akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD=1e9+7;
const int INF=1e9;

int n,m;
bool M[10][10];
bool visit[10];
int ans;

void dfs(int v){
    visit[v]=true;
    bool flag=true;
    for(int i=1;i<=n;i++){
        if(!visit[i]){
            flag=false;
            break;
        }
    }
    if(flag){
        ans++;
        return;
    }
    for(int i=2;i<=n;i++){
        if(M[v][i]&&!visit[i]){
            visit[i]=true;
            dfs(i);
            visit[i]=false;
        }
    }
}

int main(){
    cin>>n>>m;
    for(int i=0;i<m;i++){
        int a,b;
        cin>>a>>b;
        M[a][b]=true;
        M[b][a]=true;
    }
    dfs(1);
    cout<<ans<<endl;
}


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

int n;
int s[101], ss[101], si=0, ssi=0;

int main() {
    cin >> n;

    int sum=0, sum2=0;

    rep(i, n) {
        int t; cin >> t;
        if (t%10 == 0) {
            ss[ssi++] = t;
            sum2 += t;
        }
        else { s[si++] = t; sum += t; }
    }
    sort(s, s+si);

    for (int i=0; i<si && sum%10 == 0; ++i) {
        sum -= s[i];
    }

    cout << (sum%10 ? sum+sum2 : 0) << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define space putchar(' ')
#define enter putchar('\n')
#define MAXN 40005
#define eps 1e-12
//#define ivorysi
using namespace std;
typedef long long int64;
typedef unsigned int u32;
typedef double db;
template<class T>
void read(T &res) {
	res = 0;T f = 1;char c = getchar();
	while(c < '0' || c > '9') {
		if(c == '-') f = -1;
		c = getchar();
	}
	while(c >= '0' && c <= '9') {
		res = res * 10 + c - '0';
		c = getchar();
	}
	res *= f;
}
template<class T>
void out(T x) {
	if(x < 0) {x = -x;putchar('-');}
	if(x >= 10) {
		out(x / 10);
	}
	putchar('0' + x % 10);
}
int N,M;
int num[30],cnt[10];
char s[105][105];

int main() {
#ifdef ivorysi
	freopen("f1.in","r",stdin);
#endif
	read(N);read(M);
	for(int i = 1 ; i <= N ; ++i) {
		scanf("%s",s[i] + 1);
	}
	for(int i = 1 ; i <= N ; ++i) {
		for(int j = 1 ; j <= M ; ++j) {
			num[s[i][j] - 'a']++;
		}
	}
	int lr = 1,rr = N,lc = 1,rc = M;
	while(lr <= rr && lc <= rc) {
		int r = 0;
		if(lr != rr) r += 2;
		if(lc != rc) r += 2;
		if(!r) r = 1;
		cnt[r]++;
	 	for(int i = 1 ; i <= N ; ++i) {
			if(lr + i <= rr - i) {
				int r = 0;
				if(lr + i != rr - i) r += 2;
				if(lc != rc) r += 2;
				cnt[r]++;
			}
			else break;
		}
		for(int i = 1 ; i <= M ; ++i) {
			if(lc + i <= rc - i) {
				int r = 0;
				if(lc + i != rc - i) r += 2;
				if(rr != lr) r += 2;
				cnt[r]++;
			}
			else break;
		}
		++lr;--rr;++lc;--rc;
	}
	for(int i = 0 ; i < 26 ; ++i) {
		while(cnt[4] && num[i] >= 4) {num[i] -= 4;--cnt[4];}
		while(cnt[2] && num[i] >= 2) {num[i] -= 2;--cnt[2];}
		while(cnt[1] && num[i] >= 1) {num[i] -= 1;--cnt[1];}
	}
	if(cnt[1] || cnt[2] || cnt[4]) puts("No");
	else puts("Yes");
	return 0;
}


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

using namespace std;

using ll = long long;
using ld = long double;
using vi = vector<ll>;
using vvi = vector<vi>;

#define all(a) a.begin(), a.end()
#define pb push_back

struct comp {
    ld real, imag;
};

comp operator+(comp a, comp b) {
    return {a.real + b.real, a.imag + b.imag};
}

comp operator-(comp a, comp b) {
    return {a.real - b.real, a.imag - b.imag};
}

comp operator*(comp a, comp b) {
    return {a.real * b.real - a.imag * b.imag, a.real * b.imag + a.imag * b.real};
}

void operator*=(comp& a, comp b) {
    a = a * b;
}

void operator/=(comp& a, ld b) {
    a = {a.real / b, a.imag / b};
}

int rev(int num, int lg_n) {
    int res = 0;
    for (int i = 0; i < lg_n; i++) {
        if (num & (1<<i))
			res |= 1<<(lg_n-1-i);
    }
    return res;
}


ld PI = atan2(0, -1);
void fft (vector<comp> & a, bool invert) {
	int n = (int) a.size();
 
	for (int i=1, j=0; i<n; ++i) {
		int bit = n >> 1;
		for (; j>=bit; bit>>=1)
			j -= bit;
		j += bit;
		if (i < j)
			swap (a[i], a[j]);
	}
 
	for (int len=2; len<=n; len<<=1) {
		ld ang = 2*PI/len * (invert ? -1 : 1);
		comp wlen = {cos(ang), sin(ang)};
		for (int i=0; i<n; i+=len) {
			comp w = {1, 0};
			for (int j=0; j<len/2; ++j) {
			    comp u = a[i+j],  v = a[i+j+len/2] * w;
				a[i+j] = u + v;
				a[i+j+len/2] = u - v;
				w *= wlen;
			}
		}
	}
	if (invert)
		for (int i=0; i<n; ++i)
			a[i] /= n;
}

void solve() {
    ll p = 200003;
    vi kek(p);
    ll x = 1;
    for (int it = 0; it < p - 1; it++) {
        kek[x] = it;
        x *= 2;
        x %= p;
    }
    int n; cin >> n;
    vi a;
    for (int i = 0; i < n; i++) {
        ll x; cin >> x;
        if (x != 0) a.pb(x);
    }
    n = a.size();

    ll res = 0;
    for (auto& i : a) {
        res -= (i * i) % p;
    }

    for (auto& i : a) i = kek[i];

    int z = 524288;

    vector<comp> r(z);
    for (auto& i : a) r[i].real++;

    fft(r, 0);
    for (auto &i : r) i *= i;
    fft(r, 1);

    vi pow(p);
    for (int i = 1; i < p; i++) {
        pow[kek[i]] = i;
    }

    for (int i = 0; i < z; i++) {
        ll num = (ll)(r[i].real + .3);
        res += pow[i % (p - 1)] * num; 
    }
    cout << res / 2;
}



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

Measured memory_bytes: 24840
#include <iostream>
using namespace std;
int main(){
    // Your code her
    int a,b;
    for(int i=0; i<3000; i++){
        cin >> a >> b;
        if(a==0 && b==0){
            break;
        }
        int c = min(a, b);
        int d = max(a, b);
        cout << c << " " << d << endl;
    }
}



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

int main()
{
    ll n, k, q;
    cin >> n >> k >> q;
    vector<ll> score(n, k-q);
    rep(i, q){
        int a;
        cin >> a;
        score.at(a-1)++;
    }

    for(int x:score){
        if(x > 0){
            cout<<"Yes"<<endl;
        }
        else{
            cout <<"No"<<endl;
        }
    }


}



Measured memory_bytes: 1408
import std.stdio;
import std.string;
import std.conv;
import std.algorithm;
import std.range;
import std.container;
import std.bigint;
import std.math;

void main()
{
	auto n = readln.chomp.to!int;
  foreach (i; 1..n+1) {
    auto x = i;
    if (x % 3 == 0) {
      write(" ", i);
      continue;
    }
    while (x) {
      if (x % 10 == 3) {
        write(" ", i);
        break;
      }
      x /= 10;
    }
  }
  writeln("");
}

Measured memory_bytes: 1088
N, K = [int(_) for _ in input().split()]
A = [int(_) for _ in input().split()]

w = sum(x for x in A[K:] if x > 0)
b = sum(A[:K]) + w

result = max(w, b)

for i in range(N - K):
    j = i + K
    Ai = A[i]
    Aj = A[j]
    if Ai > 0:
        w += Ai
    if Ai < 0:
        b -= Ai
    if Aj > 0:
        w -= Aj
    if Aj < 0:
        b += Aj
    result = max(result, w, b)

print(result)


Measured memory_bytes: 14388
#include<bits/stdc++.h> 
using namespace std; 
typedef long long int ll;
bool sortbysec(const pair<ll,ll> &a, 
              const pair<ll,ll> &b) 
{ 
    return (a.second < b.second); 
}
int main() 
{  
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int t=1;
   // cin>>t;
    while(t--)
    {
      
      string s;
     int n,x=0;
     cin>>n;
     int arr[n];
     for(int i=0;i<n;i++)
     cin>>arr[i];
     for(int i=1;i<n-1;i++)
     {
         vector<int>v;
         v.push_back(arr[i-1]);
         v.push_back(arr[i+1]);
         v.push_back(arr[i]);
         sort(v.begin(),v.end());
         if(v[1]==arr[i])
         x++;
     }
     cout<<x;
      
    }
    
    return 0;
}

Measured memory_bytes: 256
program main
integer N,sup_w!supはsupremum(上限)の略
integer,allocatable,dimension(:)::w,v
integer(16),allocatable,dimension(:,:)::DP
read*,N,sup_w
allocate(w(n),v(n))
allocate(DP(0:N,0:10**3*N))
do i=1,n
  read*,w(i),v(i)
end do

DP(:,:)=huge(DP)/2
DP(0,0)=0
do i=1,N
  do j=0,10**3*N
    if(j-v(i)>=0) DP(i,j)=DP(i-1,j-v(i))+w(i)
    DP(i,j)=min(DP(i,j),DP(i-1,j))
  end do
end do

do i=10**3*N,0,-1
  if(DP(N,i)<=sup_w)then
    print"(I0)",i
    exit
  endif
end do
end program main

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

#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,n) for(int i=1;i<=(n);++i)
#define repr(i,n) for(int i=(n);i>=0;--i)
#define cinv(n,vec) VL (vec)(n);for(auto&v:vec)cin>>v;
#define int long long
#define itn int
#define pb push_back
#define m_p make_pair
#define m_t make_tuple
#define eb emplace_back
#define p_p(a,b) pb(m_p(a,b))
#define all(a) a.begin(),a.end()
#define SORT(a) sort(all(a))
#define RSORT(a) sort(all(a),greater<>())
#define UNIQUE(a) a.erase(unique(all(a)),a.end())
#define SZ(a) (ll)(a.size())
#define ENDL cout<<endl
#define debg(a) cout<<#a<<" "<<a<<endl;
#define debgp(a) cout<<#a<<" "<<a.fi<<" : "<<a.se<<endl
#define call(a) for(auto i:a)cout<<i<<" ";cout<<endl
#define show(a) for(cont &y:a){for(cont &x:y){cout<<x<<" ";}cout<<endl;}
#define out(a) cout<<(a)<<endl
#define cont const auto
#define fi first
#define se second
#define V vector
#define P pair
#define T tuple
#define VV(type,name,y,x,a) vector<vector<type>> name = vector<vector<type>>(y,vector<type>(x,a))
#define PQ priority_queue
typedef long long ll;
typedef double D;
typedef long double LD;
typedef string str;
typedef vector<ll> VL;
typedef pair<ll,ll> PL;
typedef vector<pair<ll,ll>> VP;
typedef tuple<ll,ll,ll> T3;
typedef tuple<ll,ll,ll,ll> T4;
const long long INF = 1LL<<60;
const long long MOD = 1e9+7;
void Yes(){cout<<"Yes"<<endl;}
void No(){cout<<"No"<<endl;}
void YN(bool b){cout<<(b?"Yes":"No")<<endl;}
template<class T>inline T gcd(T a,T b){if(b==0)return a; return(gcd(b,a%b));}
template<class T>inline T lcm(T a,T b){return a/gcd(a,b)*b;}
template<class T>inline bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>inline bool chmin(T &a,const T &b){if(a>b){a=b;return true;}return false;}

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

  int n,c,k;
  cin>>n>>c>>k;
  VL a(n);
  rep(i,n)cin>>a[i];
  SORT(a);
  int res=0;
  rep(i,n){
    int s=a[i];
    int now=1;
    while(now<c && i+1<n){
      if(a[i+1]<=s+k){
        now++;
        i++;
      }
      else break;
    }
    res++;
  }
  out(res);
  
  
  return 0;
}



Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <string.h>
#include <math.h>
using namespace std;

