akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define lp(n) for(int i = 0; i < n; i++)
#define lpp(i, n) for(int i = 0; i < n; i++)

using namespace std;
int main() {
  int a[100];
  int n, c=0;
  cin >> n;
  lp(n) cin >> a[i];
  int minj;
  lp(n) {
    minj = i;
    for(int j = i; j <= n-1; j++) {
      if(a[j] < a[minj]) minj = j;
    }
    if(i != minj) c++;
    swap(a[i], a[minj]);
  }
  lp(n) {
    cout << a[i] << ((i == n-1) ? "\n" : " ");
  }
  cout << c << endl;
  
  return 0;
}



Measured memory_bytes: 3120
#include<iostream>
using namespace std;
int isPrime(int n){
  for(int i=2;i*i<=n;i++) if(n%i==0) return 0;
  return 1;
}
int main(){
  bool d[70000];
  for(int i=0;i<70000;i++) d[i]=isPrime(i);
  int n;
  while(cin >> n){
    int k=1;
    while(!d[n-k]) k++;
    cout << n-k << " ";k=1;
    while(!d[n+k]) k++;
    cout << n+k << endl;
  }
}


Measured memory_bytes: 3192
#include <cstdio>
#include <iostream>
#include <cstdio>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iomanip>
#include<string>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
int main() {
	string s;
	cin >> s;
	int a = 0;
	rep(i, s.size()) { if (s[i] == '2') { a++; } }
	cout << a << endl;

}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;
public class Main {
    public static void main(String[] args){
    
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int[]a = new int[N];
    		
    for(int i=0; i<N; i++) {
    	a[i] = sc.nextInt();
    }
    Arrays.sort(a);

    int x = 0;
    int y = 0;
    for(int i=0; i<N; i++) {
    	if(i%2==0) {
    		x += a[i];
    	}else {
    		y += a[i];
    	}
    	}
    System.out.println(Math.abs(x-y));
    }
}

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

using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<int, int> PII;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define MP make_pair
#define PB push_back
#define MOD 1000000007
#define INF (1LL<<30)
#define LLINF (1LL<<60)
#define PI 3.14159265359
#define EPS 1e-12
#define int ll

signed main(void)
{
  char a, b;
  cin >> a >> b;
  if(a == 'H') {
    if(b == 'H') cout << 'H' << endl;
    else cout << 'D' << endl;
  } else {
    if(b == 'H') cout << 'D' << endl;
    else cout << 'H' << endl;
  }
  return 0;
}


Measured memory_bytes: 256
n, m, ll = map(int, input().split())

a = []
b = []

for i in range(n):
    a.append(list(map(int, input().split())))
for i in range(m):
    b.append(list(map(int, input().split())))

for i in range(n):
    prt = []
    for j in range(ll):
        s = 0
        for k in range(m):
            s += a[i][k] * b[k][j]
        prt.append(s)
    print(*prt)



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

