akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <string>
#include <iomanip>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <complex>
#include <ctime>


using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef int itn;
const ll LINF = 1e18;
const int INF = 1e9;

//マクロ定義
#define vvint(vec,n,m,l) vector<vector<int>> vec(n, vector<int>(m,l));	// lで初期化
#define vvll(vec,n,m,l) vector<vector<ll>> vec(n,vector<ll>(m,l));
#define vint vector<int>
#define pint pair<int,int>
#define rep(i,a) for(ll i=0;i<(a);i++)
#define all(x) (x).begin(),(x).end()
#define debug system("pause")				//デバッグ用
#define ret return 0

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 (b < a) { a = b; return 1; } return 0; }

using Graph = vector<vector<ll>>;

#define ketasitei setprecision(15) //15桁表示

const ll MOD = 1000000007;
const double PI = 3.1415926535897932;

const long long TIME_LIMIT=10000;

ll scorecalc(vector<vector<ll>> a, vector<ll> los, ll d, vector<ll> an)
{
    ll ans = 0;
    
    vector<ll> last(los.size(), 0);
    for (int i = 0; i < an.size(); i++)
    {
        ll loss = 0;
        for (int j = 0; j < 26; j++)
        {
            if (j == an[i] - 1)
                continue;

            loss += los[j] * (i+1LL - last[j]);
        }
        ans += a[i][an[i] - 1] - loss;
        cout << ans << endl;
        last[an[i] - 1] = i + 1LL;
    }

    return ans;
}

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

    ll d;
    cin >> d;
    vector<ll> c(26);
    rep(i, 26)
    {
        cin >> c[i];
    }
    vector<vector<ll>> s(d, vector<ll>(26));
    rep(i, d)
    {
        rep(j, 26)
            cin >> s[i][j];
    }

    vector<ll> ans(d);
    rep(i, d)
        cin >> ans[i];

    ll score = scorecalc(s, c, d, ans);

   /* vector<ll> last(26, 0);

    for (ll i = 0; i < d; i++)
    {
        ll lost = 0;
        for (int j = 0;j < 26; j++)
        {
            lost += c[j] * (i + 1 - last[j]);
        }
        ll man = s[i][0]-lost+c[0]*(i+1-last[0]);
        ll manu = 1;
        for (int j = 0; j < 26; j++)
        {
            if (man <= s[i][j]-lost+c[j]*(i+1-last[j]))
            {
                man = s[i][j] - lost + c[j] * (i + 1 - last[j]);
                manu = j + 1LL;
                last[j] = i + 1;
            }
        }
        ans[i] = manu;
    }
    ll score = scorecalc(s, c, d, ans);
    ll times = 0;
    while (times < 10000)
    {
        vector<ll> tmpD(1000);
        rep(j, 1000)
        {
            tmpD[j] = (ll)rand() % d;
        }
        vector<ll> tmpN(1000);
        rep(j, 1000)
        {
            tmpN[j] = ans[tmpD[j]];
            ans[tmpD[j]] = (ll)rand() % 26 + 1;
        }

        if (score >= scorecalc(s, c, d, ans))
            rep(j, 1000)
            ans[tmpD[j]] = tmpN[j];
        else
            score = scorecalc(s, c, d, ans);

        times++;
    }

    rep(i, d)
    {
        cout << ans[i] << endl;
    }*/

	return 0;

}

Measured memory_bytes: 3828
#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<deque>
#include<regex>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>
#define rep(i,n) for(int i=0;i<n;i++)

typedef int long long ll;
using namespace std;
typedef pair<int,int> P;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
const ll MOD=1e9+7;
static const int MAX = 100;
static const int INF = (1<<23);
template<class T> T gcd(T a, T b){return b? gcd(b,a%b) : a;}
template<class T> T lcm(T a,T b){return a / gcd(a,b)*b;}

int main(){

    int n,m;
    cin>>n>>m;
    vector<int> wa(n,0);
    vector<bool> toi(n,false);
    rep(i,m){
        int a;
        string s;
        cin>>a>>s;
        a--;
        if(s=="WA"){
            if(!toi[a]){
                wa[a]++;
            }
        }else if(s=="AC"){
            if(!toi[a]){
            toi[a]=true;
            }
        }
    }

    int w=0,aa=0;
    rep(i,n){
        if(toi[i]){
            w+=wa[i];
            aa++;
        }
    }
    cout<<aa<<" "<<w<<endl;



    
return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <vector>
using namespace std;
using ll = long long int;
const ll MOD = 998244353;

vector<vector<int>> divs(1010101, vector<int>{});
vector<vector<int>> A_div(1010101, vector<int>{});
ll sum_AiAj[1010101];
vector<int> a(202020);

ll mod_pow(ll x, ll n){
    ll ret = 1;
    while(n!=0){
        if(n & 1){
            ret = ret * x % MOD;
        }
        x = x * x % MOD;
        n = n >> 1;
    } 
    return ret;
}

int main() {
    int n; cin >> n;
    for(int i=0; i<n; i++){
        cin >> a[i];
    }
    for(int i=1; i<1000001; i++){
        for(int j=1; i * j < 1000001; j++){
            divs[i * j].push_back(i);
        }
    }

    for(auto& v:a){
        for(auto& w:divs[v]){
            A_div[w].push_back(v);
        }
    }

    ll inv_mod2 = mod_pow(2, MOD-2);

    for(int i=0; i<1000001; i++){
        ll square_sum = 0;
        ll sum = 0;
        for(auto& v:A_div[i]){
            square_sum += 1LL * v * v;
            sum += v;
        }
        square_sum %= MOD;
        sum %= MOD;
        sum_AiAj[i] = (sum * sum - square_sum + MOD) % MOD;
        sum_AiAj[i] *= inv_mod2; 
        sum_AiAj[i] %= MOD;
    }

    ll ans = 0;
    for(int i=1000000; i>0; i--){
        ll val = sum_AiAj[i];
        for(int j=2; i * j<1000001; j++){
            val = (val - sum_AiAj[i*j] + MOD) % MOD;
        }
        sum_AiAj[i] = val;
        if(val == 0){continue;}
        ans += val * mod_pow(i, MOD-2);
        ans %= MOD;
    }
    cout << (ans + MOD) % MOD << endl;
    return 0;
}

Measured memory_bytes: 186632
#include <bits/stdc++.h>
using namespace std;
#define pie 3.141592653589793238462643383279
#define int long long
#define mod 1000000007
#define INF LLONG_MAX/5
#define all(v) v.begin(),v.end()
#define P pair<int,int>
#define S second
#define F first
#define f(i,n) for(int i=0;i<n;i++)
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;
}
bool prime(int x) {
	for (int i = 2; i <= sqrt(x); i++) {
		if (x%i == 0)return false;
	}
	return true;
}
int kai(int x) {
	if (x == 0)return 1;
	return kai(x - 1)*x%mod;
}
int mypow(int x, int y, int mood) {
	int res = 1;
	while (y > 0) {
		if (y & 1)res = res * x%mood;
		x = x * x%mood;
		y >>= 1;
	}
	return res;
}
P x[100000];
signed main(){
	int n;
	cin>>n;
	f(i,n){
		cin>>x[i].F;
		x[i].S=i;
	}
	sort(x,x+n);
	f(i,n){
		if(i)cout<<" ";
		cout<<x[i].S+1;
	}
}


