akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize("O3")
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
using P=pair<ll,ll>;
template<class T> using V=vector<T>; 
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
const ll inf=(1e18);
//const ll mod=998244353;
const ll mod=1000000007;
const vector<int> dy={-1,0,1,0},dx={0,-1,0,1};
ll GCD(ll a,ll b) {return b ? GCD(b,a%b):a;}
ll LCM(ll c,ll d){return c/GCD(c,d)*d;}
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(20);}} __init;
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; }
template<class T>void debag(const vector<T> &a){cerr<<"debag :";for(auto v:a)cerr<<v<<" ";cerr<<"\n";}
template<class T>void print(const vector<T> &a){for(auto v:a)cout<<v<<" ";cout<<"\n";}
int main(){
    int x;
    cin>>x;
    cout<<(x^1)<<"\n";
}


Measured memory_bytes: 3652
/* ALDS1_5_A: Exhaustive Search */

#include <iostream>
#include <string>

const int MAX_GOAL = 2000;

int N;
int *S;

void prepare(int makables[], int i, int sum) {
    if (sum <= MAX_GOAL) {
        makables[sum] = true;
        if (i == N) return;
        prepare(makables, i + 1, sum);
        prepare(makables, i + 1, sum + S[i]);
    }
}

int main() {
    std::ios::sync_with_stdio(false);

    std::cin >> N;
    S = new int[N];
    for (int i = 0; i < N; i++)
        std::cin >> S[i];

    int makables[MAX_GOAL + 1] = {};
    prepare(makables, 0, 0);

    int n_goals;
    std::cin >> n_goals;

    int goal;
    for (int i = 0; i < n_goals; i++) {
        std::cin >> goal;
        std::cout << ( makables[goal] ? "yes" : "no" ) << "\n";
    }
}

Measured memory_bytes: 1176
import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  h,w=LI()
  field=[list(S()) for _ in range(h)]
  u=[[0]*w for _ in range(h)]
  d=[[0]*w for _ in range(h)]
  l=[[0]*w for _ in range(h)]
  r=[[0]*w for _ in range(h)]

  for i in range(h):
    for j in range(w):
      if field[i][j]=='#':
        u[i][j]=0
        l[i][j]=0
      else:
        if i!=0:
          u[i][j]=u[i-1][j]+1
        else:
          u[i][j]=1
        if j!=0:
          l[i][j]=l[i][j-1]+1
        else:
          l[i][j]=1

  for i in range(h)[::-1]:
    for j in range(w)[::-1]:
      if field[i][j]=='#':
        d[i][j]=0
        r[i][j]=0
      else:
        if i!=h-1:
          d[i][j]=d[i+1][j]+1
        else:
          d[i][j]=1
        if j!=w-1:
          r[i][j]=r[i][j+1]+1
        else:
          r[i][j]=1

  ans=-inf
  for i in range(h):
    for j in range(w):
      ans=max(ans,u[i][j]+d[i][j]+l[i][j]+r[i][j]-3)

  return ans

# main()
print(main())


Measured memory_bytes: 309480
n,Y = map(int,input().split())

k = 0

for i in range(n+1):
    if k != 0:
        break
    for j in range(n+1):
        x = i
        y = j
        z = n - (i+j)
        
        if z < 0:
            break
        
        if 10000*x + 5000*y + 1000*z == Y:
            print(x,y,z)
            k += 1
            break
        

if k == 0:
    print(-1,-1,-1)


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

int main()
{
	int n,i,j;
  	string s ;
  	cin >> s ;
  	
  	if(s==("SAT")) cout << 1 << endl;
  	else if(s==("SUN")) cout << 7 << endl;
  	else if(s==("MON")) cout << 6 << endl;
  	else if(s==("TUE")) cout << 5 << endl;
  	else if(s==("WED")) cout << 4 << endl;
  	else if(s==("THU")) cout << 3 << endl;
  	else if(s==("FRI")) cout << 2 << endl;




	return 0;
}

Measured memory_bytes: 256
// Ver19.03
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#define INF (1 << 29) * 2
#define LLINF 4545454545454545454
#define MOD 1000000007
#define ll long long
#define ull unsigned long long
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
int upll(const void *a, const void *b) { return *(ll *)a < *(ll *)b ? -1 : *(ll *)a > *(ll *)b ? 1 : 0; }
int downll(const void *a, const void *b) { return *(ll *)a < *(ll *)b ? 1 : *(ll *)a > *(ll *)b ? -1 : 0; }
void sortup(ll *a, int n) { qsort(a, n, sizeof(ll), upll); }
void sortdown(ll *a, int n) { qsort(a, n, sizeof(ll), downll); }

int main()
{
  int n;
  double a, ans = 0;
  scanf("%d", &n);
  for (int i = 0; i < n; i++)
  {
    scanf("%lf", &a);
    ans += 1 / a;
  }
  printf("%lf\n", 1 / ans);
}

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

int main() {
  int H, W;
  cin >> H >> W;
  vector<vector<int>> A(H, vector<int>(W));
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      cin >> A.at(i).at(j);
    }
  }
  vector<tuple<int, int, int, int>> ans;
  for (int i = 0; i < H; i++) {
    for (int j = 0; j + 1 < W; j++) {
      if (A.at(i).at(j) % 2 == 1) {
        A.at(i).at(j)--;
        A.at(i).at(j + 1)++;
        ans.push_back(make_tuple(i + 1, j + 1, i + 1, j + 2));
      }
    }
  }
  for (int i = 0; i + 1 < H; i++) {
    if (A.at(i).at(W - 1) % 2 == 1) {
      A.at(i).at(W - 1)--;
      A.at(i + 1).at(W - 1)++;
      ans.push_back(make_tuple(i + 1, W, i + 2, W));
    }
  }
  cout << ans.size() << "\n";
  for (auto a : ans) {
    int b, c, d, e;
    tie(b, c, d, e) = a;
    cout << b << " " << c << " " << d << " " << e << "\n"; 
  }
}

