akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
         
        using namespace std;
         
        int main()
        {
            ios_base::sync_with_stdio(false);
            cin.tie(NULL);
            long long int n;
            cin>>n;
            unsigned long long int s=1,c=0;
            c=pow(10,18);
           
            long long int arr[n];
            for(int i=0;i<n;i++)
            {
                cin>>arr[i];
            }
            sort(arr,arr+n);
            int flag=1;
           if(arr[0]==0)
           cout<<0<<endl;
           else
           {
            for(int i=0;i<n-1;i++)
            {
                s=s*arr[i];
                if((c/s)<arr[i+1])
                {
                    flag=0;
                    break;
                }
                
            }
            s=s*arr[n-1];
            if(flag==0)
            cout<<-1<<endl;
            if(flag==1)
              cout<<s<<endl;
           }
            return 0;
        }

Measured memory_bytes: 4376
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long LL;
typedef pair<LL,LL> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a,T b){return b?gcd(b,a%b):a;}
const LL mod=1000000007;
const LL LINF=1LL<<62;
const int INF=1<<30;
int dx[]={1,0,-1,0,1,-1,1,-1};
int dy[]={0,1,0,-1,1,-1,-1,1};


int main(){
    int n;cin >> n;
    set<int> a({2,4,5,7,9});
    set<int> b({0,1,6,8});
    int t = n % 10;
    if(a.find(t) != a.end()){
        puts("hon");
    }
    else if(b.find(t) != b.end()){
        puts("pon");
    }
    else{
        puts("bon");
    }
    return 0;
}


Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;

string s;

int main () {
	cin >> s;
	if (s[0] == s[1] and s[2] == s[3] and s[0] != s[2])
		cout << "Yes\n";
	else if (s[0] == s[2] and s[1] == s[3] and s[0] != s[1])
		cout << "Yes\n";
	else if (s[0] == s[3] and s[1] == s[2] and s[0] != s[1])
		cout << "Yes\n";	
	else
		cout << "No\n";
	return 0;
}

Measured memory_bytes: 256
N, M = map(int, input().split())
A_B = []
for i in range(N):
    A_B.append(list(map(int, input().split())))
A_B.sort()
sum = 0
money = 0
i = 0
while sum <= M and i < N:
    money += A_B[i][0] * A_B[i][1]
    sum += A_B[i][1]
    i += 1
money -= A_B[i-1][0] * (sum - M)
print(money)

Measured memory_bytes: 27760
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int d = sc.nextInt();
        int n = sc.nextInt();
        if (n == 100)
            n++;
        if (d == 0) {
            System.out.println(n);
        } else if (d == 1) {
            System.out.println(100 * n);
        } else {
            System.out.println(10000 * n);
        }
    }
}

