akhauriyash/Code-Regression huggingface dataset:
/*
   Created by Rahul Goel.
*/
/*******************************************************************************/
#include <iostream>
#include <vector>
#include <cstring>
#include <string>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <cmath>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
/*******************************************************************************/
using namespace std;
typedef long long ll;
typedef long double ld;
ll mod = 1000000007;
const int INF = 1e9;
const ll LINF = 1e18;
/*******************************************************************************/
/* For PBDS */
/*Two new methods X.order_of_key() and X.find_by_order()*/
/*
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
*/

/*******************************************************************************/
#define fastio          ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define all(c)          (c).begin(), (c).end()
#define pii             pair < ll, ll >
#define vi              vector < ll >
#define vb              vector < bool >
#define vvi             vector < vector < ll > >
#define vvb             vector < vector < bool > >
#define vpii            vector < pair < ll, ll > >
#define vvpii           vector < vector < pair < ll, ll > > >
#define present(c,x)    ((c).find(x) != (c).end())
#define cpresent(c,x)   (find(all(c),x) != (c).end())
#define uniq(c)         (c).resize(distance((c).begin(), unique(all(c))))
#define min_pq(t)       priority_queue < t, vector < t >, greater < t > >
#define max_pq(t)       priority_queue < t >
#define pb              push_back
#define ff              first
#define ss              second
/*******************************************************************************/
ll mod_sum() { return 0LL; }
template<typename T, typename... Args>
T mod_sum(T a, Args... args) { return ((a + mod_sum(args...))%mod + mod)%mod; }

ll mod_prod() { return 1LL; }
template<typename T, typename... Args>
T mod_prod(T a, Args... args) { return (a*mod_prod(args...))%mod; }
/*******************************************************************************/

/*
    Code begins after this.
*/


ll solve(){
    ll n;
    vi a, b, c;
    vvi dp;
    cin >> n;
    a = b = c = vi(n);
    dp = vvi(n, vi(3));
    
    for(ll i=0; i<n; i++)
        cin >> a[i] >> b[i] >> c[i];

    dp[0][0] = a[0], dp[0][1] = b[0], dp[0][2] = c[0];
    for(ll i=1; i<n; i++){
        dp[i][0] = max(dp[i-1][1], dp[i-1][2]) + a[i];
        dp[i][1] = max(dp[i-1][2], dp[i-1][0]) + b[i];
        dp[i][2] = max(dp[i-1][0], dp[i-1][1]) + c[i];
    }
        
    cout << *max_element(all(dp[n-1])) << endl;

    return 0;
}


int main(){
    fastio;

    ll t = 1;
    while(t--)
        solve();

    return 0;
}



Measured memory_bytes: 8064
#include <cstdio>
#include <utility>
#include <vector>
#include <array>
#include <climits>
#include <algorithm>
using namespace std;

#define gcu getchar_unlocked
int in(int c){int n=0;bool m=false;if(c=='-')m=true,c=gcu();
	do{n=10*n+(c-'0'),c=gcu();}while(c>='0');return m?-n:n;}
int in() {return in(gcu());}
bool scan(int &n){int c=gcu();return c==EOF?false:(n=in(c),true);}
bool scan(char &c){c=gcu();gcu();return c!=EOF;}
//bool scan(string &s){int c;s="";
//	for(;;){c=gcu();if(c=='\n'||c==' ')return true;else if(c==EOF)return false;s+=c;}}
template <typename head, typename... tail>
bool scan(head &h, tail&&... t){return scan(h) && scan(t...);}
#define pcu putchar_unlocked
#define vo inline void out
template <typename T>
vo(T n){static char buf[20];char *p=buf;
	if(n<0)pcu('-'),n*=-1;if(!n)*p++='0';else while(n)*p++=n%10+'0',n/=10;
	while (p!=buf)pcu(*--p);}
vo(const char *s){while(*s)pcu(*s++);}
vo(char c){pcu(c);}
//vo(string &s){for (char c: s) pcu(c);}
template <typename head, typename... tail> vo(head&& h, tail&&... t){out(h);out(move(t)...);}
//template <typename T> vo(vector<T> &v){for(T &x:v)out(&x == &v[0]?"":" "),out(x);out('\n');}
#undef vo

typedef vector<array<int, 2>> node;

int main() {
	for (int n, m; n = in(), m = in(), m++ || n;) {
		vector<node> v(m, node(m, {INT_MAX/2, INT_MAX/2}));
		while (n--) {
			int a = in(), b = in(), c = in(), t = in();
			v[a][b] = v[b][a] = {c, t};
		}
		for (int k = 1; k < m; k++)
			for (int i = 1; i < m; i++)
				for (int j = 1; j < m; j++) {
					auto &t = v[i][j];
					t = {min(t[0], v[i][k][0] + v[k][j][0]), min(t[1], v[i][k][1] + v[k][j][1])};
				}
		for (int k = in(); k--;) {
			int p = in(), q = in(), r = in();
			out(v[p][q][r], '\n');
		}
	}
}


Measured memory_bytes: 2600
import java.util.Scanner;


public class Main {

	static int M[][];

	public static void main(String[] args) {
		Scanner in=new Scanner(System.in);
		int n=Integer.parseInt(in.next());
		M=new int[n][n];

		for(int i=0;i<n;i++){
			for(int j=0;j<n;j++)M[i][j]=Integer.parseInt(in.next());
		}

		int INF=2000000001, d[]=new int[n], p[]=new int[n];
		char color[]=new char[n];

		for(int i=0;i<n;i++){
			color[i]='W';
			d[i]=INF;
		}

		d[0]=0; p[0]=-1;

		while(true){
			int mincost=INF, u=-1;

			for(int i=0;i<n;i++){
				if(color[i]!='B' && d[i]<mincost){
					mincost=d[i];
					u=i;
				}
			}

			if(u==-1)break;

			color[u]='B';

			for(int v=0;v<n;v++){
				if(color[v]!='B' && M[u][v]!=-1){
					if(M[u][v]<d[v]){
						d[v]=M[u][v];
						color[v]='G';
					}
				}
			}
		}

		int sum=0;
		for(int i=0;i<n;i++){
			if(d[i]!=-1)sum+=d[i];
		}
		System.out.println(sum);

	}

}



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

int main()
{
    long long A, B, r, x, tmp;
    cin >> A >> B;
    x = A * B;
    if(A<B){
        tmp = A;
        A = B;
        B = tmp;
        //cout << A << " "<< B << endl;
    }
    r = A % B;
    while(r!=0){
        A = B;
        B = r;
        r = A % B;
    }
    cout << x / B << endl;

}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int n, i;
	long long int num = 0,min = 1000000, max = -1000000, sum = 0;

	scanf("%d", &n);

	for (i = 0; i < n; i++)
	{
		scanf("%ld", &num);

		if (min > num) min = num;
		if (max < num) max = num;
		sum += num;
	}

	printf("%lld %lld %lld\n", min, max, sum);

	return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
