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

int n, q;
int trie[410000][26];
int len[410000][26];
int par[410000];
int let[410000];

int sz[410000];
int ok[410000]; // if it is a word
int num[410000]; // children
int v = 1;

string s[100000];
int cnt(int c){
	if(c == -1) return 0;
	for(int i = 0; i < 26; i++){
		sz[c] += cnt(trie[c][i]);
	}
	return sz[c];
}
void print(int c){
	for(int i = 0; i < 26; i++){
		if(trie[c][i] != -1){
			cout << c << " " << (char)('a'+i) << " " << trie[c][i] << " " << len[c][i] << endl;
			print(trie[c][i]);
		}
	}
}

int solve(int c, int a, string o, int cur){
	if(c == -1) return 0;
	if(cur == s[a].size()) return 1;
	int ans = 0;
	if(ok[c]) ans++;
	for(int i = 0; i < 26; i++){
		if(o[i] == s[a][cur]) break;
		if(trie[c][o[i]-'a'] == -1) continue;
		//cout << cur << " " << o[i] << endl;
		ans += sz[trie[c][o[i]-'a']];
	}
	return ans + solve(trie[c][s[a][cur]-'a'],a,o,cur+len[c][s[a][cur]-'a'] );
}
int main(){
	cin >> n;
	for(int j = 0; j < 26; j++) trie[0][j] = -1;
	for(int i = 0; i < 410000; i++){
		sz[i] = num[i] = ok[i] = 0;
		par[i] = -1;
	}

	for(int i = 0; i < n; i++){
		cin >> s[i];
		int cur = 0;
		for(int j = 0; j < s[i].size(); j++){
			if(trie[cur][s[i][j]-'a'] == -1){
				for(int k = 0; k < 26; k++){
					trie[v][k] = -1;
				}
				trie[cur][s[i][j]-'a'] = v;
				par[v] = cur;
				let[v] = s[i][j]-'a';
				len[cur][s[i][j]-'a'] = 1;
				num[cur]++;
	
				v++;
			}
			cur = trie[cur][s[i][j]-'a'];
		}
		sz[cur] = ok[cur] = 1;
	}
	//print(0);	
	cnt(0);	
	for(int i = 1; i < v; i++){
		if(num[i] == 1 && !ok[i]){
			int a = par[i];
			int c;
			for(int r = 0; r < 26; r++) if(trie[i][r] != -1) c = r;
			int b = trie[i][c];
			trie[i][c] = -1;
			par[b] = a;
			trie[a][let[i]] = b;
			len[a][let[i]] += len[i][c];
			let[b] = let[i];
		}
	}
	//print(0);
	int q;
	cin >> q;

	for(int i = 0; i < q; i++){
		int a;
		cin >> a;
		a--;
		string o;
		cin >> o;
		cout << solve(0,a,o,0) << endl;
	}
}


Measured memory_bytes: 103428
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,flag=0;
    cin >> n;
    vector<vector<int>> v(n,vector<int>(2));
    for(int i=0;i<n;++i)
    {
        for(int j=0;j<2;++j)
        {
            cin >> v[i][j];
        }
    }
    for(int i=0;i<n-2;++i)
    {
        if(v[i][0]==v[i][1] && v[i+1][0]==v[i+1][1] && v[i+2][0]==v[i+2][1])
        {
            flag=1;
            break;
        }
    }
    if(flag==1)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for( int i = 0 ; i < n ; i++ )
typedef long long ll ;
int main() {
 
  int N  ;
  cin >> N ;
  vector<int> A(N) ;
  int k = 1 ;
  rep(i,N) cin >> A.at(i) ; 
  rep(i,N){
   if(A.at(i) == k ) k++ ;
  }
  if (k == 1 ){
    cout << -1 << endl;
    return 0 ;
  }
  cout << N - k+1 << endl;
}


Measured memory_bytes: 1024
#include <iostream>

using namespace std;

int main(void) {
	int P, Q, R = 0;

	cin >> P;
	cin >> Q;
	cin >> R;

	int PQ, QR, RP = 0;
	PQ = P + Q;
	QR = Q + R;
	RP = R + P;

	int out = PQ;
	if (out > QR) {
		out = QR;
		if (out > RP) {
			out = RP;
		}
	}
	else {
		if (out > RP) {
			out = RP;
		}
	}

	cout << out;

	return 0;
}

Measured memory_bytes: 256
n,m,q = map(int,input().split())
l = [[0]*(n) for i in range(n)]
for i in range(m):
    a,b = map(int,input().split())
    l[a-1][b-1] += 1


for i in range(n):
    for j in range(n):
        if i != 0:
            l[i][j] += l[i-1][j]
        if j != 0:
            l[i][j] += l[i][j-1]
        if i!= 0 and j != 0:
            l[i][j] -= l[i-1][j-1]
    

for i in range(q):
    a,b = map(int,input().split())
    ans = l[b-1][b-1]
    if a >= 2:
        ans -= l[a-2][b-1]
    print(ans)

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

string string_to_upper(string s) {
    string s_upper = "";
    char c;
    for(int i=0; i<s.size(); i++) {
        c = s[i];
        if(isalpha(c)) {
            if(isupper(c)) {
                c = tolower(c);
            }
        }
        string c_str = {c};
        s_upper += c_str;
    }

    return s_upper;
}

int main() {
    int w_count = 0;
    string w;
    cin >> w;

    string s;
    cin >> s;
    while(s != "END_OF_TEXT") {
        s = string_to_upper(s);
        if (w == s) w_count++;
        cin >> s;
    }

    cout << w_count << endl;
    return 0;
}


Measured memory_bytes: 3208
from collections import deque


def lunlun(k: int):
    q = deque([str(i) for i in range(1, 10)])
    res = '1'

    while k > 0:
        res = q.popleft()
        left = int(res[-1]) - 1
        mid = int(res[-1])
        right = int(res[-1]) + 1

        if left >= 0:
            q.append("{}{}".format(res, str(left)))
        q.append("{}{}".format(res, str(mid)))
        if right <= 9:
            q.append("{}{}".format(res, str(right)))

        k -= 1

    return int(res)


if __name__ == '__main__':
    k = int(input())
    print(lunlun(k))


Measured memory_bytes: 17012
/*
“Being happy doesn't mean that everything is perfect.
It means that you decided to look beyond the imperfections.”
*/

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


