akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cmath>
#include <numeric>

using namespace std;

#define int long long
typedef long double ld;
#define pii pair<int, int>
#define vi vector<int>
#define vii vector<vi>
#define viii vector<vii>
#define vpii vector<pii>
#define vb vector<bool>
#define vbb vector<vb>
#define vs vector<string>
#define pb push_back
#define ff first
#define ss second
#define all(a) a.begin(), a.end()
#define in(a, x) for (int i = x; i < (a).size(); ++i) cin >> (a)[i]
#define out(a) for (auto qwe : a) cout << qwe << " "

const int INF = 1e9;
const int INF64 = 1e18;
const int MOD = 1e9 + 7;
const int MOD9 = 1e9 + 9;
const int MOD3 = 998244353;
const int P = 37;

const int mxn = 300;

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

    int n, k;
    cin >> n >> k;

    vi a(n);
    in(a, 0);
    sort(all(a));

    vb firstWins(k + 1, false);
    firstWins[0] = false;

    for (int j = 1; j <= k; ++j) {
        for (int i = 0; i < n; ++i) {
            if (a[i] > j) break;

            if (!firstWins[j - a[i]]) firstWins[j] = true;
        }
    }

    if (firstWins[k]) {
        cout << "First";
    } else {
        cout << "Second";
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

using namespace std;

#define rep(i, a, b) for (int i = a; i < b; i++)
#define rrep(i, a, b) for (int i = a; i <= b; i++)
#define all(a)  begin((a)),end((a))
#define uniq(c) (c).erase(unique(all((c))), end((c)))

int main()
{
    long long N, M; cin >> N >> M;
    cout << (1900LL*M + 100LL*(N-M)) * pow(2, M) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#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 repi(i,x) for(auto i=(x).begin(),i##_fin=(x).end();i!=i##_fin;i++)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
string solve(bool a) { return ((a) ? "Yes" : "No"); }
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef pair<int , int> Pi;
typedef vector<Pi> VPi;
typedef vector<long long> V;
typedef vector<V> VV;
typedef pair<long long , long long> P;
typedef vector<P> VP;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1;} return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1;} return 0;}
template <class T, class U>ostream& operator<<(ostream& os, const pair<T, U>& p) {
	os << "(" << p.first << "," << p.second << ")";
	return os;
}
template <class T>ostream& operator<<(ostream& os, const vector<T>& v) {
	os << "{";
	rep(i, v.size()) {
		if (i) os << ",";
		os << v[i];
	}
	os << "}";
	return os;
}
template <class T, class U>istream& operator>>(istream& is, pair<T, U>& p) {
	is >> p.first >>p.second ;
	return is;
}
template <class T>istream& operator>>(istream& is,  vector<T>& v) {
	rep(i, v.size()) {
		is >> v[i];
	}
	return is;
}
const long long INFLL = 1LL<<60;
const int INF = 1<<30;
const double PI=acos(-1);
int main(){
	int n;
	ll ans=0LL;
	cin >>n;
	VP data(n);
	cin >> data;
	sort(all(data),greater<P>());
//	clog << data << endl;
	ans = data[0].F + data[0].S;
	cout<<ans<<endl;
}

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

