akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
#define rep(i,n) for(ll i=0;i<(int)(n);i++)
#define REP(i,m,n) for(ll i=m;i<(int)(n);i++)
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; }
typedef long long ll;
typedef pair<ll,ll> pint;
const long long INF = 1LL<<60;
const ll MOD = 1000000007;
ll gcd(ll a,ll b){
    if(b==0){
        return a;
    }
    else{
        return gcd(b,a%b);
    }
}
int main(){
    string x;cin>>x;
    if(x=="ABC")cout<<"ARC"<<endl;
    else{
        cout<<"ABC"<<endl;
    }
}


Measured memory_bytes: 3596
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <cmath>
#include <iomanip>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cassert>
#include <cstring>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> V;
typedef map<int, int> M;

constexpr ll INF = 1e18;
constexpr ll MOD = 1e9 + 7;
constexpr double PI = 3.14159265358979323846;
constexpr int dx[] = {0, 0, 1, -1};
constexpr int dy[] = {1, -1, 0, 0};

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

    int N, x;

    cin >> N >> x;

    if (x == 1 || x == 2 * N - 1)
    {
        cout << "No" << endl;
    }
    else if (N == 2)
    {
        cout << "Yes" << endl;
        cout << 1 << endl
             << 2 << endl
             << 3 << endl;
    }
    else
    {
        cout << "Yes" << endl;

        int res[212345];

        if (x == N * 2 - 2)
        {
            res[N - 2] = x - 1;
            res[N - 1] = x;
            res[N] = x + 1;
            res[N + 1] = x - 2;

            int i = 0;
            int j = 1;
            while (i < N * 2 - 1)
            {
                if (x - 2 > j || j > x + 1)
                {
                    if (i < N - 2 || N + 1 < i)
                    {
                        res[i] = j;
                        j++;
                    }
                    i++;
                }
                else
                    j++;
            }
        }
        else
        {
            res[N - 2] = x + 1;
            res[N - 1] = x;
            res[N] = x - 1;
            res[N + 1] = x + 2;

            int i = 0;
            int j = 1;
            while (i < N * 2 - 1)
            {
                if (x - 1 > j || j > x + 2)
                {
                    if (i < N - 2 || N + 1 < i)
                    {
                        res[i] = j;
                        j++;
                    }
                    i++;
                }
                else
                    j++;
            }
        }

        REP(i, N * 2 - 1)
        cout << res[i] << endl;
    }

    return 0;
}

Measured memory_bytes: 2304
a, b, c = map(int, input().split())
if a < b:
    if b < c:
        print(a, b, c)
    else:
        if a < c:
            print(a, c, b)
        else:
            print(c, a, b)
else:
    if a < c:
        print(b, a, c)
    else:
        if b > c:
            print(c, b, a)
        else:
            print(b, c, a)



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

int main(){
    ll n,d;
    cin >> n >> d;
    vector <ll> x(n),y(n);
    rep(i,n){
        cin >> x[i] >> y[i]; 
    }

    ll ans=0;
    rep(i,n){
        if((x[i]*x[i]+y[i]*y[i])<=(d*d)){
            ++ans;
        }
    }

    cout << ans << endl;

    

    return 0;
}

Measured memory_bytes: 6424
#include<stdio.h>
int max,i;

void recurse(int i)
{
	int p;
	i++;
	if(i<=max){
		scanf("%d ",&p);
		recurse(i);
		if(i==1){printf("%d",p);}
		else{printf("%d ",p);}
	}
}

int main(){

scanf("%d\n",&max);
recurse(0);

printf("\n");
return 0;
}

Measured memory_bytes: 604
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Atcoder1
{
    class Program
    {
        static void Main(string[] args)
        {
            string inputLine = Console.ReadLine();
            string preHalf = inputLine.Substring(0, (inputLine.Length - 1) / 2);
            string endHalf = inputLine.Substring((inputLine.Length + 1) / 2);

            if (check(inputLine, preHalf, endHalf))
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }

        }

        static bool isKaibun(string s)
        {
            return s.Equals(string.Join("", s.Reverse()));
        }

        static bool check(string s1, string s2, string s3)
        {
            return isKaibun(s1) && isKaibun(s2) && isKaibun(s3);
        }
    }
}

Measured memory_bytes: 13268
#include<bits/stdc++.h>
typedef long long int ll;
using namespace std;
#define X first
#define Y second
#define pb push_back
#define fastio ios_base::sync_with_stdio(false);cout.tie(0);cin.tie(0);

const ll mod=998244353;
const ll MAXN=2e5+5;
const ll inf=1e17;

int main()
{
    fastio;
    ll h,n,a;
    ll sum=0;
    cin>>h>>n;
    for(int i=0;i<n;i++){
        cin>>a;
        sum+=a;
    }
    if(sum>=h) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <list>
#include <string>
#include <numeric>
#include <math.h>
#include <set>
#include <map>
#include <fstream>
using namespace std;
long long f(vector<vector<long long>> cake,vector<int> pos)
{
	long long sum = 0;
	for(int i=0; i<3; i++)
	{
		sum+=cake[i][pos[i]];
	}
	return sum;
}

bool fflag(set<vector<int>> flag,vector<int> pos)
{
	if(flag.find(pos) == flag.end())
	{
		return false;
	}
	return true;
}
int main()
{
	vector<int> size(3);
	for(int i=0; i<3; i++)
	{
		cin>>size[i];
	}

	set<vector<int>> flag;
	

	int K;
	cin>>K;
	vector<vector<long long>> cake;
	cake.resize(3);
	for(int i=0; i<3; i++)
	{
		cake[i].resize(size[i]);
		for(int j=0; j<size[i]; j++)
		{
			cin>>cake[i][j];
		}
	}
	for(int i=0; i<3; i++)
	{
		sort(cake[i].begin(),cake[i].end(),greater<long long>());
	}
	priority_queue<pair<long long,vector<int>>> q;
	vector<int> initial{0,0,0};
	q.push(make_pair(f(cake,initial),initial));
	flag.insert(initial);
	for(int k=0; k<K; k++)
	{
		
		cout<<q.top().first<<endl;
		vector<int> list = q.top().second;
		
		q.pop();
		if(k==K-1)
		{
			break;
		}
		
		vector<vector<int>> next(3);
		next[0] = {list[0]+1,list[1],list[2]};
		next[1] = {list[0],list[1]+1,list[2]};
		next[2] = {list[0],list[1],list[2]+1};

		for(int i=0; i<3; i++)
		{
			if(list[i]+1>=size[i] || flag.find(next[i])!=flag.end())
			{
				continue;
			}
			q.push(make_pair(f(cake,next[i]),next[i]));
			flag.insert(next[i]);
		}
	}
	return 0;
}

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

using namespace std;

int n, a[22], c;

int main()
{
    cin >> n;
    for(int i = 0; i < n; i++)
        cin >> a[i];
    for(int i = 1; i < n - 1; i++){
        if(a[i] > a[i - 1] && a[i] < a[i + 1])
            c++;
        if(a[i] < a[i - 1] && a[i] > a[i + 1])
            c++;
    }
    cout << c;
    return 0;
}



Measured memory_bytes: 256
#### import ####
import sys
import math
from collections import defaultdict

#### 設定 ####
sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

#### 定数 ####
mod = 10**9 + 7

#### 読み込み ####
def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N):
    read_all = [tuple(map(int, input().split())) for _ in range(N)]
    return map(list,zip(*read_all))

