akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize ("O3")
#include<bits/stdc++.h>
#include <queue>
#include <cstring>

#define pb push_back
#define p push

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define ll long long

#define getI(a) scanf("%d",&a)
#define getII(a, b) scanf("%d%d",&a,&b)
#define getIII(a, b, c) scanf("%d%d%d",&a,&b,&c)
#define getL(a) scanf("%lld",&a)
#define getLL(a, b) scanf("%lld%lld",&a,&b)
#define getLLL(a, b, c) scanf("%lld%lld%lld",&a,&b,&c)
#define BEND(c) (c).begin(),(c).end()
#define BEND2(c) (c).rbegin(),(c).rend()
#define fi first
#define se second
#define pi 3.1415926535897932384626
#define getS(a) scanf("%s",a)
#define pfb(a) printf("%.10lf\n",a);
#define pfi(a) printf("%d",a);
#define pfii(a, b) printf("%d%d",a,b);
#define pfl(a) printf("%lld",a);
#define pfll(a, b) printf("%lld%lld",a,b);
#define pfd(a) printf("%.12lf\n",a);
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);
#define endl "\n"

#define SIZE  ( int)(1e9 + 7)
#define MAXN (ll) ((1e6+5))
#define K 25
#define  ALPHABET_SIZE  26
//#define N (int)(1e5+10)
#define sag (sol|1)
#define sol (root<<1)
#define ort (bas+son)/2
#define INF (ll )1e18
#define int ll
using namespace std;

typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<vector<int>> vvi;
typedef vector<vector<pair<int,int>>> vvpi;
typedef vector<long long> vl;
typedef vector<pair<int, int>> vpi;
typedef vector<pair<long long, long long>> vpl;
typedef pair<int, int> pii;
typedef pair <ll, ll> pll;
typedef vector<vi> graph ;


signed main ( ) {
    IOS
    ll n , r ;
    cin >> n >> r;
    if( n <  10 )
        cout << (100) * (10 -n) +  r ;
    else
        cout << r ;
    return 0;
}



















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

using namespace std;

int main(){
	int  N;
	long long int num[100005]={},per,count=0,min=2;
	cin>>N;
	for(int i=0;i<N;i++){
		cin>>num[i];
	}

	count=num[0]-1;
	for(int i=1;i<N;i++){
		if(num[i]==min)
			min++;
		else if(num[i]>min){
			per=num[i]%min;
			if(per==0)
				count+=(num[i]/min)-1;
			else 
				count+=(num[i]-per)/min;
		}
	}
	cout<<count;
	return 0;
}

Measured memory_bytes: 1152
import math
a,b,x = map(int,input().split())

t = False
volume = a*a*b
if x <= volume/2:
  t = True
  
if t:
  tan = a*(b**2)/(2*x)
else:
  tan = 2*((a**2)*b - x)/a**3
    
print(math.degrees(math.atan(tan)))


Measured memory_bytes: 9308
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define all(x) x.begin(),x.end()

int const N = 200001;
int n;
string s[N];
map<string,int>fr;

int main(){
    scanf("%d", &n);
    int mx = 0;
    for(int i = 0; i<n; ++i){
        cin >> s[i];
        ++fr[s[i]];
        mx = max(mx, fr[s[i]]);
    }
    for(auto i: fr){
        if(i.second == mx){
           cout << i.first << "\n"; 
        }
    }
} 

Measured memory_bytes: 26752
#include <bits/stdc++.h>
using namespace std;
 
 
int main() {
 
  int64_t n;
  cin>>n;

 
  vector<int64_t> s(n);
  for(int i=0;i<n;i++){
    cin>>s.at(i);
  }

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

  int64_t sum=0;
  bool flg=false;
  int64_t wk=0;
  for(int i=0;i<n;i++){
    sum+=s.at(i);

    if(flg==false && s.at(i)%10!=0){
      flg=true;
      wk=s.at(i);
    }

  }

  if(flg==false)
    cout<<0<<endl;
  else if(sum%10!=0)
    cout<<sum<<endl;
  else
    cout<<sum-wk<<endl;

	return 0;
}

Measured memory_bytes: 3616
N,M,X,Y = map(int,input().split())
x = list(map(int,input().split()))
y = list(map(int,input().split()))

xmax = max(x)
ymin = min(y)

ans = 'War'
for z in range(X+1,Y+1):
    if xmax < z <= ymin:
        ans = 'No War'
        break

print(ans)

Measured memory_bytes: 3064
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define pll pair<ll,ll>
#define pii pair<int,int>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define endl '\n'
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,x) distance(c.begin(),lower_bound(all(c),x))
#define ub(c,x) distance(c.begin(),upper_bound(all(c),x))

using namespace std;

template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}


const ll INF=1e9+7;

