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

using namespace std;


#define PI 3.14159265
#define int long long


bool f(string s){
	int n = stoi(s);


	return n <= 12 and n > 0;
}



main(){


	string s; cin >> s;

	if(!f(s.substr(0, 2)) and !f(s.substr(2, 2))){
		cout << "NA" << endl; return 0;
	}


	if(f(s.substr(0, 2)) and f(s.substr(2, 2))){
		cout << "AMBIGUOUS" << endl; return 0;
	}


	if(f(s.substr(0, 2))){
		cout << "MMYY" << endl; return 0;
	}
	
	if(f(s.substr(2, 2))){
		cout << "YYMM" << endl; return 0;
	}
	
	
	return 0;
}

Measured memory_bytes: 256
N, A, B = map(int, input().split())
    
if N < A + B - 1 :
    print(-1)

else :
    if A > B :
        mode = 0
        A -= 1
    else :
        mode = 1
        B -= 1
        
    ret = []
    u = N - A + 1
    l = B
    while len(ret) < N :
        if (mode and A == 0) or (not mode and B == 0) :
            ret = [-1]
            break
            
        if mode :
            for i in range(max(u, l - B + 1), u + A) :
                ret.append(i)
            A -= 1
            u -= A
            mode ^= 1
        else :
            for i in range(min(l, u + A - 1), l - B, -1) :
                ret.append(i)
            B -= 1
            l += B
            mode ^= 1
            
    print(*ret)

Measured memory_bytes: 69232
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <sstream>
#include <cmath>
#include <set>
#include <iomanip>
#include <deque>
#include <stdio.h>
#include <random>
using namespace std;
 
#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define RREP(i,n) for(int (i)=(int)(n)-1;i>=0;i--)
#define REMOVE(Itr,n) (Itr).erase(remove((Itr).begin(),(Itr).end(),n),(Itr).end())
typedef long long ll;
 
int main() {
 
    int acc[200] = {};
 
    REP(i,2) {
        int a,b; cin >> a >> b;
        acc[a]++;
        acc[b+1]--;
    }
 
    REP(i,150) acc[i+1] = acc[i] + acc[i+1];
 
    int ans = 0;
    REP(i,150) {
        if(acc[i] == 2) ans++;
    }
 
    if(ans>0)cout << ans-1 << endl;
    else cout << 0 << endl;
 
    return 0;
} 

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

const int Maxn=10;

int N,A[Maxn+5];

int main() {
	#ifdef LOACL
	freopen("in.txt","r",stdin);
	freopen("out.txt","w",stdout);
	#endif
	scanf("%d",&N);
	for(int i=1;i<=N;i++)
		scanf("%d",&A[i]);
	sort(A+1,A+N+1);
	int t=0;
	for(int i=1;i<N;i++)
		t+=A[i];
	if(t>A[N])puts("Yes");
	else puts("No");
	return 0;
}

Measured memory_bytes: 128
/* ex7_1 
melo */
#include <stdio.h>
#include <math.h>
typedef struct{
    double x_elem;
    double y_elem;
}point;
point square_point(point top1,point top2){
    point top3;
    point r ={cos(M_PI/4),sin(M_PI/4)};
    top3.x_elem=sqrt(2)*(r.x_elem*(top2.x_elem-top1.x_elem)-r.y_elem*(top2.y_elem-top1.y_elem))+top1.x_elem;
    top3.y_elem=sqrt(2)*(r.x_elem*(top2.y_elem-top1.y_elem)+r.y_elem*(top2.x_elem-top1.x_elem))+top1.y_elem;
    return top3;
}
int main(void){
    point top1,top2,top3,top4;
    scanf("%lf %lf %lf %lf",&top1.x_elem,&top1.y_elem,&top2.x_elem,&top2.y_elem);
    top3=square_point(top1,top2);
    top4=square_point(top2,top3);
    printf("%.0lf %.0lf %.0lf %.0lf\n",top3.x_elem,top3.y_elem,top4.x_elem,top4.y_elem);
    return 0;
}


Measured memory_bytes: 1732
#include<iostream>
#include<cstring>
using namespace std;
int main()
{
	//freopen("xx.in","r",stdin);
	string s;
	cin>>s;
	int len=s.length();
	if(s[0]^s[len-1])
	{
		if(len&1) cout<<"First"<<endl;
		else cout<<"Second"<<endl;
	}
	else
	{
		if(len&1) cout<<"Second"<<endl;
		else cout<<"First"<<endl;
	}
	return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,s,n) for(int i=(s); i<(n); i++)
#define all(v) v.begin(),v.end()
#define outve(v) for(auto i : v) cout << i << " ";cout << endl
#define outmat(v) for(auto i : v){for(auto j : i) cout << j << " ";cout << endl;}
#define in(n,v) for(int i=0; i<(n); i++){cin >> v[i];}
#define out(n) cout << (n) << endl
#define fi first
#define se second
#define pb push_back
#define si(v) int(v.size())
#define len(v) int(v.length())
#define lob(v,n) lower_bound(all(v),n)
#define lobi(v,n) lower_bound(all(v),n) - v.begin()
#define upb(v,n) upper_bound(all(v),n)
#define upbi(v,n) upper_bound(all(v),n) - v.begin()
#define mod 1000000007
#define infi 1900000000
#define infl 1100000000000000000
#define cyes cout << "Yes" << endl
#define cno cout << "No" << endl
#define csp << " " <<
#define outset(n) cout << fixed << setprecision(n);
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vs = vector<string>;
using vc = vector<char>;
using vd = vector<double>;
using vvd = vector<vector<double>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vvp = vector<vector<pair<int,int>>>;
template<typename T> using ve = vector<T>;
template<typename T> using pq2 = priority_queue<T>;
template<typename T> using pq1 = priority_queue<T,vector<T>,greater<T>>;
template<typename T> bool chmax(T &a, T b) {if(a < b) {a = b;return 1;}return 0;}
template<typename T> bool chmin(T &a, T b) {if(a > b) {a = b;return 1;}return 0;}




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

    int N;
    cin >> N;
    
    vi ans(N+1,0);
    
    reps(x,1,101) reps(y,1,101) reps(z,1,101){
        int a = x*x + y*y + z*z + x*y + y*z + z*x;
        if(a <= N) ans[a]++;
    }
    
    reps(i,1,N+1) cout << ans[i] << endl;
    
    

    return 0;
}


Measured memory_bytes: 3536
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
int main(){
  int n;
  cin >> n;
  for(int i = 1; i < 10; i++){
    for(int j = 1; j < 10; j++){
      if(i * j == n){
        cout << "Yes" << endl;
        return 0;
      }
    }
  }
  cout << "No" << endl;
}

Measured memory_bytes: 256
import math
import sys
X = int(input())
flag = 0
cnt = 0

