akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long int
using namespace __gnu_pbds;
typedef tree<pair<ll,pair<ll,ll> >, null_type, less<pair<ll,pair<ll,ll> > >, rb_tree_tag, tree_order_statistics_node_update>ordered_set;
#define me BOSS
#define bug() cout<<"AIkahne aise"<<endl
#define PI acos(-1)
/* Precode Start Here *\
     Sieve
void sieve()
{
    for(ll i=3; i<=2000; i+=2)
    {
        for(ll j=i*i; j<=4000000; j+=i)
            A[j]=1;
    }
    v.push_back(2);
    for(ll i=3; i<=4000000; i+=2)
        if(A[i]==0)
            v.push_back(i);
}

     Power Function Modulo P

ll modPow(ll a, ll x, ll p) {
    //calculates a^x mod p in logarithmic time.
    long res = 1;
    while(x > 0) {
        if( x % 2 != 0) {
            res = (res * a) % p;
        }
        a = (a * a) % p;
        x /= 2;
    }
    return res;
}


   factorial

ll fact(ll n)
{
    ll ans=1;
    for(ll i=1;i<=n;i++)
    {
        ans=(ans*i)%mod;
    }
    return ans;
}
     Calculating nCr using Fermats law Theorem

ll modInverse(ll a, ll p) {
    //calculates the modular multiplicative of a mod m.
    //(assuming p is prime).
    return modPow(a, p-2, p);
}


ll modBinomial(ll n, ll k, ll p) {
// calculates C(n,k) mod p (assuming p is prime).

    ll numerator = 1; // n * (n-1) * ... * (n-k+1)
    for (ll i=0; i<k; i++) {
        numerator = (numerator * (n-i) ) % p;
    }

    ll denominator = 1; // k!
    for (ll i=1; i<=k; i++) {
        denominator = (denominator * i) % p;
    }

    // numerator / denominator mod p.
    return ( numerator* modInverse(denominator,p) ) % p;
}
     num of divisor and euler totient

ll phi[1000001],mark[1000001],divi[1000001];;
void divisorPhi(ll n)
{
    for(int i=1;i<=n;i++)
        phi[i]=i;
    for(int i=2;i<=n;i++)
    {
        if(!mark[i])
        {
            for(int j=i;j<=n;j+=i)
            {
                mark[j]=1;
                phi[j]*=(1-1/(double)i);
            }
        }
    }
    for(ll i=1;i<=n;i++)
    {
        for(ll j=i;j<=n;j+=i)
            divi[j]++;
    }
}
/* Precode Ends */
#define mod 1000000007
ll A[5000001],B[5000001];
vector<ll>v;
map<ll,ll>myMap;
set<ll>mySet;
vector<pair<ll,ll> >vp;
priority_queue<ll> pq;
priority_queue<ll, vector<ll>, std::greater<ll> > first;
ll po(ll a,ll n)
{
  ll ans=1;
  for(int i=1;i<=n;i++)
       ans*=a;
    return ans;
}

int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);

 int f=0;
 string s,t;
 cin>>s>>t;
 for(int i=0;i<s.size();i++)
 {
     if(s[i]!=t[i])
        f=1;
 }
 if(f)
 {
     cout<<"No"<<endl;
 }
 else
 {
     cout<<"Yes"<<endl;
 }

return 0;
}



Measured memory_bytes: 3648
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
#define REP(var, a, b) for (int var = (a); var < (b); var++)
#define rep(var, n) for (int var = 0; var < (n); ++var)
#define ALL(c) (c).begin(), (c).end()
#define rALL(c) (c).rbegin(), (c).rend()
ll MOD = 1000000007;
const ll INF = 1e18;

int main() {
  //
  ll n, m;
  cin >> n >> m;
  vvl g(n);
  rep(i, m) {
    ll s, t;
    cin >> s >> t;
    s--, t--;
    g[s].emplace_back(t);
  }
  vector<double> data(n, 0);
  for (int i = n - 2; i >= 0; i--) {
    double tmp = 0;
    for (auto& j : g[i]) {
      tmp += data[j];
    }
    tmp /= g[i].size();
    data[i] = tmp + 1;
  }
  double ans = data[0];

  rep(u, n - 1) {
    if (g[u].size() == 1) continue;
    int v = g[u][0];
    for (auto& x : g[u]) {
      if (data[x] > data[v]) v = x;
    }
    // cerr << u << "->" << v << endl;

    double e = [&] {
      vector<double> data(n, 0);
      for (int i = n - 2; i >= 0; i--) {
        double tmp = 0;
        for (auto& j : g[i]) {
          if (i == u && j == v) continue;
          tmp += data[j];
        }
        double deg = g[i].size();
        if (i == u) deg--;
        tmp /= deg;
        data[i] = tmp + 1;
      }
      return data[0];
    }();
    ans = min(ans, e);
  }
  cout << setprecision(8) << fixed << ans << endl;
  return 0;
}


Measured memory_bytes: 2560
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
	int N,a[102];
	cin>>N;
	for(int i=0;i<N;i++)cin>>a[i];
	int minj,i,j,cnt=0;
	for(i=0;i<N;i++){
		minj=i;
		for(j=i;j<N;j++){
			if(a[minj]>a[j])minj=j;
		}
		if(minj!=i)cnt++;
		swap(a[minj],a[i]);
	}
	int first=1;
	for(i=0;i<N;i++){
		if(first)first=0;else cout<<" ";
		cout<<a[i];
	}
	cout<<endl<<cnt<<endl;
}


Measured memory_bytes: 3116
N,W = map(int, input().split())
dp = [[0]*(W+1) for y in range(N+1)]

for i in range(1,N+1):
    v, w = map(int, input().split())
    for j in range(W+1):
        if j < w:
            dp[i][j] = dp[i-1][j]
        else:
            dp[i][j] = max(dp[i-1][j],dp[i-1][j-w]+v)

print(dp[N][W])

Measured memory_bytes: 25496
#include <iostream>
#include <set>

using namespace std;

typedef long long ll;

const int MAX_N = 2e5 + 5;

int arr [MAX_N];
int pos [MAX_N];

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

  for (int i = 0; i < n; i++) {
    cin >> arr[i];
    pos[arr[i]] = i;
  }

  set<int> seen;
  seen.insert(-1);
  seen.insert(n);

  ll ans = 0;
  for (int i = 1; i <= n; i++) {
    ll nxt = *seen.upper_bound(pos[i]);
    ll prv = *prev(seen.upper_bound(pos[i]));
    ll cur = pos[i];

    ans += (nxt - cur) * (cur - prv) * (ll) i;
    
    seen.insert(pos[i]);
  }

  cout << ans << endl;
}


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

