akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<vector>
#include<functional>
#include<iomanip>
#include<queue>
#include<cassert>
#include<tuple>
#include<set>
#include<map>
#include<list>

#define PB push_back
#define ALL(a)  (a).begin(),(a).end()
#define DWN(a)  (a).begin(),(a).end(), greater<int>()
#define rep(i, m) for (int i = 0; i < m; i++)
#define REP(i, n, m) for (int i = n; i < m; i++)

#define mod 1000000007

using namespace std;

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

const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };
const int INF = (int)1e9;

/*
pが素数なら a^(p-1)≡1(mod p)
よって a^(p-2)≡a^(-1)(mod p)
aで割るときa^(p-2)掛ける
*/

ll calc(ll a, ll b) { //a^bの計算
	if (b == 0) return 1;
	if (b % 2 == 0) { //bが偶数なら (b/2)*(b/2)
		ll d = calc(a, b / 2);
		return (d * d) % mod;
	}
	else { //bが奇数なら a*a^(b-1) 偶数にして計算
		return a * calc(a, b - 1) % mod;
	}
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	string s;
	cin >> s;
	int a = 0, b = 0, c = 0;
	rep (i, s.size()) {
		if (s[i] == 'a') a++;
		if (s[i] == 'b') b++;
		if (s[i] == 'c') c++;
	}
	if (a == 1 && b == 1 && c == 1) {
		cout << "Yes\n";
	}
	else {
		cout << "No\n";
	}
}

Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
int A[10];
int main(){
	for (int i=1;i<=7;i++) scanf("%d",&A[i]);
	long long ans=A[2];
	long long num=(1ll*A[1]/2+A[4]/2+A[5]/2)*2;
	if (A[1]&&A[4]&&A[5]) num=max(num,3+1ll*(A[1]-1)/2*2+(A[4]-1)/2*2+(A[5]-1)/2*2);
	cout<<ans+num<<endl;
	return 0;
}

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

using ll = long long int;

const int MAX = (int)(1e5 + 5);
const ll INF = (ll)(1e10 + 5);

int m;
ll k;

int main(void) {
  // Here your code !
  scanf("%d", &m);
  scanf("%lld", &k);

  if (k >= 1LL << m) {
    printf("%d\n", -1);

    return 0;
  }

  if (m == 1) {
    if (k == 1) {
      printf("%d\n", -1);
    }
    else {
      printf("0 0 1 1\n");
    }

    return 0;
  }

  vector<ll> base;

  for (ll i = 0; i < 1LL << m; ++i) {
    base.push_back(i);
  }

  for (auto e: base) {
    if (e == k) continue;

    printf("%lld ", e);
  }

  printf("%lld ", k);

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

  for (auto e: base) {
    if (e == k) continue;

    printf("%lld ", e);
  }

  printf("%lld ", k);

  printf("\n");

  return 0;
}


Measured memory_bytes: 2932
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<cstdlib>
using namespace std;
inline int read()
{
    int x=0,f=1;char ch=getchar();
    while(ch<'0' || ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0' && ch<='9')x=x*10+ch-'0',ch=getchar();
    return x*f;
}
inline void write(int x)
{
    if(x<0)putchar('-'),x=-x;
    if(x>9)write(x/10);
    putchar(x%10+'0');
}
inline void pr1(int x){write(x),putchar(' ');}
inline void pr2(int x){write(x),puts("");}
int main()
{
    //freopen("a.in","r",stdin);
    //freopen("a.out","w",stdout);
    int a=read(),b=read();
    pr2(max(max(a+b,a-b),a*b));
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <cstdint>
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <vector>

using namespace std;

const int M = 1e5;
const int INF = 1e9 + 5;
int grid[M] = {0};
int dp[M];

int main() {
    int n, k, temp, m;
    cin >> n >> k;
    memset(dp, 0, M);

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

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

    for (int i = 2; i < n; i++){
        m = INF;
        temp = 3;
        while (temp <= k && temp <= i) {
            (abs(grid[i - temp] - grid[i]) + dp[i - temp]) <= m ? m = abs(grid[i - temp] - grid[i]) + dp[i - temp] : m;
            // cout << m << " ";
            temp++;
        }
        
        (k > 1) ?
        dp[i] += min({abs(grid[i - 1] - grid[i]) + dp[i - 1], 
                      abs(grid[i - 2] - grid[i]) + dp[i - 2],
                      m})
                :
        dp[i] += abs(grid[i - 1] - grid[i]) + dp[i - 1], 
                      m;
    }

        cout << dp[n - 1];

    return 0;
}



Measured memory_bytes: 1024
type=["S","H","C","D"]
ans=[[i,str(j)] for i in type for j in range(1,14,1)]

N=int(input())
for k in range(N):
    card=list(map(str, input().split()))
    ans.remove(card)

for l in range(52-N):
    print(*ans[l])


Measured memory_bytes: 5600
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
using namespace std;

const int MOD=1000000007;
const int N=200005;

int n,f[N],s[N],stack[N],lef[N],rig[N];
struct data{int x,v;}a[N];
struct Interval{int l,r;}itv[N];

int read()
{
    int x=0,f=1;char ch=getchar();
    while (ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while (ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}

bool cmp(data a,data b)
{
    return a.v<b.v;
}

bool cmp1(Interval a,Interval b)
{
    return a.r<b.r||a.r==b.r&&a.l<b.l;
}

int main()
{
    n=read();
    for (int i=1;i<=n;i++) a[i].x=read(),a[i].v=read();
    sort(a+1,a+n+1,cmp);
    int top=0;
    for (int i=1;i<=n;i++)
    {
        if (!top||a[i].x>a[stack[top]].x) stack[++top]=i;
        int l=1,r=top;
        while (l<=r)
        {
            int mid=(l+r)/2;
            if (a[stack[mid]].x>=a[i].x) r=mid-1;
            else l=mid+1;
        }
        lef[i]=stack[r+1];
    }
    top=0;
    for (int i=n;i>=1;i--)
    {
        if (!top||a[i].x<a[stack[top]].x) stack[++top]=i;
        int l=1,r=top;
        while (l<=r)
        {
            int mid=(l+r)/2;
            if (a[stack[mid]].x<=a[i].x) r=mid-1;
            else l=mid+1;
        }
        rig[i]=stack[r+1];
    }
    for (int i=1;i<=n;i++) itv[i].l=lef[i],itv[i].r=rig[i];
    sort(itv+1,itv+n+1,cmp1);
    int now=1,ans=0;
    for (int i=1;i<=n;i++)
    {
        while (itv[now].r<itv[i].l-1) now++;
        f[i]=(s[i-1]+MOD-s[now-1])%MOD;
        if (itv[i].l==1) f[i]++;
        if (itv[i].r==n) (ans+=f[i])%=MOD;
        s[i]=(s[i-1]+f[i])%MOD;
    }
    printf("%d",ans);
    return 0;
}

Measured memory_bytes: 7296
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static System.Math;
using MethodImplAttribute = System.Runtime.CompilerServices.MethodImplAttribute;
using MethodImplOptions = System.Runtime.CompilerServices.MethodImplOptions;

public static class P
{
    public static void Main()
    {
        Console.WriteLine((int.Parse(Console.ReadLine()) + 1) / 2);
    }
}


Measured memory_bytes: 11092
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#include <numeric>
typedef long long Int;
#define rep(i,a,b) for(Int i=a;i<b;++i)
#define rrep(i,a,b) for(Int i=a;i>=b;--i)
using namespace std;

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

    int x1, y1, x2, y2; cin >> x1 >> y1 >> x2 >> y2;
    int dx = x2-x1; int dy = y2-y1;
    int x3 = x2 - dy; int y3 = y2 + dx;
    int x4 = x1 - dy; int y4 = y1 + dx;
    printf("%d %d %d %d\n", x3, y3, x4, y4);
}


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

/*

#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

*/

int main() {

#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	int n, k;
	cin >> n >> k;
	vector<int> a(n + 1, 0);
	for (int i = 1; i <= n; i++)
		cin >> a[i];
	vector<vector<long long>> dp(n + 1, vector<long long>(k + 1, 0));

	for (int i = 0; i <= k; i++)
		dp[1][i] = (i <= a[1]) ? 1 : 0;

	for (int i = 2; i <= n; i++) {
		for (int j = 0; j <= k; j++) {
			if (j == 0)
				dp[i][j] = dp[i - 1][j];
			else
				dp[i][j] = (mod + dp[i][j - 1] + dp[i - 1][j] - ((j - 1 - a[i]) >= 0 ? dp[i - 1][j - 1 - a[i]] : 0) ) % mod;
		}
	}
	/*for (int i = 1; i <= n; i++) {
		for (int j = 0; j <= k; j++) {
			cout << dp[i][j] << " ";
		}
		cout << endl;
	}*/

	cout << dp[n][k] << endl;
	return 0;
}



Measured memory_bytes: 83164
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
template <class T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return true;
    }
    return false;
}
template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return true;
    }
    return false;
}
using ll = long long;
const ll MOD = 1e9 + 7;
const long long INF = 1LL << 60;

