akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
using namespace std;
typedef long long ll;
int INF = (1LL << 30) - 1;
int MOD = 1e9+7;
main(){
    int cnt[1010] = {};
    ll N;
    cin >> N;
    rep(i,2,N+1){
        int num = i;
        for(int j = 2;j <= N;j++){
            while(num % j == 0){
                num /= j;
                cnt[j] ++;
            }
        }
    }
    ll ans = 1;
    for(auto i:cnt){
        ans = ans * (i + 1) % MOD;
    }
    cout << ans << endl;
}

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

using namespace std;

int main() {
	int cup[3] = {1,0,0};
	string str;
	while(cin>>str, !cin.eof()){
		swap(cup[str[0]-'A'], cup[str[2]-'A']);
	}
	for(int i=0; i<3; i++){
		if(cup[i] == 1) cout<<(char)('A'+ i )<<endl;
	}

	return 0;
}

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

int main() {
	int n, x;
	cin >> n >> x;
	int count = 0;
	while(n != 0 || x != 0) {
		for(int i = 3; i <= n; i++) {
			for(int j = 2; j < i; j++) {
				for(int k = 1; k < j; k++) {
					if(i + j + k == x) {
						count++;
					}
				}
			}
		}
		cout << count << endl;
		count = 0;
		cin >> n >> x;
	}
}


Measured memory_bytes: 3088
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int maxN = 1e5+7;
const int maxV = 90010;
//const int INF = 1e9+9;
//const ll INF = (1ll)<<60;
const int INF = 2e9+9;
const int MOD = 1e9+7;

ll n,A,B,C;
ll power(ll x,ll p)
{
	if(p==0)
		return 1;
	ll t = power(x,p/2);
	t = t*t%MOD;
	if(p%2 == 1)
		t = t*x%MOD;
	return t;
}
ll a[maxN];
ll b[maxN];
ll c[maxN];
ll d[maxN];
int main()
{
	scanf("%lld%lld%lld%lld",&n,&A,&B,&C);
	a[0] = b[0] = c[0] = 1ll;
	for(int i=1;i<=n;i++)
	{
		a[i] = a[i-1]*A%MOD;
		b[i] = b[i-1]*B%MOD;
		c[i] = c[i-1]*(A+B)%MOD;
	}
	d[0] = 1ll;
	for(int i=1;i<=2*n;i++)
	{
		d[i] = d[i-1]*i%MOD;
	}
	ll p = A*power(A+B, MOD-2)%MOD;
	ll q = 1-p+MOD;
	ll sum = 0;
	for(int k=0;k<n;k++)
	{
		ll tmp = d[n+k-1]*power(d[k],MOD-2)%MOD*power(d[n-1],MOD-2)%MOD;
		ll cnt = tmp * (n+k) %MOD* power(p, n)%MOD * power(q, k)%MOD;
		sum = (sum+cnt)%MOD;
	}
	for(int k=0;k<n;k++)
	{
		ll tmp = d[n+k-1]*power(d[k],MOD-2)%MOD*power(d[n-1],MOD-2)%MOD;
		ll cnt = tmp * (n+k)%MOD * power(q, n)%MOD * power(p, k)%MOD;
		sum = (sum+cnt)%MOD;
	}
	ll r = 100*power(A+B,MOD-2)%MOD;
	sum = sum*r%MOD;
	cout<<sum<<endl;
	return 0;
}

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

namespace ConsoleApp15
{
    class Class1
    {
        static void Main()
        {
            string S = Console.ReadLine();
            if (S.Length == 1)
            {
                Console.WriteLine("YES");
                return;
            }
            else if (S.Length == 2)
            {
                if (S[0] != S[1])
                    Console.WriteLine("YES");
                else
                    Console.WriteLine("NO");
            }
            else
            {
                int nums = S.Length / 3;
                int a = 0, b = 0, c = 0;
                a = S.Count(x => x == 'a');
                b = S.Count(x => x == 'b');
                c = S.Count(x => x == 'c');

                if (a >= nums & b >= nums & c >= nums & a <= nums + 1 & b <= nums + 1 & c <= nums + 1)
                    Console.WriteLine("YES");
                else
                    Console.WriteLine("NO");
            }
            
        }
    }
}


Measured memory_bytes: 13204
import java.util.*;
import java.util.function.Predicate;

public class Main {

    public static void main(String[] args) {
        new Main().run();
    }

    void run() {
        Scanner cin = new Scanner(System.in);
        int N = cin.nextInt();
        int[] H = new int[N]; //参照先がオーバーすることがあるので1余計に取る
        for (int i = 0; i < N; i++) H[i] = cin.nextInt();

        // dp[i] = iマス目にたどり着くための最小コスト
        int[] dp = new int[N];
        dp[0] = 0;  //最初のマスはもちろん0
        dp[1] = Math.abs(H[1] - H[0]);  //2つ目のマスは、1つ前から移動するパターンのみ
        //3マス目以降は、1マス前か2マス前からの2パターンの移動が必ずあるので、繰り返し処理する
        for (int i=2;i<N;i++){
            //1マス前から移動したときの最小コストを求める
            int step1 = dp[i-1] + Math.abs(H[i] - H[i-1]);
            //2マス前から移動したときの最小コストを求める
            int step2 = dp[i-2] + Math.abs(H[i] - H[i-2]);
            //2つの最小値を求めることで、i+1マス目の最小コストを求めることが出来る。
            dp[i] = Math.min(step1, step2);
        }
        //最後のマスに到達するための必要数を出力する
        System.out.println(dp[N-1]);
    }
}



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

int main(){

string s;
cin >> s;

string t;
cin >>t;

int cnt =0;
for(int i=0;i<s.size();i++){
  if(s[i]==t[i]) cnt ++;
}

int p=s.size();

if((cnt == s.size())&&(t.size()==s.size()+1)&&(t[p] >= 'a' )&&( t[p] <= 'z')){
  cout << "Yes" <<endl;
}

else{cout << "No" <<endl;}
}


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

#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define For(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define all(o) (o).begin(), (o).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define sz(x) ((int)(x).size())
#define mset(m,v) memset(m,v,sizeof(m))
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef vector<pair<int,int> > vpii;
typedef long long ll;

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

  int n; cin>>n;
  vi h(n); rep(i,n) cin>>h[i];
  vi dp(n,INF); dp[0] = 0; dp[1] = abs(h[1]-h[0]);
  For(i,2,n-1) dp[i] = min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]));
  cout<<dp[n-1]<<'\n';
}


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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N;
  cin >> N;
  vector<int> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  int64_t res = 0;
  vector<int> count(N + 1, 0);
  for (int i = 0; i < N; i++) {
    if (i - A[i] + 1 > -1) res += count[i - A[i] + 1];
    if (i + A[i] + 1 < N) count[i + A[i] + 1]++;
  }
  cout << res << '\n';
  return 0;
}


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


