akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
vector<int> a,b;
vector<string> ans;
int n;
int main(){
	cin>>n;scanf("\n");
	for (int i=1;i<=2*n;i++){
		char e=getchar();
		if (e=='a')a.push_back(i);
		else b.push_back(i);
		if (a.size()==b.size()){
			string s="",t;
			if (a[0]<b[0]){
				int las=-1;
				for (int i=0;i<a.size();i++)
					if (las<a[i]){
						s=s+"ab";
						las=b[i];
					}
				ans.push_back(s);
			}
			else {
				s.append(2*a.size(),'a');
				for (int i=0;i<b.size();i++)s[b[i]-b[0]]='b';
				t=s;
				for (int i=0;i<b.size()-1;i++){
					for (int j=0;;j++){
						if (s[j]=='a'){
							s.erase(j,1);
							break;
						}
					}
					s.erase(0,1);
					t=max(t,s);
//					cout<<s<<endl;
				}
				ans.push_back(t);
			}
			a.clear();
			b.clear();
		}
	}
	string Ans="";
	for (;ans.size();ans.pop_back())Ans=max(Ans,ans.back()+Ans);
	cout<<Ans<<endl;
}

Measured memory_bytes: 384
#include<stdio.h>
#include<stdlib.h>

 
int top, S[101];
 
void push(int x)
{

    S[++top] = x;
}
 
int pop()
{
    top--;

    return S[top+1];
}
 
int main(){
    int a,b;
    char t[100];
     
    while(scanf("%s", t) != EOF){
        if(t[0] == '+'){
            a = pop();
            b = pop();
            push(a+b);
        }else if(t[0] == '-'){
            b = pop();
            a = pop();
            push(a-b);
        }else if(t[0] == '*'){
            a = pop();
            b = pop();
            push(a*b);
        }else{
            push(atoi(t));
        }
    }
    printf("%d\n", pop());
    return 0;
}


Measured memory_bytes: 2060
#include <cstdio>
#include <string>
#include <cmath>
#include <string>
#include <algorithm>
#include <iostream>
#include <map>
#include <vector>
#include <queue>
using namespace std;

// C - *3 or /2
int main(){
    int N;
    cin >> N;
    int A[11000];
    for(int i=0;i<N;++i){
        cin >> A[i];
    }
    int ans=0;
    for(int i=0;i<N;++i){
        int tmp = A[i];
        for(int j=0;j<1000;++j){
            if(tmp%2 == 1) break;
            tmp = tmp/2;
            ++ans;
        }
    }
    cout << ans << endl;
    return 0;
}




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

using namespace std;

#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx")

using llong = long long;
using ld = long double;
using ii = pair<int, int>;
using ull = unsigned long long;
using pll = pair<llong, llong>;
using vi = vector<int>;


#define endl "\n"
#define fi first
#define se second
#define left LEVO
#define right PRAVO
#define time CHAS
#define all(a) (a).begin(), (a).end()
#define prev PAPEREDNIKXD
#define next NASTUPNIKXD
#define pb push_back
#define deb cout<<"CHECK\n";
#define last(a) (a)[(a).size()-1]

#define elif else if
#define cclear cout<<flush;
#define fclear fflush(stdout);
#define x_files freopen("exam.in","r",stdin);freopen("exam.out","w",stdout);
#define kchay ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
 
const llong over999 = 1e14;
const ld eps = 1e-9;
const int base = 1000*1000;
const ld Pi = acos(-1);
const llong md = 1e9+7;
const llong ya = 0;

/*.st*/

string s;
int main() {
    kchay;   
    //x_files;
    
    cin >> s;
    
    cout << s[0] << s.size()-2 << last(s) << endl; 
    return 0;
}

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

Measured memory_bytes: 35588
/*
Author: CNYALI_LK
LANG: C++
PROG: abc.cpp
Mail: cnyalilk@vip.qq.com
*/
#include<bits/stdc++.h>
#define debug(...) fprintf(stderr,__VA_ARGS__)
#define DEBUG printf("Passing [%s] in LINE %d\n",__FUNCTION__,__LINE__)
#define Debug debug("Passing [%s] in LINE %d\n",__FUNCTION__,__LINE__)
#define all(x) x.begin(),x.end()
using namespace std;
const double eps=1e-8;
const double pi=acos(-1.0);
typedef long long ll;
typedef pair<int,int> pii;
template<class T>int chkmin(T &a,T b){return a>b?a=b,1:0;}
template<class T>int chkmax(T &a,T b){return a<b?a=b,1:0;}
template<class T>T sqr(T a){return a*a;}
template<class T>T mmin(T a,T b){return a<b?a:b;}
template<class T>T mmax(T a,T b){return a>b?a:b;}
template<class T>T aabs(T a){return a<0?-a:a;}
#define min mmin
#define max mmax
#define abs aabs
int read(){
	int s=0,base=1;
	char c;
	while(!isdigit(c=getchar()))if(c=='-')base=-base;
	while(isdigit(c)){s=s*10+(c^48);c=getchar();}
	return s*base;
}
char WriteIntBuffer[1024];
template<class T>void write(T a,char end){
	int cnt=0,fu=1;
	if(a<0){putchar('-');fu=-1;}
	do{WriteIntBuffer[++cnt]=fu*(a%10)+'0';a/=10;}while(a);
	while(cnt){putchar(WriteIntBuffer[cnt]);--cnt;}
	putchar(end);
}
int main(){
#ifdef cnyali_lk
	freopen("abc.in","r",stdin);
	freopen("abc.out","w",stdout);
#endif
	printf("%d\n",min(read(),read())+min(read(),read()));	
	return 0;
}



Measured memory_bytes: 764
#include<bits/stdc++.h>
using namespace std; 
int main()
{
	string str;
	cin>>str;
	//cout<<str;
	int array[4];
	for(int i=0;i<4;i++)
	array[i]=int(str[i]);
	
	sort(array,array+4);
	if(array[0]==array[1]&&array[2]==array[3]&&array[1]!=array[2])
	cout<<"Yes";
	else
	cout<<"No";
}

Measured memory_bytes: 256
/*
                                Author: Ankit Kaul
**********************Code Belongs to Respective Author Only************************************
*/
 
/*#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")*/
 
#include <bits/stdc++.h>
 
