akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
using namespace std;
int m,n;
double a[100][100],b[100][100];
double f(int p,int q,double r){
  int i;
  double mx=0;
  if(p==m){
    mx=r;
  }else if(b[p][q]==0||b[p][q]<r){
    b[p][q]=r;
    for(i=0;i<n;i++)
      mx=max(mx,f(p+1,i,r*a[q][i]));
  }
  return mx;
}
int main(){
  int i,j;
  double mx;
  while(cin>>n>>m&&n+m){
    for(i=0;i<n;i++)
      for(j=0;j<n;j++)
	cin>>a[i][j];
    memset(b,0,sizeof(b));
    mx=0;
    for(i=0;i<n;i++)
      mx=max(mx,f(1,i,1));
    printf("%.2lf\n",mx);
  }
  return 0;
}

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

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ALL(a) begin(a),end(a)
#define COUNTOF(a) (sizeof(a)/sizeof(a[0]))
#define SP << " " <<
#define FMT(a) #a<<":"<<a 
#define FMT2(a,b) #a<<":"<<a<<", "<<#b<<":"<<b 
#define FMT3(a,b,c) #a<<":"<<a<<", "<<#b<<":"<<b<<", "<<#c<<":"<<c 
#define FMT4(a,b,c,d) #a<<":"<<a<<", "<<#b<<":"<<b<<", "<<#c<<":"<<c<<", "<<#d<<":"<<d 
typedef long long ll;
template<class T> istream& operator >> (istream& s, vector<T>& v) {
  for (T& x: v) s >> x;
  return s;
}
inline void Yes(bool f=true){cout<<(f?"Yes":"No")<<endl;}
inline void YES(bool f=true){cout<<(f?"YES":"NO")<<endl;}
#define ANS(a) cout<<a<<endl

int main()
{
    cin.tie(0); ios::sync_with_stdio(false);
    //cout<<std::fixed<<std::setprecision(10);

    int N; cin >>N;
    cout << N/3 << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int MOD = 1000000007;

int main(){
  int n;
  string s;
  cin >> n >> s;
  vector<int> vec(26);
  for(int i=0; i<n; ++i){
    ++vec[s[i]-'a'];
  }
  ll ans = 1;
  for(int i=0; i<26; ++i){
    if(vec[i] == 0)continue;
    ans *= vec[i] + 1;
    ans %= MOD;
  }
  --ans;
  if(ans < 0) ans += MOD;
  cout << ans << endl;
}

Measured memory_bytes: 3660
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define ALL(x) (x).rbegin(), (x).rend()
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 1e9;
const int MOD = 1000000007;
const double PI = acos(-1);
int dx[4] = {0,1,0,-1};
int dy[4] = {1,0,-1,0};

void solve() {
  int n;
  cin >> n;
  map<string, vector<pii>> mp;
  rep(i,n) {
    string s;
    int p;
    cin >> s >> p;
    mp[s].push_back(pii(p, i+1));
  }
  for (auto pr: mp) {
    sort(ALL(pr.second));
    for (auto i: pr.second) {
      cout << i.second << endl;
    }
  }
}

int main() {
  solve();
  return 0;
}

Measured memory_bytes: 3508
#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[i];
  }
  int num=0;
  for(int i=0;i<n;i++){
    if(a[i]%2!=0){
      continue;
    }
    while(a[i]%2==0){
      num++;
      a[i]/=2;
    }
  }
  cout<<num<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>

using namespace std;
#define N 100

int main(){
  int n;
  int M[N+1][N+1],p[N+1];
  cin>> n;

  for(int i=1;i<= n;i++){
    cin >> p[i-1]>> p[i];
  }
  for(int i=1;i<= n ;i++){
    M[i][i]=0;
  }
  for(int i=2;i<=n;i++){
    for(int j=1;j<=n-i+1;j++){
      int k=j+i-1;
      M[j][k] = (1 << 21);
      for(int l=j;l<= k-1 ; l++){
        M[j][k] = min(M[j][k],M[j][l]+M[l+1][k]+p[j-1]*p[l]*p[k]);
      }
    }
  }
  cout <<M[1][n]<<endl;
  return 0;
}



Measured memory_bytes: 3136
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; i++)
#define repr(i, n) for(int i = n; i >= 0; i--)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main()
{
  ll x;
  cin >> x;
  vector<ll> vec(1e5+1, 0);
  rep(i, 1e5) {
    vec[i+1] += vec[i] + i+1;
  }
  rep(i, 1e5+1) {
    if (vec[i] >= x) {
      cout << i << endl;
      return 0;
    }
  }
  return 0;
}

Measured memory_bytes: 3992
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#define rep(i,a,n) for(ll i =(a);i<(n);i++)
#define urep(i,a,n) for(ll i = (a);i>=(n);i--)
#define all(x) (x).begin(),(x).end()
#define INF 1e30
const int mod = 1e9 + 7;
typedef long long ll;
using namespace std;
ll dx[4] = { 1,-1,0,0 };
ll dy[4] = { 0,0,1,-1 };
ll N, M, Q, H, W, D, L, R, K, X, A, B, C, Z;
ll ans;
string S;
ll x[100000000];
ll y[100000000];
ll nowcost = 1;
ll gcd(ll a, ll b) {
	if (b == 0)return a;
	else return gcd(b, a%b);
}
ll DP[1000001];
int main() {
	cin>>x[0]>>x[1]>>x[2];
	rep(i,0,3){
		y[x[i]]++;
	}
	if(y[5]==2 && y[7]==1)cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
	return 0;
}

Measured memory_bytes: 4352
#!/usr/bin/env python
# -*- coding:utf-8 -*-

from collections import Counter
H, W, N = map(int, input().split())

ddx = [0, 0, 0, 1, 1, 1, -1, -1, -1]
ddy = [-1, 0, 1, -1, 0, 1, -1, 0, 1]

cnt = []
for _ in range(N):
    y, x = map(int, input().split())
    for dx, dy in zip(ddx, ddy):
        yy = y + dy
        xx = x + dx
        if 1<yy<H and 1<xx<W:
            cnt.append(yy * W + xx)
cnt = Counter(cnt)

