akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <climits>
#include <iomanip>
#include <unordered_map>
#include <unordered_set>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
using namespace std;
#define ll long long 
#define pb push_back
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
//typedef long long  MOD=1000000009;
ll MOD=998244353;
ll add(ll x, ll y) {ll res = x + y; return (res >= MOD ? res - MOD : res);}
ll mul(ll x, ll y) {ll res = x * y; return (res >= MOD ? res % MOD : res);}
ll sub(ll x, ll y) {ll res = x - y; return (res < 0 ? res + MOD : res);}
ll lcm(ll x, ll y) {ll res = (x * y) / __gcd(x, y); return res;}
ll power(ll x, ll y) {if (y < 0) return 1; ll res = 1; x %= MOD; while (y) {if (y & 1)res = mul(res, x); y >>= 1; x = mul(x, x);} return res;}

void iofoj(){
	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	freopen("error.txt","w",stderr);
	#endif
}


void solution()
{
    ll k,i,j,n,m,w;
    cin>>n;
    cout<<1-n;
}

int main(){
    fio
    //iofoj();
    // ll t;
    // cin>>t;
    // while(t--)
    solution();
    return 0; 
}



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

int main() {
  int n;
  cin >> n;
  
  vector<ll int> input(n);
  rep(i, n) {
    cin >> input[i];
    if(input[i] == 0) {
      cout << 0 << endl;
      return 0;
    }
  }
  
  ll int ans = 1;
  rep(i, n) {
    if(input[i] > (long double)1.0 * pow(10, 18) / ans) {
      cout << -1 << endl;
      return 0;
    }
    ans *= input[i];
  }
  
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3932
def main():
    import sys
    #input = sys.stdin.readline
    sys.setrecursionlimit(10000000)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations
    #from itertools import accumulate, product, permutations
    from math import floor, ceil

    #mod = 1000000007

    node,m =map(int, input().split())
    edge = [list(map(int, input().split())) for _ in range(m)]
    res = 0

    def dfs(num):
        for x, y in edge:
            if x==num:
                if not flag[y-1]:
                    flag[y-1] = 1
                    dfs(y)
            if y==num:
                if not flag[x-1]:
                    flag[x-1] = 1
                    dfs(x)
    
    for i in range(m):
        bridge = edge.pop(i)
        flag = [0]*node
        s = edge[0][0]
        flag[s-1]=1
        dfs(s)
        if not all(flag):
            res += 1
        edge.insert(i, bridge)
    print(res)

if __name__ == '__main__':
    main()

Measured memory_bytes: 3316
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned ll
#define PI acos(-1)
#define vi vector<int>
#define pi pair<int, int>
#define pl pair<ll, ll>
template<typename T> using v2 = vector<vector<T>>;
template<typename T> using v3 = vector<vector<vector<T>>>;
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
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 int MOD = 1e9 + 7;
const int INF = 1e9 + 200;
const ll INFLL = 2e18 + 200;

int main() {
    int H, W;
    cin >> H >> W;
    int ch, cw, dh, dw;
    cin >> ch >> cw >> dh >> dw;
    ch--; cw--; dh--; dw--;
    vector<string> S(H);
    cin >> S;
    typedef tuple<int, int, int> info;
    priority_queue<info, vector<info>, greater<>> tmp;
    vector<vector<int>> dist(H, vector<int>(W, INF));
    dist[ch][cw] = 0;
    tmp.emplace(0, ch, cw);
    while (!tmp.empty()) {
        int now_cost, h, w;
        tie(now_cost, h, w) = tmp.top();
        tmp.pop();
        if (dist[h][w] < now_cost) continue;
        for (int i = -1; i <= 1; i++) {
            for (int j = -1; j <= 1; j++) {
                if (h + i < 0 || h + i >= H) continue;
                if (w + j < 0 || w + j >= W) continue;
                if (abs(i) == abs(j)) continue;
                if (S[h + i][w + j] == '#') continue;
                if (dist[h + i][w + j] <= now_cost) continue;
                dist[h + i][w + j] = now_cost;
                tmp.emplace(now_cost, h + i, w + j);
            }
        }
        for (int i = -2; i <= 2; i++) {
            for (int j = -2; j <= 2; j++) {
                if (h + i < 0 || h + i >= H) continue;
                if (w + j < 0 || w + j >= W) continue;
                if (S[h + i][w + j] == '#') continue;
                if (dist[h + i][w + j] <= now_cost + 1) continue;
                dist[h + i][w + j] = now_cost + 1;
                tmp.emplace(now_cost + 1, h + i, w + j);
            }
        }
    }
    cout << (dist[dh][dw] == INF ? -1 : dist[dh][dw]) << endl;
}

Measured memory_bytes: 9552
n, k =list(map(int, input().split()))
hs = [int(input()) for _ in range(n)]
hs.sort()
#print(hs)
an = hs[k-1]-hs[0]
for i in range(1,n-k+1):
    ans = hs[i+k-1]-hs[i]
    an = min(an, ans)
    #print(an)
print(an)



Measured memory_bytes: 13348
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

#define ALL(obj) (obj).begin(),(obj).end()
#define SPEED cin.tie(0);ios::sync_with_stdio(false);

template<class T> using PQ = priority_queue<T>;
template<class T> using PQR = priority_queue<T,vector<T>,greater<T>>;

constexpr long long MOD = (long long)1e9 + 7;
constexpr long long MOD2 = 998244353;
constexpr long long HIGHINF = (long long)1e18;
constexpr long long LOWINF = (long long)1e15;
constexpr long double PI = 3.1415926535897932384626433L;

template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template <class T> void chmax(T& a, const T b){a=max(a,b);}
template <class T> void chmin(T& a, const T b){a=min(a,b);}
void YN(bool flg) {cout << (flg ? "YES" : "NO") << endl;}
void Yn(bool flg) {cout << (flg ? "Yes" : "No") << endl;}
void yn(bool flg) {cout << (flg ? "yes" : "no") << endl;}

int main() {
    int K; cin >> K;
    string S; cin >> S;
    corner(S.size()<=K,S);
    string T = S.substr(0,K);
    T.push_back('.');
    T.push_back('.');
    T.push_back('.');
    cout << T << endl;
    return 0;
}


Measured memory_bytes: 3628
N, W = map(int, input().split())

dp = [[0 for i in range(W + 1)] for j in range(N + 1)]

for i in range(1, N + 1):
    w, v = map(int, input().split())
    for j in range(1, W + 1):
        if j - w >= 0:
            dp[i][j] = max(dp[i - 1][j], dp[i - 1][j - w] + v)
        else:
            dp[i][j] = dp[i - 1][j]

print(max(dp[N]))

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

// chmin, chmax関数
template<typename T, typename U, typename Comp=less<>>
bool chmax(T& xmax, const U& x, Comp comp={}) {
    if(comp(xmax, x)) {
        xmax = x;
        return true;
    }
    return false;
}
template<typename T, typename U, typename Comp=less<>>
bool chmin(T& xmin, const U& x, Comp comp={}) {
    if(comp(x, xmin)) {
        xmin = x;
        return true;
    }
    return false;
}

// Yes-Noを出力する問題で楽をする
void Ans(bool f){
    if(f) cout << "Yes" << endl;
    else cout << "No" << endl;
}

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

int main(){
    ll h,w; cin >> h >> w;
    ll ch, cw, dh, dw;
    cin >> ch >> cw >> dh >> dw;
    ch--; cw--; dh--; dw--;

    VVL maze(h, VL(w,1000000));
    rep(i,h){
        string s;
        cin >> s;
        rep(j,w){
            if(s[j]=='#') maze[i][j] = -1; 
        }
    }

    // rep(i,h){
    //     rep(j,w){
    //         cout << maze[i][j];
    //     }
    //     cout << endl;
    // }

    queue<P> q;
    q.push(P(ch,cw));
    maze[ch][cw] = 0;
    
    while(!q.empty()){
        P p = q.front();
        q.pop();
        ll warps = maze[p.first][p.second];

        rep2(xh,-2,3){
            rep2(xw,-2,3){
                ll curh = p.first + xh;
                ll curw = p.second + xw;
                if(curh < 0 || curh >= h) continue;
                if(curw < 0 || curw >= w) continue;

                ll cur_warps = warps;
                ll status = maze[curh][curw];
                if(abs(xh)>1 || abs(xw)>1){
                    cur_warps++;
                }else if(abs(xh)==1 && abs(xw)==1){
                    cur_warps++;
                }

                if(status == -1){
                    continue;
                }else if(status > cur_warps){
                    maze[curh][curw] = cur_warps;
                    q.push(P(curh, curw));
                }else{
                    continue;
                }
            }
        }
    }

    // rep(i,h){
    //     rep(j,w){
    //         cout << maze[i][j];
    //     }
    //     cout << endl;
    // }

    ll result = maze[dh][dw];
    if(result == 1000000){
        cout << -1 << endl;
    }else{
        cout << result << endl;
    }

    return 0;
}

Measured memory_bytes: 11656
import java.util.*;
 
class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String op = sc.next();

       if(op.equals("a")|op.equals("i")|op.equals("u")|op.equals("e")|op.equals("o")){
         System.out.print("vowel");
       }else{
         System.out.print("consonant");
       }
      
    }
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define MOD 1000000007
#define FAST ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);srand(time(NULL))
int main()
{
     FAST;
     ll ans = 0;
     ll n;
     cin>>n;
     ll pos[n+1];
     for(ll i=0;i<n;i++)
     {
          ll x;
          cin>>x;
          pos[x] = i+1;
     }
     multiset<ll> m;
     m.insert(0);
     m.insert(0);
     m.insert(n+1);
     m.insert(n+1);
     for(ll i=n;i>=1;i--)
     {
          m.insert(pos[i]);
          auto itr = m.find(pos[i]);
          itr--;
          ll pre1 =  *itr;
          itr--;
          ll pre2 = *itr;
          itr++,itr++,itr++;
          ll suf1 = *itr;
          itr++;
          ll suf2 = *itr;
          ans = ans + i*(((pre1-pre2)*(suf1-pos[i]))+(suf2-suf1)*(pos[i]-pre1));
     }
     cout<<ans;
}

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

