akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;
int N;
int A[11];
string initial;
string goal;
set<string> st[2][6];
void bfs(int index, string &now) {
    st[index][0].insert(now);
    for(int cost = 0; cost < 4; cost++) {
        for(auto itr = st[index][cost].begin(); itr != st[index][cost].end(); itr++) {
            string nowst = *itr;
            for(int i = 0; i < nowst.size(); i++) {
                for(int j = i + 2; j <= nowst.size(); j++) {
                    reverse(nowst.begin() + i, nowst.begin() + j);
                    bool ok = true;
                    for(int k = 0; k <= cost + 1; k++) {
                        if(st[index][k].find(nowst) != st[index][k].end()) ok = false;
                    }
                    if(ok) {
                        st[index][cost+1].insert(nowst);
                        //cerr << index << " " << cost + 1 << " " << st[index][cost+1].size() << " " << nowst << endl;
                    }
                    reverse(nowst.begin() + i, nowst.begin() + j);
                }
            }
        }
    }
}

int main() {
    //cout.precision(10);
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> N;
    string start;
    for(int i = 1; i <= N; i++) {
        cin >> A[i];
        A[i]--;
        initial.push_back('0' + A[i]);
        start.push_back('0' + A[i]);
    }
    sort(start.begin(), start.end());
    bfs(0, start);
    //cerr << st[0][5].size() << endl;
    bfs(1, initial);
    int ans = 9;
    for(int i = 0; i <= 5; i++) {
        for(auto itr = st[0][i].begin(); itr != st[0][i].end(); itr++) {
            //cerr << i << " " << *itr << endl;
            for(int j = 0; j <= 5; j++) {
                if(st[1][j].find(*itr) != st[1][j].end()) ans = min(ans, i + j);
            }
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 50936
#include <iostream>
#include <sstream>
#include <cstdlib>
#include <cmath>
#include <map>
#include <set>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
#include <numeric>
#include <cstdio>
using namespace std;

int main()
{
	char s[500][5];
	int index = 0;

	s[0][0] = 'a';
	s[0][1] = s[0][2] = s[0][3] = s[0][4] = '\0';

	for ( ; ; ) {
		printf("?%s\n", s[index++]);

		fflush(stdout);
		scanf("%s", s[index]);

		for (int i = strlen(s[index]); i < 5; ++i)
			s[index][i] = '\0';

		bool found = false;
		for (int i = 0; i < index && !found; ++i) {
			if (strcmp(s[i], s[index]) == 0)
				found = true;
		}

		if (s[index-1][strlen(s[index-1])-1] != s[index][0] || found) {
			printf("!OUT\n");
			fflush(stdout);
			break;
		}

		++index;
		if (strcmp(s[index-1], "aa") == 0) {
			s[index][0] = s[index][1] = s[index][2] = 'a';
			s[index][3] = s[index][4] = '\0';
		} else {
			s[index][0] = s[index-1][strlen(s[index-1])-1];
			s[index][1] = 'a';
			s[index][2] = s[index][3] = s[index][4] = '\0';
		}
	}

	return 0;
}

Measured memory_bytes: 0
import java.util.*;

class Main {
    public static void main(String[] args) {
        new Solver().run();
    }
}

class Solver {

    private int getDiff(int time) {
        return (10 - time % 10) % 10;
    }

    private int getNextOrderTime(int time) {
        return time + getDiff(time);
    }

    public void run() {
        Scanner sc = new Scanner(System.in);
        List<Integer> A = new LinkedList<Integer>();
        A.add(sc.nextInt());
        A.add(sc.nextInt());
        A.add(sc.nextInt());
        A.add(sc.nextInt());
        A.add(sc.nextInt());

        int idx = 0;
        int max = 0;
        for (int i = 0; i < 5; i++) {
            int diff = getDiff(A.get(i));
            if (max < diff) {
                max = diff;
                idx = i;
            }
        }

        int time = 0;
        for (int i = 0; i < 5; i++) {
            if (i == idx) {
                time += A.get(i);
            } else {
                time += getNextOrderTime(A.get(i));
            }
        }
        System.out.println(time);

        return;
    }

}

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

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define MAX3(a, b, c) ((a) > (MAX(b, c)) ? (a) : (MAX(b, c)))
#define MIN3(a, b, c) ((a) < (MIN(b, c)) ? (a) : (MIN(b, c)))

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

int main()
{
    int n;
    ll x;
    cin >> n >> x;
    int m[1000];
    rep(i, n) {
        cin >> m[i];
        x -= m[i];
    }
    sort(m, m + n);
    cout << n + x / m[0] << endl;
    return 0;
}

Measured memory_bytes: 256
s = input()[::-1]

lst = []
num = 1
pow10 = [1]
for _ in range(len(s) - 1):
    num = num * 10 % 2019
    pow10.append(num)

num = 0
for s_num, p10 in zip(s, pow10):
    num = (num + (int(s_num) * p10)) % 2019
    lst.append(num)
lst.sort()

total = 0
cnt = 1
before = 0
for num in lst:
    if before == num:
        cnt += 1
    else:
        total += cnt * (cnt - 1) // 2
        cnt = 1
    before = num
total += cnt * (cnt - 1) // 2
print(total)

Measured memory_bytes: 24376
#include <algorithm>
#include<iostream>
#include<vector>
#include<deque>
#include<queue>
#include<list>
#include<stack>
#include<map>
#include<set>
#include<string>
#include <sstream>
#include<bitset>

#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<limits.h>

using namespace std;
const int INF = 0x7fffffff;

int gcd(int x,int y){
  int mi,ma;
  ma = max(x,y);
  mi = min(x,y);
  if(ma % mi == 0){
    return mi;
  }
  else{
    return gcd(mi,ma % mi);
  }
}

struct node{
  int key;
  node* prev;
  node* next;
};

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;

  //1.xのnext
  x->next = nil->next;
  //2.xのprev
  x->prev = nil;
  //3.nilのnext
  nil->next = x;
  //4.xのnextのprev
  x->next->prev =x;


  
}

void del(int key){
  node* cur = nil->next;
  while(cur != nil){
    if(cur->key == key){
      //curのnextのprev
      cur->next->prev = cur->prev;
      //curのprevのnext
      cur->prev->next = cur->next;
      free(cur);
      break;
    }
    cur = cur->next;
  }
    
}

void deleteFirst(){
  node* first = nil->next;
  first->prev->next = first->next;
  first->next->prev = first->prev;
  free(first);
}

void deleteLast(){
  node* last = nil->prev;
  last->prev->next = last->next;
  last->next->prev = last->prev;
  free(last);
}

int main(){
  long ii,jj,kk;
  vector<int> a;

  int n,num;
  cin >> n;
  string command;

  init();

  for(ii=0;ii<n;ii++){
    cin >> command;
    if(command == "insert" ||
       command == "delete"){
      cin >> num;
      if(command == "insert"){
        
        insert(num);
        //cout << "insert" << num << endl;
      }
      else{
        del(num);
      }
    }

    else{
      if(command == "deleteFirst"){
        deleteFirst();
      }
      else if(command == "deleteLast"){
        deleteLast();
      }
    }
  }

  node* cur = nil->next;

  while(cur  != nil){
    //cout << cur->key << endl;
    cout  << cur->key ;
    if(cur->next != nil){
      cout << " ";
    }
    else{
      cout << endl;
    }
    cur = cur->next;
  }

  return 0;
}



Measured memory_bytes: 34268
#include <stdio.h>
#include <stdlib.h>

int main()
{
        int year, month, day, conv, nen;
        char str[9];

        while ( scanf( "%d %d %d", &year, &month, &day ) != EOF ) {
                /* 87e$N@0?t$KJQ49$9$k */
                sprintf( str, "%d%02d%02d", year, month, day );
                conv = atoi( str );

                if ( conv < atoi( "18680908" ) ) {
                        printf( "pre-meiji\n" );
                } else if ( conv >= atoi( "18680908" ) && conv <= atoi( "19120729" ) ) {
                        nen = year - 1868 + 1;
                        printf( "meiji %d %d %d\n", nen, month, day );
                } else if ( conv >= atoi( "19120730" ) && conv <= atoi( "19261224" ) ) {
                        nen = year - 1912 + 1;
                        printf( "taisho %d %d %d\n", nen, month, day );
                } else if ( conv >= atoi( "19261225" ) && conv <= atoi( "19890107" ) ) {
                        nen = year - 1926 + 1;
                        printf( "showa %d %d %d\n", nen, month, day );
                } else if ( conv >= atoi( "19890108" ) ) {
                        nen = year - 1989 + 1;
                        printf( "heisei %d %d %d\n", nen, month, day );
                }
        }

        return 0;
}



Measured memory_bytes: 2024
import re
s = input()
s = s.replace("?", ".")
t = input()
if len(t) > len(s):
  print("UNRESTORABLE")
else:
  r = []
  for i in range(len(s)-len(t)+1):
    m = re.match(s[i:i+len(t)], t)
    if m is None:
      continue
    r.append((s[:i]+t+s[i+len(t):]).replace(".","a"))
  if not r:
    print('UNRESTORABLE')
    quit()
      
  print(min(r))

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

YES = "YES"
NO = "NO"

def can_leave(n, p, S, T):
    min_p, max_p = p, p
    for i in range(len(S)):
        #print(min_p, max_p)
        if S[i] > 0:
            max_p += 1
        if S[i] < 0:
            min_p -= 1
        if max_p > n or min_p < 1:
            return False

        if min_p < n and T[i] > 0:
            min_p += 1
        if max_p > 1 and T[i] < 0:
            max_p -= 1
    return True


def solve(h: int, w: int, N: int, sr: int, sc: int, S: str, T: str):
    def make(st, n):
        ret_h, ret_w = [], []
        for i in range(n):
            if st[i] == 'U':
                ret_h.append(-1)
                ret_w.append(0)
            if st[i] == 'D':
                ret_h.append(1)
                ret_w.append(0)
            if st[i] == 'L':
                ret_w.append(-1)
                ret_h.append(0)
            if st[i] == 'R':
                ret_w.append(1)
                ret_h.append(0)
        return ret_h, ret_w

    hs, ws = make(S, N)
    ht, wt = make(T, N)
    h_can = can_leave(h, sr, hs, ht)
    w_can = can_leave(w, sc, ws, wt)
    #print(hs)
    #print(ht)
    #print(h_can)
    #print()
    #print(ws)
    #print(wt)
    #print(w_can)
    if  h_can and w_can:
        ret = YES
    else:
        ret = NO
    print(ret)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    H = int(next(tokens))  # type: int
    W = int(next(tokens))  # type: int
    N = int(next(tokens))  # type: int
    s_r = int(next(tokens))  # type: int
    s_c = int(next(tokens))  # type: int
    S = next(tokens)  # type: str
    T = next(tokens)  # type: str
    solve(H, W, N, s_r, s_c, S, T)

if __name__ == '__main__':
    main()


Measured memory_bytes: 10112
#include <bits/stdc++.h>
using namespace std;
#define REP(i, s, n) for (int i = s; i < n; ++i)
#define rep(i, n) REP(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define SORT_INV(c) sort((c).begin(), (c).end(), greater<int>())
#define IINF INT_MAX
#define LLINF LLONG_MAX
#define DEBUG false
#define LL long long
// sort(a.begin(), a.end(), std::greater<int>());

int main()
{
    int a, b, c, x, y;
    cin >> a >> b >> c >> x >> y;
    long long int ma = max(x, y);
    long long int money = 0x7fffffff;
    for (long long int i = 0; i <= ma*2; i += 2)
    {
        // i means # AB pizza *
        long long int pizza1 = max((long long int )0, a * (x - i / 2));
        long long int pizza2 = max((long long int )0, b * (y - i / 2));
        long long int pizza3 = (long long int )c * i;
        money = min(money, pizza1 + pizza2 + pizza3);
    }
    cout<<money<<endl;
    return 0;
}


Measured memory_bytes: 256
//============================================================================
// Name        : AOJ.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <cstdio>
using namespace std;

int main() {
	double P=3.141592653589;
	double r;
	cin>>r;

	printf("%lf %lf\n", P*r*r, 2*P*r);



	return 0;
}

Measured memory_bytes: 3216
def partition(a,p,r)
  x = a[r]
  i = p-1
  (p..r-1).each do |j|
    if a[j] <= x
      i = i+1
      a[i],a[j] = a[j],a[i]
    end
  end
  a[i+1],a[r] = a[r],a[i+1]
  return i+1
end

n = gets.to_i
a = gets.split.map(&:to_i)
i = partition(a,0,n-1)
a[i] = "[" + a[i].to_s + "]"
printf("%s\n",a.join(" "))


Measured memory_bytes: 14448
S = list(input())
T = list(input())
s = []
t = []
for i in S:
  s.append(int(ord(i)))
for i in T:
  t.append(int(ord(i)))

s.sort()
t.sort()
for i in range(max(len(s),len(t))):
  if i >= min(len(s),len(t)):
    break
  elif max(t) > s[i]:
    print("Yes")
    exit(0)
  elif s[i] not in t:
    break
  else:
    t.remove(s[i])
    s.remove(s[i])
    
  
if len(t) > len(s):
  for i in s:
    if i not in t:
      print("No")
      exit(0)
    else:
      t.remove(i)
  print("Yes")
else:
  print("No")
 



Measured memory_bytes: 9108
function main(input) {
  input = input.trim();
  const [a,b] = input.split(" ").map(Number);
 
  if(a%3==0 || b%3==0 || (a+b)%3==0){
    console.log("Possible");
  }else{
    console.log("Impossible");
  }
}
main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 31044
#include<iostream>
#include<string.h>

using namespace std;

int main(){
	while(1){
		int h;
		cin >> h;
		if(h == 0) break;
		
		int puzle[10][5];
		int reffer [10][5];
		memset(puzle,0,sizeof(puzle));
		
		for(int i=0;i < h;i++){
			for(int j = 0;j < 5;j++){
				cin >> puzle[i][j];
				reffer[i][j] = i;
			}
		}
		
		int point = 0;
		while(true){
			int lastpoint = point;
			for(int i=0;i < h;i++){
				for(int j = 0;j < 5;j++){
					if(reffer[i][j] == -1) continue;
					int k;
					int left = puzle[reffer[i][j]][j];
					for(k = 1;j+k < 5 && left == puzle[reffer[i][j+k]][j+k];k++){
						
					}
					if(k >= 3){
						point += k*left;
						for(int p = i;p >= 0;p--){
							for(int q = j;q < j+k;q++){
								if(p == 0){
									reffer[p][q] = -1;
								}
								else{
									reffer[p][q] = reffer[p-1][q];
								}
							}
						}
						j += k;
					}
				}
			}
			if(lastpoint == point) break;
		}
		cout << point << endl;
	}
	return 0;
}


Measured memory_bytes: 3072
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
      InputStream inputStream = System.in;
      OutputStream outputStream = System.out;
      Scanner sc = new Scanner(inputStream);
      PrintWriter out = new PrintWriter(outputStream);
      int N = Integer.parseInt(sc.next());
      int A = Integer.parseInt(sc.next());
      int B = Integer.parseInt(sc.next());
      int ans = 0;
      for(int i = 1; i <= N; i++){
        int n = i;
        int digSum = 0;
      	while(0 < n){
          digSum += n % 10;
          n /= 10;
        }
        if(A <= digSum && digSum <= B){
        	ans += i;
        }
      }
      out.println(ans);
      out.close();
    }
}

