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

public class Main {
	static long solve(long A[] , int N){
		long dp[][] = new long[N][2];
		for(int i = 0 ; i < N ; ++i){
			Arrays.fill(dp[i], -100000000);
		}
		dp[0][0] = 0;
		for(int i = 0 ; i < N ; ++i){
			long next[][] = new long[N][2];
			for(int j = 0 ; j < N ; ++j){
				Arrays.fill(next[j], -100000000);
			}
			for(int j = 0 ; j < N ; ++j){
				next[j][0] = Math.max(dp[j][0] , dp[j][1]);					

				if(j > 0 && dp[j - 1][0] != -100000000){
					next[j][1] = dp[j - 1][0] + A[i];
				}
			}
			dp = next;
		}
		return Math.max(dp[N/2][0], dp[N/2][1]);
	}
	static long solve2(long A[] , int N){
		Map<Integer, Long> dp = new HashMap<Integer, Long>();
		dp.put(0, 0L);
		int needChoose = N / 2;
		for(int i = 0 ; i < N ; ++i){
			int canChoose = (N - i + 1) / 2;
			int mustChoosen = Math.max(needChoose - canChoose , 0);
			Map<Integer, Long> next = new HashMap<Integer, Long>();
			for(int j = mustChoosen ; j < N ; ++j){
				if(j > 0 && dp.containsKey(2 * j - 2)){
					next.put(2 * j + 1, dp.get(2 * (j - 1)) + A[i]);
				}
				boolean f = false;
				if(dp.containsKey(2 * j)){
					if(dp.containsKey(2 * j + 1)){
						next.put(2 * j, Math.max(dp.get(2 * j), dp.get(2 * j + 1)));
					}else{
						next.put(2 * j, dp.get(2 * j));
					}
					f = true;
				}else if(dp.containsKey(2 * j + 1)){
					if(dp.containsKey(2 * j)){
						next.put(2 * j, Math.max(dp.get(2 * j), dp.get(2 * j + 1)));
					}else{
						next.put(2 * j, dp.get(2 * j + 1));
					}
					f = true;
				}
				if(!f){
					break;
				}
			}
			dp = next;
		}
		long ret = 0;
		if(dp.containsKey(needChoose * 2)){
			ret = dp.get(needChoose * 2);
			if(dp.containsKey(needChoose * 2 + 1)){
				ret = Math.max(ret, dp.get(needChoose * 2 + 1));
			}
			return ret;
		}
		if(dp.containsKey(needChoose * 2 + 1)){
			ret = dp.get(needChoose * 2 + 1);
			if(dp.containsKey(needChoose * 2)){
				ret = Math.max(ret, dp.get(needChoose * 2));
			}
			return ret;
		}
		return ret;
	}
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		long A[] = new long[N];
		for(int i = 0 ; i < N ; ++i){
			A[i] = sc.nextLong();
		}
		System.out.println(solve2(A, N));
	}
}


Measured memory_bytes: 52592
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++) //for文マクロ
using namespace std;

typedef unsigned long ul;
typedef long long ll;
typedef pair<ul, ul> P; //ペア　タイプでふ

int main()
{
    int a, b;
    cin >> a >> b;
    if (a < b)
    {
        cout << 1;
    }
    else if (a % b == 0)
    {
        cout << 0;
    }
    else
    {
        cout << 1;
    }
}

Measured memory_bytes: 256
N = int(input())

def make753(X):
    add_ary = []
    for i in X:
        add_ary.append(int("3" + str(i)))
        add_ary.append(int("5" + str(i)))
        add_ary.append(int("7" + str(i)))
    return add_ary

L = []
L.append([3, 5, 7])
for i in range(10):
    L.append(make753(L[i]))

def flatten(nested_list):
    """2重のリストをフラットにする関数"""
    return [e for inner_list in nested_list for e in inner_list]

S = flatten(L)

true = []
for k in S:
    check = set(list(str(k)))
    if check == {'3', '5', '7'}:
        true.append(k)

true.sort()

z = 0
count = 0
while true[z] <= N:
    count += 1
    z += 1

print(count)

Measured memory_bytes: 19884
#include <cctype>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <string>
using namespace std;

const int MAX = 100;
int top, s[MAX + 1];

void initialize() { top = 0; }

bool isEmpty() { return top == 0; }

bool isFull() { return top >= MAX; }

void push(int x) {
  if (isFull()) {
    fprintf(stderr, "error: stack is full\n");
    exit(1);
  }
  top++;
  s[top] = x;
}

int pop() {
  if (isEmpty()) {
    fprintf(stderr, "error: stack is empty\n");
    exit(1);
  }
  top--;
  return s[top + 1];
}

int main() {
  initialize();
  string str;
  while (cin >> str) {
    if (isdigit(str[0])) {
      push(atoi(str.c_str()));
    } else {
      int b = pop();
      int a = pop();
      if (str == "+")
        push(a + b);
      else if (str == "-")
        push(a - b);
      else if (str == "*")
        push(a * b);
    }
  }
  printf("%d\n", pop());
  return 0;
}

Measured memory_bytes: 3272
#include <iostream>
#include <sstream>
#include <fstream>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <list>
#include <vector>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <climits>
using namespace std;

void maxHeap(int* keys, int size, int cur){
	if(cur*2 > size){
		// noop
	}else if(cur*2+1 > size && keys[cur*2] > keys[cur]){
		swap(keys[cur*2], keys[cur]);
	}else{
		int l = keys[cur*2];
		int r = keys[1+cur*2];
		if(l > r && l > keys[cur]){
			swap(keys[cur*2], keys[cur]);
			maxHeap(keys, size, cur*2);
		}else if(r > keys[cur]){
			swap(keys[1+cur*2], keys[cur]);
			maxHeap(keys, size, 1+cur*2);
		}
	}
}

int main() {
	int n;
	cin >> n;
	
	int keys[n+1];
	for(int i = 1; i <= n; i++){
		cin >> keys[i];
	}
	
	for(int i = n/2; i > 0; i--){
		maxHeap(keys, n, i);
	}
	
	for(int i = 1; i <= n; i++){
		cout << " " << keys[i];
	}
	cout << endl;
	
	return 0;
}

Measured memory_bytes: 3112
def getN():
    return int(input())


def getNM():
    return map(int, input().split())


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


from collections import defaultdict, deque, Counter
from sys import exit
import math
import copy
from bisect import bisect_left, bisect_right
from heapq import *
import sys

# sys.setrecursionlimit(1000000)
INF = 10 ** 17
MOD = 1000000007

from fractions import *


def inverse(f):
    # return Fraction(f.denominator,f.numerator)
    return 1 / f


def combmod(n, k, mod=MOD):
    ret = 1
    for i in range(n - k + 1, n + 1):
        ret *= i
        ret %= mod

    for i in range(1, k + 1):
        ret *= pow(i, mod - 2, mod)
        ret %= mod

    return ret

