akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#define A 0
#define B 1
#define S 2
#define E 3
#define N 4
#define W 5

class Dice{
private:
    int num[6]; // ^ v o > x <
public:
    Dice(){
        num[A] = 1;
        num[B] = 6;
        num[S] = 2;
        num[E] = 3;
        num[N] = 5;
        num[W] = 4;
    }
    void North(){
        int tmp=num[A];
        num[A]=num[S];
        num[S]=num[B];
        num[B]=num[N];
        num[N]=tmp;
    }
    void East(){
        int tmp=num[A];
        num[A]=num[W];
        num[W]=num[B];
        num[B]=num[E];
        num[E]=tmp;
    }
    void West(){
        int tmp=num[A];
        num[A]=num[E];
        num[E]=num[B];
        num[B]=num[W];
        num[W]=tmp;
    }
    void South(){
        int tmp=num[A];
        num[A]=num[N];
        num[N]=num[B];
        num[B]=num[S];
        num[S]=tmp;
    }
    void Right(){
        int tmp=num[S];
        num[S]=num[E];
        num[E]=num[N];
        num[N]=num[W];
        num[W]=tmp;
    }
    void Left(){
        int tmp=num[S];
        num[S]=num[W];
        num[W]=num[N];
        num[N]=num[E];
        num[E]=tmp;
    }
    int GetAbove(){return num[0];}
};

int main(void){
    int n;
    char buf[8];
    int sum;
    Dice *dice;
    
    while (scanf("%d",&n), n!=0){
        sum=1;
        dice = new Dice;
        for (int i=0; i<n; i++){
            scanf("%s", buf);
            switch(buf[0]){
                case 'N': dice->North(); break;
                case 'E': dice->East(); break;
                case 'W': dice->West(); break;
                case 'S': dice->South(); break;
                case 'R': dice->Right(); break;
                case 'L': dice->Left(); break;
            }
            sum += dice->GetAbove();
        }
        printf("%d\n", sum);
        delete dice;
    }
}

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

using namespace std;

// Repetitions
#define FOR(i,a,n) for(ll i = ((ll) a); i < ((ll) n); ++i)
#define FORR(i, s, g) for(ll i = ((ll)s - 1); i >= ((ll) g); --i)
#define REP(i, n) FOR(i, 0, n)
#define REPR(i, n) FORR(i, n, 0)

// Container Utils
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define SORTALL(v) sort(ALL(v))
#define SZ(a) int((a).size())
#define CLR(a) memset((a), 0 ,sizeof(a))
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())

// For Debug
#define DMP(x)  cerr << #x << " = " << (x) << endl
#define DBG(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl

// Aliases
#define PB push_back
#define MP make_pair
typedef long long ll;
typedef string str;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<long long> vll;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;

// I/O Asynchronizing
struct aaa{
    aaa(){
        cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);
    };
}aaaaaaa;

#define MAX_VAL 20
#define MAX_N 100
ll cnt[MAX_N - 1][MAX_VAL + 1] = { 0 };

inline bool is_in_range(const int v) {
    return 0 <= v && v <= MAX_VAL;
}

int main() {
    int n, a;
    cin >> n >> a;
    cnt[0][a] = 1;
    REP(i, n - 2) {
        int v;
        cin >> v;
        REP(j, MAX_VAL + 1) {
            if(cnt[i][j] > 0) {
                int v1 = j + v, v2 = j - v;
                if(is_in_range(v1)) {
                    cnt[i + 1][v1] += cnt[i][j];
                }
                if(is_in_range(v2)) {
                    cnt[i + 1][v2] += cnt[i][j];
                }
            }
        }
    }
    int ans;
    cin >> ans;
    cout << cnt[n - 2][ans] << "\n";

    return 0;
}



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

using namespace std;

int INF=1e9;

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

    int n;
    cin>>n;

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

    int ans=1,p=0;//p:0なら変化なし,1なら増加,2なら減少

    for(int i=0;i<n-1;i++){
        if(a[i]==a[i+1])continue;
        else if(a[i]<a[i+1]){
            if(p==0){
                p=1;
            }
            else if(p==2){
                ans++;
                p=0;
            }
        }
        else{
            if(p==0){
                p=2;
            }
            else if(p==1){
                ans++;
                p=0;
            }
        }
    }

    cout<<ans<<endl;

}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1e18;
const ll MOD = 1e9 + 7;
#define all(v) v.begin(), v.end()
#define repi(i, n, init) for (ll i = init; i < (n); i++)
#define repd(i, n, init) for (ll i = (n); i >= init; i--)
#define repm(i, m) for (auto i = m.begin(); i != m.end(); i++)

