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

typedef long long lint;
typedef long double ldouble;
#define REP(i, x, n) for(int i = x ; i < n ; i++)
#define rep(i, n) REP(i, 0, n)
#define repr(i, n) for(int i = n - 1 ; i >= 0 ; i--)
#define SORT(c) sort((c).begin(), (c).end())

const int IINF = 1e9 + 10;
const lint LLINF = 1e18;
const lint MOD = 1e9 + 7;
const lint inv = MOD - 2;

struct unionFind{

    vector<int> par, rank;

    void init(int n){
        par.resize(n);
        rank.resize(n, 0);
        rep(i, n){
            par[i] = i;
        }
        return;
    }

    int root(int x){
        if(par[x] == x){
            return x;
        }else{
            par[x] = root(par[x]);
            return par[x];
        }
    }

    bool unite(int x, int y){
        int rx = root(x);
        int ry = root(y);
        if(rx == ry){
            return false;
        }
        if(rank[rx] < rank[ry]){
            par[rx] = ry;
        }else if(rank[rx] == rank[ry]){
            par[rx] = ry;
            rank[ry]++;
        }else{
            par[ry] = rx;
        }
        return true;
    }

    bool same(int x, int y){
        return root(x) == root(y);
    }

};

struct node{
    int x, y, id;
};

struct edge{
    int from, to, cost;
};

bool compx(node a, node b){
    return a.x < b.x;
}

bool compy(node a, node b){
    return a.y < b.y;
}

bool compe(edge a, edge b){
    return a.cost < b.cost;
}