#################

S = list(str(input()))
T = list(str(input()))

a = defaultdict()

for i in range(len(S)):
    if S[i] in a.keys():
        if a[S[i]]==T[i]:
            continue
        else:
            print('No')
            exit()
    else:
        if T[i] in a.values():
            print('No')
            exit()
        else:
            a[S[i]] = T[i]
                      
print('Yes')

Measured memory_bytes: 71496
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    string S;
    cin >> S;

    int cnt=0;

    for(int i=0; i<4; i++){
        for(int j=0; j<4; j++){
            if(S.at(i)==S.at(j)){
                cnt++;
            }
        }
    }

    if(cnt==8){
        cout << "Yes" << endl;
    }

    else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
import java.util.*;

public class Main{
	public static void main(String args[]) {
		Scanner input = new Scanner(System.in);
		int h = input.nextInt();
		int w = input.nextInt();
		char arr[][] = new char[h][w];
		long dp[][] = new long[h][w];
		for(int i=0;i<h;i++) {
			String s = input.next();
			for(int j=0;j<w;j++) {
				arr[i][j] = s.charAt(j);
			}
		}
		dp[0][0] = 1;
		for(int i=1;i<h;i++) {
			dp[i][0] = arr[i][0]=='.'?dp[i-1][0]:0;
		}
		for(int i=1;i<w;i++) {
			dp[0][i] = arr[0][i]=='.'?dp[0][i-1]:0;
		}
		for(int i=1;i<h;i++) {
			for(int j=1;j<w;j++) {
				if(arr[i][j]=='#') {
					dp[i][j] = 0;
 				}
				else {
					dp[i][j] = dp[i-1][j]%(1000000007)+dp[i][j-1]%(1000000007);
				}
			}
		}
		System.out.println(dp[h-1][w-1]%(1000000007));
	}
}

Measured memory_bytes: 39668
#include<stdio.h>
int main()
{
    int a,b;
    scanf("%d %d",&a,&b);
    if(a==b)
        printf("Draw\n");
    else if(a==1)
        printf("Alice\n");
    else if(b==1)
        printf("Bob\n");
    else if(a>b)
        printf("Alice\n");
    else if(b>a)
        printf("Bob\n");

    return 0;
}


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

int n, m, c[50];

int main() {
	cin >> n >> m;
	
	for (int i = 0; i < m; i++) {
		int a, b;
		cin >> a >> b;
		c[a - 1]++;
		c[b - 1]++;
	}

	for (int i = 0; i < n; i++) {
		cout << c[i] << endl;
	}
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    int N,M,C,i=0,j=0,count=0,x=0;
    cin >> N >> M >> C;
    int a[M];
    int b[N][M];
    
    while(i<M){
        cin >> a[i];
        i++;
    }
    
    i=0;
    
    while(i<N){
        while(j<M){
            cin >> b[i][j];
            x = x + b[i][j]*a[j];
            j++;
            }
            x = x + C;
            if(x>0){
                count=count+1;
            }
        x=0;
        j=0;
        i++;
    }
    
    cout << count << endl;
    
}

Measured memory_bytes: 256
if __name__=="__main__":
    N, K = map(int, input().split(' '))
    _town_list = input().split(' ')
    town_list = [int(n) for n in _town_list]

    next_town = town_list[0]
    visited_town = set()
    visited_town.add(1)
    visited_town.add(next_town)
    lst_visited_town = [1]
    lst_visited_town.append(next_town)
    counter = 1

    while True:
        counter += 1
        next_town = town_list[next_town-1]
        if counter == K:
            print(next_town)
            break
        if next_town in visited_town:
            repeated_town_idx = lst_visited_town.index(next_town)
            loop_num = counter - repeated_town_idx
            print(lst_visited_town[(K-repeated_town_idx)%loop_num + repeated_town_idx])
            break
        lst_visited_town.append(next_town)
        visited_town.add(next_town)



Measured memory_bytes: 44648
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define P pair<ll,ll>
#define FOR(I,A,B) for(ll I = int(A); I < int(B); ++I)
#define FORR(I,A,B) for(ll I = int((B)-1); I >= int(A); --I)
#define TO(x,t,f) ((x)?(t):(f))
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin()) //xi>=v  x is sorted
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin()) //xi>v  x is sorted
#define NUM(x,v) (POSU(x,v)-POSL(x,v))  //x is sorted
#define REV(x) (reverse(x.begin(),x.end())) //reverse
ll gcd(ll a,ll b){if(a<b)swap(a,b);if(a%b==0)return b;return gcd(b,a%b);}
ll lcm(ll a,ll b){ll c=gcd(a,b);return ((a/c)*(b/c)*c);}//saisyo kobaisu
#define NEXTP(x) next_permutation(x.begin(),x.end())
const ll INF=1e18+7;
const ll MOD=1e9+7;