int main()
{
    ll A, B, K;
    cin >> A >> B >> K;
    K = min((B - A + 1) % 2 == 0 ? (B - A + 1) / 2 : int((B - A + 1) / 2) + 1, K);
    ll tmp = A + K - 1;
    repi(i, A + K, A)
    {
        cout << i << " ";
    }
    repi(i, B + 1, B - K + 1)
    {
        if (i != tmp)
        {
            cout << i << " ";
        }
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
n = int(input())
array = []
array.append(1)
for i in range(2,32):
  cnt = 2
  num = i**cnt
  while num<=1000:
    array.append(num)
    cnt += 1
    num = i**cnt 

array.sort()
ans = 0
l = len(array)
for i in range(l):
  if array[i]<=n:
    ans = array[i]
print(ans)


Measured memory_bytes: 3060
#include <iostream>
#include <sstream>
#include <cstdio>
#include <stdlib.h>
#include <string>
#include <vector>
#include<stack>
#include <algorithm>
using namespace std;
#define max 101
#define WHITE 0
#define BLACK 1
#define GRAY -1
int color[max],d[max],f[max];
int t,varry[max][max];
stack<int> s;
int next(int u){
  int nv=-1;
  for(int i=0;i<varry[u][0];i++){
    if(color[varry[u][i+1]]==WHITE){
      nv=varry[u][i+1];
      break;
    }
  }
  
  return nv;
}
void visit(int r){
  int u,v;
  s.push(r);
  color[r]=GRAY;
  d[r]=++t;
  while(!s.empty()){
    u=s.top();
    v=next(u);
    if(v!=-1){
      if(color[v]==WHITE){
	s.push(v);
	color[v]=GRAY;
	d[v]=++t;
      }
    }
    else{
      s.pop();
      color[u]=BLACK;
      f[u]=++t;
      
    }
  }
}
void dfs(int u){
  for(int i=1;i<=u;i++)
    if(color[i]==WHITE)visit(i);
}
int main(){
  int n,u;
  cin>>n;
  for(int k=0;k<n;k++){
    cin>>u;
    cin>>varry[u][0];
    for(int i=0;i<varry[u][0];i++)
      cin>>varry[u][i+1];

  }
  dfs(n);
  for(int i=1;i<=n;i++){
    cout<<i<<" "<<d[i]<<" "<<f[i]<<endl;
  }


  return 0;
}



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

char getGrade(int m,int f,int r){
	int sum = m + f;
	char grade;
	if ( m == -1 || f == -1 ){
		grade = 'F';
	}else if (80 <= sum) {
		grade = 'A';
	}else if (65 <= sum && sum < 80 ){
		grade = 'B';
	}else if (50 <= sum && sum < 65 ){
		grade = 'C';
	}else if (30 <= sum && sum < 50 ){
		if ( 50 <= r ) grade = 'C' ;
		else grade = 'D';
	}else if (sum < 30 ){
		grade = 'F' ;
	}

	return grade;
}

int main(){
	int m, f, r;
	while(1){
		cin >> m >> f >> r;
		if ( m == -1 && f == -1 && r == -1 ) break;
		cout << getGrade(m, f, r) << endl;
	}

	return 0;
}

Measured memory_bytes: 3104
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
typedef long long ll;

int main()
{
    int n,d;
    cin>>n>>d;
    d=2*d+1;
    if(n%d==0){
        cout<<n/d<<endl;
    }
    else{
        cout<<n/d+1<<endl;
    }
}

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

int arr[110000], maxi= 0, now;
int main() {
	int N;
	cin >> N;
	for (int i = 0; i < N; i++)
		cin >> arr[i];
	for (int i = 0; i < N - 1; i++) {
		if (arr[i] >= arr[i + 1])
			now++;
		else
			now = 0;
		maxi = max(maxi, now);
	}
	cout << maxi;
}

Measured memory_bytes: 640
# -*- coding: utf-8 -*-
 
import math
import itertools
import sys
import copy
 
# 入力
#A, B, C, D = map(int, input().split())
#L = list(map(int, input().split()))
#S = list(str(input()))
#N = int(input())
S = str(input())

print (S[:len(S)-8])



Measured memory_bytes: 38256
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1005;
const int MOD = 1e9 + 7;
vector < string > arr;
int dp[MAXN][MAXN];
int main(){
    int n, m;
    cin >> n >> m;
    arr.resize(n, {});
    for(int i = 0; i < n; i++)
        cin >> arr[i];
    dp[0][0] = (arr[0][0] == '.');
    for(int i = 1; i < m; i++)
        if(arr[0][i] == '.' && arr[0][i - 1] == '.') dp[0][i] = dp[0][i - 1];
    for(int i = 1; i < n; i++)
        if(arr[i][0] == '.' && arr[i - 1][0] == '.') dp[i][0] = dp[i - 1][0];
    for(int i = 1; i < n; i++){
        for(int j = 1; j < m; j++){
            if(arr[i][j] == '#') dp[i][j] = 0; 
            else{
                dp[i][j] = (dp[i - 1][j] + dp[i][j - 1]) % MOD;
            }
        }
    }
    cout << dp[n - 1][m - 1] << "\n";
}


Measured memory_bytes: 5248
#include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <queue>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <climits>
//#include "h.h"
using namespace std;

#define MOD1097 1000000007

#define ll long long
#define pint pair<int, int>
#define pll pair<ll, ll>
#define pb push_back
#define mp make_pair
#define pm(first, second) pb(mp(first, second))
#define SPACE " "
#define fpf first.first
#define fps first.second
#define spf second.first
#define sps second.second

#define all(X) (X).begin(), (X).end()

int main(){

	int N;
	vector<string> S(2);
	cin >> N >> S[0] >> S[1];
	vector<int> V;
	for(int i = 0; i < N; i ++){
		if(S[0][i] == S[1][i]){
			V.pb(1);
		}
		else{
			V.pb(0);
			i ++;
		}
	}
	ll ans = 1;
	if(V[0] == 0){
		ans *= 6;
	}
	else{
		ans *= 3;
	}
	for(int i = 1; i < V.size(); i ++){
		ans %= MOD1097;
		if(V[i] == 0){
			if(V[i - 1] == 0){
				ans *= 3;
			}
			else{
				ans *= 2;
			}
		}
		else{
			if(V[i - 1] == 0){
				ans *= 1;
			}
			else{
				ans *= 2;
			}
		}
	}
	ans %= MOD1097;
	cout << ans << endl;

//"Hiroakimm0415"

	return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;


public class Main {

	public static void main(String[] args) {
		try {
			BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
			int n = Integer.parseInt(bf.readLine());

			Map<String, Integer> sMap = new TreeMap<String, Integer>();
			List<Map<Integer, Integer>> pMapList = new ArrayList<Map<Integer, Integer>>();
			for (int i = 1; i <= n; i++) {
				String[] input = bf.readLine().split(" ");
				String s = input[0];
				int p = Integer.parseInt(input[1]);

				Map<Integer, Integer> pMap;
				if (sMap.containsKey(s)) {
					pMap = pMapList.get(sMap.get(s));
				} else {
					pMap = new TreeMap<Integer, Integer>(new Comparator<Integer>() {

						@Override
						public int compare(Integer o1, Integer o2) {
							return o2.compareTo(o1);
						}
					});
					sMap.put(s, pMapList.size());
					pMapList.add(pMap);
				}
				pMap.put(p, i);
			}

			for (Map.Entry<String, Integer> sEnt : sMap.entrySet()) {
				for (Map.Entry<Integer, Integer> pEnt : pMapList.get(sEnt.getValue()).entrySet()) {
					System.out.println(pEnt.getValue());
				}
			}
		} catch (Exception e) {
		}
	}
}


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

int main() {
    int x;
    cin>>x;
    char ans = '0';
    if(400<=x && 599>=x)ans='8';
    if(600<=x && 799>=x)ans='7';
    if(800<=x && 999>=x)ans='6';
    if(1000<=x && 1199>=x)ans='5';
    if(1200<=x && 1399>=x)ans='4';
    if(1400<=x && 1599>=x)ans='3';
    if(1600<=x && 1799>=x)ans='2';
    if(1800<=x && 1999>=x)ans='1';
    cout<<ans<<endl;
    
    return 0;
}

Measured memory_bytes: 3620
<?php
$num=trim(fgets(STDIN));
$takoyaki=explode(" ",trim(fgets(STDIN)));
$recovery=0;

for($i=0;$i<$num;$i++){
    for($j=$i+1;$j<$num;$j++){
     $recovery+=$takoyaki[$i]*$takoyaki[$j];
    }
}

echo $recovery;
?>

Measured memory_bytes: 4728
#include <bits/stdc++.h>
using namespace std;
#define ll                      long long int
#define pb                      push_back
#define rep(i,a,b,c)            for(ll i=(a);i<=(b);i+=(c))
#define repb(i,a,b,c)           for(ll i=(a);i>=(b);i-=(c))
#define MOD                     1000000007
#define inf                     1e18
#define ld                      long double
#define mp                      make_pair
#define vpll                    vector<pair<ll,ll>>
#define vll                     vector<ll>
#define vld                     vector<ld>
#define vvll                    vector<vector<ll>>
#define vvld                    vector<vector<ld>>
#define pll                     pair<ll,ll>
#define vvpll                   vector<vector<pair<ll,ll>>>
#define pqll                    priority_queue<ll>
#define mll                     map<ll,ll>
#define mlc                     map<ll,char>
#define um                      unordered_map
#define umll                    um<ll,ll>
#define umlc                    um<ll,char>
#define all(x)                  x.begin(),x.end()
#define fi                      first
#define se                      second
#define ln                      cout<<"\n";
#define endl                    "\n"
#define test                    ll T;cin>>T;while(T--)
#define isvowel(a)              (a == 'a' || a == 'e' || a == 'i' || a == 'o' || a == 'u')
#define fastIO                  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define show(w,size)            for(ll i=0;i<size;i++) cout<<w[i]<<" ";
#define print(a)                cout<<a<<"\n";
#define mset(dp,no)             memset(dp,no,sizeof(dp))
#define input(a,n)              rep(i,0,n-1,1) cin>>a[i];
#define countbit                __builtin_popcount                                           //Number of setbits in decimal notation
#define lb(v,val)               lower_bound(all(v),val)-v.begin()
#define ub(v,val)               upper_bound(all(v),val)-v.begin()
#define SS                      stringstream
#define db(...)                 __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) { cerr << name << " : " << arg1 <<'\n'; }
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
    const char* comma = strchr(names + 1, ',');
    cerr.write(names, comma - names) << " : " << arg1 << " | "; __f(comma + 1, args...);
}


using namespace std;
int main()
{
	fastIO
	string s;
	ll k,ans=0,ans1=0;
	cin>>s>>k;
	string temp=s;
	rep(i,1,s.size()-1,1)
	if(s[i]==s[i-1])
	{
	ans++;
	s[i]='1';
	}
	ans*=k;
	if(s[(int)s.size()-1]==s[0])
	ans+=k-1;
	s=temp;
	repb(i,(ll)s.size()-2,0,1)
	if(s[i]==s[i+1])
	{s[i]='1';
	ans1++;}
	ans1*=k;
	if(s[(int)s.size()-1]==s[0])
	ans1+=k-1;
//	db(ans1);	
	if(s.size()&1)
	{
		//db("here");
		char ch=temp[0];
		rep(i,1,(ll)s.size()-1,1)
		if(temp[i]!=ch)
		{
	//	db(s[i]);	
		goto x;
		}
		ans=k/2*s.size();
		if(k&1)
		ans+=s.size()/2;
		//db(ans);
		cout<<ans;
		return 0;
	}
	x:
	cout<<min(ans,ans1);
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
int compare_int(const void *a, const void *b){
    return *(int*)b - *(int*)a;
}
void sort(int *v,int size)
{
  int i,j,temp;
  for(i=0;i<size;i++)	{
    for(j=0;j<size-1 ;j++)	{
      if(v[j] < v[j+1])	{
        temp = v[j];
        v[j] = v[j+1];
        v[j+1] = temp;
      }
    }
  }
}
 
//sort関数は正確であることは確認済み//
int main (void)
{
  int n,m;
  scanf("%d %d",&n,&m);
  int x[m];
  int i;
  for (i = 0; i < m; i++)	{
    scanf("%d",&x[i]);
  }
  //ここまで入力//
  if(n >= m)	printf("0");
  else	{
    qsort(x,m,sizeof(int),compare_int);
    //差分をgapに格納し，sortする．//
    int gap[m-1];
    for (i=0;i < m-1; i++)	{
      if (x[i+1] > x[i])  gap[i] = x[i+1] - x[i];
      else gap[i] = x[i] - x[i+1];
    }
    qsort(gap,m-1,sizeof(int),compare_int);
    int ans = 0;
    for (i = 0; i < m-n; i++) {
      ans = ans + gap[m-2-i];
    }
    printf("%d",ans);
  }
}

Measured memory_bytes: 1268
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define countof(array) (sizeof(array) / sizeof(array[0]))
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = (n)-1; i >= 0; --i)
#define rep2(i,n) for(int i = 1; i <= (n); ++i)
#define rrep2(i,n) for(int i = (n); i > 0; --i)
#define srep(i,s,n) for(int i = s; i < (n); ++i)
#define rsrep(i,s,n) for(int i = (n)-1; i >= s; --i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define aall(a) (a), (a)+countof(a)//for array sorting
#define raall(a) (a), (a)+countof(a), greater<>()
#define show(x) cout<<#x<<" = "<<(x)<<endl;
#define vfind(v, a) find(all(v), a) != v.end()
#define yn(f) { if (f) puts("YES"); else puts("NO"); }
#define yns(f) { if (f) puts("Yes"); else puts("No"); }
#define show_ary(...) { cout<<#__VA_ARGS__<<" = "; for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define show_pair(...) cout<<#__VA_ARGS__<<" = "<<endl; for (const auto& x : (__VA_ARGS__)) { cout<<"  "<<x.fi<<" : "<<x.se<<endl; }
#define out_ary(...) { int n = (__VA_ARGS__).size(); rep(i, n) printf("%d%s", (__VA_ARGS__)[i], i != n-1 ? " " : "\n"); }
#define argmax(v) distance((v).begin(), max_element(all(v)))
#define argmin(v) distance((v).begin(), min_element(all(v)))
#define vmax(v) *max_element(all(v))
#define vmin(v) *min_element(all(v))
typedef long long int ll;
typedef pair<int, int> P;
typedef vector<P> vpair;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<double> vdouble;
typedef vector<string> vstr;
typedef vector<bool> vbool;
typedef vector<vint> vvint;
typedef vector<vll> vvll;
typedef vector<vstr> vvstr;
typedef vector<vbool> vvbool;
const ll LINF = 2000000000000000000ll;
const int INF = 1000000100;
const ll MOD = 1e9+7;


int main() {
    string s;
    cin >> s;
    if (s == "ABC") puts("ARC");
    else puts("ABC");
    return 0;
}

Measured memory_bytes: 3628
import re

N = int(input())
H = list(map(int, input().split()))
X = []

if N == 1:
    print('0')
else:
    for n in range(N-1):
        if H[n] >= H[n+1]:
            X.append('T')
        else:
            X.append('F')

    XX = ''.join(X)

    if XX.find('T') == -1:
        print('0')
    else:
        T = re.findall('T*T', XX)

        Y=[]
        for y in T:
            Y.append(len(y))

        print(max(Y))

Measured memory_bytes: 14536
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define endl "\n"

int main()
{
  i64 N, M;
  cin >> N >> M;
  vector<i64> edge[N];
  for (i64 i = 0; i < M; i++)
  {
    i64 A, B;
    cin >> A >> B;
    A--;
    B--;
    edge[A].push_back(B);
    edge[B].push_back(A);
  }
  vector<i64> far(N, 1e9), ans(N);
  queue<i64> que;
  far[0] = 0;
  que.push(0);
  while (que.size())
  {
    i64 p = que.front();
    que.pop();
    for (i64 i : edge[p])
      if (far[p] + 1 < far[i])
      {
        far[i] = far[p] + 1;
        ans[i] = p;
        que.push(i);
      }
  }
  bool ok = true;
  for (i64 i = 0; i < N; i++)
    if (far[i] == 1e9)
      ok = false;
  if (!ok)
  {
    cout << "No" << endl;
    return 0;
  }
  cout << "Yes" << endl;
  for (i64 i = 1; i < N; i++)
    cout << ans[i] + 1 << endl;
  return 0;
}


Measured memory_bytes: 13660
#pragma region noncode
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr ll INF = 1'010'000'000'000'000'017LL;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#pragma endregion

int main() {
    ll x;
    cin >> x;
    ll cnt = 0;
    ll n = 100;
    while(x > n) {
        n += n / 100;
        cnt++;
    }
    cout << cnt << endl;
}


Measured memory_bytes: 3636
import java.util.Scanner;

class Main{

    static boolean isPrime(int n){
        if(n == 2){
            return true;
        }else if(n < 2 || n % 2 == 0){
            return false;
        }else{
            int x = 3;
            while(x <= Math.sqrt((double)n)){
                if(n%x == 0)    return false;
                x += 2;
            }
            return true;
        }
    }
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

        int n = Integer.parseInt(sc.next());
        int result = 0;

        for(int i = 0; i < n; i++){
            if(isPrime(Integer.parseInt(sc.next()))) result++;
        }

        System.out.println(result);
    }
}


Measured memory_bytes: 40460
#include <iostream>
#include <queue>
#include <algorithm>
#include <utility>
#include <cmath>
#include <map>

using namespace std;


int main(void) {
    int N, C;
    vector<pair<int, int>> events;
    vector<pair<int, pair<int, int>>> program;
    cin >> N >> C;
    for (int i = 0; i < N; i++) {
        int s, t, c;
        cin >> s >> t >> c;
        program.push_back(make_pair(c, make_pair(s, t)));
    }
    sort(program.begin(), program.end());
    for (int i = 0; i < program.size() - 1; i++) {
        if (program[i].first == program[i + 1].first && program[i].second.second == program[i + 1].second.first) {
            program[i + 1].second.first = program[i].second.first;
            program[i].first = -1;
            //program.erase(program.begin()+i+1);
        }
    }
    for (auto &e:program) {
        if (e.first != -1) {
            events.push_back(make_pair(e.second.first, 1));
            events.push_back(make_pair(e.second.second + 1, -1));
        }
    }
    sort(events.begin(), events.end());
    int current = 0;
    int max_r = 0;
    int i = 0;
    while (i < events.size()) {
        int time = events[i].first;
        current += events[i].second;
        i++;
        while (i < events.size() && events[i].first == time) {
            current += events[i].second;
            i++;
        }
        max_r = max(max_r, current);
    }
    cout << max_r << endl;
}

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

//#define int int64_t

#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0,a1,a2,a3,x,...) x
#define REP1(i, s, cond, cal) for (signed i = signed(s); i cond; i cal)
#define REP2(i, s, n) REP1(i, s, < signed(n), ++)
#define REP3(i, n) REP2(i, 0, n)
#define rep(...) CHOOSE((__VA_ARGS__,REP1,REP2,REP3))(__VA_ARGS__)

#define all(c) begin(c), end(c)
#define maxup(ans, x) (ans = (ans < x ? x : ans))
#define minup(ans, x) (ans = (ans > x ? x : ans))

#define breakif(cond) if(cond) break; else

template<typename T>
inline void input(vector<T>& v) { for (auto& x : v) cin >> x; }

using VV = vector<vector<int>>;
using V = vector<int>;
using P = pair<int, int>;
using IP = pair<int, P>;

const int INF = 1 << 29;

signed main() {
	int n, l; cin >> n >> l;
	vector<string> v(n);
	input(v);
	sort(all(v));
	rep(i, n) {
		cout << v[i];
	}
	cout << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<n;++i)
typedef long long ll;
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}

