akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize("O3")

#include "bits/stdc++.h"
#include "ext/pb_ds/tree_policy.hpp"
#include "ext/pb_ds/assoc_container.hpp"
#include "ext/rope"
#include <iomanip> 

using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;

typedef long long ll;
typedef pair<int, int> pii;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define F0R(i, a) for(int i = 0; i < (a); ++i)
#define pb push_back
#define mp make_pair
#define sz(x) (int)x.size()
#define f first
#define s second

template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

struct custom_hash 
{
    static uint64_t splitmix64(uint64_t x) 
    {
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const 
    {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

int main()
{
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    double w, h, x, y;
    cin >> w >> h >> x >> y;
    cout << setprecision(9);
    cout << fixed;   
    cout << (w * h)/2.0 << " ";
    if(x == w/2 && y == h/2) cout << 1;
    else cout << 0;
    return 0;
}

Measured memory_bytes: 256
import numpy as np
n,k,q=map(int,input().split())
a=[int(input()) for i in range(q)]
li=np.array([0]*n)
d=np.array([k-q]*n)

for j in range(0,len(a)):
  li[a[j]-1]+=1

  
ans=np.array(li+d)


for m in range(0,n):
  if ans[m]>0:
    print("Yes")
  else:
    print("No")


Measured memory_bytes: 19496
import java.util.*;
 
class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int K = sc.nextInt();
		int X = sc.nextInt();
		for (int i=X-K+1; i<X+K; i++) {
			System.out.println(i + " ");
		}
	}
}

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

# 最大公約数を求める関数
def gcd(a,b):
    rem = a % b
    while rem != 0:
        a = b
        b = rem
        rem = a % b
    return b

cand = A[0]

for i in range(1,N):
    cand = gcd(cand, A[i])

    if cand == 1:
        break

print(cand)

Measured memory_bytes: 14224
#include <bits/stdc++.h>
#define rep(i, a, b) for(ll i = ll(a); i < ll(b); i++)
#define rer(i, a, b) for(ll i = ll(a) - 1; i >= ll(b); i--)
#define sz(v) (int)(v).size()
#define pb push_back
#define sc second
#define fr first
#define sor(v) sort(v.begin(),v.end())
#define rev(s) reverse(s.begin(),s.end())
#define lb(vec,a) lower_bound(vec.begin(),vec.end(),a)
#define ub(vec,a) upper_bound(vec.begin(),vec.end(),a)
#define uniq(vec) vec.erase(unique(vec.begin(),vec.end()),vec.end())
using namespace std;
typedef long long int ll;
typedef pair <int, int> P;

const ll MOD=1000000007;
ll n;
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin>>n;
    rep(i,0,21){
        if(1LL<<i==n){
           cout <<"No"<<"\n";
            return 0;
        }
    }
    cout <<"Yes"<<"\n";
    rep(i,1,21){
        if(1LL<<i<n){
            cout <<(1LL<<i)<<" "<<(1LL<<(i-1))<<"\n";
        }
    }
    rep(i,1,21){
        rep(j,1,1LL<<i){
            if((1LL<<i)+j<=n){
                cout <<(1LL<<i)+j<<" "<<(1LL<<i)<<"\n";
            }
        }
    }
    cout <<n+1<<" "<<3<<"\n";
    cout <<n+2<<" "<<n+1<<"\n";
    rep(i,3,n+1){
        bool t=false;
        rep(j,0,21){
            if(1LL<<j==i){
                cout <<n+i<<" "<<n+i+1<<"\n";
                t=true;

            }
            if(1LL<<j==i+1){
                cout <<n+i<<" "<<1<<"\n";
                t=true;
            }
        }
        if(t) continue;
        ll s=i;
        rer(j,21,0){
            if(1LL<<j<i){
                if((1LL<<j&s)){
                    s-=1LL<<j;
                }
                else{
                    if(s==0){
                        s+=1LL<<(j+1);
                        cout <<n+i<<" "<<s<<"\n";
                        break;
                    }
                    s+=1LL<<j;
                    cout <<n+i<<" "<<s<<"\n";
                    break;
                }
            }
        }
    }
}

Measured memory_bytes: 2688
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  long long N, K;
  cin >> N >> K;
  
  if (N % K == K - (N % K)) {
    cout << N % K << endl;
  }
  
  if (N % K > K - (N % K)) {
    cout << K - (N % K) << endl;
  }
  
  if (N % K < K - (N % K)) {
    cout << N % K << endl;
  }
}

Measured memory_bytes: 256
#include<iostream>
int main()
{
	int imos[100001];
	for(int i = 0; i < 100001; i++)
	{
		imos[i] = 0;
	}
	int N;
	std::cin >> N;
	int range_min = 100000, range_max = 0;
	for(int i = 0; i < N; i++)
	{
		int a, b;
		std::cin >> a >> b;
		imos[a - 2]++;
		imos[b - 1]--;
		if(range_min > a - 2)
		{
			range_min = a - 2;
		}
		if(range_max < b - 1)
		{
			range_max = b - 1;
		}
	}
	for(int i = range_min; i < range_max; i++)
	{
		imos[i + 1] += imos[i];
	}
	int ninzu_max = 1;
	for(int i = range_min; i < range_max; i++)
	{
		if(i + 1 <= imos[i])
		{
			ninzu_max = i + 2;
		}
	}
	std::cout << ninzu_max - 1 << std::endl;
	return 0;
}


