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

#ifdef LOCAL
#include "../dump.hpp"
#else
#define dump(...)
#endif

#define rep(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define ROF(i,a,b) for(int i=(a)-1;i>=(b);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend() //sortで大きい順
#define UNIQUE(v) v.erase(unique(all(v)),v.end())
#define SUM(a) accumlate(all(a),0)
#define pb push_back
#define fst first
#define snd second
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef long long ll;

main(){
  int n; cin >> n;
  set<char> st; char c;
  rep(i,n){ cin >> c; st.insert(c);}
  dump(st);
  if(st.size() == 3) cout << "Three\n";
  else cout << "Four\n";
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define all(v) v.begin(),v.end()
#define P pair<int,int>
#define len(s) (int)s.size()
#define pb push_back

template<class T> inline bool chmin(T &a, T b){
	if(a>b){a=b;return true;}
	return false;
}
template<class T> inline bool chmax(T &a, T b){
	if(a<b){a=b;return true;}
	return false;
}
constexpr int mod = 1e9+7;
constexpr int inf = 3e18;

int N;
P X[505];
int ans[500*505];
signed main(){
	cin>>N;
	REP(i,N+1){
		cin>>X[i].first;X[i].second=i;
		ans[X[i].first]=i;
	}
	sort(X+1,X+N+1);
	REP(i,N+1){
		int j=X[i].second-1,k=1;
		while(j&&k<X[i].first){
			if(!ans[k]){
				ans[k]=X[i].second;j--;
			}
			k++;
		}
		if(j){
			cout<<"No"<<endl;return 0;
		}
	}
	for(int i=N;i>0;i--){
		int j=N-X[i].second,k=N*N;
		while(j&&k>X[i].first){
			if(!ans[k]){
				ans[k]=X[i].second;j--;
			}
			k--;
		}
		if(j){
			cout<<"No"<<endl;return 0;
		}
	}
	cout<<"Yes"<<endl;
	REP(i,N*N+1)cout<<ans[i]<<" ";
	cout<<endl;
}


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

const ll LINF = 1e18;
const int INF = 1e9;
const ll MOD = 1000000007;

template<class T> inline bool chmin(T& a, T b){
    if(a > b){
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b){
    if(a < b){
        a = b;
        return true;
    }
    return false;
}
int main(){

    ll L, R;
    cin >> L >> R;
    R = min(R, L + 2019);
    int ans = 2018;
    for(ll i = L; i <= R; i++){
        for(ll j = i + 1; j <= R; j++){
            int x = i*j % 2019;
            ans = min(ans, x);
        }
    }
    cout << ans << endl;
    return 0;
}

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

int N;
vector<vector<vector<double>>> dp;

double solve(int ones, int twos, int threes) {
    if (ones < 0 || twos < 0 || threes < 0)
        return 0;

    if (ones == 0 && twos == 0 && threes == 0)
        return 0;

    double &answer = dp[ones][twos][threes];

    if (answer >= 0)
        return answer;

    double dishes = ones + twos + threes;
    answer = N / dishes +
             ones / dishes * solve(ones - 1, twos, threes) +
             twos / dishes * solve(ones + 1, twos - 1, threes) +
             threes / dishes * solve(ones, twos + 1, threes - 1);
    return answer;
}

int main() {
    scanf("%d", &N);
    int ones = 0, twos = 0, threes = 0;

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

        if (a == 1)
            ones++;
        else if (a == 2)
            twos++;
        else if (a == 3)
            threes++;
        else
            assert(false);
    }

    dp.assign(ones + twos + threes + 1, vector<vector<double>>(twos + threes + 1, vector<double>(threes + 1, -1)));
    printf("%.12lf\n", solve(ones, twos, threes));
}


Measured memory_bytes: 216960
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		try(Scanner sc = new Scanner(System.in)){
			while(sc.hasNext()) {
				int n = sc.nextInt();
				if(n==0)break;
				String str1 = "", str2 = "";
				int[] s1 = new int[10010];
				int[] s2 = new int[10010];
				int cnt;
				for(int i=0;i<n;i++) {
					str1 = sc.next();
					str2 = sc.next();
					
					s1[i] = ((str1.charAt(0)-'0')*10+(str1.charAt(1)-'0'))*3600; //発車時刻[s]
					s1[i] += ((str1.charAt(3)-'0')*10+(str1.charAt(4)-'0'))*60;
					s1[i] += ((str1.charAt(6)-'0')*10+(str1.charAt(7)-'0'));
					
					s2[i] = ((str2.charAt(0)-'0')*10+(str2.charAt(1)-'0'))*3600; //出発時刻[s]
					s2[i] += ((str2.charAt(3)-'0')*10+(str2.charAt(4)-'0'))*60;
					s2[i] += ((str2.charAt(6)-'0')*10+(str2.charAt(7)-'0'));
				}
					
				int max = 0;
				for(int i=0;i<=86400;i++) {									//1日86400秒
					cnt = 0;
					for(int j=0;j<n;j++) {
						if(s1[j] <= i && i < s2[j]) cnt++;
					}
					max = Math.max(max,cnt);
				}
				System.out.println(max);
			}
		}
	}
}




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

#include <math.h>
#include <stdlib.h>


#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;

template<class T> inline bool chmin(T &a, T b) { if(a > b){ a = b; return true; } return false; }
template<class T> inline bool chmax(T &a, T b) { if(a < b){ a = b; return true; } return false; }

//INT_MAX	2,147,483,647 = 2*1.0e9

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

    int len = s.length();
    int ans = len;
    
    for(int i = 0; i < s.length()-1; i++){
        if(s[i] != s[i+1]) ans = min(ans, max(i+1, len-i-1));
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 512
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author champon
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define inf 1e18
#define ceill(a, b) (a+b-1)/b
#define ok cout << "ok" << endl;
#define sp << " " <<
ll mod = 1e9+7;
void ans(bool b, ostream& out=cout){ out << (b ? "Yes" : "No") << endl; }
void ans2(bool b, ostream& out=cout){ out << (b ? "YES" : "NO") << endl; }
template<typename T> inline bool chmax(T &a, T b){ if(a<b) a=b; return a<b; }
template<typename T> inline bool chmin(T &a, T b){ if(b<a) a=b; return b<a; }
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val){fill((T*)array, (T*)(array+N), val);}
int dx[] = {1, 0, -1, 0, 1, -1, 1, -1};
int dy[] = {0, 1, 0, -1, 1, -1, -1, 1};

#ifndef INCLUDE_DEBUG_HPP
#define INCLUDE_DEBUG_HPP

class debug
{
public:
    template<typename T> void vdeb(T vec);
    template<typename T1, typename T2> void adeb(T1 *arr, T2 n);
    template<typename T> void mdeb(T mp);
};