int main(){
    int sum1=0,sum2=0,ave1,ave2;
    double ave,sum=0;
    int n;
    cin>>n;
    int a[n];
    for(int i=0; i<n; i++){
        cin>>a[i];
        sum+=a[i];
    }
    ave=sum/n;
    ave1=ceil(ave);
    ave2=(int)ave;
    for(int i=0; i<n; i++){
        sum1+=(ave1-a[i])*(ave1-a[i]);
    }
    for(int i=0; i<n; i++){
        sum2+=(ave2-a[i])*(ave2-a[i]);
    }
    cout<<min(sum1,sum2)<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
#include <stack>
#include <set>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define INF (int)(1123456789)
#define LINF (long long int)(112345678901234567)
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define all(v) v.begin(), v.end()

const int N = (int)3e5;

ll mpow(ll a, ll b){
	if(b==0) return 1;
	else if(b%2==0){ll memo = mpow(a,b/2); return memo*memo%MOD;}
	else return mpow(a,b-1) * a % MOD;
}
ll gcd(ll a, ll b){
	if(b==0) return a;
	else return gcd(b, a%b);
}
vector<ll> kaijo_memo;
ll kaijo(ll n){
	if(kaijo_memo.size() > n) return kaijo_memo[n];
	if(kaijo_memo.size() == 0) kaijo_memo.push_back(1);
	while(kaijo_memo.size() <= n) kaijo_memo.push_back(kaijo_memo[kaijo_memo.size()-1] * kaijo_memo.size() % MOD);
	return kaijo_memo[n];
}
ll nCr(ll n, ll r){
	if(n < r || r < 0) return 0;
	ll ret = 1;
	ret *= kaijo(n); ret %= MOD;
	ret *= mpow(kaijo(r), MOD-2); ret %= MOD;
	ret *= mpow(kaijo(n-r), MOD-2); ret %= MOD;
	return ret;
}

int main(void){
	int n;cin>>n;
	vector<vector<int>> A;
	vector<int> idx;
	vector<bool> flag;
	rep(i,n){
		A.push_back(vector<int>());
		idx.push_back(0);
		flag.push_back(true);
		rep(j,n-1){
			int a;
			cin>>a;a--;
			A[i].push_back(a);
		}
	}
	queue<int> q;
	ll ans = 0;
	rep(i,n){
		q.push(i);
	}
	while(q.size() > 0){
		ans++;
		queue<int> q2,q3;
		while(q.size() > 0){
			int next = q.front(); q.pop();
			int enemy = A[next][idx[next]];
			if(A[enemy][idx[enemy]] == next){
				q2.push(next);
				if(idx[next] + 1 < n-1) q3.push(next);
				if(!flag[enemy]){
					flag[enemy] = true;
					q2.push(enemy);
					if(idx[enemy] + 1 < n-1) q3.push(enemy);
				}
			}else{
				flag[next] = false;
			}
		}
		if(q2.size() == 0){
			cout<<-1<<endl;
			return 0;
		}
		while(q2.size() > 0){
			int now = q2.front(); q2.pop();
			idx[now]++;
		}
		q = q3;
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 4352
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <string>
#include <iomanip>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
typedef long long ll;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};

int main(){
    string s1,s2,s3;
    cin >> s1;
    cin >> s2;
    cin >> s3;
    cout << s1[0] <<s2[1] << s3[2] << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
// #define int long long
typedef long long ll;
typedef pair<int,int> pii;
#define ITR(v,c) for(auto v=begin(c);v!=end(c);v++)
#define FOR(v,a,n) for(int v=a;v<(int)(n);v++)
#define FORE(x,arr) for(auto &x:arr)
#define REP(v,n) FOR(v,0,n)
#define RREP(v,n) for(int v=(int)(n);v>=0;v--)
#define ALL(c) begin(c),end(c)
const int DX[4]={0,1,0,-1}, DY[4]={-1,0,1,0};
const int INF = 1e9;
const ll INFLL = 1e18;
template<class T,class U>ostream&operator<<(ostream &os,const pair<T,U> &p){
    os<<"("<<p.first<<","<<p.second<<")";return os;}
template<class T>ostream&operator<<(ostream &os,const vector<T> &v){
    ITR(i,v)os<<*i<<(i==end(v)-1?"":"\n");return os;}
//------------------------------------------------------------------------------

signed main() {
    int n,m;
    cin>>n>>m;
    vector<int> a(m),ans(n);
    REP(i,m) cin>>a[i],a[i]--;
    REP(i,m) {
        int c=0;
        REP(j,n) {
            int b;
            cin>>b;
            b--;
            if(b==a[i]) ans[j]++;
            else c++;
        }
        ans[a[i]]+=c;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3108
package main

import "fmt"

func main()  {
	var A,B,C,D int
	fmt.Scan(&A,&B,&C,&D)
	for {
		C -= B
		if C <= 0 {
			fmt.Println("Yes")
			return
		}
		A -= D
		if A <= 0 {
			fmt.Println("No")
			return
		}
	}
}

Measured memory_bytes: 1752
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Scanner;

public class Main {

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

    BigDecimal a = new BigDecimal(sc.next());
    BigDecimal b = new BigDecimal(sc.next());

    System.out.println(a.multiply(b).setScale(0, RoundingMode.FLOOR).toPlainString());

  }

}

Measured memory_bytes: 35964
#!/usr/bin/env python3
import sys
import numpy as np


def solve(A: int, B: int):
    if (A>0 and A<10) and (B>0 and B<10):
        print(A*B)
    else:
        print(-1)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    solve(A, B)

if __name__ == '__main__':
    main()


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

using namespace std;
using ll = long long;
#define MOD 1e9+7

int main(){
    vector<int> dp;
    int N,M;
    vector<int> vec;
    vector<int> A;

    cin >>N >> M;
    dp = vector<int>(pow(2, N+2), 1e9+7);
    dp[0] = 0;
    for(int i = 0;i < M;i++){
        int a,b;cin >> a >> b;
        A.push_back(a);
        int uku = 0;
        for(int j = 0;j < b;j++){
            int c;cin >> c;
            c--;
            uku |= (1<<c);
        }
        vec.push_back(uku);
    }
    for(int i = 0;i < pow(2, N);i++){
        if(dp[i] == 1e9+7)continue;
        for(int j = 0;j < M;j++){
            dp[i | vec[j]] = min(dp[i | vec[j]], dp[i] + A.at(j));
        }
    }
    int q = 0;

    for(int i = 0;i < N;i++){
        q |= (1<<i);
    }
    /*
    for(int i = 0;i < pow(2, N+1);i++){
        cout<<bitset<5>(i)<<" "<<i<<" "<<dp[i]<<endl;
    }
    */
    cout<<(dp[q] == 1e9+7 ? -1 : dp[q])<<endl;
}


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

int f(char S,char T,char U){
  if(S!=T&&T!=U&&U!=S){
    return 1;
  }else{
    return 0;
  }
}

int main(){
  long long n;
  string s;
  cin >> n >> s;
  long long i,j,r,g,b,a;
  
  r=0;
  g=0;
  b=0;
  
  for(i=0;i<n;i++){
    if(s.at(i)=='R'){
      r++;
    }else if(s.at(i)=='G'){
      g++;
    }else{
      b++;
    }
  }
  a=r*g*b;
  
  for(i=1;i<=(n-1)/2;i++){
    for(j=0;j<=n-1-2*i;j++){
      a=a-f(s.at(j),s.at(j+i),s.at(j+i+i));
    }
  }
  
  cout << a << endl;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n,a[114514],b[114514];
int main() {
	ll n,a,b;
	cin>>n>>a>>b;
	cout<<min(a,b)<<' '<<max(a+b-n,0ll)<<endl;
	return 0;
}

Measured memory_bytes: 256
/* BISMILLAHIR RAHMANIR RAHIM */
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main() {
    ios_base :: sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    int n;
    cin >> n;
    vector< pair<ll, ll> > a(n);
    for(int i = 0, x, l; i < n; i++) {
    	cin >> x >> l;
    	a[i] = {x + l, -(x - l)};
    }
    sort(a.begin(), a.end());
    ll cnt = 0, r = -1e18;
    for(int i = 0; i < n; i++) {
    	//cout << -a[i].second << " " << a[i].first << "\n";
    	if( -a[i].second >= r ) {
    		cnt++;
    		r = a[i].first;
    	}
    }
    cout << cnt << "\n";
}

Measured memory_bytes: 1792
#include <cstdio>
#include <utility>
#include <cmath>
#include <algorithm>
using namespace std;

#define gcu getchar_unlocked
int in(int c){int n=0;bool m=false;if(c=='-')m=true,c=gcu();
	do{n=10*n+(c-'0'),c=gcu();}while(c>='0');return m?-n:n;}
int in() {return in(gcu());}
bool scan(int &n){int c=gcu();return c==EOF?false:(n=in(c),true);}
bool scan(char &c){c=gcu();gcu();return c!=EOF;}
//bool scan(string &s){int c;s="";
//	for(;;){c=gcu();if(c=='\n'||c==' ')return true;else if(c==EOF)return false;s+=c;}}
#define pcu putchar_unlocked
#define vo inline void out
template <typename T>
vo(T n){static char buf[20];char *p=buf;
	if(n<0)pcu('-'),n*=-1;if(!n)*p++='0';else while(n)*p++=n%10+'0',n/=10;
	while (p!=buf)pcu(*--p);}
vo(const char *s){while(*s)pcu(*s++);}
vo(char c){pcu(c);}
//vo(string &s){for (char c: s) pcu(c);}
template <typename head, typename... tail> vo(head&& h, tail&&... t){out(h);out(move(t)...);}
//template <typename T> vo(vector<T> &v){for(T &x:v)out(&x == &v[0]?"":" "),out(x);out('\n');}
#undef vo

int main() {
	for (int e, m; (e = m = in());) {
		for (int z = cbrt(e) + 0.00001; z >= 0; z--) {
			int te = e - z * z * z;
			int y = (int)sqrt(te);
			int tm = z + y + te - y * y;
			if (y > m)
				break;
			m = min(m, tm);
		}
		out(m, '\n');
	}
}


Measured memory_bytes: 2624
#include <bits/stdc++.h>
#define BIT(n) (1LL << (n))
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPB(i, n) for (int i = 0; i < BIT(n); i++)
#define REPS(i, x) for (int i = 1; i <= (int)(x); 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 FORA(i, n) for (auto &&i : n)
#define FORS(i, m, n) for (int i = m; i <= n; i++)
#define INF 2e9
#define MOD (1000000007)
#define EPS 1e-9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef long long int lli;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N, M;
  cin >> N >> M;
  vector< vector< int > > v(M, vector< int >(3));
  REP(i, M) {
    cin >> v[i][0] >> v[i][1];
    v[i][2] = i;
  }
  sort(ALL(v));
  int tmp = v[0][0], counter = 1;
  // v i 0 is prefecture.
  REP(i, M) {
    if (tmp != v[i][0]) {
      tmp = v[i][0];
      counter = 1;
    }
    v[i][1] = counter;
    swap(v[i][0], v[i][2]);
    // cout << v[i][2] << endl;
    counter++;
  }
  sort(ALL(v));
  REP(i, M) {
    cout << setfill('0') << right << setw(6) << v[i][2] << setfill('0') << right
         << setw(6) << v[i][1] << "\n";
  }
}

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


#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

#define rep(i, n)    for(int i = 0; i < (n); ++i)
#define repA(i, a, n)  for(int i = a; i <= (n); ++i)
#define repD(i, a, n)  for(int i = a; i >= (n); --i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
#define fill(a)  memset(a, 0, sizeof (a))
#define fst first
#define snd second
#define mp make_pair
#define pb push_back
typedef long double ld;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

void pre(){


}

void solve(){


}
string s[209];
const ll inf = 1LL << 32;
void floydWarshall(vector<vector<ll>>& m) {
		int n = sz(m);
			rep(i,n) m[i][i] = min(m[i][i], {});
				rep(k,n) rep(i,n) rep(j,n)
							if (m[i][k] != inf && m[k][j] != inf) {
											auto newDist = max(m[i][k] + m[k][j], -inf);
														m[i][j] = min(m[i][j], newDist);
																}
					rep(k,n) if (m[k][k] < 0) rep(i,n) rep(j,n)
								if (m[i][k] != inf && m[k][j] != inf) m[i][j] = -inf;
}
vi g[209];
int dist[209];
void dfs(int v,int p){
	trav(i,g[v]) if(i!=0&&dist[i]==0){
		dist[i] = dist[v]+1;
		dfs(i,v);
	}
}
int main() {
	cin.sync_with_stdio(0); cin.tie(0);
	cin.exceptions(cin.failbit);
	pre();
	int n;cin>>n;
	rep(i,n) cin>>s[i];
	vector<vector<ll>> m(n,vector<ll>(n,inf));
	rep(i,n) rep(j,n) if(s[i][j]=='1') m[i][j]=1,g[i].pb(j);
	rep(i,n) m[i][i]=0;
	dfs(0,-1);
	rep(i,n) rep(j,n) if(s[i][j]=='1'&&dist[i]%2==dist[j]%2) {
		cout<<-1;
		return 0;
	}
	{
		floydWarshall(m);
		ll x = 2;
		rep(i,n) rep(j,n) x =max(x,m[i][j]+1);
		cout<<x;
	}
	return 0;
}



Measured memory_bytes: 896
import sys
import collections as c
n = int(input())
d = list(map(int, input().split()))
m = int(input())
t = list(map(int, input().split()))

D = c.Counter(d)
T = c.Counter(t)

for test in T.keys():
	if D[test] >= T[test]:
		continue
	else:
		print("NO")
		sys.exit()

print("YES")

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

typedef long long int ll;
#define rep(i,n) for (int i = 0; i < (n); i++)
#define all(v) (v).begin(), (v).end()
#define sz(x) int(x.size())
const ll mod = 1000000007;
const ll INF = 1001001001001001000;

int main() {
    int n; cin >> n;
    vector<pair<double, double>> p(n);
    rep(i,n) {
        double x,y; cin >> x >> y;
        p[i] = {x,y};
    }
    double ans = 0;

    rep(i,n) {
        rep(j,n) {
            double d = 0;
            d += (p[i].first-p[j].first)*(p[i].first-p[j].first);
            d += (p[i].second-p[j].second)*(p[i].second-p[j].second);
            ans += sqrt(d);
        }
    }
    ans = ans / n;
    printf("%.15f\n", ans);
    return 0;
}


Measured memory_bytes: 3784
#include <bits/stdc++.h>
#define rep(i,x,n) for(int i=x; i<(int)(n); i++)
#define rep_eq(i,x,n) for(int i=x; i<=(int)(n); i++)
using namespace std;

using ll=long long;

int main() {
  int N; cin >>N;
  int ans=0;
  if (N==pow(10,1) or N==pow(10,2) or N==pow(10,3) or N==pow(10,4) or N==pow(10,5)) {ans=10;}
  else {
    string temp=to_string(N);
    rep(i,0,temp.size()) {
      ans+=int(temp[i]-'0');
    }
  }
  cout <<ans <<endl;
  return 0;
}


Measured memory_bytes: 3776
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
#include<stdio.h>
#include <cstdint>
#include <stdlib.h> 
#include <time.h>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define all(a) a.begin(), a.end()
#define fi first
#define se second
#define RNG(x, a, n) &((x)[a]), &((x)[n])
typedef pair<int, int> PII;
typedef long long ll;
template<typename T> bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } return false; }
template<typename T> bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; } return false; }
const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const ll mod = 1e9 + 7;


