akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static void Main(string[] args)
    {
        //入力
        var n = crI();
        var arr = arrInt();
        var target = 1;
        for(int i = 0; i < n; i++)
        {
            if (arr[i] == target) target++;
        }
        if (target == 1) Console.WriteLine(-1);
        else Console.WriteLine(n - target + 1);

    }

   

    //入力受け取り用
    static string crS() { return Console.ReadLine(); }
    static int crI() { return int.Parse(Console.ReadLine()); }
    static int[] arrInt(){return Console.ReadLine().Split(' ').Select(v => int.Parse(v)).ToArray();}
    static long[] arrLong(){ return Console.ReadLine().Split(' ').Select(v => long.Parse(v)).ToArray(); }
    static string[] arrStr(){return Console.ReadLine().Split(' ').ToArray();}

}

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

using namespace std;

long lis_fast(long *arr, long n)
{
    vector<long> parent(n, -1);
    vector<long> lis_actual;
    lis_actual.push_back(arr[0]);

    for(long i=1; i<n; i++)
    {
        long ind = lower_bound(lis_actual.begin(), lis_actual.end(), arr[i]) - lis_actual.begin();
        if(ind < lis_actual.size()) lis_actual[ind] = arr[i];
        else lis_actual.push_back(arr[i]);
        parent[i] = lis_actual[ind-1];
    }

    // for(long )

    return lis_actual.size();
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);

    long n; cin>>n;

    long h[n];

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

    long dp[n];

    dp[0] = 0;

    for(int i=1; i<n; i++)
    {
        dp[i] = min(abs(h[i]-h[i-1])+dp[i-1], abs(h[i]-h[i-2])+dp[i-2]);
    }

    cout<<dp[n-1]<<endl;
    return 0;
}

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

#define si(a) scanf("%d",&a)
#define sl(a) scanf("%lld",&a)
#define sd(a) scanf("%lf",&a)
#define sc(a) scahf("%c",&a);
#define ss(a) scanf("%s",a)
#define pi(a) printf("%d\n",a)
#define pl(a) printf("%lld\n",a)
#define pc(a) putchar(a)
#define ms(a) memset(a,0,sizeof(a))
#define repi(i, a, b) for(register int i=a;i<=b;++i)
#define repd(i, a, b) for(register int i=a;i>=b;--i)
#define reps(s) for(register int i=head[s];i;i=Next[i])
#define ll long long
#define ull unsigned long long
#define vi vector<int>
#define vc vector<char>
#define vs vector<string>
#define pii pair<int,int>
#define pll pair<long,long>
#define pil pair<int,long>
#define pli pair<long,int>
#define mii unordered_map<int,int>
#define msi unordered_map<string,int>
#define lowbit(x) ((x)&(-(x)))
#define ce(i, r) i==r?'\n':' '
#define pb push_back
#define fi first
#define se second
#define INF 0x3f3f3f3f
#define pr(x) cout<<#x<<": "<<x<<endl
using namespace std;

inline int qr() {
    int f = 0, fu = 1;
    char c = getchar();
    while (c < '0' || c > '9') {
        if (c == '-')fu = -1;
        c = getchar();
    }
    while (c >= '0' && c <= '9') {
        f = (f << 3) + (f << 1) + c - 48;
        c = getchar();
    }
    return f * fu;
}
int main(){
    int R;
   scanf("%d",&R);
   printf("%lf\n",2*acos(-1)*R);
    return 0;
}

Measured memory_bytes: 3844
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int date;
    cin>>date;
    switch(date)
    {
        case 22:
        cout<<"Christmas Eve Eve Eve"<<endl;
        break;
        case 23:
        cout<<"Christmas Eve Eve"<<endl;
        break;
        case 24:
        cout<<"Christmas Eve"<<endl;
        break;
        case 25:
        cout<<"Christmas"<<endl;
        break;
        
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = ll(1e12);
const ll mod = ll(1e9+7);
const double pi = acos(-1);
#define rep0(i,n) for(ll (i) = 0; (i) < (n); ++(i))
#define rrep0(i,n) for(ll (i) = (n) - 1; (i) >= 0; --(i))
#define rep1(i,n) for(ll (i) = 1; (i) <= (n); ++(i))
#define rrep1(i,n) for(ll (i) = (n); (i) >= 1; --(i))
#define nfor(i,a,b) for(ll (i) = (a); (i) < (b); ++(i))
#define pf(x) cout << (x) << endl
#define all(x) (x).begin(),(x).end()
#define yes pf("Yes")
#define no pf("No")
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; }
int dx[8]={1,0,-1,0,1,1,-1,-1};
int dy[8]={0,1,0,-1,1,-1,1,-1};

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

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

ll factorial(ll n){
    ll ans = 1;
    rep1(i, n){
        ans *= i;
        ans %= mod;
    }
    return ans;
}

ll power(ll a, ll b){
    ll ans = 1;
    a %= mod;
    while(b) {
        if(b & 1LL) ans = ans * a % mod;
        a = a * a % mod;
        b >>= 1;
    }
    return ans;
}

vector<ll> FactorialInv, Factorial;

void init_combination(ll MAX){
    Factorial.resize(MAX + 1);
    FactorialInv.resize(MAX + 1);
    Factorial[0] = 1;
    for(int i = 1; i <= MAX; i++){
        Factorial[i] = Factorial[i - 1] * i % mod;
    }
    FactorialInv[MAX] = power(Factorial[MAX], mod - 2);
    for(ll i = MAX - 1; i >= 0; i--) {
        FactorialInv[i] = FactorialInv[i+1] * (i+1) % mod;
    }
}

ll combination(ll a, ll b){
    if((a == b) || (b == 0)){
        return 1;
    }
    if(a < b) return 0;
    if(b < 0) return 0;
    ll ans = Factorial[a] * FactorialInv[b] % mod;
    ans = ans * FactorialInv[a - b] % mod;
    return ans;
}

