akhauriyash/Code-Regression huggingface dataset:
//  Created by conan1024hao in 2019.
//  Copyright © 2019 conan1024hao. All rights reserved.
//  専用ライブラリです、自由にコピーして構いません。
//  感谢看我的代码！Wechat:conan1024hao QQ:810396815
#pragma GCC optimize ("O3")
#include <iostream>
#include <iomanip>
#include <istream>
#include <ostream>
#include <sstream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <utility>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <ctime>
#include <cctype>
#include <cstdlib>
#define INF 10e16
#define MOD 1000000007
#define  mod 998244353
#define rep(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define mmax(x,y)(x>y?x:y)
#define mmin(x,y)(x<y?x:y)
#define chmax(x,y) x=mmax(x,y)
#define chmin(x,y) x=mmin(x,y)
#define all(x) (x).begin(),(x).end()
#define siz(x) (ll)(x).size()
#define PI acos(-1.0)
using namespace std;
//using Int=int_fast64_t;
typedef long long int ll;
typedef pair<ll,ll>Pll;
typedef pair<int,int>Pin;
long long GCD(long long a, long long b) { return b ? GCD(b, a%b) : a; }
long long LCM(long long a, long long b)  {return a/GCD(a,b)*b;}
int dx[8]={-1,0,1,0};
int dy[8]={0,-1,0,1};
char dir[4]={'u','l','d','r'};
ll cmp1(pair<ll,string>a,pair<ll,string> b){
        if(a.fi!=b.fi)
        return a.fi<b.fi;
        else
        return a.se<b.se;
}
//--------------------------------------------------------------------------

//---------------------------------------------------------------------------
int main(){//問題をちゃんと見ろ!!!!!!!!!!!!!!!!!      llか??????????        memset()!!!!!!!!!!!!       ペナを減らせ!!!!!!!!!!!!!
    cin.tie(0);
    ios::sync_with_stdio(false);
    //-------------------------------
    int n;cin>>n;
    vector<char>s(n);
    map<int,int>m;
    for(int i=0;i<n;i++){
        cin>>s[i];
        if(s[i]=='P')
            m[0]++;
        else if(s[i]=='W')
            m[1]++;
        else if(s[i]=='G')
            m[2]++;
        else if(s[i]=='Y')
            m[3]++;
    }
    int cnt=0;
    for(int i=0;i<=3;i++){
        if(m[i])
            cnt++;
    }
       if(cnt==3)
           cout<<"Three"<<endl;
    else
        cout<<"Four"<<endl;
    //-------------------------------
    return 0;
}
//---------------------------------------------------------------------------






Measured memory_bytes: 256
#include <cstdio>
#include <cctype>
#define int long long
#define il inline
#define rgi register long long
#define sp putchar(' ')
#define el putchar('\n')
using namespace std;
il int ri()
{
	register int o1=0;
	register bool o2=0;
	register char o3;
	while(!isdigit(o3=getchar()))
		o2|=o3=='-';
	while(isdigit(o3))
		o1=(o1<<1)+(o1<<3)+(o3^48),o3=getchar();
	return o2?-o1:o1;
}
il void wi(int o1)
{
	if(o1<0)
		putchar('-'),o1=-o1;
	rgi o2=o1/10;
	if(o2)
		wi(o2);
	putchar((o1-(o2<<1)-(o2<<3))^48);
}
int a,b,c;
il int gcd(int p,int q)
{
	if(q==0)
		return p;
	return gcd(q,p%q);
}
il int divide(int n)
{
	int ret=0;
	for(rgi i=2;i*i<=n;++i)
		if(n%i==0)
		{
			++ret;
			while(n%i==0)
				n/=i;
		}
	if(n>1)
		++ret;
	return ret+1;
}
signed main()
{
	a=ri(),b=ri();
	c=gcd(a,b);
	int ans=divide(c);
	wi(ans);
	return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <ostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <queue>

using namespace std;

int main()
{
    int a, b;

    cin >> a >> b;

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
	string s;
	cin>>s;
	int q=0,l=s.length();
	while(q<l){
		if(s[q]=='C'){
		break;
	}
		q++;
	} 
	while(q<l){
		if(s[q]=='F'){
    	cout<<"Yes"<<endl;
    	return 0;
	}
	q++;
}
	cout<<"No"<<endl;
	return 0;
}

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

using namespace std;

int main(void) {
    int N;
    cin >> N;
    vector<double> x(N), y(N);
    for(int i=0; i<N; i++) {
        cin >> x[i] >> y[i];
    }

    double sum = 0.0;
    for(int i=0; i<N; i++) {
        for(int j=i+1; j<N; j++) {
            sum += hypot(x[i]-x[j], y[i]-y[j]);
        }
    }

    printf("%.10lf\n", sum*2.0/N);
    return 0;
}


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

#define ll long long
#define M 1000000007
#define deb(x) cout<<#x<<" "<<x<<endl;
#define foi(a,b) for(int i=a;i<b;i++)
#define foj(a,b) for(int j=a;j<b;j++)
#define fod(a,b) for(int i=a;i>b;i--)
#define MAX  1e9
#define MIN -1e9
#define nl cout<<"\n";
#define show(arr,a,b) for(int i=a;i<b;i++) cout<<arr[i]<<" "; cout<<endl;
#define  mp(a,b) pair<ll,ll> p(a,b)
#define pb push_back
typedef pair<ll,ll> p1;
typedef vector<ll> vecd;
typedef vector<string> vecsd;
typedef map<ll,ll> mpd;
typedef set<ll> setd;
typedef multiset<ll> msetd;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string s; cin>>s;
    if(s[2]==s[3] && s[4]==s[5]) cout<<"Yes\n";
    else cout<<"No\n";
    return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		
		int a = scanner.nextInt();
		int b = scanner.nextInt();
		int c = scanner.nextInt();
		int count = 0;
		
		do{
			if(c % a == 0){
				count++;
			}
			a++;
		}while(a != b+1);
		System.out.println(count);
		
		scanner.close();
	}
		
}

