akhauriyash/Code-Regression huggingface dataset:
// 2014/08/30 Tazoe

#include <iostream>
using namespace std;

int main()
{
	for(int i=0; i<4; i++){
		int t, n;
		cin >> t >> n;

		if(t==1){
			cout << 6000*n << endl;
		}
		else if(t==2){
			cout << 4000*n << endl;
		}
		else if(t==3){
			cout << 3000*n << endl;
		}
		else{
			cout << 2000*n << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 1160
#pragma GCC optimize("Ofast")
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <iomanip> // setprecision
#include <complex> // complex
#include <math.h> 
#include <functional>
using namespace std;
using ll = long long;
using P = pair<int,int>;
constexpr ll INF = 1e18;
constexpr int inf = 1e9;
constexpr ll mod2 = 1000000007;
constexpr ll mod = 998244353;
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> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
// --------------------------------------------------------------------------



int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  ll N,X,M;
  cin >> N >> X >> M;
  X %= M;
  ll sum = X;
  if(N <= M){
    for(int i=1; i<N; i++){
      X = (X*X)%M;
      sum += X;
    }
    cout << sum << "\n";
    return 0;
  }
  vector<int> nxt(M,-1);
  ll cnt = N-1;
  while(1){
    if(nxt[X] != -1){
      ll now = nxt[X];
      ll roop = 1;
      X = nxt[X];
      ll now_sum = X;
      while(nxt[X] != now){
        X = nxt[X];
        now_sum += X;
        roop++;
      }
      sum += cnt/roop * now_sum;
      cnt %= roop;
      while(cnt){
        X = nxt[X];
        sum += X;
        cnt--;
      }
      cout << sum << "\n";
      return 0;
    }else{
      nxt[X] = (X*X)%M;
      X = (X*X)%M;
      sum += X;
    }
    cnt--;
  }
  return 0;
}

Measured memory_bytes: 3740
#include <iostream>
#include <set>
#include <vector>
#include <string>
#include <algorithm>
#include <iterator>

using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)
#define repi(i, n) for(auto i = (n).begin(); i != (n).end(); i++)
#define in_arr(type, a, n) copy_n(istream_iterator<type>(cin), n, (a).begin());

using ll = long long int;
const ll MOD = 1000000007;

ll gcd(ll a, ll b) {
    return b == 0 ? a : gcd(b, a % b);
}

ll lcm(ll a, ll b) {
    return a / gcd(a, b) * b;
}

ll mod_add(ll a, ll b) {
    return (a + b) % MOD;
}

ll mod_sub(ll a, ll b) {
    return (a + MOD - b) % MOD;
}

ll mod_mul(ll a, ll b){
    return (a * b) % MOD;
}

ll mod_pow(ll base, ll po) {
    if(po == 0)
        return 1;
    else if(po == 1)
        return base;
    ll new_base = mod_pow(base, po / 2);
    return mod_mul(mod_mul(new_base, new_base), po % 2 == 0 ? 1 : base);
}

ll mod_div(ll a, ll b){
    return mod_mul(a, mod_pow(b, MOD - 2));
}

int main(){
    int n;
    cin >> n;
    vector<int> h(n);
    in_arr(int, h, n);
    int sum = 0, ans = 0;
    rep(i, n - 1) {
        if(h[i] < h[i + 1]) {
            ans = max(sum, ans);
            sum = 0;
        } else {
            sum++;
        }
    }
    cout << max(ans, sum) << endl;
    return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <stdlib.h>
using namespace std;

int main(){
  string str;
  int num[26] = {0};

  char ch;
  while(cin >> ch){
    
    if(islower(ch)){
      num[ch-'a'] ++;
    }else if(isupper(ch)){
      num[ch-'A'] ++;
    }
  }

  for(int i=0; i<26; i++){
    char c='a'+i;
    cout << c << " : " << num[i] << endl;
  }
  
  return(0);

}

Measured memory_bytes: 1144
//Optional FAST

//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,fma,abm,mmx,avx,avx2,tune=native")

//Required Libraries

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>

//Required namespaces

using namespace std;
using namespace __gnu_pbds;

//Required defines

#define endl '\n'

#define READ(X) cin>>X;
#define READV(X) long long X; cin>>X;
#define READAR(A,N) long long A[N]; for(long long i=0;i<N;i++) {cin>>A[i];}
#define rz(A,N) A.resize(N);
#define sz(X) (long long)(X.size())
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define FORI(a,b,c) for(long long a=b;a<c;a++)
#define FORD(a,b,c) for(long long a=b;a>c;a--)

//Required typedefs

typedef tree<long long,null_type,less<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
typedef tree<long long,null_type,greater<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set1;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;

//Required Constants

const long long inf=(long long)1e18;
const long long MOD=(long long)(1e9+7);
const long long INIT=(long long)(1e6+1);
const long double PI=3.14159265358979;

// Required random number generators

// mt19937 gen_rand_int(chrono::steady_clock::now().time_since_epoch().count());
// mt19937_64 gen_rand_ll(chrono::steady_clock::now().time_since_epoch().count());

//Required Functions

ll power(ll x,ll y) 
{ 
    if (y == 0) 
        return 1; 
    ll p = power(x, y/2) % MOD; 
    p = (p * p) % MOD; 
  
    return (y%2 == 0)? p : (x * p) % MOD; 
}
ll modInverse(ll a) 
{ 
   return power(a,MOD-2); 
   
}

//Work

int main()
{
    #ifndef ONLINE_JUDGE
    if (fopen("INPUT.txt", "r"))
    {
        freopen ("INPUT.txt" , "r" , stdin);
        //freopen ("OUTPUT.txt" , "w" , stdout);
    }
    #endif
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    clock_t clk;
    clk = clock();
//-----------------------------------------------------------------------------------------------------------//

    READV(N);
    READV(K);
    READAR(A,N);
    FORI(i,K,N)
    {
        if(A[i]>A[i-K])
        {
            cout<<"Yes"<<endl;
        }
        else
        {
            cout<<"No"<<endl;
        }
    }

//-----------------------------------------------------------------------------------------------------------//


    clk = clock() - clk;
    cerr << fixed << setprecision(6) << "Time: " << ((double)clk)/CLOCKS_PER_SEC << endl;

    return 0;
}

Measured memory_bytes: 5360
g1 = [1, 3, 5, 7, 8, 10, 12]
g2 = [4, 6, 9, 11]
g3 = [2]

s = map(int, raw_input().split())

x = s[0]
y = s[1]

if (x in g1) and (y in g1):
    print "Yes"
elif (x in g2) and (y in g2):
    print "Yes"
elif (x in g3) and (y in g3):
    print "Yes"
else:
    print "No"

Measured memory_bytes: 2568
#include<stdio.h>
typedef struct{
  char m;
  int n;
  int o;
} data;

void BubbleSort(data*,int);
void SelectionSort(data*,int);


int main(){
  data C[36],A[36];
  int N,i;


  scanf("%d",&N);

  for(i=0;i<N;i++) {
    scanf(" %c%d",&C[i].m,&C[i].n);
    C[i].o=i;
  }
  for(i=0;i<N;i++){
    A[i]=C[i];
   
  }
 
  BubbleSort(C,N);
  SelectionSort(A,N);



  return 0;
}

void BubbleSort(data *C,int N){
  int i,j,c=0;
  data A;
  for(i=0;i<N;i++){
    for(j=N-1;j>=i+1;j--){
      if(C[j].n<C[j-1].n){
	A=C[j];
	C[j]=C[j-1];
	C[j-1]=A;
      }
    }
    
  }
  for(i=0;i<N;i++){
    if(i!=0)printf(" ");
    printf("%c%d",C[i].m,C[i].n);

  }
    printf("\n");

    for(i=0;i<=N;i++){
      if(C[i].n==C[i+1].n&&C[i].o>C[i+1].o) c++;
    }    
    if(c>0)printf("Not stable\n");
    else printf("Stable\n");

    
}


void SelectionSort(data *C,int N){
  int i,j,minj,c=0;
  data A;
  for(i=0;i<N;i++){
    minj=i;
    for(j=i;j<N;j++){
      if(C[j].n<C[minj].n)minj=j;
      }
    A=C[i];
    C[i]=C[minj];
    C[minj]=A;
  }

  for(i=0;i<N;i++){
    if(i!=0)printf(" ");
    printf("%c%d",C[i].m,C[i].n);
  }
    printf("\n");

   for(i=0;i<=N;i++){
     if(C[i].n==C[i+1].n&&C[i].o>C[i+1].o)c++;
    }   

    if(c>0)printf("Not stable\n");
    else printf("Stable\n");
}

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

int main() {
    int N;
    long long K;
    cin >> N >> K;
    vector<long long> cnt(100001);
    for (int i = 0; i < N; i++) {
        int a, b;
        cin >> a >> b;
        cnt[a] += b;
    }

    for (int i = 1; i <= 100000; i++) {
        if (cnt[i] >= K) {
            cout << i << endl;
            break;
        }
        K -= cnt[i];
    }
    return 0;
}

Measured memory_bytes: 1024
def main():
    A, B, N = map(int, input().split())
    max = ((A*N)//B) - (A * (N//B))

    if B<=N:
        temp = ((A*(B-1))//B) - (A * ((B-1)//B))
        if max < temp:
            max = temp

    print(max)




if __name__ == '__main__':
    main()


Measured memory_bytes: 9180
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
int main() {
    int n;
    cin >> n;
    
    int d = n % 10;
    if (d == 2 || d == 4 || d == 5 || d == 7 || d == 9)
        cout << "hon" << endl;
    else if (d == 0 || d == 1 || d == 6 || d == 8)
        cout << "pon" << endl;
    else if (d == 3)
        cout << "bon" << endl;
    
    return 0;
}


Measured memory_bytes: 3620
#include<iostream>
using namespace std;
int main(){
  string s; cin >> s;
  string ans;
  int n; cin >> n;
  for(int i = 0; i < s.size(); i+=n){
    char c = s.at(i);
    ans.push_back(c);
  }
  cout << ans;
}
    
    
    

Measured memory_bytes: 3572
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(s,i, n) for (int i = (int)s; i < (int)(n); i++)
#define pb push_back
typedef long long ll;


string change(string s){

    return s;
} 
int main(){
    int n,k;
    string s;
    cin>>n>>k;
    
    cin>>s;
    int ans=0;
    rep(i,n){
        if(i==0){
            if(s[i]=='R' && s[i+1]=='R')ans++;
        }else if(i==n-1){
            if(s[i]=='L' && s[i-1]=='L')ans++;
        }else{
            if(s[i]=='R' && s[i+1]=='R')ans++;
            else if(s[i]=='L' && s[i-1]=='L')ans++;
        }
    }
    if(ans==n-1){
        cout<<ans<<endl;
        return 0;
    }
    int nr=0;
    int nl=0;
    rep(i,n){
        if(s[i]=='R')nr++;
        else{nl++;}
    }
    
    ans+=2*k;
    if(ans>n-1)ans=n-1;
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main()
{
    ll n;
    cin >> n;
    vector<ll> a(n);
    vector<ll> b(n);
    ll sum = 0;
    ll m = 1e10;
    bool flag = true;
    for(int i = 0; i < n; i++)
    {
        ll a, b;
        cin >> a >> b;
        sum += a;
        if(a > b)
        {
            flag = false;
            m = min(m, b);
        }
    }
    if(flag) cout << 0 << endl;
    else  cout << sum - m << endl;
}



Measured memory_bytes: 640
/*
  Compete against Yourself.
  Author - Aryan Choudhary (@aryanc403)
*/

#pragma GCC optimize ("Ofast")
#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize ("-ffloat-store")

#include<iostream>
#include<bits/stdc++.h>
using namespace std;
#define fo(i,n)   for(i=0;i<(n);++i)
#define repA(i,j,n)   for(i=(j);i<=(n);++i)
#define repD(i,j,n)   for(i=(j);i>=(n);--i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define endl "\n"

typedef long long int lli;
typedef long double mytype;
typedef pair<lli,lli> ii;
typedef vector<ii> vii;
typedef vector<lli> vi;

clock_t time_p=clock();
void aryanc403()
{
#ifdef ARYANC403
    time_p=clock()-time_p;
    cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
#endif
}

#ifdef ARYANC403
#include "/home/priank/codes/PastCodes/header.h"
#else
    #define dbg(args...)
#endif

const lli INF = 0xFFFFFFFFFFFFFFFL;

lli seed;
mt19937 rng(seed=chrono::steady_clock::now().time_since_epoch().count());
inline lli rnd(lli l=0,lli r=INF)
{return uniform_int_distribution<lli>(l,r)(rng);}

class CMP
{public:
bool operator()(ii a , ii b) //For min priority_queue .
{    return ! ( a.X < b.X || ( a.X==b.X && a.Y <= b.Y ));   }};

void add( map<lli,lli> &m, lli x,lli cnt=1)
{
    auto jt=m.find(x);
    if(jt==m.end())         m.insert({x,cnt});
    else                    jt->Y+=cnt;
}

void del( map<lli,lli> &m, lli x,lli cnt=1)
{
    auto jt=m.find(x);
    if(jt->Y<=cnt)            m.erase(jt);
    else                      jt->Y-=cnt;
}

bool cmp(const ii &a,const ii &b)
{
    return a.X<b.X||(a.X==b.X&&a.Y<b.Y);
}

const lli mod = 1000000007L;
// const lli maxN = 1000000007L;

    lli T,n,i,j,k,in,cnt,l,r,u,v,x,y;
    lli m;
    string s;
    vi a;
    //priority_queue < ii , vector < ii > , CMP > pq;// min priority_queue .

int main(void) {
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    // freopen("txt.in", "r", stdin);
    // freopen("txt.out", "w", stdout);
// cout<<std::fixed<<std::setprecision(35);
// cin>>T;while(T--)
{
    lli c;
    cin>>n>>c>>k;
    a.clear();a.reserve(n);

    fo(i,n)
    {
        cin>>in;
        a.pb(in);
    }

    sort(all(a));

    i=0;

    while(i<n)
    {
        j=i;
        cnt++;
        while(j<n&&a[j]<=a[i]+k&&j-i<c)
            j++;
        i=j;
    }


    cout<<cnt<<endl;

}   aryanc403();
    return 0;
}


Measured memory_bytes: 1024
N = int(input())
A = [int(x) for x in input().split()]
 
partial_sum = A.copy()
sum_now = A[N-1]
for j in range(N-2,-1,-1):
    sum_now = int((sum_now+A[j])%(10**9+7))
    partial_sum[j] = sum_now
res = 0
for i in range(N-1):
    res = (res + (A[i]*partial_sum[i+1])%(10**9+7)) %(10**9+7)
print(int(res))

Measured memory_bytes: 31840
import heapq


class Edge:
    def __init__(self, dst, weight, cost):
        self.dst, self.weight, self.cost = dst, weight, cost

    def __lt__(self, e):
        return self.weight > e.weight


class Graph:
    def __init__(self, V):
        self.V = V
        self.E = [[] for _ in range(V)]

    def add_edge(self, src, dst, weight, cost):
        self.E[src].append(Edge(dst, weight, cost))


class ShortestPath:
    """Dijkstra's algorithm : find the shortest path from a vertex
       Complexity: O(E + log(V))
       used in GRL1A(AOJ)
    """

    def __init__(self, G, INF=10**9):
        """ V: the number of vertexes
            E: adjacency list (all edge in E must be 0 or positive)
            start: start vertex
            INF: Infinity distance
        """
        self.G, self.INF = G, INF

    class Node:
        def __init__(self, v, cost):
            self.v, self.cost = v, cost

        def __lt__(self, n):
            return self.cost < n.cost

    def dijkstra(self, start, goal=None):
        que = list()
        self.dist = [self.INF] * self.G.V  # distance from start
        self.prev = [-1] * self.G.V  # prev vertex of shortest path
        self.dist[start] = 0
        heapq.heappush(que, self.Node(start, 0))

        while len(que) > 0:
            n = heapq.heappop(que)
            if self.dist[n.v] < n.cost:
                continue
            if goal is not None and n.v == goal:
                return
            for e in self.G.E[n.v]:
                if self.dist[n.v] + e.weight < self.dist[e.dst]:
                    self.dist[e.dst] = self.dist[n.v] + e.weight
                    heapq.heappush(que, self.Node(e.dst, self.dist[e.dst]))
                    self.prev[e.dst] = n.v

    def getPath(self, end):
        path = [end]
        while self.prev[end] != -1:
            end = self.prev[end]
        return path[::-1]


while True:
    N, M = map(int, input().split())
    if not (N | M):
        break
    g = Graph(N)
    for _ in range(M):
        u, v, d, c = map(int, input().split())
        g.add_edge(u - 1, v - 1, d, c)
        g.add_edge(v - 1, u - 1, d, c)
    sp = ShortestPath(g)
    sp.dijkstra(0)
    print(sum(min(e.cost for e in g.E[i] if sp.dist[e.dst] + e.weight == sp.dist[i]) for i in range(1, N)))

Measured memory_bytes: 27648
#include <iostream>
using namespace std;
int n,l,s,maxi;
int main()
{ cin>>n;
  for(int i=1;i<=n;i++)
  { cin>>l;
    if(maxi<=l)
       maxi=l;
    s+=l;
  }
  s-=maxi;
  if(maxi<s)
     cout<<"Yes";
  else
     cout<<"No";
  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 ll long long int
int keta(ll a){
  int count=1;
  while(a>=10){
    a/=10;
    count++;
  }
  return count;
}
ll S(ll a){
  ll sum=0;
  ll A=a;
    for(int i=keta(A)-1;i>=0;i--){
     ll AC=a;
      rep(j,i)
	AC/=10;     
      sum+=AC;
      rep(j,i)
	AC*=10;
      a-=AC;
      // cout<<a<<endl;
  }
    return sum;
}

int main(){
  ll n;
  cin>>n;
  if(n%S(n)==0)
    cout<<"Yes"<<endl;
  else
    cout<<"No"<<endl;
  // cout<<S(n)<<endl;
  

  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cctype>

int main(){
	char ch;
	
	while(1){
		scanf("%c", &ch);
		
		if(islower(ch)) printf("%c", toupper(ch));
		else if(isupper(ch)) printf("%c", tolower(ch));
		else printf("%c", ch);
		
		if(ch=='\n') break;
	}

	return 0;
}


Measured memory_bytes: 2580
/* Author rumoisen */
/* created 2018/10/13 */

#include <vector>
#include <map>
#include <string>
#include <cmath>
#include <iomanip>
#include <numeric>
#include<iostream>
#include <algorithm>
 
using namespace std;
 
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define INF (ll)1e18
#define MOD (ll)1e9 + 7
#define pb push_back

void no(){cout<<"No"<<endl;exit(0);}
void yes(){cout<<"Yes"<<endl;exit(0);}
void No(){cout<<"NO"<<endl;exit(0);}
void Yes(){cout<<"YES"<<endl;exit(0);}

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> V;
typedef map<int, int> M;

using namespace std;

int main()
{
    ll n;
    cin>>n;
    ll ans=1;
    for(int i=1;i<=n;i++){
        ans*=i;
        ans%=MOD;
    }   
    cout<<ans<<endl;
}

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

int main(){
  int h, w;
  cin >> h >> w;
  vector< vector <char> > s(h+2, vector<char>(w+2, '#'));
  
  for(int i=0;i<h;++i){
    for(int j=0;j<w;++j){
      cin >> s[i+1][j+1];
    }
  }

  for(int i=0;i<h+2;++i){
    for(int j=0;j<w+2;++j){
  	cout << s[i][j];
    }
    cout << endl;
  }
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline
inpl = lambda: list(map(int,input().split()))
N, Q = inpl()
neighbor = [[] for i in range(N)]
for i in range(N-1):
    a, b = inpl()
    a -= 1
    b -= 1
    neighbor[a].append(b)
    neighbor[b].append(a)
X = [0] * N
for _ in range(Q):
    p, x = inpl()
    X[p-1] += x
result = [0] * N
def dfs(node, x, parent):
    x += X[node]
    result[node] = x
    for c in neighbor[node]:
        if c == parent:
            continue
        else:
            dfs(c,x,node)

dfs(0, 0, None)
print(' '.join(map(str,result)))

Measured memory_bytes: 244172
#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i, a, b) for(ll i = (a); i < (ll)b; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF (1ll << 60)
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;
using vl = vector<ll>;
using vvl = vector<vl>;
typedef double db;
typedef string str;
typedef pair<ll, ll> p;
constexpr int MOD = 1000000007;
using ll = long long;
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

void print(const std::vector<int> &v) {
    std::for_each(v.begin(), v.end(), [](int x) { std::cout << x << " "; });
    std::cout << std::endl;
}

int main() {
    ll a, b, x;
    cin >> a >> b >> x;
    int hoge = (a % x == 0);
    cout << b / x - a / x + hoge << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <cmath>
using namespace std;
int main(){
    int a,b;
    cin>>a>>b;
    int ans=0;
    if(a<b)swap(a,b);
    while(b!=0){
        int c,d;
        c=a/b;
        d=a%b;
        a=b;
        b=d;
    }
    cout<<a<<endl;;
    
}



Measured memory_bytes: 3136
#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll n,a[100005];
int main()
{
	scanf("%lld",&n);
	for (int i=1;i<=n;i++)
		scanf("%lld",&a[i]);
	ll L=2,R=2;
	for (int i=n;i>=1;i--)
	{
		L=(L+a[i]-1)/a[i]*a[i];
		R=R/a[i]*a[i]+a[i]-1;
		if (L>R){puts("-1");return 0;}
	}
	printf("%lld %lld\n",L,R);
}


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

using ll = long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using pii = pair<int,int>;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define pb push_back
#define mp make_pair

int main() {
  int n; cin>>n;
  n%=10;
  if(n==3) cout<<"bon\n";
  else if(n==0||n==1||n==6||n==8) cout<<"pon\n";
  else cout<<"hon\n";
}


Measured memory_bytes: 3592
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <climits>

using namespace std;

struct Road {
    int from, to;
    int len;

    Road() {}
    Road(int f, int t, int l) : from(f), to(t), len(l) {}
};

vector<Road> roads_of[3000];
bool is_shopping_mall[3000];
int min_dist[3000];

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

    int N, M, K;
    cin >> N >> M >> K;
    for(int i = 0; i < M; ++i) {
        int a, b, l;
        cin >> a >> b >> l;
        --a; --b;
        roads_of[a].push_back(Road(a, b, l));
        roads_of[b].push_back(Road(b, a, l));
    }
    fill_n(is_shopping_mall, N, false);
    for(int i = 0; i < K; ++i) {
        int a;
        cin >> a;
        --a;
        is_shopping_mall[a] = true;
    }
    fill_n(min_dist, N, INT_MAX);

    static int memo[3000];
    for(int start = 0; start < N; ++start) {
        if(!is_shopping_mall[start]) continue;
        fill_n(memo, N, INT_MAX);
        priority_queue<pair<int, int> > q;
        q.push(make_pair(0, start));
        memo[start] = 0;
        while(!q.empty()) {
            int cost = -q.top().first;
            int pos = q.top().second;
            q.pop();
            if(memo[pos] < cost) continue;
            min_dist[pos] = min(min_dist[pos], cost);

            for(vector<Road>::iterator it = roads_of[pos].begin(); it != roads_of[pos].end(); ++it) {
                if(is_shopping_mall[it->to]) continue;

                int nc = cost + it->len;
                if(memo[it->to] > nc) {
                    memo[it->to] = nc;
                    q.push(make_pair(-nc, it->to));
                }
            }
        }
    }

    int ans = 0;
    for(int i = 0; i < N; ++i) {
        int d = 0;
        const int a = min_dist[i];
        // a+ul == b+vl, u+v == 1
        // a+ul == b+(1-u)l
        // 2ul == b-a+l
        // u == (b-a+l)/2l
        // ul == (b-a+l)/2
        for(vector<Road>::iterator it = roads_of[i].begin(); it != roads_of[i].end(); ++it) {
            const int b = min_dist[it->to];
            if(b >= a) {
                int ul = (b-a+it->len) / 2;
                if((b-a+it->len) % 2 == 1) ++ul;
                d = max(d, min_dist[i] + ul);
            }
        }
        ans = max(ans, d);
    }

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 5188
#include <iostream>
#include <string>
#include <list>
#include <utility>

using namespace std;

int main()
{
  string S;
  list<bool> X;
  cin >> S;

  int count_1=0, count_0=0;
  
  for (char c : S) {
    if (c=='0') ++count_0;
    else ++count_1;
  }

  cerr << count_0 << endl;
  cerr << count_1 << endl;
  
  cout << S.size() - max(count_1-count_0,count_0-count_1) << endl;
  
  return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <bitset>
#include <cstdio>
#include <cmath>

using namespace std;

int main() {
    int n, k;
    cin >> n >> k;
    vector<int> d(k);
    vector<vector<int>> a(k, vector<int>(n));
    for (int i = 0; i < k; i++) {
        cin >> d[i];
        for (int j = 0; j < d[i]; j++) {
            cin >> a[i][j];
        }
    }
    vector<int> snuke(n, 0);
    for (int i = 0; i < k; i++) {
        for (int j = 0; j < d[i]; j++) {
            snuke[a[i][j]-1]++;
        }
    }
    int cnt = 0;
    for (int i = 0; i < n; i++) {
        if (snuke[i] == 0) cnt++;
    }
    cout << cnt << endl;
}


Measured memory_bytes: 3640
#include<iostream>
using namespace std;
typedef long long ll;
int main(){
  ll a[105][105]={{}};
  ll b[105][105]={{}};
  int n,m,l;
  int i,j,k;
  cin >> n >> m >> l;
  for(i=0;i<n;i++){
    for(j=0;j<m;j++){
      cin >> a[i][j];
    }
  }
  for(i=0;i<m;i++){
    for(j=0;j<l;j++){
      cin >> b[i][j];
    }
  }
  for(i=0;i<n;i++){
    for(j=0;j<l;j++){
      ll o=0;
      for(k=0;k<m;k++){
	o+=a[i][k]*b[k][j];
      }
      if(j==0) cout << o;
      else cout << " " << o; 
    }
    cout << endl;
  }
  return 0;
}

Measured memory_bytes: 1344
#include<iostream>
#include<string>
#include<vector>
#include<cstdio>
#include<cstring>

using namespace std;

char siki[200];
int cur;


int digit(){
  int n=siki[cur]-'0';
  ++cur;
  return n;
}

int number(){
  int n=digit();
  while(cur<strlen(siki) && isdigit(siki[cur]))
    n=n*10+digit();

  return n;
}

int factor();

int term(){
  int a=factor();
  while(cur<strlen(siki) && (siki[cur]=='*' || siki[cur]=='/')){
    char op=siki[cur];
    ++cur;
    int b=factor();
    if(op=='*')a*=b;else a/=b;
  }
  return a;
}

int expression(){
  int a=term();
  while(cur<strlen(siki) && (siki[cur]=='+' || siki[cur]=='-')){
    char op=siki[cur];
    cur++;
    int b=term();
    if(op=='+')a+=b;else a-=b;
  }
  return a;
}

int factor(){
  if(siki[cur]!='(')return number();
  cur++;
  int n=expression();
  cur++;
  return n;
}

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

  for(int i=0;i<n;i++){
    cin>>siki;
    cur=0;
    cout<<expression()<<endl;
  }
}

Measured memory_bytes: 0
"use strict";

function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }

function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }

function _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }

function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }

!function () {
  function splitNum(line) {
    return (Array.isArray(line) ? line : line.split(/\s+/)).map(function (n) {
      return parseInt(n);
    });
  }

  function* range(start, end) {
    for (var i = start; i < end; i++) {
      yield i;
    }
  }

  !function (input) {
    var lines = input.split("\n");

    var _splitNum = splitNum(lines[0]),
        _splitNum2 = _slicedToArray(_splitNum, 2),
        N = _splitNum2[0],
        M = _splitNum2[1];

    var a = splitNum(lines.slice(1)).slice(0, M);
    var aSet = new Set(a);
    var dp = [1];
    var _iteratorNormalCompletion = true;
    var _didIteratorError = false;
    var _iteratorError = undefined;

    try {
      for (var _iterator = range(1, N + 1)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
        var i = _step.value;
        if (!aSet.has(i)) dp[i] = ((i < 2 ? 0 : dp[i - 2]) + dp[i - 1]) % (1e9 + 7);else dp[i] = 0;
      }
    } catch (err) {
      _didIteratorError = true;
      _iteratorError = err;
    } finally {
      try {
        if (!_iteratorNormalCompletion && _iterator.return != null) {
          _iterator.return();
        }
      } finally {
        if (_didIteratorError) {
          throw _iteratorError;
        }
      }
    }

    console.log(dp[N]);
  }(require("fs").readFileSync("/dev/stdin", "utf8"));
}();


Measured memory_bytes: 31520
#include<stdio.h>
#include<string.h>
#include<math.h>
int main(void)
{
	int a[5],s,d=0,f,g,h,j,i;
	for(i=0;i<5;i++) scanf("%d",&a[i]);
	if(a[0]<0){
		s=a[0]*-1;
		d+=s*a[2];
		a[0]=0;
	}
	if(a[0]==0)	d+=a[3];
	s=a[1]-a[0];
	d+=s*a[4];
	printf("%d\n",d);
	return 0;
}

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

using namespace std;

int64_t rep(int64_t h){
    if(h == 1)return 1;
    return rep(h/2)*2 + 1;
}

int main(){
    int64_t h;
    cin >> h;
    cout << rep(h);
    return 0;
}

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

int main(){
  int r,d,x[11];
  cin >> r >> d >> x[0];
  rep(i,10){
    x[i+1] = r*x[i] - d;
    cout << x[i+1] << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N,M,X;
  cin >> N >> M >> X;
  bool A[N];
  for(int i = 0; i < N; i++){
    A[i] = false;
  }
  for(int i = 0; i < M; i++){
    int a;
    cin >> a;
    A[a] = true;
  }
  int ans = INT_MAX;
  int cost = 0;
  for(int i = X; i > 0; i--){
    if(A[i]) cost++;
  }
  ans = cost;
  
  cost = 0;
  for(int i = X; i < N; i++){
    if(A[i]){
      cost++;
    }
  }

  ans = min(cost,ans);
  cout << ans << endl;
}

Measured memory_bytes: 256
d=dict()
n, k=map(int,input().split())
for _ in range(n):
    a,b=map(int,input().split())
    if a in d:
        d[a]+=b
    else:
        d.setdefault(a,b)
c=list(d.items())
c.sort()
cum=0

for key,v in c:
    cum+=v
    if cum>=k:
        ans=key
        break

print(ans)
        
    


Measured memory_bytes: 14556
#pragma target("avx")
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef unordered_map<ll, ll> U_MAP;
typedef priority_queue<ll> pq;
typedef priority_queue<ll, vector<ll>, greater<ll>> rpq;
constexpr ll INF = 1e9, MOD = 1e9 + 7, ohara = 1e6 + 10;
constexpr ll LINF = 1e18;

#define rep(i, n) for (ll(i) = 0; (i) < (int)(n); (i)++)
#define rrep(i, a, b) for (ll i = (a); i < (b); i++)
#define rrrep(i, a, b) for (ll i = (a); i >= (b); i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout << (x) << endl
#define doublecout(a) cout << fixed << setprecision(15) << a << endl;
#define fi first
#define se second
#define m_p make_pair
#define p_b push_back
string to_string(string s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string((string)s); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto& x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

//------ Believe yourself as a genius!!!!!! ------

int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
// int dy[]={-1,0,1,-1,1,-1,0,1};int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"), s;
ll n, cnt, ans, a, b, c, d, tmp, m, h, w, x, y, sum, k, q;

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

  cin >> n;
  rep(i, n) {
    cin >> a;
    if (a % 2 == 1) continue;
    if (a % 3 == 0 || a % 5 == 0) continue;
    ans = 1;
  }
  if (ans)
    Cout("DENIED");
  else
    Cout("APPROVED");
  return 0;
}

Measured memory_bytes: 256
from sys import exit
from math import sqrt

def divisor(x):
    i = 1
    x_divisor = []
    for i in range(1, int(sqrt(x)) + 1):
        if x % i == 0:
            x_divisor.append(i)
            x_divisor.append(x // i)
    result = set(x_divisor)
    return result

x = int(input())
div = divisor(x)
for k in div:
    if x ==  k ** 5:
        print(str(0), str(-k), sep = " ")
        exit()
    else:
        for a in range(1, int(x ** (1/4)) + 1):
            if x == a ** 5 - (a - k) ** 5:
                print(str(a), str(a - k), sep = " ")
                exit()

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

int mod = 1'000'000'007;

int main(){
    int n;
    cin >> n;
    string s;
    cin >> s;
    vector<int> num(26, 0);
    for (int i = 0; i < n; i++) num[s[i] - 'a']++;
    long long ans = 1;
    for (int i = 0; i < 26; i++){
        ans *= num[i] + 1;
        ans %= mod;
    }
    cout << (ans + mod - 1) % mod << endl;
}

Measured memory_bytes: 512
A, B, C, D =map( int, input().split() )

takahashi_win = False
while (A > 0) and ( C > 0 ):
    C -= B
    if C <= 0:
        takahashi_win = True
    A -= D
if takahashi_win:
    print('Yes')
else:
    print('No')
    

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

int main() {

    int a, b, c;
    cin >> a >> b >> c;
    swap(a, b);
    swap(a, c);
    
    cout << a << " " << b << " " << c << endl;

    return 0;
}

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

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

int main(){
	ll N;
	cin >> N;
	cout << N*(N+1)/2 - N << endl;
	return 0;
}


Measured memory_bytes: 3608
#include <functional>
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <iomanip>
#include <vector>
#include <string>
#include <cstdio>
#include <chrono>
#include <random>
#include <queue>
#include <stack>
#include <cmath>
#include <map>
#include <set>
#if __cplusplus >= 201103L
#include <unordered_map>
#include <unordered_set>
#endif
#define ls x<<1
#define rs x<<1|1
#define fi first
#define se second
#define ll long long
#define pb push_back
#define mp make_pair
#define fun function
#define sz(x) x.size()
#define lowbit(x) x&(-x)
#define all(x) x.begin(),x.end()
#define mem(a,b) memset(a,b,sizeof(a))
#define IOS ios_base::sync_with_stdio(0); cin.tie(0);cout.tie(0);

using namespace std;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const int INF = 0x3f3f3f3f;
const int mod=1e9+7;
 

int main() {
	IOS;
#ifdef xiaofan
	freopen("1.in","r",stdin);
	freopen("1.out","w",stdout);
#endif

	int n,k;
	cin>>n>>k;
	ll ans=0;
	for(int i=k;i<=n;i++){
		ll a=1LL*i*(i-1)/2;
		ll b=1LL*(n+n-i+1)*i/2;
		ans+=(b-a)+1;
		ans%=mod;
	}
	ans++;
	ans%=mod;
	cout<<ans<<endl;




	return 0;
}



Measured memory_bytes: 3644
/*
Author : Gaurav Singh
*/
#include<bits/stdc++.h>
using namespace std;
#define N 5005
#define MOD 1000000007
#define ll long long
#define ld long double
#define ull unsigned long long
#define li long int
#define str string
#define vll vector<ll>
#define pb push_back
#define frn(i,n) for(ll (i) = 0; (i) <(n) ; (i)=(i+1))
#define fr(i,n) for(ll (i) = 1; (i) <=(n) ; (i)=(i+1))
#define frev(i,n) for(ll (i) = n-1; (i) >=(0) ; (i)--)
#define fr1(j,a,b,c) for(ll (j) = a; (j) <c ; (i)=(i+b))
#define w(t) while(t--)
#define fast ios::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL)
void solve(){
    int k;
    str s;
    cin>>k>>s;
    //cout<<s.size()<<" ";
    if(s.size()<=k){
        cout<<s;
    }
    else{
        cout<<s.substr(0,k)<<"...";
    }
}
int main()
{   
   fast;
   int t=1;
    w(t){
        solve();
    }
   return 0;
}   
            

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

vector<string> S;
int black = 0;
int white = 0;
int INF = 1001001001;

int main() {
	 int H, W;
	 cin >> H >> W;
	 for(int i = 0; i < H; ++i) {
		 string s;
		 cin >> s;
		 S.push_back(s);
	 }

	 for(int i = 0; i < H; ++i) {
		 for(int j = 0; j < W; ++j) {
			 if(S[i][j] == '#') ++black;
			 else ++white;
		 }
	 }

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

	 int dist[100][100];
	 queue<pair<int, int>> Q;
	 Q.push(make_pair(0, 0));

	 for(int i = 0; i < 100; ++i) {
		 for(int j = 0; j < 100; ++j) {
			 dist[i][j] = INF;
		 }
	 }

	 dist[0][0] = 0;

	 while(Q.size()) {
		 auto q = Q.front(); Q.pop();
		 if(q.first == W -1 && q.second == H -1) break;
		 for(int i = 0; i < 4; ++i) {
			 int nx = q.first + dx[i];
			 int ny = q.second + dy[i];

			 if(0 <= nx && nx < W && 0 <= ny && ny < H && S[ny][nx] != '#' && dist[nx][ny] == INF) {
				 Q.push(make_pair(nx, ny));
				 dist[nx][ny] = dist[q.first][q.second] + 1;
			 }
		 }
	 }
	 int g  = dist[W-1][H-1];
	 if(g == INF) {
		 cout << -1 << endl;
		 return 0;
	 }
	 cout << white - g -1  << endl;

	return 0;
}


Measured memory_bytes: 3584
n, k = gets.chomp.split(' ').map(&:to_i)

d = gets.chomp.split(' ').map(&:to_i)

res = n
loop do
  tmp = res.to_s.split('').uniq.map(&:to_i)
  if tmp.length + d.length == (tmp + d).uniq.length
    puts res
    exit(0)
  end
  res += 1
end


Measured memory_bytes: 2044
#include<iostream>
#include<cstring>
#include<cstdio>
#include<vector>
#define MN 100000
using namespace std;
inline int read()
{
	int x=0,f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}
vector<int> v[17];
int head[MN+5],cnt=0,n,c[MN+5],f[MN+5][16],ans,F[1<<16],num[1<<16];
struct edge{int to,next,w;}e[MN*2+5];
inline void ins(int f,int t,int w)
{
	e[++cnt]=(edge){t,head[f],w};head[f]=cnt;
	e[++cnt]=(edge){f,head[t],w};head[t]=cnt;
}
void dfs(int x,int fa)
{
	for(int i=head[x];i;i=e[i].next) if(e[i].to!=fa)
	{
		dfs(e[i].to,x);c[x]^=e[i].w;
		//cout<<e[i].to<<" "<<(e[i].w^c[e[i].to])<<endl; 
		if(e[i].w^c[e[i].to]) ++ans,++f[e[i].to][e[i].w^c[e[i].to]];
	}
}
void Solve(int x,int fa)
{
	for(int i=head[x];i;i=e[i].next)
		if(e[i].to!=fa)
		{
			Solve(e[i].to,x);
			for(int j=1;j<16;++j) if(f[e[i].to][j]) 
			{
				if(f[x][j]) --ans;
				f[x][j]^=f[e[i].to][j];
			}
		}
}
int main()
{	
	n=read();
	for(int i=1,j,k;i<n;++i) j=read()+1,k=read()+1,ins(j,k,read());
	dfs(1,0);Solve(1,0);int prestat=0;
	for(int j=0;j<16;++j) if(f[1][j]) prestat|=1<<j;
	memset(F,63,sizeof(F));F[prestat]=0;
//	cout<<"prestat="<<prestat<<endl;
	for(int j=0;j<1<<16;++j)
	{
		num[j]=num[j>>1]+(j&1);
		v[num[j]].push_back(j);	
	}
	for(int j=16;~j;--j) for(int k=0;k<v[j].size();++k)
	{
		int x=v[j][k];if(F[x]>1000) continue;
		for(int a=0;a<16;++a) for(int b=a+1;b<16;++b)
			if((x&(1<<a))&&(x&(1<<b)))
			{
				int c=a^b,ss=x^(1<<a)^(1<<b)^(c?(1<<c):0);
				F[ss]=min(F[ss],F[x]+1+(x>>c&1));	
			}
		for(int a=0;a<16;++a) if(x&(1<<a)) F[x^(1<<a)]=min(F[x^(1<<a)],F[x]+1);
	}
	cout<<ans-num[prestat]+F[0];
	return 0;
}



Measured memory_bytes: 17920
#include <iostream>
#include <string>
#include <map>
using namespace std;

int main() {
	int N, M, max = 0;
	string s;
	map<string, int> mp;
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> s;
		mp[s]++;
	}
	cin >> M;
	for (int i = 0; i < M; i++) {
		cin >> s;
		mp[s]--;
	}
	map<string, int>::iterator it;
	for (it = mp.begin(); it != mp.end(); it++) {
		if (max < it->second) {
			max = it->second;
		}
	}
	cout << max << endl;
}


Measured memory_bytes: 256
#include <algorithm>
#include <array>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <vector>
using namespace std;
#define int long long

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

    int a, b;
    cin >> a >> b;

    bool ans = false;

    ans |= a % 3 == 0;
    ans |= b % 3 == 0;
    ans |= (a + b) % 3 == 0;

    cout << (ans ? "Possible" : "Impossible") << endl;
}


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

int t = 0;

int main(void){
    char s[5];
    scanf("%s" , s);

    for(int n=0; n<4; n++){
        if(s[n]=='+'){
            t += 1;
        }else{
            t -= 1;
        }
    }
    printf("%d\n" , t);
    return 0;
}

Measured memory_bytes: 128
n=int(input())
lists=[]
for t in range(n):
  a,b=input().split()
  lists.append([a,b])
ans=0
for t in range(n):
  if lists[t][1]=='JPY':
    ans+=int(lists[t][0])
  else:
    ans+=float(lists[t][0])*380000
print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
using ll =long long;
#define all(v) v.begin(),v.end()
 
int main() {
ll N;
  cin>>N;
  set<ll> S;
  for(ll i=0;i<N;i++) {
ll d;
    cin>>d;
    S.insert(d);
  }
  
  cout<<S.size()<<endl;
}


Measured memory_bytes: 3632
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <functional>
#include <bitset>

using namespace std;
using lint = long long int;
long long int INF = 1001001001001001LL;
int inf = 1000000007;
long long int MOD = 1000000007LL;
double PI = 3.1415926535897932;

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

#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()

/* do your best */

int main() {
  
  int a, b; cin >> a >> b;
  if(a > b) swap(a, b);
  for(int i = 0; i < b; i++) cout << a;
  cout << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define PI 3.1415926535897
using namespace std;
typedef long long ll;
const int INF = 1000000000;
const ll LINF = 1000000000000000000; //1e18
const double EPS = 1e-10;

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

    if (N == 0)
    {
        printf("%d\n", X);
        return (0);
    }

    vector<int> p(N);
    bool isX = true;
    for (int i = 0; i < N; i++)
    {
        cin >> p[i];
        if (p[i] == X)
        {
            isX = false;
        }
    }
    if (isX == true)
    {
        printf("%d\n", X);
        return (0);
    }

    sort(p.begin(), p.end());

    // ++
    int temp = X + 1;
    int right;
    bool found = false;
    while (true)
    {
        for (int i = 0; i < N; i++)
        {
            if (p[i] == temp)
            {
                break;
            }

            if (i == N - 1)
            {
                right = temp;
                found = true;
                break;
            }
        }
        if (found == true)
        {
            break;
        }
        temp++;
    }

    // --
    temp = X - 1;
    int left;
    found = false;
    while (true)
    {
        for (int i = 0; i < N; i++)
        {
            if (p[i] == temp)
            {
                break;
            }

            if (i == N - 1)
            {
                left = temp;
                found = true;
                break;
            }
        }
        if (found == true)
        {
            break;
        }
        temp--;
    }

    if (abs(X - right) < abs(X - left))
    {
        printf("%d\n", right);
    }
    else
    {
        printf("%d\n", left);
    }
    return (0);
}

Measured memory_bytes: 3724
#include<stdio.h>
#include<string.h>

int main(){
	//gp
	int a, b, n, x, y, i, j;
	//oHz
	int dp[17][17];
	//while
	while( scanf("%d %d", &a, &b) != EOF && a && b ){
		
		//oH
		memset( dp, -1, sizeof(dp) );
		
		//ss_
		scanf( "%d", &n );
		
		//X^[guuoH0
		for( i = 0; i <= a; i++ ){
			dp[i][0] = 0;
		}
		for( i = 0; i <= b; i++ ){
			dp[0][i] = 0;
		}
		
		dp[1][1] = 1; //X^[guoH1
		
		for( i = 0; i < n; i++ ){
			//ss_u
			scanf( "%d %d", &x, &y );
			
			//ss_oH0
			dp[x][y] = 0;
		}
		for( i = 1; i <= a; i++ ){ 
			for( j = 1; j <= b; j++ ){
				//oHvZs
				if( dp[i][j] != -1 ){
					continue;
				}
				
				//n_oHuoHuoHv
				dp[i][j] = dp[i - 1][j] + dp[i][j - 1];
			}
		}
		
		//oHo
		printf( "%d\n", dp[a][b] );
	}
	return 0;
}

Measured memory_bytes: 600
// Etavioxy
#include<cstdio>
#include<cctype>
#include<cstring>
#include<algorithm>
#include<cmath>
#define il inline
#define ll long long
#define rep(i,s,t) for(register int i=(s);i<=(t);i++)
#define rev_rep(i,s,t) for(register int i=(s);i>=(t);i--)
#define each(i,u) for(int i=head[u];i;i=bow[i].nxt)
#define file(s) freopen(s".in" ,"r",stdin),freopen(s".out","w",stdout)
#define pt(x) putchar(x)
using namespace std;
il int ci(){
	register char ch;int f=1;
	while(!isdigit(ch=getchar()))f=ch=='-'?-1:1;
	register int x=ch^'0';
	while(isdigit(ch=getchar()))x=(x*10)+(ch^'0');
	return f*x;
}

enum{N=200023};

ll a[N],b[N];

int main(){
	int n = ci();
	rep(i,0,n) a[i] = ci();
	rev_rep(i,n,0) b[i] = b[i+1]+a[i];
	ll now = 1;
	ll ans = 0;
	bool fail = 0;
	rep(i,0,n){
		ll t = min(b[i],now);
		if( t<a[i] ){ fail=1; break; }
		ans += t;
		now -= a[i];
		if( now<=1e18 ){
			now*=2;
		}
	}
	printf("%lld\n",fail?-1ll:ans);
	return 0;
}


Measured memory_bytes: 3168
n, m = gets.chomp.split(" ").map(&:to_i)
d = Array.new(n+1,0).map{Array.new(n+1,0)}
m.times do
    a, b = gets.chomp.split(" ").map(&:to_i)
    d[a][b] = 1
    d[b][a] = 1
end

def dfs(d, i, visited)
    visited[i] = true
    return true if visited.size-1 == visited.count {|v| v == true}

    for j in 1..visited.size do
        if d[i][j] == 1 && visited[j] == false
            return true if dfs(d, j, visited)
        end
    end
    return false
end

def check(d)
    visited = Array.new(d.size, false)

    visited[1] = true
    for i in 1..d.size do
        if d[1][i] == 1
            return true if dfs(d, i, visited)
        end
    end
    return false
end

count = 0
for i in 1..n
    for j in (i+1)..n
        if d[i][j] == 1
            d[i][j] = 0
            d[j][i] = 0
            if !check(d)
                count += 1
            end
            d[i][j] = 1
            d[j][i] = 1
        end
    end
end

puts count
            


Measured memory_bytes: 1916
#include <iostream>

using namespace std;

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


int main(void){
  int N;
  cin >> N;

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

  int ans[N+2];
  for(int i = 0 ; i < N + 2 ; i++){
    ans[i] = 1;
  }

  for(int i = 0 ; i < N ; i++){
    for(int j = a[i] ; j <= b[i] && j < N + 2 ; j++){
      if(ans[j] < j){
        ans[j]++;
      }else{}
    }
  }

  int max = -1;
  for(int i = 0 ; i < N + 2 ; i++){
    if(max < ans[i] && i <= ans[i]){
      max = ans[i];
    }
  }

  cout << mymax(max - 1,0) << endl;

}

Measured memory_bytes: 4244