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

public class Main {
 	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		PriorityQueue<Long> queue = new PriorityQueue(new Comparator<Long>() {
		    public int compare(Long l1, Long l2) {
		        long ll1 = l1.longValue();
		        long ll2 = l2.longValue();
		        if (ll1 == ll2) {
		            return 0;
		        } else if (ll1 > ll2) {
		            return -1;
		        } else {
		            return 1;
		        }
		    }
		});
		for (int i = 0; i < n; i++) {
		    queue.add(sc.nextLong());
		}
		long count = 0;
		while (queue.size() > 0) {
		    long x = queue.poll();
		    if (x + count < n) {
		        break;
		    }
		    long time = (x + count) / n;
		    count += time;
		    x -= (n + 1) * time;
		    queue.add(x);
		}
	    System.out.println(count);
	}
}


Measured memory_bytes: 24148
#include <string>
#include <vector>
#include <unordered_map>
#include <set>
#include <map>
#include <iostream>
using namespace std;
using ll = long long;
int gcd(int a, int b) {
    if (a % b == 0) return b;
    else {
        return gcd(b, a % b);
    }
}
int GCD(int a, int b, int c) {
    return gcd(gcd(a,b), c);
}


int main() {
    int k;
    cin >> k;
    ll res = 0;
    for(int i = 1; i <= k; i ++) {
        for(int j = 1; j <= k; j ++) {
            for(int m = 1; m <= k; m ++) {
                res += GCD(i, j, m);
            }
        }
    }
    cout << res << endl;
    return 0;
} 

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

bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n % i == 0)return false;
	}
	return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x / gcd(x, y) * y;
}
int mod_pow(int n, int p, int m) {
	if (p == 0) return 1;
	if (p % 2 == 0) {
		int t = mod_pow(n, p / 2, m);
		return (t * t) % m;
	}
	return n * mod_pow(n, p - 1, m) % m;
}
int extGCD(int a, int b, int& x, int& y) {
	if (b == 0) {
		x = 1;
		y = 0;
		return a;
	}
	long long d = extGCD(b, a % b, y, x);
	y -= a / b * x;
	return d;
}
int modinv(int a, int m) {
	int b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}

int dp[1005][(1 << 12) + 5];

signed main() {
	int n, m;
	cin >> n >> m;
	int a[1005];
	vector<int>vec[1005];
	rep(i, m) {
		int b;
		cin >> a[i] >> b;
		rep(j, b) {
			int c;
			cin >> c;
			vec[i].push_back(c - 1);
		}
	}
	for (int i = 1; i < (1 << n); i++) {
		rep(j, m + 1) {
			dp[j][i] = INF;
		}
	}
	rep(i, m) {
		rep(j, 1 << n) {
			int bit[15];
			rep(k, n) {
				bit[k] = j / (1 << k) % 2;
			}
			rep(k, vec[i].size()) {
				bit[n-1-vec[i][k]] = true;
			}
			int now = 0;
			rep(k, n) {
				if (bit[k]) {
					now += 1 << k;
				}
			}
			dp[i + 1][now] = min(dp[i + 1][now], dp[i][j] + a[i]);
		}
		rep(j, 1 << n) {
			dp[i + 1][j] = min(dp[i + 1][j], dp[i][j]);
		}
	}
	if (dp[m][(1 << n) - 1] == INF) cout << -1 << endl;
	else cout << dp[m][(1 << n) - 1] << endl;

	return 0;
}


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

int main(void){
  int N;
  string S;
  string K = "#";
  string T = ".";
  cin >> N >> S;
  int  scount = 0, tcount = 0;
  int AllSC[210000], AllTC[210000];
  for(int i = 0; i < N; i++){
    if(S[i] == K[0]){
      scount ++;
    }else{
      tcount ++;
    }
  AllTC[i] = tcount;
  AllSC[i] = scount;
  }
  int mini = N, needs = 0;
  for(int i = 0; i < N; i++){
    if((S[i] == K[0] and S[i+1] == T[0]) or (S[i] == T[0] and S[i+1] == K[0])){
      needs = AllSC[i] + (AllTC[N - 1] - AllTC[i]);
      if(AllTC[i] == 0 && AllSC[N-1] - AllSC[i] == 0){
        int needsc = needs - AllSC[i];
        int needtc = needs - AllTC[N - 1] - AllTC[i];
        needs = min(needsc, needtc);
      }
      else if(AllSC[N-1] - AllSC[i] == 0){
        needs -= AllTC[N - 1] - AllTC[i];
      }
      else if(AllTC[i] == 0){
        needs -= AllSC[i];
      }
      if(mini > needs){
        mini = needs;
      }
    }
  }
  if(mini == N) mini = 0;
  cout << mini << endl;
  return 0;
}


Measured memory_bytes: 2180
#include <bits/stdc++.h>  // include all standard C++ libraries

using namespace std;

// Loops
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define _rrep(i,n) rrepi(i,n,0)
#define rrepi(i,a,b) for(int i=int(a)-1;i>=int(b);--i)

#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
#define each(xi, x) for (auto&& xi : x)
// Note: we can use rep(i,N) or rep(i,from,to)


// typedef
using ll = long long;
template <class T> using vec = vector<T>;
using vi   = vector<int>;
using vvi  = vector<vi>;
using vvvi = vector<vvi>;
using pii  = pair<int, int>;


// Constants

// Shorter repr for frequently used terms
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define Fi first
#define Se second


// Algorithms
#define all(x) (x).begin(), (x).end()
#define uniq(v) v.erase( unique(all(v)), v.end() )
#define perm(c) sort(all(c));for(bool c##p=1;c##p;c##p=next_permutation(all(c)))

template<class T> pair<T, size_t> max(vector<T> &x){ auto it = max_element(all(x)); return mp(*it, it-x.begin()); }
template<class T> pair<T, size_t> min(vector<T> &x){ auto it = min_element(all(x)); return mp(*it, it-x.begin()); }

template<class T> inline bool chmax(T &maxval, const T &newval) { if (maxval<newval) { maxval=newval; return 1; } return 0; }
template<class T> inline bool chmin(T &minval, const T &newval) { if (minval>newval) { minval=newval; return 1; } return 0; }