MOD = 10 ** 9 + 7

def yaku(n):
    res = []
    for i in range(2, int(math.sqrt(n)) + 2):
        tmp = 0
        while(True):
            if n % i == 0:
                tmp += 1
                n //= i
            else:
                break
        if tmp != 0:
            res.append((tmp, i))
    if n != 1:
        res.append((1, n))
    return res

def solve():
    n = getN()
    acc = [0]
    tmp = 0
    for i in range(1, 10**6):
        tmp += i
        acc.append(tmp)

    res = yaku(n)
    ans = 0
    for y in res:
        ans += bisect_right(acc, y[0]) - 1
    # print(res)
    print(ans)

def main():
    n = getN()
    for _ in range(n):
        solve()


if __name__ == "__main__":
    solve()

Measured memory_bytes: 148820
X,Y=map(int,input().split())
if X==1 :
    x=300000
elif X==2 :
    x=200000
elif X==3 :
    x=100000
else :
    x=0
if Y==1 :
    y=300000
elif Y==2 :
    y=200000
elif Y==3 :
    y=100000
else :
    y=0
if X==1 and Y==1 :
    print(x+y+400000)
else :
    print(x+y)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long  ll;
#define FOR(i,a,n) for(ll i=(ll)a;i<(ll)n;i++)
#define RFOR(i,a,n) for(ll i=(ll)n-1;i >= (ll)a;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,0,n)
#define ALL(v) v.begin(), v.end()
#define bra(first,second) '(' << first << ',' << second << ')'
constexpr ll MOD = 1000000007;
//constexpr ll MOD = 998244353;
ll INF = 4001001001001001001;
long double EPS = 1e-9;
long double PI = 3.141592653589793238;
template<typename T>
void remove(std::vector<T>& vector, unsigned int index){
    vector.erase(vector.begin() + index);
}

using Graph = vector<vector<tuple<ll,ll,ll>>>;

// MOD確認

bool A[110];

int main(){
    ll N,K;
    cin >> N >> K;
    rep(i,K){
        ll d;cin >> d;
        rep(j,d){
            ll a;cin >> a;
            a--;
            A[a] = 1;
        }
    }
    ll ans = 0;
    rep(i,N) if(!A[i]) ans++;
    cout << ans << endl;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define N 100

int main(){
	int n,ans=0;
	int a[N];

	cin >> n;
	for(int i=0;i<n;i++){
		int k;
		cin >> k;
		a[i]=k;
	}	
	int flag = 1;
	while(flag){
		flag = 0;
		for(int j=n-1;j>0;j--){
			if(a[j] < a[j-1]){
				int w = a[j];
				a[j] = a[j-1];
				a[j-1] = w;
				ans++;
				flag = 1;
			}
		}
	}
	for(int i=0;i<n;i++){
		cout << a[i];
		if(i != n-1){
			cout << " ";
		}
	}
	cout << endl << ans << endl;
	return 0;
}

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

#define pii pair<ll,ll>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define pf push_front
#define pb2 pop_back
#define pf2 pop_front
#define line printf("\n")
#define pq priority_queue
#define rep(k,i,j) for(int k = (int)i;k<(int)j;k++)
#define repd(k,i,j) for(int k = (int)i;k>=(int)j;k--)
#define ll long long

using namespace std;

double EPS = 1e-9;
int INF = 1e9+7;;
long long INFLL = 1e17;
double pi = acos(-1);
int dirx[8] = {-1,0,0,1,-1,-1,1,1};
int diry[8] = {0,1,-1,0,-1,1,-1,1};

inline void OPEN (string s) {
  freopen ((s + ".in").c_str (), "r", stdin);
  freopen ((s + ".out").c_str (), "w", stdout);
}

//end of template

int n,m;

pii f(ll a,ll b){
	pii ret = mp(a/2*b,(a-a/2)*b);
	if(ret.fi>ret.se)swap(ret.fi,ret.se);
	return ret;
}
ll dp(ll a,ll b){
	ll ret = INFLL;
	rep(k,1,a){
		ll ki = k*b;
		
		ll L = a-k;
		ll R = b;
		pii x = f(L,R);
		pii y = f(R,L);
		if(x.se-x.fi >y.se-y.fi)x = y;
		
		ll mn = x.fi;
		ll mx = x.se;
		
		//printf("%lld %lld %lld\n",ki,mn,mx);
		mn = min(mn,min(ki,mx));
		mx = max(mx,max(ki,mn));
		ret = min(ret,mx-mn);
	}
	return ret;
}
int main(){
	scanf("%d%d",&n,&m);
	
	printf("%lld\n",min(dp(n,m),dp(m,n)));
	
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> VI;
typedef vector<VI> VVI;
typedef pair<ll, ll> P;
#define INF (1LL << 31)
#define FOR(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define rep(i,n)  FOR(i,0,n)
#define PRINT(V) for (auto v : (V)) cout << v << " "

int main()
{
    ll a, b, v, w, t; cin >> a >> v >> b >> w >> t;

    bool f = false;

    if (a == b) {
        f = true;
    }else if (v <= w){
        f = false;
    }else if (abs(a - b) <= (v - w)*t){
        f = true;
    }
    cout << (f?"YES":"NO") << endl;
    return 0;
}


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

int main(){
    int a,b,c,d,e,k;
    cin >> a >> b >> c >> d >> e >>k;

    if (e-a > k) cout << ":(" << endl;
    else cout << "Yay!" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int llint;
typedef long int lint;
typedef vector<char> vchar;
typedef vector<int> vint;
typedef vector<vector<int>> vvint;
typedef vector<vector<char>> vvchar;
#define vsort(v) sort((v).begin(), (v).end())
#define vreverse(v) reverse((v).begin(), (v).end())
#define pb(a) push_back(a)
#define INF 1000000007
int main(){
  string s;cin>>s;lint size=s.size();lint i;
  vchar ps(size);for(i=0;i<size;i++){ps[i]=s.at(i);}
  lint oddo=0;lint oddl=0;lint evo=0;lint evl=0; 
  for(i=0;i<size;i+=2){if(ps[i] =='0'){evo++;}else{evl++;}}
  for(i=1;i<size;i+=2){if(ps[i] =='0'){oddo++;}else{oddl++;}}
  lint a,b;//a:evo-oddl b:evl-oddo
  a=evo+oddl;b=evl+oddo;
  cout<<min(a,b)<<endl;
  
}

Measured memory_bytes: 512
#include<stdio.h>
int main()
{
    int a,m=0,b,c;
        scanf("%d%d%d",&a,&b,&c);
        if(a>m)m=a;
        if(b>m)m=b;
        if(c>m)m=c;
    printf("%d\n",a+b+c-m);
}


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

#define ASC(vec) vec.begin(), vec.end()		// 昇順ソート 例：sort(ASC(vec));
#define DESC(vec) vec.rbegin(), vec.rend()	// 降順ソート 例:sort(DESC(vec));
#define rep(i, n) for(int i = 0; i < (n); i++)
#define Rep(i, n) for(int i = 1; i < n; i++)

const int mod = 1000000007;
const int inf = (1 << 21);
const long long INF = 1LL << 60;

using ii = pair<int, int>;
using ll = long long;
using vi = vector<int>;
using vd = vector<double>;
using vb = vector<bool>;
using vl = vector<ll>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
using vvb = vector<vector<bool>>;
using vii = vector<pair<int, int>>;

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

ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
ll LCM(ll a, ll b) { return (a * b) / GCD(a, b); }
int round_int(int a, int b) { return (a + (b - 1)) / b; }

constexpr array<int, 9> dx = { 0, 1, 0, -1, -1, 1, 1, -1, 0 };
constexpr array<int, 9> dy = { 1, 0, -1, 0, 1, 1, -1, -1, 0 };

// ──────────────────────────────────────────────────────────────────

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

	for (int i = 3; i <= n; ++i) {
		if (i % 3 == 0) cout << " " << i;
		else {
			int x = i;
			while (x) {
				if (x % 10 == 3) {
					cout << " " << i;
					break;
				}
				else x /= 10;
			}
		}
	}
	cout << endl;
}


Measured memory_bytes: 3108
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.*;
public class Main { //atcoder ABC128C -

	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer(br.readLine());
		int n = Integer.parseInt(st.nextToken());
		int m = Integer.parseInt(st.nextToken());
		boolean[] arr = new boolean[n+1];
		long[] count = new long[n+1];
		for(int i = 0; i < m; i++){
			int a = Integer.parseInt(br.readLine());
			arr[a] = true;
		}
		count[0] = 1;
		count[1] = arr[1] ? 0 : 1;
		for(int i = 2; i <= n; i++){
			if(!arr[i]) {
				count[i] = (count[i-1] + count[i-2]) % 1000000007;
			}
		}
		System.out.println(count[n]);
	}
}


Measured memory_bytes: 28984
h, w, k = map(int, input().split())
c = [list(input()) for i in range(h)]

ans = 0
for i in range(2 ** h):
    for j in range(2 ** w):
        black = 0
        for x in range(h):
            for y in range(w):
                if (i >> x) & 1:
                    continue
                    
                if (j >> y) & 1:
                    continue
                    
                if c[x][y] == '#':
                    black += 1
        if black == k:
            ans += 1
print(ans)


Measured memory_bytes: 9196
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
#include <functional>
#include <utility>
using namespace std;


int main(){
  int n;
  cin >> n;
  vector<int> v(n, 0);
  for(int i = 0; i < n; i++){
    cin >> v[i];
    int cnt = 0;
    while(v[i] > 0){
      if(v[i] % 2 == 0){
        v[i] /= 2;
        cnt++;
      }
      else{
        break;
      }
    }
    v[i] = cnt;
  }
  sort(v.begin(), v.end());
  cout << v[0] << endl;
}

Measured memory_bytes: 256
import java.util.*;
class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[n];
        int index = 0;
        int index2 = 0;
        for(int i = 0; i<n; i++) {
            a[i] = sc.nextInt();
            if(a[i] == 1) index = i;
            if(a[i] == 2) index2 = i;
        }

        int cnt = 0;
        int now = 1;
        for(int i = index; i<n; i++) {
            if(a[i]==now) cnt++;
            now++;
        }
        if(cnt >= n-2) {
            System.out.println("YES");
            return;
        }
        cnt = 0;
        now = 2;
        for(int i = index2; i<n; i++) {
            if (a[i] == now) cnt++;
            now++;
        }
        if(cnt >= n-2) {
            System.out.println("YES");
            return;
        }
        System.out.println("NO");

    }
}

Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef long double D;
//typedef complex<D> P;
#define F first
#define S second
const ll MOD=1000000007;
//const ll MOD=998244353;

