akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define rep2(i,s,n) for (int i = s; i < n; ++i)
#define all(a) a.begin(),a.end()
using namespace std;

int main() {
    int x;
    cin >> x;
    if(x < 1200) cout << "ABC" << endl;
    else cout << "ARC" << endl;
}

Measured memory_bytes: 256
/*
　　　　 ∧＿∧　にっぽんちゃちゃちゃ
　／＼（　・∀・）／ヽ
（ ●　と　　　つ　● ）　にっぽんちゃちゃちゃ
　＼/⊂、 ノ　　＼ノ
　　　　　し'
*/
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define repone(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define Rep(j,n) for(int j=0;j<(int)(n);++j)
#define Repo(j,o,n) for(int j=o;j<(int)(n);++j)
#define Repone(j,n) for(int j=1;j<(int)(n);++j)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define int long long
#define MOD 1000000007
#define INF 9223372036854775807

signed main()
{
int x=0,y=0,z=0,w=0,n=0,d=0;
std::cin >> x>>y;
std::cout << (x+y)/2 << '\n';
}



Measured memory_bytes: 3116
#include <stdio.h>
 
using namespace std;
 
int main(){
    int n,x;
    scanf("%d",&n);
 
    for(int i = 1; i<= n; i++)
    {
        if(i%3 == 0){
            printf(" %d",i);
        }else{
            x = i;
            do{
                if(x%10 == 3){
                    printf(" %d",i);
                    break;
                }
                x /=10;
            }while(x);
        }
    }
    printf("\n");
}


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

using namespace std;

#define ll long long int
#define ld long double
#define MAX 200007
#define MOD 1000000007
#define fast ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)

int main(){

    fast;

    ll i,n,k;
    cin >> n >> k;

    ll a[n+1];

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

    map<ll,ll> mp;

    i = 1;
    ll t = i;
    mp[i]=1;

    ll cnt = 0;

    while(1){

        t = a[t];
        cnt++;
        if(mp[t]){
            break;
        }
        mp[t] = 1;

    }

    ll tmp = 0;
    ll cnt1 = 0;
    ll t1 = t;

    while(1){
        if(tmp==1){
            break;
        }
        t1 = a[t1];
        cnt1++;
        if(t1==t){
            tmp=1;
        }
    }

    if(k<=cnt){

        ll ans = 1;
        for(i=0;i<k;i++){
            ans = a[ans];
        }
        cout << ans << endl;

    }
    else{

        k = k-cnt;
        ll ans = t;
        k = k%cnt1;
        for(i=0;i<k;i++){
            ans = a[ans];
        }
        cout << ans << endl;

    }


}


//    cout << fixed << setprecision(2);


Measured memory_bytes: 17520
#include <bits/stdc++.h>
#define maxn 10005
using namespace std;
int a[maxn];
int b[maxn];
typedef long long ll;
//int main()
//{
//    int n;
//    scanf("%d",&n);
//    ll suma=0;
//    ll sumb=0;
//    for(int i=0;i<n;i++){
//        scanf("%d",&a[i]);
//        suma+=a[i];
//    }
//    ll cnta=0,cntb=0;
//    for(int i=0;i<n;i++){
//        scanf("%d",&b[i]);
//        if(a[i]>b[i]) cnta+=a[i]-b[i];
//        else if(a[i]<b[i]) cntb+=b[i]-a[i];
//        sumb+=b[i];
//    }
//    sumb+=cnt;
//    suma+=cnt*2;
//    if(suma>sumb) puts("No");
//    else puts("Yes");
//}
int main(){
    int n;
    scanf("%d",&n);
    for(int i=1;i<=n;i++) scanf("%d",&a[i]);
    for(int i=1;i<=n;i++) scanf("%d",&b[i]);
    long long suma,sumb;
    suma=sumb=0;
    for(int i=1;i<=n;i++){
        if(a[i]>b[i]) suma+=a[i]-b[i];
        else sumb+=(b[i]-a[i])/2;
    }
    if(sumb>=suma) puts("Yes");
    else puts("No");
    return 0;
}


Measured memory_bytes: 384
#include<iostream>
#include<cmath>
#include<stdio.h>
using namespace std;
int main(){
	int n;
	double s[1000] = { 0 }, a = 0, ave = 0;
	while (true){
		double s[1000] = { 0 }, a = 0, ave = 0;
		cin >> n;
		if (n == 0)
			break;
		for (int i = 0; i < n; i++){
			cin >> s[i];
			ave += s[i];
		}
		ave /= n;
		for (int i = 0; i < n; i++){
			a += pow(s[i] - ave, 2) / n;
		}
		printf("%.8f\n", sqrt(a));
		//cout << "test";
	}
}


Measured memory_bytes: 3196
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <stack>
#include <queue>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define PF push_front
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double
#define pii pair<int,int>
#define pll pair<LL,LL>
#define vi vector<int>
#define vii vector<vi>

const double pi = 3.14159265358979323846264;
const int mod=1000000007;

int main(){
	LL n;
    cin>>n;
    if(n<=5||n%2==1){
        cout<<0<<endl;
        return 0;
    }
    LL cnt=0;
    while(n>5){
        cnt+=n/10;
        n/=5;
    }
    cout<<cnt<<endl;

}


Measured memory_bytes: 256
// 2019/06/24
// AtCoder Beginner Contest 081 - B

#include <bits/stdc++.h>
using namespace std;

int main() {
    int n, lflg, wkr, ans;
    cin >> n;
    vector<int> a(n);
    
    for(int i = 0; i < n; i++){
        cin >> a.at(i);
    }
    ans = -1;
    lflg = 0;
    while(lflg==0){
        for(int i = 0; i < n; i++){
            wkr = a.at(i) % 2;
            if(wkr == 1){
                lflg = 1;
                break;
            } else {
                a.at(i) = a.at(i) / 2;
            }
        }
        ans += 1;
    }

    cout << ans;
}

Measured memory_bytes: 256
n, k = map(int, input().split())
r, s, p = map(int, input().split())
t = input()
V = {"r":p, "s":r, "p":s}
ans = 0

for i in range(k):
    check = t[i]
    ans += V[check]

    while 1:
        i += k
        if i >= n:
            break
        if check == t[i]:
            check = "-1"
        else:
            ans += V[t[i]]
            check = t[i]

print(ans)

Measured memory_bytes: 3316
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) x.begin(),x.end()
#define chmin(a,b) a=min(a,b)
#define chmax(a,b) a=max(a,b)

