akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <stdlib.h>

int comp(const void *a, const void *b){
    return *(long int *)b - *(long int *)a;
}

int main(void){
    long int N;
    long int A[100000];
    int i, j;
    int flag;
    long int a, b;
    a = 0;
    b = 0;

    scanf("%ld", &N);
    for (i = 0; i < N; i++){
        scanf("%ld", &A[i]);
    }

    qsort(A, N, sizeof(long int), comp);

    flag = 0;

    for (i = 0; i < N; i++){
        if (A[i] == A[i + 1] && flag == 0){
            a = A[i];
            i++;
            flag = 1;
        }else if (A[i] == A[i + 1] && flag == 1){
            b = A[i];
            break;
        }
    }

    printf("%ld\n", a * b);
    
    return 0;
}


Measured memory_bytes: 1788
/*created by tanishk gupta*/
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define repl(i,a,n) for(long long int i=a;i<n;i++)
#define pb push_back
#define mp make_pair
#define all(x) x.begin(),x.end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef vector<int> VI;
typedef long long int ll;
typedef unsigned long long ull;
//typedef pair<int,int> PII;
typedef double db;
mt19937 mrand(random_device{}());
const ll MOD=1e9+7;
const ll mod=1e9+7;
//const llint MOD;
const ll N=(ll)(1e6+1);
int rnd(int x) { return mrand() % x;}
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
ll add(ll a,ll b){return ((a%MOD)+(b%MOD))%MOD;}
ll mul(ll a,ll b){return ((a%MOD)*(b%MOD))%MOD;}
ll sub(ll a,ll b){return ((a%MOD)-(b%MOD)+MOD)%MOD;}
ll binpow(ll x, ll y){ll z = 1;while(y){if(y & 1) z = mul(z, x);x = mul(x, x);y >>= 1;}return z;}
ll inv(int x){return binpow(x, MOD - 2);}
ll divide(ll x, ll y){return mul(x, inv(y));}
ll fact[N];
void precalc(){fact[0] = 1;for(ll i = 1; i < N; i++)fact[i] = mul(fact[i - 1], i);}
ll C(ll n, ll k){return divide(fact[n], mul(fact[k], fact[n - k]));}
//bool prime[N];
//void sieve() {for(int i=2;i<N;i++) {prime[i]=true;}for (int p=2; p*p<=N; p++){if (prime[p] == true){for (int i=p*p; i<=N; i += p)prime[i] = false;}}}
ll legendpow(ll n, ll p){ll total = 0;while (n){n /= p;total += n;}return total;}

//head==================================================================================
/*I adj[200005];
int vis[200005];
int tot=0;
void dfs(int node)
{
    tot++;
    vis[node]=1;
    for (auto x : adj[node])
    {
        if (vis[x]==0)
        {
            dfs(x);
        }
    }
}*/

int main() {
//#ifdef _DEBUG
	//freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);
//#endif
IOS;

int min1=100000;
string s,t;
cin>>s>>t;
int n=s.size();
int need=t.size();
rep(i,0,n-need+1)
{int c=0;
int fin=0;
    rep(j,i,i+need)
    {
        if (s[j]!=t[c])
        {
          fin++;
        }
        c++;
        //min1=min(fin,min1);
    }
    min1=min(fin,min1);
}
cout<<min1;
}


Measured memory_bytes: 3616
from string import ascii_lowercase


def main():
    word = input()
    target_list = list(ascii_lowercase)
    answer = float("inf")
    for target in target_list:
        now_ans = 0
        now_word = word
        while len(set(now_word)) > 1:
            tmp = ""
            for i in range(len(now_word) - 1):
                if now_word[i] == target or now_word[i + 1] == target:
                    tmp += target
                else:
                    tmp += now_word[i]
            now_word = tmp
            now_ans += 1
        answer = min(answer, now_ans)
    print(answer)


if __name__ == '__main__':
    main()



Measured memory_bytes: 3768
a = input()
cnt = 0
ans = 0
for i in a:
	if i == 'A' or i == 'T' or i == 'G' or i == 'C':
		cnt +=1
	else:
		ans = max(ans , cnt)
		cnt =0
	
ans = max(ans , cnt)
print(ans)

Measured memory_bytes: 3060
// https://atcoder.jp/contests/abc067/tasks/arc078_b

#include <bits/stdc++.h>

using namespace std;

#define REP(i,n)   for(int i=0; i<(int)(n); i++)
#define FOR(i,b,e) for(int i=(b); i<=(int)(e); i++)
#define DUMP(a, n) REP(_i, n) printf("%d%c", a[_i], _i + 1 == n ? '\n' : ' ')
#define DUMP2D(a, n, m) REP(_i, n) REP(_j, m) printf("%d%c", a[_i][_j], _j + 1 == m ? '\n' : ' '); puts("")

//------------------------------------------------------------------------------
const int V_MAX = 1e5;

vector<int> G[V_MAX];
vector<int> path;

int color[V_MAX];
int vf = 0;
int vs = 0;

void add_edge(int u, int v) {
  G[u].push_back(v);
  G[v].push_back(u);
}

bool dfs(int p, int v, int dest) {
  if (v == dest) {
    path.push_back(v);
    return true;
  }
  for (int u : G[v]) {
    if (u == p) continue;
    if (dfs(v, u, dest)) {
      path.push_back(v);
      return true;
    }
  }
  return false;
}

void dfs2(int p, int v, int c) {
  if (color[v] * c < 0) return;
  color[v] = c;
  if (c > 0) vf++;
  else vs++;
  for (int u : G[v]) {
    if (u == p) continue;
    dfs2(v, u, c);
  }
}

//------------------------------------------------------------------------------
const int N_MAX = 1e5;

int N;
// int a[N_MAX-1];
// int b[N_MAX-1];

void solve() {
  dfs(-1, N - 1, 0);
  // DUMP(path, path.size());
  bool sen = true;
  int s = 0;
  int t = path.size() - 1;
  while (s <= t) {
    if (sen) {
      color[path[s++]] = 1;
    } else {
      color[path[t--]] = -1;
    }
    sen = !sen;
  }
  dfs2(-1, 0, 1);
  dfs2(-1, N - 1, -1);
  // DUMP(color, N);
  puts(vf > vs ? "Fennec" : "Snuke");
}