//modの値の確認をすること
int main(){
    init_combination(2005);
    ll n,k;
    cin >> n >> k;
    rep1(i, k){
        ll cnt = combination(n - k + 1, i);
        cnt *= combination(k - 1, i - 1);
        pf(cnt % mod);
    }
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

#define N 100

void bubbleSort(int * ,int);

int main(){
  int array[N], n, i;

  scanf("%d", &n);

  for(i = 0; i < n; i++)
    scanf("%d", &array[i]);

  bubbleSort(array, n);

  return 0;
}

void bubbleSort(int *array, int n){
  int flag = 1, i = 0, j, tmp, cnt = 0;

  while(flag){
    flag = 0;

    for(j = n - 1; j >= i + 1; j--){
      if(array[j] < array[j - 1]){
	tmp = array[j];
	array[j] = array[j - 1];
	array[j - 1] = tmp;

	flag = 1;
	cnt++;
      }
    }
    i++;
  }
  for(i = 0; i < n; i++){
    if(i == n - 1) printf("%d\n", array[i]);
    else printf("%d ", array[i]);
  }

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

}

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

int main(){
  while(1){
    string s;
    cin>>s;
    if(s=="-"){
      break;
    }
    int m;
    cin>>m;
    for(int i=0;i<m;i++){
      string tmp=s;
      s="";
      int h;
      cin>>h;
      for(int j=h;j<(int)tmp.size();j++){
	s+=tmp[j];
      }
      for(int j=0;j<h;j++){
	s+=tmp[j];
      }
    }
    cout<<s<<endl;
  }
  return 0;
}
		


Measured memory_bytes: 3152
/*
ID: tohoast1
TASK: gymnastics
LANG: C++
*/
#include <bits/stdc++.h>
#define speedup ios_base::sync_with_stdio(NULL)
#define fin freopen("allcodefs.in", "r", stdin)
#define fout freopen("allcodefs.out", "w", stdout)
#define FILENAME
#define PUBG push_back
#define p_b pop_back
#define mp make_pair
#define fi first
#define se second
#define cls clear
#define INF const int ci = 1e6 + 100
#define K_INF 1e9 + 7
#define time cerr << "\nTime elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n"
#define MIN_INT -999999999
#define MOD 1000000007
#define d109 1000000000
#define basay break
#define bmbr exit(0)

using namespace std;
typedef long long LL;
typedef long L;
typedef unsigned long long ULL;
typedef unsigned long UL;
typedef string STR;
int a, b, c, d;

int main() {
    #ifdef FILENAMEs
        fin;
        fout;
    #endif // FILENAME
    cin >> a >> b >> c >> d;
    cout << max(a * b, c * d);
    ///time;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
int main() {
	int S, h, s, m;
	std::cin >> S;
	h = S / 3600;
	S %= 3600;
	m = S / 60;
	S %= 60;
	std::cout << h << ":" << m << ":" << S << "\n";
	return 0;
}


Measured memory_bytes: 3132
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String s = sc.next();


        Map<Integer, Character> map = new HashMap<>();
        Map<Character, Integer> map2 = new HashMap<>();
        int p = 0;
        for (char a = 'A';a <= 'Z';a++) {
            map2.put(a,p);
            map.put(p++, a);
        }

        StringBuilder sb = new StringBuilder();
        for (int i = 0; i< s.length(); i++) {
            
            char c = map.get((map2.get(s.charAt(i))+n) % 26);
            //System.out.println(c);
            sb.append(c);
        }
        System.out.println(sb.toString());
    }

}


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

#define MAX 50030

int main()
{
  bool prime[MAX];
  for (int i = 0; i < MAX; i++) prime[i] = true;
  prime[0] = prime[1] = false;
  for (int i = 2; i < sqrt(MAX); i++){
    for (int j = i * 2; j < MAX; j += i){
      prime[j] = false;
    }
  }

  int n;
  while (cin >> n){
    for (int i = n - 1; i > 1; i--) {
      if (prime[i]) {
        cout << i << ' ';
        break;
      }
    }
    for (int i = n + 1; i < MAX; i++){
      if (prime[i]){
        cout << i << '\n';
        break;
      }
    }
  }
}

Measured memory_bytes: 3084
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
using ld = long double;
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define FORR(i, m, n) for (int i = (m); i >= (n); i--)
#define REP(i, n) FOR(i, 0, (n))
#define REPR(i, n) FORR(i, (n) - 1, 0)
#define REP1(i, n) FOR(i, 1, (n) + 1)
#define REPS(c, s) for (char c : s)
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REV(c) reverse(ALL(c))
#define sz(v) (int)v.size()
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;}
const int MOD = 1000000007;
const int INF = 1000000001;
const ll LINF = 1000000001000000001LL;
const char EOL = '\n';
 
void solve();
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(numeric_limits<double>::max_digits10);
    solve();
    return 0;
}

void solve() {
    int n;
    cin >> n;
    vector<int> a(n);
    REP(i, n) cin >> a[i];
    int ans = 0;
    REP(i, n - 1) FOR(j, i + 1, n) {
        chmax(ans, abs(a[i] - a[j]));
    }
    cout << ans << EOL;
}


Measured memory_bytes: 256
from math import ceil
n, k, *A = map(int, open(0).read().split())
t = sum(A) / (n+k)
A = [a for a in A if int(a/t) >= 1]
X = []
for a in A:
    X.append(ceil(a / ceil(a/t)))
    X.append(ceil(a / int(a/t)))
X.sort()
print(X[sum(int(a/t)-1 for a in A) -k-1])

Measured memory_bytes: 34680
#include <bits/stdc++.h>
#define ALL(a)  (a).begin(),(a).end()
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<long long, long long> Pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
template <typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template <typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
const int INT_INF = 1LL << 30;

int main(){
  int N;
  cin >> N;
  vi a(N+1);
  vi b(N+1, 0);

  for(int i = 1; i <= N; i++){
    cin >> a.at(i);
  }
  int anscounter = 0;
  for(int i = N; i >= 1; i--){
    if(i >= (N+2)/2 && a.at(i)){
      b.at(i) = 1;
      anscounter++;
    }
    else{
      int counter = 0;
      for(int j = 2*i; j <= N; j+=i){
        if(b.at(j)) counter++;
      }
      if(counter % 2 == a.at(i)) b.at(i) = 0;
      else{
        b.at(i) = 1;
        anscounter++;
      }
    }
  }
  cout << anscounter << endl;
  for(int i = 1; i <= N; i++){
    if(b.at(i)) cout << i << endl;
  }
}

Measured memory_bytes: 2432
n, a, b = map(int, input().split())