Measured memory_bytes: 20564
// Problem : C - Slimes
// Contest : AtCoder - AtCoder Beginner Contest 143
// URL : https://atcoder.jp/contests/abc143/tasks/abc143_c
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include<bits/stdc++.h>
#include<set>
#define lli long long int
#define pb push_back
#define rep(i,a,n) for(i=a;i<n;i++)
#define all(v) (v.begin(),v.end())
#define ppb pop_back
#define vsz v.size()
using namespace std;
int main()
{
	lli n,i,k=0;
	cin>>n;
	char c;
	vector<char>v;
	for(i=0;i<n;i++){
		cin>>c;
		v.pb(c);
	}
	for(i=0;i<n-1;i++){
		if(v[i]==v[i+1])
		k++;
	}
	cout<<n-k;	
	return 0;
}

Measured memory_bytes: 3732
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a[3];
    cin>>a[0]>>a[1]>>a[2];
    sort(a,a+3);
    if(a[0]==5&&a[1]==5&&a[2]==7){
       cout<<"YES"<<endl;
    }

    else{
            cout<<"NO"<<endl;
        }
    return 0;
}


Measured memory_bytes: 3560
S = input()
N = len(S)
S += "R"
ans = [0]*N
cnt = 0
point = 0
res = 0

def f(x, y, z):
  global ans
  if x%2 == 0:
    ans[y], ans[y+1] = x//2, x//2
  elif (y - z + 1)%2 == 0:
    ans[y], ans[y+1] = x//2, x//2 + 1
  else:
    ans[y], ans[y+1] = x//2 + 1, x//2
   
