akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
//#include<bits/stdc++.h>
#include<cstdio>
#include<cstring>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

const int cm = 1 << 17;
char cn[cm], * ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread_unlocked(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	int A = 0;
	if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
	else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}

int B[200010];
inline void add(int A) {
	while (A <= 200010) {
		B[A]++;
		A += A & -A;
	}
}

inline int query(int A) {
	int kotae = 0;
	while (A > 0) {
		kotae += B[A];
		A -= A & -A;
	}
	return kotae;
}

void pakuripair_sort(int N, ll A[], int B[]) {
	const int b = 13;
	ll tmp[200001];
	int tmp2[200001];
	rep(k, 4) {
		int kazu[1 << b] = {}, kazu2[1 << b] = {};
		rep(i, N) kazu[A[i] >> k * b & ((1 << b) - 1)]++;
		rep(i, (1 << b) - 1) kazu[i + 1] += kazu[i];
		for (int i = N - 1; i >= 0; i--) {
			tmp[--kazu[A[i] >> k * b & ((1 << b) - 1)]] = A[i];
			tmp2[kazu[A[i] >> k * b & ((1 << b) - 1)]] = B[i];
		}
		k++;
		rep(i, N) kazu2[tmp[i] >> k * b & ((1 << b) - 1)]++;
		rep(i, (1 << b) - 1) kazu2[i + 1] += kazu2[i];
		for (int i = N - 1; i >= 0; i--) {
			A[--kazu2[tmp[i] >> k * b & ((1 << b) - 1)]] = tmp[i];
			B[kazu2[tmp[i] >> k * b & ((1 << b) - 1)]] = tmp2[i];
		}
	}
}

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

	int N = getint();
	int K = getint();

	ll A[200001];
	A[0] = (ll)N * K;
	rep1(i, N) {
		B[i] = i;
		A[i] = A[i - 1] + getint() - K;
	}
	pakuripair_sort(N + 1, A, B);
	rep(i, N + 1) A[B[i]] = i + 1;
	memset(B, 0, sizeof(B));
	ll kotae = 0;
	rep(i, N + 1) {
		kotae += query(A[i]);
		add(A[i]);
	}
	printf("%lld", kotae);

	Would you please return 0;
}

Measured memory_bytes: 4992
#include<iostream>
#include<cmath>
using namespace std;
int main(){
int n;
cin>>n;
if(n==1){
    cout<<"1"<<endl;
}
for(int i = 0; i<=n; i++){
    
    if(i*i>n){
        cout<<(i-1)*(i-1)<<endl;
        return 0;
    }
    
}
return 0;
}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Scanner;
import java.util.Set;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int H = sc.nextInt();
		int W = sc.nextInt();
		int M = sc.nextInt();
		int h[] = new int[H+1];
		int w[] = new int[W+1];
		Set<Point> set = new HashSet<Point>();
		Main main = new Main();
		for (int i=0;i<M;i++) {
			Point p = main.new Point();
			p.x = sc.nextInt();
			p.y = sc.nextInt();
			h[p.x]++;
			w[p.y]++;
			set.add(p);
		}
		int maxx=0;
		int maxy=0;
		for (int i=0;i<=H;i++) {
			if (h[i]>maxx) {
				maxx= h[i];
			}
		}
		for (int i=0;i<=W;i++) {
			if (w[i]>maxy) {
				maxy= w[i];
			}
		}
		List<Integer> hl = new ArrayList<Integer>();
		for (int i=0;i<=H;i++) {
			if (h[i]==maxx) {
				hl.add(i);
			}
		}
		List<Integer> wl = new ArrayList<Integer>();
		for (int i=0;i<=W;i++) {
			if (w[i]==maxy) {
				wl.add(i);
			}
		}
		for (int i=0;i<hl.size();i++) {
			for (int j=0;j<wl.size();j++) {
				Point p = main.new Point();
				p.x= hl.get(i);
				p.y= wl.get(j);
				if (!set.contains(p)) {
					System.out.println(maxx+maxy);
					return ;
				}
			}
		}
		System.out.println(maxx+maxy-1);

	}

	public class Point extends Object{
		int x;
		int y;

		public int hashCode() {
			return x*100+y;
		}

		public boolean equals(Object o) {
			Point temp = (Point)o;
			if (temp.x==x&&temp.y==y) {
				return true;
			}
			return false;
		}
	}
}