template<typename T,typename U>istream & operator >> (istream &i,pair<T,U> &A){i>>A.F>>A.S; return i;}
template<typename T>istream & operator >> (istream &i,vector<T> &A){for(auto &I:A){i>>I;} return i;}
template<typename T,typename U>ostream & operator << (ostream &o,const pair<T,U> &A){o<<A.F<<" "<<A.S; return o;}
template<typename T>ostream & operator << (ostream &o,const vector<T> &A){ll i=A.size(); for(auto &I:A){o<<I<<(--i?" ":"");} return o;}

vector<vector<int>> dp1(301,vector<int>(301,0));
vector<vector<int>> dp2(301,vector<int>(301,MOD));

//maegasoko
ll solve(string a,string b,ll H){
  for(int i=H-1;i>=0;i--){
    for(int j=H-1;j>=0;j--){
      dp1[i][j]=dp1[i+1][j+1]+(a[i]==b[j]?1:0);
    }
  }
  for(auto &I:dp2){
    for(auto &J:I){J=MOD;}
  }
  dp2[0][0]=0;
  for(int i=0;i<=2*H;i++){
    for(int j=0;j<=H;j++){
      int x=j,y=i-j;
      if(x<0 || y<0 || x>H || y>H){continue;}
      if(x<H){
	dp2[x+1][y]=min(dp2[x+1][y],dp2[x][y]+dp1[x][y]);
      }
      if(y<H){
	dp2[x][y+1]=min(dp2[x][y+1],dp2[x][y]+dp1[x][y]);
      }
    }
  }
  return dp2[H][H];
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll H,W;
  cin>>H>>W;
  vector<string> A(H);
  cin>>A;
  ll ans=0;
  for(int i=0;i+1<W;i++){
    string a,b;
    for(int j=0;j<H;j++){
      a+=A[H-j-1][i];
      b+=A[H-j-1][i+1];
    }
    ans+=solve(a,b,H);
  }
  cout<<ans<<endl;
  
  return 0;
}


Measured memory_bytes: 1152
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
#define inf (int)(1e9+7)
#define abs(x) (x >= 0 ? x : -(x))
#define ceil(a, b) a / b + !!(a % b)
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }





int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    
    // 時間でナップサック
    
    int n, t;
    cin >> n >> t;
    
    ll table[6100]; // 次注文していい時刻
    rep(i, 6100) table[i] = -1;
    table[0] = 0;
    vector<pii> v(n);
    rep(i, n) cin >> v[i].F >> v[i].S;
    sort(all(v));
    
    rep(i, n) {
        ll a, b;
        a = v[i].F; b = v[i].S;
        for (int j = t - 1; j >= 0; --j) {
            if (table[j] == -1) continue;
            chmax(table[j + a], table[j] + b);
        }
    }
    ll ans = 0;
    rep(i, 6100) chmax(ans, table[i]);
    cout << ans << endl;
    
}



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

