akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
int main(void)
{
        int n,i,a;
        scanf("%d%d",&n,&i);
        if(1>n>100) return 1;
        else if(1>i>n) return 1;

        a=n-i+1;
        printf("%d\n",a);
        return 0;
}


Measured memory_bytes: 128
<?php

while (TRUE) {
    $a = fscanf(STDIN, '%d %d %d %d');
    if (feof(STDIN)) {
        break;
    }
    $b = fscanf(STDIN, '%d %d %d %d');
    $hit = 0;
    $blow = 0;
    $h = array();
    foreach ($a as $v) {
        $h[$v] = TRUE;
    }
    for ($i = 0; $i < 4; $i++) {
        if ($a[$i] === $b[$i]) {
            $hit++;
            continue;
        }
        if (isset($h[$b[$i]])) {
            $blow++;
        }
    }

    echo sprintf('%d %d', $hit, $blow);
    echo PHP_EOL;
}

Measured memory_bytes: 6636
#include <stdio.h>
#define N 100
#define WHITE 0
#define GRAY 1
#define BLACK 2

int n, M[N][N];
int color[N],d[N],f[N],tt;

void dfs_visit(int u){
    int v;
    color[u] = GRAY;
    d[u] = ++tt;
    for(v = 0; v < n; v++){
    	if(M[u][v] == 0)
    	continue;
        if(color[v] == WHITE){
        	dfs_visit(v);
        }
    }
    color[u] = BLACK;
    f[u] = ++tt;
}


void dfs(){
	int u;
	for(u = 0; u < n; u++) color[u] = WHITE;
    tt = 0;

    for(u = 0; u < n; u++){
    	if(color[u] == WHITE) dfs_visit(u);
       
    }

    for(u =0; u < n; u++){
        printf("%d %d %d\n", u + 1, d[u], f[u]);
    }
}


int main(){

    int u, v, k, i, j;

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

    for(i = 0; i < n; i++){
    	scanf("%d %d", &u, &k);
    	u--;
    	for(j = 0; j < k; j++){
    		scanf("%d", &v);
    		v--;
    		M[u][v] = 1;
    	}
    }

    
	dfs();
	return 0;
}

Measured memory_bytes: 636
#ifndef BZ
#pragma GCC optimize "-O3"
#endif
#include <bits/stdc++.h>
#define FASTIO ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
#define rep(i, l, r) for (ll i = (l); i < (r); ++i)
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
#define pii pair<ll, ll>
#define pll pair<ll, ll>
#define pli pair<ll, ll> 
#define pdd pair<ld, ld> 
#define pb push_back
#define reset(x,v) memset(x,v,sizeof(x))
#define mod 1000000007
using namespace std;


int main(){
    FASTIO
    int n;
    cin >> n;
    ll a[n];
    ll s = 0;
    rep(i, 0, n){
    	cin >> a[i];
	}
	if(n == 1){
		cout << 0;
		return 0;
	}
	sort(a, a + n);
	int j = n - 2;
	s = a[n-1];
	n -= 3;
	
	while(n >= 0){
		s += a[j];
//		cout << a[j] << " ";
		n--;
		if(n >= 0){
			s += a[j];
//			cout << a[j] << " ";
			n--;
		}
		j--;
	}
//	cout << endl;
	cout << s;
}

Measured memory_bytes: 5216
long long int pow(long long int a, long long int n){
	if(n == 0){
		return 1;
	}
	else if(n % 2 == 0){
		return pow(a * a, n / 2);
	}
	else{
		return a * pow(a, n - 1);
	}
}

int main(){
	long long int N, K;
	scanf("%lld%lld", &N, &K);
	printf("%lld\n", K * pow(K - 1, N - 1));
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define rep(i,j,k) for(int i=j;i<=k;i++)
using namespace std;
template<typename T> void read(T &num){
	char c=getchar();T f=1;num=0;
	while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}
	while(c>='0'&&c<='9'){num=(num<<3)+(num<<1)+(c^48);c=getchar();}
	num*=f;
}
template<typename T> void qwq(T x){
	if(x>9)qwq(x/10);
	putchar(x%10+'0');
}
template<typename T> void write(T x){
	if(x<0){x=-x;putchar('-');}
	qwq(x);putchar('\n');
}
template<typename T> void chkmin(T &x,T y){x=x<y?x:y;}
int co[100010];

int main(){
	int n;read(n);
	int a=INT_MAX;int k=0;
	rep(i,1,n){read(co[i]);chkmin(a,co[i]);}
	a++;
	rep(i,1,n){
		k+=(co[i]==a-1);
		if(co[i]!=a-1&&co[i]!=a){puts("No");return 0;}
	}
	
	if(k==n){
		puts((a==n||(1<=a-1&&a-1<=n/2))?"Yes":"No");
	}else{puts((k+1<=a&&a<=k+(n-k)/2)?"Yes":"No");}
	return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,k,n) for(int i = (int)(k); i < (int)(n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) a.begin(), a.end()
#define MS(m,v) memset(m,v,sizeof(m))
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;
const int MOD = 1000000007;
const int INF = MOD + 1;
const ld EPS = 1e-12;
template<class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<class T> T &chmax(T &a, const T &b) { return a = max(a, b); }

/*--------------------template--------------------*/

typedef int Weight;
struct Edge
{
	int from, to; Weight cost;
	bool operator < (const Edge& e) const { return cost < e.cost; }
	bool operator > (const Edge& e) const { return cost > e.cost; }
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;
typedef vector<Weight> Array;
typedef vector<Array> Matrix;
void add_edge(Graph &g, int from, int to, Weight cost)
{
	g[from].push_back(Edge{ from, to, cost });
}


int main()
{
	cin.sync_with_stdio(false); cout << fixed << setprecision(10);
	int n, m;
	cin >> n >> m;
	Graph g(n + m);
	REP(i, n)
	{
		int k;
		cin >> k;
		REP(j, k)
		{
			int l; cin >> l; l--;
			add_edge(g, i, n + l, 0);
			add_edge(g, n + l, i, 0);
		}
	}
	vector<bool> vis(n + m);
	queue<int> que;
	que.push(0);
	vis[0] = true;
	while (!que.empty())
	{
		int t = que.front();
		que.pop();
		for (auto i : g[t])
		{
			if (vis[i.to]) continue;
			vis[i.to] = true;
			que.push(i.to);
		}
	}
	bool ans = true;
	REP(i, n)
	{
		if (!vis[i]) ans = false;
	}
	cout << (ans ? "YES" : "NO") << endl;
	return 0;
}

Measured memory_bytes: 9652
#include <bits/stdc++.h>
#define ll long long int
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define pi 3.141592653589793
using namespace std;


int ones(int e) {
    int ans = 0;
    while (e) {
        e &= (e - 1);
        ans++;
    }

    return ans;
}

void f() {
    int q;
    cin >> q;
    set<int> s;
    ll even = 0, odd = 0;
    int e;
    cin >> e;
    q--;
    int p = e;
    int on = ones(e);
    while (q--) {
        int e;
        cin >> e;


    }
}


int main() {
//    cout << setprecision(10);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);


    int l, r;
    cin >> l >> r;
    if (r - l > 3000) {
        cout << 0;
        return 0;
    }

    ll ans = LONG_LONG_MAX;
    for (ll i = l; i <= r; i++) {
        for (ll j = i + 1; j <= r; j++) {
            ans = min(ans, (i * j) % 2019);
        }
    }

    cout << ans;


}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,k;
    cin>>n>>k;
    string a;
    cin>>a;
   if(a[k-1]<97)
   {
       a[k-1]=a[k-1]+32;
   }

   cout<<a<<endl;

    return 0;
}


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

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();}

