akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#pragma GCC optimize("trapv")
#define I inline void 
#define S struct 
#define vi vector<int> 

using namespace std ; 
using ll = long long ; 
using ld = long double ; 

const int N = 1e5 + 7 , mod = 1e9 + 7 ; 
int n ; 

// How interesting!

int main(){
	ios_base::sync_with_stdio(0) ; 
	cin.tie(0) ;
	//freopen("in.in" , "r" , stdin) ; 
	string s , t; 
	cin >> s >> t ; 
	int n = s.size() ; 
	int m = t .size() ; 
	int ans = 1e8 ; 	
	for(int i = 0 ;i + m <= n;i ++){
		int res = 0 ; 
		for(int j = 0 ;j< m;j++){
			res+= (t[j] != s[i + j]) ; 
		}
		ans = min(ans , res) ;
	}
	cout << ans ; 
	return 0 ; 
}


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

int main() {
    string s;
    cin>>s;
    ll ans = 0;
    ll l=0, r=0;
    rep(i,s.size()){
        if(s[i]=='<'){
            r++;
        }
        if(s[i]=='>'){
            l++;
        }
        if((s[i]=='>' && s[i+1]=='<') || i==s.size()-1){
            if(l<=r){
                
                ans += r*(r+1)/2 + l*(l-1)/2;
            }else{
                ans += r*(r-1)/2 + l*(l+1)/2;
            }
            l=0;r=0;
        }
    }
    cout<<ans<<endl;
    return 0;
    
   
}


Measured memory_bytes: 900
#include <iostream>
#include <sstream>
#include <unordered_set>
#include <vector>

using namespace std;

int main()
{
    int n;
    cin >> n;
    vector<int> v;
    for (int i = 0; i < n; ++i) {
        int d;
        cin >> d;
        v.push_back(d);
    }
    auto pow = [](int b, int e) {
        int r = 1;
        for (int i = 0; i < e; ++i) {
            r *= b;
        }
        return r;
    };
    for (int width = 1; width <= n; ++width) {
        unordered_set<int> s;
        for (int i = 0; i <= v.size() - width; ++i) {
            vector<int> vv(begin(v) + i, begin(v) + i + width);
            stringstream ss;
            for (size_t j = 0; j < vv.size(); ++j) {
                if (j == 0 && v[j] == 0 && width != 1) {
                    continue;
                }
                ss << vv[j];
            }
            s.insert(stoi(ss.str()));
        }

        const auto base = pow(10, width);
        for (int j = width == 1 ? 0 : base / 10; j < base; ++j) {
            if (s.find(j) == end(s)) {
                cout << j << endl;
                return 0;
            }
        }
    }
}


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

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll n, sum = 0;
	cin >> n;
	for(int i = 1; i <= n; i++) {
		for(ll j = i; j <= n; j += i) sum += j;
	}
	cout << sum << "\n";
	return 0;
}

Measured memory_bytes: 3636
x=int(input())
if x>=0:
	a=0
	while True:
		b5=a**5-x
		if b5>=0:
			b=int(b5**(1/5))
		else:
			b=int((-1)*((-1)*b5)**(1/5))
		if a**5-b**5==x:
			print(a,b)
			break
		elif a**5-(b+1)**5==x:
			print(a,b+1)
			break
		elif a**5-(b-1)**5==x:
			print(a,b-1)
			break
		a+=1
else:
	a=0
	while True:
		b5=a**5-x
		if b5>=0:
			b=int(b5**(1/5))
		else:
			b=int((-1)*((-1)*b5)**(1/5))
		if a**5-b**5==x:
			print(a,b)
			break
		elif a**5-(b+1)**5==x:
			print(a,b+1)
			break
		elif a**5-(b-1)**5==x:
			print(a,b-1)
			break
		a-=1

Measured memory_bytes: 9516
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <tuple>
#include <cassert>

using namespace std;

#define all(c) (c).begin(), (c).end()
#define iter(c) __typeof((c).begin())
#define cpresent(c, e) (find(all(c), (e)) != (c).end())
#define tr(c, i) for (iter(c) i = (c).begin(); i != (c).end(); ++i)
#define pb(e) push_back(e)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define mp(a,b) make_pair((a), (b))
#define mt(a,b,c) make_tuple((a),(b),(c))

typedef long long ll;

int main(){
    int n,a,b,c; cin >> n >> a >> b >> c;
    vector<char> v;
    vector<string> vs(n);
    rep(i,n) cin >> vs[i];
    for(int i=0;i<n;i++){
        string s = vs[i]; 
        if(s=="AB"){
            if(a==0&&b==0){cout << "No" << endl; return 0;}
            if(a == b == 1 && i!=n-1 && vs[i+1]!=s){
                if(vs[i+1]=="BC"){a--; b++; v.pb('B');}
                else if(vs[i+1]== "AC"){b--;a++;  v.pb('A');}
            }
            else if(a <= b){b--; a++; v.pb('A');}
            else{b++; a--; v.pb('B');}
        }
        if(s=="AC"){
            if(a==0&&c==0){cout << "No" << endl; return 0;}
            if(a == c == 1 && i!=n-1 && vs[i+1]!=s){
                if(vs[i+1]=="BC"){a--; c++; v.pb('C');}
                else if(vs[i+1]== "AB"){c--;a++;  v.pb('A');}
            }
            else if(a <= c){c--; a++; v.pb('A');}
            else{c++; a--; v.pb('C');}
        }
        if(s=="BC"){
            if(b==0&&c==0){cout << "No" << endl; return 0;}
            if(b == c == 1 && i!=n-1 && vs[i+1]!=s){
                if(vs[i+1]=="AC"){b--; c++; v.pb('C');}
                else if(vs[i+1]== "AB"){c--;b++;  v.pb('B');}
            }
            else if(c <= b){b--; c++; v.pb('C');}
            else{b++; c--; v.pb('B');}
        }
    }
    cout << "Yes" << endl;
    rep(i,n) cout << v[i] << endl;
    return 0;
}

