akhauriyash/Code-Regression huggingface dataset:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

/**
 * Yuekis' Audio Room
 */
public class Main {

	public static int R = 100;
	public static int T = 30;

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line;

		br.readLine(); //skip first line.

		while ((line = br.readLine()) != null && !line.isEmpty()) {

			int r = Integer.parseInt(line.substring(0, line.indexOf(' ')));
			int t = Integer.parseInt(line.substring(line.indexOf(' ') + 1));

			int[] _r = new int[2];
			int[] _t = new int[2];

			if (r % R == 0) {
				_r[0] = r / R;
			} else {
				_r[0] = r / R;
				_r[1] = r / R + 1;
			}

			if (t % T == 0) {
				_t[0] = t / T * 5;
			} else {
				_t[0] = t / T * 5;
				_t[1] = (t / T + 1) * 5;
			}

			int[] _rt = new int[4];
			_rt[0] = _r[0] + _t[0];
			_rt[1] = _t[1] > 0 ? _r[0] + _t[1] : 0;
			_rt[2] = _r[1] > 0 ? _r[1] + _t[0] : 0;
			_rt[3] = _r[1] > 0 && _t[1] > 0 ? _r[1] + _t[1] : 0;

			Arrays.sort(_rt);
			for (int i = 0; i < 4; i++) {
				if (_rt[i] > 0) {
					if (i > 0 && _rt[i - 1] > 0) {
						System.out.print(" ");
					}
					System.out.print(_rt[i]);
				}
			}
			System.out.println();

		} // end while
	} // end main
}

Measured memory_bytes: 24260
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define MOD 1000000007
#define fo(i,s,e) for( i=s;i<e;i++)
#define rfo(i,s,e) for(i=s;i>e;i--)
#define LLI long long int
#define LI long int 
#define pb push_back
#define pob pop_back()
#define sp " "
#define ff first
#define ss second
//               When something is important enough, you do it even if the odds are not in your favor.
LLI dp[100004];
const LLI inf=1e18;
int main(){   
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    /*#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif*/
    // code goes here
    int t=1;//cin>>t;
    while(t--){
      LI n,w,i,j;cin>>n>>w;
      std::vector<pair<LI,LI> > v(n);
      for(auto &x:v) cin>>x.ss>>x.ff;  //   x.ff is value ,other one is weight
      sort(v.begin(), v.end());
      fo(i,0,100004) dp[i]=inf;
      dp[0]=0;
      fo(i,0,n){
        rfo(j,100000,-1){  //  possible values 
          if(j<v[i].ff) break;
          dp[j]=min(dp[j],dp[j-v[i].ff]+v[i].ss);
        }
      }
      LI ans;
      fo(i,0,100004){
        if(dp[i]<=w&&dp[i]!=0) ans=i;
      }
      cout<<ans;
    }
    return 0;
}

Measured memory_bytes: 1152
#include<bits/stdc++.h>
#include <stdio.h>
#include <algorithm>

#define all(x) x.begin(),x.end()
#define sc(x) scanf("%d",&x)
#define scl(x) scanf("%lld",&x)
#define pr(x) printf("%d",x)
#define prl(x) printf("%lld",x)
#define LL long long
#define pb push_back
#define PB pop_back
#define PF pop_front
#define F first
#define S second
#define inrow(vec)    for(int i=0;i<vec.size();i++)cout<<vec[i]<<" ";
#define incoloum(vec) for(int i=0;i<vec.size();i++)cout<<vec[i]<<endl;

const double PI=3.1415926;
const int KL=1e6;

using namespace std;

LL q,x,y,z,n,m,p[KL],mn=1e9,mx=-1e9,ans;
string t;
vector <LL> vec;
set <int> s;
map <int,int> M;


int main()
{
    scl(n);
    x=n/500;
    n-=x*500;
    cout<<x*1000+(n/5)*5<<endl;
    return 0;
}


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