Measured memory_bytes: 21716
#include<bits/stdc++.h>
#define fi first
#define se second
#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define rrep(i, n) for (int (i) = 1; (i) <= (n); (i++))
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define pb push_back
#define eb emplace_back
#define yn {puts("Yes");}else {puts("No");}
#define printd(x) printf("%.12f\n", ans);
template<class T> bool chmin(T& a, const T& b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> bool chmax(T& a, const T& b) {if (a < b) {a = b; return 1;} return 0;}
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main(void) {
    int n;
    cin >> n;
    
    vector<int> hozon(100, 0);

    rrep (i, n) {
        if (i % 10 == 0) continue;
        string tmp = to_string(i);
        int sento, matubi;
        matubi = tmp[tmp.size() - 1];
        sento = tmp[0];
        hozon[(sento - '0') * 10 + (matubi - '0')]++;
    }

    ll ans = 0;

    vector<bool> used(100, false);

    for (int i = 11; i <= 99; i++) {
        if (i % 10 == 0) continue;
        if (used[i]) continue;
        int fro, bac;
        fro = i / 10; bac = i % 10;
        if (fro == bac) ans += hozon[i] * hozon[i];
        else ans += hozon[i] * hozon[bac * 10 + fro] * 2;
        used[i] = used[bac * 10 + fro] = true;
    }

    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;

namespace aising2020_b
{
  class Program
  {
    static void Main(string[] args)
    {
      var N = CIn.ReadInt();
      var a = CIn.ReadIntArray(N);

      var ans = a.Where((e, i) => e % 2 == 1 && i % 2 == 0).Count();

      Console.WriteLine(ans);
    }
  }

  static class CIn
  {
    private static readonly Queue<string> fieldBuffer = new Queue<string>();

    public static string Read()
    {
      if (fieldBuffer.Count == 0)
      {
        foreach (var field in Console.ReadLine().Split())
        {
          fieldBuffer.Enqueue(field);
        }
      }
      return fieldBuffer.Dequeue();
    }

    public static int ReadInt() => int.Parse(Read());
    public static long ReadLong() => long.Parse(Read());
    public static double ReadDouble() => double.Parse(Read());

    public static string[] ReadStringArray(int n)
    {
      var array = new string[n];
      for (var i = 0; i < n; i++)
      {
        array[i] = Read();
      }
      return array;
    }

    public static int[] ReadIntArray(int n)
    {
      var array = new int[n];
      for (var i = 0; i < n; i++)
      {
        array[i] = ReadInt();
      }
      return array;
    }

    public static long[] ReadLongArray(int n)
    {
      var array = new long[n];
      for (var i = 0; i < n; i++)
      {
        array[i] = ReadLong();
      }
      return array;
    }

    public static double[] ReadDoubleArray(int n)
    {
      var array = new double[n];
      for (var i = 0; i < n; i++)
      {
        array[i] = ReadDouble();
      }
      return array;
    }

    public static char[,] ReadCharMatrix(int h, int w)
    {
      var array = new char[h, w];
      for (var i = 0; i < h; i++)
      {
        var l = Console.ReadLine().ToCharArray();
        for (var j = 0; j < w; j++)
        {
          array[i, j] = l[j];
        }
      }
      return array;
    }
  }
}


Measured memory_bytes: 28284
#include <bits/stdc++.h>
using namespace std;

int main() {
    int N;  cin >> N;
    vector<int> T(N);
    int sum = 0;
    for (int i = 0; i < N; ++i) {
        cin >> T[i];
        sum += T[i];
    }
    int M;  cin >> M;
    for (int i = 0; i < M; ++i) {
        int p, x;  cin >> p >> x;
        cout << sum - T[p - 1] + x << endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i=0;i<n;i++){
    cin >> a[i];
  }
  map<int,int> m1,m2;
  for (int i=0;i<n;i++){
    if (i%2==0){
      m1[a[i]]++;
    }
    else {
      m2[a[i]]++;
    }
  }
  int count1=0,count2=0;
  int ans1,ans2;
  for (int i=0;i<n;i++){
    if (i%2==0){
      if (count1<m1[a[i]]){
        ans1=a[i];
        count1=m1[a[i]];
      }
    }
    else {
      if (count2<m2[a[i]]){
        ans2=a[i];
        count2=m2[a[i]];
      }
    }
  }
  if (ans1!=ans2){
    cout << n-count1-count2 << endl;
  }
  else {
    int count12=0,count22=0;
    for (int i=0;i<n;i++){
      if (i%2==0&&a[i]!=ans1){
        if (count12<m1[a[i]]){;
          count12=m1[a[i]];
        }
      }
      if (i%2==1&&a[i]!=ans2){
        if (count22<m2[a[i]]){
          count22=m2[a[i]];
        }
      }
    }
    cout << min(n-count1-count22,n-count2-count12) << endl;
  }
}
  

Measured memory_bytes: 5376
#include<bits/stdc++.h>
#define lson (o<<1)
#define rson (o<<1|1)
#define fi first
#define sc second
#define dbg(x) cout<<#x<<" = "<<(x)<<endl;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
using namespace std;
const double pi=acos(-1);
const double eps=1e-6;
inline int lowbit(int x){return x&(-x);}
inline int read(){
	int f=1,x=0;char ch;
	do{ch=getchar();if(ch=='-')f=-1;}while(ch<'0'||ch>'9');
	do{x=x*10+ch-'0';ch=getchar();}while(ch>='0'&&ch<='9');
	return f*x;
}
template<typename T> inline T max(T x,T y,T z){return max(max(x,y),z);}
template<typename T> inline T min(T x,T y,T z){return min(min(x,y),z);}
template<typename T> inline T sqr(T x){return x*x;}
template<typename T> inline void checkmax(T &x,T y){x=max(x,y);}
template<typename T> inline void checkmin(T &x,T y){x=min(x,y);}
template<typename T> inline void read(T &x){
x=0;T f=1;char ch;do{ch=getchar();if(ch=='-')f=-1;}while(ch<'0'||ch>'9');
do x=x*10+ch-'0',ch=getchar();while(ch<='9'&&ch>='0');x*=f;
}
template<typename A,typename B,typename C> inline A fpow(A x,B p,C yql){
	A ans=1;
	for(;p;p>>=1,x=1LL*x*x%yql)if(p&1)ans=1LL*x*ans%yql;
	return ans;
}
struct FastIO{
	static const int S=1310720;
	int wpos;char wbuf[S];
	FastIO():wpos(0){}
	inline int xchar(){
		static char buf[S];
		static int len=0,pos=0;
		if(pos==len)pos=0,len=fread(buf,1,S,stdin);
		if(pos==len)return -1;
		return buf[pos++];
	}
	inline int read(){
		int c=xchar(),x=0;
		while(c<=32&&~c)c=xchar();
		if(c==-1)return -1;
		for(;'0'<=c&&c<='9';c=xchar())x=x*10+c-'0';
		return x;
	}
}io;
//#define read io.read
typedef pair<int, int>P;
typedef pair<int, pair<int, int> >PP;
typedef long long ll;
ll inf = -1;

int main() {
	int n; cin >> n;
	int u, v, w;
	vector<vector<int> >grid(n),cost(n);
	for (int i = 0; i < n - 1; i++) {
		cin >> u >> v >> w;
		u--; v--;
		grid[u].push_back(v);
		grid[v].push_back(u);
		cost[u].push_back(w);
		cost[v].push_back(w);
	}
	vector<int> ans(n,inf);
	queue<int>que;
	ans[0] = 0;
	que.push(0);
	while (que.empty() == false) {
		int V = que.front();
		que.pop();
		for (int i = 0; i < grid[V].size(); i++) {
			if (ans[grid[V][i]] != -1) {
				continue;
			}
			ans[grid[V][i]] = (ans[V] + cost[V][i]) % 2;
			que.push(grid[V][i]);
		}
	}
	for (int i = 0; i < n; i++) {
		cout << ans[i] << endl;
	}
	return 0;
}


Measured memory_bytes: 12800
# 03-Getting_Started-Watch.py

# ????¨?
# ?§???????????????? SS ???????????????????????§???hh:mm:ss ?????¢?????????????????????????????????????????????
# ????????§???hh ????????????mm ??? 60 ???????????????ss ??? 60 ??????????§???¨????????????

# Input
# SS ?????????????????????????????????
# Output
# hh???mm???ss ??? :??????????????????????????§??????????????????????????????????????°?????????????????´??????0 ????????????????????¨???????????????????????????????????????

# Constraints
# 0???S<86400
# Sample Input
# 46979
# Sample Output
# 13:2:59

# print("ss?????\??????")
x=int(input())
# print("ss=%d."%x)

# hh????¨????
hh=x/3600
hh_remain = x%3600

#mm????¨????
mm=hh_remain/60
mm_remain = hh_remain%60

#ss????¨????
ss=mm_remain

print ("%d:%d:%d"%(hh,mm,ss));

Measured memory_bytes: 7644
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        
        int min = Integer.MAX_VALUE;
        int max = Integer.MIN_VALUE;
        for(int i = 0; i < 5; i++) {
            int n = sc.nextInt();
            min = Math.min(min, n);
            max = Math.max(max, n);
        }

        int k = sc.nextInt();
        if(max - min > k)
            System.out.println(":(");
        else
            System.out.println("Yay!");
    }
}


Measured memory_bytes: 21716
#include<bits/stdc++.h>
#define LL long long
using namespace std;

const int N = 100000+9;

int n,cnt[N],vout,tag;

