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

int main() {
    ll N;cin >> N;
    ll X[5] = {};
    ll mini = 1000000000000000;
    for (int i = 0;i < 5;i++){
        cin >> X[i];
        mini = min(mini,X[i]);
    }
    cout << (N + mini - 1) / mini + 4 << endl;
}

Measured memory_bytes: 256
sx, sy, tx, ty = map(int, input().split())

del_x = tx - sx
del_y = ty - sy
ans = 'U' * del_y + 'R' * del_x + 'D' * del_y + 'L' * (del_x + 1)
ans += 'U' * (del_y + 1) + 'R' * (del_x + 1) + 'DR' + 'D' * (del_y + 1) + 'L' * (del_x + 1) + 'U'
print(ans)

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

int main() {

  vector<int> S(2);
  cin >> S.at(0);
  S.at(1) = S.at(0)%100;
  S.at(0) /= 100;
  
  if(0<S.at(0) && S.at(0)<13){
    if(0<S.at(1)&& S.at(1)<13){ 
      cout << "AMBIGUOUS" << endl;
    }else{
      cout << "MMYY" <<endl;
    }
    
  }else{
    if(0<S.at(1)&&S.at(1)<13){
      cout << "YYMM" << endl;
    }else{
      cout << "NA" << endl;
    }
  }
}

Measured memory_bytes: 256
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

// 内部定数
#define D_STR_MAX		100000									// 最大文字列数

// 内部変数
static FILE *szpFpI;											// 入力
static char sc1Str[D_STR_MAX + 5];								// 文字列
static int siSLen;												// 文字列数

// 内部変数 - テスト用
#ifdef D_TEST
	static int siRes;
	static FILE *szpFpA;
#endif

// 改行カット
// 戻り値：文字数
int
fCutCrLf(
	char *pcpStr				// <I> 文字列
)
{
	int i;

	for (i = 0; pcpStr[i] != '\0'; i++) {
		if (pcpStr[i] == '\n') {
			pcpStr[i] = '\0';
			break;
		}
	}

	return i;
}

// 操作回数 - 取得
int
fGetCnt(
)
{
	// 開始・終了位置
	int liLNo = 0;
	int liRNo = siSLen - 1;

	// 両端から比較
	int liCnt = 0;
	while (liLNo < liRNo) {
		if (sc1Str[liLNo] == sc1Str[liRNo]) {		// 同一文字
			liLNo++;
			liRNo--;
		}
		else if (sc1Str[liLNo] == 'x') {			// 左側
			liLNo++;
			liCnt++;
		}
		else if (sc1Str[liRNo] == 'x') {			// 右側
			liRNo--;
			liCnt++;
		}
		else {										// 不可
			return -1;
		}
	}

	return liCnt;
}

// 実行メイン
int
fMain(
	int piTNo					// <I> テスト番号 1～
)
{
	char lc1Buf[1024], lc1Out[1024];

	// 入力 - セット
#ifdef D_TEST
	sprintf(lc1Buf, ".\\Test\\T%d.txt", piTNo);
	szpFpI = fopen(lc1Buf, "r");
	sprintf(lc1Buf, ".\\Test\\A%d.txt", piTNo);
	szpFpA = fopen(lc1Buf, "r");
	siRes = 0;
#else
	szpFpI = stdin;
#endif

	// 文字列 - 取得
	fgets(sc1Str, sizeof(sc1Str), szpFpI);

	// 文字列数 - 取得
	siSLen = fCutCrLf(sc1Str);

	// 操作回数 - 取得
	int liCnt = fGetCnt();

	// 結果 - セット
	sprintf(lc1Out, "%d\n", liCnt);

	// 結果 - 表示
#ifdef D_TEST
	fgets(lc1Buf, sizeof(lc1Buf), szpFpA);
	if (strcmp(lc1Buf, lc1Out)) {
		siRes = -1;
	}
#else
	printf("%s", lc1Out);
#endif

	// 残データ有無
#ifdef D_TEST
	lc1Buf[0] = '\0';
	fgets(lc1Buf, sizeof(lc1Buf), szpFpA);
	if (strcmp(lc1Buf, "")) {
		siRes = -1;
	}
#endif

	// テストファイルクローズ
#ifdef D_TEST
	fclose(szpFpI);
	fclose(szpFpA);
#endif

	// テスト結果
#ifdef D_TEST
	if (siRes == 0) {
		printf("OK %d\n", piTNo);
	}
	else {
		printf("NG %d\n", piTNo);
	}
#endif

	return 0;
}

int
main()
{

#ifdef D_TEST
	int i;
	for (i = D_TEST_SNO; i <= D_TEST_ENO; i++) {
		fMain(i);
	}
#else
	fMain(0);
#endif

	return 0;
}



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

typedef long long ll;

int main()
{
	int x, y, a, b, c;
	scanf("%d %d %d %d %d", &x, &y, &a, &b, &c);
	vector < ll > A(a), B(b), C(c);
	for (ll &x : A) scanf("%lld", &x);
	for (ll &x : B) scanf("%lld", &x);
	for (ll &x : C) scanf("%lld", &x);
	sort(A.begin(), A.end(), greater < ll >());
	sort(B.begin(), B.end(), greater < ll >());
	sort(C.begin(), C.end(), greater < ll >());
	priority_queue < ll, vector < ll >, greater < ll > > pq;
	ll sum = 0LL;
	for (int i=0; i<x; i++) {
		sum += A[i];
		pq.push(A[i]);
	}
	for (int i=0; i<y; i++) {
		sum += B[i];
		pq.push(B[i]);
	}
	int idx = 0;
	while (!pq.empty() && idx < c && pq.top() < C[idx])
	{
		sum += ll(C[idx] - pq.top());
		pq.pop();
		idx++;
	}
	printf("%lld\n", sum);
}

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

using namespace std;

template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;

int n;
V<int> a;

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

    cin >> n;
    a = V<int>(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }

    int mi = *min_element(a.begin(), a.end());
    int ma = *max_element(a.begin(), a.end());
    
    if (ma - mi > 1) {
        cout << "No\n";
    } else if (ma - mi == 1) {
        int cnt = count_if(a.begin(), a.end(), [&](int x) {
            return x == mi;
        });
        int large = mi - (cnt - 1);
        if (large <= 0 || 2 * large > n - cnt) cout << "No\n";
        else cout << "Yes\n";
    } else {
        if (mi == n - 1 || 2 * mi <= n) cout << "Yes\n";
        else cout << "No\n";
    }

    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define ll          long long int
#define pb          push_back
#define pll         pair<ll,ll>
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define mode        998244353
#define mod         1000000007
#define inf         1000000000000000000LL
#define vl          vector<ll>
#define F           first
#define S           second
#define db          long double
#define sz(x)       (ll)x.size()
#define fix(n)      cout<<fixed<<setprecision(n)
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define all(x)      x.begin(),x.end()
#define mset(x)     memset(x,0,sizeof x)
#define pi          3.1415926535897932


