akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
#include<algorithm>
#include<utility>
#include<cmath>
using namespace std;
typedef long long ll;

const ll MAX = 200000;
const ll MOD=1000000007;
//マクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define INF 1000000000000
#define PB push_back
#define MP make_pair
#define F first
#define S second

template<ll mod> class modint{
public:
    ll val=0;
    constexpr modint(ll x=0) noexcept : val(x%mod){
        while(x<0)x+=mod;
    }
    constexpr ll getmod(){return mod;}
    constexpr ll getvalue(){return val;}
    constexpr const ll &value() const noexcept {return val;}
    constexpr modint operator+(const modint &r) const noexcept{return modint(*this)+=r;}
    constexpr modint operator-(const modint &r) const noexcept{return modint(*this)-=r;}
    constexpr modint operator*(const modint &r) const noexcept{return modint(*this)*=r;}
    constexpr modint operator/(const modint &r) const noexcept{return modint(*this)/=r;}
    constexpr modint& operator+=(const modint &r) noexcept{
    val += r.val;
    if(val >= mod){
        val -= mod;
    }
    return *this;
    }
    constexpr modint& operator-=(const modint &r) noexcept{
    if(val < r.val){
        val += mod;
    }
    val -= r.val;
    return *this;
    }
    constexpr modint& operator*=(const modint &r) noexcept{
    val = val * r.val % mod;
    return *this;
    }
    constexpr modint& operator/=(const modint &r) noexcept{
    ll a=r.val,b=mod,u=1,v=0;
    while (b) {
        ll t = a/b;
        a -= t*b;swap(a,b);
        u -= t*v;swap(u,v);
    }
    val = val * u % mod;
    if(val < 0)val += mod;
    return *this;
    }
    constexpr bool operator == (const modint& r) const noexcept {
    return this->val == r.val;
    }
    constexpr bool operator < (const modint& r) const noexcept {
    return this->val < r.val;
    }
    constexpr bool operator != (const modint& r) const noexcept {
    return this->val != r.val;
    }
    friend constexpr ostream& operator << (ostream &os, const modint<mod>& x) noexcept {
    return os << x.val;
    }
    friend constexpr modint<mod> modpow(const modint<mod> &a,ll n) noexcept {
    if(n == 0) return 1;
    auto t = modpow(a, n / 2);
    t = t * t;
    if(n & 1) t = t * a;
    return t;
    }
};

using mint = modint<MOD>;

signed main(){
    ll n,a,b;cin >> n >> a >> b;
    const mint x=2;
    mint ans=modpow(x,n);//cout << 1 << endl;
    ans-=1;
    //cout << 1 << endl;
    vector<mint> com(b+1);
    FOR(i,1,b){
        if(i==1){
            com[i]=n;
        }else{
            com[i]=com[i-1];
            com[i]*=(n-i+1);
            com[i]/=i;
        }
    }
    ans=ans-com[a]-com[b];
    cout << ans << endl;
}

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