int n, p[10], q[10], a, b, cnt;

int main() {

    cin >> n;
    rep(i, n) {
        cin >> p[i];
    }
    rep(i, n) {
        cin >> q[i];
    }



    vector<int> v(n);
    for (int i = 0; i < n; i++) v[i] = i + 1;

    do {
        cnt++;
        bool aflag = true, bflag = true;

        rep(i, n) {
            if (p[i] != v[i])aflag = false;
            if (q[i] != v[i])bflag = false;
        }

        if (aflag)a = cnt;
        if (bflag)b = cnt;

    } while (next_permutation(v.begin(), v.end()));

    cout << abs(a - b) << endl;

	return 0;
}

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

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Eric
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ERoadwork solver = new ERoadwork();
        solver.solve(1, in, out);
        out.close();
    }

    static class ERoadwork {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            int q = in.nextInt();

            TreeSet<ERoadwork.Event> events = new TreeSet<>();
            for (int i = 0; i < n; i++) {
                int s = in.nextInt();
                int t = in.nextInt();
                int x = in.nextInt();

                events.add(new ERoadwork.Event(s - x, x, 2));
                events.add(new ERoadwork.Event(t - x, x, 1));
            }
            for (int i = 0; i < q; i++) {
                events.add(new ERoadwork.Event(in.nextInt(), i, 3));
            }

            TreeSet<Integer> currents = new TreeSet<>();
            int[] res = new int[q];
            for (ERoadwork.Event event : events)
                if (event.type == 2)
                    currents.add(event.x);
                else if (event.type == 1)
                    currents.remove(event.x);
                else {
                    res[event.x] = currents.isEmpty() ? -1 : currents.first();
                }

            for (int i = 0; i < q; i++) {
                out.println(res[i]);
            }

        }

        public static class Event implements Comparable<ERoadwork.Event> {
            int t;
            int x;
            int type;

            public Event(int t, int x, int type) {
                this.t = t;
                this.x = x;
                this.type = type;
            }

            public int compareTo(ERoadwork.Event o) {
                return t != o.t ? t - o.t : (type != o.type ? type - o.type : x - o.x);
            }

        }

    }
}



