akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"

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

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

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

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

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

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

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

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


/**************************************
** A main function starts from here  **
***************************************/
int main(){
  string S;
  cin >> S;
  ll N=S.size();
  llvec A;
  llvec B;
  llvec C;
  llvec X;
  rep(i, N){
    if(S[i]=='A')A.push_back(i);
    if(S[i]=='B')B.push_back(i);
    if(S[i]=='C')C.push_back(i);
    if(S[i]=='?')X.push_back(i);
  }

  ll ans = 0;
  rep(i, N){
    if(S[i]=='B' or S[i]=='?'){
      ll a = (ll)(lower_bound(ALL(A), i) - A.begin());
      ll xa = (ll)(lower_bound(ALL(X), i) - X.begin());
      ll c = (ll)(C.end() - upper_bound(ALL(C), i));
      ll xc = (ll)(X.end() - upper_bound(ALL(X), i));
      ll case1 = mod(a*c, MOD);
      case1 = mod(case1*modpow(3, xa+xc, MOD), MOD);
      ll case2 = mod(xa*c, MOD);
      case2 = mod(case2*modpow(3, xa+xc-1, MOD), MOD);
      ll case3 = mod(xc*a, MOD);
      case3 = mod(case3*modpow(3, xa+xc-1, MOD), MOD);
      ll case4 = mod(xc*xa, MOD);
      case4 = mod(case4*modpow(3, xa+xc-2, MOD), MOD);
      ans = mod(ans+case1, MOD);
      ans = mod(ans+case2, MOD);
      ans = mod(ans+case3, MOD);
      ans = mod(ans+case4, MOD);
    }
  }
  cout <<ans;
  return 0;
}


Measured memory_bytes: 1720
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
#define show(x) {for(auto i: x){cout << i << " ";} cout << endl;}
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
  int X, A;
  cin >> X >> A;
  if (X < A) puts("0");
  else puts("10");
  return 0;
}

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

