akhauriyash/Code-Regression huggingface dataset:
//package AtCoder;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.StringTokenizer;

public class Main {
	static int INF = (int) 1e9;
	static ArrayList<Integer>[] adjList;

	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		int l = sc.nextInt() , r = sc.nextInt() , d = sc.nextInt() , temp = l ;
		int res = 0;
		for( int i = l ; i <= r ;i++) {
			if( i%d == 0)res++;
		}
		System.out.println(res);
	}

	static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream system) {
			br = new BufferedReader(new InputStreamReader(system));
		}

		public Scanner(String file) throws Exception {
			br = new BufferedReader(new FileReader(file));
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public String nextLine() throws IOException {
			return br.readLine();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}

		public char nextChar() throws IOException {
			return next().charAt(0);
		}

		public Long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public boolean ready() throws IOException {
			return br.ready();
		}

		public void waitForInput() throws InterruptedException {
			Thread.sleep(3000);
		}
	}

	public static int gcd(int a, int b) {
		if (a == 0)
			return b;

		return gcd(b % a, a);
	}

	public static void shuffle(int[] a) {
		int n = a.length;
		for (int i = 0; i < n; i++) {
			int r = i + (int) (Math.random() * (n - i));
			int tmp = a[i];
			a[i] = a[r];
			a[r] = tmp;
		}
	}

	public static long square(long l) {
		return l * l;
	}
}


Measured memory_bytes: 32748
n = int(input())
l = list(map(int,input().split()))

c = 0

for i in range(n-2):
    for j in range(i,n-1):
        for k in range(j,n):
            if l[i] != l[j] and l[j] != l[k] and l[i] != l[k] and l[i]+l[j]>l[k] and l[i]+l[k]>l[j] and l[j]+l[k]>l[i]:
                c+=1


print(c)


Measured memory_bytes: 73680
#include<stdio.h>
int main(void)
{
    int n;
    scanf("%d",&n);
    if(100<=n)
    {
        int j=n%10;
        if(j==0||j==1||j==6||j==8)
        {
            printf("pon");
        }
        if(j==3)
        {
            printf("bon");
        }
        if(j==2||j==4||j==5||j==7||j==9)
        {
            printf("hon");
        }
    }
    else
    {
        int j=n%10;
        if(j==0||j==1||j==6||j==8)
        {
            printf("pon");
        }
        if(j==3)
        {
            printf("bon");
        }
        if(j==2||j==4||j==5||j==7||j==9)
        {
            printf("hon");
        }
    } 
}

Measured memory_bytes: 1684
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
typedef long long ll;
typedef pair<int,int> PII;
mt19937 mrand(random_device{}()); 
const ll mod=998244353;
int rnd(int x) { return mrand() % x;}
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
// head

const int N=201000;
char ss[N];
int s[N],t[N],ans[N],val[N],n,m;

int main() {
	scanf("%d",&n);
	scanf("%s",ss);
	rep(i,0,n) s[i]=ss[i]-'0';
	for (int d=1;d<=n;d++) if (n%d==0&&(n/d)%2==1) {
		for (int j=0;j<n/d;j++) for (int i=0;i<d;i++) {
			t[j*d+i]=(j%2==0)?s[i]:1-s[i];
		}
		ll c=0;
		rep(i,0,d) c=(c*2+s[i])%mod;
		if (VI(t,t+n)<=VI(s,s+n)) {
			c=(c+1)%mod;
		}
		val[m]=d;
		ans[m]=c;
		m++;
	}
	rep(i,0,m) rep(j,0,i) if (val[i]%val[j]==0) {
		ans[i]=(ans[i]+mod-ans[j])%mod;
	}
	ll ret=0;
	rep(i,0,m) ret=(ret+(ll)ans[i]*(2*val[i]))%mod;
	printf("%lld\n",ret);
}


Measured memory_bytes: 3624
#include<bits/stdc++.h>
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define MOD 1000000007
#define INF 1145141919
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define reprev(i,n) for(int (i)=(n-1);(i)>=0;(i)--)

using namespace std;

int main(void){
  int N,j;
  cin >> N;
  double V[N],ans=0;
  rep(i,N) cin >> V[i];
  sort(V,V+N);
  ans=V[0];
  for(j=1;j<N;j++){
    ans=(ans+V[j])/2;
  }
  printf("%.10lf\n",ans);
}
  

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

int a[100001] ;

int panduan(int a,int b,int c)
{
	if(a+b>c&&b+c>a&&c+a>b) return 1;
	else return 0;
}