int main()
{
	string x; cin>>x;
	if(x[x.size()-1]=='s'){
		cout<<x+"es"<<endl;
	}
	else{
		cout<<x+"s"<<endl;
	}
    return 0;
}


Measured memory_bytes: 3576
#include<stdio.h>
#include<string.h>
int main(void){
    char S[100000];
    int i,j,N,cou0=0,cou1=0;
    scanf("%s",S);
    N=strlen(S);
    for(i=0;i<N;i++){
        if(S[i]=='0'){
            
            cou0++;
        
        }else if(S[i]=='1'){
            cou1++;
        }
    }
    if(cou0>cou1){
        printf("%d",N-(cou0-cou1));
    }else{
        printf("%d",N-(cou1-cou0));
    }
    return 0;
}

Measured memory_bytes: 256
#![allow(non_snake_case)]
#![allow(unused_imports)]
use proconio::input;
// use std::collections::HashMap;
// use std::collections::VecDeque;
use std::cmp::max;
// use std::cmp::min;


pub struct UnionFind {
    par: Vec<usize>,
    rank: Vec<usize>,
}

// https://github.com/akiradeveloper/rust-comp-snippets/blob/master/src/union_find.rs
impl UnionFind {
    pub fn new(n: usize) -> UnionFind {
        UnionFind {
            par: (0..n).collect::<Vec<usize>>(),
            rank: vec![1; n],
        }
    }

