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

using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;
using LL = long long;
using VL = vector<LL>;
using VVL = vector<VL>;
using PLL = pair<LL, LL>;
using VS = vector<string>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

#define FF first
#define SS second
template<class S, class T>
istream& operator>>(istream& is, pair<S,T>& p){
  return is >> p.FF >> p.SS;
}
template<class S, class T>
ostream& operator<<(ostream& os, const pair<S,T>& p){
  return os << p.FF << " " << p.SS;
}
template<class T>
void maxi(T& x, T y){
  if(x < y) x = y;
}
template<class T>
void mini(T& x, T y){
  if(x > y) x = y;
}


const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD = 1e9+7;


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

  int N;
  cin >> N;
  VVL tab(N, VL(N));
  vector<pair<LL,PII>> es;
  LL ans = 0;
  REP(i,N) REP(j,N){
	cin >> tab[i][j];
	es.PB(MP(tab[i][j], MP(i, j)));
	if(i < j) ans += tab[i][j];
  }
  RSORT(es);

  REP(k,N) REP(i,N) REP(j,N)
	if(tab[i][j] > tab[i][k] + tab[k][j]){
	  cout << -1 << endl;
	  return 0;
	}

  for(auto&& e: es){
	int i = e.SS.FF, j = e.SS.SS;
	if(i >= j) continue;
	bool del = false;
	REP(k,N)
	  if(k != i && k != j && tab[i][j] == tab[i][k] + tab[k][j]){
		del = true;
	  }
	if(del)
	  ans -= tab[i][j];
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3196
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1e9+7;
int main(){
    int n;
    cin >> n;
    vector<int> arr(n);
    ll sum = 0;
    for(int i = 0; i < n; ++i){
        cin >> arr[i];
        sum += arr[i];
    }
    sort(arr.begin(),arr.end());
    if(sum%10 == 0){
        bool found = false;
        for(int i = 0; i < n; ++i)
            if(arr[i]%10 != 0){
                found = true;
                sum -= arr[i];
                break;
            }
        if(!found)
            sum = 0;
    }
    cout << sum << '\n';
}


Measured memory_bytes: 256
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        StringBuilder str = new StringBuilder();
        str.append(scan.next());
        int amount = scan.nextInt();
        String op;
        for (int i = 0; i < amount; i++) {
            op = scan.next();
            if ("replace".equals(op)) {
                int start = scan.nextInt();
                int end = scan.nextInt();
                String substr = scan.next();
                str.replace(start, end + 1, substr);
            }
            if ("reverse".equals(op)) {
                int start = scan.nextInt();
                int end = scan.nextInt();
                StringBuilder for_reverse = new StringBuilder();
                for_reverse.append(str.substring(start, end + 1));
                for_reverse.reverse();
                str.replace(start, end + 1, for_reverse.toString());
            }
            if ("print".equals(op)) {
                int start = scan.nextInt();
                int end = scan.nextInt();
                System.out.println(str.substring(start, end + 1));
            }
        }
    }
}

Measured memory_bytes: 22104
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define pi acos(-1)
#define mod 1000000009
using namespace std;

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

    int n;
    cin >> n;
    int a;
    bool f = true;
    for(int i = 0; i < n; i++){
        cin >> a;
        if(a % 2 == 0 && a % 3 != 0 && a % 5 != 0){
            f = false;
        }
    }
    if(f){
        cout << "APPROVED";
    }else{
        cout << "DENIED";
    }
}