#define endl       '\n'
#define PI          3.141592653589
#define jaldi       ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define M           1000000007
#define int         long long int
#define inf         INT_MAX
#define pb          emplace_back
#define pf          emplace_front
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define rall(a)     (a).rbegin(),(a).rend()
using namespace std;
 
int gcd(int a,int b) { return b == 0 ? a : gcd(b, a % b); }
int power(int x,int n){
    int result=1;
    while(n>0)
    {
        if(n % 2 ==1)
            result=(result * x) % M;
        x=(x*x)% M;
        n=n/2;
    }
    return result % M;
}
signed main()
{   jaldi
	int n;
	cin>>n;
	string str;
	cin>>str;
	int count=0;
	for(int i=0;i<n-2;i++)
	{	if(str[i]=='A' && str[i+1]=='B' && str[i+2]=='C')
		count++;
	}
	cout<<count;

}

Measured memory_bytes: 256
// In the name of God
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <vector>
#include <iomanip>
#include <ctime>
#include <queue>
using namespace std;

template <typename T>
T next_int() {  
    T x = 0, p = 1;
    char ch;
    do { ch = getchar(); } while(ch <= ' ');
    if (ch == '-') {
        p = -1;
        ch = getchar();
    }
    while(ch >= '0' && ch <= '9') {
        x = x * 10 + (ch - '0');
        ch = getchar();
    }
    return x * p;
}

const int max_n = (int)2e5 + 227 + 1;
const int max_int = (int)1e9 + 227 + 1;
const int mod = (int)1e9 + 7;

int main() {
//    freopen(".in", "r", stdin);

    int n = 3;

    vector<int> a(3);
    for(int i = 0; i < n; i++) a[i] = next_int<int>();

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

    vector<int> b(3);
    b[0] = 5;
    b[1] = 5;
    b[2] = 7;

    if(b == a) puts("YES"); else puts("NO");
 }


Measured memory_bytes: 256
//保留所有权利。
#include<iostream>
#include<stdio.h>//printするよ
#include<vector>
#include<algorithm>//辞書順はnext_permutationだよ
#include<set>
#include<string>
#include<sstream>
#include<string.h>
#include<complex>
#include<time.h>
#include<random>
#include<cmath>
#include<math.h>
#include<queue>
#include<time.h>
#include<iomanip>
#include<locale>
#include<utility>//swapで数値交換するよ
//END OF LIBRARIES.
#define rt "\n"//改行を最速化させるよ
#define rep(i,n) for(int i=0;i<n;i++)
#define rop(i,n) for(int i=1;i<=n;i++)
#define drep(i,n) for(int i=n-1;0<=i;i--)
#define drop(i,n) for(int i=n;0<i;i--)
#define yes(ans) if(ans)cout<<"yes"<<rt;else cout<<"no"<<rt;
#define Yes(ans) if(ans)cout<<"Yes"<<rt;else cout<<"No"<<rt;
#define YES(ans) if(ans)cout<<"YES"<<rt;else cout<<"NO"<<rt;
#define sec(a,b,ans) if(ans)cout<<a<<rt;else cout<<b<<rt;
#define vcin(s,n) rep(i,n)cin>>s[i];//vcin(配列名),(繰り返し回数)
#define sort(s) sort(s.begin(),s.end())
#define reve(s) reverse(s.begin(),s.end())
#define asas int ans=0
#define llcncn llint cnt=0
#define llasas llint ans=0
#define cncn int cnt=0
#define smsm int sum=0
#define str srting
#define v vector
#define please return
#define AC 0//おまじないだよ
#define Rapid cin.tie(0);ios::sync_with_stdio(false)
//END OF DEFINE.
using namespace std;
typedef vector<int> vint;
typedef vector<string> vstr;
typedef vector<char> vchar;
typedef vector<double> vdou;
typedef long long int llint;
typedef pair<int, int> pint;
typedef pair<llint, llint> pllint;
typedef vector<llint> vllint;
typedef vector<pint> vpint;
typedef vector<pair<llint, llint>> vpllint;
typedef vector<vector<int>> vvint;
typedef vector<vector<char>> vvchar;
typedef vector<vector<llint>> vvllint;
typedef vector<vector<string>> vvstr;
typedef vector<vector<bool>> vvbool;
typedef vector<vector<pint>> vvpint;
typedef vector<bool> vbool;
//printf("%02d:%02d:%02d\n", h, m, s);・・・2文字は埋める・h、m、ｓ
//END OF TYPEDEF.

//最大公約数（GCD）を求めるよ
//最小公倍数（LCM）は＜＜　A × B ÷ GCD　 ＞＞で求まるよ

long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}
long long LCM(long long a, long long b) {
	return a * b / GCD(a, b);
}
/*
  for A以上B未満でI探索 for (int I = A; i <= B; i++)

  string s = to_string(i);

  char　小文字のほうが32大　　  　大文字と小文字の境=93

  大文字→小文字 文字列のn文字目を大文字で出力→ (char)toupper(a[0])

  int i = sqrt (n) で、ｎの平方根(9に対する3)をiに入れる

  pow(a,b) → aのb乗を求める

  s1.erase(n) 文字列s1の、n文字目以降削除             */
int a=0, b=0, c = 0;
string s = "";

int main(void) {
	//vector,set,map,stack,queue,deque,priority_queue
	int a, b, c;
	cin >> a >> b >> c;
	int cnt = 0;
	if (c <= a)cnt += (b + c);
	else {
		cnt += a;
		c -= a;
		if (c <= b) {
			cnt += (b + c);
		}
		else {
			cnt += b * 2+1;
		}
	}
	cout << cnt << rt;
	please AC;
}

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

int main() {
	string S, T;
	cin >> S >> T;
	char tmp;

	for (int i = 0; i < S.size(); i++) {
		tmp = S[0]; S.erase(S.begin()); S.push_back(tmp);
		//cout << S << endl;
		if (S == T) {
			cout << "Yes" << endl;
			return 0;
		}
	}

	cout << "No" << endl;

	return 0;
}

Measured memory_bytes: 256
D, G = map(int, input().split())

p = []
c = []
ma = []

for i in range(D):
    tmp = list(map(int, input().split()))
    p.append(tmp[0])
    now = (i+1)*tmp[0]+tmp[1]//100
    ma.append(now)

ans = sum(p)