Measured memory_bytes: 5232
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;

namespace AtCoder.Contest.B
{
	static class Program
	{
		public static void Solve(Scanner cin)
		{
			string s = cin.ReadString();
			int ans = s.Length;
			int i = 0;
			while (s[i] != 'A')
			{
				i++;
				ans--;
			}
			i = s.Length - 1;
			while (s[i] != 'Z')
			{
				i--;
				ans--;
			}
			Console.WriteLine(ans);
		}

		public static void Main(string[] args)
		{
			var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
			Console.SetOut(sw);
			var cin = new Scanner();
			Solve(cin);
			Console.Out.Flush();
		}
	}

	class Scanner
	{
		string[] s;
		int i;

		char[] cs = new char[] { ' ' };

		public Scanner()
		{
			s = new string[0];
			i = 0;
		}

		public string Read() => ReadString();

		public string ReadString()
		{
			if (i < s.Length) return s[i++];
			string st = Console.ReadLine();
			while (st == "") st = Console.ReadLine();
			s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
			if (s.Length == 0) return ReadString();
			i = 0;
			return s[i++];
		}

		public string[] ReadStringArray(int N)
		{
			string[] Array = new string[N];
			for (int i = 0; i < N; i++)
			{
				Array[i] = ReadString();
			}
			return Array;
		}

		public int ReadInt()
		{
			return int.Parse(ReadString());
		}

		public int[] ReadIntArray(int N, int add = 0)
		{
			int[] Array = new int[N];
			for (int i = 0; i < N; i++)
			{
				Array[i] = ReadInt() + add;
			}
			return Array;
		}

		public long ReadLong()
		{
			return long.Parse(ReadString());
		}

		public long[] ReadLongArray(int N, long add = 0)
		{
			long[] Array = new long[N];
			for (int i = 0; i < N; i++)
			{
				Array[i] = ReadLong() + add;
			}
			return Array;
		}

		public double ReadDouble()
		{
			return double.Parse(ReadString());
		}

		public double[] ReadDoubleArray(int N, double add = 0)
		{
			double[] Array = new double[N];
			for (int i = 0; i < N; i++)
			{
				Array[i] = ReadDouble() + add;
			}
			return Array;
		}

		public T1 ReadValue<T1>() => (T1)Convert.ChangeType(ReadString(), typeof(T1));
	}
}

Measured memory_bytes: 13216
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for(int i=0; i<(int)n; i++)
#define all(v) (v).begin(), (v).end()
using vi = vector<int>;
using vvi = vector<vi>;


int main(){
  int m,f,r;
  while(true){
    cin>>m>>f>>r;
    if(m+f+r==-3)break;
    if(m==-1 || f==-1){
      cout<<'F'<<endl;
      continue;
    }
    if(m+f>=80){
      cout<<'A'<<endl;
    }else if(m+f>=65){
      cout<<'B'<<endl;
    }else if(m+f>=50){
      cout<<'C'<<endl;
    }else if(m+f>=30){
      if(r>=50){
        cout<<'C'<<endl;
      }else{
        cout<<'D'<<endl;
      }
    }else{
      cout<<'F'<<endl;
    }
  }
}


Measured memory_bytes: 3068
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
from operator import mul
from functools import reduce
import pprint
sys.setrecursionlimit(10 ** 9)


INF = 10 ** 20
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 1000000007


class BIT:
    def __init__(self, size):
        self.bit = [0] * size
        self.size = size
        self.total = 0

    def add(self, i, w):
        x = i + 1
        self.total += w
        while x <= self.size:
            self.bit[x - 1] += w
            x += x & -x
        return

    def sum(self, i):
        res = 0
        x = i + 1
        while x:
            res += self.bit[x - 1]
            x -= x & -x
        return res

    def interval_sum(self, i, j): # i <= x < j の区間
        return self.sum(j - 1) - self.sum(i - 1) if i else self.sum(j - 1)

n = I()
s = list(S())
D = defaultdict(lambda:BIT(n))
for i in range(n):
    D[s[i]].add(i, 1)

q = I()
for j in range(q):
    qi, i, c = LS()
    if qi == '1':
        i = int(i) - 1
        D[s[i]].add(i, -1)
        D[c].add(i, 1)
        s[i] = c
    else:
        l, r = int(i) - 1, int(c)
        ret = 0
        for k in range(97, 123):
            if D[chr(k)].interval_sum(l, r):
                ret += 1
        print(ret)


Measured memory_bytes: 164948
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> pii;
typedef long long ll;

const int N = 100100;
const int oo = 1e9;


int n , m , a , b, f[2], nb, cnt, ct[N];
vector<int> g[N];
bool nt = true;

void dfs(int u , int c, int p) {
	if (ct[u] != -1 && ct[u] != c) {
		nt = false;
	}
	if (ct[u] != -1)return;
	f[c]++;
	ct[u] = c;
	for (int i = 0; i < g[u].size(); ++i) {
		dfs(g[u][i], c ^ 1, u);
	}
}
ll ans = 0;

int main() {
	scanf("%d%d", &n, &m);
	for (int i = 0 ; i < m ; ++i) {
		scanf("%d%d", &a, &b);
		g[a].push_back(b);
		g[b].push_back(a);
	}
	memset(ct, -1, sizeof ct);
	dfs(1, 0, -1);
	if(!nt){
		printf("%lld\n",(1ll*n*(n-1))/2-m);
		return 0;
	}
	for (int i = 1; i <= n; ++i) {
		ans += f[ct[i]^1] - g[i].size();
	}
	printf("%lld\n", ans/2);
	return 0;
}

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