Measured memory_bytes: 91020
while True:
    n=int(input())
    if n==0:
        break
    else:
        A=[0]*31
        A[0]=1
        A[1]=1
        A[2]=2
        for i in range(3,n+1):
            A[i]=A[i-1]+A[i-2]+A[i-3]
    print(A[n]//3650+1)


Measured memory_bytes: 5596
#include<bits/stdc++.h>
#define int long long
#define fi first
#define se second
#define PB push_back
using namespace std;
typedef pair<int, int> P1;
typedef pair<int, pair<int, int> > P2;
static const int INF = 1ll<<60;
static const int dx[] = { 1, -1, 0, 0, };
static const int dy[] = { 0, 0, 1, -1 };
P1 dat[2][600005];

class Segment{
    public :
        int n;
        int ed;
        void init(int n_,int ed_){
            n=1;
            ed=ed_;
            while(n<n_)n*=2;
            for(int i=0;i<2*n-1;++i)dat[ed][i]=P1(INF,INF);
        }

        P1 Min(P1 a,P1 b){
            if(a.first<=b.first)return a;
            else return b;
        }

        void update(int k,P1 a){
            k+=n-1;
            dat[ed][k]=a;
            while(k>0){
                k=(k-1)/2;
                dat[ed][k]=Min(dat[ed][k*2+1],dat[ed][k*2+2]);
            }
        }

        P1 query(int a,int b,int k,int l,int r){
            if(a<=l&&r<=b)return dat[ed][k];
            if(r<=a||b<=l)return P1(INF,INF);
            else {
                P1 vl=query(a,b,k*2+1,l,(l+r)/2);
                P1 vr=query(a,b,k*2+2,(l+r)/2,r);
                return Min(vl,vr);
            }
        }
};

int N;
vector<int> p,q;
vector<P1> interval;
priority_queue<P2,vector<P2>,greater<P2> > minInterval;
Segment seg[2];

void divideInterval(P1 id,int i,int j){
    P1 tmp = id;
    minInterval.push(P2(seg[tmp.first%2].query(tmp.first,i,0,0,seg[tmp.first%2].n).first,P1(tmp.first,i)));
    minInterval.push(P2(seg[(i+1)%2].query(i+1,j,0,0,seg[(i+1)%2].n).first,P1(i+1,j)));
    minInterval.push(P2(seg[(j+1)%2].query(j+1,tmp.second,0,0,seg[(j+1)%2].n).first,P1(j+1,tmp.second)));
}

signed main(){
    cin>>N;
    seg[0].init(N,0);
    seg[1].init(N,1);
    for(int i=0;i<N;++i){
        int x;
        cin>>x;
        p.PB(x);
        seg[i%2].update(i,P1(x,i));
    }
    minInterval.push(P2(seg[0].query(0,N,0,0,seg[0].n).first,P1(0,N)));
    for(int cnt=0;cnt<N/2;++cnt){
        P2 nextInterval = minInterval.top();
        int l = nextInterval.second.first,r = nextInterval.second.second;
        minInterval.pop();
        P1 i,j;
        i = seg[l%2].query(l,r,0,0,seg[l%2].n);
        j = seg[!(l%2)].query(i.second+1,r,0,0,seg[!(l%2)].n);
        q.PB(i.first);
        q.PB(j.first);
        divideInterval(nextInterval.second,i.second,j.second);
    }
    for(int i=0;i<q.size();++i)cout<<q[i]<<" ";
}


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


int main(void) {
  string s;
  cin >> s;

  string ans = "";
  ans += s.front();
  ans += to_string(s.length() - 2);
  ans += s.back();

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

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

long long N;
vector<long long> L;


long long countc(long long mini, long long maxi) {
	vector<long long>::iterator it_up = lower_bound(L.begin(), L.end(), maxi);
	it_up--;
	vector<long long>::iterator it_down = upper_bound(L.begin(), L.end(), mini);
	return distance(it_down, it_up) + 1;
}


int main(){
	cin >> N;
	for(long long i = 0; i < N; i++){
		long long tmp;
		cin >> tmp;
		L.push_back(tmp);
	}

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

	long long ans = 0;
	for(long long i = 0; i < N; i++){
		for(long long j = i+1; j < N; j++){
			long long a = L[i];
			long long b = L[j];
			long long mini = max(a-b, b-a);
			long long maxi = a+b;
			long long num = countc(mini, maxi);
			if(mini < a && a < maxi){
				num--;
			}
			if(mini < b && b < maxi){
				num--;
			}
			if(num>0){
				ans+=num;
			}
		}
	}
	cout << ans/3 << endl;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

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

	while(n --)
		for(int y, m, d, count = 0; cin >> y >> m >> d; cout << count << endl, count = 0)
			for(; y < 1000; y ++, m = 1)
				for(; m <= 10; m ++, d = 1)
					for(; d <= ((!(y % 3) || (m % 2)) ? 20:19); d ++)
						count ++;
					
	return 0;
}

Measured memory_bytes: 1160
#include <stdio.h>
#include <string.h>


int main()
{
    char word[100000];
    scanf("%s",word);
    for(int i=0;i<strlen(word);i++){
      if(word[i]=='a')goto b;
    }
    printf("a\n");
    return 0;
    b:;
    for(int i=0;i<strlen(word);i++){
      if(word[i]=='b')goto c;
    }
    printf("b\n");
    return 0;
    c:;
    for(int i=0;i<strlen(word);i++){
      if(word[i]=='c')goto d;
    }
    printf("c\n");
    return 0;
    d:;
    for(int i=0;i<strlen(word);i++){
      if(word[i]=='d')goto e;
    }
    printf("d\n");
    return 0;
    e:;
    for(int i=0;i<strlen(word);i++){
      if(word[i]=='e')goto f;
    }
    printf("e\n");
    return 0;
    f:;
    for(int i=0;i<strlen(word);i++){
      if(word[i]=='f')goto g;
    }
    printf("f\n");
    return 0;
    g:;
    for(int i=0;i<strlen(word);i++){
      if(word[i]=='g')goto h;
    }
    printf("g\n");
    return 0;
    h:;

    for(int i=0;i<strlen(word);i++){
      if(word[i]=='h')goto i;
    }
    printf("h\n");
    return 0;
    i:;
    for(int i=0;i<strlen(word);i++){
      if(word[i]=='i')goto j;
    }
    printf("i\n");
    return 0;
    j:;
    for(int i=0;i<strlen(word);i++){
      if(word[i]=='j')goto k;
    }
    printf("j\n");
    return 0;
    k:;
    for(int i=0;i<strlen(word);i++){
      if(word[i]=='k')goto l;
    }
    printf("k\n");
    return 0;
    l:;

    for(int i=0;i<strlen(word);i++){
      if(word[i]=='l')goto m;
    }
    printf("l\n");
    return 0;
    m:;
    for(int i=0;i<strlen(word);i++){
      if(word[i]=='m')goto n;
    }
    printf("m\n");
    return 0;
    n:;
    for(int i=0;i<strlen(word);i++){
      if(word[i]=='n')goto o;
    }
    printf("n\n");
    return 0;
    o:;
    for(int i=0;i<strlen(word);i++){
      if(word[i]=='o')goto p;
    }
    printf("o\n");
    return 0;
    p:;
    for(int i=0;i<strlen(word);i++){
      if(word[i]=='p')goto q;
    }
    printf("p\n");
    return 0;
    q:;
    for(int i=0;i<strlen(word);i++){
      if(word[i]=='q')goto r;
    }
    printf("q\n");
    return 0;
    r:;

    for(int i=0;i<strlen(word);i++){
      if(word[i]=='r')goto s;
    }
    printf("r\n");
    return 0;
    s:;
    for(int i=0;i<strlen(word);i++){
      if(word[i]=='s')goto t;
    }
    printf("s\n");
    return 0;
    t:;
    for(int i=0;i<strlen(word);i++){
      if(word[i]=='t')goto u;
    }
    printf("t\n");
    return 0;
    u:;
    for(int i=0;i<strlen(word);i++){
      if(word[i]=='u')goto v;
    }
    printf("u\n");
    return 0;
    v:;
    for(int i=0;i<strlen(word);i++){
      if(word[i]=='v')goto w;
    }
    printf("v\n");
    return 0;
    w:;
    for(int i=0;i<strlen(word);i++){
      if(word[i]=='w')goto x;
    }
    printf("w\n");
    return 0;
    x:;
    for(int i=0;i<strlen(word);i++){
      if(word[i]=='x')goto y;
    }
    printf("x\n");
    return 0;
    y:;
    for(int i=0;i<strlen(word);i++){
      if(word[i]=='y')goto z;
    }
    printf("y\n");
    return 0;
    z:;
    for(int i=0;i<strlen(word);i++){
      if(word[i]=='z')goto no;
    }
    printf("z\n");
    return 0;
    no:;
    printf("None\n");

    return 0;
}


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

using namespace std;
static const int MAX_STR_LEN = 20000;

void sh_result(stack< pair<int, int> > st);
void get_result(stack< pair<int, int> > *st);

int main(){
	int i, str_len;


	stack< pair<int, char> > st_block;  // ??°??¢?¨?????????????, ??°??¢?¨????(/, _, \)
	stack< pair<int, int> > st_area;    // ?°´?????????????????´???????????????, ??¢???

	string str;

	cin >> str;
	str_len = str.size();

	for (i = 0; i < str_len; i++) {
		switch (str[i]) {
		case '\\' :
			if (i == 0)
				st_area.push( make_pair(i, 0) );
			else if (str[i - 1] != '\\')
				st_area.push( make_pair(i, 0) );
			st_block.push( make_pair(i, str[i]) );
			break;
		case '_' :
			if (i == 0) {}
			else if (str[i - 1] == '/')
				st_area.push( make_pair(i, 0) );
			break;
		case '/' :
			if ( !(st_block.empty()) ) {
				auto b = st_block.top(); st_block.pop();
				if ( !(st_area.empty()) ) {
					auto a = st_area.top(); st_area.pop();
					while (a.first > b.first) {
						auto c = st_area.top(); st_area.pop();
						a.first = c.first;
						a.second += c.second;
					}
					if (a.first <= b.first) {
						a.second += i - b.first;
						st_area.push( a );
					}
				}
			}
			break;
		}
	}

	get_result(&st_area);

	return 0;
}


void sh_result(stack< pair<int, int> > st) {
	int i, st_size;
	st_size = st.size();
	printf("stack size = %d\n",st_size);
	for (i = 0; i < st_size; i++) {
		cout << st.top().first << ',' << st.top().second << endl;
		st.pop();
	}

}

void get_result(stack< pair<int, int> > *st) {
	int i, st_size, num = 0, area = 0;
	int empty_flag  = 0;
	int area_each_puddle[MAX_STR_LEN / 2] = {0};

	st_size = st->size();
	for (i = 0; i < st_size && empty_flag != 1; i++) {
		while (st->size() > 0) {
			if (st->top().second == 0) {
				st->pop();
				if (st->size() == 0) {
					empty_flag = 1;
					break;
				}
			}
			else {
				break;
			}
		}

		if (empty_flag == 1) {
			break;
		}
		else {
			area_each_puddle[i] = st->top().second;
			area += area_each_puddle[i];
			num++;
			st->pop();
			if (st->size() == 0) {
				empty_flag = 1;
				break;
			}
		}
	}

	//print result
	cout << area << endl;
	if (area == 0) {
		cout << 0 << endl;
	}
	else {
		// print num of puddle
		cout << num;

		//print each area of puddles
		for (i = num - 1; i >= 0; i--)
			cout << ' ' << area_each_puddle[i];

		cout << endl;
	}
}

Measured memory_bytes: 3296
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        
        Scanner sc = new Scanner(System.in);
        
        int n = Integer.parseInt(sc.next());
        int k = Integer.parseInt(sc.next());
        
        String s = Integer.toString(n, k);
        System.out.println(s.length());
    }
}

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