int main()
{
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a.at(i);

    set<int> st;
    rep(i, n)
    {
        st.insert(a.at(i));
    }

    if (int(st.size()) == n)
    {
        cout << "YES" << endl;
    }
    else
    {
        cout << "NO" << endl;
    }
}

Measured memory_bytes: 10368
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int x = sc.nextInt();
		int z = 0;
		for(int i=0;i<n;i++) {
			z += sc.nextInt();
			if(z >x) {
				System.out.println(i+1);
				System.exit(0);
			}
			if(i==n-1) {
				System.out.println(i+2);
				System.exit(0);
			}
		}
	}

}


Measured memory_bytes: 21844
#include <iostream>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)




int main() {
	int S;
	cin >> S;
	if (0<(S / 100 )&& (S / 100) < 13 && S%100>0&&S % 100 < 13) {
		cout << "AMBIGUOUS" << endl;
	}
	else if (S % 100 > 0 && S % 100 < 13) {
		cout << "YYMM" << endl;
	}
	else if(0 < (S / 100) && (S / 100) < 13){
		cout << "MMYY" << endl;
	}
	else {
		cout << "NA" << endl;
	}
}

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

    public static void main(String[] args) {
        Scanner input=new Scanner(System.in);
        int z,x,c;
        z=input.nextInt();
        x=input.nextInt();
        c=((z*x)+(z+x)+1)-(((z+1)*2)+((x-1)*2));
        System.out.println(c);
    }
    
}


Measured memory_bytes: 26832
#include <bits/stdc++.h>
using namespace std;
// #define int long long   // <-----!!!!!!!!!!!!!!!!!!!

#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n)-1;i>=0;i--)
#define rrep2(i,a,b) for (int i=(a)-1;i>=b;i--)
#define chmin(a,b) (a)=min((a),(b));
#define chmax(a,b) (a)=max((a),(b));
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define printV(v) cerr<<(#v)<<":";for(auto(x):(v)){cerr<<" "<<(x);}cerr<<endl;
#define printVS(vs) cerr<<(#vs)<<":"<<endl;for(auto(s):(vs)){cerr<<(s)<< endl;}
#define printVV(vv) cerr<<(#vv)<<":"<<endl;for(auto(v):(vv)){for(auto(x):(v)){cerr<<" "<<(x);}cerr<<endl;}
#define printP(p) cerr<<(#p)<<(p).first<<" "<<(p).second<<endl;
#define printVP(vp) cerr<<(#vp)<<":"<<endl;for(auto(p):(vp)){cerr<<(p).first<<" "<<(p).second<<endl;}

inline void output(){ cerr << endl; }
template<typename First, typename... Rest>
inline void output(const First& first, const Rest&... rest) {
    cerr << first << " "; output(rest...);
}

using ll = long long;
using Pii = pair<int, int>;
using TUPLE = tuple<int, int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
// const int inf = 1ll << 60;
const int inf = 1e9;
const int mod = 1e9 + 7;
using Graph = vector<vector<int>>;

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

    int T;
    cin >> T;
    rep(t, T) {
        vi a;
        int x;
        while (cin >> x, x != 0) {
            a.emplace_back(x);
        }
        int L = a.size();
        vi deg;
        rep(i, L) {
            if (a[i] > 0) {
                deg.emplace_back(a[i]);
            }
        }
        int n = deg.size();
        Graph G(n);
        vi prev(n, -1);
        int now = 0;
        int nxt = 1;

        auto addEdge = [&](int x, int y) {
            G[x].emplace_back(y);
            G[y].emplace_back(x);
            deg[x]--;
            deg[y]--;
        };

        function<int(int,int)> Prev = [&](int x, int c) {
            if (c == 0) return x;
            return Prev(prev[x], c - 1);
        };

        rep2(i, 1, L) {
            if (a[i] > 0) {
                addEdge(now, nxt);
                prev[nxt] = now;
                now = nxt;
                nxt++;
            }
            else {
                addEdge(now, Prev(now, -a[i]));
            }

            while (now != 0 && deg[now] == 0) {
                now = prev[now];
            }
        }

        rep(i, n) {
            sort(all(G[i]));
            cout << i + 1;
            for (auto x : G[i]) {
                cout << " " << x + 1;
            }
            cout << endl;
        }

    }
}

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

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

  ll N; cin >> N;
  ll K; cin >> K;
  ll r = N % K;
  ll ans = min(r, K - r);
  cout << ans << '\n';
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;i++)
#define MOD 1000000007
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3f
#define EPS (1e-10)
using namespace std;
typedef long long ll;
typedef pair<int,int>P;