Measured memory_bytes: 26372
#include<bits/stdc++.h>
using namespace std;
#define pi pair<ll,ll>
#define pb push_back
#define ll long long
vector<pi>adj[100009];
ll col[100009];
bool vis[100009];
ll dis[100009];
void bfs(ll node,ll n)
{
    queue<ll>q;
    vis[node]=1;
    col[node]=0;
    q.push(node);
    while(!q.empty())
    {
        ll top=q.front();
        q.pop();
        for(ll i=0;i<adj[top].size();i++)
        {
            ll chi=adj[top][i].first;
            ll cost=adj[top][i].second;
            if(vis[chi]==0)
            {
                vis[chi]=1;
                dis[chi]=dis[top]+cost;
                col[chi]=dis[chi]%2;
                q.push(chi);
//                cout<<"pushed "<<chi<<" dis "<<dis[chi]<<endl;
            }
        }
    }
}
void dfs(ll node,ll ds)
{
    vis[node]=1;
    col[node]=ds%2;
    for(int i=0;i<adj[node].size();i++)
    {
        int chi=adj[node][i].first;
        int cost=adj[node][i].second;
        if(vis[chi]==0)
        {
            dfs(chi,ds+cost);
        }
    }
}
int main()
{
    ll n;cin>>n;
    for(ll i=0;i<n-1;i++)
    {
        ll u,v,w;
        cin>>u>>v>>w;
        adj[u].pb({v,w});
        adj[v].pb({u,w});
    }
//    bfs(1,n);
//    cout<<col[1];
//    for(ll i=2;i<=n;i++)cout<<" "<<col[i];
//    cout<<endl;
//    memset(vis,0,sizeof vis);
//    memset(col,0,sizeof col);
    dfs(1,0);
    cout<<col[1];
    for(ll i=2;i<=n;i++)cout<<" "<<col[i];
    cout<<endl;

}
/*
10
1 2 2
1 3 4
1 4 3
2 5 5
2 6 7
3 7 6
3 8 1
7 9 4
9 10 10
*/


Measured memory_bytes: 10240
R=range;(N,A),(*X,)=(map(int,input().split())for _ in R(2));C=[51*N*[0]for _ in R(N+1)];C[0][0]=1
for I in R(N):
	for J in R(N)[::-1]:
		for K in R(50*N)[::-1]:
			if C[J][K]:C[J+1][K+X[I]]+=C[J][K]
print(sum(C[I][I*A]for I in R(1,N+1)))


Measured memory_bytes: 42092
#include <iostream>
using namespace std;
int main(void){
    int n,k;
    cin>>n>>k;
    if(k==1||k==2*n-1){cout<<"No"<<endl;return 0;}
    else cout<<"Yes"<<endl;
    for(int i=0;i<2*n-1;i++){
        cout<<(k+n+i-1)%(2*n-1)+1<<endl;
    }
}


Measured memory_bytes: 1536
import java.util.Scanner;

public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Scanner cin =new Scanner(System.in);
		String[] s = new String[120];
		int count=0;
		while(cin.hasNext()){
			s[count++]=cin.next();
		}
		int[][][] a = new int[count+2][100][2];
		for(int i = 0;i<count+2;i++){
			for(int j = 0; j<100;j++){
				a[i][j][0]=-1;a[i][j][1]=0;
			}
		}
		for(int i = 1;i<=count;i++){
			String[] str = s[i-1].split(",");
			for(int j=1;j<str.length+1;j++){
				a[i][j][0]=a[i][j][1]=Integer.parseInt(str[j-1]);
			}
		}
		for(int i = 0;i<=count+1;i++){
			for(int j = 0;j <=count/2+2;j++){
				//System.out.print(a[i][j][0]);
			}
			//System.out.println();
		}
		int dx=-1;
		for(int i = 1;i<=count;i++){
			for(int j = 1;j<=count;j++){
				if(a[i][j][0]==-1){
					break;
				}
				a[i][j][1]=Math.max(a[i-1][j][1]+a[i][j][0], a[i-1][j+dx][1]+a[i][j][0]);
				//System.out.print(a[i][j][1]+" " );
			}
			if(i==count/2+1){
				dx=1;
			}
			//System.out.println();
		}
		System.out.println(a[count][1][1]);
	}
}

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


