akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define ll long long                                    // long long省略
#define pb push_back                                    // push_back省略
#define mp make_pair                                    // make_pair省略
#define fi first                                        // first省略
#define se second                                       // second省略
#define itn int                                         // int誤字保険
#define count cout                                      // cout誤字保険
#define vecotr vector                                   // vector誤字保険
#define ednl endl                                       // endl誤字保険
#define opt() cin.tie(0); ios::sync_with_stdio(false)   // 入出力速度改善

#define rep(i,l,r) for(ll i=(l);i<(r);i++)               // 範囲[l, r)で刻み1のfor文(順方向)
#define repp(i,l,r,k) for(ll i=(l);i<(r);i+=(k))         // 範囲[l, r)で刻みkのfor文(順方向)
#define rrep(i,l,r) for(ll i=(r-1);i>=(l);i--)           // 範囲[l, r)で刻み1のfor文(逆方向)
#define rrepp(i,l,r,k) for(ll i=(r-1);i>=(l);i-=(k))     // 範囲[l, r)で刻みkのfor文(逆方向)
#define all(x) (x).begin(), (x).end()                   // vectorのポインタ位置指定用
#define max(p,q)((p)>(q)?(p):(q))                       // max拡張
#define min(p,q)((p)<(q)?(p):(q))                       // min拡張
#define bit(n,m)(((n)>>(m))&1)                          // 変数nのm番目のbitを取り出す

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

int dy[]={0, 1, 0, -1};                                 // 4方向近傍
int dx[]={1, 0, -1, 0};                                 // 4方向近傍

#define INF ((1LL<<62)-(1LL<<31))
//#define MOD 998244353
#define MOD 1000000007
#define invp(a,p) pom(a,p-2,p)

////////////////////////////////////////////////////////////////////////////////////////
int main(){
    ll n;cin>>n;
    ll a[n];rep(i,0,n)cin>>a[i];

    ll sum = 0;
    rep(i,0,n)sum+=a[i];

    ll res[n];
    res[0] = sum;
    repp(i,1,n,2) res[0] -= 2*a[i];

    rep(i,1,n) res[i] = 2*a[i-1] - res[i-1];
    rep(i,0,n) cout << res[i] << " ";
    cout << endl;
}


Measured memory_bytes: 2816
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>

using namespace std;

