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

public class Main {
	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		LinkedList<Integer> ll = new LinkedList<>();
		
		int H = 999;
		int W = 999;
		
		int cnt = 0;
		
		//?????????????´?
		while(H != 0 || W != 0) {
			H = sc.nextInt();
			W = sc.nextInt();
			if(H == 0 && W == 0) {
				break;
			} else {
				ll.add(H);
				ll.add(W);
				cnt+=2;
			}
		}
		
		int k = 0;
		while(k < cnt) {
			int j = 0;
			while(j < ll.get(k)) {
				int i = 0;
				while(i < ll.get(k+1)) {
					if(j % 2 == 0 && i % 2 == 0
					|| j % 2 != 0 && i % 2 != 0) {
						System.out.print("#");
					} else if(j % 2 == 0 && i % 2 != 0
						   || j % 2 != 0 && i % 2 == 0) {
						System.out.print(".");
					}
					i++;
				}
				System.out.println();
				j++;
			}
			System.out.println();
			k+=2;
		}
		
	}
}

Measured memory_bytes: 35756
#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<deque>
#include<regex>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>

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

typedef int long long ll;
using namespace std;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
const ll MOD = 1e9 + 7;
ll dp[111][111][5555];
int main() {
    int n,a;
    cin>>n>>a;
    vector<int> x(n);
    rep(i,n){
        cin>>x[i];
    }
    dp[0][0][0]=1;
//    for(int i=0;i<n;i++){
//        for(int j=0;j<n;j++){
//         for(int k=0;k<=5000;k++){
//             dp[i+1][j][k]+=dp[i][j][k];
//             if(k>=x[i]){
//                 dp[i+1][j+1][k]+=dp[i][j][k-x[i]];
//             }
//         }
//        }
//    }
sort(x.begin(),x.end());
ll c=max(x[n-1],a);


    for(int i=0;i<n;i++){
        for(int j=0;j<i+1;j++){
            for(int k=0;k<=(j+1)*a;k++){
                dp[i+1][j][k]+=dp[i][j][k];
                if(k>=x[i]){
                    dp[i+1][j+1][k]+=dp[i][j][k-x[i]];
                }
            }
        }
    }




    ll ans=0;
    for(int i=1;i<=n;i++){
        ans+=dp[n][i][i*a];
    }
    cout<<ans<<endl;




    return 0;
}


Measured memory_bytes: 155904
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define yesno(flg) if(flg){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define MAX_N 1002
#define i197 1000000007

using namespace std;

typedef long long ll;
typedef pair<ll,ll> P1;
typedef pair<int,int> Pi;
typedef pair<double,Pi> Pdi;
typedef pair<ll,int>Pli;
typedef pair<P1,ll> P2;
const ll INF=1000000000000000001;
struct edge{int to,cost;};
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
struct Road{double cost;int a,b;};


int main() {

	ll a,b;
	cin>>a>>b;

	if(a>0)cout<<"Positive"<<endl;
	else if(a<=0&&b>=0)cout<<"Zero"<<endl;
	else if((b-a)%2==1)cout<<"Positive"<<endl;
	else cout<<"Negative"<<endl;

	return 0;

}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<map>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<string>
#include<algorithm>
#include<stack>
#include<queue>
#include<set>
#include<bitset>
#include<iomanip>
#define BUG puts("no bug")
#define sci(x) scanf("%d",&x)
#define scl(x) scanf("%lld",&x)
#define ll long long
#define ull unsigned long long
#define REP(a,b,c) for(int a=b;a<=c;a++)
#define PER(a,b,c) for(int a=b;a>=c;a--)
#define lb(a) (a&(-a))
#define pp (p<<1)
#define ppp (p<<1|1)
#define pi pair<int,int>
#define pii pair<pair<int,int>,int>
using namespace std;
const int MAXN=1e6+5;
int n,m,t;
int v[MAXN];
char s[MAXN];
int main(){
    cin>>s+1;
    n=strlen(s+1);
    int flag=1;
    REP(i,1,n/2){
        if(s[i]!=s[n-i+1])flag=0;
    }
    REP(i,1,n/2){
        if(s[i]!=s[n/2-i+1])flag=0;
    }
    int cnt=0;
    REP(i,(n+3)/2,n){
        cnt++;
        if(s[i]!=s[n-cnt+1])flag=0;
    }
    if(flag)cout<<"Yes";
    else cout<<"No";
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string>
#include<utility>
#include<iostream>
#include<queue>
#include<math.h>
#include<algorithm>
#include<vector>
#include<map>
#include<stack>
#include<bitset>
#include<cmath>

using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0;i<(int)(n);i++)

int main(){
    int n;
    scanf("%d",&n);
    ll rui[200005]={};
    REP(i,n+2){
        if(i==0)rui[0]=0;
        else{
            rui[i]=rui[i-1];
            int one = i%10;
            int last = i;
            int keta = 1;
            while(last>=10){
                last=last/10;
                keta++;
            }
            //printf("%d %d %d\n",last,one,keta);
            if(one<last && keta>=2 && one!=0){
                REP(j,keta-1)rui[i]+=(ll)std::pow(10,j)*2;
            }
            else if(one>last && keta>=3 &&one!=0){
                REP(j,keta-2)rui[i]+=(ll)std::pow(10,j)*2;
            }
            else if(one==last && keta==1)rui[i]+=1;
            else if(one==last && keta==2)rui[i]+=3;
            else if(one==last && keta>2 && one!=0){
                int x = ((i - (ll)std::pow(10, keta-1)*last)/10+1)*2+1;
                rui[i]+=x;
                //printf("%d$$$\n",x);
                REP(j,keta-2)rui[i]+=(int)std::pow(10,j)*2;
            }
            //printf("###[%d %d %d]%d %lld %lld\n",one,last,keta,i, rui[i]-rui[i-1],rui[i]);
        }
    }
    //REP(i,n+2)printf("###%lld %lld\n",i, rui[i]);
    printf("%lld\n",rui[n]);
    return 0;
}

Measured memory_bytes: 1792
N,X,Y = map(int,input().split())
ans = [0]*N
for i in range(1,N+1):
    for j in range(i+1,N+1):
        if i <= X and j <= Y:
            d = min(j-i,(X-i)+(Y-j)+1)
            ans[d] += 1
        if i <= X and j > Y:
            d = (X - i) + (j - Y) + 1
            ans[d] += 1
        if i > X and j <= Y:
            d = min(j-i,(i-X)+(Y-j)+1)
            ans[d] += 1
        if i > X and j > Y:
            d = min(j-i,(i-X)+(j-Y)+1)
            ans[d] += 1

for i in ans[1:]:
    print(i)

Measured memory_bytes: 46812
#include<iostream>
using namespace std;
main(){
  int a[30],c[30];
  int sum=0;
  int n;cin>>n;
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  for(int i=0;i<n;i++){
    int b;cin>>b;
    sum+=b;
  }
  for(int i=0;i<n;i++){
    cin>>c[i];
  }
  for(int i=0;i<n-1;i++){
    if(a[i]+1==a[i+1])sum+=c[a[i]-1];
  }
  cout<<sum<<endl;
}


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

int main(void){
    int n = 0; 

    scanf("%d", &n);

    if(n <= 111){
        printf("111\n");
    }else if(n <= 222){
        printf("222\n");
    }else if(n <= 333){
        printf("333\n");
    }else if(n <= 444){
        printf("444\n");
    }else if(n <= 555){
        printf("555\n");
    }else if(n <= 666){
        printf("666\n");
    }else if(n <= 777){
        printf("777\n");
    }else if(n <= 888){
        printf("888\n");
    }else if(n <= 999){
        printf("999\n");
    }

    return 0;

} 


Measured memory_bytes: 256
S = input()
s = int(S)
lis = [s]

def func(n):
    if n%2 == 0:
        return n//2
    else:
        return 3*n+1
 
while func(s) !=1:
    s = func(s)
    lis.append(s)

if S == "1":
    print(4)
elif S == "2":
    print(4)
elif S == "4":
    print(4)
else:
    print(len(lis)+2)

Measured memory_bytes: 38256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <ctime>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

#define rep(i,n)   for (int i = 0; i < (n); ++i)
#define sort(a)    sort((a).begin(), (a).end());
#define uniq(a)    SORT(a);(a).erase(unique((a).begin(), (a).end()), (a).end());
#define find(a,x)  find((a).begin(), (a).end(), (x)) != (a).end()
#define reverse(a) reverse((a).begin(), (a).end());
#define out(d) cout << (d);
#define outl(d) std::cout<<(d)<<"\n";
#define Yes() printf("Yes\n");
#define No() printf("No\n");
#define YES() printf("YES\n");
#define NO() printf("NO\n");
#define ceil(x, y) ((x + y - 1) / (y))

using namespace std;
using ll = long long;
using P = pair<ll,ll>;

const ll MOD = 1000000007; // 10^9 + 7

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  srand((unsigned)time(NULL));

  char s; cin >> s;
  if (s == 'a' || s == 'i' || s == 'u' || s == 'e' || s == 'o')
    cout << "vowel" << endl;
  else
    cout << "consonant" << endl;
}