#define int int64_t
#define pr(x) cout << x << endl;
#define vi vector<int>
#define vii vector< vector<int> >
#define mp make_pair
#define ii pair<int,int>
#define fr(i,x,n) for(i = x ; i< n ; i++)
#define f(i,n) for(i = 0 ; i< n ; i++) 
#define ff first
#define ss second
#define pb push_back
#define SIZE 200001
#define mod 1000000007
#define int_max 1e12
void solve();



int32_t main()
{
    ios::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);
//	freopen("input.txt", "r",stdin);
//	freopen("output.txt", "w", stdout);
    solve();
    return 0;
}



int i, j, k, l, n, a, c, nn, t, dot=0, toko=0, x, y, z;


void solve()
{
    // cin>>t;f(nn,t)
    {
        cin >> x >> y;
        if(x>9 or y> 9) cout << -1;
        else cout << x*y;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <map>

using namespace std;

int main() {
	int a, b;
	cin >> a >> b;
	int x = ((a + b) + 1) / 2;
	cout << x << endl;
	return 0;
}

Measured memory_bytes: 3552
#include<bits/stdc++.h>
using namespace std;
#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define SZ(x) ((int)(x).size())
#define debug(x) cerr << #x << ": " << x << '\n'
#define INF 999999999
typedef long long int Int;
using ll = long long;
using VI = vector<int>;

int main(){
  int ans = 1;
  int n,k;cin >> n >> k;
  for(int i=0;i<n;i++){
    if(ans<=k) ans*=2;
    else ans+=k;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define fi first
#define se second
typedef pair<ll,ll> P;
#define Mod 1000000007
using VP = vector<P>; using VVP = vector<VP>;
using VI = vector<ll>; using VVI = vector<VI>; using VVVI = vector<VVI>;
#define INF 1234567890


vector<ll> inv,fact,invfact;
void Mod_build(int n=101010){
	fact.resize(n+1);
	inv.resize(n+1);
	invfact.resize(n+1);
	fact[0]=inv[0]=invfact[0]=1;
	inv[1]=1;
	for(ll i=0;i<n;i++){
		fact[i+1]=fact[i]*(i+1)%Mod;
		if(i>0)inv[i+1]=Mod-inv[Mod%(i+1)]*(Mod/(i+1))%Mod;
		invfact[i+1]=invfact[i]*inv[i+1]%Mod;
	}
}
ll perm(int n,int k){
	if(n<0||k<0||k>n)return 0;
	return fact[n]*invfact[n-k]%Mod;
}
ll comb(int n,int k){
	if(n<0||k<0||k>n)return 0;
	return (fact[n]*invfact[n-k]%Mod)*invfact[k]%Mod;
}
ll powMod(ll n,ll k){
	k%=Mod-1;
	if(k<0)k+=Mod-1;
	ll ret=1;
	while(k){
		if(k&1)ret=ret*n%Mod;
		n=n*n%Mod;
		k>>=1;
	}
	return ret;
}


int main(){
    ll i,j,k;
    ll l,r;
    cin>>l>>r;
    l--;
    r++;
    Mod_build(101);
    ll tw[101];
    tw[0]=1;
    for(i=1;i<100;i++) tw[i]=tw[i-1]*2%Mod;

    ll ans=0;


    for(i=0;i<63;i++){
        if(((r>>i)&1)!=1) continue;
        for(j=0;j<63;j++){
            if(((l>>j)&1)!=0) continue;
            
            vector<ll> ru(63,0),lu(63,0);
            for(k=0;k<63;k++){
                if((r>>k)&1==1) ru[k]=1;
                if((l>>k)&1==1) lu[k]=1;
            }
            ll s=max(i,j);
            ll ss=min(i,j);
            ru[i]=0;
            lu[j]=1;

            ll flag=0;
            ll used=0;

            for(k=62;k>=s;k--){
                if(ru[k]==0&&lu[k]==1) flag=1;
                if(ru[k]==1&&used==0) {
                    if(lu[k]==0) flag=1;
                    else used=1;
                }
            }
            if(flag) continue;

            ll cnt=1;

            if(i>=j){
                for(k=i-1;k>=j;k--){
                    if(lu[k]==1&&used==0){
                        used=1;
                    } 
                    if(lu[k]==0&&used==1) cnt=cnt*2%Mod;
                }
            }
            else {
                for(k=j-1;k>=i;k--){
                    if(ru[k]==1&&used==0){
                        used=1;
                    } 
                    else if(ru[k]==1) cnt=cnt*2%Mod;
                }
            }
            
            ll multi=0;
            if(used==1) {
                for(k=0;k<=ss;k++){
                    multi+=(comb(ss,k)*tw[k])%Mod;
                    multi%=Mod;
                }
            }
            else{
                for(k=0;k<ss;k++){
                    multi+=(comb(ss,k+1)*tw[k])%Mod;
                    multi%=Mod;
                }
            }
            cnt=cnt*multi%Mod;
            ans=(ans+cnt)%Mod;
        }
    }
    cout<<ans<<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;
        T=1;
        // cin.ignore(); must be there when using getline(cin, s)
        while(T--)
        {
            string s;
            cin>>s;
            if(s[1]=='B')
            {
                cout<<"ARC"<<endl;
            }
            else
            {
                cout<<"ABC"<<endl;
            }
        }
        return 0;
    }


Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using u32 = uint32_t;
using vi = vector<int>;    using vvi = vector<vi>;
using vb = vector<bool>;   using vvb = vector<vb>;
using vl = vector<ll>;     using vvl = vector<vl>;
using vd = vector<double>; using vvd = vector<vd>;

#define MAXC(c, x) (c = max(c, x))
#define MINC(c, x) (c = min(c, x))

#define REP(i,n) for(auto i = 0 * (n), i##_len = (n); i < i##_len; ++i)
#define ALL(c) (c).begin(), (c).end()
#define FOR(i,s,n) for(ll i=s, i##_len=(ll)(n); i<i##_len; ++i)
#define TEN(x) ((ll)1e##x)
const ll mod = TEN(9) + 7;

const ll INF = 1e9;

int main() {
	#ifdef INPUT_FROM_FILE
	ifstream cin("sample.in");
	ofstream cout("sample.out");
	#endif
	cin.tie(0);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(50);

	ll n; cin >> n;
	ll prev = -1;
	ll sum = 0;
	REP(i, n) {
		ll a; cin >> a;
		if (a - prev > 1) {
			cout << -1 << endl;
			return 0;
		}
		if (a != prev + 1) {
			sum += prev;
		}
		if (i == n - 1) {
			sum += a;
		}
		prev = a;
	}
	cout << sum << endl;

	return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Convert;
using static System.Math;
//using static System.Globalization.CultureInfo;

class Program
{
    static void Main(string[] args)
    {
        var num = Input.num;
        if (num <=2)
        {
            WriteLine(3 * num);
            return;
        }
        var str1 = ReadLine();
        var str2 = ReadLine();
        var res = 6L;
        for(var i = str1[2]==str1[1]?3:2; i < num; i++)
        {
            if (str1[i] == str2[i])
            {
                if (str1[i - 1] != str1[i - 2]) res *= 2;
            }
            else
            {
                if (str1[i - 1] == str1[i - 2]) res *= 3;
                else res *= 2;
                    i++;
            }
            res %= Input.MOD;
        }
        WriteLine(res);
    }
}

public class Input
{
    public static string read => ReadLine();
    public  static int[] ar => Array.ConvertAll(read.Split(' '), int.Parse);
    public  static int num => ToInt32(read);
    public static long[] arL => Array.ConvertAll(read.Split(' '), long.Parse);
    public  static long numL => ToInt64(read);
    public static int[][] twodim(int num)
        => Enumerable.Repeat(0, num).Select(v => ar).ToArray();
    public static long[][] twodimL(int num)
        => Enumerable.Repeat(0, num).Select(v => arL).ToArray();
    public const double eps = 1e-11;
    public  const string Alfa = "abcdefghijklmnopqrstuvwxyz";
    public  const int MOD = 1000000007;
}


Measured memory_bytes: 13268
#include <bits/stdc++.h>
#define ALL(obj) begin(obj), end(obj)
#define debug(x) cerr << #x << ": " << x << '\n'
using namespace std;
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
template <class T>
bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}

using ll = long long;
using ull = unsigned long long;
const int INF = 1e9;
const int MOD = 1e9 + 7;

using P = pair<int, int>;
int main() {
    int a, b, c;
    cin >> a >> b >> c;
    if (b - a == c - b) {
        cout << "YES\n";
    } else {
        cout << "NO\n";
    }
}


Measured memory_bytes: 256
/* package codechef; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
public class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
	    Scanner scan=new Scanner(System.in);
	    int n=scan.nextInt(),x=scan.nextInt(),t=scan.nextInt();
	    int c=x,time=t;
	    while(c<n)
	    {
	        c+=x;
	        time+=t;
	    }
	    System.out.println(time);
	}
}


Measured memory_bytes: 35580
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n,t,a; cin>>n>>t>>a;
    double min = 1e10;
    double ele =0;
    for(int i=0;i<n;i++){
        double h; cin>>h;
        double nc=(double)t-h*0.006;
        if(fabs(a-nc)<min){
            min=fabs(a-nc);
            ele=i+1;
            
        }
    }
    cout<<ele;
}

Measured memory_bytes: 256
from sys import stdin
from sys import stdout

A,B,C = stdin.readline().split()

if int(A)%2 == 0 or int(B)%2 == 0 or int(C)%2 == 0 :
        print 0
        exit()

AB = int(A) * int(B)
BC = int(C) * int(B)
AC = int(A) * int(C)
ABC = AB * int(C)

area = sorted([AB,BC,AC])[0]                                                                                                                                         
print area

Measured memory_bytes: 2568
// B - Exponential

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

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

  vector<vector<string>> vec(N + 1, vector<string>());

  for (int i = 0; i < M; i++) {
    int a;
    string str;
    cin >> a >> str;
    vec[a].push_back(str);
  }

  int ac = 0, wa = 0;

  for (int i = 1; i <= N; i++) {
    int W = 0;
    for (int j = 0; j < vec[i].size(); j++) {
      if (vec[i][j] == "AC") {
        ac++;
        wa += W;
        break;
      } else {
        W++;
      }
    }
  }
  cout << ac << " " << wa << endl;
}


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

int main(){
    int n,m;
    cin>>n>>m;
    int dp[n+1];
    int M[m];
    for(int i=0;i<m;i++)cin>>M[i];
    fill(dp,dp+n+1,1e8);
    dp[0]=0;
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
            if(i+M[j]<=n){
                dp[i+M[j]]=min(dp[i+M[j]],dp[i]+1);
            }
        }
    }
    cout<<dp[n]<<endl;
}

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

const int maxn = 1e5+10;
const long long mod = 1e9+7;
const long double eps = 1e-10;

string s;
string res;
int n;
int a[26];
int b[26];


int main()
{
	ios::sync_with_stdio(0); cin.tie(0);
    cin >> s;
    n = s.length();
    for (int i = 0; i < n; ++i)
        a[s[i] - 'a']++;

    if (n < 26)
    {
        int j = 0;
        while (a[j]) j++;
        res = s;
        res.push_back('a' + j);
        cout << res << "\n";
        exit(0);
    } else if (n==26)
    {
        for (int i = n - 1; i >= 0; --i)
        {
            char c = s[i];
            a[c - 'a']--;
            b[c - 'a']++;
            int t = (c-'a') + 1;
            while (t < 26 && a[t]) t++;
            if (t < 26)
            {
                res = s.substr(0, i);
                res.push_back('a' + t);
                cout << res << "\n";
                exit(0);
            }
        }
    }


    cout << -1 << "\n";
}


Measured memory_bytes: 256
// </> : towhid1zaman

#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef vector<int> vi;typedef vector<ll> vll;
#define fill(a,b) memset(a, b, sizeof (a))
#define all(v) (v).begin(),(v).end()
#define sp(k) cout<<setprecision(k)<<fixed;
#define rep(i,a) for(int i=0; i<a;i++)
#define rep1(i,a,b) for(int i=(a);i<=(b);++i)
#define irep(i,b,a) for(int i=(b);i>=(a);--i)
#define minv(v) *min_element(all(v))
#define maxv(v) *max_element(all(v))
#define unq(v) sort(all(v)),(v).erase(unique(all(v)),(v).end())
#define _ios ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define sqr(a) ((a)*(a))
#define sz(a) int(a.size())
#define ff first
#define ss second
#define pb push_back

const double pi = acos(-1.0);
const int mod = 1000000007; // (int)1e9+7
const int maxn = 2000100;

int main(){
        _ios;

        int n; cin >> n;
        vi dp(3);
        for(int day = 0 ; day < n; day++){
            vi abc(3);
            vi NewDp(3,0);
            for(int i = 0; i<3; i++){
                cin >> abc[i];
            }
            for(int i = 0; i<3; i++){
                for(int j = 0; j<3; j++){
                    if(i!=j){
                        NewDp[j] = max(NewDp[j], dp[i]+abc[j]);
                    }
                }
            }
            //cout<<maxv(NewDp)<<endl;
            dp  = NewDp;
        }

        cout<<maxv(dp)<<endl;
return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <array>

#define ALPHA 26

#define INPUT_LEN 12
#define INPUT_SIZE 2
#define DATA_SIZE (1 << (INPUT_LEN * INPUT_SIZE))

bool cache[INPUT_LEN + 1][DATA_SIZE];

int encode(const std::string& dna, const std::array<int, ALPHA> dna_map){
	const int length = dna.length();
	
	int code = 0;
	for(int i = length - 1; i >= 0; i--){
		code <<= INPUT_SIZE;
		code |= dna_map[dna[i] - 'A'];
	}
	
	return code;
}

int main(int argc, char* argv[]){
	std::array<int, ALPHA> dna_map;
	dna_map.fill(-1);
	dna_map['A' - 'A'] = 0;
	dna_map['C' - 'A'] = 1;
	dna_map['G' - 'A'] = 2;
	dna_map['T' - 'A'] = 3;

	int n;
	std::cin >> n;

	for(int i = 0; i < n; i++){
		std::string ops, dna;
		std::cin >> ops >> dna;

		const int code = encode(dna, dna_map);
		const int length = dna.length();

		if(ops == "insert"){ cache[length][code] = true; }
		else{ std::cout << (cache[length][code] ? "yes" : "no") << std::endl; }
	}
	
	return 0;
}

Measured memory_bytes: 13496
#import <stdio.h>
typedef long long Int;
int main(){
    Int k,a,b;
    scanf("%lld %lld %lld",&k,&a,&b);
    printf("%lld\n",(b-a>3 && k+1-a>=2) ? a + (k+1-a)%2 + (k+1-a)/2*(b-a) : k+1);
}

Measured memory_bytes: 7500
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rep2(i,n) f2or (int i = 1; i < (n); ++i)
using namespace std;
typedef long long ll;
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N;
    cin >> N;
    vector<int> H(N);
    rep(i,N) cin >> H[i];
    int max = 0;
    int ans = 0;
    rep(i,N){
        if(max <= H[i]) {
            max = H[i];
            ans++;
        }
    }
    cout << ans << endl;

    return 0;
}


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

namespace _0380
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine((RInt() - 30) / 2);
        }
        static string RSt() { return Console.ReadLine(); }
        static int RInt() { return int.Parse(Console.ReadLine().Trim()); }
        static long RLong() { return long.Parse(Console.ReadLine().Trim()); }
        static double RDouble() { return double.Parse(Console.ReadLine()); }
        static string[] RArSt(char sep = ' ') { return Console.ReadLine().Trim().Split(sep); }
        static int[] RArInt(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => int.Parse(e)); }
        static long[] RArLong(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => long.Parse(e)); }
        static double[] RArDouble(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => double.Parse(e)); }
        static string WAr<T>(IEnumerable<T> array, string sep = " ") { return string.Join(sep, array.Select(x => x.ToString()).ToArray()); }
    }
}



Measured memory_bytes: 15912
#include "bits/stdc++.h"
typedef long long ll;
using namespace std;

int main() {
    int n, d, x;
    cin >> n >> d >> x;
    vector<int> a(n);
    for (int i = 0; i < n; ++i) cin >> a[i];
    int sum = x;
    for (int i = 0; i < n; ++i) {
        int t = 0;
        while (t++ * a[i] + 1<= d) sum++;
    }
    cout << sum;
    return 0;
}


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

using ll = long long;
#define repi(n) for (int i = 0; i < (n); i++)
#define repj(n) for (int j = 0; j < (n); j++)
#define repk(n) for (int k = 0; k < (n); k++)
#define rep(i, n) for (int i = 0; (i) < (n); i++)
#define repr(i, a, b) for (auto i = (a); i < (b); i++)
#define repv(itr) for (auto&& v : (itr))
#define updatemax(t, v) (t = max((t), (v)))
#define updatemin(t, v) (t = min((t), (v)))
const int dx[] = {-1, 0, 0, 1, -1, -1, 1, 1};
const int dy[] = {0, -1, 1, 0, -1, 1, -1, 1};
template <typename T>
T minptr(T begin, T end) {
  T re = begin;
  for (T i = begin + 1; i != end; i++) {
    if (*i < *re) re = i;
  }
  return re;
}
template <typename T>
T maxptr(T begin, T end) {
  T re = begin;
  for (T i = begin + 1; i != end; i++) {
    if (*i > *re) re = i;
  }
  return re;
}
int __vmax(int x) {
  return INT_MAX;
}
double __vmax(double x) {
  return 1e+300;
}
ll __vmax(ll x) {
  return LLONG_MAX;
}
int __vmin(int x) {
  return INT_MIN;
}
double __vmin(double x) {
  return -1e+300;
}
ll __vmin(ll x) {
  return LLONG_MIN;
}
template <typename T>
vector<T> lis(T begin, T end, bool allowequal = false, bool lds = false) {
  using V = typename iterator_traits<T>::value_type;
  int n = end - begin;
  vector<V> a(n, lds ? __vmin(*begin) : __vmax(*begin));
  vector<int> id(n);
  if (lds && allowequal) {
    for (int i = 0; i < n; i++) {
      id[i] = n - 1 -
              (lower_bound(a.rbegin(), a.rend(), begin[i]) - 1 - a.rbegin());
      a[id[i]] = begin[i];
    }
  } else if (lds) {
    for (int i = 0; i < n; i++) {
      id[i] = n - 1 -
              (upper_bound(a.rbegin(), a.rend(), begin[i]) - 1 - a.rbegin());
      a[id[i]] = begin[i];
    }
  } else if (allowequal) {
    for (int i = 0; i < n; i++) {
      id[i] = upper_bound(a.begin(), a.end(), begin[i]) - a.begin();
      a[id[i]] = begin[i];
    }
  } else {
    for (int i = 0; i < n; i++) {
      id[i] = lower_bound(a.begin(), a.end(), begin[i]) - a.begin();
      a[id[i]] = begin[i];
    }
  }
  int m = *maxptr(id.begin(), id.end());
  vector<T> re(m + 1);
  for (int i = n - 1; i >= 0; i--) {
    if (id[i] == m) re[m--] = begin + i;
  }
  return re;
}

int main() {
  int x, y;
  cin >> x >> y;
  cout << x + y / 2 << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
	    int N = sc.nextInt();
	    int K = sc.nextInt();
	    sc.close();
	    
	    double P = 0;
	    for(int i = 1; i < N+1; i++) {
	    	int count = 0;
	    	int j = i;
	    	while (j<K){
	    		j=2*j;
	    		count++;
	    	}
	    	
	    	P =   P + (Math.pow(0.5, count))/N;
	    }
	    System.out.println(P);

	}

}


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

const int MOD = 1000000007;

//long long
using ll = long long;

//出力系
#define print(x) cout << x << endl
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
 
// begin() end()
#define all(x) (x).begin(),(x).end()

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

//最大公約数 
unsigned gcd(unsigned a, unsigned b) {
  if(a < b) return gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}

 int main(){
 int n;
 cin >> n;
int ans = 3 * n * n;
print(ans);

 }

Measured memory_bytes: 256
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
  long long int a,b,c=1000000000000,d[200000],e=0,s=0;
  cin>>a;
  for(b=0;b<a;b++){cin>>d[b];s+=d[b];}
  for(b=0;b<a-1;b++){e+=d[b];if(abs(s-2*e)<c)c=abs(s-2*e);}
  cout<<c;
return 0;
}

Measured memory_bytes: 1792
import java.util.AbstractMap;
import java.util.Arrays;
import java.util.Collections;
import java.util.Scanner;
import java.util.Stack;

public class Main {

	static Scanner scanner;

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

	    int N=gi();
	    int K=gi();
	    int[] T=new int[N];
	    long[] D=new long[N];
	    Pair<Long, Integer>[] ps=new Pair[N];
	    int[] used=new int[N];
	    for(int i=0; i<N;i++) {
	    	int t=gi()-1;
	    	long d=gl();
	    	ps[i]=new Pair<Long, Integer>(d, t);
	    }

	    Arrays.parallelSort(ps, Collections.reverseOrder());

	    long k=0;
	    long point=0;
	    long max=0;
	    Stack<Integer> st=new Stack<Integer>();
	    for(int i=0; i<K;i++) {
	    	Pair<Long, Integer> p = ps[i];
	    	if(used[p.getValue()]==0)k++;
	    	used[p.getValue()]++;
	    	point+=p.getKey();
	    	if(used[p.getValue()]>1)st.push(i);
	    }

	    point+=Math.pow(k, 2);
	    max=point;
	    for(int i=K; i<N;i++) {
	    	Pair<Long, Integer> p = ps[i];
	    	if(used[p.getValue()]==0) {
	    		if(st.size()==0) break;
	    	    used[p.getValue()]++;
	    	    point-=Math.pow(k, 2);
	    	    k++;
	    	    point+=Math.pow(k, 2);
	    	    point+=p.getKey();

	    	    int hn=st.pop();
	    	    point-=ps[hn].getKey();
	    	    if(max<point) {
	    	    	max=point;
	    	    }
	    	}
	    }

	    System.out.print(max);
	}

	public static class Pair<K, V> extends AbstractMap.SimpleEntry<K, V> implements Comparable<Pair<K, V>> {
		/** serialVersionUID. */
	    private static final long serialVersionUID = 6411527075103472113L;

	    public Pair(final K key, final V value) {
	        super(key, value);
	    }

		@Override
		public int compareTo(Pair<K, V> o) {

			Comparable key = (Comparable)this.getKey();
			Comparable key2 = (Comparable)o.getKey();

			return key.compareTo(key2);
		}

	}

	// 文字列として入力を取得
	public static String gs() {
		return scanner.next();
	}

	// intとして入力を取得
	public static int gi() {
		return Integer.parseInt(scanner.next());
	}

	// longとして入力を取得
	public static long gl() {
		return Long.parseLong(scanner.next());
	}

	// doubleとして入力を取得
	public static double gd() {
		return Double.parseDouble(scanner.next());
	}
}

Measured memory_bytes: 68312
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <iomanip>

using namespace std;

int main(){

        int a,b,d,r;
        double f;
        cin >> a >> b;

        d = a / b;
        r = a % b;
        f = (double)a / b;

        cout << d << " " << r << " ";
        cout << fixed << setprecision(8) << f << "\n";

        return 0;
}

Measured memory_bytes: 1244
// Package main provides
//
// File:  d.go
// Author: ymiyamoto
//
// Created on Wed Dec 19 22:42:09 2018
//
package main

import "fmt"

type point struct {
	x, y int
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func checkPossible(points []point) bool {
	oe := abs(points[0].x+points[0].y) % 2
	for _, p := range points {
		if oe != abs(p.x+p.y)%2 {
			return false
		}
	}
	return true
}

func pow2(n int) int {
	if n == 0 {
		return 1
	}
	return 2 * pow2(n-1)
}

func main() {
	var N int
	fmt.Scan(&N)
	points := make([]point, N)
	for i := range points {
		fmt.Scan(&points[i].x, &points[i].y)
	}

	if !checkPossible(points) {
		fmt.Println(-1)
		return
	}
	arms := []int{}
	if abs(points[0].x+points[0].y)%2 == 0 {
		arms = append(arms, 1)
	}

	for i := 0; i < 39; i++ {
		arms = append(arms, pow2(i))
	}

	fmt.Println(len(arms))
	for i, arm := range arms {
		if i != 0 {
			fmt.Print(" ")
		}
		fmt.Print(arm)
	}
	fmt.Println()

	for _, p := range points {
		u := p.x + p.y
		v := p.x - p.y
		modes := ""
		for i := len(arms) - 1; i >= 0; i-- {
			l := arms[i]
			if u >= 0 && v >= 0 {
				u -= l
				v -= l
				modes += "R"
			} else if u >= 0 && v <= 0 {
				u -= l
				v += l
				modes += "U"
			} else if u <= 0 && v >= 0 {
				u += l
				v -= l
				modes += "D"
			} else {
				u += l
				v += l
				modes += "L"
			}
		}
		for i := len(modes) - 1; i >= 0; i-- {
			fmt.Print(string(modes[i]))
		}
		fmt.Println()
	}
}


Measured memory_bytes: 2560
// Words are flowing out like endless rain into a paper cup
// They slither while they pass they slip away across the universe
// Pools of sorrow, waves of joy are drifting through my open mind
// Possessing and caressing me

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

using LL = long long;

namespace _buff {

const size_t BUFF = 1 << 19;
char ibuf[BUFF], *ib = ibuf, *ie = ibuf;
char getc() {
    if (ib == ie) {
        ib = ibuf;
        ie = ibuf + fread(ibuf, 1, BUFF, stdin);
    }
    return ib == ie ? -1 : *ib++;
}

}

LL read() {
    using namespace _buff;
    LL ret = 0;
    bool pos = true;
    char c = getc();
    for (; (c < '0' || c > '9') && c != '-'; c = getc()) {
        assert(~c);
    }
    if (c == '-') {
        pos = false;
        c = getc();
    }
    for (; c >= '0' && c <= '9'; c = getc()) {
        ret = (ret << 3) + (ret << 1) + (c ^ 48);
    }
    return pos ? ret : -ret;
}

const size_t N = 6e6 + 5;
const int MOD = 998244353;

int qpow(int base, int e) {
    int ret = 1;
    for (; e; e >>= 1) {
        if (e & 1) {
            ret = (LL) ret * base % MOD;
        }
        base = (LL) base * base % MOD;
    }
    return ret;
}

void ladd(int &ans, LL val) {
    ans = (ans + val) % MOD;
}

int fac[N], inv[N];

void prep() {
    fac[0] = 1;
    for (int i = 1; i < N; ++i) {
        fac[i] = (LL) fac[i - 1] * i % MOD;
    }
    inv[N - 1] = qpow(fac[N - 1], MOD - 2);
    for (int i = N - 1; i; --i) {
        inv[i - 1] = (LL) inv[i] * i % MOD;
    }
}

LL comb(int n, int m) {
    if (n < m) return 0;
    return (LL) fac[n] * inv[m] % MOD * inv[n - m] % MOD;
}

LL calc(int n, int m) {
    // n split into the sum of m non-negative integers
    return comb(n + m - 1, m - 1);
}

int main() {
    prep();
    int n = read(), m = read();
    int ans = 0;
    for (int i = 0; i <= min(n, m); ++i) {
        if ((3 * m - i) & 1) continue;
        ladd(ans, comb(n, i) * calc((3 * m - i) / 2, n));
    }
    for (int i = 2 * m + 1; i <= 3 * m; ++i) {
        ladd(ans, -calc(3 * m - i, n - 1) * n);
    }
    if (ans < 0) ans += MOD;
    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 47488
#include <cstdint>
#include <iostream>
#include <vector>

using namespace std;

static uint64_t calc_count(vector<long long> &vec, int64_t sign)
{
  unsigned long long count = 0;
  // long long total = vec[0];
  // if (total == 0) {
  //   total = sign;
  //   count++;
  // } else {
  //   if ((sign * total) < 0) {
  //     count += abs(sign - total);
  //     total = sign;
  //   }
  // }

  long long total = 0;

  for (uint64_t i = 0; i < vec.size(); i++) {
    total += vec[i];

    if ((total == 0) || ((sign * total) < 0)) {
      count += abs(sign - total);
      total = sign;
    }
    sign *= -1;
  }

  return count;
}

int32_t main()
{
  uint64_t N;
  cin >> N;

  vector<long long> vec;

  for (uint64_t i = 0; i < N; i++) {
    long long val;
    cin >> val;
    vec.push_back(val);
  }

  cout << min(calc_count(vec, 1), calc_count(vec, -1)) << endl;
  return 0;
}


Measured memory_bytes: 1400
import itertools
import math

k = int(input())
b = []
for i in range(1,k+1):
    b.append(i)
a = list(itertools.combinations_with_replacement(b, 3))
c = 0
for i in a:
    if (i[0]==i[1] or i[1]==i[2]):
        if (i[0]==i[1] and i[1]==i[2]):
         c += math.gcd(math.gcd(i[0],i[1]),i[2])
        else:
            c += 3* math.gcd(math.gcd(i[0],i[1]),i[2])
    else:
        c += 6*math.gcd(math.gcd(i[0],i[1]),i[2])

print(c)

Measured memory_bytes: 105516
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int l,r;
    cin>>l>>r;
    int flag=0;
    long long int m=0,a;
    if(l+2022<r){
        r=l+2022;
    }
    for(long long i=l;i<r;i++){
       for(long long j=i+1;j<=r;j++){
        if(flag==0){
            m=(i*j)%2019;
            flag++;
            //cout<<i<<" "<<j<<endl;
        }
        else{
        a=(i*j)%2019;
        if(a<m){
            m=a;
            //cout<<i<<" "<<j<<endl;
        }
        }
    }
    }
    cout<<m<<endl;
}

Measured memory_bytes: 256
use proconio::input;

fn main() {
	input!(n: usize);
	input!(k: usize);
	input!(d: [usize; k]);

	let mut n = n;
	loop {
		//金額の各桁数字をVectorにする
		//嫌い数字が含まれているかをチェック
		//一つでも入っていれば、金額を+1して繰り返し。
		//一つもなければそれが答え。
		let mut v = vec![];
		let mut tmp = n;
		loop {
			if tmp == 0 {
				break;
			}
			let num = tmp % 10;
			v.push(num);
			tmp /= 10;
		}
		v.sort();
		v.dedup();
		let mut flag = 0;
		for i in 0..k {
			let result = v.binary_search(&d[i]);
			match result {
				Ok(_) => {
					flag = 1;
					break;
				},
				_ => (),
			}
		}
		if flag == 0 {
			println!("{}", n);
			return;
		}
		else {
			n += 1;
			//println!("{}", n);
		}
	}
}


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

typedef pair<int, int> pii;

const int mod = 1e9 + 7;
const int MN = 200010;

int N;
pii P[MN];

int Xn;
vector<int> X;
map<int, int> dx;

struct BIT {
    vector<int> tree;
    void init() {
        tree = vector<int>(4 * N, 1e9);
    }
    void upd(int idx, int val, int l, int r, int n) {
        if(idx < l || r < idx) return;
        if(l == r) {
            tree[n] = val;
            return;
        }
        int m = (l + r)>>1;
        upd(idx, val, l, m, 2*n);
        upd(idx, val, m + 1, r, 2*n + 1);
        tree[n] = min(tree[2*n], tree[2*n + 1]);
    }
    int quer(int a, int b, int l, int r, int n) {
        if(b < l || r < a) return 1e9;
        if(a <= l && r <= b) return tree[n];
        int m = (l + r)>>1;
        int L = quer(a, b, l, m, 2*n);
        int R = quer(a, b, m + 1, r, 2*n + 1);
        return min(L, R);
    }
} bit;

int L[MN], R[MN];
vector<pii> seg, tmp;

bool cmp(pii a, pii b) {
    return a.first < b.first || (a.first == b.first && a.second > b.second);
}

struct Fenwick {
    vector<int> tree;
    void init() {
        tree = vector<int>(MN + 1, 0);
    }
    void upd(int idx, int val) {
        for(int i = idx + 1; i <= MN; i += (i & -i)) tree[i] += val, tree[i] %= mod;
    }
    int quer(int a) {
        int ret = 0;
        for(int i = a + 1; i >= 1; i -= (i & -i)) ret += tree[i], ret %= mod;
        return ret;
    }
    int quer(int a, int b) {
        return quer(b) - quer(a - 1);
    }
} fw;

int dp[MN];

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

    for(int i = 0; i < N; i++) {
        scanf("%d %d", &P[i].first, &P[i].second);
        X.push_back(P[i].second);
    }

    sort(P, P + N);
    sort(X.begin(), X.end());
    X.resize(unique(X.begin(), X.end()) - X.begin());
    Xn = X.size();
    for(int i = 0; i < Xn; i++) dx[X[i]] = i;
    for(int i = 0; i < N; i++) P[i].second = dx[P[i].second];

    bit.init();
    for(int i = 0; i < N; i++) {
        bit.upd(P[i].second, i, 0, N - 1, 1);
        L[i] = bit.quer(P[i].second, N - 1, 0, N - 1, 1);
    }
    bit.init();
    for(int i = N - 1; i >= 0; i--) {
        bit.upd(P[i].second, -i, 0, N - 1, 1);
        R[i] = -bit.quer(0, P[i].second, 0, N - 1, 1);
    }

    for(int i = 0; i < N; i++) seg.push_back({ L[i], R[i] });
    sort(seg.begin(), seg.end(), cmp);
    for(int i = 0; i < N; i++) {
        while(tmp.size() && tmp.back().second >= seg[i].second) tmp.pop_back();
        tmp.push_back(seg[i]);
    }
    seg = tmp;

    fw.init();
    fw.upd(N - 1, 1);
    int pos = (int)seg.size();
    for(int i = N - 1; i >= 0; i--) {
        while(pos > 0 && seg[pos - 1].first >= i) pos--;

        if(pos == seg.size()) dp[i] = fw.quer(i, N - 1) + 1;
        else dp[i] = fw.quer(i, seg[pos].second);
        if(i) fw.upd(i - 1, dp[i]);

        //cout << i << ' ' << dp[i] << endl;
    }
    printf("%d", dp[0]);
}


Measured memory_bytes: 23740
#include <iostream>

using namespace std;

int main(void){
	int hands[5];
	int w,l;
	
	while(cin >> hands[0] && hands[0]){
		bool exists[3] = {false, false, false};
		
		for(int i=1;i<=4;i++){
			cin >> hands[i];
		}
		for(int i=0;i<5;i++){
			exists[hands[i]-1] = true;
		}
		
		//print results
		if( ((int)exists[0] + (int)exists[1] + (int)exists[2]) % 2 == 1){
			for(int i=0; i<5;i++) cout << 3 << endl;
		}else{
			if(exists[0] == false){
				w = 2; l = 3;
			}else if(exists[1] == false){
				w = 3; l = 1;
			}else{
				w = 1; l = 2;
			}
			for(int i=0;i<5;i++){
				if(hands[i] == w){
					cout << 1 << endl;
				}else{
					cout << 2 << endl;
				}
			}
		}
	}
}

Measured memory_bytes: 0
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ld long double
#define al(a) (a).begin(),(a).end()
#define mk make_pair
#define check cout<<"?"<<endl;

ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;

int main() {
    ll n,ans=0,m=1; cin>>n;
    vector<ll> c(n,0);
    rep(i,n) cin>>c[i];
    rep(i,2*n-2) m=(m*2+MOD)%MOD;
    sort(al(c)); reverse(al(c));
    rep(i,n){
        ll ad=m*(i+2)%MOD;
        ans=(MOD+ans+ad*c[i])%MOD;
    }
    cout<<(ans+MOD)%MOD<<endl;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
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(v) (v).begin(),(v).end()
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
typedef long long ll;
typedef pair<int, int> pii;
const ll INF = 1e9+100;
const ll MOD = 1e9+7;
const bool debug = false;

void solve(string s, vector<string> &str, vector<string> &cont) {
	int p = 0;
	string cur = "";
	while (p < s.size()) {
		if (s[p] == '\"') {
			p++;
			if (cur != "") str.push_back(cur);
			str.push_back("*");

			cur = "";
			while (s[p] != '\"') cur += s[p++];
			cont.push_back(cur);
			cur = "";
			p++;
		}
		else cur += s[p++];
	}
	if (cur != "") str.push_back(cur);
}

int main() {
	string s[2];
	while (cin >> s[0], s[0] != ".") {
		cin >> s[1];
		if (debug) putchar('@');
		if (s[0] == s[1]) puts("IDENTICAL");
		else {
			vector<string> str[2]; // encode
			vector<string> cont[2]; // ""の中身
			solve(s[0], str[0], cont[0]);
			solve(s[1], str[1], cont[1]);
			
			bool ng = false;
			if (str[0].size() != str[1].size()) ng = true;
			else {
				REP(i, str[0].size()) if (str[0][i] != str[1][i]) ng = true;
			}
			if (!ng) {
				int ngcnt = 0;
				REP(i, cont[0].size()) {
					if (cont[0][i] != cont[1][i]) ngcnt++;
				}
				if (ngcnt != 1) ng = true;
			}

			if (ng) puts("DIFFERENT");
			else puts("CLOSE");
		}
	}
	return 0;
}


Measured memory_bytes: 3176
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int maxn=1e6+5;
vector<ll> V;
string s[105];
int main() {
    int n,l;cin>>n>>l;
    for(int i=1;i<=n;i++) cin>>s[i];
    sort(s+1,s+1+n);
	for(int i=1;i<=n;i++) cout<<s[i];
    return 0;
}

Measured memory_bytes: 3652
#include<bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef pair<double,double>P;
#define f first
#define s second
int n,m,a,b;
main(){
  cin>>n;
  while(n--){
    int x=0,y=0,q,w,ma=0;
    while(cin>>q>>w,q||w){
      x+=q,y+=w;
      if(ma<x*x+y*y){
        ma=x*x+y*y;
        a=x,b=y;
      }
      else if(ma==x*x+y*y&&a<x){
        a=x,b=y;
      }
    }
    cout<<a<<' '<<b<<endl;
  }
}

Measured memory_bytes: 3120
import java.util.Scanner;

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

		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int d = 0;
		for(int i = a; i <= b; i++) {
			if(c % i == 0)
				d++;
		}

		System.out.println(d);
	}
}



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

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

    bool X[n] = {};   // 1 -> xxx
    bool Y[n] = {};   // xxx -> n

    for(int i = 0; i < m; i++){
        int a, b;
        cin >> a >> b;
        if(a == 1){
            X[b--] = true;
        }else if(b == n){
            Y[a--] = true;
        }
    }
    bool f = false;
    for(int i = 0; i < n; i++){
        if(X[i] and Y[i]){
            f = true;
            break;
        }
    }
    if(f) cout << "POSSIBLE" << endl;
    else cout << "IMPOSSIBLE" << endl;

    return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin>>s;
  int f=0,fl=0;
  for(int i=0;i<3;i++){
    if(s[i]=='A'){
      f=1;}
    else{
      if(s[i]=='B')
        fl=1;
    }
  }
  if(f==1&&fl==1)
    cout<<"Yes"<<endl;
  else
    cout<<"No"<<endl;
}
  