if X == 2 or X == 3:
    print(X)
    sys.exit()

while flag== 0:
    for i in range(2,int(math.sqrt(X+cnt))+2):
        if (X+cnt)%i == 0:
            break
        if i ==int(math.sqrt(X+cnt)):
            flag = 1
            result = X+cnt
    cnt += 1

print(result)


Measured memory_bytes: 3060
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))

n,m = iim()
l = [-1]*n
flag = True
for i in range(m):
    s,c = iim()
    if l[s-1] != -1 and l[s-1] != c:
        flag = False
    else:
        l[s-1] = c

if n > 1 and l[0] == 0:
    flag = False

ans = ''
for i,item in enumerate(l):
    if item == -1:
        if i == 0 and n > 1:
            ans += '1'
        else:
            ans += '0'
    else:
        ans += str(item)
print(ans if flag else -1)


Measured memory_bytes: 3064
//import java.util.ArrayList;
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
//		ArrayList<String> ansBox=new ArrayList<String>();
		String c="";
		Scanner sc=new Scanner(System.in);
		while(true) {//"-"が入力されるまで繰り返す
			//文字列入力
			String str=sc.next();
			int n=str.length();
			if(str.equals("-")) {
				break;
			}

			//シャッフル回数m入力
			int m=Integer.parseInt(sc.next());

			//シャッフルする番号入力//m回シャッフルする
			for(int i=0;i<m;i++) {
				int h=Integer.parseInt(sc.next());
				//strから文字列を切り分け
				String a=str.substring(0,h);
				String b=str.substring(h,n);
				str=b+a;
			}
			System.out.println(str);
		}
	}

}



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

int main() {
  double r = 0;
  int n, s = 0, c;
  cin >> n;
  vector<int> v(n);
  rep(i, n){
    cin >> v[i];
    r += v[i];
  }
  r /= n;
  if(r > floor(r)+0.5) c = ceil(r);
  else c = floor(r);
  rep(i, n) s += (v[i]-c)*(v[i]-c);
  cout << s << endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.*;


public class Main {
	public static void main (String[] args){
		Scanner sc =  new Scanner(System.in);
		int A[] = new int[9];
		for(int i = 0; i < 9; i++) {
			A[i] = sc.nextInt();
		}
		int N = sc.nextInt();
		int B[] = new int[N];
		for(int i =0; i < N; i++) {
			B[i] = sc.nextInt();
		}
		boolean E[] = {false,false,false,false,false,false,false,false,false};
		boolean BINGO = false;
		for(int i = 0; i < 9; i++) {
			for(int j = 0; j < N; j++) {
				if(A[i] == B[j]) {
					E[i] = true;
					break;
				}
			}			
		}
		//縦
		if(E[0] == true && E[3] == true && E[6] == true) {
			BINGO = true;
		}
		else if(E[1] == true && E[4] == true && E[7] == true) {
			BINGO = true;
		}
		else if(E[2] == true && E[5] == true && E[8] == true) {
			BINGO = true;
		}
		//横
		else if(E[0] == true && E[1] == true && E[2] == true) {
			BINGO = true;
		}
		else if(E[3] == true && E[4] == true && E[5] == true) {
			BINGO = true;
		}
		else if(E[6] == true && E[7] == true && E[8] == true) {
			BINGO = true;
		}
		//斜め
		else if(E[0] == true && E[4] == true && E[8] == true) {
			BINGO = true;
		}
		else if(E[2] == true && E[4] == true && E[6] == true) {
			BINGO = true;
		}
		System.out.println(BINGO?"Yes":"No");
	}
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
#define ll long long
//const int mod = 1000000007;
const int mod = 998244353;
struct mint
{
    ll x; // typedef long long ll;
    mint(ll x = 0) : x((x % mod + mod) % mod) {}
    mint operator-() const { return mint(-x); }
    mint &operator+=(const mint a)
    {
        if ((x += a.x) >= mod)
            x -= mod;
        return *this;
    }
    mint &operator-=(const mint a)
    {
        if ((x += mod - a.x) >= mod)
            x -= mod;
        return *this;
    }
    mint &operator*=(const mint a)
    {
        (x *= a.x) %= mod;
        return *this;
    }
    mint operator+(const mint a) const { return mint(*this) += a; }
    mint operator-(const mint a) const { return mint(*this) -= a; }
    mint operator*(const mint a) const { return mint(*this) *= a; }
    mint pow(ll t) const
    {
        if (!t)
            return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1)
            a *= *this;
        return a;
    }

    // for prime mod
    mint inv() const { return pow(mod - 2); }
    mint &operator/=(const mint a) { return *this *= a.inv(); }
    mint operator/(const mint a) const { return mint(*this) /= a; }
};
istream &operator>>(istream &is, const mint &a) { return is >> a.x; }
ostream &operator<<(ostream &os, const mint &a) { return os << a.x; }

mint choose(int n, int a)
{
    mint x = 1, y = 1;
    rep(i, a)
    {
        x *= n - i;
        y *= i + 1;
    }
    return x / y;
}
int main()
{
    ll n, m, k;
    cin >> n >> m >> k;
    mint ans = 0;
    vector<mint> dp(k + 1);
    for (int i = 1; i < k + 1; i++)
    {
        if (i == 1)
        {
            dp[i] = n - 1;
        }
        else
        {

            dp[i] = dp[i - 1] * (n - i) / i;
            //dp[i] = (dp[i - 1] * (n - i) / i) % mod;
        }
    }
    rep(i, k + 1) //組みがi個になる時
    {
        mint count = 1;
        if (i == 0)
        {
            count *= m;
            count *= mint(m - 1).pow(n - 1); //(m-1)のn-1乗が欲しい
            ans += count;
            continue;
        }
        count *= m;
        count *= mint(m - 1).pow(n - 1 - i);
        //i個の選び方を(n-1)から考える。
        count *= dp[i]; //
        ans += count;
    }
    cout << ans.x << endl;
}

Measured memory_bytes: 4748
#include <algorithm>  
#include <iostream>  
#include <sstream>  
#include <string>  
#include <cstring>
#include <vector>  
#include <queue>  
#include <set>  
#include <map>  
#include <cstdio>  
#include <cstdlib>  
#include <cctype>  
#include <cmath>  
#include <list>  
#include <cassert>
#include <ctime>
#include <climits>
using namespace std;  

#define PB push_back  
#define MP make_pair  
#define SZ(v) ((int)(v).size())  
#define FOR(i,a,b) for(int i=(a);i<(b);++i)  
#define REP(i,n) FOR(i,0,n)  
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)  
#define REPE(i,n) FORE(i,0,n)  
#define FORSZ(i,a,v) FOR(i,a,SZ(v))  
#define REPSZ(i,v) REP(i,SZ(v))  
typedef long long ll;
typedef unsigned long long ull;
ll gcd(ll a,ll b) { return b==0?a:gcd(b,a%b); }