int main()
{
  int N;
  cin >> N;
  vector<int> A(N);
  for (int i = 0; i < N; i++) cin >> A.at(i);
  sort(A.begin(), A.end());
  vector<pair<int, int> > B;
  set<int> ans_check;
  B.push_back(make_pair(A.at(0), 1));
  int index = 0;
  for (int i = 1; i < N; i++)
  {
    if (B.at(index).first == A.at(i)) B.at(index).second++;
    else
    {
      index++;
      B.push_back(make_pair(A.at(i), 1));
      ans_check.insert(A.at(i));
    }
  }
  int ans = 0;
  bool check;
  for (int i = 0; i < B.size(); i++)
  {
    check = true;
    if (B.at(i).second != 1) continue;
    else
    {
      for (int j = 0; j < i; j++)
      {
        if (B.at(i).first % B.at(j).first == 0)
        {
          check = false;
          break;
        }
        if (B.at(j).first > sqrt(B.at(i).first))
        {
          int tmp = 2;
          while (true)
          {
            if (tmp > sqrt(B.at(i).first) ) break;
            else if (B.at(i).first % tmp != 0)
            {
              tmp++;
              continue;
            }
            else
            {
              int tmp2 = B.at(i).first / tmp;
              if (ans_check.count(tmp2))
              {
                check = false;
                break;
              }
              else
              {
                tmp++;
              }
            }
          }
          break;
        }
      }
      if (check) ans++;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 15000
import heapq
from collections import defaultdict

N, M = list(map(int, input().split()))
A = sorted(list(map(int, input().split())))
B = sorted(list(map(int, input().split())))

D = defaultdict(int)
c = 1
hh = 0
for i in range(N):
	for j in range(M):
		if A[i] != B[j]:
			d = min(A[i], B[j])
			D[d] += 1
			hh += 1

ds = sorted(D.items())
X = []
for i in range(len(ds)):
	X += [ds[i][0]] * ds[i][1]


a = A[0]
for i in range(N - 1):
	if A[i + 1] == a:
		c = 0
		break
	a = A[i + 1]

b = B[0]
for i in range(M - 1):
	if B[i + 1] == b:
		c = 0
		break
	b = B[i + 1]

AA = []
BB = []
CC = []

for i in range(N):
	if A[i] in B:
		CC.append(A[i])
		B.remove(A[i])
	else:
		AA.append(A[i])

BB = B

xB = sorted(BB + CC)
xA = sorted(AA + CC)

for i in range(len(AA)):
	cc = 0
	for j in range(len(xB)):
		if xB[-1 - j] <= AA[i]:
			break
		else:
			cc += 1
	c = c * cc

for i in range(len(BB)):
	cc = 0
	for j in range(len(xA)):
		if xA[-1 - j] <= BB[i]:
			break
		else:
			cc += 1
	c = (c * cc) % 1000000007

if c != 0:
	if X != []:
		x = 0
	m = 0
	cnt = 0
	for i in range(hh):
		zzz = X[i]
		j = "G"
		if AA != []:
			if zzz == AA[0]:
				AA.remove(zzz)
				j = "N"
		if BB != []:
			if zzz == BB[0]:
				BB.remove(zzz)
				j = "N"

		if j == "G":
			if zzz != x:
				m += 1
			c = (c * (zzz - cnt - m)) % 1000000007
			cnt += 1
			x = zzz

print(c)

Measured memory_bytes: 11636
#include<bits/stdc++.h>
using namespace std;
#define ll   long long int
void swap(int& a,int& b)
{
	int temp;
	temp=a;
	a=b;
	b=temp;
}
 int main()
{
ll n;
string s,t;
cin>>n;
cin>>s>>t;
string ans;
for(int i=0;i<n;i++)
{
	ans+=s[i];
	ans+=t[i];
}
cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
	int H= 1,W = 1;
	int i=0,j=0,q =0;
	

	while(H != 0 && W != 0){
			scanf("%d",&H);
			scanf("%d",&W);
			if(H == 0 && W == 0){
				break;
			}

		for(i=0;i<H;i++){
			if(i%2 == 0){
				q = 1;
			}
			else{
				q = 0;
			}
			for(j=0;j<W;j++){
			
				if(q == 1){
					if(j%2 == 0){
						printf("#");
					}
					else{
						printf(".");
					}
				}
				else if(q == 0){
					if(j%2 == 0){
						printf(".");
					}
					else{
						printf("#");
					}
				}
				
			}
		
			printf("\n");
		
		}
		printf("\n");
	}
	

	return 0;
}

Measured memory_bytes: 572
n, k = map(int, raw_input().split())
a = [input() for i in range(n+k)]
c = [0]*n
for i in range(n,n+k):
    for j in range(n):
        if a[i] >= a[j]:
            c[j] += 1
            break
print c.index(max(c)) + 1

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

int main(){
  int N;
  cin>>N;
  float v[N];
  for (int i=0;i<N;i++){
    cin>>v[i];
  }
  for (int i=0;i<N;i++){
    cin>>v[i];
  }
  sort(v,v+N);
  float sum=v[0];
  for (int i=1;i<N;i++){
    sum=(sum+v[i])/2;
  }
  cout<<setprecision(10)<<sum<<endl;

  return 0;
}


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

using namespace std;

class Node {
public:
	int pos, chg, cost;
	Node(int pos, int chg, int cost) : pos(pos), chg(chg), cost(cost) {}
	bool operator < (const Node &nd) const { return cost > nd.cost; }
};

int main(){
	int n, m, c;
	static int len[100][100];
	while(cin >> n >> m >> c, n){
		vector< vector< pair<int,int> > > g(n);
		for(int i=0;i<m;i++){
			int f, t, c; cin >> f >> t >> c;
			g[f-1].push_back(make_pair(t-1, c));
		}
		for(int i=0;i<n;i++)
			for(int j=0;j<n;j++) len[i][j] = 1000000000;
		priority_queue<Node> qu; qu.push(Node(0, 0, 0));
		len[0][0] = 0;
		while(!qu.empty()){
			Node nd = qu.top(); qu.pop();
			int pos = nd.pos, chg = nd.chg, cost = nd.cost;
			if(len[pos][chg] < cost) continue;
			for(int i=0;i<g[pos].size();i++){
				int next = g[pos][i].first;
				if(len[next][chg] > len[pos][chg]+g[pos][i].second){
					len[next][chg] = len[pos][chg]+g[pos][i].second;
					qu.push(Node(next, chg, len[next][chg]));
				}
				if(chg+1 < n && len[next][chg+1] > len[pos][chg]){
					len[next][chg+1] = len[pos][chg];
					qu.push(Node(next, chg+1, len[next][chg+1]));
				}
			}
		}
		for(int i=1;i<n;i++){
			if(len[n-1][i] <= c){
				cout << i << endl;
				break;
			}
		}
	}
}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
#define endl "\n"
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
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;
}

const long long INF = 1e18;
//const ll mod = 1000000007;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N;
    cin >> N;
    bool a = false;
    ll ans = 1;
    while(N--) {
        ll b;
        cin >> b;
        if(b == 0) {
            cout << 0 << endl;
            return 0;
        }
        if(INF / b < ans) a = true;
        ans *= b;
    }
    if(a) ans = -1;
    if(ans > INF) ans = -1;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3652
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <tuple>
#include <map>
#define rep(i,n) for (int i = 0; i <= (n); i++)
typedef long long ll;


bool f(int x) {
	int keta = 0;
	while (x) {
		keta++;
		x /= 10;
	}
	return keta % 2 == 1;
}

using namespace std;
int main()
{
	int ans = 0, n;
	cin >> n;
	for (int i = 1; i <= n; i++) {
		if (f(i)) ans++;
	}
	cout << ans << endl;

}

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

#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define BIT(X,i) ((X>>i)&1)
#define REP(i,a,b) for(int i = (a); i < (b); ++i)
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define SORT(a) sort(all(a))
#define RSORT(a) sort(rall(a))
#define ina(x,n) rep(x_i,n) cin>>x[x_i]
#define outa(x,n) rep(x_i,n) cerr<<x[x_i]<<" \n"[x_i==n-1]

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll, ll> pll;
typedef vector<pll> vll;

const int mod = 1e9+7;
const int inf = (1<<28);
const ll infl = (1LL<<60);

int main() {
  int h, a; cin >> h >> a;
  cout << (h+a-1)/a << endl;
  return 0;
}


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

#ifdef NON_SUBMIT
#define TEST(n) (n)
#define tout cerr
#else
#define TEST(n) ((void)0)
#define tout cin
#endif

using namespace std;

int idx[128], cnt[2][4];

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
	TEST(freopen("input.txt", "r", stdin));
	TEST(freopen("output.txt", "w", stdout));
	TEST(freopen("debug.txt", "w", stderr));
	int H, W, N, x, y;
	string s, t;
	cin>>H>>W>>N>>x>>y>>s>>t;
	idx['R']=0; idx['D']=1; idx['L']=2; idx['U']=3;
	for(int i=0;i<N;i++) {
		cnt[0][idx[s[i]]]++;
		if(y+cnt[0][0]-cnt[1][2]>W || x+cnt[0][1]-cnt[1][3]>H || y-cnt[0][2]+cnt[1][0]<1 || x-cnt[0][3]+cnt[1][1]<1) {
			cout<<"NO\n";
			return 0;
		}
		cnt[1][idx[t[i]]]++;
		for(int i=0;i<4;i++) {
			int m=min(cnt[0][i],cnt[1][(i+2)&3]);
			cnt[0][i]-=m;
			cnt[1][(i+2)&3]-=m;
		}
		cnt[1][0]=min(cnt[1][0],W-y);
		cnt[1][1]=min(cnt[1][1],H-x);
		cnt[1][2]=min(cnt[1][2],y-1);
		cnt[1][3]=min(cnt[1][3],x-1);
	}
	cout<<"YES\n";
	return 0;
}

Measured memory_bytes: 920
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#define rep(i,n) for(int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
int main()
{
    double n, ans;
    cin >> n;
    vector<double> a(n);
    rep(i,n) cin >> a[i];
    sort(a.begin(), a.end());
    ans = a[0];
    rep(i,n-1) ans = (ans+a[i+1])/2;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#ifdef LOCAL
    #define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
    #define eprintf(...) 42
#endif // LOCAL
int n, a, b;
void showbit(int x){
    vector<char> v;
    for(; x > 0 ; x >>= 1){
        v.emplace_back('0' + (x & 1));
    }
    if(v.empty())return (void)(eprintf("0"));
    for(auto it = v.rbegin(); it != v.rend(); ++ it)
        eprintf("%c",*it);
    eprintf(" ");
}
int cutbit(int x, int bit){
    int now = (x - ((x >> bit) << bit));
    int res = ((x >> (bit + 1)) << bit) + now;
    return res;
}
int ins(int x, int bit, bool c){
    ///1110000 x ?????
    int now = x  - ((x >> bit) << bit);
    int res = ((x >> bit) << (bit + 1)) + now;
    return c ? (res ^ (1 << bit)) : res;
}
vector<int> rec(int a, int b, int curbit){
    if(curbit == 0){
        return {a , b};
    }
    int g = a ^ b, idx = -1;
    for(int i = 0 ; i < n ;i++){
        if(g & (1 << i)){
            idx = i;
            break;
        }
    }
    int x = cutbit(a, idx); int y = cutbit(b, idx);
    int z = x ^ 1;
    auto u = rec(x, z, curbit - 1) ;
    auto v = rec(z, y, curbit - 1) ;

    if(a & (1 << idx)){
        for(int &i : u)
            i = ins(i, idx, true);
        for(int i : v)
            u.push_back(ins(i, idx, false));
    }
    else{
        for(int &i : u)
            i = ins(i, idx, false);
        for(int i : v){
            u.push_back(ins(i, idx, true));
        }
    }
    return u;
}

int main(){
    scanf("%d %d %d", &n, &a , &b);
    if(! ( (__builtin_popcount(a) % 2) ^ (__builtin_popcount(b) % 2) ))
        return !printf("NO");
    auto ans = rec(a, b, n - 1);
    printf("YES\n");
    for(int i = 0 ; i < (int)ans.size() ; i++){
        printf("%d ",ans[i]);
    }
}
/**

*/


Measured memory_bytes: 1648
/*   --------------------
    |       LOSER        |
    |     ~NOOBOSS~      |
     --------------------
*/
#include <bits/stdc++.h>
using namespace std;

#define      inl(x)              scanf("%lld",&x)
#define      in(x)               scanf("%d",&x)
#define      mxx                 10000000000000
#define      mnn                 -10000000000000
#define      Y()                 cout<< "YES" <<endl
#define      N()                 cout << "NO"<<endl
#define      endl                "\n"
#define      max_3(a,b,c)        max(a, max(b,c))
#define      max_4(a,b,c,d)      max(a,max(b,max(c,d)))
#define      min_3(a,b,c)        min(a, min(b,c))
#define      min_4(a,b,c,d)      min(a,min(b,min(c,d)))
#define      gcd(a,b)            __gcd(a,b)
#define      lcm(a,b)           (a*b)/gcd(a,b)
#define      loser               return 0
#define      ll                  long long
#define      PI                  acos(-1)
#define      mem(a,v)            memset(a,v,sizeof(a))
#define      SORT(v)             sort(v.begin(),v.end())
#define      REV(v)              reverse(v.begin(),v.end())
#define      O(x)                cout<<x<<endl
#define      B                   begin()
#define      E                   end()
#define      V                   vector
#define      F                   first
#define      S                   second
#define      PSB                 push_back
#define      EMB                 emplace_back
#define      MP                  make_pair
#define      PII                 pair<int,int>
#define      MII                 map<int,int>
#define      FAST()              ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
const ll MOD = 998244353;
//auto it=std:: unique(v.B,v.E);
//v.resize(std::distance(v.B,it));
int dx[] = {0,0,1,-1};
int dy[] = {1,-1,0,0};
/*-----*/
#define bug1(a)  cout<<a<<endl;
#define bug2(a,b)  cout<<a<<" "<<b<<endl;
#define bug3(a,b,c)  cout<<a<<" "<<b<<" "<<c<<endl;
/*----*/
ll power(ll n,ll p){if(p==0) return 1;if(p==1)return n;if(p%2)return power(n,p-1)*n;else{ll x=power(n,p/2);return x*x;}}
ll binpow(ll a, ll b){ll res = 1;while (b > 0) {if (b & 1)res*=a;a*=a;b>>=1;}return res;}
ll fact(ll num){ll fac=1;while(num!=1){fac=fac*num;num--;}return fac;}
string to_binary(int x) {string s;while(x > 0) {s += (x % 2 ? '1' : '0');x /= 2;}reverse(s.begin(), s.end());return s;}
ll nsum(ll num){return (num*(num+1))/2;}
/*-----*/
const int N=2e5+5;

/*-----*/
//vector<int> v[202];

/*-----*/
int main()
{
	FAST();

       ll test=1;
       //cin>>test;
       while(test--){
           ll n;
           string s;
           cin>>n;
           ll ar[n+5],ans[n+5];
           int xxor=0;
           for(int i=0;i<n;i++){
            cin>>ar[i];
            xxor^=ar[i];
           }
           for(int i=0;i<n;i++){
            ans[i]=xxor^ar[i];
            cout<<ans[i]<<' ';
           }

        }
	loser;
}
///////LeArN MoRe AnD Wait FoR ThE Result///////


Measured memory_bytes: 6732
#include<stdio.h>

int main(){

	int H,W,i,j;	

	while(1){
		scanf("%d %d\n",&H,&W);
		if(H==0 && W==0) break;

	for(i=0;i<H;i++){
		for(j=0;j<W;j++){
			if((i+j)%2==1)
				printf(".");
			else 
				printf("#");
		}
		printf("\n");
	}

	printf("\n");


	}
	return 0;
}

Measured memory_bytes: 576
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

typedef struct node{
	int key;
	struct node *next;
	struct node *prev;
}Node;

Node *nil;

void init(){
	nil=(Node *)malloc(sizeof(Node));
	nil->next=nil;
	nil->prev=nil;
}

void insert(int key){
	Node *new = (Node *)malloc(sizeof(Node));
	new->key=key;
	new->next=nil->next;
	nil->next->prev=new;
	nil->next=new;
	new->prev=nil;
}


void deleteNode(Node *d){
	if(d==nil)return;
	d->prev->next=d->next;
	d->next->prev=d->prev;
	free(d);
}

void deleteKey(int key){
	Node *now=nil->next;
	while(now!=nil && now->key!=key){
		now=now->next;
	}
	deleteNode(now);
}




void deleteFirst(){
	deleteNode(nil->next);
}

void deleteLast(){
	deleteNode(nil->prev);
}



int main(void)
{
	int i,n,key,j=0;
	char order[12];
	Node *now;
	
	
	scanf("%d",&n);
	init();
	
	for(i=0;i<n;i++){
		scanf("%s %d",order,&key);
		if(order[0]=='i')insert(key);
		else if(order[0]=='d'){
			if(order[6]=='F')deleteFirst();
			else if(order[6]=='L')deleteLast();
			else deleteKey(key);
		}
	}
	
	now=nil->next;
	while(1){
		if(now==nil)break;
		if(j>0)printf(" ");
		printf("%d",now->key);
		now=now->next;
		j++;
	}
	printf("\n");
	return 0;
}

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

namespace ABC106
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] a = Console.ReadLine().Split().Select(int.Parse).ToArray();
            Console.WriteLine((a[0] - 1) * (a[1] - 1));
        }
    }
}


