akhauriyash/Code-Regression huggingface dataset:
import java.util.*;
import java.io.*;
import static java.lang.System.*;
import static java.lang.Math.*;

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

    int n = Integer.parseInt(sc.nextLine());
    int[] arr = Arrays.stream(sc.nextLine().split(" ")).mapToInt(Integer::parseInt).toArray();
    int H[] = new int[n+1];
    for (int i = 0; i < arr.length; i++) {
      H[i+1] = arr[i];
    }

    for(int i=1; i<=n; i++) {
      out.print("node "+i+": ");
      out.print("key = "+H[i]+", ");
      if(i>1)out.print("parent key = "+H[i/2]+", ");
      if(i*2<=n)out.print("left key = "+H[i*2]+", ");
      if(i*2+1<=n)out.print("right key = "+H[i*2+1]+", ");
      out.println();
    }
  }
}



Measured memory_bytes: 32448
# -*- coding: utf-8 -*-

A, B, C, D = map(int, input().split())

late_start = 0
first_stop = 0
same_time = 0

late_start = max(A, C)
first_stop = min(B, D)
if first_stop - late_start > 0:
    same_time = first_stop - late_start
else:
    same_time = 0

print(same_time)

Measured memory_bytes: 9116
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define countof(array) (sizeof(array) / sizeof(array[0]))
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,n,s) for(int i = s; i < (n); ++i)
#define rsrep(i,n,s) for(int i = (n)-1; i >= s; --i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define aall(a) (a), (a)+countof(a)//for array sorting
#define raall(a) (a), (a)+countof(a), greater<>()
#define show(x) cout<<#x<<" = "<<x<<endl;
#define vfind(v, a) find(all(v), a) != v.end()
#define yn(f) { if (f) puts("YES"); else puts("NO"); }
#define yns(f) { if (f) puts("Yes"); else puts("No"); }
#define show_ary(...) { cout<<#__VA_ARGS__<<" = "; for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define show_pair(...) cout<<#__VA_ARGS__<<" = "<<endl; for (const auto& x : (__VA_ARGS__)) { cout<<"  "<<x.fi<<" : "<<x.se<<endl; }
#define out_ary(...) { for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define argmax(v) distance((v).begin(), max_element(all(v)))
#define argmin(v) distance((v).begin(), min_element(all(v)))
#define vmax(v) *max_element(all(v))
#define vmin(v) *min_element(all(v))
typedef long long int ll;
typedef pair<int, int> P;
typedef vector<P> vpair;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<double> vdouble;
typedef vector<string> vstr;
typedef vector<bool> vbool;
typedef vector<vint> vvint;
typedef vector<vll> vvll;
typedef vector<vstr> vvstr;
typedef vector<vbool> vvbool;
const ll LINF = 2000000000000000000ll;
const int INF = 1000000100;
const ll MOD = 1e9+7;

int main() {
    ll n;
    cin >> n;
    vll a(5);
    rep(i, 5) cin >> a[i];
    ll s = vmin(a);

    ll ans = (n-s + (s-1))/s + 5;
    cout << ans << endl;
    return 0;
}

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

def partions(M):#Mの約数列 O(n^(0.5+e))
    import math
    d=[]
    i=1
    while math.sqrt(M)>=i:
        if M%i==0:
            d.append(i)
            if i**2!=M:
                d.append(M//i)
        i=i+1
    d.sort()
    return d

list=partions(N)
for i in range(0,len(list)//2):
    q=list[i]
    m=N//list[i]-1
    if m>q:
        ans+=m

print(ans)

Measured memory_bytes: 39024
#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <map>
#include <queue>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using namespace std;

template<class T>
constexpr T INF = ::numeric_limits<T>::max() / 32 * 15 + 208;

template <class T, class U>
vector<T> make_v(U size, const T& init){ return vector<T>(static_cast<size_t>(size), init); }

template<class... Ts, class U>
auto make_v(U size, Ts... rest) { return vector<decltype(make_v(rest...))>(static_cast<size_t>(size), make_v(rest...)); }


int main() {
    int a, b;
    cin >> a >> b;
    vector<int> s(a), t(b);
    for (auto &&i : s) scanf("%d", &i);
    for (auto &&i : t) scanf("%d", &i);
    int ans = 0;
    for (int i = 0; i < b; ++i) {
        int j = i;
        for (int k = 0; k < a; ++k) {
            if(j == b) break;
            if(s[k] == t[j]) j++;
        }
        ans = max(ans, j-i);
    }
    cout << ans << "\n";
    return 0;
}



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

using namespace std;

int main() {

	vector<int> a(10, 0);
	for (int i = 0; i < 10; i++) {
		cin >> a[i];
	}
	sort(a.begin(), a.end());
	cout << a[9] << endl << a[8] << endl << a[7] << endl;
}


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

int main(){
	int n,r,p[100],c[100],hanafuda[100][100],b;
	while(true){
		cin>>n>>r;
		if(n==0 && r==0){
			break;
		}
		for(int i=1;i<=n;i++){
			hanafuda[i][0]=n-i+1;
		}
		for(int i=1;i<=r;i++){
			
			b=0;
			cin>>p[i]>>c[i];

			for(int j=p[i];j<p[i]+c[i];j++){
				b++;
				hanafuda[b][i]=hanafuda[j][i-1];
			}
			for(int j=1;j<p[i];j++){
				b++;
				hanafuda[b][i]=hanafuda[j][i-1];
			}
			for(int j=p[i]+c[i];j<=n;j++){
				b++;
				hanafuda[b][i]=hanafuda[j][i-1];
			}
		}
		cout<<hanafuda[1][r]<<endl;
	}
	return 0;
}

Measured memory_bytes: 1184
dict = {"A":1,"C":2,"G":3,"T":4}
def a2n(a):
	ans = 0
	for i in range(len(a)):
		ans += dict[a[i]]*4**i
	return ans
	
n = int(raw_input())
ls = [0 for i in range(3000000)]
for i in range(n):
    inp = raw_input()
    if inp[0] == "i":
        ls[a2n(inp[7:])] = 1
    else:
        print "yes" if ls[a2n(inp[5:])] else "no"
            

Measured memory_bytes: 124308
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double db;
#define fi first
#define se second
#define pi pair<ll,ll>
#define pii pair<ll,pi>
#define pb push_back
#define mk make_pair
vector<vector<int>>table(10, vector<int>(10));
vector<vector<int>>task(207, vector<int>(207));
int h, w;
void flyodwashall() {
	for (int k = 0; k < 10; k++) {
		for (int i = 0; i < 10; i++) {
			for (int j = 0; j < 10; j++) {
				if (table[i][j] > table[i][k] + table[k][j]) {
					table[i][j] = table[i][k] + table[k][j];
				}
			}
		}
	}
}
int main() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cin >> h >> w;
	for (int i = 0; i < 10; i++) {
		for (int j = 0; j < 10; j++) {
			cin >> table[i][j];
		}
	}
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			cin >> task[i][j];
		}
	}
	flyodwashall();
	// for (int i = 0; i < 10; i++) {
	// 	for (int j = 0; j < 10; j++) {
	// 		cout << table[i][j] << " ";
	// 	}
	// 	cout << endl;
	// }
	int ans = 0;
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			if (task[i][j] == -1)continue;
			//cout << table[task[i][j]][1] << endl;
			ans += table[task[i][j]][1];
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 3768
#include<vector>
#include<cmath>
#include<map>
#include<cstdlib>
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<set>
#include<stack>
#include<bitset>
#include<functional>
#include<ctime>
#include<queue>
#include<deque>
#include<complex>
#include<cassert>
using namespace std;
#define pb push_back
#define pf push_front
typedef long long lint;
typedef complex<double> P;
#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
int main()
{
	lint a,b,c,k;cin>>a>>b>>c>>k;
	if(k%2==0L){
		cout<<a-b<<endl;
	}
	else cout<<b-a<<endl;
}