#define PI 3.1415926535897
using namespace std;
typedef long long ll;
const int INF = 1000000000;
const ll LINF = 1000000000000000000; //1e18
const double EPS = 1e-10;

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

    vector<ll> a(n);
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
    }
    for (int i = 0; i < n; i++)
    {
        if (a[i] == 0)
        {
            printf("0\n");
            return (0);
        }
    }

    ll ans = 1;
    for (int i = 0; i < n; i++)
    {
        if (a[i] <= (1000000000000000000 / ans))
        {
            ans *= a[i];
        }
        else
        {
            printf("-1\n");
            return (0);
        }
    }
    cout << ans << endl;
    return (0);
}

Measured memory_bytes: 4044
#include <iostream>
using namespace std;
int main(){
    int m, f, r;
    char grade;
    while (1){
        cin >> m >> f >> r;
        if (m==-1 && f==-1 && r==-1){
            break;
        } else if (m==-1 || f==-1) {
            grade = 'F';
        } else if (m+f >= 80){
            grade = 'A';
        } else if (m+f < 80 && m+f >= 65){
            grade = 'B';
        } else if (m+f < 65 && m+f >= 50){
            grade = 'C';
        } else if (m+f < 50 && m+f >= 30){
            if (r >= 50){
                grade = 'C';
            } else{
                grade = 'D';
            }
        } else{
            grade = 'F';
        }
        cout << grade << endl;
    }return 0;
}


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

const int MAXN = 1e5 + 10;

int n;
char s[MAXN];

int main() {
	scanf(" %s", s + 1), n = strlen(s + 1);
	if (s[1] == '0' || s[n] == '1') return puts("-1"), 0;
	for (int i = 1; i < n; ++i) if (s[i] != s[n - i]) return puts("-1"), 0;
	int lst = 1, now = 0;
	for (int i = 2; i <= n; ++i) if (s[i] == '1') {
		printf("%d %d\n", now = i, lst);
		for (int j = lst + 1; j < now; ++j) printf("%d %d\n", now, j);
		lst = now;
	}
	printf("%d %d\n", n, n - 1);
	return 0;
}

Measured memory_bytes: 1536
package main

import "fmt"

func main() {
	// Code for C - Be Together
	var N int
	fmt.Scanf("%d", &N)

	a := make([]int, N)
	for i := 0; i < N; i++ {
		fmt.Scanf("%d", &a[i])
	}

	var sum int
	var min int = 100000000
	for i := -100; i <= 100; i++ {
		sum = 0
		for j := 0; j < N; j++ {
			sum += (i - a[j]) * (i - a[j])
		}

		if sum < min {
			min = sum
		}
	}

	fmt.Println(min)
}


Measured memory_bytes: 1840
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
	ll n,a[114514],ans=0;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a[i];
		if(i&&a[i-1]&&a[i]){
			a[i]--;
			ans++;
		}
		ans+=a[i]/2;
		a[i]%=2;
	}
	cout<<ans<<endl;
	return 0;
}

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

using namespace std;

#define boost ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long int
// #define int ll
#define vi vector<ll>
#define vvi vector<vi>
#define pii pair<int, int>
#define vii vector<pii>
#define pb push_back
#define B begin()
#define E end()
#define sz(A) (ll)(A).size()
#define F first
#define S second
#define loop(z, v) for(auto &z: v)
#define sp << ' ' << 
#define sps << ' '
#define nl "\n"
// #define nl endl
#define fat 1000000007
// #define fat 998244353

int main()
{
    boost;
    ll tt = 1, n, k = 0, i, j;
    ll q, l = 0, r = 0, x, y, z, h, d;

    bool poss = true;
    string m;

    // cin >> tt;
    for(int _ = 1; _ <= tt; _++){
        // cout << "Case #" << _ << ": ";
        cin >> x;

        ll ans = 0;
        l = 100;
        ll frac = 0;
        while(1){
            if(l >= x){
                break;
            }
            frac = l / 100;
            l += l / 100;
            ans++;
        }

        cout << ans << nl;
    }   
    return 0;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;

int main() {
  int n;
  cin >> n;
  vector<int> a(n + 1);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < n - 1; i++) {
    if (a[i] == -1) continue;
    if (a[i] == a[i + 1]) a[i + 1] = -1;
  }
  cout << count(all(a), -1) << endl;
  return 0;
}

Measured memory_bytes: 3616
#include<cstdio>

int main(){
	int f[1000001] = {};
	int n;
	for(int i = 2; i <= 1000; i++){
		for(int j = 2; j * i <= 1000000; j++){
			f[i * j] = 1;
		}		
	}

	int sum;

	while(scanf("%d", &n) + 1){
		int sum = n - 1;
		for(int i = 2; i <= n; i++){
			sum -= f[i];
		}
		printf("%d\n", sum);
	}
	return 0;
}

Measured memory_bytes: 4936
#include <iostream>
#include <map>
#include <vector>
#include <stack>
#include <algorithm>
#include <vector>
using namespace std;

typedef vector<int> vi;
typedef vector<vi> vvi;
#define loop(i,a,b) for(int i=(a); i<int(b); i++)
#define rep(i,b) loop(i,0,b)

int dx[] = {0,1,0,-1};
int dy[] = {1,0,-1,0};
int h,w,c;

inline bool in(int x, int y){
    return 0<=x&&0<=y&&y<h&&x<w;
}

int dfs_c(vvi& g, int x, int y){
    if(!in(x,y)) return 0;
    if(g[y][x]==c){
        int res=1;
        g[y][x]=-1;
        rep(i,4){
            res+=dfs_c(g,x+dx[i],y+dy[i]);
        }
        return res;
    } else return 0;
}

int count(vvi g){
    return dfs_c(g,0,0);
}

void dfs_f(vvi& g, int ic, int fc, int x, int y){
    if(!in(x,y)) return;
    if(g[y][x]==ic){
        if(g[y][x]==fc) return;
        g[y][x]=fc;
        rep(i,4){
            dfs_f(g, ic, fc, x+dx[i],y+dy[i]);
        }
    }
}

void flip(vvi& g, int fc){
    dfs_f(g,g[0][0],fc,0,0);
}

void print(vvi const& v){
    rep(i,v.size()){
        rep(j,v[0].size()){
            cout << v[i][j]+1 << " ";
        }cout << endl;
    }cout << endl;
}