int main()
{
    string in;

    while( cin >> in )
    {
        for( int i = 0; i < in.size(); i++ )
        {
            if( in[i] == '@' )
            {
                int n = in[i+1] - '0';              //char→int型
                for( int j = 0; j < n; j++ )
                    cout << in[i+2];
                i += 2;
            }
            else
                cout << in[i];
        }
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 3140
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int,int> pint;
typedef vector<pint> vpint;
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=n-1;i>=(0);i--)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#define all(v) (v).begin(),(v).end()
#define eall(v) unique(all(v), v.end())
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
const int MOD = 1e9 + 7;
const int INF = 1e9;
const ll INFF = 1e18;

int n;
ll a[100010];
ll b[100010];
int main(void){
	cin >> n;
	rep(i, n) cin >> a[i];
	
	//rep(i, n - 1) b[i] = a[i + 1] - a[i];
	/*
	int cnt = 0;
	rep(i, n - 1){
		if((b[i] > 0 && b[i + 1] < 0) || (b[i] < 0 && b[i + 1] > 0)){
			cnt++;
			i++;
		}else if(i >= 1){
			if((a[i - 1] < 0 && a[i] == 0 && a[i + 1] > 0) || 
				(a[i - 1] > 0 && a[i] == 0 && a[i + 1] < 0)){
				cnt++;
				i++;
			}
		}
	}
	*/
	
	int cnt = 0;
	bool zou = true, gen = true;
	if(a[n -  2] <= a[n - 1]) a[n] = INFF;
	else a[n] = -1;
	rep(i, n){
		if(zou && gen){
			// printf("1\n");
			if(a[i] < a[i + 1]) gen = false;
			else if(a[i] > a[i + 1]) zou = false;
		}else if(zou){
			// printf("2\n");
			if(a[i] > a[i + 1]){
				cnt++;
				// printf("%d\n", i);
				zou = gen = true;
			}else{
				zou = true;
			}
		}else if(gen){
			// printf("3\n");
			if(a[i] < a[i + 1]){
				cnt++;
				// printf("cnt");
				zou = gen = true;
			}else{
				gen = true;
			}
		}
	}

	/*
	int cnt1 = 0;
	for (int i = n - 1; i >= 0 ; --i){
		if(zou && gen){
			if(a[i] < a[i + 1]) gen = false;
			else if(a[i] > a[i + 1]) zou = false;
		}else if(zou){
			if(a[i] > a[i + 1]){
				cnt++;
				// printf("%d\n", i);
				zou = gen = true;
			}
		}else if(gen){
			if(a[i] < a[i + 1]){
				cnt++;
				// printf("%d\n", if);
				zou = gen = true;
			}
		}
	}
	*/
	printf("%d\n", cnt + 1);
	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i, a) for (ll i = 0; i < (a); ++i)
#define pb push_back
#define all(v) v.begin(),v.end()
#define sort_1(v) sort(v.begin(),v.end())
#define sort_2(v) sort(v.begin(),v.end(),greater<ll>())
#define reverse(v) reverse(v.begin(),v.end())
typedef long long ll;
typedef long double la;
using namespace std;

char s[101][101];
int a[101][101];
int cnt = 0;

void dfs(int y, int x){
    
}

int main(){
    int h,w;
    cin >> h >> w;
    for(int i = 1; i <= h; i++){
        for(int j = 1; j <= w; j++){
            char c;
            cin >> c;
            if(c == '.'){
                a[i][j] = 0;
            }else{
                a[i][j] = 1;
            }
        }
    }
    int dp[h+1][w+1];
    dp[1][1] = a[1][1];
    for(int i = 1; i <= h; i++){
        for(int j = 1; j <= w; j++){
            if(i == 1 && j == 1) continue;
            if(i == 1) dp[i][j] = dp[i][j-1] + (a[i][j-1]?0:a[i][j]);
            else if(j == 1) dp[i][j] = dp[i-1][j] + (a[i-1][j]?0:a[i][j]);
            else dp[i][j] = min(dp[i-1][j] + (a[i-1][j]?0:a[i][j]) ,dp[i][j-1] + (a[i][j-1]?0:a[i][j]));
        }
    }
    cout << dp[h][w] << endl;
}

Measured memory_bytes: 384
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<string>
#include<iostream>
using namespace std;
int main()
{
	string s;
	cin >> s;
	int t = 0;
	int f = 0;
	for (int i = 0; i < s.size(); i++)
	{
		if (f == 2)t++, f = 0;
		else if (f == 0)t++, f = 1;
		else if (f == 1 && s[i] != s[i - 1])t++;
		else f = 2;
	}
	printf("%d\n", t);
}

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

int main()
{
  string str="";
  cin>>str;
  
  if(str=="ABC")
  {
    cout<<"ARC"<<endl;
  }
  else if(str=="ARC")
  {
    cout<<"ABC"<<endl;
  }
  
  return 0;
}


Measured memory_bytes: 3036
#include<cstdio>
#include<cstring>
#include<vector>
#include<functional>
#include<algorithm>
using namespace std;
struct tree
{
	int addv[600000],setv[600000],minv[600000],n;
	tree(int size):addv{0},setv{0},minv{0},n(size){}
	void pushdown(int v)
	{
		addv[v*2]+=addv[v];
		addv[v*2+1]+=addv[v];
		addv[v]=0;
	}
	void maintain(int v,int l,int r)
	{
		if(l<r)minv[v]=min(minv[v*2],minv[v*2+1]);
		if(l==r)minv[v]=setv[v];
		if(addv[v])minv[v]+=addv[v];
	}
	void update(int v,int l,int r,int L,int R,int x,int op)
	{
		int lc=v*2,rc=v*2+1;
		if(L<=l&&r<=R)
			if(op==1)addv[v]+=x;
			else setv[v]=x,addv[v]=0;
		else
		{
			pushdown(v);
			int m=(l+r)/2;
			if(L<=m)update(lc,l,m,L,R,x,op);
			else maintain(lc,l,m);
			if(m<R)update(rc,m+1,r,L,R,x,op);
			else maintain(rc,m+1,r);
		}
		maintain(v,l,r);
	}
	void set(int p,int x){update(1,0,n,p,p,x,2);}
	void add(int l,int r,int x){update(1,0,n,l,r,x,1);}
	int query(int v,int l,int r,int add,int L,int R)
	{
		if(l==r)return setv[v]+addv[v]+add;
		if(L<=l&&r<=R)return minv[v]+add;
		int m=(l+r)/2,lc=v*2,rc=v*2+1,ans=1<<29;
		if(L<=m)ans=min(ans,query(lc,l,m,add+addv[v],L,R));
		if(m<R)ans=min(ans,query(rc,m+1,r,add+addv[v],L,R));
		return ans;
	}
	int get(int l,int r){return query(1,0,n,0,l,r);}
};
vector<int> v[300000];
int f[300000],b[300000],n,q;
int main()
{
	scanf("%d",&n);
	int cnt=0;
	for(int i=1;i<=n;i++)scanf("%d",b+i),cnt+=!b[i],b[i]=b[i]?1:-1;
	scanf("%d",&q);
	for(int i=1;i<=q;i++)
	{
		int l,r;
		scanf("%d%d",&l,&r);
		v[l].push_back(r);
	}
	tree t(n);
	for(int i=1;i<=n;i++)t.set(i,1<<28);
	for(int i=1;i<=n;i++)
	{
		for(int j:v[i])t.set(j,t.get(i-1,j));
		t.set(i,min(t.get(i,i),t.get(i-1,i-1)+b[i]));
	}
	printf("%d\n",cnt+t.get(n,n));
	return 0;
}


Measured memory_bytes: 20992
sx, sy, tx, ty = map(int, input().split())
R = 'U' * (ty - sy) + 'R' * (tx - sx) + 'D' * (ty - sy) + 'L' * (tx - sx)
R = R[:] + 'L'
R = R[:] + 'U' * (ty - sy + 1) + 'R' * (tx - sx + 1)
R = R[:] + 'D' + 'R'
R = R[:] + 'D' * (ty - sy + 1) + 'L' * (tx - sx + 1)
R = R[:] + 'U'
print(R)

Measured memory_bytes: 3060
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cassert>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
#include <list>
#include <limits>
#include <numeric>
#include <utility>
#include <deque>
#include <valarray>
#include <unordered_set>
#include <unordered_map>
#include <regex>
#include <array>
#include <bitset>
#include <complex>
#include <string>
#include <tuple>

using namespace std;
using ll = long long;
const int INF = 1e9;
const ll MOD = 1e9 + 7;

int main()
{
  int n;
  cin >> n;
  vector<string> s(n);
  for (auto &e : s)
    cin >> e;

  int cnt = 0, a = 0, b = 0, ab = 0;
  for (int i = 0; i < n; ++i)
  {
    for (int j = 0; j < s[i].size() - 1; ++j)
    {
      if (s[i][j] == 'A' && s[i][j + 1] == 'B')
        cnt++;
    }
    if (s[i][0] == 'B' && s[i][s[i].size() - 1] == 'A')
      ab++;
    if (s[i][0] != 'B' && s[i][s[i].size() - 1] == 'A')
      a++;
    if (s[i][0] == 'B' && s[i][s[i].size() - 1] != 'A')
      b++;
  }

  if (ab == 0)
    cnt += min(a, b);
  else
  {
    if (a + b == 0)
      cnt += ab - 1;
    else
      cnt += ab + min(a, b);
  }

  cout << cnt << endl;

  return 0;
}


Measured memory_bytes: 768
import java.io.*;
import java.util.*;


public class Main {

	private static Scanner sc;
	private static Printer pr;

	private static void solve() {
		int n = sc.nextInt();

		int s = 0;
		int tmp = n;
		while (tmp > 0) {
			s += tmp % 10;
			tmp /= 10;
		}

		if (n % s == 0) {
			pr.println("Yes");
		} else {
			pr.println("No");
		}
	}

	// ---------------------------------------------------
	public static void main(String[] args) {
		sc = new Scanner(INPUT == null ? System.in : new ByteArrayInputStream(INPUT.getBytes()));
		pr = new Printer(System.out);

		solve();

//		pr.close();
		pr.flush();
//		sc.close();
	}

	static String INPUT = null;

	private static class Printer extends PrintWriter {
		Printer(OutputStream out) {
			super(out);
		}
	}
}


Measured memory_bytes: 23504
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int n,a,b;
void prin(int a,int b,int v)
{
	if(a==b)
	{
		printf("%d ",a);
		return;
	}
	int x=(a^b)&(-(a^b));
	v^=x;
	int y=v&(-v);
	prin(a,a^y,v);
	prin(a^y^x,b,v);
}
int main()
{
	scanf("%d%d%d",&n,&a,&b);
	if(__builtin_popcount(a^b)&1)
	{
		puts("YES");
		prin(a,b,(1<<n)-1);
	}
	else
		puts("NO");
	return 0;
}

Measured memory_bytes: 1024
//{
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double lf;
typedef pair<ll,ll> ii;
#define REP(i,n) for(ll i=0;i<n;i++)
#define REP1(i,n) for(ll i=1;i<=n;i++)
#define FILL(i,n) memset(i,n,sizeof i)
#define X first
#define Y second
#define SZ(_a) (int)_a.size()
#define ALL(_a) _a.begin(),_a.end()
#define pb push_back
#ifdef brian
#define debug(...) do{\
    fprintf(stderr,"%s - %d (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
    _do(__VA_ARGS__);\
}while(0)
template<typename T>void _do(T &&_x){cerr<<_x<<endl;}
template<typename T,typename ...S> void _do(T &&_x,S &&..._t){cerr<<_x<<" ,";_do(_t...);}
template<typename _a,typename _b> ostream& operator << (ostream &_s,const pair<_a,_b> &_p){return _s<<"("<<_p.X<<","<<_p.Y<<")";}
template<typename It> ostream& _OUTC(ostream &_s,It _ita,It _itb)
{
    _s<<"{";
    for(It _it=_ita;_it!=_itb;_it++)
    {
        _s<<(_it==_ita?"":",")<<*_it;
    }
    _s<<"}";
    return _s;
}
template<typename _a> ostream &operator << (ostream &_s,vector<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,set<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a,typename _b> ostream &operator << (ostream &_s,map<_a,_b> &_c){return _OUTC(_s,ALL(_c));}
template<typename _t> void pary(_t _a,_t _b){_OUTC(cerr,_a,_b);cerr<<endl;}
#define IOS()
#else
#define debug(...)
#define pary(...)
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0);
#endif // brian
//}


const ll MAXn=1e5+5,MAXlg=__lg(MAXn)+2;
const ll MOD=1000000007;
const ll INF=ll(1e15);

map<ll,ll> mp[2];
vector<ii> dt[2];

int main()
{
    IOS();
    ll n;
    cin>>n;
    REP(i,n)
    {
      ll x;
      cin>>x;
      mp[i&1][x]++;
    }
    for(auto tmp:mp[0])dt[0].pb(ii(tmp.Y,tmp.X));
    for(auto tmp:mp[1])dt[1].pb(ii(tmp.Y,tmp.X));
    dt[0].pb(ii(0,-1));
    dt[1].pb(ii(0,-1));
    sort(ALL(dt[0]),greater<ii>());
    sort(ALL(dt[1]),greater<ii>());
    if(dt[0][0].Y != dt[1][0].Y)cout<<n - dt[0][0].X - dt[1][0].X<<endl;
    else cout<<min(n - dt[0][0].X - dt[1][1].X,n - dt[0][1].X - dt[1][0].X)<<endl;
}


Measured memory_bytes: 8824
#include <stdio.h>

int main(){
  int K,A,B;
  scanf("%d %d %d",&K,&A,&B);
  
  int L=A;
  int sw=0;
  while(L<=B){
    
    if(L%K==0){
      sw=1;
    }
   
  L=L+1;  
  }
  
  if(sw==1){
    printf("OK\n");
  }else{
    printf("NG\n");
  }
  return 0;
}

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

const int MOD=1000000007;
const int INF=0x3f3f3f3f;
const ll INFL=0x3f3f3f3f3f3f3f3f;

int a[200000];


int main(){
	ll n,m,v,p;cin>>n>>m>>v>>p;
	rep(i,n)scanf("%d",&a[i]);
	int cnt=0;
	sort(a,a+n,greater<>());
	ll sum=0;
	ll sum2=0;
	int s=-1;
	int cnt2=0;
	rep(i,n){
		if(i<p-1){
			cnt++;
			sum2+=m;
			continue;
		}
		ll me=a[i]+m;
		while(s+1<i&&a[s+1]>me){
			s++;
		}
		if(s>=p-1)break;
		sum+=a[i];
		cnt2++;
		if(sum2+me*cnt2-sum+m*(n-i-1)>=v*m){
			cnt++;
		}
	}
	cout<<cnt<<endl;
}

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

// マクロ
// forループ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(ll)(b);i--)
// xにはvectorなどのコンテナ
#define ALL(x) (x)begin(),(x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
// 出力
#define PRINT(x) cout<<(x)<<endl
#define PRINTA(x,n) REP(i,n)PRINT(x[i])
// 定数
#define INF 1000000000000 // 10^12
#define MOD 1000000007 // 10^9+7
// 略記
#define PB push_back
#define MP make_pair

const int MAX_M = 10, MAX_K = 10;

int N, M, k[MAX_M], s[MAX_M][MAX_K], p[MAX_M];

int on_switch[MAX_M];

int main() {

    cin >> N >> M;
    REP(i, M) {
        cin >> k[i];
        REP(j, k[i]) {
            cin >> s[i][j];
            s[i][j]--;
        }
    }
    REP(i, M) cin >> p[i];

    int ans = 0;
    REP(bit, 1<<N) {
        REP(i, MAX_M) on_switch[i] = 0;
        REP(i, M) {
            REP(j, k[i]) {
                if (bit & 1<<s[i][j]) on_switch[i]++;
            }
        }
        bool all_on = true;
        REP(i, M) {
            if (on_switch[i] % 2 != p[i]) all_on = false;
        }
        if (all_on) ans++;
    }
    PRINT(ans);
    return 0;
}

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

f_vals = []
for i in range(N):
    f_vals.append([int(_) for _ in input().split()])
p_vals = []
for i in range(N):
    p_vals.append([int(_) for _ in input().split()])


def solve():
    ans = -1e12
    for i in range(1, 2 ** 10):
        sumv = 0
        for l in range(N):
            fcnt = 0
            for j in range(10):
                fcnt += ((i >> j) & 1) and f_vals[l][j]
            sumv += p_vals[l][fcnt]

        ans = max(ans, sumv)
    print(ans)


solve()

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<ll, pair<ll, ll> > P3;
const ll MOD = 1000000007;
const int IINF = INT_MAX;
const ll LLINF = LLONG_MAX;
const int MAX_N = int(1e5 + 5);
const double EPS = 1e-10;
const int di[] = {0, 1, 0, -1}, dj[] = {1, 0, -1, 0};
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define SORT(v) sort((v).begin(), (v).end())
#define ALL(v) (v).begin(), (v).end()

int main() {
    ll h, w, K, dp[105][10]{};
    cin >> h >> w >> K;
    dp[0][0] = 1;
    REP(i,h){
        REP(j,int(pow(2,w-1))){
            bool ok = true;
            REP(k,w-1){
                if((j>>k)&(j>>(k+1))&1) ok = false;
            }
            if(!ok)continue;
            REP(k,w){
                if(k>0 && (j>>(k-1))&1) dp[i+1][k] += dp[i][k-1];
                else if(k<w-1 && (j>>k)&1) dp[i+1][k] += dp[i][k+1];
                else dp[i+1][k] += dp[i][k];
                dp[i+1][k] %= MOD;
            }
        }
    }
    cout << dp[h][K-1] << endl;
    return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import sys
import math
import os
import itertools

class cin():
    def int():
        return int(sys.stdin.readline().rstrip())
    def string():
        return sys.stdin.readline().rstrip()
    def mapInt():
        return [int(x) for x in cin.string().split()]
    def stringList(n):
        return [input() for i in range(n)]
    def intListList(n):
        return [cin.mapInt() for i in range(n)]

class Util():
    def roundUp(a,b):
        return -(-a // b)
    def toUpperMultiple(a,x):
        return Util.round_up(a,x) * x
    def toLowerMultiple(a,x):
        return (a // x) * x

D,G = cin.mapInt()
P = cin.intListList(D)

ans = int(1e09)
for i in range(1 << D):
    point = 0
    cnt = 0
    for j in range(D):
        if i >> j & 1:
            cnt += P[j][0]
            point += P[j][0] * (j + 1) * 100 + P[j][1]
    if point >= G:
        ans = min(ans,cnt)
        continue
    for j in reversed(range(D)):
        if not i >> j & 1:
            p = (j + 1) * 100
            c = min(P[j][0],Util.roundUp(G - point,p))
            cnt += c
            point += c * p
            if point >= G:
               break
    ans = min(ans,cnt)

print(ans)


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

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

#define For(i, a, b) for(int i = (a); i < (b); i++)
#define Rep(i, n) For(i, 0, (n))
#define Rrep(i, n) for(int i = (n - 1); i >= 0; i--)
#define pb push_back

const int inf = 999999999;
const int mod = 1000000007;

int main(){
	int n; cin >> n; int ans = 0;
	Rep(i, n){
		int t; cin >> t;
		ans += t-1;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <random>
#include <string>
#include <cmath>
#include <sstream>
#include <istream>
#include <iomanip>
#include <typeinfo>
#include <stack>

using namespace std;
typedef long long ll;


vector<vector<pair<ll, ll > > > G;
//行きがけ順番を記憶（どんな順番で走査されたかを記憶）
vector<ll > pre;
//頂点から到達しうる最小の頂点
vector<ll > low;
//到達済みの頂点か
vector<bool > reach;
vector<pair<ll, ll > > ans;
//カウンター
void dfs(ll idx, ll from = -1, ll pre_count = -1){
    reach[idx] = true;
    pre[idx] = pre_count++;
    low[idx] = pre[idx];


    for(ll i = 0; i < G[idx].size(); i++){
        //cout << idx << endl;
        //次の行き先は？
        ll to = G[idx][i].first;
        //未探査のとき
        if(pre[to] == -1){
            //dfsを実行する
            //到達できる頂点の中で一番小さいpreを採用する
            dfs(to, idx, pre_count);
            low[idx] = min(low[idx], low[to]);
            //dfs(to, idx, pre_count);
            //low[idx] = min(low[idx], low[to]);
            if(pre[idx] < low[to]){
                ans.push_back(make_pair(idx, to));
            }
        }else if(to != from){

            low[idx] = min(low[idx], low[to]);
        }
 
    }

    //return low[idx];
}


int main(){
    ll N, M;
    cin >> N >> M;
    
    //初期化
    G.assign(N, vector<pair<ll, ll > >());
    //ns.assign(N, 0);
    pre.assign(N, -1);
    low.assign(N, -1);
    reach.assign(N, false);
 
    //グラフ入力
    for(ll i = 0; i < M; i++){
        ll u, v;
        //重みは今回は0
        ll w = 0;
        cin >> u >> v;
        u--;
        v--;
        //双方向に貼りましょうね
        G[u].push_back(make_pair(v, w));
        G[v].push_back(make_pair(u, w));
    }

    for(ll i = 0; i < N; i++){
        if(!reach[i])dfs(i);
    }
    
    cout << ans.size()<< endl;
    
    /*
    for(ll i = 0; i < ans.size(); i++){
        cout << ans[i].first << "," << ans[i].second << 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 = sc.nextInt();
	int b = sc.nextInt();
	if((b-a)%2 == 0) {
		System.out.println("Alice");
	} else {
		System.out.println("Borys");
	}
}
}


Measured memory_bytes: 22868
#include <bits/stdc++.h>
using namespace std;
using int64 = long long;
#define int int64
#define rep(i, n) for(int i=0; i<n; i++)
#define FOR(i, a, b) for(int i=a; i<b; i++)
#define SORT(x) sort(x.begin(), x.end())
#define GSORT(x) sort(x.begin(), x.end(), greater<int>())
#define mk make_pair
#define fi first
#define se second
#define pb push_back
#define ALL(x) x.begin(), x.end()
#define V(T) vector<T>
typedef pair<int, int> P;
typedef pair<P, P> PP;
typedef vector<int> vi;
typedef vector<vi> vvi;
int max(int a, int b) {if(b>a) return b; else return a;}
int min(int a, int b) {if(b<a) return b; else return a;}


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

    V(bool) ex(100050, false);
    int cnt = 0;
    rep(i, N) {
        int A;
        cin >> A;
        if(ex[A]) cnt++;
        else ex[A] = true;
    }

    cout << (N-cnt) - cnt%2 << endl;
    
    
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <vector>
#include <functional>
#include <cstdlib>
#include <map>
#include <set>
#include <iostream>
#include <string>
#include <ctype.h>
#include <climits>
#include <queue>
using namespace std;
#define REP(i, n) for(ll i = 0; i < (ll)(n); i++)
typedef long long ll;

int main(){
	
	int n;
	cin >> n;
	vector<int> a(n);
	REP(i,n) cin >> a[i];
	
	int ans=0;
	REP(i,n){
		if((i+1)%2==1 && a[i]%2==1) ans++;
	}
	
	cout << ans << endl;
	
	
	return 0;
}

Measured memory_bytes: 3588
import math

N ,M, K = map(int,input().split())
MOD = 998244353

def getInvs(n, MOD):
    invs = [1] * (n+1)
    for x in range(2, n+1):
        invs[x] = (-(MOD//x) * invs[MOD%x]) % MOD
    return invs
invs = getInvs(N+3, MOD)

num = M
nums = []
for i in reversed(range(1,N)):
    nums.append(num)
    num *= i*(M-1)
    num *= invs[N-i]
    num %= MOD
nums.append(num)
nums.reverse()

ans = sum(nums[:K+1])
ans %= MOD
print(ans)


Measured memory_bytes: 26240
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <functional>

using namespace std;

struct cell{
  long long A;
  long long B;
};

bool operator<(const cell& left, const cell& right)
{
  return left.A < right.A ;
}

bool operator>(const cell& left, const cell& right)
{
  return left.A > right.A ;
}

int main() {
	// your code goes here
	long long N, M;
  	std::vector<struct cell> data;
  
    long long EDcount = 0;
    long long EDmoney = 0;
    
    unsigned int temp = 0;
    
	temp = scanf("%lld %lld",&N, &M);
    for(long long i = 0; i < N; i++){
        struct cell a;
        temp = scanf("%lld %lld",&a.A,&a.B);
        data.push_back(a);
    }
  
    std::sort(data.begin(),data.end());
    //for(long long i=0;i<data.size();i++) printf("%lld %lld\n",data[i].A,data[i].B);
  
    //printf("\n\n");
  
    for(long long i = 0; i < N; i++){
      if(data[i].B + EDcount < M){
        EDmoney += data[i].A * data[i].B;
        EDcount += data[i].B;
        //printf("A : %lld\n",EDmoney);
      }else{
        EDmoney += data[i].A * (M - EDcount);
        //printf("DIS : %lld\n",(M - EDcount));
        break;
      }
    }
  
    printf("%lld", EDmoney);

	return 0;
}

Measured memory_bytes: 2420
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pdd pair<double,double>
#define X first
#define Y second
#define REP(i,a) for(int i=0;i<a;++i)
#define REPP(i,a,b) for(int i=a;i<b;++i)
#define FILL(a,x) memset(a,x,sizeof(a))
#define	foreach( gg,itit )	for( typeof(gg.begin()) itit=gg.begin();itit!=gg.end();itit++ )
#define	mp make_pair
#define	pb push_back
#define sz(a) int((a).size())
#define all(a)  a.begin(), a.end()
#define	debug(ccc)	cout << #ccc << " = " << ccc << endl;
#define present(c,x) ((c).find(x) != (c).end())
const double eps = 1e-8;
#define EQ(a,b) (fabs((a)-(b))<eps)
inline int max(int a,int b){return a<b?b:a;}
inline int min(int a,int b){return a>b?b:a;}
inline ll max(ll a,ll b){return a<b?b:a;}
inline ll min(ll a,ll b){return a>b?b:a;}
const int mod = 1e9+7;
const int N = 1e6+10;
const ll inf = 1e18;

ll power(ll a,ll n){
	if(n==0){
		return 1;
	}
	ll b = power(a,n/2);
	b = b*b%mod;
	if(n%2) b= b*a%mod;
	return b;
}

int add(int a,int b){ return (a+b)%mod;}
int mul(int a,int b){ return (ll)a*b%mod;}

int A[N];

int main(){
 // 	freopen("nice.in","r",stdin);
 // freopen("nice.out","w",stdout);
	int n; scanf("%d",&n);
	int cnt = 0, cnt1 =0;
	REP(i,n){
		int x; scanf("%d",&x); 
		if(!A[x]) cnt1++;
		else cnt++;
		A[x]++;
	}
	if(cnt==0){
		printf("%d\n",cnt1);
	}else if(cnt==1){
		printf("%d\n",cnt1-1);
	}else if(cnt%2==0){
		printf("%d\n",cnt1);
	}else{
		printf("%d\n",cnt1-1);
	}

	// if(cnt%2==0){

	// }


	return 0;
}




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

using namespace std;

#define DUMP(x) std::cerr << (#x) << " = " << (x) << "\n"
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define REP(i, k, n) for (int i = (k); i < (int)(n); ++i)
#define ALL(r) r.begin(), r.end()
#define YES puts("YES")
#define Yes puts("Yes")
#define NO puts("NO")
#define No puts("No")
#define IMP puts("IMPOSSIBLE")
#define Imp puts("Impossible")
#define imp puts("impossible")
#define M1 puts("-1")
#define pb push_back

template <typename T>
T dup(T x, T y)
{
    return (x + y - 1) / y;
};
template <typename A, size_t N, typename T>
inline void arrayFill(A (&array)[N], const T &val) { std::fill((T *)array, (T *)(array + N), val); }

using ll = int64_t;
using vint = vector<int32_t>;
using vvint = vector<vint>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pint = pair<int32_t, int32_t>;
using pll = pair<ll, ll>;
using setint = set<int32_t>;
using setstr = set<string>;
using qint = queue<int32_t>;
using qpint = queue<pint>;

constexpr std::int32_t INF = 1001001001;
constexpr std::int64_t LINF = 1001001001001001001;

void Main()
{
    int a, b, c, x;
    cin >> a >> b >> c >> x;
    int cnt = 0;
    rep(i, a + 1)
    {
        rep(j, b + 1)
        {
            int sum = 500 * i + 100 * j;
            if (x - sum >= 0 && (x - sum) / 50 <= c)
            {
                ++cnt;
            }
        }
    }
    cout << cnt << endl;
}

int main()
{
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


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

# 左側
l = A[0:N]
lsum = [sum(l)]
heapq.heapify(l)
# 右側
r = list(map(lambda x: -x, A[-N:]))
rsum = [sum(r)]# (-)
heapq.heapify(r)
for i in range(N,2*N):
    x = heapq.heappushpop(l,A[i])#max when A[i] added
    lsum.append(lsum[-1] + A[i] - x)

    x =  - heapq.heappushpop(r, -A[3*N-1-i])#min when A[i] added
    rsum.append(rsum[-1] - A[3*N-1-i] + x)

ans = -9999999999999999
for i in range(len(rsum)):
    ans = max(ans, lsum[i]+rsum[len(rsum)-1-i])

print(ans)


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

using namespace std;
using ll = long long;
using ld = long double;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define reps(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
const ll mod = ll(1e9) + 7;
const int INF = int(1e9);

int main() {
	cin.sync_with_stdio(false);
	int N;
	cin >> N;
	ll T = 0;
	vector<ll>C(N), S(N), F(N);
	rep(i, N - 1)cin >> C[i] >> S[i] >> F[i];
	rep(i, N - 1) {
		T = 0;
		reps(j,i, N - 1) {
			T = max(T, S[j]);
			if (T%F[j] != 0) {
				T = (T / F[j] + 1)*F[j];
			}
			T += C[j];
		}
		cout << T << endl;
	}
	cout << 0 << endl;
	
	return 0;
}

Measured memory_bytes: 256
from operator import itemgetter
N,M=map(int,input().split())
A=list(map(int,input().split()))
BC=[list(map(int,input().split())) for _ in range(M)]
A=sorted(A)
sum=0
BC.sort(key=itemgetter(1),reverse=True)

for a in A:
    sum+=a

i=0
#print(BC)

for j in range(M):
    #print(j)
    for k in range(BC[j][0]):
        if i<=N-1 and BC[j][1]>A[i]:
            sum+=BC[j][1]-A[i]
            i+=1
        else:
            break


print(sum)

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

int gcd(int a, int b) {
  if (b == 0) {
    return a;
  }
  else {
    return gcd(b, a%b);
  }
}

int main() {
  int a, b, k;
  cin >> a >> b >> k;
  int cnt = 0;
  int i = gcd(a, b);
  while (true) {
    if (a%i == 0 && b%i == 0) {
      cnt++;
    }
    if (cnt == k) {
      cout << i << endl;
      break;
    }
    i--;
  }
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<cctype>
#include <fstream>
#include <time.h>
#include <iterator>





#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define m0(x) memset(x,0,sizeof(x))
#define print(x) cout<<x<<endl;
#define pe(x) cout<<x<<" ";
#define lb(v,n) lower_bound(v.begin(), v.end(), n);
#define ub(v,n) upper_bound(v.begin(), v.end(), n);
#define int long long
#define all(x) (x).begin(), (x).end()
using namespace std;
int MOD = (ll)1000000000 + 7;
const ll INF = 1e17;
const double pi = acos(-1);
const double EPS = 1e-10;
typedef pair<int, int>P;

vector<int>v;
int calc(int x) {
	int res = 0;
	REP(i, v.size()) {
		res += (x - v[i])*(x - v[i]);
	}
	return res;
}
signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N; cin >> N;
	v.resize(N);
	REP(i, N)cin >> v[i];
	VSORT(v);
	int ans = INF;
	for (int i = -100; i < 101; i++) {
		ans = min(ans, calc(i));
	}
	print(ans);
}

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

class Program{

  static int ans = 0;

  static int Main() {

    int[] time = new int[5];
    int cnt = 0;

    for (int i = 0; i < 5;  i ++) {
      time[i] = int.Parse(Console.ReadLine());
    }
    // ここまで入力

    for (int i = 0; i < 5; i++) {
      for (int j = 1; j < 14 ; j++) {
        if (time[i] < j * 10 && time[i] > (j-1) * 10) {
          if ( j * 10 - time[i] > cnt) {
            cnt = j * 10 - time[i];
          }
          time[i] = j * 10;
        }
      }
      // Console.WriteLine("time[{0}]：{1}, cnt：{2}", i, time[i], cnt);
    }

    ans = time.Sum() - cnt;

    Console.WriteLine("{0}", ans);

    return 0;
  }

}


Measured memory_bytes: 13268
x = int(input())

if x % 2 == 0 and x != 2:
    x += 1
    
f = 1
while f:
    f = 0
    y = int(x**0.5)
    for i in range(3, y+1)[::-1]:
        if x / i == x // i:
            x += 2
            f = 1
print(x)

Measured memory_bytes: 39536
#!/usr/bin/env python3

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n = I()
a = LI()
memo = [0] * (10**6 + 1)
f = defaultdict(int)
for i in a:
    if f[i] > 1:
        continue
    f[i] += 1
    for j in range(i, 10**6+1, i):
        memo[j] += 1

ans = 0
for i in a:
    if memo[i] == 1:
        ans += 1
print(ans)

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

int INF = 1001001001;
ll counter = 0;


void mergex(vector<int> &A, int left, int mid, int right){
    int n1 = mid - left;
    int n2 = right - mid;
    vector<int> L(n1+1), R(n2+1);
    rep(i, n1){
        L[i] = A[left+i];
    }
    rep(i, n2){
        R[i] = A[mid+i];
    }
    L[n1] = INF;
    R[n2] = INF;

    int i = 0;
    int j = 0;

    for(int k = left; k < right; k++){
        if (L[i] <= R[j]){
            A[k] = L[i];
            i += 1;
        } else {
            A[k] = R[j];
            counter += n1 - i;
            j += 1;
        }
    }
    return;
}

void mergexSort(vector<int> &A, int left, int right){
    if(left+1 < right){
        int mid = (left + right) / 2;
        mergexSort(A, left, mid);
        mergexSort(A, mid, right);
        mergex(A, left, mid, right);
    }
    return;
}

int main() {
    int n; cin >> n;
    vector<int> A(n);
    rep(i, n){
        cin >> A[i];
    }

    mergexSort(A, 0, n);

    cout << counter << endl;
}


Measured memory_bytes: 4412
#include<iostream>
using namespace std;
 
int X,Y,E,x,y;
bool D[110][110]={};
int PY[100];
bool V[110];
 
bool match(int x)
{
    if(x<0) return true;
    if(V[x]) return false;
    V[x]=true;
    for(int y=0;y<Y;++y){
        if(!D[x][y]) continue;
        if(match(PY[y])){
            PY[y]=x;
            return true;
        }
    }
    return false;
}
 
int main()
{
    cin>>X>>Y>>E;
    for(int i=0;i<E;++i){
        cin>>x>>y;
        D[x][y]=true;
    }
 
    fill(PY, PY+Y, -1);
    int count=0;
    for(int x=0;x<X;++x){
        fill(V, V+X, false);
        if(match(x)) ++count;
    }
 
    cout<<count<<endl;
    return 0;
}


Measured memory_bytes: 3116
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#define Rep(i,a,n)for(int i=(int)(a);i<(int)(n);i++)
#define rep(i,n)Rep(i,0,n)
typedef long long ll;

int main() {
	int R, G, B, n, flag=0; ll ans = 0;
	scanf("%d %d %d %d", &R,&G,&B,&n);
	rep(r, 1 + (n / R)) {
		rep(g, 1 + (n / G)) {
			if ((n - r * R - g * G) >= 0 && (n - r * R - g * G) % B == 0)ans++;
		}
	}
	printf("%lld", ans);
}

Measured memory_bytes: 128
#include "bits/stdc++.h"
using namespace std;
#define FOR(i,a,b) for(int i =(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
#define REPm(i,n) for(int i=(n)-1;i>=0;i--)
#define REP1(i,n) for(int i=1;i<=(n);i++)
#define mp make_pair
typedef long long ll;
int main(){
    int m = 0;
    int sum = 0;
    REP(i,3){
        int a;
        cin >> a;
        sum += a;
        m = max(m,a);
    }
    if(sum == 2*m) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#define INF 2147483647

int main(int argc, char** argv)
{
	int n, min = INF, cnt = 0;
	scanf("%d", &n);
	long long ans = 0;
	for(int i=0; i<n; i++)
	{
		int x;
		scanf("%d", &x);
		if(x < 0) cnt ++, x = -x;
		if(x < min) min = x;
		ans += x;
	}
	printf("%lld\n", cnt & 1? ans - (min << 1): ans);
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
 int main() {
int N;
string S;
cin>>N>>S;
int C;
int D;
C=0;
D=0;
char op;
     for(int s=0; s<N; s++){
op=S.at(s);
     if(op=='R'){
     C++;
     }
     else if(op=='B'){
     D++;
    }
}
if(C>D){
cout<<"Yes"<<endl;
}
else if(C<=D){
cout<<"No"<<endl;
}
}

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

/* Many Requirements */

int main(){
    // 入力スタンダード
    int n, m, q;
    cin >> n >> m >> q;

    vector<int> a;
    vector<int> b;
    vector<int> c;
    vector<int> d;

    a.push_back(0);
    b.push_back(0);
    c.push_back(0);
    d.push_back(0);

    for(int i=0; i<q; i++) {
        int ai,bi,ci,di;
        cin >> ai >> bi >> ci >> di;
        a.push_back(ai);
        b.push_back(bi);
        c.push_back(ci);
        d.push_back(di);
    }
    // ***************************************

    int A[n+1];
    for (int i=0; i<n+1; i++){
        A[i] =1;
    }
    
    int sumd = 0;
    int maxsum = 0;
    bool flag = true;

    while(flag){

        for(int i=1; i<q+1; i++){
            if(A[b[i]]-A[a[i]] == c[i]){
                sumd += d[i];
            }
        }

        if(maxsum < sumd){
            maxsum = sumd;
        }
       
        A[n] += 1;
        for(int j=n; j>0; j--){
            if(A[j]>m){
                A[j-1] += 1;
                for(int k=j; k<n+1; k++){
                    A[k] = A[j-1];
                }
                if(A[0]==2){
                    flag = false;
                }
            }
        }
        sumd = 0;
    }    

    cout << maxsum << endl;

    return 0;
}

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

int main(){
    int N;

    cin >> N;

    for(int i=1;i <= 9; i++){
        for(int j=1; j <=9 ; j++){
            if(N==i*j){
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;
    return 0;
}

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

int a[1000],b[1000],s;
int main(){
    int N,R,T;
    cin>>N>>R>>T;
    for(int d=0;d<N;d++)scanf("%d",&a[d]);
    for(int e=1;e<=T;e++){
	for(int f=0;f<N;f++){
	    int g=a[f]*e%R;
	    if(b[g])b[g]--;
	    else s++;
	    }
	    if(e-1){
	    for(int f=0;f<N;f++){
	    int g=a[f]*e%R;
	    b[g]++;
	    }
	    }
	}
	cout<<s<<endl;
    }

Measured memory_bytes: 3156
#include <stdio.h>
#import <Foundation/Foundation.h>

int main(int argc, const char * argv[]) {
    long takahashi, aoki, K;
    scanf("%ld %ld %ld", &takahashi, &aoki, &K);

    long minTak = MIN(takahashi, K);
    takahashi -= minTak;
    K -= minTak;
    aoki -= MIN(aoki, K);
    printf("%ld %ld", takahashi, aoki);
    return 0;
}


Measured memory_bytes: 128
import java.util.Scanner;

public class Main {
    static int A;
    static int B;
    static int[] a;

    private static void init() {
        Scanner scanner = new Scanner(System.in);
        A = scanner.nextInt();
        B = scanner.nextInt();
        scanner.close();
    }


    public static void main(String args[]) {
        init();

        int area = A * B;
        int ans = area - (A * 1 + B * 1 -1);
        System.out.println(ans);
    }
}

Measured memory_bytes: 21840
#include <bits/stdc++.h>
using namespace std;
int main()
{
    long long n;
    long long ans=0;
    cin>>n;
    if(n%2)
        cout<<0;
    else
    {

       for(long long i =1;i<=n;i*=5)
       {
           ans+=n/(i*10);
           //ans--;
           //cout<<
       }
       cout<<ans;
    }
//124999999999999995
//111111111111111111

}

Measured memory_bytes: 384
#include<bits/stdc++.h>
  using namespace std;
  #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  #define endl "\n"
  #define int long long
  #define all(v) v.begin(),v.end()
  #define rep(i,a,b) for(int i = a; i <=b; i++)
  #define rep2(i,a,b) for(int i = a; i>=b; i--)
  #define f first
  #define s second
  #define PB push_back
  #define MP make_pair
  #define db long double
  #define trace1(x)                cerr<<#x<<": "<<x<<endl
  #define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
  #define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
  #define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
  #define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
  #define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
  #define cases int testcases;cin>>testcases; while(testcases--)

// void time() {
//     #ifndef ONLINE_JUDGE
//     cout << "\nTime: " << 1.0 * clock() / CLOCKS_PER_SEC << "s\n";
//     #endif
// }



  int32_t main()
  {        
 

     IOS

    

    int n;
    cin >> n;
    cout << n*n;
    
     


    //time();
    return  0;
     }


Measured memory_bytes: 256
import java.util.*;
import java.util.Map.Entry;
 
class Main {
	 static int mod =  (int) (Math.pow(10,9)+7);
   	 static List<ArrayList<Integer>> list= new ArrayList<ArrayList<Integer>>();
//	 static int mod = 998244353;
	 public static void main(String[] args) {
	        Scanner sc = new Scanner(System.in);
	        int H = sc.nextInt();
	        int W = sc.nextInt();
	        
	        int[][] m = new int[H][W];
	        for(int i=0;i<H;i++) {
	        	String S = sc.next();
	        	char[] c=S.toCharArray();
	        	for(int j=0;j<W;j++) {
	        		if(c[j]=='.') {
	        			m[i][j]=0;
	        		} else {
	        			m[i][j]=1;
	        		}	
	        	}
	        }
	        int[][] dp = new int[H][W];
	        dp[0][0]=m[0][0];
	        for(int i=0;i<H;i++) {
	        	for(int j=0;j<W;j++) {
	        		if(i==0&&j==0)continue;
	        		int a1;
	        		if(i==0)a1=99999999;
	        		else {
	        			a1=dp[i-1][j];
		        		if(m[i-1][j]!=m[i][j])a1++;
	        		}
	        		int a2;
	        		if(j==0)a2=99999999;
	        		else {
	        			a2=dp[i][j-1];
		        		if(m[i][j-1]!=m[i][j])a2++;
	        		}
	        		dp[i][j]=Math.min(a1, a2);
	        	}	        			
	        }
	        
	        
	        
	        System.out.println((dp[H-1][W-1]+1)/2);
	        	        	        
	 }
}

Measured memory_bytes: 22868
H, W = map(int, input().split())
arr = [input().rstrip() for h in range(H)]
ans = [[0] * W for _ in range(H)]
for h, row in enumerate(arr):
    for w, val in enumerate(row):
        if h == 0 and w == 0:
            if arr[h][w] == "#":
                ans[h][w] = 1
            continue
        nv = 1e+9
        if h > 0:
            nv = ans[h-1][w]
            if arr[h-1][w] == "." and val == "#":
                nv += 1
        if w > 0:
            tmp = ans[h][w-1]
            if arr[h][w-1] == "." and val == "#":
                tmp += 1
            nv = min(nv, tmp)
        ans[h][w] = nv
print(ans[-1][-1])


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int prt[100005],a[100005],b[100005];
long long re[100005],sum[100005];
int find(int x)
{
	int r=x;
	while(r!=prt[r]) r=prt[r];
	int i=x,j;
	while(i!=r){
		j=prt[i];
		prt[i]=r;
		i=j;
	}
	return r;
}
void join(int x,int y)
{
	int fx=find(x),fy=find(y);
	if(fx!=fy) prt[y]=x;
}
int main()
{
	int n,m;
	memset(re,0,sizeof(re));
	scanf("%d %d",&n,&m);
	for(int i=0;i<=100005;i++) prt[i]=i,sum[i]=1;
	for(int i=1;i<=m;i++){
		scanf("%d %d",&a[i],&b[i]);
	}
	long long cnt=n;
	long long ans=(cnt*(cnt-1))/2;
	re[m+1]=ans;
	for(int i=m;i>1;i--){
		int fa=find(a[i]),fb=find(b[i]);
		if(fa!=fb){
			re[i]=re[i+1]-sum[fa]*sum[fb];
			sum[fa]+=sum[fb];
			sum[fb]=0;
			prt[fb]=fa;
		}
		else re[i]=re[i+1];
	}
	for(int i=2;i<=m+1;i++) printf("%lld\n",re[i]);
	return 0;
}

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

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

  int n = 0;
  for (int i = 0; i < 4; i++) {
    if (s[i] == '+')
      n++;
    else
      n--;
  }

  cout << n << endl;
}

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

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


#define rep(i,n) for(ll (i)=0; (i)<(ll)(n); (i)++)
#define frep(i,m,n) for(ll (i)=(m); (i)<=(ll)(n); (i)++)
#define rrep(i,n) for(ll (i)=(n)-1; (i)>-1; (i)--)
#define frrep(i,m,n) for(ll (i)=(n); (i)>(ll)(m); (i)--)
#define ALL(x) (x).begin(), (x).end()

const ll INF = 100100100100100100;
const ll MOD = 1000000007;

// get abs
ll my_abs(ll a);
// a^n
ll a_n(ll a, ll n);
// get gcd
ll my_gcd(ll a, ll b);
// a^(-1) % MOD 
ll inv(ll a);
// (a+b+c)%MOD
ll madd(ll a, ll b, ll c);
// (a-b)%MOD
ll msub(ll a, ll b);
// (a*b*c)%MOD
ll mtime(ll a, ll b, ll c);


int main() {
    ll n; cin >> n;
    vector<ll> t(n), a(n);
    rep(i, n) cin >> t[i];
    rep(i, n) cin >> a[i];

    // 最大値が矛盾
    if(t[n-1] != a[0]) {
        cout << 0 << endl;
        return 0;
    }

    set<ll> fixed; // 高さ確定しているindex
    ll now = 0; //　現在の最大値
    rep(i, n) {
        if(now != t[i]) {
            now = t[i];
            fixed.insert(i);
        }
    }
    now = 0;
    rep(i, n) {
        if(now != a[n-1-i]) {
            now = a[n-1-i];
            // 矛盾
            if(now > t[n-1-i]) {
                cout << 0 << endl;
                return 0;
            }
            fixed.insert(n-1-i);
        }
    }
    ll ans = 1;
    rep(i, n) {
        if(!fixed.count(i)) {
            ans = mtime(ans, min(t[i], a[i]), 1);
        }
    }
    cout << ans << endl;
    return 0;
}

ll my_abs(ll a) {
    if(a >= 0) return a;
    else return -1 *a;
}

ll a_n(ll a, ll n) { 
    if(n == 0) return 1;
    
    ll ret = a, count = 1;
    while(count * 2 < n) {
        ret *= ret;
        count *= 2;
    }
    if(count == n) return ret;
    else return (ret * a_n(a, n-count));
}

ll my_gcd(ll a, ll b) {
    if(b == 0) return a;
    return my_gcd(b, a%b);
}

ll inv(ll a) {
    return a_n(a, MOD-2);
}

ll madd(ll a, ll b, ll c) {
    ll ret = (a+b) % MOD;
    return (ret+c) % MOD;
}

ll msub(ll a, ll b) {
    if(a < b) return (a-b+MOD) % MOD;
    else return (a-b) % MOD;
}

ll mtime(ll a, ll b, ll c) {
    ll ret = (a*b) % MOD;
    return (ret*c) % MOD;
}


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

#define ll long long int
#define watch(x) cout << (#x) << " is " << (x) << endl
#define f(i,x,n)  for(int i=x;i<n;i++)
#define FASTIO cin.tie(0); cout.tie(0);


string solve(string s , string t)
{
    const int len1= s.length();
    const int len2=t.length();

    int dp[len1+1][len2+1];

    for(int row=0;row<=len1;row++)
        dp[row][0]=0;
    for(int col=0;col<=len2;col++)
        dp[0][col]=0;


    for(int i=1;i<=len1;i++)
    {
        for(int j=1;j<=len2;j++)
        {

            if(s[i-1]==t[j-1])
            {
                dp[i][j]=max(dp[i-1][j-1]+1,max(dp[i][j-1],dp[i-1][j]));

            }
            else
                dp[i][j]=max(dp[i][j-1],dp[i-1][j]);
        }
    }


    int row=len1,col=len2;
    string ans="";
    while(row>0 && col>0)
    {
       if(s[row-1]==t[col-1] && (dp[row-1][col-1]+1)==dp[row][col])
       {
           ans.push_back(s[row-1]);
           row--;
           col--;
       }
       else if(dp[row][col]==dp[row][col-1])
            col--;
       else
            row--;


    }
    reverse(ans.begin(),ans.end());
    return ans;

}


int main()
{
	FASTIO;

	string s,t;
	 cin>>s>>t;
	 string ans=solve(s,t);
	 cout<<ans<<"\n";
	return 0;
}













Measured memory_bytes: 35456