x = (b-a) % 2
if x == 1:
    ans = 0
    if (a-1) < (n-b):
        d = a-1
        y = b - d
        ans += d
        ans += (y + 1) // 2
    else:
        d = n-b
        y = a + d
        ans += d
        ans += (n-y + 1) // 2
    ans = min([ans, b-1, n-a])
    print(ans)
else:
    print((b-a+1)//2)


Measured memory_bytes: 9204
#include<vector>
#include<cmath>
#include<map>
#include<cstdlib>
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<set>
#include<stack>
#include<bitset>
#include<functional>
#include<ctime>
#include<queue>
#include<deque>
#include<complex>
#include<cassert>
using namespace std;
#define pb push_back
#define pf push_front
typedef long long lint;
typedef complex<double> P;
#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
//問題文および制約はちゃんと確認しよう！
//サイズは10^5じゃなくて2×10^5とかかもしれないし、重要な制約・条件を見落としているかも
//とりあえずサンプルを読んでから解法を考えよう？
int dp[(1<<21)+10][22];
int main()
{
	memset(dp,0,sizeof(dp));
	int n,K;cin>>n>>K;string s;
	rep(i,n+1){
		cin>>s;
		rep(j,(1<<i)){
			if(s[j]=='1') dp[(1<<i)+j][i]++;
		}
	}
	for(int i=n;i>0;i--) rep(j,(1<<i)) rep(l,i+1){
		if(dp[(1<<i)+j][l]<1) continue;
		//cout<<i<<' '<<j<<' '<<l<<' '<<dp[(1<<i)+j][l]<<endl;
		rep(k,l){
			if(k+1<i && ((j&(1<<k))>>k)==((j&(1<<(k+1)))>>(k+1))) continue;
			int to=(j>>(k+1)),bo=(j&((1<<k)-1));
			//cout<<j<<' '<<k<<' '<<(to<<k)+bo<<endl;
			//if(i==4 && (to<<k)+bo==4) cout<<j<<' '<<k<<endl;
			if(i==3 && j==1){
				//cout<<(to<<k)+bo<<' '<<k<<endl;
			}
			dp[(1<<(i-1))+(to<<k)+bo][k]+=dp[(1<<i)+j][l];
		}
		//cout<<dp[4][2]<<endl;
	}
	for(int i=n;i>0;i--) rep(j,(1<<i)){
		int sum=0;
		rep(k,i+1) sum+=dp[(1<<i)+j][k];
		if(sum>=K){
			string out="";
			rep(l,i){
				out+=('0'+(j%2));j/=2;
			}
			reverse(All(out));
			cout<<out<<endl;return 0;
		}
	}
	cout<<""<<endl;
}


Measured memory_bytes: 182788
#include <iostream>
using namespace std;
int main(){
    int N,M;
    cin>>N>>M;
    int MA[N][M],VE[M],ANS[N];
    for(int i=0;i<N;i++)for(int j=0;j<M;j++)cin>>MA[i][j];
    for(int i=0;i<N;i++)ANS[i]=0;
    for(int i=0;i<M;i++)cin>>VE[i];
    for(int i=0;i<N;i++)for(int j=0;j<M;j++)ANS[i]+=MA[i][j]*VE[j];
    for(int i=0;i<N;i++)cout<<ANS[i]<<endl;
    return 0;
}


Measured memory_bytes: 3088
n = int(input())
h_lst = list(map(int,input().split()))
lst_len = len(h_lst)
ans = 1

for i in range(lst_len-1,0,-1):
    if(h_lst[i]>=h_lst[i-1] and h_lst[i]>=max(h_lst[:i])):
        ans += 1

print(ans)


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


int N, M;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    map<string, int> scount;
    cin >> N;
    for(int i=0; i<N; i++){
        string s;
        cin >> s;
        scount[s]++;
    }
    cin >> M;
    for(int i=0; i<M; i++){
        string t;
        cin >> t;
        scount[t]--;
    }
    int maxs = 1e-2;
    for(auto it=scount.begin(); it != scount.end(); it++){
        if(maxs< (it->second)){
            maxs = it->second;
        }
    }
    cout << maxs << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<queue>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
char cp[101][101];
int h,w;
int score[51][51];
bool use[51][51];
int dx[]={-1,1,0,0},dy[]={0,0,-1,1};
void bfs(int i,int j){
    queue<pair<int,int> >Q;
    score[i][j]=0;
    Q.push(make_pair(i,j));
    while(!Q.empty()){
        pair<int,int> q=Q.front();
        Q.pop();
        int x=q.first,y=q.second;
        rep(k,4){
            int a=x+dx[k];
            int b=y+dy[k];
            if(cp[a][b]=='#'||use[a][b])continue;
            score[a][b]=score[x][y]+1;
            use[a][b]=true;
            Q.push(make_pair(a,b));
        }
    }
}
int main(){
    int black=0;
    cin>>h>>w;
    rep(i,h+2)rep(j,w+2){
        cp[i][j]='#';
    }
    rep(i,h)rep(j,w){
        cin>>cp[i+1][j+1];
        if(cp[i+1][j+1]=='#')black++;
    }
    bfs(1,1);
    int ans;
    ans=h*w-1-score[h][w]-black;
    if(score[h][w]==0)ans=-1;
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
def tenka1_2017_beginner_b
    n = gets.chomp.to_i

    max = [0, 0]
    min = [1000000000+1,0]
    for i in 1..n
        a,b = gets.chomp.split(/\s/).map{|x| x.to_i}
        if a > max[0]
            max = [a, b]
        end
        if a < min[0]
            min = [a, b]
        end
    end

    #min[1] += (min[0]-1) unless min[0] == 1
    max[0] += max[1] unless max[1] == 0
    puts max[0]
end

tenka1_2017_beginner_b

Measured memory_bytes: 3836
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <numeric>
//#include <stdio.h>
//#include <stack>
//#include <queue>
#include <cstdio>
#include <cmath>
#include <iterator>
#include <map>
//#include <fstream>
//#include <list>
//#include <iomanip>
#include <stdlib.h>
#include <cctype>

using namespace std;

#define MOD 1000000007
#define Int int64_t
#define PI 3.14159265358979
#define ssort(z) sort(z.begin(),z.end())
#define rsort(z) sort(z.rbegin(),z.rend())
#define eerase(z) z.erase(unique(z.begin(),z.end()),z.end())
#define ccnt(z,w) count(z.begin(),z.end(),w)


void printVec(std::vector<int> & vec) {
	std::cout << "";
	for (auto it = vec.begin(); it != vec.end(); ++it) {
		std::cout << *it << " ";
	}
	std::cout << std::endl;
}
void printVec1(std::vector<string>& vec) {
	std::cout << "";
	for (auto it = vec.begin(); it != vec.end(); ++it) {
		std::cout << *it << " ";
	}
	std::cout << std::endl;
}
void printVec2(std::vector<Int>& vec) {
	std::cout << "";
	for (auto it = vec.begin(); it != vec.end(); ++it) {
		std::cout << *it << " ";
	}
	std::cout << std::endl;
}

Int gcd(Int a, Int b) {
	return b != 0 ? gcd(b, a % b) : a;
}
Int lcm(Int a, Int b) {
	return a / gcd(a, b) *b;
	//a*bは64bit integer overflow
}

bool comp(const string a, const string b) {
	return a.length() < b.length();
}

bool integer(double num) {
	return floor(num) == num;
}

string gen(int num) {
	string str = "";
	for (int i = 0; i < num; i++) str += ".";
	return str;
}
Int fact(int num) {
	if (num == 0) return 1;
	else return num * fact(num - 1);
}


int main() {
	int k; cin >> k;
	int c1 = 0, c2 = 0;
	for (int i = 1; i <= k; i++) {
		if (i % 2 == 0)c1++;
		else c2++;
	}
	cout << min(c1, c2)* max(c1, c2);

	cout << endl;
	return 0;
}

Measured memory_bytes: 256
def gcd(a,b):
    if b>a:
        a,b=b,a
    while b:
        a,b=b, a%b
    return a

def cul(n,x):
    l=len(x)
    b=[x[i] for i in range(l)]
    b.pop(n)
    tmp=b[0]
    for i in range(1,l-1):
        tmp=gcd(tmp,b[i])
    return tmp

import sys
p=50
N=int(input())
if p>N: p=N
a=list(map(int,input().split()))

ans=0
for i in range(p):
    s=cul(i,a[:p])
    if s>ans: ans=s

print(ans)


Measured memory_bytes: 14400
//MD. HASNAIN ALI (UNSOLVED)
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

#define MAX(a,b) (a>b? a:b)
#define MIN(a,b) (a<b? a:b)
#define SWAP(a,b) {       \
                    a=a+b;\
                    b=a-b;\
                    a=a-b;}
#define LL long long


int main()
{
    char x[11],y[11];
    int a,b,c=0,i;
    scanf("%s",x);
    scanf("%s",y);
    a=strlen(x);
    b=strlen(y);
    for(i=0;i<a;i++)
    {
        if(x[i]==y[i]) c++;
    }
    if(c==a) printf("Yes\n");
    else printf("No\n");

    return 0;
}


Measured memory_bytes: 1664
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define lper(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[4]={1,0,-1,0};
const ll dx[4]={0,-1,0,1};
int main(){
    int N,C,K;cin>>N>>C>>K;
    int info[N];
    rep(i,N)cin>>info[i];
    sort(info,info+N);
    int ans=0,now=info[0],count=0;
    rep(i,N){
        if(now+K<info[i]){
            ans++;
            count=1;
            now=info[i];
        }
        else{
            count++;
            if(count==C){
                if(i<N-1)now=info[i+1];
                count=0;
                ans++;
            }
        }
    }
    cout<<ans+(count?1:0)<<endl;
    return 0;
}

Measured memory_bytes: 640
#include<stdio.h>

int main(void)
{
	int a, b, i;
	char op;
	
	for(i=0;;i++)
	{
		scanf("%d %c %d", &a, &op, &b);
		if(op == '+')
		{
			printf("%d\n", a+b);
		}
		else if(op == '-')
		{
			printf("%d\n", a-b);
			}
		else if(op == '*')
		{
			printf("%d\n", a*b);
		}
		else if(op == '/')
		{
			printf("%d\n", a/b);
		}
		else if(op == '?')
		{
			break;
		}
	}
	return 0;
}


Measured memory_bytes: 2052
#include <iostream>
#include <cstdio>
#include <cstring>

using namespace std;

int main()
{
    char s[15];
    scanf("%s", s);
    int slen = strlen(s);
    int ans = 0;
    int tmp = 0;
    for(int i = 0; i < slen; ++i)
    {
        if(s[i] == 'A' || s[i] == 'C' || s[i] == 'G' || s[i] == 'T')
            tmp++;
        else
        {
            ans = max(ans, tmp);
            tmp = 0;
        }
    }
    ans = max(ans, tmp);
    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 256
int_list = []
for num in range(5):
    inta = int(input())
    int_list.append(inta)
if int_list[0] < 0:
    num1 = int_list[0] * -1
    num2 = num1 * int_list[2]
    num2 += int_list[3]
    num3 = int_list[4] * int_list[1]
    num2 += num3
    print(num2)
elif int_list[0] > 0:
    num1 = int_list[1] - int_list[0]
    num2 = num1 * int_list[4]
    print(num2)


Measured memory_bytes: 5600
a,b,c,d=map(int,input().split())
p=998244353
n=c-a+2
m=d-b+2
data=[[0]*(m)for i in range(n)]

data[1][1]=1

#print(data)

for i in range(1,n):
    gyou=a+i-1
    for j in range(1,m):
        retu=b+j-1
        if(i*j==1):
            continue
        data[i][j]=(data[i-1][j]*retu%p)+(data[i][j-1]*gyou%p)-((data[i-1][j-1]*(gyou-1)%p)*(retu-1)%p)
        data[i][j]=data[i][j]%p
        #print(gyou,retu,i,j,data[i][j])
#print(data)
print(data[n-1][m-1]%p)

Measured memory_bytes: 133908
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define f first
#define s second
#define pb push_back
#define INF 100000005
typedef pair<int, int> ii;
typedef vector <int> vi;
typedef vector <ii> vii;
int n,x,y,sol;
signed main(){
    ios_base :: sync_with_stdio(0); cin.tie(); cout.tie();
    cin>>x>>y;
    while (y>=x){
        x*=2;sol++;
    }
    cout<<sol;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	int n,k,x,y,i,m,km,kk,max;
	scanf("%d",&n);
	scanf("%d",&k);
	scanf("%d",&x);
	scanf("%d",&y);
	km=0;
	kk=0;
	if(n<=k){
		for(i=1;i<=n;i++){
			max+=x;
		}
	}
	else{
		for(i=1;i<=k;i++){
			km+=x;
		}
		for(m=k+1;m<=n;m++){
			kk+=y;
		}
		max=km+kk;
	}
	printf("%d\n",max);
	return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007;
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;

int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    map<pair<string,string>,ll> mp;
    ll n;
    cin>>n;
    string s;
    cin>>s;
    string t=s.substr(n,n);
    reverse(be(t));
    int maki=(1<<n);

    for(int bit=0;bit<maki;bit++){
    	string a="",b="";
    	for(int i=0;i<n;i++){
    		if(bit>>i&1){
    			a+=s[i];
    		}else{
    			b+=s[i];
    		}
    	}
    	reverse(be(b));
    	mp[{a,b}]++;
    }
    ll ans=0;
    for(int bit=0;bit<maki;bit++){
    	string a="",b="";
    	for(int i=0;i<n;i++){
    		if(bit>>i&1){
    			a+=t[i];
    		}else{
    			b+=t[i];
    		}
    	}
    	reverse(be(b));
    	ans+=mp[{a,b}];
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 87040
#include <bits/stdc++.h>
#define all(a) a.begin(), a.end()
#define db(a) cout << fixed << #a << " = " << a << endl;

using namespace std;

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



int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int n, k;
	cin >> n >> k;
	int A[n];
	for (int i = 0; i < n; i++) cin >> A[i];
	sort(A, A + n);
	int suma = 0;
	for (int i = 0; i < k; i++) {
		suma += A[i];
	}
	cout << suma << endl;
}



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

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

Measured memory_bytes: 256
import java.util.*;



public class Main {
	static Scanner sc = new Scanner(System.in);
	static int n, m;
	static int[] card_n, card_m;

	public static void main(String[] args) {
		// TODO ツ篠ゥツ督ョツ青カツ青ャツつウツづェツつスツδソツッツドツ・ツスツタツブ
		while(read() == true){
			solve();
		}
	}


	public static boolean read(){
		n = sc.nextInt();
		m = sc.nextInt();

		if(n==0 && m==0) return false;

		card_n = new int[n];
		card_m = new int[m];

		for(int i=0; i<n; i++){
			card_n[i] = sc.nextInt();
		}
		for(int i=0; i<m; i++){
			card_m[i] = sc.nextInt();
		}
		Arrays.sort(card_n);
		Arrays.sort(card_m);

		return true;
	}

	public static void solve(){
		int total_n=0, total_m=0;
		for(int i=0; i<card_n.length; i++){
			total_n += card_n[i];
		}
		for(int i=0; i<card_m.length; i++){
			total_m += card_m[i];
		}

		if((total_n-total_m)%2 == 0){
			for(int i=0; i<card_n.length; i++){
				for(int j=0; j<card_m.length; j++){
					if((total_n-total_m)/2 == card_n[i]-card_m[j]){
						System.out.println(card_n[i] + " " +card_m[j]);
						return;
					} else{
						continue;
					}
				}
			}
		}


		System.out.println(-1);



	}
}

Measured memory_bytes: 12000
import math
 
n, k = map(int, input().split())
c = 0
 
if k%2==0:
    if math.floor(2*n/k)%2==0:
        d=math.floor(2*n/k)/2
        c=2*d*d*d
    else:
        d=(math.floor(2*n/k)+1)/2
        c=d*d*d+(d-1)*(d-1)*(d-1)
    print(int(c))
else:
    d=math.floor(n/k)
    c=d*d*d
    print(int(c))


Measured memory_bytes: 3060
N = int(input())
A = [[int(i) for i in input().split()] for _ in range(2)]

for i in range(1, N) :
    A[0][i] += A[0][i-1]
for i in range(N-2, -1, -1) :
    A[1][i] += A[1][i+1]
print(max([A[0][i] + A[1][i] for i in range(N)]))

Measured memory_bytes: 38384
import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);

    int N = scanner.nextInt();
    Pair[] a = new Pair[N];
    for (int i = 0; i < N; i++) {
      a[i] = new Pair(i + 1, scanner.nextInt());
    }
    Arrays.sort(a, Comparator.comparingInt(pair -> pair.second));

    StringBuilder sb = new StringBuilder();
    for (int i = 0; i < N; i++) {
      sb.append(a[i].first).append(' ');
    }
    sb.setLength(sb.length() - 1);
    System.out.println(sb.toString());
  }

  private static class Pair {
    private final int first;
    private final int second;

    private Pair(int first, int second) {
      this.first = first;
      this.second = second;
    }
  }
}


Measured memory_bytes: 63676
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <fstream>
#include <iomanip>

typedef long long ll;
const ll INF = (ll)1e18 + 1;
const ll MOD = 1e9 + 7;

template<class T> std::ostream& operator << (std::ostream& os, std::vector< T > v)
{
  ll i = 0;
  for (auto x : v) {os << " [" << i++ << "]" << x; if (i % 10 == 0) os << std::endl;}
  return os;
}

template<class T, class S> std::ostream& operator << (std::ostream& os, std::vector< std::pair<T, S> > vp)
{
  ll i = 0;
  for (auto p : vp) {os << " [" << i++ << "]" << p.first << " " << p.second; if (i % 10 == 0) os << std::endl;}
  return os;
}

void print(){ std::cout << std::endl; }
template<typename H> void print(H head) { std::cout << head << std::endl; }
template<typename H, typename... T> void print(H head, T... tail){ std::cout << head << " ", print(tail...); }

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

  ll N;
  std::cin >> N;

  ll ans = 0LL;
  for (ll x = 1; x <= N; x+=2) {
    ll cnt = 0LL;
    for (ll i = 1; i * i <= x; i++) {
      if (x % i == 0) {
	cnt += i == (x / i) ? 1 : 2;
      }
    }
    //print(x, cnt);
    if (cnt == 8) ans++;
  }

  print(ans);
  return 0;
}