int main(){
    while(cin>>h>>w>>c && h+w+c){
        c--;
        vvi g(h,vi(w));
        rep(i,h)rep(j,w){
            cin>>g[i][j];
            g[i][j]--;
        }
        int end = 7776; // 6**5

        int m = 0;
        rep(mask,end){
            int t=mask;
            vvi h=g;
            // cout << mask << endl;
            rep(i,5){
                if(h[0][0]!=t%6){
                    flip(h,t%6);
                }
                // print(h);
                t/=6;
            }
            m = max(m,count(h));
        }
        cout << m << endl;
    }
}

Measured memory_bytes: 1216
#include<stdio.h>

int main(void)
{
   int a,b,c,i;
   scanf("%d %d %d",&a,&b,&c);

   i=0;

   for(;a<=b;a++){
      if(c % a == 0){
         i++;
      }
   }

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

   return 0;
}

Measured memory_bytes: 596
// Mon Aug 24 16:24:09 IST 2020        
#include <bits/stdc++.h>        
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#define forn(ii,a,b)       for(int ii = (int)a ; ii < (int)b  ; ii++ )
#define scan(any)          for(auto &i:any) cin>>i;
#define debug(x)           cerr << #x << " " << x << " -- \n"
#define I__O               ios::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define int64              long long   
#define all(x)             (x).begin(),(x).end() 
#define ff                 first
#define ss                 second
#define pppp               pair <int,int> 
#define flushOff           fflush(stdout) 
#define precise(x)         cout << fixed << setprecision(12) << x << '\n'; 
using namespace std ;    
// policy based   
using namespace __gnu_pbds;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set ; 
 
const int MOD1 = 1e9+7;
const int MOD2 = 1e9+9;
const double pi = 3.141592653589793238;
const int INF = 2e9+7; 
// const int N = 2e5+7;
struct compare{
    bool operator()(pair <int,int> A, pair <int,int> B){
        if(A.first == B.first)
            return A.second > B.second;
        return A.first > B.first;
    }
}; 
void print(vector <int>v){
    for(int t : v){
        cout << t << ' ';
    }
    cout << '\n';
}
int tests(){  
    int n,k;
    cin >> n >> k;
    int ans = 0;
    vector <bool> p(n);
    forn(i,0,k){
        int d;
        cin >> d;
        forn(_,0,d){
            int x;
            cin >> x;
            x -=1;
            p[x] = true;
        }
    }
    forn(i,0,n)
        ans += !p[i];
    cout << ans << '\n';
    return 0;
}    
int main(){
    I__O ;      
    int cases = 1 ;  
    // cin >> cases ;
    while(cases--)
        tests(); 
    return 0 ; 
}
 

Measured memory_bytes: 3632
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
 
void makecopy(int *saikoro,int *copy){
  int i;
  for(i=1;i<=6;i++){
    copy[i]=saikoro[i];
  }
}


int main(){
  int *saikoro,*copy,i,ue,syoumen,n,j,saikoro2[7],hantei=0;
  saikoro=malloc(7*sizeof(int));
  copy=malloc(7*sizeof(int));
  for(i=1;i<=6;i++) scanf("%d",&saikoro[i]);
  for(i=1;i<=6;i++) scanf("%d",&saikoro2[i]);
  makecopy(saikoro,copy);
  char order[8]="SSSSEEEE";
  for(j=0;j<1;j++){
    ue=saikoro2[1];
    syoumen=saikoro2[2];
    for(i=0;i<strlen(order);i++){
      if(order[i]=='S'){
        saikoro[2]=copy[1];
        saikoro[6]=copy[2];
        saikoro[5]=copy[6];
        saikoro[1]=copy[5];
        makecopy(saikoro,copy);
      }
      if(order[i]=='N'){
        saikoro[1]=copy[2];
        saikoro[2]=copy[6];
        saikoro[6]=copy[5];
        saikoro[5]=copy[1];
        makecopy(saikoro,copy);
      }
      if(order[i]=='W'){
        saikoro[4]=copy[1];
        saikoro[6]=copy[4];
        saikoro[3]=copy[6];
        saikoro[1]=copy[3];
        makecopy(saikoro,copy);
      }
      if(order[i]=='E'){
        saikoro[1]=copy[4];
        saikoro[4]=copy[6];
        saikoro[6]=copy[3];
        saikoro[3]=copy[1];
        makecopy(saikoro,copy);
      }
      if(saikoro[1]==ue) break;
    }
    while(saikoro[2]!=syoumen){
      saikoro[2]=copy[3];
      saikoro[4]=copy[2];
      saikoro[5]=copy[4];
      saikoro[3]=copy[5];
      makecopy(saikoro,copy);
      hantei+=1;
    }
  }
  if(saikoro[3]==saikoro2[3] && saikoro[4]==saikoro2[4] &&saikoro[5]==saikoro2[5]) printf("Yes\n");
  else printf("No\n");
  return 0;
}

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

int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	int n,k; cin>>n>>k; --k;
	vector<int>h(n); for(auto&i:h)cin>>i;
	sort(h.begin(),h.end());
	int ans=1e9;
	for(int i=k;i<n;++i){
		ans=min(ans,h.at(i)-h.at(i-k));
	}
	cout<<ans<<"\n"s;
}

Measured memory_bytes: 640
a,b,k=gets.split(" ").map(&:to_i)
ary = Array.new()

for i in 0...k
  if a+i<=b
    puts a+i
    ary.push(a+i)
  end
end

for i in 0...k
  puts b-(k-i)+1 if !ary.include?(b-(k-i)+1) && b-(k-i)+1 >= a
end

Measured memory_bytes: 1788
#include <cstdio>
#include <algorithm>
#include <list>
using namespace std;



int main(){
    list<int> dlist;
    int n,key,flag = 0;
    char command[100];
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%s %d",&command,&key);      
        if(command[0] == 'i'){
            dlist.push_front(key);
        }else if(command[0] == 'd'){
            if(command[6] == 'F'){
                dlist.pop_front();
            }else if(command[6] == 'L'){
                dlist.pop_back();
            }else{
                for(list<int>::iterator it = dlist.begin();it != dlist.end();it++){
                    if(*it == key){
                        dlist.erase(it);
                        break;
                    }
                }
            }
        }
    }

    for(list<int>::iterator it = dlist.begin();it != dlist.end();it++){
        if(flag!=0) printf(" ");
        printf("%d", *it);
        flag = 1;  
    }
    printf("\n");
}