int main(){
	
	int n;
	scanf("%d",&n);
	for(int i=1;i<=n;++i)
	{
		scanf("%d",&a[i]);
	}
	int ans=0;
	sort(a+1,a+n+1); 
	for(int i=1;i<=n;++i)
	{
		for(int j=i+1;j<=n;++j)
		{
			int it=lower_bound(a+1,a+n+1,a[i]+a[j])-a-2;
			if(it-j+1>0)
			{
				ans+=it-j+1;
			}
		}
	}
	printf("%d",ans);
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define scd(t) scanf("%d",&t)
#define scld(t) scanf("%ld",&t)
#define sclld(t) scanf("%lld",&t)
#define scc(t) scanf("%c",&t)
#define scs(t) scanf("%s",t)
#define scf(t) scanf("%f",&t)
#define sclf(t) scanf("%lf",&t)
#define MEM(a, b) memset(a, (b), sizeof(a))
#define ffor(i, j, k, in) for (int i=j ; i<k ; i+=in)
#define rfor(i, j, k, in) for (int i=j ; i>=k ; i-=in)
#define rep(i, j) ffor(i, 0, j, 1)
#define rrep(i, j) rfor(i, j, 0, 1)
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define FOREACH(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define IN(A, B, C) assert( B <= A && A <= C)
#define mp make_pair
#define pb push_back
//#define f first
//#define s second
#define inf (int)1e9
#define EPS 1e-9
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
#define read(type) readInt<type>()
#define trace1(x)                     cout <<#x<<": "<<x<< endl;
#define trace2(x, y)                 cout <<#x<<": "<<x<<" | "<<#y<<": "<<y<< endl;
#define trace3(x, y, z)              cout <<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl;
#define trace4(a, b, c, d)           cout <<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl;
#define trace5(a, b, c, d, e)        cout <<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<<": "<<e<<endl;
const double pi=acos(-1.0);
typedef pair<long long int,long long int> pii;
typedef long long ll;
typedef vector<long long int> vi;
typedef vector<string> vs;
typedef vector<pii> vpii;
typedef vector<vi> vvi;
typedef map<long long int,long long int> mpii;
typedef set<long long int> sei;
typedef multiset<long long int> msei;
typedef long int int32;
typedef unsigned long int uint32;
typedef long long int int64;
typedef unsigned long long int  uint64;
ll a[22][22];
ll n;
ll dp[(1<<22)];
ll use[21]={0};
ll find(ll mask,ll tp)
{
    if(mask==(1<<n)-1)
        return 1;
    ll i,j;
    if(dp[mask]!=-1)
        return dp[mask];
    ll cnt=0;
    for(i=0;i<n;i++)
    {
        ll k=mask&(1<<i);
        //trace3(i,a[tp][i],k)
        if(((mask&(1<<i))==0) && a[tp][i]==1)
        {
            (cnt+=find(mask|(1<<i),tp+1))%=MOD;
        }
    }
    dp[mask]=cnt;
    return cnt;
}
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(NULL);
    ll i,j,m;
    cin>>n;
    for(i=0;i<n;i++)
    {
        for(j=0;j<n;j++)
            cin>>a[i][j];
    }
    memset(dp,-1,sizeof(dp));
    cout<<find(0,0);
    return 0;
}

Measured memory_bytes: 33152
#pragma GCC optimize("Ofast")
/*#pragma GCC target("avx,avx2,fma")
#pragma GCC target ("sse4")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")*/
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
#define ld double 
#define rep(i,a,b) for(ll i=a; i<b; ++i)
#define BOOST std::ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pb push_back
#define all(v) v.begin(),v.end()
#define sl(a) a.size()
#define mod 1000000007 
#define lcm(a,b) (a*b)/__gcd(a,b)
#define MAX1 100006
#define f first
#define s second
#define pi 2*acos(0.0)
bool isPowerOfTwo (int x) {  return x && (!(x&(x-1)));  }
void solve()
{
    ll a,b,c,d;  cin>>a>>b>>c>>d;
    ll prod=max(a*c,a*d);
    prod=max(prod,max(b*c,b*d));
    cout<<prod;
}
int main()
{
    #ifndef ONLINE_JUDGE
    // for getting input from input.txt
    freopen("input.txt","r",stdin);
    //for getting error from error.txt
    freopen("error.txt", "w", stderr);
    // for writing output to output.txt
    freopen("output.txt","w",stdout);
    #endif
    BOOST
    int T=1;  //cin>>T;
    while(T--) solve();
    cerr<<"Time taken : "<<fixed<<setprecision(5)<<(float)clock()/CLOCKS_PER_SEC<<" secs"<<"\n";
    cerr<<"My CLOCKS_PER_SEC= "<<CLOCKS_PER_SEC<<"\n";
    return 0;
}

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

typedef long long ll;

int main() {
    int N, A;
    cin >> N;
    string ans = "APPROVED";
    rep(i, N) {
        cin >> A;
        if (A % 2 == 0 && A % 3 != 0 && A % 5 != 0) ans = "DENIED";
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define LOCAL
using namespace std;
template <typename A, typename B>
ostream& operator <<(ostream& out, const pair<A, B>& a) {
out << "(" << a.first << "," << a.second << ")";
return out;
}
template <typename T, size_t N>
ostream& operator <<(ostream& out, const array<T, N>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T>
ostream& operator <<(ostream& out, const vector<T>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T, class Cmp>
ostream& operator <<(ostream& out, const set<T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "}";
return out;
}
template <typename U, typename T, class Cmp>
ostream& operator <<(ostream& out, const map<U, T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& p : a) { out << (first ? "" : ", "); out << p.first << ":" << p.second; first = 0;} out << "}";
return out;
}
#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...) 42
#endif
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
const char* comma = strchr(names + 1, ',');
cerr.write(names, comma - names) << ": " << arg1 << " |";
__f(comma + 1, args...);
}
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
#define int long long
using P = pair<int,int>;
//#########################################
signed main(){
	string s;cin >> s ;
	int n = s.size();
	vector<int> res;
	rep(i,n){
		if(s[i] == 'S')res.push_back(i);
		else{
			if(res.size() == 0 || s[res.back()] == 'T')res.push_back(i);
			else if(s[res.back()] == 'S')res.pop_back();
		}


	}
	cout << res.size() << endl;
	return 0;
}

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

void print2d(vector<string> M){
    cout << endl;
    for(string s: M){
        cout << s << endl;
    }
}

int main(int argc, const char * argv[]) {
    
    while(true){
        int W, H;
        cin >> H >> W;
        if(W + H == 0){
            break;
        }
    
        // Map
        vector<string> M = vector<string>(H);
        
        for (int i=0; i<H; i++){
            cin >> M[i];
        }
        //print2d(M);
        
        // support map
        int S[H][W];
        for(int y=H-1; y>-1; y--){
            int cnt = 0;
            for(int x=W-1; x>-1; x--){
                if(M[y][x] == '.'){
                    cnt += 1;
                }else{
                    cnt = 0;
                }
                S[y][x] = cnt;
            }
        }
        
//        for(int y=0; y<H; y++){
//            cout << endl;
//            for(int x=0; x<W; x++){
//                cout << S[y][x];
//            }
//        }
        
        // solve
        int max_area = 0;
        for(int y=0; y<H; y++){
            for(int x=0; x<W; x++){
                if(M[y][x] == '.'){
                    int y_offset = 0;
                    int min_width = S[y][x];
                    while(y + y_offset < H && M[y + y_offset][x] == '.'){
                        if(S[y + y_offset][x] < min_width){
                            min_width = S[y + y_offset][x];
                        }
                        int area = min_width * (y_offset + 1);
                        if(area > max_area){
                            max_area = area;
                        }
                        
                        y_offset += 1;
                    }
                }
            }
        }
        cout << max_area << endl;
        
        
    }
    return 0;
}

Measured memory_bytes: 4216
function main(){
  var i = 0;
  while(true){
    var fieldInfo = input[i].split(' ');
    var width = fieldInfo[0] - 0;//toInt
    var height = fieldInfo[1] - 0;//toInt
 
    // 0 0が入力された
    if(!width && !height){
      break;
    }
 
    var start;
    var goal;
    var elem = [[],[],[],[],[]];
    for(var ei = 0;ei < 5; ei++){
      elem[ei].length = 0;
    }
     
    for(var y = 0; y < height; y++){
      i++;//1行進める
      for(var x = 0; x < width; x++){
        var c = input[i][x];
 
        switch(c){
        case 'S':
          start = pos(x, y);
          break;
        case 'G':
          goal = pos(x, y);
          break;
        case '.':
          break;
        default : // 入力値が正しいので、絶対に属性
          elem[c - 1][elem[c - 1].length] = pos(x, y);
          break;
        }
      }
    }
 
     
    var bestElement = -1;
    var distance = Infinity;
     
    // 属性ごとにループ
    for (var startElem = 0; startElem < 5; startElem++) {
      // DPの初期化 DP[属性][同じ属性内の連番]
      var dp = [[],[],[],[],[]];
      for(var h = 0; h < 5; h++){
        var hLength = elem[h].length;
        dp[h].length = hLength;
        for(var hidx = 0; hidx < hLength; hidx++){
          dp[h][hidx] = Infinity;
        }
      }
       
      // 最初に選んだパチモンから次に捕まえられる属性番号
      var first = (startElem + 1) % 5;
 
      var firstLength = elem[first].length;
      for (var j = 0; j < firstLength; j++) {
        // s→e1を計算
        dp[first][j] = dist(start, elem[first][j]);
      }
       
      // s->1->2->3->4->g
      // なので、ループは間の-> * 3分まわす
      for (var e = 0; e < 3; e++) {
        // ex->e(x+1)
        var now = (first + e) % 5;
        var next = (now + 1) % 5;
        var nowLength = elem[now].length;
        var nextLength = elem[next].length;
        for (var j = 0; j < nowLength; j++) {
          for (var k = 0; k < nextLength; k++) {
            dp[next][k] = min(
              dp[next][k],
              dp[now][j] + 
                  dist(elem[now][j], elem[next][k]));
          }
        }
      }
       
      var last = (first + 3) % 5;
      var lastLength = elem[last].length;
      for (var j = 0; j < lastLength; j++) {
        // e4->g
        var d = dp[last][j] + 
                    dist(elem[last][j], goal);
         
        if (d < distance) {
          distance = d;
          bestElement = startElem + 1;
        }
         
      }
       
    }
     
    if (distance == Infinity) {
      console.log("NA");
    } else {
      console.log(bestElement + " " + distance);
    }
 
    i++;
  }
   
 
}
 
function dist(from, to){
  return fabs((from >> 11) - (to >> 11)) + fabs((from & 2047) - (to & 2047));
}
 
function min(a1, a2){
  return a1 > a2 ? a2 : a1;
}
 
function pos(a, b){
  // 2^10 = 1024なので、下位10ビットでy座標を、上位ビットでx座標を表す
  return (a << 11) + b;
}

function fabs(a){
 var mask = a >> 31;
 return (a ^ (a >> 31)) - (a >> 31);
}
 
var
input = '';
 
process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', function(chunk) {
  input += chunk;
});
process.stdin.on('end', function() {
  input = input.split('\n');
  main();
});

Measured memory_bytes: 51456
#include<iostream>
#include<vector>
#include<algorithm>
#include<cctype>
#include<utility>
#include<string>

#define REP(n) for(int i = 0;i < n;i++)
#define LLREP(n) for(long long int  i = 0;i < n;i++)
typedef long long int ll;
using namespace std;
#define MAX_A 1000000007

int main(){

    vector<string> s(3);
    REP(3){
        cin >> s[i];
    }

    int now = 0,next = 0;
    while(!s[now].empty()){

        next = s[now][0]-'a';
        s[now].erase(s[now].begin());
        now = next;
    }

    if(now == 0){
        cout << "A" << endl;
    }else if(now == 1){
        cout << "B" << endl;
    }else{
        cout << "C" << endl;
    }


   

    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); i++)