for i in range(N):
  A, B = S[i], S[i+1]
  if A == B:
    cnt += 1
  elif A == "R":
    point = i
    cnt += 1
  else:
    cnt += 1
    f(cnt, point, res)
    cnt = 0
    res = i+1

print(*ans)

Measured memory_bytes: 6400
#include "bits/stdc++.h"
using namespace std;


long long lcm(int a, int b) 
{ 
    long long lar = max(a, b); 
    long long small = min(a, b); 
    for (long long i = lar; ; i += lar) { 
        if (i % small == 0) 
            return i; 
    } 
} 


int main(){

int a,b;
cin>>a>>b;

cout<<lcm(a,b);




}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <numeric>
#include <iomanip>
#include <map>
#include <set>
#include <deque>
#include <utility>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repk(i, k, n) for (int i = k; i < n; i++)
#define all(vec) vec.begin(), vec.end()
#define MOD 1e9 + 7
#define INF 1e9
#define SENTINEL 2e9
#define PIE 3.1415926535

template <class T>
inline bool chmin(T &a, T b){if (a > b){a = b;return true;}return false;}
template <class T>
inline bool chmax(T &a, T b){if (a < b){a = b;return true;}return false;}
template <class T>
inline T GCD(T a, T b){if (b == 0) return a; else return GCD(b, a % b);}
template <class T>
inline T LCM(T a, T b) {return (a * b) / GCD(a, b);}