Measured memory_bytes: 33908
#include<bits/stdc++.h>
using namespace std;
long long n,mx,pow_10[15];
int main(){
	scanf("%lld",&n);
	for(int i=sqrt(n);i>=1;i--){
		if(n%i==0){
			mx=n/i;
			break;
		}
	}
	pow_10[0]=1;
	for(int i=1;i<=10;i++){
		pow_10[i]=pow_10[i-1]*10;
	}
	for(int i=1;i<=10;i++){
		if(mx>=pow_10[i-1]&&mx<pow_10[i]){
			printf("%lld",i);
			break;
		}
	}
}

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

signed main(void)
{
	long long x;
	long long ans;
	cin >> x;

	ans = 0;
	ans += (x / 500) * 1000;
	x %= 500;
	ans += (x / 5) * 5;
	x %= 5;
	cout << ans << endl;
	return 0;
}


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

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

  int n;
  cin >> n;

  int mn = 60;
  for (int i = 0; i < n; ++i) {
    int a;
    cin >> a;

    int score = 0;
    while (a % 2 == 0) {
      a /= 2;
      ++score;
    }

    mn = min(mn, score);
  }

  cout << mn << '\n';

  return (0);
}


Measured memory_bytes: 3584
#include<stdio.h>
#include<iostream>
#include<list>
#include<map>
#include<vector>
#include<algorithm>
#include<string.h>
#include<math.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) range(i,0,b)
#define debug(x) cout << x << endl;
using namespace std;

int main(){
    double xa, ya, xb, yb, xc, yc, xd, yd;
    while(cin >> xa >> ya >> xb >> yb >> xc >> yc >> xd >> yd){
        if( fabs((yb - ya) * (yd - yc) + (xb - xa) * (xd - xc)) < 1e-10){
            cout << "YES" << endl;
        }else{
            cout << "NO" << endl;
        }
    }
}

Measured memory_bytes: 1216
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int A[15],n,m,q,a[55],b[55],c[55],d[55],ans;
int main()   
{
   cin>>n>>m>>q;
   for(int i=1;i<=q;i++)
   {
   	  cin>>a[i]>>b[i]>>c[i]>>d[i];
   }
   for(int i=1;i<=n;i++)  A[i]=1;// 1  1 1 
   while(!A[0])//A[0]=0是标志位   不等于0时说明序列生成结束 
    {
    	int  res=0;
		for(int i=1;i<=q;i++)
		{
			if((A[b[i]]-A[a[i]])==c[i]) res+=d[i];
		 } 
    	ans=max(res,ans);
    	for(int i=n;i>=0;i--)
    	{
    		if(A[i]<m)
    		{
    			A[i]++;
    			for(int j=i+1;j<=n;j++)A[j]=A[i];
    			break;
			}
		}
	   }   
   cout<<ans;

return 0;
}


Measured memory_bytes: 3632
f=->n,m,a,b{s=a/m*n*~-n/2+b/m*n
a%=m
y=(a*n+b%=m)/m
x=y*m-b
y>0&&s+=f[y,a,m,-x%a]+y*=n+-x/a
s}
$<.map{n,m,a,b=_1.split.map &:to_i
b&&p(f[n,m,a,b])}

Measured memory_bytes: 14980
def f(s,a):
    ans=0
    for i in range(len(s)):
        if i%2==0:
            if s[i]!=a:
                ans+=1
        else:
            if s[i]==a:
                ans+=1
    return ans


s=list(input())
print(min(f(s,'0'),f(s,'1')))

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

int main()
{
  	int n;
  	cin>>n;
  	int a[n];
  	for(int i = 0; i < n; i++)
      	cin>>a[i];
  	sort(a, a+n);
  	cout<<a[n-1]-a[0];
	return 0;
}

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

#define int long long

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

#define INF (3e9)

using namespace std;

int N;

int A[301][301];