template<class T> inline T sqr(T x) {return x*x;}

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef long long ll;

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())

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

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const long long INT_INF = 2147483647;
const long long LL_INF = 1LL<<60;
const long long MOD = 1000000007;

#define CLR(a) memset((a), 0 ,sizeof(a))

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

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

int main(void){
    ll N; cin >> N;
    vector<ll> a(N), b(N); REP(i,N) cin >> a[i]; REP(i,N) cin >> b[i];

    ll ans = 0;
    REP(k,30){
        vector<ll> moda(N), modb(N);
        REP(i,N){
            moda[i] = a[i]%(1<<(k+1));
            modb[i] = b[i]%(1<<(k+1));
        }
        SORT(modb);
        ll T = 1<<k, n1 = 0;
        REP(i,N){
            ll t[4];
            REP(j,4){
                ll l=-1, r=N, n=(l+r)/2;
                while(r-l>1){
                    if(modb[n] < (j+1)*T-moda[i]) l = n;
                    else r = n;
                    n = (l+r)/2;
                }
                t[j] = r;
            }
            n1 += t[1]-t[0] + t[3]-t[2];
        }
        ans += (n1%2)*(1<<k);
    }
    cout << ans << endl;
    return 0;
}

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

using namespace std;

typedef double D;
typedef long long int LL;

#define st first
#define nd second
#define pb push_back
#define PII pair <int, int>

const int N = 1e5 + 7;
const int MX = 1e9 + 7;
const LL INF = 1e18 + 7LL;

int n, m;
PII in[N];

int main(){
	scanf("%d %d", &n, &m);
	for(int i = 1; i <= m; ++i){
		scanf("%d %d", &in[i].st, &in[i].nd);
		in[i].st++;
	}

	sort(in + 1, in + m + 1);
	
	int mn = n + 1, res = 0;
	for(int i = 1; i <= m; ++i){
		if(mn < in[i].st){
			++res;
			mn = in[i].nd;
		}
		else
			mn = min(mn, in[i].nd);
	}
	
	printf("%d\n", res + 1);
	return 0;
}

Measured memory_bytes: 1024
import sys
sys.setrecursionlimit(100000000)

n, m = map(int, input().split())
graph = [[] for _ in range(n+1)]
visited = [False for _ in range(n+1)]

# print("graph is : ", graph)
# print("visited is : ", visited)
def dfs(node):
    visited[node] = True
    ret = 0
    for child in graph[node]:
        if not visited[child]:
            ret += dfs(child)
    return ret + 1


for _ in range(m):
    a, b = map(int, input().split())
    graph[a].append(b)
    graph[b].append(a)

rets = []
for node in range(1, n+1):
    if not visited[node] :
        counts = dfs(node)
        rets.append(counts)
print(max(rets))

Measured memory_bytes: 210692
n = int(input())
A = [int(input())-1 for i in range(n)]
B = [False] * n
ans = 0
i = 0
while True:
    if B[i] is True:
        print(-1)
        break
    else:
        B[i] = True
    
    ans += 1
    if A[i] != 1:
        i = A[i]
    else:
        print(ans)
        break

Measured memory_bytes: 7852
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

from itertools import chain
from functools import reduce
from collections import OrderedDict, Counter, deque
import operator

n, m = map(int, input().split())

t = Counter()
for _ in range(n):
    t += Counter(input().split()[1:])

print(sum(v == n for v in t.values()))

Measured memory_bytes: 3568
#include<stdio.h>

int main()
{
    long long n, m;
    scanf("%lld%lld", &n, &m);
    if(2*n>=m)
        printf("%lld\n", m/2);
    else
    {
        long long s=0;
        s+=n;
        m-=2*n;
        s+=m/4;
        printf("%lld\n", s);
    }
    return 0;
}


Measured memory_bytes: 128
N, M = map(int, input().split())
lst_X = sorted(list(map(int, input().split())))

if N>=M:
    print(0)
else:
    lst_diff = []
    for i in range(M-1):
        diff = abs(lst_X[i] - lst_X[i+1])
        lst_diff.append(diff)
    lst_diff.sort(reverse=True)
    print(sum(lst_diff[N-1:]))



Measured memory_bytes: 13960
#include <bits/stdc++.h>
 
#define pb push_back
#define pf push_front
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
 
using namespace std;
 
typedef long long llong;
typedef unsigned long long ullong;
 
const int MXN = (int)2e5 + 7; 
const int MOD = 998244353; 
const llong INF = (llong)1e18 + 7;
 
inline void boost(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
}

int n, dp[MXN], m;
vector <int> g[MXN];

void dfs(int v){
	for(int to : g[v]){
		if(!dp[to]) dfs(to);
		dp[v] = max(dp[v], dp[to] + 1);
	}
}

int main(){
	ios_base::sync_with_stdio(0);
	cin >> n >> m; 
	for(int i = 1; i <= m; i++){
		int u, v; 
		cin >> u >> v;
		g[u].pb(v);
	}
	for(int i = 1; i <= n; i++){
		if(!dp[i]) dfs(i);
	}
	int mx = 0;
	for(int i = 1; i <= n; i++) mx = max(mx, dp[i]);
	cout << mx;	
	return 0;	
}

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