inline int read() {
	char c=getchar(); int f=1,ret=0;
	while (c<'0'||c>'9') {if(c=='-')f=-1;c=getchar();}
	while (c<='9'&&c>='0') {ret=ret*10+c-'0';c=getchar();}
	return ret * f;
}

int main() {
	n = read();
	for (int i=1;i<=n;i++) 
		cnt[read()]++;
	for (int i=1;i<N;i++) {
		if (cnt[i]) vout++;
		if (!(cnt[i]&1) && cnt[i]) tag ^= 1;
	}
	cout<<vout-tag;
	return 0;
}


Measured memory_bytes: 640
H,W,N=map(int,input().split())
p={}
for i in range(N):
    x,y=map(int,input().split())
    if y not in p:
        p[y]=set([])
    p[y].add(x)

fast={y:-1 for y in range(1,W+1)}
fast[1]=1
for i in range(2,W+1):
    nf=fast[i-1]
    pos=nf+1
    if i in p:
        while H>=pos and pos in p[i]:
            pos+=1
        if pos>H:
            break
        else:
            fast[i]=pos
    else:
        fast[i]=pos

for y in p:
    p[y]=list(p[y])
    p[y].sort()


ans=float("inf")
for i in range(1,W+1):
    if fast[i]==-1:
        break
    if i in p:
        left=fast[i]
        start=0
        end=len(p[i])-1
        while end-start>1:
            test=(end+start)//2
            if p[i][test]>left:
                end=test
            else:
                start=test
        if p[i][start]>left:
            t=p[i][start]-1
        elif p[i][end]>left:
            t=p[i][end]-1
        else:
            t=H
        ans=min(ans,t)
    else:
        ans=min(ans,H)

print(ans)

Measured memory_bytes: 112336
#include <bits/stdc++.h>

using namespace std;

#ifdef ACMTUYO
struct RTC{~RTC(){cerr << "Time: " << clock() * 1.0 / CLOCKS_PER_SEC <<" seconds\n";}} runtimecount;
#define DBG(X) cerr << #X << " = " << X << '\n';
#else
struct RTC{};
#define DBG(X)
#endif

#define fast_io() ios_base::sync_with_stdio(false)
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
#define sz(x) ((int)(x).size())
#define all(c) (c).begin(),(c).end()
#define forn(i, n) for (int i = 0; i < (n); i++)
typedef long long int number;

int main() {
  fast_io();
  string s;
  cin >> s;
  int cnt = 0;
  int maxi = 0;
  forn (i, sz(s)) {
    if (s[i] == 'R') {
      cnt++;
    } else {
      cnt = 0;
    }
    maxi = max(maxi, cnt);
  }
  cout << maxi << '\n';
  return 0;
}


Measured memory_bytes: 3644
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
#define MP make_pair
#define PB push_back
#define REP(i, a, b) for(int i = a; i < b; i++)
#define PER(i, a, b) for(int i = b - 1; i >= a; i--)

const int maxn = 100 + 10;

int t[maxn], v[maxn];
double minv[maxn], sum[maxn];

int main() {
	double time = 0;
	double speed = 0;
	double ans = 0;

	int N; scanf("%d", &N);
	REP(i, 0, N) { scanf("%d", t + i); sum[i + 1] = t[i] + sum[i]; }
	REP(i, 0, N) scanf("%d", v + i);
	minv[N] = sum[N];
	PER(i, 0, N) minv[i] = min(sum[i] + v[i], minv[i + 1]);
	REP(i, 0, N) {
		REP(j, 0, t[i] * 2) {
			time += 0.5;
			PER(d, -1, 2) {
				double nspeed = speed + 0.5 * d;
				if(nspeed <= v[i] && nspeed <= minv[i+1]-time) {
					ans += (double)(speed + nspeed) / 4;
					speed = nspeed;
//					printf("%d: %d\n", time, speed);
					break;
				}
			}
		}
	}

	printf("%.10f\n", ans);

	return 0;
}


Measured memory_bytes: 128
function main(input) {
    var N = input[0].split(" ")[0]-0;
    var X = input[0].split(" ")[1]-0;
    var list = [];
    var sum = 0;
    for(var i=1;i<=N;i++) {sum += (input[i]-0); list.push(input[i]-0);}
    list.sort((a,b)=>a-b);
    X-=sum;
    console.log(N+Math.floor(X/list[0]));
}
main(require('fs').readFileSync('/dev/stdin', 'utf8').trim().split("\n"))


