akhauriyash/Code-Regression huggingface dataset:
n, m = map(int, input().split())

ac = [False]*n
wa = [0]*n

for i in range(m):
    no, re = input().split()
    no = int(no) - 1
    if re == "AC":
        ac[no] = True
    else:
        if not ac[no]:
            wa[no] += 1

a = sum(ac)
b = 0
for i in range(n):
    if ac[i]:
        b += wa[i]

print("{} {}".format(a, b))

Measured memory_bytes: 45528
import sys
from collections import *
import heapq
import math
from math import gcd
import bisect
import copy
from itertools import permutations,accumulate,combinations,product
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

n=int(input())
m=math.pi
print(2*n*m)

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

int main() {
  int N,M; cin>>N>>M;
  vector<int> vec(N);
  
  for(int i=0; i<2*M; i++){
    int s; cin>>s;
    vec.at(s-1)++;
  }
  
  for(int i=0; i<N; i++) cout<<vec.at(i)<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; 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)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}

int main() {
    int n;
    cin >> n;

    if(n%2==1){
        cout << n*(n-1)/2 - n/2 << endl;
        srep(i,1,n+1){
            srep(j,1,n+1){
                if(i==j)continue;
                if(i>j)continue;
                if(i+j==n)continue;
                cout << i << ' ' << j << endl;
            }
        }
    }else{
        cout << n*(n-1)/2 - n/2 << endl;
        srep(i,1,n+1){
            srep(j,1,n+1){
                if(i==j)continue;
                if(i>j)continue;
                if(i+j==n+1)continue;
                cout << i << ' ' << j << endl;
            }
        }
    }

        

    return 0;
}
 
 


Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<cmath>
#include<algorithm>
#include<cstring>
#include<cstdlib>
#include<ctime>
#include<vector>
#include<set>
#include<map>
#include<queue>
using namespace std;
#define li long long
#define gc getchar()
#define pc putchar
li read(){
	li x = 0,y = 0,c = gc;
	while(!isdigit(c)){y = c;c = gc;}
	while(isdigit(c)){x = (x << 1) + (x << 3) + (c ^ '0');c = gc;}
	return y == '-' ? -x : x;
}
void print(li x){
	if(x < 0){pc('-');x = -x;}
	if(x >= 10) print(x / 10);
	pc(x % 10 + '0');
}
void file(){freopen(".in","r",stdin);freopen(".out","w",stdout);}
int n,a[200010];
li s[200010];
int main(){
	//file();
	int i,j,l,r,mid,nw;
	n = read();
	for(i = 1;i <= n;++i) a[i] = read(),s[i] = s[i - 1] + a[i];
	li ans = 1e18;
	li w[4];
	for(i = 2;i < n - 1;++i){
		l = 1;r = i;nw = 1;
		while(l <= r){
			mid = l + r >> 1;
			if(s[mid] < s[i] - s[mid]){
				nw = mid;
				l = mid + 1;
			}
			else r = mid - 1;
		}
		if(abs(s[nw] - (s[i] - s[nw])) < abs(s[nw + 1] - (s[i] - s[nw + 1]))){
			w[0] = s[nw];w[1] = s[i] - s[nw];
		}
		else{
			w[0] = s[nw + 1];w[1] = s[i] - s[nw + 1];
		}
		//cerr<<nw<<endl;
		l = i + 1;r = n,nw = i + 1;
		while(l <= r){
			mid = l + r >> 1;
			if(s[mid] - s[i] < s[n] - s[mid]){
				nw = mid;
				l = mid + 1;
			}
			else r = mid - 1;
		}
		if(abs(s[nw] - s[i] - (s[n] - s[nw])) < abs(s[nw + 1] - s[i] - (s[n] - s[nw + 1]))){
			w[2] = s[nw] - s[i];w[3] = s[n] - s[nw];
		}
		else{
			w[2] = s[nw + 1] - s[i];w[3] = s[n] - s[nw + 1];
		}
		//cerr<<nw<<endl;
		sort(w + 0,w + 4);
		//cerr<<w[0]<<" "<<w[1]<<" "<<w[2]<<" "<<w[3]<<endl;
		ans = min(ans,w[3] - w[0]);
	}
	print(ans);
	return 0;
}


Measured memory_bytes: 2560
// #define _CRT_SECURE_NO_WARNINGS
// #define _USE_MATH_DEFINES	// M_PI=3.1415...
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <locale>
#include <cctype>
#include <sstream>
#include <iomanip>	// 20桁出力 cout << setprecision(20) << double;
#include <queue>
#include <bitset>	// bitset<8> bs1(131uL); // 10000011 bs1[0]は1 01stringからビット集合生成可
using namespace std;

typedef long long LL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<LL> VL;
typedef map<int, int> MAPII;
typedef multimap<int, char, greater<int> > MuMAPIC;
typedef vector<pair<int, int> > VPII;
typedef multimap<int, string, greater<int> > MuMIS;
typedef pair<int, int> P;
typedef pair<int, pair<P, P> > PP;

#define MP make_pair
#define FAST_IO  cin.tie(0); ios::sync_with_stdio(false);
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define FOR_REV(i,a,b) for(int i=(a);i>=(b);i--)
//for gcc (未test)
// #define FOREACH_IT(it,c) for(typeof(c)::iterator it=(c).begin(); it!=(c).end(); ++it)
//for Visual Studio
#define foreach_it(type,it,c) for(type::iterator it=c.begin(),c_end=c.end();it!=c_end;++it)
#define FOR_ITR(d) for(auto itr=d.begin(),d_end=d.end();itr!=d_end;++itr)	// C++11
// for Debug.
#define DUMP_VVI(b) FOR(i,0,b.size()){FOR(j,0,b[i].size())printf("%d ",b[i][j]);puts("");}
#define D_OUT(str,value) if(dbgF){cout<<str<<" : "<<value<<endl;}
// 入力をpush_back(d)やarray[d]に使う時に1行で書ける
// int INPUT_INT() {int d;cin>>d;return d;}
template<class T>T IN() { T d; cin >> d; return d; }
// 最大公約数（Greatest Common Divisor）
LL gcd(LL a, LL b) { return (b > 0) ? gcd(b, a%b) : a; }
// 最小公倍数（Least Common Multiple）
LL lcm(LL a, LL b) { return a / gcd(a, b) * b; }
// Y年はうるう年か否か
bool uruu(LL Y) { return (((Y % 4 == 0 && Y % 100 != 0) || Y % 400 == 0) ? true : false); }