int main(){
    string s, t;
    int a, b;
    cin >> s >> t >> a >> b;
    string u;
    cin >> u;
    if (s==u)
        a--;
    else
    {
        b--;
    
    }
    cout << a << ' ' << b << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(a,b) for(int a=0;a<(b);++a)
#define REP1(i,n) for(int i=1;i<=(n);++i)
#define debug(x) cerr<<#x<<": "<<x<<'\n'
#define all(x) (x).begin(),(x).end()
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define isYES(x) printf("%s\n",(x) ? "YES" : "NO")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define isYes(x) printf("%s\n",(x) ? "Yes" : "No")
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair
#define INF (1<<29)
#define Sp(p) cout<<setprecision(25)<< fixed<<p<<endl
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
#define X first
#define Y second
#define pie 3.14159265358979323846
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;


template<class T=int>
T in(){T x;cin>>x;return (x);}
template<class T>
void print(T& x){cout<<x<<'\n';}

const int MOD =(int)1e9+7;
const int mod =(int)1e9+7;
const int MAX =510000;
ll fac[MAX],finv[MAX],inv[MAX];
void COMint(){
    fac[0]=fac[1]=1;
    finv[0]=finv[1]=1;
    inv[1]=1;
    for(int i=2;i<MAX;i++){
        fac[i]=fac[i-1]*i%MOD;
        inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;
        finv[i]=finv[i-1]*inv[i]%MOD;
    }
}
ll COM(int n,int k){
    if(n<k) return 0;
    if(n<0||k<0)return 0;
    return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD;
}
ll gcd(ll a,ll b){
    if(b==0)return a;
    if(a>b){
        swap(a,b);
    }
    return gcd(a,b%a);
}
ll lcm(ll a,ll b){
    ll g;g=gcd(a,b);
    return a*b/g;
}
bool compare_by_b(pair<int, int> a, pair<int, int> b) {
    if(a.second != b.second){
        return a.second < b.second;
    }else{
        return a.first < b.first;
    }
}

bool compare_by_a(pair<int, int> a, pair<int, int> b) {
    if(a.first != b.first){
        return a.first < b.first;
    }else{
        return a.second < b.second;
    }
}
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

ll RS(ll N,ll P,ll M){
    if(P==0){
        return 1;
    }else{
        if(P%2==0){
            ll t=RS(N,P/2,M);
            return t*t%M;
        }else{
            return N*RS(N,P-1,M)%M;
        }
    }
}
bool greater_pair(pair<ll,ll> a,pair<ll,ll> b){
    if(a.first!=b.first){
        return a.first>b.first;
    }else{
        return a.second>b.second;
    }
}
int main() {
    ios::sync_with_stdio(false);
    int A,B,C,D;
    cin>>A>>B>>C>>D;
    if(A%D>0){
        A=A/D+1;
    }else{
        A=A/D;
    }
    if(C%B>0){
        C=C/B+1;
    }else{
        C=C/B;
    }
    // debug(A);debug(C);
    isYes(A>=C);
    return 0;
}


Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define INF 1e9+7
#define rep(i,n) for(ll i=0;i<n;i++)
#define pii pair<int,int>
#define pll pair<ll,ll>
const int maxn = 200000;
ll mod = INF;

ll a[maxn],b[maxn];
ll n;

int main(){
    cin >> n;
    rep(i,n){
        ll x,y;
        cin >> x>>y;
        a[i]=x+y;
        b[i]=x-y;
    }
    sort(a,a+n);
    sort(b,b+n);
    cout << max(a[n-1]-a[0],b[n-1]-b[0])<<endl;
    return 0;
}

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

#define mp make_pair
#define pb push_back

#define int int64_t
#define ld long double

const int MOD = 1e9+7;
const int N = 1e6+5;

int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int ans=0;
    int n;
    cin>>n;
    for(int i=1;i<=n;i++) {
        for(int j=1;j<=n;j++) {
            for(int k=1;k<=n;k++) {
                ans+=__gcd(i, __gcd(j,k));
            }
        }
    }   
    cout<<ans;

    return 0;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define all(v) begin(v), end(v)
#define FOR(i,a,b) for(int i=(a);i<(int)(b);i++)
#define rep(i,b) FOR(i,0,b)

const int mod = 1e9+7;


signed main(){
  int x;
  cin>>x;

  int lb=0,ub=1000000001;
  while(ub-lb>1){
    int mid=(lb+ub)/2;
    if(mid*(mid+1)/2 >= x){
      ub=mid;
    }else{
      lb=mid;
    }
  }
//  cout<<"lb="<<lb<<"ub="<<ub<<endl;

cout<<ub<<endl;

  return 0;
}


Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;
use std::collections::LinkedList;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char) 
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

#[derive(Clone, Debug)]
struct Query {
    a: usize,
    b: usize,
}

fn main() {
    let a: u64 = read();
    let b: u64 = read();
    let n: u64 = read();

    let x = std::cmp::min(b - 1, n);

    println!("{}", a * x / b - x / b * a);
}


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