int main(){
    string s;
    cin >> s;
    int ans=1000;
    for (int i=0;i<s.length()-2;i++){
        int num = 100*(s[i]-'0')+10*(s[i+1]-'0')+(s[i+2]-'0');
        ans = min(ans,abs(753-num));
    }
    cout << ans << endl;
    
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef pair<int, int> P;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vd = vector<double>;
using vvd = vector<vector<double>>;
using vvvd = vector<vector<vector<double>>>;
using vb = vector<bool>;
using vvb = vector<vector<bool>>;
using vs = vector<string>;
using pint = pair<int, int>;
using Graph = vvi;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
bool cmp(pint a, pint b) {return a.second < b.second;}
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main() {
    int n, k, r, s, p;
    string t;
    cin >> n >> k >> r >> s >> p >> t;

    ll sum = 0;
    rep(i, n) {
        if(i >= k) if(t[i] == t[i - k]) t[i] = 'x';
        if(t[i] == 'r') sum += p;
        if(t[i] == 's') sum += r;
        if(t[i] == 'p') sum += s;
    }

    cout << sum << endl;

    return 0;
}

Measured memory_bytes: 512
#! /usr/bin/env python3
# -*- coding:utf-8 -*-

def is_bingo(A, B):
    is_called = []
    for i in range(3):
        is_called.append([True if A[i][j] in B else False for j in range(3)])
    for i in range(3):
        if not(False in [is_called[i][j] for j in range(3)]): return True
    for j in range(3):
        if not(False in [is_called[i][j] for i in range(3)]): return True
    if not(False in [is_called[i][j] for i in range(3) for j in range(3) if i + j == 2]): return True
    if not(False in [is_called[i][j] for i in range(3) for j in range(3) if i - j == 0]): return True
    return False

def main():
    A = []
    B = []
    for _ in range(3):
        A.append(list(map(int, input().split())))
    N = int(input())
    for _ in range(N):
        B.append(int(input()))
    if is_bingo(A, B):
        print("Yes")
    else:
        print("No")

if __name__ == "__main__":
    try:
        assert is_bingo([[84, 97, 66], [79, 89, 11], [61, 59, 7]], [89, 7, 87, 79, 24, 84, 30]) == True
        assert is_bingo([[41, 7, 46], [26, 89, 2], [78, 92, 8]], [5, 6, 45, 16, 57, 17]) == False
        assert is_bingo([[60, 88, 34], [92, 41, 43], [65, 73, 48]], [10, 60, 43, 88, 11, 48, 73, 65, 41, 92, 34]) == True
    except:
        import traceback
        traceback.print_exc()
        exit()
    main()


Measured memory_bytes: 3188
#include <bits/stdc++.h>
#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 ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef long double ld;

int dp[5005][5005];

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

  int ans = 0;
  for (int i = n - 1; i >= 0; i--)
  {
    for (int j = n - 1; j >= 0; j--)
    {
      if (s[i] != s[j])
        dp[i][j] = 0;
      else
        dp[i][j] = dp[i + 1][j + 1] + 1;
    }
  }
  REP(i, n)
  {
    REP(j, n)
    {
      if (i >= j)
        continue;
      int res = min(dp[i][j], j - i);
      ans = max(ans, res);
    }
  }

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

Measured memory_bytes: 98048
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define sc(x) scanf("%d",&x);
ll mpow(ll a, ll n){
    ll res = 1;
    while (n > 0){
        if (n & 1) res = res * a;
        a = a * a;
        n >>= 1;
    }
    return res;
}
int main(){
    int d, n;
    sc(d) sc(n)
    int x = mpow(100, d), cnt = 0, ans = 0;
    while (cnt != n){
        ans += x;
        if (ans % mpow(100, d+1) != 0) cnt++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,l,n) for(int i=l;i<n;i++)
#define rer(i,l,n) for(int i=l;i<=n;i++)
#define all(a) a.begin(),a.end()
#define o(a) cout<<a<<endl
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int,int> pii;

int main(){
	int n,ans;
	while(scanf("%d",&n)!=EOF){
		ans=n%39;
		if(ans==0) ans=39;
		printf("3C%02d\n",ans);
	}
}

Measured memory_bytes: 1200
package main

import "fmt"

func main() {
	var N int
	fmt.Scan(&N)
	list := make(map[int]int)
	for i := 0; i < N; i++ {
		var A int
		fmt.Scan(&A)
		if _, exist := list[A]; exist {
			fmt.Println("NO")
			return
		} else {
			list[A] = A
		}
	}
	fmt.Println("YES")
}


Measured memory_bytes: 13056
n = int(input())
a = list(map(int, input().split()))

end = 0
count = 0

while(True):
 for i in range(n):
  if a[i]%2 == 1:
   end = 1
   break
  a[i] = a[i]/2
 
 if end == 1: break
 count += 1

print(count)

Measured memory_bytes: 3060
#include <iostream>
using namespace std;
int main()
{
    long long N;
    cin >> N;
    int A[100010] = {};
    for (int i = 1; i < N + 1; i++)
    {
        cin >> A[i];
    }
    long long sum = 0;
    for (int i = 0; i < N + 1; i++)
    {
        sum += abs(A[i + 1] - A[i]);
    }

    int a, b, c;
    for (int i = 1; i < N + 1; i++)
    {
        a = abs(A[i] - A[i - 1]);
        b = abs(A[i + 1] - A[i]);
        c = abs(A[i + 1] - A[i - 1]);
        cout << sum - a - b + c << endl;
    }

    return 0;
}


Measured memory_bytes: 1664
#include<cstdio>
const int MaxN=200010,mod=1000000007;
int N;
long long fac[MaxN],ifac[MaxN];
long long inv(int a,int p=mod){return a==1?1:(1+p*(a-inv(p%a,a)))/a%p;}
struct edge{int to;edge*next;}E[MaxN*2],*ne=E,*fir[MaxN];
void link(int u,int v){*ne=(edge){v,fir[u]};fir[u]=ne++;}
int Q[MaxN],deg[MaxN],S[MaxN],fa[MaxN],siz[MaxN],C[MaxN];
bool vis[MaxN];
int dfs(int i){
	siz[i]=1;
	int s=1;
	for(edge*e=fir[i];e;e=e->next)
		if(fa[e->to]==i&&e->to<fa[i])s=1ll*s*dfs(e->to)%mod,siz[i]+=siz[e->to];
	return 1ll*s*ifac[siz[i]]%mod*fac[siz[i]-1]%mod;
}
int solve(int v){
	int*h=Q,*t=Q+1,es=0;
	vis[*Q=v]=1;
	for(;h<t;es+=deg[*h++])
		for(edge*e=fir[*h];e;e=e->next,deg[*h]++)
			if(!vis[e->to])vis[*t++=e->to]=1;
	if(es!=(t-Q)*2)return 0;
	int*tp=S;
	for(int*i=Q;i<t;i++)if(deg[*i]==1)*tp++=*i;
	while(tp>S){
		int x=*--tp;
		for(edge*e=fir[x];e;e=e->next)
			if(--deg[e->to])deg[fa[x]=e->to]==1?*tp++=e->to:1;
	}
	int len=0;
	for(int*i=Q;i<t;i++)if(deg[*i]>1){
		for(int j=*i;deg[j];){
			deg[C[len++]=j]=0;
			for(edge*e=fir[j];e;e=e->next)
				if(deg[e->to]>1){j=e->to;break;}
		}
		break;
	}
	int sum=0;
	for(int dir=0;dir<2;dir++){
		int s=1;
		for(int i=0;i<len;i++)fa[C[i]]=C[(dir?i+len-1:i+1)%len];
		for(int*i=Q;i<t;i++)if(*i>fa[fa[*i]])s=1ll*s*dfs(*i)%mod;
		(sum+=s)%=mod;
	}
	return sum;
}
int main(){
	scanf("%d",&N);
	for(int i=*fac=1;i<=N*2;i++)fac[i]=fac[i-1]*i%mod;
	ifac[N*2]=inv(fac[N*2]);
	for(int i=N*2;i;i--)ifac[i-1]=ifac[i]*i%mod;
	for(int i=0,x,y;i<N*2;i++)scanf("%d%d",&x,&y),link(x,y+=N),link(y,x);
	int s=fac[N*2];
	for(int i=1;i<=N*2;i++)if(!vis[i])s=1ll*s*solve(i)%mod;
	printf("%d\n",s);
}

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

#define rep(i,x,y) for(ll i=(x);i<(y);i++)
#define rrep(i,x,y) for(ll i=(ll)(y)-1;i>=(x);i--)
#define all(x) (x).begin(),(x).end()
#ifdef LOCAL
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl
#define itrdebug(x) cerr << #x << " "; for (auto & el : (x)) {cerr << (el) << " ";} cerr << endl
#define dassert(...) assert(__VA_ARGS__)
#else
#define debug(x)
#define itrdebug(x)
#define dassert(...)
#endif
//#define int long long

typedef long long ll;
const ll MOD = 1e9 + 7;
const long double EPS = 1e-8;

void solve(long long A, long long B, long long H, long long M){
    long double theta = abs(2 * M_PI * (M / 60.0) - 2 * M_PI * ((60 * H + M) / (60.0 * 12.0)));
    if (theta >= M_PI) theta = 2 * M_PI - theta;
    long double C = pow(max<long double>(B * B + A * A - 2 * A * B * cos(theta), 0), 0.5);
    cout << fixed << setprecision(20) << C << endl;
}

signed main(){
    // ios_base::sync_with_stdio(false);
    // cin.tie(NULL);
    long long A;
    scanf("%lld",&A);
    long long B;
    scanf("%lld",&B);
    long long H;
    scanf("%lld",&H);
    long long M;
    scanf("%lld",&M);
    solve(A, B, H, M);
    return 0;
}


Measured memory_bytes: 4248
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines

def main():
    M,*cd = map(int, read().split())

    D = 0
    S = 0
    for d, c in zip(*[iter(cd)]*2):
        D += c
        S += c * d
    
    ans = (D - 1) + (S - 1) // 9
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 28240
#include <bits/stdc++.h>
#define ll long long int
#define ld long double
#define pb push_back
#define pll pair<ll, ll> 
#define vi vector<int>
#define vl vector<ll> 
#define vvl vector< vector<ll> > 
#define vvi vector< vector<int> >
#define vlp vector< pair<ll, ll> >
#define vllp vector<pair<ll, ll>, ll > 
#define rep(i,a)  for(ll i=0; i< a; i++)
#define rep1(i,a)   for(ll i = 1; i< a; i++)
#define foi(i, a, b)    for(ll i = a; i<b ; i++)
#define fod(i, a, b)    for(ll i = a; i>=b ; i--)
#define mp make_pair
#define fst first
#define sec second
#define ff first.first
#define fs first.second
#define pi pair<int, int>
#define ppi pair<pair<int, int>, int>
#define max3(a, b, c)   max(max(a, b), c)
#define min3(a, b, c)   min(min(a, b), c)
#define MAX 1000001
#define MOD 1000000007
#define s(v) v.size()
#define e(v) v.empty()

using namespace std;

ll gcd(ll a, ll b){if(b==0)return a;return gcd(b, a%b);}
ll lcm(ll a, ll b){return a*b/gcd(a, b);}
ll fexp(ll a, ll b){ll ans = 1;while(b){if(b&1) ans = ans*a%MOD; b/=2;a=a*a%MOD;}return ans;}
ll inverse(ll a, ll p){return fexp(a, p-2);}
// bool sortbysec(const pll &a, const pll &b){return (a.second < b.second);} 
void ingraph(vvl& graph, ll m){ll x, y;rep(i, m){cin>>x>>y;x--, y--;graph[x].pb(y);graph[y].pb(x);}}

int main(){
    /*#ifndef ONLINE_JUDGE
        freopen("../input.txt", "r", stdin);
        freopen("../output.txt", "w", stdout);
    #endif*/
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    ll t;
    // cin>>t;
    t = 1;
    while(t--){
        ll n;
        cin>>n;
        vl vec(MAX);
        rep(i,n)    cin>>vec[i];
        vl dp(MAX);
        dp[0] = 0;
        dp[1] = abs(vec[0]-vec[1]);
        dp[2] = abs(vec[2]-vec[0]);
        foi(i, 3, n){
            dp[i] = min(dp[i-1]+abs(vec[i]-vec[i-1]), dp[i-2]+abs(vec[i]-vec[i-2]));   
        }
        cout<<dp[n-1];
    }
}

Measured memory_bytes: 15872
package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)

	arr := make([]int, n+1)
	arr[0] = -1
	for i := 1; i <= n; i++ {
		fmt.Scan(&arr[i])
	}

	c, v := 0, 1
	for i := 1; i <= n; i++ {
		if v == 2 {
			fmt.Println(c)
			return
		}
		v = arr[v]
		c++
	}

	fmt.Println("-1")
}


