akhauriyash/Code-Regression huggingface dataset:
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int P = sc.nextInt();
        int Q = sc.nextInt();
        int R = sc.nextInt();
        sc.close();

        System.out.println(Math.min(Math.min(P + Q, P + R), Q + R));
    }
}


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

#define rep(i, n) for (int i = 0; i < n; ++i)
#define ALL(a) (a).begin(), (a).end()
#define rALL(a) (a).rbegin(), (a).rend()
#define SZ(x) ((int)(x).size())
using ll = long long;
using ull = unsigned long long;
using P = pair<int, int>;
using llP = pair<ll, ll>;
using DoP = pair<double, double>;
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 << 55;
const int mod = 1000000007;
//const int mod = 998244353;

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;
  return;
}

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()
{
  ll n; cin >> n;
  ll ans = 0;
  for(ll i = 1; i <= n; ++i) {
    ll j = n/i;
    ans += i*j*(j+1)/2;
  }
  cout << ans << endl;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i) 
#define PI acos(-1)
#define pcnt __builtin_popcountll
#define rng(a) a.begin(), a.end()
#define rrng(a) a.rbegin(), a.rend()
#define sz(x) (int)(x).size()
#define v(T) vector<T>
#define vv(T) v(v(T))
#define fi first
#define se second

using namespace std;
using ll = long long;
using P = pair<int, int>;
using LP = pair<ll, ll>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;

template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) {if (a > b) { a = b; return true; } return false; }

ll INF = 1001001001;
ll LINF = 1001001001001001001ll;

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

    ll n, m;
    cin>>n>>m;
    vvl to(n);
    rep(i, m) {
        ll v1, v2;
        cin>>v1>>v2; v1--; v2--;

        to[v1].push_back(v2);
        to[v2].push_back(v1);
    }

    queue<LP> q;
    q.emplace(0, 0);
    vvl visited(n, vl(2));
    while (!q.empty()) {
        LP p = q.front(); q.pop();
        ll v = p.fi;
        ll d = p.se;
        if (visited[v][d]) continue;

        visited[v][d] = true;
        for (auto nv : to[v]) {
            q.emplace(nv, (d + 1) % 2);
        }
    }
    ll oc = 0, ec = 0, dc = 0;
    rep(i, n) {
        if (visited[i][0]) ec++;
        if (visited[i][1]) oc++;
        if (visited[i][0] && visited[i][1]) dc++;
    }
    cout<<ec * oc - dc * (dc - 1) / 2 - m - dc<<endl;
}

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

typedef long long ll;

// static const int MAX = 1e6;
// static const int NIL = -1;
// static const ll INF = 1<<21;
// static const ll MOD = 1e9 + 7;

// bool compPair(const pair<int, int>& arg1, const pair<int, int>& arg2) {
//     return arg1.first > arg2.first;
// }

// template<class T> void chmin(T& a, T b) {
//     if (a > b) {
//         a = b;
//     }
// }

// template<class T> void chmax(T& a, T b) {
//     if (a < b) {
//         a = b;
//     }
// }

int main(void) {
    double t, x;
    cin >> t >> x;

    cout << setprecision(10) << t/x << endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void){
  int N;
  scanf("%d", &N);

  int a[N];
  for (int i = 0; i < N; i++) {
    scanf("%d", &a[i]);
  }

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

  printf("%d\n", ans/2);

  return 0;
}

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

int main(){
    string S, ans;
    cin >> S;
    if( S=="Sunny" ){
        ans = "Cloudy";
    }else if( S=="Cloudy"){
        ans = "Rainy";
    }else{
        ans = "Sunny";
    }
    cout << ans << endl;
} 

Measured memory_bytes: 256
#include <iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main() {
	int n,k,x,cnt=0;
	cin>>n>>k;
	vector<int>v;
	for(int i=0;i<n;i++)
	{
	   cin>>x;
	   v.push_back(x);
	}
	sort(v.begin(),v.end());
	for(int i=0;i<v.size()-1;i+=k-1)
    {
        cnt++;
    }
    cout<<cnt<<endl;
	return 0;
}


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

class Myon
{
    public Myon() { }
    public static int Main()
    {
        new Myon().run();
        return 0;
    }

    void run()
    {
        int T = int.Parse(Console.ReadLine());
        for (int test = 0; test < T; test++)
        {
            string[] st = Console.ReadLine().Split(' ');
            long[] x = new long[3];
            long[] y = new long[3];
            for (int i = 0; i < 3; i++)
            {
                x[i] = long.Parse(st[i * 2]);
                y[i] = long.Parse(st[i * 2 + 1]);
            }

            long[] tx = new long[2];
            long[] ty = new long[2];
            tx[0] = long.Parse(st[3 * 2]);
            ty[0] = long.Parse(st[3 * 2 + 1]);
            tx[1] = long.Parse(st[4 * 2]);
            ty[1] = long.Parse(st[4 * 2 + 1]);

            int[] flag = new int[2];
            for (int i = 0; i < 3; i++)
            {
                for (int j = 0; j < 2; j++)
                {
                    long x1 = x[i] - tx[j];
                    long x2 = x[(i + 1) % 3] - tx[j];
                    long y1 = y[i] - ty[j];
                    long y2 = y[(i + 1) % 3] - ty[j];
                    if (x1 * y2 > x2 * y1) flag[j] |= 1 << i;
                }
            }

            long r = 0;
            for (int j = 0; j < 2; j++)
            {
                if (flag[j] % 7 == 0) r++;
            }
            if (r % 2 == 0) Console.WriteLine("NG");
            else Console.WriteLine("OK");
        }
    }
}

Measured memory_bytes: 5552
#include<bits/stdc++.h>
        #define ll long long int
        using namespace std;
        #define mod 1000000007
        #define pb push_back
        #define ff first
        #define ss second
        #define mp make_pair
        #define f(i,p,n) for(ll i=p;i<n;i++)
        ll exp(ll a,ll b,ll m);
        #define vector <ll> vl

        int ans[100005];
        void solve(){

        	char a;
        	cin>>a;

        	cout<<(char)(a+1)<<endl;
        	




        }
 
       int main(){
            
 
            int t=1;
 			//cin>>t;
            while(t--)
               solve();
    
    		return 0;
		}
 
		

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

using namespace std;

const int num6[9] = { 0, 1, 6, 36, 216, 1296, 7776, 46656 };
const int num9[8] = { 0, 1, 9, 81, 729, 6561, 59049 };