signed main()
{
    cin >> N;
    REP(i, N) REP(j, N) cin >> A[i][j];

    int ans = 0;
    REP(i, N)
    for (int j = i+1; j < N; ++j)
    {
        int e = INF;
        REP(k, N)
        {
            if (k == i || k == j) continue;
            e = min(e, A[i][k] + A[k][j]);
        }
        if (A[i][j] < e)
        {
            ans += A[i][j];
        }
        else if (A[i][j] > e)
        {
            cout << -1 << endl;
            return 0;
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 896
def counter(x):
    if x == 0:
        return 0
    return counter(x >> 1) + (x & 1)


N = int(input())
A = [0 for i in range(20)]
x = [[0 for i in range(20)] for j in range(20)]
y = [[0 for i in range(20)] for j in range(20)]

for i in range(1, N + 1):
    A[i] = int(input())
    for j in range(1, A[i] + 1):
        x[i][j], y[i][j] = list(map(int, input().split()))

# 2^N 通りをbit全探索
# kが正直者 = 2進数表記のk-1桁目が1 (1 <= k <= N)
ans = 0
for bits in range(1, 1 << N):
    ok = True
    for i in range(1, N + 1):
        # 不親切な人の意見は無視
        if not (bits & (1 << (i - 1))):
            continue
        for j in range(1, A[i] + 1):
            # x_ij が正直者であることが偽であれば False
            if ((bits >> (x[i][j] - 1)) & 1) ^ y[i][j]:
                ok = False
    if ok:
        ans = max(ans, counter(bits))

print(ans)


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

int N;
int K;
long long A[210000];

int main(void){

    cin >> N >> K;
    for (int i = 1; i <= N;i++) cin >> A[i];

    int ansline = N - K;
    bool ans[ansline + 1];
    ans [0] = true;

    for (int i = 1; i <= ansline;i++){
        if (A[i] < A[K+i]) ans[i] = true;
        else ans[i] = false;
    }

    for (int i = 1;i <= ansline;i++){
        if (ans[i]) cout << "Yes" << endl;
        else cout << "No" << endl;
    }

    return 0;
}


Measured memory_bytes: 5344
# -*- coding: utf-8 -*-
#D - Even Relation
import sys 
from heapq import heappush, heappop
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N = int(readline())

edges = [[] for _ in range(N+1)]
INF = 10**31
dist = [INF]*(N+1) #最短距離用
prev=[None]*(N+1) #最短経路用
for _ in range(N-1):
  x,y,t = map(int, readline().split())
  edges[x].append((y,t))
  edges[y].append((x,t))
  
q = [(0,1)]
dist[1] = 0 #最短経路用
while q:
  cost, v = heappop(q)
  if dist[v] < cost:
    continue
  for vert,_cost in edges[v]:
    newcost = cost+_cost
    if newcost < dist[vert]:
      prev[vert] = v
      dist[vert] = newcost #最短経路用
      heappush(q,(newcost,vert))

for i in range(1,N+1):
    if dist[i] % 2 == 0:
        print(0)
    else:
        print(1)

Measured memory_bytes: 97824
#include "bits/stdc++.h"
	using namespace std;

bool iss(int a){
	double k = sqrt(a);          
	if((double)(floor(k) - k)!=0.0) return true;
	return false;
}

int main(){
	string a , b;
	cin>>a>>b;
	long ab=0;
	ab = stoi(a+b);
	if(!iss(ab)) cout<<"Yes\n";
	else cout<<"No\n";
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <string>
using namespace std;
int main(){
    int n; cin >> n;
    map<string, int> mp;
    int xnum = 0;
    for(int i = 0; i < n; i++){
        string s; cin >> s;
        mp[s]++;
        xnum = max(xnum,mp[s]);
    }
    for(auto& p:mp){
        if(p.second == xnum) cout << p.first << endl;
    }
    return 0;
}

Measured memory_bytes: 19208
def main():
    n = int(input())
    vs = [int(s) for s in input().split()]

    print(solve(vs))

def solve(vs):
    c1 = count(vs[0::2])
    c2 = count(vs[1::2])

    a1 = c1[0]
    a2 = c1[1] if len(c1) > 1 else (0, 0)
    b1 = c2[0]
    b2 = c2[1] if len(c2) > 1 else (0, 0)

    if a1[0] != b1[0]:
        return len(vs) - a1[1] - b1[1]

    if a1[1] + b2[1] > a2[1] + b1[1]:
        return len(vs) - a1[1] - b2[1]
    else:
        return len(vs) - a2[1] - b1[1]

def count(vs):
    c = dict()

    for v in vs:
        c[v] = c.get(v, 0) + 1

    cs = sorted(c.items(), key=lambda x: x[1], reverse=True)
    return cs

main()


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

int main(){
    int N; cin >> N;
    vector<string> v(N);
    int Q = 20;
    cout << 0 << endl;
    cin >> v[0];
    if(v[0]=="Vacant") return 0;
    Q--;
    int high = N;
    int low = 0;
    int mid;
    while(Q--) {
        mid = (high + low) / 2;
        cout << mid << endl;
        cin >> v[mid];
        if(v[mid]=="Vacant") return 0;
        if((v[low]==v[mid]&&(mid-low)%2==0)||(v[low]!=v[mid]&&(mid-low)%2!=0)) low = mid;
        else high = mid; 
    }
    return 0;
}

Measured memory_bytes: 1620
#include <iostream>
#include <string>
#include <stack>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <map>
#include <set>
#include <queue>
#include <list>
using namespace std;
using pii  = pair<int,int>;
using ll=long long;
using ld=long double;
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)
#define REP(i,a,b) for(int i=(a);i<(b);++i)
#define crep(i) for(char i='a';i<='z';++i)
#define psortsecond(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.second<b.second;});
#define All(x) (x).begin(),(x).end()
#define endl '\n'
int ctoi(const char c){
  if('0' <= c && c <= '9') return (c-'0');
  return -1;
}
long long gcd(long long a, long long b){return (b == 0 ? a : gcd(b, a%b));}
long long lcm(long long a, long long b){return a*b/gcd(a,b);}
constexpr ll MOD=1000000007;
constexpr ld EPS=10e-8;
template<typename T> istream& operator>>(istream& is,vector<T>& v){for(auto&& x:v)is >> x;return is;}
template<typename T,typename U> istream& operator>>(istream& is, pair<T,U>& p){ is >> p.first; is >> p.second; return is;}
template<typename T,typename U> ostream& operator>>(ostream& os, const pair<T,U>& p){ os << p.first << ' ' << p.second; return os;}



int main() {
    ll N;
    pair<ll,ll> P[100007];
    cin >> N;
    rep(i,N){
        cin >> P[i].first;
        P[i].second=i+1;
    }
    sort(P,P+N);
    rep(i,N){
        cout << P[i].second;
        if(i!=N-1){
            cout << " ";
        }
    }
    cout << endl;
}

Measured memory_bytes: 2432
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#define MOD 1000000007
typedef long long ll;
using namespace std;

typedef vector<ll> vec;//ll?
typedef vector<vec> mat;

mat mul(mat &A,mat &B){
  mat C(A.size(),vec(B[0].size()));
  for(int i=0;i<A.size();i++){
    for(int k=0;k<B.size();k++){
      for(int j=0;j<B[0].size();j++){
        C[i][j]=(C[i][j]+A[i][k]*B[k][j]%MOD)%MOD;
      }
    }
  }
  return C;
}

mat pow(mat A,ll n){
  mat B(A.size(),vec(A.size()));
  for(int i=0;i<A.size();i++){
    B[i][i]=1;
  }
  while(n>0){
    if(n&1) B=mul(B,A);
    A=mul(A,A);
    n=(n>>1);
  }
  return B;
}


int main(){
  ll n,k;
  cin>>n>>k;

  mat A(n,vec(n));

  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
      int a;
      cin>>a;
      if(a) A[i][j]=1;
      else A[i][j]=0;
    }
  }

  A=pow(A,k);
  ll ans=0;
  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
      ans=(ans+A[i][j])%MOD;
    }
  }
  cout<<ans<<endl;

  return 0;
}


Measured memory_bytes: 384
from operator import itemgetter
n,m = map(int,input().split())
a_list = list(map(int,input().split()))
b_list = []
for i in range(m):
	b,c = map(int,input().split()) 
	b_list.append([b,c]) #b_list[i][枚数、value]

a_list.sort()
b_list.sort(reverse = True,key = itemgetter(1)) #cについてソート
sum_list = []
now_position = 0
j = 0
for i in range(m):
	if (now_position + b_list[i][0] <= len(a_list)) and a_list[now_position + b_list[i][0]-1] < b_list[i][1]:
		sum_list.append(b_list[i][1]*b_list[i][0])
		now_position += b_list[i][0] 
	else:
		for j in range(b_list[i][0]):
			if (now_position + j < len(a_list)) and a_list[now_position + j] < b_list[i][1]:
				sum_list.append(b_list[i][1])

			else:
				break
		break
if (now_position + j <= len(a_list)-1):
	print(sum(sum_list)+sum(a_list[now_position+j:]))
else:
	print(sum(sum_list))

Measured memory_bytes: 80536
#include <iostream>
#include <string>
#include <vector>
#include <climits>
#include <cmath>
#include <algorithm>

using namespace std;