int main(){
    int n;
    cin >> n;
    vector<node> t(n);
    rep(i, n){
        cin >> t[i].x >> t[i].y;
        t[i].id = i;
    }
    vector<edge> e;
    sort(t.begin(), t.end(), compx);
    rep(i, n-1){
        edge now;
        now.from = t[i].id;
        now.to = t[i+1].id;
        now.cost = abs(t[i+1].x - t[i].x);
        e.push_back(now);
    }
    sort(t.begin(), t.end(), compy);
    rep(i, n-1){
        edge now;
        now.from = t[i].id;
        now.to = t[i+1].id;
        now.cost = abs(t[i+1].y - t[i].y);
        e.push_back(now);
    }
    sort(e.begin(), e.end(), compe);
    unionFind uf;
    uf.init(n);
    int ans = 0;
    rep(i, e.size()){
        edge now = e[i];
        if(uf.unite(now.from, now.to)){
            ans += now.cost;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 6132
primes = [2]
for i in range(3, 200):
  for prime in primes:
    if i % prime == 0:
      break
  else:
    primes.append(i)
    
n = int(input())

ans = 0
for i in range(1, n + 1, 2):
  count = 0
  for prime in primes:
    if i % prime == 0:
      i //= prime
      count += 1
  if i == 1 and count == 3:
    ans += 1
    
for i in [3, 5]:
  for prime in primes[1:25]:
    if (i ** 3) * prime <= n and i != prime:
      ans += 1
    
print(ans)

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

int main() {
	int N,A;
  	cin>>N>>A;
  	int test=N%500;
      
      if(test<=A){
      cout<<"Yes"<<endl;
      }
  
		else{
      cout<<"No"<<endl;
        }
  return 0;
          
  
  
}

Measured memory_bytes: 256
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
from collections import deque

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
     
def main():
    k, x = LI()
    lim = 10**6
    ans = []
    for p in range(-lim, lim + 1):
        if abs(p - x) <= k - 1:
            ans.append(p)
    print(' '.join([str(x) for x in ans]))

main()



Measured memory_bytes: 6220
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <climits>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <functional>
#include <set>
#include <numeric>
#include <stack>
#include <utility>
#include <time.h>
#include <iterator>
//#include "util.h"

using namespace std;
typedef unsigned uint;
typedef long long lint;
typedef unsigned long long ulint;


//呪文
template <typename _KTy, typename _Ty> ostream& operator << (ostream& ostr, const pair<_KTy, _Ty>& m) { cout << "{" << m.first << ", " << m.second << "}"; return ostr; }
template <typename _KTy, typename _Ty> ostream& operator << (ostream& ostr, const map<_KTy, _Ty>& m) { if (m.empty()) { cout << "{ }"; return ostr; } cout << "{" << *m.begin(); for (auto itr = ++m.begin(); itr != m.end(); itr++) { cout << ", " << *itr; } cout << "}"; return ostr; }
template <typename _Ty> ostream& operator << (ostream& ostr, const vector<_Ty>& v) { if (v.empty()) { cout << "{ }"; return ostr; }	cout << "{" << v.front(); for (auto itr = ++v.begin(); itr != v.end(); itr++) { cout << ", " << *itr; }	cout << "}"; return ostr; }
template <typename _Ty> ostream& operator << (ostream& ostr, const set<_Ty>& s) { if (s.empty()) { cout << "{ }"; return ostr; } cout << "{" << *(s.begin()); for (auto itr = ++s.begin(); itr != s.end(); itr++) { cout << ", " << *itr; }	cout << "}"; return ostr; }
//template <typename T> void print(T* v, int N) { if (N == 0) cout << "{ }"; cout << "{" << v[0]; for (int p = 1; p < N; p++) cout << ", " << v[p]; cout << "}"; }
#define PI 3.14159265358979323846
#define EPS 1e-8
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define all(x) (x).begin(), (x).end()
	

int main() {
	string A, B, C;
	cin >> A >> B >> C;
	if (A.back() == B.front() && B.back() == C.front())
		cout << "YES";
	else
		cout << "NO";
	cout << endl;
	return 0;
}

Measured memory_bytes: 256
N, M = map(int, input().split())

f = lambda x: 1 if x == "#" else 0
A = [list(map(f, input())) for _ in range(N)]
B = [list(map(f, input())) for _ in range(M)]

def func():
  for i in range(N-M+1):
    for j in range(N-M+1):
      if all(A[i+k][j+l] == B[k][l] for k in range(M) for l in range(M)):
        return True
  return False

print("Yes" if func() else "No")


Measured memory_bytes: 3064
#include <stdio.h>

int main(void)
{
	int n,i,y,s[14],h[14],c[14],d[14];
	char x;
	
	for(i=1;i<=13;i++){
		s[i]=0;
		h[i]=0;
		c[i]=0;
		d[i]=0;
	}
	
	
	scanf("%d",&n);
	
	
	for(i=1;i<=n;i++){
		scanf("%s %d",&x,&y);
		
		if(x=='S'){
			s[y]=1;
		}
		if(x=='H'){
			h[y]=1;
		}
		if(x=='C'){
			c[y]=1;
		}
		if(x=='D'){
			d[y]=1;
		}
	}
		
		
		for(i=1;i<=13;i++){
			if(s[i]==0){
				printf("S %d\n",i);
			}
		}
		
		for(i=1;i<=13;i++){
			if(h[i]==0){
				printf("H %d\n",i);
			}
		}
		
		for(i=1;i<=13;i++){
			if(c[i]==0){
				printf("C %d\n",i);
			}
		}
		
		for(i=1;i<=13;i++){
			if(d[i]==0){
				printf("D %d\n",i);
			}
		}
	
	return 0;
}

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

public class Team
{
    public int tid { get; set; }
    public int acc { get; set; }
    public List<int> ac { get; set; }
    public int[] wa { get; set; }
    public int score { get; set; }
}

public class Hello
{
    public const int INF = 999999999;
    public static void Main()
    {
        while (true)
        {
            string[] line = Console.ReadLine().Trim().Split(' ');
            var M = int.Parse(line[0]);
            var T = int.Parse(line[1]);
            var P = int.Parse(line[2]);
            var R = int.Parse(line[3]);
            if (M == 0 && T == 0 && P == 0 && R == 0) break;
            var teams = new Team[T];
            for (int i = 0; i < T; i++)
                teams[i] = new Team { tid = i + 1, ac = new List<int>(), acc = 0,  wa = new int[10] };
            for (int i = 0; i < R; i++)
            {
                line = Console.ReadLine().Trim().Split(' ');
                var m = int.Parse(line[0]);
                var t = int.Parse(line[1]) - 1;
                var p = int.Parse(line[2]) - 1;
                var j = int.Parse(line[3]);
                if (j == 0)
                {
                    teams[t].ac.Add(p);
                    teams[t].score += m;
                    teams[t].acc++;
                }
                else teams[t].wa[p]++;
            }
            foreach (var x in teams)
            {
                if (x.score == 0 && x.acc == 0) x.score = INF;
                else
                    foreach (var y in x.ac) x.score += x.wa[y] * 20;
            }
            print(teams);
        }
    }
    public static void print(Team[] t)
    {
        var a = t.OrderByDescending(x => x.acc).ThenBy(x => x.score).ThenByDescending(x => x.tid).ToArray();
        var pre1 = a[0].acc;
        var pre2 = a[0].score;
        Console.Write(a[0].tid);
        for (int i = 1; i < t.Length; i++)
        {
            if (a[i].acc < pre1) Console.Write(",{0}", a[i].tid);
            else if (a[i].score > pre2) Console.Write(",{0}", a[i].tid);
            else Console.Write("={0}", a[i].tid);
            pre1 = a[i].acc; pre2 = a[i].score;
        }
        Console.WriteLine();
    }
}



Measured memory_bytes: 10336
#include <bits/stdc++.h>
#define INF 0x3f3f3f3f
#define MOD 1000000007
#define N 1123456
using namespace std;
long long  n,m,sum,res,flag;
long long  a[N],b[N];
int main()
{
    #ifndef ONLINE_JUDGE
//        freopen("test.txt","r",stdin);
    #endif
    long long  i,j,k,T,cas,x,y,t;
    scanf("%lld",&n);
    {
        for(i=0;i<n;i++)
            scanf("%lld%lld",&a[i],&b[i]);
        sum=0;
        for(i=n-1;i>=0;i--)
        {
            t=b[i]-(a[i]+sum)%b[i];
            if(t==b[i])t=0;
            sum+=t;
        }
        printf("%lld\n",sum);
    }
    return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <algorithm>
#include <cmath>
#include <stdio.h>
#include <stdlib.h>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <string.h>
#include <stack>
#define Endl endl
#define mp make_pair
#define rep(N) for(int i=0;i<N;i++)
#define repj(N) for(int j=0;j<N;j++)
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define For(I,N) for(int I=0;I<N;I++)
#define cinone(N) int N;cin>>N;
#define scanfone(N) int N;cin>>N;
#define cinng(N,M) int N[M];for(int yiuytvnm=0;yiuytvnm<M;yiuytvnm++) cin>>N[yiuytvnm];
#define scanfng(N,M) int N[M];for(int qrwuoiq=0;qrwuoiq<M;qrwuoiq++) scanf("%d",&N[qrwuoiq]);
#define over(A) {cout<<A<<endl;exit(0);}
typedef unsigned long long ull;
const int inf=1039704182;
using namespace std;
int n,m;
vector <pii> vec[100005];
map <int,vector <int> > ksvec[100005];
set <pair<pii,int> > squ;
map <pii,int> dist;

int main()
{
//	freopen("input.txt","r",stdin);
	cin>>n>>m;
	int x,y,z;
	for(int i=0;i<m;i++)
	{
		scanf("%d%d%d",&x,&y,&z);
		x--;
		y--;
		ksvec[x][z].push_back(y);
		ksvec[y][z].push_back(x);
		vec[x].push_back(mp(y,z));
		vec[y].push_back(mp(x,z));
	}
	squ.insert(mp(mp(0,0),0));//distance, position and company.
	while(squ.size())
	{
		int x=squ.begin()->first.second;
		int d=squ.begin()->first.first;
		int boss=squ.begin()->second;
		squ.erase(mp(mp(d,x),boss));
		int c;
		if(boss==0)
		{
			for(int i=0;i<vec[x].size();i++)
			{
				c=vec[x][i].second;
				if(dist.find(mp(vec[x][i].first,c))==dist.end() || dist[mp(vec[x][i].first,c)]>d+1)
				{
					dist[mp(vec[x][i].first,c)]=d+1;
					squ.insert(mp(mp(d+1,vec[x][i].first),c));
				}
			}
		}
		else
		{
			if(dist.find(mp(x,0))==dist.end() || dist[mp(x,0)]>d)
			{
				dist[mp(x,0)]=d;
				squ.insert(mp(mp(d,x),0));
			}
			for(int i=0;i<ksvec[x][boss].size();i++)
			{
//				if(vec[x][i].second!=boss) continue;
				if(dist.find(mp(ksvec[x][boss][i],boss))==dist.end() || dist[mp(ksvec[x][boss][i],boss)]>d)
				{
					dist[mp(ksvec[x][boss][i],boss)]=d;
					squ.insert(mp(mp(d,ksvec[x][boss][i]),boss));
				}
			}
		}
	}
	int res=inf;
	for(int i=0;i<1000000;i++)
	{
		if(dist.find(mp(n-1,i))==dist.end()) continue;
		res=min(res,dist[mp(n-1,i)]);
	}
	cout<<(res==inf?-1:res)<<endl;
	return 0;
}

Measured memory_bytes: 92788
#include <stdio.h>
#include <iostream>
#include <string>
int main(void)
{
	char A[100];
	char S[100];
	char C[100];
	std::cin >> A >> S >> C;
	std::cout << A[0] << S[0] << C[0];
	return 0;
}
	

		
	

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

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

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

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

	ll flag = 0;

	for(ll i=1;i <6;i++)
	{
		ll x;
		cin >> x;
		if(x == 0)
			flag = i;
	}

	cout << flag << endl;

}

Measured memory_bytes: 3608
//============================================================================
// Name        : DPTest.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
using namespace std;
int N;
int A[2001]={};
long long dp[2001][2001]={};

long long calc(int n1,int n2){
	long long ans = 0;
	n1=(n1+N)%N;
	int e =(n1+n2-1)%N;
	if(dp[n1][n2]>0)return dp[n1][n2];
	if(n2<=1)return 0;
	if(n2==2)return min(A[n1],A[e]);
	if(A[n1]>A[e]){
		ans = max(A[(n1+1)%N]+calc(n1+2,n2-2),A[e]+calc(n1+1,n2-2));
	}else{
		ans = max(A[n1]+calc(n1+1,n2-2),A[(e-1+N)%N]+calc(n1,n2-2));
	}
	dp[n1][n2]=ans;
	return ans;
}

int main() {
	cin>>N;
	for(int i=0;i<N;++i)cin>>A[i];
	long long R=0;

	for(int i=0;i<N;++i)R = max( R, calc(i+1,N-1)+A[i] );

	cout<<R<<endl;
	return 0;
}

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

int main() {
  int N;
  int x = 1;
  cin >> N;
  vector<int> a(N + 1);
  
  for(int i = 1; i < N + 1; i++) {
    cin >> a.at(i);
  }
  
   for(int i = 0; i < N; i++) {
    x = a.at(x);
    if(x == 2) {
      cout << i + 1 << endl;
      return 0;
    }
  }
  
  cout << -1 << endl;
}

Measured memory_bytes: 640
def check(var):
    in_range = var <= N
    all_num_in = all(c in str(var) for c in '753')
    return in_range and all_num_in


def dfs(x):
    res = 0
    if check(x):
        res += 1
    if x <= N:
        for v in 3, 5, 7:
            res += dfs(10 * x + v)
    return res


N = int(input())
print(dfs(0))


Measured memory_bytes: 3064
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <map>
#include <vector>
#include <queue>
#define PII pair<int, int>
using namespace std;
const int MAXV = 200;
const int MAXN = 1000;
const int INF = 1e9;

int V, E, N, village[MAXN+5];
int dp[MAXN+5][MAXV+5], dist1[MAXV+5][MAXV+5], dist2[MAXV+5][MAXV+5];

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    while (cin >> V >> E) {
        if (V == 0 && E == 0) break;
        for (int i = 1; i <= V; i++) {
            for (int j = 1; j <= V; j++) {
                dist1[i][j] = dist2[i][j] = (i == j ? 0 : INF);
            }
        }

        for (int i = 0; i < E; i++) {
            char c;
            int u, v, w;
            cin >> u >> v >> w >> c;
            if (c == 'L') {
                w = min(dist1[u][v], w);
                dist1[u][v] = dist1[v][u] = w;
            }
            else {
                w = min(dist2[u][v], w);
                dist2[u][v] = dist2[v][u] = w;
            }
        }

        for (int k = 1; k <= V; k++) {
            for (int i = 1; i <= V; i++) {
                for (int j = 1; j <= V; j++) {
                    dist1[i][j] = min(dist1[i][j], dist1[i][k] + dist1[k][j]);
                    dist2[i][j] = min(dist2[i][j], dist2[i][k] + dist2[k][j]);
                }
            }
        }

        // for (int i = 1; i <= V; i++) for (int j = 1; j <= V; j++) cout << dist1[i][j] << (j == V ? "\n" : " ");
        // for (int i = 1; i <= V; i++) for (int j = 1; j <= V; j++) cout << dist2[i][j] << (j == V ? "\n" : " ");

        cin >> N;
        for (int i = 1; i <= N; i++) cin >> village[i];

        for (int i = 1; i <= V; i++) dp[N][i] = 0;
        for (int i = N - 1; i >= 1; i--) {
            for (int ship = 1; ship <= V; ship++) {
                int cur = village[i], tar = village[i + 1];
                dp[i][ship] = min(INF, dist1[cur][tar] + dp[i + 1][ship]);
                for (int mid = 1; mid <= V; mid++) {
                    if (dist1[cur][ship] == INF) continue;
                    if (dist2[ship][mid] == INF) continue;
                    if (dist1[mid][tar] == INF) continue;
                    if (dp[i + 1][mid] == INF) continue;
                    int relax = dist1[cur][ship] + dist2[ship][mid] + dist1[mid][tar] + dp[i + 1][mid];
                    dp[i][ship] = min(dp[i][ship], relax);
                }
                // cout << dp[i][ship] << (ship == V ? "\n" : " ");
            }
        }

        cout << dp[1][village[1]] << "\n";
    }
}



Measured memory_bytes: 4272
using namespace std;
#include<bits/stdc++.h>
#define int long long
#define pb push_back 
#define IOS ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ff first
#define ss second
#define all(x) x.begin(), x.end()
#define repa(i,a,b) for (int i=a; i<=b; i++)
#define repd(i,b,a) for (int i=b; i>=a; i--)
#define endl "\n"
//debugging
#define debug1(a) cout<<#a<<" = "<<(a)<<endl;
#define debug2(a,b) cout<<#a<<" = "<<(a)<<", "<<#b<<" = "<<(b)<<endl;
#define debug3(a,b,c) cout<<#a<<" = "<<(a)<<", "<<#b<<" = "<<(b)<<", "<<#c<<" = "<<(c)<<endl;
#define debug4(a,b,c,d) cout<<#a<<" = "<<(a)<<", "<<#b<<" = "<<(b)<<", "<<#c<<" = "<<(c)<<", "<<#d<<" = "<<(d)<<endl;

const int N = 1e+6+5;
int big = 1e+18+3;
int mod = 1e+9+7;

signed main()
{
    IOS;
        
    map<string,int>freq;

    int t; cin>>t; while(t--)
    {
        string s; cin>>s;
        freq[s]++;
    }   

    cout<<"AC x "<<freq["AC"]<<endl;
    cout<<"WA x "<<freq["WA"]<<endl;
    cout<<"TLE x "<<freq["TLE"]<<endl;
    cout<<"RE x "<<freq["RE"]<<endl;
}

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

int main() {
  int A, B, C, D, L, R;
  cin >> A >> B >> C >> D;
  L = A + B;
  R = C + D;
  
  if( L == R ){
    cout << "Balanced" ;
  }
  
  if( L > R ){
    cout << "Left";
  }
  
  if( L < R ){
    cout << "Right";
  }
}


Measured memory_bytes: 256
words = [
    'KIHBR',
    'AKIHBR', 'KIHABR', 'KIHBAR', 'KIHBRA', 
    'AKIHABR', 'AKIHBAR', 'AKIHBRA',
    'KIHABAR', 'KIHABRA', 
    'KIHBARA'
    'AKIHABAR', 'AKIHABRA', 'AKIHBARA', 
    'KIHABARA',
    'AKIHABARA'
    ]
    
if input() in words:
    print('YES')
else:
    print('NO')

Measured memory_bytes: 2940
import std.algorithm, std.container, std.conv, std.math, std.range, std.typecons, std.stdio, std.string;

auto rdsp(){return readln.splitter;}
void pick(R,T)(ref R r,ref T t){t=r.front.to!T;r.popFront;}
void readV(T...)(ref T t){auto r=rdsp;foreach(ref v;t)pick(r,v);}
void readA(T)(size_t n,ref T[]t){t=new T[](n);auto r=rdsp;foreach(ref v;t)pick(r,v);}

void main()
{
  int[] a; readA(3, a);
  int k; readV(k);

  a.sort();
  writeln(a[0]+a[1]+a[2]*2^^k);
}


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

int main(){
  string s, t; cin >> s >> t;
  if(s.size() != t.size()){
    cout << ( s.size() > t.size() ? "GREATER" : "LESS" );
  }else{
    int gr = 0;
    int n = s.size();
    for(int i = 0; i < n; i++){
      if(s[i] > t[i]) {gr = 1; break;}
      else if(s[i] < t[i]) {gr = -1; break;}
    }
    if(gr == 1) cout << "GREATER";
    else if(gr == -1) cout << "LESS";
    else cout << "EQUAL";
  }
}

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

int main(){
    int n=0,k=0,ans=0;
    cin >> n >> k;
    vector<int> x(n);
    for(int i=0;i<n;i++){
        cin >> x.at(i);
        if(2*x.at(i)<k)ans += 2*x.at(i);
        else ans += 2*(k-x.at(i));
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
using namespace std;
#define rep(i,x) for(int i = 0; i < x; i++)
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<vector<vector<int>>> vvvi;
const ll N = 1e9+7;
const int n_max = 1e5+10;


void print() {
    cout << endl;
}
 
template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
    cout << head;
    if (sizeof...(tail) != 0) cout << ' ';
    print(forward<Tail>(tail)...);
}
 
template <class T>
void print(vector<T> &vec) {
    for (auto& a : vec) {
        cout << a;
        if (&a != &vec.back()) cout << '\n';
    }
    //cout << endl;
}
 
template <class T>
void print(vector<vector<T>> &df) {
    for (auto& vec : df) {
        print(vec);
    }
}
 

int main(){
	ll r,d,x; cin >> r >> d >> x;
	vector<ll> res;
	res.pb(x);
	rep(i,10){
		res.pb(res.at(i) * r - d);
	}
	//res.pop_front();
	res.erase(res.begin());
	print(res);
	return 0;
}

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

using namespace std;
using ull = unsigned long long;
using ll = long long;
using ld = long double;
using D = double;
using ii = pair<int, int>;
using vi = vector<int>;
using vii = vector<ii>;

#define pb push_back
#define mp make_pair
#define all(x) x.begin(),x.end()
#define makeunique(x) sort(all(x)), (x).resize(unique(all(x)) - (x).begin())
#define rep(i, x)  for(int i = 0; i < (x); i++)
#define rrep(i, x) for(int i = (x - 1); i >= 0; i--)
#define sqrt(x) sqrt(abs(x))
#define y1 y1_1234413
#define j1 j1_235
#define y0 y0_235
#define j0 j0_256
#define fi first
#define se second
#define re return
#define prev PREV
#define next NEXT
#define sz(x) ((int)x.size())

template<typename T> T sqr(T a) { re a * a; }
template<typename T> T gcd(T a, T b) { re b ? gcd(b, a % b) : a; }
template<typename T> T sgn(T a) { re a > 0 ? 1 : (a < 0 ? -1 : 0); }
template<typename T> T abs(T a) { re a > 0 ? a : -a; }

const int inf = 2e9;
const ld st = 0.000001;
const ld pi = acos((ld)-1);
const int MAXN = 100000;
const int mod = 1e9 + 7;


#define FILENAME ""


int main() {
    ios::sync_with_stdio(0);
    cin.tie(NULL);
    //  freopen(FILENAME ".in", "r", stdin);
    //  freopen(FILENAME ".out", "w", stdout);
    ll n;
    cin >> n;
    map <string, ll> st;
    for (int i = 0; i < n; i++) {
        string s;
        cin >> s;
        sort(all(s));
        st[s]++;
    }
    ll ans = 0;
    for (auto it : st) {
        if (it.se % 2 == 0) {
            ans += (it.se/2)*(it.se - 1);
        }
        else {
            ans += ((it.se - 1)/2)*(it.se);
        }
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 11264
N = int(input())
A_list = list(map(int, input().split()))
index_add_A_list = []
for i, A in enumerate(A_list):
    index_add_A_list.append([i, A])
sorted_index_add_A_list = sorted(index_add_A_list, key=lambda x: x[1])
for a in sorted_index_add_A_list:
    print(a[0] + 1)

Measured memory_bytes: 23400
#include <stdio.h>

int main(){
  int a[4], b[4];
  while(scanf("%d%d%d%d%d%d%d%d", a,a+1,a+2,a+3,b,b+1,b+2,b+3)!=EOF){
    int x[10];
    int i;
    for(i=0;i<10;i++) x[i] = 0;

    for(i=0;i<4;i++) x[a[i]] = i+1;

    int hit=0, blow=0;

    for(i=0;i<4;i++){
      if(x[b[i]]){
        if(x[b[i]] == i+1) hit++;
        else blow++;
      }
    }
    printf("%d %d\n", hit, blow);
  }
}
      

Measured memory_bytes: 0
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
using namespace std;
#define int long long
#ifndef FAST_IO
  #define IOS ios_base::sync_with_stdio(false),cin.tie(nullptr),cout.tie(nullptr);
#endif
#define ff first
#define ss second
#define endl "\n"
#define all(c) c.begin(),c.end()
template<typename T>void print(T t){for(auto &it:t)cout<<it<<" "; cout<<endl;}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
void solve(){
  int n,k;
  cin>>n>>k;
  cout<<(n%k==0?"0":"1")<<endl;
}
int32_t main(){
   IOS;
   solve();
   //debug();
  #ifdef LOCAL_DEFINE
   cerr<<"time elapsed "<<(double)clock()/CLOCKS_PER_SEC<<endl;
  #endif	
}


Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
//#include <atcoder/all>
//using namespace atcoder;
using ll = long long;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ld long double
#define al(a) (a).begin(),(a).end()
#define mk make_pair
#define check cout<<"?"<<endl;

template<typename T>
ostream& operator<<(ostream& os,const vector<T>& v){
    if(v.empty()){
        os<<"{ }";
        return os;
    }
    os<<"{"<<v.front();
    for(auto itr=++v.begin();itr!=v.end();itr++){
        os<<", "<<*itr;
    }
    os<<"}";
    return os;
}

ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;

template<typename T>
void bfs01(const vector<vector<pair<int,T>>>& path,vector<T>& dis,int start){
    deque<T> dq;
    int n=path.size();
    vector<bool> visited(n,false);
    dq.push_front(start);
    dis[start]=0;
    while(!dq.empty()){
        int s=dq.front();
        dq.pop_front();
        if(visited[s]) continue;
        visited[s]=true;
        for(auto [to,cost]:path[s]){
            if(dis[to]>dis[s]+cost){
                dis[to]=dis[s]+cost;
                if(cost>0) dq.push_back(to);
                else dq.push_front(to);
            }
        }
    }
}

int main(){
    int k; cin>>k;
    vector<vector<pp>> path(k);
    vector<int> dis(k,inf);
    rep(i,k){
        if(i!=10*i%k) path[i].push_back(mk(10*i%k,0));
        path[i].push_back(mk((i+1)%k,1));
    }
    bfs01<int>(path,dis,1);
    cout<<dis[0]+1<<endl;
}




Measured memory_bytes: 9328
#include <bits/stdc++.h>
using namespace std;
vector<vector<int> > A;
typedef pair<int,int> P;

bool bfs(){
  sort(A.begin(),A.end());
  A.erase(unique(A.begin(),A.end()),A.end());
  int n = A.size();
  for(int i=0;i<n;i++)
    for(int j=0,used[10]={};j<A[i].size();j++)if(used[A[i][j]]++) return 1;

  queue<P> Q;
  bool D[1<<10][1<<10]={};
  D[0][0]=1;
  Q.push(P(0,0));
  while(!Q.empty()){
    P t = Q.front();Q.pop();
    int I = t.first,J = t.second;
    if(I&&J&&__builtin_popcount(I&J) == __builtin_popcount(J)) return 1;

    for(int i=0;i<n;i++){
      for(int k=0,ni=I;k<A[i].size();k++){
	int num = A[i][k],nj =(J|1<<num);
	if(k&&D[ni][nj]==0&&J!=nj)D[ni][nj]=1, Q.push(P(ni,nj));
	if(I&(1<<num))break;
	ni |= (1<<num);
      }
    }
  }
  return 0;
}

int main(){
  int n;
  while(cin>>n,n){
    string str;
    cin>>str;
    A.clear();
    for(int i=0;i<str.size();i++){
      A.push_back(vector<int>());
      while(str[i]!='u') A.back().push_back(str[i++]-'0');
    }
    cout<<(bfs()? "UN":"")<<"SAFE"<<endl;
  }
  return 0;
}

Measured memory_bytes: 4600
#include<iostream>
#include<string>
#include<vector>

using namespace std;

int main()
{
    string s;
    cin >> s;
    vector<char> v;
    for(int i=s.length()-9; i>= 0; i--) {
        v.push_back(s[i]);
    }
    for(int i=v.size()-1; i>=0; i--) {
        cout << v[i];
    }
    cout << '\n';
    return 0;
}


Measured memory_bytes: 256
#include <boost/multiprecision/cpp_int.hpp>
namespace mp = boost::multiprecision;
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using INT=mp::cpp_int;
using namespace std;
using ll=long long;
using vec=vector<ll>;
using vect=vector<double>;
using Graph = vector<vector<ll>>;
#define loop(i,n) for(ll i=0;i<n;i++)
#define Loop(i, m, n) for(ll i = m;i < n;i++)
#define pool(i,n) for(ll i=n;i>=0;i--)
#define Pool(i, m, n) for(ll i=n;i>=m;i--)
#define MAX 99999999999ll
#define MIN -99999999999ll
#define setbit bitset<8>
#define flagcount __builtin_popcount
#define flag(x) (1<<x)
#define flagadd(bit,x) bit|=flag(x)
#define flagpop(bit,x) bit&=~flag(x) 
#define flagon(bit,i) bit&flag(i)
#define flagoff(bit,i) !(bit & (1<<i))
#define all(v) v.begin(),v.end()
#define low2way(v,x) lower_bound(all(v),x)
#define high2way(v,x) upper_bound(all(v),x)
#define count2way(v,x) high2way(v,x)-low2way(v,x)
#define lower(v,x) low2way(v,x)-v.begin() //1番左が0、もし見つから無いならｎを出力
#define higher(v,x) high2way(v,x)-v.begin()-1 //1番左が0、もし見つからないならn-1を出力（注意）
#define putout(a) cout<<a<<endl
#define putout2(a,b) putout(a);putout(b)
#define putout3(a,b,c) putout(a);putout(b);putout(c)
#define putout4(a,b,c,d) putout(a);putout(b);putout(c);putout(d)
#define putout5(a,b,c,d,e) putout(a);putout(b);putout(c);putout(d);putout(e)
#define Gput(a,b) G[a].push_back(b)
#define cin1(a) cin>>a
#define cin2(a,b) cin>>a>>b
#define cin3(a,b,c) cin>>a>>b>>c
#define cin4(a,b,c,d) cin>>a>>b>>c>>d
#define cin5(a,b,c,d,e) cin>>a>>b>>c>>d>>e
#define sum(v) accumulate(all(v), 0ll)
#define gcd(x,y) __gcd(x,y)
ll ctoi(char c){
	if(c>='0'&&c<='9'){
		return c-'0';
	}
	return 0;
}
ll lcm(ll x,ll y){
  ll z=gcd(x,y);
  return x*y/z;
}
INT LCM(INT x,INT y){
  INT z=gcd(x,y);
  return x*y/z;
}
ll primejudge(ll n){
  if(n<2)return 0;
  else if(n==2)return 1;
  else if(n%2==0)return 0;
  double sqrtn=sqrt(n);
  Loop(i,3,sqrtn+1){
     if(n%i==0){
        return 0;
     }
     i++;
  }
  return 1;
}
INT modinv(INT a, INT m) {
    INT b = m, u = 1, v = 0;
    while (b) {
        INT t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
int main() {
  cout << fixed << setprecision(30);
  string s,t;
  ll a,b;
  string u;
  cin5(s,t,a,b,u);
 if(s==u){
   putout(a-1);
   putout(b);
 }
  else{
    putout(a);
    putout(b-1);
  }
}


Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#define PI 3.14159265359
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
const long long INF= 1e+18+1;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll> >vvl;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> T;
const ll MOD=1000000007LL;
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
int main(){
  ll n,x;cin>>n>>x;
  vl a(n);
  ll ans=0;
  rep(i,n)cin>>a[i];
  for(ll i=1;i<n;i++){
    if(a[i-1]+a[i]>x){
      ans+=a[i-1]+a[i]-x;
      a[i]=max(x-a[i-1],0LL);
    }
  }
  cout<<ans<<endl;
}
    
  

Measured memory_bytes: 1024
import numpy as np
if __name__ == "__main__":
    
   
    dim = int(input())
    B = [int(x) for x in input().split()]
    
    A =[B[0]]

    for x in range(dim-2):
        A.append(np.amin((B[x],B[x+1])))
    
    A.append(B[-1])

    print(np.sum(A))
    

Measured memory_bytes: 12620
#include <set>
#include <map>
#include <queue>
#include <ctime>
#include <cmath>
#include <cstdio>
#include <bitset>
#include <vector>
#include <cstring>
#include <cassert>
#include <iostream>
#include <algorithm>
using namespace std;
typedef double db;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pa;
typedef unsigned int uint;
typedef unsigned long long ull;
#define w1 first
#define ls (x<<1)
#define w2 second
#define ins insert
#define rs (x<<1|1) 
#define mp make_pair
#define pb push_back
#define mid ((l+r)>>1)
#define sqr(x) ((x)*(x))
#define cle(x) ((x).clear())
#define lowbit(x) ((x)&(-x))
#define SZ(x) (int((x).size()))
#define All(x) (x).begin(),(x).end()
#define ms(x,y) memset(x,y,sizeof (x))
#define rep(i,a,b) for(int (i)=(a);(i)<=(b);(i)++)
#define rep2(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
#define per(i,a,b) for(int (i)=(a);(i)>=(b);(i)--)
#define Rep(p,x) for(int (p)=head[(x)];(p);(p)=nxt[(p)]) 
#define Rep2(p,x) for(int (p)=cur[(x)];(p);(p)=nxt[(p)])
template<class T>inline void read(T&num){
	num=0;T f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9')num=num*10+ch-'0',ch=getchar();
	num*=f;
}
inline int getgcd(int x,int y){if(!x)return y;return getgcd(y%x,x);}
inline int power(int x,int k,int p){int res=1;for(;k;k>>=1,x=(ll)x*x%p)if(k&1)res=(ll)res*x%p;return res;}
const double pi=acos(-1);	
inline void judge(){
	freopen("input.txt","r",stdin);
} 
//********************************head*************************************
const int maxn=1e6+5;
int n,m;
int V,x[maxn],R[maxn][25],L[maxn][25];
int S1[maxn],S2[maxn];
int minL[maxn];
int main(){
	read(n);read(V);
	rep(i,1,n)read(x[i]);
	while((1<<m)<=V)m++;m++;
	rep2(i,0,m){
		R[n+1][i]=n;
		per(j,n,1)
			if(x[j+1]-x[j]<=(V>>i))R[j][i]=R[j+1][i];
			else R[j][i]=j;
		L[0][i]=1;
		rep(j,1,n)
			if(x[j]-x[j-1]<=(V>>i))L[j][i]=L[j-1][i];
			else L[j][i]=j;
	}
	rep2(i,0,1<<m)S2[i]=n+1;
	rep2(i,0,1<<m)rep2(j,0,m)if(!(i&(1<<j))){
		S1[i|(1<<j)]=max(S1[i|(1<<j)],R[S1[i]+1][j]);
		S2[i|(1<<j)]=min(S2[i|(1<<j)],L[S2[i]-1][j]);
	}
	rep(i,0,n)minL[i]=n+2;
	rep2(i,0,1<<m)if(!(i&1))minL[S1[i]]=min(minL[S1[i]],S2[((1<<m)-1)^i^1]);
	per(i,n-1,0)minL[i]=min(minL[i],minL[i+1]);
	rep(i,1,n){
		if(minL[L[i][0]-1]<=R[i][0]+1)puts("Possible");
		else puts("Impossible");
	}
	return 0;
}

Measured memory_bytes: 56448
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <regex>
#define ull unsigned long long
#define REP(i,n) for(int i = 0; i < n; i++)
#define FOR(i,j,n) for(int i = j; i < n; i++)
#define RFOR(i,j,n) for(int i = j-1; i >= n; i--)
#define PREC(n) fixed << setprecision(n)
#define print_array(v) REP(__k, v.size()) { cout << v[__k]; if(__k != v.size()-1) cout << " "; else cout << endl; } value
#define YesorNo(a) printf(a?"Yes\n":"No\n")
using namespace std;

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int a; cin>>a;
	cout<<3*a*a<<endl;
}

Measured memory_bytes: 256
function main(input) {
  const inputs =input.split('\n')
  const [S] = inputs[0].split(' ')
  const [Qn] = inputs[1].split(' ').map(Number)
  const Q = inputs.slice(2).map(e => {
    const q = e.split(' ')
    return {
      id: q[0],
      f: q[1],
      c: q[2]
    }
  })
  // console.log(Q)
  // console.log(S)
  let s = S
  let rev = 0
  for(let i = 0; i < Qn; i++) {
    if (Q[i].id === '1') {
      rev++
    } else {
      if (Q[i].f === '1' ^ rev % 2 === 0) {
        s = s + Q[i].c
      } else {
        s = Q[i].c + s
      }
    }
  }
  if (rev % 2 === 1) s = s.split('').reverse().join('')
  console.log(s)
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'))


Measured memory_bytes: 64644
import java.util.*;
import java.io.*;
import java.lang.reflect.Array;
import java.math.BigInteger;

import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
 
public class Main{
    static final long mod=1000000007;
//    static int dx[]={-1,0,1,0};
//    static int dy[]={0,-1,0,1};

    public  static void main(String[] args)   throws Exception, IOException{        
        Reader sc = new Reader(System.in);
        PrintWriter out=new PrintWriter(System.out);

//        int n = sc.nextInt();


        int x = sc.nextInt();
        int y = sc.nextInt();
        int z = sc.nextInt();
        int k = sc.nextInt();
        long dx[]=sc.nextLongArray(x);
        long dy[]=sc.nextLongArray(y);
        long dz[]=sc.nextLongArray(z);
        long xy[]=new long[1000000];
        for (int i = 0,c = 0; i < x; i++) {
			for (int j = 0; j < y; j++) {
				xy[c++]=dx[i]+dy[j];
			}
		}
        sort(dz);
        sort(xy);
        long xyz[]=new long[3000000];
        for (int i = xy.length-1,c=0; -1 < i; i--) {
			for (int j = 0; j < z; j++) {
				if(c>=xyz.length)break;
				xyz[c++]=xy[i]+dz[j];
			}
		}
        sort(xyz);
        for (int i = 0; i < k; i++) {
			out.println(xyz[xyz.length-i-1]);
		}
       
//        out.println();
        out.flush();
    }



    static boolean validpos(int x,int y,int r, int c){
        return x<r && 0<=x && y<c && 0<=y;
    }

    static void db(Object... os){
        System.err.println(Arrays.deepToString(os));
    }  
}

//class P {
//    int id, d;
//    P(int  id, int d) {
//        this.id=id;
//        this.d=d;
//    }
//}

//class P implements Comparable<P>{
//    int id,T;
//    P(int id, int T) {
//        this.id=id;
//        this.T=T;
//    }
//    public int compareTo(P p){
//        return id-p.id; //des
//    }
//}

class Reader
{ 
    private BufferedReader x;
    private StringTokenizer st;
    
    public Reader(InputStream in)
    {
        x = new BufferedReader(new InputStreamReader(in));
        st = null;
    }
    public String nextString() throws IOException
    {
        while( st==null || !st.hasMoreTokens() )
            st = new StringTokenizer(x.readLine());
        return st.nextToken();
    }
    public int nextInt() throws IOException
    {
        return Integer.parseInt(nextString());
    }
    public int[] nextIntArray(int size) throws IOException{
    	int r[] = new int[size];
    	for (int i = 0; i < size; i++) {
			r[i] = this.nextInt(); 
		}
    	return r;
    }
    public long[] nextLongArray(int size) throws IOException{
    	long r[] = new long[size];
    	for (int i = 0; i < size; i++) {
			r[i] = this.nextLong(); 
		}
    	return r;
    }
    public long nextLong() throws IOException
    {
        return Long.parseLong(nextString());
    }
    public double nextDouble() throws IOException
    {
        return Double.parseDouble(nextString());
    }
}


Measured memory_bytes: 64864
//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx,avx2,fma")
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define ull unsigned long long
#define db long double
#define pb push_back
#define ppb pop_back
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(), (x).end()

#define int long long

void dout() { cerr << '\n'; }

template <typename Head, typename... Tail>
void dout(Head H, Tail... T) {
    cerr << " " << H;
    dout(T...);
}

#ifdef LOCAL
    #define dbg(...) cerr << #__VA_ARGS__, dout(__VA_ARGS__)
#else
    #define dbg(...) ;
#endif

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
typedef pair <int, int> pii;



signed main() {
    ios_base::sync_with_stdio(false), cin.tie(NULL);
    #ifdef LOCAL
        freopen("input.txt", "r", stdin);
    #endif

    int k;
    cin >> k;
    k--;
    string num = "1";
    while (k--) {
        int pos = num.size() - 1;
        while (num[pos] == '9' || (pos > 0 && num[pos] > num[pos - 1])) {
            pos--;
        }
        if (pos == -1) {
            int len = num.size();
            num = "";
            num.pb('1');
            for (int i = 0; i < len; i++) {
                num.pb('0');
            }
        }   else {
            num[pos]++;
            for (int i = pos + 1; i < num.size(); i++) {
                num[i] = max(0, (num[i - 1] - '0') - 1) + '0';
            }
        }
    }
    cout << num;
}


Measured memory_bytes: 256
from fractions import gcd
n,m=map(int,input().split())
a=list(map(int,input().split()))
for i in range(n):
  a[i]//=2
a=sorted(set(a))[::-1]
n=len(a)
b=a[0]
d=a[0]
e=a[0]
ans=m
for i in range(n-1):
  b=gcd(d,a[i+1])
  d=d*a[i+1]//b
  e=gcd(e,a[i+1])
 
c=m//d-m//(2*d)
for i in range(n):
  a[i]//=e
  if a[i]%2==0:
    c=0
    break
 
print(c)

Measured memory_bytes: 16280
#include<iostream>
#include<math.h>
#define ll long long int
using namespace std;

int main() {
	string s;
	cin >> s;
	ll num = 0;
	for(int i=0;i<s.size();++i)
    {
        num += (int)(s[i]) - (int)('0');
    }
    if(num % 9 == 0) cout << "Yes" << endl;
    else cout << "No" << endl;
	return 0;
}


Measured memory_bytes: 3480
#include<bits/stdc++.h>
using namespace std;
#define il inline
#define ll long long
#define outy printf("Yes\n")
#define outn printf("No\n")
#define outf printf("First\n")
#define outs printf("Second\n")
#define FOR(a,b,c) for(int a=b;a<=c;a++)
#define FORD(a,b,c) for(int a=b;a>=c;a--)
#define FORL(a,b) for(int a=head[b];a;a=nxt[a])
#define in(a)  a=read()
#define in2(a,b)  in(a),in(b)
#define in3(a,b,c)  in2(a,b),in(c)
#define in4(a,b,c,d)  in2(a,b),in2(c,d)
#define out(a) printf("%d\n",a)
#define out2(a,b) printf("%d %d\n",a,b)
#define out3(a,b,c) printf("%d %d %d\n",a,b,c)
#define out4(a,b,c,d) printf("%d %d %d %d\n",a,b,c,d)
#define outl(a) printf("%lld\n",a)
#define outl2(a,b) printf("%lld %lld\n",a,b)
#define outl3(a,b,c) printf("%lld %lld %lld\n",a,b,c)
#define outl4(a,b,c,d) printf("%lld %lld %lld %lld\n",a,b,c,d)
#define clr(x,y) memset(x,y,sizeof(x))
ll read(){
    ll f=1,x=0;char c=getchar();
    while(c>'9'||c<'0'){if(c=='-')f=-1;c=getchar();}
    while(c>='0'&&c<='9')x=x*10+c-'0',c=getchar();
    return x*f;
}
/*------------------------------------------------------------*/
#define mod 1000000007
#define maxn 100010
#define inf 0x7fffffff
/*------------------------------------------------------------*/
int n,m;
int main(){
	in2(n,m);
	if(n+m==15)cout<<'+';
	 else if(n*m==15)cout<<'*';
	 else cout<<'x';
}

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

int main() {
  int A,B,i;
  int X=0;
  cin >> A >> B;

  for (i=0;i<2;i++) {
    if (A>B) {
      X+=A;
      A--; }
    else {
      X+=B;
      B--; }
  }
  
  cout << X << endl;
        
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<cstdio>
#include<cmath>
#include<deque>
#include<numeric>
#include<queue>
#include<stack>
#include<cstring>
#include<limits>
#include<functional>
#include<unordered_set>
#include<iomanip>
#include<cassert>
#include<regex>
#include<bitset>
#include<complex>
#include<chrono>
#include<random>
#define rep(i,a) for(int i=(int)0;i<(int)a;++i)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(),x.end()
using ll=long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 60;

ll gcd(ll n, ll m) {
	ll tmp;
	while (m!=0) {
		tmp = n % m;
		n = m;
		m = tmp;
	}
	return n;
}

ll lcm(ll n, ll m) {
	return abs(n * m) / gcd(n, m);//gl=xy
}
 
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 namespace std;
//ここから

void solve(){
  int a,b;
  cin>>a>>b;
  if(a+b>=10)cout<<"error";
  else cout<<a+b;
}

int main(){
	ios::sync_with_stdio(false);
  cin.tie(0);
	cout<<fixed<<setprecision(15);
  solve();
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < (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 namespace std;
using ll = long long;
using P = pair<int,int>;
using Pl = pair<long long,long long>;
using veci = vector<int>;
using vecl = vector<long>;
using vecveci = vector<vector<int>>;
using vecvecl = vector<vector<long long>>;

int main() {
    int N;
    cin >> N;
    cout << N/2*(N-N/2) << endl;
}


Measured memory_bytes: 256
S = input()
a = int(S[0:2])
b = int(S[2:4])
ans = ''

if 1 <= a <= 12 and 1 <= b <= 12:
    ans = 'AMBIGUOUS'
elif 1 <= b <= 12:
    ans = 'YYMM'
elif 1 <= a <= 12:
    ans = 'MMYY'
else:
    ans = 'NA'

print(ans)


Measured memory_bytes: 38384
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5;
int n, k, a[N], b[N], c[N], dp[N][3];
int main() {
    scanf("%d", &n);
    for(int i=0; i<n; ++i)
        scanf("%d%d%d", a+i, b+i, c+i);
    memset(dp, 0, sizeof dp);
    dp[0][0] = a[0];
    dp[0][1] = b[0];
    dp[0][2] = c[0];
    for(int i=1; i<n; ++i){
        dp[i][0] = max(dp[i-1][1], dp[i-1][2]) + a[i];
        dp[i][1] = max(dp[i-1][0], dp[i-1][2]) + b[i];
        dp[i][2] = max(dp[i-1][1], dp[i-1][0]) + c[i];
    }
    cout << max({dp[n-1][0], dp[n-1][1], dp[n-1][2]});
    return 0;
}


Measured memory_bytes: 2560
n,k = map(int,input().split())
h = [int(i) for i in input().split()]
dp = [float('inf')]*n
dp[0] = 0
for i in range(n):
    for j in range(1,k+1):
        m = i + j
        if m < n:
            dp[m] = min(dp[m],dp[i] + abs(h[i]-h[m]))

print(dp[-1])
    

Measured memory_bytes: 55264
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long x = Math.abs(sc.nextLong());
        long k = sc.nextLong();
        long d = sc.nextLong();
        long min = x % d;
        long min2 = Math.abs(x % d - d);
        long count = x / d;
        long a = k - (x / d);
        if(count >= k) {
            System.out.println(x - k * d);
            return;
        }
        if(min == min2) {
            System.out.println(min);
            return;
        }
        if(a % 2 != 0) {
            System.out.println(min2);
        } else {
            System.out.println(min);
        }
    }
}

Measured memory_bytes: 35596
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int s; cin >> s;
    set<int> S;
    int a = s, i = 1;
    for (;;) {
        if (S.count(a)) break;
        S.insert(a);
        if (a % 2 == 0) a /= 2;
        else a = 3 * a + 1;
        i++;
    }
    cout << i << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define rep(i,m,n) for(int i=(int)(m);i<(int)(n);++i)
#define rREP(i,m,n) for(int (i)=(n)-1; (i)>=(m);--(i))
#define all(x) (x).begin(),(x).end()
#define out(y,x,h,w) (y)<0||(x)<0||(y)>=(h)||(x)>=(w)
constexpr int INF = 1000000001;
constexpr ll mod = 1000000007;
constexpr double PI = 3.1415926535897932;

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;
}
inline void init() {
	cin.tie(nullptr); cout.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}

int main() {
	init();

	int N; cin >> N;
	map<int, ll>mp;
	rep(i, 2, N + 1) {
		int x = i;
		for (int j = 2;j * j <= i;++j) {
			if (x % j == 0) {
				while (x % j == 0) {
					mp[j]++;
					x /= j;
				}
			}
		}
		if (x != 1)mp[x]++;
	}
	ll ans = 1;
	for (auto p : mp) {
		ans *= p.second + 1;
		ans %= mod;
	}
	cout << ans << "\n";

	return 0;
}

Measured memory_bytes: 256