class UnionFind{
public:
	vector<int> par;
	//0-indexed
	void init(int n = 1) {
		par.resize(n);
		for (int i = 0; i < n; ++i) par[i] = i;
	}
	int root(int x = 1){
		if(par[x]==x)return x;
		else{
			return par[x] = root(par[x]);
		}
	}
	void unite(int x = 1,int y = 1){
		x = root(x);
		y = root(y);
		if(x==y)return;
		else par[x] = y;
	}
	int setsize(){
		set<int> se;
		for(auto x:par){
			se.insert(root(x));
		}
		return se.size();
	}
};

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	ll n,m,a,b,c;
	cin >> n >> m;
	UnionFind uf;
	uf.init(n);
	FOR(i,0,m){
		cin >> a >> b >> c;
		uf.unite(a-1,b-1);
	}
	cout << uf.setsize() << endl;
}

Measured memory_bytes: 5376
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb emplace_back
typedef long long ll;
typedef pair<int,int> pint;

typedef pair<double,double> pdd;
double INF=1000100010;
bool cmp_y(pdd a,pdd b){
    return a.second<b.second;
}
double closest_pair(pdd *a,int n){
    if(n==1) return INF;
    int m=n/2;
    double x=a[m].first;
    double d=min(closest_pair(a,m),closest_pair(a+m,n-m));
    inplace_merge(a,a+m,a+n,cmp_y);
    vector<pdd> b;
    rep(i,n){
        if(abs(a[i].first-x)>=d) continue;
        rep(j,b.size()){
            double dx=a[i].first-b[b.size()-j-1].first;
            double dy=a[i].second-b[b.size()-j-1].second;
            if(dy>=d) break;
            d=min(d,sqrt(dx*dx+dy*dy));
        }
        b.pb(a[i]);
    }
    return d;
}
pdd a[100001];
int main(){
    int n;
    cin>>n;
    double xi,yi;
    rep(i,n){
        cin>>xi>>yi;
        a[i]={xi,yi};
    }
    sort(a,a+n);
    cout<<fixed<<setprecision(12)<<closest_pair(a,n)<<endl;
    return 0;
}


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

#define pb(a) push_back(a)
#define INF 1145141919810
#define mod 1000000007

typedef long long ll;

const int dsize = 1e5+5;
int dx[] = {-1,0,1,0},dy[] = {0,1,0,-1};
vector<ll> prime;

ll inv[dsize],fac[dsize];

template <class T = ll> T in(){T x;cin >> x;return (x);}
inline ll GCD(ll a,ll b){ll c;while(b!=0){c=a%b;a=b;b=c;}return a;}
inline ll LCM(ll a,ll b){return a*b/GCD(a,b);}
inline ll POW(ll a,ll b){ll c=1;while(b>0){if(b&1){c=a*c%mod;}a=a*a%mod;b>>=1;}return c;}
inline void _nCr(){fac[0]=1;for(int i=1;i<dsize;i++){fac[i]=fac[i-1]*i%mod;}for(int i=0;i<dsize;i++){inv[i]=POW(fac[i],mod-2);}}
inline ll nCr(ll n,ll r){return (fac[n]*inv[r]%mod)*inv[n-r]%mod;}
inline void PRI(ll n){bool a[n+1];for(int i=0;i<n+1;i++){a[i]=1;}for(int i=2;i<n+1;i++){if(a[i]){prime.pb(i);ll b=i;while(b<=n){a[b]=0;b+=i;}}}}