for j in range(2**(D)):
    tmp = bin(j)
    ope = tmp[2:len(tmp)].zfill(D)

    now = 0
    f = 1

    num = 0
    re = [[0, 0]]

    for i in range(D):
        if ope[i]=='1':
            now = now + ma[i]
            num = num + p[i]
        else:
            re.append([(i+1)*(p[i]-1), i+1])
    
    re.sort()
    re.reverse()
    
    
    if now<(G//100):
        if now+re[0][0]<(G//100):
            now = sum(p)
            f = -1
        else:
            K = ((G//100)-now)//(re[0][1])
            
            if ((G//100)-now)%(re[0][1])>0:
                K = K+1
            
            num = num + K

    if num<ans and f>0:
        ans = num
        

print(ans)
        

Measured memory_bytes: 3064
N,A,B = gets.split.map(&:to_i)
ans = 0
def calu(n)
  a = n
  @i = 0
  while a >= 10
    @i += a%10
    a /= 10
  end
  @i += a%10
  @i
end
w = 1
while w != N+1
  if calu(w) >= A&&calu(w) <= B
    ans += w
  end
  w += 1
end
puts ans

Measured memory_bytes: 1788
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define itn int
signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  string s;
  cin>>s;
  if(s=="ABC") cout<<"ARC";
  else cout<<"ABC";
  cout<<"\n";
}


Measured memory_bytes: 3600
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <cstring>
#include <utility>
#include <numeric>

using namespace std;
const long long INF = (1LL << 60);

// SegmentTree
template<typename T>
class SegTree{
public:
    int n;
    T defaultValue;
    vector<T> dat;

    SegTree(int m, T value){
        n = 1;
        while(n < m){
            n *= 2;
        }
        dat.assign(2 * n - 1, value);
        defaultValue = value;
    }

    void update(int i, T value){
        i += n - 1;
        dat[i] = value;
        while(i > 0){
            i = (i - 1) / 2;
            dat[i] = ope(dat[2 * i + 1], dat[2 * i + 2]);
        }
    }

    T query(int a, int b, int k = 0, int l = 0, int r = -1){
        if(r < 0){
            r = n;
        }

        if(r <= a || b <= l){
            return defaultValue;
        }
        if(a <= l && r <= b){
            return dat[k];
        }
        else{
            T vl = query(a, b, 2 * k + 1, l, (l + r) / 2);
            T vr = query(a, b, 2 * k + 2, (l + r) / 2, r);
            return ope(vl, vr);
        }
    }

private:
    T ope(T a, T b){
        return min(a, b);
    }
};

int main(){

    int N, M;
    cin >> N >> M;
    vector<pair<pair<int, int>, int>> RLC(M);

    int l, r, c;
    for(int i = 0; i < M; i++){
        cin >> l >> r >> c;

        RLC[i] = make_pair(make_pair(r - 1, l - 1), c);
    }

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

    SegTree<long long> minDistSegTree(N, INF);

    minDistSegTree.update(0, 0);

    for(int i = 0; i < M; i++){
        auto temp = RLC[i];
        int l = temp.first.second;
        int r = temp.first.first;
        int c = temp.second;

        long long minDist = minDistSegTree.query(l, r);
        if(minDist == INF){
            continue;
        }
        else{
            long long currentDist = minDistSegTree.query(r, r + 1);
            if(minDist + c < currentDist){
                minDistSegTree.update(r, minDist + c);
            }
        }
    }

    long long dist = minDistSegTree.query(N - 1, N);
    if(dist == INF){
        cout << -1 << endl;
    }
    else{
        cout << dist << endl;
    }

    return 0;
}

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

int main() {
	int H, W;
	cin >> H >> W;
	char C[H][W + 1];
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			cin >> C[i][j];
		}
	}

	for (int i = 0; i < 2 * H; i++) {
		for (int j = 0; j < W; j++) {
			cout << C[(i) / 2][j];
		}
		cout << endl;
	}
}


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

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

    int n = s.length();

    int ans = 1;
    int flag = 0;

    for(int i = 1; i < n; i++){
        if(flag == 0){
            if(s[i] == s[i - 1]){
                flag = 1;
                i++;
                if(i < n){
                    ans++;
                }
            }else{
                ans++;
            }
        }else{
            flag = 0;
            ans++;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 640
use std::io;

const SIZE_RHYTHM: [usize; 5] = [5, 7, 5, 7, 7];

fn main() {
    loop {
        let mut buf1 = String::new();
        io::stdin().read_line(&mut buf1).ok();
        let n: u16 = buf1.trim().parse().unwrap();
        if n == 0 {
            return;
        }

        let mut w: Vec<String> = Vec::new();
        for _ in 0..n {
            let mut buf2 = String::new();
            io::stdin().read_line(&mut buf2).ok();
            w.push(buf2.trim().to_string());
        }

        let mut current_size = 0;
        let mut current_rhythm_idx: usize = 0;
        'search:
        for i in 0..n {
            for j in i..n {
                current_size += w[j as usize].len();
                if current_size == SIZE_RHYTHM[current_rhythm_idx] {
                    if current_rhythm_idx == SIZE_RHYTHM.len() - 1 {
                        // passed
                        println!("{}", i + 1);
                        break 'search;
                    }

                    current_size = 0;
                    current_rhythm_idx += 1;
                } else if current_size > SIZE_RHYTHM[current_rhythm_idx] {
                    // failed
                    current_size = 0;
                    current_rhythm_idx = 0;
                    break;
                }
            }
        }
    }
}



Measured memory_bytes: 5028
#include<iostream>
#include<vector>
using namespace std;
int main()
{
	int N, W;
	cin >> N >> W;

	vector< vector<char> > S= vector< vector<char> >(N+2, vector<char>(W+2,'.'));;
	for(int i=1;i<S.size()-1;i++){
		for(int j=1;j<S[0].size()-1;j++){
			cin >> S[i][j];
		}
	}

	bool flag = true;
	for(int i=1;i<S.size()-1;i++){
		for(int j=1;j<S[0].size()-1;j++){
			if(S[i][j] == '#'){
				if(S[i+1][j] == '#' || S[i][j+1] == '#'||S[i-1][j] == '#'||S[i][j-1] == '#'){
					flag = true;
				}else{
					flag = false;
				}
			}
			if(flag == false){
				break;
			}
		}
		if(flag == false){
			break;
		}
	}

	if(flag == false){
		cout << "No" << endl;
	}else{
		cout << "Yes" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush
from bisect import bisect_left,bisect_right 
import sys,math,itertools,fractions
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

a,b = input().split()
if a < b:
    print('<')
elif a > b:
    print('>')
else:
    print('=')
    

Measured memory_bytes: 10260
import numpy as np

n = int(input())
A = np.array(input().split(), dtype=np.int64)
money = 1000
kabu = 0

for i in range(n):
    if kabu > 0:
        if i != 0:
            if A[i] > A[i - 1]:
                money += A[i] * kabu
                kabu = 0
    if i != n - 1:
        if A[i] < A[i + 1]:
            kabu += money // A[i]
            money -= A[i] * kabu
print(money)


Measured memory_bytes: 27180
import math
X=int(input())
if X==2:
  print(2)
else:
  for i in range(X, 10**5+10):
    if i%2==0:
      continue
    flag=True
    for j in range(3, int(math.sqrt(i))+10, 2):
      if i%j==0:
        flag=False
        break
    if flag:
      print(i)
      break

Measured memory_bytes: 38256
// Problem : C - Sum of product of pairs
// Contest : AtCoder - AtCoder Beginner Contest 177
// URL : https://atcoder.jp/contests/abc177/tasks/abc177_c
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

// Delete the dynamically allocated memory

#include<bits/stdc++.h>
using namespace std;
 
#define ff              first
#define ss              second
#define pb              push_back
#define pr              pair<long long,long long>
#define mp(a,b)         make_pair(a,b)
#define vr              vector<long long>
#define mod1            1000000007
#define mod2            998244353
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define fill(a,b)       memset(a, b, sizeof(a))
#define mk(arr,n,type)  type *arr=new type[n];
#define ll              long long
#define ld	            long double
#define w(x)            int x; cin>>x; while(x--)

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	ll n;
	cin>>n;
	mk(a,n,ll)
	for(ll i=0;i<n;i++){
		cin>>a[i];
	}
	mk(dp,n,ll)
	dp[n-1]=a[n-1];
	for(ll i=n-2;i>=0;i--){
		dp[i]=(a[i]+dp[i+1])%mod1;
	}
	vr ans;
	ll sum=0;
	for(ll i=0;i<n-1;i++){
		ll v=(a[i]*dp[i+1])%mod1;
		ans.pb(v);
	}
	if(ans.size()==1){
		cout<<ans[0]<<"\n";
	}else{
		sum=ans[0]%mod1;
		for(ll i=1;i<ans.size();i++){
			sum=(sum+(ans[i])%mod1)%mod1;
		}
		cout<<sum<<"\n";
	}
	delete[] a;
	delete[] dp;
	return 0;
	}

Measured memory_bytes: 8380
#include "bits/stdc++.h"
using namespace std;

#define FOR( i, m, n )	for( int (i) = (m); (i) < (n); i++ )
#define REP( i, n )		FOR( i, 0, n )
#define ALL( x )		(x).begin(), (x).end()

struct P {
	string name;
	int t;
};

void enqueue( P a );
P dequeue();

int n;
int head = 0, tail;
vector<P> p;

int main() {
	int q; cin >> n >> q;
	tail = n;
	p.resize( n + 1 );

	REP( i, n ) cin >> p[i].name >> p[i].t;


	P tmp;
	int elapse = 0, c;
	while( head != tail ) {
		tmp = dequeue();
		c = min( tmp.t, q );
		tmp.t -= c;
		elapse += c;
		if( tmp.t > 0 ) enqueue( tmp );
		else			cout << tmp.name << " " << elapse << endl;
	}

}

P dequeue() {
	P x = p[head];
	head = ( head + 1 ) % ( n + 1);
	return x;
}

void enqueue( P a ) {
	p[tail] = a;
	tail = ( tail + 1 ) % ( n + 1 );
}


Measured memory_bytes: 5900
#include <iostream> 
using namespace std;
int main() 
{
	int i ;
	int r,D,x ;
	cin>>r>>D>>x ;
	for (i=0; i<10; i++)
	{
		x=r*x-D ;
		cout<<x<<endl ;
	}


		
		
		
		
		
		return 0 ;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int gcd_t(int a, int b ,int c);
int gcd(int a,int b);

int main() {
    int K;

    cin >>K;

    int sum=0;

    for(int i=1;i<=K;i++){
        for(int j=1;j<=K;j++){
            for(int l=1;l<=K;l++){
                sum=sum+gcd_t(i,j,l);
            }
        }
    }

    cout << sum <<endl;





    
}

int gcd_t(int a,int b, int c){
    return gcd(a,gcd(b,c));
}

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

Measured memory_bytes: 3632
#include <iostream>
#include <algorithm>
#include <math.h>
#include <string.h>
#include <bits/stdc++.h>
#include <set>
#include <vector>
#include <queue>
#include <bitset>
#define NL << endl
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define endl "\n"
#define fill(x, y) memset(x, y, sizeof(y))
#define debug(x)                          \
    {                                     \
        cerr << #x << " = " << x << endl; \
    }
#define inarr(arr, n)                            \
    {                                       \
        for(int i =0;i<n;i++){              \
            cin >> arr[i];                  \
        }                                   \
    }
typedef long long ll;
const int MOD = 1e9 + 7;
using namespace std;

void solve()
{
    ll n, d; cin >> n >> d; ll ans = 0;
  for(int i =0;i<n;i++){
  	ll x,y; cin >> x >> y;

    if(x*x + y *y <= d * d){
      ans++;
    }
   
  }
   cout << ans << endl;

}

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    int t; t = 1; 
    // int t; cin >> t;
    while (t--)
        solve();
    return 0;
}


Measured memory_bytes: 3652
#include<iostream>
#include<cstdio>
#include<cstring>
#include <cstdlib>  
#include <math.h>
#include <cmath>
#include<cctype>
#include<string>
#include<set>
#include<iomanip>
#include <map>
#include<algorithm>
#include <functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include<bitset>
#include <deque>
#include <climits>
#include <typeinfo>
#include <utility> 
using namespace std;
using ll = long long;
using R = double;
using Data = pair < ll, vector <ll>>;
template<typename T>using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
const ll MOD = 1e9 + 7;
const ll inf = 1LL << 60;
struct edge { ll from; ll to; ll cost; };
typedef pair<ll, ll>pll;
#define all(x) (x).begin(),(x).end()
#define rep(i,m,n) for(ll i = m;i < n;++i)
#define pb push_back
#define fore(i,a) for(auto &i:a)
#define rrep(i,m,n) for(ll i = m;i >= n;--i)
#define INF INT_MAX/2

int main() {
	int n, x;
	cin >> n >> x;
	vector<int>l(n);
	rep(i, 0, n)cin >> l[i];

	vector<int>zahyou(101010);
	rep(i, 1, n+1) {
		zahyou[i] = zahyou[i - 1] + l[i-1];
	}
	int cnt = 0;
	rep(i, 0, n+1) {
		if (zahyou[i] <= x)cnt++;
	}
	cout << cnt << endl;


	
	return 0;
}


Measured memory_bytes: 640
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}  
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}


fn main() {
    input! {
        s: String,
    }

    if &s == "ABC" {
        println!("ARC");
    } else {
        println!("ABC");
    }
}


Measured memory_bytes: 2104
from math import gcd

def main():
    K=int(input())
    ans=0
    for a in range(1,K+1):
        for b in range(1,K+1):
            tmp=gcd(a,b)
            for c in range(1,K+1):
                ans+=gcd(tmp,c)
    print(ans)

main()


Measured memory_bytes: 9180
def calc(number):
    return(int((1 + number) * number / 2))
num = int(input())
sum = calc(num)
divthree = num // 3
divfive = num // 5
divfif = num // 15
sumthree = 3 * calc(divthree)
sumfive = 5 * calc(divfive)
sumfif = 15 * calc(divfif)
print(sum - sumthree - sumfive + sumfif)


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

#define itn int
#define all(x) (x).begin(), (x).end()
#define make_unique(x) sort(all((x))); (x).resize(unique(all((x))) - (x).begin())

#define random_shuffle(...) shuffle(__VA_ARGS__, rng)
#define rand() rng()

using namespace std;

inline int nxt() {
	int x;
	scanf("%d", &x);
	return x;
}

vector<int> merge(vector<int> a, const vector<int>& b) {
	for (int x : b) {
		if (!a.empty() && a.back() == (x ^ 1)) {
			a.pop_back();
		} else {
			a.push_back(x);
		}
	}
	return a;
}

void inv(vector<int>& a) {
	reverse(all(a));
	for (int& x : a) {
		x ^= 1;
	}
}

void output(const vector<int>& a) {
	int cur = (int)a.size() / 2;
	cout << (int)a.size() << " ";
	for (int x : a) {
		// cout << (char)('p' + x / 2);
		// if (x & 1) {
		// 	cout << "^{-1}";
		// }
		cout << "pPqQ"[x];
		if (cur-- == 0) {
			cout << " ";
		}
	}
	cout << "\n";
}

vector<int> mult(const vector<itn>& a, const vector<itn>& b) {
	int n = a.size();
	vector<int> c(n);
	for (int i = 0; i < n; ++i) {
		c[i] = a[b[i]];
	}
	return c;
}

vector<int> pw(vector<int> a, int b) {
	vector<int> res(a.size());
	iota(all(res), 0);
	while (b) {
		if (b & 1) {
			res = mult(res, a);
		}
		b >>= 1;
		a = mult(a, a);
	}
	return res;
}

int main() {
	mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

	// vector<int> a = {0};
	// vector<int> b = {2};
	// for (int i = 0; i < 20; ++i) {
	// 	output(a);
	// 	inv(a);
	// 	a = merge(b, a);
	// 	a.swap(b);
	// }

	int n = nxt(), k = nxt();
	vector<int> p(n), q(n);
	for (int i = 0; i < n; ++i) {
		p[i] = nxt() - 1;
	}
	for (int i = 0; i < n; ++i) {
		q[i] = nxt() - 1;
	}
	vector<itn> P(n), Q(n);
	for (int i = 0; i < n; ++i) {
		P[p[i]] = Q[q[i]] = i;
	}

	auto qPQp = mult(mult(q, P), mult(Q, p));
	auto PqpQ = mult(mult(P, q), mult(p, Q));

	if (k == 1) {
		for (int x : p) {
			printf("%d ", x + 1);
		}
		printf("\n");
		return 0;
	}

	int len = (k - 2) / 3 * 4 + 1 + (k - 2) % 3;
	int lhs = (len + 2) / 2;
	int rhs = len - lhs;

	auto res = pw(PqpQ, rhs / 4);
	if (rhs % 4 >= 1) {
		res = mult(Q, res);
	}
	if (rhs % 4 >= 2) {
		res = mult(p, res);
	}
	if (rhs % 4 >= 3) {
		res = mult(q, res);
	}
	if (lhs % 4 >= 3) {
		res = mult(Q, res);
	}
	if (lhs % 4 >= 2) {
		res = mult(P, res);
	}
	if (lhs % 4 >= 1) {
		res = mult(q, res);
	}
	res = mult(pw(qPQp, lhs / 4), res);

	for (int x : res) {
		printf("%d ", x + 1);
	}
	printf("\n");

	return 0;
}

Measured memory_bytes: 4720
#include <iostream>
#include <string>

using namespace std;

int main(){
  string s;
  cin >> s;
  string t;
  
  for(int i = 0; i < s.length(); i++){
    if(s[i] == '0') t += "0";
    else if(s[i] == '1') t += "1";
    else if(t.length() != 0) t.pop_back();
  }
  
  cout << t << endl;
  
  return 0;
}

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

#include <algorithm>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define REP(i, n) for (long long i = 0; i < (n); i++)
const ll INF = 1LL << 60;
struct Fast {
    Fast() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(20);
    }
};
ll modpow(ll m, ll n) {
    if (n == 0) return 1;
    if (n % 2 == 0) {
        ll t = modpow(m, n / 2);
        return t * t;
    } else {
        return modpow(m, n - 1) * m;
    }
}
signed main() {
    int n, x;
    cin >> n >> x;
    ll ans = x * modpow(x - 1, n - 1);
    cout << ans << endl;
}

Measured memory_bytes: 3552
n=int(input())
s=[]
for i in range(n):
    p=input()
    l=list(p)
    l.sort()
    p="".join(l)
    s.append(p)
s.sort()
q=""
ans=0
qq=1
for i in range(n):
    if i!=n-1:
        if q==s[i]:
            qq+=1
        else:
            q=s[i]
            ans+=qq*(qq-1)//2
            qq=1
    else:
        if q==s[i]:
            qq+=1
        ans+=qq*(qq-1)//2
print(ans)

Measured memory_bytes: 10612
array = []
while True:
    w, h = map(int, input().split())
    if w == 0 and h == 0: break
    array.append(h)
    array.append(w)


def printAChess(w, h):
    for i in range(h):
        for k in range(w):
            if i % 2 == 0:
                if k % 2 == 0:
                    print('#', end='')
                else:
                    print('.', end='')
            elif i % 2 == 1:
                if k % 2 == 0:
                    print('.', end='')
                else:
                    print('#', end='')
        print()
    print()


def split_list(l, n):
    for idx in range(0, len(l), n):
        yield l[idx:idx + n]


for i in list(split_list(array, 2)):
    printAChess(i[0], i[1])



Measured memory_bytes: 7008
#include <bits/stdc++.h>
#include <stdio.h>
#include<iostream>
#include<cstdio>
#include<bitset>
#include<algorithm>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<string>
#include<string.h>
#include<cmath>
#include<utility>
#include<functional>
#include<map>
#include<set>
#include<cctype>
#include<fstream>
#include <numeric>
#include <iomanip>
#include <cstring> 
using namespace std;
using ll=long long;

#define FOR(i, a, b) for( int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for( int i=(a);i>=(b);i--)
#define LFOR(i, a, b) for( long long int i=(a);i<=(b);i++)
#define LRFOR(i, a, b) for(long long int i=(a);i>=(b);i--)
#define MOD 1000000007
#define LLONG_MAXs 9223372036854775800

#include <iostream>
#include <cmath>
using namespace std;
 

 
bool isPrimeNum( ll x ){ // 素数である場合 true を返す
  if( x <= 1 ){ // 1以下である場合は素数でないことがすぐにわかる
    return false;
  }
  // sqrt( double型 ) は引数の平方根を double型で返すので、int型でキャスト
  int n = (int)sqrt( (double)x );
  for( int i = 2; i <= n; i++ ){
    if( x % i == 0 ){ // 割り切る整数がある場合、即判定終了
      return false;
    }
  }
  return true; // 割り切る整数がない場合、素数である
}

constexpr ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
constexpr ll lcm(ll a,ll b){return a*b/gcd(a,b);}
constexpr ll abs(ll a,ll b){
if(a>=b)return a-b;
if(a<b)return b-a;
}
constexpr ll min(ll a,ll b){
if(a>=b)return b;
if(a<b)return a;
}

constexpr ll max(ll a,ll b){
if(a>=b)return a;
if(a<b)return b;
}

int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

int main() {
  ll N;
  cin>>N;
  ll h[N];
  FOR(i,0,N-1){
  cin>>h[i];}

  ll ans=h[0];
  FOR(i,1,N-1){
    ans=ans+max(0,h[i]-h[i-1]);
  }

  cout<<ans<<endl;



  return 0;
}
 


Measured memory_bytes: 256
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,copy,time
sys.setrecursionlimit(10**8)
input = sys.stdin.readline
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp():
    '''
    一つの整数
    '''
    return int(input())
def inpl():
    '''
    一行に複数の整数
    '''
    return list(map(int, input().split()))
def inpl_str():
    '''
    一行に複数の文字
    '''
    return list(input().split())

r = inp()
print(r*2*math.pi)

Measured memory_bytes: 10556
import java.util.*;

class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    String t = "CODEFESTIVAL2016";
    int c = 0;
    for(int i=0;i<16;i++){
      if(s.charAt(i)!=t.charAt(i)){
        c++;
      }
    }
    System.out.println(c);
  }
}

Measured memory_bytes: 21204
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ll long long int
const int INF = 2147483647;

using namespace std;

int main()
{
  int n, k;
  cin >> n >> k;
  int a[500];
  int sum = 0;
  REP(i, n)
  {
    cin >> a[i];
    sum += a[i];
  }

  priority_queue<int> q;

  // 約数全列挙
  FOR(i, 1, (int)sqrt(sum) + 1)
  {
    if (sum % i == 0)
    {
      q.push(i);
      q.push(sum / i);
    }
  }

  while (!q.empty())
  {
    int m = q.top();
    q.pop();

    int b[500] = {};
    REP(i, n)
    {
      b[i] = a[i] % m;
    }
    sort(b, b + n);

    int cumd[500] = {};
    int cumdr[500] = {};
    int cum[500] = {};
    int cumr[500] = {};

    cum[0] = m - b[0];
    cumd[0] = b[0];
    cumr[n - 1] = m - b[n - 1];
    cumdr[n - 1] = b[n - 1];

    FOR(i, 1, n)
    {
      cum[i] = cum[i - 1] + m - b[i];
      cumd[i] = cumd[i - 1] + b[i];
    }

    for (int i = n - 2; i >= 0; i--)
    {
      cumr[i] = cumr[i + 1] + m - b[i];
      cumdr[i] = cumdr[i + 1] + b[i];
    }

    FOR(i, 1, n)
    {
      if (cum[i - 1] == cumdr[i] && cum[i - 1] <= k)
      {
        cout << m << endl;
        return 0;
      }
      if (cumd[i - 1] == cumr[i] && cumd[i - 1] <= k)
      {
        cout << m << endl;
        return 0;
      }
    }
  }

  cout << 1 << endl;
}


Measured memory_bytes: 256
package main

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

func main() {
	sc.Split(bufio.ScanWords)
	var n int
	fmt.Scan(&n)

	a := make([]int, n*3)
	for i := 0; i < n*3; i++ {
		a[i] = nextInt()
	}
	sort.Sort(sort.Reverse(sort.IntSlice(a)))

	ans := 0
	for i := 1; i < 2*n+1; i += 2 {
		ans += a[i]
	}
	fmt.Println(ans)
}

var sc = bufio.NewScanner(os.Stdin)

func nextInt() int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return i
}


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