ans = [0] * 10
ans[0] = (H-2) * (W-2)
for k in cnt:
    c = cnt[k]
    ans[c] += 1
    ans[0] -= 1
for i in ans:
    print(i)


Measured memory_bytes: 119920
#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
using namespace std;

#define rep(i,n) for(int i = 0; i<n; ++i)
#define REP(i,n) for(int i = 1; i<=n; ++i)
#define all(x) begin(x),end(x)
#define show(obj) {for(auto x:obj)cout<<x<<' ';cout<<endl;}
#define line "----------"
typedef long long ll;
typedef pair<int,int> P;
const int inf = 1001001000;
const ll INF = 1LL<<60;
const ll MOD = 1e9 + 7;

int main(){
	int H,W; cin>>H>>W;
	map<char, int> input;
	char c;
	rep(i,H*W){
		cin>>c;
		input[c]++;
	}
	priority_queue<int> Q;
	while(H > 0 && W > 0){
		int cnt4 = 0;
		int cnt2 = 0;
		if(H == 1 && W == 1){
			Q.push(1);
			--H; --W;
		}
		bool er_h = false, er_w = false;
		if(H>1){
			cnt4 += W/2;
			cnt2 += W%2;
			er_h = true;
		}
		if(W>1){
			cnt4 += H/2;
			cnt2 += H%2;
			er_w = true;
		}
		if(er_h)H -= 2;
		if(er_w)W -= 2;
		if(cnt4>0)cnt4--;
		rep(i,cnt4)Q.push(4);
		rep(i,cnt2)Q.push(2);
	}
	bool ok = true;
	while(!Q.empty()){
		int t = Q.top();
		Q.pop();
		bool can = false;
		for(auto x: input){
			if(x.second >= t){
				input[x.first] -= t;
				can = true;
				break;
			}
		}
		if(!can)ok = false;
		// for(auto x: input)cout<<x.first<<' '<<x.second<<endl;
	}
	cout<<((ok)?"Yes":"No")<<endl;
	return 0;
}

Measured memory_bytes: 256
n = gets.to_i
s = gets.chomp.split('')
(0...s.size).each do |i|
  if s[i].ord + n <= 'Z'.ord
    s[i] = (s[i].ord + n).chr
  else
    s[i] = (s[i].ord + n -26).chr
  end
end
puts s.join('')

Measured memory_bytes: 2812
k,n = map(int,input().split())
A = list(map(int,input().split()))
A.append(A[0]+k)
B = [0 for i in range(n)]
for j in range(n):
    B[j] = A[j+1] - A[j]
#print(A)
#print(B)
B.sort()
B.pop()
#print(B)
ans = sum(B)
print(ans)

Measured memory_bytes: 26444
#define rep(i,n) for(int i=0;i<n;i++)
#define ck(a,b) (0<=(a)&&(a)<b)
using namespace std;
int dx[]={-1,1,0,0},dy[]={0,0,-1,1};

char r[21][21];
int w,h,c;

void rec(int y,int x){
	if(r[y][x]=='.')c++;
	r[y][x]='#';
	rep(d,4){
		int cy=y+dy[d],cx=x+dx[d];
		if(ck(cy,h)&&ck(cx,w)&&r[cy][cx]=='.')rec(cy,cx);
	}
}
int main(){
	int sx,sy;
	while(cin>>w>>h,w){
		rep(i,h)rep(j,w){
			cin>>r[i][j];
			if(r[i][j]=='@')sx=j,sy=i;
		}
		c=1;
		rec(sy,sx);
		cout<<c<<endl;
	}
	return 0;
}

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

using namespace std;
typedef long long ll;
#define int ll

template<typename T1,typename T2> inline void chmin(T1 &a, T2 b){ if(a > b) a = b; }
template<typename T1,typename T2> inline void chmax(T1 &a, T2 b){ if(a < b) a = b; }

#define REP(i,n) for(int i=0;i<n;++i)
#define SORT(name) sort(name.begin(), name.end())
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))
#if 1
#  define DBG(fmt, ...) printf(fmt, ##__VA_ARGS__)
#else
#  define DBG(fmt, ...)
#endif

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const double DINF = std::numeric_limits<double>::infinity();
const int MOD = 1000000007;
const int MAX_N = 100010;

signed main() {
    cin.tie(0); cout.tie(0);
    ios::sync_with_stdio(false);

    int N;
    cin >> N;

    string P = "", Q = "";
    REP(i, N) {
        int p;
        cin >> p;
        P += to_string(p);
    }
    REP(i, N) {
        int q;
        cin >> q;
        Q += to_string(q);
    }

    vector<int> v;
    for(int i = 1; i <= N; ++i) {
        v.push_back(i);
    }
    SORT(v);

    vector<string> pat;
    do {
        string s = "";
        REP(i, N) {
            s += to_string(v[i]);
        }
        pat.push_back(s);
    } while( next_permutation(v.begin(), v.end()));

    SORT(pat);

    int a, b;
    REP(i, pat.size()) {
        if(pat[i] == P) {
            a = i + 1;
        }
        if(pat[i] == Q) {
            b = i + 1;
        }
    }

    int ans = abs(a - b);
    printf("%lld\n", ans);

    return 0;
}


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


void solve () {
   long long n, m;
    cin >> n >> m;
    if (abs(n - m) > 1) {
        cout << 0;
        return;
    }
    long long f = 1;
    long long md = 1e9 + 7;
    for (int i = 2; i <= min (n, m); i++) {
        f = f * i % md;
    }
    long long x = 1;
    long long mx = max(n, m);
    if (n == m){
        x = 2;
        mx = 1;
    }
    f = f * f % md;
    cout << f * mx * x % md;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    solve();
    return 0;
}


Measured memory_bytes: 3472
#include <iostream>
#include <vector>
#include <numeric>
#include <algorithm>

using namespace std;

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

  int sum = accumulate(d.begin(), d.end(), 0);
  for (int i=0; i<n; i++) {
    ans += (sum-=d[i])*d[i];
  }

  cout << ans << endl;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline
from collections import deque


def read():
    sx, sy, tx, ty = map(int, input().strip().split())
    return sx, sy, tx, ty