signed main(){
	string s;cin>>s;
	rep(i,s.size()-1){
		if(s[i]=='A'&&s[i+1]=='C'){
			puts("Yes");return 0;
		}
	}
	puts("No");
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define LL long long
#define Max 100005
#define Mod 1e9+7
const LL mod=1e9+7;
const LL inf=0x3f3f3f3f;
using namespace std;
int main()
{
	int n,m,k,t;
	map<int,int>M;
	scanf("%d%d",&n,&m);
	for(int i=0;i<n;i++)
	{
		scanf("%d",&k);
		for(int j=0;j<k;j++)
		{
			scanf("%d",&t);
			M[t]++;
		}
	}
	int ans=0;
	for(int i=1;i<=m;i++)
		if(M[i]==n)
			ans++;
	printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#define min(X, Y) ((X) < (Y) ? (X) : (Y))
#define max(X, Y) ((X) > (Y) ? (X) : (Y))
typedef long long ll;

const ll mod = (ll)(1e9) + 7;

ll n;
ll len;
char str[5005];
ll dp[5005][5005];

ll solve(ll st_i, ll op_i);

int main()
{
    //init
    for (int i = 0; i <= 5000; i++) {
        for (int j = 0; j <= 5000; j++) {
            dp[i][j] = -1;
        }
    }
    
    scanf("%lld", &n);
    scanf("%s", str);

    len = (ll)strlen(str);

    printf("%lld\n", solve(0, 0));
    
    return 0;
}

ll solve(ll st_i, ll op_i)
{
    if (st_i == len && op_i == n) {
        return 1;
    }
    else if (op_i >= n) {
        return 0;
    }

    if (dp[st_i][op_i] != -1) {
        return dp[st_i][op_i];
    }

    dp[st_i][op_i] = solve(st_i + 1, op_i + 1);

    if (st_i > 0) {
        dp[st_i][op_i] += solve(st_i - 1, op_i + 1) * 2;
    }
    else {
        dp[st_i][op_i] += solve(0, op_i + 1);
    }

    dp[st_i][op_i] %= mod;

    return dp[st_i][op_i];
}


Measured memory_bytes: 195840
#include <bits/stdc++.h>
using namespace std;
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define int long long
#define ld long double
#define fi first
#define se second
#define all(uiet) uiet.begin(),uiet.end()
#define read(UIET) for(int i = 0; i < n; ++i) cin >> UIET[i]
#define out(UIET) for(int i = 0; i < n; ++i) cout << UIET[i]
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define vpp vector<pair< int, int > >
#define pll pair<int , int >
#define ppll pair < pll , pll >
#define debug(n1) cout << n1 << endl
#define len(a) ((int) (a).size())
#define endl "\n"
#define mod 1000000007
const int INF=(1LL<<60)-1;
const int MAXN = 1000001;
int32_t main(){
    SPEED;
    int x;
    cin >> x;
    int rem = x % 100;
    int div = x / 100;
    if(rem <= 5 * div) cout << 1 ;
    else cout << 0 ;
}

Measured memory_bytes: 3524
#include <iostream>
#include <sstream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#include <map>

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

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

using namespace std;

const ll BIG = 1000000007LL;

int inputValue(){
    int a;
    cin >> a;
    return a;
};

template<typename T>
void inputArray(T* p, int a){
    rep(i, a){
        cin >> p[i];
    }
};

template<typename T>
void inputVector(vector<T> * p, int a){
    rep(i, a){
        T input;
        cin >> input;
        p -> push_back(input);
    }
}

template <typename T>
void output(T a, int precision = 0) {
    if(precision > 0){
        cout << setprecision(precision)  << a << "\n";
    }
    else{
        cout << a << "\n";
    }
}

const int Max = 110000;
int N;
int d[Max];

int main(int argc, const char * argv[]) {
    cin >> N;
    inputArray(d, N);
    sort(d, d+N);

    int h2 = d[N/2];
    int h1 = d[N/2-1];
    output(h2-h1);

    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int n,W,ans;
int w[110],v[110],f[110][110][310];
int main()
{
	//freopen("tt.in","r",stdin);
	scanf("%d%d",&n,&W);
	for(int i=1;i<=n;i++)
		scanf("%d%d",&w[i],&v[i]);
	int t=w[1];
	for(int i=1;i<=n;i++)w[i]-=t;
	for(int i=1;i<=n;i++)
		for(int j=1;j<=n;j++)
			for(int k=0;k<=n*3;k++)
			{
				f[i][j][k]=f[i-1][j][k];
				if(k>=w[i])f[i][j][k]=max(f[i][j][k],f[i-1][j-1][k-w[i]]+v[i]);
			}
	for(int i=1;i<=n;i++)
		for(int j=0;j<=i*3&&j<=W-(ll)t*i;j++)
			ans=max(ans,f[n][i][j]);
	printf("%d\n",ans);
	return 0;
}



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

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define inf 1e18
#define ceill(a, b) (a+b-1)/b
#define ok cout << "ok" << endl;
#define sp << " " <<
ll mod = 1e9+7;
void ans(bool b, ostream& out=cout){ out << (b ? "Yes" : "No") << endl; }
void ans2(bool b, ostream& out=cout){ out << (b ? "YES" : "NO") << endl; }
template<typename T> inline bool chmax(T &a, T b){ if(a<b) a=b; return a<b; }
template<typename T> inline bool chmin(T &a, T b){ if(b<a) a=b; return b<a; }
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val){fill((T*)array, (T*)(array+N), val);}
int dx[] = {1, 0, -1, 0, 1, -1, 1, -1};
int dy[] = {0, 1, 0, -1, 1, -1, -1, 1};

#ifndef INCLUDE_DEBUG_HPP
#define INCLUDE_DEBUG_HPP

class debug
{
public:
    template<typename T> void vdeb(T vec);
    template<typename T1, typename T2> void adeb(T1 *arr, T2 n);
    template<typename T> void mdeb(T mp);
};

#endif //INCLUDE_DEBUG_HPP

template<typename T> void debug::vdeb(T vec)
{
    cout << "#vector set debug" << endl;
    for(auto vv : vec) cout << vv << " ";
    cout << endl;
}

template<typename T1, typename T2> void debug::adeb(T1 *arr, T2 n)
{
    cout << "#adebug" << endl;
    for(int i=0; i<=n; i++) cout << arr[i] << " ";
    cout << endl;
}

template<typename T> void debug::mdeb(T mp)
{
    cout << "#map pair debug" << endl;
    for(auto const& m : mp) cout << m.first sp m.second << endl;
}
debug dbg;

class BDigitSums {
public:
	void solve(std::istream& in, std::ostream& out)
	{
	    ll n;
	    in >> n;
	    ll bufn = n;
	    ll sum = 0;
	    while(bufn > 0){
            sum += bufn%10;
            bufn /= 10;
	    }

	    ans(n%sum==0, out);
	}
};


int main() {
	BDigitSums solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(){
	int n,k;
	scanf("%d%d",&n,&k);
	int a[200020];
	for(int i=0;i<n;i++){
		scanf("%d",&a[i]);
	}
	for(int i=0;i<n-k;i++){
		if(a[i]<a[i+k])
		printf("Yes\n");
		else
		printf("No\n");
	}
	return 0;
}

Measured memory_bytes: 3948
#define _USE_MATH_DEFINES
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<queue>

using ll = long long;

using namespace std;

ll mod=1e9+7;

int main() {
	ll x,y;
	cin>>x>>y;
	int ans=0;
	while(x<=y){
		x*=2;
		ans++;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3648
#include <iostream>
#include <algorithm>
#include <queue>
#include <vector>

using namespace std;

int main() {
    int n;
    cin >> n;
    long long int a0 = 2;
    long long int a1 = 1;
    for(int i = 2; i <= n; i++) {
        long long int tmp = a1;
        a1 = a0 + a1;
        a0 = tmp;
    }
    cout << a1 << endl;
}

Measured memory_bytes: 256
/* Simplicity and Goodness */

#include <bits/stdc++.h>
#define ll long long
#define scn(n) scanf("%d",&n)
#define lscn(n) scanf("%lld",&n)
#define lpri(n) printf("%lld ",n)
#define pri(n) printf("%d ",n)
#define prin(n) printf("%d\n",n)
#define lprin(n) printf("%lld\n",n)
#define rep(i,ini,n) for(int i=ini;i<int(n);i++)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define inf INT_MAX
#define ninf INT_MIN
using namespace std;
const ll mod = 998244353;
const int N = 2e5+2; 

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

    int c1 = 0, c2 = 0;

    rep(i, 0, int(s.size()))
    {
        if(i & 1)
        {
            if(s[i] != 'i')
            {
                printf("No");
                return 0;
            }
            else
            c2 ++;
        }
        else
        {
            if(s[i] != 'h')
            {
                printf("No");
                return 0;
            }
            else
            c1 ++;
        } 
    }

    if(c1 != c2)
    printf("No");
    else
    printf("Yes");
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

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

  int cost1=0;
  int cost2=0;
  int a;
  for(int k=0; k<m; k++){
    scanf("%d",&a);
    for(int i=0; i<=x; i++){
      if(i==a){
        cost1++;
      }
    }
    

    for(int j=x; j<=n; j++){
        if(j==a){
        cost2++;
      }
    }
  }

  if(cost1>cost2){
    printf("%d",cost2);
  }else{
    printf("%d",cost1);   
  }

    return 0;

}


Measured memory_bytes: 128
import java.util.Scanner;
import java.util.Arrays;
public class Main {
    public static int a,b;
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while(true){
            a=sc.nextInt();
            b=sc.nextInt();
            if(a==0&&b==0) break;
            for(int i=0;i<a;i++){
                for(int j=0;j<b;j++){
                    System.out.print("#");
                }
                System.out.print("\n");
            }
            System.out.print("\n");
        }
        sc.close();
    }
}


Measured memory_bytes: 37860
import itertools

#設定
import sys
input = sys.stdin.buffer.readline

#ライブラリインポート
from collections import defaultdict

#入力受け取り
def getlist():
	return list(map(int, input().split()))

#処理内容
def main():
	N = int(input())
	L = []
	for i in range(N):
		x, y = getlist()
		L.append([x, y])
	X = [i for i in range(N)]
	Z = list(itertools.permutations(X))
	#print(Z)
	s = 0
	for i in range(len(Z)):
		for j in range(N - 1):
			x1 = L[Z[i][j]][0]
			y1 = L[Z[i][j]][1]
			x2 = L[Z[i][j + 1]][0]
			y2 = L[Z[i][j + 1]][1]
			s += ((x1 - x2) ** 2 + (y1 - y2) ** 2) ** 0.5
	z = 1
	for i in range(N):
		z *= i + 1
	ans = s / z
	print(ans)

if __name__ == '__main__':
	main()

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

long long x,r;

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

    cin>>x;
    r+=(x/11)*2;
    x-=(x/11)*11;
    if(x==0)
        cout<<r<<endl;
    else
    {
        if(x<=6)
            cout<<r+1<<endl;
        else
            cout<<r+2<<endl;
    }

    return 0;
}


Measured memory_bytes: 3656
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string a;
  cin>>a;
  int b=0;
  for(int i=0;i<a.size();i++){
    b=b+(a.at(i)-'0');
  }
  if(b%9==0){
    cout<<"Yes";
  }else{
    cout<<"No";
  }
}

Measured memory_bytes: 3712
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define fi first
#define se second
long long mo = 1e9 + 7;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
typedef pair<ll,Pll> PlP;
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
template<class A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}cout << "\n";}
ld PI=3.14159265358979323846;

