akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define vd(T) vector<vector<T>>
#define v(T) vector<T>
#define mod (ll)(1e9+7)
#define pp(T) pair<T,T>
#define pb push_back
#define mp make_pair
#define NN 100005
#define IO ios_base::sync_with_stdio(NULL),cin.tie(0),cout.tie(0)
#define loop(i,a,b) for(ll i=a;i<b;i++)
#define DEBUG cout<<"***********DEBUGGING***********"<<endl
#include <ext/pb_ds/assoc_container.hpp> // Common file 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set; 
ll power(ll a,ll b){ if(b==0) return 1; ll s=power(a,b/2); s*=s;if(b&1) return s*a; return s;}
ll powermod(ll a,ll b,ll m){ if(b==0) return 1; ll s=power(a,b/2);s*=s; s%=m; if(b&1) return (s*a)%m; return s;}
inline int add(ll a,ll b,ll m=0){
    if(m==0) return a+b;
    return (a%m+b%m)%m;
}

inline int sub(ll a,ll b ,ll m=0){
    if(m==0) return a-b;
    return ((a%m-b%m)%m+m)%m;
}

inline int mul(ll a,ll b,ll m=0){
    if(m==0)return (a*b);
    return ((a%m)*(b%m))%m;
}

inline int div(ll a,ll b,ll m=0){
    if(m==0) return a/b;
    return ((a%m)*(powermod(a,b,m-2)%m))%m;
}

bool isopen(char c){
    return ((c=='(')||(c=='{')||(c=='['));
}

ll longest_balanced_parenthesis(string a,ll n){
    stack<char> s;
    ll start=0;
    ll ans=0,m=0;
    for(ll i=0;i<n;i++){
        if(isopen(a[i])){
            s.push(a[i]);
        }
        else{
            if(isopen(a[i])|| s.empty()){
                m=max(m,ans);
                continue;
            }
            else{
                s.pop();
                ans+=2;
                m=max(ans,m);
            }
        }
    }

    return m;

}

ll setup_k(ll *a,ll k){
  ordered_set x;
  // Now , insert and then check number of integers less than k by just using x.order_of_key(k+1)
}

