akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <iomanip>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>

using namespace std;

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

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

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

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

	ll n, m;cin >> n >> m;
	vector<pair<P, ll> > tate;
	vector<pair<P, ll> > yoko;
	vector<ll> Xs({0});
	vector<ll> Ys({0});
	REP(i, n){
		ll a, b, c;cin >> a >> b >> c;
		Ys.PB(a);
		Ys.PB(b);
		Xs.PB(c);
		tate.EB(MP(a, b), c);
	}
	REP(i, m){
		ll a, b, c;cin >> a >> b >> c;
		Xs.PB(b);
		Xs.PB(c);
		Ys.PB(a);
		yoko.EB(MP(b, c), a);
	}

	sort(ALL(Xs));
	sort(ALL(Ys));
	Xs.erase(unique(ALL(Xs)), Xs.end());
	Ys.erase(unique(ALL(Ys)), Ys.end());

	vector<vector<char> > mp(2 * Ys.size() + 1,
												vector<char>(2 * Xs.size() + 1, '.'));

	REP(i, n){
		ll y_from = 2 * (lower_bound(ALL(Ys), tate[i].FI.FI) - Ys.begin()) + 1;
		ll y_to = 2 * (lower_bound(ALL(Ys), tate[i].FI.SE) - Ys.begin()) + 1;
		ll x = 2 * (lower_bound(ALL(Xs), tate[i].SE) - Xs.begin()) + 1;
		for(ll y = y_from;y <= y_to;y++)mp[y][x] ='#';
	}

	REP(i, m){
		ll x_from = 2 * (lower_bound(ALL(Xs), yoko[i].FI.FI) - Xs.begin()) + 1;
		ll x_to = 2 * (lower_bound(ALL(Xs), yoko[i].FI.SE) - Xs.begin()) + 1;
		ll y = 2 * (lower_bound(ALL(Ys), yoko[i].SE) - Ys.begin()) + 1;
		for(ll x = x_from;x <= x_to;x++)mp[y][x] = '#';
	}

	ll h = mp.size();
	ll w = mp[0].size();
	//SHOW2d(mp, h, w);

	queue<P> q;
	ll ys = 2 * (lower_bound(ALL(Ys), 0) - Ys.begin()) + 1;
	ll xs = 2 * (lower_bound(ALL(Xs), 0) - Xs.begin()) + 1;
	q.push(MP(ys, xs));
	mp[ys][xs] = 'o';
	while(!q.empty()){
		ll y = q.front().FI;
		ll x = q.front().SE;
		q.pop();

		REP(i, 4){
			ll yy = y + dy[i];
			ll xx = x + dx[i];
			if(yy < 0 || xx < 0 || yy >= h || xx >= w)continue;
			if(mp[yy][xx] != '.')continue;
			mp[yy][xx] = 'o';
			q.push(MP(yy, xx));
		}
	}

	//SHOW2d(mp, h, w);

	if(mp[0][0] == 'o'){
		cout << "INF" << endl;
		return 0;
	}

	ll ans = 0;
	REP(i, Ys.size() - 1)REP(j, Xs.size() - 1){
		ll y = 2 * (i + 1);
		ll x = 2 * (j + 1);
		if(mp[y][x] != 'o')continue;
		ll H = Ys[i + 1] - Ys[i];
		ll W = Xs[j + 1] - Xs[j];
		ans += H * W;
	}

	cout << ans << endl;

	return 0;
}


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

using namespace std;
using llong = long long;
using ldbl = long double;
using P = pair<llong, llong>;

#define ALL(x) x.begin(), x.end()

const llong inf = 1100100100100100ll;
const llong mod = 1e9+7;

