akhauriyash/Code-Regression huggingface dataset:
/*
g++ -std=c++14 -O2 -Wall a.cpp -o a && a
g++ -std=c++14 -O2 -Wall a.cpp -o a && a < in.txt > out.txt
*/

//  io
#include <iostream>
//#include <fstream> //http://www.cplusplus.com/reference/fstream/fstream/
//#include <cstdio>
#include <iomanip> //http://www.cplusplus.com/reference/iomanip/
#include <limits>
//  util
#include <string>
#include <cstring>
#include <algorithm>
//#include <utility>
//#include <functional> //http://www.cplusplus.com/reference/functional/
//#include <cstdlib>
#include <cmath>
//#include <complex>
//#include <random>
//#include <bitset>
//  containers https://en.cppreference.com/w/cpp/container
#include <vector>
#include <queue>
#include <set>
//#include <map>
//#include <unordered_set>
//#include <unordered_map>
//  time
//#include <ctime>
#include <chrono>
//                  https://en.cppreference.com/w/cpp/header/chrono
//                  http://www.cplusplus.com/reference/chrono/

using namespace std;
typedef vector<int> arri;
typedef vector<float> arrf;
typedef pair<int, int> pairi;
typedef long long ll;
typedef long double ld;
const int mod = 1e9 + 7;
const ll inf = 0x7fffffffffffffff;
const ll infneg = -0x7fffffffffffffff;

//file input routed to stdinout
/*
    std::ifineam inFile("input.txt");
    std::ofineam outFile("output.txt");
    std::cin.rdbuf(inFile.rdbuf());
    std::cout.rdbuf(outFile.rdbuf());
    */
#include <clocale>

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

    double a, b, x;
    cin >> a >> b >> x;

    double side = 2 * (b - x / (a * a));

    cout << std::fixed << std::setprecision(10);

    if (side <= b)
    {
        cout << (atan(side / a) * (180.0 / acos(-1)));
    }
    else
    {
        double base = 2 * (x / a) / b;
        cout << (atan(b / base) * (180.0 / acos(-1)));
    }

    //cout << std::fixed << std::setprecision(10) << (atan((2 * side) / a) * (180.0 / acos(-1)));
}

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

ll a, b, c, d;
ll gc(ll x, ll y)
{
    while(y)
    {
        ll t = x;
        x = y;
        y = t%y;
    }
    return x+y;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    cin >> a >> b >> c >> d;
    a--;
    ll g = c*d/gc(c, d);
    cout << b-a - (b/c - a/c + b/d - a/d - (b/g - a/g));
}

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

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);
        Solver solver = new Solver();
        solver.solve(in, out);
        out.close();
    }

    static class Solver {
        public void solve(Scanner in, PrintWriter out) {
            boolean[][] bingo = new boolean[3][3];
            Map<Integer, String> nums = new HashMap<>();
            for (int i = 0; i < 3; i++) {
                for (int j = 0; j < 3; j++) {
                    int a = in.nextInt();
                    nums.put(a, i + ":" + j);
                    bingo[i][j] = false;
                }
            }
            int N = in.nextInt();

            for (int i = 0; i < N; i++) {
                int b = in.nextInt();
                String exists = nums.get(b);
                if (exists != null) {
                    String[] indexes = exists.split(":");
                    bingo[Integer.parseInt(indexes[0])][Integer.parseInt(indexes[1])] = true;
                }
            }

            if (
                (bingo[0][0] && bingo[0][1] && bingo[0][2]) ||
                (bingo[1][0] && bingo[1][1] && bingo[2][2]) ||
                (bingo[2][0] && bingo[2][1] && bingo[2][2]) ||
                (bingo[0][0] && bingo[1][0] && bingo[2][0]) ||
                (bingo[0][1] && bingo[1][1] && bingo[2][1]) ||
                (bingo[0][2] && bingo[1][2] && bingo[2][2]) ||
                (bingo[0][0] && bingo[1][1] && bingo[2][2]) ||
                (bingo[0][2] && bingo[1][1] && bingo[0][2])
            ) {
                out.println("Yes");
            }
            else {
                out.println("No");
            }
        }
    }
}

Measured memory_bytes: 23252
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.util.InputMismatchException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

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

    static class TaskB {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            int x = in.nextInt();

            if (x == 100) x++;

            StringBuilder sb = new StringBuilder();
            sb.append(x);
            for (int i = 0; i < n; i++) {
                sb.append("00");
            }

            out.println(sb.toString());
        }

    }

    static class InputReader {
        BufferedReader br;
        StringTokenizer st;

        public InputReader(InputStream inputStream) {
            br = new BufferedReader(new InputStreamReader(inputStream));
            st = new StringTokenizer("");
        }

        public String nextString() {
            while (!st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine(), " ");
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
            }
            return st.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(nextString());
        }

    }
}



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

int main(){
	string s;
	int n,sum;
	cin>>n;
	for(int i=0;i<n;i++){
		sum=0;
		for(int k=0;k<2;k++){
			cin>>s;
			for(int j=0;j<s.size();j++){
				switch(s[j]){
					case 'm':
						if(s[max(0,j-1)]>='2'&&s[max(0,j-1)]<='9') sum+=(s[j-1]-'0')*1000;
						else sum+=1000;
						break;
					case 'c':
						if(s[max(0,j-1)]>='2'&&s[max(0,j-1)]<='9') sum+=(s[j-1]-'0')*100;
						else sum+=100;
						break;
					case 'x':
						if(s[max(0,j-1)]>='2'&&s[max(0,j-1)]<='9') sum+=(s[j-1]-'0')*10;
						else sum+=10;
						break;
					case 'i':
						if(s[max(0,j-1)]>='2'&&s[max(0,j-1)]<='9') sum+=(s[j-1]-'0');
						else sum+=1;
						break;
				}
			}
		}
		if(sum/1000>1) cout<<sum/1000<<"m";
		else if(sum/1000==1) cout<<"m";
		if(sum%1000/100>1) cout<<sum%1000/100<<"c";
		else if(sum%1000/100==1) cout<<"c";
		if(sum%100/10>1) cout<<sum%100/10<<"x";
		else if(sum%100/10==1) cout<<"x";
		if(sum%10>1) cout<<sum%10<<"i";
		else if(sum%10==1) cout<<"i";
		cout<<endl;
	}
	return 0;
}


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

const double EPS = 1e-10;
const ll INF = 100000000;
const ll MOD = 1000000007;

int h, w;
char a[500][500];