    pub fn size(&mut self, x: usize) -> usize {
        let y = self.root(x);
        self.rank[y]
    }

    pub fn same(&mut self, x: usize, y: usize) -> bool {
        self.root(x) == self.root(y)
    }

    pub fn root(&mut self, x: usize) -> usize {
        if self.par[x] == x {
            return x;
        } else {
            let y = self.par[x];
            let z = self.root(y);
            self.par[x] = z;
            return z;
        }
    }

    pub fn merge(&mut self, x: usize, y: usize) -> bool {
        let mut a = self.root(x);
        let mut b = self.root(y);
        if a == b {
            return false;
        }

        if self.rank[a] < self.rank[b] {
            std::mem::swap(&mut a, &mut b);
        }
        assert!(self.rank[a] >= self.rank[b]);

        self.rank[a] += self.rank[b];
        self.par[b] = a;
        return true;
    }
}


fn main() {
    input! {
        N: usize,
        M: usize,
        tmpABs: [(usize, usize); M],
    }

    if M == 0 {
        println!("1");
        return;
    }

    // 0-origin
    let mut ABs: Vec<(usize, usize)> = Vec::new();
    for &(a, b) in tmpABs.iter() {
        let tpl: (usize, usize) = (a - 1, b - 1);
        ABs.push(tpl);
    }

    let mut ans = 0;
    let mut uf = UnionFind::new(N);

    for &(a, b) in ABs.iter() {
        uf.merge(a, b);

        ans = max(ans, uf.size(a));
    }

    println!("{}", ans);
}


Measured memory_bytes: 13812
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

#a = 29
#b = 20
#c = 7
#d = 35
#e = 120

intlist = []

intlist.append(a)
intlist.append(b)
intlist.append(c)
intlist.append(d)
intlist.append(e)

flagMin = [0] * 5 

Min = 0
Min_tmp = 10
tmp = 0

#print(intlist)
#print(flagMin)

for i in range(len(intlist)):
	tmp = intlist[i] % 10
	if tmp != 0:
		if tmp < Min_tmp:
			Min_tmp = tmp
			Min = intlist[i]
#print(Min)
#print(Min_tmp)

for i in range(len(intlist)):
	if intlist[i] == Min:
		flagMin[i] = 1
		break

#print(flagMin)

timelist = []

for i in range(len(intlist)):
	if flagMin[i] == 1:
		continue
	orderT = int(intlist[i] / 10)
	if intlist[i]%10 != 0:
		orderT +=1
#	print("orderMinutes:" ,intlist[i])
#	print("orderT:", orderT)
	timelist.append(orderT)

result = sum(timelist) * 10 + Min

print(result)

Measured memory_bytes: 3064
n=int(input())
s=[int(c) for c in input()]
count=0
for p in range(10):
        if p in s[:n-2]:
            inp=s.index(p)
            for q in range(10):
                if q in s[inp+1:n-1]:
                    inq=s[inp+1:n-1].index(q)+inp+1
                    for r in range(10):
                        if r in s[inq+1:]:
                            count+=1
print(count)

Measured memory_bytes: 132380
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <string>
#include <cmath>
#include <vector>
#include <queue>
typedef long long ll;
using namespace std;

int main(void){
  int n,i,max,max2,k;
  int a;
  cin>>n;
  max=-1,max2=-2;
  for(i=0;i<n;i++){
    cin>>a;
    if(a>max){
      max=a;
      k=i+1;
    }
    else if(a>max2){
      max2=a;
    }
  }

  for(i=1;i<=n;i++){
    if(i!=k)cout<<max<<endl;
    else cout<<max2<<endl;
  }

	return 0;
}

Measured memory_bytes: 1664
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <iomanip>
#include <queue>
#include <deque>
#include <map>
#include <unordered_map>
#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define repr(e,x) for(auto& e:x)
using namespace std;
typedef long long ll;
typedef long double ld;

ll N,K;
ll A[200000];
ll sum[200001];
ll ans[200001];

int main(){
    cin>>N>>K;
    rep(i,N) cin>>A[i];

    rep(j,K){
        rep(i,N){
            sum[max((ll)0,i-A[i])]++;
            sum[min(i+A[i]+1,N)]--;
        }
        repn(i,N-1){
            sum[i]+=sum[i-1];
        }
        rep(i,N){
            A[i]=sum[i];
        }
        fill(sum,sum+N,0);
        bool flag=true;
        rep(i,N){
            flag&=(A[i]==N);
        }
        if(flag) break;
    }

    rep(i,N) cout<<A[i]<<' ';
    cout<<endl;
}

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

int main(){
   int k = 0;
   int a[5] ={0};
   
  for(int i =0;i < 5;i++){
      cin>>a[i];
  }
   cin>>k;
   int res = 0;
   
    for(int i =0;i < 5;i++){
        if(a[i+1] - a[0] > k ){
             res = 1;
         }
    }
    
  if(res==0){
      cout<<"Yay!";
  }else{
      cout<<":(";
  }
   
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        while (true) {
            int H = sc.nextInt();
            int W = sc.nextInt();
            if (H == 0 && W == 0) {
            break;
            }

            for(int i=0;i<H;i++){
                for(int j=0;j<W;j++){
                    System.out.print("#");
                }
                System.out.println();
            }
            System.out.println();
            }

        sc.close();
        }
}


Measured memory_bytes: 34912
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstdio>
#include <iomanip>
#include <cmath>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <stdlib.h>
#include <set>
typedef long long ll;
using namespace std;

int main() {
	int a,b,c;
	cin>>a>>b>>c;
	if(a+b>=c){
		cout<<b+c<<endl;
	}else{
		cout<<b+c - (c-(a+b+1))<<endl;
	}
	return 0;
}



Measured memory_bytes: 256
#include "iostream"
using namespace std;

int main()
{
	long long int a,b,c,k;
	cin >> a >> b >> c >> k;
	if (abs(a - b) > 1000000000000000000)
		cout << "Unfair" << endl;
	else if (k % 2 == 0)
		cout << a - b << endl;
	else cout << b - a << endl;
	return 0;
}