int main() {
	int N, L;
	cin >> N >> L;

	int i;
	int sum_taste = 0;
	vector<int> taste(N);
	for (i = 0; i < N; i++) {
		taste[i] = L + i;
		sum_taste += taste[i];
	}

	int tmp = INT_MAX;
	int ans;
	for (int i = 0; i < N; i++) {
		if (tmp > abs(taste[i])) {
			ans = taste[i];
			tmp = abs(taste[i]);
		}
	}
	cout << sum_taste - ans << endl;
}

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

int main()
{
	int sum = 0;
	long long n, m,tem;
	scanf("%lld", &n);
	tem = n;
	while(n != 0) {
		m = n % 10;
		sum = sum + m;
		n = n / 10;
	}
	if(tem % sum == 0) printf("Yes\n");
	else printf("No\n");
}

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

#define int long long
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rep1(i,n) for(int i=1;i<=(int)(n);++i)
#define rep11(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define repm(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define pb(n) push_back(n)
#define mp make_pair
#define MOD 1002000007
#define INF LONG_LONG_MAX

int n,d,a,now,ans;
vector<pair<int,int>> v;
queue<pair<int,int>> que;

signed main() {
    cin >> n >> d >> a;d*=2;
    rep(i,n) {
        int x,h;
        cin >> x >> h;
        v.pb(mp(x,h));
    }
    sort(all(v));
    for(auto i : v) {
        while(que.size() && que.front().fi < i.fi) {
            now -= que.front().se;
            que.pop();
        }
        if (i.se <= now) continue;
        int cnt = (i.se-now+a-1)/a;
        que.push(mp(i.fi+d, cnt*a));
        now += cnt*a;
        ans += cnt;
    }
    cout << ans << endl;
}



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

int main(){
  int n;cin>>n;
  string s;cin>>s;
  int cnt=1;
  for(int i=1;i<n;i++){
    if(s[i]!=s[i-1])++cnt;
  }
  cout<<cnt<<endl;
  return 0;
}

Measured memory_bytes: 512
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc=new Scanner(System.in);

		double a=sc.nextDouble();
		double b=sc.nextDouble();
		
		BigDecimal a1 = new BigDecimal(String.valueOf(a));	//BigDecimalに変換
		BigDecimal b1 = new BigDecimal(String.valueOf(b));
		
		BigDecimal c= a1.multiply(b1);		//掛け算
		BigDecimal value =c.setScale(0, RoundingMode.DOWN);	//小数点切り捨て
		
		long l = value.longValueExact();	//long型に格納、小数の末尾を0に
		
		System.out.println(l);	
	}

}


Measured memory_bytes: 29000
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
#define in read()
#define re register
#define fur(i,a,b) for(re int i=a;i<=b;++i)
#define fdr(i,a,b) for(re int i=a;i>=b;--i)
#define cl(a,b) memset(a,b,sizeof(a))
#define jinitaimei signed
#define int long long
inline int read()
{
	int x=0;
	char ch=getchar();
	for(;!isalnum(ch);ch=getchar());
	for(;isalnum(ch);ch=getchar()) x=x*10+ch-'0';
	return x;
}
const int mod=1e9+7,xx=5e5+1;
inline int power(int b,int k)
{
	int res=1;
	for(;k;k>>=1,b=b*b%mod) if(k&1) res=res*b%mod;
	return res;
}
int jc[xx],ny[xx];
inline int C(int m,int n)
{
	if(!m) return 1;
	return jc[n]*ny[m]%mod*ny[n-m]%mod;
}
jinitaimei main()
{
	jc[0]=1;
	ny[0]=1;
	int H=in,W=in;
	fur(i,1,H+W) jc[i]=jc[i-1]*i%mod,ny[i]=power(jc[i],mod-2);
	int A=in,B=in,ans=0;
	A=H-A+1;
	int up=min(A-1,W-B);
	fur(k,1,up)
	{
		int x=A-k,y=B+k;
		int tmp=C(x-1,x+y-2)*C(H-x,W-x+H-y)%mod;
		(ans+=tmp)%=mod;
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 5888
#include <cstdio>
#include <algorithm>
#include <vector>

using namespace std;

int main(void)
{

    while(1){
        int h, w;
        scanf(" %d %d", &h, &w);
        if(h == 0 && w == 0)
            break;
        const int k = h * h + w * w;
        bool ch = false;
        bool ch1 = true;
        int ansh = 1000000000, answ = 1000000000;
        int min_taikaku = 1000000000;
        for(int i = 1; i <= 150; i++){
            for(int j = i + 1; j <= 150; j++){
                if(i == h & j == w)
                    continue;
                int taikaku = i * i  + j * j;
                if(k < taikaku && taikaku < min_taikaku && !ch){
                    //printf("%d %d %d %d %d \n", k, min_taikaku, taikaku, i , j);
                    min_taikaku = taikaku;
                    ansh = i;
                    answ = j;
                } else if(taikaku == k && h < i){
                    ch = true;
                    if(ch1){
                        ansh = 100000000;
                        ch1 = false;
                    }
                    //printf("%d %d %d %d %d \n", k, min_taikaku, taikaku, i , j);
                    if(h < i && i <= ansh){
                        min_taikaku = k;
                        ansh = i;
                        answ = j;
                    }
                }
            }
        }
        printf("%d %d\n", ansh, answ);
    }

    return 0;
}

Measured memory_bytes: 1028
#include<bits/stdc++.h>
using namespace std ;
#define ll long long
#define ld long double
#define ff first
#define ss second
const ll mod =   1e9 +7  ;
ll multiply(ll a, ll b ){ return ((a % mod) * (b % mod)) % mod; }
ll add(ll a, ll b) {     return ((a % mod) + (b % mod)) % mod; }
ll sub(ll a, ll b) { return ((a%mod) - (b % mod)+ mod) % mod ; }
////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////
void solve(){
    int x , n ;
    cin >> x >> n ;
    vector < int > a(n) ;
    map < int , int > mp ;
    for( int i = 0 ; i < n ; i++) cin >> a[i] , mp[a[i]]++;
    int diff = 100000 , ans = 100000 ;
    for(int i = -200 ; i <= 200 ; i++){
        if(mp.find(i)==mp.end()){
            if(diff > abs(x-i)){
                diff = abs(x-i);
                ans = i;
            }
            else if(diff==abs(x-i)){
                ans = min(i,ans);
            }
        }
    }
    cout << ans ;
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int t = 1 ;
    //cin >> t ;
    int case1 = 1 ;
    while(t--){
        //cout << "Case #" << case1 << ": " ;
        case1++;
        solve( );
    }
}
//


Measured memory_bytes: 3648
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
	Scanner scan = new Scanner(System.in);

	int a = scan.nextInt();
	int b = scan.nextInt();

	int p = a+b;
	int m = a-b;
	int t = a*b;

	System.out.println(Math.max(Math.max(p,m),t));
    }
}