Measured memory_bytes: 3468
#include <bits/stdc++.h>
#define pii pair<int,int>
#define LL long long
#define pb push_back
#define mp make_pair
#define st first
#define nd second
using namespace std;
int r[205][205],h,w,sx,sy,tx,ty,a,b,visited[205],prv[205];
char c;
int bfs() {
	memset(visited,0,sizeof visited);
	memset(prv,0,sizeof prv);
	queue<int> q;
	visited[203]=1;
	q.push(203);
	int x,y;
	int done=0;
	while(!q.empty()&&!done) {
		x=q.front();
		q.pop();
		//cout<<x<<" "<<sx<<" "<<r[x][sx]<<endl;
		for(int i=0;i<205&&!done;++i) {
			if(r[x][i]&&visited[i]==0) {
				visited[i]=1;
				prv[i]=x;
				if(i==204)
					done=1;
				else
					q.push(i);
			}
		}
	}
	return done;
}
int main() {
	cin>>h>>w;
	for(int i=1;i<=h;++i)
		for(int j=1;j<=w;++j) {
			cin>>c;
			if(c=='S') {
				sx=i; sy=j;
			}
			else if(c=='T') {
				tx=i; ty=j;
			}
			if(c!='.') {
				r[i][j+100]=1;
				r[j+100][i]=1;
			}
		}
	if(sx==tx||sy==ty) {
		cout<<-1<<endl;
		return 0;
	}
	r[203][sx]=300; r[sx][203]=300;
	r[203][sy+100]=300; r[sy+100][203]=300;
	r[204][tx]=300; r[tx][204]=300;
	r[204][ty+100]=300; r[ty+100][204]=300;
	int ans=0;
	while(bfs()){
		++ans;
		//cout<<"ye "<<ans<<endl;
		int cur=204,x;
		while(cur!=203) {
			x=prv[cur];
			r[x][cur]-=1;
			r[cur][x]+=1;
			cur=x;
		}
	}
	printf("%d\n",ans);
}

Measured memory_bytes: 384
package main

import "fmt"

func main() {
	var h, a int
	fmt.Scan(&h, &a)

	count := 0
	for i := 0; i < 10000; i++ {
		h -= a
		count++
		if h <= 0 {
			break
		}
	}
	fmt.Println(count)
}


Measured memory_bytes: 512
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author tatsumack
 */

#include <iostream>
#include <fstream>

#include <iostream>
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>

#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <queue>
#include <unordered_map>
#include <unordered_set>

#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 FOR(i, a, b) for (int i = (a), i##_len = (b); i <= i##_len; ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define CLR(a, b) memset((a), (b), sizeof(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define INF 1001001001001001001ll
#define fcout cout << fixed << setprecision(12)

using namespace std;

typedef pair<int, int> P;

class DKThK {
public:
    void solve(std::istream& cin, std::ostream& cout) {
        int N;
        cin >> N;
        vector<int> res(N * N);

        vector<int> x(N);
        vector<P> v(N);
        REP(i, N) {
            cin >> x[i];
            x[i]--;
            res[x[i]] = i + 1;
            v[i] = {x[i], i + 1};
        }
        sort(v.begin(), v.end());

        int cur = 0;
        REP(i, N) {
            int val = v[i].second;
            int n = val - 1;
            int num = 0;
            while (num < n) {
                if (res[cur] != 0) {
                    cur++;
                    continue;
                }
                res[cur] = val;
                cur++;
                num++;
            }
        }
        cur = N * N - 1;
        REV(i, N - 1, 0) {
            int val = v[i].second;
            int n = N - val;
            int num = 0;
            while (num < n) {
                if (res[cur] != 0) {
                    cur--;
                    continue;
                }
                res[cur] = val;
                cur--;
                num++;
            }
        }

        vector<int> cnt(N + 1);
        REP(i, res.size()) {
            cnt[res[i]]++;
            if (cnt[res[i]] == res[i]) {
                if (x[res[i] - 1] != i) {
                    cout << "No" << endl;
                    return;
                }
            }
        }

        cout << "Yes" << endl;
        REP(i, N * N) cout << res[i] << " ";
    }
};


signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    std::istream& in(std::cin);
    std::ostream& out(std::cout);

    DKThK solver;
    solver.solve(in, out);
    return 0;
}


Measured memory_bytes: 3200
BASE = 4

while True:

    input_num = int(input())

    if input_num == -1:
        break

    result = ""

    while True:
        quotient, remainder = divmod(input_num, BASE)

        result = str(remainder) + result

        if input_num < BASE:
            break

        input_num = quotient

    print(result)



Measured memory_bytes: 5596
#define _USE_MATH_DEFINES

#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cmath>
#include <bitset>
using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;



const int BIG_NUM = 1e9;
const ll INF = 1000000000000000000;
const ll MOD = 1e9 + 7;



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

	sort(a.begin(), a.end());
	sort(b.begin(), b.end(), greater<ll>());

	if (n % 2 == 0) {
		ll mi = (a[n / 2] + a[n / 2 - 1]);
		ll ma = (b[n / 2] + b[n / 2 - 1]);

		cout << ma - mi + 1 << endl;
	}
	else {
		ll mi = a[n / 2];
		ll ma = b[n / 2];

		cout << ma - mi + 1 << endl;
	}
}


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

int main() {
  int intN, intA, intB;
  cin >> intN >> intA >> intB;

  if ((intN * intA) < intB) {
    cout << intN * intA << endl;
  }
  else if ((intN * intA) > intB)  {
    cout << intB << endl;
  }
  else{
    cout << intB << endl;
  }    

}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cstdlib>
#include <math.h>
#include <set>

using namespace std;
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 long long INF = 1LL << 60;

#define MOD 1000000007

int num[5];

int main(){

    int res = -1;

    for(int i = 0; i < 5; i++) cin >> num[i];

    for(int i = 0; i < 5; i++){
        if(num[i] == 0){
            res = i+1;
        }
    }

    cout << res;
}

Measured memory_bytes: 3568
#!/usr/bin/env python3
import sys


def solve(N: int):
    print(N**3)
    return


# Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    solve(N)

if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
#pragma GCC optimize ("O3")

#include <bits/stdc++.h>

using namespace std;

#ifdef LOCAL
#include <prettyprint.hpp>
#define debug(...)  cerr << "[" << #__VA_ARGS__ << "]: ", d_err(__VA_ARGS__);
#else
#define debug(...) 83;
#endif

void d_err() {
    cerr << endl;
}

template <typename H, typename... T>
void d_err(H h, T... t) {
    cerr << h << " ";
    d_err(t...);
}

template <typename T>
void print(T x) {
    cout << x << endl;
}

#define ALL(x) (x).begin(), (x).end()
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REVFOR(i, m, n) for (int i = (n - 1); i >= (m); --i)
#define REP(i, n) FOR(i, 0, n)
#define REVREP(i, n) REVFOR(i, 0, n)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define bcnt __builtin_popcountll

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<ll,ll> Pll;
typedef pair<int,int> Pin;