int main() {
  int N;
  cin >> N;
  
  vector<double> x(N);
  vector<string> u(N);
  for (int i=0; i<N; i++) {
    cin >> x[i] >> u[i];
  }
  
  double ans = 0;
  
  for (int i=0; i<N; i++) {
    if (u[i] == "JPY") {
      ans += x[i];
    } else {
      ans += x[i] * 380000.0;
    }
  }
  
  cout << ans << endl;
 
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pi acos(-1)
#define IOS ios_base::sync_with_stdio(0); cin.tie(); cout.tie();
#define fi first
#define se second
#define pf push_front
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define debug(x) cerr<<#x<<": "<<(x)<<'\n'
typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
const ll mod = 1e9 + 7;
const ll inf = 0x3f3f3f3f;
const ll nax = 0;

int main(){
  IOS
  int ans=0, x;
  cin >> x;
  int ba=0;
  while(1){
    if((ba%360==0) && ans>0){
      break;
    }
    ans++;
    ba=(ba+x)%360;
  }
  cout << ans << '\n';
}


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

using namespace std;

typedef long long ll;

ll inq(ll x, ll y, ll mod)
{
    if (y == 0) return 1 % mod;
    ll l = inq(x, y / 2, mod);
    if (y % 2) return l * l % mod * x % mod;
    return l * l % mod;
}

ll gcdex(ll a, ll b, ll &x, ll &y)
{
    // Solves the equation ax + by = gcd(a, b)
    // returns gcd(a, b)
    // save x and y in given values
    //
    // Correctness tested on random tests.
    //
    if (a == 0)
    {
        x = 0, y = 1;
        return b;
    }
    ll x1, y1;
    ll g = gcdex(b % a, a, x1, y1);
    x = y1 - (b / a) * x1;
    y = x1;
    return g;
}

pair<ll, ll> crt(vector<ll> r, vector<ll> m)
{
    // Finds such x, that x mod m[i] = r[i] for each i
    // if such x does not exist returns {0, 0}
    //
    // Correctness tested on random tests.
    //
    int n = r.size();
    for (int i = 0; i < n; i++) r[i] %= m[i];
    ll r0 = 0, m0 = 1;
    for (int i = 0; i < n; i++)
    {
        ll r1 = r[i], m1 = m[i];
        if (m0 < m1)
        {
            swap(m0, m1);
            swap(r0, r1);
        }
        if (m0 % m1 == 0)
        {
            if (r0 % m1 != r1) return {0, 0};
            continue;
        }
        ll x, y;
        ll g = gcdex(m0, m1, x, y);
        ll u = m1 / g;
        if ((r0 - r1) % g != 0)
            return {0, 0};
        ll z = (r1 - r0) / g % u * x % u;
        r0 += z * m0;
        m0 *= u;
        if (r0 < 0) r0 += m0;
    }
    return {r0, m0};
}

const int K = 1;

ll solve(ll a, ll m)
{
    if (m == 1) return K;
    ll phi = m;
    ll z = m;
    for (int i = 2; i * i <= z; i++)
    {
        if (z % i == 0)
        {
            phi /= i;
            phi *= (i - 1);
            while (z % i == 0)
            {
                z /= i;
            }
        }
    }
    if (z > 1)
    {
        phi = phi / z * (z - 1);
    }
    ll g = __gcd(m, phi);
    ll y = solve(a, g);
    vector<ll> R = {y, inq(a, y, m)};
    vector<ll> M = {phi, m};
    pair<ll, ll> ze = crt(R, M);
    while (ze.first < K) ze.first += ze.second;
    return ze.first;
}

int main()
{
    int q;
    cin >> q;
    while (q--)
    {
        ll a, m;
        cin >> a >> m;
        ll r = solve(a, m);
        cout << r << "\n";
    }
}


Measured memory_bytes: 3620
N=int(input())
H=list(map(int,input().split()))
cur=H[0]
streak=0
ans=0
for i in range(1,N):
  if H[i]<=cur:
    streak+=1
    if ans<streak:
      ans=streak
  else:
    streak=0
  cur=H[i]

print(ans)

Measured memory_bytes: 14252
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;

int main(){
    int n;
    cin >> n;
    map<string,int> m;
    for(int i=0;i<n;i++){
        string s;
        cin >> s;
        m[s]++;
    }
    cout << m.size() << endl;
}

Measured memory_bytes: 19224
#include <iostream>
#include <cstdio>
#include <vector>
#include <stack>
#include <math.h>
#include <queue>

using namespace std;

typedef long long int ll;
typedef long double ld;

#define rep(i,n) for(int i = 0; i < (n); ++i)
#define vsort(a) sort(a.begin(), a.end())
#define rev(a) reverse(a.begin(), a.end())

const int MOD = 1000000007;
const int INF = INT_MAX;


// a,bの最小公倍数
ll lcm(ll a, ll b){ll lcm = a * b; ll r = a % b;while(r != 0){a = b; b = r; r = a % b;}return lcm /= b;}
// a,bの最大公約数
ll gcd(ll a, ll b){ll r = a % b;while(r != 0){a = b; b = r; r = a % b;}return b;}
// MOD
ll modadd(ll a, ll b){return (a%MOD+b%MOD+MOD)%MOD;}
ll modmul(ll a, ll b){return a%MOD*b%MOD%MOD;}
ll modexp(ll a, ll n){if(n==0)return 1; if(n%2==0){ll e=modexp(a,n/2); return modmul(e,e);} return modexp(a,n-1)*a%MOD;}
ll modinv(ll n){return modexp(n%MOD,MOD-2);}
ll modfact(ll n){ll res=1; for (int i=1; i <= n; ++i){res *= i; res %= MOD;} return res;}
ll modncr(ll n, ll r){ll numer=1;ll denom=1;for(int i=1;i<=r;++i){numer=modmul(numer,n-r+i);denom=modmul(denom,i);}return modmul(numer, modinv(denom));}


int main(){


    int a, b, c;
    cin >> a >> b >> c;

    int sum = a + b + c;
    int mx = max(a, max(b, c));

    int ans;
    if ((sum - mx) % 2 == 0) {
        ans = (2 * mx - (sum - mx)) / 2;
    }
    else {
        ans = (2 * mx + 3 - (sum - mx)) / 2;
    }

    cout << ans << endl;


}



//              g++ -std=c++1z



Measured memory_bytes: 256
N,K = map(int,input().split())
R,S,P = map(int,input().split())
dicta = {'r':P,'s':R,'p':S}
T = input()
count = 0
 
for i in range(N):
    if i >= K:
        if T[i-K] == T[i]:
            T = T[:i] + 'z' + T[i+1:]
            
        else:
            count += dicta[T[i]]
    else:
        count += dicta[T[i]]
print(count)

Measured memory_bytes: 3448
#include<bits/stdc++.h>
using namespace std;
#define PI          acos(-1)
#define INF         100000000
#define sc(n)       scanf("%d",&n);
#define ssc(n)      scanf("%s",n);
#define lsc(n)      scanf("%lld",&n);
#define dsc(n)      scanf("%lf",&n);
#define csc(n)       scanf("%c",&n);
#define LL          long long int
#define UI          unsigned int
#define ULL         unsigned long long int
#define DB          double
#define pii         pair<int,int>
#define VI          vector<int>
#define MII         map<int,int>
#define PB          push_back
#define MP          make_pair
#define M(mx,a)     mx=max(mx,a)
#define IT          ::iterator
#define all(a)      a.begin(),a.end()
#define mems(a,b)   memset(a,b,sizeof(a))
#define F(i,a,b)    for(i=a;i<b;i++)
#define IN(n,aa)    for(i=0;i<n;i++)scanf("%d",&aa[i]);
#define PNT(n,aa)   for(i=0;i<n;i++)printf("%lld ",aa[i]);
#define mod         1000000007
#define NUM         10000009
#define NUM2        1000000000


int main()
{
    int T=1,QQ=0;
    //cin >> T ;
    while(T--)
    {
        int n,i,j,mx=0;
        cin >> n;
        string ss;
        map<string,int>mp;
        for(i=0;i<n;i++)
        {
            cin >> ss;
            mp[ss]++;
        }
        map<string,int>IT it;
        for(it=mp.begin();it!=mp.end();it++)
        {
            mx=max(mx,it->second);
        }
        for(it=mp.begin();it!=mp.end();it++)
        {
            if(mx==it->second)cout << it->first << endl ;
        }
    }
}

//printf("Case %d: ",++QQ);


Measured memory_bytes: 19212
import math
N = int(input())
a = list(map(int,input().split()))
if min(a) >= 0:
    print(N-1)
    for i in range(N-1):
        print((i+1),(i+2))
elif max(a) < 0:
    print(N-1)
    for i in range(N-1):
        print((N-i),(N-i-1))
else:
    if abs(max(a)) >= abs(min(a)):
        print(2*N-1)
        mindex = a.index(max(a))
        for i in range(N):
            print(mindex+1,i+1)
        for j in range(N-1):
            print((j+1),(j+2))
    else:
        print(2*N-1)
        mindex = a.index(min(a))
        for i in range(N):
            print(mindex+1,i+1)
        for j in range(N-1):
            print((N-j),(N-j-1))

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

int main (){
int s;
cin>>s;
int h10=(s%10000)/1000;
int h=(s%1000)/100;
int c=(s%100)/10;
int d=s%10;
if ( h10==h || h==c || c==d){
    cout<<"Bad";
}
else {
    cout<<"Good";
}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#define int long long
#define mod (int)(1e9+7)
#define inf (int)(3e18)
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define P std::pair<int,int>
#define PiP std::pair<int,std::pair<int,int>>
#define all(v) v.begin(),v.end()
#define mkp std::make_pair
#define prique(T) std::priority_queue<T,vector<T>,greater<T>>
using namespace std;
template<class T> inline void chmax(T& a, T b) { a = std::max(a, b); }
template<class T> inline void chmin(T& a, T b) { a = std::min(a, b); }

bool prime(int x) {
	for (int i = 2; i * i <= x; i++) {
		if (x % i == 0)return false;
	}
	return x != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x / gcd(x, y) * y;
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= i; res %= mod;
	}
	return res;
}
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x, y) * mod_pow(kai(y, y), mod - 2, mod) % mod;
}
int get_rand(int MIN, int MAX) {
	std::random_device rnd;
	std::mt19937 mt32(rnd());
	std::uniform_int_distribution<int>engine(MIN, MAX);
	return engine(mt32);
}
/*--------Library Zone!--------*/

