akhauriyash/Code-Regression huggingface dataset:
#include <cstddef>
#include <complex>
#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <vector>
#include <array>
#include <list>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <numeric>
#include <limits>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <bitset>
#include <valarray>
#include <utility>
#include <tuple>
#include <cmath>
#include <memory>
#include <random>
#include <fstream>
#include <locale>
#include <bitset>

using ll = long long;
using ull = unsigned long long;

//vector
template <class T>
using vec = std::vector<T>;

template <class T>
using vvec = vec<vec<T>>;

constexpr std::size_t operator""_sz(ull n) { return std::size_t(n); }

ll gcd(ll a, ll b)
{
    if (a > b)
        std::swap(a, b);

    while (true)
    {
        auto m = b % a;
        if (m == 0)
            return a;
        b = a;
        a = m;
    }
}

int main()
{
    using namespace std;

    int n, m;
    cin >> n >> m;

    vec<int> v(m);
    vec<int> p(m);

    for (auto& e : v)
    {
        int k, b{};
        cin >> k;
        for (int i = 0; i < k; ++i)
        {
            int in;
            cin >> in;
            --in;
            b |= (1 << in);
        }
        e = b;
        //cout << e << endl;
    }

    for (auto& e : p)
    {
        cin >> e;
    }

    auto check = [&v, &p, n](int b){
        //cout << "***" << endl;
        bool ret {true};
        for (int i = 0; i < v.size(); ++i)
        {
            bitset<10> bit = (b & v[i]);
            auto count = bit.count(); 
            //cout << bit.to_string() << " " << count << endl;
            ret &= (count % 2 == p[i]);
        }

        //cout << "---" << endl;

        return ret;
    };

    int ans{};

    for (int b = 0; b < 1 << n; ++b)
    {
        if (check(b))
            ++ans;
    }

    cout << ans << endl;

    return 0;
}


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

int main() {
  int A, B,ans;
  cin >> A >> B;
  
  if(B%A == 0){
    ans = A+B;
    cout << ans << endl;
  }
  else{
    ans = B-A;
    cout << ans << endl;
  }
}

Measured memory_bytes: 256
using System;

namespace AIZU {
	class Program {
		static int cin() { return cin(-1); }
		static int cin(int D) {
			string s = Console.ReadLine();
			if (string.IsNullOrEmpty(s))
				return D;
			return int.Parse(s);
		}
		static int[] cins(char spliter) {
			string s = Console.ReadLine();
			if (string.IsNullOrEmpty(s))
				return new int[] { };
			string[] ss = s.Split(spliter);
			int[] Res = new int[ss.Length];
			for (int i = 0; i < ss.Length; i++)
				Res[i] = int.Parse(ss[i]);
			return Res;
		}
		static int[] cins() { return cins(' '); }
		static void print(object j) { Console.WriteLine(j.ToString()); }
		static void print(string j) { Console.WriteLine(j); }
		
		static void Main(string[] args) {
			int[] I = cins();
			print((I[0]*I[1])/3.305785m);
		}
	}
}

Measured memory_bytes: 9140
N, M = map(int, input().split())
H = list(map(int, input().split()))

ma = [0] * N
for i in range(M):
    A, B = map(int, input().split())
    A -= 1
    B -= 1
    ma[A] = max(ma[A], H[B])
    ma[B] = max(ma[B], H[A])

ans = 0
for i in range(N):
    if H[i] > ma[i]:
        ans += 1

print(ans)

Measured memory_bytes: 20052
import java.util.Scanner;
import java.util.HashSet;
import java.util.Set;

import java.io.*;

public class Main
{

	int[][] visited;
	int[][] ma;
	int h, w;
	int dx[] = {0, 1, 1, 1, 0, -1, -1, -1};
	int dy[] = {-1, -1, 0, 1, 1, 1, 0, -1};

	public int rec(int y, int x)
	{
		if(y < 0 || y >= h || x < 0 ||x >= w || visited[y][x] != 0 || ma[y][x] == 0)
		{
			return 0;
		}
		visited[y][x] = 1;
		int re = 1;
		for (int i = 0; i < 8; i++)
		{
			re += rec(y + dy[i], x + dx[i]);
		}
		return re;
	}