const int MAXN = 300000;

int n, len;
int x[MAXN];
int t[MAXN];

char s[MAXN + 1];

ll solve() {
	ll ret = 0;
	REP(i, n) {
		int y = t[i], z = (y - 1) / (2 * len);
		ret += 2 * z + 1; y -= 2 * len*z;
		bool l = y <= 2 * x[i], r = y <= 2 * (len - x[i]);
		s[i] = l&&r ? '*' : l ? 'R' : r ? 'L' : '-';
	}
	s[n] = '\0';
	//printf("%s: %lld\n", s, ret);
	{ int at = 0; REP(i, n - 1) if (s[i] == 'L') { while (at < i&&s[at] != '*') ++at; if (at < i) s[at] = s[i] = '.'; } }
	{ int at = 0; REP(i, n) if (s[i] == '*') { while (at < i&&s[at] != 'R') ++at; if (at<i) s[at] = s[i] = '.'; } }
	{ int at = 0; REP(i, n) if (s[i] == '*') { while (at < i&&s[at] != '*') ++at; if (at < i) s[at] = s[i] = '.'; } }
	REP(i, n) if (s[i] != '.') ++ret;
	if (s[n - 1] != '*'&&s[n - 1] != 'L') ret += 2;
	//printf("%s: %lld\n", s, ret);
	return ret*len;
}

void run() {
	scanf("%d%d", &n, &len); REP(i, n) scanf("%d", &x[i]); REP(i, n) scanf("%d", &t[i]);
	ll ans = solve();
	printf("%lld\n", ans);
}

int main() {
	run();
	return 0;
}


Measured memory_bytes: 2944
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Deque;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while (true) {
			int n = sc.nextInt();
			if (n == 0) {
				sc.close();
				break;
			}

			String firstGroup = "";

			Map<String, ArrayList<String>> groups = new HashMap<String, ArrayList<String>>();
			Map<String, Boolean> unused = new HashMap<String, Boolean>();
			for (int z = 0; z < n; z++) {
				String line = sc.next();
				String group = line.split(":")[0];
				if (z == 0) {
					firstGroup = group;
				}
				groups.put(group, new ArrayList<String>());
				unused.put(group, true);
				String[] members = line.split(":")[1].split(",");
				for (int i = 0; i < members.length; i++) {
					groups.get(group).add(
							members[i].trim().replaceAll("\\.", ""));
				}
			}

			ArrayList<String> ansList = new ArrayList<String>();
			Deque<String> deque = new ArrayDeque<String>();
			deque.add(firstGroup);
			unused.put(firstGroup, false);
			while (!deque.isEmpty()) {
				String person = deque.poll();
				if (groups.get(person) == null && !ansList.contains(person)) {
					ansList.add(person);
				} else if (groups.get(person) != null) {
					// personがグループ名の時
					for (String child : groups.get(person)) {
						if (!ansList.contains(child)
								&& (groups.get(child) == null || unused
										.get(child))) {
							deque.add(child);
							unused.put(child, false);
						}
					}
				}
			}

			System.out.println(ansList.size());

		}
	}
}

Measured memory_bytes: 50192
#include <iostream>
using namespace std ;
int main(){
    char a[19];
    for(int i=0;i<19;++i)
        cin>>a[i];
    for(int i=0; i<19; ++i){
         if(((a[i]==',')&&(i==5))||((a[i]==',')&&(i==13))){
	cout<<" ";
	continue;}
cout<<a[i];}


return 0;
}

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

using namespace std;


const int N = 101000;
#define ll long long
#define fr(i,a,n) for (int i=a;i<n;i++)
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define vipb(v) int x;cin>>x;v.pb(x);
#define vllpb(v) ll x;cin>>x;v.pb(x);
typedef vector<int> VI;
typedef vector<ll> VL;
string s;
ll n, m;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	ll k;
	cin >> n >> m >> k;
	bool a = 1;
	while (k--) {
		if (a) {
			if (n % 2 != 0) {
				n--;
			}
			m += n / 2;
			n /= 2;
			a = 0;
		}
		else {
			if (m % 2 != 0) {
				m--;
			}
			n += m / 2;
			m /= 2;
			a = 1;
		}
	}
	cout << n << " " << m << endl;
	return 0;
}

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

using namespace std;

const int N = 2'500;

int n, m, p;
vector<pair<int, int>> g[N], g_rev[N];

int dist[N];
bool changed[N];

bool visited[N];

bool dfs(int u) {
    visited[u] = true;
    if (changed[u]) return true;
    for (auto vw : g_rev[u]) {
        int v = vw.first;
        if (visited[v]) continue;
        if (dfs(v)) return true;
    }
    return false;
}

int main() {
    cin >> n >> m >> p;
    for (int i = 0; i < m; ++i) {
        int a, b, c;
        cin >> a >> b >> c;
        --a, --b;
        g[a].emplace_back(b, p - c);
        g_rev[b].emplace_back(a, p - c);
    }

    fill(dist, dist + n, INT_MAX);
    dist[0] = 0;
    for (int i = 0; i < n - 1; ++i) {
        for (int u = 0; u < n; ++u) {
            if (dist[u] == INT_MAX) continue;
            for (auto vw : g[u]) {
                int v, w;
                tie(v, w) = vw;
                dist[v] = min(dist[v], dist[u] + w);
            }
        }
    }

    for (int u = 0; u < n; ++u) {
        if (dist[u] == INT_MAX) continue;
        for (auto vw : g[u]) {
            int v, w;
            tie(v, w) = vw;
            if (dist[u] + w < dist[v]) changed[v] = true;
        }
    }

    if (dist[n - 1] == INT_MAX || dfs(n - 1)) {
        cout << -1;
    } else {
        cout << max(-dist[n - 1], 0);
    }
    cout << endl;

    return 0;
}


Measured memory_bytes: 640
n, m, c = map(int,input().split())
#n = int(input())
b = list(map(int,input().split()))
ls = [list(map(int,input().split())) for i in range(n)]
#s = input()
ans = 0
for i in range(n):
  tmp = []
  for j in range(m):
    tmp.append(ls[i][j] * b[j])
  tmp.append(c)
  if sum(tmp) > 0:
    ans += 1
print(ans)

Measured memory_bytes: 3064
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const int MOD = 1e9+7, MAX = 1e9, larg = 1e5, INF = -1e9;
long long A,B,C,D,E,F,G,H,I,J,K,L,N,M,O,P,Q,R,S,T,U,V,W,X,Y,Z;
long long max_value = INF, max_index = -1;
long long min_value = MAX, min_index = -1;
long long sum = 0;

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