#endif //INCLUDE_DEBUG_HPP

template<typename T> void debug::vdeb(T vec)
{
    cout << "#vector set debug" << endl;
    for(auto vv : vec) cout << vv << " ";
    cout << endl;
}

template<typename T1, typename T2> void debug::adeb(T1 *arr, T2 n)
{
    cout << "#adebug" << endl;
    for(int i=0; i<=n; i++) cout << arr[i] << " ";
    cout << endl;
}

template<typename T> void debug::mdeb(T mp)
{
    cout << "#map pair debug" << endl;
    for(auto const& m : mp) cout << m.first sp m.second << endl;
}
debug dbg;

class AInfiniteCoins {
public:
	void solve(std::istream& in, std::ostream& out)
	{
	    int n, a;
	    in >> n >> a;
	    int num = n %500;
	    if(num > a) ans(false, out);
	    else ans(true, out);
	}
};


int main() {
	AInfiniteCoins solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#define REP(i,n) for(int i=0;i<n;i++)

struct edge{
    int to;
    long long cost;
};

using namespace std;

//ダイクストラで多用する型
typedef pair<long long, int> P;//(その頂点までの距離,頂点)として使う。

vector<edge> G[100000];//頂点iから出る辺の配列G[i]の配列。
long long dist[100000];//特定の頂点から各頂点への距離が格納される。
bool used[100000];//dijkstra実行中に、頂点iまでの距離を確定したかどうかを持つ。

void dijkstra(int v){//vは始点。
    //以下のリンクでpriority_queueの使い方を参照
    //http://shirokurostone.hatenablog.com/entry/20110522/1306052844
    priority_queue<P, vector<P>, greater<P>> que;
    que.push(P(0, v));
    while(!que.empty()){
        P top = que.top();
        que.pop();
        int u = top.second;
        long long d = top.first;
        //cout << u << ' ' << d << endl;
        if(used[u]) continue;
        dist[u] = d;
        used[u] = true;
        for(int i = 0; i < G[u].size(); i++){
            if(!used[G[u][i].to]){
                que.push(P(d+G[u][i].cost, G[u][i].to));
                //cout << G[u][i].to << ' ' <<  d+G[u][i].cost << endl;
            }
        }
    }
}

int main(){
  
  int n,m;
  cin>>n>>m;
  int imos[n+1] = {};
  int l[m], r[m];
  long long c[m];
  REP(i,m){
    cin>>l[i]>>r[i]>>c[i];
    l[i]--;r[i]--;
    G[l[i]].push_back(edge{r[i], c[i]});
    imos[l[i]]++;
    imos[r[i]+1]--;
  }
  
  REP(i,n){
    if(i==0){
      continue;
    }else{
      imos[i] += imos[i-1];
    }
  }
  for(int i = 1; i<n; i++){
    if(imos[i-1] > 0 && imos[i] > 0){
      G[i].push_back(edge{i-1, 0LL});
    }
  }
  
  dijkstra(0);
  
  if(used[n-1]){
    cout<<dist[n-1]<<endl;
  }else{
    cout<<-1<<endl;
  }
  
      
  return 0;
}


Measured memory_bytes: 11764
#include <iostream>
#include <numeric>
#include <string>
#include <algorithm>
#include <vector>
#include <cstdlib>
 
#define repd(i,a,b); for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define ll long long int
 
 
using namespace std;
int main() {
  int x1,y1,x2,y2;
  cin >> x1 >> y1 >> x2 >> y2;
  cout << x2 + y1 - y2 << " " << y2 - x1 + x2 << " " << x1 + y1 - y2 << " " << y1 + x2 -x1;  
 
 return 0;
}

Measured memory_bytes: 256
n = int(input())

divisors = []
for i in range(1, int(n**0.5)+1):
	if n % i == 0:
		divisors.append(i)

#m = len(divisors)

#a = divisors[m//2-1]
#b = divisors[m//2]

a= max(divisors)
b=n//a
#print(a)
#print(b)
print(a+b-2)

Measured memory_bytes: 3060
import Control.Applicative
main = do
    [h, w] <- (map read . words) <$> getLine
    printARectangle h w

printARectangle :: Int -> Int -> IO()
printARectangle 0 0 = putStr ""
printARectangle h w
    | h == 0 = do
        putStrLn ""
        [h, w] <- (map read . words) <$> getLine
        printARectangle h w
    | otherwise = do
        putStrLn $ replicate w '#'
        printARectangle (h - 1) w

Measured memory_bytes: 4024
#!/usr/bin/env python
# encoding: utf-8

import sys


class Solution:
    def __init__(self):
        self.count = 0

    def shell_sort(self):
        array_length = int(input())
        # array = []
        # array_length = 10
        # array = [15, 12, 8, 9, 3, 2, 7, 2, 11, 1]
        array = list(map(int, sys.stdin.readlines()))

        G = [1]
        while True:
            g = G[0] * 3 + 1
            if g > array_length:
                break
            G.insert(0, g)

        g_length = len(G)
        result = []
        for j in range(g_length):
            result = self.insertion_sort(array=array, array_length=array_length, g=G[j])
            # print(result, 'r', G[j])

        print(g_length)
        print(" ".join(map(str, G)))
        print(self.count)
        for k in range(array_length):
            print(result[k])

    def insertion_sort(self, array, array_length, g):
        # write your code here

        for i in range(g, array_length):
            v = array[i]
            j = i - g
            while j >= 0 and array[j] > v:
                array[j + g] = array[j]
                j -= g
                self.count += 1
            array[j + g] = v

        # print(" ".join(map(str, array)))
        return array


if __name__ == '__main__':
    solution = Solution()
    solution.shell_sort()

Measured memory_bytes: 118508
N, D = map(int, input().split())
XList = list()

for x in range(N):
    X = list(map(int, input().split()))
    XList.append(X)

answer = 0

for i, x1 in enumerate(XList):
    for j, x2 in enumerate(XList):
        if i >= j:
            continue
        sumple = 0
        for d in range(D):
            sumple += (x1[d] - x2[d]) ** 2
        if abs((sumple ** 0.5 )- (sumple ** 0.5)//1) < 10**(-7):
            answer += 1

print(answer)

Measured memory_bytes: 3188
#include "bits/stdc++.h"
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <math.h>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair <ll, ll > pll;
//bool comp(
//
//	st pll &a, const pll &b) {
//	return a.first < b.first;
//}
//std::vector<int> enum_div(int n)//nの約数を列挙
//{
//	std::vector<int> ret;
//	for (int i = 1; i*i <= n; ++i)
//	{
//		if (n%i == 0)
//		{
//			ret.push_back(i);
//			if (i != 1 && i*i != n)
//			{
//				ret.push_back(n / i);
//			}
//		}
//	}
//	return ret;
//}

template<int N>
int factorial() {
	return factorial<N - 1>() * N;
}

template<>  /// 特殊化：factorial<N=”1”>だったら，値を返す
int factorial<1>() {
	return 1;
}

int main()
{
	priority_queue<int> q;
	ll h = 0, w = 0, k = 0, a = 0, b = 0, c = 0, d = 0, e = 0, f = 0, g = 0, ans = 0;
	string s = {};
	ll x[100005] = {};
	ll y[302][302] = {};
	cin >> s;
	for (int i = 0; i < s.length()/2; i++)
	{
		if (s[i]!=s[s.length()-i-1])
		{
			ans++;
		}
	}
	cout << ans << endl;

	//cout<<factorial<10><<endl;

	//cin >> a >> b;
	//for (int i = 0; i < a; i++)
	//{
	//	cin >> s[i];
	//	if (s[i] >= b)
	//	{
	//		ans++;
	//	}
	//}

	//cout << ans << endl;
	return 0;
}
//2つの組の数をソートしたりするやつ
//vector<pair<ll, ll> > hoges(a);
//for (int i = 1; i <= a; i++)
//{
//	cin >> h;
//	hoges[i - 1] = make_pair(h, i);
//}
//sort(hoges.begin(), hoges.end(), comp);
//for (int i = 0; i < a; i++)
//{
//	cout << hoges[i].second << endl;
//}


Measured memory_bytes: 256
#include<stdio.h>
 int main(void)
 {
     char S[100];
     int N,i,y=0;

     scanf("%d",&N);

     for(i=0;i<N;i++)
       scanf("%c",&S[i]);

     for(i=0;i<N;i++)
       if(S[i]=='Y') y++;

     if(y>0) printf("Four\n");
     else printf("Three\n");

     return 0;
 }


Measured memory_bytes: 128
n = gets.chomp.to_i
s = gets.chomp.split("")
red = 0
green = 0
blue = 0
n.times do |i|
    case s[i]
    when "R"
        red += 1
    when "G"
        green += 1
    when "B"
        blue += 1
    end
end
second_terms = 0

n.times do |i|
    ((i+1)...n).each do |j|
        next if s[i] == s[j]
        k = 2*j - i
        next if k >= n || s[i] == s[k] || s[j] == s[k]
        second_terms += 1
    end
end

puts red * green * blue - second_terms

Measured memory_bytes: 14360
import java.util.*;

public class Main {
	public static void main(String[] args) throws Exception{
		Scanner scn = new Scanner(System.in);
		int n = scn.nextInt();
      	int k = scn.nextInt();
      	int count = 1;
      	while(n>=k){
        	n/=k;
          	count++;
        }
      	System.out.println(count);
	}
}

Measured memory_bytes: 35712
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <queue>
#include <cstring>
#include <vector>
#include <map>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <bitset>
#include <set>
#include <deque>

using namespace std;

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define all(i,n) (i),(i+n)

int dx4[4]={1,0,-1,0};
int dy4[4]={0,-1,0,1};
int dx8[8]={1,0,-1,1,-1,1,0,-1};
int dy8[8]={1,1,1,0,0,-1,-1,-1};

typedef pair<int, int> P;
typedef pair<string, int> SP;
typedef long long ll;
typedef pair<ll, ll> PLL;

const int INF = 1e9;
const ll LLINF = 1e18;
const int MAX_V = 1e6+1;
const ll mod = 1000000007;

// --------------------------------------
int n;
int d;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  cin >> n >> d;

  ll ans = 0;
  REP(i, n) {
    long double a, b;
    cin >> a >> b;
    long double t = sqrt((a * a + b * b));
    if(t <= d) ans++;
  }
  cout << ans << endl;
}


Measured memory_bytes: 3872
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <algorithm>
using namespace std;
 
int main(){
  string temp;
  string x,y,z;
  cin >> x >> y >> z;
  temp=x[0];
  x=x.substr(1,x.size()-1);
  while(1){
    if(temp=="a"){
      if(x.size()==0){
        cout << "A" << endl;
        return 0;
      }
      temp=x[0];
      x=x.substr(1,x.size()-1);
    }
    else if(temp=="b"){
      if(y.size()==0){
        cout << "B" << endl;
        return 0;
      }
      temp=y[0];
      y=y.substr(1,y.size()-1);
    }
    else{
      if(z.size()==0){
        cout << "C" << endl;
        return 0;
      }
      temp=z[0];
      z=z.substr(1,z.size()-1);
    }
  }
  return 0;
}

Measured memory_bytes: 256
n,k = map(int,input().split())
p = [int(i)-1 for i in input().split()]
c = [int(i) for i in input().split()]

ans = -10**100

for i in range(n):
    chk = [0]*n
    chk[p[i]] = 1
    now = p[i]
    cnt = 1
    val = [-10**100]*n
    val[0] = c[p[i]]
    while 1 == 1:
        if cnt >= k:
            break
        #print(p[now])
        if chk[p[now]] == 1:
            break
        else:
            chk[p[now]] = 1
            val[cnt] = val[cnt-1]+c[p[now]]
            now = p[now]
            cnt += 1
    
    cnt -= 1
    
    #print(val)
    
    if val[cnt] <= 0:
        ans = max(ans,max(val))
    else:
        num = k // (cnt+1)
        amari = k % (cnt+1)
        #print(cnt,k)
        for j in range(cnt+1):
            if j < amari:
                tmp = num*val[cnt]
            else:
                tmp = (num-1)*val[cnt]
            ans = max(ans,tmp+val[j])
            #print(ans,tmp,val[j],j,cnt,num)
    
    #ans = max(ans,max(val))
    
print(ans)

Measured memory_bytes: 83948
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define rFOR(i,a,b) for(int i=a;i>=b;i--)
#define rep(i,b) FOR(i,0,b)
#define INF 1e9
#define dump(x) cerr<< #x << " = "<<(x)<<endl
#define int long long

using ll = long long;
const ll mod = 1000000000+7;

typedef pair<int,int> P;

int fact(int x){
  if(x==0)return 1;

  return (x*(fact(x-1))%mod)%mod;
}
signed main(){
  int n,m;
  cin>>n>>m;
  if(n<m)swap(n,m);
  if(n-1>m){
    cout<<0<<endl;
    return 0;
  }
  if(n-1==m){
    cout<<(fact(n)%mod)*(fact(m)%mod)%mod<<endl;
  }
  else{
    cout<<(fact(n)%mod)*(fact(m)%mod)*2%mod<<endl;
  }


}


Measured memory_bytes: 1792
#include <iostream>
using namespace std;
 
int main()
{
    while(true){
        int M, T, P, R;
        cin >> M >> T >> P >> R;
 
        if(M==0 && T==0 && P==0 && R==0)
            break;
 
        int CP[50], TT[50], PT[50][10];
        for(int i=0; i<T; i++){
            CP[i] = TT[i] = 0;
            for(int j=0; j<P; j++)
                PT[i][j] = 0;
        }
 
        for(int i=0; i<R; i++){
            int m, t, p, j;
            cin >> m >> t >> p >> j;
 
            if(j==0){
                CP[t-1]++;
                TT[t-1] += (m+PT[t-1][p-1]);
            }
            else{
                PT[t-1][p-1] += 20;
            }
        }
 
        int tnow, tpre = -1;
        bool flg[50];
        for(int i=0; i<T; i++)
            flg[i] = false;
 
        for(int i=0; i<T; i++){
            tnow = -1;
            for(int j=0; j<T; j++){
                if(flg[j])
                    continue;
 
                if(tnow==-1){
                    tnow = j;
                }
                else{
                    if(CP[j]>CP[tnow] || (CP[j]==CP[tnow] && TT[j]<=TT[tnow])){
                        tnow = j;
                    }
                }
            }
 
            if(tpre!=-1){
                if(CP[tnow]==CP[tpre] && TT[tnow]==TT[tpre])
                    cout << '=';
                else
                    cout << ',';
            }
            cout << tnow+1;
 
            flg[tnow] = true;
            tpre = tnow;
        }
        cout << endl;
    }
 
    return 0;
}


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

long long n, q, val[200005], ans[200005];
vector<int>adjl[200005];

void dfs(int now, int bef, long long add){
	add+=val[now];
	ans[now]=add;
	for (int i=0;i<(int)adjl[now].size();i++){
		if (adjl[now][i]==bef) continue;
		dfs(adjl[now][i],now,add);
	}
}

int main(){
	memset(val,0,sizeof val);
	cin >> n >> q;
	for (int i=0;i<n-1;i++){
		long long a, b;
		cin >> a >> b;
		adjl[a].push_back(b);
		adjl[b].push_back(a);
	}
	while (q--){
		int p, x;
		cin >> p >> x;
		val[p]+=x;
	}
	dfs(1,0,0);
	for (int i=1;i<=n;i++) cout << ans[i] << " ";
	cout << "\n";
}

Measured memory_bytes: 32128
#include <bits/stdc++.h> // {{{
using namespace std;
// clang-format off
#define ARG4(_1,_2,_3,_4,...) _4
#define rep(...) ARG4(__VA_ARGS__,FOR,REP)(__VA_ARGS__)
#define REP(i, a) FOR(i,0,a)
#define FOR(i, a, b) for(int i=(a);i<(int)(b);++i)
#define rrep(...) ARG4(__VA_ARGS__,RFOR,RREP)(__VA_ARGS__)
#define RREP(i, a) RFOR(i,0,a)
#define RFOR(i, a, b) for(int i=(b)-1;i>=(int)(a);--i)
#define ALL(c) begin(c),end(c)
#define pb emplace_back
#define em emplace
#define fi first
#define se second
#define USE1(...) template<typename __VA_ARGS__>inline
#define USE2(T, ...) USE1(T,typename __VA_ARGS__)

using ll=long long;
template<typename T>using vec=vector<T>;
USE2(T,U)bool chmax(T&x,U a){return x<a&&(x=a,1);}
USE2(T,U)bool chmin(T&x,U a){return a<x&&(x=a,1);}
USE1(T=int)T in(){T x;cin>>x;return x;}
USE2(T=int,V=vec<T>)V reserved(int n){V v;v.reserve(n);return v;}
USE1(T=int)vec<T>in(int n){auto v=reserved<T>(n);rep(i,n)v.pb(in<T>());return v;}
USE1(T)vec<T>ndvec(T&&v,int n){return vec<T>(n,v);}
USE2(T,...Ts)auto ndvec(T&&v,int n,Ts...ns)->vec<decltype(ndvec(v,ns...))>{return ndvec(ndvec(v,ns...),n);}
USE1(T)void pu(T&&x){cout<<x;}
USE1(T)void pr(T&&x){cout<<x<<'\n';}
USE2(T,...Ts)void pr(T&&x,Ts...xs){cout<<x<<' ';pr(xs...);}
USE2(T,U)void prif(bool b,T t,U f){if(b)pr(t);else pr(f);}
USE1(T)ostream&operator<<(ostream&o,vector<T>const&v){int f=0;for(auto&&x:v){if(f++)o<<' ';o<<x;}return o;}
// clang-format on
// }}}
struct IoSetup { // {{{
  IoSetup() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.precision(20);
    cout.setf(ios::fixed);
  }
} iosetup; //}}}
const int inf = 1001001001;
const ll infl = 1001001001001001001ll;
const int dd[] = {0, 1, 0, -1, 0};