int main()
{
	int n, b, f, r, v, a[4][3][10] = {};
	cin >> n;
	for (int i = 0;i < n;i++) {
		cin >> b >> f >> r >> v;
		a[b-1][f-1][r-1] = a[b-1][f-1][r-1] + v;
	}
	for (int x = 0;x < 4;x++) {
		for (int y = 0;y < 3;y++) {
			for (int z = 0;z < 10;z++) {
				cout << " " << a[x][y][z];
			}
			cout << endl;
		}
		if (x != 3)
			cout << "####################" << endl;
	}
    return 0;
}


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

#define sf scanf
#define pf printf
#define pb push_back
#define mp make_pair
#define PI ( acos(-1.0) )
#define pmod 1000000007
#define maxn 100005
#define IN freopen("input.txt","r",stdin)
#define OUT freopen("output.txt","w",stdout)
#define FOR(i,a,b) for(int i=a ; i<=b ; i++)
#define INF 1000000000
#define ll long long int
#define eps (1e-8)
#define sq(x) ( (x)*(x) )

using namespace std;

typedef pair < int, int > pii;
typedef pair < ll, ll > pll;
ll a[1005];
bool c[8000000];


void prime(long long m, ll n){

    ll j=0,num;
    //FOR (i,0,m-1) c[i]=0;
    ll u=m;
    while (j<=n){
    if (c[m]==0){
    for(ll i=1; i*m<=7368792;i++){
        c[i*m]=1;
    }
    j++;
    //cout<<m<<" ";
    }
    //cout<<c[m]<<" ";

    if (m<=2*u) m++;
    else m+=2;

    }
if (m<=2*u)    cout<<m-1<<endl;
else cout<<m-2<<endl;


}

int main()
{ll m=1;ll n;
while (1){
    memset(c,0,sizeof(c));
    cin>>m>>n;
    if (m==0) return 0;

    prime(m,n);


}

         return 0;
}

Measured memory_bytes: 10896
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<string>
#include<stack>
#include<cstdio>
#include<cmath>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<int,P> P1;

#define fr first
#define sc second
#define mp make_pair
#define pb push_back
#define rep(i,x) for(int i=0;i<x;i++)
#define rep1(i,x) for(int i=1;i<=x;i++)
#define rrep(i,x) for(int i=x-1;i>=0;i--)
#define rrep1(i,x) for(int i=x;i>0;i--)
#define sor(v) sort(v.begin(),v.end())
#define rev(s) reverse(s.begin(),s.end())
#define lb(vec,a) lower_bound(vec.begin(),vec.end(),a)
#define ub(vec,a) upper_bound(vec.begin(),vec.end(),a)
#define uniq(vec) vec.erase(unique(vec.begin(),vec.end()),vec.end())
#define mp1(a,b,c) P1(a,P(b,c))

const int INF=1000000000;
const int dir_4[4][2]={{1,0},{0,1},{-1,0},{0,-1}};
const int dir_8[8][2]={{1,0},{1,1},{0,1},{-1,1},{-1,0},{-1,-1},{0,-1},{1,-1}};

const long double EPS = 0.0000001;


int main(){
	int H,W;
	char a[102][102];
	scanf("%d%d",&H,&W);
	for(int i = 0 ; i < H ; i ++){
		scanf("\n");
		for(int j = 0 ; j < W ; j ++){
			scanf("%c",&a[i][j]);
		}
	}
	
	int x,y;
	rep(i,H)rep(j,W)if(a[i][j] == 'E'){ x = i; y = j; }
	if(x > (H-1)-x){
		for(int i = 0 ; i < H-1-i ; i ++){
			for(int j = 0 ; j < W ; j ++){
				swap(a[i][j],a[H-1-i][j]);
			}
		}
	}
	if(y > (W-1)-y){
		for(int j = 0 ; j < W-1-j ; j ++){
			for(int i = 0 ; i < H ; i ++){
				swap(a[i][j],a[i][W-1-j]);
			}
		}
	}
	rep(i,H)rep(j,W)if(a[i][j] == 'E'){ x = i; y = j; }
	
	static int tate[102][102] = {};
	static int yoko[102][102] = {};
	rep(i,H)rep(j,W){
		tate[i][j] = (a[i][j]=='.')?0:1;
		if(j != 0)tate[i][j] += tate[i][j-1];
		if(j-y-1 >= 0)tate[i][j] -= (a[i][j-y-1]=='.')?0:1;
		yoko[i][j] = (a[i][j]=='.')?0:1;
		if(i != 0)yoko[i][j] += yoko[i-1][j];
		if(i-x-1 >= 0)yoko[i][j] -= (a[i-x-1][j]=='.')?0:1;
	}
	static int ret = 0;
	for(int a = 0 ; a <= x ; a ++){
		for(int b = 0 ; b <= y ; b ++){
			static int dp[102][102];
			rep(i,102)rep(j,102)dp[i][j] = 0;
			dp[a][b+y] = tate[a][b+y];
			for(int i = a+1 ; i <= a+x ; i ++){
				dp[i][b+y] = dp[i-1][b+y]+tate[i][b+y];
			}
			for(int i = a+x ; i < H+a-x ; i ++){
				for(int j = b+y ; j < W+b-y ; j ++){
					if(i > a+x)dp[i][j] = max( dp[i][j], dp[i-1][j]+tate[i][j] );
					if(j > b+y)dp[i][j] = max( dp[i][j], dp[i][j-1]+yoko[i][j] );
				}
			}
			//cout << a << "," << b << " : " << dp[H+a-x-1][W+b-y-1] << endl;
			ret = max( ret, dp[H+a-x-1][W+b-y-1] );
		}
	}
	cout << ret-1 << endl;
}


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

using namespace std;

typedef long long ll;

int main()
{
    ll a,b,c,d,x=0,y=0,p=0,q=0,ans=-1e18;
    cin>>a>>b>>c>>d;
    x=max(a,b);
    y=max(c,d);
    p=min(a,b);
    q=min(c,d);
    ans=max(x*y,ans);
    ans=max(p*q,ans);
    ans=max(x*q,ans);
    ans=max(p*y,ans);
    cout<<ans<<endl;
    return 0;
}



Measured memory_bytes: 3632
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <queue>
#include <cstring>
#include <vector>
#include <map>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <bitset>
#include <set>
#include <stack>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define all(i,n) (i),(i+n)