int main(){
    string S;
    cin >> S;
    bool judge = true;
    for(int i = 0; i < S.length() - 1; i++){
        if(S[i] == S[i + 1]) judge = false;
    }
    if(judge) cout << "Good" << endl;
    else cout << "Bad" << endl; 
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int, int>;
const int INF = 1e9;

int main() {
  string a, s, c;
  cin >> a >> s >> c;
  cout << "A" << s.substr(0, 1) << "C" << endl;
}


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

int main (){
    int n;
    cin >> n;
    string s[n];
    double x[n];

    for(int i=0;i < n;i++){
        cin >> x[i] >> s[i];
    }

    double ans = 0;

    for(int i=0;i < n;i++){
        if(!s[i].compare("JPY")){
            ans += x[i];
        }
        else if(!s[i].compare("BTC")){
            ans += x[i] * 380000.0;
        }
    }

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

    
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<algorithm>
#include<math.h>
#include<string>
#include<iostream>
#include<vector>
#include<cstdlib>
using namespace std;
 
template <class T> using V = vector<T>;
 
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;
}
 
const long long INF = 1LL << 60;
 
using ll = long long;
using db = double;
using st = string;
using ch = char;
using bl = bool;
using vll = V<ll>;
using vpll =V<pair<ll,ll>>;
using vst = V<st>;
using vdb = V<db>;
using vch = V<ch>;
using vbl = V<bl>;
 
 
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define rFOR(i,a,b) for(ll i=(a);i>(b);i--)
#define oFOR(i,a,b) for(ll i=(a);i<(b);i+=2)
#define bgn begin()
#define en end()
#define SORT(a) sort((a).bgn,(a).en)
#define REV(a) reverse((a).bgn,(a).en)
#define M(a,b) max(a,b)
#define rM(a,b) min(a,b)
#define fi first
#define se second
#define sz size()
#define gcd(a,b) __gcd(a,b)
#define co(a) cout<<a<<endl;
#define ci(a) cin>>a;
 

vll dp(100100);

ll sum(ll n) {
  ll m=0;
  FOR(i,0,20){
    m+=n%10;
    n/=10;
    if(n==0){
      break;
    }
  }
  return m;
}
 
 
const int MAX = 510000;
const int MOD = 1000000007;
 
long long fac[MAX], finv[MAX], inv[MAX];
 
void Comuse() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
 
 
#define comuse Comuse()
 
ll combi(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
 
 
 
 
ll lcm(ll a,ll b){
  ll n;
  n=a/gcd(a,b)*b;
  return n;
}
 
 
/****************************************\
| Thank you for viewing my code:)        |
| Written by RedSpica a.k.a. RanseMirage |
| Twitter:@asakaakasaka                  | 
\****************************************/
 
 
signed main() {
  ll a=1000000007;
  
  ll n,k;
  	ci(n>>k);
  
  vpll A(n);
  
  FOR(i,0,n){
	ci(A[i].fi)
  }
  
  ll ans=0;
  ll count=0;
  
  FOR(i,0,n){
    FOR(j,0,n){
      if(i<j&&A[i].fi>A[j].fi){
        ans++;//同じ群で何個あるか
      }
      if(A[i].fi>A[j].fi){
        count++;
      }
    }
    A[i].se=count;
    count=0;
    ans%=a;
  }

  ans*=k;
  ans%=a;
  
  FOR(i,0,n){
    if(k%2==0){
	ans+=A[i].se%a*k/2%a*(k-1)%a;
  }
    else{
      ans+=A[i].se%a*(k-1)/2%a*k%a;
    }
  }
  
  co(ans%a)
}

Measured memory_bytes: 1024
#include<iostream>
#include<string>
#include<vector>
#include<iomanip>
#include<algorithm>
#include<queue>
#include<stack>
#include<map>
using namespace std;
#define ll long long
int main(){
	ll N;
	cin >> N;
	string S;
	ll i,mx=0;
	map < string ,ll> mp;
	for(i=0;i<N;i++){
		cin >> S;
		decltype(mp)::iterator it = mp.find(S);
		if(it!=mp.end())++mp[S];else mp.insert(make_pair(S,1));
		mx=max(mp[S],mx);
	}
	vector < string > ans;
	for(auto x : mp){
		if(x.second==mx) cout << x.first << endl;
	}
	return 0;
}

Measured memory_bytes: 25216
N = int(input())

N1 = int(str(N)[-1])

for i in [2, 4, 5, 7, 9]:
    if i == N1:
        print('hon')

for i in [0, 1, 6, 8]:
    if i == N1:
        print('pon')

for i in [3]:
    if i == N1:
        print('bon')


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

int main() {
  int N,M; cin >> N >> M;
  int edge[50][50];
  for(int i=0; i<50; i++) for(int j=0; j<50; j++) edge[i][j]=0;
  
  int a,b;
  for(int i=0; i<M; i++){
    cin >> a >> b; a--; b--;
    edge[a][b]=1; edge[b][a]=1;
  }
  
  int result=0;
  int reached[50]; //行けたら1
  int start,end,q[50];
  for(int i=0; i<N; i++){
    for(int j=i; j<N; j++){
      if(edge[i][j]==1){
        edge[i][j]=0; edge[j][i]=0; //辺を切る
        
        //ある頂点から他すべてへ行けるかを見る
        for(int k=0; k<N; k++) reached[k]=0; //到達点初期化
        for(int k=0; k<N; k++) q[k]=0; //キュー初期化
        start=0; end=0;
        
        q[end]=0; end++; reached[0]=1; //点0からガンガン行くぜ
        while(start!=end){
          for(int k=0; k<N; k++){
            if(edge[q[start]][k]==1&&reached[k]==0){
              q[end]=k; end++; reached[k]=1;
            }
          }
          start++;
        }
        
        if(end!=N) result++;
        
        edge[i][j]=1; edge[j][i]=1; //辺を戻す
      }
    }
  }
  cout << result << endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<queue>
#define N 205
using namespace std;
const int inf = 0x3f3f3f3f;
inline int read(){
	int sum = 0, t = 1; char ch = getchar();
	while(ch < '0' || ch > '9'){ if(ch == '-') t = -1; ch = getchar(); }
	while(ch >= '0' && ch <= '9'){ sum = sum * 10 + ch - '0'; ch = getchar(); }
	return sum * t;
}

int n, m;
char s[N][N];

struct edge{
	int to, cap, rev;
};
vector<edge>G[N];
int lev[N], vis[N], S, T;

void add(int x, int y, int cap){
	G[x].push_back((edge){y, cap, G[y].size()});
	G[y].push_back((edge){x, 0, G[x].size() - 1});
}

bool bfs(){
	memset(lev, -1, sizeof(lev));
	queue<int>q;
	q.push(S);
	lev[S] = 0;
	while(!q.empty()){
		int x = q.front(); q.pop();
		for(int i = 0; i < G[x].size(); i++){
			edge &e = G[x][i];
			if(e.cap && lev[e.to] < 0)
				lev[e.to] = lev[x] + 1, q.push(e.to);
		}
	}
	return lev[T] != -1;
}

int dfs(int x, int f){
	if(x == T || !f) return f;
	for(int &i = vis[x]; i < G[x].size(); i++){
		edge &e = G[x][i];
		if(e.cap && lev[e.to] > lev[x]){
			int d = dfs(e.to, min(f, e.cap));
			if(d){
				e.cap -= d;
				G[e.to][e.rev].cap += d;
				return d;
			}
		}
	}
	return 0;
}

int dinic(){
	int flow = 0, f;
	while(bfs()){
		memset(vis, 0, sizeof(vis));
		while((f = dfs(S, inf)) > 0) flow += f;
	}
	return flow;
}

int main(){
	n = read(); m = read();
	for(int i = 1; i <= n; i++)
		scanf("%s", s[i] + 1);
	S = n + m + 1; T = n + m + 2;
	for(int i = 1; i <= n; i++)
		for(int j = 1; j <= m; j++)
			if(s[i][j] == 'S')
				add(S, i, inf), add(S, j + n, inf);
			else if(s[i][j] == 'T')
				add(i, T, inf), add(j + n, T, inf);
			else if(s[i][j] == 'o')
				add(i, j + n, 1), add(j + n, i, 1);
	int ans = dinic();
	if(ans >= inf) puts("-1");
	else printf("%d\n", ans);
}


Measured memory_bytes: 896
// Problem : A - ∴ (Therefore)
// Contest : AtCoder - AtCoder Beginner Contest 168
// URL : https://atcoder.jp/contests/abc168/tasks/abc168_a
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include<bits/stdc++.h>
#define ll long long
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
#define sort(v) sort(all(v))
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define mod 1000000007
using namespace std;
int main()
{
    IOS
    int t=1;
    //cin>>t;
    while(t--)
    {
		int k;
		cin>>k;
		string s;
		cin>>s;
		if(s.size()<=k) cout<<s;
		else cout<<s.substr(0,k)<<"...";
		cout<<endl;
    }
    return 0;
}


Measured memory_bytes: 3644
use proconio::input;
use std::str::from_utf8;
 
fn main() {
    input! {
        n: i64
    }

  	let mut a = n;
  	let mut index = 0;
  	let mut sum = 0;
	while 0 < n - sum {
        index += 1;
		sum += 26i64.pow(index);
  	}
  	let mut left = n + 26i64.pow(index) - sum - 1;
  	index -= 1; 
  	
  	let mut result = vec![];
  	while 0 < index {
        let temp = 26i64.pow(index);
        let char_code = ((left  / temp) + 97) as u8;
      	result.push(char_code);
        left = left % temp;

 		index -= 1;   
    }
  
    let char_code = (left + 97) as u8;
    result.push(char_code);
  	
	println!("{}", from_utf8(&result).unwrap());
}

Measured memory_bytes: 2112
# ABC125B - Resale
import sys
input = sys.stdin.readline

n = int(input())
v_lst = list(map(int, input().rstrip().split()))
c_lst = list(map(int, input().rstrip().split()))
total = 0
lst = [v_lst[i] - c_lst[i] for i in range(n)]

for i in range(n):
    if lst[i] > 0:
        total += lst[i]
print(total)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    ll n;
    cin>>n;
    ll a[n];
    for(ll i=0; i<n; i++) cin>>a[i];
    for(ll i=n-1; i>=0; i--)
    {
        cout<<a[i];
        if(i>0) cout<<" ";
    }
    cout<<endl;
    return 0;
}



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

int main(){
  int n, a, b, c; cin >> n >> a >> b >> c; vector<string> s(n+1, ""); rep(i, n) cin >> s[i];
  vector<char> v(n); bool d = 1;
  rep(i, n){
    if(s[i] == "AB"){
      if(a == 0 && b == 0){
        d = 0; break;
      }
      else if(b == 0){
        b++; a--;
        v[i] = 'B';
      }
      else if(a == 0){
        a++; b--;
        v[i] = 'A';
      }
      else{
        if(s[i+1] == "AC"){
          a++; b--;
          v[i] = 'A';
        }
        else{
          b++; a--;
          v[i] = 'B';
        }
      }
    }
    if(s[i] == "AC"){
      if(a == 0 && c == 0){
        d = 0; break;
      }
      else if(c == 0){
        c++; a--;
        v[i] = 'C';
      }
      else if(a == 0){
        a++; c--;
        v[i] = 'A';
      }
      else{
        if(s[i+1] == "AB"){
          a++; c--;
          v[i] = 'A';
        }
        else{
          c++; a--;
          v[i] = 'C';
        }
      }
    }
    if(s[i] == "BC"){
      if(b == 0 && c == 0){
        d = 0; break;
      }
      else if(b == 0){
        b++; c--;
        v[i] = 'B';
      }
      else if(c == 0){
        c++; b--;
        v[i] = 'C';
      }
      else{
        if(s[i+1] == "AC"){
          c++; b--;
          v[i] = 'C';
        }
        else{
          b++; c--;
          v[i] = 'B';
        }
      }
    }
  }
  if(d){
    cout << "Yes" << "\n";
    rep(i, n){
      cout << v[i] << "\n";
    }
  }
  else cout << "No" << "\n";
  return 0;
}

Measured memory_bytes: 6376
#include<stdio.h>
int main(void){

    int a,b,c,d,n,count;
    while(scanf("%d",&n)!=EOF){
        count=0;    
        for(a=0;a<=9;a++){
            for(b=0;b<=9;b++){
                for(c=0;c<=9;c++){
                    for(d=0;d<=9;d++){
                        if(a+b+c+d==n){
                            count++;
                        }
                    }
                }
            }
        }
        printf("%d\n",count);
    }
    return 0;
}

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

int main(){
  int prime[100001] = {};
  for(int i = 2; i <= 100000; i++){
    if(!prime[i]){
      for(int j = i + i; j <= 100000; j+=i) prime[j] = 1;
    }
  }
  int cnt[100002] = {};
  for(int i = 3; i <= 100000; i += 2){
    if(!prime[i] && !prime[(i + 1) / 2]) cnt[i]++;
  }
  for(int i = 3; i < 100001; i++) cnt[i] += cnt[i-1];
  int q, r, l;
  cin >> q;
  for(int i = 0; i < q; i++){
    cin >> l >> r;
    cout << cnt[r] - cnt[l-1] << endl;
  }
  return 0;
}


Measured memory_bytes: 1536
#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
const ld eps = 1e-9;

int main() {
	while (1) {
		int N; cin >> N;
		if (!N)break;
		vector<int>v(N);
		for (int i = 0; i < N; ++i) {
			cin >> v[i];
		}
		sort(v.begin(), v.end());

		int ans = INT_MAX;
		for (int i = 0; i < N - 1; ++i) {
			ans = min(ans, v[i + 1] - v[i]);
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 3072
S = input()
N = len(S)
A = list(S)
a = 0
b = 0
for i in range(N):
  if i%2 == 0:
    #010101
    if S[i] != "0":
      a += 1
    #101010
    else:
      b += 1
  #mod2 = 1
  else:
    #010101
    if S[i] != "1":
      a += 1
    #101010
    else:
      b += 1
print(min(a,b))

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

#define rep(i, n) for(int i = 0; i < (n); ++i)

typedef long long ll;
typedef pair<int, int> P;

const int MAX = 1e5 + 5;
const int INF = 1001001001;
const int MOD = 1e9 + 7;

int main(){
    int H, W, N;
    cin >> H >> W >> N;
    
    vector<int> a(N);
    rep(i, N) cin >> a[i];

    vector<int> v;
    rep(i, N) {
        rep(j, a[i]) {
            v.push_back(i + 1);
        }
    }

    vector<vector<int>> c(H, vector<int>(W));
    rep(i, H) {
        rep(j, W) {
            c[i][j] = v.back();
            v.pop_back();
        }
    }

    rep(i, H) {
        if (i % 2) {
            reverse(c[i].begin(), c[i].end());
        }
    }

    rep(i, H) {
        rep(j, W) cout << c[i][j] << " ";
        cout << endl;
    }
}

Measured memory_bytes: 384
#include<stdio.h>

int main(){
  int a;
  int num=0;
  int k;
  char s;
  char str[10000];
  int i;
  scanf("%d",&a);

  for(i=0;i<a;i++){
    scanf("%s %d",str,&k);
    if(str[1]==0){
      if(str[0]=='(') num+=k;
      else if(str[0]==')') num-=k;
    }
    if(num<0){
      break;
    }
  }
  puts(num==0?"YES":"NO");

  return 0;
}

Measured memory_bytes: 592
N,M,K=map(int,input().split())
P=1000000007
f=[0]*(N*M+1)
f[0]=1
for i in range(N*M):
    f[i+1]=(i+1)*f[i]%P
ans=0
for A in [N,M]:
    for i in range(1,A):
        ans = (ans+(N^M^A)**2*i*(i+1)//2)%P
print(ans*f[N*M-2]*pow(f[K-2],P-2,P)*pow(f[N*M-K],P-2,P)%P)

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

typedef long long ll;
const int N = 1e5 + 100;

struct edge {
	int u, w;
	edge(int u, int w): u(u), w(w) {}
};

int f(int x, int y) {
	return (x + y + 3) % 3;
}

ll n, m, ans, edge_cnt, cnt[3], c[N];
vector<int> vec;
bool mark[N];
vector<edge> nei[N];

bool dfs(int v) {
	vec.push_back(v);
	bool b = true;
	mark[v] = true;
	cnt[c[v]]++;
	for (edge e: nei[v]) {
		edge_cnt++;
		if (mark[e.u] == false) {
			c[e.u] = f(c[v], e.w);
			b &= dfs(e.u);
		}
		else if (c[e.u] != f(c[v], e.w))
			b = false;
	}
	return b;
}

bool ok(vector<int> vec) {
	for (int v: vec)
		for (int i = 1; i < nei[v].size(); i++)
			if (nei[v][i - 1].w != nei[v][i].w)
				return true;
	return false;
}

ll solve(int v) {
	edge_cnt = 0;
	memset(cnt, 0, sizeof cnt);
	vec.clear();
	if (dfs(v) == false)
		return (cnt[0] + cnt[1] + cnt[2]) * (cnt[0] + cnt[1] + cnt[2]);
	if (ok(vec) == false)
		return edge_cnt / 2;
	return cnt[0] * cnt[1] + cnt[1] * cnt[2] + cnt[2] * cnt[0];
}

int main() {
	ios::sync_with_stdio(false), cin.tie(0);
	cin >> n >> m;
	while (m--) {
		int x, y;
		cin >> x >> y;
		nei[--x].push_back(edge(--y, 1));
		nei[y].push_back(edge(x, -1));
	}
	for (int v = 0; v < n; v++)
		if (mark[v] == false)
			ans += solve(v);
	cout << ans;
}


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

#define MAX_N 120

int S[MAX_N];
int sum[MAX_N];
int n, k, a;
int main() {
	while (true) {
		for (int i = 0; i < n; i++) {
			sum[i] = 0;
		}

		cin >> n >> k;
		if (n == 0 && k == 0) { break; }
		for (int i = 0; i < k; i++) {
			cin >> S[i];
		}
		bool ok = true;
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < k; j++) {
				cin >> a;
				S[j] -= a;
				if (S[j] < 0) { ok = false; }
			}
		}
		if (ok == true) { cout << "Yes" << endl; }
		else { cout << "No" << endl; }
	}
	return 0;
}

Measured memory_bytes: 1152
#if __has_include("debug.h")
    #include "debug.h"
#else  c
#include <bits/stdc++.h>
using namespace std;
#define d(...) 2;
#endif

#define int long long int
#define ld long double

#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define endl "\n"      

#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define ff first
#define ss second
#define eps 1e-10
#define PI acos(-1LL)

#define gcd(a,b)            __gcd((a),(b))
#define lcm(a,b)            ((a*b)/gcd(a,b))

void solve();

bool isPrime(int n)
{
	if(n<=1) return false;
	if(n<=3) return true;
	if(n%2==0||n%3==0) return false;
	for(int i=5; (i*i)<=n;i+=6)
	{
		if(n%i==0|| n%(i+2)==0)
		return false;
	}
	return true;
}


int32_t main()
{
    #ifdef DEBUG
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
    #endif 

    fast
    
    int t = 1;
	// cin>>t;
	
	while(t--)
	    solve();
	return 0;  
}

void solve()
{
	int i,j;
	int n;
	cin>>n;

	for(i=n;;i++)
	{
		if(isPrime(i))
		{
			cout<<i<<endl;
			return;
		}
	}



}

Measured memory_bytes: 3660
#include <iostream>
#include <utility>
#include <queue>

int main(int argc, char const *argv[]){
	int n,q,t = 0;
	std::cin >> n >> q;
	std::queue< std::pair<std::string,int> > que;
	
	for (int i = 0; i < n; ++i){
		std::string nm;
		int tm;
		std::cin >> nm >> tm;
		que.push(make_pair(nm,tm));
	} 

	while(!que.empty()){
		std::pair<std::string,int> front = que.front();
		que.pop();
		if(front.second  >  q){
			t += q;
			que.push(make_pair(front.first,front.second-q));
		}else{
			t += front.second;
			std::cout << front.first << " " << t << std::endl;
		}
	}
	return 0;
}


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

int main() {
	int n;
	cin >> n;
	vector<int> p(n);
	for (int i = 0; i < n; i++)
		cin >> p[i];
	int keep, max = 0;
	for (int i = 0; i < n; i++) {
		if (max < p[i]) {
			max = p[i];
			keep = i;
		}
	}
	p[keep] /= 2;
	int sum = 0;
	for (int i = 0; i < n; i++)
		sum += p[i];
	cout << sum << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <vector>
#include <cstdio>
#include <bits/stdc++.h>
#include <set>
#include <map>
#include <stdio.h>
#include <stack>
#include <queue>
#include <deque>
#include <numeric>
#include<bits/stdc++.h>
#include <utility>

#define ALL(obj) (obj).begin(), (obj).end()
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define RFOR(i,a,b) for(int i = (a); (b) <= i; i--)
#define REP(i,n) for(int i = 0; i < (n); i++)
#define RREP(i,n) for(int i = n; n <= i; i--)
#define ABS(a) ((a < 0) ? ((-1)*(a)) : (a))
#define elif else if
#define MOD 1000000007
#define INF (1<<29)

using namespace std;
using ll = long long;
map <int ,int> mpa,mpb;
typedef pair<ll, ll> P;
priority_queue<P, vector<P>, greater<P>> pque;

const int MAX = 100010;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

// NのP乗をMで割った余りを返す
ll pow_mod(ll n,ll k,ll m){
  if(k==0){
    return 1;
  }else if(k%2==1){
    return pow_mod(n,k-1,m)*n%m;
  }else{
    ll t=pow_mod(n,k/2,m);
    return (t*t)%m;
  }
}

//(10*9*8)/(3*2*1);
//10*9*8 -> ansMul
//3*2*1 -> ansDiv
long calcComb(int a, int b) {
	if (b > a - b) return calcComb(a, a - b);


	long ansMul = 1;
	long ansDiv = 1;
	for (int i = 0; i < b; i++)
	{
		ansMul *= (a - i);
		ansDiv *= (i + 1);
		ansMul %= MOD;
		ansDiv %= MOD;
	}
	//ansMul / ansDivをやりたい
	//ansDivの逆元を使って求めよう！

	long ans = ansMul * pow_mod(ansDiv,MOD - 2,MOD);
	return ans;
}


int main(){
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  vector<double> a;
  cin >> n;
  int t;
  for(int i=0;i<n;i++){
    cin >> t;
    a.push_back(t);
  }
  sort(a.rbegin(),a.rend());
  COMinit();
  int ans1=a[0],ans2=a[n];
  double cnt=a[0]/2.0;
  for(int i=0;i<n;i++){
    if(abs(a[i]-a[0]/2)<cnt){
      ans2=a[i];
      cnt=abs(a[i]-a[0]/2);
    }
  }
  cout << ans1 << ' ' << ans2 << endl;
  return 0;
}

Measured memory_bytes: 3572
import Foundation

#if swift(>=4.0)
extension String {
    func split(by separator: String) -> [String] {
        return self.components(separatedBy: separator)
    }
    func toArray() -> [String] {
        return self.map{String($0)}
    }
}
func exponentiate(_ lhs: Int, _ rhs: Int) -> Int {
    return (0..<rhs).reduce(1){i,_ in i*lhs}
}
#else
extension String {
    func split(by separator: String) -> [String] {
        return self.componentsSeparatedByString(separator)
    }
    var count: Int {
        return self.characters.count
    }
    func toArray() -> [String] {
        return self.characters.map{String($0)}
    }
    func uppercased() -> String {
        return self.uppercaseString
    }
    func lowercased() -> String {
        return self.lowercaseString
    }
}
//extension Array where Element == String {
//    func joined(separator separator: String) -> String {
//        return self.joinWithSeparator(separator)
//    }
//}
extension Array where Element: Comparable {
    func max() -> Element {
        return self.maxElement()!
    }
    func min() -> Element {
        return self.minElement()!
    }
    func sorted() -> Array {
        return self.sort()
    }
    func reversed() -> Array {
        return self.reverse()
    }
    mutating func sort() {
        self.sortInPlace()
    }
}
extension Array {
    init(repeating: Element, count: Int) {
        self.init(count: count, repeatedValue: repeating)
    }
}
func stride<T: Strideable>(from start: T, to end: T, by stride: T.Stride) -> StrideTo<T> {
    return start.stride(to: end, by: stride)
}
func exponentiate(lhs: Int, _ rhs: Int) -> Int {
    return (0..<rhs).reduce(1){i,_ in i*lhs}
}
#endif
func readInt() -> Int? {
    return Int(readLine()!)
}
func readStringSplit(by separator: String) -> [String] {
    return readLine()!.split(by: separator)
}
func readIntSplit(by separator: String) -> [Int] {
    return readLine()!.split(by: separator).map{Int($0)!}
}

/*************** テストスペース ***************/



/*************** メインプログラム ***************/

let s = readLine()!.toArray()
var start = 0
var end = 0
for i in 0..<s.count {
    if s[i] == "A" {
        start = i
        break
    }
}
for i in ((0..<s.count).map{$0}.reversed()) {
    if s[i] == "Z" {
        end = i
        break
    }
}
print(end - start + 1)


Measured memory_bytes: 18680
import numpy as np
import itertools

N = int(input())
P = tuple(map(str, input().split()))
Q = tuple(map(str, input().split()))

seq = [str(i+1) for i in range(N)]
  
permutation = list(itertools.permutations(seq))


P_index = permutation.index(P)
Q_index = permutation.index(Q)

answer = abs(Q_index-P_index)
print(int(answer))

Measured memory_bytes: 16996
#include<iostream>
using namespace std;
int main(){
  int x,y;
  cin >> x >> y;
  if(x<y){
    cout << "a < b" <<endl;
  }else if(x>y){
    cout << "a > b" <<endl;
  }else{
    cout << "a == b" <<endl;
  }
}


Measured memory_bytes: 3116
#include <iostream>
#include <vector>

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define vec vector

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

int main(void)
{
    int n;
    cin >> n;
    vec<int> a(n);
    rep(i, n) cin >> a[i];
    rep(i, n - 1) {
	a[i + 1] = gcd(a[i], a[i + 1]);
    }
    cout << a[n - 1] << endl;
    return 0;
}




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

using ll = long long;
using ull = unsigned long long;

const double PI = acos(-1);
const int inf = 2e9;
const ll INF = 2e18;
const ll MOD = 1e9+7;

#define sz(s) (s).size()
#define pb push_back
#define fi first
#define se second
#define REP(i,n) for (int i = 0; i<n; i++)
#define ALL(a) begin(a), end(a)

int main (void) {
    int N;
    cin>>N;
    vector<int> binary(8);
    binary[0] = 2;
    if (N==1) {
        cout<<1<<endl;
        return 0;
    }
    for (int i=1;i<8;i++) {
        binary[i] = binary[i-1] * 2;
    }
    for (int i=1;i<8;i++) {
        if (N>=binary[i-1] && N<binary[i]) {
            cout<<binary[i-1]<<endl;
            return 0;
        }
    }
    return 0;
}

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

#define int long long

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

int K;
int A[100000];

signed main() {
    cin >> K;
    for (int i = 0; i < K; i++) {
        cin >> A[i];
    }
    reverse(A, A + K);
    int max_N = 2, min_N = 2;
    for (int i = 0; i < K; i++) {
        max_N = max_N - max_N % A[i] + A[i] - 1;
        min_N = min_N % A[i] == 0 ? min_N : min_N - min_N % A[i] + A[i];
        if (max_N < min_N) {
            cout << -1 << endl;
            return 0;
        }
    }
    cout << min_N << " " << max_N << endl;
    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
 
using namespace std;
 
int sum(int n){
  int res = 1;
  while(n / 10 != 0){
    res++;
    n/=10;
  }
 
  return res;
}
 
int main()
{
  int a,b;
  while(~scanf("%d %d",&a,&b)){
    printf("%d\n",sum(a+b));
  }
 
  return 0;
}

Measured memory_bytes: 1188
#include <bits/stdc++.h>
using namespace std;
int n,i,j,k,a[60];
int main()
{
    cin>>n;
    for(i=1;i<=n;i++) cin>>a[i];
    for(i=2;i<=n;i++)
    {
        if(a[i]<a[i-1])
            goto go;
    }
    cout<<"YES\n";
    return 0;
    go:
    for(i=1;i<n;i++)
    {
        for(j=i+1;j<=n;j++)
        {
            swap(a[i],a[j]);
            for(k=2;k<=n;k++)
            {
                if(a[k]<a[k-1])
                    goto ok;
            }
            cout<<"YES\n";
            return 0;
            ok:
                swap(a[i],a[j]);
        }
    }
    cout<<"NO\n";
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define in inline
#define re register
using namespace std;
in int read() {
	re int t=0;
	re char v=getchar();
	while(v<'0'||v>'9')v=getchar();
	while(v>='0'&&v<='9') {
		t=(t<<3)+(t<<1)+(v^48);
		v=getchar();
	}
	return t;
}
char s[14];
signed main(){
	scanf("%s",s+1);
	if(s[2]=='B')puts("ARC");
	else puts("ABC");
}

Measured memory_bytes: 3652
N = int(input())
a = list(map(int, input().split()))

cnt_of_4 = 0
cnt_of_2 = 0
for i in range(N):
    if a[i] % 4 == 0:
        cnt_of_4 += 1
    elif a[i] % 2 ==  0:
        cnt_of_2 += 1

if cnt_of_4 >= N//2 or cnt_of_4 *2 + cnt_of_2 >= N:
    print('Yes')
else:
    print('No')





Measured memory_bytes: 15020
#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define dunk(a) cout << (a) << endl
#define rall(a) (a).rbegin(),(a).rend()
const int INF = 2e9;
using namespace std;
using Graph = vector<vector<int>>;
typedef pair<int,int> P;
typedef long long ll;

int main(){
    string s; cin >> s;
    int ans = 0;
    rep(i,s.size()-1){
        if(s[i] != s[i+1]) ans ++;
    }

    cout << ans << endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long llong;
#define MAX 100
#define INFTY 9999999

// 行列群を保持しておく
vector<int> vecMtr(MAX);
vector<vector<int>> dp(MAX,vector<int>(MAX));

int
MultipleMatrixChain(int size)
{
  for (int i = 1; i < size; i++)
  {
    dp[i][i] = 0;
  }
  
  for (int l = 2; l <= size; l++)
  {
    for (int i = 1; i <= size-l+1; i++)
    {
      int j = i + l - 1;
      dp[i][j] = INFTY;
      for (int k = i; k <= j-1; k++)
      {
        dp[i][j] = min(dp[i][j], dp[i][k] + dp[k+1][j]+ vecMtr[i-1]*vecMtr[k]*vecMtr[j]);
      }
    }
  }
  return dp[1][size];
}

int main() {
  int n;
  cin >> n;
  
  int r = 0;
  int c = 0;

  for (int i = 1; i <= n; i++)
  {
      cin >> r >> c;
      vecMtr[i-1] = r;
      vecMtr[i] = c;
  }
  
  cout << MultipleMatrixChain(n) << "\n";
}


Measured memory_bytes: 3200
import java.util.*;
class Main{
    public static void main(String[] args){
        Scanner scan=new Scanner(System.in);
        double r,area,cir;
        r=scan.nextDouble();
        area = Math.PI * (r * r);
        cir= Math.PI * (2 * r);
        System.out.printf("%.5f %.5f\n",area,cir);
    }
}


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

int main(void)
{
	char str[12];
	int i;
	while (~scanf("%s", str)){
		vector <int> v1, v2;
		for (i = 0; i < 10; i++){
			v1.push_back(str[i] - '0');
		}
		for (i = 0; i < 9; i++){
			v2.push_back((v1[i] + v1[i + 1]) % 10);
		}
		v1.clear();
		for (i = 0; i < 8; i++){
			v1.push_back((v2[i] + v2[i + 1]) % 10);
		}
		v2.clear();
		for (i = 0; i < 7; i++){
			v2.push_back((v1[i] + v1[i + 1]) % 10);
		}
		v1.clear();
		for (i = 0; i < 6; i++){
			v1.push_back((v2[i] + v2[i + 1]) % 10);
		}
		v2.clear();
		for (i = 0; i < 5; i++){
			v2.push_back((v1[i] + v1[i + 1]) % 10);
		}
		v1.clear();
		for (i = 0; i < 4; i++){
			v1.push_back((v2[i] + v2[i + 1]) % 10);
		}
		v2.clear();
		for (i = 0; i < 3; i++){
			v2.push_back((v1[i] + v1[i + 1]) % 10);
		}
		v1.clear();
		for (i = 0; i < 2; i++){
			v1.push_back((v2[i] + v2[i + 1]) % 10);
		}
		v2.clear();
		cout << (v1[0] + v1[1]) % 10 << endl;
	}
	
	return 0;
}

Measured memory_bytes: 0
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		String s = sc.next();
		if(n%2 == 1) {
			System.out.println("No");
		}else {
			String t1 = s.substring(n/2);
			t1 += t1;
			if(t1.equals(s)) {
				System.out.println("Yes");
			}else {
				System.out.println("No");
			}
		}
	}

}


Measured memory_bytes: 21844
#include<iostream>
#include<algorithm>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

using namespace std;
typedef long long ll;

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

ll lcm(ll a,ll b){
    return a*b/gcd(a,b);
}

int main(){
    ll a,b;
    cin>>a>>b;
    cout<<lcm(a,b)<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#define LL long long
using namespace std;
const LL Maxn = 310;
LL f[Maxn][Maxn], s[Maxn][Maxn];
LL n, K, Mod;
LL C[Maxn][Maxn];
void up(LL &x, LL y) { x = (x + y) % Mod; }
int main() {
	LL i, j, k;
	scanf("%lld%lld%lld", &n, &K, &Mod);
	n++;
	C[0][0] = 1;
	for(i = 1; i <= n; i++){
		C[i][0] = 1;
		for(j = 1; j <= i; j++) C[i][j] = (C[i-1][j-1]+C[i-1][j])%Mod;
	}
	for(i = 0; i <= K; i++) f[1][i] = 1;
	for(i = K; i >= 0; i--) s[1][i] = (s[1][i+1]+f[1][i])%Mod;
	for(i = 2; i <= n; i++){
		for(j = 0; j <= K; j++){
			for(k = 1; k < i; k++) up(f[i][j], C[i-2][k-1]*f[i-k][j]%Mod*s[k][j+1]);
		}
		for(j = K; j >= 0; j--) s[i][j] = (s[i][j+1]+f[i][j])%Mod;
	}
	printf("%lld\n", f[n][0]);
	return 0;
}

Measured memory_bytes: 2304
n=int(raw_input())
a=[int(raw_input()) for _ in xrange(n)]
a.sort()
ans=[]
for i in xrange(3):
    for j in xrange(i+1,n):
        ans.append(int(str(a[i])+str(a[j])))
        ans.append(int(str(a[j])+str(a[i])))
    ans.sort()
print(ans[2])

Measured memory_bytes: 7884
fun main(args: Array<String>) = println(run {
    var x = readLine()!!.toInt()

    val primes = eratosthenes(100100)
    while (primes.binarySearch(x) < 0) ++x
    x
})

fun eratosthenes(n: Int): List<Int> {
    val sqrtN = Math.sqrt(n.toDouble()).toInt()
    val prime = mutableListOf<Int>()
    var list = (2..n).toList()
    while (list.first() < sqrtN) {
        val p = list.first()
        prime += p
        list = list.filter { it % p != 0 }
    }
    return prime + list
}

Measured memory_bytes: 44924
// Problem : B - Substring
// Contest : AtCoder - AtCoder Beginner Contest 177
// URL : https://atcoder.jp/contests/abc177/tasks/abc177_b
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

//#pragma GCC optimize "trapv"//  WA to RE int!!
#include <bits/stdc++.h>
#define FOR(i,n) for(int i=0;i<n;i++)
#define FORR(i,n) for(int i=n;i>=0;i--)
#define pb push_back
#define vint vector<int>
#define sint set<int>
#define mint map<int,int>
#define pint pair< int,int >
#define int long long int 
#define test int tt1234; cin>>tt1234;while(tt1234--)
#define endl "\n"
#define SI(a,n) int a[n];FOR(i,n) cin>>a[i];
#define input(a,n) int n;cin>>n; SI(a,n)
#define all(zz) zz.begin(),zz.end()
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define error(x) cerr << #x <<" is " << x << endl;
#define Error(a,b) cerr<<"( "<<#a<<" , "<<#b<<" ) = ( "<<(a)<<" , "<<(b)<<" )\n";
#define precision(x) cout<<fixed<<setprecision(x);
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
#define present(container, element) (container.find(element)!=container.end())
#define fint fast;test
#define set(a,x) memset(a,x,sizeof(a))
#define L(x)	((x)<<1)
#define R(x)	(((x)<<1)+1)
#define ft first
#define se second
#define MOD 1000000007
using namespace std;
template<typename... T> void rd(T&... args) { ((cin >> args), ...); }
template<typename... T> void pp(T... args) { ((cout << args << " "), ...); cout<<"\n"; }

void solve(){
	string s,t;
	rd(s,t);
	int n=s.size(),m=t.size();
	int ans=m;
	for(int i=0;i+m<n+1;i++){
		int temp=0;
		// pp(s[i]);
		for(int j=0;j<m;j++){
			if(s[i+j]==t[j])continue;
			temp++;
		}
		ans=min(ans,temp);
	}	
	pp(ans);
	return;	
}


int32_t main() {
    // fint{
    	fast;
    	solve();
    // }
    return 0;
}


Measured memory_bytes: 3660
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
#define FOR(i, s, n) for(int (i)=(s); (i)<(int)(n); (i)++)
#define REP(i, n) for(int (i)=0; (i)<(int)(n); (i)++)
#define REV(i, n) for(int (i)=(n)-1; (i)>=0; (i)--)
typedef long long int lli;
const lli inf = 1e18;

int main(){
	int n;
	cin >> n;
	vector<int> a(n);
	REP(i, n) cin >> a[i];
	sort(a.begin(), a.end());
	int m = a.back();
	a.pop_back();
	
	int r = 0;
	REP(i, n-1){
		if(min(a[i], m-a[i]) >= min(r, m-r)){
			r = a[i];
		}
	}
	cout << m << " " << r << endl;
	return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
#define re register
#define inc(i,j,k) for(re int i=j;i<=k;i++)
#define ll long long
using namespace std;
const int N=3005;
inline int read(){
	int x=0;
	char ch=getchar();
	while(ch<'0'||ch>'9') ch=getchar();
	while('0'<=ch&&ch<='9') x=x*10+ch-'0',ch=getchar();
	return x;
}
int n,m;
ll s[N][N],c[N][N],ans;
ll qp(ll x,ll k,ll mod){
	ll res=1;
	while(k){
		if(k&1) res=res*x%mod;
		k>>=1,x=x*x%mod;
	}
	return res;
}
int main(){
	n=read(),m=read();
	s[0][0]=1;
	inc(i,0,n+1){
		c[i][0]=1;
		inc(j,1,i) s[i][j]=(s[i-1][j-1]+j*s[i-1][j])%m,c[i][j]=(c[i-1][j]+c[i-1][j-1])%m;
	}
	inc(i,0,n){
		ll tmp=0;
		inc(j,0,i) (tmp+=s[i+1][j+1]*qp(2,j*(n-i),m)%m)%=m;
		tmp=tmp*qp(2,qp(2,n-i,m-1),m)%m*c[n][i]%m;
		(ans+=(i&1)?m-tmp:tmp)%=m;
	}
	printf("%lld",ans);
}
 

Measured memory_bytes: 96020
#include <bits/stdc++.h>
using namespace std;
#define rep(i,j,k) for(int i = (int)j;i <= (int)k;i ++)
#define debug(x) cerr<<#x<<":"<<x<<endl
const int maxn=(int)3e3+5;
int a[maxn],b[maxn],dp[2][maxn][maxn],ans;
pair<int,int> p[maxn];
int main(){
    ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int n,t;cin>>n>>t;rep(i,1,n)cin>>p[i].first>>p[i].second;
    sort(p+1,p+1+n);
    rep(i,1,n)rep(j,1,t){
        a[i]=p[i].first,b[i]=p[i].second;
        dp[0][i][j]=(j>=a[i]?max(dp[0][i-1][j],dp[0][i-1][j-a[i]]+b[i]):dp[0][i-1][j]);
    }
    rep(i,1,n)rep(j,0,t-1){ans=max(ans,b[i]+dp[0][i-1][j]);}
    cout<<ans<<endl;
    /* int n,t;cin>>n>>t;rep(i,1,n)cin>>a[i]>>b[i];
    rep(i,1,n)rep(j,1,t){dp[0][i][j]=(j>=a[i]?max(dp[0][i-1][j],dp[0][i-1][j-a[i]]+b[i]):dp[0][i-1][j]);}
    rep(i,1,n)rep(j,1,t){dp[1][i][j]=(j>=a[n-i+1]?max(dp[1][i-1][j],dp[1][i-1][j-a[n-i+1]]+b[n-i+1]):dp[1][i-1][j]);}
    rep(i,1,n)rep(j,0,t-1){ans=max(ans,b[i]+dp[0][i-1][j]+dp[1][n-i][t-1-j]);}
    cout<<ans<<endl; */
}
/* 
时间背包 
时间和价值
时间获得一定的价值，t秒内能获得最大的价值. 最后一样东西可以超出t. 
all:[1,3000]
ana 做一个6000的背包？
枚举最后一个物品？ 不能保证最优  枚举最后一个，对剩下的做背包，可以保证正确性，N^3
状态里要存限制？
qscqesze饭卡问题 

dp[0][i][j] 前i个物品拿重量为j的最大价值
dp[1][i][j] 后i个物品拿重量为j的最大价值
ans=for i for j max(dp[0][i][j]+dp[1][n-i+1][t-1-j])

sol2: 时间最长的在最后不会更坏
wr
not 代码问题，样例问题
a[n-i+1]:一个地方改了，其它所有都要改。 if，for里的&后来加的也要改。
背包不优化，第二维 要判>=a[i]?

2 60
10 10
100 100

#include <bits/stdc++.h>
using namespace std;

int main(){
  int n, t;
  cin >> n >> t;
  vector<vector<int>> dp(t, vector<int>(2,0));
  for(int i=0; i<n; ++i){
    int a, b;
    cin >> a >> b;
    for(int j=t-1; j>=0; --j){
      dp[j][0] = max(dp[j][0], dp[j][1]+b);
      if(j>=a)dp[j][0] = max(dp[j][0], dp[j-a][0]+b);
      if(j>=a)dp[j][1] = max(dp[j][1], dp[j-a][1]+b);
    }
  }
  cout << dp[t-1][0] << endl;
}

 */

Measured memory_bytes: 37120
#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;

int main() {
    double x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    printf("%lf\n", sqrt(pow(x1 - x2, 2) + pow(y1 - y2, 2)));
}

Measured memory_bytes: 1232
[N,K,S] = list(map(int,input().split()))
cnt = 0
output = []
if S != 10**9:
    for i in range(K):
        output.append(S)
    for i in range(N-K):
        output.append(S+1)
else:
    for i in range(K):
        output.append(S)
    for i in range(N-K):
        output.append(1)

print(*output)

Measured memory_bytes: 83968
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
#include <complex>
using namespace std;

typedef long long ll;
typedef uint64_t ull;
typedef pair<int, int> P;
typedef pair<int, double> Pid;
typedef pair<double, int> Pdi;
typedef pair<ll, int> Pl;
typedef pair<ll, ll> Pll;
typedef pair<int, pair<int, int>> PP;
typedef pair<P, int> PPi;
constexpr double PI = 3.1415926535897932;   // acos(-1)
constexpr double EPS = 1e-9;
constexpr int INF = 1001001001;
constexpr int mod = 1000000007;
// constexpr int mod = 998244353;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define chadd(x, y) x = (x + y) % mod

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

    int n, m;
    cin >> n >> m;
    int pow2 = 1;
    for(int i = 0; i < m; ++i)  pow2 *= 2;
    int ans = 1900 * m + 100 * (n - m);
    ans *= pow2;
    cout << ans << endl;
}

Measured memory_bytes: 256
/*input
2
1 2
3
1 100
2 100
100 1000
*/
 
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <climits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <stdint.h>
#include <tgmath.h>
 
using namespace std;
 
/*******  All Required define Pre-Processors and typedef Constants *******/
#define ar array
#define scd(t) scanf("%d",&t)
#define scld(t) scanf("%ld",&t)
#define sclld(t) scanf("%lld",&t)
#define scc(t) scanf("%c",&t)
#define scs(t) scanf("%s",t)
#define scf(t) scanf("%f",&t)
#define sclf(t) scanf("%lf",&t)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define FOREACH(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define tests int r; cin >> r; while(r--)
#define MP make_pair
#define PI acos(-1)
typedef pair<int, int> PII;
typedef pair<double, double> PDD;
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<PII> VII;
typedef vector<VI> VVI;
typedef map<int,int> MPII;
typedef set<int> SETI;
typedef multiset<int> MSETI;
typedef long int int32;
typedef unsigned long int uint32;
typedef long long int int64;
typedef unsigned long long int  uint64;
#define godspeed ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(0);
 
#define M(x) ((x)%(1000000007))
 

int arr[1010][1010];

int h;
int w;



bool legal(int x, int y){
	if(x>=1&&x<=h){
		if(y>=1&&y<=w){
			if(arr[x][y]){
				return true;

			}
		}
	}
	return false;
}





int main() {
 	int64 n;
 	cin>>n;
 	int64 arr[n];
 	memset(arr,0,sizeof(arr));
 	map<int,int> mp;
 	int64 sum = 0;
 	for(int64 i = 0; i<n;i++){
 		int a;
 		cin>>a;
 		arr[i] = a;
 		mp[a]++;
 		sum+=a;
 	}
 	int q;
 	cin>>q;
 	rep(i,q){
 		int b;
 		int c;
 		cin>>b>>c;
 		int g = c-b;
 		if(mp.find(b)!=mp.end()){
 			int p = mp[b];
 			sum += p*g;
 			auto it = mp.find(b);
 			mp.erase(it);
 			mp[c]+= p;
 		}
 		cout<<sum<<endl;
 	}
 	

}



 


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

int main() {
  ll n,a,b;
  cin >> n >> a >> b;
  ll ans;
  if (a % 2 == b % 2) {
    ans = (b-a) / 2;
  } else {
    if (a-1 <= n-b) {
      ans = a;
      b -= a;
      a = 1;
      ans += (b-a) / 2;
    } else {
      ans = n-b+1;
      a += n-b+1;
      b = n;
      ans += (b-a) / 2;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3608
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int X = sc.nextInt();
        int A = sc.nextInt();
        
        if (X < A) {
            System.out.println(0);
        }else{
            System.out.println(10);
        }
    }
}

Measured memory_bytes: 35748
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <limits.h>

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

int iin() {
    int i;
    scanf("%d", &i);
    return i;
}

long long llin() {
    long long i;
    scanf("%lld", &i);
    return i;
}

double din() {
    double i;
    scanf("%lf", &i);
    return i;
}

char cin() {
    char c;
    scanf("%c", &c);
    return c;
}

void stin(char *s) {
    scanf("%s", s);
}

void iout(int i) {
    printf("%d\n", i);
}

void llout(long long i) {
    printf("%lld\n", i);
}

void dout(double i) {
    printf("%lf\n", i);
}

void cout(char c) {
    printf("%c\n", c);
}

void stout(char *s) {
    printf("%s\n", s);
}

int main() {
    int a = iin(), b = iin(), c = iin();
    (a < b) && (b < c) ? stout("Yes") : stout("No");
    return 0;
}



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

ll fabs(const vector<ll>& As, ll b)
{
    auto res = accumulate(begin(As), end(As), 0LL,
        [b](auto acc, auto a) mutable {
            ll val = acc + abs(a - b);
            return val;
        });
    return res;
}

void main_()
{
    ll N;
    cin >> N;
    vector<ll> As;
    As.reserve(N);
    for (ll i = 1; i <= N; i++) {
        ll A;
        cin >> A;
        As.push_back(A - i);
    }

    sort(begin(As), end(As));

    cout << fabs(As, As[N / 2]) << endl;
}
int main()
{
    cin.tie(nullptr);
    cout.tie(nullptr);
    ios_base::sync_with_stdio(false);
    main_();
    return 0;
}


Measured memory_bytes: 1792
//#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <queue>

using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<n;++i)
#define mod (ll)(1e9+7)
#define FIX(a) ((a)%mod+mod)%mod
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define fi first
#define se second
#define pb push_back
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a,b,c,d;
    cin >> a >> b >> c >> d;
    a+=b;
    c+=d;
    if(a>c){
        puts("Left");
    }else if(a==c){
        puts("Balanced");
    }else{
        puts("Right");
    }

    return 0;
}

Measured memory_bytes: 256