// Utilities
// Grid world utilities
int dx[4]={0,1,0,-1};
int dy[4]={1,0,-1,0};
#define inside(H,W,y,x) 0<=(x) && (x)<(W) && 0<=(y) && (y)<(H)

inline int in() {int x; cin >> x; return x;} // read int from cin
inline  ll IN() {ll x; cin >> x; return x;}  // read ll from cin



// Debug
#ifdef LOCAL
  #include "dump.hpp"
  #define debug(x) cerr << #x << ": " << x << '\n'
#else
  #define dump(...)
  #define debug(x)
#endif

// Paste snippets here!!

// 

int main(){
  cin.tie(0); ios::sync_with_stdio(false);    // Magic for faster cin
  ll H, N;
  cin >> H>>N;
  vi A(N);
  rep(i,N) cin >> A[i];
  ll tot = 0;
  rep(i,N) tot += A[i];
  if (tot>=H) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


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

using namespace std;

using ll = long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vi = vector<int>;
using vl = vector<ll>;

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

#define CHMIN(a,b) (a)=min((a),(b))
#define CHMAX(a,b) (a)=max((a),(b))
#define ALL(v) (v).begin(),(v).end()

#define DEBUG(x) cerr<<#x<<": "<<(x)<<endl
#define DEBUG_VEC(v) cerr<<#v<<": ";REP(__i,(v).size())cerr<<((v)[__i])<<", ";cerr<<endl

const ll MOD = 1000000007ll;

int q;
bool ok[125252];
int sum[125252];

int main(){
    cin>>q;
    FOR(m,2,100025){
        bool go = false;
        ll mul = 1;
        for(int x=2; x*x<=m; x++)if(m%x==0){
            mul *= x;
            if(mul >= 2*m){go=true; break;}
            if(m/x==x)continue;
            mul *= m/x;
            if(mul >= 2*m){go=true; break;}
        }
        ok[m] = go;
    }
    REP(i,100025)sum[i+1] = sum[i] + ok[i];
    while(q--){
        int n;
        cin>>n;
        cout<<sum[n+1]<<endl;
    }
    return 0;
}



Measured memory_bytes: 3596
#include <iostream>
#include <algorithm>
#include <vector>
#include <math.h>
using namespace std;
typedef long long ll;

int n, q, cnt[200020] = {}, ans[200020] = {}, val = 0;
bool gt[200020] = {};
vector<int> G[200020];

void dfs(int k) {
    gt[k] = true;
    val += cnt[k];
    ans[k] = val;
    for (int i = 0; i < G[k].size(); i++) {
        if (!gt[G[k][i]]) {
            dfs(G[k][i]);
        }
    }
    val -= cnt[k];
}

int main() {
    cin >> n >> q;
    for (int i = 0; i < n - 1; i++) {
        int a, b;
        cin >> a >> b;
        a--;  b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    for (int i = 0; i < q; i++) {
        int p, x;
        cin >> p >> x;
        cnt[p - 1] += x;
    }

    dfs(0);

    for (int i = 0; i < n; i++) {
        if (i != 0) cout << " ";
        cout << ans[i];
    }

}


Measured memory_bytes: 24192
#include <bits/stdc++.h>
    using namespace std;
     
    int main() {
    	int n;
    	cin>>n;
    	long long a[n];
    	for(int i=0;i<n;i++)
    	cin>>a[i];long long dp[n];dp[0]=0;dp[1]=abs(a[1]-a[0]);
    	for(int i=1;i<n;i++)
    	{
    	   dp[i]=min(dp[i-1]+abs(a[i]-a[i-1]),dp[i-2]+abs(a[i]-a[i-2]));
    	}cout<<dp[n-1]<<endl;
    	return 0;
    }

Measured memory_bytes: 1792
/*
  The Island Was Silent before.
  .....
  And One day again it became Silent.
*/
#include<bits/stdc++.h>
using namespace std;
 
#define endl '\n'
#define ll  long long
#define modd(a,b) ((a+2*b)%b)
#define debug(a) cout << #a << ": " << (a) << "\n"
#define ioso ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define rtt cerr << "Time: " << clock()*1.0 / CLOCKS_PER_SEC << endl;
#define ffe freopen("input.txt","r",stdin), freopen("output.txt","w",stdout);
 
int main() {
  ioso
  #ifndef ONLINE_JUDGE
  ffe
  #endif
  ll n,x,t; cin >> n >> x >> t;
  ll ans = floor(n/x);
  ans = n%x!=0 ? (ans+1)*(t) : ans*t;
  cout << ans << endl;
}

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

typedef long long LL;

template<typename T>
void printmatrix(vector<vector<T> > ar){
    for (int i = 0; i < (int)ar.size(); i++) {
        for (int j = 0; j < (int)ar.size(); j++) {
            cout << ar[i][j];
        }
        cout << endl;
    }
}

template<typename T>
void printvector(vector<T> vec){
    for (int i = 0; i < (int)vec.size(); i++) {
        cout << vec[i] << endl;
    }
}

template<typename T>
void unique(vector<T>& vec){
    sort(vec.begin(), vec.end());
    vec.erase(unique(vec.begin(), vec.end()), vec.end());
}

template<typename T>
vector<T> cumsum(vector<T> vec){
    vector<T> newvec((T)vec.size());
    int tmp = 0;
    for (int i = 0; i < (int)vec.size(); i++) {
        tmp += vec[i];
        newvec[i] = tmp;
    }

    return newvec;
}


int main(int argc, char const* argv[])
{
    int n,a;
    cin >> n >> a;
    if (n % 500 <= a) {
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}

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

//        894510
#define N 100000
#define MAX 1000000000

int main() {

    int cnt = 0;
    long long q = 1;
    while(cnt++ < 10) {
        string ans;
        stringstream ss;
        ss << "? " << q;
        cout << ss.str() << endl;
        /*if((q <= N && to_string(q) <= to_string(N)) ||
            (q > N && to_string(q) > to_string(N))) {
                cout << 'Y' << endl;
                ans = "Y";
        } else {
            cout << "N" << endl;
            ans = "N";
        } */
        cin >> ans;

        if(ans == "Y") {
            q *= 10;
        } else {
            goto next;
        }
    }
    next:;
    if(cnt == 11) {
        string ans = "N";
        q = 1;
        for(; ans == "N"; q *= 10) {
            cout << "? " << 2 * q << endl;
            cin >> ans;
            /*if((2 * q <= N && to_string(2 * q) <= to_string(N)) ||
                (2 * q > N && to_string(2 * q) > to_string(N))) {
                    cout << 'Y' << endl;
                    ans = "Y";
            } else {
                cout << "N" << endl;
                ans = "N";
            } */
        }

        cout << "! " << q / 10 << endl;
        exit(0);
    }

    string answer = "";
    for(int i = 0; i < to_string(q - 1).size(); i++) {
        int l = 0, r = 9;
        vector< int > used(10, 0);
        while(l < r) {
            string ans;
            stringstream ss;

            int mid = (l + r) / 2.0;
            if(used[mid]++) mid++;
            string temp;
            if(i == to_string(q - 1).size() - 1) {
                temp = answer + to_string(mid);
                temp += "0";
            } else {
                temp = answer + to_string(mid);
            }
            ss << "? " << temp;
            cout << ss.str() << endl;
            cin >> ans;
            /*if((atoll(temp.c_str()) < N && temp <= to_string(N)) ||
                (atoll(temp.c_str()) > N && temp > to_string(N))) {
                    cout << 'Y' << endl;
                    ans = "Y";
            } else {
                cout << "N" << endl;
                ans = "N";
            } */
            if(ans == "Y") {
                if(i == to_string(q - 1).size() - 1) r = mid;
                else l = mid;
            } else {
                if(i == to_string(q - 1).size() - 1) l = mid + 1;
                else r = mid - 1;
            }
        }
        answer += to_string(l);
    }
    cout << "! " + answer << endl;
    exit(0);
}


Measured memory_bytes: 644
h, w, Z = map(int, input().split())

st_po = []
out = []

id = 0
for i in range(h):
  x = list(input())
  y = []
  for j in range(w):
    xx = x[j]
    if xx == "#":
      id += 1
      y.append(id)
      st_po.append([i, j])
    else:
      y.append(0)
  out.append(y)

minY = 0
minX = 0
id = 0
  
for k in range(len(st_po)-1):
  p = st_po[k]
  if st_po[id][0] == st_po[id+1][0]:
    maxX = st_po[id+1][1]
    maxY = st_po[id][0]+1
  else:
    maxX = w
    maxY = st_po[id][0]+1
    
  id += 1
  for i in range(minY, maxY):
    for j in range(minX, maxX):
      out[i][j] = id
      
  if maxX == w:
    minY = maxY
    minX = 0
  else:
    minX = maxX

xxx = h

for i in range(h):
  if sum(out[h-i-1]) == 0:
    xxx = h-i-1
  else:
    break

for i in range(xxx, h):
  out[i] = out[xxx-1]
    
for i in range(h):
  for j in range(w):
    if out[i][j] == 0:
      print(Z, end = " ")
    else:
      print(out[i][j], end = " ")
  print()
    

Measured memory_bytes: 17104
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>

using namespace std;

#define all(c) (c).begin(), (c).end()

int solve(string s){
    vector<vector<int> > d(3333);
    int k = 0, num = 0;
    for(auto c: s){
        if(c == '[')k++;
        else if(c == ']'){
            if(num){
                d[k].push_back(num/2 + 1);
                num = 0;
            }
            sort(all(d[k]));
            int sum = accumulate(d[k].begin(), d[k].begin() + d[k].size()/2 + 1, 0);
            d[k].clear();
            d[--k].push_back(sum);
        }
        else (num *= 10) += c - '0';
    }
    return d[0][0];
}

int main(){
    int n;
    cin >> n;
    while(n--){
        string s;
        cin >> s;
        cout << solve(s) << '\n';
    }
    return 0;
}

Measured memory_bytes: 1360
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <string>
#define foor for(int i=0;i<n;i++)
#define yn cout<<"Yes"<<endl;else cout<<"No"<<endl;
#define ic int a;cin>>a;
#define ic2 ic int b;cin>>b;
#define ic3 ic2 int c;cin>>c;
int s = 0;
using namespace std;
int main() {
	int n;
	cin >> n;
	cout << n*n;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define FORq(i, m, n) for(int i = m;i <= n;i++)
#define SCD(n) scanf("%d",&n)
#define SCD2(m,n) scanf("%d%d",&m,&n)
#define SCD3(m,n,k) scanf("%d%d%d",&m,&n,&k)
#define PB push_back
#define MP make_pair
#define ARSCD(A,N) REP(i,N){SCD(A[i]);}
#define ARSCD1(A,N) FORq(i,1,N){SCD(A[i]);}
#define PRINTD(n) printf("%d\n",n)
#define PRINTLLD(n) printf("%lld\n",n);
#define DEBUG printf("%s\n","debug")
using namespace std;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef long long ll;
//////////////////////////////////////////////////////
const int INF = 100000;
int main(){
	int N,Ma,Mb;
	SCD3(N,Ma,Mb);
	static int a[42];
	static int b[42];
	static int c[42];
	
	FORq(i,1,N){
		int u,v,w;
		SCD3(u,v,w);
		a[i] = u;
		b[i] = v;
		c[i] = w;
	}
	
	static int dp[402][402][42];
	
	REP(i,402){
		REP(j,402){
			REP(k,42){
				dp[i][j][k] = INF;
			}
		}
	}
	
	REP(k,42){
		dp[0][0][k] = 0;
	}
	
	REP(i,402){
		REP(j,402){
			FORq(k,1,N){
				int ak = a[k];
				int bk = b[k];
				int ck = c[k];
				if ( (i<ak) or (j<bk) ){
					dp[i][j][k] = dp[i][j][k-1];
				}else{
					dp[i][j][k] = min(dp[i][j][k-1],dp[i-ak][j-bk][k-1] + ck);
				}
			//	if (dp[i][j][k] != INF) printf("dp[%d][%d][%d] = %d\n",i,j,k,dp[i][j][k]);
			}
		}
	}
	
	int ans = INF;
	int q = 1;
	
	while((q*Ma <= 401) and (q*Mb <= 401)){
		ans = min(ans,dp[q*Ma][q*Mb][N]);
		q++;
	}
	
	if (ans == INF){
		PRINTD(-1);
	}else{
		PRINTD(ans);
	}
	
	
	return 0;
}



Measured memory_bytes: 26880
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[n];
        for(int i = 0; i < n; i++){
            a[i] = sc.nextInt();
        }
        int counte = 0;
        for(int i = 0; i < n; i++){
            if(a[i] % 2 == 0){
                counte++;
            }
        }
        double allpattern = Math.pow(3,n);
        double allodd = Math.pow(2,counte);
        int allp = (int)allpattern;
        int allo = (int)allodd;
        System.out.print(allp-allo);
    }
}

Measured memory_bytes: 23124
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func main() {
	sc.Split(bufio.ScanWords)
	var n, m, ans int
	var k [30]int
	var a [30][30]int
	fmt.Scanf("%d %d", &n, &m)
	for i := 0; i < n; i++ {
		k[i] = nextInt()
		for j := 0; j < k[i]; j++ {
			a[i][j] = nextInt()
		}
	}

	f := make(map[int]int, 30)

	for i := 0; i < n; i++ {
		for j := 0; j < k[i]; j++ {
			b := f[a[i][j]]
			f[a[i][j]] = b + 1
		}
	}

	for i := 0; i < m; i++ {
		if f[i+1] == n {
			ans++
		}
	}

	fmt.Println(ans)

}


Measured memory_bytes: 1904
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<string>
#include<cmath>
#include<vector>
#define FOR(i,a,b) for(int i=a;i<b;i++)
typedef long long ll;
using namespace std;
const int MOD = 1e9 + 7;
int N;
ll m=0;
ll a=0;
ll r=0;
ll c = 0;
ll h = 0;
int main(void) {
	cin >> N;
	FOR(i, 0, N) {
		string t;
		cin >> t;
		if (t[0] == 'M')m++;
		if (t[0] == 'A')a++;
		if (t[0] == 'R')r++;
		if (t[0] == 'C')c++;
		if (t[0] == 'H')h++;
	}
	ll ans = m * a*r + m * a*c;
	ans += m * a*h + m * r*c;
		ans += m * r*h + m * c*h;
		ans += a * r*c + a * r*h;
		ans += a * c*h + r * c*h;
	cout << ans << endl;
	return 0;
}

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

using namespace std;

int main() {
    string str; cin >> str;
    int len = str.length();
    string ret = "";
    for (int i = 0; i < len; i++) {
        if (i % 2 == 0 || i == 0) {
            ret += str[i];
        }
    }

    cout << ret << endl;
    return 0;
}

Measured memory_bytes: 888
N = gets.to_i
as = gets.split.map(&:to_i)

hash = {}
sum = 0
ans = 0

as.each do |a|
    sum += a
    if hash[sum]
        ans += hash[sum]
    end
    if sum == 0
        ans += 1
    end
    hash[sum] ||= 0
    hash[sum] += 1
end
puts ans

Measured memory_bytes: 29060
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<cstdlib>
#include<iostream>
#include<algorithm>
#define fi first
#define se second
#define L(i,u) for (int i=head[u]; i!=0; i=nxt[i])
#define rep(i,a,b) for (register int i=a; i<=b; i++)
#define per(i,a,b) for (register int i=a; i>=b; i--)
typedef long long ll;
using namespace std;
typedef pair<int,int> Pii;
typedef vector<int> Vi;
inline void read(int &x) {
	x=0; char c=getchar(); int f=1;
	while (!isdigit(c)) {if (c=='-') f=-1; c=getchar();}
	while (isdigit(c)) {x=x*10+c-'0'; c=getchar();} x*=f;
}
const int N = 2333;
int n,k,q,a[N],s[N],ans=2e9;
int f[N],cnt[N];

int solve(int v) { //min=v
	int lst=0;
	rep(i,1,n) if (a[i]<v) {
		//[lst+1,i-1]
		cnt[lst+1]=i-1-(lst+1)+1;
		rep(j,lst+1,i-1) f[j]=lst+1;
		lst=i;
	}
	//[lst+1,n]
	cnt[lst+1]=n-lst; rep(j,lst+1,n) f[j]=lst+1;
	int now=0;
	rep(i,1,n) if (a[s[i]]>=v&&cnt[f[s[i]]]>=k) {
		now++; cnt[f[s[i]]]--; if (now==q) return a[s[i]]-v;
	}
	return 2e9;
}
bool cmp(int i, int j) {return a[i]<a[j];}
int main() {
	read(n);read(k);read(q);
	rep(i,1,n)read(a[i]),s[i]=i; sort(s+1,s+n+1,cmp);
	rep(j,1,n)ans=min(ans,solve(a[j]));
	cout<<ans;
	return 0;
}


Measured memory_bytes: 384
#include <stdio.h>
#include <ctype.h>

int main(void){
    char s;
    for(;;){
        scanf("%c",&s);
        if(s=='\n') break;
        if(islower(s)){
            s=toupper(s);
            printf("%c",s);
        }
        else{
            s=tolower(s);
            printf("%c",s);
        }
    }
    printf("\n");
    return 0;
}


Measured memory_bytes: 1816
#include<stdio.h>


int main() {
    //変数の宣言
    int i, j, n, tp=0, hp=0;
    char t[101], h[101];
    
    scanf("%d", &n); //ターン数（各持ちカード数　入力
    
    for (i=0; i<n; i++) {
        scanf("%s %s", t, h); //各々の具体的なカード　入力
        
        for (j=0;;j++) { //延々とiを増やしてく。breakが置いてある
            if (t[j] > h[j]) {//毎度勝敗を確認して終わり次第breakして次のターンの処理をする
                tp += 3;
                break;
            }else if (t[j] < h[j]) {
                hp += 3;
                break;
            }else if (t[j] + h[j] == 0) {
                tp += 1;
                hp += 1;
                break;
            }
        }

    }
    
    
    //出力
    printf("%d %d\n", tp, hp);
    
    return 0;
}



Measured memory_bytes: 2104
N = int(input())
Af = list(map(int,input().split()))
A = list()
for i in range(N):
  if Af[i] % 2 == 0:
      A.append(Af[i])
      continue
  else:
      continue
for i in range(len(A)):
  if A[i] % 3 != 0 and A[i] % 5 != 0:
      print('DENIED')
      import sys
      sys.exit()
  if A[i] % 3 == 0 or A[i] % 5 == 0:
      continue 
print('APPROVED')

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  
  int O = 1;
  int P = 0;
  for(int i = 0; i < 8; i++) {
    O *= 10;
    P += N % O / (O / 10);
  }
  
  if (N % P == 0) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include<stdio.h>
using namespace std;

int main()
{
    int x,i,y,j;
    int chk=0;
    cin>>x;
    int* ar=(int*)malloc(x*sizeof(int));
    for(i=1;i<=x;i++){
        cin>>y;
        ar[i-1]=y;
    }
    for(j=0;j<x;j++){
        chk=chk^ar[j];
        }
       
    if(chk==0){
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }
    
}


Measured memory_bytes: 640
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
using namespace std;
#define INF 100000000
typedef long long ll;

int d[110][110];

int main(void) {
    int n;
    cin >> n;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            d[i][j] = INF;
        }
        d[i][i] = 0;
    }
    for (int i = 0; i < n; i++) {
        int r, k;
        cin >> r >> k;
        --r;
        int t;
        for (int j = 0; j < k; j++) {
            cin >> t;
            d[r][t-1] = 1;
        }
    }
    for (int k = 0; k < n; k++) {
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
            }
        }
    }
    int p;
    cin >> p;
    for (int i = 0; i < p; i++) {
        int s, D, v;
        cin >> s >> D >> v;
        if (v > d[s-1][D-1]) {
            cout << d[s-1][D-1]+1 << endl;
        } else {
            cout << "NA" << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 1208
#include <iostream>

const int MAXN = 1e5 + 5;

using namespace std;

bool dp[MAXN];
int v[MAXN];

int main()
{
    int n,k;
    cin>>n>>k;
    for(int i = 1; i <= n; i++){
        cin>>v[i];
        dp[v[i]] = true;
    }
    for(int i = 1; i <= k; i++){
        for(int j = 1; j <= n; j++){
            if(v[j] <= i and !dp[i - v[j]] and !dp[i]){
                dp[i] = true;
                break;
            }
        }
    }
    if(dp[k])
        cout<<"First";
    else
        cout<<"Second";
    return 0;
}


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


int main() {
  int a,b,c,d,sum,ans;
  string s;
  cin>>a>>b>>c;
  ans=0;
  
  vector<int> vecV(a);
  vector<int> vecC(a);
  
  a = a-c;
  a= a/(b+c);
  cout<<a<<endl;
  return 0;
}


Measured memory_bytes: 1024
import os
import sys
from io import BytesIO, IOBase
import math

def main():
    #n,k=list(map(int,input().split()))
    #a=list(map(int,input().split()))
    n=int(input())
    res=""
    while n:
        n-=1
        res=chr(ord("a")+n%26)+res
        n//=26
    
    
    print(res)
# region fastio

BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

# endregion

if __name__ == "__main__":
    main()

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

int main() {
	int n, t, a; cin >> n >> t >> a;

	int mint = (1 << 30);
	int d, h, res = 0;
	for (int i = 1; i <= n; i++) {
		cin >> h;
		d = abs((t * 1000) - (h * 6) - (a * 1000));
		if (mint > d) {
			res = i;
			mint = d;
		}
	}
	cout << res << endl;

	return 0;
}

Measured memory_bytes: 256
/*
Hey there stalker....

█▀▀▄░░░░░░░░░░░▄▀▀█
░█░░░▀▄░▄▄▄▄▄░▄▀░░░█
░░▀▄░░░▀░░░░░▀░░░▄▀
░░░░▌░▄▄░░░▄▄░▐▀▀
░░░▐░░█▄░░░▄█░░▌▄▄▀▀▀▀█
░░░▌▄▄▀▀░▄░▀▀▄▄▐░░░░░░█
▄▀▀▐▀▀░▄▄▄▄▄░▀▀▌▄▄▄░░░█
█░░░▀▄░█░░░█░▄▀░░░░█▀▀▀
░▀▄░░▀░░▀▀▀░░▀░░░▄█▀
░░░█░░░░░░░░░░░▄▀▄░▀▄
░░░█░░░░░░░░░▄▀█░░█░░█
░░░█░░░░░░░░░░░█▄█░░▄▀
░░░█░░░░░░░░░░░████▀
░░░▀▄▄▀▀▄▄▀▀▄▄▄█▀

Like what you see?
*/
#include <bits/stdc++.h>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
using namespace std;
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define pb push_back
#define pii         pair<ll ,ll>
#define vi          vector<ll>
#define present(container, element) (container.find(element) != container.end()) /* For set n maps */
#define cpresent(container, element) (find(all(container),element) != container.end()) /* For vectors */
#define all(a)      (a).begin(),(a).end()
#define invect(data,n,commands) for(int i = 0;i<n;i++){int tmp;cin>>tmp;data.pb(tmp);commands}
#define inset(data,n,commands) for(int i = 0;i<n;i++){int tmp;cin>>tmp;data.I(tmp);commands}
#define F           first
#define S           second
#define I           insert
#define sz(x)       (ll)x.size()
#define rep(i,a,b)    for(ll  i=a;i<b;i++)
#define repr(i,a,b) for(ll  i=a;i>b;i--)
#define trav(a, x) 	for(auto& a : x)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define lcase(a) (char)tolower(a)
#define ll long long int
#define lld long double
#define endl "\n"
#define PI 3.14159265358979323844
#define MOD 1000000007
#define max(a, b) (a < b ? b : a)
#define min(a, b) ((a > b) ? b : a)
#define mod 1e9 + 7
const int N = 1e5 + 5;
/*	For Debugging	*/
#define DEBUG 		cerr<<"\n>>>I'm Here<<<\n"<<endl;
#define display(x) trav(a,x) cout<<a<<" ";cout<<endl;
#define what_is(x)  cerr << #x << " is " << x << endl;
int n,m,x,a[13][13],c[13],ans=MOD;
int main()
{
   IOS

    int TESTS=1;
    //cin >> TESTS;
    while (TESTS--)
    {
    	cin>>n>>m>>x;
    rep(i,0,n){
    	cin>>c[i];
    	rep(j,0,m){
    		cin>>a[i][j];
    	}
    }
    rep(i,0,1<<n){
    	int w=0,f[13]={0};
    	rep(j,0,n){
    		if((i>>j)&1){
    			w+=c[j];
    			rep(k,0,m){
    				f[k]+=a[j][k];
    			}
    		}
    	}
    	int g=1;
    	rep(j,0,m){
    		if(f[j]<x)
			{g=0;
    	}
    	}
    	if(g) ans=min(ans,w);
    }
    	
    if(ans<MOD) cout<<ans<<endl;
    else cout<<-1<<endl;
    }
    return 0;
}


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

namespace AtCoderBeginnerContest
{
    public class Program
    {
        public static void Main(string[] args)
        {
            var line1 = Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray();
            long N = line1[0];
            long T = line1[1];

            long[] t = Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray();

            // 重なる時間
            long loss = 0;
            for (long i = 1; i < N; i++)
            {
                if(t[i] - t[i - 1] < T) loss += T - (t[i] - t[i - 1]);
            }

            var rt = T * N - loss;

            Console.WriteLine(rt);

        }
    }
}


Measured memory_bytes: 32928
#include <iostream>
#include <algorithm>
#include <ios>     // std::left, std::right
#include <iomanip> // std::setw(int), std::setfill(char)
#include <string>
#include <cmath>
#include <vector>
using namespace std;

int N, Y;
int yen[3] = {10000, 5000, 1000};



int main(int argc, char const *argv[]) {
    cin >> N >> Y;

    for (int x = 0; x <= N; x++){
        for (int y = 0; y <= N - x; y++){
            int z = N - x - y;
            if (yen[0]*x + yen[1]*y + yen[2]*z == Y){
                cout << x << " " << y << " " << z << endl;
                return 0;
            }
        }
    }
    cout << "-1 -1 -1" << endl;
    return 0;
}


Measured memory_bytes: 256
n = int(input())
L = list(map(int,input().split()))
print(sum([1 if not(L[i]==L[j] or L[i]==L[k] or L[j]==L[k]) and L[i]+L[j] > L[k] and L[i]+L[k] > L[j] and L[j]+L[k] > L[i] else 0 for i in range(0,n) for j in range(i+1,n) for k in range(j+1,n)])) 

Measured memory_bytes: 84152
from collections import deque
INF = -1
H, W = map(int, input().split())
S = [input() for _ in range(H)]

dx = [0, 1, 0, -1]
dy = [1, 0, -1, 0]

answer = 0
for y in range(H):
    for x in range(W):
        if S[y][x] == '#':
            continue
        else:
            # 対象の(x, y)を元に一番遠いところまで求める
            queue = deque([[y, x]])
            memo = [[INF] * W for _ in range(H)]

            memo[y][x] = 0
            while len(queue) > 0:
                myx = queue.pop()
                for i in range(4):
                    if myx[0] + dy[i] >= 0 and myx[0] + dy[i] < H:
                        if myx[1] + dx[i] >= 0 and myx[1] + dx[i] < W:
                            if memo[myx[0] + dy[i]][myx[1] + dx[i]] == INF:
                                if S[myx[0] + dy[i]][myx[1] + dx[i]] == ".":
                                    memo[myx[0] + dy[i]][myx[1] + dx[i]] = memo[myx[0]][myx[1]] + 1
                                    queue.appendleft([myx[0] + dy[i], myx[1] + dx[i]])
            for i in range(H):
                answer = max(answer, max(memo[i]))
print(answer)

Measured memory_bytes: 3316
#include<stdio.h>

unsigned long long gcd(unsigned long long s,unsigned long long t){
  if(t==0) return s;
  return gcd(t,s%t);
}

int main(void){
  int i,n;
  unsigned long long s=1,t;

  scanf("%d",&n);

  for(i=0;i<n;i++){
    scanf("%llu",&t);
    if(s!=t)
      s = s/gcd(s,t)*t;
  }

  printf("%llu\n",s);

  return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <limits>
#include <numeric>
#include <algorithm>
#include <functional>

using namespace std;

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

	char A;
	cin >> A;

	if (A >= 'A' && A <= 'Z')
	{
		cout << 'A';
	}
	else
	{
		cout << 'a';
	}
	
	return 0;
}


Measured memory_bytes: 3624
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <iomanip>
#include <cmath>
#include <map>
#include <set>
#include <ctype.h>
#include <numeric>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
const ll MOD = 1e9 + 7;
const int INF = 1e9;

int dx4[4] = { 0, -1, 1, 0 };
int dy4[4] = { -1, 0, 0, 1 };
int dx8[8] = { 0, -1, 1, 0, -1, 1, -1, 1 };
int dy8[8] = { -1, 0, 0, 1, -1, -1, 1, 1 };

int main() {
  string num;
  cin >> num;
  cout << "ABC" << num << endl;
  return 0;
}


Measured memory_bytes: 384
from __future__ import division, print_function

''' Hey stalker :) '''
INF = 10 ** 10
TEST_CASES = False
from collections import defaultdict, Counter

def main():
    a,b = get_list()
    print(a*b)


''' FastIO Footer: PyRival Library, Thanks @c1729 and contributors '''
import os
import sys
from bisect import bisect_left, bisect_right
from io import BytesIO, IOBase

if sys.version_info[0] < 3:
    from __builtin__ import xrange as range
    from future_builtins import ascii, filter, hex, map, oct, zip
BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


def print(*args, **kwargs):
    """Prints the values to a stream, or to sys.stdout by default."""
    sep, file = kwargs.pop("sep", " "), kwargs.pop("file", sys.stdout)
    at_start = True
    for x in args:
        if not at_start:
            file.write(sep)
        file.write(str(x))
        at_start = False
    file.write(kwargs.pop("end", "\n"))
    if kwargs.pop("flush", False):
        file.flush()


if sys.version_info[0] < 3:
    sys.stdin, sys.stdout = FastIO(sys.stdin), FastIO(sys.stdout)
# else:
#     sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)

input = lambda: sys.stdin.readline().rstrip("\r\n")
get_int = lambda: int(input())
get_list = lambda: list(map(int, input().split()))
if __name__ == "__main__":
    if TEST_CASES:
        [main() for _ in range(int(input()))]
    else:
        main()


Measured memory_bytes: 66416
s=int(input())
m=s//3
c=10**9+7
dp=[[0]*(m+1) for i in range(s+1)]
for i in range(3,s+1):
  dp[i][1]=1
su=[0]*(m+1)

for i in range(6,s+1):
  for j in range(2,i//3+1):
    su[j-1]=(su[j-1]+dp[i-3][j-1])%c
    dp[i][j]=su[j-1]
print(sum(dp[-1])%c)

Measured memory_bytes: 71308
n = int(input())
S = input()

result = 0
for i in range(10):
  if str(i) in S:
    T = S[S.index(str(i))+1:]

    for j in range(10):
      if str(j) in T:
        U = T[T.index(str(j))+1:]

        for k in range(10):
          if str(k) in U:
            result += 1

print(result)



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

int h,w,k;
long num = 0;

void dfs(int i,bool exist,int d,int e){
  if(i == w-2){
    num++;
    return;
  }
  else{
    if(i+1 == d && exist == true){
      return;
    }
    else if(i+1 == d && exist == false){
      dfs(i+1,true,d,e);
    }
    else if(i+1 == e || i+1 == e+1){
      dfs(i+1,false,d,e);
    }
    else if(exist == true){
      dfs(i+1,false,d,e);
    }
    else{
      dfs(i+1,true,d,e);
      dfs(i+1,false,d,e);
    }
  }
  return;
}
const long inf = 1000000007;
int main(){
  cin >> h >> w >> k;
  long dp[h+1][w];// 横注意
  for(int i = 0;i < w;i++){
    for(int j = 0;j <= h;j++){
      dp[j][i] = 0;
    }
  }
  dp[0][0] = 1;
  for(int i = 0;i < h;i++){
    for(int j = 0;j < w;j++){
      long x,y,z;
      num = 0;
      dfs(-1,false,j-1,-100);
      x = num;
      num = 0;
      dfs(-1,false,j,-100);
      y = num;
      num = 0;
      dfs(-1,false,-100,j-1);
      z = num;
      //cout << x << ' ' << y << ' ' << z << ' ' << i << ' ' << j+1 << endl;
      if(j != 0 && j != w-1){
        dp[i+1][j-1] = (dp[i+1][j-1] + (dp[i][j]*x)%inf)%inf;
        dp[i+1][j+1] = (dp[i+1][j+1] + (dp[i][j]*y)%inf)%inf;
        dp[i+1][j] = (dp[i+1][j] + (dp[i][j]*z)%inf)%inf;
      }
      else if(j == 0){
        dp[i+1][j+1] = (dp[i+1][j+1] + (dp[i][j]*y)%inf)%inf;
        dp[i+1][j] = (dp[i+1][j] + (dp[i][j]*z)%inf)%inf;
        //cout << dp[i][j]*z << ' ' << i << ' ' << j << endl;
      }
      else{
       dp[i+1][j-1] = (dp[i+1][j-1] + (dp[i][j]*x)%inf)%inf;
        dp[i+1][j] = (dp[i+1][j] + (dp[i][j]*z)%inf)%inf;
      }
      //cout << dp[1][0] <<  ' ' << i << ' ' << j+1 << endl;
    }
  }
  if(w == 1){
    cout << 1 << endl;
  }
  else{
    cout << dp[h][k-1] << endl;
  }
}

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

using namespace std;

typedef long long ll;

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

	string s;
	cin >> s;

	int n = s.size();
	cout << s.substr(0, n - 8) << endl;
}


Measured memory_bytes: 256
#include <stdio.h>

int d,s;

void getS(int n){
	if((600-n)>0){
		s+=n*n*d;
		getS(n+d);
	}
}

int main(){
	while(scanf("%d",&d)!=EOF){
		s=0;
		getS(d);
		printf("%d\n",s);
	}
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define int long long
using namespace std;
#define pb push_back
#define mp make_pair
int snt(int n){
    int i, j;
    if(n==0 || n==1) return 0;
    if(n==2 || n==3) return 1;
    for(i=2; i<=sqrt(n); ++i){
        if(n%i==0){
            return 0;
        }
    }
    return 1;
}
signed main(){
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int  n;
    cin>>n;
    while(snt(n)==0){
        n++;
    }
    cout<<n;
}

Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ld long double
#define al(a) (a).begin(),(a).end()
#define mk make_pair
#define check cout<<"?"<<endl;

ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;

int main(){
    int n; cin>>n;
    if(n==3) cout<<"2 5 63"<<endl;
    else if(n==4) cout<<"2 4 3 9"<<endl;
    else{
        n-=4;
        cout<<"2 4 3 9 ";
        rep(i,4999){
            if(n==0) break;
            if(n==1){
                cout<<6<<endl;
                n--;
                break;
            }
            if(n==2) cout<<6*i+8<<" "<<6*i+10<<endl;
            else cout<<6*i+8<<" "<<6*i+10<<" ";
            n-=2;
        }
        rep(i,2499){
            if(n==0) break;
            if(n==1){
                cout<<6<<endl;
                n--;
                break;
            }
            if(n==2) cout<<12*i+15<<" "<<12*i+21<<endl;
            else cout<<12*i+15<<" "<<12*i+21<<" ";
            n-=2;
        }
        rep(i,5000){
            if(n==0) break;
            if(n==1) cout<<6*i+6<<endl;
            else cout<<6*i+6<<" ";
            n--;
        }
    }
}

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

int main() {
	int N, M, X, Y;
	cin >> N >> M >> X >> Y;
	int x = X, y = Y;

	for (int i = 0; i < N; i++) {
		int a; cin >> a;
		if (a > x) x = a;
	}

	for (int i = 0; i < M; i++) {
		int a; cin >> a;
		if (a < y) y = a;
	}

	cout << (x < y ? "No War" : "War") << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n,l;
  cin>>n>>l;
  string a [n];
  for (int i=0;i<n;i++) {
   cin>>a[i];
  }
  sort(a+0,a+n);
  for (int i=0;i<n;i++) {
   cout<<a[i];
  }
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <stack>

template <typename QvQ> inline QvQ Min(QvQ a,QvQ b){if(a<b) return a;return b;}
template <typename QvQ> inline QvQ Max(QvQ a,QvQ b){if(a>b) return a;return b;}

#define inf 2147483647
#define dinf 0x3f3f3f3f
#define llinf 0x7f7f7f7f7f7f7f7f

#define ll long long
#define rei register int
#define inv inline void
#define ull unsigned long long
#define il inline

#define bl putchar(' ')
#define ed putchar('\n')
#define test cout<<"this:" 

#define read2(a,b) read(a),read(b)
#define write2(a,b) write(a),bl,write(b)
#define read3(a,b,c) read(a),read(b),read(c)
#define write3(a,b,c) write(a),bl,write(b),bl,write(c)

template <typename QvQ>inv read(QvQ &x){
	x=0;int f=1;
	char c=getchar();
	for(;c<'0'||c>'9';c=getchar()) if(c=='-') f=-1;
	for(;c>='0'&&c<='9';c=getchar()) x=(x<<1)+(x<<3)+(c^48);
	x=x*f;
}
template <typename QvQ>inv write(QvQ x){
	if(x<0) x=-x,putchar('-');
	if(x>9) write(x/10);
	putchar(x%10+48);
}
#define maxn 250005
#define int ll
struct  edge{
    int to,next;
    edge(){}
    edge(const int &_to,const int &_next){ to=_to,next=_next; }
}e[maxn];
int head[maxn],k;

int stack[maxn],top;
bool vis[maxn],instack[maxn],inloop[maxn];
int n,m;

inline int read(){
    register int x(0),f(1); register char c(getchar());
    while(c<'0'||'9'<c){ if(c=='-') f=-1; c=getchar(); }
    while('0'<=c&&c<='9') x=(x<<1)+(x<<3)+(c^48),c=getchar();
    return x*f;
}
inline void add(const int &u,const int &v){
    e[k]=edge(v,head[u]);
    head[u]=k++;
}
int ans[100005],cnt;
int maxx=100005,b[100005];
void dfs(int u)
{
    vis[u]=instack[u]=true,stack[++top]=u;
    for(register int i=head[u];~i;i=e[i].next)
	{
        int v=e[i].to;
        if(!vis[v]) dfs(v);
        else if(instack[v])
		{
            int w,t=top;
            do
			{
                w=stack[t--],instack[w]=false,inloop[w]=true;
                ans[++cnt]=w;
            }while(w!=v);
            if(maxx>cnt)
            {
				maxx=cnt;
				for( int i=1;i<=cnt;++i) b[i]=ans[i];
			}
			cnt=0;
//            std::cout<<cnt<<std::endl;
//            for(int i=1;i<=cnt;++i) std::cout<<ans[i]<<std::endl;
          //  exit(0);
        }
    }
    instack[u]=false,top--;
}
signed main()
{
    memset(head,-1,sizeof head);
    n=read(),m=read();
    for(register int i=1;i<=m;i++)
	{
        int u=read(),v=read();
        add(u,v);
    }
    for(register int i=1;i<=n;i++) if(!vis[i]) dfs(i);
    if(maxx==100005) puts("-1");
    else
    {
    	std::cout<<maxx<<std::endl;
		for( int i=1;i<=maxx;++i) std::cout<<b[i]<<std::endl;
	}
    return 0;
}

Measured memory_bytes: 6400
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int T[] = new int[N];
    int total = 0;
    
    for(int i= 0; i<N; i++){
      T[i]=sc.nextInt();
      total += T[i];
    }
    
    int M = sc.nextInt();
    for(int i= 0; i<M; i++){
      int P=sc.nextInt();
      int X=sc.nextInt();
      System.out.println(total - T[P-1] + X);
    }
  }
}
      

Measured memory_bytes: 36164
using System;
using System.Text;

public class Program
{
    private int L;

    private StringBuilder Sb;

    private int N;

    public void Solve()
    {
        Sb = new StringBuilder();
        var sc = new Scanner();
        L = sc.NextInt();
        int r = (int) Math.Log(L, 2);
        int N = r + 1;
        int M = 0;
        for (int i = 1; i <= r; i++)
        {
            Sb.AppendLine($"{i} {i + 1} {1 << (i - 1)}");
            Sb.AppendLine($"{i} {i + 1} 0");
            M += 2;
        }
        
        for (int t = N - 1; t >= 1; t--)
        {
            int a = L - (1 << (t - 1));
            int b = 1 << r;
            if (a >= b)
            {
                Sb.AppendLine($"{t} {N} {a}");
                L = a;
                M++;
            }
        }
        Console.WriteLine($"{N} {M}");
        Console.Write(Sb.ToString());
        
    }


    public static void Main(string[] args)
    {
        new Program().Solve();
    }
}

class Scanner
{
    public Scanner()
    {
        _pos = 0;
        _line = new string[0];
    }

    const char Separator = ' ';
    private int _pos;
    private string[] _line;

    #region スペース区切りで取得

    public string Next()
    {
        if (_pos >= _line.Length)
        {
            _line = Console.ReadLine().Split(Separator);
            _pos = 0;
        }

        return _line[_pos++];
    }

    public int NextInt()
    {
        return int.Parse(Next());
    }

    public long NextLong()
    {
        return long.Parse(Next());
    }

    public double NextDouble()
    {
        return double.Parse(Next());
    }

    #endregion

    #region 型変換

    private int[] ToIntArray(string[] array)
    {
        var result = new int[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = int.Parse(array[i]);
        }

        return result;
    }

    private long[] ToLongArray(string[] array)
    {
        var result = new long[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = long.Parse(array[i]);
        }

        return result;
    }

    private double[] ToDoubleArray(string[] array)
    {
        var result = new double[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = double.Parse(array[i]);
        }

        return result;
    }

    #endregion

    #region 配列取得

    public string[] Array()
    {
        if (_pos >= _line.Length)
            _line = Console.ReadLine().Split(Separator);

        _pos = _line.Length;
        return _line;
    }

    public int[] IntArray()
    {
        return ToIntArray(Array());
    }

    public long[] LongArray()
    {
        return ToLongArray(Array());
    }

    public double[] DoubleArray()
    {
        return ToDoubleArray(Array());
    }

    #endregion
}

Measured memory_bytes: 13268