using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using LLP = pair<ll, ll>;

// const int INF = (1 << 30) - 1;
// const ll LL_INF = (1LL << 62) - 1;
// const ll MOD = 1e9 + 7;
// const double PI = M_PI;

int N;
vector<int> a;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> N;
  a.resize(N);
  rep(i, N) { cin >> a[i]; }

  int sum = 0;
  rep(i, N) { sum ^= a[i]; }

  rep(i, N) {
    if (i != 0) {
      cout << " ";
    }
    cout << (sum ^ a[i]);
  }
  cout << endl;
  return 0;
}


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

int main() {
  int64_t a;
  string b;
  cin >> a >> b;
  int64_t answer = 1LL;
  int B = (b.at(0) - '0') * 100 + (b.at(2) - '0') * 10 + (b.at(3) - '0');//char型が内部で数字故3桁の整数に
  answer = a * (int64_t)B / 100; //10^15 * 10^3いかないくらい
  cout << answer;
}

Measured memory_bytes: 3636
#include <cstdio>

int main(){
    int h,w;
    scanf("%d %d",&h,&w);
    char s[h][w + 1];
    for(int i = 0; i < h; i++){
        scanf("%s",s[i]);
    }

    int count;
    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++){
            if(s[i][j] == '.'){
                count = 0;
                if(i - 1 >= 0 && j - 1 >= 0){
                    if(s[i - 1][j - 1] == '#'){
                        count++;
                    }
                }
                if(i - 1 >= 0){
                    if(s[i - 1][j] == '#'){
                        count++;
                    }
                }
                if(i - 1 >= 0 && j + 1 < w){
                    if(s[i - 1][j + 1] == '#'){
                        count++;
                    }
                }
                if(j - 1 >= 0){
                    if(s[i][j - 1] == '#'){
                        count++;
                    }
                }
                if(j + 1 < w){
                    if(s[i][j + 1] == '#'){
                        count++;
                    }
                }
                if(i + 1 < h && j - 1 >= 0){
                    if(s[i + 1][j - 1] == '#'){
                        count++;
                    }
                }
                if(i + 1 < h){
                    if(s[i + 1][j] == '#'){
                        count++;
                    }
                }
                if(i + 1 < h && j + 1 < w){
                    if(s[i + 1][j + 1] == '#'){
                        count++;
                    }
                }

                s[i][j] = '0' + count;
            }
        }
    }

    for(int i = 0; i < h; i++){
        printf("%s\n",s[i]);
    }

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
const int INF=1145141919,MOD=1e9+7;
const int64_t LINF=8931145141919364364,LMOD=998244353;
// const int dx[]={1,0,-1,0,1,1,-1,-1},dy[]={0,-1,0,1,1,-1,-1,1};