Measured memory_bytes: 223360
#include <iostream>
#include <set>
#include <string>
using namespace std;

int main ()
{
    int n;
    cin >> n;
    set<string> str;
    while (n--) {
        string tmp;
        cin >> tmp;
        str.insert(tmp);
    }

    cin >> n;
    int key = 0;
    while (n--) {
        string tmp;
        cin >> tmp;
        if (str.find(tmp) == str.end()) {
            cout << "Unknown " << tmp << endl;
        } else {
            cout << (key ? "Closed by " : "Opened by ") << tmp << endl;
            key = key ? 0 : 1;
        }
    }

    return 0;
}

Measured memory_bytes: 1232
# coding: utf-8
# Your code here!

[N,T] = map(int,input().split())
ca = 10000
ta = None
for _ in range(N):
    c, t = map(int,input().split())
    
    if c < ca and t <= T:
        ca = c
        ta = t

if ca == 10000:
    print("TLE")
else:
    print(ca)


Measured memory_bytes: 2940
n = int(input())
s = input()
sums = 0

r = []
g = []
b = []

for k in range(n):
    if s[k] =="R":
        r.append(k)
        for p in range(0,min(k+1,n-k)):
            if {s[k-p], s[k+p]} == {"G", "B"}:
                sums -=1
    elif s[k] =="G":
        g.append(k)
        for p in range(0,min(k+1,n-k)):
            if {s[k-p], s[k+p]} == {"R", "B"}:
                sums -=1
    else:
        b.append(k)
        for p in range(0,min(k+1,n-k)):
            if {s[k-p], s[k+p]} == {"R", "G"}:
                sums -=1

sums +=len(r)*len(g)*len(b)
print(sums)

Measured memory_bytes: 9292
//  main.cpp
//  CppTest

#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
using namespace std;

int main(int argc, const char * argv[]) {
    // cinを高速にするためのおまじない
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    /////////////////////
    // Write code below /
    /////////////////////
    int N, K;
    string S;
    cin >> N >> K >> S;
    
    K--;
    if (S.at(K) == 'A') {
        S.at(K) = 'a';
    } else if (S.at(K) == 'B') {
        S.at(K) = 'b';
    } else if (S.at(K) == 'C') {
        S.at(K) = 'c';
    }
    
    cout << S << endl;
    
    return 0;
}


Measured memory_bytes: 256
def minusOneFactorial(num):
    return sum([i-1 for i in range(1,num+1)])

N,M = [int(i) for i in input().split()]
possible_evens = minusOneFactorial(N)
possible_odds = minusOneFactorial(M) if not M==0 else 0
print(possible_evens + possible_odds)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define enld '\n'
#define rep(i,n) for(int i=0; i<(n); i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("Ofast")
constexpr ll INF = 1e18;
constexpr int inf = 1e9;
constexpr ll mod = 1000000007;
constexpr ll mod2 = 998244353;
const double PI = 3.1415926535897932384626433832795028841971;
const int dx[6] = {1, 0, -1, 0,1,1};
const int dy[6] = {0, 1, 0, -1,1,-1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
// ---------------------------------------------------------------------------


int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N;
    cin >> N;
    vector<int> cnt(N,0);
    for(int i=0; i<N-1; i++){
        int a;
        cin >> a;
        cnt[a-1]++;
    }
    for(int i=0; i<N; i++){
        cout << cnt[i] << enld;
    }
    return 0;
}

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

int main(){
    int h, w;

    while(true){
        cin >> h >> w;
        if(h == 0 && w == 0)
            break;
        for(int i = 0; i < h; i++){
            for(int j = 0; j < w; j++){
                cout << '#';
            }
            cout << '\n';
        }
        cout << '\n';
    }
    return 0;
}

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