void solve()
{
       ll n;
       cin>>n;
       ll x[n], y[n], h[n];
       ll tx, ty, th;
       rep(i,0,n) { cin>>x[i]>>y[i]>>h[i]; if(h[i]>0) { tx=x[i], ty=y[i], th=h[i]; } }
       rep(cx, 0, 101)
       {
              rep(cy, 0, 101)
              {
                     bool f=1;
                     ll a = th + abs(tx-cx) + abs(ty-cy);
                     rep(i, 0, n)
                     {
                            if(h[i] > 0)
                            {
                                   if(h[i] + abs(x[i]-cx) + abs(y[i]-cy) != a) f=false;
                            }
                            else
                            {
                                   if(a - abs(cx-x[i]) - abs(cy-y[i]) > 0) f=false;
                            }
                     }
                     if(f)
                     {
                            cout<<cx<<" "<<cy<<" "<<a<<endl;
                            return;
                     }
              }
       }

}

int main() {
	ll T = 1;
	speed_up
	//cin>>T;
	while(T--)
	    solve();
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define si(x) scanf("%d",&x)
#define sl(x) scanf("%lld",&x)
#define pi(x) printf("%d",x)
#define pl(x) printf("%lld",x)
#define pb push_back
#define mkp make_pair
#define fi first
#define se second
#define re register
#define rep(i,m,n) for(int i=m;i<=n;i++)
#define per(i,n,m) for(int i=m;i>=n;i--)
#define rrep(i,m,n) for(register int i=m;i<=n;i++)
#define rper(i,n,m) for(register int i=m;i>=n;i--)
const int N = 3e3 + 10;
const ll mod = 1e9 + 7;
ll cnt[60][N];
int x[N];
signed main(){
    int n,a;
    si(n);
    si(a);
    rep(i,1,n)si(x[i]);
    cnt[0][0]=1;
    rep(i,1,n){
        per(k,1,i)
        rep(j,x[i],2501){
            cnt[k][j]+=cnt[k-1][j-x[i]];
        }
    }
    ll res=0;
    rep(i,1,n) {
        res+=cnt[i][i*a];
    }
    pl(res);
    return 0;
}

Measured memory_bytes: 4940
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(I,A,B) for(ll I = (A); I < (B); ++I)
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin()) //ai>=v
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin()) //ai>v
#define NUM(x,v) (POSU(x,v)-POSL(x,v))
const ll INF=1e9+7;
const ll N = 8;
ll h,w,did=0,n=0;
bool ok;
bool f=false;
char a[N][N];

void dfs(ll y,ll x){
	did++;
	if(x==w-1&&y==h-2){
		did++;
		ok=true;
		f=true;
		return;
	}else if(x==w-2&&y==h-1){
		did++;
		ok=true;
		f=true;
		return;
	}
	if(x+1<w)if(a[y][x+1]=='#')dfs(y,x+1);
	if(f)return;
	if(y+1<h)if(a[y+1][x]=='#')dfs(y+1,x);
	if(f)return;
	if(x+1<w&&a[y][x+1]!='#'&&y+1<h&&a[y+1][x]!='#'){
		ok=false;
	}
	did--;
}



int main(){
	cin>>h>>w;
	FOR(i,0,h){
		FOR(j,0,w){
			cin>>a[i][j];
			if(a[i][j]=='#')n++;
		}
	}
	dfs(0ll,0ll);
	if(ok&&(n==did)){
		cout<<"Possible"<<endl;
	}else{
		cout<<"Impossible"<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  long N;
  cin >> N;
  long p[N];
  for(int i=0;i<N;i++){
    int x=0;
    cin >> x;
    p[x-1]=i;
  }
  for(int i=0;i<N;i++) cout << (i+1)*N+p[i] << " ";
  cout << endl;
  for(int i=0;i<N;i++) cout << (N-i)*N << " ";
}

Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define P pair<int,int>
int n;
vector<int>v[222222];
int dp[2][222222];
bool used[222222];
int dfs(int x){
	used[x]=true;
	int ans=0;
	for(int e:v[x]){
		if(used[e])continue;
		ans=max(ans,dfs(e));
		ans=max(ans,dp[1][x]+dp[0][e]);
		ans=max(ans,dp[0][x]+dp[1][e]);
		dp[0][x]=max(dp[0][x],dp[0][e]+1);
		dp[1][x]=max(dp[1][x],dp[1][e]+1);
	}
	return ans;
}
signed main(){
	cin>>n;
  if(n==1){
    puts("First");
    return 0;
  }
	rep(i,n-1){
		int a,b;
		cin>>a>>b;
		a--,b--;
		v[a].push_back(b);
		v[b].push_back(a);
	}
	int path=dfs(0);
	path++;
	if(path%3==1)puts("Second");
	else puts("First");
	return 0;
}


Measured memory_bytes: 24192
import java.util.Scanner;

class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		StringBuilder all = new StringBuilder();
		StringBuilder out = new StringBuilder();
		
		while(true){
			int H = sc.nextInt();
			int W = sc.nextInt();
			if((H + W) <= 0){break;}
				for(int j = 0; j < H; j++){
					for(int i = 0; i < W; i++){
						out = out.append("#");
					}
					out = out.append("\n");
				}
			all = all.append(out + "\n");
			out.delete(0, out.length());
		}
        
		System.out.print(all);
	}
}


Measured memory_bytes: 28132
#include<stdio.h>
#define N 101
#define WHITE 5
#define GRAY 2
#define BLACK 3

int stack[N],top=0;
int color[N],d[N],A[N][N],f[N],time,n;
void push(int r){
  stack[top]=r;
  top++;
}

int pop(){
  top--;
  return stack[top];
}

int next(int v){
  int i;
  for(i=0;i<n;i++){
    if(A[v][i]==1&&color[i]==WHITE){
      return i;
    }
  }
  return NULL;
}

void dfsVisit(int r){
  int u,i,v;
  push(r);
  color[r] =GRAY;
  d[r] = ++time;
  while(top!=0){
    u = stack[top-1];
    v = next(u);
    if(v!=NULL){
      if(color[v]==WHITE){
	push(v);
	color[v] = GRAY;
	d[v]=++time;
      }
    }
      else{
	pop();
	color[u]=BLACK;
	f[u]=++time;
      }
    
  }
}

void dfs(void){
  int i;
  for(i=0;i<n;i++){
    color[i]=WHITE;
    time = 0;
  }
  for(i=0;i<n;i++){
    if(color[i]==WHITE)
      dfsVisit(i);
  }
  
  
}





int main(){
  int m,l,i,j,s;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      A[i][j]=0;
    }
  }
  for(i=0;i<n;i++){
    scanf("%d%d",&l,&m);
    for(j=0;j<m;j++){
      scanf("%d",&s);
      A[l-1][s-1]=1;
    }
  }
  dfs();
  for(i=0;i<n;i++){
    printf("%d %d %d\n",i+1,d[i],f[i]);
  }
  return 0;
  
}