void input() {
  scanf("%d", &N);
  REP(i, N-1) {
    int a, b;
    scanf("%d%d", &a, &b);
    add_edge(a - 1, b - 1);
  }
}

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


Measured memory_bytes: 12920
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections;
using static System.Console;
namespace AtCoder.ABC064
{
    class Insertion
    {
        public static void Main()
        {
            var n = int.Parse(ReadLine().Trim());
            var s = ReadLine().Trim();
            var start = 0;
            var count = 0;
            foreach(var ch in s) {
                if (ch == '(') ++count;
                else {
                    if (count == 0) ++start;
                    else --count;
                }
            }
            count = 0;
            var end = 0;
            foreach(var ch in s.Reverse()) {
                if (ch == ')') ++count;
                else {
                    if (count == 0) ++end;
                    else --count;
                }
            }
            WriteLine(new string('(', start) + s + new string(')', end));
        }
    }
}


Measured memory_bytes: 13268
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <stdio.h>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#define rep(i,a,n) for(ll i =(a);i<(n);++i)
#define urep(i,a,n) for(ll i = (a);i>=(n);--i)
#define all(x) (x).begin(),(x).end()
#define INF 1e18
const int mod = 1e9 + 7;
typedef long long ll;
using namespace std;
ll dx[4] = { 1,-1,0,0 };
ll dy[4] = { 0,0,1,-1 };
ll N,M,X,Y,A,B,C,Q,K,R,W,H,P,L;
string S,T;
ll ans;
ll x[101010];
ll y[101010];
ll a[101010];
ll b[101010];
ll c[101010];
ll t[101010];
ll p[101010];
ll n[101010];
ll l[101010];
ll gcd(ll a, ll b) {
	if (b == 0)return a;
	else return gcd(b, a%b);
}
struct Edge{
	ll to,cost;
	 Edge(ll to, ll cost) : to(to), cost(cost) {}
};
typedef vector<vector<Edge> > AdjList;
AdjList graph;
vector<ll> dist;

struct UnionFind {
    vector<ll> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2
	vector<ll> size;
    UnionFind(ll N) : par(N),size(N) { //最初は全てが根であるとして初期化
        for(ll i = 0; i < N; i++) par[i] = i;
		for(ll i = 0; i < N; i++) size[i] = 1;
    }

    ll root(ll x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }
	ll GetSize(ll x){
		return size[root(x)];
	}

    void unite(ll x, ll y) { // xとyの木を併合
        ll rx = root(x); //xの根をrx
        ll ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
		size[ry]+=size[rx];

    }

    bool same(ll x, ll y) { // 2つのデータx, yが属する木が同じならtrueを返す
        ll rx = root(x);
        ll ry = root(y);
        return rx == ry;
    }
};

map<char,ll> mp;

ll dfs(ll num, ll tmp,ll pos){
    //cerr<<num<<" "<<tmp<<" "<<pos<<endl;
    if(pos>=26){
        return 0;
    }
    tmp*=mp['a'+pos];
    tmp%=mod;
    num+=tmp;
    num%=mod;
    rep(i,pos+1,26){
        num=(dfs(num,tmp,i))%mod;
    }
    return num;
}
int main() {
    cin>>N;
    cin>>S;
    ll count=0;
    
    ans=0;
    rep(i,0,N){
        mp[S[i]]++;
    }
    rep(i,0,26){
        ans+=dfs(0,1,i);
        ans%=mod;
    }
    cout<<ans<<endl;
	return 0;
}


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

int main() {
    int n, x;
    cin >> n;
    multiset < int > X;
    
    for (int i = 0; i < n; i++) {
        scanf("%d", &x);
        
        auto it = X.lower_bound(x);
        
        if (it == X.begin()) X.insert(x);
        else {
            it--;
            X.erase(it);
            X.insert(x);
        }
    }
    
    printf("%d\n", (int)X.size());
    return 0;
}

Measured memory_bytes: 4992
/*   --------------------
    |       LOSER        |
    |     ~NOOBOSS~      |
     --------------------
*/
#include <bits/stdc++.h>
using namespace std;
#define      mxx                 LLONG_MAX
#define      mnn                 LLONG_MIN
#define      Y()                 cout<< "YES" <<endl
#define      N()                 cout << "NO"<<endl
#define      endl                "\n"
#define      max_3(a,b,c)        max(a, max(b,c))
#define      min_3(a,b,c)        min(a, min(b,c))
#define      gcd(a,b)            __gcd(a,b)
#define      lcm(a,b)           (a*b)/gcd(a,b)
#define      loser               return 0
#define      ll                  long long
#define      PI                  acos(-1)
#define      mem(a,v)            memset(a,v,sizeof(a))
#define      SORT(v)             sort(v.begin(),v.end())
#define      REV(v)              reverse(v.begin(),v.end())
#define      B                   begin()
#define      E                   end()
#define      V                   vector
#define      F                   first
#define      S                   second
#define      PSB                 push_back
#define      MP                  make_pair
#define      flash               cout.flush()
#define      InTheNameOfGod      ios::sync_with_stdio(0);cin.tie(0); cout.tie(0);
constexpr ll MOD = 998244353;
constexpr ll mod = 1e9  + 7;
int dx[] = {0,0,1,-1};
int dy[] = {1,-1,0,0};
/*-----*/
#define bug1(a)  cerr<<a<<endl;
#define bug2(a,b)  cerr<<a<<" "<<b<<endl;
#define bug3(a,b,c)  cerr<<a<<" "<<b<<" "<<c<<endl;
/*----*/
const ll N=2e5+5;
vector<ll> adj[N];
ll power(ll n,ll p){if(p==0) return 1;if(p==1)return n;if(p%2)return power(n,p-1)*n;else{ll x=power(n,p/2);return x*x;}}
ll modpow(ll a,ll b,ll m){ll ans=1;while(b){if(b&1)ans=(ans*a)%m;b/=2;a=(a*a)%m;}return ans;}
ll nsum(ll num){return (num*(num+1))/2;}
void edge (ll u,ll v) {adj[u].PSB(v) ;adj[v].PSB(u);}
/*------------------START---------------------*/