Measured memory_bytes: 5504
import sys
from collections import deque as dq
input = sys.stdin.readline
N, M = map(int, input().split())
e = [[] for _ in range(N + 1)]
for _ in range(M):
  u, v = map(int, input().split())
  e[u].append(v)
  e[v].append(u)
Q = dq([1])
d = [10 ** 6] * (N + 1)
d[1] = 0
res = [0] * (N + 1)
while len(Q):
  x = Q.popleft()
  for y in e[x]:
    if d[y] > d[x] + 1:
      d[y] = d[x] + 1
      Q.append(y)
      res[y] = x
if min(res[2: ]):
  print("Yes")
  for r in res[2: ]: print(r)
else: print("No")

Measured memory_bytes: 92760
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = n - 1; i >= 0; i--)
using namespace std;
using Graph = vector<vector<int>>;
#define MOD 1000000007
#define MOD2 998244353
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long ll;
typedef pair<ll, ll> P;

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

    vector<string> t;
    t.push_back("KIHBR");
    t.push_back("KIHBRA");
    t.push_back("KIHBAR");
    t.push_back("KIHBARA");
    t.push_back("KIHABR");
    t.push_back("KIHABRA");
    t.push_back("KIHABAR");
    t.push_back("KIHABARA");
    t.push_back("AKIHBR");
    t.push_back("AKIHBRA");
    t.push_back("AKIHBAR");
    t.push_back("AKIHBARA");
    t.push_back("AKIHABR");
    t.push_back("AKIHABRA");
    t.push_back("AKIHABAR");
    t.push_back("AKIHABARA");

    bool flag = 0;
    rep(i, 16) if (t[i] == s) flag = 1;

    if (flag) cout << "YES" << endl;
    else cout << "NO" << endl;

    return 0;
}

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

using namespace std;

typedef long long ll;

const double pi = 3.14159265358979323846;

#define REP(i, n) for (ll i = 0; i < n; i++)
#define MOD 1000000007LL
#define PS(p) cout << setprecision(15) << fixed << p << endl;
#define UNIQUE(v) v.erase(std::unique(v.begin(), v.end()), v.end());
#define ALL(c) c.begin(), c.end()
#define CIN(v) cin >> v;
#define COUT(v) cout << v << "\n";

bool isPrime(ll n) {
  for (ll i = 2; i * i <= n; i++) {
    if (n % i == 0)
      return false;
  }

  return n != 1;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  ll X;

  CIN(X);

  for (ll i = X; i < 200000; i++) {
    if (isPrime(i)) {
      COUT(i);
      return 0;
    }
  }
  COUT(0);

  return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
//using System.Text;
//using System.Text.RegularExpressions;
//using System.Globalization;
//using System.Diagnostics;
using static System.Console;
//using System.Numerics;
//using static System.Math;
//using pair = Pair<int, int>;

class Program
{
    static void Main()
    {
        //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
        new Program().solve();
        Out.Flush();
    }
    readonly Scanner cin = new Scanner();
    readonly int[] dd = { 0, 1, 0, -1, 0 }; //→↓←↑
    readonly int mod = 1000000007;
    void chmax<T>(ref T a, T b) where T : IComparable<T> { a = a.CompareTo(b) < 0 ? b : a; }
    void chmin<T>(ref T a, T b) where T : IComparable<T> { a = a.CompareTo(b) < 0 ? a : b; }

    void solve()
    {
        int N = cin.nextint;
        int K = cin.nextint;
        var A = cin.scanlong;
        //Array.Sort(A);
        //Array.Reverse(A);

        var L = new List<long>();
        for (int i = 0; i < N; i++)
        {
            long sum = 0;
            for (int j = i; j < N; j++)
            {
                sum += A[j];
                L.Add(sum);
            }
        }
       

        //iのビットが立っているものがK個以上あるか
        for (int i = 40 - 1; i >= 0; i--)
        {
            var tmp = new List<long>();
            for (int j = 0; j < L.Count; j++)
            {
                if ((L[j] >> i & 1) == 1)
                {
                    tmp.Add(L[j]);
                }
            }
            if (tmp.Count >= K)
            {
                L = new List<long>();
                foreach (var item in tmp)
                {
                    L.Add(item);
                }
            }
        }

        long ans = L[0];
        for (int i = 1; i < K; i++)
        {
            ans &= L[i];
        }
        WriteLine(ans);
    }

}

class Scanner
{
    string[] s; int i;
    readonly char[] cs = new char[] { ' ' };
    public Scanner() { s = new string[0]; i = 0; }
    public string[] scan { get { return ReadLine().Split(); } }
    public int[] scanint { get { return Array.ConvertAll(scan, int.Parse); } }
    public long[] scanlong { get { return Array.ConvertAll(scan, long.Parse); } }
    public double[] scandouble { get { return Array.ConvertAll(scan, double.Parse); } }
    public string next
    {
        get
        {
            if (i < s.Length) return s[i++];
            string st = ReadLine();
            while (st == "") st = ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            i = 0;
            return next;
        }
    }
    public int nextint { get { return int.Parse(next); } }
    public long nextlong { get { return long.Parse(next); } }
    public double nextdouble { get { return double.Parse(next); } }
    public void join<T>(IEnumerable<T> values) { WriteLine(string.Join(" ", values)); }
}

Measured memory_bytes: 29776
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) (v).begin(), (v).end()
#define coutd(n) cout << fixed << setprecision(n)
#define ll long long int
#define vl vector<ll>
#define vi vector<int>
const int INF = 2147483647;
const ll MOD = 1000000007;