int cnt[100100];

signed main() {
    int N = in();
    auto A = in(N);

    for (int a : A) {
        cnt[a]++;
        if (a) cnt[a - 1]++;
        cnt[a + 1]++;
    }

    pr(*max_element(cnt, cnt + 100001));
  return 0;
}


Measured memory_bytes: 1024
#include <stdio.h>
#include <utility>
#include <iostream>
#include <bitset>

#define max_n (1<<27)
using namespace std;

int N;
int dat[max_n];

int gcd(int _a , int _b){
    if(_a < _b) std::swap(_a, _b);
    if(_a % _b == 0){
        return _b;
    }else{
        return gcd(_b, _a % _b);
    }
}

void show(int _n){
    int step = 2;
    for(int i = 0; i < 2*_n -1; i++){
       cout << dat[i] << " ";
        if (i == 0){
            printf("\n");
        }else if( i % step== 0){
            printf("\n");
            step = 2*step + 2;
        }
    }
}
int query(int a, int b, int k, int l, int r){
    // printf("a = %d, b = %d, k = %d , l = %d, r = %d\n", a,b,k,l,r);
    if ( r <= a || b <= l){
        return -1;
    }
    if ( a <= l && r <= b){
        return dat[k];
    }else{
        int vl = query(a, b, k*2+1, l, (l+r)/2);
        int vr = query(a, b, k*2+2, (l+r)/2, r);
        // printf("vl = %d, vr = %d\n", vl,vr);
        if (vl == -1 && vr == -1){
            return -1;
        }else if(vl == -1){
            return vr;
        }else if(vr == -1){
            return vl;
        }else{
            return gcd(vl,vr);
        }
    }
}