Measured memory_bytes: 256
#pragma once
#include <stdio.h>
#include <sstream>
#include <string.h>
#include <vector>
#include <map>
#include <algorithm>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <deque>
#include <limits>
#include <iomanip>
#include <ctype.h>
#define _USE_MATH_DEFINES
#include <iostream>
#include <math.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define bit(x,v) ((ll)x << v)

const ll INF = 1000000007;
const int MAX = 210000;
const int MOD = 1000000007;

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

// 二項係数計算
long long COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}
int pr[100010];
void uini(int n) {
	for (size_t i = 0; i <= n; i++)
	{
		pr[i] = i;
	}
}

int parent(int x) {
	if (x == pr[x]) return x;
	return pr[x] = parent(pr[x]);
}

bool unit(int x, int y) {
	int px = parent(x);
	int py = parent(y);

	if (px == py) return false;
	if (px < py) {
		pr[py] = px;
	}
	else {
		pr[px] = py;
	}
	return true;
}

ll bit[200010];
int max_n = 200000;
int pm = 0;
void add(int x) {

	while (max_n >= x)
	{
		bit[x]++;
		x += x & -x;
	}
}
void sub(int x) {
	while (max_n >= x)
	{
		bit[x]--;
		x += x & -x;
	}
}
int search(int x) {

	int k = 0;
	int p = 1;
	while (p * 2 <= max_n)
	{
		p *= 2;
	}
	for (int i = p; i > 0; i /= 2)
	{
		if (i + k < max_n && bit[i + k] < x) {
			x -= bit[i + k];
			k += i;
		}
	}
	return k + 1;
}
void solv() {

	ll a, b;
	cin >> a >> b;
	cout << gcd(a, b) << endl;
}
int main() {
	//	COMinit();
	solv();
	return 0;
}



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