int dp[100];

//最大公約数
int gcd(int x, int y){
  if(x % y == 0) return 1;
  return gcd(y, x % y);
}
//最小公倍数
int lcm(int x, int y){
  return x * y / gcd(x, y);
}
//フィボナッチ数列
//配列dpを-1で初期化する
int fib(int n){
  if(n == 0 || n == 1) return dp[n] = 1;
  if(dp[n] != -1) return dp[n];
  return dp[n] = fib(n - 1) + fib(n - 2);
}
//階乗計算(factorial)
int fact(int n){
  if(n = 1) return 1;
  return n * fact(n - 1);
}
//累乗計算(Exponentiation)
//x**y
ll expo(int x, int y){
  ll ans = 1;
  rep(i, y){
    ans *= x;
  }
  return ans;
}
//桁数
int keta(ll x){
  if(x == 0) return 1;
  int res = 0;
  while(x){
    x /= 10;
    res++;
  }
  return res;
}


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

  vector<int> h(n);
  rep(i, n) cin >> h[i];

  sort(h.begin(), h.end());
  reverse(h.begin(), h.end());

  ll ans = 0;

  if(k >= n) cout << 0 << endl;
  else{
    for(int i = k; i < n; i++){
      ans += h[i];
    }
    cout << ans << endl;
  }
}


/*





















*/


Measured memory_bytes: 1024
// A. 

#include <iostream>
#include <algorithm>
#include <sstream>
#include <cstdio>
#include <cstring>

using namespace std;

int main(int argc, char *argv[])
{
	int a, b, c;
	cin >> a >> b >> c;
	int ans = 0;
	for (ans = 0; ans < 1000000; ++ans) {
		if ((a % 2) || (b % 2) || (c % 2)) {
			break;
		}
		int pa = a, pb = b, pc = c;
		a = pb / 2 + pc / 2;
		b = pa / 2 + pc / 2;
		c = pa / 2 + pb / 2;
	}
	cout << (ans >= 1000000 ? -1 : ans) << endl;
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<iomanip>
#include<algorithm>
#include<queue>
#include<stack>
#include<list>
#include<map>
#include<deque>
#include<cctype>
#include<math.h>
using namespace std;
#define ll long long
int main(){
    ll N,C;
    ll s,t,c;
    ll i,j;
    cin >> N >> C;
    ll ch[C][100010];
    for(i=0;i<C;i++){
        for(j=0;j<100010;j++){
            ch[i][j]=0;
        }
    }
    for(i=0;i<N;i++){
        cin >> s >> t >> c;
        ch[c-1][s]+=1;
        ch[c-1][t+1]-=1;
    }
    ll tmp=0,ans=0;
    for(j=1;j<100010;j++){
        for(i=0;i<C;i++){
            ch[i][j]+=ch[i][j-1];
        }
    }
    for(j=0;j<100010;j++){
        tmp=0;
        for(i=0;i<C;i++){
            if(ch[i][j]!=0)tmp++;
        }
        ans=max(ans,tmp);
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 23680
#include<iostream>
#include<vector>
using namespace std;
typedef long long ll;

ll n,x;
ll a[50+1],p[50+1];

ll solve(ll n, ll x){
    if(n==0){
        if(x<=0) return 0;
        else return 1;
    }else if(x<=a[n-1]+1){
        return solve(n-1,x-1);
    }else{
        return p[n-1]+1+solve(n-1,x-2-a[n-1]);
    }
}

int main(){
    cin >> n >> x;
    a[0]=p[0]=1;
    for(ll i=1;i<=n;i++){
        a[i]=2*a[i-1]+3;
        p[i]=2*p[i-1]+1;
    }
    cout << solve(n,x) << endl;
}

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




int main(){ 
      
      int n; cin >> n;
      vector<vector<int>> a(n,vector<int>(n,0));
      for(int i=0;i<n;i++){
            int u,k; cin >> u >> k;
            if(k==0) continue;
            for(int j=0;j<k;j++){
                  int v; cin >> v;
                  a[u-1][v-1] = 1;
            }
      }

      for(int i=0;i<n;i++){
            for(int j=0;j<n;j++){
                  cout << a[i][j] ;
                  if(j!=n-1){
                        cout<<" ";
                  }
                  
            }
            cout << endl;

      }
}


Measured memory_bytes: 3128
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
LL n,a,b,c,d; 
map<LL,LL> s;
LL dfs(LL n=5e18){
    if(n==0){
        return 0;
    }
    if(s.count(n)){
        return s[n];
    }
    LL &ans = s[n];
    ans=((LL)5e18)/n<d?5e18:n*d;
    ans = min(ans,dfs(n/2)+a+(n%2)*d);
    ans = min(ans,dfs(n/3)+b+(n%3)*d);
    ans = min(ans,dfs(n/5)+c+(n%5)*d);
    ans = min(ans,dfs(n/2+1)+a+(2-n%2)*d);
    ans = min(ans,dfs(n/3+1)+b+(3-n%3)*d);
    ans = min(ans,dfs(n/5+1)+c+(5-n%5)*d);
    return ans; 
}
void work(){
    cin>>n>>a>>b>>c>>d;
    s.clear();
    cout<<dfs(n)<<endl;
}
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int t;
    cin>>t;
    while(t--){
        work();
    }
    return 0;
}

Measured memory_bytes: 4780
#include <iostream>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <vector>
#include <algorithm>
#include <queue>
#include <set>

using namespace std;
typedef long long ll;
const int maxn=2e5+100;
const ll mod=1e9+7;
const int INF=1e7;


int main()
{
    int x,y;
    cin>>x>>y;
    double a=(x+y)/2.0;
    int l=a;
    if(abs(l-x)==abs(l-y)){
        cout<<l<<endl;
    }else{
        cout<<"IMPOSSIBLE"<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
use std::cmp::*;
use std::collections::*;
use std::io::*;
use std::str::FromStr;
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}
fn main() {
    let n: usize = read();
    let mut a = 0;
    let mut b = 0;
    let mut c = 0;
    let mut d = 0;
    for i in 0..n {
        let s: String = read();
        if s == "AC" {
            a += 1;
        } else if s == "WA" {
            b += 1;
        } else if s == "TLE" {
            c += 1;
        } else {
            d += 1;
        }
    }
        println!("AC x {}", a);
        println!("WA x {}", b);
        println!("TLE x {}", c);
        println!("RE x {}", d);
    
}


Measured memory_bytes: 2140
# 単純に橋となる辺を返す
def bridge(G, N):
    result = set()
    label = [None]*N
    gen = 0
    cost = [0]*N
    def dfs(u, p):
        nonlocal gen
        res = 0
        for v in G[u]:
            if v == p:
                continue
            if label[v] is not None:
                if label[v] < label[u]:
                    cost[v] += 1
                    res += 1
            else:
                label[v] = gen; gen += 1
                r = dfs(v, u)
                if r == 0:
                    result.add((u, v) if u < v else (v, u))
                res += r
        res -= cost[u]
        return res
    for v in range(N):
        if not label[v]:
            label[v] = gen; gen += 1
            r = dfs(v, -1)
            assert r == 0, r
    return result

N, M = [int(i) for i in input().split()]
G = [[] for _ in range(N)]
for _ in range(M):
    a, b = [int(i)-1 for i in input().split()]
    G[a].append(b); G[b].append(a);

print(len(bridge(G, N)))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; (i) < (int)(n); ++ (i))
#define REP3(i, m, n) for (int i = (m); (i) < (int)(n); ++ (i))
#define REP_R(i, n) for (int i = (int)(n) - 1; (i) >= 0; -- (i))
#define REP3R(i, m, n) for (int i = (int)(n) - 1; (i) >= (int)(m); -- (i))
#define ALL(x) begin(x), end(x)
#define dump(x) cerr << #x " = " << x << endl
using ll = long long;
using namespace std;

template <int32_t MOD>
struct mint {
    int32_t value;
    mint() : value() {}
    mint(int64_t value_) : value(value_ < 0 ? value_ % MOD + MOD : value_ >= MOD ? value_ % MOD : value_) {}
    inline mint<MOD> operator + (mint<MOD> other) const { int32_t c = this->value + other.value; return mint<MOD>(c >= MOD ? c - MOD : c); }
    inline mint<MOD> operator * (mint<MOD> other) const { int32_t c = (int64_t)this->value * other.value % MOD; return mint<MOD>(c < 0 ? c + MOD : c); }
    inline mint<MOD> & operator += (mint<MOD> other) { this->value += other.value; if (this->value >= MOD) this->value -= MOD; return *this; }
    inline mint<MOD> & operator *= (mint<MOD> other) { this->value = (int64_t)this->value * other.value % MOD; if (this->value < 0) this->value += MOD; return *this; }
};
template <int32_t MOD> mint<MOD> operator * (int64_t value, mint<MOD> n) { return mint<MOD>(value) * n; }
template <int32_t MOD> std::ostream & operator << (std::ostream & out, mint<MOD> n) { return out << n.value; }

template <int32_t MOD>
mint<MOD> fact(int n) {
    static std::vector<mint<MOD> > memo(1, 1);
    while (n >= memo.size()) {
        memo.push_back(memo.back() * mint<MOD>(memo.size()));
    }
    return memo[n];
}

constexpr int MOD = 1e9 + 7;
mint<MOD> solve(int n, const string & s) {
    mint<MOD> cnt = 1;
    int opened = 0;
    for (char c : s) {
        if (c == (opened % 2 == 0 ? 'W' : 'B')) {
            if (opened) {
                cnt *= opened;
                -- opened;
            } else {
                cnt = 0;
            }
        } else {
            ++ opened;
        }
    }
    if (opened) cnt = 0;
    return cnt * fact<MOD>(n);
}

int main() {
    int n; string s; cin >> n >> s;
    cout << solve(n, s) << endl;
    return 0;
}


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

int main(){
    int n;
    string s;
    cin >> n;
    cin >> s;
    
    int x=0, m=0;
    for(int i=0; i<n; i++){
        if(s.at(i)=='I'){
            x++;
            if(x>m)
                m = x;
        }else if(s.at(i) == 'D')
            x--;
    }

    cout << m << endl;
    return 0;
}

Measured memory_bytes: 3612
"use strict";
    
const main = arg => {
    arg = arg.trim().split("\n");
    const H = parseInt(arg[0].split(" ")[0]);
    const W = parseInt(arg[0].split(" ")[1]);
    
    const words = arg.slice(1, H + 1).map(s=>s.split(" "));
    const alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZ".split("");
    
    for(let i=0; i<H; i++) {
        for(let j=0; j<W; j++) {
            if(words[i][j] === "snuke") {
                console.log(alpha[j] + (parseInt(i) + 1));
                return;
            }
        }
    }
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));


Measured memory_bytes: 7624
/*input
6
G W Y P Y W
*/
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
	int n;
	cin>>n;
	char s;
	int flag1 = 0,flag2 = 0, flag3 = 0, flag4 = 0;
	while(n--)
	{
		cin>>s;
		if(s=='W')
			flag1 = 1;
		if(s=='P')
			flag2 = 1;
		if(s=='G')
			flag3 = 1;
		if(s=='Y')
			flag4 = 1;
	}
	if(flag1 && flag2 && flag3 && flag4) 
		cout<<"Four";
	else
		cout<<"Three";

}

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