int main(){
  string s;
  cin >> s;
  bool f = true;
  int n = s.size();
  for(int i = 0; i < n / 2; ++i){
    if(s[i] != s[n - 1 - i]) f = false;
  }
  for(int i = 0; i < n / 2 / 2; ++i){
    if(s[i] != s[n / 2 - 1 - i]) f = false;
    if(s[n / 2 + 1 + i] != s[n - 1 - i]) f = false;
  }
  cout << (f ? "Yes" : "No") << endl;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(long long i=0; i<(n); i++)
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; }

int D;
vector<int> c(26); 
vector<vector<int>> s(365, vector<int>(26));

int cal_score(vector<int> t){
    int satis = 0;
    vector<int> last(26, 0);
    rep(d, D){
        satis += s[d][t[d] - 1];
        last[t[d] - 1] = d + 1;
        rep(i, 26){
            satis -= c[i] * (d - last[i] + 1);
        }
    }
    return satis;
}

int ch_sch(vector<int> t, int d, int q, int score){
    // change t[d - 1] -> q
    // calculate the score
    int old = t[d - 1];
    score -= s[d - 1][old - 1];
    score += s[d - 1][q - 1];

    int last_old = 0, last_new = 0;
    rep(i, D){
        if(t[i] == old ) last_old = i + 1;
        else if(t[i] == q) last_new = i + 1;
        score += c[old - 1] * (i - last_old + 1);
        score += c[q - 1] * (i - last_new + 1);
    }

    t[d - 1] = q;

    last_old = 0, last_new = 0;
    rep(i, D){
        if(t[i] == old) last_old = i + 1;
        else if(t[i] == q) last_new = i + 1;
        score -= c[old - 1] * (i - last_old + 1);
        score -= c[q - 1] * (i - last_new + 1);
    }
    return score;
}

int main(){
    srand((unsigned)time(NULL));
    
    // input 
    cin >> D;
    rep(i, 26) cin >> c[i];
    rep(i, D){
        rep(j, 26){
            cin >> s[i][j];
        }
    }

    // greedy
    vector<int> last(26, 0);
    vector<int> res(D);

    rep(d, D){
        int max_plus = -10000;
        int use = -1;
        rep(i, 26){
            int tmp = s[d][i] + c[i] * (d - last[i] + 1);
            if(max_plus < tmp){
                max_plus = tmp;
                use = i;
            }
        }
        last[use] = d + 1;
        res[d] = use + 1;
    }

    int cur_score = cal_score(res);

    while((clock() / (double)CLOCKS_PER_SEC) <= 1.98){
        int ch_d = rand() % D + 1;
        int ch_c = rand() % 26 + 1;
        int new_score = ch_sch(res, ch_d, ch_c, cur_score);
        if(cur_score < new_score){
            cur_score = new_score;
            res[ch_d - 1] = ch_c;
        }
    }

    rep(i, D){
        cout << res[i] << endl;
    }
    return 0;
}


Measured memory_bytes: 3700
//* dp[i] = 1; if Taro win
//*         0; otherwise

//* dp[i]=1; if dp[i-A[j]]==0 where j belongs to [0, n-1]
//*       0 otherwise

//* BASE CASE
//* dp[0]=0; If there are 0 stones in pile then Taro looses

#include<bits/stdc++.h>

using namespace std;

int main(){
    int n, k;
    cin>>n>>k;
    vector<int> A(n);
    for(int &x:A){
        cin>>x;
    }
    vector<int> dp(k+1);
    for(int i=1;i<=k;i++){
        bool doesExist=false;
        for(int j=0;j<n;j++){
            if(i-A[j]>=0){
                if(dp[i-A[j]]==0){
                    doesExist=true;
                    break;
                }
            }else{
                doesExist=false;
                break;
            }
        }
        if(doesExist){
            dp[i]=1;
        }
    }
    if(dp[k]){
        cout<<"First"<<endl;
    }else{
        cout<<"Second"<<endl;
    }

}

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

int gcd(int a, int b)
{
   if (a%b == 0)
   {
       return(b);
   }
   else
   {
       return(gcd(b, a%b));
   }
}

int lcm(int a, int b)
{
   return a * b / gcd(a, b);
}

int main() {
  int X;
  cin>>X;
  if(360%X==0) cout<<360/X;
  else cout<<lcm(X,360)/X;
}


Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
const int N=2e5+7;
int n,n1,s1,s2,a[N],pw1[N],pw2[N];
char ch[N];
int solve(int x)
{
	if(!x)return 0;
	int num=0,tmp=x;
	while(x){if(x&1)num++;x/=2;}
	return 1+solve(tmp%num);
}
int main()
{
	scanf("%d",&n);
	scanf("%s",ch+1);
	for(int i=1;i<=n;i++){a[i]=ch[i]-'0';if(a[i])n1++;}
	if(n1>=2)
	{
		pw1[n]=1;
		for(int i=n-1;i;i--)pw1[i]=2ll*pw1[i+1]%(n1-1);
		for(int i=1;i<=n;i++)if(a[i])s1=(s1+pw1[i])%(n1-1);
	}
	pw2[n]=1;
	for(int i=n-1;i;i--)pw2[i]=2ll*pw2[i+1]%(n1+1);
	for(int i=1;i<=n;i++)if(a[i])s2=(s2+pw2[i])%(n1+1);
	for(int i=1,x;i<=n;i++)
	if(a[i])
	{
		if(n1<=1)puts("0");
		else x=(s1-pw1[i]+n1-1)%(n1-1),printf("%d\n",solve(x)+1);
	}
	else x=(s2+pw2[i])%(n1+1),printf("%d\n",solve(x)+1);
}

Measured memory_bytes: 6252
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <map>
#include <queue>
#include <stack>
#include <vector>
#include <deque>
#include <functional>
#include <string>
#include <iostream>
#include <cctype>
#include <set>
#include <climits>
#include <iomanip>
#include <cassert>

//#include <bits/stdc++.h>

using namespace std;





int main()
{
   int n;
   cin >> n;
   int a[n+1];
   for(int i=0;i<n;i++) {
    cin >> a[i];
   }

   sort(a,a+n);

   int x = a[n-1];
   int sum = 0;
   for(int i=0;i<n-1;i++) {
    sum += a[i];
   }

   if(sum<=x)
    cout << "No" << endl;
   else
    cout << "Yes" << endl;


    return 0;
}



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