ll INF = 1e16;
int inf = 1e9;
ll MOD = 1e9+7;

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    int N; cin >> N;

    string S, T;
    cin >> S >> T;

    REP(i, N) {
        cout << S[i] << T[i];
    }

    cout << endl;

    
}


Measured memory_bytes: 3644
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

h, w, k = map(int, input().split())
board = [0] * h
for i in range(h):
    board[i] = list(input().strip())

ans = 0
for i in range(2 ** h):
    for j in range(2 ** w):
        bin_i = format(i, '0{}b'.format(h))
        bin_j = format(j, '0{}b'.format(w))
        black = 0
        for ch in range(h):
            for cw in range(w):
                if bin_i[ch] == '1':
                    continue
                if bin_j[cw] == '1':
                    continue
                if board[ch][cw] == '#':
                    black += 1
        if black == k:
            ans += 1
print(ans)


Measured memory_bytes: 68800
import io
import sys

readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)

import itertools

A, B, C, D = list(read().rstrip().decode('utf-8'))

for operators in itertools.product(['+', '-'], repeat=3):
    op1, op2, op3 = operators
    eq = A + op1 + B + op2 + C + op3 + D
    x = eval(eq)
    if x == 7:
        break

answer = eq + "=7"
print(answer)

Measured memory_bytes: 3064
#include <stdio.h>
int main(void){
    char po;
    int buri[26]={};
    int mojisu=0;
    long long int ans=1;
    while(scanf("%c",&po)!=-1&&po-'a'>=0&&po-'a'<26){
        mojisu++;
        buri[po-'a']++;
        ans+=(long long int)(mojisu-buri[po-'a']);
    }
    printf("%lld",ans);
    return 0;
}


Measured memory_bytes: 128
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    
    int number;
  	long long ans;
      
    cin >> number;
    
    ans = 0;
    
    for(int i=1;i<=number;i++){
        
        if(i%5!=0 && i%3 !=0){
            
            ans = ans + i;
            
        }
        
    }

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

Measured memory_bytes: 3636
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>
#include <stack>
#include <assert.h>


using namespace std;
using ll = long long;
using ull = unsigned long long;

const ll INF = 1e16;
const ll MOD = 1e9 + 7;

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







int main(){
    ll n, k;
    cin >> n >> k;
    vector<string> p(n);
    vector<ll> cnt(26);
    REP(i, n){
        cin >> p[i];
        cnt[p[i][0] - 'A']++;
    }
    
    ll ans = 0;
    [&](){
    for(;;){
        sort(cnt.begin(), cnt.end(), greater<ll>());
        REP(i, k){
            if(cnt[i]-- <= 0){
                return;
            }
        }
        ans++;
    }
    }();
    cout << ans << endl;
}

Measured memory_bytes: 896
#include<bits/stdc++.h>
using namespace std;
int arr[100010];
int box[110];
int main()
{
int n,k,i,j;
scanf("%d%d",&n,&k);
for(i=0;i<n;i++)
scanf("%d",&box[i]);
for(i=0;i<box[0];i++)
arr[i]=-1;
for(i=box[0];i<=k;i++)
{  int z=0;
	for(j=0;j<n;j++)
	{    
	      	if( i-box[j]>=0 && arr[i-box[j]]==-1 )
		z++;

	}
	if(z>0)
	arr[i]=1;
        else
	arr[i]=-1;	
}
if(arr[k]==1)
printf("First\n");
else
printf("Second\n");

}	


Measured memory_bytes: 640
/* ****TCIITB**** */

#include<bits/stdc++.h>
#define io          ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); 
#define ll          long long
#define pb          push_back
#define	endl		'\n'
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define rep(i,a,b)	for(ll int i=a;i<b;i++)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define time        cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
using namespace std;

#define N  100005

int main()
{
	
	io
	
	string s,t;
	cin>>s>>t;
	ll n=s.length();
	ll m=t.length();
	ll res=1e18;
	rep(i,0,n-m+1)
	{
		ll cnt=0;
		rep(j,0,m)
		{
			if(s[i+j]!=t[j])
				cnt++;
		}
		res=min(res,cnt);
	}
	cout<<res;
}

Measured memory_bytes: 3608
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define MOD 1000000007
#define ff first
#define ss second
#define pb push_back
#define N 3010

ll inv[N], fac[N], finv[N];

void make()
{
	fac[0] = fac[1] = 1;
	inv[1] = 1;
	finv[1] = finv[0] = 1;
	for(int i = 2; i < N; ++i)
	{
		fac[i] = i * fac[i - 1] % MOD;
		inv[i] = MOD - MOD/i * inv[MOD % i] % MOD;
		finv[i] = inv[i] * finv[i - 1] % MOD;
	}
}

ll C(ll n, ll k)
{
	if(n < k || n < 0) return 0;
	return fac[n] * finv[n - k] % MOD* finv[k] % MOD;
}

ll gcd(ll a, ll b)
{
	if(b == 0)
		return a;
	return gcd(b, a % b);
}
string s, t;
int n1, n2;
int dp[N][N];
int p[N][N];
int dpf(int i, int j)
{
	if(i == n1 || j == n2)
		return 0;
	if(dp[i][j] >= 0)
		return dp[i][j];
	if(s[i] == t[j])
	{
		dp[i][j] = 1 + dpf(i + 1, j + 1);
		p[i][j] = 2;
	}
	else
	{
		int k1, k2;
		dp[i][j] = max(k1 = dpf(i + 1, j), k2 = dpf(i, j + 1));
		if(dp[i][j] == k1)
			p[i][j] = 1;
		else
			p[i][j] = 3;
	}
	return dp[i][j];
}
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);

	memset(dp, 0, sizeof(dp));
	// memset(s, -1, sizeof(s));
	cin >> s >> t;
	n1 = s.size(), n2 = t.size();

	int i = 0, j = 0;
	for (int i = 0; i < n1; ++i)
	{
		if(s[i] == t[0])
			dp[i][0] = 1, p[i][0] = 2; 
		else p[i][0] = 1;
	}

	for (int i = 0; i < n2; ++i)
	{
		if(t[i] == s[0])
			dp[0][i] = 1, p[0][i] = 2;
		else p[0][i] = 3;
	}

	for (int i = 1; i < n1; ++i)
	{
		for (int j = 1; j < n2; ++j)
		{
			if(s[i] == t[j])
				dp[i][j] = 1 + dp[i-1][j-1], p[i][j] = 2;
			else
			{
				dp[i][j] = max({dp[i-1][j], dp[i][j-1], dp[i-1][j-1]});
				if(dp[i][j] == dp[i-1][j])
					p[i][j] = 1;
				else
					p[i][j] = 3;
			}
			// cout << dp[i][j] << " ";
		}
		// cout << "\n";
	}
	i = n1 - 1, j = n2 - 1;

	string an;
	while(i >= 0 && j >= 0)
	{
		if(p[i][j] == 1)
		{
			i--;
		}
		else if(p[i][j] == 2)
		{
			an += s[i];
			i--;
			j--;
		}
		else
		{
			// cout << i << " " <<  j <<"\n";
			j--;
		}
			// cout << i << " " <<  j <<"\n";
	}
	reverse(an.begin(), an.end());
	// cout << dp[n1-1][n2-1] << '\n';
	cout << an << "\n";
	return 0;
}