using namespace std;

int main() {
  int n;
  cin >> n;
  vector<vector<pair<int, int>>> m(n);
  REP(i, n) {
    int a;
    cin >> a;
    REP(j, a) {
      int x, y;
      cin >> x >> y;
      x--;
      y++;
      m[i].push_back(make_pair(x, y));
    }
  }

  int ans = 0;
  REP(i, (1 << n)) {
    int tmp = 0;
    // 本物:2, 嘘:1
    vector<int> kari(n, 0);
    bool ok = true;
    REP(j, n) {
      if ((i >> j) % 2 == 1) {
        tmp++;
        REP(k, m[j].size()) {
          if (kari[m[j][k].first] != 0 &&
              kari[m[j][k].first] != m[j][k].second) {
            ok = false;
          }
          kari[m[j][k].first] = m[j][k].second;
        }
      }
    }
    REP(j, n) {
      if (kari[j] == 2 && (i >> j) % 2 == 0) {
        ok = false;
      }
      if (kari[j] == 1 && (i >> j) % 2 == 1) {
        ok = false;
      }
    }
    if (ok) {
      ans = max(ans, tmp);
    }
  }
  cout << ans << endl;
}


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

using namespace std;

int main()
{
	int n;
	int a;
	vector<int> listA;
	vector<int>::iterator foundIndex;

	cin >> n;

	for (int i = 0; i < n; i++)
	{
		cin >> a;
		listA.push_back(a);
	}

	while (listA.size() > 1)
	{
		sort(listA.begin(), listA.end());
		
		for (int i = 1; i < listA.size(); i++)
		{
			listA[i] = listA[i] % listA[0];
		}
		
		foundIndex = find(listA.begin(), listA.end(), 0);
		while (foundIndex != listA.end())
		{
			listA.erase(foundIndex);
			foundIndex = find(listA.begin(), listA.end(), 0);
		}
	}
	cout << listA[0];
	
	
	return 0;
}

Measured memory_bytes: 892
#include<iostream>
#include<stdio.h>
using namespace std;
#define N 100
int n, M[N][N];
int search[N], d[N], f[N], t;

void dfs_visit(int u) {
    int v;
    search[u] = 1;
    d[u] = ++t;
    for (v=0; v<n; v++) {
        if (M[u][v] == 0) continue;
        if (search[v] == 0) {
            dfs_visit(v);
        }
    }
    search[u] = 2;
    f[u] = ++t;
}

void dfs() {
    int u;
    for (u=0; u<n; u++) {
        search[u] = 0;
    }
    t=0;
    for (u=0; u<n; u++) {
        if(search[u] == 0) dfs_visit(u);
    }
    for (u=0; u<n; u++) {
        cout << u+1 << " " << d[u] << " " << f[u] << endl;
    }
}

int main() {
    int u, v, k, i, j;
    cin >> n;
    for (i = 0; i < n; i++) {
        for (j=0; j<n; j++) {
            M[i][j] = 0;
        }
    }
    for (i=0; i<n; i++) {
        cin >> u >> k;
        u--;
        for (j=0; j<k; j++) {
            cin >> v;
            v--;
            M[u][v] = 1;
        }
    }
    
    dfs();
    
    return 0;
}


Measured memory_bytes: 3104
n = int(input())
try:
  a = list(map(int,input().split()))
  a1 = list(i for i in a if i%2==0)
  a2 = list(i for i in a1 if i%3!=0)
  a3 = list(i for i in a2 if i%5!=0)
except EOFError:
  pass
if len(a3) == 0:
  print('APPROVED')
else:
  print('DENIED')

Measured memory_bytes: 3064
import std.stdio, std.string, std.conv, std.range;
import std.algorithm, std.array, std.typecons, std.container;
import std.math, std.numeric, std.random, core.bitop;

enum inf = 1_001_001_001;
enum infl = 1_001_001_001_001_001_001L;


void main() {
    string a, b, c;
    scan(a);
    scan(b);
    scan(c);

    auto A = a.length.to!int;
    auto B = b.length.to!int;
    auto C = c.length.to!int;

    auto ab = new bool[](20000);
    auto ac = new bool[](20000);
    auto bc = new bool[](20000);
    ab[] = ac[] = bc[] = true;

    bool match(char c1, char c2) {
        return c1 == '?' || c2 == '?' || c1 == c2;
    }

    foreach (i ; 0 .. A) {
        foreach (j ; 0 .. B) {
            if (!match(a[i], b[j])) {
                ab[i - j + 10000] = false;
            }
        }
    }

    foreach (i ; 0 .. A) {
        foreach (j ; 0 .. C) {
            if (!match(a[i], c[j])) {
                ac[i - j + 10000] = false;
            }
        }
    }

    foreach (i ; 0 .. B) {
        foreach (j ; 0 .. C) {
            if (!match(b[i], c[j])) {
                bc[i - j + 10000] = false;
            }
        }
    }

    int ans = inf;

    foreach (lb ; -4000 .. 4001) {
        foreach (lc ; -4000 .. 4001) {
            bool valid = ab[lb + 10000] && ac[lc + 10000] && bc[lc - lb + 10000];
            if (valid) {
                int l = min(lb, lc, 0);
                int r = max(lb + B, lc + C, A);
                chmin(ans, r - l);
            }
        }
    }

    writeln(ans);
}



void scan(T...)(ref T args) {
    auto line = readln.split;
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront;
    }
    assert(line.empty);
}

void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}

bool chmin(T, U...)(ref T x, U args) {
    bool isChanged;
    foreach (arg; args) if (x > arg) {
        x = arg;
        isChanged = true;
    }
    return isChanged;
}

bool chmax(T, U...)(ref T x, U args) {
    bool isChanged;
    foreach (arg; args) if (x < arg) {
        x = arg;
        isChanged = true;
    }
    return isChanged;
}

void yes(bool ok, string y = "Yes", string n = "No") {
    return writeln(ok ? y : n);
}


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

using namespace std;

map<int,int>my;

int main()
{
    int k;
    cin >> k;
    int arr[101];

    for(int i=0; i<k; i++){
        int a;
        cin >> a;
        my[a]= 1;
    }
    int ans=0;
    for(int i=0; i<101; i++){
        ans += my[i];
       /// cout << my[i] << " ";
    }
    cout <<  ans <<endl;
}


Measured memory_bytes: 256
n,m=map(int, input().split())
a=list()
for i in range(m):
    a.append(int(input()))

mod=1e9+7

inf=float('inf')

dp=[inf]*(n+1)
dp[0]=1
dp[1]=1

for i in a:
    dp[i]=0

for i in range(2,n+1):
    dp[i] = min(dp[i], dp[i-1]+dp[i-2]) % mod

print(int(dp[-1]))