int main(){
   ll n;
   cin >> n;
   ll sum = (n)*(n-1)/2;
   cout << sum << endl;


   return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <cstdint>

using namespace std;

#define BIT(v, digit) ((v >> digit) & 1)

int main() {
  int n;
  int64_t k;
  cin >> n >> k;
  vector<int64_t> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];

  vector<vector<int64_t>> dp(60, vector<int64_t>(2, -1));

  dp[45][0] = 0;
  for (int i = 44; i >= 0; i--) {
    int onecnt = 0;
    for (auto x : a) {
      if (BIT(x, i)) ++onecnt;
    }
    int64_t d = 1LL << i;
    // smaller => smaller
    if (dp[i+1][1] > -1)
      dp[i][1] = max(dp[i][1], dp[i+1][1] + d*max(onecnt, n-onecnt));
    if (dp[i+1][0] > -1) {
      if (BIT(k, i)) {
        // not smaller => smaller
        dp[i][1] = max(dp[i][1], dp[i+1][0] + d*onecnt);
        // not smaller => not smaller
        dp[i][0] = max(dp[i][0], dp[i+1][0] + d*(n-onecnt));
      } else {
        // not smaller => not smaller
        dp[i][0] = max(dp[i][0], dp[i+1][0] + d*onecnt);
      }
    }
  }
  cout << max(dp[0][0], dp[0][1]) << endl;
  return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
#include <iostream>
using namespace std;
void digits(long n, int base) 
{ 
    int dig = (int)(floor( log(n) /  log(base)) + 1);
    cout << dig; 
} 
int main()
{
    long long int r,k;
    cin >> r >> k;
    digits(r,k);
    return 0;
}


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

int main(){
		int n,m,a;
		while(cin >> n >> m >> a and !(n==0 && m==0 && a==0)){
				vector<vector<int> > ami(1005);

				for(int i=0;i<m;i++){
						int h,p,q;
						cin >> h >> p >> q;
						h--, p--, q--;
						ami[h].push_back(p);
				}
				int point = a-1;
				for(int i=1004;i>=0;i--){
						for(int j=0;j<ami[i].size();j++){
								if(point==ami[i][j]){
										point = point + 1;
								}else if(point-1==ami[i][j]){
										point = point - 1;
								}
						}
				}
				cout << point+1 << endl;
		}
}


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

typedef long long int ll;
typedef pair<ll, ll> pll;

#define FOR(i, n, m) for (ll(i) = (m); (i) < (n); ++(i))
#define REP(i, n) FOR(i, n, 0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll)1e15;

int main()
{
    ll S[3];
    ll odd = 0;
    REP(i, 3)
    {
        cin >> S[i];
        if (S[i] % 2 == 1)
            odd++;
    }
    REP(i, 3)
    {
        if (odd == 1)
        {
            if (S[i] % 2 == 0)
                S[i]++;
        }
        else if (odd == 2)
        {
            if (S[i] % 2 == 1)
                S[i]++;
        }
    }
    sort(S, S + 3);
    ll ans = 0;
    if (odd == 1 || odd == 2)
        ans++;
    ans += (S[2] - S[1]) / 2 + (S[2] - S[0]) / 2;

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

Measured memory_bytes: 256
#include<stdio.h>
#include<cstring>
#include<algorithm>
using namespace std;
#define N 305

int n,m,i,j,l,r,mid,Max,ans;
int a[N][N],num[N],pos[N];
bool vis[N];

void get(){Max=0;
	for(int i=1;i<=m;i++)
		if(num[i]>num[Max])Max=i;
}
bool check1(int x){
	memset(num,0,sizeof(num));
	memset(vis,0,sizeof(vis));
	for(int i=1;i<=n;i++)num[a[i][1]]++,pos[i]=1;
	while(get(),num[Max]>x){
		num[Max]=0;vis[Max]=1;
		for(int i=1;i<=n;i++)
			if(a[i][pos[i]]==Max){
				while(vis[a[i][pos[i]]]&&pos[i]<=m)pos[i]++;
				if(pos[i]>m)return 0;
				num[a[i][pos[i]]]++;
			}
	}return 1;
}
int main()
{
	scanf("%d%d",&n,&m);
	for(i=1;i<=n;i++)
	for(j=1;j<=m;j++)
		scanf("%d",&a[i][j]);
	l=1,r=n;
	while(l<=r){
		mid=(l+r)>>1;
		if(check1(mid))ans=mid,r=mid-1;
			else l=mid+1;
	}printf("%d\n",ans);
	return 0;
}

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

using namespace std;

#ifdef WIN32
	#define I64 "%I64d"
#else
	#define I64 "%lld"
#endif

typedef long long ll;

#define f first
#define s second
#define mp make_pair
#define pb push_back
#define all(s) s.begin(), s.end()
#define sz(s) (int(s.size()))
#define fname "a"
#define k 100


int main()
{
	#ifdef LOCAL
	freopen(fname".in", "r", stdin);
	freopen(fname".out", "w", stdout);
	#endif

	int a, b, c, d, e, f;
	int answ = -1, anst = -1;
	cin >> a >> b >> c >> d >> e >> f;
	for (int i = 0; i <= k; ++i)
		for (int j = 0; j <= k; ++j)
			for (int x = 0; x <= k; ++x)
				for (int y = 0; y <= k; ++y) {
					if (!i && !j && !x && !y) continue; 
					int t = x * c + y * d;
					if (i * 100 * a + j * 100 * b + x * c + y * d <= f && 100 * t <= e * (i * 100 * a + j * 100 * b)) {
						int w = i * 100 * a + j * 100 * b + x * c + y * d;
						if (answ == -1 || 1LL * t * answ > 1LL * anst * w) {
							anst = t;
							answ = w;
						}
					}
				}
	printf("%d %d\n", answ, anst);

	return 0;
}


Measured memory_bytes: 256
#include <bits//stdc++.h>
using namespace std;
#define int long long
#define rep(i,n,k) for(int i=n;i<k;i++)
#define P make_pair
#define F first
#define S second
#define M LLONG_MAX
signed main(void){
    int n,m,ans,p,q;
    ans=0;
    string s1,s2;
    vector<int> v;
    cin>>n;
    rep(i,0,1000){
        rep(j,0,1000){
            p=1;
            q=1;
            rep(k,0,5){
                p=p*i;
                q=q*j;
            }
            if(p+q==n){
                cout<<i<<" "<<-j<<endl;
                return 0;
            }
        }
    }
     rep(i,0,1000){
        rep(j,i,1000){
            p=1;
            q=1;
            rep(k,0,5){
                p=p*i;
                q=q*j;
            }
            if(q-p==n){
                cout<<j<<" "<<i<<endl;
                return 0;
            }
        }
    }
    
    
    
}


Measured memory_bytes: 3612
#include <stdio.h>

int main(void){
	int a,b;
	a = 0;
	b = 0;
	
	scanf("%d%d",&a,&b);
	
	if(a % 3 == 0) printf("Possible\n");
	else if(b % 3 == 0) printf("Possible\n");
	else if((a + b) % 3 == 0) printf("Possible\n");
	else printf("Impossible\n");
}

Measured memory_bytes: 128
#include<bits/stdc++.h> 
using namespace std;
 
#define ll long long int
#define absdiff(a,b) (a>b)?a-b:b-a
#define debug cout<<"debug";
#define mp make_pair 
#define pb push_back
#define ff first
#define ss second
#define fast  ios_base::sync_with_stdio(false);cin.tie(0);
#define MOD 1000000007
#define ll_MAX 19223372036859
#define endl "\n"
ll fast_expo(ll x,ll p){if(p==0) return 1;
else if(p%2==0){ ll t=fast_expo(x,p/2)%MOD;return (t*t)%MOD;} else return (x*(fast_expo(x,p-1))%MOD)%MOD;}
ll gcd(ll a,ll b){if(a==0||b==0) return a+b;  else return gcd(b%a,a); }


int main()
{
    ll t;t=1;
    // cin>>t;
    for(ll x=0;x<t;++x){
        ll a,b,c;cin>>a>>b>>c;
        if(a+b+c>=22) cout<<"bust";
        else cout<<"win";
    }
    return 0;
}

Measured memory_bytes: 256
N = int(input())

if N >= 1800:
    print('1')
elif N >= 1600:
    print('2')
elif N >= 1400:
    print('3')
elif N >= 1200:
    print('4')
elif N >= 1000:
    print('5')
elif N >= 800:
    print('6')
elif N >= 600:
    print('7')
elif N >= 400:
    print('8')

Measured memory_bytes: 9176
#include <stdio.h>

int main(void){
	int i,N,a,b,c;
	scanf("%d\n", &N);
	for(i = 0; i < N; i++){
		scanf("%d %d %d", &a, &b, &c);
		if((a*a == b*b + c*c) || (b*b == c*c + a*a) || (c*c == a*a + b*b)){
			printf("YES\n");
		}else{
			printf("NO\n");
		}
	}
	
	return 0;
}

Measured memory_bytes: 576
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cstdlib>
#include<cstdio>
#include<cmath>
using namespace std;

void add(int a,int b,int c,int d)
{
	if(a + b + c + d == 7) cout<<a<<"+"<<b<<"+"<<c<<"+"<<d<<"=7"<<endl;

	else if(a + b + c - d == 7) cout<<a<<"+"<<b<<"+"<<c<<"-"<<d<<"=7"<<endl;
	else if(a + b - c + d == 7) cout<<a<<"+"<<b<<"-"<<c<<"+"<<d<<"=7"<<endl;

	else if(a + b - c - d == 7) cout<<a<<"+"<<b<<"-"<<c<<"-"<<d<<"=7"<<endl;

	else if(a - b + c + d == 7) cout<<a<<"-"<<b<<"+"<<c<<"+"<<d<<"=7"<<endl;

	else if(a - b + c - d == 7) cout<<a<<"-"<<b<<"+"<<c<<"-"<<d<<"=7"<<endl;

	else if(a - b - c + d == 7)cout<<a<<"-"<<b<<"-"<<c<<"+"<<d<<"=7"<<endl;
}

int main(){
	int n;
	cin>>n;
	int a[5];
	for(int i = 1;i <= 4;i++)
	{
		if(n % 10 == 0) 
		{
			a[i] = 0;
			n = n / 10;
		}
		else 
		{
			a[i] = n % 10;
			n = n / 10;
		}
//		cout<<a[i]<<endl;
	}
//	cout<<a[1]<<a[2]<<a[3]<<a[4];
	add(a[4],a[3],a[2],a[1]);
	return 0;
}

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

using namespace std;

int main() {
	int a, b, c, d, e, k;
	cin >> a >> b >> c >> d >> e >> k;
	if (e-a<=k) {
		cout << "Yay!";
	}
	else {
		cout << ":(";
	}

}

Measured memory_bytes: 3640
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
#define ll long long
#define gmax(x,y) x=max(x,y)
#define gmin(x,y) x=min(x,y)
#define F first
#define S second
#define P pair
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define rep(i,a,b) for(int i=a;i<b;i++)
#define V vector
#define RE return
#define ALL(a) a.begin(),a.end()
#define MP make_pair
#define PB emplace_back
#define PF emplace_front
#define FILL(a,b) memset(a,b,sizeof(a))
#define lwb lower_bound
#define upb upper_bound
using namespace std;
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	while(1){
		c-=b;
		if(c<=0){
			cout<<"Yes";RE 0;
		}
		a-=d;
		if(a<=0){
			cout<<"No";RE 0;
		}
	}
	RE 0;
}




Measured memory_bytes: 3640
#include <cmath>
#include <cstdio>
#include <cstring>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;

#define MAXN 100111

bool solve(int ans[], int a[], int n)
{
	for(int i=2; i<=n+1; ++i)
	{
		if(ans[i-1] == 1)
			ans[i] = a[i-1] ? ans[i-2] : 1-ans[i-2];
		else
			ans[i] = (1-a[i-1]) ? ans[i-2] : 1-ans[i-2];
	}

	return ans[0] == ans[n] && ans[1] == ans[n+1];
}

int main()
{
	ios::sync_with_stdio(false);

	int n;
	cin >> n;
	string s;
	cin >> s;
	int a[MAXN];
	for(int i=0; i<n; ++i)
		a[i] = s[i] == 'o' ? 1 : 0;
	a[n] = a[0];
	a[n+1] = a[1];

	int ans[MAXN];
	for(int i=0; i<4; ++i)
	{
		ans[0] = i/2;
		ans[1] = i%2;
		if(solve(ans, a, n))
		{
			for(int j=0; j<n; ++j)
				cout << (ans[j] ? 'S' : 'W');
			cout << "\n";
			return 0;
		}
	}

	cout << "-1\n";
	return 0;
}


Measured memory_bytes: 1360
c=[]
for i in range(3):
    c.append(list(map(int,input().split())))
#aを消去
flag=True
for i in range(3):
    flag = flag and (c[0][i]-c[0][i-1]==c[1][i]-c[1][i-1] == c[2][i]-c[2][i-1])
    flag = flag and (c[i][0]-c[i-1][0]==c[i][1]-c[i-1][1] == c[i][2]-c[i-1][2])
    if not flag:
        break
print("Yes" if flag else "No")

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
 
long long mod = 998244353;
long long A,B,C,D;
long long dp[3030][3030];
 
int main(){
  cin >> A >> B >> C >> D;
  dp[A][B] = 1;
  for (long long i = A; i <= C; i++){
    for (long long j = B; j <= D; j++){
      if ((i > A)||(j > B)){
        dp[i][j]=
          (i * dp[i][j-1] % mod
          + j * dp[i-1][j] % mod
          - (i - 1) * (j - 1) * dp[i-1][j-1] % mod + mod) % mod;
      }
    }
  }
  cout << dp[C][D];
}

Measured memory_bytes: 74540
main = do
  li <- getLine
  let n = read li
  li <- getLine
  let bs = map read $ words li
  let ans = compute n bs
  print ans

-- aiはmin b(i-1) bi以下なので、その総和をとる

compute :: Int -> [Int] -> Int
compute _ bs = sum $ zipWith min bs1 (tail bs1)
  where
    bs1 = head bs : bs ++ [last bs]

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

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

n = inn()
a = []
b = []
xb = 10**9+1
for i in range(n):
    aa,bb = inm()
    a.append(aa)
    b.append(bb)
    if aa>bb and xb>bb:
        xb = bb
        xi = i
if n==-2 and a[0]==1:
    3/0
print(0 if xb>10**9 else sum(a)-b[xi])


Measured memory_bytes: 79100
using System;
using System.Collections.Generic;
using System.Linq;
using System.Diagnostics;

class Program
{
    static void Main(string[] args)
    {
        string[] cin = Console.ReadLine().Split();
        int n = int.Parse(cin[0]);
        int m = int.Parse(cin[1]);
        Console.WriteLine((1900 * m + 100 * (n - m)) * Math.Pow(2, m));
    }
}

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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;

#define MOD 1000000007
#define REP(i, N) for (int i = 0; i < N; ++i)
#define REP1(i, N) for (int i = 1; i <= N; ++i)
#define RREP(i, N) for (int i = N - 1; i >= 0; --i)
#define ALL(a) a.begin(), a.end()

int main() {
  int a, b;
  cin >> a >> b;
  cout << max(max(2 * a - 1, 2 * b - 1), a + b) << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<int(n);++i)
#define rep1(i,n) for(int i=1;i<=int(n);++i)
#define all(a) a.begin(),a.end()
#define lb(s,x) lower_bound(all(s),x)-s.begin()
#define debug(x) cout<<#x<<": "<<x<<endl
#define INF 1e9
typedef long long ll;

int a[301][301];

ll dist(pair<int,int> p, pair<int,int> q){
    return abs(p.first-q.first)+abs(p.second-q.second);
}

int main(void){
    int h,w,d,q;
    cin>>h>>w>>d;
    int n = h*w+1;
    vector<pair<int,int>> pos(n);
    rep(y,h)rep(x,w){
        cin>>a[y][x];
        pos[a[y][x]] = {y,x};
    }

    vector<ll> cost(n);
    rep(i,n){
        if(i+d > h*w) continue;
        cost[i+d] = cost[i] + dist(pos[i],pos[i+d]);
    }

    cin>>q;
    rep(_,q){
        int l,r;
        cin>>l>>r;
        cout<<cost[r]-cost[l]<<endl;
    }
    return 0;
}


Measured memory_bytes: 2944
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <utility>
#include <iostream>
#include <algorithm>
#include <functional>

using namespace std;

#define INF (1 << 30)
#define INFL (1LL << 62)
#define MOD7 1000000007
#define MOD9 1000000009
#define EPS 1e-10

#define ll long long
#define ull unsigned long long
#define all(a) (a).begin(), (a).end()

int main() {
	int a, b;
	cin >> a >> b;
	cout << a * b << " " << 2 * (a + b) << endl;

	return 0;
}


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

int main()
{
  int i, n, buff, max, min;
  double result;
  
  scanf("%d", &n);
  
  while (1) {
    if (n == 0)
      break;
    
    result = 0;
    max = 0;
    min = 1000;
    
    for (i = 1; i <= n; i++) {
      scanf("%d", &buff);
      result += buff;
      
      if (buff > max)
	max = buff;
      if (buff < min)
	min = buff;
    }
    
    result = (result - max - min) / (n - 2);
    printf("%d\n", (int)floor(result));
    
    scanf("%d", &n);
  }

  return 0;
}

Measured memory_bytes: 0
N, K = map(int, input().split())

X, Y = [], []
for i in range(N):
    x, y = map(int, input().split())
    X.append(x)
    Y.append(y)

ans = float('INF')

for left in range(N):
    for right in range(N):
        for top in range(N):
            for bottom in range(N):
                if X[right]-X[left] <= 0:
                    continue
                if Y[top]-Y[bottom] <= 0:
                    continue
                cnt = 0
                for i in range(N):
                    if X[left] <= X[i] <= X[right] and Y[bottom] <= Y[i] <= Y[top]:
                        cnt += 1
                if cnt >= K:
                    ans = min(ans, (X[right]-X[left])*(Y[top]-Y[bottom]))

print(ans)


Measured memory_bytes: 51040
#include<cstdio>
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>

using namespace std;

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

#define INF 1000000000

int main(){
	int n,T;
	cin>>n>>T;
	
	int trr[110000]={0};
	rep(i,n)cin>>trr[i];
	int ans=0;
	
	int sum=T-trr[0];
	for(int i=1;i<=n;i++){
		if(trr[i-1]>trr[i]||i==n){
			ans = max(ans,sum);
			sum=T-trr[i];
		}else{
			sum+=T-trr[i];
		}
	}
	
	sum=T-trr[0];
	for(int i=1;i<=n;i++){
		if(trr[i-1]<trr[i] || i==n){
			ans = max(ans,sum);
			sum=T-trr[i];
		}else{
			sum+=T-trr[i];
		}
	}
	
	printf("%d\n",ans);
}

Measured memory_bytes: 1260
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
const int mod = 1e9+7;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;
int main(){
    cout << fixed << setprecision(10);
    while(1){
        int m,n_min,n_max;
        cin >> m >> n_min >> n_max;
        if(m == 0 && n_min == 0 && n_max == 0) break;
        vector<int> v(m);
        rep(i,m){
            cin >> v[i];
        }
        sort(v.begin(),v.end());
        int ans;
        int now = 0;
        for(int i =  n_min; i <= n_max;i++){
            if( now <= abs(v[m - i] - v[m - i -1])){
                now = abs(v[m - i] - v[m - i -1]);
                ans = i;
            }
        }
        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 3128
#include <bits/stdc++.h>
#define lli long long int
#define pb push_back
#define mod 1000000007
#pragma GCC optimize ("-O3")
#define mod2 998244353
#define MAXN 1000000000
#define v32 vector<int>
#define v64 vector<lli>
#define v1024 vector <vector <int>>
#define v4096 vector <vector <lli>>
#define vt vector
#define f(x, y, z) for (lli x = y; x < z; x++)
#define fd(x, y, z) for (lli x = y; x > z; x--)
#define lb lower_bound
#define ld long double
#define m64 map<lli,lli>
#define m32 map<int,int>
#define m64it map<lli,lli>::iterator
#define m32it map<int,int>::iterator
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define ist insert
#define endl "\n"
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
#define p_q priority_queue 
#define min_p_q priority_queue <int,vt <int>,greater <int>>
using namespace std;
using namespace __gnu_pbds; 
template <typename T> 
void DEBUG_ARR(vt<T> a,char c)
{
	f(i,0,a.size())cout<<a[i]<<c;
	cout<<"\n";
}

lli tmod(lli x,lli m){return (x%m+m)%m;}//USE AT YOUR OWN RISK
lli power(lli x, lli y) 
{
    lli res = 1;  
   
    while (y > 0) 
    { 
        if (y & 1) 
            res = (res*x)%mod; 
        y = y>>1; 
        x = (x*x)%mod;  
    }
    if(res<0)
       res+=mod; 
    return res; 
}


// lli fact[2000009];
// lli ncr(lli n,lli r){
//     lli ans=fact[n];
//     if(r>n)return 0;
//     ans=(ans*power(fact[n-r],mod-2))%mod;
//     ans=(ans*power(fact[r],mod-2))%mod;
//     return ans;
// }

int main() 
{ 
    fastio;
    // fact[0]=1;
    // f(i,1,2000009)fact[i]=(fact[i-1]*i)%mod;
    int t;
    // cin>>t;
    t=1;
    // int temp=t;
    while(t--){
      int n,m;
      cin>>n>>m;
      cout<<(n*(n-1))/2+(m*(m-1))/2<<"\n";
      
    }

    return 0; 	
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const long long INF = 1LL<<60;

ll GCD(ll x,ll y){
    if(y == 0) return x;
    else return GCD(y,x%y);
}

ll LCM(ll a,ll b){
    return a / GCD(a,b) * b;
}

const int MOD = 1000000007;



int main() {
    ll a,b,k; cin >> a >> b >> k;
    ll ans1 = min(a,k);
    a -= ans1;
    k -= ans1;
    b -= min(b,k);
    cout << a << " " << b;
}


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

int main() {
	int a,b;
  	cin >> a >> b;
  
  	int sum = 0;
  	sum += max(a,b);
  
  	if (a < b) {
    	b--;
    }else {
        a--;
    }
  
  	sum += max(a,b);
  
  	cout << sum << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int N = 5e5 + 10, inf = 1e8;
int b[N], a[N], n, k, fen[N], val, seg[N << 2], lazy[N << 2], ans[N];
// fen
void add(int p) {
	for (p++; p <= n; p += p & -p)
		fen[p]++;
}
int getPref(int p) {
	int rtr = 0;
	for (; p > 0; p -= p & -p)
		rtr += fen[p];
	return rtr;
}
int get(int l, int r) {
	return getPref(r) - getPref(l);
}
// fen

// seg
void relax(int id) {
	int lc = id * 2, rc = lc + 1;
	seg[lc] += lazy[id], seg[rc] += lazy[id];
	lazy[lc] += lazy[id], lazy[rc] += lazy[id];
	lazy[id] = 0;
}
void addseg(int l, int r, int id = 1, int s = 0, int e = n) {
	if (e <= l || r <= s)
		return;
	if (l <= s && e <= r) {
		seg[id] += val;
		lazy[id] += val;
		return;
	}
	int mid = (s + e) / 2, lc = id * 2, rc = lc + 1;
	relax(id);
	addseg(l, r, lc, s, mid);
	addseg(l, r, rc, mid, e);
	seg[id] = min(seg[lc], seg[rc]);
}
int getseg(int id = 1, int s = 0, int e = n) {
	if (e - s == 1) 
		return s;
	relax(id);
	int mid = (s + e) / 2, lc = id * 2, rc = lc + 1;
	if (seg[rc] == 0)
		return getseg(rc, mid, e);
	return getseg(lc, s, mid);
}
// seg

// main
int main() {
	// input
	ios_base::sync_with_stdio (false), cin.tie(0), cout.tie(0);
	cin >> n >> k;
	for (int i = 0; i < n; i++) 
		cin >> b[i], b[i]--;
	for (int i = 0; i < n; i++)
		a[b[i]] = i;
	// input

	// getDegree
	for (int i = n - 1; i >= 0; i--) {
		val = get(max(0, a[i] - k + 1), min(n, a[i] + k));
		addseg(a[i], a[i] + 1);
		add(a[i]);
	}
	// getDegree

	// get most right ziro
	for (int i = 0; i < n; i++) {
		int plc = getseg();
		ans[plc] = n - i - 1;
		val = -1;
		addseg(max(0, plc - k + 1), min(n, plc + k));
		val = inf;
		addseg(plc, plc + 1);
	}
	// getmost right ziro

	//outout
	for (int i = 0; i < n; i++) 
		cout << ans[i] + 1 << "\n";
	//output

	return 0;
}
// main


Measured memory_bytes: 22912
#include <bits/stdc++.h>
using namespace std;
using P = pair<int, int>;

P concentration_max(P p1, P p2) {
  return ((p2.first + p2.second) * p1.second < (p1.first + p1.second) * p2.second) ? p2 : p1;
}

main() {
  int A, B, C, D, E, F;
  cin >> A >> B >> C >> D >> E >> F;

  vector<bool> w(F + 1, false), s(F + 1, false);
  for (int i = 0; i <= F; i++) {
    for (int j = 0; j <= F; j++) {
      int x = 100 * A * i + 100 * B * j;
      int y = C * i + D * j;
      if (x <= F) w[x] = true;
      if (y <= F) s[y] = true;
    }
  }

  const P bound{100, E};
  P ans{100 * A, 0};
  for (int i = 1; i <= F; i++) {
    for (int j = 0; j <= F; j++) {
      if (w[i] && s[j] && i + j <= F && concentration_max(bound, {i, j}).second == E) {
        ans = concentration_max(ans, {i, j});
      }
    }
  }
  cout << (ans.first + ans.second) << ' ' << ans.second << endl;
}


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

namespace agc002_a
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] x = Console.ReadLine().Split().Select(int.Parse).ToArray();
            if (x[0] <= 0 && 0 <= x[1])
            {
                Console.WriteLine("Zero");
            }
            else if (0 < x[0])
            {
                Console.WriteLine("Positive");
            }
            else
            {
                int minus = 0;
                if (minus > x[1])
                {
                    minus = x[1];
                }
                Console.WriteLine((minus - x[0]) % 2 == 0 ? "Negative" : "Positive");
            }
        }
    }
}

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

using namespace std;

#define INP "solve"
#define OUT "solve"

const int QQ = 3e5 + 10;
const int maxN = 3e5 + 100;
const int maxM = 3e5 + 10;
const long long oo = 1e15;
const int module = 1e9 + 7;
const long double du = 1e-9;

void doc() {
    freopen(INP ".inp","r",stdin);
    freopen(OUT ".out","w",stdout);
}
struct mt {
    int c[52][52];
    mt() {
        memset(c, 0, sizeof(c));
    }
};
int n;
mt nhan(mt a, mt b) {
    mt c;
    for (int k = 0; k < n; k++) {
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                int Val = 1LL * a.c[i][k] * b.c[k][j] % module;
                c.c[i][j] = (c.c[i][j] + Val) % module;
            }
        }
    }
    return c;
}
mt Get(mt a, long long K) {
    mt Res;
    for (int i = 0; i < n; i++) Res.c[i][i] = 1;
    for (; K; K = K >> 1, a = nhan(a, a)) {
        if (K & 1)
            Res = nhan(Res, a);
    }
    return Res;
}
void solve() {
    long long K;
    cin >> n >> K;
    mt a;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) cin >> a.c[i][j];
    }
    a = Get(a, K);
    int Res = 0;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++)
            Res = (Res + a.c[i][j]) % module;
    }
    cout << Res;
}
int main(int argc,char *argv[]) {
    //srand(time(nullptr));
    ios_base::sync_with_stdio(0); cin.tie(nullptr); cout.tie(nullptr);
    ///doc();
    solve();
}


Measured memory_bytes: 384
import sys
import numpy as np
input = sys.stdin.readline


def log(*args):
    print(*args, file=sys.stderr)


def main():
    np.set_printoptions(threshold=20)
    N = int(input())
    a = list(map(int, input().rstrip().split()))
    ans = 0
    for v in a:
        ans += v - 1
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 27132