Measured memory_bytes: 256
import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

in_n = lambda: int(readline())
in_nn = lambda: map(int, readline().split())
in_s = lambda: readline().rstrip().decode('utf-8')
in_nl = lambda: list(map(int, readline().split()))
in_nl2 = lambda H: [in_nl() for _ in range(H)]
in_map = lambda: [s == ord('.') for s in readline() if s != ord('\n')]
in_map2 = lambda H: [in_map() for _ in range(H)]
in_all = lambda: map(int, read().split())


def main():

    N = in_n()
    abc = in_nl2(N)

    dp = [[0 for _ in range(N)] for _ in range(3)]

    a, b, c = abc[0]
    dp[0][0] = a
    dp[1][0] = b
    dp[2][0] = c

    for i in range(N - 1):
        a, b, c = abc[i + 1]
        dp[0][i + 1] = max(dp[1][i] + a, dp[2][i] + a)
        dp[1][i + 1] = max(dp[0][i] + b, dp[2][i] + b)
        dp[2][i + 1] = max(dp[0][i] + c, dp[1][i] + c)

    print(max(dp[0][-1], dp[1][-1], dp[2][-1]))


if __name__ == '__main__':
    main()


Measured memory_bytes: 100348
#include <iostream>
#include <string>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <utility>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
using namespace std;
#define INF 1000000007
#define LINF 1000000000000000007
#define MOD 1000000007
#define int long long
#define rep(i, n) for (int i = 0; i < n; i++)
#define repb(i, n) for (int i = n - 1; i >= 0; i--)
#define MODE 1
#ifdef MODE
#define DEB(X) cout << #X << ": " << X << " ";
#define ARDEB(i, X) cout << #X << "[" << i << "]: " << X[i] << " ";
#define END cout << endl;
#else
#define DEB(X) \
    {          \
    }