int main(){
    int x[5];
    for(int i=0;i<5;++i) cin >> x[i];
    for(int i=0;i<5;++i){
        if(x[i] == 0){ cout << i+1 << endl; return 0; }
    }
    
    return 0;
}

Measured memory_bytes: 3580
#include <iostream>
    #include <vector>
    #include <algorithm>
    #include <numeric>
     
    using namespace std;
     
    int main() {
      int n,k;
      cin >> n >> k;
      
      int ans;
      ans = (n+1)/2;
      
      if(ans>=k){
        cout << "YES" << endl;
      } else {
        cout << "NO" << endl;
      }
      
      
      return 0;
    }

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

string solution(int x, int y) {
    int min = x*2;
    int max = x*4;
    if( y >= min && y <= max && y % 2 == 0 ) {
        return "Yes";
    }
    else {
        return "No";
    }
}

int main(){

    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int x, y ;
    cin >> x >> y;

    cout << solution (x, y);

    return 0;  

}


Measured memory_bytes: 3656
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <fstream>
#include <iostream>
#include <map>
#include <queue>
#include <string>
#include <stack>
#include <vector>
#include <set>
#include <tuple>
#include <utility>
#include <functional>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
const int INF = 1000000000;
const int MOD = 1000000007;

int main(){
	int n,t;
	cin >> n >> t;

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

	int mn = 1000000010;
	int mx = 0;
	for(int i = 0;i < n;i++){
		mx = max(mx,a[i]-mn);
		mn = min(mn,a[i]);
	}

	map<int,int> cnt;
	ll ans = 0;
	for(int i = 0;i < n;i++){
		ans += cnt[a[i]-mx];
		cnt[a[i]]++;
	}

	cout << ans << endl;
}


Measured memory_bytes: 9984
#include <stdio.h>

#define N 100

int main(){

  int hairetu[N],i,j,nagasa,tmp,count=0;

  scanf("%d",&nagasa);

  for(i=0;i<nagasa;i++) scanf("%d",&hairetu[i]);

  for(j=nagasa-1;j>0;j--){

    for(i=nagasa-1;i>0;i--){

      if(hairetu[i]<hairetu[i-1]){

	tmp=hairetu[i];
	hairetu[i]=hairetu[i-1];
	hairetu[i-1]=tmp;

	count++;

}

    }

}

  for(i=0;i<nagasa-1;i++) printf("%d ",hairetu[i]);
  printf("%d",hairetu[i]);
  printf("\n%d\n",count);

  return 0;

}

Measured memory_bytes: 600
import java.util.Scanner;

public class Main{
         public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        for(int i = 0; i < s.length(); i++){
        	if( Character.isUpperCase(s.charAt(i)) ){
        		System.out.print(Character.toLowerCase(s.charAt(i)));
            }else if( Character.isLowerCase(s.charAt(i)) ){
        		System.out.print(Character.toUpperCase(s.charAt(i)));
            }else{ 
            	System.out.print(s.charAt(i));
        }
        sc.close();
    }
   	System.out.println();
  }
}




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

using namespace std;

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

typedef long long ll;

const int Inf = 1e9;
const double EPS = 1e-9;
const int MOD = 1e9 + 7;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    double res = 0;
    int n;
    cin >> n;
    vector<pair<int, int> > v;
    rep (i, n) {
        int x, y;
        cin >> x >> y;
        v.push_back(make_pair(x, y));
    }
    sort(v.begin(), v.end());
    int cnt = 0;
    do {
        cnt++;
        rep (i, n - 1) {
            res += sqrt((v[i].first - v[i + 1].first) * (v[i].first - v[i + 1].first) + (v[i].second - v[i + 1].second) * (v[i].second - v[i + 1].second));
        }
    } while (next_permutation(v.begin(), v.end()));
    res /= cnt;
    cout << fixed << setprecision(7);
    cout << res << endl;
    
    return 0;
}



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

bool isprime(int n)
{
	for(int i=2;i*i<=n;i++)
	  if(n%i==0)
	    return false;
	    
	 return true;   
}

int main()
{
  int x;
  cin>>x;
  for(int i=x;;i++)
    if(isprime(i))
    {
      cout<<i<<"\n";
      return 0;
    }
  
  
  return 0;
}

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

int main()
{
    int n;
    std::cin>>n;
    std::vector<int> p(n);
    for(int i=0;i<n;i++)std::cin>>p[i];
    int cnt = 0;
    for(int i=1;i<n-1;i++){
        int f = p[i-1] , s = p[i], t = p[i+1];
        if(f<s&&s<t)cnt++;
        if(t<s&&s<f)cnt++;
    }
    std::cout<<cnt<<std::endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#define MAXN 56
using namespace std;
long long d[MAXN][MAXN][MAXN*MAXN],ans;
int n,A,a[MAXN],sum[MAXN];
int main()
{
	scanf("%d%d",&n,&A);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);
		sum[i]=sum[i-1]+a[i];
	}
	for(int i=0;i<=n;i++)
		d[i][0][0]=1;
	for(int i=1;i<=n;i++)
		for(int j=1;j<=i;j++)
			for(int k=1;k<=sum[i];k++)
			{
				d[i][j][k]=d[i-1][j][k];
				if(k>=a[i]) d[i][j][k]=d[i][j][k]+d[i-1][j-1][k-a[i]];
			}
	for(int i=1;i<=n;i++)
		ans+=d[n][i][A*i];
	printf("%lld",ans);
}

Measured memory_bytes: 69760
import java.util.*;

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

        int n = sc.nextInt();
        if (n == 100000)
            System.out.println(90909);
        else if (n >= 10000)
            System.out.println(n - 10000 + 1 + 909);
        else if (n >= 1000)
            System.out.println(909);
        else if (n >= 100)
            System.out.println(n - 100 + 1 + 9);
        else if (n >= 10)
            System.out.println(9);
        else
            System.out.println(n);
    }
}

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


bool isBomb(vector<string> &map, int x, int y){
    int h = map.size();
    int w = map.at(0).size();
    bool d = true;
    if (x < 0 || y < 0 || x >= h || y >= w){
        d = false;
    }

    bool count = false;
    if (d){
        if (map.at(x).at(y) == '#'){
            count = true;
        }     
    }
    return count;
}

