akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define endl "\n"
using namespace std;
#define ll long long
#define ld long double
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repo(i,n) for(int i = 1; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
#define np next_permutation
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define uniq(v) v.erase(unique(v.begin(),v.end()),v.end())
#define lb(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define ub(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
using Pair = pair<ll,pair<int,int>>;
#define pq priority_queue<Pair, vector<Pair>, greater<Pair>> 
const ll mod=1000000007;
//const ll mod=998244353;
const ld pi=acos(-1.0);
const ll INF = 1LL<<61;
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; }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'大文字'+=32;    で小文字に
//  cout << fixed << setprecision (20);   小数点以下2０桁まで
//実行時間制約2秒では２×10^8回くらいまで計算できる


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

  int n,k;
  cin>>n>>k;

  vector<ll> p(n);
  vector<ll> q(n);
  rep(i,n){
    cin>>p[i]>>q[i];
  }

  ll ans=8e18;
  rep(a,n){
    rep(b,n){
      rep(c,n){
        rep(d,n){
          ll sx=p[a];
          ll gx=p[b];
          ll sy=q[c];
          ll gy=q[d];
          int cnt=0;
          rep(e,n){
            if(sx<=p[e]&&p[e]<=gx && sy<=q[e]&&q[e]<=gy){
              cnt++;
            }
          }
          if(cnt>=k) chmin(ans,(gx-sx)*(gy-sy));
        }
      }
    }
  }

  cout << ans << endl;
}

Measured memory_bytes: 3664
using System;
using System.Collections.Generic;
using System.Linq;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var b = Console.ReadLine();
            if (b[0] == 'A')
            {
                Console.WriteLine('T');
            }
            else if (b[0] == 'C')
            {
                Console.WriteLine('G');
            }
            else if (b[0] == 'G')
            {
                Console.WriteLine('C');
            }
            else if (b[0] == 'T')
            {
                Console.WriteLine('A');
            }
        }
    }
}


Measured memory_bytes: 11092
#include <bits/stdc++.h>
using namespace std;
  
int main() {
  long long N;
  cin >> N;
  long long X = 0;
  
  vector<long long> A(N);
  vector<long long> B(N);
  for (int i = 0; i < N; i++) {
    cin >> A.at(i);
    if (i == 0){
      B.at(i) = X;
    }
    else if (i % 2 == 0){
      X += A.at(i-1) - A.at(i-2);
    }
    B.at(i) = X;
  }
  
  X = (A.at(N-1) - B.at(N-1))/2;
  
  for (int i = 0; i < N; i++) {
    cout << X*2;
    X = A.at(i) - X;
    if (i == N-1){
      cout << endl;
    }
    else {
      cout << ' ';
    }
  }
}
  

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

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

const int INF = 1000000007;

int main(void){
	string S; cin>>S;

	//condition1,2,3
	bool con1 = false, con2 = false, con3 = false;
	if(S[0] == 'A') con1 = true;

	int c_cnt = 0;
	for(int i=2;i<S.size() - 2 + 1;i++) {
		if(S[i] == 'C') c_cnt++;
	}
	if(c_cnt == 1) con2 = true;

	//small character
	int sc_cnt = 0;
	for(int i=0;i<S.size();i++) {
		if('a' <= S[i] && S[i] <= 'z') sc_cnt++;
	}
	if(sc_cnt == (S.size() - 2)) con3 = true;

	if((con1) && (con2) && (con3)) cout<< "AC" <<endl;
	else cout<< "WA" <<endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using LL = long long;

int main() {
  std::vector<LL> stack;
  int n, m;
  scanf("%d%d", &n, &m);
  stack.emplace_back(n);
  for (int i = 0; i < m; i++) {
    LL x;
    scanf("%lld", &x);
    while (stack.size() && stack.back() >= x) stack.pop_back();
    stack.emplace_back(x);
  }
  std::map<LL, LL> positions;
  positions.insert({stack.back(), 1});
  while (stack.size()) {
    LL position = stack.back(); stack.pop_back();
    auto pos = positions.upper_bound(position);
    for(auto itr = pos; itr != positions.end(); itr++) {
      LL x, y;
      std::tie(x, y) = *itr;
      LL k = x / position, b = x % position;
      positions[position] += y * k;
      positions[b] += y;
    }
    positions.erase(pos, positions.end());
  }
  LL now = 0;
  std::vector<LL> answer(n, 0);
  for (int i = n; i >= 1; i--) {
    now += positions[i];
    answer[i - 1] = now;
  }
  for (auto x: answer) {
    printf("%lld\n", x);
  }
  return 0;
}


Measured memory_bytes: 12020
def print_ans():
    for i in field:
        print("".join(i))
    exit()
        
h,w,a,b=map(int,input().split())

field=[["0"]*w for i in range(h)]

if a==0:
    if b==0:
        print_ans()
    else:
        for i in range(b):
            field[i]=["1"]*w
        print_ans()
if b==0:
    for i in range(h):
        for j in range(a):
            field[i][j]="1"
    print_ans()
    
for i in range(h):
    for j in range(w):
        if i<b and j<a:
            field[i][j]="1"
        if i>=b and j>=a:
            field[i][j]="1"
print_ans()

Measured memory_bytes: 49008
# -*- coding:utf-8 -*-
from collections import deque

def solve():
    n = int(input())
    A = input().split()

    """方針
    A = 0 6 7 6 7 0
    i | b
    ---------------
    1 | 0
    2 | 0 6 (本当は逆で6 0)
    3 | 7 0 6
    4 | 7 0 6 6 (本当は逆で 6 6 0 7)
    5 | 7 7 0 6 6
    6 | 7 7 0 6 6 0 (本当は逆で0 6 6 0 7 7) 

    ・iが偶数のとき、bの後ろにA[i]を追加する
    ・iが奇数のとき、bの前にA[i]を追加する

    上の操作をn回すべてしたあとに、

    ・nが偶数なら答えを反転する
    ・nが奇数なら答えはそのまま

    ただし、A[i]は2桁以上の数字の可能性も考慮すること

    あとPythonは、list.insert()はとても遅いので（TLEしたので）、代わりにcollections.dequeを使用する

    ・collections.deque
    https://docs.python.org/ja/3/library/collections.html#collections.deque

    dequeとは、「両端における append や pop を高速に行えるリスト風のコンテナ」
    """

    # 1 2 3 -> 3 1 2
    b = deque()
    for i in range(1, n+1):
        if i%2 == 0:
            b.append(A[i-1])
        else:
            b.appendleft(A[i-1])

    if n%2 == 0:
        ans = ""
        for i in range(n-1, -1, -1):
            ans += b[i] + " "
        print(ans[:-1])
    else:
        ans = " ".join(b)
        print(ans)


if __name__ == "__main__":
    solve()


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

int main()
{
    string S;
    cin >> S;
    ll sum = 0;

    for(ll bits = 0; bits < (1 << S.size()); bits++)
    {
        ll tmp = 0;
        for(int i = 0; i < S.size(); i++)
        {
            ll tmpNum = S.at(i) - '0';
            tmp = tmp*10+tmpNum;
            //cout << "tmp:" << tmp << endl;
            if(bits & (1 << i) || i == S.size()-1) 
            {
                
                sum += tmp;   
                tmp = 0;
            }
            //cout << "sum:" << sum << endl; 
        }
    }

    cout << sum/2 << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using VI = vector<int>;
using VL = vector<ll>;
template<class T> using PQ = priority_queue<T, vector<T>, greater<T>>;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);++(i))
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);++(i))
#define rFOR(i,a,n) for(int (i)=(n)-1;(i)>=(a);--(i))
#define erFOR(i,a,n) for(int (i)=(n);(i)>=(a);--(i))
#define each(i, a) for(auto &i : a)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
#define out(y,x) ((y) < 0 || h <= (y) || (x) < 0 || w <= (x))
#define line cout << "------------------------\n" 
#define ENDL(i,n) ((i) == (n) - 1 ? "\n" : " ")
#define stop system("pause") //comment out this on AOJ.
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
constexpr ld eps = 1e-10; //1e-9?
constexpr ld pi = 3.1415926535897932;
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; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }
template<class T>inline istream& operator>>(istream& is, vector<T>& v) { for (auto& elemnt : v)is >> elemnt; return is; }
template<class T, class U>inline istream& operator>>(istream& is, pair<T, U>& p) { is >> p.first >> p.second; return is; }
template<class T>inline vector<T> vec(size_t a) { return vector<T>(a); }
template<class T>inline vector<T> defvec(T def, size_t a) { return vector<T>(a, def); }
template<class T, class... Ts>inline auto vec(size_t a, Ts... ts) { return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...)); }
template<class T, class... Ts>inline auto defvec(T def, size_t a, Ts... ts) { return vector<decltype(defvec<T>(def, ts...))>(a, defvec<T>(def, ts...)); }