int main() { /* ここに書く */
  
  int N,K;
  cin >> N >> K;
  
  vector<bool>child(N);
  
  for(int i = 0; i<K ; i++){
    
    int d;
    cin >> d;
    
    for(int j = 0; j<d ; j++){
      
      int A;
      cin >> A;
      A--;
      child.at(A) = 1;
      
    }
  }
  
    int f;

  for(int i = 0; i<N ; i++){

    if(child.at(i) == 0){
      f = f +1;
  }

  }
  
    cout << f << endl;
    

}


Measured memory_bytes: 3628
N = int(input())						# 5
a = [int(i) for i in input().split()]	# 1 2 3 4 5 ...


a_max = max(a)
a_min = min(a)

# print(a_max)
# print(a_min)


l = [0] * (a_max+3) # *を用いた初期化 ← こっちの方が高速

for i in range(N):
	x = a[i]
#	print(x, l[x])

	l[x]   = l[x]   + 1
#	l[x-1] = l[x-1] + 1
	l[x+1] = l[x+1] + 1
	l[x+2] = l[x+2] + 1

#print(l)
l[0] = 0
#l[len(l)-1] = 0
print(max(l))


Measured memory_bytes: 13964
#include <algorithm>
#include <cmath>
#include <climits>
#include <functional>
#include <iostream>
#include <queue>
#include <string>
#include <numeric>
#include <vector>
#include <map>

using namespace std;
using ll = long long;
template<typename T> void print(T t) {cout << t << endl;}


vector<pair<ll, int>> prime_factorize(ll n) {
    vector < pair < ll, int >> res;
    int num = 0;
    while (n % 2 == 0) {
        num++;
        n /= 2;
    }
    if (num != 0) res.emplace_back(make_pair( 2, num ));

    for (ll p = 3; p * p <= n; p += 2) {
        num = 0;
        while (n % p == 0) {
            num++;
            n /= p;
        }
        if (num != 0) res.emplace_back(make_pair(p, num));
    }
    if (n != 1)res.emplace_back(make_pair(n, 1));
    return res;
}