/*-----*/
void solve(){
   ll n;
   string s;
   cin>>n;
   ll ans=(modpow(10LL,n,mod)-modpow(9LL,n,mod)-modpow(9LL,n,mod)+modpow(8LL,n,mod))%mod;
   cout<<(ans+mod)%mod<<endl;



}
/*-----*/
int main(){
   InTheNameOfGod

   ll Test=1;
   //cin>>Test;
   while(Test--){
     solve();
    }
  loser;
}
///////   C O D I N G  I S  L I F E   ///////


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

int main(){
	string p;
	string s;
	
	cin>>p;
	cin>>s;
	
	p += p;
	
	string::size_type hantei = p.find(s);
	
	if(hantei != string::npos)
		cout<<"Yes"<<endl;
	else
		cout<<"No"<<endl;
	
	return 0;
}

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

int main()
{
    int num1,num2;
    scanf("%d%d",&num1,&num2);
    if(num1>0)
        printf("Positive\n");
    else if(num1<=0&&num2>=0)
        printf("Zero\n");
    else
    {
        if((-num1+num2)%2==0)
            printf("Negative\n");
        else
            printf("Positive\n");
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>

using namespace std;

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

    int count = 0;
    vector<char> vec;

    for (int i = 1; i < 4; i++)
    {
        if (S.at(0) == S.at(i))
        {
            count++;
        }
        else
        {
            vec.push_back(S.at(i));
        }
    }

    if (count == 1)
    {
        if (vec.size() == 2)
        {
            if (vec.at(0) == vec.at(1))
            {
                cout << "Yes" << endl;
            }
            else
            {
                cout << "No" << endl;
            }
            
        }
        else
        {
            cout << "No" << endl;
        }
    }
    else
    {
        cout << "No" << endl;
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <queue>
using namespace std;
int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
  int n, q;
  cin >> n >> q;
  queue<pair<string, int> > queue;
  for(int i=0;i < n;i++){
    string name; int time;
    cin >> name >> time;
    queue.push(make_pair<string, int>(name,time));
  }
  int now = 0;
  while(!queue.empty()){
    pair<string, int> que = queue.front(); queue.pop();
    if(que.second <= q){
      now += que.second;
      cout << que.first << " " << now << endl;
    }else{
      que.second -= q;
      queue.push(que);
      now += q;

    }
  }
	return 0;
}

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

int main()
{
  int i, j, sum = 0;
  char st[1000];

  for( ; ; )
  {
    scanf("%s", st);
    if( st[0] == '0' )
      break;
    for( j = 0 ; j < strlen(st) ; j++ )
    {
      sum += st[j] - '0';
    }
    printf("%d\n", sum);
    sum = 0;
  }
}



Measured memory_bytes: 2124
#include <iostream>
#include <vector>
#include <string.h>
#include <stack>
#include <queue>
#include <algorithm>
#include <climits>
#include <cmath>
#include <map>
#include <set>
#include <assert.h>
#include <stdio.h>
#define REP(i,n) for(ll i=0;i<(n);i++)
#define MOD 1000000007
#define int long long
#ifdef int
const long long INF = LLONG_MAX / 10;
#else
const int INF = 1010101010;
#endif
using namespace std;
typedef long long ll;
typedef vector<vector<ll> > mat;
typedef pair<int, int> P;
//typedef pair<double, double> P;
const int dx[9] = {-1, 0, 0, 1, -1, -1, 1, 1, 0};
const int dy[9] = {0, -1, 1, 0, -1, 1, -1, 1, 0};
 
int N;
int A[101010], B[101010];
 
signed main() {
  cin >> N;
  REP(i,N) cin >> A[i] >> B[i];

  int ans = 0;
  int sum = 0;
  for (int i=N-1; 0<=i; i--) {
    A[i] += sum;
    int cnt;
    if (A[i] % B[i] == 0) {
      cnt = 0;
    } else {
      cnt = B[i] - (A[i] % B[i]);
    }
    ans += cnt;
    sum += cnt;
  }

  cout << ans << endl;
}

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

// Begin {{{
using namespace std;
#define all(x) x.begin(), x.end()
#define rep(i, n) for (i64 i = 0, i##_limit = (n); i < i##_limit; ++i)
#define reps(i, b, e) for (i64 i = (b), i##_limit = (e); i <= i##_limit; ++i)
#define repr(i, b, e) for (i64 i = (b), i##_limit = (e); i >= i##_limit; --i)
#define var(Type, ...) Type __VA_ARGS__; input(__VA_ARGS__)
using i64 = int_fast64_t;
using pii = pair<i64, i64>;
template <class T> using MaxHeap = priority_queue<T>;
template <class T> using MinHeap = priority_queue<T, vector<T>, greater<>>;
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }
inline i64 sigma(i64 n) { return n * (1 + n) >> 1; }
inline i64 updiv(i64 n, i64 d) { return (n + d - 1) / d; }
constexpr int INF = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int MOD = int(1e9) + 7;
#ifndef DEBUG
#define dump(...)
#endif

inline void input() {}
template <class Head, class... Tail>
inline void input(Head&& head, Tail&&... tail) {
    cin >> head;
    input(forward<Tail>(tail)...);
}

inline void outs() { cout << "\n"; }
template <class Head, class... Tail>
inline void outs(Head&& head, Tail&&... tail) {
    cout << head << (sizeof...(tail) ? " " : "");
    outs(forward<Tail>(tail)...);
}

template <class T>
inline void outs(vector<T> &vec) { for (auto &e : vec) cout << e << " \n"[&e == &vec.back()]; }

template <class T>
inline void outs(vector<vector<T>> &df) { for (auto &vec : df) outs(vec); }

inline void outl() { cout << "\n"; }
template <class Head, class... Tail>
inline void outl(Head&& head, Tail&&... tail) {
    cout << head << (sizeof...(tail) ? "\n" : "");
    outl(forward<Tail>(tail)...);
}

template <class T>
inline void outl(vector<T> &vec) { for (auto &e : vec) cout << e << "\n"; }

inline void outn() {}
template <class Head, class... Tail>
inline void outn(Head&& head, Tail&&... tail) {
    cout << head;
    outn(forward<Tail>(tail)...);
}

template <class T>
inline void outn(vector<T> &vec) { for (auto &e : vec) cout << e; }

template <class T>
inline vector<T> make_v(const T &initvalue, size_t sz) {
    return vector<T>(sz, initvalue);
}

template <class T, class... Args>
inline auto make_v(const T &initvalue, size_t sz, Args... args) {
    return vector<decltype(make_v<T>(initvalue, args...))>(sz, make_v<T>(initvalue, args...));
}
// }}} End

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    var(size_t, H, W, N);
    auto mat = make_v(0, H, W);
    vector<int> a(N + 1);
    reps(i, 1, N) {
        input(a[i]);
    }
    int now = 1;
    rep(i, H) {
        if (!(i % 2)) {
            rep(j, W) {
                mat[i][j] = now;
                a[now]--;
                if (!a[now]) now++;
            }
        } else {
            repr(j, W - 1, 0) {
                mat[i][j] = now;
                a[now]--;
                if (!a[now]) now++;
            }
        }
    }
    outs(mat);
    return 0;
}