int main() {
	string s;
	cin >> s;

	bool check = false;
	for (int i = 0; i < 3; ++i)
		if (s[i] == s[i+1])
			check = true;

	if (check)
		cout << "Bad" << endl;
	else
		cout << "Good" << endl;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#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 all(a) (a).begin(),(a).end()
#define print(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<_<<", "; cerr<<"]"<<endl; }
#define printpair(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<"{"<<_.first<<","<<_.second<<"}"<<", "; cerr<<"]"<<endl; }
#define dump(x) cerr<<#x<<": "<<x<<endl;
#define bit(k) (1LL<<(k))
typedef long long ll;
typedef pair<int, int> i_i;
typedef pair<ll, ll> l_l;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;
template< typename T1, typename T2 >
ostream &operator<<(ostream &os, const pair< T1, T2 >& p) {
  os << "{" <<p.first << ", " << p.second << "}";
  return os;
}
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

const int INF = (ll)1e9;
const ll INFLL = (ll)1e18+1;
const ll MOD = (ll)1e9+7;
const double PI = acos(-1.0);
/*
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const string dir = "DRUL";
*/

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    int N;
    cin >> N;
    vec<l_l> v;
    rep(i,N){
        ll X, L;
        cin >> X >> L;
        v.emplace_back(X+L,X-L);
    }
    //終端ソート
    sort(all(v));
    //print(v);
    int ans = 0;
    ll r = -INFLL;
    for(int i = 0; i < N; i++){
        ll nr = v[i].first;
        ll nl = v[i].second;
        if(r <= nl){
            r = nr;
            ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 2420
#include <stdio.h>

int main()
{
	int A1, A2, A3, A4, check;
	
	scanf("%d%d%d", &A1, &A2, &A3);
	A4 = A1+A2+A3;
	
	check=A4;
	if(check>=22)
	{
		printf("bust");
	}
	else
	{
		printf("win");
	}
	return 0;
}

Measured memory_bytes: 1720
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner cin=new Scanner(System.in);
		
		int n=cin.nextInt(),T[]=new int[n];
		
		for(int i=0;i<n;i++)T[i]=Integer.parseInt(cin.next());
		
		int q=cin.nextInt(),res=0;
		for(int i=0;i<q;i++) {
			int t=Integer.parseInt(cin.next()),s=0,m=(T.length-1)/2,g=T.length;
			while(g-s>=1) {
				if(T[m]==t) {
					res++;
					break;
				}
				if(T[m]>t) {
					g=m;
					m=(s+g)/2;
				}
				else if(T[m]<t) {
					s=m+1;
					m=(s+g)/2;
				}
			}
		}
		System.out.println(res);
	}

}



Measured memory_bytes: 70248
N = int(input())
A1 = list(map(int, input().split()))
A2 = list(map(int, input().split()))

# 下に降りるタイミングでパターン分け
patterns = [0] * N

upper = A1[0]
lower = sum(A2)

patterns[0] = upper + lower

for i in range(1, N):
  upper += A1[i]
  lower -= A2[i-1]
  patterns[i] = upper + lower
  
print(max(patterns))

Measured memory_bytes: 3188
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std;
double ans;
int N,A;
int main(){
	scanf("%d",&N);
	while(N--){
		scanf("%d",&A);
		ans+=(1.0/A);
	}
	printf("%g",1.0/ans);
	return 0;
}

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

using namespace std;

#define rep(i, n) for(int i = 0; i < n; ++i)
#define all(x) (x).begin(),(x).end()
#define endl "\n"

using ll = long long;
using P = pair<int,int>;

const int MOD = 1e9 + 7;
const int INF = 1001001001;

int main (){
    string s;
    cin >> s;

    string t = "CODEFESTIVAL2016";
    int cnt = 0;
    rep(i, 16){
        if(s[i] != t[i]){
            cnt++;
        }
    }

    cout << cnt << endl;

    return 0;
}

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

using namespace std;
typedef long long ll;

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

    int L;
    cin >> L;

    int sum = 0;
    for(int i=0;i<N;i++) sum += L+i;
    int best = abs(L) + abs(N);
    for(int i=0;i<N;i++) {
        if(abs(L+i) < abs(best)) best = L+i;
    }

    cout << sum - best << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
    using namespace std;
    
    #define ll long long
    #define pb push_back
    #define printV(v) for(int i=0;i<v.size();i++){cout << v[i]<< " ";} cout << endl
    #define printRev(v) for(int i=v.size()-1;i >= 0;i--){cout << v[i] << " ";} cout << endl
    #define sortV(v) sort(v.begin(),v.end())
    #define revV(v) reverse(v.begin(),v.end())
    #define FOR(i,from,n) for(int i=from;i<n;i++)
    #define FOL(i,from,n) for(int i=from;i >= n;i--)
        
        ll a,b,c,d,e,f,g,n,m,k,t,x,h,w,q;
        ll mod = 998244353;

        
        void solve(){
            cin >> n >> m;
            ll sum = 0;
            while(m--){
                cin >> a;
                sum += a;
            }
            if(sum <= n){
                cout << n-sum;
            }else cout << -1;
        }
            
        int main(){
        ios_base::sync_with_stdio(false);
        //freopen("input.txt","r",stdin);
        //freopen("output.txt","w",stdout);
        int cases = 1;
        //cin >> cases;
    
        while(cases--){ 
            solve();
        }

        return 0;

        }

Measured memory_bytes: 3664
while 1:
	try:
		h=[input() for i in [1]*5]
		if 1 in h and 2 in h:w=1
		elif 1 in h:w=3
		else:w=2
		for i in h:
			if len(set(h))!=2:print 3
			else:print 1 if i==w else 2
	except:break

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

int main() {
	string s;
	int ans = 0, zeros = 0, ones = 0;
	cin >> s;
	for (int i = 0; i < (int)s.size(); i++) {
		if(s[i] == '0')
			zeros++;
		else
			ones++;
	}
	ans = 2*min(zeros, ones);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 512
N, K = map(int, input().split())
Ds = set(map(int, input().split()))
nmbrs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}
nDs = nmbrs - Ds
payment = N
while True:
    payment_str = set(int(i) for i in str(payment))
    if payment_str.issubset(nDs) == True:
        print(payment)
        break
    else:
        payment += 1


Measured memory_bytes: 3060
import sys
sys.setrecursionlimit(10**7)
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return sys.stdin.readline().strip()
INF = 10 ** 18
MOD = 10 ** 9 + 7

def main(): 
    A, B, C, D = LI()

    Cで割り切れる個数 = B // C - (A-1) // C
    Dで割り切れる個数 = B // D - (A-1) // D
    from fractions import gcd
    def lcm(x, y):
        return x * y // gcd(x, y)
    CDの最小公倍数 = lcm(C,D)
    CでもDでも割り切れる個数 = B // CDの最小公倍数 - (A-1) // CDの最小公倍数

    print(B-(A-1) - Cで割り切れる個数 - Dで割り切れる個数 + CでもDでも割り切れる個数)


main()

Measured memory_bytes: 5164
#include<stdio.h>

void compression(int height, int width, char matrix[height][width]){
	int row[height], col[width], i,j;
	for(i = 0; i < height; i++){
		row[i] = 0;
		for(j = 0; j < width; j++){
			if(matrix[i][j] == '#'){
				row[i] = 1;
				break;
			}
		}
	}
	
	for(j = 0; j < width; j++){
		col[j] = 0;
		for(i = 0; i < height; i++){
			if(matrix[i][j] == '#'){
				col[j] = 1;
				break;
			}
		}
	}
	
	for(i = 0; i < height; i++){
		if(row[i] == 1){
			for(j = 0; j < width; j++){
				if(col[j] == 1){
					printf("%c", matrix[i][j]);
				}
			}
			printf("\n");
		}
	}
}

int main(void){
	int height, width, i, j;
	scanf("%d %d", &height, &width);
	char matrix[height][width];
	for (i = 0; i < height; i++){
		for (j = 0; j < width; j++){
			scanf(" %c", &matrix[i][j]);
		}
	}
	
	compression(height, width, matrix);
	
	return 0;
}


Measured memory_bytes: 128
n = int(input())
arr= list(map(int,input().split(" ")))
l=list()

for i in range(len(arr)):
	if(i==0):
		l.append(0)
	elif(i==1):
		l.append(abs(arr[i-1] - arr[i]))
	else:
		# print(i)
		l.append(min ((abs(arr[i-1] - arr[i]) + l[i-1]) , (abs(arr[i-2] - arr[i])+l[i-2]) ))

print(l[-1])

Measured memory_bytes: 13928
while True:
    m,f,r=map(int,input().split())
    if m==-1 and f==-1 and r==-1:
        break
    elif m==-1 or f==-1:
        print("F")
    else:
      su=m+f
      if su>=80:
          print("A")
      elif 65<=su and su<80:
          print("B")
      elif 50<=su and su<65:
          print("C")
      elif su<50 and 30<=su and r<50:
          print("D")
      elif r>=50:
          print("C")
      else:
          print("F")


Measured memory_bytes: 5592
#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

typedef long long ll;

template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}

const ll MAX_N = 100000LL;
const ll MAX_S = 1000000000LL;

vector<ll> A;

