akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;

#define make_it_fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

#define mp make_pair
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define ll long long
#define ld long double
#define endl "\n"
#define ff first
#define ss second
#define imn INT_MIN
#define imx INT_MAX

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}

template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}

void _print() {cerr << "]\n";}

template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}

#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...) 20
#endif

ll power(ll a,ll b,ll m=1e9+7)
{
    a%=m;
    if(b==1)
    return a;
    if(b==0)
    return 1;
    ll ret=power(a,b/2);
    ret=(ret%m*ret%m)%m;
    if(b&1)
    ret=(ret%m*a%m)%m;
    return ret;
}

ll lcm(ll a,ll b)
{
    return (a*b)/(__gcd(a,b));
}

void solve()
{
    ll n,i,m=1e9+7;
    cin>>n;
    ll a[n];
    for(i=0;i<n;i++)
    cin>>a[i];
    ll sum[n];
    sum[0]=a[0];
    for(i=1;i<n;i++)
    {
        sum[i]=(sum[i-1]+a[i])%m;
    }
    ll ans=0;
    for(i=0;i<n-1;i++)
    {
        ll z=(a[i]*(sum[n-1]-sum[i]+m)%m)%m;
        ans=(ans+z)%m;
    }
    cout<<ans<<endl;
}

int main()
{
    int TEST_CASES=1;
    // cin>>TEST_CASES;
    while(TEST_CASES--)
    {
        solve();
    }
    return 0;
}


Measured memory_bytes: 6768
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		String[] C = new String[N];
		for(int i=0; i<N; i++) {
			C[i] = scan.next();
		}
		scan.close();
		String[] bubbleSortedC = C.clone();
		String[] SelectionSortedC = C.clone();

		BubbleSort(bubbleSortedC, N);
		SelectionSort(SelectionSortedC, N);

		trace(bubbleSortedC);
		System.out.println("Stable");	//バブルソートは安定
		trace(SelectionSortedC);

		for(int i=0; i<C.length; i++) {
			if(bubbleSortedC[i] == SelectionSortedC[i]) {
				continue;
			} else {
				//バブルソートと異なるので安定でない
				System.out.println("Not stable");
				return;
			}
		}
		System.out.println("Stable");	//バブルソートと一致したので安定

	}

	private static void SelectionSort(String[] C, int N) {
		for(int i=0; i<N; i++) {
			int minj = i;
			for(int j=i; j<N; j++) {

				if(Integer.parseInt(C[j].substring(1)) < Integer.parseInt(C[minj].substring(1))) {
					minj = j;
				}
			}
			String t = C[i];
			C[i] = C[minj];
			C[minj] = t;
		}
	}

	private static void BubbleSort(String[] C, int N) {
		for(int i=0; i<N; i++) {
			for(int j=N-1; j>i; j--) {
				if(Integer.parseInt(C[j].substring(1)) < Integer.parseInt(C[j-1].substring(1))) {
					String t = C[j];
					C[j] = C[j-1];
					C[j-1] = t;
				}

			}
		}
	}

	private static void trace(String[] C) {
		for(int i=0; i<C.length; i++) {
			if(i != 0) {
				System.out.print(" ");
			}
			System.out.print(C[i]);
		}
		System.out.println();
	}
}



Measured memory_bytes: 26628
import java.util.Scanner;

public class Main {

	static class Point{
		double x;
		double y;
		
		public Point(double x, double y) {
			this.x = x;
			this.y = y;
		}
		
		public String toString(){
			return x + " " + y;
		}
	}
	
	static int n;
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		n = scan.nextInt();
		Point start = new Point(0.0, 0.0);
		Point end = new Point(100.0, 0.0);
		System.out.println(start);
		make(start, end, 0);
		System.out.println(end);
		scan.close();
	}
	
	public static void make(Point start, Point end, int i) {
		if (n <= i) {
			return;
		}

		Point s = new Point((2.0 * start.x + 1.0 * end.x) / 3.0, (2.0 * start.y + 1.0 * end.y) / 3.0);
		Point t = new Point((1.0 * start.x + 2.0 * end.x) / 3.0, (1.0 * start.y + 2.0 * end.y) / 3.0);
		
		double ux = (t.x - s.x) * Math.cos(Math.toRadians(60)) - (t.y - s.y)*Math.sin(Math.toRadians(60)) + s.x;
		double uy = (t.x - s.x) * Math.sin(Math.toRadians(60)) + (t.y - s.y)*Math.cos(Math.toRadians(60)) + s.y;
		Point u = new Point(ux, uy);
		
		
		make(start, s, i + 1);
		System.out.println(s);
		make(s, u, i + 1);
		System.out.println(u);
		make(u, t, i + 1);
		System.out.println(t);
		make(t, end, i + 1);
	}

	
	
	
}

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

int main()
{

  string S;

  cin >> S;

  long N = S.length() + 1;

  vector<long> a(N, 0);

  for (long i = 0; i < N - 1; i++)
  {
    if (S.at(i) == '<')
    {
      a.at(i + 1) = max(a.at(i + 1), a.at(i) + 1);
    }
  }

  for (long i = N - 2; i >= 0; i--)
  {
    if (S.at(i) == '>')
    {
      a.at(i) = max(a.at(i), a.at(i + 1) + 1);
    }
  }

  long sum = 0;

  for (long i = 0; i < N; i++)
  {
    sum += a.at(i);
  }

  cout << sum << endl;
}


Measured memory_bytes: 4740
#include <bits/stdc++.h>
#define exrep(i, a, b) for(long long i = a; i <= b; i++)
#define rep(i,n)for(long long i=0;i<(long long)(n);i++)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
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 MOD=1e9+7;
const ll INF=1e18;
const int MAX=510000;
const double pi=acos(-1);
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
ll modpow(ll a, ll n){
  if(n==0)return 1;
  if(n%2==0){
    ll t=modpow(a,n/2);
    return t*t%MOD;
  }
  return a*modpow(a,n-1)%MOD;
}
ll modinv(ll a){
  return modpow(a,MOD-2);
}
long long fac[MAX], finv[MAX], inv[MAX];
 
// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
 
// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
struct UnionFind {
    vector<int> par; // 親ノード
    vector<int> rank; // ランク
 
    UnionFind(int n = 1) {
        init(n);
    }
 