int main() {
  int n; string s;
  cin >> n >> s;
  int cntE = 0, cntW = 0;
  vector<int> dpE(n), dpW(n);
  rep(i,n) {
    dpW[i] = cntW;
    if(s[i]=='E') cntE++;
    if(s[i]=='W') cntW++;
    dpE[i] = cntE;
  }

  int ans = n;

  rep(i,n) {
    int tmp = dpE[n-1] - dpE[i] + dpW[i];
    ans = min(ans, tmp);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 6152
#include <stdio.h>

int main(void) {
	unsigned long long int X, ret;
	unsigned short i;
	scanf("%llu%*c", &X);
	ret = 100;
	for (i = 0; ret < X; i++) {
		ret += ret * 0.01;
	}
	printf("%hu\n", i);
	return 0;
}


Measured memory_bytes: 1736
n,k = map(int,input().split())
s = list(input())

if s[k-1] == 'A':
    s[k-1] = 'a'
elif s[k-1] == 'B':
    s[k-1] = 'b'
else:
    s[k-1] = 'c'
res = ''
for e in s:
    res += e
print(res)

Measured memory_bytes: 3060
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=0
for i in range(n):
  if a[i]>b[i]:
    c+=b[i]
  elif a[i]<=b[i]:
   
    if a[i+1]-(b[i]-a[i])>=0:
      c+=b[i]
      a[i+1]-=(b[i]-a[i])
    else:
      c+=a[i+1]+a[i]
      a[i+1]=0
print(c)



Measured memory_bytes: 18624
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define int_Max 2147483647
#define ll_Max 9223372036854775807
#define REP(i,f,n) for(int i=f; i<(n); i++)

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

  //--debug : end_stoper
  //string end_stoper; cin >> end_stoper;

  return 0;
}

Measured memory_bytes: 3728
import heapq

N, M = map(int,input().split())
a = list(map(int,input().split()))
count = 0

for i in heapq.nlargest(M,a):
    if(1 / (4 * M) <= i / sum(a)):
        count += 1

if(count >= M):
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define mo 1000000007
using namespace std;
int n,m,ans;
map<int,int> mp;
int mi(int a,int x)
{
	int ans=1;
	while (x)
	{
		if (x&1) ans=(long long)ans*a%mo;
		a=(long long)a*a%mo;
		x>>=1;
	}
	return ans;
}
int work(int p)
{
	if (mp.count(p)) return mp[p];
	int ans=0;
	for (int i=1;i*i<=p;i++) if (p%i==0)
	{
		if (i!=p) ans=(ans-work(i))%mo;
		if ((p/i!=i)&&(p/i!=p)) ans=(ans-work(p/i))%mo;
	}
	ans=(ans+mo)%mo;
	if (n/p%2==0) ans=(ans+mi(m,p))%mo;
	else if (p&1) ans=(ans+mi(m,(p+1)/2))%mo;
	else ans=(ans+mi(m,p/2))%mo;
	//if ((n%(2*p)==0)&&(2*p!=n)) ans=(ans+mi[2*p]-mi[p])%mo;
	return mp[p]=ans;
}
int main()
{
	scanf("%d%d",&n,&m);
	//mi[0]=1;for (int i=1;i<=n;i++) mi[i]=(long long)mi[i-1]*m%mo;
	//for (int i=1;i*i<=n;i++) if (n%i==0) {ans+=work(i);ans+=work(n/i);}
	work(n);
	int ans=0;
	for (map<int,int>::iterator it=mp.begin();it!=mp.end();it++)
	{
		//cerr<<it->first<<' '<<it->second<<endl;
		//if ((it->first==n)&&(it->first!=1)) continue;
		ans=(ans+(long long)it->first*it->second)%mo;
	}
	printf("%d\n",ans);
}

Measured memory_bytes: 256
n = gets.to_s.to_i

g = Array.new(n){ [] }
(n-1).times do |i|
  a, b = gets.to_s.split.map{|t| t.to_i - 1 }
  g[a] << [b, i]
  g[b] << [a, i]
end

q = [0, -1, -1]

ans = Array.new(n-1)
while q.any?
  v, parent, parent_color = q.pop
  color = 0
  g[v].each do |(u, i)|
    next if u == parent
    # p [v, color] if i == 0
    color += 1
    color += 1 if color == parent_color
    # p [v, color] if i == 0
    ans[i] = color
    q << [u, v, color]
  end
end
# puts "ans"
puts ans.max, ans

Measured memory_bytes: 27900
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
#define sp(x) fixed << setprecision(x)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const int inf = (1<<30)-1;
const ll INF = (1LL<<60)-1;
const ld EPS = 1e-10;
template<typename T> bool chmax(T &x, const T &y) {return (x < y)? (x = y, true) : false;};
template<typename T> bool chmin(T &x, const T &y) {return (x > y)? (x = y, true) : false;};

int main(){
    int N;
    cin >> N;
    int A[N];
    rep(i, N) cin >> A[i];
    vector<int> cnt(1<<20, 0);
    rep(i, N) cnt[A[i]]++;
    int ans = 0;
    rep(i, N){
        vector<int> ds;
        for(int j = 1; j*j <= A[i]; j++){
            if(A[i]%j == 0){
                ds.pb(j), ds.pb(A[i]/j);
            }
        }
        bool able = true;
        for(auto &e: ds){
            if(e == A[i] && cnt[e] > 1) able = false;
            if(e != A[i] && cnt[e]) able = false;
        }
        if(able) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 8276
N = int(input())
C = input()

i= 0
j = N - 1
cnt = 0
while i < j:
    if C[i] == 'W':
        while i < j:
            if C[j] == 'R':
                cnt += 1
                j -= 1
                break
            j -= 1
    i += 1
print(cnt)


Measured memory_bytes: 9432
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <sstream>
#include <string>

using namespace std;

void solve(int a, int b) { printf("%d\n", max({a + b, a - b, a * b})); }

int main() {
  int a, b;
  cin >> a >> b;
  solve(a, b);
  return 0;
}

Measured memory_bytes: 888
#include <stdio.h>

long long int gcd(long long int x, long long int y) {
    return y ? gcd(y, x % y) : x;
}

long long int lcm(long long int x, long long int y) {
    return x/gcd(x, y)*y;
}

int main()
{
    int N, i;
    long long int ans = 1LL;
    long long int T;

    scanf("%d", &N);

    for (i = 0; i < N; i++) {
        scanf("%ld", &T);
        ans = lcm(ans, T);
    }
    printf("%lld\n", ans);

    return 0;
}

Measured memory_bytes: 128
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; ++i)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = int64_t;
using ld = long double;
using P = pair<int, int>;
using vs = vector<string>;
using vi = vector<int>;
using vvi = vector<vi>;
template<class T> using PQ = priority_queue<T>;
template<class T> using PQG = priority_queue<T, vector<T>, greater<T> >;
const int INF = 100010001;
const ll LINF = (ll)INF*INF*10;
template<typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) {return a < b && (a = b, true);}
template<typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) {return a > b && (a = b, true);}
template<typename T1, typename T2>
istream &operator>>(istream &is, pair<T1, T2> &p) { return is >> p.first >> p.second;}
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) { return os << p.first << ' ' << p.second;}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    int res = 0;
    rep(i, n) {
        int a;
        cin >> a;
        if(~i&1 and a&1) {
            res++;
        }
    }

    cout << res << endl;
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define nl "\n"
#define rep(i,n) for(ll i=0; i<(n); i++)
typedef vector<ll> vl;
typedef vector<vector<ll>> matrix;//matrix A(n, vl(m)); //n*m行列
typedef vector<string> vs;
typedef pair<ll,ll> pl;
typedef vector<pl> vp;
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define sortup(V) sort(V.begin(), V.end())
#define sortdown(V) sort(V.rbegin(), V.rend())
template<class T>bool chmax(T &a, const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a, const T &b){if(b<a){a=b;return 1;}return 0;}
#define MOD 1000000007 //998244353


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

    // solution comes here

    ll N, A;
    cin >> N >> A;
    vl x(N+1);
    rep(i, N) cin >> x[i+1];//1-indexed

    vector<matrix> dp(N+1, matrix(N+1, vl(2600)));
    rep(i, N+1) dp[i][0][0] = 1;
    ll i, j, k;
    for(i=1; i<=N; i++) {
        for(j=1; j<=N; j++) {
            for(k=1; k<=2500; k++) {
                dp[i][j][k] += dp[i-1][j][k];
                if(k>=x[i]) dp[i][j][k] += dp[i-1][j-1][k-x[i]];
            }
        }
    }

    ll ans=0;
    for(j=1; j<=N; j++) ans += dp[N][j][j*A];
    cout << ans << nl;
}