#define ARDEB(i, X) \
    {               \
    }
#define END \
    {       \
    }
#endif
typedef pair<int, int> P;
struct edge{int to,cost;};
typedef long long ll;

int ans;
signed main()
{
    int n,k,v[1111];
    cin>>n>>k;
    rep(i,n)cin>>v[i];
    priority_queue<int,vector<int>,greater<int>> que,que2,que3,que4;
    int sum=0,max=0;
    for(int i=0;i<=k && i<=n;i++){
        if(i!=0){
            que.push(v[i-1]);
            sum+=v[i-1];
        }
        int sum2=sum;
        que2=que;

        /*while(que4.size()){
        cout<<que4.top()<<" ";
        que4.pop();
    }*/
    //cout<<endl;
        for(int j=0;i+j<=k && i+j<=n;j++){
            if(j!=0){
                que2.push(v[n-j]);
                sum2+=v[n-j];
            }
            int sum3=sum2;
            que3=que2;
            /*que4=que3;while(que4.size()){
        cout<<que4.top()<<" ";
        que4.pop();
    }
    cout<<endl;*/
            rep(l,k-i-j){
                if(que3.size() && que3.top()<0){
                    sum3-=que3.top();
                    que3.pop();
                }
                else break;
            }
            int a=max;
            max=std::max(max,sum3);
           // if(a!=max)que3=que2;
        }
    }
    /*while(que3.size()){
        cout<<que3.top()<<" ";
        que3.pop();
    }*/
    cout<<endl;
    cout<<max<<endl;

}