// E - Crested Ibis vs Monster
// DP計画法を利用する
struct Atack {
    int power;
    int magic;
};
int main() {
    int H, N;
    cin >> H >> N;
    vector<Atack> atack(N);
    int A, B;
    for (int i = 0; i < N; i++) {
        cin >> atack[i].power;
        cin >> atack[i].magic;
    }

    long dp[H+1];
    for (int i = 1; i <= H; i++) {
        dp[i] = 1e13;
        for (int j = 0; j < N; j++) {
            if (atack[j].power >= i) {
                dp[i] = min((long)atack[j].magic, dp[i]);
            } else {
                dp[i] = min(dp[i - atack[j].power]  + atack[j].magic, dp[i]);
            }
        }
    }
    cout << dp[H];
}


Measured memory_bytes: 3632
#include <iostream>
#include <stack>
#include <math.h>
#include <vector>
#include <string>
#include <algorithm>
#include <map>

#define rep(i,n) for(int i=0; i < n; i++)
using ll =  long long;
using namespace std;

int main()
{
    int n, a , b, clear = 0, clear_b = 0;
    string s;
    cin >> n >> a >> b >> s;
    
    rep(i, n)
    {
        if (s[i] == 'a')
        {
            if (a + b > clear) 
            {
                cout << "Yes" << endl;
                clear++;
            }
            else
            {
                cout << "No" << endl;
            }
        }
        else if (s[i] == 'b')
        {
            if (a + b > clear && b > clear_b)
            {
                cout << "Yes" << endl;
                clear++;
                clear_b++;
            }
            else
            {
                cout << "No" << endl;
            }
        }
        else
        {
            cout << "No" << endl;
        }
    }
    return 0;
}

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

const ll N = 2e5+100;


ll a[N];
ll n;

