akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef pair<int, int> PII;

const int N = 10, mod = 1e9 + 7;

string s, t, res = "";
bool flag;

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

    int lens = s.size(), lent = t.size();
    for(int i = 0; i < lens - lent + 1; i++)
    {
        flag = true;
        string str = s;
        for(int j = 0; j < lent; j++)
            if(str[i + j] == t[j] || str[i + j] == '?') str[i + j] = t[j];
            else
            {
                flag = false;
                break;
            }

        if(flag)
        {
            for(int i = 0; i < lens; i++)
                if(str[i] == '?')
                    str[i] = 'a';
            if(res == "" || res > str) res = str;
        }
    }

    if(res == "") puts("UNRESTORABLE");
    else cout << res << endl;
    return 0;
}


Measured memory_bytes: 256
//Never stop trying
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
#define boost ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)

typedef string str;
typedef long long ll;
//#define int ll
typedef double db;
typedef long double ld;

typedef pair<int,int> pi;
#define fi first
#define se second

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<str> vs;
typedef vector<pi> vpi;

#define pb push_back
#define eb emplace_back
#define pf push_front

#define lb lower_bound
#define ub upper_bound

#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
#define endl "\n"

const int MOD = 1e9+7; //998244353
const ll INF = 1e18;
const int nx[4]={0,0,1,-1}, ny[4]={1,-1,0,0}; //right left down up

void IO(){
#ifndef ONLINE_JUDGE 
    freopen("in.txt", "r", stdin); 
    freopen("out.txt", "w", stdout); 
#endif 
}

const int MX=1001;
char g[MX][MX];
int memo[MX][MX];
int R,C;

int solve(int x, int y){
	if(x==R-1 && y==C-1) return 1;
	if(x<0||y<0||x>=R||y>=C || g[x][y]=='#') return 0;
	if(memo[x][y]!=-1) return memo[x][y];
	int ans=solve(x,y+1);
	ans=(ans+solve(x+1,y))%MOD;
	return memo[x][y]=ans;
}

int main(){
   boost;
   IO();
   cin>>R>>C;
   for(int i=0; i<R; i++) for(int j=0; j<C; j++) cin>>g[i][j];
   for(int i=0; i<MX; i++) for(int j=0; j<MX; j++) memo[i][j]=-1;
   cout << solve(0,0) << endl;

   return 0;
}


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

int main(){
  string s,t;
  cin >> s >> t;
  for(int i=0; i<s.size(); i++){
    s = s.at(s.size()-1) + s.substr(0,s.size()-1);
    if(s==t){cout << "Yes" << endl; return 0;}
  }
  cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.*;

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

      int n=sc.nextInt();

      int[] h = new int[n];
    for(int i=0;i<n;i++){
      h[i]=sc.nextInt();
    }
    if(n==1){
      System.out.println("Yes");
    }
    else{
      for(int i=0;i<n-1;i++){
        if(h[i]-h[i+1]>=2){
          System.out.println("No");
          break;
        }
        else if(h[i]-h[i+1]==1){
          h[i+1]++;
        }
        if(i==n-2){
          System.out.println("Yes");
        }
      }
    }


    }
}


Measured memory_bytes: 50468
#include <stdio.h>
#include <string.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define INF ((1LL<<62)-(1LL<<31))
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))

ll n;
ll p[500],q[500],r[500];
int main(){
	scanf("%lld",&n);
	ll c=0;
	rep(i,0,n-1)scanf("%lld%lld%lld",p+i,q+i,r+i);
	rep(i,0,n){
		ll c=0;
		rep(j,i,n-1)c=max(q[j],(c-1+r[j])/r[j]*r[j])+p[j];
		printf("%lld\n",c);
	}
}

Measured memory_bytes: 128
from math import sin,cos,radians
A,B,H,M = map(int,input().split())

# 分針の角度計算
## 1分で360/60度移動
## 15分を0どになるよう補正
fun = 360/60 * M
th_fun = fun - 90
# 時針の角度計算
## 1時間で360/12度移動
## 1分で360/12/60度移動
## 15分を0度となるよう補正
jis = 360/12 * H + 360/12/60 * M
th_jis = jis - 90

# それぞれの座標を計算
cos_f = B * cos(radians(th_fun))
sin_f = B * sin(radians(th_fun))

cos_j = A * cos(radians(th_jis))
sin_j = A * sin(radians(th_jis))
# ユークリッド距離を計算

dist =((cos_f - cos_j)**2 + (sin_f - sin_j)**2)**0.5

print(dist)


Measured memory_bytes: 62608
import os
import sys
from collections import defaultdict, Counter
from itertools import product, permutations,combinations, accumulate
from operator import itemgetter
from bisect import bisect_left,bisect
from heapq import heappop,heappush,heapify
from math import ceil, floor, sqrt
from copy import deepcopy

def main():
    num = int(input())
    ans = ""
    for i in range(1,100):
        if num <= 26**i:
            
            num -= 1
            for j in range(i):
                ans += chr(65 + num%26)
                num //= 26
            break
        else:
            num -= 26**i
            
    ans = ans.lower()
    print(ans[::-1])


if __name__ == "__main__":
    main()

Measured memory_bytes: 9512
#include<stdio.h>
#define N 100000
typedef struct
{
    int parent;
    int left;
    int right;
} node;

node T[N];
 int finddepth(int x)
{
    int c=0;
    while(T[x].parent >= 0)
    {
        c++;
        x = T[x].parent;
    }
    return c;
}
void preorder(int root)
{
    if(root == -1) return;
     
    printf(" %d", root);
    preorder(T[root].left);
    preorder(T[root].right);
}
void inorder(int root)
{
    if(root == -1) return;
     
    inorder(T[root].left);
    printf(" %d", root);
    inorder(T[root].right);
}
void postorder(int root)
{
    if(root == -1) return;
     
    postorder(T[root].left);
    postorder(T[root].right);
    printf(" %d", root);
}
int main()
{
    int pa, x, y, i, j, n, k, c, root;
     
    scanf("%d", &n);
    for(i=0; i<n; i++)
    {
        T[i].parent = -1;
        T[i].left = -1;
        T[i].right = -1;
    }
     
     
    for(i=0; i<n; i++)
    {
        scanf("%d", &pa);
         
        scanf("%d%d", &x, &y);
        if(x!=-1)T[x].parent = pa;
        if(y!=-1)T[y].parent = pa;
        T[pa].left = x;
        T[pa].right = y;
         
    }
     
    for(i=0; i<n; i++)
    {
        if(T[i].parent == -1)
        {
            root = i;
            break;
        }
    }
     
    printf("Preorder\n");
    preorder(root);
    printf("\n");
     
    printf("Inorder\n");
    inorder(root);
    printf("\n");
     
    printf("Postorder\n");
    postorder(root);
    printf("\n");
     
    return 0;
}