int h, w, k;
char c[305][305];
int ans[305][305];
signed main() {
	cin >> h >> w >> k;
	rep(i, h)rep(j, w)cin >> c[i][j];
	int now = 1;
	int x = 0;
	rep(i, h) {
		int j = 0;
		bool flag = false;
		int y = 0;
		while (j < w) {
			if (c[i][j] == '#') {
				while (j < w - 1 && c[i][j + 1] != '#')j++;
				for (int k = x; k <= i; k++)for (int l = y; l <= j; l++)ans[k][l] = now;
				y = j + 1;
				flag = true;
				now++;
			}
			j++;
		}
		if (flag)x = i + 1;
	}
	for (int i = h - 1; i >= 0; i--) {
		bool flag = false;
		rep(j, w) {
			if (c[i][j] == '#')flag = true;
		}
		if (flag) {
			for (int j = i + 1; j < h; j++) {
				rep(k, w) {
					ans[j][k] = ans[i][k];
				}
			}
			break;
		}
	}
	rep(i, h) {
		rep(j, w)cout << ans[i][j] << " ";
		cout << endl;
	}
}


Measured memory_bytes: 1664
from functools import lru_cache
from operator import mul
from functools import reduce


def cmb(n, r):
    r = min(n - r, r)
    if r == 0:
        return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1, r + 1))
    return over // under


N = list(input())
N = list(map(int, N))
K = int(input())
n = len(N)


@lru_cache(None)
def rec(i, k, smaller):
    if k == 0:
        return 1
    if n - i < k:
        return 0

    if smaller:
        # i桁目がNより小さいとき
        return cmb(n - i, k) * pow(9, k)
    else:
        if N[i] == 0:
            return rec(i + 1, k, False)
        else:
            a = rec(i + 1, k, True)
            b = rec(i + 1, k - 1, True) * (N[i] - 1)
            c = rec(i + 1, k - 1, False)
            return a + b + c


answer = rec(0, K, False)
print(answer)


Measured memory_bytes: 3684
object Main {
  def main(args: Array[String]): Unit = {
    val fac_num = scala.io.StdIn.readInt
    val factors = scala.io.StdIn.readLine.split(" ").map{_.toInt}
    var answer  = 0

    factors.foreach({ i =>
      answer += i - 1
    })

    println(answer)

  }
}

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

// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
    //a^tを求める
    //例：d[i] = mint(k/i).pow(n);
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}


vector<ll> g[200005];
mint ans=0;
//N^P(modM)
ll n;




ll dfs(ll v, ll p){
  ll res=0;
  mint atemp=mint(2).pow(n-1)-1;

  for(ll to:g[v]){
    if (to==p)continue;
    ll temp=dfs(to,v);
    res+=temp;
  //  cout<<cntn<<'c'<<endl;
    atemp-=(mint(2).pow(temp)-1);
  }
  //cout<<atemp<<endl;
  atemp-=(mint(2).pow(n-1-res)-1);
  ans+=atemp;
  res++;
  //cout<<v<<' '<<res<<endl;

  return res;
}

int main() {
  cin>>n;
  rep(i,n-1){
    ll a1,b1;
    cin>>a1>>b1;
    a1--;b1--;
    g[a1].push_back(b1);
    g[b1].push_back(a1);
  }
  dfs(0,-1);
  ans/=mint(2).pow(n);
  cout<<ans;

}


Measured memory_bytes: 27136
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

#define repd(i, a, b) for (ll i = (a); i < (b); i++)
#define rep(i, n) repd(i, 0, n)

using namespace std;

namespace mp = boost::multiprecision;
using Bint = mp::cpp_int;

using ll = long long;
ll mod = pow(10, 9) + 7;

template <typename T> void output(T, ll);
ll gcd(ll, ll);
ll lcm(ll, ll);
Bint comb(Bint, Bint);
void prime_map(map<ll, ll> &, ll);