int main(){
    cin >> N;
    int n = 1;
    while (n < N){n = 2*n;}
    for(int i = 0; i<n; i++){
        if (i < N){
            cin >> dat[n-1 + i];
        }else{
            dat[n-1 + i] = dat[n-1 + i-1] ;
        }
    }
    // show(n);

    for(int i = n-2; i>=0; i--){
        dat[i] = gcd(dat[2*i+1], dat[2*i+2]);
    }
    // show(n);

    int ans = 0;
    // printf(" solve \n");
    for(int i = 0; i<N; i++){
        // i を省いた時の値を調べていく
        // cout << "i : "<< i << endl;
        if (i==0){
            ans = max(ans, query(1, N, 0, 0, n));
        }else if(i==N-1){
            ans = max(ans, query(0, N-1, 0, 0, n));
        }else{
            ans = max(ans, gcd(query(0, i, 0, 0, n), query(i + 1, N, 0, 0, n)));
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4568
#include<iostream>
#include<string>
#include<string.h>
#include<algorithm>
#include<stdio.h>
#include<cmath>
#include<vector>
#include<utility>
#include<stack>
#include<queue>
#include<list>
#include<bitset>

#define FOR(i, a, b) for(int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for(int i=(a);i>=(b);i--)
#define MOD 1000000007
#define INF 1000000000

using namespace std;

int main(void) {
	string s;
	int a, b, c, d;
	int total;

	cin >> s;
	a = s[0] - '0';
	b = s[1] - '0';
	c = s[2] - '0';
	d = s[3] - '0';

	FOR(i, 0, 15) {
		total = a;
		bitset<3> bit(i);
		if (bit[0] == true) {
			total += b;
		}
		else {
			total -= b;
		}
		if (bit[1] == true) {
			total += c;
		}
		else {
			total -= c;
		}
		if (bit[2] == true) {
			total += d;
		}
		else {
			total -= d;
		}

		if (total == 7) {
			cout << a;
			if (bit[0] == true) {
				cout << "+";
			}
			else {
				cout << "-";
			}
			cout << b;
			if (bit[1] == true) {
				cout << "+";
			}
			else {
				cout << "-";
			}
			cout << c;
			if (bit[2] == true) {
				cout << "+";
			}
			else {
				cout << "-";
			}
			cout << d;
			cout << "=7" << endl;
			break;
		}

	}


	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
int n,m,i,j,k,count1=0,count2=0;
using namespace std;
void ABC120(void);
void ABC121(void);
void ABC122(void);
void ABC123(void);
void ABC124(void);
void ABC125(void);
void ABC126(void);
void ABC127(void);
void ABC128(void);
void ABC129(void);

int main(void){
    ABC123();
}

void ABC123(){
    int sum=0;
    vector<int>vec(5);
    for(i=0;i<5;i++){
        cin>>vec[i];
        sum+=vec[i];
        if(vec[i]%10==0)vec[i]=0;
        else{
            vec[i]=10-vec[i]%10;
            sum+=vec[i];
        }
    }
    sort(vec.begin(),vec.end());
    reverse(vec.begin(),vec.end());
    cout<<sum-vec[0]<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define invrepr(i,a,b) for(int i=b-1;i>=a;i--)
#define invrep(i,n) invrepr(i,0,n)
#define repitr(itr,a) for(auto itr=a.begin();itr!=a.end();++itr)
#define P pair<int,int>
const int MOD=1e9+7;
const int INF=2e9;


struct UnionFind {
    vector<int> par;
    UnionFind(int N) : par(N) {
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) {
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) {
        int rx = root(x);
        int ry = root(y);
        if (rx == ry) return;
        par[rx] = ry;
    }

    bool same(int x, int y) {
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

int main() {
    ios_base::sync_with_stdio(false);

    int n,m;
    cin >> n >> m;
    vector<pair<int,P>> p(m);
    rep(i,m) {
        int s,t,d;
        cin >> s >> t >> d;
        p[i].first=d;
        p[i].second=make_pair(s,t);
    }
    sort(p.begin(),p.end());
    int cnt=0;
    UnionFind tree(n);
    ll ans=0;
    rep(i,m) {
        if (!tree.same(p[i].second.first,p[i].second.second)) {
            ans+=p[i].first;
            tree.unite(p[i].second.first,p[i].second.second);
        }
    }
    cout << ans << endl;


    return 0;   
}



Measured memory_bytes: 4268
#include <bits/stdc++.h>
#define int long long
using namespace std;

signed main(){
    int a,b,c,k,ans=0;
    cin>>a>>b>>c>>k;
    
    if(k>=a){
        ans+=a;
        k-=a;
    }
    else
        ans+=k;
        
    if(k>=b)
        k-=b;
    else{
        cout<<ans<<"\n";
        return 0;
    }
        
    ans-=k;
    cout<<ans<<"\n";
    return 0;
}

Measured memory_bytes: 3652
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
  ll x,y;
  cin>>x>>y;
  int ans=0;
  if(x%y==0){
    ans=-1;
  }
  ll n=1000000000000000000;
  for(ll i=x;i<n;i+=x){
    if(i%y==0){
      ;
    }
    else{
      ans=i;
      break;
    }
    if(ans){
      break;
    }
  }
  if(ans){
    cout<<ans<<endl;
  }
  else{
    cout<<-1<<endl;
  }
}

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

int main(){
    while(1){
        int h,m,s;
        cin >> h >> m >> s;
        if(h==-1) break;
        int t = 120*60 -h*3600 -m*60 -s;
        printf("%02d:%02d:%02d\n", t/3600, (t/60)%60, t%60);
        t *= 3;
        printf("%02d:%02d:%02d\n", t/3600, (t/60)%60, t%60);
    }
    return 0;
}



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

#define ll unsigned long long
#define fornum(A,B,C) for(A=B;A<C;++A)
#define pii pair<int,int>
#define pll pair<ll,ll>

using namespace std;

/////////////////////////////////////////////////////

ll N;
ll S[555], T[555];
ll U[555], V[555];
ll  mks[555],mkt[555];
ll A[555][555];
ll i, j, k;

void outpt(){
    fornum(i,0,N){
        ll a = A[i][0];
        fornum(j,1,N){
            if(S[i]==0){
                a &= A[i][j];
            }else{
                a |= A[i][j];
            }
        }
        if(a!=U[i]){
            break;
        }
        a = A[0][i];
        fornum(j,1,N){
            if(T[i]==0){
                a &= A[j][i];
            }else{
                a |= A[j][i];
            }
        }
        if(a!=V[i])
            break;
    }
    if(i<N){
        printf("-1\n");
        return;
    }
    fornum(i,0,N){
        fornum(j,0,N){
            cout << A[i][j]<<" ";
        }
        cout << endl;
    }
}


int main(){
    cin>>N;
    fornum(i,0,N){
        cin>>S[i];
    }
    fornum(i,0,N){
        cin>>T[i];
    }
    fornum(i,0,N){
        cin>>U[i];
    }
    fornum(i,0,N){
        cin >> V[i];
    }
    //r&
    fornum(i,0,N){
        if(S[i]==1)
            continue;
        fornum(j,0,N){
            A[i][j] |= U[i];
        }
    }
    //c&
    fornum(i,0,N){
        if(T[i]==1)
            continue;
        fornum(j,0,N){
            A[j][i] |= V[i];
        }
    }
    //r|
    k = 0;
    fornum(i,0,N){
        if(S[i]==0)
            continue;
        fornum(j,0,N){
            if(T[j]==1){
                A[i][j] = U[i] & V[j];
            }
        }
        ll aa = 0;
        fornum(j,0,N){
            aa |= A[i][j];
        }
        if((aa&U[i])!=U[i]){
            ll a = 1e9, b = 1e9;
            fornum(j,0,N){
                if(T[j]==0){
                    if(a==1e9)
                        a = j;
                    b = j;
                }
            }
            if(a==1e9)
                continue;
            ll c = (aa & U[i]) ^ U[i];
            if(k%2==0){
                A[i][a] |= c;
            }else{
                A[i][b] |= c;
            }
        }
        ++k;
    }
    k = 0;
    fornum(i,0,N){
        if(T[i]==0)
            continue;
        ll aa = 0;
        fornum(j,0,N){
            aa |= A[j][i];
        }
        if((aa&V[i])!=V[i]){
            ll a = 1e9, b = 1e9;
            fornum(j,0,N){
                if(S[j]==0){
                    if(a==1e9)
                        a = j;
                    b = j;
                }
            }
            if(a==1e9)
                continue;
            ll c = (aa & V[i]) ^ V[i];
            if(k%2==0){
                A[a][i] |= c;
            }else{
                A[b][i] |= c;
            }
        }
        ++k;
    }

    outpt();

    return 0;
}

Measured memory_bytes: 7756
import itertools
N, M = map(int, input().split())

ab_list = []
for _ in range(N):
    a, b = map(int, input().split())
    ab_list.append((a, b))

ab_list = sorted(ab_list)

res = M
ans = 0
for i in itertools.count(0):
    res -= ab_list[i][1]
    if res > 0:
        ans += ab_list[i][0] *  ab_list[i][1]
    else:
        ans += ab_list[i][0] * (ab_list[i][1] + res)
        break

print(ans)

Measured memory_bytes: 17800
import scala.io.StdIn.{readLine,readInt}

object Main {

  def main(args: Array[String]) = {
    val n = readInt
    val a = Array.ofDim[Int](4,3,10)

    1 to n foreach { _ =>
      val v = readLine.split(" ").map(_.toInt)
      a(v(0)-1)(v(1)-1)(v(2)-1) += v(3)
    }

    for(i <- 0 to 3) {
      for(j <- 0 to 2) {
        for(k <- 0 to 9) {
          print(" "+a(i)(j)(k))
        }
        println()
      }
      if(i<3) {
        println("####################")
      }
    }
  }
}

Measured memory_bytes: 44124
#include <cstdio>

using namespace std;

int main()
{
	int hand;
	
	while (scanf("%d", &hand) != EOF){
		int card[15] = {0};
		card[hand]++;
	
		for (int i = 0; i < 4; i++){
			scanf(",%d",&hand);
			card[hand]++;
		}
		
		int cnt = 0;
		int cast = 1;
	
		if (card[10] == 1 && card[11] == 1 &&card[12] == 1 &&card[13] == 1 &&card[1] == 1){
			cast = 5;
		}
		else {
		for (int i = 1; i <= 14; i++){
			
			if (cnt == 5) cast = 5;
			
			if (card[i] == 1) cnt++;
			else cnt = 0;
		
			if (card[i] == 4) cast = 7;
		
			else if (card[i] == 3){
				for (int j = 1; j < 14; j++){
					if (card[j] == 2){
						cast = 6;
					}
				}
				if (cast == 6);
				else cast = 4;
			}
		
			else if (card[i] == 2){
				for (int j = 1; j < 14; j++){
					if (card[j] == 3){
						cast = 6;
					}
				}
				if (cast == 6);
				else if (cast == 2) cast = 3;
				else cast = 2;
			}
		}
		}
		if (cast == 7) printf("four card\n");
		else if (cast == 6) printf("full house\n");
		else if (cast == 5) printf("straight\n");
		else if (cast == 4) printf("three card\n");
		else if (cast == 3) printf("two pair\n");
		else if (cast == 2) printf("one pair\n");
		else if (cast == 1) printf("null\n");
	}
	
	return (0);
}

Measured memory_bytes: 1012
object Main {
  def main(args: Array[String]): Unit = {
    solve
  }

  def solve(): Unit = {
    val sc = new java.util.Scanner(System.in)
    val n = sc.nextLong
    val abcde = new Array[Long](5)
    for (i <- 0 until 5) {
      abcde(i) = sc.nextLong
    }
    println((n-1) / abcde.min + 5)
//    if (n <= abcde.min) println(5)
//    else {
//      if (n % abcde.min == 0) println(5L + n / abcde.min - 1)
//      else println(5L + n / abcde.min)
//    }
  }
}


Measured memory_bytes: 27296
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int n;
int main(){
	cin >>n;
	for(register int i=1;i<=9;i++){
		for(register int j=1;j<=9;j++){
			if(i*j==n){
				cout<<"Yes"<<endl;return 0;
			}
		}
	}
	cout<<"No"<<endl;
}
 

Measured memory_bytes: 256
#include <iostream>  
#include <cstring>  
#include <string>  
#include <cstdio>  
#include <cmath>  
#include <algorithm>  
#include <vector>  
#include <queue>  
#include <map>  
#define inf 0x3f3f3f3f  
using namespace std;  
  
int dx[]={1,-1,0,0};  
int dy[]={0,0,1,-1};  
char ma[105][105];  
int h,w,vis[105][105];  
  
void dfs(int x,int y,char c)  
{  
    int i,xx,yy;  
    for(i=0;i<4;i++)  
    {  
        xx=x+dx[i];  
        yy=y+dy[i];  
        if(xx>=0&&xx<h&&yy>=0&&yy<w&&!vis[xx][yy]&&ma[xx][yy]==c)  
        {  
            vis[xx][yy]=1;  
            dfs(xx,yy,c);  
        }  
    }  
}  
  
int main()  
{  
    int i,j,ans;  
    while(scanf("%d%d",&h,&w)&&(h||w))  
    {  
        getchar();  
        for(i=0;i<h;i++)  
            scanf("%s",ma[i]);  
        memset(vis,0,sizeof vis);  
        ans=0;  
        for(i=0;i<h;i++)  
        {  
            for(j=0;j<w;j++)  
            {  
                if(!vis[i][j])  
                {  
                    ans++;  
                    dfs(i,j,ma[i][j]);  
                }  
            }  
        }  
        printf("%d\n",ans);  
    }  
    return 0;  
}

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

int main()
{
	int64_t n;
	cin >> n;
	vector<int64_t> bs(n - 1);
	for (auto &&b : bs)
	{
		cin >> b;
	}

	int64_t ans = bs[0] + bs[n - 2];

	for (int i = 1; i < n - 1; i++)
	{
		ans += min(bs[i - 1], bs[i]);
	}

	cout << ans << endl;

	return 0;
}

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

int gcd(int a, int b){
	if(b == 0)
		return a;
	else{
		N++;
		return gcd(b, a % b);
	}
}

int main() {
	int x, y;
	while(cin >> x >> y && (x || y)){
		N = 0;
		int a = max(x, y);
		int b = min(x, y);
		int ans = gcd(a, b);
		
		cout << ans << " " << N << endl;
	}
	return 0;
}

Measured memory_bytes: 1156
import sys
import numpy as np
input = sys.stdin.readline

n=int(input())
mon = list(map(int,input().split()))
kni = list(map(int,input().split()))
kill=0

for i in range(n):
    if kni[i]<=mon[i]:
        kill=kill+kni[i]
        mon[i]=mon[i]-kni[i]
    else:
        kill=kill+mon[i]
        if kni[i]-mon[i]<=mon[i+1]:
            kill=kill+kni[i]-mon[i]
            mon[i+1]=mon[i+1]-(kni[i]-mon[i])
        else:
            kill=kill+mon[i+1]
            mon[i+1]=0

print(kill)



Measured memory_bytes: 27616
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <sstream>
#include <iomanip>
#include <set>
#include <queue>
#include <stack>
#include <utility>
#include <stdio.h>
#include <unistd.h>
using namespace std;
typedef long long int ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define drep(i, n) for(int i = n - 1; i >= 0; i--)
#define itrep(itr, base) for (auto itr = base.begin(); itr != base.end(); itr++)
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define yes cout << "yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
#define no cout << "no" << endl
#define PI 3.14159265359

const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;
const int mod = 1000000007;

void P(int x) {cout << x << endl;}
void P(long x) {cout << x << endl;}
void P(double x) {cout << x << endl;}
void P(ll x) {cout << x << endl;}
void P(string x) {cout << x << endl;}
void P(char x) {cout << x << endl;}

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

int main() {
  ll n;
  cin >> n;
  vector<ll> v[3];
  rep (i, 3) {
    v[i] = vector<ll>(n);
    rep (j, n) {
      cin >> v[i][j];
    }
  }
  rep (i, 3) sort(v[i].begin(), v[i].end());

  ll ans = 0;
  rep (i, n) {
    ll ue = lower_bound(v[0].begin(), v[0].end(), v[1][i]) - v[0].begin();
    ll st = v[2].end() - upper_bound(v[2].begin(), v[2].end(), v[1][i]);
    ans += ue * st;
  }
  P(ans);


  return 0;
}



Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
map<string,int> m;
map<string,int>::iterator it;
int main()
{
	int n,z,i,ma=0;
	char sz[11];
	string str1;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s",sz);
		str1=sz;
		if(m.count(str1)==0)
			m[str1]=1;
		else
			m[str1]++;
	}
	scanf("%d",&z);
	for(i=0;i<z;i++)
	{
		scanf("%s",sz);
		str1=sz;
		if(m.count(str1)==0)
			m[str1]=-1;
		else
			m[str1]--;
	}
	for(it=m.begin();it!=m.end();it++)
	{	
		ma=max(ma,it->second);
	}	
	printf("%d",ma);
	return 0;
}

Measured memory_bytes: 384
use proconio::input;
use std::mem;

fn main() {
    input! {
        n: usize,
        r#as: [u64; n],
    }

    let mut x = 1000;
    let mut y = 0;
    let mut p = r#as[0] <= r#as[1];

    if p {
        x = 1000 % r#as[0];
        y = 1000 / r#as[0];
    }

    for i in 1..n {
        if p {
            if i == n - 1 || r#as[i] > r#as[i + 1] {
                x += r#as[i] * mem::replace(&mut y, 0);
                p = false;
            }
        } else {
            if i < n - 1 && r#as[i] < r#as[i + 1] {
                y += x / r#as[i];
                x %= r#as[i];
                p = true;
            }
        }
    }

    println!("{}", x);
}


Measured memory_bytes: 2160
"use strict";
var input = require("fs").readFileSync("/dev/stdin", "utf8");
var cin = input.trim().split(/ |\n/), cid = 0;

function main() {
    let K = +cin.shift();
    let S = cin.shift();
    if (S.length <= K) {
        console.log(S);
    } else {
        console.log(S.substring(0, K) + "...");
    }
}
main();

Measured memory_bytes: 29632
/* author   : mpily :-()
title : Competing.cpp
time :Sat May 16 10:36:41 2020

*/
#include<bits/stdc++.h>
using namespace std;
const int64_t mod = 1e9+7;

int main(){
	string s;
	cin >> s;
	map<char,int>j;
	for(auto a : s)
		j[a]++;
	if(j['A'] && j['B'])
		cout << "Yes\n";
	else
		cout << "No\n";
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include<iomanip>
using namespace std;

int main(){
  int M1,M2,D1,D2;
  
  cin >> M1;
  cin >> D1;
  cin >> M2;
  cin >> D2;


  if(M1!=M2){
    cout << 1;
  }
  else{
    cout << 0;
  }
  
  return 0;
}





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

const int MX = 100001;

int main(){
  int n;
  cin >> n;
  vector<int> d(n);
  rep(i,n) cin >> d[i];
  
  sort(d.begin(),d.end());

  int ans = 1;
  rep(i,n-1){
    if(d[i]<d[i+1]) ans++;
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 3632
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<string>
#include<cstring>
#include<sstream>
#define ll long long
using namespace std;
int main()
{
    ll n;
    cin>>n;
    if(n%2==0)
        cout<<n;
    else
        cout<<n*2;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <numeric>
#include <queue>
#include <utility>
#include <cmath>
#include <iomanip>
using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()

typedef long long lint;
typedef pair<int,int> P;

int main()
{

    int X,A;
    cin >> X >> A;



	lint ans;

	if(X<A) ans =0;
	else ans = 10;


	cout << ans << endl;





}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'
#define SPEED ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
signed main()
{
    SPEED;
    int n;
    cin>>n;
    int a[n],b[n],c[n],dp1[n]={0},dp2[n]={0},dp3[n]={0};
    for(int i=0;i<n;i++)
    {
        cin>>a[i]>>b[i]>>c[i];
    }
    dp1[0]=a[0];
    dp2[0]=b[0];
    dp3[0]=c[0];
    for(int i=1;i<n;i++)
    {
        dp1[i]=max(dp2[i-1],dp3[i-1])+a[i];
        dp2[i]=max(dp1[i-1],dp3[i-1])+b[i];
        dp3[i]=max(dp2[i-1],dp1[i-1])+c[i];
    }
    cout<<max({dp1[n-1],dp2[n-1],dp3[n-1]});
}

Measured memory_bytes: 8272
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<n; ++i)
#define rep1(i, n) for (int i=1; i<=n; ++i)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
using namespace std;
typedef long long ll;
constexpr ll  MOD = (1e9+7);
constexpr int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
constexpr int lcm(int a, int b) { return a / gcd(a, b) * b; }

template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
ll factorial(ll n, ll m=2) {
    // calculate n!
    m = max(2LL, m);
    ll rtn = 1;
    for (ll i=m; i<=n; i++) {
        rtn = (rtn * i) % MOD;
    }
    return rtn;
}
ll modinv(ll a, ll m) {
    ll b = m, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b;
        swap(a, b);
        u -= t * v;
        swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
ll modpow(ll a, ll n) {
    ll res = 1;
    while (n > 0) {
        if (n & 1)
            res = res * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return res;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    int n; cin >> n;
    vector<int> t(n);
    rep(i, n) cin >> t[i];
    int sum = accumulate(ALL(t), 0);
    int m; cin >> m;
    rep(i, m) {
        int p, x; cin >> p >> x; --p;
        cout << sum - (t[p] - x) << endl;
    }
    return 0;
}

Measured memory_bytes: 256
//For higher stack size use g++ -O2 -std=c++11 -Wall -Wl,--stack=268435456 a.cpp -o a.exe in cmd
    #include <bits/stdc++.h>
    #include <cstdio>
    #include <cstring>
    #include <cmath>
    #include <cstring>
    #include <chrono>
    #include <complex>
    #define ll long long
    #define ld long double
    #define vi vector<int>
    #define vll vector<ll>
    #define vvi vector < vi >
    #define pii pair<int,int>
    #define pll pair<long long, long long>
    #define mod 1000000007
    #define inf 1000000000000000001;
    #define all(c) c.begin(),c.end()
    #define mp(x,y) make_pair(x,y)
    #define mem(a,val) memset(a,val,sizeof(a))
    #define eb emplace_back
    #define pb push_back
    #define f first
    #define s second
    
    using namespace std;
    int main()
    {
        std::ios::sync_with_stdio(false);
        int T;
        map<string,int> mp;
        string s;
        cin>>T;
        // cin.ignore(); must be there when using getline(cin, s)
        while(T--)
        {
            cin>>s;
            mp[s]=1;
        }
        cout<<mp.size()<<endl;
        return 0;
    }


Measured memory_bytes: 19276
#include<stdio.h>
#include<stdlib.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))

ll a[100010];
ll m[100010];
ll p[100010];
int main(){
	int n,k;
	scanf("%d%d",&n,&k);
	rep(i,0,n)scanf("%lld",a+i);

	ll sum=0;
	rep(i,0,k)sum+=min(a[i],0);
	m[k-1]=sum;
	rep(i,k,n)m[i]=m[i-1]+min(a[i],0)-min(a[i-k],0);
	
	sum=0;
	rep(i,0,k)sum+=max(a[i],0);
	p[k-1]=sum;
	rep(i,k,n)p[i]=p[i-1]+max(a[i],0)-max(a[i-k],0);
	
	ll pp=0;
	rep(i,0,n)pp+=max(a[i],0);
	
	ll ans=pp;
	rep(i,k-1,n){
		ans=min(ans,p[i]);
		ans=min(ans,-m[i]);
	}
	printf("%lld\n",pp-ans);
	return 0;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef double D;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int,int> PII;
typedef pair<ll,ll> PLL;
 
#define rd(x) scanf("%d",&x)
#define rd2(x,y) scanf("%d %d",&x,&y)
#define rl(x) scanf("%lld",&x)
#define rl2(x,y) scanf("%lld %lld",&x,&y)
#define wd(x) printf("%d" ,x)
#define wd2(x,y) printf("%d %d",x,y)
#define wl(x) printf("%lld",x)
#define wl2(x,y) printf("%lld %lld",x,y)
#define PC(x) putchar(x)
#define GC() getchar()
#define NL printf("\n")
#define SP printf(" ")
 
#define SZ(a) (int)a.size()
#define ALL(a) a.begin(), a.end()
#define ITER(it,a) for (__typeof(a.begin()) it = a.begin(); it != a.end(); it++)
#define FILL(a,value) memset(a, value, sizeof(a))

#define F first
#define S second
#define MP make_pair
#define PB push_back

#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL)
#define fr(i,s,e) for(int i=s;i<e;i++)
#define frl(i,s,e) for(ll i=s;i<e;i++)
#define frr(i,s,e) for(int i=s-1;i>=e;i--)
#define frv(i,a) for(int i = 0;i<(int)a.size();i++)
#define frvr(i,a) for(int i = a.size()-1;i>=0;i--)
#define tr(i,a) for(typeof(a.begin()) i = a.begin(); i != a.end();i++)

#define mod 1000000007
#define maxn 100009
#define maxr 100009


int main(){
	//sstd::ios::sync_with_stdio(false); cin.tie(NULL);
	fastio
	string s,t;
	cin>>s>>t;
	ll ans=0,ns,nt,x=0;
	ns=SZ(s);
	nt=SZ(t);
	//map<char,VL> mp;
	string ss=s+s;
	vector<VI> mp(26,VI());
	fr(i,0,SZ(ss))
	{
		mp[ss[i]-'a'].PB(i);
	}
	fr(i,0,nt)
	{
		if(mp[t[i]-'a'].size()!=0)
		{
			//VI tmp=mp[t[i]-'a'];
			ll np=*lower_bound(ALL(mp[t[i]-'a']),x)+1;
			ans+=np-x;
			x=np;
			//VL::iterator lower;
			//ll x=ans%ns;
			// if(x==0)
			// {
			// 	if(s[ns-1]==t[i]&&ans!=0)
			// 		x=ns;
			// }
			// if(x==0&&ans!=0)
			// 	x=ns;
			// lower=lower_bound(ALL(tmp),x);
			// ll pos=lower-tmp.begin();
			// //cout<<x<<" : "<<tmp[pos]<<endl;
			// if(pos==SZ(tmp)||(tmp[pos]+1<x))
			// {
			// 	ans+=(ns-x)+tmp[0]+1;
			// 	x=tmp[0]+1;
			// }
			// else
			// {
			// 	ans+=(tmp[pos]-x+1);
			// 	x=tmp[pos]+1;
			// }
			if(x>=ns)x-=ns;
		}
		else
		{
			cout<<-1<<endl;
			return 0;
		}
	}
	cout<<ans<<endl;
	//return;
	return 0;
}

Measured memory_bytes: 1872