akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define MOD 1000000007
#define pb push_back
typedef long long ll;
using namespace std;

int same(char a, char b, char c){
	if(a == b && b == c){
		return 3;
	}
	else if(a == b || b == c || c == a){
		return 2;
	}
	else{
		return 1;
	}
}
 
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

	ll n;
	string a, b, c;
	cin>>n>>a>>b>>c;
	ll cnt=0;
	for (int i = 0; i < n; ++i)
	{
		int x = same(a[i],b[i],c[i]);
		if(x == 2) cnt += 1;
		else if(x == 1) cnt += 2;
	}
	cout<<cnt<<"\n";
}



Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<math.h>
#include<string.h>
using namespace std;
typedef long long ll;

int main()
{
	char a[100];
	cin >> a;
	int len= strlen(a);
	for (int i=len-1; i>=0; i--){
		cout << a[i];
	}
	cout << endl;
	return 0;
}



Measured memory_bytes: 3100
#include <stdio.h>

int main(void)
{
	char str[10001];
	int i;
	
	fgets(str, 10000, stdin);
	
	for (i = 0; str[i] != '\0'; i++){
		if (str[i] >= 'a' && str[i] <= 'z'){
			str[i] -= 32;
		}
		if (str[i] == '\n'){
			str[i] = '\0';
		}
	}
	puts(str);
	
	return 0;
}

Measured memory_bytes: 524
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main(){
    ll l,r;
    int ans=2018;
    cin >> l >> r;
    r = min(r,l+4038);
    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 <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
 
typedef pair<ll, ll> p;
 
#define MOD 1000000007

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

    string S;
    int K;

    cin >> S >> K;

    vector<vector<int> > dp1(K + 1, vector<int>(S.length()));
    vector<vector<int> > dp2(K + 1, vector<int>(S.length()));

    for(int i = 0; i < S.length(); i++) {
        dp1[0][i] = 1;
    }

    dp1[1][0] = (S[0] - '0') - 1;
    dp2[1][0] = 1;

    for(int i = 1; i < S.length(); i++) {
        for(int j = 1; j <= K; j++) {
            dp1[j][i] = dp1[j - 1][i - 1] * 9 + dp1[j][i - 1];
        }
        if(S[i] == '0') {
            for(int j = 1; j <= K; j++) {
                dp2[j][i] = dp2[j][i - 1];
            }
        } else {
            for(int j = 1; j <= K; j++) {
                dp2[j][i] = dp2[j - 1][i - 1];
                dp1[j][i] += dp2[j - 1][i - 1] * ((S[i] - '0') - 1) + dp2[j][i - 1];
            }
        }
    }

    cout << dp1[K][S.length() - 1] + dp2[K][S.length() - 1] << endl;
}

Measured memory_bytes: 3600
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0;i < (n);i++)
using ll = long long;
const ll MOD=1000000007;
const long long INF = 1LL << 60;
const double pi=acos(-1);





int main() 
{
  ll H,K,W; cin>>H>>W>>K;
  ll sum=0;
  vector<ll> yoko(H,0);
  vector<ll> tate(W,0);
  vector<string> grid(H);
  rep(i,H)
  {
    cin>>grid.at(i);
    rep(j,W)
    {
      if(grid.at(i).at(j)=='#') 
      {
        yoko.at(i)++;
        tate.at(j)++;
        sum++;
      }
    }
  }
  //cout<<sum<<endl;
  /*
  rep(i,H)
  {
    if(i!=0) cout<<" ";
    cout<<yoko.at(i);
  }
  cout<<endl;
  rep(i,W)
  {
    if(i!=0) cout<<" ";
    cout<<tate.at(i);
  }
  cout<<endl;
  */
  
  
  ll ans=0;
  rep(i,1<<H)
  {
    rep(j,1<<W)
    {
      ll i2=i,j2=j;
      ll sum2=sum;
      vector<int> yoko2(0);
      vector<int> tate2(0);
      rep(k,H)
      {
        if(i2&1) {yoko2.push_back(k);}
        i2>>=1;
      }
      rep(k,W)
      {
        if(j2&1) {tate2.push_back(k);}
        j2>>=1;
      }
      /*
      rep(i,yoko2.size())
      {
        if(i!=0) {cout<<" ";}
        cout<<yoko2.at(i);
      }
      cout<<";"<<endl;
      rep(i,tate2.size())
      {
        if(i!=0) {cout<<" ";}
        cout<<tate2.at(i);
      }
      cout<<";"<<endl;
      */
      for(auto hoge:yoko2)
      {
        sum2-=yoko.at(hoge);
      }
      for(auto hoge:tate2)
      {
        sum2-=tate.at(hoge);
      }
      
      for(auto k:yoko2)
      {
        for(auto l:tate2)
        {
          if(grid.at(k).at(l)=='#')
          {
            sum2++;
          }
        }
      }
      
      if(sum2==K) {ans++;}
    }
  }  
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 3632
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
constexpr int MOD = 1000000000 + 7;
constexpr int INF = 2000000000;
using namespace std;

int h, w;
int osenbei[10][10000];
int ans;
int flag[10];

int count() {
	int res = 0;
	for (int j = 0; j < w; j++) {
		int count1 = 0;
		for (int i = 0; i < h; i++) {
			if ((flag[i] && !osenbei[i][j]) || (!flag[i] && osenbei[i][j]))count1++;
		}
		if (count1 < h - count1) {
			res += h - count1;
		}
		else {
			res += count1;
		}
	}
	return res;
}

void calc(int hcount) {
	if (hcount == h) {
		int num = count();
		if (ans < num)ans = num;
		return;
	}

	flag[hcount] = 0;
	calc(hcount + 1);

	flag[hcount] = 1;
	calc(hcount + 1);
}

int main() {
	while (cin >> h >> w&&h&&w) {
		ans = 0;
		for (int i = 0; i < h; i++)for (int j = 0; j < w; j++)cin >> osenbei[i][j];
		calc(0);
		cout << ans << endl;
	}
}

Measured memory_bytes: 3472
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

#define rep(i, a, b) for (int i = (a); i < (b); ++i)
#define MOD 1000000007
#define int long long
using ll = long long;
using namespace std;
const int INF = 1LL << 50;
using P       = pair<int, int>;

struct Setup {
    Setup() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(20);
    }
} SETUP;

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

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

signed main() {
    int s, c;
    cin >> s >> c;
    int sc    = min(s, c / 2);
    int c_rem = c - (sc * 2);
    cout << sc + (c_rem / 4) << endl;
}


Measured memory_bytes: 256
package main

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