int main() {
    // source
    string s;
    cin >> s;
    string ans;
    if (s == "Sunny") {
        ans = "Cloudy";
    } else if (s == "Cloudy") {
        ans = "Rainy";
    } else {
        ans = "Sunny";
    }

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

Bint comb(Bint a, Bint b) {
    Bint ans = 1;

    if (a < b) {
        return 0;
    }

    rep(i, b) {
        ans *= a - i;
        ans /= i + 1;
    }

    return ans;
}

template <typename T> void output(T a, int precision) {
    if (precision > 0) {
        cout << setprecision(precision) << a << "\n";
    } else {
        cout << a << "\n";
    }
}

template <typename T> T min(T a, T b) {

    if (a < b) {
        return a;
    } else {
        return b;
    }
}

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

ll lcm(ll a, ll b) { return a * b / gcd(a, b); }

void prime_map(map<ll, ll> &m, ll num) {
    ll cache = num;
    repd(i, 2, sqrt(num) + 2) {
        if (num % i == 0) {
            if (m[i] == 0) {
                m[i] = 1;
            } else {
                m[i]++;
            }

            num /= i;
            break;
        }
    }

    if (cache == num) {
        if (m[num] == 0) {
            m[num] = 1;
        } else {
            m[num]++;
        }
        return;
    } else {
        prime_map(m, num);
    }
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;


class GoldenApple
{
    static void Main(string[] args)
    {
        string[] input = Console.ReadLine().Split(' ');
        var N = int.Parse(input[0]);
        var D = int.Parse(input[1]);
        var temp = 1 + D * 2;
        var count = 0;
        while (N > 0)
        {
            N -= temp;
            count++;
        }
        Console.WriteLine(count);
    }

}


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

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin>>n;
  float x,s=0.000,t;
  while(n--) {
    cin>>x;
    t=1/x;
    s+=t;
  }
  cout<<1/s;
  return 0;
}

Measured memory_bytes: 256
N, K, S = map(int, input().split())

ans = []

for i in range(K):
  ans.append(S)
if S < 10**9:
  for i in range(N - K):
    ans.append(S + 1)
else:
  for i in range(N - K):
    ans.append(1)

print(*ans)

Measured memory_bytes: 9580
#pragma region header
#include <bits/stdc++.h>
using namespace std;
#define int long long
#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 rev(i, n) for(int i = (int)(n - 1); i >= 0; i--)
#define rev1(i, n) for(int i = (int)(n); i > 0; i--)
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define resort(v) sort((v).rbegin(), (v).rend())
#define vi vector<int>
#define vvi vector<vector<int>>
#define vc vector<char>
#define vvc vector<vector<char>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
using ll = long long;
using P = pair<int, int>;
/* ----------------よく使う数字や配列----------------- */
int dx[] = {1,0,-1,0};
int dy[] = {0,1,0,-1};
constexpr ll mod = 1e9+7;
constexpr int inf = INT32_MAX/2;
constexpr ll INF = LLONG_MAX/2;
constexpr long double eps = DBL_EPSILON;
constexpr long double pi = 3.141592653589793238462643383279;
/* ----------------------end----------------------- */

/* --------------------テンプレート------------------ */
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
/* ----------------------end----------------------- */

/* --------------------ライブラリ-------------------- */
ll fact(int i) {       //階乗
    if (i == 0) return 1;
    return (fact(i - 1)) * i % mod;
}
ll gcd(ll a, ll b) {        //最大公約数
    if(b == 0) return a;
    return gcd(b, a % b); 
}
ll lcm(ll a, ll b) {      //最小公倍数
    return a * b / gcd(a, b);
}
int keta(ll n) {        //桁数を求める
    if(n == 0) return 1;
    int count = 0;
    while(n != 0) {
        n /= 10;
        count++;
    }
    return count;
}
ll ketasum(ll n) {    //各桁の和
    ll sum = 0;
    while(n != 0) {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}
/* ----------------------end----------------------- */
#pragma endregion
bool bo[8];
signed main() {
    int n;cin >> n;
    int mi=inf,ma=-1;
    rep(i, n) {
        int a;cin >> a;
        chmin(mi,a);chmax(ma,a);
    }
    cout << ma - mi << endl;
    return 0;
}

Measured memory_bytes: 3636
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
class Program
{
    static void Main(string[] args)
    {
            // 入力
            int iN = int.Parse(Console.ReadLine().Trim());

            System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
            sw.Start();

            // 解析
            string sOut = "No";
            int iRet = iN / 15;
            int iOut = iN * 800 - iRet * 200;

            //出力
            Console.WriteLine("{0}", iOut.ToString().Trim());

            sw.Stop();
#if DEBUG
            Console.WriteLine();
            Console.WriteLine("{0}", sw.Elapsed.ToString());
            Console.WriteLine("続行するには何かキーを押してください．．．");
            Console.ReadKey();
#endif
    }
}


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

int main(){
	int n;
	while ( cin >> n ){
		bool* table = new bool[ n + 1 ];
		for ( int i = 0; i <= n ; ++i ){
			table[ i ] = false;
		}
		if ( n >= 2 ) table[ 2 ] = true;

		for ( int i = 3; i <= n; i += 2 ){
			table[ i ] = true;
		}
		for ( int i = 3; i <= sqrt( static_cast< double >( n ) ); i += 2 ){
			if ( !table[ i ] ) continue;
			for ( int j = i + i; j <= n; j += i ){
				table[ j ] = false;
			}
		}

		int cnt = 0;
		for ( int i = 0; i <= n; ++i ){
			if ( table[ i ] ) ++cnt;
		}

		cout << cnt << endl;

		delete[] table;
	}
}

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

int cnt[200005];
int main() {
	memset(cnt,0,sizeof(cnt));
	int n,k;
	cin>>n>>k;
	for (int i=0,tmp; i<n; i++) {
		cin>>tmp;
		cnt[tmp]++;
	}
	sort(cnt,cnt+n+1);
	int typeCnt=0, ans=0;
	for (int i=1; i<=n; i++)
		if (cnt[i])
			typeCnt++;//,cout<<"("<<i<<")="<<cnt[i]<<endl;
	for (int i=1; i<=typeCnt-k; i++)
		ans += cnt[ n-typeCnt+i];
	cout<<ans<<endl;
	return 0;
}


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

    /*
    ||||||||||||||||||||||||||||||||||||||||||||||||
       |      |||         |      ||||    ||||  |   |
      | |     |   |      | |     |   |  |      |   |
     |   |    |    |    |   |    |   |  |      |   |
    |||||||   |    |   |||||||   |||     |||   |||||
    |     |   |   |    |     |   | |        |  |   |
    |     |   |||      |     |   |  ||  ||||   |   |
    ||||||||||||||||||||||||||||||||||||||||||||||||

    */
    using namespace std;
    #define ff first
    #define ss second
    #define mp make_pair
    #define all(v) v.begin(),v.end()
    #define int long long
    #define ll long long
    #define M 1000000007

    #define mii  map<ll ,ll >
    #define msi  map<string,ll >
    #define mis  map<ll int, string>
    #define rep(a,b)    for(ll i=a;i<b;i++)
    #define rep0(n)    for(ll i=0;i<n;i++)
    #define repi(i,a,b) for(ll i=a;i<b;i++)
    #define pb push_back
    #define vi vector<ll>
    #define mp make_pair
    #define vs vector<string>
    #define ppb pop_back
    #define endl '\n'
    #define asdf ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    #define r0 return 0;
    #define FORD(i, a, b) for (int i = (int) (a); i >= (int) (b); --i)
    #define FORE(it, c) for (__typeof((c).begin()) it = (c).begin(); it != (c).end(); ++it)
    #define inputoutput freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
    #define input freopen("input.txt", "r", stdin);
    #define Set(a, s) 4(a, s, sizeof (a))
    #define FOR repi
    //#define float long double
    ll max(ll a, ll b) { return (a > b)? a : b;}
    int min(int a, int b) { return (a < b)? a : b;}


     int solve()
     {
        int n;
        cin>>n;
        vi h(n);
        rep0(n) cin>>h[i];
        int ans=0;
        vi v;
        rep0(n){
            v.pb(h[i]);
            sort(all(v));
            if(v[i]==h[i]){ans++;}
        }
        cout<<ans;
     }
    signed main()
    {   
        
        int t=1;
        //cin>>t;
        while(t--)
        {
            solve();
        }     
        
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <math.h>
using namespace std;
typedef long long int ll;

int main(){
	int n; cin >> n;
	vector<int> a(1<<n);
	for(int i=0;i<1<<n;i++){
		cin >> a[i];
	}
	sort(a.begin(),a.end());
	vector<int> s;
	s.push_back(a.back());
	a.back()=-1;
	for(int i=0;i<n;i++){
		vector<int> p=s;
		sort(p.begin(),p.end());
		int ai=(1<<n)-1;
		while(p.size()>0&&ai>=0){
			if(a[ai]==-1){
				ai--;
				continue;
			}
			if(a[ai]<p.back()){
				s.push_back(a[ai]);
				p.pop_back();
				a[ai]=-1;
			}
			ai--;
		}
		if(p.size()>0){
			cout << "No" << endl;
			return 0;
		}
	}

	cout << "Yes" << endl;
	return 0;
}

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

using namespace std;

typedef unsigned int ui;
typedef long long ll;
typedef unsigned long long ull;

constexpr int MAXK = 100;

int dp[MAXK + 2][2];

int main() {
	int N, K;
	cin >> N >> K;
	cin >> dp[0][1];
	for(int i = 1; i < N; i++) {
		int h;
		cin >> h;
		int best = INT_MAX;
		for(int j = 0; j < min(i, K); j++)
			best = min(best, dp[j][0] + abs(dp[j][1] - h));
		dp[i % K][0] = best;
		dp[i % K][1] = h;
	}
	cout << dp[(N - 1) % K][0] << endl;
}


Measured memory_bytes: 256
import scala.io.StdIn

object Main extends App {

  val n = StdIn.readLine().toInt
  private val a: Array[Int] = Array.ofDim(45)
  a(0) = 1
  a(1) = 1

  (2 to n).foreach{ i =>
    a(i) = a(i-1) + a(i-2)
  }
  
  println(a(n))
}


Measured memory_bytes: 43876
#include <iostream>
#include <string>
using namespace std;
int Dice[6];

void roll(char c)
{
    int t;
    if (c == 'E')
    {
        t = Dice[2];
        Dice[2] = Dice[0];
        Dice[0] = Dice[3];
        Dice[3] = Dice[5];
        Dice[5] = t;
    }
    else if (c == 'W')
    {
        t = Dice[3];
        Dice[3] = Dice[0];
        Dice[0] = Dice[2];
        Dice[2] = Dice[5];
        Dice[5] = t;
    }
    else if (c == 'N')
    {
        t = Dice[4];
        Dice[4] = Dice[0];
        Dice[0] = Dice[1];
        Dice[1] = Dice[5];
        Dice[5] = t;
    }
    else if (c == 'S')
    {
        t = Dice[1];
        Dice[1] = Dice[0];
        Dice[0] = Dice[4];
        Dice[4] = Dice[5];
        Dice[5] = t;
    }
}

int main()
{
    string s;
    for (int i = 0; i != 6; ++i)
    {
        cin >> Dice[i];
    }
    cin >> s;
    for (int i = 0; i != s.size(); ++i)
    {
        roll(s[i]);
    }
    cout << Dice[0] << endl;
    return 0;
}


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

public class Main {

	public static void main(String[] args) {
		// TODO ?????????????????????????????????????????????
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] w = new int[n];
		boolean[] judge = new boolean[n];

		int AllMin = 10000;

		for (int i = 0; i < n; i++) {
			w[i] = sc.nextInt();
			AllMin = Math.min(AllMin, w[i]);
			judge[i] = false;
		}

		int answer = 0;

		int[] copy = w.clone();
		Arrays.sort(copy);

		for (int i = 0; i < n; i++) {
			if (judge[i] == true || w[i] == copy[i]) {
				judge[i] = true;
				continue;
			}

			int min = w[i];
			int roop = 0;
			int cost = 0;

			while (true) {
				if (judge[i] == true) {
					break;
				}
				roop++;
				judge[i] = true;

				min = Math.min(min, w[Index(copy, w[i])]);

				cost += w[Index(copy, w[i])];
				i = Index(copy, w[i]);
			}

			answer += Math.min(cost + (roop - 2) * min, cost + min + AllMin
					* (roop + 1));

		}
		
		System.out.println(answer);

	}

	public static int Index(int[] w, int X) {
		int index = 0;
		for (int i = 0; i < w.length; i++) {
			if (w[i] == X) {
				index = i;
				break;
			}
		}
		return index;
	}

}

Measured memory_bytes: 30748
N = int(input())
a = list(map(int, input().split()))

from fractions import gcd
gcds_ascendant = [-1, a[0]]
for i in range(1, N-1):
    gcds_ascendant.append(gcd(gcds_ascendant[-1], a[i]))

a = a[::-1]
gcds_descendant = [-1, a[0]]
for i in range(1, N-1):
    gcds_descendant.append(gcd(gcds_descendant[-1], a[i]))
gcds_descendant = gcds_descendant[::-1]

ans = 0
for i in range(N):
    left, right = gcds_ascendant[i], gcds_descendant[i]
    if left == -1:
        left = right
    elif right == -1:
        right = left
    ans = max(ans, gcd(right, left))

print(ans)

# print(gcds_ascendant)
# print(gcds_descendant)


Measured memory_bytes: 14428
#include <iostream>
#include <set>
#include <vector>
#include <string>
#include <algorithm>
#include <iterator>
#include <map>
#include <utility>
#include <list>
#include <climits>
#include <bitset>
#include <numeric>

using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)
#define repi(i, n) for(auto i = (n).begin(); i != (n).end(); i++)
#define in_arr(type, a, n) copy_n(istream_iterator<type>(cin), n, (a).begin());
#define ll long long int

int main(){
    vector< vector<int> > f(9);
    repi(i, f){
        *i = vector<int>(9, 0);
    }
    int n;
    string s;
    cin >> n >> s;
    rep(i, n - 1){
        ++f[s[i] - '0' - 1][s[i + 1] - '0' - 1];
    }
    vector<int> res(9);
    vector<int> vi = {0, 1, 2, 3, 4, 5, 6, 7, 8};
    int ret = INT_MAX;
    do{
        int exp_res = 0;
        rep(i, 9){
            rep(j, 9){
                int xi = i % 3;
                int yi = i / 3;
                int xj = j % 3;
                int yj = j / 3;
                int dist = abs(xi - xj) + abs(yi - yj);
                exp_res += dist * f[vi[i]][vi[j]];
            }
        }
        if(exp_res < ret){
            ret = exp_res;
            rep(i, 9){
                res[i] = vi[i];
            }
        }
    }while(next_permutation(vi.begin(), vi.end()));
    rep(i, 3){
        rep(j, 3){
            cout << res[i * 3 + j] + 1;
            if(j == 2){
                cout << endl;
            }
        }
    }
    return 0;
}



Measured memory_bytes: 3316
import collections

N = int(input())
S = list(input() for i in range(N))

c = collections.Counter(S)
max = max(c.values())

max_k_list = [kv[0] for kv in c.items() if kv[1] == max]

max_k_list.sort()
for i in max_k_list:
    print(i)


Measured memory_bytes: 35556
#include <cstdio>
#include <vector>
#include <algorithm>
#include <queue>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
int n,m;

int main(){
  scanf("%d %d", &n, &m);
  vector<vector<int>> reward;
  reward.resize(100010);
  for(int i=0; i<n; i++){
    int a,b; scanf("%d %d", &a, &b);
    a--;
    reward[a].emplace_back(b);
  }
  
  ll ans=0;
  priority_queue<int> que;
  
  for(int i=0; i<m; i++){
    for(int j=0; j<(int)reward[i].size(); j++){
      que.push(reward[i][j]);
    }
    if(!que.empty()){
      ans += (ll)que.top();
      que.pop();
    }
  }
  
  printf("%llu\n", ans);
}

Measured memory_bytes: 5632
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long n = sc.nextLong();
        long k = sc.nextLong();
        long ans1 = n%k;
        long ans2 = Math.abs(ans1 - k);
        if (ans1 > ans2) System.out.println(ans2);
        else System.out.println(ans1);
    }
}

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