int dx4[4]={1,0,-1,0};
int dy4[4]={0,-1,0,1};
int dx8[8]={1,0,-1,1,-1,1,0,-1};
int dy8[8]={1,1,1,0,0,-1,-1,-1};
int dx9[9]={0,1,0,-1,1,-1,1,0,-1};
int dy9[9]={0,1,1,1,0,0,-1,-1,-1};

typedef pair<int, int> P;
typedef pair<string, int> SP;
typedef long long ll;
typedef pair<ll, ll> PLL;

const int INF = 1e9;
const ll LLINF = 1e18;
const int MAX_V = 1e6+1;
const ll mod = 1000000007;
// << fixed << setprecision
// --------------------------------------
int n;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  cin >> n;
  vector<int> a(n + 1);
  REP(i, n) cin >> a[i + 1];

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

  vector<int> ans;
  for(int i = n; i > 0; i--) {
    int sum = 0;
    for(int j = i * 2; j <= n; j += i) {
      sum += t[j];
    }
    sum %= 2;
    if(a[i] ^ sum) {
      ans.push_back(i);
      t[i] = 1;
    }
  }
  cout << ans.size() << endl;
  REP(i, ans.size()) cout << ans[i] << " ";
  cout << endl;
}


Measured memory_bytes: 5464
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<iostream>
#include<fstream>
#include<iomanip>
#include<cstdio>
#include<string>
#include<cstring>
#include<climits>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<deque>
#include<tuple>
#include<list>
#include<unordered_map>
#include<unordered_set>
#include<random>
#include<functional>
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define pp pair<pair<ll, ll>,pair<ll, ll>>
#define pll pair<ll,ll>
#define pdd pair<double,double>
#define vii vector<int>
#define vll vector<ll>
#define mat vector<vector<ll>>
#define lb lower_bound
#define pb push_back
#define mp make_pair
#define fi first
#define sc second
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define LB(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define UB(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
#define ERASE(v) v.erase(unique(v.begin(),v.end()),v.end())
// #define int ll
using namespace std;
const ll INF = (1 << 30 ) - 1;
const ll LLINF = (1LL << 60LL);
const ll MOD = 1000000007;
const ll mod = 998244353;
const ll MAX = 1100000;
const double pi = acos(-1);
const double eps = 1e-10;
ll dx[4] ={1,0,-1,0} , dy[4] ={0,1,0,-1};


signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    ll n;
    cin>>n;
    cout<<(n+1)*n/2<<endl;
    return 0;
}

Measured memory_bytes: 256
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.nio.charset.StandardCharsets;
import java.util.HashSet;
//import org.apache.commons.lang3.StringUtils;
 
 
/**
 *
 * @author aj
 */
public class Main {
    
    public static void main(String[] args){
        try {
            //Scanner sc = new Scanner(System.in);
            BufferedInputStream bf = new BufferedInputStream(System.in);
            BufferedReader in = new BufferedReader(
                    new InputStreamReader(bf, StandardCharsets.UTF_8));
            OutputStream out = new BufferedOutputStream ( System.out );
            
            int s = Integer.parseInt(in.readLine());
            int lim = 1000000,i= 2 , a = s;
            HashSet<Integer> set = new HashSet();
            set.add(s);
            while(i<lim){
                if (a%2==0) a = a / 2 ;
                else a = 3 * a + 1;
                if (!set.add(a)) break;
                i++;
            }
            out.write((i+"\n").getBytes());
            out.flush();
        }catch(Exception ex){
            ex.printStackTrace();
        }
    }
}

Measured memory_bytes: 22612
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin>>N;
  vector<int>v(N);
  for(int i=0;i<N;i++)cin>>v.at(i);
  int count=0;
  int M=10000000;
  for(int i=0;i<N;i++){
    if(M>=v.at(i)){
      count++;
      M=v.at(i);
    }
  }
    cout<<count<<endl;
    
  
  
}


Measured memory_bytes: 1024
#pragma comment(linker, "/stack:20000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx")

#include <iostream>
#include <fstream>
#include <string>
#include <algorithm>
#include <memory.h>
#include <vector>
#include <array>
#include <map>
#include <set>
#include <queue>
#include <cassert>

using namespace std;

#define TT1T2 template<class T1, class T2>
TT1T2 void debug_print_array(const T1 &a, T2 sz, T2 beg = 0){ for (T2 i = beg; i<sz; i++) cerr << a[i] << (i + 1 != sz ? "," : ""); cout << endl; }
#define DBN1(a)           cerr<<#a<<"="<<(a)<<"\n"
#define DBN2(a,b)         cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<"\n"
#define DBN3(a,b,c)       cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<"\n"
#define DA(a,n) cerr<<#a<<"=["; debug_print_array(a,n); cerr<<"]\n"
double __begin;
#define DTIME(ccc) __begin = clock(); ccc; cerr<<"Time of work = "<<(clock()-__begin)/CLOCKS_PER_SEC<<endl;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
template <typename T, const int N> using Graph = vector <T> [N];

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

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.precision(20);
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif


    int n, m, k;
    cin >> n >> m >> k;

    for (int i = 0; i <= n; i++) {
        for (int j = 0; j <= m; j++) {
            int cnt = 0;
            cnt = i * m + j * n - 2 * i * j;
            if (cnt == k)
                Yes();
        }
    }
    cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 256
S = str(input())

cnt_1 = 0
cnt_2 = 0
for i in range(len(S)):
    if i%2==1:
        if S[i] == '1':
            cnt_1 += 1
        if S[i] == '0':
            cnt_2 += 1
    else:
        if S[i] == '0':
            cnt_1 += 1
        if S[i] == '1':
            cnt_2 += 1
    #print(cnt_1,cnt_2)
print(min(cnt_1,cnt_2))

Measured memory_bytes: 39664
import java.util.Scanner;
//import java.util.Arrays;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		int sum = 0;
		for(int i = 0; i < m; i++){
			sum += sc.nextInt();
		}
		
		System.out.println(n - sum >= 0 ? n - sum : -1);
	}
}


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

int main()
{
    int n, ans=0;
    string s, x, y;
    cin >> n >> s;
    for(int i=1; i<n; i++){
        int cnt=0;
        for(char c='a'; c<='z'; c++){
            bool right=false, left=false;
            for(int j=0; j<i; j++)
                if(s[j]==c)
                    left=true;
        
            for(int j=i; j<n; j++)
                if(s[j]==c)
                    right=true;

            if(right&&left)
                cnt++;
        }
        if(ans<cnt) ans = cnt;
    }
    
    cout << ans << "\n";
    return 0;
}

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

