akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef pair<ll,ll> P;
 
long long int INF = 3e18;
double Pi = 3.1415926535897932384626;
 
//vector<ll> G[550010];
//vector<P> tree[500010];
priority_queue <ll> pql;
priority_queue <P> pqp;
//big priority queue
priority_queue <ll,vector<ll>,greater<ll> > pqls;
priority_queue <P,vector<P>,greater<P> > pqps;
//small priority queue
//top pop
 
int dx[8]={1,0,-1,0,1,1,-1,-1};
int dy[8]={0,1,0,-1,1,-1,-1,1};
char dir[] = "DRUL";
//ll bit[500005];
//↓,→,↑,←
 
 
#define p(x) cout<<x<<"\n";
#define el cout<<endl;
#define pe(x) cout<<(x)<<" ";
#define ps(x) cout<<fixed<<setprecision(25)<<x<<endl;
#define pu(x) cout<<(x);
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define CLEAR(a) a = decltype(a)(); 
 
 
ll mod = 1000000007;
/*
2000000011 is prime
2000000033 is prime
*/

ll rui(ll number1,ll number2){
 
    if(number2 == 0){
        return 1;
    }else{
        ll number3 = rui(number1,number2 / 2);
        number3 *= number3;
        number3 %= mod;
        if(number2%2==1){
            number3 *= number1;
            number3 %= mod;
        }
        return number3;
    }
}
ll gcd(ll number1,ll number2){
 
    if(number1 > number2){
        swap(number1,number2);
    }
    if(number1 == 0 || number1 == number2){
        return number2;
    }else{
        return gcd(number2 % number1,number1);
    }
}
void YES(bool condition){
 
    if(condition){
        p("YES");
    }else{
        p("NO");
    }
    return;
}
void Yes(bool condition){
 
    if(condition){
        p("Yes");
    }else{
        p("No");
    }
    return;
}

/*
ll fact[800005],rfact[800005];

void c3_init(){
    fact[0] = rfact[0] = 1;
    for(ll i=1; i<=800000; i++){
        fact[i] = (fact[i-1]*i) % mod;
    }
    rfact[800000] = rui(fact[800000],mod - 2);
    for(ll i=800000; i>=1; i--){
       rfact[i-1] = rfact[i] * i;
       rfact[i-1] %= mod;
    }
    return;}
ll c3(ll n,ll r){
    return (((fact[n] * rfact[r]) % mod) * rfact[n-r]) % mod;}
*/
 
ll n,m,num,sum,a,b,c,d,e,g,h,w,i,j,q;
ll k,ans;
ll x[500005],y[500005],z[500005];
char s[500005];

int main(){
    cin >> s;
    n = strlen(s);
    bool one = false;
    for(i=0;i<n;i++){
        if(one && s[i] == s[i-1]){
            if(i == n-1){
                ans--;
            }
            one = false;
            i += 1;
        }else{
            one = true;
        }
        ans++;
    }
    p(ans);
    
    return 0;
}






Measured memory_bytes: 384
#include <iostream>
#include <algorithm>
#include <map>
#include <math.h>
#include <string>
typedef long long ll;

using namespace std;

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

    ll res[100] = {0};
    res[0] = 2;
    res[1] = 1;
    for (int i = 2; i <= N; i++){
	res[i] = res[i-1]+res[i-2];
    }

    cout << res[N] << endl;

    return 0;
}


Measured memory_bytes: 256
import math
N = int(input())

n = int(math.sqrt(N))+1
#print(n)
def digit(x):
    if 1 <= x < 10:
        return 1
    elif x < 100:
        return 2
    elif x < 1000:
        return 3
    elif x < 10000:
        return 4
    elif x < 100000:
        return 5
    elif x < 1000000:
        return 6
    elif x < 10000000:
        return 7
    elif x < 100000000:
        return 8
    elif x < 1000000000:
        return 9
    else:
        return 10

while True:
    if(N % n == 0):
        k = N / n
        print(digit(k))
        break
    n-=1


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

const int MAXN = 5e5 + 10;
int a[MAXN], n;
vector<int> p;
bool r[MAXN];

int main() {
	for (int i = 2; i < MAXN; i++)
		if (!r[i]) {
			if (i % 5 == 1)
				p.push_back(i);
			for (int j = i; j < MAXN; j += i)
				r[j] = 1;
		}
	cin >> n;
	for (int i = 0; i < n; i++)
		cout << p[i] << ' ';
}

Measured memory_bytes: 896
#include<iostream>
#include<vector>
#include<cstdio>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<cmath>
#include<deque>
#include<queue>
using namespace std;

using ll = long long;
const int INF = 1001001001;
const ll LLINF = 1001001001001001001;
const int MOD = 1000000007;

#define rep(i,n) for (int i = 0; i < (n); ++i)

int main()
{
  int n;
  cin >> n;
  vector<double> a(n);
  rep(i,n) cin >> a[i];
  sort(a.begin(), a.end());
  reverse(a.begin(), a.end());
  for (int i = n-1; i >= 1; i--) {
    double tmp = (a[i] + a[i-1]) / 2;
    a.pop_back();
    a.pop_back();
    a.push_back(tmp);
  }

  cout << a[0] << endl;
}


Measured memory_bytes: 256
N, K = map(int, input().split())
p = list(map(int, input().split()))
 
exp = []
sum_list = []
result_list = []
result = 0
count = 0
tmp = 0
for i in range(N):
    if count < K-1:
        a = (p[i]+1)/2
        exp.append(a)
        tmp += a
    else:
        a = (p[i]+1)/2
        exp.append(a)
        tmp += a
        sum_list.append(tmp)
        tmp -= exp[count-K+1]
    count += 1

print(max(sum_list))


Measured memory_bytes: 77576
#include <stdio.h>
#define MAX 101
#define INFINITY 1048576 
#define WHITE -1
#define GRAY 0
#define BLACK 1
#define true 1
 
void serch(int,int *);
 
int M[MAX][MAX];
 
int main() {
 
  int n,i,j,k,v,a,d[MAX];
  scanf("%d",&n);
 
  for(i = 0; i < n; i++){
    for(j = 0; j < n; j++) {
      M[i][j] = INFINITY;
    }
  }
  for(i = 0; i < n; i++) {
    scanf("%d%d",&a,&k);
    for(j = 0; j < k; j++) {
      scanf("%d",&v);
      scanf("%d",&M[i][v]);
    }
  }
 
  serch(n,d);
 
  for(i = 0; i < n; i++) {
    printf("%d ",i);
    if(d[i] == INFINITY) printf("%d",-1);
    else printf("%d\n",d[i]);
  }
  return 0;
}
 