Measured memory_bytes: 256
K, S = gets.chomp.split.map(&:to_i)
ans = 0

(K + 1).times do |i|
  (K + 1).times do |j|
    z = S - i - j
    if z <= K && 0 <= z # 題意の条件式
      ans += 1
    end
  end
end

puts ans

Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
#define SIZE 86
int n;
long long *inp;
void init()
{
    inp=new long long[SIZE+1];
    int i;
    inp[0]=2;inp[1]=1;
    for (i=2;i<=SIZE;i++)
        inp[i]=inp[i-2]+inp[i-1];
}
void solve()
{
    cout<<inp[n]<<endl;
}
int main()
{
    init();
    while(cin>>n)
        solve();
}

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


using namespace std;

int main(int argc, char** argv) {
    int N;
    long long int a;
    vector<long long int> P(61, 0);

    cin >> N;
    for(int i = 0; i < N; i++) {
        cin >> a;
        for(int j = 0; j < 61; j++) {
            if(a % 2l == 1) {
                P[j] += 1;
                a = (long long int)((a - 1l) / 2l);
            }
            else {
                a = (long long int)(a / 2l);
            }

            if(a == 0) {
                break;
            }
        }
    }

    long long int mod = 1000000007ll;
    long long int total = 0;
    long long int base = 1;
    long long int t = 0;

    for(int i = 0; i < 61; i++) {
        t = P[i] * (N - P[i]);
        t %= mod;
        t = (t * base) % mod;
        total += t;
        total %= mod;
        base = base * 2;
        base %=mod;
    }

    cout << total << endl;
}


Measured memory_bytes: 256
import math

A, B = map(int, input().split())
Am = math.ceil(A * 12.5)
AM = math.ceil((A+1) * 12.5)
Bm = B * 10
BM = (B+1) * 10

if AM <= Bm or BM <= Am:
  print(-1)
elif Am <= Bm:
  print(Bm)
else:
  print(Am)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int a[200009];
/*
 * state: index
 * base case: n = 0
 * Transition: either jump 1 step or jump 2 steps
 * cost: next index - current index
 */
int dp[100005 + 7];
int solve(int i,int n){
    if(i==n-1)
        return 0;
    if(dp[i]!= -1)
        return dp[i];
    return  dp[i] = min(abs(a[i+1]-a[i]) + solve(i+1,n),(i!= n-2? abs(a[i+2]-a[i]) : INT_MAX) + solve(i+2,n));
}
int main() {
    int n;
    scanf("%d",&n);
    for(int i = 0;i<n;++i){
        scanf("%d",a+i);
    }
    memset(dp,-1,sizeof dp);
    printf("%d",solve(0,n));
}

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

using ll = long long;
using Pii = std::pair<int, int>;
using Pll = std::pair<ll, ll>;

const ll INF = (ll)1e11;

using namespace std;

int main() {
    ios::sync_with_stdio(false);

    int N;
    cin >> N;

    struct T {
        int no;
        string s;
        int p;
        T(int no_, string s_, int p_) : no(no_), s(s_), p(p_) {}
    };
    auto cmp = [](const T& l, const T& r) { return l.s < r.s || l.s == r.s && l.p > r.p; };
    set<T, decltype(cmp)> S(cmp);

    string s;
    int p;
    for (int i = 0; i < N; ++i) {
        cin >> s >> p;
        S.emplace(i+1, s, p);
    }

    for (auto x : S) {
        cout << x.no << endl;
    }

    return 0;
}


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

using ll = long long;
using namespace std;

const int MAX = 1e5 + 1;
array<ll, MAX> dp1, dp2;

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

#ifdef LOCAL_DEFINE
	freopen("in.txt", "r", stdin);
#endif

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

	for (int i = 0; i < n; ++i)
	{
		int weight, value;
		cin >> weight >> value;

		for (int j = 0; j <= w - weight; ++j)
		{
			dp1[j + weight] = max(dp1[j + weight], dp2[j] + value);
		}
		dp2 = dp1;
	}

	cout << dp1[w] << '\n';

	return 0;
}

Measured memory_bytes: 1920
import java.util.*;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        if(n == m){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
}

Measured memory_bytes: 23892
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <random>
#include <iomanip>
#include <unordered_set>
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<pair<ll,ll> > vpll;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<vc> vvc;
typedef vector<vs> vvs;
typedef vector<vll> vvll;
typedef map<int,int> mii;
typedef set<int> si;
#define rep(i,n) for(ll i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define arep(i,v) for(auto i : v)
#define irep(it, stl) for(auto it = stl.begin(); it != stl.end(); it++)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define STLL(s) strtoll(s.c_str(), NULL, 10)
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define fi first
#define se second
constexpr int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
constexpr int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
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> inline void dump(T &v){irep(i, v){cout<<*i<<((i==--v.end())?'\n':' ');}}
inline string getline(){string s; getline(cin,s); return s;}
inline void yn(const bool b){b?fin("yes"):fin("no");}
inline void Yn(const bool b){b?fin("Yes"):fin("No");}
inline void YN(const bool b){b?fin("YES"):fin("NO");}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const int INF = INT_MAX;
constexpr ll LLINF = 1LL<<60;
constexpr ll MOD = 1000000007;
constexpr ld EPS = 1e-11;

constexpr int N=10000001;
vector<int> num(N, 1);

int main() {

    int n;
    cin>>n;
    ll sum;
    ll ans=0;
    for(int i=2;i<N;i++){
        for(int j=i;j<N;j+=i){
            num[j]++;
        }
    }
    for(ll i=1;i<=n;i++){
        ans+=num[i]*i;
    }
    fin(ans);

}



Measured memory_bytes: 42048
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MAX 5 * 10000 + 1
#define INF 10000000000

int n;
vector<vector<ll>> dp(100010, vector<ll>(3, -1));  // dp[i][j] is the maximum happiness possible by ending at day i, taking option j in day i.
                                    // j is a number from 0..2, where 0 means we did activity a, 1 activity b, so on...

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

Measured memory_bytes: 8064
#include <iostream>

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

using namespace std;

int main(){
	int n;
	int a[102];
	cin >> n;
	REP(i,n) cin >> a[i];
	
	int po;
	
	REP(k,n){
		REP(i,n-1){
			if (a[i]<a[i+1]){
				po = a[i];
				a[i] = a[i+1];
				a[i+1] = po;
			}
		}
	}
	
	int ans[2];
	ans[0] = 0;
	ans[1] = 0;
	
	REP(i,n){
		ans[i%2] += a[i];
	}
	
	cout << ans[0]-ans[1] << endl;
}


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