int main(){
	string s;
	cin>>s;
	rep(i,3)cout<<s[i];
	cout<<endl;
}


Measured memory_bytes: 3624
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using namespace std;

typedef long long ll;

#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define per(i,a,b) for(ll i=b-1LL;i>=(a);--i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define ctos(c) string(1,c)
#define print(x) cout<<#x<<" = "<<x<<endl;

#define MOD 1000000007

int main() {
	string s;
	cin>>s;
	if(s=="A")cout << "T" << endl;
	if(s=="T")cout << "A" << endl;
	if(s=="C")cout << "G" << endl;
	if(s=="G")cout << "C" << endl;
	return 0;
}

Measured memory_bytes: 256
#include<algorithm>
#include<iostream>
#include<vector>
#include<string>
#include<queue>
#include<stack>
#include<cmath>
#include<list>
#include<set>
#include<map>

using namespace std;
long long MOD = 1000000007LL;
const double PI = 3.14159265358979323846;
#undef INT_MIN
#undef INT_MAX
#define INT_MIN -2147483648
#define INT_MAX 2147483647
#define endl "\n"

int main() {
	unsigned long long X, Y;
	cin >> X >> Y;
	
	int count = 0;
	while (1) {
		if (X <= Y)++count;
		else break;

		X *= 2;
	}

	cout << count << endl;
	return 0;
}

Measured memory_bytes: 3572
/**
*    created: 03.07.2020 16:02:24
**/
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
// #include <boost/multiprecision/cpp_int.hpp>
// using bint = boost::multiprecision::cpp_int;
using namespace std;
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define pcnt(bit) __builtin_popcountll(bit)
template<class T> bool chmax(T &a, const T &b) {if (a < b) {a = b; return 1;} return 0;}
template<class T> bool chmin(T &a, const T &b) {if (b < a) {a = b; return 1;} return 0;}
const long double pi = acos(-1.0);
const int INF = 1LL << 60;
const int MOD = 1000000007;
// const int MOD = 998244353;