int main(){
    ll x,k,d;
    cin >> x >> k >> d;
    x=abs(x);
    if(x>0){
        if(x/d<k){
            ll m=(x/d)+1;
            k-=m;
            if(k%2==0){
                cout << abs(x-m*d) << endl;
            }
            else{
                cout << abs(x-(m-1)*d) << endl;
            }
        }
        else{
            cout << abs(x-k*d) << endl;
        }
    }
    else{
        if(k%2==1){
            cout << d << endl;
        }
        else{
            cout << 0 << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
int mod=1000000007;
int main(){
	int n, m, d; scanf("%d %d", &n, &m);
	bool treats[100010]; 
	int stairs[100010];
	memset(treats, 0, sizeof treats);
	memset(stairs, 0, sizeof stairs);
	for (int i=0;i<m;++i){
		scanf("%d", &d);
		treats[d]=1;
	}
	if (!treats[1]) stairs[1]=1;
	if (!treats[2]) stairs[2]= stairs[1] + 1;
	for(int i=3; i<=n;++i) if (!treats[i]) 
		stairs[i] = (stairs[i-1]%mod + stairs[i-2]%mod)%mod;
	printf("%d ", stairs[n]); 
	return 0;
}


Measured memory_bytes: 768
import scala.io.StdIn

object Main {
	def main(args: Array[String]): Unit ={
		val N = StdIn.readLine.toInt
		val result =
			if(N == 1){ "Hello World"}
			else {
				val A = StdIn.readInt
				val B = StdIn.readInt
				(A + B).toString
		}
		println(result)
	}

}


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

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

    return 0;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

const long long INF=INT_MAX/4;
const long long MOD=1'000'000'007;
const double EPS=1e-14;
const bool DEBUG=false;

const string YES = "YES";
const string NO = "NO";
const string Yes = "Yes";
const string No = "No";

template<class T>
void debug(T head){
    if(DEBUG){
        cout<<head<<endl;
    }
}

template <class Head, class... Body>
void debug(Head head, Body... body){
    if(DEBUG){
        cout<<head<<" ";
        debug(body...);
    }
}

/////
ll gcd(ll x, ll y) {
    // C = GCD(X, Y)
    // return C
    ll a = x, b = y;
    ll r;

    r = a % b;
    while(r != 0){
        a = b;
        b = r;
        r = a % b;
    }
    return b;
}

void answer(ll A, ll B){
    ll answer = 0;

    ll c;
    c = gcd(A, B);

    ll p = c;
    answer = 1;

    if(p % 2 == 0){
        p /= 2;
        answer++;
        while(p % 2 == 0){
            p /= 2;
        }
    }

    for(ll i=3; i<=sqrt(c); i+=2){
        if(p == 1){
            break;
        }
        debug(i, p);
        if(p % i == 0){
            p /= i;
            debug(i);
            answer++;
            while(p % i == 0){
                p /= i;
            }
        }
    }
    if(p != 1){
        answer++;
    }

    cout<<answer<<endl;

    return;
}

/////

int main(int argc, char* argv[]){
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout.precision(16);

    ll A, B;
    cin>>A>>B;
    answer(A, B);

    return 0;
}


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

using namespace std;
typedef long long ll;
typedef pair<int, int> pi;


int main() {
    int n;
    string s;
    cin >> n >> s;
    for (int i = 0; i < s.length(); i++) {
        s[i] = (s[i] - 'A' + n) % 26 + 'A';
    }
    cout << s << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
int ans;
string s[10],r[10];
string t1[5],t2[5];
bool b[11];
bool check(int p){
  r(i,5)if(t1[i][p]==t2[p][i])return 0;
  return 1;
}
void dfs2(int d){
  if(d==5)ans++;
  else{
    r(i,10)if(!b[i]){
      b[i]=1;
      t2[d]=s[i];
      if(check(d))dfs2(d+1);
      t2[d]=r[i];
      if(check(d))dfs2(d+1);
      b[i]=0;
    }
  }
}
void dfs(int d){
  if(d==5)dfs2(0);
  else{
    r(i,10)if(!b[i]){
      b[i]=1;
      t1[d]=s[i];
      dfs(d+1);
      t1[d]=r[i];
      dfs(d+1);
      b[i]=0;
    }
  }
}
main(){
  while(cin>>s[0],s[0]!="END"){
    memset(b,0,sizeof(b));
    ans=0;
    r[0]=s[0];
    reverse(r[0].begin(),r[0].end());
    r(i,9){
      cin>>s[i+1];
      r[i+1]=s[i+1];
      reverse(r[i+1].begin(),r[i+1].end());
    }
    int p=0;
    r(i,10)if(s[i]==r[i])p++;
    dfs(0);
    cout<<ans/(pow(2,p)*8)<<endl;
  }
}

Measured memory_bytes: 3404
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define F first
#define S second
 
const int mx=200010;
const ll mod=1e9+7;

int main(){  
  int n;
  cin >> n;
  cout << (n<1200?"ABC":"ARC") << endl;
  return 0;
}

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

int main ()
{
int A,B;
cin>>A>>B;
if((A*B*3)%2!=0)
cout<<"Yes";
else if((A*B*2)%2!=0)
cout<<"Yes";
else if((A*B*1)%2!=0)
cout<<"Yes";
else cout<<"No";

    return 0;
}


Measured memory_bytes: 256
program main
Implicit None
	integer(8)::n,m,i,j,g,f,e
	integer(8),allocatable::k(:),s(:,:),p(:),gs(:)
	character(len = 60),allocatable::str(:)
	
	read*,n,m
	allocate(k(m),p(m),s(m,n),str(m),gs(n))
	s = 0
	
	do i = 1,m
		read"(a60)",str(i)
	enddo
	read*,p
	
	do i =1,m
		g = 0
		do j = 1,60
			if(str(i)(j:j) == " " .and. g == 0)then
				read(str(i)(1:j-1),*) k(i)
				f = j+1
				g = 1
				cycle
			endif
			if(str(i)(j:j) == " " .and. g /= 0)then
				read(str(i)(f:j-1),*) s(i,g)
				f = j+1
				g = g+1
				if(g > k(i)) exit
			endif
		enddo
	enddo
	
	g = 0
	do i = 0,2**(n)-1
		call nb(i,n,gs)
		do j = 1,m
			e = 0
			do f = 1,n
				if(s(j,f) == 0) exit
				if(gs(s(j,f)) == 1) e = e+1
			enddo
			if (mod(e,2) /= p(j)) exit
			if(j == m) g = g+1
		enddo
	enddo
	print"(i0)",g
end program main

subroutine nb(i1,n,gs)
Implicit None
	integer(8)::i1,i,n,k,p,j
	integer(8)::gs(n)
	
	i = i1
	gs = 0
	k = int(log(real(i))/log(real(2)))+1
	do j = 1,k
		p = mod(i,2)
		i = (i-p)/2
		gs(j) = p
	enddo
end subroutine nb


Measured memory_bytes: 512
#include <bits/stdc++.h>
 
using namespace std;
 
#define lli long long int
#define lld long double
#define REP(i,s,n) for(lli i=s;i<n;i++)
#define RREP(i,s,n) for(lli i=s;i>=n;i--)
#define MOD 1000000007
#define NUM 2520
#define DEBUG 1
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())
#define PI (3.141592653589794)
#define INF (1LL<<50)

lli a[400][400];
bool vis[100100];
lli sum[100100];
lli h,w,d;
map<lli,pair<lli,lli>> dd;

signed main(){
	cin>>h>>w>>d;

	REP(i,0,h)REP(j,0,w){
		cin>>a[i][j];
		dd[a[i][j]] = mp(i,j);
	}
	for(lli i=1;i<=h*w;i++){
		sum[i+d] = sum[i] + abs(dd[i].first-dd[i+d].first)+abs(dd[i].second-dd[i+d].second);
	}

	lli q;
	cin>>q;
	REP(i,0,q){
		lli l,r;
		cin>>l>>r;
		cout<<sum[r]-sum[l]<<endl;
	}

	return 0;
}

Measured memory_bytes: 12800
#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define ull unsigned long long
#define vi vector<ll>
#define vvi vector<vi>
#define DBG_N(hoge) cerr<<" "<<(hoge)<<endl;
#define DBG cerr<<"!"<<endl;
#define BITLE(n) (1LL<<((ll)n))
#define BITCNT(n) (__builtin_popcountll(n))
#define SUBS(s,f,t) ((s).substr((f)-1,(t)-(f)+1))
#define ALL(a) (a).begin(),(a).end()
using namespace std;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll a,b,c,d,e;
  string s,ss,sss;
  cin>>a>>b;
  if(a==1&&b==1)cout<<1000000<<endl;
  else{
    ll ans=0;
    if(a==1)ans+=300000;
    else if(a==2)ans+=200000;
    else if(a==3)ans+=100000;
    if(b==1)ans+=300000;
    else if(b==2)ans+=200000;
    else if(b==3)ans+=100000;
    cout<<ans<<endl;
  }
  //  cout<<<<endl;
  return 0;
}


Measured memory_bytes: 256
s = input()
N = len(s)
sum = 0
for i in range(2**(N-1)):
	sum = int(s[0])
	for n in range(N-1):
		if (i >> n) & 1:
			sum += int(s[n+1])
		else:
			sum -= int(s[n+1])
	if sum == 7:
		print(s[0],end = "")
		for n in range(N-1):
			if (i >> n) & 1:
				print("+",end = "")
			else:
				print("-",end = "")
			print(s[n+1],end = "")
		print("=7")
		exit()


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define ll long long
#define pii pair<int, int>
#define pll pair<long long, long long>
#define ull unsigned long long
#define mp make_pair
#define F first
#define S second
#define mod 1000000007

ll dp[3005][3005];
ll pref[3005][3005];

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

    dp[1][1] = 1;

    for(int i = 2; i<=n; i++)
    {

        for(int j=1; j<i; j++)
        {
            pref[i-1][j] = (pref[i-1][j-1] + dp[i-1][j])%mod;
        }

        for(int j=1; j<=i; j++)
        {
            int l,r;
            if(s[i-2] == '<')
            {
                l = 1;
                r = j-1;
            }
            else
            {
                l = j;
                r = i-1;
            }

            if(l<=r)
                dp[i][j] = (dp[i][j] + (pref[i-1][r] - pref[i-1][l-1] + mod)%mod)%mod;
            
        }
    }

    ll ans = 0;
    for(int i=1;i<=n;i++)
    {
        ans = (ans + dp[n][i])%mod;
    }
    cout << ans << endl;

}


Measured memory_bytes: 139648
# include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define pii pair<int,int>
typedef long long ll;
ll a,b,c,k;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    cin>>a>>b>>c>>k;
    if(k&1){
        cout<<-1*(a-b)<<endl;
    }
    else cout<<a-b<<endl;
}