int main() {
	ll n,s;
	cin >> n >> s;
	ll sqr=sqrt(n);
	if (n==s) {
		cout << n+1 << endl;
		return 0;	
	}
	ll yoo;if (!n%2) yoo=n/2;
	else yoo=n/2+1;
	if (yoo<s) {
		cout << -1 << endl;
		return 0;
	}
	ll ans=-1;
	for (int i = 2;i <= sqr;i++) {
		ll x=n/i;x++;
		ll ma=i-1+n%x;
		ll mi=n/x+n%(n/(i-1));
		if (mi<=s&&s<=ma&&0==(ma-s)%(i-1)) {
			ans=x+(ma-s)/(i-1);
		}
	}
	for (int i = sqr+1;i > 1;i--) {
		ll p=n;
		ll sum=0;
		while (p) {
			sum+=p%i;
			p/=i;
		}
		if (sum==s) ans=i;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
N = int(input())
s = [None] * N
t = [None] * N
for i in range(N):
    s[i], t[i] = input().split()
    t[i] = int(t[i])
X = input()
for i in range(N):
    if s[i] == X:
        print(sum(t[i + 1:]))

Measured memory_bytes: 3060
#include<bits/stdc++.h>
 using namespace std;
 
 #define  int           long long
 #define pb                push_back
 #define ppb               pop_back
 #define pf                push_front
 #define ppf               pop_front
 #define all(x)            (x).begin(),(x).end()
 #define uniq(v)           (v).erase(unique(all(v)),(v).end())
 #define sz(x)             (int)((x).size())
 #define fr                first
 #define sc                second
 #define pint              pair<int,int>
 #define rep(i,a,b)        for(int i=a;i<b;i++)
 #define mem1(a)           memset(a,-1,sizeof(a))
 #define mem0(a)           memset(a,0,sizeof(a))
 #define ppc               __builtin_popcount
 #define ppcll             __builtin_popcountll
 #define vint			   vector<int>
 #define vpint			   vector<pair<int,int>>
 #define mp                make_pair


 void reader() 
 { 
 #ifndef ONLINE_JUDGE 
 freopen("input.txt","r",stdin);
 freopen("output.txt","w",stdout); 
 #endif
 }
 
 void fastIO() {ios_base::sync_with_stdio(false); cin.tie(NULL);}
 
 
 
 void solve()
 {
 
 int n;
 cin>>n;
 int a[n];
 rep(i,0,n)
 cin>>a[i];
 int b[n];
 rep(i,0,n)
 b[i]=a[i];
 int sum=0;
 rep(i,0,n-1)
 {
 	if(a[i]>a[i+1])
 	{
 		sum+=abs(a[i+1]-a[i]);
 		a[i+1]=a[i];
 	}
 }
 cout<<sum;
 
 cout<<"\n";
 }
 
 
 
 signed main()
 {
 	reader(); fastIO();
 	long long t=1;
 	//cin>>t;
 	while(t--) solve();
 	return 0;
 }

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

int main() {
    string s;  cin >> s;
    int ans = 0;
    rep(i,4) {
        if (s[i] == '+')  ans++;
        else  ans--; 
    }
    cout << ans << endl;
}

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

template <typename T, typename U>
vector<pair<T, U>> prime_factorization(T x)
{
    vector<pair<T, U>> ret;
    for (T i = 2; i * i <= x; i++)
    {
        U count = 0;
        while (x % i == 0)
        {
            count++;
            x /= i;
        }
        if (count > 0)
        {
            ret.push_back(make_pair(i, count));
        }
    }
    if (x != 1)
    {
        ret.push_back(make_pair(x, 1));
    }
    return ret;
}

set<long long> get_divisor(long long n)
{
    set<long long> ret;

    for (long long i = 1; i * i <= n; i++)
    {
        if (n % i == 0)
        {
            ret.insert(i);
            ret.insert(n / i);
        }
    }
    return ret;
}

int main()
{
    long long N;
    cin >> N;
    // if (N == 1)
    // {
    //     cout << 1 << endl;
    //     return 1;
    // }

    long long ans = 1;
    for (pair<long long, long long> p : prime_factorization<long long, long long>(N - 1))
    {
        ans *= p.second + 1;
    }
    ans--;
    // cout << ans << endl;

    for (long long d : get_divisor(N))
    {
        if (d == 1)
        {
            continue;
        }
        long long M = N;
        while (M % d == 0)
        {
            M /= d;
        }
        if (M % d == 1)
        {
            // cout << d << endl;
            ans++;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 512
n = int(input())
A=[]
for i in range(n):
  a,b = map(int,input().split())
  A.append((b,a))
A.sort()
c = 0
for a in A:
  c+=a[1]
  if c>a[0]:
    print("No")
    exit()
print("Yes")
  
  

Measured memory_bytes: 29456
N = gets.to_i
x, y = N.times.map{gets.split.map(&:to_i)}.transpose
t = 0
[*(0..N-1)].combination(2) {|a,b| t += Math.sqrt((x[a]-x[b])**2 + (y[a]-y[b])**2)}
p t*2/N

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

using namespace std;

int main()
{

    int a,b,c,v=0,i;
    string s[100],t[100];

    cin>>a>>b;

    for(i=0;i<a;i++)
    {
        cin>>s[i];
    }
    for(i=0;i<a;i++)
    {

        if(s[i].size()<=b)
        {
            t[i]=s[i];
        }
    }
    sort(t, t+a);
    for(i=0;i<a;i++)
    {
        cout<<t[i];
    }

}


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

int main(){
	int W;
	int H;
	int x;
	int y;
	int r;

	cin>>W;
	cin>>H;
	cin>>x;
	cin>>y;
	cin>>r;

	int top;
	int left;
	int right;
	int bottom;

	top=y+r;
	left=x-r;
	right=x+r;
	bottom=y-r;

	if((top>H)||(left<0)||(W<right)||(bottom<0)){
		cout<<"No"<<endl;
	}else{
		cout<<"Yes"<<endl;
	}
}



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

int main() {
	int K, S;
	cin >> K >> S;
	int xmin, xmax;
	int cnt = 0;
	for (int z = 0; z <= K; z++) {
		xmin = max(0, S - z - K);
		xmax = min(K, S - z);
		if (xmax >= xmin) cnt += xmax - xmin + 1;
	}

	cout << cnt << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = (int)(a); i <= (int)(n); ++i)
#define rrep(i, a, n) for (int i = (int)(a); i >= (int)(n); --i)
#define debug(x) cerr << #x << " = " << x << "\n"
#define debugv(x) \
  rep(f, 0, (x.size() - 1)) cerr << x[f] << (f == (x.size() - 1) ? "\n" : " ")
#define all(x) x.begin(), x.end()
#define int long long
using namespace std;
typedef pair<int, int> pii;
typedef vector<int> vi;
const int MX = 1e5 + 5, INF = 5 << 28, MOD = 1e9 + 7;

int N, M, K;
vector<string> A, B;
string S, T;

void input() {
  cin >> N >> M;
  A.resize(N);
  B.resize(M);
  rep(i, 0, N - 1) { cin >> A[i]; }
  rep(i, 0, M - 1) { cin >> B[i]; }
}
void solve() {
  bool ans = true;
  rep(i, 0, N - 1) {
    rep(j, 0, N - 1) {
      bool mcd = false;
      rep(k, 0, M - 1) {
        if (mcd) break;
        rep(l, 0, M - 1) {
          if (i + k < N && j + l < N) {
            if (A[i + k][j + l] != B[k][l]) {
              mcd = true;
              break;
            }
          } else {
            mcd = true;
          }
        }
      }
      if (!mcd) {
        cout << "Yes" << endl;
        return;
      }
    }
  }
  cout << "No" << endl;
  ;
  ;
}
signed main() {
  input();
  solve();
  return 0;
}

Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

sum = 0

for i in range(N):
    sum += B[A[i]-1]
    if i == 0:
        pass
    elif A[i-1] == A[i] -1:
        sum += C[A[i-1]-1]
print(sum)

Measured memory_bytes: 3064
#include<iostream>
#include<string>
#include<string.h>
#include<algorithm>
#include<stdio.h>
#include<cmath>
#include<vector>
#include<utility>
#include<stack>
#include<queue>
#include<list>
#include<bitset>
#include<functional>

#define FOR(i, a, b) for(long long int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for(long long int i=(a);i>=(b);i--)
#define MOD 1000000007
#define INF 1000000000 //2000000000
#define LLINF 1000000000000000000 //9000000000000000000
#define PI 3.14159265358979

using namespace std;
typedef long long int ll;
typedef pair< long long int, long long  int> P;



int main(void) {
	int n, m;

	cin >> n >> m;
	n -= m + 1;
	cout << n << endl;



	return 0;
}


Measured memory_bytes: 3088
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define F first
#define S second

const int mx=100010;
const ll mod=1e9+7;

int n,s,b,c;
ll sum=0;
vector<ll> a(mx);

bool finish(ll x){
  ll cnt=0;
  ll pw = b*x;
  auto itma = lower_bound(a.begin(),a.end(),pw+1);
  while(itma != a.end()){
    int pwcnt = (*itma-pw+c-1)/c;
    cnt += (a.end()-itma)*pwcnt;
    pw += c*pwcnt;
    itma = lower_bound(a.begin(),a.end(),pw+1);
    if(cnt>x){ return false; }
  } 
  if(cnt<=x){ return true; } else { return false; }
}


int main(){
  cin >> n >> s >> b;
  c = s-b;
  rep(i,n){ cin >> a[i]; sum += a[i]; }
  sort(a.begin(),a.end());
  
  ll l=0,r=inf,mid=(r+l)/2;
  while(r-l>1){
    mid=(r+l)/2;
    if(finish(mid)){ r=mid; }else{ l=mid; }
  }
  ll ans = r;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <sstream>
#include <iomanip>
#include <set>
#include <queue>
#include <stack>
#include <utility>
#include <stdio.h>
#include <unistd.h>
using namespace std;
typedef long long int ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define drep(i, n) for(int i = n - 1; i >= 0; i--)
#define itrep(itr, base) for (auto itr = base.begin(); itr != base.end(); itr++)
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define yes cout << "yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
#define no cout << "no" << endl
#define PI 3.14159265359

const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;
const int mod = 1000000007;

void P(int x) {cout << x << endl;}
void P(long x) {cout << x << endl;}
void P(double x) {cout << x << endl;}
void P(ll x) {cout << x << endl;}
void P(string x) {cout << x << endl;}
void P(char x) {cout << x << endl;}

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

int main() {
  ll n;
  cin >> n;
  map<ll, ll> mp;
  for (ll i = 2; i * i <= n; i++) {
    if (n % i == 0) {
      mp[i] = 0;
      while (n % i == 0) {
        n /= i;
        mp[i]++;
      }
      if (n == 1) break;
    }
  }
  if (n > 1) mp[n]++;
  int ans = 0;
  itrep(itr, mp) {
    int num = itr->second;
    int count = 1;
    while (num >= count) {
      ans++;
      num -= count;
      count++;
    }
    // cout << itr->first << ": " << itr->second << endl;
  }



  P(ans);

  return 0;
}


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

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

const int mod = 1000000007;
//const int mod = 998244353;

struct mint {
    ll x; // typedef long long ll;
    mint(ll x=0):x((x%mod+mod)%mod){}
    mint operator-() const { return mint(-x);}
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod-a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
    mint operator+(const mint a) const { return mint(*this) += a;}
    mint operator-(const mint a) const { return mint(*this) -= a;}
    mint operator*(const mint a) const { return mint(*this) *= a;}
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }

    // for prime mod
    mint inv() const { return pow(mod-2);}
    mint& operator/=(const mint a) { return *this *= a.inv();}
    mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}


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

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

// combination mod prime
// https://www.youtube.com/watch?v=8uowVvQ_-Mo&feature=youtu.be&t=1619
struct combination {
    vector<mint> fact, ifact;
    combination(int n):fact(n+1),ifact(n+1) {
        assert(n < mod);
        fact[0] = 1;
        for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
        ifact[n] = fact[n].inv();
        for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
    }
    mint operator()(int n, int k) {
        if (k < 0 || k > n) return 0;
        return fact[n]*ifact[k]*ifact[n-k];
    }
};
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    char a; cin >> a;
    a++;
    cout << (char)a << endl;
}


Measured memory_bytes: 256
n,m = (int(j) for j in input().split())
K = [[0]]*n
Count = [0]*m
for j in range(n):
    K[j] = [int(k) for k in input().split()]
for j in range(n):
    for k in range(1,K[j][0] + 1):
        Count[K[j][k] - 1] = Count[K[j][k]-1] + 1
count2 = 0
for j in range(m):
    if Count[j] == n:
        count2 = count2 + 1
print(count2)

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <cstring>

using namespace std;
// ascending order
#define vsort(v) sort(v.begin(), v.end())
// descending order
#define vsort_r(v) sort(v.begin(), v.end(), greater<int>())
// ascending order
#define asort(array, N) sort(array, array + N)
// descending order
#define asort_r(array, N) sort(array, array + N, greater<int>())
#define vunique(v) v.erase(unique(v.begin(), v.end()), v.end())
#define mp make_pair
#define ts(x) to_string(x)
typedef long long ll;
typedef pair<int, int> P;
const ll INF = 1e18;

ll X, Y;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cin >> X >> Y;

	ll A = X;
	ll ans = 0;
	while(A <= Y) {
		A *= 2;
		ans++;
	}
	cout << ans << endl;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end))) // rep(i, 1, 5) --> {1,2,3,4} // rep(i, 5, 1) --> {4,3,2,1} // rep(it, end(v), begin(v)) --> *it

using namespace std;

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

Measured memory_bytes: 3624
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <functional>
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 200000000
#define mod 1000000007
#define INF2 1000000000000000000
int H, W;
int sx, sy, gx, gy;
string S[1010];
int d[1010][1010];
typedef pair<int, int> P;
typedef pair<int, P> PP;
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};
int bfs() {
    priority_queue<PP, vector<PP>, greater<PP>> que;
    queue<P> visited;
    rep(i, 1010) rep(j, 1010) d[i][j] = INF;
    d[sx][sy] = 0;
    que.push({0, {sx, sy}});
    visited.push({sx, sy});
    while(que.size()) {
        while(que.size()) {
            PP pp = que.top(); que.pop();
            int cost = pp.first;
            int x = pp.second.first;
            int y = pp.second.second;
            if(d[x][y] < cost) continue;
            rep(i, 4) {
                int xx = x + dx[i];
                int yy = y + dy[i];
                if(xx < 0 || xx >= H || yy < 0 || yy >= W) continue;
                if (S[xx][yy] == '#') continue;
                if(d[xx][yy] == INF) {
                    visited.push({xx, yy});
                }
                if(d[xx][yy] > cost) {
                    d[xx][yy] = cost;
                    que.push({cost, {xx, yy}});
                }
            }
        }
        queue<P> tmp;
        while(visited.size()) {
            P p = visited.front(); visited.pop();
            int x = p.first;
            int y = p.second;
            rep(i, 25) {
                int xx = x + i % 5 - 2;
                int yy = y + i / 5 - 2;
                if(xx < 0 || xx >= H || yy < 0 || yy >= W) continue;
                
                if (S[xx][yy] == '#') continue;
                if(d[xx][yy] == INF || d[xx][yy] > d[x][y] + 1) {
                    d[xx][yy] = d[x][y] + 1;
                    que.push({d[x][y] + 1, {xx, yy}});
                    tmp.push({xx, yy});
                }
            }
        }
        visited = tmp;
    }
    return d[gx][gy];
}

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    cin >> H >> W;
    cin >> sx >> sy;
    cin >> gx >> gy;
    sx--; sy--; 
    gx--; gy--;
    rep(i, H) cin >> S[i];
    d[sx][sy] = 0;
    int ans = bfs();
    if(ans == INF) ans = -1;
    cout << ans << endl;
    // rep(i, H) {
    //     rep(j, W) {
    //         if(d[i][j] == INF) {
    //             cout << "∞" << " ";
    //         } else {
    //             cout << d[i][j] << " ";
    //         }
    //     }
    //     cout << endl;
    // }

    return 0;
}