Measured memory_bytes: 384
/*
 _     _                             
| |__ | |__   __ _  __ _ _   _  __ _ 
| '_ \| '_ \ / _` |/ _` | | | |/ _` |
| |_) | | | | (_| | (_| | |_| | (_| |
|_.__/|_| |_|\__,_|\__, |\__, |\__,_|
                   |___/ |___/       
*/
#include<bits/stdc++.h>

#define ll          long long
#define pb          push_back
#define ppb         pop_back
#define BigInt      __int128
#define endl        '\n'
#define mii         map<ll int,ll int>
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define sim         template < class c
#define ris         return * this
#define dor         > debug & operator <<
#define eni(x)      sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {

using namespace std;

sim > struct rge {c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug 
{
	~debug() 
	{ 
		cerr<<endl; 
	}
	eni(!=) cerr << boolalpha << i; ris; }
	eni(==) ris << range(begin(i), end(i)); }
	sim, class b dor(pair < b, c > d) 
	{
		ris << "(" << d.first << ", " << d.second << ")";
	}
	sim dor(rge<c> d) 
	{
	  	*this << "[";
	  	for (auto it = d.b; it != d.e; ++it)
	    	*this << ", " + 2 * (it == d.b) << *it;
	  	ris << "]";
	}
};
#define fuck(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

#define N  100005

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int TESTS=1;
	// cin>>TESTS;
	while(TESTS--)
	{
		ll int a,v;
		cin>>a>>v;
		ll int b,w;
		cin>>b>>w;
		ll int t;
		cin>>t;
		if(a==b)
		{
			cout<<"YES"<<endl;
			return 0;
		}
		ll int d=abs(a-b);
		ll int s=v-w;
		ll int dd=s*t;
		if(dd>=d) cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}
	return 0;
}

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

vector<bool> sieve_of_eratosthenes(int size) {
	vector<bool> res(size + 1, 1);
	res[0] = res[1] = false;
	for (int i = 2; i * i <= size; i++) if (res[i]) {
		for (int j = i * 2; j <= size; j += i) res[j] = false;
	}
	return res;
}

int main()
{
	const int MAX = 55555;
	auto isp = sieve_of_eratosthenes(55555);
	int N;
	cin >> N;
	for (int i = 3; i < MAX && N; i += 10) {
		if (isp[i]) {
			cout << i << " \n"[N == 1];
			N--;
		}
	}
	return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <vector>
using namespace std;
typedef long long LL;
const int maxn=200001;

vector<int> path[maxn];
int n;
vector<int> circle;
int p[maxn];
bool vis[maxn],inc[maxn];
int a[maxn];
vector<int> g[maxn];
int cap[maxn][2];

void calc(int p)
{
	g[p].clear();
	for(int i=0;i<path[p].size();i++)
	{
		if (!inc[path[p][i]])
		{
			calc(path[p][i]);
			g[p].push_back(a[path[p][i]]);
		}
	}
	
	sort(g[p].begin(),g[p].end());
	if (g[p].size()==0)
	{
		a[p]=0;
		return;
	}
	if (g[p][0]!=0)
	{
		a[p]=0;
		return;
	}
	
	for(int i=0;i<g[p].size()-1;i++)
	{
		if (g[p][i+1]>g[p][i]+1)
		{
			a[p]=g[p][i]+1;
			return;
		}
	}
	a[p]=g[p][g[p].size()-1]+1;
	return;
}

int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++) 
	{
		scanf("%lld",&p[i]);
		path[p[i]].push_back(i);
	}
	
	int pos=1;
	while(!vis[pos])
	{
		vis[pos]=true;
		pos=p[pos];
	}
	circle.push_back(pos);
	inc[pos]=true;
	
	int st=pos;
	pos=p[pos];
	while(pos!=st)
	{
		circle.push_back(pos);
		inc[pos]=true;
		pos=p[pos];
	}
	
	for(int i=0;i<circle.size();i++)
	{
		int now=circle[i];
		calc(now);
		cap[now][0]=a[now];
		g[now].push_back(a[now]);
		sort(g[now].begin(),g[now].end());
		
		bool f=false;
		for(int i=0;i<g[now].size()-1;i++)
		{
			if (g[now][i+1]>g[now][i]+1)
			{
				cap[now][1]=g[now][i]+1;
				f=true;break;
			}
		}
		if (!f) cap[now][1]=g[now][g[now].size()-1]+1;
	}
	
	a[circle[0]]=cap[circle[0]][0];
	for(int i=1;i<circle.size();i++)
	{
		if (a[circle[i-1]]==cap[circle[i]][0])
			a[circle[i]]=cap[circle[i]][1];
		else a[circle[i]]=cap[circle[i]][0];
	}
	
	if (a[circle[circle.size()-1]]!=a[circle[0]])
	{
		printf("POSSIBLE\n");
		return 0;
	}
	
	a[circle[0]]=cap[circle[0]][1];
	for(int i=1;i<circle.size();i++)
	{
		if (a[circle[i-1]]==cap[circle[i]][0])
			a[circle[i]]=cap[circle[i]][1];
		else a[circle[i]]=cap[circle[i]][0];
	}
	
	if (a[circle[circle.size()-1]]==cap[circle[0]][0])
	{
		printf("POSSIBLE\n");
		return 0;
	}
	else printf("IMPOSSIBLE\n");
	
	return 0;
}