Measured memory_bytes: 3572
#include <bits/stdc++.h>
using namespace std;
#define rep(i,j) for(int i=0;i<j;i++)
#define print(a) cout<<a<<endl
typedef long long ll;
typedef string str;
typedef unsigned long long ul;
#define vint vector<int>

int main() {
	int n;
	long double sum=0;
	cin >> n;
	rep(i,n){
		long double k;
		cin >> k;
		sum += 1.0/k;
	}
	cout << setprecision(16) << 1.0/sum << endl;
	return 0;
}

Measured memory_bytes: 256
#![allow(unused_imports)]

use text_io::*;
use proconio::*;
use std::collections::*;
use itertools::Itertools;
use std::process::exit;
use std::cmp::*;
use num::*;
use num::integer::Roots;

fn main() {
    input! {
    a:usize,
    b:usize,
    c:usize,
    d:[usize;a],
    }
    let mut e=0;
    let mut f=0;
    let mut g=0;
    for i in 0..a{
        if d[i]<=b{e+=1}
        else if d[i]<=c{f+=1}
        else{g+=1}
    }
    println!("{}",min(min(e,f),g))
}

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

int main(){
    while(true){
        int n;
        cin >> n;
        
        if(n == 0) break;
        vector<int> s(n);
        rep(i,n) cin >> s[i];
        
        double ave = 0;
        double stdv = 0;
        
        rep(i,n){
            ave += s[i];
        }
        ave /= n;
        
        rep(i,n){
            stdv += pow((s[i]-ave),2);
        }
        stdv = sqrt(stdv/n);
        
        cout << fixed << setprecision(10) << stdv << endl;
    }
}


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

using namespace std;

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

    int n;
    cin >> n;
    string s, t;
    cin >> s >> t;

    for (int i = 0; i < n; i++) {
        cout << s[i] << t[i];
    }
    cout << endl;

    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

//#include "atcoder/all"
//using namespace atcoder;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll a, b, c;
	cin >> a >> b >> c;
	if(c == 0 || c-a-b < 0 || a*b*4 >= (c-a-b)*(c-a-b)) cout << "No" << endl;
	else cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 3612
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdint>
#include <cstdio>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;

using i64 = int64_t;

int N, K, arr[101010];

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

int main() {
    cin >> N >> K;
    for (int j = 0; j < N; ++j) cin >> arr[j];
    sort(arr, arr+N);

    int g = arr[0];
    for (int j = 1; j < N; ++j) {
        g = gcd(g, arr[j]);
    }

    bool flg = false;
    for (int j = 0; j < N; ++j) {
        if (K <= arr[j] && (arr[j] - K) % g == 0) {
            flg = true;
        }
    }
    cout << (flg ? "POSSIBLE" : "IMPOSSIBLE") << endl;

    return 0;
}


Measured memory_bytes: 640
def main():
    n = int(input())
    result = -10**10

    r = int(input())
    for t in range(1, n):
        r_next = int(input())

        if (r_next - r) > result:
            result = r_next-r

        if r > r_next:
            r = r_next

    print(result)


if __name__ == "__main__":
    main()



Measured memory_bytes: 5616
import sys
sys.setrecursionlimit(4100000)

n, k = [int(i) for i in input().split()]
a = []
for i in range(n):
    a.append(k+i)
temp = float('inf')
for apple in a:
    if abs(temp) > abs(apple):
        temp = apple
print(sum(a)-temp)



Measured memory_bytes: 3060
def comb_mod(n,r):
    mod = 10**9+7
    ans = 1
    for i in range(r):
        ans *= n-i
        ans %= mod
    for i in range(1,r+1):
        ans *= pow(i,mod-2,mod)
        ans %= mod
    return ans