def solve(sx, sy, tx, ty):
    dx = tx - sx
    dy = ty - sy
    q = deque()
    q.append("U" * dy)
    q.append("R" * dx)
    q.append("D" * dy)
    q.append("L" * dx)
    q.append("L" * 1)
    q.append("U" * (dy+1))
    q.append("R" * (dx+1))
    q.append("D" * 1)
    q.append("R" * 1)
    q.append("D" * (dy+1))
    q.append("L" * (dx+1))
    q.append("U" * 1)
    return "".join(q)


if __name__ == '__main__':
    inputs = read()
    print(solve(*inputs))


Measured memory_bytes: 3316
#include<bits/stdc++.h>
using namespace std;
#define ll long long
typedef pair<ll,ll> P;
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; }
#define M 1000000007
#define all(a) (a).begin(),(a).end()
#define rep(i,n) reps(i,0,n)
#define reps(i,m,n) for(int i=(m);i<(n);i++)
int main(){
  int n,k;cin>>n>>k;
  vector<int> a(n);
  rep(i,n){
    cin>>a[i];
  }
  int c=0,m=0;
  rep(i,n){
    if(i<k)c+=a[i];
    else{
      c+=a[i];c-=a[i-k];
    }
    chmax(m,c);
  }
  cout<<fixed<<setprecision(10)<<(double)(m+k)/2.0;
}

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

using ll = long long;

struct Edge {
    int to;
    ll cost;
    Edge(int to, ll cost) : to(to), cost(cost) {}
};

ll dist[100100];
int N;
vector<Edge> G[100100];

void dfs(int u, int p=-1, int d=0, ll c=0) {
    dist[u] = c;
    for (auto& e : G[u]) {
        if (e.to == p) continue;
        dfs(e.to, u, d + 1, c + e.cost);
    }
}

int main() {
    cin >> N;
    for (int i = 0; i < N - 1; i++) {
        int from, to;
        ll cost;
        cin >> from >> to >> cost;
        from--, to--;
        G[from].emplace_back(to, cost);
        G[to].emplace_back(from, cost);
    }
    int Q, K;
    cin >> Q >> K;
    K--;
    dfs(K);

    for (int i = 0; i < Q; i++) {
        int x, y;
        cin >> x >> y;
        x--, y--;
        cout << dist[x] + dist[y] << endl;
    }
}


Measured memory_bytes: 16768
#include <bits/stdc++.h>
//#include <mylib.h>
using namespace std;
//cin.sync_with_stdio(false);

#define FOR(i,a,b) for(int i = (a); i < (b); ++i)
#define FOR_EQ(i,a,b) for(int i = (a); i <= (b); ++i)
#define FOR_RE(i,a,b) for(int i = (a); i > (b); --i)
#define rep(i,n) FOR(i,0,n)
#define rep_eq(i,n) FOR_EQ(i,0,n)
#define rep_re(i,n) FOR_RE(i,n,0)

#define WHITE 1//（未訪問）
#define GRAY 2//（訪問）未だに訪問していない頂点への辺を持っている。スタックに退避。
#define BLACK 3//（訪問完了）未訪問への頂点への辺を持たない
#define N 100
#define INFTY (1 << 21) //10^21
int M[N][N];//隣接行列
int color[N];

//1個上から時計周り
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
//上右下左
const int dx[4] = {0, 1, 0, -1};
const int dy[4] = {1, 0, -1, 0};
static const int NIL = -1;

typedef unsigned long long ull;
typedef long long ll;
typedef vector<int> Vector;
typedef vector<Vector>	DVector;
int n;

//配列の表示
void printArray(int array[], int n){
    rep(i, n){
        if(i)   cout << " ";
        cout << array[i];
    }
    cout << endl;
}

int main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    int color[8];
    rep(i, 8)   color[i] = 0;
    cin >> n;
    int a, rainbow = 0, ans = 0;
    
    
    rep(i, n){
        cin >> a;
        a /= 400;
        if(a >= 8)  rainbow++;
        else    color[a]++;
    }
    
    rep(i, 8){
        if(color[i])    ans++;
    }
    
    if(ans == 0){
        cout << 1 << " " << rainbow << endl;
    }else{
        cout << ans << " " << ans + rainbow << endl;
    }
}

Measured memory_bytes: 256
// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
//#define int ll
typedef ll Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
// #define mt make_tuple
//typedef tuple<pii,int,int> tp;
//typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
//template<class C>constexpr int size(const C &c){return (int)c.size();}
//template<class T,size_t N> constexpr int size(const T (&xs)[N])noexcept{return (int)N;}
const double PI=acos(-1);
const double EPS=1e-7;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
int main(){
	int n,a,b;
	cin>>n>>a>>b;
	a=b-a;
	if(a%2)cout<<"Borys"<<endl;
	else cout<<"Alice"<<endl;
}








Measured memory_bytes: 256
import java.io.*;
import java.util.*;
import java.lang.*;

public class Main {
    static class FastScanner {
        private final InputStream in = System.in;
        private final byte[] buffer = new byte[1024];
        private int ptr = 0;
        private int buflen = 0;