int main() {
    cin >> h >> w;
    rep(i,h) rep(j,w) cin >> a[i][j];
    rep(j,w) cout << '#';
    cout << endl;
    for (int i = 1; i < h-1; i++) {
        rep(j,w) {
            if (a[i][j] == '#') cout << '#';
            else if (j%2) cout << '#';
            else cout << '.';
        }
        cout << endl;
    }
    rep(j,w) cout << '.';
    cout << endl; cout << endl;
    
    rep(j,w) cout << '.';
    cout << endl;
    for (int i = 1; i < h-1; i++) {
        rep(j,w) {
            if (a[i][j] == '#') cout << '#';
            else if (!(j%2)) cout << '#';
            else cout << '.';
        }
        cout << endl;
    }
    rep(j,w) cout << '#';
    cout << endl;
}
































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

const int N = 1e5 + 10;
int n;
int dp[N][3];
int a[N][3];
int solve(int r,int c){

    if(r > n-1)
        return 0;
        
    if(dp[r][c] != -1)  return dp[r][c];
    
    for(int i=0;i<3;i++){
        if(i != c)
            dp[r][c] = max(dp[r][c],solve(r+1,i)+a[r][i]);
    }
    
    return dp[r][c];    
} 
int main()
{
    cin>>n;
    memset(dp,-1,sizeof(dp));
   
    
    for(int i=0;i<n;i++)
        for(int j=0;j<3;j++)
            cin>>a[i][j];
    int ans = -1;
    for(int i=0;i<3;i++)
    {
        ans = max(ans,solve(1,i) + a[0][i]);
    }
    
    cout<<ans<<endl;
    
    return 0;
    
}
    

Measured memory_bytes: 10368
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<stack>
#include<climits>
#include<cstring>
#include<queue>
using namespace std;

const int INF = INT_MAX/3;

int main(){
    //??\???
    int n;
    cin >> n;
    int input[n];
    for (int i=0;i<n;i++){
        cin >> input[i];
    }

    //?????§????????¨??????
    int checked[n];
    for (int i=0;i<n;i++){
        checked[i] = 0;
    }

    //??\???????????????????????????????±???????
    vector< pair<int, int > >inputSorted;
    for(int i=0;i<n;i++){
        inputSorted.push_back(make_pair(input[i], i));
    }
    sort(inputSorted.begin(), inputSorted.end());
    int toMove[n];
    for (int i=0;i<n;i++){
        toMove[inputSorted[i].second] = i;
    }
    int totalMini = inputSorted[0].first;

    //??¢?????´?????????
    int result = 0;
    for (int i=0;i<n;i++){
        if (checked[i] == 0 and i != toMove[i]){
            checked[i] = 1;
            int mini = input[i];
            int count = 1;
            int sum = input[i];
            int now = toMove[i];
            while(i!=now){
                checked[now] = 1;
                mini = min(mini, input[now]);
                count++;
                sum += input[now];
                now = toMove[now];
            }
            sum += mini*(count - 2);
            int sum2 = sum + (mini+totalMini)*2 -mini*(count-1)+totalMini*(count-1);
            result += min(sum, sum2);
        }
    }

    cout << result << endl;

    return 0;
}

Measured memory_bytes: 3128
import java.util.*;
class Main {
	public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[n];
        for(int i = 0;i<n;i++)a[i]=sc.nextInt();
        int marker = 1,count=0;
        boolean tmp = false;
        for(int i = 0;i<n;i++){
            marker = a[marker-1];
            count++;
            if(marker==2){
                tmp =true;
                break;
            }
        }
        System.out.println(tmp?count:-1);
    }
}