int main() {
  string s;
  cin >> s;
  
  string ans;
  ans = "No";
  
  if(s.at(0) == s.at(1)){
    if(s.at(2) == s.at(3) && s.at(1) != s.at(2)){
      ans = "Yes";
    }
  }
  
  if(s.at(0) == s.at(2)){
    if(s.at(1) == s.at(3) && s.at(1) != s.at(2)){
          ans = "Yes";
    }
  }
  
    if(s.at(0) == s.at(3)){
    if(s.at(1) == s.at(2) && s.at(0) != s.at(1)){
          ans = "Yes";
    }
  }
  
  cout << ans << endl;
  
}
      

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long h = sc.nextLong();
		long sum = 0;
		long i = 1;

		if(h == 1) {
			System.out.println(1);
			System.exit(0);
		}

		do {
			h /= 2;
			sum += i;
			i *= 2;
		}while(h > 1);

		sum += i;

		System.out.println(sum);
		sc.close();
	}
}


Measured memory_bytes: 22996
#include <iostream>
#include <algorithm>
#include <cmath>

const int maxn = 1234;

int main(int argc, char *argv[]) {  
	int n;
	double t, a, h[maxn];
	std::cin >> n >> t >> a;
	int ans = 0;
	double x = 10000000;
	for (int i = 1; i <= n; i++) {
		std::cin >> h[i];
		if (std::abs(t-h[i]*0.006 - a) < x) {
			ans = i;
			x = std::abs(t-h[i]*0.006 - a);
		}
	}
	std::cout << ans;
}

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

bool has3(int x){
    while(x){
        if(x%10==3) return true;
        x /= 10;
    }
    return false;
}

void call(int n){
    for(int x = 1; x<=n;x++){
        if(x%3==0||has3(x)){
            cout << " " << x;
        }
    }
    cout << endl;
}




int main(){
    int n;
    cin >> n;
   call(n);

   return 0;
    
}


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

int main() {
    int n, k;
    string s;
    cin >> n >> k >> s;

    int ans = 0;
    char prev = s[0];
    for(int i = 1; i < n; i++) {
        if (s[i] == prev) {
            ans++;
        }
        prev = s[i];
    }
    ans += min(n - 1 - ans, 2*k);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 512
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=int(a);i<int(b);i++)
#define INF 1200000000


int main(){
    
    int c[4][4];
    rep(i,0,3){
        rep(j,0,3){
            cin>>c[i][j];
        }
    }
    if(c[0][0]+c[1][1]+c[2][2] == c[0][1]+c[1][2]+c[2][0] && c[1][0]+c[2][1]+c[0][2]== c[0][1]+c[1][2]+c[2][0]){
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }
}




Measured memory_bytes: 256
N = int(input())
items = []
for i in range(N):
    x, u = input().split()
    items.append((float(x),u))
bp = 380000.0

ans = 0

for x, u in items:
    if u == "JPY":
        ans += x
    else:
        ans += bp * x
print(ans)


Measured memory_bytes: 2940
#include<iostream>
#include<cstdio>
#include<vector>
using namespace std;

typedef long long ll;
const int maxn = 10 + 5;
int N, M;
int K;
int P[maxn];
vector<vector<int> > S(maxn);

int solve()
{
	ll res = 0;
	int total = 1 << N; //全ビットパターン
	for(int bit = 0; bit < total; bit++) 
	{
		bool ok = true;
		for(int i = 0; i < M; i++) 
		{
			int cnt = 0;
			for(auto v : S[i]) //使われているスイッチをカウントする
				if(bit & (1<<v)) cnt++;
			if(cnt % 2 != P[i]) ok = false;
		}
		if(ok) res++;
	}
	return res;
}

int main()
{
	cin >> N >> M;
	for(int i = 0; i < M; i++)
	{
		cin >> K;
		for(int j = 0; j < K; j++) 
		{
			int s; cin >> s; s--;
			S[i].push_back(s);
		}
	}
	for(int i = 0; i < M; i++) cin >> P[i];

	printf("%d\n", solve());
}

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

#ifdef NON_SUBMIT
#define TEST(n) (n)
#define tout cerr
#else
#define TEST(n) ((void)0)
#define tout cin
#endif

using namespace std;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
	TEST(freopen("input.txt","r",stdin));
	TEST(freopen("output.txt","w",stdout));
	TEST(freopen("debug.txt","w",stderr));
	int N;
	cin>>N;
	cout<<180*(N-2)<<'\n';
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <set>
#include <vector>

using namespace std;

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

    set<int> values;
    for (int i = 0; i < n; ++i) {
        int tmp;
        cin >> tmp;
        values.insert(tmp);
    }

    cout << values.size() << '\n';
}


Measured memory_bytes: 256
N = int(input())
inp = []
for k in range(N-1):
  a, b = map(int, input().split())
  if a > b:
    a, b = b-1, a-1
  else:
    a, b = a-1, b-1
  inp.append((a, b, k))
inp.sort(key = lambda x: x[0])
mark = [[] for _ in range(N)]
def binary_search(list, item):
    low = 0
    high = len(list) - 1

    while low <= high:
        mid = (low + high) //2
        guess = list[mid]
        if guess == item:
            #return mid
            return True
        if guess > item:
            high = mid -1
        else:
            low = mid + 1

    #return None
    return False

from bisect import insort


ans = [0 for _ in range(N-1)]
now = 0
cnt = 0
for item in inp:
  cnt += 1
  if now < item[0]:
    now = item[0]
    cnt = 1
  while binary_search(mark[item[0]], cnt) or binary_search(mark[item[1]], cnt):
    cnt += 1
  insort(mark[item[1]], cnt)
  ans[item[2]] = cnt
color = max(ans)
print(color)
for k in range(N-1):
  print(ans[k])


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

int main() {
int64_t n;
cin>>n;
  int count=0;
vector<int64_t> a(n);
  vector<int64_t> A(n);
for(int i=0;i<n;i++){
cin>>a.at(i);
  A.at(i)=abs(a.at(i));
  if(a.at(i)<0){
    count++;
  }
}
  sort(A.begin(),A.end());
  int64_t sum=0;
  for(int i=0;i<n;i++){
    sum+=A.at(i);
  }
  if(count%2==0){
    cout<<sum;
  }
  else{
    cout<<sum-2*A.at(0);
  }
}

Measured memory_bytes: 1792
# -*- coding: utf-8 -*-
import sys
import math
from bisect import bisect_left
from bisect import bisect_right
import collections
import copy
import heapq
from collections import defaultdict
from heapq import heappop, heappush
import itertools
input = sys.stdin.readline

##### リストの 二分木検索 #####
# bisect_left(lists, 3)
# bisect_right(lists, 3)