int n, ans;

int solve(int x, int y)
{
    int res = 0, sum, cnt;
    while (x)
    {
        res += x % 6;
        x /= 6;
    }
    cnt = res;
    res = 0;
    while (y)
    {
        res += y % 9;
        y /= 9;
    }
    return cnt + res;
}

int main()
{
    ios::sync_with_stdio(false);
    cin >> n;
    if (n < 6) { cout << n << endl; return 0; }
    int a = n % 6, b = n / 6, c = 0;
    int ans = solve(b, 0) + a;
    while(b)
    {
        a += 6;
        b--;
        if (a >= 9)
        {
            a -= 9;
            c++;
        }
        ans = min(ans, solve(b, c) + a);
    }
    cout << ans << endl;
    return 0;
}

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

int main() {
    long long i, input, cnt, sub=1;
    cin >> i;
    cnt = i;
    for(;i!=0;i--){
        cin >> input;
        if(input%2 == 0) sub *= 2;
    }
    cout << pow(3, cnt) - sub << endl;
}

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

long long power(long long n, int k)
{
	if (k == 0 || n == 1) return 1;
	
	long long i, N;
	for (i = 1, N = n; i * 2 <= k; i *= 2) N = N * N;
	return N * power(n, k - i);
}

int main()
{	
	long long N, A;
	scanf("%lld %lld", &N, &A);
	
	int k, l;
	long long n, min = N, tmp;
	for (k = 2, n = (long long)sqrt(N); n > 1 && A * (k - 1) < min; k++) {
		for (; power(n, k) > N; n--);
		for (l = 0, tmp = power(n, k); l <= k && tmp < N; l++, tmp = tmp / n * (n + 1));
		if (A * (k - 1) + n * k + l < min) min = A * (k - 1) + n * k + l;
	}
	
	printf("%lld\n", min);
	fflush(stdout);
	return 0;
}

Measured memory_bytes: 2096
#include <stdio.h>
int main(){
 
  int a,b,i,d;
 
  while(1){
  scanf("%d %d",&a,&b);
if(a==0 && b==0)break;
 
  for(i=0;i<a;i++){

    for(d=0;d<b;d++)
{
    printf("#");
  } 
  printf("\n");
 
  
  }
  printf("\n");
  }
  
 
  return 0;
  }


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

using namespace std;
#define FOR(i,s,x) for(int i=s;i<(int)(x);i++)
#define REP(i,x) FOR(i,0,x)

int main() {
  while (1) {
    int N, K, M; cin >> N >> K >> M;
    if (N == 0 and K == 0 and M == 0) break;
    M--;
    vector<int> stones(N); REP(i, N) stones[i] = i;
    while (stones.size() > 1) {
      stones.erase(stones.begin() + M);
      M = (M + K - 1 + stones.size()) % stones.size();
    }
    cout << stones[0] + 1 << endl;
  }
  return 0;
}

Measured memory_bytes: 3112
#include<stdio.h>
#define N 100
#define INF 200000000
#define WHITE 0
#define GRAY 1
#define BLACK 2

int n,A[N][N];
void dijkstra(void){
  int u,v,i,mincost;
  int color[N],d[N],pi[N];

  for(i=0;i<n;i++){
    color[i]=WHITE;
    d[i]=INF;
  }
  d[0]=0;
  color[0]=GRAY;

  while(1){
    mincost=INF;
    u=-1;
    for(i=0;i<n;i++){
      if(color[i]!=BLACK&&d[i]<mincost){
	mincost=d[i];
	u=i;
      }
    }
    if(u==-1) break;

    color[u]=BLACK;

    for(v=0;v<n;v++){
      if(color[v]!=BLACK&&A[u][v]!=INF){
	if(d[u]+A[u][v]<d[v]){
	  d[v]=d[u]+A[u][v];
	  pi[v]=u;
	  color[v]=GRAY;
	}
      }
    }
  }
    for(i=0;i<n;i++) printf("%d %d\n",i,d[i]==INF?-1:d[i]);
}
int main(){
  int i,j,a,b,k,l;

  scanf("%d",&n);
  for(i=0;i<n;i++){
    for(j=0;j<n;j++) A[i][j]=INF;
  }
  for(i=0;i<n;i++){
    scanf("%d %d",&a,&k);
    for(j=0;j<k;j++){
      scanf("%d %d",&b,&l);
      A[a][b]=l;
    }
  }

  dijkstra();

  return 0;
}
  



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

int main() {
    int n;
    cin >> n;
    int i, j;
    int cnt = 0;
    for(i = 1; i <= n; i++) {
        for(j = 1; j <= n/i; j++) {
            if (i*j < n) {
                cnt++;
            }
        }
    }
    cout << cnt << endl;
}


Measured memory_bytes: 3516
#include <bits/stdc++.h>
#define INF 0x3f3f3f3f
#define MOD 1000000007
#define MAXN 300005
#define MAXM 100005
#define lint long long
#define trace(x) cout << #x << " = " << x << '\n'
#define sz(x) (int)(x).size()
using namespace std;
struct ii {
	int a, b;
	bool operator < (ii o) const { return tie(a, b) < tie(o.a, o.b); }
};
struct iii {
	int a, b, c;
	bool operator < (iii o) const { return tie(a, b, c) < tie(o.a, o.b, o.c); }
};
int TC, N, M, K, Q, x, y, z, ans;
lint mod(lint n) { return (n%MOD + MOD)%MOD; }
lint kali(lint a, lint b, lint c = 1, lint d = 1) { return mod(mod(a*b)*mod(c*d)); }

int fw[MAXM];
vector<ii> panjang[MAXM];

void update(int pos, int val) {
	for (int i = pos; i <= M; i += i&-i) {
		fw[i] += val;
	}
}

int get(int pos) {
	int ret = 0;
	for (int i = pos; i > 0; i -= i&-i) {
		ret += fw[i];
	}
	return ret;
}

int main() {
	#ifdef FAIRUZI10
	freopen("/home/fairuzi/Documents/CP/input.in", "r", stdin);
	#endif
	
	scanf("%d%d", &N, &M);
	for (int i = 0; i < N; i++) {
		scanf("%d%d", &x, &y);
		panjang[y-x+1].push_back({x, y+1});
	}
	
	int pasti = N;
	for (int i = 1; i <= M; i++) {
		pasti -= sz(panjang[i-1]);
		for (ii j: panjang[i-1]) {
			update(j.a, 1);
			update(j.b, -1);
		}
		int tambah = 0;
		for (int j = 0; j <= M; j += i) {
			tambah += get(j);
		}
		printf("%d\n", pasti+tambah);
	}
	
	return 0;
}