int main() {
    init();

    ll n, k; cin >> n >> k;
    ll a = k;
    int ans = 1;
    if (n < a) {
        cout << ans << "\n";
        return 0;
    }
    while (1) {
        a *= k;
        ++ans;
        if (n < a) {
            cout << ans << "\n";
            return 0;
        }
    }
}

Measured memory_bytes: 256
using System;

namespace Tenka2019
{
    class ProgramC
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var s = Console.ReadLine();

            var bL2R = new int[n];
            var wR2L = new int[n];

            var tmp = 0;
            for (var i = 0; i < n; i++)
            {
                if (s[i] == '#') // Black
                {
                    tmp++;
                }
                bL2R[i] = tmp;
            }

            tmp = 0;
            for (var i = 0; i < n; i++)
            {
                if (s[n - i - 1] == '.') // white
                {
                    tmp++;
                }
                wR2L[i] = tmp;
            }

            var minCount = wR2L[n - 1];
            for (var i = 0; i < n - 1; i++)
            {
                var count = bL2R[i] + wR2L[n - i - 2];
                minCount = Math.Min(minCount, count);
            }

            minCount = Math.Min(minCount, bL2R[n-1]);

            Console.WriteLine(minCount);
        }
    }
}


Measured memory_bytes: 13280
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <cassert>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <list>


using namespace std;

#ifdef _MSC_VER
#define __typeof__ decltype
template <class T> int __builtin_popcount(T n) { return n ? 1 + __builtin_popcount(n & (n - 1)) : 0; }
#endif

#define foreach(it, c) for (__typeof__((c).begin()) it=(c).begin(); it != (c).end(); ++it)
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define CLEAR(arr, val) memset(arr, val, sizeof(arr))

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

template <class T> void max_swap(T& a, const T& b) { a = max(a, b); }
template <class T> void min_swap(T& a, const T& b) { a = min(a, b); }

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

const double EPS = 1e-8;
const double PI = acos(-1.0);
const int dx[] = { 0, 1, 0, -1 };
const int dy[] = { 1, 0, -1, 0 };



int main()
{
	static int dp[1 << 10][810];
	dp[0][0] = 1;
	for (int s = 0; s < 1 << 10; ++s)
	{
		int n = __builtin_popcount(s);
		for (int k = 0; k < 10; ++k)
		{
			if (!(s >> k & 1))
			{
				int ns = s | (1 << k);
				int add = (n + 1) * k;

				for (int i = 0; i < 333; ++i)
					dp[ns][i + add] += dp[s][i];
			}
		}
	}

	static int table[11][810];
	for (int s = 0; s < 1 << 10; ++s)
		for (int i = 0; i < 333; ++i)
			table[__builtin_popcount(s)][i] += dp[s][i];

	int n, s;
	while (~scanf("%d%d", &n, &s))
		printf("%d\n", table[n][s]);
}

Measured memory_bytes: 0
EPS = 0.0001

# しきい値を決める際に、ベクトル演算をするのだが、
# line, a,b で計算したときESPの誤差を許容する必要がある


# a, b, はラインの同一側にあるか。　-1, 0, 1
def atSameSide(a, b, line):
    sa = (line[1].real-line[0].real)*(a.imag-line[0].imag) \
         + (line[1].imag-line[0].imag)*(line[0].real-a.real);
    sb = (line[1].real-line[0].real)*(b.imag-line[0].imag) \
         + (line[1].imag-line[0].imag)*(line[0].real-b.real);
    if -EPS <= sa and sa <= EPS: return 0          # a in line
    if -EPS <= sb and sb <= EPS: return 0          # b in line
    if sa*sb >= 0: return 1           # a,b at same side
    return -1;
 
while True:
    try: p = list(map(float, input().split(',')))
    except: break
     
    p1 = complex(p[0], p[1])
    p2 = complex(p[2], p[3])
    p3 = complex(p[4], p[5])
    p4 = complex(p[6], p[7])
    if atSameSide(p2, p4, [p1, p3]) == -1 and \
       atSameSide(p1, p3, [p2, p4]) == -1: print('YES')
    else: print('NO')



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

#define REP(i, x) REPI(i, 0, x)
#define REPI(i, a, b) for (int i = int(a); i < int(b); ++i)
#define ALL(x) (x).begin(), (x).end()