/*一旦max_elementを試して、並び替えアルゴリズムを試す*/
// priority-queue heap 優先順位付きキュー

int main(){
  int N, M;
  cin >> N >> M;
  priority_queue<int > q;
  rep(i,N){
    int a;
    cin >> a;
    q.push(a);
  }

  rep(i,M){
    int a = q.top(); q.pop(); // 最大値を
    q.push(a/2);
  }

  ll ans = 0;
  rep(i,N){
    ans += q.top(); q.pop();
  }
  cout << ans << endl;

  return 0;
}


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


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

using namespace std;

int main()
{
    int n;
    cin >> n;
    vector<int> s;
    for (int i = 0; i < n; ++i) {
        int ss;
        cin >> ss;
        s.push_back(ss);
    }
    int q;
    cin >> q;
    int count{0};
    for (int i = 0; i < q; ++i) {
        int t;
        cin >> t;
        if (binary_search(begin(s), end(s), t)) {
            ++count;
        }
    }
    cout << count << endl;
}

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

int main() {
    long long int n,W;
	cin>>n>>W;
	long long int w[n],v[n];
	for(int i=0;i<n;i++)
	{
	    cin>>w[i]>>v[i];
	}
	vector<long long int> dp(W+1,0);
	for(int j=0;j<n;j++)
	{
	for(int i=W;i>=1;i--)
	{
	        if(i>=w[j])
	        dp[i]= max((dp[i-w[j]] + v[j]),dp[i]);
	}
	}
	cout<<dp[W];
	return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>
#include <stdio.h>
using namespace std;

int main() {

	int s, w;
	cin >> s >> w;

	if (w >= s) {
		cout << "unsafe" << endl;
	}
	else {
		cout << "safe" << endl;
	}

	return 0;

}

Measured memory_bytes: 3620
// Created by arvybhatt

#include <bits/stdc++.h>
#define fast ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define F first
#define S second
#define p_b push_back
#define m_p make_pair
#define rep(i,n) for(int i=0;i<(n);++i)
#define repA(i,a,n) for(int i=a;i<=(n);++i)
#define repD(i,a,n) for(int i=a;i>=(n);--i)

using namespace std;
using ll = long long;

ll power(ll x, ll y) { ll temp; if( y == 0) return 1; temp = power(x, y/2); if (y%2 == 0) return temp*temp; else return x*temp*temp; } 

int main()
{	
    fast;
    int n;cin>>n;
    set<string> st;
    rep(i,n)
    {
    	string s;cin>>s;
    	st.insert(s);
    }
    cout<<st.size();
    
}





Measured memory_bytes: 19236
class Stack:
    """Stack"""
    def __init__(self):
        self.Clear()

    def Clear(self):
        self.Stack = []

    def push(self, dat):
        self.Stack.append(dat)
        return self.Stack

    def pop(self):
        if len(self.Stack) == 0:
            return None
        return self.Stack.pop()

s = [i for i in input().split()]
stack = Stack()
for i in range(len(s)):
    if s[i] == '+':
        s_1 = stack.pop()
        s_2 = stack.pop()
        stack.push(s_1 + s_2)
    elif s[i] == '-':
        s_3 = stack.pop()
        s_4 = stack.pop()
        stack.push(s_4 - s_3)
    elif s[i] == '*':
        s_5 = stack.pop()
        s_6 = stack.pop()
        stack.push(s_5 * s_6)
    else:
        stack.push(int(s[i]))
    
        
print(stack.pop())



Measured memory_bytes: 5608
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
using namespace std;
#define REP(i, j) for(int i = 0; i < (int)(j); ++i)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define REVERSE(v) reverse((v).begin(), (v).end())
typedef pair<int, int> P;
const int MAX_M = 1000001;
const int MAX_C = 1000;
const int INF = 1e9;
#define y first
#define x second

map<P, int> ptoi;
bool isp[MAX_M];
P dp[MAX_C][MAX_C];

void make_prime(){
  REP(i, MAX_M) isp[i] = true;
  isp[0] = isp[1] = false;
  FOR(i, 2, sqrt(MAX_M) + 1){
    if(!isp[i]) continue;
    for(int j = i + i; j < MAX_M; j += i) isp[j] = false;
  }
}

void init(){
  P now = P(MAX_C / 2, MAX_C / 2);
  int pls = 1, l = 1, step = 0, d = 0;
  FOR(i, 1, MAX_M){
    ptoi[now] = i;
    if(d == 0) now.x += 1;
    else if(d == 1) now.y -= 1;
    else if(d == 2) now.x -= 1;
    else if(d == 3) now.y += 1;
    ++step;
    if(step >= l){
      d = (d + 1) % 4;
      step = 0;
    }
    if(i != 1 && (d == 0 || d == 2) && step == 0) ++l;
  }
}

int main() {
  make_prime();
  init();
  int M, N;
  while(cin >>M >>N && (N && M)){
    REP(i, MAX_C) REP(j, MAX_C) dp[i][j] = P(-1, -1);
    REP(i, MAX_C) REP(j, MAX_C) if(ptoi[P(i, j)] == N) dp[i][j] = (isp[N] ? P(1, N) : P(0, -1));
    P ans = P(-1, -1);
    REP(y, MAX_C){
      REP(x, MAX_C){
        if(dp[y][x].first == -1 || ptoi.find(P(y, x)) == ptoi.end() || ptoi[P(y, x)] > M) continue;
        ans = max(ans, dp[y][x]);
        for(int mx = -1; mx <= 1; ++mx){
          int ny = y + 1, nx = x + mx;
          if(ny < 0 || nx < 0 || ny >= MAX_C || nx >= MAX_C || ptoi.find(P(ny, nx)) == ptoi.end() || ptoi[P(ny, nx)] > M) continue;
          int cnt = dp[y][x].first + (isp[ptoi[P(ny, nx)]] ? 1 : 0), num = (isp[ptoi[P(ny, nx)]] ? ptoi[P(ny, nx)] : dp[y][x].second);
          if(cnt > dp[ny][nx].first || (cnt == dp[ny][nx].first && num > dp[ny][nx].second)) dp[ny][nx] = P(cnt, num);
        }
      }
    }
    if(ans.first == 0) cout <<"0 0" <<endl;
    else cout <<ans.first <<" " <<ans.second <<endl;
  }
  return 0;
}

Measured memory_bytes: 72548
#include <bits/stdc++.h>
using namespace std;
#define Int int64_t
#define dump(x) cout << (x) << endl
#define fi first
#define se second
Int mod = 1e9+7;
Int INF = 1e18;
double EPS = 0.00000001;
//Int mod = 998244353;

Int dp[100005];

int main() {
    Int n;
    cin >> n;
    vector<Int> a(n);
    for (Int i = n - 1; i >= 0; i--) cin >> a[i];
    fill(dp, dp + n + 5, INF);
    for (Int i = 0; i < n; i++) {
        *upper_bound(dp, dp + n, a[i]) = a[i];
    }
    dump(lower_bound(dp, dp + n, INF) - dp);
    return 0;
}

Measured memory_bytes: 1792
import sys

sys.setrecursionlimit(10000000)
import os
import math
import bisect
import collections
import itertools
import heapq
import re
import queue

# import fractions

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: (x * y) // math.gcd(x, y)
# lcm = lambda x, y: (x * y) // fractions.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    A, B, H, M = il()
    hc = H * 30 + 0.5 * M
    mc = 6 * M
    C = abs(hc - mc)
    print(math.sqrt(A ** 2 + B ** 2 - 2 * A * B * math.cos(math.radians(C))))


if __name__ == '__main__':
    main()


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

int main(void){
  int q;
  double xn,x1,k;
  while(scanf("%d",&q)!=EOF){
    if(q==-1) break;
    else{
      x1=(double)q/2.0;
      //printf("x1:%.6f\n",x1);
      while(fabs(x1*x1*x1-q)>=(0.00001*q)){
	k=(x1*x1*x1-q)/(3*x1*x1);
	xn=x1-k;
	x1=xn;
	//printf("//%.6f\n",x1);
	
      }
      printf("%.6f\n",x1);
    }
  }
  return 0;
}

Measured memory_bytes: 636
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define all(x) (x).begin(), (x).end()
#define PI 3.14159265358979323846264338327950L
using namespace std;
typedef long long ll;
typedef long double ld;
int main() {
    int n;
    cin>>n;
    vector<int> A(26,50);
    rep(i,n){
        string S;
        cin>>S;
        vector<int> B(26,0);
        for(auto c:S) B[c-'a']++;
        rep(i,26) A[i]=min(A[i],B[i]);
    }
    rep(i,26){
        rep(j,A[i]){
            cout<<(char)(i+'a');
        }
    }
    cout<<endl;
}

Measured memory_bytes: 3628
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class Main {
	public static void main(String[] args) throws IOException, ParseException {
    	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    	String str = br.readLine();
    	
    	String tmp = "2019/04/30";
    	SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd");
    	Date criteria = sdf.parse(tmp);
    	Date now = sdf.parse(str);
    	
    	if (now.after(criteria)) {
    		System.out.println("TBD");
    	} else {
    		System.out.println("Heisei");
    	}
	}
}


Measured memory_bytes: 22608
#include <iostream>

using namespace std;

int main()
{
  int a, b;

  while (cin >> a, cin >> b, a or b) {
    for (int i=0; i<a; ++i) {
      char inside = i==0 or i==a-1 ? '#' : '.';
      cout << '#';
      for (int j=1; j<b-1; ++j)
        cout << inside;
      if (b > 1) cout << '#';
      cout << endl;
    }
    cout << endl;
  }
}


Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <vector>
#include <utility>
#include <climits>
#include <iomanip>
using namespace std;
#define MAXSIZE 100005
#define MAXL 100
#define MOD 998244353
typedef long long int lli;

int main(){
    string s;
    cin >> s;
    int ans = 0;
    if(s == "SAT"){
        ans = 1;
    }else if(s == "FRI"){
        ans = 2;
    }else if(s == "THU"){
        ans = 3;
    }else if(s == "WED"){
        ans = 4;
    }else if(s == "TUE"){
        ans = 5;
    }else if(s == "MON"){
        ans = 6;
    }else{
        ans = 7;
    }
    cout << ans << endl;
    return 0;
}

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

typedef long long ll;
typedef pair<int,int> P;
int dx[] = {-1, 1, 0,  0};
int dy[] = { 0, 0, 1, -1};

 
int main(){
  int h, w;
  cin >> h >> w;
  vector<vector<int>> a(h, vector<int>(w, 0));
  for(int i=0; i<h; i++){
    for(int j=0; j<w; j++){
      int k;
      cin >> k;
      a[i][j] = k%2;
    }
  }
  bool flag = false;
  vector<int> ans[4];
  for(int i=0; i<h; i++){
    for(int j=0; j<w; j++){
      if(i==h-1&&j==w-1) continue;
      if(i%2){
        if(flag){
          if(a[i][w-j-1]){
            flag = false;
            continue;
          }
          if(j==w-1){
            ans[0].push_back(i+1);
            ans[1].push_back(1);
            ans[2].push_back(i+2);
            ans[3].push_back(1);
          }else{
            ans[0].push_back(i+1);
            ans[1].push_back(w-j);
            ans[2].push_back(i+1);
            ans[3].push_back(w-j-1);
          }
          continue;
        }
        if(a[i][w-j-1]){
          flag = true;
          if(j==w-1){
            ans[0].push_back(i+1);
            ans[1].push_back(1);
            ans[2].push_back(i+2);
            ans[3].push_back(1);
          }else{
            ans[0].push_back(i+1);
            ans[1].push_back(w-j);
            ans[2].push_back(i+1);
            ans[3].push_back(w-j-1);
          }
        }
      }else{
        if(flag){
          if(a[i][j]){
            flag = false;
            continue;
          }
          if(j==w-1){
            ans[0].push_back(i+1);
            ans[1].push_back(w);
            ans[2].push_back(i+2);
            ans[3].push_back(w);
          }else{
            ans[0].push_back(i+1);
            ans[1].push_back(j+1);
            ans[2].push_back(i+1);
            ans[3].push_back(j+2);
          }
          continue;
        }
        if(a[i][j]){
          flag = true;
          if(j==w-1){
            ans[0].push_back(i+1);
            ans[1].push_back(w);
            ans[2].push_back(i+2);
            ans[3].push_back(w);
          }else{
            ans[0].push_back(i+1);
            ans[1].push_back(j+1);
            ans[2].push_back(i+1);
            ans[3].push_back(j+2);
          }
        }
      }
    }
  }
  cout << ans[0].size() << endl;
  for(int i=0; i<ans[0].size(); i++){
    cout << ans[0][i] << " " << ans[1][i] << " " << ans[2][i] << " " << ans[3][i] << endl;
  }
  return 0;
}


Measured memory_bytes: 5224
h,w,k = map(int, input().split())
c = [list(input()) for _ in range(h)]
ans = 0
#全探索
for ib in range(1<<h): #縦の部分を調べる
    for jb in range(1<<w): #横の部分を調べる
        black = 0
        for i in range(h):
            if ib&(1<<i):continue #縦のi番目が１かどうか見る
            for j in range(w):
                if jb&(1<<j):continue #横のj番目が１かどうか見る
                black += c[i][j]=="#"
        if black==k: ans += 1
print(ans)

Measured memory_bytes: 9016
#include<bits/stdc++.h>
#define ll long long int
#define pb push_back
#define mk make_pair
#define all(v) v.begin(),v.end()
#define fi first
#define se second
#define vl vector<long long int>
#define vvl vector<vector<ll> > 
#define fo(i,a,b) for(int i=a;i<b;i++)
#define rof(i,a,b)  for(int i=b;i>=a;i--)
using namespace std;
ll mod=1000000007;
ll dp[3100][3100][2],a[3100];
ll cnt(ll i,ll j,ll taro)
{
    if(i>j)
        return 0;
    if(dp[i][j][taro]!=-1)
        return dp[i][j][taro];
    if(taro)
    {
        dp[i][j][taro] = max(a[i]+cnt(i+1,j,0),a[j]+cnt(i,j-1,0));
    }
    else
        dp[i][j][taro] = min(cnt(i+1,j,1),cnt(i,j-1,1));
    return dp[i][j][taro];
}
int main()
{
    ios_base:: sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
    ll n;cin>>n;
    ll tot=0;
    memset(dp,-1,sizeof(dp));
    fo(i,0,n)
        cin>>a[i],tot+=a[i];
    ll maxi = cnt(0,n-1,1);
    cout << maxi-(tot-maxi);
}



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

using namespace std;
using llong = long long;
using P = pair<llong, llong>;

#define BE(x) x.begin(), x.end()

const llong inf = llong(1e18)+7;
const llong mod = 1e9+7;

llong N;
vector<llong> A;

llong solve(vector<llong> v, int now){
	if(now == N){
		llong ans = 1;
		for(auto x : v)
			ans *= x;
		if(ans&1^1)
			return 1;
		else
			return 0;
	}

	llong ret = 0;
	v.push_back(0);
	for(int i = A[now]-1; i <= A[now]+1; i++){
		v[v.size()-1] = i;
		ret += solve(v,now+1);
	}

	return ret;
}

int main(){

	cin >> N;
	A.resize(N);
	for(int i = 0; i < N; i++)
		cin >> A[i];

	cout << solve(vector<llong>(),0) << endl;

	return 0;
}

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

const int N = (int) 1e5 + 5;

int n, m;
int s[N];
map <int, int> fw;

void upd(int i) {
	for (; i <= m; i += i & -i) fw[i]++; 
}

int get(int i) {
	int res = 0;
	for (; i >= 1; i -= i & -i) res += fw[i];
	return res;
}

int main() {
	//freopen(".inp", "r", stdin); freopen(".out", "w", stdout);
	scanf("%d %d", &n, &m);
	for (int i = 1; i <= n; i++) {
		int a; scanf("%d", &a);
		s[i] = (s[i - 1] + a) % m;
		if (s[i] == 0) s[i] = m;
	}
	long long ans = 0;
	upd(m);
	for (int i = 1; i <= n; i++) {
		ans += get(s[i]) - get(s[i] - 1);
		upd(s[i]);
	}
	printf("%lld", ans);
	return 0;
}

Measured memory_bytes: 42112
n,l = map(int,input().split())
A = []
for i in range(1,n+1):
    A.append((abs(l+i-1),l+i-1))
A.sort()
# print(A)
ans = 0
for i in range(1,len(A)):
    ans += A[i][1]
print(ans)

Measured memory_bytes: 61532
n,m=map(int,input().split())
flag=list(1 for _ in range(n+1))
count=list(0 for _ in range(n+1))
ans=0
for i in range(m):
    x=int(input())
    flag[x]=0

if n==1:
    ans=1
else:
    if flag[1]==1:
        count[1]=1
    if flag[2]==1:
        count[2]=count[1]+1
    for i in range(3,n+1):
        if flag[i]==1:
            count[i]=count[i-1]+count[i-2]
            
    ans=count[n]
print(ans%(10**9+7))
           

Measured memory_bytes: 460836
import java.util.Scanner;

class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		double a = sc.nextDouble();
		double b = sc.nextDouble();
		double c = sc.nextDouble();
		System.out.println(a*b*Math.sin(c*Math.PI/180.0)/2);
		System.out.println(a+b+Math.sqrt(Math.pow(a,2)+Math.pow(b,2)-2*a*b*Math.cos(c*Math.PI/180.0)));
		System.out.println(b*Math.sin(c*Math.PI/180.0));
    }
}


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