Measured memory_bytes: 71040
#include <stdio.h>

int main (){

  int n;
  int p[50];
  int a[50];
  int i;
  int cnt=0;
  scanf("%d" ,&n);

  for(i=0;i<n;i++){
  	scanf("%d" ,&p[i]);
  }
  for(i=0;i<n;i++){
  	a[i]=i+1;
  }
  
  for(i=0;i<n;i++){
  
    if(p[i]==a[i]) cnt++;
    
  }
  
  
  if((cnt==n-2)||(cnt==n)){
  printf("YES");
  }
  else{
    printf("NO");
  }
  
  return 0;
}

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

void solve() {
    int N;
  	string S;
    cin >> N >> S;
    S.push_back('#');
    int ans = 0;
    for(int i = 0; i + 1 < S.size(); i++) {
        if(S[i] != S[i+1]) ans++;
    }
    cout << ans << endl;
}
 
int main() {
    solve();
}

Measured memory_bytes: 512
class UnionFind:
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n
 
    def find(self, x):#要素xが属するグループの根を返す
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]
 
    def union(self, x, y):#要素xが属するグループと要素yが属するグループとを併合する
        x = self.find(x)
        y = self.find(y)
 
        if x == y:
            return
 
        if self.parents[x] > self.parents[y]:
            x, y = y, x
 
        self.parents[x] += self.parents[y]
        self.parents[y] = x
 
    def size(self, x):#要素xが属するグループのサイズ（要素数）を返す
        return -self.parents[self.find(x)]
 
    def same(self, x, y):#要素x, yが同じグループに属するかどうかを返す
        return self.find(x) == self.find(y)
 
    def members(self, x):#要素xが属するグループに属する要素をリストで返す
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]
 
    def roots(self):#すべての根の要素をリストで返す
        return [i for i, x in enumerate(self.parents) if x < 0]
 
    def group_count(self):#グループの数を返す
        return len(self.roots())
 
    def all_group_members(self):#{ルート要素: [そのグループに含まれる要素のリスト], ...}の辞書を返す
        return {r: self.members(r) for r in self.roots()}
 
    def __str__(self):#print()での表示用 ルート要素: [そのグループに含まれる要素のリスト]を文字列で返す
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

n,q = map(int,input().split())

uf = UnionFind(n)

for i in range(q):
    query = list(map(int,input().split()))
    if query[0] == 0:
        uf.union(query[1], query[2])
    else:
        print(int(uf.same(query[1], query[2])))


Measured memory_bytes: 5800
#include<stdio.h>
int dx[4]={0,-1,0,1},dy[4]={-1,0,1,0},cnt,x,y;
char a[12][13];
void func(int y,int x){
	int i;
	a[y][x]='0';
	for(i=0;i<4;i++){
		if(x+dx[i]>=0&&x+dx[i]<12&&a[y][x+dx[i]]=='1') func(y,x+dx[i]);
		if(y+dy[i]>=0&&y+dy[i]<12&&a[y+dy[i]][x]=='1') func(y+dy[i],x);
	}
}
int main(void){
	int i,j;
	while(scanf("%s",&a[0])!=EOF)	{
		for(i=1;i<12;i++) scanf("%s",a[i]);
		cnt=0;
		for(i=0;i<12;i++){
			for(j=0;j<12;j++){
				if(a[i][j]=='1'){
					cnt++;
					func(i,j);
				}
			}
		}
		printf("%d\n",cnt);
	}
	return 0;
}

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

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

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

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

// --------------------------------------

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

  cin >> a >> b;

  int sum = 0;
  if(a > b) {
    sum = a + a - 1;
  } else if(a == b) {
    sum = a + b;
  } else {
    sum = b + b - 1;
  }

  cout << sum << endl;
}


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

#define MAX 200000

int L[MAX/2+2], R[MAX/2+2];

long long merge(int A[], int size, int left, int mid, int right);
long long mergesort(int A[], int size, int left, int right);

int main(){
    int A[MAX], n;
    cin >> n;
    for(int i = 0; i < n; i++){
        cin >> A[i];
    }
    
    long long con = mergesort(A, n, 0, n);

    cout << con << endl;
}

long long merge(int A[], int size, int left, int mid, int right){
    // A[]を右と左にわけ、右と左の大きい方をとってく
    int i, j;
    long long cnt = 0;
    int n1 = mid - left;
    int n2 = right - mid;
    for(i = 0; i < n1; i++) L[i] = A[left+i];
    for(i = 0; i < n2; i++) R[i] = A[mid+i];
    L[n1] = R[n2] = INT_MAX;
    i = j = 0;
    for(int k = left; k < right; k++){
        if(L[i] <= R[j]){
            A[k] = L[i++];
        }else{
            A[k] = R[j++];
            cnt+= n1-i; 
            // L,Rはソートずみ。この時左側の要素それぞれの反転数はn1-iで求められる
        }
    }
    return cnt;
}

