akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<algorithm>
#include<string>
#include<cstring>
#include<sstream>
#include<iomanip>
#include<limits>
#include<deque>
#include<map>
#include<list>
#include<set>
#include <unordered_set>
#include<vector>
#include<cmath>
#include<cstdio>
#include<memory>
#include<bitset>
#include<stack>
#include <functional>
#include <queue>
#include <regex>

using namespace std;

constexpr int MOD = 1000000007;
constexpr int INF = 1050000000;



int main() {
	int H, W, h, w; cin >> H >> W >> h >> w;

	cout << (H - h) * (W - w) << endl;










}


Measured memory_bytes: 256
m,f,r = gets.split.map &:to_i
grade = ""
score = 0

while m!=-1 || f!=-1 || r!= -1 do
    score = m+f
    if(m==-1 || f ==-1)
        grade = "F";
    elsif(score >= 80)
        grade = "A";
    elsif(score < 80 && score >= 65)
        grade = "B";
    elsif(score < 65 && score >= 50)
        grade = "C";
    elsif(score < 50 && score >= 30)
        if(r>=50)
            grade = "C";
        else
            grade = "D";
        end
    else
        grade = "F";
    end
    puts grade
    m,f,r = gets.split.map &:to_i
end

Measured memory_bytes: 8652
#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9 + 5;
int main(){
    int a[3][3][2];
    for(int i = 0; i < 3; i++) {
        for(int j = 0; j < 3; j++) {
            cin >> a[i][j][0];
            a[i][j][1] = 0;
        }
    }
    int n; cin >> n;
    int b[n];
    for(int q = 0;  q < n; q++) {
        int x; cin >> x;
        for(int i = 0; i < 3; i++) {
            for(int j = 0; j < 3; j++) {
                if(a[i][j][0] == x) {
                    a[i][j][1] = 1;
                }
            }
        }
    }
    bool check = false;
    for(int i = 0; i < 3; i++) {
        int cnt = 0;
        int count = 0;
        for(int j = 0; j < 3; j++) {
            cnt += a[i][j][1];
            count += a[j][i][1];
        }
        if(cnt == 3){
            check = true;
        }
        if(count == 3) {
            check = true;
        }
    }
    if(a[0][0][1] + a[1][1][1] + a[2][2][1] == 3) {
        check = true;
    }
    else if(a[1][1][1] + a[2][0][1] + a[0][2][1] == 3) {
        check = true;
    }
    if(check){
        cout << "Yes";
    }
    else{
        cout << "No";
    }

    return 0;
}

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


void solve(long long H, long long A){
    if(H%A==0)
        cout<<H/A<<endl;
    else
        cout<<H/A+1<<endl;
}

int main(){
    long long H;
    scanf("%lld",&H);
    long long A;
    scanf("%lld",&A);
    solve(H, A);
    return 0;
}


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

void solve()
{
    int n;
    scanf("%d",&n);
    int sum=n%1000;
    if(sum==0)
    {
        printf("%d",sum);
    }
    else
    {
        printf("%d",1000-sum);
    }
}
int main()
{
    solve();   
    return 0;
}

Measured memory_bytes: 3808
#include<iostream>
using namespace std;
const int N = 1e5+10;
int main()
{
    int ac=0,wa=0,tle=0,re=0;
    int n;
    cin>>n;
    string s;
    for(int i=1; i<=n; i++)
    {
        cin>>s;
        if(s=="AC")
            ac++;
        else if(s=="WA")
            wa++;
        else if(s=="TLE")
            tle++;
        else
            re++;
    }
    cout<<"AC x "<<ac<<endl;
    cout<<"WA x "<<wa<<endl;
    cout<<"TLE x "<<tle<<endl;
    cout<<"RE x "<<re<<endl;
     return 0;
}


Measured memory_bytes: 3628
#!/usr/bin/env python3
def solve(n, k):
    p = 0
    for i in range(1, n + 1):
        q = 1
        j = i
        while j < k:
            q /= 2
            j *= 2
        p += q / n
    return p
print('%.12f' % solve(*map(int, input().split())))


Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
    
#define FAST ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
#define ordered_set tree<int, null_type,less_equal<int>, rb_tree_tag,tree_order_statistics_node_update>
    
#define int long long
#define double long double
    
#define all(a)      (a).begin(),(a).end()
#define sz(x)       (int)x.size()
    
#define ff first
#define ss second
#define mp make_pair
         
#define pb push_back
#define endl "\n" 
         
#define f(i,l,r) for(int i=l;i<=r;i++)
#define rf(i,r,l) for(int i=r;i>=l;i--)    
 
#define bp __builtin_popcountll
#define inf 1e18
    
const int N=80+5;
const int MOD=1e9+7;
int n;
int a[N];
void solve()
{
	int ans=1000,s=0;
	cin>>n;
	int a[n+2]={0};
	for(int i=1;i<=n;i++)
	cin>>a[i];
	int dp[n+2]={0};
	int i=1;
	while(i<=n)
	{
		if(a[i+1]<a[i])
		{
			dp[i]=1;
		}
		i++;
	}
	for(i=1;i<=n;i++)
	{
		if(dp[i]==1)
		{
			// cout<<i<<" ";
			int pp=s*a[i];
			s=0;
			ans+=pp;
		}
		else
		{
			int pp=ans/a[i];
			ans-=(pp*a[i]);
			s+=pp;
		}
	}
	cout<<ans;
}
 
signed main()
{
	FAST
    int t=1;
    // cin>>t;
    for(int tc=1;tc<=t;tc++)
    {
    	// cout<<"Case #"<<tc<<": "<<endl;
    	solve();
    }
}


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

int main() {
	int N; cin >> N;
	vector<int> p(N); for(int i = 0; i < N; ++i) cin >> p[i];

	int maxn = *max_element(p.begin(), p.end());

	for(int i = 0; i < N; ++i) {
		if(maxn == p[i]) {
			p[i] = p[i] / 2;
			break;
		}
	}

	cout << accumulate(p.begin(), p.end(), 0) << endl;
}

Measured memory_bytes: 256
// LARGE WEIGHTS .

#include <bits/stdc++.h>
using namespace std;
#define ll long long int

ll dp[100001][100];
bool vis[100001][100];

ll solve(ll y, ll i, ll n, ll w[], ll v[])
{
	if(y<=0) return 0;
	if(i==n) return 1000000001;

	if(vis[y][i]) return dp[y][i];
	vis[y][i] = 1;

	return dp[y][i] = min(solve(y,i+1,n,w,v),w[i]+solve(y-v[i],i+1,n,w,v));
} 