        private boolean hasNextByte() {
            if (ptr < buflen) {
                return true;
            } else {
                ptr = 0;
                try {
                    buflen = in.read(buffer);
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (buflen <= 0) {
                    return false;
                }
            }
            return true;
        }

        private int readByte() {
            if (hasNextByte()) return buffer[ptr++];
            else return -1;
        }

        private static boolean isPrintableChar(int c) {
            return 33 <= c && c <= 126;
        }

        public boolean hasNext() {
            while (hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;
            return hasNextByte();
        }

        public String next() {
            if (!hasNext()) throw new NoSuchElementException();
            StringBuilder sb = new StringBuilder();
            int b = readByte();
            while (isPrintableChar(b)) {
                sb.appendCodePoint(b);
                b = readByte();
            }
            return sb.toString();
        }

        public long nextLong() {
            if (!hasNext()) throw new NoSuchElementException();
            long n = 0;
            boolean minus = false;
            int b = readByte();
            if (b == '-') {
                minus = true;
                b = readByte();
            }
            if (b < '0' || '9' < b) {
                throw new NumberFormatException();
            }
            while (true) {
                if ('0' <= b && b <= '9') {
                    n *= 10;
                    n += b - '0';
                } else if (b == -1 || !isPrintableChar(b)) {
                    return minus ? -n : n;
                } else {
                    throw new NumberFormatException();
                }
                b = readByte();
            }
        }

        public int nextInt() {
            long nl = nextLong();
            if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
            return (int) nl;
        }

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

    public static void main(String[] args) {
        FastScanner fs = new FastScanner();
        long x = fs.nextLong(), y = fs.nextLong();
        if (x < y) {
            long tmp = y;
            y = x;
            x = tmp;
        }
        long diff = x - y;
        if (diff <= 1) {
            System.out.println("Brown");
        } else {
            System.out.println("Alice");
        }
    }
}


Measured memory_bytes: 23252
hitachi = True
s = input()
if(len(s) % 2 != 0):
    hitachi = False
for i in range(0, len(s), 2):
    if(hitachi == False):
        break
    if(s[i] != 'h' or s[i + 1] != 'i'):
        hitachi = False
if(hitachi):
    print('Yes')
else:
    print('No')

Measured memory_bytes: 38384
#include<bits/stdc++.h>
const int N=200005;
using namespace std;
int n,a[N],sx[N],sy[N],t,mi,ans;
bool chk(){
	t=0;
	for(int i=1;i<n;i++)
	if(a[i]<=a[i-1]){
		for(;t&&sx[t]>a[i];t--);
		for(int j=a[i];j;j--,t--)
		if(sx[t]==j){
			if(++sy[t]<mi)break;
		}else{sx[++t]=j,sy[t]=1;break;}
		if(sy[t]>=mi||!t)return 0;
	}return 1;
}
int main(){
	scanf("%d",&n);
	for(int i=0;i<n;i++)
	scanf("%d",a+i);
	for(int l=1,r=n;l<=r;){
		mi=l+r>>1;
		chk()?ans=mi,r=mi-1:l=mi+1;
	}printf("%d",ans);
}


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

int main() {
  int N, a, ans;
  cin >> N;
  a=(N-N%1000)/1000;
  if (N%1000==0) {
    cout << 0 << endl;
  }
  else {
    ans=1000*(a+1)-N;
    cout << ans << endl;
  }
}

Measured memory_bytes: 3620
#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;
set<string>f;
cin>>n;
for(ll i=1;i<=n;++i){
  string s;cin>>s;
  f.insert(s);
}
cout<<f.size();
return 0;
}

/*
 WA? check edge cases, N=1,M=1 etc. Read code fully once and check all variables.
 Read the question again and see what you might have missed.
 Consider changing your solution or find more cases.
 */


Measured memory_bytes: 19236
#include <stdio.h>
#include <algorithm>
#define inf 1000000111
#define N 1005

using namespace std;

struct Calender
{
     int l, r;
     char st[22];
}cale[N];

int cmp(Calender x, Calender y)
{
     return x.l < y.l;
}

int main()
{
     int n, q, x;
     while(scanf("%d%d", &n, &q))
     {
          if(n == 0 && q == 0)
          {
               break ;
          }
          for(int i = 0; i < n; i++)
          {
               scanf("%s%d%d", cale[i].st, &x, &cale[i].r);
               cale[i].l = cale[i].r - x;
          }
          sort(cale, cale + n, cmp);
          cale[n].l = inf;

          while(q--)
          {
               scanf("%d", &x);
               for(int i = 0; i <= n; i++)
               {
                    if(cale[i].l >= x)
                    {
                         if(i > 0 && cale[i - 1].l < x && cale[i - 1].r >= x)
                         {
                              printf("%s %d\n", cale[i - 1].st, x - cale[i - 1].l);
                         }
                         else
                         {
                              printf("Unknown\n");
                         }
                         break ;
                    }
               }
          }
     }
     return 0;
}

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

int main() {
    long long a, b, c, d;
    cin >> a >> b >> c >> d;

    long long x, y;
    x = max(a*c,a*d);
    y = max(b*c,b*d);

    cout << max(x,y) << endl;

    return 0;
}


Measured memory_bytes: 3632
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <cstdio>
#include <string>
#include <cmath>
#include <queue>
#include <tuple>
//#include <bits/stdc++.h>
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repr(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i,i0,n) for(int (i)=(i0);(i)<(n);(i)++)
#define FORR(i,i0,n) for(int (i)=(n)-1; (i)>=(i0);(i)--)
#define SORT(x) sort(x.begin(),x.end())
#define rn return
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
typedef std::pair<int,int> P;
using namespace std;
using ll = long long;


int main(){
    int N,X; cin >> N >> X;
    int L;
    int ans = 1;
    int pos = 0;
    rep(i,N){
        cin >> L;
        pos += L;
        if (pos<=X){
            ans++;
        }
        else{
            break;
        }
    }
    cout << ans;
    rn 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define int ll
#define double long double
#define YES {cout<<"YES"<<'\n';}
#define NO {cout<<"NO"<<'\n';}
#define Yes {cout<<"Yes"<<'\n';}
#define No {cout<<"No"<<'\n';}
#define yes {cout<<"yes"<<'\n';}
#define no {cout<<"no"<<'\n';}
void YN(bool flg){cout<<(flg?"YES":"NO")<<'\n';}
void Yn(bool flg){cout<<(flg?"Yes":"No")<<'\n';}
void yn(bool flg){cout<<(flg?"yes":"no")<<'\n';}
#define SORT(a) sort(a.begin(),a.end())
#define REVERSE(a) reverse(a.begin(),a.end())
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define out(n) {cout << n << '\n';}
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<VI> VVI;
const int MOD = 1000000007;
const long long INF = 10e10;
const double PI = acos(-1.0);
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; }
template<class T>auto MAX(const T& a) { return *max_element(a.begin(),a.end()); }
template<class T>auto MIN(const T& a) { return *min_element(a.begin(),a.end()); }
int ABS(int a) {if(a<0) a = -a; return a;}
template<class T, class U>U SUM(const T& a, const U& v) { return accumulate(a.begin(),a.end(), v); }
template<class T, class U>U COUNT(const T& a, const U& v) { return count(a.begin(),a.end(), v); }
template<class T, class U>int LOWER(const T& a, const U& v) { return lower_bound(a.begin(),a.end(), v) - a.begin(); }
template<class T, class U>int UPPER(const T& a, const U& v) { return upper_bound(a.begin(),a.end(), v) - a.begin(); }
int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
int LCM(int a, int b) { int g = GCD(a, b); return a / g * b; }
int POW(int a, int n) { int r = 1; while (n > 0) { if (n & 1)r *= a; a *= a; n /= 2; }return r; }
int isPrime(int n){if(n<2){return 0;}for(int i=2; i*i<=n; i++){if(n%i==0){return 0;}}return 1;}
/*素因数分解*/map< int, int >prime_factor(int n){map< int, int > ret;for(int i = 2; i * i <= n; i++) {while(n % i == 0) {ret[i]++;n /= i;}}if(n != 1) ret[n] = 1;return ret;}
/*約数の個数*/int divisor_number(int n){auto p = prime_factor(n); int res = 1; for(auto x:p)res*=(x.second+1); return res;}
/*約数列挙*/vector<int> divisor(int n){vector<int> v; for(int i=1; i*i<=n; i++){if(n%i==0){v.push_back(i);if(i!=n/i){v.push_back(n/i);}}}sort(v.begin(),v.end()); return v;}
//----------------ライブラリとか----------------

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout<<fixed<<setprecision(15);