int main() {
	// your code goes here
	long long a,b,c,d;
	cin>>a>>b>>c>>d;
	vector<long long>v;
	v.push_back(a*c);
	v.push_back(a*d);
	v.push_back(b*c);
	v.push_back(b*d);
//	v.push_back((a+1)*c);
//	v.push_back((a+1)*d);
//	v.push_back((b-1)*c);
//	v.push_back((b-1)*d);
//	v.push_back((c+1)*a);
//	v.push_back((c+1)*b);
//	v.push_back((d-1)*a);
//	v.push_back((d-1)*b);
//	v.push_back((a+1)*(c+1));
//	v.push_back((b-1)*(d-1));
//	v.push_back((a+1)*(d-1));
//	v.push_back((c+1)*(b-1));
	cout<<*max_element(v.begin(),v.end());
	return 0;
}

Measured memory_bytes: 3632
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

typedef long long ll;
constexpr double PI = 3.141592653589793;
constexpr ll INF = 1e18 + 10;
template <class T>
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}

using namespace std;
//    cout << setprecision(20) << ans << "\n";

int main()
{
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    string s;
    cin >> s;

    if (s == "ARC")
    {
        cout << "ABC"
             << "\n";
        return 0;
    }

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


Measured memory_bytes: 3660
#include<bits/stdc++.h>
#define endl "\n"
using namespace std;
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  string s;
  int cnt = 0;
  int a[50] = {};
  
  cin >> s;

  for(int i = 0;i < s.size();i++){
	if(a[s[i] - 'A'] == 0){
	  cnt ++;
	  a[s[i] - 'A'] ++;
	}
  }

  if(cnt == 2){
	cout << "Yes" << endl;
  }else{
	cout << "No" << endl;
  }
  return 0;
}