Measured memory_bytes: 7500
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<cassert>
#define PB push_back
#define MP make_pair
#define sz(v) (in((v).size()))
#define forn(i,n) for(in i=0;i<(n);++i)
#define forv(i,v) forn(i,sz(v))
#define fors(i,s) for(auto i=(s).begin();i!=(s).end();++i)
#define all(v) (v).begin(),(v).end()
using namespace std;
typedef long long in;
typedef vector<in> VI;
typedef vector<VI> VVI;
in n,a,b;
VI h;
bool isk(in c){
  in nd=0;
  forn(i,n){
    nd+=(max(h[i]-c*b,0LL)+a-1)/a;
  }
  return nd<=c;
}
int main(){
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin>>n>>a>>b;
  a-=b;
  h.resize(n);
  forn(i,n)
    cin>>h[i];
  in mn=0;
  in mx=1e9+10;
  in md;
  while(mx-mn>1){
    md=(mx+mn)/2;
    if(isk(md))
      mx=md;
    else
      mn=md;
  }
  cout<<mx<<endl;
  return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<string>
using namespace std;
int main(void){
  string a,b;
  cin>>a>>b;
  size_t sizeA=a.length();
  size_t sizeB=b.length();
  if(sizeA>sizeB)cout<<"GREATER"<<endl;
  else if(sizeA<sizeB)cout<<"LESS"<<endl;
  else{
    int result=a.compare(b);
    if(result>0)cout<<"GREATER"<<endl;
    else if(result<0)cout<<"LESS"<<endl;
    else cout<<"EQUAL"<<endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MOD = 1000000007;
#define dame { puts("-1"); return 0;}
#define yn {puts("YES");}else{puts("NO");}

int count_digits(ll N) {
  int d = 0;
  while(N > 0) {
    N /= 10;
    d++;
  }
  return d;
}
  
int main() {
  ll N;
  cin >> N;
  int ans = count_digits(N);
  for(ll a = 1ll;a*a <= N;a++) {
    if(N%a != 0) continue;
    ll b = N / a;
    ans = min(ans,count_digits(b));
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Majk
 */

#include <vector>
#include <iostream>
#include <unordered_map>
#include <map>
#include <iomanip>
#include <functional>
#include <algorithm>
#include <cassert>
#include <cmath>
#include <string>
#include <sstream>
#include <queue>
using namespace std;

#define x first
#define y second
constexpr int MOD = 1000000007;

typedef std::pair<int,int> pii;
typedef long long ll;

template<typename T>std::istream&operator>>(std::istream&i,vector<T>&t) {for(auto&v:t){i>>v;}return i;}
template<typename T>std::ostream&operator<<(std::ostream&o,const vector<T>&t) {for(size_t i=0;i<t.size();++i){o<<t[i]<<" \n"[i == t.size()-1];}return o;}

namespace std {
    template<typename T,typename U>struct hash<pair<T,U>>{hash<T>t;hash<U>u;size_t operator()(const pair<T,U>&p)const{return t(p.x)^(u(p.y)<<7);}};
}
template<typename T,typename F>T bsh(T l,T h,const F&f){T r=-1,m;while(l<=h){m=(l+h)/2;if(f(m)){l=m+1;r=m;}else{h=m-1;}}return r;}
template<typename T,typename F>T bsl(T l,T h,const F&f){T r=-1,m;while(l<=h){m=(l+h)/2;if(f(m)){h=m-1;r=m;}else{l=m+1;}}return r;}
template<typename T> T gcd(T a,T b) { if (a<b) swap(a,b); return b?gcd(b,a%b):a; }

// #include "../l/mod.h"

class C {
public:
	void solve(istream& cin, ostream& cout) {
		int N; cin >> N;
		int B; cin >> B;
		ll A[3] = {B, -1000000000000000LL, -1000000000000000LL};
		for (int i = 0; i < N-1; ++i) {
			char c; cin >> c;
			cin >> B;

			if (c == '+') {
				A[0] = max(A[0], A[1]) + B;
				A[1] -= B;
			} else {
				A[2] = max(A[1], A[2]);
				A[0] -= B;
				A[1] -= B;
				A[1] = max(A[0], A[1]);
			}

			A[2] = A[2] + B;
		}

		cout << max(A[0], max(A[1], A[2])) << endl;
	}
};


int main() {
	ios_base::sync_with_stdio(false);
	C solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 256
n = gets.to_i
a = Array.new(n).map{Array.new(n,true)}
b = Array.new((n+1)/2).map{[]}
(n/2).times do |i|
    b[i] << i
end
if n%2 == 1
    b[-1] << n-1
end
(n/2).times do |i|
    b[i] << n-i-1
    b[i][1] -= 1 if n%2 == 1
end
b.each do |arr|
    arr.each do |x|
        arr.each do |y|
            a[x][y] = false
        end
    end
end
ans = []
for i in 0..n-2
    for j in i+1..n-1
        ans << [i+1,j+1] if a[i][j]
    end
end
puts ans.size
ans.each do |arr|
    puts arr.join(" ")
end

Measured memory_bytes: 2428
//ｺｯwwｺｯwwｺｹｯwwwｺｯwwｺｹｯwwwｺｹｯｺｯwwwｺｯwwｺｯwwｺｹｯwwwｺｯwwｺｹｯwwwｺｹｯｺｯwwwｺｹｰｰｰｰｯ!!!wwwwwｺｯwwｺｯwwｺｹｯwwwｺｯwwｺｹｯwwwｺｹｯｺｯwwwｺｯwwｺｯwwｺｹｯwwwｺｯwwwｺｹｯwwwｺｹｯｺｯwwwｺｹｰｰｰｰｯ!!!wwwwwｺｹｯｺｯｯｺｰｰｰｰ!!!!!!wwwwwwwwwww
import java.util.*;
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int a = sc.nextInt();
        int b = sc.nextInt();
        System.out.println(Math.min(n * a , b));
    }
}

Measured memory_bytes: 35848
#include <iostream>
#include <set>
#include <queue>
#include <vector>
#include <algorithm>
#include <math.h>
#include <cmath>
#include <string>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
#include <tuple>
#include <numeric>
#include <functional>
#include <unordered_map>

using namespace std;

/*-----------------------------------------------------------------------------
　定義
 -------------------------------------------------------------------------------*/
#define ALL(a)			(a).begin(),(a).end()
#define REP(i, n)		for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n)	for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define INF				2e9
#define MOD				(1000 * 1000 * 1000 + 7)
#define Ceil(x, n)		(((((x))+((n)-1))/n))		/* Nの倍数に切り上げ割り算 */
#define CeilN(x, n)		(((((x))+((n)-1))/n)*n)		/* Nの倍数に切り上げ */
#define FloorN(x, n)	((x)-(x)%(n))				/* Nの倍数に切り下げ */
#define IsOdd(x)		(((x)&0x01UL) == 0x01UL)			
#define IsEven(x)		(!IsOdd((x)))						
#define M_PI			3.14159265358979323846
typedef long long		ll;
typedef pair<ll, ll>	P;

/*-----------------------------------------------------------------------------
　処理
 -------------------------------------------------------------------------------*/
int main()
{
	int N, Y;
	cin >> N >> Y;
	Y /= 1000;

	int diff = N * 10 - Y;
	if (diff < 0) {
		cout << "-1 -1 -1" << endl;
		return 0;
	}

	int n1000Max = diff / 9;
	for (int n1000 = 0; n1000 <= n1000Max; n1000++) {
		int nokori = diff - n1000 * 9;
		int n5000 = nokori / 5;
		if (nokori % 5 == 0) {
			if (n5000 + n1000 <= N) {
				int n10000 = N - n5000 - n1000;
				cout << n10000 << " " << n5000 << " " << n1000 << endl;
				return 0;
			}
		}
	}

	cout << "-1 -1 -1" << endl;
	return 0;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;

int main(){
	int N,M;
	string str;
	bool jud;
	bool f;

	cin >> N >> M;
	str="000";

	jud=true; f=true;
	for(int i=0; i<M; i++){
		int s,c;
		cin >> s >> c;
		if(s==1)f=false;
		if(str.at(s-1)!='0' && str.at(s-1)!=c+'0'){ jud=false;}
		str.at(s-1)=c+'0';
	}
	if(N>1 && str.at(0)=='0' && f)str.at(0)='1';
	if(str.at(0)=='0' && N!=1){ jud=false; }



	if(jud){
		for(int i=0; i<N; i++)
			cout << str.at(i);
		cout << endl;
	}
	else {cout << "-1" << endl;}
}

Measured memory_bytes: 256
n, m = map(int, input().split())
lr_list = [list(map(int, input().split())) for _ in range(m)]
max_l = 1
min_r = n
for lr in lr_list:
    max_l = max(max_l, lr[0])
    min_r = min(min_r, lr[1])
print(max(0, min_r - max_l + 1))

Measured memory_bytes: 27336
#include <bits/stdc++.h>
#define ll long long
#define lsb(x) (x & -x)

using namespace std;

const int MOD = 1000000007;

void dfs(int node, int dad, const vector<vector<int>> &g, vector<vector<ll>> &dp) {
    bool isleaf = 1;
    for(auto it : g[node]) {
        if(it != dad) {
            dfs(it, node, g, dp);
            isleaf = 0;
        }
    }

    dp[node][0] = dp[node][1] = 1;
    if(!isleaf) {
        for(auto it : g[node]) {
            if(it != dad) {
                dp[node][1] = (dp[node][1] * dp[it][0]) % MOD;
                dp[node][0] = (dp[node][0] * ((dp[it][1] + dp[it][0]) % MOD)) % MOD;
            }
        }
    }
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    //freopen("a.in", "r", stdin);

    int n;
    cin >> n;
    vector<vector<int>> g(n + 1);
    for(int i = 1; i < n; i ++) {
        int x, y;
        cin >> x >> y;
        g[x].push_back(y);
        g[y].push_back(x);
    }

    vector<vector<ll>> dp(n + 1, vector<ll> (2, 0));
    dfs(1, 0, g, dp);

    int ans = (dp[1][1] + dp[1][0]) % MOD;
    cout << ans;

    return 0;
}


Measured memory_bytes: 18176
#include <cstdio>
const int N = 100001;
int main () {
    int i, k;
    char s[N];
    scanf("%s", &s);
    for(k=i=1;s[i];i++)
        s[i]==s[i-1]?k:k++;
    printf("%d\n",k-1);
    return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in) ;
    String S = sc.next();
    int check =0;
    for (int i=0; i<3; i++) {
      if (S.charAt(i) == S.charAt(i+1)) {
        check++;
      }
    }
    if (check != 0) {
      System.out.println("Bad");
    } else {
      System.out.println("Good");
    }
  }
}

Measured memory_bytes: 22868
import sys

sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    N = list(map(int, input().split()))
    print("YES" if 1 in N and 9 in N and 7 in N and 4 in N else "NO")


if __name__ == '__main__':
    resolve()


Measured memory_bytes: 2940
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0;i < (int)(n);i++)
using ll = long long;
const ll MOD=1000000007;
const long long INF = 1LL << 60;
const double pi=acos(-1.0);

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

ll my_pow(long long x, long long n) {
    long long ret = 1;
    while (n > 0) {
        if (n & 1) ret = ret * x;  // n の最下位bitが 1 ならば x^(2^i) をかける
        x = x * x;
        n >>= 1;  // n を1bit 左にずらす
    }
    return ret;
}

int main()
{
  ll N; cin>>N;
  vector<ll> A(N+1); rep(i,N+1) cin>>A[i];
  
  //上から抑える
  vector<ll> msum(N+1,1);
  if(msum[0]-A[0]<0) {cout<<-1<<endl; return 0;}
  rep(i,N){
    msum[i+1]=min(INF,(msum[i]-A[i])*2);
    if(msum[i+1]-A[i+1]<0) {cout<<-1<<endl; return 0;}
  }
  
  //下から抑える
  ll sum=0,ans=0;
  for(int i=N;i>=0;i--){
    sum=min(sum+A[i],msum[i]);
    ans+=sum;
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 4768
#include <bits/stdc++.h>
#define rep(i,a,b) for(ll i=ll(a);i<ll(b);i++)
#define irep(i,a,b) for(ll i=ll(a);i>=ll(b);i--)
#define pb push_back
#define mp make_pair
#define F .first
#define S .second 
using ll=long long;
using ld=long double;
using namespace std;
const ll mod=1e9+7;
ll a[110000];
int main(){
    ll n,k,l,ans=0,tmp=0;
    string s;
    cin>>s;
    if(s[0]=='S')cout<<"Cloudy";
    else if(s[0]=='C')cout<<"Rainy";
    else cout<<"Sunny";

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using pint = pair<int, int>;
using ll = long long;
using pll = pair<ll, ll>;
#define FOR(i, begin, end) for (int i = (begin), i##_end_ = (end); i < i##_end_; i++)
#define IFOR(i, begin, end) for (int i = (end)-1, i##_begin_ = (begin); i >= i##_begin_; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#define VREP(s, ite) for (auto ite = s.begin(); ite != s.end(); ++ite)
#define FI first
#define SE second
//#define endl "\n"
#define ciosup  \
    cin.tie(0); \
    ios::sync_with_stdio(false);
#define eb emplace_back
#define vint vector<int>
constexpr ll INF = 1e9 + 7;
constexpr ll MOD = 2019;

int main()
{
    ciosup;
    ll l, r;
    cin >> l >> r;
    if (l == 0){
        cout << 0 << endl;
    }else{
        if (r-l <= 2050){
            ll ans = INF;
            FOR(i, l, r + 1)
            {
                FOR(j,l,r+1){
                    if (i < j){
                        ll hid = i;
                        hid = (hid * j) % MOD;
                        ans = min(ans, hid);
                    }
                }
            }
            cout << ans << endl;
        }
        else
        {
            cout << 0 << endl;
        }
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0;i<(int)(n);++i)
#define rep1(i, n) for(int i=1;i<=(int)(n);++i)
#define irep(i, a, n) for(int i=a;i<(int)(n);++i)
#define rrep(i, n) for(int i=(int)(n)-1;i>=0;--i)
#define rrep1(i, n) for(int i=(int)(n);i>=1;--i)
#define allrep(V, v) for(auto&& V:v)
#define all(x) (x).begin(),(x).end()
typedef long long lint;
const int INF=1<<29;
const double EPS=1e-9;
using namespace std;


int main (void)
{
  double xa,ya,xb,yb,xc,yc,xd,yd;
  while(scanf("%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf",&xa,&ya,&xb,&yb,&xc,&yc,&xd,&yd)!=EOF){
    double area1,area2;
    area1=abs((xa-xb)*(yc-yb)-(ya-yb)*(xc-xb))+abs((xa-xd)*(yc-yd)-(ya-yd)*(xc-xd));
    area2=abs((xb-xa)*(yd-ya)-(yb-ya)*(xd-xa))+abs((xb-xc)*(yd-yc)-(yb-yc)*(xd-xc));

    cout << (area1==area2 ? "YES" : "NO") << endl;
  }
  return 0;
}


Measured memory_bytes: 3196
import java.util.Scanner;

public class Main {
	static double dp[][];
	static int X, Y, Z;
	static int V[];
	static int m_kinds[];
	static int m_values[];

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while (true) {
			X = sc.nextInt();
			Y = sc.nextInt();
			Z = sc.nextInt();
			if (X == 0)
				break;
			V = new int[X];
			for (int i = 0; i < X; i++) {
				V[i] = sc.nextInt();
			}
			m_kinds = new int[Y+1];
			m_values = new int[Y+1];
			for (int i = 0; i < Z; i++) {
				int n = sc.nextInt();
				m_kinds[n] = sc.nextInt(); 
				m_values[n] = sc.nextInt(); 
			}
			dp = new double[Y+1][5001];
			dp[0][0] = 1;
			System.out.println((int)DP());
		}		
	}

	private static double DP() {
		for (int i = 0; i < Y; i++) {
			for (int j = 0; j < 5001; j++) {
				if (dp[i][j] > 0) {
					for (int k = 0; k < X; k++) {
						int to = i + V[k];
						if (to > Y) to = Y;
						int money = j;
						switch (m_kinds[to]) {
						case 1:
							to += m_values[to];
							if (to > Y) to = Y;
							break;
						case 2:
							money += m_values[to];
							break;
						case 3:
							money -= m_values[to];
							if (money < 0 ) money = 0;
							break;
						}
						dp[to][money] += (dp[i][j] / X);
					}
				}
			}
		}
        double exp = 0;
        for (int i = 0; i < 5001; i++) {
            exp += (dp[Y][i] * i);
        }
        return exp;
	}
}

Measured memory_bytes: 61460
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007
#define INF (1e9)
#define PI (acos(-1))
#define print(x) cout << x << endl
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl

int main() {
    int X, ans = 1;
    cin >> X;

    for (int i=2; i<sqrt(X)+1; ++i) {
        for (int j=2; ; ++j) {
            int p = (int)pow(i, j);
            if (p <= X) ans = max(ans, p);
            else break;
        }
    }

    cout << ans << endl;
}




Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;

#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define REP(i, n)  FOR(i, 0, n)
#define ASC(c) sort((c).begin(), (c).end())
#define DESC(c) sort((c).begin(), (c).end(), greater<int>())

#define DUMP(x)  cerr << #x << " = " << (x) << endl;
#define DEBUG(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

typedef long long ll;
typedef unsigned long long ull;
struct edge { int u, v; ll w; };
 
ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

int main() {
  int N, T; cin >> N >> T;
  vector<int> c(N), t(N);
  REP(i, N) cin >> c[i] >> t[i];
  int ans = 1001;
  REP(i, N) if (t[i] <= T && c[i] < ans) ans = c[i];
  if (ans == 1001) cout << "TLE" << endl;
  else cout << ans << endl;
}


Measured memory_bytes: 888
#include <stdio.h>
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <queue>
#include <set>
#include <vector>
#include <string>
#include <cstring>
#include <algorithm>
#include <cmath>

int main(){

  long long int N, M, tmp;
  std::string result;

  std::vector<long long int> p, res;

  scanf("%lld%lld", &N, &M);
  for(long long int i = 0; i < M; i++){
    scanf("%lld", &tmp);
    std::cin >> result;
    p.push_back(tmp-1);
    if(result == "AC"){
      res.push_back(1);
    }
    else if(result == "WA"){
      res.push_back(0);
    }
    else{
      res.push_back(-1);
    }
  }

  /*for(long long int i = 0; i < M; i++){
    std::cout << res[i] << " ";
  }std::cout << std::endl;*/
  
  long long int clear = 0, penalty = 0;
  std::vector<long long int> count(N);

  for(long long int i = 0; i < M; i++){
    // clear new problem
    if(res[i] == 1 && count[p[i]] >= 0){
      penalty += count[p[i]];
      clear++;
      count[p[i]] = -1;
    }
    // WA
    if(res[i] == 0 && count[p[i]] >= 0){
      count[p[i]]++;
    }
  }

  std::cerr << "Answer: " << std::endl;
  std::cout << clear << " " << penalty << std::endl;

  return 0;
}


Measured memory_bytes: 2796
#include <bits/stdc++.h>
using namespace std;

int main() {
    int out=0;
    int sums=0;
    string s;
    cin>>s;
    for(int i=0;i<s.length();i++)
    {
        if(s[i]=='S')sums++;
        else
        {
            if(sums==0)out++;
            else sums--;
        }
    }
    cout<<out*2<<endl;
    return 0;
}


Measured memory_bytes: 640
<?php

  $line = [
    trim(fgets(STDIN)),
    trim(fgets(STDIN))
  ];

  $base = explode(' ', $line[0]);
  $l = explode(' ', $line[1]);
  foreach ($l as $k => $v) $l[$k] = (int)$v;

  $r = [0];
  foreach ($l as $k => $v) {
    if ($k === 0) {
      $r[] = $v;
      continue;
    }
    $r[] = $r[$k] + $v;
  }

  $n = 0;
  foreach ($r as $v) {
    if ($v <= $base[1]) $n++;
  }

  echo $n.PHP_EOL;

?>


Measured memory_bytes: 4728
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include <iomanip>
using namespace std;
#define rep(i,n) for(int i = 0;i<n;i++)
const long long MOD = 1000000007LL;
const string alpha = "abcdefghijklmnopqrstuvwxyz";
//aのMODbでの逆元
long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
int main(){
    int n,k;
    cin >> n >> k;
    long long a[n];
    rep(i,n) cin >> a[i];
    long long comb[n];
    comb[k-1]=1;
    for(int i = k;i<n;i++){
        long long tmp = i;
        comb[i]=comb[i-1]*tmp;
        comb[i]%=MOD;
        comb[i]*=modinv(tmp-k+1,MOD);
        comb[i]%=MOD;
    }
    long long ans = 0;
    sort(a,a+n);
    for(int i = k-1;i<n;i++){
        long long tmp = comb[i]*a[i];
        tmp%=MOD;
        ans+=tmp;
        ans%=MOD;
    }
    rep(i,n-k+1){
        long long tmp = comb[n-1-i]*a[i];
        tmp%=MOD;
        ans-=tmp;
        ans%=MOD;        
    }
    if(ans<0) ans+=MOD;
    cout << ans << endl;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
#include <stdlib.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> P;
typedef priority_queue<P,vector<P>,greater<P>> P_queue;

#define REP(i,a,b) for(int i=(int)a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define mp make_pair
#define ALL(a) a.begin(),a.end()
#define SORT(a) sort(ALL(a))
#define U_ERASE(V) V.erase(unique(ALL(V)), V.end());

const ll MOD=998244353;
const ll mod=1000000007;
const ll INF=1e15;
vec dx={1,0,-1,0};
vec dy={0,1,0,-1};

int main(){
    ll N,K; cin>>N>>K;
    ll ans=0;
    REP(i,K,N+2){
        ans+=(i*(N-i+1));
        ans++;
        ans%=mod;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>

using namespace std;

const int MX=505;
int h,w;
char a[MX][MX];

int main(){
	scanf("%d%d",&h,&w);
	for(int i=1;i<=h;i++)scanf("%s",a[i]+1);
	for(int i=1;i<=h;i++){
		for(int j=1;j<=w;j++)
			putchar(a[i][j]=='#'||(j!=w&&(j==1||(i&1)))?'#':'.');
		puts("");
	}
	puts("");
	for(int i=1;i<=h;i++){
		for(int j=1;j<=w;j++)
			putchar(a[i][j]=='#'||(j!=1&&(j==w||!(i&1)))?'#':'.');
		puts("");
	}
	return 0;
}

Measured memory_bytes: 1024
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long; 
using pii =  pair<int, int>;
using pll =  pair<long long, long long>;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
//constexpr long long MOD = 998244353LL;
template<class T, class U> inline bool chmax(T &a, U b) { if (a < b) { a = b; return true;} return false; }
template<class T, class U> inline bool chmin(T &a, U b) { if (a > b) { a = b; return true;} return false; }
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    
    int a; cin >> a;
    string s; cin >> s; 
    string ans;

    if(a >= 3200) ans = s;
    else ans = "red";
    
    cout << ans << ln;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
using ll = long long;
#define int ll

signed main(){
    int H,W;
    cin >> W >> H;
    vector<int>p(W),q(H);
    for(auto & e : p) cin >> e;
    for(auto & e : q) cin >> e;
    using pi = pair<int,int>;
    vector<pi>v;
    for(auto e : p)
        v.push_back({e,1});
    for(auto e : q)
        v.push_back({e,0});
    sort(v.begin(),v.end());
    int pc = 0,qc = 0;
    int sum = 0;
    for(auto e : v){
        int cost = e.first, isP = e.second;
        if(isP){
            int cnt = H - qc + 1;
            sum += cnt * cost;
            ++pc;
        } else {
            int cnt = W - pc + 1;
            sum += cnt * cost;
            ++qc;
        }
    }
    cout << sum << endl;
}


Measured memory_bytes: 8048
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int maxn=1e6+5;
int main() {
	string s;cin>>s;
	int ans=0;
	for(int i=1;i<s.length();i++) {
		if(s[i]!=s[i-1]) ans++;
	}   
	cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3752
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>
#include <stack>
#include <assert.h>
#include <unordered_set>
#include <random>


using namespace std;
using ll = long long;
using ull = unsigned long long;

const ll INF = 1e18;
const ll MOD = 1e9 + 7;

#define REP(i, n) for(ll i = 0; i < n; i++)

















int main(){
    ll n, m;
    cin >> n >> m;
    vector<ll> a(n);
    ll sum = 0;
    REP(i, n){
        cin >> a[i];
        sum += a[i];
    }
    ll cnt = 0;
    REP(i, n){
        if(a[i] >= sum * 1.0 / (double)(4.0 * m)) cnt++;
    }
    cout << ((cnt >= m)? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[]T = new int[N];
		for(int i = 0; i < N; i++) {
			T[i] = sc.nextInt();
		}
		int M = sc.nextInt();
		int[]P = new int[M];
		int[]X = new int[M];
		for(int i = 0; i < M; i++) {
			P[i] = sc.nextInt();
			X[i] = sc.nextInt();
		}
		sc.close();
		int sum = 0;
		for(int i = 0; i < N; i++) {
			sum += T[i];
		}
		StringBuilder sb = new StringBuilder();
		for(int i = 0; i < M; i++) {
			int t = sum - T[P[i] - 1] + X[i];
			sb.append(t).append("\n");
		}
		System.out.print(sb.toString());
	}
}

Measured memory_bytes: 23252
#include <bits/stdc++.h>

using namespace std;

using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template<typename Q_temp>
using smaller_queue = priority_queue <Q_temp, vector<Q_temp>, greater<Q_temp> >;

const int INF = (int) 1e9;
const ll LINF = (ll) 4e18;
const ll MOD = (ll) (1e9 + 7);
const double PI = acos(-1.0);
const int limit = 100010;

#define REP(i,m,n) for(ll i = m; i < (ll)(n); ++i)
#define rep(i,n) REP(i, 0, n)
#define MP make_pair
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << endl
#define NP(v) next_permutation(v.begin(),v.end())
#define debug(x) cout << #x << ":" << x << endl;
#define debug2(x) for(auto a : x) cout << a << " "; cout << endl;
#define debug3(x) rep(i, sizeof(x)) cout << x[i] << " "; cout << endl;

vector<pii> around = {MP(1, 0), MP(-1, 0), MP(0, 1), MP(0, -1)};

//------------------------------------------------------

class UnionFind {
public:
    vector<int> par, rank_;

    UnionFind(int n = limit) : par(n), rank_(n, 0) {
        rep(i, n) par[i] = i;
    }

    int root(int x) {
        return par[x] == x ? x : par[x] = root(par[x]);
    }

    bool same(int x, int y) {
        return root(x) == root(y);
    }

    void unite(int x, int y) {
        x = root(x);
        y = root(y);
        if (x == y) return;

        if (rank_[x] < rank_[y]) {
            par[x] = y;
        } else {
            par[y] = x;
            if (rank_[x] == rank_[y]) rank_[x]++;
        }
    }
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);

    UnionFind uf;
    int n, q;
    cin >> n >> q;

    rep(i, q) {
        int com, x, y;
        cin >> com >> x >> y;
        if (com == 0) uf.unite(x, y);
        else cout << uf.same(x, y) << endl;
    }

    return 0;
}




Measured memory_bytes: 3508
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main(){

    input!{
        s: chars,
    }

    let ss: String = s.into_iter().collect();

    if ss=="ARC" {
        println!("ABC");
    } else if ss=="ABC" {
        println!("ARC");
    } else {
        return;
    }

    return;
}

Measured memory_bytes: 2076
def examA():
    N, R = LI()
    ans = R+100*max(0,(10-N))
    print(ans)
    return

def examB():
    N, K = LI()
    ans = 1
    while(N>=K):
        N //=K
        ans += 1
    print(ans)
    return

def examC():
    N = I()
    X = LI()
    ans = inf
    for i in range(101):
        cur = 0
        for x in X:
            cur += (i-x)**2
        ans = min(ans,cur)
    print(ans)
    return

def examD():
    def cmb(n, r, mod):
        cur = 1
        for i in range(r):
            cur *= (n-i)
            cur %= mod
        for i in range(r):
            cur *= pow(i+1,mod-2,mod)
            cur %= mod
        return cur
    n, a, b = LI()
    ans = pow(2,n,mod) - cmb(n,a,mod) - cmb(n,b,mod) -1
    ans = (ans+mod*2)%mod
    print(ans)
    return

def examE():
    ans = 0
    print(ans)
    return

def examF():
    ans = 0
    print(ans)
    return

import sys,copy,bisect,itertools,heapq,math,random
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet,_ep
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
_ep = 10**(-12)
alphabet = [chr(ord('a') + i) for i in range(26)]

if __name__ == '__main__':
    examD()

"""

"""

Measured memory_bytes: 40048
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)

long long int ans = 0;
string S;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cin >> S;
	long long int len = S.size();
	int cnt = 0,lookup = 0;
	bool flag = false;
	REP(i,len){
		if(S[i] == 'B'){
			flag = true;
			cnt++;
		}else{
			if(flag){
				if(S[i] == 'W'){
					ans += i - lookup++;
				}
			}else{
				lookup++;
			}
		}
	}
	cout << ans << endl;

}


Measured memory_bytes: 720
def main():
    x = int(input())
    ans1 = x//11
    ans2 = x - 11*ans1
    ans = (ans1 * 2)
    if ans2 == 0:
        pass
    elif ans2 <= 6:
        ans += 1
    else:
        ans += 2
    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 38384
//<============ Author --> @venom ============>//
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

#define fo(i,n)           for(int i=0;i<n;i++)
#define int               long long
#define pb                emplace_back
#define mp                make_pair
#define ff                first
#define ss                second
#define all(x)            x.begin(), x.end()
#define sortall(x)        sort(all(x))
#define sortrev(x)        sort(all(x), greater<int>())
#define w(x)              int x; cin>>x; while(x--)
#define trunc(x,y)        fixed<<setprecision(y)<<x
#define mk(arr, n, type)  type *arr=new type[n];
#define PI                3.1415926535897932384626
#define mod               1000000007
#define inf               1e9 + 5
#define FIO               ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
typedef pair<int, int>    pi;
typedef vector<int>       vi;
typedef vector<pi>        vpi;
typedef vector<vi>        vvi;
typedef tree<int, null_type, less<int>, rb_tree_tag,
        tree_order_statistics_node_update> indexed_set;
const int N = 3e5, M = N;
int mpow(int base, int exp);
int gcd(int a, int b) {if (a == 0) return b; return gcd(b % a, a);}
//<----------------------------------------------------------------------------->//
void fastIO()
{
  FIO;
#ifndef ONLINE_JUDGE
  // for getting input from input.txt
  freopen("input.txt", "r", stdin);
  // for writing output to output.txt
  freopen("output.txt", "w", stdout);
#endif
}

struct item
{
  int wt;
  int val;
};

int solve(vector<item> ar, int n, int W)
{
  int dp[n + 1][W + 1];

  for (int w = 0; w <= W; w++)
    dp[1][w] = 0;

  dp[1][ar[1].wt] = ar[1].val;

  for (int i = 2; i <= n; i++)
  {
    for (int w = 0; w <= W; w++)
    {
      dp[i][w] = dp[i - 1][w];

      if (ar[i].wt > w)
        continue;

      dp[i][w] = max(dp[i][w], dp[i - 1][w - ar[i].wt] + ar[i].val);
    }
  }

  return *max_element(dp[n], dp[n] + W + 1);
}

int32_t main()
{
  FIO;

  int n, w;
  cin >> n >> w;

  vector<item> v(n + 1);

  for (int i = 1; i <= n; i++)
  {
    cin >> v[i].wt >> v[i].val;
  }

  cout << solve(v, n, w);

  return 0;
}

int mpow(int base, int exp) {
  base %= mod;
  int result = 1;
  while (exp > 0) {
    if (exp & 1) result = ((int)result * base) % mod;
    base = ((int)base * base) % mod;
    exp >>= 1;
  }
  return result;
}

Measured memory_bytes: 78336