    void init(int n = 1) {
        par.resize(n); rank.resize(n);
        for (int i = 0; i < n; ++i) par[i] = i, rank[i] = 0;
    }
 
    int root(int x) {
        if (par[x] == x) {
            return x;
        }
        else {
            int r = root(par[x]);
            return par[x] = r;
        }
    }
 
    bool issame(int x, int y) {
        return root(x) == root(y);
    }
 
    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (rank[x] < rank[y]) swap(x, y);
        if (rank[x] == rank[y]) ++rank[x];
        par[y] = x;
        return true;
    }
};

    
  
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false); 
  COMinit();
  
  int n;
  cin >> n;
  vector<ll> a(n+1),b(n);
  rep(i,n+1) cin >> a[i];
  rep(i,n) cin >> b[i];
  ll cnt=0;
  rep(i,n){
    if(a[i]>=b[i]){
      cnt+=b[i];
      a[i]-=b[i];
    }
    else{
      cnt+=a[i];
      b[i]-=a[i];
      if(a[i+1]>=b[i]){
        cnt+=b[i];
        a[i+1]-=b[i];
      }
      else{
        cnt+=a[i+1];
        a[i+1]=0;
      }
    }
  }
  cout << cnt << endl;
}


Measured memory_bytes: 13824
#include <bits/stdc++.h>
#define rep(i, n) for(ll i = 0; i < n; i++)
#define repr(i, n) for(ll i = n; i >= 0; i--)
#define reprr(i, m, n) for (ll i = m; i < n; i++)
#define inf 2e9
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;


int main()
{
    ll n, x, y; cin >> n >> x >> y; x--, y--;
    vll v(n, 0);

    rep(i, n-1) {
        reprr(j, i + 1, n) {
            ll m = min(j - i, min(abs(x - i) + 1 + abs(j - y), abs(y - i) + 1 + abs(j - x)));
            v[m]++;
        }
    }

    reprr(k, 1, n) {
        cout << v[k] << endl;
    }

    return 0;
}

Measured memory_bytes: 256
loop do
    n, d = gets.split.map(&:to_i)
    break if n == 0 && d == 0
    m = Array.new(n)
    sum = Array.new(n,0)
    n.times do |i|
        _, *m[i] = gets.split.map(&:to_i)
        sum[i] = m[i].inject(:+)
        sum[i] = 0 if !sum[i]
    end
    loop do
        e = false
        n.times do |i|
            while m[i].size > 0
                sum[i] -= m[i][-1]
                max = sum.max
                if max - sum[i] <= d
                    m[i].pop
                    e = true
                else
                    sum[i] += m[i][-1]
                    break
                end
            end
        end
        break if !e
    end
    puts m.all?{|s| s.size == 0} ? "Yes" : "No"
end

Measured memory_bytes: 6184
/*
Koch Curve(https://onlinejudge.u-aizu.ac.jp/#/problems/ALDS1_5_C)
右
*/

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <complex>
using namespace std;

#define Rep(b, e, i) for(int i = b; i <= e; i++)
#define Repr(e, b, i) for(int i = e; i >= b; i--)
#define rep(n, i) Rep(0, n-1, i)
#define repr(n, i) Repr(n-1, 0, i)
#define all(v) (v).begin(), (v).end()
#define pb(v) push_back(v)

//複素数で処理
typedef complex<double> P;

const double L = 100.0;
const double PI = 3.14159265358979323846;


//答えを格納するvector
vector <P> ans;

int N;

//再帰関数(引数に左端、右端、残りの再帰回数を渡す)
//それ以上分岐しなくなったら左端の点を返す（こうすることで点がダブらず、かつ順番になる）
void rec(P lp, P rp, int n) {
    if (n == 0) {
        ans.pb(lp);
        return;
    }
    //aはπ/3だけ回転させる複素数
    //u,s,tは問題文のものに対応
    P s, t, u, a;
    s = lp + (rp - lp) / 3.;
    t = lp + (rp - lp) * 2. / 3.;
    a = polar(abs(rp-lp)/3, arg(rp-lp) + PI/3.);
    u = s + a;
    rec(lp, s, n-1);
    rec(s, u, n-1);
    rec(u, t, n-1);
    rec(t, rp, n-1);
}

void solve(void){
    cin >> N;

    P p1(0., 0.);
    P p2(L, 0.);

    rec(p1, p2, N);

    //右端の点は格納されないので最後に追加
    ans.pb(p2);

    for (auto p : ans) {
        printf("%.6lf %.6lf\n", p.real(), p.imag());
    }

}

int main(void){
  solve();
  //cout << "yui(*-v・)yui" << endl;
  return 0;
}



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

using namespace std;