Measured memory_bytes: 764
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<map>
#include<cmath>
using namespace std;
#define REP(i, limit) for(int i=0; i< limit; ++i)
#define FOR(i, j, limit) for(int i=j; i< limit; ++i)
#define DUMP(a) REP(d,a.size()){cout<<a[d];if(d!=a.size()-1)cout<<" ";else cout<<endl;}
#define LL long long
int INF = 2147483647;
LL LINF = 9223372036854775807;
LL MOD = 1000000007;
typedef pair<int, int>P;
typedef pair<LL, LL>PL;
typedef vector<int> vi;
typedef vector<LL> vl;


int main(){
  int N;
  LL x;
  cin>>N>>x;
  LL a[N];
  REP(i, N){
    cin>>a[i];
  }
  LL ans=0;
  if(a[0]>x){
    ans += a[0]-x;
    a[0]=x;
  }
  FOR(i, 1, N){
    if(a[i]+a[i-1]>x){
      ans += a[i]+a[i-1]-x;
      a[i]=x-a[i-1];
    }
  }
  cout<<ans<<endl;

  return 0;
}


Measured memory_bytes: 1024
#include<iostream>
using namespace std;
int main(){
  int a;
  int ans;
  cin >> a;
  ans=a;
  if(a/100==9) ans=ans-900+100;
  if(a/100==1) ans=ans+900-100;

  if((a/10)%10==9) ans=ans-90+10;
  if((a/10)%10==1) ans=ans+90-10;

  if((a%100)%10==9) ans=ans-9+1;
  if((a%100)%10==1) ans=ans+9-1;
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
int a,b;
cin>>a>>b;
string s;
cin>>s;
if(s[a]!='-')
{
    cout<<"No";
    return 0;
}
for(int i=0;i<a+b+1;i++)
{
    if(i!=a)
    {
        if(s[i]>='0'&&s[i]<='9')
        continue;
        cout<<"No";
        return 0;

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


Measured memory_bytes: 256
import numpy as np

A, B = map(int, input().split())

K = 50
grid = np.ones((100, 100), dtype='int')

# 白1黒0
grid[:K, :] = 0

A -= 1
col = 0
row = 0
while A:
    if A >= K:
        grid[col, ::2] = 1
        A -= K
        col += 2
        continue

    grid[col, row] = 1
    row += 2
    A -= 1

B -= 1
col = K + 1
row = 0
while B:
    if B >= K:
        grid[col, ::2] = 0
        B -= K
        col += 2
        continue

    grid[col, row] = 0
    row += 2
    B -= 1

grid = np.where(grid, '.', '#').tolist()
grid = map(''.join, grid)
print(100, 100)
print('\n'.join(grid))

Measured memory_bytes: 21372
#include <iostream>
#include <vector>
#include <fstream>
#include <numeric>
#include <sstream>
#include <cassert>
#include <tuple>
#include <iomanip>
#include <random>
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <chrono>
#include <stack>
#include <string>
#include <bitset>
#include <unordered_map>
#include <cstdio>
#include <limits>
#include <vector>
#include <climits>
#include <cstring>

using namespace std;

#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x.size())
#define pb push_back
#define endl "\n" // TODO: remove
#define int long long

const int N = (int)(1e6) + 322;
const long long inf = (long long)(2e18) + 322;
const int mod = (int)(1e9) + 7; // check modulo


void solve() {
    int k; cin >> k;
    int cur = 0;
    for(int i = 1; i <= N; ++i) {
        cur = (cur * 10 + 7) % k;
        if (cur == 0) {
            cout << i;
            return;
        }
    }
    cout << -1;
}

signed main () {
    ios_base :: sync_with_stdio(false);
    cin.tie(NULL);

    int test = 1;//  cin >> test;
    for(int t = 1; t <= test; ++t) {
        solve();
    }
    return 0;
}



Measured memory_bytes: 3192
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n;
  cin >>n;
  for( int i = 0;i<= n/7;i++){
    if( (n - i*7)%4 == 0){
      cout << "Yes";
      break;
    }
    if( i == n/7){
      cout << "No";
    }
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
    ll n,ans = 0;
    cin >> n;
    for (ll i = 1;i <= 9;i++)
        if (n >= i)
            ans++;
        else break;
    for (ll i = 100;i <= 999;i++)
        if (n >= i)
            ans++;
        else break;
    for (ll i = 10000;i <= 99999;i++)
        if (n >= i)
            ans++;
        else break;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int p,a;
    scanf("%d%d",&p,&a);
    if(p>=1&&p<=10000&&a>=0&&a<=1000)
    {
       if(p%500==0)
		printf("Yes\n");
	   else if(p<=a)
		printf("Yes\n");
	   else if((p%500)<=a)
	   printf("Yes\n");
	   else if((p%500)>a)
	   printf("No\n");
	   else
		printf("No\n");
    }
    return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(),v.end()
#define INF INT_MAX;
typedef long long ll;
using namespace std;

int main(){
  int w,a,b;
  cin >> w >> a >> b;
  int x,y,ans;
  x = min(a,b); y = max(a,b);
  if(x+w>y) ans = 0;
  else ans = y-x-w;
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
vector<int>arr1;
vector<int>arr2;
vector<ll>pf1;
vector<ll>pf2;
bool check(ll num,ll k)
{
//	cout<<"hello "<<num<<"\n";
	ll s1=min(num,ll(arr1.size()));
	for(ll i=s1; i>=0; i--)
	{
		if(arr2.size()<num-i)
		 continue;
		ll size2=num-i;
		ll temp;
		if(size2==0)
		{
			temp=pf1[i-1];
		}
		else if(i==0)
		{
			temp=pf2[size2-1];
		}
		else
		 temp=pf1[i-1]+pf2[size2-1];
		if(temp<=k)
		 return true;
	}
	return false;
	
}
int main()
{
	int n,m;
	ll k;
	cin>>n>>m>>k;
	arr1.resize(n);
	arr2.resize(m);
	pf1.resize(n);
	pf2.resize(m);
	ll sum1=0,sum2=0;
	for(int i=0; i<n; i++){
	 cin>>arr1[i];
	 sum1+=arr1[i];
	 pf1[i]=sum1;
    }
	for(int j=0; j<m; j++){
	 cin>>arr2[j];
	 sum2+=arr2[j];
	 pf2[j]=sum2;
    }
	int ans=0;
	ll s=1;
	ll e=n+m;
	while(s<=e)
	{
		ll mid=(s+e)/2;
		if(check(mid,k))
		{
			ans=mid;
			s=mid+1;
		}
		else
		 e=mid-1;
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 7948
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

//INSERT ABOVE HERE
int is_vowel(char c){
  return c=='a'||c=='i'||c=='u'||c=='e'||c=='o';
}

signed main(){
  int n;
  while(cin>>n,n){
    vector<string> ss(n);
    for(int i=0;i<n;i++) cin>>ss[i];

    int ans=-1;
    for(int k=1;k<=50;k++){
      set<string> ts;
      for(string s:ss){
        string t;
        t+=s[0];
        int m=s.size();
        for(int j=0;j+1<m;j++)
          if(is_vowel(s[j])) t+=s[j+1];
        if((int)t.size()>k) t.resize(k);
        ts.emplace(t);
      }
      if((int)ts.size()==n){
        ans=k;
        break;
      }
    }
    cout<<ans<<endl;
  }
  return 0;
}



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

int main(){
  int k,x;
  cin >> k>>x;
  if(500*k>=x)cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256
/*package whatever //do not write package name here */
import java.util.*;
import java.lang.Math;
import java.io.*;

class Main {
	public static void main (String[] args) {
// 		System.out.println("GfG!");
		Scanner input=new Scanner(System.in);
		double n=input.nextDouble();
		outer:for(double i=0;i<=100000;i++)
		{
		    for(double j=-100000;j<=100000;j++)
		    {
		        if((Math.pow(i,5)-Math.pow(j,5))==n)
		        {
		            System.out.println((int)i + " " + (int)j);
		            break outer;
		        }
		    }
		}
		input.close();
	}
}

Measured memory_bytes: 39336
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class Main {

	static int d[];
	static int v;

	static List<edge> edges;

	public static void main(String[] args) throws IOException {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String[] v_e_r = br.readLine().split(" ");

		v = Integer.parseInt(v_e_r[0]);

		int e = Integer.parseInt(v_e_r[1]);

		int r = Integer.parseInt(v_e_r[2]);

		d = new int[v];

		edges = new ArrayList<>();

		for (int i = 0; i < e; i++) {
			String[] from_to_cost_edge = br.readLine().split(" ");

			edges.add(new edge(Integer.parseInt(from_to_cost_edge[0]), Integer.parseInt(from_to_cost_edge[1]),
					Integer.parseInt(from_to_cost_edge[2])));
		}


		if (bellford(r)) {
			System.out.println("NEGATIVE CYCLE");
		} else {

			for (int i = 0; i < d.length; i++) {
				if (d[i] == Integer.MAX_VALUE / 2) {
					System.out.println("INF");
				} else {
					System.out.println(d[i]);
				}
			}
		}

	}

	static boolean judge = false;

	static boolean bellford(int now) {

		Arrays.fill(d, Integer.MAX_VALUE / 2);
		d[now] = 0;
		int i;
		for (i = 0; i < v; i++) {
			for (edge e : edges) {
				if (d[e.from] != Integer.MAX_VALUE/2 && d[e.to] > d[e.from] + e.cost) {
					d[e.to] = d[e.from] + e.cost;

					if (i == v-1) {
						judge = true;
						return true;
					}
				}
				/* System.out.println(e.to+""+e.from); */
			}
		}
		return false;
	}

	static class edge {
		int from;
		int to;
		int cost;

		public edge(int a, int b, int c) {
			this.from = a;
			this.to = b;
			this.cost = c;
		}
	}
}

Measured memory_bytes: 27712
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define For(i,n,k) for(int i=(n);i<(k);i++)
#define ALL(a)  (a).begin(),(a).end()
ll ans=0;
void Main(){
    string s;cin>>s;
    for(char t:s){
        if(t == '7'){
            cout << "Yes" << endl;
            return;
        }
    }
    cout << "No" << endl;
}
int main(){
    Main();
    /*
    東方風神録は神が出てくるので当然神ゲー
    */
    return 0;
}

Measured memory_bytes: 3596
// In the name of God

#include <bits/stdc++.h>
using namespace std;
const int N = 505;
int a[N], sum;
vector<int> divs;

int main() {
	ios_base::sync_with_stdio(0), cin.tie(0);
	int n, k;
	cin >> n >> k;
	for(int i=0; i<n; i++) cin >> a[i];
	for(int i=0; i<n; i++) sum += a[i];
	for(int i=1; i*i<=sum; i++) {
		if(sum % i == 0) {
			divs.push_back(i);
			if(sum / i != i) divs.push_back(sum/i);
		}
	}
	sort(divs.rbegin(), divs.rend());
	for(auto x : divs) {
		vector<int> rem, need;
		for(int i=0; i<n; i++) rem.push_back(a[i] % x);
		sort(rem.begin(), rem.end());
		for(int i=0; i<n; i++) need.push_back( rem[i]==0?0:x-rem[i] );
		for(int i=1; i<n; i++) need[i] += need[i-1];
		int s = 0;
		if(need[n-1]==0) {
			cout << x;
			exit(0);
		}
		for(int i=0; i<n; i++) {
			s += rem[i];
			if(s > k) break;
			if(s == need[n-1]-need[i]) {
				cout << x;
				exit(0);
			}
		}
	}
	cout << 1;
	return 0;
}


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

int main(){
  string A = "AIDUNYAN", B = "AIZUNYAN";

  int check[26] = {};
  for(int i=0;i<(int)A.size();i++)check[A[i]-'A']++;

  string D,Z;
  cin >> D;
  Z = D;

  int cnt[26] = {};
  for(int i=0;i<(int)D.size();i++){
    cnt[D[i]-'A']++;
    if(8<=i)cnt[D[i-8]-'A']--;

    bool f = true;
    for(int j=0;j<26;j++){
      if(cnt[j] != check[j])f = false;
    }

    if(f){
      for(int j=0;j<8;j++)Z[i-7+j] = B[j];
    }
  }

  cout << Z << endl;
}

Measured memory_bytes: 1192
#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() {
    long long W, H, x, y;
    cin >> W >> H >> x >> y;
    double res = (double)(W)*H / 2;
    cout << fixed << setprecision(10) << res << " ";

    if(x * 2 == W && y * 2 == H)
        cout << 1 << endl;
    else
        cout << 0 << endl;
}

Measured memory_bytes: 3768
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a) for(int i = 0; i < (a); i++)
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9;
const int MOD = 1e9 + 7;

int main(){
	int n;
	cin >> n;
	int k;
	set<int> s;
	REP(i,n){
		cin >> k;
		s.insert(k);
	}
	cout << s.size() << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<deque>
#include<cmath>
#include<map>
#include<cstring>

using namespace std;
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LLINF = 1LL<<60;
#define P pair<ll, ll>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define print(x) cout << (x) << endl

class mint {
    long long x;
public:
    mint(long long x=0) : x((x%MOD+MOD)%MOD) {}
    mint operator-() const {
      return mint(-x);
    }
    mint& operator+=(const mint& a) {
        if ((x += a.x) >= MOD) x -= MOD;
        return *this;
    }
    mint& operator-=(const mint& a) {
        if ((x += MOD-a.x) >= MOD) x -= MOD;
        return *this;
    }
    mint& operator*=(const  mint& a) {
        (x *= a.x) %= MOD;
        return *this;
    }
    mint operator+(const mint& a) const {
        mint res(*this);
        return res+=a;
    }
    mint operator-(const mint& a) const {
        mint res(*this);
        return res-=a;
    }
    mint operator*(const mint& a) const {
        mint res(*this);
        return res*=a;
    }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }
    // for prime MOD
    mint inv() const {
        return pow(MOD-2);
    }
    mint& operator/=(const mint& a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint& a) const {
        mint res(*this);
        return res/=a;
    }

    friend ostream& operator<<(ostream& os, const mint& m){
        os << m.x;
        return os;
    }
};

/* -- template -- */

int main() {
    int X, N; cin >> X >> N;
    int p[N]; rep(i, N) cin >> p[i];
    map<int, bool> used;
    rep(i, N) used[p[i]] = true;
    rep(i, 100) {
        if(used[X - i] == false) {
            cout << X - i << endl;
            return 0;
        }
        if(used[X + i] == false) {
            cout << X + i << endl;
            return 0;
        }
    }
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int ctoi(const char c) {
    if ('0' <= c && c <= '9') return (c - '0');
    return -1;
}
vector<int> input(int n) {
    vector<int> vec(n);
    for (int i = 0; i < n; i++) {
        cin >> vec.at(i);
    }
    return vec;
}
void output(vector<int> vec) {
    for (int i = 0; i < vec.size(); i++) {
        cout << vec[i] << " ";
    }
    return;
}
vector<vector<int>> input(int n, int m) {
    vector<vector<int>> table(n, vector<int>(m));
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            cin >> table. at(i).at(j);
        }
    }
    return table;
}
void output(vector<vector<int>> table) {
    for (int i = 0; i < table.size(); i++) {
        for (int j = 0; j < table.at(0).size(); j++) {
            cout << table.at(i).at(j) << " ";
        }
        cout << endl;
    }
}
long long perm(int n, int r) {
    if (n < r) {
        cout << "error" << endl;
        return 0;
    }
    long long perm = 1;
    for (int i = n; i > n - r; i--) {
        perm *= i;
    }
    return perm;
}
long long comb(int n, int r) {
    if (n < r) {
        cout << "error" << endl;
        return 0;
    }
    long long comb = perm(n,r);
    for (int i = r; i > 0; i--) {
        comb /= i;
    }
    return comb;
}
long long homo(int n, int r) {
    return comb(n + r - 1, n - 1);
}
long long fact(int n) {
    long long fact = 1;
    for (int i = n; i > 0; i--) {
        fact *= i;
    }
    return fact;
}
int gcd(int a, int b){
    if (a % b == 0){
        return(b);
    }else{
        return(gcd(b, a % b));
    }
}
int lcm(int a, int b) {
    return a * b / gcd(a, b);
}
bool isprime(int n){
    if (n < 2) return false;
    else if (n == 2) return true;
    else if (n % 2 == 0) return false;

    for (int i = 3; i <= sqrt(n); i += 2){
        if (n % i == 0){
            return false;
        }
    }
    return true;
}
void sayYes(bool f) {
    if (f) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
}
void sayYES(bool f) {
    if (f) {
        cout << "YES" << endl;
    }
    else {
        cout << "NO" << endl;
    }
}

int main() {
  double h,w,n;
  cin >> h >> w >> n;
  cout << ceil(n/max(h,w)) << endl;
}


Measured memory_bytes: 256
X = int(input())
if 400<=X<=599:
    print(8)
elif 600<=X<=799:
    print(7)
elif 800<=X<=999:
    print(6)
elif 1000<=X<=1199:
    print(5)
elif 1200<=X<=1399:
    print(4)
elif 1400<=X<=1599:
    print(3)
elif 1600<=X<=1799:
    print(2)
elif 1800<=X<=1999:
    print(1)


Measured memory_bytes: 9088
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		String s = sc.next();
		String t = sc.next();
		
		int a = sc.nextInt();
		int b = sc.nextInt();
		
		String u = sc.next();
		
		if (u.equals(s)) {
			System.out.print(a - 1 + " ");
			System.out.print(b);
		}
		else if (u.equals(t)){
			System.out.print(a + " ");
			System.out.print(b - 1);
		}
	}

}


Measured memory_bytes: 22612
#include<iostream>
#include<string>
#include <algorithm>
#include <vector>

using namespace std;

int main()
{
    int N;
    string S;
    int K;
    cin >> N >> S >> K;
    char c;
    c = S[K-1];
    for (int i = 0; i < N; i++)
    {
        if(S[i] != c)
        {
            S[i] = '*';
        }
    }
    cout << S << endl;
}

Measured memory_bytes: 256
#105b
n=int(input())
ans=0
flag=False
    
for i in range(25):
    for j in range(14):
        ans=4*i+j*7
        if ans==n:
            flag=True
            break
        elif ans>n:
            break
print('Yes' if flag==True else 'No')
            
    

Measured memory_bytes: 2940
#import <Foundation/Foundation.h>
#define MM 1000000007
typedef long long INT;
int main(){
    @autoreleasepool {
        NSMutableSet *set = [NSMutableSet set];
        INT N,M;
        scanf("%lld %lld",&N,&M);
        for(INT i=0;i<M;i++){
            INT a;
            scanf("%lld",&a);
            [set addObject:@(a)];
        }
        INT a=0;
        INT b=1;
        for(INT i=1;i<=N;i++) {
            if ([set containsObject:@(i)]) {
                a=b;
                b=0;
            } else {
                INT c = (a+b) % MM;
                a=b;
                b=c;
            }
        }
        printf("%lld",b);
    }
}


Measured memory_bytes: 13192
#
# Written by NoKnowledgeGG @YlePhan
# ('ω')
#
#import math
#mod = 10**9+7
#import itertools
#import fractions
#import numpy as np
#mod = 10**4 + 7
"""def kiri(n,m):
  r_ = n / m
  if (r_ - (n // m)) > 0:
    return (n//m) + 1
  else:
    return (n//m)"""
 
def main():
  TIME = 0
  ORDER = [int(input()) for _ in range(5)]
  for i in range(5):
    for j in range(i,5):
      if (ORDER[i] % 10 != 0 and ORDER[j] % 10 != 0) and ORDER[i] % 10 >= ORDER[j] % 10:
        tmp = ORDER[i]
        ORDER[i] = ORDER[j]
        ORDER[j] = tmp
      
  ORDER = ORDER[::-1]
  #print(ORDER)
  for i in range(5):
    #ORDER = int(input())
    TIME += ORDER[i]
    if i == 4:
      break
    if TIME % 10 != 0:
      TIME += 10 - (TIME%10)
    #print(TIME)
  print(TIME)
if __name__ == '__main__':
  main()

Measured memory_bytes: 3064
def sieve_of_eratosthenes(n):
    prime=[]
    limit=int(n**0.5)
    data=[i+1 for i in range(1,n)]
    while True:
        p=data[0]
        if limit<p:
            return prime+data
        prime.append(p)
        data=[e for e in data if e%p!=0]

m=55555
Primes=sieve_of_eratosthenes(m)
k=(len(Primes))
A=[]
for p in Primes:
    if p%5==1:
        A.append(p)
n=int(input())
print(*A[:n])

Measured memory_bytes: 5528
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int a[3];

int formula(string& s,int& idx){
    if('0'<=s[idx]&&s[idx]<='2'){
        int ret = s[idx]-'0';
        ++idx;
        return ret;
    }
    else if('P'<=s[idx]&&s[idx]<='R'){
        int ret = a[s[idx]-'P'];
        ++idx;
        return ret;
    }
    else if(s[idx]=='-'){
        ++idx;
        return 2-formula(s,idx);
    }
    else if(s[idx]=='('){
        ++idx;
        int lhs = formula(s,idx);
        char op = s[idx];
        ++idx;
        int rhs = formula(s,idx);
        assert(s[idx]==')');
        ++idx;
        if(op == '+')return max(lhs, rhs);
        else return min(lhs, rhs);
    }
    else assert(false);
}

void solve(string& s){
    int ans = 0;
    rep(i,3)rep(j,3)rep(k,3){
        a[0]=i;a[1]=j;a[2]=k;
        int idx = 0;
        ans += formula(s,idx) == 2;
    }
    cout<<ans<<endl;
}

int main(){
    string s;
    while(cin>>s,s!=".")solve(s);
    return 0;
}


Measured memory_bytes: 3064
N=int(input())
cnt=0
maxcnt=0
for i in range(N):
  tmp = input().split()
  tmp1=int(tmp[0])
  tmp2=int(tmp[1])
  if tmp1 == tmp2:
    cnt+=1
  else:
    cnt=0
  
  if cnt > maxcnt:
    maxcnt=cnt
    
if maxcnt >= 3:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 9188
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#include <ctype.h>
#include <stdlib.h>
using namespace std;

int main()
{
    string S;
    cin >> S;
    if(S == "SUN"){
        cout << "7" << endl;
    }else if(S == "MON"){
        cout << "6" << endl;
    }else if(S == "TUE"){
        cout << "5" << endl;
    }else if(S == "WED"){
        cout << "4" << endl;
    }else if(S == "THU"){
        cout << "3" << endl;
    }else if(S == "FRI"){
        cout << "2" << endl;
    }else if(S == "SAT"){
        cout << "1" << endl;
    }



}


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

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author varunvats32
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        CLowElements solver = new CLowElements();
        solver.solve(1, in, out);
        out.close();
    }

    static class CLowElements {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            int[] arr = new int[n];

            for (int i = 0; i < n; i++) {
                arr[i] = in.nextInt();
            }

            int min = arr[0];
            int count = 0;

            for (int i = 0; i < n; i++) {
                if (arr[i] > min) {
                    count++;
                }
                min = Math.min(min, arr[i]);
            }

            out.println(n - count);
        }

    }
}