typedef long long ll;
using namespace std;

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

  ll X;
  cin >> X;

  vector<ll> sum(100010, 0);
  map<ll, ll> m;

  for (ll i = 1; i < 1e5; ++i) {
    sum.at(i) = sum.at(i - 1) + i;
    m.insert(make_pair(sum.at(i), i));
  }

  ll c = *lower_bound(sum.begin(), sum.end(), X);
  cout << m.at(c) << endl;

  return 0;
}


Measured memory_bytes: 7296
import numpy
import re
import math

def main():
	"""
	テストコード実行
	:return:
	"""
	#文字列を逆順にして、該当する単語を除いていく
	#eraseとeraserは"er"を決してしまうと判定できないので、先に消去
	n = int(input())
	#t, x, y = list(map(int, [re.split(" +", input()) for i in range(n)]))
	for i in range(n):
		t, x, y = map(int, input().split())
		if t < x + y or (x + y + t) % 2:
			print("No")
			exit()
	print("Yes")

if __name__ == '__main__':
	main()

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

int main(){
  string S;
  cin >> S;
  vector<int> alph(26);
  for(char c: S){
    int idx = c - 'a';
    alph[idx] = 1;
  }
  char ans;
  int i;
  for(i = 0; i < 26; i++){
    if(alph[i] == 0){
      ans = i + 'a';
      break;
    }
  }
  if(i == 26){
    cout << "None" << endl;
  }else{
    cout << ans << endl;
  }
}