int main()
{
	ll n, c;
	cin>>n>>c;
	ll w[n], v[n];
	for(ll i=0; i<n; i++) cin>>w[i]>>v[i];
	
	for(ll j = 100001; j>=0; j--)
	{
		if(solve(j,0,n,w,v)<=c)
		{
			cout<<j;
			break;
		}
	}
	return 0;
}

Measured memory_bytes: 88192
import sys
from statistics import *
from collections import *
stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

n = ni()
ct = 0
dic = {}
for i in range(n):
    s = input()
    if s not in dic.keys():
        dic[s] = 1
    else:
        dic[s] += 1
m = ni()
for i in range(m):
    t = input()
    if t in dic.keys():
        dic[t] -= 1
print(max(0, *dic.values()))

Measured memory_bytes: 5276
#include <iostream>
#include <stdio.h>
using namespace std;

int main(){
        int w,h,x,y,r;
        cin>>w>>h>>x>>y>>r;
        cout<<((x-r>=0&&x+r<=w&&y-r>=0&&y+r<=h)?"Yes":"No")<<endl;
        return 0;
}

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

int main()
{
    double a,b,x;   /// a= baza , b=inaltimea , x= volum apa

    cin>>a>>b>>x;

    double h = x/(a*a); /// inaltimea apei

    double v = a*a*b; ///inaltimea vasului

    double cateta1 , cateta2 ;

    if(h>=b/2.0){

        cateta1 = b-h;

        cateta2 = a/2.0;

        double incl = atan2(cateta2,cateta1);

        incl = 90.0-incl*180/M_PI;

        cout<<fixed<<setprecision(10)<<incl;

    }

    else{

        double y = (a*h*2.0)/b;

        cateta1=y;

        cateta2=b;

        double incl = atan2(cateta2,cateta1);

        incl = incl*180.0/M_PI;

        cout<<fixed<<setprecision(10)<<incl;


    }


    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iomanip>
#include <algorithm>
#define ll long long
#include <unordered_map>
using namespace std;
 
int main() {
  ll X;
  cin >> X;
  if(X % 100 > X / 100 * 5) cout << 0 << endl;
  else cout << 1 << endl;
}

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

signed main(void)
{
	double r;
	cin >> r;
	cout << fixed << setprecision(21) <<(double) r * 2 * 3.1415926535 << endl;
	return 0;
}


Measured memory_bytes: 3764
#include <bits/stdc++.h>
using namespace std;
int main() {
	int n[2];
	while(cin>>n[0]>>n[1],n[0],n[1]){
		int num[2][101],sum[2]={};
		for(int i=0;i<2;i++){
			for(int j=0;j<n[i];j++){
				cin>>num[i][j];
				sum[i]+=num[i][j];
			}
			sort(num[i],num[i]+n[i]);
		}
		int ans[2]={101,101};
		for(int i=0,now[2];i<n[0];i++){
			for(int j=0;j<n[1];j++){
				int now[2]={sum[0]-num[0][i]+num[1][j],sum[1]-num[1][j]+num[0][i]};
				if(now[0]==now[1]){
					if(num[0][i]+num[1][j]<ans[0]+ans[1]){
						swap(num[0][i],ans[0]);
						swap(num[1][j],ans[1]);
					}
					break;
				}
			}
		}
		if(ans[0]==101)cout<<-1<<endl;
		else cout<<ans[0]<<" "<<ans[1]<<endl;
	}
}

Measured memory_bytes: 1180
#include<stdio.h>
#define NUM 1000
int main(){
   int i,N,A[NUM],cnt=0;
   scanf("%d",&N);
   for(i=0;i<N;i++){
      scanf("%d",&A[i]);
   }
   for(i=0;i<N;i++){
      if(A[i]%2==0){
         if(A[i]%3!=0&&A[i]%5!=0){
            cnt++;
         }
      }
   }
   if(cnt>0){
      printf("DENIED");
   }else{
      printf("APPROVED");
   }
   
   return 0;
}

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

// vectorとsortの場合

int main() {
  int N;
  cin >> N;
  
  vector<int> A(N);
  for (int i = 0; i < N; i++) cin >> A.at(i);
  
  sort(A.begin(), A.end());
  reverse(A.begin(), A.end());
  
  int alice = 0, bob = 0;
  
  for (int i = 0; i < N; i++) {
    if (i % 2 == 0) alice += A.at(i);
    else bob += A.at(i);
  }
  
  cout << (alice - bob) << endl;
}


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

using namespace std;

int main()
{
    long long a,b,c,d;
    cin>>a>>b>>c>>d;
    long long prod1 = a*c;
    long long prod2 = a*d;
    long long prod3 = b*c;
    long long prod4 = b*d;
    long long ans = max({prod1,prod2,prod3,prod4});
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3644
#include <iostream>
#include <iomanip>
#include <string>
#include <string.h>
#include <math.h>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <utility>
#include <deque>
#include <queue>

#define rep(i, n) for(int i = 0; i < n; ++i)
#define REP(i, m, n) for(int i = m; i < n; ++i)
#define rrep(i,n) for(int i = n; i >= 0; --i)
#define RREP(i, m, n) for(int i = n; i >= m; --i)

using ll = long long;
using ull = unsigned long long;
using pii = std::pair<int, int>;
using pll = std::pair<long long, long long>;
using pli = std::pair<long long, int> ;

using namespace std;

const long long MOD = 1000000007;

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

	int n, m;
	cin >> n >> m;
	int* ans;
	ans = new int[n];
	memset(ans, 0, sizeof(int)*n);
	int* flag;
	flag = new int[n];
	memset(flag, 0, sizeof(int)*n);

	rep(i, m) {
		int p;
		string judge;
		cin >> p >> judge;

		if (judge == "AC") flag[p - 1] = 1;
		else if (flag[p - 1] == 0) ++ans[p-1];
	}

	int ac = 0;
	int wa = 0;
	rep(i, n) {
		ac += flag[i];
		wa += flag[i] * ans[i];
	}

	cout << ac << " " << wa << "\n";

	return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <utility>
#include <cstdio>
#include <cstdlib>
using namespace std;

typedef pair<int,int> pii;
typedef long long LL;

const LL MOD = 1000000007;
const char *p;
long long esp_org, esp_new;

pii expr();

pii factor(){
	if(*p == '~'){
		++p;
		pii a = factor();
		return pii(a.second, a.first);
	}
	if(*p == '('){
		++p;
		pii a = expr();
		++p;
		return a;
	}
	int d;
	sscanf(p, "x%*d%n", &d);
	p += d;
	return pii(1, 1);
}

pii term(){
	pii a = factor();
	while(*p == '&'){
		++p;
		pii b = factor();
		LL t = (LL)a.first * b.first;
		LL f = a.second * LL(b.first + b.second) + (LL)a.first * b.second;
		a = pii(t % MOD, f % MOD);
	}
	return a;
}

pii expr(){
	pii a = term();
	while(*p == '|'){
		++p;
		pii b = term();
		LL t = a.first * LL(b.first + b.second) + (LL)a.second * b.first;
		LL f = (LL)a.second * b.second;
		a = pii(t % MOD, f % MOD);
	}
	return a;
}

int main(){
	const int sz = 48 << 20;
	void *stptr = malloc(sz);
	esp_new = (long long)stptr + sz - 1;
	__asm__ volatile("mov %rsp, esp_org");
	__asm__ volatile("mov esp_new, %rsp");

	ios::sync_with_stdio(false);

	string s;
	cin >> s;
	p = s.c_str();

	pii p = expr();
	cout << p.first << endl;
	
	__asm__ volatile("mov esp_org, %rsp");
	free(stptr);
}

Measured memory_bytes: 50744
import java.util.*;
import java.awt.Rectangle;

public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		while(n-- > 0){
			Rectangle r = new Rectangle(sc.nextInt()-1,sc.nextInt()-1,sc.nextInt()+2,sc.nextInt()+2);
			int ans=0,m=sc.nextInt();
			while(m-- > 0)if(r.contains(sc.nextInt(), sc.nextInt()))ans++;
			System.out.println(ans);
		}
	}
}