long long mergesort(int A[], int size, int left, int right){
    long long v1,v2,v3;
    if(left+1 < right){
        int m = (left + right) /2;
        v1 = mergesort(A, size, left, m);
        v2 = mergesort(A, size, m, right);
        v3 = merge(A, size, left, m, right);
        return v1 + v2 + v3;
    }else return 0;
}


Measured memory_bytes: 4676
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func Scan() string {
	sc.Scan()
	return sc.Text()
}
func iScan() int {
	n, _ := strconv.Atoi(Scan())
	return n
}
func fScan() float64 {
	n, _ := strconv.ParseFloat(Scan(), 64)
	return n
}
func stringToInt(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}
func SScan(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = Scan()
	}
	return a
}
func iSScan(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = iScan()
	}
	return a
}
func abs(x int) int {
	if x < 0 {
		x = -x
	}
	return x
}
func larger(a, b int) int {
	if a < b {
		return b
	} else {
		return a
	}
}
func smaller(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}
func max(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x < a[i] {
			x = a[i]
		}
	}
	return x
}
func min(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x > a[i] {
			x = a[i]
		}
	}
	return x
}
func sum(a []int) int {
	x := 0
	for _, v := range a {
		x += v
	}
	return x
}
func fSum(a []float64) float64 {
	x := 0.
	for _, v := range a {
		x += v
	}
	return x
}

var mod int = 1000000007

func main() {
	buf := make([]byte, 0)
	sc.Buffer(buf, mod)
	sc.Split(bufio.ScanWords)
	d := iScan()
	t := iScan()
	s := iScan()
	if (d+s-1)/s <= t {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


Measured memory_bytes: 1772
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys

input1 = raw_input().split(" ")
input1 = [int(i) for i in input1]
N = input1[0]
M = input1[1]
X = input1[2]
Y = input1[3]

input2 = raw_input().split(" ")
input2 = [int(i) for i in input2]

input3 = raw_input().split(" ")
input3 = [int(i) for i in input3]


for i in range(X + 1, Y):
    if max(input2) < i <= min(input3):
        print "No War"
        sys.exit()

print "War"

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

int count = 0;

int main()
{
  string s;
  cin >> s;
  if (s == "Sunny")
    puts("Cloudy");
  else if (s == "Cloudy")
    puts("Rainy");
  else
    puts("Sunny");
  return 0;
}

Measured memory_bytes: 256
import math
X = int(input())
 
if X == 2:
  print(2)
  exit()
  
hajime = X
 
if hajime % 2 == 0:
  hajime += 1
checkMax = math.ceil(math.sqrt(hajime))
for i in range(hajime, 1000000):
  goseisu = False
  for j in range(2, checkMax + 1):
    if i % j == 0:
      goseisu = True
      break
  if not goseisu:
    print(i)
    exit()

Measured memory_bytes: 3064
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <cassert>
#include <vector>

using namespace std;

#define TRACE(x) cerr << #x << " = " << x << endl
#define _ << " " <<
#define X first
#define Y second
#define FOR(i, a, b) for (int i=(a); i<(b); i++)
#define REP(i, n) FOR(i, 0, n)

typedef pair<int, int> P;
typedef long long ll;

const int MAX = 52;
const ll GRAN = 1e16 + 1000;

int n;
ll p[MAX];

int check(ll x) {
  if (x < 0) return 0;
  ll kol = 0;
  
  REP(i, n) {
    ll tmp = p[i] + x - n + 1;
    if (tmp > 0)
      kol += (tmp - 1) / (n+1) + 1;
  }
  
  return kol <= x;
}

ll solve() {
  ll lo=0;
  REP(i, n) lo += p[i];

  for (ll i=lo-n*n; ; i++)
    if (check(i))
      return i;
}

int main() {
  ll K;
  scanf("%lld", &K);
  
  n = 50;

  ll sum = n * (n - 1) + K;
  ll prvih = sum % n;
  REP(i, n)
    p[i] = sum / n + (i < prvih ? 1 : 0);
  
  for (;;) {
    ll tmp = solve();
    if (tmp == K) break;
    //    int raz = (int) (tmp - K);
    int ind = rand() % n;

    ll nov = p[ind] + ((tmp < K ? 1 : -1) * (rand() % 40 + 1));
    if (nov >= 0 && nov <= GRAN)
      p[ind] = nov;
  }

  printf("%d\n", n);
  REP(i, n)
    printf("%lld ", p[i]);
  printf("\n");
  
  return 0;
}


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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N;
  cin >> N;
  string S;
  cin >> S;
  int cnt = 0, pre = 0;
  for (int i = 0; i < N; i++) {
    if (S[i] == '(') {
      cnt++;
    } else {
      cnt--;
      if (cnt < 0) pre = max(pre, -cnt);
    }
  }
  for (int i = 0; i < pre; i++) {
    S = '(' + S;
  }
  N += pre;
  cnt = 0;
  for (int i = 0; i < N; i++) {
    if (S[i] == '(') {
      cnt++;
    } else {
      cnt--;
    }
  }
  for (int i = 0; i < cnt; i++) {
    S = S + ')';
  }
  cout << S << '\n';
  return 0;
}


Measured memory_bytes: 256
local n, m = io.read("*n", "*n")
do
  local oddm = m
  if oddm % 2 == 0 then oddm = oddm - 1 end
  local spos = 1
  for i = oddm, 1, -2 do
    print(spos .. " " .. spos + i)
    spos = spos + 1
  end
end
if 1 < m then
  local evm = m
  if evm % 2 == 1 then evm = evm - 1 end
  local epos = n
  for i = evm, 2, -2 do
    print(epos - i .. " " .. epos)
    epos = epos - 1
  end
end


Measured memory_bytes: 2924
#include <iostream>
#include<string>
using namespace std;
int main(void){
    int c,m[50];
    cin>>c; //曲数

	string n[50];

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

	string fm;
	cin>>fm;
	int j,sum=0;

	for(j=0;j<c;j++){
		if(fm==n[j]){
			j++;
			break;
		}
	}

	for(j=j;j<c;j++){
		sum=sum + m[j];
	}

	cout << sum << endl;
		return 0;
    
}

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

int main() {
    string s;
    cin >> s;
    
    int n = s.size();
    int sum;

    vector<string> op(n); 
    
    for (int bit = 0; bit< 1<<(n-1); bit++){
        sum = s.at(0) - '0';
//        cout << bit << " ";
        for (int i=0; i<n-1; i++){
           if(bit & (1<<i)){
                sum += s.at(i+1) - '0';
                op.at(i) = '+';
//                cout << op.at(i);
            }else{
                sum -= s.at(i+1) - '0';
                op.at(i) = '-';
//                cout << op.at(i);
            }
        }
//        cout << endl;

        if (sum == 7){
            for (int i=0; i<3; i++){
                cout << s.at(i) << op.at(i);
            }
            cout << s.at(3) << "=7" << endl;
            break;
        }
    }
    return 0;
}


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

using namespace std;

int main() {
   vector <pair<int,int  >> v[1000000];
   int n,m,a,l;
   cin >> n>> m;
   for(int i=0;i<m;i++){
       cin >> l>> a;
       v[l-1].push_back(make_pair(a,i));
   }
 //  sort(v.begin(),v.end());
   vector<pair<long long ,string>> p;
   
   for(int i=0;i<n;i++){
       sort(v[i].begin(),v[i].end());
       for(long long j=0;j<v[i].size();j++){
           p.push_back(make_pair(v[i][j].second,to_string(1000000+i+1).substr(1,6)+to_string(1000000+1+j).substr(1,6)));
       }
   }
   sort(p.begin(),p.end());
   for(long long i=0;i<m;i++){
       cout << p[i].second<<"\n";
   }
}

Measured memory_bytes: 34288
#include<bits/stdc++.h>
using namespace std;
int n,m,ans;
int main()
{
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;++i)
		for(int j=1;j<=m;++j)
			if(j%10>=2&&j/10>=2&&(j%10)*(j/10)==i) ans++;
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define vi vector<int>
#define pb push_back
using namespace std;
const int N=2e5+5;
int sum[N],col[N],n;
ll ans[N],son[N];
vi v[N];
void DFS(int now,int fa)
{
	son[now]=1;
	for(int i=0;i<v[now].size();i++)
	{
		int to=v[now][i];
		if(to==fa)continue;
		DFS(to,now);
		son[now]+=son[to];
	}
}
void dfs(int now,int fa)
{
	ans[col[now]]+=(ll)son[now]*(ll)(n-son[now]-(ll)sum[col[now]]+1);
	sum[col[now]]+=son[now];
	int rem=sum[col[now]];
	ll pre=0;
	for(int i=0;i<v[now].size();i++)
	{
		int to=v[now][i];
		if(to==fa)continue;
		sum[col[now]]=(n-son[to]);
		dfs(to,now);
		ans[col[now]]+=pre*son[to];
		pre+=son[to];
	}
	sum[col[now]]=rem;
	return;
}
int main()
{
	cin>>n;
	for(int i=0;i<n;i++)cin>>col[i];
	for(int i=0;i<n-1;i++)
	{
		int a,b;
		cin>>a>>b;
		a--,b--;
		v[a].pb(b);
		v[b].pb(a);
	}
	DFS(0,-1);
	dfs(0,-1);
	for(int i=1;i<=n;i++)cout<<ans[i]<<"\n";
	return 0;
}

Measured memory_bytes: 37940
#include <bits/stdc++.h>
using namespace std;
 
template <typename T> void print(T t) { cout<<t<<endl; }
template<typename T, typename... Args> void print(T t, Args... args) { cout<<t<<" "; print(args...); }

typedef complex<double> base;

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl '\n'
#define int long long
#define double long double

int32_t main() 
{
    IOS
    int n,d;
    cin>>n>>d;
    int ans=0;
    for(int i=0;i<n;i++)
    {
        int a,b;
        cin>>a>>b;
        if(a*a+b*b<=d*d)
            ans++;
    }
    print(ans);
}   


Measured memory_bytes: 3572
#include<bits/stdc++.h>
using namespace std;
int read(){
	int ans=0;char c=getchar();
    while (c<'0'||c>'9') c=getchar();
	while (c>='0'&&c<='9'){
		ans=ans*10+c-'0';
		c=getchar();
	}
	return ans;
}
int main(){
	int n;
	n=read();
	cout<<n*800-(n/15)*200<<endl;
	return 0;
}
	


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vll = vector<long long>;
using vp = vector<pair<int, int>>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using vvll = vector<vector<long long>>;
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 (b<a) {a=b; return 1;} return 0;}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int n;
    cin >> n;
    vp ba(n);
    rep(i, n) {
        int a, b;
        cin >> a >> b;
        ba[i] = P(b, a);
    }
    sort(ba.begin(), ba.end());
    int now = 0;
    rep(i, n) {
        now += ba[i].se;
        if (now > ba[i].fi) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
}