    int a,b,c; cin >> a >> b >> c;
    Yn(a+b>=c);

    return 0;
}

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

using namespace std;
typedef long long ll;

int main() {
	string a = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
	int n;
	cin >> n;
	string s;
	cin >> s;

	for(int i = 0; i < s.length(); i++){
		for(int j = 0; j < 26; j++){
			if(s[i] == a[j]){
				int temp = (j+n) % 26;
//				cout << temp << endl;
				cout << a[temp];
			}
		}
	}
	cout << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pll;
typedef unsigned long long ull;

const int MOD = 1000000007 ; //  , 1000000009 , 1000000023 ,998244353
const ll INF = ll(1e18);
const ld PI = 4*atan((ld)1);

ll power(ll x,ll n) {
  ll result=1;
  while(n>0){
    if(n&1)result = (result * x)%MOD;
    x=(x*x)%MOD;
    n >>= 1;
  }
  return result%MOD;
}
ll gcd(ll a,ll b){
  if(a==0)return b;
  return gcd(b%a,a);
}
int main() {
  #ifdef AVI  
    freopen("input.txt" , "r" , stdin);
  #endif
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.precision(20);

  ll n,k;
  cin >> n >> k;
  ll dp[n+1][n+1] = {0};
  dp[0][0] = 1 , dp[1][0] = 1 , dp[1][1] = 1;
  
  for(ll i=1 ; i<=n ; i++){
    for(ll j=0 ; j<=i ; j++){
      if(j==i || j==0){
        dp[i][j] = 1;
        continue;
      }
      dp[i][j] = (dp[i-1][j] + dp[i-1][j-1])%MOD;
      dp[i][j] %= MOD;
    }
  }
  for(ll i=1 ; i<=k ; i++){
    cout << ((dp[k-1][i-1]%MOD)*(dp[n-k+1][i]%MOD))%MOD << '\n';
  }
}

Measured memory_bytes: 31488
#include <bits/stdc++.h>
using namespace std; 
int main(){
    ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
    int n;
    cin >> n;
    vector<int> arr(n);
    for(auto &i: arr)
        cin >> i;
    int ans = 0;
    for (int i=0; i<n; i++)
        for(int j=i+1; j<n; j++)
            for(int k=j+1; k<n; k++){
                if (arr[i]!=arr[j] && arr[j]!=arr[k] && arr[i]!=arr[k]){
                    vector<int> t{arr[i],arr[j], arr[k]};
                    sort(t.begin(), t.end());
                    if (t[0]+t[1]>t[2]) {
                        ans++;
                    }
                }
            }
    cout  << ans <<"\n";
}

Measured memory_bytes: 3656
#include <bits/stdc++.h>
using namespace std;
// define
#define int long long
#define UNIQUE(v) v.erase(unique(all(v)), v.end());
#define ZIP(v) sort(all(v)),UNIQUE(v)
#define ADD(a, b) a = (a + b) % mod
#define SUB(a, b) a = (a+mod-b)%mod
#define MUL(a, b) a = (a * b) % mod
#define rollcall cout << "I'm Sucu." << endl;
#define repi(i,m,n) for(int i = m;i < n;i++)
#define drep(i,n,m) for(int i = n;i >= m;i--)
#define rep(i,n) repi(i,0,n)
#define rrep(i,n) repi(i,1,n+1)
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(), v.rend()
#define dmp(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define pf(x) push_front(x)
#define fi first
#define se second
// debug
template <typename T, typename U>
ostream &operator<<(ostream &os, const pair<T, U> &p){
  os << "(" << p.first << "," << p.second << ")";return os;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v){
  for (auto it = v.begin();it != v.end();++it){
    if(it != v.begin())os << " ";os << *it;
      }return os;
}
template <typename T, typename U>
ostream &operator<<(ostream &os, const map<T, U> &mp){
  for(auto x: mp)os << "(" << x.first << "," << x.second << ")" << endl;
  return os;
}
template<typename T, int SIZE>
int array_length(const T (&)[SIZE]){return SIZE;}
template<typename T, int N>
void PRINTF(const T (&a)[N], int s = N, int t = -1, bool f = true){
	if(t == -1){rep(i,s){if(i)cout << " ";cout << a[i];}}
	else repi(i,s,t){if(i!=s)cout << " ";cout << a[i];}
	if(f)cout << "\n";
}
template<typename T, int N1, int N2>
void PRINTF(const T (&a)[N1][N2], int h = N1, int w = N2){
	rep(i,h){rep(j,w){cout << a[i][j] << " \n"[j==w-1];}}
}
// typedef
typedef complex<double> Point;
typedef pair<int, int> P;
typedef pair<int, P> PP;
typedef pair<P, int> Pi;
typedef vector<int> vi;
typedef deque<int> dq;
const int inf = 1e9+7;
const int INF = 1e18+7;
const int MAX = 5e5;


int x[MAX], y[MAX], s[MAX];
signed main(){
   int n;
   scanf("%lld", &n);
   rep(i,n)scanf("%lld%lld", &x[i], &y[i]);
   rep(i,n){
     s[i] = llabs(x[i])+llabs(y[i]);
     if(llabs(s[i]-s[0])%2){printf("-1\n");return 0;}
   }
   
   vector<int> vec;
   drep(i,32,0)vec.pb(1LL<<i);
   if(s[0]%2 == 0)vec.pb(1);
   int m = vec.size();
   printf("%lld\n", m);
   rep(i,m)printf("%lld%c", vec[i], " \n"[i == m-1]);
   rep(i,n){
     string str = "";
     rep(j,m){
       int d = vec[j];
       if(llabs(x[i]) <= llabs(y[i])){
         if(y[i] > 0){str.pb('U');y[i] -= d;}
         else{str.pb('D');y[i] += d;}
       }else{
         if(x[i] < 0){str.pb('L');x[i] += d;}
         else{str.pb('R');x[i] -= d;}
       }
     }
     cout << str << endl;
   }
  return 0;
}










Measured memory_bytes: 4352
import math
n=int(input())
x=input()
x0=x.split()
a=[int(n) for n in x0]
m=1000
for i in range(n-1):
    if a[i]<a[i+1]:
        m1=int(math.floor(m/a[i]))
        m=m+m1*(a[i+1]-a[i])
print(m)

Measured memory_bytes: 62200
#include<iostream>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;

const int inf = 999999999;
const double pi = acos(-1);
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};

#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define mod(i) ((i)%(ll)(1e9 + 7))
#define divm(a,b) (mod(a * modpow((ll)b,(ll)(1e9+5))))
#define rsort(a,b,c) sort(a, b, greater<c>())
#define vsort(v) sort(v.begin(), v.end());
#define ft first
#define sd second
#define pb push_back
#define it insert
#define sz(x) ((int)(x).size())
#define lb(a,n,k) (lower_bound(a,a+n,k) - a) 
#define vlb(a,k)  (lower_bound(a.begin(),a.end(),k) - a.begin())
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define ret return

ll modpow(ll i,ll j){ ll tmp=1; while(j){ if(j%2)tmp=mod(tmp*i);i=mod(i*i);j/=2;}return tmp;}
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 main(){
	int n;
    string s,t;
    cin >> n >> s >> t;

    rep(i,0,sz(s)){
        bool flag = 0;
        rep(j,0,sz(t)){
            if(i+j >= sz(s))break;
            if(s[i+j] != t[j]){
                flag = 1;
                break;
            }
        }
        if(flag == 0){
            cout << i + sz(t) << endl;
            return 0;
        }
    }
    cout << sz(s) + sz(t) << endl;
	return  0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
 
N, K = map(int, input().split())
A = list(map(int, input().split()))
 
def gcd(a, b):
    if a > b:
        a, b = b, a
    # assert(a <= b)
    if b%a == 0:
        return a
    else:
        return gcd(b%a, a)
 
def gcd_many(l):
    # if len(l) == 1:
    #     return l
    # elif len(l) == 2:
    #     return gcd(l[0], l[1])
    # else:
    #     return gcd(l[0], gcd_many(l[1:]))
    if len(l) == 1:
        return l[0]
    g = l[0]
    for i in range(1,len(l)):
        g = gcd(g, l[i])
    return g
 
Amax = max(A)
g = gcd_many(A)
 
possible = "POSSIBLE"
impossible = "IMPOSSIBLE"
 
 
if K > Amax:
    print(impossible)
else:
    if K % g == 0:
        print(possible)
    else:
        print(impossible)

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

int f(int n) {
    int ret = 1;
    for (int i = n; i > 0; i--) ret *= n;
    return ret;
}

int main() {
    int n;
    cin >> n;
    long double x[8], y[8];
    rep(i, n) cin >> x[i] >> y[i];

    long double ans = 0;
    for (int i = 0; i < n-1; i++) {
        for (int j = i+1; j < n; j++) {
            ans += sqrt( (x[i]-x[j]) * (x[i]-x[j]) + (y[i]-y[j]) * (y[i]-y[j]) );
        }
    }

    ans *= 2.0/(long double)n;

    cout << fixed << setprecision(10) << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <iterator>
#include <vector>

using namespace std;


int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n, m, v, p;
    cin >> n >> m >> v >> p;
    vector<long long> A;
    A.reserve(n);
    copy_n(istream_iterator<long long>(cin), n, back_inserter(A));
    sort(A.begin(), A.end());

    auto ok = [&](int i) {
        auto last_it = upper_bound(A.begin(), A.end(), A[i]);
        --last_it;
        i = distance(A.begin(), last_it);
        if (i >= n - p) {
            return true;
        }
        auto w = max(0, v - p - i);
        long long ai = A[i] + m;
        long long todo = 0;
        for (int j = i + 1; j < n - (p - 1); ++j) {
            if (A[j] <= ai) {
                todo += ai - A[j];
            } else {
                return false;
            }
        }
        return todo >= (long long)m * w;
    };

    int ans;
    if (ok(0)) {
        ans = n;
    } else {
        int a = 0;
        int b = n - 1;
        while (b - a > 1) {
            int c = a + (b - a) / 2;
            if (ok(c)) {
                b = c;
            } else {
                a = c;
            }
        }
        ans = n - b;
    }
    cout << ans << endl;
    return 0;
}


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

using namespace std;
#define all(a)a.begin(),a.end()
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int mod= int(1e9)+7;
using P = pair<ll,ll>;
using ld=long double;

int main(){
    int a,b;cin >>a>>b;
    a+=b;
    int ans=(a-1)/2+1;
    cout <<ans <<endl;
    return 0;
}


Measured memory_bytes: 3520
#include <cstdio>
#include <cstring>
#include <string>
#include <iostream>
#include <algorithm>
#define MAXN 200001

int n, m, k, ans, a[MAXN], b[MAXN];
long long suma[MAXN], sumb[MAXN];

int max(int a, int b) { return a > b ? a : b; }

int main() {
	scanf("%d %d %d", &n, &m, &k);
	for (int i = 1; i <= n; ++i) {
		scanf("%d", &a[i]);
		suma[i] = suma[i - 1] + a[i];
	}
	for (int i = 1; i <= m; ++i) {
		scanf("%d", &b[i]);
		sumb[i] = sumb[i - 1] + b[i];
	}
	for (int i = 0; i <= n; ++i) {
		int temp = k - suma[i];
		if (temp == 0) ans = max(ans, i);
		if(temp < 0) break;
		int pos = std::upper_bound(sumb + 1, sumb + m +1, temp) - sumb;
		ans = max(ans, i + pos - 1);
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 8484
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <cmath>
#include <map>
#include <climits>
#include <cassert>
#include <algorithm>
#include <utility>

using namespace std;
using Int = long long int;
using UInt = unsigned long long int;
using VI = vector<long long int>;
using VVI = vector<vector<long long int> >;

// 二つの値の最小値を求める関数
Int Min(const Int a, const Int b) {
    if (a <= b) {
        return a;
    } else {
        return b;
    }
}

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

    Int result = LLONG_MAX;
    Int root = floor(sqrt(n));
    for (Int i = 1; i <= root; ++i) {
        if (n % i == 0) {
            result = Min(result, i + n / i);
        }
    }
    cout << result - 2 << endl;
    return 0;
}


Measured memory_bytes: 3580
package main

import (
	"bufio"
	. "fmt"
	"io"
	"math"
	"os"
)

// github.com/EndlessCheng/codeforces-go
func run(_r io.Reader, _w io.Writer) {
	in := bufio.NewReader(_r)
	out := bufio.NewWriter(_w)
	defer out.Flush()

	var n int
	var b float64
	Fscan(in, &n,&b)
	a := int(math.Round(b*100))
	Fprintln(out, n*a/100)
}

func main() { run(os.Stdin, os.Stdout) }


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

int main() {
  string s, alp = "abcdefghijklmnopqrstuvwxyz";
  cin >> s;
  
  int num[10000] = {0};
  
  for ( int i = 0; i < s.size() ; ++i){
   num[s.at(i)]++;
  }
  
  for ( int i = 0; i < alp.size(); ++i){
    if(num[alp.at(i)] == 0) {
      cout << alp.at(i) << endl;
      return 0;
    }
  }
  cout << "None" << endl;
 
}


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

int main()
{
	int n;
	cin >> n;
	vector<int>a(n);
	for(int i = 0;i<n;i++)
	{
		cin >> a[i];
	}
	sort(a.begin(),a.end(),greater<>());
	ll tate=0,yoko=0;
	for(int i = 0;i<n-1;i++)
	{
		if(a[i]==a[i+1])
		{
			if(tate==0)tate=a[i];
			else
			{
				yoko = a[i];
				break;
			}
			i++;
		}
	}
	cout<<tate*yoko<<endl;
	return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define ios ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
using namespace std;
const int MAXN=100100;
int a[10],b[10],c[10];
int main()
{
    ios;
    int n;
    cin>>n;
    for(int i=1;i<=n;i++) cin>>b[i];
    for(int i=1;i<=n;i++) cin>>c[i];
    for(int i=1;i<=n;i++) a[i]=i;
    int cnt=1,ans1,ans2;
    int flag1=0,flag2=0;
    do{
        int f1=1, f2=1;
        if(!flag1){
            for(int i=1;i<=n;i++){
                if(a[i]!=b[i]){
                    f1=0; break;
                }
            }
            if(f1){
                ans1=cnt;
                flag1=1;
            }
        }
        if(!flag2){
            for(int i=1;i<=n;i++){
                if(a[i]!=c[i]){
                    f2=0; break;
                }
            }
            if(f2){
                ans2=cnt;
                flag2=1;
            }
        }
        if(flag1 && flag2) break;
        cnt++;
    }while(next_permutation(a+1,a+1+n));
    cout<<abs(ans1-ans2)<<'\n';
    return 0;
}

Measured memory_bytes: 3596
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=1;i<=n;i++)
#define pb push_back
#define pf push_front
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef long long ll;

int main()
{
	ios::sync_with_stdio(false);
	int ans=0;
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	for (int i=0;i<=100;i++){
		if (i>=a&&i<b&&i>=c&&i<d) ans++;
	}
	cout<<ans;
}

Measured memory_bytes: 256
import sys
stdin = sys.stdin

def li(): return [int(x) for x in stdin.readline().split()]
def li_(): return [int(x)-1 for x in stdin.readline().split()]
def lf(): return [float(x) for x in stdin.readline().split()]
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(ns())
def nf(): return float(ns())


a,b = li()

if a%2 == 1 and b%2 == 1:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3316
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
  ll h,w;cin>>h>>w;
  string s[h];
  for(ll i=0;i<h;i++)cin>>s[i];
  bool used[h][w];
  for(ll i=0;i<h;i++)for(ll j=0;j<w;j++)used[i][j]=false;
  ll ans=0;
  ll dx[4]={-1,1,0,0};
  ll dy[4]={0,0,-1,1};
  for(ll i=0;i<h;i++){
    for(ll j=0;j<w;j++){
      if(s[i][j]=='.'||used[i][j]==true)continue;
      ll c=0;
      ll d=0;
      queue<pair<ll,ll>> q;
      q.push(make_pair(i,j));
      used[i][j]=true;
      while(q.size()>0){
        pair<ll,ll> p=q.front();q.pop();
        ll pf=p.first,ps=p.second;
        //cout<<pf<<" "<<ps<<endl;
        if(s[pf][ps]=='#')c++;
        else d++;
        for(ll k=0;k<4;k++){
          ll in=pf+dy[k],jn=ps+dx[k];
          if(in<0||in>=h||jn<0||jn>=w||used[in][jn]==true)continue;
          if(s[pf][ps]==s[in][jn])continue;
          q.push(make_pair(in,jn));
          used[in][jn]=true;
        }
      }
      ans+=c*d;
      //cout<<c<<" "<<d<<endl;
    }
  }
  cout<<ans<<endl;
}
          


Measured memory_bytes: 640
s = input()
for i in range(8):
    total = int(s[0])
    str = s[0]
    for j in range(1, 4):
        if i >> (j - 1) & 1:
            total += int(s[j])
            str += '+' + s[j]
        else:
            total -= int(s[j])
            str += '-' + s[j]
    if total == 7:
        print(str + '=7')
        exit()

Measured memory_bytes: 3060
import java.util.Scanner;

public class Main{
  public static void main(String[] args){
    
    Scanner scanner = new Scanner(System.in);
      
    int K = scanner.nextInt();
    long X = scanner.nextLong();
    
    int sum = 500*K;
    
    if(sum >= X){
      System.out.println("Yes");
    }else{
      System.out.println("No");
    }
  
  }
  
}

    
    


Measured memory_bytes: 21844
#include <cstdint>
#include <iostream>

using namespace std;

#define MAX_R 8
#define MAX_VERTEX 200

static uint32_t rs[MAX_R];
static uint32_t perm[MAX_R];
static bool used[MAX_R];
static uint64_t routes[MAX_VERTEX][MAX_VERTEX];

uint64_t apply_all_patterns(uint32_t len, uint32_t max)
{
  if (len == max) {
    uint64_t weight = 0;
    for (uint32_t i = 0; i < (max - 1); i++) {
      weight += routes[perm[i]][perm[i + 1]];
    }
    return weight;
  } else {
    uint64_t min_weight = UINT32_MAX;
    for (uint32_t i = 0; i < max; i++) {
      if (used[i]) continue;
      perm[len] = rs[i];
      used[i] = true;
      uint64_t weight = apply_all_patterns(len + 1, max);
      if (weight > 0) {
        min_weight = min(weight, min_weight);
      }
      used[i] = false;
    }
    return min_weight;
  }
}

uint32_t min_path(int32_t R)
{
  return apply_all_patterns(0, R);
}

void init_routes(uint32_t N)
{
  for (uint32_t i = 0; i < N; i++) {
    for (uint32_t j = 0; j < N; j++) {
      routes[i][j] = UINT32_MAX;
    }
  }
}

int32_t main()
{
  uint32_t N, M, R;
  cin >> N >> M >> R;

  for (uint32_t i = 0; i < R; i++) {
    cin >> rs[i];
    rs[i]--;
  }

  init_routes(N);
  for (uint32_t i = 0; i < M; i++) {
    uint32_t A, B, C;
    cin >> A >> B >> C;
    A--;
    B--;
    routes[A][B] = routes[B][A] = C;
  }

  for (uint32_t k = 0; k < N; k++) {
    for (uint32_t i = 0; i < N; i++) {
      for (uint32_t j = 0; j < N; j++) {
        uint64_t weight = routes[i][k] + routes[k][j];
        routes[i][j] = min(weight, routes[i][j]);
      }
    }
  }

  cout << min_path(R) << endl;

  return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,n-1,0)
#define all(v) v.begin(), v.end()
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;
const ld eps = 1e-10;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n; cin >> n;
  ll ans = 1;
  while((1LL<<ans) < n) ans++;
  rep(i, n-1) {
    REP(j, i+1, n) {
      int tmp = i^j;
      int a = 1;
      while(!(tmp&1)) {
        tmp >>= 1;
        a++;
      }
      cout << a << " ";
    }
    cout << "\n";
  }
  return 0;
}


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

int main(){
  long long N,c;
  cin >> N;
  c = N / 11 * 2;
  if(N%11 != 0){
    if(N%11 > 6){
      c += 2;
    }
    else{
      c++;
    }
  }
  cout << c << endl;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
	"strconv"
)

func main() {
	var n string
	fmt.Scan(&n)

  sum := 0
	for _, i := range n {
    num, _ := strconv.Atoi(string(i))
    sum += num
	}

  if sum % 9==0{
    fmt.Println("Yes")
  }else{
    fmt.Println("No")
  }
}


Measured memory_bytes: 3240
#include <iostream>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (n); i++)

int main() {
    int n;
    cin >> n;
    while (n > 0) {
        if (n % 10 == 7) {
            puts("Yes");
            return 0;
        }
        n /= 10;
    }
    puts("No");
}

Measured memory_bytes: 3636
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i=0;i < (int)(n);i++)

