akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<algorithm>
#include<vector>
#include<numeric>
#include<utility>
using namespace std;
using ll = long long int;

ll n;
vector<pair<ll, ll>> ab;

int main(void) {
	cin >> n;
	for (size_t i = 0; i < n; i++) {
		ll ai, bi;
		cin >> ai >> bi;
		ab.emplace_back(ai, bi);
	}
	sort(ab.begin(), ab.end(), [](const pair<ll, ll> & x, const pair<ll, ll> & y) {return x.second < y.second;});
	ll time = 0;
	string ret = "Yes";
	for (int i = 0; i < n; i++) {
		time += ab[i].first;
		if (time > ab[i].second) {
			ret = "No";
			break;
		}
	}
	cout << ret << endl;
	return 0;
}

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

int main() {
  int x,ans = 0,sum = 0;
  cin >> x;
  while(true){
    if(sum%360 == 0 && sum >= 360){
      cout << ans << endl;
      return 0;
    }
    sum += x;
    ans++;
  }
}

Measured memory_bytes: 3628
n = int(input())

ans = [0] * (10 ** 4 + 1)
for x in range(1, 101):
    for y in range(1, 101):
        for z in range(1, 101):
            s = x * x + y * y + z * z + x * y + y * z + z * x
            if s <= 10 ** 4:
                ans[s] += 1

for i in range(1, n + 1):
    print(ans[i])


Measured memory_bytes: 9184
#include <iostream>

#define int long long

using namespace std;

const int N = 2e5 + 10;

int l[N], r[N], now[N], p[N];

int32_t main()
{
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);    
    int n, k;
    cin >> n >> k;
    for (int i = 1; i <= n; ++i)
    {
        cin >> p[i];
        if (p[i])
        {
            ++l[max(1LL, i - p[i])];
            ++r[min(n + 1, i + p[i] + 1)];
        }
    }
    for (int i = 0; i < k; ++i)
    {
        int tot = 0;
        for (int i = 1; i <= n; ++i)
        {
            tot += l[i] - r[i];
            now[i] = tot + !p[i];
        }
        int c = 0;
        for (int i = 1; i <= n; ++i) l[i] = r[i] = 0;
        for (int i = 1; i <= n; ++i) 
        {
            if (now[i] == p[i]) ++c;
            p[i] = now[i];
            if (p[i])
            {
                ++l[max(1LL, i - p[i])];
                ++r[min(n + 1, i + p[i] + 1)];
            }
        }
        if (c == n) break;
    }
    for (int i = 1; i <= n; ++i) cout << now[i] << ' ';
    return 0;
}


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

#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <algorithm>

#include <bits/stdc++.h>
#include <cmath>
#include <limits>

using namespace std;

const int MAX = 50000;
const int P = 1000000007; //shuoud be prime

long long fac[MAX], finv[MAX], inv[MAX];

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

long long COMB(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % P) % P;
}

long long N, K;

int main(int argc, char* argv[]){
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	cin >> N >> K ;
	COMBinit();

	printf("%lld\n", N-K+1);
	for(int i=2; i<=K; i++){
		long long a, b;
		b = COMB(K-1, i-1);
		a = 0;
		for(int j=i-1; j <= N-K; j++){
			a += COMB(j-1, i-2)*(N-K-j+1);
			a %= P;
		}
		printf("%lld\n", (a*b)%P);
	}
	return 0;
}

Measured memory_bytes: 4892
N,K = map(int, input().split())
L,R = [0]*K, [0]*K

count = 0
for _ in range(K):
    a,b = map(int, input().split())
    for _1 in range(_):
        x,y = L[_1],R[_1]
        if x <= a <= y or x <= b <= y :
            L[_1] = min(a,x)
            R[_1] = max(b,y)
            break
    else:
        L[_],R[_] =a,b
        count += 1
L,R = L[0:count+1],R[0:count+1]

MOD = 998244353
dp = [0]*(4*10**5+100)
for l, r in zip(L, R):
    dp[min(N + 1, 1 + l)] += 1
    dp[min(N + 1, 1 + r + 1)] -= 1

for i in range(2,N+1):
    number = dp[i-1] + dp[i]
    if number > MOD:
        number -= MOD
    dp[i] = number
    for l, r in zip(L,R):
        dp[i + l] += number
        dp[i + l] %= MOD
        dp[i + r +1] -= number
        dp[i + r +1] %= MOD

print(dp[N]%MOD)

Measured memory_bytes: 24272
#include<stdio.h>
int main()
{
	int a;
	scanf("%d",&a);
	if(a==1)
	printf("1");
	else if(a==2||a==3)
		printf("2");
	else if(a>3&&a<8)
		printf("4");
	else if(a>7&&a<16)
		printf("8");
	else if(a>15&&a<32)
		printf("16");
	else if(a>31&&a<64)
		printf("32");
	else printf("64");
	return 0;
}

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

const int N = 100 * 1001, inf = 1e9 + 7;
int h[N], dp[N], n, k;

int main() {
	cin >> n >> k;
	for (int i = 0; i < n; i++) {
		cin >> h[i];
		dp[i] = inf;
	}
	dp[n - 1] = 0;
	for (int i = n - 2; 0 <= i; i--)
		for (int j = 1; j <= k; j++)
			if (i + j < n)
				dp[i] = min(dp[i], dp[i + j] + abs(h[i + j] - h[i]));
	cout << dp[0] << endl;
}
		
	

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,c,d,e,f,g,h,j,i;
    string s;
    map<char,int>m;
    cin>>s;
    map<char,int>::iterator it;
    for(i=0; i<s.size(); i++)
    {
        m[s[i]]++;
    }
    c=0;
    for(it=m.begin(); it!=m.end(); it++)
    {
        if((*it).second>1)
        {
            c=1;
            break;
        }
    }
    if(c==1)
    {
        cout<<"no"<<endl;
    }
    else
    {
        cout<<"yes"<<endl;
    }
    m.clear();
    return 0;
}


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

void print_vec(vector<int> vec)
{
  cout << "[";
  for (int i = 0; i < vec.size(); i++)
  {
    cout << vec.at(i);
    if (i < vec.size() - 1)
    {
      cout << ", ";
    }
  }
  cout << "]...size: " << vec.size() << endl;
}

int main()
{
  double r;
  cin >> r;
  double pi = 3.141592653589;
  double area = pi * r * r;
  double circumference = 2 * pi * r;

  printf("%f %f\n", area, circumference);
}



Measured memory_bytes: 3288
#include <bits/stdc++.h>
 
#define llint long long int
 