Measured memory_bytes: 59684
def solve(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

n = int(input())
arr = solve(n)

cnt = 0
for n in arr:
    a=1
    if n[0]==1:
        break
    while n[1]>=a:
        n[1] -= a
        a += 1
        cnt += 1

print(cnt)

Measured memory_bytes: 9448
import unittest
from io import StringIO
import sys
sys.setrecursionlimit(10 ** 5 + 10)


def input(): return sys.stdin.readline().strip()


def resolve():

    n, m = map(int, input().split())
    if n==1:
        a=int(input())
        print(-(-(m//(a//2)) // 2))

    else:
        A = list(map(int, input().split()))
        B = [0]*n
        for i in range(n):
            B[i] = A[i]//2

        for i in range(n):
            cnt = 0
            val = B[i]
            while val % 2 == 0:
                val //= 2
                cnt += 1
            if i == 0:
                temp = cnt
            else:
                if cnt != temp:
                    ok = False
                    break
                if i == n-1:
                    ok = True

        if ok:
            from functools import reduce
            from fractions import gcd

            def lcm(A, B):
                return A * B // gcd(A, B)

            # リストを引数にとる
            l = reduce(lcm, B)
            print(-(-(m//l) // 2))

        else:
            print(0)


resolve()


Measured memory_bytes: 92332
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define MP make_pair
#define PII pair<int, int>
#define PLL pair<ll, ll>
#define PLI pair<ll, int>
#define PIL pair<int, ll>
#define STR string
#define Fst first
#define Snd second
#define SHN 1e9
#define LSHN 1e18
using namespace std;
struct edge
{
	int to,col,len;
	edge(int to_,int col_,int len_)
	{ to=to_,col=col_,len=len_; }
};
struct hint
{
	int num,typ,col,val;
	hint(int num_,int typ_,int col_,int val_)
	{ num=num_,typ=typ_,col=col_,val=val_; }
};
int n,m;
vector<edge> v[100010];
int ans[100010];
vector<hint> h[100010];
int lcai[100010][30];
int dep[100010];
int cnt[100010],sum[100010];
void dfs1(int x,int par)
{
	lcai[x][0]=par;
	dep[x]=(par==-1 ? 0 :dep[par]+1);
	for (int i=0;i<v[x].size();i++)
	{
		int xi=v[x][i].to;
		if (xi!=par) dfs1(xi,x);
	}
}
int lca(int x,int y)
{
	if (dep[x]>dep[y]) swap(x,y);
	int t=dep[y]-dep[x];
	for (int i=0;i<20;i++) if (t & (1<<i)) y=lcai[y][i];
	int l=0,r=n;
	while (l<r)
	{
		int mid=(l+r)>>1;
		int xi=x,yi=y;
		for (int i=0;i<20;i++)
			if (mid & (1<<i)) xi=lcai[xi][i],yi=lcai[yi][i];
		if (xi==yi) r=mid;
		else l=mid+1;
	}
	for (int i=0;i<20;i++) if (l & (1<<i)) x=lcai[x][i];
	return x;
}
int dfs2(int x,int par,int t)
{
	for (int i=0;i<h[x].size();i++)
	{
		if (!h[x][i].typ) ans[h[x][i].num]+=t*h[x][i].val;
		else if (h[x][i].typ==1) ans[h[x][i].num]+=sum[h[x][i].col]*h[x][i].val;
		else ans[h[x][i].num]+=cnt[h[x][i].col]*h[x][i].val;
	}
	for (int i=0;i<v[x].size();i++)
	{
		int xi=v[x][i].to;
		if (xi!=par)
		{
			cnt[v[x][i].col]++,sum[v[x][i].col]+=v[x][i].len;
			dfs2(xi,x,t+v[x][i].len);
			cnt[v[x][i].col]--,sum[v[x][i].col]-=v[x][i].len;
		}
	}
} 
int main()
{
	scanf("%d%d",&n,&m);
	for (int i=0;i<n-1;i++)
	{
		int x,y,c,d;
		scanf("%d%d%d%d",&x,&y,&c,&d);
		x--,y--,c--;
		v[x].push_back(edge(y,c,d));
		v[y].push_back(edge(x,c,d));
	}
	dfs1(0,-1);
	for (int i=1;i<20;i++)
		for (int j=0;j<n;j++)
			lcai[j][i]=(lcai[j][i-1]!=-1 ? lcai[lcai[j][i-1]][i-1] : -1);
	for (int i=0;i<m;i++)
	{
		int x,y,ui,vi;
		scanf("%d%d%d%d",&x,&y,&ui,&vi);
		x--,ui--,vi--;
		int wi=lca(ui,vi);
		h[ui].push_back(hint(i,0,-1,1));
		h[ui].push_back(hint(i,1,x,-1));
		h[ui].push_back(hint(i,2,x,y));
		h[vi].push_back(hint(i,0,-1,1));
		h[vi].push_back(hint(i,1,x,-1));
		h[vi].push_back(hint(i,2,x,y));
		h[wi].push_back(hint(i,0,-1,-2));
		h[wi].push_back(hint(i,1,x,2));
		h[wi].push_back(hint(i,2,x,-2*y));
	}
	dfs2(0,-1,0);
	for (int i=0;i<m;i++) printf("%d\n",ans[i]);
	return 0;
} 

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

int main() {
  int N;
  cin >> N;
  int ans = 0;
  for (int i = 1; i <= N; i += 2) {
    int c = 0;
    for (int j = 1; j <= i; j += 2) {
      if (i % j == 0) c++;
    }
    if (c == 8) ans++;
  }
  cout << ans << endl;
}

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

import sys
import math
import re
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(1000000)
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()))

while 1:
    n = I()
    if n == 0:
        quit()
    f = defaultdict(dict)
    t = defaultdict(lambda : False)
    ch = defaultdict(lambda : False)
    stack = []
    for i in range(n):
        x = input()[:-1].split(':')
        y = x[1].split(',')
        x = x[0]
        for j in y:
            f[x][j] = 1
            if i != 0:
                continue
            stack.append(j)
    ans = 0
    while stack:
        x = stack.pop()
        if ch[x]:
            continue
        ch[x] = True
        if len(f[x]) == 0 and not t[x]:
            ans += 1
            t[x] = True
            continue
        for i,j in f[x].items():
            stack.append(i)
    print(ans)


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

#define INF 2147483647

#define MAX_N 131072
//  131072 = 2^17

int tree[ MAX_N*2 ];
int L[ MAX_N*2 ];
int R[ MAX_N*2 ];

int dfs(int a,int b,int k){  
  if(R[k]<=a || b<=L[k])return INF;
  if(a<=L[k] && R[k]<=b)return tree[k];
  return min(dfs(a,b,k*2+1),dfs(a,b,k*2+2));
}

int getMin(int a,int b){
  return dfs(a,b,0);
}

void update(int i,int x){
  int k=i;
  k+= ( MAX_N - 1 );
  tree[k]=x;
  L[k]=i;
  R[k]=i+1;
  while(k){
    k=(k-1)/2;
    tree[k]=min(tree[k*2+1],tree[k*2+2]);
    L[k]=min(L[k*2+1],L[k*2+2]);
    R[k]=max(R[k*2+1],R[k*2+2]);
  }
}


int n,q;
int a,b,c;
int main(){
  for(int i=0;i<MAX_N;i++)update(i,INF);

  cin>>n>>q;

  for(int i=0;i<q;i++){
    cin>>a>>b>>c;
    if(a==1){
      cout<<getMin(b,c+1)<<endl;
    }else{
      update(b,c);
    }
  }
  return 0;
}

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

//repetition
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)

//container util
#define all(x) (x).begin(),(x).end()

//typedef
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VLL;
typedef vector<VLL> VVLL;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;


//conversion
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}


int main(){
  int n;
  string s;
	cin >> n >> s;
  VI w(n,0);
  int sumW = 0;
  rep(i,n) if(s[i]=='.') sumW += 1;

  int ans = sumW;
  int b=0;

	rep(i,n){
    if(s[i] == '#') b++;
    else sumW--;
    ans = min(ans,b+sumW);
  }

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


Measured memory_bytes: 1412
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<list>
#include<set>
#include<string>
using namespace std;
int gcd(int a, int b) {
	int c = a % b;
	while (c != 0) {
		a = b;
		b = c;
		c = a % b;
	}
	return b;
}
struct UnionFind {
	vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

	UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
		for (int i = 0; i < N; i++) par[i] = i;
	}

	int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
		if (par[x] == x) return x;
		return par[x] = root(par[x]);
	}

	void unite(int x, int y) { // xとyの木を併合
		int rx = root(x); //xの根をrx
		int ry = root(y); //yの根をry
		if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
		par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
	}

	bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
		int rx = root(x);
		int ry = root(y);
		return rx == ry;
	}
};
typedef long long ll;

ll M = 1000000007;

vector<ll> fac(300001); //n!(mod M)
vector<ll> ifac(300001); //k!^{M-2} (mod M)

ll mpow(ll x, ll n) {
	ll ans = 1;
	while (n != 0) {
		if (n & 1) ans = ans * x % M;
		x = x * x % M;
		n = n >> 1;
	}
	return ans;
}
ll comb(ll a, ll b) {
	if (a == 0 && b == 0)return 1;
	if (a < b || a < 0)return 0;
	ll tmp = ifac[a - b] * ifac[b] % M;
	return tmp * fac[a] % M;
}
// mod. m での a の逆元 a^{-1} を計算する
long long modinv(long long a) {
	long long b = M, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= M;
	if (u < 0) u += M;
	return u;
}
vector<vector<ll>> mul(vector<vector<ll>> a,vector<vector<ll>> b,int n){
	int i,j,k,t;
	vector<vector<ll>> c(n);
	for (i = 0; i < n; i++) {
		for (j = 0; j < n; j++) {
			t = 0;
			for (k = 0; k < n; k++)
				t = (t + a[i][k]*b[k][j] % M)%M;
			c[i].push_back(t);
		}
	}
	return c;
}
int main() {
	int a[5], i,k;
	for (i = 0; i < 5; i++)
		cin >> a[i];
	cin >> k;
	if(a[4]-a[0]>k)
			cout << ":(" << endl;
  else
	cout << "Yay!" << endl;
}


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

#define rep(i, n) for (int i = 0; i < (n); i++)
#define contains(v, t) (find(v.begin(), v.end(), t) != v.end())
#define MOD 1000000007
typedef long long ll;
typedef unsigned long long ull;

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

  if (t.substr(0, t.length() - 1) == s) {
    cout << "Yes";
  } else {
    cout << "No";
  }
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = 1e16;
const ll MOD = 1e9 + 7;

#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(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second
#define N_SIZE (1LL << 20)
#define NIL -1

ll sq(ll num) { return num*num; }
ll mod_pow(ll x, ll n) {
	if (n == 0)return 1;
	if (n == 1)return x%MOD;
	ll res = sq(mod_pow(x, n / 2));
	res %= MOD;
	if (n % 2 == 1) {
		res *= x;
		res %= MOD;
	}
	return res;
}

ll d,g;
ll p[10];
ll c[10];
ll dp[11][200000];

int main(){
	cin >> d >> g;
	g /= 100;
	rep(i,d){
		cin >> p[i] >> c[i];
		c[i] /= 100;
	}
	rep(i,11)rep(j,200000)dp[i][j] = INF;
	dp[0][0] = 0;
	rep(i,d){
		rep(j,200000){
			rep(k,p[i]){
				ll num = (i+1) * (k+1);
				if(k == p[i]-1)num += c[i];
				if(num + j < 200000){
					dp[i+1][num + j] = min(dp[i][j] + (k+1),dp[i+1][num + j]);
				}
			}
			dp[i+1][j] = min(dp[i+1][j],dp[i][j]);
		}
	}
	ll ans = INF;
	rep(i,200000){
		if(i >= g)ans = min(ans,dp[d][i]);
	}
	cout << ans << endl;
}

Measured memory_bytes: 17408
import java.io.BufferedReader
import java.util.*

fun main() = arc069d()

@OptIn(ExperimentalStdlibApi::class)
fun arc069d() = SimpleFastIOWithToken_arc069d().exec {
    val n = readInt()
    val replies = readString().map { it == 'o' }.toBooleanArray()

    val booleans = listOf(true, false)

    for (a1 in booleans) for (a2 in booleans) {
        val allocation = BooleanArray(n).apply { this[0] = a1; this[1] = a2 }

        for (i in 1 until n - 1) {
            allocation[i + 1] = (replies[i] == allocation[i]) == allocation[i - 1]
        }

        val allOk = (0 until n).all {
            (replies[it] == allocation[it]) == (allocation[(it - 1 + n) % n] == allocation[(it + 1) % n])
        }
        if (allOk) return@exec println(allocation.joinToString("") { if (it) "S" else "W" })
    }

    println(-1)
}

// region kokokara template dayo (^o^)
@Suppress("unused", "HasPlatformType", "MemberVisibilityCanBePrivate", "ClassName")
private class SimpleFastIOWithToken_arc069d(private val separator: String = System.lineSeparator()) {
    private val br: BufferedReader = System.`in`.bufferedReader()
    private var st: StringTokenizer = StringTokenizer("")
    private val sb: StringBuilder = StringBuilder()
    private fun prepareNext() = run { if (!st.hasMoreTokens()) st = StringTokenizer(br.readLine()) }

    fun readString(): String = run { prepareNext() }.run { st.nextToken() }
    fun readInt(): Int = Integer.valueOf(readString())
    fun readLong(): Long = java.lang.Long.valueOf(readString())

    fun println(): Unit = run { sb.append(separator) }
    fun print(any: Any): Unit = run { sb.append(any) }
    fun println(any: Any): Unit = run { sb.append(any.toString() + separator) }

    fun exec(action: SimpleFastIOWithToken_arc069d.() -> Unit) {
        var t: Throwable? = null
        Thread(null, { action() }, "solve", 128 * 1024 * 1024)
            .apply { setUncaughtExceptionHandler { _, t1 -> t = t1 } }
            .apply { start() }.join()
        t?.let { throw it }
        kotlin.io.print(sb)
    }

    fun readLine(): Nothing = error("readLine is disabled.")
}
// endregion kokomade template dayo (^o^)


Measured memory_bytes: 44232
#include<bits/stdc++.h>
using namespace std;
#define fine cout<<"fine"<<endl;
#define ll long long int
#define pb push_back
#define FASTIO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
const ll inf=(ll)2e18;
const int mod=1e9+7;
bool overflow(ll a,ll b){
    if (a <= (inf+b-1)/b) return false;
    return true;
}
const int NAX=5e5+5;
bitset<26> seg[4*NAX];
string s;
void build(int i,int l,int r){
    if(r-l<2){
        seg[i][s[l]-97]=1;
        return;
    }
    int mid=(l+r)/2;
    build(2*i,l,mid);
    build(2*i+1,mid,r);
    seg[i]=seg[2*i]|seg[2*i+1];
}
void update(int i,int l,int r,int p,int val){
    if(r-l<2){
        seg[i]=0;
        seg[i][val]=1;
        return;
    }
    int mid=(l+r)/2;
    if(p>=mid)
        update(2*i+1,mid,r,p,val);
    else update(2*i,l,mid,p,val);
    seg[i]=seg[2*i]|seg[2*i+1];
}
bitset<26> query(int i,int l,int r,int x,int y){
    if(x>=r||y<=l){
        bitset<26> b;
        return b;
    }
    if(l>=x&&r<=y)
        return seg[i];
    int mid=(l+r)/2;
    return query(2*i,l,mid,x,y)|query(2*i+1,mid,r,x,y);
}
int main(){
FASTIO;
int n,q;
cin>>n;
cin>>s;
cin>>q;
build(1,0,n);
while(q--){
    int type;
    cin>>type;
    if(type-1){
        int l,r;
        cin>>l>>r;
        bitset<26> b=query(1,0,n,l-1,r);
        cout<<b.count()<<endl;
    }
    else{
        int index;
        char c;
        cin>>index>>c;
        if(s[index-1]!=c)
            s[index]=c;
        update(1,0,n,index-1,c-97);
    }
}
}


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

#define int long long
#define ALL(x) x.begin(),x.end()
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
#define pb(x) push_back(x)
#define eb emplace_back
#define SORT(ls) sort(ls.begin(), ls.end())
#define DESC(ls) sort(ls.rbegin(), ls.rend()) 
#define mp(x, y) make_pair(x, y)
#define INF 1000000000
#define MOD 1000000007
#define F(i, a, n) for(i=a;i<n;i++)
#define B(i, a, n) for(i=n-1;i>=0;i--)
#define SI(x) cin>>x
#define DI(x, y) cin>>x>>y
#define TI(x, y, z) cin>>x>>y>>z
#define FI(w, x, y, z) cin>>w>>x>>y>>z
#define SO(x) cout<<x<<"\n"
#define DO(x, y) cout<<x<<" "<<y<<"\n"
#define TO(x, y, z) cout<<x<<" "<<y<<" "<<z<< "\n"
#define FO(w, x, y, z) cout<<w<<" "<<x<<" "<<y<<" "<<z<<"\n"
#define FASTER ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)

inline bool inBounds(int i, int j)
{
    if(i < 0 || j < 0)
        return false;
    return true;
}


int32_t main(void)
{
    FASTER;
    #ifdef LOCAL
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
    int i, j;
    int n;
    SI(n);
    double p[n];
    F(i, 0, n)
        SI(p[i]);
    double dp[n][n + 1];
    memset(dp, 0, sizeof(dp));
    dp[0][0] = 1 - p[0];
    dp[0][1] = p[0];
    F(i, 1, n)
    {
        F(j, 0, n + 1)
        {
            if(inBounds(i - 1, j))
                dp[i][j] += (dp[i - 1][j] * (1 - p[i]));
            if(inBounds(i - 1, j - 1))
                dp[i][j] += (dp[i - 1][j - 1] * p[i]);
        }
    }
    double ans = 0;
    F(i, n/2 + 1, n + 1)
    {
        ans += dp[n - 1][i];
    }
    cout << setprecision(13) << ans << "\n";
    return 0;
}


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

int main() {
	// your code goes here
	int a,b,c;
	cin>>a>>b>>c;
    if(a<=b && b<=c && a<=c){
    	cout<<a<<" "<<b<<" "<<c<<endl;
    }
    else if(a<=b && b>=c && a<=c){
    	cout<<a<<" "<<c<<" "<<b<<endl;
    }
    else if(a>=b && b<=c && a<=c){
    	cout<<b<<" "<<a<<" "<<c<<endl;
    }
    else if(a>=b && b<=c && a>=c){
    	cout<<b<<" "<<c<<" "<<a<<endl;
    }
    else if(a<=b && b>=c && a>=c){
    	cout<<c<<" "<<a<<" "<<b<<endl;
    }
    else if(a>=b && b>=c && a>=c){
    	cout<<c<<" "<<b<<" "<<a<<endl;
    }
   
    
	return 0;
}

Measured memory_bytes: 3068
#include <cstdio>
bool f[100001];
int c[100002];
int N, L, R;
int main ()
{
for(int i =2; i <=100000; i++) if (!f[i])for(int j = i + i ;j <=100000; j += i )
f[j]= true ;
for ( int i =3; i <=100000; i +=2) if (!f[i]&&!f[(i+1)/2]) c[i]++;
for ( int i =3; i <=100000; i++) c[i] += c[i-1];
scanf ("%d" ,&N);
while (N--)
{
scanf ("%d %d " ,&L ,& R );
printf ("%d \n " , c[R] - c[L-1]);
}
}


Measured memory_bytes: 1280
//56
#include<iostream>

using namespace std;

int main(){
  for(int k;cin>>k,k;){
    int s=0;
    for(int i=0;i<k*(k-1)/2;i++){
      int c;
      cin>>c;
      s+=c;
    }
    cout<<s/(k-1)<<endl;
  }
  return 0;
}

Measured memory_bytes: 0
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace _0024
{
    public class Program

    {
        public static void Main(string[] args)
        {
            while (true)
            {
                string line = ReadSt();
                if (line == null) break;
                decimal requiredV = decimal.Parse(line);

                var t = requiredV / (decimal)9.8;
                decimal requiredY = (decimal)(Math.Pow((double)t, 2) * 4.9);
                Console.WriteLine(requiredY % 5 == 0 ? Math.Floor(requiredY / 5) + 1: Math.Floor(requiredY / 5) + 2);

            }
        }

        static string ReadSt() { return Console.ReadLine(); }
        static int ReadInt() { return int.Parse(Console.ReadLine()); }
        static long ReadLong() { return long.Parse(Console.ReadLine()); }
        static double ReadDouble() { return double.Parse(Console.ReadLine()); }
        static string[] ReadStAr(char sep = ' ') { return Console.ReadLine().Split(sep); }
        static int[] ReadIntAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => int.Parse(e)); }
        static long[] ReadLongAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => long.Parse(e)); }
        static double[] ReadDoubleAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => double.Parse(e)); }
        static string WriteAr(int[] array, string sep = " ") { return String.Join(sep, array.Select(x => x.ToString()).ToArray()); }
        static string WriteAr(double[] array, string sep = " ") { return String.Join(sep, array.Select(x => x.ToString()).ToArray()); }
        static string WriteAr(long[] array, string sep = " ") { return String.Join(sep, array.Select(x => x.ToString()).ToArray()); }

    }

}