int main()
{
	scanf("%lld",&n);
	ll ans = 0,maxx = 0;
	for(int i=1;i<=n;i++)
	{
		scanf("%lld",&a[i]);
		if(a[i]<maxx) ans+=(maxx - a[i]);
		maxx = max(maxx,a[i]);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 5224
#include <bits/stdc++.h>
using namespace std;
int main() {
    int n;
    cin >> n;
    string s;
    cin >> s;
    for (int i = 0, sz = s.size(); i < sz; ++i) {
        cout << (char)((s[i] + n) <= 'Z' ? (s[i] + n) : 'A' + ((s[i] + n - 1) % 'Z'));
    }
    return 0;
}

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

  int gcd(int x, int y) {
    if (x < y) {
      swap(x,y);
    }
    while (x%y != 0) {
      int c=x%y;
      x = y;
      y = c;
    }
    return y;
  }
int main() {  
  int N,X;
  cin >> N >> X;
  vector<int> vec(N);
  for (int i=0; i<N; i++) {
      vec.at(i);
  }
  for (int i=0; i<N; i++) {
    cin >> vec.at(i);
    vec.at(i) -=X;
    if (vec.at(i) < 0) {
        vec.at(i) *= -1;
    }
  }
  for (int i=0; i<N-1; i++) {
    vec.at(i+1) = gcd( vec.at(i) , vec.at(i+1) );
  }
  cout << vec.at(N-1) << endl;
}

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

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

int main(){
    int n;
    cin>>n;
    string s="yes";
    vector<int>a(500000);
    vector<int>b(500000);
    vector<int>c(500000);
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    for(int i=0;i<n;i++){
        b[i+1]++;
        b[i+a[i]/10+1]--;
    }
    for(int i=0;i<n-1;i++){
        b[i+1]+=b[i];
    }
    for(int i=0;i<n;i++){
        c[i+1]++;
        c[i+a[n-1-i]/10+1]--;
    }
    for(int i=0;i<n-1;i++){
        c[i+1]+=c[i];
    }
    b[0]++;
    c[0]++;
    for(int i=0;i<n;i++){
        if(b[i]==0||c[i]==0){
            s="no";
        }
    }
    cout<<s<<endl;

    return 0;
}


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

int main(){
    int N, ans=100000000;
    int Num[210];
    cin >> N;
    for (int i = 0; i < N; i++) cin >> Num[i];
    
    for (int i = 0; i < N; i++) {
        int cnt = 0;
        while (Num[i] % 2 == 0) {
            Num[i] /= 2;
            cnt++;
        }
        ans = min(ans, cnt);
    }
    cout << ans << endl;
}


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

int main() {
	for(;;) {
		int n;
		cin >> n;
		if(!n) break;
		string s;
		cin >> s;
		string ans;
		for(int i = 0; i < n; i++) {
			ostringstream os;
			queue<char> que;

			int len = s.length();
			for(int j = 0; j < len; j++) {
				que.push(s[j]);
			}

			while(!que.empty()) {
				char top = que.front();
				que.pop();
				int cnt = 1;
				while(!que.empty() && que.front() == top) {
					cnt++;
					que.pop();
				}
				os << cnt << top;
			}
			ans = s = os.str();
		}
		cout << ans << endl;
	}

	return 0;
}

Measured memory_bytes: 0
#include <stdio.h>

int main(void){
  int A,B,C;
  scanf("%d",&A);
  scanf("%d",&B);
  scanf("%d",&C);
  if(A==B&&A!=C)
    printf("Yes");
  else if(A==C&&A!=B)
    printf("Yes");
  else if(B==C&&B!=A)
    printf("Yes");
  else
    printf("No");
  return 0;
}
  

Measured memory_bytes: 128
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <queue>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define fst first
#define secnd second
#define PB push_back
#define MP make_pair
#define LL long long
#define uLL unsigned LL
#define LD long double

const double pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342;
const int mod=1000000007;

using namespace std;

int main(void){
  int N,M,maxn=0;
  string s;
  map<string, int> mp;
  // mp["kyo_pro"]=11;
  //vector< map<string, int> > map_v;

  cin>>N;
  FOR(i,0,N){
    cin>>s;
    mp[s]++;
  }
  cin>>M;
  FOR(i,0,M){
    cin>>s;
    mp[s]--;
  }

  for(auto x:mp){
    maxn=max(maxn,x.secnd);
  }
  cout<<maxn<<endl;
  return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#define rep(i,n) for (int i = 0; i < n; ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main() {
  int N, T; cin >> N >> T;
  vector<int> c(N), t(N);
  rep(i,N) cin >> c[i] >> t[i];
  int cost = 1010;
  rep(i,N) {
    if (t[i] <= T) cost = min(cost, c[i]);
  }
  if (cost == 1010) cout << "TLE" << endl;
  else cout << cost << endl;
  return 0;
}

Measured memory_bytes: 3144
#include <iostream>

using namespace std;

int main(){
    int A, B, sum = 0;
    cin >> A >> B;
    for(int i = 0; i < 2; i++){
        if(A > B){
            sum += A;
            A--;
        }else{
            sum += B;
            B--;
        }
    }
    cout << sum << endl;
}

Measured memory_bytes: 256
import sys
from pprint import pprint
from collections import deque

S = list(sys.stdin.readline().strip())
Q = int(sys.stdin.readline().strip())

q = deque(S)

n_rev = 0
for _ in range(Q):
    tmp = sys.stdin.readline().strip().split()
    if tmp[0] == "1":
        n_rev += 1
    else:
        f, c = tmp[1], tmp[2]
        if f == "1":
            if n_rev % 2 == 0:
                #S = c + S
                q.appendleft(c)
            else:
                #S = S + c
                q.append(c)
        else:
            if n_rev % 2 == 0:
                #S = S + c
                q.append(c)
            else:
                #S = c + S
                q.appendleft(c)

S = "".join(list(q))
if n_rev % 2 == 0:
    print(S)
else:
    print(S[::-1])

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

int main(void){
    int n;
    cin >> n;
    vector<int> d(n);

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

    long long int ans = 0;
    for(int i = 0;i < n-1;i++){
        for(int j = i + 1;j<n;j++){
            ans += d[i] * d[j];
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func main() {
	sc.Split(bufio.ScanWords)

	N := nextInt()
	var as []int
	for i := 0; i < N; i++ {
		as = append(as, nextInt())
	}

	c := 0
	for {
		for i := 0; i < N; i++ {
			if as[i] % 2 == 1 {
				fmt.Println(c)
				return
			}
			as[i] /= 2
		}
		c++
	}
}

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

typedef long long int ll; 
#define MOD 1000000007
#define ON 200000
#define rep(i,n) fp(i,0,n)  
#define fp(i,a,b) for(ll i=(a);i<(b);++i)
#define fn(i,a,b) for(ll i=(a);i>(b);i--)
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define FF first
#define SS second
typedef pair<ll, ll> pll; 
typedef vector<pll> vpll;
typedef vector<ll> vll;
#define rs(t) string t;cin>>t
#define ri(t) int t;cin>>t
#define rll(t) long long int t;cin>>t
#define MK make_pair
#define PB push_back
#define PO pop_back


int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  rll(n);
  vector <ll> v(n-1);
  rep(i,n-1){
  	cin >> v[i];
  }
  ll sum = 0;
  sum += v[0];
  sum += v[n-2];

  for(ll i=1;i<n-1;i++){
  	sum += min(v[i-1],v[i]); 
  }
  cout << sum << endl;

  return 0;
  
}

Measured memory_bytes: 256
s = input()
l = len(s)

if s[0] == 'A':
  if s[2:l - 1].count('C') == 1:
    idx = s[2:l - 1].index('C') + 2
    if s[1:idx].islower() and s[idx + 1:].islower():
      print('AC')
      quit()
print('WA')

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

#define rep(i, n) for(long long i=0;i<n;i++)
using ll = long long;
const ll INF = (1LL<<60);

int main(){

    ll k, x; cin >> k >> x;

    if((500*k) >= x){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii =  pair<int, int>;
using pll =  pair<long long, long long>;
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
constexpr long long INF = 1000000000LL;
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)


int main() {
  int n, ans; cin >> n;
  vector<ll> A(n);
  ll sum = 0;
  rep(i, n){
      ll num; cin >> A[i];
      sum += A[i];
      }
  ll sum2 = 0;
  ll num = n % 2 + 1;
  for(num; num < n; num += 2) sum2 += num * 2;
  if(sum != sum2) ans = 0;
  else{
      ans = 1;
      int k = n / 2;
      rep(i, k){
          ans = ans * 2 % MOD;
      }
  }
  cout << ans  % MOD << ln;
}

Measured memory_bytes: 1024
///#pragma GCC optimize("Ofast")
///#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma")
///#pragma GCC optimize("unroll-loops")

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

///#include<ext/pb_ds/assoc_container.hpp>
///#include<ext/pb_ds/tree_policy.hpp>
///using namespace __gnu_pbds;
///template<typename T> using orderset = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;
///(X).order_of_key(value) /// return lower_bound(value)
///(*X).find_by_order(index) /// return value (0 index)

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); /// mt19937_64 (long long)

typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef vector<int> vii;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vii> vvii;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<bool> vbb;

const int N = 1000001;
const int MOD = 1000000007;
const ll INF = LLONG_MAX;

#define fast() ios_base::sync_with_stdio(false),cin.tie(NULL)
#define next(x) next_permutation(all(x))
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rev(a) reverse(all(a))
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define yes cout<<"YES"<<nl
#define no cout<<"NO"<<nl
#define space ' '
#define nl '\n'
#define PI acos(-1)
#define Case(x) cout<<"Case "<<x<<": "
#define strtoint(a) atoi(a.c_str())
#define dbg(x) cerr<<#x<<" is "<<x<<'\n';
#define fix(x) cout<<fixed<<setprecision(x)
#define leastonepos(x) __builtin_ffs(x)
#define leadingoff(x) __builtin_clz(x)
#define trailingoff(x) __builtin_ctz(x)
#define numofone(x) __builtin_popcount(x)
#define time() cerr<<"Time elapsed : "<<clock()*1000.0/CLOCKS_PER_SEC<<"ms"<<'\n'

#define coutv(v) for(auto it:v)cout<<it<<space;cout<<nl;
#define cinv(v) for(auto &it:v)cin>>it;

///................Graph's Move.................
///const int dx[] = {+1,-1,+0,+0}; ///Rock's Move
///const int dy[] = {+0,+0,+1,-1}; ///Rock's Move
///const int dx[] = {+0,+0,+1,-1,-1,+1,-1,+1}; ///King's Move
///const int dy[] = {-1,+1,+0,+0,+1,+1,-1,-1}; ///king's Move
///const int dx[] = {-2,-2,-1,-1,+1,+1,+2,+2}; ///knight's Move
///const int dy[] = {-1,+1,-2,+2,-2,+2,-1,+1}; ///knight's Move
///*.....................-_-........................*///



int main()
{
    fast();
    int tc=1,cs=0;
    //cin>>tc;
    while(tc--)
    {
        ll n,W,i,j;
        cin>>n>>W;
        vll w(n),val(n),dp(W+1,-1);
        for(i=0; i<n; i++)
            cin>>w[i]>>val[i];
        dp[0]=0;
        for(i=0; i<n; i++)
            for(j=W; j>=0; j--)
                if(dp[0]!=-1&&j+w[i]<=W)
                    dp[j+w[i]]=max(dp[j+w[i]],dp[j]+val[i]);
        ll ans=*max_element(all(dp));
        cout<<ans<<nl;
    }
}


Measured memory_bytes: 3988
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#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 <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef long long ll;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;


int main() {
    int N;
    int a[100];
    cin >> N;
    REP(i, N) cin >> a[i];
    int ans = 0;

    for(int i = 0; i < N - 1; i++) {
        if(a[i] == a[i + 1]){
             ans++;
             i += 1;
         }
    }
    cout << ans << endl;



    return 0;
}


Measured memory_bytes: 384
def solve(a, b):
    a_int = int(a)
    b_int = 0
    c = 0
    for i in range(len(b)):
        if b[- i - 1] == ".":
            continue
        b_int += int(b[- i - 1]) * (10 ** c)
        c += 1
    # print(a_int, b_int, a_int * b_int // 100)
    return a_int * b_int // 100


def main():
    a, b = input().split()
    res = solve(a, b)
    print(res)


def test():
    assert solve("198", "1.10") == 217
    assert solve("1", "0.01") == 0
    assert solve("1000000000000000", "09.99") == 9990000000000000


if __name__ == "__main__":
    test()
    main()


Measured memory_bytes: 9204
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<bitset>
#include<cctype>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<functional>
#include<limits>
#include<list>
#include<map>
#include<set>
#include<stack>
#include<string>
#include<sstream>
#include<queue>
#include<vector>
using namespace std;

#define MOD 1000000007
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL

#define MAX 10000
#define WHITE 0
#define GRAY 1
#define BLACK 2

int n;
vector<pair<int, int> >adj[MAX];

typedef pair<int, int> pii;

void dijkstra() {
	priority_queue<pii, vector<pii>, greater<pii> >PQ; //d[id] d
	int color[MAX] = {},
		d[MAX];
	fill(d, d + MAX, INF);
	d[0] = 0;

	//?§????????????\
	PQ.push(make_pair(0, 0));
	color[0] = GRAY;

	//PQ???????´????????????°
	while (!PQ.empty()) {
		//d????????§???(-????°????)??¨??????????´????????????????
		pii f = PQ.top(); PQ.pop();

		int u = f.second;
		color[u] = BLACK;

		//????????§???????????°??????
		if (d[u] < f.first) { continue; }

		//??£??\????????????????????¨????????????
		for (int j = 0; j < adj[u].size(); j++) {
			int v = adj[u][j].first;
			if (color[v] == BLACK)continue;
			if (d[v] > d[u] + adj[u][j].second) {
				d[v] = d[u] + adj[u][j].second;
				PQ.push(make_pair(d[v], v));
				color[v] = GRAY;
			}
		}
	}
	for (int i = 0; i < n; i++) {
		cout << i << " " << (d[i] == INF ? -1 : d[i]) << endl;
	}
}

int main() {
	cin >> n;
	for (int i = 0; i < n; i++) {
		int u, k; scanf("%d%d", &u, &k);
		for (int j = 0; j < k; j++) {
			int v, c; scanf("%d%d", &v, &c);
			adj[u].push_back(make_pair(v, c));
		}
	}
	dijkstra();
	return 0;
}

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

#define MOD (1000000007)

using namespace std;

typedef long long int Int;

constexpr Int TEN(int n) { return n == 0 ? 1 : 10 * TEN(n-1); }

int main(void) {
    int a,b;
    cin>>a>>b;
    
    if(a <= 5) {
        cout<<0<<endl;
    } else if (a <= 12) {
        cout<<b/2<<endl;
    } else {
        cout<<b<<endl;
    }

    return 0;
}




Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author NikuKyabe
 */

#include <iostream>
#include <fstream>

#include "bits/stdc++.h"

using namespace std;
#define int long long
#define FOR(i, a, b) for(int i=(int)(a);i<(int)(b);++i)
#define REP(i, n)  FOR(i,0,(n))


class BPolygon {
public:
    void solve(std::istream &in, std::ostream &out) {
      int n;
      in >> n;
      vector<int> l(n);
      REP(i, n) in >> l[i];

      sort(l.begin(), l.end(), greater<int>());

      int sum = 0;
      FOR(i, 1, n) {
        sum += l[i];
      }

      out << (l[0] < sum ? "Yes" : "No") << endl;
    }
};


signed main() {
  ios::sync_with_stdio(false);
  cout.tie(0);
  cout << fixed;
  BPolygon solver;
  std::istream &in(std::cin);
  std::ostream &out(std::cout);
  solver.solve(in, out);
  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
using namespace std;
int N, Q, Sum[100005];
char S[100005];

int main()
{
    scanf("%d %d %s", &N, &Q, S);
    for(int i = 0; i < N; i++)
    {
        if(S[i] == 'A' && S[i + 1] == 'C')
        {
            Sum[i + 1] = 1;
            i++;
        }
    }
    for(int i = 1; i <= N; i++)
    {
        Sum[i] += Sum[i - 1];
    }
    for(int i = 0; i < Q; i++)
    {
        int l, r;
        scanf("%d %d", &l, &r);
        printf("%d\n", Sum[r - 1] - Sum[l - 1]);
    }
}

Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
  ll N,K,Q ; cin >> N >> K >> Q;
  
  vector<ll> X(N);
  for(ll i = 0; i < Q; i++){ ll a; cin >> a; a--;  X[a]++; }
  ll ans = 0;
  for(ll i = 0; i < N; i++){ 
    ll res = K-Q+X[i];
    if( res > 0){ cout << "Yes" << endl;} else{ cout << "No" << endl;}}
  
  return 0;}

Measured memory_bytes: 1408
#include<stdio.h>

int main(){
	int N;
	int T , A;
	scanf("%d %d %d",&N ,&T ,&A);
	int H[N];
	for(int i=0;i<N;i++){
		scanf("%d",&H[i]);
	}
	int x[N];
	for(int j=0;j<N;j++){
		x[j] = 1000*A - (1000*T - H[j]*6);
		if(x[j]<0){
			x[j] *= -1;
		}
	}
	int min = 0;
	for(int k=0;k<N;k++){
		if(x[k] < x[min]){
			min = k;
		}
	}
	printf("%d",min+1);
	return 0;
}	

Measured memory_bytes: 128
n = gets.chomp.to_i
a = gets.chomp.to_i
b = gets.chomp.to_i
c = gets.chomp.to_i
d = gets.chomp.to_i
e = gets.chomp.to_i
min = 10**16
[a,b,c,d,e].each do |t|
  if min > t
    min = t
  end
end
if (n % min) == 0
  puts n / min + 4
else
  puts n / min + 5
end


Measured memory_bytes: 1788
s=raw_input()
cntn=0
cnts=0
cnte=0
cntw=0
for i in s:
    if i=="S":
        cnts+=1
    elif i=="E":
        cnte+=1
    elif i=="N":
        cntn+=1
    else:
        cntw+=1
if cntn>0 and cnts>0 and cntw>0 and cnte>0:
    print("Yes")
elif cntn>0 and cnts>0 :
    if cntw==0 and cnte==0:
        print('Yes')
    else:
        print('No')
elif cntn==0 and cnts==0:
    if cntw>0 and cnte>0:
        print('Yes')
    else:
        print('No')
else:
    print('No')

Measured memory_bytes: 2692
#include<iostream>
#include<algorithm>
using namespace std;
const int INF= 1000000001;
int C;
void Merge(int A[], int left, int mid, int right){
    int n1=mid-left;
    int n2=right-mid;

    int* L=new int[n1+1];
    int* R=new int[n2+1];

    for(int i=0;i<n1;i++){
        L[i]=A[left+i];
    }
    for(int i=0;i<n2;i++){
        R[i]=A[mid+i];
    }
    L[n1]=INF;
    R[n2]=INF;

    for(int i=0,j=0,k=left;k<right;k++){
        if(C++,L[i]<=R[j]){
            A[k]=L[i];
            i++;
        }else{
            A[k]=R[j];
            j++;
        }
    }
    delete[] L;
    delete[] R;
}
void mergeSort(int A[], int left, int right){
    if(left+1>=right)
        return;
    int mid=(left+right)/2;
    mergeSort(A,left,mid);
    mergeSort(A,mid,right);
    Merge(A,left,mid,right);
}
int main(){
    int n;
    cin>>n;
    int A[500000];
    for(int i=0;i<n;i++)cin>>A[i];
    C=0;
    mergeSort(A,0,n);
    for(int i=0;i<n;i++){
        if(i==n-1){
            cout<<A[i]<<endl;
        }else{
            cout<<A[i]<<' ';
        }
    }
    cout<<C<<endl;
    return 0;
}


Measured memory_bytes: 6800
#include <bits/stdc++.h>
#define debug(x) cout << #x << " -> " << x << endl
#define booga cout << "booga" << endl
#define ll long long int
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
using namespace std;


void testcase(){
	int x,n,p[105];
	cin >> x >> n;
	for(int i{0};i < n;i++){
		cin >> p[i];
	}
	sort(p,p+n);
	for(int i{0};true;i++){
		if(!binary_search(p,p+n,x-i)){
			cout << x-i << "\n";
			return;
		}
		if(!binary_search(p,p+n,x+i)){
			cout << x+i << "\n";
			return;
		}
	}
}
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int t;
	t = 1;
	while(t--){
		testcase();
	}
	return 0;
}


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

int main()
{
  int n, m;

  int sum = 0;

  cin >> n >> m;
  rep(i, n)
  {
    sum += i;
  }
  rep(i, m)
  {
    sum += i;
  }

  cout << sum;
}


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

#define REP(i,n) for(ll i=0; i<(ll)(n); i++)
#define FOR(i,n,m) for (ll i=n; i<(ll)(m); i++)
#define pb push_back
#define INF 1000000007LL
#define all(a) (a).begin(),(a).end()
#define chmin(a,b) a=min(a,b)
#define chmax(a,b) a=max(a,b)

typedef long long ll;
typedef pair<int,int> p;

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


int main(){
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    string S;
    cin >> S;
    
    int cnt = 0;
    REP(i, S.length()) {
        if (S[i] == '(') {
            cnt++;
        } else {
            cnt--;
        }
        if (cnt < 0) {
            S = "(" + S;
            i++;
            cnt = 0;
        }
    }
    REP(i, cnt) S += ")";
    cout << S << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int n;
vector<int> a(1000);
int main () {
  while(cin >> n, n) {
    int min = INT_MAX;
    for(int i = 0; i < n; i++) cin >> a[i];
    
    for(int i = 0; i < n; i++) {
      for(int j  = 0; j < n; j++) {
	if(i != j && min > abs(a[i] - a[j])) {
	  min = abs(a[i] - a[j]);
	}
      }
    }
    cout << min << endl;
  }
}

Measured memory_bytes: 3084
#include <bits/stdc++.h>
#define all(v) v.begin(), v.end()
typedef long long int lint;
using namespace std;

//累積和
// vectorっぽく使う
template <typename T>
struct cumulative_sum {
    // data[i]:元の数列
    vector<T> data;
    // sum[i]:[0,i)の和
    vector<long long int> sum;
    //要素数を指定して初期化
    cumulative_sum(const int n) {
        data.assign(n, 0);
    }
    T& operator[](const int k) {
        return data[k];
    }
    // dataに基づいてsumを構築
    void build() {
        sum.assign(data.size() + 1, 0);
        for (int i = 0; i < (int)data.size(); i++) {
            sum[i + 1] = sum[i] + data[i];
        }
    }
    //[a,b)の和を求める
    long long int query(const int a, const int b) {
        return sum[b] - sum[a];
    }
};

int main() {
    int n, x;
    cin >> n >> x;
    cumulative_sum<int> l(n);
    for (int i = 0; i < n; i++) {
        cin >> l[i];
    }
    l.build();
    int ans = 0;
    for (int i = 0; i < n + 1; i++) {
        if (l.sum[i] <= x) {
            ans++;
        } else {
            break;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define inf 10e17
#define rep(i,n) for(long long i=0; i<n; i++)
#define repr(i,n,m) for(long long i=m; i<n; i++)
#define mod 1000000007
#define sorti(x) sort(x.begin(), x.end())
#define sortd(x) sort(x.begin(), x.end(), std::greater<long long>())
#define debug(x) std::cerr << (x) << std::endl;
#define roll(x) for (auto&& itr : x) { cerr << (itr) << " "; }

template <class T> inline void chmax(T &ans, T t) { if (t > ans) ans = t;}
template <class T> inline void chmin(T &ans, T t) { if (t < ans) ans = t;}

void dfs(string s, int mx, const int n) {
  if (s.size() == n) {
    cout << s << endl;
  } else {
    repr(i, mx, 0) {
      if (i == mx-1) {
        dfs(s + (char)(i + 'a'), mx+1, n);
      } else {
        dfs(s + (char)(i + 'a'), mx, n);
      }
    }
  }
}

int main() {
  int n;
  cin >> n;
  dfs("", 1, n);
}

Measured memory_bytes: 1536
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> pi;
#define f first
#define s second
#define FAST ios_base::sync_with_stdio(0); cin.tie(0);
#define all(x) x.begin(),x.end()
const int maxn = 200010;

int K,n;
int A[maxn];
int32_t main() {
	cin >> K >> n;
	for (int i =0;i<n;i++) cin >> A[i];
	int ans = (K - A[n-1]) + A[0];
	for (int i =1;i<n;i++) {
		ans = max(ans,A[i] - A[i-1]);
	}
	
	cout << K - ans;
}









Measured memory_bytes: 1792
def main():
    X, N = map(int, input().split())
    P = set(list(map(int, input().split())))

    d, v = X, 0
    for i in range(102):
        if i in P:
            continue
        if abs(i - X) < d:
            d = abs(i - X)
            v = i
    return v


print(main())


Measured memory_bytes: 9176
# -*- coding: utf-8 -*-

#----------
O = input().strip()
E = input().strip()
#----------

new_S=""
for i in range(1,len(O)+len(E)+1):
    if (i % 2) == 1:
        new_S += O[i // 2]
    else:
        new_S += E[i // 2 - 1]

print(new_S)


Measured memory_bytes: 3064
H, W = map(int,input().split())
a = []
for _ in range(H):
    l = list(map(int,input().split()))
    a.append(l)
cnt = 0
ope = []
for i in range(H):
    for j in range(W):
        if a[i][j] % 2 != 0:
            cnt += 1
            ni,nj = i+1,j
            if ni < H and nj < W and a[ni][nj] % 2 != 0:
                a[i][j] -= 1
                a[ni][nj] += 1
                ope.append((i,j,ni,nj))
                continue
            ni,nj = i,j+1
            if ni < H and nj < W and a[ni][nj] % 2 != 0:
                a[i][j] -= 1
                a[ni][nj] += 1
                ope.append((i,j,ni,nj))
                continue
            ni,nj = i+1,j
            if ni < H and nj < W:
                a[i][j] -= 1
                a[ni][nj] += 1
                ope.append((i,j,ni,nj))
                continue
            ni,nj = i,j+1
            if ni < H and nj < W:
                a[i][j] -= 1
                a[ni][nj] += 1
                ope.append((i,j,ni,nj))
                continue
            cnt -= 1
print(cnt)
for x in ope:
    print(*map(lambda y:y+1, x))

Measured memory_bytes: 26452
#include<stdio.h>
int main()
{
    int A,B,C;
    while((scanf("%d%d%d",&A,&B,&C)) != EOF){
        if(A==B && A!=C){
            printf("%d\n",C);
        }
        else if(A==C && A!=B){
            printf("%d\n",B);
        }
        else{
            printf("%d\n",A);
        }
    }
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef int ll;
typedef long double ld;
const ll N = 200005;
char en = '\n';
ll inf = 1e16;
ll mod = 1e9 + 7;
ll power(ll x, ll n, ll mod) {
  ll res = 1 % mod;
  x %= mod;
  while (n) {
    if (n & 1)
      res = (res * x) % mod;
    x = (x * x) % mod;
    n >>= 1;
  }
  return res;
}

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

  ll a, b, c;
  cin >> a >> b >> c;

  if ((c - a - b) <= 0) {
    cout << "No" << en;
    return 0;
  }

  cout << (((4 * a * b) < ((c - a - b) * (c - a - b))) ? "Yes" : "No") << en;

  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair< ll, ll > Pi;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep2(i,n) for(int i=1;i<=(n);i++)
#define rep3(i,i0,n) for(int i=i0;i<(n);i++)
#define pb push_back
#define mod 1000000007
const ll INF = 1LL << 60;
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; }
ll gcd(ll a, ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}
#define all(x) x.begin(), x.end()
#define mp make_pair
bool compare(Pi a, Pi b) {
    if(a.first != b.first){
        return a.first < b.first;
        
    }else{
        return a.second < b.second;
    }
}


bool In_map(ll y,ll x,ll h,ll w){
    if(y<0 || x<0 || y>=h || x>=w){
        return 0;
    }else{
        return 1;
    }
}
const vector<ll> dx{1,0,-1,0};
const vector<ll> dy{0,1,0,-1};


int main() {
    ll K,N;
    cin >>K>>N;
    vector<ll> A(N);

    rep(i,N){
        cin>>A[i];
        
    }
    ll mx=0;
    rep(i,N-1){
        chmax(mx,A[i+1]-A[i]);
    }
    chmax(mx,A[0]+K-A[N-1]);
    cout <<K-mx  << endl;


    return 0;
    

}

Measured memory_bytes: 4844
#include<iostream>
#include<cstdio>

int paper[10][10]={};

void drop(int x,int y){
  if(x>=0&&y>=0&&x<=9&&y<=9){
    ++paper[x][y];
  }
}

void ink(int x,int y, int s){
  switch(s){
    case 3: drop(x+2,y);
            drop(x-2,y);
            drop(x,y+2);
            drop(x,y-2);
    case 2: drop(x+1,y+1);
            drop(x-1,y+1);
            drop(x-1,y-1);
            drop(x+1,y-1);
    case 1: drop(x,y);
            drop(x+1,y);
            drop(x-1,y);
            drop(x,y+1);
            drop(x,y-1);
  }

}

int main(){
  int x,y,s;

  //drop(9,9);

  /*for(int i=0;i<10;i++){
    for(int j=0;j<10;j++){
      std::cout << paper[i][j] << std::endl;
    }
  }*/

  while(std::scanf(" %d,%d,%d",&x,&y,&s)+1){
    //std::cout << x << y << s;
    ink(x,y,s);
  }

  int spase=0,max=0;

  for(int i=0;i<10;i++){
    for(int j=0;j<10;j++){
      if(paper[i][j]==0){
        ++spase;
      }
      if(paper[i][j]>max){
        max = paper[i][j];
      }
    }
  }

  std::cout << spase << std::endl;
  std::cout << max << std::endl;


}

Measured memory_bytes: 3228
// clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define forever while (true)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
template<typename A> using V = std::vector<A>;
template<typename A> using F = std::function<A>;
template<typename A, typename B> using P = std::pair<A, B>;
using pii = P<int, int>;
using vi = V<int>;
using vd = V<double>;
using vs = V<std::string>;
using vpii = V<pii>;
using vvi = V<vi>;
using vvpii = V<vpii>;
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = acos(-1);
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
template<typename T> std::istream &operator>>(std::istream &is, std::vector<T> &v) { for (T &x : v) is >> x; return is; }
using namespace std;
// clang-format on

template<class Monoid, class InputIterator> typename Monoid::value_type fold(InputIterator first, InputIterator last) {
  Monoid m = Monoid();
  using T = typename Monoid::value_type;
  T acc = m.id();
  std::for_each(first, last, [&](T &x) { acc = m(acc, x); });
  return acc;
}

template<typename T, T upperInf = std::numeric_limits<T>::max()> struct minMonoid {
  using value_type = T;
  constexpr T id() const { return upperInf; }
  T operator()(const T &a, const T &b) const { return std::min(a, b); }
};

template<typename T, T lowerInf = std::numeric_limits<T>::min()> struct maxMonoid {
  using value_type = T;
  constexpr T id() const { return lowerInf; }
  T operator()(const T &a, const T &b) const { return std::max(a, b); }
};

template<typename T> struct sumMonoid {
  using value_type = T;
  constexpr T id() const { return 0; }
  T operator()(const T &a, const T &b) const { return a + b; }
};

main {
  int n;
  cin >> n;
  vi a(n);
  cin >> a;
  cout << fold<minMonoid<int>>(all(a)) << ' ' << fold<maxMonoid<int>>(all(a)) << ' ' << fold<sumMonoid<int>>(all(a)) << endl;
}

Measured memory_bytes: 3176
#include<bits/stdc++.h>
using namespace std;
int main(){
	int W,H,x,y,r;
	cin>>W>>H>>x>>y>>r;
	if (0<=x-r&&0<=y-r&&W>=x+r&&H>=y+r){
		cout<<"Yes"<<endl;
	}
	else {
		cout<<"No"<<endl;
	}
	
}



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

int main() {
    int n; scanf("%d", &n);
    vector<vector<int>> g(n);
    for (int i = 0; i < n - 1; ++i) {
        int u, v; scanf("%d%d", &u, &v);
        u--, v--;
        g[u].push_back(v);
        g[v].push_back(u);
    }

    vector<int> dp(n);
    function<int(int, int)> Dfs = [&](int x, int p) {
        int v = 0;
        for (int u : g[x]) {
            if (u == p) continue;
            int r = Dfs(u, x);
            dp[x] += dp[u];
            if (r && !v) {
                dp[x]++;
                v = 1;
            }
        }
        return 1 - v;
    };

    Dfs(0, -1);
    if (dp[0] * 2 == n) puts("Second");
    else puts("First");
}


Measured memory_bytes: 6272