Measured memory_bytes: 616
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] C = new int[N-1];
		int[] S = new int[N-1];
		int[] F = new int[N-1];
		for (int i = 0; i < N-1; i++) {
			C[i] = sc.nextInt();
			S[i] = sc.nextInt();
			F[i] = sc.nextInt();
		}

		for (int i = 0; i < N; i++) {
			int nowt = 0;
			for (int j = i; j < N-1; j++) {
				nowt += waitTime(C[j], S[j], F[j], nowt);
			}
			System.out.println(nowt);
		}
	}

	private static int waitTime(int C, int S, int F, int nowt) {
		return Math.max(F * ((nowt - 1) / F + 1), S) - nowt + C;
	}
}

Measured memory_bytes: 25900
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const ll mod = 1e9 + 7;

int main() {
    int H, W;
    cin >> H >> W;
    int N;
    cin >> N;
    int a[N];
    for(int i = 0; i < N; i++) cin >> a[i];

    int ans[H][W], color = 0;
    bool fromLeft = true;
    for(int i = 0; i < H; i++) {
        int j = 0, dim = 1;
        if(!fromLeft) {
            j = W - 1;
            dim = -1;
        }
        for(; 0 <= j && j < W; j += dim) {
            ans[i][j] = color + 1;
            a[color]--;
            if(a[color] <= 0) color++;
        }
        fromLeft = !fromLeft;
    }

    for(int i = 0; i < H; i++) {
        for(int j = 0; j < W; j++) cout << ans[i][j] << " ";
        cout << "\n";
    }
    return 0;
}


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

class Program {
    static void Main(string[] args) {
        string s = Console.ReadLine();
        int N = int.Parse(s.Split(' ')[0]);
        int D = int.Parse(s.Split(' ')[1]);

        string[] t = new string[N];
        int[ , ] X = new int[N, D];

        for (int i = 0; i < N; i++) {
            t[i] = Console.ReadLine();
            int[] kari = t[i].Split(' ').Select(x => int.Parse(x)).ToArray();
            for (int j = 0; j < D; j++) {
                X[i, j] = kari[j];
            }
        }

        //カウンタ
        int counter = 0;

        //検証
        for (int i = 0; i < N; i++) {
            for (int j = i + 1; j < N; j++) {
                int sum = 0;
                for (int k = 0; k < D; k++) {
                    sum += (int)Math.Pow(X[i, k] - X[j, k], 2);
                }
                //Console.WriteLine(sum);
                if (CheckSquare(sum)) {
                    counter++;
                }
            }
        }

        Console.WriteLine(counter);
    }
    public static bool CheckSquare(int N) {
        if (N < 0) {
            return false;
        }
        return N == (int)Math.Sqrt(N) * (int)Math.Sqrt(N);
    }
}

Measured memory_bytes: 13396
#include <bits/stdc++.h>
using namespace std;
#define ll long long 
#define endl "\n"
#define pb push_back
#define f(i,n) for(i=0;i<n;i++)
#define F(i,a,b) for(i=a;a<=b;i++)
#define arr(a,n) for( i=0;i<n;i++)cin>>a[i];
#define fi first
#define se second
#define mp make_pair
#define mod 1000000007
#define YES cout<<"YES"<<endl;
#define Yes cout<<"Yes"<<endl;
#define NO cout<<"NO"<<endl;
#define No cout<<"No"<<endl;
#define yes cout<<"yes"<<endl;
#define no cout<<"no"<<endl;
#define vi vector<ll>
#define ed end()
#define bg begin()
#define sz size()
#define ln length()
#define s() sort(a,a+n);
#define sr() sort(a,a+n,greater<ll>());
#define v()  sort(v.begin(),v.end());
#define vr() sort(v.begin(),v.end(),greater<ll>());
#define mod 1000000007
#define fast() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
ll gcd(ll a, ll b){if(!b)return a;return gcd(b, a % b);}
ll power(ll x,ll y,ll p){ll res=1;x%=p;while(y>0){if(y&1)res=(res*x)%p;y=y>>1;x=(x*x)%p;}return res;}
int main() {
   /* #ifndef ONLINE_JUDGE
        // for getting input from input.txt
        freopen("input.txt", "r", stdin);
        // for writing output to output.txt
        freopen("output.txt", "w", stdout);
    #endif*/
        

fast();
//ll t;cin>>t;while(t--)
{
    ll n,s=0;
    cin>>n;
    map<ll,ll>m;
    for(int i=0;i<n;i++)
    {
        ll x;
        cin>>x;
        s+=x;
        m[x]++;
    }
    ll q;
    cin>>q;
    for(int i=1;i<=q;i++)
    {
        ll b,c;
        cin>>b>>c;
        ll temp=m[b]*b;
        s-=temp;
        ll tt=m[b]*c;
        s+=tt;
        ll fre=m[b];
        m[b]=0;
        m[c]+=fre;
        cout<<s<<endl;
        //for(auto t:m)
            //cerr<<t.fi<<" "<<t.se<<endl;
        //cerr<<endl;
    }
    
}
return 0;
}

Measured memory_bytes: 9500
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <string>
#include <numeric>
#include <limits>
#include <cmath>
#include <math.h>
#include <iomanip>
#include <unordered_map>

using namespace std;

void DFS(int vert, const vector<vector<int>>& edges, vector<pair<int, int>>& conectivity, bool roads, int con) {
    if (roads) {
        if (conectivity[vert].first == 0) {
            conectivity[vert].first = con;
            for (const auto & x: edges[vert]) {
                DFS(x, edges, conectivity, roads, con);
            }
        }
    } else {
        if (conectivity[vert].second == 0) {
            conectivity[vert].second = con;
            for (const auto & x: edges[vert]) {
                DFS(x, edges, conectivity, roads, con);
            }
        }
    }
}