Measured memory_bytes: 13268
#include <bits/stdc++.h> 
#define MOD 1000000007
using namespace std;
 
typedef long long int ll;
typedef unsigned long long ull;
int dp[100002];

int main(){

    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin) ;
    freopen("output.txt", "w", stdout) ;
    #endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL) ; cout.tie(NULL) ;
    int n;
    cin >> n;    
    int ar[n];
    for(int i = 0;i<n;i++)cin >> ar[i];
    dp[0] = 0;
    dp[1] = abs(ar[0]-ar[1]);
    for(int i = 2; i <= n; i++){
        dp[i] = min(dp[i-1]+abs(ar[i]-ar[i-1]),dp[i-2]+abs(ar[i]-ar[i-2]));
    }
    cout << dp[n-1]<<endl;
        
}


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

int main(){
  string s,t ;
  cin >> s >> t ;
  if(s.at(0)==t.at(2)&&s.at(1)==t.at(1)&&s.at(2)==t.at(0)) cout << "YES" << endl ;
  else cout << "NO" << endl ;
}

Measured memory_bytes: 256
/*~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=
*$* WRITER:kakitamasziru/OxOmisosiru *$*
~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=*/
#ifdef LOCAL_JUDGE
#define _GLIBCXX_DEBUG //FOR THE DEBUG! COMMENT OUT THIS WHEN SUBMITTING!
#endif
/* I REALLY HOPE MY WISH REACH YOU , ATCODER'S ONLINE JUDGE */
#define WOULD
#define YOU
#define PLEASE
#define ACCEPT
#define MY
#define SUBMISSION
/* I REALLY HOPE MY WISH REACH YOU , ATCODER'S ONLINE JUDGE */
#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 <iomanip>
#include <limits>//setprecision
//#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <math.h>//pow,,,
#include <cmath>//abs,,,
#include <bitset> // bitset
//It is so troublesome that I include bits/stdc++.h !
using namespace std;

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
const long long INF = 100100100100;
const long long MOD = 1000000007;
typedef pair<int,int> P;