int main(){
  int n;
  long k;
  cin >> n >> k;
  vector<int>a(n);
  for(int i=0; i<n; i++){
    cin >> a[i];
    a[i]--;
  }
  for(int i=0; i<n; i++)cerr << a[i] << ' ';
  cerr << endl;
  vector<int>flag(n, -1); //0からスタートして何手目に着いたか
  int t=0;
  int span, lst;
  for(int i=0; i<n; i++){
    flag[t]=i;
    t = a[t];
    if(flag[t]>=0){
      span = i-flag[t]+1;
      lst = flag[t];
      break;
    }
  }
  int tt = 0;
  if(k<lst){
    for(int i=0; i<k; i++){
      tt=a[tt];
    }
    cout << ++tt;
  }
  else {
    for(int i=0; i<lst+(k-lst)%span; i++){
      tt=a[tt];
    }
    cout << ++tt;
  }
  return 0;
}
  

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

int main(){
	int x[20][20];
	int n,m,c,d,e;
	bool dame[20][20];
	while(true){
		memset(x,0,sizeof(x));
		memset(dame,false,sizeof(dame));
		cin>>n>>m;
		if(n==0 && m==0){
			break;
		}
		cin>>c;
		for(int i=0;i<c;i++){
			cin>>d>>e;
			dame[d][e]=true;
		}
		for(int i=1;i<=n;i++){
			if(dame[i][1]==true){
				for(int j=i;j<=n;j++){
					x[j][1]=0;	
				}
				goto Exit1;
			}
			else{
				x[i][1]=1;
			}
		}
		Exit1:;
		for(int i=1;i<=m;i++){
			if(dame[1][i]==true){
				for(int j=i;j<=n;j++){
					x[1][j]=0;	
				}
				goto Exit2;
			}
			else{
				x[1][i]=1;
			}
		}
		Exit2:;
		for(int i=2;i<=n;i++){
			for(int j=2;j<=m;j++){
				if(dame[i][j]==true){
					x[i][j]=0;
				}
				else{
					x[i][j]=x[i-1][j]+x[i][j-1];
				}
			}
		}
		cout<<x[n][m]<<endl;
	}
	return 0;
}

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