Measured memory_bytes: 256
// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(long long i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define show1d(v) {rep(_,v.size())cout<<" "<<v[_];cout<<endl;}
#define show2d(v) {rep(__,v.size())show1d(v[__]);}
using namespace std;
//kaewasuretyuui
typedef long long ll;
#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
#define mt make_tuple
typedef tuple<int,int,int> tp;
typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
int dx[]={-1,0,1,0};
int dy[]={0,1,0,-1};
#define yes cout<<"Yes\n"
#define no cout<<"No\n"

//nCr mod m
#define MOD 998244353
#define M 2200000
vector<ll> fact;
bool h=false;
void init(){
	h=true;
	fact=vector<ll>(M);
	fact[0]=fact[1]=1;
	loop(i,2,M)fact[i]=fact[i-1]*i%MOD;
}
// a^b mod MOD
ll powmod(ll a,ll b,ll m=MOD){
	ll out=1;
	ll p=a%m;
	while(b){
		if(b&1)out=out*p%m;
		p=p*p%m;
		b>>=1;
	}
	return out;
}
//nCr
ll nCr(ll n,ll r,ll m=MOD){
	if(!h)init();
	if(n<0||r<0||n<r)return 1;//??????
	ll out=fact[n]*powmod(fact[r]*fact[n-r]%m,m-2,m)%m;
	return out;
}
int gcd(int a,int b){
	if(b==0)return a;
	return gcd(b,a%b);
}
int lcm(int a,int b){
	return a/gcd(a,b)*b;
}


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

	int k,a,b;
	cin>>k>>a>>b;
	loop(i,a,b+1)if(i%k==0){
		cout<<"OK"<<endl;
		return 0;
	}
	cout<<"NG"<<endl;
}


Measured memory_bytes: 3644
import math


def read_int():
    return int(input().strip())


def read_ints():
    return list(map(int, input().strip().split(' ')))


def solve():
    N, T = read_ints()
    A = read_ints()
    MAX_OF_REST = []
    MAX = -math.inf
    for i in range(N-1, -1, -1):
        MAX = max(MAX, A[i])
        MAX_OF_REST.append(MAX)
    MAX_OF_REST.reverse()
    max_profit = 0
    max_count = 0
    for i in range(N-1):
        profit = MAX_OF_REST[i+1]-A[i]
        if profit > max_profit:
            max_profit = profit
            max_count = 1
        elif profit == max_profit:
            max_count += 1
    return max_count


if __name__ == '__main__':
    print(solve())


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

int main () {
  int a, b, c, d, e;
  cin >> a >> b >> c >> d >> e;

  int aa = a % 10;
  int ba = b % 10;
  int ca = c % 10;
  int da = d % 10;
  int ea = e % 10;

  if (aa == 0) aa = 10;
  if (ba == 0) ba = 10;
  if (ca == 0) ca = 10;
  if (da == 0) da = 10;
  if (ea == 0) ea = 10;

  int ab = a - aa + 10;
  int bb = b - ba + 10;
  int cb = c - ca + 10;
  int db = d - da + 10;
  int eb = e - ea + 10;

  
  int mina = min(aa, ba);
  mina = min(mina, ca);
  mina = min(mina, da);
  mina = min(mina, ea);

  int ans = ab + bb + cb + db + eb + mina - 10;

  cout << ans << endl;
}

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


struct qaq{
	int v;int id;
} a[100005];

bool cmp(qaq x,qaq y){
	return x.v<y.v; 
}