Measured memory_bytes: 636
n = gets.to_i
t = [0]
x = [0]
y = [0]
(1..n).each { |i| t[i], x[i], y[i] = gets.split.map(&:to_i) }

ans = 'Yes'
(1..n).each do |i|
  diff_t = t[i] - t[i - 1]
  diff_x = (x[i] - x[i - 1]).abs
  diff_y = (y[i] - y[i - 1]).abs
  if diff_t < diff_x + diff_y || (diff_t - (diff_x + diff_y)) % 2 == 1
    ans = 'No'
    break
  end
end
puts ans


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

int main(){
    int N,A;
    int ans = 0;

    std::cin >> N;
    for(int i = 1; i <= N; i++){
        std::cin >> A;
        if(i%2 == 1 && A%2 == 1){
            ans++;
        }
    }
    

    std::cout << ans;
}

Measured memory_bytes: 3592
#include<bits/stdc++.h>
using namespace std;
 
#define pb push_back
#define ll long long
#define maxn 300005
#define fr(i,j,k) for(int i=j;i<k;i++)
#define f(n) fr(i,0,n)
#define f1(n) fr(i,1,n+1)
#define ms(i) memset(i,0,sizeof(i));
#define ms1(i) memset(i,-1,sizeof(i));
string s;
vector<int> sum[2000005];
void pushup(int x){
    for (int i = 0 ; i < 26 ; i++) {
        sum[x][i] = sum[x<<1][i] | sum[x<<1|1][i];
    }
}
void build(int x,int l,int r){
    sum[x].resize(26);
    if(l==r){
        sum[x][s[l]-'a'] = 1;
        return ;
    }
    int mid = (l+r) >> 1;
    build(x<<1,l,mid);
    build(x<<1|1,mid+1,r);
    pushup(x);
}
void update(int x,int l,int r,int p){
    if(l==r){
        for (int i = 0 ; i < 26 ; i++) {
            if(i == s[p]-'a'){
                sum[x][i] = 1;
            }
            else {
                sum[x][i] = 0;
            }
        }
        return ;
    }
    int mid = (l+r) >> 1;
    if(p <= mid){
        update(x<<1,l,mid,p);
    }
    else{
        update(x<<1|1,mid+1,r,p);
    }
    pushup(x);
}
vector<int> query(int x,int l,int r,int ql,int qr){
    if(ql <= l && qr >= r){
        return sum[x];
    }
    int mid = (l+r) >> 1;
    if(qr <= mid){
        return query(x<<1,l,mid,ql,qr);
    }
    if(ql > mid){
        return query(x<<1|1,mid+1,r,ql,qr);
    }
    else {
        vector<int> ret(26,0);
        vector<int> q1 = query(x<<1,l,mid,ql,qr);
        vector<int> q2 = query(x<<1|1,mid+1,r,ql,qr);
        for (int i = 0 ; i < 26 ; i++) {
            ret[i] = q1[i] | q2[i];
        }
        return ret;
    }
}
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin >> n;
    cin >> s;          
    s = " " + s;
    build(1,1,n);
    int t;
    cin >> t;
    while(t--) {
        int tp;
        cin >> tp;
        if (tp == 2) {
            int l ,r;
            cin >> l >> r;
            vector<int>ret = query(1,1,n,l,r);
            int sum = 0;
            for (auto i:ret) {
                sum += i;
            }
            cout << sum << '\n';
        }
        else {
            int x;
            char c;
            cin >> x >> c;
            s[x] = c;
            update(1,1,n,x);
        }
    } 
}

Measured memory_bytes: 157104
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define uli unsigned long long int
#define INF 999999999999999999
#define rep(i,m,n) for(lli i = m;i < n;i++)
#define rrep(i,m,n) for(lli i=m-1;i>=n;i--)
#define pb(n) push_back(n)
#define UE(N) N.erase(unique(N.begin(),N.end()),N.end());
#define Sort(n) sort(n.begin(), n.end())
#define Rev(n) reverse(n.begin(),n.end())
#define Out(S) cout << S << endl
#define NeOut(S) cout << S
#define HpOut(S) cout << setprecision(25) << S << endl
#define Vec(K,L,N,S) vector<L> K(N,S)
#define DV(K,L,N,M,S) vector<vector<L>> K(N,vector<L>(M,S))
#define TV(K,L,N,M,R,S) vector<vector<vector<L>>> K(N,vector<vector<L>>(M,vector<L>(R,S)))
#define pint pair<lli,lli>
#define paf(L,R) pair<L,R>
#define mod 1000000007
#define MAX 5100000
#define ALL(a)  a.begin(),a.end()
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
int main(){
  lli A,B,C,D,E,F,N,M,K,L,X,Y,Z,H,W,sum=0,num=0,flag=0;string S,T;
  cin >> N >> K;
  X=1;
  sum=0;
  while(X<=N){
    X*=K;
    sum++;
  }
  Out(sum);
}

Measured memory_bytes: 256
/* This code is written by 7_shadows/civil_coder */

#include<bits/stdc++.h>
#define int             long long
#define mod             1000000007
#define size(x)          (int)((x).size())
#define fill(x, y) memset(x, y, sizeof(x))
using namespace std;

const int N = 100001;
int dp[N];
int minsteps(int a[], int n) {
	//base case
	if (n == 1)
		return 0;
	if (dp[n] != -1)
		return dp[n];
	int op1, op2;
	op1 = op2 = INT_MAX;
	if (n - 1 >= 0)
		op1 = minsteps(a, n - 1) + abs(a[n - 1] - a[n - 2]);
	if (n - 2 >= 0)
		op2 = minsteps(a, n - 2) + abs(a[n - 1] - a[n - 3]);
	int ans = min(op1, op2);
	dp[n] = ans;
	return dp[n];

}

void solve() {
	int n; cin >> n;
	int a[n];
	for (int i = 0; i < n; i++)
		cin >> a[i];
	fill(dp, -1);
	cout << minsteps(a, n) << '\n';

}
int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

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

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

Measured memory_bytes: 11428
X = int(input())

if 400 <= X < 600:
  print(8)
elif 600 <= X < 800:
  print(7)
elif 800 <= X < 1000:
  print(6)
elif 1000 <= X < 1200:
  print(5)
elif 1200 <= X < 1400:
  print(4)
elif 1400 <= X < 1600:
  print(3)
elif 1600 <= X < 1800:
  print(2)
else:
  print(1)


Measured memory_bytes: 9172
import heapq

x,y,a,b,c=map(int,input().split())
p=list(map(int,input().split()))
q=list(map(int,input().split()))
r=list(map(int,input().split()))

p.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)

ans=[]
for i in range(x):
  ans.append(p[i])
  
for j in range(y):
  ans.append(q[j])
  