vector<int> edge[10010];
int num[10010];
void bfs(){
    rep(i,10010) num[i]=-1;
    queue<int> q;
    q.push(0);
    int idx=0;
    while(q.size()){
        int from=q.front(); q.pop();
        num[from]=idx;
        idx++;
        for(int to:edge[from]){
            if(num[to]==-1) q.push(to);
        }
    }
}
int main(){
    int n; cin>>n;
    rep(i,n-1){
        int a,b; cin>>a>>b;
        a--,b--;
        edge[a].push_back(b);
        edge[b].push_back(a);
    }
    int c[n]; rep(i,n) cin>>c[i];
    sort(c,c+n); reverse(c,c+n);
    bfs();
    int sum=0;
    rep(i,n-1) sum+=c[i+1];
    cout<<sum<<endl;
    for(int i=0;i<n;i++){
        cout<<c[num[i]]<<(i==n-1?"\n":" ");
    }
    return 0;
}


Measured memory_bytes: 1024
// https://atcoder.jp/contests/abc164/tasks/abc164_c

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

#define REP(i,n)   for(int i=0; i<(int)(n); i++)
#define FOR(i,b,e) for(int i=(b); i<=(int)(e); i++)
#define DEBUG 0
#if DEBUG
  #define DUMP(a) REP(_i, a.size()) cout << a[_i] << (_i + 1 == a.size() ? "\n" : " ")
  #define DUMP2D(b) REP(_j, b.size()) DUMP(b[_j]); cout << endl
#else
  #define DUMP(a)
  #define DUMP2D(b)
#endif

const int N_MAX = 2*1e5;

int N;
set<string> st;

int main() {
  cin >> N;
  REP(i, N) {
    string S;
    cin >> S;
    st.insert(S);
  }

  cout << st.size() << endl;
}


Measured memory_bytes: 19016
// https://atcoder.jp/contests/acl1/tasks/acl1_a

#include <atcoder/all>

#include "algorithm"
#include "bitset"
#include "cmath"
#include "functional"
#include "iomanip"
#include "iostream"
#include "map"
#include "numeric"
#include "queue"
#include "set"
#include "string"
#include "vector"
#define rep(i, to) for (ll i = 0; i < (to); ++i)
#define rep1(i, to) for (ll i = 1; i <= (to); ++i)
#define repf(i, from, to) for (ll i = from; i < (to); ++i)
#define repr(i, from) for (ll i = from - 1; i >= 0; --i)
#define all(vec) vec.begin(), vec.end()
#define unless(cond) if (!(cond))
#define fi first
#define se second
using namespace std;
using namespace atcoder;
using ll = long long;
using ld = long double;
template <typename T>
using V = vector<T>;
using VL = V<ll>;
template <typename T>
using VV = V<V<T>>;
using VVL = VV<ll>;
template <typename T>
using VVV = VV<V<T>>;
template <typename T, typename U>
using P = pair<T, U>;
using PL = P<ll, ll>;
using VPL = V<PL>;
template <typename T>
using asc_pq = priority_queue<T, V<T>, greater<T>>;

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

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

template <typename T>
inline ll len(V<T> arr) {
  return arr.size();
}

struct exit_exception : public std::exception {
  const char* what() const throw() { return "Exited"; }
};

template <typename T>
void drop(T res) {
  cout << res << endl;
  throw exit_exception();
}

const ll INF = 1e18;

void solve();

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

  try {
    solve();
  } catch (exit_exception& e) {
  }

  return 0;
}
#endif

void solve() {
  ll N;
  cin >> N;

  using PT = tuple<ll, ll, ll>;

  V<PT> points(N);

  VL y_to_i(N);

  rep(i, N) {
    ll x, y;
    cin >> x >> y;
    --x, --y;
    y_to_i[y] = i;
    points[i] = {x, y, i};
  }

  sort(all(points), [](PT a, PT b) {
    auto [ax, ay, ai] = a;
    auto [bx, by, bi] = b;
    return ax < bx;
  });

  dsu d(N);

  set<ll> ys;

  rep(i, N) {
    auto [x, y, pi] = points[i];

    ll merged_min_y = INF;

    for (auto it = ys.begin(); it != ys.end();) {
      auto s_y = *it;
      unless(s_y < y) break;
      d.merge(y_to_i[s_y], pi);
      chmin(merged_min_y, s_y);
      ys.erase(it++);
    }

    if (merged_min_y == INF) {
      ys.insert(y);
    } else {
      ys.insert(merged_min_y);
    }
  }

  rep(i, N) cout << d.size(i) << "\n";
}