int main() {
	ll N, ans=0;
	cin >> N;
    auto list = prime_factorize(N);
    for (const auto [_, n] : list) {
        for (int k = 1; k * (1 + k) / 2 <= n; k++) ans++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 3624
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>

using namespace std;
#define ll long long
const int maxn = 2*100000+5;
ll a[maxn];

int main()
{
    int n;
    int i;
    ll minn,temp;

    while(scanf("%d",&n) == 1)
    {
        a[0]=0;
        for(i = 1;i <= n;i++)
        {
            scanf("%lld",&temp);
            a[i] = a[i-1] + temp;
        }
        minn = abs(a[n]-a[1]-a[1]);
        for(i = 2;i < n;i++)
        {
            minn = min(minn,abs(a[n]-a[i]-a[i]));
        }
        printf("%lld\n",minn);
    }

    return 0;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#ifdef LOCAL_DEBUG
  #include "LOCAL_DEBUG.hpp"
#endif
#define int long long

void fail(){
  cout << -1 << endl;
  exit(0);
}

signed main(){

  string s; cin >> s;

  int n = s.size();
  if(s[0] != '1' || s[n-1] != '0') fail();
  for(int i = 1; i < n-1; i++){
    if(s[i] != s[n-1 - i-1]) fail();
  }

  queue<int> q;
  for(int i = 0; i < n; i++){
    if(s[i] == '1'){
      q.push(i + 1);
    }
  }
  q.push(n);
  //uの部分グラフがs[u]になればいい
  for(int i = 1; i < n; i++){
    if(i == q.front()){
      q.pop();
    }
    cout << i << " " << q.front() << endl;
  }

  return 0;
}


Measured memory_bytes: 2304
#include <bits/stdc++.h>
#define ll unsigned long long
#define fir first
#define sec second
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
struct sushi
{
    int delicious;
    int type;
    int id;
    bool operator<(const sushi &another) const
    {
        return delicious < another.delicious;
    };
    bool operator>(const sushi &another) const
    {
        return delicious > another.delicious;
    };
};
void printsushi(sushi s[], int n)
{
    rep(i, n)
    {
        cout << "id:" << s[i].id << ",delicious:" << s[i].delicious << ",type:" << s[i].type << endl;
    }
}

ll eval(priority_queue<sushi, vector<sushi>, greater<sushi>> base, priority_queue<sushi, vector<sushi>, greater<sushi>> opt, int mpsize)
{
    auto evbase = base, evopt = opt;
    ll ret = 0;
    while (!evbase.empty())
    {
        ret += evbase.top().delicious;
        evbase.pop();
    }
    while (!evopt.empty())
    {
        ret += evopt.top().delicious;
        evopt.pop();
    }
    ret += (ll)mpsize * (ll)mpsize;
    return ret;
}

int main()
{
    int n, k;
    clock_t c = clock();
    cin >> n >> k;
    sushi tt[n];
    priority_queue<sushi> all;
    priority_queue<sushi, vector<sushi>, greater<sushi>> base, opt;

    rep(i, n) tt[i] = sushi{0, -1, -1};
    rep(i, n)
    {
        int t, d;
        cin >> t >> d;
        sushi nsushi = sushi{d, t, i};
        all.push(nsushi);
        tt[nsushi.type - 1] = max(tt[nsushi.type - 1], nsushi);
    }
    map<int, bool> mp;
    rep(i, k)
    {
        sushi s = all.top();
        all.pop();
        if (mp.find(s.type) == end(mp))
        {
            base.push(s);
            mp[s.type] = true;
        }
        else
        {
            opt.push(s);
        }
    }
    priority_queue<ll> ans;
    ans.push(eval(base, opt, mp.size()));
    ll nowans = ans.top();
    while (!all.empty() && mp.size() != k)
    {
        sushi s = all.top();
        all.pop();
        if (mp.find(s.type) != end(mp))
            continue;
        mp[s.type] = true;
        int lossdesicious = opt.top().delicious, gaindelicious = s.delicious, ms = mp.size();
        opt.pop();
        base.push(s);
        nowans = nowans - lossdesicious + gaindelicious - (ms - 1) * (ms - 1) + ms * ms;
        ans.push(nowans);
    }
    cout << ans.top() << endl;
    return 0;
}


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

int main() {
    int k, s;
    cin >> k >> s;
    int counter = 0;

    for (int x = 0; x <= k; x++) {
        for (int y = 0; y <= k; y++) {
            if (0 <= s - x - y && s - x - y <= k) {
                counter++;
            }
        }
    }

    cout << counter << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<=n;i++)
typedef long long ll;
 
int main(){
  char c;
  cin>>c;
  cout<<char(c+1)<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <string>
#include <iomanip>
#include <map>
#include <set>
#include <cmath>
#include <cstdio>
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)++)
#define All(v) (v).begin(),(v).end()
typedef long long ll;

int main(){
    int x,y,s;
    while(cin >> x >> y >> s,x|y|s){
        int res = 0;
        for(int a=1;a<s;a++){
            for(int b=1;b<s;b++){
                if((a*(100+x))/100+(b*(100+x))/100==s){
                    res=max(res,(a*(100+y))/100+(b*(100+y))/100);
                }
            }
        }
        cout << res << endl;
    }
    return 0;
}


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

int main()
{
    string S;
    cin >> S;

    int l = 0;
    int r = S.size() - 1;
    int ans = 0;
    while (l < r)
    {
        if (S[l] != S[r])
        {
            ans++;
        }
        l++;
        r--;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
using namespace std;
int main() {

  int M1,D1,M2,D2;
  cin>>M1>>D1>>M2>>D2;
  
  if(D2==1){
    cout<<1<<endl;
  }
  else{
    cout<<0<<endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
using namespace std;
const int MOD = 1000000007;
const ll INF = 1LL << 60;
int main() {
   cin.tie(0);
   ios::sync_with_stdio(false);
   string s, t;
   cin >> s >> t;
   ll cnt = 0;
   for(int i = 0; i < s.length(); ++i) {
       if(s[i]!=t[i])cnt++;
   }
   cout << cnt << endl;
}

Measured memory_bytes: 3792
# include <bits/stdc++.h>
# define ll int64_t
# define rep(i,n) for(ll i=0;i<n;i++)
# define rrep(i,n) for(ll i=1;i<=n;i++)
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size())
# define pb push_back
# define mod 1000000007

using namespace std;

bool compare_by_b(pair<ll,ll> a,pair<ll,ll> b){
    if(a.second != b.second) return a.second<b.second;
    else return a.first<b.first;
}

bool my_compare(pair<ll,ll> a,pair<ll,ll> b){
    
    if(a.first != b.first) return a.first<b.first;
    if(a.second != b.second) return a.second>b.second;
    else return true;
}

ll factorial(ll n){
    ll x=1;
    rrep(i,n) x*=i;
    return x;
}

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

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

void f(ll rest,string s){
    if(rest==0){
        cout<<s<<endl;
    }else{
        for(char c='a';c<='c';c++){
            f(rest -1,s+c);
        }
    }
}


int main(){
    ll n;
    cin>>n;
    vector<pair<ll,ll>> a(n);
    rep(i,n) cin>>a[i].first>>a[i].second;
    
    sort(ALL(a),compare_by_b);
    ll sum=0;
    rep(i,n){
        sum+=a[i].first;
        if(sum>a[i].second){
            cout<<"No"<<endl;
            return 0;
        }
    }
    cout<<"Yes"<<endl;
    return 0;
}


Measured memory_bytes: 3328
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
 
using namespace std;
 
int main(){
    long long N, M;
    int AC[100001];
    cin >> N >> M;
    for(long long i=1; i<=N; i++){
        AC[i] = 0;   
    }
    
    long long problem = 0;
    string result;
    
    long long numac = 0;
    long long penalty = 0;
    
    for(long long i=1; i<=M; i++){
        cin >> problem >> result;
        if(AC[problem] != -1 && result == "WA"){
            AC[problem]++;
        }
        else if(AC[problem] != -1 && result == "AC"){
            penalty += AC[problem];
            numac++;
            AC[problem] = -1;
        }
    }
    
    cout << numac << " " << penalty;
    
    return 0;
}

Measured memory_bytes: 640
#include <algorithm>
#include <iostream>
#include <vector>
#include <numeric>
#include <string>
#include <stdio.h>
using namespace std;
int main()
{
    int N;
    cin >> N;
    vector<int> vec(N);
    for(int i=0; i<N; i++){
      cin >> vec.at(i);
    }
    sort(vec.begin(), vec.end());
    for(int i=0; i<N-1; i++){
      if(vec.at(i)-vec.at(i+1) == 0){
        printf("%s\n", "NO");
        return 0;
      }
    }
    printf("%s\n", "YES");
    return 0;
}

Measured memory_bytes: 1024
import java.util.*;
public class Main{
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] A = new int[N];
		int[] B = new int[N];
		long buf = 0;
		for(int i = 0;i < N;i++){
			A[i] = sc.nextInt() - 1;
			B[i] = A[i];
		}
		Arrays.sort(A);
		int count = 1;
		int[] num = new int[N];
		num[A[0]] = 1;
		for(int i = 1;i < N;i++){
			if(A[i - 1] == A[i]){
				count++;
				if(i == N-1){
					num[A[i]] = count;
				}
			}else{
				num[A[i - 1]] = count;
				count = 1;
				if(i == N-1){
					num[A[i]] = 1;
				}
			}
		}
		for(int i = 0;i < N;i++){
			if(num[i] > 1){
				buf += (long)((long)num[i] * (long)(num[i] - 1) / 2);
			}
		}
		for(int i = 0;i < N;i++){
			long ans = buf;
			if(num[B[i]] > 1){
				ans -= (num[B[i]] - 1);
			}
			System.out.println(ans);
		}
	}
}

Measured memory_bytes: 99400
import bisect
import string
N=int(input())

s=string.ascii_lowercase

k=1
lis=[0]
for i in range(11):
    k*=26
    lis.append(k+lis[-1])
#print(lis)

keta=bisect.bisect(lis, N-1)
#print(keta,N-lis[keta-1])

ans=''
n=N-lis[keta-1]-1
for i in range(keta):
    q,m=divmod(n,26)
    #print(q,m)
    n=q
    ans+=s[m]
print(ans[::-1])


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

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout.precision(12);
    cout.setf(ios_base::fixed, ios_base::floatfield);
    
    int a, b, q;
    cin >> a >> b >> q;
    int64_t s[100002], t[100002];
    s[0] = t[0] = -20'000'000'000;
    for(int i=1;i<=a;i++) cin >> s[i];
    for(int i=1;i<=b;i++) cin >> t[i];
    s[a+1] = t[b+1] = 30'000'000'000;

    for(int i=0;i<q;i++){
        int64_t x;
        cin >> x;
        int64_t *rt = lower_bound(s, s+a+2, x);
        int64_t *lt = lower_bound(s, s+a+2, x+1) - 1;
        int64_t *rs = lower_bound(t, t+b+2, x);
        int64_t *ls = lower_bound(t, t+b+2, x+1) - 1;
        int64_t ans = INT64_MAX;
        // right
        if(*rt < *rs){
            int64_t *rls = lower_bound(t, t+b+2, *rt+1) - 1;
            int64_t *rrs = lower_bound(t, t+b+2, *rt);
            ans = min(ans, *rt-x + min(*rt-*rls, *rrs-*rt));
        }else if(*rs < *rt){
            int64_t *rlt = lower_bound(s, s+a+2, *rs+1) - 1;
            int64_t *rrt = lower_bound(s, s+a+2, *rs);
            ans = min(ans, *rs-x + min(*rs-*rlt, *rrt-*rs));
        }
        // left
        if(*lt > *ls){
            int64_t *lls = lower_bound(t, t+b+2, *lt+1) - 1;
            int64_t *lrs = lower_bound(t, t+b+2, *lt);
            ans = min(ans, x-*lt + min(*lt-*lls, *lrs-*lt));
        }else if(*ls > *lt){
            int64_t *llt = lower_bound(s, s+a+2, *ls+1) - 1;
            int64_t *lrt = lower_bound(s, s+a+2, *ls);
            ans = min(ans, x-*ls + min(*ls-*llt, *lrt-*ls));
        }
        cout << ans << endl;
    }
    
    return 0;
}

Measured memory_bytes: 2944
#include<iostream>
#include<vector>
#include<queue>
#include<numeric>
using namespace std;
typedef long long ll;

int main(){
    int n;
    cin >> n;
    vector<vector<int>> v(n, vector<int>(n-1));
    for(int i = 0; i < n; i++){
        for(int j = 0; j < n-1; j++){
            cin >> v[i][j];
            v[i][j]--;
        }
    }
    vector<vector<int>> num(n, vector<int>(n));
    int k = 0;
    for(int i = 0; i < n; i++){
        for(int j = i+1; j < n; j++){
            num[i][j] = num[j][i] = k++;
        }
    }
    vector<int> edge[k], indeg(k, 0);
    for(int i = 0; i < n; i++){
        for(int j = 0; j+1 < n-1; j++){
            int ida = num[i][v[i][j]], idb = num[i][v[i][j+1]];
            bool found = false;
            for(int x : edge[ida])  found |= x==idb;
            if(found)   continue;
            edge[ida].push_back(idb);
            indeg[idb]++;
        }
    }
    queue<pair<int,int>> q;
    for(int i = 0; i < k; i++){
        if(indeg[i] == 0)   q.push({i, 1});
    }
    int ans;
    while(!q.empty()){
        auto p = q.front(); q.pop();
        ans = p.second;
        for(int next : edge[p.first]){
            indeg[next]--;
            if(indeg[next] == 0){
                q.push({next, ans+1});
            }
        }
    }
    cout << (accumulate(indeg.begin(), indeg.end(), 0ll) == 0 ? ans : -1) << endl;
    return 0;
}

Measured memory_bytes: 37376
using System;
using System.Collections.Generic;
class Program
{
	static void Main(string[] args)
	{
		string str = Console.ReadLine();
		long N = long.Parse(str);
		string[] str1 = Console.ReadLine().Split();
		string[] str2 = Console.ReadLine().Split();
		string[] str3 = Console.ReadLine().Split();
		long[] A = new long[N];
		long[] B = new long[N];
		long[] C = new long[N];
		for(var i=0;i<N;i++){
			A[i] = long.Parse(str1[i]);
			B[i] = long.Parse(str2[i]);
			C[i] = long.Parse(str3[i]);
		}
		Array.Sort(A);
		Array.Sort(B);
		Array.Sort(C);
		long count = 0;
		long at = 0;
		long ct = 0;
		long tt = 0;
		for(var i=0;i<N;i++){
			while(at < N){
				if(A[at] < B[i]){
					at += 1;
				} else {
					break;
				}
			}
			tt = at;
			while(ct < N){
				if(C[ct] <= B[i]){
					ct += 1;
				} else {
					break;
				}
			}
			count += tt * (N-ct);
		}
		Console.WriteLine(count);
	}
}

Measured memory_bytes: 40796
#include <stack>
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <cmath>
#include <array>
#include <iomanip>
#include <string>
#include <limits>
using namespace std;
int gcd(int a, int b)//最大公約数
{
   if (a%b == 0)
   {
       return(b);
   }
   else
   {
       return(gcd(b, a%b));
   }
}
int mod = 1000000000 + 7;
vector<int> v;
class Calc
{
    // 宣言
    long long a;

    public:
        // 素因数分解
        void decompositPrime(long long a);
};

/*
 * 素因数分解
 */
void Calc::decompositPrime(long long n)
{
    // 割る数の初期値
    a = 2;
    // √n ≧ a ( n ≧ a * a ) の間ループ処理
    while (n >= a * a) {
        // a で割り切れたら、a は素因数
        // そして、割られる数を a で割る
        // a で割り切れなかったら、 a を 1 増加させる
        if (n % a == 0) {
            //printf("%d * ", a);
             v.push_back(a);
            n /= a;
        } else {
            a++;
        }
    }
    // 最後に残った n は素因数
    v.push_back(n);
    //printf("%d\n", n);
}
vector<int> divisor(int n) {//約数発見
    vector<int> ret;
    for (int i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            ret.push_back(i);
            if (i * i != n) ret.push_back(n / i);
        }
    }
    std::sort(ret.begin(), ret.end());
    return ret;
}
long nc2(long n){
    return n*(n-1)/2;
}
int main(){
    //std::stack<int> stack;
    int n;
    cin >> n;
    long tot = 0;
    vector<int> a(n);
    vector<long> cnt(n, 0);
    for(int i = 0; i < n; i++){
        cin >> a[i];
        a[i] --;
        cnt[a[i]] ++;
    }
    for(int i = 0; i < n; i++){
        tot += nc2(cnt[i]);
    }
    //cout << tot << endl;
    for(int i = 0; i < n; i++){
        long ans = tot;
        ans -= nc2(cnt[a[i]]);
        ans += nc2(cnt[a[i]]-1);
        cout << ans << endl;
    }
    //cout << ans << endl;
    return 0;
}






Measured memory_bytes: 4992
#include<bits/stdc++.h>
using namespace std;
vector<int>cnt;
int main()
{
	int a[9]={1,3,6,10,15,21,28,36,45};
	int res=0;
	long long n;
	cin>>n;
	for(long long i=2;i*i<=n;i++)
	{
		int k=0;
		while(n%i==0)
		{
			k++;
			n=n/i;
		}
		cnt.push_back(k);
	}
	if(n!=1)
		cnt.push_back(1);
	for(int i=0;i<cnt.size();i++)
	{
		int j=0;
		while(cnt[i]>=a[j])
		{
			j++;
		//	cout<<j;
		}
		res+=j;
	//	cout<<res<<" ";
	}
	cout<<res;
	return 0;
 } 

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

#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/tag_and_trait.hpp>
using namespace __gnu_pbds;

using key=pair<int,int>;
using Tree=tree<key,null_type,less<key>,rb_tree_tag,tree_order_statistics_node_update>;

using ll=long long;
int main(){
    int n;
    cin>>n;
    vector<int> a(n);
    for(int i=0;i<n;i++) cin>>a[i];
    vector<int> aa(n);
    for(int i=0;i<n;i++) aa[i]=a[i];
    sort(aa.begin(),aa.end());
    int lb=0;
    int ub=n;
    
    while(ub-lb>1){
        int mididx=(ub+lb)/2;
        int mid=aa[mididx];
        vector<int> b(n);
        for(int i=0;i<n;i++){
            if(mid<=a[i]) b[i]=1;
            else b[i]=-1;
        }
        int sum=0;
        Tree tr;
        for(int i=0;i<n;i++){
            sum+=b[i];
            tr.insert(make_pair(sum,i));
        }
        sum=0;
        ll cnt=0;
        for(int i=0;i<n;i++){
            int sc=tr.order_of_key(make_pair(sum,-1));
            cnt+=(tr.size()-sc);
            sum+=b[i];
            tr.erase(tr.find(make_pair(sum,i)));
        }
        
        if(cnt>=ll(n)*(n+1)/4+(ll)(ll(n)*(n+1)%4!=0)){
            lb=mididx;
        }
        else{
            ub=mididx;
        }
    }
    cout<<aa[lb]<<endl;
    return 0;
}

Measured memory_bytes: 7720
//#include<bits\stdc++.h>
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<cstring>
#include<string>
#include<ctime>
#include<cmath>
#include<cctype>
#include<cstdlib>
#include<queue>
#include<deque>
#include<stack>
#include<vector>
#include<algorithm>
#include<utility>
#include<bitset>
#include<set>
#include<map>
#define ll long long
#define db double
#define INF 2000000000
#define inf 10000000000000000ll
#define ldb long double
#define pb push_back
#define get(x) x=read()
#define gt(x) scanf("%d",&x)
#define put(x) printf("%d\n",x)
#define putl(x) printf("%lld\n",x)
#define gc(a) scanf("%s",a+1)
#define rep(p,n,i) for(RE int i=p;i<=n;++i)
#define go(x) for(int i=lin[x],tn=ver[i];i;tn=ver[i=nex[i]])
#define fep(n,p,i) for(RE int i=n;i>=p;--i)
#define pii pair<int,int> 
#define mk make_pair
#define RE register
#define P 1000000007
#define S second
#define gf(x) scanf("%lf",&x)
#define pf(x) ((x)*(x))
#define ull unsigned long long
#define S second
#define F first
#define l(p) t[p].l
#define r(p) t[p].r
#define sum(p) t[p].sum
#define tag(p) t[p].tag
#define zz p<<1
#define yy p<<1|1
using namespace std;
char buf[1<<15],*fs,*ft;
inline char getc()
{
    return (fs==ft&&(ft=(fs=buf)+fread(buf,1,1<<15,stdin),fs==ft))?0:*fs++;
}
inline int read()
{
    RE int x=0,f=1;char ch=getc();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getc();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getc();}
    return x*f;
}
int n;
int main()
{
	//freopen("1.in","r",stdin);
	get(n);ll ans=0;
	rep(1,n,i)
	{
		if(i%3==0||i%5==0)continue;
		ans+=i;
	}
	putl(ans);
	return 0;
}