int main() {
    int n, m; cin >> n >> m;
    string s; cin >> s;
    reverse(s.begin(), s.end());
    int re[n+1] = {}, tmp = 0;
    for (int i = 0; i < s.size(); i++)
    {
        if(s[i] == '0') {
            tmp = 0;
            re[i] = 0;
        }
        else {
            tmp++;
            re[i] = tmp;
        }
    }

    vector<int> res;
    int st = 0;
    bool ok = true;
    while (st < n)
    {
        if(st + m >= n) {
            res.push_back(n - st);
            break;
        }
        else {
            int ex = m - re[st+m];
            if(ex <= 0) {
                ok = false;
                break;
            }
            res.push_back(ex);
            st += ex;
        }
    }
    if(ok) {
        reverse(res.begin(), res.end());
        for (int i = 0; i < res.size(); i++)
        {
            cout << res[i];
            if(i == res.size()-1) cout << endl;
            else cout << " ";
        }
    }
    else cout << "-1" << endl;
    return 0;
}

Measured memory_bytes: 1528
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const ll mod998 = 998244353;
const ll intmax = 2147483647;
const ll llmax = 9223372036854775807;
const char sp = ' ';

int N;
ll X, b[100000], l[100000], u[100000], k, res;
bool a[100000];
vector<pair<ll, int>>v;

