akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <iomanip>
#include <fstream>
#include <sstream>
#include <string>
#include <cmath>
#include <cstdio>
#include <cctype>
#include <ctime>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <complex>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cwchar>
#include <cwctype>
#include <exception>
#include <locale>
#include <numeric>
#include <new>
#include <stdexcept>
#include <limits>
#include <valarray>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <list>
#include <utility>
#include <bitset>
#include <algorithm>
#include <functional>
#define rep(i, n) for(int i = 0; i < (int)(n); i ++)
#define rep1(i, n) for(int i = 1; i <= (int)(n); i ++)
#define MP make_pair
using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
const int INF = 1e9 + 7;

string S, ans;
set<string> subs;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int k;
	cin >> S >> k;
	rep(i, S.length()) rep1(j, k)
	if(i + j <= S.length()) subs.insert(S.substr(i, j));
	rep(i, k) {
		ans = *subs.begin();
		subs.erase(subs.begin());
	}
	cout << ans << '\n';
	return 0;
}

Measured memory_bytes: 1664
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int max = 0;
        int result = 0;
        for(int i=0;i<n;i++){
          int tmp = sc.nextInt();
          if(tmp >= max){
            result++;
            max = tmp;
          }
        }
      System.out.println(result);
	}
}

Measured memory_bytes: 21716
#include<iostream>
#include<vector>
#include<algorithm>
#include <queue>
#include<string>
#include<utility>
#include<iterator>
#include<regex>
#include<math.h>
#include<numeric>

#define lli long long
#define all(i) i.begin(),i.end()
#define rall(i) i.rbegin(),i.rend()
#define rep0(i,j) for(lli i=0;i<j;i++)
#define rep1(i,j) for(lli i=1;i<=j;i++)
#define rep0d(i,j) for(lli i=j-1;i>=0;i--)
#define MAX 1000000007
typedef struct tree Tree;

using namespace std;

bool cmpf(pair<lli, lli> left, pair<lli, lli> right) {
	return left.first < right.first;
}
bool cmp(pair<lli, lli> left, pair<lli, lli> right) {
	if (left.first != right.first)return left.first < right.first;
	else return left.second < right.second;
}

int main() {
	lli n;
	cin >> n;
	vector<lli>vec(n - 1), ans(n);
	rep0(i, n - 1)cin >> vec[i];
	ans[0] = vec[0];
	rep1(i, n - 2) {
		ans[i] = min(vec[i], vec[i - 1]);
	}
	ans[n - 1] = vec[n - 2];
	
	cout << accumulate(all(ans),0);
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a)  (a).begin(),(a).end()
#define vi vector<int>
#define pb push_back
#define INF 999999999
//#define INF (1LL<<59)

int main(){
    vector<ll> inp(3);
    rep(i,3)cin>>inp[i];
    
    
    sort(all(inp));
    
    
    rep(i,3){
        if(inp[i]%2==0){
            cout<<0<<endl;
            return 0;
        }
    }
    
    
    cout<<inp[0]*inp[1]<<endl;
    
    
}

Measured memory_bytes: 256
/// In the name of God
#include <bits/stdc++.h>
//#define int long long
using namespace std;
typedef pair<int,int> pii;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
#define X first
#define Y second
#define all(o) o.begin(), o.end()
#define IOS ios::sync_with_stdio(0), cin.tie(0)
const int maxn = 2e5 + 10;
vi adj[maxn];
int col[maxn];
vi ver;
void dfs(int v,int c){
    if(col[v] != -1) return;
    col[v] = c;
    ver.push_back(v);
    for(auto u : adj[v])
        dfs(u, 1^c);
}
main(){
    IOS;
    int n, m;
    cin >> n >> m;
    memset(col, -1, sizeof col);
    for(int i=0; i<m; i++){
        int u, v;
        cin >> u >> v;
        u--, v--;
        adj[u].push_back(v);
        adj[v].push_back(u);
    }
    ll tot = 0, zer = 0;
    for(int i=0; i<n; i++)
        if(adj[i].size() == 0) zer++;
    tot += zer * zer + 2LL * zer * (n - zer);
    ll bip = 0, n_bip = 0;
    for(int i=0; i<n; i++){
        if(col[i] != -1) continue;
        ver.clear();
        dfs(i, 0);
        //for(auto i : ver)
        //    cout << i + 1 << "**";
        //cout << endl;
        bool bi = 1;
        for(auto v : ver)
            for(auto u : adj[v])
                if(col[u] == col[v])
                    bi = 0;
        if(ver.size() == 1) continue;
        if(bi) bip++;
        else n_bip++;
    }
    tot += 2LL * bip * bip;
    tot += n_bip * bip * 2;
    tot += n_bip * n_bip;
    cout << tot << endl;
}


Measured memory_bytes: 13180
import java.util.*;

public class Main{
  public static void main(String[] args){
    
    Scanner sc = new Scanner(System.in);
    
    int numberA = sc.nextInt();
    int numberB = sc.nextInt();
    
    if(numberB%numberA == 0){
      System.out.println(numberA + numberB);
    }else {
      System.out.println(numberB - numberA);
    }
    
  }
}

Measured memory_bytes: 23892
#include <iostream>
#include <cmath>
using namespace std;
bool isPrime(int n){
  //??\???????????°n???Prime??????1???????????¢??°
  if(n == 2) return true; //2????´???°
  if(n < 2 || n % 2 == 0) return false; //1??¨??¶??°?????????
  for(int i = 3; i <= sqrt((double)n); i += 2)
    if(n % i == 0) return false;
  return true;
}

int main(){
  int n,times=0;
  cin >> n;
  int A[n];
  for(int i= 0; i < n; i++){
    cin >> A[i];
    if(isPrime(A[i])) times++;
  }
  cout << times << endl;
}

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

int A[3];
int main(){
	while(cin >> A[0] >> A[1] >> A[2] && !(A[0] == -1 && A[1] == -1 && A[2] == -1)){
		int a = A[0] + A[1];
		if(A[0] == -1 || A[1] == -1) cout << "F" << endl;
		else if(a>=80) cout << "A" << endl;
		else if(a<80 && a>=65) cout << "B" << endl;
		else if(a<65 && a>=50) cout << "C" << endl;
		else if(a<50 && a>=30){
			if(A[2]>=50) cout << "C" << endl;
			else cout << "D" << endl;
		}
		else if(a<30) cout << "F" << endl;
	}
}


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

const int mod = 1000000007;