int main() {
    int N, K, L;
    cin >> N >> K >> L;
    vector<vector<int>> roads(N);
    for (int i = 0; i < K; ++i) {
        int p, q;
        cin >> p >> q;
        roads[p - 1].push_back(q - 1);
        roads[q - 1].push_back(p - 1);
    }
    vector<vector<int>> railways(N);
    for (int i = 0; i < L; ++i) {
        int p, q;
        cin >> p >> q;
        railways[p - 1].push_back(q - 1);
        railways[q - 1].push_back(p - 1);
    }
    vector<pair<int, int>> conectivity(N);
    for (int i = 0; i < N; ++i) {
        DFS(i, roads, conectivity, 1, i + 1);
    }
    for (int i = 0; i < N; ++i) {
        DFS(i, railways, conectivity, 0, i + 1);
    }
   /* for (const auto & x: conectivity) {
        cout << x.first << " " <<x.second << '\n';
    } */
    vector<int> indexes(N);
    for (int i = 0; i < N; ++i) {
        indexes[i] = i;
    }
    vector<int> ans(N);
    sort(indexes.begin(), indexes.end(), [&conectivity](int a, int b) {return conectivity[a] < conectivity[b];});
    int i = 1;
    int cur_ans = 1;
    while (i < N) {
        while (i < N && conectivity[indexes[i]] == conectivity[indexes[i - 1]]) {
            ++i;
            ++ cur_ans;
        }
        if (i < N) {
            for (int k = i - 1; k >= i - cur_ans; --k) {
                ans[indexes[k]] = cur_ans;
            }
            cur_ans = 1;
            ++i;
        }
    }
    for (int k = i - 1; k >= i - cur_ans; --k) {
        ans[indexes[k]] = cur_ans;
    }
    for (const auto & x: ans) {
        cout << x << " ";
    }




    return 0;
}


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

typedef long long ll;
using namespace std;

ll gcd(ll a,ll b){
    if(a == 0) return b;
    else return gcd(b%a, a);
}
 
ll lcm(ll a,ll b){
    return b / gcd(a,b)*a;
}