Measured memory_bytes: 256
/*****/

#include <iostream>
#include <array>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <iomanip>	//cout << fixed << setprecision(桁数);
#include <stdexcept>

//#define int long long

using namespace std;
using ll = long long;
using ld = long double;
using vecll = vector<ll>;

#define nextline() (std::cerr << "\n")
#define debug(x) (#x " : " + (x))
#define debug_cout(x) (std::cerr << #x << " : " <<  (x) << "\n")
#define debug_tabcout(n, x) (std::cerr << strMulti("\t",n) << #x << " : " <<  (x) << "\n")
#define debug_headcout(h, x) (std::cerr << h << " : " <<  (x) << "\n")
#define debug_tabheadcout(n, h, x) (std::cerr << strMulti("\t",n) << h << " : " <<  (x) << "\n")

#define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; i++)
#define rep1(i, n) for(int i=1, i##_len=(n); i<=i##_len; i++)
#define rrep(i, n) for(int i=(n)-1; i >= 0; i--)
#define rrep1(i, n) for(int i=(n); i > 0; i--)
#define all(x) (x).begin(), (x).end()
#define pair(a, b) make_pair(a, b);
constexpr int INF = 2000000100;
constexpr ll DIV = 1000000007;	// 10e9+7
template<class T> bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
//template<class T> T divup(T a, T b) { if (a % b == 0) { return a / b; } return a / b + 1; }
#define diup(a, b) (a % b == 0 ? a / b : a / b + 1)
std::string strMulti(std::string t, int n) { std::string out = ""; for (int i = 0; i < n; i++) { out += t; } return out; }
template<class T> T math_P(T m, T n) { T ret = 1; for (T i = m; i > m - n; i--) { ret *= i; } return ret; }
template<class T> T math_C(T m, T n) { T ret = mathP(m, n); for (T i = 2; i <= n; i++) { ret /= i; } return ret; }
template<class T> bool compare_by_b(pair<T, T> a, pair<T, T> b) { if (a.second != b.second) { return a.second < b.second; } return a.first < b.first; }
template<class T> T math_gcd(T a, T b) { a = abs(a); b = abs(b); if (a < b) { std::swap(a, b); } T tmp; while (b != 0) { tmp = b; b = a % b; a = tmp; } return a; }
template<class T> T math_lcm(T a, T b) { a = abs(a); b = abs(b); if (a > b) { std::swap(a, b); } if (a == 1) { return b; } T i = a; while (i % b != 0) { i += a; } return i; }

/*****/

void Main()
{
	int x;
	cin >> x;
	if (x < 1200)
		cout << "ABC";
	else
		cout << "ARC";
}