Measured memory_bytes: 8744
#include <iostream>
using namespace std;
int main(){
  int a, b, c, d;
  cin>>a>>b>>c>>d;
  int l = (a+b);
  int r = (c+d);
  if(a>= 1&&b>=1&&c>=1&&d>=1&&a<= 10&&b<=10&&c<=10&&d<=10){
  	if(l<r){
    	cout<<"Right"<<endl;
  	}
  	if(l>r){
    	cout<<"Left"<<endl;
  	}
  	if(l==r){
    	cout<<"Balanced"<<endl;
  	}
  }
}

Measured memory_bytes: 256
import java.util.*;
public class Main{
	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
      int n = sc.nextInt();
      int k = sc.nextInt();
      int q = sc.nextInt();
      int[] a = new int[q];
      int[] p = new int[n];
      for(int i = 0;i < n;i++)p[i]=k-q;
      for(int i = 0;i < q;i++){
        a[i]=sc.nextInt();
        p[a[i]-1]++;
      }
      for(int i = 0;i < n;i++){
      	if(p[i]>0)System.out.println("Yes");
        else System.out.println("No");
      }
    }
}

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

int main()
{
    //A問題
    int a,b,t;
    cin>>a>>b>>t;
    int ans=0,time=a;
    double x=(double)t + 0.5;
    while((double)time <=x){
        ans+=b;
        time+=a;
    }
    cout<<ans<<endl;
    

   /*B問題
   int n;
   cin>>n;
   vector<int> v(n),c(n),cost(n);
   for(int i=0;i<n;i++){
       cin>>v[i];
   }
   for(int i=0;i<n;i++){
       cin>>c[i];
   }
   for(int i=0;i<n;i++){
       cost[i]=v[i]-c[i];
   }
   sort(cost.begin(),cost.end());
   int ans=0;
   for(int i=n-1;i>=0;i--){
       if(cost[i]<=0){
           break;
       }
       ans+=cost[i];
   }
   cout<<ans<<endl;
    */



    /*D問題
    int n;
    cin>>n;
    vector<ll> v(n);
    for(int i=0;i<n;i++){
        cin>>v[i];
    }
    ll sum=0;
    for(int i=0;i<n-1;i++){
        if(v[i]<0){
            v[i]=-v[i];
            v[i+1]=-v[i+1];
        }
        sum+=v[i];
    }
    if(v[n-1]>=0){
        sum+=v[n-1];
        cout<<sum<<endl;
    }else{
        sum+=v[n-1];
        ll ans=sum;
        for(int i=n-2;i>=0;i--){
            v[i+1]=-v[i+1];
            sum+=2*v[i+1];
            v[i]=-v[i];
            sum+=2*v[i];
            ans=max(ans,sum);
        }
        cout<<ans<<endl;
    }
    */
    return 0;
}

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