//Solve N^M. This, mod_pow use Iterative Square Method.
long long mod_pow(long long N, long long M) {
    if (M == 0) return 1;
    long long res = mod_pow((N * N) % MOD, M / 2);
    //最下位ビット(*N)が1の時は単独でNをかける
    if (M & 1) res = (res * N) % MOD;

    return res %= MOD;
}

long long gcd(long long a, long long b) {
    if (b == 0) return a;
    else return gcd(b, a % b);
}
long long lcm(long long a, long long b) {
    return a * b / gcd(a, b);
}

int main() {
    long long A,B,C,D;cin >> A >> B >> C >> D;
    long long N;cin >> N;
    long long one = min({A*4,B*2,C});
    long long two = min({A*8,B*4,C*2,D});
    if(N % 2 == 0){
        cout << two*(N/2) << endl;
    }
    else{
        cout << two*(N/2)+one << endl;
    }
}

Measured memory_bytes: 256
<?php
 
list($n) = explode(" ", trim(fgets(STDIN)));
list($s) = explode(" ", trim(fgets(STDIN)));

$x = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
$x = str_split($x);

$len = strlen($s);
for($i=0; $i<$len; $i++){
  $key = array_search($s[$i], $x);
  echo $x[($key+$n)%26];
}

Measured memory_bytes: 4604
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
const double EPS = 1e-9;
#define INF (1LL<<60)
#define D double
#define fs first
#define sc second
#define int long long
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define RFOR(i,a,b) for(int i = (int)(b-1);i>=(int)(a);--i)
#define REP(i,n)  FOR(i,0,(n))
#define RREP(i,n) RFOR(i,0,(n))
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define RITR(itr,mp) for(auto itr = (mp).rbegin(); itr != (mp).rend(); ++itr)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x)  cout << #x << " = " << (x) << endl;
#define SP << " " << 
typedef pair<int,int> P;
typedef vector<int> vec;
typedef vector<vector<int>> mat;
 
signed main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.precision(20);

  string a, b;
  cin >> a >> b;

  if(a.length() > b.length()){
    cout << "GREATER" << endl;
  }
  else if(a.length() < b.length()){
    cout << "LESS" << endl;
  }
  else{
    if(a == b){
      cout << "EQUAL" << endl;
    }
    else{
      REP(i, a.length()){
        if(a[i] > b[i]){
          cout << "GREATER" << endl;
          break;
        }
        else if(a[i] < b[i]){
          cout << "LESS" << endl;
          break;
        }
      }
    }
  }

  return 0;
}

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

std::string S;
long long calc(int p) {
    unsigned char len = S.length();
    long long temp = 0;
    long long ans = 0;
    for(int i=0; i < len; ++i){
        temp = temp*10 + (S[i] - '0');
        if( (p >> (len-i-2)) & 0x01 ) {
            ans += temp;
            temp = 0;
        }
    }
    ans += temp;
    return ans;
}

int main(void){
    std::cin >> S;

    long long ans = 0;
    for(long i=0; i<std::pow(2, S.length()-1); i++) {
        ans += calc(i);
    }
    std::cout << ans << std::endl;
}


Measured memory_bytes: 512
#include <iostream>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <limits>
#include <algorithm>
#include <functional>

using namespace std;

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

	int N, M;
	cin >> N >> M;

	if (N == M)
	{
		cout << "Yes";
	}
	else
	{
		cout << "No";
	}

	return 0;
}


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

#include <atcoder/all>

#define rep(i, n) for (int i = 0; i < (n); i++)

using namespace std;
using namespace atcoder;

using ll = long long;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  while (n--) {
    cout << "ACL";
  }
  cout << '\n';
  return 0;
}

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

int main() {
   string S;
  while(cin>>S&&S.at(0)!='0'){
    int ans=0;
   for(int i=0;i<S.size();i++){
     ans+=S.at(i)-'0';}
  cout<<ans<<endl;}
  return 0;
}