Measured memory_bytes: 10152
n=int(input())
a=list(map(int,input().split()))
a.append(0)
a.insert(0,0)
diff=[]
sum=0
for i in range(0,n+1):
	diff.append(a[i+1]-a[i])
	sum+=abs(diff[i])
for i in range(0,n):
	ans=sum+abs(diff[i]+diff[i+1])-(abs(diff[i])+abs(diff[i+1]))
	print(ans)
	

Measured memory_bytes: 13920
//raja1999
#include <bits/stdc++.h>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <climits>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <iomanip> 
//setbase - cout << setbase (16); cout << 100 << endl; Prints 64
//setfill -   cout << setfill ('x') << setw (5); cout << 77 <<endl;prints xxx77
//setprecision - cout << setprecision (14) << f << endl; Prints x.xxxx


using namespace std;
#define f(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) f(i,0,n)
#define fd(i,a,b) for(i=a;i>=b;i--)
#define pb push_back
#define mp make_pair
#define vi vector< int >
#define vl vector< ll >
#define ss second
#define ff first
#define ll long long
#define pii pair< int,int >
#define pll pair< ll,ll >
#define sz(a) a.size()
#define inf (1000*1000*1000+5)
#define all(a) a.begin(),a.end()
#define tri pair<int,pii>
#define vii vector<pii>
#define vll vector<pll>
#define viii vector<tri>
#define mod (1000*1000*1000+7)
#define pqueue priority_queue< int >
#define pdqueue priority_queue< int,vi ,greater< int > >

//std::ios::sync_with_stdio(false);
int main(){
	std::ios::sync_with_stdio(false);
	int n;
	cin>>n;
	ll g,l,a,x,i;
	cin>>x;
	g=x;
	l=x;
	rep(i,n-1)
	{
		cin>>a;
		//l=x;
		g=__gcd(l,a);
		//cout<<g<<endl;
		a/=g;
		l*=a;	
		//cout<<l<<endl;	
	}
	cout<<l<<endl;
} 


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <time.h>
#include <stdlib.h>
#include <string>
#include <bitset>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <algorithm>
#include <sstream>
#include <stack>
#include <iomanip>
using namespace std;
#define pb push_back
#define mp make_pair
typedef pair<int,int> pii;
typedef long long ll;
typedef double ld;
typedef vector<int> vi;
#define fi first
#define se second
#define fe first
#define FO(x) {freopen(#x".in","r",stdin);freopen(#x".out","w",stdout);}
#define Edg int M=0,fst[SZ],vb[SZ],nxt[SZ];void ad_de(int a,int b){++M;nxt[M]=fst[a];fst[a]=M;vb[M]=b;}void adde(int a,int b){ad_de(a,b);ad_de(b,a);}
#define Edgc int M=0,fst[SZ],vb[SZ],nxt[SZ],vc[SZ];void ad_de(int a,int b,int c){++M;nxt[M]=fst[a];fst[a]=M;vb[M]=b;vc[M]=c;}void adde(int a,int b,int c){ad_de(a,b,c);ad_de(b,a,c);}
#define es(x,e) (int e=fst[x];e;e=nxt[e])
#define esb(x,e,b) (int e=fst[x],b=vb[e];e;e=nxt[e],b=vb[e])
#define SZ 666666
bool np[SZ];
int n,ps[SZ],pn;
ll a[555][555];
set<ll> sw;
ll lcm(ll a,ll b)
{return a/__gcd(a,b)*b;}
int main()
{
	for(int i=2;i<SZ;++i) if(!np[i])
	{
		ps[++pn]=i;
		for(int j=i;j<SZ;j+=i) np[j]=1;
	}
	cin>>n; 
	for(int i=0;i<=n+1;++i)
		for(int j=0;j<=n+1;++j) a[i][j]=1;
	for(int i=1;i<=n;++i)
		for(int j=1;j<=n;++j)
			if((i+j)%2==0)
			{
				a[i][j]=ps[(i+1)/2+1]*(ll)ps[(j+1)/2+(n+1)/2+1]*(1+(i%2));
				sw.insert(a[i][j]);
			}
	for(int i=n;i>=1;--i)
		for(int j=n;j>=1;--j)
			if((i+j)&1)
			{
				ll u=
				lcm(
				lcm(a[i][j+1],a[i][j-1]),
				lcm(a[i-1][j],a[i+1][j])
				),uu=u;
				while(sw.count(uu+1)) uu+=u;
				sw.insert(a[i][j]=uu+1);
			}
	for(int i=1;i<=n;++i,puts(""))
		for(int j=1;j<=n;++j)
			printf("%lld ",a[i][j]);
}


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

int Partition(vector<int> &A, int p, int r)
{
	int i = p-1;
	for(int j = p; j < r; j++){
		if(A[j] <= A[r]){
			i++;
			swap(A[i], A[j]);
		}
	}
	swap(A[i+1], A[r]);
	return i+1;
}


int main()
{
	int n;
	cin >> n;
	vector<int> A(n);
	for(int i = 0; i < n; i++){
		cin >> A[i];
	}
	
	int q = Partition(A, 0, n-1);
	
	for(int i = 0; i < n; i++){
		if(i == q){
			cout << '[' << A[i] << ']';
		}else{
			cout << A[i];
		}
		if(i == n-1){
			cout << endl;
		}else{
			cout << ' ';
		}
	}
	return 0;
}

Measured memory_bytes: 3040
open Batteries
(* a = (N - C) / B *)
let n = read_int ()


let rec a_loop a result_a =
  let rec b_loop b result_b =
    if a * b >= n then result_b else b_loop (b+1) (result_b+1)
  in if a >= n then result_a else a_loop (a+1) (result_a + (b_loop 1 0))


let () = Printf.printf "%d\n" @@ a_loop 1 0


Measured memory_bytes: 7244
#include <cstdio>
#include <cmath>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>

#ifdef _DEBUG
#define DMP(x) cerr << #x << ": " << x << "\n"
#else
#define DMP(x) ((void)0)
#endif

const int MOD = 1000000007, INF = 1111111111; 
using namespace std;
typedef long long lint;

size_t make753(int N) {

	vector<int> vec753;
	int bit_used = 0, range = 9;
	int tmp, ternary, n753;

	for (int digit = 3; digit <= 9; digit++) {

		range *= 3;

		for (int i = 0; i <= range; i++) {

			bit_used = 0;
			ternary = i;
			n753 = 0;

			for (int j = 0; j < digit; j++) {

				tmp = ternary % 3;
				ternary /= 3;
				n753 *= 10;
				
				if (tmp == 0) {
					n753 += 3;
					bit_used |= 1;
				}				
				if (tmp == 1) {
					n753 += 5;
					bit_used |= 2;
				}
				if (tmp == 2) {
					n753 += 7;
					bit_used |= 4;
				}

			}

			if (!(bit_used ^ 7)) vec753.push_back(n753);

		}

	}

	sort(vec753.begin(), vec753.end());
	size_t res = upper_bound(vec753.begin(), vec753.end(), N) - vec753.begin();
	
	return res;

}

