akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define pi M_PI
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define REP(i,m,n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1000000007,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<int,int> P;

int n,a[111111],c[111111],ans;
vector<P> v[111111];

int dfs2(int x) {
  rep(i,v[x].size()) v[x][i]=P(dfs2(v[x][i].S),v[x][i].S);
  sort(all(v[x]),greater<P>());
  //rep(i,v[x].size()) v[x][i].F+=i;
  int M=0;
  rep(i,v[x].size()) M=max(M,v[x][i].F+i);
  return M+1;
}

void dfs(int x,int t) {
  //pr(x+1,t,t+c[x]);
  ans=max(ans,t+c[x]);
  rep(i,v[x].size()) {
    dfs(v[x][i].S,t+i+1);
  }
}

void Main() {
  R n;
  REP(i,1,n) {
    R a[i];
    a[i]--;
    c[a[i]]++;
  }
  REP(i,1,n) {
    v[a[i]].pb(P(0,i));
  }
  dfs2(0);
  //rep(i,n) {pr(i+1);rep(j,v[i].size()) pr(v[i][j].F,v[i][j].S+1);}
  dfs(0,0);
  pr(ans);
}

int main(){ios::sync_with_stdio(0);cin.tie(0);Main();return 0;}


Measured memory_bytes: 13056
#include <bits/stdc++.h>
typedef long long ll;
#define all(x) x.begin(),x.end()
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define mod 1000000007
#define all(x) x.begin(),x.end()
#define deb(x) cout<<#x<<" "<<x<<"\n";
#define cr7 ios_base::sync_with_stdio(false);cin.tie(NULL);
using namespace std;
int main() {
	cr7
	ll r;
	cin >> r;
	double d = (double)(6.28318530717958623200/2.00);
	//cout.precision(20+floor(log10(2*r) + 1));
	cout << (double)(2*(d)*r)<<"\n";
}

Measured memory_bytes: 3804
#!/usr/bin/env python3
import sys


def solve(A: int, B: int, N: int):
    def f(x):
        return A * x // B - A * (x // B)
    if B - 1 <= N:
        print(f(B - 1))
    else:
        print(f(N))
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    N = int(next(tokens))  # type: int
    solve(A, B, N)

if __name__ == '__main__':
    main()


Measured memory_bytes: 61900
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional>

#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define repi(i,a,b) for(int i = (a); i < (b); i++)

using namespace std;

typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;

const int INF=1<<29;
const double EPS=1e-9;

const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};
pii point[3010];
bool ex[5010][5010];
int main(){
	int n;
	while(cin>>n,n){
		if(n==0)break;
		rep(i,5010){
			rep(j,5010){
				ex[i][j]=false;

			}
		}
		memset(point, 0, sizeof(point));
		for(int i=0;i < n;i++){
			cin>>point[i].first>>point[i].second;
			ex[point[i].second][point[i].first]=true;
		}
		sort(point,point+n);
		/*rep(i,n){
			printf("(x,y) =(%d,%d)\n",point[i].first,point[i].second);
		}*/
			int ans =0;
			for(int i=0;i < n;i++){
				for(int j=0;j < n;j++){
					if(i==j)continue;
					int dx =abs(point[j].first-point[i].first);
					int dy =abs(point[j].second-point[i].second);
					int tmp =dx*dx+dy*dy;
					if(tmp<=ans)continue;
				/*printf("(x1,y1) =(%d,%d)\n",point[i].first,point[i].second);
				printf("(x2,y2) =(%d,%d)\n",point[j].first,point[j].second);
				printf("(dx,dy) = (%d,%d)\n",dx,dy);*/
				int nx1 =point[j].first+dy;
				int ny1 =point[j].second+dx;

				int nx2 =point[i].first+dy;
				int ny2 =point[i].second+dx;
				//
				int mnx1 =(point[j].first-dy);
				int mny1 =(point[j].second-dx);

				int mnx2 =(point[i].first-dy);
				int mny2 =(point[i].second-dx);
				/*printf("(nx1,ny1) =(%d,%d)\n",nx1,ny1);
				printf("(nx2,ny2) =(%d,%d)\n",nx2,ny2);
				printf("(mnx1,mny2) =(%d,%d)\n",mnx1,mny1);
				printf("(mnx1,mny2) =(%d,%d)\n",mnx2,mny2);
				cout <<endl;*/
				if(nx1<=5000&&ny1<=5000&&nx2<=5000&&ny2<=5000&&
				   ex[ny1][nx1]&&ex[ny2][nx2]){
					ans=max(ans,tmp);
				//cout <<ans<<endl;
				continue;
			}
			if(mnx1>=0&&mny1>=0&&mnx2>=0&&mny2>=0&&
			   ex[mny1][mnx1]&&ex[mny2][mnx2]){
				ans=max(ans,tmp);
		}
	}
}
cout <<ans<<endl;
}
return 0;
}

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

using namespace std;