int main() {
  int r,D,i,n;
  vector<int> x(11);
  cin >> r >> D >> x.at(0);
  
  for(i=0; i<10; i++) {
    x.at(i+1) = r*x.at(i)-D;
    cout << x.at(i+1) << endl;
  }
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
  int i, n;
  scanf("%d",&n);
  if(n%2!=0){
    printf("No");
    return 0;
  }
  char s[n];
  scanf("%s",s);
  for(i=0;i<n/2;i++){
    if(s[i]!=s[n/2+i]) {
      printf("No");
      return 0;
    }
  }
  printf("Yes");
}

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

int n,ans=1,s,po[210000],in,but;

int main(){

    cin >> n;

    for(int i=0;i<n;i++){
        cin >> s;
        po[i]=s;
    }

    for(int i=1;i<=n/2;i++){
        if(n%i==0){

            for(int j=0;j<n;j++){
                if(po[j]!=po[j%i]){
                    ans=1;
                    break;
                }
                ans=n/i;
            }
            if(ans!=1)break;

        }
    }

    cout << ans << endl;

return 0;
}

Measured memory_bytes: 1944
#include <bits/stdc++.h>
using namespace std;
#define FAST       			ios_base :: sync_with_stdio(false); cin.tie(NULL);

int main() {
  FAST;
  string S;
  cin >> S;
  if (S.at(2) == S.at(3) && S.at(4) == S.at(5)) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
from math import floor, sqrt

# xの約数を求める
def getDivisor(x):
    ans = []
    for d in range(1, floor(sqrt(x)) + 1): # 1からスタート
        if x % d == 0:
            ans.append(d)
            if x // d != d:
                ans.append(x // d)

    return sorted(ans)


N, M = map(int, input().split())

divs = getDivisor(M)
for div in reversed(divs):
    if M // div >= N:
        print(div)
        break


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
template<class T> inline bool chmax(T &a, T b) {if (a < b) {a = b;return 1;}return 0;}
template<class T> inline bool chmin(T &a, T b) {if (a > b) {a = b;return 1;}return 0;}

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


Measured memory_bytes: 3576
#include <iostream>
#include <numeric>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <iterator>
#include <math.h>
#include <cmath>

#define INF 100000000
#define ll long long


using namespace std;

int main() {
	vector<int> v = {};
	int n;
	int ans = 0;
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		int x;
		cin >> x;
		v.push_back(x);
	}

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

	for (int i = 1; i < v.size(); i++)
	{
		if (v[i - 1] == v[i]) {
			v[i - 1] = 0;
			v[i] = 0;
		}
	}

	for (int i = 0; i < v.size(); i++)
	{
		if (v[i] != 0) {
			ans++;
		}
	}
	cout << ans << endl;


}

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

using ll = long long;
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define FORR(i, m, n) for (int i = (m); i >= (n); i--)
#define REP(i, n) FOR(i, 0, (n))
#define REPR(i, n) FORR(i, (n) - 1, 0)
#define REP1(i, n) FOR(i, 1, (n) + 1)
#define ALL(c) (c).begin(), (c).end()
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
const int MOD = 1000000007;
const int INF = 1000000001;
const char EOL = '\n';

void solve();

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    solve();
}