int main(){
    int N, M, X[100000];
    cin >> N >> M;
    for(int i=0; i<M; i++) cin >> X[i];
    sort(X, X+M);

    vector<int> diff;
    for(int i=0; i<M-1; i++) diff.push_back(X[i+1] - X[i]);
    sort(diff.begin(), diff.end());

    int64_t ans = 0;
    for(int i=0; i<M-N; i++) ans += diff[i];
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1276
#include <iostream>
#define ll long long
#define rep(i,a,b) for(int (i)=(a);(i)<(b);++(i))

using namespace std;

ll solve(ll v, ll m, ll n, ll k)
{
    ll cs[] = {3, 5, 7};
    ll vs[] = {4, 2, 1};

    if (k >  m) return      0;
    if (v == 0) return n == 7;

    ll ret = 0;
    rep(i,0,3)
    {
        ret += solve(v/10, m, n|vs[i], k+cs[i]*v);
    }
    return ret;
}

int main()
{
    ll N;
    cin >> N;

    ll ans =  0;
    ll inv = 10;

    while (inv < N)
    {
        inv *= 10;
        ans += solve(inv, N, 0, 0);
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
package main

import "fmt"

func main() {
	ans := make([]int, 0)
	for {
		var n int
		fmt.Scan(&n)
		if n == 0 {
			break
		}
		a := make([]int, n)
		for i := range a {
			fmt.Scan(&a[i])
		}
		mind := int(1e9)
		for bits := 0; bits < (1 << uint(n)); bits++ {
			gsum, psum := 0, 0
			for j := 0; j < n; j++ {
				if (bits & (1 << uint(j))) != 0 {
					gsum += a[j]
				} else {
					psum += a[j]
				}
			}
			mind = min(mind, abs(gsum-psum))
		}
		ans = append(ans, mind)
	}
	for i := range ans {
		fmt.Println(ans[i])
	}
}

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

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}



Measured memory_bytes: 1172
#include<stdio.h>

int main(){
  int num_members, lim_height;
  scanf("%d %d", &num_members, &lim_height);
  
  int cnt = 0;
  int height_member;
  int i;
  for(i = 0; i < num_members; i++){
    scanf("%d", &height_member);
    if(height_member >= lim_height){
      cnt++;
    }
  }
  
  printf("%d", cnt);
}

Measured memory_bytes: 128
k, q = map(int, input().split())
d = list(map(int, input().split()))
for _ in range(q):
    n, x, m = map(int, input().split())
    tmp = x
    a = list(map(lambda y: y % m, d))
    c = 0
    s = 0
    c2 = 0
    s2 = 0
    for x in a:
        if x == 0:
            c += 1
        s += x
    for x in a[:(n - 1) % k]:
        if x == 0:
            c2 += 1
        s2 += x
    t = s * ((n - 1) // k) + s2 + tmp % m
    ans = n - 1 - t // m - c * ((n - 1) // k) - c2
    print(ans)


Measured memory_bytes: 75100
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define REP(a,b) for(int a=0;a<(b);++a)
#define REP1(i,n) for(int i=1;i<=(n);++i)
#define debug(x) cerr<<#x<<": "<<x<<'\n'
#define all(x) (x).begin(),(x).end()
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define isYES(x) printf("%s\n",(x) ? "YES" : "NO")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define isYes(x) printf("%s\n",(x) ? "Yes" : "No")
#define isPossible(x) printf("%s\n",(x) ? "Possible" : "Impossible")
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair
// #define INF (1<<29)

const long long INF = 1LL<<60;

#define Sp(p) cout<<setprecision(25)<< fixed<<p<<endl
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
#define pie 3.14159265358979323846
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;
template<class T=int>
T in(){T x;cin>>x;return (x);}
template<class T>
void print(T& x){cout<<x<<'\n';}

const int MOD =(int)1e9+7;
// const int mod =(int)998244353;
const int mod =(int)1e9+7;

const int MAX =510000;
ll fac[MAX],finv[MAX],inv[MAX];
void COMint(){
    fac[0]=fac[1]=1;
    finv[0]=finv[1]=1;
    inv[1]=1;
    for(int i=2;i<MAX;i++){
        fac[i]=fac[i-1]*i%MOD;
        inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;
        finv[i]=finv[i-1]*inv[i]%MOD;
    }
}
ll COM(int n,int k){
    if(n<k) return 0;
    if(n<0||k<0)return 0;
    return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD;
}
ll gcd(ll a,ll b){
    if(a<0)a=-a;
    if(b<0)b=-b;
    if(b==0)return a;
    if(a>b){
        swap(a,b);
    }
    return gcd(a,b%a);
}
ll lcm(ll a,ll b){
  if(a<0)a=-a;
  if(b<0)b=-b;
    ll g;g=gcd(a,b);
    return b/g*a;
}
bool compare_by_b(pair<int, int> a, pair<int, int> b) {
    if(a.second != b.second){
        return a.second < b.second;
    }else{
        return a.first < b.first;
    }
}
bool compare_by_a(pair<int, int> a, pair<int, int> b) {
    if(a.first != b.first){
        return a.first < b.first;
    }else{
        return a.second < b.second;
    }
}
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
ll RS(ll N,ll P,ll m){
    if(P==0){
        return 1;
    }else{
        if(P%2==0){
            ll t=RS(N,P/2,m);
            return t*t%m;
        }else{
            return N*RS(N,P-1,m)%m;
        }
    }
}
bool greater_pair(pair<ll,ll> a,pair<ll,ll> b){
    if(a.first!=b.first){
        return a.first>b.first;
    }else{
        return a.second>b.second;
    }
}

int main() {
    ios::sync_with_stdio(false);
    string s,t;
    cin>>s>>t;
    int ans=0;
    int l=s.length();
    REP(i,l){
        if(s[i]!=t[i])ans++;
    }
    cout<<ans<<endl;


    return 0;
} 


Measured memory_bytes: 3864
#include <stdio.h>

using namespace std;

void outPut(int Array[],char mark){
	for(int i = 1; i <= 13; i++){
		if(Array[i] == 0) printf("%c %d\n",mark,i);
	}
}

int main(){
	char mark[2];
	int n,S[14],H[14],C[14],D[14],tmp;
	for(int i = 0; i < 14; i++) S[i] = H[i] = C[i] = D[i] = 0;
	scanf("%d",&n);

	for(int i = 0; i < n; i++){
		scanf("%s %d",mark,&tmp);
		switch(mark[0]){
		case 'S':
			S[tmp] = 1;
			break;
		case 'H':
			H[tmp] = 1;
			break;
		case 'C':
			C[tmp] = 1;
			break;
		case 'D':
			D[tmp] = 1;
			break;
		}
	}
	outPut(S,'S');
	outPut(H,'H');
	outPut(C,'C');
	outPut(D,'D');
}

Measured memory_bytes: 1024
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <tuple>
#include <vector>

using namespace std;

#define rep(i, n) for (int64_t i = 0; i < (n); i++)
#define irep(i, n) for (int64_t i = 0; i <= (n); i++)
#define rrep(i, n) for (int64_t i = (n)-1; i >= 0; i--)
#define rirep(i, n) for (int64_t i = n; i >= 0; i--)

int main()
{
    int n;
    cin >> n;
    vector<int> p(n), q(n);

    rep(i, n)
    {
        cin >> p[i];
    }
    rep(i, n)
    {
        cin >> q[i];
    }

    vector<int> L(n);
    rep(i, n)
    {
        L[i] = i + 1;
    }

    int i = 0;
    int a, b;
    do {
        if (p == L) {
            a = i;
        }
        if (q == L) {
            b = i;
        }
        i++;
    } while (next_permutation(L.begin(), L.end()));

    cout << abs(a - b) << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
	ll a,v,b,w,t,g;
	cin>>a>>v>>b>>w>>t;
	if(a>b) g = a-b;
	if(b>a) g = b-a;
	if(g <= t * (v-w)) cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
	return 0;
}

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

void sort_string(string &s,int a) {
	for (int i(0); i < a-1;i++) {
		for (int j(0); j < a-1-i; j++) {
			if (s[j] > s[j + 1])swap(s[j],s[j+1]);
		}
	}
}

void reverse_sort_string(string &s,int a) {
	for (int i(0); i < a - 1; i++) {
		for (int j(0); j < a - 1 - i; j++) {
			if (s[j] < s[j + 1])swap(s[j], s[j + 1]);
		}
	}
}

int main(void) {
	string s, t;
	cin >> s >> t;
	sort_string(s, s.size());
	reverse_sort_string(t, t.size());
	int min(s.size());
	if (min > t.size())min = t.size();
	bool flag(true);
	for (int i(0); i < min; i++) {
		if (s[i] < t[i]) {
			flag = false;
			cout << "Yes" << endl;
			break;
		}
		else if (s[i]>t[i]) {
			flag = false;
			cout << "No" << endl;
			break;
		}
	}
	if (flag == true && s.size() < t.size())cout << "Yes" << endl;
	if (flag == true && s.size() > t.size())cout << "No" << endl;
	if (flag == true && s.size() == t.size())cout << "No" << endl;
	return 0;
}

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

int main(){
  long long n;
  long long t[50];

  t[0] = 0;
  for(int i=1;i<=30;i++){
    t[i] = t[i-1]*3+1LL;
  }

  while(scanf("%lld",&n)!=EOF){
    if(n<=0){
      printf("0\n");
      continue;
    }
    if(n==1){
      printf("1\n");
      continue;
    }
    if(n&1)printf("%lld\n",1LL + 4LL*t[n/2]);
    else printf("%lld\n",1LL + 3LL*t[n/2-1] + t[n/2]);
  }
}

Measured memory_bytes: 0
#include<iostream>
#include<stdlib.h>
#include<stdio.h>
#include<bits/stdc++.h>
using namespace std;
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
/*---------------------DEBUGGING--------------------------------------------*/
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
/*-------------------------------------------------------------------------------------*/
//#define mp make_pair
#define pb push_back
#define ll long long
#define pii pair<int,int>
#define pcc pair<char,char>
#define F first
#define S second
#define int long long
#define pi 3.141592653589793238462643383279502
#define M  1000000007
#define rep(i,a,n) for(int i=a;i<n;i++)
#define INF 1000000000000000000
#define N 200005
#define vi vector<int>
#define all(v) v.begin(),v.end()
#define endl "\n"
//#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
signed main()
{
   ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
   int a,b,c,d;
   cin>>a>>b>>c>>d;
   cout<<max({a*c,b*d,a*d,b*c})<<endl;
}


Measured memory_bytes: 3656
import math
from collections import defaultdict

def prime_factorize(n: int):
    prime_factors = defaultdict(int)

    for i in range(2, int(math.sqrt(n)) + 1):
        while True:
            div, mod = divmod(n, i)
            if mod == 0:
                prime_factors[i] += 1
                n = div
            else:
                break
        if n == 1:
            break
    if n != 1:
        prime_factors[n] = 1

    return prime_factors


def main():
    N, P = map(int, input().split())
    prime_factors = prime_factorize(P)

    gcd = 1
    for k, v in prime_factors.items():
        v_cnt = v // N
        gcd *= pow(k, v_cnt)

    print(gcd)
    return

main()

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

using namespace std;

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

int main(){
  int n;
  cin >> n;
  string s;
  cin >> s;
  vector<int> r(n), g(n), b(n);
  int x = 0, y = 0, z = 0;
  REP(i, n){
    if(s[n - i - 1] == 'R') ++x;
    else if(s[n - i - 1] == 'G') ++y;
    else if(s[n - i - 1] == 'B') ++z;
    r[n - i - 1] = x;
    g[n - i - 1] = y;
    b[n - i - 1] = z;
  }
  uint64_t res = 0;
  REP(i, n){
    REP(j, n - 1) if(j > i && s[i] != s[j]){
      char c = 'R' + 'G' + 'B' - s[i] - s[j];
      if(c == 'R') res += r[j + 1];
      else if(c == 'G') res += g[j + 1];
      else if(c == 'B') res += b[j + 1];
      if(j + j - i < n && s[j + j - i] == c) --res;
    }
  }
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 3656
S=input()
if S[0] == S[1] == S[2] == S[3]:
  print("No")
else:
  if S[0] == S[1]:
    if S[2] == S[3]:
      print("Yes")
    else:
      print("No")
  elif S[0] == S[2]:
    if S[1] == S[3]:
      print("Yes")
    else:
      print("No")
  elif S[0] == S[3]:
    if S[1] == S[2]:
      print("Yes")
    else:
      print("No")
  else:
    print("No")

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

const long long MOD = 1000000007;
const long long INF = 1LL << 60;

int main()
{
  int N;
  cin >> N;
  vector<int> A(N), B(N), C(N);
  for (int i = 0; i < N; i++)
    cin >> A[i];
  for (int i = 0; i < N; i++)
    cin >> B[i];
  for (int i = 0; i < N - 1; i++)
    cin >> C[i];
  int ans = 0;
  int prev = -1;
  for (int i = 0; i < N; i++)
  {
    if (i == 0)
    {
      ans += B[A[i] - 1];
      prev = A[i] - 1;
    }
    else
    {
      ans += B[A[i] - 1];
      if (A[i] - 1 == prev + 1)
        ans += C[prev];
      prev = A[i] - 1;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <chrono>
#define watch(x) cout << (#x) << " is " << (x) << endl
#define eps 1e-9
#define f first
#define s second

typedef long long ll;

using namespace std;

int main()

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

    ll a, b, c, d;

    cin >> a >> b >> c >> d;

    a--;

    ll z = (b/c-a/c) + (b/d-a/d);
    ll lcm = (c*d)/__gcd(c, d);

    z-= b/lcm - a/lcm;

    cout << b-a-z;

    return 0;
}


Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int[] a = new int[n];
		for(int i=0;i<n;i++) {
			a[i] = in.nextInt();
		}
		Arrays.sort(a);
		int max = a[n-1];
		int idx = 0;
		while(a[idx]<max/2) {
			idx++;
		}
		int half = a[idx];
		if(idx>0) {
			if((double)max/2-a[idx-1]<a[idx]-(double)max/2) {
				half = a[--idx];
			}
		}
		if(max==half) {
			half = a[idx-1];
		}
		System.out.println(max+" "+half);
		in.close();
	}

}


Measured memory_bytes: 49016
#include<bits/stdc++.h>
using namespace std;
typedef long long int uli;
const int mx=1e5+10;
uli x[mx];
int main(){
  int n;
  uli a,b;
  scanf("%d %lld %lld",&n,&a,&b);
  for(int i=0;i<n;i++){
    scanf("%lld",x+i);
  }
  uli ans=0;
  for(int i=0;i+1<n;i++){
    if((x[i+1]-x[i])*a<b){
      ans+=(x[i+1]-x[i])*a;
    }
    else ans+=b;
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 1152
n = int(input())
n2 = int(n ** 0.5) + 1
n3 = n * 1
ans = 0

def md(r):
    divisors = []
    for i in range(1, int(r**0.5)+1):
        if r % i == 0:
            divisors.append(i)
            if i != r // i:
                divisors.append(r//i)

    # divisors.sort()
    return divisors

a = set(md(n-1))

for i in range(2,n2+1):
    n3 = n * 1
    while True:
        if n3 % i == 0:
            n3 //= i
        else:
            n3 %= i
            if n3 == 1:
                a.add(i)
            break
    
if n != 2:
    print(len(a))
else:
    print(1)

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

using int64 = long long;
using uint64 = unsigned long long;

using namespace std;

struct Edge {
    int id;
    int to;
};

constexpr int MAX_N = 50;

vector<Edge> tree[MAX_N];

int64 enumerateAffectedEdges(int u, int par, int goal) {
    int64 res = 0;
    for (const Edge& e: tree[u]) {
        if (e.to == par) continue;
        if (e.to == goal) {
            res |= (1LL << e.id);
        } else {
            int64 subres = enumerateAffectedEdges(e.to, u, goal);
            res |= subres;
            if (subres > 0) res |= (1LL << e.id);
        }
    }
    return res;
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);

    int n;
    cin >> n;

    for (int i = 0; i < n - 1; i++) {
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        tree[a].push_back((Edge){ i, b });
        tree[b].push_back((Edge){ i, a });
    }

    int m;
    cin >> m;

    vector<int64> affected_edges(m);
    for (int i = 0; i < m; i++) {
        int u, v;
        cin >> u >> v;
        u--;
        v--;
        affected_edges[i] = enumerateAffectedEdges(u, -1, v);
    }

    int64 ans = 0;
    for (int mask = 0; mask < (1 << m); mask++) {
        int cnt = 0;
        int64 union_affected_edges = 0;
        for (int i = 0; i < m; i++) {
            if ((mask >> i) & 1) {
                cnt++;
                union_affected_edges |= affected_edges[i];
            }
        }
        int white = __builtin_popcountll(union_affected_edges);
        if (cnt % 2 == 1) {
            ans -= (1LL << (n - 1 - white));
        } else {
            ans += (1LL << (n - 1 - white));
        }
    }
    cout << ans << endl;

    return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<map>
#include<unordered_map>
#include<set>
#include<vector>
#include<algorithm>
#include<cmath>
#include<string>
#include<queue>
using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef long double ld;
#define mp make_pair
#define pb push_back
const ll mod = 1000000007;
// const ll mod = 998244353;

const ll LLMAX = numeric_limits<long long>::max();

void No() {
	cout << "No" << endl;
}

void Yes() {
	cout << "Yes" << endl;
}

// 約数列挙
vector< ll > divisor(ll n) {
	vector< ll > ret;
	for (ll i = 1; i * i <= n; i++) {
		if (n % i == 0) {
			ret.push_back(i);
			if (i * i != n) ret.push_back(n / i);
		}
	}
	sort(begin(ret), end(ret), greater<ll>());
	return (ret);
}

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

	cout  << endl;
	return 0;
}

Measured memory_bytes: 256
X, Y = map(int, input().split())

a,b,c = 0,0,0

if X == 1 and Y == 1:
  c = 400000

if X == 1:
  a = 300000
elif X == 2:
  a = 200000
elif X == 3:
  a = 100000

if Y == 1:
  b = 300000
elif Y == 2:
  b = 200000
elif Y == 3:
  b = 100000

print(a+b+c)
  

Measured memory_bytes: 38384
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define each(a,x) for(auto a : (x))
#define all(a) (a).begin(),(a).end()
#define chmin(a,b) ((a) = min((a),(b)))
#define chmax(a,b) ((a) = max((a),(b)))
#define in_range(x,l,r) ((l)<=(x) && (x)<(r))
#define printvec(a) rep(i,a) cout << a[i] << " \n"[i+1==(a).size()];
#define fs first
#define sc second
#define em emplace
#define eb emplace_back
#define sz size()
#define MP make_pair
using namespace std;
typedef long long ll;
typedef double D;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vs;

const ll INF = 1e8;
const D EPS = 1e-8;
const ll MOD = 1e9+7;

int main(){
  int n;
  cin >> n;
  cout << (n-2) * 180 << endl;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
n = int(input())
h = list(map(int, input().split()))

dp = [0 for _ in range(n)]

dp[1] = abs(h[1] - h[0])

for i in range(2, n):
    dp[i] = min(dp[i - 1] + abs(h[i] - h[i - 1]),
                dp[i - 2] + abs(h[i] - h[i - 2]))

print(dp[-1])

Measured memory_bytes: 13928
#include<bits/stdc++.h>
using namespace std;
int prime(int n){
  if(n==1) return 0;
  if(n==2||n==3)return 1;
  for(int i=2;i*i<=n;i++){
    if(n%i==0) return 0;
  }
  return 1;
}
int main(){
  int q;cin>>q;
  int l[q],r[q];
  for(int i=0;i<q;i++)cin>>l[i]>>r[i];
  int d[100001];
  for(int i=1;i<=100000;i++) d[i]=prime(i);
  int s[100001];
  s[0]=0;
  int c[100001];
  c[0]=0;
  for(int i=1;i<=100000;i++){
    if(i%2==0) s[i]=0;
    else{
      if(d[i]==1&&d[(i+1)/2]==1) s[i]=1;
    }
    c[i]=s[i]+c[i-1];
  }
  for(int i=0;i<q;i++){
    cout<<c[r[i]]-c[l[i]-1]<<endl;
  }
}
  

Measured memory_bytes: 2560
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <iterator>
#include <cmath>
#include <set>
#include <deque> 
#include <string>


using namespace std;

int main()
{
	int n, m;
	scanf("%d%d", &n, &m);
	int ans = n * (n - 1) / 2 + m * (m - 1) / 2;
	printf("%d\n", ans);
	
	
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
    int N, M;
    ll K;
    cin >> N >> M >> K;
    ll A[N], B[M];
    for (int i = 0; i < N; i++) {
        cin >> A[i];
    }
    for (int i = 0; i < M; i++) {
        cin >> B[i];
    }
    int ans = 0;
    ll c[M + 1]{};
    for (int i = 0; i < M; i++) {
        c[i + 1] = c[i] + B[i];
    }
    ll t = 0;
    for (int i = 0; i <= N; i++) {
        if (i != 0) {
            t += A[i - 1];
        }
        if (t > K) break;
        int l = -1;
        int r = M + 1;
        while (r - l > 1) {
            int m = (l + r) / 2;
            if (t + c[m] <= K) {
                l = m;
            } else {
                r = m;
            }
        }
        ans = max(ans, i + l);
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 8316
#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
using ld = long double;
const int INF = 1 << 29;
const ll LINF = 1l << 61;
const ld PI = abs(acos(-1));
#define pq priotity_queue
#define P pair<int, int>
#define P2 pair<int, P>
#define P3 pair<int, P2>
#define fr(i, a, b) for (int i = a; i < b; i++)    //[a, b)
#define frr(i, a, b) for (int i = b; i >= a; i--)  //[a, b]
#define rp(i, b) for (int i = 0; i < b; i++)       //[0, b)
#define rrp(i, b) for (int i = b; i >= 0; i--)     //[0, b]
#define cbuf(buf, init) memset(buf, init, sizeof(buf))

int H, W, c[30][30], A[300][300];
ll dp[10][10000];

ll rec(int i, int flag)
{
    if (dp[i][flag] != -1) {
        return dp[i][flag];
    }
    if (i == 1) return 0;
    flag |= (1 << i);
    ll s = LINF;
    rp(j, 10)
    {
        if (flag & (1 << j)) continue;
        s = min(s, rec(j, flag) + c[i][j]);
    }
    flag &= ~(1 << i);
    return dp[i][flag] = s;
}

int main()
{
    //
    cin >> H >> W;
    rp(i, 10)
    {
        rp(j, 10) { cin >> c[i][j]; }
    }
    rp(i, H)
    {
        rp(j, W) { cin >> A[i][j]; }
    }

    cbuf(dp, -1);

    ll s = 0;
    rp(i, H)
    {
        rp(j, W)
        {
            if (A[i][j] != -1) s += rec(A[i][j], 0);
        }
    }

    cout << s << endl;
}


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

int main(){
  int n,m,c;
  cin>>n>>m>>c;
  vector<int>b(m);
  for(int i=0;i<m;i++){
    cin>>b[i];
  }
  vector<vector<int>>a(n,vector<int>(m));
  for(int i=0;i<n;i++){
    for(int j=0;j<m;j++){
    cin>>a.at(i).at(j);
     }
   }

  int ans=0;
  
  for(int i=0;i<n;i++){
    int s=0;
    for(int j=0;j<m;j++){
      s+=a.at(i).at(j)*b.at(j);
   }
   
    
    if(s+c>0){
      ans+=1;
    }
    else{
      ans+=0;
    }
  }

  cout<<ans<<endl;
}


Measured memory_bytes: 256
X = int(input())
def is_prime(x):
    flag = True
    for i in range(2,int(x**(0.5))+1):
        if x % i == 0:
            flag = False
    return flag
for i in range(X,2*X+1):
    if is_prime(i):
        print(i)
        break

Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
int main (){
    double N,T,A,h,x,ans=1;
    cin >> N >> T >> A >> h;//h地点での気温はT-0.006h
    
    for(int i=2;i<N+1;i++){
        cin >> x;
        if(abs(T-0.006*h-A) > abs(T-0.006*x-A)){
            ans = i;
            h = x;
            }
    }
    cout << ans << endl;
}

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

int cmp(const void *a,const void *b)
{
  return *(float *)a - *(float *)b;
}

int main()
{
  int n,i;
  float *v,ans;

  scanf("%d",&n);
  v = calloc(n,sizeof(float));

  for(i=0; i<n; i++)
    scanf("%f",&v[i]);

  qsort(v,n,sizeof(float),cmp);

  ans = (v[0]+v[1])/2;

  for(i=2; i<n; i++){
    ans = (ans+v[i])/2;
  }

  printf("%f", ans);

  free(v);
  return 0;
}


Measured memory_bytes: 1744
#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define dunk(a) cout << (a) << endl
using namespace std;
typedef long long ll;

ll n,w;
ll item[109][2];
ll dp[109][100099] = {0};

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

int main(){
    cin >> n >> w;
    
    rep(i,n){
        rep(j,2){
            cin >> item[i][j];
        }
    }
    //入力まで

    ll sumw =0;

    for(ll i=0; i<n; i++){
        for(ll sumw=0; sumw<=w; sumw++){

            if(sumw >= item[i][0]){
            chmax(dp[i+1][sumw] , dp[i][sumw - item[i][0]] + item[i][1]);
            }
            chmax(dp[i+1][sumw], dp[i][sumw]);
        }
    }
    dunk(dp[n][w]);
}

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

int main(){
  int n,k;
  cin >> n >> k;
  vector<int> p(n);
  for (int i = 0; i < n; i++)
  {
    cin >> p[i];
  }

  sort(p.begin(),p.end());
  int ans = 0;
  for (int i = 0; i < k; i++)
  {
    ans+=p[i];
  }
  cout << ans << endl;
  
  
}

Measured memory_bytes: 3632
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <map>
#include <queue>
#include <string>

#define reps(i,s,n) for(int (i) = (s); (i) < (n); (i)++)
#define rep(i,n) reps(i,0,n)
using namespace std;
using ll = long long;

int main(){
    long double a ,b,tmp;
    cin >> a >> b;
    tmp = a*b;

    cout << (ll)tmp << endl;

    return 0;
}

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

int main(){
  int N, M;
  cin >> N >> M;
  vector<int> a(M), b(M);
  int ans = 0;
  for(int i = 0; i < M; i++) {
    cin >> a[i] >> b[i];
  }
  vector<int> array(N);
  for(int i = 0; i < N; i++) {
    array[i] = i + 1;
  }
  
  int next = 0;
  bool flag;
  do {
    flag = true;
    if(array[0] != 1) continue;
    next = 1;
    for(int i = 0; i < N - 1; i++) {
      if(next != array[i]) { flag = false; break; }
      for(int j = 0; j < M; j++) {
        if(a[j] == array[i] && array[i + 1] == b[j]) next = b[j];
        else if(b[j] == array[i] && array[i + 1] == a[j]) next = a[j];
      }
    }
    if(next == array[N - 1] && flag == true) ans++;
     

  }while(next_permutation(array.begin(), array.end()));
 

 cout << ans;
 return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
const int INF=1e9,MOD=1e9+7,ohara=1e6+10;
const ll LINF=1e18;
using namespace std;

#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout<<(x)<<endl
#define Cerr(x) cerr<<(x)<<endl
#define fi first
#define se second
#define P pair<ll,ll> 
#define m_p make_pair

ll n,cnt,ans,a[ohara],b,c,d,tmp,tmpp,m,h,w,x,y,sum[ohara],pos,k;
ld doua;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
//int dy[]={-1,0,1,-1,1,-1,0,1};
//int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl;
struct edge{int to,cost;};

//-------------------------↓↓↓↓↓↓------------------------

ll modinv(ll aa,ll mm){
    ll bb=mm,uu=1,vv=0;
    while(bb){
        ll tt=aa/bb;
        aa-=tt*bb;swap(aa,bb);
        uu-=tt*vv;swap(uu,vv);
    }
    uu%=mm;
    if(uu<0)uu+=mm;
    return uu;
}

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

    cin>>n;
    rep(i,n)cin>>a[i];
    rep(i,n)(sum[i+1]=modinv(i+1,MOD))%=MOD;
    rrep(i,1,n)(sum[i+1]+=sum[i])%=MOD;
    /// 1/1 1/2 1/3 1/4.....の累積和を逆元を用いてやってる
    rep(i,n){
        (ans+=(a[i]*(sum[i+1]+sum[n-i]-1))%MOD)%=MOD;
    }
    rrep(i,2,n+1)(ans*=i)%=MOD;
    Cout(ans);
    return 0;
}


Measured memory_bytes: 5120
from collections import Counter

n = int(input())

strings = []
for i in range(n):
    strings.append(input())

c = Counter(strings)

times = 0
ans_list = []
for item in c.most_common():
    if not times:
        times = item[1]
    elif times != item[1]:
        break

    ans_list.append(item[0])

ans_list.sort()

for ans in ans_list:
    print(ans)



Measured memory_bytes: 45084
using System;
using System.Linq;

namespace PrintTestCases
{
    class Class1
    {
        public static void Main()
        {
            while (true)
            {
                string[] s = Console.ReadLine().Trim().Split(' ');
                int[] i = s.Select(str => int.Parse(str)).ToArray();
                if (i[0] == 0 && i[1] == 0) break;
                if (i[0] < i[1])
                {
                    Console.WriteLine("{0} {1}", i[0], i[1]);
                }
                else
                {
                    Console.WriteLine("{0} {1}", i[1], i[0]);
                }
            }
        }
    }
}



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

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

    int n;
    long long k;
    cin >> n >> k;

    vector<int> as(n), bs(n);
    for (int i = 0; i < n; i++) cin >> as[i];
    for (int i = 0; i < n; i++) cin >> bs[i];
    sort(as.begin(), as.end());
    sort(bs.rbegin(), bs.rend());

    auto ok = [&](long long m) -> bool {
        vector<long long> kosuu(n);
        for (int i = 0; i < n; i++) {
            kosuu[i] = m / bs[i];
        }
        long long cnt = 0;
        for (int i = 0; i < n; i++) {
            if (as[i] > kosuu[i]) {
                cnt += as[i] - kosuu[i];
            }
        }
        return cnt <= k;
    };

    long long l = -1, r = 1e18;
    while (l < r - 1) {
        long long m = (l + r) / 2;
        if (ok(m)) {
            r = m;
        } else {
            l = m;
        }
    }
    cout << r << endl;
}


Measured memory_bytes: 3456
#include<bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define int long long
#define vec(a,n) vector<int> (a)((n))
#define Vec(a,n) vector<string> (a)((n))
using namespace std;
signed main(){
	int n,a=0,b,e=0,t=1;
	cin >> n;
	FOR(i,1,100000){
		a += i;
		if(a == n){
			b=i;
			goto oke;
			
		}
		else if(a > n){
			goto dame;
		}
	}
	oke:
	cout << "Yes" << endl;
  cout << b + 1 << endl;
	REP(i,b+1){
		cout << b << " ";
		
		int c = i;
		int f = b-i;
		e=0;
		int d = c;
		while(c != 0){
			
			cout << d << " ";
			d += b-e-1;
			e++;
			c--;
		}
		FOR(j,t,t+f){
			cout << j << " ";
		}
		cout << endl;
		t += f;
	}
	goto owa;
	dame:
	cout << "No";
	owa:


    return 0;
}

Measured memory_bytes: 1408
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
bool compare(vector<int> &a,vector<int> &b){
	return a[1]>b[1]||a[1]==b[1]&&a[0]<b[0];
}
int main(){
	int n,m,bo;
	while(cin>>n>>m&&n!=0){
		vector<vector<int> > answer(m,vector<int>(2));
		for(int i=0;i<m;++i){
			answer[i][0]=i;
			answer[i][1]=0;
		}
		for(int i=0;i<n;++i){
			for(int k=0;k<m;++k){
				cin>>bo;
				answer[k][1]+=bo;
			}
		}
		sort(answer.begin(),answer.end(),compare);
		for(int i=0;i<m-1;++i){
			cout<<answer[i][0]+1<<' ';
		}
		cout<<answer.back()[0]+1<<endl;
	}
}

Measured memory_bytes: 3120
#! /usr/bin/env python3

import sys
import math
import numpy as np
int1 = lambda x: int(x) - 1
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

A, B = readline().decode().rstrip().split()
A = int(A)
B = 100 * int(B[0]) + 10 * int(B[2]) + int(B[3])

ans = A * B // 100

print(ans)

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

int main() {
	int n;
	int cnt = 0;
	cin >> n;
	for (int i = 1; i <= n; i++) {
		if (1 <= i && i < 10)cnt++;
		if (100 <= i && i < 1000)cnt++;
		if (10000 <= i && i < 100000)cnt++;
	}
	cout << cnt << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define sz(x) (int)((x).size())
#define debug(x) cout << #x << ":" << x << ' ';
#define debugg(x) cout << #x << ":" << x << ' ' << "\n";
#define endl "\n"
#define L(X) ((X)<<1)
#define R(X) (((X)<<1)|1)
#define M(X,Y) (((X)+(Y))>>1)

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

const int MAXN = 1e5 + 5;
const int MOD = 1e9 + 7;
const int INF = 0x3f3f3f3f;
const long long int LLINF = 0x3f3f3f3f3f3f3f3f;
const double EPS = 1e-9;
const double PI = acos(-1);

template<typename T>   T max_self(T& a, T b) { if (a < b) a = b; return a; }
template<typename T>   T min_self(T& a, T b) { if (a > b) a = b; return a; }
template<typename T>   T add(T x, T y) { return ((x % MOD)  + (y % MOD)) % MOD;}
template<typename T>   T mul(T x, T y) { return ((x % MOD) * (long long)(y % MOD)) % MOD;}
template<typename T>   T sub(T x, T y) { return add(x, -y + MOD);}
template<typename T>   T gcd(T a, T b) { return b ? gcd(b, a % b) : a;}
template<typename T>   T lcm(T a, T b) { return a / gcd(a, b) * b;}
template<typename T>   vector<T> read(vector<T>& v, int n) {v.resize(n); for (auto &x : v)cin >> x;}
template<typename T>   void trav(vector<T> &v) {for (int i = 0 ; i < (int)v.size() ; ++i) {cout << v[i]; if (i != (int)v.size() - 1) cout << ' ';}}
int lg2(long long x)   {   return 64 - __builtin_clzll(x) - 1;  }
int lg2(int x)   {   return 32 - __builtin_clz(x) - 1;  }
#define NMAX 100005



int main()
{
    int tab[5] = {0};
    for (int i = 0; i < 5; ++i)
    {
        cin>>tab[i];
    }
    for (int i = 0; i < 5; ++i)
    {
        if(!tab[i]){
            cout<<i+1<<endl;
            return 0;
        }
    }


   return 0;
}


Measured memory_bytes: 3568
fn main() {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).expect("error");

    s = String::new();
    std::io::stdin().read_line(&mut s).expect("error");
    let s = s.trim();

    let mut x = 0;
    let mut max = 0;
    for c in s.chars() {
        if c == 'I' {
            x += 1;
            if x > max {
                max = x;
            }
        } else {
            x -= 1;
        }
    }
    println!("{}", max);
}


Measured memory_bytes: 4352
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String[] s = sc.next().split("");
        String prev="";
        int count = 0;
        int i=0;
        while(i<s.length){
            String tmp = s[i];
            if(prev.equals(tmp)){
                if(i==s.length-1){
                    break;
                }
                i++;
                tmp += s[i];
            }
            count++;
            prev = tmp;
            i++;
        }
        System.out.println(count);
    }
}

Measured memory_bytes: 54132
#include "iostream"
#include "string"


int main()
{
	int W, H;

	while (true) {
		std::cin >> H >> W;

		if (W == 0 && H == 0)
			break;

		for (int i = 0; i < H; i++) {
			for (int j = 0; j < W; j++) {
				std::cout << '#';
			}
			std::cout << std::endl;
		}
		std::cout << std::endl;
	}
	return 0;
}

Measured memory_bytes: 3080
#include <limits.h>
#include <stdio.h>
#define min(x, y) ((x) < (y) ? (x) : (y))
#define max(x, y) ((x) > (y) ? (x) : (y))
#define abs(x) ((x) < 0 ? (-1*x) : (x))

int main()
{
  int n,k;
  scanf("%d%d",&n,&k);
  k = min((n-1), k);
  //printf("%d",k);
  int h[n],dp[n];
  int i = 0;
  while (i < n)
  {
    dp[i] = 0;
    scanf("%d",&h[i]);
    i++;
  }
  dp[0] = 0;
  dp[1] = abs((h[1]-h[0]));
  if (n == 2)
  {
    printf("%d",dp[1]);
    return (0);
  }
  //dp[2] = min(abs((h[2]-h[1]))+dp[1], abs((h[2]-h[0])+dp[0]));
  i = 1;
  int j = 0;
  int min_tmp;
  while (i < n)
  {
    j = max(0, i-k);
    min_tmp = INT_MAX;
    while (j < i)
    {
      if (min_tmp > abs((h[i]-h[j]))+dp[j])
        min_tmp = abs((h[i]-h[j])) + dp[j];
      dp[i] = min_tmp;
      j++;
    }
    i++;
  }
  printf("%d",dp[i-1]);
}

Measured memory_bytes: 2460
using System;
using System.Linq;

namespace rensyuu1
{
    class Program
    {
        static void Main(string[] args)
        {
            int num = int.Parse(Console.ReadLine());
            string[] line = new string[num];
            int[] s1 = new int[13];
            int[] h1 = new int[13];
            int[] c1 = new int[13];
            int[] d1 = new int[13];
            for (int n1 = 0; n1 < num; n1++)
            {
                line[n1] = Console.ReadLine();
                string[] strs = line[n1].Split(new char[] { ' ' });
                if (strs[0] == "S")
                {
                    for (int n2 = 0; n2 < 13; n2++)
                    {
                        if (s1[n2] == 0)
                        {
                            s1[n2] = int.Parse(strs[1]);
                            break;
                        }
                    }


                }
                else if (strs[0] == "H")
                {
                    for (int n3 = 0; n3 < 13; n3++)
                    {
                        if (h1[n3] == 0)
                        {
                            h1[n3] = int.Parse(strs[1]);
                            break;
                        }
                    }


                }
                else if (strs[0] == "C")
                {
                    for (int n4 = 0; n4 < 13; n4++)
                    {
                        if (c1[n4] == 0)
                        {
                            c1[n4] = int.Parse(strs[1]);
                            break;
                        }
                    }


                }
                else if (strs[0] == "D")
                {
                    for (int n5 = 0; n5 < 13; n5++)
                    {
                        if (d1[n5] == 0)
                        {
                            d1[n5] = int.Parse(strs[1]);
                            break;
                        }
                    }


                }
            }

            //

            for (int n5 = 1; n5 < 14; n5++)
            {
                if (s1.Contains(n5))
                {
                    //break;
                }
                else
                {
                    Console.WriteLine("S {0}", n5);
                }
            }
            for (int n6 = 1; n6 < 14; n6++)
            {
                if (h1.Contains(n6))
                {
                    //break;
                }
                else
                {
                    Console.WriteLine("H {0}", n6);
                }
            }
            for (int n7 = 1; n7 < 14; n7++)
            {
                if (c1.Contains(n7))
                {
                    //break;
                }
                else
                {
                    Console.WriteLine("C {0}", n7);
                }
            }
            for (int n8 = 1; n8 < 14; n8++)
            {
                if (d1.Contains(n8))
                {
                    //break;
                }
                else
                {
                    Console.WriteLine("D {0}", n8);
                }
            }

        }
    }
}


Measured memory_bytes: 18232
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;

bool IsDigit(string::iterator &itr);
int expr(string::iterator &itr);
int factor(string::iterator &itr);
int number(string::iterator &itr);

int expr(string::iterator &itr) {
    int now = factor(itr);
    /*
    if(*itr == '+') {
        itr++;
        now += expr(itr);
        return now;
    }
    if(*itr == '-') {
        itr++;
        now -= expr(itr);
        return now;
    }
    return now;
    */
    while(true) {
        if(*itr == '+') {
            itr++;
            now += factor(itr);
            continue;
        }
        if(*itr == '-') {
            itr++;
            now -= factor(itr);
            continue;
        }
        //cerr << "expr:" << now << endl;
        return now;
    }
}

int factor(string::iterator &itr) {
    //cerr << "factor:" << *itr << endl;
    int now = number(itr);
    /*
    if(*itr == '*') {
        itr++;
        now *= factor(itr);
        return now;
    }
    if(*itr == '/') {
        itr++;
        now /= factor(itr);
        return now;
    }
    return now;
    */
    while(true) {
        if(*itr == '*') {
            itr++;
            now *= number(itr);
            continue;
        }
        if(*itr == '/') {
            itr++;
            now /= number(itr);
            continue;
        }
        //cerr << "factor:" << now << endl;
        return now;
    }
}

int number(string::iterator &itr) {
    //cerr << "number:" << *itr << endl;
    int now = 0;
    if(*itr == '(') {
        itr++;
        now = expr(itr);
        itr++;
        //cerr << "number:" << now << endl;
        return now;
    }
    while(IsDigit(itr)) {
        now *= 10;
        now += *itr - '0';
        itr++;
    }
    //cerr << "number:" << now << endl;
    return now;
}

bool IsDigit(string::iterator &itr) {
    return *itr <= '9' && *itr >= '0';
}

int main() {
    //cout.precision(10);
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    while(N--) {
        string S;
        cin >> S;
        auto itr = S.begin();
        cout << expr(itr) << endl;
    }
    return 0;
}



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

using namespace std;

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin >> n;
    vector<int> d(n);
    for (int i = 0; i < n; i++) {
        cin >> d[i];
    }
    long long sum = 0;
    for (int i = 0; i < n; i++) {
        for (int j = i + 1; j < n; j++) {
            sum += d[i] * d[j];
        }
    }
    cout << sum;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<bits/stdc++.h>
using namespace std;
int main() 
{
string s;
for(int i=0;i<4;i++)
{
cin>>s[i];
}
if(s[0]==s[1]&&s[0]!=s[2]&&s[2]==s[3])
cout<<"Yes"<<endl;
else if(s[0]==s[2]&&s[0]!=s[1]&&s[1]==s[3])
cout<<"Yes"<<endl;
else if(s[0]==s[3]&&s[0]!=s[2]&&s[2]==s[1])
cout<<"Yes"<<endl;
else if(s[0]==s[3]&&s[0]==s[2]&&s[2]==s[1])
cout<<"No"<<endl;
else
cout<<"No";
return 0;
}

Measured memory_bytes: 3600
//#pragma GCC optimize ('O3')
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<ll,ll> pll;
typedef long double ld;
#define mp make_pair
#define f first
#define s second
#define pb push_back

const int N = 100 + 5;
const int M = 1e7 + 5;
const ll OO = 2e18;
const int mod = 998244353;

int n,m,r[N],c[N];
char a[N][N];

int main() {

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

    cin >> n >> m;

    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < m; ++j) {
            cin >> a[i][j];
            if(a[i][j]=='#') {
                ++r[i], ++c[j];
            }
        }
    }

    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < m; ++j) {
            if(r[i] && c[j]) {
                cout << a[i][j];
            }
        }
        if(r[i]) cout << '\n';
    }

    return 0;

}

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

typedef long long ll;
# define  pii pair<ll,ll> 
# define pb push_back
# define f first 
# define s second 


int main() {
	int x;
	cin>>x;
    
    if(x>=30)
    	cout<<"Yes"<<endl;
    else
    	cout<<"No"<<endl;

   
	return 0;
}


Measured memory_bytes: 3552
#include <cstdio>
#include <algorithm>
#include <queue>

int a[200000];

int main()
{
	int n;
	scanf("%d", &n);
	for (int i = 0; i < n; ++i)
	{
		scanf("%d", a + i);
	}
	std::sort(a, a + n, std::greater<int>());
	std::priority_queue<int> q;
	q.emplace(a[0]);
	long long ans = 0;
	for (int i = 1; i < n; ++i)
	{
		ans += (long long)q.top();
		q.pop();
		q.emplace(a[i]);
		q.emplace(a[i]);
	}
	printf("%lld\n", ans);
	return 0;
}


Measured memory_bytes: 4576
#include<iostream>
#include<cstring>
#include<cstdio>
using namespace std;
int main(){
	char s[1000];
	cin>>s;
	if(strlen(s)==6&&s[2]==s[3]&&s[4]==s[5]) cout<<"Yes"<<endl;
	else                                     cout<<"No"<<endl; 
}

Measured memory_bytes: 256