int main() {
    int n, x;
    cin >> n >> x;
    vector<int> l(n);
    for(int i = 0; i < n; i++) {
        cin >> l[i];
    }
    int ans = 1;
    int counter = 0;
    for(int i = 0; i < n; i++) {
        counter += l[i];
        if(counter <= x ) {
            ans++;
        }
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 3576
#include <bits/stdc++.h>
#include <cstring>
#include <limits>
using namespace std;
#define ll long long int
#define lli long long int
#define fw(i, s, e) for (ll i = s; i < e; ++i)
#define fe(i, s, e) for (ll i = s; i <= e; ++i)
#define fb(i, e, s) for (ll i = e; i >= s; --i)
#define L(T)  \
    ll T;     \
    cin >> T; \
    while (T--)
#define FASTIO                   \
    ios::sync_with_stdio(false); \
    cin.tie(nullptr);            \
    cout.tie(nullptr);
#define mem(a, i) memset(a, i, sizeof(a))
#define ld long double
#define endl "\n"
#define in(P) \
    ll P;     \
    cin >> P;
int main()
{
    FASTIO
    // L(T)
    {
        in(a);
        cout<<a+a*a+a*a*a<<endl;
    }
    return 0;
}

Measured memory_bytes: 3652
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;

int main(){
	int A, B;
	cin >> A >> B;
	int T = 1;
	int count = 0;
	while (T < B) {
		T += A - 1;
		++count;
	}
	cout << count << endl;
}

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

int main(void)
{
  int a, b;
  cin >> a >> b;
  for(int i = 1; i < 1300; i++)
  {
    if((int)(i * 0.08) == a && (int)(i * 0.1) == b)
    {
      cout << i << endl;
      return (0);
    }
  }
  cout << -1 << endl;
}

Measured memory_bytes: 256
N = int(input())
blist = list(map(int,input().split()))
answer = []
current = []
flag = True
while flag:
    if len(blist) == 0:
        break
    if blist.index(max(blist)) + 1 < max(blist):
        flag = False
    else:
        current = [x for i, x in enumerate(blist) if x == i+1]
        current
        answer.append(blist.pop(max(current)-1))
if flag:
    for ans in answer[::-1]:
        print(ans)
else:
    print(-1)        

#まずbの最大値のインデックスが自身の値を超えていないか見る
#次にインデックスの一致する要素を取得，そのうちの最大のものを削除
#これを繰り返す

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

int main(){
  long long int h,n;
  cin>>h>>n;
  long long s=0;
  for(int i=0;i<n;i++){
    int x;
    cin>>x;
    s=s+x;
  }
  if(s>=h)
    cout<<"Yes\n";
  else
    cout<<"No\n";
}


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


using namespace std;

int main() {
	long long h,w;
	long long ans = 0;
	
	cin >> h >> w;
	
	if((h == 1) || (w == 1)) {
		cout << 1 << endl;
		return 0;
	}
	
	int half = (h+1) /2;
	ans = h*(w/2)+half*(w % 2);
	
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

//Istiyak Hossain

int main()
{
    int a, b;
    char ch;

    scanf("%d %c %d", &a, &ch, &b);

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



Measured memory_bytes: 2056
#include<iostream>
#include<vector>
#include<string.h>
using namespace std;

int polloc[200];

int main()
{
	for(int i=0;i<200;i++){
		polloc[i]=i*(i+1)*(i+2)/6;
	}
	int n;
	vector<int> ans1(1000001,-1);
	vector<int> ans2(1000001,-1);
	
	for(int i=0;i<200;i++){
		if(polloc[i]>1000000) break;
		ans1[polloc[i]]=1;
		if(polloc[i]%2==1)
			ans2[polloc[i]]=1;
	}

	for(int i=1;i<=1000000;i++){
		if(ans1[i]<0){
			ans1[i]=100000000;
			for(int k=0;k<200;k++){
				if(i-polloc[k]<0) break;
				ans1[i]=min(ans1[i],ans1[i-polloc[k]]+1);
			}
		}

		if(ans2[i]<0){
			ans2[i]=1000000000;
			for(int k=0;k<200;k++){
				if(polloc[k]%2==0) continue;
				if(i-polloc[k]<0) break;
				ans2[i]=min(ans2[i],ans2[i-polloc[k]]+1);
			}

		}

	}

	while(cin>>n){
		if(n==0) return 0;
		cout<<ans1[n]<<" "<<ans2[n]<<endl;
	}
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
struct edge { int to, cost; };
typedef pair<int, int>P;
#define M_PI 3.14159265359
#define deg_to_rad(deg) (((deg)/360)*2*M_PI)
#define rad_to_deg(rad) (((rad)/2/M_PI)*360)



int main(){
	double a,b,x,g,h,V;
  	cin >>a>>b>>x;
  	double mi=0,ma=M_PI/2,mid;
  	int flag=0;//溢れたら1
  	for(int i=0;i<=200;i++){
    	mid=(ma+mi)/2;
    	if(a*tan(mid)<=b){
        	V=(a*a*b)-(a*a*a*tan(mid)/2);
        	if(V<x){flag=1;}
        	else{flag=0;}
        }
    	else{
        	V=(a*b*b/2)/tan(mid);
          	if(V<x){flag=1;}
          	else{flag=0;}
        }
    	if(flag==1){ma=mid;}
    	if(flag==0){mi=mid;}
    }
  cout<<setprecision(10)<<mid*(double)180/M_PI<<endl;
  
  
}

Measured memory_bytes: 512
package main

import "fmt"

func main() {
	var a1, a2, a3 int
	fmt.Scan(&a1, &a2, &a3)
	
	if a1 + a2 + a3 > 21 {
		fmt.Println("bust")
	} else {
		fmt.Println("win")
		
	}
}


Measured memory_bytes: 512
#include <cstdio>
#include <bits/stdc++.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <cmath>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <map>
using ll = long long;
#define rep(i,n) for (ll i=0;i<n;i++)
using namespace std;


void solve(){

}
int main (){
    ios::sync_with_stdio(0);
    cin.tie(0);
    ll n;
    cin >> n;
    rep(i,n){
        cout << "ACL";
    }

    return 0;
}

Measured memory_bytes: 3640
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <stack>
#include <numeric>
#include <algorithm>
#include <tuple>
#include <stdio.h>
#include <bitset>
#include <limits.h>
#include <complex>
#include <deque>
#include <iomanip>
#include <list>
#include <cstring>
using namespace std;
#define pi pair<int,int>
#define pl pair<long long,long long>
#define chmax(a,b) (a<b ? a=b:0)
#define chmin(a,b) (a>b ? a=b:0)
#define en cout << endl //セミコロンつけろ
//#define MM 1000000000
//#define MOD MM+7
const int MM = 1e9;
const int MOD = MM+7;
const long double PI = acos(-1);
const long long INF = 1e15;
int dx[8] = {-1,0,1,0,-1,-1,1,1};
int dy[8] = {0,-1,0,1,-1,1,1,-1};
// 'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122
template<typename T>
T GCD(T u,T v){
    return v ? GCD(v,u%v) : u;
}
template<typename T>
T LCM(T x,T y){
    T gc = GCD(x,y);
    return x*y/gc;
}


struct UnionFind {
	vector<int> par, rank, cnt;
	UnionFind(int n) : par(n), rank(n, 0), cnt(n, 1){
		for(int i=0; i<n; ++i) par[i] = i;
	}
 
	int find(int x) {
		if (x == par[x]) return x;
		return par[x] = find(par[x]);
	}
 
	void unite(int x, int y) {
		x = find(x); y = find(y);
		if (x == y) return;
 
		if (rank[x] < rank[y]) swap(x, y);
 
		par[y] = x;
		cnt[x] += cnt[y];
		if (rank[x] == rank[y]) rank[x]++;
	}
 
	bool same(int x, int y) {
		return find(x) == find(y);
	}
 
	int size(int x) {
		return cnt[find(x)];
	}
};

const int COM_MAX = 500500;
long long fac[COM_MAX],finv[COM_MAX],inv[COM_MAX];
void init(){
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for(int i = 2; i < COM_MAX; i++){
        fac[i] = fac[i-1]*i%MOD;
        inv[i] = MOD - inv[MOD%i]*(MOD/i)%MOD;
        finv[i] = finv[i-1]*inv[i]%MOD;
    }
}
long long COM(int n,int k){
    if(n < k || n < 0 || k < 0) return 0;
    return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD;
}

int main(){
    long long N,M; cin >> N >> M;
    long long mx = 1;
    if (N == 1){
        cout << M << endl;
        return 0;
    }
    for (int i = 2; i * N <= M; i++){
        long long mm = M;
        mm -= i*N;
        if (mm % i == 0 || mm == 0){
            mx = i;
        }
    }
    cout << mx << endl;
}

Measured memory_bytes: 384
#include<iostream>
#include<algorithm>
#include<vector>
#include<cmath>
using namespace std;
int main() {
	int N;
	cin >> N;
	vector<int>W(N);
	int sum = 0;
	for (int i = 0; i < N; i++) {
		cin >> W[i];
		sum += W[i];
	}
	int Sum = 0;
	int min = 100000;
	for (int i = 0; i < N; i++) {
		Sum += W[i];
		if (min > abs(Sum - (sum - Sum))) {
			min = abs(Sum - (sum - Sum));
		}
	}
	cout << min << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
    char  a,b,c,d;
    cin>>a>>b>>c>>d;
    int e,r,t,y;
    e=a-48;
    r=b-48;
    t=c-48;
    y=d-48;
    if(e+r+t+y==7){cout<<e<<"+"<<r<<"+"<<t<<"+"<<y<<"=7"<<endl;}
    else if(e-r+t+y==7){cout<<e<<"-"<<r<<"+"<<t<<"+"<<y<<"=7"<<endl;}
    else if(e+r-t+y==7){cout<<e<<"+"<<r<<"-"<<t<<"+"<<y<<"=7"<<endl;}
    else if(e+r+t-y==7){cout<<e<<"+"<<r<<"+"<<t<<"-"<<y<<"=7"<<endl;}
    else if(e-r-t+y==7){cout<<e<<"-"<<r<<"-"<<t<<"+"<<y<<"=7"<<endl;}
    else if(e+r-t-y==7){cout<<e<<"+"<<r<<"-"<<t<<"-"<<y<<"=7"<<endl;}
    else if(e-r+t-y==7){cout<<e<<"-"<<r<<"+"<<t<<"-"<<y<<"=7"<<endl;}
    else if(e-r-t-y==7){cout<<e<<"-"<<r<<"-"<<t<<"-"<<y<<"=7"<<endl;}

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <algorithm>
#include <iomanip>
#include <string.h>

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

typedef long long lint;

using namespace std;

int main(){
  int A,B;
  cin>>A>>B;
  cout<<A*B<<endl;
  return 0;
}


Measured memory_bytes: 3620
#include<iostream>
#include<string>
#include<algorithm>

using namespace std;

int main(){
    int A, B, C, X, Y, p;
    p = 0;

    cin >> A >> B >> C >> X >> Y;

    while(X > 0 && Y > 0){
        if(A+B < 2 * C){
            X -= 1; Y -= 1;
            p += A + B;
        }else{
            X -= 1; Y -= 1;
            p += 2 * C;
        }
    }

    while(1){
        if(X > Y){
            if(A > C*2){
                X-=1;
                p += 2 * C;
            }else{
                X -= 1;
                p += A;
            }
        }else if(Y > X){
            if(B > C*2){
                Y-=1;
                p += 2 * C;
            }else{
                Y -= 1;
                p += B;
            } 
        }else{
            break;
        }
    }

    cout << p << endl;

    return 0; 
}

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

using namespace std;

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

    vector<int> times(n);
    auto total = 0;

    for (auto &time : times) {
        cin >> time;
        total += time;
    }

    int drinks;
    cin >> drinks;

    for (auto i = 0; i < drinks; i += 1) {
        int index, new_time;
        cin >> index >> new_time;

        auto res = total - times[index - 1] + new_time;
        cout << res << "\n";
    }

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s1,s2;
  cin>>s1>>s2;
  reverse(s1.begin(),s1.end());
  if(s1.compare(s2)==0)
     cout<<"YES"<<endl;
  else
    cout<<"NO"<<endl;
  
}  

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

using namespace std;

int main() {
	int n,tmp,ans = 0;
	cin >> n;
	vector<int> a(n);
	for (int i = 0; i < n; i++)cin >> tmp, a[i] = tmp - 1;
	for (int i = 0; i < n; i++)ans += (a[a[i]] == i);
	cout << ans/2 << endl;
}

Measured memory_bytes: 640
#include <stdio.h>

int main(void)
{
	char num[1001];
	
	int a, sum;
	
	while(1){
		
		scanf("%s" ,num);
		
		if(num[0]=='0')break;
		
		sum = 0;
		
		for(a = 0;num[a]!='\0';a++){
			
			sum+=num[a]-'0';
			
		}
		
		printf("%d\n" ,sum);
		
	}
	return 0;

}

Measured memory_bytes: 536
using System;

class Program
{
    static void Main()
    {
        for (int i = 1; i > 0; i++)
        {
            string[] aopb = Console.ReadLine().Split(' ');
            int a = int.Parse(aopb[0]);
            string op = aopb[1];
            int b = int.Parse(aopb[2]);

            switch (op)
            {
                case "+":
                    Console.WriteLine(a + b);
                    break;
                case "-":
                    Console.WriteLine(a - b);
                    break;
                case "/":
                    Console.WriteLine(a / b);
                    break;
                case "*":
                    Console.WriteLine(a * b);
                    break;
                case "?":
                    i = -1;
                    break;
            }
        }
    }
}

Measured memory_bytes: 9092
N, Q = map(int,input().split())
S = input()
tmp_list = [[int(i) for i in input().split()] for i in range(Q)]

ac_place_list = [0]*N
num_ac = 0
for i in range(1, N):
    if S[i-1]=='A' and S[i]=='C':
        num_ac += 1
    ac_place_list[i] = num_ac

for i in range(Q):
    print(ac_place_list[tmp_list[i][1]-1]-ac_place_list[tmp_list[i][0]-1])


Measured memory_bytes: 24400
s = gets.chomp.freeze
n = s.length
# array_s = []

# s.length.times do |i|
#   array_s << s[i].to_i
# end

array_plus = (1..(n-1)).to_a

ans = s.to_i
array_plus.each do |plus_num|
  combination = (0..(n-2)).to_a.combination(plus_num).to_a
  ans_temp = 0

  # p combination

  combination.each_with_index do |comb, i|
    s_temp = "#{s}"
    k = 0
    # p "comb: #{comb}"
    (n-1).times do |j|
      if comb.include?(j)
        s_temp.insert(j+1+k, "+")
        k += 1
      end
    end

    array_s_temp = s_temp.split("+").map(&:to_i)
    array_s_temp.each do |ss|
      ans_temp += ss
    end

    # p s_temp
  end
  ans += ans_temp
end

puts ans


Measured memory_bytes: 14364
using namespace std;
#include<bits/stdc++.h>
#define BEGIN ios_base::sync_with_stdio(0);cin.tie(0);
#define END return EXIT_SUCCESS;
#define FOR(I,A,B) for((I)=(A);(I)<(B);(I)++)
#define REP(I,N) FOR((I),0,(N))
#define UP(I,A,B) for((I)=(A);(I)<=(B);(I)++)
#define DW(I,A,B) for((I)=(A);(I)>=(B);(I)--)
#define IN(P) cin>>(P)
#define IN2(P1,P2) cin>>(P1)>>(P2)
#define IN3(P1,P2,P3) cin>>(P1)>>(P2)>>(P3)
#define INS(I,N,V) REP((I),(N)) cin>>(V[I])
#define INS2(I,N,V1,V2) REP((I),(N)) cin>>(V1[I])>>(V2[I]);
#define INS3(I,N,V1,V2,V3) REP((I),(N)) cin>>(V1[I])>>(V2[I])>>(V3[I]);
#define OUT(P) cout<<(P)<<endl
#define OUT2(P1,P2) cout<<(P1)<<" "<<(P2)<<endl
#define OUT3(P1,P2,P3) cout<<(P1)<<" "<<(P2)<<" "<<(P3)<<endl
#define OUTS(I,N,V) REP((I),(N)) cout<<(V[i])<<endl
#define ALL(C) (C).begin(),(C).end()
#define RALL(C) (C).rbegin(),(C).rend()
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
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;}

string s[3];int i;
inline void solve(){
  INS(i,3,s);
  REP(i,3)cout<<s[i][0];
  cout<<endl;
}

int main(int argc,char**argv){
  BEGIN
  solve();
  END
}


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

#define REP(i, x, n) for (int i = x; i < (int)(n); i++)
#define rep(i, n) REP(i, 0, x);
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

using namespace std;

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

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

int main(void) {
  vector<int> s(3);
  for (int i = 0; i < 3; i++) {
    cin >> s[i];
  }
  sort(all(s));
  if (s[2] == (s[1] + s[0])) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	string s;
	cin >> s;
	int len = s.size();
	long long ans = 0, carry = 0;
	// int cnt = 0;
	for ( int i=len-1; i>=0; --i ) {
		// cnt += (s[i]-'0');
		bool flag = carry;
		int n = (s[i]-'0')+carry;
		// cout << "ans: " << ans << '\n';
		// cout << "n: " << n << '\n';
		if ( n > 9 ) {
			carry = n/10;
			n = n%10;
			// n %= 10;
			// carry = n/10;
		} else {
			carry = 0;
		}
		if ( n > 5 || (n == 5 && i > 0 && s[i-1] >= '5' ) ) {
			ans += (10-n);
			carry++;
		} else {
			ans += n;
		}
	}
	cout << ans+carry << '\n';
	return 0;
}

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

#define deb(x) cout << #x << " " << x << "\n";
#define fo(i, n) for(i=0; i<n; i++)
#define Fo(i, k, n) for(i=k; i<n; i++)
#define endl "\n"
#define ll long long
#define vi vector<int>

// memset(arr, value, size);

int main() {
#ifndef ONLINE_JUDGE
	freopen("input1.txt", "r", stdin);
	freopen("output1.txt", "w", stdout);
#endif
	ios::sync_with_stdio(0);
	cin.tie(0);

	int t, i = 0;
	cin >> t;
	if (t >= 400 && t <= 599) i = 8;
	else if (t >= 600 && t <= 799) i = 7;
	else if (t >= 800 && t <= 999) i = 6;
	else if (t >= 1000 && t <= 1199) i = 5;
	else if (t >= 1200 && t <= 1399) i = 4;
	else if (t >= 1400 && t <= 1599) i = 3;
	else if (t >= 1600 && t <= 1799) i = 2;
	else if (t >= 1800 && t <= 1999) i = 1;

	cout << i;
	return 0;
}

Measured memory_bytes: 3648
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
using namespace std;
int num[100][100];
int main() {
	//freopen("in","r",stdin);
	memset(num,0,sizeof(num));
	int n; cin>>n;
	for(int i=0;i<n;i++) {
		int a,b,c,d; cin>>a>>b>>c>>d;
		num[1+(a-1)*3+(b-1)][c] += d;
	}

	int k=1;
	for(int i=1;i<=15;i++) {
		for(int j=1;j<=10;j++) {
			if(i==4||i==8||i==12) {
				cout<<"####################";
				break;
			}
			else printf(" %d",num[k][j]);
		}
		if(i==4||i==8||i==12);
		else k++;
		cout<<endl;
	}
	return 0;
}


Measured memory_bytes: 3248
#include <bits/stdc++.h>
#define REP(i, a, n) for (long long i = (a); i < (long long)(n); ++i)
#define REPC(i, a, n) for (long long i = (a); i <= (long long)(n); ++i)
#define ALL(t) t.begin(), t.end()
#define RALL(t) t.rbegin(), t.rend()
#define MATINIT(type, row, col, init)                                          \
  vector<vector<type>>(row, vector<type>(col, init));
#define Yes(cond) cout << (cond ? "Yes" : "No") << endl;
#define YES(cond) cout << (cond ? "YES" : "NO") << endl;
using namespace std;
using LL = long long;
using ULL = unsigned long long;
template <class T> using VEC = std::vector<T>;
template <class T> using MAT = std::vector<std::vector<T>>;
void DUMP() { cerr << endl; }
template <class Head, class... Tail> void DUMP(Head &&head, Tail &&... tail) {
  cerr << head << ", ";
  DUMP(std::move(tail)...);
}
template <typename T> ostream &operator<<(ostream &os, vector<T> &vec) {
  os << "{";
  for (auto v : vec)
    os << v << ",";
  os << "}";
  return os;
}
template <typename T> ostream &operator<<(ostream &os, set<T> &s) {
  os << "{";
  for (auto p : s)
    os << p << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, map<T1, T2> &m) {
  os << "{";
  for (auto p : m)
    os << p << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, pair<T1, T2> p) {
  os << "[" << p.first << " " << p.second << "]";
  return os;
}

int main() {
  int X,Y,Z;
  cin>>X>>Y>>Z;
  swap(X,Y);
  swap(X,Z);
  cout<<X<<" "<<Y<<" "<<Z<<endl;

  return 0;
}


Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long int lli;
typedef unsigned long long int ulli;
typedef long double ld;
#define vec(s) vector

#define vvec(s) vector<vector
>
typedef vector<lli> vi;
typedef vector<vi> vvi;
typedef pair<lli, lli> pii;
#define rep(i, n) for (lli i = 0; i < (lli)(n); i++)
#define Yes(x) cout << (x ? "Yes" : "No") << endl;
#define YES(x) cout << (x ? "YES" : "NO") << endl;
#define out(s) cout << s << endl;
#define Reverse(x) reverse(all(x));
#define Sort(x) sort(all(x));
#define pb(s) push_back(s);
#define sp " "
#define INF 10000000000
#define LINF 9000000000000000000
#define all(s) s.begin(), s.end()
void vout(vi v)
{
    for (lli i = 0; i < v.size(); i++)
        cout << v.at(i) << endl;
}

vector<lli> par(2000000);  /*親*/
vector<lli> Rank(2000000); /*根の深さ*/
vi num(2000000, 0);
/*n要素で初期化*/
void init(lli n)
{
    for (lli i = 0; i < n; i++)
    {
        par[i] = i;
        Rank[i] = 0;
        num[i] = 1;
    }
}
/*木の根を求める*/
lli find(lli x)
{
    if (par[x] == x)
    { /*親が自分自身＝根*/
        return x;
    }
    else
    {
        return par[x] = find(par[x]); /*一つ上の階層へ*/
    }
}
/*ｘとｙの集合を併合*/
void unite(lli x, lli y)
{
    x = find(x);
    y = find(y);
    /*根を求める*/
    if (x == y)
        return; /*同じ集合に属していたら終了*/
    if (Rank[x] < Rank[y])
    {
        par[x] = y;
        num[x] += num[y];
        num[y] = num[x];
    }
    else
    {
        par[y] = x;
        num[y] += num[x];
        num[x] = num[y];
        if (Rank[x] == Rank[y])
            Rank[x]++;
    }
}
/*同じ集合に属するか調べる*/
bool same(lli x, lli y)
{
    return find(x) == find(y);
}
/*利用方法はparのそれぞれの要素に対応させる形で別の配列を用意し、そこに入力する。*/

//入力par,Rankの配列数にノードの最大数を入力(max_v)
//使用時、初期化を忘れずに！init
int main()
{
    cout << std::fixed << std::setprecision(10);
    lli n, m;
    cin >> n >> m;
    init(n);
    rep(i, m)
    {
        lli a, b;
        cin >> a >> b;
        a--;
        b--;
        unite(a, b);
    }
    lli ans = 0;
    rep(i, n)
    {
        ans = max(ans, num[i]);
    }
    out(ans);
}

Measured memory_bytes: 50068
def count_power_of_2(x):
    cnt = 0
    while x % 2 == 0:
        x //= 2
        cnt += 1
    return cnt


def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(b, a % b)


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


def main():
    N, M = map(int, input().split())
    a = map(int, input().split())
    *a, = map(lambda x: x >> 1, a)

    power = count_power_of_2(a[0])

    if any(count_power_of_2(x) != power for x in a):
        print(0)
        return

    common = 1 << power

    base = common
    for x in a:
        x //= common
        base = lcm(base, x)

    ret = (M // base) - (M // (base * 2))
    print(ret)
    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 14244
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a) for(int i = 0; i < (a); i++)
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;

int main(){
	int n;
	cin >> n;
	string s[n],t[n];
	int p[n];
	REP(i,n){
		cin >> s[i] >> p[i];t[i] = s[i];
	}
	sort(t, t + n);
	REP(i,n){
		int max = 0;
		REP(j,n){
			if(t[i] == s[j]){
				if(p[j] > max) max = p[j];
			}
		}
		REP(j,n){
			if(t[i] == s[j] && p[j] == max){
				cout << j + 1 << endl;
				p[j] = -1;
			}
		}
	}
}

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

int main(){
    int n;
    cin >> n;
    long long l[n+1];
    l[0] = 2;
    l[1] = 1;
    for(int i=2;i<=n;i++){
        l[i] =l[i-1]+l[i-2]; 
    }
    cout << l[n] << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define PB push_back
#define MP make_pair
#define sz(v) (in((v).size()))
#define forn(i,n) for(in i=0;i<(n);++i)
#define forv(i,v) forn(i,sz(v))
#define fors(i,s) for(auto i=(s).begin();i!=(s).end();++i)
#define all(v) (v).begin(),(v).end()
using namespace std;
typedef long long in;
typedef vector<in> VI;
typedef vector<VI> VVI;
#define ll long long
void no(){
  cout<<"NO"<<endl;
  exit(0);
}
VI a,df;
int main(){
  ios::sync_with_stdio(0);
  cin.tie(0);
  in n;
  cin>>n;
  in sm=0;
  a.resize(n);
  forn(i,n){
    cin>>a[i];
    sm+=a[i];
  }
  in tr=n*(n+1)/2;
  if(sm%tr)
    no();
  sm/=tr;
  df=a;
  forn(i,n){
    df[i]-=a[(i+n-1)%n];
    df[i]-=sm;
    if(df[i]>0)
      no();
    if((-df[i])%n)
      no();
  }
  cout<<"YES"<<endl;
  return 0;
}


Measured memory_bytes: 1792
#include <stdio.h>

#define YES 0
#define NO 1

int main(void){
  char grid[51][52];
  int h,w;
  int i,j;
  int judge = YES;
  
  scanf("%d %d\n",&h,&w);
  
  /* Init */
  for( i=0; i<51; i++) for( j=0; j<51; j++){
      grid[i][j] = '.';
  }
  
  for( i=1; i<=h; i++) for( j=1; j<=w+1; j++){
      scanf("%c",&grid[i][j]);
  }
  
  //Delete NULL
  for( i=0; i<=h; i++) grid[i][w+1] = '.';
  
  for( i=1; i<=h; i++) for( j=1; j<=w; j++){
      if( grid[i][j] == '#' &&
          grid[i-1][j] == '.' &&
          grid[i+1][j] == '.' &&
          grid[i][j-1] == '.' &&
          grid[i][j+1] == '.' ) judge = NO;
  }
    
  (judge == YES) ? printf("Yes\n") : printf("No\n") ;
  
  return 0;
}
    
    
  
  

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

const long long INF = 1000010000;

int main() {
	int n, w;
	cin >> n >> w;
	int data[110][2];
	for(int i=1; i<=n; i++){
		cin >> data[i][0] >> data[i][1];
	}
	long long dp[110][100100];
	for(int i=0; i<110; i++){
		for(int j=0; j<100100; j++){
			dp[i][j] = INF;
		}
	}
	dp[0][0] = 0;
	for(int i=1; i<=n; i++){
		for(int j=0; j<=100000; j++){
			dp[i][j+data[i][1]] = min(dp[i][j+data[i][1]], dp[i-1][j]+data[i][0]);
			dp[i][j] = min(dp[i][j], dp[i-1][j]);
		}
	}
	long long ans = 0;
	for(int i=100000; i>=0; i--){
		if(dp[n][i] <= w){
			ans = i;
			break;
		}
	}
	cout << ans << endl;
}



Measured memory_bytes: 86272
#include <iostream>
#include <cassert>
#include <limits>
#include <cmath>
#include <algorithm>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <string>
#include <array>
#include <map>
#include <set>
#include <deque>
#include <list>
#include <sstream>
#include <iomanip>
#include <numeric>
#include <climits>
#include <cstring>
#include <bitset>
#include <stack>
#include <queue>

#define MOD (1e9 + 7);
#define PI (3.14159265358979323846)

using ll = int64_t;
using ull = uint64_t;

using namespace std;

[[maybe_unused]] static auto __x = [](){ios_base::sync_with_stdio(0); cin.tie(0);};

int main() {
    ull x;
    cin >> x;

    int year{};
    ull current{100};
    while (current < x) {
        current += current / 100;
        ++year;
    }
    cout << year;

    return 0;
}


Measured memory_bytes: 3612
#include<algorithm>
#include<complex>
#include<ctype.h>
#include<iomanip>
#include<iostream>
#include<map>
#include<math.h>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<stdio.h>
#include<string>
#include<string>
#include<vector>

using namespace std;
typedef long long ll;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ALL(v) (v).begin(), (v).end()
#define p(s) cout<<(s)<<endl
#define p2(s, t) cout << (s) << " " << (t) << endl
#define pn(s) cout << (#s) << " " << (s) << endl

const ll mod = 1e9 + 7;
const ll inf = 1e18;

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

    // input
    int A, B, C, X;
    cin >> A >> B >> C >> X;

    ll count = 0;
    FOR(i, 0, A+1){
        FOR(j, 0, B+1){
            FOR(k, 0, C+1){
                ll yen = 500 * i + 100 * j + 50 * k;
                if(yen == X){
                    count++;
                }
            }
        }
    }    

    p(count);
    
    return 0;
}

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


int main() {
    int N,n;
    int sum =0;
    cin >> N;
    n = N;
    
    while(n > 10){
        sum = sum + n%10;
        n = n /10;
    }
    sum = sum + n;

    if(N%sum==0){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    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(int i=0;i < (n);i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define SCANF(i) int i;scanf("%d",&i)
typedef long long ll;
using namespace std;
using P = pair<int,int>;
const long long INF = 1LL << 60;
const int IINF=100000000;
const int MOD = (int)1e9 + 7;
//約数列挙
vector<long long> divisor(long long n) {
    vector<long long> ret;
    for (long long i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            ret.push_back(i);
            if (i * i != n) ret.push_back(n / i);
        }
    }
    //sort(ret.begin(), ret.end()); // 昇順に並べる
    return ret;
}
vector<int> dx={1,0,-1,0};vector<int> dy={0,-1,0,1};

struct UF {
    vector<int>par;
    vector<int>cnt;
    UF(int x) : par(x),cnt(x){
        REP(i,x)par[i]=i,cnt[i]=1;
    }
    int root(int x){
        if(par[x]==x)return x;
        return par[x]=root(par[x]);
    }
    bool same(int x,int y){
        return root(x) == root(y);
    }
    void unite(int x,int y){
        if(x>y)swap(x,y);
        int rx = root(x);
        int ry = root(y);
        if(rx==ry)return ;
        par[ry] = rx;
        cnt[rx] += cnt[ry];
    }
    int deepth(int x){
        return cnt[x];
    }
};

signed main () {
    int n,m;
    cin >> n >> m;
    UF tree(n);
    REP(i,m){
        int a,b;cin >> a >> b;
        a--;b--;
        tree.unite(a,b);
    }
    int ans=0;
    REP(i,n){
        int ri = tree.root(i);
        int deep = tree.deepth(ri);
        ans=max(ans,deep);
    }
    cout << ans << endl;
}//https://atcoder.jp/contests/abc177/tasks/abc177_d

Measured memory_bytes: 5756
#include<cstdio>
#include<iostream>
#include<algorithm>
using namespace std;
void read(int &x) {
	char ch; bool ok;
	for(ok=0,ch=getchar(); !isdigit(ch); ch=getchar()) if(ch=='-') ok=1;
	for(x=0; isdigit(ch); x=x*10+ch-'0',ch=getchar()); if(ok) x=-x;
}
#define rg register
const int maxn=2e5+10,mod=1e9+7,N=4050,M=2010;
int n,a[maxn],b[maxn],s[N+10][N+10],fac[maxn],inv[maxn],ans;
int mul(int x,int y){return 1ll*x*y-1ll*x*y/mod*mod;}
int add(int x,int y){return x+y>=mod?x+y-mod:x+y;}
int del(int x,int y){return x-y<0?x-y+mod:x-y;}
int mi(int a,int b){
	int ans=1;
	while(b){
		if(b&1)ans=mul(ans,a);
		b>>=1,a=mul(a,a);
	}
	return ans;
}
int C(int n,int m){return mul(fac[n],mul(inv[n-m],inv[m]));}
int main(){
	read(n);fac[0]=inv[0]=1;
	for(rg int i=1;i<=n;i++)read(a[i]),read(b[i]),s[M-a[i]][M-b[i]]+=1;
	for(rg int i=1;i<=N<<1;i++)fac[i]=mul(fac[i-1],i);
	inv[N<<1]=mi(fac[N<<1],mod-2);
	for(rg int i=(N<<1)-1;i;i--)inv[i]=mul(i+1,inv[i+1]);
	for(rg int i=1;i<=N;i++)
		for(rg int j=1;j<=N;j++) 
			s[i][j]=add(s[i][j],add(s[i][j-1],s[i-1][j]));
	for(rg int i=1;i<=n;i++)ans=add(ans,del(s[M+a[i]][M+b[i]],C(2*(a[i]+b[i]),2*a[i])));
	printf("%d\n",mul(ans,mi(2,mod-2)));
}

Measured memory_bytes: 66176
import java.util.*;
import java.lang.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] b = new int[n-1];
        if(n==2){
            System.out.println((sc.nextInt() * 2));
            return;
        }
        for(int i = 0;i<(n-1);i++){
            b[i] = sc.nextInt();
        }
        int result = b[0] + b[n-2];
        for(int i = 0;i<(n-2);i++){
            if(b[i]<b[i+1]){
                result += b[i];
            }else{
                result += b[i+1];
            }
        }
        System.out.println(result);
        sc.close();
    }
}

Measured memory_bytes: 21332
import math
import numpy as np
from fractions import gcd
import fractions
import statistics
import collections
from functools import reduce
import itertools
from collections import defaultdict
import bisect
from fractions import Fraction

N = int(input())
P=list(map(int, input().split()))

min_num = P[0]

ans = 0
for i in range(N):
    if min_num >= P[i]:
        ans += 1
    min_num = min(P[i],min_num)

print(ans)

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

int main() {
  string s;
  cin >> s;
  map<char, int> mp;
  rep(i, s.size()) {
  	mp[s[i]]++;
  }

  bool flag = true;
  for(auto x : mp) {
    if(x.second%2 != 0) {
      flag = false;
      break;
    }
  }

  flag == true ? cout << "Yes" << endl : cout << "No" << endl;

  return 0;
}

Measured memory_bytes: 256
g=[[0]*5 for _ in[0]*5]
for i in range(9):
 e=input()
 for j in range(4+i%2):
  if int(e[j]):
   if i%2:g[i//2][j]+=4;g[i//2+1][j]+=1
   else:r=g[i//2];r[j]+=2;r[j+1]+=8
y,x=0,1
k=1
a=[1]
while 1:
 k+=2
 for _ in[0]*4:
  k+=1
  if g[y][x]&int(2**(k%4)):a+=[k%4];break
 if k%2:x+=1-2*((k%4)>1)
 else:y+=2*((k%4)>0)-1
 if x+y<1:break
print(''.join('URDL'[c]for c in a))


Measured memory_bytes: 5612
# abc158_a.py
# https://atcoder.jp/contests/abc158/tasks/abc158_a

# A - Station and Bus /
# 実行時間制限: 2 sec / メモリ制限: 1024 MB
# 配点 : 100点

# 問題文
# AtCoder 市には 3つの駅があり、1,2,3の番号がつけられています。
# これらの駅は、それぞれ鉄道会社A, Bのいずれかが管理しています。
# 管理状況は長さ 3の文字列 S で表され、駅 i は Siが A のとき鉄道会社 A が、B のとき鉄道会社 B が管理しています。
# 鉄道会社 A が管理している駅と、鉄道会社 B が管理している駅の間には、交通の便のためにバスを運行することになりました。
# 実際にバスが運行することになる駅の組み合わせが存在するかどうかを判定してください。

# 制約
#     Sは A または B から成る
#     |S|=3

# 入力
# 入力は以下の形式で標準入力から与えられる。
# S

# 出力
# バスが運行することになる駅の組み合わせが存在する場合は Yes を、存在しない場合は No を出力せよ。

# 入力例 1
# ABA

# 出力例 1
# Yes

# 駅 1,3は鉄道会社 A が、駅 2は鉄道会社 B が管理しています。
# 駅 1,2間と駅 2,3間でバスが運行するので、Yes を出力してください。

# 入力例 2
# BBA

# 出力例 2
# Yes

# 駅 1,2は鉄道会社 B が、駅 3は鉄道会社 A が管理しています。
# 駅 1,3間と駅 2,3間でバスが運行するので、Yes を出力してください。

# 入力例 3
# BBB

# 出力例 3
# No

# 駅は全て鉄道会社 B が管理しているので、バスは運行しません。よって No を出力してください。


global FLAG_LOG
FLAG_LOG = False


def log(value):
    # FLAG_LOG = True
    # FLAG_LOG = False
    if FLAG_LOG:
        print(str(value))


def calculation(lines):
    S = lines[0]
    # N = int(lines[0])
    # N, M = list(map(int, lines[0].split()))
    # values = list(map(int, lines[1].split()))
    # values = list(map(int, lines[2].split()))
    # values = list()
    # for i in range(N):
    #     values.append(int(lines[i]))
    # valueses = list()
    # for i in range(N):
    #     valueses.append(list(map(int, lines[i+1].split())))

    if S == 'AAA' or S == 'BBB':
        result = 'No'
    else:
        result = 'Yes'

    return [result]


# 引数を取得
def get_input_lines(lines_count):
    lines = list()
    for _ in range(lines_count):
        lines.append(input())
    return lines


# テストデータ
def get_testdata(pattern):
    if pattern == 1:
        lines_input = ['ABA']
        lines_export = ['Yes']
    if pattern == 2:
        lines_input = ['BBA']
        lines_export = ['Yes']
    if pattern == 3:
        lines_input = ['BBB']
        lines_export = ['No']
    return lines_input, lines_export


# 動作モード判別
def get_mode():
    import sys
    args = sys.argv
    global FLAG_LOG
    if len(args) == 1:
        mode = 0
        FLAG_LOG = False
    else:
        mode = int(args[1])
        FLAG_LOG = True
    return mode


# 主処理
def main():
    import time
    started = time.time()
    mode = get_mode()
    if mode == 0:
        lines_input = get_input_lines(1)
    else:
        lines_input, lines_export = get_testdata(mode)

    lines_result = calculation(lines_input)

    for line_result in lines_result:
        print(line_result)

    # if mode > 0:
    #     print(f'lines_input=[{lines_input}]')
    #     print(f'lines_export=[{lines_export}]')
    #     print(f'lines_result=[{lines_result}]')
    #     if lines_result == lines_export:
    #         print('OK')
    #     else:
    #         print('NG')
    # finished = time.time()
    # duration = finished - started
    # print(f'duration=[{duration}]')


# 起動処理
if __name__ == '__main__':
    main()


Measured memory_bytes: 9180
/*
Rectangle
Write a program which calculates the area and perimeter of a given rectangle.

Input
The length a and breadth b of the rectangle are given in a line separated by a single space.

Output
Print the area and perimeter of the rectangle in a line. The two integers should be separated by a single space.

Constraints
1 ≤ a, b ≤ 100
*/
#include <iostream>

using namespace std;

int main(){
	int a,b;
	cin>>a>>b;
	cout<<a*b<<" "<<2*(a+b)<<endl;
	
	return 0;
}


Measured memory_bytes: 3084
<?php
  
  fscanf(STDIN,"%d %d",$N,$K);

$monstars = explode(" ",trim(fgets(STDIN)));
sort($monstars);

for($i=0;$i<$K;$i++){
  array_pop($monstars);
}

$kougeki=0;
foreach($monstars as $monstar){
  $kougeki += $monstar;
}


echo $kougeki."\n";


Measured memory_bytes: 23200
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();
		if(a < 0){
			System.out.println(Math.abs(a)*c + d + b*e);
		}else{
			System.out.println((b-a)*e);
		}
	}
}

Measured memory_bytes: 26236
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#include <time.h>
#include <stack>
#include <array>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;

int main()
{
    int n, m;
	cin>>n>>m;
	int s=0;
	for(int i=0; i<m; i++){
		int a; cin>>a;
		s+=a;
	}
	if(s>n) cout<<-1<<endl;
	else cout<<n-s<<endl;
	return 0;
}


Measured memory_bytes: 3632
import math
inn = input().split()
a = int(inn[0])
b = int(inn[1])
x = int(inn[2])
if (a**2)*b/2 < x:
  print(math.degrees(math.atan(((a**2)*b-x)/((a**3)/2))))
else:
  print(math.degrees(math.atan((b**2)*a/(2*x))))

Measured memory_bytes: 3060
/* ???????????¨?????????????????? */

#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;

int n;
int m;
int as[1000][1000];
int dp[1000][1000];
char buf[10000];

int main() {
  while (1) {
    if (scanf("%s", buf) != 1) break;

    int cnt = 0;
    char *p = buf;
    int l = strlen(buf);
    while (p < buf+l) {
      char *next;
      long t = strtol(p, &next, 10);
      if (p == next) break;

      as[n][cnt] = t;
      p = next+1;
      ++cnt;
    }
    ++n;
    m = max(cnt, m);
  }

  dp[0][0] = as[0][0];
  for (int i=1; i<m; i++) {
    int lim = i+1;
    for (int j=0; j<lim; j++) {
      if (j-1 < lim-1) dp[i][j] = max(dp[i][j], dp[i-1][j-1] + as[i][j]);
      if (j < lim-1) dp[i][j] = max(dp[i][j], dp[i-1][j] + as[i][j]);
    }
  }

  for (int i=m; i<n; i++) {
    int lim = m+m-(i+1);
    for (int j=0; j<lim; j++) {
      if (j < lim+1) dp[i][j] = max(dp[i][j], dp[i-1][j] + as[i][j]);
      if (j+1 < lim+1) dp[i][j] = max(dp[i][j], dp[i-1][j+1] + as[i][j]);
    }
  }

  printf("%d\n", dp[n-1][0]);
}

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

using namespace std;
typedef long long ll;

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, a, b) for (int i = (a); i < (b); ++i)
#define all(a) (a).begin(), (a).end()
#define all2(a, b) (a).begin(), (a).begin() + (b)
#define debug(vari) cerr << #vari << " = " << (vari) << endl;

char *demangle(const char *demangle)
{
    int status;
    return abi::__cxa_demangle(demangle, 0, 0, &status);
}

int main()
{
    string s;
    cin >> s;
    int n = s.size();
    string m = "";
    rep(i, n) m += 'x';
    cout << m << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	string s;
	cin >> s;
	int ans=0;
	if(s[0]==s[s.size()-1])
	ans=1;
	ans=s.size()%2-ans;
	if(ans)
	cout << "First";
	else
	cout << "Second";
	return 0;
}

Measured memory_bytes: 512
import numpy as np


def main():
    N = int(input())
    towns = [input().split() for _ in range(N)]
    # 8 * 2
    towns = np.array(towns).astype(np.int64)
    # 8 * 1 * 2 - 1 * 8 * 2 = 8 * 8 * 2
    diffs = np.expand_dims(towns, axis=1) - np.expand_dims(towns, axis=0)
    # 8 * 8
    distances = np.sqrt(np.sum(diffs ** 2, axis=-1))
    # distance.mean() * N でもよさそう
    ans = distances.sum(axis=1).mean()
    print(ans)


if __name__ == '__main__':
    main()


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

const bool DEBUG = false;

int N;

void input() { cin >> N; }

int main(int argc, char const *argv[]) {
  input();
  int total = 0;

  for (size_t i = 0; i < 10; i += 2) {
    int base = (int)pow(10, i);
    if (base > N) {
      break;
    }
    total += min(N + 1, (int)pow(10, i + 1)) - base;
  }

  cout << total << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for (int i = 1; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define vout(x) rep(i,x.size()) cout << x[i] << " "
template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;return 1;}return 0;}
template<class T> bool chmax(T &a, T b) {if(a<b) {a=b;return 1;}return 0;}
using namespace std;
using vint = vector<int>;
using vvint = vector<vector<int>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<int,int>;
const int inf = 1e9+7;
const ll inf_l = 1e18;
const int MAX = 1e6;

int main() {
    int h, w, n; cin >> h >> w >> n;
    int y, x; cin >> y >> x;
    string s, t; cin >> s >> t;
    reverse(all(s));
    reverse(all(t));
    P l = P(1,1), r = P(h,w);
    rep(i,n) {
        if (t[i] == 'L') r.second = min(w,r.second+1);
        if (t[i] == 'R') l.second = max(1,l.second-1);
        if (t[i] == 'U') r.first = min(h,r.first+1);
        if (t[i] == 'D') l.first = max(1,l.first-1);
        if (s[i] == 'L') l.second++;
        if (s[i] == 'R') r.second--;
        if (s[i] == 'U') l.first++;
        if (s[i] == 'D') r.first--;
        // cout << l.first << l.second << endl;
        // cout << r.first << r.second << endl;
        // cout << endl;
        if (l.first > r.first) {cout << "NO" << endl; return 0;}
        if (l.second > r.second) {cout << "NO" << endl; return 0;}
    }
    if (l.first <= y && y <= r.first && l.second <= x && x <= r.second) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
}

Measured memory_bytes: 776
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cassert>
using namespace std;
static const int MAX_N = 1000000;

int n, k;
int a [MAX_N];

int b[MAX_N];
int deq[MAX_N];

void solve(){
  int s = 0, t = 0;

  for ( int i = 0; i < n; i++ ){
    while( s < t && a[deq[t - 1]] >= a[i] ) t--;
    deq[t++] = i;

    if ( i - k + 1 >= 0 ){
      b[i - k + 1] = a[deq[s]];

      if ( deq[s] == i - k + 1 ){
        s++;
      }
    }
  }

  for ( int i = 0; i <= n-k; i++ ){
    if ( i ) printf(" ");
    printf("%d", b[i]);
  }
  printf("\n");


}

main(){
  cin >> n >> k;
  for ( int i = 0; i < n; i++ ) scanf("%d", &a[i]);
  solve();

  return 0;
}

Measured memory_bytes: 14916