ans.sort()

heapq.heapify(ans)

for j in range(c):
  min_a=heapq.heappop(ans)
  if min_a<=r[j]:
    heapq.heappush(ans,r[j])
  else:
    heapq.heappush(ans,min_a)
    break
    
print(sum(ans))




Measured memory_bytes: 29488
import java.util.Scanner;
import java.util.HashMap;
import java.util.List;
import java.util.Arrays;
import java.util.ArrayList;
import java.lang.Math;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] d = new int[n];
        for (int i = 0; i < n; i++) {
            d[i] = sc.nextInt();
        }
        int ans = 0;
        for (int i = 0; i < n-1; i++) {
            for (int j = i+1; j < n; j++) {
                ans += d[i] * d[j];
            }
        }
        System.out.println(ans);
    }

}


Measured memory_bytes: 23764
def main():
  n=int(input())
  a=[0]*n
  b=a[:]
  for i in range(n):
    a[i],b[i]=map(int,input().split())
  b,a=zip(*sorted(zip(b,a)))
  t=0
  for (i,j) in zip(a,b):
    t+=i
    if t>j:
      print("No")
      return
  print("Yes")
main()

Measured memory_bytes: 47528
a,b,m = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
ans = min(a) + min(b)
for _ in range(m):
    x,y,c = map(int,input().split())
    x -= 1
    y -= 1
    tmp = a[x] + b[y] - c
    ans = min(ans,tmp)
print(ans)

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

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

const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const ll INF = 1LL<<29;
const ll mod = 1e9+7;

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

ll gcd(ll x, ll y)
{
  if (x % y == 0)
  {
    return y;
  }
  return gcd(y, x % y);
}

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  char c;  
  cin >> c;
  
  if (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u') {
    cout << "vowel" << endl;
  }
  else {
    cout << "consonant" << endl; 
  }  

}


Measured memory_bytes: 256
#include <iostream>      // cout, endl, cin
#include <string>        // string, to_string, stoi
#include <vector>        // vector
#include <algorithm>     // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility>       // pair, make_pair
#include <tuple>         // tuple, make_tuple
#include <cstdint>       // int64_t, int*_t
#include <cstdio>        // printf
#include <map>           // map
#include <queue>         // queue, priority_queue
#include <set>           // set
#include <stack>         // stack
#include <deque>         // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset>        // bitset
#include <cctype>        // isupper, islower, isdigit, toupper, tolower
#include <iomanip>       // fixed, setprecision
using namespace std;

int main()
{
  int K, X, start = 0, end = 0;
  cin >> K >> X;
  start = X - K + 1;
  end = X + K - 1;
  for (int i = start; i <= end; i++)
  {
    cout << i << " ";
  }
  cout << endl;
}


Measured memory_bytes: 3180
n=int(input())
arr=list(map(int,input().split(" ")))
c=0
for i in range(1,n-1):
	if(arr[i]!=min(arr[i-1],arr[i],arr[i+1]) and arr[i]!=max(arr[i-1],arr[i],arr[i+1])):
		c=c+1
print(c)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std ;
#define Next( i, x ) for( int i = head[x]; i; i = e[i].next )
#define rep( i, s, t ) for( int i = (s); i <= (t); ++ i )
#define drep( i, s, t ) for( int i = (t); i >= (s); -- i )
#define int long long
int gi() {
	char cc = getchar() ; int cn = 0, flus = 1 ;
	while( cc < '0' || cc > '9' ) {  if( cc == '-' ) flus = - flus ; cc = getchar() ; }
	while( cc >= '0' && cc <= '9' )  cn = cn * 10 + cc - '0', cc = getchar() ;
	return cn * flus ;
}
const int N = 500 + 5 ; 
const int M = 100 + 5 ; 
int T, n, A[N], flag, b[M] ;
char s[N] ;  
void solve( int l, int r, int type ) {
	if( type == 0 ) {
		rep( j, l, r ) {	
			int x = A[j] ; 
			for( int i = 60; i >= 0; -- i ) {
				int u = ( 1ll << i ) ; 
				if( u & x ) x ^= b[i] ;   
			}
			if( x ) flag = 1 ; 
		}
	}
	else {
		rep( j, l, r ) {	
			int x = A[j] ; 
			for( int i = 60; i >= 0; -- i ) {
				int u = ( 1ll << i ) ; 
				if( u & x ) {
					if( !b[i] ) b[i] = x, x = 0 ; 
					else x ^= b[i] ;   
				}
			}
		}
	}
} 
signed main()
{
	T = gi() ; 
	while( T-- ) {
		n = gi() ;
		rep( i, 1, n ) A[i] = gi() ; 
		scanf("%s", s + 1 ) ; s[0] = '5' ; 
		int lst = n ; flag = 0 ; 
		for( int i = n; i >= 1; -- i ) {
			if( s[i] != s[i - 1] ) {
				if( s[i] == '0' ) solve(i, lst, 1) ;
				else solve(i, lst, 0) ;
				lst = i - 1 ; 
			}
		} 
		if( flag ) puts("1") ;
		else puts("0") ; 
		rep( i, 0, 65 ) b[i] = 0 ;
	}
	return 0 ;
}

Measured memory_bytes: 3540
#include<cstdio>
#include<vector>
const int mod=998244353;
int N,A[410],S,IS,B[410],C[410][410],f[410][410][410];
long long inv(int a,int p=mod){return a==1?1:(1+p*(a-inv(p%a,a)))/a%p;}
int pw(int a,int n){int b=1;for(;n;n>>=1)n&1?b=1ll*b*a%mod:1,a=1ll*a*a%mod;return b;}
int main(){
	scanf("%d",&N);
	for(int i=0;i<N;i++)scanf("%d%d",A+i,B+i),S+=A[i];
	IS=inv(S);
	for(int i=0;i<=400;i++)
		for(int j=*C[i]=1;j<=400;j++)C[i][j]=(C[i-1][j-1]+C[i-1][j])%mod;
	f[0][0][0]=mod-1;
	for(int i=0;i<N;i++)
		for(int j=0;j<=S;j++)
			for(int k=0;k<=400;k++)if(f[i][j][k]){
				long long p=1ll*A[i]*IS%mod;
				(f[i+1][j][k]+=f[i][j][k])%=mod;
				for(int l=0,w=1;l<B[i];l++,w=1ll*w*p%mod){
					f[i+1][j+A[i]][k+l]=(f[i+1][j+A[i]][k+l]+1ll*(mod-C[k+l][k])*f[i][j][k]%mod*w)%mod;
				}
			}
	int ans=0;
	for(int k=0;k<=400;k++){
		for(int i=1;i<=S;i++)if(f[N][i][k]){
			int a=(S-i)*1ll*IS%mod;
			if(a)ans=(ans+f[N][i][k]*inv(pw(a,k))%mod*pw(a*inv((mod+1-a)%mod)%mod,k)%mod*inv((mod+1-a)%mod))%mod;
			else ans=(ans+f[N][i][k])%mod;
		}
	}
	printf("%d\n",ans);
}