int main() {

    IO; 

    string s;
    cin>>s;
    ll a=(s[0]-'0')*10+(s[1]-'0');
    ll b=(s[2]-'0')*10+(s[3]-'0');
    
    if(a!=0 && a<=12){
        if(b!=0 && b<=12){
            cout<<"AMBIGUOUS"<<endl;
            return 0;
        }
        cout<<"MMYY"<<endl;
    }
    else{
        if(b!=0 && b<=12){
            cout<<"YYMM"<<endl;
        }
        else{
            cout<<"NA"<<endl;
        }
    }
    

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <cstdlib> 
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
typedef long long lint;
using namespace std;
int main(){
  lint N;
  cin>>N;
  lint s=N/11;
  if(N%11==0){cout<<2*s<<endl;}
  else if(N%11<=6){cout<<2*s+1<<endl;}
  else cout<<2*s+2<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <numeric> //lcm


#define ERROR() cout << "ERROR!!" << endl; return 0;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = n-1; i >= 0; --i)
#define rep1(i,n) for(int i = 1; i <= (n); ++i)

#define debug(vec) for(auto v : vec) cout << v << " "; cout << endl;

#define debug2D(vec2D) for(auto vec : vec2D) { for (auto v : vec) cout << v << " "; cout << endl; } 

using namespace std;

typedef long long ll;

const long long int INF = 1 << 29; //<10^10
//const ll MOD = 998244353;
const ll MOD = 1000000007;

inline bool maxch(int &a, int b) { if (a < b) {a = b; return true;} else return false;}

int main() {
	int n;
	cin >> n;
  
	map<string,int> strs;
	rep(i, n) {
		string s;
		cin >> s;
		strs[s]++;
	}

	vector<pair<int,string>> s(n);
	int ix =  0;
	for(auto it = strs.begin(); it != strs.end(); ++it) {
		s[ix] = {it->second, it->first};
		++ix;
	}

	sort(s.begin(), s.end(), greater<pair<int,string>>());

	int maxCnt = s[0].first;
	vector<string> maxs;
	rep(i, n) {
		if (maxCnt > s[i].first) break;
		maxs.push_back(s[i].second);
	}

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

	for (auto str : maxs) {
		cout << str << endl;
	}

	return 0;
}




Measured memory_bytes: 30068
#include <iostream>

using std::cout;
using std::cin;
using std::endl;;

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 <queue>
#include <map>
#include <cstdio>
using namespace std;
int main(){
	int n,m;
	scanf("%d%d",&n,&m);
	if(m==1){
		puts("0");return 0;
	}
	vector<int>start(n),end1(n),end2(n);
	for(int i=0;i<n;i++)scanf("%d",&start[i]);
	{
		vector<int>p(m);
		for(int i=0;i<m;i++)scanf("%d",&p[i]);
		for(int i=0,c=0,x=0;i<m;i++,x^=1)for(int j=0;j<p[i];j++,c++)end1[c]=x;
		for(int i=0,c=0,x=1;i<m;i++,x^=1)for(int j=0;j<p[i];j++,c++)end2[c]=x;
	}
	map<vector<int>,int>depth;
	queue<vector<int> >q;
	depth[start]=1,depth[end1]=depth[end2]=-1;
	q.push(start),q.push(end1),q.push(end2);
	for(;!q.empty();){
		vector<int>cur=q.front();q.pop();
		int d=depth[cur];
		for(int i=0;i<n-1;i++)if(cur[i]!=cur[i+1]){
			swap(cur[i],cur[i+1]);
			map<vector<int>,int>::iterator it=depth.find(cur);
			if(it==depth.end()){
				depth[cur]=d+(d>0?1:-1);
				q.push(cur);
			}else if(it->second*d<0){
				d-=it->second;
				if(d<0)d=-d;
				printf("%d\n",d-1);
				return 0;
			}
			swap(cur[i],cur[i+1]);
		}
	}
	puts("0");
}

Measured memory_bytes: 2652
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <cassert>
#include <memory>
#include <stack>
#include <set>
#include <map>

#define MAX_SIZE 100000000
typedef long long ll;
typedef unsigned long long ull;
using namespace std;

int main() {
  int n,k; cin >>n>>k;
  vector<int> l(n);
  for(auto& v : l) {
    cin >> v;
  }

  sort(l.begin(), l.end(), [](int x, int y) -> bool { return x > y; });
  int sum = 0;
  for(int i = 0; i < k; i++) {
    sum += l[i];
  }

  cout << sum << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define MOD 998244353 
#define last last2

using namespace std;

typedef long long ll;

ll C[405][405],pow2[405];

void pre(int n) {
  for(int i=0;i<=n;i++) C[i][0]=1;
  for(int i=1;i<=n;i++)
    for(int j=1;j<=i;j++) C[i][j]=(C[i-1][j-1]+C[i-1][j])%MOD;
  pow2[0]=1;
  for(int i=1;i<=n;i++) pow2[i]=pow2[i-1]*2LL%MOD;
}

int num[405];
int f[405][405],g[405][405];

void dp(int d,int l,int r) {
  static int sum1[405],sum2[405];
  memset(f[d],0,sizeof(f[d]));
  memset(g[d],0,sizeof(g[d]));
  f[d][0]=g[d][0]=1;
  int last=l-1,s=0;
  for(int i=l;i<=r+1;i++)
    if (i>r||num[i]==d) {
    	if (last+1<i) {
    		dp(d+1,last+1,i-1);
    		int k=i-last-1;
    		memset(sum1,0,sizeof(sum1));
    		for(int j=0;j<=s;j++)
    		  for(int l=0;l<=k;l++) sum1[j+l]=(sum1[j+l]+(ll)f[d][j]*f[d+1][l])%MOD;
    		for(int j=0;j<=s+k;j++) f[d][j]=sum1[j];
    		memset(sum2,0,sizeof(sum2));
    		for(int j=0;j<=s;j++)
    		  for(int l=0;l<=k;l++) sum2[j+l]=(sum2[j+l]+(ll)g[d][j]*g[d+1][l])%MOD;
    		for(int j=0;j<=s+k;j++) g[d][j]=sum2[j];
    		s+=k;
		}
		last=i;
	}
  int len=r-l+1,t=len-s;
  memset(sum1,0,sizeof(sum1));
  memset(sum2,0,sizeof(sum2));
  for(int i=0;i<=s;i++) {
  	int t2=s-i;
    for(int j=0;j<=t2;j++)
	  sum1[i+t+j]=(sum1[i+t+j]+C[t2][j]*((j)?pow2[i+t]:pow2[i+t]-1)%MOD*f[d][i])%MOD;
	t2=len-i;
	for(int j=0;j<=t2;j++)
	  sum2[i+j]=(sum2[i+j]+C[t2][j]*((j)?pow2[i]:pow2[i]-1)%MOD*g[d][i])%MOD;
	sum1[i]=(sum1[i]+g[d][i])%MOD;
	sum2[i]=(sum2[i]+g[d][i])%MOD;
  }
  for(int i=0;i<=len;i++) {
  	f[d][i]=sum1[i];
  	g[d][i]=sum2[i];
  }
}

int main() {
  int n;
  scanf("%d",&n);
  pre(n);
  for(int i=1;i<=n;i++) scanf("%d",&num[i]);
  dp(1,1,n);
  printf("%d\n",f[1][n]);
  return 0;
}

Measured memory_bytes: 2816
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#define mo 1000000007
typedef long long ll;
using namespace std;
int n,m,num[200009],f[200009];
int gf(int x)
{
 if (f[x]==x) return x;
 f[x]=gf(f[x]);
 return f[x];
}
int main()
{
  scanf("%d%d",&n,&m);
  for (int i=1;i<=n;i++) f[i]=i,num[i]=1;
  int x,y;
  for (int i=1;i<=m;i++)
  {
    scanf("%d%d",&x,&y);
    int fx=gf(x),fy=gf(y);
    if (fx!=fy) f[fx]=fy,num[fy]+=num[fx];
  }
  int ans=0;
  for (int i=1;i<=n;i++)
  if (num[i]>ans) ans=num[i];
  printf("%d\n",ans);
  return 0;	
} 

Measured memory_bytes: 5388
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1

s = input()
t = input()
n = len(s)
if t[:n] == s[:n]:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 65244
import collections
N,K = map(int,input().split())
A = list(map(int,input().split()))

c = collections.Counter(A)
score_sorted = sorted(c.items(), key=lambda x:-x[1])

memo = 0
count = 0
for key,value in score_sorted:
    if count < K:
        count += 1
        memo += value
    else:
        break
print(N-memo)

Measured memory_bytes: 122336
#include <algorithm>
#include <cstdlib>
#include <iostream>
#include <vector>
using namespace std;

template<typename T> void chmax(T& a, T b) { if(b > a) a = b; }

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

	for(int n, k; cin >> n >> k, n;) {
		int white = 0;
		vector<int> cards;
		for(int i = 0; i < k; ++i) {
			int in;
			cin >> in;
			if(in)
				cards.push_back(in);
			else
				++white;
		}

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

		int l = 0, sum = 1, cost = 0, ans = 1;
		for(int r = 1; r < k; ++r) {
			sum += cards[r] - cards[r - 1];
			cost += cards[r] - cards[r - 1] - 1;
			while(cost > white) {
				sum -= cards[l + 1] - cards[l];
				cost -= cards[l + 1] - cards[l] - 1;
				++l;
			}

			chmax(ans, sum);
		}

		cout << ans << endl;
	}

	return EXIT_SUCCESS;
}

Measured memory_bytes: 1744
#include<stdio.h>
 
int main(void){
	int a,b,d,r;
	double f;
	 
	scanf("%d %d",&a,&b);
	 
	d= a/b;
	r= a%b;
	f= (double)a/b;
	 
	printf("%d %d %f\n",d,r,f);
	 
	return 0;
}

Measured memory_bytes: 1852
#include<stdio.h>
int main(void) {
	int n;
	scanf("%d",&n);
	int i,k[100],p[100];
	for(i=0;i<n;i++){
		scanf("%d %d",&k[i],&p[i]);
	}
	int a[100];
	for(i=0;i<n;i++){
		a[i]=k[i]%p[i];
		if(a[i]!=0){
		    printf("%d\n",a[i]);
		}
		else{
		    printf("%d\n",p[i]);
		}
	}
	return 0;
}


Measured memory_bytes: 2084
/*--------------------------"SABUJ-JANA"------"JADAVPUR UNIVERSITY"--------*/
/*-------------------------------@greenindia-----------------------------------*/
//
//		  _____       _           _        _
//		 / ____|     | |         (_)      | |
//		| (___   __ _| |__  _   _ _       | | __ _ _ __   __ _
//		 \___ \ / _` | '_ \| | | | |  _   | |/ _` | '_ \ / _` |
//		 ____) | (_| | |_) | |_| | | | |__| | (_| | | | | (_| |
//		|_____/ \__,_|_.__/ \__,_| |  \____/ \__,_|_| |_|\__,_|
//		                        _/ |
//		                       |__/
/*---------------------- Magic. Do not touch.-----------------------------*/
/*------------------------------God is Great/\---------------------------------*/
#include <bits/stdc++.h>
using namespace std;
#define crap ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
//cout<<fixed<<showpoint<<setprecision(12)<<ans<<endl;
#define int long long int
#define double long double
#define PI acos(-1)
typedef vector<int> vi;
typedef vector<vector<int>> vvi;

void print1d(const vector<int>& vec) {for (auto val : vec) {cout << val << " ";} cout << endl;}

void print2d(const vector<vector<int>>& vec) {for (auto row : vec) {for (auto val : row) {cout << val << " ";} cout << endl;}}

signed main() {
	crap;

	map<int, string> mp = {
		{2, "hon"},
		{4, "hon"},
		{5, "hon"},
		{7, "hon"},
		{9, "hon"},
		{0, "pon"},
		{1, "pon"},
		{6, "pon"},
		{8, "pon"},
		{3, "bon"}
	};

	int N;
	cin >> N;

	cout << mp[N % 10] << endl;


	return 0;
}

Measured memory_bytes: 3656
#include<iostream>

#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) for(int i=0;i<a;i++)


using namespace std;



int main(){
	bool prime[1000001];
	rep(i, 1000001){
		prime[i] = true;
	}
	prime[0] = prime[1] = false;

	loop(i, 2, 1001){
		if (prime[i]){
			for (int j = i * 2; j < 1000001; j += i){
				prime[j] = false;
			}
		}
	}



	int ord;
	while (1){
		cin >> ord;
		if (ord == 0){
			break;
		}
		int sum = 0;
		rep(i, 1000001){
			if (prime[i]){
				sum += i;
				ord--;
			}
			if (ord == 0){
				break;
			}
		}
		cout << sum << endl;

	}
			
		
				

}

Measured memory_bytes: 2136
#どの 2 つの街の間も、道を何本か通ることで行き来することができる
cnts=[0]*4
for i in range(3):
    ai,bi=map(int, input().split())
    ai-=1;bi-=1
    cnts[ai]+=1;cnts[bi]+=1
for i in range(4):
    if cnts[i]>2:
        print("NO")
        exit()
print("YES")


Measured memory_bytes: 9084
import math 
n,a,b = map(int,input().split())
if a>b:
  print(0)
  exit()
if n==1 and a!=b:
  print(0)
  exit()
if n==2:
  print(1)
  exit()
q = b*(n-2)-a*(n-2)+1
print(q)

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

int main(void)
{
    int money, num_500, num_5;

    // 所持金を入力
    scanf("%d", &money);

    // 500円硬貨の枚数
    num_500 = money / 500;

    // 5円硬貨の枚数
    num_5 = (money - 500 * num_500) / 5;

    //嬉しさ
    printf("%d", num_500*1000 + num_5*5);
    
    return 0;
}

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

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

int main()
{
    ll i,j;
    ll n, k;
    const ll MOD = 998244353;
    cin >> n >> k;
    vector<ll> l(k);
    vector<ll> r(k);
    rep(i,k) cin >> l[i] >> r[i];
    vector<ll> dp(n+1, 0);
    dp[1] = 1;
    vector<ll> ruiseki(n+1,0);
    ruiseki[1] = 1;
    for(i = 2;i <= n;++i){
        rep(j,k){
            ll left = i - r[j];
            ll right = i - l[j];
            ll sup = 1;
            ll inf = i-1;
            if(inf < left) continue;
            if(right < sup) continue;
            sup = max(sup, left);
            inf = min(inf, right);
            dp[i] += ruiseki[inf] + MOD - ruiseki[sup-1];
            dp[i] %= MOD;
        }
        ruiseki[i] = dp[i] + ruiseki[i-1];
        ruiseki[i] %= MOD;
    }
    cout << dp[n] << endl;
    return 0;
}

Measured memory_bytes: 6432
import java.util.Scanner

object Main {
  def main(args: Array[String]): Unit = {
    val sc: Scanner = new Scanner(System.in)
    val Array(n, x): Array[Int] = sc.nextLine.split(" ").map(_.toInt)
    val ms = List.fill(n)(sc.nextInt)
    val additional: Int = (x - ms.sum) / ms.min
    println(n + additional)
  }

}


Measured memory_bytes: 27320
#include <iostream>

using std::cin;
using std::cout;
using std::endl;

bool isCyclic(int num)
{
    int b1 = num % 10;
    int b2 = num % 100 - b1; // 2 桁目
    int b3 = num % 1000 - b1 - b2; // 3 桁目
    int b4 = num % 10000 - b1 - b2 - b3; // 4
    int b5 = num - b1 - b2 - b3 - b4; // 5

    if (b5 / 10000 != b1) return false;
    if (b4 / 1000 != b2 / 10) return false;

    return true;
}

int main(int argc, char* argv)
{
    int a;
    int b;

    cin >> a;
    cin >> b;

    int count = 0;
    for (auto num = a; num <= b; ++num)
    {
        if (isCyclic(num))
        {
            ++count;
        }
    }

    cout << count << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int kmp[200010],len;
char s[200010];
ll p,l,r;
ll sum[30][200010];
ll solve(ll L,int n) {
	if(L<=len) return sum[n][L];
	ll s1=sum[n][p],s2=sum[n][len],l1=p,l2=len,x,y;
	while(l1+l2<L){
		x=s2,y=l2;
		s2+=s1,l2+=l1;
		s1=x,l1=y;
	}
	return s2+solve(L-l2,n);
}
int main(){
	scanf("%s%lld%lld",s+1,&l,&r);
	len=strlen(s+1)/2;
	for(int i=2,j=0;i<=len;i++){     
        while(j&&s[i]!=s[j+1]) j=kmp[j];    
        if(s[j+1]==s[i]) j++;    
    	kmp[i]=j;
    	//cout<<i<<" "<<kmp[i]<<endl;
    }
	p=len-kmp[len];
	for(int i=0;i<26;i++) 
	for(int j=1;j<=len;j++){
		sum[i][j]=sum[i][j-1];
		if(s[j]-'a'==i) sum[i][j]++;
	}
	for(int i=0;i<26;i++) 
	printf("%lld ",solve(r,i)-solve(l-1,i));
}

Measured memory_bytes: 24792
//
// Created on 2020/05/02.
//


#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <ios>
#include <iomanip>
#include <numeric>

#define all(x) (x).begin(),(x).end()
typedef long long ll;
using namespace std;
const long long LINF =1e18;
const int INF = 1e9;


int main() {
    ll x;
    double a,b,n;
    cin>>a>>b>>n;

    if(b - 1 <= n){
        x = b - 1;
    }else if(n < b - 1){
        x = n;
    }

    double first = a * x / b;
    double second = x / b;
    ll ans = ll(first) - a * ll(second);

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


Measured memory_bytes: 3724
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define int long long
#define double long double
#define mod 1000000007
#define F first
#define S second
#define P pair<long long,long long>
#define all(a) a.begin(),a.end()
#define INF 5000000000000000
#define endl '\n'
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; }
using namespace std;

signed main(){
    int n; cin>>n;
    vector<P> x(n);
    vector<int> ans(n*n,0);
    rep(i,n){
        cin>>x.at(i).F;
        x.at(i).S=i+1;
        ans.at(x.at(i).F-1)=x.at(i).S;
    }
    sort(all(x));
    int cnt1=0,cnt2=0;
    rep(i,n){
        cnt1+=x.at(i).S;
        if(cnt1>x.at(i).F){
            cout<<"No"<<endl;
            return 0;
        }
    }
    reverse(all(x));
    rep(i,n){
        cnt2+=n-x.at(i).S+1;
        if(cnt2>n*n-x.at(i).F+1){
            cout<<"No"<<endl;
            return 0;
        }
    }
    reverse(all(x));
    int at=0;
    rep(i,n){
        rep(j,x.at(i).S-1){
            while(ans.at(at)!=0){
                at++;
            }
            ans.at(at)=x.at(i).S;
        }
    }
    reverse(all(x));
    at=n*n-1;
    rep(i,n){
        rep(j,n-x.at(i).S){
            while(ans.at(at)!=0){
                at--;
            }
            ans.at(at)=x.at(i).S;
        }
    }
    cout<<"Yes"<<endl;
    rep(i,n*n-1)cout<<ans.at(i)<<' ';
    cout<<ans.back()<<endl;
}

Measured memory_bytes: 3072
package main

import (
	"fmt"
)

func min(n, m int) int {
	if n >= m {
		return m
	} else {
		return n
	}
}

func main() {
	var a, b, c, x, y int
	fmt.Scan(&a, &b, &c, &x, &y)
	m := min(a+b, 2*c)
	if x >= y {
		fmt.Println(y*m + (x-y)*min(a, 2*c))
	} else {
		fmt.Println(x*m + (y-x)*min(b, 2*c))
	}
}


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

int main(){
    int x;
    cin >> x;
    for(int i=-150; i<150; i++){
        for(int j=-150; j <150; j++){
            if (pow(i, 5) - pow(j, 5) == x){
                cout << i << " " << j << endl;
                exit(0);
            }
        }
    }
}

Measured memory_bytes: 3924
package main

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

var sc = bufio.NewScanner(os.Stdin)

func next() string {
	sc.Scan()
	return sc.Text()
}

func main() {
	sc.Split(bufio.ScanWords)
	a := next()
	b := next()

	i, _ := strconv.Atoi(a + b)
	j := int(math.Sqrt(float64(i)))
	k := int(j * j)

	if k == i {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


Measured memory_bytes: 1772
#include <stdio.h>
int main(void){
    int h,w;
    int i,j;
    while(1){
        scanf("%d %d",&h,&w);
        if(h == 0 && w == 0)break;
        for(i = 0;i < h;i++){
            for(j = 0;j < w;j++){
                if((i%2 == 0 && j%2 == 0)||(i%2 == 1 && j%2 == 1)){
                    printf("#");
                }else{
                    printf(".");
                }
            }
            printf("\n");
        }
        printf("\n");
    }
    return 0;
    
}




Measured memory_bytes: 2680
#include<iostream>
#include<string>
using namespace std;
int main(void){
    string str;
    int ab[26]={};
    int i;
    while(getline(cin,str)){
        for(i=0;i<str.size();i++){
            if(str[i]>='a'&&str[i]<='z') ab[str[i]-'a']++;
            else if(str[i]>='A'&&str[i]<='Z') ab[str[i]-'A']++;
        }
    }
    for(i=0;i<26;i++){
        cout << (char)('a'+i) << " : " << ab[i] << endl;
    }
}



Measured memory_bytes: 3184
#include <iostream>
#include <algorithm>
using namespace std;
int N; long long C, x[100009], v[100009], opt[100009];
int main() {
	cin.tie(0);
	ios_base::sync_with_stdio(false);
	cin >> N >> C;
	for (int i = 0; i < N; i++) {
		cin >> x[i] >> v[i];
	}
	long long ret = 0;
	for (int i = 0; i < 2; i++) {
		long long rsum = 0;
		for (int j = N - 1; j >= 0; j--) {
			rsum += v[j];
			opt[j] = max(opt[j + 1], rsum - 2 * (C - x[j]));
		}
		ret = max(ret, opt[0]);
		long long sum = 0;
		for (int j = 0; j < N; j++) {
			sum += v[j];
			ret = max(ret, sum + opt[j + 1] - x[j]);
		}
		for (int j = 0; j < N; j++) x[j] = C - x[j];
		reverse(x, x + N);
		reverse(v, v + N);
	}
	cout << ret << "\n";
	return 0;
}

Measured memory_bytes: 2560
// 二部グラフマッチング
#include <bits/stdc++.h>
#define REP(i,n) for (long i=0;i<(n);i++)
#define FOR(i,a,b) for (long i=(a);i<(b);i++)
#define RREP(i,n) for(long i=n;i>=0;i--)
#define RFOR(i,a,b) for(long i=(a);i>(b);i--)
#define dump(x)  cerr << #x << " => " << (x) << endl
using namespace std;
// to:次の頂点,cap:辺の重み,rev:逆辺のindex
template<typename Ver,typename Weight>
class fordFulkerson {
private:
	typedef struct {Ver to;Weight cap;Ver rev;}edge;
	vector<vector<edge>> E;
	vector<char> used;
	size_t V;
	Weight dfs(Ver node,Ver goal,Weight flow){
		if (node == goal) return flow;
		used[node] = 1;
		REP(i,E[node].size()){
			edge* e = &E[node][i];
			if (!used[e->to] && e->cap != 0){
				Weight d = dfs(e->to,goal,min(flow,e->cap));
				if (d != 0) {
					e->cap -= d;
					E[e->to][e->rev].cap += d;
					return d;
				}
			}
		}
		return 0;
	}
public:
	fordFulkerson(size_t v) :
		E(v),used(v,0),V(v){}

	size_t size() { return V;}

	void addDirectedEdge(Ver from,Ver to,Weight cap){
		E[from].push_back({to,cap,(Ver)E[to].size()});
		E[to].push_back({from,0,(Ver)E[from].size()-1});
	}

	void addUndirectedEdge(Ver from,Ver to,Weight cap){
		E[from].push_back({to,cap,(Ver)E[to].size()});
		E[to].push_back({from,cap,(Ver)E[from].size()-1});
	}

	Weight maxFlow(Ver start,Ver goal){
		Weight ans = 0;
		while (1){
			REP(i,used.size()) used[i] = 0;
			Weight f = dfs(start,goal,numeric_limits<Weight>::max());
			if (f == 0) return ans;
			ans += f;
		}
	}
};
template<typename Ver>
class BipartiteMatching : public fordFulkerson<Ver,int> {
private:
	Ver V;
	vector<char> connected;
public:
	BipartiteMatching (Ver v) : V(v),connected(v,0),fordFulkerson<Ver,int>(v+2){}
	void addEdge(Ver g1,Ver g2) { // g1 : 二部グラフの一方, g2 : 二部グラフの他方
		fordFulkerson<Ver,int>::addDirectedEdge(g1,g2,1);
		if (!connected[g1]) {
			fordFulkerson<Ver,int>::addDirectedEdge(V,g1,1);
			connected[g1] = 1;
		}
		if (!connected[g2]) {
			fordFulkerson<Ver,int>::addDirectedEdge(g2,V+1,1);
			connected[g2] = 1;
		}
	}
	Ver matching(void) {
		return fordFulkerson<Ver,int>::maxFlow(V,V+1);
	}
};

int main() {
  int X, Y, E;
  scanf("%d %d %d", &X, &Y, &E);
  BipartiteMatching<int> bm(X + Y);
  for(int i = 0; i < E; i++) {
    int a, b;
    scanf("%d %d", &a, &b);
    bm.addEdge(a, X + b);
  }
  printf("%d\n", bm.matching());
}




Measured memory_bytes: 3400
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String line = scanner.nextLine();
        boolean cf = false;
        for (int i = 0; i < line.length(); ++i) {
            if (line.charAt(i) == 'C') {
                for (int j = i; j < line.length(); ++j) {
                    if (line.charAt(j) == 'F') {
                        cf = true;
                        break;
                    }
                }
                break;
            }
        }
        System.out.println(cf ? "Yes" : "No");
    }
}


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

int main()
{
    long long a,b,c,d;
    cin>>a>>b>>c>>d;
    if(d<=a)
        cout<<d;
    else if(d>a && d<=(a+b))
        cout<<a;
    else
        cout<<a-(d-(a+b));
}


Measured memory_bytes: 3588
#include<iostream>
#include<cstdio>
#include<string>
#include<vector>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<queue>
#include<stack>
#include<set>
#include<map>
#define ll long long
#define PI acos(-1.0)
#define MAX 0x3fffffff
using namespace std;

double r;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin >> r;
	printf("%.8lf\n", 2 * PI*r);
	return 0;
}

Measured memory_bytes: 3796
/*
                         ----------------------------
                              Ankur Kumar Singh    
                         ----------------------------
*/


#include <bits/stdc++.h>
using namespace std;
# define ll  long long  int
# define ld  long double
# define pb push_back
# define pp pop_back
# define ff first
# define ss second
# define mp make_pair
# define ac accumulate
# define mod 1000000007
# define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
# define trace1(x)                cerr << #x << ": " << x << "\n";
# define trace2(x, y)             cerr << #x << ": " << x << " | " << #y << ": " << y << "\n";
# define trace3(x, y, z)          cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << "\n";
# define trace4(a, b, c, d)       cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << "\n";

int  main()
{

   IOS;
   ll h,n;
   cin>>h>>n;
   ll arr[n+2][2];
   for(ll i=1;i<=n;i++)
   {
        cin>>arr[i][0]>>arr[i][1];
   }
   ll dp[h+2][n+2];
   ll ans[h+2];
   for(ll i=1;i<=h;i++)
   {
      dp[i][0]=LLONG_MAX;
      ans[i]=LLONG_MAX;
      for(ll j=1;j<=n;j++)
      {
          ll k=dp[i][j-1];
          ans[i]=min(ans[i],k);
          ll a=arr[j][0],b=arr[j][1];
         // cout<<a<<" "<<b<<endl;
          if(i-a>0)
          {
              ans[i]=min(ans[i],ans[i-a]+b);
          }
          else
          {
              ans[i]=min(ans[i],b);
          }
          dp[i][j]=ans[i];
      }
      //cout<<ans[i]<<"\n";
      //return 0;
   }
   cout<<ans[h];
}


Measured memory_bytes: 78592
#include<stdio.h>
#include<math.h>

#define M_PI 3.1415926535

int main(){
	double s,l,h,a,b,c,x;
	char input[256];
	
	fgets(input,sizeof input,stdin);
	sscanf(input,"%lf %lf %lf",&a,&b,&c);
	
	h=sin(M_PI-(c*M_PI/180.0))*b;
	s=(a*h)/2.0;
	
	x=cos(M_PI-(c*M_PI/180.0))*b;
	
	l=hypot(a+x,h)+a+b;
	
	printf("%f\n%f\n%f\n",s,l,h);
	
	
	return 0;
}

Measured memory_bytes: 668
#include<bits/stdc++.h>
using namespace std;
int x;
int y;

int a;//turtle 4 legs

int b;//turu 2 legs

void yes(){
    cout<<"Yes"<<endl;
}
void no(){
    cout<<"No"<<endl;
}
int main(){
    cin>>x;
    cin>>y;
    if(y%2!=0){
        no();
        return 0;
    }
    a=y/2-x;
    b=-y/2+2*x;
    if(a<0||b<0){
        no();
        return 0;
    }
    yes();
}

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

namespace ABC083_B
{
    class Program
    {
        static bool Check(int num, int a, int b)
        {
            int num_ = num;
            int sum = 0;

            while(num_ != 0)
            {
                sum += num_ % 10;
                num_ /= 10;
            }

            return (a <= sum && sum <= b);
        }

        static void Main(string[] args)
        {
            string[] strs = Console.ReadLine().Split(' ');
            int n = int.Parse(strs[0]);
            int a = int.Parse(strs[1]);
            int b = int.Parse(strs[2]);

            int sum = 0;

            for (int i = 1; i <= n; ++i)
            {
                if (Check(i, a, b))
                {
                    sum += i;
                }
            }

            Console.WriteLine($"{sum}");
        }
    }
}


Measured memory_bytes: 13140
#pragma region kyomukyomupurin

/**
 *    author  : 𝒌𝒚𝒐𝒎𝒖𝒌𝒚𝒐𝒎𝒖𝒑𝒖𝒓𝒊𝒏
 *    created : 2020-05-17 23:36:24
 **/

#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <chrono>
#include <cmath>
#include <complex>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using namespace std;

using int64 = long long;

template <class T>
using binary_heap = std::priority_queue<T, std::vector<T>, std::greater<T>>;

template <class T, class U>
std::ostream& operator<<(std::ostream& os, const std::pair<T, U>& p) {
  return os << '(' << p.first << ", " << p.second << ')';
}

template <class T>
std::ostream& operator<<(std::ostream& os, const std::vector<T>& vec) {
  int n = 0;
  for (auto e : vec) os << (n++ ? ", " : "{") << e;
  return os << (n ? "}" : "{}");
}

template <class T>
std::ostream& operator<<(std::ostream& os, const std::set<T>& st) {
  int n = 0;
  for (auto e : st) os << (n++ ? ", " : "{") << e;
  return os << (n ? "}" : "{}");
}

template <class T, class U>
std::ostream& operator<<(std::ostream& os, const std::map<T, U>& mp) {
  int n = 0;
  for (auto e : mp) os << (n++ ? ", " : "{") << e;
  return os << (n ? "}" : "{}");
}

template <class T>
std::istream& operator>>(std::istream& is, std::vector<T>& vec) {
  for (T& e : vec) is >> e;
  return is;
}

#define all(_) begin(_), end(_)
#define rall(_) rbegin(_), rend(_)

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]: ", debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif

void debug_out() { std::cerr << '\n'; }

template <class Head, class... Tail>
void debug_out(Head&& head, Tail&&... tail) {
  std::cerr << head;
  if (sizeof...(Tail) != 0) std::cerr << ", ";
  debug_out(std::forward<Tail>(tail)...);
}

#pragma endregion kyomukyomupurin

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

  int k; cin >> k;
  string s; cin >> s;
  int n = s.size();

  if (n <= k) {
    cout << s << endl;
  } else {
    cout << s.substr(0, k) << "..." << endl;
  }

  return 0;
}