/*****/

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

	std::cout << std::fixed << std::setprecision(10);


	/*
	while (true)
	{
		Main();
		cout << endl;
	}
	//*/


	Main();

	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(){
  int a,b,c;
  
  scanf("%d %d %d",&a,&b,&c);
  
  if(a==b && a!=c)
    printf("Yes");
  else if(a==c && b!=a)
    printf("Yes");
  else if(b==c && a!=b)
    printf("Yes");
  else
    printf("No");
  
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
#define cinf(n,x,y) for(int i=0;i<(n);i++) cin >> x[i] >> y[i] ;

int main(){
  int N,T ;
  cin >> N >> T ;
  int c[110],t[110] ;
  cinf(N,c,t) ;
  int min =10000 ;
  for(int i=0;i<N;i++){
    if(t[i] <= T){
      if(c[i] < min )
        min = c[i] ;
    }
  }
  if(min != 10000)
    cout << min << endl;
  else
    cout << "TLE" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
const long long mod = 1e9 + 7 ;
const int N = 3e5+122; 

int n, m, k, t;
int a[N];
long long ans = 0;
vector<int> v[N];

int main ( ) {
	cin >>ans;
	int f = ans * 100 / 108;
	for(int s = f - 4; s <= f + 4; s++)
	if(s * 108/100 == ans)return cout << s,0;
	cout<<":(";
	return 0;

}

Measured memory_bytes: 8448
import sys

def seiseki(m, f, r):
    if m == -1 or f == -1:
        return "F"
    elif m + f >= 80:
        return "A"
    elif 65 <= m + f < 80:
        return "B"
    elif 50 <= m + f < 65:
        return "C"
    elif 30 <= m + f < 50:
        if r >= 50:
            return "C"
        return "D"
    elif m + f < 30:
        return "F"

for line in sys.stdin:
    m, f, r = map(int, line.strip().split())
    if m == f == r == -1:
        break

    print seiseki(m, f, r)

Measured memory_bytes: 6372
#include <iostream>
#include <cstdio>
#include <vector>

using namespace std;

int main(int argc, char *argv[]) {
  double d[10], v1, v2;
  vector<int> result;
  while (scanf("%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,\n",
               d, d+1, d+2, d+3, d+4, d+5, d+6, d+7, d+8, d+9, &v1, &v2) != EOF) {
    double hoge = 0;
    for (int i = 0; i < 10; i++)
      hoge += d[i];
    hoge /= v1 + v2;
    hoge *= v1;
    for (int i = 0; i < 10; i++) {
      hoge -= d[i];
      if (hoge <= 0) {
        result.push_back(i+1);
        break;
      }
    }
  }

  for (int i = 0; i < result.size(); i++)
    cout << result[i] << endl;
  return 0;
}

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

using namespace std;

int N;
int H[100000];
int dp[100000];
int INF = 1145141919;

int main() {
	cin >> N;
	for (int i = 0; i < N; i++)cin >> H[i];
	dp[0] = 0;
	for (int i = 1; i < N; i++) {
		dp[i] = INF;
	}
	for (int i = 1; i < N; i++) {
		if (i - 1 >= 0)dp[i] = min(dp[i], dp[i - 1] + abs(H[i] - H[i - 1]));
		if (i - 2 >= 0)dp[i] = min(dp[i], dp[i - 2] + abs(H[i] - H[i - 2]));
	}
	cout << dp[N - 1] << endl;
	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
////////////////////////////////////////////////
int main()
{
    ll x, k, d, a;
    cin >> x >> k >> d;
    x = abs(x);
    if (x / d < k)
    {
        a = x - (x / d) * d;
        k -= x / d;
    }
    else
    {
        a = x - k * d;
        k = 0;
    }

    if (k % 2 == 0)
        cout << a << endl;
    else
        cout << d - a << endl;
}

Measured memory_bytes: 3620
package main

import(
	"fmt"
)

func main(){
	var a,b,c int
	fmt.Scanf("%d",&a)
	fmt.Scanf("%d %d",&b,&c)
	for i := b;i<=c;i++{
		if i % a == 0{
			fmt.Println("OK")
			return 
		}
	}
	fmt.Println("NG")
}

Measured memory_bytes: 1816
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
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; }
const ll INF=1LL<<60;
const int inf=1<<30;
const int mod=1e9+7;
const int MOD=998244353;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a,b;
    while(cin >> a >> b){
        if(a==0&&b==0){
            return 0;
        }
        int n;cin >> n;
        vector<vector<int>> dp(a,vector<int>(b));
        dp[0][0]=1;
        for(int i=0;i<n;i++){
            int x,y;cin >> x >> y;
            x--,y--;
            dp[x][y]=-1;
        }
        for(int i=0;i<a;i++){
            for(int j=0;j<b;j++){
                if(dp[i][j]==-1){
                    continue;
                }
                if(i<a-1){
                    if(dp[i+1][j]!=-1){
                        dp[i+1][j]+=dp[i][j];
                    }
                }
                if(j<b-1){
                    if(dp[i][j+1]!=-1){
                        dp[i][j+1]+=dp[i][j];
                    }
                }
            }
        }
        cout << dp[a-1][b-1] << endl;
    }
}


Measured memory_bytes: 3080
import itertools
S = input()
combs = list(itertools.product(["+", "-"], repeat = 3))
res = ""
for comb in combs:
    temp = S[0] + comb[0] + S[1] + comb[1] + S[2] + comb[2] + S[3]
    if eval(temp) == 7:
        res = temp + "=7"
print(res)

Measured memory_bytes: 3060
/*|In The Name Of Allah|*/

#include <bits/stdc++.h>

using namespace std;

const int N = 2e5+5;

int n;
int ar[N];
int pr[N][20];

bool can(int mid , int idx){
     for(int i = 0; i < 20; i++){
        if(pr[mid][i] - pr[idx - 1][i] > 1)
            return 0;
     }
     return 1;
}

int main(){
    scanf("%d" , &n);
    for(int i = 1; i <= n; i++){
        scanf("%d" , &ar[i]);
        for(int j = 0; j < 20; j++){
            pr[i][j] = pr[i - 1][j] + ( (ar[i] & (1 << j)) != 0);
        }
    }
    long long ans = 0;
    for(int i = 1; i <= n; i++){
        int l = i , r = n;
        while(l < r){
            int mid = (l + r + 1) >> 1;
            if(can(mid , i)){
                l = mid;
            } else {
                r = mid - 1;
            }
        }
        ans += l - i + 1;
    }
    printf("%lld\n" , ans);
}


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

int main()
{
	string a,b;
	int x;
	int zh(string s);
	
	cin>>a>>b;
	
	x=zh(a+b);
	
	if(int(sqrt(x))==sqrt(x))
	   cout<<"Yes"<<endl;
	else
	   cout<<"No"<<endl;
	   
	return 0;
 } 
 
 int zh(string s)
 {
 	int tmp=0;
 	
 	for(int i=0;i<s.size();i++)
 	   tmp=tmp*10+(s[i]-'0');
 	   
 	return tmp;
 }

Measured memory_bytes: 384
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		
		int ans = a * b;
		
		if(ans % 2 == 0) {
			System.out.println("Even");
		} else {
			System.out.println("Odd");
		}
		
		sc.close();
	}

}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define pi acos(-1.0)
#define is_palindrome(str) equal(str.begin(),str.begin() + str.size()/2, str.rbegin())