int main(void){
    char pass[4];
    for(int i=0;i<4;i++){
        cin>>pass[i];
    }
    int count=0;
    for(int i=0;i<3;i++){
        if(pass[i]==pass[i+1]) count++;
    }
    if(count>0) cout<<"Bad"<<endl;
    else cout<<"Good"<<endl;
    return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define rep(i,s,n) for(int i = s; i < n; i++)
const int maxn = 3005;
string s,t;
int d[maxn][maxn];
stack<char> st;
int dp(int a, int b){
	if(d[a][b]!=-1)return d[a][b];
	if(a==0||b==0)return d[a][b] = 0;
	int ans = -1;
	ans = max(ans, dp(a-1, b));
	ans = max(ans, dp(a,b-1));
	int flag = s[a-1]==t[b-1] ? 1 : 0;
	ans = max(ans, dp(a-1, b-1)+flag);
	return d[a][b] = ans;
}

void dp2(int a, int b){
	if(a==0||b==0)return;
	int cur = d[a][b];
	if(cur==d[a-1][b])return dp2(a-1,b);
	else if(cur==d[a][b-1])return dp2(a,b-1);
	else if(cur==d[a-1][b-1])return dp2(a-1,b-1);
	else if(cur==d[a-1][b-1]+1){
		st.push(s[a-1]);
		return dp2(a-1,b-1);
	}
}

int main(){
	cin>>s>>t;
	memset(d,-1,sizeof d);
	dp(s.size(), t.size());
	dp2(s.size(), t.size());
	// cout<<d[s.size()][t.size()]<<endl;
	while(!st.empty()){ printf("%c", st.top());st.pop();}
	cout<<endl;
}

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

int intpow(int x,int y){
  double a=x,b=y;
  return pow(a,b);
}//(x,y) xをy乗する

int intfabs(int x){
  double a=x;
  return fabs(a);
}//(x) の絶対値

int in(){
  int a;
  cin >> a;
  return a;
}//int型関数の受け取り

void forin(int* x,int y){
  for (int i=0;i<y;i++){
    cin >> x[i];
  }
}//配列の受け取り

int btc(double u){
  return u*380000;
}

main(){
  int n=in();
  double ans=0,u;
  string x;
  for (int i=0;i<n;i++){
    cin >> u >> x;
    if (x=="JPY") ans+=u;
    else ans+=u*380000;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <cmath>
#include <set>
#include <unordered_set>


using namespace std;


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

    int d=0;
    for(int i=0; i<N+1; i++){
        d+=L[i];
        if(d>X){
            cout<<i+1<<endl;
            return 0;
        }
    }
    cout<<N+1<<endl;
    return 0;
}

Measured memory_bytes: 256
n=int(input())
ab=[list(map(int,input().split())) for i in range(n)]
ab.sort(key=lambda x:x[1])
#print(ab)
time=0
for a,b in ab:
    temp=time+a
    if temp<=b:
        time=temp
    else:
        print('No')
        exit()
print('Yes')

Measured memory_bytes: 53600
import java.util.*;

class Main {
	public static void main (String[] args) {
    	Scanner sc = new Scanner(System.in);
      	int L = sc.nextInt();
      	int R = sc.nextInt();
      	int d = sc.nextInt();
      
      	System.out.println(R / d - (L - 1) / d);
    }
}

Measured memory_bytes: 35588
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vin=vector<int>;
using vll=vector<long long>;
using vstr=vector<string>;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,s,n) for(int i=(s);i<(int)(n);i++)
#define _GLIBCXX_DEBUG
int main()
{
    long double n;
    cin>>n;
    vector<long double> a(n);
    rep(i,n)cin>>a[i];
    vector<long double> rec(n);
    rep(i,n)rec[i]=1/a[i];
    long double sum=0;
    rep(i,n)sum+=rec[i];
    cout<<1/sum<<endl;
}

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

namespace TYC
{
	typedef long long ll;

	const int N = 1 << 16 | 5, mod = 1e9 + 7;

	int n, m, A[25], F[17][N], Fac[N], Inv[N], Cnt[N];

	int inv(const int x) { return x == 1 ? x : int((ll)inv(mod % x) * (mod - mod / x) % mod); }

	inline int C(const int x, const int y)
	{ return x < y ? 0 : int((ll)Fac[x] * Inv[y] % mod * Inv[x - y] % mod); }

	void work()
	{
		scanf("%d%d", &n, &m);
		for (int i = 1; i <= m; i++)
			scanf("%d", &A[i]);
		sort(A + 1, A + 1 + m, greater<int>());
		int tot = 1 << n;
		Fac[0] = 1;
		for (int i = 1; i <= tot; i++)
			Fac[i] = int((ll)Fac[i - 1] * i % mod);
		Inv[tot] = inv(Fac[tot]);
		for (int i = tot; i; i--)
			Inv[i - 1] = int((ll)Inv[i] * i % mod);
		F[0][0] = 1;
		for (int i = 1; i <= m; i++)
			for (int s = 0; s < tot; s++)
			{
				F[i][s] = F[i - 1][s];
				for (int k = 0; k < n; k++)
					if (s & (1 << k))
					{
						int c = 1 << k, t = s ^ (1 << k);
						F[i][s] = int((F[i][s] + (ll)F[i - 1][t] * Fac[c] % mod * C(tot - A[i] - t, c - 1)) % mod);
					}
			}
		int ans = 0;
		for (int s = 0; s < tot; s++)
		{
			Cnt[s] = Cnt[s >> 1] + (s & 1);
			ans = int((ans + (ll)(Cnt[s] & 1 ? -1 : 1) * F[m][s] * Fac[tot - s - 1] % mod + mod) % mod);
		}
		printf("%d\n", int((ll)ans * tot % mod));
	}
}

int main()
{
	TYC::work();
	return 0;
}

Measured memory_bytes: 5120
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cassert>
#include <cstdint>
#include <numeric>
#include <bitset>
#include <functional>

using namespace std;

using ll =  long long;
using Pll = pair<ll, ll>;
using Pii = pair<int, int>;

constexpr ll MOD = 1000000007;
constexpr long double EPS = 1e-10;
constexpr int dyx[4][2] = {
    { 0, 1}, {-1, 0}, {0,-1}, {1, 0}
};
constexpr int N_MAX = 100000;

class UnionFind {
    public:
    int n;
    vector<int> par, rank, size;  //親, 深さ, その木の要素数

    UnionFind(int n): n(n) {
        for(int i=0;i<n;++i){
            par.push_back(i);
            rank.push_back(0);
            size.push_back(1);
        }
    }

    //根を求める
    int find(int x){
        if(par[x] == x){
            return x;
        }else{
            int p = find(par[x]);
            size[x] = size[p];
            return par[x] = p;
        }
    }

    //xとyの属する集合の併合
    void unite(int x, int y){
        x = find(x);
        y = find(y);
        if(x == y) return;
        
        size[x] += size[y];
        size[y] = size[x];
        if(rank[x] < rank[y]){
            par[x] = y;
        }else{
            par[y] = x;
            if(rank[x] == rank[y]) rank[x]++;
        }
    }

    //同じ集合に属するか否か
    bool is_same(int x, int y){
        return find(x) == find(y);
    }
};

int main() {
    int n;
    cin >> n;
    vector<Pii> points(n);
    map<int, vector<int>> mpx, mpy;
    UnionFind uf = UnionFind(n);
    for(int i=0;i<n;++i) {
        cin >> points[i].first >> points[i].second;
        mpx[points[i].first].push_back(i);
        mpy[points[i].second].push_back(i);
    }

    for(auto itr=mpx.begin();itr!=mpx.end();++itr) {
        vector<int> v = itr->second;
        for(int i=0;i<v.size()-1;++i) {
            uf.unite(v[i], v[i+1]);
        }
    }
    for(auto itr=mpy.begin();itr!=mpy.end();++itr) {
        vector<int> v = itr->second;
        for(int i=0;i<v.size()-1;++i) {
            uf.unite(v[i], v[i+1]);
        }
    }

    map<int, int> cnt;
    map<int, set<int>> gx, gy;
    for(int i=0;i<n;++i) {
        int g = uf.find(i);
        ++cnt[g];
        gx[g].insert(points[i].first);
        gy[g].insert(points[i].second);
    }

    ll ans = 0LL;
    for(int g=0;g<n;++g) {
        if(!cnt[g]) continue;
        ans += gx[g].size() * gy[g].size() - cnt[g];
    }
    cout << ans << endl;
}

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

 static class Reader{ 
        BufferedReader br; 
        StringTokenizer st; 
  
        public Reader(){ 
            br = new BufferedReader(new InputStreamReader(System.in)); 
        } 
       
        String next(){ 
            while (st == null || !st.hasMoreElements()){ 
                try{ 
                    st = new StringTokenizer(br.readLine()); 
                } 
                catch (IOException  e){ 
                    e.printStackTrace(); 
                } 
            } 
            return st.nextToken(); 
        } 
  
        int nextInt(){ 
            return Integer.parseInt(next()); 
        } 
  
        long nextLong(){ 
            return Long.parseLong(next()); 
        } 
  
        double nextDouble(){ 
            return Double.parseDouble(next()); 
        } 
        
        String nextLine(){ 
            String str = ""; 
            try{ 
                str = br.readLine(); 
            } 
            catch (IOException e) { 
                e.printStackTrace(); 
            } 
            return str; 
        } 
    } 


  static int gcd(int a,int b){
      if(b==0)return a;
      return gcd(b,a%b);
  }
  static int f(int n){
      return (180*(n-2))/n;
  }
    public static void main(final String [] args)throws IOException{
       Reader sc=new Reader();
       int n=sc.nextInt();
       int lcm=(360*n)/gcd(360,n);
       int ans=lcm/n;
       System.out.println(ans);

      

    }
}