Measured memory_bytes: 512
#include<stdio.h>
#include<stdlib.h>
int main()
{
	int i = 0, j = 0;
	int sum = 0;
	int a[100];
	int n, x;
	scanf("%d%d", &n, &x);
	for (i = 0; i < n; i++)
		scanf("%d", &a[i]);
	for (i = 0; i < n; i++)
		sum += a[i];
	int t = x - sum;
	for (i = 0; i<n-1; i++) 
		for (j = 0; j<n - i - 1; j++)
			if (a[j]>a[j + 1])
			{
				int temp = a[j];
				a[j] = a[j + 1];
				a[j + 1] = temp;
			}
		t = t / a[0];
		printf("%d", t + n);
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
using Graph=vector<vector<int>>;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
typedef long long ll;
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
int main(){
    int A,B;
    cin>>A>>B;
    cout<<A*B<<endl;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define endl '\n'
#define all(x) (x).begin(),(x).end()
const int INF=1e9+5;
const int N=3e5+5;
const int mod=1e9+7;

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n,m,nums;
	cin>>n>>m>>nums;
	vector<int> x(nums),y(nums);
	vector<int> rows(N),cols(N);
	for(int i=0;i<nums;++i){
		cin>>x[i]>>y[i];
		++rows[x[i]];
		++cols[y[i]];
	}
	int cnt_row=0,cnt_col=0;
	int max_row=0,max_col=0;
	for(int i=0;i<N;++i){
		if(rows[i]>max_row){
			max_row=rows[i];
			cnt_row=0;
		}
		if(rows[i]==max_row) ++cnt_row;
	}
	for(int i=0;i<N;++i){
		if(cols[i]>max_col){
			max_col=cols[i];
			cnt_col=0;
		}
		if(cols[i]==max_col) ++cnt_col;
	}
	int ans=max_row+max_col;
	int cnt=0;
	for(int i=0;i<nums;++i){
		if(rows[x[i]]==max_row&&cols[y[i]]==max_col) ++cnt;
	}
	if(cnt==cnt_col*cnt_row) --ans;
	cout<<ans;
	return 0;
}


Measured memory_bytes: 7952
D = int(input())
c = [int(i) for i in input().split()]
s = []
for _ in range(D):
    s.append([int(i) for i in input().split()])
score = 0
days = [0]*26
for k in range(D):
    t = int(input())-1
    for i in range(26):
        if i == t:
            days[i] = 0
        else:
            days[i] += 1
    score += s[k][t]
    for i in range(26):
        score -= days[i]*c[i]
    print(score)

Measured memory_bytes: 74548
import java.util.Scanner

object Main extends App{
  val sc = new Scanner(System.in)

  val a = sc.nextLong
  val b = sc.nextLong

  val g = gcd(a,b)
  val sqrtG = Math.sqrt(g).ceil.toLong

  val res =
    g match {
      case 1 => 1
      case 2 => 2
      case 3 => 2
      case gg => {
        val temp = loop( (gg, Vector(1), 2) )._2
        temp.size
      }
    }

  println(res)


  def gcd(a: Long, b: Long): Long ={
    (a,b) match{
      case (x,y) if y == 0 => x
      case (x,y) if x < y  => gcd(y, x)
      case (x,y)           => gcd(y, x % y)
    }
  }

  def loop( tuple: (Long, Vector[Long], Long)): (Long, Vector[Long], Long) = {
    val (n, vec, diviser) = tuple
    if( n == 1 ) {
      (n, vec, diviser)
    } else if (diviser > sqrtG){
      (n, vec :+ n, diviser)
    }    else {
      def divLoop(num: Long, d: Long): Long =
        if(num % d != 0) num else divLoop(num / d, d)

      val newN = divLoop(n, diviser)
      val newVec = if(newN == n) vec else vec :+ diviser

      loop((newN, newVec, diviser + 1))
    }
  }



}

Measured memory_bytes: 44688
#include <cstdio>
#include <cmath>
#include <iostream>
#include <set>
#include <algorithm>
#include <vector>
#include <map>
#include <cassert>
#include <string>
#include <cstring>
#include <queue>

using namespace std;

#define rep(i,a,b) for(int i = a; i < b; i++)
#define S(x) scanf("%d",&x)
#define S2(x,y) scanf("%d%d",&x,&y)
#define P(x) printf("%d\n",x)
#define all(v) v.begin(),v.end()
#define FF first
#define SS second
#define pb push_back
#define mp make_pair

typedef long long int LL;
typedef pair<int, int > pii;
typedef vector<int > vi;

const int N = 12;

string s[N];
int h,w;
vector<pii > pairs;
bool ans = false;

int bit(int x, int y) {
  return (x >> y) & 1;
}

bool isPlain(string a) {
  string b = a;
  reverse(all(b));
  return a == b;
}

bool check() {
  vi v;
  rep(i,0,pairs.size()) v.pb(pairs[i].FF);
  for(int i = pairs.size() - 1; i >= 0; i--) if(pairs[i].FF != pairs[i].SS) {
    v.pb(pairs[i].SS);
  }
  assert(v.size() == h);
  vector<string > st;
  rep(j,0,w) {
    string tmp;
    for(int i = h - 1; i >= 0; i--) {
      tmp += s[v[i]][j];
    }
    bool ok = false;
    rep(i,0,st.size()) if(st[i] == tmp) {
      rep(k,i+1,st.size()) {
        st[k - 1] = st[k];
      }
      st.pop_back();
      ok = true;
      break;
    }
    if(ok) continue;

    tmp = "";
    for(int i = 0; i < h; i++) {
      tmp += s[v[i]][j];
    }
    st.pb(tmp);
  }
  if(st.size() > 1) {
    return false;
  }
  if(st.size() == 1) {
    return isPlain(st.back());
  }
  return true;
}

void solve(int mask) {
  if(ans) {
    return;
  }
  if(mask == 0) {
    if(check()) {
      ans = true;
    }
    return;
  }
  if(__builtin_popcount(mask) == 1) {
    rep(i,0,h) if(bit(mask, i)) {
      pairs.pb(mp(i, i));
    }
    solve(0);
    pairs.pop_back();
    return;
  }

  int cnt = 0;
  rep(i,0,h) if(bit(mask, i)) {
    cnt++;
    rep(j,i+1,h) if(bit(mask, j)) {
      pairs.pb(mp(i, j));
      solve(mask ^ (1 << i) ^ (1 << j));
      pairs.pop_back();
    }
    if(cnt == 1 && h % 2 == 0) break;
    if(cnt == 2 && h % 2 == 1) break;
  }
}

int main() {
  S2(h,w);
  rep(i,0,h) cin >> s[i];
  solve((1 << h) - 1);
  if(ans) printf("YES\n");
  else printf("NO\n");
  return 0;
}


Measured memory_bytes: 384
#!python3

iim = lambda: map(int, input().rstrip().split())

def resolve():
    N = int(input())
    A = tuple(iim())

    for x in A:
        if (x % 2 == 0) and x % 3 and x % 5:
            print("DENIED")
            return
    print("APPROVED")

if __name__ == "__main__":
    resolve()


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

using namespace std;

#define deb(x) cout << #x << " " << x << endl;

typedef long long ll;
const ll mod = 1000000007;

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

int a[200000];
int main(){
    //freopen("input.txt", "r", stdin);
   // freopen("output.txt", "w", stdout);
    int t,i,n,j,k;
    ll sum=0;
    cin>>n>>k;
    For(i,n){
        cin>>a[i];
    }
    sort(a, a+n);
    if(k>=n)
        cout<<0;
    else{
        n=n-k;
        For(i,n){
            sum+=a[i];
        }
        cout<<sum;
    }
    return 0;
}

Measured memory_bytes: 1024
let quick_sort (a : (int * char * int) array) n cmp =
  let swap i j = let tmp = a.(i) in a.(i) <- a.(j); a.(j) <- tmp in
  let partition p r =
    let i = ref p in
    for j = p to r - 1 do
      if cmp a.(j) a.(r) <= 0 then begin
        swap !i j;
        incr i;
      end
    done;
    swap !i r;
    !i in
  let rec doit p r =
    if p >= r then () else
    let q = partition p r in
    doit p (q - 1);
    doit q r in
  doit 0 (n - 1)

let stable_p (a : (int * char * int) array) n =
  try
    for i = 1 to n - 1 do
      if (fun (xi, _, xd) (yi, _, yd) -> xd = yd && xi > yi) a.(i-1) a.(i) then raise Exit
    done;
    true
  with Exit -> false

let split_on_char sep s =
  let open String in
  let r = ref [] in
  let j = ref (length s) in
  for i = length s - 1 downto 0 do
    if get s i = sep then begin
      r := sub s (i + 1) (!j - i - 1) :: !r;
      j := i
    end
  done;
  sub s 0 !j :: !r

let () =
  let n = read_int () in
  let a = Array.init n (fun i ->
    match read_line () |> split_on_char ' ' with
    | [c; d] -> (i, c.[0], int_of_string d)
    | _ -> assert false) in
  quick_sort a n (fun (_, _, x) (_, _, y) -> compare x y);
  print_endline (if stable_p a n then "Stable" else "Not stable");
  Array.iter (fun (_, c, d) -> Printf.printf "%c %d\n" c d) a

Measured memory_bytes: 9836
#include <bits/stdc++.h>
#define smax(a, b) ((a) < (b) ? ((a)=(b), true) : false)
#define smin(a, b) ((a) > (b) ? ((a)=(b), true) : false)
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
using namespace std;
typedef long long ll;

ll n;
ll a[3001];
ll dp[3001][3001];

ll dps(int l, int r)
{
    if(dp[l][r] != 0) return dp[l][r];
    if(l == r) return a[l];

    dp[l][r] = max(-1 * dps(l+1, r) + a[l], -1 * dps(l, r-1) + a[r]);
    return dp[l][r];
}
int main() {
    cin >> n;
    for(int i = 0; i < n; i++)
    {
        cin >> a[i];
    }

    cout << dps(0, n-1) << endl;;
}

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

int main() {
	int n,sum=0,c=0;
	cin>>n;
	vector<int>a(n);
	for(int i=0;i<n;++i){
		cin>>a.at(i);
		sum+=a.at(i);
	}
	int ans=0x40000000;
	for(int i=1;i<n;++i)
		if(a.at(i-1)==a.at(i))++c;
	if(c==n-1){
		ans=0;
	}else{
		for(int i=-100,t;i<=100;++i){
			t=0;
			for(int j=0;j<n;++j)
				t+=(a.at(j)-i)*(a.at(j)-i);
			ans=min(ans,t);
		}
	}
	cout<<ans<<"\n"s;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<cstring>

char s[200010];
int main() {
    scanf("%s", s);
    int len = strlen(s);
    int sum = 0;
    for (int i = 0; i < len; i++)sum += s[i] - '0';
    if (sum % 9 == 0) {
        puts("Yes");
    }
    else {
        puts("No");
    }
}



Measured memory_bytes: 1796
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define REP(i,s,n) for(int i=s; i<(n); ++i)
#define ALL(n) begin(n),end(n)
using ll = long long;
const ll INF = 1e18;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

int main(){
    int N;
    cin >> N;

    int amari = N % 10;
    if (amari == 3){
        cout << "bon" << endl;
    } else if(amari == 0 || amari == 1 || amari == 6 || amari == 8){
        cout << "pon" << endl;
    } else{
        cout << "hon" << endl;
    }

    return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
#include <stdio.h>
#include <algorithm>
using namespace std;
#define r(i,n) for(int i=0;i<n;i++)
#define rn(i,n) for(int i=1;i<=n;i++)
#define ll long long
const ll mod=1e9+7;



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

  int cnt_0=0,cnt_1=0;
  r(i,s.size()){
    if(s.at(i)=='0')cnt_0++;
    else cnt_1++;
  }
  cout<<min(cnt_0,cnt_1)*2<<endl;

  return 0;

}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
    ll N, T;
    cin >> N >> T;
    ll c, t, m = 10000;
    for ( int i = 0; i < N; i++ ) {
        cin >> c >> t;
        if ( t <= T ) {
            if ( m > c ) m = c;
        }
    }
    if ( m == 10000 ) {
        cout << "TLE\n";
    } else {
        cout << m << "\n";
    }
    return 0;
}

Measured memory_bytes: 384
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using ld=long double;
using ch=char;
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<P> vP;
typedef vector<ch> vc;
typedef vector<vc> vvc;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
#define ROF(i,a,b) for(ll i=a;i>=b;i--)
#define per(i,a) ROF(i,a,0)
#define pb push_back
const ll MOD=1000000007;
const ll MOD2=998244353;
const ld PI=acos(-1);
const ll INF=1e18;
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
struct edge{ll to,cost;};
struct edge2{ll from,to,cost;};

const ll MXV=2e5;
vl G[MXV];
vl seen(MXV,0);
vl ans(MXV,0);
vl a(MXV);

//木の上でLISを頑張る
void dfs(ll s,vl &v){
    seen[s]=1;
    ans[s]=v.size();
    ll sz=G[s].size();
    rep(i,sz){
        ll nv=G[s][i];
        if(seen[nv]==0){
            if(a[nv]>v[v.size()-1]){
                v.pb(a[nv]);
                dfs(nv,v);
                v.pop_back();
            }
            else{
                ll over=v.size()-1,nover=-1;
                while(abs(over-nover)>1){
                    ll mid=(over+nover)/2;
                    if(v[mid]>=a[nv]){
                        over=mid;
                    }
                    else{
                        nover=mid;
                    }
                }
                ll k=v[over];
                v[over]=a[nv];
                dfs(nv,v);
                v[over]=k;
            }
        }
    }
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll n;
    cin >> n;
    a.resize(n);
    rep(i,n){
        cin >> a[i];
    }
    rep(i,n-1){
        ll u,v;
        cin >> u >> v;
        u--,v--;
        G[u].pb(v);
        G[v].pb(u);
    }
    vl vec={a[0]};
    dfs(0,vec);
    rep(i,n){
        cout << ans[i] << '\n';
    }
}

Measured memory_bytes: 33232
#include <stdio.h>

int main(void)
{
	int q, c, n, a, s, f;
	
	scanf("%d", &q);
	while (q--){
		scanf("%d %d %d", &c, &a, &n);
		
		s = 0;
		f = -1;
		while (s != f){
			f = s;
			if (c >= 1 && a >= 1 && n >= 1){
				c--;
				n--;
				a--;
				s++;
			}
			else if (c >= 2 && a >= 1){
				c -= 2;
				a--;
				s++;
			}
			else if (c >= 3){
				c -= 3;
				s++;
			}
		}
		printf("%d\n", s);
	}
		
	return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
 
using namespace std;
 
#define f(i,a,b) for(int i=a;i<b;i++)
#define fll(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) f(i,0,n)
#define fd(i,a,b) for(int i=a;i>=b;i--)
#define pb push_back
#define mp make_pair
#define vi vector< int >
#define vl vector< ll >
#define vvi vector<vector<int> >
#define ss second
#define ff first
#define ll long long
#define lld long double
#define pii pair< int,int >
#define pll pair< ll,ll >
#define sz(a) a.size()
#define inf (1000*1000*1000+5)
#define all(a) a.begin(),a.end()
#define tri pair<int,pii>
#define vii vector<pii>
#define vll vector<pll>
#define viii vector<tri>
#define mod (1000*1000*1000+7)
#define pq priority_queue< int >
#define pqll priority_queue< ll >
#define pdqueue priority_queue< int,vi ,greater< int > >
#define INF 1000000000
#define NINF -1000000000
#define endl '\n'

void solve(){

    ll grade[] = {400 , 600 , 800 , 1000 , 1200 , 1400 , 1600 , 1800};
    ll points[] = {8 , 7 , 6 , 5 , 4 , 3 , 2 , 1};
    ll a;
    cin >> a;
    ll temp = a%200;
    temp = a - temp;
    temp = (temp - 400) /200;
    cout << points[temp] << endl; 
}


int main(){

    #ifndef ONLINE_JUDGE 
  
    // For getting input from input.txt file 
    freopen("input.txt", "r", stdin); 
  
    // Printing the Output to output.txt file 
    freopen("output.txt", "w", stdout); 
  
    #endif 

    ios::sync_with_stdio(0);
    cin.tie(nullptr);
    cout.tie(nullptr);
    cerr.tie(nullptr);
 

    int t = 1;
    // cin >> t;
    
    for (int tt = 0 ; tt < t ; tt++){
        solve();
        // cout << "Case #" << (tt+1) <<":" << endl;
    }
}

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

bool comp(const pair<int, int> a, const pair<int, int> b) {
	return a.second < b.second;
}

int main() {
	int N, M;
	cin >> N >> M;
	vector<pair<int, int>>P(M);
	for (int i = 0; i < M; ++i) {
		int a, b;
		cin >> a >> b;
		P[i] = make_pair(a, b);
	}
	sort(P.begin(), P.end(), comp);
	int ans = 0;
	pair<int, int> p;
	for (int i = 0; i < M; ++i) {
		if (0 == ans) {
			ans++;
			p = P[i];
		}
		else {
			if (p.second <= P[i].first) {
				ans++;
				p = P[i];
			}
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 4052
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
#define ll long long
#define FOR(i, n, m) for(int i=n; i<m; ++i)

int main(){
  ll N, M, Q;
  cin >> N >> M >> Q;
  ll L[200010], R[200010];
  FOR(i, 0, M) cin >> L[i] >> R[i];
  ll p[100010], q[100010];
  FOR(i, 0, Q) cin >> p[i] >> q[i];
  
  ll a[N+1][N+1];
  FOR(i, 0, N+1){
    FOR(j, 0, N+1) a[i][j] = 0;
  }
  
  FOR(i, 0, M) a[L[i]][R[i]] += 1;
  
  ll sum[N+1][N+1];
  FOR(i, 0, N+1) {
    FOR(j, 0, N+1) sum[i][j] = 0;
  }
  
  FOR(i, 1, N+1){
    FOR(j, i, N+1) sum[i][j] = sum[i][j-1] + a[i][j];
    //cout << sum[i] << endl;
  }
  
  ll ans;
  FOR(i, 0, Q) {
    ans = 0;
    FOR(j, p[i], q[i]+1) ans += (sum[j][q[i]] - sum[j][p[i]-1]);
    cout << ans << endl;
  }
}

Measured memory_bytes: 9472
program main
      implicit none
      integer(8) :: a,b,n,x,ans

      read *, a, b, n
      
      if ( n >= b ) then
        x = b-1
        ans = int(a*x/b)
      else
        x = n
        ans = int(a*x/b)
      end if
      print *, ans

end program main


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

int main(){
  int n;
  cin>>n;
  vector<int>a(n);
  for(int i=0;i<n;i++){
    cin>>a.at(i);
  }
  sort(a.begin(),a.end());
  reverse(a.begin(),a.end());
  int al=0,bo=0;
  for(int i=0;i<n;i++){
    if(i%2==0)al+=a.at(i);
    else bo+=a.at(i);
  }
  cout<<al-bo<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
#define pb push_back
using namespace std;
typedef pair<ll ,ll> pll;

ll dp[2002][2];
ll k ,n;
ll oka[5200];
const ll mod =998244353;
ll C[5200][5200];
ll pw[25002];
void pre()
{
        pw[0] = 1LL;
        for(ll i=1;i<=5005;i++) {
                pw[i] = (pw[i-1] * 2LL)%mod;
        }
        for(ll i=0;i<=5005;i++) C[i][0] = 1LL;
        for(ll i=1;i<=5005;i++) {
                for(ll j=1;j<=i;j++) {
                        C[i][j] = (C[i-1][j] + C[i-1][j-1])%mod;
                }
        }
}
ll gos(ll good, ll bads, ll tot)
{
        ll ret = 0LL;
        for(ll i=0;i<=bads;i++) {

                ll yo = pw[i];
                yo = (yo * C[bads][i])%mod;
                if(tot+good-1 >= 0 && good+i-1 >= 0)
                        ret = (ret + (yo * C[tot+good-1][good+i-1])%mod)%mod;
        }
        return ret;
}
int main()
{
        cin >> k >> n;
        pre();
        for(ll i=2;i<=k+k;i++) {
                ll ay = 0;
                for(ll j=1;j<=k;j++) {
                        ll anti = i - j;
                        if(j <= k && anti <= k && anti >= 1) {
                                if(anti == j) ay = 1;
                                oka[i]++;
                        }

                }
                if(ay) oka[i]--;
                assert(oka[i]%2 == 0);
                ll bads = oka[i] / 2;

                ll gg = k - oka[i] - ay;
                ll ans = gos(gg, bads, n);
                if(ay) ans = (ans + gos(gg, bads, n-1))%mod;
                cout << ans << endl;
        }
}


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

int main() {
    int n, a, b;
    cin >> n >> a >> b;
    cout << min(a, b) << ' ';
    if (a + b > n) cout << a + b - n << endl;
    else cout << 0 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i, a, b) for (int i = (a); i < ((int)b); ++i)
#define rrep(i, a, b) for (int i = (int)(b) - 1; i >= ((int)a); --i)
#define sz(c) ((int)c.size())
#define all(c) c.begin(),c.end()

using pii = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;

void dump_impl(string str) {}
template <class H, class... T>
void dump_impl(string s, const H &head, const T&... tail) {
    int par = 0;
    rep(i, 0, sz(s)) {
        char ch = s[i];
        if (ch == ',' && par == 0) {
            cerr << " = " << head << ", ";
            dump_impl(s.substr(i + 1), tail...);
            return;
        } else {
            cerr << ch;
            if (ch == '(') par++;
            if (ch == ')') par--;
        }
    }
}
#define dump(...) do { cerr << "\x1b[33;1m"; dump_impl(#__VA_ARGS__ ",", __VA_ARGS__); cerr << "\x1b[0m" << endl; } while (0)

int DX[] = {0, 1, 0, -1, 1, 1, -1, -1};
int DY[] = {-1, 0, 1, 0, -1, 1, 1, -1};

vector<pii> rotate(const vector<pii> &L) {
    vector<pii> ret;
    if (L[0].first == 0 && L[0].second > 0) {
        return L;
    }
    if (L[0].first == 0 && L[0].second < 0) {
        // 180度回転
        rep(i, 0, sz(L)) {
            ret.push_back({L[i].first, -L[i].second});
        }
    }
    if (L[0].first == 1 && L[0].second > 0) {
        // 時計回りに90度
        rep(i, 0, sz(L)) {
            if (L[i].first == 0) {
                ret.push_back({1, -L[i].second});
            } else {
                ret.push_back({0, L[i].second});
            }
        }
    }
    if (L[0].first == 1 && L[0].second < 0) {
        // 反時計回りに90度
        rep(i, 0, sz(L)) {
            if (L[i].first == 1) {
                ret.push_back({0, -L[i].second});
            } else {
                ret.push_back({1, L[i].second});
            }
        }
    }
    return ret;
}

vector<pii> input_line() {
    vector<pii> ret;
    int last_x, last_y;
    int M;
    cin >> M;
    cin >> last_x >> last_y;
    rep(i, 0, M - 1) {
        int X, Y;
        cin >> X >> Y;

        int dx = X - last_x;
        int dy = Y - last_y;
        if (dx == 0) {
            ret.push_back({0, dy});
        } else if (dy == 0) {
            ret.push_back({1, dx});
        } else {
            assert(false);
        }

        last_x = X;
        last_y = Y;
    }
    return ret;
}

bool same(const vector<pii> &L, const vector<pii> &R) {
    return L == R;
}

vector<pii> rev(vector<pii> &L) {
    vector<pii> ret;
    rrep(i, 0, sz(L)) {
        ret.push_back({L[i].first, -L[i].second});
    }
    return ret;
}

signed main() {
    while (1) {
        int N;
        cin >> N;
        if (N == 0) break;
        vector<vector<pii>> lines;
        rep(i, 0, N + 1) {
            lines.push_back(input_line());
        }
        lines.front() = rotate(lines.front());
        rep(i, 1, N + 1) {
            if (same(lines[0], rotate(lines[i])) || same(lines[0], rotate(rev(lines[i])))) {
                cout << i << endl;
            }
        }
        cout << "+++++" << endl;
    }
}



Measured memory_bytes: 3100
let inputs = readLine()!.split(separator: " ")
let A = Int(inputs[0])!
let Bs = Array(inputs[1])
let base = Character("0").unicodeScalars.first!.value
let B = 100 * Int(Bs[0].unicodeScalars.first!.value - base) +
        10 * Int(Bs[2].unicodeScalars.first!.value - base) +
        Int(Bs[3].unicodeScalars.first!.value - base)     
print(A * B / 100)

Measured memory_bytes: 8232
import sys
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__

class RangeMinimumQuery:
    def __init__(self, n, func=min, inf=float("inf")):
        self.n0 = 2**(n-1).bit_length()
        self.op = func
        self.inf = inf
        self.data = [self.inf]*(2*self.n0)

    # [l, r)
    def query(self, l,r):
        l += self.n0
        r += self.n0
        res = self.inf
        while l < r:
            if r&1:
                r -= 1
                res = self.op(res, self.data[r-1])
            if l&1:
                res = self.op(res, self.data[l-1])
                l += 1
            l >>=1
            r >>=1
        return res

    def update(self, i, x):
        i += self.n0-1
        self.data[i] = x
        while i:
            i = ~-i//2
            self.data[i] = self.op(self.data[2*i+1], self.data[2*i+2])

n = int(input())
h = list(map(int, input().split()))
a = list(map(int, input().split()))

RMQ = RangeMinimumQuery(n, func=max, inf=0)

for i in range(n):
    hi, ai = h[i], a[i]
    s = RMQ.query(0, hi-1)
    RMQ.update(hi-1, s+ai)

ans = RMQ.query(0, n)
print(ans)

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

int main(){
  double A, B, C, D, E, F;
  cin >> A >> B >> C >> D >> E >> F;
  A *= 100;
  B *= 100;
  int ans1=A,ans2=0;
  double tmp_dens = 0.0;
  for(int i=1; A*i<=F; i++){
    for(int j=0; A*i+B*j<=F; j++){
      double w = A*i+B*j;
      for(int k=0; w+C*k<=F && C*k<=E*w/100; k++){
        int l_1 = static_cast<int>((F-w-C*k)/D);
        int l_2 = static_cast<int>((E*w/100-C*k)/D);
        int l = max(0,min(l_1, l_2));
        double s = C*k+D*l;
        if(tmp_dens<s/(s+w)){
          ans1 = s+w;
          ans2 = s;
          tmp_dens = s/(s+w);
        }
      }
    }
  }
  cout << ans1 << " " << ans2;
  return 0;
}


Measured memory_bytes: 3708
#include <iostream>

int main() {
    int r, c, ans[101][101];
    for (int i=0;i<101;++i)
        for (int j=0;j<101;++j)
            ans[i][j] = 0;
    std::cin >> r >> c;
    for (int i=0;i<r;++i)
        for (int j=0;j<c;++j) {
            int val;
            std::cin >> val;
            ans[i][j] = val;
            ans[i][c] += val;
            ans[r][j] += val;
            ans[r][c] += val;
        }
    for (int i=0;i<r+1;++i) {
        for (int j=0;j<c;++j)
            std::cout << ans[i][j] << " ";
        std::cout << ans[i][c] << std::endl;
    }
    return 0;
}


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

using namespace std;

int main(){
	int			n;
	int			s_buf;
	int			sum;
	vector<int>	s;

	while(cin >> n){
		if(n == 0){
			break;
		}

		sum = 0;
		s_buf = 0;
		s.clear();

		for(int i = 0; i < n; i++){
			cin >> s_buf;

			s.push_back(s_buf);
		}

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

		for(int i = 1; i < s.size() - 1; i++){
			sum += s[i];
		}

		cout << sum / (s.size() - 2) << endl;
	}
}

Measured memory_bytes: 0
#include <cstdint>
#include <iostream>

using namespace std;

int main()
{
    int64_t n, k;
    cin >> n >> k;

    int64_t res = 0;
    for (int64_t i = k + 1; i <= n; i += 1) {
        res += n / i * (i - k);
        res += max<int64_t>(0, n % i - k + (k == 0 ? 0 : 1));
    }

    cout << res << "\n";
    return 0;
}


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

int main()
{
  string comp;
  while (cin >> comp) {
    string dec = "";
    for (unsigned int i = 0; i < comp.size(); ++i) {
      if (comp[i] == '@') {
	for (int j = 0; j < (comp[i+1]-'0'); ++j)
	  dec += comp[i+2];
	i += 2;
      } else {
	dec +=  comp[i];
      }
    }
    cout << dec << endl;
  }
  return 0;
}

Measured memory_bytes: 0
#include<iostream>
#include<sstream>
#include<fstream>
#include<vector>
#include<algorithm>
#include<map>
#include<queue>
#include<cmath>

using namespace std;


int main(){
    int N;
    cin >> N;
    int all=0;
    vector<int> as;
    for(int i=0;i<N;i++){
        long A;
        cin >> A;
        as.push_back(A);
        all ^= A;
    }
    for(int i=0;i<N;i++){
        cout << (as[i]^all) << " ";
    }

    return 0;
}


Measured memory_bytes: 3916
#include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <bitset>
#include <math.h>

typedef long long ll;
typedef unsigned long long ull;

#define vi std::vector<int>
#define vl std::vector<ll>
#define floop(n) for(int i = 0; i < n; ++i)
#define print(x) std::cout << x << std::endl;

const ll INF = 1e18;

int main()
{
    int N, total=0;
    std::cin >> N;

    floop(N)
        total += i+1;
    
    print(total);
    return 0;
}

Measured memory_bytes: 3604
import itertools
h, w, d = map(int, input().split())
a = [list(map(int, input().split())) for i in range(h)]
p = [0] * (h * w)
for i, j in itertools.product(range(h), range(w)):
  p[a[i][j] - 1] = (i, j)
s = [0] * d
for i in range(h * w - d):
  s.append(s[-d] + abs(p[i][0] - p[i+d][0]) + abs(p[i][1] - p[i+d][1]))
q = int(input())
for i in range(q):
  l, r = map(int, input().split())
  l -= 1
  r -= 1
  print(s[r] - s[l])


Measured memory_bytes: 60124
#include <iostream>
#include <string>
#include <vector>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <math.h>
#include <stdio.h>
#include <ctype.h>
#include <ios> 
#include <iomanip>
using namespace std;

#define N_MAX   (100000)
#define LL_MAX_NUM (1LL<<60)
#define INF 1e7

typedef long long ll;
typedef long long int lli;

int main() {
    string s;
	cin >> s;
    for (int i = 0; i < s.size(); i++) {
        if (s[i] == ',') 
        {
            s[i] = ' ';
        }
    }
    cout << s << endl;   
	return 0;
}


Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
*/public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		Scanner in = new Scanner(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskD solver = new TaskD();
		solver.solve(1, in, out);
		out.close();
	}
static class TaskD   {
public void solve(int testNumber, Scanner in, PrintWriter out) {
        int H = in.nextInt();
        int W = in.nextInt();
        int a[][] = new int[H][W];
        for(int ih=0; ih<H; ih++){
            for(int iw=0; iw<W; iw++){
                a[ih][iw] = in.nextInt();
            }
        }
        int n = 0;
        String ans[] = new String[H*W];
        for(int ih=0; ih<H; ih++){
            for(int iw=0; iw<W-1; iw++){
                if(a[ih][iw]%2 != 0){
                    ans[n] = (ih+1)+" "+(iw+1)+" "+(ih+1)+" "+(iw+2);
                    n++;
                    a[ih][iw+1]++;
                }
            }
        }
        for(int ih=0; ih<H-1; ih++){
            if(a[ih][W-1]%2 != 0){
                ans[n] = (ih+1)+" "+W+" "+(ih+2)+" "+W;
                n++;
                a[ih+1][W-1]++;
            }
        }
        out.println(n);
        for(int i=0; i<n; i++) out.println(ans[i]);
    }

}
}



Measured memory_bytes: 98932
s="1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51"
s=s.split(", ")
k=int(input())
print(int(s[k-1]))

Measured memory_bytes: 38384
#include <iostream>  
using namespace std;
typedef long long ll;
#define fast_io ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
 
ll gcd(ll a, ll b)  
{  
    if (a == 0) 
        return b;  
    return gcd(b % a, a);  
}  
 
ll lcm(ll a, ll b)  
{  
    return (a*b)/gcd(a, b);  
}  
 
int main()  
{  
    fast_io;
    ll a, b;
    cin >> a >> b;
    cout << lcm(a, b) << endl;  
    return 0;  
} 

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

using namespace std;

#define F first
#define S second
#define modulo ll (1e9 + 7)

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

void init(){
    cin.tie(0);
    cin.sync_with_stdio(0);
}

const int N = 59, M = 5e3 + 9, OO = 0x3f3f3f3f;
const ll llOO = 0x3f3f3f3f3f3f3f3f;


ll o1, o2, s1, s2;

int main(){
    init();

    int n;  cin >> n;

    // o1 - > even positive odd negative
    // o2 - > odd positive even negative
    for(int i = 0;i < n;i++){
        int x;  cin >> x;
        s1 += x;
        s2 += x;

        if(i & 1){
            if(s1 >= 0){
                o1 += 1 + s1;
                s1 = -1;
            }
            if(s2 <= 0){
                o2 += 1 + abs(s2);
                s2 = 1;
            }
        }
        else{
            if(s2 >= 0){
                o2 += 1 + s2;
                s2 = -1;
            }
            if(s1 <= 0){
                o1 += 1 + abs(s1);
                s1 = 1;
            }
        }
    }

    cout << min(o1, o2);
}

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

void solve () {
	int ans, x;
	for (int i = 0; i < 5; i++) {
		cin >> x;
		if (x == 0) ans = i;
	}
	cout << ans + 1 << endl;
}

int main () {
	/*int t;
	cin >> t;
	while (t--) {
		solve();
	}*/
	
	solve();

	return 0;
}


Measured memory_bytes: 3620
// clang-format off
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define stoi stoll
using pii = pair<int,int>;
using vi = vector<int>;
using vvi = vector<vi>;
#define all(c) begin(c), end(c)
#define rall(c) rbegin(c), rend(c)
#define fore(x, c) for(auto &&x : c)
#define rep(i, a, n) for(int i = a, i##len = (int)(n); i < i##len; ++i)
#define rrep(i, a, n) for(int i = (int)(n - 1); i >= a; --i)
#define sz(c) ((int)c.size())
#define contains(c, x) (c.find(x) != end(c))
#define inseg(l, x, r) ((l) <= (x) && (x) < (r))
#define dump(...)
#define pb push_back
#define eb emplace_back
#define _ 0
const signed INF_ = 1001001001; const long long INF = 1001001001001001001LL;
const int DX[9] = {0,1,0,-1,1,1,-1,-1,0}, DY[9] = {-1,0,1,0,-1,1,1,-1,0};
template<class T> ostream& operator<<(ostream &os, const vector<T> &v) {
  for (auto i = begin(v); i != end(v); i++) os<<*i<<(i==end(v)-1?"":" ");return os;}
template<class T> istream& operator>>(istream &is, vector<T> &v) {
  for (auto i = begin(v); i != end(v); i++) is>>*i;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, class U> bool chmax(T &a, const U &b){return a<b?a=b,1:0;}
template<class T, class U> bool chmin(T &a, const U &b){return a>b?a=b,1:0;}
template <class T> void psum(T& c) {partial_sum(begin(c), end(c), begin(c));}
template<class T> using heap = priority_queue<T, vector<T>, greater<T>>;
struct before_main_function {
  before_main_function() {
      cin.tie(nullptr); ios::sync_with_stdio(0);
      cout << setprecision(15) << fixed;
  }
} before_main_function;
// clang-format on
//------------------8<------------------------------------8<--------------------

signed main() {
  int N;
  cin >> N;
  vi A(N);
  cin >> A;

  vi S = A;
  psum(S);

  int ans = INF;
  rep(i, 0, N) {
    int l = S[i];
    int r = S[N - 1] - S[i];
    dump(i, l, r);
    int tmp = abs(l - r);
    chmin(ans, tmp);
  }
  cout << ans << endl;
  return (0 ^ _ ^ 0);
}



Measured memory_bytes: 3456
local n=io.read("n")
local a={}
local a_map={}
for i=1,n do
    local input=io.read("n")
    a[i]=input
    a_map[input]=(a_map[input] or 0)+1
end

local counter=0
for i=1,n do
    local checker=true
    a_map[a[i]]=a_map[a[i]]-1
    for j=1,math.sqrt(a[i]) do
        local div=math.floor(a[i]/j)
        if a[i]%j==0 then
            if (a_map[j] and a_map[j]>0) or (a_map[div] and a_map[div]>0) then
                checker=false
                break
            end
        end
    end
    if checker then
        counter=counter+1
    end
    a_map[a[i]]=a_map[a[i]]+1
end
print(counter)

Measured memory_bytes: 14008
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n,m;
  cin >> n>>m;
  int sum=0;
  vector<int> a(n);
  for(int i=0;i<n;i++){
    cin >> a[i];
    sum+=a[i];
  }
  
  sort(a.begin(),a.end());
  reverse(a.begin(),a.end());
  
  
  if(a[m-1]>=(float)sum/(4*m)) cout << "Yes" <<endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256