func main() {
	sc.Split(bufio.ScanWords)
	n := nextInt()

	as := make([]int, n)
	bs := make([]int, n)
	for i := 0; i < n; i++ {
		as[i] = nextInt()
		bs[i] = nextInt()
	}
	sort.Ints(as)
	sort.Ints(bs)

	var m1, m2 int
	if len(as)%2 == 0 {
		m1 = int(float64(as[n/2-1]+as[n/2]) / 2.0 * 2)
		m2 = int(float64(bs[n/2-1]+bs[n/2]) / 2.0 * 2)
	} else {
		m1 = as[n/2]
		m2 = bs[n/2]
	}
	fmt.Println(m2 - m1 + 1)
}

var sc = bufio.NewScanner(os.Stdin)

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}


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

int main(){
	int N, a = 0, ans = 0;
	string S;
	cin>>N;
	for(int i = 0; i < N; i++){
		cin>>S;
		if(S == "A") {
			a++;
		}
		if(S == "Un"){
			if(a - 1 < 0){
				ans = 1;
			}
			a--;
		}
	}
	
		
	if(ans || a != 0) cout<<"NO"<<endl;
	else cout<<"YES"<<endl;
	return 0;
}



Measured memory_bytes: 3160
#include <bits/stdc++.h>
#include <chrono>
#define watch(x) cout << (#x) << " is " << (x) << endl
#define eps 1e-9

typedef long long ll;

using namespace std;

const int N = 1e5;
int a[N+5];

int main()