Measured memory_bytes: 16000
if __name__ == "__main__":
    n = int(input())
    x = list(map(int, input().split()))

    ans = 10 ** 8
    x_min = min(x)
    x_max = max(x)
    for i in range(x_min, x_max+1):
        tmp = 0
        for j in range(n):
            tmp += (x[j] - i) ** 2
        if tmp < ans:
            ans = tmp

    print(ans)


Measured memory_bytes: 3060
#include "bits/stdc++.h"

#define MOD 1000000007
#define rep(i, n) for(ll i=0; i < (n); i++)
#define ALL(v) v.begin(),v.end()
#define FOR(i, j, k) for(ll i=j;i<k;i++)
#define DUMP(i, v)for(ll i=0;i<v.size();i++)cout<<v[i]<<" "

using namespace std;
typedef long long int ll;
typedef vector<ll> llvec;
typedef vector<double> dvec;
typedef pair<ll, ll> P;
typedef long double ld;
struct Edge{ll from, to, cost;};
struct node{ll cost, to;
  bool friend operator>(node a, node b){
    return a.cost>b.cost;
  }
};

ll mod(ll a, ll mod){
  ll res = a%mod;
  if(res<0)res=res + mod;
  return res;
}

ll modpow(ll a, ll n, ll mod){
  ll res=1;
  while(n>0){
    if(n&1) res=res*a%mod;
    a=a*a%mod;
    n>>=1;
  }
  return res;
}