Measured memory_bytes: 1792
#pragma GCC optimize("Ofast,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
using namespace __gnu_pbds;
using namespace std;
#define IO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define PI 3.1415926535897932384626433832795
#define endl "\n"
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
long long MOD = 1e9+7;
pair<int,int> dx[4] = {{1,0},{-1,0},{0,1},{0,-1}};
const int RANDOM = chrono::high_resolution_clock::now().time_since_epoch().count();
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
struct chash {int operator()(int x) const { return x ^ RANDOM; }};
string toString(long long x){stringstream ss;ss << x;string str = ss.str();return str;}
long long fastpow(long long x,long long k){if(!k)return 1;if(k & 1)return ((x * fastpow(x,k-1) % MOD) % MOD) % MOD;
long long ans = fastpow(x,k/2);ans %= MOD;ans *= ans;ans %= MOD;return ans;}
long long sumF(long long x){int s = 0;while(x)s += x%10,x /= 10;return s;}
bool isS(char c){return (c >= 'a' && c <= 'z');}
bool isB(char c){return (c >= 'A' && c <= 'Z');}
bool isD(char c){return (c >= '0' && c <= '9');}
bool isSqrt(long long x){ long long f = sqrt((long double)x + 0.5); return f*f == x;}
bool isCubic(long long x) {long long f = cbrt((long double)x + 0.5); return f*f*f == x;}
long long lcm(long long a,long long b){return a * (b / __gcd(a,b));}
vector<long long> divVec(long long x){vector<long long> tmp;for(long long i = 1;1LL*i*i <= x;i++){if(x % i == 0){tmp.push_back(i);if(x / i != i)
tmp.push_back(x / i);}}return tmp;}
long long invMod(long long x){return fastpow(x,MOD - 2) % MOD;}
int main() {
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    IO;
    int n;
    cin >> n;
    cout << (n-2) * 180;
    return 0;
}