Measured memory_bytes: 54272
#include<iostream>
#include<cstdio>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<math.h>
#include<numeric>
#include<iomanip>
#include<queue>
#include<functional>

using namespace std;

typedef vector<int> vi;
typedef pair<int, int> pii;
typedef long long ll;
typedef vector<long long> vll;
typedef pair<long long, long long> pll;

//const ll INF = 1e15;
const ll MOD = 1e9 + 7;

int main(){
	ll N, Y;
	cin >> N >> Y;
	int i, j, k;
	bool flg = false;
	for (i = 0; i <= N; i++){
		for (j = 0; j <= N - i; j++){
			k = N - i - j;
			if (10000 * i + 5000 * j + 1000 * k == Y){
				flg = true;
				break;
			}
		}
		if (flg){
			break;
		}
	}
	if (!flg){
		cout << -1 << ' ' << -1 << ' ' << -1 << endl;
	}
	else{
		cout << i << ' ' << j << ' ' << k << endl;
	}
	return 0;
}

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

using ll = long long;

int main () {
    ll A, B, K;

    cin >> A >> B >> K;

    A -= K;
    if (A < 0) {
        B += A;
        A = 0;
    }
    if (B < 0) {
        B = 0;
    }

    cout << A << ' ' << B << endl;
    
    return 0;
}


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

int main() 
{
  int n;
  cin >> n;
  vector<int> data;
  for(int i = 1; i < n; i++)
  { 
    int a = i;
    int b = n - a;
    if(a > b)
    { 
      break;
    }
    int answer = 0;
    while(a > 0)
    {
      answer += a % 10;
      a /= 10;
    }
    while(b > 0)
    {
      answer += b % 10;
      b /= 10;
    }
    data.push_back(answer);
  }
  sort(begin(data), end(data));
  cout << data.at(0) << endl;
}


Measured memory_bytes: 640
#include <iostream>
#include <list>
#include <stack>
#include <limits.h>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <memory>
#include <regex>
#include <set>
#include <functional>
#include <cmath>
#include <thread>
using namespace std;


int main(void)
{
    string num;;
    cin >> num;
    int res = num[0] - '0';
    int carry = 0;
    for (int i = num.size() - 1; i > 0; i--)
    {
        int currDigit = (num[i] - '0') - carry;
        res += 9;
        if (currDigit != 9)
        {
            carry = 1;
        }
    }
    cout << (res - carry) << endl;
}



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

int d[10][10];

inline void drop2(int x, int y) {
	if (x>=0 && x<10 && y>=0 && y<10)
		d[y][x]++;
}

void drop(int x, int y, int size) {
	if (size == 1) {
		drop2(x-1, y);
		drop2(x, y-1);
		drop2(x, y);
		drop2(x, y+1);
		drop2(x+1, y);
	} else if (size == 2) {
		for (int i = -1; i <= 1; i++)
			for (int j = -1; j <= 1; j++)
				drop2(x+i, y+j);
	} else /* if (size == 3 */ {
		for (int i = -1; i <= 1; i++)
			for (int j = -1; j <= 1; j++)
				drop2(x+i, y+j);
		drop2(x-2, y);
		drop2(x, y-2);
		drop2(x, y+2);
		drop2(x+2, y);
	}
}

int main() {
	int x, y, size;
	for (int y = 0; y < 10; y++)
		for (int x = 0; x < 10; x++)
			d[y][x] = 0;
	
	while (scanf("%d,%d,%d", &x, &y, &size) == 3) {
		drop(x, y, size);
	}

	int zeronum = 0;
	int maxnum = 0;
	for (int y = 0; y < 10; y++) {
		for (int x = 0; x < 10; x++) {
			if (d[y][x] == 0)
				zeronum++;
			if (d[y][x] > maxnum)
				maxnum = d[y][x];
		}
	}
	cout << zeronum << endl;
	cout << maxnum << endl;
	return 0;
}

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