Measured memory_bytes: 85192
s = input()
#l = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
l = []
roll = ord('z')-ord('a')+1

for i in range(roll):
    l.append(0)

for i in range(len(s)):
    num = ord(s[i])
    l[num-97] += 1
    #print(num)

for i in range(roll):
    if l[i]%2 != 0:
        print("No")
        break
else:
    print("Yes")


Measured memory_bytes: 3060
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstdlib>
#include<cstdio>
#include<cstring>
#include<iomanip>
#include<string>
#include<set>
#include<map>
#include<vector>
#include<queue>
#include<stack>
#include<utility>
#define PI acos(-1.0)
using namespace std;
int main(){
	int a,b,h,m;
	cin >> a >> b >> h >> m;
	h %= 12;
	m %= 60;
	double dis = h + m * 1.0/60 - m * 1.0 / 5;
	if(dis > 6){
		dis = 12 - dis;
		double ans = dis * PI / 6;
		printf("%.10lf",sqrt(a * a + b * b - 2 * a * b * cos(ans)));
	}else if(dis == 6){
		cout << a + b;
	}else{
		double ans = dis * PI / 6;
		printf("%.10lf",sqrt(a * a + b * b - 2 * a * b * cos(ans)));
	}
	return 0;
}

Measured memory_bytes: 4124
num, point, ques = list(map(int, input().split(" ")))
ans_list = []
point_list = []