Measured memory_bytes: 24308
#include<iostream>
#include <bits/stdc++.h>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <map>

using namespace std;

int min(int a,int b){
    return (a<b) ? a : b ;
}

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


int main() {

    string s,t ;
    cin >> s >> t ;

    sort(s.begin(),s.end()) ;
    //cout << s << endl ;    

    sort(t.begin(),t.end(),greater<char>()) ;
    //cout << t << endl ;    
    
    cout << (s<t ? "Yes" : "No") ;

 return 0 ;
}  


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
    #ifdef DEBUG
    std::ifstream in("/home/share/inputf.in");
    std::cin.rdbuf(in.rdbuf());
    #endif
    int X, A;
    cin >> X >> A;
    cout << (X < A ? 0 : 10) << endl;
    return 0;
}

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

typedef long long ll;
int main()
{
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    unsigned long long res=2,n;
    cin>>n;
    for(ll i=0;i<n;i++)
        res=res*2+2;
    cout<<res;
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <iomanip>
#include <stack>
using namespace std;
int n,k;
int num[200006];
bool cmp(int a,int b){
	return a>b;
}
int main(){
	cin>>n>>k;
	for (int i=1;i<=n;++i){
		int a;
		scanf("%d",&a);
		num[a]++;
	}
	sort(num,num+200006,cmp);
	int ans=0;
	for (int i=k;i<n;++i){
		ans+=num[i];
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 1024
# ABC076C
S = input()
T = input()
check = -1
for i in range(len(S) - len(T) + 1):
    if S[i] == "?" or S[i] == T[0]:
        k = 1
        flag = True
        while k < len(T):
            if S[i+k] == "?":
                k += 1
            else:
                if S[i + k] == T[k]:
                    k += 1
                else:
                    flag = False
                    break
        if k == len(T) and flag == True:
            check = i

if check != -1:
    S = list(S)
    for i in range(len(T)):
        S[check + i] = T[i]
    S = "".join(S)
    ans = S.replace("?", "a")
    print(ans)
else:
    print("UNRESTORABLE")

Measured memory_bytes: 3064
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);

        String day = s.next();
        int answer = 0;

        switch (day) {
        case "MON":
            answer = 6;
            break;
        case "TUE":
            answer = 5;
            break;
        case "WED":
            answer = 4;
            break;
        case "THU":
            answer = 3;
            break;
        case "FRI":
            answer = 2;
            break;
        case "SAT":
            answer = 1;
            break;
        case "SUN":
            answer = 7;
            break;
        }

        System.out.println(answer);
    }
}


Measured memory_bytes: 21716
import java.io.IOException;
import java.util.*;

public class Main {

    public static void main(String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int x[] = new int[n];
        int buf[] = new int[n];
        for (int ct = 0; ct < x.length; ct++) {
            x[ct] = sc.nextInt();
            buf[ct] = x[ct];
        }
        
        Arrays.sort(buf);

        if (buf[n / 2-1] < buf[n / 2]) {
            for (int oki : x) {
                if (oki <= buf[n / 2-1]) {
                    System.out.println(buf[n / 2 ]);
                } else {
                    System.out.println(buf[n / 2-1]);
                }
            }
        } else {
            for (int ct = 0; ct < x.length; ct++) {
                System.out.println(buf[n / 2-1]);
            }
            System.exit(0);
        }
    }
}


Measured memory_bytes: 90940
a,b,c,x,y  = map(int,input().split())
if a+b > c*2:
    mmm = min(x,y)
    aaa = max(x,y)
    if (x > y and a<=2*c):
        print(c*2*mmm + a*(aaa-mmm))
    elif (x > y and a>2*c):
        print(c*2*aaa)
    elif (x <= y and b<=2*c):
        print(c*2*mmm + b*(aaa-mmm))
    elif (x <= y and b>2*c):
        print(c*2*aaa)
else:
    print(a*x + b*y)
    

Measured memory_bytes: 3064
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Threading;

using Pair = System.Collections.Generic.KeyValuePair<int, int>;

class Program
{
	public Program() { }

	static void Main(string[] args)
	{
		new Program().prog();
	}
	Scanner cin;
	const int MOD = 1000000007;
	const int INF = int.MaxValue - 10;
	const long INFL = long.MaxValue - 10;
	const double EPS = 1e-7;
	const double PI = 3.1415926536;

	int N,M;
	int[] X;
	int[] num, pair;

	void prog()
	{
		cin = new Scanner();
		int[,] dir8 = new int[8, 2] { { -1, -1 }, { -1, 0 }, { -1, 1 }, { 0, -1 }, { 0, 1 }, { 1, -1 }, { 1, 0 }, { 1, 1 } };
		int[,] dir4 = new int[4, 2] { { -1, 0 }, { 0, -1 }, { 0, 1 }, { 1, 0 } };

		N = cin.nextInt();	// 10^5
		M = cin.nextInt();  // 10^5
		num = new int[M];
		pair = new int[M];

		X = new int[N];
		for (int i = 0; i < N; i++)
		{
			X[i] = cin.nextInt();   // 10^5
			num[X[i] % M]++;
		}
		// ペア後回し
		Array.Sort(X);
		for (int i = 0; i < N - 1; i++)
		{
			if (X[i] == X[i + 1])
			{
				pair[X[i] % M]++;
				i++;
			}
		}
		long ans = 0;
		for (int i = 1; i < (M + 1) / 2; i++)
		{
			if (num[i] <= num[M - i])
			{
				int min = num[i];
				//pair[i] = 0;
				pair[M - i] -= (Math.Max(min - (num[M - i] - pair[M - i] * 2), 0) + 1) / 2;
				ans += min;
				ans += pair[M - i];
			}
			else
			{
				int min = num[M - i];
				pair[i] -= (Math.Max(min - (num[i] - pair[i] * 2), 0) + 1) / 2;
				//pair[M - i] = 0;
				ans += min;
				ans += pair[i];
			}
		}
		ans += num[0] / 2;
		if (M % 2 == 0)
		{
			ans += num[M / 2] / 2;
		}
		Console.WriteLine(ans);
	}
}

class Scanner
{
	string[] s;
	int i;

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

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