Measured memory_bytes: 32696
#include <iostream>
#include <algorithm>
#include <climits>
#include <numeric>
#include <iomanip>
#include <cmath>
#include <vector>
#include <set>
#include <unordered_set>
#include <string>
#include <numeric>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <unordered_map>

#define barsik ios::sync_with_stdio(false)
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)

typedef long long ll;
typedef std::vector<int> vi;
typedef std::pair <int, int> pii;
typedef std::unordered_set <int> u_si;

using namespace std;

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

void solve(){
    ll n, x;
    cin >> n >> x;
    ll a;
    cin >> a;
    ll ans = abs(x - a);
    for(int i = 1; i < n; i++){
        cin >> a;
        ans = gcd(abs(a - x), ans);
    }
    cout << ans;
}

int main(){
    barsik;
    int q = 1;
    //cin >> q;
    while(q--) solve();
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fast_cin ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

int main()
{
    fast_cin;
    #ifndef ONLINE_JUDGE
    // for getting input from input.txt
    freopen("input.txt", "r", stdin);
    // for writing output to output.txt
    freopen("output.txt", "w", stdout);
    #endif

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

    ll p1=a*c;
    ll p2=a*d;
    ll p3=b*c;
    ll p4=b*d;

    ll ans=max(p4,max(p3,max(p1,p2)));
    cout<<ans<<"\n";

}


Measured memory_bytes: 3648
def gcd(a,b):
	if b==0:
		return a
	return gcd(b,a%b)
n= int(raw_input())
a=[]
g=0
h=1
for i in range(n):
	x=int(raw_input())
	a.append(x)
h=a[0]
for i in a:
	
	h=(h*i)/gcd(h,i)
print h

Measured memory_bytes: 2568
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

public class Program
{
    public static void Main(string[] args)
    {
        new Program().Solve(new ConsoleInput(Console.In, ' '));
    }

    public void Solve(ConsoleInput cin)
    {
        var n = cin.ReadInt;
        if (n == Math.Floor(Math.Floor(n / 1.08d) * 1.08d) || n == Math.Floor(Math.Ceiling(n / 1.08d) * 1.08d))
        {
            WriteLine(Math.Ceiling(n / 1.08d));
        }
        else
        {
            WriteLine(":(");
        }
        ReadKey();
    }
}

public class ConsoleInput
{
    private readonly System.IO.TextReader _stream;
    private char _separator = ' ';
    private Queue<string> inputStream;
    public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
    {
        this._separator = separator;
        this._stream = stream;
        inputStream = new Queue<string>();
    }
    public string Read
    {
        get
        {
            if (inputStream.Count != 0) return inputStream.Dequeue();
            string[] tmp = _stream.ReadLine().Split(_separator);
            for (int i = 0; i < tmp.Length; ++i)
                inputStream.Enqueue(tmp[i]);
            return inputStream.Dequeue();
        }
    }
    public string ReadLine { get { return _stream.ReadLine(); } }
    public int ReadInt { get { return int.Parse(Read); } }
    public long ReadLong { get { return long.Parse(Read); } }
    public double ReadDouble { get { return double.Parse(Read); } }
    public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
    public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
    public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
}


Measured memory_bytes: 13268
/* Author : bhavye9499 - Bhavye Anand Gupta */

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

typedef long long ll;
typedef long double ld;

#define endl "\n"
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define pii pair<ll,ll>
#define showArr(A,a,n) {for(int i=a; i<a+n; i++) cout << A[i] << " "; cout << endl;}
#define showPair(A,a,n) {for(int i=a; i<a+n; i++) cout << A[i].fi << " " << A[i].se << endl;}

const ll MOD = 1e9 + 7;

ll n, m, dp[100100];
vector<ll> Adj[100100];

ll fun(ll i);

int main() {
    ios::sync_with_stdio(false);
    memset(dp, -1, sizeof(dp));
    for(int i = 0; i < 100100; i++) {
    	Adj[i].clear();
    }

    cin >> n >> m;
    for(int i = 0; i < m; i++) {
    	ll a, b;
    	cin >> a >> b;
    	Adj[a].pb(b);
    }

    ll ans = -1;
    for(int i = 1; i < n + 1; i++) {
    	ans = max(ans, fun(i));
    }

    cout << ans << endl;
}

ll fun(ll i) {
	if(dp[i] != -1)
		return dp[i];
	ll ans = 0;
	ll sz = Adj[i].size();
	for(int j = 0; j < sz; j++) {
		ans = max(ans, 1 + fun(Adj[i][j]));
	}
	return dp[i] = ans;
}

Measured memory_bytes: 8576
pub fn main() {
    let (r1, c1, r2, c2): (i64, i64, i64, i64) = {
        let mut buf = String::new();
        std::io::stdin().read_line(&mut buf).unwrap();
        let words: Vec<i64> = buf.split_whitespace().map(|w| w.parse().unwrap()).collect();
        (words[0], words[1], words[2], words[3])
    };
    let p: i64 = 1_000_000_007;
    fn inverse(x: i64, p: i64) -> i64 {
        if x == 1 {
            1
        } else {
            let q = p / x;
            let y = p % x;
            q * (p - inverse(y, p)) % p
        }
    }
    fn binom(m: i64, n: i64, p: i64) -> i64 {
        let (m, n) = if m < n { (m, n) } else { (n, m) };
        let mut c = 1;
        for i in 0..m {
            c = c * (n + m - i) % p;
            c = c * inverse(m - i, p) % p;
        }
        c
    }
    let mut ans = binom(r2 + 1, c2 + 1, p);
    ans = (ans - binom(r2 + 1, c1, p) + p) % p;
    ans = (ans - binom(r1, c2 + 1, p) + p) % p;
    ans = (ans + binom(r1, c1, p)) % p;
    println!("{}", ans);
}

Measured memory_bytes: 4352
#include <iostream>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <functional>

using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> P;
typedef vector<P> vpl;
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(ll i=(a); i<(b); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const int inf = 1<<30;
const ll linf = 1LL<<62;
const int mod = 1e9+7;
const int MAX = 510000;
const int V = 100005;
ll dy[8] = {1,0,-1,0,1,-1,1,-1};
ll dx[8] = {0,1,0,-1,1,-1,-1,1};
const double pi = acos(-1);
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
template<typename T1,typename T2> inline void print2(T1 a, T2 b){cout << a << " " << b << endl;}
#define INT_MAX 1e9+7

int main(){
    ll n; cin >> n;
    vvl G(n);
    map<P,ll> mp;
    rep(i,n-1){
        ll a,b; cin >> a >> b; a--; b--;
        G[a].push_back(b);
        G[b].push_back(a);
        mp[P(a,b)] = i;
        mp[P(b,a)] = i;
    }
    queue<ll> q;
    q.push(0);
    vl ans(n-1);
    vector<bool> visit(n,false);
    ll mxcolor = 1;
    while(!q.empty()){
        ll u = q.front(); q.pop();
        visit[u] = true;
        ll color = 1;
        set<ll> se;
        for(auto v : G[u]){
            if(visit[v]){
                se.insert(ans[mp[P(u,v)]]);
            }
        }
        for(auto v : G[u]){
            if(visit[v]) continue;
            while(se.find(color) != se.end()) color++;
            ans[mp[P(u,v)]] = color;
            color++;
            q.push(v);
        }
        se.clear();
        chmax(mxcolor,color-1);
    }
    cout << mxcolor << endl;
    for(auto i : ans) cout << i << endl;
}

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

#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,n) for(int i=1;i<=(n);++i)
#define repr(i,n) for(int i=(n);i>=0;--i)
#define int long long
#define itn int
#define pb push_back
#define m_p make_pair
#define m_t meke_tuple
#define p_p(a,b) pb(m_p(a,b))
#define all(a) a.begin(),a.end()
#define SORT(a) sort(all(a))
#define RSORT(a) sort(all(a));reverse(all(a))
#define UNIQUE(a) a.erase(unique(all(a)),a.end())
#define debg(a) cout<<#a<<" "<<a<<endl;
#define call(a) for(auto i:a)cout<<i<<" ";cout<<endl
#define out(a) cout<<(a)<<endl
#define fi first
#define se second
#define Vec vector
#define P pair
typedef long long ll;
typedef string str;
typedef vector<ll> V;
typedef pair<ll,ll> Pi;
typedef vector<Pi> VP;
const long long INF = 1LL<<60;
const long long MOD = 1e9+7;
int gcd(int a,int b){if(b==0)return a;return gcd(b,a%b);}
int lcm(int a,int b){return a/gcd(a,b)*b;}
int max(int a,int b){if(a>b)return a; return b;}
int min(int a,int b){if(a>b)return b; return a;}
void Yes(){cout<<"Yes"<<endl;}
void No(){cout<<"No"<<endl;}
void YN(bool b){cout<<(b?"Yes":"No")<<endl;}
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(a>b){a=b;return true;}return false;}

signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  str s;
  cin>>s;
  int cnt1=0,cnt2=0;
  str a="",b="";
  rep(i,s.length()){
    if(i%2==0)a+='0',b+='1';
    else a+='1',b+='0';
  }
  rep(i,s.length()){
    if(s[i]!=a[i])cnt1++;
    if(s[i]!=b[i])cnt2++;
  }
  out(min(cnt1,cnt2));


  
  
  return 0;
}



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