##### プライオリティキュー #####
# heapq.heapify(a) #リストaのheap化
# heapq.heappush(a,x) #heap化されたリストaに要素xを追加
# heapq.heappop(a) #heap化されたリストaから最小値を削除＆その最小値を出力

# heapq.heappush(a, -x) #最大値を取り出す時は、pushする時にマイナスにして入れよう
# heapq.heappop(a) * (-1) #取り出す時は、-1を掛けて取り出すこと

##### タプルリストのソート #####
# sorted(ans) #(a, b) -> 1st : aの昇順, 2nd : bの昇順
# sorted(SP, key=lambda x:(x[0],-x[1])) #(a, b) -> 1st : aの昇順, 2nd : bの降順
# sorted(SP, key=lambda x:(-x[0],x[1])) #(a, b) -> 1st : aの降順, 2nd : bの昇順
# sorted(SP, key=lambda x:(-x[0],-x[1])) #(a, b) -> 1st : aの降順, 2nd : bの降順

# sorted(SP, key=lambda x:(x[1])) #(a, b) -> 1st : bの昇順
# sorted(SP, key=lambda x:(-x[1])) #(a, b) -> 1st : bの降順

def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))

def main():
	N = inputInt()
	A = inputList()

	A.sort()
	ans = 0
	for i,val in enumerate(A):
		if i == 0:
			ans = val
			continue

		ans = (ans + val) / 2

	print(ans)


if __name__ == "__main__":
	main()


Measured memory_bytes: 38256
a1 = gets.chomp.split.map(&:to_i)
a2 = gets.chomp.split.map(&:to_i)
a3 = gets.chomp.split.map(&:to_i)
as = [a1, a2, a3]
n = gets.to_i
n.times do
  b = gets.to_i
  3.times do |i|
    3.times do |j|
      as[i][j] = 'x' if as[i][j] == b
    end
  end
end

if (as[0][0] == 'x' && as[0][1] == 'x' && as[0][2] == 'x') ||
   (as[1][0] == 'x' && as[1][1] == 'x' && as[1][2] == 'x') ||
   (as[2][0] == 'x' && as[2][1] == 'x' && as[2][2] == 'x') ||
   (as[0][0] == 'x' && as[1][0] == 'x' && as[2][0] == 'x') ||
   (as[0][1] == 'x' && as[1][1] == 'x' && as[2][1] == 'x') ||
   (as[0][2] == 'x' && as[1][2] == 'x' && as[2][2] == 'x') ||
   (as[0][0] == 'x' && as[1][1] == 'x' && as[2][2] == 'x') ||
   (as[2][0] == 'x' && as[1][1] == 'x' && as[0][2] == 'x')
  puts 'Yes'
else
  puts 'No'
end

Measured memory_bytes: 1788
#include<iostream>
#include<string>
#include<math.h>
#include<algorithm>
using namespace std;

int main(){

	int n;
	int a[100000];
	int count = 0;

	cin >> n;

	for (int i = 1; i <= n; i++) cin >> a[i];

	for (int j = 1; j <= n; j++) { if (a[a[j]] == j) count++; }

	count = count / 2;

	cout << count << endl;
}

Measured memory_bytes: 640
#include<iostream>
#include<stdio.h>
using namespace std;

int main(void) {
	string S;
	cin >> S;
	int ans = 0;
	for (int i = 0; i < S.length(); i++) {
		int cnt = 0;
		for (int j = i; j < S.length(); j++) {
			if (S[j] == 'A' || S[j] == 'C' || S[j] == 'G' || S[j] == 'T') {
				cnt++;
			} else {
				break;
			}
		}
		// cout << i << "  " << cnt << "\n";
		ans = max(ans, cnt);
	}
	printf("%d\n", ans);

	return 0;
}


Measured memory_bytes: 3524
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<stdbool.h>

#define SIZE (2000)
#define STACK_SIZE (100)

struct {
    const size_t size;
    unsigned int top;
    int *buf;
} typedef Stack;

bool isEmpty(Stack *stack);
bool isFull(Stack *stack);
void push(Stack *stack, int n);
int pop(Stack *stack);

bool isEmpty(Stack *stack){
    return stack->top == 0;
}

bool isFull(Stack *stack){
    return stack->top >= stack->size;
}

void push(Stack *stack, int n){
    if(isFull(stack)){
        exit(1);
    }
    stack->buf[stack->top] = n;
    stack->top++;
}

int pop(Stack *stack){
    if(isEmpty(stack)){
        exit(1);
    }
    stack->top--;
    return stack->buf[stack->top];
}


int main(void){
    int a, b;
    char s[SIZE];
    char *tok;
    int stack_buf[100];
    Stack stack = {100, 0, stack_buf};

    fgets(s, SIZE, stdin);

    tok = strtok(s, " ");
    push(&stack, atoi(tok));

    while((tok = strtok(NULL, " ")) != NULL){
        if(tok[0] == '+'){
            a = pop(&stack);
            b = pop(&stack);
            push(&stack, a+b);
        }else if(tok[0] == '-'){
            a = pop(&stack);
            b = pop(&stack);
            push(&stack, b-a);
        }else if(tok[0] == '*'){
            a = pop(&stack);
            b = pop(&stack);
            push(&stack, a*b);
        }else{
            push(&stack, atoi(tok));
        }
    }

    printf("%d\n", pop(&stack));

    return 0;
}


Measured memory_bytes: 2040
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <memory.h>
#include <math.h>
#include <assert.h>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <string>
#include <algorithm>
#include <iostream>
#include <functional>
#include <unordered_set>
#include <bitset>
#include <time.h>
#include <limits.h>

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define Fi first
#define Se second
#define pb(x) push_back(x)
#define szz(x) (int)x.size()
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) x.begin(),x.end()
typedef tuple<int, int, int> t3;

int N;
vector <int> E[200010];
int par[200020], uv[200020], dep[200020];
int ST[200020], EN[200020], cs;
int Tr[1<<20]; const int ADD = 1<<19;

void pdfs(int x, int fa) {
	ST[x] = ++cs;
	for(int e : E[x]) if(e != fa) {
		par[e] = x;
		uv[e] = max(uv[x], x);
		dep[e] = dep[x] + 1;
		pdfs(e, x);
	}
	EN[x] = cs;
}
void update_t(int x, int val) {
	x = ST[x];
	x += ADD; Tr[x] += val; x >>= 1;
	while(x) {
		Tr[x] = Tr[x<<1] + Tr[x<<1|1];
		x >>= 1;
	}
}
int read_t(int x) {
	int l = ST[x] + ADD, r = EN[x] + ADD;
	int res = 0;
	while(l <= r) {
		if(l & 1) res += Tr[l++];
		if(!(r & 1)) res += Tr[r--];
		l >>= 1, r >>= 1;
	}
	return res;
}