int main() {

	cin.tie(0);
	ios::sync_with_stdio(false);

	int N;
	cin >> N;

	cout << make753(N) << "\n";

	return 0;

}

Measured memory_bytes: 512
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	MyScanner sc = new MyScanner();
	Scanner sc2 = new Scanner(System.in);
	int mod = 1000000007;

	void run() {
		while (sc2.hasNext()) {
			double a = sc2.nextDouble();
			double l = sc2.nextDouble();
			double x = sc2.nextDouble();
			double s = (a + l + l) / 2;
			double S1 = Math.sqrt(s * (s - a) * (s - l) * (s - l));

			double l2 = (l + x) / 2;
			s = (l2 * 2 + l) / 2;
			double S2 = Math.sqrt(s * (s - l) * (s - l2) * (s - l2));
			System.out.println(S1 + S2 * 2);
		}
	}

	public static void main(String[] args) {
		new Main().run();
	}

	void debug(Object... o) {
		System.out.println(Arrays.deepToString(o));
	}

	void debug2(int[][] array) {
		for (int i = 0; i < array.length; i++) {
			for (int j = 0; j < array[i].length; j++) {
				System.out.print(array[i][j]);
			}
			System.out.println();
		}
	}

	class MyScanner {
		int nextInt() {
			try {
				int c = System.in.read();
				while (c != '-' && (c < '0' || '9' < c))
					c = System.in.read();
				if (c == '-')
					return -nextInt();
				int res = 0;
				do {
					res *= 10;
					res += c - '0';
					c = System.in.read();
				} while ('0' <= c && c <= '9');
				return res;
			} catch (Exception e) {
				return -1;
			}
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		String next() {
			try {
				StringBuilder res = new StringBuilder("");
				int c = System.in.read();
				while (Character.isWhitespace(c))
					c = System.in.read();
				do {
					res.append((char) c);
				} while (!Character.isWhitespace(c = System.in.read()));
				return res.toString();
			} catch (Exception e) {
				return null;
			}
		}
	}
}

Measured memory_bytes: 37664
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define P pair<ll,ll>
#define FOR(I,A,B) for(ll I = ll(A); I < ll(B); ++I)
#define FORR(I,A,B) for(ll I = ll((B)-1); I >= ll(A); --I)
#define TO(x,t,f) ((x)?(t):(f))
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin()) //xi>=v  x is sorted
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin()) //xi>v  x is sorted
#define NUM(x,v) (POSU(x,v)-POSL(x,v))  //x is sorted
#define REV(x) (reverse(x.begin(),x.end())) //reverse
ll gcd(ll a,ll b){if(a%b==0)return b;return gcd(b,a%b);}
ll lcm(ll a,ll b){ll c=gcd(a,b);return ((a/c)*(b/c)*c);}
#define NEXTP(x) next_permutation(x.begin(),x.end())
const ll INF=ll(1e16)+ll(7);
const ll MOD=1000000007LL;
#define out(a) cout<<fixed<<setprecision((a))

struct MQ{//平方分割 0-index
	int n,rn,bn;
	vector<ll> a,b;
	MQ(int n_){
		n = n_; rn = sqrt(n); bn = ceil((double)n/rn);
		a.resize(n,INF);
		b.resize(bn,INF);
	}
	ll value(ll s){
		if(a[s]>b[s/rn])a[s] = b[s/rn];
		return a[s];
	}
	void updete(int s,int t,ll x){
		for(int i=s;i<=t;i++){
			if(i%rn==0 && (i+rn-1)<=t){
				if(x<b[i/rn])b[i/rn]=x;
				i += rn-1;
			}else{
				if(a[i]>x)a[i]=x;
			}
		}
	}
};



int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	ll N,M;
	cin >> N >> M;
	vector< tuple<int,int,ll> > LRC(M);
	FOR(i,0,M){
		int l,r; ll c;
		cin >> l >> r >> c;
		l--;r--;
		LRC[i] = tie(l,r,c);
	}
	SORT(LRC);
	MQ minq(N);
	minq.updete(0,0,0);
	FOR(i,0,M){
		ll l,r,c;
		tie(l,r,c) = LRC[i];
		ll v = minq.value(l);
		if(v>=INF)continue;
		minq.updete(l+1,r,c+v);
	}
	ll ans = minq.value(N-1);
	if(ans==INF)ans=-1;
	cout << ans << endl;
}


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

using namespace std;

typedef long long ll;

const int N = 21;
int n;
int dp[22][(1 << 21)];
int a[N][N];
const int mod = 1e9 + 7;

int add(int a, int b)
{
  return (a + b) % mod;
}

int main()
{
  cin >> n;
  for(int i = 0; i < n; i++)
    for(int j = 0; j < n; j++)
      cin >> a[i][j];
  dp[n][(1 << n) - 1] = 1;
  for(int i = n - 1; i >= 0; i--)
  {
    for(int mask = 0; mask < (1 << n) - 1; mask++)
    {
      if( __builtin_popcount(mask) != i)
        continue;
      for(int j = 0; j < n; j++)
      {
        if(!(mask & (1 << j)) && a[i][j])
          dp[i][mask] = add(dp[i][mask], dp[i + 1][mask | (1 << j)]);
      }
    }
  }
  cout << dp[0][0];
  return 0;
}


Measured memory_bytes: 162048
#include <iostream>
#include <vector>

using namespace std;

int main() {
  int n;
  cin >> n;
  vector<int> vec(n);
  for (auto &v : vec)
    cin >> v;

  int cnt = 0;
  for (int i = 1; i <= 100; ++i) {
    bool flag = false;
    for (auto &h : vec) {
      if (i <= h && flag == false) {
        flag = true;
        ++cnt;
      }
      else if (h < i) {
        flag = false;
      }
    }
  }

  cout << cnt << endl;
}


Measured memory_bytes: 3628
# coding: utf-8

N, M = (int(x) for x in input().split())

pass_ids = [x for x in range(N)]

L_max, R_min = 0, N
for i in range(M):
	L, R = (int(x) - 1 for x in input().split())
	
	if L_max < L:
		L_max = L
	if R_min > R:
		R_min = R


if L_max < R_min + 1:
	print(len(list(range(L_max, R_min + 1))))
else:
	print("0")

Measured memory_bytes: 11032
(let ((n (read))
      (s (read-line))
      (ans 0)
      (ans-max 0))
     (loop for i across s
           do (if (eq i #\D) (decf ans)
                  (progn (incf ans)
                    (setf ans-max (max ans ans-max)))))
     (princ ans-max))

Measured memory_bytes: 3816
#include <bits/stdc++.h>
using namespace std;
#define rep(i, m, n) for(int i=m; i<n; i++)
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> Pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
template <typename T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1;} return 0; }
template <typename T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1;} return 0; }


