akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;

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

        int i;
        int swap;

        int n=sc.nextInt();
        int[] numarr=new int[n];
        for(i=0;i<n;i++){
            numarr[i]=i+1;
        }
        int m=sc.nextInt();
        
        for(i=0;i<m;i++){
            String str=sc.next();
            String[] inte=str.split(",",0);
            int a=Integer.parseInt(inte[0])-1;
            int b=Integer.parseInt(inte[1])-1;
            swap=numarr[a];
            numarr[a]=numarr[b];
            numarr[b]=swap;
        }
        
        for(i=0;i<n;i++){
            System.out.println(numarr[i]);
        }
        sc.close();
    }
}


Measured memory_bytes: 25960
h,w,k = map(int,input().split())
raw = []
for _ in range(h):
  raw.append(input())
if raw[0] == '.' * w:
  for i in range(h):
    if raw[i] != '.' * w:
      raw[0],raw[i] = raw[i],raw[0]
      break
index = 0
for x in raw:
  if x == '.' * w:
    ans = last
  else:
    for i in range(w):
      if i == 0:
        if x[i] == '.':
          ans = [0]
        else:
          ans = [1]
      else:
        if x[i] == '.':
          ans.append(ans[-1])
        else:
          ans.append(ans[-1]+1)
    for i in range(w):
      if ans[i] == 0:
        ans[i] += index+1
      else:
        ans[i] += index
    index = ans[-1]
  print(' '.join(list(map(str,ans))))
  last = ans

Measured memory_bytes: 3700
#include <iostream>
using namespace std;
int count = 0;
int search(int arr[], int x, int n) {
    for (int i = 0; i < n; i++)
        if (arr[i] == x) return i;
    return -1;
}
void printPostOrder(int in[], int pre[], int n, int arr5[]) {
    int root = search(in, pre[0], n);
    if (root != 0) printPostOrder(in, pre+1, root, arr5);
    if (root != n-1) printPostOrder(in+root+1, pre+root+1, n-root-1, arr5);
    arr5[count] = pre[0];
    count++;
}

int main() {
    int num;
    cin >> num;
    int arr[num];
    int arr2[num];
    int arr5[num];
    for (int i = 0; i < num; i++) cin >> arr[i];
    for (int i = 0; i < num; i++) cin >> arr2[i];
    printPostOrder(arr2, arr, num, arr5);
    for (int i = 0; i < num; i++) {
        if (i != num - 1) cout << arr5[i] << " ";
        else cout << arr5[i] << endl;
    }
}


Measured memory_bytes: 3096
import std.stdio;
import std.algorithm;

long countLess(const(long)[] a, long x) {
	long count;

	foreach (e;a) {
		if (e >= 0) {
			long ng = -1, ok = cast(long)a.length;

			while (ok - ng > 1) {
				auto middle = (ok + ng) / 2;

				if (e * a[middle] >= x) {
					ok = middle;
				} else {
					ng = middle;
				}
			}
			count += ok;
		} else {
			long ng = -1, ok = cast(long)a.length;

			while (ok - ng > 1) {
				auto middle = (ok + ng) / 2;
				if (e * a[middle] < x) {
					ok = middle;
				} else {
					ng = middle;
				}
			}
			count += cast(long)a.length - ok;
		}

		if (e * e < x) {
			--count;
		}
	}

	return count / 2;
}

void main() {
	long n, k;
	readf(" %s %s", &n, &k);
	auto a = new long[n];
	foreach (ref e;a) {
		readf(" %s", &e);
	}

	sort(a);

	long ok = long.min / 2 + 1, ng = long.max / 2;

	while (ng - ok > 1) {
		auto middle = (ok + ng) / 2;
		auto count = countLess(a, middle);

		if (count < k) {
			ok = middle;
		} else {
			ng = middle;
		}
	}

	writeln(ok);
}


Measured memory_bytes: 3452
import java.util.ArrayDeque;
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		while(sc.hasNext()){
			int N = sc.nextInt(), x = sc.nextInt();
			if(x == 1 || x == 2 * N - 1) {
				System.out.println("No");
				break;
			}
			System.out.println("Yes");
			int low = x - 1, high = x + 1;
			ArrayDeque<Integer> deq = new ArrayDeque<Integer>();
			deq.add(x);
			while(low != 0 || high != 2*N) {
				if(low == 0) {
					deq.push(high);
					deq.add(high+1); high += 2;
				}else if(high == 2*N) {
					deq.add(low);
					deq.push(low - 1); low -= 2;
				}else {
					deq.push(low); low--;
					deq.add(high); high++;
				}
			}
			for(int s : deq) System.out.println(s);
		}
	}
}

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

int main()
{
    int n, a, b;
    cin >> n >> a >> b;
    if ((n * a) > b)
    {
        std::cout << b << std::endl;
    }
    else if ((n * a) < b)
    {
        std::cout << n * a << std::endl;
    }
    else
    {
        std::cout << b << std::endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
int main(){
	int N; 
	cin >> N; 
	int A[510][510] = {}; 
	int count = 1; 
	for(int i = 0; i < 500; i++){
		for(int j = 0; j <= i; j++){
			A[i-j][j] = count; 
			count ++; 
		}
	}
	int K = -1;
	for(int i = 0; i < 500; i++){
		if(N == A[0][i]){
			K = i;
		}
	}
	if(K == -1){cout << "No" << endl;}
	else{cout << "Yes" << endl << N * 2 / (K+1) << endl; 
         cout << K + 1 << " "; 
	for(int i = 0; i <= K; i++){
		cout << A[K-i][i] << " "; 
	}
	cout << endl; 
	for(int i = 0; i <= K; i++){
             cout << K+1 << " "; 
		for(int j = 0; j <= K - i; j++){
			cout << A[j][i] << " ";
		}
		for(int j = 0; j < i; j++){
			cout << A[K - i][j] << " ";
		}
		cout << endl; 
	}
}
}

Measured memory_bytes: 2432
use proconio::{input, fastout , marker::*};

#[fastout]
fn main() {
  input!{
    h:i64,
    w:i64,
    k:i64,
    c:[Chars;h]
  }
  let mut ans = 0;
  for hbit in 0..1 << h{
    for wbit in 0..1 << w {
        let mut x = 0;
        for i in 0..h {
            for j in 0..w {
                if ((hbit >> i) & 1) == 0 && ((wbit >> j) & 1) == 0 && c[i as usize][j as usize] == '#' {
                    x += 1;
                }
            }
        }
        if x == k {
            ans += 1;
        }
    }
  }
  println!("{}",ans);
}


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

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        final String word = br.readLine().toUpperCase();
        int count = 0;
        while (true){
            String line = br.readLine();
            if (line==null|line=="END_OF_TEXT"){
                break;
            }
            String[] ln = line.split("[.,!\"?:... ]");
            for (int i=0; i<ln.length; i++){
                //System.out.println(ln[i]);
                String tmp = ln[i].toUpperCase();
                if (tmp.equals(word)){
                    count++;
                }
            }
        }
        System.out.println(count);
    }
}