Measured memory_bytes: 256
n, d = list(map(int, input().split()))
x = [list(map(int,input().split())) for _ in range(n)]
num = 0
for i in range(n):
    for j in range(i + 1, n):
        dis = 0
        for k in range(d):
            dis += (x[i][k] - x[j][k]) ** 2
        root = dis ** 0.5
        if root.is_integer():
            num += 1
print(num)


Measured memory_bytes: 3060
#include <iostream>

using namespace std;

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

	int a[100];

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

		if (a[i] % 2 == 0) {
			if (a[i] % 3 == 0 || a[i] % 5 == 0) {
			}
			else {
				cout << "DENIED" << endl;
				break;
			}
		}

		if (n - 1 == i) {
			cout << "APPROVED" << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
#define lli long long int
#define ulli unsigned long long int
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define pf push_front
#define lb lower_bound
#define ub upper_bound
#define bs binary_search
#define loopl(i,a,b) for(lli i=a;i<b;i++) 
#define loop(i,a,b) for(int i=a;i<b;i++)
#define all(v) v.begin(), v.end()
#define mod 1000000007
#define mod2 1000000006
#define inf 1000000000000000000
#define lld long double
#define pll pair<long long int,long long int>
#define pii pair<int,int>
#define vll vector<lli>
#define vii vector<int>
#define is indexed_set
#define eps 0.000001
#define endl '\n'
#define mo 998244353
#define pi 3.141592653589793
 
using namespace std ;

const lli dx4[] = {-1, 0, 1, 0};
const lli dy4[] = {0, 1, 0, -1};
const lli dx8[] = {-1, 0, 1, 0, -1, -1, 1, 1};
const lli dy8[] = {0, 1, 0, -1, -1, 1, -1, 1};
 
typedef tree<pair<pll,lli>,null_type,less<pair<pll,lli>>,rb_tree_tag,
tree_order_statistics_node_update> indexed_set;
 
#define N 1000005

int main()
{
/////////////////////////////////////
    
    fastio;
 
/////////////////////////////////////  

    lli n;
    cin>>n;

    string s[n];
	
	map<string,lli> m;

	lli mx = 0;
	loopl(i,0,n)
	{
		cin>>s[i];
		m[s[i]]++;
		mx = max(mx , m[s[i]]);
	}

	set<string> st;
	loopl(i,0,n)
	{
		if(m[s[i]] == mx) st.insert(s[i]);
	}

	for(auto x:st) cout<<x<<endl;

}
        
 

Measured memory_bytes: 34816
#include <iostream>  // cin,cout
#include <stdio.h>   // printf,scanf (standard input/output)
#include <cmath>     // abs(x),pow(x,2)
#include <string>
#include <string.h>  // strlen, strcmp
#include <algorithm> // min,max, sort(v.begin(),v.end())
#include <vector>
#include <time.h>
using namespace std;



int main(){
    float T, X;
    float f;
    string s;
    
    cin >> T >> X;
    //for (int i=0;i<N;i++) cin >> A[i];
    
    f = T/X;
    
    cout << f << endl;
    
    
    
    return 0;
}


Measured memory_bytes: 256
//#include<bits/stdc++.h>
#include<iostream>
#include<cmath>
#include<cstdio>
#include<vector>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<utility>
#include<algorithm>
#include<cstring>
#include<sstream>
#include <iomanip>

using namespace std;

typedef long long ll ;
typedef double db;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef vector< pair<int,int> > vii;
const double pi = 2*acos(0) ;

#define pf		  	printf
#define sf			  scanf
#define pb(a)         push_back(a)
#define mp			make_pair
#define fi			 first
#define se			 second
#define for0(i,n)        for(int i=0;i<n;i++)
#define for1(i,n)        for(int i=1;i<=n;i++)
#define forab(i,a,b)       for(int i=a;i<=b;i++)
#define lcm(a, b)     ((a)*((b)/gcd(a,b)))
#define sq(a)		   (a)*(a)
#define nw				"\n"
#define abs(x)		fabs(x)
#define pcase(z,x)    cout<<"Case "<<z<<": "<<x<<"\n"

int main()
{
	int i,n;
	db x;
	cin>>n;
	vi ar(n);
	for0(i,n) cin>>ar[i];
	sort(ar.begin(),ar.end());
	x = (ar[0]+ar[1])/2.0;
	for(i=2 ; i<n ; i++){
		x = x+ar[i];
		x /= 2.0;
		}
	pf("%.5lf\n",x);
	
	return 0;
}

Measured memory_bytes: 256
using System;

public class Program
{
	public static void Main(string[] args)
	{
		var ss = new StreamScanner();
		//---------------------------------
		var x = ss.Next<int>();
		var y = ss.Next<int>();
		Console.WriteLine(x*y+" "+2*(x+y));

		/*
		//????????????int, double, string?????????????????£????????????
		int i = ss.Next<int>();
		double d = ss.Next<double>();
		string s = ss.Next<string>();

		//?????°???????????????????????¨?????????????????????????????????????????????????´???????
		int[] array = ss.Next<int>(10);
		*/
		//---------------------------------
	}
}

public class StreamScanner
{
	private readonly char[] _c = { ' ' };
	private int _index = -1;
	private string[] _input = new string[0];
	private readonly System.IO.StreamReader _sr = new System.IO.StreamReader(Console.OpenStandardInput());

	public T Next<T>()
	{
		if (_index == _input.Length - 1)
		{
			_index = -1;
			while (true)
			{
				string rl = _sr.ReadLine();
				if (rl == null)
				{
					if (typeof(T).IsClass) return default(T);
					return (T)typeof(T).GetField("MinValue").GetValue(null);
				}
				if (rl != "")
				{
					_input = rl.Split(_c, StringSplitOptions.RemoveEmptyEntries);
					break;
				}
			}
		}
		return (T)Convert.ChangeType(_input[++_index], typeof(T), System.Globalization.CultureInfo.InvariantCulture);
	}

	public T[] Next<T>(int x)
	{
		var ret = new T[x];
		for (var i = 0; i < x; ++i) ret[i] = Next<T>();
		return ret;
	}

	public T[][] Next<T>(int x, int y)
	{
		var ret = new T[y][];
		for (var i = 0; i < y; ++i) ret[i] = Next<T>(x);
		return ret;
	}
}

Measured memory_bytes: 9848
#include <iostream>
#include <string>

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

  // 見つからない。または複数個ある場合はNo
  if (s.find('a') == std::string::npos || s.find('a') != s.rfind('a') ||
      s.find('b') == std::string::npos || s.find('b') != s.rfind('b') ||
      s.find('c') == std::string::npos || s.find('c') != s.rfind('c')) {
    std::cout << "No" << std::endl;
    return 0;
  }

  std::cout << "Yes" << std::endl;
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
  long n,i,d,c=0,a[5],k=0,dig=0;
  scanf("%ld",&n);
  while(dig<4)
  {
    d=n%10;
    a[k]=d;
    k++;
    n=n/10;
    dig++;
  }
  for(i=0;i<3;i++)
  {
    if(a[i]==a[i+1])
    {
      c++; break;
    }
  }
  if(c>0)
  {
    printf("Bad");
  }
  else
  {
    printf("Good");
  }
  return 0;
}

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