int main(){
	int n;
	cin>>n;
	for(int i=1;i<=n;i++){
		int x;
		cin>>x;
		a[i].id=i;
		a[i].v=x; 
	}	
	sort(a+1,a+1+n,cmp);
	for(int i=1;i<=n;i++){
		cout<<a[i].id<<" ";
	}
}

Measured memory_bytes: 1536
import collections

N = int(input())
C = []
for i in range(N):
  C.append(input())
X = collections.Counter(C)
print("AC x " + str(X["AC"]))
print("WA x " + str(X["WA"]))
print("TLE x " + str(X["TLE"]))
print("RE x " + str(X["RE"]))

Measured memory_bytes: 16348
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <cmath>
#include <algorithm>
using namespace std;

//素数判定
bool IsPrime(int p) {
	if (p == 1) return false;
	for (int i = 2; i < p; i++) {
		if (p%i == 0) return false;
	}
	return true;
}

//10進数の自然数の桁数を返す
int GetDigit(int num) {
	return (int)log10(num) + 1;
}

int main() {
	int A, B, C, X;
	int cnt = 0;

	cin >> A >> B >> C >> X;

	for (int i = 0; i <= A; i++)
	{
		for (int j = 0; j <= B; j++)
		{
			for (int k = 0; k <= C; k++)
			{
				if (i * 500 + j * 100 + k * 50 == X) {
					cnt++;
				}
			}
		}
	}

	cout << cnt << endl;

	return 0;
}

Measured memory_bytes: 768
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); i++)
#define all(x) (x).begin(),(x).end()
#define dup(x,y) (((x)+(y)-1)/(y))
#define sz(x) (int)(x).size()
#define MOD 1000000007
using namespace std;
typedef long long ll;

