akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		//		new Main().solveA();
		new Main().solveB();
		// new Main().solveC();
		// new Main().solveD();
	}

	private void solveA() {
		Scanner scanner = null;
		int numA = 0;
		int numB = 0;
		int numC = 0;
		int numD = 0;

		try {
			scanner = new Scanner(System.in);
			numA = scanner.nextInt();
			numB = scanner.nextInt();
			numC = scanner.nextInt();
			numD = scanner.nextInt();

			if (numA + numB == numC + numD) {
				System.out.println("Balanced");
			} else if (numA + numB > numC + numD) {
				System.out.println("Left");
			} else if (numA + numB < numC + numD) {
				System.out.println("Right");
			}

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}

	private void solveB() {
		Scanner scanner = null;
		int numN = 0;
		int numA = 0;
		int numB = 0;

		try {
			scanner = new Scanner(System.in);
			numN = scanner.nextInt();
			numA = scanner.nextInt();
			numB = scanner.nextInt();

			int res = 0;
			for (int i = 1; i <= numN; i++) {

				int wk = 0;
				int tmp = i;
				while (tmp != 0) {
					wk += tmp % 10;
					tmp /= 10;
				}
				if (numA <= wk && wk <= numB) {
					res += i;
				}

			}

			System.out.println(res);

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}

	private void solveC() {
		Scanner scanner = null;
		int numN = 0;
		int numK = 0;
		int numS = 0;

		try {
			scanner = new Scanner(System.in);
			numN = scanner.nextInt();

			System.out.println("");

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}

	private void solveD() {
		Scanner scanner = null;
		int numN = 0;
		int numK = 0;
		int numS = 0;

		try {
			scanner = new Scanner(System.in);
			numN = scanner.nextInt();

			System.out.println("");

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}
}

Measured memory_bytes: 22996
#Longest Path 

import sys
# 許容する再帰処理の回数を変更
sys.setrecursionlimit(10**5+10)
# input処理を高速化する
input = sys.stdin.readline

N,M = map(int,input().split())

dp = [-1]*N
adg_list = [ [] for _ in range(N)]

for i in range(M):
    x,y = map(int,input().split())
    adg_list[x-1].append(y-1)

# print(*dp,sep="\n")
# print(*adg_list,sep="\n")

def rec(v):
    if dp[v] !=-1:
        return dp[v]
    
    nv_s = adg_list[v]

    ans = 0
    #もしnv_s(隣接する頂点の集合)が0の場合は
    #forループは実行されずに0が出力される。
    for nv in nv_s:
        ans = max(ans , rec(nv) + 1)
    dp[v] = ans
    return dp[v]

ans = 0
for w in range(N):
    ans =max(ans,rec(w))
print(ans)




Measured memory_bytes: 59056
#define _CRT_SECURE_NO_WARNINGS

/* include ***********************/
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>

/* define *************************/
//for
#define REP(i,n) for(int i=0,i##_len=(int)(n);i<i##_len;i++)
#define REPS(i,n) for(int i=1,i##_len=(int)(n);i<=i##_len;i++)
#define RREP(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define RREPS(i,n) for(int i=(int)(n);i>0;i--)
#define FOR(i,s,n) for(int i=(int)(s),i##_len=(int)(n);i<i##_len;i++)
#define RFOR(i,s,n) for(int i=(int)(s)-1,i##_len=(int)(n);i>=i##_len;i--)

//printf
#define PRINTD(d) printf("%d\n",(d))
#define PRINTL(d) printf("%lld\n",(d))

//memset
#define m0(s) memset(s,0,sizeof(s))
#define ml(s) memset(s,63,sizeof(s))
#define fill(s,c) memset(s,c,sizeof(s))

#define INF 1e9
#define MOD 1000000007

typedef long long ll;
typedef unsigned long long ull;

int diff[4][2] = {
	{ 0, -1 },
	{ -1, 0 },
	{ 1, 0 },
	{ 0, 1 },
};

int Min(int a, int b) {
	return (a)<(b) ? (a) : (b);
}
int Max(int  a, int  b) {
	return (a) > (b) ? (a) : (b);
}
ll Minl(ll a, ll b) {
	return (a)<(b) ? (a) : (b);
}
void Swap(int *a, int *b) {
	int tmp = *a;
	*a = *b;
	*b = tmp;
}


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

	ll x=1;
	while (x-1 < b)x *= 2;
	x--;
	ll y = x - a + 1;
	ll ans=0, ans1=0, ans2=0;
	int i;
	for (i = 0; i < 41; i++) {
		ll z = (ll)2 << i;
		//printf("y:%lld, z:%lld\n", y, z);
		if (x < z/2)break;
		ll tar = ((y / z)*(z / 2) + Minl(y%z, z >> 1)) % 2;
		ans1 += (ll)tar << i;
		//PRINTL(ans1);
	}
	//puts("--");
	//PRINTL(x);
	y = x - b;
	if (y < 0) {
		//puts("?");
		PRINTL(ans1);
		return 0;
	}
	for (i = 0; i < 41; i++) {
		ll z = (ll)2 << i;
		//printf("y:%lld, z:%lld\n", y, z);
		if (x < z/2)break;
		ll tar = ((y / z)*(z/2) + Minl(y%z, z >> 1)) % 2;
		ans2 += (ll)tar << i;
		//PRINTL(ans2);
	}
	for (i = 0; i < 41; i++) {
		ll tmp1 = (ans1>>i)%2;
		ll tmp2 = (ans2>>i)%2;
		ans += ((tmp1+tmp2==1)?(ll)1:(ll)0)<<i;
	}
	PRINTL(ans);

}

Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <cstring>
#define MOD 1000000007

using namespace std;

int main()
{
    int n;
    char a[55],b[55];
    while(scanf("%d",&n)!=EOF)
    {
        getchar();
        scanf("%s",a);
        getchar();
        scanf("%s",b);
        int i=0,p=0;
        long long sum=1;
        while(i<n)
        {
            if(i==0)
            {
                if(a[i]==b[i])
                {
                    sum=(sum*3)%MOD;
                    i++;
                    p=1;
                }
                else
                {
                    sum=(sum*6)%MOD;
                    i+=2;
                    p=2;
                }
            }
            else
            {
                if(a[i]==b[i])
                {
                    if(p==1)
                    {
                        sum=(sum*2)%MOD;
                    }
                    else
                    {
                        sum=(sum*1)%MOD;
                    }
                    i++;
                    p=1;
                }
                else
                {
                    if(p==1)
                    {
                        sum=(sum*2)%MOD;
                    }
                    else
                    {
                        sum=(sum*3)%MOD;
                    }
                    i+=2;
                    p=2;
                }
            }
        }
        printf("%lld\n",sum);
    }
    return 0;
}


Measured memory_bytes: 256
n, m = map(int, input().split())
k = []
for _ in range(n):
    a = list(map(int, input().split()))[1:]
    k.append(a)

ans = 0
for i in range(m):
    flag = True
    for j in range(n):
        if i+1 not in k[j]:
            flag = False
            break
    if flag:
        ans += 1

print(ans)


Measured memory_bytes: 3060
N,K=map(int,input().split());p=[int(i)-1 for i in input().split()];q=[int(i)-1 for i in input().split()];T=lambda s,t:[s[t[i]] for i in range(N)];m=[[0 for i in [0]*N] for i in [0]*6];m[0]=p;m[1]=q
def I(s):
 r=[0]*N
 for i in range(N):r[s[i]]=i
 return r
for i in range(4):m[i+2]=T(m[i+1],I(m[i]))
E=lambda s,k:(E(T(s,s),k//2) if k!=0 else list(range(N)))if k%2==0 else T(E(T(s,s),k//2),s);t=E(T(T(T(q,I(p)),I(q)),p),~-K//6);print(" ".join([str(i+1) for i in T(T(t,m[~-K%6]),I(t))]))

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

int main(){
    int N;
    cin >> N;
	vector< vector<int> > arr;
	arr.resize(2);
	for( int i=0; i<2; i++ ){
		arr[i].resize(N);
	}

    for(int i=0;i<2;i++){
        for(int k=0;k<N;k++){
            cin >> arr[i][k];
        }
    }

    int score = 0;
    int result = 0;
    int k;
    for(int i=0;i<N;i++){
        k = 0;
        score = 0;
        for(int j=0;j<N;j++){
            if(j==i){
                score = score + arr[k][j];
                k = 1;
            }
            score = score + arr[k][j];
        }
        if(score > result) result = score;
    }
    cout << result << endl;
}

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

using namespace std;

const int MAX_N = 200000, INDEX = 1;
const int MAX_T = 1000000000, INF = MAX_T + 1;

int N, T;
int t[MAX_N + INDEX];
int X;

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

    cin >> N >> T;

    for (int i = 1; i <= N; i++) {
        cin >> t[i];
    }

    t[0] = -INF;

    for (int i = 1; i <= N; i++) {
        X += (t[i] + T) - max(t[i], t[i - 1] + T);
    }

    cout << X << endl;

    return 0;
}


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

#define int long long
#define DEBUG(x) cerr <<#x<<":"<<x<<endl;
#define DEBUG2(x, y) cerr <<#x<<":"<<x<<" "<<#y<<":"<<y<<endl;
#define DEBUG3(x, y, z) cerr <<#x<<":"<<x<<" "<<#y<<":"<<y<<" "<<#z<<":"<<z<<endl;
#define DEBUGVC(x) cerr <<#x<<": "; for(auto a:x) cerr << a <<" "; cerr << endl;
#define DEBUGMP(x) cerr <<#x<<":"<<endl; for(auto a:x) cerr << a.first <<" "<< a.second << endl;
#define MAX_N (1000006)
#define INF (1LL << 60)
const int MOD = (int)1e9+7;


signed main() {
    while(1) {
        int m, n_min, n_max;
        cin >> m >> n_min >> n_max;
        if(m==0&&n_min==0&&n_max==0) return 0;
        vector<int> p(m);
        for(int i=0; i<m; i++) cin >> p[i];
        sort(p.rbegin(),p.rend());
        vector<pair<int,int>> n;
        for(int i=n_min; i<=n_max; i++) {
            n.push_back(make_pair(p[i-1]-p[i], i));
            //cout << p[i-1]-p[i] <<" "<< i << endl;
        }
        sort(n.rbegin(),n.rend());
        //for(int i=0; i<n.size(); i++) cout << n[0].first <<" "<< n[0].second << endl;
        cout << n[0].second << endl;
    }
}


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
const int N=1010;
int n,v[N],dp[5*N],f[N];
vector <int> p[1010];
inline void dfs(int x){
    for(int i=0;i<p[x].size();i++) dfs(p[x][i]);
    memset(dp,0x3f,sizeof(dp)); dp[0]=0;
    for(int j=0;j<p[x].size();j++) {
        int k=p[x][j];
        for (int i=v[x];i>=0;i--) {
            int tmp=0x3f3f3f3f;
            if (i>=v[k]) tmp=min(tmp,dp[i-v[k]]+f[k]);
            if (i>=f[k]) tmp=min(tmp,dp[i-f[k]]+v[k]);
            dp[i]=tmp;
        }
    }
    for(int i=v[x];i>=0;i--) f[x]=min(f[x],dp[i]);
}
signed main () {
    memset(f,0x3f,sizeof(f)); scanf("%d",&n);
    for (int i=2,u;i<=n;i++) { scanf("%d",&u); p[u].push_back(i); }
    for (int i=1;i<=n;i++) scanf("%d",&v[i]);
    dfs(1);
    if (f[1]<0x3f3f3f3f) printf("POSSIBLE\n");
    else printf("IMPOSSIBLE\n");
}

Measured memory_bytes: 384
#https://www.youtube.com/watch?v=3gFnZhZlAF8
#【競プロ実況】ABC172 AからD問題【かつっぱ】
# 等差数列の和
# 初期入力
import sys
input = sys.stdin.readline
N = int(input())
ans =0
for i in range(1,N+1):
    n =N//i #項数
    ans +=n*(2*i +(n-1)*i)//2
print(ans)


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

using namespace std;

constexpr int N = 200000;

int a[N + 1];

int main() {
	int n, i;

	scanf("%d", &n);

	for (i = 1; i <= n; i++) {
		scanf("%d", a + i);
	}

	sort(a + 1, a + 1 + n);

	for (i = 2; i <= n; i++) {
		if (a[i - 1] == a[i]) {
			break;
		}
	}

	if (i <= n) {
		printf("NO\n");
	}
	else {
		printf("YES\n");
	}

	return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>

using namespace std;

int main(void) {
	int N, M;
	cin >> N;
	vector<int> D(N);
	for (int i = 0; i < N;i++) cin >> D[i];
	cin >> M;
	vector<int> T(M);
	for (int i = 0; i < M; i++) cin >> T[i];

	sort(D.begin(), D.end());
	sort(T.begin(), T.end());

	int i = 0, j = 0;
	while (i < D.size() && j < T.size()) {
		if (D[i] == T[j]) {
			j++;
		}
		i++;
	}
	if (j >= T.size()) cout << "YES" << endl;
	else cout << "NO" << endl;
	system("pause");
	return 0;
}

Measured memory_bytes: 2040
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
#define INF 1145141919810893364
#define PI 3.141592653589
typedef pair<int,int> PP;
typedef long long ll;
#define int ll
#define setdouble setprecision
#define REP(i,n) for(int i=0;i<(n);++i)
#define OREP(i,n) for(int i=1;i<=(n);++i)
#define RREP(i,n) for(int i=(n)-1;i>=0;--i)
#define GOODBYE cout << "-1" << endl;return 0
#define MM <<" "<<
#define Endl endl

signed main(){
    int a;
    string s;
    cin >> a;
    cin >> s;
    
    if(a>=3200){
        cout << s << endl;
    }else{
        cout << "red" << endl;
    }
    return 0;
}   


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める
typedef long long ll;

int main(){
    int a,b;
    cin>>a>>b;
    if(a>9||b>9){
        cout << -1;
    }else{
        cout<< a*b;
    }
    
    return 0;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline
N,M = map(int, input().split())
xyz = [tuple(map(int, input().split())) for _ in range(N)]

def score(x): return abs(x[0])+abs(x[1])+abs(x[2])
def add(a, b): return (a[0]+b[0], a[1]+b[1], a[2]+b[2])
def score2(x,c): return x[0]*c[0] + x[1]*c[1] + x[2]*c[2]
def key(c): return lambda x: score2(x,c)

def solve(c):
    A = sorted(xyz, key=key(c))
    rslt=(0,0,0)
    for i in range(M):
        rslt = add(rslt, A[i])
    return score(rslt)

ans=0
for i in [-1,1]:
    for j in [-1,1]:
        for k in [-1,1]:
            ans=max(ans,solve((i,j,k)))
print(ans)

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

int main(){
  string s;
  cin >> s;
  
  int tmp = 0;
  for(int i = 0;i < s.size();i++){
    tmp += (s[i] - '0');
    tmp %= 9;
  }

  cout << (tmp%9?"No":"Yes") << endl;
} 

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

int main(){
  int n;
  long inf = 1000000007;
  string s;
  cin >> s;
  n = s.size();
  long dp[n+1][4];
  for(int i = 0;i <= n;i++){
    for(int j = 0;j < 4;j++){
      dp[i][j] = 0;
    }
  }
  dp[0][0] = 1;
  for(int i = 0;i < n;i++){
    if(s.at(i) == 'A'){
      for(int j = 0;j < 4;j++){
        dp[i+1][j] += dp[i][j];
        dp[i+1][j] %= inf;
      }
      dp[i+1][1] += dp[i][0];
      dp[i+1][1] %= inf;
    }
    else if(s.at(i) == 'B'){
      for(int j = 0;j < 4;j++){
        dp[i+1][j] += dp[i][j];
        dp[i+1][j] %= inf;
      }
      dp[i+1][2] += dp[i][1];
      dp[i+1][2] %= inf;
    }
    else if(s.at(i) == 'C'){
      for(int j = 0;j < 4;j++){
        dp[i+1][j] += dp[i][j];
        dp[i+1][j] %= inf;
      }
      dp[i+1][3] += dp[i][2];
      dp[i+1][3] %= inf;
    }
    else{
      for(int j = 0;j < 4;j++){
        dp[i+1][j] += 3*dp[i][j];
        dp[i+1][j] %= inf;
      }
      dp[i+1][1] += dp[i][0];
      dp[i+1][2] += dp[i][1];
      dp[i+1][3] += dp[i][2];
      dp[i+1][1] %= inf;
      dp[i+1][2] %= inf;
      dp[i+1][3] %= inf;
    }
  }
  cout << dp[n][3] << endl;
}

Measured memory_bytes: 3584
#include <bits/stdc++.h>
#define INF LLONG_MAX
#define Int long long
#define rep(i,n) for(int i=0; i<n; ++i)
using namespace std;
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;}

int main() {
  int five=0, seven=0;
  for(int i=0; i<3; ++i) {
    int n; cin >> n;
    if(n==5) ++five;
    if(n==7) ++seven;
  }
  printf((five==2&&seven==1)?"YES\n":"NO\n");
}


Measured memory_bytes: 256
n = int(raw_input())
a = [int(i) for i in raw_input().split(' ')]
b = [int(i) for i in raw_input().split(' ')]
ret = 0
for i in range(n):
    e = min(a[i], b[i])
    ret += e
    a[i] -= e
    b[i] -= e
    e = min(a[i + 1], b[i])
    ret += e
    a[i + 1] -= e
    b[i] -= e

print ret


Measured memory_bytes: 14992
import java.util.Scanner;

public class Main {
    public static void main(String args[]) {
        try (Scanner in = new Scanner(System.in)) {
            int N = in.nextInt();
            int M = in.nextInt();
            int C = in.nextInt();
            int[] B = new int[M];
            for (int i = 0; i < M; i++) {
                B[i] = in.nextInt();
            }
            int[][] A = new int[N][M];
            for (int i = 0; i < N; i++) {
                for (int j = 0; j < M; j++) {
                    A[i][j] = in.nextInt();
                }
            }

            int count = 0;
            for (int i = 0; i < N; i++) {
                int sum = C;
                for (int j = 0; j < M; j++) {
                    sum += A[i][j] * B[j];
                }
                if (sum > 0) {
                    count++;
                }
            }
            System.out.println(count);
        }
    }
}


Measured memory_bytes: 24276
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
ll inf = 1e18;
ll mod = 1e9+7;

int main(){
    ll n;
    cin >> n;
    ll sum = 0;
    for (int i = 1; i <= n; i++) {
        if (i % 3 == 0 || i % 5 == 0) continue;
        sum += i; 
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 3636
#include<stdio.h>
int cont=0;
int judge(int);
int main()
{
  int i,n=0,j;
  int NN[1000];

  
  while(1){
    scanf("%d",&NN[n]);
    if(NN[n]==0)break;
    n++;
  }
  
  for(i=0;i<n;i++){
    for(j=NN[i]+1;j<=2*NN[i];j++){
      cont+=judge(j);
    }
    printf("%d\n",cont);
    cont=0;
  }
  return 0;
}
   
int judge(int n)
{
  int i;
  if(n<2)return 0;
  else if(n==2)return 1;
  if(n%2==0)return 0;
  for(i=3;i<=n/i;i+=2){
    if(n%i==0)return 0;
  }
  return 1;
}

Measured memory_bytes: 604
#include <bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pli pair<ll,int>
#define fi first
#define se second
#define inf (INT_MAX/2-1)
#define infl (1LL<<60)
#define vi vector<int>
#define pb push_back
#define sz(a) (int)(a).size()
#define all(a) begin(a),end(a)
#define y0 y5656
#define y1 y7878
#define aaa system("pause");
#define dbg(x) cerr<<(#x)<<": "<<(x)<<'\n',aaa
#define dbga(x,n) cerr<<(#x)<<"[]: ";for(int _=0;_<n;_++)cerr<<x[_]<<' ';cerr<<'\n',aaa
#define dbgs(x) cerr<<(#x)<<"[stl]: ";for(int _:x)cerr<<_<<' ';cerr<<'\n',aaa
#define dbgp(x) cerr<<(#x)<<": "<<x.fi<<' '<<x.se<<'\n',aaa
#define maxn 3000

using namespace std;

double p[maxn+5], d[maxn+5][maxn+5];///d[i][j]=primele i cu j ok

int main () {
  ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
  int n; cin >> n;
  int i, j, z;
  for (i = 1; i <= n; i++) cin >> p[i];
  d[1][0] = 1-p[1]; d[1][1] = p[1];
  for (i = 2; i <= n; i++) {
    d[i][0] = d[i-1][0]*(1-p[i]);
    for (j = 1; j <= i; j++) d[i][j] = d[i-1][j-1]*p[i] + d[i-1][j]*(1-p[i]);
  }
  double ans = 0.0;
  for (j = n/2+1; j <= n; j++) ans += d[n][j];
  cout << fixed << setprecision(12) << ans;
  return 0;
}

Measured memory_bytes: 69120
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1001001001;
const int MOD = 1000000007;

vector<long long> fact_inv, inv, Com;
/*  init_nCk :二項係数のための前処理
    計算量:O(n)
*/
void init_nCk(int n, int SIZE) {
    fact_inv.resize(SIZE + 5);
    inv.resize(SIZE + 5);
    fact_inv[0] = fact_inv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < SIZE + 5; i++) {
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        fact_inv[i] = fact_inv[i - 1] * inv[i] % MOD;
    }
    Com.resize(SIZE + 5);
    Com[0] = 1;
    for (int i = 1; i < SIZE + 5; i++) {
        Com[i] = Com[i - 1] * ((n - i + 1) * inv[i] % MOD) % MOD;
    }
}
/*  nCk :MODでの二項係数を求める(前処理 int_nCk が必要)
    計算量:O(1)
*/
long long nCk(int k) {
    assert(!(k < 0));
    return Com[k];
}

ll beki(ll a, ll b) {
  if(b == 0) return 1;
  ll ret = beki(a, b / 2);
  ret = ret * ret % MOD;
  if(b & 1) ret = ret * a % MOD;
  return ret;
}

int main() {
  int n, a, b;
  cin >> n >> a >> b;
  ll ans = 0;
  ans = (beki(2, n) - 1 + MOD) % MOD;
  init_nCk(n, 200000);
  ans = (ans -  nCk(a) + MOD) % MOD;
  ans = (ans -  nCk(b) + MOD) % MOD;
  cout << ans << endl;
  return 0;
}

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

signed main() {
  string s;
  cin>>s;
  int n=s.size();
  if(s[0]=='0'||s[n-1]=='1'){
    cout<<-1;
    return 0;
  }
  int u[n-1],v[n-1];
  int p=1;
  for(int i=1;i<=n/2;i++){
    if(s[i-1]!=s[n-i-1]){
      cout<<-1;
      return 0;
    }
    if(s[i-1]=='0')continue;
    while(p<i){
      u[p-1]=p;
     // u[n-2-(p-1)]=n-p;
      v[p-1]=i;
      //v[n-2-(p-1)]=n-i;
      p++;
    }
  }
  while(p<n){
    u[p-1]=p;
    v[p-1]=n;
    p++;
  }

  for(int i=0;i<n-1;i++){
    cout<<u[i]<<' '<<v[i]<<endl;
  }
  return 0;
}


Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
typedef pair<int, int> P;
ll Mod = 1000000007;

bool is_prime(ll N) {
    if (N == 1) return false;
    for (ll i = 2; i * i <= N; ++i) {
        if (N % i == 0) return false;
    }
    return true;
}

int main() {
  int N;
  cin >> N;
  vector<ll> vec;
  for (ll i = 6; i <= 55555; i+=5) {
    if (is_prime(i)) {
      vec.push_back(i);
    }
  }

  for (int i = 0; i < N; i++) {
    cout << vec[i] << " ";
  }
  cout << "\n";
  return 0;
}

Measured memory_bytes: 3552
#include <iostream>
#include <stack>
#include <cstdlib>
#include <vector>
#include <algorithm>
using namespace std;

int _stoi(string s) {
    return atoi(s.c_str());
}

int popValue(stack<int> *S) {
    int retVal = S->top();
    S->pop();
    return retVal;
}

struct startAndAmount {
    int start;
    int amount;
};

startAndAmount popValue(stack<startAndAmount> *S) {
    startAndAmount retVal = S->top();
    S->pop();
    return retVal;
}

int main(int argc, const char * argv[]) {
    stack<int> S;
    stack<startAndAmount> S2;
    string s;
    int i = 0;
    int total = 0;
    cin >> s;
    
    while(i < s.length()){
        if (s[i] == '\\') {
            S.push(i);
        } else if (s[i] == '/') {
            if (S.empty() == false) {
                int plus = 0;
                int start = popValue(&S);
                plus = i - start;
                total += plus;
                
                while (S2.empty() == false && S2.top().start > start) {
                    plus += S2.top().amount;
                    S2.pop();
                }
                startAndAmount saa;
                saa.start = start;
                saa.amount = plus;
                S2.push(saa);
            }
        }
        i++;
    }
    
    vector<int> ans;
    while (S2.empty() == false) {
        ans.push_back(popValue(&S2).amount);
    }
    reverse(ans.begin(), ans.end());
    
    cout << total << endl;
    
    cout << ans.size();
    
    for (int i = 0; i < ans.size(); i++) {
        cout << " " << ans[i];
    }
    
    cout << endl;
    
    return 0;
}

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


int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int L,R,tmp;
  cin>>L>>R;
  int ans=2019,l=L%2019,r=R%2019;
  if(R-L>=2019){
    ans=0;
  }else{
    for(int i=l;i<l+R-L;i++){
      for(int j=i+1;j<=l+R-L;j++){
        int k=j%2019;
        ans=min(ans,(i*j)%2019);
      }
    }
  }
  cout<<ans;
  return 0;
}

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

//sort(v.rbegin(), v.rend(), [](auto& x, auto& y){return x[1] < y[1];});
typedef long long ll;

int main(){
    int N,x,r=0;
    cin >> N >> x;
    vector<int> v(N);

    for (int i=0;i<N;++i){
        cin >> v[i];
    }

    sort(v.begin(),v.end());

    for (int i=0;i<N;++i){
        x-=v[i];
        if (x>=0) r++;
        else break;

        if (i==N-1&&x>0) r-=1;
    }
    
    cout << r << endl;
  }


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            long N = long.Parse(Console.ReadLine());
            long[] btnNum = new long[N];
            for (int i = 0; i < N; i++)
            {
                btnNum[i] = long.Parse(Console.ReadLine());
            }
            long num = 0;
            int cnt = 0;
            List<long> oldNum = new List<long>();
            while (true)
            {
                //該当ボタンとその先を見る
                //num == numはたどり着けないのでbreak
                if (num == btnNum[num] - 1)
                {
                    Console.WriteLine(-1);
                    return;
                }
                if (oldNum.Contains(num))
                {
                    Console.WriteLine(-1);
                    return;
                }

                // 該当番号が2なら終わり
                if (btnNum[num] == 2)
                {
                    Console.WriteLine(cnt + 1/*最初のbtn1の分*/);
                    return;
                }
                else
                {
                    oldNum.Add(num);
                    //該当の番号取得
                    num = btnNum[num] - 1;
                    //掛かった回数
                    cnt++;
                }
            }
        }
    }
}
// 文字列の入力
//string s = Console.ReadLine();

// 整数の入力
//long n = long.Parse(Console.ReadLine());

// 文字列配列の入力
//string[] inputStrArray = Console.ReadLine().Split(' ');

// 整数配列の入力
//long[] inputLongArray = Console.ReadLine().Split(' ').Select(i => long.Parse(i)).ToArray();


//Console.WriteLine(ans);

Measured memory_bytes: 33516
#include<bits/stdc++.h>
using namespace std;
inline int read () {
	int num = 0;
	char c = ' ';
	bool flag = true;
	for (;c > '9' || c < '0';c = getchar())
		if (c == '-')
			flag = false;
	for (;c >= '0' && c <= '9';num = (num << 1) + (num << 3) + c - 48, c = getchar());
	return flag ? num : -num;
}
const int maxn = 200020;
char s[maxn],t[maxn];
int n;
void init () {
	scanf("%s",s + 1);
	scanf("%s",t + 1);
	n = strlen(s + 1);
}
int a[maxn],map1[maxn],cnt1 = 0;
void work1 () {
	for (int i = 1;i <= n;i ++) {
		int c = (int)s[i];
		if (map1[c] == 0)
			map1[c] = ++ cnt1;
		a[i] = map1[c];
	}
}
int b[maxn],map2[maxn],cnt2 = 0;
void work2 () {
	for (int i = 1;i <= n;i ++) {
		int c = (int)t[i];
		if (map2[c] == 0)
			map2[c] = ++ cnt2;
		b[i] = map2[c];
	}
}
int main () {
	init ();
	work1 ();
	work2 ();
	for (int i = 1;i <= n;i ++)
		if (a[i] != b[i]) {
			printf("No\n");
			return 0;
		}
	printf("Yes\n");
	return 0;
}

Measured memory_bytes: 2176
import math

def main():
    a = int(input())
    print(mama(a,0,0))

def mama(hp,num,sum):
    sum = sum + 2**num
    num = num + 1
    if hp <= 1:
        return sum

    hp = hp//2
    return mama(hp,num,sum)


if __name__ == "__main__":
    main()

Measured memory_bytes: 3060
MOD = 10 ** 9 + 7

N, K = map(int, input().split(" "))

fin = 0
for k in range(K,N+2):
    low = k * (k - 1) / 2
    high = k * (2*N - k  + 1) / 2
    fin = (fin + ((high - low) + 1)) % MOD

print(int(fin))

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

int main() {
    int N;
    cin >> N;
    int L[110];

    for(int i = 0; i < N; i++) {
        cin >> L[i];
    }
    sort(L, L+N);

    int count = 0;
    for(int i = 0; i < N; i++) {
        for(int j = 0; j < i; j++) {
            for(int k = 0; k < j; k++) {
                if(L[k] != L[j] && L[i] != L[j] && L[k]+L[j]>L[i]) {
                    count++;
                }
            }
        }
    }
    cout << count << endl;
}

Measured memory_bytes: 3668
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>
#include<complex>
#include <cassert>

using namespace std;

#define ll long long
#define ld long double
#define INF 1e9
#define LINF (ll)INF*INF
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,a,n) for(int i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

#define int ll //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

const double PI=acos(-1);
const double EPS=1e-9; //うまくいかなかったらゆるめる

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef pair<pii,int> ppi;
typedef pair<int,pii> pip;
typedef vector<pii> vp;
typedef vector<vi> vvi;

int gcd(int a, int b){if(b==0) return a;return gcd(b,a%b);}
int lcm(int a, int b){return a/gcd(a,b)*b;}

int a[1000005];

signed main(void) {
    int n;
    cin >> n;
    rep(i,n){
        int in;
        cin >> in;
        a[in]++;
    }
    int ans = a[1] == 1;
    for(int num = 1000000; num > 1; num--)if(a[num] == 1 && a[1] == 0){
        bool c = true;
        for(int i = 2; i*i <= num; i++)if(num%i == 0){
            if(a[i])c = false;
            if(i*i < num && a[num/i])c = false;
        }
        if(c) ans++;
    }
    cout << ans << endl;
}


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

int main(){
    int n,m;
    cin >> n >> m;
    vector<int>a(m);
    vector<int>b(m);
    vector<int>c(n);
    for(int i=0;i<m;i++){
        cin >> a[i];
        cin >> b[i];
    }
    for(int i=0;i<n;i++){
        c[i]=count(a.begin(),a.end(),i+1)+count(b.begin(),b.end(),i+1);
    }
    for(int i=0;i<n;i++){
        cout << c[i] << "\n";
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n,x,d,p,ans;
int main(){
	scanf("%lld%lld%lld",&n,&x,&d),p=d/abs(__gcd(x,d));
	if(!d)return printf("%d",x==0?1:n+1),0;
	//if(d<0)x=-x,d=-d;
	for(ll i=0;i<=n;i++){
		ll l=i*(i-1)-n*(n-1)/2,r=(n-1)*n/2-(n-i)*(n-i-1);
		ll l1=(i-p)*(i-p-1)-n*(n-1)/2-2*x*p/d,r1=n*(n-1)/2-(n-i+p)*(n-i+p-1)-2*x*p/d;
		if(r<l1 or l>r1 or i<p)ans+=(r-l)/2+1;
		else{
			if(l<=l1 and l1<=r)ans+=(l1-l)/2;
			if(l<=r1 and r1<=r)ans+=(r-r1)/2;
		}
	}
	printf("%lld",ans);
	return 0;
}


Measured memory_bytes: 256
#include<set>
#include<map>
#include<cmath>
#include<queue>
#include<bitset>
#include<string>
#include<cstdio>
#include<cctype>
#include<cassert>
#include<cstdlib>
#include<cstring>
#include<sstream>
#include<iostream>
#include<algorithm>

#define For(i,x,y) for (int i=x;i<y;i++)
#define pb push_back
#define mp make_pair
#define fi first
#define se second

#define dprintf(...) fprintf(stderr,__VA_ARGS__)
using namespace std;

int IN(){
	int c,f,x;
	while (!isdigit(c=getchar())&&c!='-');c=='-'?(f=1,x=0):(f=0,x=c-'0');
	while (isdigit(c=getchar())) x=(x<<1)+(x<<3)+c-'0';return !f?x:-x;
}

typedef long long ll;
typedef double db;
typedef pair<int,int> pii;
typedef vector<int> Vi;

const int N=200000+19;

int fa[N];
int n,m,k,x;

int getf(int x){
	return fa[x]==x?x:fa[x]=getf(fa[x]);
}
void Union(int x,int y){
	x=getf(x),y=getf(y);
	if (x!=y) fa[x]=y;
}

int main(){
	n=IN(),m=IN();
	For(i,1,n+m+1) fa[i]=i;
	For(i,1,n+1){
		k=IN();
		while (k--) Union(i,IN()+n);
	}
	For(i,2,n+1)
		if (getf(i)!=getf(1)){
			puts("NO");
			return 0;
		}
	puts("YES");
}

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

using  namespace  std;

#define PI              acos(-1.0)
#define lcm(a,b)        (a * (b / __gcd(a,b)))
#define en '\n'

#define READ_IN freopen("Input.txt","r",stdin);
#define READ_OUT freopen("Output.txt","w",stdout);


void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define trace(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define trace(x...)
#endif

typedef long long int           ll;
typedef unsigned long long int  llu;


int main(void)
{
    //READ_IN

    ios_base::sync_with_stdio(false);
   cin.tie(NULL);

    string a,b;

    cin >> a >> b;

    cout << b+a << endl;

    return 0;

}



Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
#define Rep(i, n) for (int i = 0; i < (int)(n); i++)
#define BitRep(i, n) for (int i = 0; i < (int)(1 << n); i++)
#define All(vec) vec.begin(), vec.end()
#define Sum(vec) accumulate(vec.begin(), vec.end(), 0)
#define Sort(vec) sort(vec.begin(), vec.end())
#define Reverse(vec) reverse(vec.begin(), vec.end())
#define Next_permutation(vec) next_permutation(vec.begin(), vec.end())
#define PI acos(-1)

int main() {
    int N;
    string S;
    cin >> N >> S;
    int cnt = 0;
    for (int i = 1; i < S.size(); i++) {
        if (S[i] == 'E') cnt++;
    }
    int ans = cnt;
    for (int i = 1; i < S.size(); i++) {
        if (S[i - 1] == 'W') cnt++;
        if (S[i] == 'E') cnt--;
        ans = min(ans, cnt);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3904
#include<stdio.h>

int num,X[50];

int cal(int i, int d){
  if(d==0){
    return 1;
  }
  if(i>=num){
    return 0;
  }
  int result = cal(i+1,d) || cal(i+1,d-X[i]);

  return result;
}

int main(){
  int num2,Y,i;

  scanf("%d",&num);

  for(i=0;i<num;i++){
    scanf("%d",&X[i]);
  }
  scanf("%d",&num2);

  for(i=0;i<num2;i++){
    scanf("%d",&Y);
    if(cal(0,Y)){
      printf("yes\n");
    }
      else printf("no\n");
    }

    return 0;
  }



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

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

	int n1, n10, n100;
	n1 = n%10; n = n/10;
	n10 = n%10; n = n/10;
	n100 = n%10; n = n/10;

	// cout << n100 << n10 << n1 << endl;

	bool a = (n1 == 7) || (n10 == 7) || (n100 == 7);
	if (a) cout << "Yes" << endl;
	else cout << "No" << endl;
}

Measured memory_bytes: 3596
import java.util.*;
//import static java.lang.Integer.*;
import static java.lang.Long.*;
//import static java.lang.Math.*;
import static java.lang.System.*;

public class Main {
	public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(in);
		long k = parseLong(sc.next());
		sc.close();
		long k2 = k / 2;
		out.println(k2*(k2+k%2));
	}
}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using st = string;
using P = pair<int, int>;
#define mrep(i, m, n) for(int i = m; i < n; i++)
#define rep(i, n) mrep(i, 0, n)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)

const int mod = (int) (1e9 + 7);

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a.at(i);
    vector<ll> b(n + 1, 0); // aの累積和を格納する配列
    rep(i, n){
        b.at(i + 1) = b.at(i) + a.at(i);
    }
    ll ans = 0;
    rep(i, n){
        ll sum = (b.at(n) - b.at(i + 1)) % mod; // A[i] + ... + A[N - 1] = B[N] - B[i]
        ans += (a.at(i) * sum) % mod;
        ans %= mod;
    }
    ans %= mod;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 5592
import math
a, b = map(int, input().split())

for i in range(1, 1010):
    A = math.floor(0.08 * i)
    B = math.floor(0.1 * i)
    if a == A and b == B:
        print(i)
        break
    elif i == 1009:
        print(-1)

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

int main() {
    int k, ans = -1;
    int s = 0;
    cin >> k;
    
    for (int i = 1; i <= k; i++) {
        s = (s * 10 + 7) % k;
        
        if (s == 0) {
            ans = i;
            break;
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3644
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
using namespace std;

typedef long long LL;

const int N=100005;

int n,m;
LL stack[N],t[N],ans[N],a[N];

int binary(int r,LL k)
{
    int l=1;
    while (l<=r)
    {
        int mid=(l+r)/2;
        if (a[mid]<=k) l=mid+1;
        else r=mid-1;
    }
    return l-1;
}

int main()
{
    scanf("%d%d",&n,&m);
    int top=0;
    stack[++top]=n;
    for (int i=1;i<=m;i++)
    {
        LL x;cin>>x;
        while (x<=stack[top]) top--;
        stack[++top]=x;
    }
    m=top;
    for (int i=1;i<=top;i++) a[i]=stack[i];
    t[m]=1;
    for (int i=m;i>=1;i--)
    {
        LL k=a[i];int p=binary(i-1,k);
        while (p)
        {
            t[p]+=k/a[p]*t[i];
            k%=a[p];
            p=binary(p-1,k);
        }
        ans[k]+=t[i];
    }
    for (int i=n;i>=1;i--) ans[i]+=ans[i+1];
    for (int i=1;i<=n;i++) printf("%lld\n",ans[i]);
    return 0;
}

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

int main()
{
    int N, M;
    cin >> N >> M;
    vector<tuple<int, int, int>> years(M);
    int Pi, Yi;
    for (int i = 0; i < M; i++)
    {
        cin >> Pi >> Yi;
        years.at(i) = make_tuple(Yi, Pi, i);
    }

    sort(years.begin(), years.end());

    vector<pair<int, int>> cities(M);
    vector<int> idx_in_pref(N, 0);
    for (auto &&year : years)
    {
        int i = get<2>(year), Pi = get<1>(year);
        int idx = ++idx_in_pref.at(Pi - 1);
        cities.at(i) = make_pair(Pi, idx);
    }

    for (auto &&city : cities)
    {
        int Pi = city.first, idx = city.second;
        printf("%06d%06d\n", Pi, idx);
    }
}

Measured memory_bytes: 3840
mod = 1000000007
MOD = 998244353
ii = lambda :  int(input())
si = lambda :  input()
dgl = lambda : list(map(int, input()))
f = lambda :   map(int, input().split())
il = lambda :  list(map(int, input().split()))
it = lambda :  tuple(map(int, input().split()))
ls = lambda :  list(input())
n=ii()
l=il()

l2=[[j,i] for i,j in enumerate(l)]
l2.sort()
for i in range(n):
    print(l2[i][1]+1,end=' ')



Measured memory_bytes: 21464
#include <bits/stdc++.h>
#define rep(i,n) for(long long int i = 0; i < n; i++)
#define _rep(i,m,n) for(long long int i = m; i < n; i++)
#define print(n) std::cout << n << std::endl
#define _print(n) std::cout << n
using namespace std;
typedef long long ll;
const int N = 1000000;
const ll mod = 1000000007;

int main(){
    string s; cin >> s;
    
    if(s[2] == s[3] && s[4] == s[5])print("Yes");
    else print("No");
}

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

char s[10001];
int M = 1e9+7, d, dp[10001][101][2], n;

int solve(int i = 0, int m = 0, int f = 0) {
    if (i == n) {
        return m==0;
    }
    int& ret = dp[i][m][f];
    if (~ret) {
        return ret;
    }
    ret = 0;
    for (int j = 0; j <= 9; ++j) {
        if (j> s[i]-'0' && !f) {
            break;
        }
        ret += solve(i+1, (m+j)%d, f || (j < s[i]-'0'));
        if (ret >= M) {
            ret -= M;
        }
    }
    return ret;
}
int main() {
    scanf("%s %d", s, &d);
    n = strlen(s);
    memset(dp, -1, sizeof dp);
    int ans = solve()-1;
    if (ans == -1) {
        ans = M-1;
    }
    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 8960
from collections import defaultdict
import math
def P(n, r):
    return math.factorial(n)//math.factorial(n-r)
def C(n, r):
    return P(n, r)//math.factorial(r)
S = input()[::-1]
N = len(S)
cnt = [0]*N
tmp = 0
d = defaultdict(int)
d[0] += 1
for i in range(N):
    tmp += int(S[i])*pow(10,i,2019)
    tmp %= 2019
    d[tmp] += 1
ans = 0
for v in d.values():
    if v >= 2:
        ans += C(v,2)
print(ans)

Measured memory_bytes: 83368
using System;

namespace ConsoleApp3
{
    class Program
    {
        static void Main(string[] args)
        {
            int x = int.Parse(Console.ReadLine());

            if (x == 0)
            {
                Console.WriteLine("1");
            }
            else
            {
                Console.WriteLine("0");
            }

        }
    }
}


Measured memory_bytes: 27472
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;

int main(){
  ll N,K,X,Y;
  cin >> N >> K >> X >> Y;

  if(K >= N) cout << N * X << endl;
  else cout << K * X + (N - K) * Y << endl;
  return 0;
}


Measured memory_bytes: 256
import sys


Stack = []
MAX = 1000

def push(x):
    #if isFull():
    #    print "ERROR!"
    #    sys.exit()
    Stack.append(x)

def pop():
    #if isEmpty():
    #    print "ERROR!"
    #    sys.exit()
    Stack.pop(-1)

def cul(exp):
    for v in exp:
        if v == "+":
            x = reduce(lambda a,b:int(a)+int(b), Stack[-2:])
            for i in range(2):
                pop()
            push(x)
        elif v == "-":
            x = reduce(lambda a,b:int(a)-int(b), Stack[-2:])
            for i in range(2):
                pop()
            push(x)
        elif v == "*":
            x = reduce(lambda a,b:int(a)*int(b), Stack[-2:])
            for i in range(2):
                pop()
            push(x)
        else:
            push(v)

    return Stack[0]

if __name__ == "__main__":
    exp = sys.stdin.read().strip().split(" ")
    ans = cul(exp)
    print ans

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define REP(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, a, b) for(int i=(a); i<(b); ++i)
#define FORR(i, a, b) for(int i=(b)-1; i>=(a); --i)

#define DEBUG(x) cout<<#x<<": "<<(x)<<'\n'
#define DEBUG_VEC(v) cout<<#v<<":";REP(i, v.size())cout<<' '<<v[i];cout<<'\n'
#define ALL(a) (a).begin(), (a).end()

template<typename T> inline void CHMAX(T& a, const T b) {if(a<b) a=b;}
template<typename T> inline void CHMIN(T& a, const T b) {if(a>b) a=b;}

constexpr ll MOD=1000000007ll;
// constexpr ll MOD=998244353ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

const double EPS=1e-11;
#define EQ0(x) (abs((x))<EPS)
#define EQ(a, b) (abs((a)-(b))<EPS)

constexpr int C=36800;
int d[100][100];
bool dp[100][100][73610];

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  // cout<<setprecision(10)<<fixed;
  int h, w, a[100][100], b[100][100];
  cin>>h>>w;
  REP(i, h)REP(j, w){
    cin>>a[i][j];
  }
  REP(i, h)REP(j, w){
    cin>>b[i][j];
  }
  REP(i, h)REP(j, w){
    d[i][j]=abs(a[i][j]-b[i][j]);
  }
  REP(i, h)REP(j, w){
    if(i==0 && j==0){
      dp[i][j][d[i][j]+C]=dp[i][j][-d[i][j]+C]=true;
      continue;
    }
    if(i>0){
      REP(k, C*2+1){
        if(dp[i-1][j][k]){
          dp[i][j][k+d[i][j]]=dp[i][j][k-d[i][j]]=true;
        }
      }
    }
    if(j>0){
      REP(k, C*2+1){
        if(dp[i][j-1][k]){
          dp[i][j][k+d[i][j]]=dp[i][j][k-d[i][j]]=true;
        }
      }
    }
  }
  int ans=1e9;
  REP(i, C*2+1){
    if(dp[h-1][w-1][i]){
      CHMIN(ans, abs(i-C));
      if(i>=C){
        break;
      }
    }
  }
  cout<<ans<<'\n';
  return 0;
}

Measured memory_bytes: 573952
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		
		long tot = 0;
		Array.Sort(A,B);
		for(int i=0;i<N;i++){
			tot += B[i];
			if(tot < K) continue;
			Console.WriteLine(A[i]);
			break;
		}
		
		
		
	}
	
	int N;
	long K;
	long[] A,B;
	public Sol(){
		var dd = rla();
		N = (int) dd[0]; K = dd[1];
		A = new long[N];
		B = new long[N];
		for(int i=0;i<N;i++){
			var d = ria();
			A[i] = d[0]; B[i] = d[1];
		}
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}


Measured memory_bytes: 16836
#include <algorithm>
#include <iostream>
#include <numeric>
#include <vector>
using namespace std;

int main() {
  int N, M;
  cin >> N >> M;
  vector<int> X(M), dist;
  for (int i = 0; i < M; i++) cin >> X[i];
  if (M <= N) {
    cout << 0 << endl;
    return 0;
  }
  sort(X.begin(), X.end());
  for (int i = 1; i < M; i++) {
    dist.push_back(X[i] - X[i - 1]);
  }
  sort(dist.begin(), dist.end());
  for (int i = 0; i < N - 1; i++) {
    dist.pop_back();
  }

  cout << accumulate(dist.begin(), dist.end(), 0) << endl;
}

Measured memory_bytes: 1276
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(int)(n); i++)

using namespace std;
using LL = long long;
using P = pair<int,int>;

int main(){
	LL N;
	cin >> N;
	if(N%2==1){
		cout << 0 << endl;
		return 0;
	}
	LL div=10, ans=0;
	while(div<=N){
		ans+=N/div;
		div*=5;
	}
	cout << ans << endl;

	return 0;
}

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

int main() {
 int n,m;
 cin >> n >> m;
 vector<int> vec(m);
 
 for(int i=0;i<m;i++){
    cin >> vec.at(i);
 }
 
 sort(vec.begin(),vec.end());
 vector<int> ans(m-1);
 
 for(int i=0;i<m-1;i++){
    ans.at(i) = vec.at(i+1) - vec.at(i); 
 }
 
 sort(ans.begin(),ans.end());
 int answer = 0;
 
 for(int i=0;i<m-n;i++){
    answer += ans.at(i); 
 }
 cout << answer << endl;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define ll long long
#define double long double
#define rep(i,n) for(ll i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define mod (ll)(1e9+7)
#define inf (ll)(3e18+7)
#define pi (double) acos(-1)
#define P pair<int,int>
#define PiP pair<int,pair<int,int>>
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
using namespace std;

int main() {
    string s, k = "keyence";
    cin >> s;
    if(s.substr(0, 7) == k || s.substr(s.size()-7, 7) == k)cout << "YES";
    else{
        int now = 0, a=0, b=0;
        while(s[a] == k[now]){
            a++;
            now++;
        }
        reverse(all(s));
        reverse(all(k));
        now = 0;
        while(s[b] == k[now]){
            b++;
            now++;
        }
        if(a+b >= 7)cout << "YES";
        else cout << "NO";
    }
}


Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            out.println((in.nextInt() + in.nextInt()) % 24);
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}



Measured memory_bytes: 21460