signed main() {

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

    int n, k;
    cin >> n >> k;
    int ans = 1;
    rep(i,n) ans = min(ans*2,ans+k);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3588
#include <bits/stdc++.h>
#define rep(i, a) for(int i = 0; i < (a); i++)
#define pai 3.14159265359
using namespace std;

int main() {
    long long a, b, v, w, t;
    cin >> a >> v >> b >> w >> t;
    if((a < b && a + v * t >= b + w * t) || (a > b && a - v * t <= b - w * t))
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
}

Measured memory_bytes: 3592
#!/usr/bin/env python3
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys
import collections
from decimal import Decimal # 10進数で考慮できる

mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000

d = collections.deque()
def LI(): return list(map(int, sys.stdin.readline().split()))

D = int(input())
ans = "Christmas"
for i in range(25 - D):
    ans += " Eve"
print(ans)

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

#include<bits/stdc++.h>
using namespace std;
#define mod 1000000007 
#define pb push_back
#define mp make_pair
#define MP ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define IG cin.ignore(numeric_limits<streamsize>::max(),'\n');
#define ll long long int
#define N 1378
#define maxn 1000003
#define FP ff.open("output.txt")
#define FR ff.open("input.txt")
#define valid(a,b) if(a>=1 && a<row-1 && b>=1 && b<col-1)
fstream ff;

ll a, q, b, c, d, k, h, e, f, t, m, n, i, j, x, y, count, tcase = 0, l, r;

string s1, s2, s;

int main() {
	cin>>s;
	if(s[s.size()-1]!='s') s+="s";
	else s+="es";
	cout<<s<<endl;
	return 0;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
#define fr first
#define sc second
#define pb push_back
#define mk make_pair
#define OK puts("OK");
#define sz(s) (int)s.size()
#define pii pair<int,int>
#define all(s) s.begin(), s.end()
#define allr(s) s.rbegin(), s.rend()
#define rep(i,n) for (i=0;i<(n);++i)
#define rep1(i,n) for (i=1;i<=(n);++i)
#define ret return
#define int long long
#define scan1(a) scanf("%lld",&(a));
#define scan2(a,b) scanf("%lld %lld",&(a),&(b));
#define scan3(a,b,c) scanf("%lld %lld %lld",&(a),&(b),&(c));
#define nemeshay ios::sync_with_stdio(0),cin.tie(0);
const int INF=1e9+7,N=1e6+12;
int dp[1001][1001];
bool q[1001][1001];
main(){
    int n,m,i,j;
    scan2(n,m)
    char ch;
    for (i=0;i<n;++i){
        for (j=0;j<m;++j){
            cin>>ch;
            if (ch == '.')q[i][j]=1;
        }
    }
    for (i=0;i<n;++i){
        if (q[i][0]==0)break;
        dp[i][0]=1;
    }
    for (i=0;i<m;++i){
        if (q[0][i]==0)break;
        dp[0][i]=1;
    }

    for (i=1;i<n;++i){
        for (j=1;j<m;++j){
            if (q[i][j-1])
                dp[i][j] += dp[i][j-1];
            if (q[i-1][j])
                dp[i][j] += dp[i-1][j];
            dp[i][j] %= INF;
        }
    }
    cout <<dp[n-1][m-1];
}










Measured memory_bytes: 9088
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
const int mod = 1e9+7;

int main(){
    string s;
    cin >> s;
    int n = s.size();
    bool flag = true;
    while(flag){
        flag = false;
        if(!s.size()) break;
        for(int i = 0; i < s.size()-1; i++){
            if(s[i] != s[i+1]){
                s.erase(s.begin()+i);
                s.erase(s.begin()+i);
                flag = true;
                break;
            }
        }
    }
    cout <<  n-s.size() << endl;   
}

Measured memory_bytes: 512
#include <iostream>

using namespace std;

int main(int argc, char *argv[]) {
  int N, count = 1;
  cin >> N;
  int flg = 0, u, v;

  cin >> v;
  for (int i = 1; i < N; i++) {
    u = v;
    cin >> v;
    int d = v - u > 0 ? 1 : v - u < 0 ? -1 : 0;
    if (flg == 0)
      flg = d;
    else {
      if (flg * d < 0) {
        count++;
        flg = 0;
      } else {
        if (d) flg = d;
      }
    }
  }
  cout << count << endl;

  return 0;
}


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

using namespace std;
using ll = long long;
int main()
{
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(10);
    ll W, H;
    double x, y;
    cin >> W >> H >> x >> y;

    double area = W*H;

    // if(W==H && x==W/2.0 && y==H/2.0){
    //     cout << area/2 << " 1\n";
    // }
    if(x==W/2.0 && y==H/2.0){
        cout << area/2 << " 1\n";
    }
    else
    {
        cout << area/2 << " 0\n";
    }
    
    
        return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main() {
    int v,x,res=1;
        cin >> x;
        for(int i=2;i<=x;i++) {
            v = i*i;
            while(v<=x) {
                if(res<v) {
                    res = v;
                }
                v*=i;
            }

        }
    cout << res << endl;
}


Measured memory_bytes: 384
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>

/*
	Author   :: Rakesh Ghosh
	Language :: c++17
*/


using namespace std;
 
typedef long long ll;
typedef long double ld;

typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
 
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;


typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef vector<vd> vvd;


#define umap unordered_map 
#define uset unordered_set 

#define F0r(i, a, b) for(int i=a; i<(b); i++)
#define For(i, a)    for(int i=0; i<(a); i++)
#define F0rb(i,a,b)  for(int i = (b); i >= a; i--)
#define Forb(i,a)    for(int i = (a); i >= 0; i--)

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define lb lower_bound
#define ub upper_bound
#define setbits(x)  __builtin_popcountll(x)
#define zrobits(x)  __builtin_ctzll(x)
#define all(x) x.begin(), x.end()
#define ins insert
#define w(x) int x; cin >> x ; while(x--)


 
const int MOD = 1000000007;
const char nl = '\n';



int main() {
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	int d,t,s;
	cin >> d >> t >> s;
	if(d <= t *s){
		cout << "Yes";
	} else {
		cout << "No";
	}
	return 0;
}


Measured memory_bytes: 3652
#include <iostream>

using namespace std;

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

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

    cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(void){
	int val[10];

	for(int i=0;i<10;i++)
		cin >> val[i];

	for(int i=0;i<9;i++)
		for(int j=0;j<9;j++)
			if(val[j]<val[j+1]){
				int tmp=val[j];
				val[j]=val[j+1];
				val[j+1]=tmp;
			}

	for(int i=0;i<3;i++)
		cout << val[i] << endl;

	return 0;
}

Measured memory_bytes: 1160
#include <iostream>

using namespace std;

int main() {

	char a[100001];
	string tile;
	int length;
	int answer_a = 0, answer_b = 0, true_answer = 0;

	cin >> tile;

	length = tile.length();

	for (int i = 0; i < length;i++) {

		a[i] = tile[i];
	}

	for (int i = 0; i < length; i++) {

		if (i % 2 == 0) {
			if (a[i] == '1') {
				answer_a++;
			}
			else {
				answer_b++;
			}
		}
		else {
			if (a[i] == '0') {
				answer_a++;
			}
			else {
				answer_b++;

			}
		}

		if (answer_a < answer_b) {
			true_answer = answer_a;
		}
		else {
			true_answer = answer_b;
		}
	}
		cout << true_answer << endl;

	//cin >> /*変数他*/;
	//cout << /*文字列*/ << endl;
	return 0;
}

Measured memory_bytes: 512
#include <iostream>

using namespace std;
long long z,x,c,s,a[101];
int main()
{
    cin>>z;
    for(int i=1;i<=z;i++){
        cin>>x;
        if(x%2==0 && x%3!=0 && x%5!=0)s=1;
    }
    if(s==1)cout<<"DENIED"<<endl;
    else cout<<"APPROVED"<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>

using namespace std;

int main(){
    int a, b;
    while(true){
        cin>>a>>b;
        if(a==0&&b==0) break;
        for(int i=0; i<a; i++){
            for(int j=0; j<b; j++){
                cout<<"#";
            }
            cout<<endl;
        }
        cout<<endl;
    }
}


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

vector<int> forintinput(int n) {
	vector<int> x(100000);
	for(int i = 0;i < n;i++) cin >> x[i];
	return x;
}
int main(){
	int h,a;
	cin >> h >> a;
	cout << (h + a - 1) / a << endl;
}

Measured memory_bytes: 3620
n = int(input())
data = {}
for i in range(n):
    s,p = map(str,input().split())
    p = int(p)
    if s in data:
        data[s].append((p,i+1))
    else:
        data[s] = [(p,i+1)]
D = sorted(data.items())
for i in range(len(D)):
    P = D[i][1]
    P.sort()
    while P:
        print(P.pop()[1])


Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <cmath>
#include <string>
#include <sstream>
#include <iomanip>
#include <complex>
using namespace std;

#define ll long long
#define vvi vector< vector<int> >
#define All(X) X.begin(),X.end()
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back 
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int mylog10(int x){
	if(x==0) return 0;
	else return (int)log10(x);
}

string gettopnum(string str){
	string rst = "";
	REP(i,str.size()){
		if(str[i]=='*'||str[i]=='+') break;
		else rst += str[i];
	}
	return rst;
}

string strerase(string instr,int num){
	string rst = "";
	for(int i=num;i<instr.size();i++){
		rst += instr[i];
	}
	return rst;
}
ll int calc1(string str){//multiplication-first
	stack<ll int> st;
	string rststr = gettopnum(str);
	if(rststr!="") st.push((ll int)stoi(rststr));
	if(rststr!="") str = strerase(str,mylog10((double)stoi(rststr))+1);
	while(str.size()!=0){
		//cout << str << endl;
		if(str[0]=='*'){
			str = strerase(str,1);
			ll int tmp = stoi(gettopnum(str));
			str = strerase(str,(int)mylog10((double)tmp)+1);
			ll int tmp2 = st.top();
			st.pop();
			st.push(tmp*tmp2);
		}else if(str[0]=='+'){
			str = strerase(str,1);
			ll int tmp = stoi(gettopnum(str));
			st.push(tmp);
			str = strerase(str,(int)mylog10((double)tmp)+1);
		}
	}
	ll int rst = 0;
	while(!st.empty()){
		rst += st.top();
		st.pop();
	}
	return rst;
}

ll int calc2(string str){////multiplication-first2
	//cout << str << endl;
	string rststr = gettopnum(str);
	ll int rst;
	if(rststr!="") rst = stoi(rststr);
	if(rststr!="") str = strerase(str,(int)mylog10((double)rst)+1);
	if(str.size()==0) return rst;
	else if(str[0]=='*') {
		str = strerase(str,1);
		return rst*calc2(str);
	}else if(str[0]=='+'){
		str = strerase(str,1);
		return rst+calc2(str);
	}
	//dummy
	return -1;
}

ll int calc3(string str){//leftto-right
	string rststr = gettopnum(str);
	if(rststr!="") str = strerase(str,(int)mylog10((double)stoi(rststr))+1);
	ll int rst = stoi(rststr);
	while(str.size()!=0){
		//cout << str << endl;
		if(str[0]=='*'){
			str = strerase(str,1);
			ll int tmp = stoi(gettopnum(str));
			rst *= tmp;
			str = strerase(str,(int)mylog10((double)tmp)+1);
		}else if(str[0]=='+'){
			str = strerase(str,1);
			ll int tmp = stoi(gettopnum(str));
			rst += tmp;
			str = strerase(str,(int)mylog10((double)tmp)+1);
		}
	}
	return rst;
}

int main(){
	string str;
	cin >> str;
	ll int ans;
	cin >> ans;
	ll int rst1 = calc1(str);//calc2　is bug
	ll int rst2 = calc3(str);
	//cout << rst1 << " " << rst2 << endl;
	if(rst1==ans){
		if(rst2==ans) cout << 'U' << endl;
		else cout << 'M' << endl;
	}else{
		if(rst2==ans) cout << 'L' << endl;
		else cout << 'I' << endl;
	}
	return 0;
}

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

N = int(input().strip())
A_list = list(map(int, input().rstrip().split()))
#-----

A_set = set()

for a in A_list:
    if a in A_set:
        print("NO")
        break
    
    A_set.add(a)
    
else:
    print("YES")


Measured memory_bytes: 25168
#pragma warning(disable:4786)
#pragma warning(disable:4996)
#include<list>
#include<bitset>
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<set>
#include<map>
#include<functional>
#include<string>
#include<cstring>
#include<cstdlib>
#include<queue>
#include<utility>
#include<fstream>
#include<sstream>
#include<cmath>
#include<stack>
#include<assert.h>
using namespace std;

#define MEM(a, b) memset(a, (b), sizeof(a))
#define CLR(a) memset(a, 0, sizeof(a))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define ABS(X) ( (X) > 0 ? (X) : ( -(X) ) )
#define S(X) ( (X) * (X) )
#define SZ(V) (int )V.size()
#define FORN(i, n) for(i = 0; i < n; i++)
#define FORAB(i, a, b) for(i = a; i <= b; i++)
#define ALL(V) V.begin(), V.end()
#define IN(A, B, C)  ((B) <= (A) && (A) <= (C))

typedef pair<int,int> PII;
typedef pair<double, double> PDD;
typedef vector<int> VI;
typedef vector<PII > VP;

#define AIN(A, B, C) assert(IN(A, B, C))

//typedef int LL;
typedef long long int LL;
//typedef __int64 LL;

int dp[350][350];

int main()
{
	/*
	for (int d = 0; d <= 100; d++) {
		for (int i = 0; i <= d; i++) {
			int j = d - i;
			{
				dp[i][j] = 0;
				for (int k = 1; 2 * k <= i; k++) {
					if (dp[i - 2 * k][j + k] == 0) {
						dp[i][j] = 1;
					}
				}
				for (int k = 1; 2 * k <= j; k++) {
					if (dp[i + k][j - 2 * k] == 0) {
						dp[i][j] = 1;
					}
				}
			}
		}
	}

	for (int i = 0; i <= 50; i++) {
		for (int j = 0; j <= 50; j++) {
			printf("%d", dp[i][j]);
		}
		printf("\n");
	}
	*/

	LL x, y;
	scanf("%lld %lld", &x, &y);
	if (x > y) swap(x, y);
	if (y == x || y == x + 1) printf("Brown\n"); else printf("Alice\n");
	return 0;
}


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

int main(void) {
	int n;
	scanf("%d",&n);
	long  int sum1=0,a_count[100001] = {0},t;
	for(int i=0;i<n;i++){
		scanf("%ld",&t);
		//aの和と数値ごとの出現回数を格納する。
		a_count[t]++;//数値ごとの出現回数
		sum1+=t;//aの和
	}
	int q;
	scanf("%d",&q);
	int b[q],c[q];
	for(int i=0;i<q;i++){
		scanf("%d%d",&b[i],&c[i]);
		sum1+=(c[i]-b[i])*a_count[b[i]];
		a_count[c[i]] += a_count[b[i]];
		a_count[b[i]] = 0;
		printf("%ld\n",sum1);
	}

}


Measured memory_bytes: 3260
fn get_input() -> String {
    let mut word = String::new();
    std::io::stdin().read_line(&mut word).unwrap();
    word.trim().to_owned()
}

fn main() {
    let mut a:Vec<u64> = Vec::new();
    a.push(get_input().parse().unwrap());
    a.push(get_input().parse().unwrap());
    a.push(get_input().parse().unwrap());
    a.push(get_input().parse().unwrap());
    a.push(get_input().parse().unwrap());
    let k:usize = get_input().parse().unwrap();

    let mut ans = "Yay!";
    for i in 0..a.len()-1 {
        for j in i+1..a.len() {
            if a[j] - a[i] > k as u64 {
                ans = ":(";
                break;
            }
        }
        if ans == ":(" {
            break;
        }
    }

    println!("{}", ans);
}

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

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF = (1<<30) - 1;
const ll LINF = (1LL<<60) - 1;

int main(){
    int n;
    cin >> n;
    vector<int> d(n);
    for (int i = 0; i < n; ++i) {
        cin >> d[i];
    }

    int sum = 0;
    for (int i = 0; i < n-1; ++i) {
        for (int j = i+1; j < n; ++j) {
            sum += d[i] * d[j];
        }
    }
    cout << sum << endl;
}

Measured memory_bytes: 3608
import sys

a = int(input())
b = int(input())
c = int(input())
x = int(input())

cnt = 0
a_min = min( int(x/500) ,a)
for ai in range(a_min+1):
    rem_a = x - (ai * 500)
    if rem_a == 0:
        cnt+=1
        break
    b_min = min( int(rem_a/100) ,b)
    for bi in range(b_min+1):
        rem_b = rem_a - (bi * 100)
        if rem_b == 0:
            cnt+=1
            break
        c_min = min( int(rem_b/50) ,c)
        for ci in range(c_min+1):
            rem_c = rem_b - (ci * 50)
            if rem_c == 0:
                cnt+=1
                break

print(cnt)

Measured memory_bytes: 9092
import sys
input=sys.stdin.readline
n=int(input())
wf=[list(map(int,input().split())) for i in range(n)]

ans=0
for i in range(n):
    for j in range(i+1,n):
        use=True
        for h in range(n):
            if h!=i and h!=j and wf[i][j] > wf[i][h]+wf[h][j]:
                print(-1)
                exit()
            if h!=i and h!=j and wf[i][j] == wf[i][h]+wf[h][j]:
                use=False
        if use:
            ans+=wf[i][j]
print(int(ans))

Measured memory_bytes: 45404
#include <iostream>
using namespace std;
 
int main(void){
    int a, b;
    cin >> a >> b;
    if (a == b){
        cout << "a == b" << endl;
    }
    else if (a < b){
        cout << "a < b" << endl;
    }
    if (a > b){
        cout << "a > b" << endl;
    }
    return 0;
}

Measured memory_bytes: 1156
import math

n = int(input())
x = list(map(int, input().split()))
ans = 0
mod = 10 ** 9 + 7
f = 1
for i in range(1,n):
  f *= i
  f %= mod

for i in range(n-1):
    ans+=(x[n-1]-x[i])*pow(i+1,mod-2,mod)

ans*=f
ans%=mod


print(ans)

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

int32_t main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int t = 1;
    // cin >> t;
    while (t--) {
        int n;
        cin >> n;
        int ans = 0;
        for (int i = 1; i <= n; i++) {
            int j = i;
            while (j <= n) {
                ans += j;
                j += i;
            }
        }
        cout << ans;
    }
    return 0;
}

Measured memory_bytes: 3648
import java.util.*;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int h = sc.nextInt();
		int n = sc.nextInt();
		int l = 0;
		int r = w;
		int u = h;
		int d = 0;
		for(int i=0; i<n; i++){
			int x = sc.nextInt();
			int y = sc.nextInt();
			int a = sc.nextInt();
			if(a==1)l = Math.max(l, x);
			else if(a==2)r = Math.min(r, x);
			else if(a==3)d = Math.max(d, y);
			else u  = Math.min(u, y);
		}
		System.out.println(r-l<0 || u-d<0 ? 0 : (r-l)*(u-d));
	}
}

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

using namespace std;

int main(int argc, const char *argv[]) {
  string s;
  cin >> s;

  vector<int> ans;
  for (int i = 0; i < s.size() - 2; ++i) {
    int n = 0, pow10 = 1;
    for (int j = i + 2; i <= j; --j, pow10 *= 10) {
      n += pow10 * (s[j] - '0');
    }

    ans.push_back(abs(753 - n));
  }

  cout << *min_element(ans.begin(), ans.end()) << '\n';
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
using bint = boost::multiprecision::cpp_int;
using ll = long long;
using pint = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repSE(i,s,n) for (int i = (s); i < (n); i++)
#define rrepSE(i,s,e) for (int i = (s); i > (e); i--)
#define ssort(v) sort(v.begin(), v.end())
#define gsort(v) sort(v.rbegin(), v.rend())
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &vec){ os << "["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const deque<T> &vec){ os << "deq["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &pa){ os << "(" << pa.first << "," << pa.second << ")"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const unordered_map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
template<typename T> bool chmax(T &m, const T q) { if (m < q) {m = q; return true;} else return false; }
template<typename T> bool chmin(T &m, const T q) { if (q < m) {m = q; return true;} else return false; }
#define DEBUG_PRINT(var) std::cout << #var << " = " << var << "\n";

int main()
{
    char ch;
    cin >> ch;
    char ans;
    if (ch >= 'A' && ch <= 'Z') ans = 'A';
    if (ch >= 'a' && ch <= 'z') ans = 'a';
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
 
mt19937 rnd(chrono::high_resolution_clock::now().time_since_epoch().count());

bool is_pal(string s) {
  string t = s;
  reverse(t.begin(), t.end());
  return s == t;
}

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  string s;
  cin >> s;
  if (!is_pal(s)) {
    cout << "No\n";
    return 0;
  }
  int n = s.size();
  string x = s.substr(0, (n - 1) / 2);
  if (!is_pal(x)) {
    cout << "No\n";
    return 0;
  } 
  int len = (n + 3) / 2;
  len--;
  x = s.substr(len, n - len);
  if (!is_pal(x)) {
    cout << "No\n";
    return 0;
  }
  cout << "Yes\n"; 
  return 0;
}

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

# from typing import Optional
from typing import List

# from typing import Dict
from typing import Tuple
from typing import Set

# from typing import Sequence

Cod = Tuple[int, int]


def main():
    args = input().split()
    H = int(args[0])
    W = int(args[1])
    M = int(args[2])

    codList = set()
    columnSumList: List[int] = [0] * W
    rowSumList: List[int] = [0] * H
    for i in range(M):
        h, w = map(lambda x: int(x), input().split())
        item = (h, w)
        codList.add(item)
        # codList.setdefault(h, {})
        # codList[h][w] = item
        columnSumList[w - 1] += 1
        rowSumList[h - 1] += 1

    maxColumnSum = max(columnSumList)
    maxColumIndexList = [i for i, x in enumerate(columnSumList) if x == maxColumnSum]
    maxRowSum = max(rowSumList)
    maxRowIndexList = [i for i, x in enumerate(rowSumList) if x == maxRowSum]

    result = maxColumnSum + maxRowSum
    for row in maxRowIndexList:
        for column in maxColumIndexList:
            if (row + 1, column + 1) in codList:
                continue
            else:
                print(result)
                return

    print(result - 1)


if __name__ == "__main__":
    main()


Measured memory_bytes: 84844
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
int n, l[10], a, b, c, ans;

void saiki(int x, int y)
{
	if (x == n)
	{
		vector<int> vec[6];
		int j = 0, A[4], zan = 0;
		A[1] = 0, A[2] = 0, A[3] = 0;
		while (y)
		{
			vec[y % 10].push_back(l[j]);
			j++, y /= 10;
		}
		if (vec[1].size() && vec[2].size() && vec[3].size())
		{
			for (int i = 1; i <= 3; i++)
			{
				for (int k = 0; k < vec[i].size(); k++)
				{
					A[i] += vec[i][k];
				}
			}
			zan += vec[1].size() + vec[2].size() + vec[3].size() - 3;
			zan *= 10;
			zan += abs(A[1] - a) + abs(A[2] - b) + abs(A[3] - c);
			ans = min(zan, ans);
		}
	}
	else
	{
		for (int i = 1; i <= 4; i++)
		{
			saiki(x + 1, y * 10 + i);
		}
	}
}

int main(void)
{
	cin >> n;
	ans = 1000000000;
	cin >> a >> b >> c;
	for (int i = 0; i < n; i++) cin >> l[i];
	saiki(0, 0);
	cout << ans << endl;
}

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

using namespace std; 

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef pair<LL, LL> PLL;
typedef vector<PLL> VPLL;
typedef priority_queue<int> PQ_DESC;
typedef priority_queue<int, vector<int>, greater<int>> PQ_ASC;
typedef priority_queue<PII> PQ_DESC_PII;
typedef priority_queue<PII, vector<PII>, greater<PII>> PQ_ASC_PII;

#define ALL(c) (c).begin(),(c).end()
#define PB push_back
#define MP make_pair
#define SORT_ASC(c) sort(ALL(c))
//#define SORT_DESC(c) sort(ALL(c), greater<typeof(*((c).begin()))>())
#define SORT_DESC(c) sort((c).rbegin(),(c).rend())
#define REV(c) reverse((c).begin(), (c).end())
#define SIZE(a) int((a).size())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ROF(i,a,b) for(int i=(b-1);i>=(a);--i)
#define REP(i,n) FOR(i,0,n)
#define PER(i,n) ROF(i,0,n)

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int LARGE_INT = 1e9+100;
const int INF = 2e9+100;
const LL INF_LL = (LL)INF * 300 * 300;
const int MOD = 1e9+7;

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

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

void Main()
{
    LL n,m,x;cin>>n>>m>>x;
    VL c(n);
    VVL a(n);
    REP(i,n){
        cin>>c[i];
        a[i].resize(m);
        REP(j,m){
            cin>>a[i][j];
        }
    }

    LL result = INF_LL;
    REP(bit,(1<<n)){
        VL s(m);
        LL cost=0;
        REP(i,n){
            if(bit&(1<<i)){
                cost+=c[i];
                REP(j,m){
                    s[j]+=a[i][j];
                }
            }
        }
        bool f=true;
        REP(i,m){
            if(s[i]<x){
                f=false;
                break;
            }
        }
        if(f){
            result = min(result,cost);
        }
    }
    if(result==INF_LL){
        cout<<-1<<endl;
    }
    else{
        cout<<result<<endl;
    }
	return;
}

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

Measured memory_bytes: 3664
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <string.h>
#include <queue>
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
typedef long long ll;
const ll mod = 1e9+7;
ll fac[1111111];
ll invfac[1111111];
ll n, ans, add;


ll exp(ll x,ll y){
    if(y<0) return 0;
    ll ret=1;
    for(;y;y>>=1,x=(x*x)%mod){
        if(y&1)ret=(ret*x)%mod;
    }
    return ret;
}

ll ncr(ll u, ll v){
    if(u<0 || v<0 || u<v) return 0;
    ll ret = fac[u];
    ret=(ret*invfac[v])%mod;
    ret=(ret*invfac[u-v])%mod;
    return ret;
}

int main(void){
    cin>>n;
    fac[0]=1;
    invfac[0]=1;
    for(int i=1 ; i<=n ; i++){
        fac[i]=(i*fac[i-1])%mod;
        invfac[i]=exp(fac[i],mod-2);
    }
    ans+=fac[n-1];
    for(int i=1 ; i<=n-1 ; i++){
        add = ncr(n-1,i)-ncr(i-1,n-2-i+1);
        add = (add+mod)%mod;
        add = (add*fac[n-1-i])%mod;
        add = (add*fac[i])%mod;
        ans = (ans+add);
        if(ans>=mod) ans-=mod;
    }	
    ans%=mod;
    cout<<ans;
}

Measured memory_bytes: 16768
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE BangPatterns #-}

import Control.Applicative
import Control.Monad
import Control.Arrow
import Data.List
import Data.Maybe
import Data.Char
import qualified Data.ByteString.Char8 as B
import Text.Printf

readInt = ( readLn :: IO Int )
readInts = map ( read :: String -> Int ) . words <$> getLine

getList = map ( fst . fromJust . B.readInt ) . B.words <$> B.getLine

which a b f = if f then a else b
mp [ a, b ] = ( a, b )

main = do
	n <- readInt
	ss <- replicateM n getLine
	m <- readInt
	ts <- replicateM m getLine
	let
		count s = length . filter( == s )
		benefit s = count s ss - count s ts
	print $ max 0 $ maximum $ map benefit $ ss ++ ts


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

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

    string s; cin>>s;

    for(char i:s) {
        if(i=='7') {
            cout<<"Yes";
            return 0;
        }
    }
    cout<<"No";
}


Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> pll;
const ll mod=1e9+7;
//const ll mod=998244353;
const ll inf=1LL<<61;

int main() {
  ll n,k;
  cin >> n >> k;
  vec a(n);
  for(ll i=0;i<n;i++) cin >> a[i];
  ll ng=0,ok=1e9;
  while(ng+1<ok) {
    ll cnt=0;
    ll m=(ng+ok)/2;
    for(ll i=0;i<n;i++) {
      cnt+=(a[i]-1)/m;
    }
    if(cnt<=k) ok=m;
    else ng=m;
  }
  cout << ok << endl;
}

Measured memory_bytes: 4736
/*
title:

url:
*/

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <functional>
#include <queue>
#include <limits>
#include <string>
#include <utility>
#include <cstring>
#include <map>
#include <cmath>

using namespace std;

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

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

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

    int l = 0;
    for (int i = 1; i < n + 2; i++)
    {
        l += abs(a[i] - a[i - 1]);
    }
    for (int i = 1; i < n + 1; i++)
    {
        int tmp[3] = {a[i - 1], a[i], a[i + 1]};
        sort(tmp, tmp + 3);
        int tmpl = l;
        if (tmp[1] == a[i])
        {
            cout << tmpl << endl;
        }
        else if (tmp[1] == a[i - 1])
        {
            tmpl -= 2 * abs(a[i] - a[i - 1]);
            cout << tmpl << endl;
        }
        else
        {
            tmpl -= 2 * abs(a[i] - a[i + 1]);
            cout << tmpl << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 1664
#include<bits/stdc++.h>
#define ll long long
#define gcd(x,y) __gcd(x,y)
#define fi first
#define se second
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }
template <class A> inline ll abs(A &a) { return (a < 0 ? -a : a); }
using namespace std;
const ll inf=(1LL<<62);
const ll MOD=(1e9)+7;
const ll mod=998244353;
signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  ll n, ans = 0;
  cin >> n;
  for (int i = 1; i < n; i++) {
    ans += (n - 1) / i;
  }

  cout << ans << "\n";
  return 0;
}
 

Measured memory_bytes: 3648
import sys
import math
import bisect

def main():
    s = input()
    n = len(s)
    l = 0
    r = n - 1
    while l < n and s[l] != 'A':
        l += 1
    while r >= 0 and s[r] != 'Z':
        r -= 1
    print(r - l + 1)

if __name__ == "__main__":
    main()


Measured memory_bytes: 3516
X,N = map(int,input().split())
l = list(map(int,input().split()))
n_l = sorted(l)

for i in range(100):
  if not X-i in n_l:
      print(X-i)
      break
  elif not X+i in n_l:
      print(X+i)
      break
  pass

Measured memory_bytes: 9036
n = int(input())

a = [list(map(int, input().split())) for i in range(n)]

# ?????????
sum_v = [[0 for i in range(n)] for i in range(n + 1)]
for i in range(n):
    c = 0
    for j in range(n):
        c += a[j][i]
        sum_v[j+1][i] = c

ans = -10**9


for sr in range(n):
    er = 0
    for er in range(sr, n):
        c = 0
        for col in range(n):
            c += sum_v[er+1][col] - sum_v[sr][col]
            ans = max(ans, c)
            if c < 0:
                c = 0  # c????????¢ (a(?????°) + b < b????????????

print(ans)

Measured memory_bytes: 8244
import scala.io.StdIn.readInt

object Main {
  def sieve(n:Int) = {
    val primes = Array.tabulate(n+1) { _ % 2 }
    primes(1) = 0
    primes(2) = 1

    for( i <- 3 to Math.sqrt(n).toInt by 2 )
      if(primes(i) == 1)
        (i*i to n by i*2).foreach { primes(_) = 0 }
    primes
  }

  def main(args:Array[String]) = {
    val p = sieve(50000)
    var n = 0
    while( { n = readInt; n} != 0 ) {
      var cnt = 0
      if(p(2) == 1 && p(n-2) == 1) cnt += 1
      for(i<- 3 to n/2 by 2)
        if(p(i) ==1 && p(n-i) ==1)
          cnt += 1
      println(cnt)
    }
  }
}

Measured memory_bytes: 51124
#include <bits/stdc++.h>
#define rep(i,N) for (int i = 0; i < (N); ++i)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main(void){
  int s, w;
  cin >> s >> w;

  if (s <= w) cout << "unsafe" << endl;
  else cout << "safe" << endl;
}