Measured memory_bytes: 6732
//A,Elebereth Gilthoniel mantae!
//For Temeria!
#include<iostream>
#include<algorithm>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<cstdio>
#include<map>
#include<stack>
#include<queue>
#include<cstring> 
using namespace std;;
vector<int> v[100008];int tag[100008];int vis[100008];int flag=0;int op;
void dfs(int x,int c)
{
//	cout<<x<<" "<<c;
	vis[x]=1;tag[x]=c;
	for(int i=0;i<v[x].size();i++)
	{
		int t=v[x][i];
		if(vis[t]==1) 
		{
			if(tag[t]==c) flag=1;
			continue;
		}
		dfs(t,!c);
	}
	if(c==0) op++;
}
int main()
{
	int n,m;cin>>n>>m;
	for(int i=0;i<m;i++)
	{
		int ai,bi;cin>>ai>>bi;v[ai].push_back(bi);v[bi].push_back(ai);	
	}
	dfs(1,0);
	if(flag)
	{
		cout<<(long long)n*(long long)(n-1)/(long long)2-(long long)m;
	}
	else
	{
		cout<<(long long)op*(long long)(n-op)-m;
	}
	return 0;
}


Measured memory_bytes: 7296
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> vvl;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvec;
typedef vector<vector<bool>> vveb;
typedef vector<vector<string>> vves;
#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 rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pb push_back
#define pp pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
typedef long long int64;
//const int64 INF = 1LL << 58;
#define dame { puts("-1"); return 0;}
#define YES { cout << "YES" << endl; return 0; }
#define NO { cout << "NO" << endl; return 0; }
#define Yes { cout << "Yes" << endl; return 0; }
#define No { cout << "No" << endl; return 0; }
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 (a>b) { a=b; return 1; } return 0; }
int dx[] = {0, 0, -1, 1};
int dy[] = {1, -1, 0, 0};

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

    ll n,a,b,c,d,e;
    cin >>n>>a>>b>>c>>d>>e;
    cout << max({(n-1)/a,(n-1)/b,(n-1)/c,(n-1)/d,(n-1)/e})+5<<endl;
    return 0;

}

Measured memory_bytes: 256
using System;
class Program
    {
        static void Main(string[] args)
        {

            // 自分の得意な言語で
            // Let's チャレンジ！！

            var line = System.Console.ReadLine();
            var nums = line.Split(new char[] { ' ' });
            int M = Convert.ToInt32(nums[0]);
            int N = Convert.ToInt32(nums[1]);
            if(M == N)
            { Console.WriteLine("Yes"); }
            else
            {
                Console.WriteLine("No");
            }
        } 
    }

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

int main () 
{
 int N ;
 scanf("%d",&N);
 int A , B;
 if (N==1)printf("Hello World");

 else if (N==2)
 {
  scanf("%d",&A);
  scanf("%d",&B);
  printf("%d",A+B);
 }
 

 return 0;
}

Measured memory_bytes: 128
/*

                         YATIN KWATRA                   _03_08_14


Let's Hoop..

------------------------------------------------

           o
 /|   o         o
 \|=--            o
    ##
                    \\
                 /   \O
                O_/   T
                T    /|
                |\  | |
 _______________|_|________

------------------------------------------------

o- - -  \o          __|
   o/   /|          vv`\
  /|     |              |
   |    / \_            |
  / \   |               |
 /  |                   |


------------------------------------------------

HOOPER_4_LYF..

*/

// AC BAKSHI RABBA

// #pragma GCC optimize "trapv"

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define FIO                     ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pbds                    tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define ll                      long long
#define ld                      long double
#define ull                     unsigned long long
#define endl                    "\n"
#define fo(i,a,b)               for(int i = a; i<=b ; i++)
#define rfo(i,a,b)              for(int i = a; i>=b ; i--)
#define vii                     vector<int>
#define vll                     vector<ll>
#define pq                      priority_queue
#define uom                     unordered_map
#define all(v)                  v.begin(),v.end()
#define mp                      make_pair
#define pb                      push_back
#define pob                     pop_back
#define ff                      first
#define ss                      second
#define pii                     pair<int,int>
#define pll                     pair<ll,ll>
#define mll                     map<ll,ll>
#define mii                     map<int,int>
#define vvii                    vector<vii>
#define vvll                    vector<vll>
#define mod                     1000000007
#define MIN                     -1e9
#define pi                      3.1415926535897932384626433832795

using namespace std;
using namespace __gnu_pbds;

void INPUT()
{
#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif
}

/*
----------------------------------------------------------------

   -> Check For Overflows
   -> Out of Bounds
   -> Initialisations of global arrays and variables
   -> Read the Question and the sample test cases carefully
   -> Its not Always Complex, Try to simplify
   -> write it down and try to solve
   -> Have Faith in urself and in ur approach
   -> If it seems totally out of reach, switch to next :)
   -> And Come Back later, if possible ..

----------------------------------------------------------------*/

ll n, t, x, y, z;
string s, s1, s2;

void solve()
{
  cin >> n >> x >> t;

  ll ans = (ceil)((n) / (ld)(x));
  ans *= t;
  cout << ans << endl;

}

int main() {

  FIO
  INPUT();

  int t;
  t = 1;
// cin >> t;

  fo(i, 0, t - 1)
  {
    solve();
  }
  return 0;
}

Measured memory_bytes: 3644
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<pair<ll, ll>>> vvpll;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;

int main() {
    ll n;
    cin >> n;

    vl a(n);
    ll u = 1;
    rep(i, n) {
        cin >> a[i];
        if(a[i] == u) {
            u++;
        }
    }

    if(u == 1) {
        out(-1);
        re0;
    }

    out(n - u + 1);
    re0;
}

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

int dSum(int num){
	int sum = 0;
	while(num){
    		sum += num%10;
    		num /= 10;
	}

	return sum;
}

int main(){
	int n;
	cin>>n;
	int minsum = 999999999;
	int a = 1, b = n-1;
	int fsum = 0;
	while(a <= b){
		fsum = dSum(a) + dSum(b);
		if(fsum < minsum) minsum = fsum;
		a++; b--;
	}
	cout<<minsum<<endl;
}


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

int com(int x,int y){
  long long int ans;
  if(y==0)return 1;
  if(y==1)return x;
  ans = x;
  for(int i=1;i<y;i++)ans *= x-i;
  for(int i=0;i<y;i++)ans /= y-i;
  return ans;
}

int main(){
  int n;
  int a,d,y;

  while(1){
    cin >> n;
    if(!n)break;

    a = 0;
    for(int i=0;i<=n/3;i++){
      for(int j=0;j<=(n-3*i)/2;j++){
	a += com(i+j+(n-3*i-2*j),i+j) * com(i+j,i);
      }
    }

    d = a/10;
    if(d*10 != a)d++;
    y = d/365;
    if(y*365 != d)y++;
    cout << y << endl;
  }
}