int main()
{

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
     long long s,t,k,s1;
     cin>>s>>t>>k;

     s1=max(0LL,s-k);
     k=max(0LL,k-s);
     cout<<s1<<" "<<max(0LL,t-k)<<endl;

    return  0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int sz = 1e6+5;

bitset <sz> done;

int main() {
   ll n, d;
   cin >> n >> d;
   int ans = 0;
   d *= d;
   for(int i=0; i<n; i++) {
      ll x, y;
      scanf("%lld %lld", &x, &y);
      ll dd =  x *x + y * y;
      if(dd <= d) ans++;
   }
   cout << ans << endl;
}


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

int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	int n,m; cin>>n>>m;
	set<int>s;
	for(int i=0;i<m;++i){
		int a; cin>>a;
		s.insert(a);
	}
	vector<int>v(n+1);
	v.at(0)=1;
	if(s.find(1)==s.end())v.at(1)=1;
	const int mod=1e9+7;
	for(int i=2;i<=n;++i){
		if(s.find(i-2)==s.end())v.at(i)+=v.at(i-2);
		if(s.find(i-1)==s.end())v.at(i)+=v.at(i-1);
		v.at(i)%=mod;
	}
	cout<<v.at(n)<<"\n"s;
}

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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,a,b) for(int i=(a);i<(b);i++)
#define pb push_back
#define eb emplace_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second

using vint=vector<int>;
using pint=pair<int,int>;
using vpint=vector<pint>;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

template<class A,class B>
ostream& operator<<(ostream& ost,const pair<A,B>&p){
	ost<<"{"<<p.first<<","<<p.second<<"}";
	return ost;
}

template<class T>
ostream& operator<<(ostream& ost,const vector<T>&v){
	ost<<"{";
	for(int i=0;i<v.size();i++){
		if(i)ost<<",";
		ost<<v[i];
	}
	ost<<"}";
	return ost;
}

signed main(){
	int n;
	cin>>n;
	cout<<180*(n-2)<<endl;
	return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String[] tmpArray = br.readLine().split(" ");
		
		int a = Integer.parseInt(tmpArray[0]);
		int b = Integer.parseInt(tmpArray[1]);
		
		if((a - b)%2 == 0){
			System.out.println((a+b)/2);
		}
		else {
			System.out.println("IMPOSSIBLE");
		}
	}

}


Measured memory_bytes: 20052
#include <stdio.h>

int research(int x, int y){
    int n;
    while(1){
        n = x % y;
        x = y;
        y = n;
        if(x % y == 0){
            return y;
        }
    }
}
int main(void){
    int x, y, z;
    scanf("%d %d", &x, &y);
    if(x > y){
        z = research(x, y);
    }else if(y > x){
        z = research(y, x);
    }else{
        z = x;
    }
    printf("%d\n", z);
    return 0;
}



Measured memory_bytes: 2148
using System;

class MainClass
{
    public static void Main(string[] args)
    {
        long K = long.Parse(Console.ReadLine());
        string[] s = Console.ReadLine().Split(' ');
        long[] a = new long[K];

        for (long i = 0; i < K;i++)
        {
            a[i] = long.Parse(s[i]);
        }

        long max = a[K - 1] * 2 - 1;
        long min = a[K - 1];

        if(min != 2)
        {
            Console.WriteLine("-1");
            return;
        }
        if(K==1)
        {
            Console.WriteLine("{0} {1}", min, max);
            return;
        }

        for(long i = K-2; i >= 0; i--)
        {
            long j = (min / a[i]) * a[i];


            bool mi = true;

            while(true)
            {
                if (j >= min && mi)
                {
                    min = j;
                    mi = false;
                    j = (max / a[i]) * a[i];
                }

                if (j > max)
                {
                    max = j - 1;

                    if (max <= min)
                    {
                        Console.WriteLine("-1");
                        return;
                    }

                    break;
                }

                j += a[i];


            }

        }

        Console.WriteLine("{0} {1}", min, max);
        return;

    }
}


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

#define ll long long int

int main() {
    int n; cin>> n;
    ll s=0;

    for(int i=1; i<=n; i++) {
        if(i % 3 == 0 || i % 5 == 0);
        else s+=i;
    }
    cout << s;
}

Measured memory_bytes: 3628
A = int(input())
B = int(input())
C = int(input())
X = int(input())
p = 0
for i in range(A+1):
  for j in range(B+1):
    for k in range(C+1):
      if 500*(i) + 100*(j) + 50*(k) == X:
        p = p + 1
print(p)

Measured memory_bytes: 3060
#include <iostream>
#include <iomanip>
#include <stdlib.h>
#include <cmath>
#include <string>
#include <cstring>
#include <utility>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#define debug(x) cerr << #x << ':' << x << endl
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define ALL(c) (c).begin(), (c).end()
using namespace std;
typedef long long ll;

int main(){
    int n;
    cin >> n;
    vector<int> D(n,0);
    rep(i,n) cin >> D[i];
    sort(ALL(D));
    int low = D[n/2 -1], great = D[n/2];
    // cout << low << " " <<great << endl;
    cout << great - (low) << endl;
    return 0;
}

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

int main() {
    int N;
    long long a[200001];
    cin >>N;
    for(int i=0;i<N;i++){
        cin>>a[i];
    }
    sort(a,a+N);
    for(int i=0;i<N-1;i++){
        if(a[i]==a[i+1]){
            cout<<"NO";
            return 0;
        }
        
    }
    cout <<"YES";
    return 0;
}


Measured memory_bytes: 1792