N=int(input())
heights = list(map(int,input().split()))  # N, H1, H2.... 複数行入力
ans = 0  # 一番左
max_height = heights[0]  # 一番西の建物が最大

for i in range(N):
    max_height = max(max_height,heights[i])
    if max_height == heights[i]:  # 更新
        ans += 1

print(ans)

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


def read():
    X = input().strip()
    return X,


def solve(X):
    q = deque()
    for x in X:
        if x == "S":
            q.append(x)
        elif x == "T":
            if len(q) > 0 and q[-1] == "S":
                q.pop()
            else:
                q.append(x)
    return len(q)


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


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

using namespace std;

using ll = long long;
using ull = unsigned long long;

int main(int argc, char const *argv[]) {
	int n;
	std::cin >> n;
	std::vector<int> v(n);
	std::vector<ll> sums(2,0);
	for (size_t i = 0; i < n; i++) {
		std::cin >> v[i];
		sums[i%2] += v[i];
	}
/*
	ull ans = 0;
	// 奇数番目と偶数番目を足して大きい方が正、小さい方が負
	// なので、0番目の数字をその符号にしておく
	if (sums[0] > sums[1] && v[0] <= 0) {
		ans = ans + abs(v[0]) + 1;
		v[0] = 1;
	}
	else if (sums[0] < sums[1] && v[0] >= 0) {
		ans = ans + abs(v[0]) + 1;
		v[0] = -1;
	}
	// sums[0] == sums[1]
	else if (v[0] == 0) {
		ans += 1;
		v[0] = 1;
	}

	ll now,pre;
	now = pre = v[0];
	for (size_t i = 1; i < n; i++) {
		now = v[i] + pre;
		if (pre * now >= 0) {
			if (pre > 0) {
				ans = ans + abs(now) + 1;
				now = -1;
			}
			else if (pre < 0) {
				ans = ans + abs(now) + 1;
				now = 1;
			}
		}
		pre = now;
	}*/

	ull ans1,ans2;
	ans1 = ans2 = 0;
	ll now,pre;
	pre = v[0];
	if (v[0] <= 0) {
		ans1 = ans1 + abs(v[0]) + 1;
		pre = 1;
	}
	for (size_t i = 1; i < n; i++) {
		now = v[i] + pre;
		if (pre * now >= 0) {
			ans1 = ans1 + abs(now) + 1;
			if (pre > 0) {
				now = -1;
			}
			else if (pre < 0) {
				now = 1;
			}
		}
		pre = now;
	}

	pre = v[0];
	if (v[0] >= 0) {
		ans2 = ans2 + abs(v[0]) + 1;
		pre = -1;
	}
	for (size_t i = 1; i < n; i++) {
		now = v[i] + pre;
		if (pre * now >= 0) {
			ans2 = ans2 + abs(now) + 1;
			if (pre > 0) {
				now = -1;
			}
			else if (pre < 0) {
				now = 1;
			}
		}
		pre = now;
	}

	std::cout << min(ans1,ans2) << '\n';
	return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define vlli vector<ll>
#define vi vector<int>
#define vs vector<string>
#define vplli vector< pair< ll,ll> >
#define plli pair< ll,ll >
#define vps vector< pair< string, string> >
#define vpi vector< pair< int, int> >
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define fast ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define forn(i,a,n) for(ll i=a;i<n;i++)
#define forr(i,n,a) for(ll i=n-1;i>=a;i--)
#define scan(arr,a,n) for(int i=(a);i<(n);i++)cin>>(arr)[i];
#define print(arr,a,n) for(int i=(a);i<(n);i++)cout<<(arr)[i]<<' ';

const ll inf = 1e18;

ll add(ll x, ll y) {ll res = x + y; return (res >= mod ? res - mod : res);}
ll mul(ll x, ll y) {ll res = x * y; return (res >= mod ? res % mod : res);}
ll sub(ll x, ll y) {ll res = x - y; return (res < 0 ? res + mod : res);}
ll power(ll x, ll y) {ll res = 1; x %= mod; while (y) {if (y & 1)res = mul(res, x); y >>= 1; x = mul(x, x);} return res;}
ll mod_inv(ll x) {return power(x, mod - 2);}

int main(){
	fast;
	ll n;
	cin>>n;
	ll a[n], dp[n];
	scan(a, 0, n);
	dp[0] = 0;
	dp[1] = abs(a[0]-a[1]);
	forn(i, 2, n){
		dp[i] = min(dp[i-1]+abs(a[i]-a[i-1]), dp[i-2]+abs(a[i] - a[i-2]));

	}
	cout<<dp[n-1]<<endl;
}

Measured memory_bytes: 5128
import java.util.Scanner;
import java.util.HashMap;
import java.util.List;
import java.util.Arrays;
import java.util.ArrayList;
import java.lang.Math;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int ans = (a > b*2) ? a - b*2 : 0;
        System.out.println(ans);
    }

}


Measured memory_bytes: 21844
#include <iostream>
#include <cmath>
using namespace std;
const int N_MAX = 50;
const int M_MAX = min(N_MAX * (N_MAX - 1) / 2 + 1, 50);
int N;
int M;
bool edge[M_MAX][M_MAX];
int cnt = 0;
bool visited[N_MAX];
void dfs (int v) {
    visited[v] = true;
    for (int i = 0; i < N; i++) {
        if (edge[v][i] && !visited[i]) {
            dfs(i);
        }
    }
}

int main (void) {
    int a[N_MAX];
    int b[N_MAX];

    cin >> N >> M;

    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N; j++) {
            edge[i][j] = false;
        }
    }

    for (int i = 0; i < M; i++) {
        cin >> a[i] >> b[i];
        a[i]--;
        b[i]--;
        edge[a[i]][b[i]] = true;
        edge[b[i]][a[i]] = true;
    }

    for (int i = 0; i < M; i++) {
        for (int j = 0; j < N; j++) {
            visited[j] = false;
        }
        edge[a[i]][b[i]] = false;
        edge[b[i]][a[i]] = false;
        dfs(0);
        bool bridge = true;
        for (int i = 0; i < N; i++) {
            if (!visited[i]) {
                bridge = false;
            }
        }
        if (bridge) {
            cnt++;
        }
        edge[a[i]][b[i]] = true;
        edge[b[i]][a[i]] = true;
    }

    int ans = M - cnt;
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void){
    // Your code here!
    long long int i,n, d,x[200001], y[200001], ans = 0;
    scanf("%lld%lld", &n, &d);
    for (i = 0; i < n; i++)
    {
        scanf("%lld%lld", x + i, y + i);
        if (x[i]*x[i]+y[i]*y[i]<=d*d)
            ans++;
    }
    printf("%lld",ans);
}