int digit(vector<string> &map, int x, int y){
    int count = 0;

    if (isBomb(map, x-1, y-1)){//topleft
        count++;
    }
    if (isBomb(map, x-1, y)){//topmiddle
        count++;
    }
    if (isBomb(map, x-1, y+1)){//topright
        count++;
    }
    if (isBomb(map, x, y-1)){//middleleft
        count++;
    }
    if (isBomb(map, x, y+1)){//middleright
        count++;
    }
    if (isBomb(map, x+1, y-1)){//bottomleft
        count++;
    }
    if (isBomb(map, x+1, y)){//bottommiddle
        count++;
    }
    if (isBomb(map, x+1, y+1)){//bottomright
        count++;
    }

    return count;
}

int main(){
    int h, w;
    cin >> h >> w;

    vector<string> map(h);
    for (int i = 0; i<h; i++){
        cin >> map.at(i);
    }

    for (int i = 0; i<h; i++){
        for (int j = 0; j<w; j++){
            if (map.at(i).at(j) == '#'){
                cout << '#';
            }else{
                cout << digit(map, i, j);
            }      
        }
        cout << endl;
    }
}

Measured memory_bytes: 256
using System;
class Program
{
	static void Main(string[] args)
	{
		// スペース区切りの整数の入力
		string[] input = Console.ReadLine().Split(' ');
		string msg = input[0];
		int replaceCount = 0;
		for(int i = 0 ; i < msg.Length/2 ; i++)
            if (msg[i]!=msg[msg.Length-1-i])
            	replaceCount ++;
		Console.WriteLine(replaceCount);
	}
}


Measured memory_bytes: 13140
#include <iostream>
#include <iomanip>
#include <string>
#include <algorithm>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,s,n) for(int i = (s);i<(int)(n);i++)

int main(){
    int k , a , b;
    cin >> k >> a >> b;
    bool l = 0;
    rep2(i,a,b+1){
        if(i % k == 0){
            l = 1;
            break;
        }
    }
    if(l == 1)cout << "OK" << endl;
    else cout << "NG" << endl;
}

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

int main(void) {
	char s[200001] = { 0 };
	int len;
	long long ans = 0;

	scanf("%s", s);

	len = strlen(s);
	int a_cnt = 0;
	char temp;
	for (int i = 0; i < len; i++) {
		if (s[i] == 'A')a_cnt++;
		else if (s[i] == 'B' && s[i + 1] == 'C') {
			if (a_cnt) {
				s[i + 1] = 'A';
				ans += a_cnt;
				a_cnt--;
			}
		}
		else a_cnt = 0;
	}
	printf("%lld", ans);
	return 0;
}


Measured memory_bytes: 384
#include<stdio.h>
#include<string.h>

int main(){
  char s1[100];
  char s2[100];
  char s3[100];
  int n;

  scanf("%s""%s",s1,s2);

  n = strlen(s2) - 1;

  strncat(s3,s2,n);

  if(strcmp(s1,s3)==0)
  printf("Yes\n");
  else
  printf("No\n");
  return 0;
}

Measured memory_bytes: 1648
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[][] a = new int[2][n];
		for(int i = 0 ; i < 2 ; i++) {
			for(int j = 0 ; j < n ; j++) {
				a[i][j] = sc.nextInt();
			}
		}
		int[][] dp = new int[2][n];
		dp[0][0] = a[0][0];
		dp[1][0] = dp[0][0] + a[1][0];
		for(int i = 1 ; i < n ; i++) dp[0][i] = dp[0][i - 1] + a[0][i];
		for(int i = 1 ; i < n ; i++) {
			dp[1][i] = Math.max(dp[1][i - 1] + a[1][i], dp[0][i] + a[1][i]);
		}
		System.out.println(dp[1][n - 1]);
	}
}


Measured memory_bytes: 21844
n,m = map(int,input().split())
x = list(map(int,input().split()))

if n >= m:
    print(0)
else:
    x = sorted(x)
    xx = [x[i+1]-x[i] for i in range(len(x)-1)]

    xx = sorted(xx, reverse=True)
    xx = xx[n-1:]
    ans = 0
    for i in xx:
        ans+=i
    print(ans)


Measured memory_bytes: 13964
def solve(a):
	for i in M-set(a):
		if any(x == i and y not in a for x,y in xy): continue
		r = solve([i]+a)
		if r: return r
	return a
m = input()
M = set(range(1,m+1))
xy = [map(int,raw_input().split()) for i in range(input())]
for i in solve([]): print i

Measured memory_bytes: 4240
#include<bits/stdc++.h>
using namespace std;
#define double long double
#define int long long 
#define f(z) for(int i=1;i<=z;i++)
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define vi vector<int>
#define pb push_back
#define si set<int>
int cl(int n ,int m) { if(n%m)return n/m + 1 ;else return n/m ;}
int pw(int a,int b){int r=1;while(b>0){if(b&1)r=r*a;a=a*a;b>>=1;}return r;}
#define mod  1000000007
#define T() int TT; cin>>TT; while(TT--)
#define P pair<int,int>
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

const int N = 1e6 + 5 ;

signed main(){
	int a[3] ; 
	cin >> a[1] >> a[2] >> a[3] ; 
	sort(a+1 , a+4 , greater<int>()) ;

	int x = a[1]*10 + a[2] + a[3] ; 
	cout << x ;

}


Measured memory_bytes: 256
# D - Binomial Coefficients

import bisect

n = int(input())
a = sorted(list(map(int, input().split())))
    