int V[200020], W[200020];
vector <int> uvt[200020];
int p[200020], pz[200020]; int Find(int x) { return p[x] == x ? x : p[x] = Find(p[x]); }
int color[200020];
int ans[200020];

void DFS(int x, int fa) {
	for(int e : E[x]) if(e != fa) {
		ans[e] = ans[x] + W[e] - V[e];
		DFS(e, x);
	}
}

int main() {
	scanf("%d", &N);
	for(int i=1;i<N;i++) {
		int x, y; scanf("%d%d", &x, &y);
		E[x].pb(y);
		E[y].pb(x);
	}
	pdfs(1, -1);
	for(int i=2;i<=N;i++) uvt[uv[i]].pb(i);
	for(int i=1;i<=N;i++) p[i] = i, pz[i] = 1;
	for(int i=1;i<=N;i++) {
		for(int e : uvt[i]) {
			for(int f : E[e]) if(f != par[e]) V[f] = read_t(f);
		}
		color[i] = 1;
		for(int e : E[i]) if(e != par[i]) {
			if(color[e] == 1) {
				p[e] = i;
				pz[i] += pz[e];
			}
		}
		int val = pz[i];
		int u = i;
		if(i > 1 && color[par[i]]) {
			int pp = Find(par[i]);
			p[i] = pp;
			pz[pp] += pz[i];
			u = pp;
		}
		update_t(i, val);
		if(u != 1) update_t(par[u], -val);
	}
	for(int i=1;i<=N;i++) for(int e : E[i]) if(e != par[i]) W[i] += V[e];
	DFS(1, -1);
	for(int i=2;i<=N;i++) printf("%d ", ans[i] + dep[i]); puts("");
	return 0;
}


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

using namespace std;

typedef vector<vector<int> > Matrix; //隣接行列

const int INF = 1000000000;

Matrix dist;

