akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#include <boost/multiprecision/cpp_int.hpp>
//typedef boost::multiprecision::cpp_int ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
ll inf=(ll)1E17;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
////////////////////////////

class UnionFind {
public:
    vector < ll > par; // 各元の親を表す配列
    vector < ll > siz; // 素集合のサイズを表す配列(1 で初期化)
    // Constructor
    UnionFind(ll sz_): par(sz_), siz(sz_, 1) {
        for (ll i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身
    }
    void init(ll sz_) {
        par.resize(sz_);
        siz.assign(sz_, 1);
        for (ll i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身
    }
    // Member Function
    // Find
    ll root(ll x) { // 根の検索
        while (par[x] != x) {
            x = par[x] = par[par[x]]; // x の親の親を x の親とする
        }
        return x;
    }
    // Union(Unite, Merge)
    bool merge(ll x, ll y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        // merge technique（データ構造をマージするテク．小を大にくっつける）
        if (siz[x] < siz[y]) swap(x, y);
        siz[x] += siz[y];
        par[y] = x;
        return true;
    }
    bool issame(ll x, ll y) { // 連結判定
        return root(x) == root(y);
    }
    ll size(ll x) { // 素集合のサイズ
        return siz[root(x)];
    }
};
/////////////////////////////////////
//UnionFind uf(N);

int main(){fastio
    ll n,m;cin>>n>>m;
    UnionFind uf(n+1);
    ll que[m][2];rep(i,0,m-1)rep(j,0,1)cin>>que[i][j];
    ll ans[m];
    ans[m-1]=0;
    for(ll i=m-1;i>=1;i--){
        ll a=que[i][0],b=que[i][1];
        if(uf.issame(a,b)){
            ans[i-1]=ans[i];continue;
        }
        ll sa=uf.size(a),sb=uf.size(b);
        uf.merge(a,b);
        ans[i-1]=ans[i]+sa*sb;
    }
    ll sum=n*(n-1)/2;
    rep(i,0,m-1){
        cout<<sum-ans[i]<<endl;
    }
    
    
    return 0;
}


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

int main() {
    int a,b;
    cin>>a>>b;
    if (a<b)cout<<"a < b"<<endl;
    else if (a>b)cout<<"a > b"<<endl;
    else cout<<"a == b"<<endl;
    
        
    return 0;        
         
}

Measured memory_bytes: 1156
#include <iostream>
#include <string>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <functional>
#include <map>
#include <set>

using namespace std;

typedef long long i64;
typedef i64 int_t;
typedef vector<int_t> vi;
typedef vector<vi> vvi;

typedef pair<int_t, int_t> pi;

#define tr(c, i) for(auto i = (c).begin(); i != (c).end(); i++)
#define pb push_back
#define sz(a) i64((a).size())
#define all(c) (c).begin(), (c).end()
#define REP(s, e, i) for(i=(s); i < (e); ++i)

int main(int argc, char *argv[]) {
  string S;
  cin >> S;
  i64 N = sz(S), i;
  const i64 NUM = 2019;

  reverse(all(S));
  vi C(N+1);
  C[0] = 0;
  i64 P = 1;
  REP(0, N, i) {
    C[i+1] = (C[i] + (S[i] - '0') * P) % NUM;
    P *= 10;
    P %= NUM;
  }

  vi Cm(NUM, 0);
  REP(0, N+1, i) {
    Cm[C[i]]++;
  }

  i64 ans = 0;
  REP(0, NUM, i) {
    if(Cm[i] > 0)
      ans += Cm[i] * (Cm[i] - 1) / 2;
  }
  cout << ans << endl;
  
  return 0;
}


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

using namespace std;

#define ALL(x) (x).begin(), (x).end()
#define AND(x,y,z) set_intersection((x).begin(),(x).end(),(y).begin(),(y).end(),inserter((z),(z).end()))
#define CONCAT(x,y) (x).insert((x).end(),(y).begin(),(y).end())
#define DUMP(xs) for (auto x:xs) cout<<x<<' ';cout<<endl
#define FOR(i,a,b) for (int i=(int)(a);i<(int)(b);++i)
#define OR(x,y,z) set_union((x).begin(),(x).end(),(y).begin(),(y).end(),inserter((z),(z).end()))
#define OUT(x) cout<<x<<endl
#define REP(i,n) FOR(i,0,n)

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

int main() {
  int N;cin>>N;
  int ans = 0;
  REP(i,N) {
    int a;cin>>a;
    ans += a-1;
  }
  OUT(ans);

  return 0;
}

Measured memory_bytes: 256
import java.util.*;
import java.math.RoundingMode;
import java.math.BigDecimal;
 
 
public class Main{
	public static void main (String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long mod = 1000000007;
		long[] ans = new long[n];
		if(n>=4) {
			ans[2]=1;
			ans[3]=1;
			for(int i = 4; i < n; i++) {
				ans[i]=ans[i-3]%mod+ans[i-1]%mod;
			}
			System.out.println(ans[n-1]%mod);
		}
		else if(n==4||n==3)System.out.println(1);
		else System.out.println(0);
	}
}

Measured memory_bytes: 35860
// finish date: 2018/01/06
#include <iostream>
#include <cmath>
#include <vector>
#include <bitset>
#include <algorithm>
#include <stack>
#include <limits>
#include <map>

using namespace std;

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

bool isExist(char c, string str) {
    rep(i, str.length()) {
        if (c == str[i]) return true;
    }
    return false;
}

int main() {
    int N, Y;
    cin >> N >> Y;
    Y /= 1000;
    rep(a, N + 1) {
        rep(b, N - a + 1) {
            if (9 * a + 4 * b == Y - N) {
                cout << a << " " << b << " " << (N - a - b) << endl;
                return 0;
            }
        }
    }
    cout << "-1 -1 -1" << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define rep(i, n) for(int i=0;i<n;++i)
#define rrep(i, n) for(int i=n;i>=0;--i)
const int inf=1e9+7;
const ll mod=1e9+7;
const ll mod1=998244353;
const ll big=1e18;
const double PI=2*asin(1);

int main() {
  int K, X;
  cin>>K>>X;
  for(int i=X-K+1;i<X+K;++i) cout<<i<<" ";
  cout<<endl;
}



Measured memory_bytes: 3636
// AOJ ALDS1_15_C Activity Selection Problem
// 2019.3.9 bal4u

#include <stdio.h>
#include <stdlib.h>

#if 1
#define gc() getchar_unlocked()
#else
#define gc() getchar()
#endif
int in()
{
	int n = 0, c = gc();
	do n = 10 * n + (c & 0xf), c = gc(); while (c >= '0');
	return n;
}

typedef struct { int s, t; } T;
T tbl[100015]; int sz;

int cmp(const void *a, const void *b)
{
	return ((T *)a)->t - ((T *)b)->t;
}

int main()
{
	int i, n, now, ans;

	n = in();
	for (sz = 0; n--; sz++) tbl[sz].s = in(), tbl[sz].t = in();
	qsort(tbl, sz, sizeof(T), cmp);

	ans = now = 0;
	for (i = 0; i < sz; i++) {
		if (tbl[i].s > now) ans++, now = tbl[i].t;
	}
	printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 2948
#include <iostream>
using namespace std;
 
int main() {
    int N, i, M, j;
    int sumT = 0;
 
    cin >> N;
    int T[N];
  
    for (i = 1; i <= N; ++i){
      cin >> T[i];
      sumT += T[i];
    }
 
    cin >> M;
    int P[M], Q[M];
    for (j = 1; j <= M; ++j){
      cin >> Q[j] >> P[j];
      //cout << T[Q[j]] << P[Q[j]] << endl;
      cout << sumT - T[Q[j]] + P[j] << endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#define MAX 1000000000000L
using namespace std;

int main(void) {
	long long n, i = 1, k, buf = MAX, sum;
	cin >> n;
	if (n == 2) {
		printf("0\n");
		return 0;
	}
	k = (long long)sqrt(n) + 1;
	n--;
	sum = n;
	while (buf > k) {
		n--;
		i++;
		buf = n / i;
		if (n % i == 0)
			sum += buf;
	}
	cout << sum << "\n";
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <cctype>
#include <map>
#include <vector>
#include <queue>
#include <list>
#define PI 3.141592653
#define rep(i,a,n) for(int i=a;i<(int)n;++i)
#define SZ(x) ((int)(x).size())	//size() unsigned -> int
#define descSort(a) sort(a.begin(),a.end(),std::greater<int>())
 
using namespace std;
typedef long long ll;
const ll INF = 1e9 + 7;
 
int main(void){
	string s;
	cin >> s;
	if (s[0] == '7' || s[1] == '7' || s[2] == '7')cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 3628
#pragma comment(linker, "/stack:200000000")
        #pragma GCC optimize ("Ofast")
        #pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
         
         
        #include <iostream>
        #include <iomanip>
        #include <sstream>
        #include <cstring>
        #include <vector>
        #include <deque>
        #include <queue>
        #include <set>
        #include <map>
        #include <valarray>
        #include <iterator>
        #include <functional>
        #include <limits>
        #include <algorithm>
        #include <numeric>
        #include <cmath>
        #include <cassert>
        #include <unordered_map>
        #include <unordered_set>
        #include <stack>
        using namespace std;
        #define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
         #define trace(x) cerr << #x << ": " << x << " " << endl;
     
        typedef int64_t ll;
     
        #define endl '\n'
        #define int ll
        ll mod=1e9+7;
        ll mod1=1e9+5;
        ll power(ll a,ll b)
        {
            if(b==0) return 1;
            else if(b%2==0)
                return power((((a%mod)*(a%mod))%mod),b/2)%mod;
            else return ((a%mod)*(power((((a%mod)*(a%mod))%mod),b/2)%mod))%mod;
        }
       
       
        
        int32_t main()
        {
            IOS
           
             
        
        int n,ans=0;
        cin>>n;
        int a[n];
        for(int i=0;i<n;++i)
            cin>>a[i];
        for(int i=0;i<n;++i)
        {
            for(int j=i+1;j<n;++j)
                ans+=a[i]*a[j];
        }
        cout<<ans;

        }


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

// types
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
typedef vector<ll> vll;

// macros
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define FI first
#define SE second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define REP1(i,n) for(int i=1;i<((int)n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define PB push_back
#define EB emplace_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL

// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double eps = 1e-10;
const int MOD = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  
  ll n;
  cin>>n;
  n*=2;
  vll a(n);
  REP(i,n)
    cin>>a[i];
  
  sort(a.begin(), a.end());
  ll sum = 0;
  REP(i,n){
    if(i%2==0)
    sum += a[i];
  }
  
  cout<<sum<<endl;
}

Measured memory_bytes: 256
// Code for A - Air Conditioner
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define FOR(i,x,y) for(ll i=x;i<(ll)(y);i++)

#define debug(var)  do{std::cout << #var << " : ";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }

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

  if (x >= 30) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;

  }
  return 0;
}


Measured memory_bytes: 3632
N,P = map(int, input().split())

def factorize(a:int)->dict:
    """prime factorization O(sqrt(N))
    return dict of prime factor
    """
    ps = {}
    i = 2
    nokori = a
    while i*i <= nokori:
        if nokori%i==0:
            cnt = 0
            while nokori%i==0:
                cnt += 1
                nokori //= i
            ps[i] = cnt
        i += 1
    if nokori != 1:
        ps[nokori] = 1
    return ps

ps = factorize(P)
ans = 1
for k,v in ps.items():
    ans *= pow(k, v//N)
print(ans)


Measured memory_bytes: 38384
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int d = s.nextInt();
        int  a = d % 10;

        if(a == 3) {
            System.out.println("bon");
        } else if( a== 0 || a == 1 || a == 6 || a == 8) {
            System.out.println("pon");
        } else {
            System.out.println("hon");
        }
    }

    static int getDigit(int n) {
        int d = 0;
        while(n > 0){
            d = n % 10;
            n /= 10;
        }
        return d;
    }
}

Measured memory_bytes: 35680
abcd = input()
A,B,C,D = int(abcd[0]),int(abcd[1]),int(abcd[2]),int(abcd[3])    
if A + B + C + D == 7:
  print('{}+{}+{}+{}=7'.format(A, B, C, D))
elif A + B + C - D == 7:
  print('{}+{}+{}-{}=7'.format(A, B, C, D))
elif A + B - C + D == 7:
  print('{}+{}-{}+{}=7'.format(A, B, C, D))
elif A + B - C - D == 7:
  print('{}+{}-{}-{}=7'.format(A, B, C, D))
elif A - B + C + D == 7:
  print('{}-{}+{}+{}=7'.format(A, B, C, D))
elif A - B + C - D == 7:
  print('{}-{}+{}-{}=7'.format(A, B, C, D))
elif A - B - C + D == 7:
  print('{}-{}-{}+{}=7'.format(A, B, C, D))
else:
  print('{}-{}-{}-{}=7'.format(A, B, C, D))


Measured memory_bytes: 3064
def resolve():
    n = int(input())
    ans = [0] * n
    for x in range(1, 101):
        for y in range(1, 101):
            for z in range(1, 101):
                a = x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x
                if a <= n:
                    ans[a - 1] += 1
    for i in ans:
        print(i)


if __name__ == '__main__':
    resolve()


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

typedef long long   signed int LL;
typedef long long unsigned int LU;

#define incID(i, l, r) for(int i = (l)    ; i <  (r); i++)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); i++)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); i--)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); i--)
#define  inc(i, n) incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define  dec(i, n) decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)

#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))

#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define UB upper_bound
#define LB lower_bound
#define PQ priority_queue

#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
#define  FOR(it, v) for(auto it =  v.begin(); it !=  v.end(); ++it)
#define RFOR(it, v) for(auto it = v.rbegin(); it != v.rend(); ++it)

template<typename T> bool   setmin(T & a, T b) { if(b <  a) { a = b; return true; } else { return false; } }
template<typename T> bool   setmax(T & a, T b) { if(b >  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } }
template<typename T> bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }

// ---- ----

string w;
int a[26];

int main() {
	cin >> w;
	inc(i, w.size()) { a[ w[i] - 'a' ]++; }
	
	bool flag = true;
	inc(i, 26) { if(a[i] % 2 != 0) { flag = false; } }
	
	cout << (flag ? "Yes" : "No") << endl;
	
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#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 fi first
#define se second
#define mp make_pair
#define itrfor(itr,A) for(auto itr = A.begin(); itr !=A.end();itr++)
#define dame { printf("No\n"); return 0;}
template <class T> using reversed_priority_queue = priority_queue<T, vector<T>, greater<T> >;
typedef long long llong;
char moji[26]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
char moji2[26]={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
char moji3[10]={'0','1','2','3','4','5','6','7','8','9'};
#define Sort(a) sort(a.begin(),a.end());
#define Reverse(a) reverse(a.begin(),a.end());
#define print(a) cout << a << endl;
#define MOD llong(1e9+7)
#define MAX int(2 * 1e5 +5)
#define debug(x)  cout << #x << " = " << (x) << endl;
#define pi acos(-1.0)
#define int llong
#define INF llong(1e17)


signed main(){
    int n,m;
    cin >> n >> m;
    map<int,int> A;
    REP(i,n){
        int a;
        scanf("%lld",&a);
        A[a] ++;
    }

    REP(i,m){
        int b,c;
        scanf("%lld%lld",&b,&c);
        A[c] += b;
    }

    int res = 0;
    int k = 0;
    for(auto itr = A.end(); itr != A.begin();itr--){
        if(itr == A.end()) continue;
        if(k + itr->se <= n){
            res += itr->se * itr->fi;
            k += itr->se;
        }
        else{
            res += itr->fi * (n - k); 
            k = n;
            break;
        }
    }
    if(k != n){
        auto itr = A.begin();
        res += itr->fi * (n-k);
    }
    cout << res << endl;
}


Measured memory_bytes: 12800
#include<cstdio>
#include<cmath>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<cstdlib>
using namespace std;
int N,K,h[100005],dp[100005];
int main(){
	scanf("%d%d",&N,&K);
	for(int i = 1;i <= N;i++)
		scanf("%d",&h[i]);
	dp[1] = 0;dp[2] = abs(h[2] - h[1]);
	for(int i= 3;i<=N;i++){
		dp[i] = 0x3f3f3f3f;
		for(int j = K;j >= 1;j--){
		if(i-j>0)
			dp[i] = min(dp[i],dp[i-j]+abs(h[i]-h[i-j]));
		}
	}
	printf("%d\n",dp[N]);
	return 0;
}

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

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

  int A[1000],B[1000];
  for(int i = 0; i < M; i++){
    cin >> A[i] >> B[i];
  }

  list<int> l;
  int count = 0;
  for(int i = 0; i < M; i++){
    if(A[i] >= B[i]) count++;
    if(A[i] < B[i]) l.push_back(B[i] - A[i]);
  }
  l.sort();

  int ans = 0;
  while(count < M - 1){
    count++;
    ans += l.front() / 2;
    l.pop_front();
  }
  cout << ans << endl;

  return 0;
}



Measured memory_bytes: 3096
n = int(input())
a = list(map(int, input().split()))

DIV = 1000000007

ls = [0]*100000

ans = 1
for i in a:
    ls[i] += 1
    if i == 0:
        ans *= 4 - ls[i]
    else:
        ans *= ls[i-1]-ls[i]+1

    ans %= DIV

print(ans)


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

int main()
{
    ios::sync_with_stdio(false);
    int n;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++) cin>>a[i];
    for(int i=0;i<n;i++)
        printf("%d%c",a[n-i-1]," \n"[i==n-1]);
    return 0;
}



Measured memory_bytes: 3172
using System;
using System.Collections.Generic;

namespace cswork
{
    class Program
    {
        public Program() { }

        Scanner cin;
        const int MAXIN = 1024;
        bool[] used = new bool[MAXIN];
        int[] perm = new int[MAXIN];

        List<int[]> permList = new List<int[]>();

        void Omame()
        {
            cin = new Scanner();
            int n = cin.nextInt();
            int m = cin.nextInt();

            int[] road = new int[n];
            for (int i = 0; i < m; i++)
            {
                int a = cin.nextInt() - 1;
                int b = cin.nextInt() - 1;
                road[a]++;
                road[b]++;
            }

            for (int i = 0; i < n; i++)
            {
                Console.WriteLine(road[i]);
            }
        }

        static void Main(string[] args)
        {
            new Program().Omame();
        }

        public void Permutation(int pos, int n, int length)
        {
            if (pos == n)
            {
                permList.Add((int[])perm.Clone());
            }

            for (int i = 0; i < n; i++)
            {
                if (!used[i])
                {
                    perm[pos] = i;
                    used[i] = true;
                    Permutation(pos + 1, n, length);
                    used[i] = false;
                }
            }
        }
    }

    class Scanner
    {
        string[] s;
        int i;

        char[] cs = new char[] { ' ' };

        public Scanner()
        {
            s = new string[0];
            i = 0;
        }

        public string next()
        {
            if (i < s.Length) return s[i++];
            string st = Console.ReadLine();
            while (st == "") st = Console.ReadLine();

            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            i = 0;
            return next();
        }

        public int nextInt()
        {
            return int.Parse(next());
        }

        public long nextLong()
        {
            return long.Parse(next());
        }

        public double nextDouble()
        {
            return double.Parse(next());
        }
    }
}

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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); 

#define ll long long
#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define mp make_pair
#define pu push
#define pp pop_back
#define in insert
#define ld long double
#define forn(low,high,i) for(i = low;i < high;i++)
#define forrev(high,low,i) for(i = high; i >= low;i--)
#define trace(x) cerr << #x << ": " << x << " " << endl;
#define all(v) v.begin(),v.end()
#define sz(v) (int)v.size()
#define line cout << __LINE__;
#define prv(a) for(auto x : a) cout << x << ' ';cout << '\n';
#define decimal_digits cout << fixed << setprecision(15);
#define dbg2(a,b) cerr << #a << " = " << a << " " << #b << " = " << b << '\n';        
#define debug(x) cerr << __LINE__ << ' ' << #x << " = " << x << '\n';
#define dln cerr << '\n';
#define dsp cerr << ' ';
#define pln cout << '\n';
#define psp cout << ' ';

typedef unordered_map<int,int> umi;
typedef unordered_map<ll,ll> uml;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;


clock_t time_p = clock();

void ktj(){
  time_p = clock() - time_p;
  cerr << "Time elapsed : " << (float)(time_p)/CLOCKS_PER_SEC << "\n";
}

int main(){
  fastio
  ll l,r;
  ll mod = 2019;

  cin >> l >> r;

  if(l <= mod and r >= mod){
    cout << 0 << '\n';
  }else{
    ll f = (r / mod) - (l - 1) / mod;
    if(f){
      cout << "0\n";
    }else{
      ll ans = mod;
      for(ll i = l; i < r; i++){
        for(ll j = i + 1; j <= r; j++){
          ans = min(ans, (i * j) % mod);
        }
      }
      cout << ans << '\n';
    }
  }

  ktj();
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define endl '\n'
#define pb push_back
#define mp make_pair
#define SZ(x) ((int)(x).size())
#define all(x) x.begin(),x.end()
#define mem0(s) memset(s,0,sizeof(s))
#define meminf(s) memset(s,0x3f,sizeof(s))
#define mp_insert(a,b,c) mp.insert(map<pair<int,int>,int>::value_type(make_pair(a,b),c))
//double pi=acos(-1);
typedef long long ll;
typedef unsigned long long ull;
inline ll lowbit(ll x){return x&(-x);}
inline ll min(ll a,ll b){return a<b?a:b;}
inline ll max(ll a,ll b){return a>b?a:b;}
const int INF=0x3f3f3f3f,max_n=200005;
inline ll gcd(ll a,ll b){return b==0?a:gcd(b,a%b);}
inline ll pow(ll a,ll b,ll mod){ll res=1;a%=mod;assert(b>=0);for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
int n,p;
char s[max_n];
int u[max_n];
ll ans[10005];
ll ans1;
int main()
{
	cin>>n>>p;
	cin>>s+1;
	if(p==2)
	{
		for(int i=n;i>=1;i--)
		{
			if((s[i]-'0')%p==0)
			{
				ans1+=i;
			}
		}
		cout<<ans1<<endl;
	}
	else if(p==5)
	{
		for(int i=n;i>=1;i--)
		{
			if((s[i]-'0')%p==0)
			{
				ans1+=i;
			}
		}
		cout<<ans1<<endl;
	}
	else
	{
		u[n+1]=0;
		ans[0]++;
		for(int i=n;i>=1;i--)
		{
			if(i==n)
			{
				u[i]=(s[n]-'0')%p;
				ans[u[i]]++;
			}
			else
			{
				u[i]=((s[i]-'0')%p*pow(10,n-i,p)%p+u[i+1])%p;
				ans[u[i]]++;
			}
		}
		for(int i=0;i<10001;i++)
		{
			ans1+=ans[i]*(ans[i]-1)/2;
		}
		cout<<ans1;
	}
    return 0;
}

Measured memory_bytes: 1280
#include<iostream>
#include <cmath>
#include <string>
#include <iomanip>

#define loop(k) for(int i=0;i<k;i++)
#define looop(k) for(int j=0;j<k;j++)
#define swap(a,b) a^=b^=a^=b;

using namespace std;

int main(){
    int a, b, h ;
    cin >> a >> b >>h ;
    cout << h * ( a + b ) / 2 << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<functional>
#include<vector>
#include<set>
#include<queue>
#include<list>
#include<stdio.h>
#include<stdlib.h>
#include<map>
#include<cstdio>
#include <iomanip>

#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()

typedef long long ll;

using namespace std;

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

	a.erase(unique(a.begin(), a.end()), a.end());

	int ans = 1;

	for (int i = 2; i < a.size(); i++) {
		if ((a[i - 2]<a[i - 1] && a[i - 1]>a[i]) ||
			(a[i - 2]>a[i - 1] && a[i - 1]<a[i])) {
			++ans;
			i++;
		}
	}

	cout << ans << endl;

}

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



int main(){
	long long n,k,a,b;
	vector<pair<int,int> > v;
	cin >> n >> k;
	for(int i=0;i<n;i++){
		cin >> a >> b;
		v.push_back(make_pair(a,b));
	}
	
	sort(v.begin(),v.end());
	long long sum=0;
	for(int i=0;i<v.size();i++){
		sum+=v[i].second;
		if(k<=sum){
			cout << v[i].first;
			break;
		}
	}
	
	return 0;
}

Measured memory_bytes: 1400
import bisect
N=int(input())
LA=list(map(int,input().split()))
LB=list(map(int,input().split()))
LC=list(map(int,input().split()))
LA.sort()
LB.sort()
LC.sort()
ans=0
for b in LB:
    a,c=bisect.bisect_left(LA,b),bisect.bisect_right(LC,b)
    ans+=a*(N-c)
print(ans)

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

int main(){
	int arr[1001] = { 0 };
	int n,k,ans=0;
	cin >> n >> k;
	for (int i = 0; i < n; i++){
		cin >> arr[i];
	
	
	}
	sort(arr, arr + n);
	for (int i = 0; i < k; i++){
		ans += arr[i];
	
	
	}
	cout << ans;

}

Measured memory_bytes: 3644
#include <iostream>
#include <algorithm>
#include <queue>
#include <vector>
#include <set>
#include <cmath>
#include <string>
#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 FI first
#define SE second
#define MA(i,j) make_pair(i,j)
#define PA pair<int,int>
#define PB push_back
#define PQ priority_queue<int>
#define PGQ priority_queue<int,vector<int>,greater<int> >
#define VE vector<int>
#define VP vector<PA>
#define YES(i) cout<<(i?"YES":"NO")<<endl
#define Yes(i) cout<<(i?"Yes":"No")<<endl
using namespace std;
//
const int MOD=1e9+7;
const int INF=1e9+7;
const double PI=3.141592653589793238462643383279;
//
int N;
int A[9];
int main(){
  cin>>N;
  FOR(i,0,N){
    int R;
    cin>>R;
    int num=R/400;
    if(num>=8){
      A[8]++;
    }else{
      A[num]++;
    }
  }
  int cnt=0;
  FOR(i,0,8){
    if(A[i]){
      cnt++;
    }
  }
  cout<<max(cnt,1)<<" "<<cnt+A[8]<<endl;
  return 0;
}


Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.buffer.readline

N, M = map(int, input().split())
nextcity = [[] for _ in range(N)]
sgn = [0 for _ in range(N)]
while M:
	M -= 1
	A, B = map(int, input().split())
	A -= 1
	B -= 1
	nextcity[A].append(B)
	nextcity[B].append(A)

def dfs(cnt, city):
	for item in nextcity[city]:
		if sgn[item] == 0:
			sgn[item] = cnt
			dfs(cnt, item)
	return None

cnt = 0
for k in range(N):
	if sgn[k] == 0:
		cnt += 1
		sgn[k] = cnt
		dfs(cnt, k)
print(cnt -1)

Measured memory_bytes: 940564
use std::collections::HashMap;
use std::io::stdin;

fn main() {
    let mut s = String::new();
    stdin().read_line(&mut s).ok();
    let w = s.trim();
    let mut d = HashMap::new();

    for e in w.chars() {
        *d.entry(e).or_insert(0) += 1;
    }

    println!(
        "{}",
        if d.iter().all(|e| *e.1 % 2 == 0) {
            "Yes"
        } else {
            "No"
        }
    );
}


Measured memory_bytes: 4352
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp56
{
    class Program
    {
       static long m = 100;
       static long x = 0;
        static long cnt = 0;
        static void Main(string[] args)
        {
            x = long.Parse(Console.ReadLine());

            while (true)
            {
                next();
                if(m >= x)
                {
                    Console.WriteLine(cnt);
                    return;
                }

            }

        }

       static void next()
        {
            cnt++;
            m = m + (m / 100);
        }
    }
}


Measured memory_bytes: 27504
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>

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

    std::vector<int> v(N);
    for (int i = 0; i < N; i++) std::cin >> v[i];

    std::sort(v.begin(), v.end());

    double ans = v.front();
    for (int i = 1; i < N; i++) ans = (ans + v[i]) / 2.0;
    std::cout << std::fixed << std::setprecision(10);
    std::cout << ans << "\n";
}

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

int main()
{
	int a, b, c;
	cin >> a >> b >> c;
	if((a == (b + c)) || (b == (c + a)) || (c == (a + b))){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
int main(void){
   int N;
   cin>>N;
   long A[N];
   for(int i=0;i<N;i++){
       cin>>A[i];
   }
   int count=0;
   for(int i=0;i<N;i++){
       if(A[i]<0){count++;}
   }
   long ans=0;
   if(count%2==0){
       for(int i=0;i<N;i++){
      ans+=abs(A[i]);
       }
   }
   if(count%2==1){
       for(int i=0;i<N;i++){
           A[i]=abs(A[i]);
       }
       sort(A,A+N);
       for(int i=1;i<N;i++){
           ans+=A[i];
       }
       ans-=A[0];
   }
   cout<<ans;
   return 0;
}


Measured memory_bytes: 1024
import unittest


class TestA(unittest.TestCase):
    def test_1(self):
        self.assertEqual(think(3), 2)

    def test_2(self):
        self.assertEqual(think(2), 1)

    def test_3(self):
        self.assertEqual(think(100), 50)


def solve():
    n = read()
    result = think(n)
    write(result)


def read():
    return read_int(1)[0]


def read_int(n):
    return read_type(int, n, sep=' ')


def read_float(n):
    return read_type(float, n, sep=' ')


def read_type(t, n, sep):
    return list(map(lambda x: t(x), read_line().split(sep)))[:n]


def read_line(n=0):
    if n == 0:
        return input().rstrip()
    else:
        return input().rstrip()[:n]


def think(n):
    return n // 2 if n % 2 == 0 else n // 2 + 1


def write(result):
    print(result)


if __name__ == '__main__':
    # unittest.main()
    solve()

Measured memory_bytes: 50928
import sys

if __name__ == '__main__':
    n = int(sys.stdin.readline())
    A = list(map(lambda x: int(x), sys.stdin.readline().split()))
    allxor = 0
    for a in A:
        allxor ^= a
    for a in A:
        print(allxor^a, end=' ')
    print()

# スヌケ君dの値が知りたい：d以外の人の計算結果を全部xorする

Measured memory_bytes: 31480
#define _GLIBCXX_DEBUG //エラーを出すためのおまじない
#include <bits/stdc++.h>
#include <algorithm>
//#include <cstdlib>  // abs() for integer
#include <cmath>    // abs() for float, and fabs()
#include <math.h>
using namespace std;
#define coYES cout << "YES" << endl
#define coNO cout << "NO" << endl
#define coYes cout << "Yes" << endl
#define coNo cout << "No" << endl
#define coyes cout << "yes" << endl
#define cono cout << "no" << endl
//#define cocount cout << count << endl;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i < (int)(n); i++)
#define Cinint(n) int n;\
cin >> n;
#define Cinvecint(a, n) vector<int> a(n);\
for (int i = 0; i < (int)(n); i++) {\
  int num;\
  cin >> num;\
  a.at(i) = num;\
}
#define Cinstring(s) string s;\
cin >>s;

  

int main() {
  Cinint(n);
  vector<int> a(n+1);
  a.at(0) = 0;
  a.at(1) = 0;
  for (int i = 2; i <n+1; i++) {
    int num;
    cin >> num;
    a.at(i) = num;
  }
  vector<int> a_buka(n+1);
  a_buka.at(0) = 0;
  for (int i = 2; i < n+1; i++) {
    a_buka.at(a.at(i))++;
  }
  for (int i = 1; i < n+1; i++) {
    cout << a_buka.at(i) << endl;
  }
}


Measured memory_bytes: 4804
/*** author: yuji9511 ***/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using lpair = pair<ll, ll>;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i=(m);i<(n);i++)
#define rrep(i,m,n) for(ll i=(m);i>=(n);i--)
#define printa(x,n) for(ll i=0;i<n;i++){cout<<(x[i])<<" \n"[i==n-1];};
void print() {}
template <class H,class... T>
void print(H&& h, T&&... t){cout<<h<<" \n"[sizeof...(t)==0];print(forward<T>(t)...);}

void solve(){
    ll X;
    cin >> X;
    if(X >= 400 && X <= 599){
        print(8);

    }else if(X <= 799){
        print(7);

    }else if(X <= 999){
        print(6);
        
    }else if(X <= 1199){
        print(5);
        
    }else if(X <= 1399){
        print(4);
        
    }else if(X <= 1599){
        print(3);
        
    }else if(X <= 1799){
        print(2);
        
    }else{
        print(1);

    }

    

}

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

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

using namespace std;

int main () {
    using ll = long long;
    ll a, v, b, _v, t;
    cin >> a >> v >> b >> _v >> t;
    if(_v < v and abs(a-b) <= abs(_v-v)*t) {
        cout << "YES\n";
    }
    else {
        cout << "NO\n";
    }
    return 0;
}

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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>bool chmin(T&a,const T&b){return a>b?(a=b,1):0;}
template<class T>bool chmax(T&a,const T&b){return a<b?(a=b,1):0;}


int nextInt() { int x; scanf("%d", &x); return x;}

int a[333][333];
bool ban[333];

int main2() {
  int N = nextInt();
  int M = nextInt();
  REP(i, N) REP(j, M) a[i][j] = nextInt() - 1;
  memset(ban, 0, sizeof(ban));
  int ans = N;
  REP(_, M - 1) {
    vector<int> cnt(M);
    REP(i, N) REP(j, M) if (!ban[a[i][j]]) {
      cnt[a[i][j]]++;
      break;
    }
    int best = 0;
    REP(i, M) if (cnt[best] < cnt[i]) best = i;
    chmin(ans, cnt[best]);
    ban[best] = true;
  }
  cout << ans << endl;
  return 0;
}

int main() {
  for (;!cin.eof();cin>>ws) main2();
  return 0;
}



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

using namespace std;

void Main() {
    int N;
    cin >> N;
    vector<int> A(N, 0);
    for (int i = 0; i < N; ++i) {
        cin >> A[i];
    }

    map<int, int> numA;
    for (int i = 0; i < N; ++i) {
        if (numA.count(A[i]) == 0) {
            numA.insert(make_pair(A[i], 0));
        }
        ++numA[A[i]];
    }
    set<int> duplicated;
    for (auto e : numA) {
        if (e.second > 1) {
            duplicated.insert(e.first);
        }
    }

    sort(A.begin(), A.end());
    const int MAX_A = A.back();
    vector<bool> divisible(MAX_A + 1, false);

    for (int i = 0; i < A.size(); ++i) {
        if (divisible[A[i]]) {
            continue;
        }
        for (int j = 2; A[i] * j < divisible.size(); ++j) {
            divisible[A[i] * j] = true;
        }
    }

    int ans = 0;
    for (int i = 0; i < A.size(); ++i) {
        if (!divisible[A[i]] && duplicated.count(A[i]) == 0) {
            ++ans;
        }
    }
    cout << ans << endl;
}

int main() {
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 13512
fn main() {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    if s.chars().nth(0).unwrap() == '9' || s.chars().nth(1).unwrap() == '9' {
        println!("Yes");
    }
    else {
        println!("No");
    }
}


Measured memory_bytes: 4352
#include <iostream>
#include <string>
#include <cstdlib>
#include <cmath>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <functional>

using namespace std;

int main()
{
    int n;
    cin >> n;
    vector<int> h;
    int tmp;

    for (int i = 0; i < n; ++i) {
        cin >> tmp;
        h.push_back(tmp);
    }

    int max_hight = h[0];
    int c = 0;

    for (int i = 0; i < n; ++i) {
        if (h[i] >= max_hight) {
            ++c;
            max_hight = h[i];
        }
    }

    cout << c << endl;
}


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

using namespace std;

typedef long long ll;
typedef vector<ll> vl;
typedef long double ld;
typedef vector<ld> vd;
typedef bool bl;
typedef vector<bl> vb;
typedef unordered_map<ll,unordered_map<ll,ll>> graph;

const ll e5 = 1 << 20;
const ll mod = 1000000007;
const ll e3 = 1 << 13;
const ll INF = 1ll << 60;

ll a,p;

int main(){
  cin >> a >> p;
  cout << (a*3+p)/2 << endl;
}


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

int main(){
    int n;
    cin >> n;
    vector<int> x(n);
    rep(i,n) cin >> x[i];
    int maxi = *max_element(x.begin(),x.end());
    vector<int> ans(maxi,0);
    for(int i=0; i<maxi; ++i){
        rep(j,n){
            int t = abs(x[j]-(i+1))*abs(x[j]-(i+1));
            ans[i] += t;
        }
    }
    cout << *min_element(ans.begin(),ans.end()) << "\n";
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for (int i = 1; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define vout(x) rep(i,x.size()) cout << x[i] << " "
template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;return 1;}return 0;}
template<class T> bool chmax(T &a, T b) {if(a<b) {a=b;return 1;}return 0;}
using namespace std;
using vint = vector<int>;
using vvint = vector<vector<int>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<int,int>;
const int inf = 1e9;
const ll inf_l = 1e18;
const int MAX = 1e5;

int main() {
    string o, e; cin >> o >> e;
    int n_o = o.size();
    int n_e = e.size();
    rep(i,n_o+n_e) {
        if (i&1) {
            cout << e[(i-1)/2];
        }
        else cout << o[i/2];
    }
    cout << endl;
}

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

const int N = 1000005, mod = 998244353;
typedef long long LL;
int n, pr[N], cnt[N], pt, mu[N], ans, inv[N], x;
bool sie[N];
void reduce(int &x) { x += x >> 31 & mod; }
int pow(int x, int y, int ans = 1) {
	for (; y; y >>= 1, x = (LL) x * x % mod)
		if (y & 1) ans = (LL) ans * x % mod;
	return ans;
}
void sieve(int n) {
	inv[1] = 1;
	for (int i = 2; i <= n; ++i) {
		if (!sie[i]) pr[++pt] = i, inv[i] = pow(i, mod - 2);
		for (int j = 1, t; j <= pt && (t = i * pr[j]) <= n; ++j) {
			sie[t] = 1, inv[t] = (LL) inv[i] * inv[pr[j]] % mod;
			if (i % pr[j] == 0) break;
		}
	}
	for (int i = 1; i <= pt; ++i)
		for (int t = n / pr[i], j = t * pr[i]; t; j -= pr[i], --t)
			reduce(inv[j] -= inv[t]);
}
int main() {
	std::ios::sync_with_stdio(0), std::cin.tie(0);
	std::cin >> n, sieve(1000000);
	for (int i = 1; i <= n; ++i) std::cin >> x, reduce(cnt[x] += x - mod), reduce(ans -= x);
	for (int i = 1; i <= pt; ++i)
		for (int t = 1000000 / pr[i], j = t * pr[i]; t; --t, j -= pr[i])
			reduce(cnt[t] += cnt[j] - mod);
	for (int i = 1; i <= 1000000; ++i)
		ans = (ans + (LL) cnt[i] * cnt[i] % mod * inv[i]) % mod; 
	std::cout << (LL) ans * (mod + 1 >> 1) % mod << '\n';
	return 0;
}

Measured memory_bytes: 12544
import java.util.Scanner;
public class Main {
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        int N=sc.nextInt();
        if(N%111==0){
            System.out.println(N);
        }
        else{
            System.out.println((N/111+1)*111);
        }
    }
}


Measured memory_bytes: 21712
#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 FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define FORR(i, m, n) for (int i = (m); i >= (n); --i)
#define equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
//const ll mod = 1000000007;
//const ll mod = 998244353;
const int inf = 1e9 + 10;
const ll INF = 1e18;
const ld EPS = 1e-10;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
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 (a>b) { a=b; return 1; } return 0; }

ll cnt[1000100];

map<ll, ll> prime_factor(ll n) {
  map<ll, ll> res;
  for (ll i = 2; i * i <= n; ++i) {
    while (n % i == 0) {
      ++res[i];
      n /= i;
    }
  }
  if (n != 1) res[n] = 1;
  return res;
}

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

  ll n;
  cin >> n;
  vector<ll> a(n);
  rep(i, n) cin >> a[i];

  rep(i, n) {
    map<ll, ll> mp = prime_factor(a[i]);
    for (auto p: mp) cnt[p.first]++;
  }
  bool p = true;
  rep(i, 1000100) {
    if (cnt[i] > 1) {
      p = false;
      break;
    }
  }
  if (p) {
    cout << "pairwise coprime\n";
    return 0;
  }
  rep(i, 1000100) {
    if (cnt[i] == n) {
      cout << "not coprime\n";
      return 0;
    }
  }
  cout << "setwise coprime\n";

  
  return 0;
}

Measured memory_bytes: 18760
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <limits>

using namespace std;

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

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

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define EXISTch(s,c) ((((s).find_first_of(c)) != std::string::npos)? 1 : 0)//cがあれば1 if(1)
#define SORT(c) sort((c).begin(),(c).end())

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = (int)1000000007;
const LL MOD = (LL)1000000007;//10^9+7
const LL INF2 = (LL)100000000000000000;//10^18

int main() {
	string s, t; cin >> s >> t;
	int n = s.size() - t.size()+1;
	int ans = INF;
	for (int i = 0; i < n; i++) {
		int tmp = 0;
		for (int j = 0; j < t.size(); j++) {
			if (s[i+j] != t[j])tmp++;
		}
		ans = min(ans, tmp);
	}
	cout << ans << endl;
}

Measured memory_bytes: 3612
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <cmath>
#include <set>
#include <algorithm>
#include <iomanip>

typedef long long ll;
const ll MOD = 1e9 + 7;
const long long INF = 1LL<<60;
const double PI=3.14159265358979323846;
const int NMAX=100005;
using namespace std;


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

    if(s == "ABC"){
        cout << "ARC" << endl;
    } else {
        cout << "ABC" << endl;
    }


    return 0;
}

Measured memory_bytes: 3624
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<stack>
#include<functional>
#include<queue>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<utility>
#include<set>
#include<unordered_set>
#include<map>
#include<unordered_map>
typedef long long int ll;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<signed(n);i++)
#define EREP(i,n) for(int i=1;i<=signed(n);i++)
#define ALL(a) (a).begin(),(a).end()
using namespace std;
//#define EVEL 1
#ifdef EVEL
#define DEB(X) cout << #X <<":" <<X<<" " ;
#define TF(f) f ? cout<<"true  " : cout<<"false ";
#define END cout<<"\n";
#else
#define DEB(X) {}
#define TF(f) {}
#define END {}
#endif
const ll MOD = 1000000007;
const ll INF = 9e14;
typedef std::pair<ll,ll> P;
struct edge{ int to,cost; };
#define VMAX 100000