int n;
int dst[100][100];

void wf(){
	for(int k=0; k<n; k++){
		for(int i=0; i<n; i++){
			for(int j=0; j<n; j++){
				if(dst[i][k]+dst[k][j] < dst[i][j]){
					dst[i][j] = dst[i][k]+dst[k][j];
				}
			}

		}
	}
}

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

	for(int i=0; i<n; i++){
		for(int j=0; j<n; j++){
			dst[i][j] = 1001001001;
		}
	}

	for(int i=0; i<m; i++){
		int a, b, c, d;
		scanf("%d,%d,%d,%d", &a, &b, &c, &d);
		dst[a-1][b-1] = c;
		dst[b-1][a-1] = d;
	}
	int x1, x2, y1, y2;
	scanf("%d,%d,%d,%d", &x1, &x2, &y1, &y2);

	wf();
	cout << y1 - y2 - (dst[x1-1][x2-1]+dst[x2-1][x1-1]) << endl;
	return 0;
}

Measured memory_bytes: 1252
H, W = map(int, input().split())
A = [0] * H
for i in range(H):
    A[i] = list(map(int, input().split()))

# print(A)

ops_list = []

for h in range(H):
    for w in range(W):
        # print(A[h][w])
        if A[h][w] % 2 == 0:
            continue
        if w+1 < W and A[h][w+1] % 2 == 1:
            A[h][w] -= 1
            A[h][w + 1] += 1
            ops_list.append([h+1, w+1, h+1, w+2])

        elif h+1 < H and A[h+1][w] % 2 == 1:
            A[h][w] -= 1
            A[h+1][w] += 1
            ops_list.append([h+1, w+1, h+2, w+1])

        elif w+1 < W:
            A[h][w] -= 1
            A[h][w + 1] += 1
            ops_list.append([h+1, w+1, h+1, w+2])

        elif h+1 < H:
            A[h][w] -= 1
            A[h+1][w] += 1
            ops_list.append([h+1, w+1, h+2, w+1])