	public string next()
	{
		if (i < s.Length) return s[i++];
		string st = Console.ReadLine();
		while (st == "") st = Console.ReadLine();
		s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
		i = 0;
		return next();
	}

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

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

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

Measured memory_bytes: 10584
// -----------------------------------
// author   : MatsuTaku
// country  : Japan
// created  : 06/14/20 20:53:44
// -----------------------------------

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

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

  int x,n; cin>>x>>n;
  vector<int> P(n); for (auto& p:P) cin>>p;
  set<int> c;
  for (int i = -101; i <= 101; i++)
    c.insert(i);
  for (auto p:P)
    c.erase(p);
  int min_diff = 1000;
  int ans = 0;
  for (auto v:c) {
    if (abs(v-x) < min_diff) {
      min_diff = abs(v-x);
      ans = v;
    }
  }
  cout << ans << endl;

  return 0;
}


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

int main() {
  int  n; cin>>n;
  vector<ll> v(n);
  rep(i,n){
    cin>>v[i];
  }
  sort(v.begin(),v.end() );
  rep(i,n-1){
    v[i+1]+= v[i];
  }
  int  c=1;
  rep(i,n-1){
    if(v[n-1-i]<=3*v[n-2-i]){c++;}
    else{break;}
  }
  cout<<c<<endl;
}

Measured memory_bytes: 3972
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
#define MAX 2000000
#define INFTY (1<<30)

int H, A[MAX+1];

void maxHeapify(int i) {
  int l, r, largest;
  l = 2 * i;
  r = 2 * i + 1;

  if ( l <= H && A[l] > A[i] ) largest = l;
  else largest = i;
  if ( r <= H && A[r] > A[largest] ) largest = r;

  if ( largest != i ) {
    swap(A[i], A[largest]);
    maxHeapify(largest);
  }
}

int extract() {
  int maxv;
  if ( H < 1 ) return -INFTY;
  maxv = A[1];
  A[1] = A[H--];
  maxHeapify(1);
  return maxv;
}

void increaseKey(int i, int key) {
  if ( key < A[i] ) return;
  A[i] = key;
  while ( i > 1 && A[i / 2] < A[i] ) {
    swap(A[i], A[i / 2]);
    i = i / 2;
  }
}

void insert(int key) {
  H++;
  A[H] = -INFTY;
  increaseKey(H, key);
}

int main() {
  int key;
  char com[10];

  while ( 1 ) {
    scanf("%s", com);
    if ( com[0] == 'e' && com[1] == 'n' ) break;
    if ( com[0] == 'i') {
      scanf("%d", &key);
      insert(key);
    } else {
      printf("%d\n", extract());
    }
  }

  return 0;
}



Measured memory_bytes: 6612
let id x = x

let mk_ls n =
  let rec f n' ls =
    if n' <= 0 then List.sort_uniq compare ls
    else
      f (pred n') (Scanf.scanf "%d " id :: ls)
  in
  f n []

let solve ls =
  let rec aux ans = function
    | [] | [_] -> ans
    | h :: (h' :: _ as t) ->
      aux (ans + h' - h) t
  in
  aux 0 ls

let () =
  mk_ls (Scanf.scanf "%d\n" id) |> solve |> Printf.printf "%d\n"


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "debug.h"
#else
#define dump(...)
#endif
#define endl '\n'
//#define int long long
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define REP(i, x) for (int i = 0; i < (int)(x); i++)
#define REPS(i, x) for (int i = 1; i <= (int)(x); i++)
#define RREP(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define RREPS(i, x) for (int i = ((int)(x)); i > 0; i--)
#define INF 2147483647
#define LLINF 9223372036854775807LL
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define BIT(n) (1LL << (n))
#define TOUPPER(s) transform(s.begin(), s.end(), s.begin(), ::toupper)
#define TOLOWER(s) transform(s.begin(), s.end(), s.begin(), ::tolower)
#define FILLZERO(s, n)                      \
    do {                                    \
        ostringstream os;                   \
        os << setw(n) << setfill('0') << s; \
        s = os.str();                       \
    } while (0);
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end()) //sortしてからつかうこと
#define INIT                               \
    std::cin.tie(nullptr);                 \
    std::ios_base::sync_with_stdio(false); \
    cout << std::fixed << std::setprecision(10);

using ll = long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using pi = pair<int, int>;
template <typename T>
using Pq = priority_queue<T>;
template <typename T>
using pQ = priority_queue<T, vector<T>, greater<T>>;

template <typename T>
vector<T> make_vec(size_t a, T n) { return vector<T>(a, n); }
template <typename T, typename... Ts>
auto make_vec(size_t a, Ts... ts) { return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...)); }
template <class T>
inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
inline bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return 1;
    }
    return 0;
}
template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
    for (T &x : vec)
        is >> x;
    return is;
}

constexpr ll MOD = 1e9 + 7;
int dx[8] = {1, 0, -1, 0, 1, 1, -1, -1};
int dy[8] = {0, 1, 0, -1, 1, -1, 1, -1};
ll A, B, C, D, E, F, G, H, N, M, L, K, P, Q, R, W, X, Y, Z;
string S, T;
ll ans = 0;

int main() {
    INIT;
    cin >> N;
    vi a(N);
    cin >> a;
    vector<map<int, ll[2]>> dp(N + 1);
    REP(i, N + 1) {
        FOR(jj, -10, 10) {
            int j = i / 2 + jj;
            dp[i][j][0] = -1e18;
            dp[i][j][1] = -1e18;
        }
    }
    dp[0][0][0] = 0;
    REP(i, N) {
        FOR(jj, -5, 5) {
            int j = i / 2 + jj;
            chmax(dp[i + 1][j + 1][1], dp[i][j][0] + a[i]);
            chmax(dp[i + 1][j][0], dp[i][j][0]);
            chmax(dp[i + 1][j][0], dp[i][j][1]);
            dump(dp[i + 1][j][1]);
        }
    }
    cout << max(dp[N][N / 2][0], dp[N][N / 2][1]) << endl;
}

Measured memory_bytes: 263468
import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.numeric;
import std.stdio;
import std.string;