Measured memory_bytes: 13668
/*
    Created by Ezio112
*/
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
#define inf ll(10e16)
#define mod ll(10e5+7)
#define ff first
#define ss second
ll power(ll a,ll b)
{
    if(!b)
        return 1;
    ll temp=power(a,b/2);
    if(b&1)
        return (temp*temp)*a;
    return (temp*temp);
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);


    ll t=1;
    //cin>>t;
    while(t--)
    {
        ll n;
        cin>>n;

        ll k=n%10;
        if(k==2 || k==4 || k==5 || k==7 || k==9)
        cout<<"hon";
        else if(k==0 || k==1 || k==6 || k==8)
        cout<<"pon";
        else cout<<"bon";
    }
    return 0;
}


Measured memory_bytes: 3600
#include<cstdio>
#include<cmath>
using namespace std;
#define N 3050
int n,l,v[N];
double pi=acos(-1),su[N][2],as1,as2;
int main()
{
	scanf("%d%d",&n,&l);l*=2;
	for(int i=1;i<=n;i++)scanf("%d",&v[i]),v[i]*=2,su[i][0]=su[i-1][0]+cos(pi*v[i]/l),su[i][1]=su[i-1][1]+sin(pi*v[i]/l);
	for(int i=1;i<=n;i++)
	for(int j=i+2;j<=n;j++)
	{
		long long su1=1ll*v[i]+v[j];
		if(su1<l)
		{
			int st=l-(l-su1)/2;
			double c1=cos(pi*st/l+1.5*pi),c2=sin(pi*st/l+1.5*pi);
			double v1=c1*(su[j-1][0]-su[i][0])-c2*(su[j-1][1]-su[i][1]),v2=c2*(su[j-1][0]-su[i][0])+c1*(su[j-1][1]-su[i][1]);
			double st1=cos(v[i]*pi*2/l)-cos(st*pi*2/l),st2=sin(v[i]*pi*2/l)-sin(st*pi*2/l);
			double le1=sqrt(st1*st1+st2*st2);
			v1*=le1,v2*=le1;
			v1+=cos(st*pi*2/l)*(j-i-1),v2+=sin(st*pi*2/l)*(j-i-1);
			as1+=v1,as2+=v2;
		}
		else
		{
			int st=(su1-l)/2;
			double c1=cos(pi*st/l+0.5*pi),c2=sin(pi*st/l+0.5*pi);
			double v1=c1*(su[j-1][0]-su[i][0])-c2*(su[j-1][1]-su[i][1]),v2=c2*(su[j-1][0]-su[i][0])+c1*(su[j-1][1]-su[i][1]);
			double st1=cos(v[i]*pi*2/l)-cos(st*pi*2/l),st2=sin(v[i]*pi*2/l)-sin(st*pi*2/l);
			double le1=sqrt(st1*st1+st2*st2);
			v1*=le1,v2*=le1;
			v1+=cos(st*pi*2/l)*(j-i-1),v2+=sin(st*pi*2/l)*(j-i-1);
			as1+=v1,as2+=v2;
		}
	}
	double st1=1.0*n*(n-1)*(n-2)/6;
	as1/=st1,as2/=st1;
	printf("%.15lf %.15lf\n",as1,as2);
}//

Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <chrono>
#include <random>

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