int main() {
    string s;
    cin >> N >> s;
    char curr = s[0];
    int count = 1;
    rep(i, N-1){
        if(s[i+1] != curr){
            count++;
            curr = s[i+1];
        }
    }
    cout << count;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
int M, m, N;
int A[11][2];
int B[11][2];

bool hantei() {
	
	for (int i = m - 1; i >= 0; i--) {
		B[i][0] -= B[0][0];
		B[i][1] -= B[0][1];
	}
	for (int i = 0; i < m ; i++) {
		if (B[i][0] != A[i][0] or B[i][1] != A[i][1]) return false;
	}
	return true;
}

bool reversed() {
	for (int i = 0; i < m / 2; i++) {
		swap(B[i], B[m - i - 1]);
	}
	for (int i = m - 1; i >= 0; i--) {
		B[i][0] -= B[0][0];
		B[i][1] -= B[0][1];
	}
	bool res = hantei();
	for (int i = 0; i < m / 2; i++) {
		swap(B[i], B[m - i - 1]);
	}
	for (int i = m - 1; i >= 0; i--) {
		B[i][0] -= B[0][0];
		B[i][1] -= B[0][1];
	}
	return res;
}

void rotate() {
	for (int i = 0; i < m ; i++) {
		swap(B[i][0], B[i][1]);
		B[i][0] *= -1;
	}
}

int main() {
	while (cin >> N, N) {
		cin >> M;
		for(int i = 0; i < M; i++) {
			cin >> A[i][0] >> A[i][1];
		}
		for(int i = M - 1; i >= 0; i--) {
			A[i][0] -= A[0][0];
			A[i][1] -= A[0][1];
		}
		
		for(int n = 1; n <= N; n++) {
			cin >> m;
			for (int i = 0; i < m; i++) {
				cin >> B[i][0] >> B[i][1];
			}
			if (m != M) continue;
			bool f = false;
			for (int i = 0; i < 4 and (!f); i++) {
				f = (f or hantei());
				f = (f or reversed());
				rotate();
			}
			if (f) {
				cout << n << endl;
			}
		}
		cout << "+++++" << endl;
	}
}
		



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

#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let a = read::<i32>();
    let b = read::<i32>();
    println!(
        "{}",
        if a % 3 == 0 || b % 3 == 0 || (a + b) % 3 == 0 {
            "Possible"
        } else {
            "Impossible"
        }
    );
}


Measured memory_bytes: 4352
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>

using namespace std;
using ll = long long int;
#define rep(i,n) for(int i = 0; i < n; i++)
#define FOR(i, a, b)  for(int i = (a); i < (b) ; i++)

#define pb push_back
#define SORT(v,n) sort(v, v+n)
#define ALL(x) (x).begin(),(x).end()
#define debug(x) cerr << #x << ": " << x << '\n'
#define elif else if
#define itn ll
#define int ll
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
///                →,↑,←,↓,↗,↖,↙,↘
int dx[8] = { 1, 0, -1, 0, 1, -1, -1, 1 };
int dy[8] = { 0, 1, 0, -1, 1, 1, -1, -1 };

int h[1010];

int M[110][110];

signed main() {
	ios::sync_with_stdio(false);
	string s;
	cin >> s;
	for (int i = 0; i < s.size(); i += 2) {
		cout << s[i];
	}
	cout << '\n';
	return 0;
}

Measured memory_bytes: 592
#include <bits/stdc++.h>
#include <math.h>
#define ALL(a)    a.begin(), a.end() 
#define rep(i, K, N)  for(long long int i = K; i < N; i++)
#define ll long long int
#define PP 1000000007
using namespace std;

ll a, b, c, d, Ans = -1000000000000000000;
vector<ll>  X(2);vector<ll>  Y(2);

int main(){
cin >> X[0] >> X[1] >> Y[0] >> Y[1];

rep(i, 0, 2){

  rep(j, 0, 2){

  Ans = max(X[i]*Y[j], Ans);

  }
}
cout << Ans;
}

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

using namespace std;

#define REP(i,n) for(int i = 0; i < n; i++)
int main(void){
  int d;
  cin >> d;
  int c[26];
  REP(i,26) cin >> c[i];
  int s[d][26];
  REP(i,d){
    REP(j,26) cin >> s[i][j];
  }
  
  REP(i,d) cout << 1 << endl;
  return 0;
}

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

using namespace std;

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

    int count = 0;
    for (int state = 0; count < n; state = a[state]-1) {
        if (state+1 == 2) break;
        else count++;
    }

    cout << (count != n ? count : -1) << endl;
}

Measured memory_bytes: 768
#include <stdio.h>