void solve(const ll N, const ll K, const ll S) {
    if (S == MAX_S) {
        for (int i = 0; i < K; i++) {
            A[i] = S;
        }
        for (int i = K; i < N; i++) {
            A[i] = 1;
        }
    } else {
        for (int i = 0; i < K; i++) {
            A[i] = S;
        }
        for (int i = K; i < N; i++) {
            A[i] = MAX_S;
        }
    }
}

int main(void) {
    ll N, K, S;
    cin >> N >> K >> S;

    A.resize(N);
    solve(N, K, S);

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

    return 0;
}


Measured memory_bytes: 2048
/**
 *      ABC 43 C
 *      author  : kyomukyomupurin
 *      created : 2018-10-02 17:45:30
**/

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

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int_fast32_t N; cin >> N;
    int_fast32_t a[N] = {};
    for (auto i = 0; i < N; ++i) cin >> a[i];

    int_fast32_t mini = *min_element(a, a + N); int_fast32_t maxi = *max_element(a, a + N);
    int_fast32_t answer = 1e+9;

    for (auto i = mini; i <= maxi; ++i) {
        int_fast32_t temp = 0;
        for (auto j = 0; j < N; ++j) {
            temp += ((i - a[j]) * (i - a[j]));
        }
        if (temp < answer) answer = temp;
    }

    cout << answer << '\n';
    
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define LL long long
#define debug(x) cerr<<#x<<" = "<<x
#define sp <<"  "
#define el <<endl
#define fgx cerr<<" ---------------------------------------------- "<<endl
#define uint unsigned int 
#define ULL unsigned long long
#define LDB long double
#define DB double
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
inline LL read(){
	LL nm=0; bool fh=true; char cw=getchar();
	for(;!isdigit(cw);cw=getchar()) fh^=(cw=='-');
	for(;isdigit(cw);cw=getchar()) nm=nm*10+(cw-'0');
	return fh?nm:-nm;
}

#define mod 1000000007
namespace  CALC{
	inline int add(int x,int y){return (x+y>=mod)?(x+y-mod):(x+y);}
	inline int mns(int x,int y){return (x-y<0)?(x-y+mod):(x-y);}
	inline int mul(int x,int y){return (LL)x*(LL)y%mod;}
	inline void upd(int &x,int y){x+=y;(x>=mod)?(x-=mod):0;}
	inline void dec(int &x,int y){x-=y;(x<0)?(x+=mod):0;}
	inline int qpow(int x,int sq){int res=1;for(;sq;sq>>=1,x=mul(x,x))if(sq&1)res=mul(res,x);return res;}
}using namespace CALC;

#define M 1020
int n,m,X[M],ans;
int fac[M],ifac[M],iv[M],pre[M];
int F[M],G[M],H[M];
inline int C(int N,int K){return mul(fac[N],mul(ifac[N-K],ifac[K]));}
int main(){
	n=read(),m=read(),fac[0]=ifac[0]=1; int sum=0;
	for(int i=1;i<=n;i++)fac[i]=mul(fac[i-1],i); ifac[n]=qpow(fac[n],mod-2);
	for(int i=n;i>=1;--i) ifac[i-1]=mul(ifac[i],i),iv[i]=mul(ifac[i],fac[i-1]);
	for(int i=1;i<=m;i++) X[i]=read(),sum+=X[i];
	G[0]=fac[n];
	for(int k=1;k<=m;++k){
		memset(F,0,sizeof(F));
		for(int i=0;i<=X[k];i++){
			int bas=mul(ifac[i],C(n-i,X[k]-i));
			for(int j=0;j+i<=n;++j) upd(F[i+j],mul(G[j],bas));
		}
		memcpy(G,F,sizeof(F));
	}

	printf("%d\n",G[n]);	return 0;

}

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

#define fi first
#define se second
#define fin(s) freopen( s, "r", stdin );
#define fout(s) freopen( s, "w", stdout );

const long long N = 200200;
const long long Q = 100000001;
const long long mod = 1e9 + 7;
const long long MAGIC = 30;

using namespace std;

void solve()
{
        int n;
        cin >> n;
        if(n < 1000){
                cout << "ABC" << "\n";
        }
        else{
                cout << "ABD" << "\n";
        }
}

bool mtest = false; int main()
{
        //fin("input.txt");
        //fout("output.txt");
        //fin("maze.in");
        //fout("maze.out");
        ios_base::sync_with_stdio(0);
        int TE = 1;
        if(mtest)
                cin >> TE;
        while(TE--)
                solve();
        return 0;
}


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

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

#define fr first
#define sc second
#define pb push_back
#define mpr make_pair
#define ppb pop_back()
#define ins insert
#define sz(s) int(s.size())
#define all(x) x.begin(), x.end()
#define lb lower_bound
#define ub upper_bound
ll n, a, b;
int main()
{
	ios_base :: sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	cin >> n >> a >> b;
	cout << max(0ll, b * (n - 2) - a * (n - 2) + 1);
	return 0;
}

Measured memory_bytes: 256
x1,y1,x2,y2 = map(int, input().split())
a = x2 - x1
b = y2 - y1
x3 = x2 - b
y3 = y2 + a
x4 = x3 - a
y4 = y3 - b
print(x3,y3,x4,y4)

Measured memory_bytes: 3060
N, M = map(int, input().split())
graph ={i+1:[] for i in range(N)}
for _ in range(M):
    a, b = map(int, input().split())
    graph[a].append(b)
    graph[b].append(a)
    
def dfs(path, n, cnt):
    if(len(path) == N):
        return cnt+1
    for j in graph[n]:
        if(j in path):
            continue
        cnt = dfs(path+[j], j, cnt)
    return cnt
print(dfs([1], 1, 0))

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

using ll = long long int;

const int MAX = (int)(5e2 + 5);

int h, w;
int a[MAX][MAX];

int ans_n;
vector<vector<int>> ans_vec;

int main(void) {
  // Here your code !
  scanf("%d %d", &h, &w);

  for (int i = 1; i <= h; ++i) for (int j = 1; j <= w; ++j) {
    scanf("%d", &(a[i][j]));
  }

  for (int i = 1; i <= h; ++i) for (int j = 1; j <= w - 1; ++j) {
    if (a[i][j] % 2 == 1) {
      a[i][j + 1] += 1;
      a[i][j] -= 1;

      ans_n += 1;
      vector<int> tmp;
      tmp.push_back(i);
      tmp.push_back(j);
      tmp.push_back(i);
      tmp.push_back(j + 1);
      ans_vec.push_back(tmp);
    }
  }

  for (int i = 1; i <= h - 1; ++i) {
    if (a[i][w] % 2 == 1) {
      a[i + 1][w] += 1;
      a[i][w] -= 1;

      ans_n += 1;
      vector<int> tmp;
      tmp.push_back(i);
      tmp.push_back(w);
      tmp.push_back(i + 1);
      tmp.push_back(w);
      ans_vec.push_back(tmp);
    }
  }

  printf("%d\n", ans_n);

  for (auto e: ans_vec) {
    printf("%d %d %d %d\n", e[0], e[1], e[2], e[3]);
  }

  return 0;
}