for i in range(num):
    point_list.append(point)

for i in range(ques):
    point_list[int(input())-1]+=1

for i in range(num):
    if(point_list[i]-ques<=0):
        print("No")
    else:
        print("Yes")

Measured memory_bytes: 6604
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<vector>
#include<queue>
#include<stack>
#include<cmath>
using namespace std;
int main(){
	int a,b;
	cin>>a>>b;
	if(a%b==0)cout<<0;
	else cout<<1;
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define space putchar(' ')
#define enter putchar('\n')
#define MAXN 1005
#define eps 1e-10
//#define ivorysi
using namespace std;
typedef long long int64;
typedef double db;
template<class T>
void read(T &res) {
	res = 0;T f = 1;char c = getchar();
	while(c < '0' || c > '9') {
		if(c == '-') f = -1;
		c = getchar();
	}
	while(c >= '0' && c <= '9') {
		res = res * 10 + c - '0';
		c = getchar();
	}
	res *= f;
}
template<class T>
void out(T x) {
	if(x < 0) {x = -x;putchar('-');}
	if(x >= 10) {
		out(x / 10);
	}
	putchar('0' + x % 10);
}
const int MOD = 1000000007;
int N,M;
bool col[MAXN * MAXN],row[MAXN * MAXN];
int inc(int a,int b) {
	return a + b >= MOD ? a + b - MOD : a + b;
}
int mul(int a,int b) {
	return 1LL * a * b % MOD;
}
void Solve() {
	read(N);read(M);
	int a;
	for(int i = 1 ; i <= N ; ++i) {
		read(a);
		if(row[a]) {puts("0");return;}
		row[a] = 1;
	}
	for(int i = 1 ; i <= M ; ++i) {
		read(a);
		if(col[a]) {puts("0");return;}
		col[a] = 1;
	}
	int ans = 1;
	int c = 0,r = 0;
	for(int i = N * M ; i >= 1 ; --i) {
		int tc = c,tr = r;
		if(col[i]) {tc = 1;++c;}
		if(row[i]) {tr = 1;++r;}
		if(col[i] || row[i]) ans = mul(ans,tc * tr);
		else ans = mul(ans,tc * tr - (N * M - i));
	}
	out(ans);enter;
}
int main() {
#ifdef ivorysi
	freopen("f1.in","r",stdin);
#endif
	Solve();
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b)  for(int i=(a),i##formax=(b);i< i##formax;i++)
#define FORR(i,a,b) for(int i=(a),i##formin=(b);i>=i##formin;i--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define pcnt __builtin_popcount
#define sz(x) (int)(x).size()
#define maxs(x,y) x=max((x),(y))
#define mins(x,y) x=min((x),(y))
#define show(x) cout<<#x<<" = "<<(x)<<endl;
#define all(a) ((a).begin()),((a).end())
#define each(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define bit(n) (1LL<<(n))
typedef long long ll;
typedef __int128_t lll;
template<class T>using V=vector<T>;
template<class T>using VV=V<V<T>>;
template<class T,class Y>using P=pair<T,Y>;
template<class T,class Y>ostream& operator<<(ostream&o,P<T,Y>&p){return o<<"("<<p.fi<<","<<p.se<<")";}
template<class T>ostream& operator<<(ostream&o,V<T>&v){for(T&t:v)o<<t<<",";return o<<endl;}
template<class T>void uniq(V<T>&v){sort(all(v));v.erase(unique(all(v)), v.end());}
template<typename A, size_t N, typename T>void Fill(A (&a)[N], const T &v){fill((T*)a,(T*)(a+N),v);}

lll gcd(lll a,lll b,lll&x,lll&y){if(!b){x=1;y=0;return a;}lll d=gcd(b,a%b,y,x);y-=a/b*x;return d;}
ll modInv(ll a,ll m){lll x,y;gcd(a,m,x,y);return(x%m+m)%m;}
ll modPow(lll a,lll n,ll m){lll p=1;for(;n;n>>=1,a=a*a%m)if(n&1)p=p*a%m;return p;}
V<ll>F,R;void setF(int n,int mod){F=R=V<ll>(++n);F[0]=1;FOR(i,1,n)F[i]=F[i-1]*i%mod;R[n-1]=modInv(F[n-1],mod);FORR(i,n-1,1)R[i-1]=R[i]*i%mod;}
ll comb(int a,int b,int m){return a<b||b<0?0:F[a]*R[b]%m*R[a-b]%m;}

const int IINF = 1e9+6;
const ll LINF = 1e18;
const int MOD = 1e9+7;
const int N=1e5;
int n, k, a[N];

main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n >> k;
  setF(n, MOD);
  FOR(i, 0, n) cin >> a[i];
  sort(a, a+n);
  ll ma=0, mi=0;
  FOR(i, 0, n){
    ma += a[i]*comb(i, k-1, MOD)%MOD;
    mi += a[i]*comb(n-i-1, k-1, MOD)%MOD;
  }
  cout << (ma%MOD-mi%MOD+MOD)%MOD << endl;
}

Measured memory_bytes: 2176
#include <stdio.h>
#include <math.h>

int
main (
  int   argc,
  char *argv[ ]
  )
{
  double r;

  scanf ( "%lf", &r );
  printf ( "%.5f %.5f\n", r * r * M_PI, 2. * r * M_PI );

  return ( 0 );
}

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

#if MYDEBUG
#include "lib/cp_debug.hpp"
#else
#define DBG(...) ;
#endif
#if __cplusplus <= 201402L
template <typename T>
T gcd(T a, T b) { return ((a % b == 0) ? b : gcd(b, a % b)); }
template <typename T>
T lcm(T a, T b) { return a / gcd(a, b) * b; }
#endif
using LL = long long;
constexpr LL LINF = 334ll << 53;
constexpr int INF = 15 << 26;
constexpr LL MOD = 1E9 + 7;

namespace Problem {
using namespace std;

class Solver2 {
 public:
  int h, w;
  vector<string> a;
  vector<vector<int>> d;
  int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
  Solver2(LL h, LL w) : h(h), w(w), a(h), d(h, vector<int>(w, INF)){};

  void solve() {
    for (int i = 0; i < h; ++i) {
      cin >> a[i];
    }
    queue<pair<int, int>> Q;
    for (int i = 0; i < h; ++i) {
      for (int j = 0; j < w; ++j) {
        if (a[i][j] == '#') {
          d[i][j] = 0;
          Q.emplace(i, j);
        }
      }
    }
    while (!Q.empty()) {
      auto tmp = Q.front();
      Q.pop();
      int nx = tmp.first;
      int ny = tmp.second;
      for (int dir = 0; dir < 4; ++dir) {
        int R = nx + dx[dir];
        int C = ny + dy[dir];
        if (0 <= R && R < h && 0 <= C && C < w && d[R][C] == INF) {
          d[R][C] = d[nx][ny] + 1;
          Q.emplace(R, C);
        }
      }
    }
    int ans = 0;
    for (int i = 0; i < h; ++i) {
      for (int j = 0; j < w; ++j) {
        ans = max(ans, d[i][j]);
      }
    }
    cout << ans << endl;
  }
};
}  // namespace Problem

int main() {
  std::cin.tie(0);
  std::ios_base::sync_with_stdio(false);
  // std::cout << std::fixed << std::setprecision(12);
  long long n = 0, m;
  std::cin >> n >> m;

  Problem::Solver2 sol(n, m);
  sol.solve();
  return 0;
}


Measured memory_bytes: 13456
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        
        int n = scanner.nextInt();
        int m = scanner.nextInt();
        int l = scanner.nextInt();
        
        int[][] A = new int[n][m];
        int[][] B = new int[m][l];
        long[][] C = new long[n][l];
        
        for(int i=0;i<n;i++){
            for(int j=0;j<m;j++){
                A[i][j] = scanner.nextInt();
            }
        }
        
        for(int j=0;j<m;j++){
            for(int k=0;k<l;k++){
                B[j][k] = scanner.nextInt();
            }
        }
        
        for(int i=0; i<n; i++){
            for(int j=0; j<l; j++){
                for(int k=0; k<m; k++){
                    C[i][j] = C[i][j]  + (A[i][k] * B[k][j]);
                }
            }
        }
        
        for(int i=0;i<n;i++){
            for (int j=0;j<l;j++) {
                if(j != l-1){
                    System.out.print(String.valueOf(C[i][j]) + " ");
                } else {
                    System.out.println(C[i][j]);
                }
            }
        }
    }
}