Measured memory_bytes: 8064
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rrep(i, n) for (int i = (n); i >= 0; i--)
#define loop(i, r, n) for (int i = (r); i < (n); i++)
#define pb push_back
#define all(in) in.begin(),in.end()

template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }

using ll = long long;
using ull = unsigned long long;
using namespace std;

const ll MOD = 1000000007;

ll modpow(ll a, ll n, ll p) {
    ll res = 1;
    while (n) {
        if (n & 1) res = res * a % p;
        a = a * a % p;
        n >>= 1;
    }
    return res;
}

const int MAX = 100100;
ll fac[MAX], finv[MAX], inv[MAX];

void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i-1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD/i) % MOD;
        finv[i] = finv[i-1] * inv[i] % MOD;
    }
}

ll COM(int n, int k){
    if (n < 0 || k < 0 || n < k) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main() {
    ll n; cin >> n;
    COMinit();
    ll ans = 0;
    rep(i,2000) if (i) {
        int num = n - i * 3;
        if(num < 0) break;
        ans += COM(num + i - 1, num);
        ans %= MOD;
    }
    cout << ans % MOD << endl;
    return 0;
}

Measured memory_bytes: 5960
#include<bits/stdc++.h>
#define mod 1000000007
using namespace std;
using ll=long long;
int main(){
  ll n;
  cin>>n;
  vector<ll> a(n);
  vector<ll> b(n+1,0);
  for(int i=0;i<n;i++){
    cin>>a[i];
    b[i+1]=b[i]+a[i];
  }
  ll ans=0;
  for(int i=0;i<n;i++){
    ll s=(b[n]-b[i+1])%mod;
    ans+=s*a[i];
    ans=ans%mod;
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 6428
#include <iostream>
using namespace std;
#define lli long long int


int main () {
	lli n, flag = 0;
  cin  >> n;
  while(n) {
  	int x = n % 10;
    if(x == 7){
    flag++;
    }
    n = n/10;
  }
  if(flag != 0){
  cout << "Yes" << endl;}
  else cout << "No";
}


Measured memory_bytes: 3132
//----------------------------templates
    #pragma GCC optimize ("Ofast")
    #pragma GCC target ("tune=native")
    #pragma GCC target ("avx")
    //----------------------------
    #include <bits/stdc++.h>
    using namespace std;

    typedef long long ll;
    typedef unsigned long long ull;
    #define int ll

    #define FOR(i,j,n) for (int i=(int)(j);i<(n);i++)
    #define REP(i,n) for (int i=0;i<(int)(n);i++)
    #define REPS(i,n) for (int i=1;i<=(int)(n);i++)
    #define REPN(i,n) for (int i=(int)(n)-1;i>=0;i--)
    #define REPNS(i,n) for (int i=(int)(n);i>0;i--)

    #define I(n) scanf("%lld", &(n))
    #define LL(n) scanf("%lld", &(n))
    #define pb(n) push_back((n))
    #define mp(i,j) make_pair((i),(j))
    #define eb(i,j) emplace_back((i),(j))
    #define y0 y3487465
    #define y1 y8687969
    #define j0 j1347829
    #define j1 j234892
    #define uniq(v) v.erase( unique(v.begin(), v.end()), v.end() )

    #define all(x) (x).begin(),(x).end()
    #define sz(x) ((int)(x).size())

    typedef vector<int> vi;
    typedef pair<int,int> pi;
    typedef vector<pi> vpi;
    typedef vector<vi> vvi;
    typedef vector<vpi> vvpi;
    typedef vector<vvi> vvvi;

    const int mod = 1000000007;

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

int q,a,b,c,d;
int board[10][10];

signed main(){
    REP(i,8){
        REP(j,8){
            board[i][j] = (i%2) || ((j+1)%2);
        }
    }
    I(q);
    REP(_,q){
        I(a); I(b); I(c); I(d);
        int ret = 0;
        FOR(i,a-1,c) FOR(j,b-1,d) ret += board[i][j];
        printf("%lld\n", ret);
    }
}


Measured memory_bytes: 3240
#include <iostream>

using namespace std;

void solve(string x) {
    int s=0, st=0;
    for(char& c : x) {
        if(c == 'S') {
            s++;
        } else {
            if(s > 0) {
                st++;
                s--;
            }
        }
    }

    int res = (int)x.size() - 2*st;
    cout << res << "\n";
}

int main() {
    string x;
    cin >> x;
    solve(x);
    return 0;
}

Measured memory_bytes: 772
n = int(input())
a_list = [0] + [int(x) for x in input().split()]

temp_list = [False] * (n + 1)
for i in range(n, 0, -1):
    count = 0
    for j in range(i * 2, n + 1, i):
        if temp_list[j]:
            count += 1

    if count % 2 != a_list[i]:
        temp_list[i] = True

ans_list = [i for i in range(n + 1) if temp_list[i]]
print(len(ans_list))
for ans in ans_list:
    print(ans, end=" ")

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

typedef long long ll;
using namespace std;
ll N, M;
int A[100000], B[100000];
ll ans[100001];
int size[100000];
int par[100000];

int find(int v) {
    if (par[v] == v) return v;
    return par[v] = find(par[v]);
}

int main() {
    scanf("%lld%lld", &N, &M);
    for (int i = 0; i < N; i++) {
        size[i] = 1;
        par[i] = i;
    }
    for (int i = 0; i < M; i++) {
        scanf("%d%d", &A[i], &B[i]);
        A[i]--, B[i]--;
    }
    ans[M] = N * (N - 1) / 2;
    for (int i = M - 1; i > 0; i--) {
        ans[i] = ans[i + 1];
        int a = find(A[i]), b = find(B[i]);
        if (a == b) {
        } else {
            ans[i] -= size[a] * size[b];
            par[b] = a;
            size[a] += size[b];
        }
    }
    for (int i = 1; i <= M; i++) {
        printf("%lld\n", ans[i]);
    }
}

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

int main(){
    int N;
    cin >> N;
    vector<int> T;
    for(int i=0; i<N; i++){
        int c;
        cin >> c;
        T.push_back(c);
    }
    int M;
    cin >> M;
    vector<int> P, X;
    for(int i=0; i<M; i++){
        int a, b;
        cin >> a >> b;
        P.push_back(a);
        X.push_back(b);
}
// ドリンク1-Mまで順番にみる
for(int i=0;i<M;i++){
    int sum=0;
    // 分かりやすさのために例外処理をする問題番号と変更後の値を変数にとっておく
    int exception_index=P[i];
    int exception_time=X[i];
    // 問題1-Nまでみて合計を出す。例外処理の時は変更後の値を加算(本当は合計を先に出しておいて差分だけ足し引きするほうが早い)
    for(int j=0;j<N;j++){
        if(j +1 ==exception_index){
            sum+=exception_time;
        }else{
            sum+=T[j];
        }
        
    }
    // 一行ずつ出力。vector<int>ansとか作って答えを格納しておいて最後にまとめて出力するのでもいいけど、これでもOK
    cout<<sum<<endl;
    sum =0;
}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int INF=2E9;

int main(){
    array<int,3> A;
    cin >> A[0] >> A[1] >> A[2];
    sort(A.begin(),A.end());
    if((A[0]+A[1])%2==0) cout << (2*A[2]-A[1]-A[0])/2<<endl;
    else cout << (2*A[2]-A[1]-A[0]+3)/2 << endl;
    return 0;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
	"sort"
)

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

	a := make([]int, n)
	for i := range a {
		fmt.Scan(&a[i])
	}

	sort.Sort(sort.Reverse(sort.IntSlice(a)))

	alice := 0
	bob := 0
	for i := 0; i < n; i += 2 {
		alice += a[i]
	}
	for i := 1; i < n; i += 2 {
		bob += a[i]
	}

	fmt.Println(alice - bob)
}

Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <set>
#include <map>
#include <stack>
using namespace std;

vector<int> edge[10010];
int h[10010];

int V;
int E;

int main()
{
    cin >> V;
    cin >> E;

    for(int i = 0;i < E;i++)
    {
        int s;
        int t;

        cin >> s >> t;

        edge[s].push_back(t);


        h[t]++;
    }

    stack<int> st;

    for(int i = 0;i < V;i++)
    {
        if(h[i] == 0) st.push(i);
    }

    vector<int> topolo;

    while(!st.empty())
    {
        int v = st.top();
        st.pop();

        topolo.push_back(v);

        for(int to : edge[v])
        {
            h[to]--;

            if(h[to] == 0)
            {
                st.push(to);
            }
        }
    }

    for(int ans : topolo)
    {
        cout << ans << endl;
    }

    return 0;


}


Measured memory_bytes: 3856
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
using namespace std;
typedef long long LL;

const int MaxN = 100;
int n, V;
int v[MaxN + 5], w[MaxN + 5];
LL f[MaxN + 5][MaxN + 5][MaxN * 4 + 5];

int main()
{
	while (~scanf("%d%d", &n, &V)) {
		LL sum = 0;
		for (int i = 1; i <= n; i++) {
			scanf("%d%d", &v[i], &w[i]);	
			sum = sum + v[i] - v[1];
		}
		memset(f, 0, sizeof(f));
		for (int i = 1; i <= n; i++) {
			for (int j = 1; j <= i; j++)
				for (int k = 0; k <= v[i] - v[1] - 1; k++) 
					f[i][j][k] = f[i - 1][j][k];
			for (int j = 1; j <= i; j++)
				for (int k = v[i] - v[1]; k <= sum; k++)
					f[i][j][k] = max(f[i - 1][j][k], f[i - 1][j - 1][k - (v[i] - v[1])] + w[i]);
		}
		LL ans = 0;
		for (int i = 1; (LL)i * v[1] <= V; i++)
			ans = max(ans, f[n][i][min(V - (LL)i * v[1], sum)]);
		printf("%lld\n", ans);
	}
	return 0;
}

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

using namespace std;

typedef long long int ll;
typedef pair<ll, ll> pll;

#define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i))
#define REP(i, n) FOR(i,n,0)
#define OF64 std::setprecision(40)

const ll MOD = 1000000007;
const ll INF = (ll) 1e15;

ll N;
pll A[55];
pll mx(INF, -INF), my(INF, -INF);

double calc(double x, double y) {
    double ret = 0;
    REP(i, N) {
        double a = A[i].first - x;
        double b = A[i].second - y;
        double len = sqrt(a * a + b * b);
        ret = std::max(ret, len);
    }
    return ret;
}

double calcY(double x) {
    double ly = my.first, ry = my.second;
    REP(_, 100) {
        double lly = ly + (ry - ly) / 3.0;
        double rry = lly + (ry - ly) / 3.0;

        if (calc(x, lly) < calc(x, rry))
            ry = rry;
        else
            ly = lly;
    }
    return calc(x, ly);
}

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

    cin >> N;
    REP(i, N) {
        cin >> A[i].first >> A[i].second;
        mx.first = std::min(mx.first, A[i].first);
        mx.second = std::max(mx.second, A[i].first);
        my.first = std::min(my.first, A[i].second);
        my.second = std::max(my.second, A[i].second);
    }

    double lx = mx.first, rx = mx.second;
    REP(_, 100) {
        double llx = lx + (rx - lx) / 3.0;
        double rrx = llx + (rx - lx) / 3.0;
        //cout << OF64 << llx << "," << rrx << endl;
        if (calcY(llx) < calcY(rrx))
            rx = rrx;
        else
            lx = llx;
    }


    cout << OF64 << calcY(lx) << endl;
    return 0;
}

Measured memory_bytes: 256
/** author: __nishad **/

#include<bits/stdc++.h>
using namespace std;


typedef long long ll ;
typedef vector<ll> vll ;

#define all(v) (v).begin(),(v).end()
#define precision(k) cout<<setprecision(k)<<fixed;
#define loop(i,a) for(int i=0; i<a;i++)
#define loop2(i,a,b) for(int i=(a);i<=(b);++i)
#define minv(v) *min_element(all(v))
#define maxv(v) *max_element(all(v))
#define getpos(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define pb push_back
#define pi 3.14159265358979323

int main()
{
    IOS;

    string str;
    cin>>str;
    ll ans = 1e6;

    loop(i, str.size()-2){
        ll n = (str[i]-'0')*100+ (str[i+1]-'0')*10+(str[i+2]-'0');
        ans = min(abs(753-n), ans);
    }

    cout<<ans;


}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
#define say(a) cout<<a<<endl
#define say1(a,b) cout<<a<<" "<<b<<endl
#define loop(a,b) for(int i=a;i<b;i++)
#define pi 2*acos(0.0)
#define ll long long
#define f first
#define s second
//vector<int> v[200009];
using namespace std;
int mod =1e9;
int main()
{
    int n,sum=0,i;
    cin>>n;
    int a[n],b[n+5],c[n+5];
    for(i=0;i<n;i++)
    {
        scanf("%d",&a[i]);
    }for(i=1;i<=n;i++)
    {
        scanf("%d",&b[i]);
    }for(i=1;i<n;i++)
    {
        scanf("%d",&c[i]);
    }
    for(i=0;i<(n-1);i++)
    {
        if((a[i]+1)==a[i+1])
        {
            sum+=c[a[i]];
        }sum+=b[a[i]];

    }sum+=b[a[i]];
    cout<<sum;
}




Measured memory_bytes: 256
#include <stdio.h>

int main(){
	int n,t=0,s=0;
  	scanf("%d",&n);
  	for(int i=1;i<=n;i++){
  		t=0;
      	int a=i;
    	while(a!=0){
        	t++;
          	a=a/10;
        }
      if(t%2==1){
      	s++;
      }
    }
  
  printf("%d",s);
}

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

#define ll long long 
int main() {
  double fa,ans=100;
  cin>>fa;
  ll cnt=0;
  while(ans<fa)
  {
    ans=ans*(pow((1.01),1));
    ans=(ll)ans;
    cnt++;
  }
  cout<<cnt;
  return 0;

}

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

long long N, M;
long long a[10000];
long long b[10000];
long long dp[10000];


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

	for(long long i = 0; i < M; i++){
		long long bnum;
		cin >> a[i] >> bnum;
		for(long long j = 0; j < bnum; j++){
			long long tmp;
			cin >> tmp;
			tmp--;
			b[i] = (b[i] | (1<<tmp));
		}
	}

	for(long long i = 0; i < 10000; i ++){
		dp[i] = INT_MAX;
	}
	dp[0] = 0;

	for(long long i = 0; i < M; i++){
		//cout << "i = " << i << endl;
		long long cost = a[i];
		long long bit = b[i];
		for(long long from = (1<<N) - 1; from >= 0; from--){
			//cout << "from = " << from << endl;
			if(dp[from] < INT_MAX){
				long long to = (from | bit);
				//cout << "from " << from << " to " << to << endl;
				dp[to] = min(dp[to], dp[from] + cost);
			}
		}
	}

	long long tar = (1<<N) - 1;
	//cout << "tar = " << tar << endl;
	if(dp[tar] < INT_MAX){
		cout << dp[tar] << endl;
	} else {
		cout << -1 << endl;
	}
}

Measured memory_bytes: 384
#include <iostream>
#include <queue>
#include <utility>
using namespace std;
static const int INFTY = (1 << 21);
static const int WHITE = 0;
static const int GRAY = 1;
static const int BLACK = 2;

int n;
vector<pair<int, int>> adj[100];
int *d;

void dijkstra() {
    priority_queue<pair<int, int>> PQ;
    int d[n], color[n];

    for (int i = 0; i < n; i++) {
        d[i] = INFTY;
        color[n] = WHITE;
    }
    d[0] = 0;
    PQ.push(make_pair(0, 0));

    while (!PQ.empty()) {
        pair<int, int> f = PQ.top();
        PQ.pop();

        int u = f.second;
        color[u] = BLACK;

        if (d[u] < f.first * (-1)) { continue; }

        for (int j = 0; j < adj[u].size(); j++) {
            int v = adj[u][j].first;
            if (color[v] == BLACK) { continue; }
            if (d[u] + adj[u][j].second < d[v]) {
                d[v] = d[u] + adj[u][j].second;
                PQ.push(make_pair(d[v] * (-1), v));
                color[v] = GRAY;
            }
        }
    }
    
    for (int i = 0; i < n; i++) {
        printf("%d %d\n", i, d[i]);
    }
}

int main() {
    cin >> n;
    for (int i = 0; i < n; i++) {
        int u, k;
        cin >> u >> k;
        for (int j = 0; j < k; j++) {
            int v, c;
            cin >> v >> c;
            adj[u].push_back(make_pair(v, c));
        }
    }

    dijkstra();

    return 0;
}


Measured memory_bytes: 3216
#include<bits/stdc++.h>
using namespace std;
long long int a[100100], b[100100], c[100100];
long long int dp[100100][3];
int main()
{
    int n,i,j,k,x,y,ans=0,curr,last;
    scanf("%d",&n);
    for(i=0;i<n;i++)
        scanf("%d %d %d",&a[i], &b[i], &c[i]);
    dp[0][0] = a[0];
    dp[0][1] = b[0];
    dp[0][2] = c[0];
    for(i=1;i<n;i++)
    {
        dp[i][0] = max(a[i] + dp[i-1][1], a[i] + dp[i-1][2]);
        dp[i][1] = max(b[i] + dp[i-1][0], b[i] + dp[i-1][2]);
        dp[i][2] = max(c[i] + dp[i-1][1], c[i] + dp[i-1][0]);
    }
    long long int jwb = 0;
    for(i=0;i<3;i++)
    {
        jwb = max(jwb,dp[n-1][i]);
    }
    printf("%lld\n",jwb);
    return 0;
}


Measured memory_bytes: 4992
#include <bits/stdc++.h>
//#include <chrono>
#pragma GCC optimize("Ofast")
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
#define ALL(a) a.begin(), a.end()
#define fi first
#define se second
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll N,M,H,W,Q,K,A,B;
string S;
typedef pair<ll, ll> P;
const ll INF = (1LL<<60);

class SEGTREE {
    unsigned int log_n, n;
    ll dflt;
    vector<ll> dat;
    const ll op(const ll a, const ll b) {
        return max(a, b);
    }

    const bool f(const unsigned int id, const ll a){
        return dat[id] >= a;
    }

public:
    SEGTREE(unsigned long _n, ll _a) : n(1), log_n(0), dflt(_a) {
        while (n < _n) {n *= 2;}
        dat.resize(n * 2, dflt);
    }

    void update(unsigned int k, ll a) {
        k += n;
        dat[k] = a;
        while (k > 0) {
            k >>= 1;
            dat[k] = op(dat[k<<1], dat[(k<<1)|1]);
        }
    }

    void init(vector<ll> &v) {
        for (int i = 0; i < v.size(); ++i) dat[i + n] = v[i];
        for (int i = n - 1; i >= 1; --i) {
            dat[i] = op(dat[i * 2], dat[i * 2 + 1]);
        }
    }

    ll query(unsigned int l, unsigned int r) {
        ll res_left = dflt, res_right = dflt;
        l += n; r += n;
        for ( ; l < r; l >>= 1, r >>= 1){
            if(l&1){
                res_left = op(res_left, dat[l]);
                if((++l) == r) break;
            }
            if(r&1){
                res_right = op(dat[r ^ 1], res_right);
            }
        }
        return op(res_left, res_right);
    }

    const unsigned int max_right_search(unsigned int id, ll a){
        while(id < n) id = (id<<1) | !f(id<<1, a);
        return id - n;
    }

    unsigned int max_right(unsigned int l, unsigned int r, ll a){
        //[l, r)内のindexであるjであって、query(l, j) < a <= query(l, j + 1)なるものを求める
        //つまり、j >= l かつ dat[j] >= a である最小の数jを求める(func = maxの場合)
        unsigned int see_after = r + n;
        l += n;
        for (unsigned int tr = r + n ; l < tr; l >>= 1, tr >>= 1){
            if(l&1){
                if(f(l, a)) return max_right_search(l, a);
                if((++l) == tr) break;
            }
            if((tr&1) && f(tr ^ 1, a)) see_after = tr ^ 1;
        }
        return see_after == r + n ? r : max_right_search(see_after, a);
    }

    //単項にアクセスする[]だが、書き換え厳禁
    //一応後でinitすれば書き換えてもよさそうだが…
    ll &operator[](int k) { return dat[k + n]; }
};
int main() {
    cin>>N>>Q;
    vec a(N);
    rep(i, N) scanf("%lld", &a[i]);
    SEGTREE seg(N, 0);
    seg.init(a);
    rep(_, Q){
        int t, x, v, l, r;
        scanf("%d", &t);
        if(t == 1){
            scanf("%d%d", &x, &v); --x;
            seg.update(x, v);
        }else if(t == 2){
            scanf("%d%d", &l, &r);
            printf("%lld\n", seg.query(l - 1, r));
        }else{
            scanf("%d%d", &x, &v); --x;
            printf("%u\n", seg.max_right(x, (unsigned int) N, v) + 1);
        }
    }
}



Measured memory_bytes: 9152
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		ArrayList<Integer> list = new ArrayList<>();

		for (int i = 0; i < 3; i++) {
			list.add(sc.nextInt());
		}

		Collections.sort(list);

		int ans =0;

		int ope1 = list.get(2) - list.get(1);

		ans += ope1;

		list.set(1, list.get(2));
		list.set(0, list.get(0) + ope1);

		int ope2 = list.get(2) - list.get(0);

		if(ope2%2 == 0) {
			ans += ope2/2;
		} else {
			ans += ope2/2 + 2;
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 23764
n = int(input())
an = list(map(int, input().split()))

an = sorted(an, reverse=True)
alice = sum([an[i] for i in range(len(an)) if i % 2 == 0])
bob = sum([an[i] for i in range(len(an)) if i % 2 == 1])
print(alice - bob)

Measured memory_bytes: 3060
#![allow(unused)]

use std::io::{Read, StdinLock};
use std::iter::{FromIterator, Iterator};
use std::str::{FromStr};
use std::string::String;

pub fn read_bytes<T: FromIterator<char>>(s: &mut StdinLock) -> T {
    s.bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect::<T>()
}

pub fn reads(s: &mut StdinLock) -> String {
    read_bytes::<String>(s)
}

pub fn read<T: FromStr>(s: &mut StdinLock) -> T {
    reads(s).parse().ok().unwrap()
}

fn is_palindrome(s: &[char]) -> bool {
    (0 .. s.len()).all(|i| s[i] == s[s.len() - i - 1])
}

fn is_strong_palindrome(s: &[char]) -> bool {
    let n = s.len();
    is_palindrome(s)
        && is_palindrome(&s[0 .. (n - 1) / 2])
        && is_palindrome(&s[(n + 3) / 2 - 1 .. n])
}

fn main() {
    let sin = std::io::stdin();
    let mut sin = sin.lock();

    let s = read_bytes::<Vec<char>>(&mut sin);

    println!("{}",
        if is_strong_palindrome(s.as_slice()) { "Yes" } else { "No" });
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
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++)
typedef long long ll;
typedef pair<int,int> pii;

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

Measured memory_bytes: 3624
#include<iostream>
#include<cmath>
#include<vector>
#include<set>
#include<algorithm>
#include<tuple>
#include<utility>
#include<cctype>
#include<climits>
#include<map>
#include<queue>
#include<functional>

using namespace std;
template<class T> void chmax(T& a, T b) {if(a < b){a=b;}}
template<class T> void chmin(T& a, T b) {if(a > b){a=b;}}

#define REP(i,a,n) for(int i=a;i<n;++i)
#define RUP(a,b) ((a+b-1)/(b))
#define ENT "\n"
#define REV(v) reverse(v.begin(),v.end())
#define SRTV(v) sort(v.begin(),v.end())
#define SRTA(a,n) sort(a,a+n)
#define MOD 1000000007

typedef long long ll;
typedef tuple<int,int,bool> Tb;

int atcoder(){
    //入力
    int a,b;
    cin >> a >> b;
    int ans = 0;
    int c;
    if(b<10) c=10*a+b;
    else if(b<100) c=100*a+b;
    else c=1000*a+b;
    //処理
    int d = sqrt(c);
    //出力
    if(c==d*d)cout << "Yes" << ENT;
    else cout << "No" << ENT;
    return 0;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    atcoder();
    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)
#define rep1(i, n) for (int i = 1; i < int(n); ++i)
#define repx(i, x, n) for (int i = int(x); i < int(n); ++i)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; --i)
#define ALL(n) begin(n), end(n)
#define IN(a, x, b) ((a) <= (x) && (x) < (b))
#define OUT(a, x, b) ((x) < (a) || (x) < (b))
typedef long long ll;
typedef long double ld;
const ll INF = 1e18;
const ll MOD = 1000000007;

const ll MAX = 1e9 + 10;

int main()
{
    ll N, A, B, thr, pre, now;
    cin >> N >> A >> B;
    thr = ll(B / A);
    ll ans = 0;

    cin >> pre;
    rep1(i, N)
    {
        cin >> now;
        if (now - pre > thr)
        {
            ans += B;
            // cout << "+B" << endl;
        }
        else
        {
            ans += A * (now - pre);
            // cout << "+" << A * (now - pre) << endl;
        }
        pre = now;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <algorithm>
#define P 1000000007ll
#define int long long

using namespace std;

typedef long long ll;

int n, A[100010], Fac[100010], S[100010];

ll powmod(ll x, ll y = P - 2, ll p = P) {
    ll ans = 1;
    while(y) {
        if(y & 1) ans = ans * x % p;
        x = x * x % p;
        y >>= 1;
    }
    return ans;
}

signed main() {
    scanf("%lld", &n);
    Fac[0] = 1;
    for(int i = 1; i <= n; i++) Fac[i] = Fac[i - 1] * i % P;
    for(int i = 1; i <= n; i++) S[i] = (S[i - 1] + powmod(i)) % P;
    int ans = 0;
    for(int i = 1; i <= n; i++) {
        int x;
        scanf("%lld", &x);
        ans = (ans + x * (S[i] - S[0] + S[n - i + 1] - S[1])) % P;
    }
    printf("%lld\n", (ans * Fac[n] % P + P) % P);
    return 0;
}

Measured memory_bytes: 1664
n = int(input())
a = list(map(int,input().split()))
mod = 10**9 + 7
ans = 1
rgb = [0,0,0]
for x in a:
    ans *= rgb.count(x)
    if rgb[0] == x: rgb[0] += 1
    elif rgb[1] == x :rgb[1] += 1
    elif rgb[2] == x :rgb[2] += 1
    ans %= mod

print(ans)

Measured memory_bytes: 52908
import math
n = int(input())
count = [0]*(10**7)
for i in range(1,101):
    for j in range(1,101):
        for k in range(1,101):
            count[i*i + j*j + k*k + i*j + j*k + k*i -1] += 1
for i in range(n):
    print(count[i])

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

int main(void){
  int n; char event[10];
  int first,second,third,home,out,score;

  scanf("%d",&n);
  while(n-->0){
    first=0; second=0; third=0;
    home=0; out=0; score=0;
    while(out!=3){
      scanf("%s",event);
      if(strcmp(event,"HIT")==0){
        if(third==1){ third--; score++; }
        if(second==1){ second--; third++; }
        if(first==1){ first--; second++; }
        first++;
      }
      else if(strcmp(event,"HOMERUN")==0){
        score += first+second+third+1;
        first=0; second=0; third=0; home=0;
      }
      else if(strcmp(event,"OUT")==0){ out++; }
      //printf("event is %s\n",event);
      //printf("first=%d,second=%d,third=%d,home=%d\n\n",first,second,third,home);
      event[0]='\0';
    }
    printf("%d\n",score);
  }
  return 0;
}



Measured memory_bytes: 2060
while true
  h, w = gets.split.map(&:to_i)
  if h==0 && w==0
    break
  end
  i=1
  while i <= h
    if i == 1 || i == h
      puts "#"*w
    else
      puts("#"+"."*(w-2)+"#")
    end
      i += 1
  end
  print "\n"
end

Measured memory_bytes: 8720
s = input()
t = input()
ls = len(s)
lt = len(t)

a = []
sum_ = 0
for i in range(ls-lt+1):
    ss = s[i:i+lt]
    sum_ = 0
    for i, alb in enumerate(t):
        if alb == ss[i]:
            sum_+= 1
    a.append(sum_)

print(lt - max(a))

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

int main(){

    int N;
    cin >> N;
    vector<int> A_sort(N);
    rep(i,N) cin >> A_sort[i];
    vector<int> A = A_sort;
    sort(A_sort.begin(),A_sort.end());

    rep(j,N){
        if(A[j] == A_sort[N-1]) cout << A_sort[N-2] << endl;
        else cout << A_sort[N-1] << endl;
    }
    



    return 0;
}

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

using namespace std;
using ll = long long int;
constexpr ll M = 1e9 + 7;
inline ll sum_1(const ll n) { return ((n * (n + 1)) / 2) % M; }
inline ll sum_2(const ll n) { return ((n * (n + 1) * (2 * n + 1)) / 6) % M; }
inline ll sum_3(const ll n) { return (((n * (n + 1)) / 2) % M * ((n * (n + 1)) / 2) % M) % M; }
inline ll sum_1(const ll i, const ll j) { return (sum_1(j) - sum_1(i - 1) + M) % M; }
inline ll sum_2(const ll i, const ll j) { return (sum_2(j) - sum_2(i - 1) + M) % M; }
inline ll sum_3(const ll i, const ll j) { return (sum_3(j) - sum_3(i - 1) + M) % M; }

ll pow_f(ll b, ll e) {
    ll ans = 1;
    b = b % M;
    while (e) {
        if (e&1) {
            ans = (ans * b) % M;
        }
        b = (b * b) % M;
        e >>= 1;
    }
    return ans;
}

ll nCr(ll n, ll r) {
    if (r > n || n < 0 || r < 0) { return 0; }
    if (n == r || r == 0) { return 1; }
    r = min(r, n-r);
    ll ans = 1;
    for (ll i = 1; i <= r; ++i) {
        ans = (ans * (n-i+1))/(i); 
    }
    return ans;
}

ll nCr(tuple<ll,ll> t) {
    auto n = get<0>(t);
    auto k = get<1>(t);
    return nCr(n+k-1, k);
}

void solve() {
    int n;
    cin >> n;
    map<string, bool> m;
    for (int i = 0; i < n; ++i) {
        string s;
        cin >> s;
        m[s] = true;
    }
    cout << m.size() << endl;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    #ifdef D_LOCAL
        freopen("in.in", "r", stdin);
        freopen("out.out", "w", stdout);
    #endif

    solve();

    return 0;
}

Measured memory_bytes: 19292
import java.io.*;
import java.util.*;

class Main{
    public static void main(String[] args){
	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	int data,key,sum;
	double sqrt;
	try{
	    while(0!=(data=Integer.valueOf(br.readLine()))){
		sqrt = Math.sqrt(data);
		if(sqrt == (key = (int)sqrt)){
		    sum = key;
		    key--;
		    if(key == 0)sum--;
		}
		else {
		    sum = 1;
		}
		for(;key > 1;key--){
		    if((data%key) == 0)sum += ((data/key) + key);
		}
		if(sum > data)System.out.println("abundant number");
		if(sum < data)System.out.println("deficient number");
		if(sum ==data)System.out.println("perfect number");
	    }
	    
	}
	catch(Exception e){
	    System.exit(0);
	}
    }
}

Measured memory_bytes: 17008
#include <bits/stdc++.h>
#include <iostream>
using namespace std;
int main() {
    int N,ans;
    cin >> N;
    vector<long long> a(N);
    for(int i=0;i<N;i++){
        cin >> a[i];
    }
    sort(a.begin(),a.end());
    int i = 0;
    while(i<N){
        long long num = a[i];
        //int j = 1;
        int res = 1;
        while(a[i+1]==num){
            i++;
            res++;
        }
        ans = ans + res%2;
        i++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 1024
#include "bits/stdc++.h"
using namespace std;
typedef long long LL;
LL A[100000];
LL B[100000];
LL C[100000];
LL sum[100000];
int main() {
	int N;
	cin >> N;
	for (int i = 0; i < N; i++) cin >> A[i];
	for (int i = 0; i < N; i++) cin >> B[i];
	for (int i = 0; i < N; i++) cin >> C[i];
	sort(A, A + N);
	sort(B, B + N);
	sort(C, C + N);
	for (int i = N - 1; i >= 0; i--) {
		sum[i] = (C + N) - upper_bound(C, C + N, B[i]);
		if (i + 1 < N) sum[i] += sum[i + 1];
	}
	LL ans = 0;
	for (int i = 0; i < N; i++) {
		int pos = upper_bound(B, B + N, A[i]) - B;
		if (pos < N) ans += sum[pos];
	}
	cout << ans << endl;
}

Measured memory_bytes: 3328
// 何回操作を行うことができるか
import 'dart:io';

void main() {
  int n = int.parse(stdin.readLineSync()); // 一つ入力
  List ai = stdin
      .readLineSync()
      .split(" ")
      .map((x) => int.parse(x))
      .toList(); // 一行に複数入力

  int count;

  count = 0;

  bool even;
  even = true;
  while (even) {
    for (int i = 0; i < n; i++) {
      if (ai[i] % 2 != 0) {
        even = false;
        print(count);
        return;
      }

      ai[i] = (ai[i] / 2).floor();
    }
    // if (even == false) break;
    // if (even) {
    // for (int i = 0; i < n; i++) {
    //   ai[i] = (ai[i] / 2).floor();
    // }
    count++;
    // }
  }

  print(count);
}


Measured memory_bytes: 13344
#include <iostream>
#include <cstdint>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int, int>> vpii;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvc;
typedef vector<vector<string>> vvs;
typedef vector<vector<ll>> vvll;

#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define rrep(i, n) for (ll i = 1; i <= (n); ++i)
#define irep(it, stl) for (auto it = stl.begin(); it != stl.end(); it++)
#define drep(i, n) for (ll i = (n)-1; i >= 0; --i)
#define mes(a) cout << (a) << endl
#define dmes(a, b) cout << (a) << " " << (b) << endl
#define re0 return 0
#define mp(p, q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define rSort(a) sort(a.rbegin(), a.rend())
#define Rev(a) reverse(a.begin(), a.end())
#define MATHPI acos(-1)
#define itn int
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
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;
}
struct io
{
    io()
    {
        ios::sync_with_stdio(false);
        cin.tie(0);
    }
};
const int INF = INT_MAX;
const ll LLINF = 1LL << 60;
const ll MOD = 1000000007;
const double EPS = 1e-19;


signed main() {
    ll h, w, h2, w2;
    cin >> h >> w >> h2 >> w2;
    
    mes(h*w - h2*w - (h-h2) * w2);
    
        
    
    
    
    
    
    
    
    
}

Measured memory_bytes: 3644
line = input().split()
N = int(line[0])
M = int(line[1])
lineA = input().split()
lineA_str = [int(s) for s in lineA]
Total = sum(lineA_str)
B = [ i for i in lineA_str if i >= Total/(4*M)]
if M <= len(B):
  print("Yes")
else:
  print("No")

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


#define M 1000000007
#define pb push_back
#define mp make_pair
#define s second
#define f first
#define mod 998244353
#define sz(v) (int)(v).size()

#define pii pair<int, int>
#define vi vector<int>
#define ll long long
#define fastio ios_base::sync_with_stdio(false);cin.tie(0)

ll add(ll a,ll b)
{
	a%=M;
	b%=M;
	ll p = (a+b)%M;
	return (p+M)%M;
}

ll mul(ll a,ll b)
{
	a%=M;
	b%=M;
	ll p = (a*b)%M;
	return (p+M)%M;
}


int main()
{
	fastio;
	ll i,j,n,ans=0;
	cin>>n;
	string str;
	cin>>str;
	ll c1=0,c2=0,c3=0;
	for(i=0;i<n;i++)
	{
		if(str[i]=='R')
			c1++;
		else if(str[i]=='G')
			c2++;
		else
			c3++;
	}
	ans = c1*c2*c3;
	for(i=0;i<n;i++)
	{
		for(j=1;(j<=i)&&(i+j<n);j++)
		{
			if((str[i]!=str[i-j])&&(str[i]!=str[i+j])&&(str[i-j]!=str[i+j]))
				ans--;
		}
	}
	cout<<ans<<endl;
    return 0;
}





Measured memory_bytes: 3664
#include <iostream>
#include <cstring>
#include <cmath>
#include <vector>
#include <algorithm>
#include <numeric>
#include <array>
using namespace std;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define pow(x) x*x

long long gcd(long long x){ 

  long long ans, i;

  for( i = 1; i <= x / 2; i++ ){
    if( x % i == 0 ) ans = i;
  }
  return ans;
}

int main() {

  long long x, y, z;
  long long ans;

  cin >> x >> y;

  z = x;

  while(1){
    if( x > y ) {
      if( x % y == 0 ) break;
      z = x % y; 
      x = z;
    }
    else{ 
      if( y % x == 0 ) break;
      z = y % x; 
      y = z;
    }
  }

  cout << z  << endl;


}

/*
                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         pass System Test!
*/


Measured memory_bytes: 3104