int main()
{
    int n;
    cin >> n;
    int a[n];
    int max=0;
    for(int i=0;i<n;++i){
        cin >> a[i];
        if(max<a[i]) max = a[i];
    }
    int p[max+2]={};
    for(int i=0;i<n;++i){
        ++p[a[i]];
        ++p[a[i]+1];
        ++p[a[i]-1];
    }
    int maxp=0;
    for(int i=0;i<max+1;++i){
        if(maxp<p[i]) maxp=p[i];
    }
    cout << maxp << endl;
    return 0;
}

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

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

	sort(a, a+n);
	int ans = a[n-1] - a[0];
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
n=int(input())
b=list(map(int,input().split()))
ans=[]

for i in range(n):
    for j in range(n-1-i,-1,-1):
        if b[j]==j+1:
            t=b.pop(j)
            ans.append(t)
            break
    else:
        print(-1)
        exit()

for a in reversed(ans):
    print(a)


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

using namespace std;

typedef long long ll;

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

	int n;
	cin >> n;

	for(int i = 1; i <= 9; i++){
		for(int j = 1; j <= 9; j++){
			if(i * j == n){
				cout << "Yes" << endl;
				return 0;
			}
		}
	}
	cout << "No" << endl;
}


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

using namespace std;
#define int long long
int32_t main()
{
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int n;
    cin>>n;
    int a[n];
    for(int i=0;i<n;++i) cin>>a[i];
    int dp[n+1];
    dp[0]=1000;
    for(int i=1;i<=n;++i)
    {
        dp[i]=dp[i-1];
        for(int j=1;j<i;++j)
        {
            dp[i]=max(dp[i],(dp[j]/a[j-1])*a[i-1]+dp[j]%a[j-1]);
        }
    }
    cout<<dp[n];
    return 0;
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
typedef long long LL;
int N;

int main(){
	string S,T;
	cin>>S>>T;
	cout<<T+S<<endl;
}

Measured memory_bytes: 256
import java.io.*;
import java.util.*;

public class Main
{
    PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    StringTokenizer tok;

    long MOD = 1000000007;

    public void go() throws IOException
    {
        ntok();
        int n = ipar();
        long k = ipar();
        int[] arr = new int[n];
        ntok();
        for (int i = 0; i < n; i++)
        {
            arr[i] = ipar();
        }
        long total = 0;
        for (int i = 0; i < n; i++)
        {
            for (int e = i+1; e < n; e++)
            {
                if (arr[i] > arr[e])
                {
                    total += k * (k+1) / 2;
                    total %= MOD;
                }
                else if (arr[i] < arr[e])
                {
                    total += (k-1) * k / 2;
                    total %= MOD;
                }
            }
        }
        out.println(total);

        out.flush();
        in.close();
    }

    public void ntok() throws IOException
    {
        tok = new StringTokenizer(in.readLine());
    }

    public int ipar()
    {
        return Integer.parseInt(tok.nextToken());
    }

    public long lpar()
    {
        return Long.parseLong(tok.nextToken());
    }

    public double dpar()
    {
        return Double.parseDouble(tok.nextToken());
    }

    public String spar()
    {
        return tok.nextToken();
    }

    public static void main(String[] args) throws IOException
    {
        new Main().go();
    }
}


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

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORTASC(c) sort((c).begin(),(c).end())
#define SORTDESC(c,t) sort((c).begin(),(c).end(), std::greater<t>());
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define VMAX(a) *max_element(ALL(a))
#define VMIN(a) *min_element(ALL(a))
#define OUT(a) cout << (a) << endl;
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

const double PI  = acos(-1.0);

template <class T, class S>
using umap = std::unordered_map<T, S>;
using ll = long long;
using namespace std;

int main() {
    ll n;
    long double x;
    string u;

  	cin >> n;
  
    long double dama = 0;
    REP(i, n){
        cin >> x >> u;

        if (u == "JPY"){
            dama += x;
        } else {
            dama += x*380000.0;
        }
    }

    cout << setprecision(20) << dama << endl;

    return 0;
}

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)
#define exist_in(list, value) (list.end() != std::find(all(list),value))
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; }
//template<class T1, class T2> bool exist_in(const T1& list, const T2& v) { return (list.end() != std::find(list.begin(), list.end(), v)); }
//template<class T> bool exist_in(const T& c, const typename T::value_type& v) {	return (c.end() != std::find(c.begin(), c.end(), v));}