Measured memory_bytes: 54456
#include <stdio.h>
//#include <stdlib.h>
//#include <string.h>
//#include <stdbool.h>
//#include <limits.h>
//#include <math.h>

#define Min(a, b) (a < b ? a : b)

int main() {
  int h, w;
  scanf("%d%d", &h, &w);
  int c[10][10], a[h][w];
  for (int i=0; i<10; i++)
    for (int j=0; j<10; j++)
      scanf("%d", c[i]+j);
  for (int i=0; i<h; i++)
    for (int j=0; j<w; j++)
      scanf("%d", a[i]+j);
  int cost[10];
  for (int i=0; i<10; i++)
    cost[i] = c[i][1];
  for (int i=0; i<15; i++) {
    for (int j=0; j<10; j++) {
      for (int k=0; k<10; k++) {
        cost[j] = Min(cost[j], cost[k]+c[j][k]);
      }
    }
  }
  int ans = 0;
  for (int i=0; i<h; i++) {
    for (int j=0; j<w; j++) {
      if (a[i][j] == -1)
        continue;
      else
        ans += cost[a[i][j]];
    }
  }
  printf("%d\n", ans);
  return 0;
}


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

#define int long long
#define fast_io(); ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define loop(i,a,b) for(int i=a;i<b;i++)
#define all(x) x.begin(),x.end()
#define us unordered_set
#define um unordered_map
#define ms multiset
#define mm multimap
#define pb push_back
#define pf push_front
#define ins insert
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define _max max_element
#define _min min_element
#define tc(T) int T; cin>>T; while(T--)
#define q(q) int q; cin>>q; while(q--)
#define pi 3.1415926535897932384626433832
const int pinf=((int)2e18);
const int ninf=((int)-2e18);
const int mod=1000000007;