int main()
{
    int n;
    ll ans;
    cin >> n;
    vector <ll> t(n, 0);
    for (int i = 0; i < n; i++) cin >> t[i];
    ans = t[0];
    for (int i = 1; i < n; i++) {
        ans = lcm(ans, t[i]);
    }

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


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define inf 1000000009
using namespace std;
int main()
{
    int n,k;
    double tmp=0,ans=0,a[200009];
    scanf("%d%d",&n,&k);
    for(int i=1;i<=n;i++)
    {
        double x;
        scanf("%lf",&x);
        a[i]=(1+x)/2.0;
    }
    for(int i=1;i<=k;i++)
    tmp+=a[i];
    ans=tmp;
    for(int i=2;i+k-1<=n;i++)
    {
        tmp=tmp-a[i-1]+a[i+k-1];
        ans=max(ans,tmp);
    }
    printf("%lf",ans);
    return 0;
}


Measured memory_bytes: 1792
#include<iostream>

using namespace std;

int main()
{
    cin.tie(0);
    int input;
    cin >> input;
    if(input <= 0)
    {
        cout << 0 << endl;
    }
    else
    {
        int x = input/500*1000;
        int y = (input%500)/5*5;
        cout << x+y << endl;
    }
    return 0;

}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
char s[100005];
int s1[200];
int main()
{
    
    int len;
    int flag=1;
    scanf("%s",s);
    len = (int)strlen(s);
    for(int i=0;i<len;i++){
        s1[s[i]]++;
    }
    for(int i=97;i<=122;i++){
        if(s1[i]==0){
            printf("%c\n",i);
            flag=0;
            break;
        }
    }
    if(flag==1){
        printf("None\n");
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>

using namespace std;

int main()
{
	int n, m;
	cin >> n >> m;
	int l, r;
	vector<int> v(n + 2, 0);
	for (int i = 0; i < m; i++) {
		cin >> l >> r;
		v[l]++;
		v[r+1]--;
	}
	
	int ans = 0;
	for (int i = 1; i <= n; i++) {
		v[i] += v[i - 1];
		if (m == v[i]) {
			ans++;
		}
	}
	cout << ans << endl;

	return 0;
}

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

int sum(int x)
{
  int b=10,s=0,i,q,ar[5],y;
  ar[0]=0;
  q=log10(x);
  if(q==log10(x))
  {
      y=log10(x)+1;
  }
  else
  {
     y=ceil(log10(x));
  }
  for(i=1;i<=y;i++)
  {
      ar[i]=((x%b)-ar[i-1])/(b/10);
      s=s+ar[i];
      b=b*10;
  }
  return s;
}

int main()
{
   int a,b,n,s=0,i;
   cin >> n >> a >> b;
   for(i=1;i<=n;i++)
   {
       if(sum(i)>=a&&sum(i)<=b)
       {
           s=s+i;
       }

   }
   cout << s;
   return 0;
}


Measured memory_bytes: 256
x,y=map(int,input().split())

A=[1,3,5,7,8,10,12]
B=[4,6,9,11]
C=[2]

ans="No"
if (x in A and y in A) or (x in B and y in B) or (x in C and y in C):
  ans="Yes"
print(ans)

Measured memory_bytes: 3060
// #pragma GCC target("avx2")  // CPU 処理並列化
// #pragma GCC optimize("O3")  // CPU 処理並列化
// #pragma GCC optimize("unroll-loops")  // 条件処理の呼び出しを減らす
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const double EPS=1e-10;
const double INF=1e+10;
const double PI=acos(-1.0);
const int C_SIZE = 3121000;
long long fact[C_SIZE];
long long finv[C_SIZE];
long long inv[C_SIZE];
long long Comb(int a,int b){
 	if(a<b||b<0)return 0;
 	return fact[a]*finv[b]%mod*finv[a-b]%mod;
}
void init_C(int n){
	fact[0]=finv[0]=inv[1]=1;
	for(int i=2;i<n;i++){
		inv[i]=(mod-(mod/i)*inv[mod%i]%mod)%mod;
	}
	for(int i=1;i<n;i++){
		fact[i]=fact[i-1]*i%mod;
		finv[i]=finv[i-1]*inv[i]%mod;
	}
}
long long pw(long long a,long long b){
	if(a<0LL)return 0;
	long long ret=1;
	while(b){
		if(b%2)ret=ret*a%mod;
		a=a*a%mod;
		b/=2;
	}
	return ret;
}
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}
double ABS(double a){return max(a,-a);}
// ここから編集しろ
char in[101000];
long long dp[101000][13];
int main(){
	scanf("%s",in);
	int n=strlen(in);
	dp[0][0]=1;
	for(int i=0;i<n;i++){
		for(int j=0;j<13;j++){
			if(in[i]=='?'){
				for(int k=0;k<10;k++){
					dp[i+1][(j*10+k)%13]=(dp[i+1][(j*10+k)%13]+dp[i][j])%mod;
				}
			}else{
				dp[i+1][(j*10+in[i]-'0')%13]=(dp[i+1][(j*10+in[i]-'0')%13]+dp[i][j])%mod;
			}
		}
	}
	printf("%lld\n",dp[n][5]);
}

Measured memory_bytes: 12416
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll arr[100005],n,k,ans=0;
int main() {
    cin>>n>>k;
    priority_queue<int> q; 
    for(int i=0;i<n;i++)
    {
        int a;
        cin>>a;
        q.push(a);
    }
    while(k--)
    {
        int a=q.top();
        a=a/2;
        q.pop();
        q.push(a);
    }
    while(!q.empty())
    {
        ans+=q.top();
        q.pop();
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 892
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); i++)
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define MOD 1000000007
using namespace std;
typedef long long ll;

int main(){
    string s, t;
    cin >> s >> t;
    if(s[0] == t[2] && s[1] == t[1] && s[2] == t[0]) puts("YES");
    else puts("NO");
    return 0;
}

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

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

int main()
{
	int h, w, k;
	cin >> h >> w >> k;
	vector<vector<int>> v(h, vector<int>(w, 0));
	for (int i = 0; i < h; i++)
	{
		for (int j = 0; j < w; j++)
		{
			char a;
			cin >> a;
			if (a == '#')
			{
				v[i][j] = 1;
			}
			else v[i][j] = 0;
		}
	}
	int cnt2 = 0;
	int bmax = 1 << (h + w);
	for (int b = 0; b < bmax; b++)
	{
		int cnt = 0;
		int bi = b;
		for (int i = 0; i < h; i++)
		{
			bool bi2 = bi % 2;
			bi = bi >> 1;
			if (bi2) continue;
			int bj = b >> h;
			for (int j = 0; j < w; j++)
			{
				bool bj2 = bj % 2;
				bj = bj >> 1;
				if (bj2) continue;
				if (v[i][j] == 1)
				{
					cnt++;
				}
			}
		}
		if (cnt == k)
		{
			cnt2++;
		}
	}
	cout << cnt2 << endl;
}

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

int n,a,l[100005];
int main(){
    cin>>n;
    for (int i=0; i<n; i++){
        cin>>a;
        l[a-1]=i+1;
    }
    for (int i=0; i<n; i++){
        cout<<l[i]<<' ';
    }
}


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

#define F first
#define S second

using namespace std;

typedef long long LL;
typedef pair<int, int> PII;
typedef priority_queue<int> HEAP;
typedef priority_queue<int, vector<int>, greater<int> > RHEAP;

const int N = 55, M = 1010;

LL k, n;
LL a[N];

int main()
{
	cin >> k;
	
	n = 50;
	for (int i = 1; i <= n; i ++ ) a[i] = i - 1;
	
	LL c = k / n, r = k % n;
	for (int i = 1; i <= n; i ++ ) a[i] += c;
	for (int i = n - r + 1; i <= n; i ++ ) a[i] ++ ;
	
	cout << n << endl;
	for (int i = 1; i <= n; i ++ ) cout << a[i] << ' ';
	puts("");
	return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {

    Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        new Main().run();
    }

    void run() {
        int n = sc.nextInt();
        int[] arr = new int[n];
        for (int i=0; i<n; i++) arr[i] = sc.nextInt();

        Arrays.sort(arr);

        int cnt = 0;

        for (int i=0; i<n-1; i++) {
            if (arr[i]==arr[i+1]) cnt++;
        }

        if (cnt==0) {
            System.out.println("YES\n");
        } else {
            System.out.println("NO\n");
        }

    }

}


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

int main(){
  int seconds, hours, minutes;
  std::cin >> seconds;
  hours = seconds / (60 * 60);
  minutes = (seconds % (60 * 60) ) / 60;
  seconds = (seconds % (60 * 60) ) % 60;
  std::cout << hours << ':' << minutes << ':' << seconds << std::endl;
  return 0;
}

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

int main(){
    int N;
    cin >> N;
    long back;
    cin >> back;
    for(int i = 1; i < N; i++){
        long T;
        cin >> T;
        long min_num = max(back, T);
        long max_num = min(back, T);
        long r = max_num % min_num;
        while(r != 0){
            max_num = min_num;
            min_num = r;
            r = max_num % min_num;
        }
        back *= T / min_num;
    }
    cout << back << endl;
}



Measured memory_bytes: 256
# coding: utf-8
# Your code here!

N = int(input())
K = int(input())
x_list = [int(i) for i in input().split()]
dist = 0

for i in range(N):
    if abs(x_list[i] - K) >= x_list[i]:
        dist += 2 * x_list[i]
    else:
        dist += 2 * abs(x_list[i] - K)
print(dist)


Measured memory_bytes: 2940
using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Text;

class Program
{
    static void Main(string[] args)
    {
        // 入力
        var x = decimal.Parse(Console.ReadLine());

        decimal ans = Math.Ceiling(x / 11) * 2;
        if (x % 11 < 7 && x % 11 != 0)
        {
            ans -= 1;
        }
        Console.WriteLine(ans);
    }
}


Measured memory_bytes: 13140
fn read_stdin() -> String {
    use std::io::Read;
    let mut input = String::new();
    std::io::stdin().read_to_string(&mut input).unwrap();
    input
}

fn scan<'a, I: Iterator<Item = &'a str>, T: std::str::FromStr>(tokens: &mut I) -> T {
    tokens.next().unwrap().parse().ok().unwrap()
}

fn rep<T, F: FnMut() -> T>(n: usize, mut f: F) -> Vec<T> {
    (0..n).map(|_| f()).collect()
}

fn main() {
    let input = read_stdin();
    let tokens = &mut input.split_whitespace();
    let n: usize = scan(tokens);
    let p: Vec<i32> = rep(n, || scan(tokens));
    let q: Vec<i32> = rep(n, || scan(tokens));
    let ord_p = order(p);
    let ord_q = order(q);
    println!("{}", (ord_p - ord_q).abs());
}

fn order(p: Vec<i32>) -> i32 {
    let mut x = p.clone();
    x.sort();
    let mut count = 0;
    for i in p {
        for j in 0..x.len() {
            if x[j] == i {
                x.remove(j);
                if j > 0 {
                    count += j * factorial(x.len());
                }
                break;
            }
        }
    }
    count as i32
}

fn factorial(n: usize) -> usize {
    if n == 0 {
        1
    } else {
        n * factorial(n - 1)
    }
}

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

using namespace std;

int main() {
    int n, l;
    cin >> n >> l;
    vector<string> v;
    for (int i = 0; i < n; ++i) {
        string s;
        cin >> s;
        v.push_back(s);
    }
    sort(v.begin(), v.end());
    for (auto x: v) {
        cout << x;
    }
    cout << endl;
    return 0;
};


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

struct edge
{
    int from, to, w;
};
bool cmp(const edge &x, const edge &y)
{
    return x.w < y.w;
}
int group[10001];
int u, v, w;
int n, m;
// vector<edge> E;
inline int find_root(int v)
{
    if (v == group[v])
        return v;
    return group[v] = find_root(group[v]);
}
inline void Union(int a, int b)
{
    group[find_root(a)] = find_root(b);
}
int main()
{
    int cnt = 0;
    while (cin >> n >> m)
    {
        // MST.clear();
        bool flag = false;
        int ans = 100000;
        int cost = 0;
        if (n == 0 && m == 0)
        {
            break;
        }
        edge E[m];
        for (int i = 0; i < m; ++i)
        {
            cin >> u >> v >> w;
            E[i] = {u, v, w};
        }
        sort(E, E + m, cmp);
        for (int j = 0; j < m; ++j)
        {
            cnt = 0;
            vector<edge> ST;
            for (int i = 1; i <= n; ++i)
                group[i] = i;
            for (int i = j; i < m; ++i)
            {
                int a = E[i].from;
                int b = E[i].to;
                if (find_root(a) != find_root(b))
                {
                    Union(a, b);
                    cost += E[i].w;
                    ST.push_back({a, b, E[i].w});
                    cnt++;
                    //cout << a << " " << b << "\n";
                    // cout << cnt << '\n';
                }
            }
            if (ST.back().w - ST.front().w < ans && cnt == n - 1)
            {
                ans = ST.back().w - ST.front().w;
                flag = true;
            }
            // cout << "\n";
        }
        // cout << cnt << "\n";
        if (flag)
            cout << ans << '\n';
        else
            cout << -1 << "\n";
    }
    return 0;
}


Measured memory_bytes: 3220
#include<iostream>
#include<algorithm>
#include<vector>
#include<string.h>
using namespace std;

int syc(long i,long Min,long Max){
	if(Min <= i && i <= Max){
		return 1;
	}else{
		exit(1);
		//return 0;
	}
}

int main(){
	
	int a,b;
	string s;
	cin >> a;
	syc(a,0,26);
	cin >> s;
	
	for(int i=0;i<s.length();i++){
		b = s[i]+a;
		//cout << b;
		if(b>90){
			s[i] = 'A' + ( b-90-1);
		}else{
			s[i] += a;
		}
		cout << s[i];	
	}
	
	return 0;
}


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

int main()
{   
    int n, m;
    int a, b;
    int i, j, k, l;
    int h_now = 0, w_now = 0;
    int h[1505], w[1505];
    int haba_h[1500000] = {};
    int haba_w[1500000] = {};
    int counter = 0;
    while(1){
        for(i = 0; i < 1500000; i++){
            haba_h[i] = 0;
            haba_w[i] = 0;
        }
        counter = 0;
        w_now = 0;
        h_now = 0;
        h[0] = 0;
        w[0] = 0;
        cin >> n >> m;
        if(n == 0 && m == 0){ break ;}
        
        //テッツスツ暗」ツ?ョテ・ツコツァテヲツィツ?
        for(i = 1; i <= n; i++){
            cin >> a;
        
        h_now = h_now + a;
        h[i] = h_now;
        }

        //wテ」ツ?ョテ・ツコツァテヲツィツ?
        for(i = 1; i <= m; i++){
            cin >> b;

            w_now = w_now + b;
            w[i] = w_now;
        }
        
        //テ・ツケツ?ゥツ?催・ツ按療」ツつ津」ツつ、テ」ツδウテ」ツつッテ」ツδェテ」ツδ。テ」ツδウテ」ツδ?
        for(i = 0; i < n; i++){
            for(j = i; j <= n; j++){
                haba_h[h[j] - h[i]]++;
            }
        }

        for(i = 0; i < m; i++){
            for(j = i; j <= m; j++){
                haba_w[w[j] - w[i]]++;
            }
        }

        for(i = 1; i < 1500000; i++){
            counter = counter + haba_h[i] * haba_w[i];
        }
        cout << counter << endl;
    }
    return 0;
}
       

    

Measured memory_bytes: 14780
#include <iostream>

using namespace std;

void solve()
{
	int aIn[3], aOut[3];
	int bIn[3], bOut[3];
	int cIn[3], cOut[3];
	cin >> aIn[0] >> aIn[1] >> aIn[2];
	cin >> aOut[0] >> aOut[1] >> aOut[2];
	cin >> bIn[0] >> bIn[1] >> bIn[2];
	cin >> bOut[0] >> bOut[1] >> bOut[2];
	cin >> cIn[0] >> cIn[1] >> cIn[2];
	cin >> cOut[0] >> cOut[1] >> cOut[2];
	int a = 0, b = 0, c = 0;
	a += 3600 * (aOut[0] - aIn[0]) + 60 * (aOut[1] - aIn[1]) + (aOut[2] - aIn[2]);
	cout << a / 3600 << " " << (a % 3600) / 60 << " " << (a % 3600) % 60 << endl;
	b += 3600 * (bOut[0] - bIn[0]) + 60 * (bOut[1] - bIn[1]) + (bOut[2] - bIn[2]);
	cout << b / 3600 << " " << (b % 3600) / 60 << " " << (b % 3600) % 60 << endl;
	c += 3600 * (cOut[0] - cIn[0]) + 60 * (cOut[1] - cIn[1]) + (cOut[2] - cIn[2]);
	cout << c / 3600 << " " << (c % 3600) / 60 << " " << (c % 3600) % 60 << endl;
}

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

Measured memory_bytes: 1160
# Author: cr4zjh0bp
# Created: Sat Mar  7 13:01:23 UTC 2020
import sys
 
stdin = sys.stdin
inf = 1 << 60
mod = 1000000007
 
ni = lambda: int(ns())
nin = lambda y: [ni() for _ in range(y)]
na = lambda: list(map(int, stdin.readline().split()))
nan = lambda y: [na() for _ in range(y)]
nf = lambda: float(ns())
nfn = lambda y: [nf() for _ in range(y)]
nfa = lambda: list(map(float, stdin.readline().split()))
nfan = lambda y: [nfa() for _ in range(y)]
ns = lambda: stdin.readline().rstrip()
nsn = lambda y: [ns() for _ in range(y)]
ncl = lambda y: [list(ns()) for _ in range(y)]
nas = lambda: stdin.readline().split()

a, b, c = na()

if a == b and b == c:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3064
#include <algorithm>
#include <climits>
#include <iostream>
#include <queue>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

int H, W;
int c[10][10];
int A[200][200];

int main() {
  cin >> H >> W;
  for (int i = 0; i < 10; i++) {
    for (int j = 0; j < 10; j++) {
      cin >> c[i][j];
    }
  }
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      cin >> A[i][j];
    }
  }

  int d[10];
  d[1] = 0;
  for (int i = 0; i < 10; i++) {
    if (i == 1)
      continue;

    int tmp[10];
    for (int j = 0; j < 10; j++)
      tmp[j] = INT_MAX;
    tmp[i] = 0;

    for (;;) {
      bool update = false;
      for (int j = 0; j < 10; j++) {
        for (int k = 0; k < 10; k++) {
          if (tmp[j] != INT_MAX && tmp[k] > tmp[j] + c[j][k]) {
            tmp[k] = tmp[j] + c[j][k];
            update = true;
          }
        }
      }
      if (!update)
        break;
    }
    d[i] = tmp[1];
  }

  int res = 0;
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      if (A[i][j] != -1) {
        res += d[A[i][j]];
      }
    }
  }
  cout << res << endl;

  return 0;
}