Measured memory_bytes: 17036
#include "bits/stdc++.h"
#include <regex>
#define _USE_MATH_DEFINES
#include <math.h>

using namespace std;

#ifndef _DEBUG
#define main_ main
#endif
#define FOR(i,s,e) for (int i = int(s); i != int(e); i++)
#define INF (INT_MAX/2)
#define EPS (1.0e-8)
#define LINF (LONG_MAX/2)

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;

template <typename T>
using keyVal = pair<string, T>;
template<typename T>
bool val_greater(const keyVal<T>& left, const keyVal<T>& right) {
	return left.second > right.second;
}

void init_global() {}

int main_() {
	int A, B, C, D;
	cin >> A >> B >> C >> D;

	int ans = max(A*B, C*D);

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


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

#define rep(i, a, b) for (ll i = a; i < b; i++)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> pll;
typedef unordered_map<string, ll> u_map;

// input
void input() {}
template <class Head, class... Tail>
void input(Head &&a, Tail &&... b)
{
    cin >> a;
    input(forward<Tail>(b)...);
}

template <class V>
void input(vector<V> &v)
{
    for_each(v.begin(), v.end(), [](auto &i) { input(i); });
}

// output
template <class V>
void output(vector<V> &v)
{
    for_each(v.begin(), v.end(), [](auto &x) { cout << x << " "; });
    cout << endl;
}

// math functions
ll mpow(ll a, ll n, ll p)
{
    ll x = 1;
    while (n > 0)
    {
        if (n & 1)
        {
            x = a * x % p;
        }
        a = a * a % p;
        n >>= 1;
    }

    return x;
}

ll mfact(ll n, ll p)
{
    ll res = 1;
    for (ll i = 2; i <= n; i++)
    {
        res = res * i % p;
    }
    return res;
}

ll mcomb(ll n, ll r, ll p)
{
    if (n == 0 && r == 0)
    {
        return 1;
    }
    if (n < r || n < 0 || r < 0)
    {
        return 0;
    }

    ll a = mfact(n, p);
    ll b = mfact(n - r, p);
    ll c = mfact(r, p);
    return (((a * mpow(b, p - 2, p)) % p) * mpow(c, p - 2, p)) % p;
}

ll gcd(ll a, ll b)
{
    if (a < b)
    {
        a ^= b;
        b ^= a;
        a ^= b;
    }
    return b ? gcd(b, a % b) : a;
}

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

int main()
{
    ll N;
    input(N);

    vector<ll> v(N, 0);
    input(v);

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

    bool res = true;
    rep(i, 0, N - 1)
    {
        if (v[i] == v[i + 1])
        {
            res = false;
            break;
        }
    }

    cout << (res ? "YES" : "NO") << endl;

    return 0;
}

Measured memory_bytes: 1792
N,K = map(int,input().split())
A = list(map(int,input().split()))

P = 10**9+7

ans = 0
for i in range(N):
    for j in range(N):
        if i == j:
            continue
        if A[i] > A[j]:
            if i < j:
                ans += K*(K+1)//2
                ans %= P
            else:
                ans += K*(K-1)//2
                ans %= P
print(ans)


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

int main()
{
	int x,y;
	cin>>x>>y;
	for(int i=0;i<=x;i++)
	{
		if(y==i*4+2*(x-i))
		{
			cout<<"Yes";
			return 0;
		}
	}
	cout<<"No";
}



Measured memory_bytes: 3584
#include<iostream>
#include<algorithm>
#include<cstdint>

int64_t const MOD = 1e9+7;

template<int64_t Prime>
struct mod_int {
  int64_t v_;
  mod_int(int64_t x=0) : v_(x) { normalize(); }
  void normalize() { ((v_ %= Prime) += Prime) %= Prime; }
  mod_int operator+=(mod_int const& r){ (v_ += r.v_) %= Prime; return *this; }
  mod_int operator-=(mod_int const& r){ (v_ += Prime - r.v_) %= Prime; return *this; }
  mod_int operator*=(mod_int const& r){ (v_ *= r.v_) %= Prime; return *this; }
  mod_int operator+(mod_int const& r) { mod_int res(*this); return res += r; }
  mod_int operator-(mod_int const& r) { mod_int res(*this); return res -= r; }
  mod_int operator*(mod_int const& r) { mod_int res(*this); return res *= r; }
  mod_int pow(int x) const {
    int64_t res = 1, v = v_;
    while(x > 0) {
      if(x&1) (res *= v) %= Prime;
      x/=2; (v *= v) %= Prime;
    }
    return mod_int(res);
  }
  mod_int inv() const { return pow(Prime-2); }
};
typedef mod_int<MOD> mint;


mint f(int64_t k, int64_t N) {
  return mint(N+1)*mint(k+1)*mint(k)*mint(2).inv()
       - mint(k)*mint(k+1)*mint(k*2+1)*mint(6).inv()
       + mint(k);
}

int main() {
  int64_t N, K; std::cin >> N >> K;
  mint ans = f(N+1, N) - f(K-1, N);
  std::cout << ans.v_ << std::endl;
  return 0;
}


Measured memory_bytes: 3636
#include <stdio.h>
#define N 101
#define INF 0xffff
#define NIL 0

typedef enum {
  WHITE,
  BLACK,
} color_t;


int main(){
  int n, i, j, u ,k;
  int w[N][N]= {0}; // 1-origin
  int adj[N][N] = {0}; // 1-origin
  int v;
  int d[N], pi[N];
  color_t color[N];
  int mincost;
  int sum=0;

  scanf("%d", &n);
  for ( i = 1; i <= n; i++ ){
    for( j = 1 ; j <= n ; j++){
      scanf("%d", &w[i][j]);
    }
  }

  //set adj
  for( i = 1; i <= n ; i++ ){
    k = 1;
    for( j = 1; j <= n ; j++ ){
      if( w[i][j] != -1 ){
	adj[i][k] = j;
	k++;
      }
    }
  }

  //prim()
  const int r = 1; // arbitrary root

  for( u = 0 ; u <= n ; u++){
    d[u] = INF;
    pi[u] = NIL;
    color[u] = WHITE;
  }
  d[r] = 0;
  
  while(1){
    mincost = INF;
    for(i = 1 ; i <= n ; i++){
      if( color[i] != BLACK && d[i] < mincost ){
	mincost = d[i];
	u = i;
      }
    }

    if(mincost == INF){
      break;
    }
    
    color[u] = BLACK;  // This is the missing code in the p33.
    for( j=1 ; j <= n ; j++){
      v = adj[u][j];
      if( v == 0 ){
	break;
      }
      if( color[v] != BLACK && w[u][v] < d[v] ){
	pi[v] = u;
	d[v]  = w[u][v];
      }
    }
    
  }

  // print
  sum = 0;
  for( i = 1 ; i <= n ; i++ ){
    sum += d[i];
  }
  printf("%d\n" , sum);

  return 0; // Don't forget return 0
}

Measured memory_bytes: 688
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main(){
  ll n,i,j,k;
  cin>>n>>k;
  ll a[n+1];
  ll dp[n+1];
  dp[1]=0;
  for(i=1;i<=n;i++){
    cin>>a[i];
  }
  for(i=2;i<=n;i++){
      dp[i]=dp[i-1]+abs(a[i]-a[i-1]);
      for(j=i-1;j>=(i-k);j--){
        if(j>=1){
          dp[i]=min(dp[i],dp[j]+abs(a[i]-a[j]));
        }
      }
    }
  cout<<dp[n]<<endl;
}


Measured memory_bytes: 1792
Q,H,S,D=map(int,input().split())
N=int(input())

if D%2==1:
    f=1
else:
    f=0

if N//2==0:
    g=1
else:
    g=0

Q*=4
H*=2
S=S
D2=D/2.0
D=D

cnt=0
cost=[[Q,1],[H,1],[S,1],[D2,2]]
cost2=[[Q,1],[H,1],[S,1]]
if min(cost)[1]==2:
    if not(f==1 and g==1):
        cnt+=D*(N//2)
        N%=2

if N!=0:
    cnt+=min(cost2)[0]*N
print(int(cnt))

Measured memory_bytes: 3192
#include <iostream>
#include <fstream>
#include <string> 
#include <cmath>  
#include <cstdlib>
#include <ctime>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <set>
#include <functional>

#define FOR(i, m, n) for(int i = (m);i < (n);i++)
#define REP(i,n) for(int i = 0; i < int(n); i++)
#define VI vector<int>
#define VVI vector<vector<int>>
#define VVVI vector<vector<vector<int>>>


using namespace std;
using ll = long long;

int main() {
	int N;
	string S;
	cin >> S;
	N = stoi(S);
	int c=0;
	if (N%10 == 1) c++;
	N /= 10;
	if (N % 10 == 1) c++;
	N /= 10;
	if (N % 10 == 1) c++;
	cout << c << endl;



	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
import java.util.Arrays;
public class Main {
    public static int a,b;
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while(true){
            a=sc.nextInt();
            b=sc.nextInt();
            if(a==0&&b==0){
                sc.close();
                return;
            }
            for(int i=0;i<a;i++){
                for(int j=0;j<b;j++){
                    if((i+j)%2==0){
                        System.out.printf("#");
                    }else{
                        System.out.printf(".");
                    }
                }
                System.out.printf("\n");
            }
            System.out.printf("\n");
        }
    }
}


Measured memory_bytes: 61524
#include <iostream>

using namespace std;

typedef long long ll;

int main() {
	ll dp[34] = {1};
	for (int i = 0; i < 31; i++) {
		for (int j = 1; j < 4; j++) {
			dp[i+j] += dp[i];
		}
	}
	ll n;
	while (cin >> n) {
		if (!n) { break; }
		if (!(dp[n] % 3650)) {
			cout << int(dp[n] / 3650); 
		} else {
			cout << int(dp[n] / 3650 + 1);
		}
		cout << endl;
	} 
	return 0;
} 



Measured memory_bytes: 3052
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef long double ld;

template< typename T >
vector< T > convert_base(T x, T b) {
  vector< T > ret;
  T t = 1, k = abs(b);
  while(x) {
    ret.emplace_back((x * t) % k);
    if(ret.back() < 0) ret.back() += k;
    x -= ret.back() * t;
    x /= k;
    t *= b / k;
  }
  if(ret.empty()) ret.emplace_back(0);
  reverse(begin(ret), end(ret));
  return ret;
}

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n;
  cin >> n;
  vector<int> a = convert_base(n,-2);
  REP(i,a.size()) cout << a[i];
  return 0;
}

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

x = [None] * N
x[0] = 0
for i in range(2, N, 2):
    x[i] = x[i-2] + (A[i-1] - A[i-2]) * 2
x[1] = x[-1] + (A[0] - A[-1]) * 2
for i in range(3, N-1, 2):
    x[i] = x[i-2] + (A[i-1] - A[i-2]) * 2

import numpy as np
ma = np.mean(A)
mx = np.mean(x)
x = (np.array(x) + ma - mx + 0.1).astype(int)
for i in range(N-1):
    print(x[i], end=" ")
print(x[-1])



Measured memory_bytes: 22024
#include <stdio.h>

int main(){
    int n, ans;

    scanf("%d", &n);

    ans = n;    
    char s[n + 1];

        scanf("%s", s);

    for(int i = 0; i < n - 1; i ++){
        if(s[i] == s[i + 1]){
            ans -= 1;
        }
    }


    printf("%d", ans);
    return 0;
}

Measured memory_bytes: 256
import java.util.ArrayDeque;
import java.util.Scanner;

public class Main {

	private static ArrayDeque<Character> q = new ArrayDeque<Character>();

	public static void main(String[] args) {

        //input
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.nextLine());

        char[] c;
        while(n-- > 0){
        	c = sc.nextLine().toCharArray();
        	q.add(c[0]);
        	char t;
        	for(int i=1;i<c.length;i++){
        		t = c[i];
       			i+=2;
       			if(!q.contains(c[i])){
       				if(t == '<'){q.addFirst(c[i]);}
       				if(t == '-'){q.addLast(c[i]);}
   				}
        	}
        	for(char ch:q){System.out.print(ch);}
        	System.out.println();
        	q.clear();
        }
	}
}