{
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

    int m;

    cin >> m;

    cout << 24+(24-m);

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define fo(a,b) for(int a=0;a<b;a++)
#define Sort(a) sort(a.begin(),a.end())
#define rev(a) reverse(a.begin(),a.end())
#define fi first
#define se second
#define co(a) cout<<a<<endl
#define sz size()
#define bgn begin()
#define en end()
#define pb(a) push_back(a)
#define pp() pop_back()
#define V vector
#define P pair
#define V2(a,b,c) V<V<int>> a(b,V<int>(c))
#define V2a(a,b,c,d) V<V<int>> a(b,V<int>(c,d))
#define incin(a) int a; cin>>a
#define yuko(a) setprecision(a)
#define uni(a) a.erase(unique(a.begin(),a.end()),a.end())
//#define min min<int>
//#define max max<int>
template<class T>
 void cou(vector<vector<T>> a){
  int b=a.size();
  int c=a[0].size();
  fo(i,b){
    fo(j,c){
      cout<<a[i][j];
      if(j==c-1)
        cout<<endl;
      else
        cout<<' ';
    }
  }
}
/*template<>
 void cou(vector<vector<char>> a){
  int b=a.size();
  int c=a[0].size();
  fo(i,b){
    fo(j,c){
      cout<<a[i][j];
      if(j==c-1)
        cout<<endl;
      else
        cout<<' ';
    }
  }
}*/
 int wari(int a,int b) {
   if(a%b==0)
     return a/b;
   else
     return a/b+1;
 }
 int keta(int a){
  double b=a;
  b=log10(b);
  int c=b;
  return c+1;
 }
 int souwa(int a){
  return a*(a+1)/2;
 }
 /*int lcm(int a,int b){
  int d=a,e=b,f;
  if(a<b)
    swap(a,b);
  int c,m=1;
  while(m){
    c=a%b;
    if(c==0){
       f=b;
      m--;
    }
    else{
      a=b;
      b=c;
 }
  }
  return d*e/f;
    }
  int gcm(int a,int b){
      int d=a,e=b,f;
  if(a<b)
    swap(a,b);
  int c,m=1;
  while(m){
    c=a%b;
    if(c==0){
       f=b;
      m--;
    }
    else{
      a=b;
      b=c;
 }
  }
  return f;
  }*/
 bool prime(int a){
   if(a<2)
     return false;
   else if(a==2)
     return true;
   else if(a%2==0)
     return false;
   double b=sqrt(a);
    for(int i=3;i<=b;i+=2){
      if(a%i==0){
        return false;
      }
    }
   return true;
 }
struct Union{
  vector<int> par;
  Union(int a){
	par= vector<int>(a,-1);
  }
  int find(int a){
    if(par[a]<0)
      return a;
    else
      return par[a]=find(par[a]);
  }
  bool same(int a,int b){
    return find(a)==find(b);
  }
  int Size(int a){
    return -par[find(a)];
  }
  void unite(int a,int b){
    a=find(a);
    b=find(b);
    if(a==b)
      return;
    if(Size(b)>Size(a))
      swap<int>(a,b);
    par[a]+=par[b];
    par[b]=a;
  }
};
int ketas(int a){
  string b=to_string(a);
  int c=0;
  fo(i,keta(a)){
    c+=b[i]-'0';
  }
  return c;
}
int gcm(int a,int b){
    if(b==0)
        return a;
    return gcm(b,a%b);
}
int lcm(int a,int b){
    return a/gcm(a,b)*b;
}
/*struct aa{
	vector<int> gt;
  aa(int n){
	gt= vector<int>(n, 1);
  }
	void c(V<int> d,int b){
	if(d[b]==0){
		gt[d[b]-1]++;
		gt[gt.sz-1]++;
	}
	else{
		gt[d[b]-1]++;
		c(d,d[d[b]]-1);
	}
}
void cok(int a){
	cout<<gt[a-1]<<endl;
	fo(i,a-1)
	cout<<gt[i]<<endl;
}
};
*/
/*struct dfs(){

}*/
signed main(){
  double a,b,c,e=1000000,f;
  cin>>a>>b>>c;
  V<double> d(a);
  fo(i,a){
    cin>>d[i];
    d[i]=b-d[i]*0.006;
  }
  fo(i,a){
    if(abs(c-d[i])<e){
      e=abs(c-d[i]);
      f=i;
    }
  }
  cout<<f+1<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define pi acos(-1)
#define ll long long
#define pii pair<ll,ll>
#define debug(a) cout<<a<<'\n'
#define maxn 100009 /// Still trying to be normal
#define MOD 1000000007
#define F first
#define S second
#define rep(i, a, b) for(ll i = a; i < (b); ++i)
#define per(i, b, a) for(ll i = b-1; i>=a ; i--)
#define trav(a, x) for(auto& a : x)
#define allin(a , x) for(auto a : x)
#define all(x) begin(x), end(x)
#define sz(x) (ll)(x).size()
using namespace std;
const ll INF = 1e17 + 9;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin>>n;
    ll ans =0;
    map<string,int >cont;
    while(n--){
        string s;
        cin>>s;
        if(cont[s]==0){
            ans++;
            cont[s]=1;
        }
    }
    cout<<ans<<endl;
    return 0;   
}

Measured memory_bytes: 19200
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <queue>
#include <algorithm>
using namespace std;
typedef unsigned int uint;
typedef long long ll;
typedef pair<int, int> P;
const int c_INF = 111111111;
const int c_mINF = -111111111;
const int c_YET = -1;
const int c_Dx[4] = { 0,0,1,-1 };
const int c_Dy[4] = { 1,-1,0,0 };
const int c_div = 1000000007; //10^9 + 7



int main() {

	int A, B, C, X;

	scanf("%d%d%d%d", &A, &B, &C, &X);

	int ans = 0;

	for (int i = 0; i<=A; i++) {
		for (int j = 0; j<=B; j++) {
			for (int k = 0; k<=C; k++) {
				if (500 * i + 100 * j + 50 * k == X) {
					ans++;
					//printf("%d%d%d\n", i, j, k);
				}


			}
		}
	}



	printf("%d", ans);



}


Measured memory_bytes: 128
import heapq

swap_list = [
    {(6, 21), (7, 22), (8, 23), (9, 11), (12, 17)},
    {(0, 27), (1, 28), (2, 29), (14, 15), (18, 20)},
    {(0, 23), (3, 26), (6, 29), (15, 17), (9, 20)},
    {(2, 21), (5, 24), (8, 27), (12, 14), (11, 18)}
]


def check_complete(cube):
    for surface in (cube[:9], cube[9:12], cube[12:15], cube[15:18], cube[18:21]):
        val = surface[0]
        if any(block - val for block in surface):
            return False
    return True


def next_cubes(cube, prev):
    nc = [None] * 4
    for i in range(4):
        if i != prev:
            nci = cube[:]
            for a, b in swap_list[i]:
                nci[a], nci[b] = cube[b], cube[a]
            nc[i] = nci
    return nc


n = int(input())
while n:
    cube0 = list(map(int, input().split()))
    checked = []
    queue = [(0, cube0, -1)]
    while queue:
        cnt, cube, prev = heapq.heappop(queue)
        if cube in checked:
            continue
        if check_complete(cube):
            print(cnt)
            break
        checked.append(cube)
        for i, next_cube in enumerate(next_cubes(cube, prev)):
            if next_cube and not next_cube in checked:
                heapq.heappush(queue, (cnt + 1, next_cube, i))

    n -= 1

Measured memory_bytes: 7884
n,k = list(map(int,input().split()))
s = str(input())

ans = ""

for i in range(n):
    if i+1 == k:
        if s[i] == "A":
            ans += "a"
        elif s[i] == "B":
            ans += "b"
        else:
            ans += "c"
    else:
        ans += s[i]
        
print(ans)

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

using namespace std;

#define INF 1000000007
#define LINF (1LL << 61)
#define PI 3.14159265358979

typedef long long i64;
typedef pair<i64,i64> P;

inline i64 mod(i64 a, i64 m) { return (a % m + m) % m; }

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



i64 n;
void solve(){
	cin >> n;
	n--;
	string s;
	while(n >= 0){
		s += (char)('a'+n%26);
		n /= 26;
		n--;
	}
	for(int i = s.size(); i > 0; i--){
		cout << s[i-1];
	}
	cout << endl;
}

int main(){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	int t = 1;
	//cin >> t;
	while(t--){
		solve();
	}
	
	return 0;
}

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

using namespace std;

#define lli long long int

lli n;

bool check(lli i, lli j, lli k){
    return (i!=j && j!=k && k!=i && (i+j)>k && (j+k)>i && (k+i)>j);
}

int main(){
    cin>>n;
    vector<lli>v(n, 0);
    for(int i=0;i<n;i++) cin>>v[i];

    vector<int>ans(n,0);
    
    lli c=0;
    if(n>=2 && check(v[0],v[1],v[2])) c=1;
    for(int k=3;k<n;k++){
        for(int j=k-1;j>0;j--){
            int i=j-1;
            while(i>=0){
                if(check(v[i],v[j],v[k])) c++;
                i--;
            }
        }
    }

    cout<<c<<"\n";
    return 0;

}

Measured memory_bytes: 3176
#include <iostream>
#include <string>
#include <vector>

std::vector<std::string> weather =
{
  "Sunny",
  "Cloudy",
  "Rainy"
};

int main(){
  std::string S;
  std::cin >> S;
  
  for(int i=0; i<weather.size(); i++){
    if(weather[i] == S){
      if(weather.size()-1 == i)
        std::cout << weather[0] << std::endl;
      else
        std::cout << weather[i+1] << std::endl;
    }
  }
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define N 500005
using namespace std;
long long a[N],ans,ans1;int n;
void work()
{
	long long sum=a[1]; if (sum<=0) ans=ans+1-sum,sum=1;
	for (int i=2;i<=n;i++){
		sum=sum+a[i]; if (i%2==0){if (sum>=0) ans=ans+sum+1,sum=-1;}
		else if (i%2==1){if (sum<=0) ans=ans+1-sum,sum=1;}
	}
}
void work1()
{
	long long sum=a[1]; if (sum>=0) ans1=ans1+sum+1,sum=-1;
	for (int i=2;i<=n;i++){
		sum=sum+a[i];
		if (i%2==0){if (sum<=0) ans1=ans1+1-sum,sum=1;}
		else if (i%2==1){if (sum>=0) ans1=ans1+sum+1,sum=-1;}
	}
	ans=min(ans,ans1);
}
int main()
{
	scanf("%d",&n); for (int i=1;i<=n;i++) scanf("%lld",&a[i]);
	work(); work1();
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>
#include <vector>
#include <iostream>
#include <queue>
#include <bits/stdc++.h>
 
#define rep(i,n) for (int i=0;i<(n);++i)
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<double> vd;
typedef pair<int, int> pi;

const int MOD = 1000000007;

// const int N = 50;
const int N = 1000005;
vi pt(N, 0);


void init_pt(){
  for (int i=2;i<N;i++){
    if (!pt[i]){
      for (int j=i;j<N;j+=i){
        pt[j] = i;
      }
    }
  }
}

vi factList(int n){
  vi f;
  while(n > 1){
    f.push_back(pt[n]);
    n /= pt[n];
  }
  return f;
}

vector<pi> fact(int n){
  vi fl = factList(n);
  if (fl.size() == 0) return vector<pi>(0);
  vector<pi> f(1, pi(fl[0], 0));
  for(int i: fl){
    if (f.back().first == i){
      f.back().second++;
    }else{
      f.push_back(pi(i, 1));
    }
  }
  return f;
}

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

ll mod_inv(ll a, ll b){
  ll inv = mpow(b, MOD - 2);
  return a * inv % MOD;
}

int main() {
  int n;
  cin >> n;
  vi a(n);
  rep(i, n) cin >> a[i];
  init_pt();

  map<int, int> max_f;
  for(int i=0;i<n;i++){
    vector<pi> f = fact(a[i]);
    for (pi j: f){
      max_f[j.first] = max(j.second, max_f[j.first]);
    }
  }

  ll lcm = 1;
  for (pi fac: max_f){
    rep(_, fac.second){
      lcm = lcm * fac.first % MOD;
    }
  }

  ll ans = 0;
  rep(i, n){
    ans = (ans + mod_inv(lcm, a[i])) % MOD;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 4608
#include<iostream>
#include <algorithm>
#include <string>
#include<math.h>
#define rep(i,n)for(int i=0;i<n;i++)
using namespace std;
int main() {
    int a;
    cin >> a;
    if (a == 1) {
        cout << "Hello World" << endl;
    }
    else {
        int b, c;
        cin >> b >> c;
        cout << b + c << endl;
    }
    return 0;
}


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

using namespace std;

#define int long long

int n,h[200005],a[200005],gt,res,f[1000006];

void update(int id,int l,int r,int vt)
{
    if(l==vt&&r==vt)
    {
        f[id]=gt;
    }
    else if(l>vt||r<vt) return;
    else
    {
        int m=(l+r)/2;
        update(id*2,l,m,vt);
        update(id*2+1,m+1,r,vt);
        f[id]=max(f[id*2],f[id*2+1]);
    }
}

int get(int id,int l,int r,int vt)
{
    if(r<=vt) return f[id];
    else if(l>vt) return -1e15;
    else
    {
        int m=(l+r)/2;
        return max(get(id*2,l,m,vt),get(id*2+1,m+1,r,vt));
    }
}

main()
{
    cin>>n;
    for(int i=1;i<=n;i++) cin>>h[i];
    for(int i=1;i<=n;i++) cin>>a[i];
    for(int i=1;i<=n;i++)
    {
        gt=get(1,1,n,h[i])+a[i];
        update(1,1,n,h[i]);
        res=max(res,gt);
    }
    cout<<res;
}


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

long yugrid(long max_num, long min_num)
{
    long r = max_num - min_num;
    return r;
}

int main()
{
    // int A, B;
    // cin >> A >> B;
    // vector<int> nums{1,2,3};
    // nums.erase(remove(nums.begin(), nums.end(), A), nums.end());
    // nums.erase(remove(nums.begin(), nums.end(), B), nums.end());
    // int ans = nums.at(0);
    // cout << ans << endl;
    // int N;
    // cin >> N;
    // string S, T;
    // cin >> S >> T;
    // string ans = "";
    // for (int i = 0; i < N; i++) {
    //     ans += S.at(i);
    //     ans += T.at(i);
    // }
    // cout << ans << endl;

    long A, B;
    cin >> A >> B;

    long max_num;
    long min_num;
    long G;

    long A_multi_B = A * B;

    while(true) {
        if (A > B)
        {
            max_num = A;
            min_num = B;
        }
        else
        {
            max_num = B;
            min_num = A;
        }
        if (A == B) {
            G = A;
            break;
        }
        A = yugrid(max_num, min_num);
        B = min_num;
    }
    long ans = A_multi_B / G;

    cout << ans << endl;

}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<string>
#include<utility>
#include<queue>
#define rep(i, n) for(int i=0;i<=n;i++)
using namespace std;
int main(){
	int n, m;
	cin>>n>>m;
	cout<<(n+m-1)/m<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream> 
#include <cstring>                            
#include <vector>
#include <queue>
#define reg register
using namespace std;
typedef long long ll;            // >10^18
const int MAXN = 1e5 + 5;
const int INF = 0x3f3f3f3f;   
struct edge{
	int from, to;
	edge(int u, int v){  //结构体赋值 
		from = u, to = v;
	}
};
vector< edge >e[MAXN];
int cnt = 0;
queue< int >Q;
int now, next;
bool vis[MAXN];
bool flag;
void dfs(int x){     //可以加个遍历次数, 在里面写换行代码 dfs(1)
	if(vis[x] == false){
		vis[x] = true;
		flag = true;
		for(int i = 0; i < e[x].size(); i++)
			if(!vis[e[x][i].to])
				dfs(e[x][i].to);
	}
	
}
int main(int argc, char *argv[]){
	ios::sync_with_stdio(0);
	int N, M; cin >> N >> M;
	while(M--){
		int u, v; cin >> u >> v;
		e[u].push_back(edge(u, v));
		e[v].push_back(edge(v, u));
	}
	for(reg int i = 1; i <= N; i++){
		flag = false;
		dfs(i);
		if(flag) cnt++;
	}
	cout << cnt - 1;
	return 0;
}

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

using namespace std;

string a;
int ans=0;

int main() {
	cin>>a;
	int len=a.size();
	for(int i=0;i<len-1;i++) if(a[i]!=a[i+1]) ans++;
	
	cout<<ans<<endl;
	
	return 0;
}

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

int main() {
    int a;
    int b;
 
   cin >> a >> b;
  
  if (a != 1 && b !=1 ){
   
  if (a > b){
    
     cout << "Alice" << endl;
    
  }else if(a == b){
    
    cout << "Draw" << endl;
    
  }else if (a < b){
    
     cout << "Bob" << endl;
    
  }
    
  }else{
    
    if(a == b){
    
      cout << "Draw" << endl;
    
    }else{
      
      if (a == 1){
        cout << "Alice" << endl;
      }else if(b == 1){
        
        cout << "Bob" << endl;
      }
      
      
    }
    
    
  }
  
  
 
  
   
  
  return 0;
}

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

constexpr int MAX_ROOM = 100;

vector<int> sequence;

int next_v;
int degree[MAX_ROOM];
int dist[MAX_ROOM];
vector<int> G[MAX_ROOM];

void dfs(int v, int &idx) {
	if(idx == sequence.size()) return;

	degree[v] = sequence[idx++] - (v ? 1 : 0);

	while(degree[v]) {
		if(sequence[idx] > 0) {
			G[v].emplace_back(next_v);
			G[next_v].emplace_back(v);
			--degree[v];
			dist[next_v] = dist[v] + 1;
			dfs(next_v++, idx);
		}
		else {
			for(int u = 0; u < v; ++u) {
				if(dist[u] - dist[v] == sequence[idx] && degree[u]) {
					G[v].emplace_back(u);
					G[u].emplace_back(v);
					--degree[v];
					--degree[u];
					++idx;
					break;
				}
			}
		}
	}
}

void init() {
	sequence.clear();
	next_v = 1;
	memset(dist, -1, sizeof(dist));
	dist[0] = 0;
	for(auto &vec : G) vec.clear();
}

void solve() {
	init();
	for(int number; cin >> number && number;) {
		sequence.emplace_back(number);
	}

	int idx = 0;
	dfs(0, idx);

	for(int v = 0; v < next_v; ++v) {
		sort(G[v].begin(), G[v].end());
		cout << v + 1;
		for(const auto &to : G[v]) cout << " " << to + 1;
		cout << "\n";
	}
}

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

	while(t--) solve();
}

Measured memory_bytes: 1240
#include <iostream>
using namespace std;
typedef long long ll;
ll N,a;
ll A[100010] = {0};
ll inf = 1e9+7;

ll mult(ll n,ll m){
	if(m==0) return 1;
	else if(m==1) return n%inf;
	else if(m%2==0){
		ll t = mult(n,m/2);
		return (t*t)%inf;
	}else{
		ll t = mult(n,m-1);
		return (n*t)%inf;
	}
}

int main(){
	cin >> N;
	for(int i=0;i<N;i++){
		cin >> a;
		A[a]++;
	}
	if(N%2==1){
		bool judge = true;
		for(int i=0;i<=N/2;i++){
			if(i==0 && A[i]!=1) judge = false;
			if(i!=0 && A[i*2]!=2) judge = false;
		}
		if(judge) cout << mult(2,N/2) << endl;
		else cout << 0 << endl;
	}else{
		bool judge = true;
		for(int i=0;i<N/2;i++){
			if(A[i*2+1]!=2) judge = false;
		}
		if(judge) cout << mult(2,N/2) << endl;
		else cout << 0 << endl;
	}
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define sort(v) sort(v.begin(),v.end())
#define pb push_back
int main()
{
 ll a,b,c,d;
  cin>>a;
 if(a%1000==0)cout<<0;
 else {
 c=a/1000;
 c++;
 b=c*1000;
cout<<b-a;
}}

Measured memory_bytes: 3600
// ITP1_4_C
#include<iostream>
#include<cstdio>
#define PI 3.141592653589
using namespace std;
int main(){
	while(true){
		int x,y,t;
		char c; // ?????????:char??§?????? 
		cin >> x >> c >> y;
		if (c=='?') break;
		int z;
		switch(c){
		  case '+':
			z=x+y;
			break;
		  case '-':
			z=x-y;
			break;
		  case '*':
			z=x*y;
			break;
		  case '/':
			z=x/y;
			break;
		}
		printf("%d\n",z);
	}
	return 0;
}

Measured memory_bytes: 3172
#include <algorithm>
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define ll long long
#define INF 1000000000000000000

int main() {
    int N, K;
    cin >> N >> K;
    ll R, S, P;
    cin >> R >> S >> P;
    string T;
    cin >> T;
    map<char, ll> ma;
    ma['r'] = P, ma['s'] = R, ma['p'] = S;
    ll res = 0;
    vector<bool> win(N, false);

    rep(i, K) {
        res += ma[T[i]];
        win[i] = true;
    }

    for (int i = K; i < N; i++) {
        if (T[i] == T[i - K]) {
            if (!win[i - K])
                res += ma[T[i]], win[i] = true;
        } else
            res += ma[T[i]], win[i] = true;
    }

    cout << res << endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i, n) for(int i = 0; i < n; i++)
#define REP(i, a, b) for(int i = a; i <= b; i++)
#define all(x) x.begin(), x.end()
#define fi first
#define se second
#define debug(...) cerr<<__LINE__<<" ["<<#__VA_ARGS__<<"]:",debug_out(__VA_ARGS__)
template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec)
{ for (auto v : vec) os << v << ' '; os << '\n'; return os; }
template <typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &pa)
{ os << '(' << pa.first << ',' << pa.second << ')'; return os; }
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T)
{ cerr << " " << H; debug_out(T...); }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF = (1<<30) - 1;
const ll LINF = (1LL<<60) - 1;

void solve() {
    int n, a, b;
    cin >> n >> a >> b;
    cout << min(n * a, b) << endl;
}

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


Measured memory_bytes: 3640
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
#define double long double
typedef vector<int> VI;
typedef pair<int, int> pii;
typedef vector<pii> VP;
typedef vector<string> VS;
typedef priority_queue<int> PQ;
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; }
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
#define eps 1e-12 
//priority_queue<int,vector<int>, greater<int> > q2;



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

	int N, M, X, Y;
	string S, T;
	
	cin >> N >> M >> X;

	if (M*X >= N)cout << "Yes" << endl;
	else cout << "No" << endl;


	return 0;
}



Measured memory_bytes: 3608
n, x = map(int,input().split())

if x > n // 2:
    x = n - x

xx = x
yy = n - x

ans = n
i = 0

while True:
    ans += 2 * (yy // xx) * xx
    yy %= xx

    if yy == 0:
        ans -= xx
        break

    if yy < xx:
        tmp = xx
        xx = yy
        yy = tmp

print(ans)


Measured memory_bytes: 43120
import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)
INF = float('inf')

N = int(input())
AC = 0
WA = 0
TLE = 0
RE = 0

for _ in range(N):
    s = input()
    if s == "AC":
        AC += 1
    elif s == "WA":
        WA += 1
    elif s == "TLE":
        TLE += 1
    elif s == "RE":
        RE += 1
print("AC x {}".format(AC))
print("WA x {}".format(WA))
print("TLE x {}".format(TLE))
print("RE x {}".format(RE))

Measured memory_bytes: 9224
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define vi vector<int>
#define ff first
#define ss second
#define file_se_input  freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#define pp long long int
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define pb push_back
#define mp make_pair
#define pi 3.141592653589793238
#define eb emplace_back
#define rep(i,a,b) for (int i = a; i <= b; i++)
#define zip(i,a,b) for(int i=a;i<b;i++)
#define rzip(i,a,b) for(int i=a;i>=b;i--)
#define ll unsigned long long int
#define test int t;cin>>t; while(t--)
#define um unordered_map
#define en '\n'
#define us unordered_set
typedef pair<int, int>     pii;
typedef pair<char, int>    pci;
typedef pair<char, char>   pcc;
typedef vector<pii>       vii;
typedef long double ld;
#define all(v) v.begin(), v.end()
#define INF (1e18+5)
#define inf (1e9+5)
#define mod 1000000007


bool check_prime(long long n)
{
	int flag = 0;
	for (long long i = 2; i * i <= n; i++)
	{
		if (n % i == 0)
		{
			flag = 1;
			break;
		}
	}
	if (n == 1)
		return false;
	else if (flag == 0 || n == 2 || n == 3)
	{
		return true;
	}
	else
	{
		return false;
	}

}

int BE(int x, int n, int m) //function to calculate x raise to power n modulo m
{
	int result = 1;
	while (n > 0)
	{
		if (n % 2 == 1)
			result = result * x % m;
		x = x * x % m;
		n = n / 2;
	}
	return result;
}

int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(0);
#ifndef ONLINE_JUDGE
	if (fopen("input.txt", "r"))
	{
		freopen ("input.txt" , "r" , stdin);
		freopen ("output.txt" , "w" , stdout);
	}
#endif
	//_______________________________-code starts-_______________________________________________

	int n, k;
	cin >> n >> k;
	int a[n];
	int pos1;
	zip(i, 0, n)
	{
		cin >> a[i];
		if (a[i] == 1)
		{
			pos1 = i;
		}
	}
    int ans = (n-k)/(k-1)+1;
   if((n-k)%(k-1)!=0)ans++;
   cout << ans << endl;

	return 0;
}