Measured memory_bytes: 3648
a = [list(map(int, input().split())) for i in range(3)]
n = int(input())
b = [int(input()) for i in range(n)]

for i in range(n):
    for j in range(3):
        for k in range(3):
            if b[i] == a[j][k]:
                a[j][k] = 0

check = False
r0 = [r[0] for r in a]
r1 = [r[1] for r in a]
r2 = [r[2] for r in a]
if a[0].count(0) == 3 or a[1].count(0) == 3 or a[2].count(0) == 3:
    check = True
elif r0.count(0) == 3 or r1.count(0) == 3 or r2.count(0) == 3:
    check = True
elif (a[0][0] == 0 and a[1][1] == 0 and a[2][2] == 0) or (a[0][2] == 0 and a[1][1] == 0 and a[2][0] == 0):
    check = True

if check:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 3064
#include<bits/stdc++.h>
#include<algorithm>
using namespace std;
#define str string
#define rep(x,y) for(int i=x;i<y;i++)
#define REP(x,y) for(int j=x;j<y;j++)
#define all(x) x.begin(),x.end()
int main(){
  int A,B,C;
  double D=0;
  char k,d;
  str N,N2;
  cin>>A;
  vector<double>x(A);
  vector<string>u(A);
  rep(0,A){
    cin>>x[i]>>u[i];
    if(u[i]=="JPY")D+=x[i];
    else D+=380000*x[i];
  }
  cout<<D<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
#define int long long
constexpr long long INF = numeric_limits<long long>::max() / 2;
constexpr int MOD = 1000000007;
using Graph = vector<vector<int>>;

int N,M,Q;
int a[55],b[55],c[55],d[55];
int dfs(vector<int> v){
    int ans=0;
    if(v.size()==N){
        rep(i,Q){
            if(v[b[i]]-v[a[i]]==c[i]) ans+=d[i];
        }
        return ans;
    }else{
        if(v.size()==0){
            for(int i=1;i<=M;i++){
                auto nv=v;
                nv.push_back(i);
                ans=max(ans,dfs(nv));
            }

        }else{
            int x=v[v.size()-1];
            for(int i=x;i<=M;i++){
                auto nv=v;
                nv.push_back(i);
                ans=max(ans,dfs(nv));
            }
        }
        return ans;
    }
}



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


    cin>>N>>M>>Q;


    rep(i,Q){
        cin>>a[i]>>b[i]>>c[i]>>d[i];
        a[i]--;
        b[i]--;

    }
    vector<int> vec;
    cout << dfs(vec) << endl;


    



}