int main() {
	cin >> N >> X;
	v = vector<pair<ll, int>>(N);
	for (int i = 0; i < N; i++) {
		cin >> b[i] >> l[i] >> u[i];
		k += b[i] * l[i];
		v[i] = { b[i] * l[i] + (X - b[i])*u[i],i };
	}
	if (!k) {
		cout << 0 << endl;
		return 0;
	}
	sort(v.begin(), v.end(), greater<>());

	ll s = 0;
	int t = N;
	for (int i = 0; i < N; i++) {
		s += v[i].first;
		a[v[i].second] = true;
		if (s >= k) {
			s -= v[i].first;
			a[v[i].second] = false;
			t = i;
			break;
		}
	}
	if (t == N) {
		cout << t*X << endl;
	}
	else {
		res = llmax;
		for (int i = 0; i < N; i++) {
			if (a[i]) {
				ll c = s;
				c -= b[i] * l[i] + (X - b[i])*u[i];
				c += b[v[t].second] * l[v[t].second] + (X - b[v[t].second])*u[v[t].second];
				if (k - c <= b[i] * l[i]) {
					res = min(res, t*X + (k - c - 1) / l[i] + 1);
				}
				else {
					res = min(res, t*X + b[i] + (k - c - b[i] * l[i] - 1) / u[i] + 1);
				}
			}
			else {
				if (k - s <= b[i] * l[i]) {
					res = min(res, t*X + (k - s - 1) / l[i] + 1);
				}
				else {
					res = min(res, t*X + b[i] + (k - s - b[i] * l[i] - 1) / u[i] + 1);
				}
			}
		}
		cout << res << endl;
	}
}

Measured memory_bytes: 4352
#include <iostream>

using namespace std;