using namespace std;
 
int main()
{
    string N;
 
    cin >> N;
 
    int count = 0;
 
    for (int i = 0; i < N.length(); i++)
    {
        count += (N[i] - '0');
    }
    if (count % 9 == 0)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 3736
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Feb 10 10:05:08 2019

@author: shinjisu
"""


# ARC 076 C
def getInt(): return int(input())


def getIntList(): return [int(x) for x in input().split()]


def zeros(n): return [0]*n


def dmp(x):
    global debug
    if debug:
        print(x)
    return x


def probC():
    N = getInt()
    A = getIntList()
    dmp((N, A))
    maxA = max(A)
    dmp(maxA)
    b = zeros(maxA+3)
    for i in range(N):
        b[A[i]] += 1
        b[A[i]+1] += 1
        b[A[i]+2] += 1
    dmp(b)
    return dmp(max(b))


debug = False  # True False
print(probC())

def probCTLE2():
    N = getInt()
    A = getIntList()
    dmp((N, A))
    hist = zeros(10**5)
    for i in range(N):
        if A[i] in hist:
            hist[A[i]] += 1
        else:
            hist[A[i]] = 1
    #dmp(hist)
    mxCnt = 1
    #keylist = list(hist.keys())
    #mxKey = max(keylist)
    # dmp(mxKey)
    for k in range(10**5-2):
        cnt = hist[k] + hist[k+1] + hist[k+2]
        mxCnt = max(mxCnt, cnt)
    return mxCnt


def probCTLE():
    N = getInt()
    A = getIntList()
    dmp((N, A))
    hist = {}
    for i in range(N):
        if A[i] in hist:
            hist[A[i]] += 1
        else:
            hist[A[i]] = 1
    dmp(hist)
    mxCnt = 1
    keylist = list(hist.keys())
    mxKey = max(keylist)
    dmp(mxKey)
    for k in hist.keys():
        cnt = 0
        if k-1 in keylist:
            cnt += hist[k-1]
        if k in keylist:
            cnt += hist[k]
        if k+1 in keylist:
            cnt += hist[k+1]
        mxCnt = max(mxCnt, cnt)
        dmp(('max',mxCnt))
    return mxCnt


def probCWA():
    N = getInt()
    A = getIntList()
    dmp((N, A))
    hist = {}
    for i in range(N):
        if A[i] in hist:
            hist[A[i]] += 1
        else:
            hist[A[i]] = 1
    dmp(hist)
    mxCnt = 1
    keylist = list(hist.keys())
    mxKey = max(keylist)
    dmp(mxKey)
    for i in range(mxKey-1):
        cnt = 0
        if i in keylist:
            cnt += hist[i]
        if i+1 in keylist:
            cnt += hist[i+1]
        if i+2 in keylist:
            cnt += hist[i+2]
        mxCnt = max(mxCnt, cnt)
        dmp(('max',mxCnt))
    return mxCnt


Measured memory_bytes: 13952
#include<bits/stdc++.h>
using namespace std;
struct node{
  node *prev;
  int key;
  node *next;
};
node L;
node *nil=&L;
 
node* find(int x){
  node *i;
  for(i=nil;i->next->key!=x&&i->next!=nil;i=i->next);
  return i->next;
}
void del(int x){
  node *a;
  if(x==-1)a=nil->next;
  else if(x==-2)a=nil->prev;
  else a=find(x);
  if(a==nil)return;
  a->prev->next=a->next;
  a->next->prev=a->prev;
  free(a);
}
void in(int x){
  node *a;
  a=(node *)malloc(sizeof(node));
  a->next=nil->next;
  nil->next->prev=a;
  nil->next=a;
  a->prev=nil;
  a->key=x;
}
int main(){
  int n;
  string s;
  L.prev=nil,L.next=nil;
  scanf("%d\n",&n);
  while(n--){
    getline(cin,s);
    int t=0;
    for(int i=7;i<s.size();i++)t*=10,t+=s[i]-'0';
    if(s[0]=='i')in(t);
    else{
       if(s[6]=='F')del(-1);
      else if(s[6]=='L')del(-2);
      else del(t);
    } 
  }
  node *i;
  for(i=nil;i->next->next!=nil;i=i->next)cout<<i->next->key<<' ';
  cout<<i->next->key<<endl;
  return 0;
}


Measured memory_bytes: 34472
#include <stdio.h>
#include <iostream>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <math.h>
#include <algorithm>
using namespace std;
#define ll long long
const double EPS = 1e-10;
const ll MOD = 7+(1e+9);

int main (){
  char n;
  cin>>n;
  switch(n){
    case 'A':
      cout<<'T'<<endl;
      break;
      case 'T':
        cout<<'A'<<endl;
        break;
        case 'C':
          cout<<'G'<<endl;
          break;
          case 'G':
            cout<<'C'<<endl;
            break;
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <string>
#include <cstring>
#include <cmath>
#include <complex>
#include <map>
#include <climits>
#include <sstream>
using namespace std;

#define reep(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) reep((i),0,(n))
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define EPS 1e-8
#define F first
#define S second
#define mkp make_pair

static const double PI=6*asin(0.5);
typedef long long ll;
typedef complex<double> CP;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vint;
static const int INF=1<<24;

template <class T>
void initvv(vector<vector<T> > &v,int a,int b, const T  &t = T()){
	v.assign(a,vector<T>(b,t));
}

//v.erase(unique(v.begin(),v.end()),v.end());


int main(){
	int n,k;
	while(cin>>n>>k,n||k){
		vint s1(k,0),s2(k,0);
		rep(i,k){
			cin>>s1[i];
		}
		rep(i,n){
			rep(j,k){
				int t;
				cin>>t;
				s2[j]+=t;
			}
		}
		bool f=false;
		rep(i,k){
			if(s1[i]<s2[i]){
				cout<<"No\n";
				f=true;
				break;
			}
		}
		if(!f) cout<<"Yes\n";
	}
}

Measured memory_bytes: 1156
# -*- coding:utf-8 -*-


def Palace():
    input()
    T, A = [int(n) for n in input().split()]
    candidate = [int(n) for n in input().split()]

    index = 1
    _min = float('inf')
    for i, elevation in enumerate(candidate, start=1):
        temp = T - elevation * 0.006
        diff = abs(A - temp)
        if diff < _min:
            _min = diff
            index = i

    print(index)


if __name__ == '__main__':
    Palace()

Measured memory_bytes: 3064
from sys import stdin
from itertools import accumulate
input = stdin.readline
N, M, Q = map(int, input().split())
D = [[0] * (N + 1) for i in range(N + 1)]
for _ in range(M):
    L, R = map(int, input().split())
    D[L][R] += 1
for i in range(N - 1, 0, -1):
    for j in range(i, N + 1):
        D[i][j] += D[i + 1][j]
for i in range(1, N + 1):
    D[i] = list(accumulate(D[i]))
for _ in range(Q):
    p, q = map(int, input().split())
    print(D[p][q])

Measured memory_bytes: 56668
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{

   double n;
   cin>>n;
   double x=(n/1.08);
   double k=ceil(x);
   double kk=k*1.08;
   double mm=floor(kk);
   if(mm==n)
   {
       cout<<k<<endl;
   }
   else
   {
       cout<<":("<<endl;
   }

}



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

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

  int count = 0;
  for (int i = 1; i <= 100; i++)
  {
    if (num[i] != 0)
    {
      count++;
    }
  }

  cout << count << endl;

  return 0;
}

Measured memory_bytes: 256
import std.stdio, std.conv, std.string, std.array, std.range, std.algorithm, std.container;
import std.math, std.random, std.bigint, std.datetime, std.format;
void main(string[] args){ if(args.length > 1) if(args[1] == "-debug") DEBUG = 1; solve(); }
void log()(){ writeln(""); } void log(T, A ...)(T t, lazy A a){ if(DEBUG) write(t, " "), log(a); } bool DEBUG = 0; 
string rstring(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; }
T rtype(T)(){ return rstring.to!T; } alias rint = rtype!int, rlong = rtype!long, rreal = rtype!real;
T[] rtypes(T)(int n){ return n.iota.map!(i => rtype!T()).array; } alias rint = rtypes!int, rlong = rtypes!long, rreal = rtypes!real;
T[][] rtypess(T)(int n, int m){ return n.iota.map!(i => rtypes!T(m)).array; } alias rint = rtypess!int, rlong = rtypess!long, rreal = rtypess!real;
T chmin(T)(ref T x, T y){ if(x > y) x = y; return x; } T chmax(T)(ref T x, T y){ if(x < y) x = y; return x; }

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

void solve(){
	int h = rint, w = rint;
	int[][] as = new int[][](h, w);
	foreach(i; 0 .. h){
		int[] q = rint(w);
		foreach(j; 0 .. w) as[i][j] += q[j];
	}
	foreach(i; 0 .. h){
		int[] q = rint(w);
		foreach(j; 0 .. w){
			as[i][j] -= q[j];
			if(as[i][j] < 0) as[i][j] *= -1;
		}
	}
	int sum = 80 * (h + w - 1);
	log("as:", as);

	bool[][][] xz = new bool[][][](h, w, sum + 1);
	foreach(i; 0 .. h) foreach(j; 0 .. w){
		int a = as[i][j];
		if(i == 0 && j == 0) xz[i][j][a] = 1;
		if(i > 0)foreach(r; 0 .. sum) if(xz[i - 1][j][r]){
			if(r + a <= sum) xz[i][j][r + a] = 1;
			if(r >= a && r - a <= sum) xz[i][j][r - a] = 1;
			if(r < a && a - r <= sum) xz[i][j][a - r] = 1;
		}
		if(j > 0)foreach(r; 0 .. sum) if(xz[i][j - 1][r]){
			if(r + a <= sum) xz[i][j][r + a] = 1;
			if(r >= a && r - a <= sum) xz[i][j][r - a] = 1;
			if(r < a && a - r <= sum) xz[i][j][a - r] = 1;
		}
		//log("i:", i, "j:", j, "ws:", xz[i][j]);
	}

	foreach(r; 0 .. sum + 1){
		if(xz[h - 1][w - 1][r]){
			r.writeln;
			break;
		}
	}
}

Measured memory_bytes: 105596
#include<bits/stdc++.h>
#include<unordered_map>
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#define endl                         '\n'	
#define Ceil(x,y)             ((x+y-1)/y)
#define sz(s)               (int)s.size()
#define RT(x)           return cout<<x,0;
#define mem(x,y)    memset(x,y,sizeof(x))
#define all(v) ((v).begin()), ((v).end())
#define vi                    vector<int>
#define pii                 pair<int,int>
#define watch(x) cout<<(#x)<<" = "<<x<<endl
#define forr(i, n) for (int i = 0; i < int(n); i++)
int dx[] = { 0, 0, 1, -1, 1, -1, 1, -1 };
int dy[] = { 1, -1, 0, 0, -1, 1, 1, -1 };
const double PI = acos(-1), EPS = 1e-7;
const int OO = 0x3f3f3f3f, N = 1e7 + 5, mod = 1e9 + 7;
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
ll gcd(ll x, ll y) { return (!y) ? x : gcd(y, x%y); }
ll lcm(ll x, ll y) { return ((x / gcd(x, y))*y); }
void mansour()
{
	std::ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	cout.tie(NULL);
}
void file()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt" , "r" , stdin) ;
    freopen("output.txt" , "w" , stdout) ;
#endif
}
int mem[100005],n,a[100005],y,mn=LONG_MAX;
int min_path(int ix)
{
	if(ix>=n)
		return 1e10;
	if(ix==n-1)
		return 0;
	if(mem[ix]!=-1)
		return mem[ix];
	int r1=1e10,r2=1e10;
	if(ix+1<n)
		r1=abs(a[ix]-a[ix+1])+min_path(ix+1);
	if(ix+2<n)
		r2=abs(a[ix]-a[ix+2])+min_path(ix+2);
	if(r1<=r2)
		return mem[ix]=r1;
	return mem[ix]=r2;
}
int main()
{
	mansour();
	//file();
	/*The First*/
	memset(mem,-1,sizeof(mem));
	cin>>n;
	for(int i=0;i<n;i++)
		cin>>a[i];
	cout <<min_path(0)<<"\n";
}

Measured memory_bytes: 4224
#include <stdio.h>

#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>

#define N 200010
#define MAX 1000000000000000000
#define MOD 1000000007

#include <stdio.h>

int main (void) {
    int a, b, c, d, takahashi, aoki;

    scanf("%d %d %d %d", &a, &b, &c, &d);

    takahashi = (c + (b - 1)) / b;
    aoki = (a + (d - 1)) / d;

    if (takahashi <= aoki) {
        puts("Yes");
    } else {
        puts("No");
    }

    return 0;
}



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

signed main(){
    // cout << fixed << setprecision(10) << flush;

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

    vector<int> right(n);
    for(int i=0; i<n-1; i++){
        right[i] = x[i+1] - x[i];
    }
    right[n-1] = -1;
    int klim = log2(n) + 1;
    // i から 2^k 右へ行くのにかかる距離、n を超える場合は -1
    vector<vector<int>> kright(klim, vector<int>(n, -1));
    for(int i=0; i<n; i++){
        kright[0][i] = right[i];
    }
    for(int k=1; k<klim; k++){
        for(int i=0; i<n; i++){
            if(i + (1<<k) < n){
                kright[k][i] = kright[k-1][i] + kright[k-1][i+(1<<(k-1))];
            }
            else{
                kright[k][i] = -1;
            }
        }
    }

    vector<int> next_hotel(n);

    auto n_hotel = [&](int s, int l) -> int{
        // l 以下の距離にある最も右のホテル
        // int dis = 0;
        for(int k=klim-1; k>=0; k--){
            if(kright[k][s] != -1){
                if(l >= kright[k][s]){
                    // 右へ 2^k 進める
                    l -= kright[k][s];
                    s += (1<<k);
                }
            }
        }
        return s;
    };
    
    int l, q;   
    cin >> l >> q;
    
    for(int i=0; i<n-1; i++){
        next_hotel[i] = n_hotel(i, l);
    }
    next_hotel[n-1] = -1;

    // m_days_right[k][i] は i から 2^k 日右へ進んだときのホテル
    // 無駄だったときは -1, m_days_right[k][n-1] はいつも -1
    vector<vector<int>> m_days_right(klim, vector<int>(n, -1));
    for(int i=0; i<n; i++){
        m_days_right[0][i] = next_hotel[i];
    }
    for(int k=1; k<klim; k++){
        for(int i=0; i<n; i++){
            if(m_days_right[k-1][i] != -1){
                m_days_right[k][i] = m_days_right[k-1][m_days_right[k-1][i]];
            }
        }
    }

    auto min_days = [&](int a, int b, int l) -> int{
        // a <= b
        int now = a;
        int days = 0;
        // 二分探索
        for(int k=klim-1; k>=0; k--){
            if(m_days_right[k][a] != -1 && b > m_days_right[k][a]){
                a = m_days_right[k][a];
                days += (1<<k);
            }
        }
        return days + 1;
    };

    vector<int> ans(q);
    for(int qq=0; qq<q; qq++){
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        if(a > b) swap(a, b);
        ans[qq] = min_days(a, b, l);
    }
    for(int i=0; i<q; i++){
        cout << ans[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 33868
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
 
#define mod 1000000007 
#define check exit(0)
#define nl cout<<endl;
#define inp 200005
#define ordered_set tree<int,null_type,less_equal<int>,rb_tree_tag,tree_order_statistics_node_update>
#define ll long long int
#define trace(x) cerr<<#x<<" : "<<x<<endl;
#define deb(v) for(int i=0;i<v.size();i++) {cout<<v[i]; (i==v.size()-1) ? cout<<"\n":cout<<" "; }
#define jaldi ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
 
using namespace __gnu_pbds;
using namespace std;
 
// Pick yourself up, 'cause...
 
vector<int> g[100005];
vector<bool> visited(100005,false);
vector<int> start(inp,0);
 
 
void dfs(int n)
{
    if(visited[n]) return;
    visited[n]=true;
    for(int c:g[n])
    {
        dfs(c);
        start[n]=max(start[n],1+start[c]);
    }
}
 
int main()
{
    jaldi
 
    int n,m;
    cin>>n>>m;
 
    for(int i=1,u,v;i<=m;i++)
    {
        cin>>u>>v;
        g[u].push_back(v);
    }
 
    for(int i=1;i<=n;i++)
    {
        if(!visited[i]) dfs(i);
    }
 
    //for(int i=1;i<=n;i++) visited[i]=false;
 
    int ans=0;
    for(int i=1;i<=n;i++) ans=max(ans,start[i]);
    cout<<ans;
 
    return 0;
}

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

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

using namespace std;

int main()
{
	int n;
	while(cin >> n && n)
	{
		vector<int> a;
		int temp,count = 0;

		rep(i,n)
		{
			cin >> temp;
			a.push_back(temp);
		}

		rep(i,n-1)
		{
			for(int j=n-1;j>i;j--)
			{
				if(a[j] < a[j-1])
				{
					count++;
					swap(a[j],a[j-1]);
				}
			}
		}

		cout << count << endl;
	}
	return 0;
}

Measured memory_bytes: 1216
# -*- coding: utf-8 -*-
from collections import  deque
def inpl(): return tuple(map(int, input().split()))
 
N, M = inpl()
 
adj = [[] for _ in range(N+1)]  
 
for _ in range(M):
    l, r, d = inpl()
    adj[l].append([r, d])
    adj[r].append([l, -d])
 
X = [-1 for _ in range(N+1)]
searched = [False for _ in range(N+1)]
S = 0 # == sum(searched)
res = True
g = 1
Q = deque([])
for g in range(1, N+1):
    if searched[g]:
        continue
    X[g] = 0
    Q.append(g)
    searched[g] = True
    while Q:
        p = Q.popleft()
        for np, d in adj[p]:
            if searched[np]:
                if X[np] != X[p] + d:
                    Q = []
                    res = False
                    break
            else:
                X[np] = X[p] + d
                Q.append(np)
                searched[np] = True
    if not res:
        break
 
if res:
    print("Yes")
else:
    print("No")

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

#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))

typedef long long LL;

struct sindo{
  int x;
  int y;
  int count;
};

int main(){
  int t,n;
  int houkoux[6]={1,1,0,-1,-1,0};
  int houkouy[6]={1,0,-1,-1,0,1};
  while(1){
    cin >> t >> n;
    if(t==0) return 0;
    vector<vector<int>> field(200,vector<int>(200,0));
    vector<vector<bool>> tootta(200,vector<bool>(200,false));
    int x,y;
    for(int i=0;i<n;i++){
      cin >> x >> y;
      field[y+100][x+100]=1;
    }
    cin >> x >> y;
    queue<struct sindo> bfs;
    int ans=0;
    bfs.push({x,y,0});
    tootta[y+100][x+100]=true;
    struct sindo now;
    while(!bfs.empty()){
      now = bfs.front();
      bfs.pop();
      ans++;
      if(now.count<t){
        for(int i=0;i<6;i++){
          if(!field[now.y+houkouy[i]+100][now.x+houkoux[i]+100]&&(!tootta[now.y+houkouy[i]+100][now.x+houkoux[i]+100])){
              bfs.push({now.x+houkoux[i],now.y+houkouy[i],now.count+1});
              tootta[now.y+houkouy[i]+100][now.x+houkoux[i]+100]=true;
          }
        }
      }
    }
    cout << ans << endl;
  }
  return 0;
}



Measured memory_bytes: 3236
<?php
	$a = trim(fgets(STDIN));
	$a = str_split($a);
	$count = 0;
	for($i=0;$i<count($a);$i++){
     if($i%2 ==0){
     	if($a[$i] == 'L'){
          	$count++;
        }
     }else{
     	if($a[$i] == 'R'){
          	$count++;
        }
     }
    }
	if($count == 0){
      echo('Yes');
    }else{
      echo('No');
    }

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

int main(){
    
        
    int a,b,c;
    cin>>a>>b>>c;
    int ans;
    ans=c-(a-b);
    if(ans>0)
    cout<<ans;
    else
    cout<<0;
    return 0;
    
}


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

class Program
{
    static void Main()
    {
        Console.WriteLine(Solve());
        return;
    }

    public static string Solve()
    {
        int[] input = ReadInts();
        int N = input[0], K = input[1];


        long ans = N - K + 1;


        return ans.ToString();
    }

    private static string Read() { return Console.ReadLine(); }
    private static int ReadInt() { return int.Parse(Read()); }
    private static long ReadLong() { return long.Parse(Read()); }
    private static double ReadDouble() { return double.Parse(Read()); }
    private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
    private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
    private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
}


Measured memory_bytes: 13140
N, M, K = gets.split.map(&:to_i)
A = Array.new(N + 1, 0)
B = Array.new(M + 1, 0)
gets.split.map(&:to_i).each_with_index do |a,i|
  A[i + 1] = A[i] + a
end
gets.split.map(&:to_i).each_with_index do |b,i|
  B[i + 1] = B[i] + b
end
ans = A.each_with_index.map do |sa, i|
  next -1 if sa > K
  j = B.bsearch_index{|sb| sa + sb > K } || (M + 1)
  i + (j - 1)
end.max
puts ans



Measured memory_bytes: 47444
n = gets.to_i
a = gets.split.map(&:to_i)
b = []
sum = 0
n.times do |i|
	b.push(a[i]-i)
end

b.sort!
ans = b[n/2]
n.times do |i|
	sum += (a[i]-(ans+i)).abs
end

puts sum

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

int main() {
    int N; cin >> N;
    vector<int> num(N + 3);
    rep(i, N) {
        int a, b; cin >> a >> b;
        if (a > N + 1) continue;
        num[a] += 1; num[min(b, N + 1) + 1] -= 1;
    }
    int maxi = 0;
    for (int i = 2; i < N + 3; ++i) {
        num[i] += num[i - 1];
        if (num[i] >= i - 1 && maxi < i - 1) maxi = i - 1;
    }
    cout << maxi << endl;
}

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

int main(){
	int i,j,k,n,m,l,f,x,y,z; string s[55];
	int h, w;
	cin >> h >> w;
	rep(i, h) cin >> s[i];
	int dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
	int dy[8] = {0, -1, -1, -1, 0, 1, 1, 1};
	string t[55] = {""};
	int ans[55][55] = {0};
	rep(i, h){
		rep(j, w){
			if(s[i][j] == '.'){
				rep(k, 8){
					if(
						i+dy[k] >= 0 
						&& i+dy[k] <= h 
						&& j+dx[k] >= 0
						&& j+dx[k] <= w){
						if(s[i+dy[k]][j+dx[k]] == '#') ++ans[i][j]; 
					}
				}
				t[i] += to_string(ans[i][j]);
			}else{
				t[i] += '#';
			}
			
		}
	}

	rep(i,h){
		cout << t[i] << endl;
	}
}

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

using namespace std;

#define FORE(i, a) for (auto i = a.begin(); i != a.end(); ++i)
#define REPU(i, a, b) for (int i = (a); i < (b); ++i)
#define REPD(i, a, b) for (int i = (a); i > (b); --i)
#define MEM(a, x) memset(a, x, sizeof(a))
#define ALL(a) a.begin(), a.end()
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end())

vector<string> split(const string &s, char c) {
	vector<string> v; stringstream ss(s); string x;
	while (getline(ss, x, c)) v.push_back(x);
	return v;
}
#define DEBUG(args...) { vector<string> _v = split(#args, ','); err(_v.begin(), args); }
void err(vector<string>::iterator it) {}
template<typename T, typename... Args>
void err(vector<string>::iterator it, T a, Args... args) {
	cerr << "[DEBUG] " << it -> substr((*it)[0] == ' ', it -> length()) << " = " << a << '\n';
	err(++it, args...);
}

typedef long long ll;
const int MOD = 1000003;

template<class T, class U> inline T tmin(T a, U b) { return (a < b) ? a : b; }
template<class T, class U> inline T tmax(T a, U b) { return (a > b) ? a : b; }
template<class T, class U> inline void amax(T &a, U b) { if (b > a) a = b; }
template<class T, class U> inline void amin(T &a, U b) { if (b < a) a = b; }
template<class T> T gcd(T a, T b) { while (b != 0) { T c = a; a = b; b = c % b; } return a; }

ll ft[1000005];

ll mod_pow(ll x, ll y, ll p) {
    ll res = 1;
    while (y > 0) {
        if (y & 1) res = res * x % p;
        x = x * x % p;
        y >>= 1;
    }
    return res;
}

int main(int argc, char *argv[]) {
	ios_base::sync_with_stdio(false);

	ft[0] = 1;
	REPU(i, 1, MOD) ft[i] = i * ft[i - 1] % MOD;

	int Q; cin >> Q;
	REPU(_, 0, Q) {
		ll x, d, n; cin >> x >> d >> n;
		if (x == 0) puts("0");
		else if (d == 0) {
			printf("%lld\n", mod_pow(x, n, MOD));
		}
		else {
			ll invd = mod_pow(d, MOD - 2, MOD);
			x = x * invd % MOD;
			if (x + n - 1 >= MOD) puts("0");
			else {
				ll ans = mod_pow(d, n, MOD);
				ans = ans * ft[x + n - 1] % MOD * mod_pow(ft[x - 1], MOD - 2, MOD) % MOD;
				printf("%lld\n", ans);
			}
		}
	}

	return 0;
}


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

int main() {
  int n, cnt = 1;
  string s;
  cin >> n >> s;
  char last = s[0];
  FOR(i, 1, n) {
    if (last != s[i]) cnt++;
    last = s[i];
  }
  cout << cnt << endl;
}

Measured memory_bytes: 512
def solve(s):
    ret = [s]
    
    for i in range(len(s)+1):
        ret.append(s[:i]+s[i:][::-1])
        ret.append(s[:i][::-1]+s[i:])
        ret.append(s[:i][::-1]+s[i:][::-1])
        ret.append(s[i:]+s[:i])
        ret.append(s[i:][::-1]+s[:i])
        ret.append(s[i:]+s[:i][::-1])
        ret.append(s[i:][::-1]+s[:i][::-1])
    
    return len(set(ret))

def main():
    ans = []
    m = int(input())
    for i in range(m):
        ans.append(solve(input()))
    for i in ans:
        print(i)

main()



Measured memory_bytes: 5636
#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll int as[3000006]={0};
ll int f(ll int n,ll int p)
{
	if(as[n]!=0)return as[n];
	if(n==1)return as[n]=p;
	if(n==0)return as[n]=1;
	if(n%2==0)
	{
		return as[n]=(f(n/2,p)*f(n/2,p))%1000000007;
	}
	else 
	{
		return as[n]=(((f(n/2,p)*f(n/2,p))%1000000007)*p)%1000000007;
	}
}
int main()
{
	ll int n,ans,i,a,b,c;
	cin>>n;
	for(i=0;i<3000004;i++)
	{
		as[i]=0;
	}
	a=f(n,10);
	for(i=0;i<3000004;i++)
	{
		as[i]=0;
	}
	b=f(n,9);
	for(i=0;i<3000004;i++)
	{
		as[i]=0;
	}
	c=f(n,8);
	ans=(a-b-b+c)%1000000007;
	//cout<<a<<" "<<b<<" "<<c<<endl;
	if(ans<0)ans+=1000000007;
	printf("%lld\n",ans%1000000007);
	return 0;
}

Measured memory_bytes: 27192
#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 a, b;

    cin >> a >> b;

    if (a > b) rep(i, a) cout << b;
    else rep(i, b) cout << a;

    cout << endl;
    
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

class Main{

	public static void main(String[] args){
	
		Scanner sc = new Scanner(System.in);
		
		String S = sc.next();

		int ans = 0;

		for(int i = 0; i<4; i++){
		if(S.charAt(i) == '-') ans--;
		if(S.charAt(i) == '+') ans++;
		}
		System.out.println(ans);
	}
}

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

#define int long long
#define rep(i,a,n) for(int i = a; i < n; i++)
#define pb push_back
#define eb emplace_back
#define dump(x) cout << #x << " = " << (x) << endl
#define chk() cout << "now" << endl;
#define SORT(c) sort((c).begin(), (c).end())
#define SORTG(c) sort((c).begin(), (c).end(), greater<int>());
#define fi first
#define se second
  
typedef pair<int,int> P;
typedef vector<int> vi;

signed main() {
    int x, a;
    cin >> x >> a;
    if(x >= a) cout << 10;
    else cout << 0;
    cout << endl;
    return 0;
}


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

int main() {
int N;
  cin >>N;
  vector<int> vec(N);
  vector<int> vec1(N);
  for(int i=0;i<N;i++){
    cin >>vec.at(i);
    vec1.at(i)=vec.at(i);
  }
sort(vec1.begin(),vec1.end());
 
  int counter=0;
  
  for(int i=0;i<N;i++){

      if(vec.at(i)!=vec1.at(i)){
        counter++;
      
    }
  }
  if(counter==2||counter==0){
    cout << "YES"<<endl;}
  else{cout<<"NO"<<endl;
      }
    
  
    
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <string>
#include <cstring>
#include <utility>
#include <algorithm>
#include <functional>
#include <deque>
#include <cctype>
#include <ctime>
#include <cstdlib>
#include <iomanip>
using namespace std;

int main(){
	string s;
	cin >> s;
	if ((s[0]==s[1] && s[1]==s[2]) || (s[1]==s[2] && s[2]==s[3])) cout << "Yes" << endl;
	else cout << "No" << endl;
}


Measured memory_bytes: 888
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(), a.end()
#define rrng(a) a.rbegin(), a.rend()
#define maxs(x, y) (x = max(x, y))
#define mins(x, y) (x = min(x, y))
#define limit(x, l, r) max(l, min(x, r))
#define lims(x, l, r) (x = max(l, min(x, r)))
#define isin(x, l, r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)), x.end())
#define show(x) cout << #x << " = " << x << endl;
#define PQ(T) priority_queue<T, v(T), greater<T>>
#define bn(x) ((1 << x) - 1)
#define dup(x, y) (((x) + (y)-1) / (y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;

int main() {

  string s;
  cin >> s;
  int n = s.size();
  string t = "";
  rep(i,n){
    if(i!=n-1 && s[i] =='B' && s[i+1] == 'C'){
      t+='D';
      i++;
    }
    else t+=s[i];
  }
  ll numA = 0;
  ll ans = 0;
  rep(i,(int)t.size()){
    if(t[i] == 'A') numA++;
    else if(t[i] == 'D') ans+=numA;
    else numA = 0;
  }
  cout<<ans<<endl;
  return 0; 
}

Measured memory_bytes: 776
#!/usr/bin/env python3
import sys
INF = float("inf")


def yes():
    print("Yes")  # type: str


def no():
    print("No")  # type: str


def solve(A: int, B: int, C: int):
    if (A <= C and C <= B) or (B <= C and C <= A):
        yes()
    else:
        no()
    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    C = int(next(tokens))  # type: int
    solve(A, B, C)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#define _CRT_SECURE_NO_WARNINGS
#include <queue>
#include <tuple>
#include <iostream>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <sstream>
#include <utility>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
#define all(c) (c).begin(), (c).end()
#define loop(i,a,b) for(ll i=a; i<ll(b); i++)
#define rep(i,b) loop(i,0,b)
#define each(e,c) for(auto&e:c)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define lb lower_bound
#define ub upper_bound
#ifdef DEBUG
#define dump(...) (cerr<<#__VA_ARGS__<<" = "<<(DUMP(),__VA_ARGS__).str()<<" ["<<__LINE__<<"]"<<endl)
struct DUMP:ostringstream{template<class T>DUMP &operator,(const T&t){if(this->tellp())*this<<", ";*this<<t;return *this;}};
#else
#define dump(...)
#endif
template<class T> ostream& operator<<(ostream& os, vector<T> const& v){
    rep(i,v.size()) os << v[i] << (i+1==v.size()?"":" ");
    return os;
}


typedef long double R;
typedef tuple<R,R,R> P;
typedef pair<P,R> S;
R const eps = 1e-10;

typedef R Weight;
struct Edge {
    int src, dst;
    Weight weight;
    Edge(int src, int dst, Weight weight) :
        src(src), dst(dst), weight(weight) { }
};
bool operator < (const Edge &e, const Edge &f) {
    return e.weight != f.weight ? e.weight > f.weight : // !!INVERSE!!
        e.src != f.src ? e.src < f.src : e.dst < f.dst;
}
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

typedef vector<Weight> Array;
typedef vector<Array> Matrix;

pair<Weight, Edges> minimumSpanningTree(const Graph &g, int r = 0) {
    int n = g.size();
    Edges T;
    Weight total = 0;
    vector<bool> vis(n);
    priority_queue<Edge> q;
    q.push( Edge(-1, r, 0) );
    while (!q.empty()) {
        Edge e = q.top(); q.pop();
        if (vis[e.dst]) continue;
        T.push_back(e);
        total += e.weight;
        vis[e.dst] = true;
        for(auto& f : g[e.dst]) if (!vis[f.dst]) q.push(f);
    }
    return make_pair(total, T);
}

int n;
S ss[111];
R d[111][111];

P operator-(const P& p, const P& q){
    R x,y,z, a,b,c;
    tie(x,y,z) = p; tie(a,b,c) = q;
    return P(x-a, y-b, z-c);
}

R abs(P p){
    R x,y,z;
    tie(x,y,z) = p;
    return sqrt(x*x+y*y+z*z);
}

R dist(S const& c1, S const& c2){
    R d = abs(c1.first-c2.first);
    return max<R>(0, d-(c1.second+c2.second));
}

int main(){
    while(cin >> n && n){
        Graph g(n);
        rep(i,n){
            R x,y,z,r; cin >> x >> y >> z >> r;
            ss[i] = S(P(x,y,z),r);
            rep(j,i){
                R d = dist(ss[i],ss[j]);
                g[i].eb(i,j,d);
                g[j].eb(j,i,d);
            }
        }
        printf("%.3lf\n", (double)minimumSpanningTree(g).first);
    }
}

Measured memory_bytes: 1916
//
// Created on 2020/09/19.
//


#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <ios>
#include <iomanip>
#include <numeric>

#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
typedef long long ll;
using namespace std;
const long long LINF =1e18;
const int INF = 1e9;



int main() {
    string s;
    cin>>s;
    if(s[s.size()-1] == 's'){
        s += "es";
    }else{
        s += "s";
    }
    cout<<s<<endl;
    return 0;
}


Measured memory_bytes: 3616
def examC():
    def search_graph(graph_releation, result_list, current_idx=0, path=[0]):
        for i in range(len(graph_releation[current_idx])):
            next_idx = graph_releation[current_idx][i]
            #次の点の候補全部ひとつずつやる
            tmp_path = copy.deepcopy(path)
            #今まで通った点
            if next_idx in tmp_path:
                #通ったことがある
                continue
            tmp_path.append(next_idx)
            if len(tmp_path) == len(graph_releation):
                #今まで通った点が点全部になった
                result_list.append(tmp_path)  # 確定
                continue
            else:
                search_graph(graph_releation, result_list, next_idx, tmp_path)
                #次の点から出る辺でチェック

    N, M = LI()
    v = [[] for _ in range(N)]
    for i in range(M):
        a, b = LI()
        v[a-1].append(b-1)
        v[b-1].append(a-1)
    cur = []
    search_graph(v, cur)
    print(len(cur))
#    print(cur)

import sys
import copy
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

examC()


Measured memory_bytes: 4212
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<ctime>
#include<queue>

using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vector<int> >;
using pii = pair<int, int>;
using ppi = pair<pii, int>;

int f_dir[2][4] = {{-1, 0, 1, 0}, {0, 1, 0, -1}}; //↑→↓←
int e_dir[2][8] = {{-1, -1, -1, 0, 0, 1, 1, 1}, {-1, 0, 1, -1, 1, -1, 0, 1}};
bool is_in_field(int y, int x, int h, int w){
  return (y >= 0 && y < h && x >= 0 && x < w);
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int ti = clock();
  // start-----------------------------------------------
  int h1, m1, h2, m2, k;
  cin >> h1 >> m1 >> h2 >> m2 >> k;
  cout << (m2 - m1) + (h2 - h1) * 60 - k << endl;


  // end-----------------------------------------------
  // cerr << 1.0 * (clock() - ti) / CLOCKS_PER_SEC << endl;
}


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

int main(){
  string S;
  cin>>S;
  int N=S.size();
  for(int i=0;i<N;i++){
    if(S.at(i)=='?'){
      S.at(i)='D';
    }
  }

  cout<<S<<endl;
}


Measured memory_bytes: 3752
W,H,N = map(int,input().split())
Data = []
for _ in range(N):
    Data.append(list(map(int,input().split())))

x1,x2 = 0,W
y1,y2 = 0,H

for i in range(N):
    x,y,a = Data[i]
    if a == 1:
        x1 = max(x1,x)
    elif a == 2:
        x2 = min(x2,x)
    elif a == 3:
        y1 = max(y1,y)
    elif a == 4:
        y2 = min(y2,y)

if x2 >= x1 and y2 >= y1:
    s = (x2-x1)*(y2-y1)
else:
    s = 0
print(s)


Measured memory_bytes: 3064
class Stack:

    def __init__(self):
        self.stack = []

    def push(self, value):
        self.stack.append(value)

    def pop(self):
        ans = self.stack[-1]
        del self.stack[-1]
        return ans

    def IsEmpty(self):
        return len(self.stack) == 0

def Reverse_polish(lst):
    stack = Stack()
    for i in range(len(lst)):
        if lst[i] == "+":
            a = stack.pop()
            b = stack.pop()
            stack.push(a + b)
        elif lst[i] == "-":
            a = stack.pop()
            b = stack.pop()
            stack.push(b - a)
        elif lst[i] == "*":
            a = stack.pop()
            b = stack.pop()
            stack.push(a * b)
        elif lst[i] == "/" and stack.stack[-1] != 0:
            a = stack.pop()
            b = stack.pop()
            stack.push(b / a)
        else:
            stack.push(int(lst[i]))
    print(stack.stack[-1])

lst = list(map(str, input().split()))
Reverse_polish(lst)        
            


Measured memory_bytes: 5612
#include <bits/stdc++.h>
using namespace std;
int main() {
    int N; cin >> N;
    vector<int> A(N, -1), B(N-1);
    for(int i = 0; i < N-1; i++) {
        cin >> B[i];
    }

    for(int i = 0; i < N-1; i++) {
        int b = min(A[i], A[i+1]);
        if(b == -1) {
            if(A[i] == -1) A[i] = B[i];
            if(A[i+1] == -1) A[i+1] = B[i];
        }
        int a = max(A[i], A[i+1]);
        if(B[i] < a){
            if(A[i] > B[i]) A[i] = B[i];
            if(A[i+1] > B[i]) A[i] = B[i];
        }
    }

    cout << accumulate(A.begin(), A.end(), 0);
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,m,que[1000],s,t,dr[4][2]={{0,1},{1,0},{0,-1},{-1,0}},dis[30][30];
char S[30][30];
int bfs(int st){
	s=t=0;que[t++]=st;memset(dis,0x1f,sizeof(dis));
	dis[st/20][st%20]=0;
	while(s<t){
		int x=que[s++],y=x%20;x/=20;
		for(int i=0;i<4;i++){
			int x1=x+dr[i][0],y1=y+dr[i][1];
			if(x1<0||x1>=n||y1<0||y1>=m||S[x1][y1]!='.'||dis[x1][y1]<=dis[x][y]+1)continue;
			dis[x1][y1]=dis[x][y]+1,que[t++]=x1*20+y1;
		}
	}
	return dis[que[t-1]/20][que[t-1]%20];
}
int main(){
	int ans=0;scanf("%d%d",&n,&m);
	for(int i=0;i<n;i++)scanf("%s",S[i]);
	for(int i=0;i<n;i++)for(int j=0;j<m;j++)if(S[i][j]=='.')ans=max(ans,bfs(i*20+j));
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>  
#include <iostream>  
#include <sstream>  
#include <string>  
#include <cstring>
#include <vector>  
#include <queue>  
#include <set>  
#include <map>  
#include <cstdio>  
#include <cstdlib>  
#include <cctype>  
#include <cmath>  
#include <list>  
#include <cassert>
#include <ctime>
#include <climits>
using namespace std;  

#define PB push_back  
#define MP make_pair  
#define SZ(v) ((int)(v).size())  
#define FOR(i,a,b) for(int i=(a);i<(b);++i)  
#define REP(i,n) FOR(i,0,n)  
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)  
#define REPE(i,n) FORE(i,0,n)  
#define FORSZ(i,a,v) FOR(i,a,SZ(v))  
#define REPSZ(i,v) REP(i,SZ(v))  
typedef long long ll;
typedef unsigned long long ull;
ll gcd(ll a,ll b) { return b==0?a:gcd(b,a%b); }

const int MAXN = 100000;

int n, needperc;
int a[MAXN], b[MAXN];

ll c[MAXN];

void run() {
	scanf("%d%d", &n, &needperc); REP(i, n) scanf("%d%d", &a[i], &b[i]);

	// (100-needperc)*asum-needperc*bsum>=0
	REP(i, n) c[i] = (ll)(100 - needperc) * a[i] + (ll)needperc*b[i];
	sort(c, c + n); reverse(c, c + n);
	ll have = 0; REP(i, n) have -= (ll)needperc*b[i];
	int ret = 0; while (ret < n&&have < 0) have += c[ret++];
	printf("%d\n", ret);
}

int main() {
	run();
	return 0;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;
#define rep(i,n) for(ll i=0;i<n;i++)
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define fi first
#define se second
#define endl "\n"

template<typename T> inline bool chmax(T &a, T b){if(a<b){a=b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if(a>b){a=b;return true;}return false;}
template<typename T> ostream& operator<<(ostream& s,const complex<T>& d) {return s<<"("<<d.real()<<", "<<d.imag()<< ")";}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const pair<T1,T2>& d) {return s<<"("<<d.first<<", "<<d.second<<")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& d){int len=d.size();rep(i,len){s<<d[i];if(i<len-1) s<<" ";}return s;}
template<typename T> ostream& operator<<(ostream& s,const vector<vector<T>>& d){int len=d.size();rep(i,len){s<<d[i]<<endl;}return s;}
template<typename T> ostream& operator<<(ostream& s,const set<T>& v){s<<"{ ";for(auto itr=v.begin();itr!=v.end();++itr) {if (itr!=v.begin()) {s<< ", ";}s<<(*itr);}s<<" }";return s;}
template<typename T> ostream& operator<<(ostream& s,const multiset<T>& v){s<<"{ ";for(auto itr=v.begin();itr!=v.end();++itr) {if (itr!=v.begin()) {s<< ", ";}s<<(*itr);}s<<" }";return s;}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const map<T1,T2>& m){s<<"{"<<endl;for(auto itr=m.begin();itr!=m.end();++itr){s<<" "<<(*itr).first<<" : "<<(*itr).second<<endl;}s<<"}"<<endl;return s;}

const ll mod=1'000'000'007;
const ll inf=1'000'000'000'000'000'00;
const int INF=1'000'000'000;
const double EPS=1e-10;
const double PI=acos(-1);

int main(){
	cin.tie(0);ios::sync_with_stdio(false);
	int h,w;
	cin>>h>>w;
	vector<string> g(h);
	int cnt=0;
	rep(i,h){
		cin>>g[i];
		rep(j,w){
			if(g[i][j]=='#') cnt++;
		}
	}
	auto bfs=[&](Pi s,Pi go){
		vector<int> dx={1,-1,0,0},dy={0,0,1,-1};
		queue<Pi> que;
		vector<vector<int>> dist(h,vector<int>(w,INF));
		que.push(s);
		dist[s.fi][s.se]=0;
		while(!que.empty()){
			Pi now=que.front();
			que.pop();
			rep(i,4){
				int nx=now.fi+dx[i],ny=now.se+dy[i];
				if(0<=nx && nx<=h-1 && 0<=ny && ny<=w-1){
					if(g[nx][ny]!='#' && dist[nx][ny]==INF){
						dist[nx][ny]=dist[now.fi][now.se]+1;
						que.push(Pi(nx,ny));
					}
				}
			}
		}
		return dist[go.fi][go.se];
	};
	int ret=bfs(Pi(0,0),Pi(h-1,w-1));
	if(ret==INF){
		cout<<-1<<endl;
	}else{
		cout<<h*w-ret-cnt-1<<endl;
	}
}

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

using namespace std;

int main()
{
    char S[4];
    int ans = 700;

    scanf("%s", S);

    for (int i = 0; i < 3; i++)
    {
        if (S[i] == 'o')
            ans += 100;
    }

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

    return 0;
}

Measured memory_bytes: 256