#define rep(i,N) for(int i=0;i<N;i++)
#define rep2(i,N) for(int i=1;i<=N;i++)
using namespace std;
long long  INF=1e18;
long long mod=1e9+7;

//status unsolved
int main(){
    string ans="";
    rep(i,3){
        string s;
        cin>>s;
        ans.append(1,s[0]+('A'-'a'));
    }
    cout<<ans<<endl;
    return 0;

}
/*


*/


Measured memory_bytes: 256
#include <bits/stdc++.h>
/*cout<<setprecision(5)<<ret<<endl;で、数字部分を計5桁表示かつゼロ埋め無*/
/*cout<<fixed<<setprecision(5)<<ret<<endlで、小数部のみ5桁表示かつゼロ埋め有*/
using namespace std;

typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
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; }
/* [Shift+Command+b]（コンパイル）ー＞[Ctrl+Shift+`]（ターミナル起動）ー＞[./a.out] */

//////////////////
//  A
int main(void){
    int a,b,c;cin>>a>>b>>c;
    int d=a-b;
    if(d>c){
        cout<<"0"<<endl;
    }else{
        cout<<c-d<<endl;
    }
    return 0;
}
//////////////////
//  B
/*int main(void){

    return 0;
}*/
//////////////////
//  C 
/*int main(void){

    return 0;
}*/
//////////////////
//  D
/*int main(void){

    return 0;
}*/


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

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        final String S = sc.next();
        int ans = Arrays.stream(S.split("[^ACGT]"))
                .mapToInt(String::length)
                .max()
                .orElse(0);
        System.out.println(ans);
    }
}


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

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