/*****/

void Main()
{
	int r, g, b;
	cin >> r >> g >> b;
	if ((g * 10 + b) % 4 == 0)
		cout << "YES";
	else
		cout << "NO";
}

/*****/

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
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String s1 = sc.nextLine();
		String s2 = sc.nextLine();
		boolean judge = true;
		for(int i = 0; i < s1.length(); i++){
			if(s1.charAt(i) != s2.charAt(s1.length()-1-i)){
				judge = false;
				break;
			}
		}
		System.out.println(judge ? "YES" : "NO");
	}
}


Measured memory_bytes: 23764
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class Main {

  public static void main(String[] args) {
    new Main().run();
  }

  public void run() {
    
    try(BufferedReader in = new BufferedReader(new InputStreamReader(System.in))) {

      int n = Integer.parseInt(in.readLine());
      String line = in.readLine();
      int nHalf = n >> 1;

      int[] seqA = new int[nHalf];
      int[] seqB = new int[nHalf];

      Integer num;
      List<Integer> listA = new ArrayList<>();
      List<Integer> listB = new ArrayList<>();
      Map<Integer,Integer> mapA = new HashMap<>();
      Map<Integer,Integer> mapB = new HashMap<>();
      int offset=0,next=0;
      char regx = ' ';
      for(int i=0, j=0; i<n; i++, j= i >> 1) {
        if((next = line.indexOf(regx,offset)) == -1)
          next = line.length();
        num = new Integer(line.substring(offset, next));
        offset = ++next;

        if((i & 1) == 0) {
          seqA[j] = num;
          if(mapA.containsKey(num)) {
            mapA.replace(num, mapA.get(num) + 1);
          } else {
            mapA.put(num, 1);
            listA.add(num);
          }
        }
        else {
          seqB[j] = num;
          if(mapB.containsKey(num)) {
            mapB.replace(num, mapB.get(num) + 1);
          } else {
            mapB.put(num, 1);
            listB.add(num);
          }
        }
      }

      int vma,vmb,xa,xb;
      vma = vmb = xa = xb =0;
      for (Integer var : listA) {
        int ma = mapA.get(var);
        if(vma < ma) {
          vma = ma;
          xa = var;
        }
      }
      for (Integer var : listB) {
        int mb = mapB.get(var);
        if(vmb < mb) {
          vmb = mb;
          xb = var;
        }
      }

      int cca = nHalf - mapA.get(xa);
      int ccb = nHalf - mapB.get(xb);

      int vma2,vmb2,xa2,xb2;
      vma2 = vmb2= xa2 = xb2 =0;
      int cca2,ccb2;
      cca2 = ccb2 = 0;
      int ans = 0;
      if(xa == xb) {
        for (Integer var : listA) {
          int ma = mapA.get(var);
          if(var != xa && vma2 < ma) {
            vma2 = ma;
            xa2 = var;
          }
        }
        for (Integer var : listB) {
          int mb = mapB.get(var);
          if(var != xb && vmb2 < mb) {
            vmb2 = mb;
            xb2 = var;
          }
        }
      
        cca2 = nHalf -( mapA.containsKey(xa2) ? mapA.get(xa2) : 0);
        ccb2 = nHalf -( mapB.containsKey(xb2) ? mapB.get(xb2) : 0);

        ans = cca2 > ccb2 ? cca + ccb2 : cca2 + ccb;
      }
      else {
        ans = cca + ccb;
      }

      System.out.println(ans);
    }
    catch(IOException e) {
      System.err.println(e);
    }
  }
}

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