using namespace std;

int power(int x,int n,int M)
{
    if(n==0)
        return 1;
    else if(n%2 == 0)
        return power((x*x)%M,n/2,M);
    else
        return (x*power((x*x)%M,(n-1)/2,M))%M;
}

bool vowel(char c)
{
    return(c=='a' or c=='e' or c=='i' or c=='o' or c=='u' or c=='A' or c=='E' or c=='I' or c=='U' or c=='O');
}

int32_t main()
{
    fast_io();

    //FILE *fptr1=freopen("in.txt","r",stdin);
    //FILE *fptr2=freopen("out.txt","w",stdout);

    int a,b;
    cin>>a>>b;
    if(a>9 or b>9)
    {
        cout<< "-1";
    }
    else
    {
        int ans=a*b;
        cout<<ans;
    }


    return 0;
}


Measured memory_bytes: 3624
#include <iostream>
#include <algorithm>
#include <queue>

using namespace std;

using ll = long long;

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

const int MOD = (int) 1e9 + 7;

int main(void) {
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	
	int N;
	cin >> N;
	ll a[3 * N + 1];
	FOR(i, 1, 3 * N + 1) cin >> a[i];
	
	
	// 前半の最大値を求める
	priority_queue<ll, vector<ll>, greater<int>> firsthalf;
	FOR(i, 1, N + 1) firsthalf.push(a[i]);
	
	ll firsthalfsumlist[N + 1];
	REP(i, N + 1) firsthalfsumlist[i] = 0;
	int k = 0;
	ll firsthalfsum = 0;
	FOR(i, 1, N + 1) {
		firsthalfsum += a[i];
	}
	firsthalfsumlist[k++] = firsthalfsum;
	
	FOR(i, N + 1, 2 * N + 1) {
		firsthalf.push(a[i]);
		firsthalfsum = firsthalfsum + a[i] - firsthalf.top();
		firsthalfsumlist[k++] = firsthalfsum;
		firsthalf.pop();
	}

//	REP(i, N + 1) cout << firsthalfsumlist[i] << endl;
	
	
	// 後半の最大値を求める
	priority_queue<ll> latterhalf;
	FOR(i, 2 * N + 1, 3 * N + 1) latterhalf.push(a[i]);
	
	ll latterhalfsumlist[N + 1];
	REP(i, N + 1) latterhalfsumlist[i] = 0;
	k = 0;
	ll latterhalfsum = 0;
	FOR(i, 2 * N + 1, 3 * N + 1) {
		latterhalfsum += a[i];
	}
	latterhalfsumlist[k++] = latterhalfsum;
	
	for (int i = 2 * N; i >= N; --i) {
		latterhalf.push(a[i]);
		latterhalfsum = latterhalfsum + a[i] - latterhalf.top();
		latterhalfsumlist[k++] = latterhalfsum;
		latterhalf.pop();
	}

//	REP(i, N + 1) cout << latterhalfsumlist[i] << endl;
	
	
	// 答えを求める
	ll ans = -1e15;
	REP(i, N + 1) {
		ans = max(ans, firsthalfsumlist[i] - latterhalfsumlist[N - i]);
//		cout << firsthalfsumlist[i] - latterhalfsumlist[N - i] << " " << ans << endl;
	}
	
	
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 5876
import java.util.Scanner;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    long k=sc.nextLong(),a=sc.nextLong(),b=sc.nextLong();
    if((b-a)<=2 || k==1) {
    	System.out.println(k+1);
    }else {
    	long flag=(k-a+1)/2;
    	if(flag>0)System.out.println(a+flag*(b-a)+((k-a+1)%2));
    	else System.out.println(k+1);
    }
  }
}