Measured memory_bytes: 2432
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define MD 1000000007
#define INF 1ll<<60
typedef pair<ll, ll> P;
template <typename T>
std::string tostr(const T &t){std::ostringstream os;os << t;return os.str();}
int dx[4]={1, 0, -1, 0}, dy[4]={0, 1, 0, -1};

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


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

int main() {
  int n ;
  cin >> n;
  vector<int> a(n);
  rep(i,n) {
    cin >> a[i];
    --a[i];
  }
  vector<int> b(n);
  rep(i,n) cin >> b[i];
  vector<int> c(n-1);
  rep(i,n-1) cin >> c[i];
  int sum = 0;
  rep(i,n){
    sum += b[i];
    if (i > 0 && a[i] - a[i-1] == 1) sum += c[a[i-1]]; 
  }
  cout << sum << endl;
  return 0;
}


Measured memory_bytes: 256
K = int(input())-1
A=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(A[K])


Measured memory_bytes: 2940
#include<stdio.h>

int main()
{
    int a,b,c;
    int i,n;
    n=0;
    scanf("%d %d %d",&a,&b,&c);
    for (i=a;i<=b;i++)
    {
        if (c%i==0)
            n++;
    }
    printf("%d\n",n);
    return 0;
}



Measured memory_bytes: 2064
import java.io.*;
import java.util.*;
import static java.lang.Math.*;

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

    public void solve(String[] args) {
        MyScanner scanner = new MyScanner();
        int N = scanner.nextInt();
        int ans = 0;
        for (int i = 1; i <= N; i++) {
            if (i % 2 == 0) continue;
            int count = 0;
            for (int j = 1; j <= N; j++) {
                if ((i % j) == 0) {
                    count++;
                }
            }
            if (count == 8) {
                ans++;
            }
        }
        System.out.println(ans);
    }

    private class MyScanner {
        String[] s;int i;BufferedReader br;String reg = " ";
        MyScanner () { s = new String[0];i = 0;br = new BufferedReader(new InputStreamReader(System.in)); }
        public String next() {
            try {
                if (i < s.length) return s[i++]; String line = br.readLine();
                while (line.equals("")) {line = br.readLine();}
                s = line.split(reg, 0); i = 0;return s[i++];
            } catch (Exception e) {e.printStackTrace();}
            return null;
        }
        public int nextInt() {
            try {return Integer.parseInt(next());} catch (Exception e) {e.printStackTrace();}
            return -1;
        }
        public double nextDouble() {
            try {return Double.parseDouble(next());} catch (Exception e) {e.printStackTrace();}
            return -1;
        }
        public long nextLong()  {
            try {return Long.parseLong(next());} catch (Exception e) {e.printStackTrace();}
            return -1;
        }
    }
}


Measured memory_bytes: 19924
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt(); 
        int b = sc.nextInt();
        int c = sc.nextInt();
        if(c>=a && c<=b){System.out.println("Yes");}
        else{System.out.println("No");}
	}
}


Measured memory_bytes: 21332
#include <iostream>
#include <map>
#include <string>
#include <algorithm>
#include <vector>

#define ll long long

int main()
{
    int D, T, S;
    std::cin >> D >> T >> S;

    int sum = T * S;
    if(sum >= D) {
        std::cout << "Yes" << std::endl;
    }
    else {
        std::cout << "No" << std::endl;
    }
}

Measured memory_bytes: 3632
#include<stdio.h>
#include<stdlib.h>
#define N 2000000

int H=0,T[N];
void BuildMaxHeap(int*);
void MaxHeapify(int* , int );
void swap(int * ,int ,int);
void insert(int* , int);
int  extract(int*);
void HeapIncreaseKey(int* ,int,int);


int main(){

  int i,n,key;
  char com[20];
  while(1){
  scanf("%s",com);
  if(com[0]=='i'){
    scanf("%d",&key);
    insert(T,key);
  }
  else if(com[1]=='x')
    printf("%d\n",extract(T));
  else break;
  }
  
  return 0;
}

void MaxHeapify( int* T,int i){
  int l,r,largest,tmp;

  l=2*i;
  r=2*i+1;

  if(l<=H && T[i]<T[l])largest=l;
  else largest=i;

  if(r<=H && T[largest]<T[r])largest=r;

  if(largest!=i){
    swap(T,i,largest);
    MaxHeapify(T,largest);
  }
  
  
}

void BuildMaxHeap(int* T){
  int i;
  for(i=H/2;i>=1;i--)
    MaxHeapify(T,i);
 
}

void swap(int* T,int i, int j){

  int tmp;

  tmp=T[i];
  T[i]=T[j];
  T[j]=tmp;
}

void insert(int* T,int key){
  H++;
  T[H]=-1;
  HeapIncreaseKey(T,H,key);
}

void  HeapIncreaseKey(int* T, int i,int key ){
  if(key<T[i]){
    fprintf(stderr,"new key id smaller than current key");
    return ;
  }

  T[i]=key;

  while(i>1 && T[i/2]<T[i]){
    swap(T,i/2,i);
    i=i/2;
  }
}