int main(){
    int a, b, n;
    int ans = 0;
    cin >> n;
    if(n%2 == 0) printf("%.6f\n",1/2.0);
    else cout << (n/2+1)/double(n) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    int a, b, c;
    cin >> a >> b >> c;
    if(a+b==c || b+c==a || c+a==b){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<int(n);i++)
#define rep1(i,n) for(int i=1;i<=int(n);i++)
#define per(i,n) for(int i=int(n)-1;i>=0;i--)
#define per1(i,n) for(int i=int(n);i>0;i--)
#define foreach(i,n) for(auto &&i:n)
#define all(x) (x).begin(),(x).end()
#define SORT(x) sort(all(x))
#define GSORT(x) sort(all(x), greater<int>())
#define REV(x) reverse(all(x))
#define MAX(x) *max_element(all(x))
#define MIN(x) *min_element(all(x))
#define LOWitr(x, n) lower_bound(all(x), n)
#define UPRitr(x, n) upper_bound(all(x), n)
#define cii(x) int x;cin >> x
#define cill(x) LL x;cin >> x
#define cis(x) string x;cin >> x
#define co(x) cout << x << endl
#define dump(x)  cout << #x << " = " << (x) << endl
#define truecheck assert
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define fastcin() cin.tie(0);ios::sync_with_stdio(false)
using namespace std;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef long long int64;
template<class T,class U>bool chmax(T &a, const U &b) { if (a<b) { a=b; return true; } return false; }
template<class T,class U>bool chmin(T &a, const U &b) { if (b<a) { a=b; return true; } return false; }
const int INF = 1e9, MOD = 1e9 + 7;
const LL LLINF = 1e16;

int main() {
    fastcin();
    cout << fixed << setprecision(10);
    cii(a);
    cii(b);
    int ans = max(a + b, max(a * 2 - 1, b * 2 - 1));
    co(ans);
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>

int const N = 1234567;

int a[N], cn[N];

int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", a + i);
  for (int i = 0; i < n; i++) cn[a[i]]++;
  std::sort(a, a + n);
  int k = a[0];
  if (a[0] == a[1]) {
    if (n > 2 && a[2] == a[0]) {
      puts("Impossible");
      return 0;
    }
    if (n < 2 * k) {
      puts("Impossible");
      return 0;
    }
    bool ok = true;
    for (int j = k; j < 2 * k; j++) {
      if (cn[j] < 2) {
        ok = false;
        break;
      }
    }
    ok &= a[n - 1] < 2 * k;
    puts(ok ? "Possible" : "Impossible");
  } else {
    if (n < 2 * k + 1) {
      puts("Impossible");
      return 0;
    }
    bool ok = true;
    for (int j = k + 1; j <= 2 * k; j++) {
      if (cn[j] < 2) {
        ok = false;
        break;
      }
    }
    ok &= a[n - 1] <= 2 * k;
    puts(ok ? "Possible" : "Impossible");
  }  
}

Measured memory_bytes: 128
from collections import deque
from copy import deepcopy
H, W = map(int, input().split())
maze = [[]for i in range(H)]
for i in range(H):
    S = input()
    for j in range(W):
        maze[i].append(S[j])

dx = [0, 1, 0, -1]
dy = [1, 0, -1, 0]
ans = 0
Q = deque()

for sy in range(H):
    for sx in range(W):
        if maze[sy][sx] == '#':
            continue
        mazenow = deepcopy(maze)
        Q.clear()
        Q.append((sy, sx))
        mazenow[sy][sx] = 0
        flag = True
        max_maze_now = 0
        while len(Q) > 0:
            y, x = Q.popleft()
            for i in range(4):
                ny = y + dy[i]
                nx = x + dx[i]
                if (ny < 0) or (nx < 0) or (ny >= H) or (nx >= W):
                    continue
                elif mazenow[ny][nx] == '.':
                    mazenow[ny][nx] = mazenow[y][x] + 1
                    max_maze_now = max(max_maze_now, mazenow[ny][nx])
                    Q.append((ny, nx))
        ans = max(max_maze_now, ans)

print(ans)

Measured memory_bytes: 56796
/*input
7
3 1
4 1
5 9
2 6
5 3
5 8
9 7
*/
#include <iostream>
#include <cstdio>
#include <vector>
#include <functional>
#include <cmath>
#include <cstring>
#include <utility>
#include <algorithm>
#include <iomanip>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <list>
#include <cstdlib>
#include <list>
#include <cassert>
#include <ctime>
#include <fstream>
#include <sstream>
using namespace std;
#define sp ' '
#define endl '\n'
#define fi first
#define se second
#define mp make_pair
#define ll long long
#define N 100005
#define int long long
// const int INF = 1e18;

int n;
int a[N];
int b[N];
signed main() {
	ios_base::sync_with_stdio(false); cin.tie(0);
	cin >> n;
	for (int i = 1; i <= n; i++) {
		cin >> a[i] >> b[i];
	}
	int ans = 0;
	for (int i = n; i >= 1; i--) {
		a[i] += ans;
		int t = b[i] - (a[i] % b[i]);
		if (t == b[i]) continue;
		else {
			ans += t;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long unsigned n,i,blue,red,ans=0,tot;
    cin>>n>>blue>>red;
    if(!blue)
    {
        return  cout<<0<<endl,0;
    }
    tot=blue+red;

    if(n>=tot)
    {
        ans+=(n/tot)*blue;
       // cout<<n<<endl;
        n=n%tot;
        //cout<<n<<endl;
    }
    if(n>blue)
    {
        ans+=blue;
    }
    else
    {
        ans+=n;
       // cout<<ans<<endl;
    }

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




Measured memory_bytes: 256
import java.lang.Math.*

data class Edge(val from: Int, val to: Int, val cost: Int)

fun log2(x: Int) = (log(x.toDouble()) / log(2.0) + 1e-10).toInt()

fun main(args: Array<String>) {
  val l = readLine()!!.toInt()
  var edges = mutableListOf<Edge>()
  var v = 1
  var e = 0
  var t = 1
  var b = log2(l) - 1
  while (t < l) {
    for (i in 0 until edges.size) {
      val es = edges[i]
      edges[i] = Edge(es.from, es.to, es.cost * 2)
    }
    edges.add(Edge(v, v + 1, 0))
    edges.add(Edge(v, v + 1, 1))
    v++
    e += 2
    t *= 2
    if ((l shr b) % 2 == 1) {
      edges.add(Edge(1, v, t))
      e++
      t++
    }
    b--
  }
  println("${v} ${e}")
  edges.forEach { println("${it.from} ${it.to} ${it.cost}") }
}


Measured memory_bytes: 33788
#include<iostream>
#include<string>
using namespace std;
int main() {
  string s;
  cin >> s;
  int n = s.size() - 1, t = (n + 1) / 2, r=0;
  for(int i=0;i<t;++i) if(s[i]!=s[n-i]) ++r;
  cout << r;
}

Measured memory_bytes: 256
a = int(input())
b = int(input())
c = int(input())
k = int(input())

count = 0
for x in range(a+1):
    for y in range(b+1):
        for z in range(c+1):
            if 500 * x + 100 * y + 50 * z == k:
                #print(x,y,z)
                count += 1
print(count)


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
 
const int N = 1e5 + 10;
 
char s[N], t[N];
 
int gcd(int a, int b){
	if (b == 0)
		return a;
	return gcd(b, a % b);
}
 
int main(){
	int n, m, st1, st2, _gcd, p1, p2;
	long long lcm;
	scanf("%d %d",&n,&m);
	scanf("%s",s);
	scanf("%s",t);
	_gcd = gcd(n, m);
	lcm = 1LL * n * m / (long long)_gcd;
	st1 = lcm / m;
	st2 = lcm / n;
	p1 = p2 = 0;
	while (p1 < n && p2 < m){
		if (s[p1] != t[p2]){
			printf("-1\n");
			return 0;
		}
		p1 += st1;
		p2 += st2;
	}
	printf("%lld\n",lcm);
	return 0;
}

Measured memory_bytes: 384
a, b, c = list(map(int, input().split()))

if (a == b):
    if (a != c):
        print("Yes")
        exit()
    else:
        print("No")
        exit()
if (b == c):
    if (b != a):
        print("Yes")
        exit()
    else:
        print("No")
        exit()
if (c == a):
    if (c != b):
        print("Yes")
        exit()
    else:
        print("No")
        exit()
if (a != b != c):
    print("No")


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

namespace AtCorder
{
	public class Program
	{
		static void Main(string[] args)
		{
			int[] nmq = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
			int n = nmq[0];
			int m = nmq[1];
			int q = nmq[2];

			int[,] lr = new int[n + 1, n + 1];
			int[] l = new int[m];
			int[] r = new int[m];
			for (int i = 0; i < m; i++) {
				int[] lrtemp = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
				l[i] = lrtemp[0];
				r[i] = lrtemp[1];

				lr[l[i], r[i]]++;
			}

			for (int i = 1; i < n + 1; i++) {
				for (int j = 0; j < n + 1; j++) {
					lr[j, i] += lr[j, i - 1];
				}
			}

			var sb = new StringBuilder();
			for (int i = 0; i < q; i++) {
				int[] pq = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
				int ans = 0;
				for (int j = pq[0]; j <= pq[1]; j++) {
					ans += lr[j, pq[1]];
				}

				sb.AppendLine(ans.ToString());
			}

			Console.WriteLine(sb.ToString());
		}
	}
}


Measured memory_bytes: 22508
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=2e5+5;
#define fast_IO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
ll a[N],b[N],c[N],dp[N][4];
bool vis[N],vis1[N];
vector<ll>v[N];
pair<ll,ll>p[N],p1[N];
set<int>s;
map<string,ll>mp;

main()
{
    fast_IO
    int n;
    cin>>n;
    for(int i=0; i<n; i++)
        cin>>a[i]>>b[i]>>c[i];
    int ans=0;

    for(int i=1; i<=n; i++)
    {
        dp[i][1]+=(a[i-1]+max(dp[i-1][2],dp[i-1][3]));
        dp[i][2]+=(b[i-1]+max(dp[i-1][1],dp[i-1][3]));
        dp[i][3]+=(c[i-1]+max(dp[i-1][1],dp[i-1][2]));
        ans=max({dp[i][1],dp[i][2],dp[i][3]});
    }
   cout<<ans<<"\n";



}










Measured memory_bytes: 13804
n, m = map(int, input().split())
a = [int(input()) for _ in range(m)]

tmp = [1, 2]
for i in range(10 ** 5):
    tmp.append(tmp[-1] + tmp[-2])

ans = 1
before = -1
if m != 0:
    for i in range(m):
        step = a[i] - before - 2
        if step == -1:
            ans = 0
            break
        elif step > 0:
            ans = ans * tmp[step-1]
            ans = ans % 1000000007

        before = a[i]

# final steps
step = n - before - 1
if step > 0:
    ans *= tmp[step-1]
    ans = ans % 1000000007

print(ans)


Measured memory_bytes: 463964
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(300000)

def dfs(idx, con, visited):
    visited[idx] = True
    max_depth = 0
    max_len = 0
    depths = []
    if idx >= len(con):
        return max_depth, max_len
    for v in con[idx]:
        if v < len(visited) and not visited[v]:
            max_d, max_l = dfs(v, con, visited)
            max_len = max(max_len, max_l)
            depths.append(max_d + 1)
    if len(depths) > 0:
        depths.sort(reverse=True)
        max_depth = depths[0]
        if len(depths) > 1:
            max_len = max(max_len, depths[0] + depths[1])
        else:
            max_len = max(max_len, depths[0])
    visited[idx] = False
    return max_depth, max_len


def solve(N: int, A: "List[int]", B: "List[int]"):
    con = [[] for _ in range(N)]
    for i in range(len(A)):
        a = A[i] - 1
        b = B[i] - 1
        con[a].append(b)
        con[b].append(a)
    #print(con)
    visited = [False] * N
    max_depth, max_len = dfs(0, con, visited)
    #print(max_len)
    if (max_len + 1) % 3 == 2:
        ret = 'Second'
    else:
        ret = 'First'
    print(ret)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    a = [int()] * (N-1)  # type: "List[int]" 
    b = [int()] * (N-1)  # type: "List[int]" 
    for i in range(N-1):
        a[i] = int(next(tokens))
        b[i] = int(next(tokens))
    solve(N, a, b)

if __name__ == '__main__':
    main()


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

typedef long long ll;

#define ff first
#define ss second
#define pb push_back
#define mp make_pair

using namespace std;

const int N = 1e4 + 69;
const ll INF = 1e18;

int n;
ll answer;
ll best[N];
bool  fix[N];

vector < pair <int,int> > P;

struct bla{
        int w, s, v;
};

bla A[N];

bool cmp(bla A, bla B){
        int cnt_A = A.s - B.w;
        int cnt_B = B.s - A.w;
        if(cnt_A == cnt_B){
                return A.s < B.s;
        }
        return cnt_A < cnt_B;
}

int main(){

        ios::sync_with_stdio(0);

        cin >> n;
        for(int i = 1; i <= n; i++){
                cin >> A[i].w >> A[i].s >> A[i].v;

        }

        sort(A+1, A+1+n, cmp);

        fix[0] = 1;
        cout << endl;
        for(int i = 1; i <= n; i++){
                ll answer_i = 0;
                for(int j = 0; j <= A[i].s; j++){
                        answer_i = max(answer_i, best[j]);
                }


                answer_i += A[i].v;
                answer = max(answer, answer_i);


                for(int j = A[i].s; j >= 0; j--){
                        if(fix[j]){
                                int to = j + A[i].w;
                                if(to > 1e4) continue;
                                best[to] = max(best[to], best[j] + A[i].v);
                                fix[to] = 1;
                        }
                }
        }

        cout << answer << endl;
}


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

signed main(){
	int n,h[110],ans = 0;
	cin >> n;
	for(int i = 0;i < n;i++) cin >> h[i];
	while(1){
		int ind = -1;
		for(int i = 0;i < n;i++){
			if(h[i]){
				ind = i;
				break;
			}
		}
		if(ind == -1) break;
		for(int i = ind;i < n;i++){
			if(!h[i]) break;
			h[i]--;
		}
		ans++;
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<string>
#include<cstdlib>
#include<cmath>
#include<algorithm>
#include<vector>
#include<iomanip>


using namespace std;

int main() {
	int W, H, N;
	cin >> W >> H >> N;

	int a=1, b=1;
	int input;
	int count = 0;
	for(int i=0; i<N; i++) {
		cin >> input;
		if(input) b++;
		else a++;

		if(a < W) {
			if(a==b) count++;
		}
		else if(W < a && a < W+H-1) {
			if(a==b+2) count++;
		}
		else if(W+H-1 < a) {
			if(a==b+4) count++;
		}
	}

	cout << count << endl;

	return 0;
}

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

int main() {
  int N,A;
  cin >> N >> A;
  
  if (1 <= N <= 10000, 0 <= A <=1000, N % 500 <= A) {
   cout << "Yes" << endl;
  }
  
  else if (1 <= N <= 10000, 0 <= A <=1000, N % 500 > A) {
    cout << "No" << endl;
  }
    
}




Measured memory_bytes: 256
#include<iostream>
 #include<stdio.h>
 #include<cstdlib>
 #include<cstdio>
 #include<string>
 #include<math.h>
 #include<time.h>
 #include<iomanip>
 #include<algorithm>
 #include<string.h>
 #include<cctype>
 #include<fstream> 
 #include<map>
 #include<set>
 #include<vector>
 #include<sstream>
 #include<stack>
 #include<queue>
 #include<deque>
 #include<functional>
 #include<utility>
 #include<list>
 #include<memory>
 
 using namespace std;
 
 int main()
 {
   int n,m;
   while(cin>>n>>m)
   {
     int c[26]={0};
     int cnt4,cnt2,cnt1;
     cnt1=0;
     cnt2=0;
     char arr[105][105];
     for(int i=0;i<n;i++)
     {
       for(int j=0;j<m;j++)
       {
         cin>>arr[i][j];
         c[arr[i][j]-'a']++;        
       }        
     }                
     for(int i=0;i<26;i++)
     {
       if(c[i]%4==2) cnt2++;
       else if(c[i]%2==1) cnt1++;        
     }
     //cout<<" "<<cnt2<<" "<<cnt1<<endl; 
     if(n%2==0&&m%2==0)
     {
       if(cnt2||cnt1) cout<<"No"<<endl;
       else cout<<"Yes"<<endl;
     } 
     else if(n%2==1&&m%2==1)
     {
       if(cnt2<=(n/2+m/2)&&cnt1<=1) cout<<"Yes"<<endl;
       else cout<<"No"<<endl;     
     }
     else
     {
       if(m%2==1)
       {
         if(cnt2<=(n/2)&&cnt1<=1) cout<<"Yes"<<endl;
         else cout<<"No"<<endl;          
       }
       else
       {
         if(cnt2<=(m/2)&&cnt1<=1) cout<<"Yes"<<endl;
         else cout<<"No"<<endl;    
       }    
     }
   }
   return 0;
 }
 

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

#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL); 

#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define mp make_pair
#define pu push
#define pp pop_back
#define in insert
#define ld long double
#define endl '\n'
#define debug cout << "Hold right there sparky.....\n";
#define forn(low,high,i) for(i=low;i<high;i++)
#define forrev(high,low,i) for(i = high; i>= low;i--)
#define trace(x) cerr << #x << ": " << x << " " << endl;
#define zeroes(x) memset(x,0,sizeof(x))
typedef long long int ll;

typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
const ll mod =1e9+7;
const ll maxn=100000;

int main()
{		
	
   
    IOS
   ll k,x;
   cin>>k>>x;
   for(ll i=x-k+1;i<=x+k-1;i++)
    cout<<i<<" ";




}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<math.h>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<string>
#include<complex>
#include<unordered_map>

#define INF 1000000000ll
#define MOD 1000000007ll
#define EPS 1e-8

#define REP(i, m) for(long long i = 0; i < m; ++i)
#define FOR(i, n, m) for(long long i = n; i < m; ++i)
#define ALL(v) v.begin(), v.end()
#define pb push_back

using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef long double ld;

int main() {
	int n,a,b;
	cin>>n>>a>>b;
	string s;
	cin>>s;
	int c=0;
	int ca=0;
	REP(i,n) {
		if(s[i]=='a') {
			if(c<a+b) {
				++c;
				cout<<"Yes"<<endl;
			} else {
				cout<<"No"<<endl;
			}
		}
		else if(s[i]=='b') {
			if(c<a+b&&ca<b) {
				++c;
				++ca;
				cout<<"Yes"<<endl;
			} else {
				cout<<"No"<<endl;
			}
		} else cout<<"No"<<endl;
	}
}


Measured memory_bytes: 896
cnt=0
while 1:
    cnt+=1
    w=int(raw_input())
    if w==0:break
    n=int(raw_input())
    tre=[map(int,raw_input().split(",")) for _ in xrange(n)]
    dp=[[0]*(w+1) for _ in xrange(n+1)]
    dp[0][0]=0
    for i in xrange(n):
        for j in xrange(w+1):
            if tre[i][1]>j:dp[i+1][j]=dp[i][j]
            else:
                dp[i+1][j]=max(dp[i][j],dp[i][j-tre[i][1]]+tre[i][0])
    print('Case '+str(cnt)+":")
    print(dp[n][w])
    print(dp[n].index(dp[n][w]))

Measured memory_bytes: 16608
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {

        Scanner sc = new Scanner(System.in);
        
        String A = sc.next();
        String B = sc.next();
        String C = sc.next();
        
        int a = A.length();
        int b = B.length();
        int c = C.length();
        
        if(A.charAt(a-1) == B.charAt(0) && B.charAt(b-1) == C.charAt(0)){
            System.out.println("YES");
        }else{
            System.out.println("NO");
        }
    }
}


Measured memory_bytes: 22740
import bisect,collections,copy,itertools,math,string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
def main():
    s = S()
    ans = 0


    for i in range(len(s)//2):
        if s[i] != s[-(i+1)]:
            ans += 1

    print(ans)
main()


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

int selectionSort(int A[], int N) {
	int sw = 0;
	for (int i = 0; i < N - 1; i++) {
		int min = i;
		for (int j = i; j < N; j++) {
			if (A[j] < A[min]) min = j;
		}
		swap(A[min], A[i]);
		if ( i != min) sw++;
	}
	return sw;
}

int main()
{
	int A[100], N;
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> A[i];
	}
	int sw = selectionSort(A, N);

	for (int i = 0; i < N; i++) {
		if (i > 0) cout << " ";
		cout << A[i];
	}
	cout << endl;
	cout << sw<<endl;
    return 0;
}

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

int main()
{
	string s;
	cin >> s;
	
	vector<pair<char, int>> v;
	for (char c : s){
		if (v.empty() || v.back().first != c){
			v.emplace_back(c, 1);
		}
		else {
			v.back().second++;
		}
	}

	int res = 0;
	for (int i = 1; i + 1 < v.size(); i++){
		string t = string() + v[i - 1].first + v[i].first + v[i + 1].first;
		if (t != "JOI") continue;
		if (v[i - 1].second < v[i].second) continue;
		if (v[i + 1].second < v[i].second) continue;
		res = max(res, v[i].second);
	}

	cout << res << endl;
}

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

using namespace std;
using ll=long long;
using ull=unsigned long long;
using pii=pair<int,int>;

#define INF LONG_MAX
#define MOD 1000000007
#define rng(a) a.begin(),a.end()
#define rrng(a) a.end(),a.begin()

struct weightUF{
  vector<int>par,rank;
  vector<ll>diff_weight;

  weightUF(int n){
    par.resize(n);
    rank.resize(n,0);
    diff_weight.resize(n,0);
    for(int i=0;i<n;i++)par[i]=i;
  }
  int root(int x){
    if(par[x]==x)return x;
    else{
      int r=root(par[x]);
      diff_weight[x]+=diff_weight[par[x]];
      return par[x]=r;
    }
  }
  ll weight(int x){
    root(x);
    return diff_weight[x];
  }
  bool is_same(int x,int y){
    return root(x)==root(y);
  }
  bool unite(int x,int y,ll w){
    w+=weight(x);
    w-=weight(y);
    x=root(x);
    y=root(y);
    if(x==y)return false;
    if(rank[x]<rank[y])swap(x,y),w=-w;
    if(rank[x]==rank[y])++rank[x];
    par[y]=x;
    diff_weight[y]=w;
    return true;
  }
  ll diff(int x,int y){
    return weight(y)-weight(x);
  }
};

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

  int n,q; cin>>n>>q;
  weightUF uf(n);
  for(int i=0;i<q;i++){
    int query;
    cin>>query;
    if(query==0){
      int x,y,z;
      cin>>x>>y>>z;
      uf.unite(x,y,z);
    }
    else{
      int x,y;
      cin>>x>>y;
      ll res=uf.diff(x,y);
      if(uf.is_same(x,y))cout<<res<<endl;
      else cout<<'?'<<endl;
    }
  }
  return 0;
}



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

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

typedef long long int lli;
typedef unsigned long long ull;
typedef complex<double> point;

template <typename P, typename Q>
ostream& operator<<(ostream& os, pair<P, Q> p)
{
  os << "(" << p.first << "," << p.second << ")";
  return os;
}

template <typename T>
ostream& operator<<(ostream& os, vector<T> v)
{
  os << "(";
  each (i, v)
    os << i << ",";
  os << ")";
  return os;
}

int main(int argc, char* argv[])
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  int a, b, c;
  while (cin >> a >> b >> c) {
    vector<int> v({a, b, c});
    sort(v.begin(), v.end());
    v.back() *= 10;
    cout << accumulate(v.begin(), v.end(), 0) << endl;
  }

  return 0;
}


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

const double EPS = 1e-12;

double add(double a, double b) {
	if (abs(a + b) < EPS * (abs(a) + abs(b)))
		return 0;
	return a + b;
}

struct P {
	double x, y;
	P() {};
	P(double x, double y) : x(x), y(y) {
	}

	P operator + (P p) {
		return P(add(x, p.x), add(y, p.y));
	}

	P operator - (P p) {
		return P(add(x, -p.x), add(y, -p.y));
	}

	P operator * (double d) {
		return P(x * d, y * d);
	}

	P operator / (double d) {
		return P(x / d, y / d);
	}

	// 内積
	double dot(P p) {
		return add(x * p.x, y * p.y);
	}

	// 外積
	double det(P p) {
		return add(x * p.y, -y * p.x);
	}
};

// 線分上に点があるか
bool on_seg(P p1, P p2, P q) {
	return (p1 - q).det(p2 - q) == 0 && (p1 - q).dot(p2 - q) <= 0;
}

// 直線と直線の交点
P intersection(P p1, P p2, P q1, P q2) {
	return p1 + (p2 - p1) * ((q2 - q1).det(q1 - p1) / (q2 - q1).det(p2 - p1));
}

// 2直線の直行判定
bool line_orth(P a1, P a2, P b1, P b2) {
	return fabs((a1 - a2).dot(b1 - b2)) < EPS;
}

// 2直線の平行判定
bool line_paral(P a1, P a2, P b1, P b2) {
	return fabs((a1 - a2).det(b1 - b2)) < EPS;
}

int main(void) {
	string str;
	P p[4];
	while (getline(cin, str)) {
		replace(str.begin(), str.end(), ',', ' ');
		stringstream buf(str);
		for (int i = 0; i < 4; i++) {
			buf >> p[i].x >> p[i].y;
		}

		bool modify = (p[3] - p[0]).det(p[0] - p[1]) < 0;
		bool flg = true;
		for (int i = 0; i < 3; i++) {
			if ((p[i] - p[i+1]).det(p[i+1] - p[(i+2)%4]) < 0 != modify){
				flg = false;
				break;
			}
		}
		cout << (flg ? "YES" : "NO") << endl;
	}
}

Measured memory_bytes: 1240
x = int(input())

if x>= 400 and x<= 599:
  print(8)
elif x>= 600 and x<= 799:
  print(7)
elif x>= 800 and x<= 999:
  print(6)
elif x>= 1000 and x<= 1199:
  print(5)
elif x>= 1200 and x<= 1399:
  print(4)
elif x>= 1400 and x<= 1599:
  print(3)
elif x>= 1600 and x<= 1799:
  print(2)
elif x>= 1800 and x<= 1999:
  print(1)

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


int main() {
  vector <int> dtom{-1, 2,5,5,4,5,6,3,7,6 };
  int n, m;
  cin >> n;
  long long int min = 10000000000;
  
  priority_queue<int> pq;
  int temp;
  for(int i=0; i < n; i++) {
   	cin >> temp;
    pq.push(temp);
  }
  while(pq.size() != 1) {
  	int n1 = pq.top();
    pq.pop();
    int n2 = pq.top();
    pq.pop();
    n1 = n1 % n2;
    if(n1 != 0)
    	pq.push(n1);
    pq.push(n2);
    
  }
  cout << pq.top();
  return 0;
}

Measured memory_bytes: 3824
n = int(input())
ls = list(map(int,input().split()))
def sub(p,q):
    return p-q
i = 0
p = 1
new=[0 for _ in range(n)]
s = [1 for _ in range(n)]
while ls[ls.index(max(ls))]>0:
    for j in range(len(ls)):
        if j == n-1:
            if ls[j] > 0:
                new[j] = p
            else:
                pass
        else:
            if (ls[j] <= 0) and (ls[j+1] <= 0):
                pass
            elif (ls[j] <= 0) and (ls[j+1] > 0):
                p += 1
            elif (ls[j] > 0) and (ls[j+1] > 0):
                new[j] = p
            else:
                new[j] = p
    if (sum(new) == n) and (len(list(set(new))) == 1):
        i += 1
    else:
        i += len(list(set(new))) -1
    ls = list(map(sub,ls,s))
    new = [0]*n
    p = 1
print(i)
    
        
        

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> PA;
typedef priority_queue<int, vector<int>, greater<int> > PQG;
#define REP(i, a, n) for(ll i = (ll) a;i < (ll) n;i++)
#define fi first
#define se second
#define pb push_back
#define INF 1000000009
#define INFL 1000000000000000018
#define MOD 1000000007
#define MAXN 200005
#define MAXM 200005

ll n, k;
map<ll, ll> mp;

int main()
{
    cin >> n >> k;
    REP(i, 0, n){
        ll a, b;
        cin >> a >> b;
        mp[a] += b;
    }
    map<ll, ll> :: iterator ite;
    ll sum = 0;
    for(ite = mp.begin(); ite != mp.end(); ++ite){
        sum += ite->se;
        if(sum >= k){
            printf("%lld\n", ite->first);
            return 0;
        }
    }


    return 0;
}
/*
*/





Measured memory_bytes: 4224
#import<bits/stdc++.h>
#define endl '\n'
using namespace std;
typedef long long LL;
LL i,j,k,m,n,s,x,y,a[200040];
main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	cin>>n;
	if(n>29)cout<<"Yes";
	else cout<<"No";
}

Measured memory_bytes: 3612
#include<stdio.h>
#include<string.h>
#include <algorithm> 
#include<bits/stdc++.h>
using namespace std;
int main()
{
   	int n;
   	scanf("%d",&n);
   	int a[100];
   	int evenc=0,cout=0;
   	for(int i=0;i<n;i++)
   	{
   		scanf("%d",&a[i]);
   		if(a[i]%2==0)
   		{
   			cout++;
   			if(a[i]%3==0||a[i]%5==0)
   				evenc++;
		}
	}
	if(evenc==cout)
		printf("APPROVED");
	else printf("DENIED");
	return 0;
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);
    String w = sc.next();
    boolean[] even = new boolean[26];
    Arrays.fill(even, true);

    for (int i = 0; i < w.length(); i++) {
      char c = w.charAt(i);
      even[c - 'a'] = !even[c - 'a'];
    }

    for (boolean b : even) {
      if (!b) {
        System.out.println("No");
        return;
      }
    }

    System.out.println("Yes");

  }
}

