akhauriyash/Code-Regression huggingface dataset:
# D - Line++
from collections import deque

INF = 1001001001

n, x, y = map(int, input().split())
x -= 1
y -= 1
ans = [0]*n

for i in range(n):
    dist = [INF]*n
    q = deque()
    dist[i] = 0
    q.append(i)
    
    while len(q)>0:
        v = q.popleft()
        d = dist[v]
        if v-1 >= 0 and dist[v-1]==INF:
            q.append(v-1)
            dist[v-1]=d+1
        if v+1 < n and dist[v+1]==INF:
            q.append(v+1)
            dist[v+1]=d+1
        if v==x and dist[y]==INF:
            q.append(y)
            dist[y]=d+1
        if v==y and dist[x]==INF:
            q.append(x)
            dist[x]=d+1
    for d in dist:
        ans[d] += 1

for a in ans[1:]:
    print(int(a//2))


Measured memory_bytes: 49756
package main

import "fmt"

var pR, pS, pP int

func main() {
	var N, K int
	fmt.Scan(&N, &K, &pR, &pS, &pP)
	var T string
	fmt.Scan(&T)
	ss := make([][]byte, K)
	for i := 0; i < N; i++ { // mod Kのグループに分ける
		ss[i%K] = append(ss[i%K], T[i])
	}
	ans := 0
	for i := 0; i < len(ss); i++ {
		// fmt.Println("i", i, "ss[i]", string(ss[i]))
		L := len(ss[i])
		dp := make([][3]int, L+1) // DPテーブル
		for j := 0; j < L; j++ {
			r := winp(ss[i][j], 'r')
			s := winp(ss[i][j], 's')
			p := winp(ss[i][j], 'p')
			// 二回連続で同じ手を出せない条件でDPする
			dp[j+1][0] = max(dp[j][1]+r, dp[j][2]+r)
			dp[j+1][1] = max(dp[j][0]+s, dp[j][2]+s)
			dp[j+1][2] = max(dp[j][0]+p, dp[j][1]+p)
		}
		// fmt.Println("i", i, "dp[i]", dp)
		ans += max(dp[L][0], max(dp[L][1], dp[L][2]))
	}
	fmt.Println(ans)
}
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}
func winp(c, p byte) (r int) {
	if c != p {
		if p == 'r' && c == 's' {
			r = pR
		} else if p == 's' && c == 'p' {
			r = pS
		} else if p == 'p' && c == 'r' {
			r = pP
		}
	}
	return r
}


Measured memory_bytes: 6272
#include<queue>
#include<cstdio>
#include<vector>
#include<algorithm>

#define	mp	make_pair
#define	pb	push_back

using namespace std;

typedef	pair<int,int>	pii;

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

int main(){
	for(int r;scanf("%d",&r),r;){
		int w[2],h[2],x[2],y[2];
		static int room[2][500][500];
		static int roomcnt[2][100001];
		for(int k=0;k<2;k++){
			scanf("%d%d%d%d",&w[k],&h[k],&x[k],&y[k]);
			x[k]--,y[k]--;
			for(int i=0;i<h[k];i++)for(int j=0;j<w[k];j++)	scanf("%d",&room[k][i][j]);

			for(int i=0;i<=r;i++)	roomcnt[k][i]=1<<30;
			roomcnt[k][0]=0;

			static bool visited[500][500];
			for(int i=0;i<h[k];i++)for(int j=0;j<w[k];j++)	visited[i][j]=false;
			visited[y[k]][x[k]]=true;
			int cnt=0,lev=0;
			priority_queue< pair<int,pii> > pq;
			pq.push(mp(-room[k][y[k]][x[k]],mp(y[k],x[k])));
			while(!pq.empty()){
				pair<int,pii> a=pq.top();	pq.pop();
				int nowlev=-a.first,x=a.second.second,y=a.second.first;
				cnt++;
				if(lev<nowlev)	lev=nowlev;
				roomcnt[k][cnt]=lev;
				if(cnt==r)	break;

				for(int i=0;i<4;i++){
					int xx=x+dx[i],yy=y+dy[i];
					if(0<=xx && xx<w[k] && 0<=yy && yy<h[k] && !visited[yy][xx]){
						pq.push(mp(-room[k][yy][xx],mp(yy,xx)));
						visited[yy][xx]=true;
					}
				}
			}
		}

		int ans=1<<30;
		for(int i=0;i<=r;i++)	ans=min(ans,roomcnt[0][i]+roomcnt[1][r-i]);
		printf("%d\n",ans);
	}

	return 0;
}

Measured memory_bytes: 3972
import bisect,collections,copy,itertools,math,string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
def main():

    n, k= LI()
    x = LI()
    ans = float("inf")

    for i in range(n-k+1):
        if x[i] >= 0 or x[i+k-1] <= 0:
            time = max(abs(x[i]), abs(x[i+k-1]))
            ans = min(ans, time)
        else:
            time = min(abs(x[i]), abs(x[i+k-1]))*2 + max(abs(x[i]), abs(x[i+k-1]))
            ans = min(ans, time)

    print(ans)

main()





Measured memory_bytes: 83868
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
long long inf=(long long)1E17;
#define i_7 (long long)(1E9+7)
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
using namespace std;
long long gcd(long long a, long long b){
  if(a<b){
    swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd(b,a%b);
  }
}
 
long long lcm(long long x, long long y){
  return (x/gcd(x,y))*y;
}
 
class UnionFind {
    public:
    //各頂点の親の番号を格納する。その頂点自身が親だった場合は-(その集合のサイズ)を入れる。
    vector<int> Parent;
    
    //クラスを作るときは、Parentの値を全て-1にする。
    //以下のようにすると全てバラバラの頂点として解釈できる。
    UnionFind(int N) {
        Parent = vector<int>(N, -1);
    }
    
    //Aがどのグループに属しているか調べる
    int root(int A) {
        if (Parent[A] < 0) return A;
        return Parent[A] = root(Parent[A]);
    }
    
    //自分のいるグループの頂点数を調べる
    int size(int A) {
        return -Parent[root(A)];//先祖をrootで取っておきたい。
    }
    
    //AとBをくっ付ける
    bool connect(int A, int B) {
        //AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
        A = root(A);
        B = root(B);
        if (A == B) {
            //すでにくっついてるからくっ付けない
            return false;
        }
        
        //大きい方(A)に小さいほう(B)をくっ付けたい
        //大小が逆だったらAとBをひっくり返す。
        if (size(A) < size(B)) swap(A, B);
        
        //Aのサイズを更新する
        Parent[A] += Parent[B];
        //Bの親をAに変更する
        Parent[B] = A;
        
        return true;
    }
};
 
int main(){
  int w,a,b;
  cin>>w>>a>>b;
  if((a<=b && b<=a+w) || (a<=b+w && b+w<=a+w)){
    cout<<0<<endl;
  }else if(b>a+w){
    cout<<b-a-w<<endl;
  }else{
    cout<<a-b-w<<endl;
  }
  return 0;
}



Measured memory_bytes: 256
N = int(input())
A = [a - i - 1 for i, a in enumerate(list(map(lambda x: int(x), input().split(" "))))]
A.sort()
 
ini = int(N/2)
m_abs = ""
sumlist = 0
for i in range(ini, len(A)):
  tmp = 0
  if i == ini:
    sumlist = - sum(A[:i]) + sum(A[i:])
  else:
    sumlist -= 2 * A[i]
 
  if 2 * i - N > 0:
    tmp = sumlist + (2 * i - N) * A[i - 1]
  else:
    tmp = sumlist + (2 * i - N) * A[i]
  if not m_abs or m_abs > tmp:
    m_abs = tmp
  if m_abs and m_abs <= tmp:
    break
    
print(m_abs)

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

#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < n; i++)
typedef long long ll;

int main() {
    int n; cin >> n;
    map<int, int> m;
    for(int i = 0; i < n; i++) {
        int a; cin >> a;
        m[a]++;
    }
    int ans = 0;
    for(auto p : m){
        if(p.first < p.second){
            ans += abs(p.second - p.first);
        }else if(p.second < p.first){
            ans += p.second;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 4736
#include<bits/stdc++.h>
using namespace std;
#define LL long long
#define P pair<LL, LL>
#define fs first
#define sc second
const int N = 2e2 + 11;
int dep[N], du[N], maxdu[N], n;
vector<int> G[N];
queue<int> dl;
LL bfs(int u, int v){
	memset(dep, 0, sizeof dep);
	memset(maxdu, 0, sizeof(maxdu));
	dep[u] = 1; dl.push(u);
	if(v)dep[v] = 1, dl.push(v);
	int ma = 0;
	while(dl.size()){
		int x = dl.front(); dl.pop();
		ma = max(ma, dep[x]);
		maxdu[dep[x]] = max(maxdu[dep[x]], du[x]);
		for(int y : G[x]){
			if(dep[y] != 0)continue;
			dep[y] = dep[x] + 1;
			dl.push(y);
		}
	}
	return ma;
}
P get(int u, int v){
	P ans;
	ans.fs = bfs(u, v);
	ans.sc = maxdu[1] - (v != 0);
//	printf("madu1=%d ans.sc=%lld\n", maxdu[1] - (v != 0), ans.sc);
	for(int i = 2;i <= n; i++){
		if(maxdu[i] <= 1)break;
		ans.sc *= maxdu[i] - 1;
	}
	if(v != 0)ans.sc *= 2;
//	printf("u=%d v=%d fs=%lld sc=%lld\n", u, v, ans.fs, ans.sc);
	return ans;
}
int main(){
	cin>>n;
	if(n == 2){
		puts("1 2");
		return 0;
	}
	int u, v;
	for(int i = 1;i < n; i++){
		scanf("%d%d", &u, &v);
		G[u].push_back(v);
		G[v].push_back(u);
		du[u]++; du[v]++;
	}
	P ans = P(1e18, 1e18);
//	printf("ans.fs=%lld ans.sc=%lld\n", ans.fs, ans.sc);
	for(int i = 1;i <= n; i++){
		ans = min(ans, get(i, 0));
		for(int v : G[i]){
			ans = min(ans, get(i, v));
		}
	}
	cout<<ans.fs<<" "<<ans.sc<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// 端点を間違えないように気をつけること!
#define FOR(i, m, n) for (ll i = (ll)(m); i <= (ll)(n); i++)
#define RFOR(i, m, n) for (ll i = (ll)(m); i >= (ll)(n); i--)
// 割り算をするときは自作関数syou,amariを使うこと!
ll amari(ll a, ll b)
{
    if (a >= 0)
    {
        return a % b;
    }
    else
    {
        ll c = (-a) % b;
        return (b - c) % b;
    }
}
ll syou(ll a, ll b)
{
    if (a >= 0)
    {
        return a / b;
    }
    else
    {
        return (a - amari(a, b)) / b;
    }
}

ll ue(ll n)
{
    ll a = n / 10;
    ll b = n % 10;
    if (b == 0)
    {
        return a * 10;
    }
    else
    {
        return (a + 1) * 10;
    }
}

int main()
{
    ll A[5];
    ll m = 0;
    FOR(i, 0, 4)
    {
        cin >> A[i];
        m = max(m, amari(10 - A[i], 10));
    }
    ll sum = 0;
    FOR(i, 0, 4)
    {
        sum += ue(A[i]);
    }
    cout << sum - m << endl;
}

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

#define REP(i,n) for(int i=0;i<n;++i)
#define RREP(i,n) for(int i=n-1;i>=0;--i)
#define FOR(i,m,n) for(int i=m;i<n;++i)
#define RFOR(i,m,n) for(int i=n-1;i>=m;--i)
#define ALL(v) v.begin(),v.end()
#define PB(a) push_back(a)
#define INF 1000000001
#define MOD 1000000007
#define EPS 1e-9

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

typedef long long ll;
using namespace std;


int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	REP(cnt,INF) {
		int n, sum = 0;
		cin >> n;
		if (!n)break;
		if (cnt) cout << endl;
		vector<int> v(4), c = { 10,50,100,500 }, charge(4);
		REP(i, 4) {
			cin >> v[i];
			sum += v[i] * c[i];
		}
		int res = sum - n;
		RREP(i, 4) {
			int k = 0;
			while (c[i] * k <= res) k++;
			charge[i] = k - 1;
			res -= (k - 1)*c[i];
		}
		REP(i, 4) {
			v[i] -= min(charge[i], v[i]);
			if (v[i] != 0) {
				cout << c[i] << " " << v[i] << endl;
			}
		}
	}
	return 0;

}

Measured memory_bytes: 3104
N=int(input())
x=0
y=0
t=0
for i in range(N):
    tt,xx,yy=map(int,input().split())
    if abs(xx-x)+abs(yy-y)<=tt-t:
        if (abs(xx-x)+abs(yy-y))%2!=(tt-t)%2:
            print("No")
            exit()
    else:
        print("No")
        exit()
    t,x,y=tt,xx,yy
print("Yes")

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

using namespace std;
int n, k;
int a[200000], fn[300000], f[200000];
void md(int x) {
    while (x <= n + n + 1) {
        fn[x]++;
        x = (x | (x - 1)) + 1;
    }
}
int sum(int x) {
    int s = 0;
    while (x >= 1) {
        s += fn[x];
        x = (x & (x - 1));
    }
    return s;
}
long long calc(int x) {
    for (int i = 1; i <= n; i++) {
        if (a[i] <= x) f[i] = f[i - 1] + 1;
        else f[i] = f[i - 1] - 1;
    }
    for (int i = 1; i <= n + n + 1; i++) fn[i] = 0;
    long long c = 0;
    md(f[0] + n + 1);
    for (int i = 1; i <= n; i++) {
        c += sum(f[i] + n);
        md(f[i] + n + 1);
    }
    return c;
}
int main() {
    ios_base::sync_with_stdio(0);
    cin >> n;
    for (int i = 1; i <= n; i++) cin >> a[i];
    long long all = 1ll * n * (n + 1) / 2;
    int l = 1;
    int r = 1e9;
    while (r - l > 0) {
        int mid = (r + l) / 2;
        long long k = calc(mid);
        if (k < all / 2 + 1) l = mid + 1;
        else r = mid;
    }
    cout << l << "\n";
    return 0;
}


Measured memory_bytes: 1792
use proconio::{input, fastout};

#[fastout]
fn main() {
    input! {
        h: usize,
        n: usize,
        ab: [(usize, usize); n],
    }

    let mut dp = vec![0usize; h+1];
    
    for i in 1..=h {
        let mut min = None;
        for &(a, b) in ab.iter() {
            if i < a {
                if let Some(v) = min {
                    if v > b {
                        min = Some(b);
                    }
                } else {
                    min = Some(b);
                }
            } else {
                let cost = dp[i-a] + b;
                if let Some(v) = min {
                    if v > cost {
                        min = Some(cost);
                    }
                } else {
                    min = Some(cost);
                }
            }
        }
        if let Some(min) = min {
            dp[i] = min;
        } else {
            unreachable!();
        }
    }

    println!("{}", dp[h]);
}

Measured memory_bytes: 2276
#include <stdio.h>
#include <stdlib.h>
#define MAX 2000001
#define VMAX 10000

int main() {
  unsigned short *A, *B;
  
  int C[VMAX+1];
  int n, i, j;
  scanf("%d", &n);

  A = malloc(sizeof(short)*n+1);
  B = malloc(sizeof(short)*n+1);

  for(i=0;i<=VMAX;i++) C[i]=0;
  
  for(i=0;i<n;i++)
    {
      scanf("%hu",&A[i+1]);
      C[A[i+1]]++;
    }

  for(i=1;i<=VMAX;i++)
    {
      C[i]=C[i]+C[i-1];
    }
  for(j=1;j<=n;j++)
    {
      B[C[A[j]]]=A[j];
      C[A[j]]--;
    }
  for(i=1;i<=n;i++)
    {
      if(i>1)
	printf(" ");
      printf("%d",B[i]);
    }
  printf("\n");

  return 0;
}



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

int main()
{
    int x1,x2,y1,y2;
    int x,y;
    cin >> x1 >> y1 >> x2 >> y2;
    x = x2 -x1;
    y = y2 - y1;

    cout << x2 - y << " "<<y2 + x << " "<< x1 - y << " "<< y1+x;
}


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

string s, t, u;
map<string, int> cnt;
int ans;

void in();
void solve();
void out();

int main(){
    in();
    solve();
    out();
}

void in(){
    ios::sync_with_stdio(false);
    cout.tie(0);
    cin.tie(0);
    cin >> s >> t;
    cin >> cnt[s] >> cnt[t];
    cin >> u;
}

void solve(){
    cnt[u]--;
}

void out(){
    cout << cnt[s] << ' ' << cnt[t];
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define pb           push_back
#define pf           push_front
#define in           insert
#define ff           first
#define ss           second
#define mp           make_pair
#define int          long long
#define uint         unsigned long long
#define rep(i,x,m)   for(int i=x;i<m;i++)
#define repr(i,x,m)  for(int i=x;i>=m;i--)
#define MOD          1000000007
#define endl         "\n"
#define all(v)       v.begin(),v.end()
#define rall(v)      v.rbegin(),v.rend()
#define vi           vector<int>
#define vs           vector<string>
#define pi           pair<int,int>
#define di           deque<int>
#define sz(x)       (int)x.size()
#define pq           priority_queue<int>
#define pqs          priority_queue<int,vi,greater<int> >
#define fix(y)       fixed<<setprecision(y)
#define print(v)     for(int i=0;i<v.size();i++) cout<<v[i]<<" ";cout<<endl
#define noob         ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;

int fac[2000005]={0};
void factorial(){ fac[0]=1; fac[1]=1; for(int i=2;i<200005;i++) fac[i]=((i%MOD)*(fac[i-1]%MOD))%MOD;}
int power(int n,int m)
{int p=1;if(m==0)return 1;p=(power(n,m/2)%MOD);p=(p%MOD*p%MOD)%MOD;
return(m&1?((p%MOD*n%MOD)%MOD):(p%MOD));}
int ncr(int n,int r){return ((fac[n]*power(fac[r],MOD-2))%MOD*power(fac[n-r],MOD-2))%MOD;}

void ram5564()
{
    int n;
    cin>>n;
    int a[n][3];
    int dp[n][3];
    memset(dp,0,sizeof(dp));
    rep(i,0,n)
    {
        cin>>a[i][0]>>a[i][1]>>a[i][2];
    }

  dp[0][0]=a[0][0];
  dp[0][1]=a[0][1];
  dp[0][2]=a[0][2];
  rep(i,1,n)
  {
    rep(j,0,3)
    dp[i][j]=a[i][j]+max(dp[i-1][(j+1)%3],dp[i-1][(j+2)%3]);
  }
  int mx=-1;
  rep(i,0,3)
  mx=max(mx,dp[n-1][i]);
  cout<<mx;


}

signed main()
{
        noob
        // #ifndef ONLINE_JUDGE
        //  freopen("input.txt","r",stdin);
        //  freopen("output.txt","w",stdout);
        //  #endif   
        
        int t=1;
        //cin>>t;
        while(t--)
        ram5564();
        return 0;
}

Measured memory_bytes: 8264
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define INF 99999999

int main(){
  int n;
  cin >> n;
  ll ans = 1;
  ll num=1;
  for(int i=0;i<9;i++){
    num *= 10;
  }
  num += 7;
  vector<int> v(1001, 0);
  for(int i=2;i<=n;i++){
    int x = i, p=2;
    while (x != 1){
      if (x % p == 0){
        x /= p;
        v[p]++;
      }else{
        p++;
      }
    }
  }
  for(int i=2;i<=1000;i++){
    ans *= (v[i]+1);
    ans %= num;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
//#define in freopen("in.txt","r",stdin)
//#define out freopen("out.txt","w",stdout) 
ll n,m,k,t,l,r;
ll a,b,c,d;
char A,B,C,X,Y,Z;
ll ans,MAX,MIN,sum;
ll ax[1000000];
char str[100000];
ll dx[12];
ll bx[2000500];


int main()
{
    ll i,j;
    sum=0;
    t=1;
    //scanf("lld",&t);
    while(t--)
    {
        memset(ax,0,sizeof(ax));
        memset(bx,0,sizeof(bx));
        ll flag=0;
        cin>>n;
        for(i=1;i<=n;i++)
        {
            scanf("%lld",&a);
            if(i-a>=0)
                ax[i-a]++;
            if(i+a<=n)
                bx[i+a]++;
        }
        for(i=0;i<=n;i++)
        {
            sum+=ax[i]*bx[i];
        }
        printf("%lld\n",sum);
    }
	return 0;
}

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

using namespace std;

int main(void) {
  int n;
  while (cin >> n, n) {
    vector<int> T(n), H;
    vector<bool> used(2 * n + 1, false);
    for (int i = 0; i < n; i++) {
      cin >> T[i];
      used[T[i]] = true;
    }
    for (int i = 1; i <= 2 * n; i++) {
      if (used[i]) continue;
      H.push_back(i);
    }
    sort(T.begin(), T.end());
    sort(H.begin(), H.end());

    int pt = n, ph = n, turn = 1;
    vector<bool> usedT(n, false), usedH(n, false);
    while (true) {
      int pre = 0;
      while (true) {
        bool none = true;
        if (turn > 0) {
          for (int i = 0; i < n; i++) {
            if (usedT[i] || T[i] < pre) continue;
            usedT[i] = true;
            pre = T[i];
            ph--;
            none = false;
            break;
          }
        } else {
          for (int i = 0; i < n; i++) {
            if (usedH[i] || H[i] < pre) continue;
            usedH[i] = true;
            pre = H[i];
            pt--;
            none = false;
            break;
          }
        }
        if (pt * ph == 0 || none) break;
        turn *= -1;
      }
      if (pt * ph == 0) break;
      turn *= -1;
    }

    cout << pt << endl;
    cout << ph << endl;
  }

  return 0;
}


Measured memory_bytes: 3080
#include<stdio.h>
int main(void) {
   int n, w[100], k, i;
   while ( scanf("%d", &n) != EOF ) {
       k = 512;
       i = 1;
       while ( k ) {
           if ( n / k != 0 ) {
               w[i] = k;
               i++;
               n = n % k;
           }           
           k /= 2;
           /*printf("k:%d n:%d ", k, n);*/
       }
       /*printf("\n");*/
       /*if ( n / k != 0 ) {
           w[i] = n / k;
           i++;
        } */ 
       i--;
       printf("%d", w[i]);
       i--;
       while( i ) {
           printf(" %d", w[i]);
           i--;
       }
       printf("\n");
   }
   return 0;
}

Measured memory_bytes: 1688
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(n) begin(n), end(n)
using ll = long long;
using namespace std;

int main(){
	string a, b, c;
	cin >> a >> b >> c;
	a[0] = toupper(a[0]);
	b[0] = toupper(b[0]);
	c[0] = toupper(c[0]);
	cout << a[0] << b[0] << c[0] << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <stack>
#include <queue>
#include <functional>
#include <set>
#include <map>
#include <tuple>
#include <bitset>
#include <random>
#define REP(i,n) for(int i=0;i<n;i++)
#define INF 100000000000007
using namespace std;
using pii=pair<int,int>;
using LL=int64_t;

int main(){
    int n;
    LL k;
    cin>>n>>k;
    
    
    vector<int> to(n+1);
    vector<bool> is_reached(n+1,false);
    int loop_start;

    
    
    REP(i,n){
        int a;
        cin>>a;
        to.at(i+1)=a;

    }
    is_reached.at(1)=true;
    int now1=1;
    for(int i=1;i<=n;i++){
        
        int next=to.at(now1);
        if(is_reached.at(next)){
            loop_start=next;
            break;
        }
        is_reached.at(next)=true;
        
        now1=next;
    }


    now1=1;
    while(now1!=loop_start){
        if(k==0){
            cout<<now1<<endl;
            return 0;
        }
        k--;
        now1=to.at(now1);
    }

    REP(i,n+1){
        is_reached.at(i)=false;
    }
    
    is_reached.at(loop_start)=true;
    int period=1;
    int next=to.at(loop_start);
    while(true){
        if(is_reached.at(next)){
            break;
        }
        
        is_reached.at(next)=true;
        next=to.at(next);
        period++;
    }

    int64_t step=k%period;
    int now=loop_start;
    /*cout<<loop_start<<endl;
    cout<<period<<endl;
    cout<<step<<endl;*/
    REP(i,step){
        now=to.at(now);
    }

    cout<<now<<endl;
    return 0;
}

Measured memory_bytes: 3644
a, b, c, d = map(int, input().split())

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

def lcm(a, b):
    return a * b // gcd (a, b)

print(b-a+1 - (b//c - (a-1)//c + b//d - (a-1)//d- (b//lcm(c, d) - (a-1)//lcm(c, d))))

Measured memory_bytes: 3060
import java.util.Comparator;
import java.util.PriorityQueue;
import java.util.Scanner;

//Cliff Climbing
public class Main{

	static int[][][] dist;
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int[][] leftMove = {{-2,-1},{-1,-1},{0,-1},{1,-1},{2,-1},{-1,-2},{0,-2},{1,-2},{0,-3}};
		int[][] rightMove = {{-2,1},{-1,1},{0,1},{1,1},{2,1},{-1,2},{0,2},{1,2},{0,3}};
		while(true){
			int w = sc.nextInt();
			int h = sc.nextInt();
			if((w|h)==0)break;
			char[][] m = new char[h][w];
			for(int i=0;i<h;i++)for(int j=0;j<w;j++)m[i][j]=sc.next().charAt(0);
			dist = new int[h][w][2];
			for(int i=0;i<h;i++)for(int j=0;j<w;j++)for(int k=0;k<2;k++)dist[i][j][k]=Integer.MAX_VALUE;
			PriorityQueue<int[]> q = new PriorityQueue<int[]>(h*w, new Comparator<int[]>() {
				public int compare(int[] o1, int[] o2) {
					return dist[o1[0]][o1[1]][o1[2]] - dist[o2[0]][o2[1]][o2[2]];
				}
			});
			for(int i=0;i<h;i++){
				for(int j=0;j<w;j++){
					if(m[i][j]=='S'){
						dist[i][j][0] = 0;
						dist[i][j][1] = 0;
						q.add(new int[]{i, j, 0});
						q.add(new int[]{i, j, 1});
					}
				}
			}
			int ans = -1;
			while(!q.isEmpty()){
				int[] a = q.poll();
				int i = a[0];
				int j = a[1];
				int foot = a[2];
				if(m[i][j]=='T'){
					ans = dist[i][j][foot];
					break;
				}
				//next movement is right side
				if(foot==0){
					for(int k=0;k<9;k++){
						int ni = i+rightMove[k][0];
						int nj = j+rightMove[k][1];
						if(0<=ni&&ni<h&&0<=nj&&nj<w&&m[ni][nj]!='X'){
							int v = dist[i][j][foot] + (Character.isDigit(m[ni][nj])?(int)(m[ni][nj]-'0'):0);
							if(v < dist[ni][nj][1]){
								dist[ni][nj][1] = v;
								q.add(new int[]{ni, nj, 1});
							}
						}
					}
				}
				else{
					for(int k=0;k<9;k++){
						int ni = i+leftMove[k][0];
						int nj = j+leftMove[k][1];
						if(0<=ni&&ni<h&&0<=nj&&nj<w&&m[ni][nj]!='X'){
							int v = dist[i][j][foot] + (Character.isDigit(m[ni][nj])?(int)(m[ni][nj]-'0'):0);
							if(v < dist[ni][nj][0]){
								dist[ni][nj][0] = v;
								q.add(new int[]{ni, nj, 0});
							}
						}
					}
				}
			}
			System.out.println(ans);
		}
	}
}

Measured memory_bytes: 0
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <stack>
#include <queue>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;

int main()
{
    int x[5];
    for (int i = 0; i < 5; ++i) cin >> x[i];
    for (int i = 0; i < 5; ++i)
    {
        if (x[i] == 0)
        {
            cout << i + 1 << endl;
            return 0;
        }
    }
    return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define ll              long long
#define pb              push_back
#define ppb             pop_back
#define endl            '\n'
#define mii             map<ll,ll>
#define pii             pair<ll,ll>
#define vi              vector<ll>
#define vs              vector<string>
#define all(a)          (a).begin(),(a).end()
#define F               first
#define S               second
#define sz(x)           (ll)x.size()
#define hell            1000000007
#define inf             (ll)1e18 + 5
#define PI              (double)3.14159265358979323844
#define DECIMAL(n)      cout << fixed << setprecision(n);
#define rep(i,a,b)      for (ll i=a;i<b;i++)
#define repr(i,a,b)     for (ll i=a-1;i>=b;i--)
#define bitcount(a)     (ll)__builtin_popcount(a)
#define lbnd            lower_bound
#define ubnd            upper_bound
#define mp              make_pair
#define ios             ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ordered_set     tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
#define trace(...)      __f(#__VA_ARGS__, __VA_ARGS__)

template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    std::cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');std::cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}

using namespace std;
using namespace __gnu_pbds;

/*----------------------Graph Moves----------------*/
//const int fx[]={+1,-1,+0,+0};
//const int fy[]={+0,+0,+1,-1};
//const int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};   // Kings Move
//const int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};  // Kings Move
//const int fx[]={-2, -2, -1, -1,  1,  1,  2,  2};  // Knights Move
//const int fy[]={-1,  1, -2,  2, -2,  2, -1,  1}; // Knights Move
/*------------------------------------------------*/

//primes for hashing 937,991,1013,1409,1741

void solve() {
    ll n;
    cin>>n;
    set <string > s;
    rep(i,0,n){
    	string x;
    	cin>>x;
    	s.insert(x);
    }
    cout<<sz(s)<<endl;
}

signed main() {
    ios
    ll test=1;
    //cin>>test;
    while (test--) solve();
    return 0;
}

Measured memory_bytes: 19244
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define whole(x) (x).begin(),(x).end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
using ll = long long;
using P = pair<int, int>;
const int mod = 1000000007;

vector<int> to[100005];

int main(){
    int n, m;
    cin >> n >> m;
    vector<int> h(n);
    rep(i, n) cin >> h[i];
    int ans = 0;
    
    rep(i, m) {
        int a, b;
        cin >> a >> b;
        a--; b--;
        to[a].emplace_back(b);
        to[b].emplace_back(a);
    }

    rep(i, n) {
        if (to[i].size()==0) {
            ans++;
            continue;
        }
        bool flg = true;
        for (int e: to[i]) {
            if (h[i]<=h[e]) flg = false;
        }
        if (flg) ans++;
    }

    
    
    
    
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 8752
using System;

namespace ABC133
{
    class A
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            int N = int.Parse(input[0]);
            int A = int.Parse(input[1]);
            int B = int.Parse(input[2]);

            if (N * A <= B)
            {
                Console.WriteLine(N * A);
            }
            else
            {
                Console.WriteLine(B);
            }
        }
    }
}


Measured memory_bytes: 13140
package main

import(
	"fmt"
)

func main() {
	var n int
	var s string
	var ac, wa, tle, re int
	fmt.Scanf("%d", &n)
	
	for i := 0; i < n; i++ {
		fmt.Scanf("%s", &s)
		if (s == "AC") {
			ac++
		} else if (s == "WA") {
			wa++
		} else if (s == "TLE") {
			tle++
		} else {
			re++
		}
	}

	fmt.Printf("AC x %d\n", ac)
	fmt.Printf("WA x %d\n", wa)
	fmt.Printf("TLE x %d\n", tle)
	fmt.Printf("RE x %d\n", re)
}

Measured memory_bytes: 6328
#include<bits/stdc++.h>
using namespace std;
#define ll long long int 
#define lmin LONG_MIN
#define lmax LONG_MAX
#define imin ll_MIN
#define imax ll_MAX
#define ffor(i,a,b) for(i=a;i<b;i++)
#define bfor(i,a,b) for(i=a-1;i>=b;i--)
#define mset(f,a) memset(f,a,sizeof(f))
#define pb push_back
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define MAXN   10000009


ll mod = 1e9 +7;



int main() 
{
    ll t=1,temp;
    //cin>>t;
    ffor(temp,0,t)
    {
        fastio;
        string a,b;
        cin>>a;
        cin>>b;
        ll h=b.size();
        ll i,j;
        ll ans=INT_MAX;
        
        ffor(i,0,a.size()-b.size()+1)
        {
            ll k=i,cnt=0;
            ffor(j,0,b.size())
            {
                if(a[k]==b[j])
                    cnt++;
                
                k++;    
            }
            //cout<<ans<<endl;
            ans=min(ans,h-cnt);
        }
        cout<<ans<<endl;
        
    }
      
    
}


Measured memory_bytes: 3620
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
using namespace std;
int a[200008];
int main() {
    int n;
    cin >> n;
    for (int i=0; i<n; i++) {
        cin >> a[i];
    }
    sort(a, a+n);
    for (int i=1; i<n; i++) {
        if(a[i]==a[i-1]){
            cout << "NO";
            return 0;
        }
    }
    cout << "YES";
    return 0;
}


Measured memory_bytes: 1024
#include<iostream>
using namespace std;
static const long long int MAX = 1000000000; 
int main()
{
    int A, B, K, d;
    cin >> A >> B >> K;
    d = ((B - K + 1) - (A + K - 1) > 0)?  +1 : -1; 
    if (d == +1)
    {
        for (int i = A; i < A + K; i++)
        {

            cout << i << endl;
        }
        for (int i = B - K + 1; i <= B; i++)
        {
            cout << i << endl;
        }
    }
    if (d == -1)
    {
        for (int i = A; i <= B; i++)
        {
            cout << i << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
   int N;
   int K;
   cin>>N>>K;
   int sum=0;
   int l[N];
   for(int i=0; i<N; i++){
       cin>>l[i];
   }
sort(l,l+N);
reverse(l, l+N);

 for(int j=0; j<K; j++){
        
        sum=sum+l[j];
    }
    cout<<sum<<endl;
    return 0;
}



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


vector<int>vab;
vector<int>vba;
string s;
int main()
{
    cin>>s;
    bool yes=true;
    for(int i=0;i<s.size();i++)
    {
        if(i%2==0&&s[i]=='L')
            yes=false;
        if(i%2==1&&s[i]=='R')
            yes=false;
    }
    if(yes)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
    return 0;
}
/*
10
16 7
15 15
12 14
2 5
3 9
1 10
14 14
4 6
*/


Measured memory_bytes: 256
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <bitset>
#include <list>
#include <stdexcept>
#include <functional>
#include <utility>
#include <ctime>
#include <random>
#include <cassert>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
#define MEM(a,b) memset((a),(b),sizeof(a))
const LL INF = 1e9 + 7;
const int N = 1e5 + 10;

int main()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	int a, b;
	cin >> a >> b;
	if (a >= 13) cout << b << endl;
	else if (a >= 6) cout << b / 2 << endl;
	else cout << 0 << endl;
	return 0;
}

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

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define pi acos(-1.0)

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;


int n, m;
vector<int> v[9];
bool searched[9] = {};
int ans = 0;

bool all_searched(){
    FOR(i, 1, n){
        if(!searched[i]) return false;
    }
    return true;
}


int dfs(int vertex){
    searched[vertex] = true;
    if(all_searched()){
        searched[vertex] = false;
        return 1;
    }
    int sum = 0;
    for(auto &adj : v[vertex]){
        if(searched[adj]) continue;
        sum += dfs(adj);
        searched[adj] = false;
    }
    return sum;
}


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n >> m;
    REP(i, m){
        int a, b;
        cin >> a >> b;
        v[a].push_back(b);
        v[b].push_back(a);
    }

    cout << dfs(1) << "\n";
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

main()
{
  int length, i, j, tmp, count = 0;
  int A[100];

  scanf("%d", &length);

  for(i = 0; i < length; i++)
    {
      scanf("%d", &A[i]);
    }

  for(i = 0; i < length; i++)
    {
      for(j = length - 1; j >= i + 1; j--)
	{
	  if(A[j] < A[j - 1])
	    {
	      tmp = A[j];
	      A[j] = A[j - 1];
	      A[j - 1] = tmp;
	      count++;
	    }
	}
    }
  for(i = 0; i < length; i++)
    {
      if(i == length - 1)
	{
	  printf("%d\n", A[i]);
	}
      else
	{
	  printf("%d ", A[i]);
	}
    }
  printf("%d\n", count);
  return 0;
}

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

int main(){
  string s;
  cin>>s;
  reverse(s.begin(),s.end());
  int n=s.size();
  int ans=0;
  vector<int> rs(n+1);
  rs[0]=0;
  int tmp=1;
  rep(i,n){
    rs[i+1]=(rs[i]+(int)(s[i]-'0')*tmp)%2019;
    tmp=tmp*10%2019;
  }
  map<int,int> mp;
  for(auto x : rs){
    mp[x]++;
  }
  for(auto x : mp){
    ans+=(x.second)*(x.second-1)/2;
  }
  cout<<ans<<endl;
}

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

int main() {
  int n;
  cin >> n;
  deque<int> b;
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    if (i % 2 == 1) b.push_front(a);
    else b.push_back(a);
  }
  if (n % 2 == 1) {
    for (int i = 0; i < n-1; i++) {
      cout << b.back() << " ";
      b.pop_back();
    }
    cout << b.back() << endl;
  }
  else {
    for (int i = 0; i < n-1; i++) {
      cout << b.front() << " ";
      b.pop_front();
    }
    cout << b.front() << endl;
  }
}

Measured memory_bytes: 2944
#include<iostream>
#include<cmath>

using namespace std;

int main(){
    long long a,b,c;
    
    cin >> a >> b >> c;

    if(c-a-b > 0 && 4*a*b<(c-a-b)*(c-a-b)){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
/*
    if(sqrt(a) + sqrt(b) < sqrt(c)){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
*/
    return 0;
}

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

using namespace std;
using ll = long long;
const ll MOD = 1e9 + 7;

int main() {
    int N;
    cin >> N;
    bool ans = 0;
    int sum = 0;
    for(int i = 0; i < N; i++) {
        int A, B;
        cin >> A >> B;

        if(A == B) {
            sum++;
        } else {
            sum = 0;
        }
        if(sum == 3) {
            ans = 1;
            break;
        }
    }

    if(ans) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }



    return 0;
}

Measured memory_bytes: 3620
/*input
1
1
50
*/
#include <bits/stdc++.h>
using namespace std;

#define pb push_back
#define f first
#define s second
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long
int const mod = 1e9+7;
int power(int x, int y, int mod = 2e18){ int ans = 1;x %= mod;while(y){if(y&1)ans = (x * ans) % mod;x = (x * x) % mod;y >>= 1;}return ans;}
int gcd(int a , int b){if(a==0)return b;return gcd(b%a,a);}
int a[21];
int b[21];
int n;
int final_ans = 0 ;
void solve(int  i,int j,int k){
  if(i == n){
    final_ans = max(final_ans,j-k);
    return;
  }
  solve(i+1,j+a[i],k+b[i]);
  solve(i+1,j,k);
}
signed main() {
  IOS;
  
  cin>>n;
  
  for(int i=0;i<n;i++)cin>>a[i];
  for(int i=0;i<n;i++)cin>>b[i];
 solve(0,0,0);
  cout << final_ans;
return 0;
}

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

using namespace std;

typedef long long ll;

const ll M = 2e18;
ll T;
ll n, a, b, c, d;
map<ll, ll> ma;

ll f(ll p)
{
    if(ma[p]) return ma[p];
    if(p == 1) return d;
    if(p == 0) return 0;
    ll re = 4e18;
    re = min(re, a + f(p / 2) + p % 2 * d);
    if(p > 2) re = min(re, a + f(p / 2 + 1) + (2 - p % 2) * d);
    re = min(re, b + f(p / 3) + p % 3 * d);
    re = min(re, b + f(p / 3 + 1) + (3 - p % 3) * d);
    re = min(re, c + f(p / 5) + p % 5 * d);
    re = min(re, c + f(p / 5 + 1) + (5 - p % 5) * d);
    if(M / p >= d) re = min(re, d * p);
    return ma[p] = re;
}

int main()
{
    scanf("%lld", &T);
    while(T--)
    {
        scanf("%lld%lld%lld%lld%lld", &n, &a, &b, &c, &d);
        ma.clear();
        printf("%lld\n", f(n));
    }
    return 0;
}


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

int main() {
    int a,b,c;
    cin>>a>>b>>c;
    if (b-a==c-b) cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>

int main(void) {
	int i;
	char a[11], b[11], c[11], al, bs, bl, cs;
	scanf("%s%s%s", &a, &b, &c);

	al = a[strlen(a) - 1];
	bs = b[0];
	bl = b[strlen(b) - 1];
	cs = c[0];
	
	if (al == bs && bl == cs) {
		printf("YES\n");
	}
	else {
		printf("NO\n");
	}
	return 0;
}

Measured memory_bytes: 128
import java.util.Arrays;
import java.util.Scanner;

//Baseball Championship
public class Main{

	static class T implements Comparable<T>{
		int id, w, l;
		char s;
		public T(int id, char s, int w, int l) {
			this.id = id;
			this.w = w;
			this.l = l;
			this.s = s;
		}
		public int compareTo(T o) {
			return w!=o.w?o.w-w:l!=o.l?l-o.l:id-o.id;
		}
	}

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while(true){
			int n = sc.nextInt();
			if(n==0)break;
			T[] t = new T[n];
			for(int i=0;i<n;i++){
				char s = sc.next().charAt(0);
				int w = 0;
				int l = 0;
				for(int j=0;j<n-1;j++){
					int x = sc.nextInt();
					w += x==0?1:0;
					l += x==1?1:0;
				}
				t[i] = new T(i, s, w, l);
			}
			Arrays.sort(t);
			for(int i=0;i<n;i++)System.out.println(t[i].s);
		}
	}
}

Measured memory_bytes: 12000
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <array>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <sstream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <list>
#include <numeric>
#include <stack>
#include <iomanip>
#include <random>
#include <complex>
#include <functional>
#include <tuple>

using namespace std;

#define Rep(i,a,b) for(ll i = a; i < b; ++i)
#define rep(i,b) Rep(i,0,b)
#define allof(a) (a).begin(), (a).end()

#define Yes(q) ((q) ? "Yes" : "No")
#define YES(q) ((q) ? "YES" : "NO")
#define Possible(q) ((q) ? "Possible" : "Impossible")
#define POSSIBLE(q) ((q) ? "POSSIBLE" : "IMPOSSIBLE")

using ll = long long;

constexpr int inf = 1e9 + 7;
constexpr ll infll = 1ll << 60ll;
constexpr ll mod = 1e9 + 7;
// 0~3までは右左下上 4~7までは斜め
constexpr int dx[] = { 1, 0, -1, 0, 1, 1, -1, -1 };
constexpr int dy[] = { 0, -1, 0, 1, 1, -1, -1, 1 };

namespace {
    template<typename T> void chmax(T& a, T b) { a = std::max(a, b); }
    template<typename T> void chmin(T& a, T b) { a = std::min(a, b); }
    template<typename T> void chadd(T& a, T b) { a = a + b; }

    void Cout(long long x, const char* end = "\n") { std::cout << x << end; }
    template <typename T> void Cout(const T& x, const char* end = "\n") { std::cout << x << end; }
    template <typename T> void Cout(const std::vector<T>& x, const char* sep = " ", const char* end = "\n") { for (std::size_t i = 0, sz = x.size(); i < sz; i++) { std::cout << x[i] << (i == sz - 1 ? end : sep); } }

    // 標準入出力
    struct inp {
        std::size_t sz;
        inp(std::size_t _sz = 1) : sz(_sz) {}
        template <typename T> operator T () const { T a; std::cin >> a; return a; }
        template <typename T> operator std::vector<T>() const { std::vector<T> a(sz); for (std::size_t i = 0; i < sz; i++) std::cin >> a[i]; return a; }
    };

    // 2次元用の標準入出力
    template<typename T>
    struct inpn {
        std::size_t szi, szj;
        inpn(std::size_t _szi, std::size_t _szj) : szi(_szi), szj(_szj) {}
        operator std::vector<std::vector<T>>() const {
            std::vector<std::vector<T>> a(szi, std::vector<T>(szj));
            for (std::size_t i = 0; i < szi; ++i)
                for (std::size_t j = 0; j < szj; ++j) cin >> a[i][j];
            return a;
        }
    };

    inp inp1; // input one
}

int main() {

    ll x = inp1;

    ll a = 100LL;

    ll ans = 0;

    while (a < x) {
        a += a / 100;
        ++ans;
    }

    Cout(ans);

    return 0;
}

Measured memory_bytes: 3636
n = int(input())
l = list(map(int,input().split()))
c= 0

for i in range(n):
  for j in range(n):
    for k in range(n):
      if l[i] + l[j] > l[k] and l[j]+l[k]>l[i] and l[k]+l[i]>l[j]  and i<j and j<k and l[i] != l[j] != l[k] != l[i]:
        c += 1

print(c)


Measured memory_bytes: 9184
#include<iostream>
#include<algorithm>
#include<string>
#include<cmath>

using namespace std;

int main(){

  int n;

  while(cin>>n, n){
    int a[40]={};
    for(int i=0;i<=n;i++){
      if(i==0) a[i]=1;
      if(i==1) a[i]=a[i-1];
      if(i==2) a[i]=a[i-1]+a[i-2];
      if(i>2) a[i]=a[i-1]+a[i-2]+a[i-3];
    }

    cout<<ceil((double)a[n]/10/365)<<endl;
  }

  return 0;
}



Measured memory_bytes: 3256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define INF 999999999
#define M_PI 3.14159265358979323846
const double eps = 1e-9;

#ifdef __LOCAL
    #define DBG(X) cout << #X << " = " << (X) << endl;
    #define SAY(X) cout << (X) << endl;
#else
    #define DBG(X)
    #define SAY(X)
#endif

#ifdef __LOCAL
    #include <filesystem>
    namespace fs = std::filesystem;
#endif

using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

int dx[]={1, 0, -1, 0, 0};
int dy[]={0, 1, 0, -1, 0};
const int INT_INF = (int)(2e9);
const ll  LL_INF = (ll)(2e18);
const int NIL = -1;
static mt19937 _g(time(nullptr));
 
std::string pad(int num){ char buffer[4]; std::snprintf(buffer, sizeof(buffer), "%03d", num); return buffer;}
inline ll randint(ll a, ll b) { ll w = (_g() << 31LL) ^ _g(); return a + w % (b - a + 1); }
inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T> inline T sign(T x) { return T(x > 0) - T(x < 0); }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const map<T, S> p) { for (auto el : p) cout << "[" << el.first << "," << el.second << "] "; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline T fetch() { T ret; cin >> ret; return ret; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }

int main()
{
    #ifdef __LOCAL
        fs::path path_to_file = __FILE__;
        fs::path input,output;
        input = output = path_to_file.parent_path();
        input += string("/input/") + string(path_to_file.stem()) + string(".txt");
        output += string("/output/") + string(path_to_file.stem()) + string(".txt");
        freopen(input.c_str(), "r", stdin);
        freopen(output.c_str(), "w", stdout);
    #endif

    int N;
    string S;
    int ans=1;
    cin >> N >> S;
    for(int i=0;i<N-1;i++)
        if(S[i]!=S[i+1])
            ans++;

    cout << ans << endl;

}


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

#define PI 3.14159265359
#define eps 1e-8
#define mp make_pair
#define pb push_back
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define FORN(i,a,b) for(int i=a;i<=b;i++)
typedef long long int ll;
const int INF = 1<<29;
typedef long long ll;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

int k,s;

int main(){
	ios_base::sync_with_stdio(false); //Fast I/O
	cin.tie(NULL);
	//freopen("in.txt","r",stdin);
	//freopen("output.txt","w",stdout);	
	
    cin >> k >> s;
    int cc=0;

    for(int i=0;i<=k;i++){
        for(int j=0;j<=k;j++){
            if(s-i-j>=0 && s-i-j<=k)
                cc++;
        }
    }

    cout << cc << endl;

	return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define fs first
#define sc second
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<char> vc;
typedef vector<tuple<ll,ll>> vtl;
typedef pair<ll, ll> l_l;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
#define pf(a) cout << (a) << endl;
#define be(x) (x).begin(),(x).end()
int n,ans;
string s;
void solve(){
    ll n,m,a,b;
    cin>>n>>m;
    ll cnt[200050]={0};
    rep(i,m){
      cin>>a>>b;
      if(a==1)cnt[b]++;
      if(b==n)cnt[a]++;
    }
    rep(i,200050){
      if(cnt[i]==2){
        cout<<"POSSIBLE"<<endl;
        return;
      }
    }
    cout<<"IMPOSSIBLE"<<endl;
}

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

Measured memory_bytes: 1792
#include<iostream>
using namespace std;
int main(){
    char a,b;
    cin >> a >> b;
    if(a=='H'){
        if(b=='H'){cout << 'H';}
        if(b=='D'){cout << 'D';}
    }
    else if(a=='D'){
        if(b=='H'){cout << 'D';}
        if(b=='D'){cout << 'H';}
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#include <iomanip>
#include <cstdlib>
#include <cmath>
using namespace std;

const int INF = 1e9;

int main(){
    int a, b;
    char o;
    cin >>a>>o>>b;
    if(o=='+')
        cout<<a+b<<endl;
    else
        cout<<a-b<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    char b;
    cin >> b;
    if(b == 'A')
    {
        cout << "T";
    }
    else if(b == 'T')
    {
        cout << "A";
    }
    else if(b == 'G')
    {
        cout << "C";
    }
    else
    {
        cout << "G";
    }
    
    return 0;
}

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

using namespace std;
using int64 = long long;

constexpr int DEBUG = 0;

constexpr int NUM_BITS = 60;

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

  int n;
  cin >> n;
  vector<int64> xs(n);
  for (int i = 0; i < n; i++) {
    cin >> xs[i];
  }

  int64 xor_all = 0;
  for (int64 x : xs) {
    xor_all ^= x;
  }

  for (int i = 0; i < n; i++) {
    xs[i] &= ~xor_all;
  }

  int c = 0;
  for (int b = NUM_BITS - 1; b >= 0; b--) {
    int pivot_i = -1;
    for (int i = c; i < n; i++) {
      if (xs[i] & (1L << b)) {
        pivot_i = i;
        break;
      }
    }

    if (pivot_i < 0) continue;

    swap(xs[pivot_i], xs[c]);

    for (int i = 0; i < n; i++) {
      if (i == c) continue;
      if (xs[i] & (1L << b)) {
        xs[i] ^= xs[c];
      }
    }

    c++;
  }

  int64 xor_all_2 = 0;
  for (int i = 0; i < n; i++) {
    xor_all_2 ^= xs[i];
  }
  cout << xor_all + xor_all_2 * 2 << endl;
}

Measured memory_bytes: 1024