Measured memory_bytes: 3232
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		//???????????????????????????
		int count =0;
		//????????£????????????
		Scanner sc =  new Scanner(System.in);
		while(true){
			//???????????°
			int n = sc.nextInt();
			//???????????????
			int  x = sc.nextInt();
			//??\???????????????????????±0?????£????????????
			if( n==0 && x ==0){
				break;
			}
			//??????????¶???????
			//???+???+??? //???+???+1+???+2 ??§?¨???? ???????????°????????????
			for( int i=1; i<= n; i++){
				for(int j=i+1; j<=n;j++){
					for(int k=j+1;k<=n;k++){
						//??¨???????§£???????????¨?????´????????´???
						if(i+j+k == x){
							count++;
						}
					}
				}
			}
			System.out.println(count);
			//????????????????????????
			count =0;
		}
	}
}

Measured memory_bytes: 26824
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define oo 0x3f3f3f3f

int main()
{
    ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    vector<int>spf(1e6+1);
    for(int i=0; i<spf.size(); i++)
        spf[i]=i;

    for(int i=2; i<spf.size(); i++)
        if(spf[i]==i)
        for(int j=2*i; j<spf.size(); j+=i)
        if(spf[j]==j)spf[j]=i;

    vector<int>f(1e6+1);
    int gcd = 0;

    int n;
    cin>>n;
    vector<int>A(n);
    int idx = 0;

    bool pairwise = true;

    for(int&x:A)
    {
        idx++;
        cin>>x;
        if(gcd!=1)gcd = __gcd(gcd,x);
        while( x > 1 && pairwise)
        {
            if(f[spf[x]] > 0 && f[spf[x]] != idx)pairwise = 0;
            f[spf[x]]=idx;
            x/=spf[x];
        }
    }

    if(pairwise)return cout<<"pairwise coprime\n",0;
    if(gcd == 1)return cout<<"setwise coprime\n",0;
    cout<<"not coprime";
}


Measured memory_bytes: 15076
package main

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

