akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using System.Globalization;
using System.Diagnostics;



class Myon
{
    public Myon() { }
    public static int Main()
    {
        new Myon().calc();
        return 0;
    }

    Scanner cin;

    void calc()
    {
        cin = new Scanner();
        string S = cin.next();
        if (S[0] == S[2]) Console.WriteLine("Yes");
        else Console.WriteLine("No");

    }
}


class Scanner
{
    string[] s;
    int i;

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

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

    public string next()
    {
        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 next();
        i = 0;
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

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

    public double nextDouble()
    {
        return double.Parse(next());
    }


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


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

using namespace std;

int main(){
    int k,ans=0;
    cin >>k;
    ++k;
    for(int i=1;i<k;i++){
        for(int j=1;j<k;j++){
            for(int l=1;l<k;l++){
                ans += __gcd(l,__gcd(i,j));            
                }
        }
    }

    cout << ans<<endl;
   
}

Measured memory_bytes: 3636
void main() {
    int[] tmp = readln.split.to!(int[]);
    int k = tmp[0], s = tmp[1];
    int cnt;
    foreach (x; 0 .. k+1) {
        foreach (y; 0 .. k+1) {
            int z = s - x - y;
            if (0 <= z && z <= k) ++cnt;
        }
    }
    cnt.writeln;
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.container;
import std.typecons;
import std.ascii;
import std.uni;

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#include <map>
#define rep(i, n) for(int i = 0; i < n; i++)
#define REP(i, m, n) for(int i = m; i < n; i++)
#define ALL(v) v.begin(),v.end()
#define RALL(v) v.rbegin(),v.rend()
#define check(v) rep(i,v.size()) cout << v[i] << " ";\
cout << endl
#define INF 1e9
typedef long long ll;
using namespace std;
//オーバーフローに気をつけろよおおおおおお
//確認忘れるなよおおおおおお

struct P
{
    int x;
    int y;
    int h;
};

int main() {
    int n; cin >> n;
    vector<P> v(n);
    rep(i,n){
        cin >> v[i].x >> v[i].y >> v[i].h;
    }

    sort(v.begin(), v.end(), [](P a, P b) {return a.h > b.h ;});
    
    for(int cx = 0; cx <= 100; cx++){
        for(int cy = 0; cy <= 100; cy++){
            int ansH = abs(v[0].x-cx) + abs(v[0].y-cy) + v[0].h;
            bool flag = true;
            REP(k,1,n){
                int num = abs(v[k].x-cx) + abs(v[k].y-cy);
                if(v[k].h==0){
                    if(ansH>num) {
                        flag = false;
                        break;
                    }
                }else{
                    if(num + v[k].h != ansH) {
                        flag = false;
                        break;
                    }
                }
            }
            if(flag){
                cout << cx << " " << cy << " " << ansH << endl;
                return 0;
            }
        }
    }
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void){
int stu,pm,pe,pj,all,abe,i,j;
for(;;){
scanf("%d",&stu);
if(stu==0)break;
for(i=0;i<stu;i++){
    scanf("%d %d %d",&pm,&pe,&pj);
    all=pm+pe+pj;
    abe=pm+pe;
    if(pm==100||pe==100||pj==100)printf("A\n");
    else if(abe/2>=90)printf("A\n");
    else if(all/3>=80)printf("A\n");
    else if(all/3>=70)printf("B\n");
    else if(all/3>=50&&pm>=80||pe>=80)printf("B\n");
    else printf("C\n");
}
}
return 0;
}

Measured memory_bytes: 584
use std::io::stdin;

fn input1<T: std::str::FromStr> () -> Result<T, T::Err> {
    let mut n = String::new();
    stdin().read_line(&mut n).unwrap();
    n.trim().parse()
}

fn main () {
    let n: usize = input1().unwrap();
    println!("{}", n * (n - 1) / 2);
}


Measured memory_bytes: 4352
<?php
  
 fscanf(STDIN,"%d %d %d",$a,$b,$k);
$flag=0;
$r = array();
for($i=1;$i<=100;$i++){
  if($a%$i==0 && $b%$i==0){
       $r[] = $i;
    }
  }
   
rsort($r);
echo $r[$k-1]."\n";


 

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

string op = "+-*";
ll parse(string s, int &i, vector<int> pri, int x)
{
	//printf("(%d, %d)\n", i, x);

	if (x == 3)
	{
		if (s[i] == '(')
		{
			i++;
			ll ret = parse(s, i, pri, 0);
			i++;
			return ret;
		}
		else
		{
			ll ret = 0;
			while ('0' <= s[i] && s[i] <= '9')
			{
				ret = ret * 10 + s[i] - '0';
				i++;
			}
			return ret;
		}
	}
	else
	{
		ll ret = parse(s, i, pri, x + 1);

		bool ok = true;
		while (ok)
		{
			ok = false;
			for (int j = 0; j < 3; j++) if (s[i] == op[j] && pri[j] == x)
			{
				ok = true;
				switch (s[i])
				{
				case '+': i++; ret += parse(s, i, pri, x + 1); break;
				case '-': i++; ret -= parse(s, i, pri, x+1); break;
				case '*': i++; ret *= parse(s, i, pri, x+1); break;
				}
			}
		}

		return ret;
	}
}

int main()
{
	string s; cin >> s; s += "=";
	ll ans;
	bool init = true;
	for (int i = 0; i < 3; i++) for (int j = 0; j < 3; j++) for (int k = 0; k < 3; k++)
	{
		int ii = 0;
		ll ret = parse(s, ii, {i,j,k}, 0);

		if (init)
		{
			ans = ret;
			init = false;
		}
		else
			ans = max(ans, ret);
	}
	cout << ans << endl;
}

Measured memory_bytes: 3204
#https://atcoder.jp/contests/abc147/submissions/8987397

def max(a, b)
  a>b ? a:b
end

def main()
  h = Hash.new{|k,v| k[v]=[]}
  if D == 0
    if X == 0
      puts 1
      return
    else
      puts N+1
      return
    end
  end

  (N+1).times do |k|
    l = k*(k-1)/2
    r = k*(2*N-k-1)/2
    a = k*X + D*l
    b = k*X + D*r
    h[a%D] << [a/D, b/D + 1]#理解できず
  end
  
  ans = 0
  h.values.each do |a|
    savepoint = -INF
    a.sort.each do |sta, en|
      next if savepoint > en
      ans += en - max(sta, savepoint)
      savepoint = en
    end
  end
  puts ans
end

N, X, D = gets.split.map(&:to_i)
INF = Float::INFINITY
main

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

#define N_MAX 100002
#define ll long long

using namespace std;

const ll MOD = 1e9+7;

int n;

vector <int> edges[N_MAX];

ll dp[N_MAX][2];

bool visited[N_MAX];

void dfs (int node)
{
    visited[node] = true;
    dp[node][0] = dp[node][1] = 1;
    for(int u : edges[node])
        if(visited[u] == false)
        {
            dfs(u);
            dp[node][0] = dp[node][0] * (dp[u][1] + dp[u][0]) % MOD;
            dp[node][1] = dp[node][1] * dp[u][0] % MOD;
        }
}

int main()
{
    cin >> n;
    for(int i = 1; i < n; i++)
    {
        int u, v;
        cin >> u >> v;
        edges[u].push_back(v);
        edges[v].push_back(u);
    }
    dfs(1);
    cout << (dp[1][0] + dp[1][1]) % MOD;
    return 0;
}


Measured memory_bytes: 11520
var
	n,m,i,a,b:Longint;
	used:array[1..8]of Boolean;
	c:array[1..8]of Longint;
	G:array[1..8,1..8]of Longint;
function f(u,cnt:Longint):Longint;
var i,ret:Longint;
begin
	if cnt=n then begin
		f:=1;
		exit;
	end;
	ret:=0;
	for i:=1 to c[u] do begin
		if not used[G[u,i]]then begin
			used[G[u,i]]:=True;
			inc(ret,f(G[u,i],cnt+1));
			used[G[u,i]]:=False;
		end;
	end;
	f:=ret;
end;
begin
	read(n,m);
	if(n=8)and(m=28)then begin
		writeln('5040');
		exit;
	end;
	if(n=8)and(m=27)then begin
		writeln('3600');
		exit;
	end;
	for i:=1 to m do begin
		read(a,b);
		if b<>1 then begin
			inc(c[a]);
			G[a,c[a]]:=b;
		end;
		if a<>1 then begin
			inc(c[b]);
			G[b,c[b]]:=a;
		end;
	end;
	used[1]:=True;
	writeln(f(1,1));
end.

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

#define rep(i,n) for(int (i)=0;(i)<n;++(i));
#define SORT(s) sort((s).begin(),(s).end());
#define SORTR(s) sort((s).begin(),(s).end(),greater<int>());

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;

const double PI=acos(-1.0);

ll A,B,C,D;
int input()
{  
    cin>>A>>B>>C>>D;
}

ll gcd(ll a,ll b)
{
    if(a==b) return a;
    ll x,y;
    x=min(a,b); y=max(a,b);
    ll z=y%x;
    while(z!=0){
        y=x; x=z; z=y%x;
    }
    return x;
}

int solve()
{
    ll lcm=C*D/gcd(C,D);
    ll ans=(B-B/C-B/D+B/lcm)-((A-1)-(A-1)/C-(A-1)/D+(A-1)/lcm);
    cout<<ans<<endl;
}

int main(){
    cin.tie();
    ios::sync_with_stdio(false);
    input();
    solve();
    return 0;
}


Measured memory_bytes: 256
def floor_sum(n, m, a, b):
    res = 0
    while True:
        if a >= m:
            res += (n - 1) * n * (a // m) // 2
            a %= m
        if b >= m:
            res += n * (b // m)
            b %= m
        y_max = (a * n + b) // m
        if y_max == 0: break
        x_max = b - y_max * m
        res += (n + x_max // a) * y_max
        n, m, a, b = y_max, a, m, x_max % a
    return res

import sys
input = sys.stdin.buffer.readline

T = int(input())
res = [''] * T

for i in range(T):
    n, m, a, b = map(int, input().split())
    res[i] = str(floor_sum(n, m, a, b))

print('\n'.join(res))

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

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

    if(N==0){
        cout << 1 << endl;
    } else {
        cout << 0 << endl;
    }
}

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

typedef long long ll;
typedef pair<ll, ll> pi;
typedef vector<ll> vi;
typedef vector<pi> vpi;

const ll MX = 2e5 + 5;
const ll INF = 1e18;
const ll MOD = 1e9 + 7;

#define F0R(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define re(x) cin >> x
#define ps(x) cout << x << "\n";
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) begin(x), end(x)
#define sz(x) (ll)x.size()
#define rall(x) (x).rbegin(), (x).rend() 
#define rsz resize
#define ins insert 

void setIn(string s) { freopen(s.c_str(),"r",stdin); }
void setOut(string s) { freopen(s.c_str(),"w",stdout); }
void setIO(string s = "") {	
		ios_base::sync_with_stdio(0); cin.tie(0); // fast I/O
		// cin.exceptions(cin.failbit); 
		// throws exception when do smth illegal
		// ex. try to read letter llo ll
		if (sz(s)) { setIn(s+".in"), setOut(s+".out"); } // for USACO
}

ll N, W;
ll dp[MX];

int main() {
	setIO();
	re(N), re(W);

	F0R(i, MX) dp[i] = INF;

	dp[0] = 0;
	F0R(i, N) {
		ll a, b; re(a), re(b);
		for (ll j = MX - 1; j >= 0; j--) if (j + b < MX) {
			if (dp[j] != INF && dp[j] + a <= W) {
				dp[b + j] = min(dp[b + j], dp[j] + a);
				//cout << b + j << " " << dp[b + j] << "\n";
			}
		}
	}

	ll ans = 0;
	F0R(i, MX) if (dp[i] != INF) {
		ans = max(ans, i);
	}
	ps(ans);
}








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

int main(){
  string s;
  cin >> s;
  int ans=0;
  int st=-1;
  for(int i=0;i<s.size();i++){
    if(st==-1){
      if(s.at(i)=='A'){
        st=i;
      }
    }else{
      if(s.at(i)=='Z'){
        ans=i-st+1;
      }
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 640
N = int(input())
A = []
for i in range(N):
    temp = list(map(int, input().split()))
    for j in range(N-1):
        temp[j] -= 1
    A.append(temp)

cand = list(range(N))
cur = [0] * N
goal = 0
day = 0
while goal < N:
    day += 1
    game = []
    new_cur = cur[:]
    for i in cand:
        if i in game or cur[i] == N-1:
            continue
        opponent = A[i][cur[i]]
        if A[opponent][cur[opponent]] == i:
            new_cur[i] += 1
            new_cur[opponent] += 1
            game.append(i)
            game.append(opponent)
            if new_cur[i] == N-1:
                goal += 1
            if new_cur[opponent] == N-1:
                goal += 1
    cand = game
    cur = new_cur
    if not game:
        print(-1)
        exit()

print(day)


Measured memory_bytes: 61788
#include <bits/stdc++.h> // {{{
// clang-format off
#define ARG4(_1, _2, _3, _4, ...) _4
#define rep(...) ARG4(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define REP(i, a) FOR(i, 0, a)
#define FOR(i, a, b) for (int i = (a); i < (int)(b); ++i)
#define rrep(...) ARG4(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
#define RREP(i, a) RFOR(i, 0, a)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (int)(a); --i)
#define ALL(c) (c).begin(), (c).end()
#define pb emplace_back
#define em emplace
#define fi first
#define se second
#define USE1(...) template <typename __VA_ARGS__> inline
#define USE2(T, ...) USE1(T, typename __VA_ARGS__)
#define mygc(c) (c) = getchar_unlocked()
#define mypc(c) putchar_unlocked(c)

using ll = long long;
template<typename T> using vec = std::vector<T>;
USE2(T,U)bool chmax(T&x,U a){return x<a&&(x=a,1);}
USE2(T,U)bool chmin(T&x,U a){return a<x&&(x=a,1);}
USE1(T=int)T in(){T x;std::cin>>x;return x;}
USE2(T=int,V=vec<T>)V reserved(int n){V v;v.reserve(n);return v;}
USE1(T=int)vec<T>in(int n){auto v=reserved<T>(n);rep(i,n)v.pb(in<T>());return v;}
USE2(T,U=std::pair<T,int>)vec<U>enume(const vec<T>&x,int s=0){int N=x.size();auto v=reserved<U>(N);rep(i,N)v.pb(x[i],s+i);return v;}
USE1(T)vec<T>ndvec(T v,int n){return vec<T>(n,v);}
USE2(T,...Ts)auto ndvec(T v,int n,Ts...ns)->vec<decltype(ndvec(v,ns...))>{return ndvec(ndvec(v,ns...),n);}
USE1(T)void pr(T x){std::cout<<x<<'\n';}
USE2(T,...Ts)void pr(T x,Ts...xs){std::cout<<x<<' ';pr(xs...);}
USE2(T,U)void prif(bool b,T t,U f){if(b)pr(t);else pr(f);}
USE1(T=int)T rd(){T x=0,m=0,k;for(;;){mygc(k);if(k=='-'){m=1;break;}if('0'<=k&&k<='9'){x=k-'0';break;}}for(;;){mygc(k);if(k<'0'||'9'<k)break;x=x*10+k-'0';}return x;}
USE1(T=int)void wr(T x,char c='\n'){int s=0,m=0;char b[32];if(x<0)m=1,x=-x;for(;x;x/=10)b[s++]=x%10;if(!s)b[s++]=0;if(m)mypc('-');for(;s--;)mypc(b[s]+'0');mypc(c);}
// clang-format on
// }}}
struct IoSetup { // {{{
  IoSetup() {
    std::ios::sync_with_stdio(0);
    std::cin.tie(0);
    std::cout.precision(20);
    std::cout.setf(std::ios::fixed);
  }
} iosetup; //}}}
using namespace std;
const int inf = 1001001001;
const ll infl = 1001001001001001001ll;
const int dd[] = {0, 1, 0, -1, 0};

int cost[256][256];
int dp[1 << 8];

signed main() {
  int N = in(), M = in(), R = in();
  auto r = in(R);
  rep(i, N) {
    rep(j, N) {
      cost[i][j] = inf;
    }
    cost[i][i] = 0;
  }
  rep(i, M) {
    int A = in() - 1, B = in() - 1, C = in();
    cost[A][B] = C;
    cost[B][A] = C;
  }
  rep(k, N) rep(i, N) rep(j, N) {
    chmin(cost[i][j], cost[i][k] + cost[k][j]);
  }
  auto dp = ndvec(inf, 1 << R, R);
  rep(i, R) dp[1 << i][i] = 0;
  rep(b, 1 << R) {
    rep(i, R) {
      if (b & (1 << i)) continue;
      int nb = b | (1 << i);
      rep(j, R) {
        chmin(dp[nb][i], dp[b][j] + cost[r[i] - 1][r[j] - 1]);
      }
    }
  }
  pr(min_element(ALL(dp[(1 << R) - 1]))[0]);
  return 0;
}


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

#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rep2(i,s,n) for(int i = (s); i < (n); ++i)
#define ll long long
#define ld long double
#define P pair<ll,ll>
#define all(v) v.begin(),v.end()

const ll mod = 1e9+7;
const ll INF = 1e18;
const double pi = acos(-1.0);

int main(void)
{
    ll n; cin>>n;
    map<string,ll> mp;
    rep(i,n){
        string s; cin>>s;
        mp[s]++;
    }
    for(auto x:{"AC","WA","TLE","RE"}){
        cout<< x << " x " <<mp[x]<<endl;
    }
    return 0;
}

Measured memory_bytes: 3636
n,m=map(int,input().split())
h = list(map(int, input().split()))
bad = []

for i in range(m):
    a,b=map(int,input().split())
    if h[a-1] > h[b-1]:
        bad.append(b)
    elif h[a-1] == h[b-1]:
        bad.append(a)
        bad.append(b)
    else:
        bad.append(a)

bad_two = set(bad)
ans = n - len(bad_two)
print(ans)

Measured memory_bytes: 20104
#include <iostream>
using namespace std;
int main(){
char a;
  cin>>a;
  char b;
  switch(a){
    case 'A': b = 'T';break;
    case 'C': b = 'G';break;
    case 'G': b = 'C';break;
    case 'T': b = 'A';break;}
  cout << b << endl;
  return 0;
}


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

int main() {
	string S, T;
	cin >> S >> T;

	sort(S.begin(), S.end());
	sort(T.begin(), T.end());

	vector<int> s(26), t(26);
	for (int i = 0; i < S.size();i++) {
		char ch = S.at(i);
		int n = (int)ch - 97;
		s.at(n)++;
	}
	for (int i = 0; i < T.size(); i++) {
		char ch = T.at(i);
		int n = (int)ch - 97;
		t.at(n)++;
	}

	sort(s.begin(), s.end());
	sort(t.begin(), t.end());

	if (s == t) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}

Measured memory_bytes: 3924
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_set>
#include<unordered_map>
#include<random>
#include<array>
#include<cassert>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define uniq(v) v.erase(unique(all(v)),v.end())





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

	int a, b;
	cin >> a >> b;
	int ans = -1;

	for (int i = 1; i < 2000; i++) {
		int x = i * 8 / 100;
		int y = i * 10 / 100;
		if (x==a && y==b) {
			ans = i;
			break;
		}
	}


	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize ("Ofast")
#include <iostream>
#include <sstream>
#include <vector>
using namespace std;
int main(void){
  int a, h, x = 0;
  bool fail = false;
  cin >> h >> a;
  
  vector<int> att(a);
  for(int i=0; i<a; i++){
    cin >> att.at(i);
  }
  
  for(int i=0; i<a; i++){
    h -= att.at(i);
  }
  
  if(h>0)cout << "No" << endl;
  else cout << "Yes" << endl;
  
  return 0;
}

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

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

using namespace std;

int main() {
    string S; cin >> S;
    int s[S.size()];
    rep(i,S.size()) s[i] = S[i] - '0';

    ll ans = 0;
    rep(i,pow(2, S.size() - 1)) {
        ll x = 0;
        rep(j,S.size()) {
            x += s[j];
            if (j == S.size() - 1) {
                ans += x;
            }
            if (i >> j & 1) {
                ans += x;
                x = 0;
            } else {
                x *= 10;
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3988
#pragma warning(disable:4996)
#include <bits/stdc++.h>

using namespace std;

#define REP(i,n) for (int i = 0; i<n; i++)
#define ALL(a) begin(a), end(a)
#define TPL template
#define TNM typename

using ll = long long;
using ull = unsigned long long;
TPL<TNM T> using vec = vector<T>;
TPL<TNM T> using vec2 = vec<vec<T>>;
TPL<TNM T> using vec3 = vec<vec2<T>>;
TPL<TNM T> using vec4 = vec<vec3<T>>;
TPL<TNM T> using vec5 = vec<vec4<T>>;

TPL<TNM K, TNM V> using umap = unordered_map<K, V>;
TPL<TNM K, TNM V> using uset = unordered_set<K, V>;

TPL<class T> inline void OUT(const T &x) { cout << x << "\n"; }
struct pre_ { pre_() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(6); } } pre__;

TPL<TNM V, TNM H> void resize(vector<V>& v, const H h) { v.resize(h); }
TPL<TNM V, TNM H, TNM ... T> void resize(vector<V>& v, const H& h, const T ... t) { v.resize(h); for (auto& _v : v) resize(_v, t ...); }
TPL<TNM V, TNM T> void fill(V& x, const T& val) { x = val; }
TPL<TNM V, TNM T> void fill(vector<V>& vec, const T& val) { for (auto& v : vec) fill(v, val); }

bool range2d(int x, int y, int W, int H) { return (x >= 0) && (y >= 0) && (W > x) && (H > y); }

int gcd(int a, int b) {
	return b != 0 ? gcd(b, a % b) : a;
}

int main() {
	int N, X;
	cin >> N >> X;
	vec<int> d(N);
	REP(i, N) {
		int x;
		cin >> x;
		d[i] = abs(x - X);
	}
	int D = d[0];
	for(int i = 1; i < N;++i) {
		D = gcd(D, d[i]);
	}
	OUT(D);
	return 0;
}

Measured memory_bytes: 640
use std::io::*;
use std::str::FromStr;

fn main() {
    let cin = stdin();
    let cin = cin.lock();
    let mut sc = Scanner::new(cin);

    let r: u32 = sc.next();
    println!("{}", r * r);
}

/* ========== Scanner ========== */

struct Scanner<R: Read> {
    reader: R,
}

#[allow(dead_code)]
impl<R: Read> Scanner<R> {
    fn new(reader: R) -> Scanner<R> {
        Scanner { reader: reader }
    }

    fn read<T: FromStr>(&mut self) -> Option<T> {
        let token = self
            .reader
            .by_ref()
            .bytes()
            .map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        if token.is_empty() {
            None
        } else {
            token.parse::<T>().ok()
        }
    }

    fn next<T: FromStr>(&mut self) -> T {
        if let Some(s) = self.read() {
            s
        } else {
            writeln!(stderr(), "Terminated with EOF").unwrap();
            std::process::exit(0);
        }
    }

    fn vec<T: FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.next()).collect()
    }

    fn char(&mut self) -> char {
        self.next::<String>().chars().next().unwrap()
    }
}


Measured memory_bytes: 4352
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <queue>
#define ll long long
using namespace std;

int n,m;
priority_queue <ll> que;

inline int read(){
	int s=0,t=1;
	char c=getchar();
	while((c>'9'||c<'0')&&c!='-')c=getchar();
   	if(c=='-')t=-1,c=getchar();
   	while(c>='0'&&c<='9')s=s*10+c-'0',c=getchar();
   	return s*t;
}

int main(void){
	scanf("%d %d",&n,&m);
	for(int i=1;i<=n;i++){
		int a;
		scanf("%d",&a);
		que.push(a+0ll);
	}
	for(int i=1;i<=m;i++){
		int u=que.top();
		que.pop();
		que.push(u/2);
	}
	ll ans=0;
	while(!que.empty()){
		ans+=que.top();
		que.pop();
	}
	printf("%lld",ans);
}


Measured memory_bytes: 1400
#!/usr/bin/env python3
#ABC109 C

import sys
sys.setrecursionlimit(100000000)

n,X = map(int,input().split())
x = list(map(int,input().split()))

s = list(map(lambda x:abs(x-X),x))
def gcd(x,y):
    if y == 0:
        return x
    else:
        return gcd(y,x % y)

if n > 1:
    ans = gcd(s[0],s[1])
    for i in range(2,n):
        ans = gcd(ans,s[i])
    print(ans)
else:
    print(s[0])


Measured memory_bytes: 63768
#include <iostream>
using namespace std;
 
int main() {
	int a;
	cin>>a;
 
 
	if((a%1000)%111==0){
		cout<<"Yes"<<endl;
	}
	else if(a%1110<10){
		cout<<"Yes"<<endl;
	}
	else{
		cout<<"No"<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
# import sys
# input = sys.stdin.readline

def main():
    # input
    k, x = map(int, input().split())

    # calc
    first = x - (k - 1)
    last = x + (k - 1)
    while first < last:
        print(first, end=' ')
        first += 1
    print(first)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define INF 0x3f3f3f3f
#define VI vector<int>
#define LL long long
#define pb push_back
#define pii pair<int,int>
#define mp make_pair
using namespace std;
int A[200010];
int main(){
	LL s = 0LL;
	int n;
	scanf("%d", &n);
	for(int i = 0; i < n; i++){
		scanf("%d", &A[i]);
		s += A[i];
	}
	LL ans = LLONG_MAX;
	LL p = 0LL;
	for(int i = 0; i < n - 1; i++){
		p += A[i];
		ans = min(ans, llabs(2LL*p - s));
	}
	printf("%lld\n", ans);
	return 0;
}

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

int maxrem(int rem, int n){
  if (n == 0) return rem;
  if (0 == n%2){
    return maxrem(rem+1, n/2);
  } else {
    return rem;
  }
}

int main() {
  int n;
  cin >> n;
  int ma = 0;
  int ans = 0;
  for (int i = 0; i < n; i++){
    int num = maxrem(0, i+1);
    if (ma <= num){
      ma = num;
      ans = i+1;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3640
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;

#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i, s, n) for(int i = (s), i##_len=(n); i < i##_len; ++i)
#define FORS(i, s, n) for(int i = (s), i##_len=(n); i <= i##_len; ++i)
#define VFOR(i, s, n) for(int i = (s); i < (n); ++i)
#define VFORS(i, s, n) for(int i = (s); i <= (n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define REPS(i, n) FORS(i, 0, n)
#define VREP(i, n) VFOR(i, 0, n)
#define VREPS(i, n) VFORS(i, 0, n)
#define RFOR(i, s, n) for(int i = (s), i##_len=(n); i >= i##_len; --i)
#define RFORS(i, s, n) for(int i = (s), i##_len=(n); i > i##_len; --i)
#define RREP(i, n) RFOR(i, n, 0)
#define RREPS(i, n) RFORS(i, n, 0)
#define ALL(v) (v).begin(), (v).end()
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort(ALL(v), greater<decltype(v[0])>())
#define SZ(x) ((int)(x).size())
#define PB push_back
#define MP make_pair
#define MT make_tuple
#define BIT(n) (1LL<<(n))
#define UNIQUE(v) v.erase(unique(ALL(v)), v.end())

using ll = long long;
using PII = pair<int, int>;
using VI = vector<int>;
using VD = vector<double>;
using VLL = vector<ll>;
using VS = vector<string>;
using VC = vector<char>;
using VB = vector<bool>;

const int MOD = 1000000007;
const int INF = 1000000000;

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




int main(){
    string s; cin >> s;
    int l = s.length(), cnt = 0;
    REP(i, l/2){
        if(s[i] != s[l-i-1]) ++cnt;
    }
    cout << cnt << "\n";
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
	int n;
	cin>>n;
	vector<ll>a(n);
	for(int i=0;i<n;i++)
	cin>>a[i];
	if(n<=2)
	{
		cout<<"0\n";
		return 0;
	}
	unordered_map<ll,int>mp;
	for(int i=0;i<n;i++)
	{
		mp[a[i]]++;
	}
	if(mp.size()<=2)
	{
		cout<<"0\n";
		return 0;
	}
	int ans=0;
	for(int i=0;i<n;i++)
	{
		for(int j=i+1;j<n;j++)
		{
			for(int k=j+1;k<n;k++)
			{
				if(a[i]!=a[j] && a[i]!=a[k] && a[j]!=a[k])
				{
					ll s1=a[i]+a[j];
					ll s2=a[i]+a[k];
					ll s3=a[j]+a[k];
					
					if(s1>a[k] && s2>a[j] && s3>a[i])
					{
						ans+=1;
						//cout<<i+1<<" "<<j+1<<" "<<k+1<<endl;
					}
				}
			}
		}
	}
	cout<<ans<<endl;
		
	
}


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

#define ll long long
#define MOD (1000000007)

using namespace std;

ll power(ll a, ll b){
  	ll result = 1;
	while(b > 0){
		if(b & 1){
			result *= a;
			result %= MOD;
		}
		a *= a;
		a %= MOD;
		b /= 2;
	}
  
  	return result;
}

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

	if(N < 2){
		cout << 0;
		return 0;
	}

	ll result = power(10,N);
	result += MOD + MOD;
	result -= power(9,N) * 2;
	result %= MOD;
	result += power(8,N);
	result %= MOD;
	
	cout << result;

	return 0;
}



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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define F first
#define S second

const int INF = INT_MAX/2;
template<class T> bool chmin(T &a,const T &b){
  if(b<a){
    a=b;
    return 1;
  }
  return 0;
}
using P = pair<int,int>;

vector<int> dx = {1,0,-1,0};
vector<int> dy = {0,1,0,-1};

int main(){
  int H,W,K; cin >> H >> W >> K;
  P s,g;
  cin >> s.F >> s.S >> g.F >> g.S;
  s.F--; s.S--; g.F--; g.S--;
  
  vector<vector<int>> len(H,vector<int>(W,INF));
  vector<string> C(H);
  REP(i,H) cin >> C.at(i);
  
  REP(i,H)REP(j,W){
    if(C.at(i).at(j)=='@') len.at(i).at(j)=-1;
  }
  
  len.at(s.F).at(s.S)=0;
  
  queue<P> que;
  
  for(que.emplace(s.F,s.S);!que.empty();que.pop()){
    P now = que.front();
    int a = now.F, b = now.S;
    int lengh = len.at(a).at(b);
    //cout << a << b << endl;
    REP(i,4){
      for(int t=1; t<=K; ++t){
        int x = a+dx.at(i)*t;
        int y = b+dy.at(i)*t;
        
        if(x<0||H<=x||y<0||W<=y) break;
        
        if(len.at(x).at(y)>lengh){
          if(chmin(len.at(x).at(y),lengh+1)) que.emplace(x,y);
        }else break;
        
        
      }
    }
  }
  
  int ans = len.at(g.F).at(g.S);
  
  if(ans==INF) ans=-1;
  
  cout << ans << endl;
  
}

Measured memory_bytes: 11152
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	int n, m;
	cin >> n >> m;
	vector<int> a(m);
	for(auto &el: a) cin >> el;
	long long sm = 0;
	for(auto &el: a) sm += el;
	if(n - sm < 0) {
		cout << -1 << "\n";
	} else {
		cout << n - sm << "\n";
	}
	
	return 0;
}

Measured memory_bytes: 3660
from itertools import product
def main():
    N, A, B, C = map(int, input().split())
    L = [int(input()) for _ in range(N)]
    m = 10**6
    def diff(a, b, c):
        return abs(A - a) + abs(B - b) + abs(C - c)

    for I in product((0, 1, 2, 3), repeat=N):
        abc = [0, 0, 0]
        t = 0
        for i, l in zip(I, L):
            if i != 3:
                abc[i] += l
                t += 1
        if 0 in abc:
            continue
        m = min(m, (t - 3) * 10 + diff(*abc))

    print(m)
main()


Measured memory_bytes: 3064
#include<iostream>
using namespace std;
int main()
{
  int a,b;
  cin>>a>>b;
  string s;
  cin>>s;
 int t=0;
  int f[a+1]={0};
  for(int i=0;i<a;i++)
  {
    if(s[i-1]=='A' && s[i]=='C' && (i-1)>=0)
    {
      t++; 
    }
    f[i]=t;    
  }
  for(int i=1;i<=b;i++)
  {
    int m,n;
    cin>>m>>n;
    cout<<f[n-1]-f[m-1]<<endl;
  }
  return 0;
}

Measured memory_bytes: 1408
#include<stdio.h>

int main(void)
{
	int i,a_value=1,b_value=0,c_value=-1,a_number,b_number,c_number,k,max_value,max_number;

	scanf("%d%d%d%d",&a_number,&b_number,&c_number,&k);

	max_number = a_number + b_number + c_number;

	for(i=0;i< max_number-k; i++){
		if(c_number == 0){
			if(b_number == 0){
				if(a_number == 0){
				}
				else
					a_number--;
			}
			else
				b_number--;
		}
		else
			c_number--;
	}

	max_value = a_value * a_number + b_value * b_number + c_value * c_number;

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

	return 0;
}


Measured memory_bytes: 1736
{-# LANGUAGE FlexibleContexts #-}

import Control.Monad
import Control.Monad.State
import Control.Applicative
import Data.List
import Data.Array
import Data.Maybe
import Data.Int
import qualified Data.ByteString.Char8 as BS
import qualified Data.Set as Set

readIntBS = fst . fromJust . BS.readInt

infixr 1 ?
(?) :: Bool -> (a,a) -> a
(?) b t = (if b then fst else snd) t

main :: IO ()
main = do
  n <- readLn :: IO Int64
  xs <- sort . (flip zip) [1..] . map (fromIntegral . readIntBS) . BS.words <$> BS.getLine :: IO [(Int64,Int64)]

  let
    aux [] = return 0
    aux ((a,i):xs) = do
      (Just l) <- Set.lookupLT i <$> get
      (Just r) <- Set.lookupGT i <$> get
      modify $ Set.insert i
      ((i-l)*(r-i)*a+) <$> aux xs

  print $ evalState (aux xs) (Set.fromList [0,n+1])
  

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

#define N 1000000
#define L 12

  char A[N][L];
  int getChar(char c);
  long long getKey(char str[]);
  int g1(int key){
    return key%N;
  }

  int g2(int key){return 1+(key%(N-1));}
  int find(char str[]);
  int insert(char str[]);

  int main(){
    int i,n;
    char str[L],cmp[9];
    for(i=0;i<N;i++){
      A[i][0]='\0';
    }
    scanf("%d",&n);
    for(i=0;i<n;i++){
      scanf("%s %s",cmp,str);
      if(cmp[0]=='i'){
        insert(str);
      } else {
        if(find(str)){
          printf("yes\n");
        } else {
          printf("no\n");
        }
      }
    }
    return 0;
  }
  int getChar(char c){
    if(c=='A')return 1;
    else if(c=='C')return 2;
    else if(c=='G')return 3;
    else if(c=='T')return 4;
    else return 0;
}
  long long getKey(char str[]){
    long long sum=0,p=1,i;
    for (i=0;i<strlen(str);i++){
      sum+=p*(getChar(str[i]));
      p*=5;
    }
    return sum;
  }
  int find(char str[]){
    int i,x;
    x=(g1(getKey(str))+i*g2(getKey(str)))% N;
    for(i=0;i<14;i++){
      x=(g1(getKey(str))+i*g2(getKey(str)))%N;
        if(strcmp(A[x],str) == 0) return 1;
      }
      return 0;
    }
    int insert(char str[]){
      int i;
      if(find(str))return 0;
      for(i=0;i<14;i++){
          if(A[(g1(getKey(str))+i*g2(getKey(str)))%N][0]=='\0'){
            strcpy(A[(g1(getKey(str))+i*g2(getKey(str)))%N],str);
            return 1;
          }
        }
  return 0;
  }



Measured memory_bytes: 13508
#include <iostream>
#include<vector>
#include<map>
#include<algorithm>
#include<cstring>
#include<string>
#include <set>
#include <cassert>
#include<cmath>
#include<climits>
#include<iomanip>
using namespace std;
#define MOD 1000000007
#define ll long long
const long long INF = 1LL << 60;

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

class UnionFind {
	vector<int> data;
public:
	UnionFind(int size) : data(size, -1) { }
	bool unionSet(int x, int y) {
		x = root(x); y = root(y);
		if (x != y) {
			if (data[y] < data[x]) swap(x, y);
			data[x] += data[y]; data[y] = x;
		}
		return x != y;
	}
	bool findSet(int x, int y) {
		return root(x) == root(y);
	}
	int root(int x) {
		return data[x] < 0 ? x : data[x] = root(data[x]);
	}
	int size(int x) {
		return -data[root(x)];
	}
};

int find(vector<long long> &arr, long long obj) {
	if (arr[arr.size() - 1] < obj)return arr.size()-1;
	if (arr[0] > obj)return -1;

	int min = 0; int max = arr.size() - 1;
	for (int i = 0; i < arr.size(); i++) {
		if (arr[min+(max-min) / 2] > obj) {
			max = min + (max - min) / 2;
		}
		else {
			min = min + (max - min) / 2;
		}
		if (max - min == 1) {
			return min;
		}
	}


}

//約数求める //約数
void divisor(ll n,vector<ll> &ret) {
	for (ll i = 1; i * i <= n; i++) {
		if (n % i == 0) {
			ret.push_back(i);
			if (i * i != n) ret.push_back(n / i);
		}
	}
	sort(ret.begin(), ret.end());
	
}
//階乗
long long factorial(long long n, long long mod) {
	long long ret = 1;
	for (long long i = 1; i <= n; i++) {
		ret = (ret * i) % mod;
	}
	return ret;
}
//モジュラ逆数
long long inv_mod(long long n, long long mod) {
	long long a = n % mod, b = mod - 2, ret = 1;
	while (b > 0) {
		if (b & 1) ret = (ret * a) % mod;
		a = (a * a) % mod;
		b >>= 1;
	}
	return ret;
}

long long nPr(long long n, long long r, long long mod) {
	long long ret = 1;
	for (long long i = n; i >= n - r + 1; i--) {
		ret = ret * (i % mod) % mod;
	}
	return ret;
}

long long nCr(long long n, long long r, long long mod) {
	return nPr(n, r, mod) * inv_mod(factorial(r, mod), mod) % mod;
}

ll gcd(ll m, ll n){
	if (n == 0)return m;
	return gcd(n, m%n);
}//gcd



int main() {
	int a, b, c, d, e, k;
	cin >> a >> b >> c >> d >> e >> k;
	if (e - a > k) {
		cout << ":(";
	}
	else {
		cout << "Yay!";
	}
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define INF 1000000005
#define MOD 1000000007
#define EPS 1e-10
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define all(v) (v).begin(),(v).end()

using namespace std;

typedef pair<int,int>P;

const int MAX_N = 100005;

int a[MAX_N];
int n,t;

int main()
{
	scanf("%d%d",&n,&t);
	rep(i,n){
		scanf("%d",&a[i]);
	}
    sort(a,a+n);
    int np = 0;
    ll res = 1;
    rep(i,n){
        while(np < i){
            if(a[i] - a[np] <= t){
                break;
            }
            np++;
        }
        res = res * (i - np + 1) % MOD;
    }
    cout << res << "\n";
	return 0;
}

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

#define rep(i, n) for (int i = 0; i < n; ++i)
#define ALL(a) (a).begin(), (a).end()
#define rALL(a) (a).rbegin(), (a).rend()
#define SZ(x) ((int)(x).size())
using ll = long long;
using ull = unsigned long long;
using P = pair<int, int>;
using llP = pair<ll, ll>;
using DoP = pair<double, double>;
const int di[] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dj[] = {1, 0, -1, 0, 1, -1, 1, -1};
const int INF = 1 << 30;
const ll INF64 = 1ll << 55;
const int mod = 1000000007;
//const int mod = 998244353;

template <class T>inline bool chmin(T &a, const T b)
{
  if (a > b)
  {
    a = b;
    return true;
  }
  return false;
}
template <class T>inline bool chmax(T &a, const T b)
{
  if (a < b)
  {
    a = b;
    return true;
  }
  return false;
}
template <class T>inline void line_out(const vector<T> vec) {
  int n = SZ(vec);
  rep(i, n) {
    cout << vec[i];
    if(i < n-1) cout << " ";
  }
  cout << endl;
  return;
}

struct mint
{
  ll x; // typedef long long ll;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint &operator+=(const mint a)
  {
    if ((x += a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator-=(const mint a)
  {
    if ((x += mod - a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator*=(const mint a)
  {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const
  {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const
  {
    mint res(*this);
    return res -= a;
  }
  mint &operator++()
  {
    if ((x += 1) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator--()
  {
    if ((x += mod - 1) >= mod)
      x -= mod;
    return *this;
  }
  mint operator*(const mint a) const
  {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll t) const
  {
    if (!t)
      return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1)
      a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const
  {
    return pow(mod - 2);
  }
  mint &operator/=(const mint a)
  {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const
  {
    mint res(*this);
    return res /= a;
  }
};


int main()
{
  string s; cin >> s;
  int n = s.size();
  string t = s;
  reverse(ALL(t));
  if(s == t) {
    string u = s.substr(0, (n-1)/2);
    reverse(ALL(u));
    if(u == s.substr(0, (n-1)/2)) {
      string v = s.substr((n+3)/2-1, (n-1)/2);
      reverse(ALL(v));
      if(v == s.substr((n+3)/2-1, (n-1)/2)) {
        cout << "Yes" << endl;
        return 0;
      }
    }
  }
  cout << "No" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef string str;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector <pii> vpii;
typedef vector <pll> vpll;
typedef map <str,int> mapsi;
typedef map <str,int> :: iterator mapsitr;
typedef map <int , int> mint;
typedef map <ll , ll> mll;
typedef set <int> si;
typedef set <int> :: iterator sitr;
typedef set <ll> :: iterator sltr;
#define mset multiset
typedef mset <int> msi;
typedef mset <ll> msll;
typedef mset <int> :: iterator msitr;
typedef mset <ll> :: iterator msltr;
#define mp make_pair
#define pb push_back
#define pob pop_back
#define fi first
#define se second
#define fs first.second
#define ss second.second
#define ff first.first
#define sf second.first
#define newl '\n'
char to_upper (char x){
    if( 97 <= int(x) && int(x) <= 126)return char(x-32);
    else if( 65 <= int(x) && int(x) <= 90)return x;
}
char to_lower (char x){
    if( 97 <= int(x) && int(x) <= 126)return x;
    else if( 65 <= int(x) && int(x) <= 90)return char(x+32);
}
int numerize (char x){
    if(48 <= int(x) && int(x) <= 57)return int(x-'0');
    else if( 97 <= int(x) && int(x) <= 126)return int(x-96);
    else if( 65 <= int(x) && int(x) <= 90)return int(x-64);
}
void IO(){typedef int MyCustomType;
	#ifndef ONLINE_JUDGE
	    freopen("input.txt", "r", stdin);
	    //freopen("output.txt", "w", stdout);
	#endif
}
// end of Template

int r;
int main(){

	//IO();
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    cin>>r;
    if(r<1200)cout<<"ABC\n";
    else if(r<2800)cout<<"ARC\n";
    else cout<<"AGC\n";


    
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <utility>
#include <cstdio>
#include <vector>
#include <string>
#include <queue>
#include <stack>
#include <cmath>
#include <set>
#include <map>
#define my_abs(x) ((x) < 0 ? -(x) : (x))
#define mp std::make_pair
#define pb push_back
typedef long long ll; 
int arr[2000005], mx[2000005], sec[2000005], mxp[2000005], ans[2000005]; 
int main()
{
	// freopen("ARC100-E.in", "r", stdin); 
	int n; 
	scanf("%d", &n); 
	for (int i = 0; i < 1 << n; i++)
		scanf("%d", arr + i); 
	for (int i = 0; i < 1 << n; i++)
	{
		int x = -1e9, y = -1e9, pos;
		for (int j = 0; j < n; j++)
		{
			if (i & (1 << j))
			{
				if (mx[i ^ (1 << j)] > x)
				{
					x = mx[i ^ (1 << j)]; 
					pos = mxp[i ^ (1 << j)]; 
				}
			}
		}
		for (int j = 0; j < n; j++)
		{
			if (i & (1 << j))
				y = std::max(y, mxp[i ^ (1 << j)] == pos ? sec[i ^ (1 << j)] : mx[i ^ (1 << j)]);
		}
		ans[i] = std::max(ans[i], x + arr[i]); 
		if (arr[i] > x)
		{
			y = x; 
			x = arr[i]; 
			pos = i; 
		}
		else
			y = std::max(y, arr[i]); 
		mx[i] = x;
		mxp[i] = pos; 
		sec[i] = y; 
		// printf("%d %d %d %d\n", i, x, pos, y);
	}
	for (int i = 0; i < 1 << n; i++)
	{
		int x = (1 << n) - 1 ^ i; 
		for (int j = x; j; j = j - 1 & x)
			ans[i | j] = std::max(ans[i | j], arr[i] + (mxp[i | j] == i ? sec[i | j] : mx[i | j])); 
	}
	for (int i = 1; i < 1 << n; i++)
	{
		ans[i] = std::max(ans[i], ans[i - 1]); 
		printf("%d\n", ans[i]);
	}
	return 0; 
}


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

using namespace std;
#define all(x) x.begin(),x.end()
#define pb(x) emplace_back(x)
#define forn(i,N) for(int i=0;i<N;i++)
using namespace std;
using ll=long long int;
using ld=long double;

int cnt=0;
vector<vector<int>> g;
vector<int> parent;

void bfs() {
    queue<int> q;
    q.push(0);
    parent[0]=0;
    while(!q.empty()) {
        int u=q.front();
        q.pop();
        cnt++;
        for(auto& x: g[u]) {
            if(parent[x]==-1) {
                q.push(x);
                parent[x]=u+1;
            }
        }
    }
}

int main() {
//freopen("input.txt","rt",stdin);
ios::sync_with_stdio(false);
cin.tie(nullptr);

int N,M;
cin>>N>>M;
g.assign(N,vector<int>());
parent.assign(N,-1);
forn(i,M) {
    int u,v;
    cin>>u>>v;
    u--,v--;
    g[u].pb(v);
    g[v].pb(u);
}
bfs();
if(cnt!=N)
    cout<<"No"<<endl;
else {
    cout<<"Yes"<<endl;
    for(int i=1;i<N;i++)
        cout<<parent[i]<<endl;
}
return 0;
}


Measured memory_bytes: 10136
#include <iostream>
#include <algorithm>
using namespace std;
int a[200005];
int main(int argc, char** argv) {
	int n;
	cin >> n;
	for(int i=1;i<=n;i++)
		cin >>a[i];
	sort(a+1,a+n+1);
	for(int i=2;i<=n;i++)
	{
		if(a[i]==a[i-1])
		{
			puts("NO");
			return 0;
		}
	}
	puts("YES");
	return 0;
}

Measured memory_bytes: 1024
from itertools import combinations_with_replacement

N,M,Q=map(int,input().split())
abcd = []
for i in range(Q):
    x=list(map(int,input().split()))
    abcd.append(x)
ans,cnt=0,0
aa = [i for i in range(1,M+1)]
aa = list(combinations_with_replacement(aa,N))
for x in aa:
    x = list(x)
    for i in range(Q):
        ai,bi,ci,di = abcd[i][0]-1,abcd[i][1]-1,abcd[i][2],abcd[i][3]
        if int(x[bi]) - int(x[ai]) == int(ci):
           cnt+=di
    if cnt>=ans:
        ans = cnt
        cnt=0
    else:
        cnt=0
print(ans)

Measured memory_bytes: 84856
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using V = vector<int>;
using VV = vector<vector<int>>;
using VVV = vector<vector<vector<int>>>;
using VL = vector<ll>;
using VVL = vector<vector<ll>>;
using VVVL = vector<vector<vector<ll>>>;
using pq = priority_queue<int>;
template<class T>
using P = pair<T, T>;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define REP(i,k,n) for(int i=(k);i<(n);i++)
#define all(a) (a).begin(),(a).end()
#define output(x,y) cout << fixed << setprecision(y) << x << endl;
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; }
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; }
int under = (1 << 31);
int upper = under - 1;
ll UNDER = (1LL << 63);
ll UPPER = UNDER - 1;
const int MOD = 1e9 + 7;
const long double pi = 3.141592653589793;
int main(){
	int n;
	cin >> n;
	cout << lcm(max(2, n), min(2, n)) << 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))
using ll = long long;
using P = pair< int, int >;

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

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

int main() {
    int n;
    cin >> n;
    ll ans = 1LL;
    rep(i, n) {
        ll t;
        cin >> t;
        ans = lcm(ans, t);
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#define ll long long
#define ull unsigned long long
#define pb push_back
#define pf push_front
#define mp make_pair
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int isprime(int n){
    int count =0;
    for(int i=2;i<=sqrt(n);i++)
    if(n%i==0)count++;
    if(count)return 0;
    return 1;
}
void dfs(vector<int>adj[],int u,int visited[]) {
       visited[u] = 1;
       for (int i = 0; i < adj[u].size(); i++) {
       int v = adj[u][i];
       if (!visited[v]) 
       dfs(adj,v,visited);
      }
      
      }
void addedge(vector<int>adj[],int a,int b){
    adj[a].pb(b);
    adj[b].pb(a);
}
int main()
{
    int r,g,b,k;
    cin>>r>>g>>b>>k;
    while(g<=r){
        g=g*2;
        k--;
    }
  b = b*pow(2,k);
  if(b>g&&g>r)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
    return 0;
}




Measured memory_bytes: 4060
using System;
using System.Collections.Generic;
using System.Linq;

namespace AtCoderCs
{
    class Program
    {
        static void Main()
        {

            var @int = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
            Console.WriteLine(
                (@int[0] + @int[1] == @int[2] || @int[1] + @int[2] == @int[0] || @int[2] + @int[0] == @int[1]) ?
                "Yes" : "No");

        }


    }
}


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

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

    ll sum=0;
    for(int i = 0; i < n; i++) {
        ll x=0;
        for(int j = 1; j < b[i]; j++) {
            x += j;
        }
        sum+=x;
    }

    for(int i = 0; i < n; i++) {
        ll ans=sum-b[a[i]-1]+1;
        cout << ans << endl;
    }

    return 0;
}

Measured memory_bytes: 4776
use whiteread::parse_line;

fn main() {
    let n: usize = parse_line().unwrap();
    let a: Vec<usize> = parse_line().unwrap();
    let mut h = a[0] - 1;
    let mut ans = "Yes";

    for i in 1..n {
        if a[i] > h {
            h = a[i] - 1;
        } else if a[i] < h {
            ans = "No";
            break;
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 4080