Measured memory_bytes: 3760
package main

import (
	"fmt"
)

func main() {
	var a, b, c int
	fmt.Scanf("%d %d %d", &a, &b, &c)

	min := []int{a + b, b + c, c + a}

	result := a + b

	for _, num := range min {
		if num < result {
			result = num
		}
	}

	fmt.Printf("%d\n", result)
}

Measured memory_bytes: 512
#include <iostream>
#include <map>
#include <algorithm>
#include <string>
#include <vector> 
#include <numeric>
#include <cmath>
#include <queue>
#include <iomanip>
#include <functional>


#define CHMAX(a,b) a = std::max(a,b)
#define CHMIN(a,b) a = std::min(a,b)
#define MAXMIN(a,b,c) std::max(a,min(b,c))
#define CHABS(a) a = std::abs(a) 
#define COUT(a) std::cout << a << std::endl
#define CERR(a) std::cerr << a << std::endl
#define FOR(n) for(lli i = 0; i < n; i++)

using namespace std;
using lli = long long int;
using pll = pair<lli, lli>;
using tlll = tuple<lli, lli, lli>;
using vll = vector<lli>;

lli mod197 = 1000000007LL;
lli INF = 10000000000000;

// ax + by = gcd(a,b) 最大公約数
template< typename T >
T extgcd(T a, T b, T& x, T& y) {
	T d = a;
	if (b != 0) {
		d = extgcd(b, a % b, y, x);
		y -= (a / b) * x;
	}
	else {
		x = 1;
		y = 0;
	}
	return d;
}