using ll = long long;

const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

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

int main() {
  string s;
  cin>>s;
  vector<vector<int>> ch(26);
  rep(i,26) ch[i].push_back(-1);
  int l = s.size();
  rep(i,l){
    ch[s[i]-'a'].push_back(i);
  }
  rep(i,26){
    ch[i].push_back(l);
  }
  int ans=1<<30;
  rep(i,26){
    int M = 0;
    rep(j,(int)ch[i].size()-1){
      chmax(M,ch[i][j+1]-ch[i][j]);
    }
    chmin(ans,M);
  }
  cout<<ans-1<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <string.h>
#include <queue>
#include <utility>
#define lli long long int
#define fio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
using namespace std;
vector<vector<int>>v(100002);
int dp[100002];
int result (int i)
{
    if (v[i].size()==0)
    return 0;
    if (dp[i]!=-1)
    return dp[i];
    if (dp[i]==-1)
    {
        int maxi=0;
        for (int j=0;j<v[i].size();j++)
        {
            maxi=max(maxi,result(v[i][j])+1);
        }
        dp[i]=maxi;
        return dp[i];
    }
}
int main() 
{
	fio;
    int n,m,a,b;
    cin>>n>>m;
    memset(dp,-1,sizeof(dp));
    for (int i=0;i<m;i++)
    {
        cin>>a>>b;
        v[a].push_back(b);
    }
    int maxi=0;
    for (int i=1;i<=n;i++)
    {
        maxi=max(maxi,result(i));
    }
    cout<<maxi;
	return 0;
}

Measured memory_bytes: 8192
#define PI 3.14159265359
#define INF 2000000000
#define MAX 500000
#include <map>
#include <algorithm>
#include <vector>
#include <queue>
#include <iostream>
#include <string>
#include <cstring>
#include <cmath>
#include <cstdio>
using namespace std;


int main() {
	int N, D[200009], M, T[200009];
	cin >> N;
	for (int i = 0;i < N;i++) cin >> D[i];
	sort(D, D + N);
	cin >> M;
	for (int i = 0;i < M;i++) cin >> T[i];
	sort(T, T + M);
	int d = 0, t = 0;
	while (d < N) {
		if (D[d] == T[t]) t++;
		d++;
	}
	if (t == M) cout << "YES" << endl;
	else cout <<"NO"<< endl;
	return 0;
}

Measured memory_bytes: 1792
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.LinkedList;
import java.util.Queue;

public class Main {

    public static void main(String[] args) throws IOException {
        Queue<Integer> qBase = new LinkedList<Integer>();
        BufferedReader bReader =
                new BufferedReader(new InputStreamReader(System.in));
        int inningCount = Integer.parseInt(bReader.readLine());
        int calcCount = 0;
        int point = 0;
        int out = 0;
        qBase.offer(0);
        qBase.offer(0);
        qBase.offer(0);
        while (calcCount != inningCount) {
            String inputStr = bReader.readLine();
            if (inputStr.equals("HIT")) {
                point += qBase.peek();
                qBase.poll();
                qBase.offer(1);
            } else if (inputStr.equals("HOMERUN")) {
                point += qBase.peek();
                qBase.poll();
                point += qBase.peek();
                qBase.poll();
                point += qBase.peek();
                qBase.poll();
                point += 1;
                qBase.offer(0);
                qBase.offer(0);
                qBase.offer(0);
            } else if (inputStr.equals("OUT")) {
                out++;
                if (out == 3) {
                    System.out.println(point);
                    calcCount++;
                    out = 0;
                    point = 0;
                    qBase.clear();
                    qBase.offer(0);
                    qBase.offer(0);
                    qBase.offer(0);
                }
            } else {
            }
        }
    }
}

Measured memory_bytes: 9328
from collections import Counter

n = int(input())
a = [input() for i in range(n)]
m = int(input())
b = [input() for i in range(m)]

a_cnt = Counter(a)
b_cnt = Counter(b)

maxs = 0
for k, v in a_cnt.items():
    maxs = max(maxs, v - b_cnt[k])
print(maxs)

Measured memory_bytes: 3316
#include <iostream>
#include <cmath>
#include <iomanip>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <map>
#include <set>
#include <bitset>
#include <string>
#include <algorithm>
#include <iterator>
#include <unordered_map>
#include <unordered_set>
#include <sstream>
#include <fstream>
#include <tuple>

using namespace std;

#define fori(t) for(int i = 0; i < t; ++i)
#define forj(n) for(int j = 0; j < n; ++j)
#define fork(n) for(int k = 0; k < n; ++k)
#define forai(a) for(auto& i : a)
#define foraj(a) for(auto& j : a)
#define forak(a) for(auto& k : a)
#define forp(s, n, d) for(int p = s; p < n; p += d)
#define fast cin.tie(0); cout.tie(0); std::ios_base::sync_with_stdio(0);
#define pb(a) push_back(a);
#define pob(a) pop_back(a);
#define sorti(a) sort(a.begin(), a.end());
#define sortm(a, n) sort(a, a + n);
#define reversi(a) reverse(a.begin(), a.end());
#define fi first
#define se second
#define yes cout << "Yes\n";
#define no cout << "No\n";
#define ans(a) cout << a << '\n';
#define res(a, n) a.resize(n);
#define read(a, n) a.resize(n); fori(n) cin >> a[i];
//#define int long long
//#define double long double

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> ii;
typedef pair<long long, long long> llll;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector<pair<int, int>> vii;
typedef vector<pair<int, pair<int, int>>> viii;
typedef pair<int, pair<int, int>> iii;
typedef vector<pair<long long, long long>> vllll;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvll;
typedef vector<bool> vb;
typedef pair<char, char> cc;
typedef pair<pair<char, char>, char> ccc;
typedef vector<char> vc;
typedef pair<int, char> ic;
typedef pair<ii, char> iic;
typedef vector<bool> vb;
typedef set<int> si;
typedef set<ii> sii;

const int INF = 2147483647;
const ll LONGINF = 9223372036854775807;
const ll MOD = 998244353;

void solve()
{
    int n, d;
    cin >> n >> d;
    int counter = 0;
    long double x, y;
    fori(n)
    {
        cin >> x >> y;
        if (sqrt(x * x + y * y) <= d) ++counter;
    }
    ans(counter)
}

signed main()
{
    fast
    bool mult = false;
    if (mult)
    {
        int t;
        cin >> t;
        while (t--) solve();
    }
    else solve();
}


Measured memory_bytes: 3760
using System;
class T{
　static void Main(){
　　string[] l = Console.ReadLine().Split(' ');
　　int N = int.Parse(l[0]);
　　int A = int.Parse(l[1]);
　　int B = int.Parse(l[2]);
　　Console.WriteLine(N*A>B?B:N*A); }　}

Measured memory_bytes: 13140
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define I_L_Z_D ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); 
const int N = 1e6 + 5;