void main()
{
    long n = readln.chomp.to!long;
    for (long cake = 0; cake <= 100; ++cake)
    {
        for (long donuts = 0; donuts <= 100; ++donuts)
        {
            if (cake * 4 + donuts * 7 == n)
            {
                writeln("Yes");
                return;
            }
        }
    }
    writeln("No");
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <random>
#include <string>
#include <cmath>
#include <sstream>
#include <istream>
#include <iomanip>
#include <typeinfo>
#include <stack>

using namespace std;
typedef long long ll;
ll N;

int main(){
    int N , Q;
    cin >> N >> Q;
    string b;
    cin >> b;
    vector<string > ss;
    vector<int > l;
    vector<int > r;

    int L, R;
    for(int i = 0; i < Q;i++){
        cin >> L >> R;
        l.push_back(L);
        r.push_back(R);
    }

/*
    for(int i = 0; i < Q;i++){
        string sss;
        sss = b.substr(l[i]-1, r[i]-l[i]+1);
        ss.push_back(sss);  
        //cout << sss << endl;
    }
*/

    vector<int > dp(11451419, 0);
    dp[0] = 0;
    for(int j = 0; j < b.length() - 1;j++){  
        string h = b.substr(j,2);
        if(h == "AC") {
            dp[j + 1] += dp[j] + 1;
        }else{
            dp[j + 1] = dp[j];
        } 
        //cout << dp[j] << " ";
    } 
    //cout << endl;

    
    int f = 0;
    for(int i = 0; i < Q;i++){
        int ans = 0;
        ans = dp[r[i]-1] - dp[l[i]-1];
        //cout << r[i]-1 << " " << l[i]-1 << endl;
        //cout << dp[r[i]-1]  << " " << dp[l[i]-1] << endl;
        //for(int j = l[i] - 1; j < r[i] - 1; j++){
            //cout << b.substr(l[i] - 1 , )
            //ans += dp[j] - ;
        //}

        cout << ans << endl;
    }

} 

Measured memory_bytes: 46708
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
struct UF {
  vector<int> par;
  UF(int N) : par(N) {
    for(int i = 0; i < N; i++) par[i] = i;
  }
  int root(int x) {
    if(par[x] == x) return x;
    return par[x] = root(par[x]);
  }
  void unite(int x, int y) {
    int rx = root(x); int ry = root(y);
    if(rx == ry) return;
    par[rx] = ry;
  }
  bool same(int x, int y) {
    int rx = root(x); int ry = root(y);
    return rx == ry;
  }
};
  
int main() {
  int N, M; cin >> N >> M;
  UF tree(N);
  for(int i = 0; i < M; i++) {
    int x, y; cin >> x >> y;
    x--; y--;
    tree.unite(x, y);
  }
  vector<int> parents(0);
  map<int, int> roots;
  for(int i = 0; i < N; i++) {
    int ri = tree.root(i);
    if(roots.count(ri)) roots.at(ri)++;
    else {
      roots[ri] = 1;
      parents.push_back(ri);
    }
      //cout << ri << " r" << i << endl;
  }
  int cnt = 0;
  for(int i = 0; i < parents.size(); i++) {
    cnt = max(cnt, roots.at(parents.at(i)));
  }
  cout << cnt << endl;
}

Measured memory_bytes: 14008
#include <bits/stdc++.h>
using namespace std;
const int maxn = 511;
int a[maxn * maxn], esp[maxn * maxn];
int main(){
	auto bad = [](){
		cout << "No" << endl;
		exit(0);
	};
	int n; cin >> n;
	for(int i = 1; i <= n; i++){
		int x; cin >> x;
		if(a[x]) bad();
		a[x] = i;
		esp[x] = 1;
	}
	queue<int> q;
	for(int i = 1; i <= n * n; i++){
		if(a[i]){
			for(int j = 1; j < a[i]; j++){
				if(q.empty()) bad();
				int p = q.front(); q.pop();
				a[p] = a[i];
			}
		} else {
			q.push(i);
		}
	}
	while(!q.empty()) q.pop();
	for(int i = n * n; i >= 1; i--){
		if(esp[i]){
			for(int j = 1; j <= n - a[i]; j++){
				if(q.empty()) bad();
				int p = q.front(); q.pop();
				a[p] = a[i];
			}
		} else if(!a[i]){
			q.push(i);
		}
	}
	cout << "Yes" << endl;
	for(int i = 1; i <= n * n; i++) cout << a[i] << " \n"[i == n * n];
	return 0;
}



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

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);  
	long long n, a, b;
	cin >> n >> a >> b;
	if(a > b) cout << 0 << endl;
	else if(n == 1) {
		if(a == b) cout << 1 << endl;
		else cout << 0 << endl;
	} else { 
		cout << 1 + (b - a) * (n - 2) << endl;
	}
	return 0;	
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <stdio.h>
using namespace std;
int main() {
	int n ,d,q;
	int ans;

	cin >> n >> d;
	q = n % (d * 2 + 1);

    if (q == 0)
			ans = n / (d * 2 + 1);
    else
			ans =(n / (d * 2 + 1) + 1) ;

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



Measured memory_bytes: 256
n,k,q = map(int,input().split())
points = [k for i in range(n)]
winner = [int(input()) for i in range(q)]
points = [i-q for i in points]
for i in range(q):
    points[winner[i]-1] += 1
for i in points:
    if i <= 0:
        print('No')
    else:
        print('Yes')

Measured memory_bytes: 11812
#include<stdio.h>

int main() {
	long long n, d, x,a[100];
	scanf("%lld\n", &n);
	scanf("%lld%lld", &d, &x);
	for (int i = 0; i < n; i++) {
		scanf("%lld", &a[i]);
	}
	long long sum = x;
	for (int i = 0; i < n; i++) {
		sum += (d-1)/a[i]+1;
	}
	printf("%d", sum);

	return 0;
}

Measured memory_bytes: 2112
n, k = gets.split.map(&:to_i)
s = gets.chomp
case s[k-1]
when 'A'
  s[k-1] = 'a'
when 'B'
  s[k-1] = 'b'
when 'C'
  s[k-1] = 'c'
end
puts s


Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
typedef long long ll;
 
int main() {
    ll N; cin >> N;
    int x = 1;
    vector<string> S(N);
for (int i = 0; i < N; i++) {
  cin >> S.at(i);
};

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

for (int i = 0; i < N - 1; i++) {
  if(S.at(i) != S.at(i + 1)){
      x = x + 1;
  };
};

cout << x << endl;
}

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

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

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

int main(){
	ll N; cin>>N;
	set<ll> yakusuu;
	for(ll k = 1; k*k <=N; ++k){
		if(N%k == 0){
			yakusuu.insert(k);
			yakusuu.insert(N/k);
		}
	}
	int ans = 0;
	for(auto x: yakusuu){
		map<ll, ll> t = prime_factor(x);
		if(t.size() == 1){
			if(N<x){break;}
			if(N%x != 0){continue;}
			N /= x;
			ans ++;
			// printf("%lld, %lld\n", N, x);
		}

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

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

int main() {
  ll A;
  cin >> A;
  ll B;
  cin >> B;

  if (A <= 9 && B <= 9) {
    cout << A*B << endl;
  } else {
    cout << -1 << endl;
  }
  
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String input;

        while (true) {
            input = sc.next();
            int sum = 0, tmp = 0;

            if (input.equals("0")) break;

            for (int i = 0; i < input.length(); i++) {
                tmp = input.charAt(i) - '0';
                sum += tmp;
            }
            System.out.println(sum);
        }

    }
}


Measured memory_bytes: 26212
#include<cstdio>
#include<algorithm>
#include<functional>
using namespace std;
int main()
{
	int p[65000],m[65000],i,n,x,a;
	long long MAX,b;
	while(1){
		scanf("%d",&n);
		if(n==0){
			break;
		}
		a=0;
		for(i=0;i<n;i++){
			scanf("%d",&p[i]);
			a+=p[i];
		}
		//printf("a=%d\n",a);
		MAX=(long long)a*n;
		//printf("MAX=%d\n",MAX);
		for(i=0;i<n-1;i++){
			scanf("%d",&m[i]);
		}
		sort(m,m+n-1,greater<int>());
		/*for(i=0;i<n-1;i++){
			printf("m=%d\n",m[i]);
		}*/
		x=n;
		for(i=0;i<n-1;i++){
			a+=m[i];
			x--;
			b=(long long)a*x;
			//printf("a=%d b=%d\n",a,b);
			if(MAX<b){
				MAX=b;
			}
		}
		printf("%lld\n",MAX);
	}
	return 0;
}
	


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

// エイリアス
using  ll = long signed long;
using ull = long unsigned long;
using  ld = long double;
using   P = pair<int, int>;
using llP = pair<ll, ll>;
using DoP = pair<double, double>;

// 汎用マクロ
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define FOREACH(i,q) for (auto &i : q)
#define UNIQUE(v) do { sort((v).begin(), (v).end()); (v).erase(unique((v).begin(), (v).end()), (v).end()); } while (false)
#define SZ(x) ((int)(x).size())
template <class T>inline bool chmin(T &a, const T b) {if (a > b) { a = b; return true;} return false;}
template <class T>inline bool chmax(T &a, const T b) {if (a < b) { a = b; return true;} return false;}
template <class T>inline void line_out(const vector<T> vec) {int n = SZ(vec); rep(i, n) { cout << vec[i]; if(i < n-1) cout << " ";}cout << endl;}
const int di[] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dj[] = {1, 0, -1, 0, 1, -1, 1, -1};
const int INF = 1 << 28;
const ll INF64 = 1ll << 62;
const int mod = 1000000007;
//const int mod = 998244353;
struct mint
{
  ll x; // typedef long long ll;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint &operator+=(const mint a)
  {
    if ((x += a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator-=(const mint a)
  {
    if ((x += mod - a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator*=(const mint a)
  {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const
  {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const
  {
    mint res(*this);
    return res -= a;
  }
  mint &operator++()
  {
    if ((x += 1) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator--()
  {
    if ((x += mod - 1) >= mod)
      x -= mod;
    return *this;
  }
  mint operator*(const mint a) const
  {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll t) const
  {
    if (!t)
      return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1)
      a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const
  {
    return pow(mod - 2);
  }
  mint &operator/=(const mint a)
  {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const
  {
    mint res(*this);
    return res /= a;
  }
};

int main()
{
  int h, w, n; cin >> h >> w >> n;
  vector<int> a(n);
  rep(i, n) cin >> a[i];
  vector<vector<int>> ans(h, vector<int>(w));

  int c = 0;
  rep(I, n) {
    rep(x, a[I]) {
      int i = c/w;
      int j = c%w;
      if(i%2==1) j=w-1-j;
      ans[i][j] = I+1;
      ++c;
    }
  }
  rep(i, h) line_out(ans[i]);
}

Measured memory_bytes: 3532
#include <iostream>
#include <cstdlib>
#include <algorithm>

using namespace std;
int main(void){
  int n, m;
  int a[55]={};
  int b[55]={};
  int c[55]={};
  int d[55]={};

  int point=0;
  cin >> n >> m;
  for(int i=0; i<n; i++){
    cin >> a[i] >> b[i];
  }
  for(int i=0; i<m; i++){
    cin >> c[i] >> d[i];
  }
  int j=0;

  for(int i=0; i<n; i++){
    int mina=1000000000;
    for(j=0; j<m; j++){
      if(abs(a[i]-c[j])+abs(b[i]-d[j])<mina){
        mina=abs(a[i]-c[j])+abs(b[i]-d[j]);
        point = j;
      }
    }
    cout << point+1 << endl;
  }
  return 0;
}


Measured memory_bytes: 256
main :: IO ()
main = readLn >>= printRes . solve 
    where
        printRes = putStrLn . unwords . map show 

solve :: Int -> [Int]
solve = flip take xs
    where
        xs = filter (\x -> x `mod` 5 == 1) primes

primes :: [Int]
primes = build [2..]
    where
        build (x : xs) = x : build (filter (\n -> n `mod` x /= 0) xs)

Measured memory_bytes: 1020
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <string>
#include <queue>
#include <map>
#include <algorithm>
#include <cmath>
#include <iostream>
#include <sstream>
#include <set>
using namespace std;

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

  for (int i=0; i<s.size(); i++) {
    if (s[i] == 'a') continue;
    int diff = 'z' + 1 - s[i];
    if (diff <= K) {
      K -= diff;
      s[i] = 'a';
    }
  }
  s[s.size()-1] += K % 26;
  if (s[s.size()-1] > 'z') s[s.size()-1] -= 26;
  cout << s << endl;
}


Measured memory_bytes: 512