Measured memory_bytes: 263040
#include<iostream>
#include<string>
#include<vector>
#include<numeric>
#include<math.h>
#include<algorithm>
#include<iomanip>
#include<list>
#include<bitset>
using namespace std;

int main() {

	int N;
	cin >> N;

	vector<string> S(N, "");

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

	sort(S.begin(), S.end());

	auto itr = S.begin();
	auto ditr = S.begin();

	int ans = 0;
	while (itr != S.end()) {
		ditr = itr;
		ans += 1;
		while (*ditr == *itr) {
			itr += 1;
			if (itr == S.end()) {
				break;
			}
		}
	}

	cout << ans << endl;

	return 0;
}



Measured memory_bytes: 9548
#include <iostream>
#include <bits/stdc++.h>
#include <vector>
using namespace std;
//int count = 0;
vector<vector<int>> dp;
string solve(string s, string t)
{
    if(s=="" || t == "") return "";
    for (int i = 1; i < dp.size(); i++)
    {
        for (int j = 1; j < dp[i].size(); j++)
        {
            if (s[i - 1] == t[j - 1])
            {
                dp[i][j] = dp[i - 1][j - 1] + 1;
            }
            else
            {
                dp[i][j] = max(dp[i - 1][j], dp[i][j - 1]);
            }
        }
    }

    int row = dp.size() - 1;
    int col = t.length();
    string ans = "";

    // while(dp[row][col] == dp[row-1][col]){
    // //cout<<row<<" "<<col<<endl;
    //     row--;
    // }
    // cout<<row<<" "<<col;
    while (row >= 0 && col >= 0)
    {
//        if(col-1 >= 0) 
            //ans = s[col - 1] + ans;

        if (row - 1 >= 0 && col - 1 >= 0 && dp[row - 1][col - 1] != dp[row][col])
        {
            //int col = col;
            while(col - 1 >= 0 && dp[row][col] == dp[row][col-1]){
                col--;
            }
            while(row - 1 >= 0 && dp[row][col] == dp[row-1][col]){
                row--;
            }
       // cout<<col<<" ";
       if(col-1 >= 0)
            ans = t[col-1] + ans;
        }

            col--;
            row--;
        // row--;
        // col--;
    }
    return ans;
}

int main()
{
    string s, t;
    cin >> s >> t;
    if (s.length() < t.length())
    {
        dp = vector<vector<int>>(s.length() + 1, vector<int>(t.length() + 1, 0));
        cout << solve(s, t);
    }
    else
    {
        dp = vector<vector<int>>(t.length() + 1, vector<int>(s.length() + 1, 0));
        cout << solve(t, s);
    }
}

Measured memory_bytes: 38884
#include<bits/stdc++.h>
using namespace std;
int main(){
  int k;
  cin>>k;
  long long ans=0;
  for(int i=1;i<=k;i++){
    for(int j=1;j<=k;j++){
      for(int l=1;l<=k;l++){
         ans+=__gcd(__gcd(i,j),l);
      }
    }
  }
  cout<<ans<<endl;
  return 0;
}

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

int main() {
    int N, A, B, C;
    std::cin >> N >> A >> B >> C;

    if ((A + B + C) == 0) {
        std::cout << "No" << std::endl;
        return 0;
    }

    std::string s[N];
    for (int i = 0; i < N; ++i) {
        std::cin >> s[i];
    }

    std::vector<char> vec;
    for (int i = 0; i < N; ++i) {
        const std::string& str = s[i];
        if (str == "AB") {
            if (A < B) {
                ++A;
                --B;
                vec.push_back('A');
            } else if (A > B) {
                --A;
                ++B;
                vec.push_back('B');
            } else {
                if (A == 1 && B == 1 && i != (N - 1) && s[i+1] == "AC") {
                    ++A;
                    --B;
                    vec.push_back('A');
                } else {
                    --A;
                    ++B;
                    vec.push_back('B');
                }
            }
        } 
        else if (str == "AC") {
            if (A < C) {
                ++A;
                --C;
                vec.push_back('A');
            } else if (A > C) {
                --A;
                ++C;
                vec.push_back('C');
            } else {
                if (A == 1 && C == 1 && i != (N - 1) && s[i+1] == "AB") {
                    ++A;
                    --C;
                    vec.push_back('A');
                } else {
                    --A;
                    ++C;
                    vec.push_back('C');
                }
            }
        } 
        else if (str == "BC") {
            if (B < C) {
                ++B;
                --C;
                vec.push_back('B');
            } else if (B > C) {
                --B;
                ++C;
                vec.push_back('C');
            } else {
                if (B == 1 && C == 1 && i != (N - 1) && s[i+1] == "AB") {
                    ++B;
                    --C;
                    vec.push_back('B');
                } else {
                    --B;
                    ++C;
                    vec.push_back('C');
                }
            }
        } 

        if (A < 0 || B < 0 || C < 0) {
            std::cout << "No" << std::endl;
            return 0;
        }
    }

    std::cout << "Yes" << std::endl;
    for (char c : vec) {
        std::cout << c << std::endl;
    }

    return 0;
}


Measured memory_bytes: 6872
#include<iostream>
#include<algorithm>
#define fi        first
#define se        second
#define pb        push_back
#define PI        acos(-1)
#define LC(a)     ((a<<1))
#define RC(a)     ((a<<1)+1)
#define MID(a,b)  ((a+b)>>1)
#define mem(a, b) memset(a, b, sizeof(a))
#define IOS()     std::ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
using namespace std;
typedef long long ll;
typedef unsigned long long ULL;
typedef pair<int,int> PII;
typedef pair<ll,ll>   PLL;
typedef pair<ll,int>  PLI;
const int INF = 0X3F3F3F3F;
const int MIN = -(1<<30);
const ll N = 1e5+7;
inline void solve()
{
	ll n,k;
	cin>>n>>k;
	cout<<min(n%k,k-n%k)<<endl;
}
int main()
{
	IOS();
	solve();
	return 0;
}




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

#define rep(i,n) for (int i = 0; i < (n); ++i)
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> pint;
const int INF = 1e9;
const ll LINF = 1e18;
const int MOD = 1e9+7;

int main() {
    int n, m; cin >> n >> m;
    cout << n * (n-1) / 2 + m * (m-1) / 2 << endl;

    return 0;
}

Measured memory_bytes: 256
N,*ABC=map(int,input().split())
M=3
ans=10**9
L=[]
for i in range(N):
  l=int(input())
  if l in ABC:
    ABC.remove(l)
    N-=1
    M-=1
  else:
    L.append(l)
if M==0:
  print(0)
  exit(0)