Measured memory_bytes: 4852
import sys
import math
W,a,b = map(int,input().split())
al = [[a,0],[a,1],[a+W,0],[a+W,1]]
bl = [[b,1],[b,2],[b+W,1],[b+W,2]]
box = []
if (b <= a and a <= b+W) or (a <= b <= a+W and a <= b+W <=a+W) or (a <= b and b <= a+W):
  print(0)
  sys.exit()
for i in range(4):
  for j in range(4):
    num = math.sqrt((al[i][0]-bl[j][0])**2 + (al[i][1]-bl[j][1])**2)
    box.append(int(num))
print(min(box))

Measured memory_bytes: 9144
#include<bits/stdc++.h>
#define all(vec) vec.begin(),vec.end()
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const ll MOD=1000000007;
const ll INF=1000000000;
int dx[8]={0,0,1,1,1,-1,-1,-1};
int dy[8]={1,-1,1,-1,0,1,-1,0};
int main(){
    int n,k;cin>>n>>k;
    int a[100010];
    int id;
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    int ans=0;
    n--;
    if(n%(k-1)){
        ans=n/(k-1)+1;
    }else{
        ans=n/(k-1);
    }
    cout<<ans<<endl;
}

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

int main() {
  int N;
  cin >> N;
  vector<int>A(N);
  for(int i=0; i<N; i++)cin >> A.at(i);
  
  int count = 0;
  bool X = true;
  while(X){
    for(int j=0; j<N; j++){
      if(A.at(j)%2==0)A.at(j)/=2;
      else{
        X = false;
        break;
      }
    }
    
    if(X)count ++;
  }
  
  cout << count << endl;
    
}

Measured memory_bytes: 3580
// #include {{{
#include <iostream>
#include <cassert>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <ctime>
#include <queue>
#include <set>
#include <map>
#include <stack>
#include <string>
#include <bitset>
#include <vector>
#include <complex>
#include <algorithm>
using namespace std;
// }}}
// #define {{{
typedef long long ll;
typedef double db;
typedef pair<int,int> pii;
typedef vector<int> vi;
#define de(x) cout << #x << "=" << x << endl
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define per(i,a,b) for(int i=(b)-1;i>=(a);--i)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define fi first
#define se second
// }}}

const int N = 40404;
const db inf = 1e20;
int n , a[N] , b[N] , c[N] , s[N] , t[N];
db Y[N];
template<class T>
struct Fenwick{
#define lb(x) ((x)&-(x))
    int n;T a[N];
    void ini(int _n){ fill_n(a+1,n=_n,0);}
    void add(int x,T d){ for(;x<=n;x+=lb(x)) a[x]+=d;}
    T sum(int x){ T r=0;for(;x>=1;x^=lb(x)) r+=a[x];return r;}
};
Fenwick<int> fen;

db solve() {
    rep(i,0,n) s[i] = t[i] = i;
    int need = (n * (n - 1) / 2 + 1) / 2;
    db l = -inf , r = inf;
    rep(i,0,n) Y[i] = (c[i] - a[i] * l) / b[i];
    sort(t , t + n , [&](int x,int y){return Y[x] < Y[y];});
    rep(i,0,n) s[t[i]] = i;
    rep(i,0,200) {
        db m = (l + r) / 2;
        rep(i,0,n) Y[i] = (c[i] - a[i] * m) / b[i];
        sort(t , t + n , [&](int x,int y){return Y[x] < Y[y];});
        int cnt = 0;
        fen.ini(n);
        rep(i,0,n) cnt+=i-fen.sum(s[t[i]]+1),fen.add(s[t[i]]+1,1);
        if(cnt >= need) r = m;
        else l = m;
    }
    return r;
}

int main(){
    scanf("%d",&n);
    rep(i,0,n) scanf("%d%d%d",a+i,b+i,c+i);
    pair<db,db> ans;
    ans.fi = solve();
    rep(i,0,n) swap(a[i] , b[i]);
    ans.se = solve();
    printf("%.16f %.16f\n",ans.fi , ans.se);
    return 0;
}


Measured memory_bytes: 1536
#include <algorithm>
#include <iostream>
#include <map>
#include <set>
#include <vector>
using namespace std;

int main() {
    long long N;
    cin >> N;
    long long tmp;
    string ans = "APPROVED";
    for (int i = 0; i < N; i++) {
        cin >> tmp;
        if (tmp % 2 == 0 && (tmp % 3 != 0 && tmp % 5 != 0)) {
            ans = "DENIED";
            break;
        }
    }
    cout << ans << "\n";
    return 0;
}


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

int main() {
  int n;
  cin >> n;
  int c = 0;
  for(int i = 0; i < n; i++){
    int a;
    cin >> a;
    if(a % 2) c++;
  }
   if(c % 2) cout << "NO" << endl;
  else cout << "YES" << endl;
}

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

#define fastio 			ios::sync_with_stdio(0);	cin.tie(0); cout.tie(0);  cout<<fixed;  cout<<setprecision(12);
#define randomINT 		mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define	newl 			cout<<"\n"
#define DISP(as)		for(auto it : as) cout<<it<<" ";newl;
#define all(x)         	(x).begin(),(x).end()
#define mset(x,val)    	memset(x,val,sizeof(x))
#define newl           	cout<<"\n"
#define pb             	push_back
#define mp             	make_pair
#define f 				first
#define s 				second
#define dline          cerr<<"///REACHED///\n";
#define deb1(x)        cerr<<#x<<" = "<<x<<'\n';
#define deb2(x,y)      cerr<<'['<<#x<<','<<#y<<"] = "<<'['<<x<<','<<y<<']'<<'\n';
#define deb3(x,y,z)    cerr<<'['<<#x<<','<<#y<<','<<#z<<"] = "<<'['<<x<<','<<y<<','<<z<<']'<<'\n';

typedef long long 				ll;
typedef long double 			ld;
typedef vector<ll> 				vll;
typedef pair<ll , ll> 			pll;
typedef pair<ld, ld> 			pld;
typedef unordered_map<ll, ll> 	um;
typedef vector<pll> 			vpll;