int main(void)
{
	int n = 0, i = 0, j = 0, ka = 0;
	scanf("%d", &n);
	for (i = 1; i <= 9; i++) {
		for (j = 1; j <= 9; j++) {
			if (i*j == n) {
				ka = 1;
			}
		}
	}
	if (ka == 1) {
		printf("Yes");
	}
	else {
		printf("No");
	}


	return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <stack>
#include <tuple>
#include <cmath>
#include <iomanip>
#include <map>
#include <cstring> //memset(dp,0,sizeof(dp))
#include <functional>
#include <cctype>
#include <locale>
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define fi first
#define se second
#define pb push_back
#define ALL(a) (a).begin(),(a).end()
using namespace std;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
typedef pair<int,int> P;
typedef pair<long long,long long> Pll;
#define fout(num) cout << fixed << setprecision(20) << (num) << endl
//s[i]=tolower(s[i]); islower(s[i]); cout << tolower(s[i])はバグ
//vector<vector<ll>> dp(n,vector<ll>(n))
//exist x map o set



signed main(){
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    int n; cin >> n;
    vector<int> a(n),b(n),c(n);
    rep(i,n) cin >> a[i];
    rep(i,n) cin >> b[i];
    rep(i,n) cin >> c[i];
    sort(ALL(a));
    sort(ALL(b));
    sort(ALL(c));
    ll cnt[n];
    rep(i,n){
        if(c[n-1]<=b[i]) cnt[i]=0;
        else{
            int p=upper_bound(ALL(c),b[i])-c.begin();
            cnt[i]=n-p;
        }
    }
    ll sum[n];
    sum[n-1]=cnt[n-1];
    for(int i=n-2;i>=0;i--) sum[i]=sum[i+1]+cnt[i];
    ll ans=0;
    rep(i,n){
        if(b[n-1]<=a[i]) continue;
        int p=upper_bound(ALL(b),a[i])-b.begin();
        ans+=sum[p];
    }
    cout << ans << endl;
}


Measured memory_bytes: 6104
#include <stdio.h>

int main(void)
{
    int n,i,a[100];

    scanf("%d", &n);
    for(i=0;i<n;i++) 
        scanf("%d",a+i);
    printf("%d", *(a+n-1));
    for(i=n-2;i>=0;i--) {
        printf(" %d",*(a+i));
    }
    printf("\n");
    return 0;
}

Measured memory_bytes: 2660
#include <iostream>
#include <vector>
#define rep(i,n) for(int (i)=0;(i)<(n);++(i))
#define all(x) (x).begin(),(x).end()
#define dump(x) cout << #x << " = " << (x) << endl

using namespace std;
using ll = long long;

int main() {
    int n; cin >> n;
    vector<vector<int>> a(2, vector<int>(n, 0));
    rep(i, 2)rep(j, n) cin >> a[i][j];

    vector<int> ue(n+1, 0), shita(n + 1, 0);

    rep(i, n) ue[i + 1] = ue[i] + a[0][i];
    for (int i = n - 1; i >= 0; --i) shita[n - i] = shita[n - (i + 1)] + a[1][i];

    int ans = 0;
    for (int i = 1; i <= n; ++i) {
        ans = max(ans, ue[i] + shita[n - i + 1]);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <string>
#include <string.h>
#include <cstdlib>
#include <iomanip>
#include <stdio.h>

using namespace std;


int main(){

        int a,b;
        char op;

        while(1){
        scanf("%d %c %d\n",&a,&op,&b);
                switch(op){
                        case '+':
                                printf("%d\n",a+b);
                                break;
                        case '-':
                                printf("%d\n",a-b);
                                break;
                        case '*':
                                printf("%d\n",a*b);
                                break;
                        case '/':
                                printf("%d\n",a/b);
                                break;
                        case '?':
                                return 0;
                }
        }
}


Measured memory_bytes: 3192
#include <iostream>
#include <string>
#include <ctime>
using namespace std;

int main(){
	volatile clock_t c = clock();
	string s;
	cin >> s;
	c += (s[3] - 'a' + 1) * 0.01 * CLOCKS_PER_SEC;
	while(clock() < c);
	if(s[2] == s[3] && s[4] == s[5]){
		cout << "Yes\n";
	}
	else{
		cout << "No\n";
	}
}


Measured memory_bytes: 256
import java.util.*;
import java.lang.*;
import java.math.*;

public class Main {
	Scanner sc = new Scanner(System.in);

	class state implements Comparable<state> {
		int value;
		int pos;
		int omit;

		public int compareTo(state arg0) {
			return value - arg0.value;
		}

		state(int v, int p, int o) {
			value = v;
			pos = p;
			omit = o;
		}
	}

	void run() {
		for (;;) {
			int n = sc.nextInt();
			int m = sc.nextInt();
			int c = sc.nextInt();
			if ((n | m | c) == 0) {
				break;
			}

			int dp[][] = new int[n][n];

			int cost[][] = new int[n][n];

			for (int i = 0; i < n; i++) {
				Arrays.fill(cost[i], -1);
			}
			for (int i = 0; i < m; i++) {
				int a = sc.nextInt() -1;
				int b = sc.nextInt()-1;
				cost[a][b] = sc.nextInt();
			}

			PriorityQueue<state> q = new PriorityQueue<state>();
			q.add(new state(0, 0, 0));

			boolean used[][] = new boolean[n][n];
			int ans[][] = new int[n][n];
			for (;;) {
				if (q.isEmpty()) {
					break;
				}
				state t = q.poll();
				if (used[t.pos][t.omit]) {
					continue;
				}
				used[t.pos][t.omit] = true;
				ans[t.pos][t.omit] = t.value;
				for (int i = 0; i < n; i++) {
					if (cost[t.pos][i] != -1) {
						if (!used[i][t.omit]) {
							q.add(new state(t.value + cost[t.pos][i], i,
									t.omit));
						}
						if (t.omit+1 < n) {
							if (!used[i][t.omit + 1]) {
								q.add(new state(t.value, i, t.omit + 1));
							}
						}
					}
				}
			}
			for(int i = 0 ; i< n ; i++){
				if(ans[n-1][i] <= c){
					System.out.println(i);
					break;
				}
			}
		}

	}

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

Measured memory_bytes: 0
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#include <functional>
#include <ctime>
#include <cmath>
#include <limits>
#include <numeric>
#include <type_traits>
#include <iomanip>
#include <float.h>
#include <math.h>
using namespace std;
using ll = long long;


unsigned euclidean_gcd(unsigned a, unsigned b) {
    if (a < b) return euclidean_gcd(b, a);
    unsigned r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}

class UnionFind {
public:
    vector <ll> par;
    vector <ll> siz;
    UnionFind(ll sz_) : par(sz_), siz(sz_, 1LL) {
        for (ll i = 0; i < sz_; ++i) par[i] = i;
    }
    void init(ll sz_) {
        par.resize(sz_);
        siz.assign(sz_, 1LL);
        for (ll i = 0; i < sz_; ++i) par[i] = i;
    }
    ll root(ll x) {
        while (par[x] != x) {
            x = par[x] = par[par[x]];
        }
        return x;
    }
    bool merge(ll x, ll y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        if (siz[x] < siz[y]) swap(x, y);
        siz[x] += siz[y];
        par[y] = x;
        return true;
    }

    bool issame(ll x, ll y) {
        return root(x) == root(y);
    }

    ll size(ll x) {
        return siz[root(x)];
    }
};

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

long long modinv(long long a, long long mod) {
    return modpow(a, mod - 2, mod);
}

void dfs(vector<vector<ll>>& z,ll oya,vector<ll> &kyori,vector<bool> &seen,ll now) {
    kyori[now] = oya;
    seen[now] = true;
    for (int i = 0; i < z[now].size(); i++) {
        if (seen[z[now][i]] == false) {
            dfs(z, oya + 1, kyori, seen, z[now][i]);
        }
    }
    return;
}

int main() {
    ll n,u,v;
    cin >> n >> u >> v;
    u--;
    v--;
    vector<vector<ll>> z(n);
    for (int i = 0; i < n-1; i++) {
        ll a, b;
        cin >> a >> b;
        a--;
        b--;
        z[a].push_back(b);
        z[b].push_back(a);
    }
    vector<bool> useen(n, false);
    vector<ll> ukyori(n);
    vector<bool> vseen(n, false);
    vector<ll> vkyori(n);
    dfs(z, 0, ukyori, useen,u);
    dfs(z, 0, vkyori, vseen, v);
    ll ans = 0;
    for (int i = 0; i < n; i++) {
        if (ukyori[i] < vkyori[i])ans = max(ans, vkyori[i] - 1);
    }
    cout << ans << endl;
}

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

typedef long long lint;
typedef long double louble;

template<typename T1,typename T2> inline T1 max(T1 a,T2 b){return a<b?b:a;}
template<typename T1,typename T2> inline T1 min(T1 a,T2 b){return a<b?a:b;}
template<typename T1,typename T2> inline T1 gmax(T1 &a,T2 b){return a=a<b?b:a;}
template<typename T1,typename T2> inline T1 gmin(T1 &a,T2 b){return a=a<b?a:b;}

namespace ae86
{
	const int bufl = 1<<15;
	
	char buf[bufl],*s=buf,*t=buf;
	
	inline int fetch()
	{
		if(s==t){t=(s=buf)+fread(buf,1,bufl,stdin);if(s==t)return EOF;}
		return *s++;
	}
	
	inline int ty()
	{
		int a=0,b=1,c=fetch();
		while(!isdigit(c))b^=c=='-',c=fetch();
		while(isdigit(c))a=a*10+c-48,c=fetch();
		return b?a:-a;
	}

	inline int tc()
	{
		int c=fetch();
		while(c<=32 && c!=EOF)c=fetch();
		return c;
	}
}
using ae86::ty;
using ae86::tc;

const int _ = 103;

int H,W,stx,sty,val[_][_],sval[_][_]={0};
short f[_][_][_][_];

inline int sumval(int xl,int xr,int yl,int yr)
{
	if(xl>xr)swap(xl,xr);
	if(yl>yr)swap(yl,yr);
	return sval[xr][yr]-sval[xl-1][yr]-sval[xr][yl-1]+sval[xl-1][yl-1];
}

int main()
{
	H=ty(),W=ty();
	for(int i=1;i<=H;i++)
		for(int j=1,a;j<=W;j++)
		{
			a=tc();
			if(a=='E')stx=i,sty=j;
			val[i][j]=a=='o';
		}

	for(int i=1;i<=H;i++)
		for(int j=1;j<=W;j++)
			sval[i][j]=sval[i-1][j]+sval[i][j-1]-sval[i-1][j-1]+val[i][j];

	int ans=0;
	memset(f,-64,sizeof(f)),f[stx][sty][stx][sty]=0;
	for(int i=stx;i>=1;i--)
		for(int j=sty;j>=1;j--)
			for(int a=stx;a<=H;a++)
				for(int b=sty;b<=W;b++)
				{
					gmax(ans,f[i][j][a][b]);
					int xl=a-stx+1,xr=H-stx+i,yl=b-sty+1,yr=W-sty+j;
					if(i>xl)gmax(f[i-1][j][a][b],f[i][j][a][b]+sumval(i-1,i-1,max(j,yl),min(b,yr)));
					if(j>yl)gmax(f[i][j-1][a][b],f[i][j][a][b]+sumval(max(i,xl),min(a,xr),j-1,j-1));
					if(a<xr)gmax(f[i][j][a+1][b],f[i][j][a][b]+sumval(a+1,a+1,max(j,yl),min(b,yr)));
					if(b<yr)gmax(f[i][j][a][b+1],f[i][j][a][b]+sumval(max(i,xl),min(a,xr),b+1,b+1));
				}
	printf("%d\n",ans);

	return 0;
}


Measured memory_bytes: 220288
#include <algorithm>
#include <cassert>
// #include <chrono>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
// #include <random>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>

/*
unsigned seed1 = std::chrono::system_clock::now().time_since_epoch().count();
mt19937 g1.seed(seed1);
*/
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<pii, pii> ppiipii;
typedef pair<int, ppiipii> pippiipii;
typedef pair<int, pii> pipii;
typedef pair<pii, int> ppiii;
typedef pair<int, ppiii> pippiii;
typedef pair<int, ll> pill;
typedef pair<int, double> pid;
typedef pair<string, string> pss;
// note to self, the below two triggers someone
typedef pair<ll, ll> pll;
typedef pair<ll, int> plli;
typedef long double ld;

int main() {
  int n;
  scanf("%d", &n);
  int r = 0;
  while(n--) {
    int a, b;
    scanf("%d%d", &a, &b);
    r += b-a+1;
  }
  printf("%d\n", r);
}


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

using namespace std;

long long a[100010];
long long b[100010];
long long c[100010];

int main()
{
    long long N;
    while(cin >> N)
    {
        for(long long j=0; j<N; j++)
            scanf("%lld",&a[j]);
        for(long long j=0; j<N; j++)
            scanf("%lld",&b[j]);
        for(long long j=0; j<N; j++)
            scanf("%lld",&c[j]);
        sort(a,a+N);
        sort(b,b+N);
        sort(c,c+N);
        long long sum=0;
        for(long long i=0;i<N;i++)
        {
            long long low=lower_bound(a,a+N,b[i])-a;
            long long upp=upper_bound(c,c+N,b[i])-c;
            //cout << low << ' ' << N-upp << endl;
            sum+=low*(N-upp);
        }
        cout << sum << endl;
    }
    return 0;
}


Measured memory_bytes: 2560
#include<stdio.h>
int main()
{
	char aa[6];
	gets(aa);
	int i,j=0;
	for(i=0;i<=3;i++)
	{
		if(aa[i]!=aa[i+1])
		{
			j=0;
			continue;
		}
		else
		{
			j=1;
			break;
		}
	}
	if(j!=1)
	printf("Good\n");
	else
	printf("Bad\n");
	return 0;
}

Measured memory_bytes: 128
// Package main provides
//
// File:  main.go
// Author: ymiyamoto
//
// Created on Sun Feb  2 15:28:19 2020
//
package main

import "fmt"

const MOD = 1e9 + 7

type pair struct {
	A int
	B int
}

var H, N int
var AB []pair

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func main() {
	fmt.Scan(&H, &N)
	AB = make([]pair, N)
	for i := range AB {
		fmt.Scan(&AB[i].A, &AB[i].B)
	}

	dp := make([]int, 1e4+1)
	for i := range dp {
		dp[i] = MOD
	}
	dp[0] = 0

	for _, ab := range AB {
		a := ab.A
		b := ab.B
		for i := range dp {
			if 0 <= i-a && dp[i-a] >= 0 {
				dp[i] = min(dp[i], dp[i-a]+b)
			}
		}
	}

	ans := int(MOD)
	for i := range dp {
		if i >= H {
			ans = min(ans, dp[i])
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 640
#include<stdio.h>
int main(){
  int a,b,c,i;
  scanf("%d%d",&a,&b);
  if(b%10==b)
    c=a*10+b;
  else if(b%100==b)
    c=a*100+b;
  else
    c=a*1000+b;
  for(i=1;i<=1000;i++){
    if(c==i*i){
      puts("Yes");
      return 0;
    }
  }
  puts("No");
  return 0;
}

Measured memory_bytes: 128
def gcd(a, b):
    return gcd(b, a%b) if b else a

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

x.append(X)
x = sorted(x)

s = [0 for i in range(N)]
for i in range(N):
    s[i] = x[i+1] - x[i]
    
ans = s[0]
for i in range(N):
    ans = gcd(ans, s[i])

print(ans)

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

// See debug.cc for usage etc
#define DEBUG 0

template <class... Args>
string dbgFormat(const char* fmt, Args... args) {
  size_t len = snprintf(nullptr, 0, fmt, args...);
  char buf[len + 1];
  snprintf(buf, len + 1, fmt, args...);
  return string(buf);
}

#if DEBUG
  #define DLOG(...)        cerr << dbgFormat(__VA_ARGS__) << endl
  #define DCALL(func, ...) func(__VA_ARGS__)
#else
  #define DLOG(...)
  #define DCALL(func, ...)
#endif

ll N, M;
vector<ll> sw;
vector<ll> p;

ll bitCount(ll bits) {
  ll cnt = 0;
  for (ll i = 0; i < N; i++) {
    if (bits & (1 << i)) cnt++;
  }
  return cnt;
}

bool check(ll mask) {
  for (ll i = 0; i < M; i++) {
    if (bitCount(mask & sw.at(i)) % 2 != p.at(i)) return false;
  }
  return true;
}

int main() {
#if !DEBUG
  ios_base::sync_with_stdio(false);
#endif

  cin >> N >> M;
  sw.resize(M);
  p.resize(M);
  for (ll i = 0; i < M; i++) {
    ll k;
    cin >> k;
    sw.at(i) = 0;
    for (ll j = 0; j < k; j++) {
      ll x;
      cin >> x;
      sw.at(i) |= 1 << (x-1);
    }
    DLOG("sw %lld = %lld", i, sw.at(i));
  }
  for (ll i = 0; i < M; i++) {
    cin >> p.at(i);
  }

  ll answer = 0;
  for (ll k = 0; k < (1 << N); k++) {
    if (check(k)) answer++;
  }
  cout << answer << endl;

  return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define mod 1000000007
ll exp(ll taban, ll us) {
    ll carpan = taban % mod;
    ll temp = us;
    ll res = 1;
    while(temp){
        if(temp % 2) res = (res*carpan) % mod;
        temp /= 2;
        carpan = (carpan*carpan) % mod;
    }
    return res;
}
ll ebob(ll a, ll b){
	if(!a)return b;
	return ebob(b%a, a);
}
ll ekok(ll a, ll b){
	return (a*b)/ebob(a, b);
}
double fonk(double x, double y){
	return x*x + y*y;
}
int main(){
	ios_base::sync_with_stdio(false); cin.tie(NULL);
	bool x = false, y = false;
    for(int i = 0; i < 3; i++){
		char c; cin>>c;
		if(c == 'A') x = true;
		else y = true;
	}
	x&&y ? cout<<"Yes" : cout<<"No";
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include <numeric>
#include<map>
#include<unordered_map>
#include <queue>

using namespace std;
using ll=long long;
#define rep(i,n)  for(ll i=0;i<n;++i)
#define all_map(itr,mp) for(auto itr=mp.begin();itr!=mp.end();itr++)
#define ALL(a) (a).begin(),(a).end()

ll d, g;
vector<ll> p(15), c(15);

int main(){
    cin >> d >> g;
    rep(i, d)cin >> p[i] >> c[i];
    ll ans = 100000;
    rep(i, 2<<10){
        ll point = 0;
        ll cnt = 0;
        rep(j, d+1)if(i&(1<<j)){
            point += p[j]*(j+1)*100+c[j];
            cnt += p[j];
        }
        if(point < g){
            ll mx = d-1;
            while(i&(1<<mx))mx--;
            ll k = 0;
            while(point < g && k <= p[mx])point+=(mx+1)*100, k++, cnt++;
        }
        if(point >= g)ans = min(ans, cnt);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <fstream>
#include <sstream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>

#define _GLIBCXX_DEBUG
#define rep(i, n) for (int64_t i = 0; i < (int64_t)(n); i++)
using namespace std;
using vi = vector<int64_t>;
using vvi = vector<vi>;

int main(int argc, const char * argv[]) {
    // fasten cin
    cin.tie(0);
    ios::sync_with_stdio(false);
    // implement
    int64_t n,k;
    cin >> n >> k;
    vi a(n);
    rep(i,n) cin >> a.at(i);
    int64_t res = 0;
    if((n-1)%(k-1)==0){
        res = (n-1)/(k-1);
    }else{
        res = (n-1)/(k-1) + 1;
    }
    cout << res << endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define ALL(e) e.begin(), e.end()
#define RALL(e) e.rbegin(), e.rend()
#define mp(a, b) make_pair(a, b)
#define pb push_back
#define dbg(x) (cerr << #x << ":" << x << endl)
#define mid (l + r) / 2
#define pii pair <int, int>
#define fi first
#define sc second
#define N 1000000009

using namespace std;

typedef long long int lli;

int main(){
	ios::sync_with_stdio(0);
	lli n;
	cin >> n;
	int res = 0;
	int resn = n;
	while(n > 0){
		res += n%10;
		n /= 10;
	}

	if(resn % res == 0) cout << "Yes";
	else cout << "No";

	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

class Main{
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);

		int M=sc.nextInt();
		int N=sc.nextInt();

		int roops=sc.nextInt();
		int[][] Js=new int[M+1][N+1];
		int[][] Os=new int[M+1][N+1];
		int[][] Is=new int[M+1][N+1];

		for(int i=0; i<=M; i++) {
			Js[i][0]=0;
			Os[i][0]=0;
			Is[i][0]=0;
		}
		for(int i=0; i<=N; i++) {
			Js[0][i]=0;
			Os[0][i]=0;
			Is[0][i]=0;
		}

		String a="";

		for(int i=1; i<=M; i++) {
			a=sc.next();
			for(int j=1; j<=N; j++) {
				if(a.charAt(j-1)=='J') {
					Js[i][j]=1;
					Os[i][j]=0;
					Is[i][j]=0;
				}
				else if(a.charAt(j-1)=='O') {
					Js[i][j]=0;
					Os[i][j]=1;
					Is[i][j]=0;
				}
				if(a.charAt(j-1)=='I') {
					Js[i][j]=0;
					Os[i][j]=0;
					Is[i][j]=1;
				}
			}
		}
		for(int i=0; i<=M; i++) {
			for(int j=1; j<=N; j++) {
				Js[i][j]=Js[i][j-1]+Js[i][j];
				Os[i][j]=Os[i][j-1]+Os[i][j];
				Is[i][j]=Is[i][j-1]+Is[i][j];
			}
		}

		for(int i=1; i<=M; i++) {
			for(int j=0; j<=N; j++) {
				Js[i][j]=Js[i-1][j]+Js[i][j];
				Os[i][j]=Os[i-1][j]+Os[i][j];
				Is[i][j]=Is[i-1][j]+Is[i][j];
			}
		}

		for(int i=0; i<roops; i++) {
			int sM=sc.nextInt();
			int sN=sc.nextInt();
			int gM=sc.nextInt();
			int gN=sc.nextInt();

			int j_ans=Js[gM][gN]-Js[gM][sN-1]-Js[sM-1][gN]+Js[sM-1][sN-1];
			int o_ans=Os[gM][gN]-Os[gM][sN-1]-Os[sM-1][gN]+Os[sM-1][sN-1];
			int i_ans=Is[gM][gN]-Is[gM][sN-1]-Is[sM-1][gN]+Is[sM-1][sN-1];

			System.out.println(j_ans+" "+o_ans+" "+i_ans);
		}
	}
}


Measured memory_bytes: 156708
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		String s = sc.next();
		String t = sc.next();

		if (s.equals(t.substring(0, s.length())))
			System.out.println("Yes");
		else
			System.out.println("No");
	}

}


Measured memory_bytes: 27008
#include<bits/stdc++.h>
#define FOR0(i,n) for(i=0;i<n;i++)
#define FOR(i,j,n) for(i=j;i<n;i++)
#define FORD(i,j,k) for(i=j;i>=k;i--)
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define inf 1000000000
#define ninf -1000000000
#define endl '\n' 
#define she_told_me_dont_worry ios_base::sync_with_stdio (false) ; cin.tie(0) ; cout.tie(0) ;
// Use cout.flush() for interactive problems.
// Use this for increased stack size: g++ -o a.exe -Wl,--stack=256000000 -O2 source.cpp
inline long long  MAX2(long long  a, long long int b){return (a)>(b)?(a):(b);}
inline long long  MAX3(long long  a, long long  b,long long  c){return (a)>(b)?((a)>(c)?(a):(c)):((b)>(c)?(b):(c));}
inline long long  MIN2(long long  a, long long  b){return (a)<(b)?(a):(b);}
inline long long  MIN3(long long  a, long long b,long long c){return (a)<(b)?((a)<(c)?(a):(c)):((b)<(c)?(b):(c));}
using namespace std;
typedef long long ll;
typedef pair<int,int> ii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector< ii > vii;
int main()
{
    she_told_me_dont_worry
    int n, k;
    cin>>n>>k;
    int ans = (n/2);
    if(n%2!=0) ans++;
    if(ans>=k) cout<<"YES";
    else cout<<"NO";
    cerr <<endl<< "Time elapsed : " << clock() * 1000.0 / CLOCKS_PER_SEC << " ms" << '\n';
}

Measured memory_bytes: 256
#include<stdio.h>
main()
{
int S,s,h,m;
0<=S<86400;
scanf("%d",&S);
h=S/3600;
m=(S-h*3600)/60;
s=(S-h*3600-m*60);
printf("%d:%d:%d\n",h,m,s);
return 0;
}

Measured memory_bytes: 592
def palin(x):
    #print(x)
    if x == x[::-1]: return True
    return False

a = input()
n = len(a)
if palin(a) and palin(a[:int((n-1)/2)]) and palin(a[int((n+3)/2)-1:]):
    print("Yes")
else: print("No")


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

int main()
{
	int n;
	int x[100], y[100];
	double s = 0;

	cin >> n;

	for (int i = 0; i < n; i++)
		cin >> x[i] >> y[i];

	for (int i = 1; i < n; i++) {
		x[i] -= x[0];
		y[i] -= y[0];
	}

	for (int i = 1; i < n - 1; i++)
		s += (double)(x[i] * y[i + 1] - x[i + 1] * y[i]) / 2;

	cout << setiosflags(ios::fixed|ios::showpoint) << setprecision(1)
		 << s << endl;

	return 0;
}


Measured memory_bytes: 3292
//S.G.N.//
#include <bits/stdc++.h>
using namespace std;
typedef vector< long long > vi;
typedef long long ll;
#define sz(a) int((a).size())
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define endl "\n"
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define fr(n) for(ll i=0;i<n;i++)
#define tr(a) for(auto it=a.begin();it!=a.end();it++)
#define N 998244353445 
#define PI 3.1415926535897932384
#define F first
#define S second
#define mp make_pair
#define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define mod 1000000007
void solve()
{
  ll n,k;
  cin>>n>>k;
  ll a[n];
  fr(n)
  cin>>a[i];
  ll dp[n];
  fr(n)
  {
    dp[i]=1000000000000;
  }
  dp[0]=0;
  fr(n)
  {
    rep(j,1,k+1)
    {
     if(i-j>=0)
      dp[i]=min(dp[i],dp[i-j]+abs(a[i]-a[i-j]));
    }
  }
  cout<<dp[n-1];

}
int main()
{
  
  #ifndef ONLINE_JUDGE
     * freopen("input.txt", "r", stdin);
      freopen("output.txt", "w", stdout);
  #endif
  FAST
  ll test;
  test=1;
  //cin>>test;
  while(test--)
  {
    solve();
  }
  return 0;
}

Measured memory_bytes: 5176
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <set>
#include <map>
using namespace std;

int main() {

    int N, C, K;
    cin >> N >> C >> K;

    vector<int> T(N);
    for (int i = 0; i < N; i++) cin>> T[i];

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

    int start = T[0];
    int sum = 1, cnt = 1;

    for (int i = 1; i < N; i++) {
        cnt ++;
        if (T[i] > start + K || cnt > C) {
            start = T[i];
            cnt = 1;
            sum ++;
        }
    }
    cout << sum << endl;
    
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define ll long long

using namespace std;

ll a[55], b[55], c[55], d[55];

int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    cin >> a[i] >> b[i];
  }
  for (int i = 0; i < m; i++) {
    cin >> c[i] >> d[i];
  }
  for (int i = 0; i < n; i++) {
    ll ans = 1e17, ansi = -1;
    for (int j = 0; j < m; j++) {
      int foo = abs(a[i] - c[j]) + abs(b[i] - d[j]);
      if (foo < ans) { ans = foo; ansi = j + 1; }
    }
    cout << ansi << endl;
  }
  return 0;
}


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

int main(){
  int N,K;cin>>N>>K;
  vector<int> A(N);
  for(int i=0;i<N;i++) cin>>A.at(i);
  for(int j=0;j<N-K;j++){
    if(A.at(j)<A.at(j+K)) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
  }
}




Measured memory_bytes: 4052
#include <stdio.h>
typedef unsigned int uint;
inline static uint gl(void){
    uint x = 0;
    for(;;){
        const uint c = getchar_unlocked() - 48;
        if(c < 10){
            x = x*10 + c;
        }else{
            break;
        }
    }
    return x;
}

int main(void){
    long n = gl();
    for(long i=0; i<n; i++){
        long t = gl();
        if(t%2==1){
            puts("first");
            return 0;
        }
    }
    puts("second");
    return 0;
}


Measured memory_bytes: 128