akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
#define MOD = 1000000007;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define ALL(a) begin(a),end(a)
#define COUNTOF(a) (sizeof(a)/sizeof(a[0]))
template<class T> istream& operator >> (istream& s, vector<T>& v)
{ for (T& x: v) { s >> x; } return s;}
template<class T> void cout_v(const vector<T>& c)
{ for (int i = 0; i < c.size(); i++) cout << c[i] << endl; }
template<class T> void cout_h(const vector<T>& c)
{ for (int i = 0; i < c.size(); i++) cout << c[i] << (i==c.size()-1?"\n":" "); }
template<class T> inline bool chmin(T& a, T b) {return a>b?a=b,true:false;}
template<class T> inline bool chmax(T& a, T b) {return a<b?a=b,true:false;}
template<class T> inline bool is_overlap(const T& as, const T& ae, const T& bs, const T& be)
{ return bs <=ae && as <= be; }
#define SP << " " <<
#define FMT(a) #a<<":"<<a 
#define FMT2(a,b) #a<<":"<<a<<", "<<#b<<":"<<b 
#define FMT3(a,b,c) #a<<":"<<a<<", "<<#b<<":"<<b<<", "<<#c<<":"<<c 
#define FMT4(a,b,c,d) #a<<":"<<a<<", "<<#b<<":"<<b<<", "<<#c<<":"<<c<<", "<<#d<<":"<<d 
#define ANS(a) cout<<a<<endl
void yes(bool f){cout<<(f?"yes":"no")<<endl;}
void Yes(bool f){cout<<(f?"Yes":"No")<<endl;}
void YES(bool f){cout<<(f?"YES":"NO")<<endl;}

int main()
{
    cin.tie(0); ios::sync_with_stdio(false);
    //cout<<std::fixed<<std::setprecision(10);

    int N, T; cin >>N>>T;
    
    int ans = INT_MAX;

    for (int i = 0; i < N; i++) {
        int c, t; cin >> c >> t;
        if (t <= T) {
            chmin(ans, c);
        }
    }

    if (ans == INT_MAX)
        cout << "TLE" << endl;
    else
        cout << ans << endl;
}


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

typedef long long ll;

const int INF = 1001001001;