Measured memory_bytes: 9904
import sys, bisect, math, itertools, string, queue, copy
# import numpy as np
# import scipy
from collections import Counter,defaultdict,deque
from itertools import permutations, combinations
from heapq import heappop, heappush
from fractions import gcd
# input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(input())
def inpm(): return map(int,input().split())
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())
def inplm(n): return list(int(input()) for _ in range(n))
def inplL(n): return [list(input()) for _ in range(n)]
def inplT(n): return [tuple(input()) for _ in range(n)]
def inpll(n): return [list(map(int, input().split())) for _ in range(n)]
def inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)])

def main():
    n,k = inpm()
    ans = 0
    for i in range(k,n+2):
        M = ((2*n+1-i)*i)//2
        m = ((i-1)*i)//2
        ans += M - m + 1
        ans %= mod
    print(ans)

if __name__ == "__main__":
    main()

Measured memory_bytes: 73188
#include <bits/stdc++.h>
#include <limits>
#include <math.h>
#include <cmath>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int> ;
using vi = vector<int> ;
using vvi = vector<vector<int>> ;
using vll = vector<long long>;
using vvll = vector<vector<long long >>;
#define PI 3.141592653
#define rep(i, n) for(ll i = 0; i < n; i++)



int main(){
  ll n; cin >> n;
  
  string ans = "";
  while(n > 0){
    ll amari;
    amari = n % 26;
    if(amari == 0){amari += 26; n -= 1;}
    ans += amari + 96;
    n /= 26;
  }

  reverse(ans.begin(), ans.end());

  cout << ans << endl;

}

Measured memory_bytes: 3588
main(n,h,m){double H,M;
for(scanf("%d",&n);n--;){
scanf("%02d:%02d",&h,&m);
M=m*6;H=h*30+m/2.0;
M-=H;
if(M<0)M=-M;
if(M>180)M=360-M;
puts(M<30?"alert":M<90?"warning":"safe");
}exit(0);}

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

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

//#define int long long
//signed main(){
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n,k;
    cin >> n >> k;
    vector<int> a(n);
    int mx=0;
    for(int i = 0; i < n; i++) {
        cin >> a[i];
        mx=max(a[i],mx);
    }

    int g=a[0];
    for(int i = 1; i < n; i++) {
        g=__gcd(a[i],g);
    }

    if(k>mx){
        cout << "IMPOSSIBLE" << "\n";
        return 0;
    }
    if((mx-k)%g==0) cout << "POSSIBLE" << "\n";
    else            cout << "IMPOSSIBLE" << "\n";

    return 0;
}

Measured memory_bytes: 3652
using System;

namespace AizuOnlineJudge
{
    class Program
    {
        static void Main(string[] args)
        {
            var i = int.Parse(Console.ReadLine());

            Console.WriteLine(new DateTime(1970, 1, 1, 0, 0, 0).AddSeconds(i).ToString("H:m:s"));
        }
    }
}



Measured memory_bytes: 18284
import sys
stdin = sys.stdin

sys.setrecursionlimit(10 ** 7)

def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x) - 1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