int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n;i++) {
        cin >> a[i];
    }
    int ans = 0;
    for (int i = 0; i < n; i++)
    {
        for (int j = i + 1; j < n;j++) {
            ans += a[i] * a[j];
        }
    }

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

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


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

    int A[M];
    string S;

    int AC_list[N] = {};
    int buf[N] = {};

    long long WA_count = 0;
    long long AC_count = 0;


    for(int i=0; i<M; i++){
        cin >> A[i] >> S;
        if(S == "AC" && AC_list[A[i]-1] == 0){
            AC_list[A[i]-1] = 1;
            AC_count++;
            WA_count += buf[A[i]-1];
        }else if(S == "WA" && AC_list[A[i]-1] == 0){
            // WA_count++;
            buf[A[i]-1]++;
        }
    }
    
    // cout << AC_list[2] << endl;
    cout << AC_count << " " << WA_count<< endl;
}

Measured memory_bytes: 1408
def pushBack(A, x):
    A.append(x)
def randomAccess(A, x):
    return A[x]
def popBack(A):
    _=A.pop()


A = []
q = int(input())
for _ in range(q):
    query = input()
    if query == '2':
        popBack(A)
    else:
        query = list(map(int, query.split()))
        if query[0] == 0:
            pushBack(A, query[1])
        elif query[0] == 1:
            print(randomAccess(A, query[1]))