using namespace std;

typedef long long ll;

int maxx[1050];

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin >> n;
	queue<int> player[n+1];
	for(int i=1; i<=n; i++){
		for(int j=1; j<n; j++){
			int x;
			cin >> x;
			player[i].push(x);
		}
	}
	bool flag;
	bool isEmp;
	while(1){
		isEmp = true;
		flag = true;
		for(int i=1; i<=n; i++){
			if(player[i].empty()) continue;
			isEmp = false;
			int x = player[i].front();
			if(player[x].front() == i){
				maxx[i] = maxx[x] = max(maxx[i], maxx[x]) + 1;
				player[i].pop();
				player[x].pop();
				flag = false;
			}
		}
		if(isEmp) break;
		if(flag){
			cout << -1 << endl;
			return 0;
		}
	}
	int ans = -1;
	for(int i=1; i<n+1; i++) ans = max(ans, maxx[i]);
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 4736
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cctype>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <complex>
#include <sstream>
#include <deque>

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

using namespace std;

typedef vector< vector<int> > field;

int w, h;
field f, closed;
int mx[] = {0, 0, 1, -1},
    my[] = {1, -1, 0, 0};

void dump(field &f, int x = -1, int y = -1) {
    REP(i, f.size()) {
        REP(j, f[i].size()) {
            if ( y == i && x == j )
                cout << "# ";
            else
                cout << f[i][j] << " ";
        }
        cout << endl;
    }
}

int in_range(int x, int y, int w, int h) {
    return (int)(0 <= x && x < w && 0 <= y && y < h);
}