Measured memory_bytes: 1024
#include "bits/stdc++.h"
using namespace std;

int main() {
  int N;
  cin >> N;
  vector<int> r(N);
  for(int i = 0; i < N; i++)
  {
    cin >> r.at(i);
  }
  
  int count = 0;
  int high = 0;
  for(int i = 0; i < N; i++)
  {
    if (high <= r.at(i)) {
      count++;
      high = r.at(i);
    }
  }
  
  cout << count << endl;

  return 0;

}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
	int a, b,c;
	cin >> a >> b>>c;

	if (b > c)
	{
		int t = b;
		b = c;
		c = t;
	}
	if (a > b)
	{
		int t = a;
		a = b;
		b = t;
	}
	if (b > c)
	{
		int t = b;
		b = c;
		c = t;
	}
	cout << a << " " << b << " " << c << endl;

	return 0;
}


Measured memory_bytes: 3088
#include <iostream>
#include <algorithm>
#include <complex>
#include <utility>
#include <vector>
#include <string>
#include <queue>
#include <tuple>
#include <cmath>
#include <bitset>
#include <cctype>
#include <set>
#include <map>
#include <unordered_map>
#include <numeric>
#include <functional>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
using namespace std;
using ll = long long;
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; }
inline void Yes(bool condition){ if(condition) PRINT("Yes"); else PRINT("No"); }
template<class itr> void cins(itr first,itr last){
    for (auto i = first;i != last;i++){
        cin >> (*i);
    }
}
template<class itr> void array_output(itr start,itr goal){
    string ans = "",k = " ";
    for (auto i = start;i != goal;i++) ans += to_string(*i)+k;
    if (!ans.empty()) ans.pop_back();
    PRINT(ans);
}
ll gcd(ll a, ll b) {
    return a ? gcd(b%a,a) : b;
}
const ll INF = 1e18;
const ll MOD = 1000000007;
typedef pair<ll,ll> P;
const ll MAX = 100010;
constexpr ll nx[8] = {1,0,-1,0,-1,-1,1,1};
constexpr ll ny[8] = {0,1,0,-1,-1,1,-1,1};
int prefix(string s){
    int n = s.size();
    vector<int> z(n);
    z[0] = n;
    int i = 1,j = 0;
    while(i < n){
        while(i+j < n && s[j] == s[i+j]) j++;
        z[i] = j;
        if (j == 0){
            i++;
            continue;
        }
        int k = 1;
        while(k+z[k] < j){
            z[i+k] = z[k];
            k++;
        }
        i += k;
        j -= k;
    }
    int res = 0;
    rep(i,n){
        chmax(res,min((int)i,z[i]));
    }
    return res;
}
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    string s;
    cin >> n >> s;
    int ans = 0;
    rep(i,n-1){
        chmax(ans,prefix(s.substr(i,n-i)));
    }
    PRINT(ans);
}    