Measured memory_bytes: 22868
#include <bits/stdc++.h>
#define int long
#define ll long long
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
int gcd(int a,int b){return b ? gcd(b,a%b) : a;}
int lcm(int a,int b){return a/gcd(a,b)*b;}

main() {
    int N; cin >> N;
    vector<int> A(N),B(N),C(N),D(N),E(N),F(N+1);
    rep(i,N) cin >> A[i];
    rep(i,N) cin >> B[i];
    rep(i,N) cin >> C[i];
    sort(A.begin(),A.end());
    sort(B.begin(),B.end());
    sort(C.begin(),C.end());
    rep(i,N){
        D[i]=B.end()-upper_bound(B.begin(),B.end(),A[i]);
        E[i]=C.end()-upper_bound(C.begin(),C.end(),B[i]);
    }
    rep(i,N+1){
        if(i==0) F[0]=0;
        else F[i]=F[i-1]+E[N-i];
    }
    ll ans=0;
    rep(i,N){
        ans+=F[D[i]];
    }
    cout << ans << endl;

    return 0;
}


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

int syc(long i,long Min,long Max){
	if(Min <= i && i <= Max){
		return 1;
	}else{
		exit(1);
		//return 0;
	}
}

int main(){
	
	int a,b;
	
	cin >> a;
	syc(a,1,100000);
	
	cin >> b;
	syc(b,1,500);
	
	int c[a];
	
	for(int i=0;i<a;i++){
		cin >> c[i];
		syc(c[i],1,500);
	}
	
	int count = 0;
			
	for(int i=0;i<a;i++){
		//cout << i << endl;
		if(b<=c[i]){
			count++;	
		}
	}
	
	cout << count << endl;
	
	return 0;
}