int extract(int* T){
  int max;

  if(H<1){
    fprintf(stderr,"heap underflow");
    return 0;
  }

  max=T[1];
  T[1]=T[H];
  H--;
  MaxHeapify(T,1);

  return max;
}

Measured memory_bytes: 4696
//#define TIMER_
#include <bits/stdc++.h>
using namespace std;
#define rep(i,r) for(int i = 0; i < (r); i++)
#define pb push_back
#define ALL(a) a.begin(), a.end()
#define fastio ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define endl '\n'
using ll = long long;
using ull = unsigned long long;
const int maxnfact = 100010;
const int md = 1e9+7;
int N, K;
int fact[maxnfact], fact_inv[maxnfact];
int A[maxnfact];

inline void add(int &a, int b) {
 a += b;
 if (a >= md) a -= md;
}

inline void sub(int &a, int b) {
  a -= b;
  if (a < 0) a += md;
}

inline int mul(int a, int b) {
  return (int) ((long long) a * b % md);
}

inline int mdpow(int a, long long b) {
  int res = 1;
  while (b > 0) {
    if (b & 1) {
      res = mul(res, a);
    }
    a = mul(a, a);
    b >>= 1;
  }
  return res;
}

inline int inv(int a) {
  a %= md;
  if (a < 0) a += md;
  int b = md, u = 0, v = 1;
  while (a) {
    int t = b / a;
    b -= t * a; swap(a, b);
    u -= t * v; swap(u, v);
  }
  assert(b == 1);
  if (u < 0) u += md;
  return u;
}

void pre() {
  fact[0] = 1;
  fact_inv[0] = 1;
  for(int i = 1; i < maxnfact; i++){
    fact[i] = mul(fact[i-1], i);
  }
  fact_inv[maxnfact - 1] = mdpow(fact[maxnfact - 1], md - 2);
  for (int i = maxnfact-1-1; i >= 1; i--) {
    fact_inv[i] = mul(fact_inv[i+1], i+1);
  }
}

inline int nck(int n, int k) {
  return mul(mul(fact[n], fact_inv[n-k]), fact_inv[k]);
}

int main() {
  fastio;
  cin >> N >> K;
  pre();
  for (int i = 0; i < N; i++) { cin >> A[i]; }
  sort(A, A + N);
  int res = 0;
  for (int i = K-1; i < N; i++) {
    int choose = nck(i, K-1);
    int val = A[i] + md; val %= md;
    add(res, mul(val, choose));
  }

  for (int i = 0; i + K <= N; i++) {
    int choose = nck(N - i - 1, K-1);
    int val = A[i] + md; val %= md;
    sub(res, mul(val, choose));
  }
  cout << res << endl;
  
  #ifdef TIMER_
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
  #endif
}


Measured memory_bytes: 1408
from sys import stdin

readline = stdin.readline


def nf():
    """
    入力全て(EOFまで)を`int iter`に変換
    """
    return map(int, open(0).read().split())


def main():
    n, *al = nf()
    s, f = sorted(al)[-2:]
    if s == f:
        for _ in range(n):
            print(f)
        return
    for a in al:
        if a == f:
            print(s)
            continue
        print(f)


if __name__ == "__main__":
    main()


Measured memory_bytes: 25148
#from collections import deque,defaultdict
from sys import stdin
input = stdin.readline
printn = lambda x: print(x,end='')
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
ins = lambda : input().strip()
DBG = True # and False
BIG = 10**18
R = 10**9 + 7

def ddprint(x):
  if DBG:
    print(x)

x = inl()
for i in range(5):
    if x[i]==0:
        print(i+1)
        exit()


Measured memory_bytes: 61904
import java.util.Scanner;

public class Main {
    public static void main(String args[]) {
        Scanner scn = new Scanner(System.in);
        int d1, d2, d3, d4, d5, d6;
        d1 = scn.nextInt();
        d2 = scn.nextInt();
        d3 = scn.nextInt();
        d4 = scn.nextInt();
        d5 = scn.nextInt();
        d6 = scn.nextInt();

        String order = scn.next();
        for (int i = 0; i < order.length(); i++) {
            String or = String.valueOf(order.charAt(i));
            int temp = d1;
            switch (or) {
                case "W":
                    d1 = d3;
                    d3 = d6;
                    d6 = d4;
                    d4 = temp;
                    break;
                case "E":
                    d1 = d4;
                    d4 = d6;
                    d6 = d3;
                    d3 = temp;
                    break;
                case "S":
                    d1 = d5;
                    d5 = d6;
                    d6 = d2;
                    d2 = temp;
                    break;
                default:
                    d1 = d2;
                    d2 = d6;
                    d6 = d5;
                    d5 = temp;

            }
        }

        System.out.println(d1);

        scn.close();

    }

}


Measured memory_bytes: 26244
def inp():
 return [int(x) for x in input().split()]

N = int(input())
a = inp()

n = 1
i = 0 

k = 0

while i<N:
  while i<N and a[i]!=n:
    i+=1
    k+=1
  i+=1
  n+=1

if N==k:
  print(-1)
else:
  print(k)



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


int tile[10][10];
int whtile = 0;
int mxtile = 0;


void paintS(int x, int y){
	int dx[4] = { 1, 0, -1, 0 };
	int dy[4] = { 0, 1, 0, -1 };
	tile[y][x]++;
	for (int i = 0; i < 4; i++){
		int X = x + dx[i];
		int Y = y + dy[i];
		if (0 <= X && X < 10 && 0 <= Y && Y < 10) tile[Y][X]++;
	}
}


void paintM(int x, int y){
	int dx[8] = { 1, 1, 0, -1, -1, -1, 0, 1 };
	int dy[8] = { 0, 1, 1, 1, 0, -1, -1, -1 };
	tile[y][x]++;
	for (int i = 0; i < 8; i++){
		int X = x + dx[i];
		int Y = y + dy[i];
		if (0 <= X && X < 10 && 0 <= Y && Y < 10) tile[Y][X]++;
	}
}


void paintL(int x, int y){
	int dx[12] = { 1, 1, 0, -1, -1, -1, 0, 1, 2, 0, -2, 0 };
	int dy[12] = { 0, 1, 1, 1, 0, -1, -1, -1, 0, 2, 0, -2 };
	tile[y][x]++;
	for (int i = 0; i < 12; i++){
		int X = x + dx[i];
		int Y = y + dy[i];
		if (0 <= X && X < 10 && 0 <= Y && Y < 10) tile[Y][X]++;
	}
}