int bt(int x, int y, int step) {
    // printf("step:%d x:%d y:%d\n", step, x, y);
    // dump(f, x, y);

    int res = INT_MAX, tmp;

    // 終了条件
    if ( step == 10 ) {
        return res;
    }

    // 上下左右に進めるなら進む
    REP(i, 4) {
        int nx = x, ny = y;
        // cout << "-----" << endl;

        // int nx = x + mx[i],
        //     ny = y + my[i];

        // printf("x:%d y:%d f[ny][nx]:%d\n", nx, ny, f[ny][nx]);

        // while(in_range(nx+mx[i], ny+my[i], w, h)) {
        while(1) {
            nx += mx[i];
            ny += my[i];

            if ( !in_range(nx, ny, w, h) ) {
                break;
            }
            // printf("nx:%d ny:%d f[ny][nx]:%d\n", nx, ny, f[ny][nx]);

            if ( f[ny][nx] == 1 ) {
                break;
            } else if ( f[ny][nx] == 3 ) {
                return step + 1;
            }
        }

        if ( !in_range(nx, ny, w, h) || abs(x-nx) == 1 || abs(y-ny) == 1 ) continue;
        // printf("nx:%d ny:%d inrange:%d\n", nx, ny, in_range(nx, ny, w, h));
        // printf("push: %d, %d, %d mx[i]:%d, my[i]:%d\n", (nx-mx[i]), (ny-my[i]), (step+1), mx[i], my[i]);
        // dump(f, nx, ny);
        // cout << "hoge" << endl;

        // 障害物を破壊
        f[ny][nx] = 0;
        tmp = bt(nx-mx[i], ny-my[i], step+1);
        f[ny][nx] = 1;

        // 最小手の更新
        if ( tmp < res )
            res = tmp;
    }

    return res;
}

int main() {
    int fx, fy, res;

    while( cin >> w >> h, w || h ) {
        f = field(h, vector<int>(w));
        // closed = field(h, vector<int>(w));

        // 入力
        REP(i, h) {
            REP(j, w) {
                cin >> f[i][j];
                if ( f[i][j] == 2 ) {
                    fx = j;
                    fy = i;
                }
            }
        }
        // dump(f, fx, fy);

        res = bt(fx, fy, 0);

        if ( res != INT_MAX )
            cout << res;
        else
            cout << -1;
        cout << endl;
    }

    return 0;
}

Measured memory_bytes: 1224
#include"bits/stdc++.h"
using namespace std;
typedef long long ll;
const ll MOD = (ll)(1e9+7);
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int (i)=0; (i)<(int)(n); (i)++)
int dx[4]={ 1,0,-1,0 };
int dy[4]={ 0,1,0,-1 };

int N;
int A[200000];

signed main(){
    cin >> N;
    rep(i, N) cin >> A[i];

    int ans = 0;
    rep(i, N){
        if(A[i] == ans+1) ans++;
    }
    if(ans == 0) cout << "-1" << endl;
    else cout << N-ans << endl;
}

Measured memory_bytes: 1152
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<deque>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<string>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define reps(i,n) for(int i=1;i<=(int)n;i++)
#define all(v) v.begin(), v.end()
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define lb lower_bound
#define ub upper_bound
#define LB(a,x) lb(all(a), x) - a.begin()
#define UB(a,x) ub(all(a), x) - a.begin()
#define MOD 1000000007
#define itn int
#define enld endl
using namespace std;
typedef long long ll;
const double pi = 3.141592653589793;
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;}
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

int main(){
    int L,R,d; cin >> L >> R >> d;
    int ans  = 0;
    for(int i=L;i<=R;i++){
        if(i % d == 0) ans++;
    }
    cout << ans << enld;
    return 0;
}

Measured memory_bytes: 3500
#include "bits/stdc++.h"
using namespace std;
const int N = 1e5 + 5;
int n;
long long arr[N];
long long dif[N];
long long sum;
long long x;
int main(){
    scanf("%d" , &n);
    sum = 0;
    for(int i = 1 ; i <= n ; ++i){
        scanf("%lld" , arr + i);
        sum += arr[i];
    }
    dif[1] = arr[1] - arr[n];
    for(int i = 2 ; i <= n ; ++i){
        dif[i] = arr[i] - arr[i - 1];
    }
    long long s = (1LL * n * (n + 1LL)) / 2LL;
    if(sum % s != 0){
        cout << "NO\n";
        return 0;
    }
    x = sum / s;
    for(int i = 1 ; i <= n ; ++i){
        dif[i] -= x;
    }
    sum = 0;
    for(int i = 1 ; i <= n ; ++i){
        if(dif[i] > 0){
            cout << "NO\n";
            return 0;
        }
        dif[i] *= -1;
        if(dif[i] % n){
            cout << "NO\n";
            return 0;
        }
        sum += dif[i] / n;
    }
    if(sum != x){
        cout << "NO\n";
        return 0;
    }
    cout << "YES\n";
}

Measured memory_bytes: 1792
results = []

while True:
    N = input()

    if N == '-':
        break

    m = int(input())

    shuffle = []
    for i in range(m):
        n = int(input())
        shuffle.append(n)

    for n in shuffle:
        N = N[n:] + N[:n]

    results.append(N)


for result in results:
    print(result)



Measured memory_bytes: 5600
#include <iostream>
#include <algorithm>

void fastin(int &num) {
    bool neg = false;
    int c;
    num = 0;
    c = getchar_unlocked();
    if (c == '-') {
        neg = true;
        c = getchar_unlocked();
    }
    for (; (c > 47 && c < 58); c = getchar_unlocked()) num = num * 10 + c - 48;
    if (neg) num *= -1;
}

void fastout(int n) {
    int N = n, rev, count = 0;
    rev = N;
    if (N == 0) { putchar('0'); putchar('\n'); return ;}
    while ((rev % 10) == 0) { ++count; rev /= 10;}
    rev = 0;
    while (N != 0) { rev = (rev<<3) + (rev<<1) + N % 10; N /= 10;}
    while (rev != 0) { putchar(rev % 10 + '0'); rev /= 10;}
    while (count--) putchar('0');
}

int main(){
    int n, c, k; fastin(n); fastin(c); fastin(k);
    int t[n];
    for (int i = 0; i < n; ++i) fastin(t[i]);

    std::sort(t, t + n);

    int ans = 0;
    int beg = 0;
    while (beg < n){
        int end = beg;
        while (end - beg + 1 < c && t[end + 1] - t[beg] <= k){
            ++end;
            if (end == n - 1) break;
        }
        ++ans; beg = end + 1;
        if (beg == n - 1){
            ++ans; break;
        }
    }
    fastout(ans);
    
    return 0;
}

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