	public void solve()
	{
		Scanner sc = new Scanner(System.in);
		while(true)
		{
			w = sc.nextInt();
			h = sc.nextInt();
			if(w == 0 && h == 0)
			{
				break;
			}
			ma = new int[52][52];
			visited = new int[52][52];
			for (int i = 0; i < h; i++)
			{
				for (int j = 0; j < w; j++)
				{
					ma[i][j] = sc.nextInt();
				}
			}
			int ans = 0;
			for (int i = 0; i < h; i++)
			{
				for (int j = 0; j < w; j++)
				{
					if(visited[i][j] == 0 && rec(i, j) != 0)
					{
						++ans;
					}
				}
			}
			System.out.println(ans);
		}
		
		sc.close();
	}

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


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

int main(void) {
    int w,h,x,y,r;
    std::cin >> w >> h >> x >> y >> r;
    if(x>=r && y>=r && x<=w-r && y<=h-r){
        std::cout << "Yes" << std::endl;
    }else{
        std::cout << "No" << std::endl;
    }
    return 0;
}



Measured memory_bytes: 3100
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int tmp,top,x,max;
int S[100];
char s[100];

void initialize()
{
  top=0;//スタックを空にする
}
int isEmpty()
{
  return top==0;
}
int isFull()
{
  max=strlen(s);
  return top>=max-1;
}
void push()
{
  /* if (isFull())
    puts("err");
  */
  top++;
  S[top] = x;
}
int pop()
{
  /* if(isEmpty())
     puts("err");
*/
  top--;
  return S[top+1];
}
void test()
{
 int i=0;
 while( scanf("%s", s) != EOF ){
   if(s[0]=='+')
     puts("+");
   else
     printf("%s",s);
 }
}
int main()
{
  initialize();
  while( scanf("%s", s) != EOF ){//文字の終わりまで
    if ( s[0] == '+' ){//文字列のs[0]は+がきたとき全てに通用する
      tmp=pop();
      S[top]=tmp+S[top];
//      printf("sum=%dtop=%d\n",S[top],top);
	    
    } else if ( s[0] == '-' ){
      tmp=pop();
      S[top] =S[top]-tmp;
     // printf("sum=%dtop=%d\n",S[top],top);

      
    } else if ( s[0] == '*' ){
      tmp=pop();
      S[top]=tmp*S[top];//例の通りならここでsum[1]に入っていたsum[1]と[2をかける
  //    printf("sum=%dtop=%d\n",S[top],top);
      
    } else {
      x = atoi(s);
      push();
    }

  }
printf("%d\n",S[top]);
  return 0;
}


Measured memory_bytes: 2044
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
 
int top,S[100];
void push(int x)
{
  S[++top]=x;
}
 
int pop()
{
  top--;
  return S[top+1];
}
 
 
int main()
{
  top=0;
  int a,b;
  char s[100];
  while(scanf("%s",s)!=EOF)
    {
      if(s[0]=='+')
    {
      a=pop();
      b=pop();
      push(a+b);
    }
      else  if(s[0]=='-')
    {
      b=pop();
      a=pop();
      push(a-b);
    }
      else if(s[0]=='*')
    {
    a=pop();
    b=pop();
    push(a*b);
    }
      else
    {
      push(atoi(s));
    }
    }
  printf("%d\n",pop());
 
  return 0;
}

Measured memory_bytes: 548
#include <stdio.h>
#include <stdlib.h>

int sums(int n, int ans, int *A);

int main()
{
    int n,m,i,con;
    int A[2000] = {0};
    int B[2000] = {0};

    scanf("%d",&n);

    for (i=0; i<n; i++) {
        scanf("%d",&A[i]);
    }
    
    scanf("%d",&m);

    for (i=0; i<m; i++) {
        scanf("%d",&B[i]);
    }

    for (i=0; i<m; i++) {
        con = sums(n,B[i],A);
        if (con) printf("yes");
        else printf("no");

        printf("\n");
    }

    return 0;
}

int sums(int n, int ans, int *A) {
    int t,s;

    if (n == 0) {
        if (ans == 0) return 1;
        else return 0;
    }

    //if (A[n-1] > ans) return 0;

    if (A[n-1] == ans) return 1;

    t = sums(n-1,ans,A);
    s = sums(n-1,ans-A[n-1],A);

    return (t || s);
}


Measured memory_bytes: 2140
#include <bits/stdc++.h>
using namespace std;
long long ta[399999];

int main()
{
    long long n;
    cin >> n;
    int i1,i2,i3,i4,i5;
    long sum=0;
    long answer = 9999999;
    long num;
    long m;
    for(i1=0;i1<9;i1++){
        for(i2=0;i2<9;i2++){
            for(i3=0;i3<9;i3++){
                for(i4=0;i4<9;i4++){
                    for(i5=0;i5<9;i5++){
                        sum = i1 * 9 + i2 * 9*9 + i3 * 9*9*9 + i4 * 9*9*9*9 + i5 * 9*9*9*9*9;
                        if(n<sum){
                            break;
                        }
                        num = i1 + i2 + i3 + i4 + i5;
                        m = n - sum;
                        while(m){
                            num += (m % 6);
                            m = m / 6;
                        }
//                        printf("%d\t%d\t%d\t%d\t%d\t%d\t\n",num,i1,i2,i3,i4,i5);
                        
                        if(answer > num){
                            answer = num;
                        }
                    }
                }
            }
        }
    }
    printf("%ld\n",answer);

}


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

typedef long long int ll;
typedef pair<ll, ll> p_ll;
typedef vector<pair<ll, ll>> vec_p; //vector<pair<ll, ll>> pairs(n) ,pairs.at(i) = make_pair(i*i, i)

const ll MOD = pow(10, 9) + 7;
const ll LLINF = pow(2, 61) - 1;
const int INF = pow(2, 30) - 1;

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

  ll N, M;
  cin >> N >> M;

  vector<ll> vec(N);
  for (ll i = 0; i < N; i++)
  {
    cin >> vec.at(i);
  }

  ll sum = 0;
  for (ll i = 0; i < N; i++)
  {
    sum += vec.at(i);
  }
  //cout << sum << endl;

  ll cri=0;
  ll tmp = 4 * M;
  if (sum % tmp == 0)
  {
    cri = sum / tmp;
    
    cri =cri- 1;
  }
  else
  {
    cri = sum /tmp;
  }
  //cout << cri << endl;

  sort(vec.begin(), vec.end());
  reverse(vec.begin(), vec.end());
  ll flag = 0;

  for (ll i = 0; i < M; i++)
  {
    if (vec.at(i) <= cri)
    {
      flag = 1;
    }
  }