Measured memory_bytes: 35656
#include <iostream>
#include <algorithm>
#include <cmath>
#include <stdio.h>
#include <stdlib.h>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <string.h>
#include <stack>
#define Endl endl
#define mp make_pair
#define rep(N) for(int i=0;i<N;i++)
#define repj(N) for(int j=0;j<N;j++)
#define ll long long 
#define pii pair<int,int>
#define pll pair<ll,ll>
#define For(I,N) for(int I=0;I<N;I++)
#define cinone(N) int N;cin>>N;
#define scanfone(N) int N;cin>>N;
#define cinng(N,M) int N[M];for(int yiuytvnm=0;yiuytvnm<M;yiuytvnm++) cin>>N[yiuytvnm];
#define scanfng(N,M) int N[M];for(int qrwuoiq=0;qrwuoiq<M;qrwuoiq++) scanf("%d",&N[qrwuoiq]);
#define over(A) {cout<<A<<endl;exit(0);}
typedef unsigned long long ull;
const int inf=103974182;
using namespace std;

int main()
{
//	freopen("input.txt","r",stdin);
	string n;
	cin>>n;
	int l=n.size();
	if(n=="10" || n=="100" || n=="1000" || n=="10000" || n=="100000")
	{
		cout<<10<<endl;
	}
	else
	{
		int res=0;
		for(int i=0;i<l;i++)
		{
			res+=n[i]-'0';
		}
		cout<<res<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef pair <int,int> pii;
typedef long long LL;

const int RLEN=1<<18|1;
inline char nc() {
    static char ibuf[RLEN],*ib,*ob;
    (ib==ob) && (ob=(ib=ibuf)+fread(ibuf,1,RLEN,stdin));
    return (ib==ob) ? -1 : *ib++;
}
inline int rd() {
    char ch=nc(); int i=0,f=1;
    while(!isdigit(ch)) {if(ch=='-')f=-1; ch=nc();}
    while(isdigit(ch)) {i=(i<<1)+(i<<3)+ch-'0'; ch=nc();}
    return i*f;
}

const int N=1e5+50;
int n,m,anc[N];
int sze[N][4],num[N],rt[N],cnt[N];
vector <pii> edge[N];
inline void dfs(int x) {
    int bz=1; sze[x][num[x]]=1; cnt[x]=edge[x].size();
    for(auto v:edge[x]) {
        if(!~num[v.first]) {
            num[v.first]=(num[x]+v.second+3)%3; dfs(v.first);
            for(int i=0;i<=3;i++) sze[x][i]+=sze[v.first][i];
            cnt[x]+=cnt[v.first];
        }
        if(num[v.first]==3 || (num[v.first]!=(num[x]+v.second+3)%3)) bz=0;
    } 
    if(bz==0) {
        sze[x][3]+=sze[x][0]+sze[x][1]+sze[x][2];
        num[x]=3; sze[x][0]=sze[x][1]=sze[x][2]=0;
    }
}
int main() {
    n=rd(); m=rd();
    for(int i=1;i<=n;i++) num[i]=-1;
    for(int i=1;i<=m;i++) {
        int x=rd(), y=rd();
        edge[x].push_back(pii(y,-1));
        edge[y].push_back(pii(x,1));
    }
    for(int i=1;i<=n;i++) 
        if(!~num[i]) num[i]=0, rt[i]=1, dfs(i);
    LL ans=0;
    for(int i=1;i<=n;i++) if(rt[i]) {
        if(num[i]==3) ans+=(LL)sze[i][3]*sze[i][3];
        else {
            if(sze[i][1] && sze[i][0] && sze[i][2]) ans+=(LL)sze[i][0]*sze[i][1]+(LL)sze[i][1]*sze[i][2]+(LL)sze[i][2]*sze[i][0];
            else ans+=cnt[i]/2;
        }
    } cout<<ans<<'\n';
}

Measured memory_bytes: 14720
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pii pair<int, int>
const int N = (int)1e5+1;
vector<int> adj[N+1];
int n;

void dfs(int s, int dp[], bool visited[])
{
	visited[s] = 1;
	for(auto i : adj[s])
	{
		if (!visited[i])
		dfs(i, dp, visited);

		dp[s] = max(dp[s], 1+dp[i]);
	}
}


int main()
{
	int m;
	cin >> n >> m;
	int x, y;

	for(int i = 0; i < m; i++)
	{
		cin >> x >> y;
		adj[x].push_back(y);
	}


	int dp[n+1];
	bool visited[n+1];
	memset(dp, 0, sizeof(dp));
	memset(visited,0, sizeof(visited));

	for(int i = 1; i <= n; i++)
	{
		if (!visited[i])
		dfs(i, dp, visited);
	}
	int ans = 0;

	for(int i = 1; i <= n; i++)
	ans = max(ans, dp[i]);

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 12080
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
  
int main(void){
    int a, b, c;
    cin >> a >> b >> c;
    
    if (c >= a && c <= b) {
        cout << "Yes" << endl;
        return 0;
    } else {
        cout << "No" << endl;
        return 0;
    }
}

Measured memory_bytes: 256
n,m,k= map(int,input().split())
par = [-1]*n
def findsize(x):
    temp = par[x]
    if temp<0:return -1*temp
    else:return findsize(temp)
def find(x):
    if par[x]<0:return x
    else:
        par[x]=find(par[x])
        return par[x]
def unite(x,y):
    px,py=find(x),find(y)
    if px==py:return False
    else:
        if px<py:px,py=py,px
        par[px]+=par[py]
        par[py]=px
        return True
fl = []
for i in range(m):
    a,b= map(int,input().split())
    unite(a-1,b-1)
    fl.append((a-1,b-1))
bl = []
for i in range(k):
    c,d= map(int,input().split())
    bl.append((c-1,d-1))
points=[0]*n
for i in range(n):points[i]=findsize(find(i))-1
for i in range(m):
    (a1,b1)=fl[i]
    points[a1]-=1
    points[b1]-=1
for i in range(k):
    (c1,d1)=bl[i]
    if find(c1)==find(d1):
        points[c1]-=1
        points[d1]-=1
print(*points)

Measured memory_bytes: 37136