int main(){
    ll n;
    string s;
    cin >> n;
    s = to_string(n);
    ll ans;
    ans=s.size();
    for (ll i=2; i*i <= n;i++){
        if( n%i == 0){
            string u,t;
            u=to_string(i);
            t=to_string(n/i);
            //printf("i=%lld n/i = %lld\n",i,n/i);
            ans=min(ans,max(ll(u.size()),ll(t.size())));
        }
        else continue;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import core.bitop;
import std.algorithm;
import std.ascii;
import std.bigint;
import std.conv;
import std.functional;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.random;
import std.typecons;
import std.container;

enum MAX = 1_000_100;
ulong MOD = 1_000_000_007;
ulong INF = 1_000_000_000_000;
alias sread = () => readln.chomp();
alias Pair = Tuple!(long, "a", long, "b");
alias PQueue(T, alias less = "a<b") = BinaryHeap!(Array!T, less);

void main()
{
    auto n = lread();
    string s, t;
    scan(s, t);
    foreach(i; iota(n))
        write(s[i], t[i]);
    writeln();
}

T lread(T = long)()
{
    return readln.chomp.to!T();
}

T[] aryread(T = long)()
{
    return readln.split.to!(T[])();
}

void scan(TList...)(ref TList Args)
{
    auto line = readln.split();
    foreach (i, T; TList)
    {
        T val = line[i].to!(T);
        Args[i] = val;
    }
}


Measured memory_bytes: 256
import sys


def solve(X: int, A: int):
    print(0 if X < A else 10)


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    X = int(next(tokens))  # type: int
    A = int(next(tokens))  # type: int
    solve(X, A)

if __name__ == '__main__':
    main()


Measured memory_bytes: 2940