Measured memory_bytes: 256
/* 
    @author : srinathbalaji_99
*/


#include<bits/stdc++.h>

#define PB push_back
#define MP make_pair
#define endl '\n'
#define MAX LLONG_MAX
#define MIN LLONG_MIN
#define rep(i, a, b, inc) for(long long i = a; i < b; i += inc)
#define REP(i, n) rep(i, 0, n, 1)
#define MEM(a, b) memset(a, (b), sizeof(a))
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
#define PLL pair<long long, long long>
#define VL vector<long long>
#define VS vector<string>
#define VLL vector<PLL>
#define VVL vector<VL>
#define MPLL map<long long, long long>
#define UMPLL unordered_map<long long, long long>
#define SETL set<long long>
#define MSETL multiset<long long>
#define GCD(a, b) __gcd(a, b)
#define LCM(a, b) (a * b)/GCD(a, b)
#define ff first
#define ss second
#define pall(a) REP(i, sizeof(a)/sizeof(a[0]))cout << a[i] << " ";cout << endl;
#define pvall(v) REP(i, v.size())cout << v[i] << " ";cout << endl;
#define gall(a, n) REP(i, n)cin >> a[i];
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()

typedef unsigned long long ULL;
typedef long long LL;
typedef long double LD;


using namespace std;