Measured memory_bytes: 3788
#include<iostream>
#include<cstdio>
#include<set>
using namespace std;
typedef long long ll;
int main()
{
    set<ll>s;
    set<ll>::iterator it;
    ll x,n;
    cin>>n;
    while (n--)
    {
        cin>>x;
        it = s.find(x);
        if (it!=s.end())
            s.erase(x);
        else
            s.insert(x);
    }
    cout << s.size() << endl;
}


Measured memory_bytes: 4864
'use strict'
function main(input) {
  input = input.split(/\n|\s/).map(v => ~~v)
  const n = input.shift()
  const arr = input.slice(0, -1)
  // let sorted = arr.slice(0)
  // mergeSort(sorted, 0, n) //arr.slice(0).sort((a, b) => a - b) //countingSort(arr)
  const sorted = [...arr].sort((a, b) => a - b) //countingSort(arr)
  const mid = sorted[n / 2]
  const mid2 = sorted[n / 2 - 1]
  //   console.log(arr, sorted, mid)

  const ans = []
  for (let i = 0; i < n; i++) {
    // if (arr[i] < mid) {
    //   ans.push(mid)
    // } else {
    //   ans.push(mid2)
    // }
    ans.push(arr[i] < mid ? mid : mid2)
  }
  console.log(ans.join('\n'))
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'))

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

int main(){
  int n;
  long long  sum=0;
  cin >> n;
  for(int i=1;i<=n;i++){
    if(i%3!=0&&i%5!=0) sum += i;
  }
  cout << sum << endl;
  return 0;
}


Measured memory_bytes: 3676
/*** 𝕒𝕜𝕤𝕙𝕒𝕪𝕜𝕦𝕞𝕒𝕣𝟡𝟡 ***/

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
template<typename T> using id_set = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update> ;
template<typename T> using id_setp = tree<pair<T,T>,null_type,less<pair<T,T>>,rb_tree_tag,tree_order_statistics_node_update> ;
 
#define f(i,x,n) for(i=x;i<n;i++)
#define fr(i,x,n) for(i=x;i>=n;i--)
#define pu push_back           
#define pp pop_back
#define F first
#define S second
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define SP(x) fixed<<setprecision(x)
#define IOS() ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
 
const long long MOD=1e9+7;
const long double PI = acos(-1);
const long long INF=INT_MAX;
const long long LINF=LLONG_MAX;
const long long N=2e3+1;
 
typedef long long ll;
typedef long double ld;

void test_case()
{
    ll n,m,i,j;
    ld sum=0;
    cin>>n>>m;
    vector<ld> a(n);
    f(i,0,n)
    {
        cin>>a[i];
        sum+=a[i];
    }
    ld req=(sum/(4.0*m));
    sort(rall(a));
    f(i,0,m)
    {
        if(a[i]<req)
        {
            cout<<"No\n";
            return;
        }
    }
    cout<<"Yes\n";
}

int main()
{
    IOS();
   
    int tc=1;
    // cin>>tc;
    while(tc--)
        test_case();
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	int a, b, c;
	scanf("%d %d %d", &a, &b, &c);
	if(a < b && b < c)
	{
	printf("Yes\n", a, b, c);
	}
	else
	{
	printf("No\n",a, b, c);
	}
	return 0;
}


Measured memory_bytes: 2044
from collections import Counter
n=int(input())
s_=input()
s=Counter(s_)
rgb = s['R'] * s['G'] * s['B']
cnt=0
for i in range(len(s_)):
  for j in range(i+1,len(s_)):
    h=j-i+j
    if h<n:
      if s_[i]!=s_[j] and s_[h]!=s_[j] and s_[i]!=s_[h]:
        cnt+=1

print(rgb-cnt)
    

Measured memory_bytes: 9492
#include <bits/stdc++.h>
using namespace std;
long long a[110];
int main(){
	int n;
	scanf("%d",&n);
	for(int i = 1;i <= n;i++){
		scanf("%d",&a[i]);
	}
	sort(a + 1,a + n + 1);
	printf("%d\n",a[n] - a[1]);
	return 0;
}

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

void solve()
{
	//Enter code here Tanmay::
	int c=0;
	string s,t;
	cin>>s>>t;
	for(int i=0;i<3;i++)
	{
		if(s.at(i)==t.at(i))
		c++;
	}
	cout<<c;
	
}

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int t=1;
//	cin>>t;
	while(t--)
	{
		solve();
	}
	return 0;
}
void fastscan(int &number) 
{ 
    //variable to indicate sign of input number 
    bool negative = false; 
    register int c; 
  
    number = 0; 
  
    // extract current character from buffer 
    c = getchar(); 
    if (c=='-') 
    { 
        // number is negative 
        negative = true; 
  
        // extract the next character from the buffer 
        c = getchar(); 
    } 
  
    // Keep on extracting characters if they are integers 
    // i.e ASCII Value lies from '0'(48) to '9' (57) 
    for (; (c>47 && c<58); c=getchar()) 
        number = number *10 + c - 48; 
  
    // if scanned input has a negative sign, negate the 
    // value of the input number 
    if (negative) 
        number *= -1; 
} 