for x in range((M+1)**N):
  _=0
  abc=[0]*(M+1)
  for i in range(N):
    if x%(M+1)!=M and abc[x%(M+1)]>0:
      abc[x%(M+1)]+=L[i]
      _+=10
    else:
      abc[x%(M+1)]+=L[i]
    x=x//(M+1)
  if min(abc[:M])==0:
    continue
  for i in range(M):
    _+=abs(ABC[i]-abc[i])
  ans=min(ans,_)
  
print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h> 
using namespace std;
typedef long long ll;
ll INFL = 1000000000000000010;//10^18 = 2^60
int INF = 2000000000;//10^9
ll MOD  = 998244353;


int main() {
    int N;
    cin >> N;
    string W[N];
    for(int i = 0; i < N; i++){
        cin >> W[i];
    }
    bool a = true;
    for(int i = 0; i < N; i++){
        int cnt = 0;
        for(int j = 0; j < N; j++){
            if(W[i] == W[j]){
                cnt++;
            }
        }
        if(cnt >= 2){
            a = false;
        }
    }
    
    for(int i = 0; i < N-1; i++){
        if(W[i].at(W[i].size()-1) != W[i+1].at(0)){
            a = false;
        }
    }
    if(a){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    
}

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

using namespace std;

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
#define fth(t) std::get<3>(t)
#define unless(p) if(!(p))
#define until(p) while(!(p))

using ll = long long;
using P3 = std::tuple<int,int,int>;

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

P3 ps[60];
bool solved[60][20];
int WAs[60][20];

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

    while(true){
        int M, T, P, R;
        std::cin >> M >> T >> P >> R;
        if(!M){break;}
    
        for(int i=1;i<=T;++i){
            ps[i] = std::make_tuple(0, 0, 0);
        }
        memset(solved, 0, sizeof(solved));
        memset(WAs, 0, sizeof(WAs));
    
        for(int i=0;i<R;++i){
            int tid, pid, t, c;

            std::cin >> t >> tid >> pid >> c;

            if(solved[tid][pid]){continue;}
            if(c == 0){
                ++fst(ps[tid]);
                snd(ps[tid]) += WAs[tid][pid] * 20 + t;
                solved[tid][pid] = true;
            }else{
                ++WAs[tid][pid];
            }
        }

        for(int i=1;i<=T;++i){
            fst(ps[i]) = -fst(ps[i]);
            thd(ps[i]) = -i;
        }

        sort(ps+1, ps+1+T);

        for(int i=1,j=1;i<=T;i=j){
            if(i > 1){
                std::cout << ",";
            }
            
            while(j <= T && std::make_tuple(fst(ps[j]), snd(ps[j])) == std::make_tuple(fst(ps[i]), snd(ps[i]))){
                if(j > i){std::cout << "=";}
                std::cout << (-thd(ps[j]));
                ++j;
            }
        }

        std::cout << std::endl;
    }
}



Measured memory_bytes: 3080
#include<stdio.h>
int main(void)
{
    int n[10],i,j;
	j=0;
	for(i=0;i<10;i++){
	    scanf("%d",&n[i]);
	}
	for(i=0;i<10;i++){
	    j+=n[i];
	}
	printf("%d\n",j);
	return 0;
}

Measured memory_bytes: 2696
n, m = map(int, (input().split()))

lst = []
for i in range(m):
    p, y = map(int, (input().split()))
    lst.append([p, y, i])
lst.sort()

lst2 = []
pref = 0
for v in lst:
    if pref != v[0]:
        cnt = 1
        pref = v[0]
    lst2.append(['{:0=6}{:0=6}'.format(v[0], cnt), v[2]])
    cnt += 1
lst2.sort(key=lambda x: x[1])

[print(lst2[i][0]) for i in range(m)]

Measured memory_bytes: 41604
// atcoder/abc161/D/main.cpp
// author: @___Johniel
// github: https://github.com/johniel/

#include <bits/stdc++.h>

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << "," << p.second << ")"; return os; }
template<typename P, typename Q> istream& operator >> (istream& is, pair<P, Q>& p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; for (auto& i: v) os << i << ","; os << ")"; return os; }
template<typename T> istream& operator >> (istream& is, vector<T>& v) { for (auto& i: v) is >> i; return is; }
template<typename T> ostream& operator << (ostream& os, set<T> s) { os << "#{"; for (auto& i: s) os << i << ","; os << "}"; return os; }
template<typename K, typename V> ostream& operator << (ostream& os, map<K, V> m) { os << "{"; for (auto& i: m) os << i << ","; os << "}"; return os; }

template<typename T> inline T setmax(T& a, T b) { return a = std::max(a, b); }
template<typename T> inline T setmin(T& a, T b) { return a = std::min(a, b); }

using lli = long long int;
using ull = unsigned long long;
using point = complex<double>;
using str = string;
template<typename T> using vec = vector<T>;

constexpr array<int, 8> di({0, 1, -1, 0, 1, -1, 1, -1});
constexpr array<int, 8> dj({1, 0, 0, -1, 1, -1, -1, 1});
constexpr lli mod = 1e9 + 7;

int main(int argc, char *argv[])
{
  std::ios_base::sync_with_stdio(0);
  std::cin.tie(0);
  std::cout.setf(std::ios_base::fixed);
  std::cout.precision(15);

  int k;
  while (cin >> k) {
    --k;

    vec<str> v;
    for (int i = 1; i <= 9; ++i) {
      v.push_back(string(1, '0' + i));
    }

    int x = 0;
    while (x + v.size() <= k) {
      x += v.size();
      vec<str> u;
      each (i, v) {
        char a = i.back() - 1;
        char b = i.back() - 0;
        char c = i.back() + 1;

        if ('0' <= a && a <= '9') u.push_back(i + a);
        if ('0' <= b && b <= '9') u.push_back(i + b);
        if ('0' <= c && c <= '9') u.push_back(i + c);
      }
      v = u;
    }
    sort(v.begin(), v.end());
    // cout << k << ' ' << x << ' ' << v << endl;
    cout << v.at(k - x) << endl;
  }

  return 0;
}


Measured memory_bytes: 13600
#include <algorithm>
#include <bitset>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stdio.h>
#include <string>
#include <vector>

#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using LP = pair<ll, ll>;
const double PI = 3.1415926535897932;

/* a と b の最大公約数を返す関数 */
long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}

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

	return 0;
}


Measured memory_bytes: 3624
import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
# def LF(): return [float(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  n=I()
  s=S()

  l=0
  r=n-1

  ans=0
  while l<r:
    if s[l]=='W' and s[r]=='R':
      l+=1
      r-=1
      ans+=1
    else:
      if s[l]=='R':
        l+=1
      elif s[r]=='W':
        r-=1

  return ans

# main()
print(main())