int main(){
    ll a,b,c,d;
    string S;
    cin >> a >> b >> c >> d;
    ll M1 = a*c;
    ll M2 = b*d;
    ll M3 = a*d;
    ll M4 = b*c;
    ll ans = max(max(M1,M2), max(M3,M4));
    cout << ans << endl;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define pb push_back
using namespace std;
typedef long long ll;
const int N = 1e5 + 5;
int main() {
    ios_base::sync_with_stdio(false);
    int n, W;
    cin >> n >> W;
    vector < ll > DP(W + 5, -2e9), weights(n + 5), values(n + 5);
    // DP[i] --> max value for weight i
    for (int i = 1; i <= n; i++) {
      cin >> weights[i] >> values[i];
    }
    DP[0] = 0;
    for (int i = 1; i <= n; i++) {
      for (int last_weight = W - weights[i]; last_weight >= 0; last_weight--) {
        if (DP[last_weight] == -2e9) continue;
        DP[last_weight + weights[i]] = max(DP[last_weight + weights[i]], DP[last_weight] + values[i]);
      }
    }
    ll ans = -2e9;
    for (int i = 0; i <= W; i++) {
      ans = max(ans, DP[i]);
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define dd double
#define endl "\n"
#define pb push_back
#define all(v) v.begin(),v.end()
#define mp make_pair
#define fi first
#define se second
#define vll vector<ll>
#define pll pair<ll,ll>
#define fo(i,n) for(int i=0;i<n;i++)
#define fo1(i,n) for(int i=1;i<=n;i++)
ll mod=1000000007;
ll n,k,t,m,q,flag=0;
ll power(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
// #include <ext/pb_ds/assoc_container.hpp> 
// #include <ext/pb_ds/tree_policy.hpp> 
// using namespace __gnu_pbds; 
// #define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
// ordered_set s ; s.order_of_key(a) -- no. of elements strictly less than a
// s.find_by_order(i) -- itertor to ith element (0 indexed)
ll min(ll a,ll b){if(a>b)return b;else return a;}
ll max(ll a,ll b){if(a>b)return a;else return b;}
ll gcd(ll a , ll b){ if(b > a) return gcd(b , a) ; if(b == 0) return a ; return gcd(b , a%b) ;}
int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    #ifdef NOOBxCODER
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #else 
    #define NOOBxCODER 0
    #endif
    //cin>>t;
    t=1;
    while(t--){
        cin>>n;
        ll a[n+1];
        ll sum=0;
        fo(i,n+1)cin>>a[i],sum+=a[i];
        if(a[0]==1 && sum==1)cout<<1;
        else if(a[0]==1)cout<<-1;
        else if(a[0]>1)cout<<-1;
        else{
            ll no=0;
            ll maxi[n+1];
            maxi[0]=1;
            flag=0;
            fo1(i,n){
                if(a[i]>2*maxi[i-1])flag=1;

                maxi[i]=2*maxi[i-1]-a[i];
                maxi[i]=min(maxi[i], 1e16);
                //cout<<maxi[i]<<" ";
            }
            if(flag==1){cout<<-1;  return 0;}
            ll temp;
            for(int i=n;i>=0;i--){
                if(i==n)no+=a[i],temp=a[i];
                else{
                    no+=min(temp , maxi[i] ) + a[i];
                    temp=min(temp , maxi[i] ) + a[i];
                }

            }
            cout<<no;

        }





        
    }
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
    return 0;
}


Measured memory_bytes: 5328
#include <iostream>
using namespace std;
int main(){
    string s,t;
    int i,num1[26],num2[26];
    cin >> s >> t;
    for (i=0;i<26;i++){
        num1[i]=-1;
        num2[i]=-1;
    }
    int len=s.size();
    for (i=0;i<len;i++){
        if (num1[s[i]-'a']==-1)
            num1[s[i]-'a']=t[i]-'a';
        else{
            if (num1[s[i]-'a']!=t[i]-'a'){
                cout << "No" << endl;
                return 0;
            }
        }
    }
    for (i=0;i<len;i++){
        if (num2[t[i]-'a']==-1)
            num2[t[i]-'a']=s[i]-'a';
        else{
            if(num2[t[i]-'a']!=s[i]-'a'){
                cout << "No" << endl;
                return 0;
            }
        }
    }
    cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 776
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
#include <complex>
using namespace std;

typedef long long ll;
typedef uint64_t ull;
typedef pair<int, int> P;
constexpr double EPS = 1e-9;
constexpr int INF = 1001001001;
constexpr int mod = 1000000007;
// constexpr int mod = 998244353;

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

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

    int n;
    cin >> n;
    vector<int> a(n);
    for(int i = 0; i < n; ++i){
        cin >> a[i];
        a[i] -= i + 1;
    }
    sort(a.begin(), a.end());
    int median = a[n >> 1];
    ll ans = 0;
    for(int x : a)  ans += abs(x - median);
    cout << ans << endl;
}

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

const int MOD = 1000000007;

//long long
using ll = long long;

//出力系
#define print(x) cout << x << endl
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
 
// begin() end()
#define all(x) (x).begin(),(x).end()

//for
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)

//最大公約数 
unsigned gcd(unsigned a, unsigned b) {
  if(a < b) return gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}



  
int main() {

int N;
cin >> N;

int T, A;
cin >> T >> A;

vector<double>H(N);
REP(i, N) cin >> H.at(i);

double now = 100000;
int ans;
REP(i, N){
  if (now > abs(A - (T - H.at(i) * 0.006))) {
    ans = i + 1;
    now = abs(A - (T - H.at(i) * 0.006));
  }
}

print(ans);
}

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

#define dump(...) do{print_vars(cout<<"# "<<#__VA_ARGS__<<'=',__VA_ARGS__);cout<<endl;}while(0)
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define peri(i,a,b) for(int i=int(b);i-->int(a);)
#define rep(i,n) repi(i,0,n)
#define per(i,n) peri(i,0,n)
#define all(c) begin(c),end(c)
#define mp make_pair
#define mt make_tuple

using uint=unsigned;
using ll=long long;
using ull=unsigned long long;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using vd=vector<double>;
using vvd=vector<vd>;
using vs=vector<string>;

template<typename T,typename U>bool chmin(T& a,const U& b){return a>b?(a=b,1):0;}
template<typename T,typename U>bool chmax(T& a,const U& b){return a<b?(a=b,1):0;}

void print_vars(ostream&){}
template<typename Car,typename... Cdr>
void print_vars(ostream& os,const Car& car,const Cdr&... cdr){
	print_vars(os<<car<<(sizeof...(cdr)?",":""),cdr...);
}

template<typename T1,typename T2>
ostream& operator<<(ostream& os,const pair<T1,T2>& p){
	return os<<'('<<p.first<<','<<p.second<<')';
}

template<int I,typename Tuple>
void print_tuple(ostream&,const Tuple&){}
template<int I,typename Car,typename... Cdr,typename Tuple>
void print_tuple(ostream& os,const Tuple& t){
	os<<get<I>(t)<<(sizeof...(Cdr)?",":"");
	print_tuple<I+1,Cdr...>(os,t);
}
template<typename... Args>
ostream& operator<<(ostream& os,const tuple<Args...>& t){
	print_tuple<0,Args...>(os<<'(',t);
	return os<<')';
}

template<typename Ch,typename Tr,typename C>
basic_ostream<Ch,Tr>& operator<<(basic_ostream<Ch,Tr>& os,const C& c){
	os<<'[';
	for(auto i=begin(c);i!=end(c);++i)
		os<<(i==begin(c)?"":" ")<<*i;
	return os<<']';
}

constexpr int INF=1e9;
constexpr int MOD=1e9+7;
constexpr double EPS=1e-9;

int main()
{
	#ifndef _GLIBCXX_DEBUG
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	constexpr char endl='\n';
	#endif

	for(int n;cin>>n&&n;){
		vi a(n);
		rep(i,n) cin>>a[i];
		int sum=accumulate(all(a),0);
		int res=0;
		rep(i,n){
			int x=abs(a[res]*n-sum);
			int y=abs(a[i]*n-sum);
			if(x>y)
				res=i;
		}
		cout<<res<<endl;
	}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll mod = 1000000007;
const int INF = 1001001001;

template<class Type>
Type modpow(Type a, Type n, Type mod)
{
	Type res = 1;
	while (0 < n) {
		if (n & 1) {
			res = res * a % mod;
		}
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}

template<class Type>
Type gcd(Type x, Type y)
{
	Type r;
	if (x < y) swap(x, y);

	while (0 < y) {
		r = x % y;
		x = y;
		y = r;
	}
	return x;
}

template<class Type>
Type lcm(Type x, Type y)
{
	return x * y / gcd(x, y);
}

template<class Type>
bool is_prime(Type x)
{
	if (x == 2) return true;
	if (x < 2 || x % 2 == 0) return false;

	for (Type i = 3; i <= sqrt(x); i += 2) {
		if (x % i == 0) return false;
	}
	return true;
}

template<class Type>
vector<bool> eratos(Type n)
{
	vector<bool> isPrime(n + 1, true);
	isPrime[0] = isPrime[1] = false;
	for (Type i = 2; i <= n; i++) {
		if (isPrime[i]) {
			Type j = i + i;
			while (j <= n) {
				isPrime[j] = false;
				j = j + i;
			}
		}
	}
	return isPrime;
}

bool binary_search_judge(vector<int> a, int index, int key)
{
	if (key <= a[index]) return true;
	else return false;
}

int binary_search(vector<int> a, int key)
{
	int ng = -1;
	int ok = a.size();
	while (1 < abs(ng - ok)) {
		int mid = (ng + ok) / 2;
		if (binary_search_judge(a, mid, key)) ok = mid;
		else ng = mid;
	}
	return a[ok] == key;
}

int main()
{
	int n;
	cin >> n;
	int ans = 0;
	int active = 0;
	for (int i = 0; i < n; i++) {
		int h;
		cin >> h;

		if (h < active) active = h;
		else {
			ans += h - active;
			active = h;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
import Control.Monad
import Text.Printf

infixl 0 `dot`
dot :: (c -> d) -> (a -> b -> c) -> a -> b -> d
dot = ((.).(.))

main :: IO ()
main = do
  forM_ [1..9] $ \i -> do
    forM_ [1..9] $ \j -> do
      printf "%dx%d=%d\n" (i :: Int) (j :: Int) (i * j)



Measured memory_bytes: 4196
N = int(input())
A = list(map(int, input().split()))

prev = A[0]
ans = 1
for i in range(1, N):
    if A[i] > prev:
        pls = "plus"
        break
    elif A[i] < prev:
        pls = "minus"
        break
else:
    print(1)
    exit()

for i in range(1, N):
    if pls == "plus" and prev > A[i]:
        prev = A[i]
        ans += 1
        pls = "even"
        continue
    if pls == "minus" and prev < A[i]:
        prev = A[i]
        ans += 1
        pls = "even"
        continue
    if pls == "even" and prev < A[i]:
        pls = "plus"
    elif pls == "even" and prev > A[i]:
        pls = "minus"
    prev = A[i]
print(ans)

Measured memory_bytes: 62704
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <algorithm>

#define Rep(b, e, i) for(int i = b; i <= e; i++)
#define rep(n, i) Rep(0, n-1, i)
#define INF 10000000

using namespace std;

void solve(void){
    int h, w;
    cin >> h >> w;
    int magic[10][10];
    rep(10, i) {
        rep(10, j) scanf("%d ", &magic[i][j]);
        scanf("\n");
    }

    //wf
    rep(10, k) rep(10, i) rep(10, j) magic[i][j] = min(magic[i][j], magic[i][k] + magic[k][j]);

    int ans = 0;
    rep(h, i) {
        rep(w, j) {
            int num;
            scanf("%d ", &num);
            if (num < 0) continue;
            ans += magic[num][1];
        }
        scanf("\n");
    }
    printf("%d\n", ans);
}

int main(void){
  solve();
  return 0;
}


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

using namespace std;

using VI = vector<int>;
using VVI = vector<VI>;
using VB = vector<bool>;
using VVB = vector<VB>;
using VD = vector<double>;
using VVD = vector<VD>;
using VS = vector<string>;
using PII = pair<int, int>;
using VPII = vector<PII>;
using VL = vector<long long>;
using VVL = vector<VL>;

#define sz(var) (int)var.size()
#define REP(var, start, end) for(int var = start; var < (int)end; ++var)
#define CLEAR(var, with) memset(var, with, sizeof(var))
#define ALL(x) x.begin(), x.end()
#define LL long long
#define ULL unsigned long long

bool allsame(const string& str) {
    return str == string(sz(str), str[0]);
}

string s;
int minChanges()
{
    int ret = 987654321;
    for(char c : s)
    {
        string tmp = s; int cnt = 0;
        while(allsame(tmp) == false)
        {
            for(int i = 0; i < sz(tmp) - 1; ++i)
                if(tmp[i + 1] == c) tmp[i] = c;
            tmp.pop_back();
            ++cnt;
        }
        ret = min(ret, cnt);
    }
    return ret;
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
#ifndef ONLINE_JUDGE
	//freopen("tmp.in", "r", stdin);
//	freopen("tmp.out", "w", stderr);
#endif
    cin >> s;

    cout << minChanges() << endl;

	return 0;
}

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

int N, M; bool flag = false;

int main() {
	cin >> N >> M;
	int cnt = M + 1;
	for (int i = M; i >= 1; i--) {
		if (N % 2 == 0 && (cnt - i) * 2 >= N && flag == false) { cnt++; flag = true; }
		cout << i << " " << cnt << endl;
		cnt++;
	}
	return 0;
}

Measured memory_bytes: 3628
#include <iostream>
#include <vector>
#include <map>
#include <cmath>
#include <set>
#include <cstdio>
#include <sstream>
#include <algorithm>
#define vi vector < int > 
#define fast ios_base::sync_with_stdio(0);cin.tie(0)
#define debug freopen("input", "r", stdin);freopen("output", "w", stdout)
#define endl '\n'
#define all(var) var.begin(), var.end()
int const MOD = 1e9+7;
typedef long long ll;
using namespace std;

int main(){
    ll n; cin >> n;
    cout << (n/2)+n%2 << endl;
}


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

using namespace std;
typedef long long ll;
typedef string str;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector <pii> vpii;
typedef vector <pll> vpll;
typedef map <str,int> mapsi;
typedef map <str,int> :: iterator mapsitr;
typedef map <int , int> mint;
typedef map <ll , ll> mll;
typedef set <int> si;
typedef set <ll> sll;
typedef si :: iterator sitr;
typedef si :: reverse_iterator rsitr;
typedef sll :: iterator sltr;
typedef sll :: reverse_iterator rsltr;
#define mset multiset

typedef mset <int> msi;
typedef mset <ll> msll;
typedef msi :: iterator msitr;
typedef msi :: reverse_iterator msritr;
typedef msll :: iterator msltr;
typedef msll :: reverse_iterator mslritr;

#define mp make_pair
#define pb push_back
#define pob pop_back
#define pf push_front
#define pof pop_front
#define fi first
#define se second
#define fs first.second
#define ss second.second
#define ff first.first
#define sf second.first
#define newl '\n'

char to_upper (char x){
    if( 97 <= int(x) && int(x) <= 126)return char(x-32);
    else if( 65 <= int(x) && int(x) <= 90)return x;
}
char to_lower (char x){
    if( 97 <= int(x) && int(x) <= 126)return x;
    else if( 65 <= int(x) && int(x) <= 90)return char(x+32);
}
int numerize (char x){
    if(48 <= int(x) && int(x) <= 57)return int(x-'0');
    else if( 97 <= int(x) && int(x) <= 126)return int(x-96);
    else if( 65 <= int(x) && int(x) <= 90)return int(x-64);
}
bool isect (int l1, int r1, int l2, int r2){
    pii p1,p2;
    p1 = mp(l1,r1); p2 = mp(l2,r2);
    if(p1>p2)swap(p1,p2);
    if(p2.fi <= p1.se)return true;
    else return false;
}
ll fexp (ll num1, ll num2, ll MOD){
    if(num2==0)return 1;
    else if(num2==1)return num1;
    else{
        ll temp = fexp (num1,num2/2,MOD); ll res = ((temp%MOD) * (temp%MOD))%MOD;
        if(num2%2==1) res = ((res%MOD)*(num1%MOD))%MOD; return res;
    }
}
ll invmod (ll num, ll MOD){return fexp (num,MOD-2,MOD);}
ll gcd (ll num1, ll num2){
    if(num1 < num2) swap(num1,num2); ll num3 = num1 % num2 ;
    while(num3 > 0){ num1 = num2; num2 = num3; num3 = num1 % num2;}
    return num2;
}
ll lcm (ll num1 , ll num2){return (ll) (num1/gcd(num1,num2))*num2;}


// end of Template
int a,b;
int main(){

//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);

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

    cin>>a>>b;
    if(a%3==0 || b%3==0 || (a+b)%3 == 0)cout<<"Possible\n";
    else cout<<"Impossible\n";

}


Measured memory_bytes: 256
import itertools
n=int(input())
l=list(map(int,input().split()))
c_list=list(itertools.combinations(l,3))
ans=0
for i in c_list:
    if(i[0]+i[1]>i[2] and i[1]+i[2]>i[0] and i[2]+i[0]>i[1] and i[0]!=i[1] and i[1]!=i[2] and i[2]!=i[0]):
        ans+=1
print(ans)

Measured memory_bytes: 20224
from collections import Counter
N, M = map(int, input().split())
groups = [0] * (N + 1)
group_num_list = [[0]]
group_num = 1
for _ in range(M):
    A, B = map(int, input().split())
    if groups[A] != 0 and groups[B] != 0:
        if groups[A] != groups[B]:
            lower = min(groups[A], groups[B])
            higher = max(groups[A], groups[B])
            for i in group_num_list[higher]:
                groups[i] = lower
            tmp = group_num_list[higher]
            group_num_list[lower].extend(tmp)
            # del group_num_list[higher]
    elif groups[A] != 0:
        groups[B] = groups[A]
        group_num_list[groups[A]].append(int(B))
    elif groups[B] != 0:
        groups[A] = groups[B]
        group_num_list[groups[B]].append(int(A))
    else:
        groups[A] = group_num
        groups[B] = group_num
        group_num_list.append([int(A), int(B)])
        group_num += 1
counter = Counter(groups)
# print(collection)
# print(group_num_list)
if len(group_num_list) == 1:
    print(1)
elif int(counter.most_common()[0][0]) != 0:
    print(counter.most_common()[0][1])
else:
    print(counter.most_common()[1][1])


Measured memory_bytes: 31380
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        
        while (true) {
            int a = sc.nextInt();
            String op = sc.next();
            int b = sc.nextInt();
            if(op.equals("+")) System.out.println(a+b);
            if(op.equals("-")) System.out.println(a-b);
            if(op.equals("*")) System.out.println(a*b);
            if(op.equals("/")) System.out.println(a/b);
            if(op.equals("?")) break;
        }
    }
}


Measured memory_bytes: 26336
import math
N, H = map(int, input().split())
cut_max = 0
throw = [0 for _ in range(N)]
throw_max = []
throw_sum = 0
for i in range(N):
    cut, throw[i] = map(int, input().split())
    if cut > cut_max:
        cut_max = cut
throw.sort(reverse=True)
for i in range(N):
    if cut_max < throw[i]:
        throw_max.append(throw[i])
        throw_sum += throw[i]
        if throw_sum >= H:
            print(i+1)
            exit()
    else:
        break
print(len(throw_max) + math.ceil((H-throw_sum)/cut_max))






Measured memory_bytes: 8028
l,r = map(int, input().split())
if r < 2019:
	print((l*(l+1)) % 2019)
	exit()
elif r-l >=  2019:
	print(0)
	exit()
elif r-l < 2019:
	if r % 2019 == 0 or l % 2019 == 0:
		print(0)
		exit()
	else:
		mini = 2018
		for i in range(0,r-l):
			for j in range(1,r-l+1):
				if i >= j:
					continue
				mod = ((l+i)*(l+j)) % 2019
				if mod < mini:
					mini = mod
print(mini)

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

using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;

#define fi first
#define se second

const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll MOD3 = 1812447359;
const ll INF = 1ll << 62;
const double PI = 2 * asin(1);

void yes() {printf("yes\n");}
void no() {printf("no\n");}
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

int N;
vector <int> Graph[int(2e5+5)];
int Dist[int(2e5+5)];
vector <int> odd, even;
int ans[int(2e5+5)];
bool used[int(2e5+5)];

int main(){
  cin >> N;
  for (int i = 0; i < N - 1; i++){
    int A, B; cin >> A >> B;
    Graph[A].push_back(B);
    Graph[B].push_back(A);
  }
  fill(Dist, Dist + N + 1, -1);
  queue <int> que; que.push(1);
  Dist[1] = 0;
  while (!que.empty()){
    int Q = que.front(); que.pop();
    if (Dist[Q] % 2 == 0) even.push_back(Q);
    else odd.push_back(Q);
    for (int next : Graph[Q]){
      if (Dist[next] != -1) continue;
      Dist[next] = Dist[Q] + 1;
      que.push(next);
    }
  }

  if (odd.size() <= N / 3){
    int now = 3;
    for (int i : odd){
      ans[i] = now; used[now] = true; now += 3;
    }
    now = 1;
    for (int j : even){
      while (used[now]) now++;
      ans[j] = now; used[now] = true;
    }
  }else if (even.size() <= N / 3){
    int now = 3;
    for (int j : even){
      ans[j] = now; used[now] = true; now += 3;
    }
    now = 1;
    for (int i : odd){
      while (used[now]) now++;
      ans[i] = now; used[now] = true;
    }
  }else{
    int now = 1;
    for (int i : odd){
      ans[i] = now; used[now] = true; now += 3;
      if (now > N) now = 3;
    }
    now = 1;
    for (int j : even){
      while (used[now]) now++;
      ans[j] = now; used[now] = true;
    }
  }


  cout << ans[1];
  for (int i = 2; i <= N; i++) cout << " " << ans[i];
  cout << endl;

  return 0;
}


Measured memory_bytes: 18208
#include<stdio.h>
int main(void){//float?????????double???
int i,j,h,w,a;
a=1;

while(a==1){
scanf("%d %d",&h,&w);
if(h==0&&w==0){
	break;
}
for(i=1;i<=h;i++){
	 for(j=1;j<=w;j++){
		if((i>=2&&j>=2)&&(i!=h&&j!=w)) printf(".");
		else printf("#");
	}
	printf("\n");
}
printf("\n");
}
return 0;
}

Measured memory_bytes: 1808
#include <stdio.h>
long long n;
int a[20], k;
char s[20];
int main() {
	scanf("%lld", &n);
	while (n) {
		a[k] = (n - 1) % 26 + 1;
		n -= (n - 1) % 26 + 1;
		n /= 26;
		k++;
	}
	for (int i = 0; i < k; i++) {
		s[i] = 'a' + a[k - 1 - i] - 1;
	}
	s[k] = NULL;
	printf("%s\n", s);
}

Measured memory_bytes: 1660
def main():

    a, b = map(int, input().split())
    dividers = makeDividers(a, b)
    ans = []

    for p in dividers:
        flg = True
        for q in dividers:
            if q == 1 or p == q:
                continue
            if p % q == 0:
                flg = False
                break
        if flg:
            ans.append(p)
    print(len(ans))

def makeDividers(x, y):
    listX = []
    listY = []
    for j in range(1, int(max(x, y) ** 0.5) + 1):
        if x % j == 0:
            listX.append(j)
            if j != x // j:
                listX.append(x // j)
        if y % j == 0:
            listY.append(j)
            if j != y // j:
                listY.append(y // j)
    return list(set(listX) & set(listY))

if __name__ == "__main__":
    main()

Measured memory_bytes: 5072