using namespace std;

int main()
{

  int a[32] = {1,
               1,
               1,
               2,
               1,
               2,
               1,
               5,
               2,
               2,
               1,
               5,
               1,
               2,
               1,
               14,
               1,
               5,
               1,
               5,
               2,
               2,
               1,
               15,
               2,
               2,
               5,
               4,
               1,
               4,
               1,
               51};
  int K;

  cin >> K;

  cout << a[K - 1] << endl;
}

Measured memory_bytes: 256
input()
myarr = list(map(int, input().split()))
for i in range(len(myarr)):
    for j in range(i, 0,-1):
        if myarr[j] < myarr[j-1]:
            t = myarr[j]
            myarr[j] = myarr[j-1]
            myarr[j-1] = t
        else:
            break
    print(" ".join(map(str, myarr)))
        
    


Measured memory_bytes: 5596
// B - 0 or 1 Swap
#include <bits/stdc++.h>

using namespace std;

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

	int n;
	cin >> n;
	vector<int> a(n);
	for (int i = 0; i < n; i++) cin >> a[i];
	int c = 0;
	for (int i = 0; i < n; i++)
		if (a[i] != i + 1) c++;

	cout << (c <= 2 ? "YES" : "NO") << endl;

	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<stack>
using namespace std;
bool f[1000001];
typedef long long ll;
int main(){
	int n,k=1;
	cin>>n;
	f[n]=1;
	while(1){
		k++;
		if(n%2==0){
			n/=2;
		}
		else{
			n=3*n+1;
		}
		if(!f[n]){
			f[n]=true;
		}
		else{
			cout<<k;
			break;
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll MOD=(ll)1e9+7;

ll dp[3010][3010];

int main(){
    int N; cin>>N;
    vector<int> a(N);
    for (int i = 0; i < N; ++i) {
        cin>>a[i];
    }
    memset(dp,0, sizeof(dp));

    for (int len = 1; len <= N; ++len) {
        for (int i = 0; i+len <= N; ++i) {
            int j=i+len;

            if((N-len)%2==0) dp[i][j]=max(dp[i+1][j]+a[i],dp[i][j-1]+a[j-1]); //先手
            else dp[i][j]=min(dp[i+1][j]-a[i],dp[i][j-1]-a[j-1]); //後手
        }
    }
    cout<<dp[0][N]<<endl;
    return 0;
}

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

using namespace std;
using ll = long long;

int main(int argc, const char *argv[]) {
  int n, m, l;
  cin >> n >> m >> l;

  vector<vector<ll>> d(n, vector<ll>(n, -1));
  for (int i = 0; i < m; ++i) {
    ll a, b, c;
    cin >> a >> b >> c;
    a--;
    b--;
    d[a][b] = c;
    d[b][a] = c;
  }

  int q;
  cin >> q;

  auto warshall_floyd = [&]() {
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < n; j++) {
        for (int k = 0; k < n; k++) {
          if (d[j][i] < 0 || d[i][k] < 0) {
            continue;
          }

          if (d[j][k] < 0 || d[j][k] > d[j][i] + d[i][k]) {
            d[j][k] = d[j][i] + d[i][k];
          }
        }
      }
    }
  };

  warshall_floyd();

  // 距離l以下のノードに辺を張る
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n; ++j) {
      if (d[i][j] < 0) {
        continue;
      }

      if (d[i][j] <= l) {
        d[i][j] = 1;
      } else {
        d[i][j] = -1;
      }
    }
  }

  warshall_floyd();

  vector<int> ans(q);
  for (int i = 0; i < q; ++i) {
    int s, t;
    cin >> s >> t;
    s--;
    t--;
    ans[i] = d[s][t];
  }

  for (int i = 0; i < q; ++i) {
    if (ans[i] == -1) {
      cout << ans[i] << '\n';
    } else {
      cout << ans[i] - 1 << '\n';
    }
  }
}

Measured memory_bytes: 4328
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define fi first
#define se second
typedef pair<ll,ll> P;
using VP = vector<P>; using VVP = vector<VP>;
using VI = vector<int>; using VVI = vector<VI>; using VVVI = vector<VVI>;
const int inf=1e9+7;
const ll INF=1LL<<61;
const ll mod=1e9+7;

int main(){
  int i,j;
  int n;
  string s;
  cin>>n>>s;
  int cnt=0;
  for(i=0;i<n-2;i++){
    if(s[i]=='A'&&s[i+1]=='B'&&s[i+2]=='C') cnt++;
  }
  cout<<cnt<<endl;
  
  return 0;
}


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