  if (flag == 0)
  {
    cout << "Yes" << endl;
  }
  else
  {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
import Control.Applicative
import Control.Monad
import Data.List

main :: IO ()
main = do
  [n, m] <- f
  solve n <$> replicateM n (tail <$> f) >>= print
  where
    f = map read <$> words <$> getLine

solve :: Int -> [[Int]] -> Int
solve n = length . filter ((== n) . length) . group . sort . concat


Measured memory_bytes: 1276
/*
 * atcoder/abc126_2nd/d.cpp
 */

// C++ 14
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstring> // memset
#include <cassert>
#include <queue>
using namespace std;
#define ll long long
#define loop(__x, __start, __end) for(int __x = __start; __x < __end; __x++)
template <class T> ostream & operator << (ostream & out, vector<T> const & v) {
  for (auto &&a: v) out << a << " "; out << endl; return out;
}
template <class T> void dump(T &a) { cout << a << endl; }
template <class T> bool chmin(T &a, T b) { if (a > b) {a = b; return true; } return false; }
template <class T> bool chmax(T &a, T b) { if (a < b) {a = b; return true; } return false; }

struct Edge {
  ll v, w;
};
ostream & operator << (ostream & out, Edge const & v) {
  out << "(" << v.v << ", " << v.w << ")"; return out;
}
const int MAX = 100001;
int N, M;
vector<Edge> G[MAX];
int C[MAX];
void solve() {
  cin >> N;
  M = N-1;
  ll u, v, w;
  loop(n,0,M) {
    cin >> u >> v >> w;
    u--;v--;
    G[u].push_back((Edge){ v, w });
    G[v].push_back((Edge){ u, w });
  }

  memset(C, -1, sizeof(C));

  queue<int> Q;
  Q.push(0);
  C[0] = 0;

  while (Q.size()) {
    int u = Q.front(); Q.pop();
    for (auto&& edge: G[u]) {
      ll v = edge.v, w = edge.w;
      if (C[v] >= 0) continue;
      C[v] = w%2==0 ? C[u] : (C[u]+1)%2;
      Q.push(v);
    }
  }
  loop(n,0,N) cout << C[n] << endl;
}
int main() {
  // cout.precision(15); cout << fixed;

  solve();

  return 0;
}


Measured memory_bytes: 8192
import collections
N = int(input())
A=list(map(int,input().split()))
B = collections.Counter(A)
ans=N
flag=0
for i,a in enumerate(B.values()):
  #print(a,ans)
  if a==1:
    continue
  if a%2==0:
    ans-=a-1
    if flag==0:
      flag=1
    else:
      flag=0
  else:
    ans-=a-1
if flag==1:
  ans-=1
print(ans)
  
  

Measured memory_bytes: 18656
N,K = map(int,input().split())
ab = [list(map(int,input().split())) for _ in range(N)]
ab.sort()
count = 0

for i in range(N):
  a,b  = ab[i][0],ab[i][1]
  count += b
  if count >= K:
    print(a)
    break

Measured memory_bytes: 27468
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.*;


public class Main {

    public static void main(String[] args) throws IOException {
        Scanner s = new Scanner(System.in);
        int a = s.nextInt(),b=s.nextInt();
        long mult = Math.max(a,b);
        for(int i=1;;i++){
            if(mult*i%a==0&&mult*i%b==0){
                System.out.println(mult*i);
                break;
            }
        }
    }
}




class Scanner
{
    StringTokenizer st;
    BufferedReader br;

    public Scanner(InputStream s){	br = new BufferedReader(new InputStreamReader(s));}

    public String next() throws IOException
    {
        while (st == null || !st.hasMoreTokens())
            st = new StringTokenizer(br.readLine());
        return st.nextToken();
    }

    public int nextInt() throws IOException {return Integer.parseInt(next());}

    public long nextLong() throws IOException {return Long.parseLong(next());}

    public String nextLine() throws IOException {return br.readLine();}

    public double nextDouble() throws IOException
    {
        String x = next();
        StringBuilder sb = new StringBuilder("0");
        double res = 0, f = 1;
        boolean dec = false, neg = false;
        int start = 0;
        if(x.charAt(0) == '-')
        {
            neg = true;
            start++;
        }
        for(int i = start; i < x.length(); i++)
            if(x.charAt(i) == '.')
            {
                res = Long.parseLong(sb.toString());
                sb = new StringBuilder("0");
                dec = true;
            }
            else
            {
                sb.append(x.charAt(i));
                if(dec)
                    f *= 10;
            }
        res += Long.parseLong(sb.toString()) / f;
        return res * (neg?-1:1);
    }

    public boolean ready() throws IOException {return br.ready();}


}

Measured memory_bytes: 25448
program main
    integer :: n,k
    character(len=20) :: char
    integer :: a,keta
    read *,n,k


!    if(k==10) then
!        print *,n
!        write(char,*) n
!        print *,len_trim(char)
!        print '(i0)',len_trim(char)
!        stop
!    else
        keta=0
        do 
            if(n<k) then
                keta=keta+1
                exit
            else
                a=mod(n,k)
                n=n/k
                keta=keta+1
            endif
        end do
        print '(i0)',keta
!    endif
    stop
end program main

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define ll long long
#define PI 3.1415926535897932384626433832795l
#define MAX_NUM 1000000000000
using namespace std;
template <typename T>
inline T __lcm(T a, T b)
{
    return (a * b) / __gcd(a, b);
}


ll dp[201][201];
ll fun(ll a,ll b)
{
    if(a>b)
    {
        swap(a,b);
    }
    if(dp[a][b]!=-1)
    {
        return dp[a][b];
    }
    else
    {
        return dp[a][b]=__gcd(a,b);
    }
    
}
void solve()
{
    memset(dp,-1,sizeof(dp));
    int n;
    cin>>n;
    ll sum=0;
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=n;j++)
        {
            for(int k=1;k<=n;k++)
            {
                sum+=fun(fun(i,j),k);
            }
        }
    }
    printf("%lld\n",sum);
}

int main()
{
#ifndef ONLINE_JUDGE
    freopen("inputf.txt", "r", stdin);
    freopen("outputf.txt", "w", stdout);
#endif // ONLINE_JUDGE

    solve();
    return 0;
}


Measured memory_bytes: 4076
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
 
int main() {
  long a,b;
  string op;
  cin>>a>>op>>b;
  if(op=="+") cout<<a+b<<endl;
  else if(op=="-") cout<<a-b<<endl;  
}

Measured memory_bytes: 256
#include<stdio.h>
int r=99,n=98,t,s;
int c(int i,int j,int k){printf("< %d %d %d ",i,j,k);}
int a(int i,int j,int k){printf("+ %d %d %d ",i,j,k);}
int b(int i,int j,int k){a(i,j,r);c(n,r,r+1);a(k,r+1,k);}
int m(int i,int l,int j,int p,int k){for(t=0;t<l+p-1;++t){if(t)a(k,k,k);for(s=0;s<=t;++s)if(s<p&&s+l>t)b(i+t-s,j+s,k);}}
int d(int x,int i,int l,int j){for(t=0;t<l;++t){if(t)a(j+t-1,j+t-1,j+t);a(j+t,n,j+t);for(s=t;s+1<l;++s)a(j+s,j+s,j+s+1);c(j+l-1,x,i+t);a(j+t-1,j+t-1,j+t);a(j+t,i+t,j+t);}}
int main(){puts("3930");a(0,1,n);c(2,n,n);a(0,n,3);a(1,n,4);d(3,5,30,36);d(4,36,30,67);m(5,30,36,30,2);}

Measured memory_bytes: 1576
#include<stdio.h>
#include<stdlib.h>
int main(void){
 int N,K;
 scanf("%d",&N);
 scanf("%d",&K);
 int i;
 int a[N];
 int count=0;
 for(i=0;i<N;i++){
   scanf("%d",&a[i]);
  if(a[i]>=K){
   count++;
  }
  else{
  }
 }printf("%d",count);

}