void paint(int x, int y, int s){
	if (s == 1) paintS(x, y);
	else if (s == 2) paintM(x, y);
	else paintL(x, y);
}


void solve(){
	for (int i = 0; i < 10; i++){
		whtile += count(begin(tile[i]), end(tile[i]), 0);
		mxtile = max(mxtile, *max_element(begin(tile[i]), end(tile[i])));
	}
}


int main(){
	int x, y, s;
	string in;
	while (cin >> in){
		replace(in.begin(), in.end(), ',', ' ');
		stringstream ss;
		ss << in;
		ss >> x >> y >> s;

		paint(x, y, s);
	}

	solve();

	cout << whtile << endl;
	cout << mxtile << endl;

	return 0;
}

Measured memory_bytes: 3180
#include<algorithm>
#include<iostream>
#include<cstdio>
#include<map>
#include<set>
using namespace std;
string s, t;
set<string> S;
 
void Work(){
    int lens = s.size();
    int lent = t.size();
    for(int i = 0; i < lens; i++){
        if(s[i] == '?' || s[i] == t[0]){
            string tmp = s;
            for(int j = 0; j < i; j++) if(tmp[j] == '?') tmp[j] ='a';
            bool can = false;
            for(int j = 0; j < lent; j++){
                if(tmp[i+j]!= '?' && tmp[i+j] != t[j]) break;
                tmp[i+j] = t[j];
                if(j == lent - 1) can = true;
            }
            if(can){
                for(int j = i + lent; j < lens; j++) if(tmp[j] == '?') tmp[j] = 'a';
                S.insert(tmp);
            }
        }
    }
    if(S.size() == 0) cout << "UNRESTORABLE" << endl;
    else cout << *S.begin() << endl;
}
int main(){
    cin >> s >> t;
    Work();
}

Measured memory_bytes: 256
#include <cstdio>
#include <queue>
#include <vector>
#include <cstring>
using namespace std;
int n;
int p[100001];
vector<int> G[100001];

int next[100001];
bool used[100001];
vector<int> vs;
void dfs(int v){
	used[v]=true;
	vs.push_back(v);
	if(p[v]==0){
		for(int i=0;i<vs.size();i++){
			next[vs[i]]=v;
		}
		return;
	}
	for(int i=0;i<G[v].size();i++){
		if(!used[G[v][i]]){
			dfs(G[v][i]);
		}else{
			if(next[G[v][i]]==-1){
				for(int j=0;j<vs.size();j++){
					next[vs[j]]=-2;
				}
				next[G[v][i]]=-2;
			}else{
				for(int j=0;j<vs.size();j++){
					next[vs[j]]=next[G[v][i]];
				}
			}
		}
	}
}

int cnt[100001];

int bfs(){
	queue<int> que;
	que.push(1);
	memset(cnt,-1,sizeof(cnt));
	cnt[1]=0;
	while(que.size()){
		int v=que.front();
		que.pop();
		if(v==n)return cnt[n];
		for(int i=1;i<=6;i++){
			if(v+i>=n)return cnt[v]+1;
			else if(next[v+i]>=1 && cnt[next[v+i]]==-1){
				cnt[next[v+i]]=cnt[v]+1;
				que.push(next[v+i]);
			}
		}
	}
}

int main(void){
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%d",&p[i]);
		if(p[i]!=0)G[i].push_back(i+p[i]);
	}
	memset(next,-1,sizeof(next));
	memset(used,0,sizeof(used));
	for(int i=1;i<=n;i++){
		if(next[i]==-1){
			vs.clear();
			dfs(i);
		}
	}
	printf("%d\n",bfs());
	return 0;
}

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

int main () {
    string S; cin >> S;
    string stack = "";
    
    for (char i : S) {
      if (i == 'S') stack.push_back(i);
      else if (i == 'T' && ((stack.back() == 'T') || stack == "")) stack.push_back(i);
      else stack.pop_back(); 
    }
    cout << stack.size() << endl;
}


Measured memory_bytes: 776
def slove():
    import sys
    input = sys.stdin.readline
    n, m = list(map(int, input().rstrip('\n').split()))
    cnt = 1
    t = n
    while True:
        t *= 2
        if t <= m:
            cnt += 1
        else:
            print(cnt)
            exit()


if __name__ == '__main__':
    slove()


Measured memory_bytes: 38384
def chmin(a,b):
    if a > b:
        return b
    else:
        return a

N, K = map(int,input().split())
H = list(map(int, input().split()))

inf = float('inf')
dp = [inf] * N

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

for i in range(2,N):
    for j in range(1,K+1):
        if i - j < 0:
            continue
        dp[i] = chmin(dp[i], dp[i-j] + abs(H[i] - H[i-j]))
        

print(dp[N-1])

Measured memory_bytes: 55648
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)a;i<(int)b;++i)
int main(){
  string s;cin>>s;
  rep(i,s.size())if(s[i]==',')s[i]=' ';
  cout<<s<<endl;
    return 0;
}

Measured memory_bytes: 256
package main

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

var sc *bufio.Scanner

func nextInt() int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return i
}
func makeList(n int) []int {
	t := make([]int, n)
	for i := 0; i < n; i++ {
		t[i] = nextInt()
	}
	return t
}
func max(a int, b int) int {
	if a < b {
		return b
	} else {
		return a
	}
}
func min(a int, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}

func main() {
	sc = bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)

	N := nextInt()
	A := makeList(N)

	lmax := make([]int, N)
	lmax[0] = A[0]
	for n := 1; n < N; n++ {
		lmax[n] = max(lmax[n-1], A[n])
	}

	rmax := make([]int, N)
	rmax[0] = A[N-1]
	for n := 1; n < N; n++ {
		rmax[n] = max(rmax[n-1], A[N-n-1])
	}
	sort.Sort(sort.Reverse(sort.IntSlice(rmax)))

	allmax := []int{}
	allmax = append(allmax, rmax[1])
	for n := 0; n < N-2; n++ {
		allmax = append(allmax, max(lmax[n], rmax[n+2]))
	}
	allmax = append(allmax, lmax[N-2])

	for _, n := range allmax {
		fmt.Println(n)
	}
}