void serch(int n,int *d) {
  int u, v, min, i, j, p[MAX], c[MAX];
 
  for(i = 0; i < n; i++) {
    c[i] = WHITE; 
    d[i] = INFINITY; 
  }
 
  d[0] = 0;
  c[0] = GRAY;
 
  while(true) {
    min = INFINITY;
    u = -1;
 
    for(i = 0; i < n; i++) {
      if(min > d[i] && c[i] != BLACK) {
        u = i; 
        min = d[i];
      }
    }
 
    if(u == -1) break;
 
    c[u] = BLACK;
 
    for(v = 0; v < n; v++) {
      if(c[v] != BLACK && M[u][v] != INFINITY) {
        if(d[v] > M[u][v] + d[u]) {
          d[v] = M[u][v] + d[u];
          c[v] = GRAY;
        }
      }
    }
  }
 
  return;
}

Measured memory_bytes: 640
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(x) (x).begin(), (x).end()
#define dbg(x) cerr << #x << ": " << x << endl

int toi(char b) {
  switch(b) {
    case '0': return 0;
    case '1': return 1;
    default: return -1;
  }
}

int f(string s, char lc) {
  int res = 0;
  rep(i, s.size()) {
    res += toi(s[i]) ^ toi(lc);
    lc ^= 1;
  }
  return res;
}

int main() {
  string s;
  cin >> s;
  cout << min(f(s, '0'), f(s, '1')) << endl;
  return 0;
}

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