int main() {
    int n, l;
    scanf("%d%d", &n, &l);
    int abs_small = 10000, sum = 0, k;
    for(int i = 0; i < n; i++){
        sum += l+i;
        if(abs(l+i) < abs_small){
            abs_small = abs(l+i);
            k = l+i;
        }
    }
    printf("%d", sum - k);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define dofloat cout<<fixed<<setprecision(8)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define bitcount __builtin_popcount
#define all(vec) vec.begin(),vec.end()
#define rall(vec) vec.rbegin(),vec.rend()
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<long long> vl;
typedef pair<long long,long long> pll;
typedef vector<pair<long long,long long> > vll;
typedef vector<pair<int,int> > vii;
typedef vector<int> vi;
typedef pair<int,int> ii;
const long long MOD=1000000007;
const long long MAX=100005;
const long double PI=3.14159265359;
const long double G=9.807;
const long long INF=1e18;
const long double EPS=1e-6;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
bool isprime(ll a){
  if(a==2)return 1;
  if(!(a&1))return 0;
  for(ll i=3;i*i<=a;i+=2)
    if(a%i==0)return 0;
  return 1;
}
ll mpow(ll base,ll exponent,ll modulus){
  if(modulus==1)return 0;
  long long result = 1;
  base=base%modulus;
  while(exponent){
    if(exponent%2 == 1)
	  result=(result*base)%modulus;
	  exponent=exponent>>1;
	  base=(base*base)%modulus;
  }
  return result;
}
ll minv(ll a,ll mod){
  ll _gcd=gcd(a,mod);
  assert(_gcd==1);
  return mpow(a,mod-2,mod);
}


/*
ll ncr(ll N,ll K){
	if(N<K)return 0;
	if(K==0)return 1;
	if(N==0)return 0;

	ll den=1;
	for(ll i=1;i<=K;i++)den*=i;
	ll num=1;
	while(K--){
		num*=N;
		if(num%den==0){
			num/=den;
			den=1;
		}
		N--;
	}

	return num;
}
*/
ll n;
int main(){FAST;
cin>>n;
ll ans = 0;
for(int i=1;i<=9;i++){
	if(n%i == 0){
		ll x = n/i;
		if(x<=9)ans=1;
	}
}
if(ans)cout<<"Yes";
else cout<<"No";
return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define l_ength size
const int inf = (1<<30);
const int mod = 1000000007; // 998244353
using ll = long long;
using namespace std;

const int red = 1, green = 2, blue = 4;

ll sum[10][4010];

int main(){
	int n; cin >> n;
	string s; cin >> s;
	vector<int> seq;
	for( char c : s ){
		if( c == 'R' ) seq.push_back(red);
		if( c == 'G' ) seq.push_back(green);
		if( c == 'B' ) seq.push_back(blue);
	}
	for( int i = 0; i < n; ++i ){
		for( int color = red; color <= blue; color <<= 1 ){
			sum[color][i+1] = sum[color][i];
		}
		sum[seq[i]][i+1] += 1;
	}
	ll ans = 0;
	for( int left = 0; left < n-2; ++left ){
		for( int right = left+2; right < n; ++right ){
			if( seq[left] == seq[right] ) continue;
			int needed_c = 7 - seq[left] - seq[right];
			ans += ( sum[needed_c][right] - sum[needed_c][left+1] );
			if( (right-left)%2 == 0 and seq[(left+right)/2] == needed_c ) ans -= 1;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 3728
class UnionFind:
    def __init__(self, n):
        self.par = [i for i in range(n + 1)]
        self.rank = [0] * (n + 1)
        self.size = [1] * (n + 1)

    def find(self, x):
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]

    def same_check(self, x, y):
        return self.find(x) == self.find(y)

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if self.rank[x] < self.rank[y]:
            if self.same_check(x, y) != True:
                self.size[y] += self.size[x]
                self.size[x] = 0
            self.par[x] = y
        else:
            if self.same_check(x, y) != True:
               self.size[x] += self.size[y]
               self.size[y] = 0
            self.par[y] = x
            if self.rank[x] == self.rank[y]:
               self.rank[x] += 1

    def siz(self, x):
        x = self.find(x)
        return self.size[x]

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

N, M = getlist()
X = []
for i in range(M):
	A, B = getlist()
	X.append([A, B])

ansL = [0]
ans = 0
UF = UnionFind(N)
for i in range(M - 1):
	x, y = X[-1 - i][0], X[-1 - i][1]
	if UF.same_check(x, y) != True:
		a = UF.size[UF.find(x)]
		b = UF.size[UF.find(y)]
		ans -= a * (a - 1) // 2 + b * (b - 1) // 2
		UF.union(x, y)
		ans += (a + b) * (a + b - 1) // 2
	ansL.append(ans)
	
for i in range(M):
	print(N * (N - 1) // 2 - ansL[-1 - i])

Measured memory_bytes: 29688
#include <bits/stdc++.h>
#include <cmath>
#include <numeric>
using namespace std;
using ll=long long;
#define rep(i,a,b) for(int i=(a); i<(b); ++i) // a ≦ i < b 
#define Rrep(i,a,b) for(int i=(a);i>=(b);--i) // reverse repeat. a から b まで減少．
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend() //逆イテレータ
#define RANGE(a,b,c) (a).begin()+b,(a).begin()+c // コンテナ a の 要素 b から c へのイテレータ
// typedef
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<PII> VP;

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

cout << max({a+b, a-b, a*b}) << "\n";

return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<queue>
#include <limits>
using namespace std;
#define N 100

int inf = numeric_limits<int>::max();
int n, M[N][N], d[N];

void bfs(int s) {
    queue<int> q;
    q.push(s);
    for (int i; i<n; i++) {
        d[i] = inf;
    }
    d[s] = 0;
    int u;
    while (!q.empty()) {
        u = q.front(); // Get the first element
        q.pop();
        for (int v=0; v<n; v++) {
            if (M[u][v]==0) {
                continue;  
            }
            if (d[v]!=inf) {
                // Already visited
                continue;
            }
            d[v] = d[u] +1;
            q.push(v);
        }
    }
    for (int i=0; i<n; i++) {
        if (d[i]!=inf) {
            cout << i+1 << " " << d[i] << endl;
        } else {
            cout << i+1 << " " << -1 << endl;
        }
    }
}

int main() {
    int u, k, tmp;
    cin >> n;
    for (int i=0; i<n; i++) {
        for (int j=0; j<n; j++) {
            M[i][j] = 0;
        }
    }
    // Directed graph
    for (int i=0; i<n; i++) {
        cin >> u >> k;
        for (int j=0; j<k; j++) {
            cin >> tmp;
            M[u-1][tmp-1] = 1;
        }
    }

    bfs(0);
    return 0;
}


Measured memory_bytes: 3140
#include<bits/stdc++.h>
using namespace std;
const int INF=2E5;
typedef pair<int,int> Pair;

int main(){
    int N;
    string s;
    string march="MARCH";
    long long A[5]={};
    long long ans=0;
    cin >> N;
    for(int i=0;i<N;i++){
        cin >> s;
        for(int j=0;j<5;j++){
            if(s[0]==march[j]){
                A[j]++;
                break;
            }
        }
    }
    long long K1=0,K2=0,K3=0;
    for(int i=0;i<5;i++){
        K1+=A[i];
        K2+=A[i]*A[i];
        K3+=A[i]*A[i]*A[i];
    }
    ans=0;
    ans=(K1*K1*K1-K3-3*(K2*K1-K3))/6;

    cout << ans << endl;
}


Measured memory_bytes: 256
#include <cstdio>

int main(){
	int sum = 0;
	for(int i = 0; i < 4; ++i){
		int in;
		scanf("%d", &in);
		sum += in;
	}
	printf("%d\n", sum / 60);
	printf("%d\n", sum % 60);
	return 0;
}

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

int main(){
  long long a,b,c,k,s;
  cin >> a >> b >> c >> k;
  if(k%2==0)
    s = a-b;
  else
    s = b-a;
  if(s>pow(10,18))
  	cout << "Unfair" << endl;
  else
    cout << s << endl;
}


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


bool is_int_lround(double x){
  return static_cast<std::int32_t>(x)==x;
}

int main(void){
    // Your code here!
    int n,count=0;
    cin >> n;

    for (int c=1;c<n;c++){
        double nc = n-c;
        for(double a =1;a<=sqrt(nc);a++){
            double b = nc/a;
            //cout << a<<b << endl;
            if(is_int_lround(b)){
              count+=2;
              if(a==b) count--;
              //cout << "y" << endl;
            }
        }
    }
    cout << count << endl;
}


Measured memory_bytes: 3672
#include <bits/stdc++.h>
using namespace std;
void Trace(int*, int);

int main(void){
	int n;
	int a[200];
	cin >> n;
	for(int i=0; i<n; i++){
		cin >> a[i];
	}

	Trace(a, n);

	for(int i=1; i<n; i++){
		int key = a[i];
		int j = i-1;
		while(j >= 0 && key < a[j]){
			a[j+1] = a[j];
			j--;
		}
		a[j+1] = key;

		Trace(a, n);
	}

	return 0;
}

void Trace(int* a, int n){
	for(int i=0; i<n; i++){
		if(i!=n-1)printf("%d ", a[i]);
		else printf("%d\n", a[i]);
	}
}

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

int main() {
  int N;
  cin >> N;
  vector<int>a(N);
  
  for(int i=0; i<N; i++){
    cin >> a.at(i);
  }
  
  sort(a.begin(), a.end());
  reverse(a.begin(), a.end());
  
  int ans=0;
  for(int i=0; i<N; i++){
    if(i%2==0){
      ans += a.at(i);
    }
    else{
      ans-=a.at(i);
    }
  }
  
  cout << ans << endl;
  
}


Measured memory_bytes: 3624
#include<iostream>
#include<stdlib.h>
#include<stdio.h>
#include<string.h>
#include<cstdio>
#include<cstring>
#include<math.h>
#include<vector>
#include<map>
#include<algorithm>
using namespace std;
int a[100010],b[100010];
int main(void)
{
     int n,m,k,i,j;
     memset(b,0,sizeof(b));
     scanf("%d",&n);
     for(i=0;i<n;i++)
     {
          scanf("%d",&a[i]);
          b[a[i]-1]++;
          b[a[i]]++;
          b[a[i]+1]++;
     }
     k=0;
     for(i=0;i<100001;i++)
     {
          if(b[i]>k)
               k=b[i];
     }
     printf("%d\n",k);
     return 0;
}


Measured memory_bytes: 1024
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;
const ll MOD = 1000000007LL;

class Combination {
public:
    vector <ll> fac, inv, fiv;
    Combination(int N) : fac(N + 1), inv(N + 1), fiv(N + 1) {
        fac[0] = inv[0] = fiv[0] = fac[1] = inv[1] = fiv[1] = 1;
        for (ll i = 2; i <= N; i++) {
            fac[i] = fac[i - 1] * i % MOD; // n!
            inv[i] = inv[MOD % i] * (MOD - MOD / i) % MOD; // n^-1
            fiv[i] = fiv[i - 1] * inv[i] % MOD; // (n!)^-1
        }
    }
    ll C(ll n, ll k) {
        if (k < 0 || n < k) return 0;
        return fac[n] * fiv[k] % MOD * fiv[n - k] % MOD;
    }
    ll P(ll n, ll k) {
        if (k < 0 || n < k) return 0;
        return fac[n] * fiv[n - k] % MOD;
    }
    ll H(ll n, ll k) {
        if (n == 0 && k == 0) return 1;
        return C(n + k - 1, k - 1);
    }
};

int main() {
    ll n, m, K;
    cin >> n >> m >> K;

    ll tate = 0;
    for (ll i = 1; i < m; i++) (tate += i * (m - i)) %= MOD;
    tate = n * n % MOD * tate % MOD;

    ll yoko = 0;
    for (ll i = 1; i < n; i++) (yoko += i * (n - i)) %= MOD;
    yoko = m * m % MOD * yoko % MOD;

    Combination Com(200005);
    cout << (yoko + tate) * Com.C(n * m - 2, K - 2) % MOD << "\n";
    return 0;
}

Measured memory_bytes: 4992
N = int(input())
X = input()

mem = dict()
def find(n):
    if n == 0 :
        return 0
    elif n in mem :
        return mem[n]

    cur = n 
    bit_count = 0
    while cur > 0 :
        bit_count += cur%2
        cur //= 2

    if bit_count == 1 : 
        mem[n] = 1
    else :
        mem[n] = 1+find(n%bit_count)
    return mem[n] 

bit_count = sum([ int(x) for x in X ])

dp = [ [0]*N for _ in range(2)]   
def build_dp(j, v):
    if v == 0:
        return 
    st = 1
    _dp = dp[j]
    for i in range(N-1,-1,-1):
        _dp[i] = st%v
        st = (st*2)%v

build_dp(0, bit_count-1)
build_dp(1, bit_count+1)

base = [0]*2
k = 0
for v in [bit_count-1, bit_count+1]:
    st = 1 
    if v == 0 :
        continue
    for i in range(N-1,-1,-1):
        if X[i] == '1' :
            base[k] = (base[k]+st)%v
        st = (st*2)%v
    k += 1

for i in range(0,N):
    if X[i] == '1' :
        if bit_count-1 == 0 :
            print(0)
        else :
            value = (base[0]-dp[0][i]+bit_count-1) % (bit_count-1)
            print(1+find(value))
    else :
        value = (base[1]+dp[1][i]+bit_count+1) % (bit_count+1)
        print(1+find(value))
        

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

# define REP(i,n) for (int i=0;i<(n);++i)
# define rep(i,a,b) for(int i=a;i<(b);++i)
# define p(s) std::cout << s ;
# define pl(s)  std::cout << s << endl;
# define printIf(j,s1,s2) cout << (j ? s1 : s2) << endl;
# define YES(j) cout << (j ? "YES" : "NO") << endl;
# define Yes(j) std::cout << (j ? "Yes" : "No") << endl;
# define yes(j) std::cout << (j ? "yes" : "no") << endl;
# define all(v) v.begin(),v.end()
# define showVector(v) REP(i,v.size()){p(v[i]);p(" ")} pl("")
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 long long int ll;
typedef pair<ll,ll> P_ii;
typedef pair<double,double> P_dd;

template<class T>
vector<T> make_vec(size_t a){
    return vector<T>(a);
}

template<class T, class... Ts>
auto make_vec(size_t a, Ts... ts){
  return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

template<typename T,typename V>
typename enable_if<is_class<T>::value==0>::type
fill_v(T &t,const V &v){t=v;}

template<typename T,typename V>
typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t,const V &v){
  for(auto &e:t) fill_v(e,v);
}


const int MOD = 1000000007;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;

void addM(long long &a, long long b) {
    a += b;
    if (a >= MOD) a -= MOD;
}

void mulM(long long &a, long long b) {
    a = ((a%MOD)*(b%MOD))%MOD ;
}

// a^b mod M
long myPow(long a,long b,int M) {
    long ret = 1;
    long tmp = a;
    while(b>0) {
        if((b&1)==1) ret = (ret * tmp) % M;
        tmp = (tmp * tmp) % M;
        b = b>>1;
    }
    return ret;
}

 // nCk mod M
int nCk(int n,int k,int M) {
    long ret = 1;
    int mi = min(k, n-k);
    for(int i=1;i<=mi;i++) {
        ret = (ret * myPow(i,M-2,M)) % M;
    }
    for(int i=n-mi+1;i<=n;i++) {
        ret = (ret * i) % M;
    }
    return (int)ret;
};

int main() {
    ll N,X;cin >> N >> X;

    vector<ll> L(N+1),P(N+1);
    L[0]=1;
    P[0]=1;
    REP(i,N){
        L[i+1] = L[i]*2+3;
        P[i+1] = P[i]*2+1;        
    }

    ll ans=0;
    ll now_x=1;
    ll now_n=N-1;
    while(1){
        if(now_x == X) {
            // 左端のB
            break;

        } else if(now_x + L[now_n] >= X) {
            // 左側のL-1
            now_x += 1;
            now_n -= 1;            
            if(now_n < 0) {
                ans += 1;
                break;
            }

        } else if (now_x + L[now_n] + 1 == X){
            // 中央のP
            ans += P[now_n] + 1;
            break;

        } else if (now_x + L[now_n] + 1 + L[now_n] >= X){
            // 右側のL-1
            ans += P[now_n] + 1;
            now_x += 1 + L[now_n] + 1;
            now_n -= 1;            
            if(now_n < 0) {
                ans += 1;
                break;
            }

        } else {
            // 右端のB
            ans += P[now_n] + 1 + P[now_n];
            break;
        } 
    }

    pl(ans)

    return 0;
}

Measured memory_bytes: 256
/**
*    author:  yuya1234
*    created: 26.06.2020 13:30:29
**/

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

#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--)

#define SORT(s) sort((s).begin(),(s).end())
#define SORTD(s) sort((s).rbegin(),(s).rend())
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

#define SZ(x) ((int)(x).size())
#define MEMSET(v, h) memset((v), h, sizeof(v))

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

    int a,b,c,d,e,f;
    cin>>a>>b>>c>>d>>e>>f;
    double ee=100*(double)e/(100+e);

    vector<int> v;

    REP(i,f-i*100*a+1)
    {
        REP(j,f-i*100*a-j*b*100+1)
        {
            v.push_back((i*a+j*b)*100);
        }
    }

    SORT(v);
    UNIQUE(v);

    int ansAB=v[1],ansB=0,sumA=0,sumB=0;
    double sumN=0.0,ansMax=0.0;

    FOR(i,1,SZ(v)-1)
    {
        sumA=v[i];
        REP(j,f-sumA+1)
        {
            REP(k,f-sumA+1)
            {
                sumB=j*c+k*d;
                if(sumB==0)continue;
                sumN=100*(double)sumB/(sumA+sumB);
                if(ee>=sumN && f>=sumA+sumB)
                {
                    if(ansMax<sumN)
                    {
                        ansAB=sumA+sumB;
                        ansB=sumB;
                        ansMax=sumN;
                        k=0;
                    }
                }
                else break;
            }
        }
    }

    cout<<ansAB<<" "<<ansB<<endl;

    return 0;
}

Measured memory_bytes: 3604
#include <stdio.h>

int main()
{
	int A, B;
	
	scanf("%d %d", &A, &B);

	if(A % 3 == 0 || B % 3 == 0 || (A + B) % 3 == 0) {
		puts("Possible");
	} else {
		puts("Impossible");
	}
  
	return(0);
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define int long long int
#define double long double
#define inf (int)(1e15)
#define all(x) (x).begin(), (x).end()
#define pair pair<int, int>
typedef vector<int> vi;   // Vector of long long
typedef vector<vi> vvi;   // Vector of vi
typedef vector<pair> vii; // Vector of pairs
typedef vector<vii> vvii; // Vector of Vector of pairs
typedef vector<bool> vb;  // Vector of bool
#define pq priority_queue // Max heap (To convert to min heap, use negative sign before every value)
#define ff first          // For pairs
#define ss second
const int dx4[] = {1, 0, -1, 0}, dy4[] = {0, -1, 0, 1};
const int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1}, dy8[] = {1, -1, 1, 0, -1, 1, -0, -1};
#define testcases(t) \
    int(t);          \
    cin >> (t);      \
    while ((t)--)
signed main()
{
    int h, n, newHealth;
    cin >> h >> n;
    int a[n + 1], b[n + 1];
    for (int i = 1; i <= n; i++)
    {
        cin >> a[i] >> b[i];
    }
    int dp[n + 1][h + 1];
    for (int i = 0; i <= n; i++)
    {
        for (int j = 0; j <= h; j++)
        {
            if (j == 0)
                dp[i][j] = 0;
            else if (i == 0)
                dp[i][j] = inf;
            else
            {
                newHealth = j - a[i];
                if (newHealth < 0)
                    newHealth = 0;
                dp[i]
                  [j] = min(dp[i][newHealth] + b[i], dp[i - 1][j]);
            }
        }
    }
    cout << dp[n][h] << endl;
    return 0;
}

Measured memory_bytes: 78464
import java.util.*;
import java.io.*;
import java.math.*;
 
public class Main
{
    static int l_eq(long x,long arr[],int l,int r){
        int ret=0;
        while(l<=r){
            int mid=l+(r-l)/2;
            if(arr[mid]<=x){
                ret=mid;
                l=mid+1;
            }
            else
                r=mid-1;
        }

        return ret;
    }

    public static void process()throws IOException
    {
        int n=ni(),m=ni(),k=ni(),res=0;

        long a[]=new long[n+1],b[]=new long[m+1];
        for(int i=1;i<=n;i++) a[i]=a[i-1]+nl();
        for(int i=1;i<=m;i++) b[i]=b[i-1]+nl();

        for(int i=0;i<=n;i++){
            if(a[i]>k)
                break;

            long rem=k-a[i];

            int idx=l_eq(rem,b,0,m);
            res=Math.max(res, i+idx);
        }

        for(int i=0;i<=m;i++){
            if(b[i]>k)
                break;

            long rem=k-b[i];

            int idx=l_eq(rem,a,0,n);
            res=Math.max(res, i+idx);
        }

        pn(res);
    }
 
 
    static FastReader sc;
    static PrintWriter out;
    public static void main(String[]args)throws IOException
    {
        out = new PrintWriter(System.out);
        sc=new FastReader();
 
        long s = System.currentTimeMillis();
        int t=1;
        //t=ni();
        while(t-->0)
            process();
 
        out.flush();
        System.err.println(System.currentTimeMillis()-s+"ms");
    }
    
    
    static void pn(Object o){out.println(o);}
    static void p(Object o){out.print(o);}
    static int ni()throws IOException{return Integer.parseInt(sc.next());}
    static long nl()throws IOException{return Long.parseLong(sc.next());}
    static double nd()throws IOException{return Double.parseDouble(sc.next());}
    static String nln()throws IOException{return sc.nextLine();}
    static long gcd(long a, long b)throws IOException{return (b==0)?a:gcd(b,a%b);}
    static int gcd(int a, int b)throws IOException{return (b==0)?a:gcd(b,a%b);}
    static int bit(long n)throws IOException{return (n==0)?0:(1+bit(n&(n-1)));}
    
    static long mod=(long)1e9+7l;
    
/////////////////////////////////////////////////////////////////////////////////////////////////////////
    static class FastReader{ 
        BufferedReader br; 
        StringTokenizer st; 
  
        public FastReader(){ 
            br = new BufferedReader(new InputStreamReader(System.in)); 
        } 
  
        String next(){ 
            while (st == null || !st.hasMoreElements()){ 
                try{ st = new StringTokenizer(br.readLine()); } catch (IOException  e){ e.printStackTrace(); } 
            } 
            return st.nextToken(); 
        } 
  
        String nextLine(){ 
            String str = ""; 
            try{ str = br.readLine(); } catch (IOException e) { e.printStackTrace(); } 
            return str; 
        } 
    } 
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
}

Measured memory_bytes: 64220
is_easy = True
S = input()
for i in range(len(S)):
    if (i+1) % 2 == 0 and S[i] != "R":
        pass
    elif (i+1) % 2 == 1 and S[i] != "L":
        pass
    else:
        is_easy = False
        break

if is_easy:
    print("Yes")
else:
    print("No")



Measured memory_bytes: 38256
#include <iostream>
#include <cstdio>
#include <algorithm>
#define N 100005
using namespace std;

typedef long long ll;
ll n, m, Q, u1, u2, x, x1[N], x2[N], a[N], b[N];
ll ab(ll p) {return p > 0 ? p : -p;}
int main()
{
	ll i, j, t;
	cin >> n >> m >> Q;
	a[0] = -1e18;
	a[n + 1] = 1e18;
	for (i = 1; i <= n; i++) {
		scanf ("%lld", &a[i]);
	}
	b[0] = -1e18;
	b[m + 1] = 1e18;
	for (i = 1; i <= m; i++) {
		scanf ("%lld", &b[i]);
	}
	for (i = 1; i <= n; i++) {
		t = upper_bound(b, b + m + 1, a[i]) - b;
		x1[i] = min(ab(a[i] - b[t]), ab(a[i] - b[t - 1]));
	}
	for (i = 1; i <= m; i++) {
		t = upper_bound(a, a + n + 1, b[i]) - a;
		x2[i] = min(ab(b[i] - a[t]), ab(b[i] - a[t - 1]));
	}
	while (Q--) {
		scanf ("%lld", &x);
		t = upper_bound(a, a + n + 1, x) - a;
		u1 = min(ab(a[t] - x) + x1[t], ab(a[t - 1] - x) + x1[t - 1]);
		t = upper_bound(b, b + m + 1, x) - b;
		u2 = min(ab(b[t] - x) + x2[t], ab(b[t - 1] - x) + x2[t - 1]);
		printf("%lld\n", min(u1, u2));
	}
    return 0;
}


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

const int maxN = 5005, mod = 1e9 + 7;

int n, A, B;
int f[maxN + 1][2], g[maxN + 1][2], h[maxN + 1];

inline int ADD(int x, int y) { return x + y >= mod ? x + y - mod : x + y; }

inline int SUB(int x, int y) { return x - y < 0 ? x - y + mod : x - y; }

int main()
{
	scanf("%d %d %d", &n, &A, &B);

	if(A > B) swap(A, B);

	g[1][1] = 1;
	for(int i = 2; i <= B - 1; i++)
	{
		g[i][1] = ADD(g[i - 1][0], g[i - 1][1]);
		for(int j = A; j <= i; j++)
			g[i][0] = ADD(g[i][0], g[i - j][1]);
	}

	for(int i = A + 1; i <= B - 1; i++) h[i] = ADD(h[i - 1], g[i - A][1]);

	f[0][0] = f[0][1] = 1;
	for(int i = 1; i <= n; i++)
	{
		for(int j = 1; j <= min(i, A - 1); j++) f[i][0] = ADD(f[i][0], f[i - j][1]);
		for(int j = 1; j <= min(i, B - 1); j++)
		{
			if(i == n) f[i][1] = ADD(f[i][1], 1ll * f[i - j][0] * g[j][0] % mod);
			if(j == i) f[i][1] = ADD(f[i][1], 1ll * f[i - j][0] * h[j] % mod); 
			f[i][1] = ADD(f[i][1], 1ll * f[i - j][0] * g[j][1] % mod);
		}
	}

	int ans = 1;
	for(int i = 1; i <= n; i++) ans = 2ll * ans % mod;
	ans = SUB(ans, ADD(f[n][0], f[n][1]));

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


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

int main() {
  int N, M;
  cin >> N >> M;
  vector<int> city(N);
  
  for (int i = 0; i < M; i++) {
    int a, b;
    cin >> a >> b;
    city.at(a-1)++;
    city.at(b-1)++;
  }
  
  for (int i = 0; i < N; i++) {
    cout << city.at(i) << endl;
  }
}


Measured memory_bytes: 256
#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 INF = 1 << 30;
const ll LLINF = 1LL << 60;

int dx[] = {0, -1, 0, 1};
int dy[] = {1, 0, -1, 0};

int mod = 1000000007;

int main(void){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int H, W;
    cin >> H >> W;
    bool visited[H][W]; rep(i, H) rep(j, W) visited[i][j] = false;
    string grid[H]; rep(i, H) cin >> grid[i];
    pair<P, int> st; st.first = make_pair(0, 0); st.second = 1;
    queue<pair<P, int>> que;
    que.push(st);

    int cnt_wall = 0; rep(i, H) rep(j, W) if(grid[i][j] == '#') cnt_wall++;
    visited[0][0] = true;
    while(!que.empty()){
        pair<P, int> op = que.front();
        que.pop();
        int X = op.first.first, Y = op.first.second, d = op.second;
        if(X == H-1 && Y == W-1){
            cout << H*W - cnt_wall - d << endl;
            return 0;
        }
        rep(i, 4){
            int nx = X+dx[i], ny = Y+dy[i];
            if(0 <= nx && nx < H && 0 <= ny && ny < W && grid[nx][ny] == '.'){
                if(!visited[nx][ny]){
                    visited[nx][ny] = true;
                    que.push(make_pair(make_pair(nx, ny), d+1));
                }
            } 
        }
    }
    cout << -1 << endl;
    return 0;
}

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

using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int e, y;
    cin >> e >> y;
    if (e == 0) {
        if (1868 <= y && y <= 1911) {
            cout << 'M' << y - 1867 << '\n';
        } else if (1912 <= y && y <= 1925) {
            cout << 'T' << y - 1911 << '\n';
        } else if (1926 <= y && y <= 1988) {
            cout << 'S' << y - 1925 << '\n';
        } else {
            cout << 'H' << y - 1988 << '\n';
        }
    }
    if (e == 1) {
        cout << y + 1867 << '\n';
    }
    if (e == 2) {
        cout << y + 1911 << '\n';
    }
    if (e == 3) {
        cout << y + 1925 << '\n';
    }
    if (e == 4) {
        cout << y + 1988 << '\n';
    }
}


Measured memory_bytes: 3188
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			int a = scanner.nextInt();
			int b = scanner.nextInt();
			for (int i = 1; i <= 1000; i++) {
				if ((i * 8 / 100 == a) && (i / 10 == b)) {
					System.out.println(i);
					return;
				}
			}
			System.out.println(-1);
		}
	}
}


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

int main() {
	int h, w; cin >> h >> w;
	vector<int> a(26, 0);
	REP(i, h * w) {
		char c; cin >> c;
		a[c - 'a']++;
	}
	int cnt1, cnt2;
	cnt1 = cnt2 = 0;
	for (auto x : a) {
		if (x % 2 == 1) cnt1++;
		if (x % 4 == 2) cnt2++;
	}
	bool ok = false;
	if (h % 2 && w % 2)
		ok = (cnt1 == 1 && cnt2 <= (h / 2) + (w / 2));
	else if (h % 2 == 0 && w % 2 == 0)
		ok = (cnt1 == 0 && cnt2 == 0);
	else if (h % 2 == 0 && w % 2)
		ok = (cnt1 == 0 && cnt2 <= h / 2);
	else if (h % 2 && w % 2 == 0)
		ok = (cnt1 == 0 && cnt2 <= w / 2);
	cout << (ok ? "Yes" : "No") << '\n';
	return 0;
}

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

int main(){
    int a,b;
    int i;
    scanf("%d %d",&a,&b);
    if(a>=b){
        for(i=0;i<a;i++){
            printf("%d",b);
        }
    }
    else{
        for(i=0;i<b;i++){
            printf("%d",a);
        }
    }
    return 0;
}



Measured memory_bytes: 128
import java.io.*;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {

    static class Task {

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int[] arr = new int[5];
            for (int i = 0; i < 5; i++) {
                arr[i] = in.nextInt();
            }


            for (int i = 0; i < 5; i++) {
                if (arr[i] != i + 1) {
                    out.println(i + 1);
                    return;
                }
            }
        }
    }

    private static void sort(double[] arr) {
        Double[] objArr = Arrays.stream(arr).boxed().toArray(Double[]::new);
        Arrays.sort(objArr);
        for (int i = 0; i < arr.length; i++) {
            arr[i] = objArr[i];
        }
    }

    private static void sort(int[] arr) {
        Integer[] objArr = Arrays.stream(arr).boxed().toArray(Integer[]::new);
        Arrays.sort(objArr);
        for (int i = 0; i < arr.length; i++) {
            arr[i] = objArr[i];
        }
    }

    private static void sort(long[] arr) {
        Long[] objArr = Arrays.stream(arr).boxed().toArray(Long[]::new);
        Arrays.sort(objArr);
        for (int i = 0; i < arr.length; i++) {
            arr[i] = objArr[i];
        }
    }

    private static void solve() {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Task task = new Task();
        task.solve(1, in, out);
        out.close();
    }

    public static void main(String[] args) {
        new Thread(null, () -> solve(), "1", 1 << 26).start();
    }

    static class InputReader {

        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

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

        public long nextLong() {
            return Long.parseLong(next());
        }

        public double nextDouble() {
            return Double.parseDouble(next());
        }

    }

}