ll modinv(ll a, ll mod){
  return modpow(a, mod-2, mod);
}

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

bool is_prime(ll n){
  ll i = 2;
  if(n==1)return false;
  if(n==2)return true;
  bool res = true;
  while(i*i <n){
    if(n%i==0){
      res = false;
    }
    i = i+1;
  }

  //if(i==1)res = false;
  if(n%i==0)res=false;
  return res;
}


/**************************************
** A main function starts from here  **
***************************************/
int main(){
  ll N, M;
  cin >> N >> M;
  llvec H = llvec(N, 0);
  llvec A = llvec(M, 0);
  llvec B = llvec(M, 0);
  rep(i, N)cin >> H[i];
  llvec c(N, 0);
  rep(i, M){
    cin >> A[i] >> B[i];
    if(H[A[i]-1]<=H[B[i]-1])c[A[i]-1]++;
    if(H[A[i]-1]>=H[B[i]-1])c[B[i]-1]++;
  }
  ll ans=0;
  rep(i, N){
    if(c[i]==0)ans++;
  }

  cout << ans;
  return 0;
}


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


int main(){
    int n; cin >> n;
    vector<int>p(n);
    rep(i,n)cin>>p[i];
    int cnt=0,a;
    rep(i,n-1){
        if(p[i]!=i+1) cnt++;
    }
    if(cnt>2) cout << "NO"<<endl;
    else cout << "YES" << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(signed i=0;i<n;++i)
#define repi(n) rep(i,n)
#define repvin(n) vint a(n);r(i,n)cin>>a[i];
#define int long long
#define str string
#define vint vector<signed>
#define pint pair<signed,signed>
#define pb(a) push_back(a)
#define all(v) v.begin(),v.end()
#define yn(b) cout<<((b)?"Yes":"No")<<endl
#define YN(b) cout<<((b)?"YES":"NO")<<endl
#define call(a) for(auto t:a)cout<<t<<" ";cout<<endl
#define ENDL printf("\n");
#define debg(a) cout<<#a<<":"<<a<<endl;

bool check(str s,str t){
  rep(i,s.length()){
    if(s[i]=='?')continue;
    if(s[i]!=t[i])return false;
  }
  return true;
}

signed main(){
  str s,cs,t,st;
  cin>>s>>t;
  signed sl=s.length(),tl=t.length();
  for(int i=sl-tl;i>=0;--i){
    st=s;
    for(signed j=0;j<tl;++j){
      st[i+j]=t[j];
    }
    if(check(s,st)){
        repi(sl)if(st[i]=='?')st[i]='a';
        cout<<st<<endl;
        return 0;
    }
  }
  cout<<"UNRESTORABLE"<<endl;

  return 0;
}


Measured memory_bytes: 256
a = int(input())
b = int(input())
c = int(input())
x = int(input())
count = 0
for i in range(a + 1):
  for j in range(b + 1):
    for k in range(c + 1):
      if 500*i + 100*j + 50*k == x:
        count += 1
print(count)

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

int main() {
  int n, x;
  cin >> n >> x;
  vector<int>m(n);
  rep(i,n) cin >> m[i];
  sort(m.begin(), m.end());
  int minsum = 0;
  rep(i,n) minsum += m[i];
  x -= minsum;
  int ans = n;
  ans += x / m[0];
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#include <time.h>
#include <stack>
#include <array>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;

int main()
{
	ll a, b, c;
	cin>>a>>b>>c;
	if((c-a-b)<=0)
    {
     cout << "No\n";return 0; 
    }
	if(4*a*b<(c-a-b)*(c-a-b)){
		cout<<"Yes"<<endl;
	}else{
		cout<<"No"<<endl;
	}
	return 0;
}


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

using namespace std;

int main()
{
   int n;
   cin >> n;
   int arr[n];
   for(int i = 0; i < n; i++)
   {
     cin >> arr[i];
   }
    int j = 1, ct = 0;
   for(int i = 0; i < n; i++)
   {
     if(arr[i] == j)
     {
		ct++;
		j++;
     }
   }
   int tem = n - ct;
   if(tem == n) cout << -1  << '\n';
   else cout << tem << '\n';
  return 0;
}



Measured memory_bytes: 1024
#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<map>
#include<set>

#define FOR(i, a, n) for(int i = (int)(a); i < (int)(n); ++i)
#define REP(i, n) FOR(i, 0, n)
 
#define sPRINT(str) printf(#str "\n")
#define yOUT sPRINT(Yes)
#define nOUT sPRINT(No)
#define YOUT sPRINT(YES)
#define NOUT sPRINT(NO)
 
#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()
 
using namespace std;

int main(void)
{   
    int n,m;
    cin >> n >> m;
    cout << (n-1)*(m-1) << endl;
}


Measured memory_bytes: 256
<?php
$s = trim(fgets(STDIN));
$len = strlen($s);
$error = 0;
for($i=0; $i<$len/2; $i++) {
    if($s[$i*2] === "L") {
        $error = 1;
    } elseif ($s[$i*2+1] === "R") {
        $error = 1;
    }
}
if($error === 0) {
    echo "Yes";
} else {
    echo "No";
}

Measured memory_bytes: 4728
#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

using ll = long long;

const long long MAX = 1e18;

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

	vector<ll> A(N);
	for(auto &x : A) {
		cin >> x;
	}

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

	ll result = 1L;
	for(int i = 0; i < N; i++) {
		const ll old = result;
		if(numeric_limits<long long>::max())
		if(A[i] == 0) {
			cout << 0 << endl;
			return 0;
		}
		if(result > MAX / A[i]) {
			cout << -1 << endl;
			return 0;
		}
		result *= A[i];
	}

	cout << result << endl;

	return 0;
}


Measured memory_bytes: 3984
#include <stdio.h>
#include <stdlib.h>
#define int long long

typedef struct {
	int i;
	int val;
}pair;

signed compair(const void *a, const void *b){
	int sub = ((pair *)a)->val - ((pair *)b)->val;
	if(sub < 0){
		return -1;
	}
	else if(sub == 0){
		return 0;
	}
	else{
		return 1;
	}
}

int min(int a, int b){
	return a <= b ? a : b;
}
/*
signed main(){
	int N, i, j, now, ans;
	scanf("%lld", &N);
	pair *A = (pair *)malloc(sizeof(pair) * N);
	pair *B = (pair *)malloc(sizeof(pair) * N);
	for(i = 0; i < N; i++){
		A[i].i = i;
		B[i].i = i;
		scanf("%lld%lld", &A[i].val, &B[i].val);
	}
	qsort(A, N, sizeof(pair), compair);
	qsort(B, N, sizeof(pair), compair);
	int *is_used = (int *)malloc(sizeof(int) * N);
	int *Apos = (int *)malloc(sizeof(int) * N);
	int *Bpos = (int *)malloc(sizeof(int) * N);
	for(i = 0; i < N; i++){
		is_used[i] = 0;
		Apos[A[i].i] = i;
		Bpos[B[i].i] = i;
	}
	now = A[N - 1].i;
	is_used[now] = 1;
	j = 0;
	ans = 0;
	while(1){
		printf("now = %lld\n", now);
		while(j < N && is_used[B[j].i] == 1){
			j++;
		}
		printf("j = %lld\n", j);
		if(j == N){
			ans += min(A[Apos[now]].val, B[N - 1].val);
			printf("%lld\n", ans);
			return 0;
		}
		ans += min(A[Apos[now]].val, B[j].val);
		now = B[j].i;
		is_used[now] = 1;
	}
}
*/

signed main(){
	int N, i, Asum = 0, Bsum = 0;
	scanf("%lld", &N);
	pair *ps = (pair *)malloc(sizeof(pair) * (2 * N));
	int *is_used = (int *)malloc(sizeof(int) * N);
	int *vs = (int *)malloc(sizeof(int) * N);
	for(i = 0; i < N; i++){
		is_used[i] = 0;
		vs[i] = -1;
		ps[2 * i].i = i;
		ps[2 * i + 1].i = i;
		scanf("%lld%lld", &ps[2 * i].val, &ps[2 * i + 1].val);
		Asum += ps[2 * i].val;
		Bsum += ps[2 * i + 1].val;
	}
	qsort(ps, 2 * N, sizeof(pair), compair);
	int f = 0, now = 0, ans = 0;
	for(i = 0; i < 2 * N; i++){
		ans += ps[i].val;
		vs[ps[i].i] = ps[i].val;
		is_used[ps[i].i]++;
		now++;
		if(is_used[ps[i].i] == 2){
			f = 1;
		}
/*		if(f == 1 || now < N - 1){
			ans += ps[i].val;
			is_used[ps[i].i]++;
			now++;
			if(is_used[ps[i].i] == 2){
				f = 1;
			}
		}
		else{
			if(is_used[ps[i].i] == 1){
				ans += ps[i].val;
				is_used[ps[i].i]++;
				now++;
				f = 1;
			}
		}
*/		if(now == N){
			if(f == 0){
				if(ps[i].i != ps[i + 1].i){
					ans = ans - ps[i].val + ps[i + 1].val;
				}
				else{
					ans = min(ans - ps[i - 1].val + ps[i + 1].val, ans - ps[i].val + ps[i + 2].val);
				}
/*				int ans_sub = ans;
				ans = min(Asum, Bsum);
				for(i++; i < 2 * N; i++){
					ans = min(ans, ans_sub - vs[ps[i].i] + ps[i].val);
				}
*/			}
			printf("%lld\n", min(min(Asum, Bsum), ans));
			return 0;
		}
	}
}

Measured memory_bytes: 7932
#include <iostream>

using std::cin;
using std::cout;
using std::endl;


void TorT()
{
  int n, a, b;

  cin >> n >> a >> b;
  if (n * a > b) cout << b << endl;
  else           cout << n * a << endl;
}


void cross9_9()
{
  int a, b;

  cin >> a >> b;
  if (a > 0 && a < 10 && b > 0 && b < 10) cout << a * b << endl;
  else cout << -1 << endl;
}


void calculate_circle()
{
  int r;

  cin >> r;
  cout << r * r << endl;
}


void SvsM()
{
  int hp, a;
  int atk_cnt, rest;

  cin >> hp >> a;
  atk_cnt = hp / a;
  if (hp % a) atk_cnt++;
  cout << atk_cnt << endl;
}


void Poor3()
{
  int a, b, c;

  cin >> a >> b >> c;
  if (a == b && b != c) cout << "Yes" << endl;
  else if (b == c && c != a) cout << "Yes" << endl;
  else if (c == a && a != b) cout << "Yes" << endl;
  else cout << "No" << endl;
}


void Algae()
{
  int r, d, x;
  
  cin >> r >> d >> x;
  for (int i = 0; i < 10; i++)
  {
    x = r * x - d;
    cout << x << endl;
  }
}


void cross81()
{
  int n;
  int flag = 0;

  cin >> n;
  for (int i = 1; i < 10; i++)
  {
    for (int j = 1; j < 10; j++)
    {
      if (n == i * j)
      {
        flag = 1;
        cout << "Yes" << endl;
        break;
      }
    }
    if (flag) break;
  }
  if(!flag) cout << "No" << endl;
}


int main()
{
  //TorT();
  //cross9_9();
  //calculate_circle();
  //SvsM();
  //Poor3();
  //Algae();
  cross81();
}

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

    int main()
    {
        ios_base::sync_with_stdio(false);
        cin.tie(NULL);
        long long int n;
        cin>>n;
      //  cout<<n<<endl;
        if(n==1)
        cout<<0<<endl;
        else
    {
        vector<long long int>v;
        while (n % 2 == 0)  
        {  
        v.push_back(2);
        n = n/2;  
        }  
  
    for (long long int i = 3; i <= sqrtl(n); i = i + 2)  
    {  
       
        while (n % i == 0)  
        {  
             v.push_back(i);
            n = n/i;  
        }  
    }  
  
    if (n > 2)  
     v.push_back(n);  
     for(int i=0;i<v.size();i++)
     {
   //      cout<<v[i]<<" ";
     }
   //  cout<<endl;
     
     vector<long long int>vec;
     
     vector<bool> visited(v.size(), false); 
  
   
    for (int i = 0; i <v.size(); i++) { 
  
        if (visited[i] == true) 
            continue; 
  
      
        int count = 1; 
        for (int j = i + 1; j <v.size(); j++) { 
            if (v[i] == v[j]) { 
                visited[j] = true; 
                count++; 
            } 
        } 
        vec.push_back(count);
        
    } 
     for(int i=0;i<vec.size();i++)
     {
    //     cout<<vec[i]<<" ";
     }
     long long int k=vec.size();
   // cout<<k<<endl;
   
   long long int i=0,j=1,ans=0;
   while(i!=k)
   {
       j=1;
       while(vec[i]>0)
       {
           vec[i]=vec[i]-j;
           //cout<<vec[i]<<" ";
           j++;
           if(vec[i]>=0)
           ans++;
       }
       i++;
       
   }
   cout<<ans<<endl;
   
   
     
        }
        return 0;
    }

Measured memory_bytes: 3660
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long n = sc.nextLong();
        long a = sc.nextLong();
        long b = sc.nextLong();
        long c = sc.nextLong();
        long d = sc.nextLong();
        long e = sc.nextLong();
        long min = Math.min(Math.min(Math.min(Math.min(d, e), c), b), a);
        if (n % min == 0) {
            System.out.println(n / min + 4);
        } else {
            System.out.println(n / min + 5);
        }
    }
}