int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	int n; cin>>n;
	vector<int>v(1e4+1,0);
	for(int x=1;x<100;++x){
		for(int y=x;y<100;++y){
			for(int z=y;z<100;++z){
				int sum=x*x+y*y+z*z+x*y+y*z+z*x;
				if(sum>n)break;
				if(x!=y&&y!=z)v.at(sum)+=6;
				else if(x==y&&y==z)v.at(sum)+=1;
				else v.at(sum)+=3;
			}
		}
	}
	for(int i=1;i<=n;++i){
		cout<<v.at(i)<<"\n"s;
	}
}


Measured memory_bytes: 3616
import java.util.Scanner;
import java.util.Stack;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while(sc.hasNext()) {
			String str = sc.nextLine();
			if(str.equals("."))break;
			Stack<String> b = new Stack<String>();
			boolean can = true;
			String ans = "yes";
			StringBuilder sb = new StringBuilder();
			for(int i=0;i<str.length();i++) {
				char a = str.charAt(i);
				if(a=='(' || a==')' || a=='[' || a==']') {
					sb.append(a);
				}
			}

			for(int i=0;i<sb.length();i++) {	
				String a = String.valueOf(sb.charAt(i));
				if(a.equals("(")) {
					if(b.empty() || b.peek().equals("(") || b.peek().equals("["))
						b.push(a);
					else {
						can = false;
						break;
					}
					
				}
				else if(a.equals(")")) {
					if(b.empty()) {
						can  = false;
						break;
					}
					else if(b.peek().equals("(") )
						b.pop();
					else{
						can = false;
						break;
					}
				}
				else if(a.equals("[")) {
					if(b.empty() || b.peek().equals("[") || b.peek().equals("("))
						b.push(a);
					else{
						can = false;
						break;
					}
				}
				else if(a.equals("]")) {
					if(b.empty()) {
						can = false;
						break;
					}
					else if(b.peek().equals("["))
						b.pop();
					else {
						can = false;
						break;
					}
				}
			}
			if(!can || !b.empty())ans="no";
			System.out.println(ans);
			b.clear();
		}
	}

}



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

int main()
{
    const long MAX = 1000000000;
    long a, b;

    cin >> a >> b;

    int d, r;
    double f;


    if ((a >= 1 && a <= MAX) && (b >= 1 && b <= MAX)) {
        d = a / b;
        r = a % b;
        f = static_cast<double>(a) / static_cast<double>(b);

        cout << fixed;
        cout << d << " " << r << " " << setprecision(5) << f << endl;
    }
    return 0;
}


Measured memory_bytes: 3300
#include<stdio.h>
int main(){
    int a,b,c,t;

    scanf("%d %d %d",&a,&b,&c);

    if (a > b) {
       t = a;
       a = b;
       b = t;
    }
    if (c < a) {
        t = c;
        c = b;
        b = a;
        a = t;
    }
    else if ((c >= a) && (b > c)){
       t = c;
       c = b;
       b = t;
    }
    printf("%d %d %d\n",a,b,c);
    return 0;
}


Measured memory_bytes: 2044
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <map>
#include <numeric>
#include <cmath>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <complex>
#include <string.h>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <iomanip>
#include <sys/time.h>
#include <tuple>
#include <random>
using namespace std;

#define endl '\n'
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define UNIQ(v) (v).erase(unique((v).begin(), (v).end()), (v).end())

typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;
typedef complex<double> comp;
typedef vector< vector<ld> > matrix;
struct pairhash {
public:
    template<typename T, typename U>
    size_t operator()(const pair<T, U> &x) const {
	size_t seed = hash<T>()(x.first);
	return hash<U>()(x.second) + 0x9e3779b9 + (seed<<6) + (seed>>2);
    }
};
const ll inf = 1e18 + 9;
const ll mod = 998244353;
const double eps = 1e-8;
const double pi = acos(-1);

int n, q;
int c[500001];
int l[500001], r[500001];

int cnt[500001];
int k = 0;