int H[200001] = {};

int main(void) {

	int N, K;
	cin >> N >> K;


	lli ans = 0;

	for (int i = 0; i < N; i++) {
		cin >> H[i];
	}

	sort(H, H + N);


	for (int i = 0; i < N - K; i++) {
		ans += H[i];
	}

	COUT(ans);

	return 0;
}


Measured memory_bytes: 1024
N,K= map(int, input().split())
List = list(map(int, input().split()))
num=0
s=0
for i in range(K):
    s+=(List[i]+1)
num=0
#print(s)
if N==K:
    print(s/2)
else:
    
    for i in range(N-K):
        a=List[i+K]-List[i]
        #print(a)
        n1=s+a
        s=n1
        n1=n1/2
        if n1>=num:
            num=n1
    print(num)

Measured memory_bytes: 32176
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<n; i++)
typedef long long int ll;
typedef pair<int, int> P;
#define INF 1e9 + 7

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

    int n;
    cin >> n;
    ll h[n];
    rep(i,n) cin >> h[i];
    
    string ans = "Yes";
    
    for(int i=n-1; i>0; i--){
        if(h[i-1] > h[i]){
            h[i-1] -= 1;
        }
        
        if(h[i-1] > h[i]){
            ans = "No";
          	break;
        }
    }
    
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
  