func main() {
	sc := newScanner()
	var d = sc.readInt()
	var t = sc.readInt()
	var s = sc.readInt()
	if t*s >= d {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}

//////////////////
//////////////////
//////////////////

func abs(x int) int {
	if x >= 0 {
		return x
	}
	return -x
}

func min(values ...int) int {
	if len(values) == 0 {
		panic("no values")
	}

	min := values[0]
	for _, v := range values {
		if v < min {
			min = v
		}
	}
	return min
}

func max(values ...int) int {
	if len(values) == 0 {
		panic("no values")
	}

	max := values[0]
	for _, v := range values {
		if v > max {
			max = v
		}
	}
	return max
}

func pow(base, exponent int) int {
	if exponent < 0 {
		panic(fmt.Sprintf("exponent (%d) should not be a minus", exponent))
	}

	answer := 1
	for i := 0; i < exponent; i++ {
		answer *= base
	}
	return answer
}

func ceil(divident, dividor int) int {
	if dividor == 0 {
		panic("dividor should not be 0")
	}

	quo := divident / dividor
	rem := divident % dividor

	if rem != 0 {
		if (divident > 0 && dividor > 0) ||
			(divident < 0 && dividor < 0) {
			return quo + 1
		}
	}
	return quo
}

// -   sortutil

func reverseInts(a []int) {
	sort.Sort(sort.Reverse(sort.IntSlice(a)))
}

func reverseStrings(a []string) {
	sort.Sort(sort.Reverse(sort.StringSlice(a)))
}

// -   io

type scanner struct {
	bufScanner *bufio.Scanner
}

func newScanner() *scanner {
	bufSc := bufio.NewScanner(os.Stdin)
	bufSc.Split(bufio.ScanWords)
	bufSc.Buffer(nil, 100000000)
	return &scanner{bufSc}
}

func (sc *scanner) readString() string {
	bufSc := sc.bufScanner
	bufSc.Scan()
	return bufSc.Text()
}

func (sc *scanner) readInt() int {
	bufSc := sc.bufScanner
	bufSc.Scan()
	text := bufSc.Text()

	num, err := strconv.Atoi(text)
	if err != nil {
		panic(err)
	}
	return num
}

func (sc *scanner) readInt64() int64 {
	bufSc := sc.bufScanner
	bufSc.Scan()
	text := bufSc.Text()

	num, err := strconv.ParseInt(text, 10, 64)
	if err != nil {
		panic(err)
	}
	return num
}


Measured memory_bytes: 1772
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#include<map>
#include<iomanip>
#include<queue>
#include<stack>
#include<time.h>
#define rep(i,n)for(ll i=0;i<n;i++)
#define ll long long
#define ggr getchar();getchar();return 0;
#define prique priority_queue
#define inf 1145141919364364
#define double long double
using namespace std;
typedef pair<ll, ll>P;
ll gcd(ll x, ll y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
ll lcm(ll x, ll y) {
	return x * y / gcd(x, y);
}
signed main() {
	ll n, k;
	cin >> n >> k;
	if (k == 1)cout << 0 << endl;
	else cout << n - k << endl;
	ggr
}


Measured memory_bytes: 892
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>
#include<cstdio>
#include<cmath>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
int MOD=1000000007;
signed main(){
    int n;cin>>n;
    if(n==1)cout<<"Hello World"<<endl;
    else {
        int a,b;cin>>a>>b;
        cout<<a+b<<endl;
    }
    return 0;
}

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

int main()
{
	long long n;
	cin >> n;
	long long int ans = 0;
	for(long long int i = 1; i * i <= n; ++i){
		if(((n - i) % i == 0 &&  (n - i) / i > i)) ans += ((n - i) / i);
	}
	cout << ans << endl;
	return 0;
}

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

int main()
{
 	std::ios_base::sync_with_stdio(false);
  	cin.tie(0);
  lli a,b,c;
  cin>>a>>b>>c;
  lli m=max(a,b);
  m=max(c,m);
  lli ans=1;
  ans*=a;
  ans*=b;
  ans*=c;
  ans/=m;
  ans/=2;
  cout<<ans;
  return 0;
}

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

int main()
{
    long long x, L;
    long long count = 0;
    long long n;
    cin >> x;
    for (int i = 1; i < 200000; i++)
    {
        if ((i * (i + 1)) / 2 >= x)
        {
           
            n=i;
            break;
        }
    }
    cout<<n<<endl;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){ 

  int  a,b;

  cin>>a>>b;

  if(a<b){cout<<"a < b"<<endl;}

  if(a>b){cout<<"a > b"<<endl;}

  if(a==b){cout<<"a == b"<<endl;}

     return 0;

}

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

#define MOD 1000000007
#define rep(i, n) for(ll i=0; i < (n); i++)
#define ALL(v) v.begin(),v.end()
#define DUMP(i, v)for(ll i=0;i<v.size();i++)cout<<v[i]<<" "

using namespace std;
typedef long long int ll;
typedef vector<ll> llvec;
typedef vector<double> dvec;
typedef pair<ll, ll> P;
struct Edge{ll from, to, cost;};
struct node{ll cost, to;
  bool friend operator>(node a, node b){
    return a.cost>b.cost;
  }
};

ll mod(ll a, ll mod){
  ll res = a%mod;
  if(res<0)res=res + mod;
  return res;
}

ll modpow(ll a, ll n, ll mod){
  ll res=1;
  while(n>0){
    if(n&1) res=res*a%mod;
    a=a*a%mod;
    n>>=1;
  }
  return res;
}

ll modinv(ll a, ll mod){
  return modpow(a, mod-2, mod);
}

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

bool is_prime(ll n){
  ll i = 2;
  if(n==1)return false;
  if(n==2)return true;
  bool res = true;
  while(i*i <n){
    if(n%i==0){
      res = false;
    }
    i = i+1;
  }

  //if(i==1)res = false;
  if(n%i==0)res=false;
  return res;
}


/**************************************
** A main function starts from here  **
***************************************/
int main(){
  ll N, M;
  cin >> N >> M;
  llvec X(M);
  rep(i, M){
    cin >> X[i];
  }

  sort(ALL(X));

  llvec d;
  rep(i, M-1){
    d.push_back(X[i+1]-X[i]);
  }
  sort(ALL(d));
  ll ans =0;
  rep(i, max(0LL, M-N)){
    ans += d[i];
  }
  cout << ans;
  return 0;
}


Measured memory_bytes: 2168
#include <bits/stdc++.h>
#define il inline
#define RG register
#define ll long long
#define inf (1LL<<60)
#define N (200005)

using namespace std;

struct edge{ int nt,to,dis; }g[N<<1];
struct E{ int u,v; ll w; }e[N*30];

int head[N],vis[N],son[N],sz[N],fa[N],a[N],n,num,tot;
ll dis[N],ans;

vector<int> st;

il int gi(){
  RG int x=0,q=1; RG char ch=getchar();
  while ((ch<'0' || ch>'9') && ch!='-') ch=getchar();
  if (ch=='-') q=-1,ch=getchar();
  while (ch>='0' && ch<='9') x=x*10+ch-'0',ch=getchar();
  return q*x;
}

il void insert(RG int from,RG int to,RG int dis){
  g[++num]=(edge){head[from],to,dis},head[from]=num; return;
}

il void getrt(RG int x,RG int p,RG int &rt){
  sz[x]=1,son[x]=0;
  for (RG int i=head[x],v;i;i=g[i].nt){
    v=g[i].to; if (v==p || vis[v]) continue;
    getrt(v,x,rt),sz[x]+=sz[v];
    son[x]=max(son[x],sz[v]);
  }
  son[x]=max(son[x],son[0]-sz[x]);
  if (son[rt]>=son[x]) rt=x; return;
}

il void getdis(RG int x,RG int p){
  st.push_back(x),sz[x]=1;
  for (RG int i=head[x],v;i;i=g[i].nt){
    v=g[i].to; if (v==p || vis[v]) continue;
    dis[v]=dis[x]+g[i].dis,getdis(v,x),sz[x]+=sz[v];
  }
  return;
}

il void solve(RG int x,RG int S){
  RG int rt=0; son[0]=S,getrt(x,0,rt),vis[rt]=1;
  st.clear(),dis[rt]=0,getdis(rt,0); RG ll res=inf; RG int p=0;
  for (RG int v : st) if ((dis[v]+=a[v])<res) res=dis[v],p=v;
  for (RG int v : st) e[++tot]=(E){p,v,res+dis[v]};
  for (RG int i=head[rt];i;i=g[i].nt)
    if (!vis[g[i].to]) solve(g[i].to,sz[g[i].to]);
  return;
}

il int cmp(const E &a,const E &b){ return a.w<b.w; }

il int find(RG int x){ return fa[x]==x ? x : fa[x]=find(fa[x]); }

int main(){
  n=gi(); for (RG int i=1;i<=n;++i) a[i]=gi(),fa[i]=i;
  for (RG int i=1,u,v,w;i<n;++i)
    u=gi(),v=gi(),w=gi(),insert(u,v,w),insert(v,u,w);
  solve(1,n),sort(e+1,e+tot+1,cmp);
  for (RG int i=1,x,y,k;i<=tot;++i){
    x=find(e[i].u),y=find(e[i].v); if (x==y) continue;
    ans+=e[i].w,fa[x]=y,++k; if (k==n-1) break;
  }
  cout<<ans; return 0;
}


Measured memory_bytes: 71796
#include <bits/stdc++.h>
using namespace std;
struct Edge {
    int to;     // 辺の行き先
    int weight; // 辺の重み
    Edge(int t, int w) : to(t), weight(w) { }
};
using Graph = vector<vector<Edge>>;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define reprep(i,j,w,h) rep(j,h)rep(i,w)
#define rrep(i,m, n) for(int i = m; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define aall(x,n) (x).begin(),(x).begin()+(n)
#define VEC(type,name,n) std::vector<type> a(n);rep(i,n)std::cin >> a[i];
#define pb push_back
#define pf push_front
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define sum accumulate
#define keta fixed<<setprecision
#define vvector(name,typ,m,n,a)vector<vector<typ> > name(m,vector<typ> (n,a))
#define vvvector(name,t,l,m,n,a) vector<vector<vector<t> > > name(l, vector<vector<t> >(m, vector<int>(n,a)));
typedef long long ll;
const int INF = 2000000000;
const long INF64 = 1000000000000000ll;
const ll MOD = 1000000007LL;
int main(){
    string s;
    std::cin >> s;
    int le=s.size();
    int co=0;
    rep(i,le/2){
        if(s[i]!=s[le-i-1]){
            co++;
        }
    }
    std::cout << co << std::endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	long long  n,r,b;
	cin>>n>>b>>r;
	long long  k=n/(r+b);
	//cout<<k<<endl;
	long long  s=n%(r+b);
	//cout<<s<<endl;
	long long  d;
	if(s>b){
		d=b;
	}else{
		d=s;
	}
	cout<<(k*b)+d<<endl;
}

Measured memory_bytes: 256
#include<stdio.h>

    int main()
    {
        int n;
        scanf("%d",&n);
        int a[200000],i;
        long long b[200000]={0},x;
        for (i=0;i<n;i++)
        {
            scanf("%d",&a[i]);
            //a[i]=a[i]-1;
            b[a[i]]++;
        }
        for (i=0;i<=n;i++)
        {
            x=x+b[i]*(b[i]-1)/2;
        }
        long long s;
        for (i=0;i<n;i++)
        {
            s=x;
            s=s-(b[a[i]]*(b[a[i]]-1)/2);
            s=s+(b[a[i]]-1)*(b[a[i]]-2)/2;
            printf("%lld\n",s);
        }
        return 0;
    }


Measured memory_bytes: 4864
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <unordered_map>
#define rep(i,n) for (int i=0; i<n;++i)
#define rep_down(i,n) for (int i=n-1; i>=0;--i)
typedef long long ll;
using namespace std;
typedef pair<int, ll> P;
const ll MOD = 1000000007LL;
const int INF = 1000000007;
int N, Q, K;
vector<P> Tree[100003];
vector<ll> Mp(100003);

void dfs(int idx, ll cost){
  if (idx==K || Mp[idx]==0){
    Mp[idx] = cost;
    rep(i, Tree[idx].size()){
      int nxt = Tree[idx][i].first;
      if (nxt==K) continue;
      ll ct = Tree[idx][i].second;
      dfs(nxt, cost+ct);
    }
  }
}

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

  cin >> N;
  int a,b;
  ll c;
  rep(i,N-1){
    cin >> a >> b >> c;
    a--;b--;
    P p1 = make_pair(b, c);
    P p2 = make_pair(a, c);
    Tree[a].push_back(p1);
    Tree[b].push_back(p2);
  }
  cin >> Q >> K;
  K--;
  dfs(K, 0ll);
  rep(i, Q){
    cin >> a >> b;
    a--; b--;
    cout << Mp[a] + Mp[b] << "\n";
  }

  return 0;
}

Measured memory_bytes: 14336
S=input()

if len(S)!=4:
  print('No')
else:  
  Sorted_S = sorted(S)
  
  L1=Sorted_S[0]
  L2=Sorted_S[1]
  L3=Sorted_S[2]
  L4=Sorted_S[3]

  if (L1==L2) and (L3==L4) and (L2!=L3):
    print("Yes")
  else:
    print("No")


Measured memory_bytes: 3060
n = int(input())
a = list(map(int, input().split()))
a.insert(0, 0)

ans = []
box = [0] * (n+1)
for i in range(n, 0, -1):
    num = i
    sum_num = 0
    while num <= n:
        sum_num += box[num]
        num += i
    if a[i] != sum_num%2:
        ans.append(i)
        box[i] = 1

print(len(ans))
print(*ans)

Measured memory_bytes: 14032
#include<iostream>
#include<string>

using namespace std;

int main(){
	
	char word1[10];
	char word2[10];
	char word3[10];
	
	cin>>word1;
	cin>>word2;
	cin>>word3;
	
	char acronym[3];
	
	acronym[0] = toupper(word1[0]);
	acronym[1] = toupper(word2[0]);
	acronym[2] = toupper(word3[0]);
	
	cout<<acronym[0]<<acronym[1]<<acronym[2]<<endl;
	
	
	system("PAUSE");
	return 0;
}

Measured memory_bytes: 504
import sys
N, K = map(int, input().split())
arr = [0 for _ in range(10**5 + 1)]
su = 0
ans = 0

for n in range(N):
  a, b = map(int, input().split())
  arr[a] += b
  
for i in range(1, 10**5+1):
  su += arr[i]
  if su >= K:
    ans = i
    break
print(ans)

Measured memory_bytes: 5928
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iomanip>
#include <numeric>
#include <queue>
#include <cmath>
using namespace std;


int main() {
    const int mod = 1e9 + 7;
    string s;
    cin >> s;
    long long int a = 0, b = 0, c = 0;
    long long int t = 1;
    for (int i = 0; i < s.size(); i++) {
        if (s[i] == 'A') {
            a += t;
        } else if (s[i] == 'B') {
            b += a;
        } else if (s[i] == 'C') {
            c += b;
        } else {
            c = b + 3 * c;
            b = a + 3 * b;
            a = 3 * a + t;
            t = t * 3 % mod;
        }
        a %= mod;
        b %= mod;
        c %= mod;
        // res = (res + c) % mod;
        // cout << a << " " << b << " " << c << endl;
    }
    cout << c << endl;
}


Measured memory_bytes: 3732
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

int main(){
    fast;
    int H, N;
    cin >> H >> N;
    int A[N];
    for(int i = 0; i < N; i++)
        cin >> A[i];
    int sum = 0;
    for(int i = 0; i < N; i++)
    {
        sum = sum + A[i];
    }
    if(sum >= H)
        cout << "Yes";
    else
        cout << "No";

    return 0;
}


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

int main() {
  int a, b;
  cin >> a >> b;
  if (b%a==0) {
    cout << a + b << endl;
  } else {
    cout << b - a << endl;
  }
  return 0;
}

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

int main(){
	int N;
	cin >> N;
	vector<int> s(N);
	for(int i=0;i<N;i++)	cin >> s.at(i);

	int ans=0;
	bool flag=false;
	for(int i=0;i<N;i++){
		ans+=s.at(i);
		if(s.at(i)%10!=0)	flag=true;
	}
	if(!flag){
		cout << "0" << endl;
		return 0;
	}
	if(ans%10!=0){
		cout << ans << endl;
		return 0;
	}
	int mi=100;
	for(int i=0;i<N;i++){
		if(s.at(i)%10!=0)	mi=min(mi,s.at(i));
	}
	cout << ans-mi << endl;

	return 0;
}


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

int main() {
  int a, b, c, x, y;
  cin >> a >> b >> c >> x >> y;
  int ans = 2e9;
  x <<= 1, y <<= 1;
  for(int i = 0; i <= max(x, y); ++i) {
    int pos = i * c;
    if(i <= x) {
      pos += (((x - i) & 1) + (x - i) / 2) * a;
    } 
    if(i <= y) {
      pos += (((y - i) & 1) + (y - i) / 2) * b;
    }
//    printf("%d %d\n", i, pos);
    ans = min(ans, pos);
  }  
  printf("%d\n", ans);
  return 0;
}

Measured memory_bytes: 256
n, k = list(map(int, input().split()))
p = list(map(int, input().split()))


def expect(n):
    res = (n + 1) / 2
    return res

p = list(map(expect, p))
ans_sum = sum(p[:k])
tmp_sum = ans_sum
idx = 0

for i in range(k, n):
    tmp_sum = tmp_sum + p[i] - p[i-k]
    if tmp_sum > ans_sum:
        ans_sum = tmp_sum

print(ans_sum)



Measured memory_bytes: 25060
#include<bits/stdc++.h>
using namespace std;
int a,b,c;
int cmp(int a,int b,int c)
{
	if(a==b&&b!=c)
	return 1;
	else
	if(a==c&&a!=b)
	return 1;
	else
	if(b==c&&a!=c)
	return 1;
	else
	return 0;
}
int main()
{
	cin>>a>>b>>c;
    if(cmp(a,b,c)==true)
    cout<<"Yes";
    else
    cout<<"No";
    return 0;
} 

Measured memory_bytes: 256
use proconio::input;

fn bisect(aa: &[u64], k: u64) -> usize {
    let mut size = aa.len();
    let mut base = 0;
    while size > 1 {
        let half = size / 2;
        let mid = base + half;
        if aa[mid] <= k {
            base = mid;
        }
        size -= half;
    }
    base
}

fn main() {
    input! {
        n: usize,
        m: usize,
        mut k: u64,
        aa: [u64; n],
        bb: [u64; m],
    };
    let mut aa_cum = Vec::with_capacity(aa.len() + 1);
    aa_cum.push(0);
    for a in aa {
        aa_cum.push(aa_cum.last().unwrap() + a);
    }
    let mut bb_cum = Vec::with_capacity(bb.len() + 1);
    bb_cum.push(0);
    for b in bb {
        bb_cum.push(bb_cum.last().unwrap() + b);
    }
    let mut best = 0;
    for (i, a) in aa_cum.into_iter().enumerate() {
        if a <= k {
            let c = i + bisect(&bb_cum, k - a);
            best = best.max(c);
        } else {
            break;
        }
    }
    println!("{}", best);
}


Measured memory_bytes: 10928
#include <algorithm>
#include <iostream>
#include <vector>
#include <string>
#include <climits> // FOO_MAX, FOO_MIN
#include <cmath> 
#include <cstdlib> // abs(int)
#include <numeric>
#include <iomanip>
#include <map>

using namespace std;

#define roundup(n,d) ( ((n) + ((d)-1)) / (d) )
#define assign_max(into, compared) (into = max((into), (compared)))
#define assign_min(into, compared) (into = min((into), (compared)))
#define rep(i,n) for(long long i = 0;i < n;++i)
#define FAST_IO ios::sync_with_stdio(false); cin.tie(nullptr);
#define fix(n) fixed << setprecision(n)
#define ALL(v) v.begin(),v.end()

#define PI 3.14159265358979323846;

using ll = long long;
using ull = unsigned long long;
using vll = vector<long long>;


int main(void){
    FAST_IO
    
    ll n;
    string s;
    cin >> n >> s;
    ll w_count = 0,r_count = 0;

    rep(i,n){
        (s[i] == 'W') ? w_count++ : r_count++;
    }

    ll count = 0;
    for(int i = r_count;i < n;i++){
        if(s[i] == 'R'){
            count++;
        }
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 3472
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] a = new int[n];
		int sum = 0;
		for (int i = 0; i < n; i++) {
			a[i] = sc.nextInt();
			sum += a[i];
		}
		int[] d = new int[n];
		for (int i = 0; i < d.length; i++) {
			d[i] = Math.abs(sum - a[i]*n);
		}
		int min = Integer.MAX_VALUE;
		int ans = -1;
		for (int i = 0; i < d.length; i++) {
			if (d[i] < min) {
				min = d[i];
				ans = i;
			}
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 21844
package main

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

func min(a, b int64) int64 {
	if a > b {
		return b
	}
	return a
}

func get_int(sc *bufio.Scanner) int64 {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return int64(i)
}

func main() {
	var n, t int64
	fmt.Scan(&n, &t)
	ts := make([]int64, n)
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	for i := range ts {
		ts[i] = get_int(sc)
	}

	sum := int64(0)
	for i := 0; i < len(ts)-1; i++ {
		sum += min(ts[i+1]-ts[i], t)
	}
	sum += t
	fmt.Println(sum)
}


Measured memory_bytes: 4608
#include <bits/stdc++.h>
#define f first
#define s second
#define mp make_pair
#define pb push_back
#define lp(i,a,n) for(int i=a;i<=n;++i)
#define lpd(i,a,n) for(int i=a;i>=n;--i)
#define mem(a,b) memset(a,b,sizeof a)
#define all(v) v.begin(),v.end()
#define println(a) cout <<(a) <<endl
#define sz(x) ((int)(x).size())
#define readi(x) scanf("%d",&x)
#define read2i(x,y) scanf("%d%d",&x,&y)
#define read3i(x,y,z) scanf("%d%d%d",&x,&y,&z)
#define mod 1000000007
#define eps 1e-8
#define infi 1000000000
#define infll 1000000000000000000ll
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef set<int> si;
typedef map<int,int> mii;

const int N = 100002;
int n,m;

int main(){
    read2i(n,m);
    cout <<(1<<m) * (1900 * m + 100 * (n - m));
}

/*
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
*/


Measured memory_bytes: 256
import heapq

H,W = (int(i) for i in input().split())
C = []
for i in range(10):
    C.append( [int(j) for j in input().split()] )
SU = []
for i in range(H):
    SU += [int(j) for j in input().split()]

def Dijkstra(graph, start):
    N = 10
    d = {}
    prev = {}
    for i in range(N):
        prev[i] = None
        if i == start:
            d[i] = 0
        else:
            d[i] = float('inf')
    Q = []
    heapq.heappush(Q, (0, start))
    while Q:
        d_u, u = heapq.heappop(Q)
        if d[u] < d_u:#ダブりを回避
            continue
        for i in range(N):
            if graph[i][u]:
                temp = d_u + graph[i][u]
                if d[i] > temp:
                    d[i] = temp
                    prev[i] = u
                    heapq.heappush(Q, (d[i], i))
    return (d, prev)

def saitan(start, goal, d, prev):
    temp = goal
    res = [goal]
    while True:
        res.append(prev[temp])
        if prev[temp] == start:
            break
        else:
            temp = prev[temp]
    return res

d, prev = Dijkstra(C, 1)

res = 0
for i in SU:
    if i == -1:
        pass
    else:
        res += d[i]

print(res)


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

using namespace std;

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

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

int n;
double dp[310][310][310];
int cnt[3];

double rec(int i, int j, int k) {
  int sum = i + j + k;
  if (sum == 0) return 0.0;
  if (0 < dp[i][j][k]) return dp[i][j][k];
  double res = 0.0;
  res += (1.0 * n) / sum;
  if (i) res += (1.0 * i) / sum * rec(i - 1, j, k);
  if (j) res += (1.0 * j) / sum * rec(i + 1, j - 1, k);
  if (k) res += (1.0 * k) / sum * rec(i, j + 1, k - 1);
  dp[i][j][k] = res;
  return res;
}

int main() {
  cin >> n;
  REP(i, n) {
    int a;
    cin >> a;
    a--;
    cnt[a]++;
  }
  REP(i, 310) REP(j, 310) REP(k, 310) dp[i][j][k] = -1.0;
  printf("%.12f\n", rec(cnt[0], cnt[1], cnt[2]));
  return 0;
}

Measured memory_bytes: 233088