Measured memory_bytes: 512
import sys
input = sys.stdin.readline
N = int(input())
a = list(map(int, input().split()))
a.sort()
def check(x):
  b = [0] * N
  for i in range(N):
    b[i] = a[i] + x
  t = x
  for i in range(N):
    if t * (N + 1) >= b[i] - (N - 1):
      t -= -(-(b[i] - (N - 1)) // (N + 1))
    else:
      return False
  return True


ok = sum(a)
ng = -1

while ok - ng > 1:
  m = (ok + ng) // 2
  isok = 0
  for i in range(50):
    if check(m + i):
      isok = 1
      break
  if isok: ok = m
  else: ng = m


for i in range(50):
  if check(ok + i):
    print(ok + i)
    break

Measured memory_bytes: 41840
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(100000)


def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


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


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(A, B, C, D, E):
    a = A, B, C, D, E
    ans = sum(a)
    r = []
    for v in a:
        if v % 10 != 0:
            r.append(10 - v % 10)
    
    ans += sum(r)
    if r:
        ans -= max(r)
    return ans


def main():
    A = read_int()
    B = read_int()
    C = read_int()
    D = read_int()
    E = read_int()

    print(slv(A, B, C, D, E ))


if __name__ == '__main__':
    main()


Measured memory_bytes: 6492
#include <climits>
#include <iostream>
#include <algorithm>
#include <stack>
#include <string>
#include <vector>

using namespace std;
using PII     = pair<int, int>;
using int64   = long long;
const int MOD = 998244353;

int64 power(int64 a, int64 b = MOD - 2) {
    int64 c = 1;
    while (b) {
        if (b & 1)
            c = c * a % MOD;
        b /= 2;
        a = a * a % MOD;
    }
    return c;
}

int main() {
    // freopen("in.txt", "r", stdin);
    int n, m, k;
    int64 ans = 0;
    cin >> n >> m >> k;
    vector<int64> fac(n + 1, 1), inv(n + 1), p(n + 1, 1);
    for (int i = 1; i <= n; i++)
        fac[i] = fac[i - 1] * i % MOD;
    inv[n] = power(fac[n]);
    for (int i = n; i > 0; i--)
        inv[i-1] = inv[i] * i % MOD;
    for (int i = 1; i <= n; i++)
        p[i] = p[i - 1] * (m - 1) % MOD;
    for (int i = 0; i <= k; i++) {
        int64 C = fac[n - 1] * inv[i] % MOD * inv[n - 1 - i] % MOD;
        ans += C * p[n - 1 - i];
        ans %= MOD;
    }
    ans = ans * m % MOD;
    cout << ans << endl;
}

Measured memory_bytes: 7496
#include <iostream>
#include <string>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
using namespace std;

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

int main(){
    int N;
    cin >> N;
    vector<int> p(N);
    rep(i, N) cin >> p[i];
    int cnt = 0;
    int swap;
    rep(i, N){
        if((i + 1) == p[i]){
            cnt++;
            swap = p[i];
            p[i] = p[i+1];
            p[i+1] = swap;
        }
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 3732
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int x, y;
  cin >> x >> y;
  vector<int> as = {1,3,5,7,8,10,12};
  vector<int> bs = {4,6,9,11};
  int a = 0;
  int b = 0;
  for (int i = 0; i < 7; i++) { if (as.at(i)==x || as.at(i)==y) {a++;} }
  for (int i = 0; i < 4; i++) { if (bs.at(i)==x || bs.at(i)==y) {b++;} }
  if (a == 2 || b == 2) { cout << "Yes" << endl; }
  else { cout << "No" << endl; }
}

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

int main(void) {
  int N;
  cin >> N;
  int64_t sum = 0LL;
  for(int i = 1; i <= N; i++) {
    if(i % 3 != 0 && i % 5 != 0) {
      sum += i;
    }
  }
  cout << sum << endl;
  return 0;
}

Measured memory_bytes: 3620
x = "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"
r = x.split(", ")
z = int(input())
print(r[z-1])

Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define all(a) a.begin(),a.end()
#define rall(c) (c).rbegin(),(c).rend()
#define mp make_pair
#define endl '\n'
#define vec vector<ll>
#define mat vector<vector<ll> >
#define fi first
#define se second
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> pll;
typedef long double ld;
typedef complex<double> comp;
const ll inf=1e9+7;
const ll mod=1e9+7;
const int MAX=1010;


signed main(){
    ll h,w,m;cin>>h>>w>>m;
    set<pll>st;
    map<ll,ll>x,y;
    ll mx=0,my=0;
    rep(i,m){
        ll a,b;cin>>a>>b;
        x[a]++;
        y[b]++;
        mx=max(mx,x[a]);
        my=max(my,y[b]);
        st.insert(mp(a,b));
    }
    ll cnt=0;
    vector<ll>used(w+1);
    for(auto e:st){
        if(y[e.se]==my&&x[e.fi]==mx){
            cnt++;
        }
    }
    ll cntx=0;
    ll cnty=0;
    for(auto e:x){
        if(e.se==mx)cntx++;
    }
    for(auto e:y){
        if(e.se==my)cnty++;
    }
    cout<<mx+my-(!(cntx*cnty>cnt))<<endl;
}

Measured memory_bytes: 61844
#include <bits/stdc++.h>
using namespace std;
const long long E9 = 1000000000;
int main() {
	long long s;
	scanf("%lld", &s);
	if(s == E9 * E9) {
		puts("0 0 0 1000000000 1000000000 0");
		return 0;
	}
	int bigs = s / E9 + 1;
	int smalls = 1ll * bigs * E9 - s;
	int b_y = E9, c_y = 0, a_y = 1;
	int a_x = bigs, b_x = smalls, c_x = 0;
	printf("%d %d %d %d %d %d\n", a_x, a_y, b_x, b_y, c_x, c_y);
	long long surface = 1ll * a_x * (b_y - c_y) + 1ll * b_x * (c_y - a_y) + 1ll * c_x * (a_y - b_y);
	fprintf(stderr, "surface is %lld\n", surface);
	return 0;
}

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

int main(void)
{



	int R,C;
	int a;

	while(cin >> R >> C, R | C){
	bitset<10000> sen[10];
	for(int i = 0; i < R; i++){
		for(int j = 0; j < C; j++){
			cin >> a;
			sen[i][j] = a > 0;
		}
	}

	int ans = 0;
	bitset<1 << (10-1)> re;
	for(int i = 0; i < 1 << (R-1); i++){
		re = i;
		int sum = 0;
		for(int j = 0; j < R; j++){
			if(re[j])
				sen[j].flip();
		}
		for(int j = 0; j < C; j++){
			int x = 0;
			for(int k = 0; k < R; k++)
				if(sen[k][j])
					x++;
			sum += max(x, R-x);
		}
		for(int j = 0; j < R; j++){
			if(re[j])
				sen[j].flip();
		}
		ans = max(sum,ans);
		
	}

	cout << ans << endl;


	}
	return 0;
}

	

Measured memory_bytes: 1168
#include <bits/stdc++.h>
using namespace std;
 
 
typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef long double ld;
 
typedef set<int>::iterator sit;
typedef map<int,int>::iterator mit;
typedef vector<int>::iterator vit;
 
const int INF = 1e9 + 7;
const int MOD = 1e9 + 7;
const int MAXN = 1e6 + 3;
 
#define _  %  MOD
#define __ %= MOD
 
#define      each(it,s)        for(auto it = s.begin(); it != s.end(); ++it)
#define      sortA(v)          sort(v.begin(), v.end())
#define      sortD(v)          sort(v.begin(), v.end(), greater<auto>())
#define      fill(a)           memset(a, 0, sizeof (a))
 
#define      swap(a,b)        {a=a+b;b=a-b;a=a-b;}
#define      rep(i, n)         for(ll i = 0; i < (n); ++i)
#define      repA(i, a, n)     for(ll i = a; i <= (n); ++i)
#define      repD(i, a, n)     for(ll i = a; i >= (n); --i)
#define watch(x) cout << (#x) << " is " << (x) <<endl
 
#define fi first
#define se second
#define mp make_pair
#define pb push_back
 
#define fbo find_by_order
#define ook order_of_key
 
ll gcd(ll a,ll b){if(b==0) return a; else return gcd(b,a%b);}
ll power(ll x,ll y){ll res=1; while(y>0){if(y&1) res=res*x;y=y>>1;x=x*x;}return res;} // modular exponent
 
int main()
{
    ios_base::sync_with_stdio(false); // don't use printf and scanf
    cin.tie(NULL); // cout<<fixed<<setprecision
	ll n;
	cin>>n;
	vector<ll> v(n);
	rep(i,n) cin>>v[i];
	sortA(v);
	map<ll,vector<ll>> sums;
	rep(i,n)
	{
		rep(j,i)
		{
			sums[i].pb(v[i]+v[j]);
		}
		sortA(sums[i]);
	}
	ll ans=0ll;
	for(ll i=n-1;i>=0;i--)
	{
		ll val=v[i];
		repD(j,i-1,0)
		{
			auto it=upper_bound(sums[j].begin(),sums[j].end(),val);
			ans+=(sums[j].end()-it);
		}
	}
	cout<<ans<<'\n';
	return 0;
}
// JUST ASK YOURSELF DID YOU GIVE YOUR BEST ? ISSE ZYADA
// KUCH KAR BHI NAHI SAKTE !! ENJOY AND GIVE YOUR BEST!!



Measured memory_bytes: 23660
import itertools

N = int(input())
dict = {}
for i in range(N):
  name = input()
  if name[0] in ['M', 'A', 'R', 'C', 'H']:
    if name[0] in dict:
      dict[name[0]] += 1
    else:
      dict[name[0]] = 1

ans =  0
if len(dict) >= 3:
  for v in itertools.combinations(dict.keys(), 3):
    ans += dict[v[0]] * dict[v[1]] * dict[v[2]]
print(ans)

Measured memory_bytes: 3064
#include<iostream>
        using namespace std;
         
        int main(){
          int n;
          cin>>n;
          
          int a[n];
          for(int i=0; i < n; i++){
            cin>>a[i];
          }
          
          int ans = 0;
          int active = 0;
          for(int i;i<n;i++){
            if(active>=a[i]){
              active = a[i];
            }else{
              ans += a[i]-active;
              active = a[i];
            }
          }
          cout << ans << endl;
          return 0;
        }

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

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

using namespace std;
//        tmp = stoi(S.substr(i,3));
int main(){
    ll X,Y;

    cin >> X >> Y;

    cout << (X + Y/2) << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <cmath>
#include <cstdlib>
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define MA(i,j) make_pair(i,j)
#define PA pair<int,int>
#define PB push_back
#define PQ priority_queue<int>
#define PGQ priority_queue<int,vector<int>,greater<int> >
#define VE vector<int>
#define VP vector<PA>
#define YES(i) cout<<(i?"YES":"NO")<<endl
#define Yes(i) cout<<(i?"Yes":"No")<<endl
#define MOD 1000000007
#define INF 1000000007
#define PI 3.14159265358979323846
using namespace std;
//
int main(){
  int A,B,C,D,E,F;
  cin>>A>>B>>C>>D>>E>>F;
  VE V1,V2;
  FOR(i,0,1000){
    FOR(j,0,1000){
      if(A*100*i+B*100*j<=F&&A*100*i+B*100*j!=0){
        V1.PB(A*100*i+B*100*j);
      }
    }
  }
  FOR(i,0,1000){
    FOR(j,0,1000){
      if(C*i+D*j<=F&&C*i+D*j!=0){
        V2.PB(C*i+D*j);
      }
    }
  }
  double MAX=-1;
  int MAX_M=-1,MAX_SUGAR=-1;
  FOR(i,0,(int)V1.size()){
    FOR(j,0,(int)V2.size()){
      if(V1[i]+V2[j]<=F&&V1[i]*E>=V2[j]*100){
        if(MAX<(double)100*V2[j]/(V1[i]+V2[j])){
          MAX=(double)100*V2[j]/(V1[i]+V2[j]);
          MAX_M=V1[i]+V2[j];
          MAX_SUGAR=V2[j];
        }
      }
    }
  }
  if(MAX==-1){
    cout<<100*A<<" "<<0<<endl;
  }else{
    cout<<MAX_M<<" "<<MAX_SUGAR<<endl;
  }
  return 0;
}


Measured memory_bytes: 1400
#include <iostream>
#include <vector>

using namespace std;

int main(void) {
  int N;
  cin >> N;
  vector<int> H(N);
  for (auto& v : H) {
    cin >> v;
  }
  for (int i = 0; i < N; ++i) {
    if (i == 0 || H[i - 1] < H[i]) {
      H[i] -= 1;
    }
  }
  bool flag = true;
  for (int i = 1; i < N; ++i) {
    if (H[i - 1] > H[i]) {
      flag = false;
      break;
    }
  }
  if (flag) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}


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

using ll = long long int;

const int MAX = (int)(1e5 + 5);
const ll INF = (ll)(1e10 + 5);

const int MAX_N = (int)(1e5 + 5);
const ll MOD = (ll)(1e9 + 7);

/////////////////////////////////////////////////////////////
class ModuloOperator {
 public:
  ll modulo;

  ModuloOperator(ll modulo) {
    this->modulo = modulo;
  }

  ll add(ll a, ll b) {
    ll ret = a + b;
    ret %= modulo;
    return ret;
  }

  ll sub(ll a, ll b) {
    ll ret = a - b;
    if (ret < 0)
      ret += modulo;
    else
      ret %= modulo;
    return ret;
  }

  ll mul(ll a, ll b) {
    ll ret = a * b;
    ret %= modulo;
    return ret;
  }

  ll div(ll a, ll b) { return mul(a, pow(b, modulo - 2)); }

  ll pow(ll x, ll y) {
    ll res = 1LL;

    x %= modulo;

    while (y > 0) {
      if (y & 1) {
        res = mul(res, x);
      }

      y = y >> 1;
      x = mul(x, x);
    }

    return res;
  }
};
/////////////////////////////////////////////////////////////

string s;

int n;
ll cnt_a[MAX_N];
ll cnt_c[MAX_N];
ll cnt_q[MAX_N];

ModuloOperator mo(MOD);

ll ans;

int main(void) {
  // Here your code !
  cin >> s;

  n = s.size();

  for (int i = 1; i <= n; ++i) {
    if (s[i - 1] == 'A') cnt_a[i] = 1LL;
    if (s[i - 1] == 'C') cnt_c[i] = 1LL;
    if (s[i - 1] == '?') cnt_q[i] = 1LL;
  }

  for (int i = 1; i <= n; ++i) {
    cnt_a[i] += cnt_a[i - 1];
    cnt_c[i] += cnt_c[i - 1];
    cnt_q[i] += cnt_q[i - 1];
  }

  ans = 0LL;

  for (int i = 2; i < n; ++i) {
    int ind = i - 1;
    if (s[ind] == 'A' || s[ind] == 'C') continue;

    ll left_a = cnt_a[i - 1];
    ll right_c = cnt_c[n] - cnt_c[i];
    ll left_q = cnt_q[i - 1];
    ll right_q = cnt_q[n] - cnt_q[i];

    ll tmp_left= 0LL;
    tmp_left += mo.mul(left_a, mo.pow(3LL, left_q));
    tmp_left += mo.mul(left_q, mo.pow(3LL, max(left_q - 1LL, 0LL)));

    ll tmp_right = 0LL;
    tmp_right += mo.mul(right_c, mo.pow(3LL, right_q));
    tmp_right += mo.mul(right_q, mo.pow(3LL, max(right_q - 1LL, 0LL)));

    ans = mo.add(ans, mo.mul(tmp_left, tmp_right));
  }

  printf("%lld\n", ans);

  return 0;
}


Measured memory_bytes: 2816
def main():
    N, K, Q = map(int, input().split())
    A = list(map(int, input().split()))
    ans = float("inf")
    for X in A:
        targets = []
        t = []
        for a in A:
            if a >= X:
                t.append(a)
            else:
                if len(t) >= K:
                    targets += sorted(t)[:len(t)-K+1]
                t = []
        if len(t) >= K:
            targets += sorted(t)[:len(t)-K+1]
        targets.sort()
        if len(targets) >= Q:
            ans = min(targets[Q-1] - targets[0], ans)
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 43868
#pragma GCC optimize("Ofast,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("fast-math")   
#include <iostream>
#include <complex>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
#include <random>

using namespace std;

#define pb push_back
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define Str(x) to_string(x)
#define len(s) (int)s.size()

typedef long long ll;
typedef long double lld;
typedef string str;
typedef unsigned long long ull;

const int maxn = 1e6 + 2;

int dp[maxn][10][2];

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    vector <int> s;
    string t;
    cin >> t;
    int g = len(t);
    for (auto it : t) {
        s.pb(it - '0');
    }
    while (len(s) != maxn)
        s.pb(0);
    for (int i = 0; i < maxn; i++) {
        for (int j = 0; j < 10; j++) {
            dp[i][j][0] = dp[i][j][1] = 1e9;
        }
    }

    for (int i = 0; i < 10; i++) {
        if (i >= s[0]) {
            dp[0][i][0] = 2 * i - s[0];
        } else {
            dp[0][i][1] = i  + i + 10 - s[0];
        }
    }
    int ans = 1e9;
    for (int i = 1; i < maxn; i++) {
        for (int j = 0; j < 10; j++) {
            for (int last = 0; last < 10; last++) {
                for (int first = 0; first < 2; first++) {
                    for (int second = 0; second < 2; second++) {
                        int x = j - s[i];
                        if (second) {
                            x--;
                        }
                        if (first)
                            x += 10;
                        if (x >= 0 && x < 10) {
                            dp[i][j][first] = min(dp[i][j][first], dp[i-1][last][second] + j + x);
                        }
                    }
                }
            }
            if (i + 1 >= g) {
                ans = min(ans, dp[i][j][0]);
            }
        }
    }
    cout << ans;
    return 0;
}


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

int main() {
  int n, k;
  cin >> n >> k;
  vector<int> l(n);
  int i;
  for (i = 0; i < n; i++) {
    cin >> l.at(i);
  }
  sort(l.begin(), l.end());
  int result = 0;
  for (i = 0; i < k; i++) {
    result += l.at(n - i - 1);
  }
  cout << result << endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<utility>
#include<set>
#include<stack>
#include<list>
#include<deque>
#include<bitset>
#include<iomanip>
#include<cstring>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<climits>
#include<cmath>
#include<cctype>


#define pb push_back
#define mp make_pair
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define ren(i,a,b) for(int i=a;i>=b;i--)
#define ff first
#define ss second
#define pll pair<long long int,long long int>
#define pii pair<int,int>
#define vll vector<long long int>
#define vii vector<int>
#define gi(n) scanf("%d",&n)
#define gll(n) scanf("%lld",&n)
#define gstr(n) scanf("%s",n)
#define gl(n) cin >> n
#define oi(n) printf("%d",n)
#define oll(n) printf("%lld",n)
#define ostr(n) printf("%s",n)
#define ol(n) cout << n
#define os cout<<" "
#define on cout<<"\n"
#define o2(a,b) cout<<a<<" "<<b
#define all(n) n.begin(),n.end()
#define present(s,x) (s.find(x) != s.end())
#define cpresent(s,x) (find(all(s),x) != s.end())
#define tr(container, it) for(__typeof(container.begin()) it = container.begin(); it != container.end(); it++)
using namespace std;

typedef unsigned long long int ull;
typedef long long int ll;
typedef long double ld;
typedef vector<vector<ll> > mat;

int main()
{ios_base::sync_with_stdio(false);
ll n,k,bit;
cin>>n>>k;
map<ll,ll> m;
rep(i,0,30)
{
	if((1ll<<i)&k)
	{
		bit=(1ll<<i);
	}
}
ll ans=0,ans1=0,ans2=0;
while(n--)
{
	ll a,b;
	cin>>a>>b;
	m[a]+=b;
}

map<ll,ll> a,b;

tr(m,it)
{
	ans1+=it->ss;
	a[it->ff]=1;
}

ren(i,30,0)
{
	ll kk=(1ll<<i);
	if(k&kk)
	{
		ll kk1=0;
		tr(a,it)
		{
			if(it->ss==0)continue;
			ll xx=it->ff;
			if((xx&kk)==0)
			{
				kk1+=m[xx];
			}
		}
		ans=max(ans,kk1);
	}
	else
	{
		tr(a,it)
		{
		
			if(it->ss==0)continue;
			ll xx=it->ff;
			if(xx&kk)
			{
				ans1-=m[xx];
				a[xx]=0;
			}
		}
	}	
}
ans=max(ans,ans1);
ol(ans);
return 0;
}



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

#define endl '\n'

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

    int n,m; cin >> n >> m;
    int ans1, ans2=0;
    set<int> acs;
    vector<int> was(n+1, 0);
    for (int i=0; i<m; i++){
        int p; string s;
        cin >> p >> s;
        if (acs.count(p)) continue;
        if (s == "WA") was[p]++;
        else{
            acs.insert(p);
            ans2 += was[p];
        }
    }
    cout << acs.size() << " " << ans2 << endl;
}

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

#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()

typedef vector <int> vi;
typedef pair<int,int> ii;
typedef long long ll;
typedef long double ld;

const int mod = 998244353;
const ll inf = 3e18 + 5;

int add(int a, int b) { return (a += b) < mod ? a : a - mod; }
int mul(int a, int b) { return 1LL * a * b % mod; }  

int main(){
    int n,q;
    cin >> n >> q;
    string s;
    cin >> s;
    vi p;
    for(int i=0; i<n-1; i++){
        if(s[i] == 'A' && s[i+1] == 'C')
            p.push_back(i);
    }
    vector<pair<int, int>> que(q);
    for(int i=0; i<q; i++){
        int l, r;
        cin >> l >> r;
        que[i].first = l-1;
        que[i].second = r-1;
    }
    for(int i=0; i<q; i++){
        int l = que[i].first;
        int r = que[i].second;
        int sol = upper_bound(all(p), r) - lower_bound(all(p), l);
        if(s[r] == 'A' && s[r+1] == 'C')
            sol--;
        cout << sol << endl;
    }
}

Measured memory_bytes: 2044
import java.util.*;

class Main{
    
   public static void main(String a[]) throws java.io.IOException{
       Scanner scan =new Scanner (System.in);
       int [] bType ={0,0,0,0};
       scan.useDelimiter("\\d*,|\\n\\d*,|\\n");
       while(scan.hasNext()){
           String blood = scan.next();
        if(blood.compareTo("A")==0) 
            bType[0]++;
        else if(blood.compareTo("B")==0)
            bType[1]++;
        else if(blood.compareTo("O")==0)
            bType[3]++;
        else 
            bType[2]++;
           }
      
           for(int i=0;i<4;i++)
               System.out.println(bType[i]);
   }
}

Measured memory_bytes: 12000
#include <bits/stdc++.h>
#define ll long long
#define db double
#define fr(i,x) for( int i=0;i<(x);i++)
#define io ios_base::sync_with_stdio(false); cin.tie(NULL);
using namespace std;

int main()
{
    ll n;
    cin>>n;
    ll m,s=0;
    cin>>m;
    ll a[m];
    for (int i = 0; i < m; i++) 
    {
      cin>>a[i];
      s=s+a[i];
    }
    if(s<=n)
    cout<<n-s<<endl;
    else
    cout<<-1<<endl;
}

Measured memory_bytes: 3716
#include <bits/stdc++.h>
#include <algorithm>
#define rep(i, n) for (ll i=0; i<n; ++i)
#define all(obj) (obj).begin(),(obj).end()
using namespace std;
typedef long long ll;
long long GCD(long long x, long long y) { return y ? GCD(y, x%y) : x; }

int main(){
    ll N;
    cin >> N;
    vector<ll> A(N);
    rep(i, N) cin >> A[i];
    ll cnt = 0;
    ll ans = 1;
    sort(A.rbegin(), A.rend());
    rep(i, N){
        if(cnt==2) break;
        if(A[i]==A[i+1]){
            ans*=A[i];
            cnt++;
            i++;
        }
    }
    if(cnt==2) cout << ans << endl;
    else cout << 0 << endl;
    return 0;
}


Measured memory_bytes: 3796
#include <complex>
#include <iostream>


using namespace std;
int main(){
  int x1, x2,x3,x4, y1, y2,y3,y4;
  cin >> x1 >> y1 >> x2 >> y2;

  complex<int> c1(x1,y1), c2(x2,y2);
  complex<int> i(0,1);

  complex<int> c4 = (c2-c1)*i + c1;
  complex<int> c3 = (c2-c1) + c4 ;

  x3 = c3.real();
  x4 = c4.real();
  y3 = c3.imag();
  y4 = c4.imag();

  cout << x3 << " " << y3 << " " << x4 << " " << y4 <<endl;

  

  return 0;
}




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


void main() {
    auto N = readln.chomp.to!int;
    auto A = readln.split.map!(to!long).array;
    A = 0L ~ A ~ 0L;
    long S = (N+1).iota.map!(i => abs(A[i+1]-A[i])).sum;

    foreach (i; 1..N+1) {
        if ((A[i+1] - A[i]) * (A[i] - A[i-1]) >= 0) {
            S.writeln;
        } else {
            long ans = S;
            ans -= abs(A[i+1] - A[i]) + abs(A[i] - A[i-1]);
            ans += abs(A[i+1] - A[i-1]);
            ans.writeln;
        }
    }
}


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

int ComputeMaxGCM(int n, int threshold) {
	int max = sqrt(n);
	vector<int> memo;
	for (int i = 1; i <= max; i++) {
		if (n % i == 0) {
			if (n / i <= threshold)return n / i;
			else memo.push_back(i);
		}
	}
	for (auto i = memo.rbegin();i != memo.rend(); i++) 
		if (*i <= threshold)return *i;
	return 1;
}

int main() {
	int N, M;
	cin >> N >> M;
	int threshold = M / N;
	cout << ComputeMaxGCM(M, threshold) << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <iostream>
#include <sstream>
#include <vector>
#include <string>
#include <math.h>
#include <queue>
#include <list>
#include <algorithm>
#include <map>
#include <set>
#include <stack>
#include <ctime>
#include <iomanip>
#include <fstream>
#include <array>
using namespace std;

#define ALL(c) (c).begin(),(c).end()
#define PB push_back
#define IN(x,c) (find(c.begin(),c.end(),x) != (c).end())
#define REP(i,n) for (int i=0;i<(int)(n);i++)
#define FOR(i,a,b) for (int i=(a);i<=(b);i++)
#define INIT(a,v) memset(a,v,sizeof(a))
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
template<class A, class B> A cvt(B x) { stringstream ss; ss<<x; A y; ss>>y; return y; }

#define SPC << " " <<
#define DEBUG(x) cerr << #x << " = "; cerr << x << endl;
#define DEBUG_ITER(x) cerr << #x << " = "; for (auto _ : x) cerr << _ << ' '; cerr << endl;

typedef pair<int,int> PII;
typedef long long int64;
typedef vector<int> VI;

int n;

int main() {
	//freopen("test.in","r",stdin);
	cin >> n;
	cout << 1-n << endl;
	return 0;
}


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

int main(int argc, char const *argv[])
{
    int h, w, pass = 0, ij = 0;

    cin >> h >> w;

    char s[h][w], ans[h][w];

    for (size_t i = 0; i < h; i++)
    {
        for (size_t j = 0; j < w; j++)
        {
            cin >> s[i][j];

            if (s[i][j] == '#')
            {
                ans[i][j] = '#';
            }
            else
            {
                ans[i][j] = '0';
            }
        }
    }

    for (int i = 0; i < h; i++)
    {
        for (int j = 0; j < w; j++)
        {
            for (int k = i - 1; k < i + 2; k++)
            {
                for (int l = j - 1; l < j + 2; l++)
                {
                    if ((k < 0 || h - 1 < k) || (l < 0 || w - 1 < l))
                    {
                        continue;
                    }
                    if (s[k][l] == '#' && s[i][j] != '#')
                    {
                        ans[i][j]++;
                    }
                }
            }
        }
    }

    for (size_t i = 0; i < h; i++)
    {
        for (size_t j = 0; j < w; j++)
        {
            cout << ans[i][j];
        }
        cout << endl;
    }
}


Measured memory_bytes: 256
#include<stdio.h>
#include<ctype.h>
#include<string.h>
int main(){
	char text;
	while(1){
		scanf("%c",&text);
		if(text=='\n')	break;
		if(islower(text))	printf("%c",toupper(text));
		else if(isupper(text))	printf("%c",tolower(text));
		else	printf("%c",text);
	}
	printf("\n");
	return 0;
}


Measured memory_bytes: 1816
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(n) begin(n), end(n)
using ll = long long;
using namespace std;

bool chk(int now){
	vector<bool> c(3, false);
	string ns = to_string(now);
	rep(i, ns.size()){
		if(ns[i] == '3') c.at(0) = true;
		else if(ns[i] == '5') c.at(1) = true;
		else if(ns[i] == '7') c.at(2) = true;
	}
	rep(i, 3){
		if(c.at(i) == false) return false;
	}
	return true;
}

int main(){
	int n;
	cin >> n;
	queue<int> q;
	q.push(3); q.push(5); q.push(7);
	int ans = 0;
	while(!q.empty()){
		ll now = q.front(); q.pop();
		if(chk(now)) ans++;
		now *= 10;
		if(now+3 <= n) q.push(now+3);
		if(now+5 <= n) q.push(now+5);
		if(now+7 <= n) q.push(now+7);
	}
	cout << ans << endl;
	return 0;
}

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

int main() {
    unsigned long long int l, r;
    cin >> l >> r;

    unsigned long long int min = l * r;
    for (unsigned long long int i = l; i < r; i++) {
        unsigned long long int mod = 0;
        for (unsigned long long int j = i+1; j < r+1; j++) {
            mod = (i * j) % 2019;
            if (mod < min) {
                min = mod;
            }
            if (mod == 0) {
                break;
            }
        }
        if (mod == 0) {
            break;
        }
    }

    cout << min << endl;

    return 0;
}

Measured memory_bytes: 256
import sys

oto = []

N = int(sys.stdin.readline())
for i in range(N):
    input_lines = sys.stdin.readline()
    oto.append(input_lines.split())


mny = 0

for i in range(N):
    if(oto[i][1] == "BTC"):
        mny += float(oto[i][0]) * 380000
    else:
        mny += float(oto[i][0])
        
print(mny)

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

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            ulong A,B,K;
            string input;

            input = Console.ReadLine();
            string[] inputArray = input.Split(' ');

            A = ulong.Parse(inputArray[0]);
            B = ulong.Parse(inputArray[1]);
            K = ulong.Parse(inputArray[2]);

            if(K <= A)
            {
                A -= K;
            }else if (A + B <= K)
            {
                A = 0;
                B = 0;
            }
            else
            {
                B -= K - A;
                A = 0;
            }


            Console.WriteLine(A.ToString() + ' ' + B.ToString());

            return;
        }
    }
}


Measured memory_bytes: 13140
#include <bits/stdc++.h>
using namespace std;
# define LL long long

int main(){
    int p[201]={0};
    int x,n;
    scanf("%d%d",&x,&n);
    for (int i=0;i<n;i++){
        int y;
        scanf("%d",&y);
        p[y]=1;
    }
    int i=x,j=x,ans;
    while (1){
        if (p[i]==0){
            ans=i;
            break;
        }
        if (p[j]==0){
            ans=j;
            break;
        }
        else{
            i-=1;
            j+=1;
        }
    }
    printf("%d",ans);
}

Measured memory_bytes: 3780
#include<iostream>
using namespace std;
int main()
{
    int n,t;
    cin>>n;
    t=n%1000;
    if(t==0)
    {
        cout<<"0\n";
    }
    else
    {
    cout<<(1000-t)<<endl;
    }
    return 0;
    
}

Measured memory_bytes: 3616