Measured memory_bytes: 21404
import java.util.*;
import java.io.*;
public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        int n=Integer.parseInt(br.readLine());
        StringTokenizer st=new StringTokenizer(br.readLine());
        int[] a=new int[2*n];
        for(int i=0;i<2*n;i++){ a[i]=Integer.parseInt(st.nextToken()); }
        Arrays.parallelSort(a);
        int sum=0;
        for(int i=0;i<2*n;i+=2){ sum+=a[i]; }
        System.out.println(sum);
    }
}

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


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

Measured memory_bytes: 3608
#ifdef Prateek
  #include "Prateek.h"
#else
  #include <bits/stdc++.h>
  using namespace std;
  #define debug(...) 42
#endif
#define F first
#define S second
#define pb push_back
#define f(i,x,n) for(int i=x;i<n;i++)
#define all(c) c.begin(),c.end()
#define int ll
using ll = long long;
const int MOD = 1e9+7, N = 1e5 + 10; 

int32_t main(){
   ios::sync_with_stdio(false);
   cin.tie(NULL);
   int a,b,c,d;
   cin >> a >> b >> c >> d;
   cout << max({a*c,a*d,b*c,b*d});
   return 0;
} 

Measured memory_bytes: 3608
n = int(input())
s = list(map(int,input().split()))
 