int main() {
    int h, n;
    cin >> h >> n;
    vector<int> dp(h+1, INF);

    dp[0] = 0;
    for (int i = 0; i < n; i++) {
        int a, b;
        cin >> a >> b;
        for (int j = 0; j < h; j++) {
            int nj = min(j+a, h);
            dp[nj] = min(dp[nj], dp[j]+b);
        }
    }
    cout << dp[h] << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<unordered_map>
#include<climits>
using namespace std;
unordered_map<int, int> dp;
int main(){
    int n,k;
    cin>>n>>k;
    int h[n];
    for(int i=0;i<n;i++){
        cin>>h[i];
    }
    dp[0]=0;
    dp[1]=0;
    dp[2]=abs(h[1]-h[0]);
    for(int i=3;i<n+1;i++){
        int min=INT_MAX;
        for(int j=i-1;j>-1&&j>=i-k;j--){
            if(min>(dp[j]+abs(h[i-1]-h[j-1]))){
                min=dp[j]+abs(h[i-1]-h[j-1]);
            }
        }
        dp[i]=min;
    }
    cout<<dp[n]<<endl;
    return 0;
}

Measured memory_bytes: 7768
#include<bits/stdc++.h>
    using namespace std;
    int main()
    {
      string a,b;
      cin>>a>>b;
      int c=0;
      for(int i=0;i<a.length();i++)
      {
        if(a[i]!=b[i])
          c++;
      }
      cout<<c<<endl;
      return 0;
    }

Measured memory_bytes: 3832
#include <iostream>
#include <algorithm>

int main()
{
    int K;
    std::cin >> K;
    int sum = 0;
    for (int a = 1; a <= K; a++)
    {
        for (int b = 1; b <= K; b++)
        {
            int gcd_ab = std::__gcd(a, b);
            for (int c = 1; c <= K; c++)
            {
                sum += std::__gcd(gcd_ab, c);
            }
        }
    }
    std::cout << sum << std::endl;
}

Measured memory_bytes: 3604
printn = lambda x: print(x,end='')
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
ins = lambda : input().strip()
DBG = True # and False
BIG = 10**18
R = 10**9 + 7

def ddprint(x):
  if DBG:
    print(x)

from math import sqrt

def prime_division(x):
    q = int(sqrt(x))
    a = []
    for i in range(2,q+1):
        ex = 0
        while x%i == 0:
            ex += 1
            x //= i
        if ex>0:
            a.append([i,ex])
    if x>q:
        a.append([x,1])
    return a

def divisorlist(z): # z : output of prime_division
    #ddprint(f"dvl {z}")
    if len(z)==1:
        return [z[0][0]**i for i in range(z[0][1]+1)]
    y = divisorlist(z[1:])
    s = []
    for i in range(z[0][1]+1):
        for j in y:
            s.append((z[0][0]**i)*j)
    return s

n,k = inm()
d = [0]*(k+1)
d[1] = pow(k,n,R)
sm = 0
for i in range(k,1,-1):
    d[i] = (d[i]+pow(k//i,n,R))
    ps = divisorlist(prime_division(i))
    for p in ps:
        if p!=i:
            d[p] = (d[p]-d[i])%R
    sm = (sm+d[i]*i)%R
#ddprint(d)
print((sm+d[1])%R)


Measured memory_bytes: 73612
# ref: https://atcoder.jp/contests/abc128/submissions/5654623

import sys
from bisect import bisect_left

def main():
    input = sys.stdin.readline
    N, Q = map(int, input().split())
    closure = []
    for _ in range(N):
        start, end, pos = map(int, input().split())
        closure.append((pos, start, end))

    closure.sort()

    D = [int(input()) for _ in range(Q)]

    ans = [-1] * Q
    skip = [-1] * Q
    for pos, start, end in closure:
        left = bisect_left(D, start - pos)
        right = bisect_left(D, end - pos)

        while left < right:
            if skip[left] == -1:
                ans[left] = pos
                skip[left] = right
                left += 1
            else:
                left = skip[left]

    return ans


if __name__ == '__main__':
    print(*main(), sep='\n')


Measured memory_bytes: 52764
import sys
import math 
ni = lambda: int(ns())
na = lambda: list(map(int, input().split()))
ns = lambda: input()
N,K = na()
S = ns()
Add = 2*K+1
Nums = []
cnt=0
now=1
for i in range(N):
    if(S[i]==str(now)):
        cnt+=1
    else:
        Nums.append(cnt)
        now = 1-now
        cnt = 1
if(cnt):
    Nums.append(cnt)
if(len(Nums)%2==0):
    Nums.append(0)
#累積和
Sums = [0]*(len(Nums)+1)
for i in range(len(Nums)):
    #print(Nums[i])
    Sums[i+1] = Sums[i] + Nums[i]
#print(Sums)
#print(Nums)
ans = 0
for i in range(0,len(Nums),2):
    left = i
    right = min(i+Add, len(Nums))
    #print(i)
    #print(Sums[i+Add])
    tmp = Sums[right] - Sums[left]
    ans  = max(ans,tmp)
print(ans)

Measured memory_bytes: 8004
n,l = map(int, input().split())
sum_n = n * (l-1) + (n * (n+1)) // 2

min = 10**9
ind = -1
for i in range(1,n+1):
    diff = abs(l+i-1)
    if diff < min:
        min = diff
        ind = i

print(sum_n - (l+ind-1))


Measured memory_bytes: 3060
#include <stdio.h>

int main(void){
    int a,b,c,v=0,l[100]={0};
    scanf("%d%d%d",&a,&b,&c);
    l[a-1]++;l[b-1]++;l[c-1]++;
    for(int i=0;i<100;i++){if(l[i]){v++;}}
    printf("%d\n",v);
    return 0;
}

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

int main() {
  bool flag = false;
  string n; cin>>n;
  for (int i = 0; i < n.length(); i++) {
    if (n.at(i) == '7') flag = true;
  }
  cout << (flag?"Yes":"No") << endl;
}


Measured memory_bytes: 3620
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>

using namespace std;

int main(void){
    vector<char> n(4);
    char m[4] = {'1', '9', '7', '4'};
    int o, p, q;
    int _flag = 0;
    int count = 0;
    
    cin >> n[0] >> n[1] >> n[2] >> n[3];

    for(int i = 0; i < 4; i++){
        if(n[0] == m[i] &&(n[0] == '1' || n[0] == '7' || n[0] == '4' || n[0] == '9')){
            o = i;
            _flag++;
        }
    }
    for(int i = 0; i < 4; i++){
        if(_flag == 1 && n[1] == m[i] && i != o &&(n[1] == '1' || n[1] == '7' || n[1] == '4' || n[1] == '9')){
            p = i;
            _flag++;
        }
    }
    for(int i = 0; i < 4; i++){
        if(_flag == 2 && n[2] == m[i] && i != o && i != p &&(n[2] == '1' || n[2] == '7' || n[2] == '4' || n[2] == '9')){
            q = i;
            _flag++;
        }
    }
    for(int i = 0; i < 4; i++){
        if(_flag == 3 && n[3] == m[i] && i != o && i != p && i != q &&(n[3] == '1' || n[3] == '7' || n[3] == '4' || n[3] == '9')){
            _flag = 4;
            break;
        }
    }

    if(_flag == 4){
        cout << "YES" << endl;
    }
    else{
        cout << "NO" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define pii pair<int,int>
const long long MOD=1000000007;

int main(){
    int s,l,h,m;
    cin>>s>>l>>h>>m;
    double pi = 3.141592653589793238;
    double argl=(double)6*m*pi/180;
    double args=(double)(30*h+0.5*m)*pi/180;
    double c2=s*s+l*l-2*s*l*cos(argl-args);
    cout<<fixed<<setprecision(15)<<pow(c2,0.5)<<endl;
    return 0;
}

Measured memory_bytes: 4352
using System;
using System.Collections.Generic;

namespace abc168_c
{
  class Program
  {
    static void Main(string[] args)
    {
      var A = CIn.ReadInt();
      var B = CIn.ReadInt();
      var H = CIn.ReadInt();
      var M = CIn.ReadInt();

      var hRad = (H + (double)M / 60) / 6 * Math.PI;
      var mRad = (double)M / 30 * Math.PI;

      var hX = Math.Cos(hRad) * A;
      var hY = Math.Sin(hRad) * A;
      var mX = Math.Cos(mRad) * B;
      var mY = Math.Sin(mRad) * B;

      var d = Math.Sqrt(Math.Pow(hX - mX, 2) + Math.Pow(hY - mY, 2));

      Console.WriteLine(d);
    }
  }

  static class CIn
  {
    private static readonly Queue<string> fieldBuffer = new Queue<string>();

    public static string Read()
    {
      if (fieldBuffer.Count == 0)
      {
        foreach (var field in Console.ReadLine().Split())
        {
          fieldBuffer.Enqueue(field);
        }
      }
      return fieldBuffer.Dequeue();
    }

    public static int ReadInt() => int.Parse(Read());
    public static long ReadLong() => long.Parse(Read());
    public static double ReadDouble() => double.Parse(Read());

    public static string[] ReadStringArray(int n)
    {
      var array = new string[n];
      for (var i = 0; i < n; i++)
      {
        array[i] = Read();
      }
      return array;
    }

    public static int[] ReadIntArray(int n)
    {
      var array = new int[n];
      for (var i = 0; i < n; i++)
      {
        array[i] = ReadInt();
      }
      return array;
    }

    public static long[] ReadLongArray(int n)
    {
      var array = new long[n];
      for (var i = 0; i < n; i++)
      {
        array[i] = ReadLong();
      }
      return array;
    }

    public static double[] ReadDoubleArray(int n)
    {
      var array = new double[n];
      for (var i = 0; i < n; i++)
      {
        array[i] = ReadDouble();
      }
      return array;
    }

    public static char[,] ReadCharMatrix(int h, int w)
    {
      var array = new char[h, w];
      for (var i = 0; i < h; i++)
      {
        var l = Console.ReadLine().ToCharArray();
        for (var j = 0; j < w; j++)
        {
          array[i, j] = l[j];
        }
      }
      return array;
    }
  }
}


Measured memory_bytes: 28364
import java.util.Scanner;

public class Main {
	static int[] p;
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N=sc.nextInt();
		p=new int[N];
		int counter=0;
		for(int i=0; i<N; i++) {
			p[i]=sc.nextInt();
		}
		int check=0;
		while(check<N) {
			if(check+2<N) {	//更に奥の列を見れる時
				if(p[check]!=check+1 && p[check+1]==check+2 && p[check+2]==check+3) {
					//1つ先の2つくみを見る前に自分を木にする
					//1こ先のやつがどっちもスワップしたほうがいい時
					counter++;
					swap(check+1,check+2);
					check++;
				}
				else {
					//1個先の2つ組がどちらかがp_i != i　ならわざわざ先でやる必要はない
					if(p[check]==check+1 || p[check+1]==check+2) {
						counter++;
						swap(check,check+1);
						check++;
					}
					else {
						check++;
						//特に無いなら次を見る
					}
				}
			}
			else if(check+1<N){
				//1個先の2つ組がどちらかがp_i != i　ならわざわざ先でやる必要はない
				if(p[check]==check+1 || p[check+1]==check+2) {
					counter++;
					swap(check,check+1);
					check++;
				}
				else {
					check++;
					//特に無いなら次を見る
				}
			}
			else {
				check++;
			}
		}
		System.out.println(counter);
	}
	static void swap(int i,int j) {
		int tmp1=p[i];
		int tmp2=p[j];
		p[i]=tmp2;
		p[j]=tmp1;
	}
}

Measured memory_bytes: 53196
#include<iostream>
#include<vector>
#include<map>
#include<string>
#include<utility>
#include<algorithm>
using namespace std;
#define ll int64_t
#define REP(i, n) for (int i=0; i<n; i++)

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

    ll N, K;
    string S;
    cin >> N >> K >> S;

    S[K-1] = tolower(S[K-1]);
    cout << S << "\n";
}

Measured memory_bytes: 256
#!/usr/bin/env python3
import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines


def main():
    N, M = map(int, readline().split())
    submit = [line.split() for line in readlines()]
    submit = [[int(p), S.decode()] for p, S in submit]
    WA_count = [0] * (N + 1)
    correct_list = [False] * (N + 1)
    correct = 0
    penalty = 0
    for p, S in submit:
        if not correct_list[p]:
            if S == 'WA':
                WA_count[p] += 1
            else:
                correct += 1
                penalty += WA_count[p]
                correct_list[p] = True
    print(correct, penalty)


if __name__ == '__main__':
    main()


Measured memory_bytes: 48404
# coding: utf-8
# hello worldと表示する
#dpでできないかな？
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def SI(): return input().rstrip()
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7

n,k=MI()
ans=0
for i in range(1,n+1):
    ansi=((n+1)//i)*max(i-k,0)
    ansi2=max(0,(n+1)%i-k)
    #print(ansi,ansi2)
    #print(ansi2)
    ans+=ansi+ansi2
if k==0:
    ans-=n
print(ans)

Measured memory_bytes: 39792
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <math.h>
#include <cassert>
#define rep(i,n) for(int i = 0; i < n; ++i )
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main() {
  int a,b;
  cin >> a >> b;
  cout << a*b << endl;
}


Measured memory_bytes: 3632
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {	
	    public static void main(String[] args) throws IOException {
	        BufferedReader reader = new BufferedReader( new InputStreamReader( System.in ) );
	            int X,Y;
	            String[] t;  
	            while( true ) {
	                String str = reader.readLine();
	                t= str.split( " " );
	               int n = Integer.parseInt(t[0] );
	               int x = Integer.parseInt(t[1] );
	                if(n==0 && x==0 ) {  
	                	break; 
	                	}
	                int count = 0;
	                X = x / 3;
	                int i, j, k;
	                for( i=1; i<X; i++ ) {
	                    Y = ( x-i ) / 2;
	                    for( j=i+1; j<=Y; j++ ) {
	                        k = x - i - j;
	                        if( j < k && k <= n ) {
	                            count++;
	                        }
	                    }
	                }
	                System.out.println( count );    
	            }
	        } 
	    }
	


Measured memory_bytes: 24408
n, k = map(int, input().split())
r, s, p = map(int, input().split())
t = input()
ans = 0
for i in range(n):
    if ((i - k) < 0):
        if (t[i] == 'r'):
            ans += p
        elif (t[i] == 's'):
            ans += r
        else:
            ans += s
        continue

    else:
        if (t[i - k] == t[i]):
            t = t[:i] + 'n' + t[i + 1:]
        else:
            if (t[i] == 'r'):
                ans += p
            elif (t[i] == 's'):
                ans += r
            else:
                ans += s
print(ans)


Measured memory_bytes: 121484
n = int(input())
a = list(map(int, input().split()))
q = int(input())
for i in range(q):
    b, m, e = map(int, input().split())
    s = a[b:e]
    a = a[:b] + s[m-b:] + s[:m-b] + a[e:]
print(*a)


Measured memory_bytes: 5832
#include<bits/stdc++.h>
using namespace std;
int main(){
    int a, b, c, d, N, ans=0, L, X;
    vector<int> v(3);
    char tmp, tmp2;
    string S, S2, S3;
    bool flag=true;
    
    cin >> N>>a>>b;

    // ans = a<=b ? a:a-1;

    
    ans = min(N*a, b);
    cout << ans<< endl;

    // if(S[1]==S[2] &&(S[0]==S[1] | S[2]==S[3]))
    // 	cout << "Yes" <<endl;
    // else
    // 	cout << "No" <<endl;

    // string S;
    // cin >>S;
    // // cout << S + "pp"<<endl;
    // if(flag)
    // 	puts("Yes");
    // else
    // 	puts("No");
}



Measured memory_bytes: 256
from itertools import permutations
n, m = map(int, input().split())
path = []
for i in range(m):
    a, b = map(int, input().split())
    path.append([a,b])
    path.append([b,a])
import itertools
per = [i for i in range(2,n+1)]
data = list(itertools.permutations(per, n-1))  
flg = 0
for k in range(len(data)):
    tmp = [[1, data[k][0]]]
    for i in range(n-2):
        tmp.append([data[k][i],data[k][i+1]])
    cnt = 0
    for var in tmp:
        if var in path:
            cnt += 1
    if cnt == len(tmp):
        flg += 1
print(flg)  

Measured memory_bytes: 9260
#[allow(unused_imports)]
use std::cmp::{Ordering};

#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};

#[allow(unused_imports)]
use std::io::{stdin, stdout, BufWriter, Write};

#[allow(unused_imports)]
use std::iter::FromIterator;

#[allow(unused_macros)]
macro_rules! min {
    ($x: expr) => ($x);
    ($x: expr, $($z: expr),+) => {{
        std::cmp::min($x, min!($($z),*))
    }}
}

#[allow(unused_macros)]
macro_rules! max {
    ($x: expr) => ($x);
    ($x: expr, $($z: expr),+) => {{
        std::cmp::max($x, max!($($z),*))
    }}
}

#[allow(unused_macros)]
macro_rules! get { 
    ([$t: ty]) => { 
        { 
            let mut line = String::new(); 
            stdin().read_line(&mut line).unwrap(); 
            line.split_whitespace().map(|t|t.parse::<$t>().unwrap()).collect::<Vec<_>>()
        }
    };
    ([$t: ty];$n: expr) => {
        (0..$n).map(|_|get!([$t])).collect::<Vec<_>>()
    };
    ($t: ty) => {
        {
            let mut line = String::new();
            stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t: ty),*) => {
        { 
            let mut line = String::new();
            stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            ($(iter.next().unwrap().parse::<$t>().unwrap(),)*)
        }
    };
    ($t: ty; $n: expr) => {
        (0..$n).map(|_|get!($t)).collect::<Vec<_>>()
    };
    ($($t: ty),*; $n: expr) => {
        (0..$n).map(|_|get!($($t),*)).collect::<Vec<_>>()
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        #[cfg(debug_assertions)]
        writeln!(&mut std::io::stderr(), concat!("[DEBUG] ", $(stringify!($a), "={:?} "),*), $($a),*).unwrap();
    }
}

const BIG_STACK_SIZE: bool = true;

#[allow(dead_code)]
fn main() {
    use std::thread;
    if BIG_STACK_SIZE {
        thread::Builder::new()
            .stack_size(32 * 1024 * 1024)
            .name("solve".into())
            .spawn(solve)
            .unwrap()
            .join()
            .unwrap();
    } else {
        solve();
    }
}

fn solve() {
    let (h,w) = get!(usize, usize);
    let a = get!(String; h).into_iter().map(|e| e.chars().map(|f| f == '.').collect::<Vec<_>>()).collect::<Vec<_>>();

    let mut dp = vec![vec![0;w+1];h+1];
    dp[0][1] = 1;
    let mo = 1_000_000_007;
    for row in 0..h {
        for col in 0..w {
            if a[row][col] {
                dp[row+1][col+1] = (dp[row+1][col] % mo + dp[row][col+1] % mo) % mo;
            }
        }
    }
    println!("{}", dp[h][w]);
}


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

using namespace std;

#define rep(i, x)   for (__typeof(x) i = 0; i < x; i++)
#define mp             make_pair
#define pb             push_back
#define fi             first
#define se             second
#define sz(x)          (int)((x).size())
#define all(x)         (x).begin(), (x).end()
#define sci(x)         int x;       scanf("%d", &x);
#define scii(x, y)     int x, y;    scanf("%d %d", &x, &y);
#define sciii(x, y, z) int x, y, z; scanf("%d %d %d", &x, &y, &z);
#define TC(x)          sci(x); while(x --)
#define eprintf(...)   fprintf(stderr, __VA_ARGS__)
#define debug(x)       { cerr << #x << " = " << x << endl; }
#define repi(i, x)  for (__typeof(x) i = x-1; i >= 0; i --)
#define fore(itr, x)   for (__typeof(x.begin()) itr = x.begin(); itr != x.end(); itr ++)
#define forei(itr, x)  for (__typeof(x.end()) itr = x.end() - 1; itr != x.begin() - 1; itr --)
typedef long long      ll;
typedef pair<int, int> ii;
typedef pair<ii, int>  iii;
typedef vector<int>    vi;
typedef vector<ii>     vii;
typedef vector<iii>    viii;
typedef vector<vector<int> > vvi;
typedef pair<ll, ll>   pairl;
typedef vector<ll>     vl;
typedef vector<ll>     vll;
typedef vector<vector<ll> > vvl;
const   int            infi = numeric_limits<int>::max();
const   ll             infl = numeric_limits<ll>::max();
const   double         eps = 0;
const   int            ms  = 0;



int main()
{
    ios::sync_with_stdio(false);//endl->"\n"
    cin.tie(0);
    int a,b,c;
    cin >> a >> b >> c;
    if(a+b+c >= 22)cout << "bust" << endl;
    else cout << "win" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <iterator>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <limits>
#include <iomanip>

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

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

inline int ctoi(char c) {
    return (int)(c -'0');
}

// ----------------------------------------------------------

int main() {
    string str;
    cin >> str;
    int ans = 0;
    rep(i, str.size() / 2) {
        if (str[i] != str[str.size() - i - 1]) {
            ++ans;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
n = gets.chomp.to_i
a = gets.chomp.split.map(&:to_i)
a.each do |e|
  if e.even?
    if e % 3 == 0 || e % 5 == 0
    else
      puts 'DENIED'
      exit
    end
  end
end
puts 'APPROVED'


Measured memory_bytes: 1788
#include <stdio.h>

int main(int argc, char const *argv[]) {
    int a, b;
    //入力
    scanf("%d %d", &a, &b);
    //計算
    int c;
    int ans;
    c = a-b;
    ans = 0.5*c*(c+1) - a;
    //出力
    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
ll n,k;
ll mod=1e9+7;
vector<vector<ll>> bv(50,vector<ll>(50));
vector<vector<ll>> mul(vector<vector<ll>> v1, vector<vector<ll>> v2){
    vector<vector<ll>> v(50,vector<ll>(50));
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            ll s=0;
            for(int r=0;r<n;r++){
                s=(s+ (v1[i][r]*v2[r][j])%mod )%mod;
            }
            v[i][j]=s;
        }
    }
    return v;
}
vector<vector<ll>> f(ll p){
    if(p==1) return bv;
    vector<vector<ll>> v=f(p/2);
    vector<vector<ll>> V=mul(v,v);
    if(p%2!=0) V=mul(V,bv);
    return V;
}
int main() {
    /*
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output1.txt", "w", stdout);
    #endif*/
   //cout << std::fixed;
    //cout << std::setprecision(10);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    cin>>n>>k;
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            cin>>bv[i][j];
        }
    }
    vector<vector<ll>> v=f(k);
    ll ans=0;
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            ans=(ans+v[i][j])%mod;
        }
    }
    cout<<ans;
}

Measured memory_bytes: 384
import java.util.Arrays;
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		String[] s = new String[n];
		int count = 0;
		
		for(int i=0;i<n;i++) {
			s[i] = scan.next();
		}
		
		Arrays.sort(s);
		
		for(int i=0;i<n-1;i++) {
			if(i == 0) {
				count++;
			}
			if(!(s[i].equals(s[i+1]))) {
				count++;
			}
		}
		if(count == 0) {
			count++;
		}
		System.out.println(count);

	}

}

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

int main()
{
    int n,m; cin >> n >> m;
    if (n == m) {
        cout << "Yes" << endl;
        return 0;
    } else {
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <queue>
#include <bitset>
#define MOD (1000000007l)
#define rep(i, n) for(long i = 0; i < (n); i++)

using namespace std;

void solve() {
  long N;
  cin >> N;
  vector<long> A(N);
  rep (i, N) cin >> A[i];
  vector<long> B(N);
  rep (i, N) cin >> B[i];
  vector<long> C(N);
  rep (i, N) cin >> C[i];
  long ans = 0;
  rep (i, N) ans += B[i];
  rep (i, N-1) if (A[i] + 1 == A[i+1]) ans += C[A[i]-1];
  cout << ans << endl;
}

int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout.precision(12);
  solve();
  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <climits>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <stack>
#include <queue>
#include <algorithm>
#include <iostream>
#include <string>

#define REP(i,n) for(auto i=0;i<n;++i)
#define REPR(i,n) for(auto i=n;i>=0;--i)
#define REPI(itr,v) for(auto itr=v.begin();itr!=v.end();++itr)
#define REPIR(itr,v) for(auto itr=v.rbegin();itr!=v.rend();++itr)
#define FOR(i,a,b) for(auto i=a;i<b;++i)
#define SORT(v,n) sort(v, v+n)
#define SORTV(v) sort(v.begin(), v.end())
#define ALL(v) v.begin(),v.end()
#define llong long long
#define ll long long
#define INF 999999999
#define MOD 1000000007
#define pb push_back
#define pf push_front
#define MP make_pair
#define SV(n,v) {int tmp;for(int i=0;i<n;++i){scanf("%d",&tmp);v.push_back(tmp);}}

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

using namespace std;

typedef pair<int,int> pii;

int main(){

  int a, b;
  cin >> a >> b;
  
  cout << max({a+b, a+a-1,b+b-1}) << endl;

  return 0;
}



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

int main() {
int N;
  cin >> N;
  if(N <= 9){
    cout << N << endl;
  }else if(N <= 99){
   cout << 9 << endl; 
  }else if(N <= 999){
   cout << N - 90 << endl; 
  }else if(N <= 9999){
   cout <<  909 << endl;
  }else if(N <= 99999){
   cout << N - 9090 << endl;
  }else if(N == 100000){
    cout << 90909 << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
	int h=0,v=0,d=0;int n,m;
	cin>>n>>m;char a[n][m];
	for (int i = 0; i < n; ++i)
	{
		for (int j = 0; j < m; ++j)
		{
			cin>>a[i][j];
		}
	}
	
	for (int i = 0; i < n; ++i)
	{
		for (int j = 0; j < m; ++j)
		{
			if(a[i][j]=='.')
			{
				for(int k=i-1;k<=i+1;k++)
				{
					for (int l = j-1; l<=j+1 ; l++)
					{
						if(l>=0 && k>=0 && l<m && k<n)
						{
							if(a[k][l]=='#' )
								h++;
						}
					}
				}
				cout<<h;
				
			}
			else
				{cout<<a[i][j];}

			h=0;
		}
		cout<<endl;
		
	}
	

}

Measured memory_bytes: 256
// ------------------------------------
// Date:2018/ 3/ 7
// Problem:ABC 076 RatingGoal a.cpp
//
// ------------------------------------

#include <bits/stdc++.h>

using namespace std;

#define EACH(i,a) for (auto&& i : a)
#define FOR(i,a,b) for(int i=(int)a;i<(int)b;++i)
#define RFOR(i,a,b) for(int i=(int)b-1;i>=(int)a;--i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()
#define debug(x) cerr << #x << ":" << x << endl

typedef long long ll;

static const int MOD = 1000000007;

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

  int R, G;
  cin >> R >> G;
  int ans = 2 * G - R;
  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<set>
using namespace std;
int main()
{
    int n,x,i,an=0,k=0;
    cin>>x>>n;
    int m[n];
    for(i=0;i<n;i++)
    {
        cin>>m[i];
    }
    an=x;
    k=0;
    set<int> st;
    for(i=0;i<n;i++)
    {
        st.insert(m[i]);
    }
    /*if(n==0)
    {
        cout<<x<<endl;
        return 0;
    }*/
    for(i=0;i<=101;i++)
    {
        if(st.find(i)!=st.end())
        {

        }
        else{

            if(abs(x-i)<an)
            {
                an=abs(x-i);
                k=i;
            }
        }

        }
    //}
    cout<<k<<endl;

    return 0;
}


Measured memory_bytes: 3616
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
using namespace std;
#define P pair<int, char>

int main(){
    int tmp1, tmp2;
    while(cin >>tmp1 >>tmp2){
        if(tmp1 == 0 && tmp2 == 0) break;
        vector<P> vec;
        char shop[5] = {'A', 'B', 'C', 'D', 'E'};
        vec.push_back( make_pair(tmp1 + tmp2, shop[0]) );
        for(int i = 1; i < 5; i++){
            cin >>tmp1 >>tmp2;
            vec.push_back( make_pair(tmp1 + tmp2, shop[i]) );
        }
        sort(vec.begin(), vec.end());
        cout <<vec[vec.size() - 1].second <<" " <<vec[vec.size() - 1].first <<endl;
    }
    return 0;
}

Measured memory_bytes: 0
#include<stdio.h>
int main(){
int n,i,j,k,flag=0;
scanf("%d\n",&n);
int score[n][3];
int result[n][3];
for(i=0;i<n;i++){
scanf("%d %d %d\n",&score[i][0],&score[i][1],&score[i][2]);
}
for(i=0;i<n;i++){
for(k=0;k<3;k++){
for(j=0;j<n;j++){
if(i!=j && score[i][k]==score[j][k])flag=1;
}
if(flag==0){
result[i][k]=score[i][k];
}else{
result[i][k]=0;
flag=0;
}

}
}
for(i=0;i<n;i++){
printf("%d\n",result[i][0]+result[i][1]+result[i][2]);
}
return 0;
}

Measured memory_bytes: 604
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{
    ll n;
    cin>>n;
    if(n>=400 && n<=599) cout<<8<<"\n";
    else if(n>=600 && n<=799) cout<<7<<"\n";
    else if(n>=800 && n<=999) cout<<6<<"\n";
    else if(n>=1000 && n<=1199) cout<<5<<"\n";
    else if(n>=1200 && n<=1399) cout<<4<<"\n";
    else if(n>=1400 && n<=1599) cout<<3<<"\n";
    else if(n>=1600 && n<=1799) cout<<2<<"\n";
    else if(n>=1800 && n<=1999) cout<<1<<"\n";
    return 0;
}

Measured memory_bytes: 3632
#include <algorithm>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
// const int INF = (1 << 30) - 1;
// const ll LL_INF = (1LL << 62) - 1;
// const ll MOD = 1e9 + 7;

int N;
vector<int> a;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> N;
  a.resize(N + 1);
  for (int i = 1; i <= N; i++) {
    cin >> a[i];
  }

  int M = 0;
  vector<int> b(N + 1, 0);

  for (int i = N; i >= 1; i--) {
    int sum = 0;
    int cur = i + i;
    while (cur <= N) {
      sum += b[cur];
      cur += i;
    }

    if (sum % 2 != a[i]) {
      b[i] = 1;
      M++;
    }
  }

  cout << M << endl;
  for (int i = 1; i <= N; i++) {
    if (b[i] == 1) {
      cout << i << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int mxn= 1e6+5;
// check for forloop
// intialize variable
// overflow
// go for easy solution
#define mod 1000000007
ll INF = 1000000000000000005LL;
#define endl '\n'
void rishabh(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}
int main(){
    rishabh();
    int n;
    cin>>n;
    n--;
    int arr[n];
    for(int i=0;i<n;i++){
        cin>>arr[i];
    }
    int ans=arr[0];
    for(int i=1;i<n;i++){
        ans=ans+min(arr[i],arr[i-1]);
    }
    cout<<ans+arr[n-1];
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>*/
 
#define pll              pair <long long,long long>
#define pb               push_back
#define ll               long long
#define ff               first
#define ss               second
#define D(x)             cerr<<#x " = "<<(x)<<endl
#define vll              vector <ll>
#define IOS              ios_base::sync_with_stdio(0); cin.tie(NULL);
#define endl             '\n'   
using namespace std;


int main()
{
    IOS
    ll n,k;
    cin>>n>>k;
    ll mn=n-2;
    ll mx=((n-2)*(n-1))/2;
    vector<pll>ans;
    if(mx<k)
    {
        cout<<-1<<endl;
    }
    else
    {
        for(ll i=1;i<=n-1;i++)
        {
            ans.pb({i,n});
        }
        while(mx>k)
        {
            for(ll i=1;i<=n-2;i++){
                for(ll j=i+1;j<=n-1;j++){
                    ans.pb({i,j});
                    mx--;
                    if(mx==k)
                        break;
                }
                if(mx==k)
                    break;
            }
        }
        cout<<ans.size()<<endl;
        for(pll p:ans)
        {
            cout<<p.first<<" "<<p.second<<endl;
        }
    }
    return 0;
}



Measured memory_bytes: 512
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<string.h>
#include<string>
#include<set>
#include<limits.h>
#include<set>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include<list>
#include<functional>
#include<stack>
#include<deque>
#include<queue>
using namespace std;

bool dp[16001];
signed main() {
	string a; cin >> a;
	a += 'T';
	int x, y; cin >> x >> y;
	int z = 0;
	bool S = true;
	vector<int>l, r;
	int k = 0;
	int sum = 0;
	for (char i : a) {
		if (i == 'T') {  k++; if (k % 2 == 0)r.push_back(sum); else if(S==false)l.push_back(sum); sum = 0; S = false;
		}
		else if (S)z++;
		else { sum++; }
	}
	int OK = 0;
	dp[0] = true;
	int h = abs(x - z);
	int q = 0;
	for (int i : l) {
		q += i;
	}
	for (int i : l) {
		for (int j = 8000; j >= i * 2; j--) {
			if (dp[j - i * 2])dp[j] = true;
		}
	}
	if ((q >= h&&dp[q - h])||dp[q+h])OK++;
	memset(dp, false, sizeof(dp));
	dp[0] = true;
	h = abs(y);
	q = 0;
	for (int i : r) {
		q += i;
	}
	for (int i : r) {
		for (int j = 16000; j >= i * 2; j--) {
			if (dp[j - i * 2])dp[j] = true;
		}
	}
	if ((q >= h&&dp[q - h]) || dp[q + h])OK++;
	if (OK == 2) {
		puts("Yes");
	}
	else {
		puts("No");
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <string>
#include <sstream>
#include <algorithm>
#include <random>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>
#include <cassert>
#include <climits>
#include <bitset>
#include <functional>
#include <iomanip>
#include <random>

#define FOR_LT(i, beg, end) for (int i = (int)(beg); i < (int)(end); i++)
#define FOR_LE(i, beg, end) for (int i = (int)(beg); i <= (int)(end); i++)
#define FOR_DW(i, beg, end) for (int i = (int)(beg); (int)(end) <= i; i--)
#define REP(n)              for (int repeat_index = 0; repeat_index < (int)n; repeat_index++)


using namespace std;

int64_t kRem = 1000000007;

int64_t pow_rem(int64_t x, int64_t m, int64_t rem)
{
	if (m == 0) {
		return 1;
	}
	if (m == 1) {
		return x;
	}

	if (m & 1) {
		int64_t val = pow_rem(x, m / 2, rem);
		val = val * val;
		val %= rem;
		val *= x;
		val %= rem;
		return val;
	}
	else {
		int64_t val = pow_rem(x, m / 2, rem);
		val = val * val;
		val %= rem;
		return val;
	}
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout << fixed << setprecision(20);

	int64_t n, k; cin >> n >> k;

	vector<int64_t> cases(k + 1);
	FOR_DW(l, k, 1) {
		int64_t c = pow_rem(k/ l, n, kRem);
		int64_t v = l * 2;
		while (v <= k) {
			c -= cases[v];
			if (c < 0) c += kRem;
			v += l;
		}
		cases[l] = c;
	}

	int64_t ans = 0;
	FOR_LE(i, 1, k) {
		int64_t c = cases[i] * i;
		c %= kRem;
		ans += c;
		ans %= kRem;
	}
	cout << ans << endl;

	return 0;
}

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

int main(){
  
  int n, q, b, m, e;
  
  cin >> n;
  vector<int> A(n);
  vector<int>::iterator a = A.begin();
  for(int i = 0;i < n;i++) cin >> A[i];
  
  cin >> q;
  for(int i = 0;i < q;i++){
    cin >> b >> m >> e;
    rotate(a + b, a + m, a + e);
  }
  
  for(int i = 0;i < n;i++){
    cout << (i?" ":"");
    cout << A[i];
  }
  cout << endl;
  
  return 0;
}


Measured memory_bytes: 3164
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n, k, q, l;
  cin >> n >> k >> q;
  int a[n + 1] = {};
  for(int i = 0; i < q; ++i)
  {
    cin >> l;
    a[l]++;
  }
  for(int i = 1; i <= n; ++i)
  {
    a[i] += k - q;
    if(a[i] > 0)
      cout << "Yes\n";
    else cout << "No\n";
  }
   return 0;
}

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

int n;
cin >> n;
int count = 0;
int num = 1;
vector<int> block(n);

for(int i = 0;i < n;i++){
    cin >> block.at(i);
}

/*for (int i = 0; i < n; i++)
{
    cout << block.at(i);
}*/

/*for(int i = 1;i < n;i++){
    for(int j = 0; j < n;j++){
        if(i == block.at(j)){
            count++;
        }else{
            break;
        }
    }
}*/


for (int i = 0; i < n; i++)
{
    if(num == block.at(i)){
        count++;
        num++;
//        cout << "num="<<num << endl << block.at(i) << endl;
    }
}


if(count == 0){
    cout << "-1" << endl;
}else{
    cout << n-count << endl;
}

return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using VI = vector<int>;
using VL = vector<ll>;
template<class T> using PQ = priority_queue<T, vector<T>, greater<T>>;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);++(i))
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);++(i))
#define rFOR(i,a,n) for(int (i)=(n)-1;(i)>=(a);--(i))
#define erFOR(i,a,n) for(int (i)=(n);(i)>=(a);--(i))
#define each(i, a) for(auto &i : a)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
#define out(y,x) ((y) < 0 || h <= (y) || (x) < 0 || w <= (x))
#define line cout << "------------------------\n" 
#define ENDL(i,n) ((i) == (n) - 1 ? "\n" : " ")
#define stop system("pause")
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
const long double pi = acos(-1);
const long double eps = 1e-10;
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; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }
template<class T>inline istream& operator>>(istream& is, vector<T>& v) { for (auto& elemnt : v)is >> elemnt; return is; }
template<class T, class U>inline istream& operator>>(istream& is, pair<T, U>& p) { is >> p.first >> p.second; return is; }
template<class T>inline vector<T> vec(size_t a) { return vector<T>(a); }
template<class T>inline vector<T> defvec(T def, size_t a) { return vector<T>(a, def); }
template<class T, class... Ts>inline auto vec(size_t a, Ts... ts) { return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...)); }
template<class T, class... Ts>inline auto defvec(T def, size_t a, Ts... ts) { return vector<decltype(defvec<T>(def, ts...))>(a, defvec<T>(def, ts...)); }

int n;
vector<VI> mzr;
vector<VL> memo;
ll solve(int now, int color) {
    if (memo[now][color] != -1)return memo[now][color];
    ll ret = 1;
    each(to, mzr[now]) {
        ll s = 0;
        if (color == 0)(s += solve(to, 1)) %= mod;
        (s += solve(to, 0)) %= mod;
        (ret *= s) %= mod;
    }
    return memo[now][color] = ret;
}

int main() {
    init();

    cin >> n;
    vector<VI> nzm(n);
    FOR(i, 0, n - 1) {
        int x, y; cin >> x >> y;
        --x, --y;
        nzm[x].push_back(y);
        nzm[y].push_back(x);
    }
    memo = defvec<ll>(-1, n, 2);

    mzr.resize(n);
    vector<bool> ever(n);
    queue<int> bfs;
    bfs.push(0);
    while (!bfs.empty()) {
        int now = bfs.front(); bfs.pop();
        ever[now] = true;
        each(to, nzm[now]) {
            if (ever[to])continue;
            bfs.push(to);
            mzr[now].push_back(to);
        }
    }

    cout << (solve(0, 0) + solve(0, 1)) % mod << "\n";
}


Measured memory_bytes: 23680
#include <iostream>
#define int long long
using namespace std;

int n, k;
int a, b;
int cnt[100001];

signed main() {
	int i;
	
	cin >> n >> k;
	for (i = 0; i < n; i++) {
		cin >> a >> b;
		cnt[a] += b;
	}
	
	int kosuu = 0;
	for (i = 0; i <= 100000; i++) {
		kosuu += cnt[i];
		if (kosuu >= k) {
			cout << i << endl;
			break;
		}
	}
	return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <regex>
#include <set>
#include <cmath>
#include <numeric>
#include <set>

using namespace std;

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

    std::set<std::string> presents;
    for(int i = 0; i < n; i++)
    {
        std::string x;
        std::cin >> x;
        presents.insert(x);
    }

    std::cout << presents.size();

    return EXIT_SUCCESS;
} 

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

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

int main(){
	int n,q;
	cin>>n>>q;
	queue<tuple<string,int>> wait;
	queue<tuple<string,int>> fin;
	int now=0;
	REP(i,n){
		string tmpn;
		int tmpt;
		cin>>tmpn>>tmpt;
		wait.push(make_tuple(tmpn,tmpt));
	}
	while(!wait.empty()){
		now+=q;
		auto item = wait.front();
		wait.pop();
		int t = get<1>(item) - q;
		if(t>0){
			get<1>(item) = t;
			wait.push(item);
		} else {
			now+=t;//?????????????????????
			get<1>(item) = now;
			fin.push(item);
		}
	}
	while(!fin.empty()){
		auto item = fin.front();
		cout<< get<0>(item) <<" "<< get<1>(item) <<endl;
		fin.pop();
	}
	return 0;
}

Measured memory_bytes: 6164
#include<cstdio>
#include<cstdlib>
#include<cstring>
using namespace std;

struct command{char com[20];int key;};
struct Node{int key;Node *next, *prev;};
Node *nil;

void init()
{
	nil=(Node *)malloc(sizeof(Node));
	nil->next=nil;
	nil->prev=nil;
}

void insert(int key)
{
	Node *x=(Node *)malloc(sizeof(Node));
	x->key=key;
	x->next=nil->next;
	nil->next->prev=x;
	nil->next=x;
	x->prev=nil;
}

Node* listSearch(int key)
{
	Node *cur=nil->next;
	while(cur!=nil&&cur->key!=key)
	{
		cur=cur->next;
	}
	return cur;
}

void deleteNode(Node *t)
{
	if(t==nil)return;
	t->prev->next=t->next;
	t->next->prev=t->prev;
	free(t);
}
void deleteFirst()
{
	deleteNode(nil->next);
}
void deleteLast()
{
	deleteNode(nil->prev);
}
void deleteKey(int key)
{
	deleteNode(listSearch(key));
}

void printList()
{
	Node *cur=nil->next;
	int isf=0;
	while(1)
	{
		if(cur==nil)break;
		if(isf++>0)printf(" ");
		printf("%d",cur->key);
		cur=cur->next;
	}
	printf("\n");
}

int main()
{
	int n;scanf("%d",&n);
	command G;
	init();
	for(int i=0;i<n;i++)
	{
	
		scanf("%s%d",G.com,&G.key);
		if(G.com[0]=='i')
		{
			insert(G.key);
		}
		else if(strlen(G.com)<8)
		{
			deleteKey(G.key);
		}
		else if(G.com[6]=='F')
		{
			deleteFirst();
		}
		else
		{
			deleteLast();
		}
	}
	printList();
	return 0;
}

Measured memory_bytes: 33860
#include <iostream>
#include <stdio.h>
#include <string.h>
using namespace std;
const int N=400005;
int tot=0;
int a[N],b[N],n;
unsigned long long k;
int vis[N];
int main() {
  scanf("%d%llu",&n,&k);
  for (int i=1;i<=n;++i) scanf("%d",&a[i]);
  int now=1;
  while(1) {
    now=a[now];
    b[++tot]=now;
    if(tot==k) {
      printf("%d\n",now);
      return 0;
    }
    if(vis[now]!=0) {
      k-=1ull*(vis[now]-1);
      int len=(tot-vis[now]);
      k%=(1ull*len);
      if(k==0) k=len;
      printf("%d\n",b[k+vis[now]-1]);
      return 0;
    }
    vis[now]=tot;
  }
  return 0;
}




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

#define FAST std::ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define M 1000000007
#define mp make_pair
#define pb push_back
#define PB pop_back
#define sl(a) (int)a.length()
#define sz(a) (int)a.size()
#define lcase(a) (char)tolower(a)
#define ucase(a) (char)toupper(a)
#define precise(a) fixed<<setprecision(a)<<
#define F first
#define S second
#define I insert
#define pii pair<int,int>
#define trav(a, x) for(auto& a : x)
#define rep(n) for(int i = 0;i<n;i++)
#define rrep(n) for(int i = n-1;i>=0;i--)
#define time cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
#define invect(data,n,commands) for(int i = 0;i<n;i++){int tmp;cin>>tmp;data.pb(tmp);commands}
#define inset(data,n,commands) for(int i = 0;i<n;i++){int tmp;cin>>tmp;data.I(tmp);commands}
#define display(x) trav(a,x) cout<<a<<" "; cout<<endl;
#define ingrid(data,n,commands) for(int i = 0; i<n; i++){cin>>data[i];commands}
#define section(a,b,w) set_intersection(a.begin(), a.end(),b.begin(), b.end(),back_inserter(w));
#define union(a,b,w) set_union(a.begin(), a.end(),b.begin(), b.end(),back_inserter(w));
#define copy(a,w) copy(a.begin(), a.end(),back_inserter(w));
#define all(data) data.begin(), data.end()
#define PI 3.14159265358979323844
#define endl '\n'
#define last(a) a[sz(a)-1]
 
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    std::cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');std::cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
 
// Graph DFS
const int fx[]={+1,-1,+0,+0};
const int fy[]={+0,+0,+1,-1};
 
//primes for hashing 937,991,1013,1409,1741
 
//Returns index of first element not less than key and more than key respectively
#define lb(data,key) lower_bound(all(data),key) - data.begin();
#define up(data,key) upper_bound(all(data),key) - data.begin();
#define fnd(data,key) find(all(data),key) - data.begin();
/* Long Long Int */
#define int long long int


 
void solve(){
    
    int n, wt;
    cin>>n>>wt;
    vector<int> dp(wt+1);
    dp[0] = 0;
    for (int i = 0; i < n; ++i)
    {
        int w, v;

        cin>>w>>v;
        for (int j = wt; j >= w; --j)
        {
            dp[j] = max(dp[j], dp[j-w]+v);
        }
    }
    cout<<*max_element(all(dp));
}

signed main()
{
    FAST
    int t = 1;
    // cin>>t;
    while(t--) solve();
    return 0;

return 0;
}

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

int main(){
    int n;
    cin >> n;
    set<int> st;
    for(int i = 0; i < n; i++){
        int a;
        cin >> a;
        bool f = st.erase(a);
        if(f);
        else st.insert(a);
    }
    cout << st.size() << endl;

    return 0;
}

Measured memory_bytes: 4864