int dx[4] = { 0,1,0,-1 };
int dy[4] = { 1,0,-1,0 };

// vector注意
// vec[i][j]の形に入力を入れるとき、vecは初期化してある必要がある.

// ------------------- include, typedef, define END. -------------------

int main() {
	FAST_IO;
	// for D_OUT(str, value)  ... cout<< str <<" : "<< value <<endl;
	bool dbgF = true;

	//コードはここから書く.

	int N,M;
	bool ok = false;
	
	cin >> N >> M;
	//VVI ab(200001,VI(200001,0));
	VI ichi_t, t_N;

	FOR(i, 0, M) {
		int a, b;
		cin >> a >> b;
		if (a == 1)
			ichi_t.push_back(b);
		if (a == N)
			t_N.push_back(b);
		if (b == N)
			t_N.push_back(a);
	}

	for (int i = 0, j = 0; ;) {
		if (ichi_t.size() == 0 || t_N.size() == 0) {
			break;
		}
		else {
			if (i == 0&&j==0) {
				sort(ichi_t.begin(), ichi_t.end());
				sort(t_N.begin(), t_N.end());
			}
		}
		if (ichi_t[i] == t_N[j]) {
			ok = true;
			break;
		}
		else {

			if (i < ichi_t.size() - 1 && ichi_t[i] < t_N[j]) {
				i++;
			}
			else if (j < t_N.size() - 1) {
				j++;
			}
			else {
				break;
			}


		}
	}
	cout << (ok ? "POSSIBLE" : "IMPOSSIBLE") << endl;

	return 0;
}

Measured memory_bytes: 1276
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<vector>
#include<algorithm>
#include<functional>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<deque>
#include<tuple>
#include<iostream>
#include<string>
#include<unordered_map>
#include<unordered_set>
using namespace std;
#define REP(i,x) for (int i=0;i<x;i++)
#define REPP(i,x,y) for (int i=x;i<=y;i++)
#define SI(x) scanf("%d",&x)
#define SL(x) scanf("%lld",&x)
#define MX3(x,y,z) max(x,max(y,z))
#define MX4(x,y,z,p) max(x,max(y,max(z,p)))
#define MX5(x,y,z,p,q) max(x,max(y,max(z,max(p,q))))
#define MN3(x,y,z) min(x,min(y,z))
#define MN4(x,y,z,p) min(x,min(y,min(z,p)))
#define MN5(x,y,z,p,q) min(x,min(y,min(z,min(p,q))))
#define amax(x,y) x=max(x,y)
#define amin(x,y) x=min(x,y)
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<bool> vb;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef vector<vb> vvb;
typedef long double ld;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;
typedef tuple<int,int,int> ti;
typedef tuple<ll,ll,ll> tl;
// #####################################################################
const long long MOD = 998244353;
 

const double __gauss_template_EPS = 1e-8;

int Gauss(vector<vector<int>> &mat) {
    // return rank
    int rank = 0;
    int n = (int)mat.size();

    for(int i = 0; i < n; i++) {
        bool ok = false;
        for(int j = rank; j < n; j++) {
            if(mat[j][i]) {
                swap(mat[j], mat[rank]);
                ok = true;
                break;
            }
        }

        if(!ok) continue;

        int fs = mat[rank][i];

        for(int j = rank+1; j < n; j++) {
            int r = mat[j][i] / fs;

            for(int k = i; k < n; k++) {

                mat[j][k] ^= mat[rank][k] * r;
            }
        }

        rank++;
    }

    return rank;
}

 
const long long __exp_template_MOD = MOD;
const long long mod = MOD;
int qpow(int x, int n){ int y = 1; while(n){ if(n & 1) y = (ll) y * x % mod; x = (ll) x * x % mod; n >>= 1; } return y; }
 
long long exp(int a, int b) {
    if(b == 0) return 1;
    long long tmp = exp(a, b/2);
    if(b & 1) {
        return (long long)tmp*tmp%__exp_template_MOD*a%__exp_template_MOD;
    }
    return (long long)tmp*tmp%__exp_template_MOD;
}
 
void solve() {
    int n, m;
    SI(n);
    SI(m);
    vvi rec(max(n, m),vi(max(n,m), 0));
    REP(i, n) {
        REP(j, m) {
            scanf("%d", &rec[i][j]);
        }
    }
    int r = Gauss(rec);
 
    printf("%lld\n", ((qpow(2, n+m-1) - qpow(2, n+m-r-1))%MOD+MOD)%MOD);
}
 
void init() {
    
 
 
}
 
int main () {
    init();
    solve();
    return 0;
}


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

#if __has_include(<local.h>)
#include <local.h>
#endif

using namespace std;

typedef long long int LL;
typedef long long int LLint;

//Faster Program
#define endl "\n"

//Faster Coding
#define ED return
#define GET(a) int a;cin >> a
#define DGET(a) double a;cin >> a
#define SGET(a) string a;cin >> a
#define CGET(a) char a;cin >> a
#define PRINT(a) cout << a << "\n"
#define ANS(a,b) int a;cin >> a;cout << b << "\n"
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define SORT(vec) sort(vec.begin(),vec.end())
#define REV(vec) reverse(vec.begin(),vec.end())
#define ALL(x) (x).begin(),(x).end()

//As Function
#define UP(a,b) ((a+(b-1))/b)
#define IPOW(x,y) LL(pow(x,y))

//Debug
#ifdef LOCAL_H
#define TEST cout << "OK\n"
#define DEBUG(a) a
#else
#define TEST
#define DEBUG(a)
#endif

#ifdef LOCAL_H
[[maybe_unused]]
#endif
const double PI = M_PI;
#ifdef LOCAL_H
[[maybe_unused]]
#endif
const int INF = int(999999999);
#ifdef LOCAL_H
[[maybe_unused]]
#endif
const LL LL_INF = LL(999999999999999999);
#ifdef LOCAL_H
[[maybe_unused]]
#endif
const long long MOD = int(1000000007);

//Settings
#ifdef LOCAL_H
const bool DO_BENCHMARK = true;
#endif
const int DOUBLE_ACCURACY = 15;
const int RUN_SOLVE = 1;

#ifndef LOCAL_H
const bool DO_BENCHMARK = false;
#endif

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(DOUBLE_ACCURACY);
    for(int do_solve_time = 0;do_solve_time < RUN_SOLVE;do_solve_time++){
        void solve();
        if(DO_BENCHMARK){
            clock_t clock_start = clock();
            solve();
            clock_t clock_end = clock();
            const double time = static_cast<double>(clock_end-clock_start)/CLOCKS_PER_SEC*1000.0;
            cout << "\n------------------------------------\n" << time << "[ms]\n";
        }
        else solve();
    }
}