const ll 	MAX5 	= 	1e+5 + 7;
const ll 	MAX7 	= 	1e+7 + 7;
const ll 	MAXN 	= 	MAX7;
const ll   	INF   	=  	0x7f7f7f7f7f7f7f7f;
const int  	INFi 	=  	0x7f7f7f7f;
const ll 	MOD		=  	1e9 + 7;


// <------------- Declare Variables Here ------------> //

ll T = 1;
ll n, x, m, k, u, v;
string s, t;

// <------------- Implement Functions Here ----------> //



// <------------- Start of main() -------------------> //

void MAIN() {
	cin>>n;
	if(n%2==0) n--;
	cout<<(n-1)/2;newl;
}

int main() {
	fastio; randomINT;
	//cin >> T;
	while (T--) {
		MAIN();
	}
	return 0;
}

Measured memory_bytes: 256
/*
* Welcome to my code!
*---------------------------------------------*
* author : lynmisakura(twitter : @andoreiji11)
*/
#include <iostream>
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <chrono>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <cassert>

using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define repn for(int i = 0;i < n;i++)
#define ain(a) for(auto& i : a)cin >> i;
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x.size()) 
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define cont continue

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using pi = pair<int,int>;
using vpi = vector<pi>;
using pl = pair<ll,ll>;
using vpl = vector<pl>;

template<class T> bool chmin(T& a,T b){if(a > b){a = b;return true;}else return false;}
template<class T> bool chmax(T& a,T b){if(a < b){a = b;return true;}else return false;}
template<class T> void print(std::vector<T> a){ int sz = a.size();
for(int i=0;i<a.size();i++)cout << a[i] << (i < sz-1 ? ' ' : '\n'); }
void ioboost(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(20);}
///////////////////////////////////////////////////////////

int n; // length of s.
int cnt2[1000005];// size of 2 in x!

int func(int i){
  return cnt2[n - 1] == ((cnt2[i] + cnt2[n - 1 - i]));
}

void precalc(){
  for (size_t i = 0; i < 1000001; i++)
  {
    if(i == 0)cnt2[i] = 0;
    else{
      int x = i;
      int add = 0;
      while (x % 2 == 0)
      {
        add++;
        x /= 2;
      }
      cnt2[i] = cnt2[i-1] + add; 
    }
  }
}

int main(int argc, char const *argv[])
{
  precalc();

  cin >> n;
  string s;cin >> s;
  vector<int> a(n);

  bool ex_1 = false;

  for (size_t i = 0; i < n; i++)
  {
    a[i] = s[i] - '0';
    a[i]--;
    ex_1 |= (a[i] == 1);
  }

  int ans_eq_1 = 0;
  for (size_t i = 0; i < n; i++)
  {
    if(a[i] == 1){
      ans_eq_1 ^= func(i);
    }
  }
  if(ans_eq_1){
    cout << 1 << '\n';
    return 0;
  }else{
    if(ex_1){
      cout << 0 << '\n';
      return 0;
    }else{
      for (size_t i = 0; i < n; i++)
      {
        a[i] /= 2;
      }

      ans_eq_1 = 0;
      for (size_t i = 0; i < n; i++)
      {
        if(a[i] == 1){
          ans_eq_1 ^= func(i);
        }
      }
      cout << ans_eq_1 * 2 << '\n'; 
    }
  }  

  return 0;
}


Measured memory_bytes: 9220
s = str(input())
L =['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']
for i in s:
  if i in L:
    L.remove(i)
if L == []:
  print('None')
else:
  print(L[0])

Measured memory_bytes: 9116
#include <iostream>
#include <vector>
#include <cmath>
#include <queue>
#include <deque>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <functional>
#include <bitset>
#include <utility>
#include <sstream>
#include <fstream>
#include <stack>
#include <cstdlib>
#include <complex>
#include <set>

using namespace std;

#define INF 1070000000LL
#define pb push_back
#define irep(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) irep(i,0,n)

typedef long long lint;
typedef pair<int, int> pint;
struct Edge{
    int to,weight;
};
typedef vector<vector<Edge> > Graph;

int main(){
    int n;
    cin >> n;
    rep(i,9){
	if(n <= 111*(i+1)){
	    cout << 111*(i+1) << endl;
	    break;
	}
	else{
	    continue;
	}
    }
    return 0;
}


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

int main()
{
    int m,n;
    scanf("%d %d",&n,&m);
    while(n>=1&&n<=100&&m>=0&&m<=n)
    {
        if(m==n)
        {
         printf("Yes");
            break;
        }
        else
            {
         printf("No");
            break;
        }
    }
    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <numeric> // accumulate(v.begin(), v.end(), 0)                                                         

using namespace std;
#define ll long long

int main(){
  int a, b;
  cin >> a >> b;
  int num;
  if(b < 10)
    num = a * 10 + b;
  else if(b < 100)
    num = a * 100 + b;
  else
    num = a * 1000 + b;

  int root = floor(sqrt(num));
  if(num == root * root)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;

  return 0;
}


Measured memory_bytes: 256
#include<cstdio>  
#include<cstring>  
#include<algorithm> 
#include<iostream>
#include<cmath> 
using namespace std;  
#define LL long long  
#define G  110000  

const int mod=1e9+7;
LL pri[G];  
LL ni[G],ans=1; 
int prm[32],step=0;
LL pow(LL a,int b)  
{  
    LL ans=1,base=a;  
    while (b)  
    {  
        if (b&1)  
            ans=(base*ans)%mod;  
        base=(base*base)%mod;  
        b>>=1;  
    }  
    return ans;  
}  
void s() 
{  
    pri[0]=1;  
    for(int i=1;i<=G;i++)  
    {  
        pri[i]=(pri[i-1]*i)%mod;
    }
    ni[G]=pow(pri[G],mod-2);
    for(int i=G-1;i>=0;i--)
    ni[i]=(ni[i+1]*(i+1))%mod; 
}
void divide(int n)
{
	for(int i=2;i<=sqrt(n);i++)
	{
		if(n%i==0) step++;
		while(n%i==0)
		{
			n/=i;
			prm[step]++;
		}
	}
	if(n>1){
		prm[++step]=1;
	}
	
}
int main()  
{  
    int n,m;
    scanf("%d%d",&n,&m);
	s();
    divide(m);
    for(int i=1;i<=step;i++) 
    {  
    long long now=(pri[n+prm[i]-1]*ni[n-1])%mod*ni[prm[i]]%mod;
    ans=ans*now%mod;} 
    printf("%lld",ans);
    return 0; 
}

Measured memory_bytes: 1920
import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        String p = sc.nextLine();
        s += s;
        if(s.contains(p)){
            System.out.println("Yes");
        }
        else{
            System.out.println("No");
        }
    }
}


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

#define ll long long int

ll ar[1000001];