int bubbleSort(int l[], int n) {
    int count = 0;
    bool flag = 1;
    for(int i=0; flag; ++i) {
        flag = 0;
        for(int j=n-1; j>=1+i; --j) {
            if(l[j]<l[j-1]) {
                swap(l[j], l[j-1]);
                flag = 1;
                count++;
            }
        }
    }
    return count;
}

int main() {
    int n, l[100], count;
    cin >> n;
    for(int i=0; i<n; ++i) cin >> l[i];
    
    count = bubbleSort(l, n);
    
    for(int i=0; i<n; ++i) {
        if(i) cout << " ";
        cout << l[i];
    }
    cout << endl;
    cout << count << endl;
    
    return 0;
}


Measured memory_bytes: 3096
using System;
using System.IO;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Numerics;
using System.Diagnostics;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static System.Math;
using MethodImplOptions = System.Runtime.CompilerServices.MethodImplOptions;
using MethodImplAttribute = System.Runtime.CompilerServices.MethodImplAttribute;

static class P
{
    static void Main()
    {
        var nab = Console.ReadLine().Split().Select(long.Parse).ToArray();
        var n = nab[0];
        var a = nab[1] - nab[2];
        var b = nab[2];
        var h = Enumerable.Repeat(0, (int)n).Select(_ => int.Parse(Console.ReadLine())).OrderBy(x => x).ToArray();
        long valid = int.MaxValue;
        long invalid = 0;
        while ((valid - invalid) > 1)
        {
            var mid = (valid + invalid) / 2;
            if (h.Select(x => (Max(x - b * mid, 0) + a - 1) / a).Sum() <= mid) valid = mid;
            else invalid = mid;
        }
        Console.WriteLine(valid);
    }
}


Measured memory_bytes: 20700
use std::io::{stdin, Read};
use std::str::FromStr;

// https://qiita.com/tubo28/items/e6076e9040da57368845
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

#[allow(dead_code)]
fn main() {
    let n = read::<usize>();
    let xyh = (0..n)
        .map(|_| (read::<i64>(), read::<i64>(), read::<i64>()))
        .filter(|&(_, _, h)| h > 0)
        .collect::<Vec<_>>();

    let min_x = xyh.iter().map(|&(x, _, _)| x).min().unwrap();
    let max_x = xyh.iter().map(|&(x, _, _)| x).max().unwrap();
    let min_y = xyh.iter().map(|&(_, y, _)| y).min().unwrap();
    let max_y = xyh.iter().map(|&(_, y, _)| y).max().unwrap();

    let inf = i64::max_value();
    for cx in min_x..max_x + 1 {
        for cy in min_y..max_y + 1 {
            let mut h = inf;
            for &(xi, yi, hi) in &xyh {
                let _h = hi + (xi - cx).abs() + (yi - cy).abs();
                if h == inf {
                    h = _h
                } else if h != _h {
                    h = inf;
                    break;
                }
            }

            if h != inf {
                println!("{} {} {}", cx, cy, h);
                return;
            }
        }
    }
}


Measured memory_bytes: 4352
//2020年4月17日現在

#include<stdio.h>
#include<cmath>
#include<math.h>
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<complex>
#include<queue>
#include<set>
#include<utility>
#include<iomanip>
#include<limits>
#include<thread>
#include<map>
#include<stack>
#include<numeric>
#include<cassert>
#include<random>
#include<chrono>
#include<unordered_set>
#include<unordered_map>
#include<fstream>
#include<list>
#include<functional>
#include<bitset>
#include<tuple>
#include <cstdio>

using namespace std;

template <class... A>
void prints() { cout << "\n"; }
template <class... A>
void prints_rest() { cout << "\n"; }
template <class T, class... A>
void prints_rest(const T &first, const A &... rest) { cout << " " << first; prints_rest(rest...); }
template <class T, class... A>
void prints(const T &first, const A &... rest) { cout << first; prints_rest(rest...); }
template <class T, class... A>
void printd(const T &first, const A &... rest) { cout << fixed << setprecision(15) << first; prints_rest(rest...); }


namespace {
	// printElems(&a[0], &a[n]);　みたいな感じで使う。
	void printElems(const int* begin, const int* end)
	{
		for (const int* p = begin; p != end; ++p) {
			cout << *p << ' ';
		}
		cout << endl;
	}
}

#define rep(i,n) for(ll i=0; i<n; i++)
#define rep1(i,n) for(ll i=1; i<n+1; i++)
#define repr(i,n) for(ll i=n-1; i>=0; i--)
#define repr1(i,n) for(ll i=n; i>0; i--)
#define FOR(i,j,n) for(ll i=j; i < n; i++)
#define souatari(i,j,n) rep1(i,n-1)rep(j,i)
#define souatari1(i,j,n) for(ll i=2; i<n+1; i++)rep1(j,i-1)
#define mp make_pair
#define F first
#define S second
#define elif else if

typedef long long ll;
typedef vector<int>  vi;
typedef vector<vi>  vvi;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<pii> vpii;
typedef array<int,3> arr3;
typedef long double D;


const ll llinf =  numeric_limits<ll>::max();
const ll _llinf = numeric_limits<ll>::lowest();
const int inf = numeric_limits<int>::max();
const int _inf = numeric_limits<int>::lowest();
const double dinf = numeric_limits<double>::infinity();
const ll MOD = 1000000007;
//const ll MOD = 998244353;
const ll BIG = 1LL<<60;
const string yes = "Yes";
const string no = "No";

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


int main(){
	int n;
	cin >> n;
	string c;
	cin >> c;
	int rcnt = 0;
	rep(i,n) if(c[i] == 'R') rcnt++;
	int wcnt = 0;
	int ans = max(rcnt,wcnt);

	rep1(i,n){
		if(c[i-1] == 'R'){rcnt--;}
		else{wcnt++;}
		ans = min(ans,max(rcnt,wcnt));
	}
	prints(ans);


	return 0;
}




Measured memory_bytes: 3700