int main(){
    string s;
    cin >> s;
    string t = "";
    string k = "";
    int t0 = 0;
    int t1 = 0;
    int k1 = 0;
    int k0 = 0;
    if(s.size()==1){
        cout << '0' << endl;
        return 0;
    }
    for (int i = 0; i < s.size(); i += 2)
    {
        if(s[i]=='0'){
            t0++;
        }else{
            t1++;
        }
        if(i+1<s.size()){
            if(s[i+1]=='0'){
                k0++;
            }else{
                k1++;
            }
        }
    }
    int ans = min(t0 + k1, t1 + k0);
    cout << ans << endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimize("03")
#pragma GCC optimize("unroll-loops")
#define rep(i,n) for(int i=0;i<(n);++i)
#define rrep(i,n) for(int i=1;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define dunk(a) cout << (a) << "\n"
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int inf = 1001001001;
const int mod = 1000000007;

vector<vector<P>> G(100001);
vector<int> ans;

void dfs(int a, int d = -1, int p = -1) {
	int tmp = 1;
	for (auto& c : G[a]) {
		int land = c.first, bridge = c.second;
		if (land == p) continue;
		if (tmp == d) tmp++;
		ans[bridge] = tmp; tmp++;
		dfs(land, ans[bridge], a);
	}
	return;
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n; cin >> n;
	rep(i, n - 1) {
		int a, b; cin >> a >> b;
		a--; b--;
		G[a].emplace_back(b, i);
		G[b].emplace_back(a, i);
	}
	ans.resize(n - 1, -1);
	dfs(0);
	int j_ans = 0;
	rep(i, n) j_ans = max(j_ans, (int)G[i].size());
	dunk(j_ans);
	rep(i, n - 1) dunk(ans[i]);
	return 0;
}


Measured memory_bytes: 7040
#include <bits/stdc++.h>
using namespace std;using ll=int_fast64_t;using ld=long double;using pll=pair<ll,ll>;using pld=pair<ld,ld>;
const ll INF=1LL<<60;void solve();int main(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(10);solve();}
#define foreach(i,a) for(auto &i:a)
#define SELECTOR(_1,_2,_3,_4,SELECT,...) SELECT
#define rep(...) SELECTOR(__VA_ARGS__,_rep2,_rep1,_rep0)(__VA_ARGS__)
#define _rep0(i,n) for(ll i=0;i<n;++i)
#define _rep1(i,k,n) for(ll i=k;i<n;++i)
#define _rep2(i,k,n,d) for(ll i=k;d!=0&&d>0?i<n:i>n;i+=d)
template<class T> vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
template<class... Ts> auto make_v(size_t a,Ts... ts){return vector<decltype(make_v(ts...))>(a,make_v(ts...));}
template<class T> inline bool chmax(T &a,const T &b){if(a<b){a=b; return 1;} return 0;}
template<class T> inline bool chmin(T &a,const T &b){if(a>b){a=b; return 1;} return 0;}

using ull=unsigned long long;
using M=vector<vector<ull>>;
ull m;

ull modpow(ull a,ull p){
  ull res=1;
  ull power = a;
  while(p){
    if(p&1){
      res*=power;
      res%=m;
    }
    power*=power;
    p>>=1;
  }
  return res;
}

ull fastpow(ull a,ull p){
  ull res=1;
  ull power = a;
  while(p){
    if(p&1){
      res*=power;
    }
    power*=power;
    p>>=1;
  }
  return res;
}

M mat_mul(const M& A, const M& B){
  M C{{0,0,0},{0,0,0},{0,0,0}};
  rep(i,3)rep(j,3)rep(k,3) {
    C[i][j]+=A[i][k]*B[k][j];
    C[i][j]%=m;
  }
  return C;
}


void solve(){
  ull l,a,b; cin>>l>>a>>b>>m;
  vector<ull> C(19,0);
  rep(d,1,19){
    if((ll)pow(10,d)-1-(ll)a>=0){
      C[d]=((ll)pow(10,d)-1-(ll)a)/b+1;
    } else {
      C[d]=0;
    }
  }
  rep(d,18,0,-1){
    C[d]-=C[d-1];
  }
  rep(d,1,19){
    C[d]=min(l,C[d]);
    l-=min(l,C[d]);
  }

  M A{{1,0,0},{0,1,0},{0,0,1}};
  rep(d,1,19){
    M res{{1,0,0},{0,1,0},{0,0,1}};
    M power{{modpow(10,d),1,0},{0,1,b%m},{0,0,1}};
    ull p=C[d];
    while(p){
      if(p&1) res=mat_mul(res,power);
      power=mat_mul(power,power);
      p>>=1;
    }
    A=mat_mul(res,A);
  }
  ull ans=0;
  ans+=(a%m)*(A[0][1])%m;
  ans+=A[0][2];
  cout<<ans%m<<"\n";
}

Measured memory_bytes: 256
a, b = map(int, input().split())
a_list = [x for x in range(20000) if int(x*0.08) == a]
b_list = [x for x in range(20000) if int(x*0.1) == b]
a_list.extend(b_list)
new_list = sorted([x for x in set(a_list) if a_list.count(x) >1])
if len(new_list) != 0:
    print(new_list[0])
else:
    print(-1)

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <numeric>
#include <cstdint>
#include <iomanip>
#include <set>
#include <map>
#include <unordered_map>
#include <cassert>
using ll = long long;
#define fast_io(); std::ios_base::sync_with_stdio(0); std::cin.tie(0); std::cout.tie(0);

int main(){
    ll a,b,c,k; std::cin >> a >> b >> c >> k;
    std::cout << (( k%2 )?( b-a ):( a-b )) << "\n";
    return 0;
}


Measured memory_bytes: 3532
from collections import deque
import sys

N = int(input())

if N == 1:
    print ("First")
    sys.exit()


dic = {}

for  i in range(N-1):

    a,b = map(int,input().split())
    a-=1
    b-=1

    if a not in dic:
        dic[a] = []
    if b not in dic:
        dic[b] = []

    dic[a].append(b)
    dic[b].append(a)

for xxx in range(1):

    lis = [float("inf")] * N
    lis[0] = 0
    maxind = 0
    q = deque([0])

    while len(q) > 0:

        now = q.popleft()

        for nex in dic[now]:

            if lis[nex] > lis[now] + 1:
                lis[nex] = lis[now] + 1
                q.append(nex)
                maxind = nex

    lis = [float("inf")] * N
    lis[maxind] = 1
    q = deque([maxind])
    L = 0

    while len(q) > 0:

        now = q.popleft()

        for nex in dic[now]:

            if lis[nex] > lis[now] + 1:
                lis[nex] = lis[now] + 1
                q.append(nex)
                L = lis[nex]

    #print (lis)
    #print (L)

    if L == 1 or L % 3 != 2:

        print ("First")

    else:

        print ("Second")



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

int sosu[300000];
int main()
{

	sosu[1] = 1;
	for (int i = 2; i < 300000; i++){
		if (i % 7 == 2 || i % 7 == 3 || i % 7 == 4 || i % 7 == 5 || i % 7 == 0){
			sosu[i] = 1;
			continue;
		}
		int sq = sqrt(i);
		for (int j = 2; j <= sqrt(i); j++){
			if (i % j == 0 && (sosu[j] == 0 || sosu[i/j] == 0)){
				sosu[i] = 1;
				break;
			}
		}
	}

	int n;
	while (cin >> n, n != 1){
		cout << n << ":";
		for (int i = 1; i <= n; i++){
			if (sosu[i] == 0 && n % i == 0)
				cout << " " << i;
		}
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 2332
#include <ctype.h>
#include <float.h>
#include <inttypes.h>
#include <limits.h>
#include <signal.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <math.h>
#ifdef __cplusplus
#include <bits/stdc++.h>
#endif
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
//#pragma GCC optimize("unroll-loops")

//char rbuf[]; int rbufl;
//#define getchar() rbuf[rbufl++]
#define getchar getchar_unlocked
#define putchar putchar_unlocked
int32_t nextint(void){ char c=getchar(); while(c!='-'&&(c<'0'||'9'<c)) c=getchar(); bool s=false; if(c=='-'){s=true;c=getchar();} uint32_t x=0; while('0'<=c && c<='9'){ x=x*10+c-'0'; c=getchar(); } return s?-x:x; }
int64_t nextlong(void){ char c=getchar(); while(c!='-'&&(c<'0'||'9'<c)) c=getchar(); int s=0; if(c=='-'){s=1;c=getchar();} uint64_t x=0; while('0'<=c && c<='9'){ x=x*10+c-'0'; c=getchar(); } return s?-x:x; }
uint32_t nextstr(char *s){ char c=getchar(); while(c==' '||c=='\n') c=getchar(); uint32_t len=0; while(c!=' '&&c!='\n'){ *s++=c; len++; c=getchar(); } *s='\0'; return len; }
void printint(int32_t x){ if(x<0){x=-x; putchar('-');}else if(x==0){putchar('0');} int d=0; char s[10]; while(x){ s[d]='0'+x%10; x/=10; d++; } for (int i=d-1; i>=0; i--) putchar(s[i]); putchar('\n'); }
void rsorta_d32(void *base, const int count, const int size, const int index){
	typedef int32_t rsort_t;
	rsort_t (*a)[size] = (rsort_t(*)[size])base;
	rsort_t (*b)[size] = (rsort_t(*)[size])malloc(count*size*sizeof(rsort_t));
	int c[0x100];
	for(int k=0; k<4; k++){
		memset(c, 0, sizeof(c)); for(int i=0; i<count; i++){ c[(a[i][index]>>(k<<3))&0xFF]++; } for(int i=1; i<0x100; i++) c[i]+=c[i-1]; for(int i=count-1; i>=0; i--){ int to=--c[(a[i][index]>>(k<<3))&0xFF]; for(int j=0; j<size; j++){ b[to][j]=a[i][j]; } }{rsort_t(*t)[size]=a; a=b; b=t;}
	}
	free(b);
}

int main(void){
	int a=nextint();
	int b=nextint();
	int c=nextint();
	int d=nextint();
	long ans = LONG_MIN;
	{long now = (long)a*c; if(now>ans) ans=now; }
	{long now = (long)a*d; if(now>ans) ans=now; }
	{long now = (long)b*c; if(now>ans) ans=now; }
	{long now = (long)b*d; if(now>ans) ans=now; }
	printf("%ld\n", ans);
}


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

int main() {
  ll x,a,ans;
  cin >> x >> a;
  ans=(x<a) ? 0:10;
  cout << ans << endl;
}


Measured memory_bytes: 256
import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

S = sr()
N = len(S)
# R と L の境目、偶数回
RR_end = [0] * N
LL_end = [0] * N
temp = 0
for i in range(N):
    if S[i] == 'R':
        temp += 1
    else:
        RR_end[i] = temp
        temp = 0
temp = 0
for i in range(N-1, -1, -1):
    if S[i] == 'L':
        temp += 1
    else:
        LL_end[i] = temp
        temp = 0
answer = [0] * N

for i in range(N):
    answer[i] += LL_end[i] // 2
    answer[i] += RR_end[i] // 2
    if i < N-1:
        answer[i+1] += (LL_end[i] + 1) // 2
        answer[i] += (RR_end[i+1]+1) // 2

print(*answer)
 

Measured memory_bytes: 49348
use proconio::*;
use std::collections::*;

fn calc(mut p: Vec<(usize, u64, u64)>) -> u64 {
    let mut ans = p.iter().fold(0, |s, a| s + a.2);
    p.sort();
    let len = p.len();
    let mut h = BinaryHeap::new();
    for i in (1..=len).rev() {
        while p.last().map_or(false, |p| p.0 >= i) {
            let (_, l, r) = p.pop().unwrap();
            h.push(l - r);
        }
        if let Some(v) = h.pop() {
            ans += v;
        }
    }
    ans
}

#[fastout]
fn run() {
    input! {
        t: usize,
    }
    for _ in 0..t {
        input! {
            n: usize,
            p: [(usize, u64, u64); n],
        }
        let mut left = vec![];
        let mut right = vec![];
        for (k, l, r) in p {
            if l >= r {
                left.push((k, l, r));
            } else {
                right.push((n - k, r, l));
            }
        }
        let ans = calc(left) + calc(right);
        println!("{}", ans);
    }
}

fn main() {
    run();
}


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

public class AtCoderA
{
    static void Main()
    {
        var sc = new Scanner();

        long a = sc.NextLong();
        long b = sc.NextLong();
        long c = sc.NextLong();

        bool ok = false;
        if (a <= c && c <= b)
        {
            ok = true;
        }
        if (b <= c && c <= a)
        {
            ok = true;
        }

        string answer = ok ? "Yes" : "No";

        Console.WriteLine(answer);
    }

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

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

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

            return _line[_index++];
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}


Measured memory_bytes: 27360
#include<bits/stdc++.h>
typedef long long i64;
int n,k;
i64 sa=0;
void mins(i64&a,i64 b){if(a>b)a=b;}
struct node{
	node*lc,*rc;
	int D,sz,rnd;
	i64 vl,vr;
	void sp(node*&,node*&,int);
	i64 gl(){return lc?lc->gl():vl;}
	i64 gmn(){
		i64 mn=vr;
		if(lc)mins(mn,lc->gmn());
		if(rc)mins(mn,rc->gmn());
		return mn;
	}
}ns[1000007],*np=ns,*rt,*p1,*p2,*p3,*p4;
node*mg(node*a,node*b){
	if(!a)return b;
	if(!b)return a;
	if(a->rnd>b->rnd){
		a->sz+=b->sz;
		a->rc=mg(a->rc,b);
		return a;
	}
	b->sz+=a->sz;
	b->lc=mg(a,b->lc);
	return b;
}
void node::sp(node*&l,node*&r,int k){
	if(!this){l=r=0;return;}
	int ls=lc?lc->sz:0;
	if(k<=ls)return r=this,sz-=k,lc->sp(l,lc,k);
	if(k>=ls+D)return l=this,sz=k,rc->sp(rc,r,k-ls-D);
	k-=ls;
	node*a=np++,*b=np++;
	*a=(node){0,0,k,k,rand(),vl,vl};
	*b=(node){0,0,D-k,D-k,rand(),vr,vr};
	if(vl>vr){
		a->vr=vl-k+1;
		b->vl=vl-k;
	}
	l=mg(lc,a);
	r=mg(b,rc);
}
int main(){
	scanf("%d%d",&n,&k);
	srand(n+k);
	*(rt=np++)=(node){0,0,k,k,rand(),0,0};
	for(int i=1,a,b;i<=n;++i){
		scanf("%d%d",&a,&b);
		sa+=a;
		if(b==1){
			if(a*2>k)return puts("-1"),0;
			rt->sp(p1,p2,1);
			p2->sp(p2,p3,a*2-1);
			p3=mg(p3,p1);
			int D=a*2-1;
			i64 y=p3->gl();
			*(p4=np++)=(node){0,0,D,D,rand(),y+D,y+1};
			rt=mg(p3,p4);
		}else{
			rt->sp(p1,p2,a*2%k);
			rt=mg(p2,p1);
		}
	}
	printf("%lld\n",sa*2+rt->gmn());
	return 0;
}

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

#define rep(i, n) for(int i = 0; i<(n); i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
using ll = long long;

int main() {
    int N;
    cin >> N;
    map<string, int> ma;
    int cnt = 0;
    rep(i, N) {
        string s;
        cin >> s;
        ma[s]++;
        chmax(cnt, ma[s]);
    }
    vector<string> ans;
    for (auto m: ma) {
        if (cnt == m.second) ans.push_back(m.first);
    }
    sort(ans.begin(), ans.end());

    rep(i, ans.size()) cout << ans[i] << endl;
}

Measured memory_bytes: 26868
#include<iostream>
#include<algorithm>
#include<math.h>
using namespace std;
#define REP(i,b,n) for(int i=b;i<n;i++)
#define rep(i,n)   REP(i,0,n)
const double eps=1e-10;
double adj[21][21];
double  cost[20][20];
const double INF = 10000000;
#define MAOU 20

bool backTrack(int last,double r,int now,int n,
	   bool *visited){
  rep(i,n){
    if ( visited[i]==false && adj[MAOU][i]<=r)return false;
    if (visited[i]==false &&  adj[MAOU][i]<=r+adj[last][i])return false;
  }
  if ( now == n)return true;
  
  //
  /*
  visited[last]=false;
  rep(i,n){
    if (visited[i]==true)cost[i][i]=INF;
    else cost[i][i]=0;
    REP(j,i+1,n){
      if (visited[i]==true ||visited[j]==true)cost[i][j]=cost[j][i]=INF;
      else cost[i][j]=cost[j][i]=adj[i][j];
    }
  }
  visited[last]=true;
  rep(k,n)rep(i,n)rep(j,n)cost[i][j]=min(cost[i][j],cost[i][k]+cost[k][j]);
  rep(i,n)if( visited[i]==false && r+cost[last][i] >=adj[MAOU][i])return false;
  */
  //

  
  rep(i,n){
    if ( visited[i]==true)continue;
    if ( r+adj[last][i] < adj[MAOU][i]){
      visited[i]=true;
      if ( backTrack(i,r+adj[last][i],now+1,n,visited))return true;
      visited[i]=false;
    }//else return false;
  }
  return false;
}

double dist(int x,int y){
  return sqrt(x*x+y*y);
}

int solve(int n,int *x,int *y,int rx,int ry,int mx,int my){
  rep(i,n){
    adj[i][i]=0;
    adj[MAOU][i]=adj[i][MAOU]=dist(x[i]-rx,y[i]-ry);
    REP(j,i+1,n){
      adj[i][j]=adj[j][i]=dist(x[i]-x[j],y[i]-y[j]);
    }
  }
  
  rep(i,n){
    if ( dist(mx-x[i],my-y[i])+eps>dist(rx-x[i],ry-y[i]))return false;
  }


  bool visited[20]={false};
  rep(i,n){
    if ( dist(mx-x[i],my-y[i]) < dist(rx-x[i],ry-y[i])){
      visited[i]=true;
      if ( backTrack(i,dist(mx-x[i],my-y[i]),1,n,visited))return true;
      visited[i]=false;
    }else return false;
  }
  return false;
}

main(){
  int n,mx,my,rx,ry;
  while(cin>>n>>mx>>my>>rx>>ry && n){
    int x[n],y[n];
    rep(i,n)cin>>x[i]>>y[i];
    if ( solve(n,x,y,rx,ry,mx,my))puts("YES");
    else puts("NO");
  }
}

Measured memory_bytes: 852
using namespace std;
#define _CRT_SECURE_NO_WARNINGS
#pragma target("avx")
#pragma optimize("O3")
#pragma optimize("unroll-loops")
#include<iostream>
#include<algorithm>
#include<ctime>
#include<vector>
#include<string>
#include<cmath>
#include<map>
#include<iomanip>
#include<numeric>
#include<queue>
#include<deque>
#include<cfloat>
#include<functional>
#include<tuple>
#include<math.h>
#include<bitset>
#include<stack>
#include<set>
#include<random>
#include<stdlib.h>
#define rip(i,n) for(ll i=0;i<n;i++)
#define Rip(i,n) for(ll i=1;i<n;i++)
#define all(V) V.begin(),V.end()
#define ll long long
#define ld long double
#define MOD 998244353
#define mod MOD
#define sec setprecision
constexpr double eps = 1e-9;
constexpr double PI = 3.141592653589793238462643383279;
ll gcd(ll a, ll b) {
	if (a % b == 0)	return(b);
	else return(gcd(b, a % b));
}
ll lcm(ll a, ll b)
{
	return a * b / gcd(a, b);
}
const int MAX = 510000;
long long fac[MAX], finv[MAX], inv[MAX];
void cominit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (ll 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;
	}
}
vector<ll> soinnsuubunnkai(ll n) {
	vector<ll>a;
	while (n % 2 == 0) {
		a.push_back(2);
		n /= 2;
	}
	ll f = 3;
	while (f * f <= n) {
		if (n % f == 0) {
			a.push_back(f);
			n /= f;
		}
		else f += 2;
	}
	if (n != 1)
		a.push_back(n);
	return(a);
}
// 二項係数計算
long long com(ll n, ll k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}
ll pow(ll a, ll b) {
	a = a % mod;
	if (b == 0)return(1);
	else if (b % 2 == 0)return(pow((a * a) % mod, b / 2));
	else return(a * (pow(a, b - 1)));
}
void solve() {
	int a, b, c;
	cin >> a >> b >> c;
	if (a + b + c > 21)cout << "bust" << endl;
	else cout << "win" << endl;
}
int main() {
	solve();
}

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

int main() {

    int n;
    cin >> n;

    int mid = n/10%100;

    if ( mid%11 == 0 && (mid/10 == n/1000 || mid/10 == n%10)) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

}

Measured memory_bytes: 3596
N = gets.to_i
xls = N.times.map { gets.split.map(&:to_i) }

sorted = xls.sort_by { |(x, l)| x - l }
ans = 0
r = -(1 << 60)
sorted.each do |(x, l)|
  left = x - l
  right = x + l
  if left >= r
    ans += 1
    r = right
  elsif right < r
    r = right
  end
end
puts ans

Measured memory_bytes: 12792
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::{Bytes, Chars};
#[allow(unused_imports)]
use std::cmp::{min, max};

fn main() {
	input! {
		n: usize,
		a: [isize; n],
	}

	if n == 2 {
		println!("{}", (a[0]-a[1]).abs());
		return;
	}

	let mut total = 0;
	for i in 0..n {
		total += a[i];
	}

	let mut sunu = a[0];
	let mut arai = total - a[0];
	let mut dmin = (sunu-arai).abs();

	for i in 1..n-1 {
		sunu += a[i];
		arai -= a[i];
		dmin = min(dmin, (sunu-arai).abs());
	}

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



Measured memory_bytes: 4704
import sys
import math
from collections import defaultdict

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N):
    read_all = [tuple(map(int, input().split())) for _ in range(N)]
    return map(list,zip(*read_all))

#################

N,K,Q = II()
A = [I() for _ in range(Q)]

count = [K-Q]*N

for i in range(Q):
    count[A[i]-1] += 1

ans = N
for i in range(N):
    if count[i]>0:
        print('Yes')
    else:
        print('No')

Measured memory_bytes: 50140
def count_change(num):
    return max(num[0][0], num[1][1])

N = int(input())
C = input()
W = 0
R = 0
for c in C:
    if c=="W":
        W += 1
    else:
        R += 1

num = [[0,0],[W,R]]
min_change = count_change(num)
for i in range(N):
    if C[i]=="W":
        num[0][0] += 1
        num[1][0] -= 1
    else:
        num[0][1] += 1
        num[1][1] -= 1
    change = count_change(num)
    if change < min_change:
        min_change = change
        
print(min_change)

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

using namespace std;

#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define REV(i,n) for(ll (i) = (n) - 1;(i) >= 0;--i)
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {REP(WW,n)cerr << v[WW] << ' ';cerr << endl << endl;}
#define SHOW2d(v,WW,HH) {REP(W_,WW){REP(H_,HH)cerr << v[W_][H_] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 998244353

typedef long long ll;
typedef pair<ll,ll> P;

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

	string str;cin >> str;
	int a = 0;
	int b = 0;
	REP(i, str.size()){
		if(str[i] == 'o')a++;
		else b++;
	}

	if(15 - b >= 8)cout << "YES" << endl;
	else cout << "NO" << endl;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
    string S,T;
    cin >> S >> T;
    int N = S.size();
    int M = T.size();
    queue<int> q;
    for(int i = 0; i < N-M+1; i++){
        bool flag = true;
        for(int j = 0; j < M; j++){
            if(S[i+j] != T[j] && S[i+j] != '?'){
                flag = false;
                break;
            }
        }
        if(flag == true) q.push(i);
    }
    int Q = q.size();
    if(q.empty()) cout << "UNRESTORABLE" << endl;
    else{
        string S2 = S;
        for(int i = 0; i < Q; i++){
            int k = q.front();
            string S1 = S;
            for(int j = k; j-k < M; j++) S1[j] = T[-k+j];
            for(int j = 0; j < N; j++){
                if(S1[j] == '?') S1[j] = 'a';
            }
            if(S2 == S) S2 = S1;
            else if(S1 <= S2) S2 = S1;
            q.pop();
        }
        cout << S2 << endl;
    }
}


Measured memory_bytes: 256
N,K = list(map(int,input().split()))
h = sorted(list(map(int,input().split())), reverse = True)

if K >= N:
	print(0)
	exit()
else:
	ans = 0
	for i in range(K):
		h[i] = 0
	ans += sum(h)
	print(ans)



Measured memory_bytes: 26020
#include <stdio.h>
#define M 1030

int main ( void ) {
  int i, j;
  int n;
  char ch[ M ];
  int count;

  scanf ( "%d", &n );
  for ( i = 0; i < n; i++ ) {
    ch[ 0 ] = '0';
    scanf ( "%s", ch + 1 );

    count = 0;

    for ( j = 1; ch[ j ]; j++ ) {
      if ( ch[ j ] == '0' ) {
        if ( ch[ j - 1 ] == '1' ) {
          count %= 5;
          if ( count == 1 ) printf ( "." );
          else if ( count == 2 ) printf ( "," );
          else if ( count == 3 ) printf ( "!" );
          else if ( count == 4 ) printf ( "?" );
          else if ( count == 0 ) printf ( " " );
        } else if ( ch[ j - 1 ] == '2' ) {
          count %= 3;
          if ( count == 1 ) printf ( "a" );
          else if ( count == 2 ) printf ( "b" );
          else if ( count == 0 ) printf ( "c" );
        } else if ( ch[ j - 1 ] == '3' ) {
          count %= 3;
          if ( count == 1 ) printf ( "d" );
          else if ( count == 2 ) printf ( "e" );
          else if ( count == 0 ) printf ( "f" );
        } else if ( ch[ j - 1 ] == '4' ) {
          count %= 3;
          if ( count == 1 ) printf ( "g" );
          else if ( count == 2 ) printf ( "h" );
          else if ( count == 0 ) printf ( "i" );
        } else if ( ch[ j - 1 ] == '5' ) {
          count %= 3;
          if ( count == 1 ) printf ( "j" );
          else if ( count == 2 ) printf ( "k" );
          else if ( count == 0 ) printf ( "l" );
        } else if ( ch[ j - 1 ] == '6' ) {
          count %= 3;
          if ( count == 1 ) printf ( "m" );
          else if ( count == 2 ) printf ( "n" );
          else if ( count == 0 ) printf ( "o" );
        } else if ( ch[ j - 1 ] == '7' ) {
          count %= 4;
          if ( count == 1 ) printf ( "p" );
          else if ( count == 2 ) printf ( "q" );
          else if ( count == 3 ) printf ( "r" );
          else if ( count == 0 ) printf ( "s" );
        } else if ( ch[ j - 1 ] == '8' ) {
          count %= 3;
          if ( count == 1 ) printf ( "t" );
          else if ( count == 2 ) printf ( "u" );
          else if ( count == 0 ) printf ( "v" );
        } else if ( ch[ j - 1 ] == '9' ) {
          count %= 4;
          if ( count == 1 ) printf ( "w" );
          else if ( count == 2 ) printf ( "x" );
          else if ( count == 3 ) printf ( "y" );
          else if ( count == 0 ) printf ( "z" );
        }
        count = 0;
      } else {
        count ++;
      }
    }
    printf ( "\n" );
  }

  return ( 0 );
}

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

int main(int argc, char const *argv[])
{
	int n,q;
	while(cin>>n>>q,n)
	{
		vector<int> v[n];
		int m,t,mi=1000000,ma=-1;
		for (int i = 0; i < n; ++i)
		{
			cin>>m;
			for (int j = 0; j < m; ++j) cin>>t,v[i].push_back(t),mi=min(mi,t),ma=max(ma,t);
		}
		int ans=-1,d=-1;
		for (int i = mi; i <= ma; ++i)
		{
			int k=0;
			for (int j = 0; j < n; ++j)
			{
				for (int l = 0; l < v[j].size(); ++l)
				{
					if(v[j].at(l)==i)
					{
						++k;
						break;
					}
				}
			}
			if(k>d) ans=i,d=k;
		}
		if(d>=q) cout<<ans<<endl;
		else cout<<"0\n";
	}
	return 0;
}


Measured memory_bytes: 3156
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

struct node{
  int me;
  struct node *parent,*left,*right;
};
typedef struct node *point;
point root;
void insert(int);
void list(point);
void list1(point);
int find(int,point);

int main(){
  int x,i,num1,num2;
  char com[8];
  scanf("%d",&x);
  for(i=0;i<x;i++){
    scanf("%s",com);
    if((strcmp(com,"insert"))==0){
      scanf("%d",&num1);
      insert(num1);
    }
    else if((strcmp(com,"find"))==0){
      scanf("%d",&num1);
      num2=find(num1,root);
      if(num2==1)printf("yes\n");
      else printf("no\n");
    }
    else{
      list(root);
      printf("\n");
      list1(root);
      printf("\n");
    }
  }
  return 0;
}
void insert(int id){
  point x,y,z;
  z=malloc(sizeof(struct node));
  z->me=id;
  z->right=NULL;
  z->left=NULL;
  y=NULL;
  x=root;
  while(x!=NULL){
    y=x;
    if(z->me < x->me)
      x = x->left;
    else
      x = x->right;
  }
  z->parent = y;
  if(y==NULL)
    root = z;
  else if(z->me < y->me)
    y->left = z;
  else
    y->right = z;
}
void list(point x){
  if(x!=NULL){
    list(x->left);
    printf(" %d",x->me);
    list(x->right);
  }
}
void list1(point x){
  if(x!=NULL){
    printf(" %d",x->me);
    list1(x->left);
    list1(x->right);
  }
}
int find(int num,point x){
  while(x!=NULL&&num!=x->me){
    if(num<x->me)x=x->left;
    else x=x->right;
  }
  if(x!=NULL)return 1;
  return 0;
}
    
  



Measured memory_bytes: 20468
#include <iostream>
//#include <iomanip>
//#include <string>
#include <vector>
//#include <algorithm>
//#include <utility>
//#include <set>
//#include <map>
//#include <queue>
//#include <deque>
#include <bitset>
//#include <math.h>
using namespace std ;
using ll = long long ;
//using ld = long double ;
using vll = vector<ll> ;
using vvll = vector<vll> ;
//using vc = vector<char> ;
//using vvc = vector<vc> ;
//using vb = vector<bool> ;
//using vvb = vector<vb> ;
//using pll = pair<ll,ll> ;

//ll mod = 1000000007 ;
//long double pie = acos(-1) ;

//string yorn(bool a){if(a) return"Yes" ; return "No" ;}
//string YorN(bool a){if(a) return"YES" ; return "NO" ;}
//ll gcd(long long a,long long b){if(b==0) return a ; return gcd(b,a%b) ;}
//ll lcm(long long a,long long b){return a/gcd(a,b)*b ;}
//ll sa(long long a,long long b){if(a>b) return a-b ; return b-a ;}
//void mysort(vector<long long> &a){sort(a.begin(),a.end()) ;}
//void myrev(vector<long long> &a){reverse(a.begin(),a.end()) ;}

int main(){
	ll h,w,k ;
	cin >> h >> w >> k ;
	vvll cho(h+2,vll(w+2,0)) ;
	for(int i=1;i<=h;i++){
		for(int j=1;j<=w;j++){
			char c ; cin >> c ;
			cho.at(i).at(j) = (c=='1') ;
		}
	}
	vvll sum(h+2,vll(w+2,0)) ;
	for(int i=1;i<=h;i++){
		for(int j=1;j<=w+1;j++){
			sum.at(i).at(j) = sum.at(i).at(j-1)+cho.at(i).at(j) ;
		}
	}
	for(int j=1;j<=w+1;j++){
		for(int i=1;i<=h+1;i++){
			sum.at(i).at(j) += sum.at(i-1).at(j) ;
		}
	}
	if(h==1){
		ll pos = 0 ;
		ll ans = 0 ;
		for(int i=1;i<=w-1;i++){
			if(sum.at(1).at(i)-sum.at(1).at(pos)<=k&&sum.at(1).at(i+1)-sum.at(1).at(pos)>k){
				ans++ ;
				pos = i ;
			}
		}
		cout << ans << endl ;
		return 0 ;
	}
	ll ans = 10000000 ;
	for(int i=0;i<(1<<(h-1));i++){
		bitset<15> bit(i) ;
		ll sub = 0 ;
		for(int j=0;j<h;j++) if(bit[j]) sub++ ;
		vll yoko ;
		for(int j=0;j<h;j++) if(bit[j]) yoko.push_back(j+1) ;
		if(sub==0){
			ll pos = 0 ;
			ll subcnt = 0 ;
			for(int j=1;j<=w;j++){
				if(sum.at(h).at(j)-sum.at(h).at(pos)>k){
					pos = j-1 ;
					subcnt++ ;
				}
			}
			if(ans>subcnt) ans = subcnt ;
			for(int j=1;j<=w;j++){
				if(sum.at(h).at(j)-sum.at(h).at(j-1)>k) ans = 1000000 ;
			}
//			cout << subcnt << endl ;
			continue ;
		}
		ll pos = 0 ;
		ll subcnt = 0 ;
		for(int j=1;j<=w;j++){
			bool ok = true ;
			for(int l=0;l<sub+1;l++){
				if(l==0){
//					cout << sum.at(yoko.at(0)).at(j)-sum.at(yoko.at(0)).at(pos) << " " ;
					if(sum.at(yoko.at(0)).at(j)-sum.at(yoko.at(0)).at(pos)>k){ 
						ok = false ; 
						if(j==pos+1) subcnt = 10000 ;
					}
				}else if(l==sub){
					if(sum.at(h).at(j)-sum.at(h).at(pos)-sum.at(yoko.at(sub-1)).at(j)+sum.at(yoko.at(sub-1)).at(pos)>k){ ok = false ;if(j==pos+1) subcnt = 10000 ;}
				}else{
					if(sum.at(yoko.at(l)).at(j)-sum.at(yoko.at(l)).at(pos)-sum.at(yoko.at(l-1)).at(j)+sum.at(yoko.at(l-1)).at(pos)>k) {ok = false ;if(j==pos+1) subcnt = 10000 ;}
				}
			}
			if(!ok){
				pos = j-1 ;
				subcnt++ ;
			}
		}
//		cout << endl ;
		if(ans>sub+subcnt) ans = sub+subcnt ;
//		cout << sub+subcnt << endl ;
	}
	cout << ans << endl ;
}


Measured memory_bytes: 512
#include <iostream>
#include <vector>

int main(){
  while(1){
    int n,r;
    std::cin>>n>>r;
    if(n==0&&r==0) break;
    std::vector<int> hanafuda(n),tmp(n);
    for(int i=0;i<n;++i) hanafuda[i]=n-i;

    for(int i=0;i<r;++i){
      for(int j=0;j<n;++j)
        tmp[j]=hanafuda[j];
      int p,c;
      std::cin>>p>>c;
      for(int j=0;j<c;++j) hanafuda[j] = tmp[p-1+j];
      for(int j=0;j<p-1;++j) hanafuda[c+j] = tmp[j];
    }
    std::cout<<hanafuda[0]<<std::endl;
  }
  return 0;
}

Measured memory_bytes: 3052
#include<iostream>
#include<string>
#include<vector>
using namespace std;
int main()
{
	/*int n, r;
	cin >> n >> r;
	if (n >= 10)
		cout << r;
	else
		cout << r + (10 - n) * 100;*/

	long long n, k = 0;
	cin >> n >> k;
	int ans = 1;
	while (n >= k)
	{
		n /= k;
		ans += 1;
	}
	cout << ans;
}



Measured memory_bytes: 3584
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>

using namespace std;

#define NUM 7370000

int main(){
	int limit;
	int* table = new int[NUM];
	int* work = new int[NUM];

	for(int i=0; i < NUM;i++)table[i] = 1;
	table[0] = 0;
	table[1] = 0;

	limit = sqrt(NUM);

	for(int i=2;i<=limit;i++){
		if(table[i] == 1){
			for(int k=2*i;k < NUM; k += i){
				table[k] = 0;
			}
		}
	}

	int index = 0;
	int* prime_table = new int[550000];

	for(int i = 2; i < NUM; i++){
		if(table[i] == 1){
			prime_table[index++] = i;
		}
	}

	int m,n,count,tmp_index;

	while(true){
		scanf("%d %d",&m,&n);
		if(m == 0 && n == 0)break;

		count = 0; //m????????§??????n+1??????????´???°?????´?????±????????????????????¨?????§??????????????§?????????limit??¨??????
		for(tmp_index = 0; prime_table[tmp_index] <= m; tmp_index++);

		limit = prime_table[tmp_index+n-1];

		for(int i = m; i <= limit; i++)work[i] = 1; //??¨????????´???????????????????????¨????????????

		count = 0;
		for(int i = m; i <=2*m-1 && count < n; i++){
			work[i] = 0;
			count++;
			for(int k = 2*i; k < limit; k += i)work[k] = 0;
		}

		if(count < n){
			for(int i = 2*m; i <= limit && count < n; i++){
				if(work[i] == 1){ //i??´???????????????
					work[i] = 0;
					count++; //????????????
					for(int k = 2*i; k < limit; k += i)work[k] = 0;
				}
			}
		}

		for(int i = m; i <= limit; i++){
			if(work[i] == 1){
				printf("%d\n",i);
				break;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 62220
import java.util.*;
 
public class Main {
	public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
    	String s1 = sc.next();
        String s2 = sc.next();
        String s3 = sc.next();
        String ans = s1.substring(0,1) + s2.substring(0,1) + s3.substring(0,1);
        System.out.println(ans.toUpperCase());
    }
}

Measured memory_bytes: 38804
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <numeric>
#include <cmath>
#include <cstdlib>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define REP(i,a) FOR(i,0,a)
#define ALL(x) x.begin(), x.end()
#define INF (1001000000)
#define SZ(a) int((a).size())
#define EACH(i,c) for(auto i:c)
#define EXIST(cs,v) (find(ALL(cs),(v))!=cs.end())
#define SORT(c) sort((c).begin(),(c).end())
#define RSORT(c) sort((c).rbegin(),(c).rend())
#define UNIQ(c) (c).erase(unique((c).begin(),(c).end()), (c).end());
#define P(p) cout<<(p)<<endl;

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

    int h, w;
    cin >> h >> w;

    vector<string> m;
    REP(i, h) {
        string s;
        cin >> s;
        m.push_back(s);
    }

    vector<bool> row(h, false);
    vector<bool> col(w, false);
    REP(i, h) {
        REP(j, w) {
            if (m[i][j] == '#') {
                row[i] = true;
                col[j] = true;
            }
        }
    }

    REP(i, h) {
        if (row[i]) {
            REP(j, w) {
                if (row[i] && col[j]) {
                    cout << m[i][j];
                }
            }
            cout << endl;
        }
    }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define pb push_back
#define pp pop_back
#define mp make_pair
#define F first
#define S second
#define Need_for_speed ios_base::sync_with_stdio(0);
using namespace std;
//cout<<fixed<<setprecision()
int main(){
	Need_for_speed;
	int n,m,l;
	cin>>n>>m>>l;
	while(m != l){
	    m++;
		if(m == l){
			cout<<"Borys";
			return 0;
		}
		if(m > n && l >= 1){
			cout<<"Borys";
			return 0;
		}
		l--;
		if(m == l){
			cout<<"Alice";
			return 0;
		}
		if(m <= n && l < 1){
			cout<<"Alice";
			return 0;
		}
	}
	cout<<"Draw";
	exit(0);
}


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

int main(){
    long long N;
    std::cin>>N;

    std::vector<int> d;
    long long k = N;
    while(k > 0){
        d.push_back(k % 10);
        k /= 10;
    }

    int sum = std::accumulate(d.begin(), d.end(), 0);
    std::cout<<(N % sum == 0 ? "Yes" : "No")<<std::endl;
    return 0;
}

Measured memory_bytes: 256
import java.math.BigInteger

fun main() = Thread(null, ::abc169b, "(^o^)", 128 * 1024 * 1024).apply { start() }.join()

@OptIn(ExperimentalStdlibApi::class)
fun abc169b() {
    readLine()
    val aList = readLine()!!.split(' ').map { it.toBigInteger() }

    if (BigInteger.ZERO in aList) return println(0)

    var answer = BigInteger.ONE
    val max = BigInteger.valueOf(1000000000000000000L)

    for (a in aList) {
        answer = answer.multiply(a)
        if (answer > max) return println(-1)
    }

    println(answer)
}


Measured memory_bytes: 72148
#include<bits/stdc++.h>
#include <ext/pb_ds/detail/standard_policies.hpp>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define int long long 
#define pb push_back
#define ins insert
#define rs resize
#define br break;
#define cont continue;
#define vi vector<int>
#define vll vector<long long>
#define vvi vector<vector<int>>
#define si set<ll>
#define sll set<long long>
#define pii pair<ll,ll>
#define pll pair<long long, long long>
#define speed ios_base::sync_with_stdio(false);cin.tie(NULL);
#define vec vector
#define cend cout<<endl;
#define sc second
#define fr first
#define retz return 0;
#define ll_MAX (ll)(1e9*1e9)
#define ll_MIN (ll)(-1e9*1e9)
#define lb lower_bound
#define ub upper_bound
#define rep(i,a,b)  for(int i=a; i<=b; i++)
#define repd(i,a,b) for(int i=a; i>=b; i--)
#define ps(arr, n) for(int i=1; i<n; i++)arr[i]+=arr[i-1];
#define inp(arr, n)for(int i=0; i<n; i++)cin>>arr[i];
#define out(arr, n)for(int i=0; i<n; i++)cout<<arr[i];
#define inp1(arr,n,m)for(int i=0; i<n; i++)for(int j=0;j<m;j++)cin>>arr[i][j];
#define out1(arr,n,m)for(int i=0; i<n; i++)for(int j=0;j<m;j++)cin>>arr[i][j];
#define loop(q) for(auto it:q)
#define loop1(q) for(auto&it:q)
#define db1 cout << "*" << endl
#define db2 cout << "YES" << endl
using namespace std;
using namespace __gnu_pbds; 
#define oset(X) tree<X,null_type,less<X>, rb_tree_tag, tree_order_statistics_node_update> 
#define roset(X) tree<X,null_type,greater<X>, rb_tree_tag, tree_order_statistics_node_update>  
#define okey order_of_key //lower_bound_set
#define ofind find_by_order
#define cyes cout << "Yes" << endl; 
#define cno cout << "No" << endl;
#define mod (long long)1000000007
#define mod2 (long long)998244353
#define INT_MAX1 900000000
#define MAXN 2000000
#define INF INT_MAX


int pp(int i)
{
    return i*i*i*i*i;
}

void solve()
{
   int n;
   cin >> n;
   int arr[n];
   inp(arr, n);
   map<int,vi> q;
   rep(i,0,n-1)
   {
     q[arr[i]-i].pb(arr[i]);
   }




   int ans = 0;


   rep(i,0,n-1)
   {
     int x = -1*arr[i]+1-(i+1);
     ans += q[x].size();
   }
   cout << ans << endl;
}   


signed main()
{
    
    speed;
    int t = 1;
    //cin >> t;
    while(t--)
        solve();
}

Measured memory_bytes: 39380
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define vi vector<int>
#define pb push_back
#define pii pair<int , int>
#define fast ios_base::sync_with_stdio(0)
#define mx 100005
#define inf 1000000000000000008LL
ll arr[102], dp[102][mx], weight[102], value[102];
int n;
ll fun(int pos, int rem)
{
    if(pos>n) return 0;
    ll& ret= dp[pos][rem];
    if(ret!=-1) return ret;
    ret = max(ret, fun(pos+1, rem));
    if(rem-weight[pos] >=0)
        ret = max(ret, value[pos] +  fun(pos+1, rem-weight[pos]));
    return ret;
}
int main()
{
    int cap;
    scanf("%d%d",&n, &cap);
    for(int i=1; i<=n; i++)
        scanf("%lld%lld",&weight[i], &value[i]);
    memset(dp, -1, sizeof dp);
    printf("%lld\n", fun(1,cap));
}



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

int main() {

	int n, m; cin >> n >> m;
	vector<int> num(m, 0);
	for (int i = 0; i < n; i++) {
		int k; cin >> k;
		for (int j = 0; j < k; j++) {
			int a; cin >> a;
			num[--a]++;
		}
	}
	int ans = 0;
	for (int i = 0; i < m; i++) {
		if (num[i] == n) ans++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3580
a[100],c[100],p,v,i,j,n,m;main(k){for(;~scanf("%d%d",n?(i<n?a:c-n)+i++:&n,m?(i<n?a:c-n)+i+50:&m););for(;j<n;printf("%d\n",p,j++))for(v=1e9,p=i=0;i<m;v>k?p=i,v=k:0)k=abs(a[j]-c[i])+abs(a[j+50]-c[50+i++]);}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
typedef long long ll;

const int maxn = 0;
ll n;
void no(){ cout << "No"; exit(0); }

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(NULL);
	cin >> n;
	int cur = 0;
	pair < int , int > now = make_pair(0,0);
	for(int i=0,t,x,y;i<n;i++)
	{
		cin >> t >> x >> y;
		int dis = abs(x - now.first) + abs(y - now.second);
		if(dis > t - cur) no();
		if((t - cur) % 2 != dis % 2) no();
		now = make_pair(x , y);
		cur = t;
	}
	cout << "Yes";
}

Measured memory_bytes: 256
fun main(args: Array<String>) {
    var (l, r) = readLine()!!.split(" ").map { it.toLong() }
    if (r - l >= 2019) {
        println(0)
        return
    }
    var ans = 2020L
    for (i in l until r) {
        for (j in i+1 until r+1) {
            ans = Math.min(ans, i*j%2019)
        }
    }
    println(ans)
}

Measured memory_bytes: 37900
while True:
   n,m = map(int, input().split())
   if n == 0 and m == 0:
      break
   T = []
   H = []
   for i in range(n):
      t = int(input())
      T.append(t)
   for j in range(m):
      h = int(input())
      H.append(h)
      
   T.sort()
   H.sort()
   min = []
   
   if (sum(T) - sum(H))%2!=0 or (sum(H) - sum(T))%2!=0:
      pass
   elif sum(T) > sum(H):
      s = (sum(T) - sum(H))//2
      for p in range(n):
         for q in range(m):
            if min == []:
               if T[p] - s == H[q]:
                  min = [T[p], H[q]]
            else:
               break
   elif sum(T) < sum(H):
      s = (sum(H) - sum(T))//2
      for p in range(n):
         for q in range(m):
            if min == []:
               if T[p] + s == H[q]:
                  min = [T[p], H[q]]
            else:
               break
   else:
      for p in range(n):
         for q in range(m):
            if T[p] == H[q]:
               if sum(min) > T[p]+H[q] or min == []:
                  min = [T[p], H[q]]

   if min == []:
      print('-1')
   else:
      print(*min)


Measured memory_bytes: 5608
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=1;i<n;i++)
int n;
signed main(){
	cin>>n;
	rep(i,3501){
		rep(j,3501){
			int k=i*j*n;
			int l=k/n*4;
			int m=l-k/i-k/j;
			if(m==0)continue;
			if(k/m<0)continue;
			if(k%m==0){
				cout<<i<<" "<<j<<" "<<k/m<<endl;
				return 0;
			}
		}
	}
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int ans=753;
		String s = sc.next();
		for(int i=0;i<s.length()-2; i++) {
			int num = Math.abs(753 - Integer.parseInt(s.substring(i, i+3)));
			if(num < ans) ans = num;
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 21588