void solve() {
    int a, b;
    cin >> a >> b;
    cout << max(0, a - b * 2) << endl;
}

Measured memory_bytes: 256
n=int(input())
a=[0]+list(map(int,input().split()))+[0]
sum_a=0
for i in range(n+1):
  sum_a+=abs(a[i+1]-a[i])
for i in range(n):
  print(sum_a-abs(a[i+1]-a[i])-abs(a[i+2]-a[i+1])+abs(a[i+2]-a[i]))

Measured memory_bytes: 86832
#include <iostream>

using namespace std;
const int MAXW = 51;
const int MAXH = 51;

int h, w;
char s[MAXW][MAXH];
bool visited[MAXW][MAXH];
int dx[4] = {-1, 0, 1, 0};
int dy[4] = {0, 1, 0, -1};

int dfs(int x, int y) {
  visited[x][y] = true;
  if (s[x][y] == '.') {
    return 0;
  }
  int cnt = 1;
  for (int i=0;i<4;i++) {
    int nx = x + dx[i];
    int ny = y + dy[i];
    if (0 <= nx && nx < w && 0 <= ny && ny < h && !visited[nx][ny]) {
      cnt += dfs(nx, ny);
    }
  }
  return cnt;
}

void solve() {
  for (int i=0;i<h;i++) {
    for (int j=0;j<w;j++) {
      if (s[j][i] == '#' && !visited[j][i]) {
        int cnt = dfs(j, i);
        if (cnt == 1) {
          cout << "No" << endl;
          return;
        }
      }
    }
  }
  cout << "Yes" << endl;
}