Measured memory_bytes: 11052
#include <bits/stdc++.h>
#define REP(i, s, n) for (int i = s; i < (int)(n); i++)
#define ALL(a) a.begin(), a.end()
#define MOD 1000000007
using namespace std;
using ll = long long;

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

    int base = 0;
    vector<vector<int>> V(4);
    REP(i, 0, N) {
        int w, v; cin >> w >> v;
        if (i == 0) {
            base = w;
            V[0].push_back(v);
        } else {
            V[w - base].push_back(v);
        }
    }

    for (auto &v : V) sort(ALL(v), greater<>());

    vector<vector<int>> sums(4);
    REP(i, 0, 4) {
        sums[i].resize(V[i].size() + 1);
        REP(j, 0, V[i].size()) sums[i][j + 1] = sums[i][j] + V[i][j];
    }

    int ans = 0;
    REP(i, 0, sums[0].size()) {
        REP(j, 0, sums[1].size()) {
            REP(k, 0, sums[2].size()) {
                // cout << "# i : " << i << ", j : " << j << ", k : " << k << endl;
                // REP(l, 0, sums[3].size()) {
                //     if (W < i * (ll)base + j * (ll)(base + 1) + k * (ll)(base + 2) + l * (ll)(base + 3)) continue;
                //     ans = max(ans, sums[0][i] + sums[1][j] + sums[2][k] + sums[3][l]);
                //     // cout << "--> l : " << l << endl;
                // }

                if (W < i * (ll)base + j * (ll)(base + 1) + k * (ll)(base + 2)) continue;
                int l = max(0LL, (ll)W - (i * (ll)base + j * (ll)(base + 1) + k * (ll)(base + 2))) / (base + 3);
                ans = max(ans, sums[0][i] + sums[1][j] + sums[2][k] + sums[3][min(l, (int)sums[3].size() - 1)]);
            }
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3572
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
const int INF = 1e9;

int main() {
  int n;
  string s;
  cin >> n >> s;
  vector<int> w(n, 0);  // Wを向く人
  vector<int> e(n, 0);  // Eを向く人
  for (int i = 0; i < n; i++) {
    if (s[i] == 'W') {
      w[i] = w[i - 1] + 1;
      e[i] = e[i - 1];
    } else if (s[i] == 'E') {
      e[i] = e[i - 1] + 1;
      w[i] = w[i - 1];
    }
  }
  int ans = INF;
  for (int i = 0; i < n; i++) {
    ans = min(ans, w[i - 1] + (e[n - 1] - e[i]));
  }
  cout << ans << endl;
  return 0;
}

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

int main()
{
    
    /*
    string s1;
    getline( cin, s1 );
    int n1 = s1.size();
    */
    int a, b;
    cin >> a >> b ;
    
    if( a >= 13 ){
        cout << b << endl;
    }
    else if( a >= 6 && a <= 12 ){
        cout << b/2 << endl;
    }
    else if( a <= 5 ){
        cout << 0 << endl;
    }
      
    return 0;
}


Measured memory_bytes: 256
import java.util.*;
class Main{
	public static void main(String[] args){
		Scanner in = new Scanner(System.in);
		String S = in.next();
		char[] c = {' ',' ',' '};
		c[0] = S.charAt(0);
		c[1] = S.charAt(1);
		c[2] = S.charAt(2);
		Arrays.sort(c);
		if(c[0] == 'a' &&c[1] == 'b' &&c[2] == 'c')System.out.println("Yes");
		else System.out.println("No");
	}
}

Measured memory_bytes: 21716
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
using ll = long long;
using P = pair<ll,int>;
template <class T> void chmin(T &a, const T &b) noexcept { if (b < a) a = b; }
template <class T> void chmax(T &a, const T &b) noexcept { if (a < b) a = b; }
void print() { cout << "\n"; }
template <class T, class... Args>
void print(const T &x, const Args &... args) { cout << x << " "; print(args...);}
void debug_out() { cout << "\n"; }
template <class T, class... Args>
void debug_out(const T &x, const Args &... args) { cout << x << " "; debug_out(args...);}
#ifdef _DEBUG
  #define debug(...) debug_out(__VA_ARGS__)
#else
  #define debug(...) 
#endif


int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  int a,b,c,d,e,f;
  cin >> a >> b >> c >> d >> e >> f;
  double max_C = 0;
  int su_wa = 100*a, su = 0;
  auto update = [&](int x, int y, int z, int w) {
    double res = c*z + d*w;
    res /= double(100*(a*x+b*y)+c*z+d*w);
    if (res > max_C) {
      max_C = res;
      su_wa = 100*(a*x+b*y)+c*z+d*w;
      su = c*z+d*w;
    }
    return res;
  };
  for (int x = 0; x <= f/100; ++x) {
    for (int y = 0; y <= f/100; ++y) {
      if (x == 0 && y == 0) continue;
      for (int z = 0; z <= f; ++z) {
        if (f - 100*(a*x+b*y) - c*z < 0) break;
        int max_w = (f - 100*(a*x+b*y) - c*z)/d; //wの範囲を絞る
        for (int w = 0; w <= max_w; ++w) {
          double X = c*z+d*w;
          X /= double(a*x+b*y);
          if (X > e) break;
          update(x,y,z,w); //最大値をもとめる
        }
      }
    }
  }
  cout << su_wa << " " << su << endl; 
  return 0;
}

Measured memory_bytes: 256
S = list(input())
S = S[::-1]

t = 0
ans = 0
bc_score = 0
flag = 1

if len(S) <= 2:
    print(0)
    exit()

while t <= len(S)-2:
    if S[t]=="C" and S[t+1] == "B":
        bc_score = 0
        bc_score += 1
        t += 2
        flag = 1
        if t == len(S)-1:
            if S[t] == "A":
                ans += 1
            t += 1
        while flag == 1 and t <= len(S) - 1:
            flag = 0
            if S[t]=="C" and S[t+1] == "B":
                bc_score += 1
                t += 2
                flag = 1
            if t <= len(S) - 1:
                if S[t] == "A":
                    ans += bc_score
                    t += 1
                    flag = 1
    else:
        t += 1

print(ans)

Measured memory_bytes: 6308
#include <stdio.h>

int main(void)
{
	int S;

	scanf("%d", &S);
	
	if (0 <= S && S < 86400)
	{
		printf("%d:%d:%d\n", S / 3600, (S % 3600) / 60, ((S%3600)%60)%60);
	}
	return 0;
}


Measured memory_bytes: 2072
#include <bits/stdc++.h>
#include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <random>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define repp(i,n,m) for (int i = m; i < (n); ++i)
#define repl(i,n) for (long long i = 0; i < (n); ++i)
#define reppl(i,n,m) for (long long i = m; i < (n); ++i)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using PL = pair<long long, long long>;
using Pxy = pair<double, double>;
using T = tuple<int, int, bool>;
const int INF = 1001001007;
const int mod = 1000000007;
const int MOD = 998244353;
const ll inf = 1e18;
template <typename AT>
void printvec(vector<AT> &ar){
    rep(i,ar.size()-1) cout << ar[i] << " ";
    cout << ar[ar.size()-1] << endl;
}
template <typename Q>
void printvvec(vector<vector<Q>> &ar){
    rep(i,ar.size()){
        rep(j,ar[0].size()-1) cout << ar[i][j] << " ";
        cout << ar[i][ar[0].size()-1] << endl;
    }
}
template <typename S>
bool range(S a, S b, S x){
    return (a <= x && x < b);
}

void yes(int n){
    cout << "Yes" << endl;
}

void no (int n){
    cout << "No" << endl;
}

int ggcd(int a, int b){
    int c = a % b;
    while (c > 0){
        a = b;
        b = c;
        c = a % b;
    }
    return b;
}

int main() {
    int n; cin >> n;
    vector<int> ar(n);
    rep(i,n) cin >> ar[i];
    vector<int> gl(n);
    vector<int> gr(n);
    gl[0] = ar[0];
    gr[0] = ar[n-1];
    rep(i,n-1){
        gl[i+1] = ggcd(gl[i],ar[i+1]);
        gr[i+1] = ggcd(gr[i],ar[n-2-i]);
    }
    int ans = max(gl[n-2],gr[n-2]);
    repp(i,n-1,1){
        ans = max(ans,ggcd(gl[i-1],gr[n-2-i]));
    }
    cout << ans << endl;
}

Measured memory_bytes: 4588
#include <stdio.h>
#define N 100

int main(){
  int i,j,s,length,count=0,flag;
  int A[N];

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

  flag = 1;
  while(flag){
    flag = 0;
    for(j=0; j<length; j++) {
      if(A[j] < A[j-1]) {
	s = A[j];
	A[j] = A[j-1];
	A[j-1] = s;
	count ++;
	flag = 1;
      }
    }
  }

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

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

using namespace std;

int main()
{
	int N;
	cin >> N;
	vector<int> s(N);
	for (auto &s_i : s) {
		cin >> s_i;
	}

	const int SCORE_MAX = 100 * 100;
	vector<bool> v(SCORE_MAX + 1, false);

	v[0] = true;
	for (int i = 0; i < N; ++i) {
		vector<bool> x = v;
		for (int j = 0; j <= SCORE_MAX; ++j) {
			if (v[j]) {
				x[j + s[i]] = true;
			}
		}
		swap(x, v);
	}
	
	int ans = 0;
	for (int j = 0; j <= SCORE_MAX; ++j) {
		if (v[j] && j % 10 != 0) {
			ans = j;
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
def main():
    N = int(input())
    a = [list(map(int, input().split())) for i in range(N)]

    def popcount(x):
        # 2bitごとの組に分け、立っているビット数を2bitで表現する
        x = x - ((x >> 1) & 0x5555555555555555)

        # 4bit整数に 上位2bit + 下位2bit を計算した値を入れる
        x = (x & 0x3333333333333333) + ((x >> 2) & 0x3333333333333333)

        x = (x + (x >> 4)) & 0x0f0f0f0f0f0f0f0f  # 8bitごと
        x = x + (x >> 8)  # 16bitごと
        x = x + (x >> 16)  # 32bitごと
        x = x + (x >> 32)  # 64bitごと = 全部の合計
        return x & 0x0000007f

    dp = [[0]*(1 << N) for i in range(N+1)]
    dp[0][0] = 1
    mod = 10**9+7
    for j in range(1, 1 << N):
        i = popcount(j)
        DP = dp[i]
        prev = dp[i-1]
        for k in range(N):
            if (j >> k) % 2 == 1:
                if a[i-1][k] == 1:
                    DP[j] += prev[j ^ (1 << k)]
                    DP[j] %= mod

    print(dp[-1][(1 << N) - 1])


main()


Measured memory_bytes: 395160
n = int(input())
k2 = 9
k4 = len(range(100,1000))
k6 = len(range(10000,100000))
if len(str(n)) == 1:
  print(len(range(1,n+1)))
elif len(str(n)) == 2:
  print(k2)
elif len(str(n)) == 3:
  print(k2+len(range(100,n+1)))
elif len(str(n)) ==4:
  print(k2+k4)
elif len(str(n)) ==5:
  print(k2+k4+len(range(10000,n+1)))
elif len(str(n)) ==6:
  print(k2+k4+k6)

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <algorithm>
#include <stdlib.h>
#include <stack>
#define ll long long
using namespace std;

int main()
{
	int a[20], b[20], c[20];
	int n, bn, ans = 0;

	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	for (int i = 0; i < n; i++) {
		cin >> bn;
		ans += bn;
		b[i] = bn;
	}
	for (int i = 0; i < n-1; i++) {
		cin >> c[i];
	}
	for (int i = 0; i < n - 1; i++) {
		if (a[i] + 1 == a[i + 1]) {
			ans += c[a[i]-1];
		}
	}
	
	cout << ans;

	return 0;
}

Measured memory_bytes: 256
/*

*/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAXN = 3e3 + 3;
const int inf = 0x3f3f3f3f;
char a[MAXN], b[MAXN];
int dp[MAXN][MAXN], path[MAXN][MAXN];
void PrintLCS(int i, int j)
{
    if (!i || !j)
        return;
    if (path[i][j] == 1)
    {
        PrintLCS(i - 1, j - 1);
        putchar(a[i]);
    }
    else if (path[i][j] == 2)
        PrintLCS(i - 1, j);
    else
        PrintLCS(i, j - 1);
}
int main()
{
    scanf("%s", a + 1);
    scanf("%s", b + 1);
    int lena = strlen(a + 1);
    int lenb = strlen(b + 1);
    int ans = 0;
    for (int i = 1; i <= lena; i++)
        for (int j = 1; j <= lenb; j++)
            if (a[i] == b[j])
                dp[i][j] = dp[i - 1][j - 1] + 1, path[i][j] = 1;
            else if (dp[i - 1][j] >= dp[i][j - 1])
                dp[i][j] = dp[i - 1][j], path[i][j] = 2;
            else
                dp[i][j] = dp[i][j - 1], path[i][j] = 3;
    PrintLCS(lena, lenb);
    return 0;
}

Measured memory_bytes: 70784
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<stack>
#include<queue>
#include<map>
#include<set>

using namespace std;

typedef long long ll;
typedef std::vector<int> VI;

#define FOR(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR1(i,n) for(int (i)=1;(i)<(n);(i)++)
#define eFOR(i,n) for(int (i)=0;(i)<=(n);(i)++)
#define eFOR1(i,n) for(int (i)=1;(i)<=(n);(i)++)
#define SORT(i) sort((i).begin(),(i).end())

int main() {

	int n;
	cin >> n;
	vector<ll> a(n);
	FOR(i, n)cin >> a[i];
	FOR1(i, n)a[i] += a[i - 1];
	ll sum = a[n - 1], ans = 10e9;
	FOR(i, n - 1) {
		ans = min(ans, abs(sum - a[i] * 2));
	}
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 1792