Measured memory_bytes: 22740
from collections import deque

d = deque()
q = int(input())
key = 0
for i in range(q):
    x, *y = map(int,input().split())
    if x == 0:
        d.append(y[0])
    elif x == 1:
        d.rotate(y[0])
        key -= y[0]
    else:
        d.pop()
d.rotate(key)
d.reverse()
for i in d:
    print(i)


Measured memory_bytes: 21672
/*{{{*/
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<string>
#include<iostream>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include<bitset>
#include<vector>
#include<limits.h>
#include<assert.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define FOR(I, A, B) for (int I = (A); I <= (B); ++I)
#define FORS(I, S) for (int I = 0; S[I]; ++I)
#define RS(X) scanf("%s", (X))
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<PII> VPII;
typedef pair<LL,LL> PLL;
typedef vector<PLL> VPLL;
template<class T> void _R(T &x) { cin >> x; }
void _R(int &x) { scanf("%d", &x); }
void _R(LL &x) { scanf("%lld", &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template<class T, class... U> void R(T &head, U &... tail) { _R(head); R(tail...); }
template<class T> void _W(const T &x) { cout << x; }
void _W(const int &x) { printf("%d", x); }
void _W(const LL &x) { printf("%lld", x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template<class T,class U> void _W(const pair<T,U> &x) {_W(x.F); putchar(' '); _W(x.S);}
template<class T> void _W(const vector<T> &x) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W(const T &head, const U &... tail) { _W(head); putchar(sizeof...(tail) ? ' ' : '\n'); W(tail...); }
#ifdef HOME
 #define DEBUG(...) {printf("# ");printf(__VA_ARGS__);puts("");}
#else
 #define DEBUG(...)
#endif
int MOD = 1e9+7;
void ADD(LL& x,LL v){x=(x+v)%MOD;if(x<0)x+=MOD;}
/*}}}*/
const int SIZE = 1e6+10;
int main(){
    int N;
    R(N);
    VI d;
    LL an=0;
    int neg=0;
    REP(i,N){
        int x; R(x);
        d.PB(abs(x));
        an+=abs(x);
        if(x<0)neg++;
    }
    sort(ALL(d));
    if(neg&1)an-=d[0]*2;
    W(an);
    return 0;
}


Measured memory_bytes: 892
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
int pal(string x)
{
    int i,n=x.length();
    for(i=0;i<n/2;++i)
    {
        if(x[i]!=x[n-1-i])
            return 0;
    }
    if(i==n/2)
        return 1;
}
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(nullptr);
    cout.tie(nullptr);
    string a,b="",c="";
    cin>>a;
    int i,n=a.length();
    for(i=0;i<(n-1)/2;++i)
        b+=a[i];
    for(i=((n+3)/2)-1;i<n;++i)
        c+=a[i];
    if(pal(a)&&pal(b)&&pal(c))
        cout<<"Yes";
    else
        cout<<"No";
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A, B;
  cin >> A >> B;
  if (A > 12) {
    cout << B << endl;
  }
  else if (A > 5) {
    cout << B/2 << endl;
  }
  else {
    cout << 0 << endl;
  }
  return 0;
}

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

long long nn, i, j;

main(){
		cin>>nn;
		for(i=1; i<=3500; i++)
			for(j=1; j<=3500; j++){
				long long a = nn*i*j;
				long long b = 4*i*j - nn*j - nn*i;
				if (b==0) continue;
				if (a%b == 0 && a/b>0){
					cout<<i<<" "<<j<<" "<<a/b;
					return 0;
				}
			}
}


Measured memory_bytes: 256
<?php
fscanf(STDIN, '%d', $n);
fscanf(STDIN, '%s', $s);
$ans = 0;
for($i = 0; $i < $n - 2; $i++) {
    $ans += ($s[$i].$s[$i + 1].$s[$i + 2] == 'ABC') ? 1 : 0;
}
echo $ans, PHP_EOL;

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

int index(int numToFind, std::vector<int> vectorToFindIn) {int len = vectorToFindIn.size();for (int i = 0; i < len; i++){if (vectorToFindIn[i] == numToFind){return i;}}return -1;}

int main()
{
  ios_base::sync_with_stdio(0); cin.tie(0);
  int n,i,big,big2;
  cin>>n;
  int a[n];
  big=0;
  big2=0;
  for (i=0;i<n;i++)
  {
  	cin>>a[i];
  	if (a[i] >= big)
  	{
  		big2=big;
  		big=a[i];
  	}
  	else if (a[i]>big2)
  	{
  		big2=a[i];
  	}
  }
  //cout<<big<<" "<<big2<<"\n";
  for (i=0;i<n;i++)
  {
  	if (a[i]==big)
  	{
  		cout<<big2<<"\n";
  	}
  	else
  	{
  		cout<<big<<"\n";
  	}
  }
  return 0;
}

Measured memory_bytes: 2432
import java.util.*;
import java.io.*;

class Main {
    static class Node {
        String a;
        String b;
        Node(String a, String b) {
            this.a = a;
            this.b = b;
        }
    }
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        String S = sc.next();
        ArrayList<Node> l = new ArrayList<>();
        HashMap<String,HashMap<String,Long>> m = new HashMap<>();
        for(int i = 0; i < (1 << N); i++) {
            String s1 = "";
            String s2 = "";
            for(int j = 0; j < N; j++) {
                if((i & (1 << j)) > 0) {
                    s1 += S.substring(j,j+1);
                } else {
                    s2 = S.substring(j,j+1) + s2;
                }
            }
            l.add(new Node(s1,s2));
        }
        for(int i = 0; i < (1 << N); i++) {
            String s1 = "";
            String s2 = "";
            for(int j = 0; j < N; j++) {
                if((i & (1 << j)) > 0) {
                    s1 += S.substring(j + N,j+1 + N);
                } else {
                    s2 = S.substring(j + N,j+1 + N) + s2;
                }
            }
            if(m.containsKey(s1)) {
                HashMap<String,Long> mm = m.get(s1);
                if(mm.containsKey(s2)) {
                    mm.put(s2, mm.get(s2) + 1L);
                } else {
                    mm.put(s2, 1L);
                }
            } else {
                HashMap<String,Long> mm = new HashMap<>();
                mm.put(s2,1L);
                m.put(s1, mm);
            }
        }

        long ans = 0;

        for(int i = 0; i < l.size(); i++) {
            String s1l = l.get(i).a;
            String s2l = l.get(i).b;
            if(m.containsKey(s2l)) {
                HashMap<String,Long> mm = m.get(s2l);
                if(mm.containsKey(s1l)) {
                    ans += mm.get(s1l);
                }
            }

        }

        System.out.println(ans);
        
    }
}

Measured memory_bytes: 447608
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;


public class Main {
	private	static	BufferedReader	br = null;

	static {
		br = new BufferedReader(new InputStreamReader(System.in));
	}

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		int	nMax = getNum();

		for (int n = 0; n < nMax; n++) {
			double[]	aCir = getCircle();
			double		dDst = Math.sqrt((aCir[0] - aCir[3]) * (aCir[0] - aCir[3]) + (aCir[1] - aCir[4]) * (aCir[1] - aCir[4]));

			if (dDst > aCir[2] + aCir[5]) {
				System.out.println(0);
			}
			else if (dDst < (aCir[2] - aCir[5]) && aCir[2] > aCir[5]) {
				System.out.println(2);
			}
			else if (dDst < (aCir[5] - aCir[2]) && aCir[5] > aCir[2]) {
				System.out.println(-2);
			}
			else {
				System.out.println(1);
			}
		}
	}

	private static int getNum() {
		return Integer.parseInt(parseStdin());
	}

	private static double[] getCircle() {
		String[]	aPrm = parseStdin().split(" ");
		double[]	aCir = {
			Double.parseDouble(aPrm[0]),
			Double.parseDouble(aPrm[1]),
			Double.parseDouble(aPrm[2]),
			Double.parseDouble(aPrm[3]),
			Double.parseDouble(aPrm[4]),
			Double.parseDouble(aPrm[5])
		};

		return aCir;
	}

	private static String parseStdin() {
		String	strNum = "";

		try {
			String line = br.readLine();
			if (line != null) {
				if (!line.isEmpty()) {
					strNum = line;
				}
			}
		}
		catch (IOException e) {}

		return strNum;
	}
}

Measured memory_bytes: 17092
#include <bits/stdc++.h>
#define all(x) begin(x), end(x)
#define sz(x) int(x.size())
#define pb push_back

using namespace std;
#define int long long
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const int MOD = 1e9 + 7;
const int N = 2e5 + 5;

int32_t main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n; cin >> n;
	vector<int> ans(n+2, 0);
	for (int i = 0; i < n-1; ++i) {
		int x; cin >> x;
		++ans[x];
	}
	for (int i = 1; i <= n; ++i)
		cout << ans[i] << '\n';
}