int main() {
  ll A,B,N; cin>>A>>B>>N;
  ll ans=0;
  for(ll i=B-1; i<N+1; i+=B){
      ans=max(ans,A*i/B-A*(i/B));
      if(i>(B-1)+B*10000000) break;
  }
  ans=max(ans,(A*N)/B-A*(N/B));
  cout<<ans<<endl;
}

Measured memory_bytes: 3672
#include <iostream>
#include<string>
#include<cmath>
#include<ciso646>
#include<cstring>
#include<iomanip>
#include<vector>
#include<algorithm>
#include<stdarg.h>
#include<math.h>
using ll = long long;

using namespace std;
int main()
{/*7日目*/
//少数も使いたい割り算はしない方がいい
// 数値の大きさ
//for文で0代入する場所はforの一文下
//オーバーフローする一手手前を分解して作る・ 割り算で減らしていく
//for文いつも間違える/ i<nなら最後はa[n-1]
	int n, m; cin >> n >> m;
	vector<int> iner(n);
	vector<bool>higher(n);
	int sum = 0;
	for (int i = 0;i < n;i++) {
		cin >> iner[i];
		higher[i] = true;
	}
	for (int i = 0;i < m;i++) {
		int a, b;cin >> a >> b;
		if (iner[a - 1] > iner[b - 1])
			higher[b - 1] = false;
		else if (iner[a - 1] < iner[b - 1])
			higher[a - 1] = false;
		else if (iner[a - 1] == iner[b - 1]) {
			higher[a - 1] = false;
			higher[b - 1] = false;
		}

	}for (int i = 0;i < n;i++) {
		if (higher[i] == true)
			sum++;
	}cout << sum;
}


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

using ll = long long;

int main() {
    int A, B;
    cin >> A >> B;
    if ((A + B) % 2 == 0) cout << (A + B) / 2 << endl;
    else cout << "IMPOSSIBLE" << endl;
}

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

int main (){
      int k, n;
    string s;
    cin >> n >> k >> s;

    for(int i = 0;i < n; i++){
        if(i == k-1){
            s[i] = s[i]+32;
        }
    }

    cout << s;
    return 0 ;
}



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