void warshall_floyd(int n) { //nは頂点数
    for (int k = 0; k < n; k++) { //経由点
        for (int i = 0; i < n; i++) { //始点
            for (int j = 0; j < n; j++) { //終点
                if (dist[i][k] != INF && dist[k][j] != INF) {
                    dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
                }
            }
        }
    }
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n, m;
	cin >> n >> m;
	vector<int> a(m), b(m), c(m);
	dist.resize(n, vector<int>(n, INF));
	for (int i = 0; i < m; i++) {
		cin >> a[i] >> b[i] >> c[i];
		a[i]--;
		b[i]--;
		dist[a[i]][b[i]] = c[i];
		dist[b[i]][a[i]] = c[i];
	}
	for (int i = 0; i < n; i++) dist[i][i] = 0;
	warshall_floyd(n);
	int ans = 0;
	for (int i = 0; i < m; i++) {
		ans += (dist[a[i]][b[i]] != c[i]);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 384
<?php
fscanf(STDIN, "%d", $N);
$A = array_map('intval', explode(" ", trim(fgets(STDIN))));
$B = array_map('intval', explode(" ", trim(fgets(STDIN))));
$C = array_map('intval', explode(" ", trim(fgets(STDIN))));
$ans = 0;
$prev = -PHP_INT_MAX;
foreach ($A as $num) {
    $sum[$num - 1] = 1;
    $ans += $B[$num - 1];
    if ($prev + 1 === $num) {
        $ans += $C[$num - 2];
    }
    $prev = $num;
}
echo $ans;


Measured memory_bytes: 4856
#include<bits/stdc++.h>
const int N=100005,M=1000000007;
using namespace std;
int n,m,li,x,a[N],f[N],fac[N],inv[N],ans;
int main(){
	scanf("%d%d",&n,&m);li=1<<n;
	for(int i=0;i<m;i++)
	scanf("%d",a+i);
	f[0]=fac[0]=inv[li]=1;
	for(int i=1;i<=li;i++)
	fac[i]=fac[i-1]*1ll*i%M;
	x=fac[li];
	for(int t=M-2;t;t>>=1)
	t&1?inv[li]=1ll*inv[li]*x%M:0,x=1ll*x*x%M;
	for(int i=li;i;i--)
	inv[i-1]=1ll*inv[i]*i%M;
	for(int i=m-1;~i;i--){
		for(int s=li-a[i]+1;s;s--){
			for(int j=1;j<1<<n;j<<=1)
			if(s&j)f[s]=(f[s]-f[s^j]*1ll*j%M
			*fac[li-a[i]-(s^j)]%M*inv[li-a[i]-s+1])%M;
		}
	}
	for(int s=0;s<li;s++)
	ans=(ans+f[s]*1ll*fac[li-s-1])%M;
	printf("%d",(1ll*ans*li%M+M)%M);
}

Measured memory_bytes: 1024
def i1():
 return int(input())
def i2():
 return [int(i) for i in input().split()]
n=i1()
s=i2()
m=10**9+1
s.sort(reverse=True)
x=[s[0]]
s[0]=m
a="Yes"
for i in range(n):
 y=[]
 k=0
 for j in range(len(s)):
   if k>=len(x):
      break
   if s[j]<x[k]:
     y.append(s[j])
     s[j]=m
     k+=1
 x+=y
 x.sort(reverse=True)
if k==(1<<(n-1)):
   print("Yes")
else:
   print("No")

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

#define int long long
#define pb push_back
#define in insert
#define F first
#define S second
#define mod 1000000007
#define endl '\n'
#define w(x) int x;cin>>x; while(x-->0)
#define memset(a,b) memset(a,b,sizeof(a))
#define debug(x) cout << "[ " << #x  << " : " << x << " ]" << endl;

void fast()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

}
map<int, int>m;
void mysol()
{
	m.clear();
	int k, n; cin >> k >> n;
	int arr[n];
	for (int &a : arr)
		cin >> a, m[a]++;
	int diff = INT_MAX;
	int ans = 0;
	for (int i = -101; i <= 101; i++)
		if (!m[i])
			if (abs(k - i) < diff)
			{
				diff = abs(k - i);
				ans = i;
			}
	cout << ans;



}

int32_t main()
{
	fast();
	// w(t)
	{
		mysol();
	}
	//cerr << sizeof(dp)*(1e-6) << " megabytes\n";
	return 0;
}


Measured memory_bytes: 3680
//minamoto
#include<bits/stdc++.h>
#define R register
#define fp(i,a,b) for(R int i=(a),I=(b)+1;i<I;++i)
#define fd(i,a,b) for(R int i=(a),I=(b)-1;i>I;--i)
#define go(u) for(int i=head[u],v=e[i].v;i;i=e[i].nx,v=e[i].v)
template<class T>inline bool cmax(T&a,const T&b){return a<b?a=b,1:0;}
template<class T>inline bool cmin(T&a,const T&b){return a>b?a=b,1:0;}
using namespace std;
const int P=1e9+7;
inline void upd(R int &x,R int y){(x+=y)>=P?x-=P:0;}
inline int inc(R int x,R int y){return x+y>=P?x+y-P:x+y;}
inline int dec(R int x,R int y){return x-y<0?x-y+P:x-y;}
inline int mul(R int x,R int y){return 1ll*x*y-1ll*x*y/P*P;}
int ksm(R int x,R int y){
	R int res=1;
	for(;y;y>>=1,x=mul(x,x))(y&1)?res=mul(res,x):0;
	return res;
}
const int N=1e5+5;
char s[N];int a[N],f[N],las[N],n,fl;
int main(){
//	freopen("testdata.in","r",stdin);
	scanf("%s",s+1),n=strlen(s+1);
	fp(i,1,n)if(a[i]=(a[i-1]+s[i]-'a'+1)%3,s[i]==s[i-1])fl=1;
	if(!fl)return puts("1"),0;
	fp(i,1,n)f[i]=(0ll+f[las[0]]+f[las[1]]+f[las[2]]+(a[i]>=1)-f[las[a[i]]])%P,las[a[i]]=i;
	printf("%d\n",f[n]);
	return 0;
}

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

const int N = 2e5 + 10;
int n, a[N], t[2][N << 2];

inline int read() {
    int s = 0, f = 1;
    char ch;
    for(; ch < '0' || ch > '9'; ch = getchar()) if(ch == '-')   f = -1;
    for(; ch >= '0' && ch <= '9'; ch = getchar())   s = (s << 1) + (s << 3) + ch - '0';
    return s * f;
}

inline void add(int o, int pos, int l, int r, int cnt) {
    if (a[cnt] < a[t[o][pos]])  t[o][pos] = cnt;
    if (l == r) return;
    int mid = (l + r) >> 1;
    if (cnt <= mid) add(o, pos << 1, l, mid, cnt);
    else    add(o, pos << 1 | 1, mid + 1, r, cnt);
}

inline int ask(int o, int pos, int l, int r, int L, int R) {
    if (l > R || r < L) return 0;
    if (L <= l && r <= R)   return t[o][pos];
    int mid = (l + r) >> 1;
    int lans = ask(o, pos << 1, l, mid, L, R);
    int rans = ask(o, pos << 1 | 1, mid + 1, r, L, R);
    return a[lans] < a[rans] ? lans : rans;
}

struct node {
    int l, r, v;
    node() {}
    node(int _l, int _r){ l = _l, r = _r, v = l > r ? 0 : ask(l & 1, 1, 1, n, l, r); }
    friend bool operator < (node A,node B) { return a[A.v] < a[B.v]; }
};

set <node> s;

int main() {
    n = read();
    a[0] = n + 1;
    for(int i = 1; i <= n; ++i) {
        a[i] = read();
        add(i & 1, 1, 1, n, i);
    }
    s.clear();
    s.insert(node(1, n));
    for(int i = 1; i <= n >> 1; ++i) {
        node now = *s.begin();
        s.erase(s.begin());
        int l = now.l, r = now.r;
        int lmid = now.v, rmid = ask((lmid & 1) ^ 1, 1, 1, n, lmid, r);
        printf("%d %d ", a[lmid], a[rmid]);
        s.insert(node(l, lmid - 1));
        s.insert(node(lmid + 1, rmid - 1));
        s.insert(node(rmid + 1, r));
    }
    puts("");
    return 0;
}

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

namespace A_1116_B
{
    class Program
    {
        class A_2019_1123_A
        {
            public void run()
            {
                //入力部
                string[] jyuni = Console.ReadLine().Split(' ');
                //string str = Console.ReadLine();

                //処理
                int prize = 0;

                if (jyuni[0] == "3")
                {
                    prize += 100000;
                }
                if (jyuni[0] == "2")
                {
                    prize += 200000;
                }
                if (jyuni[0] == "1")
                {
                    prize += 300000;
                }
                if (jyuni[1] == "3")
                {
                    prize += 100000;
                }
                if (jyuni[1] == "2")
                {
                    prize += 200000;
                }
                if (jyuni[1] == "1")
                {
                    prize += 300000;
                }

                if (jyuni[0] == "1" && jyuni[1] == "1")
                {
                    prize += 400000;
                }


                //出力
                Console.WriteLine(prize);




            }
        }



        static void Main(string[] args)
        {
            A_2019_1123_A mainClass = new A_2019_1123_A();
            mainClass.run();


            Console.ReadLine();
        }
    }
}


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

int main() {
  int N;
  cin >> N;
  vector<int> ans = {1, 2, 4, 8, 16, 32, 64, 10000};
  for (int i = 0; i < ans.size(); i++) {
    if (N < ans[i]) {
      cout << ans[i - 1] << endl;
      return 0;
    }
  }
}

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

#define mod 1000000007
#define REP(i, n) for (int i = 0; i < n; i++)

using namespace std;

/*long C(long n, long r){
    if(n < r) return 0;
    long p[n+1][n+1];
    p[0][0] = 1;
    for(int i = 1; i <= n; i++){
        p[i][0] = 1;
        p[i][i] = 1;
        for(int j = 1; j <= i-1; j++){
            p[i][j] = p[i-1][j] + p[i-1][j-1];
        }
    }
    return p[n][r];
}*/

 
void solve() {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    int ans = 0;
    ans = max(0, min(d, b) - max(a, c));
    cout << ans << endl;
}
 
int main() {
    solve();
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define SZ(x) ((int)(x).size())
#define rep(i,n) for(int i=0;i<(n);++i)
#define fore(i,a) for(auto &i:a)
#define Yes cout << "Yes" << endl;
#define No cout << "No" << endl;
#define answer cout << ans << endl;
signed _main(); signed main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> using v = vector<T>;
template<class T> using vv = vector<v<T>>;
const int MOD=1e9+7;
const long long INF = 1LL << 60;

signed _main(){
  int A,B,C,X,Y; cin >> A >> B >> C >> X >> Y;
  int ans=INF;
  for(int i=0;i<=max(2*X,2*Y);i+=2){
    int res=max((int)0,A*(X-i/2))+max((int)0,B*(Y-i/2))+C*i;
    chmin(ans,res);
  }
  cout << ans << endl;
  return 0;
}


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

using namespace std;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int w,h,x,ans,max;
    cin>>h>>w>>x;
    int n;float n1;
    (h>w)?max=h:max=w;
    if(x<=max){
        cout<<1;
        return 0;
    }
    n1=((float)x)/max;
    n=x/max;
    if(n==n1) cout<<n;
    else cout<<n+1;
    
    
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int m = sc.nextInt();
    int[][] ab = new int[n][2];
    int[][] cd = new int[m][2];
    int min = Integer.MAX_VALUE;
    int nearNum = 0;

    for(int i = 0; i < n; i++) {
      ab[i][0] = sc.nextInt();
      ab[i][1] = sc.nextInt();
    }
    for(int i = 0; i < m; i++) {
      cd[i][0] = sc.nextInt();
      cd[i][1] = sc.nextInt();
    }

    for(int i = 0; i < n; i++) {
      for(int j = 0; j < m; j++) {
        int num = Math.abs(ab[i][0] - cd[j][0]) + Math.abs(ab[i][1] - cd[j][1]);
        if(min > num) {
          min = num;
          nearNum = j + 1;
        }
      }
      System.out.println(nearNum);
      min = Integer.MAX_VALUE;
    }
  }
}