Measured memory_bytes: 4764
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#include <bits/stdc++.h>
using namespace std;
typedef long long int lld;

const lld N = 200043;
const lld MOD = 1000000007;

lld add(lld x, lld y)
{
    x =((x%MOD)+(y%MOD))%MOD;
    while(x >= MOD) x -= MOD;
    while(x < 0) x += MOD;
    return x;
}

lld mul(lld x, lld y)
{
    return ((x%MOD)*(y%MOD))% MOD;
}

lld binpow(lld x, lld y)
{
    lld z = 1;
    while(y)
    {
        if(y & 1) z = mul(z, x);
        x = mul(x, x);
        y >>= 1;
    }
    return z;
}

lld inv(lld x)
{
    return binpow(x, MOD - 2);
}

lld divide(lld x, lld y)
{
    return mul(x, inv(y));
}

// Combinations

/*
lld fact[N];

void precalc()
{
    fact[0] = 1;
    for(lld i = 1; i < N; i++)
        fact[i] = mul(fact[i - 1], i);
}

lld C(lld n, lld k)
{
    return divide(fact[n], mul(fact[k], fact[n - k]));
}
*/
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    lld t,i,j;
    //cin>>t;
    t=1;
    while(t--)
    {   lld n;
        cin>>n;
        lld ar[n];
        lld br[n];
        for(i=0;i<n;i++)
            cin>>ar[i]>>br[i];
        for(i=0;i<=n-3;i++)
        {
            if((ar[i]==br[i])&&(ar[i+1]==br[i+1])&&(ar[i+2]==br[i+2]))
            {
                cout<<"Yes"<<endl;
                return 0;
            }
        }
        cout<<"No"<<endl;
    }
}





Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
int n,p;
long long m,v,a[100100],qzh[100100];
int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cin>>n>>m>>v>>p;
	v=n-v;
	for(int i=1;i<=n;i++){
		cin>>a[i];
		a[i]=10-a[i];
	}
	sort(a+1,a+n+1);
	for(int i=1;i<=n;i++)
		qzh[i]=qzh[i-1]+a[i];
	for(int i=p+1;i<=n;i++){
		if(a[i]-a[p]>m){
			cout<<i-1<<endl;
			return 0; 
		}
		long long he=qzh[i-1]-qzh[p-1];
		he=a[i]*(i-p)-he;
		if(he>1LL*m*v){
			cout<<i-1<<endl;
			return 0;
		}
	}
	cout<<n<<endl;
	return 0;
}


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

string res(int n) {
    if(n == 0) return "pairwise coprime";
    else if(n == 1) return "setwise coprime";
    else return "not coprime";
}

const int M = 1e6 + 5;

int main() {
    int N; cin >> N;
    vector<int> A(N), B(M);
    for(auto &e : A) {
        cin >> e;
        B[e]++;
    }

    int64_t G = 0;
    rep(i, N) G = gcd(G, A[i]);
    if(G != 1) {
        cout << res(2) << '\n';
        return 0;
    }

    for(int i = 2; i < M; ++i) {
        int cnt = 0;
        for(int j = i; j < M; j += i) {
            cnt += B[j];
        }
        if(cnt > 1) {
            cout << res(1) << '\n';
            return 0;
        }
    }
    cout << res(0) << '\n';
    return 0;
}


Measured memory_bytes: 11152
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repR(i, n) for(int i = (n) - 1; i > -1; i--)
#define rep1(i, n) for(int i = 1; i < (int)(n + 1); i++)
#define rep1R(i, n) for(int i = (n); i > 0; i--)
typedef long long ll;
typedef unsigned long long ull;
using namespace std;

int main() {
  int N, A, B;
  cin >> N;
  if (N == 1) {
    cout << "Hello World" << endl;
    return 0;
  }
  cin >> A >> B;
  cout << A + B << endl;
  return 0;
}

Measured memory_bytes: 256
S = input()
T = input()
Ans = len(T)
for i in range(len(S)-len(T)+1):
    d = 0
    for j in range(len(T)):
        if T[j] != S[i:i+len(T)][j]:
            d += 1
    if d <= Ans:
        Ans = d

print(Ans)

Measured memory_bytes: 8980