Measured memory_bytes: 0
#include <stdio.h>

int main(void)
{
	int W,H,x,y,r;
	scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);
	if(W>=x+r && H>=y+r && x-r>=0 && y-r>=0 ){
		printf("Yes\n");
	}else{
		printf("No\n");
	}
	return 0;
}

Measured memory_bytes: 584
#include <iostream>
#include <string>
#include<vector>
#include<algorithm>
#include<utility>
#include<queue>
#include<math.h>
#include<stack>
#include<set>
#include<map>
#define INF 2e9
#define rep(i,n,m) for(int i=n;i<m;i++)

using namespace std;

vector<long long int>Ans;
int main()
{
	long long int n;
	long long int x;
	cin >> n;
	vector<char>a;
	if (n % 26 == 0){
		a.push_back('z');
		n -= 26;
	}
	else {
		a.push_back(char(int('a') + n % 26 - 1));
		n -= n % 26;
	}
	int i = 2;
	x = 26;
	while (1)
	{
		if (n > 0)
		{
			if ((n / x) % 26 == 0) {
				a.push_back('z');
				n -= x * 26;
			}
			else {
				a.push_back(char(int('a') + (n / x) % 26 - 1));
				n = n - x * ((n / x) % 26);
			}
			x = pow(26, i);
			i++;
		}
		else break;
	}
	for (int i = a.size() - 1; i >= 0; i--)cout << a[i];
}


Measured memory_bytes: 3976
#include<stdio.h>
#include<math.h>
#define MAX 10000
#define NIL -1

struct Node { int parent, left, right; };

struct Node T[MAX];
//節点、深さ、高さ
int n, D[MAX], H[MAX];

void setDepth(int u, int d){
  if (u == NIL) return;
  D[u] = d;
  setDepth(T[u].left, d+1);
  setDepth(T[u].right, d+1);
}

int setHeight(int u){
	int h1 = 0, h2 = 0;
	if (T[u].left != NIL) h1 = setHeight(T[u].left) + 1;
	if (T[u].right != NIL) h2 = setHeight(T[u].right) + 1;
	return H[u] = (int)fmax(h1, h2);
}

//節点uの兄弟を返す
int getSibling(int u){
	if (T[u].parent == NIL) return NIL;
	if (T[T[u].parent].left != u && T[T[u].parent].left != NIL) return T[T[u].parent].left;
	if (T[T[u].parent].right != u && T[T[u].parent].right != NIL) return T[T[u].parent].right;
	return NIL;
}

void print(int u){
	printf("node %d: parent = %d, sibling = %d, ", u, T[u].parent, getSibling(u));
	int deg = 0;
	if (T[u].left != NIL) deg++;
	if (T[u].right != NIL) deg++;
	printf("degree = %d, depth = %d, height = %d, ", deg, D[u], H[u]);

	if (T[u].parent == NIL){
		printf("root\n");
	} else if (T[u].left == NIL && T[u].right == NIL){
		printf("leaf\n");
	} else {
		printf("internal node\n");
	}
}

int main(){
	int v, l, r, root=0;
	scanf("%d", &n);

	for (int i=0; i<n; i++) T[i].parent = NIL;

	for (int i=0; i<n; i++){
		scanf("%d %d %d", &v, &l, &r);
		T[v].left = l;
		T[v].right = r;
		if (l != NIL) T[l].parent = v;
		if (r != NIL) T[r].parent = v;
	}

	for (int i=0; i<n; i++){
		if (T[i].parent == NIL){
			root = i;
		}
	}

	setDepth(root, 0);
	setHeight(root);

	for (int i=0; i<n; i++) print(i);

	return 0;
}


Measured memory_bytes: 2080
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Map;
import java.util.logging.Logger;

public class Main {

	public static void main(String[] args) {
		printAnswer();
	}

	private static void printAnswer() {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		try {
			Map<Integer ,String> spade = new HashMap<>();
			Map<Integer ,String> heart = new HashMap<>();
			Map<Integer ,String> crub = new HashMap<>();
			Map<Integer ,String> dia = new HashMap<>();
			int numOfCards = Integer.valueOf(br.readLine());
			for(int i = 0; i < numOfCards; i++){
				String[] cardsSet = br.readLine().split(" ");
				String print = cardsSet[0];
				int rank = Integer.valueOf(cardsSet[1]);
				if(print.equals("S")){
					spade.put(rank, print);
				}
				if(print.equals("H")){
					heart.put(rank, print);
				}
				if(print.equals("C")){
					crub.put(rank, print);
				}
				if(print.equals("D")){
					dia.put(rank, print);
				}
			}

			for(int i = 1; i < 14 ; i++){
				if(!spade.containsKey(i)){
					System.out.println("S " + i);
				}
			}
			for(int i = 1; i < 14 ; i++){
				if(!heart.containsKey(i)){
					System.out.println("H " + i);
				}
			}
			for(int i = 1; i < 14 ; i++){
				if(!crub.containsKey(i)){
					System.out.println("C " + i);
				}
			}
			for(int i = 1; i < 14 ; i++){
				if(!dia.containsKey(i)){
					System.out.println("D " + i);
				}
			}

		} catch (IOException e) {
			Logger.getGlobal();
			throw new RuntimeException(e);
		} finally {
			try {
				br.close();
			} catch (IOException e) {
				Logger.getGlobal();
			}
		}
	}

}