void fast()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}

int main()
{
    fast();



    LL t,n,i,j,k,x,y,c,m;
    cin >> n;
    LL lim = 10;
    LL res = 0;
    while(n >= lim){ 
        if(lim > 10){
            res += ((lim - (lim) / 10));
        }
        else{
            res += 9;
        }
        lim *= 100;
    }
    lim /= 10;
    if(to_string(n).size() & 1){
        res += (n - (lim) + 1);
    }
    cout << res;

}

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

using namespace std;
 
using ll = long long;
using ull = unsigned long long;
using ldouble = long double;
 
const ll inf = 1ll << 60;
const ll mod = (ll)1e9 + 7;

#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define print(s) cout << s;
#define println(s) cout << s << endl;
#define printd(s) cout << fixed << setprecision(10) << s << endl;

string res;

int main()
{
    ll n, k, x, y;
    cin >> n >> k >> x >> y;

    if (n < k)
    {
        println(n * x);
    }
    else
    {

        println(k * x + (n - k) * y);
    }
}

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

char *decode (char *inbuf, int s) {
  int p = 0;
  while (inbuf[p] != 0) {
    if ((inbuf[p] >= 'a')&&(inbuf[p]<='z')) {
      int t = inbuf[p] + s;
      //inbuf[p] = inbuf[p] + (char)s;
      if (t > 'z')      inbuf[p] = (char)(t - 26);
      else if (t < 'a') inbuf[p] = (char)(t + 26);
      else              inbuf[p] = (char)t;
    }
    p++;
  }
  return (inbuf);
}