inline void add(int v) {
    if (cnt[c[v]] == 0) k++;
    cnt[c[v]]++;
}

inline void del(int v) {
    cnt[c[v]]--;
    if (cnt[c[v]] == 0) k--;
}

void solve() {
    int sq = (int)sqrt(n);
    vector<pair<int, int>> qs[n/sq+1];
    for (int i = 0; i < q; i++) {
        qs[l[i]/sq].push_back(make_pair(r[i], i));
    }

    // [nl, nr)
    int nl, nr;
    int res[q];
    for (int i = 0; i <= n/sq; i++) {
        if (qs[i].size() == 0) continue;
        sort(ALL(qs[i]));
        // 初期化処理
        nl = nr = qs[i][0].first;
        memset(cnt, 0, sizeof(cnt));
        k = 0;

        for (const pair<int, int>& p : qs[i]) {
            int idx = p.second;
            while (nl > l[idx]) {
                nl--;
                add(nl);
            }
            while (nr < r[idx]) {
                add(nr);
                nr++;
            }
            while (nl < l[idx]) {
                del(nl);
                nl++;
            }

            res[idx] = k;
        }
    }

    for (int i = 0; i < q; i++) {
        printf("%d\n", res[i]);
    }
}

void input() {
    scanf("%d%d", &n, &q);
    for (int i = 0; i < n; i++) scanf("%d", c+i);
    for (int i = 0; i < q; i++) {
        scanf("%d%d", l+i, r+i);
        l[i]--;
    }
}

int main() {
    input();
    solve();
}


Measured memory_bytes: 19512
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()　#小さい順位欲しいとき
    return divisors
n=int(input())
a=make_divisors(n)[1:]
ans=0
for i in a:
    k=n
    while k%i==0:
        k//=i
    if k%i==1:
        ans+=1
ans+=len(make_divisors(n-1))-1
print(ans)

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

int n,x[100005],y[100005],t[100005];

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

    cin>>n;
    for(int i=1;i<=n;i++)
        cin>>t[i]>>x[i]>>y[i];

    for(int i=1;i<=n;i++)
    {
        int d=abs(x[i]-x[i-1])+abs(y[i]-y[i-1]);
        int v=t[i]-t[i-1];
        if(d>v)
        {
            cout<<"No"<<endl;
            return 0;
        }
        else if((v-d)%2==1)
        {
            cout<<"No"<<endl;
            return 0;
        }
    }

    cout<<"Yes"<<endl;
    return 0;
}


Measured memory_bytes: 4788
N, K = map(int, input().split())
D = list(input().split())

flag = False
for a in range(N, 10*N+1):
	ans = list(str(a))
	for b in range(len(ans)):
		if ans[b] in D:
			break
		if b == len(ans) - 1 and ans[b] not in D:
			print(a)
			flag = True
	if flag:
		break

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

int main(void)
{
    int m;
    int h;
    int len;
    char tmp;
    
    while ( 1 ) {
        char str[201] = {0};
        scanf("%s", str);
        if ( strcmp(str, "-") == 0 ) {
            break;
        }
        len = strlen(str);
        scanf("%d", &m);
        for ( int i = 0; i < m; i++ ) {
            scanf("%d", &h);
            for ( int j = 0; j < h; j++ ) {
                tmp = str[0];
                for ( int k = 1; k < len; k++ ) {
                    str[k - 1] = str[k];
                }
                str[len - 1] = tmp;
            }
        }
        printf("%s\n", str);
    }
    
    return 0;
}


Measured memory_bytes: 2040
#include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <climits>
#include <cmath>
#include <complex>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <iomanip>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <cstdint>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
#define MP make_pair
#define PB push_back
#define inf 1000000007
#define rep(i,n) for(int i = 0; i < (int)(n); ++i)
#define all(x) (x).begin(),(x).end()

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}
 
template<class T> inline bool chmax(T &a, T b){
    if(a<b){
        a = b;
        return true;
    }
    return false;
}

template<class T> inline bool chmin(T &a, T b){
    if(a>b){
        a = b;
        return true;
    }
    return false;
}


int main(){
    int n,p;
    cin >> n >> p;
    string s;
    cin >> s;
    reverse(all(s));
    if(p==2){
        ll sm = 0;
        rep(i,n){
            if(s[i]=='2'||s[i]=='4'||s[i]=='6'||s[i]=='8'||s[i]=='0'){
                sm += n-i;
            }
        }
        cout << sm << endl;
    }else if(p==5){
        ll sm = 0;
        rep(i,n){
            if(s[i]=='0'||s[i]=='5'){
                sm += n-i;
            }
        }
        cout << sm << endl;
    }else{
        vector<ll> a(n+1);
        ll base = 1;
        rep(i,n){
            a[i+1] = (base*(s[i]-'0'))%p;
            base *= 10;
            base %= p;
        }
        vector<ll> res(p);
        rep(i,n){
            a[i+1] += a[i];
            a[i+1] %= p;
        }
        rep(i,n+1){
            res[a[i]]++;
        }
        ll ans = 0;
        rep(i,p){
            ans += res[i]*(res[i]-1)/2;
        }
        cout << ans << endl;
    }
    return 0;
}

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

int main(int argc, char *argv[]) {
  uint64_t w, h, x, y;
  cin >> w >> h >> x >> y;

  cout << w*h / (double)2 << endl;
  cout << (x+x == w && y+y == h) << endl;
  
  return 0;
}

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

struct Edge { int to, cost; };

vector<vector<Edge>> G(101010);
vector<bool> visited(101010);
vector<int> x(101010);