Measured memory_bytes: 24252
#include<bits/stdc++.h>
#include<unordered_map>
using namespace std;
typedef long long ll;
typedef double db;
typedef long double ld;
const int MAXN = 2e5 + 5, MAXM = 2e3 + 5, BOUND = 2e5, MOD = 1e9 + 7, INF = 0x3f3f3f3f;
const ll INFL = 0x3f3f3f3f3f3f3f3f;
const double PI = acos(-1.0), eps = 1e-3;
#define mid l + ((r-l)>>1)
#define lson o<<1,l,m
#define rson o<<1|1,m+1,r
#define lc(x) ch[x][0]
#define pii pair<int,int>
#define rc(x) ch[x][1]
#define rep(i,a,b) for(int i=(a);i<=(b);++i)
int read() {
	int x = 0, f = 1; char ch = getchar();
	while (ch<'0' || ch>'9') { if (ch == '-')f = -1; ch = getchar(); }
	while (ch >= '0'&&ch <= '9') { x = x * 10 + ch - '0'; ch = getchar(); }
	return x * f;
}
int n, a[MAXN];
int main() {
	ios::sync_with_stdio(false); cin.tie(0);
	cin >> n;
	if (n & 1) {
		cout << (n - 1)*(n - 2) / 2 - n / 2 + n - 1 << '\n';
		rep(i, 1, n / 2) {
			rep(j, i + 1, n / 2) {
				cout << i << ' ' << j << '\n';
				cout << n - i << ' ' << n - j << '\n';
				cout << i << ' ' << n - j << '\n';
				cout << n - i << ' ' << j << '\n';
			}
		}
		rep(i, 1, n - 1)cout << i << ' ' << n << '\n';
	}
	else {
		cout << (n / 2 - 1) *n << '\n';
		rep(i, 1, n / 2) {
			rep(j, i + 1, n / 2) {
				cout << i << ' ' << j << '\n';
				cout << n - i + 1 << ' ' << n - j + 1 << '\n';
				cout << i << ' ' << n - j + 1 << '\n';
				cout << n - i + 1 << ' ' << j << '\n';
			}
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string> 
#include <cstring>
#include <map>

using namespace std;

/*
int run(int x, int arr[]) { 
   int titen = 0;
   for (int i = 1; i <= x; i++) {
      if (arr[i] == 1) {
         titen += i;
         if (titen => x) { break; }
      }
   }



   if (titen == x) {
      for (int j = x; j > 0; j--) {
         if (arr[j] == 1) {
            int ans = j;
            return ans;
         }
      }
   } else {
      for (int i = 1; i <= x; i++) {
         if (arr[i] == 0) {
            arr[i] = 1;
            break;
         } else {
            arr[i] = 0;
         }
      }
      return run(x, arr);
   }
}*/

int main() {
   int x, ans;
   cin >> x;
   int arr[(x + 1)];

   int titen = 0;
   for (int i = 1; i <= x; i++) {
      //arr[i] = 1;
      titen += i;
      if (titen >= x) {
         ans = i;
         break;
      }
   }


   cout << ans << endl;

}

Measured memory_bytes: 256
/*

                                  In the name of Allah, Most Gracious, Most Merciful


*/
#include<bits/stdc++.h>
#include<numeric>
using namespace std;

//*** constant value ***
const long double PI = 3.141592653589793238;
const double EPS = 1e-6 ;
//*** constant value ***

//****** define ********
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
#define dd double
#define vll vector<ll>
#define vs vector<string>
#define fn(i,n) for(ll i = 0; i<n; i++)
#define f(i,a,b) for(i=a;i<b;i++)
#define f1(i,a,b) for(i=b-1;i>=a;i--)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pls pair<ll,string>
#define vpl vector<pll>
#define pb push_back
#define mk make_pair
#define x first
#define y second
#define tt cout<<"Came here"<<endl;
//****** define ********
void solve()
{
  char c;
  cin>>c;
  if(c>='A' && c<='Z')
     cout<<"A"<<endl;
   else
    cout<<"a"<<endl;
}

int main()
{
    IOS;
    ll tc = 1;
    while(tc--)
    {
        solve();
    }


return 0;
}



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

int main() {

  std::vector<int> v;
  int w;
  int n;
  int a, b;

  std::cin >> w;
  for(int i = 1; i <= w; ++i) {
    v.push_back(i);
  }

  std::cin >> n;
  for(int i = 0; i < n; ++i) {
    scanf("%d,%d", &a, &b);
    std::swap(v[a-1], v[b-1]);
  }

  for(int i = 0; i < w; ++i) {
    std::cout << v[i] << std::endl;
  }
    
  return 0;
}

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

int main(){
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    int l=max(a,c),r=min(b,d);
    cout<<max(0,r-l)<<endl;
    return 0;
}

Measured memory_bytes: 256
n, a, b = map(int, input().split())
s = input()

count = 0
countB = 0
for i in range(n):
    if s[i] == 'a':
        if count < a+b:
            print('Yes')
            count += 1
        else:
            print('No')
    elif s[i] == 'b':
        if count < a+b and countB < b:
            print('Yes')
            count += 1
            countB += 1
        else:
            print('No')
    else:
        print('No')


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

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int x;
  cin >> x;
  auto prime = [](int x){
    if (x < 2)
      return 0;
    if (x == 2)
      return 1;
    if (x % 2 == 0)
      return 0;
    for (int i = 3; i * i <= x; i+=2)
      if (x % i == 0)
        return 0;
    return 1;
  };
  for (int i = x ; i <= 100005 ; i++)
    if (prime(i)){
      cout << i << '\n';
      return 0;
    }
  return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
  int winter;
  int japanese;
  int math;
  int j_perday;
  int m_perday;

  cin>>winter>>japanese>>math>>j_perday>>m_perday;

  for(int i=0;i<winter;i++){
    if(j_perday*i>=japanese && m_perday*i>=math){
      cout<<winter-i<<endl;
      break;
    }
  }

}



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

using namespace std;

using i64 = long long;

const i64 INF = 1e18 + 7;
const i64 MOD = 1e9 + 7;


signed main(){
    int n, m;
    cin >> n >> m;
    vector<int> a(n);
    priority_queue<int> que;
    for(auto& x : a){
        cin >> x;
        que.emplace(x);
    }
    for(int i = 0; i < m; ++i){
        int to = que.top();
        que.pop();
        que.emplace(to >> 1);
    }
    i64 sum = 0;
    while(!que.empty()){
        sum += que.top();
        que.pop();
    }
    cout << sum << endl;
}


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

int main() {
  int x1,x2,y1,y2;
  cin >> x1 >> y1 >> x2 >> y2;
  cout << x2-y2+y1 << " " << y2-x1+x2 << " " << x1-y2+y1 << " " << y1-x1+x2;
}




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

#define ll long long

int main(){

    ios::sync_with_stdio(false);
    cin.tie(0);
    
    ll n;
    cin >> n;

    ll sum=0;
    for (ll i = 1; i<=n; i++)
    {
        if(i%3==0 && i%5==0) continue;
        else if(i%3==0) continue;
        else if(i%5==0) continue;
        else sum+=i;
    }
    
    cout << sum << "\n";
    return 0;
}

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

using namespace std;

unsigned long long int attacks(unsigned long long int health)
{
    if(health==1) return 1;
    else return 1+2*attacks(ceil(health/2));
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    unsigned long long h;
    cin>>h;
    cout<<attacks(h);

}


Measured memory_bytes: 256
#include <cstdio>
#include <string>
#include <iostream>
#include <vector>
#include <list>
#include <cmath>
#include <iomanip>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <numeric>

typedef unsigned long long ULONG;
typedef long long LONG;
using namespace std;

#define PI 3.1415926535897932384626433
#define _DBG_

#define BIG 10000000000 //10

#define LAST 10000000 //10^7


vector<bool> int2bit(int a) {
	vector<bool> b(6);
	for (int i = 0; i < 6; i++) {
		if (a >> i & 1) {
			b[i] = true;
		}
		else {
			b[i] = false;
		}
	}
	return b;
}


int main(void) {

	int H, W, K;
	cin >> H >> W >> K;
	vector<vector<int>> c(H, vector<int>(W));

	for (int h = 0; h < H; h++) {
		string tmps;
		cin >> tmps;
		for (int w = 0; w < W; w++) {

			if (tmps[w] == '.') {
				c[h][w] = 0;
			}
			else {
				c[h][w] = 1;
			}
		}
	}

	int count = 0;
	int Wmax = pow(2, W);
	int Hmax = pow(2, H);
	for (int HP = 0; HP < Hmax; HP++) {
		vector<vector<int>> c2(H, vector<int>(W));
		for (int h = 0; h < H; h++) {
			for (int w = 0; w < W; w++) {
				c2[h][w] = c[h][w];
			}
		}

		vector<bool> HPb = int2bit(HP);
		for (int h = 0; h < H; h++) {
			if (HPb[h]) {
				for (int w = 0; w < W; w++) {
					c2[h][w] = 2;
				}
			}
		}
		
		int bcount = 0;
		for (int h = 0; h < H; h++) {
				for (int w = 0; w < W; w++) {
					if (c2[h][w] == 1) {
						bcount++;
					}
				}

		}
		if (bcount < K)continue;

		for (int WP = 0; WP < Wmax; WP++) {
			vector<vector<int>> c3(H, vector<int>(W));
			for (int h = 0; h < H; h++) {
				for (int w = 0; w < W; w++) {
					c3[h][w] = c2[h][w];
				}
			}
			
			vector<bool> WPb = int2bit(WP);
			for (int w = 0; w < W; w++) {
				if (WPb[w]) {
					for (int h = 0; h < H; h++) {
						c3[h][w] = 2;
					}
				}
			}

			int bcount = 0;
			for (int h = 0; h < H; h++) {
				for (int w = 0; w < W; w++) {
					if (c3[h][w] == 1) {
						bcount++;
					}
				}

			}
			if (bcount == K) {
				count++;
			}
			
		}
	}

	cout << count << endl;




	return 0;
}


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

using namespace std;

int dp[5001][5001];

int main(){
  int n;
  string line; cin >> n >> line;
  
  int mx = 0;
  for(int i = 1; i <= n; i++)
    for(int j = i + 1; j <= n; j++) {
      dp[i][j] = (line[i - 1] == line[j - 1] && dp[i - 1][j - 1] < j - i) ? 
        dp[i - 1][j - 1] + 1 :
     	0;
      mx = max(mx, dp[i][j]);
    }
  
  cout << mx;
  return 0;
}

Measured memory_bytes: 96896
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7;

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 main() {
  int A, B, C;
  cin >> A >> B >> C;
  cout << max({A, B, C}) - min({A, B, C}) << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,has,w,r;
string s;
int main()
{
	cin>>n>>s;
	for(int i=0;i<s.size();i++)
	{
		if(s[i]=='W') w++;
		else if(s[i]=='R') r++;
	}
	for(int i=0;i<s.size();i++)
	{
		if(r==0) break;
		if(s[i]=='W') has++,r--;
		else r--;
	}
	cout<<has<<endl;
}

Measured memory_bytes: 3760
#include<bits/stdc++.h>
#define FOR(i,a,b) for (register int i=(a);i<=(b);i++)
#define For(i,a,b) for (register int i=(a);i>=(b);i--)
#define mem(i,j) memset(i,j,sizeof(i))
#define GO(u) for (register int j=f[u];j!=-1;j=nxt[j])
#define fi first
#define se second
#define pii pair<int,int>
#define MP make_pair
using namespace std;
typedef long long ll;
const int N=1e5+5;
int n,a,b,lf[N],d[N],rt;
int tot=0,f[N],nxt[N<<1];
struct E
{
	int u,v;
}e[N<<1];
inline void add(int u,int v)
{
	tot++;
	nxt[tot]=f[u];
	f[u]=tot;
	e[tot]=(E){u,v};
	return;
}
inline int read()
{
	int x=0,f=1;
	char c=getchar();
	while (c<'0'||c>'9') {if (c=='-') f=-1;c=getchar();}
	while (c>='0'&&c<='9') {x=(x<<1)+(x<<3)+c-'0';c=getchar();}
	return f*x;
}
inline void write(int x)
{
	if (x<0) putchar('-'),x=-x;
	if (x>9) write(x/10);
	putchar(x%10+'0');
	return;
}
inline void yes() {printf("First\n");exit(0);}
inline void no() {printf("Second\n");exit(0);}
inline int dfs(int u,int fa)
{
	int cnt=0;
	GO(u)
	{
		int v=e[j].v;
		if (v==fa) continue;
		cnt+=dfs(v,u);
	}
	if (cnt>1) yes();
	return cnt^1;
}
int main()
{
	mem(f,-1);
	n=read();
	if (n==2) no();
	if (n==1) yes();
	FOR(i,1,n-1) a=read(),b=read(),add(a,b),add(b,a),d[a]++,d[b]++;
	FOR(i,1,n) lf[i]=(d[i]==1);
	FOR(i,1,n) if (!lf[i]) {rt=i;break;}
	if (dfs(rt,0)) yes();
	no();
	return 0;
}

Measured memory_bytes: 3712
n = int(input())
ans = 0
l = list(map(int, input().split()))
for i in range(0, n-2):
    for j in range(i+1, n-1):
        for z in range(j+1, n):
            ma = max(l[i], l[j], l[z])
            mi = min(l[i], l[j], l[z])
            mm = (l[i] + l[j] + l[z])-ma-mi
            if mm-mi < ma and ma < mi+mm and l[i] != l[j] and l[j] != l[z] and l[i] != l[z]:
                ans += 1
                # print(i, j, z)

print(ans)


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

int main()
{
	int N, L[10];
	cin >> N;
	for (int i = 0; i < N; i++)
		cin >> L[i];

	sort(L, L + N);
	int sum = 0;
	for (int i = 0; i < N - 1; i++)
		sum += L[i];
	if (sum > L[N - 1])
		cout << "Yes";
	else
		cout << "No";

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define PI 3.14159265359
#define NIL (-1)
#define LL long long
using namespace std;
const int64_t MOD = 1e9 + 7;
const int INF = INT_MAX;

vector<vector<int>> E;
vector<int> P, A;

void DFS(int cur, int p, int t) {
	for (int i = 0; i < E[cur].size(); i++) {
		int n = E[cur][i];
		if (n == p) continue;
		A[n] += t + P[n];
		DFS(n, cur, t + P[n]);
	}
	return;
}

int main() {
	int N, Q;
	cin >> N >> Q;

	E.assign(N, vector<int>());
	P.resize(N);
	A.assign(N, 0);

	for (int i = 0; i < N - 1; i++) {
		int a, b;
		cin >> a >> b;
		a--; b--;
		E[a].push_back(b);
		E[b].push_back(a);
	}

	for (int i = 0; i < Q; i++) {
		int p, x;
		cin >> p >> x;
		p--;
		P[p] += x;
	}

	A[0] += P[0];
	DFS(0, -1, P[0]);

	for (int i = 0; i < N; i++) {
		if (i) cout << ' ';
		cout << A[i];
	}
	cout << endl;
}

Measured memory_bytes: 28352
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> V;
#define rep(a,j,n) for(ll i=a;i<j;i=i+n )
typedef pair<ll,ll> P;
const ll mod = 1000000007;
const ll INF = 1000000009;
ll i;

int main(){
    ll A,B;
    cin>>A>>B;
    if(B%A)cout<<B-A;
    else cout<<A+B;
    cout<<endl;
}

Measured memory_bytes: 256
//2019.3.23 by ljz
#include<bits/stdc++.h>
using namespace std;
#define res register int
#define RG register
#define LL long long
#define inf 0x3f3f3f3f
#define eps 1e-15
inline int read(){
    res s=0,w=1,ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')w=-1;ch=getchar();}
    while(ch>='0'&&ch<='9')s=s*10+ch-'0',ch=getchar();
    return s*w;
}
inline void swap(res &x,res &y){
    x^=y^=x^=y;
}
const int kcz=1e9+7;
const int N=1e5+10;
namespace MAIN{
    int n;
    char str[N];
    LL ans=1;
    int buc[26];
    inline void MAIN(){
        n=read();
        scanf("%s",str+1);
        for(res i=1;i<=n;i++)buc[str[i]-'a']++;
        for(res i=0;i<26;i++)ans=ans*(buc[i]+1)%kcz;
        printf("%lld\n",ans-1);
    }
}
int main(){
    MAIN::MAIN();
    return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
const int ZDN=3+8;
char sz[ZDN]={};
int main(){
	long long i;
	long long ans=0;
	long long zd=0;
	for (i=1; i<=3; i++){
		cin>>sz[i];
	}
	for (i=1; i<=3; i++){
		if ('R'==sz[i]){
			ans++;
		} else{
			if (ans>zd){
				zd=ans;
			}
			ans=0;
		}
	}
	if (ans>zd){
		zd=ans;
	}
	cout<<zd<<"\n";
	return 0;
}

Measured memory_bytes: 3632
import { readFileSync } from 'fs'

function main(input: string[]) {
  let [N, K] = input[0].split(' ').map(v=>BigInt(v))
  let amari = N % K; 
  let ans = K - amari
  if (amari < ans) ans = amari
  console.log(ans.toString())
}

let lines: string[] = [];
const reader = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout
});

reader.on('line', function (line: string) {
  lines.push(line);
});
reader.on('close', function () {
  main(lines)
});


Measured memory_bytes: 30008
/* 
 * Project: AtCoder Beginners Contest 154 B - I miss you...
 * Author: toms74209200 <https://github.com/toms74209200>
 *
 * Created on 2020/06/30
 * Copyright (c) 2020 toms74209200
 * 
 * This software is released under the MIT License.
 * http://opensource.org/licenses/mit-license.php
 */
#include <cstdio>
using namespace std;

char s[100];

void solve() {

    char *ptr;
    ptr = &s[0];

    while (*ptr != '\0') {
        printf("x");
        ptr++;
    }
    printf("\n");
}

int main() {

    scanf("%s", s);

    solve();

}

Measured memory_bytes: 3196
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1000000007;
//cout << setprecision(20) << 

ll ans = 0;

void rec(vector<ll> parent, ll n, vector<tuple<ll, ll, ll, ll>> poll, ll m) {
    if (parent.size() == n) {
        // 最大値の判定
        ll tmp_ans = 0;
        for (auto i: poll) {
            ll a = get<0>(i);
            ll b = get<1>(i);
            ll c = get<2>(i);
            ll d = get<3>(i);
            if (parent[b] - parent[a] == c) tmp_ans += d;
        }
        ans = max(ans, tmp_ans);
        return;
    }
    // 生成
    for (ll i = (parent.size() > 0 ? parent[parent.size() - 1] : 1); i <= min(m, (ll)10); i++) {
        vector<ll> v = parent;
        v.push_back(i);
        rec(v, n, poll, m);
    }
}

int main() {
    ll N, M, Q; cin >> N >> M >> Q;
    vector<tuple<ll, ll, ll, ll>> poll(Q);
    for (ll i = 0; i < Q; ++i) {
        ll a, b, c, d; cin >> a >> b >> c >> d;
        poll[i] = make_tuple(a - 1, b - 1, c, d);
    }

    rec({}, N, poll, M);
    cout << ans << endl;
}

Measured memory_bytes: 3624
k = int(input())

a = list()
b = list()
a2 = list()
for i in range(10):
    a.append(i)
b.extend(a)
a2.extend(a)
for i in range(10):
    a = list()
    dig = 10 ** i
    for c in a2:
        tmpc = c//dig
        min = tmpc - 1
        if min < 0:
            min = 0
        max = tmpc + 1
        if max > 9:
            max = 9
        for j in range(min,max+1):
            a.append(j*10*dig+c)
    b.extend(a)
    a2 = a
    #a2.append(0)
b=list(set(b))
b.sort()
print(b[k])

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

using namespace std;

typedef long long int ll;
typedef vector <int> vi;
typedef pair <int, int> ii;
typedef vector <ii> vii;

ll solve(vi x, vi y, vi z)
{
    vii p;
    vi w;

    ll triples = 0;

    for (int i = 0; i < x.size(); i++)
    {
        int l1 = lower_bound(y.begin(), y.end(), x[i]) - y.begin();

        for (int j = l1; j < y.size(); j++)
        {
            int l2 = lower_bound(z.begin(), z.end(), y[j]) - z.begin();
            
            triples += (z.size() - l2);

            int d = y[j] - x[i];

            if (binary_search(z.begin(), z.end(), y[j]+d))
                triples--;
        }
    }

    return triples;
}

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

    int n;
    string s;
    vi r, g, b;

    cin >> n >> s;

    for (int i = 0; i < n; i++)
    {
        if (s[i] == 'R')
            r.push_back(i);
        if (s[i] == 'G')
            g.push_back(i);
        if (s[i] == 'B')
            b.push_back(i);
    }

    ll triples = 0;

    triples += solve(r, g, b);
    triples += solve(r, b, g);
    triples += solve(g, r, b);
    triples += solve(g, b, r);
    triples += solve(b, r, g);
    triples += solve(b, g, r);

    cout << triples << "\n";

    return 0;
}

Measured memory_bytes: 3632
#include <algorithm>
#include <climits>
#include <iostream>
#include <string>
#include <utility>
#include <vector>
#include <set>
#include <map>
#include <queue>


using namespace std;
using ll = long long int;

template <class T> ostream &operator<<(ostream &os, vector<T> &v) {
  for (auto i = v.begin(); i != v.end(); i++) {
    os << *i << " ";
  }
  return os;
}

vector<pair<long long, long long> > prime_factorize(long long n) {
  vector<pair<long long, long long> > res;
  for (long long p = 2; p * p <= n; ++p) {
    if (n % p != 0) continue;
    int num = 0;
    while (n % p == 0) { ++num; n /= p; }
    res.push_back(make_pair(p, num));
  }
  if (n != 1) res.push_back(make_pair(n, 1));
  return res;
}


bool prime(ll n) {
  bool f = true;
  if(n == 1)
    return false;
  for(ll i=2; i*i<=n; ++i) {
    if(n % i == 0) {
      f = false;
      break;
    }
  }
  return f;
}

void solve(long long Q, std::vector<long long> l, std::vector<long long> r){
  vector<ll> v;
  v.push_back(0);
  for(ll i=1; i<=100000; i++) {
    if(i % 2 != 0 and prime(i) and prime((i+1)/2)) {
      v.push_back(v[i-1]+1);
    } else {
      v.push_back(v[i-1]);
    }
  }
  for(int i=0; i<Q; i++){
    std::cout << v[r[i]]-v[l[i]-1] << std::endl;
  }

}

int main(){
  long long Q;
  scanf("%lld",&Q);
  std::vector<long long> l(Q);
  std::vector<long long> r(Q);
  for(int i = 0 ; i < Q ; i++){
    scanf("%lld",&l[i]);
    scanf("%lld",&r[i]);
  }
  solve(Q, std::move(l), std::move(r));
  return 0;
}



Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
using ll =long long;
#define all(v) v.begin(),v.end()
 
int main() {
  ll H,W;
  cin>>H>>W;
  vector<vector<char>> vec(H,vector<char>(W));
  for(ll i=0;i<H;i++) {
    for(ll j=0;j<W;j++) {
      cin>>vec[i][j];
    }
  }
  

set<ll> tate;
  set<ll> yoko;
  
  for(ll i=0;i<H;i++) {
    bool a=true;
for(ll j=0;j<W;j++) {
  if(vec[i][j]=='#') {
a=false;
  }
}
    
    if(a) {
yoko.insert(i);
    }
  }
  
  
  for(ll i=0;i<W;i++) {
    bool a=true;
for(ll j=0;j<H;j++) {
  if(vec[j][i]=='#') {
a=false;
  }
}
    
    if(a) {
tate.insert(i);
    }
  }
  
  
  for(ll i=0;i<H;i++) {
    if(yoko.count(i)) {
continue;
    }
for(ll j=0;j<W;j++) {
  if(tate.count(j)) {
continue;
  }
  cout<<vec[i][j];
}
    cout<<endl;
  }
}



  
 



Measured memory_bytes: 3604
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    ll a,b,c,d;
    cin>>a>>b>>c>>d;
    ll res =max(a*c,a*d);
    res =max(res,b*c);
    res =max(res,b*d);
    cout<<res<<endl;
    return 0;
}


Measured memory_bytes: 3612
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i<(n); ++i)
using namespace std;
using ll=long long;
int main(){
    int a,b,c;
    cin>>a>>b>>c;
    int sum=0;
    bool ok=false;
    rep(i,b){
        sum+=a;
        if(sum%b==c)ok=true;
    }
    cout<<(ok==true?"YES":"NO")<<endl;
}


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