int main() {
	// your code goes here
ll n,i,ans=0,a;
cin>>n;
for(i=1;i<=n;i++)
 {
   cin>>ar[i];
 }
for(i=1;i<n;i++)
 {
   if(ar[i]==i)
    {
      swap(ar[i],ar[i+1]);
      ans++;
    }
 }
 if(n==ar[n])
  {
     ans++; 
  }
 cout<<ans;
	return 0;
}


Measured memory_bytes: 1024
N, M = list(map(int, input().split()))
L, R = [], []
for i in range(M):
    l, r = list(map(int, input().split()))
    L.append(l)
    R.append(r)

l = max(L)
r = min(R)
ans = r - l + 1
if ans < 0:
    ans = 0
print(ans)

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

int main()
{
	int n;
	int a[3];

	cin >> n;

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

		sort(a, a + 3);

		if (a[0] * a[0] + a[1] * a[1] == a[2] * a[2])
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
	}

	return 0;
}


Measured memory_bytes: 3020
import java.util.*;
public class Main
{
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int alas = scan.nextInt();
        int tinggi = scan.nextInt();
        int sisi = scan.nextInt();
        int hasil = 0;
        hasil = alas*tinggi/2;
        System.out.println(hasil);

    }
}


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

#define ll long long
#define N 109
bool vis[N][N];

int main()
{
    int n,m;
    cin>>n>>m;
    char a[N][N];
    for(int i=1; i<=n; i++)
    {
        for(int j=1; j<=m; j++)
        {
            cin>>a[i][j];
        }
    }
    for(int i=1; i<=n; i++)
    {
        int c=0;
        for(int j=1; j<=m; j++)
        {
            if(a[i][j]=='.')
            {
                c++;
            }
            if(c==m)
            {
                for(int k=1; k<=m; k++)
                    vis[i][k]=true;
            }
        }
    }
    for(int i=1; i<=m; i++)
    {
        int d=0;
        for(int j=1; j<=n; j++)
        {
            if(a[j][i]=='.')
            {
                d++;
            }
            if(d==n)
            {
                for(int k=1; k<=n; k++)
                    vis[k][i]=true;
            }
        }
    }
    for(int i=1; i<=n; i++)
    {
        int x=0;
        for(int j=1; j<=m; j++)
        {
            if(vis[i][j]==false){
                cout<<a[i][j];
                x++;
            }
        }
        if(x!=0)
        cout<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
import sys
import math

N = 1000000
primes = [1] * (N//2+1)
primes[0] = 1

for i in range(3,int(math.sqrt(N))+1,2):
    if primes[i//2]:
        primes[(i*i)//2::i] = [0] * len(primes[(i*i)//2::i])
    primes[i//2] += primes[i//2-1]

for i in range(int(math.sqrt(N))+1,N+1,2):
    primes[i//2] += primes[i//2-1]


for i in sys.stdin:
    n = int(i)
    if n == 1:
        print(0)
    elif n == 2:
        print(1)
    else:
        print(primes[(n-1)//2])

Measured memory_bytes: 28884
package main

import "fmt"

func main() {

	var a, b, k int
	i := 1
	num := []int{}
	count := 0
	fmt.Scan(&a, &b, &k)

	for ; i <= a && i <= b; i++ {
		if a%i == 0 && b%i == 0 {
			num = append(num, i)
		}
	}
	for i = len(num) - 1; i >= 0; i-- {
		count++
		if count == k {
			fmt.Println(num[i])
			break
		}
	}
}


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

#define ALL(a) (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
#define DESCSORT(c) sort(c.begin(), c.end(), greater<int>())

using namespace std;

using LL = long long int;
using LD = long double;

using pii = pair<int, int>;
using pll = pair<LL, LL>;
using pdd = pair<double, double>;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vl = vector<LL>;
using vvl = vector<vl>;
using vvvl = vector<vvl>;
using vd = vector<double>;
using vvd = vector<vd>;
using vs = vector<string>;
using vb = vector<bool>;
using vvb = vector<vb>;

const int INF = (1 << 30) - 1;
const LL INF64 = ((LL)1 << 62) - 1;
const double PI = 3.1415926535897932384626433832795;

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

int gcd(int x, int y) { return y ? gcd(y, x % y) : x; }
LL gcd(LL x, LL y) { return y ? gcd(y, x % y) : x; }

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

	map<string, int> mp;
	string s;

	while (cin >> s) {
		mp[s]++;
	}

	pair<string, int> ma = make_pair("nanashi", 0);
	pair<string, int> ma2 = make_pair("nanashi2", 0);
	for (auto v : mp) {
		if (ma.second < v.second) {
			ma = v;
		}
		if (ma2.second < v.first.size()) {
			ma2 = make_pair(v.first, v.first.size());
		}
	}

	cout << ma.first << " " << ma2.first << endl;
	return 0;
}

Measured memory_bytes: 3048
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
#define fi first
#define se second
#define pb push_back
#define forn(i,n) for(int i=0;i<(n);i++)
#define for1(i,n) for(int i=1;i<=n;i++)
#define forr(i,n) for(int i=n;i>=0;i--)
#define all(x) x.begin(), x.end()
const int MAXN = 2e3 +5;

void fio(){
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}

LL d[MAXN][MAXN];
LL min(LL a, LL b){
  return a>b?b:a;
}


int main(){
  fio();
  LL n,x,y; cin>>n>>x>>y;
  vector <LL> an(n+1);
  for1(i,n){
    for(int j=i+1;j<=n;j++){
     an[min(abs(i-x) + 1LL + abs(j-y), (j-i))]++;
    }
  }
  for1(i,n-1) cout<<an[i]<<endl;

  return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int f[3001][3001]={0};
char s[3001],t[3001],p[3001];
void print(char c)
{
	printf("%c",c);
	return;
}
void dfs(int x,int y)
{
	if(x==0||y==0)
		return;
	if(s[x-1]!=t[y-1])
	{
		if(f[x-1][y]>=f[x][y-1])
			dfs(x-1,y);
		else
			dfs(x,y-1);
	}
	else
		dfs(x-1,y-1);
	if(s[x-1]==t[y-1])	
		print(s[x-1]);
}
int main()
{
	int i,j,n,m;
	scanf("%s",s);
	scanf("%s",t);
	n=strlen(s);
	m=strlen(t);
	for(i=1;i<=n;i++)
	{
		for(j=1;j<=m;j++)
		{
			if(s[i-1]==t[j-1])
				f[i][j]=f[i-1][j-1]+1;
			else
				f[i][j]=max(f[i-1][j],f[i][j-1]);
		}
	}
	dfs(n,m);
	return 0;
}

Measured memory_bytes: 35456