int main() {
  cin >> h >> w;
  for (int i=0;i<h;i++) {
    for (int j=0;j<w;j++) {
      cin >> s[j][i];
    }
  }
  solve();
}


Measured memory_bytes: 384
#include<iostream>
#include<algorithm>
#include<functional>
#include<cmath>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<deque>
using namespace std;
#define ll long long
const int mod = 1000000007;
const ll INF = 1000000000000000000;

int main()
{
	string S;
	cin >> S;
	int ans = mod;
	for (int i = 0; i < S.size(); i++) {
		int n = stoi(S.substr(i, 3));
		//cout << n << endl;
		ans = min(ans, abs(753 - n));
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
using namespace std;
int pw[300050],ni[300050],i;
#define Mod 998244353
inline int qmi(int di,int zhi)
{
	int ret=1,x=di;
	while (zhi){
		if (zhi&1) ret=1LL*ret*x%Mod;
		x=1LL*x*x%Mod;zhi>>=1;
	}return ret;
}
int main()
{
	int n,a,b,c,d,ans=0;long long k;
	scanf("%d%d%d%lld",&n,&a,&b,&k);pw[0]=1;
	for (i=1;i<=n;i++) pw[i]=1LL*pw[i-1]*i%Mod;
	ni[n]=qmi(pw[n],Mod-2);
	for (i=n;i>=1;i--) ni[i-1]=1LL*ni[i]*i%Mod;
	for (c=0;c<=n;c++){
		if ((k-1LL*a*c)%b) continue;
		d=(k-1LL*a*c)/b;
		if (d<0||d>n) continue;
		ans=(1LL*pw[n]*ni[c]%Mod*ni[n-c]%Mod*pw[n]%Mod*ni[d]%Mod*ni[n-d]%Mod+ans)%Mod;
	}printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 2560
#include <iostream>
#include <queue>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <bitset>

#define REP(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define FILL(x, y) memset(x, y, sizeof(x))
#define pb push_back
#ifdef LOCAL
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
#define eprintf(...) 42
#endif

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

using namespace std;
using ll = long long;

const int kInf = 1e9;
const ll kLInf = 1e18;

int gcd (int a, int b) {
   return b ? gcd(b, a % b) : a;
}
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

int dp[1010][1010];
int a[1000][1000];

int main()
{
   const int kMod = 1e9+7;
   int H, W;
   cin >> H >> W;
   string tmp;
   REP(i, H) {
      cin >> tmp;
      eprintf("\n");
      REP(j, W) {
         if (tmp[j] == '.') {
            a[i][j] = 1;
         } else {
            a[i][j] = 0;
         }
         eprintf("%d ", a[i][j]);
         dp[i][j] = 0;
      }
   }
   eprintf("------\n");
   dp[0][0] = 1;
   REP(i, H) {
      REP(j, W) {
         if (a[i][j]) {
            dp[i+1][j] += dp[i][j];
            dp[i+1][j] %= kMod;
            dp[i][j+1] += dp[i][j];
            dp[i][j+1] %= kMod;
         }
      }
   }
   REP(i, H) {
      REP(j, W) {
         eprintf("%d ",dp[i][j]);
      }
      eprintf("\n");
   }
   cout << dp[H-1][W-1] << endl;
   return 0;
}


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

using P = complex<double>;
const double PI = acos(-1);
double r,x,y;
int n;

double cross(P a, P b){
    return a.real()*b.imag() - a.imag()*b.real();
}

int main(){
    while(cin >> r >> x >> y >> n){
        P Q(x/r,y/r);
        double b = PI/2;
        for(int i = 0; i < n; ++i){
            double t;
            cin >> t;
            t = 2*PI * t/100;
            b -= t;
            double a = b + t;
            P A = polar(1.,a);
            P B = polar(1.,b);
            double s_org = t;
            double s_mod = s_org + cross(A,Q) + cross(Q,B);
            cout << floor(s_mod/s_org*100) << (i == n-1 ? "\n" : " ");
        }
    }
}

Measured memory_bytes: 3672
#include <cstdio>
#include <algorithm>

using namespace std;

char s[100001];

int main(int argc, char **argv)
{
    //len 1 1e5
    scanf("%s", s);
    char *p = s;
    int one = 0, zero = 0;
    while(*p){
        if(*p++ == '1'){
            one ++;
        }else{
            zero ++;
        }
    }
    printf("%d\n", min(one, zero) * 2);
    return 0;
}

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

int main() {
  int n, l;
  cin >> n >> l;
  if(l >= 0) {
    int sum = 0;
    for(int i = 2; i <= n; i++) sum += (l+i-1);
    cout << sum << endl;
  }
  else if(l+n-1 <= 0) {
    int sum = 0;
    for(int i = 1; i <= n-1; i++) sum += (l+i-1);
    cout << sum << endl;
  }
  else {
    int sum = 0;
    for(int i = 1; i <= n; i++) sum += (l+i-1);
    cout << sum << endl;
  }
}


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

int main(void){
int a,b,c;
cin >> a;
cin >> b;
cin >> c;
int i = 0;
    for(int x = a ; x <= b ; x++){
        if(c % x == 0){
            i++;
        }
        else{
        }
   }
cout << i << endl;
}



Measured memory_bytes: 3108
#include<iostream>
using namespace std;
typedef long long ll;
int main() {
	ll n, t,before=0,after=0,ans=0;
	cin >> n >> t;
	for (ll i = 0; i < n; i++) {
		cin >> after;
		if (before == 0 && after == 0) {
			ans+=t;
		}
		else {
			if (after - before < t) {
				ans -= t - (after - before);
			}
			ans += t;
		}
		before = after;
	}
	cout << ans << endl;
}

Measured memory_bytes: 256