Measured memory_bytes: 13000
#include<cstdio>
#include<iostream>
#include<cmath>
#define eps 1e-6
using namespace std;
double i,j,n,x;
int main()
{
	scanf("%lf",&n);
	for(i=1;i<=3500;i++)
		for(j=1;j<=3500;j++)
		{
			x=1/(4/n-1/i-1/j);
			if(fabs(x-int(x+eps))<eps)
			{
				cout<<int(i+eps)<<" "<<int(j+eps)<<" "<<int(x+eps)<<endl;
				return 0;
			}
		}
}

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

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

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

    // start
    int a, b, x;
    cin >> a >> b >> x;
    cout << (a <= x && x <= (a + b) ? "YES" : "NO") << endl;
    // end

    return 0;
}


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

using namespace std;

int main()
{
 int a,b,x,z,e,f;
 cin>>a>>b>>x>>z;
 e=a-x;
 f=b-z;
 if(a-x==1&&b-z==1)
 cout<<1;
  else if(a==x&&b==z)
  {
  cout<<0;    
  }
  
  else 
  cout<<(e*f)<<endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
 
using namespace __gnu_pbds;
using namespace std;

template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define all(a) a.begin(),a.end()
#define F first
#define S second
#define pb push_back
#define ll long long
#define vi vector<int>
#define pi pair<int,int>
#define mp make_pair

#ifdef LOCAL
#include "debug.h"
#else
#define debug(...) 42
#endif

const int mod=1e9+7;
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template<typename A,typename B> istream& operator>>(istream&,pair<A,B>&);
template<typename A> istream& operator>>(istream&,vector<A>&);
void add(int&,int);
int mul(int,int);
int powz(int,int);
int sub(int,int);
template<typename A> ostream& operator<<(ostream&,vector<A>&);

const int N=500001;
	
void solve(){
	int n,a,b;
	cin>>n>>a>>b;
	cout<<min(1ll*n*a,1ll*b);
	
}
	
signed main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int tc=1;
	//~ cin>>tc;
	for(int _=0;_<tc;_++){
		//~ cout<<"Case #"<<_+1<<": ";
		solve();
		if(_!=tc-1)
		cout<<"\n";
	}
}
 
int mul(int a,int b)
{
	return ((a)*1ll*(b))%mod;
}
 
void add(int &a,int b)
{
	a+=b;
	if(a>=mod)a-=mod;
}

int sub(int a,int b){
	a-=b;
	if(a<0){
		a+=mod;
	}
	return a;
}
 
int powz(int a,int b)
{
	int res=1;
	while(b)
	{
		if(b&1)res=mul(res,a);
		b/=2;
		a=mul(a,a);
	}
	return res;
}
 
template <typename A, typename B>
istream& operator>>(istream& input,pair<A,B>& x) {
	input>>x.F>>x.S;
	return input;
}
 
template <typename A>
istream& operator>>(istream& input,vector<A>& x) {
	for(auto& i:x)
		input>>i;
	return input;
}
 
template<typename A>
ostream& operator<<(ostream& output,vector<A>& x) {
	for(auto& i:x)
	    output<<i<<' ';
	return output;	
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
	
	int i;
	int a,b;
	int total;
	int digit;
	

	while( scanf("%d%d",&a, &b) != EOF){
		digit = 0;
		total = a + b;
		while( total != 0) {
			total /= 10;
			digit++;
		}
		printf("%d\n", digit);
	}
	
	return 0;
}

Measured memory_bytes: 600
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <iomanip>
#include <cmath>

using namespace std;
typedef long long ll;

#define cout (cout << setprecision(12))