Measured memory_bytes: 256
# D - Maze Master
from collections import deque


def bfs(start: int):
    queue = deque([start])
    dist = {start: 0}
    while queue:
        x = queue.popleft()
        for nx in (x + 1, x - 1, x + W, x - W):
            if maze[nx] and nx not in dist:
                dist[nx] = dist[x] + 1
                queue.append(nx)
    return max(dist.values())


def main():
    global H, W, maze
    H, W, *S = open(0).read().split()
    H, W = int(H) + 2, int(W) + 2
    maze = [0] * W  # flatten S and put sentinels
    for s in S:
        maze += [0] + [c == "." for c in s] + [0]
    maze += [0] * W
    ans = max(bfs(i) for i, x in enumerate(maze) if x)
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 3436
#include <bits/stdc++.h>
using namespace std;
const int N=1e5+5;
int a[N];
int main()
{
    int n,a;
    cin>>n>>a;
    cout<<(int)ceil(n*1.0/a)<<endl;
    //cout << "Hello world!" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl;
using namespace std;
int main() {
    int n,k;
    cin >> n;
    vector<vector<long long>> dp;
    dp.push_back({1000, 0, 1000, 0});
    for(int i = 0; i < n; i++) {
        long long a;
        cin >> a;
        vector<long long> cur(4), prev = dp[i];
        long long kabu = prev[0] / a;
        if(prev[3] < kabu) {
            cur[3] = kabu;
            cur[2] = prev[0] - kabu * a;
        } else if(kabu == prev[3] && prev[2] <= prev[0] - kabu * a) {
            cur[3] = kabu;
            cur[2] = prev[0] - kabu * a;
        } else {
            cur[3] = prev[3];
            cur[2] = prev[2];
        }
        if(prev[0] < cur[3] * a + cur[2]) {
            cur[0] = cur[3] * a + cur[2];
        } else {
            cur[0] = prev[0];
        }
        dp.push_back(cur);
    }
    cout << fixed << dp[n][0];
}


Measured memory_bytes: 3640
unittest
{
	assert( [ "4 5 8", "1 1", "1 4", "1 5", "2 3", "3 1", "3 2", "3 4", "4 4" ].parse.expand.solve == "0\n0\n0\n2\n4\n0\n0\n0\n0\n0" );
	assert( [ "10 10 20", "1 1", "1 4", "1 9", "2 5", "3 10", "4 2", "4 7", "5 9", "6 4", "6 6", "6 7", "7 1", "7 3", "7 7", "8 1", "8 5", "8 10", "9 2", "10 4", "10 9" ].parse.expand.solve == "4\n26\n22\n10\n2\n0\n0\n0\n0\n0" );
	assert( [ "1000000000 1000000000 0" ].parse.expand.solve == "999999996000000004\n0\n0\n0\n0\n0\n0\n0\n0\n0" );
}



import std.algorithm;
import std.conv;
import std.range;
import std.stdio;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto hwn = input.front.split.to!( long[] );
	auto abs = new long[ 2 ][ hwn[ 2 ] ];
	foreach( ref ab; abs )
	{
		input.popFront;
		ab = input.front.split.to!( long[] );
	}
	return tuple( hwn[ 0 ], hwn[ 1 ], abs );
}