Measured memory_bytes: 3632
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <cmath>
#include <map>
#include <cstdlib>
using namespace std;
using ll = long long int;
int INF = 1e9+7;

int main() {
    int N,K;
    cin >> N >> K;
    if (N/2 >= K)
        cout << "YES" << endl;
    else if (N/2+1 == K && N%2 == 1)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(void){
    int L; scanf("%d", &L);
    int n = 0; while((1 << (n+1)) <= L) n++;
    int N = (1 << n) - 1; int U = L - N - 1;
    int l = L;
    int m = 2 * n + __builtin_popcount(U);
    printf("%d %d\n", n+1, m);
    for(int x = 0; x + 1 <= n; ++x) printf("%d %d 0\n%d %d %d\n", x+1, x+2, x+1, x+2, (1 << x));
    for(int d = n; d >= 0; --d) if((U >> d) & 1){
        l -= (1 << d);
        printf("%d %d %d\n", d+1, n+1, l);
    }
    return 0;
}

Measured memory_bytes: 888
#include<iostream>
#include<string>
#include<vector>
#include<utility>
#include<algorithm>
#include<map>
#include<cstdlib>
#include<cmath>
#include<numeric>
#include<iomanip>
#include<functional>
#include<cstdlib>
#include<queue>
#include<deque>
const double PI = acos(-1);
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
using ll =long long;
const int mod = 1000000007;

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

	friend ostream& operator<<(ostream & os, const mint & m) {
		os << m.x;
		return os;
	}
};
int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}
//組み合わせ
void recursive_comb(vector<int> indexes, int s, int rest, std::function<void(vector<int>)> f) {
	if (rest == 0) {
		f(indexes);
	}
	else {
		if (s < 0) return;
		recursive_comb(indexes, s - 1, rest, f);
		indexes[rest - 1] = s;
		recursive_comb(indexes, s - 1, rest - 1, f);
	}
}