int main(){
  int x,a,b;
  cin >> x >> a >> b;
  int res = x - a;
  while(res >= 0) {
    res = res - b;
  }
  cout << res + b << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define Fst first
#define Snd second
#define RG register
#define mp make_pair
#define mem(a,b) memset(a,b,sizeof(a))
using namespace std;
typedef long long LL;
typedef long double LD;
typedef unsigned int UI;
typedef unsigned long long ULL;
template<typename T> inline void read(T& x) {
	char c = getchar();
	bool f = false;
	for (x = 0; !isdigit(c); c = getchar()) {
		if (c == '-') {
			f = true;
		}
	}
	for (; isdigit(c); c = getchar()) {
		x = x * 10 + c - '0';
	}
	if (f) {
		x = -x;
	}
}
template<typename T, typename... U> inline void read(T& x, U& ... y) {
	read(x), read(y...);
}
int n,K;
int G[600010];
char s[200010];
//#define rua
int main() {
//	ios::sync_with_stdio(false);
#ifdef rua
	freopen("GG.in","r",stdin);
#endif
  read(n,K); scanf("%s",s+1);
  for(int i=1;i<=n;++i) G[i]=s[i]-'A';
  int l=1,r=n,t=0;
  for(int i=1;i<=n<<1;++i) {
    if(G[l]^t==0) G[l]^=1;
    else t^=1,++l,G[++r]=t;
    if(i==K) {
      for(int i=l;i<=r;++i) G[i]^=t,printf("%c",G[i]+'A');
      return 0;
    }
  }
  if(n%2&&K%2) G[l]^=1;
  for(int i=l;i<=r;++i) G[i]^=t,printf("%c",G[i]+'A');
  return 0;
}


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

n, m = map(int, readline().split())

if n == 1 and m == 0:
  print(0)
  quit()
if m == 0:
  print('1' + '0' * (n-1))
  quit()
tf = [False] * (n + 1)
s = ['0'] * n
for _ in range(m):
  a, b = readline().split()
  a = int(a)
  if not tf[a]:
    s[a-1]=b
    tf[a] = True
  else:
    if s[a-1]==b:
      continue
    else:
      print(-1)
      quit()
if n == 1:
  print(''.join(s))
elif s[0] == '0':
  if tf[1]:
    print(-1)
    quit()
  s[0] = '1'
  print(''.join(s))
else:
  print(''.join(s))

Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;

int main()
{
	int N, L;
	cin >> N >> L;
	string s[100];
	for (int i = 0; i < N; i++) {
		cin >> s[i];
	}
	sort(s, s + N);
	string soon = "";
	for (int i = 0; i < N; i++) {
		soon += s[i];
	}
	cout << soon << endl;
}

Measured memory_bytes: 256
from functools import reduce
H, W = map(int, input().split())
s = [list("." + input() + ".") for _ in range(H)]
s.insert(0, list("."*(W+2)))
s.append(list("."*(W+2)))

while "#" in reduce(lambda x,y: x+y, s):
    hantei = reduce(lambda x,y: x+y, s)
    index = hantei.index("#") + 1
    #切り上げ - 1
    h = -(-index//(W+2)) - 1
    w = index - (W+2)*(h+1) - 1
    roop = False
    if (s[h-1][w] == "#") or (s[h-1][w] == "Z"):
        s[h][w] = "Z"
        s[h-1][w] = "Z"
        roop = True
    if (s[h][w-1] == "#") or (s[h][w-1] == "Z"):
        s[h][w] = "Z"
        s[h][w-1] = "Z"
        roop = True
    if (s[h][w+1] == "#") or (s[h][w+1] == "Z"):
        s[h][w] = "Z"
        s[h][w+1] = "Z"
        roop = True
    if (s[h+1][w] == "#") or (s[h+1][w] == "Z"):
        s[h][w] = "Z"
        s[h+1][w] = "Z"
        roop = True
    if not roop:
        break

if "#" in reduce(lambda x,y: x+y, s):
    print("No")
else:
    print("Yes")


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

int cmp(const void *a,const void *b)
{
    if(*(int*)a > *(int*)b)
      return 1;
    else if(*(int*)a < *(int*)b)
      return -1;
    else
      return 0;
}

int main()
{
  int N,i;
  int *a;

  scanf("%d", &N);
  a = calloc(N,sizeof(int));

  for(i=0; i<N; i++)
    scanf("%d",&a[i]);

  qsort(a, N, sizeof(int), cmp);

  for(i=0; i<N-1; i++){
    if(a[i] == a[i+1])
    {
      printf("NO"); return 0;
    }
  }
  printf("YES");
  return 0;
}


Measured memory_bytes: 3088
#include <stdio.h>
#include <string.h>
#include <limits.h>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <queue>

typedef unsigned long long ULLONG;
typedef long long LLONG;
static const LLONG MOD_NUM = 1000000007;

template<class _T> static void getint(_T& a) {
	const char* fmt = " %d";
	if (sizeof(_T) == sizeof(long long)) {
		fmt = " %lld";
	}

	if (scanf(fmt, &a) < 0) {
		printf("g1int Error\n");
	}
}
template<class _T> static void getint(_T& a, _T& b) {
	const char* fmt = " %d %d";
	if (sizeof(_T) == sizeof(long long)) {
		fmt = " %lld %lld";
	}

	if (scanf(fmt, &a, &b) < 0) {
		printf("g2int Error\n");
	}
}
template<class _T> static void getint(_T& a, _T& b, _T& c) {
	const char* fmt = " %d %d %d";
	if (sizeof(_T) == sizeof(long long)) {
		fmt = " %lld %lld %lld";
	}

	if (scanf(fmt, &a, &b, &c) < 0) {
		printf("g3int Error\n");
	}
}

static void ABC088D();

#if 1
int main()
{
	ABC088D();
	fflush(stdout);
	return 0;
}
#endif

static void ABC088D()
{
	int H, W;
	getint(H, W);

	std::vector<std::string> grid(H);
	for (int i = 0; i < H; i++) {
		std::cin >> grid[i];
	}

	std::vector<std::vector<int>> dp(H, std::vector<int>(W, (int)MOD_NUM));

	std::queue<std::pair<int, int>> que;
	que.push(std::pair<int, int>(0, 0));
	dp[0][0] = 0;
	while (!que.empty()) {
		int dh[] = { 1, 0, -1, 0 };
		int dw[] = { 0, 1, 0, -1 };

		std::pair<int, int> pos = que.front(); que.pop();
		int nowStep = dp[pos.first][pos.second] + 1;
		for (int i = 0; i < 4; i++) {
			int nh = pos.first + dh[i];
			int nw = pos.second + dw[i];

			if ((nh >= 0) && (nh < H) && (nw >= 0) && (nw < W) && (grid[nh][nw] == '.') && (nowStep < dp[nh][nw])) {
				dp[nh][nw] = nowStep;
				if ((nh == (H - 1)) && (nw == (W - 1))) {
					while (!que.empty()) que.pop();
					break;
				}
				que.push(std::pair<int, int>(nh, nw));
			}
		}
	}

	if (dp[H - 1][W - 1] == MOD_NUM) {
		printf("-1\n");
		return;
	}
	
	int whiteCount = 0;
	for (int h = 0; h < H; h++) {
		for (int w = 0; w < W; w++) {
			if (grid[h][w] == '.') {
				whiteCount++;
			}
		}
	}
	printf("%d\n", whiteCount - dp[H - 1][W - 1] - 1);
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <climits>

using namespace std;

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

typedef long long LL;
typedef vector<int> VI;

int main() {
  int A, B, C;
  cin >> A >> B >> C;
  if (A == B || B == C || C == A) {
    if (A == B && B == C) {
      cout << "No" << endl;
      return 0;
    } else {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repr(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define FORR(i, m, n) for (int i = (m); i >= (n); --i)
#define equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
const ll mod = 1000000007;
//const ll mod = 998244353;
const int inf = 1e9 + 10;
const ll INF = 1e18;
const ld EPS = 1e-10;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }



int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(25);

  int n, m;
  cin >> n >> m;

  int l = 1, r = n;
  bool f = false;
  rep(i, m) {
    if (n % 2 == 0 && r - l <= n / 2 && !f) {
      l++;
      f = true;
    }
    cout << l << ' ' << r << '\n';
    l++, r--;
  }




  
  return 0;
}

Measured memory_bytes: 3652
import java.util.Scanner;
import java.util.stream.IntStream;

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

	static int gcd(int a,int b){
		return a%b==0?b:gcd(b,a%b);
	}

	void solve(){
		int n=gInt(),m=gInt();
		int gcd=gcd(n,m);
		long x=(long)n*m;
		
		long lcm=x/gcd;
		String a=s.next(),b=s.next();
		
		for(int i=0;i<gcd;++i) {
			if(a.charAt(n/gcd*i)!=b.charAt(m/gcd*i)) {
				//System.out.println(a.charAt(n/gcd*i)+" "+b.charAt(m/gcd*i));
				System.out.println(-1);
				return;
			}
		}
		System.out.println(lcm);
	}

	public static void main(String[] A){
		new Main().solve();
	}

	static int gInt(){
		return Integer.parseInt(s.next());
	}
	static long gLong(){
		return Long.parseLong(s.next());
	}
	static double gDouble(){
		return Double.parseDouble(s.next());
	}

	IntStream REP(int n){
		return REP(0,n-1);
	}
	IntStream REP(int l,int r){
		return IntStream.rangeClosed(l,r);
	}

	IntStream INTS(int n){
		return IntStream.generate(Main::gInt).limit(n);
	}
}


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

using namespace std;

#define rep(i,n) for (decay_t <decltype (n)> i = 0, i ## __len = (n); i < i ## __len; ++ i)


using cost_t = pair <size_t, int>;
vector <vector <cost_t>> distances;

vector <int> color;

inline auto dfs (size_t node) -> void
{
  for (auto && elem : distances [node])
  {
    size_t to;
    int cost;
    tie (to, cost) = elem;
    if (color [to] == -1)
    {
      color [to] = color [node] ^ cost;
      dfs (to);
    }
  }
}

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

  size_t n;
  cin >> n;


  color = vector <int> (n + 1, -1);
  distances = vector <vector <cost_t>> (n + 1);

  size_t root = 0;

  rep (i, n - 1)
  {
    size_t u, v;
    int w;
    cin >> u >> v >> w;

    if (root == 0) root = u;

    distances [u].emplace_back (v, w & 1);
    distances [v].emplace_back (u, w & 1);
  }

  color [root] = 0;
  dfs (root);

  for (size_t i = 1; i <= n; ++ i)
  {
    cout << color [i] << endl;
  }
}



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

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

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define ALL(c) (c).begin(),(c).end()

int N;
int C[510], S[510], F[510];

int main() {
	cin >> N;

	rep(i, N-1) {
		cin >> C[i] >> S[i] >> F[i];
	}

	rep(i, N) {
		if (i == N - 1) {
			puts("0");
		} else {
			int c = 0;
			int p = i;
			while (p != N-1) {
				if (c >= S[p]) {
					c = (c + F[p] - 1) / F[p] * F[p];
				} else {
					c = S[p];
				}
				c += C[p];
				++p;
			}
			cout << c << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 256
n = gets.chomp.to_i
as = gets.chomp.split.map(&:to_i)

if as.count(0) > 0
  puts 0
  exit
end

ans = 1
as.each do |a|
	ans *= a
  	if ans > 10**18
      ans = -1
      break
    end
end

puts ans

Measured memory_bytes: 23512
import random
class Dice:
    def __init__(self,top,front,right,left,back,bottom):
        self.top, self.bottom=top,bottom
        self.right, self.left=right,left
        self.front, self.back=front,back
    def turn(self,order):
        if order=="N":
            self.top,self.front,self.bottom,self.back=self.front,self.bottom,self.back,self.top
        if order=="S":
            self.top,self.front,self.bottom,self.back=self.back,self.top,self.front,self.bottom
        if order=="E":
            self.top,self.right,self.bottom,self.left=self.left,self.top,self.right,self.bottom
        if order=="W":
            self.top,self.right,self.bottom,self.left=self.right,self.bottom,self.left,self.top
d1=map(int,raw_input().split())
d2=map(int,raw_input().split())
dice1=Dice(d1[0],d1[1],d1[2],d1[3],d1[4],d1[5])
dice2=Dice(d2[0],d2[1],d2[2],d2[3],d2[4],d2[5])
flg=0
for i in range(1000):
    d="NSWE"[random.randint(0,3)]
    dice1.turn(d)
    if dice1.top==dice2.top and dice1.front==dice2.front and dice1.right==dice2.right and dice1.left==dice2.left and dice1.back==dice2.back and dice1.bottom==dice2.bottom:
        print "Yes"
        flg=1
        break
if flg==0:
    print "No"


Measured memory_bytes: 6620
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i=0; i<n; i++)
#define pb push_back
#define int long long
//typedef pair<int, int> P;
typedef tuple<string, int, int> T;

int N;
int F[110][15];
int P[110][15];

signed main() {
    cin >> N;
    rep(i, N) rep(j, 10) cin >> F[i][j];
    rep(i, N) rep(j, 11) cin >> P[i][j];
    int ans = -1000000000000;
    rep(S, 1<<10) {
        if (S==0) continue;
        int ans_cand = 0;
        rep(i, N) {
            int cnt = 0;
            rep(j, 10) {
                if (F[i][j]==1 && (S>>j)&1) cnt++;
            }
            ans_cand += P[i][cnt];
        }
        ans = max(ans, ans_cand);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int a, b, c, d, e;
int main()
{
    cin >> a >> b;
    c = a + b;
    d = a - b;
    e = a * b;
    if (c >= d && c >= e) {
        cout << c;
    } else if (d >= c && d >= e) {
        cout << d;
    } else {
        cout << e;
    }
    return 0;
}


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

int main()
{
    int n;
    cin >> n;
    int ans = n % 10;
    if (ans == 3)
    {
        cout << "bon" << endl;
    }
    else if (ans == 0 || ans == 1 || ans == 6 || ans == 8)
    {
        cout << "pon" << endl;
    }
    else
    {
        cout << "hon" << endl;
    }
}


Measured memory_bytes: 3584
#include <bits/stdc++.h>
//using
using intl = long long;
using itnl = long long;//typo用
using uintl = unsigned long long;
using itn = int;//typo用
using ld = long double;
using namespace std;

//関数マクロ
#define rep(i, n) for(intl i = 0; i < (intl)(n); i++)
#define rrep(i, n) for(intl i = (intl)(n) - 1; i >= 0; i--)
#define repi(i, a, b) for(intl i = (intl)(a); i < (intl)(b); i++)
#define rrepi(i, a, b) for(intl i = (intl)(a) - 1; i >= (intl)(b); i--)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define m0(x) memset(x,0,sizeof(x))
#define m1(x) memset(x,1,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))
#define alength(a) (sizeof(a) / sizeof(a[0]))
#define debug(x) cout << #x << ":" << x << endl

//定数マクロ
#define pb push_back
#define mp make_pair
#define pii pair<intl,intl>

//定数
const intl INF = 1e9;
const intl MOD = 1e9+7;
const ld EPS = 1.0e-14;//-9
const ld PI = acos(-1);

//テンプレート関数
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; }
//intl gcd(intl a, intl b){ if(!b)return a; return gcd(b, a % b); } //c++17からある
//intl lcm(intl a,intl b){ return a / gcd(a, b) * b; } //c++17からある

//自作テンプレート関数
void fp(bool f){cout << (f ? "Yes" : "No") << endl;}//Yes,Noの出力を楽にするよう
void fp(bool f, string s, string t){cout << (f ? s : t) << endl;}//上の関数のYes,Noを任意の文字列でできるようにしたもの
intl fact(intl k){ intl a = 1; for(int i = 2; i <= k; i++){ a *= i; } return a; }//k!を求める関数,O(N)
intl digit10(intl a){ intl b = 0; do{ a /= 10; b++; }while(a); return b; }//aを10進数で表したときの桁数を求める関数,O(logN)


signed main(){
    cout << fixed << setprecision(10);
    intl n,a,b;
    cin >> n >> a >> b;
    intl x[n];
    rep(i,n)cin >> x[i];
    intl ans = 0;
    rep(i,n-1){
        ans += min(a * (x[i + 1] - x[i]), b);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 4316
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"
#define rep(i,a,b) for (int i = (a); i < (b); i++)
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
typedef complex<double> com;
const int mod = 1e9 + 7;
const int MOD = 998244353;
const int inf = 2e9;



int main(){
	int n; cin >> n;
	vector<string> grid(n);
	rep(i, 0, n) cin >> grid[i];
	int ans = 0;
	rep(k, 0, n) {
		bool flag = true;
		rep(i, 0, n)rep(j, 0, n) {
			if (grid[i][j] != grid[(j + k) % n][(i + n - k) % n]) flag = false;
		}
		if (flag) ans += n;
	}
	printf("%d", ans);
	return 0;
}


Measured memory_bytes: 384
#include <stdio.h>

int A, B;

int main(void)
{
	scanf("%d%d", &A, &B);
	if (A == B)
	{
		printf("Draw\n");
	}
	else if (A == 1)
	{
		printf("Alice\n");
	}
	else if (B == 1)
	{
		printf("Bob\n");
	}
	else if (A > B)
	{
		printf("Alice\n");
	}
	else if (B > A)
	{
		printf("Bob\n");
	}
	return 0;
}

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

int main()
{
    int n;
    cin>>n;
    string s,x;
    vector <int> a(26,0);
    cin>>s;
    for(int i=0;i<s.size();i++) a[s[i]-'a']++;
    for(int i=0;i<n-1;i++)
    {
        cin>>x;
        vector <int> b(26,0);
        for(int j=0;j<x.size();j++)
            b[x[j]-'a']++;
        for(int j=0;j<26;j++)
            a[j]=min(a[j],b[j]);
    }
    for(int i=0;i<26;i++)
        for(int j=0;j<a[i];j++)
        {
           cout<<(char)(i+'a');
        }

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

char island[9][9];

void dfs(int i, int j){
	int di, dj;
	
	island[i][j] = '0';
		
	for (di = -3; di <= 3; di++){
		if (0 <= i + di && i + di < 8 && island[i + di][j] == '1'){
			dfs(i + di, j);
		}
	}
	for (dj = -3; dj <= 3; dj++){
		if (0 <= j + dj && j + dj < 8 && island[i][j + dj] == '1'){
			dfs(i, j + dj);
		}
	}
}

int main(void)
{
	int i, j;
	int x, y;
	int n;
	int data = 0;
	
	scanf("%d", &n);
	while (n--){
		for (i = 0; i < 8; i++){
			if (scanf("%s", island[i]) == EOF){
				return (0);
			}
		}
		scanf("%d", &x);
		scanf("%d", &y);
		
		dfs(y - 1, x - 1);
		data++;
		printf("Data %d:\n", data);
		for (i = 0; i < 8; i++){
			printf("%s\n", island[i]);
		}
	}
	
	return (0);
}

Measured memory_bytes: 0
#include <stdlib.h>     /* srand, rand */
#include <time.h>       /* time */
#include <bits/stdc++.h>
#include <cmath>
#include <iomanip>
#include <iterator> 
using namespace std;

#define f first
#define s second

#define pb push_back
#define pp pop_back
#define mp make_pair

#define sz(x) (int)x.size()
#define sqr(x) ((x) * 1ll * (x))
#define all(x) x.begin(), x.end()
#define clr(a,v) memset(a, v, sizeof(a))

#define rep(i, l, r) for (int i = (l); i <= (r); i++)
#define per(i, l, r) for (int i = (l); i >= (r); i--)
#define reflex ios_base::sync_with_stdio(false)

#define nl '\n'
#define ioi exit(0);


#define PI 3.141592653589793238462643383279502884197169399375105820974944592307816406286

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
//~ const int N= (int)2e5 + 7;
const int inf = (int)1e9 + 7;
const int mod = (int)1e9 + 7;
//const int mod = 1000000007;
const ll linf = (ll)1e18 + 7;

const int dx[] = {-1, 0, 1, 0, 1, -1, -1, 1};
const int dy[] = {0, 1, 0, -1, 1, -1, 1, -1};
const int kx[] = {-1,1,2,2,1,-1,-2,-2};
const int ky[] = {2,2,1,-1,-2,-2,-1,1};

int v[100007];
int main() {
	int a, b; cin>> a >> b;
	cout<< a* b;
  return 0; 
} 





Measured memory_bytes: 3632
import re
n=int(input())
A=[]
for i in range(n):
    B=["."]*n
    for x,y in [list(map(int,input().split())) for k in range(int(input()))]:
        B[x-1]=str(y)
    A.append("".join(B))
ans=0
for i in range(2**n):
    num=format(i,"b").zfill(n)
    cnt,flag=0,1
    for k,j in enumerate(num):
        result=re.search(r"".join(A[k]),num)
        if result is not None and j=="1":
            cnt +=1
        elif (result is not None and j=="0") or (result is None and j=="1"):
            flag=0
            break
    if flag:ans=max(ans,cnt)
print(ans)

Measured memory_bytes: 3188
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define rrep(i,n) for(int i=1;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define maxs(a, b) a = max(a, b)
#define mins(a, b) a = min(a, b)
using namespace std;
template<class T> inline istream& operator >> (istream & c, vector<T> & A) {rep(i, A.size()) c >> A[i];return c;}
typedef long long ll;
typedef pair<int, int> P;
const ll linf = (1ll << 61);
const int inf = 1001001001;
const int mod = 1000000007;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int x;
	cin >> x;
	x /= 200;
	cout << 8 - x + 2 << endl;
	return 0;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i : x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
#define fast ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define ll long long
#define int long long
#define vll vector<long long>
#define pii pair<long long ,long long >
#define vvi vector< vector<long long > >
#define vpii vector<pair<int,int>>
#define pll  pair<long long ,long long >
#define pb  push_back
#define ff  first
#define sec second
#define SORT(a) sort(a.begin(),a.end())
#define SORTR(a) sort(a.rbegin(),a.rend())
#define m_p make_pair
#define all(x) (x.begin(),x.end())
#define sz(v) ((int)(v.size()))
#define endl '\n'
typedef vector< long long > vi ;
const int MOD = 1e9 + 7 ;
int size = 10000000;


void solve() {

  int n; cin >> n;
  int sum = 0 ;
  for ( int i = 1; i <= n; i++ ) {
    for ( int j = 1; j <= n ; j++ ) {
      for ( int k = 1; k <= n; k++ ) {

        sum += __gcd(i, __gcd(j, k));
      }
    }
  }
  cout << sum << endl;

}


int32_t main() {
  fast;
  /*  #ifndef ONLINE_JUDGE
      freopen("input.txt","r",stdin);
      freopen("output.txt","w",stdout);
    #endif */

  int T = 1; //cin>>T;
  while (T--) {
    solve();
  }

  return 0;
}



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

int main(){
  while(1){
    int n,x;cin >> n >> x;
    if(n == 0 && x == 0)return 0;
    int ans = 0;
    for(int i=1;i<=n;++i){
      for(int j=i+1;j<=n;++j){
        for(int k=j+1;k<=n;++k){
          if(i+j+k == x)ans += 1;
        }
      }
    }
    cout << ans << endl;
  }
  return 0;
}


Measured memory_bytes: 3032
#include<cstdio>
#include<cstring>
#include<algorithm>
#define SF scanf
#define PF printf
#define MAXN 100010
using namespace std;
typedef long long ll;
int n,l;
int fac[70],cnt;
struct node{
	int u,v,val;	
	node () {}
	node (int u1,int v1,int val1):u(u1),v(v1),val(val1) {}
}pr[70];
int main(){
	SF("%d",&l);
	l--;
	int sum=1;
	int tot=0;
	for(tot=0;sum-1<=l&&tot<=19;tot++)
		sum*=2;
	sum/=2;
	for(int i=1;i<tot;i++){
		pr[++cnt]=node(i,i+1,0);
		pr[++cnt]=node(i,i+1,1<<(i-1));
		/*PF("%d %d 0\n",i,i+1);
		PF("%d %d %d\n",i,i+1,1<<(i-2));
		cnt+=2;*/
	}
	int pre=0;
	int tot1=tot;
	tot--;
	sum/=2;
	while(pre<l){
		pre+=sum;
		for(;sum+pre+sum-1<=l;pre+=sum){
			pr[++cnt]=node(tot,tot1,sum+pre);
		}
		sum/=2;
		tot--;
	}
	/*if(topx*maxd<l)
		PF("1 2 %d\n",l-maxd*topx);*/
		
	PF("%d %d\n",tot1,cnt);
	for(int i=1;i<=cnt;i++)
		PF("%d %d %d\n",pr[i].u,pr[i].v,pr[i].val);
}
	

Measured memory_bytes: 128
#include<stdio.h>
int main(void)
{
	int e[12],i,j,box;
	for(i=0;i<12;i++){
	scanf("%d",&e[i]);
	}
	for(i=0;i<11;i++){
		for(j=i+1;j<12;j++){
			if(e[i]>e[j]){
				box=e[i];
				e[i]=e[j];
				e[j]=box;
			}
		}
	}
		if(e[0]==e[1]&&e[1]==e[2]&&e[2]==e[3]&&e[4]==e[5]&&e[5]==e[6]&&e[6]==e[7]&&e[8]==e[9]&&e[9]==e[10]&&e[10]==e[11]){
		printf("yes\n");
		}
		else{
			printf("no\n");
		}
	return 0;
}


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

int main() {
	int n, a[100000], num[100001], t,ans;
	t = 0;
	for (int i = 0; i < 100000; i++) {
		num[i] = 0;
	}
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		num[a[i] + 1]++;
		num[a[i]]++;
		if (a[i] > 0)num[a[i] - 1]++;
		else t++;
	}
	ans = t;
	for (int i = 0; i < 100000; i++) {
		if (ans < num[i])ans = num[i];
	}
	cout << ans << endl;

}


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

typedef long long int ll;
#define loop(i,s,e) for(ll i=s;i<e;i++)
#define test ll x;cin>>x;while(x--)
#define pb push_back
#define vec vector<ll>
#define sortvec(x) sort(x.begin(),x.end())
#define sz(x) x.size()

int main () {
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	ll n,k;
	cin>>k>>n;
	ll a[n+1];
	a[n]=-1;
	loop(i,0,n)
	cin>>a[i];

	a[n]=k-a[n-1]+a[0];
	ll m=-1;
	for (ll i=n-1;i>0;i--)
	{
		a[i]-=a[i-1];
		if (a[i]>m)
			m=a[i];
	}
	cout<<min(k-m,k-a[n])<<"\n";
}


Measured memory_bytes: 5184
function Main(input) {
var tmp = input.trim(); 
var tmp2 = parseInt(tmp.substring(tmp.length-1, tmp.length));
//console.log(tmp2);

if (tmp2 === 0 || tmp2 === 1 || tmp2 === 6 || tmp2 === 8) {
  console.log('pon');
} else if 
  (tmp2 === 3) {
    console.log('bon');
  } else 
  {console.log('hon')};
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 29628
#include<cstdio>
#include<cstring>
#define MAXN 1000
int A,B,C,D;char s[MAXN+5];
int main()
{
	A=B=C=D=1;
	scanf("%s",s+1);
	for(int i=1;i<=strlen(s+1);i++)
	A&=(s[i]!='N'),B&=(s[i]!='S'),C&=(s[i]!='W'),D&=(s[i]!='E');
	if((A^B)||(C^D))printf("No\n");
	else printf("Yes\n");//
}

Measured memory_bytes: 128
#include <stdio.h>
#include <string.h>
void replace(char str1[], int a, int b, char str2[]);
void reverse(char str[], int a, int b);
void print(char str[], int a, int b);
int main(){
  char line[1002];
  int i, j;
  char order[1000];
  char *str_ptr;
  int a, b;
  char temp[1000];
  int q;
  //
  fgets(line,sizeof(line), stdin);
  line[strlen(line)-1]='\0';
  //
  fgets(order, sizeof(order), stdin);
  sscanf(order, "%d", &q);
    //
  for(i=0; i<q; ++i){
  	fgets(order, sizeof(order), stdin); /* 命令の読み込み */
  	order[strlen(order)-1]='\0'; /* 改行文字の削除 */
  	str_ptr=strtok(order, " ");	 /* 命令の種類 */
  	strcpy(temp, order);		 /*  */
  	str_ptr=strtok(NULL, " ");
  	a=atoi(str_ptr);
  	str_ptr=strtok(NULL, " ");
  	b=atoi(str_ptr);
	//
  	if(strcmp(temp, "replace")==0){
  	  str_ptr=strtok(NULL, " ");
	  str_ptr[strlen(str_ptr)-1]=='\0';
	  replace(line, a, b, str_ptr);
  	}else if(strcmp(temp, "reverse")==0)
  	  reverse(line, a, b);
  	else if(strcmp(temp, "print")==0)
  	  print(line, a, b);
  }
  return 0;
}
void replace(char str1[], int a, int b, char str2[]){
  int i;
  int n;
  n=b-a+1;
  for(i=0; i<n; ++i)
	str1[a+i]=str2[i];
  
}
void reverse(char str[], int a, int b){
  int n;
  n=b-a+1;
  char temp[n];
  int i;
  for(i=0; i<n; ++i)
	temp[i]=str[a+i];
  for(i=0; i<n; ++i)
	str[a+i]=temp[n-1-i];
}
void print(char str[], int a, int b){
  int i;
  for(i=a; i<=b; ++i){
	printf("%c", str[i]);
	if(i==b)
	  printf("\n");
  }
}



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

#define ll long long int


int main()
{
	
	int ar[10000];
	memset(ar,0,sizeof(ar));
	string s;
	cin>>s;
	for(int i=0;i<4;i++)
	{
		ar[(int)(s.at(i)-'A')]++;
	}
	for(int i=0;i<100;i++)
	{
		if(ar[i]==1||ar[i]==4)
		{
			cout<<"No"<<endl;
			return 0;
		}
	}
	cout<<"Yes"<<endl;
	return 0;
}

Measured memory_bytes: 256
A,B = map(int,input().split())

_A = int(A//0.08)
_B = int(B//0.10)

r = sorted([_A,_B])
ans = []
for i in range(r[0],r[1]+2):
    if int(i*0.08) == A and int(i*0.1) == B :
        ans.append(i)

if ans == []:
    print("-1")
else:print(ans[0])

Measured memory_bytes: 3064
import sys
def gcd(a, b):
	while b:
		a, b = b, a % b
	return a
def lcm(a, b):
	return a * b // gcd (a, b)

for line in sys.stdin.readlines():
    num = map(int, line.strip().split())
    print "%i %i"%(gcd(num[0],num[1]) , lcm(num[0],num[1]))
    

Measured memory_bytes: 4204
int m[2000][2000];
main(){
	int N,K;
	for(scanf("%d%d",&N,&K);N--;){
		int x,y;char c;
		scanf("%d%d%*c%c",&x,&y,&c);
		if(c=='W'){x+=K;}
		for(int i=0;i<2;++i){
			x%=2*K;
			y%=2*K;
			++m[y][x];
			--m[y][(x+K)%(2*K)];
			--m[(y+K)%(2*K)][x];
			++m[(y+K)%(2*K)][(x+K)%(2*K)];
			if(x>=K){
				++m[y][0];
				--m[(y+K)%(2*K)][0];
			}
			if(y>=K){
				++m[0][x];
				--m[0][(x+K)%(2*K)];
			}
			if(x>=K&&y>=K){
				++m[0][0];
			}
			x+=K;
			y+=K;
		}
	}
	for(int y=0;y<2*K;++y){
		for(int x=1;x<2*K;++x){
			m[y][x]+=m[y][x-1];
		}
	}
	int z=0;
	for(int x=0;x<2*K;++x){
		for(int y=0;y<2*K;++y){
			if(y){
				m[y][x]+=m[y-1][x];
			}
			if(m[y][x]>z){
				z=m[y][x];
			}
		}
	}
	printf("%d",z);
}


Measured memory_bytes: 15744
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "iomanip"
#include "random"

using namespace std;

const long long int MOD = 1000000007;
const long double EPS = 0.00000001;
const long double PI = 3.1415926535897932384626433;

long long int N, M, K, H, W, L, R;



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

	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> M;
		string s = to_string(M);
		int cnt = 0;
		while (s.size() > 1) {
			cnt++;
			K = s.size();
			K--;
			int ans = 0;
			for (int j = 0; j < K; j++) {
				string t, u;
				for (int k = 0; k <= j; k++) {
					t += s[k];
				}
				for (int k = j + 1; k <= K; k++) {
					u += s[k];
				}
				int box = 0;
				for (auto k : t) {
					box *= 10;
					box += k - '0';
				}
				int bag = 0;
				for (auto k : u) {
					bag *= 10;
					bag += k - '0';
				}
				ans = max(ans, box*bag);
			}
			s = to_string(ans);
		}
		cout << cnt << endl;
	}
	return 0;
}

Measured memory_bytes: 3296
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, s, n) for (int i = (s); i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main() {
  int n;
  cin >> n;
  int mini = 1001001001;
  int a[n];
  rep(i, n) {
    cin >> a[i];
    if (a[i] < mini) mini = a[i];
  }
  int next_mini = mini;
  while (next_mini > 0) {
    rep(i, n) {
      if (a[i] != mini) a[i] = a[i] % mini;
      if (a[i] < next_mini && a[i] != 0) next_mini = a[i];
    }
    if (next_mini == 1) {
      mini = 1;
      break;
    }
    if (mini == next_mini) {
      break;
    }
    mini = next_mini;
  }
  cout << mini << endl;
  return 0;
}

Measured memory_bytes: 4000
/*
	Failure is not the reason for you to stop trying 
	   it is actually a remainder that you should 
			KEEP GOING 
*/
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define SaveTime ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back 
#define eb emplace_back
#define fn for(int i =0 ;i <n;i++)
#define fn1 for( int i =1;i<=n;i++)
#define fm for(int j =0 ;j <m;j++)
#define fm1 for(int j =1;j<=m;j++)
#define fi first
#define se second
#define MOD 1000000007
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
const int N = 1e6+5;
const int INF = 1e18L;
int ar[N];
int dp[N];
signed main(){
	// #ifndef ONLINE_JUDGE
	// freopen("input.txt","r",stdin);
	// freopen("output.txt","w",stdout);
	// #endif
	SaveTime;
	int T=1;
	// cin >> T;
	while(T--){
		int n;
		cin >> n ;
		string s,t;cin>>s>>t;
		for(int i =0 ;i < n;i++){
			cout << s[i] << t[i];
		}
	}
	
	cerr << "Time elapsed : " << 1.0 * clock() / CLOCKS_PER_SEC << " sec \n";
	return 0;
}



Measured memory_bytes: 256
n,x=map(int,input().split())
A=list(map(int,input().split()))
ans=0
for i in range(n-1):
  if A[i]+A[i+1]>x:
    if A[i]>x:
      ans+=A[i]+A[i+1]-x
      A[i+1]=0
      A[i]=x
      
    else:
      ans+=A[i]+A[i+1]-x
      A[i+1]=x-A[i]      
print(ans)

Measured memory_bytes: 14060
#include "bits/stdc++.h"
#define rep(i,b) for(ll i=0;i<b;i++)
#define ll long long
using namespace std;
/*--Input//////////////////////////////////////////////////*/
inline void IN(void){return;}
template <typename First, typename... Rest>
void IN(First& first, Rest&... rest){cin >> first;IN(rest...);return;}
#define SS(T, ...)      T __VA_ARGS__; IN(__VA_ARGS__);
#define SV(type,c,n) vector<type> c(n);for(auto& i:c)cin >> i;
/*--Output/////////////////////////////////////////////////*/
inline int p(void){cout << endl; return 0;}
template<class Head> int p(Head&& head){cout << head;p();return 0;} template<class Head,class... Tail> int p(Head&& head,Tail&&... tail){cout<<head<<" ";p(forward<Tail>(tail)...);return 0;}
struct ProconInit {
    static constexpr bool AUTOFLUSH = false;
    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(15);
        if(AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;

#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vvvl vector<vector<vector<ll>>>
#define debug(x) cerr<<#x<<" "<<x<<'\n';
#define all(x) (x).begin(),(x).end()
#define bit(n) (1LL<<(n))
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
bool cmp(pair<ll,ll> a, pair<ll,ll> b) { return a.first+a.second > b.first+b.second; }
const int MOD = 1000000007;
signed main() {
 
    SS(ll, N);
    SV(ll, A, N);
    vl B(N, 0);
    for (int i = N - 1; i >= 0; i--) {
        int k = i + 1;
        int sm = 0;
        for (int j = 2 * i + 1; j < N; j += k) {
            sm += B[j];
        }
        if (sm % 2 != A[i] % 2) {
            B[i] = 1;
        } else {
            B[i] = 0;
        }
    }
    vl res;
    rep(i, N) {
        if (B[i] == 1) {
            res.push_back(i + 1);
        }
    }
    p(res.size());
    for(auto x: res) cout << x << " ";
}

Measured memory_bytes: 5108
a, b, k = map(int, input().split())

# TEだった
# for _ in range(k):
#     if a >= 1:
#         a -= 1
#     elif b >= 1:
#         b -= 1

ans_a = 0
ans_b = 0

if a >= k:
    ans_a = a - k
    ans_b = b
else:
    ans_a = 0
    if b >= (k - a):
        ans_b = b - (k - a)
    else:
        ans_b = 0

print(ans_a, ans_b, sep=" ")


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

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

	if (s.length() == 3) {
		string k;
		reverse(s.begin(), s.end());
		cout << s << endl;
	}
	else {
		cout << s << endl;
	}

	return 0;
}

Measured memory_bytes: 888
#include <cstdint>
#include <iostream>
#include <string>

using namespace std;

int32_t main()
{
  string A, B, C;
  cin >> A >> B >> C;

  if ((A[A.size() - 1] == B[0]) && (B[B.size() - 1] == C[0])) {
    cout << "YES";
  } else {
    cout << "NO";
  }
  cout << endl;

  return 0;
}


Measured memory_bytes: 256
//Nayeem Shahriar Joy ,Applied Physics And Electronic Engineering , University of Rajshahi.


#include <bits/stdc++.h>
#include<algorithm>
#include<cstring>
#include<string>

using namespace std;

int main()

{

  ios_base::sync_with_stdio(false);

  cin.tie(NULL);

  string s;

  getline(cin,s);

  for(int i=0;i<s.size();i++)

  {
      s[i]=toupper(s[i]);
  }

  cout<<s<<endl;

  return 0;

}

Measured memory_bytes: 3096
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
typedef long long LL;
int main() {
	int h, w,count = 0;
	char grid[51][51] = {};
	char gc[51][51] = {};
	std::cin >> h >> w;
	for (int i = 1; i < h+1; i++) {
		for (int j = 1; j < w+1; j++) {
			std::cin >> grid[i][j];
			gc[i][j] = grid[i][j];
		}
	}
	for (int i = 0; i < h + 1; i++) {
		grid[i][w+1] = '.';
		gc[i][w+1] = '.';
	}
	for (int i = 0; i < h+1; i++) {
		for (int j = 0; j < w+1; j++) {
			if (gc[i][j] == '#') { goto skip; }
			if (gc[i][j + 1] == '#') { count++; }
			if (gc[i][j - 1] == '#') { count++; }
			if (gc[i-1][j] == '#') { count++; }
			if (gc[i+1][j] == '#') { count++; }
			if (gc[i+1][j + 1] == '#') { count++; }
			if (gc[i+1][j - 1] == '#') { count++; }
			if (gc[i-1][j + 1] == '#') { count++; }
			if (gc[i-1][j - 1] == '#') { count++; }
			grid[i][j] = '0' + count;
			skip:
			count = 0;
		}
	}
	for (int i = 1; i < h+1; i++) {
		for (int j = 1; j < w+1; j++) {
			std::cout << grid[i][j];
		}
		std::cout << std::endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main()
{
	int a, b, c, n, x, count;
	
	scanf("%d %d", &n, &x);
	while (n || x)
	{
		count = 0;
		for (a = 3; a <= n; a++)
		{
			for (b = 2; b < a; b++)
			{
				for (c = 1; c < b; c++)
				{
					if (a + b + c == x)
						count++;
				}
			}
		}
		printf("%d\n", count);
		scanf("%d %d", &n, &x);
	}
}


Measured memory_bytes: 2104
#include<bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
int main(){
  int n;
  cin >> n;
  vector<int> a;
  int ans = 0;
  rep(i, n){
    int temp; cin >> temp;
    while(temp%2 == 0){
      ans += 1;
      temp /= 2;
    }
  }
  cout << ans << endl;
}

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

static const int MAX = 1e+5;
vector<int> fr[MAX], bl[MAX];
int n, group[MAX], color = 0;

void dfs(int u){
    group[u] = color;
    for(int v : fr[u]){
        if(group[v] >= 0) continue;
        dfs(v);
    }
}

int main(){
    int m, k, a, b;
    cin >> n >> m >> k;
    rep(i, m){
        scanf("%d %d", &a, &b);
        a--, b--;
        fr[a].push_back(b);
        fr[b].push_back(a);
    } rep(i, k) {
        scanf("%d %d", &a, &b);
        a--, b--;
        bl[a].push_back(b);
        bl[b].push_back(a);
    }
    int num[n];
    rep(i, n){
        group[i] = -1;
        num[i] = 0;
    }
    rep(i, n){
        if(group[i] >= 0) continue;
        dfs(i);
        color++;
    }
    rep(i, n){
        num[group[i]]++;
    }
    int ans;
    rep(i, n){
        int cnt = 0;
        for(int x : bl[i]){
            if(group[x] == group[i]) cnt++;
        }
        ans = num[group[i]] - fr[i].size() - cnt - 1;
        if(i) printf(" ");
        printf("%d", ans);
    }
    printf("\n");
}

Measured memory_bytes: 12672
# B - 1 21
# https://atcoder.jp/contests/abc086/tasks/abc086_b

import sys

a,b = input().split()

c = int(a + b)

i = 0

while i <= 10000:
    if (i * i) == c:
        print("Yes")
        sys.exit()

    i = i + 1

print("No")


Measured memory_bytes: 2940
#include <queue>
#include <cstdio>
#include <iostream>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <sstream>
#include <algorithm>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-9)
#define INF (1e9)
#define PI (acos(-1))
#define REP(i,n) for(int i=0;i<n;i++)


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

ll n;
ll p[100000], j[100000], ans[100000] = {};
ll l = 0;

int main()
{
	while (true) {
		cin >> n;
		if (n == 0) break;
		int sum = 0;
		REP(i, n) {
			cin >> p[i];
			sum += p[i];
		}
		REP(i, n - 1) cin >> j[i];
		sort(j, j + n - 1, greater<ll>());

		ll k = 0;
		for (ll i = n; i >= 1; i--) {
			if (i != n) sum += j[k++];
			ans[l] = max(ans[l], sum * i);
//			cout << "ans[" << l << "]:" << ans[l] << endl;
//			cout << "sum * i:" << sum * i << endl;
//			cout << "sum:" << sum << endl;
//			cout << "i:" << i << endl;
		}
		l++;
	}
	REP(i, l) {
		cout << ans[i] << endl;
	}
}


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

struct BipartiteMatching {
    int n;
    vector<vector<int>> g;
    vector<int> match, used;
    BipartiteMatching(int n) : n(n), g(n), match(n), used(n) {}
    void addEdge(int u, int v) {
        g[u].push_back(v);
        g[v].push_back(u);
    }
    int maxmimumMatching(void) {
        int res = 0;
        match.assign(n, -1);
        for(int v = 0; v < n; ++v){
            if (match[v] < 0) {
                used.assign(n, false);
                if (augument(v)) res++;
            }
        }
        return res;
    }
    bool augument(int v) {
        used[v] = true;
        for (int u : g[v]) {
            int w = match[u];
            if (w < 0 || (!used[w] && augument(w))) {
                match[v] = u; 
                match[u] = v;
                return true;
            }
        }
        return false;
    }
};

#include <iostream>
int main() {
    int X, Y, E;
    while (cin >> X >> Y >> E) {
        BipartiteMatching bm(X + Y);
        for (int i = 0; i < E; ++i) {
            int x, y;
            cin >> x >> y;
            bm.addEdge(x , y + X);
        }
        cout << bm.maxmimumMatching() << endl;
    }
}

Measured memory_bytes: 3284
import java.util.Scanner;

public class Main {
	public static void main(String arg[]) {

		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		int count = 0;
		int sum = 0;

		for (int i = 1; i <= N; i++) {

			if (i % 2 == 0) {
				continue;
			}

			for (int j = 1; j <= i; j++) {
				if (i % j == 0) {
					count++;
				}
			}

			if (count == 8) {
				sum++;
			}
			count = 0;
		}

		System.out.print(sum);
	}
}

Measured memory_bytes: 21716
import sys

fin = sys.stdin.readline
n = int(fin())
p_list = [int(elem) for elem in fin().split()]

count = 0
for i in range(1, len(p_list)-1):
    prev_p = p_list[i-1]
    next_p = p_list[i+1]
    cur_p = p_list[i]
    if prev_p < cur_p < next_p:
        count += 1
    elif prev_p > cur_p > next_p:
        count += 1
print(count)


Measured memory_bytes: 38508