int main(){
  char inbuf[82];
  while(fgets(inbuf,80,stdin)){
    int s;
    char *p=inbuf;
    while(*p){
      s = 0;
      if (((*p-*(p+1))==12)||((*p-*(p+1))==-14)) {
	/* the */
	if (((*p-*(p+2))==15)||((*p-*(p+2))==-11)) {
	  if((*(p+3)<'a')||(*(p+3)>'z'))
	    s = 't' - *p;
	}
	/* that */
	else if (((*p-*(p+2))==19)||((*p-*(p+2))==-7)) {
	  if (*p-*(p+3) == 0)
	    if((*(p+4)<'a')||(*(p+4)>'z'))
	      s = 't' - *p;
	}
	/* this */
	else if (((*p-*(p+2))==11)||((*p-*(p+2))==-15)) {
	  if (((*p-*(p+3))==1)||((*p-*(p+3))==-25))
	    if((*(p+4)<'a')||(*(p+4)>'z'))
	      s = 't' - *p;
	}
      }
      if (s) break;
      p++;
    }
    printf("%s",decode(inbuf, s));
  }
  return 0;
}

Measured memory_bytes: 524
N = int(input())

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

dic = {}

s = sum(A)
for i in A:
    if i not in dic:
        dic[i] = 1
    else:
        dic[i] += 1
        

Q = int(input())

for i in range(Q):

    B,C = map(int,input().split())

    if B not in dic:
        pass
    else:

        s -= dic[B] * B
        s += dic[B] * C

        if C not in dic:
            dic[C] = 0

        dic[C] += dic[B]
        dic[B] = 0

    print (s)


Measured memory_bytes: 85264
#include <iostream>
#include <stack>
#include <vector>
#include <fstream>
#include <string>
#include <time.h>
#include <functional>
#include <memory>
#include <map>
#include <set>
#include <algorithm>


using namespace std;

vector<string> vs[100];

int main()
{
	string s;
	cin >> s;
	int i = 0;
	bool flag1 = false;
	bool flag2 = false;
	for (; i < s.length(); i++)
	{
		if (s[i]=='C')
		{
			i++;
			flag1 = true;
			break;
		}
	}
	if (flag1){
		for (int j = i; j < s.length(); j++)
		{
			if (s[j] == 'F')
			{
				flag2 = true;
				break;
			}
		}
	}
	if (flag2)
	{
		cout << "Yes" << endl;
	}
	else
	{
		cout << "No" << endl;
	}
	
	return 0;
}

Measured memory_bytes: 256
<?php

function input() {
    return trim(fgets(STDIN));
}

function input_array() {
    return explode(' ', input());
}

$N = input();
if ($N == 1) {
    echo "Hello World\n";
} else {
    $A = input();
    $B = input();
    echo ($A + $B) . "\n";
}

Measured memory_bytes: 4728
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <functional>
#include <bitset>
#include <numeric>
#include <complex>
#include <iomanip>
#include <cassert>
#include <random>


class UnionFind {
private:
    std::vector<int> par, ran;

public:
    UnionFind(int n) : par(n, -1), ran(n, -1) {};

    void unite(int x, int y) {
        x = find_root(x);
        y = find_root(y);
        if (x == y) return;

        if (ran[x] < ran[y]) {
            par[find_root(y)] += par[find_root(x)];
            par[x] = y;
        }
        else {
            par[find_root(x)] += par[find_root(y)];
            par[y] = x;
            if (ran[x] == ran[y]) ran[x]++;
        }
    }

    int size(int x) {
        return -par[find_root(x)];
    }

    bool same(int x, int y) {
        return find_root(x) == find_root(y);
    }

    int find_root(int x) {
        if (par[x] < 0) {
            return x;
        }
        else {
            return par[x] = find_root(par[x]);
        }
    }
};


int main() {
    int n; std::cin >> n;
    std::vector<int> x(n), y(n);
    std::vector<int> prev(1e5, -1);
    UnionFind uf(1e5);
    for (int i = 0; i < n; i++) {
        std::cin >> x[i] >> y[i];
        x[i]--; y[i]--;
        if (prev[y[i]] != -1) {
            uf.unite(x[i], prev[y[i]]);
        }
        prev[y[i]] = x[i];
    }
    std::map<int, std::set<int>> s;
    for (int i = 0; i < n; i++) {
        s[uf.find_root(x[i])].insert(y[i]);
    }
    long long ans = -n;
    for (const auto &p : s) {
        ans += uf.size(p.first) * p.second.size();
    }
    std::cout << ans << std::endl;
    return 0;
}