bool dfs(int v) {
  visited[v] = true;
  for(auto nx : G[v]) {
    if(visited[nx.to]) {
      if(x[nx.to] != x[v] + nx.cost) return false;
    } else {
      x[nx.to] = x[v] + nx.cost;
      if(!dfs(nx.to)) return false;
    }
  }
  return true;
}

bool solve() {
  int N, M;
  cin >> N >> M;
  rep(i, 0, M) {
    int l, r, d;
    cin >> l >> r >> d;
    G[l].push_back({r, d});
    G[r].push_back({l, -d});
  }
  rep(i, 0, N) if(!dfs(i)) return false;
  return true;
}

int main() {
  cout << (solve() ? "Yes" : "No") << endl;
  return 0;
}


Measured memory_bytes: 12032
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
int n,a[20],b[20],vis[20],p[20];
pair<int,int> pre[20],now[20];
int solve(int mask){
	for(int i=0;i<n;++i)
		if((mask>>i)&1) pre[i]=make_pair(b[i],1);
		else pre[i]=make_pair(a[i],0);
	for(int i=0;i<n;++i) vis[i]=0,now[i]=pre[i];
	sort(now,now+n);
	for(int i=0;i<n;++i)
		for(int j=0;j<n;++j)
			if(vis[j]==0 && pre[i].fi==now[j].fi && ((i-j)&1)==pre[i].se){
				vis[j]=1,p[i]=j;		
				break;		
			}
	for(int i=0;i<n;++i) if(vis[i]==0) return 114514;
	int ans=0;
	for(int i=0;i<n;++i)
		for(int j=0;j<i;++j)
			if(p[j]>p[i]) ++ans;
	return ans;
}
int main(){
	cin>>n;
	for(int i=0;i<n;++i)
		cin>>a[i];
	for(int i=0;i<n;++i)
		cin>>b[i];
	int ans=114514;
	for(int i=0;i<(1<<n);++i)
		ans=min(ans,solve(i));
	if(ans==114514) return puts("-1"),0;
	cout<<ans;
	return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
#include <fstream>
using namespace std;
#define rep(i, a, b) for (ll i = (a); i < (b); i++)
#define rep2(r, aa, bb) for (ll r = (aa)-1; r >= (bb); r--)
#define be(x) (x.begin(), x.end())
#define pb(t) push_back(t)
#define ll long long
int main()
{
    int n,w;
    cin>>n>>w;
    vector<pair<ll,int>>A(n);
    rep(i,0,n)cin>>A[i].first>>A[i].second;
    ll int dp[n+1][w+1];
    rep(ind,0,n+1)
    {
        rep(weight, 0, w+1)
        {
            if(ind==0||weight==0)
            {
                dp[ind][weight]=0;
            }
            else if(weight>=A[ind-1].first)
            {
                dp[ind][weight]=max(dp[ind-1][weight], A[ind-1].second+dp[ind-1][weight-A[ind-1].first]);
            }
            else
            {
                dp[ind][weight]=dp[ind-1][weight];
            }
            // cout<<dp[ind][weight]<<" ";
        }
        // cout<<endl;
    }
    cout<<endl;
    // ll count=0;
    // rep(i,0,w+1)count+=dp[n][i];
    // cout<<count;
    cout<<dp[n][w];
}

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

int main(){
    int A,B;
    int ans = -1;
    cin >> A >> B;
    for(int i=10000;i>0;i--){
            if(int(i*0.08) == A && int(i*0.1) == B){                
                ans = i;
            }
        }
        cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i <(n); ++i)
#define REP2(i,x,n) for (int i = x; i <(n); ++i)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
using namespace std;
using ll = long long;
using P = pair<int,int>;
static const double PI = acos(-1);
static const int INF = 1e9+7;
#define REP(i,n) for (int i = 0; i <(n); ++i)
//debug 
#ifdef _DEBUG
#define debug(var)  do{cout << #var << " :";view(var);}while(0)
#else
#define debug(...)
#endif
template<typename T> void view(T e){cout << e << endl;}
template<typename T> void view(const vector<T>& v){for(const auto& e : v){ cout << e << " "; } cout << endl;}
template<typename T> void view(const vector<vector<T> >& vv){ for(const auto& v : vv){ view(v); } }


int main(){
  int n;
  cin >> n;
  int k;
  cin >> k;
  vector<int> x(n);
  REP(i,n) cin >> x[i];

  ll ans = 0;
  REP(i,n){
    int l = x[i]*2;
    int r = abs(x[i] - k) *2;
    ans += min(l, r);
    debug(l);
    debug(r);
  }

  cout << ans << endl;

  return 0;
}

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

bool comp(const long long int &a,const long long int &b){
    return a>b;
}


int main(){
    bool check = true;
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    long long int ans = -1;
    cin >> n;
    long long int vi[n];
    for (int i=0;i<n;i++) cin >> vi[i];
    sort(vi,vi+n,comp);
    long long int l1 = -1;
    for (int i=0;i<n-1;i++){
        if (vi[i] == vi[i+1] && vi[i+1] == vi[i+2] && vi[i+2] == vi[i+3]){
            check = false;
            ans = max(ans,vi[i]*vi[i]);
        }else if (l1 == -1 && vi[i] == vi[i+1]){
            l1 = vi[i];
            i++;
            continue;
        }if ( l1 != -1 && vi[i] == vi[i+1] && vi[i] != l1){
            check = false;
            //cout << l1 << " " << vi[i] << endl;
            ans = max(ans,l1*vi[i]);
        }
    }
    if (check) cout << 0;
    else cout << ans;
    return 0;
}

Measured memory_bytes: 1024
import std.stdio, std.conv, std.functional, std.string;
import std.algorithm, std.array, std.container, std.range, std.typecons;
import std.numeric, std.math, std.random;
import core.bitop;

string FMT_F = "%.10f";

static string[] s_rd;
T RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
string RDR()() { return readln.chomp; }
T[] ARR(T = long)(in string str, T fix = 0) { auto r = str.split.to!(T[]); r[] += fix; return r; }
size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

bool inside(T)(T x, T b, T e) { return x >= b && x < e; }
long lcm(long x, long y) { return x * y / gcd(x, y); }

long mod = 10^^9 + 7;
//long mod = 998244353;
//long mod = 1_000_003;
void moda(ref long x, long y) { x = (x + y) % mod; }
void mods(ref long x, long y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(ref long x, long y) { x = (x * y) % mod; }

void main()
{
	auto A = RD!string;
	auto B = RD!string;
	auto ab = (A ~ B).to!long;
	bool ok;
	for (int i = 1; i*i <= ab; ++i)
	{
		if (i * i == ab)
			ok = true;
	}

	writeln(ok ? "Yes" : "No");
	stdout.flush();
	debug readln();
}

Measured memory_bytes: 256
N, M = map(int, input().split())

flag = [ 0 for i in range(N+1)]
dp = [0 for i in range(N+1)]

for _ in range(M):
    a = int(input())
    flag[a] = 1


dp[0] = 1
if flag[1] == 1:
    dp[1] = 0
else:
    dp[1] = 1;

for i in range(2, N+1):
    if flag[i] == 1:
        dp[i] = 0
    else:
        dp[i] = (dp[i-1] + dp[i-2]) % 1000000007

print(dp[N])


Measured memory_bytes: 7832
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
typedef long double ld;
const ll INF = 1e+14;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back

void Yes(){
	cout<<"Yes"<<endl;
	exit(0);
}
 
void No(){
	cout<<"No"<<endl;
	exit(0);
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
    int H, W;
    cin >> H >> W;
    char a[1010][1010];
    rep(i, H) rep(j, W) cin >> a[i][j];
    ll dp[1010][1010];
    dp[0][0] = 1LL;
    rep(i, H) {
        rep(j, W) {
            if(a[i][j] != '#') {
                if(i - 1 >= 0) dp[i][j] += dp[i - 1][j];
                if(j - 1 >= 0) dp[i][j] += dp[i][j - 1];
                dp[i][j] %= mod;
            } 
        }
    }
    cout << dp[H - 1][W - 1] << endl;
	return 0;
}

Measured memory_bytes: 9216
n = int(input())
h = [int(i) for i in input().split(' ')]
 
for i, e in enumerate(h[-2::-1]):
    if h[len(h) - i - 1] - e == -1:
        h[len(h) - i - 2] -= 1
    elif h[len(h) - i - 1] - e >= 0:
        continue
    else:
        print('No')
        exit(0)
 
print('Yes')


Measured memory_bytes: 14252
#include <iostream>
#include <algorithm>
#include <map>

using namespace std;

int main(int argc, char** argv){
    int N, M;
    cin >> N >> M;
    map<long long int, long long int> mp;
    for (int i=0; i<N; i++){
        long long int A;
        cin >> A;
        if (mp.count(A)) mp[A]++;
        else mp[A] = 1;
    }
    for (int i=0; i<M; i++){
        int B;
        long long int C;
        cin >> B >> C;
        if (mp.count(C)) mp[C] += B;
        else mp[C] = B;
    }
    auto itr = mp.rbegin();
    long long int sum = 0;
    int addable = N;
    while (1){
        long long int val = itr->first;
        long long int num = itr->second;
        if (num <= addable){
            sum += val * num;
            addable -= num;
        } else {
            sum += val * addable;
            break;
        }
        itr++;
    }

    cout << sum << "\n";

    return 0;
}


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

using namespace std;
long long L[200005],arr[200005],n;

int lis()
{
    multiset<int> last;
    for (int i = 0; i < n; i++) {

        multiset<int>::iterator it = last.lower_bound(arr[i]);

        if (it == last.begin())
            last.insert(arr[i]);

        else {
            it--;

            last.erase(it);
            last.insert(arr[i]);
        }
    }
    return last.size();
}

int main()
{
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>arr[i];
        L[i]=1;
    }
    cout << lis()<<endl;

    return 0;
}


Measured memory_bytes: 6528
n = int(input())
p = [int(input()) for i in range(n)]
x,r,num,ans = [0 for i in range(n)],0,1,0
for i in range(n): x[p[i]-1] = i
while r!=n-1:
	r += 1
	if x[r-1]<x[r]: num = num+1
	else: ans,num = max(ans,num),1
ans = max(ans,num)
print(n-ans)


Measured memory_bytes: 18888
#include <bits/stdc++.h>
using namespace std;
double sum[200005];
int main()
{
    int n,m;
    cin>>n>>m;
    for(int i=1;i<=n;++i)
    {
        int a;
        cin>>a;
        sum[i]=sum[i-1]+(1.0/a)*(a+1)*a/2;
    }
    double  maxn=-1;
    for(int i=m;i<=n;++i)
    {
        maxn=max(maxn,sum[i]-sum[i-m]);
    }
   cout<<fixed<<setprecision(13)<<maxn<<endl;
    return 0;
}



Measured memory_bytes: 1792
N = int(input())
A = list(map(int, input().split()))
count = 0
sat = 0
for a in A:
    if a % 2 == 0:
        count += 1
        if a % 3 == 0 or a % 5 ==0:
            sat += 1
if count == sat:
    print('APPROVED')
else:
    print('DENIED')

Measured memory_bytes: 9112
n,k=map(int,input().split())
a=list(map(int,input().split()))
s=1
sa=set()
d=dict()
count=0
niko=0
anss=0
bx=False
while True:
  count+=1
  if count==k:
    anss=a[s-1]
    bx=True
    print(a[s-1])
    count-1
    break
  if not (a[s-1] in sa):
    sa.add(a[s-1])
    d[a[s-1]]=count
    s=a[s-1]
  else:
    niko=a[s-1]
    number=count-d[a[s-1]]
    break
if bx==False:
  lf=False
  ans_list=[]
  kaisu=0
  for i,j in d.items():
    if i==niko:
      lf=True
      kaisu=j
    if lf==True:
      ans_list.append(i)
  print(ans_list[(k-kaisu)%number])
    
    
    
  

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

#define PB push_back
#define MP make_pair
#define fi first
#define se second

typedef long long LL;

const double EPS=1e-9;
const double PI=acos(-1.0);
const int MAXN=100005;
const LL MOD=1000000007;
const int dx[8]={-1, 0, 1, -1, 1, -1, 0, 1}, dy[8]={-1, -1, -1, 0, 0, 1, 1, 1};

void base(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
}

int cnt[26];

int main(){
	base();
	int tc;
	cin>>tc;

	while(tc--){
		int n, d;
		cin>>n>>d;
		if(n%2){
			cout<<127*(n-1)+d<<endl;
		}
		else{
			cout<<127*(n-1)+(d^127)<<endl;
		}
	}

	return 0;
}


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

 int main()
     {
  int a,b;
  cin>>a>>b;
  if(a==b)
    cout<<"Draw";
 else  if(a==1)
    cout<<"Alice";
  else if(b==1)
    cout<<"Bob";
    else if(a>b)
         cout<<"Alice";
    else if(b>a)
        cout<<"Bob";


   return 0;
     }


Measured memory_bytes: 3568
/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <bits/stdc++.h>

using namespace std;

int main()
{
    //cout<<"Hello World";
    long long int n,k;
    cin>>n>>k;
    
    if(n%k ==0)
    cout<<0<<endl;
    else
    cout<<1<<endl;
    
    
    return 0;
}


Measured memory_bytes: 384
N, M = map(int,input().split())

shop = {}
b = [0] * N


for i in range(N):
    tmp = list(map(int,input().split()))
    shop[i] = tmp[0]
    b[i] = tmp[1]


shop = sorted(shop.items(), key=lambda x:x[1])


ans = 0
tmp = 0
for i in range(N):
    if(tmp + b[shop[i][0]] >= M):
       ans += shop[i][1] * (M - tmp)
       break
    else:
        ans += shop[i][1] * b[shop[i][0]]
        tmp += b[shop[i][0]]


print(ans)

Measured memory_bytes: 28152
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
signed main() {
	ios::sync_with_stdio(false); cin.tie(0);
	string s;
	cin >> s;
	int n = (int) s.length();
	int ans = n;
	for (int i = 0; i + 1 < n; i++) {
		if (s[i] != s[i + 1]) ans = min(ans, max(i + 1, n - i - 1));
	}
	cout << ans << endl;
	return 0;	
}

Measured memory_bytes: 512
#include <cstdio>
#include <algorithm>

using namespace std;

typedef long long lint;

int main()
{
	int N;
	lint A[100000];
	
	scanf("%d", &N);
	
	for (int i = 0; i < N; i++) scanf("%lld", A + i);
	
	sort(A, A + N);
	reverse(A, A + N);
	
	lint ans = 0;
	for (int i = 0; i + 2 < N; i++){
		if (A[i] < A[i + 1] + A[i + 2]){
			for (int j = i + 3; j + 2 < N; j++){
				if (A[j] < A[j + 1] + A[j + 2]){
					ans = A[i] + A[i + 1] + A[i + 2] + A[j] + A[j + 1] + A[j + 2];
					break;
				}
			}
			break;
		}
	}
	
	bool flag = false;
	for (int i = 0; i + 5 < N; i++){
		int ind[] = {i, i + 1, i + 2, i + 3, i + 4, i + 5};
		do {
			if (A[ind[0]] < A[ind[1]] || A[ind[0]] < A[ind[2]] || A[ind[3]] < A[ind[4]] || A[ind[3]] < A[ind[5]]) continue;
			if (A[ind[0]] < A[ind[1]] + A[ind[2]] && A[ind[3]] < A[ind[4]] + A[ind[5]]){
				ans = max(ans, A[i] + A[i + 1] + A[i + 2] + A[i + 3] + A[i + 4] + A[i + 5]);
				flag = true;
				break;
			}
		} while (next_permutation(ind, ind + 6));
		if (flag) break;
	}
	
	printf("%lld\n", ans);
	
	return (0);
}

Measured memory_bytes: 1820
let m, cs, c, d = Scanf.scanf "%d %d" @@ fun n m -> m, Array.make n (0, 0), ref 0, ref 0
let _ = for _ = 1 to m do Scanf.scanf " %d %s" @@ fun p s -> let a, w = cs.(p - 1) in if s = "AC" then (if a = 0 then (d := !d + w; cs.(p - 1) <- 1, w; incr c)) else cs.(p - 1) <- a, w + 1 done; Printf.printf "%d %d\n" !c !d

Measured memory_bytes: 6784