Measured memory_bytes: 13952
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repo(i,n) for(int i = 1; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
#define np next_permutation
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define pi acos(-1.0)
const ll INF = 1LL<<61;
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 (b<a) { a=b; return 1; } return 0; }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }
ll jou(ll N, ll P){if(P==0) return 1;
  if(P%2==0){ll t = jou(N, P/2);return t*t % mod;
  }return (N * jou(N, P-1)) % mod;}  //jou(n,mod-2)で逆元
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'大文字'+=32;    で小文字に
//  cout << fixed << setprecision (20);   小数点以下2０桁まで
//実行時間制約2秒では２×10^8回くらいまで計算できる





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

  int ans=0;
  int l,r;

  rep(i,n){
    cin>>l>>r;
    ans+=r-l+1;
  }

  cout << ans << endl;
}

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

using namespace std;
using ll = long long;

long double getArc(int h, int m) {
    // 何度回ったか
    double arc_m = m * 360.0 / 60.0;
    double arc_h = (h * 60 + m) * 360.0 / (12.0 * 60.0);

    while( arc_h >= 360.0 ) {
    arc_h -= 360;
    }

    if( arc_m > arc_h )
        return arc_m - arc_h;
    else
        return arc_h - arc_m;
}


int main(int argc, char const *argv[]) { int a, b, h, m;
  cin >> a >> b >> h >> m;
  long double ang = getArc(h, m);

  cout << fixed << setprecision(20) << sqrtl(a*a + b*b - 2 * a * b * cosl(ang * (M_PI / 180.0))) << endl;
  return 0;
}


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