int main() {
    string s;
    cin >> s;
    int ans = 0;
    for (int i = 0; i < s.size() / 2; i++) {
        if (s[i] != s[s.size() - 1 - i]) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#!/usr/bin/python3

from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b


def main():
    N = int(input())
    F = []
    for _ in range(N):
        F.append(list(map(int, input().split())))
    P = []
    for _ in range(N):
        P.append(list(map(int, input().split())))

    ans = -INF
    for p in product([0, 1, 2, 3], repeat=5):
        if sum(p) == 0:
            continue
        t = 0
        for n in range(N):
            num = 0
            for y in range(0, 10, 2):
                if p[y // 2] == 1:
                    num += F[n][y]
                if p[y // 2] == 2:
                    num += F[n][y + 1]
                if p[y // 2] == 3:
                    num += F[n][y] + F[n][y + 1]

            t += P[n][num]
        ans = max(ans, t)
    
    print(ans)


if __name__ == '__main__':
    main()


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

//abbriviations
typedef long long ll;
typedef vector<ll> vll;
typedef pair<ll,ll> pll;

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

//theory
//max(a,b)->returns the larger among a and b

//code
// do 
//     {
//         //process s
//     } 
// while (next_permutation(s.begin(),s.end()));

long long __gcd(ll a, ll b) 
{ 
    if (b == 0) 
        return a; 
    return __gcd(b, a % b);
}



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

    ll h1,h2,m1,m2,k;
    cin >> h1 >> m1 >>h2 >> m2 >> k;
    ll tot=(h2-h1)*60+m2-m1-k;
    tot=max(tot,ll(0));
    cout << tot;


    return 0;
}

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

// macros
#define pb emplace_back
#define mk make_pair
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) for(int i=((int)(n)-1);i>=0;i--)
#define irep(itr, st) for(auto itr = (st).begin(); itr != (st).end(); ++itr)
#define irrep(itr, st) for(auto itr = (st).rbegin(); itr != (st).rend(); ++itr)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define bit(n) (1LL<<(n))
// functions
template <class T>bool chmax(T &a, const T &b){if(a < b){a = b; return 1;} return 0;}
template <class T>bool chmin(T &a, const T &b){if(a > b){a = b; return 1;} return 0;}
template <typename T> istream &operator>>(istream &is, vector<T> &vec){for(auto &v: vec)is >> v; return is;}
template <typename T> ostream &operator<<(ostream &os, const vector<T>& vec){for(int i = 0; i < vec.size(); i++){ os << vec[i]; if(i + 1 != vec.size())os << " ";} return os;}
template <typename T> ostream &operator<<(ostream &os, const set<T>& st){for(auto itr = st.begin(); itr != st.end(); ++itr){ os << *itr; auto titr = itr; if(++titr != st.end())os << " ";} return os;}
template <typename T> ostream &operator<<(ostream &os, const unordered_set<T>& st){for(auto itr = st.begin(); itr != st.end(); ++itr){ os << *itr; auto titr = itr; if(++titr != st.end())os << " ";} return os;}
template <typename T> ostream &operator<<(ostream &os, const multiset<T>& st){for(auto itr = st.begin(); itr != st.end(); ++itr){ os << *itr; auto titr = itr; if(++titr != st.end())os << " ";} return os;}
template <typename T> ostream &operator<<(ostream &os, const unordered_multiset<T>& st){for(auto itr = st.begin(); itr != st.end(); ++itr){ os << *itr; auto titr = itr; if(++titr != st.end())os << " ";} return os;}
template <typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &p){os << p.first << " " << p.second; return os;}
template <typename T1, typename T2> ostream &operator<<(ostream &os, const map<T1, T2> &mp){for(auto itr = mp.begin(); itr != mp.end(); ++itr){ os << itr->first << ":" << itr->second; auto titr = itr; if(++titr != mp.end())os << " "; } return os;}
template <typename T1, typename T2> ostream &operator<<(ostream &os, const unordered_map<T1, T2> &mp){for(auto itr = mp.begin(); itr != mp.end(); ++itr){ os << itr->first << ":" << itr->second; auto titr = itr; if(++titr != mp.end())os << " "; } return os;}
//  types
using ll = long long int;
using P = pair<int, int>;
// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double EPS = 1e-10;
const int mod = 1000000007;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};
// io
struct fast_io{
  fast_io(){ios_base::sync_with_stdio(false); cin.tie(0); cout << fixed << setprecision(20);}
} fast_io_;


int main(int argc, char const* argv[])
{
  int n; cin >> n;
  string s, t; cin >> s >> t;
  rep(i, n){
    cout << s[i] << t[i];
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int a[3000005];
int main()
{
    int n;
    scanf("%d",&n);
    for(int i=0; i<3*n; i++)
        scanf("%d",&a[i]);
    multiset<int > s1,s2,s3;
    multiset<int >::iterator it;
    for(int i=0; i<n; i++)
        s1.insert(a[i]);
    for(int i=n; i<3*n; i++)
        s2.insert(a[i]);
    for(int i=0; i<n; i++)
    {
        s3.insert(*(s2.begin()));
        s2.erase(s2.begin());
    }
    long long x=0,y=0,maxx=0;
    for(it=s1.begin(); it!=s1.end(); it++)
        x+=*it;
    for(it=s3.begin(); it!=s3.end(); it++)
        y+=*it;
    maxx=x-y;
    for(int i=n; i<2*n; i++)
    {
        if(a[i]>*(s1.begin()))
        {
            x-=*(s1.begin());
            x+=a[i];
            s1.erase(s1.begin());
            s1.insert(a[i]);
            if(s3.find(a[i])!=s3.end())
            {
                y-=a[i];
                s3.erase(s3.find(a[i]));
                s3.insert(*(s2.begin()));
                y+=*(s2.begin());
                s2.erase(s2.begin());
            }
            else s2.erase(s2.find(a[i]));
            maxx=max(maxx,x-y);
        }
        else
        {
            if(s3.find(a[i])!=s3.end())
            {
                y-=a[i];
                s3.erase(s3.find(a[i]));
                s3.insert(*(s2.begin()));
                y+=*(s2.begin());
                s2.erase(s2.begin());
            }
        }
    }
    cout<<maxx;
    return 0;
}



Measured memory_bytes: 15488
def count(x):
    cnt = 0
    for i in range(1, x + 1):
        if x % i == 0:
            cnt += 1
    return cnt

N = int(input())

cnt = 0
for i in range(1, N + 1, 2):
    if count(i) == 8:
        cnt += 1

print(cnt)

Measured memory_bytes: 3060
import java.util.Scanner

object Main{
  def main(args: Array[String]): Unit = {
    val sc = new Scanner(System.in)
    val n = sc.nextInt
    val array = List.fill(n)(sc.nextInt)
    val max = array.max
    val min = array.min
    println(max-min)
  }
}

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

int main() {
    int N; cin >> N;
    vector<long long> S(N + 1, 0);
    for(int i=0; i<N; ++i) {
        cin >> S[i + 1];
        S[i + 1] += S[i];
    }

    long long res = 1001001001001001001;
    for(int k=1; k<N; ++k) {
        res = min(res, abs(S[N] - S[k] - S[k]));
    }
    cout << res << endl;
}

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

using namespace std;

#define loop(i, n) for(int i = 0;i < int(n);i++)
#define rloop(i, n) for(int i = int(n);i >= 0;i--)
#define range(i, a, b) for(int i = int(a);i <= int(b);i++)
#define SZ(c) int(c.size())
#define ALL(c) c.begin(), c.end()
#define RALL(c) c.rbegin(), c.rend()
#define PI acos(-1)
#define pb push_back
#define mp make_pair
#define fr first
#define sc second
#define sfi1(v) scanf("%d",&v)
#define sfi2(v1, v2) scanf("%d %d",&v1,&v2)
#define sfi3(v1, v2, v3) scanf("%d %d %d",&v1,&v2,&v3)
#define sfll1(v) scanf("%I64d",&v);
#define sfll2(v1, v2) scanf("%I64d %I64d",&v1,&v2)
#define sfll3(v1, v2, v3) scanf("%I64d %I64d %I64d",&v1,&v2,&v3)
#define endl '\n'

typedef vector<int> vi;
typedef vector<pair<int, int> > vii;
typedef long long ll;
typedef pair<int, int> pii;

const int N = 105;
const int SUM = 1e4 + 4;
int dp[N][SUM];
int arr[N];
int n;

int solve(int idx, int s) {
    if (idx == n)return s % 10 == 0 ? 0 : s;
    int &ret = dp[idx][s];
    if (~ret)return ret;
    return ret = max(solve(idx + 1, s), solve(idx + 1, s + arr[idx]));
}

int main() {

#ifndef ONLINE_JUDGE
    freopen("in.in", "r", stdin);
    //freopen("out.in", "w", stdout);
#endif
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    cin >> n;
    loop(i, n)cin >> arr[i];
    memset(dp, -1, sizeof dp);
    cout << solve(0, 0) << endl;

    return 0;
}


Measured memory_bytes: 7720
#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<deque>
#include<regex>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>

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

typedef int long long ll;
using namespace std;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
const ll MOD = 1e9 + 7;
static const int MAX = 100;
static const int INF = (1 << 23);

int main() {

    int n,k;
    cin>>n>>k;
    vector<int> v(n);


    rep(i,n){
        cin>>v[i];

    }

    int ans=0;
    int lim=min(n,k);
    vector<int> lt;
    int sum1=0;
    for(int l=0;l<=lim;l++){
        if(l!=0){lt.push_back(v[l-1]);sum1+=v[l-1];}
        vector<int> rt;
        rt=lt;
        int sum2=0;


        for(int r=0;r<=lim-l;r++){

            if(r!=0){
                sum2+=v[n-r];
                rt.push_back(v[n-r]);
            }


           /* for(int i=0;i<l;i++){
                sum+=v[i];
                //  if(v[i]<0) {
                te.push_back(v[i]);
                //}
            }*/
          /*  for(int i=0;i<r;i++){
                sum+=v[n-i-1];
                //  if(v[n-i-1]<0) {
                te.push_back(v[n - i - 1]);
                //}
            }*/
          int sum=sum1+sum2;

            int a=k-(l+r);
            int b=rt.size();
            sort(rt.begin(),rt.end());
            for (int tt = 0; tt <= min(a, b); tt++) {
                if(tt!=0){ sum-= rt[tt-1];}
                if (ans < sum) {
                    ans = sum;
                }
            }
            //cout<<l<<" "<<r<<" "<<ans<<endl;
        }
    }

    cout<<ans<<endl;



    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#include<queue>
#include<functional>
using namespace std;
int n, m, k;
int main() {
	cin >> n >> m >> k;
	for (int i = 0; i <= n; i++) {
		for (int j = 0; j <= m; j++) {
			int V = i*(m - j) + j*(n - i);
			if (V == k) { cout << "Yes" << endl; return 0; }
		}
	}
	cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <random>
#include <cstdio>
#include <cstring>
#include <cmath>

// for i in f..<t { as swift
#define forin(i, f, t) for(auto i = f; i < t; i++)

using namespace std;
using ll = long long;

const int MAX_N = 100000;

struct Edge {
    int to;
    int cost;
};

vector<Edge> node[MAX_N + 1];
int weight[MAX_N + 1];

bool dfs(int idx, int cost) {
    if (weight[idx] != int(INFINITY))
        return weight[idx] == cost;
    weight[idx] = cost;
    for(auto e : node[idx])
        if (!dfs(e.to, cost + e.cost)) return false;
    return true;
}

int main() {
    forin(i, 0, MAX_N + 1) weight[i] = INFINITY;
    int n, m;
    cin >> n >> m;
    int l, r, d;
    forin(i, 0, m) {
        cin >> l >> r >> d;
        node[l].push_back(Edge{r, d});
        node[r].push_back(Edge{l, -d});
    }
    bool rec = true;
    forin(i, 1, n + 1) {
        if (node[i].size() > 0 && weight[i] == int(INFINITY)) rec &= dfs(i, 0);
    }
    cout << (rec ? "Yes" : "No") << endl;
}



Measured memory_bytes: 11008
import java.io.InputStream;
import java.io.PrintStream;
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        solve(System.in, System.out);
    }

    static void solve(InputStream is, PrintStream os) {
        // Your code here!
        Scanner scan = new Scanner(is);
        int A = scan.nextInt();
        int B = scan.nextInt();

        os.println(A*B);
    }
}

Measured memory_bytes: 27064
#include <iostream>
#include <string>
#include <algorithm>
#include <sstream>

#define REP(a, b) for((a) = 0; (a) < (b); i++)

typedef long long ll;

using namespace std;

int digits(ll n) {
        stringstream ss;
        string s;

        ss << n;
        s = ss.str();
        return s.length();
}

int main() {
        ll n, a, b, ans, cur;
        cin >> n;
        ans = digits(n);
        for (a = 1; a * a <= n; a++) {
                if (n % a)
                        continue;
                b = n / a;
                cur = max(digits(a), digits(b));
                ans = min(ans, cur);
        }
        cout << ans << endl;
        return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<stack>
#include<set>
#include<climits>
#include<cstdlib>
#include<cmath>
#include<string>

using namespace std;

#define INF 1 << 29
#define LL long long int

LL const MOD = 1000000007;

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

    int n;
    cin >> n;

    vector<int> a;
    a.push_back(1);

    for(int i = 6; i <= 100000; i *= 6){
        a.push_back(i);
    }

    for(int i = 9; i <= 100000; i *= 9){
        if(i % 6 == 0){

        }else{
            a.push_back(i);
        }
    }

    vector<int> dp(n+1,0);

    for(int i = 1; i < n+1; i++){
        dp[i] = dp[i-1] + 1;
    }

    for(int i = 1; i < a.size(); i++){
        for(int j = 0; j < n+1; j++){
            if(j - a[i] >= 0){
                if(dp[j] > dp[j-a[i]] + 1){
                    dp[j] = dp[j-a[i]] + 1;
                }
            }
        }
    }

    cout << dp[n] << endl;
    
    return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <bits/stdc++.h>
#define read(a) scanf("%d", &a)
#define read2(a,b) scanf("%d%d", &a, &b)
#define f(i,a,b) for (int i=a; i<b; i++)
#define F(i,a,b) for (int i=a; i<=b; i++)
#define fod(i,a,b) for (int i=a; i>=b; i--)
#define vi vector<int>
#define pb push_back
#define fi first
#define se second
#define all(x) x.begin(), x.end()
#define MOD 998244353
using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef map<int,int> mii;

const int maxn=1e5+5;
int A[maxn];
int B[maxn];
int main()
{
    int n, k;
    cin>>n>>k;
    F(i,1,n) cin>>A[i];
    B[2]=abs(A[2]-A[1]);
    F(i,3,n) {
        int res=B[i-1] +abs(A[i]-A[i-1]);
        F(j,2,k) {
            if (j>=i) break;
            res=min(res, B[i-j]+abs(A[i]-A[i-j]));
        }
        B[i]=res;
    }
    cout<<B[n];
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define rep(i,a,b) for(int i = (a);i<(b);i++)
#define REP(i,a,b) for(int i = (a);i<=(b);i++)
#define pb push_back
#define mk make_pair
#define all(c) (c).begin(),(c).end()
#define debug(x) cout<< #x << " = " << x << endl;
#define debug2(x,y) cout << #x <<" = "<< x << " --- "<<#y<< " = "<<y<<endl;
typedef pair<int, int> ii;
typedef long long ll;
const int INF = 0x3f3f3f3f;

int main(){
int a,b;
cin>>a>>b;
a--;b--;
cout<<a*b<<endl;
}

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

using namespace std;

vector<long long> b;
vector<long long> c;

bool comp(int i, int j) {
  return c[i] > c[j];
}

int main(int argc, char* argv[]) {
  long long N, M;
  cin >> N >> M;

  map<long long, int> m;
  priority_queue<long long> q;
  for (int i = 0; i < N; ++i) {
    long long tmp;
    cin >> tmp;
    if (m.find(tmp) == m.end()) {
      m[tmp] = 0;
      q.push(-tmp);
    }
    ++m[tmp];
  }

  b.resize(M);
  c.resize(M);
  vector<long long> indices(M);
  for (int i = 0; i < M; ++i) {
    cin >> b[i] >> c[i];
    indices[i] = i;
  }

  sort(indices.begin(), indices.end(), comp);

  for (int i = 0; i < M; ++i) {
    while (b[i] > 0) {
      long long smallest = -q.top();
      if (smallest >= c[i])
        break;
      if (m[smallest] > b[i]) {
        m[smallest] -= b[i];
        if (m.find(c[i]) == m.end()) {
          m[c[i]] = 0;
          q.push(-c[i]);
        }
        m[c[i]] += b[i];
        b[i] = 0;
      } else {
        int n = m[smallest];
        b[i] -= n;
        q.pop();
        m.erase(smallest);
        if (m.find(c[i]) == m.end()) {
          m[c[i]] = 0;
          q.push(-c[i]);
        }
        m[c[i]] += n;
      }
    }
  }

  long long ret = 0;
  for (map<long long, int>::iterator i = m.begin(); i != m.end(); ++i) {
    ret += i->first * i->second;
  }

  cout << ret << endl;

  return 0;
}

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

#define int long long

int fact(int n){
	return	n > 1 ? fact(n-1)*n : 1 ;
}

int check(vector<int>& a , vector<int>& b){
	for(int i = 0 ; i < a.size() ; i++){
		if(a[i] != b[i]) {
			if(a[i] > b[i]) return 1 ;
			else return -1 ;
		}
	}
	return 0 ;
}

int32_t main(){
	int n ;
	cin >> n ;
	vector<int> a(n) , b(n) ;
	for(int i = 0 ; i < n ; i++) cin >> a[i] ;
	for(int i = 0 ; i < n  ;i++) cin >> b[i] ;
	if(check(a,b) == 1){
		vector<int> c(a) ;
		a = b ;
		b = c ;
	}
	int count = 0 ;
	do{
		if(check(a,b) == 0){
			break ;
		}
		count++ ;
	} while(next_permutation(a.begin(),a.end())) ;
	cout << count ;
	return 0 ;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<n; i++)
#define rrep(i, n) for(int i=n-1; i>=0; i--)
#define FOR(i, a, b) for(int i=a; i<b; i++)
#define ALL(v) v.begin(),v.end()
#define pb push_back
#define eb emplace_back
#define mp make_pair
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int, ll> pil;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LLINF = 1e18;
const ll MOD = 1e9+7;
const double EPS = 1e-10;
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; }

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

    int left = 0, right = 0;
    rep(i, n) {
        if (s[i] == '(') {
            left++;
        } else {
            if (left > 0) left--;
            else right++;
        }
    }
    rep(i, right) cout << '(';
    cout << s;
    rep(i, left) cout << ')';
    cout << endl;
}



Measured memory_bytes: 256
#include <iostream>
#define N 14
using namespace std;
int main(){
  int n,num,s[N],h[N],c[N],d[N],i;
  char in;
  for(i=0;i<N;i++) s[i]=h[i]=c[i]=d[i]=0;
  cin >> n;
  for(i=0;i<n;i++){
    cin >> in;
    cin >> num;
    if(in=='S') s[num]=1;
    else if(in=='H') h[num]=1;
    else if(in=='C') c[num]=1;
    else d[num]=1;
  }
  for(i=1;i<N;i++){
    if(s[i]==0) cout << 'S' << ' ' << i << endl;
  }
  for(i=1;i<N;i++){
    if(h[i]==0) cout << 'H' << ' ' << i << endl;
  }
  for(i=1;i<N;i++){
    if(c[i]==0) cout << 'C' << ' ' << i << endl;
  }
  for(i=1;i<N;i++){
    if(d[i]==0) cout << 'D' << ' ' << i << endl;
  }
  return 0;
}

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

using namespace std;
typedef long long ll;
#define rep(i, s, e) for (int(i) = (s); (i) <= (e); ++(i))
#define all(x) x.begin(),x.end()


int main()
{
	int p, q, r; cin >> p >> q >> r;
	int ans = p + q + r;
	ans = min(ans - p, min(ans - q, ans - r));
	cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<limits>
using namespace std;
#pragma warning(disable:4996)

template<typename Type> class RMQ {
private:
	std::size_t size_; Type *dat;
	Type query_(std::size_t a, std::size_t b, std::size_t k, std::size_t l, std::size_t r) {
		if (r <= a || b <= l) return RMQ<Type>::inf;
		if (a <= l && r <= b) return dat[k];
		Type lc = query_(a, b, (k << 1), l, (l + r) >> 1);
		Type rc = query_(a, b, (k << 1) + 1U, (l + r) >> 1, r);
		return min(lc, rc);
	}
public:
	static const Type inf = std::numeric_limits<Type>::max() / 2;
	RMQ() {};
	RMQ(int size__) {
		for (size_ = 1U; size_ < size__; ) size_ <<= 1;
		dat = (Type *)malloc(sizeof(Type) * (size_ << 1));
		for (std::size_t i = 0U; i < (size_ << 1); i++) dat[i] = RMQ<Type>::inf;
	}
	template<class T>
	RMQ(T l, T r) {
		std::size_t n = (r - l);
		for (size_ = 1; size_ < n; size_ <<= 1); dat.resize(size_ << 1, RMQ<Type>::inf);
		dat = (Type *)malloc(sizeof(Type) * (size_ << 1));
		for (std::size_t i = 0U; i < n; i++) dat[i + size_] = *(l + i);
		for (std::size_t i = size_ - 1U; i > 0U; i--) dat[i] = std::min(dat[i << 1], dat[(i << 1) + 1]);
	}
	std::size_t size() { return size_; }
	void update(size_t i, Type x) {
		i += size_; dat[i] = x;
		while (i > 1U) i >>= 1, dat[i] = std::min(dat[i << 1], dat[(i << 1) + 1]);
	}
	Type query(size_t l, size_t r) {
		return query_(l, r, 1U, 0U, size_);
	}
};
long long N, Q, A, B, X[300000], dp[300000], d, ret = (1LL << 60);
int main() {
	cin >> N >> Q >> A >> B;
	for (int i = 1; i <= Q; i++)scanf("%lld", &X[i]);
	RMQ<long long>X1(N + 1), X2(N + 1);
	for (int i = 1; i <= N; i++)dp[i] = (1LL << 60);
	dp[B] = abs(A - X[1]); dp[A] = abs(B - X[1]);
	X1.update(B, -B + dp[B]); X2.update(B, B + dp[B]);
	X1.update(A, -A + dp[A]); X2.update(A, A + dp[A]);
	for (int i = 2; i <= Q; i++) {
		d += abs(X[i - 1] - X[i]);
		dp[X[i - 1]] = min(X1.query(0, X[i]) + X[i], X2.query(X[i], N + 1) - X[i]) - abs(X[i - 1] - X[i]);
		X1.update(X[i - 1], -X[i - 1] + dp[X[i - 1]]); X2.update(X[i - 1], X[i - 1] + dp[X[i - 1]]);
	}
	for (int i = 1; i <= N; i++)ret = min(ret, dp[i]);
	cout << ret + d << endl;
	return 0;
}

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

using namespace std;
using ll = long long;
constexpr int mod = 1e9+7;
constexpr int md = mod;
vector<string> s;
vector<vector<int>> num(55,vector<int>(55,10000));
int h,w;
int bfs(){
    queue<pair<int,int>> q;
    q.push({0,0});
    num[0][0] = 0;
    vector<pair<int,int>> dv = {{-1,0},{0,-1},{1,0},{0,1}};
    while(!q.empty()){
        auto cur = q.front();q.pop();
        if(cur.first == w-1 && cur.second == h-1) return num[cur.second][cur.first];
        for(auto v : dv){
            int dx = cur.first + v.first;
            int dy = cur.second + v.second;
            if(dx < 0 || dy < 0 || dx > w-1 || dy > h-1 || s[dy][dx] == '#' || num[dy][dx] != 10000) continue;
            if(num[dy][dx] > num[cur.second][cur.first] + 1) num[dy][dx] = num[cur.second][cur.first] + 1;
            q.push({dx,dy});
        }
    }
    return -1;
}
int main(){
    cin>>h>>w;
    s.resize(h);
    for(int i=0;i<h;++i)cin>>s[i];
    int ret = 0;
    int white = 0;
    for(int i=0;i<h;++i){
        for(int j=0;j<w;++j){
            if(s[i][j] == '.')white++;
        }
    }
    ret = bfs();
    if(ret != -1){
        ret = max(0,white - ret -1);
    }
    cout << ret << endl;
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
typedef vector<int> vec1;
typedef vector<string> vec2;
typedef vector<double> vec3;

int main() {
  
  int n, k;
  cin >> n >> k;
  vec1 a(n);
  for(int i = 0; i < k; i++) {
    int d;
    cin >> d;
    for(int j = 0; j < d; j++) {
      int A;
      cin >> A;
      a.at(A-1)++;
    }
  }
  int ans = 0;
  for(int i = 0; i < n; i++) {
    if(a.at(i) == 0) {
      ans++;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3604
#include<bits/stdc++.h>
using namespace std;
const int mod=998244353;
const int inv2=(mod+1)/2;
inline int qpow(int d,int z,int t=0,int a=1){
	for(;z;z>>=1,d=1ll*d*d%(mod-t))
		if(z&1) a=1ll*a*d%(mod-t); return a;
}
const int N=20;

int n,s,a[1<<N],b[1<<N];
inline void fwt(int *a){
	for(int i=0;i<(1<<n);++i) if(a[i]<0) a[i]+=mod;
	for(int i=0;i<n;++i){
		for(int len=1<<i,j=0;j<(1<<n);j+=2*len){
			for(int p=0;p<len;++p){
				int x=a[j+p],y=a[j+len+p];
				a[j+p]=(x+y)%mod;
				a[j+p+len]=(x-y+mod)%mod;
			}
		}
	}
}
inline void ifwt(int *a){
	for(int i=0;i<n;++i){
		for(int len=1<<i,j=0;j<(1<<n);j+=2*len){
			for(int p=0;p<len;++p){
				int x=a[j+p],y=a[j+len+p];
				a[j+p]=1ll*inv2*(x+y)%mod;
				a[j+p+len]=1ll*inv2*(x-y+mod)%mod;
			}
		}
	}
}

int main(){
	scanf("%d",&n); b[0]=1<<n;
	for(int i=0;i<(1<<n);++i) --b[i],scanf("%d",&a[i]),s+=a[i];
	for(int i=0;i<(1<<n);++i) a[i]=1ll*a[i]*qpow(s,mod-2)%mod;
	--a[0]; fwt(a); fwt(b);
	for(int i=1;i<(1<<n);++i) a[i]=1ll*b[i]*qpow(a[i],mod-2)%mod;
	a[0]=0; ifwt(a);
	int x=mod-a[0];
	for(int i=0;i<(1<<n);++i) printf("%d\n",(a[i]+x)%mod);
	return 0;
}

Measured memory_bytes: 5820
s = int(input())
cnt = 0
cnt4 = 0

if s == 1 or s == 2:
    print(4)
    exit()

while cnt4 < 2:
    cnt += 1
    if s == 4:
        cnt4 += 1
    if s % 2 == 0:
        s = s // 2
    else:
        s = 3 * s + 1
print(cnt)


Measured memory_bytes: 38256
#include <cstdio>

int main(void)
{
  int c;
  int n[26]={0};
  int i;
  char s[]="abcdefghijklmnopqrstuvwxyz";

  while((c = getchar()) != EOF){
    if('a'<=c && c<='z'){
      n[c-'a']++;
    }
    if('A'<=c && c<='Z'){
      n[c-'A']++;
    }
  }

  for(i=0;i<26;i++){
    printf("%c : %d\n", s[i],n[i]);
  }

  return 0;
}


Measured memory_bytes: 932
package main

import (
	"fmt"
	"strconv"
)

func main() {
	var a, b string
	fmt.Scan(&a, &b)

	c := a + b
	num, _ := strconv.Atoi(c)

	for i := 4; i*i <= num; i++ {
		if i*i == num {
			fmt.Println("Yes")
			return
		}
	}
	fmt.Println("No")
}


Measured memory_bytes: 512
/*#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>

#include <boost/rational.hpp>
*/
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
using ll = long long;
using ld = long double;
using pll = pair<ll,ll>;
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define rep3(i, n) for (ll i = 1; i < (ll)(n+1); i++)
#define rep4(i, s, n) for (ll i = (s); i < (ll)(n+1); i++)
#define repr(i,n) for (ll i = (n-1); i>=0;i--)
#define repr3(i,n) for(ll i = (n);i>0;i--)
#define repr4(i,s,n) for(ll i = (n);i>=(s);i--)
#define stlen(s) ll s.size()-1
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define cout(n) cout<<std::fixed<<std::setprecision(n)
using Graph = vector<vector<int>>;
using Graphw = vector<vector<pair<ll,ll>>>;
#define INF1  INT_MAX;
#define INF2  LLONG_MAX;
#define PI  3.14159265358979323846;
#define MOD 1000000007;
/*
namespace mp = boost::multiprecision;
// 任意長整数型
using Bint = mp::cpp_int;
// 仮数部長が32の浮動小数点数型
using Real32 = mp::number<mp::cpp_dec_float<32>>;
// 仮数部長が1024の浮動小数点数型
using Real1024 = mp::number<mp::cpp_dec_float<1024>>;
// 有理数型
using Rat = boost::rational<Bint>;
*/
const int mod = 1000000007;



int main(){

string S;
  int K;
  cin>>S>>K;
  for(int i=0;i<S.size();i++){
    if(('z'-S[i]+1)%26<=K){
      K-=('z'-S[i]+1)%26;
      S[i]='a';
    }
  }
  S[S.size()-1]='a'+(S[S.size()-1]-'a'+K)%26;
  cout<<S<<endl;



return 0;
}

Measured memory_bytes: 3748
#include<stdio.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<string.h>

#ifdef LOCAL
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
#define NDEBUG
#define eprintf(...) do {} while (0)
#endif
#include<cassert>

using namespace std;

typedef long long LL;
typedef vector<int> VI;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define EACH(i,c) for(__typeof((c).begin()) i=(c).begin(),i##_end=(c).end();i!=i##_end;++i)

template<class T> inline void amin(T &x, const T &y) { if (y<x) x=y; }
template<class T> inline void amax(T &x, const T &y) { if (x<y) x=y; }
template<class Iter> void rprintf(const char *fmt, Iter begin, Iter end) {
    for (bool sp=0; begin!=end; ++begin) { if (sp) putchar(' '); else sp = true; printf(fmt, *begin); }
    putchar('\n');
}

void MAIN() {
    int X, Y;
    scanf("%d%d", &X, &Y);
    int ans = 0;
    if (X <= 3) ans += 4 - X;
    if (Y <= 3) ans += 4 - Y;

    if (X == 1 && Y == 1) {
	ans += 4;
    }
    printf("%d\n", ans * 100000);
}

int main() {
    int TC = 1;
//    scanf("%d", &TC);
    REP (tc, TC) MAIN();
    return 0;
}



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

using namespace std;

void solve(int n){
    vector<pair<int,int> > v;
    for(int i=0;i<n;i++){
        int c;int t=0;
        cin >> c;
        for(int j=0;j<4;j++){
            int m,s;
            cin >> m >> s;
            t += 60*m + s;
        }
        v.push_back(make_pair(t,c));
    }
    sort(v.begin(),v.end());
    cout << v[0].second << endl;
    cout << v[1].second << endl;
    cout << v[v.size()-2].second << endl;
}

int main(){
    int n;
    while(cin >> n && n != 0){
        solve(n);
    }
}

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

#define int long long int
#define mp make_pair
using namespace std;

int n;
vector <int> v(302);
double dp[302][302][302];

double fun(int c1 , int c2 ,int c3)
{
    if(c1 < 0 || c2 < 0 || c3 < 0){
        return 0;
    }
    if(c1 == 0 && c2 == 0 && c3 == 0){
        return 0;
    }
    if(dp[c1][c2][c3] != -1){
        return dp[c1][c2][c3];
    }
    dp[c1][c2][c3] = n + c1*fun(c1 - 1 , c2 , c3) + c2*fun(c1 + 1 , c2 - 1 ,c3) + c3*fun(c1 , c2 + 1 , c3 - 1);
    dp[c1][c2][c3] = (dp[c1][c2][c3]) / (c1 + c2 + c3);
    return dp[c1][c2][c3];
}

int32_t main() {
    scanf("%lld", &n);
    int c1 = 0,c2 = 0,c3 = 0;
    for (int i = 0; i < n; ++i) {
        scanf("%lld", &v[i]);
        if(v[i] == 1){
            c1++;
        }
        if(v[i] == 2){
            c2++;
        }
        if(v[i] == 3){
            c3++;
        }
    }
    for (int i = 0; i < 302; ++i) {
        for (int j = 0; j < 302; ++j) {
            for (int k = 0; k < 302; ++k) {
                dp[i][j][k] = -1;
            }
        }
    }
    double ans = fun(c1 , c2 , c3);
    printf("%0.9lf",ans);
    return 0;
}

Measured memory_bytes: 215552
import java.io.*
import java.util.*

const val YES = "Yes"
const val NO = "No"
fun solve(N: Long){
    val SN = N.toString().map{ it - '0' }.sum().toLong()
    println(if(N%SN==0L) YES else NO)
    return
}


fun main(args: Array<String>) {
    fun StringArray(size: Int, init: (Int) -> String = { "\u0000" }): Array<String> {
        return Array<String>(size, init)
    }
    class Scanner(stream: InputStream) {
        private val reader = BufferedInputStream(stream).bufferedReader()
        private var st: StringTokenizer? = null
        fun next(): String {
            while (!(st?.hasMoreTokens() ?: false)) st = StringTokenizer(reader.readLine())
            return st!!.nextToken()
        }
    }
    val sc = Scanner(System.`in`)
    val N = sc.next().toLong()
    solve(N)
}



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

int main (){
    int a,b,c;

    cin >> a >> b >> c;

    if(a == b && a != c){cout << "Yes" << endl;}
    else if(a == c && a != b){cout << "Yes" << endl;}
    else if(b == c && a != b){cout << "Yes" << endl;}
    else{cout << "No" << endl;}

    return 0;




}

Measured memory_bytes: 3612
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
#define INF 999999999
#define rep(i,n) for(int i=0;i<n;i++)
const ll MOD = 1000000007;
ll cnt =0,ans=0;
const int MAX = 510000;

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

     for(int i=1;i<n;i++){
          if(a[i] - a[i-1] < 0){
               ans += ( a[i-1] - a[i] );
               a[i] += a[i-1] - a[i] ;
          }
     }
     cout << ans << endl;
}

Measured memory_bytes: 5168