int32_t main(){
    I_L_Z_D ;
	int n;
	cin >> n;
	int a[n + 1];
	for(int i = 1 ; i <= n ; i++) cin >> a[i];
	int ans = 0;
	for(int i = 2 ; i < n ; i++){
		if((a[i] > a[i - 1] && a[i] < a[i + 1] )|| (a[i] < a[i - 1] && a[i] > a[i + 1]) ) ans++;
	}	
	cout << ans << " ";
  return 0;
}

Measured memory_bytes: 256
import math


def main(K, N):
    ans = []

    if K % 2 == 0:
        for i in range(N):
            if i == 0:
                ans.append(K // 2)
            else:
                ans.append(K)
    elif K == 1:
        n2 = math.ceil(N / 2)
        for i in range(n2):
            ans.append(1)
    else:
        K2 = math.ceil(K / 2)
        ans = [K2] * N
        n = N // 2
        for i in range(n):
            if ans[-1] == 1:
                ans.pop()
            else:
                ans[-1] -= 1
                while len(ans) < N:
                    ans.append(K)

    return ' '.join(map(str, ans))


K, N = map(int, input().split())
print(main(K, N))


Measured memory_bytes: 26532
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main(){
  string s;
  cin >> s;
  int y=s.size();
  int cnt=0;
  rep(i,y-1){
    if(s[i]=='0'&&s[i+1]=='0'){
      cnt++;
      s[i+1]='1';
      //cout << i << endl;
    }
    if(s[i]=='1'&&s[i+1]=='1'){
      cnt++;
      s[i+1]='0';
      //cout << i << endl;
    }
  }
  cout << cnt << endl;
}


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

using namespace std;
int main() {
    int n;
    int f[100][5][2];
    int p[100][11];
    int max_sum = INT_MIN;

    cin >> n;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < 5; j++) {
            for (int k = 0; k < 2; k++) {
                cin >> f[i][j][k];
            }
        }
    }
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < 11; j++) {
            cin>> p[i][j];
        }
    }

    for (int sw = 1; sw < 1024; sw++) {
        int c;
        int sum = 0;
        for (int i = 0; i < n; i++) {
            c = 0;
            for (int j = 0; j < 5; j++) {
                for (int k = 0; k < 2; k++) {
                    if ( (sw & (1<<(j*2+k)))  && f[i][j][k]) {
                        c++;
                    }
                }
            }
            sum += p[i][c];
        }
        max_sum = max(max_sum, sum);
    }

    cout << max_sum << endl;

    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <string>