/************************************************************************************************************************************************/
void solve(){
    int X, N;
    cin >> X >> N;
    vector<int> P (N);
    for(int i = 0;i < N;i++){
        cin >> P[i];
    }

    for(int i = 0;1;i++){
        bool found1 = false;
        bool found2 = false;
        for(int j = 0;j < N;j++){
            if(P[j] == X-i){
                found1 = true;
            }
            if(P[j] == X+i){
                found2 = true;
            }
        }
        if(found1 == false){
            cout << X-i;
            return;
        }
        else if(found2 == false){
            cout << X+i;
            return;
        }
    }
}



Measured memory_bytes: 3636
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC137C
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            string[] s = new string[N+1];
            s[N] = "zzzzzzzzzzz";
            for(int i = 0; i < N; i++)
            {
                s[i] = Console.ReadLine();
                string[] sort = new string[10];
                for(int j = 0; j < 10; j++)
                {
                    sort[j] = s[i][j].ToString();
                }
                Array.Sort(sort);
                s[i] = string.Join("", sort);
            }
            Array.Sort(s);
            //Console.WriteLine(string.Join(" ", s));
            long ans = 0;
            List<int> a = new List<int>();
            int same = 1;
            for(int i = 0; i < N; i++)
            {
                if (s[i] == s[i + 1])
                {
                    same += 1;
                }
                else
                {
                    a.Add(same);
                    same = 1;
                }
            }
            int l = a.Count;
            for(int i = 0; i < l; i++)
            {
                ans += (long)a[i] * (a[i] - 1)/2;
            }
            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 50852
#include <bits/stdc++.h>
#define rep(i,n) for (int (i) = 0; (i) < (n); (i)++)
using namespace std;
typedef long long ll;