auto solve( long h, long w, long[ 2 ][] abs )
{
	auto cs = new long[ 2 ][ abs.length * 9 ];
	auto ci = 0L;
	foreach( ab; abs )
	{
		auto ym = min( h - 2, ab[ 0 ] );
		auto xm = min( w - 2, ab[ 1 ] );
		for( auto y = max( 1L, ab[ 0 ] - 2 ); y <= ym; y++ )
		{
			for( auto x = max( 1L, ab[ 1 ] - 2 ); x <= xm; x++ )
			{
				cs[ ci ] = [ y, x ];
				ci++;
			}
		}
	}
	cs.length = ci;
	cs.sort();
	
	auto anss = new long[ 10 ];
	anss[ 0 ] = ( h - 2 ) * ( w - 2 );
	foreach( g; cs.group )
	{
		anss[ 0 ]--;
		anss[ g[ 1 ] ]++; 
	}
	return anss.to!( string[] ).join( "\n" );
}


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

int pow(long long m, long long n);

int main()
{
  long long m, n;
  cin >> m >> n;

  cout << pow(m, n) % 1000000007 << endl;

  return 0;
}

int pow(long long m, long long n)
{
  long long p = 1000000007;
  if (n == 1) return m;

  if (n % 2 == 1){
    return ((pow(m % p * m % p, n / 2)) % p * m % p);
  }
  return ((pow(m % p * m % p, n / 2) % p));
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
const long long INF = numeric_limits<long long>::max();
typedef long long ll;
int main(void)
{
    int a, b, c;
    cin >> a >> b >> c;
    cout << a * b / 2 << endl;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(void){

  int N;
  int count_a=0,count_w=0,count_t=0,count_r=0;
  char Result[4];

  scanf("%d",&N);

  if((1<=N)&&(N<=10*10*10*10*10)){


  for (int i = 0; i < N; i++) {
    scanf("%s",Result);

    if('A'==Result[0]){
      count_a++;
    }if('W'==Result[0]){
      count_w++;
    }if('T'==Result[0]){
      count_t++;
    }if('R'==Result[0]){
      count_r++;
    }

  }

  printf("AC x %d\n",count_a);
  printf("WA x %d\n",count_w);
  printf("TLE x %d\n",count_t);
  printf("RE x %d\n",count_r);


}


  return 0;
}


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

#define int long long
#define ll long long
#define ffor(i,n) for(int i = 0;i < (n); ++i)
#define fro(i,j,n) for(int i = (j);i < (n); ++i)
#define all(v) v.begin(),v.end()
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int,int>
#define vpii vector<pii>
#define ff first
#define ss second
const int mod = 1e9 + 7;
int add(int a,int b){
	return (a + b)%mod;
}
int sub(int a,int b){
	return add(a,mod - 1);
}
int mul(int a,int b){
	return (a*b)%mod;
}

signed main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
    int t;
    cin >> t;
    set<string> st;
    while(t--){
    	string s;
    	cin >> s;
    	st.insert(s);
    }
    cout << st.size();
}

Measured memory_bytes: 19296
H,W,M=map(int,input().split())
countH=[0]*(H+1)
countW=[0]*(W+1)
S={}
i=0
for _ in range(M):
    h,w=map(int,input().split())
    countH[h]+=1
    countW[w]+=1
    S[str(h)+','+str(w)]=1

mh=max(countH)
mw=max(countW)
ans=mh+mw-1

c_mh=[]
i=0
while i<=H:
    if countH[i]==mh:
        c_mh.append(i)
    i+=1

c_mw=[]
i=0
while i<=W:
    if countW[i]==mw:
        c_mw.append(i)
    i+=1

ok=0
ok1=0
ok2=0
for h in c_mh:
    for w in c_mw:
        S.setdefault(str(h)+','+str(w))
        if S[str(h)+','+str(w)]==1:
            continue
        else:
            ans+=1
            ok=1
        if ok:
            break
    if ok:
        break

print(ans)

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

void fnInput(vector<string>& rvsBoard)
{
  int nHigh, nWide;
  cin >> nHigh >> nWide;

  rvsBoard.resize(nHigh);
  for (int ny = 0; ny < nHigh; ny++)
    cin >> rvsBoard[ny];
}

int fnCountBomb(int ny, int nx, const vector<string>& cnrvsBoad)
{
  if (   ny >= 0  && ny < cnrvsBoad.size()
      && nx >= 0  && nx < cnrvsBoad[ny].size())
    if (cnrvsBoad[ny][nx] == '#')  return 1;
    else;

  return 0;
}

void fnMinesweeper(vector<string>& rvsBoard)
{
  const vector<int> cnvnDy = {-1, -1, -1,  0,  0,  1,  1,  1};
  const vector<int> cnvnDx = {-1,  0,  1, -1,  1, -1,  0,  1};
  for (int ny = 0; ny < rvsBoard.size(); ny++)
  {
    for (int nx = 0; nx < rvsBoard[ny].size(); nx++)
    {
      if (rvsBoard[ny][nx] == '.')
      {
        int nCount = 0;
        for (int i = 0; i < cnvnDy.size(); i++)
          nCount += fnCountBomb(ny + cnvnDy[i], nx + cnvnDx[i], rvsBoard);

        rvsBoard[ny][nx] = '0' + nCount;       // int → char 変換
      }
    }
  }
}

void fnResult(const vector<string>& cnrvsBoard)
{
  for (string sBoard : cnrvsBoard)
    cout << sBoard << endl;
}

int main()
{
  vector<string> vsBoard;

  fnInput(vsBoard);
  fnMinesweeper(vsBoard);
  fnResult(vsBoard);

  return 0;
}

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

using namespace std;

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

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

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

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

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

  cin >> a;
  a *= 2;
  double aa;
  aa = (double)a * M_PI;
  doublecout(aa);
  return 0;
}