Measured memory_bytes: 33892
a,b,c = map(int,input().split(" "))
count = 0
sr = []
for i in range(1,a+1):
    ar = list(str(i))
    for r in ar:
        count += int(r)
    if count >= b and count <= c:
        sr.append(i)
    count = 0
print(sum(sr))


Measured memory_bytes: 3296
r=0
m=9
c=0
for i in range(5):
    t=int(input())
    h=int(str(t)[-1])
    if h==0:
        r+=t
        c+=1
    else:
        t=(t+10-1)//10*10
        r+=t
        m=min(m,h)
if c==5:
    print(r)
else:
    print(r-10+m)

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

int digits(long long x) {
  int y;
  for(int i = 0; i < 20; i++) {
    if(x >= pow(10, i) && x < pow(10, (i + 1))) {
      y = i + 1;
      return y;
    }
  }
       }
int main() {
 long long N;
  cin >> N;
  
  int res = 1000000;
  for(int i = 1; i < sqrt(N) + 1; i++) {
    if(N % i == 0) {
    res = min(res, max(digits(i), digits(N / i)));
              }
              }
              
              cout << res << endl;

  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

#define UNION_FIND_MAX 100

int uf_table[UNION_FIND_MAX];

void uf_init(void) {
	int i;
	for(i=0;i<UNION_FIND_MAX;i++)uf_table[i]=0;
}

void uf_merge(int a,int b) {
	int next;
	while(uf_table[a]>0) {
		next=uf_table[a]-1;
		if(uf_table[next]>0)uf_table[a]=uf_table[next];
		a=next;
	}
	while(uf_table[b]>0) {
		next=uf_table[b]-1;
		if(uf_table[next]>0)uf_table[b]=uf_table[next];
		b=next;
	}
	if(a!=b)uf_table[a]=b+1;
}

int uf_issame(int a,int b) {
	int next;
	while(uf_table[a]>0) {
		next=uf_table[a]-1;
		if(uf_table[next]>0)uf_table[a]=uf_table[next];
		a=next;
	}
	while(uf_table[b]>0) {
		next=uf_table[b]-1;
		if(uf_table[next]>0)uf_table[b]=uf_table[next];
		b=next;
	}
	return a==b;
}

typedef struct {
	int from,to;
	double cost;
} edge_t;

typedef struct {
	double x,y,z,r;
} node_t;

int qsort_comp(const void* x,const void* y) {
	const edge_t* a=(const edge_t*)x;
	const edge_t* b=(const edge_t*)y;
	if((a->cost)>(b->cost))return 1;
	if((a->cost)<(b->cost))return -1;
	return 0;
}

int n;
node_t node[100];
edge_t edge[10000];

int main(void) {
	int i,j,p,c;
	double result;
	while(scanf("%d",&n)==1 && n>0) {
		for(i=0;i<n;i++)scanf("%lf%lf%lf%lf",
			&node[i].x,&node[i].y,&node[i].z,&node[i].r);
		p=0;
		for(i=0;i<n;i++) {
			for(j=i+1;j<n;j++) {
				edge[p].from=i;
				edge[p].to=j;
				edge[p].cost=sqrt(
					(node[i].x-node[j].x)*(node[i].x-node[j].x)+
					(node[i].y-node[j].y)*(node[i].y-node[j].y)+
					(node[i].z-node[j].z)*(node[i].z-node[j].z)
				)-node[i].r-node[j].r;
				if(edge[p].cost<=0)edge[p].cost=0;
				p++;
			}
		}
		qsort(edge,p,sizeof(edge_t),qsort_comp);
		c=1;
		result=0;
		uf_init();
		for(i=0;i<p && c<n;i++) {
			if(!uf_issame(edge[i].from,edge[i].to)) {
				c++;
				result+=edge[i].cost;
				uf_merge(edge[i].from,edge[i].to);
			}
		}
		printf("%.3f\n",result);
	}
	return 0;
}

Measured memory_bytes: 868
#include <bits/stdc++.h>
#define mp make_pair
#define X first
#define Y second
#define pii pair<ll,ll>
#define x1 dlfjl
#define x2 dkfj
#define x3 dflgkg
#define y1 dskgj
#define y2 dskfj
#define y3 dfhgdh
#define SQ 320
#define PI 3.14159265359
#define MOD 1000000007
typedef int ll;
using namespace std;
int  n,i,j,k,z,m,q,r,timer,v,tot,x,y,xx, yy,INF, sz;
int a[100500], cnt[100500];
int main() {
    //freopen("input.txt","r",stdin);
    cin >> n >> k;
    int lst = 0;
    for (int i = 0, x; i < n; i++)
    {
    	cin >> x;
    	if (i == 0)
		{
			lst = x;
			continue;
		}
    	if (lst + x >= k) {
            cout << "Possible" << endl;
            for (int j = 1; j < i; j++)
                cout << j << endl;
            for (int j = n-1; j > i; j--)
                cout << j << endl;
            cout << i << endl;
            return 0;
        }
        lst = x;
	}
        
    cout << "Impossible" << endl;
    return 0;
}

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

signed main() {
  int N;
  cin >> N;
  
  vector<int> D(N);
  for( int i = 0; i < N; i++ ) cin >> D.at(i);
  int ans = 0;
  for( int i = 0; i < N; i++ ){
    for( int j = i+1; j < N; j++ ){
      ans += D.at(i)*D.at(j);
    }
  }
  cout << ans << endl;
      
  
  
  
}


Measured memory_bytes: 256
#include<stdio.h>
int main(){
        int n,i,j,s;
        int card[4][13];
        char mark;

        //初期化
        for(i = 0;i < 4;i++){
            for(j = 0;j < 13;j++){
                card[i][j] = 0;
            }
        }

        //枚数を入力
        scanf("%d",&n);
        for(i = 0;i < n;i++){
            //マークと数値を入力
            scanf("%c %d", &mark, &s);
            //スペードの場合
            if(mark == 'S'){
               card[0][s - 1] = 1;
            }
            //ハートの場合
            else if(mark == 'H'){
               card[1][s - 1] = 1;
            }
            //クローバーの場合
            else if(mark == 'C'){
               card[2][s - 1] = 1;
            }
            //ダイヤの場合
            else if(mark == 'D'){
               card[3][s - 1] = 1;
            }
        	else{
        		i--;
        	}
        }

        //余ったカードを出力
        for(i = 0;i < 4;i++){
           for(j = 0;j < 13;j++){
              if(card[i][j] == 0){
                if(i == 0){
                   printf("%c %d\n",'S',j + 1);
                }
                else if(i == 1){
                   printf("%c %d\n",'H',j + 1);
                }
                else if(i == 2){
                   printf("%c %d\n",'C',j + 1);
                }
                else if(i == 3){
                   printf("%c %d\n",'D',j + 1);
                }
              }
           }
        }
        return 0;
}



Measured memory_bytes: 2104