akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main(){
    int x,a,b;
    scanf("%d %d %d",&x,&a,&b);
    if(abs(x-a)<abs(x-b)){
        printf("A");
    }
    else{
        printf("B");
    }
    return 0;
}


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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define POW(n) ((n)*(n))
#define ALL(a) (a).begin(),(a).end()
#define cerr if(false) cerr
 
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
 
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<unsigned long long> vull;

void solve(long long a, long long b, long long c){
	map<int,int> Map;
  Map[a] = 1;
  Map[b] = 1;
  Map[c] = 1;
  
  cout << Map.size() << endl;
}


int main(){	
	ios::sync_with_stdio(false);
	long long b;
	long long a;
	long long c;
	cin >> a;
	cin >> b;
	cin >> c;
	solve(a, b, c);
	return 0;
}


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

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(),v.end()
#define _GLIBCXX_DEBUG
#define fi first
#define se second

using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using vd = vector<double>;
using vvi = vector<vi>;
using vvll = vector<vll>;
using vvd = vector<vd>;
using vvvi = vector<vvi>;
using vvvll = vector<vvll>;
using vvvd = vector<vvd>;

const double pi=acos(-1);
const ll MOD=1e9+7;
const ll INF=(1LL<<60);

int main() {
    int n;
    cin>>n;
    ll t[n],a[n];
    rep(i,n)cin>>t[i];
    rep(i,n)cin>>a[i];
    vll h(n,-1);
    h[0]=t[0];
    rep(i,n-1){
        if (t[i+1]!=t[i]){
            h[i+1]=t[i+1];
        }
    }
    ll now=a[n-1];

    if (h[n-1]!=-1){
        if (h[n-1]!=a[n-1]){
            cout<<0<<endl;
            return 0;
        }
    }
    else {
        h[n-1]=a[n-1];
        if (a[n-1]>t[n-1]){
            cout<<0<<endl;
            return 0;
        }
    }

    for (int i=n-2;i>=0;i--){
        if (h[i]!=-1){//高さが確定している
            if (h[i]>a[i]){
                cout<<0<<endl;
                return 0;
            }
        }
        else{
            if (a[i+1]!=a[i]){
                h[i]=a[i];
                if (h[i]>t[i]){
                    cout<<0<<endl;
                    return 0;
                }
            }
        }
    }
    ll ans=1;
    vll anslist;
    rep(i,n){
        if (h[i]==-1){
            ans*=min(a[i],t[i]);
            ans%=MOD;
        }
    }
    cout<<ans<<endl;



    return 0;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define zero_pad(num) setfill('0') << std::right << setw(num)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;

int main() {
    int a, b;
    cin >> a >> b;
    if(a <= b) cout << a << endl;
    else cout << a - 1 << endl; 
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <queue>
#include <vector>
#include <utility>
#define maxn 5005
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const ll infll = 0x3f3f3f3f3f3f3f3fll;
int n,siz[maxn];
ll a[maxn],f[2][maxn][maxn],tmp[maxn];
vector <int> adj[maxn];
void work_size(int u,int f){
	for(int i = 0;i < (int)adj[u].size();i++){
		int v = adj[u][i];
		if(v == f) continue;
		work_size(v,u);
		siz[u] += siz[v] + 1;
	}
}
inline bool able(int u,int i){
	return f[0][u][i] < 0 || f[1][u][i] < infll;
}
void dfs(int u,int fa){
	if((int)adj[u].size() == (fa != -1)){
		f[0][u][0] = a[u];
		if(a[u] > 0) f[1][u][0] = a[u];
		return;
	}
	int v;
	for(int i = 0;i < (int)adj[u].size();i++){
		v = adj[u][i];
		if(v != fa) dfs(v,u);
	}
	int fir = 0;
	if(adj[u][fir] == fa) fir++;
	v = adj[u][fir];
	for(int i = 0;i <= siz[v];i++){
		f[0][u][i] = min(f[0][u][i],f[0][v][i] + a[u]);
		if(able(v,i)) f[0][u][i + 1] = min(f[0][u][i + 1],a[u]);
	}
	int totsiz = siz[v] + 1;
	for(int i = fir + 1;i < (int)adj[u].size();i++){
		v = adj[u][i];
		if(v == fa) continue;
		for(int j = 0;j <= totsiz + siz[v] + 1;j++) tmp[j] = infll;
		for(int j1 = totsiz;j1 >= 0;j1--){
			for(int j2 = siz[v];j2 >= 0;j2--){
				tmp[j1 + j2] = min(tmp[j1 + j2],f[0][u][j1] + f[0][v][j2]);
				if(able(v,j2)) tmp[j1 + j2 + 1] = min(tmp[j1 + j2 + 1],f[0][u][j1]);
			}
		}
		for(int j = 0;j <= totsiz + siz[v] + 1;j++) f[0][u][j] = tmp[j];
		totsiz += siz[v] + 1;
	}
	if(a[u] < 0) return;
	v = adj[u][fir];
	for(int i = 0;i <= siz[v];i++){
		f[1][u][i] = min(f[1][u][i],f[1][v][i] + a[u]);
		if(able(v,i)) f[1][u][i + 1] = min(f[1][u][i + 1],a[u]);
	}
	totsiz = siz[v] + 1;
	for(int i = fir + 1;i < (int)adj[u].size();i++){
		v = adj[u][i];
		if(v == fa) continue;
		for(int j = 0;j <= totsiz + siz[v] + 1;j++) tmp[j] = infll;
		for(int j1 = totsiz;j1 >= 0;j1--){
			for(int j2 = siz[v];j2 >= 0;j2--){
				tmp[j1 + j2] = min(tmp[j1 + j2],f[1][u][j1] + f[1][v][j2]);
				if(able(v,j2)) tmp[j1 + j2 + 1] = min(tmp[j1 + j2 + 1],f[1][u][j1]);
			}
		}
		for(int j = 0;j <= totsiz + siz[v] + 1;j++) f[1][u][j] = tmp[j];
		totsiz += siz[v] + 1;
	}
}
int main(){
	scanf("%d",&n);
	for(int i = 1;i <= n;i++) scanf("%lld",&a[i]);
	for(int i = 1;i < n;i++){
		int u,v;
		scanf("%d%d",&u,&v);
		adj[u].push_back(v);
		adj[v].push_back(u);
	}
	work_size(1,-1);
	memset(f,0x3f,sizeof(f));
	dfs(1,-1);
	for(int i = 0;i <= n - 1;i++){
		if(able(1,i)){
			printf("%d\n",i);
			return 0;
		}
	}
	return 0;
}


Measured memory_bytes: 392704
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, a, b) for (int i = (a); i < (b); i++)
//#include "library/debug.cpp"

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

    int h, w;
    cin >> h >> w;
    vector<string> c(h);
    rep(i, 0, h) cin >> c[i];
    rep(i, 0, h) {
        rep(k, 0, 2) {
            rep(j, 0, w) cout << c[i][j];
            cout << endl;
        }
    }

    return 0;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(500*500)
def modpow(a,n,p):
    if n==0:
        return 1
    x=modpow(a,n//2,p)
    x=(x*x)%p
    if (n%2)==1:
        x=(x*a)%p
    return x%p
def modinv(a,p):
    return modpow(a,p-2,p)

r1,c1,r2,c2=map(int,input().split())
n1=r2+c2+2
n2=r2+c1+1
n3=r1+c2+1
n4=r1+c1
l=[r2+1,r2+1,r1,r1]
p=10**9+7
buf=1
cnt=0
l=[0]*(10**7+10)
inv=[0]*(10**7+10)
l[1]=1
for i in range(2,n1+3,1):#n1+1
    l[i]=(l[i-1]*i)%p
print((((l[n1]*modinv(l[r2+1],p)*modinv(l[n1-r2-1],p))%p)-(l[n2]*modinv(l[r2+1],p)*modinv(l[n2-r2-1],p))-(l[n3]*modinv(l[r1],p)*modinv(l[n3-r1],p))+(l[n4]*modinv(l[r1],p)*modinv(l[n4-r1],p)))%p)

Measured memory_bytes: 190616
MOD = 10**9 + 7
H, W = map(int, input().split())
G = [input() for _ in range(H)]

dp = [[0] * W for _ in range(H)]
for i in range(H):
    if G[i][0] == '#':
        break
    dp[i][0] = 1
for i in range(W):
    if G[0][i] == '#':
        break
    dp[0][i] = 1


for i in range(1, H):
    for j in range(1, W):
        if G[i][j] == '#':
            dp[i][j] = 0
        else:
            dp[i][j] = (dp[i - 1][j] + dp[i][j - 1]) % MOD

print(dp[H - 1][W - 1])

Measured memory_bytes: 71988
#include <bits/stdc++.h>
using namespace std;
 
int main() {
int n,a;
  cin >> n >> a;
  
  if (a >= 499) { 
  cout << "Yes" << endl;
  }
  else if (a < 499 && n%500 <= a ) {
  cout << "Yes" << endl;
    }
else {
  cout << "No" << endl;
 }
}

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

int main() {
    int n,ans=0,M=-1;
    cin >> n;
    vector<int> H(n);
    rep(i,n) cin >> H.at(i);
    rep(i,n){
        ans += int(M<=H.at(i));
        M = max(M,H.at(i));
    }
    cout << ans << endl;
}

Measured memory_bytes: 3608
#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

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

#define MOD 1000000007
#define REP(i, N) for (int i = 0; i < N; ++i)
#define REP1(i, N) for (int i = 1; i <= N; ++i)
#define RREP(i, N) for (int i = N - 1; i >= 0; --i)
#define ALL(a) a.begin(), a.end()

int main() {
  int N;
  cin >> N;
  ll ans = 1;
  REP1(i, N) {
    ans *= i;
    ans %= MOD;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
  int x,y;
  

  scanf("%d%d",&x,&y);
  while(1){
    if(x>=y)x=x%y;
    else y=y%x;
    if(x==1){
      printf("%d\n",x);
	     break;
    }
    if(y==1){
      printf("%d\n",y);
	     break;
    }
    if(x==0){
      printf("%d\n",y);
      break;
    }
     if(y==0){
      printf("%d\n",x);
      break;
     }
  }
  return 0;
}



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

signed main(){
	int N;cin>>N;
	set<int> A; int t;
	for(int i=0;i<N;i++){
		cin>>t;
		if(!A.count(t))A.insert(t);
		else {
			t=-1;break;
		}
	}
	cout<<((t==-1)? "NO":"YES")<<endl;
}

Measured memory_bytes: 9600
#include<iostream>
#include<vector>
#include<string>
#include<cstring>
#include<algorithm>
#include<map>
#include<set>
#include<cmath>
#include<cassert>
#include<queue>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;

int main() {
	int N, M, K;
	cin >> N >> M >> K;
	for (int i = 0; i <= N; i++) {
		for (int j = 0; j <= M; j++) {
			int sum = i * (M - j) + j * (N - i);
			if (sum == K) {
				cout << "Yes" << endl;
				return 0;
			}
		}
	}
	cout << "No" << endl;
	return 0;
}


Measured memory_bytes: 256
import sys

def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def main():
    n, m = MI()
    a_b = [LI() for _ in range(n)]
    a_b.sort(key=lambda x:x[0])
    cnt = 0
    ans = 0
    for i in range(n):
        a = a_b[i][0]
        b = a_b[i][1]
        if cnt + b < m:
            cnt += b
            ans += a*b
        else:
            ans += a*(m - cnt)
            break
    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 28324
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func getString() string {
	sc.Scan()
	return sc.Text()
}

func main() {
	sc.Split(bufio.ScanWords)
	W, a, b := getInt(), getInt(), getInt()

	if a > b {
		a, b = b, a
	}

	ans := b - (a + W)
	if ans < 0 {
		ans = 0
	}
	out(ans)
}


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

int main(){
    int k, s;
    cin >> k >> s;

    long long int ans = 0;
    for(int i=0; i<=k; i++){
        for(int j=0; j<=k; j++){
            if(0 <= s - i - j && s - i - j <= k) ans += 1;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
def main():
    N = int(input())
    A_list = sorted(list(map(int, input().split())))
    max_a = A_list[-1]

    res = 0
    multi_set = set([])
    for i,a in enumerate(A_list):
        if a not in multi_set:    
            for j in range(1,max_a//a + 1):
                multi_set.add(a*j)
            
            if i == N-1:
                res += 1
            elif A_list[i+1] != a:
                res += 1
    print(res)

if __name__ == "__main__":
    main()


Measured memory_bytes: 173620
N = int(input())
dp = [N] * (N + 1)
dp[0] = 0
for i in range(N):
    j = 1
    while i + j <= N:
        dp[i + j] = min(dp[i + j], dp[i] + 1)
        j *= 6
    j = 9
    while i + j <= N:
        dp[i + j] = min(dp[i + j], dp[i] + 1)
        j *= 9
print(dp[-1])


Measured memory_bytes: 9488
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using namespace std;
int main(void){
    int n;
    std::cin >> n;
    std::vector<int> p(n);
    rep(i, n){
        std::cin >> p.at(i);
    }
    sort(p.begin(), p.end());
    int ans;
    ans = p.at(n - 1) / 2;
    rep(i, n - 1){
        ans = ans + p.at(i);
    }
    std::cout << ans << std::endl;
}


Measured memory_bytes: 384
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <vector>
#include <map>
#include <list>
#include <stack>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <queue>
#define pye cout << "yes" << endl
#define pno cout << "no" << endl
#define pYe cout << "Yes" << endl
#define pNo cout << "No" << endl
#define pYE cout << "YES" << endl
#define pNO cout << "NO" << endl
#define prin(num) cout << num << endl
#define REP(i, n) for(i=0; i<n; i++)
#define REPR(i, n) for(i=n; i>=0; i--)
#define FOR(i, m, n) for(i=m; i<n; i++)
#define max(a, b) ((a)>(b) ? (a):(b))
#define min(a, b) ((a)<(b) ? (a):(b))
#define INF 1000000000000000000
#define MOD 1000000007LL
#define MAX_V 100005
#define MAX_E 100005
#define NIL -1
#define WHITE 0
#define GRAY 1
#define BLACK 2
#define mp make_pair
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef priority_queue<P> PQ;

ll f(ll b, ll n) {
    return n<b ? n : f(b, n/b)+n%b;
}

int main(void) {
    ll n, s;
    cin >> n;
    cin >> s;
    ll ans1=INF, ans2=INF;
    ll ans=INF;
    
    if(n<s) {
        prin(-1);
        return 0;
    }
    
    if(n==s) {
        prin(n+1);
        return 0;
    }
    
    ll b;
    for(b=2; b*b<=n; b++) {
        if(f(b, n)==s) {
            ans1=b;
            break;
        }
    }
    
    ll p;
    for(p=1; p*p<=n; p++) {
        b=(n-s)/p+1;
        if((n-s)%p==0 && f(b, n)==s) {
            ans2=b;
        }
    }
    ans=min(ans1, ans2);
    if(ans==INF) ans=-1;
    prin(ans);
}


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

int main(){
  	vector<int> a(5);
  	for(int i=0; i<5; i++){
    	cin >> a[i];
    }
  	int ans = 10000;
  	for(int i=0; i<5; i++){
    	int tmp = 0;
		for(int j=0; j<5; j++){
        	if(i==j) tmp += a[j];
          	else tmp += (a[j] % 10 == 0) ? a[j] : ((a[j] / 10)*10 + 10);
        }
      	ans = tmp <= ans ? tmp : ans;
    }
  	cout << ans << endl;
	return 0;
}

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

#define ll long long

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	string N;
	cin >> N;
	int len = N.length()-1;
	if(N[len] == '2' || N[len] == '4' || N[len] == '5' || N[len] == '7'||  N[len] == '9')
	cout << "hon";
	if(N[len] == '0' || N[len] == '1' || N[len] == '6' || N[len] == '8')
	cout << "pon";
	if(N[len] == '3')
	cout << "bon";
}


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

int main() {
	string a, b;
	cin >> a >> b;

	int a_int = stoi(a);
	int b_int = stoi(b);
	string a_str = "";
	string b_str = "";

	for (int i = 0; i < b_int; i++) {
		a_str += a;
	}

	for (int i = 0; i < a_int; i++) {
		b_str += b;
	}

	cout << min(a_str, b_str) << endl;
}


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

int main(){
    int num, ans = 0;
    rep(i,3){
        cin >> num;
        ans += num;
    }
    if(ans >= 22) cout << "bust" << endl;
    else cout << "win" << endl;
    return 0;
}

Measured memory_bytes: 256
#coding: utf-8
N, M = map(int, input().split())
points = list(map(int, input().split()))
if N > M:
  print(0)
else:
  points.sort()
  koma = [points[i+1] - points[i] for i in range(M-1)]
  koma.sort()
  print(sum(koma[:M-N]))

Measured memory_bytes: 13968
/*      Chill raho be kuch nhi rakha sadness me. 
               Author: Maskman_lucifer                   */
               
#include <bits/stdc++.h>   
#define IO ios_base::sync_with_stdio(false);cin.tie(NULL);
#define ll long long 
#define pll pair<ll,ll>
#define pb push_back
#define M 1000000007
#define lc '\n'
using namespace std;
ll dp[110][200005];;

ll knapsack(ll index,ll size,ll weights[],ll values[])
{
    ll take,dontTake;
    take = dontTake = 0;
    
    if (dp[index][size]!=-1)
    {
        return dp[index][size];
    }

    if (index==0)
    {
        if (weights[0]<=size)
        {
            dp[index][size] = values[0];
            return values[0];
        }
        else
        {
            dp[index][size] = 0;
            return 0;
        }
    }

    if (weights[index]<=size)
    {
        take = values[index] + knapsack(index-1, size-weights[index], weights, values);
    }
    dontTake = knapsack(index-1, size, weights, values);
    
    dp[index][size] = max (take, dontTake);
    
    return dp[index][size];

}
int main()
{
    IO
    memset(dp,-1,sizeof(dp));
    ll n;
    cin>>n;
    ll knapsackSize;
    cin>>knapsackSize;
    ll weights[n+1];
    ll values[n+1];
    for(ll i=0;i<n;i++)
    {
        cin>>weights[i]>>values[i];
    }
    cout<<knapsack(n-1,knapsackSize,weights,values)<<lc;
    return 0;
}

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

using namespace std;

#define FOR(i,s,e) for((i)=(s);(i)<(int)(e);(i)++)
#define REP(i,e) FOR(i,0,e)

#define all(o) (o).begin(), (o).end()
#define psb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))

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

const double EPS = 1e-10;

const int N = 100000;
const int K = 100000;
int n, k;
int w[N], c[K];

bool check(int lmt) {
  int i, j;

  for (i=0; i<n; i++)
    if (lmt < w[i]) return false;

/*
  for (i=0; i<(int)min(k, n); i++)
    c[i] = w[i]; 

  int full = -1;
  for (i=k-1; i>=0; i--)
    if (c[i] == lmt) {
      full = i;
      break;
    }

  for (i=k; i<n; i++) {
    bool is_put = false;
    for (j=full+1; j<k; j++)
      if (c[j]+w[i] <= lmt) {
        is_put = true;
        c[j] += w[i];
        if (c[j] == lmt) full++;
        break;
      }
    if (!is_put) return false;
  }
*/

  memset(c, 0, sizeof(c));
  int full = -1;
  for (i=0; i<n; i++) {
    bool is_put = false;
    for (j=full+1; j<k; j++) {
      if (lmt < c[j] + w[i])
        full++; 
      else {
        c[j] += w[i];
        if (c[j] == lmt) full++;
        is_put = true;
        break;
      }
    }
    if (!is_put) return false;
  }

  return true;
}

int main() {
  int i;
  scanf("%d%d ", &n, &k);
  for (i=0; i<n; i++)
    scanf("%d ", w+i);
  memset(c, 0, sizeof(c));
//  sort(w, w+n, greater<int>());

  //?±?????????????(l, u]????????????????????¨??????????????¢?´¢
  int l = 0, u = 0;
  for (i=0; i<n; i++) u += w[i];
  while (u-l > 1) {
    int m = (int)(((ll)l + u)/2);
    if (check(m))
      u = m;
    else
      l = m;
  }

  printf("%d\n", u);

  return 0;
}

Measured memory_bytes: 1984
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Linq;
using static MyIO;


public class A
{
	public static void Main()
	{
		int a = GetInt();
		int b = GetInt();
		Console.WriteLine((a + b == 15) ? '+' : (a * b == 15) ? '*' : 'x');
	}
}


public static class MyIO
{
	private static string[] args = null;
	private static int num = -1;
	private static int used = -1;

	private static string getArg()
	{
		if(used == num)
		{
			args = Console.ReadLine().Split(' ');
			num = args.Length;
			used = 0;
		}
		return args[used++];
	}

	public static int GetInt(){ return int.Parse(getArg()); }
	public static long GetLong(){ return long.Parse(getArg()); }
	public static double GetDouble(){ return double.Parse(getArg()); }
	public static string GetString(){ return getArg(); }
}

Measured memory_bytes: 11092
A,B,M=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
m=10**6
for i in range(M):
    x,y,z=map(int,input().split())
    m=min(a[x-1]+b[y-1]-z,m)
print(min(m,min(a)+min(b)))

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

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

    int a[10], k;

    for (int i = 0; i < 5; i++)
        cin >> a[i];

    cin >> k;

    for (int i = 0; i < 5; i++)
        for (int j = i + 1; j < 5; j++)
            if (a[j] - a[i] > k)
            {
                cout << ":(" << endl;
                return 0;
            }

    cout << "Yay!" << endl;

    return 0;
}

Measured memory_bytes: 256
def abs(x):
    if x >= 0:
        return x;
    else:
        return -x;

def Next(v, n):
    list = [];
    for i in range(n - 1, -1, -1):
        if v[i] != 9 and (i == 0 or abs(v[i - 1] - (v[i] + 1)) <= 1):
            for j in range(i):
                list.append(v[j]);
            list.append(v[i] + 1);
            for j in range(i + 1, n):
                list.append(max(list[j - 1] - 1, 0));
            return list;
    list.append(1);
    for i in range(n):
        list.append(0);
    return list;

k = int(input());

curr = [];
curr.append(0);

for i in range(k):
    curr = Next(curr, len(curr));
    #print(curr);

for i in curr:
    print(i, end = "");


Measured memory_bytes: 3064
def main():
    N = int(input())
    A = [input() for i in range(N)]
    from collections import Counter
    c = Counter(A)
    print("AC x", c["AC"])
    print("WA x", c["WA"])
    print("TLE x", c["TLE"])
    print("RE x", c["RE"])


if __name__ == '__main__':
    main()


Measured memory_bytes: 82984
import java.util.Scanner;

public class Main{
  public static void main(String[]args){
   Scanner scan=new Scanner(System.in);
    String b=scan.next();
  if(b.equals("A")){
    System.out.println("T");
    }
  if(b.equals("T")){
    System.out.println("A");
    }
  if(b.equals("G")){
    System.out.println("C");
    }
  if(b.equals("C")){
    System.out.println("G");
    }
}
}
  

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

void solve() {
    int N;
    cin >> N;
    set<int> as;
    for (int i = 0; i < N; ++i) {
        int a;
        cin >> a;
        as.insert(a);
    }
    if (as.size() == N) {
        cout << "YES";
    } else {
        cout << "NO";
    }
    cout << endl;

}

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


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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}


int calc(vint A){
    int N=A.size();
    int ans=0;
    while(true){
        int latte=0;
        rep(i,N){
            if(A[i]<N)continue;
            int tmp=A[i]-(N-1);
            tmp=(tmp+N)/(N+1);
            latte+=tmp;
            A[i]-=tmp*(N+1);
        }
        if(latte==0)break;
        rep(i,N)A[i]+=latte;
        ans+=latte;
    }

    return ans;
}


signed main(){
    vint A(50,10000000000000000ll+1000);

    int K;cin>>K;

    K=calc(A)-K;

    rep(i,50)A[i]+=K-K/50*51;
    rep(i,K%50)A[i]-=51;

    cout<<50<<endl;
    rep(i,50){
        if(i)cout<<" ";
        cout<<A[i];
    }cout<<endl;
    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;

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

int main() {
    ios::sync_with_stdio(false);
    int k;
    ll ans = 0;

    cin >> k;
    for (int a = 1; a <= k; a++) {
        for (int b = 1; b <= k; b++) {
            for (int c = 1; c <= k; c++) {
                ll tmp = gcd(a, b);
                ans += gcd(tmp, c);
            }
        }
    }
    cout << ans << endl;

    return 0;
}


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

vector<ll> u, v;
int n, m = 0, a[1000];

main()
{
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
    }
    m = a[0];
    for (int i = 1; i < n; i++)
    {
        if (a[i] > a[i - 1])
            m += a[i] - a[i - 1];
    }
    cout << m << endl;
}


Measured memory_bytes: 256
//コンパイラ最適化用
#pragma GCC optimize("Ofast")
#define _GLIBCXX_DEBUG
//インクルード(アルファベット順)
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<chrono>//実行時間計測
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm,accumulate
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//順序保持しないmap
#include<unordered_set>//順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列
#include<bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<int, int> pii;
typedef pair<ll, ld> pld;
typedef pair<pii, int> ppiii;
typedef pair<pii, ll> ppiill;
typedef pair<pll, ll> ppllll;
typedef pair<pli, int> pplii;
typedef map<int, int> mii;
typedef deque<ll> dll;
typedef queue<ll> qll;
typedef priority_queue<ll> pqll;
typedef priority_queue<ll, vector<ll>, greater<ll>> pqrll;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<vector<int>> vvint;
typedef vector<vector<pll>> vvpll;

//マクロ
//forループ
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(ll i=0;i<ll(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=ll(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=ll(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) x.begin(),x.end() 
#define SIZE(x) ll(x.size()) 
//定数
#define INF 1000000000000 //10^12:∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange
//略記
#define PB push_back //挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素
#define cin(x) cin >> x

signed main(){
    //入力の高速化用のコード
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    //入力
    ll A = 0, B =0, C = 0;
    cin >> A >> B >> C;

    //vll X(N);
    //REP(i,N) cin >> X[i];
    if(A%2==0||B%2==0||C%2==0){cout << 0;}
    else{
        cout << min(A*B, min(B*C,C*A));
    }


    //本文
    //出力
    //cout << ans << endl;
    //REP(i,N) cout << ans.at(i) <<endl;
  return 0;
}

Measured memory_bytes: 3516
#include<iostream>
#include<vector>
using namespace std;
int main (void)
{
	int N;
	cin >> N;
	vector<long> A;
	A.resize (N);
	for (auto &e: A)
		cin >> e;

	vector<long> B;
	B.resize (N);

	int maxlength = A[0];
	
	for (int i = 0; i < N; i++)
	{
		if (A [i] > maxlength)
		{
			maxlength = A[i];
			B[i] = maxlength;
		}
		else
		{
			B[i] = maxlength;
		};
	}

	long total = 0;
	for (int i = 0; i < N; i++)
		total += (B[i] - A[i]);

	cout << total << endl;
	return 0;
}

Measured memory_bytes: 6368
def slove():
    import sys
    input = sys.stdin.readline
    n = int(input().rstrip('\n'))
    p = [int(input().rstrip('\n')) for _ in range(n)]
    p.sort()
    print(sum(p[:-1]) + p[-1] // 2)


if __name__ == '__main__':
    slove()


Measured memory_bytes: 38256
a,b,c,x,y = gets.chomp.split.map(&:to_i)

min = a*x + b*y

if x>y
  if min > 2*c*y + a*(x-y)
    min = 2*c*y + a*(x-y)
  end
  if min > 2*c*x
    min = 2*c*x
  end
else
  if min > 2*c*x + b*(y-x)
    min = 2*c*x + b*(y-x)
  end
  if min > 2*c*y
    min = 2*c*y
  end
end

printf("%d\n",min)

Measured memory_bytes: 1788
#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <map>
using namespace std;
using ll = long long;
#define REP(i, n) for(int i = 0; i < n; ++i)
constexpr ll MOD = 1e9 + 7;


ll n, k, a[200020], b[200020];


int main() {
	cin >> n >> k;
	REP(i, n) cin >> a[i];

	b[0] = true; // make状態
	for (int i = 1; i <= k; ++i) {
		bool make = true;
		for (int j = 0; j < n; ++j) {
			if (i >= a[j] && b[i - a[j]]) make = false;
		}
		b[i] = make;
	}
	cout << (!b[k] ? "First" : "Second") << endl;
}

Measured memory_bytes: 1024
import java.util.Arrays;
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();
        int D = sc.nextInt();
        int E = sc.nextInt();

        System.out.println(solve(A, B, C, D, E));

        sc.close();
    }

    static int solve(int A, int B, int C, int D, int E) {
        int[] times = { A, B, C, D, E };

        return Arrays.stream(times).map(time -> (time + 9) / 10 * 10).sum()
                - Arrays.stream(times).map(time -> (10 - time % 10) % 10).max().getAsInt();
    }
}

Measured memory_bytes: 35948
#include <bits/stdc++.h>
using namespace std;
int main(){
    int a,N;vector<int> A;vector<int> B;cin >> N;
    a = 0;
    for(int i=0;i<N;i++){
        cin >> a;
        A.push_back(a);
    }
    B = A;
    sort(B.begin(), B.end(), greater<int>());
    for(int i=0;i<N;i++){
        if(A[i] == B[0]){
            cout << B[1] << endl;
        }else{
            cout << B[0] << endl;
        }
    }

    return 0;
}


Measured memory_bytes: 3316
import itertools
H,W,K = map(int,input().split())

table = []

for _ in range(H):
    s = input()
    inst_s = []
    for x in s:
        inst_s.append(x)
    table.append(inst_s)

#print(table)

#Hで消すところの組み合わせ
del_H = []
l = [i for i in range(H)]
for x in range(1,H+1):
	for v in itertools.combinations(l,x):
		del_H.append(v)

#W方向で消すところ
del_W = []
l = [i for i in range(W)]
for x in range(1,W+1):
	for v in itertools.combinations(l,x):
		del_W.append(v)

"""
print(del_H)
print(del_W)
"""
ans = 0

#まずは使うところタプルの組み合わせ
for tuple_h in del_H:
    for tuple_w in del_W:
        count = 0
        for h in tuple_h:
            for w in tuple_w:
                count += table[h][w].count("#")
        
        if count == K:
            ans += 1

print(ans)

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

using namespace std;
typedef long long ll;

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  
  int a, b;
  while (cin >> a >> b, a) {
    map<int, int> s, t;
    int x;
    for (int i = 0; i < a; i++) {
      cin >> x;
      s[x]++;
    }
    for (int i = 0; i < b; i++) {
      cin >> x;
      t[x]++;
    }

    int ans = 0;
    for (int i = 1; i <= 20; i++) {
      ans += min(s[i], t[i]) * i + abs(s[i] - t[i]) * i;
    }
    cout << ans << endl;
  }

  return 0;
}


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

bool first_win();

int main()
{
	if (first_win())
		printf("First\n");
	else
		printf("Second\n");
	return 0;
}

bool first_win()
{
	std::string s;
	std::cin >> s;
	if (s.front() != s.back())
	{
		bool next{};
		int front_count{1};
		for (unsigned int i = 1; i < s.size(); i++)
		{
			if (next)
				next = s[i] == s.back();
			else
			{
				if (s[i] == s.front())
				{
					front_count++;
					next = false;
				}
			}
		}
		return (s.size() - 2 * front_count) & 1;
	}
	else
	{
		for (char i = 'a'; i <= 'z'; i++)
		{
			if (i == s.front()) continue;
			bool next{};
			int char_count{1};
			for (int j = 1; j < s.size(); j++)
			{
				if (next)
					next = s[j] == i;
				else
				{
					if (s[j] == s.front())
					{
						char_count++;
						next = false;
					}
				}
			}
			if ((s.size() - (2 * char_count - 1)) & 1)
				return true;
		}
		return false;
	}
}

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

using namespace std;

const int MAX_M = 20, MAX_N = 50000;
const int INF = 1<<28;

int N, M;
int C[MAX_M];
int main() {
    cin >> N >> M;
    for (int i = 0; i < M; i++) cin >> C[i];

    vector<int> dp(N + 1, INF);
    dp[0] = 0;
    for (int i = 0; i < M; i++) {
        for (int j = 0; j + C[i] <= N; j++) {
            if (dp[j] < INF) dp[j + C[i]] = min(dp[j + C[i]], dp[j] + 1);
        }
    }
    cout << dp[N] << endl;
    return 0;
}

Measured memory_bytes: 1288
<?php
fscanf(STDIN, "%d %d", $N, $M);
$A = explode(" ", trim(fgets(STDIN)));
rsort($A);

while($M > 0) {
    $base = $A[0] / 2;
    foreach ($A as $k => $v) {
        if ($base <= $v) {
            if ($M > 0) {
                $A[$k] /= 2;
                $M--;
            } else {
                break;
            }
        }
    }
    rsort($A);
}

$ans = 0;
foreach ($A as $v) {
    $ans += intval($v);
}
echo $ans;


Measured memory_bytes: 16884
// * refernce
//   * https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8

use std::io;
use std::str;

fn main () {

    // STEP.01
    // create a new `String` instance to store the test data from standard input
    let mut buffer_stdin = String::new();

    // STEP.02
    // read a line from the standard input to get test data
    std::io::stdin().read_line(&mut buffer_stdin).unwrap();

    // STEP.03
    // split the stdin by spaces
    let mut test_data = buffer_stdin.split_whitespace();

    // STEP.04
    // read out the test data from the iterator
    let a: u32 = test_data.next().unwrap().parse().unwrap();
    let b: u32 = test_data.next().unwrap().parse().unwrap();

    println!( "{}", abc086_a(a, b) );

}

fn abc086_a (a: u32, b: u32) -> String {

    if   is_even(a) || is_even(b) { String::from("Even") }
    else                          { String::from("Odd")  }

}

fn is_even (target: u32) -> bool {

    (target % 2) == 0

}

Measured memory_bytes: 4352
n = int(input())
x, y = map(int, input().split())
p, m = [x+y]*2, [x-y]*2
for i in range(n-1):
    x, y = map(int, input().split())
    p = [min(p[0], x+y), max(p[1], x+y)]
    m = [min(m[0], x-y), max(m[1], x-y)]
print(max(p[1] - p[0], m[1] - m[0]))


Measured memory_bytes: 9112
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int) n; i++)
using ll = long long;
template <class T>
using vt = vector<T>;
using vvi = vector<vector<int>>;

void svtr(vector<int> &a){
  sort(a.begin(),a.end());
  reverse(a.begin(),a.end());
}

int main() {
  int a,b;
  double c;
  cin >> a >> b >> c;
  c+=0.5;

  cout << (int) (c/a)*b;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
constexpr long long mod = 1'000'000'007;

long long pow_mod(long long b, long long p){
    long long ret = 1;
    while (p){
        if (p & 1) ret = (ret * b) % mod;
        b = (b * b) % mod;
        p >>= 1;
    }
    return ret;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    string S;
    cin >> S;
    int L = S.size();
    vector<long long> cumA(L + 1, 0);
    vector<long long> cumB(L + 1, 0);
    vector<long long> cumC(L + 1, 0);
    vector<long long> cumX(L + 1, 0);

    for (int i = 0; i < L; ++i){
        cumA[i + 1] = cumA[i];
        cumB[i + 1] = cumB[i];
        cumC[i + 1] = cumC[i];
        cumX[i + 1] = cumX[i];
        if (S[i] == 'A'){
            ++cumA[i + 1];
        }else if (S[i] == 'B'){
            ++cumB[i + 1];
        }else if (S[i] == 'C'){
            ++cumC[i + 1];
        }else{
            ++cumX[i + 1];
        }
    }

    long long Q = cumX[L];

    long long ans = 0;

    for (int i = 0; i < L; ++i){
        if (S[i] == 'B') {
            long long nAbefore = cumA[i];
            long long nCafter = cumC[L] - cumC[i + 1];
            long long nXbefore = cumX[i];
            long long nXafter = cumX[L] - cumX[i + 1];
            // ABC
            ans = (ans + (nAbefore * nCafter) % mod * pow_mod(3, Q)) % mod;
            // AB? ?BC
            if (Q >= 1){
                ans = (ans + (nAbefore * nXafter) % mod * pow_mod(3, Q - 1)) % mod;
                ans = (ans + (nXbefore * nCafter) % mod * pow_mod(3, Q - 1)) % mod;
            }
            // ?B?
            if (Q >= 2){
                ans = (ans + (nXbefore * nXafter) % mod * pow_mod(3, Q - 2)) % mod;
            }
        }else if (S[i] == '?'){
            long long nAbefore = cumA[i];
            long long nCafter = cumC[L] - cumC[i + 1];
            long long nXbefore = cumX[i];
            long long nXafter = cumX[L] - cumX[i + 1];
            // A?C
            ans = (ans + (nAbefore * nCafter) % mod * pow_mod(3, Q - 1)) % mod;
            // A?? ??C
            if (Q >= 2){
                ans = (ans + (nAbefore * nXafter) % mod * pow_mod(3, Q - 2)) % mod;
                ans = (ans + (nXbefore * nCafter) % mod * pow_mod(3, Q - 2)) % mod;
            }
            // ???
            if (Q >= 3){
                ans = (ans + (nXbefore * nXafter) % mod * pow_mod(3, Q - 3)) % mod;
            }
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3664
#include <iostream>

using namespace std;

int main() {
    char X, Y;
    cin >> X >> Y;
    
    if(X<Y) {
        cout << "<" << endl;
    } else if(X>Y) {
        cout << ">" << endl;
    } else {
        cout << "=" << endl;
    }


    return 0;
    
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using V = vector<ll>;
#define _GLIBCXX_DEBUG
#define rep(i, a) for(int i = 0; i < a; i++)
#define ALL(v) v.begin(), v.end()

int main(){
    int n; cin>>n;
    if(n==1)cout<<"Hello World"<<endl;
    else {
        int a,b; cin>>a>>b;
        cout<<a+b<<endl;
    }
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;
int main(){
    char stud;
    int64_t N,A,B,passed=0,overseas=0;
    cin>>N>>A>>B;

    for(int64_t i=0;i<N;i++){
        cin>>stud;
        if(stud=='a' && passed<A+B){
            passed++;
            cout<<"Yes"<<endl;
        }
        else if(stud=='b' && passed<A+B && overseas<B){
            overseas++;
            passed++;
            cout<<"Yes"<<endl;
        }
        else{
            cout<<"No"<<endl;
        }
    }
    return 0;
}



Measured memory_bytes: 640
c = []
for _ in range(3):
    c1 = list(map(int, input().split()))
    c.append(c1)

a = [c[0][0], c[0][1], c[0][2]]
b = [0, c[1][1] - a[1], c[2][2] - a[2]]

for i in range(3):
    for j in range(3):
        if c[i][j] != a[j] + b[i]:
            print("No")
            exit()
print("Yes")

Measured memory_bytes: 3064
#include<algorithm>     //sort,二分探索,など
#include<bitset>        //固定長bit集合
#include<cmath>         //pow,logなど
#include<complex>       //複素数
#include<deque>         //両端アクセスのキュー
#include<fstream>       //ファイルストリーム（標準入力変更用）
#include<functional>    //sortのgreater
#include<iomanip>       //setprecision(浮動小数点の出力の誤差)
#include<iostream>      //入出力
#include<iterator>      //集合演算(積集合,和集合,差集合など)
#include<map>           //map(辞書)
#include<numeric>       //iota(整数列の生成),gcdとlcm(c++17)
#include<queue>         //キュー
#include<set>           //集合
#include<stack>         //スタック
#include<string>        //文字列
#include<unordered_map> //イテレータあるけど順序保持しないmap
#include<unordered_set> //イテレータあるけど順序保持しないset
#include<utility>       //pair
#include<vector>        //可変長配列

//名前
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef map<string, int> msi;
typedef map<string, ll> msll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pllll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvll;
typedef vector<vector<string>> vvs;
typedef vector<vector<bool>> vvb;

//定数
const ll MOD = 1000000007;
const ll INF = 1000000000000000000;

//マクロ
#define rep(i,n) for(int i=0;i<n;i++)
#define reps(i,s,e) for(int i=s;i<e;i++)
#define repse(i,s,e) for(int i=s;i<=e;i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define in1(x1) cin >> x1
#define in2(x1, x2) cin >> x1 >> x2
#define in3(x1, x2, x3) cin >> x1 >> x2 >> x3
#define inN(x, N) rep(i, N) in1(x[i])
#define outl(x) cout << x << endl
#define out2l(x, y) cout << x << " " << y << endl 

//よく使う関数
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

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

    //標準入力をファイルに変更
    //std::ifstream in("input.txt");
    //std::cin.rdbuf(in.rdbuf());

    int N;
    in1(N);

    vvi D(N, vi(2));

    rep(i, N) in2(D[i][0], D[i][1]);

    rep(i, N - 2)
    {
        if (D[i][0] == D[i][1] &&
            D[i + 1][0] == D[i + 1][1] &&
            D[i + 2][0] == D[i + 2][1])
        {
            outl("Yes");
            return 0;
        }
    }

    outl("No");

    return 0;
}


Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
long long n,k;
int main()
{
	scanf("%lld %lld",&n,&k);
	if(k%2==1)
	{
		long long ans=(n/k)*(n/k)*(n/k);
		printf("%lld",ans);
	}
	if(k%2==0)
	{
		printf("%lld\n",(n/k)*(n/k)*(n/k)+(n/(k/2)-n/k)*(n/(k/2)-n/k)*(n/(k/2)-n/k));
	} 
	return 0;
} 

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<vector>
#include<list>
#include<cmath>
#include<algorithm>
#define lson node<<1,st,mid
#define rson node<<1|1,mid+1,ed
#define mem(a,x) memset(a,x,sizeof(a))
#define me(a) memset(a,0,sizeof(a))
#define IOS ios::sync_with_stdio(false)
#define lowbit(x) x&(-x)
#define up(i,x,y) for(long long i=x;i<y;i++)
#define down(i,x,y) for(long long i=x;i>=y;i--)
#define in freopen("in.txt","r",stdin)
#define out freopen("out.txt","w",stdout)  	
typedef long long ll;
const ll mod = 1e9 + 7;
const ll INF = 0x3f3f3f3f;
const int maxn = 1e5+5;
const double pi = acos(-1.0);
using namespace std;
ll qpow(ll a, ll b) { ll s = 1; while (b > 0) { if (b & 1)s = s * a % mod; a = a * a % mod; b >>= 1; }return s; }
ll read()     //输入外挂
{
    ll res = 0, ch, flag = 0;
    if ((ch = getchar()) == '-')
        flag = 1;
    else if (ch >= '0' && ch <= '9')
        res = ch - '0';
    while ((ch = getchar()) >= '0' && ch <= '9')
        res = res * 10 + ch - '0';
    return flag ? -res : res;
}
int main(){
    ll n, k, s;
    ll x, y;
    cin >> n >> k >> s;
    for (int i = 0; i < k; i++) {
        cout << s << " ";
    }
    for (int i = k; i < n; i++) {
        if (s != 1000000000) cout << s + 1 << " ";
        else cout << "999999999 ";
                    
    }
    cout << endl;
}

Measured memory_bytes: 1280
#

import sys
input=sys.stdin.readline

def main():
    S=input().strip("\n")
    T=input().strip("\n")
    cnt=0
    for i in range(len(S)):
        if S[i]==T[i]:
            cnt+=1
    print(len(S)-cnt)
    
    
    
if __name__=="__main__":
    main()


Measured memory_bytes: 67940
#include <bits/stdc++.h>
using namespace std;
int main() {
  int A, B, C, D;
  cin >> A >> B >> C >> D;
  int w = abs(C-A), h = abs(D-B);
  int g = __gcd(w, h);
  w /= g, h /= g;
  cout << (h+w-1)*g << endl;
  return 0;
}


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

using namespace std;

int main(void)
{
	ios::sync_with_stdio(false);
	string s;
	int ans=0;
	cin >> s;
	for(int i=0;i<=6;i++)
	{
		if(s[i]=='1')
		{
			ans++;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
void fastIO(){
  ios_base::sync_with_stdio(0); cin.tie(0);
}


int main(){
  fastIO();
  int n;
  cin>>n;
  int two = 0;
  int cnt = 0;
  for(int i=0;i<n;i++){
  	int x;
  	cin>>x;
  	if(x%4==0){
  		cnt++;
  	}else if(x%2==0){
  		two++;
  	}
  }
  cnt+=two/2;
  if((n%2==0&&cnt>=(n/2))||(n%2!=0&&cnt>=(n/2)-1)){
  	cout<<"Yes"<<endl;
  }else{
  	cout<<"No"<<endl;
  }
}



Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<functional>
#include<math.h>
using namespace std;
#define N (1000000000+7)
#define M (998244353)
#define INF 1e16
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<P,ll>Q;


int main(void){
    ll a,b,c,x,y;
    cin>>a>>b>>c>>x>>y;
    ll lim = max(x,y);
    ll ans = (ll)INF;
    for(ll i=0;i<=lim;i++){
        ll p1 =2*i*c;
        ll p2 = a*max(x-i,0LL);
        ll p3 = b*max(y-i,0LL);
        ans = min(ans,p1+p2+p3);
    }
    cout<<ans<<endl;
    return 0;
}

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

int const N = 200000, md = 998244353, ti = 499122177;
int p[N + 1], n, k;

void ad(int &x, int y) { if ((x += y) >= md)x -= md; }

struct S{
	int pr, s, z;
	S():pr(), s(), z(1) {}
	S operator +(S const &o)const {
		S an;
		ad(an.pr = pr, o.pr);
		an.s = s + o.s;
		return an;
	}
	void up(int v){
		pr = (ll)pr * v % md;
		z = (ll)z * v % md;
	}
}s[N << 2];

void sl(int id, int a, int b){
	if (s[id].z != 1){
		s[a].up(s[id].z);
		s[b].up(s[id].z);
		s[id].z = 1;
	}
}

void st(int i, int l = 1, int r = n, int id = 1){
	if (l == r){
		s[id].pr = 1;
		s[id].s = 1;
		return;
	}
	int m = l + r >> 1, a = id << 1, b = a | 1;
	sl(id, a, b);
	if (i <= m)st(i, l, m, a);
	else st(i, m + 1, r, b);
	s[id] = s[a] + s[b];
}

void up(int x, int y, int v, int l = 1, int r = n, int id = 1){
	if (l > y || r < x)return;
	if (l >= x && r <= y)return s[id].up(v);
	int m = l + r >> 1, a = id << 1, b = a | 1;
	sl(id, a, b);
	up(x, y, v, l, m, a);
	up(x, y, v, m + 1, r, b);
	s[id] = s[a] + s[b];
}

S gt(int x, int y, int l = 1, int r = n, int id = 1){
	if (l > y || r < x)return S();
	if (l >= x && r <= y)return s[id];
	int m = l + r >> 1, a = id << 1, b = a | 1;
	sl(id, a, b);
	return gt(x, y, l, m, a) + gt(x, y, m + 1, r, b);
}

int pw(int x, int p){
	int an = 1;
	while (p){
		if (p & 1)an = (ll)an * x % md;
		x = (ll)x * x % md;
		p >>= 1;
	}
	return an;
}

int inv(int x) { return pw(x, md - 2); }

int main(){
	scanf("%d%d", &n, &k);
	f(i, 1, n + 1)scanf("%d", p + i);
	f(i, 1, k)st(p[i]);
	int an = (ll)(k - 2) * (k - 1) / 2 % md * ti % md, ki = inv(k);
	f(i, k, n + 1){
		ad(an, (ll)s[1].pr * ti % md);
		S t = gt(p[i], n);
		ad(an, t.s - t.pr);
		ad(an, md);
		st(p[i]);
		up(1, n, (ll)(k - 1) * ki % md);
	}
	printf("%d\n", an);
}

Measured memory_bytes: 13904
#include<bits/stdc++.h>
#define inf 0x3f3f3f3f
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef double dd;
const int N = 1e5+5;
const dd eps = 1e-8;
const int mod = 1e9+7;

ll qu[N],x;
int cnt;

int main(){
  ios::sync_with_stdio(false);
  // freopen("input.txt","r",stdin);
  for(ll i = -5e3;i <= 5e3;i++){
    qu[++cnt] = i*i*i*i*i;
  }
  cin>>x;
  for(int i = 1;i <= cnt;i++){
    int inx = lower_bound(qu+1,qu+1+cnt,x+qu[i]) - qu;
    if(inx == cnt+1) continue;
    if(qu[inx] == x+qu[i]){
      cout<<(inx-5001)<<" "<<(i-5001)<<endl;
      return 0;
    }
  }
  return 0;
}


Measured memory_bytes: 3632
K = int(input())

queue = list(range(1, 10))

if K < 10:
    print(K)
else:
    i = 0
    while K > len(queue):
        if queue[i] % 10 != 0:
            l = 10 * queue[i] + queue[i] % 10 - 1
            queue.append(l)
        
        l = 10 * queue[i] + queue[i] % 10
        queue.append(l)
        
        if queue[i] % 10 != 9:
            l = 10 * queue[i] + queue[i] % 10 + 1
            queue.append(l)
        
        i += 1

    print(queue[K - 1])

Measured memory_bytes: 7200
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp2
{
    public class Program
    {
        public static void Main(string[] args)
        {
            int A;
            int B;
            int T;

            string input = Console.ReadLine();
            string[] ints = input.Split(' ');

            A = int.Parse(ints[0]);
            B = int.Parse(ints[1]);
            T = int.Parse(ints[2]);

            Console.WriteLine(B*(T/A));
        }
    }
}


Measured memory_bytes: 13140
#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()
{
    string s;
    cin >> s;
    map<char, int> dic;
    rep(i, 26) dic[i + 'a'] = 0;
    int n = s.size();
    rep(i, n) dic[s[i]]++;
    rep(i, 26)
    {
        if (dic['a' + i] < 1)
        {
            cout << char('a' + i) << endl;
            return 0;
        }
    }
    cout << "None" << endl;
    return 0;
}

Measured memory_bytes: 3684