int main()
{
	int in[4];
	int total[2];

	for(int i = 0; i < 2; i++){
		total[i] = 0;
		for(int j = 0; j < 4; j++){
			cin >> in[j];
			total[i] += in[j];
		}
	}

	if(total[0] > total[1]){
		cout << total[0] << endl;
	}
	else{
		cout << total[1] << endl;
	}

	return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
#define rep(i,n)    for(long long i = 0; i < (n) ; ++i)
#define orep(i,n)   for(long long i = 1; i <= (n); ++i)   // one rep
#define drep(i,n)   for(long long i = (n)-1; i >= 0; --i) // down rep
#define srep(i,s,t) for(long long i = (s); i < (t); ++i)  // set rep
#define rng(x)  (x).begin(),(x).end()

  // range
#define rrng(a) (a).rbegin(),(a).rend() // reverse range
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define ru(x,y) (((x)+(y)-1)/(y)) // round up
#define fi first
#define se second
#define eb emplace_back
#define fcout cout << fixed << setprecision(15)


using namespace std;
using ll  = long long;
using P   = pair<int,int>;
using vi  = vector<int>;
using vvi = vector<vi>;
using vp  = vector<P>;
using vl  = vector<ll>;

template<typename T> void Yes(T flag) {
  cout << (flag ? "Yes" : "No") << endl;
}

template<typename T> void pv(vector<T> vec) {
  cout << "[";
  for(auto& v : vec) { cout << v << ","; }
  cout << "]" << endl;
}

template<>
void pv(vector<P> vec) {
  cout << "[";
  for(auto& v : vec) {
    cout << "<" << v.fi << ","<< v.se << ">" << ",";
  }
  cout << "]" << endl;
}

template<typename T> void pv2(vector<vector<T>> vec) {
  for(auto& v : vec) pv(v);
}

int main() {
  int n,m;
  cin >> n >> m;
  vi h(n,0);
  rep(i,n) cin >> h.at(i);
//  vi a(m,0),b(m,0);

  vvi miti(n,vi());
  rep(i,m) {
    int a,b;
    cin >> a >> b;
    a--;b--;
    miti.at(a).eb(b);
    miti.at(b).eb(a);
  }

  int ans = 0;
  rep(i,n) {
    vi t = miti.at(i);
    bool flag = true;
    int ht = h.at(i);
    rep(j,t.size()) {
      if(ht <= h.at(t.at(j))) {
        flag = false;
        break;
      }
    }
    if(flag) ans++;
  }

  cout << ans << endl;



  return 0;
}


Measured memory_bytes: 8824
#include<bits/stdc++.h>
#include<math.h>
using namespace std;
 
int main(){
  int A,B, C, D, E, F;
  cin >> A >> B >> C >> D >> E >> F;
  double noudo = 0.0;
  int tot = 100*A, sugar = 0;
  for (int a=0;a<=F/(100*A);a++){
    for (int b=0;b<=(F-100*A*a)/(100*B);b++){
      if (a==0 && b==0) continue;

      for (int c=0;c<=(F-100*A*a-100*B*b)/C;c++){
        for (int d=0;d<=(F-100*A*a-100*B*b-C*c)/D;d++){
          if (1.0*(C*c+D*d)/(100*A*a+100*B*b+C*c+D*d) <= 1.0*E/(100+E) && 1.0*(C*c+D*d)/(100*A*a+100*B*b+C*c+D*d) > noudo){
            tot = 100*A*a+100*B*b+C*c+D*d;
            sugar = C*c+D*d;
            noudo = 1.0*sugar/tot;
          }
        }
      }
    }
  }
  cout << tot << " " << sugar << endl;

}
 

Measured memory_bytes: 256
x, y = map(int,input().split())

aG = [1,3,5,7,8,10,12]
bG = [4,6,9,11]
cG = [2]

if (x in aG and y in aG) or (x in bG and y in bG) or (x in cG and y in cG):
  print("Yes")
else:
  print("No")


Measured memory_bytes: 2940
N = int(input())
A = list(map(int, input().split()))

num_list = [0 for i in range(N)]


for n in A :
  num_list[n-1] += 1
  
calc_list = list(map(lambda x : max(0, int(x*(x-1)/2)), num_list))
s = sum(calc_list)

for k in range(N) :
  print(s - num_list[A[k]-1] + 1)


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

#define                      ff                                          first
#define                      ss                                          second
#define                      pai                                         acos(-1)
#define                      ll                                          long long
#define                      pb                                          push_back
#define                      mp                                          make_pair
#define                      pll                                         pair<ll,ll>
#define                      sz(a)                                       (ll)a.size()




const ll mod  = 1e9 +07;
const ll mxn  = 1e6 +10;

bool valid(ll a, ll b, ll c)
{
    if((a+b)>c && (b+c)>a && (a+c)>b && a<b && a<c && b<c)
    {
        return true;
    }
    else
    {
        return false;
    }
}
int  main(int argc, char const *argv[])
{
    ll i,j,k,a,b,c,d,n,m,t,h,u,v,x,y,z;
    cin>>n;
    vector<ll>vec(n);
    for(auto &a:vec)
    {
        cin>>a;
    }
    sort(vec.begin(),vec.end());
    ll cnt=0;
    for(i=0;i<n-2;i++)
    {
        for(j=i+1;j<n-1;j++)
        {
            for(k=j+1;k<n;k++)
            {
                if(valid(vec[i],vec[j],vec[k]))
                {
                    //cout<<"( "<<vec[i]<<" , "<<vec[j]<<" , "<<vec[k]<<" ) "<<endl;
                    cnt++;
                }
            }
        }
    }
    cout<<cnt<<endl;
    return 0;
}



Measured memory_bytes: 3608
#include<stdio.h>

 

int main()

{

  int length = 0;

  int height = 0;

  int area = 0;

  int cir = 0;

 

  scanf("%d %d", &length, &height);

  area = length * height;

  cir = length*2 + height*2;

 

  printf("%d %d\n", area, cir);

 

  return 0;

} 

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

namespace ABC153A
{
    class Program
    {
        static void Main(string[] args)
        {
            int H, A,s;
            var word = Console.ReadLine().Split(' ');
            H = int.Parse(word[0]);
            A = int.Parse(word[1]);
            s = 0;
            if (H % A == 0)
                s = H / A;
            else
            s = H / A + 1;

            Console.WriteLine(s);
            Console.ReadKey();
        }
    }
}


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

int main() {
    int a, b;
    cin >> a >> b;
    if(a%(2*b+1)==0) {
        cout << a/(2*b+1);
    } else {
        cout << a/(2*b+1)+1;
    }
    return 0;
}



Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <bits/stdc++.h>
/*#pragma GCC optimize("Ofast","unroll-loops","omit-frame-pointer","inline") //Optimization flags
#pragma GCC option("arch=native","tune=native","no-zero-upper") //Enable AVX
#pragma GCC target("avx2")  //Enable AVX*/

using namespace std;

using ll = long long;

#define mp make_pair

const int p = 1000000007;


int mul(int a, int b) {
    return (1LL * a * b) % p;
}

int add(int a, int b) {
    int s = (a+b);
    if (s>=p) s-=p;
    return s;
}

int sub(int a, int b) {
    int s = (a+p-b);
    if (s>=p) s-=p;
    return s;
}

int po(int a, int deg)
{
    if (deg==0) return 1;
    if (deg%2==1) return mul(a, po(a, deg-1));
    int t = po(a, deg/2);
    return mul(t, t);
}

int inv(int n)
{
    return po(n, p-2);
}

/*struct DSU {
    vector<int> sz;
    vector<int> parent;

    void make_set(int v) {
        parent[v] = v;
        sz[v] = 1;
    }

    int find_set(int v) {
        if (v == parent[v])
            return v;
        return parent[v] = find_set(parent[v]);
    }

    void union_sets(int a, int b) {
        a = find_set(a);
        b = find_set(b);
        if (a != b) {
            if (sz[a] < sz[b])
                swap(a, b);
            parent[b] = a;
            sz[a] += sz[b];
        }
    }

    DSU(int n) {
        sz.resize(n);
        parent.resize(n);
        for (int i = 0; i < n; i++) make_set(i);
    }
};*/

/*const int N = 1000000;

vector<int> facs(N), invfacs(N);

void init()
{
    facs[0] = 1;
    for (int i = 1; i<N; i++) facs[i] = mul(facs[i-1], i);
    invfacs[N-1] = inv(facs[N-1]);
    for (int i = N-2; i>=0; i--) invfacs[i] = mul(invfacs[i+1], i+1);
}

int C(int n, int k)
{
    return mul(facs[n], mul(invfacs[k], invfacs[n-k]));
}*/

map<ll, int> answer;

int solve(ll N)
{
    if (answer.find(N)!=answer.end()) return answer[N];
    if (N==0) answer[N] = 1;
    else if (N==1) answer[N] = 2;
    else answer[N] = add(solve(N/2), add(solve((N-1)/2), solve((N-2)/2)));
    return answer[N];
}



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

    ll n;
    cin>>n;
    cout<<solve(n);

    /*for (int i = 1; i<=10; i++) cout<<i<<": "<<solve(i)<<endl;
    cout<<endl;
    for (int i = 1; i<=10; i++) cout<<i<<": "<<bad(i)<<endl;*/




}




Measured memory_bytes: 256
package main

import (
  "fmt"
)

func main() {
  var S string
  fmt.Scan(&S)

  var z, o int
  for i := 0; i < len(S); i++ {
    if S[i] == '0' {
      z++
    } else {
      o++
    }
  }
  if z > o {
    fmt.Println(o * 2)
  } else {
    fmt.Println(z * 2)
  }
}

Measured memory_bytes: 1280