int a[12][12];
int main() {
  ios::sync_with_stdio(0); cin.tie(0);
  int n, m, x;
  cin >> n >> m >> x;
  vector<int> cost(n);
  for (int i = 0; i < n; i++) {
    cin >> cost[i];
    for (int j = 0; j < m; j++) {
      cin >> a[i][j];
    }
  }
  int ans = 1e9;
  for (int i = 0; i < 1<<n; i++) {
    int ok = 1, sumcost = 0;
    for (int k = 0; k < n; k++)
      if (i>>k&1) sumcost += cost[k];
    for (int j = 0; j < m; j++) {
      int sum = 0;
      for (int k = 0; k < n; k++) {
	sum += (i>>k&1)*a[k][j];
      }
      if (sum < x) ok = 0;
    }
    if (ok) ans = min(ans, sumcost);
  }
  if (ans == 1e9) ans = -1;
  cout << ans << endl;
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
#define rep( i, n ) for( int ( i ) = 0; ( i ) < ( n ); ( i )++ )
#define repr( i, n ) for( int ( i ) = ( n ); ( i ) >= 0; ( i )-- )
#define FOR( i, m, n ) for( int ( i ) = ( m ); ( i ) < ( n ); ( i )++ )
#define all( x ) ( x ).begin(), ( x ).end()
typedef long long lint;
using namespace std;

int main( void ){
	
	lint h, w;
	string str, ret;
	char c;
	
	cin >> h >> w;
	
	rep(i,h){
		rep(j,w){
			cin >> str;
			if( str == "snuke"){
				c = 'A' + j;
				ret = c + to_string(i + 1);
			}
		}
	}
	cout << ret << endl;
	
	return 0;
	
}

Measured memory_bytes: 256
//A.cpp
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <vector>
using namespace std;

int main(){
  string S;
  cin >> S;
  bool flag = true;

  if(S[0]!='A') flag = false;

  int cnt = 0;
  int memo;
  for(int i = 2; i < S.size()-1; i++){
    if(S[i]=='C') ++cnt, memo = i;
  }
  if(cnt != 1) flag = false;

  if(flag){
    for(int i = 1; i < S.size(); i++){
      if(i==memo) continue;
      bool mflag = false;
      for(int j = 0; j < 26; j++){
        if(S[i]=='a'+j) mflag = true;
      }
      if(!mflag){
        flag = false;
        break;
      }
    }
  }

  if(flag) printf("AC\n");
  else printf("WA\n");
  return 0;

}


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

int main(){
  int N;
  cin >> N;
  int sum=0;
  vector<int> w(N);
  for(int i=0;i<N;i++){
    cin >> w[i];
    sum += w[i];
  }
  int mini=sum;
  int p_sum=0;
  for(int i=0;i<N;i++){
    p_sum+=w[i];
    mini=min(mini,abs(p_sum-(sum-p_sum)));
  }

  cout << mini << endl;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <queue>
#include <queue>
#include <stdio.h>
#include <string>

using namespace std;

void solve(int A, int B, int C) {
  int ans = min(B / A, C);
  cout << ans << endl;
}

int main() {
  int A, B, C;
  cin >> A >> B >> C;
  solve(A, B, C);
  return 0;
}

Measured memory_bytes: 888
import java.util.Scanner;

public class Main {
	static int H;
	static int W;
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		H = sc.nextInt();
		W = sc.nextInt();
		String[] S = new String[H];
		int[][][] num = new int[H][W][2];
		
		for(int i = 0; i < H; i++) {
			S[i] = sc.next();
		}
		
		int ans = 0;
		
		for(int i = 0; i < H; i++) {
			for(int j = 0; j < W; j++) {
				if(S[i].charAt(j) == '.') {
					int temp = Lamp(i, j, S, num);
					ans = Math.max(ans, temp);
				}
			}
		}
		System.out.println(ans);
	}
	
	public static int Lamp(int a, int b, String[] S, int[][][] num) {
		if(b > 0 && S[a].charAt(b - 1) == '.') {
			num[a][b][0] = num[a][b - 1][0];
		} else {
			for(int i = b; i >= 0; i--) {
				if(S[a].charAt(i) == '.') {
					num[a][b][0]++;
				} else {
					break;
				}
			}
			
			for(int i = b + 1; i < W; i++) {
				if(S[a].charAt(i) == '.') {
					num[a][b][0]++;
				} else {
					break;
				}
			}
		}
		
		if(a > 0 && S[a - 1].charAt(b) == '.') {
			num[a][b][1] = num[a - 1][b][1];
		} else {
			for(int i = a; i >= 0; i--) {
				if(S[i].charAt(b) == '.') {
					num[a][b][1]++;
				} else {
					break;
				}
			}
			
			for(int i = a + 1; i < H; i++) {
				if(S[i].charAt(b) == '.') {
					num[a][b][1]++;
				} else {
					break;
				}
			}
		}
		
		return num[a][b][0] + num[a][b][1] - 1;
	}
}


Measured memory_bytes: 163628
#include <bits/stdc++.h>
#define sz(c)       int(c.size())
#define rep(i,a,b)  for (int i=a; i<(b); ++i)
#define per(i,a,b)  for (int i=(b)-1; i>=(a); --i)
#define fore(c,...) for (auto __VA_ARGS__:(c))
using namespace std;
typedef long long ll;



int main() {
	cin.tie(0);
	ios_base::sync_with_stdio(0);
	cout<<fixed<<setprecision(10);

	int a,b,c;
	cin>>a>>b>>c;
	swap(a,b);
	swap(a,c);
	cout<<a<<" "<<b<<" "<<c<<'\n';
}


Measured memory_bytes: 256
/*{{{*/
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<string>
#include<iostream>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include<bitset>
#include<vector>
#include<limits.h>
#include<assert.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define FOR(I, A, B) for (int I = (A); I <= (B); ++I)
#define FORS(I, S) for (int I = 0; S[I]; ++I)
#define RS(X) scanf("%s", (X))
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<PII> VPII;
typedef pair<LL,LL> PLL;
typedef vector<PLL> VPLL;
template<class T> void _R(T &x) { cin >> x; }
void _R(int &x) { scanf("%d", &x); }
void _R(LL &x) { scanf("%lld", &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template<class T, class... U> void R(T &head, U &... tail) { _R(head); R(tail...); }
template<class T> void _W(const T &x) { cout << x; }
void _W(const int &x) { printf("%d", x); }
void _W(const LL &x) { printf("%lld", x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template<class T,class U> void _W(const pair<T,U> &x) {_W(x.F); putchar(' '); _W(x.S);}
template<class T> void _W(const vector<T> &x) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W(const T &head, const U &... tail) { _W(head); putchar(sizeof...(tail) ? ' ' : '\n'); W(tail...); }
#ifdef HOME
 #define DEBUG(...) {printf("# ");printf(__VA_ARGS__);puts("");}
#else
 #define DEBUG(...)
#endif
int MOD = 1e9+7;
void ADD(LL& x,LL v){x=(x+v)%MOD;if(x<0)x+=MOD;}
/*}}}*/
const int SIZE = 1e6+10;
int main(){
    int X,N; R(X,N);
    int ll=1,rr=X;
    FOR(i,1,N){
        int L,r;
        R(L,r);
        ll=max(L,ll);
        rr=min(rr,r);
    }
    W(max(rr-ll+1,0));
    return 0;
}


Measured memory_bytes: 256