using namespace std;
  
template<class T> void ckmin(T &a, T b) { a = min(a, b); }
template<class T> void ckmax(T &a, T b) { a = max(a, b); }
  
#define pb push_back
#define mp make_pair
#define cotu cout
#define itn int
#define Red ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define F first
#define S second
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int i = 0; i < n; ++i)
#define repr(i,n) for(int i = n - 1; i >= 0; --i)
#define Rep(i, a, n) for(int i = (a); i <=(n); ++i)
#define repst(i, n) for(auto it = n.begin(); it != n.end(); ++it)
#define Repr(i, a, n) for(int i = (n); i >= (a); --i)
  
#define ordered_set tree<int , null_type,less<int >, rb_tree_tag,tree_order_statistics_node_update> 
  
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
  
typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
  
const int inf = int(1e9);
const int mod = inf + 7;
const int N = 1e6 + 555; // TL MB
const double PI = acos(-1.0);
 
void mul(ll &x, ll y){
	x *= y;
	if(x >= mod) x %= mod;
}
 
void add(ll &x, ll y){
	x += y;
	if(x >= mod) x -= mod;
	if(x < 0) x += mod;
}
ll bp(ll a, ll n){
	ll r = 1;
	while(n){
		if(n & 1) mul(r, a);
		mul(a, a);
		n >>= 1;
	}
	return r;
}

int bad[N];
void solve()
{
	int n, m, x;
	cin >> n >> m >> x;
	for(int i = 0; i < m; ++i){
		int a;
		cin >> a;
		bad[a] = 1;
	}
	int fsum = 0, ssum = 0;
	for(int i = x - 1; i >= 0; --i){
		fsum += bad[i];
	}
	
	for(int i = x + 1; i <= n; ++i){
		ssum += bad[i];
	}
	cout << min(fsum, ssum) << endl;
}


 
 
int main()
{
    Red;
  	//int T; cin >> T; while(T--)
    solve();
    return 0;
}

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

int main(){
    int w,n;
    cin >> w >> n;
    
    vector<int> lots(w);
    for(int i=0; i<w; i++){
        lots[i] = i+1;
    }
    
    for(int i=0; i<n; i++){
        int a,b;
        scanf("%d,%d",&a,&b);
        swap(lots[a-1],lots[b-1]);
    }
    
    for(int i=0; i<w; i++){
        cout << lots[i] << endl;
    }
    
    return 0;
}
    
    
        
    

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

int main(){
  int A, B;
  cin >> A >> B;
  
  if (A == 1) A = 100;
  if (B == 1) B = 100;
  
  if (A > B) cout << "Alice" << endl;
  else if (A < B) cout << "Bob" << endl;
  else cout << "Draw" << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
	int t;
	long long a[100010];
	scanf("%d", &t);
	
	for(int i=0; i<t; i++){
		scanf("%lld", &a[i]);
		if (a[i]==0){
			printf("%d\n", 0);
			return 0;
		}
	}
	long long u=1;
	long long s=1e18;
	for(int i=0; i<t; i++){
			s/=a[i];
			if(s<1){
			printf("%d\n", -1);
			return 0;
			}
			else{
			u*=a[i];
			if(s>=1 && i==(t-1)) {
				printf("%lld\n", u);
				}
			}
			}
		

	
	return 0;
}

Measured memory_bytes: 2464
use proconio::input;
use std::collections::HashMap;

const MOD: usize = 1_000_000_007;

fn main() {
    input! {
        n: usize,
        aa: [usize; n],
    }

    let mut map = HashMap::new();

    for a in aa {
        *map.entry(a).or_insert(0) += 1;
    }

    if n % 2 == 1 {
        if let Some(&count) = map.get(&0) {
            if count != 1 {
                println!("0");
                return;
            }
        } else {
            println!("0");
            return;
        }
        map.remove(&0);
    }

    for (&k, &v) in map.iter() {
        if k % 2 == n % 2 || v != 2 {
            println!("0");
            return;
        }
    }

    let mut ans = 1;

    for _ in 0..map.len() {
        ans *= 2;
        ans %= MOD;
    }

    println!("{}", ans);
}


Measured memory_bytes: 6828
A = int(input())
B = int(input())
C = int(input())
X = int(input())
X = X // 50

ans = 0
for ai in range(A+1):
  for bi in range(B+1):
    for ci in range(C+1):
      if 10*ai + 2*bi + ci == X:
        ans += 1
        
print(ans)


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

N, Q = map(int, input().split())
S = input()
LR = [list(map(int, input().split())) for i in range(Q)]

lst = [0] * N
count = 0
for i in range(N - 1):
    if S[i] == 'A' and S[i + 1] == 'C':
        count += 1
    lst[i + 1] = count

for l, r in LR:
    ans = lst[r-1] - lst[l-1]
    print(ans)