// nCkの組み合わせに対して処理を実行する
void foreach_comb(int n, int k, std::function<void(vector<int>)> f) {
	vector<int>indexes(k);
	recursive_comb(indexes, n - 1, k, f);
}

ll gcd(ll a, ll b) {
	if (a % b == 0) {
		return b;
	}
	else {
		return gcd(b, a % b);
	}
}
ll lcm(ll a, ll b) {
	return a * b / gcd(a, b);
};
//fixed << setprecision(2)
int func(int j) {
	int tmp = j;
	int ans=1;
	tmp /= 10;
	while (tmp!=0) {
		ans++;
		tmp /=10;
	}
	return ans;
}

int main() {
	string s;
	cin >> s;
	int a[4];
	rep(i,4)a[i]=ctoi(s[i]);
	int sum=0;
	rep(i, 4) {
		sum += a[i];
	}
	int n = 3;
	int tmp;
	// {0, 1, ..., n-1} の部分集合の全探索
	for (int bit = 0; bit < (1 << n); ++bit) {
		vector<int> S;
		for (int i = 0; i < n; ++i) {
			if (bit & (1 << i)) { // 列挙に i が含まれるか
				S.push_back(i);
			}
		}
		tmp = sum;
		
		for (int i = 0; i < (int)S.size(); ++i) {
			tmp -= 2 * a[S[i]+1];
		}
		if (tmp == 7) {
				int j = 0;
			for (int i = 0; i < 3; i++) {
				cout << a[i];
				if (j < S.size() && S[j] == i) {

					cout << "-";
					j++;
				}
				else {
					cout << "+";
				}

			}
			cout << a[3]<<"=7";
			return 0;
		}
	
	}
}
	


Measured memory_bytes: 3620
#include<iostream>
#include<deque>
#include<list>
#include<vector>
#include<algorithm>
#include<cmath>
#include<stack>
#include<queue>
#include<iterator>
#include<string>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;

int main() {
	int h, w;
	cin >> h >> w;
	vector <string> a(h);
	rep(i, h) {
		cin >> a[i];
	}
	vector <bool>r(h, 0);
	vector <bool>c(w, 0);
	rep(i, h) {
		rep(j, w) {
			if (a[i][j]=='#') {
				r[i] = 1;
				c[j] = 1;
			}
		}
	}

	rep(i, h) {
		if (r[i]) {
			rep(j, w) {
				if (c[j])cout << a[i][j];
			}
			cout << endl;
		}
		
	}
}

Measured memory_bytes: 256