Measured memory_bytes: 256
import math
def main():
    N = int(input())
    min_sum_xy = N + 1
    for x in range(2, math.floor(N**(1/2))+1):
        if N % x == 0:
            y = N // x
            min_sum_xy = min(x + y, min_sum_xy)
    print(min_sum_xy - 2)
main()

Measured memory_bytes: 63784
N = int(input())
a = input().split(' ')
b = input().split(' ')
c = input().split(' ')

total_point = 0
before_eat = -2

for i in range(N):
  now_eat = int(a[i]) - 1
  point = int(b[now_eat])
  if now_eat == before_eat + 1:
    additional_point = int(c[before_eat])
  else:
    additional_point = 0
  total_point = total_point + point + additional_point
  before_eat = now_eat
  
print(total_point)
  

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

using namespace std;

int n,m,i,j,dfn[55],low[55],nxt,res;

vector <int> edge[55];

void solve(int id, int p){
	dfn[id] = low[id] = ++nxt;
	for(int k = 0; k < edge[id].size(); k++){
		int to = edge[id][k];
		if(dfn[to] == -1){
			solve(to, id);
			low[id] = min(low[id], low[to]);
		}
		else if(to != p)
		low[id] = min(low[id], dfn[to]);
	}
	
	for(int k = 0; k < edge[id].size(); k++){
		int to = edge[id][k];
		if(to == p) continue;
		if(low[to] > dfn[id]) res++;
	}
}

int main(){
	scanf("%d%d", &n, &m);
	
	for(i = 0; i < m; i++){
		int x,y;
		scanf("%d%d", &x, &y);
		edge[x].push_back(y);
		edge[y].push_back(x);
	}
	
	memset(dfn, -1, sizeof(dfn));
	solve(1, -1);
	
	printf("%d\n", res);
}


Measured memory_bytes: 256
#082-C
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(input())
def S(): return list(input())
n=I()
A=IL()
Ad={}
for a in A:
    if a in Ad:
        Ad[a]+=1
    else:
        Ad[a]=1
ans=0
for key in Ad.keys():
    if Ad[key]<key:
        ans+=Ad[key]
    else:
        ans+=Ad[key]-key
print(ans)

Measured memory_bytes: 17780
#include <iostream>
#include <cstdlib>
#include <algorithm>

using namespace std;

int main(void) {
  int x[3];
  for (int i = 0; i < 3; i++) {
    cin >> x[i];
  }

  sort(x, x + 3);
  int da, db;
  da = x[2] - x[0];
  db = x[2] - x[1];
  int res;
  if (da % 2 == 0 and db % 2 == 0) {
    res = da / 2 + db / 2;
  } else if (da % 2 == 1 and db % 2 == 1) {
    res = 1 + (da - 1) / 2 + (db - 1) / 2;
  } else if (da % 2 == 0 and db % 2 == 1) {
    res = 1 + da / 2 + (db + 1) / 2;
  } else if (da % 2 == 1 and db % 2 == 0) {
    res = 1 + (da + 1) / 2 + db / 2;
  }
  cout << res << endl;
  return EXIT_SUCCESS;
}



Measured memory_bytes: 256
#include <stdio.h>
int main(){
	int H,W,i,j;
	while(1){
	scanf("%d %d",&H,&W);
	if(H!=0 && W!=0){
		for(i=0;i<H;i++){
			for(j=0;j<W;j++){
				if(i==0 || j==0 || i == H-1 ||j == W-1){
					printf("#");
				}else{
					printf(".");
				}
			}
			printf("\n");
		}
	}else{
		break;
	}
	printf("\n");
	}
}

Measured memory_bytes: 1000
#include <iostream>
#define loop(a,n) for(int i=a;i < n;i ++)

using namespace std;

int main()
{
  int n,m;
  cin >> n >> m;
  int a,b;
  int road[n];
  loop(0,n)
  {
    road[i] = 0;
  }

  loop(0,m)
  {
    cin >> a >> b;
    road[a-1] ++;
    road[b-1] ++;
  }

  loop(0,n)
  {
    cout << road[i] << endl;
  }

}


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