int main(){
    int ai , bi , ci;
    int ans = 0;
    cin >> ai>> bi >> ci;
    vector<int> a(ai);
    vector<int> b(bi);
    for(int i = 0; i < ai ; i++){
        cin >> a.at(i);
    }
    for(int i = 0; i < bi ; i++){
        cin >> b.at(i);
    }
    int ac , bc , cc;
    cin >> ac >> bc >> cc;
    ans = a.at(ac-1) + b.at(bc-1) - cc;
    for(int i = 1; i < ci ; i++){
        cin >> ac >> bc >> cc;
        if( ans > a.at(ac-1) + b.at(bc-1) - cc){
            ans = a.at(ac-1) + b.at(bc-1) - cc;
        }
    }
    int a_ans = a.at(0);
    for(int i = 1; i < ai ; i++){
        if(a_ans > a.at(i)){
            a_ans = a.at(i);
        }
    }
    int b_ans = b.at(0);
    for(int i = 1; i < bi ; i++){
        if(b_ans > b.at(i)){
            b_ans = b.at(i);
        }
    }
    int ab = a_ans + b_ans;
    if(ans > ab){
        cout << ab << endl;
    }
    else{
        cout << ans << endl;
    }
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define inf 0x3f3f3f3f
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef double dd;
const int N = 1e5+5;
const dd eps = 1e-8;
const int mod = 1e9+7;
string ans;
ll n;
int main(){
  ios::sync_with_stdio(false);
  // freopen("input.txt","r",stdin);
  cin>>n;
  while(n){
    n--;
    ans += char(n%26+'a');
    n/=26;
  }
  reverse(ans.begin(),ans.end());
  cout<<ans<<endl;
  return 0;
}


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

int cmp(const void *a,const void *b)
{
    if(*(int*)a > *(int*)b)
      return 1;
    else if(*(int*)a < *(int*)b)
      return -1;
    else
      return 0;
}

int main()
{
  int N,i;
  int *a;

  scanf("%d", &N);
  a = calloc(N+2,sizeof(int));

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

  qsort(a, N, sizeof(int), cmp);

  for(i=0; i<N-1; i++){
    if(a[i] == a[i+1])
    {
      printf("NO"); return 0;
    }
  }
  printf("YES");
  return 0;
}


Measured memory_bytes: 3096
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <tuple>
# include <unordered_map>
# include <numeric>
# include <complex>
# include <bitset>
# include <random>
# include <chrono>
# include <cstdlib>
# include <tuple>
# include <array>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
constexpr int INF = 2147483647;
constexpr int HINF = INF / 2;
constexpr double DINF = 100000000000000000.0;
constexpr double HDINF = 50000000000000000.0;
constexpr long long LINF = 9223372036854775807;
constexpr long long HLINF = 4500000000000000000;
const double PI = acos(-1);
template <typename T_char>T_char TL(T_char cX) { return tolower(cX); };
template <typename T_char>T_char TU(T_char cX) { return toupper(cX); };
const int vy[] = { -1, -1, -1, 0, 1, 1, 1, 0 }, vx[] = { -1, 0, 1, 1, 1, 0, -1, -1 };
const int dx[4] = { 0,1,0,-1 }, dy[4] = { 1,0,-1,0 };
# define ALL(qpqpq)           (qpqpq).begin(),(qpqpq).end()
# define UNIQUE(wpwpw)        sort(ALL((wpwpw)));(wpwpw).erase(unique(ALL((wpwpw))),(wpwpw).end())
# define LOWER(epepe)         transform(ALL((epepe)),(epepe).begin(),TL<char>)
# define UPPER(rprpr)         transform(ALL((rprpr)),(rprpr).begin(),TU<char>)
# define FOR(i,tptpt,ypypy)   for(LL i=(tptpt);i<(ypypy);i++)
# define RFOR(i,tptpt,ypypy)  for(LL i=(tptpt);i>=(ypypy);i--)
# define REP(i,upupu)         FOR(i,0,upupu)
# define INIT                 std::ios::sync_with_stdio(false);std::cin.tie(0)

LL n, a, b, k;
LL ans = 0;

LL MOD = 998244353;
LL combi(LL N_, LL C_) {
	const int NUM_ = 400001;
	static LL fact[NUM_ + 1], factr[NUM_ + 1], inv[NUM_ + 1];
	if (fact[0] == 0) {
		inv[1] = fact[0] = factr[0] = 1;
		for (int i = 2; i <= NUM_; ++i) inv[i] = inv[MOD % i] * (MOD - MOD / i) % MOD;
		for (int i = 1; i <= NUM_; ++i) fact[i] = fact[i - 1] * i%MOD, factr[i] = factr[i - 1] * inv[i] % MOD;
	}
	if (C_<0 || C_>N_) return 0;
	return factr[C_] * fact[N_] % MOD*factr[N_ - C_] % MOD;
}
LL hcomb(int P_, int Q_) { return (P_ == 0 && Q_ == 0) ? 1 : combi(P_ + Q_ - 1, Q_); }

LL modpow(LL a, LL n = MOD - 2) {
	LL r = 1;
	while (n) r = r*((n % 2) ? a : 1) % MOD, a = a*a%MOD, n >>= 1;
	return r;
}

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

long long lcm(long long a, long long b) {
	long long g = gcd(a, b);
	return a / g * b;
}

int main() {
	cin >> n >> a >> b >> k;
	int acnt = 0;
	LL ans = 0;
	while ((k - acnt*a) % b != 0)acnt++;
	int bcnt = (k - acnt*a) / b;
	while (bcnt>=0&&acnt<=n) {
		if (bcnt <= n&&acnt <= n) {
			ans += combi(n, acnt)*combi(n, bcnt);
			ans %= MOD;
		}
		acnt += lcm(a, b) / a;
		bcnt -= lcm(a, b) / b;
	}
	cout << ans << endl;
	//system("pause");
}

Measured memory_bytes: 9600
#include<iostream>
#include<algorithm>
#include<string.h>
using namespace std;

int main(){
	double a,b,c,d,e,f;
	cin>>a>>b>>c>>d>>e>>f;
	double aa=e*a,bb=e*b;
	double t,sum,k;
	double maxx1=-1,maxx2=1;
	for(int i=0;i*a*100<=f;i++)
	for(int j=0;j*b*100<=f-i*a*100;j++)
	for(int x=0;x*c<=f-i*a*100-j*b*100;x++)
	for(int y=0;y*d<=f-i*a*100-j*b*100-x*c;y++){
		t=x*c+y*d;
		sum=i*a*100+j*b*100+t;
		k=aa*i+bb*j;
		if(k<t||sum>f) continue;		
		if(sum!=0&&t/sum>maxx2/maxx1){
			maxx1=sum;
			maxx2=t;
		}
	}
	cout<<int(maxx1)<<" "<<int(maxx2)<<endl;
	return 0;
}

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

int main(){
    long long n;
    cin >> n;
    long long a[n];
    for(int i=0;i<n;i++){
        cin >> a[i];
        a[i]-=i+1;
    }
    sort(a,a+n);
    long long mid=a[n/2];
    long long ans=0;
    for(int i=0;i<n;i++){
        ans+=abs(a[i]-mid);
    }
    cout << ans << endl;
}

Measured memory_bytes: 1792
//C++14 (Clang 3.8.0)

#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <string>
#include <climits>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const int maxn=200003;

int main(){
  int n;
  cin>>n;
  int res[maxn];
  int cent=(n-1)/2;
  for(int i=0;i<n;i++){
    int tmp;
    cin>>tmp;
    
    if(i%2==0) {
      res[cent-(i+1)/2]=tmp;
    }
    else {
      res[cent+(i+1)/2]=tmp;
    }
  }
  if(n%2==0){
    for(int i=n-1;i>=1;i--)cout<<res[i]<<" ";
    cout<<res[0]<<endl;
  }
  else{
    for(int i=0;i<n-1;i++)cout<<res[i]<<" ";
    cout<<res[n-1]<<endl;
  }
  return 0;
}


Measured memory_bytes: 2944