Measured memory_bytes: 640
a, b, c, d = map(int, input().strip().split())


def func(a_sec, b_sec, c_sec, d_sec):
    if a_sec < c_sec <= b_sec < d_sec:
        temp = b_sec - c_sec
    elif c_sec < a_sec <= d_sec < b_sec:
        temp = d_sec - a_sec
    elif a_sec <= c_sec < d_sec <= b_sec:
        temp = d_sec - c_sec
    elif c_sec <= a_sec < b_sec <= d_sec:
        temp = b_sec - a_sec
    else:
        temp = 0

    print(temp)


func(a_sec=a, b_sec=b, c_sec=c, d_sec=d)


Measured memory_bytes: 3060
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ld long double
#define al(a) (a).begin(),(a).end()
#define mk make_pair
#define check cout<<"?"<<endl;

ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;

int find_(int x,vector<int> &v){
    if(v[x]<0) return x;
    v[x]=find_(v[x],v);
    return v[x];
}

int same_(int a,int b,vector<int> &v){
    if(find_(a,v)==find_(b,v)) return 1;
    return 0;
}

void union_(int a,int b,vector<int> &v){
    if(same_(a,b,v)) return;
    int a_p=find_(a,v),b_p=find_(b,v);
    if(a_p>b_p) swap(a_p,b_p);
    v[a_p]+=v[b_p]; v[b_p]=a_p;
}

void print_v(vector<int> v){
    rep(i,v.size()) cout<<v[i]<<" ";
    cout<<endl;
}

int size_(int a,vector<int> &v){
    return -v[find_(a,v)];
}

int main(){
    set<char> q;
    rep(i,3){
        char ch; cin>>ch;
        q.insert(ch);
    }
    cout<<(q.size()==2 ? "Yes" : "No")<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fast ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
const ll maxn=1e6+100;
const ll mod=1e9+7;
//ll fact[maxn];

int main()
{
	fast;
	ll k,i,j;
	cin>>k;
	queue<ll> q;
	for(i=1;i<=9;i++)
		q.push(i);
	
	ll x;
	for(i=1;i<=k;i++)
	{
		x=q.front();
		q.pop();
		if(x%10!=0)
			q.push(10*x+(x%10)-1);
		q.push(10*x+(x%10));
		if(x%10!=9)
				q.push(10*x+(x%10)+1);
	}
	cout<<x<<endl;
}

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

#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
tree<pair<int,int>,null_type,less<pair<int,int>>,splay_tree_tag,tree_order_statistics_node_update>tr;

int a[200000];
int main(){
	int n;scanf("%d",&n);
	rep(i,n){
		scanf("%d",&a[i]);
		tr.insert(P(a[i],i));
	}
	rep(i,n){
		tr.erase(P(a[i],i));
		printf("%d\n",tr.find_by_order((n-1)/2)->first);
		tr.insert(P(a[i],i));
	}
}

Measured memory_bytes: 16512
use std::str::FromStr;

fn get_one<T : FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    return s.trim().parse().ok().unwrap();
}

fn get_vec<T : FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    return s.trim().split_whitespace().map(|e| e.parse().ok().unwrap()).collect();
}

fn main() {
    let nm : Vec<i32> = get_vec();
    let n = nm[0];
    let m = nm[1];
    println!("{}", 2_i32.pow(m as u32) * (1900 * m + 100 * (n-m)));
}


Measured memory_bytes: 4352