Measured memory_bytes: 68892
#include <stdio.h>

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

Measured memory_bytes: 1648
# D
n, W = map(int, input().split())
w = []
v = []
for i in range(n):
    ww, vv = map(int, input().split())
    w.append(ww)
    v.append(vv)
    
dp = [[0]*(W+1) for _ in range(n+1)]
for i in range(n):
    for j in range(W+1):
        if j < w[i]:
            dp[i+1][j] = dp[i][j]
        else:
            dp[i+1][j] = max(dp[i][j], dp[i][j-w[i]]+v[i])
print(dp[n][W])

Measured memory_bytes: 120300
from sys import stdin
input = stdin.readline

MOD = 10**9 + 7





def solve():
    N,M = map(int,input().split())
    # print(cntA*dp(M,N)%MOD)
    fac = [1,1] + [0] * M
    inv = [1,1] + [0] * M
    for i in range(2,M+1):
        fac[i] = (fac[i-1]*i)%MOD
    inv[M] = pow(fac[M],MOD-2,MOD)
    for i in range(M-1,1,-1):
        inv[i] = inv[i+1]*(i+1)%MOD
    def p(a,b):
        return (fac[b]*inv[b-a])%MOD
    def c(a,b):
        return (fac[b]*inv[a]*inv[b-a]) % MOD
    res = p(N,M)
    for i in range(1,N+1):
        res += (-1)**(i&1)*c(i,N)*p(N-i,M-i)
        res %= MOD
    print(res* p(N,M)%MOD)




if __name__ == '__main__':
    solve()


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

int main() {
  int a, b, c, x, ans, i, j, k;
  ans = 0;
  cin >> a >> b >> c >> x;
  for(i=0; i <= a; i++){
    for(j=0; j <= b; j++){
      for(k=0; k <= c; k++){
        if(i*500 + j*100 + k*50 ==x){
		  ans++;
        }
      }
      k = 0;
    }
    j = 0;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include<stdio.h>
#define MAXSIZE 3000
using namespace std;
int main(){
  int x,y;
  std::cin >> x>>y;
  std::cout << x/y<<" "<<x%y;
  double ans=(double)x/y;
  printf(" %.8lf\n", ans);
}

Measured memory_bytes: 3220
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;cin >> n;
	vector<string> s(n);
	rep(i,n) cin >> s[i];
	vector<vector<int>> a(n,vector<int>(26,0));
	rep(i,n){
		rep(j,s[i].size()){
			a[i][s[i][j]-'a']++;
		}
	}
	vector<int> m(26,10000);
	rep(i,26){
		rep(j,n){
			m[i]=min(m[i],a[j][i]);
		}
	}
	rep(i,26){
		char c='a'+i;
		rep(j,m[i]){
			cout << c;
		}
	}
	cout << endl;
}

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

int main(){
  int N;
  cin >> N;
  
  vector<double> x(N); //i人目の親戚からもらったお年玉の金額
  vector<string> u(N); //i人目の親戚からもらったお年玉が"JPY "か"BTC"か
  
  for(int i=0 ; i < N; i++){
    cin >> x[i];
    cin >> u[i];
  }
  
  double money = 0; // 高橋君が合計でもらった金額
  
  for(int i = 0 ; i < N; i++){
    if(u[i] == "JPY"){
      money += x[i];
    }
    else if(u[i] == "BTC"){
      money += x[i]*380000.0;
    }
  }
  
  cout << money << endl;
  
  return 0;
}
      

Measured memory_bytes: 256
n,k = map(int,input().split())
s = input()
ans = s.count("RL") * 2
ans1 = 0
if s[0]=="L":
	ans1 += 1
if s[-1]=="R":
	ans1 += 1
while k > 0:
	if ans > 0:
		if ans == 2 and ans1 == 0:ans1 += 1;ans -= 2;break
		ans -= 2
	elif ans1 == 2:
		ans1 -= 1
	k -= 1
print(n - ans - ans1)


Measured memory_bytes: 3316
N = int(input())
ans = 0
pattern = {"BA":0,"A":0,"B":0}
for i in range(N):
    s = input()
    ans += s.count("AB")
    if(s[0]=="B" and s[-1]=="A"):
        pattern["BA"]+=1
    elif(s[-1]=="A"):
        pattern["A"]+=1
    elif(s[0]=="B"):
        pattern["B"]+=1

if pattern["BA"]==0:
    ans += min(pattern["A"], pattern["B"])
else:
    ans += pattern["BA"]-1
    ans += pattern["A"]>0
    ans += pattern["B"]>0
    ans += max(0, min(pattern["A"]-1, pattern["B"]-1))
print(ans)    

Measured memory_bytes: 3064
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace _0164
{
    public class Program

    {
        public static void Main(string[] args)
        {

            while (true)
            {
                int n = RInt(); if (n == 0) break;
                int[] a = RIntAr();

                int ohajiki = 32;
                int turn = 0;
                while (ohajiki > 0)
                {
                    if (turn % 2 == 0)
                    {
                        //taro
                        ohajiki -= (ohajiki - 1) % 5;
                    }
                    else
                    {
                        //jiro
                        int subNum = a[((turn - 1) / 2) % n];
                        ohajiki -= subNum > ohajiki ? ohajiki : subNum;
                    }
                    Console.WriteLine(ohajiki);
                    turn++;
                }
            }

        }

        static string RSt() { return Console.ReadLine(); }
        static int RInt() { return int.Parse(Console.ReadLine().Trim()); }
        static long RLong() { return long.Parse(Console.ReadLine().Trim()); }
        static double RDouble() { return double.Parse(Console.ReadLine()); }
        static string[] RStAr(char sep = ' ') { return Console.ReadLine().Trim().Split(sep); }
        static int[] RIntAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => int.Parse(e)); }
        static long[] RLongAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => long.Parse(e)); }
        static double[] RDoubleAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => double.Parse(e)); }
        static string WAr<T>(IEnumerable<T> array, string sep = " ") { return string.Join(sep, array.Select(x => x.ToString()).ToArray()); }
    }

}



Measured memory_bytes: 13864
use std::io::*;
use std::cmp;

fn read<T: std::str::FromStr>() -> T {
    let stdin = stdin();
    let mut buf = String::new();
	stdin.lock().read_line(&mut buf);
	buf.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
	read::<String>().trim().split_whitespace()
        .map(|w| w.parse().ok().unwrap()).collect()
}

fn main() {
    let v = read_vec::<usize>();
    let a = read_vec::<usize>();
    let mut c1 = 0;
    let mut c2 = 0;
    for b in a {
        if b < v[2] {
            c1 += 1;
        } else {
            c2 += 1;
        }
    }
    let ans: usize = cmp::min(c1,c2);
    println!("{}",ans);
}


Measured memory_bytes: 4352