Measured memory_bytes: 23764
#include <cstdio>
int main() {
	float fm, tm;
	while (scanf("%f%f",&fm,&tm)!=EOF) {
		if (fm<35.5&&tm<71.0) printf("AAA\n");
		else if (fm<37.5&&tm<77.0) printf("AA\n");
		else if (fm<40.0&&tm<83.0) printf("A\n");
		else if (fm<43.0&&tm<89.0) printf("B\n");
		else if (fm<50.0&&tm<105.0) printf("C\n");
		else if (fm<55.0&&tm<116.0) printf("D\n");
		else if (fm<70.0&&tm<148.0) printf("E\n");
		else printf("NA\n");
	}
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
 
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define int long long
#define rep(i,a,b)    for(int i=a;i<b;i++)
#define repn(i,a,b)   for(int i=a;i>=b;i--)
#define F first
#define S second
#define pii pair<int,int>
#define vi vector<int>
#define vii vector<pii>
#define pb push_back
#define mp  make_pair
#define all(v) (v).begin(), (v).end()
#define mod 100000000
#define inf 1e18 
int maxn=1e5;

using namespace std;

signed main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output1.txt", "w", stdout);
    #endif
    
    IOS;
    int n,d;
    cin>>n>>d;
    int count=0;
    d*=d;
    while(n--)
    {
        int x,y;
        cin>>x>>y;
        if(x*x+y*y<=d) count++;
        
    }
    cout<<count;
}