int main() {
    char s[201], t[101], p[101];

    scanf("%s %s", s, p);
    strcpy(t,s);
    strcat(s,t);

    if (strstr(s,p)) cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 3172
n = int(input())
a = list(map(int, input().split()))
mod = 10**9 + 7
s = [0] * n
ss = 0
for i in range(n):
  ss += a[i]%mod
  s[i] = ss

s.reverse()
ans = 0
for i in range(n-1):
  #print (a[n-1-i],s[i+1])
  ans += a[n-1-i] *s[i+1]
  ans %= mod
print (ans)

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

const int nm = 2e5;
int n, k, inf, sup, mid, bit[nm + 2];
long long b[nm + 1], c[nm + 1], ans;
void add(int i) {
	for (int j = i; j <= n + 1; j += j & -j) {
		bit[j]++;
	}
}
long long sum(int i) {
	long long rv = 0;
	for (int j = i; j > 0; j -= j & -j) {
		rv += bit[j];
	}
	return rv;
}

int main() {
	cin >> n >> k;
	for (int i = 0, a; i < n; i++) {
		cin >> a;
		b[i + 1] = b[i] + a - k;
		c[i + 1] = b[i + 1];
	}
	sort(c, c + n + 1);
	for (int i = 0; i < n + 1; i++) { //b[i] <- index of b[i] in c
		inf = 0, sup = n + 1;
		while (sup - inf > 1) {
			mid = (inf + sup) / 2;
			if (c[mid] <= b[i])
				inf = mid;
			else
				sup = mid;
		}
		b[i] = sup;
	}
	for (int i = 0; i < n + 1; i++) {
		ans += sum(b[i]);
		add(b[i]);
	}
	cout << ans << endl;
}


Measured memory_bytes: 4224
public class Main {
    private static java.util.Scanner scanner = new java.util.Scanner(System.in);

    public static void main(String[] args) {
        int x1 = scanner.nextInt();
        int y1 = scanner.nextInt();
        int x2 = scanner.nextInt();
        int y2 = scanner.nextInt();
        System.out.printf("%s %s %s %s", x2 - y2 + y1, y2 + x2 - x1, x1 - y2 + y1, y1 + x2 - x1);
    }
}

Measured memory_bytes: 21844
#include<bits/stdc++.h>
#define mins(a,b) a=min(a,b)
#define maxs(a,b) a=max(a,b)
using namespace std;

int main(){
  long long int n,cnt=1;
  cin>>n;
  long int ans[n+10]={};
  for(int i=2;i<=n;i++){
    int x;
    x=i;
    for(int j=2;j<=i;j++){
      while(x%j==0){
        x/=j;
        ans[j]++;
      }
    }
  }
  for(int i=0;i<n+10;i++){
    cnt=(cnt*(ans[i]+1))%1000000007;
  }
  cout<<cnt<<endl;
}


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

using namespace std;

/*-----------------------------------------------------------------------------
　定義
 -------------------------------------------------------------------------------*/
#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						(int)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 ArrayLength(x)			(sizeof( x ) / sizeof( x[ 0 ]))
#define	MAX_QWORD				((QWORD)0xFFFFFFFFFFFFFFFF)
#define M_PI					3.14159265358979323846
typedef long long				ll;
typedef unsigned long long int	QWORD;
typedef pair<ll, ll>			P;

/*-----------------------------------------------------------------------------
　処理
 -------------------------------------------------------------------------------*/
int main()
{
	int N, K;
	cin >> N >> K;
	vector<bool> isEnable(N, true);
	REP(i, K) {
		int a;
		cin >> a;
		isEnable[a] = false;
	};

	int ans = 0;
	for (int kane = N; kane <= 100000; kane++) {
		bool ret = true;
		int checkVal = kane;
		while (checkVal) {
			int digit = checkVal % 10;
			if (!isEnable[digit]) {
				ret = false;
				break;
			}
			checkVal /= 10;
		}
		if (ret) {
			ans = kane;
			break;
		}
	}

/*	bool isLarge = false;
	for (int keta = 0; keta <= 5; keta++) {
		int digit = N % 10;
		int ansOne = 0;
		REP(i, N) {
			for (int i = digit; i < 10; i++) {
				if (isEnable[i]) {
				
				}
			}

			ansOne += (a[i] - ave) * (a[i] - ave);
		}
		N /= 10;
	}*/

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



Measured memory_bytes: 256
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <algorithm>

using namespace std;

int main()
{
    int a,b,c;
    while(~scanf("%d %d %d",&a,&b,&c))
    {
        if(a>b) {int t=a;a=b;b=t;}
        if(b>c) {int t=b;b=c;c=t;}
        if(a>b) {int t=a;a=b;b=t;}
        int sum=0;
        sum=c-b;
        a=a+sum,b=b+sum;
        if(a%2==c%2)
            sum=sum+(c-a)/2;
        else
            sum=sum+(c-a+1)/2+1;
        printf("%d\n",sum);
    }
    return 0;
}


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

string s;
int n,dsum,pdsum,sum,bil;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cin>>s;
	n = s.length();
	for(int i = 0;i < n;i++){
		if(s[i] == '?'){
			s[i] = 'D';
		}
	}
	for(int i = 0;i < n - 1;i++){
		if(s.substr(i,2) == "PD"){
			pdsum++;
		}
		if(s[i] == 'D'){
			dsum++;
		}
	}
	cout<<s<<endl;
}


Measured memory_bytes: 3740
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
using namespace std;
using ll = long long;
// 
// auto mod int
//
const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

mint comb(int n, int k) {
  mint x = 1;
  mint y = 1;
  rep(i,k) {
    x *= n-i;
    y *= i+1;
  }
  return x/y;
}

int main()
{
    ll n, a, b;
    cin >> n >> a >> b;

    mint ans = 2;
    ans = ans.pow(n);
    ans -= 1;
    ans -= comb(n,a);
    ans -= comb(n,b);

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

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

namespace {
   constexpr int g1 = 1000 * 1000 * 1000, si = 1001 * 1002, si_log = 8 + 10, mod = static_cast<int>(1e9) + 7;
   constexpr long double eps = 1.0e-9;
   int n, ar[2][si];
}

int64_t sol() {
   auto ret = 0 * numeric_limits<int64_t>::max();

   return ret;
}

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

   string s;
   while (cin >> s)
   {
      //memset(ar, 0, sizeof ar);
      //for (int i = 0; i <= n; ++i) { gr[i].clear(); }
      //for (int i = 1; i <= n; ++i) cin >> ar[i];

      string w = "YAKI";
      int ok = 4 <= s.size() && s.substr(0, 4) == w;
      //auto s =
         sol();
      cout << (ok ? "Yes" : "No") << '\n';
#ifndef _DEBUG
      break;
#endif
   }
   return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define ll long long int

ll gcd2(ll a,ll b){
  if(b==1){
    return 1;}
  if(a==1){
    return 1;}
  if(a%b==0){
    return b;}
  if(b%a==0){
    return a;}
  return gcd2(b,a%b);
}

ll gcd3(ll a,ll b,ll c){
  return gcd2(a,gcd2(b,c));
}

int kumi(int i,int j,int k){
  if(i==j && j==k) return 1;
  if(i==j || j==k || k==i) return 3;
  return 6;
}

int main(){
  ll n;
  scanf("%lld",&n);

  ll ans=0;

  for(int i=1;i<=n;i++){
    for(int j=1;j<=i;j++){
      for(int k=1;k<=j;k++){
	ans += gcd3(i,j,k)*kumi(i,j,k);
	//printf("%d %d %d %lld\n",i,j,k,ans);
      }}}

  printf("%lld\n",ans);
  
  return 0;
}


Measured memory_bytes: 1736
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;

using System.Collections;

class Program
{
    static void Main()
    {
        int D = int.Parse(Console.ReadLine());

        string ans = "";

        if (D == 25)
        {
            ans = "Christmas";
        }
        else if (D == 24)
        {
            ans = "Christmas Eve";
        }
        else if (D == 23)
        {
            ans = "Christmas Eve Eve";
        }
        else 
        {
            ans = "Christmas Eve Eve Eve";
        }

        Console.WriteLine(ans);
    }
    
    
}


static class MathUtil
{
    public static T Max<T>(params T[] datas)
    {
        return datas.Max();
    }

    public static T Min<T>(params T[] datas)
    {
        return datas.Min();
    }

    public static IEnumerable<IEnumerable<int>> GetPermutation(int n)
    {
        if (n == 0)
        {
            yield return Single(0);
            yield break;
        }

        for (int i = 0; i <= n; i++)
        {
            foreach (var x in GetPermutation(n - 1))
            {
                yield return Single(i).Concat(x.Select(itm => itm < i ? itm : itm + 1));
            }
        }
    }

    private static IEnumerable<int> Single(int x)
    {
        yield return x;
    }

    public static IEnumerable<int> EnumeratePrimeNumbers()
    {
        List<int> primes = new List<int>() { 2 };
        yield return 2;

        for (int i = 3; i < int.MaxValue; i++)
        {
            bool isPrime = true;
            int Sqrt = (int)Math.Sqrt(i) + 1;

            foreach (var prime in primes)
            {
                if (prime > Sqrt)
                {
                    break;
                }
                if (i % prime == 0)
                {
                    isPrime = false;
                    break;
                }
            }

            if (isPrime)
            {
                primes.Add(i);
                yield return i;
            }
        }
    }
}






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

#define debug(n) cerr << #n << ':' << n << endl;

int main(){
  string S;cin >> S;
  int N = int(S.size());
  int ans = 1e+9;
  for(char c = 'a'; c != 'z'; ++c){
    string T = S;
    int M = N;
    int cnt = 0;
    while(1){
      bool fin = true;
      for(int i = 1; i < M; ++i)
	if(T[i] != T[i - 1])fin = false;
      if(fin)break;
      M--;
      string U = T.substr(0, M);
      for(int i = 0; i < M; ++i){
	if(T[i] == c || T[i + 1] == c)
	  U[i] = c;
      }
      T = U;
      cnt++;
    }
    ans = min(cnt, ans);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
N,M,Q=map(int, input().split())
 
#C[i][j]= i==LかつR<=jなる列車の総数(1-indexed)
C=[[0 for _ in range(N+1)] for __ in range(N+1)]
 
for _ in range(M):
    l,r=map(int, input().split())
    C[l][r]+=1
#print(C)
for i in range(N+1):
    for j in range(1,N+1):
        C[i][j]+=C[i][j-1]
 
for _ in range(Q):
    p,q=map(int, input().split())
    ans=0
    for i in range(p,q+1):
        ans+=C[i][q]-C[i][i-1]
    print(ans)


Measured memory_bytes: 53592
import sys

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


def main():
    N, K = [int(x) for x in input().split()]
    P = [int(x) for x in input().split()]
    P.sort()

    print(sum(P[:K]))





if __name__ == '__main__':
    main()



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

int main(){
  int H, W, K;
  cin >> H >> W >> K;
  char s[H][W];
  for(int i=0; i<H; i++){
    for(int j=0; j<W; j++) cin >> s[i][j];
  }
  int noch[H];
  for(int i=0; i<H; i++){
    int cnt=0;
    for(int j=0; j<W; j++){
      if(s[i][j]=='#') cnt++;
    }
    if(cnt!=0) noch[i]=1;
    else noch[i]=0;
  }
  
  int DIV[H+1][W];
  int num=0;
  int first=0;
  for(int i=0; i<H; i++){
    if(noch[i]==1){
      first=i;
      for(int j=0; j<W; j++){
        if(s[i][j]=='.') DIV[0][j]=num;
        else{
          num++;
          DIV[0][j]=num;
        }
      }
      break;
    }
  }

  for(int i=0; i<W; i++){
    if(s[first][i]=='.') DIV[0][i]++;
    else break;
  }

  num=0;
  for(int i=1; i<=H; i++){
    for(int j=0; j<W; j++){
      if(noch[i-1]!=0){
        if(s[i-1][j]=='.') DIV[i][j]=num;
        else{
          num++;
          DIV[i][j]=num;
        }
      }
    }
  }
  for(int i=0; i<=H; i++){
    for(int j=0; j<W; j++){
      if(noch[i-1]!=0){
        if(s[i-1][j]=='.') DIV[i][j]++;
        if(s[i-1][j]=='#') break;
      }
    }
  }
  for(int i=1; i<=H; i++){
    for(int j=0; j<W; j++){
      if(noch[i-1]==0) DIV[i][j]=DIV[i-1][j];
    }
  }
  for(int i=1; i<=H; i++){
    for(int j=0; j<W; j++) cout << DIV[i][j] << ' ';
    cout << endl;
  }
}

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

using namespace std;

template <typename A> ostream & operator << (ostream & out, vector <A> x) {
    out << "{";
    for (int i = 0; i < (int) x.size(); i++) {
        out << x[i] << ", ";
    }
    return out << "}\n";
}

template <typename A, typename B> ostream & operator << (ostream & out, pair <A, B> x) {
    return out << "{" << x.first << ", " << x.second << "}\n";
}

int main() {
    int a, b, ans = 0;
    cin >> a >> b;              
    for (int i = a; i <= b; i++) {
        string s = to_string(i);
        string x = s;
        reverse(x.begin(), x.end());
        ans += x == s;
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

typedef long long ll;

#define MOD 1000000007

int main() {
  int n;
  cin >> n;
  vector<string> s(n);
  vector<int> t(n);
  for (int i = 0; i < n; ++i) {
    cin >> s[i] >> t[i];
  }
  string x;
  cin >> x;
  ll sum = 0;
  for (int i = 0; i < n; ++i) {
    sum += t[i];
  }
  ll sum2 = 0;
  for (int i = 0; i < n; ++i) {
    sum2 += t[i];
    if (s[i] == x) {
      cout << sum - sum2 << endl;
      return 0;
    }
  }
  return 0;
}

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

int main(){
        int n;cin>>n;
        int x[n];
        int p=0;
        int s=0;
        for(int i=0;i<n;i++){
                cin >> x[i];
                s+=x[i];
        }
        sort(x,x+n);
        int sum;
        int temp=0;
        while(true){
                sum=0;
                for(int i=0;i<n;i++){
                        sum+=2*(p-x[i])+1;
                }
                if(sum<0)p++;
                else break;
        }
        sum=0;
        for(int i=0;i<n;i++){
                sum+=(p-x[i])*(p-x[i]);
        }
        cout << sum;
}

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

using namespace std;
const long long MOD = 1e18;


int main() {
    long long a;
    cin >> a;
    string b;
    cin >> b;
    b.erase(1, 1);
    long long ans = a * stoi(b) / 100;
    cout << ans;

    return 0;
}

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

using ll = long long;
using namespace std;

map<ll,ll> cnt;

int main() {
	ll m,n,a;
	ll ans = 0;

	ll sum[2];

	cin >> n >> m;

	cin >> a;
	sum[0] = a;

	cnt[0] = 1;
	cnt[a%m] += 1;

	for (int i = 1;i < n;i++){
		cin >> a;
		if (a%m == 0) ans += 0;
		sum[1] = a + sum[0];
		sum[1] %= m;
		//cout << sum[1] << endl;
		cnt[sum[1]] += 1;
		sum[0] = sum[1];
	}

	for(auto itr = cnt.begin(); itr != cnt.end(); ++itr){
		if(itr->second > 1){
			ll v = itr->second;
			ans += v*(v-1)/2;
			//cout << itr->first << " " << itr->second << endl;
		} 
	}

	cout << ans << endl;

	return 0;

}

Measured memory_bytes: 4224
#include <iostream>
#include <algorithm>
#include <cmath>
#include <stdio.h>
#include <stdlib.h>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <string.h>
#include <stack>
#include <assert.h>
#include <bitset>
#define Endl endl
#define mp make_pair
#define ll long long 
#define ull unsigned long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define over(A) {cout<<A<<endl;exit(0);}
#define all(A) A.begin(),A.end()
#define ceil(a,b) ((a-1)/b+1)
#define quickcin ios_base::sync_with_stdio(false);
const int mod=998244353;
const int inf=1039074182;
const ll llinf=1LL*inf*inf;
using namespace std;
template <typename T1,typename T2> inline void chmin(T1 &x,T2 b) {if(b<x) x=b;}
template <typename T1,typename T2> inline void chmax(T1 &x,T2 b) {if(b>x) x=b;}
template <typename T1,typename T2> inline void chadd(T1 &x,T2 b) {x+=b;if(x>=mod) x-=mod;};
template <typename T1,typename T2> inline void chmod(T1 &x,T2 b) {x%=b,x+=b;if(x>=b) x-=b;}
int a,b,c,d;
int dp[3005][3005];

namespace combinatorics
{
	int *fac;
	int *ifac;
	int __Tmod;
	inline int add(int a,int b)
	{
		return (a+b)%__Tmod;
	}
	inline int sub(int a,int b)
	{
		return (a-b+__Tmod)%__Tmod;
	}
	inline int mult(int a,int b)
	{
		return (1LL*a*b)%__Tmod;
	}
	inline int fastpow(int basic,int x)
	{
		if(x==0) return 1;
		int res=1;
		while(x)
		{
			if(x&1)	res=mult(res,basic);
			basic=mult(basic,basic);
			x>>=1;
		}
		return res;
	}
	inline int inv(int x)
	{
		return fastpow(x,__Tmod-2);
	}
	void init(int n,int tmod)
	{
		__Tmod=tmod;
		fac=new int[n+5];
		ifac=new int[n+5];
		fac[0]=1;
		for(int i=1;i<=n;i++)
		{
			fac[i]=mult(fac[i-1],i);
		}
		ifac[n]=inv(fac[n]);
		for(int i=n-1;i>=0;i--)
		{
			ifac[i]=mult(ifac[i+1],i+1);
		}
	}
	inline int C(int n,int m)
	{
		return mult(mult(fac[n],ifac[m]),ifac[n-m]);
	}
	inline int Cat(int x)
	{
		return mult(C(x*2,x),inv(x+1));
	}
};
using namespace combinatorics;

int dfs(int x,int y)
{
	if(dp[x][y]!=-1) return dp[x][y];
	int &res=dp[x][y];
	if(x==a && y==b) return res=1;
	if(x==a) return res=mult(dfs(x,y-1),x);
	if(y==b) return res=mult(dfs(x-1,y),y);
	return res=sub(add(mult(dfs(x,y-1),x),mult(dfs(x-1,y),y)),mult(dfs(x-1,y-1),mult(x-1,y-1)));
}

int main()
{
//	freopen("input.txt","r",stdin);
	cin>>a>>b>>c>>d;
	init(0,mod);
	memset(dp,-1,sizeof(dp));
	cout<<dfs(c,d)<<endl;
	return 0;
}

Measured memory_bytes: 39068
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
typedef long long ll;
int main() {
    // ifstream in("data1.txt");
    // cin.rdbuf(in.rdbuf());
    int a, b, c;
    cin >> a >> b >> c;
    int one;
    int two;
    int three;
    if(a < b) {
        one = a;
        two = b;
    } else {
        one = b;
        two = a;
    }

    if(two < c) {
        three = c;
    } else if(one < c) {
        three = two;
        two = c;
    } else {
        three = two;
        two = one;
        one = c;
    }
    cout << one << " " << two << " " << three << endl;
}



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

using namespace std;

int main() {
	int x, y;

	cin >> x >> y;

	bool ans = false;

	for (int i = 0; i <= 100; i++) {
		for (int j = 0; j <= 100; j++) {
			if (i + j == x) {
				if (i*2 + j*4 == y) {
					ans = true;
				}
			}
		}
	}

	if (ans)
		cout << "Yes";
	else
		cout << "No";

	cout << "\n";

	return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i <(n); ++i)
#define ALL(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<int,int>;
static const double PI = acos(-1);



int main(){
  char b;
  cin >> b;

  if(b == 'A') cout << 'T' << endl;
  if(b == 'T') cout << 'A' << endl;
  if(b == 'C') cout << 'G' << endl;
  if(b == 'G') cout << 'C' << endl;

  return 0;
}

Measured memory_bytes: 3512
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

#define pb push_back
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define debug(x) cerr << #x << " : " << x << '\n'

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;
typedef string str;
typedef pair<ll, ll> pll;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

const ll Mod = 1000000007LL;
const int Maxn = 1e5 + 10;
const ll Inf = 2242545357980376863LL;
const ll Log = 30;

ll mul(ll a, ll b){
	return (a * b) % Mod;
}
ll bin_pow(ll b, ll p){
	ll res = 1;
	for(ll j = 1, pw = b; j <= p; j <<= 1, pw = mul(pw, pw))
		if(p & j)
			res = mul(res, pw);
	return res;
}
ll inv(ll x){
	return bin_pow(x, Mod - 2);
}
ll f[Maxn], iv[Maxn];
ll nCr(ll n, ll r){
	if((n < r) || (r < 0)) return 0;
	return mul(f[n], mul(iv[r], iv[n - r]));
}



int main(){
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	f[0] = 1;
	for(int i = 1; i < Maxn; i++) f[i] = mul(f[i - 1], i);
	for(int i = 0; i < Maxn; i++) iv[i] = inv(f[i]);
	
	ll n, a, b, c;
	cin >> n >> a >> b >> c;
	if(b & 1) return cout << 0, 0;
	b /= 2;
	
	ll ans = 0;
	for(int i = 0; i <= a; i++){
		for(int j = 0; 3*j + (a - i) <= c; j++){
			if(b > 0){
				ans += mul( mul( mul(nCr(a + j + b, i), nCr(a + j + b - i, a - i)), nCr(j + b, j) ), nCr(c - 3*j - (a - i) + b - 1, b - 1));
			} else {
				if(c == 3 * j + (a - i)){
					ans += mul(nCr(a + j, i), nCr(a + j - i, a - i));
				}
			}
		}
	}
	cout << ans % Mod << '\n';
	return 0;
}


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

#define INF_LL (int64)1e18
#define INF (int32)1e9
#define REP(i, n) for(int64 i = 0;i < (n);i++)
#define FOR(i, a, b) for(int64 i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-10;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

const int64 mod = 1e9+7;

int main(void){
	int32 N, M;
	cin >> N >> M;
	vector<PII> v(M);
	REP(i, M) cin >> v[i].sc >> v[i].fs;
	int32 last = 0;
	sort(all(v));
	int32 cnt = 0;
	REP(i, M){
		if(v[i].sc > last){
			cnt++;
			last = v[i].fs-1;
		}
	}
	cout << cnt << endl;
}


Measured memory_bytes: 1792
#include<iostream>
#include<string>

std::string shuffle(std::string s, int h){
    int length = s.size();
    std::string head = s.substr(0, h);
    std::string tail = s.substr(h, length - h);
    return tail + head;
}

int main(){
    std::string s;
    int m;
    
    while(1){
        std::cin >> s >> m;
        if(s[0] == '-') break;
        
        for(int i = 0; i < m; i++){
            int h;
            std::cin >> h;
            s = shuffle(s, h);
        }
        std::cout << s << std::endl;
    }
}


Measured memory_bytes: 3164
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define all(obj) (obj).begin(),(obj).end()
#define debug(x) cerr << #x << ": " << endl
#define rep(i,n) for(int i=0; (i)<(n); ++(i))
#define rrep(i,n) for(int i=(n); (i)>=0; --(i))
#define reps(i,s,n) for(int i=(s); (i)<(n); ++(i))
#define maxi(v) distance(v.begin(), max_element(v.begin(), v.end()))
#define mini(v) distance(v.begin(), min_element(v.begin(), v.end()))
#define maxemt(v) *max_element(v.begin(), v.end())
#define minemt(v) *min_element(v.begin(), v.end())
#define lb(v,x) v[lower_bound(v.begin(), v.end(), x) - v.begin()]
#define ub(v,x) v[upper_bound(v.begin(), v.end(), x) - v.begin()]
template<class T> inline bool print(T& x){ cout << x << endl; return true; }
template<class T> inline bool print_(T& x){ cout << x << " "; return true; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
ll gcd(ll x, ll y){
  if(y==0) return x;
  else return gcd(y, x%y);
  }
ll lcm(ll x, ll y){
  return x / gcd(x,y) * y;
}
const int INF = 1e9;
const ll llINF = 1LL<<60;
const int MOD = 1e9+7;
const double EPS = 1e-9;
int main(){
  int n; cin >> n;
  string s; cin >> s;
  string abc="ABC";
  int ans=0;
  rep(i,n-2){
    int flg=0;
    rep(j,3) if(s[i+j]==abc[j]) flg++;
    if(flg==3) ans++;
  }
  cout << ans;
  
  
return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
const ll mod=1000000007;
/* 4 方向への隣接頂点への移動を表すベクトル */
const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };
int main() {
ll n,m;
cin>>n>>m;
ll ca=0;
ll f=0;
for(ll i=1; i*n<=m; i++){
if(m%i==0){
ca=i;
if(ca>=n){
f++;
break;}}}
if(f==1){
cout<<m/ca<<endl;}
else{
cout<<ca<<endl;}}


Measured memory_bytes: 3676
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

ll solve() {
    ll N;
    cin >> N;
    vector<vector<ll>> F(N, vector<ll>(10));
    vector<vector<ll>> P(N, vector<ll>(11));
    for ( int n = 0; n < N; n++ ) {
        for ( int i = 0; i < 10; i++ ) {
            cin >> F[n][i];
        }
    }
    for ( int n = 0; n < N; n++ ) {
        for ( int i = 0; i <= 10; i++ ) {
            cin >> P[n][i];
        }
    }
    ll ans = -1e18;
    vector<ll> jo(10);
    for ( int j = 1; j < 1<<10; j++ ) {
        ll p = 0;
        for ( int i = 0; i < 10; i++ ) {
            jo[i] = (j >> i) & 1;
        }
        for ( int n = 0; n < N; n++ ) {
            ll c = 0;
            for ( int i = 0; i < 10; i++ ) {
                if ( jo[i] == 1 && F[n][i] == 1 ) {
                    c++;
                }
            }
            p += P[n][c];
        }
        ans = max(ans, p);
    }
    return ans;
}

int main() {
    auto ans = solve();
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 256
// {{{
#include <iostream>
#include <iomanip>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <complex>
#include <vector>
#include <list>
#include <set>
#include <unordered_set>
#include <queue>
#include <stack>
#include <map>
#include <unordered_map>
#include <string>
#include <algorithm>
#include <numeric>
using namespace std;

#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define FOR(i, a, b) for(ll i = static_cast<ll>(a); i < static_cast<ll>(b); i++)
#define FORR(i, a, b) for(ll i = static_cast<ll>(a); i >= static_cast<ll>(b); i--)
#define REP(i, n) for(ll i = 0ll; i < static_cast<ll>(n); i++)
#define REPR(i, n) for(ll i = static_cast<ll>(n); i >= 0ll; i--)
#define ALL(x) (x).begin(), (x).end()

#define DBG(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl;

template<typename T>
ostream &operator<<(ostream &os, const vector<T> &v) {
    os << "[";
    for (auto e: v) os << e << ",";
    os << "]";
    return os;
}

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> IP;
typedef pair<ll, LP> LLP;

const int dx[] = {1, -1, 0, 0};
const int dy[] = {0, 0, 1, -1};

constexpr int INF = 100000000;
constexpr ll LINF = 10000000000000000ll;
constexpr int MOD = static_cast<int>(1e9 + 7);
constexpr double EPS = 1e-9;

static inline ll mod(ll x, ll m)
{
    ll y = x % m;
    return (y >= 0 ? y : y+m);
}

// print floating-point number
// cout << fixed << setprecision(12) <<

// }}}

char c;

void solve()
{
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> c;
    cout << (char)(c+1) << endl;
    return 0;
}

// vim:set foldmethod=marker:


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

int main(){
    int n, a, b, c, x;
    while(cin >> n >> a >> b >> c >> x, n+a+b+c+x){
        int count = 0;
        vector<int> ans(n);
        for(int i=0; i < n; i++) cin >> ans[i];
        for(int count = 0; ; count++){
            if(10000 < count){cout << -1 << endl; break;}
            if(x == ans[0]){
                vector<int> t;
                for(int i=1; i < ans.size(); i++) t.push_back(ans[i]);
                ans = t;
            }
            if(ans.size() == 0){cout << count << endl; break;}
            x = (a*x+b)%c;
        }
    }
}

Measured memory_bytes: 1220
#include <bits/stdc++.h>
using namespace std;
#define REP(i, init, n) for(int i = (int)(init); i < (int)(n); i++)

int main() {
    int N, M;
    cin>>N>>M;
    vector<vector<int>> G(N);
    REP(i, 0, M){
        int X, Y, Z;
        cin >> X >> Y >> Z;
        X--; Y--;
        G[X].emplace_back(Y);
        G[Y].emplace_back(X);
    }
    vector<bool> Search(N, false);
    int count = 0;
    REP(i, 0, N){
        if(!Search[i]){
            count++;
            if(!G[i].empty()){
                queue<int> que;
                que.push(i);
                while(!que.empty()){
                    int cur = que.front(); que.pop();
                    Search[cur] = true;
                    for(auto j: G[cur]){
                        if(!Search[j]) que.push(j);
                    }
                }
            }else{
                Search[i] == true;
            }
        }
    }
    cout << count << endl;
}

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

const int N=2e+6+7;
long long int M = 1e+9 + 7;
long long int power(long long int x, long long int n)
{
    if (n == 0)
        return (long long)1;
    else if (n % 2 == 0) //n is even
        return power((x * x) % M, n / 2);
    else //n is odd
        return (x * power((x * x) % M, (n - 1) / 2)) % M;
}
long long int cans(long long int p, long long int q)
{
    return ((p * power(q, M - 2)) % M + M) % M;
}
long long int fact[N],facti[N];

int main()
{
    int r1,r2,c1,c2;
    cin>>r1>>c1>>r2>>c2;
    fact[0]=facti[0]=1;
    for(int i=1;i<=N;i++)
    {
        fact[i]=(i*fact[i-1])%M;
        facti[i]=cans(1,fact[i]);
    }
    long long int ans1=(((((fact[r2+c2+2]*facti[r2+1])%M)*facti[c2+1])%M+((fact[r1+c1]*facti[r1])%M)*facti[c1])%M)%M;
    long long int ans2=(((((fact[r2+c1+1]*facti[r2+1])%M)*facti[c1])%M+((fact[r1+c2+1]*facti[r1])%M)*facti[c2+1])%M)%M;
    long long int ans=((ans1-ans2)%M+M)%M;
    // cout<<(fact[r2+c2+2]*facti[r2+1])%M<<endl;
    cout<<ans;
}

Measured memory_bytes: 31488
#include<cstdio>
#include<algorithm>
using namespace std;

const int MAXN = 100010;
int n, a[MAXN];
bool ans;

int main() {
	int i, j;
	scanf("%d", &n);
	for(i = 1; i <= n; i++) scanf("%d", &a[i]);
	sort(a+1, a+n+1);
	if(a[1]&1) ans = false;
	else ans = true;
	if(!(n&1)) ans^=1;
	for(i = 1; i <= n; i = j) {
		for(j = i; j <= n; j++) 
			if(a[j] != a[i]) break;
		//if(!((j-i)&1)) ans ^= 1;
		//printf("%d %d\n", ans, j);
		if(j <= n) {
			if((j-i)&1) {
				if(!((a[j]-a[i])&1) && j+a[i] <= n) ans ^= 1;
			}
			else {
				if(((a[j]-a[i])&1) && j-1+a[i] <= n) ans ^= 1;
			}
		}
		//ans^=1;
	}
	if(ans) printf("First\n");
	else printf("Second\n");
	return 0;
}


Measured memory_bytes: 640
#include <stdio.h>
int main(void){
    
int a,b,k,i,j=0;
int x,y;
int s[100];

scanf("%d",&a);
scanf("%d",&b);
scanf("%d",&k);


    
    for(i=100; i>=1; i--){
        if(b%i==0 && a%i==0){
        s[j]=i;
        j++;

        }
    }

printf("%d\n",s[k-1]);
}


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

int main(){
  int N;
  cin >> N;
  int M = N;
  int x=0;
  for(int i=0;i<8;i++){
    x+=M%10;
    M/=10;
  }
  if(N%x==0){
    cout << "Yes" <<endl;
  }else{
    cout << "No" <<endl;
  }
}

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

#define rep(i, n) for (int i=0; i<(n); ++i)
using ll = long long;
using P = pair<int, int>;

int main() {
  int n;
  cin >> n;
  vector<ll> a(n);
  rep(i, n) cin >> a[i];

  ll x2 = 0;
  rep(i, n) {
    if (i&1) x2 -= a[i];
    else x2 += a[i];
  }
  vector<int> ans(n);
  ans[0] = x2 / 2;
  rep(i, n-1) {
    ans[i+1] = a[i] - ans[i];
  }
  rep(i, n) ans[i] *= 2;
  rep(i, n) printf("%d%c", ans[i], i==n-1 ? '\n' : ' ');
  return 0;
}


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

int main() {
  int A, B, count = 0;
  cin >> A >> B;

  // ここにプログラムを追記
  for(int i= A; i <= B; i++){
    int p = i;
	int s = 0;
    for(int j = 0; j < 2; j++){
	  int k = p%10;
      s *= 10;
      s += k;
      p /= 10;
      
    }
    int t = i / 1000;
    if(t == s){
      count++;
    }  
  }
  cout << count << endl;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;

int main() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  int ans = 0;
  rep(i,n-1) {
    if (s[i] != s[i+1]) ++ans;
  }
  ans++;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3756
#include <bits/stdc++.h>
using namespace std;
using llong = long long;
using ldouble = long double;

void fnInput(int& rnWide, int& rnHigh, int& rnx, int& rny)
{
  cin >> rnWide >> rnHigh >> rnx >> rny;
}

void fnRectCutArea(int nWide, int nHigh, int nx, int ny)
{
  llong nRectArea = (llong)nWide * nHigh;
  ldouble nRectCutArea = nRectArea / 2.0L;
  cout << nRectCutArea << " ";

  double nCenterx = nWide / 2.0;
  double nCentery = nHigh / 2.0;
  if (nCenterx == nx && nCentery == ny)
    cout << "1" << endl;
  else
    cout << "0" << endl;
}
  
int main()
{
  int nWide, nHigh, nx, ny;

  fnInput(nWide, nHigh, nx, ny);
  fnRectCutArea(nWide, nHigh, nx, ny);

  return 0;
}

Measured memory_bytes: 3760
#include<iostream>
#include<cstdio>
#include<map>
using namespace std;
#define LL long long
#define INF 0x3f3f3f3f3f3f3fll
int T,A,B,C,D;map<LL,LL>f;
LL dfs(LL n)
{
	if(n==0)return 0;
	if(f.count(n))return f[n];LL &v=f[n];v=n*min(INF/n+1,1ll*D);bool fl1=0,fl2=0,fl3=0;
	if(n%5==0)v=min(v,dfs(n/5)+C),fl1=1;
	if(n%3==0)v=min(v,dfs(n/3)+B),fl2=1;
	if(n%2==0)v=min(v,dfs(n/2)+A),fl3=1;
	if(fl1&&fl2&&fl3)return v;
	v=min(v,dfs(n-1)+D);
	v=min(v,dfs(n+1)+D);return v;
}
LL n;
int main(){
	scanf("%d",&T);
	while(T--)
	{
		f.clear();
		scanf("%lld%d%d%d%d",&n,&A,&B,&C,&D);
		printf("%lld\n",dfs(n));
	}return 0;
}

Measured memory_bytes: 13724
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<P,int> P1;
typedef pair<P,P> P2;
typedef pair<double,int>Q;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
typedef complex<double> pt;
int n,a[3][100005];
int main(){
	cin>>n;
	rep(i,3)rep(j,n){
		scanf("%d",&a[i][j]);
	}
	rep(i,3) sort(a[i],a[i]+n);
	ll ret = 0;
	rep(i,n){
		int x = a[1][i];
		int d = lower_bound(a[0],a[0]+n,x)-a[0];
		int e = upper_bound(a[2],a[2]+n,x)-a[2];
		ret += 1LL*d*(n-e);
	}
	cout<<ret<<endl;
}

Measured memory_bytes: 1408