int main(){

	int W = 0;
	int H = 0;
	int N = 0;
	int nowx,nowy;//現在位置
	int x = 0, y = 0;//次の目的地
	int ans = 0;

	scanf("%d %d %d",&W,&H,&N);//W,Hは使わない

	scanf("%d %d", &nowx, &nowy);//入力の最初は現座標に


	for (W = 1; W < N; W++){

		scanf("%d %d", &x, &y);//次の座標

			//ななめ移動

			//右上
			while ((nowx - x) < 0 && (nowy - y) < 0)
			{
				nowx++;
				nowy++;
				ans++;
			}
			//左下
			while ((nowx - x) > 0 && (nowy - y) > 0)
			{
				nowx--;
				nowy--;
				ans++;
			}

			//上下左右に調整
			ans += abs(nowx - x);
			nowx -= nowx - x;
			ans += abs(nowy - y);
			nowy -= nowy - y;
		
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 1028
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <cmath>
#include <queue>
#include <deque>
#include <set>
#include <iomanip>
#include <utility>
#define ll long long
#define ld long double
using namespace std;

ll sum[200010];

int main() {
	int N;
	cin >> N;
	for(int i=0; i<N; ++i){
		ll a;
		cin >> a;
		sum[i+1]=sum[i]+a;
	}
	ll ans=1e18;
	for(int i=1; i<=N; ++i){
		ans=min(ans, abs(sum[N]-sum[i]*2));
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1792
from collections import deque, namedtuple

Process = namedtuple('Process', 'name, time')

def main():
    n, q = map(int, input().split())
    dq = deque()
    for _ in range(n):
        name, time = input().split()
        dq.append(Process(name, int(time)))
    cur_time = 0
    while len(dq) > 0:
        x = dq.popleft()
        if x.time > q:
            dq.append(Process(x.name, x.time-q))
            cur_time += q
        else:
            cur_time += x.time
            print(x.name, cur_time)


if __name__ == '__main__':
    main()


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

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REPl(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define REPRl(i, n) for(ll i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < (int)n; i++)
#define FORl(i, m, n) for(ll i = m; i < (ll)n; i++)
#define ALL(v) v.begin(), v.end()
ll gcd(ll a,ll b) {
  return b? gcd(b,a%b): a;  
}
ll lcm(ll a,ll b) {
  return a*b/gcd(a,b);
}
bool isLowerCase(char c){
  return (c>='a'&&c<='z');
}
int main() {
  int n;cin>>n;
  string pre=n<1000?"ABC":"ABD";
  cout << pre<<endl;;
}


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

namespace ConsoleApp1
{
	class Program
	{
		static void Main(string[] args)
		{
			string input = Console.ReadLine();

			int num = input.Length - 3;
			List<int> data = new List<int>();

			for(int i = 0; i <= num; i++)
			{
				int n = int.Parse(input[i].ToString() + input[i+1].ToString() + input[i+2].ToString());
				data.Add(n);
			}

			int min = data.Min(x => Math.Abs( 753 - x ));

			
			Console.WriteLine(min);
		}
	}
}


Measured memory_bytes: 13396
#pragma GCC optimize(2,3,"Ofast")
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define db double
#define in inline
namespace fast_io
{
    char buf[1<<12],*p1=buf,*p2=buf,sr[1<<23],z[23],nc;int C=-1,Z=0,Bi=0,ny;
    in char gc() {return p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<12,stdin),p1==p2)?EOF:*p1++;}
    in int read()
    {
        int x=0;ny=1;while(nc=gc(),(nc<48||nc>57)&&nc!=EOF)if(nc==45)ny=-1;Bi=1;if(nc<0)return nc;
        x=nc-48;while(nc=gc(),47<nc&&nc<58&&nc!=EOF)x=(x<<3)+(x<<1)+(nc^48),Bi++;return x*ny;
    }
    in db gf() {int a=read(),y=ny,b=(nc!='.')?0:read();return (b?a+(db)b/pow(10,Bi)*y:a);}
    in int gs(char *s) {char c,*t=s;while(c=gc(),c<32);*s++=c;while(c=gc(),c>32)*s++=c;return s-t;}
    in void ot() {fwrite(sr,1,C+1,stdout);C=-1;}
    in void flush() {if(C>1<<22) ot();}
    template <typename T>
    in void write(T x,char t)
    {
        int y=0;if(x<0)y=1,x=-x;while(z[++Z]=x%10+48,x/=10);
        if(y)z[++Z]='-';while(sr[++C]=z[Z],--Z);sr[++C]=t;flush();
    }
    in void write(char *s) {int l=strlen(s);for(int i=0;i<l;i++)sr[++C]=*s++;sr[++C]='\n';flush();}
};
using namespace fast_io;
const int N=3e5+5,p=998244353;
int main()
{
	int a=read(),b=read(),c=read();
	if(a+b+c>=22) write("bust");
	else write("win");
	return ot(),0;
}
//Author: disangan233
//In my dream's scene,I can see the everything that in Cyaegha.

Measured memory_bytes: 256
#include "bits/stdc++.h"
#include "ext/pb_ds/assoc_container.hpp"
#include "ext/pb_ds/tree_policy.hpp"

using namespace std;
using namespace __gnu_pbds;

#define ll long long int
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(a) a.begin(),a.end()
int main(void)
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n, m;
    cin>>n>>m;
    if(m == n) {
    	cout<<"Yes\n";
    }
    else {
    	cout<<"No\n";
    }
}

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

using namespace std;

static inline int in(){ int x; scanf("%d", &x); return x; }

int main()
{
  int n = in();
  int am[12][256] = {};
  am[1]['>'] = 2;
  am[2]['\''] = 3;
  am[3]['='] = 4;
  am[4]['='] = 4;
  am[4]['#'] = 5;
  am[5]['='] = 5;
  am[5]['~'] = 6;
  am[2]['^'] = 7;
  am[7]['Q'] = 8;
  am[8]['='] = 9;
  am[9]['Q'] = 8;
  am[9]['~'] = 10;
  am[10]['~'] = 11;
  const int typeA = 6;
  const int typeB = 11;

  for (int i = 0; i < n; i++){
    string snake;
    cin >> snake;
    int aid = 1;
    int c4, c5;
    c4 = c5 = 0;
    for (int j = 0; j < snake.size(); j++){
      aid = am[aid][snake[j]];
      if (aid == 4) c4++;
      if (aid == 5) c5++;
    }
    if (aid == typeA && c4 == c5 - 1){
      puts("A");
    }
    else if (aid == typeB){
      puts("B");
    }
    else {
      puts("NA");
    }
  }
  return 0;
}

Measured memory_bytes: 1220
#include <bits/stdc++.h>
using namespace std;
int main(){
    int h,w;
    cin >> h >> w;
    vector <vector<char>> map(h+2,vector<char>(w+2,'#'));
    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++){
            cin >> map[i+1][j+1];
        }
    }
    for(int i = 0; i < map.size(); i++){
        for( int j = 0; j < map[i].size(); j++){
            cout << map[i][j];
        }
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 3584
innum = [int(x) for x in input().split()]

k = innum[0]
x = innum[1]

minim = int(max((x - k + 1), (-1000000)))
maxim = int(min((x + k - 1), 1000000))

result = ""

for i in range(minim, maxim + 1):
    result = result + " " + str(i)
print (result)

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <algorithm>
using namespace std;
typedef long long ll;
typedef vector<int> vi;

struct Square{
	int x;
	int y;
	int dist;
	Square(int _x, int _y, int _dist):
		x(_x), y(_y), dist(_dist){}
};

int main(){
	int H,W;
	cin >> H >> W;
	queue<Square> q;
	vector<vi> reached(H,vi(W,0));
	for(int i=0; i<H; i++){
		string s;
		cin >> s;
		for(int j=0; j<W; j++){
			if(s[j]=='#'){ //黒
				q.push(Square(j,i,0));
				reached[i][j]=1;
			}
		}
	}

	int max=0;
	while(!q.empty()){
		Square sq=q.front();
		q.pop();
		int nextx,nexty;
		for(int i=0; i<4; i++){
			switch(i){
				case 0: //上
					nexty=sq.y-1;
					nextx=sq.x;
					break;
				case 1: //下
					nexty=sq.y+1;
					nextx=sq.x;
					break;
				case 2: //左
					nexty=sq.y;
					nextx=sq.x-1;
					break;
				case 3: //右
					nexty=sq.y;
					nextx=sq.x+1;
					break;
			}

			if(nexty>=0 && nexty<H && nextx>=0 && nextx<W && reached[nexty][nextx]==0){
				Square next(nextx,nexty,sq.dist+1);
				q.push(next);
				reached[nexty][nextx]=1;
				if(max<next.dist){
					max=next.dist;
				}
			}
		}
	}

	cout << max << endl;
	return 0;
}

Measured memory_bytes: 16400
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Globalization;
using System.Diagnostics;
using static System.Console;
using Pair = System.Collections.Generic.KeyValuePair<int, int>;

class Program
{
    static void Main()
    {
        SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
        new Program().Solve();
        Out.Flush();
    }
    Scanner cin = new Scanner();
    Random rnd = new Random();
    Stopwatch sw = new Stopwatch();
    readonly int[] dd = { 0, 1, 0, -1, 0 };
    readonly int mod = 1000000007;
    readonly string alfa = "abcdefghijklmnopqrstuvwxyz";


    void Solve()
    {
        int N = cin.Nextint;
        int K = 2 * N - 1;
        int x = cin.Nextint;
        if (x == 1 || x == K)
        {
            WriteLine("No");
            return;
        }
        WriteLine("Yes");
        var A = new int[K];
        A[N - 2] = x - 1;
        A[N - 1] = x;
        A[N] = x + 1;
        int cnt = 0;
        for (int i = 1; i <= K; i++)
        {
            if (i == x - 1 || i == x || i == x + 1) continue;
            if (cnt == N - 2) cnt = N + 1;
            A[cnt++] = i;
        }
        foreach (var v in A)
        {
            WriteLine(v);
        }

    }

}

class Scanner
{
    string[] s; int i;
    char[] cs = new char[] { ' ' };
    public Scanner() { s = new string[0]; i = 0; }
    public string[] Scan { get { return ReadLine().Split(); } }
    public int[] Scanint { get { return Array.ConvertAll(Scan, int.Parse); } }
    public long[] Scanlong { get { return Array.ConvertAll(Scan, long.Parse); } }
    public double[] Scandouble { get { return Array.ConvertAll(Scan, double.Parse); } }
    public string Next
    {
        get
        {
            if (i < s.Length) return s[i++];
            string st = ReadLine();
            while (st == "") st = ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            i = 0;
            return Next;
        }
    }
    public int Nextint { get { return int.Parse(Next); } }
    public long Nextlong { get { return long.Parse(Next); } }
    public double Nextdouble { get { return double.Parse(Next); } }
}

Measured memory_bytes: 17112
def solve():
    N = int(input())
    a = [int(x) for x in input().split()]

    import collections
    count = collections.Counter(a)

    valid = {k: v for k, v in count.items() if v >= 2}

    # print(valid)

    m = sorted(valid.items(), reverse=True)

    if len(valid) == 0:
        return 0
    elif m[0][1] >= 4:
        return m[0][0] ** 2
    elif len(valid) >= 2:
        return m[0][0] * m[1][0]
    else:
        return 0


def main():
    print(solve())


if __name__ == '__main__':
    main()

Measured memory_bytes: 18444