Measured memory_bytes: 13368
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>

using namespace std;

using ll = long long;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)

#define input(...) __VA_ARGS__; in(__VA_ARGS__)

template<class T>
void print(vector<T> a) {
  cout << "[ ";
  REP(i, a.size()) cout << a[i] << " ";
  cout << "]" << endl;
}

void print() {
  std::cout << std::endl;
}

template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
  std::cout << head << " ";
  print(std::forward<Tail>(tail)...);
}

void in() { }

template <class Head, class... Tail>
void in(Head&& head, Tail&&... tail) {
  cin >> head;
  in(std::forward<Tail>(tail)...);
}

int main() {
  ll input(n);
  vector<ll> erat(n + 1, 1);

  FOR(j, 2, n) {
    for(ll i = j; i <= n; i += j) {
      erat[i]++;
    }
  }

  ll ans = 0;
  FOR(i, 1, n) {
    ans += erat[i] * i;
  }
  cout << ans << endl;
  // cout << accumulate(erat.begin(), erat.end(), 0ll) << endl;
}


Measured memory_bytes: 81324
#include <iostream>

using namespace std;

int main(){
    // proof needed

    int N;
    cin >> N;
    unsigned long long int A[N], B[N];
    for (int i = 0; i < N; i++){
        cin >> A[i] >> B[i];
    }

    unsigned long long int ans = 0;
    for (int i = N - 1; i > -1; i--){
        if (((A[i] + ans) % B[i]) != 0){
            ans += B[i] - ((A[i] + ans) % B[i]);
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1792