def solve():
    n, a, b = map(int, input().split())
    mod = 10**9+7
    ans = pow(2,n,mod)-comb_mod(n,a)-comb_mod(n,b)-1
    ans %= mod
    return ans
print(solve())

Measured memory_bytes: 3064
#include <stdio.h>

int main(void){
    int n;
    scanf("%d",&n);
    int count=0,ans=0;
    for(int i=1; i<=n; i++){
        count=0;
        if(i%2==1){
            for(int j=1; j<=i; j++){
                if(i%j==0)count++;
            }
        }
        if(count==8)ans++;
    }
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 128
import math

a,b,h,m = map(int,input().split())

tha = (360 / 12 * h + 360 / 12 / 60 * m) * math.pi / 180
thb = (360 / 60 * m) * math.pi / 180

c2 = a**2 + b**2 - 2*a*b*math.cos(tha - thb)

print(c2**(1/2))


Measured memory_bytes: 9440
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <unordered_map>
#define rep(i,n) for( int i = 0; i < n; i++)
using namespace std;
using ll = long long;
#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))
ll u18 = 1000000000000000000;
int main()
{
    
	string s,t;
  cin >> s;
  cin >> t;
	
  int ans = t.size();
  for( int h = 0; h<= s.size()-t.size(); h++ ){
		int tmp = 0;
		for( int i = 0; i< t.size(); i++ ){
			if( s[h+i] != t[i] ) tmp ++;
		}	
		if( ans >= tmp ) ans = tmp;
	}	

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


Measured memory_bytes: 3612
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define erep(i,a,b) for(int i=a;i<=(int)(b);++i)
#define per(i,a,b) for(int i=(b);i>(a);--i)
#define eper(i,a,b) for(int i=((int)(a));i>=b;--i)
#define pb push_back
#define mp make_pair
#define INF 2000000000
#define MOD 1000000007
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a/gcd(a, b)*b;}

int n;
string s;
char march[] = {'M', 'A', 'R', 'C', 'H'};
ll cnt[5];
int main() {
 ios::sync_with_stdio ( false );
 cin.tie ( 0 );
    cin >> n;
    rep(i, 0, n) {
        cin >> s;
        rep(j, 0, 5) {
            if (march[j] == s[0])
                cnt[j]++;
        }
    }
    ll ans = 0;
    int P[10]={0 ,0 ,0 ,0 ,0 ,0 ,1 ,1 ,1 ,2};
    int Q[10]={1 ,1 ,1 ,2 ,2 ,3 ,2 ,2 ,3 ,3};
    int R[10]={2 ,3 ,4 ,3 ,4 ,4 ,3 ,4 ,4 ,4};
    rep(i, 0, 10) 
        ans += cnt[P[i]]*cnt[Q[i]]*cnt[R[i]];
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
class CNSPath
  def initialize
    @inf = 1000000000
    @d = Array.new(101){Array.new(101){@inf}}
    (1..100).each do |i|
      @d[i][i] = 0
    end
  end
  
  def solve
    #n = gets.chomp.to_i
    n,m = gets.scan(/\d+/).map(&:to_i)
    adj = Array.new(m)
    m.times do |i|
      adj[i] = gets.scan(/\d+/).map(&:to_i)
      @d[adj[i][0]][adj[i][1]] = adj[i][2]
      @d[adj[i][1]][adj[i][0]] = adj[i][2]
    end

    wf(n)

    r = 0
    adj.each do |x|
      r += 1 if @d[x[0]][x[1]] != x[2]
    end
    r
  end
  
  def wf(n)
    (1..n).each do |k|
      (1..n).each do |i|
        next if (@d[i][k] == @inf)
        (1..n).each do |j|
          next if (@d[i][k] == @inf)
          @d[i][j] = [@d[i][j], @d[i][k] + @d[k][j]].min
        end
      end
    end
  end
end

if $0 == __FILE__
  puts CNSPath.new.solve
end


Measured memory_bytes: 2300
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <string>
#include <string.h>
#include <vector>

using namespace std;
typedef long long ll;

ll Record[3000];
int RecordCount = 0;

int Binary_Search(ll a, ll b[], int N, ll Value, bool isRecord){
	if(a + b[N-1] <= Value){
		return 0;
	}
	
	int min = 0;
	int max = N-1;
	while(max - min > 0){
		//printf("%lld %lld\n", min, max);
		int mid = min + (max - min)/2;
		if(a + b[mid] > Value){
			max = mid;
		}else{
			min = mid + 1;
		}
	}
	
	if(isRecord){
		for(int i = min; i < N; i++){
			Record[RecordCount] = a + b[i];
			RecordCount++;
		}
	}
	
	return N - min;
}

int main()
{
	int X, Y, Z, K;
	ll A[1000];
	ll B[1000];
	ll C[1000];
	
	scanf("%d %d %d %d", &X, &Y, &Z, &K);
	for(int i = 0; i < X; i++){
		scanf("%lld", &A[i]);
	}
	for(int i = 0; i < Y; i++){
		scanf("%lld", &B[i]);
	}
	for(int i = 0; i < Z; i++){
		scanf("%lld", &C[i]);
	}
	
	ll BC[1000000];
	
	for(int i = 0; i < Y; i++){
		for(int j = 0; j < Z; j++){
			BC[i*Z+j] = B[i] + C[j];
		}
	}
	
	sort(A, A+X);
	sort(BC, BC+Y*Z);
	
	{
		ll min = 0;
		ll max = 300000000000;
		
		while(max - min > 0){
			// printf("%lld %lld\n", min, max);
			ll mid = min + (max - min)/2;
			int count = 0;
			for(int j = 0; j < X; j++){
				count += Binary_Search(A[j], Y*Z > K ? BC + (Y*Z-K) : BC, Y*Z > K ? K : Y*Z, mid, false);
			}
			
			if(count < K){
				max = mid;
			}else{
				min = mid + 1;
			}
		}
		
		for(int j = 0; j < X; j++){
			Binary_Search(A[j], Y*Z > K ? BC + (Y*Z-K) : BC, Y*Z > K ? K : Y*Z, min, true);
		}
		sort(Record, Record + RecordCount);
		
		int count = 0;
		for(int i = RecordCount - 1; i >= 0; i--){
			printf("%lld\n", Record[i]);
			count ++;
		}
		
		for(int i = 0; i < K - count; i++){
			printf("%lld\n", min);
		}
	}
	
	return 0;
}

Measured memory_bytes: 8064
//Written by Rhitwik Saha//
#include <bits/stdc++.h>
using namespace std;
#define int         long long
#define mp          make_pair
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define vb          vector<bool>
#define vc          vector<char>
#define vii         vector<pii>
//#define mi          map<int,int>
//#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (int)x.size()
#define ub(x)       upper_bound(x)
#define lb(x)       lower_bound(x)
#define endl        '\n'
#define file        freopen("input.txt","r",stdin);freopen("output.txt","w",stdout)
#define fastio      ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
// #define N            1e5+5
#define M           1000000007
#define MAX         100005
#define mem0(a)     memset(a,0,sizeof(a))
#define prec        cout<<std::setprecision(9)<<std::fixed
#define forn(i,a,b)  for(int i=a;i<b;i++)
int i,j,k;
void Anon_mouS(){
    string s;
    cin>>s;
    for(i=0;i<s.length();i++)cout<<"x";

}
int32_t main(){
    fastio;
    // file;
    // sieve();
    int q=1;
    // cin>>q;
    while(q--)Anon_mouS();
    return 0;
}


Measured memory_bytes: 256
import std.stdio, std.conv, std.functional, std.string;
import std.algorithm, std.array, std.container, std.range, std.typecons;
import std.bigint, std.numeric, std.math, std.random;
import core.bitop;

string FMT_F = "%.10f";

static File _f;
void file_io(string fn) { _f = File(fn, "r"); }
static string[] s_rd;
T _RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
T _RD(T = long)(File f) { while(!s_rd.length) s_rd = f.readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
T[] _RDA(T = long)(T fix = 0) { auto r = readln.chomp.split.to!(T[]); r[] += fix; return r; }
T[] _RDA(T = long)(File f, T fix = 0) { auto r = f.readln.chomp.split.to!(T[]); r[] += fix; return r; }
T RD(T = long)() { if (_f.isOpen) return _RD!T(_f); else return _RD!T; }
T[] RDA(T = long)(T fix = 0) { if (_f.isOpen)  return _RDA!T(_f, fix); else return _RDA!T(fix); }

size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

void chmin(T)(ref T x, T y) { x = min(x, y); } void chmax(T)(ref T x, T y) { x = max(x, y); }
bool inside(T)(T x, T b, T e) { return x >= b && x < e; }
T lcm(T)(T x, T y) { return x * (y / gcd(x, y)); }

//long mod = 10^^9 + 7;
long mod = 998_244_353;
//long mod = 1_000_003;
void moda(T)(ref T x, T y) { x = (x + y) % mod; }
void mods(T)(ref T x, T y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(T)(ref T x, T y) { x = (x * y) % mod; }
void modpow(T)(ref T x, T y) { if (!y) { x = 1; return; } auto t = x; x.modpow(y>>1); x.modm(x); if (y&1) x.modm(t); }
void modd(T)(ref T x, T y) { y.modpow(mod - 2); x.modm(y); }

void main()
{
	auto N = RD;
	auto a = RDA;

	auto cnt = new long[](32);
	foreach (i; 0..N)
	{
		foreach (j; 0..32)
		{
			auto bit = 1L << j;
			if (a[i] & bit)
			{
				++cnt[j];
			}
		}
	}

	auto ans = new long[](N);
	foreach (i; 0..N)
	{
		foreach (j; 0..32)
		{
			auto bit = 1L << j;
			long add;
			if (a[i] & bit)
			{
				++add;
			}
			ans[i] |= (cnt[j]-add) % 2 ? bit : 0;
		}
	}

	ans.map!(to!string).join(" ").writeln;
	stdout.flush;
	debug readln;
}

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

int main(){
    int N;
    cin >> N;
    vector<int> H(N);
    rep(i,N) cin >> H[i];
    for (int i = N-1; i > 0; i--){
        int h = H[i] - H[i - 1];
        if (h < -1){
            cout << "No" << endl;
            return 0;
        } else if (h == -1){
            H[i-1]--;
        } 
    }
    cout << "Yes" << endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vi;
typedef vector<vector<ll>> vvi;
typedef pair<ll,ll> pii;
typedef vector<pii> vpii;
#define REP(i,n) FOR(i,0,n)
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define PB push_back
#define LB lower_bound
#define UB upper_bound
#define PQ priority_queue
#define UM unordered_map
#define US unordered_set
#define ALL(a) (a).begin(),(a).end()
const ll INF = (1ll << 60);

int main() {
  ll N; cin>>N;
  string S=to_string(N);
  ll f=0;
  for(char c:S) f+=c-'0';
  if(N%f==0) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;

}


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

template <int MOD>
struct ModInt {
    using lint = long long;
    int val;

    // constructor
    ModInt(lint v = 0) : val(v % MOD) {
        if (val < 0) val += MOD;
    };

    // unary operator
    ModInt operator+() const { return ModInt(val); }
    ModInt operator-() const { return ModInt(MOD - val); }
    ModInt inv() const { return this->pow(MOD - 2); }

    // arithmetic
    ModInt operator+(const ModInt& x) const { return ModInt(*this) += x; }
    ModInt operator-(const ModInt& x) const { return ModInt(*this) -= x; }
    ModInt operator*(const ModInt& x) const { return ModInt(*this) *= x; }
    ModInt operator/(const ModInt& x) const { return ModInt(*this) /= x; }
    ModInt pow(lint n) const {
        auto x = ModInt(1);
        auto b = *this;
        while (n > 0) {
            if (n & 1) x *= b;
            n >>= 1;
            b *= b;
        }
        return x;
    }

    // compound assignment
    ModInt& operator+=(const ModInt& x) {
        if ((val += x.val) >= MOD) val -= MOD;
        return *this;
    }
    ModInt& operator-=(const ModInt& x) {
        if ((val -= x.val) < 0) val += MOD;
        return *this;
    }
    ModInt& operator*=(const ModInt& x) {
        val = lint(val) * x.val % MOD;
        return *this;
    }
    ModInt& operator/=(const ModInt& x) { return *this *= x.inv(); }

    // compare
    bool operator==(const ModInt& b) const { return val == b.val; }
    bool operator!=(const ModInt& b) const { return val != b.val; }

    // I/O
    friend std::istream& operator>>(std::istream& is, ModInt& x) noexcept { return is >> x.val; }
    friend std::ostream& operator<<(std::ostream& os, const ModInt& x) noexcept { return os << x.val; }
};

constexpr int MOD = 1e9 + 7;
using mint = ModInt<MOD>;

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

    std::vector<int> cs(n);
    for (auto& c : cs) std::cin >> c;
    std::sort(cs.rbegin(), cs.rend());

    mint ans = 0;
    for (int k = 0; k < n; ++k) {
        ans += mint(k + 2) * cs[k];
    }
    ans *= mint(2).pow(n * 2 - 2);

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


Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define fastio  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define debug(x) cout << #x << "--> " << x << endl;
#define int long long
#define pii pair<int, int>
using namespace std;
main()
{
    fastio;
    int n; cin >> n;
    map<int, int>mp;
    vector<int>vec;
    for(int i = 0; i < n; i++)
    {
         int x; cin >> x;
         if(mp[x] == false) vec.push_back(x);
            mp[x]++;
    }
    sort(vec.begin(), vec.end(), greater<int>());
    int ans = 0;
    int a = 0, b = 0;
    for(int i = 0; i < vec.size(); i++)
    {
        if(mp[vec[i]] >= 4) ans = max(ans, vec[i] * vec[i]);
        if(mp[vec[i]] >= 2)
        {
            if(!a) a = vec[i];
            else if(!b) b = vec[i];
        }
        ans = max(ans, a * b);
    }
    cout << ans << endl;
}


Measured memory_bytes: 10332
o = input()
e = input()

n = len(o) + len(e)
s = ['' for _ in range(n)]
for i in range(n):
    j = i // 2
    if i % 2 == 0:
        s[i] = o[j]
    else:
        s[i] = e[j]

print(''.join(s))


Measured memory_bytes: 9100
#include <iostream>

using namespace std;

// Function to trace the order of elements of array
void trace(int A[], int n)
{
	for (int i = 0; i < n; i++) {
		if (i > 0) cout << " ";
		cout << A[i];
	}
	cout << endl;
}

// Function to do bubble sort
void bubbleSort(int A[], int n)
{
	int numberOfSwap = 0;
	for (int i = 0; i < n; i++) {
		for (int j = n - 1; j >= i + 1; j--) {
			if (A[j] < A[j - 1]) {
				int tmp = A[j];
				A[j] = A[j - 1];
				A[j - 1] = tmp;
				numberOfSwap++;
			}
		}
	}
	trace(A, n);
	cout << numberOfSwap << endl;
}

// MAIN FUCNTION
int main()
{
	int n;
	int A[100];
	int key;

	// Input data
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> A[i];
	}

	bubbleSort(A, n);

	return 0;
}

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

int main() {
    ll N, A, B;
    cin >> N >> A >> B;
    vector<int> X(N);
    rep(i, N) cin >> X[i];

    ll ans = 0, now = X[0];
    for (int i = 1; i < N; ++i) {
        ans += min(B, (X[i] - now) * A);
        now = X[i];
    }

    cout << ans << "\n";

    return 0;
}

Measured memory_bytes: 640
def main():
    S = input()

    answer = {}
    for s in S:
        if s in answer:
            answer[s] += 1
        else:
            answer[s] = 1


    count = 0
    for s, c in answer.items():
        count += 1
        if answer[s] != 2:
            print('No')
            return
    if count == 2:
        print('Yes')
    

if __name__ == '__main__':
    main()


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

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

  double ans = 0;
  double bit = 0;
    
  for(int i =0 ; i< n ; i++){
    double x;
    string s;
    cin >> x >>s;
    
    if(s == "JPY" ){
      ans += x;
    }
    else {
      bit += x*380000.0 ;
    }
  }
  
  cout << ans + bit << endl;
}


Measured memory_bytes: 256
#![allow(non_snake_case)]
#![allow(dead_code)]
#![allow(unused_macros)]
#![allow(unused_imports)]

use std::str::FromStr;
use std::io::*;
use std::collections::*;
use std::cmp::*;

struct Scanner<I: Iterator<Item = char>> {
    iter: std::iter::Peekable<I>,
}

macro_rules! exit {
    () => {{
        exit!(0)
    }};
    ($code:expr) => {{
        if cfg!(local) {
            writeln!(std::io::stderr(), "===== Terminated =====")
                .expect("failed printing to stderr");
        }
        std::process::exit($code);
    }}
}

impl<I: Iterator<Item = char>> Scanner<I> {
    pub fn new(iter: I) -> Scanner<I> {
        Scanner {
            iter: iter.peekable(),
        }
    }

    pub fn safe_get_token(&mut self) -> Option<String> {
        let token = self.iter
            .by_ref()
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        if token.is_empty() {
            None
        } else {
            Some(token)
        }
    }

    pub fn token(&mut self) -> String {
        self.safe_get_token().unwrap_or_else(|| exit!())
    }

    pub fn get<T: FromStr>(&mut self) -> T {
        self.token().parse::<T>().unwrap_or_else(|_| exit!())
    }

    pub fn vec<T: FromStr>(&mut self, len: usize) -> Vec<T> {
        (0..len).map(|_| self.get()).collect()
    }

    pub fn mat<T: FromStr>(&mut self, row: usize, col: usize) -> Vec<Vec<T>> {
        (0..row).map(|_| self.vec(col)).collect()
    }

    pub fn char(&mut self) -> char {
        self.iter.next().unwrap_or_else(|| exit!())
    }

    pub fn chars(&mut self) -> Vec<char> {
        self.get::<String>().chars().collect()
    }

    pub fn mat_chars(&mut self, row: usize) -> Vec<Vec<char>> {
        (0..row).map(|_| self.chars()).collect()
    }

    pub fn line(&mut self) -> String {
        if self.peek().is_some() {
            self.iter
                .by_ref()
                .take_while(|&c| !(c == '\n' || c == '\r'))
                .collect::<String>()
        } else {
            exit!();
        }
    }

    pub fn peek(&mut self) -> Option<&char> {
        self.iter.peek()
    }
}

fn main() {
    let cin = stdin();
    let cin = cin.lock();
    let mut sc = Scanner::new(cin.bytes().map(|c| c.unwrap() as char));
    let N: usize = sc.get();
    let R: usize = sc.get();
    if N >= 10 {
        println!("{}", R);
    } else {
        println!("{}", R+100*(10-N));
    }
}


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

int main(){
	int N, L;
	int orig;
	int sub;

	cin >> N >> L;

	int min = L;
	int max = L + N - 1;

	orig = N * (min + max) / 2;

	if (max < 0){
		sub = max;
	}
	else if (min <= 0 && max >= 0){
		sub = 0;
	}
	else{
		sub = min;
	}

	cout << (orig - sub) << endl;

	return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <iomanip>

using namespace std;

int main() {

  int a, b, c;
  cin >> a >> b;
  double ans, ra, rb;
  string weatherReport;
  if((a * b ) % 2 == 0){
    cout<< "No";
  }else{
    cout << "Yes";
  }
  return 0;
}


Measured memory_bytes: 3612
n = int(input())
d = {}
for i in range(n):
    s = input()
    if s in d:
        d[s] += 1
    else:
        d[s] = 1

a = sorted(d.items(), key=lambda x:x[1], reverse=True)
m = a[0][1]
l = list()
for v in a:
    if v[1] == m:
        l.append(v[0])
    else:
        break

for v in sorted(l):
    print(v)

Measured memory_bytes: 47324
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define sz(x) (int)(x).size()
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define EPS (1e-10)
#define equals(a, b) (fabs((a)-(b)) < EPS)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<double> vd;
typedef pair<double,double> PD;
typedef pair<int,P> ed;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MOD = 1000000007;
  
int main() {
  int N;
  cin >> N;
  vi A(N);
  rep(i,N) {
    cin >> A[i];
  }
  reverse(rng(A));
  vi dp(N,INF);
  rep(i,N) {
    *upper_bound(rng(dp),A[i]) = A[i];
  }
  cout << lower_bound(rng(dp),INF) - dp.begin() << endl;
  return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
ll MOD = 1e9+7;

#define vec     vector<int>
#define vecll   vector<ll>
#define vec2    vector<vector<int>>
#define vec2ll  vector<vector<ll>>
#define vpair   vector<pair<int, int>>
#define vpairll vector<pair<ll, ll>>
#define vecst   vector<string>
#define vecb    vector<bool>

#define rep(i,n)         for(ll i=(ll)0; i<(ll)n; i++)
#define REP(i,m,n)       for(ll i=(ll)m; i<(ll)n; i++)
#define arr(var, n)      vec var(n); rep(i,n){cin >> var[i];}
#define arrll(var, n)    vecll var(n); rep(i,n){cin >> var[i];}
#define arrst(var, n)    vecst var(n); rep(i,n){cin >> var[i];}
#define all(var)         (var).begin(), (var).end()
#define sortall(var)     sort(all(var))
#define uniqueall(v)     v.erase(unique(v.begin(), v.end()), v.end());
#define f_sum(var)       accumulate(all(var), 0)
#define f_sumll(var)     accumulate(all(var), 0LL)
#define chmin(v1, v2)    v1 = min(v1, v2)
#define chmax(v1, v2)    v1 = max(v1, v2)
#define mpair(v1, v2)    make_pair(v1, v2)
#define pb(var)          push_back(var)
#define prt(var)         cout << var << "\n"
#define prtd(n, var)     cout << fixed << setprecision(n) << var << "\n"
#define prtfill(n, var)  cout << setw(n) << setfill('0') << var;
#define prt2(v1, v2)     cout << v1 << " " << v2 << "\n"
#define prt3(v1, v2, v3) cout << v1 << " " << v2 << " " << v3 << "\n"
#define prtall(v)        rep(i,v.size()){cout<<v[i]<<(i!=v.size()-1?" ":"\n");}
void prtok(bool ok){prt((ok ? "Yes" : "No"));}
//----------------------------------------------------------------

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

  bool turn=true;
  while(a>0 && b>0){
    if(turn){
      c-=b;
      turn=false;
      if(c<=0) break;
      //prt2("!", c);
    } else {
      a-=d;
      turn=true;
      //prt2("?", a);
      if(a<=0) break;
    }
  }

  prtok(!turn);
}


Measured memory_bytes: 3620
import java.util.HashSet;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int N = scan.nextInt();
        HashSet<String> S = new HashSet<String>();
        for (int i = 0; i < N; i++) {
            S.add(scan.next());
        }
        System.out.println(S.size());
        scan.close();
    }
}

Measured memory_bytes: 77220
N = int(input())
# X, L = [], []
A = []
for i in range(N):
    x, l = map(int, input().split())
    # X.append(x)
    # L.append(l)
    A.append((x - l, x + l))

A.sort(key=lambda x: x[1])
ans = 0
x = -10e50
for i in range(N):
    l, r = A[i]
    if x <= l:
        ans += 1
        x = r

print(ans)


# 選べるロボットの中で最もX+Lが小さいもの


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

#define start \
    int t;    \
    cin >> t; \
    while (t--)

const long long mod = 1000000007;

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

    int n;
    cin >> n;
    int arr[n];

    long long sum = 0;
    for (int i = 0; i < n; i++)
    {
        cin >> arr[i];
        sum += arr[i];
        sum %= mod;
    }

    long long ans = 0;

    for (int i = 0; i < n; i++)
    {
        sum -= arr[i];

        if (sum < 0)
            sum += mod;

        ans += sum * arr[i];
        ans %= mod;
    }

    cout << ans << endl;
}

Measured memory_bytes: 4416
#include <map>
#include <list>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#define fast ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
using namespace std;
int a,b,c,d;
int main()
{
    fast;
    cin>>a>>b>>c>>d;
    cout<<min(a,b)+min(c,d)<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
struct edge{int to, cost;};
vector<vector<edge> > G;
vector<int> color;

void dfs(int now, int ago, int depth){
  if(depth % 2 == 0) color[now] = 1;
  else color[now] = 0;
  for(auto next : G[now]){
    if(next.to == ago) continue;
    else dfs(next.to, now, depth + next.cost);
  }
}

signed main(){
  int n; scanf("%d", &n);
  G.resize(n);
  for(int i = 0; i < n - 1; i++){
    int u, v, w; scanf("%d %d %d", &u, &v, &w);
    --u; --v;
    G[u].push_back(edge{v, w}); G[v].push_back(edge{u, w});
  }
  color.resize(n);
  dfs(0, -1, 0);
  for(int i = 0; i < n; i++){
    printf("%d\n", color[i]);
  }
}

Measured memory_bytes: 11100
#include <stdio.h>
#include <stdlib.h>

typedef struct
{
	int time;
	int deadline;
}job;

int cmp(const void *p,const void *q)//昇順
{
	if(((job*)p)->deadline == ((job*)q)->deadline)return ((job*)p)->time - ((job*)q)->time;
	else return ((job*)p)->deadline - ((job*)q)->deadline;
}

int main()
{
	int n,a,b,i,now=0,dead=0,flag=1;
	job joblst[200010]={0};
	
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%d %d",&a,&b);
		joblst[i].time=a;
		joblst[i].deadline=b;
	}
	
	qsort(joblst,n,sizeof(job),cmp);
	
	for(i=0;i<n;i++)
	{
		now+=joblst[i].time;
		dead=joblst[i].deadline;
		if(now>dead)
		{
			flag=0;
			break;
		}
	}
	if(flag)printf("Yes");
	else printf("No");
	
}


Measured memory_bytes: 3324
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define mod 1000000007
#define fs first
#define ss second



int main(){
 
  string s;
  cin >> s;
  int q;
  cin >> q;
  int rev =0;
  
  deque<char> d;
  for(auto i: s){
      d.push_back(i);
  }
  for(int i =0;i<q;i++){
      int t;
      cin >> t;
      if( t == 1){
         rev^=t;
      }
      else{
           int f;
           cin >> f;
           if( rev){
                char c; cin >> c;
                if(f==1) d.push_back(c);
                else d.push_front(c);
           }
           else{
               char c;cin >> c;
               if(f ==1) d.push_front(c);
               else d.push_back(c);
           }
      }
      
  }
  if( rev) reverse(d.begin(),d.end());

   for(char i: d){
       cout <<i;
   }

}

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

bool dp[2000005];
int main(){

  int n, a[2009], sum = 0;

  cin >> n;
  for(int i=0; i<n; i++) cin >> a[i], sum += a[i];
  sort(a, a+n);
  dp[0] = true;

  for(int i=0; i<n; i++){
    for(int j=sum/2; j>=a[i]; j--){
      dp[j] |= dp[j-a[i]];
    }
  }

  for(int i=sum/2; i>=0; i--){
    if(dp[i]){
      cout << sum-i << endl;
      return 0;
    }
  }
  return 0;
}

Measured memory_bytes: 5500
N = int(input())
A = list(map(int, input().split()))
flag = 1

for i in range(N):
    if A[i] % 2 ==0:
        if A[i] % 3 is not 0 and A[i] % 5 is not 0:
            flag = 0
if flag == 1:
    print("APPROVED")
else:
    print("DENIED")

Measured memory_bytes: 3060
#include <stdio.h>

int main()
{
	// 変数定義
	int iTate;
	int iYoko;
	int iCountA;
	int iCountB;

	// 縦横ともに0が指定されるまで繰り返す
	while (1)
	{
		// 入力：縦横の長さ
		scanf("%d %d", &iTate, &iYoko);

		// 縦横ともに0ならば終了
		if (iTate == 0 && iYoko == 0)
		{
			break;
		}

		// 出力：チェック柄の長方形
		for (iCountA = 0; iCountA < iTate; iCountA++)
		{
			for (iCountB = 0; iCountB < iYoko; iCountB++)
			{
				if ((iCountA + iCountB) % 2 == 0)
				{
					printf("#");
				}
				else
				{
					printf(".");
				}
			}
			printf("\n");
		}
		printf("\n");
	}
}


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

const long long inf = 0x3fffffffffffffff;
int N, len[60];
long long c[60];
long long dp[2][60][30];
char s[2][60][50];
long long dfs(const int &N, const int &l, const char &f);
char pal(char *l, char *r);

int main() {
	scanf("%d", &N);
	for (int i = 0; i < N; ++i) {
		scanf("%s%lld", s[0][i], &c[i]);
		len[i] = strlen(s[0][i]);
		for (int j = 0; j < len[i]; ++j)
			s[1][i][j] = s[0][i][len[i] - 1 - j];
	}
	long long ans = inf;
	memset(dp, -1, sizeof(dp));
	for (int i = 0; i < N; ++i)
		ans = min(ans, c[i] + dfs (i, 0, 0));
	printf("%lld\n", ans == inf ? -1 : ans);
	return 0;
}

char pal(char *l, char *r) {
	for (; l < r; ++l, --r)
		if (*l != *r)
			return 0;
	return 1;
}

long long dfs(const int &n, const int &l, const char &f) {
	long long &ret = dp[f][n][l];
	if (ret != -1)
		return ret;
	const int r = len[n] - 1;
	if (pal(&s[f][n][l], &s[f][n][r]))
		return ret = 0;
	ret = inf;
	for (int i = 0; i < N; ++i) {
		if (r - l + 1 <= len[i]) {
			for (int j = 0; j <= r - l; ++j)
				if (s[f][n][j + l] != s[!f][i][j])
					goto LABLE;
			ret = min(ret, c[i] + dfs(i, r - l + 1, !f));
		}
		else {
			for (int j = 0; j < len[i]; ++j)
				if (s[f][n][j + l] != s[!f][i][j])
					goto LABLE;
			ret = min(ret, c[i] + dfs(n, l + len[i], f));
		}
LABLE:;
	}
	return ret;
}



Measured memory_bytes: 3848
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vi;
typedef vector<vector<ll>> vvi;
typedef pair<ll,ll> pii;
typedef vector<pii> vpii;
#define REP(i,n) FOR(i,0,n)
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define PB push_back
#define LB lower_bound
#define UB upper_bound
#define PQ priority_queue
#define UM unordered_map
#define US unordered_set
#define ALL(a) (a).begin(),(a).end()
const ll INF = (1ll << 60);

int main() {
  list<ll> l;
  ll n; cin>>n;
  REP(i,n) {
    ll a; cin>>a;
    if(i%2==0) l.PB(a);
    else l.push_front(a);
  }

  list<ll> ll;
  if(n%2) for(auto i:l) ll.push_front(i);
  else for(auto i:l) ll.push_back(i);

  l=ll;

  for(auto it=l.begin();it!=l.end();++it) {
    if(next(it)==l.end()) cout<<*it<<endl;
    else cout<<*it<<' ';
  }

}


Measured memory_bytes: 14720
package main

import (
	"fmt"
	"math"
)

func main() {
	var p, q, r int
	fmt.Scanf("%d %d %d", &p, &q, &r)

	ans := (p + q + r) - max(p, q, r)
	fmt.Print(ans)
}

func max(a int, b int, c int) int {
	max1 := math.Max(float64(a), float64(b))
	max2 := math.Max(float64(c), float64(max1))
	return int(max2)
}


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

int main() {
	int N;
	cin >> N;
	string s, t;
	cin >> s >> t;
	for (int i = 0; i < N; i++) {
		cout<< s.at(i) << t.at(i);
	}
	cout << endl;
}

Measured memory_bytes: 256