class CombTools(object):
    def __init__(self, cap: int, mod: int):
        self.cap = cap
        self.mod = mod
        self.inv = self._calc_inv()
        self.fac = self._calc_fac()
        self.fac_inv = self._calc_fac_inv()

    def _calc_inv(self):
        inv = [0, 1]
        for i in range(2, self.cap+1):
            inv.append((self.mod - (self.mod // i) * inv[self.mod % i]) % self.mod)

        return inv

    def _calc_fac(self):
        fac = [1]
        for i in range(1, self.cap+1):
            fac.append((i * fac[-1]) % self.mod)

        return fac

    def _calc_fac_inv(self):
        fac_inv = [1]
        for i in range(1, self.cap+1):
            fac_inv.append((self.inv[i] * fac_inv[-1]) % self.mod)

        return fac_inv

    def nCr(self, n: int, r: int):
        # validation
        if r > n:
            raise ValueError("n must be larger than r (n={}, r={})".format(n, r))

        # calculation
        return self.fac[n] * self.fac_inv[n-r] * self.fac_inv[r] % self.mod


class BIT(object):
    def __init__(self, n: int):
        self.bitree = [0]*(pow(2, (n-1).bit_length()) + 1)
        self.size = len(self.bitree) - 1

    def add(self, index, value):
        while index <= self.size:
            self.bitree[index] += value
            index += (-index) & index

    def get(self, index):
        ans = 0
        while index > 0:
            ans += self.bitree[index]
            index -= (-index) & index

        return ans


# 入力
n = ni()
xs = []
ys = []
ps = []
MOD = 998244353
for _ in range(n):
    xi, yi = li()
    xs.append(xi)
    ys.append(yi)
    ps.append([xi, yi])

# 座標圧縮
xcomp = {xi: i+1 for i, xi in enumerate(sorted(xs))}
ycomp = {yi: i+1 for i, yi in enumerate(sorted(ys))}
pcomp = [[xcomp[xi], ycomp[yi]] for xi, yi in zip(xs, ys)]
pcomp.sort()

# 答え
ans = 0

# 自分が選択される
ct = CombTools(n, MOD)
for i in range(1,n+1):
    ans += i * ct.nCr(n, i)
    ans %= MOD

# BITで左右管理
leftBIT = BIT(n)
rightBIT = BIT(n)

for _, yi in pcomp:
    rightBIT.add(yi, 1)

# 左端から繰り返し
pow2 = [pow(2, i, MOD) for i in range(n+1)]
for _, yi in pcomp:
    rightBIT.add(yi, -1)

    nw = leftBIT.get(n) - leftBIT.get(yi)
    ne = rightBIT.get(n) - rightBIT.get(yi)
    sw = leftBIT.get(yi)
    se = rightBIT.get(yi)

    ans += (pow2[nw] - 1) * (pow2[se] - 1) * (pow2[ne] * pow2[sw])
    ans += (pow2[sw] - 1) * (pow2[ne] - 1) * (pow2[se] * pow2[nw])
    ans -= (pow2[nw] - 1) * (pow2[ne] - 1) * (pow2[sw] - 1) * (pow2[se] - 1)
    ans %= MOD

    leftBIT.add(yi, 1)

print(ans)

Measured memory_bytes: 125148
def main(argv)
  (a, b, c) = gets.chomp.split(' ').map(&:to_i)
  (a, b, c) = [a, b, c].sort

  if a == c then
    if [a, b, c].map{|x| x % 2}.reduce(:+) == 0 then
      puts -1.to_s
    else
      puts 0.to_s
    end
    return
  end
  
  d = 0
  while [a, b, c].map{|x| x % 2}.reduce(:+) == 0 do
    (a, b, c) = [b + c, c + a, a + b].map{|x| x / 2}
    d += 1
  end
  puts d.to_s
end

if self.to_s == 'main' then
  main(ARGV)
end

Measured memory_bytes: 1788
n=int(input())
a=list(map(int,input().split()))
a.append(0)
x=a[0]
xi=1
ans=0
x_s=0
x_e=0
a_sum=a[0]
while x_e<n:
    if x_s==x_e:
        x_e+=1
        ans+=1
        xi=2
        x^=a[x_e]
        a_sum+=a[x_e]
    elif x==a_sum:
        ans+=xi
        xi+=1
        x_e+=1
        x=x^a[x_e]
        a_sum=a_sum+a[x_e]
    else:
        xi-=1
        x=x^a[x_s]
        a_sum=a_sum-a[x_s]
        x_s+=1

print(ans)

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

int main(){
	int a[3];
	cin>>a[0]>>a[1]>>a[2];
	sort(a,a+3);
	if(a[0]==5&&a[1]==5&&a[2]==7)cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#define N 165003
int arr[N];
int main(){
	int a;
	scanf("%d",&a);
	int i;
	for(i=0;i<a*2;i++){
		scanf("%d",arr+i);
	}
	int w;
	for(i=0;i<a*2;i++){
		for(w=0;w<a*2;w++){
			if(arr[w]<arr[w+1]){
				int temp=arr[w];
				arr[w]=arr[w+1];
				arr[w+1]=temp;
			}
		}
	}
	int s=0;
	for(i=0;i<(a*2)-1;i+=2){
		s+=arr[i+1];
	}
	printf("%d",s);
}

Measured memory_bytes: 128
<?php
    list($A,$B,$K) = array_map('intval',explode(" ",trim(fgets(STDIN))));
    
    if(($A+$B-$K) <= 0){
        echo "0 0";   
    }elseif(($A-$K) > 0){
        echo $A-$K." ".$B;
    }else{
        echo "0"." ".($A+$B-$K);
    }

?>

Measured memory_bytes: 16248
N = int(input())
dp = [[0,0,0] for i in range(N)]
dp[0] = list(map(int,input().split()))
for i in range(1,N):
    a,b,c = map(int,input().split())
    dp[i][0] = max(dp[i-1][1],dp[i-1][2]) + a
    dp[i][1] = max(dp[i-1][0],dp[i-1][2]) + b
    dp[i][2] = max(dp[i-1][0],dp[i-1][1]) + c
print(max(dp[N-1]))


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

#define pb push_back
#define mp make_pair
#define inside sl<=l&&r<=sr
#define outside r<sl||sr<l
#define INF 1000000009
using namespace std;
typedef long long ll;

int arr[101];
int dp[100005][2];

int main(){
	//freopen("stl.gir", "r", stdin);
	
	int n, k;
	cin >> n >> k;
	for (int i = 0; i < n; i++) cin >> arr[i];
	
	dp[0][0] = 1;
	dp[0][1] = 0;
	
	for (int tas = 1; tas <= k; tas++){
		int flag1 = 1;
		int flag2 = 0;
		for (int i = 0; i < n; i++){
			if (tas-arr[i] >= 0 && dp[tas-arr[i]][1] == 0) flag1 = 0;
			if (tas-arr[i] >= 0 && dp[tas-arr[i]][0] == 1) flag2 = 1;
		}
		dp[tas][0] = flag1;
		dp[tas][1] = flag2;
	}
	
	if (dp[k][0]) cout << "Second" << endl;
	else cout << "First" << endl;
	
	
	
}

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

int main()
{
  int x, a, b;
  cin >> x >> a >> b;
  if((b-a) > 0) {
    if((b-a) <= x) {
      cout << "safe" << endl;
    } else {
      cout << "dangerous" << endl;
    }
  } else {
    cout << "delicious" << endl;
      }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define all(x) x.begin(),x.end()
#define rep(i,j,n) for (long long i = j; i < (long long)(n); i++)
#define _GLIBCXX_DEBUG
#define MOD 1000000007
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
//name[i][j]-> vvl name(i,vl(j))
//map<int,int>mp
//余りを切り上げる =>  (a + b - 1) / b 

signed main(){
	int a,b,c; cin>>a>>b>>c;
	vi v(3);
	v[0]=a; v[1]=b; v[2]=c;
	sort(all(v));
	int k=v[2]-v[0],l=v[2]-v[1];
//	cout<<k<<" "<<l<<endl;
	int ans=l+(k-l)/2;
	//cout<<ans<<endl;
	if((k-l)%2!=0){
		ans+=2;
	}
	cout<<ans<<endl;
	
	
	
	return 0;
}

Measured memory_bytes: 3584
c0= list(map(int, input().split()))
c1= list(map(int, input().split()))
c2= list(map(int, input().split()))
if c0[1]-c0[0]==c1[1]-c1[0]==c2[1]-c2[0] and c0[2]-c0[0]==c1[2]-c1[0]==c2[2]-c2[0]:
    print('Yes')
else:
    print('No')

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

using namespace std;

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

    string s, t;
    cin >> s >> t;
    int ans = 0;
    for (int i = 0; i < 3; i++) {
        if (s[i] == t[i]) ans++;
    }
    cout << ans << endl;
}

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

typedef int64_t Int;
#define all(x) (x).begin(), (x).end()
 
const double EPS = 1e-10;
const Int INF = 1e18;
const int inf = 1e9;
const Int mod = 1e9+7;

bool print_space_enable = false;
void print() { 
    cout << '\n'; 
    print_space_enable = false;
}

template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
    if (print_space_enable) std::cout << " ";
    cout << fixed << setprecision(15) << head;
    print_space_enable = true;
    print(std::forward<Tail>(tail)...);
}

template<typename T>
void print(vector<T> v) {
    for (size_t i = 0; i < v.size(); i++) {
        if (i > 0) std::cout << " ";
        std::cout << v[i];
    }
    std::cout << '\n';
}

// Union-Find
class UnionFind {
public:
    vector<Int> par, sz;
    UnionFind(Int n) : par(n), sz(n) {
        for (Int i = 0; i < n; i++) {
            par[i] = i;
            sz[i] = 1;
        }
    }
    Int root(Int x) {
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }
    void unite(Int x, Int y) {
        Int rx = root(x);
        Int ry = root(y);
        if (rx == ry) return;
        par[rx] = ry;
        sz[ry] += sz[rx];
    }
    bool same(Int x, Int y) {
        return root(x) == root(y);
    }
};


int main() {
    Int n, m;
    cin >> n >> m;
    UnionFind uf(n);
    for (Int i = 0; i < m; i++) {
        Int a, b;
        cin >> a >> b;
        a--, b--;
        uf.unite(a, b);
    }
    Int res = -INF;
    for (Int i = 0; i < n; i++) {
        res = max(res, uf.sz[uf.root(i)]);
    }
    print(res);
    return 0;
}


Measured memory_bytes: 12592
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b;
  cin>>a>>b;
  if(a!=1&&b!=1){
    cout<<"1"<<endl;}
  else if(a!=2&&b!=2){
    cout<<"2"<<endl;}
  else{
    cout<<"3"<<endl;}
}
   

Measured memory_bytes: 3544
using System;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Linq;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using System.Security.Policy;

class Program
{
    const string Yes = "Yes";
    const string No = "No";
    const char White = '.';
    const char Black = '#';
    const long Mod = 1000000007;

    static void Main(string[] args) {
        checked {
#if DEBUG
            MyDebugger.Test(process, "../TextFile1.txt");
            //TestCaseMaker.MakeTestCase1("../TextFile2.txt");
            //MyDebugger.Test(process, "../TextFile2.txt");
#else
            object ret = process(new StreamReader(Console.OpenStandardInput()));
            Console.WriteLine(ret);
#endif
        }
    }

    static object process(TextReader input) {
        var spl = input.ReadLine().Split(' ');
        var n = int.Parse(spl[0]);
        var m = int.Parse(spl[1]);
        var k = long.Parse(spl[2]);

        var aa = ToIntArray(input.ReadLine(), n);
        var bb = ToIntArray(input.ReadLine(), m);

        var aaa = new long[n];
        var bbb = new long[m];

        aaa[0] = aa[0];
        for (int i = 1; i < n; i++) {
            aaa[i] = aaa[i - 1] + aa[i];
        }

        bbb[0] = bb[0];
        for (int i = 1; i < m; i++) {
            bbb[i] = bbb[i - 1] + bb[i];
        }

        long max = 0;

        for(int i=0; i<=n; i++) {
            var a = i==0 ? 0 : aaa[i-1];
            var bmax = k-a;
            if(bmax < 0) continue;

            var st = 0;
            var en = m-1;
            var p = (st + en) / 2;

            while (true) {
                //終了条件
                if (en - st <= 1) {
                    break;
                }

                //探索条件
                if (bmax > bbb[p]) {
                    st = p;
                } else {
                    en = p;
                }
                p = (st + en) / 2;
            }

            //最後の処理
            if(bbb[en] <= bmax) p = en;
            else if(bbb[st] <= bmax) p = st;
            else p = -1;

            max = Math.Max(max, i + p + 1);
        }

        return max;
    }

    static long[] ToIntArray(string strs, int n) {
        var ret = new long[n];
        if (n == 0) return ret;
        var spl = strs.Split(' ');
        for (int i = 0; i < n; i++)
            ret[i] = long.Parse(spl[i]);
        return ret;
    }
}


Measured memory_bytes: 72148
k, a, b = map(int, input().split())
if a < k and b >= a:
  print('-1')
elif a >= k:
  print('1')
else:
  ans = k // (a - b) * 2 - 4
  while ans // 2 * a - ans // 2 * b + b < k:
    ans += 2
  print(ans - 1)

Measured memory_bytes: 3060
function Main(input){
    const arr = input.split(' ').map(Number);
    let K = arr[3];
    let total=0;
 
    if(K>=arr[0]){
        total += arr[0];
        K -= arr[0];
        K -= arr[1];    
        console.log(K>0 ? total-K:total)
    } else {
        total += K;
        console.log(total);
    }
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 29700
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
#define fi first
#define se second
#define pb push_back
#define forn(i,n) for(int i=0;i<(n);i++)
#define for1(i,n) for(int i=1;i<=n;i++)
#define forr(i,n) for(int i=n;i>=0;i--)
#define all(x) x.begin(), x.end()
const int MAXN = 1e5 +5;

void fio(){
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}

vector<tuple<int,int,int,int> > Q;
int n,m,q;
int an = 0;
vector <int> v;

void dfs(int u){
	if(v.size()==n){
		int ma = 0;
		for(auto z:Q)
			if(v[get<1>(z)] - v[get<0>(z)] == get<2>(z))
					ma += get<3>(z);
		an = max(an, ma);
		return;
	}
	for(int i = u; i<=m ;i++){
		v.pb(i);
		dfs(i);
		v.pop_back();
	}
}

int main(){
  fio();
  cin>>n>>m>>q;
  Q.resize(q);
  forn(i,q){
  	int a,b,c,d; cin>>a>>b>>c>>d;
  	a--,b--;
  	Q.pb({a,b,c,d});
  }
  dfs(1);
  cout<<an<<endl;
  return 0;
}

Measured memory_bytes: 3624
n= int(input())
arr = [int(x) for x in input().strip().split()]


def Greedy(arr):
    
    curr = 1000
    for i in range(len(arr)-1):
        if arr[i+1]>arr[i]:
            stocks = curr // arr[i]
            curr += (arr[i+1] - arr[i])*stocks
    return curr

print(Greedy(arr))


Measured memory_bytes: 9188
#include<iostream>
#include <algorithm>
#include<string>
#include <bitset>
#include <vector>
#include <functional>
#include <climits>
#include <iomanip>
using namespace std;
int main()
{

	//int a = 0, b = 0, c = 0, d = 0, e = 0, f = 0, g = 0, h = 0, ans = 0;
	long a = 0, b = 0, c = 0, d = 0, e = 0, f = 0, g = 0, h = 0, i = 0, j = 0, k = 0, l = 0, ans = 0;
	//cout << LONG_MAX << endl;
	//string s[1001];
	//long long n, A[1000000000];
	//string s;
	cin >> a;
	cin >> b;
	if (a+b==15)
	{
		cout << "+" << endl;

	}
	else if (a*b==15)
	{
		cout << "*" << endl;

	}
	else
	{
		cout << "x" << endl;


	}
	//cout <<  << endl;
	return 0;
}

Measured memory_bytes: 256
<?php
$arr = explode(' ', fgets(STDIN));

$startTime = (int) $arr[0];
$biscuitCount = (int) $arr[1];
$endTime = ((int)$arr[2]) + 0.5;

if ($endTime < $startTime) {
    echo 0 . PHP_EOL;
    exit;
}

$diff = floor($endTime / $startTime);
echo $diff * $biscuitCount . PHP_EOL;


Measured memory_bytes: 4728
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; i++)
#define repr(i, s, e) for(int i=s; i>=e; i--)
#define reps(i, s, e) for(int i=s; i<=e; i++)
#define inf 1e18
#define all(v) v.begin(),v.end()
#define vsort(v) sort(v.begin(), v.end())
#define vsortr(v) sort(v.begin(), v.end(), greater<ll>())
#define sz(x) x.size()
#define ceil(a, b) (a+b-1)/b
#define ok cout << "ok" << endl;
#define sp << " " <<
using namespace std;
using ll = long long;
template<typename T> inline bool chmax(T &a, T b){ if(a<b){ a=b; return true; } return false; }
template<typename T> inline bool chmin(T &a, T b){ if(b<a){ a=b; return true; } return false; }
template<typename T> T gcd(T a, T b){ if(b==0) return a; return gcd(b, a%b); }
template<typename T> T lcm(T a, T b){ return a*b/gcd(a, b); }
template<typename T> void vdebug(vector<T> v){ for(auto vv : v){ cout << vv << " "; } cout << endl; }
template<typename T> void adebug(T arr[], int n){ rep(i, n){ cout << arr[i] << " "; } cout << endl; }
void ans(bool b){ if(b) cout << "Yes" << endl; else cout << "No" << endl; }
void ans2(bool b){ if(b) cout << "YES" << endl; else cout << "NO" << endl; }
int keta(ll num){ int k=0; while(num>0){ num/=10; k++; } return k; }
int dx[] = {1, -1, 0, 0, 1, -1, 1, -1};
int dy[] = {0, 0, 1, -1, 1, -1, -1, 1};


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

    ll n, a, b;
    cin >> n >> a >> b;

    ll num = (n-2)*b - (n-2)*a + 1;
    cout << (num < 0 ? 0 : num) << endl;

    return 0;
}


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

using namespace std;

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

    int bou = 0;
    int count = 1;

    for(int i=0;i<N;i++)
    {
        int L;
        cin >> L;
        bou += L;
        if(bou <= X)
        {
            count++;
        }
    }

    cout << count << endl;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
using namespace std;
int main(){
  int n;
  cin>>n;
  vector<int>v(n);
  for(int& x:v)cin>>x;
  int ans=0;
  for(int i=0;i<n;i++){
    for(int j=i+1;j<n;j++){
      ans+=v[i]*v[j];
    }
  }
  cout<<ans<<endl;
}


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

int main() {
  string s;
  cin >> s;
  int counter = 0;
  if ( s[0] == '1' ) ++counter;
  if ( s[1] == '1' ) ++counter;
  if ( s[2] == '1' ) ++counter;
  cout << counter << endl;
  return 0;
}


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

using namespace std;

int main(void){

  int N,K,S;
  while(cin >> N >> K >> S,N|K|S){

  int dp[11][21][200];
  fill(*dp[0],*dp[11],0);
  dp[0][0][0]=1;

  for(int l=0;l<K;l++){
    for(int i=0;i<N;i++){
      for(int j=0;j<200;j++){
	for(int k=i+1;k<=N;k++){
	  if(j+k<200) dp[l+1][k][j+k]+=dp[l][i][j];
	}
      }
    }
  }

  int ans=0;
  for(int i=0;i<=N;i++)ans+=dp[K][i][S];

  cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 1340
### SNIPPET
  # array = [*1..q].map { |_| gets.split.map(&:to_i) }
  # n = gets.split.map(&:to_i)
  # [].all?(&:even?)
  # a = [*1..m].repeated_combination(n).to_a
  # 切り捨て: .floor(2).to_f ,切り上げ： .ceil(2).to_f,四捨五入: round(2)
  # 3.upto(6) do |i|, 6.downto(3) do |i|
  # 公約数125.gcd(100)、公倍数125.lcm(100)
  # PI = Math::PI
  # 高さh = a * Math.sin(w / 180.0 * Math::PI)
  # 底辺 = a * Math.cos(w / 180.0 * Math::PI)
  # def chmax(a, b) a > b ? a : b end
  # INF = Float::INFINITY
  # def chmin(a, b) a < b ? a : b end

a = gets.split.map(&:to_i)

puts a.uniq.length == 2 ? "Yes" : "No"

Measured memory_bytes: 1788
<?php
     
    $stdin = trim(fgets(STDIN));
     
    for($i = 0;$i < $stdin;$i++) {
        $line = fgets(STDIN);
        $inputs = array();
        $inputs[] = explode(' ', trim($line));
        sort($inputs[0]);
        if(($inputs[0][0]*$inputs[0][0]+$inputs[0][1]*$inputs[0][1])==$inputs[0][2]*$inputs[0][2]){
            echo("YES\n");
        }else{
            echo("NO\n");
        }
    }

Measured memory_bytes: 15356
#include <iostream>
#include <string>
#include <map>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <queue>
#include <tgmath.h>
#define MOD 1000000007
using namespace std;
#define INT_MAX 2147000000
#define LONG_MAX 9223372036854775806

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

int main(){
    int A,B;
    cin >> A >> B;
    cout << max(0,A-B*2) << endl;
    return 0;
}

Measured memory_bytes: 256
// 基本テンプレート
 
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
using namespace std;
 
#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)
#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define int long long int
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
typedef pair<int, int> pii;
typedef long long ll;
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1001001001001001LL;
const ll MOD = 998244353LL;

ll mod_pow(ll x, ll n) {
    ll res = 1;
    while(n > 0) {
        if(n & 1) res = (res * x) % MOD; //ビット演算(最下位ビットが1のとき)
        x = (x * x) % MOD;
        n >>= 1; //右シフト(n = n >> 1)
    }
    return res;
}

const int MAXN = 300010;
int fact[MAXN], inv[MAXN];

void init_fact() {
    fact[0] = 1;
    for(int i=1; i<MAXN; i++) {
        fact[i] = (fact[i-1] * i) % MOD;
    }

    inv[MAXN - 1] = mod_pow(fact[MAXN - 1], MOD-2);
    for(int i=MAXN - 2; i>=0; i--) {
        inv[i] = (inv[i+1] * (i+1)) % MOD;
    }
}

int comb(int n, int r) {
    if(r < 0 || n < r) return 0;
    return fact[n] * inv[n-r] % MOD * inv[r] % MOD;
}

signed main() {
    init_fact();

    int N, A, B, K; cin >> N >> A >> B >> K;

    int ans = 0;
    for(int x=0; x<=N; x++) {
        int F = K - A*x;
        if(F < 0) break;
        if(F % B != 0) continue;

        // valid
        int y = F / B;
        // printf("x = %lld (%lld), y = %lld (%lld)\n", x, comb(N, x), y, comb(N, y));
        (ans += (comb(N, x) * comb(N, y) % MOD)) %= MOD;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4992
/*
    Code written by Talant I.D.
*/
 
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef pair <int, int> pii;
typedef tuple <int, int, int> tiii;
 
#define precision(n) fixed << setprecision(n)
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define mp make_pair
#define mt make_tuple
#define mod (int)1e9+7
#define eps (double)1e-9	
#define PI 2*acos(-0.0);
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define do_not_disturb ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define curMod 998244353

inline bool isvowel(char ch){
    ch = tolower(ch);
    return (ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch == 'u');
}
 
bool isprime(int n){
	if(n < 2 || (n % 2 == 0 && n != 2))
		return false;
	for(int i = 3; i*i <= n; i += 2) 
		if(n % i == 0) return false;
	return true;
}

int main(){
    do_not_disturb
	mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
	string a, b;
	int i, n;
	cin >> n;
	cin >> a >> b;
	for(i = 0; i < a.size(); i++){
		cout << a[i] << b[i];
	}
	
    return 0;
} // What is to be written here?


Measured memory_bytes: 256
/*
 * @Author       : nonameless
 * @Date         : 2020-09-19 20:36:30
 * @LastEditors  : nonameless
 * @LastEditTime : 2020-09-19 21:26:22
 */
#include <bits/stdc++.h>
#define x first
#define y second
#define pb push_back
#define sz(x) (int)x.size()
#define toStr(name) (#name)
#define all(x) x.begin(), x.end()
using namespace std;
typedef long long ll;
typedef pair<ll, ll> PLL;
typedef pair<int, int> PII;
typedef pair<double, double> PDD;
const double eps = 1e-6;
const double PI  = acos(-1.0);
const int INF = 0x3f3f3f3f;
const ll LNF  = 0x3f3f3f3f3f3f3f3f;
inline int gcd(int a, int b) { return b ? gcd(b,a % b):a;}
inline ll  gcd(ll  a, ll  b) { return b ? gcd(b,a % b):a;}
inline int lcm(int a, int b) { return a * b / gcd(a, b); }

template<class T>
inline void read(T &x){
    x = 0;
    int f = 1;
    char c = getchar();
    while(c < '0' || c > '9')   { if(c == '-') f = -1;  c = getchar(); }
    while(c >= '0' && c <= '9') { x = x * 10 + c - '0'; c = getchar(); }
    x = x * f;
}

template<class T>
inline void out(string a, T x){ cout << a << " = " << x << endl; }


int main(){

    ll n, x, m, a;
    cin >> n >> x >> m;
    vector<ll> vec;
    map<ll, int> mp;
    ll idx = n;
    ll ans = 0;
    a = x;
    int yy = n;
    for(int i = 1; i <= n; i ++){
        yy = i;
        if(mp[a]) { idx = mp[a] - 1; break; }
        mp[a] = i;
        ans += a;
        vec.pb(a);
        a = a * a  % m;
    }
    vector<ll> vec2;
    for(int i = 0; i < sz(vec); i ++) if(i >= idx) vec2.pb(vec[i]);
    ll cnt = n - yy + 1;
    ll sum = 0;
    for(auto it : vec2) sum += it;
    if(sz(vec2)){
        ans += cnt / sz(vec2) * sum;
        for(int i = 0; i < cnt % sz(vec2); i ++) ans += vec2[i];
    } 
    cout << ans << endl;
    
    return 0;
}


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

using namespace std;

#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define FIO             ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());
void c_p_c()
{
#ifndef  ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}
int getSum(int n)
{
	int sum;


	for (sum = 0; n > 0; sum += n % 10, n /= 10);

	return sum;
}
int neighbours(int i, int j, int n, int m)
{
	int c = 0;
	if (i + 1 < n)
		c++;
	if (i - 1 >= 0)
		c++;
	if (j + 1 < m)
		c++;
	if (j - 1 >= 0)
		c++;
	return c;
}
int32_t main()
{
	FIO;
	
	int n, d;
	cin >> n >> d;
	vector<vector<int>>ve(n, vector<int>(d));
	int i, j;
	for (i = 0; i < n; i++)
		for (j = 0; j < d; j++)
			cin >> ve[i][j];
	int ans = 0;
	for (i = 0; i < n; i++)
	{
		for (j = i + 1; j < n; j++)
		{
			int a = 0;
			for (int k = 0; k < d; k++)
			{
				int diff = abs(ve[i][k] - ve[j][k]);
				a += diff * diff;
			}
			bool be = false;;
			for (int k = 0; k <= a; k++)
			{
				if (k * k == a)
					be = true;
			}
			if (be) ans++;
		}
	}

	cout << ans;
}










Measured memory_bytes: 3640
from collections import deque
h,w = map(int,input().split())
n = int(input())
A = list(map(int,input().split()))
dx = [0,1,0,-1]
dy = [1,0,-1,0]
ans = [["." for _ in range(w)]for _ in range(h)]
dq = deque([(0,0)])
i = 0
cnt = 0
while i != n:
    p,q = dq.pop()
    ans[q][p] = str(i+1)
    cnt += 1
    for j in range(4):
        nx = p + dx[j]
        ny = q + dy[j]
        if 0<=nx<=w-1 and 0<=ny<=h-1 and ans[ny][nx] == ".":
            dq.append((nx,ny))
            break
    if cnt == A[i]:
        cnt = 0
        i += 1
for i in ans:
    print(" ".join(i))

Measured memory_bytes: 4076