int main() {
  int N;
  cin >> N;
  vector<string>vec(N);
  cin >> vec[0];
  for(int i=1; i<N; i++){
    cin >> vec[i];
    string a = vec[i],b = vec[i-1];
    if(a[0] != b[b.size()-1]){
      cout << "No" << endl;
      return 0;
    }
  }
  sort(vec.begin(),vec.end());
  for(int i=0; i<N-1; i++){
    if(vec[i] == vec[i+1]){
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
}


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

int main(){
    string in;
    cin >> in;
    string out;
    for(int i=0;i<in.size();i++){
        if(in[i] == '0'){
            out.push_back('0');
        }
        else if(in[i] == '1'){
            out.push_back('1');
        }
        else{
            if(!out.empty()){
                out.pop_back();
            }
        }
    }
    cout << out << endl;
    return 0;
}

Measured memory_bytes: 256
import sys
import math
from collections import deque
import heapq
import itertools
from decimal import Decimal
MAX_INT = int(10e25)
MIN_INT = -MAX_INT
mod = 1000000000+7
sys.setrecursionlimit(1000000)
def IL(): return list(map(float,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

a,b = SL()

a = int(a)
b = Decimal(b)
ans = int(a*b)

print(ans)

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

int main() {
	vector<vector<char>> a(3,vector<char>(2,0));
	for(int i = 0;i<3;i++)
	{
		for(int j = 0;j < 2;j++)
		{
			cin >> a.at(i).at(j);
		}
	}
	string k = "YES";
	for(int i =0;i<3;i++)
	{
		if(a.at(i).at(0) != a.at(2-i).at(1))
		{
			k = "NO";
		}
	}
    cout << k << endl;
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<vector>
#include<map>
#include<set>
#include<algorithm>
#include<numeric>
#include<limits>
#include<bitset>
#include<functional>
#include<type_traits>
#include<queue>
#include<stack>
#include<array>
#include<random>
#include<utility>
#include<cstdlib>
#include<ctime>

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;}

#define rep(i,n) for(int i=0;i<(int)n;i++)
#define rep2(i, begin_i, end_i) for (int i = (int)begin_i; i < (int)end_i; i++)

long long INF = 1LL<<60;
long long dp[100010];
int h[100010];
int main(){
    string w;
    cin>>w;
    rep(i,w.size())
    {
        if(w.at(i)<'a'||w.at(i)>'z'){
            cout<<"No"<<endl;
            return 0;
        }
        h[w.at(i)-'a']++;
    }
    rep(i,26){
    if(h[i]%2){
        cout<<"No"<<endl;
return 0;}
    }
    cout<<"Yes"<<endl;
    return 0;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i) = 0; (i) < (n); ++(i))
#define rrep(i,n) for(int (i) = (n) - 1; (i) >= 0; --(i)) //Reversi rep
#define nfor(i,a,b) for(int (i) = (a); (i) < (b); ++(i)) //Natural for
#define rfor(i,a,b) for(int (i) = (b); (i) >= (a); --(i)) //Reversi for
#define ll long long
#define mod (1000000007)
#define YES cout << "YES" << endl;
#define Yes cout << "Yes" << endl;
#define yes cout << "yes" << endl;
#define NO cout << "NO" << endl;
#define No cout << "No" << endl;
#define no cout << "no" << endl;

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

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

int main()
{
    int n,cnt,ans = 0;
    cin >> n;
    for(int i = 1;i <= n;i += 2){
        cnt = 0;
        nfor(j, 1, i + 1){
            if (i % j == 0) {
                ++cnt;
            }
        }
        if (cnt == 8) {
            ++ans;
        }
    }
    cout << ans << endl;
    return 0;
}


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

int main() {
  int64_t H, W;
  cin >> H >> W;
  if(H==1 || W==1){
    cout << 1 <<endl;
}else{
  int64_t count=0;
  if(H*W%2==0)
    count=H*W/2;
  else
    count=H*W/2+1;
  cout << count << endl;
  }
}

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

int main(){
  string s;
  cin >> s;
  if( s.at(0) != s.at(1) || s.at(0) != s.at(2) || s.at(1) != s.at(2) ){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;

  }
  return 0;
}


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

ll r(ll x, ll y) {
  if (y == 0) return 1;
  else if (y % 2 == 0) return r(x, y/2) * r(x, y/2) % mod;
  else return x * r(x, (y-1)/2) % mod * r(x, (y-1)/2) % mod;
}
  
int main() {
  int n, k;
  cin >> n >> k;
  if (n == k) cout << "Yes" <<endl;
  else cout << "No" <<endl;
} 

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,m;
  cin>>n>>m;
  char ma[55][55];
  for(int i=0;i<55;i++)
   for(int j=0;j<55;j++)
     ma[i][j]='.';
  
  for(int i=1;i<=n;i++)
    for(int j=1;j<=m;j++)
      cin>>ma[i][j];
  int f=0;
  int dx[4]={0,0,-1,1};
  int dy[4]={-1,1,0,0};
  for(int i=1;i<=n;i++){
    for(int j=1;j<=m;j++){
      if(ma[i][j]=='#'){
	int d=0;
	for(int k=0;k<4;k++){
	  if(ma[i+dx[k]][j+dy[k]]=='#')d=1;
	}
	if(!d)f=1;
      }
    }
  }
  cout<<(f?"No":"Yes")<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <string>

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (a); i > (b); i--)
#define ALL(a) (a).begin(), (a).end()

int main() {
    int N;
    cin >> N;
    string ans = N == 0 ? "0" : "";
    while (N != 0) {
        if (N % 2 == 0) {
            ans = "0" + ans;
        }
        else {
            ans = "1" + ans;
            N--;
        }
        N /= -2;
    }
    cout << ans << endl;
}

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

using namespace std;
int main(){
  long long int N;
  cin >> N;
  vector<long long int> H(N);
  for(int  i = 0; i < N; i++) cin >> H[i];
    long long int count = 0;
    long long int max = -100;
  for(int i = 0; i < N - 1; i++){

      if(H[i] >= H[i + 1]) count++;
      else{ if(max < count){ max = count; } count = 0; }
  }

  if(max < count) max = count;

  cout << max << endl;
 return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
 
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repi(i, s, n) for (int i = s; i < (int)(n); i++)
#define print(a) cout << (a) << endl; 
typedef long long ll;
const int MOD = 1000000007; 

int main() {
    int a, b, c;
    cin >> a >> b >> c;
    cout << c << " ";
    cout << a << " ";
    cout << b << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;;
#define rep(i, n) for(int i = 0;i < n;i++)
#define repr(i, n) for(int i = n;i >= 0;i--)
#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 INF 1<<30
#define LINF 1LL<<62
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define pb push_back
const int MOD = 1000000007;
 
typedef long long ll;
typedef long double ld;
typedef vector<ll> vl;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;

ll po(ll x){
  return x*x*x*x*x;
}
int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll x;cin >> x;
  FOR(i,-1000,1001){
    FOR(j,-1000,1001){
      if(po(i) - po(j)==x){
        cout <<i << " " << j <<endl;
        return 0;
        
      }
    }
  }
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int n,l,t,x[123456],w[123456],lp[123456];
int main()
{
	scanf("%d%d%d",&n,&l,&t);
	ll cs=0;
	for(int i=0;i<n;i++)
	{
		scanf("%d%d",x+i,w+i);
		if(w[i]==1)
		{
			lp[i]=(x[i]+t)%l;
			cs+=(x[i]+t)/l%n;
		}
		else
		{
			lp[i]=((x[i]-t)%l+l)%l;
			if(x[i]-t<0) cs-=(t-x[i]+l-1)/l%n;
		}
	}
	sort(lp,lp+n); cs=(cs%n+n)%n;
	for(int i=0;i<n;i++)
		printf("%d\n",lp[(i+cs)%n]);
}


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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
typedef vector<vpii> vvpii;

#define mt make_tuple
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sqr(x) ((ll)(x) * (x))

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

    ll a, b;
    cin >> a >> b;

    ll nzd = __gcd(a, b);

    vi v;

    for(ll i = 2; i * i <= nzd; ++i)
    {
        bool jelUsao = false;

        while(nzd % i == 0)
        {
            jelUsao = true;
            nzd /= i;
        }

        if(jelUsao)v.pb(i);
    }

    if(nzd > 1)v.pb(nzd);

    cout << 1LL + (ll)v.size() << '\n';

    return 0;
}


Measured memory_bytes: 256
n=int(input())
s=[]

for i in range(n):
  a,b=map(str,input().split())
  b=int(b)
  s.append([a,100-b,i+1])
  
s.sort(key=lambda x:(x[0],x[1]))
#print(s)

for i in range(n):
  print(s[i][2])

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

typedef struct{
  double x,y;
} point;

void koch(int N, point a, point b)
{
  point l, m, n;
  double d = M_PI * 60.0 / 180.0;
  
  if (N == 0)
    return;
  l.x = (2.0*a.x + 1.0*b.x) / 3.0;
  l.y = (2.0*a.y + 1.0*b.y) / 3.0;
  m.x = (1.0*a.x + 2.0*b.x) / 3.0;
  m.y = (1.0*a.y + 2.0*b.y) / 3.0;
  n.x = (m.x-l.x) * cos(d) - (m.y - l.y) * sin(d) + l.x;
  n.y = (m.x-l.x) * sin(d) + (m.y - l.y) * cos(d) + l.y;
  koch(N-1,a,l);
  printf("%.8f %.8f\n",l.x,l.y);
  koch(N-1,l,n);
  printf("%.8f %.8f\n",n.x,n.y);
  koch(N-1,n,m);
  printf("%.8f %.8f\n",m.x,m.y);
  koch(N-1,m,b);
}
 
int main()
{
  point a, b;
  int n;

  scanf("%d",&n);
  a.x = 0;
  a.y = 0;
  b.x = 100;
  b.y = 0;
  printf("%.8f %.8f\n",a.x,a.y);
  koch(n,a,b);
  printf("%.8f %.8f\n",b.x,b.y);

  return 0;
}



Measured memory_bytes: 2112
def poly_divide(f, g):
    n = len(g)
    a, b = f
    q = [0]*(n-1)
    r = 0
    q[-1] = g[-1]*inv[b%p]%p
    for i in range(n-2)[::-1]:
        q[i] = (g[i+1]-q[i+1]*a)*inv[b%p]%p
    r = g[0]-q[0]
    return q, r
  
def poly_product(f, g):
    n, m = len(f), len(g)
    res = [0]*(n+m-1)
    for i in range(n):
        for j in range(m):
            res[i+j]+=g[j]*f[i]
            res[i+j]%=p
    return res
def assign(f, x):
    tmp = 1
    res = 0
    n = len(f)
    for i in range(n):
        res+=f[i]*tmp
        tmp*=x
        tmp%=p
        res%=p
    return res
def c_mul(c, f):
    n = len(f)
    for i in range(n):
        f[i]*=c
        f[i]%=p
    return f
def poly_add(f, g):
    n = len(g)
    for i in range(n):
        f[i]+=g[i]
        f[i]%=p
    return f


p = int(input())
a = list(map(int, input().split()))
inv = [0]*p
P = [1]
for i in range(p):
    inv[i] = pow(i, p-2, p)
for i in range(p):
    b = [-i, 1]
    P = poly_product(b, P)
R = [0]*p
for i in range(p):
    b = [-i, 1]
    Q, _ = poly_divide(b, P)
    v = assign(Q, i)
    Q=c_mul(inv[v%p]*a[i], Q)
    R = poly_add(R, Q)
print(*R)
    
    







Measured memory_bytes: 48988
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> lpair;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i = (m); i < (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define print2(x,y) cout << (x) << " " << (y) << endl;
#define printa(x,n) for(ll i = 0; i < n; i++){ cout << (x[i]) << " ";} cout<<endl;
inline ll gcd(ll a,ll b){return b?gcd(b,a%b):a;} //最大公約数
inline ll lcm(ll a,ll b){return a/gcd(a,b)*b;} //最小公倍数
inline vector<ll> divisor(ll M){ //約数の全列挙
    vector<ll> dd;
    for(ll i = 1; i*i <= M; i++){
        if(M % i == 0){
            dd.push_back(i);
            if(i * i != M){
                dd.push_back(M/i);
            }
        }
    }
    sort(dd.begin(), dd.end());
    return dd;
}
inline vector<ll> factor(ll M){ //素因数分解
    vector<ll> dd;
    if(M == 1){
        dd.push_back(1);
        return dd;
    }
    for(ll i = 2; i*i <= M; i++){
        while(M % i == 0){
            dd.push_back(i);
            M /= i;
        }
    }
    if(M != 1) dd.push_back(M);
    sort(dd.begin(), dd.end());
    return dd;
}
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N;
    cin >> N;
    vector<ll> dd = divisor(N);
    // sort(dd.begin(), dd.end(), greater<ll>());
    ll ans = 0;
    rep(i,0,dd.size()){
        ll k = N / dd[i];
        if(k > 0 && dd[i]-1 > 0 && dd[i]-1 > k ) ans += dd[i]-1;
    }
    print(ans);

    
}

Measured memory_bytes: 384
import sys

readline = sys.stdin.readline

class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1]*n
        self.rank = [0]*n
    
    def find(self, 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 = self.find(x)
        y = self.find(y)

        if x == y:
            return
        
        if self.rank[x] < self.rank[y]:
            self.parents[x] = y
        else:
            self.parents[y] = x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1

def main():
    n, q = map(int, readline().split())
    uf = UnionFind(n)
    for _ in range(q):
        com, x, y = map(int, readline().split())
        if com == 0:
            uf.union(x, y)
        else:
            px = uf.find(x)
            py = uf.find(y)
            print((px == py)*1)


if __name__ == "__main__":
    main()



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

int main() {
  int64_t a,b,k;
  cin>>a>>b>>k;

  if(a>=k) cout<<a-k<<' '<<b<<endl;
  else if(a+b>=k) cout<<0<<' '<<a+b-k<<endl;
  else cout<<0<<' '<<0<<endl;

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;



ll n, m, k;

vector<set<int>> frnd;
vector<set<int>> block;
vector<int> group;
vector<set<int>> group_to_nodes;

void dfs( int node, int parent_node, int group_id ){
	group[node] = group_id;
	group_to_nodes[group_id].insert(node);
	
	for ( auto next_node : frnd[node] ){
		if ( next_node == parent_node )
			continue;
		if ( group[next_node] )
			continue;
		dfs(next_node, node, group_id);
	}
}

int main(){
	cin >> n >> m >> k;
	
	frnd.resize(n);
	block.resize(n);
	group.resize(n);
	
	
	for ( int i = 0; i < m; i++ ){
		int a, b;
		cin >> a >> b;
		a--;
		b--;
		frnd[a].insert(b);
		frnd[b].insert(a);
	}
	
	for ( int i = 0; i < k; i++ ){
		int c, d;
		cin >> c >> d;
		c--;
		d--;
		block[c].insert(d);
		block[d].insert(c);
	}
	
	// グループ分けをする
	{
		int group_id = 1;
		group_to_nodes.resize(n+1);
		for ( int i = 0; i < n; i++ ){
			if ( group[i] == 0 )
				dfs( i, -1, group_id++ );
		}
	}
	
	// 候補の人数 = グループの人数 - 友達の人数 - 自分の人数 - ブロックかつグループ内の人数
	for ( int i = 0; i < n; i++ ){
		int group_id = group[i];
		int result = group_to_nodes[group_id].size() - frnd[i].size() - 1;
		
		
		for ( auto it : block[i] ){
			if ( group_to_nodes[group_id].count(it) != 0 )
				result--;
		}
		cout << result << " ";
	}
	cout << endl;
	
	return 0;
}



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


using namespace std;


#define ll long long
#define mk make_pair
#define pb push_back
#define fi first
#define se second
#define all(x) x.begin(), x.end()
#define sz(x) (int) (x).size()


ll sum(int n);


void go(){
	char c;cin>>c;
	if(isupper(c)) cout << 'A';
	else cout << 'a';
} 
int main(){
   
   ios_base::sync_with_stdio(0);
   cin.tie(0);
   cout.tie(0);

   go();

   return 0;
}

ll sum(int n){                
   if(n == 0){
      return n;
   }else{
      return sum(n/10) + n%10;
   }
}


Measured memory_bytes: 3660
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define MAX(a,b) (a > b) ? a : b
#define MIN(a,b) (a < b) ? a : b
const int inf = 1000000000; // 10^9

int main(){
   char s[27];scanf("%s",s);
   for(int i = 0;i < strlen(s);i++){
      for(int j = i+1;j < strlen(s);j++){
         if(s[i] == s[j]){
            printf("no\n");
            return 0;
         }
      }
   }
   printf("yes\n");
   return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <math.h>
using namespace std;

bool isPrime(int n){
	if(n <= 1){
		return false;
	}
	for(int i = 2; i*i <= n; i++){
		if(n%i == 0){
			return false;
		}
	}
	return true;
}

int main(){
	int n;
	while(cin >> n){
		if(n==0){
			break;
		}
		int cnt=0,ans=0,j=0;
		while(n>cnt){
			if(!isPrime(j)){
				j++;
				continue;
			}
			ans+=j;
			j++;
			cnt++;
		}
		cout<<ans<<endl;
	}
	return 0;
}


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

int main(){
  int num;
  int kekka = 0;
  int renBonus = 0;
  
  cin >> num;
  
  vector<int> vecTurn(num);
  vector<int> vecRyori(num);
  vector<int> vecBonus(num,0);
  
  for(int i = 0; i < num; i++) cin >> vecTurn.at(i);
  for(int i = 0; i < num; i++) cin >> vecRyori.at(i);
  for(int i = 0; i < num; i++) cin >> vecBonus.at(i);
  
  for(int i = 0; i < num; i++){
    kekka += vecRyori.at(vecTurn.at(i)-1);
    if(i >= 1 && vecTurn.at(i) == vecTurn.at(i-1) + 1){
      kekka += vecBonus.at(vecTurn.at(i)-2);
    }
  }
  
  cout << kekka;
}

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

int main() {
  string in, s;
  int i = 0,j = 0;
  cin >> s;

  while (cin >> in) {
    if (in == "END_OF_TEXT") {
      break;
    }

    for (j = 0; j < in.size(); j++) {
      in[j] = tolower(in[j]);
    }

    if (s == in) {
      i++;
    }
  }
  cout << i << endl;
  return 0;
}

Measured memory_bytes: 1192
#define rep(i,a,b) for (int i = (a); i < (b); i++)
#define _USE_MATH_DEFINES
#include <iostream>
#include <stdio.h>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <functional>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <math.h>
#include <complex>
#include <cassert>
using namespace std;
typedef long long int ll;
typedef complex<double> com;
const int mod = 1e9 + 7;
const int MOD = 998244353;
const ll INF = 1e18;



int main() {
	int n; cin>>n;
	vector<int> a(n),b(n),c(n);
	rep(i,0,n) cin>>a[i];
	rep(i,0,n) cin>>b[i];
	rep(i,0,n) cin>>c[i];
	sort(a.begin(),a.end());
	sort(c.begin(),c.end());
	ll ans=0;
	rep(i,0,n){
		ans+=(lower_bound(a.begin(),a.end(),b[i])-a.begin())*(n-(upper_bound(c.begin(),c.end(),b[i])-c.begin()));
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 1408
#include<stdio.h>
int main(void){
  long int A, B, AA, BB, K = 0;
  scanf("%ld %ld %ld", &A,&B,&K);
  if((K-A)>=0){
    AA=0;
    if(B>(K-A)){
      BB=B-K+A;
    }else{
      BB=0;
    }
  }else{
    AA=A-K;
    BB=B;
  }
  printf("%ld %ld",AA,BB);
  return 0;
}

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

int main(){
    int N;
    cin >> N;
    string S[100009];
    long long headname[5];
    for (int i = 0; i < 5; i++){
        headname[i] = 0;
    }
    for (int i = 0 ; i < N; i++){
        cin >> S[i];
        if (S[i][0] == 'M') headname[0]++;
        else if (S[i][0] == 'A') headname[1]++;
        else if (S[i][0] == 'R') headname[2]++;
        else if (S[i][0] == 'C') headname[3]++;
        else if (S[i][0] == 'H') headname[4]++;
    }
    long long counter = 0;
    for (int i = 0; i < 5; i++){
        for (int j = 0; j < i; j++){
            for (int k = 0; k < j; k++){
                counter += headname[i] * headname[j] * headname[k];
            }
        }
    }
    cout << counter << endl;
    return 0;
}

Measured memory_bytes: 6144
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<ll, pair<ll, ll> > P3;
const ll MOD = ll(1e9)+7;
const int IINF = INT_MAX;
const ll LLINF = LLONG_MAX;
const int MAX_N = int(2e5 + 5);
const double EPS = 1e-10;
const int di[] = {0, 1, 0, -1}, dj[] = {1, 0, -1, 0};
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define SORT(v) sort((v).begin(), (v).end())
#define ALL(v) (v).begin(), (v).end()

int main() {
    int n;
    string s="", s0;
    cin >> n;
    int l = 1, r = n;
    cout << 0 << endl;
    cin >> s;
    s0 = s;
    while(s!="Vacant"){
        int mid = (l+r)/2;
        cout << mid << endl;
        cin >> s;
        if(mid%2){
            if(s==s0) r = mid;
            else l = mid;
        }
        else{
            if(s==s0) l = mid;
            else r = mid;
        }
    }
    return 0;
}

Measured memory_bytes: 852
#include<bits/stdc++.h>
using namespace std;
int main()
{
	long n,m;
	cin>>n>>m;
	int a[m];
	for(int i=0;i<m;i++)
	{
		cin>>a[i];
	}
	for(int i=0;i<m;i++)
	{
		n-=a[i];
		if(n<0)
        {
		    cout<<"-1";
		    return 0;
	    }	
	}
	cout<<n;
	return 0;
}

Measured memory_bytes: 3656
#include<bits/stdc++.h>
#define endl '\n'
#define INF ((1 << 31) - 1)
#define ALL(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;
const int MOD = 1000000007;
using namespace std;
ll dpt[105][100005];
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, W;
  int w[105], v[105];
  int ans = -1;

  fill(dpt[0], dpt[105], INF);

  cin >> n >> W;
  for(int i = 0;i < n;i++){
    cin >> w[i] >> v[i];
  }

  dpt[0][0] = 0;
  for(int i = 0;i < n;i++){
    for(int j = 0;j <= 100 * 1000;j++){
      if(j >= v[i]){
	dpt[i + 1][j] = min(dpt[i + 1][j], dpt[i][j - v[i]] + w[i]);
      }
      dpt[i + 1][j] = min(dpt[i][j], dpt[i + 1][j]);
    }
  }
  
  for(int j = 100 * 1000;j > 0 && ans < 0;--j){
    if(dpt[n][j] <= W){
      ans = j;
    }
  }

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


Measured memory_bytes: 82304