Measured memory_bytes: 256
#include<iostream>
#include <algorithm>
#include <string>
#include<math.h>
#define rep(i,n)for(int i=0;i<n;i++)
using namespace std;
int main() {
    int a, b, r;
    cin >> a >> b >> r;
    if (a > r) {
        cout << "NO" << endl;
    }
    else if (a + b < r) {
        cout << "NO" << endl;
    }
    else {
        cout << "YES" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
  char s[101];
  scanf("%s",s);
  //printf("%s",s);
  for(int i=0;i<102;i++)
    {
      if(i%2==0 && s[i]=='L'){
	printf("No\n");
	return 0;
      }
      else if(i%2==1 &&  s[i]=='R')
	{
	  printf("No\n");
	  return 0;
	}
    }
  printf("Yes\n");
  return 0;
  
  
  
}


Measured memory_bytes: 128
#include <iostream>

using namespace std;

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

    int A[N][N];
    for(int i=0; i<N; i++){
        for(int j=0; j<N; j++){
            cin >> A[i][j];
        }
    }

    int fl = false;
    long ans = 0;
    for(int i=0; i<N-1; i++){
        for(int j=i+1; j<N; j++){
            int cnt = 0;
            int isconnected = true;
            for(int k=0; k<N; k++){
                if(A[i][j] > A[i][k]+A[k][j]) fl = true;
                if(A[i][j] == A[i][k]+A[k][j] && i!=k && j!=k)isconnected = false;
            }
            if(isconnected) ans += A[i][j];
            if(fl) break;
        }
        if(fl) break;
    }

    if(fl){
        cout << -1 <<endl;
        return 0;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 640
<?php

$weight = array(91, 81, 75, 69, 64, 60, 57, 54, 51, 48);
$class = explode(
    ',',
    'heavy,light heavy,middle,light middle,welter,light welter,light,feather,bantam,fly'
);
while (($line = trim(fgets(STDIN))) !== '') {
    $n = (int)ceil($line * 100);
    $str = 'light fly';
    foreach ($weight as $i => $w) {
        if ($n > $w * 100) {
            $str = $class[$i];
            break;
        }
    }
    echo $str, PHP_EOL;
}

Measured memory_bytes: 6620
#include <iostream>
#include <sstream>
#include <iomanip>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <vector>
#include <cmath>
#include <math.h>
#include <stdexcept>
#include <algorithm>
#include <set>
#include <map>
#include <stdlib.h>
#include <cctype>
using namespace std;
int main(){
    int N;
    cin >> N;
    cout << (1000 - (N % 1000)) % 1000 << endl;
}

Measured memory_bytes: 3592
#include <stdint.h>
#include <inttypes.h>
#include <stdio.h>

int64_t max(int64_t a, int64_t b)
{
  return a > b ? a : b;
}

int main(void)
{
  int n;
  scanf("%d", &n);
  int64_t a[n];
  for (int i = 0; i < n; i++) {
    scanf("%" SCNd64, &a[i]);
  }
  int64_t dp[n + 1][2];
  dp[0][0] = 0;
  dp[0][1] = -1000000000000000;
  for (int i = 0; i < n; i++) {
    dp[i + 1][0] = max(dp[i][0] + a[i], dp[i][1] - a[i]);
    dp[i + 1][1] = max(dp[i][0] - a[i], dp[i][1] + a[i]);
  }
  printf("%" PRId64 "\n", dp[n][0]);
}


Measured memory_bytes: 2560
from collections import deque
from functools import reduce
n = int(input())
al = [int(i) for i in input().split()]
ad = deque(al)

num = reduce(lambda x, y: x ^ y, al)

num = num ^ al[0]
print(num)
pre = al[0]
for i in al[1:]:
  num = num ^ pre
  num = num ^ i
  print(num)
  pre = i
  

Measured memory_bytes: 31596
#include <bits/stdc++.h>
int a[500000];
int main(){
int q,h,i,j,k,l,m,n,r;
l=250000;
r=250001;
k=0;
scanf("%d",&n);
for(i=0;i<n;i++){
 if(k==0){
 	scanf("%d",&a[r]);
 	r++;
 	k=1;
 }
 else{
 	scanf("%d",&a[l]);
 	l--;
 	k=0;
 }
 
}
if(k==0){
for(i=l+1;i<r;i++){
	printf("%d ",a[i]);
}
}
else{
	for(i=r-1;i>l;i--){
	printf("%d ",a[i]);
}
}
return 0;
} 

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


double L(vector<double> x, vector<double> y, vector<int> k){
  int n=k.size();
  double ret=0;
  for(int i=0;i<n-1;i++){
    double xx=x[k[i]]-x[k[i+1]];
    double yy=y[k[i]]-y[k[i+1]];
    ret+=sqrt(xx*xx+yy*yy);
  }
  return ret;
}
  

int main(){
  int N; cin >> N;
  vector<double> X(N);
  vector<double> Y(N);
  int Nkai=1;
  for(int i=0;i<N;i++){
    cin >> X[i] >> Y[i];
    Nkai*=i+1;
  }
  vector<int> K(N);
  for(int i=0;i<N;i++){
    K[i]=i;
  }
  double ans;
  do{
    ans+=L(X,Y,K);
  }while(next_permutation(K.begin(),K.end()));
  cout << fixed << setprecision(10);
  cout << ans/Nkai << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
struct pr{int y,x,cost;};

int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	int h,w; cin>>h>>w;
	vector<string>s(h); for(auto&i:s)cin>>i;
	vector<vector<int>>mp(h,vector<int>(w,1e9));
	vector<int>yw={0,-1,0,1},xw={1,0,-1,0};
	queue<pr>q; q.push({0,0,0});
	while(q.size()){
		pr rec=q.front(); q.pop();
		int y=rec.y,x=rec.x,cost=rec.cost;
		for(int i=0;i<4;++i){
			int yy=y+yw.at(i),xx=x+xw.at(i);
			if(yy>=0&&yy<h&&xx>=0&&xx<w){
				int&destcost=mp.at(yy).at(xx);
				char&destcolor=s.at(yy).at(xx);
				if(destcost>cost+1&&destcolor=='.'){
					destcost=cost+1;
					q.push({yy,xx,cost+1});
				}
			}
		}
	}
	int cnt=-1;
	for(auto&i:s)cnt+=count(i.begin(),i.end(),'.');
	int mn=mp.at(h-1).at(w-1);
	cout<<(mn!=1e9?cnt-mn:-1)<<"\n"s;
}

Measured memory_bytes: 256
package main

import (
  "fmt"
)

func min(A []int) (ret int) {
  ret = A[0]
  for _, a := range A {
    if a < ret {
      ret = a
    }
  }
  return
}

func main() {
  var L int
  fmt.Scan(&L)
  DP := make([][]int, L + 1)
  for i, _ := range DP {
    DP[i] = make([]int, 5)
  }
  var a int
  for i := 0; i < L; i++ {
    fmt.Scan(&a)
    DP[i + 1][0] = DP[i][0] + a
    DP[i + 1][1] = min([]int{min(DP[i][:2]), DP[i + 1][0]})
    if a > 0 {
      DP[i + 1][1] += a % 2
    } else {
      DP[i + 1][1] += 2
    }
    DP[i + 1][2] = min([]int{min(DP[i][:3]), DP[i + 1][1]})
    if a > 0 {
      DP[i + 1][2] += 1 - (a % 2)
    } else {
      DP[i + 1][2] += 1
    }
    DP[i + 1][3] = min([]int{min(DP[i][:4]), DP[i + 1][2]})
    if a > 0 {
      DP[i + 1][3] += a % 2
    } else {
      DP[i + 1][3] += 2
    }
    DP[i + 1][4] = min([]int{min(DP[i]), DP[i + 1][3]}) + a
  }
  fmt.Println(min(DP[L]))
}


Measured memory_bytes: 28288
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<set>
#define SF scanf
#define PF printf
#define MAXN 300010
#define INF 0x3FFFFFFF
using namespace std;
typedef long long ll;
int n,x,ans,suma,sumb;
set<int> a,b;
int main(){
	SF("%d",&n);
	for(int i=1;i<=n;i++){
		SF("%d",&x);
		if(i%2==1)
			a.insert(x);
		else
			b.insert(x);
	}
	a.insert(INF);
	b.insert(INF);
	for(int i=1;i<=n;i++){
		if(i%2==1){
			if(*a.begin()>*b.begin()){
				suma++;
				int x=*b.begin();
				b.erase(x);	
			}
			else{
				int x=*a.begin();
				a.erase(x);	
			}
		}
		else{
			if(*a.begin()<*b.begin()){
				sumb++;
				int x=*a.begin();
				a.erase(x);	
			}
			else{
				int x=*b.begin();
				b.erase(x);	
			}
		}
	}
	PF("%d",max(suma,sumb));
}

Measured memory_bytes: 4992
//is there any case of -1 or any special corner cases ?
#include<bits/stdc++.h>
using namespace std;
#define int long long int 
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define vi vector<int>
#define pi pair<int,int>
#define all(v) v.begin(),v.end()
#define zeros(arr) memset(arr,0,sizeof(arr));
#define precise(num)  cout<<fixed; cout << std::setprecision(num)
#define nl cout<<"\n";
#define test int t;cin>>t;while(t--) 
int32_t main(){
//    boost;
    string s;
    cin>>s;
    if(s=="ABC")cout<<"ARC";
    else cout<<"ABC";
}

Measured memory_bytes: 3604
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
#include <random>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
typedef vector<int> vi;
typedef long long ll;
typedef pair<int, int> pii;
typedef double db;
mt19937 mrand(random_device{}());
const ll mod = 1000000007;
int rnd(int x) { return mrand() % x; }
ll powmod(ll a, ll b) { ll res = 1; a %= mod; assert(b >= 0); for (; b; b >>= 1) { if (b & 1)res = res * a % mod; a = a * a % mod; }return res; }
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
// head

int t;

int main()
{
	ios::sync_with_stdio(false);
#ifdef RG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	int dir[2][2] = { {0,1},{1,0} };
	int h, w;
	cin >> h >> w;
	vector<vector<char>> grid(h, vector<char>(w));
	rep(i, 0, h) {
		rep(j, 0, w) cin >> grid[i][j];
	}

	vector<vector<int>> dp(h, vector<int>(w, INT_MAX));
	if (grid[0][0] == '.') dp[0][0] = 0;
	else dp[0][0] = 1;
	rep(i, 0, h) {
		rep(j, 0, w) {
			if (j == 0) {
				if (i == 0) continue;
				else {
					if (grid[i - 1][j] == '.' && grid[i][j] == '#') 
						dp[i][j] = min(dp[i][j], dp[i - 1][j] + 1);
					else 
						dp[i][j] = min(dp[i][j], dp[i - 1][j]);
				}
			}
			else {
				if (i == 0) {
					if (grid[i][j-1] == '.' && grid[i][j] == '#')
						dp[i][j] = min(dp[i][j], dp[i][j-1] + 1);
					else
						dp[i][j] = min(dp[i][j], dp[i][j-1]);
				}
				else {
					if (grid[i][j - 1] == '.' && grid[i][j] == '#')
						dp[i][j] = min(dp[i][j], dp[i][j - 1] + 1);
					else
						dp[i][j] = min(dp[i][j], dp[i][j - 1]);
					if (grid[i - 1][j] == '.' && grid[i][j] == '#')
						dp[i][j] = min(dp[i][j], dp[i - 1][j] + 1);
					else
						dp[i][j] = min(dp[i][j], dp[i - 1][j]);
				}
			}
		}
	}

	cout << dp[h - 1][w - 1] << endl;
	return 0;
}

Measured memory_bytes: 384
N, M = map(int, input().split()) 
a = list(map(int,input().split()))
a.sort(reverse=True)
frag=0
for i in (0,M-1):
    if(sum(a)/(4*M)>a[i]):
        print("No")
        frag=1
        break
if(frag==0):
    print("Yes")

Measured memory_bytes: 9196
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<math.h>

#define rep(i,a,b) for (int i = a;i < b;i++)

using namespace std;


int main() {
	string ans = "";
	int N;
	cin >> N;
	while(N != 0){
		if (N % 2 != 0) {
			ans = "1" + ans;
			N--;
			N = N / (-2);
		}
		else {
			ans = "0" + ans;
			N = N / (-2);
		}
		//cout << N << endl;
	}

	if (ans == "") ans = "0";

	cout << ans << endl;
	cin >> N;

	return 0;
}


Measured memory_bytes: 256
n = int(input())
a = list(map(int,input().split()))
d = {}
aa = [0,0]
for i in range(1,n):
	aa.append(aa[-1]+i)
for i in a:
	if i not in d:
		d[i] = 1
	else:
		d[i]+=1
s = 0
for i in d:
	s+=aa[d[i]]
dd = {}
for i in d:
	if i not in dd:
		dd[i] = (s-aa[d[i]]+aa[d[i]-1])
for i in a:
	print(dd[i])

Measured memory_bytes: 44064
N, W, D = map(int, input().split())
def calc(x0, y0, dx, dy):
    s = min(W - x0 if dx >= 0 else x0, D - y0 if dy >= 0 else y0)
    x = x0 + dx*s; y = y0 + dy*s
    assert x in [0, W] or y in [0, D], (x, y)
    if y == 0:
        return x
    if x == W:
        return W+y
    if y == D:
        return 2*W+D-x
    return 2*W+2*D-y

S = []
for i in range(N):
    x, y, f = input().split(); x = int(x); y = int(y)
    if f == 'N':
        t1 = calc(x, y, 1, 1)
        t2 = calc(x, y, -1, 1)
    elif f == 'E':
        t1 = calc(x, y, 1, -1)
        t2 = calc(x, y, 1, 1)
    elif f == 'S':
        t1 = calc(x, y, -1, -1)
        t2 = calc(x, y, 1, -1)
    else:
        t1 = calc(x, y, -1, 1)
        t2 = calc(x, y, -1, -1)
    if t1 >= t2:
        t1 -= 2*(W+D)
    S.append((t1, t2))
S.sort(key=lambda x: x[1])
ans = N
INF = 10**9
for i in range(N):
    r = 0
    cur = -INF
    base = 0
    for j in range(N):
        a, b = S[(i+j) % N]
        if (i+j) % N == 0:
            base += 2*(W+D)
        if a + base <= cur:
            continue
        cur = b + base
        r += 1
    ans = min(r, ans)
print(ans)


Measured memory_bytes: 5636
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
int main()
{
    string S;
    cin >> S;
    REP( i, (int)S.size() )
    {
        if( i % 2 == 0 )
        {
            cout << S[ i ];
        }
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 592
N=int(input())
AB = [tuple(map(int,input().split())) for i in range(N)]
AB.sort(key = lambda x:x[1])
curtime = 0
clear = True
for a,b in AB:
    curtime += a
    if curtime > b:
        clear = False
        break
if clear:print("Yes")
else:print("No")

Measured memory_bytes: 31828
#learnt about numpy from this code thank you nohtaray
#source: https://atcoder.jp/contests/abc129/submissions/5850116
import bisect
import os
from collections import Counter, deque
from fractions import gcd
from functools import lru_cache
from functools import reduce
import functools
import heapq
import itertools
import math
import numpy as np
import re
import sys

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")

H, W = list(map(int, sys.stdin.readline().split()))

S = np.array([list(sys.stdin.readline().rstrip()) for _ in range(H)]) == '.'
ups = np.zeros((H, W), dtype=int)
downs = np.zeros((H, W), dtype=int)
rights = np.zeros((H, W), dtype=int)
lefts = np.zeros((H, W), dtype=int)

for h in range(1, H):
    ups[h] = (ups[h - 1] + 1) * S[h - 1]
for h in reversed(range(H - 1)):
    downs[h] = (downs[h + 1] + 1) * S[h + 1]
for w in range(1, W):
    lefts[:, w] = (lefts[:, w - 1] + 1) * S[:, w - 1]
for w in reversed(range(W - 1)):
    rights[:, w] = (rights[:, w + 1] + 1) * S[:, w + 1]
print(((ups + downs + lefts + rights) * S).max() + 1)



Measured memory_bytes: 226288
from functools import partial
from itertools import islice, accumulate


def take(n, iterable):
    return list(islice(iterable, n))


def chunked(iterable, n):
    return iter(partial(take, n, iter(iterable)), [])


def solve(s):
    n, m, q, *lrpq = map(int, s.split())
    lr, pq = lrpq[:2 * m], lrpq[2 * m:]
    t = [[0] * (n + 1) for _ in range(n + 1)]
    for l, r in chunked(lr, 2):
        t[l][r] += 1
    t = [list(accumulate(_t)) for _t in zip(*(accumulate(_t) for _t in t))]
    return "\n".join(
        [str(t[q][q] - t[p - 1][q] - t[q][p - 1] + t[p - 1][p - 1]) for p, q in chunked(pq, 2)])


n, m, q = map(int, input().split())
print(solve('{} {} {}\n'.format(n, m, q) + '\n'.join([input() for _ in range(m + q)])))


Measured memory_bytes: 60736
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep1(i, n) for(int i = 1; i < n+1; i++)
#define sort(A) sort(A.begin(),A.end())
#define reverse(A) reverse(A.begin(),A.end());
#define vecmin(A) *min_element(A.begin(),A.end());
#define vecmax(A) *max_element(A.begin(),A.end());
typedef long long ll;

int main(){
  int n,m;
  cin >> n >> m;
  if(abs(n-m) > 1){
    cout << 0 << endl;
    return 0;
  }
  vector<ll> k(100001,0);
  k[0] = 1;
  for(ll i=1;i<=100000;i++) k[i] = (k[i-1]*i)%1000000007;
  if(n == m) cout << (k[n]*k[m]*2)%1000000007 << endl;
  else cout << (k[n]*k[m])%1000000007 << endl;
}

Measured memory_bytes: 1024
<>=~$";
if(abs($`-$')>1){
	print 0,$/
}else{
	$a=1;
	$a=$a*$_%(1e9+7)for 1..$`;
	$a=$a*$_%(1e9+7)for 1..$';
	$a<<=$`==$';
	print$a%=1e9+7,$/
}


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

int main(){
  int N;
  cin>>N;
  vector<int64_t> h(N);
  vector<int> x(N),y(N);
  for(int i=0;i<N;++i){
    cin>>x[i]>>y[i]>>h[i];
  }

  bool frag=false;

  for(int cx=0;cx<=100;++cx){
    for(int cy=0;cy<=100;++cy){
      for(int i=0;i<N;++i){
        int cnt=0;
        int64_t H=abs(x[i]-cx)+abs(y[i]-cy)+h[i];
        for(int j=0;j<N;++j){
          if(h[j]!=max(H-abs(x[j]-cx)-abs(y[j]-cy),(int64_t)0)) break;
          ++cnt;
          if(cnt==N){
            frag=true;
            break;
          }
        }
        if(frag){
          cout<<cx<<" "<<cy<<" "<<H<<endl;
          break;
        }
      }
      if(frag) break;
    }
    if(frag) break;
  }

}

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

/* short names and const
using ll = long long;
using vll = vector<long long>;
using df = vector<vll>;
df data(n, vll(m));
const ll MOD = 1e9 + 7;
const ll INF = 1e18;
*/

/* Boost!
#include <boost/algorithm/string/classification.hpp> // is_any_of
#include <boost/algorithm/string/split.hpp>
#include <boost/algorithm/string/join.hpp>
#include <boost/algorithm/string/replace.hpp>
#include <boost/range/algorithm.hpp> // boost::sort(arr)
using boost::algorithm::split; // split(result, s, boost::is_any_of(","));
using boost::algorithm::join; // string s = join(arr, "");
using boost::algorithm::replace_all; // replace_all(s, "AtCoder", "A");
*/

/* print(arr)
template <class T>
void print(vector<T> &vec) {
  for (auto& a : vec) {
    cout << a;
    if (&a != &vec.back()) cout << " ";
  }
  cout << endl;
}
*/

/* fast cin and precise cout
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  getline(cin, s);
  cout << fixed << setprecision(15);
*/

template <class T>
void print(vector<T> &vec) {
  for (auto& a : vec) {
    cout << a;
    if (&a != &vec.back()) cout << " ";
  }
  cout << endl;
}

int main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  cout << max(a * b, c * d) << endl;
}


Measured memory_bytes: 256
x, k, d = map(int, input().split())

if abs(x) > k * d:
    print(abs(x) - k * d)
else:
    cnt = k - (abs(x) // d)
    if cnt % 2 == 0:
        print(abs(x) % d)
    else:
        print(abs((abs(x) % d) - d))


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

using namespace std;

const int N = 3007;
const int MOD = 1e9 + 7;

inline int add(int &a, int &b) {
	int ret = a + b;
	if(ret >= MOD) ret -= MOD;
	return ret;
}

int dp[N][N][2];

int main() {
	int n, m;
	cin >> n >> m;

	for(int i=0; i<=n; ++i) dp[m][i][1] = 1;
	for(int i=m-1; i>=0; --i) {
		for(int j=0; j<=n; ++j) {
			for(int k=0; k<2; ++k) {
				if(j > 0) {
					// RR
					dp[i][j][k] = add(dp[i][j][k], dp[i+1][j-1][k|(j==1)]);
					// RB
					dp[i][j][k] = add(dp[i][j][k], dp[i+1][j][k|(j==1)]);
				}
				if(j < n) {
					// BB
					dp[i][j][k] = add(dp[i][j][k], dp[i+1][j+1][k|(j==0)]);
					// BR
					dp[i][j][k] = add(dp[i][j][k], dp[i+1][j][k|(j==0)]);
				}
			}
		}
	}

	int res = 0;
	for(int i=0; i<=n; ++i) res = add(res, dp[0][i][0]);
	cout << res << "\n";

	return 0;
}

Measured memory_bytes: 70784
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String {
            bytes
                .by_ref()
                .map(|r| r.unwrap() as char)
                .skip_while(|c| c.is_whitespace())
                .take_while(|c| !c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!{
        r: usize,
        d: usize,
        mut x: usize
    }
    for i in 0..10 {
        x = x * r - d;
        println!("{}", x);
    }
}


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

int main() {
    int h, r;
    cin >> h >> r;
    if(h+r>0) cout << 1 << endl;
    else if(h+r<0) cout << -1 << endl;
    else cout << 0 << endl;
    return 0;
}



Measured memory_bytes: 3108
#include <stdio.h>
long long p = 998244353;
long long n, y, ans;
char x[200001];
char z[200001];
long long o[100000];
long long de[100000];
int d;
int che(void) {
	for (int i = 0; i < n; i++) {
		if (x[i] > z[i])return 1;
		if (x[i] < z[i])return 0;
	}
	return 1;
}
int main() {
	scanf("%lld", &n);
	scanf(" %s", x);
	for (int i = 3; i <= n; i++) {
		if (i % 2 && n % i == 0) {
			o[d] = i;
			d++;
		}
	}
	for (int i = d - 1; i >= 0; i--) {
		y = 0;
		for (int j = 0; j < n / o[i]; j++) {
			y *= 2;
			y += (x[j] - '0');
			y %= p;
			for (int k = 0; k < o[i]; k++) {
				if (k % 2 == 0)z[j + k * n / o[i]] = x[j];
				else z[j + k * n / o[i]] = '0' + ('1' - x[j]);
			}
		}
		y += che();
		y %= p;
		for (int j = d - 1; j > i; j--) {
			if (o[j] % o[i] == 0) {
				y -= de[j];
				y += p;
				y %= p;
			}
		}
		de[i] = y;
		ans += y * 2 * n / o[i];
		ans %= p;
	}
	y = 0;
	for (int i = 0; i < n; i++) {
		y *= 2;
		y += (x[i] - '0');
		y %= p;
	}
	for (int i = 0; i < d; i++) {
		y -= de[i];
		y += p;
		y %= p;
	}
	y++;
	ans += y * 2 * n;
	ans %= p;
	printf("%lld\n", ans);
}

Measured memory_bytes: 512
#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>	
#include <cmath>
#include <string>
#include<math.h>
#include<sstream>//���炵���̂Œ���
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define Cout(s) cout<<s<<endl
using namespace std;
using Graph = vector<vector<int>>;
typedef long long ll;
string Yes(bool b) { if (b) { return "Yes"; } else { return "No"; } }
string YES(bool b) { if (b) { return "YES"; } else { return "NO"; } }
//================================================
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }

int a = 1, b = 0, c, d, n, k = 0, ans = 0;
string s, t;
int mod = 1000000007;


int main()
{
	int n; cin >> n;
	vector<double> a(n); rep(i, n)cin >> a[i];
	int LCM=1;
	rep(i, n) { LCM = lcm(LCM, a[i]); }
	double sum = 0; rep(i, n) { sum += LCM / a[i]; }
	printf("%.8f\n", LCM/sum);

	return 0;
}


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

string s;

int main() {
    cin >> s;

    s[5] = ' ';
    s[13] = ' ';

    cout << s << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fastio() ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define int long long
#define endl "\n"
#define pb push_back
const int mxN = 1e6 + 500;
const int mod = 1e9 + 7;
int ar[mxN];


int32_t main() {

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

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

		int n, k, l = 0, c = 0, ans = 0;
		cin >> n;

		if (n == 0) {
			cout << "1";
		}
		else
			cout << "0";




		cout << endl;
	}

	return 0;
}



Measured memory_bytes: 3648
#include<bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define C 0.5772156649
#define pi acos(-1.0)
#define ll long long
#define mod 1000000007
#define ls l,m,rt<<1
#define rs m+1,r,rt<<1|1

using namespace std;

const double g=10.0,eps=1e-7;
const int N=1000+10,maxn=60000+10,inf=0x3f3f3f;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s;
    cin>>s;
    if(s.substr(0,4)=="YAKI")cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}
/********************

********************/


Measured memory_bytes: 256
/*
これを入れて実行
g++ code.cpp
./a.out
 */

#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <cmath>
#include <tuple>
#include <iomanip>

using namespace std;
typedef long long ll;
typedef long double ld;

int dy4[4] = {-1, 0, +1, 0};
int dx4[4] = {0, +1, 0, -1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};

const long long INF = 1LL << 60;
const ll MOD = 1e9 + 7;

bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}

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

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

ll nCr(ll n, ll r){
    if(r == 0 || r == n){
        return 1;
    } else if(r == 1){
        return n;
    }
    return (nCr(n - 1, r) + nCr(n - 1, r - 1));
}

ll nPr(ll n, ll r){
    r = n - r;
    ll ret = 1;
    for (ll i = n; i >= r + 1; i--) ret *= i;
    return ret;
}

//-----------------------ここから-----------

int main(void){
    string a, b, c;
    cin >> a >> b >> c;
    if(a[a.size() - 1] == b[0] && b[b.size() - 1] == c[0]){
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define F first
#define S second
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define Blue ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define rep(i,a,n) for(int i=a;i<n;++i)
typedef vector<int> vi;
typedef long long ll;
const int mod=1e9+7;

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


void solve(){
	int n,k;
	cin>>n>>k;
	int cnt=0;
	while(n)cnt++,n/=k;
	cout<<cnt;

}


int main(){
	Blue;
	int test=1;
	//cin>>test;
	while(test--)
		solve();
	return 0;
}

Measured memory_bytes: 3644
import java.util.Scanner;

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

        System.out.println(c + " " + a + " " + b);
    }
}


Measured memory_bytes: 21076
#include<stdio.h> 
#include<algorithm> 
using namespace std; 
int main()  { 
  char s[10]; 
  scanf("%s", s); 
  if(s[0] == s[1] && s[1] != s[2] && s[2] == s[3])printf("Yes\n"); 
  else if(s[0] == s[2] && s[2] != s[1] && s[1] == s[3])printf("Yes\n"); 
    else if(s[0] == s[3] && s[3] != s[1] && s[1] == s[2])printf("Yes\n"); 
  else printf("No\n");
}


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

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

  if(X == 1){
    cout << 1 << endl;
    return 0;
  }

  int ans = 0;
  for(int b = 2; b * b <= X; b++){
    for(int bp = b * b; bp <= X; bp *= b){
      ans = max(ans, bp);
    }
  }
  cout << ans << endl;
}



Measured memory_bytes: 256
// Problem Link: 
// Tutorial Link: 

#include<bits/stdc++.h>
 
using namespace std;
 
#define LL long long
#define pb push_back
#define pLL pair<LL,LL>
#define ff first
#define ss second
#define rep(i,a,b) for(LL i=a;i<=b;++i)
#define repb(i,a,b) for(LL i=a;i>=b;--i)
#define ld double
#define mp make_pair
#define vLL vector<LL>
#define vpLL vector<pLL>
#define vld vector<ld>
#define pld pair<ld,ld>
#define vpld vector<pld>
#define SLL set<LL>
#define SpLL set<pLL>
#define FIO ios::sync_with_stdio(false)
#define mod 1000000007

LL l, r, d;

int main()
{
	FIO;
	cin >> l >> r >> d;
	cout << r/d - l/d + ((l%d == 0) ? 1 : 0) << "\n";
}

Measured memory_bytes: 3632
#include <iostream>
using namespace std;
int main(void)
{
	int n;
	cin >> n;
	
	int b,f,r,v;
	int a[4][3][10] = {};
	int i;
	
	for( i = 0; i < n; i++){
		cin >> b >> f >> r >> v;
		a[b-1][f-1][r-1] += v;
	}
	
	int j,k;
	for( i = 0; i < 4; i++){
		for( j = 0; j < 3; j++){
			for( k = 0; k < 10; k++){
				cout << " " << a[i][j][k];
			}
			cout << endl;
		}
		if(i != 3){
			cout << "####################" << endl;
		}
	}
	return 0;
}

		

Measured memory_bytes: 1160
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using namespace std;
typedef long long ll ;
string s;
int n;
ll  res=0;
void dfs(int len,ll sum,ll tmp)
{

  if(len==n+1){res+=sum;return;}
  int sl;
  sl=s[len]-'0';
  dfs(len+1,sum+tmp*9+sl,tmp*10+sl);
  dfs(len+1,sum+sl,sl);

}
int main()
{
  //cout<<setprecision(10);
  cin>>s;
  n=s.length()-1;
  dfs(1,s[0]-'0',s[0]-'0');
  cout<<res;
  return 0;

}


Measured memory_bytes: 256
import sys
 
stdin = sys.stdin
 
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces
 
n, a, b = na()
mod = 1000000007
 
def comb(n, r, mod):
    if n < 0 or r < 0 or r > n: return 0
    nu = 1
    de = 1
    for i in range(r):
        nu = nu * (n-i) % mod
        de = de * (i+1) % mod
    return nu * inv(de, mod) % mod
 
def inv(a, mod):
    b = mod
    p, q = 1, 0
    while b > 0:
        c = a//b
        d = a; a = b; b = d % b
        d = p; p = q; q = d-c*q
    return p+mod if p < 0 else p
 
print((pow(2, n, mod) - comb(n, a, mod) - comb(n, b, mod) - 1)%mod)

Measured memory_bytes: 63208
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <climits>
#include <cstring>
#include <string>
#include <set>
#include <bitset>
#include <map>
#include <queue>
#include <stack>
#include <vector>
#include <cassert>
#include <ctime>
#define rep(i,m,n) for(i=m;i<=n;i++)
#define mod 1000000009
//#define inf 0x3f3f3f3f
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define ll long long
#define pi acos(-1.0)
#define pii pair<int,int>
#define sys system("pause")
const int maxn=2e5+10;
const int N=2e5+10;
using namespace std;
typedef vector<int> vi;
ll gcd(ll p,ll q){return q==0?p:gcd(q,p%q);}
ll qpow(ll p,ll q){ll f=1;while(q){if(q&1)f=f*p%mod;p=p*p%mod;q>>=1;}return f;}
//int n,m,k,t,a[maxn],b[maxn],id[maxn],ama,bma,ami=1e9,bmi=1e9,dma,dmi=1e9;
//bool cmp(int x,int y){return a[x]<a[y];}
int main()
{
    int n;
    scanf("%d",&n);
    vector<ll> a(n), b(n), di(n);
    ll maxa = 0, maxb = 0, mina = INT_MAX, minb = INT_MAX;
    for(int i = 0; i < n; i++) {
        scanf("%lld %lld", &a[i], &b[i]);
        if(a[i] > b[i]) swap(a[i], b[i]);
        di[i] = i;
        maxa = max(maxa, a[i]);
        maxb = max(maxb, b[i]);
        mina = min(mina, a[i]);
        minb = min(minb, b[i]);
    }
    ll res = (maxa - mina) * (maxb - minb);
    sort(di.begin(), di.end(), [&](ll n1, ll n2) {
        return a[n1] < a[n2];
    });
    ll dmin = INT_MAX, dmax = 0;
    for(int i = 0; i < n - 1; i++ ) {
        dmin = min(dmin, b[di[i]]);
        dmax = max(dmax, b[di[i]]);
        res = min(res, (max(dmax, a[di[n - 1]]) - min(dmin, a[di[i+1]]))* (maxb - mina));
    }
    printf("%lld\n", res);
    return 0;
}

Measured memory_bytes: 4992
#include <bits/stdc++.h>
// X - Tower

#define fi first
#define se second

using namespace std;

pair<int,pair<int,int>> arr[1005];
long long dp[1005][20005];

bool cmp(pair<int,pair<int,int>> p1,pair<int,pair<int,int>> p2) {
    return p1.fi + p1.se.fi < p2.fi + p2.se.fi;
}

int main() {
    int N,i,j;
    long long ans;

    scanf("%d",&N);

    for (i = 1;i <= N;i++)
        scanf("%d%d%d",&arr[i].se.fi,&arr[i].fi,&arr[i].se.se);

    sort(arr + 1,arr + N + 1,cmp);

    for (i = 1;i <= N;i++) {
        for (j = 0;j < arr[i].se.fi;j++)
            dp[i][j] = dp[i - 1][j];

        for (j = arr[i].se.fi;j <= arr[i].se.fi + arr[i].fi;j++)
            dp[i][j] = max(dp[i - 1][j],dp[i - 1][j - arr[i].se.fi] + arr[i].se.se);
    }

    ans = 0;
    for (i = 0;i <= 20000;i++)
        ans = max(ans,dp[N][i]);

    printf("%lld\n",ans);

    return 0;
}


Measured memory_bytes: 156544
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define rep2(i, s, n) for (ll i = s; i < (ll)(n); i++)
#define repr(i, n) for (ll i = n; i >= 0; i--)
#define pb push_back
#define COUT(x) cout << (x) << endl
#define COUTF(x) cout << setprecision(15) << (x) << endl
#define ENDL cout << endl
#define DF(x) x.erase(x.begin())  // 先頭文字削除
#define ALL(x) x.begin(), x.end()
#define SORT(x) sort(ALL(x))
#define REVERSE(x) reverse(ALL(x))
#define init() \
  cin.tie(0);  \
  ios::sync_with_stdio(false)
#define debug(x) cerr << "[debug] " << #x << ": " << x << endl;
#define debugV(v)                       \
  cerr << "[debugV] " << #v << ":";     \
  rep(i, v.size()) cerr << " " << v[i]; \
  cerr << endl;
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using P = pair<ll, ll>;
constexpr ll INF = 0x3f3f3f3f3f3f3f3f;
constexpr ld PI = 3.141592653589793238462643383279;
ll get_digit(ll x) {
  return to_string(x).size();
}

ll gcd(ll x, ll y) {
  return y ? gcd(y, x % y) : x;
}

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

vector<P> factorize(ll n) {
  vector<P> result;
  for (ll i = 2; i * i <= n; ++i) {
    if (n % i == 0) {
      result.pb({i, 0});
      while (n % i == 0) {
        n /= i;
        result.back().second++;
      }
    }
  }
  if (n != 1) {
    result.pb({n, 1});
  }
  return result;
}

vll divisor(ll n) {
  vll ret;
  for (ll i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      ret.push_back(i);
      if (i * i != n) ret.push_back(n / i);
    }
  }
  SORT(ret);
  return (ret);
}

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;
}

signed main() {
  init();
  string S;
  cin >> S;
  ll ans = 700;
  rep(i, S.size()) {
    if (S[i] == 'o') {
      ans += 100;
    }
  }
  COUT(ans);
  return 0;
}

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

const int INF = 1 << 29;
const long long int Mod = 1000000007;
using ll = long long int;
#define all(x) (x).begin(),(x).end()
#define rep(i,N) for(ll i = 0; i < (ll)N; ++i)
#define repi(i,a,b) for(ll i = ll(a); i < ll(b); ++i)



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

	rep(i, n) cout << "ACL";

	cout << endl;
	return 0;
}

Measured memory_bytes: 3040
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i ,n) for(int i = 0 ; i < (n) ; i ++ )
#define all(x) (x).begin(),(x).end()
using namespace std;
using ll = long long;
using vin=vector<int>;
const int inf=1e9+7;
const ll INF=1e18;


int main() {
  int n;
  cin>>n;
  vin a(n);
  rep(i,n) cin>>a[i];
  ///
  bool ok=false;
  int ans=0;
  int j=1;
  rep(i,n){
    if(a[i]==j){
      ok=true;
     j++;
      ans++;
    }
  }
  
  
  if(ok) cout<<n-ans<<endl;
  else cout<<-1<<endl;
}




Measured memory_bytes: 1024
#include <stdio.h>
#include <string>
#include <iostream>

using namespace std;
int main()
{
	string T;
	string S;
	cin >> T;
	cin >> S;
	int cnt = 0;
	for (int i = 0; i < 3; i++)
	{
		if (T.at(i)==S.at(i) )
		{
			cnt++;
		}
	}

	cout << cnt << endl;

	
	return 0;
}

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


int main() {
	int n, k;
  	std::cin >> n >> k;
  	std::vector<int> arr(n + 1), dp;
  	
  	for(int i = 1; i <= n; i++)
      	std::cin >> arr[i];
  
  	dp.assign(n + 1, INT32_MAX);
  	dp[1] = 0;
  
  	for(int i = 2; i <= n; i++) 
    	for(int j = k; j >= 1; j--) 
        	if(i > j)
            	dp[i] = std::min(dp[i], std::abs(arr[i - j] - arr[i]) + dp[i - j]);

  	std::cout << dp[n];
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define rep0(i,n) for(i=0;i<n;i++)
#define rep(i,n) for(i=1;i<=n;i++)
#define reps(i,a,n) for(i=a;i<=n;i++)
#define mem(ara,n) memset(ara,n,sizeof(ara))
#define memb(ara) memset(ara,false,sizeof(ara))
#define all(x) (x).begin(),(x).end()
#define fast ios_base:: sync_with_stdio( false ); cin.tie(0); cout.tie(0);
#define eb              emplace_back
#define em              emplace
#define pb              push_back
#define Mp              make_pair
#define ff              first
#define ss              second
#define mod 1000000007
typedef long long ll;
using namespace std;

const int M = (int)(2e6 + 239);

ll nCr(int n, int r)
{

    ll p=1,k=1;
    if (n-r<r)
    {
        r=n-r;
    }
    if(r!=0)
    {
        while(r)
        {
            p*=n;
            k*=r;
            ll m=__gcd(p, k);
            p /= m;
            k /= m;
            n--;
            r--;
        }
    }
    else
    {
        p=1;
    }
    return p;
}

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

    string s;
    cin>>s;
    int flag=0;
    string s1=s;
    reverse(all(s1));
    if(s1!=s)
    {
        flag=1;
    }
    if(flag==0)
    {
        string x1,x2,x3,x4;
        x1=s.substr(0,(s.size()-1)/2);
        x2=s.substr((s.size()+3)/2, s.size());
        x2=x1;
        x4=x3;
        reverse(all(x2));
        reverse(all(x4));
        if(x1!=x2 || x3!=x4)
        {
            flag=1;
        }
    }
    if(flag)
    {
        cout<<"No"<<endl;
    }
    else
    {
        cout<<"Yes"<<endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
int main() {
    ll N, M;
    cin >> N >> M;
    vector<ll> A(N);
    for (int i = 0; i < N; i++) {
        cin >> A[i];
    }
    sort(A.begin(), A.end(), greater<ll>());
    priority_queue<P> que;
    for (int i = 0; i < M; i++) {
        ll b, c;
        cin >> b >> c;
        que.push(P(c, b));
    }
    ll sum = 0;
    int i = 0;
    while (N > 0 && !que.empty()) {
        P p = que.top();
        if (p.first < A[i]) {
            sum += A[i++];
            N--;
        } else {
            if (N - p.second >= 0) {
                sum += p.second * p.first;
                N -= p.second;
            } else {
                sum += p.first * N;
                N = 0;
            }
            que.pop();
        }
    }
    while (N > 0) {
        sum += A[i++];
        N--;
    }

    cout << sum << endl;
}

Measured memory_bytes: 3188
import sys
import math
def I():return int(sys.stdin.readline().replace("\n",""))
def I2():return map(int,sys.stdin.readline().replace("\n","").split())
def S():return str(sys.stdin.readline().replace("\n",""))
def L():return list(sys.stdin.readline().replace("\n",""))
def Intl():return [int(k) for k in sys.stdin.readline().replace("\n","").split()]
def Lx(k):return list(map(lambda x:int(x)*-k,sys.stdin.readline().replace("\n","").split()))

s = S()
t = S()
for i in range(len(s)):
    s = s[-1]+s[:-1]
    if s == t:
        print("Yes")
        exit()
print("No")

Measured memory_bytes: 3064
#include<iostream>
#include<math.h>
#include<iomanip>
#include<vector>
#include<algorithm>
#include<queue>
#include<string>
#include<stdlib.h>
using namespace std;
#define PI 3.14159265358979
#define rep(i,n) for(int i=0;i<n;i++)
 

 int main(void)
 {

int ans1,ans2;
cin>>ans1>>ans2;

bool b[3] = {false,false,false};

b[ans1-1] = true;
b[ans2-1] = true;

rep(i,3){

    if(!b[i]) cout<<i+1<<endl;
}



 }

Measured memory_bytes: 256
#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 main() {
  int x, a;
  cin >> x >> a;
  cout << (x < a ? 0 : 10) << endl;
  return 0;
}

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

int main()
{
    int N, K;
    cin >> N >> K;
    vector<long long> points(N);
    for (int i=0; i<N; i++) cin >> points[i];
    for (int i=K; i<N; i++)
    {
        string ans;
        if (points[i] > points[i-K]) ans = "Yes";
        else ans = "No";
        cout << ans << endl;
    }
}

Measured memory_bytes: 4836
#include <bits/stdc++.h>
using namespace std;
int main() {
  int a;
  cin>>a;
  vector<int> vec(82);
  for(int i=0;i<9;i++){
    for(int j=0;j<9;j++){
      vec.at(9*i+j+1)+=(i+1)*(j+1);
    }
  }
  for(int i=0;i<81;i++){
    if(vec.at(i)==a||a==81){
      cout<<"Yes"<<endl;
      break;
    }
    else if(i==80)
      cout<<"No"<<endl;
  }
}

Measured memory_bytes: 256
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <queue>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
#include <stdio.h>
#include <complex>
#include <cstdint>
#include <tuple>
#include <regex>

#define M_PI       3.14159265358979323846

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<int, PII> TIII;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;

//container util

//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define MOD 1000000007

int main() {
	LL a, b, c, k;
	scanf("%lld%lld%lld%lld", &a, &b, &c, &k);
	if (k % 2)cout << b - a << endl;
	else cout << a - b << endl;
	
	return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-

A,B = [int(i) for i in input().rstrip().split()]

if (A%3) == 0:
  print("Possible")
elif  (B%3) == 0:
  print("Possible")
elif  ((A+B)%3) == 0:
  print("Possible")
else:
  print("Impossible")

Measured memory_bytes: 3060
'''
1つの始点から全頂点への最短距離を求めるアルゴリズム
辺の数E,頂点の数Vに対し、O((E+V)log(V))
edge[u]=[(d1, v1), (d2, v2), ...]が頂点uと頂点viに距離diの辺があることを表す隣接リストが入力
無向グラフにて検証済み。有効グラフのたぶんいけるので確認したらここを書き換えて欲しい。
'''

from heapq import heappush, heappop

INF = 10**15
 
def dijkstra(s, edges):
    que = []
    d = [INF] * n
    d[s] = 0
    heappush(que, (0, s))

    while len(que) > 0:
        (c, v) = heappop(que)
        if d[v] < c:
            continue
        for (cc, w) in edges[v]:
            if d[w] > d[v] + cc:
                d[w] = d[v] + cc
                heappush(que, (d[w], w))

    return d

n, m, s, t = map(int, input().split())
s, t = s-1, t-1
yen_edge = [[] for i in range(n)]
snook_edge = [[] for i in range(n)]
for i in range(m):
    ui, vi, ai, bi = map(int, input().split())
    ui, vi = vi-1, ui-1
    yen_edge[ui].append((ai, vi))
    yen_edge[vi].append((ai, ui))
    snook_edge[ui].append((bi, vi))
    snook_edge[vi].append((bi, ui))

distance_yen = dijkstra(s, yen_edge)
distance_snook = dijkstra(t, snook_edge)

ans_lst = [0 for i in range(n)]
temp_min = 10**15
for i in range(n)[::-1]:
    now = distance_yen[i] + distance_snook[i]
    temp_min = min(temp_min, now)
    ans_lst[i] = 10**15 - temp_min

for i in range(n):
    print(ans_lst[i])

Measured memory_bytes: 115052