print(len(ops_list))
for ops in ops_list:
    print(*ops)

Measured memory_bytes: 69596
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++) 
#define ALL(n) begin(n),end(n)
using ULL=unsigned long long;
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
int main()
{
    string A, B;
    cin >> A >> B;
    cout << ( A == B ? "EQUAL" : A > B && A.size() >= B.size() ? "GREATER" : "LESS" ) << endl;
    return 0;
}

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

int main()
{
  string S, T;
  cin >> S >> T;
  int N = S.size(), ans = 0;
  for (int i = 0; i < N; i++)
  {
    if (S[i] != T[i])
      ans++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 3920
#include <bits/stdc++.h>
#define FOR(I,X,Y) for(int (I)=(X);(I)<(Y);(I)++)
#define REP(I,X,Y) for(int (I)=(Y)-1;(I)>=(X);(I)--)
#define ALL(X) (X).begin(),(X).end()
#define INF 1000000007
#define LINF 1000000000000000007
typedef long long ll;
using namespace std;

int GCD(ll x,ll y){
  if(x == y)return x;
  if(x < y)swap(x,y);
  ll r = x%y;
  if(r)return GCD(y,r);
  else return y;
}

int main(){
  ll N,X;
  cin >> N >> X;
  ll x[N];
  FOR(i,0,N)cin >> x[i];
  FOR(i,0,N)x[i] = abs(X - x[i]);
  ll ans = x[0];
  FOR(i,0,N)ans = GCD(ans,x[i]);
  cout << ans << endl;
}


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

typedef long long ll;
typedef bitset<5010> B;

int main(){
	int n,t,a[5002];
	scanf("%d%d",&n,&t);
	for(int i = 0 ; i < n ; i ++){
		scanf("%d",&a[i]);
	}
	
	int ret = n;
	int sq = 70;
	for(int i = 0 ; i*sq < n ; i ++){
		B b; b.reset();
		b[0] = 1;
		for(int j = 0 ; j < n ; j ++){
			if(i*sq <= j && j < (i+1)*sq)continue;
			b |= b << a[j];
		}
		for(int j = i*sq ; j < min((i+1)*sq,n) ; j ++){
			B b_ = b;
			for(int k = i*sq ; k < min((i+1)*sq,n) ; k ++){
				if(k == j)continue;
				b_ |= b_ << a[k];
			}
			for(int k = max(t-a[j],0) ; k <= t-1 ; k ++){
				if(b_[k]){
					//cout << j << " " << k << endl;
					ret --;
					break;
				}
			}
		}
	}
	cout << ret << endl;
}

Measured memory_bytes: 256
/**
 *		author:  zvm
 *		created: 28.09.2020 17:02:50
**/

#include <bits/stdc++.h>

using namespace std ;

typedef long long int ll ;

int main() 
{
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);	

	ll x, y ;
	cin >> x >> y ;

	int ans = 0 ;
	while( x <= y ) {
		ans += 1 ;
		x *= 2 ;
	}

	cout << ans << endl ;
}


Measured memory_bytes: 3612
// Created by Kshitij Anand NSIT
#include <bits/stdc++.h>


using namespace std;


#define int long long
#define pb push_back
#define P pair<int,int>
#define F first
#define S second
#define vi vector<int>
#define vc vector<char>
#define vb vector<bool>
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
#define mp(a, b) make_pair(a, b)
#define min3(a, b, c) min(min(a, b), c)
#define min4(a, b, c, d) min(min(a, b), min(c, d))
#define max3(a, b, c) max(max(a, b), c)
#define max4(a, b, c, d) max(max(a, b), max(c, d))
#define fill(arr,val) memset(arr,val,sizeof(arr))
#define db(x)  cout<<#x<<" : "<<x<<endl


const int N = 1000000007;

int func(int arr[] ,  int n){

	int dp[n];

	for(int i=0; i<n; i++) {
		dp[i] = INT_MAX;
	}
	dp[0] = 0;

	dp[1] = abs(arr[1] - arr[0]);


	for(int i=2; i<n; i++) {

		dp[i] = min(dp[i] , dp[i-2] + abs(arr[i] - arr[i-2]));
		dp[i] = min(dp[i] , dp[i-1] + abs(arr[i] - arr[i-1]));
	}

	return dp[n-1];

}

void solve(){

    int n,a,b,c, ans=0, count=0, sum=0;
    cin>>n;
    int arr[n];
    for(int i=0;i<n;i++){
      cin>>arr[i];
    }

    ans = func(arr , n);
    
    cout<<ans<<endl; 
}

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    
    
  //  int t; cin>>t; while(t--)
    {     
      solve();
    }

  return 0;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define int long long int
#define ldouble long double
#define vin vector<int>
#define rep(a,n) for(int i=(a);i<(n);i++)
#define INF (int)1000000007

//setprecision()<<

using namespace std;

void fin(int n,vin &a){
    rep(0,n){
        cin>>a.at(i);
    }
}

signed main(){
    int H,W;
    cin>>H>>W;
    int N;
    cin>>N;
    if(N%max(H,W)==0){
        cout<<N/max(H,W)<<endl;
    }
    else{
        cout<<N/max(H,W)+1<<endl;
    }
    

    return 0;
}

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

using namespace std;

const int INF = 2e9 + 5;

pair <int, int> a[200005];

int main() {
    int n;
    scanf("%d", &n);

    int minx = INF;
    int maxx = -INF;
    int miny = INF;
    int maxy = -INF;

    for (int i = 0; i < n; i++) {
        int x, y;
        scanf("%d%d", &x, &y);
        minx = min(minx, x + y);
        maxx = max(maxx, x + y);
        miny = min(miny, x - y);
        maxy = max(maxy, x - y);
    }

   printf("%d\n", max(maxx - minx, maxy - miny)); 
}


Measured memory_bytes: 3812
#include <iostream>
#include <string>
#include <cmath>
#include <vector>
#include <set>
#include <utility>
#include <algorithm>
using namespace std;

int main()
{
    ios::sync_with_stdio(0);
    int a,b;
    cin>> a;
    cin>> b;
    if((a+b)%2!=0)
      {
        cout<< "IMPOSSIBLE"<< endl;
      }
     else
        cout<<(a+b)/2<<endl;
}


Measured memory_bytes: 256
import sys
from collections import Counter
n = int(input())
a_ls = [int(i) for i in sys.stdin.readline().split()]
ct = Counter(a_ls)
flg = False
new_ct = []
for i, j in sorted(ct.items(), key=lambda x:x[0], reverse=True):
    if j >= 4:
        flg = True
    if j > 1:
        new_ct.append((i, j))
if len(new_ct) == 0:
    print(0)
elif len(new_ct) == 1 and not flg:
    print(0)
else:
    if new_ct[0][1] >= 4:
        print(new_ct[0][0] ** 2)
    else:
        print(new_ct[0][0] * new_ct[1][0])

Measured memory_bytes: 22308
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <cstdio>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;
typedef pair<int, int> P;

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

int main(){
	while(1){
	int n, k;
	cin >> n >> k;
	if(n==0 && k==0) return 0;

	int a[k];
	bool flag=0;
	REP(i, k){
		cin >> a[i];
		if(a[i]==0){
			flag=1;
			i--;
			k--;
		}
	}
	if(k==0){
		cout << 1 << endl;
		continue;
	}
	SORT(a, k);

	int res=0;
	REP(i, k){
		int l=1, b=a[i];
		bool f=flag;
		FOR(j, i, k){
			if(j+1<k && b+1==a[j+1]){
				b++;
				l++;
			}
			else if(b<=n && f){
				b++;
				l++;
				j--;
				f=0;
			}
			else{
				if(f && a[i]-1>0) l++;
				break;
			}
		}

		res=max(res, l);
	}

	printf("%d\n", res);
	}
}

Measured memory_bytes: 1476
#include<algorithm>
#include<climits>
#include<cmath>
#include<cstdlib>
#include<iomanip>
#include<iostream>
#include<numeric>
#include<string>
using namespace std;

long gcd(long x, long y) { if (x > y) { return gcd(y, x); } long r; while (y != 0) { r = x % y; x = y; y = r; }return x; }
long lcm(long x, long y) { return(x / gcd(x, y)) * y; }
void indexsort(long* first, long* last, long* func) { sort(first, last, [&](long a, long b) {return func[a] < func[b]; }); }
//--------------------

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

	long res = lcm(2, N);

	cout << res << endl;
}

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