Measured memory_bytes: 3640
import java.util.Scanner;

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

        int N = sc.nextInt();
        int K = sc.nextInt();
        int X = sc.nextInt();
        int Y = sc.nextInt();

        System.out.println(solve(N, K, X, Y));

        sc.close();
    }

    static int solve(int N, int K, int X, int Y) {
        return Math.min(N, K) * X + Math.max(0, N - K) * Y;
    }
}

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

int main(){
  int N; cin >> N;
  int ans;
  if(N < 600) ans = 8;
  else if(N<800) ans = 7;
  else if(N<1000) ans = 6;
  else if(N<1200) ans = 5;
  else if(N<1400) ans = 4;
  else if(N<1600) ans = 3;
  else if(N<1800) ans = 2;
  else ans = 1;
    cout << ans << endl;
  return 0;
  
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define lint long long
#define ll long long
#define pq priority_queue
#define mp make_pair
#define pb push_back
#define vl vector<long long>
#define pii pair<long long,long long>
#define all(x) (x).begin(),(x).end()
#define rep(x) for(int i = 0;i < (x);i++)
#define repj(x) for(int j = 0;j < (x);j++)
#define REP(i,x) for(int (i) = 0;(i) < (x);(i)++)
#define rrep(x) for(int i = (x);i >= 0;i--)
#define mod 1000000007
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
int qp(int a,ll b){int ans=1;do{if(b&1)ans=1ll*ans*a;a=1ll*a*a;}while(b>>=1);return ans;}
int qp(int a,ll b,int mo){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
long long INF = 1e10;

int main(){
    int n;cin >> n;
    vector<int> a(n),b(n);
    rep(n) cin >> a[i]; rep(n) cin >> b[i];
    vector<int> ca(n+1),cb(n+1);
    ca[0] = 0,cb[0] = 0;
    rep(n){ca[i+1]=ca[i]+a[i],cb[i+1]=cb[i]+b[i];}
    int ans = 0;
    rep(n) ans = max(ans,ca[i+1]+cb[n]-cb[i]);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

#define STR_MAX 128
 
int calcSumBiscuit(unsigned char A, unsigned char B, unsigned char T)
{
  int sum = 0;  
  unsigned char i = 0;
  
  for(i=A; i<=T; i+=A){
    sum += B;
  }
 
  return sum;
}
 
 
int main(){
  	int sum = 0;
  
  	char str[STR_MAX];
  	unsigned char A=0, B=0, T=0;
  
	fgets(str, sizeof(str), stdin);
  	sscanf(str, "%d %d %d", &A, &B, &T);
  
  	sum = calcSumBiscuit(A, B, T);
  	printf("%d", sum);
  
	return 0; 
}


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

using namespace std;

using ll = long long;

int main()
{
#ifdef jcg
    assert(freopen("input.in", "r", stdin));
//    assert(freopen("output.out", "w", stdout));
#endif

    ios_base::sync_with_stdio(0);
    cin.tie(0);

    int N;
    cin >> N;

    vector<int> A(N);
    for (int &x : A) cin >> x;

    ll total = 0;
    for (int i = 0; i < N - 1; ++i)
        total = A[i] - total;

    ll x = (A.back() - total) / 2;
    cout << 2 * x;
    for (int i = 0; i < N - 1; ++i)
    {
        x = A[i] - x;
        cout << " " << 2 * x;
    }
    cout << '\n';

    return 0;
}


Measured memory_bytes: 1792