Measured memory_bytes: 3612
use std::io::BufRead;

fn main() {
    let handle = std::io::stdin();
    for line in handle.lock().lines().map(|a| a.ok().unwrap()) {
        if line == "0" { break; } 
        let sum: isize = line.chars()
            .map(|a| a.to_string().parse::<isize>().unwrap()).sum(); 
        println!("{}", sum);
    }
}


Measured memory_bytes: 5036
import sys
input=lambda: sys.stdin.readline().rstrip()
n,k=map(int,input().split())
P=[int(i) for i in input().split()]
C=[int(i) for i in input().split()]
A=[[0]*n]
Cur=[int(i)+1 for i in range(n)]
L=[0]*n
for _ in range(n):
  N=[0]*n
  for i in range(n):
    N[i]=A[-1][i]+C[P[Cur[i]-1]-1]
    Cur[i]=P[Cur[i]-1]
    if L[i]==0 and Cur[i]==i+1:
      L[i]=_+1
  A.append(N)
ans=max(A[1])
for i in range(n):
  ct=0
  loop=L[i]
  loop_ct=A[loop][i]
  rem=-float("inf")
  if k>loop and loop_ct>0:
    ct+=(k//loop-1)*loop_ct
    rem=0
    for j in range(loop):
      if j+1<=k%loop:
        rem=max(rem,A[j+1][i]+loop_ct)
      else:
        rem=max(rem,A[j+1][i])
    ans=max(ans,rem+ct)
  else:
    for j in range(min(k,n)):
      rem=max(rem,A[j+1][i])
    ans=max(ans,rem)
print(ans)




Measured memory_bytes: 265604
#include <stdio.h>
#include <math.h>

int main(void){
    int L[1000000];
    scanf("%d", &L[1]);
    int i, j, c=0;

    for(i = 1; ; i++){
        for(j = 1; j < i; j++){
            if(L[j] == L[i]){
                c++;
                break;
            }
        }
        if(c){
            break;
        }

        if(L[i] % 2 == 0)  L[i+1] = L[i] / 2;
        else L[i+1] = 3 * L[i] + 1;
    }

    printf("%d\n", i);

    return 0;
}


Measured memory_bytes: 128
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;

namespace AtCoder
{
    class Program
    {
        private static string Read() { return Console.ReadLine(); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }

        static int Solve(int N, long[] A, long[] B)
        {
            var diffs = new long[N];
            int n = 0;
            long sum = 0;
            for (int i = 0; i < N; ++i)
            {
                diffs[i] = A[i] - B[i];
                if (A[i] < B[i])
                {
                    sum += B[i] - A[i];
                    ++n;
                }
            }
            if (sum == 0) { return 0; }
            Array.Sort(diffs, (a, b) => b.CompareTo(a));
            long diff = 0;
            for (int i = 0; i < N; ++i)
            {
                diff += diffs[i];
                if (diff >= sum) { return n + i + 1; }
            }
            return -1;
        }
        static void Main(string[] args)
        {
            int N = ReadInt();
            var A = ReadLongs();
            var B = ReadLongs();
            Console.WriteLine(Solve(N, A, B));
        }
    }
}


Measured memory_bytes: 37980
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ll long long int

struct edge
{
  int to, cost;
};
typedef std::vector<std::vector<int>> graph;
const ll MOD = 1000000007;
using namespace std;

ll dfs(ll k, graph &g, int now, int from)
{
  if (g[now].size() == 1 && from != -1)
    return 1LL;
  if (g[now].size() >= k)
    return 0LL;
  ll c = 0;
  if (from == -1)
  {
    c = k - 1;
  }
  else
  {
    c = k - 2;
  }

  ll val = 1;
  for (auto v : g[now])
  {
    if (v == from)
      continue;
    val = (val * c) % MOD;
    c--;
  }

  for (auto v : g[now])
  {
    if (v == from)
      continue;
    ll tmp = dfs(k, g, v, now);
    val = (val * tmp) % MOD;
  }
  return val;
}

int main()
{
  int n;
  ll k;
  cin >> n >> k;
  graph g(n);
  REP(i, n - 1)
  {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    g[a].push_back(b);
    g[b].push_back(a);
  }

  cout << (k * dfs(k, g, 0, -1)) % MOD << endl;
}


Measured memory_bytes: 11520
#include <stdio.h>

int main(int argc, char *argv[])
{
  int m, f, r;
  char grade;

  while (1) {
    scanf("%d %d %d", &m, &f, &r);
    if (m == -1 && f == -1 && r == -1) break;

    if (m == -1 || f == -1) grade = 'F';
    else if (80 <= m+f) grade = 'A';
    else if (65 <= m+f && m+f < 80) grade = 'B';
    else if (50 <= m+f && m+f < 65) grade = 'C';
    else if (30 <= m+f && m+f < 50) {
      if (r >= 50) grade = 'C';
      else grade = 'D';
    } else grade = 'F';

    printf("%c\n", grade);
  }

  return 0;
}

Measured memory_bytes: 600
{-# LANGUAGE ScopedTypeVariables, LambdaCase #-}

import qualified Data.List as List
import qualified Data.Set as Set

main :: IO ()
main = do
    [a, b, c] :: [Int] <- map read . words <$> getContents
    putStrLn $ if a <= c && c <= b then "Yes" else "No"

Measured memory_bytes: 508
#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = a; i <= b; ++i)
#define per(i, a, b) for (int i = a; i >= b; i--)
#define ll long long
#define mset(s, _) memset(s, _, sizeof s)
#define ALL(a) (a).begin(), (a).end()
using namespace std;
int MAX_N = pow(10, 5);

int main(void) {
  int n;
  cin >> n;
  vector<int> h;
  rep(i, 0, n - 1) {
    int H;
    cin >> H;
    h.push_back(H);
  }
  int cost[MAX_N];
  cost[0] = 0;
  cost[1] = abs(h[1] - h[0]);
  rep(i, 2, n - 1) {
    cost[i] = min(cost[i - 1] + abs(h[i] - h[i - 1]),
                  cost[i - 2] + abs(h[i] - h[i - 2]));
  }
  // rep(i, 0, n - 1) { cout << cost[i] << endl; }
  cout << cost[n - 1] << endl;
  return 0;
}


Measured memory_bytes: 1144
using System;
using System.Linq;
using System.Collections.Generic;

class Amondai
{
    static void Main()
    {
        var nmc = Console.ReadLine().Split(' ').Select(x=> Int32.Parse(x)).ToArray();
        var B = Console.ReadLine().Split(' ').Select(x => Int32.Parse(x)).ToArray();
        var ans = 0;
        for (int i=0;i<nmc[0];++i)
        {
            var A= Console.ReadLine().Split(' ').Select(x => Int32.Parse(x)).ToArray();
            var num = 0;
            for (int j=0;j<nmc[1];++j)
            {
                num += A[j] * B[j];
                if (j == nmc[1] - 1) {
                    num += nmc[2];
                    if (0 < num) ans++;
                }
            }
        }
        Console.WriteLine(ans);
    }
}

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

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 = 1LL << 60;

bool dp[110][10100] = {false};

int main(void){
	int a,b,m;cin >> a >> b >>m;
	vector<int>A(a),B(b);
	int ans_a=1000000,ans_b = 1000000,ans=1000000;
	rep(i,a){
		cin >> A[i];
		ans_a = min(ans_a,A[i]);
	}
	rep(i,b){
		cin >> B[i];
		ans_b = min(ans_b,B[i]);
	}
	ans = ans_a+ans_b;
	rep(i,m){
		int x,y,z;
		cin >> x >> y >> z;
		ans = min(ans,A[x-1]+B[y-1]-z);
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 1024
//   _/                _/                 _/_/_/   _/
//_/_/_/_/   _/_/   _/_/_/_/   _/_/    _/       _/_/
// _/     _/    _/   _/     _/    _/  _/_/_/     _/
//_/     _/    _/   _/     _/    _/  _/    _/   _/
// _/_/   _/_/       _/_/   _/_/      _/_/     _/
#include<iostream>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<set>
#include<map>
#include<queue>
#include<vector>
#include<random>
using namespace std;
typedef long long ll;
const int MOD=1e9+7;
const double pi=3.14159265358979323846;
const int inf=1e9;
const ll INF=1e18;
int main() {
  cin.tie(0),cout.tie(0);
  ios::sync_with_stdio(false);
  ll h,n,a[1005]={},b[1005]={},dp[10000]={};
  cin >> h >> n;
  for(int i=0; i<n; i++) {
    cin >> a[i] >> b[i];
  }
  for(int i=1; i<=10000; i++) {
    dp[i]=inf;
  }
  dp[0]=0;
  for(int i=0; i<=10000; i++) {
    for(int j=0; j<n; j++) {
      dp[i]=min(dp[i],dp[max(i-a[j],0LL)]+b[j]);
    }
  }
  cout << dp[h] << endl;
 }

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int main(){
  string S;
  cin>>S;
  int w;
  cin>>w;
  int len=S.size();
  string ans="";
  for(int i=0;i<len;i=i+w){
    ans+=S[i];
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
ma = lambda :map(int,input().split())
lma = lambda :list(map(int,input().split()))
tma = lambda :tuple(map(int,input().split()))
ni = lambda:int(input())
yn = lambda fl:print("Yes") if fl else print("No")
import collections
import math
import itertools
import heapq as hq
n,m = ma()
A= lma()
s = [0]*(n+1)
for i in range(n):
    s[i+1]=(s[i]+A[i])%m
co = collections.Counter(s)
ans = 0
for num,cnt in co.items():
    ans+=cnt*(cnt-1)//2
print(ans)


Measured memory_bytes: 95008
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{

	ios_base::sync_with_stdio(0);
	cout.tie(0);
	cin.tie(0);

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

	string s;
	cin>>s;
	ll n=s.length(),ans=0;
	vector<ll>v(n+1);
	for(ll i=0;i<v.size();i++)
		v[i]=0;
	for(ll i=0;i<n;i++)
	{
		if(s[i]=='<')
		{
			v[i+1]=max(v[i+1],v[i]+1);
		}
	}
	for(ll i=n-1;i>=0;i--)
	{
		if(s[i]=='>')
		{
			v[i]=max(v[i],v[i+1]+1);
		}
	}
	for(ll i=0;i<v.size();i++)
		ans+=v[i];
	cout<<ans<<endl;

	
	
}


Measured memory_bytes: 4764
#include <bits/stdc++.h>
/* Type alias */
using ll = long long;
using ld = long double;

using vec_i = std::vector<int>;
using vec_ll = std::vector<ll>;
using vec_ld = std::vector<ld>;

using set_i = std::set<int>;
using set_ll = std::set<ll>;
using set_ld = std::set<ld>;

using uset_i = std::unordered_set<int>;
using uset_ll = std::unordered_set<ll>;
using uset_ld = std::unordered_set<ld>;

/* IO macros */
#define in(i)            int i; std::cin >> i
#define in2(i, j)        int i, j; std::cin >> i >> j
#define in3(i, j, k)     int i, j, k; std::cin >> i >> j >> k
#define in_(i)           std::cin >> i
#define in2_(i, j)       std::cin >> i >> j
#define in3_(i, j, k)    std::cin >> i >> j >> k
#define in_ll(i)         ll i; std::cin >> i
#define in2_ll(i, j)     ll i, j; std::cin >> i >> j
#define in3_ll(i, j, k)  ll i, j, k; std::cin >> i >> j >> k
#define in_ll_(i)        std::cin >> i
#define in2_ll_(i, j)    std::cin >> i >> j
#define in3_ll_(i, j, k) std::cin >> i >> j >> k
#define in_ld(i)         ld i; std::cin >> i
#define in2_ld(i, j)     ld i, j; std::cin >> i >> j
#define in3_ld(i, j, k)  ld i, j, k; std::cin >> i >> j >> k
#define in_ld_(i)        std::cin >> i
#define in2_ld_(i, j)    std::cin >> i >> j
#define in3_ld_(i, j, k) std::cin >> i >> j >> k
#define in_c(i)          char i; std::cin >> i
#define in2_c(i, j)      char i, j; std::cin >> i >> j
#define in3_c(i, j, k)   char i, j, k; std::cin >> i >> j >> k
#define in_c_(i)         std::cin >> i
#define in2_c_(i, j)     std::cin >> i >> j
#define in3_c_(i, j, k)  std::cin >> i >> j >> k
#define in_str(s)        std::string s; std::cin >> s

#define vec_in(v, n)    auto v=vec_i(n); for(auto &x:v){std::cin>>x;}
#define vec_in_ll(v, n) auto v=vec_ll(n);for(auto &x:v){std::cin>>x;}
#define vec_in_ld(v, n) auto v=vec_ld(n);for(auto &x:v){std::cin>>x;}

#define print(x)   std::cout << x
#define println(x) std::cout << x << "\n"
#define print_fixed(x)   std::cout << std::fixed << x
#define println_fixed(x) std::cout << std::fixed << x << "\n"
#define print_vec(v) for (auto &x:v) { std::cout << x << " ";}
#define println_vec(v) for (auto &x:v) { std::cout << x << " ";} std::cout << "\n";
#define print_long_vec(v) for (auto &x:v) { std::cout << x << "\n";}
#define println_long_vec(v) for (auto &x:v) { std::cout << x << "\n";} std::cout << "\n";

/* Loops */
#define rep(i, n) for (auto i = 0; i < n; ++i)
#define rep2(i, m, n) for (auto i = m; i < n; ++i)

/* Vector manipulation */
#define vec_sort(v) std::sort(v.begin(), v.end())

using namespace std;
/* Code Starts Here*/
int main () {
    std::ios::sync_with_stdio(false);
    cin.tie(NULL);
    in(N);
    map<string, int> s;

    rep(i, N) {
        in_str(S);
        s[S]++;
    }
    println("AC x " << s["AC"]);
    println("WA x " << s["WA"]);
    println("TLE x " << s["TLE"]);
    println("RE x " << s["RE"]);

    return 0;
}


Measured memory_bytes: 3660
#include<bits/stdc++.h>
using namespace std;
int main() {
        int n;
	cin>>n;
        int a[n+1];
	for (int i=0; i<n;i++) {
		cin>>a[i];
         }
        int k=0;
        for (int i=0; i<n;i++) {
         while (a[i] % 2 == 0) {
                   a[i] /= 2;
                   k++;
            }
       }
	cout<<k<<"\n";
	
}


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

constexpr int INF = 1e9;

int main() {
    int n, m;
    cin >> n >> m;
    vector<int> W(n+2), E(n+2);
    for(int i=0; i<m; ++i) {
        for(int j=0; j<n; ++j) {
            char c;
            cin >> c;
            if(c == 'E') {
                E[j+1]++;
            } else {
                W[j+1]++;
            }
        }
    }
    for(int i=0; i<n+1; ++i) {
        E[i+1] += E[i];
        W[i+1] += W[i];
    }

    int sum = INF;
    int res = 0;
    for(int i=0; i<=n+1; ++i) {
        if(sum > E[i] + (W[n+1] - W[i])) {
            res = i;
            sum = E[i] + (W[n+1] - W[i]);
        }
    }
    cout << res << " " << res+1 << endl;
}


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

int n;
int a[5][5];

int row[5];
int col[5];

int dig[4];

int main(){
	for(int i=1;i<=3;i++){
		for(int j=1;j<=3;j++){
			cin >> a[i][j];
		}
	}
	cin >> n;
	bool dpt = 0;
	while(n--){
		int x;
		cin >> x;
		for(int i=1;i<=3;i++){
			for(int j=1;j<=3;j++){
				if(a[i][j] == x){
					row[i]++;
					col[j]++;
					if(row[i] == 3) dpt = 1;
					if(col[j] == 3) dpt = 1;
					if(i == j){
						dig[1]++;
						if(dig[1] == 3) dpt = 1;
					}
					if(i+j == 4){
						dig[2]++;
						if(dig[2] == 3) dpt = 1;
					}
				}
			}
		}
	}
	if(dpt) cout << "Yes\n";
	else cout << "No\n";
	return 0;
}


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

int main()
{
    int p[5][5][15]={},n,b,f,r,v;

    cin>>n;

    for(int i=1;i<=n;i++){
        cin>>b>>f>>r>>v;

        p[b][f][r]+=v;
    }

    for(int i=1;i<=4;i++){
        for(int j=1;j<=3;j++){
            for(int k=1;k<=10;k++){
                cout<<" "<<p[i][j][k];
            }
            cout<<endl;
        }
        if(i!=4){
            cout<<"####################"<<endl;
        }
    }

    return 0;
}


Measured memory_bytes: 3080