Measured memory_bytes: 22868
#include <bits/stdc++.h>
using namespace std;
 
int main() {

  struct shop {
    int num;
    int value;
    string name;

    bool operator<( const shop& right ) const {
        return name == right.name ? value > right.value : name < right.name;
    }
  };

  int N;
  cin >> N;
  int p;
  string s;

  vector<shop> rest(N);

  for(int i=0;i<N;i++){
    cin >> s >> p;
    rest[i].name = s;
    rest[i].value = p;
    rest[i].num = i+1;
  }

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

  for(int i=0;i<N;i++){
    cout << rest[i].num << endl;
  }

}

Measured memory_bytes: 256
import numpy as np
h, w = map(int, input().split())
a = [[c for c in input()] for i in range(h)]
a = np.array(a)
colums = []
rows = []
for i in range(h):
    if not np.all(a[i] == '.'):
        colums.append(i)
for i in range(w):
    if not np.all(a[:, i] == '.'):
        rows.append(i)
a = a[colums]
for l in a[:, rows]:
    print(''.join(l))

Measured memory_bytes: 14568
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <stdio.h>
#include <iomanip>
#include <limits>
#include <list>
#include <string>
#include <queue>
#include <deque>
#include <tuple>
#include <map>
#include <sstream>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define FOR(i,a,b) for(int i=a; i<(int)(b); i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SORT(c) sort(ALL(x))
#define CLR(a) memset((a), 0 ,sizeof(a))
#define PB push_back
#define MP make_pair
#define SP << " " <<
const int INF = 1001001001;
const ll LINF = 100100100100100100;
const double EPS = 1e-10;
const long double PI  = acos(-1.0L);
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
#define chmax(a,b) a = (((a)<(b))?(b):(a))
#define chmin(a,b) a = (((a)>(b))?(b):(a))




__attribute__((constructor))
void initial(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}

signed main(){
  int n; cin>>n;
	rep(i,n){
		int a; cin>>a;
		if(a%2==0){
			if(a%3&&a%5) return cout<<"DENIED"<<endl,0;
		}
	}
	cout << "APPROVED" << endl;
  return 0;
}


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

int main() {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    if (abs(c-a)<=d || (abs(c-b)<=d && abs(b-a)<=d)) cout << "Yes\n";
    else cout << "No\n";
}

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

using namespace std;

const int MAX_LIMIT = 100005;
int N, K;
int arr[MAX_LIMIT];
int cnt = 0;

int main()
{
	scanf("%d %d", &N, &K);

	for(int i = 0; i < N; i++) {
		scanf("%d", &arr[i]);
	}

	N = N - K;

	while(N > 0) {
		N -= K - 1;
		cnt++;
	}

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

	
	return 0;
}
/*
	Powered by Buggy Plugin
*/


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair< ll, ll > Pi;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep2(i,n) for(int i=1;i<=(n);i++)
#define rep3(i,i0,n) for(int i=i0;i<(n);i++)
#define pb push_back
#define mod 1000000007
const ll INF = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
ll gcd(ll a, ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}
#define all(x) x.begin(), x.end()
#define mp make_pair
bool compare(Pi a, Pi b) {
    if(a.first != b.first){
        return a.first < b.first;
        
    }else{
        return a.second < b.second;
    }
}


bool In_map(ll y,ll x,ll h,ll w){
    if(y<0 || x<0 || y>=h || x>=w){
        return 0;
    }else{
        return 1;
    }
}
const vector<ll> dx{1,0,-1,0};
const vector<ll> dy{0,1,0,-1};


int main() {
    ll N;
    string S,T;
    cin >>S>>T;
    N = S.size();
    ll ans = 0;
    rep(i,N){
        if(S[i]!=T[i]){
            ans++;
        }
    }
    
    cout << ans << endl;


    return 0;
    

}

Measured memory_bytes: 3892
#include <stdio.h>

int main(void)
{
	int n;
	int i;
	int suma;
	int sumb;
	int a;
	int b;
	
	while (1){
		scanf("%d", &n);
		if (n == 0){
			break;
		}
		suma = 0;
		sumb = 0;
		for (i = 0; i < n; i++){
			scanf("%d %d", &a, &b);
			if (a < b){
				sumb += a + b;
			}
			else if(a > b){
				suma += a + b;
			}
			else {
				suma += a;
				sumb += b;
			}
		}
		printf("%d %d\n", suma, sumb);
	}
	
	return (0);
}

Measured memory_bytes: 600
/**
 ____ ____ ____ ____ ____
||a |||t |||o |||d |||o ||
||__|||__|||__|||__|||__||
|/__\|/__\|/__\|/__\|/__\|

**/

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const int NM_MAX = 200002;

int n, m;

ll k;

ll a[NM_MAX], b[NM_MAX];

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin >> n >> m >> k;
    for(int i = 1; i <= n; i++)
        cin >> a[i];
    for(int i = 1; i <= m; i++)
        cin >> b[i];
    int ans = 0;
    ll suma = 0, sumb = 0;
    for(int i = 1; i <= m; i++)
        sumb += b[i];
    int pos = m;
    while(sumb > k)
    {
        sumb -= b[pos];
        pos--;
    }
    ans = pos;
    for(int i = 1; i <= n; i++)
    {
        suma += a[i];
        while(sumb + suma > k && pos > 0)
        {
            sumb -= b[pos];
            pos--;
        }
        if(sumb + suma > k)
            break;
        ans = max(ans, pos + i);
    }
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 6732
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int maxn=3010,mod=998244353;
int a,b,c,d,dp[maxn][maxn];
signed main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cin>>a>>b>>c>>d;
	dp[a][b]=1;
	for(int i=a;i<=c;i++)
		for(int j=b;j<=d;j++)
			if(i!=a||j!=b)
			{
				if(i==1||j==1)
					dp[i][j]=1;
				else
					dp[i][j]=(dp[i-1][j]*j%mod+dp[i][j-1]*i%mod-dp[i-1][j-1]*(i-1)%mod*(j-1)%mod+mod)%mod;
			}
	cout<<dp[c][d]<<endl;
	return 0;
}

Measured memory_bytes: 74184