int main() {
	std::ios_base::sync_with_stdio(false); std::cin.tie(NULL);
	int n, k;
	std::cin >> n >> k;
	std::cout << n - k + 1 << '\n';
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ls(x) (x)<<1
#define rs(x) (x)<<1|1 
#define fast ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define mm make_pair
#define pi 2*acos(0.0)
#define lcm(a,b) (a*b)/__gcd(a,b)
#define Case(i,ans) cout<<"Case "<<i<<": "<<ans<<endl;
#define cp(i,ans) printf("%.if",ans);
#define cpp(i,ans) cout.precision(i);cout<<fixed<<ans<<endl;
#define pb(x) push_back(x)
#define lowbit(x) (x)&(-x)
#define out(x) {cout<<x<<endl;return 0;} 
#define all(v) v.begin(),v.end() 
#define eps 1e-8 
#define ll long long
#define ull unsigned long long
using namespace std;
const int mod=1e9+7;
const int inf=0x3f3f3f3f,maxn=1e5+100;
ll gcd(ll x,ll y){if(y==0) return x;else return gcd(y,x%y);} 
ll ksm(ll a,ll b){ll r=1;while(b){if(b&1) r=(r*a)%mod;a=a*a%mod;b>>=1;}return r;} 
int n,a,b,k,t;
int main()
{
	cin>>n>>a>>b;
	cout<<min(n*a,b)<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;
ll n;
int main(){
    cin >>n;
    vector <bool> check(n+1);
    check[1] = 1;
    for(int i=2;i<=n;i++){
        int v = i*i;
        while(v<=n){
            check[v] = 1;
            v *= i;
        }
    }
    for(int i=n;i>=1;i--){ 
        if(check[i]){
        cout <<i<<endl;
        return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    long long int l,r,l2,r2,diff,i,rival,j,j2,i2;
    int ans;
    cin >> l >> r;
    l2 = l%2019;
    r2 = r%2019;
    diff = r-l;
    if(diff>2019){
        diff=2019;
    }
    ans = (l2*r2)%2019;
    for(j=l2;j<=l2+diff-1;j++){
        j2=j%2019;
      for(i=j+1;i<=l2+diff;i++){
          i2=i%2019;
        rival = (j2*i2)%2019;
        if(ans > rival){
            ans = rival;
        }
        if(ans==0){
            break;
        }
      }
     if(ans==0){
            break;
     }
    }

    cout << ans << endl;

}

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

int main() {
    int n[3]; 
    cin >> n[0];
    cin >> n[1];
    cin >> n[2];

    cout << (n[0] + (n[1] - 1)) / n[1] * n[2] << endl;
    
    return 0;
}


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

int odd_digits(int x) {
    if (x <= 9 ||
        (100 <= x && x <= 999) ||
        (10000 <= x && x <= 99999))
    {
        return 1;
    }
    else
    {
        return 0;
    }
}

int main() {
    int N;
    cin >> N;
    int count = 0;
    for (int i = 1; i <= N; i++) {
        count += odd_digits(i);
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize(2)
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<set>
#define ll long long
#define maxn 1005
#define inf 1e9
#define pb push_back
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define per(i,a,b) for(int i=a;i>=b;i--)
using namespace std;

inline ll read()
{
	ll x=0,w=1; char c=getchar();
	while(c<'0'||c>'9') {if(c=='-') w=-1; c=getchar();}
	while(c<='9'&&c>='0') {x=(x<<1)+(x<<3)+c-'0'; c=getchar();}
	return w==1?x:-x;
}
const int N=4e3+10;
int last[N][3];
char s[N];
int a[N],n;
int main()
{
    cin>>n>>s+1;
    rep(i,1,n)
    {
        if(s[i]=='R') a[i]=0;
        if(s[i]=='G') a[i]=1;
        if(s[i]=='B') a[i]=2;
    }
    per(i,n,1){
        rep(j,0,2){
            last[i][j]=last[i+1][j];
        }
        last[i][a[i]]++;
    }

    ll ans=0;
    rep(i,1,n)
    {
        rep(j,i+1,n){
            if(a[i]==a[j]) continue;


            ans+=last[j+1][3-a[i]-a[j]];
            int len=j-i;
            if(j+len<=n&&a[j+len]==3-a[i]-a[j]) ans--;
            //printf("i:%d j:%d ans:%lld a[%d]:%d %d\n",i,j,ans,j+len,a[j+len],3-a[i]-a[j]);
        }
    }
    printf("%lld\n",ans);
}


Measured memory_bytes: 3772
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()

int main()
{
  string s;
  while(cin >> s){
    char a = s[0];
    char b = s[s.size() - 1];
    int n = s.size();
    if ((a == b && n % 2 == 0) || (a != b && n % 2 == 1))
      cout << "First" << endl;
    else
      cout << "Second" << endl;
  }
  return 0;
}


Measured memory_bytes: 512
using System;

namespace Alchemist
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            int[] v = new int[N];
            String input = Console.ReadLine();
            String[] spl = input.Split(' ');
            for(int i = 0; i <N; i++)
            {
                v[i] = int.Parse(spl[i]);
            }

            Array.Sort(v);
            double final = v[0];
            for(int i = 1; i < N; i++)
            {
                final = (final + v[i]) / 2;
            }
            Console.WriteLine(final);
        }
    }
}


Measured memory_bytes: 11092
/*
       This sky
       Is lonely and grey
       But every night I feel your gravity waves
       And the world is cold
       But it's beautiful
       I wish you were here now
       I miss your soul
       But you lost your light
       When the darkness called
       I still stand here waiting
       The last to fall
       The last to fall
       The last to fall
       The last to fall
                            */
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
template <typename X> ostream& operator << (ostream& x,const vector<X>& v){for(ll i=0;i<v.size();++i) x<<v[i]<<" ";return x;}
template <typename X> ostream& operator << (ostream& x,const set<X>& v){for(auto it:v) x<<it<<" ";return x;}
template <typename X, typename Y> ostream& operator << (ostream& x, const pair<X,Y>& v) {x<<v.ff<<" "<<v.ss;return x;}
template <typename T, typename S> ostream& operator << (ostream& os, const unordered_map<T, S>& v) { for (auto it : v) os << it.first << "=>" << it.second << endl; return os; }
struct pair_hash {inline std::size_t operator()(const std::pair<ll, ll> & v) const {return v.first*31+v.second;}};
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC targett("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define speed ios_base::sync_with_stdio(false);cin.tie(NULL)
#define pb push_back
#define fr first
#define sc second
#define tra(it,m) for(auto it=m.begin();it!=m.end();++it)
#define dbg(x) cout<<#x<<" = "<<x<<'\n';
#define fri(i,s,n) for(ll i=s;i<n;i++)
#define mod 1000000007
#define mod2 998244353
#define vct2 vector<vector<ll>>
#define vct vector<ll>
#define pll pair<ll,ll>
#define rz(n) resize(n)
#define all(v) v.begin(),v.end()
#define mkp make_pair
#define arrin(a,n) for(ll i = 0; i < n ; i++){cin>>a[i];}
#define arrout(a,n) for(ll i = 0;i < n; i++){cout<<a[i]<<" ";}
#define ex(s) cout<<s<<endl,exit(0);
#define inf 4e18
#define five 100005;
#define six 1000005;
#define printclock cerr<<"Time"<<1000*(ld)clock()/(ld)CLOCKS_PER_SEC<<"ms\n";
//_______________________________________________________________________________________
int main()
{
       char x;
       cin>>x;
       if(x >= 'a' && x <= 'z'){
              cout<<'a';
       }
       else{
              cout<<'A';
       }
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
#define rep(i, start, end) for (long long i = start; i < end; ++i)
#define repreverse(i, start, end) for (long long i = start; i >= end; --i)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define len(x) ((long long)(x).size())
#define lcm(a, b) ((a) / __gcd((a), (b)) * (b))
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using vllvll = vector<vll>;
using vc = vector<char>;
using pll = pair<ll, ll>;
template<class T> void print1d(T x,ll n=-1){if(n==-1)n=x.size();rep(i,0,n){cout<<x[i]<<' ';}cout<<'\n';}
template<class T> void print2d(T x,ll r=-1,ll c=-1){if(r==-1)r=x.size();if(c==-1)c=x[0].size();rep(i,0,r)print1d(x[i],c);}
template<class T, class U> bool haskey(T mp, U key) { return mp.find(key) != mp.end(); }
template<class T, class U> bool isin(T el, U container) { return find(all(container), el) != container.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; }
template<class T> bool even(T n) { return ! (n & 1); }
template<class T> bool odd(T n) { return n & 1; }
template<class T> ll rup(T a, T b) { return a % b ? a / b + 1 : a / b; }
template<class T> ld deg2rad(T deg) { return M_PI * deg / 180.0; }
template<class T> ld rad2deg(T rad) { return 180.0 * rad / M_PI; }
const long double pi = M_PI;
const long long big = 1LL << 50;
const long long inf = 1LL << 60;
const long long mod = 1e9 + 7;
ll intpow(ll a, ll n, ll _mod=numeric_limits<ll>::max()) { ll p=1; while (n) { if (n&1) p=p*a%_mod; a=a*a%_mod; n>>=1; } return p; } 
ll modc(ll a, char op, ll b, ll _mod=mod)
{
        a %= _mod; b %= _mod; ll res = 1;
        switch (op) {
        case '+': res = (a + b) % _mod; break;
        case '-': res = (a - b) % _mod; break;
        case '*': res = a * b % _mod; break;
        case '/': res = modc(a, '*', modc(b, '^', _mod-2, _mod), _mod); break;
        case '^': res = intpow(a, b, _mod); break;
        case 'P': rep(i, a-b+1, a+1) res = modc(res, '*', i, _mod); break;
        case 'C': res = modc(modc(a, 'P', b, _mod), '/', modc(b, 'P', b, _mod)); break;
        } 
        if (res < 0) { res += _mod; } return res;
}



int main()
{
        ll N, K;
        cin >> N >> K;
        ll red = N - K;

        rep(i, 1, K+1) {
            ll x = modc(red+1, 'C', i);
            x = modc(x, '*', modc(K-1, 'C', i-1));
            cout << x << endl;
        }
}


Measured memory_bytes: 3524
#include <algorithm>
#include <bitset>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstring>
#include <fstream>
#include <iostream>
#include <iomanip>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

const int MAX = 200007;
const int MOD = 1000000007;

void solve() {
    string s, t;
    cin >> s;
    cin >> t;
    bool ok = true;
    for (int i = 0; i < s.size(); i++) {
        if (s[i] != t[i]) {
            ok = false;
        }
    }
    cout << (ok ? "Yes" : "No");
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    //int tt; cin >> tt; for (int i = 1; i <= tt; i++) {solve(); cout << endl;}
    solve();
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vll = vector<long long>;
using vp = vector<pair<int, int>>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using vvll = vector<vector<long long>>;
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 (b<a) {a=b; return 1;} return 0;}

// int main() {
//     ios::sync_with_stdio(false);
//     cin.tie(0);
    
//     string s, t;
//     cin >> s >> t;
//     ll n = sz(s);
//     vvi cnt(26);
//     rep(i, n) {
//         cnt[s[i]-'a'].pb(i);
//     }
//     ll now = -1;
//     ll m = sz(t);
//     rep(i, m) {
//         int idx = t[i] - 'a';
//         if (sz(cnt[idx]) == 0) {
//             cout << -1 << endl;
//             return 0;
//         }
//         int x = upper_bound(cnt[idx].begin(), cnt[idx].end(), now%n) - cnt[idx].begin();
//         if (x == sz(cnt[idx])) {
//             now = (now + n) / n * n + cnt[idx][0];
//         } else {
//             now = now / n * n + cnt[idx][x];
//         }
//     }
//     cout << now+1 << endl;
// }


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

    string s, t;
    cin >> s >> t;
    int a = sz(s);
    int b = sz(t);
    s += s;
    vvi nex(2*a+1, vi(26));
    rep(j, 26) nex[2*a][j] = 2*a;
    for (int i = 2*a-1; i >= 0; --i) {
        rep(j, 26) nex[i][j] = nex[i+1][j];
        nex[i][s[i]-'a'] = i+1;
    }
    ll cur = 0;
    rep(i, b) {
        int c = t[i] - 'a';
        int x = cur % a;
        if (nex[x][c] == 2*a) {
            cout << -1 << endl;
            return 0;
        }
        cur += nex[x][c] - x;
    }
    cout << cur << endl;
}

Measured memory_bytes: 27116
#include <cstdio>
#include <iostream>
#include <cmath>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <memory.h>
#include <iomanip>
#include <bitset>
#include <list>
#include <stack>
#include <deque>

using namespace std;

#define mod 1000000007

int main()
{
	int n;
	string a, b, c;
	cin >> n >> a >> b >> c;
	int ans = 0;
	for(int i = 0; i < n; i++){
		if(a[i] == b[i] && b[i] == c[i]) continue;
		else if(a[i] == b[i] || b[i] == c[i] || c[i] == a[i]) ans++;
		else ans += 2;
	}
	cout << ans << endl;
}

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

int main(){
    int n;
    cin >> n;
    vector<int> data(n);
    int i;
    for(i = 0; i < n; i++){
        cin >> data.at(i);
    }
    vector<int> arr(0);
    for(int x : data){
        if(x % 2 == 0){
            arr.push_back(x);
        }
    }
    for(int x : arr){
        if(x % 3 != 0 && x % 5 != 0){
            cout << "DENIED" << endl;
            return 0;
        }
    }
    cout << "APPROVED" << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
    //#include <bits/stdc++.h>
    #include<vector>
    #include<algorithm>
    #include<string>
    #include<math.h>
    #include<sstream>
    #include<set>
    #include<map>
    using namespace std;
    #define INF 10000000;
    #define rep(i,n)for(int i=0;(i)<(int)(n);i++)
    #define vec(n) vector<int> vec(n)
    #define vvec(m,n) vector<vector<int>> vec(m,vector(n))

    int main(){
      long a,b,tmp,r,x;
      cin >> a >> b;
      x = a*b;
      
      if(a<b){
        tmp = a;
        a = b;
        b = tmp;
      }

      r = a%b;
      while(r != 0){
        a = b;
        b = r;
        r = a%b;
      }
      cout << x/b <<endl;
    }
    

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

using namespace std;

const string YES = "Possible";
const string NO = "Impossible";

int main() {
  int H, W;
  char a;
  cin >> H >> W;
  bool cond = true;
  set<int> s;
  for (auto i = 0; i != H; ++i) {
    for (auto j = 0; j != W; ++j) {
      cin >> a;
      if(a == '#' && !s.insert(i+j).second) {
        cond = false;
        break;
      }
    }
  }
  cout << (cond ? YES : NO) << endl;
}


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

using namespace std;

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


Measured memory_bytes: 3088
#include <bits/stdc++.h>
using namespace std;
#define dg(x) cerr << #x << " = " << x << endl;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()
#define F first
#define S second
#define forn(i, n) for (int i = 0; i < (int)n; i++)
#define fore(i, a, b) for (int i = (int)a; i <= (int)b; ++i)
#define pb push_back
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
int main()
{
#ifdef LOCAL
    //freopen("h.txt", "r", stdin);
    // freopen("main.out", "w", stdout);
#else
    ios::sync_with_stdio(0), cin.tie(0);
#define endl '\n'
#endif
    string s;
    cin >> s;
    int fullupper = 0;
    int fulllower = 0;
    bool fupper = 0;
    forn(i, sz(s))
    {
        if (s[0] >= 'A' && s[0] <= 'Z')fupper=1;
            if (s[i] >= 'A' && s[i] <= 'Z')
            {
                fullupper++;
            }
        if (s[i] >= 'a' && s[i] <= 'A')
        {
            fulllower++;
        }
    }
    forn(i,sz(s))s[i]=tolower(s[i]);
    if (s == "sunny")
    {
        if (fulllower == sz(s))
        {
            cout << "cloudy" << endl;
        }
        else if (fullupper == sz(s))
        {
            cout << "CLOUDY" << endl;
        }
        else if (fupper)
        {
            cout << "Cloudy" << endl;
        }
        else
        {
            cout << "cLOUDY" << endl;
        }
    }
    else if (s == "cloudy")
    {
        if (fulllower == sz(s))
        {
            cout << "rainy" << endl;
        }
        else if (fullupper == sz(s))
        {
            cout << "RAINY" << endl;
        }
        else if (fupper)
        {
            cout << "Rainy" << endl;
        }
        else
        {
            cout << "rAINY" << endl;
        }
    }else{
        if (fulllower == sz(s))
        {
            cout << "sunny" << endl;
        }
        else if (fullupper == sz(s))
        {
            cout << "SUNNY" << endl;
        }
        else if (fupper)
        {
            cout << "Sunny" << endl;
        }
        else
        {
            cout << "sUNNY" << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 256
import numpy as np

h, w = map(int, input().split())
max_value = h + w
values = []

for i in range(h):
    values.append([0 if i == '#' else max_value for i in list(input())])
values = np.array(values)
#print(values)
for x in range(w - 1):
    values[:, x+1] = np.minimum(values[:, x] + 1, values[:, x+1])
#print(values)
for x in range(w - 1, 0 , -1):
    values[:, x-1] = np.minimum(values[:, x-1], values[:, x] + 1)
#print(values)
for x in range(h - 1):
    values[x+1, :] = np.minimum(values[x, :] + 1,values[x+1, :])
#print(values)
for x in range(h - 1, 0, -1):
    values[x-1, :] = np.minimum(values[x, :] + 1, values[x-1, :])
#print(values)

print(np.max(values))

Measured memory_bytes: 28924
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define countof(array) (sizeof(array) / sizeof(array[0]))
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,n,s) for(int i = s; i < (n); ++i)
#define rsrep(i,n,s) for(int i = (n)-1; i >= s; --i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define aall(a) (a), (a)+countof(a)//for array sorting
#define raall(a) (a), (a)+countof(a), greater<>()
#define show(x) cout<<#x<<" = "<<x<<endl;
#define vfind(v, a) find(all(v), a) != v.end()
#define yn(f) { if (f) puts("YES"); else puts("NO"); }
#define yns(f) { if (f) puts("Yes"); else puts("No"); }
#define show_ary(...) { cout<<#__VA_ARGS__<<" = "; for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define show_pair(...) cout<<#__VA_ARGS__<<" = "<<endl; for (const auto& x : (__VA_ARGS__)) { cout<<"  "<<x.fi<<" : "<<x.se<<endl; }
#define out_ary(...) { for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define argmax(v) distance((v).begin(), max_element(all(v)))
#define argmin(v) distance((v).begin(), min_element(all(v)))
#define vmax(v) *max_element(all(v))
#define vmin(v) *min_element(all(v))
typedef long long int ll;
typedef pair<int, int> P;
typedef vector<P> vpair;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<double> vdouble;
typedef vector<string> vstr;
typedef vector<bool> vbool;
typedef vector<vint> vvint;
typedef vector<vll> vvll;
typedef vector<vstr> vvstr;
typedef vector<vbool> vvbool;
const ll LINF = 2000000000000000000ll;
const int INF = 1000000100;
const ll MOD = 1e9+7;

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

    int ans = pow(n, 3);

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

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

map<string, int> mp;

int main() {
  int n, p, m, k;
  string s, t;
  
  while(cin >> n, n) {
    mp.clear();
    for(int i=0; i<n; i++) {
      cin >> s >> p;
      mp[s] = p;
    }
    
    cin >> m;
    for(int i=0; i<m; i++) {
      cin >> s >> k;
      int temp = 0;
      for(int j=0; j<k; j++) {
	cin >> t;
	temp += mp[t];
      }
      if(temp<mp[s]) mp[s] = temp;
    }
    
    cin >> s;
    cout << mp[s] << endl;
  }
  
  return 0;
}

Measured memory_bytes: 1220
k, t = map(int, input().split())

A = list(map(int, input().split()))

A = list(reversed(sorted(A)))

left_sum = 0
right_sum = 0
for i in A:
    if left_sum < right_sum :
        left_sum += i
    else:
        right_sum += i

if abs(left_sum - right_sum) in [0, 1]:
    print(0)
else:
    a = abs(left_sum - right_sum) - 1
    print(a)

Measured memory_bytes: 3064