Measured memory_bytes: 4608
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,m,ans=0;
  cin >> n >> m;
  vector<int> x(n),mod(m,0),num(100010,0);
  for(int i=0;i<n;i++){
    cin >> x[i];
    mod[x[i]%m]++;
    num[x[i]]++;
  }
  for(int i=0;i*2<=m;i++){
    if(i*2%m==0){
      ans+=mod[i]/2;
      mod[i]%=2;
    }
    else{
      int p=min(mod[i],mod[m-i]);
      ans+=p;
      mod[i]-=p;
      mod[m-i]-=p;
    }
  }
  for(int i=1;i<100001;i++){
    if(mod[i%m]>1 && num[i]>1){
      ans+=min(mod[i%m]/2,num[i]/2);
      mod[i%m]-=min(mod[i%m]/2*2,num[i]/2*2);
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 1408
#include <iostream>
#include <set>
#include <map>
#include <string>
#include <math.h>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <bitset>
#include <string.h>

using namespace std;

// #define for(i,a,b) for (int i=(a);i<(b);++i)
typedef long long ll;
typedef pair<ll,ll> P;
#define REP(i,n) for(long long i = 0; i < (long long)(n); i++)
#define pb push_back // vectorに要素追加
#define INF (ll)1e18

ll mod = 1e9+7;

bool judge(ll i){
	bool ans = true;
	ll tmp1 = i%10;
	while (i/10>0){
		i /= 10;
		if (abs(i%10 - tmp1)>1) ans = false;
		tmp1 = i%10;
	}
	return ans;
}
// 検索タグ
int main() {
	// 入力
	ll K;cin>>K;
    
	// 解法
	ll count = 0;
	ll ans = -1;
	vector<vector<ll>> lunlun;

	while (count<K){
		ll lunlun_size = lunlun.size();
		vector<ll> lunlun_i;
		if (lunlun.size()==0){
			REP(i,9){
				ll tmp = i+1;
				lunlun_i.pb(tmp); // 1-9
				// printf("%lld\n", tmp);
				count++;if (count==K){ans = tmp;break;}
			}
		}
		else{
			ll pre_lunlun_i_size = lunlun[lunlun_size-1].size();
			REP(i, pre_lunlun_i_size){ // 前の桁の各要素について
				ll base = lunlun[lunlun_size-1][i];
				if (base%10==0){
					ll tmp = base*10+ base%10 ;
					lunlun_i.pb(tmp);
					// printf("%lld\n", tmp);
					count++;if (count==K){ans = tmp;break;}
					tmp = base*10+ base%10 +1;
					lunlun_i.pb(tmp);
					// printf("%lld\n", tmp);
					count++;if (count==K){ans = tmp;break;}
				}
				else if (base%10!=9){
					ll tmp = base*10 + base%10 -1;
					lunlun_i.pb(tmp);
					// printf("%lld\n", tmp);
					count++;if (count==K){ans = tmp;break;}
					tmp = base*10 + base%10 ;
					lunlun_i.pb(tmp);
					// printf("%lld\n", tmp);
					count++;if (count==K){ans = tmp;break;}
					tmp = base*10+ base%10 +1;
					lunlun_i.pb(tmp);
					// printf("%lld\n", tmp);
					count++;if (count==K){ans = tmp;break;}
				}
				else{
					ll tmp = base*10+ base%10 -1;
					lunlun_i.pb(tmp);
					// printf("%lld\n", tmp);
					count++;if (count==K){ans = tmp;break;}
					tmp = base*10+ base%10 ;
					lunlun_i.pb(tmp);
					// printf("%lld\n", tmp);
					count++;if (count==K){ans = tmp;break;}
				}
			}
		}
		lunlun.pb(lunlun_i);
	}
	// REP(i, 3234566667){
	// 	if (judge(i+1)){
	// 		// printf("%lld\n", i+1);
	// 		count++;
	// 	}
	// 	if (count==K){
	// 		ans = i+1;
	// 		break;
	// 	}
	// }

	//出力
	printf("%lld\n", ans);
}


Measured memory_bytes: 1312
#define _USE_MATH_DEFINES
#include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<functional>
#include<algorithm>
#include<cstdio>
#include<unordered_map>
using namespace std;
//---------------------------------------------------
//ライブラリゾーン！！！！
typedef long long ll;
typedef long double ld;
#define str string
#define rep(i,j) for(ll i=0;i<(long long)(j);i++)
const ll Mod = 1000000007;
const ll gosenchou = 5000000000000000;
short gh[2][4] = { { 0,0,-1,1 },{ -1,1,0,0 } };
struct P {
	ll pos, cost;
};
bool operator<(P a, P b) { return a.cost < b.cost; }
bool operator>(P a, P b) { return a.cost > b.cost; }
struct B {//隣接リスト表現
	ll to, cost;
};
struct E {//辺の情報を入れる変数
	ll from, to, cost;
};
bool operator<(E a, E b) {
	return a.cost < b.cost;
}
struct H {
	ll x, y;
};
bool operator<(H a, H b) {
	if (a.x != b.x) return a.x < b.x;
	return a.y < b.y;
}
bool operator>(H a, H b) {
	if (a.x != b.x) return a.x > b.x;
	return a.y > b.y;
}
bool operator==(H a, H b) {
	return a.x == b.x&&a.y == b.y;
}
bool operator!=(H a, H b) {
	return a.x != b.x || a.y != b.y;
}
ll gcm(ll i, ll j) {//最大公約数
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcm(j%i, i);
}
ld rad(H a, H b) {
	return sqrt(pow(a.x - b.x, 2.0) + pow(a.y - b.y, 2.0));
}//rad＝座標上の2点間の距離
ll ari(ll a, ll b, ll c) {
	return (a + b)*c / 2;
}//等差数列の和
bool suf(ld a, ld b, ld c, ld d) {
	if (b <= c || d <= a) return 0;
	return 1;
}//[a,b),[c,d)
ll fact(ll i, ll z) {
	ll sum = 1;
	for (ll j = max(z, 2LL); j <= i; j++)
		sum = (sum* j) % Mod;
	return sum;
}//階乗(正）
ll mod_pow(ll x, ll n, ll p) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res*x%Mod;
		x = x*x%p;
		n >>= 1;
	}
	return res;
}
#define int long long
const long long inf = 4523372036854775807;
const int iinf = 1500000000;
//----------------------------------------------------
//++++++++++++++++++++++++++++++++++++++++++++++++++++
int h, w, n;
bool a[1000][1000];
int dp[1001][1001];
H ans;
void solve(int x, int y) {
	if (x == h || y == w) {
		ans = H{ x,y };
		return;
	}
	if (a[x][y]) solve(x, y + 1);
	else solve(x + 1, y);
}
signed main() {
	while (cin >> h >> w >> n&&h + w + n > 0) {
		for (int i = 0; i < h; i++) {
			for (int j = 0; j < w; j++) {
				cin >> a[i][j];
				dp[i][j] = 0;
			}
		}
		dp[0][0] = n - 1;
		for (int i = 0; i < h; i++) {
			for (int j = 0; j < w; j++) {
				if (a[i][j]) {
					dp[i][j + 1] += ceil(dp[i][j] / 2.0);
					dp[i + 1][j] += floor(dp[i][j] / 2.0);
				}
				else {
					dp[i + 1][j] += ceil(dp[i][j] / 2.0);
					dp[i][j + 1] += floor(dp[i][j] / 2.0);
				}
			}
		}
		for (int i = 0; i < h; i++) {
			for (int j = 0; j < w; j++) {
				if (dp[i][j] % 2 == 1) {
					a[i][j] = !a[i][j];
				}
			}
		}
		solve(0, 0);
		cout << ans.x + 1 << " " << ans.y + 1 << endl;
	}
	getchar(); getchar();
}


Measured memory_bytes: 11776
import java.util.Scanner;

public class Main {

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

		double x1 = scan.nextDouble();
		double y1 = scan.nextDouble();
		double x2 = scan.nextDouble();
		double y2 = scan.nextDouble();

		double ans = Math.sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));

		System.out.println(ans);
		scan.close();
		System.exit(0);
	}

}

Measured memory_bytes: 28068