using namespace std;

typedef long long int ll;
#define pb push_back
#define ALL(a) (a).begin() , a.end()

int mod = 1e9 + 7;
int add(int a, int b){
	if(a + b >= mod)return a+ b - mod;
	return a + b;
}
int mul(int a, int b){
	return 1LL * a * b  % mod;
}
int const N = 200 * 1010;

/********************i**********************************/
void solve(){
	int n;
	cin >> n;
	int mi = 1e6, ans = 0;
	for(int x =0; x<n; x++){
		int v;
		cin >> v;
		if(v <= mi){
			mi = v;
			ans ++;
		}
	}
	cout  << ans;
}

/******************************************************/
int main()
{
	ios_base::sync_with_stdio(false);cin.tie(nullptr);
	int t;
	t = 1;
	// cin >> t;
	while(t--){
		solve();
	}
}

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

int main(){
    double a,b;
    cin >> a >> b;
    if(a > b) swap(a, b);
    double ans = (a+b)/2;
    if(b -a > 180){
        ans += 180;
        if(ans > 360) ans -= 360;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3300
#include<stdio.h>
int main(void){
  char *s="python3 -c\""
"n,m=map(int,input().split())\n"
"s=[list(map(int,input().split()))for _ in range(m)]\n"
"s.sort(key=lambda x:x[0])\n"
"c=a=0\n"
"while c<m:\n"
"    i=1\n"
"    t=s[0][1]\n"
"    while i<len(s)and s[i][0]<t:\n"
"        t=min(t,s[i][1])\n"
"        i+=1\n"
"    c+=i\n"
"    s=s[i:]\n"
"    a+=1\n"
"print(a)\n"
"\"";
  system(s);
  return 0;
}            

Measured memory_bytes: 29352
while True:
  a,b,c=map(int,input().split())
  d=a+b
  if a==-1 and b==-1:
    break
  elif a==-1 or b==-1:
    print('F')
  elif d>=80:
    print('A')
  elif 80>d>=65:
    print('B')
  elif 65>d>=50:
    print('C')
  elif 50>d>=30:
    if c>=50:
      print('C')
    else:
      print('D')
  else:
    print('F')




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

int main(){
   int N;
   cin>>N;
   unsigned long int count;
   count=0;
  
   for(int i=0;i<N;i++){
   int a=i+1;
   if(a%3!=0 && a%5!=0){
   count+=a;
   }
   }
   cout<<count<<endl;
}

Measured memory_bytes: 3580
#include <stdio.h>

int main() {
	int i, n, j, k;
	int tou, kai, heya, hito;
	int house[4][3][10] = { 0 };



	scanf("%d", &n);

	for (i = 0; i <n; i++) {
		scanf("%d %d %d %d", &tou, &kai, &heya, &hito);
		house[tou - 1][kai - 1][heya - 1] += hito;
	}

	for (k = 0; k<4; k++) 
	{
		for (j = 0; j<3; j++)
		{
			for (i = 0; i<10; i++) 
			{
				printf(" %d", house[k][j][i]);
			}

			printf("\n");
		}

		if (k == 3) 
		{
			break;
		}

		printf("####################\n");

	}
	return 0;
}



Measured memory_bytes: 2044
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define int long long
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e18;

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    int ans = INF;
    int six[7] = {}, nine[6] = {};
    six[0] = 1;
    nine[0] = 1;
    for(int i = 1; i < 7; i++) six[i] = six[i - 1] * 6;
    for(int i = 1; i < 6; i++) nine[i] = nine[i - 1] * 9;
    for(int i = 0; i <= n; i++){
        int now = i, sum = 0;
        for(int j = 6; j >= 0; j--){
            sum += now / six[j];
            now %= six[j];
        }
        now = n - i;
        for(int j = 5; j >= 0; j--){
            sum += now / nine[j];
            now %= nine[j];
        }
        ans = min(ans, sum);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
integer(16) N,A,B,C,D
integer(16) NumOfNeg
logical check
read*,N,A,B,C,D

check=.False.
do NumOfNeg=0,N-1
  if(C*(N-1-NumOfNeg)-D*NumOfNeg<=B-A .and. B-A<=-C*NumOfNeg +D*(N-1-NumOfNeg))check=.TRUE.
end do

if(check)then
  print"(A)","YES"
else
  print"(A)","NO"
endif
end

Measured memory_bytes: 256
/* <3 <3 <3 */
#include  <bits/stdc++.h> 
  
using namespace std; 
  
#define ii pair <int,int> 
#define iii pair <ii,int> 
#define fi first 
#define se second 
#define ll long long 
#define ull unsigned long long 
  
const int dx[4]={0,1,0,-1}; 
const int dy[4]={1,0,-1,0}; 
const int oo = 1e9; 
vector < iii > v; 
iii a[50]; 
ii b[1000][1000]; 
int n,m1,m2; 
  
int GCD(int m1,int m2) 
{ 
    while (m1!=m2 && m1!=0 && m2!=0) 
    { 
        if (m1>m2) 
            m1%=m2; 
        else
            m2%=m1; 
    } 
    return max(m1,m2); 
} 
int main() 
{ 
    ios::sync_with_stdio(false); 
    cin.tie(0); 
    //freopen("Test.inp","r",stdin); 
    //freopen("Test.out","w",stdout); 
    cin >> n >> m1 >> m2; 
    for (int i=1;i<=n;i++) 
    { 
        cin >> a[i].fi.fi >> a[i].fi.se >> a[i].se; 
    } 
    int res=oo; 
    for (int t=1;t<=50;t++) 
    { 
        int n1=m1*t; 
        int n2=m2*t; 
        for (int i=1;i<=n1;i++) 
            for (int j=1;j<=n2;j++) 
            { 
                b[i][j].fi=0; 
                b[i][j].se=oo; 
            } 
            b[0][0].fi=1; 
            b[0][0].se=0; 
        for (int i=1;i<=n;i++) 
            for (int j=n1;j>=a[i].fi.fi;j--) 
                for (int k=n2;k>=a[i].fi.se;k--) 
                { 
                    if (b[j-a[i].fi.fi][k-a[i].fi.se].fi==1 && b[j-a[i].fi.fi][k-a[i].fi.se].se+a[i].se<b[j][k].se) 
                    { 
                        b[j][k].fi=1; 
                        b[j][k].se=b[j-a[i].fi.fi][k-a[i].fi.se].se+a[i].se; 
                    } 
                } 
        if (b[n1][n2].fi==1) 
            res=min(res,b[n1][n2].se); 
    } 
    if (res==oo) 
        res=-1; 
    cout << res; 
    return 0; 
} 

Measured memory_bytes: 4224
#include <stdio.h>
#include <math.h>

int main(){


  double x1,x2,y1,y2,X,Y,ru;

  scanf("%lf %lf %lf %lf",&x1,&y1,&x2,&y2);

  X=x2-x1;
  X=X*X;
  Y=y2-y1;
  Y=Y*Y;

  ru=X+Y;
  printf("%f\n",sqrt(ru));
  return 0;
}

Measured memory_bytes: 652
#include "bits/stdc++.h"

using namespace std;

#define endl            "\n"
#define sz(x)          (int) (x.size())
#define all(v)          v.begin(), v.end()
#define isOdd(n)       (n&1)
#define pow(n, m)      (ll)powl(n, m)
#define clr(x, val)     memset(x, val, sizeof(x))

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi;


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

    int d, t, s; cin >> d >> t >> s;
    cout << (isgreater(1.0*d/s, t) ? "No" : "Yes");
    return 0;
}


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

int main() {
    int h, w;
    cin >> h >> w;
    vector<vector<char>> c(h, vector<char>(w));
    for (int i=0; i<h; i++)
        for (int j=0; j<w; j++)
            cin >> c[i][j];

    for (int i=0; i<h; i++) {
        for (int j=0; j<w; j++) {
            cout << c[i][j];
        }
        cout << endl;
        for (int j=0; j<w; j++) {
            cout << c[i][j];
        }
        cout << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <bitset>
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <cassert>
#include <queue>

#define mp make_pair
#define pb push_back


typedef long long ll;
typedef long double ld;

using namespace std;


int main() {
	ll n, m;
	cin >> n >> m;
	ll l = 0;
	ll r = n + m + 1;
	while (r - l > 1) {
		ll mid = (l + r) >> 1;
		ll nd = max(0ll, mid - n) * 2;
		if (nd + 2 * mid <= m)
			l = mid;
		else
			r = mid;
	}
	cout << l << "\n";
	return 0;
}




Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static System.Console;

class Program
{
    static void Main(string[] args)
    {
        new Program().Calc();
    }

    Scanner cin;

    public Program() { }

    bool chmax<T>(ref T a, T b) where T : IComparable<T> { if (a.CompareTo(b) < 0) { a = b; return true; } return false; }
    bool chmin<T>(ref T a, T b) where T : IComparable<T> { if (b.CompareTo(a) < 0) { a = b; return true; } return false; }

    void Calc()
    {
        cin = new Scanner();

        int n = cin.nextInt();

        string s = cin.next();
        string t = cin.next();

        char[] s_ = s.ToCharArray();
        char[] t_ = t.ToCharArray();

        string ans = string.Empty;

        for (int i = 0; i < n; ++i)
        {
            ans += s_[i];
            ans += t_[i];
        }

        WriteLine(ans);
    }
}

public static class StringExtension
{
    public static char GetChar1(this string str, int indexOneBase)
    {
        return str[indexOneBase - 1];
    }
}

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
import java.util.*;
public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int[] a = new int[10];
		while(sc.hasNext()){
			Long t = sc.nextLong();
			for(int i=0; i<10; i++) { a[i] = (int)(t%10); t/=10;} 
			
			for(int n=0; n<10; n++){
				for(int i=0; i<9-n; i++) a[i] = (a[i]+a[i+1])%10;
			}
			System.out.println(a[0]);
			
		}
	}

}

Measured memory_bytes: 12000