int main(){
    int n;
    string s1,s2;
    cin>>n;
    cin>>s1>>s2;
    
    bool before;
    int start;
    ll ans=1;
    if(s1[0]==s2[0]){
        before=true;
        start=1;
        ans*=3;
    }
    else{
        before=false;
        start=2;
        ans*=6;
    }
    for(int i=start;i<n;i++){
        bool now=s1[i]==s2[i];
        if(before){
            ans=ans*2%mod;
        }
        if(!before&&!now){
            ans=ans*3%mod;
        }
        if(!now) i++;
        before=now;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <string>
#include <numeric>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <queue>

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

int main() {
	int N, A, B;
	cin >> N >> A >> B;
	int ans = min(A*N, B);

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

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
)

//Util
func nextStr() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func maxInt(a, b int) int {
	if a > b {
		return a
	} else {
		return b
	}
}

func minInt(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}

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

func absFloat64(a float64) float64 {
	if a >= 0 {
		return a
	} else {
		return -a
	}
}

func maxFloat64(a, b float64) float64 {
	if a > b {
		return a
	} else {
		return b
	}
}

func minFloat64(a, b float64) float64 {
	if a > b {
		return b
	} else {
		return a
	}
}

func str2Int(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}

func reverse(s string) string {
	runes := []rune(s)
	for i, j := 0, len(runes)-1; i < j; i, j = i+1, j-1 {
		runes[i], runes[j] = runes[j], runes[i]
	}
	return string(runes)
}

func powInt(p, q int) int {
	return int(math.Pow(float64(p), float64(q)))
}

func isPrime(x int) bool {
	if x == 1 {
		return false
	}
	if x == 2 {
		return true
	}
	if x%2 == 0 {
		return false
	}

	b := true
	rootx := int(math.Sqrt(float64(x)))
	i := 3
	for i <= rootx {
		if x%i == 0 {
			b = false
			break
		}
		i += 2
	}
	return b
}

func PrimeFactors(n int) (pfs []int) {
	// Get the number of 2s that divide n
	for n%2 == 0 {
		pfs = append(pfs, 2)
		n = n / 2
	}

	// n must be odd at this point. so we can skip one element
	// (note i = i + 2)
	for i := 3; i*i <= n; i = i + 2 {
		// while i divides n, append i and divide n
		for n%i == 0 {
			pfs = append(pfs, i)
			n = n / i
		}
	}

	// This condition is to handle the case when n is a prime number
	// greater than 2
	if n > 2 {
		pfs = append(pfs, n)
	}

	return
}

func sumInts(x []int) int {

	total := 0
	for _, v := range x {
		total += v
	}

	return total
}

//Main
const (
	initialBufSize = 10000
	maxBufSize     = 1000000
	mod            = 1e9 + 7
)

var (
	sc *bufio.Scanner = func() *bufio.Scanner {
		sc := bufio.NewScanner(os.Stdin)
		buf := make([]byte, initialBufSize)
		sc.Buffer(buf, maxBufSize)
		return sc
	}()
)

var N, T int

func main() {
	sc.Split(bufio.ScanWords)

	N, T = nextInt(), nextInt()
	t := make([]int, N)
	sum := 0
	for i := 0; i < N; i++ {
		t[i] = nextInt()
	}

	for i := 1; i < N; i++ {
		sum += minInt(t[i]-t[i-1], T)
	}

	fmt.Println(sum + T)
}


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

#define ll long long
const int mod = 1e9 + 7;

int hgt[100005];
ll int dp[100005];

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

  int n;
  cin>>n;


  for(int i=1;i<=n;i++)
    cin>>hgt[i];

  dp[0] = 1e15;

  for(int i=2;i<=n;i++)
    dp[i] = min(dp[i-2] + abs(hgt[i-2] - hgt[i]), dp[i-1] + abs(hgt[i-1] - hgt[i]));

  cout<<dp[n]<<endl;

  return 0;
}


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

#define FOR(i, s, e)   for(int i = (s); i < (e); i++)
#define FOR64(i, s, e) for(ll  i = (s); i < (e); i++)
#define ALL(x)         (x).begin(), (x).end()
#define SORT(b, e)     sort((b), (e))
#define REV(b, e)      reverse((b), (e))
#define VSORT(v)       sort((v).begin(), (v).end())
#define VREV(v)        reverse((v).begin(), (v).end())
#define pb(a)          push_back(a)
#define INF            999999999

typedef long long ll;

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

	vector<int> cost;

	FOR(i, 0, N){
		int c, t;
		cin >> c >> t;
		if(t <= T){
			cost.pb(c);
		}
	}

	if(cost.empty())
		cout << "TLE" << endl;
	else
		cout << *min_element(ALL(cost)) << endl;

	return 0;
}



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

namespace C
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            var A = new int[N];
            var B = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
            A[0] = B[0];
            for (int i = 1; i < N - 1; i++)
            {
                A[i] = Math.Min(B[i], B[i - 1]);
            }
            A[N - 1] = B[N - 2];

            Console.WriteLine(A.Sum());
        }
    }
}


Measured memory_bytes: 13268
from itertools import count

A, B, C = map(int, input().split())
reminders = []

for n in count(start=A // C):
    r = (n * A - C) % B
    if r == 0:
        print("YES")
        break
    else:
        if r not in reminders:
            reminders.append(r)
        else:
            print("NO")
            break


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

int main()
{
  int N;
  cin >> N;
  double a[N];
  double sum = 0;
  for(int i = 0; i < N; i++){
    cin >> a[i];
    sum += a[i];
  }
  double mean = sum / N;
  int x = floor(mean);
  int y = ceil(mean);
  int ans1 = 0;
  int ans2 = 0;
  for(int i = 0; i < N; i++){
    ans1 += (x-a[i])*(x-a[i]);
    ans2 += (y-a[i])*(y-a[i]);
  }
  cout << ((ans1 < ans2) ? ans1 : ans2) << endl;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
    int A, B, C, X, Y, ans;

    cin >> A >> B >> C >> X >> Y;

    if (A + B < C * 2)
    {
        ans = A * X + B * Y;
    }
    else
    {
        int min = X < Y ? X : Y;
        int max = X > Y ? X : Y;
        int maxP = X > Y ? A : B;

        ans = min * 2 * C;

        if (maxP < C * 2)
            ans += (max - min) * maxP;
        else
            ans += (max - min) * 2 * C;
    }

    cout << ans << endl;

    return 0;
}

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

typedef long long LL;

#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ALL(x) (x).begin(),(x).end()
const int IINF = 1e9;
const LL LINF = 1e18;
const LL mod = 1e9+7;

int main() {
    int N, M;
    cin >> N >> M;
    int res = N*(N - 1)/2 + M*(M - 1)/2;
    cout << res << endl;
    return 0;
}


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

int main(){
   int N;
   int t[110000], x[110000], y[110000];
   cin >> N;
   t[0] = x[0] = y[0] = 0;
   for (int i = 0; i < N; i++){
       cin >> t[i+1] >> x[i+1] >> y[i+1];
   }
   
   bool can = true;
   
   for (int i = 0; i < N; i++){
    int dist = abs(x[i+1] - x[i]) + abs(y[i+1] - y[i]);
    int dt = t[i+1] - t[i];
    
    if (dist > dt) can = false;
    if (dist % 2 != dt % 2) can = false;
    
   }
   
   if (can) cout << "Yes" << endl;
   else cout << "No" << endl;

}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    string s, sr;
    cin >> s;
    int n = s.length();
    sr = s;
    reverse(sr.begin(), sr.end());
    bool ok = true;
    if(s != sr)ok = false;
    if(s.substr(0, (n-1)/2) != sr.substr((n+1)/2))ok = false;
     if(sr.substr(0, (n-1)/2) != s.substr((n+1)/2))ok = false;
 
    if(ok)cout << "Yes" << endl;
    else cout << "No" << endl;
   
 
    return 0;
}

Measured memory_bytes: 3632