#include <sstream>
#include <vector>
#include <set>
#include <stack>
#include <map>
#include <cmath>
#include <queue>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using namespace std;
typedef long long ll;

int main()
{
	ll n,k;
	cin>>n>>k;
	ll num = k;
	int ans = 1;
	while( num <= n){
		num = num * k; 
		ans++;
	}
	cout<<ans<<endl;
	return 0;
}



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

int main(){
  int n;cin >> n;
  float a[n],ans;
  for(int i=0;i<n;++i){
    cin >> a[i];
    ans += 1.0 / a[i];
  }
  cout << 1.0/ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define repi(i,a,b) for(ll (i)=(a);(i)<(b);(i)++)
#define SIZE_OF_ARRAY(array)    (sizeof(array)/sizeof(array[0]))
typedef long long ll;
using namespace std;
int main(){
  int k,x;
  cin >> k >> x;
  if(500*k>=x){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#define For(i, n) for(int i = 0; i < (n); i ++)
#define Range(c) c.begin(), c.end()
#define RevRange(c) c.begin(), c.end()
#define Cin(T, x) T x; cin >> x;
#define Cins(T, n, xs) vector<T> xs(n); For(i, n) cin >> xs[i];
#define Cout(val) cout << (val) << "\n";
#define Sort(a) sort(Range(a));
#define DeSort(a) sort(RevRange(a));

using namespace std;
using ll = long long;

int main(void){
    Cin(int, a);
    Cin(int, b);
    Cin(int, c);
    Cin(int, d);
    Cout(max(a*b, c*d));
    //Cout(() ? "Yes" : "No");
    //Cout(() ? "YES" : "NO");
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define ed cout<<"\n";
#define speed ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long int
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define All(obj) (obj).begin(),(obj).end()

using namespace std;


int main() {
	speed;
	int a, b;
	cin >> a >> b;
	cout << a - b + 1;
	return 0;
}


Measured memory_bytes: 256