Measured memory_bytes: 3840
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        String S = sc.next();
        String T = sc.next();
        String target = new String();
        for(int i = 0; i < N;i++){
            target += S.substring(i, i+1);
            target += T.substring(i, i+1);
        }
        System.out.println(target);
    }
}

Measured memory_bytes: 39268
import bisect

N = int(input())
L = sorted(list(map(int, input().split())))

res = 0
for i in range(N):
    for j in range(i+1, N):
        idx = bisect.bisect_left(L, L[i]+L[j])
        res += max(0, idx-j-1)

print(res)


Measured memory_bytes: 3188
package main

import (
    "fmt"
    "os"
    "bufio"
    "strconv"
    "sort"
)

var sc = bufio.NewScanner(os.Stdin)

func main() {
    sc.Split(bufio.ScanWords)

    x, y, z := nextInt(), nextInt(), nextInt()

    fmt.Println(z, x, y)
}


// Library

func nextLine() string {
    sc.Scan()
    return sc.Text()
}

func nextInt() int {
    sc.Scan()
    i, _ := strconv.Atoi(sc.Text())
    return i
}

func nextIntArr(n int) []int {
    var a []int
    for i := 0; i < n; i++ {
        a = append(a, nextInt())
    }
    return a
}

// 数値を桁区切りのスライスにする
func digit(n int, list []int) []int {
   if n > 0 {
       return digit(n/10, append(list, n%10))
   }
   return list
}

func sortIntsRev(list []int) {
    sort.Sort(sort.Reverse(sort.IntSlice(list)))
}

func strReverse(s string) string {
    runes := []rune(s)
    for i := 0; i < len(s)/2; i++ {
        runes[i], runes[len(s)-1-i] = runes[len(s)-1-i], runes[i]
    }
    return string(runes)
}



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

#define N 100000

int gcd(int a, int b)
{
  int temp;
  while (b != 0) {
    temp = a % b;
    a = b;
    b = temp;
  }
  return a;
}

int main(int argc, char *argv[])
{
  int n = 0;
  int x = 0;

  scanf("%d %d", &n, &x);

  int arr_x[N];
  char tmp;
  int i = 0;
  do {
    scanf("%d%c", &arr_x[i], &tmp);
    i++;
  } while (tmp != '\n');

  int arr_diff[N];
  for (i = 0; i < n; i++) {
    arr_diff[i] = abs(arr_x[i] - x);
  }

  int g = arr_diff[0];
  for (i = 1; i < n; i++) {
    g = gcd(g, arr_diff[i]);
  }

  printf("%d\n", g);

  return 0;
}


Measured memory_bytes: 896
import java.util.*;

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

		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		int D = sc.nextInt();
		int X = sc.nextInt();

		int[] array = new int[N];
		for (int i = 0; i < N; i++) {
			array[i] = sc.nextInt();
		}

		int total = X;

		for (int i = 0; i < N; i++) {
			for(int d = 0; d <= 100; d++){
				int day = 1 + array[i] * d;
				if(day <= D){
					total++;
				} else {
					break;
				}
			}
		}

		System.out.println(total);
	}
}


Measured memory_bytes: 21972
#include <cstdio>
#include <map>
#include <algorithm>

int main()
{
  int n, m;
  scanf("%d%d", &n, &m);
  std::map<long long, long long> map;
  for (int i = 0; i < n; ++i)
  {
    long long a;
    scanf("%lld", &a);
    map[a]++;
  }
  for (int i = 0; i < m; ++i)
  {
    long long b, c;
    scanf("%lld%lld", &b, &c);
    map[c] += b;
  }
  long long ans = 0;
  long long count = 0;
  for (auto it = map.rbegin(); it != map.rend() && count < n; ++it)
  {
    ans += std::min(it->second, n - count) * it->first;
    count += it->second;
  }
  printf("%lld\n", ans);
  return 0;
}

Measured memory_bytes: 12800