ll N,M,X,K,Q;
ll A,B,C,D;

ll ans;
bool F=false;
string S,T,U;
int main(){
    cin>>A;
    cout<<A*A;
   
}
// cd /mnt/d/Data/Source/ABC/


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

for h in range(1, 3501):
    for n in range(1, 3501):
        if (4*h*n-n*N-h*N) > 0:
            if n*h*N%(4*h*n-n*N-h*N) == 0:
                print(h, n, n*h*N//(4*h*n-n*N-h*N))
                exit()

Measured memory_bytes: 40684
#include <bits/stdc++.h>
using namespace std;
#define mem(a,b) memset(a,b,sizeof(a))
#define pii pair<int,int>
#define int long long
const int inf = 0x3f3f3f3f;
const int maxn = 201110;
const int M = 1e9+7;
int n,m,k,ok;

int a[maxn];

int id[maxn];

signed main()
{
    cin>>n;
    for(int i = 1; i <= n; i++) 
    {
        cin>>a[i];
        id[a[i]]++;
    }
    int ans = 0;
    for(int i = 1; i <= n; i++) 
    {
        ans += id[i]*(id[i]-1)/2;
    }
    for(int i = 1; i <= n; i++) 
    {
        cout<<(ans-(id[a[i]]*(id[a[i]]-1)/2) + (id[a[i]]-1)*(id[a[i]]-2)/2)<<endl;
    }
    return 0;
}

Measured memory_bytes: 4736
#include <iostream>
#include <vector>
#include <cstring>
#include <algorithm>

using namespace std;

int main(void){
	int i,j;
	int n,tmp;
	vector<int> v,w;
	int max_w;
	int cur=0,nxt=1;
	int dp[2][1001];
	int dpw[2][1001];
	int index=0;
	int tmp_max = 0;
	int max_weight = 1 << 30;
	int casenum = 1;
	
	while(cin >> max_w){
		if(max_w == 0) break;
		memset(dp, 0, sizeof(dp));
		memset(dpw, 0, sizeof(dpw));
		cur = 0;
		nxt = 1;
		cin >> n;
		for(i=0;i<n;i++){
			cin >> tmp;
			v.push_back(tmp);
			cin.ignore();
			cin >> tmp;
			w.push_back(tmp);
		}
		//f[^ÇÝÝ±±ÜÅ
		
		/*
		*  dp[i+1][j] := iÔÚÜÅÅd³jÉµ½Æ«ÌÅåÌ¿l
		*  dp[i+1][j] = max(dp[i][j], dp[i][j-w[i]] + v[i]) if(j > w[i])
		*  dp[i+1][j] = dp[i][j]
		*/
		for(i=0;i<n;i++){
			for(j=0;j<=max_w;j++){
				if(j >= w[i]){
					dp[nxt][j] = max(dp[cur][j], dp[cur][j-w[i]] + v[i]);
					if(dp[nxt][j] == dp[cur][j]){
						dpw[nxt][j] = dpw[cur][j];
					}else{
						dpw[nxt][j] = dpw[cur][j-w[i]] + w[i];
					}
				}else{
					dp[nxt][j] = dp[cur][j];
					dpw[nxt][j] = dpw[cur][j];
				}
				//cout << dpw[nxt][j] << " ";
				if(tmp_max < dp[nxt][j]){
					tmp_max = dp[nxt][j];
					max_weight = dpw[nxt][j];
					//cout << "max_weight = " << max_weight << endl;
				}else if(tmp_max == dp[nxt][j]){
					max_weight = min(max_weight, dpw[nxt][j]);
				}
			}
			nxt = 1 - nxt; //toggle
			cur = 1 - cur; //toggle
			//cout << endl;
		}
		
		cout << "Case " << casenum++ << ":"<<endl;
		cout << dp[cur][max_w] << endl;
		if(tmp_max == 0){
			cout << 0 << endl;
		}else{
			cout << max_weight << endl;
		}
		v.clear();
		w.clear();
		index = 0;
		tmp_max=0;
		max_weight = 1 << 30;
	}
	
	
}

Measured memory_bytes: 0