int main(){
  string s;
  cin>>s;
  
  if(s=="A"){
    cout<<"T"<<endl;
    return 0;
  }
  else if(s=="T"){
    cout<<"A"<<endl;
    return 0;
  }
  else if(s=="G"){
    cout<<"C"<<endl;
    return 0;
  }
  else if(s=="C"){
    cout<<"G"<<endl;
    return 0;
  }
  
  return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <array>
#include <cmath>
#include <deque>
#include <iostream>
#include <set>
#include <string>
#include <unordered_map>

using namespace std;

int main() {
  int n;
  deque<int> numbers;
  deque<int> sums;

  cin >> n;

  for (int i = 1; i < n; i++) {
    int tmp;
    cin >> tmp;
    numbers.push_back(tmp);
    sums.push_back(0);
  }

  for (int i = 0; i < n - 1; i++) {
    sums[numbers[i] - 1]++;
  }

  for (int i = 0; i < n; i++) {
    cout << sums[i] << endl;
  }

  return 0;
}

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

using namespace std;

int main(){
	string S;
	cin >> S;
	
	int length = 0, ans = 0;
	
	for(int i = 0; i < S.size(); i++){
		if(S.at(i) == 'A' || S.at(i) == 'C' || S.at(i) == 'G' || S.at(i) == 'T'){
			length += 1;
		}else{
			length = 0;
		}
		if(length > ans){
			ans = length;
		}
	}
	
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 256
import collections
n = int(input())
v = list(map(int, input().split()))
v1 = v[::2]
v2 = v[1::2]
c1 = collections.Counter(v1).most_common()
c2 = collections.Counter(v2).most_common()

if c1[0][0] != c2[0][0]:
  print(n - c1[0][1] - c2[0][1])
else:
  if len(c1) == len(c2) == 1:
    print(n // 2)
  elif len(c1) == 1:
    print(len(v2)-c2[1][1])
  elif len(c2) == 1:
    print(len(v1)-c1[1][1])
  else:
    print(min(n-c1[0][1]-c2[1][1], n-c1[1][1]-c2[0][1]))

Measured memory_bytes: 21084
#include "bits/stdc++.h"

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

using namespace std;
const long long INF = 1LL << 61;

int main() {
	int A, B; cin >> A >> B;
	int ans = (B - 1) / (A - 1);
	if ((B - 1) % (A - 1) == 0)cout << ans;
	else cout << ans + 1;
}

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

string s, t;

int main()
{
    cin>>s>>t;
    for(int i = 0;i<s.length();i++){
        if(s[i] != t[i]){
            cout<<"No"<<endl;
            return 0;
        }
    }
    cout<<"Yes"<<endl;

    return 0;
}


Measured memory_bytes: 3612
#include <atcoder/all>
#include <bits/stdc++.h>
#define FOR(i, a, n) for(ll i = (ll)a; i < (ll)n; i++)
#define FORR(i, n) for(ll i = (ll)n - 1LL; i >= 0LL; i--)
#define rep(i, n) FOR(i, 0, n)
#define ALL(x) begin(x), end(x)
using namespace std;
using ll = long long;
constexpr ll Mod = 998244353;
constexpr ll mod = 1e9 + 7;
constexpr ll inf = 1LL << 60;
const double PI = acos(-1);
template <typename T1, typename T2> inline bool chmax(T1 &a, T2 b) {
    return a < b && (a = b, true);
}
template <typename T1, typename T2> inline bool chmin(T1 &a, T2 b) {
    return a > b && (a = b, true);
}
/*-------------------------------------------*/

int op(int a, int b) { return max(a, b); }
int e() { return 0; }

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

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

    atcoder::segtree<int, op, e> seg(300001);
    rep(i, n) {
        int a;
        cin >> a;
        int l = max(a - k, 0);
        int r = min(a + k, 300000) + 1;
        seg.set(a, seg.prod(l, r) + 1);
    }

    cout << seg.all_prod() << endl;

    return 0;
}

Measured memory_bytes: 8496
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <math.h>
using namespace std;

double c[11]={91,81,75,69,64,60,57,54,51,48,0};
string s[11]={"light fly","fly","bantam","feather","light","light welter","welter","light middle","middle","light heavy","heavy"};

int main(){
	double w;
	while(scanf("%lf",&w)!=EOF){
		for(int i=0;i<11;i++){
			if(w>c[i]){cout<<s[10-i]<<endl;break;}
		}
	}
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
#define SORT(a) sort((a).begin(), (a).end())
#define RSORT(a) reverse((a).begin(), (a).end())
#define rep(i, n) for (int i = 0; i < n; i++)
#define all(a) ((a).begin(), (a).end())
typedef long long ll;
// const long long INF = 1LL << 60;
const int INF = 1010101010;
// using Graph = vector<vector<int>>;
const int MOD = 1000000007;

int main() {
  ll x;
  cin >> x;
  ll gohyaku = x / 500;
  ll go = (x - gohyaku * 500) / 5;
  cout << gohyaku * 1000 + go * 5 << endl;
}

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

int main()
{
  int n;
  cin>>n;
  int a[n];
  for(int i=0; i<n; i++)cin>>a[i];
  int p=100000;
  for(int j=0; j<n; j++){
    if(a[j]<p)p=a[j];
  }
  int q=0;
  for(int e=0; e<n; e++){
    if(a[e]>q)q=a[e];
  }
  cout<<q-p<<endl;
}

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

using namespace std;
#define ll long long
#define pb push_back
#define vi vector<int>
#define vll vector<long long>
#define inf 1000000100

int main()
{
    int n, m;
    cin >> n >> m;
    vi city(n+1);
    while(m--)
    {
        int a, b;
        cin >> a >> b;
        city[a]++, city[b]++;
    }

    for(int i = 1; i <= n; i++)
    {
        cout << city[i] << endl;
    }
}


Measured memory_bytes: 764
#include<bits/stdc++.h>
#include<unordered_map>
/*
*▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
*    ▀▀       ▀▀▀▀▀▀    ▀     ▀▀▀▀▀▀      ▀    ▀
*   ▀  ▀      ▀         ▀     ▀            ▀  ▀
*  ▀    ▀     ▀ ▀ ▀     ▀     ▀ ▀ ▀         ▀
* ▀ ▀▀▀▀ ▀    ▀         ▀     ▀             ▀
*▀        ▀   ▀         ▀     ▀             ▀
*▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
*/
using namespace std;
void afify()
{
    ios::sync_with_stdio(0);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}
#define ll long long
#define ld long double
#define mk make_pair
#define loop(i,intial,n)  for(int i=int(intial);i<n;i++)
#define loopn(j,n) for(int j=int(n);j>=0;j--)
#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c))
#define all(v) v.begin(),v.end()
///////////////////////////////////////
#define SCD(a) scanf("%d",&a)
#define SCD2(a,b) scanf("%d %d",&a,&b)
#define SCLL(a) scanf("%lld",&a)
#define SCLL2(a,b) scanf("%lld %lld",&a,&b)
#define PRD(a) printf("%d\n",a)
#define PRLL(a) printf("%lld\n",a)
///////////////////////////////////////
typedef vector <int> vi;
typedef vector <ll> vll;
typedef vector <vi> vvi;
typedef vector <vll> vvll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vpll> vvpll;
typedef vector<vpii> vvpii;
typedef stringstream ss;
const ll oo = (ll) 10e9+7;
const double EPS = 1e-4;
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
//ifstream ifs("input.txt");
//ofstream ofs("output.txt");

int main()
{
    afify(); 
	string s;
	cin>>s;
	set<char> st;
	loop(i,0,s.length()) st.insert(s[i]);
	if(st.size()==s.length()){
		cout<<"yes"<<endl;
	}
	else cout<<"no"<<endl;

	return 0; 
 
} 

Measured memory_bytes: 256
#include<cstdio>

const int N_MAX = 100000;
int p_rev[N_MAX];
int par[N_MAX];
int rank[N_MAX];

void init(int n) {
	for(int i=0;i<n;i++) {
		par[i] = i;
		rank[i] = 0;
	}
}

int find(int x) {
	if(par[x] == x) {
		return x;
	} else {
		return par[x] = find(par[x]);
	}
}

void unite(int x, int y) {
	x = find(x);
	y = find(y);
	if(rank[x] < rank[y]) {
		par[x] = y;
	} else {
		par[y] = x;
		if(rank[x] == rank[y]) rank[x]++;
	}
}

int main() {
	int n, m;
	scanf("%d %d", &n, &m);
	init(n);
	for(int i=0;i<n;i++) {
		int p;
		scanf("%d", &p);
		p_rev[p-1] = i;
	}
	for(int i=0;i<m;i++) {
		int x, y;
		scanf("%d %d", &x, &y);
		unite(x-1, y-1);
	}
	int count = 0;
	for(int i=0;i<n;i++) {
		if(find(i) == find(p_rev[i])) count++;
	}
	printf("%d\n", count);
	return 0;
}


Measured memory_bytes: 1280
N = int(input())
H = list(map(int,input().split()))
ind = 0
cnt = 0
for i in range(1,N):
    d = H[i]-H[i-1]
    if d<=0:
        cnt += d
    else:
        cnt = 0
    if cnt<=-2:
        ind = 1
        break
if ind==0:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 14396
#include "bits/stdc++.h"

using namespace std;
#ifdef _DEBUG
#define _GLIBCXX_DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

#define int long long
#define ll long long
#define DBG 1
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define loop(n) rep(loop, (0), (n))
#define all(c) begin(c), end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
using pii = pair<int, int>;
// template<class T> ostream &operator<<(ostream &os,T &t){dump(t);return os;}
template <typename T, typename S>istream &operator>>(istream &is, pair<T, S> &p) { is >> p.first >> p.second; return is; }
//template <typename T, typename S>ostream &operator<<(ostream &os, pair<T, S> &p) {os << p.first << " " << p.second;return os;}

template <typename T> void printvv(const vector<vector<T>> &v) {
	cerr << endl;
	rep(i, 0, v.size()) rep(j, 0, v[i].size()) {
		if (typeid(v[i][j]).name() == typeid(INF).name() and v[i][j] == INF) {
			cerr << "INF";
		}
		else
			cerr << v[i][j];
		cerr << (j == v[i].size() - 1 ? '\n' : ' ');
	}
	cerr << endl;
}

#ifndef _DEBUG
#define printvv(...)
#endif
void YES(bool f) { cout << (f ? "YES" : "NO") << endl; }
void Yes(bool f) { cout << (f ? "Yes" : "No") << endl; }
template <class T, class U>bool chmin(T& a, U b) { if (a > b) { a = b; return true; }return false; }
template <class T, class U>bool chmax(T& a, U b) { if (a < b) { a = b; return true; }return false; }

signed main(signed argc, char *argv[]) {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(12);

	int N; cin >> N;
	rep(i, 0, N + 1) {
		if (((108 * i) / 100) == N) {
			cout << i << endl;
			return 0;
		}
	}
	cout << ":(" << endl;

	return 0;
}


Measured memory_bytes: 256
M = 0
D = int(input())
*c, = map(int, input().split())
S = []
for _ in [None] * D:
    *s, = map(int, input().split())
    S += s,
last = [-1] * 26
for d in range(D):
    t = int(input())
    M += S[d][t - 1]
    last[t - 1] = d
    M -= sum((d - last[i]) * c[i] for i in range(26))
    print(M)

Measured memory_bytes: 9396
#include <iostream>
#include <algorithm>
#include <complex>
#include <utility>
#include <vector>
#include <string>
#include <queue>
#include <tuple>
#include <cmath>
#include <bitset>
#include <cctype>
#include <set>
#include <map>
#include <numeric>
#include <functional>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
using namespace std;
using ll = long long;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
inline void Yes(bool condition){ if(condition) PRINT("Yes"); else PRINT("No"); }
template<class itr> void cins(itr first,itr last){
    for (auto i = first;i != last;i++){
        cin >> (*i);
    }
}
template<class itr> void array_output(itr start,itr goal){
    string ans = "",k = " ";
    for (auto i = start;i != goal;i++) ans += to_string(*i)+k;
    if (!ans.empty()) ans.pop_back();
    PRINT(ans);
}
ll gcd(ll a, ll b) {
    return a ? gcd(b%a,a) : b;
}
const ll INF = 1e18;
const ll MOD = 1000000007;
typedef pair<ll,ll> P;
const ll MAX = 100005;
constexpr ll nx[8] = {1,0,-1,0,-1,-1,1,1};
constexpr ll ny[8] = {0,1,0,-1,-1,1,-1,1};
vector<vector<ll>> g(200005);
vector<ll> cnt(200005,0);
vector<bool> done(200005,0);
void dfs(ll v){
    done[v] = 1;
    for (ll u:g[v]){
        if (done[u]) continue;
        cnt[u] += cnt[v];
        dfs(u);
    }
}
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll a,b,q,c,d;
    cin >> a >> b >> q;
    vector<ll> s,t;
    s.push_back(-INF);
    t.push_back(-INF);
    rep(i,a){
        cin >> c;
        s.push_back(c);
    }
    rep(i,b){
        cin >> c;
        t.push_back(c);
    }
    s.push_back(INF);
    t.push_back(INF);
    ll x;
    rep(i,q){
        cin >> x;
        ll si = lower_bound(all(s),x)-s.begin();
        ll ti = lower_bound(all(t),x)-t.begin();
        PRINT(min({max(s[si]-x,t[ti]-x),max(x-s[si-1],x-t[ti-1]),2*min(s[si]-x,x-t[ti-1])+max(s[si]-x,x-t[ti-1]),2*min(x-s[si-1],t[ti]-x)+max(x-s[si-1],t[ti]-x)}));
    }
}




Measured memory_bytes: 9332
S = input()

judge = True

if S[0] != "A":
    judge = False


count = 0
for i in range(2, len(S) - 1):
    if S[i] == "C":
        count += 1

if count != 1:
    judge = False

s = S.replace("A", "", 1)
s = s.replace("C", "", 1)

if not s.islower():
    judge = False

if judge:
    print("AC")
else:
    print("WA")

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

#define fio                         \
  ios_base::sync_with_stdio(false); \
  cin.tie(NULL);                    \
  cout.tie(NULL);
#define ll long long
#define ull unsigned long long
#define ld long double
#define endl "\n"
#define ff first
#define ss second
#define pi pair<ll, ll>
#define PI 3.141592653589793238462643383279502884L
#define mp make_pair
#define pb push_back
#define fall(i, a, b) for (int i = a; i < b; i++)
#define sz(x) (ll) x.size()
#define all(x) x.begin(), x.end()
#define ed cout << "ed";
#define time_passed 1.0 * clock() / CLOCKS_PER_SEC
ll MOD = 1e9 + 7;
ll MOD1 = 1e9 + 123;
ll MOD2 = 1e9 + 321;

int main()
{
    fio;
    ll t, a, n, q, k, i, l, m, c, u, f, j, p, r, x, y, s, b, d;
    cin>>k>>s;c=0;
    for(i=0;i<=k;i++)
    for(j=0;j<=k;j++)
    if(s-i-j>=0 && s-i-j<=k)c++;
    cout<<c<<endl;
    
    return 0;
}


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

using namespace std;

#define rep(i,n) for(int i=0;i<(n);i++)
#define repa(i,a,n) for(int i=(a);i<(n);i++)
#define rrep(i,n) for(int i=n;i>=0;i--)
#define rrepa(i,a,n) for(int i=n;i>=(a);i--)
#define all(a) (a).begin(),(a).end()
#define MOD 1000000007
#define maxs(a,b) a=max(a,b)
#define mins(a,b) a=min(a,b)
#define vc vector

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<int,int> pi;

int ctoi(char c){
    switch (c){
        case 'A':return 0;
        case 'B':return 1;
        case 'C':return 2;
        case 'D':return 3;
        case 'E':return 4;
        case 'F':return 5;
        case 'G':return 6;
        case 'H':return 7;
        case 'I':return 8;
        case 'J':return 9;
        case 'K':return 10;
        case 'L':return 11;
        case 'M':return 12;
        case 'N':return 13;
        case 'O':return 14;
        case 'P':return 15;
        case 'Q':return 16;
        case 'R':return 17;
        case 'S':return 18;
        case 'T':return 19;
        case 'U':return 20;
        case 'V':return 21;
        case 'W':return 22;
        case 'X':return 23;
        case 'Y':return 24;
        case 'Z':return 25;
        default:return -1;
    }
}

int main(){
   
    int n;
    string s;
    cin>>n>>s;
    string alf="ABCDEFGHIJKLMNOPQRSTUVWXYZ";

    string ans=s;
    rep(i,s.length()){
        ans[i]=alf[(n+ctoi(s[i]))%26];
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
int n, a[200010], ma[200010], mi[200010], ans = -1145141919;
int main(){
	cin >> n;
	rep(i, n)cin >> a[i];
	rep(i, n) {
		if (i == 0)mi[i] = a[i];
		else mi[i] = min(mi[i - 1], a[i]);
	}
	for (int i = n - 1; i >= 0; i--) {
		if (i == n - 1)ma[i] = a[i];
		else ma[i] = max(ma[i + 1], a[i]);
	}
	rep(i, n - 1)ans = max(ma[i + 1] - mi[i], ans);
	cout << ans << endl;
	return 0;
}


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

using namespace std;

#define fi first
#define se second
#define mp make_pair
#define pb push_back

int main() {
	int n, m;
	cin >> n >> m;
	for (int i = 0; i < n; i ++)
		for (int j = 0; j < m; j++) {
			string s; cin >> s;
			if (s == "snuke") {
				putchar('A'+j);
				printf("%d\n", i+1);
			}
		}
	return 0;
}

Measured memory_bytes: 764
program sample
    implicit none
    
    integer(8) :: a,b,c,i,j,m,n,k,a1,b1,c1
    integer(8), allocatable  ::x(:) 

    read(*,*) n
  
    allocate(x(n))
    read(*,*) x
    call msort(x)
    m=0
    if (mod(n,2)==0)then
        do i=1,n/2
            m=m+x(2*i)-x(2*i-1)
        end do
    else
        m=x(1)
        do i=1,n/2
            M=m+x(2*i+1)-x(2*i)
        end do
end if
    write(*,*)m

    deallocate(x)
    stop

    contains

    recursive subroutine msort(x)
    implicit none
    integer(8), intent(inout) :: x(:)
 
    integer(8) :: n, mid, i, j, k
    integer(8), allocatable :: tmp(:)
    
    n = size(x)
    
    if(n == 1) then
      return
    end if
 
    !
    ! 前半と後半に分けてソート
    ! 1~midとmid+1~nをそれぞれソート済みにする
    !
    mid = n / 2
    call msort(x(:mid))
    call msort(x(mid+1:))
 
    !
    ! tmpという配列にxを一時的に保管
    ! マージソートは外部ソート
    !
    allocate(tmp(n))
    tmp = x
 
    ! tmpの後半部分を左右反転
    do k = n, mid+1, -1
      tmp(k) = x(mid + n - k + 1)
    end do
 
    ! iは前半のリストのうちまだ見ていないものの最小値
    ! jは後半のリストのうちまだ見ていないものの最小値
    ! kは見た回数の合計
    i = 1
    j = n
 
    do k = 1, n
      !
      ! 一番左と一番右のうち小さい方をxに入れていく
      ! ここが等号つき不等号なので、安定ソートとなる
      !
      if(tmp(i) <= tmp(j)) then
        x(k) = tmp(i)
        i = i + 1
      else
        x(k) = tmp(j)
        j = j - 1
      end if
    end do
    
    deallocate(tmp)
    return
  end subroutine msort
end program sample
  



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define _ ios_base::sync_with_stdio(0);cin.tie(0);
#define REP(i,n) for(int i=0;i<(int)(n);i++)

using namespace std;
using ull = unsigned long long;

int n;
ull k;
ull a[100010];
int bitcount(ull filter){
  int result=0;
  for(int i=0;i<n;i++){
    result+=(a[i]&filter)?1:0;
  }
  return result;
}
int bitcounts[64];

int main(){ _;
  cin>>n>>k;
  REP(i,n)cin>>a[i];
  REP(i,64)bitcounts[i]=bitcount(1ULL<<i);
  int kbit=63;
  while((1ULL<<kbit)>k&&kbit>1){
    kbit--;
  }
  //cout<<kbit<<" "<<k<<endl;
  ull f1=0ULL;
  bool any=false;
  for(int i=63;i>=0;i--){
    //    cout<<"["<<i<<"]"<<bitcounts[i]<<endl;
    if(i>kbit){
      f1+=bitcounts[i]*(1ULL<<i);
    }else if(any){
      f1+=max(bitcounts[i],n-bitcounts[i])*(1ULL<<i);
    }else if(k&(1ULL<<i)){
      if(bitcounts[i]<n-bitcounts[i]){
	f1+=(n-bitcounts[i])*(1ULL<<i);
      }else{
	f1+=bitcounts[i]*(1ULL<<i);
	any=true;
      }
    }else{
      f1+=bitcounts[i]*(1ULL<<i);
    }
    //    cout<<f1<<" "<<(any?"any":"")<<endl;
  }
  cout<<f1<<endl;
}


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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,a,b) for(int i=(a);i<(b);i++)
#define pb push_back
#define eb emplace_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second

using vint=vector<int>;
using pint=pair<int,int>;
using vpint=vector<pint>;

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

template<class A,class B>
ostream& operator<<(ostream& ost,const pair<A,B>&p){
	ost<<"{"<<p.first<<","<<p.second<<"}";
	return ost;
}

template<class T>
ostream& operator<<(ostream& ost,const vector<T>&v){
	ost<<"{";
	for(int i=0;i<v.size();i++){
		if(i)ost<<",";
		ost<<v[i];
	}
	ost<<"}";
	return ost;
}

template<uint32_t mod>
struct ModInt{
	uint32_t a;
	ModInt& s(uint32_t vv){
		a=vv<mod?vv:vv-mod;
		return *this;
	}

	ModInt(int64_t x=0){s(x%mod+mod);}

	ModInt& operator+=(const ModInt &x){return s(a+x.a);}
	ModInt& operator-=(const ModInt &x){return s(a+mod-x.a);}
	ModInt& operator*=(const ModInt &x){
		a=uint64_t(a)*x.a%mod;
		return *this;
	}
	ModInt& operator/=(const ModInt &x){
		*this*=x.inv();
		return *this;
	}

	ModInt operator+(const ModInt &x)const{return ModInt(*this)+=x;}
	ModInt operator-(const ModInt &x)const{return ModInt(*this)-=x;}
	ModInt operator*(const ModInt &x)const{return ModInt(*this)*=x;}
	ModInt operator/(const ModInt &x)const{return ModInt(*this)/=x;}
	bool operator==(const ModInt &x)const{return a==x.a;}
	bool operator!=(const ModInt &x)const{return a!=x.a;}
	bool operator<(const ModInt &x)const{return a<x.a;}

	ModInt operator-()const{return ModInt()-*this;}
	ModInt pow(int64_t n)const{
		ModInt res(1),x(*this);
		while(n){
			if(n&1)res*=x;
			x*=x;
			n>>=1;
		}
		return res;
	}

	ModInt inv()const{return pow(mod-2);}
};

template<uint32_t mod>
istream& operator>>(istream& in,ModInt<mod>& a){
	return (in>>a.a);
}
template<uint32_t mod>
ostream& operator<<(ostream& out,const ModInt<mod>& a){
	return (out<<a.a);
}
using mint=ModInt<1000000007>;

int N;
int A[555555];
int X[555555];



vint pos[1<<20];


mint solve(vint lis){
	int n=lis.size();
	vint num(n);
	rep(i,n)num[i]=lower_bound(all(pos[0]),lis[i])-pos[0].begin();

	mint ans=0;

	mint a=0,b=0;
	for(int i=0;i<n;i++){
		mint way=1;
		way+=a*num[i]+b;
		ans+=way;
		a+=way;
		b-=way*num[i];
	}
	return ans;
}
signed main(){
	scanf("%lld",&N);
	rep(i,N)scanf("%lld",&A[i]);
	rep(i,N)X[i+1]=X[i]^A[i];


	if(X[N]){
		mint z=0,x=0;
		for(int i=1;i<=N;i++){
			if(X[i]==0){
				z+=x;
			}
			else if(X[i]==X[N]){
				x+=z+1;
			}
		}
		cout<<z+1<<endl;
		return 0;
	}

	mint ans=0;
	rep(i,N+1)pos[X[i]].pb(i);
	for(int i=1;i<1<<20;i++)if(pos[i].size())ans+=solve(pos[i]);
	
	ans+=mint(2).pow(pos[0].size()-2);
	cout<<ans<<endl;
	return 0;
}

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

int main() {
	int n;
	cin>>n;
	vector<int>v(n+1);int counter=0;
	for(int i=1;i<=n;i++)
	{
		cin>>v[i];
	}
	for(int i=1;i<=n;i++)
	{
		if(v[i]&1 && i&1)
		{
			counter++;
		}
	}
	cout<<counter<<endl;
	return 0;
}

Measured memory_bytes: 3588
import java.util.Scanner;

class Main {
  public static void main(String[] args) {
    Scanner stdInt = new Scanner(System.in);

  int[] a = new int[10000];
  int i = 0;
    while (true) {
      int x;
      x = stdInt.nextInt();
      if (x == 0) break;
      a[i++] = x;
    }

    for (int j = 0; j < i; j++) {
      System.out.println("Case " + (j+1) + ": " + a[j]);
    }
  }
}


Measured memory_bytes: 43448
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define irep(i, n) for (int i = (n); i >= 0; i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = 1 << 30;
 
int main() {
  int n, m;
  cin >> n >> m;
  vector<pair<ll,ll>> students(n);
  rep(i,n) {
    ll a,b; cin >> a >> b;
    students[i] = make_pair(a,b);
  }
  vector<pair<ll,ll>> point(m);
  rep(i,m) {
    ll a, b; cin >> a >> b;
    point[i] = make_pair(a,b);
  }
  int ans[100];
  rep(i,n) {
    ll dist = 1e10;
    rep(j,m) {
      ll now = abs(students[i].first-point[j].first) + abs(students[i].second-point[j].second);
      if (now < dist) {
        dist = now;
        ans[i] = j + 1;
      }
    }
  }
  rep(i,n) cout << ans[i] << endl;
  return 0;
}

Measured memory_bytes: 3640