idx = bisect.bisect_left(a, a[-1]//2)
tmp = float("inf")

try:
    if idx != n-1:
        tmp = abs(a[idx]-a[-1]/2)
        ans = [a[-1], a[idx]]
    if abs(a[idx-1] - a[-1]/2) < tmp:
        tmp = abs(a[idx-1] - a[-1]/2)
        ans = [a[-1], a[idx-1]]
    if abs(a[idx+1] - a[-1]/2) < tmp and idx+1 != n-1:
        ans = [a[-1], a[idx+1]]
except IndexError:
    pass

print(*ans)

Measured memory_bytes: 62704
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>
#include<cmath>
#include<cstdio>
#include<tuple>
#include<bitset>
#include<map>
#include<stack>

using namespace std;
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define ALL(x) x.begin(),x.end()
#define ll long long
using lint=long long;
typedef pair<int,int> P;
const int inf=1000000007;
const int MOD=1000000007;
signed main(){
  int r,c,n;cin>>r>>c>>n;
  vector<pair<P,P>> p(n);
  rep(i,n){
      P f,b;cin>>f.first>>f.second>>b.first>>b.second;
      p[i]={f,b};
  }
  vector<P> top,bottom,right,left;
  rep(i,n){
      if(p[i].first.first%r==0||p[i].first.second%c==0){
          if(p[i].second.first%r==0||p[i].second.second%c==0){
              if(p[i].first.second==0){
                  top.push_back({p[i].first.first,i});
              }
              else if(p[i].first.second==c){
                  bottom.push_back({p[i].first.first,i});
              }
              else if(p[i].first.first==0){
                  left.push_back({p[i].first.second,i});
              }
              else{
                  right.push_back({p[i].first.second,i});
              }
              if(p[i].second.second==0){
                  top.push_back({p[i].second.first,i});
              }
              else if(p[i].second.second==c){
                  bottom.push_back({p[i].second.first,i});
              }
              else if(p[i].second.first==0){
                  left.push_back({p[i].second.second,i});
              }
              else{
                  right.push_back({p[i].second.second,i});
              }
          }
      }
  }
  sort(top.begin(),top.end());
  sort(bottom.begin(),bottom.end());
  sort(left.begin(),left.end());
  sort(right.begin(),right.end());
  reverse(ALL(bottom));
  reverse(ALL(left));
  vector<P> all;
  for(auto& val:top)all.push_back(val);
  for(auto& val:right)all.push_back(val);
  for(auto& val:bottom)all.push_back(val);
  for(auto& val:left)all.push_back(val);
  vector<P> position(n,{inf,inf});
  int nm=all.size();
  stack<int> st;
  st.push(inf);
  int front=all[0].second;
  rep(i,nm){
      if(i>=0){
          if(st.top()==all[i].second){
              front=st.top();st.pop();
          }
          else{
              st.push(all[i].second);
          }
      }
      //cout<<all[i].second<<"\n";
      if(position[all[i].second].first==inf){
        position[all[i].second].first=i;
      }
      else{
          position[all[i].second].second=i;
      }
  }
  	if(st.top()==inf){
          cout<<"YES"<<endl;
          return 0;
      }
      else{
          cout<<"NO"<<endl;
          return 0;
      }
  vector<int> sm(n*3+10,0);
  //cout<<1<<"\n";
  rep(i,n){
      if(position[i].first==inf)continue;
      sm[position[i].first]+=1;
      sm[position[i].second+1]-=1;
  }
  rep1(i,n*3+9){
      sm[i]+=sm[i-1];
  }
  bool flag=true;
  //cout<<0<<"\n";
  rep(i,n){
      if(position[i].first==inf)continue;
      if(sm[position[i].first]!=sm[position[i].second])flag=false;
  }
	if(flag){
        cout<<"YES"<<endl;
    }
    else{
        cout<<"NO"<<endl;
    }
  return 0;
}

Measured memory_bytes: 9416
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))

ll a[110];
int main(){
	ll n=0;
	while(1){
		char c;
		c=getchar();
		if(c==10)break;
		if(c==' ')continue;
		n=n*10+c-48;
	}
	ll t=sqrt(n);
	puts(t*t==n?"Yes":"No");
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define ll long long                                    // long long省略
#define pb push_back                                    // push_back省略
#define mp make_pair                                    // make_pair省略
#define fi first                                        // first省略
#define se second                                       // second省略
#define itn int                                         // int誤字保険
#define count cout                                      // cout誤字保険
#define vecotr vector                                   // vector誤字保険
#define ednl endl                                       // endl誤字保険
#define opt() cin.tie(0); ios::sync_with_stdio(false)   // 入出力速度改善

#define rep(i,l,r) for(ll i=(l);i<(r);i++)               // 範囲[l, r)で刻み1のfor文(順方向)
#define repp(i,l,r,k) for(ll i=(l);i<(r);i+=(k))         // 範囲[l, r)で刻みkのfor文(順方向)
#define rrep(i,l,r) for(ll i=(r-1);i>=(l);i--)           // 範囲[l, r)で刻み1のfor文(逆方向)
#define rrepp(i,l,r,k) for(ll i=(r-1);i>=(l);i-=(k))     // 範囲[l, r)で刻みkのfor文(逆方向)
#define all(x) (x).begin(), (x).end()                   // vectorのポインタ位置指定用
#define max(p,q)((p)>(q)?(p):(q))                       // max拡張
#define min(p,q)((p)<(q)?(p):(q))                       // min拡張
#define bit(n,m)(((n)>>(m))&1)                          // 変数nのm番目のbitを取り出す

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; }

int dy[]={0, 1, 0, -1};                                 // 4方向近傍
int dx[]={1, 0, -1, 0};                                 // 4方向近傍

#define INF ((1LL<<62)-(1LL<<31))
//#define MOD 998244353
#define MOD 1000000007
#define invp(a,p) pom(a,p-2,p)

////////////////////////////////////////////////////////////////////////////////////////
int main(){
    ll n, a, b, c, d, e;
    cin >> n >> a >> b >> c >> d >> e;
    a = (n + a - 1) / a;
    b = (n + b - 1) / b;
    c = (n + c - 1) / c;
    d = (n + d - 1) / d;
    e = (n + e - 1) / e;

    ll res = max(a,b);
    res = max(res, b);
    res = max(res, c);
    res = max(res, d);
    res = max(res, e);
  	//cout << a << " " << b << " " << c << " " << d << " " << e << ednl;
    cout << res + 4 << ednl;

}


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

int main(){
	string al = "abcdefghijklmnopqrstuvwxyz";
	char a;
	cin >> a;
	for(int i = 0; i<al.size();i++){
		if(al[i]==a){
			cout << al[i+1];
			break;
		}
	}
}

Measured memory_bytes: 3632