maxans = 0
minans = 0
 
color = [0]*8
red = 0
 
for i in s:
    if i>=3200:
        red += 1
    else:
        color[i//400] = 1
        
x = sum(color)
 
if x == 0:
    print(1,red)
else:
    print(x,x+red)

Measured memory_bytes: 9104
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <assert.h>
 
using namespace std;
 
typedef long long ll;
 
#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define per(i,a,b) for(ll i=b-1LL;i>=(a);--i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define ctos(c) string(1,c)
#define print(x) cout<<#x<<" = "<<x<<endl;
 
#define MOD 1000000007

int main(){
  ll K,n;
  cin>>K>>n;
  vector<ll> v1;
  rep(i,0,n){
    ll a;
    cin>>a;
    v1.pb(a);
  }
  vector<ll> v;
  rep(i,0,v1.sz){
    v.pb(v1[i]);
  }
  rep(i,0,v1.sz){
    v.pb(K+v1[i]);
  }
  ll mx = 0;
  rep(i,0,v.sz-1){
    mx = max(mx,v[i+1]-v[i]);
  }
  cout << K-mx << endl;
  return 0;
}

Measured memory_bytes: 7920
#include <bits/stdc++.h>
#define rep(i, n) for(ll i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
const double PI=acos(-1);

int main(){
    ll l, r;

    cin >> l >> r;
    vector<ll> a;
    for(ll i = l; i <= l+2019 && i <= r; ++i){
        ll mod = i%2019;
        a.push_back(mod);
    }
    ll mi = 9999;
    rep(i, a.size()){
        for(ll j = i+1; j < a.size(); ++j){
            //printf("%lld * %lld % 2019 = %lld\n", a[i], a[j], (a[i]*a[j])%2019);
            mi = min(mi, a[i]*a[j]%2019);
        }
    }
    cout << mi << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n, m) for (int i = (int)(n); i < (int)(m); i++)
#define repr(i, n, m) for (int i = (int)(n) - 1; i >= (int)(m); i--)
using namespace std;
using ll = int64_t;
const int MOD = 1000000007; // 10^9+7

int N, M, K;
vector<vector<int>> friends, block, group;
vector<int> aff;

int groupID = 0;

void dfs(int a) {
    rep(i, 0, friends[a].size())
    {
        if (aff[friends[a][i]] == -1)
        {
            group[groupID].push_back(friends[a][i]);
            aff[friends[a][i]] = groupID;
            dfs(friends[a][i]);
        }
    }
}

int main() {
    // https://atcoder.jp/contests/abc157/tasks/abc157_d

    cin >> N >> M >> K;
    friends.resize(N);
    block.resize(N);
    group.resize(N); // 余裕をもって
    aff.resize(N);
    rep(i, 0, N) aff[i] = -1;

    rep(i, 0, M)
    {
        int a, b;
        cin >> a >> b;
        a--; b--;
        friends[a].push_back(b);
        friends[b].push_back(a);
    }

    rep(i, 0, K)
    {
        int c, d;
        cin >> c >> d;
        c--; d--;
        block[c].push_back(d);
        block[d].push_back(c);
    }

    rep(i, 0, N)
    {
        if (aff[i] == -1)
        {
            aff[i] = groupID;
            group[groupID].push_back(i);
            dfs(i);
            groupID++;
        }
    }

    rep(i, 0, N){
        int cnt = 0;
        rep(k, 0, block[i].size())
        {
            if (aff[i] == aff[block[i][k]]) cnt++;
        }
        cout << group[aff[i]].size() - cnt - friends[i].size() - 1;
        if (i != N - 1) cout << " ";
        else cout << endl;
    }
}


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

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << setprecision(20);
  int n;
  cin >> n;
  vector<int> c(n), v(n);
  rep(i, n) { cin >> v[i]; } 
  rep(i, n) { cin >> c[i]; } 
  int ans = INT_MIN;
  for (int i = 0; i < 1 << n; ++i) {
    int x = 0, y = 0;
    for (int j = 0; j < n; ++j) {
      if (i & 1 << j) {
        x += v[j];
        y += c[j];
      }
    }
    ans = max(x - y, ans);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <vector>
#include <iostream>
#include <cmath>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <fstream>
#include <unistd.h>
#include <string>
#include <numeric>
#include <queue>
#include <deque>
#include <sstream>
#include <iomanip>
#include <set>
#include <stack>
#include <cassert>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<vvb> vvvb;
typedef vector<vvvb> vvvvb;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<vvd> vvvd;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
typedef vector<P> vp;
typedef vector<PL> vpl;
typedef vector<vector<P>> vvp;
typedef vector<vector<PL>> vvpl;
const int INF = 1001001001;
const ll LINF = 1e16;
const double pi = 3.1415926535897932;
const string endstr = "\n";
#define FOR(i, a, b) for(ll i = (a); i < b; i++)
#define RFOR(i, a, b) for(ll i = (a); i > b; i--)
#define REP(i, n) for(ll i = 0; i < n; i++)
#define RREP(i, n) for(ll i = n-1; i > -1; i--)
#define FORMAP(it, m) for(auto it = m.begin(); it != m.end(); it++)
#define ff first
#define ss second
#define pb push_back
#define epb emplace_back

template <typename T>
T gcd(T a, T b) {
    return (a == 0) ? b : gcd(b%a, a);
}
template <typename T>
T lcm(T a, T b) {
    return a / gcd(a, b) * b;
}

bool p_comp_fs(const PL p1, const PL p2){ return p1.first < p2.first;};
bool p_comp_fg(const PL p1, const PL p2){ return p1.first > p2.first;};
bool p_comp_ss(const PL p1, const PL p2){ return p1.second < p2.second;};
bool p_comp_sg(const PL p1, const PL p2){ return p1.second > p2.second;};
template <typename T>
vector<T> uniquen(vector<T> vec){
    vec.erase(unique(vec.begin(), vec.end()), vec.end());
    return vec;
}


int main(){
    ll K; cin >> K; vl A(K); REP(i, K) cin >> A[i];
    ll l = 2, r = 2;
    for (ll i = K-1; i >= 0; i--) {
        ll a = A[i];
        // a mul
        ll la = ((l+a-1)/a) * a;
        ll ra = (r/a) * a;
        if(la > r && ra < l){
            cout << -1 << endl; return 0;
        }
        l = la;
        r = ra+(a-1);
    }
    cout << l << " " << r << endstr;
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long int;
using ull = unsigned long long int;
using P = pair<int, int>;
using P3 = pair<int,P>;
using PP = pair<P ,P>;
constexpr ll MOD = ll(1e9+7);
constexpr int IINF = INT_MAX;

vector<vector<P> > g;
int dist[105][15];

int main(){
    int c, n, m, s, d;
    while(cin >> c >> n >> m >> s >> d, n){
        s--; d--;
        g.clear();
        g.resize(n);
        for(int i=0;i<m;i++){
            int a, b, f;
            cin >> a >> b >> f;
            a--; b--;
            g[a].push_back(P(b,f));
            g[b].push_back(P(a,f));
        }
        for(int i=0;i<n;i++){
            fill(dist[i], dist[i]+c+1, IINF/2);
        }
        dist[s][c] = 0;
        priority_queue<P3, vector<P3>, greater<P3> > que;
        que.push(P3(0, P(s, c)));
        while(!que.empty()){
            auto p = que.top();
            que.pop();
            int now = p.second.first, r = p.second.second;
            if(dist[now][r] < p.first) continue;
            for(auto e : g[now]){
                int nxt = e.first, f = e.second;
                if(dist[nxt][r] > dist[now][r] + f){
                    dist[nxt][r] = dist[now][r] + f;
                    que.push(P3(dist[nxt][r], P(nxt,r)));
                }
                if(r>0 && dist[nxt][r-1] > dist[now][r] + f/2){
                    dist[nxt][r-1] = dist[now][r] + f/2;
                    que.push(P3(dist[nxt][r-1], P(nxt,r-1)));
                }
            }
        }
        int ans = IINF;
        for(int i=0;i<=c;i++){
            ans = min(ans, dist[d][i]);
        }
        cout << ans << endl;
    }

    return 0;
}


Measured memory_bytes: 3136
#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
using namespace std;
char a[105],b[105];
int la,lb;
bool cmp1(char x,char y)
{
	return x<y;
}
bool cmp2(char x,char y)
{
	return x>y;
}
int main()
{
	scanf("%s",a+1);
	scanf("%s",b+1);
	la=strlen(a+1);
	lb=strlen(b+1);
	sort(a+1,a+la+1,cmp1);
	sort(b+1,b+lb+1,cmp2);
	if(strcmp(a+1,b+1)<0)  cout<<"Yes";
	else  cout<<"No";
	return 0;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline

n = int(input())
A = list(map(int,input().split()))

dp = [[-float("INF")]*(n+1) for i in range(n+1)]
low = [-float("INF")]*(n+1)
m = 0
a,b = A[:2]
dp[a][b] = 0
dp[b][a] = 0
low[a] = 0
low[b] = 0
base = 0

for _ in range(1,n):
    a,b,c = A[3*_-1:3*_+2]
    q = []
    if a==b==c:
        base += 1
        continue
    m1 = max(m,max(dp[a][a],dp[b][b],dp[c][c])+1)
    for j in range(3):
        q.append((a,b,max(m,dp[c][c]+1)))
        for i in range(1,n+1):
            q.append((a,i,low[i]))
        if a==b:
            for i in range(1,n+1):
                q.append((c,i,dp[a][i]+1))
                m1 = max(m1,dp[a][i]+1)
        a,b,c = b,c,a
    for a,b,v in q:
        dp[a][b] = max(dp[a][b],v)
        dp[b][a] = max(dp[b][a],v)
        low[a] = max(low[a],v)  
        low[b] = max(low[b],v)      
    m = m1
print(max(m,dp[A[-1]][A[-1]]+1)+base)




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

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

using namespace std;

using ll = long long;
using P = pair<int, int>;

int main() {
  int a, b, x;
  cin >> a >> b >> x;

  double res = 3;
  if ((a * b) / 2 * a > x) {
    // 三角形の範囲まで傾ける必要がある
    // 傾けて零れるときに水がかかる長さを求める
    // ((a2 * b) / 2) * a == x より
    double a2 = (double) x * 2 / a / b;
    // a2の対角のtan
    double tanA2 = a2 / b;
    res = 90 - (atan(tanA2) * 180.0 / M_PI);
  } else {
    // 台形の範囲で傾ければ済む
    // 上底の長さ
    // (((b2 + b) * a) / 2) * a  == x より
    double b2 = ((double) x * 2 / a / a) - b;
    double tanB2 = a / (b - b2);
    res = 90 - (atan(tanB2) * 180.0 / M_PI);
  }

  cout << fixed << setprecision(10) << res << endl;

  return 0;
}


Measured memory_bytes: 512
import java.util.Scanner;

class Main{
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        
        for(;;){
            int m = sc.nextInt();
            int f = sc.nextInt();
            int r = sc.nextInt();
                
            if((m&f&r) == -1) break;

            if (m*f < 0){
                System.out.println("F");
            }else if (m+f >= 80){
                System.out.println("A");
            }else if (m+f >= 65){
                System.out.println("B");
            }else if (m+f >= 50){
                System.out.println("C");
            }else if (m+f >= 30){
                if (r >= 50){
                    System.out.println("C");
                }else{
                    System.out.println("D");
                }
            }else{
                System.out.println("F");
            }
        }
    }
}


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

int main() {
    int n;
    cin >> n;
    vector<int>a(n);
    vector<int>b(n);
    rep(i,n) {
        int x,y;
        cin >> x >> y;
        a[i] = x+y;
        b[i] = x-y;
    }
    sort(a.rbegin(),a.rend());
    sort(b.rbegin(),b.rend());
    int ans = max(abs(a[n-1]-a[0]),abs(b[0]-b[n-1]));
    cout << ans << endl;
}

Measured memory_bytes: 4824
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb emplace_back
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,ll> pll;

int n;
ll d,a;
ll x[200001],h[200001],s[200002];
pll xh[200001];
int main(){
    cin>>n>>d>>a;
    rep(i,n){
        cin>>x[i]>>h[i];
        xh[i]={x[i],h[i]};
    }
    sort(xh,xh+n);
    rep(i,n) x[i]=xh[i].first,h[i]=xh[i].second;
    ll cnt=0;
    int l=0,r=0,px;
    ll cur=0;
    while(l<n){
        px=lower_bound(x,x+n,x[l]-d*2)-x;
        cur+=-s[px];
        ll nx=max(0ll,(h[l]+a-1)/a-cur);
        cnt+=nx;
        s[l+1]=s[l]+nx;
        cur=s[l+1];
        ++l;
    }
    cout<<cnt<<endl;
    return 0;
}


Measured memory_bytes: 8064
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <algorithm>
#include <iomanip>
#include <string.h>

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

typedef long long lint;

using namespace std;

int main(){
  int N;
  cin>>N;
  map<string,int> m;
  REP(i,N){
    string S;
    cin>>S;
    m[S]++;
  }
  int n=0;
  for(auto e:m){
    n=max(n,e.second);
  }
  for(auto e:m)if(e.second==n){
    cout<<e.first<<endl;
  }
  return 0;
}


Measured memory_bytes: 25216
#include <iostream>
#include <iomanip>
#include <vector>
#include <array>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <string>
#include <algorithm>
#include <limits>
#include <iterator>
#include <cmath>
#include <numeric>
#include <stack>
#include <queue>
#include <cassert>
#include <forward_list>
#include <chrono>
#include <deque>
#include <list>
#include <random>
#include <cstdio>
#include <sstream>

using namespace std;

//最大公約数
template<class T>
inline T GCD(T m, T n)
{
	T temp;
	while (m % n != 0)
	{
		temp = n;
		n = m % n;
		m = temp;
	}
	return n;
}

//最小公倍数
template<class T>
inline T LCM(T m, T n)
{
	return m * n / GCD(m, n);
}

int main()
{
	int l, r; cin >> l >> r;
	int m = r - l;
	l = l % 2019; r = r % 2019;
	if (l >= r || m >= 2019) { r += 5000; }
	int ans = numeric_limits<int>::max();
	for (int i = l; i < r; ++i)
	{
		for (int j = i + 1; j <= r; ++j)
		{
			int n = (i * j) % 2019;
			ans = (ans > n) ? n : ans;
		}
	}

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, s, n) for (int i = s; i < n; i++)
#define ALL(a) a.begin(), a.end()
#define MOD 1000000007
using namespace std;
typedef long long ll;

ll xorsum(ll n) {
    return ((n + 1) / 2 % 2) ^ ((n + 1) % 2 ? n : 0);
}

// ll xorsum2(ll n) {
//     ll ans = 0;
//     for (int i = 1; i <= n; i++) {
//         ans ^= i;
//     }
//     return ans;
// }

int main() {
    ll A, B; cin >> A >> B;
    // cout << "A : " << xorsum(A - 1) << " " << xorsum2(A - 1) << endl;
    // cout << "B : " << xorsum(B) << " " << xorsum2(B) << endl;
    cout << (xorsum(B) ^ xorsum(A - 1)) << endl; 
    return 0;
}

Measured memory_bytes: 256
from collections import deque
import sys
n=int(input())
N=[]
O=deque()
for i in range(n):
  N=input().split()
  if N[0]=='insert':
    O.appendleft(N[1])
  elif N[0]=='delete':
    try:
      O.remove(N[1])
    except ValueError:
      pass  # do nothing!
  elif N[0]=='deleteFirst':
    O.popleft()
  elif N[0]=='deleteLast':
    O.pop()
print(' '.join(map(str, O)))



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

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


Measured memory_bytes: 256
/*
author : seryu
title : ABC166D_"I hate Factorization"
*/
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
#define reps(i,n) for(int i = 1; i <= n; i++)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define ERASE(x,val) x.erase(remove(all(x), val), x.end())
typedef long long ll;
typedef pair<int, int> P;
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; }
ll MOD = 1000000007;
int INF = 1001001001;

void solve()
{
	ll x;
	cin >> x;
	ll a = 1;
	while (true)
	{
		for (ll b = -a; b < a; b++)
		{
			if(ll(pow(a,5)-pow(b,5)) == x)
			{
				cout << a << " " << b << endl;
				return;
			}
		}
		a++;
	}	
	return;
}

int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	solve();
	return 0;
}


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

template <class Abel> struct BIT {
    vector<Abel> dat[2];
    Abel UNITY_SUM = 0;                     // to be set
    
    /* [1, n] */
    BIT(int n) { init(n); }
    void init(int n) { for (int iter = 0; iter < 2; ++iter) dat[iter].assign(n + 1, UNITY_SUM); }
    
    /* a, b are 1-indexed, [a, b) */
    inline void sub_add(int p, int a, Abel x) {
        for (int i = a; i < (int)dat[p].size(); i += i & -i)
            dat[p][i] = dat[p][i] + x;
    }
    inline void add(int a, int b, Abel x) {
        sub_add(0, a, x * -(a - 1)); sub_add(1, a, x); sub_add(0, b, x * (b - 1)); sub_add(1, b, x * (-1));
    }
    
    /* a is 1-indexed, [a, b) */
    inline Abel sub_sum(int p, int a) {
        Abel res = UNITY_SUM;
        for (int i = a; i > 0; i -= i & -i) res = res + dat[p][i];
        return res;
    }
    inline Abel sum(int a, int b) {
        return sub_sum(0, b - 1) + sub_sum(1, b - 1) * (b - 1) - sub_sum(0, a - 1) - sub_sum(1, a - 1) * (a - 1);
    }
    
    /* debug */
    void print() {
        for (int i = 1; i < (int)dat[0].size(); ++i) cout << sum(i, i + 1) << ",";
        cout << endl;
    }
};

int main() {
    int N; cin >> N;
	int Q; cin >> Q;
    vector<int> a(N);
    for (int i = 0; i < N; ++i) cin >> a[i];
    
    vector<int> lefts(Q), rights(Q), ids(Q);
    for (int i = 0; i < Q; ++i) {
        cin >> lefts[i] >> rights[i];
        --lefts[i];
        ids[i] = i;
    }
    sort(ids.begin(), ids.end(), [&](int i, int j) {
            return rights[i] < rights[j];});

    BIT<int> bit(N+5);
    vector<int> prev(1100000, -1);
    vector<int> res(Q, 0);
    int r = 0;
    for (auto i : ids) {
        for (; r < rights[i]; ++r) {
            bit.add(prev[a[r]]+2, r+2, 1);
            prev[a[r]] = r;
        }
        int tmp = bit.sum(lefts[i]+1, lefts[i]+2);
        res[i] = max(res[i], tmp);
    }
    for (int i = 0; i < Q; ++i) cout << res[i] << endl;
}


Measured memory_bytes: 21732
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <algorithm>
#include <queue>
#include <cmath>
#include <iomanip>
#include <cstdlib>
// #include <fstream>

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


int main()
{
    std::ios_base::sync_with_stdio(0);
    std::cin.tie(0);
    
    int n;
    long long int act[100010][3];
    long long int dp[100010][3];
    
    std::cin >> n;
    for(int i=0; i<n; i++)
    {
        for(int j=0; j<3; j++)
        {
            std::cin >> act[i][j];
        }
    }
    
    for(int i=0; i<n; i++)
    {
        dp[i+1][0] = std::max(dp[i][1]+act[i][0], dp[i][2]+act[i][0]);
        dp[i+1][1] = std::max(dp[i][0]+act[i][1], dp[i][2]+act[i][1]);
        dp[i+1][2] = std::max(dp[i][0]+act[i][2], dp[i][1]+act[i][2]);
    }

    std::cout << std::max({dp[n][0], dp[n][1], dp[n][2]}) << std::endl;

    return 0;
}

Measured memory_bytes: 4992
#include<stdio.h>
int array[3], max, min, i;

int main()
    {
      scanf("%d %d %d",&array[0],&array[1],&array[2]);
     
      max = array[0];
      min = array[0];
      for (i = 0; i <=2 ; i++){ 
        if ( max < array[i]) max = array[i];
        if ( min > array[i]) min = array[i]; 
        }

      if ( (array [0] + array[1] + array[2]== 17) && (max == 7) && (min == 5))
        printf("YES");
      else
        printf("NO");
    }

Measured memory_bytes: 128
#include "bits/stdc++.h"
#define YES "YES"
#define NO "NO"
#define Yes "Yes"
#define No "No"
#define DEFAULT LL ans=solve();\
 	if(ans==NONE){\
 	}else{\
 		cout << ans << endl;\
 	}
#define YESNO three(solve(),OUT(YES),OUT(NO))
#define YesNo three(solve(),OUT(Yes),OUT(No))
#define ECHO OUT(solve())
#define three(A,B,C) ((A)?(B):(C))
#define FOR(i,a,b)  for(LL i=(a);i< (LL)(b);i++)
#define EFOR(i,a,b) for(LL i=(a);i<=(LL)(b);i++)
#define RFOR(i,a,b) for(LL i=(b-1);i>=(LL)(a);i--)
#define REP(i,b) FOR(i,zero,b)
#define rep REP
#define EREP(i,b) EFOR(i,zero,b)
#define RREP(i,b) RFOR(i,zero,b)
#define ALL(c) c.begin(),c.end()
#define UNIQUE(c) sort(ALL(c));c.erase(unique(ALL(c)),c.end())
#define MAX(c) (*max_element(ALL(c)))
#define MIN(c) (*min_element(ALL(c)))
#define MP make_pair
#define FI first
#define SE second
#define SI(x) (LL(x.size()))
#define PB push_back
#define DEBUG(a) OUT(a)
#define DEBUG2(a,b) OUT2(a,b)
#define cat cout << __LINE__ << endl
#define OUT(a) cout << (a) << endl
#define OUT2(a,b) cout << (a) <<" "<<(b) << endl
#define zero 0LL
#define all ALL
#define pb emplace_back
#define eb pb
#define int long long
using namespace std;
template<typename T> inline void maximize(T &a, T b) { a = max(a, b); }
template<typename T> inline void minimize(T &a, T b) { a = min(a, b); }
template<typename T> inline bool middle(T a, T b, T c) { return b <= a && a <= c; }
template<class T> inline bool MX(T &l, const T &r) { return l < r ? l = r, 1 : 0; }
template<class T> inline bool MN(T &l, const T &r) { return l > r ? l = r, 1 : 0; }
typedef int LL;
typedef double ld;
typedef int ut;
typedef vector<ut> VI;
typedef vector<VI> VII;
typedef pair<ut, ut> pr;
typedef pair<ut, pr> ppr;
typedef vector<pr> Vpr;
typedef vector<ppr> Vppr;
typedef tuple<int, int, int, int> tapu;
typedef vector<tapu> Vtapu;
typedef priority_queue<pr, Vpr > PQ;
inline void outputVI(VI x) { REP(i, SI(x)) { cout << three(i, " ", "") << x[i]; }OUT(""); }
const int SIZE1 = 5e5 + 1000;
const int SIZE2 = 2010;
const int SIZE3 = 430;
const int SIZE = SIZE1;
const int MAPSIZE = 40;
const LL p = 998244353;
const LL INF = 1LL << 60;
const long double EPS = 1e-7;
const LL NONE=-2;
#define endl "\n"
ut N, M,K,  Q, D, H, W;
VI edges[SIZE];
LL vals[SIZE], answer = zero;
LL A[SIZE],B[SIZE],C[SIZE];
LL solve(){
	string s[]={"SUN","MON","TUE","WED","THU","FRI","SAT" };
	string ss;
	cin >> ss;
	REP(i,7){
		if(ss==s[i]){
			return 7-i;
		}
	}
	return NONE;
}
 signed main() {
 
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(10);
	string s;
	LL T;
	DEFAULT;
	
	
//	YesNo;
//	YESNO;
//	three(solve(),OUT("First"),OUT("Second"));
	//cin >> N;
	return 0;
 
}

Measured memory_bytes: 13312
x = int(input())
y = x % 100
z = (y // 5) + ((y % 5) // 4) + ((y % 5 % 4) // 3) + ((y % 5 % 4 % 3) // 2) + (y % 5 % 4 % 3 % 2)
if x // 100 >= z:
    print(1)
else:
    print(0)


Measured memory_bytes: 2940
n = int(input())
h = list(map(int, input().split()))
ans = 0
for i in range(1, 110):
  flag = False
  for j in range(n):
    if (flag and h[j]<i) or (j==n-1 and h[j]>=i):
      ans += 1
      flag = False
    elif h[j]>=i:
      flag = True
print(ans)

Measured memory_bytes: 3060
#include<stdio.h>
#include<iostream>
using namespace std;
int main(void)
{
int n,a[366],b[366],c[366],d[366],i,j,m[366],e[366],z,t;
cin>>n;
for(i=0;i<n;i++){
	z=5;
	t=2;
cin>>a[i]>>b[i]>>c[i]>>d[i];
m[i]=a[i]*c[i]+b[i]*d[i];
	if(c[i]>=5){
		z=c[i];
	}
	if(d[i]>=2){
		t=d[i];
	}
e[i]=(a[i]*z+b[i]*t)*0.8;
}
for(i=0;i<n;i++){
	if(c[i]>=5&&d[i]>=2){
		m[i]=m[i]*0.8;
	}
	if(m[i]>e[i]){
		m[i]=e[i];
	}
}
	for(i=0;i<n;i++){
	cout<<m[i]<<endl;
	}
return 0;
}

Measured memory_bytes: 3088
package main

import "fmt"

func main() {
    var h, n int
    fmt.Scan(&h, &n);
    for i := 0; i < n; i++ {
        var a int;
        fmt.Scan(&a);
        h -= a;
    }
    if h <= 0 {
        fmt.Printf("Yes\n");
    } else {
        fmt.Printf("No\n");
    }
}

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

int main() {
  int cell_num; 	// マスの数、マス目の数は、cell_numの2乗
  int white_cell;	// 白く塗るマス目の数
  int black_cell;	// 黒く塗るマス目の数
  
  // 標準入力から、マスの数と白く塗るマス目の数を取得する
  cin >> cell_num >> white_cell;
  
  if ( 0 <= cell_num && cell_num <= 100) {
    if ( 0 <= white_cell && white_cell <= 10000 ) {
      // 黒く塗るマス目の数を求める
      black_cell = cell_num * cell_num - white_cell;
      cout << black_cell << endl;
    }
  }
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

var sc = bufio.NewReaderSize(os.Stdin, 1024*1024*1)

func main() {
	list := getStdinIntArr()
	N := list[0]
	A := list[1]
	B := list[2]

	if A*N < B {
		fmt.Printf("%d\n", A*N)
	} else {
		fmt.Printf("%d\n", B)
	}
}

func getStdin() string {
	return readLine()
}
func getStdinInt() int {
	str := getStdin()
	rtn, _ := strconv.Atoi(str)
	return rtn
}
func getStdinInt64() int64 {
	str := getStdin()
	rtn, _ := strconv.ParseInt(str, 10, 64)
	return rtn
}
func getStdinIntArr() []int {
	str := getStdin()
	list := strings.Split(str, " ")
	rtn := make([]int, len(list))
	for idx, val := range list {
		rtn[idx], _ = strconv.Atoi(val)
	}
	return rtn
}

func getStdinArr() []string {
	str := getStdin()
	list := strings.Split(str, " ")
	return list
}

func getStdinIntArr64() []int64 {
	str := getStdin()
	list := strings.Split(str, " ")
	rtn := make([]int64, len(list))
	for idx, val := range list {
		rtn[idx], _ = strconv.ParseInt(val, 10, 64)
	}
	return rtn
}

func readLine() string {
	buf := make([]byte, 0, 0)
	for {
		l, p, e := sc.ReadLine()
		if e != nil {
			panic(e)
		}
		buf = append(buf, l...)
		if !p {
			break
		}
	}
	return string(buf)
}


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

int main() {
  ll n;
  cin >> n;
  ll ans;
  for(int i= floor(sqrt(n));i>0;i--){
    if(n%i ==0){
      ans = i + n/i;
      break;
    }
  }
  cout << ans-2 << endl;
  
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#define ll long long int

int main(int argc, char *argv[]){
  ll a, b, x;
  scanf("%lld %lld %lld", &a, &b, &x);
  ll cnt = b/x-a/x;
  if((a%x)==0) cnt++;
  printf("%lld\n", cnt);
  return 0;
}


Measured memory_bytes: 128
import math

def power2(n):
  global ans
  if n == 1:
    tmp =  m % p
  elif n % 2 == 0:
    tmp = power2(n//2) ** 2 % p
  else:
    tmp =  power2(n//2) * power2((n+1)//2) % p
  return ans * tmp % p
    
m, n = map(int, input().split())
p = 10**9+7
ans = 1
print(power2(n))


Measured memory_bytes: 5660
#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
using namespace std;
char s[110],t[11];
int a,b;
char u[11];
int main(){
    while (scanf("%s",s)!=EOF){
        for (int i=0;i<strlen(s);i++)
            printf("x");
        printf("\n");


    }
    return 0;
}



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

using namespace std;

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

vector<vector<ll>> c;

ll comb(int a, int b){
    if(c[a][b] != -1){
        return c[a][b];
    }
    ll ans;
    if(b == 0){
        ans = 1;
    }else if(a == b){
        ans = 1;
    }else{
        ans = comb(a - 1, b - 1) + comb(a - 1, b);
    }
    return c[a][b] = ans;
}

int main(){
    int N, A, B;
    cin >> N >> A >> B;
    c = vector<vector<ll>>(N + 1, vector<ll>(N + 1, -1));
    vector<ll> vs(N, 0);
    rep(i, N){
        cin >> vs[i];
    }
    sort(vs.begin(), vs.end());
    int index = N - (A);
    auto iter1 = lower_bound(vs.begin(), vs.end(), vs[index]);
    auto iter2 = upper_bound(vs.begin(), vs.end(), vs[index]);
    int cnt = iter2 - iter1;
    ll ans = 0;
    double  avg = 0;

    if(iter2 == vs.end()){
        int tmp = min(B, cnt);
        for(int i = A; i <= tmp;  i ++){
            ans += (ll)comb(cnt, i);
        }
    }else{
        int tmp = vs.end() - iter2;
        ans = (ll)comb(cnt, A - tmp);
    }

    for(int i = index; i < N; i ++){
        avg += vs[i];
    }
    avg /= (double)A;
    cout.precision(20);
    cout << fixed << avg << endl;
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    long long n,ans,cnt=0;
  	cin >> n;
    long long a[n];
    for(int i=0;i<n;i++){
      cin >> a[i];
    }
    sort(a,a+n);
    for(int i=a[0];i<=a[n-1];i++){
      long long tmp=0;
      for(int j=0;j<n;j++){
        tmp+=(a[j]-i)*(a[j]-i); 
      }
      if(cnt==0){
        ans=tmp;
      }
      ans=min(ans,tmp);
      cnt++;
    }
    cout << ans << endl;
  	return 0;
}


Measured memory_bytes: 256