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

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rrep(i, n) for(int i = ((int)(n)-1); i >= 0; i--)
#define all(x) (x).begin(),(x).end()
 
using namespace std;
using ll = long long;
 
struct edge { int to, cost; };
 
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> P;
 
const int INF = 1e9;
const int MOD = 1e9+7;
const double EPS = 1.0e-10;
const double PI = acos(-1.0);
 
const int mx4[] = {0,1,0,-1};
const int my4[] = {1,0,-1,0};
const int mx8[] = {0,1,1,1,0,-1,-1,-1};
const int my8[] = {1,1,0,-1,-1,-1,0,1};

ll Pow(ll x,ll n) {
	ll res = 1;
	while (n > 0) {
		if(n&1) res = res * x % MOD;
		x = x * x % MOD;
		n >>= 1;
	}
	return res;
}

int main() {
	ll n,a,b;
	cin >> n >> a >> b;
	ll sum = Pow(2,n)-1,z1,z2,tmp1 = 1,tmp2 = 1;
	for(int i = 0; i < a; i++){
		tmp1 = (tmp1*(i+1))%MOD;
		tmp2 = (tmp2*(n-i))%MOD;
	}
	z1 = tmp2*Pow(tmp1,MOD-2)%MOD;
	tmp1 = 1, tmp2 = 1;
	for(int i = 0; i < b; i++){
		tmp1 = (tmp1*(i+1))%MOD;
		tmp2 = (tmp2*(n-i))%MOD;
	}
	z2 = tmp2*Pow(tmp1,MOD-2)%MOD;
	ll ans = (sum-z1-z2);
	while(ans < 0) ans += MOD;
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
let () =
  let rec count n = if n < 10 then 1 else 1 + count (n/10) in
  try
    while true do
      let n = Scanf.scanf "%d %d\n" @@ fun a b -> a + b in
      Printf.printf "%d\n" (count n)
    done;
  with End_of_file -> ()


Measured memory_bytes: 2484
//g++ -std=c++14 test.cpp -o test.out
//問題URL
//https://atcoder.jp/contests/abc179/tasks/abc179_e

//ポイント：
//制約が10^10となっているときに使えそうなアルゴリズム
//二部探索
//ダブリング
//ループ構造
 
//今回はmodのループする性質を用いる

//ループする場合
//スタート地点からある距離まで進んだ地点がループ開始地点
//スタート地点がループ開始地点
//の場合がある
 
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <iomanip>
#include <vector>
#include <queue>
#include <stack>
#include <map> 
#include <unordered_map> 
#include <utility>
#include <limits.h>
#include <bitset>
#include <set>
using namespace std;
 
#define LL long long int
const LL INF = (1LL<<60);
const int INF_INT = 2147483647-1e6-1;
const LL mod = 1000000007ll;
const int mod_int = 1000000007;

LL N,X,M;

LL ans = 0;

void solve(){
    //i回の操作までの累積和をaccum[i]とおく
    vector<LL> accum(M+1,0);
    //ループ一回あたりの操作回数
    LL operation_per_loop = 0;
    //ループ一回あたりの和
    LL sum_per_loop = 0;
    //ループ開始地点
    LL loop_start_Ai = 0;
    //最初の状態から操作を何回繰り返すとAiになるかをdist[Ai]とする
    vector<LL> dist(M,-1); dist[X] = 0;
    LL operation = 0;
    LL now = X;
    while(1){
        operation++;
        accum[operation] = accum[operation-1] + now;
        LL next = (now*now)%M;
        if(dist[next]!=-1){
            loop_start_Ai = next;
            operation_per_loop = operation - dist[next];
            sum_per_loop = accum[operation] - accum[dist[next]];
            accum[operation+1] = accum[operation] + next;
            break;
        }
        dist[next] = operation;
        now = next;
    }

   //cout << loop_start_Ai << "," << operation_per_loop << "," << sum_per_loop << endl;

    if(N<=operation) ans = accum[N];
    else{
        LL former_operation = dist[loop_start_Ai];
        LL numof_loop = (N-former_operation)/operation_per_loop;
        LL later_operation = (N-former_operation)%operation_per_loop;
        //cout << later_operation << endl;
        ans = accum[former_operation]  + numof_loop*sum_per_loop + (accum[former_operation+later_operation]-accum[former_operation]);
    }
}
 
int main(){
	cin >> N >> X >> M;
 
    solve();

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

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

using namespace std;
using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
#define REP(i,n) for(ll i = 0;i < (ll)n;i++)
#define REPD(i,n) for(ll i = (ll)n - 1;i >= 0;i--)
#define ALL(x) (x).begin(),(x).end()
#define FILLl(n,first_dimension_size,value) fill((ll*)n,(ll*)(n+first_dimension_size),value)
#define FILL(n,first_dimension_size,value) fill((int*)n,(int*)(n+first_dimension_size),value)
#define INF (1 << 30)
#define MOD 1000000007
//int dy[4] = {-1,0,0,1};
//int dx[4] = {0,1,-1,0};

/*
ll mod(ll n){
  ll res = 1ll;
  ll modd = MOD - 2ll;
  while(modd){
    if(modd & 1ll)(res *= n)%= MOD;
    (n *= n)%= MOD;
    modd >>= 1ll;
  }
  return res;
}
*/
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

// a^{-1} mod を計算する
long long modinv(long long a, long long mod) {
    return modpow(a, mod - 2, mod);
}

ll oh[100100];
ll reoh[100100];
ll mp[100100];

ll comb(ll n,ll r){
  if(n < r)return 0;
  ll res = (oh[n]*reoh[n-r])%MOD;
  res = (res*reoh[r])%MOD;
  return res;
}


int main(){
  
  oh[0] = 1;
  reoh[0] = 1;
  FILLl(mp,100100,0);
  for(ll i = 1;i < 100100ll;i++)oh[i] = (oh[i-1]*i)%MOD;
  for(ll i = 1;i < 100100ll;i++)reoh[i] = (modinv(oh[i],MOD))%MOD;
  
  ll n;
  cin >> n;
  ll l = 0,r = 0;
  REP(i,n+1ll){
    ll x;cin >> x;
    if(!mp[x]){
      mp[x] = i+1ll;
    }else{
      l = mp[x]-1ll;
      r = n-i;
    }
  }
  REP(i,n+1ll){
    ll res = comb(n+1ll,i+1ll)%MOD;
    res = (2ll*MOD + res - comb(r+l,i))%MOD;
    cout << res << endl;
  }
  

  return 0;
}


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

using namespace std;

#define endl "\n"

const int INF = 1e9 + 5;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
	
	int t, k;
	cin >> t >> k;
	vector<int> A(t);
	for(int &i : A) cin >> i ;
	vector<int> dp(t, INF);
	dp[0] = 0;
	for(int i =0; i< t; i++) {
		for(int j = i+1; j <= i + k ; j++) {
			if(j < t) {
				dp[j] = min(dp[j], dp[i] + abs(A[j] - A[i]));
			}
		}
	}

	cout << dp[t-1] << endl;

    return 0;
}



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

int main() {
  string s;
  cin >> s;
  
  int n;
  n = s.size() - 1;
  
  if (s.at(n) == 's')
    cout << s << "es" << endl;
  else
    cout << s << "s" << endl;
}

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

int N;
int H[100005];

int main() {
    cin >> N;
    for (int i = 0; i < N; i++) {
        cin >> H[i];
    }
    int c = 0;
    int ans = 0;
    for (int i = N-1; i > 0; i--) {
        if (H[i] <= H[i-1]) {
            c++;
            if (ans < c) ans = c;
        } else {
            c = 0;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 888
n, m, l = map(int, input().split())

Q1 = []
Q2 = []
for x in range(n):
    Q1.append(list(map(int, input().split())))

for x in range(m):
    Q2.append(list(map(int, input().split())))

Ans = []
for x in range(n):
    Ans.append([])
    for y in range(l):
        ans = 0
        for z in range(m):
            ans += Q1[x][z]*Q2[z][y]
        Ans[x].append(ans)
 
for x in range(n):   
    print(*Ans[x], end="\n")




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

int main() {
  int N;
  cin >> N;
  long sum = 0;
  for(int i=1; i <=N; i++){
  if(i % 3 == 0||i % 5 == 0){
    continue;
  } 
  sum += i;
  }
  cout << sum << endl;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define int long long int
#define double long double
#define inf (int)(1e15)
#define all(x) (x).begin(), (x).end()
#define pair pair<int, int>
typedef vector<int> vi;   // Vector of long long
typedef vector<vi> vvi;   // Vector of vi
typedef vector<pair> vii; // Vector of pairs
typedef vector<vii> vvii; // Vector of Vector of pairs
typedef vector<bool> vb;  // Vector of bool
#define pq priority_queue // Max heap (To convert to min heap, use negative sign before every value)
#define ff first          // For pairs
#define ss second
const int dx4[] = {1, 0, -1, 0}, dy4[] = {0, -1, 0, 1};
const int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1}, dy8[] = {1, -1, 1, 0, -1, 1, -0, -1};
#define testcases(t) \
    int(t);          \
    cin >> (t);      \
    while ((t)--)
signed main()
{
    int n;
    cin >> n;
    vi boss(n + 1), cnt(n + 1);
    for (int i = 2; i <= n; i++)
    {
        cin >> boss[i];
        cnt[boss[i]]++;
    }
    for (int i = 1; i <= n; i++)
    {
        cout << cnt[i] << endl;
    }
    return 0;
}


Measured memory_bytes: 6412
#include<bits/stdc++.h>
#define int long long
#define M 1000000007
#define deb(x) cout<<#x<<'='<<x<<endl
using namespace std;
const int N=1e6;
signed main()
{
	int k;
	cin>>k;
	int ans=0;
	for(int i=1; i<=k; i++)
	{
		for(int j=1; j<=k; j++)
		{
			for(int l=1; l<=k; l++)
				ans+=__gcd(__gcd(i,j),l);
		}
	}
	cout<<ans<<endl;

}

Measured memory_bytes: 3632
#include <stdio.h>

int main(void) {
  int n, a[n], sum = 0;
  scanf("%d", &n);

  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    if (a[i] != i) sum++;
  }

  if (sum <= 2) printf("YES");
  else {
    printf("NO");
  }

	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef long double ld;
const double pi=acos(-1.0);
const ll mod=pow(10,9)+7;
const ll INF=pow(2,31)-1;
using str=string;
typedef pair<int,int> P;
typedef vector<int> vi;

ll gcd(ll a,ll b){
    ll v0=a,v1=b,v2=a%b;
    while(v2!=0){
        v0=v1;
        v1=v2;
        v2=v0%v1;
    }
    return v1;
}

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

int main(){
    int a, b,c;
    cin >> a >> b >> c;
    if(a==b&b==c){
        cout << "No" << endl;
    }
    else if(a==b|b==c|a==c){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int X,dp[1<<17],i,j;
int main(){
  cin>>X;
  for(i=100;i<106;i++)dp[i]=1;
  for(i=100;i<=1e5;i++)if(dp[i])for(j=0;j<6;j++)dp[i+100+j]=dp[i];
  cout<<dp[X]<<endl;
}


Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
#include <cstring>
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <stdint.h>
#define INF 0x3f3f3f3f

using namespace std;

int n,m;
const int N = 10010;
int a[N][2],book[N];
struct node
{
    int from,to;
    double cost;
}b[N*N/2];

int cmp(struct node x,struct node y)
{
    return x.cost > y.cost;
}

int father(int x)
{
    int f = x;
    while(f != book[f])
        f = book[f];
    int p = x;
    while(p != book[p])
    {
        int q = book[p];
        book[p] = f;
        p = q;
    }
    return f;
}

double bellman()
{
    double ans = 0;
    for(int i = 1; i <= n; i++)
        book[i] = i;
    for(int i = 1; i <= m; i++)
    {
        if(father(b[i].from) != father(b[i].to))
            book[father(b[i].from)] = father(b[i].to);
        else
            ans += b[i].cost;
    }
    return ans;
}

int main()
{
    cin>>n>>m;
    for(int i = 1; i <= n; i++)
        cin>>a[i][0]>>a[i][1];
    for(int i = 1; i <= m; i++)
    {
        cin>>b[i].from>>b[i].to;
        int x1 = a[b[i].from][0],y1 = a[b[i].from][1];
        int x2 = a[b[i].to][0],y2 = a[b[i].to][1];
        b[i].cost = sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
    }
    sort(b+1,b+1+m,cmp);
    printf("%.3f\n",bellman());
}



Measured memory_bytes: 3640
#include <bits/stdc++.h>
#define x real()
#define y imag()
using namespace std;
typedef complex<double> point;

double dot(point a,point b){return a.x*b.x+a.y*b.y;}
double cross(point a,point b){return a.x*b.y-a.y*b.x;}
int ccw(point a,point b,point c){
  point d = b-a,e = c-a;
  if(cross(d,e)>0) return 1;//"COUNTER_CLOCKWISE"
  if(cross(d,e)<0) return -1;//"CLOCKWISE"
  if(dot(d,e)<0) return 2;//"ONLINE_BACK"
  if(abs(d) < abs(e)) return -2;//"ONLINE_FRONT"
  return 0;//"ON_SEGMENT"
}

point crosspoint(point a,point b,point c,point d){
  a-=d;b-=d;c-=d;
  return d+a+(b-a)*imag(a/c)/imag(a/c-b/c);
}

vector<point> ConvexCut(vector<point> &polygon,point a,point b){
  vector <point> res;
  for(int i=0;i<polygon.size();i++){
    point A=polygon[i],B=polygon[(i+1)%polygon.size()];
    if(ccw(a,b,A)!=-1)res.push_back(A);
    if(ccw(a,b,A)*ccw(a,b,B)==-1)res.push_back(crosspoint(a,b,A,B));
  }
  return res;
}

double get_area(vector <point> &polygon){
  if(polygon.size()<3)return 0;
  double res=0;
  for(int i=0;i<polygon.size();i++)
    res+=cross(polygon[i],polygon[(i+1)%polygon.size()])/2;
  return res;
}

int main(){
  while(1){
    int v,n,d;
    vector <point> pl;
    cin>>n>>d>>v;
    if(!n&&!d&&!v) break;
    for(int i=0,a,b;i<n;i++) cin>>a>>b,pl.push_back(point(a,b));
    
    double V=min(get_area(pl)*d,(double)v),ans=0;
    
    for(int i=0;i<n;i++){
      double L=0,M,R=2010;
      int I=1000;
      while(I--){
	M=(L+R)/2;
	point h=pl[(i+1)%n]-pl[i],b=h;
	h=(point(0,M)*h/abs(h))+pl[i];
	vector<point> a=ConvexCut(pl,h+b,h);
	double res=get_area(a);
	assert(res>0);
	if(res*d>=V)R=M;
	else L=M+0.000000001;
      }
      ans=max(ans,L);
    }
    printf("%.8f\n",ans);
  }
  return 0;
}

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

using namespace std;

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

    string s;
    cin>>s;

    if(s.find("AC")!=-1)
        cout<<"Yes";
    else
        cout<<"No";

    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main {

	public static void main(String[] args){
		Scanner stdIn=new Scanner(System.in);
		int s=stdIn.nextInt();
		int S[]=new int[1000000];
		int z=0,y=0,x=0;
		while(true){
			if(z==0){
				S[z]=s;
			}
			else{
				if(S[z-1]%2==0)
					S[z]=S[z-1]/2;
				else
					S[z]=(3*S[z-1])+1;
				while(y<z){
					if(S[z]==S[y])
						x=1;
					y++;
				}y=0;
			}
			if(x==1)
				break;
			z++;
		}
		System.out.println(z+1);
	}
}


Measured memory_bytes: 27476
#include<iostream>
#include<algorithm>

using namespace std;

int main() {
    int A, B, K;
    cin >> A >> B >> K;

    for (int i = min(A,B); i >= 1; --i) {
        if (A % i == 0 && B % i == 0) K--;
        if (K == 0) {
            cout << i;
            return 0;
        }
    }
} 


Measured memory_bytes: 256
using System;

namespace AtCoder
{
    public class Program
    {
        public static void Main()
        {
            int i;
            int n,m;
            string line = System.Console.ReadLine();
            string []input = line.Split(' ');
            n = int.Parse(input[0]);
            m = int.Parse(input[1]);
            long []h = new long[n];
            bool []good = new bool[n];
            for(i=0;i<n;i++){
                good[i] = true;
            }
            line = System.Console.ReadLine();
            input = line.Split(' ');
            for(i=0;i<n;i++){
                h[i] = long.Parse(input[i]);
            }
            
            for(i=0;i<m;i++){
                line = System.Console.ReadLine();
                input = line.Split(' ');
                int a=int.Parse(input[0])-1;
                int b=int.Parse(input[1])-1;
                if(h[a]>=h[b]) good[b]=false;
                if(h[b]>=h[a]) good[a]=false; 
            }
            int num_good = 0;
            for(i=0;i<n;i++){
                if(good[i]) num_good++;
            }
            System.Console.WriteLine(num_good.ToString());
        }
    }
}

Measured memory_bytes: 46528
#include <iostream>
#include <algorithm>
#include <string>
#include <stdio.h>
#include <math.h>
using namespace std;

int main(){
	double x = -1;
	cin >> x ;
	printf("%.6f %.6f\n", x*x*3.14159265359, 2 * x*3.14159265359
		);
	return 0;
}

Measured memory_bytes: 1236
#include<iostream>
using namespace std;
int main(){
    int H,W;
    while(1){
        cin >> H >> W;
        if(H==0 && W==0)break;
        for(int i=0; i<H; i++){
            for(int j=0; j<W; j++){
                if((i+j)%2==0){
                    cout << "#";
                }else{
                    cout << ".";
                }
                
            }
            cout << endl;
        } cout << endl;
        
    }
}



Measured memory_bytes: 3000
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>
#include <cstring>
#include <cassert>


using namespace std;
#define SZ(x) (int)(x.size())
#define REP(i, n) for(int i=0;i<n;++i)
#define FOR(i, a, b) for(int i=a;i<b;++i)
#define RREP(i, n) for(int i=n-1;i>=0;--i)
#define RFOR(i, a, b) for(int i=b-1;i>=a;--i)

#define all(x) begin(x),end(x)
#define dump(x) cerr<<#x<<" = "<<(x)<<endl
#define debug(x) cerr<<#x<<" = "<<(x)<<" (L"<<__LINE__<<")"<< endl;

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using P = pair<int, int>;
const double eps = 1e-8;
const ll MOD = 1000000007;
const int INF = INT_MAX / 2;
const ll LINF = LLONG_MAX / 2;

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

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


template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> p) {
    os << p.first << ":" << p.second;
    return os;
}

template<class T>
ostream &operator<<(ostream &os, const vector<T> &v) {
    os << "[";
    REP(i, SZ(v)) {
        if (i) os << ", ";
        os << v[i];
    }
    return os << "]";
}

// edit

void solve() {
    ll A;
    string S;
    cin >> A >> S;
    
    ll B = 0;
    for(auto e : S){
        if(e != '.'){
            B *= 10;
            B += e - '0';
        }
    }
    
    ll ans = A * B / 100;
    cout << ans << endl;
    
    
}


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
//    std::ifstream in("input.txt");
//    std::cin.rdbuf(in.rdbuf());

    solve();


    return 0;
}


Measured memory_bytes: 3196
n = int(input())
a = []
for i in range(n):
    l,m = map(int,input().split())
    a.append([l,m])
f = 0
for i in range(n-2):
    if a[i][0] == a[i][1] and a[i+1][0] == a[i+1][1] and a[i+2][0] == a[i+2][1]:
        f = 1
if f == 0:
    print('No')
else:
    print('Yes')


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

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    //INT_MAX = 2147483647, UINT_MAX = 4294967295

    int a, b, c, d;
    cin >> a >> b >> c >> d;

    int hits1 = floor(a / d);
    int hits2 = floor(c / b);

    if(a % d != 0) hits1++;
    if(c % b != 0) hits2++;

    if(hits2 <= hits1) cout << "Yes\n";
    else cout << "No\n";
    return 0;
}

Measured memory_bytes: 3612
/**
 *    Coded by : lucky_21
 *               --------Lokesh Singh
**/

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

#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
template<class T> using oset=tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;

#define     F           first
#define     S           second
#define     pb          push_back
#define     lb          lower_bound
#define     ub          upper_bound
#define     pii         pair<int,int>
#define     all(x)      x.begin(),x.end()
#define     fix         fixed<<setprecision(10)
#define     rep(i,a,b)  for(int i=int(a);i<=int(b);i++)
#define     repb(i,b,a) for(int i=int(b);i>=int(a);i--)
#define     FastIO      ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)

typedef double db;
typedef long long ll;

const int N=2e5+5;
const int mod=1e9+7;

signed main(){
    FastIO;
    int n;
    cin>>n;
    ll ans=0;
    rep(i,1,n){
        ans+=n/i;
        if(n%i==0) ans--;
    }
    cout<<ans;
    return 0;
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
#define pb push_back
int dy[] = {0, 0, 1, -1, 1, 1, -1, -1};
int dx[] = {1, -1, 0, 0, 1, -1, -1, 1};

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n)-1; i >= 0; i--)
#define mp make_pair
#define fi first
#define sc second

int tate[500000], yoko[500000];
int main()
{
    int N, W, H;
    cin >> N >> W >> H;
    int x, y, w;
    bool flagtate = true;
    bool flagyoko = true;
    for (int i = 0; i < N; i++)
    {
        cin >> x >> y >> w;
        tate[max(x - w, 0)]++;
        tate[x + w]--;
        yoko[max(y - w, 0)]++;
        yoko[y + w]--;
    }
    for (int i = 1; i < W; i++)
    {
        tate[i] += tate[i - 1];
    }
    for (int i = 1; i < H; i++)
    {
        yoko[i] += yoko[i - 1];
    }

    for (int i = 0; i < W; i++)
    {
        if (tate[i] == 0)
        {
            flagtate = false;
            break;
        }
    }
    for (int i = 0; i < H; i++)
    {
        if (yoko[i] == 0)
        {
            flagyoko = false;
            break;
        }
    }
    if (flagtate || flagyoko)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 4656
// finish date: 2018/02/02
#include <iostream>
#include <cmath>
#include <vector>
#include <bitset>
#include <algorithm>
#include <stack>
#include <queue>
#include <map>
#include <climits>

using namespace std;

#define FOR(i, a, b) for(int (i)=a;(i)<(b);(i)++)
#define rep(i, n)  FOR(i,0,n)
#define ll long long
#define vi vector<int>
#define vvi vector<vector<int>>
#define vvvi vector<vector<vector<int>>>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define vs vector<string>
#define vc vector<char>
#define vvc vector<vector<char>>
#define bigmod 1000000007
#define INF 1050000000

#include <iostream>
#include <cmath>
#include <vector>
#include <bitset>
#include <algorithm>
#include <stack>
#include <queue>
#include <map>
#include <climits>

using namespace std;

// finish date: 2018/01/31
#include <iostream>
#include <cmath>
#include <vector>
#include <bitset>
#include <algorithm>
#include <stack>
#include <queue>
#include <map>
#include <climits>

using namespace std;

#define FOR(i, a, b) for(int (i)=a;(i)<(b);(i)++)
#define rep(i, n)  FOR(i,0,n)
#define ll long long
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define vs vector<string>
#define vc vector<char>
#define vvc vector<vector<char>>
#define bigmod 1000000007
#define INF 1050000000

#include <iostream>
#include <cmath>
#include <vector>
#include <bitset>
#include <algorithm>
#include <stack>
#include <queue>
#include <map>
#include <climits>

using namespace std;


int main() {
    string s;
    cin >> s;
    if(s.length()==2){
        if(s[0]==s[1]) cout<<1<<" "<<2<<endl;
        else cout<<-1<<" "<<-1<<endl;
        return 0;
    }
    rep(i, s.length() - 2) {
        if (s[i] == s[i + 1] || s[i + 1] == s[i + 2] || s[i + 2] == s[i]) {
            cout << i + 1 << " " << i + 3 << endl;
            return 0;
        }
    }
    cout << -1 << " " << -1 << endl;

    return 0;
}



Measured memory_bytes: 512
H, W, K = map(int, input().split())
c = [input() for _ in range(H)]

ans = 0
for row in range(1<<H):
  for col in range(1<<W):
    count=0
    
    for i in range(H):
      for j in range(W):
        if c[i][j]=="#" and row&(1<<i)==0 and col&(1<<j)==0:
          count+=1
    if count==K:
      ans += 1
    
print(ans)

Measured memory_bytes: 9196
//
//  main.cpp
//
// https://atcoder.jp/contests/abc131/tasks/abc131_f

#include <algorithm>
#include <array>
#include <assert.h>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <math.h>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

using ll = long long;
using ull = unsigned long long;

struct UnionFind {
    vector<size_t> parent;
    vector<size_t> rank;
    size_t find_parent(size_t x) {
        if (parent[x] == x) {
            return x;
        } else {
            parent[x] = find_parent(parent[x]);
            return parent[x];
        }
    }
    explicit UnionFind(size_t size) {
        parent.resize(size);
        rank.resize(size);
        for (size_t i = 0; i < size; i++) {
            parent[i] = i;
            rank[i] = 0;
        }
    }
    virtual ~UnionFind() {}
    void unite(size_t x, size_t y) {
        size_t px = find_parent(x);
        size_t py = find_parent(y);
        if (px == py) {
            return;
        }
        if (rank[px] < rank[py]) {
            parent[px] = py;
        } else if (rank[px] > rank[py]) {
            parent[py] = px;
        } else { // rank[px] == rank[py]
            parent[py] = px;
            rank[px]++;
        }
    }
    bool is_same(size_t x, size_t y) {
        return find_parent(x) == find_parent(y);
    }
    unordered_map<size_t, set<size_t>> create_map_parent_to_elements() {
        unordered_map<size_t, set<size_t>> ans;
        for (size_t i = 0; i < parent.size(); i++) {
            ans[find_parent(i)].insert(i);
        }
        return ans;
    }
};

int main(int argc, char* argv[]) {
    int N;
    cin >> N;
    UnionFind tree(N);
    vector<pair<int, int>> pts;
    map<int, int> x_to_idx;
    map<int, int> y_to_idx;
    for (int i = 0; i < N; i++) {
        int x, y;
        cin >> x >> y;
        pts.push_back(make_pair(x, y));
        if (x_to_idx.find(x) != x_to_idx.end()) {
            tree.unite(i, x_to_idx[x]);
        } else {
            x_to_idx[x] = i;
        }
        if (y_to_idx.find(y) != y_to_idx.end()) {
            tree.unite(i, y_to_idx[y]);
        } else {
            y_to_idx[y] = i;
        }
    }
    unordered_map<size_t, set<size_t>> parent_idx_to_groups = tree.create_map_parent_to_elements();
    ll count = 0;
    for (const pair<size_t, set<size_t>>& parent_group : parent_idx_to_groups) {
        const set<size_t>& group = parent_group.second;
        set<int> x_coords;
        set<int> y_coords;
        for (size_t idx : group) {
            x_coords.insert(pts[idx].first);
            y_coords.insert(pts[idx].second);
        }
        count += x_coords.size() * y_coords.size();
    }
    cout << count - pts.size() << endl;
}



Measured memory_bytes: 21492
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
using Graph = vector<vector<int>>;
int main() {
  string s;
  cin >> s;
  int l=s.length();
  for(int i=0;i<l;++i) {
    s[i]='x';
  }
  for(int i=0;i<l;++i) {
    cout << s[i];
  }
}



Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <list>
#include <utility>
#include <tuple>
#include <cstdio>
#include <set>
#include <queue>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#include <cmath>
#define _GLIBCXX_DEBUG
using namespace std;
const long long INF = 1LL << 60;
typedef long long ll;
int main() {
    string S;
    cin >> S;
    vector<int> alphabet(26,0);
    int size = S.size();
    for(int i=0;i<size;i++){
        int num = (int)(S[i]-'a');
        alphabet[num]++;
    }
    for(int i=0;i<26;i++){
        if(alphabet[i]>1){
            cout << "no" << endl;
            break;
        }
        else if(i==25){
            cout << "yes" << endl;
        }
    }
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#define ll long long
#define PB push_back
#define POP pop_back()
#define PII pair<int,int>
#define FI first
#define SE second
#define ULL unsigned long long
#define endl '\n'
using namespace std;
const int INF=0x3f3f3f3f;
const double pi=acos(-1),eps=1e-8;

int main()
{
	double a,b,h,m;
	cin>>a>>b>>h>>m;
	double t1=(h/12.0+(m/60.0)/12.0)*2*pi;
	double t2=(m/60.0)*2*pi;
	double ans=sqrt(a*a+b*b-2.0*a*b*cos(t1-t2));
	printf("%.20lf\n",ans);
 	return 0;
}



//  sqrt 16+9-2*12*cos(60)=

//5/12+1/12*(40/60)  *360

Measured memory_bytes: 4216
def main():
    n=int(input())
    if n==1:
        print(0)
        return 0
    import numpy as np
    p=np.array([np.array(list(map(int,input().split()))) for _ in [0]*n])
    if n==2:
        print(p[0][1])
        return 0
    import scipy.sparse.csgraph as sp
    ans=0
    d=np.full((n,n),0)
    for i in range(n):
        for j in range(i+1,n):
            b=p[i][j]
            if b!=np.sort(p[i]+p[j])[2]:
                d[i][j],d[j][i]=b,b
                ans+=b
    s=sp.shortest_path(d)
    if (s==p).all():
        print(ans)
    else:
        print(-1)
main()

Measured memory_bytes: 17392
#include <bits/stdc++.h>
using namespace std;
int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n,c=0;
    string s;
    cin>>n>>s;
    
    for(int i=0;i<n-2;i++){
        if(s[i]=='A'&&s[i+1]=='B'&&s[i+2]=='C') c++;
    }
    
    cout<<c<<endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<vector>
using namespace std;

int main(void) {
	int s;
	scanf("%d", &s);
	vector<int> a = {s};
	int m = 2;
	while (1) {
		if (s % 2 == 0) {
			s /= 2;
		} else {
			s = 3*s + 1;
		}
		// cout << m << " " << s << endl;
		for (int i = a.size(); i > 0; i--) {
			if (a[i - 1] == s) {
				printf("%d\n", m);
				return 0;
			}
		}
		a.push_back(s);
		m++;
	}
	return 0;
}


Measured memory_bytes: 3764
A, B, C, K = map(int, input().split())

total = 0
if K <= A:
    total = K*1
elif A < K and K <= A+B:
    total = A*1 + (K - A)*0
else:
    total = A*1 + B*0 + (K - A - B)*(-1)

print(total)

Measured memory_bytes: 9184
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
#define tii tuple<int,int,int>
signed main(){
  int N,W; cin>>N>>W;
  vii dp(N+1,vi(W+1));
  REP(i,1,N){
    int w,v; cin>>w>>v;
    rep(j,0,w) dp[i][j]=dp[i-1][j];
    REP(j,w,W){
      dp[i][j]=max(dp[i-1][j],dp[i-1][j-w]+v);
    }
  }
  cout<<dp[N][W]<<endl;
  }


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

int main() {
  int H, W;
  cin >> H >> W;
  vector<vector<char>>C(H, vector<char>(W));
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      cin >> C.at(i).at(j);
    }
  }
  for (int i = 0; i < H * 2; i++) {
    for (int j = 0; j < W; j++) {
      cout << C.at(i/2).at(j);
    }
    cout << endl;
  }
}

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

string n;
int cnt = 0;

int main() {

  cin >> n;
  for(int i = 0; i < n.length(); i++){
    if (n[i] == '1') {
      cnt++;
    }
  }

  //cout << typeid(n[2]).name() << endl;
  cout << cnt << endl;
  

  return 0;
}

Measured memory_bytes: 888
N=int(raw_input())
a=map(int,raw_input().split(' '))

color=[0]*8
free=0

for ai in a:
    if ai<400:
        color[0]+=1
    elif ai<800:
        color[1]+=1
    elif ai<1200:
        color[2]+=1
    elif ai<1600:
        color[3]+=1
    elif ai<2000:
        color[4]+=1
    elif ai<2400:
        color[5]+=1
    elif ai<2800:
        color[6]+=1
    elif ai<3200:
        color[7]+=1
    else:
        free+=1

c=len(color)-color.count(0)

m=c+free

if c==0:
    c=1

print c,m


Measured memory_bytes: 2692
/*Author - Shubham Gupta (@shubham107)*/
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef vector<ll> vl;		typedef vector<int> vi;
typedef vector<vl> vvl;	  	typedef vector<vi> vvi;
typedef pair<ll, ll> pll;	typedef pair<int, int> pii;
#define forn(i,n) for(int i=0;i<n;i++)
#define rforn(i,n) for(int i=n-1;i>=0;i--)
#define forne(i,n) for(int i=1;i<=n;i++)
#define forse(i,s,e) for(int i=s;i<e;i++)
#define rforse(i,s,e) for(int i=e-1;i>=s;i--)
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
#define MOD 1000000007
#define F first
#define S second
#define pb push_back
#define fill(a,x) memset(a,x,sizeof a);
#define trav(a,x) for(auto &a:x)
#define INF	ll(1e18)
#ifdef SHUBHAM107
#include "../code-pieces/trace.h"
#else
#define trace(args...)
#endif

ll modpow(ll a, ll b, ll m = MOD) {
	a %= m; ll res = 1; while (b) {if (b & 1)res = res * a % m; a = a * a % m; b >>= 1;}
	return res;
}
ll bpow(ll a, ll b) {ll res = 1; while (b) {if (b & 1)res = res * a; a = a * a; b >>= 1;} return res;}
ll modinv(ll a) {return modpow(a, MOD - 2, MOD);}
void graph(vvi &adj, int m) {int x, y; forn(i, m) {cin >> x >> y; adj[x - 1].pb(y - 1); adj[y - 1].pb(x - 1);}}

const int mxN = 2e5 + 5;
void solve() {
	int n;
	cin >> n;
	map<string, int> mp;
	string s;
	forn(i, n){
		cin >> s;
		mp[s]++;
	}
	int maxm = 0;
	vector<string> ans;
	trav(elem, mp) maxm = max(maxm, elem.S);
	trav(elem, mp) if(elem.S == maxm) ans.pb(elem.F);
	sort(all(ans));
	trav(k, ans) cout << k << '\n';
}
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
#ifdef SHUBHAM107
	freopen("inp.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
	freopen("err.txt", "w", stderr);
#endif
	int t = 1;
	// cin >> t;
	while (t--) {
		solve();
	}
}


Measured memory_bytes: 25584
#include<stdio.h>
int main(void){
  int a, b, c,i=0,j=0;
  scanf("%d %d %d",&a,&b,&c);
  if(a==5)
    i++;
  else if(a==7)
    j++;
  if(b==5)
    i++;
  else if(b==7)
    j++;
  if(c==5)
    i++;
  else if(c==7)
    j++;
  if(i==2 && j==1)
    printf("YES");
  else
    printf("NO");
  return 0;
}

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

namespace dwacon
{
    class Program
    {

        static void Main(string[] args)
        {
            int[] a = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            int left = a[0] + a[1];
            int right = a[2] + a[3];
            if (left > right) Console.WriteLine("Left");
            else if (left < right) Console.WriteLine("Right");
            else Console.WriteLine("Balanced");
        }
    }
}


Measured memory_bytes: 13396
/*
	author - sekai_no_owari
	date   - 22.01.2020
*/
#include<bits/stdc++.h>
#define ll long long
#define mod 1000000007
#define amaterasu ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;

int
main ()
{
  amaterasu 
  ll a, b;
  cin >> a >> b;
  ll res = min(a, b);
  ll count = max(a, b);
  for(ll i=0;i<count;i++)cout<<res;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
int n;
long long a[100009][4];
long long dp[100009][4];
int main(){
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>a[i][0]>>a[i][1]>>a[i][2];
	}
	for(int i=1;i<=n;i++){
		dp[i][0]=max(dp[i-1][1],dp[i-1][2])+a[i][0];
		dp[i][1]=max(dp[i-1][0],dp[i-1][2])+a[i][1];
		dp[i][2]=max(dp[i-1][0],dp[i-1][1])+a[i][2];
	}
	cout<<max(dp[n][0],max(dp[n][1],dp[n][2]))<<endl;
}


Measured memory_bytes: 6528
#include<bits/stdc++.h>
using namespace std;
typedef complex < double > P;
typedef vector < P > Ps;
const double EPS = 1e-10;
const double INF = 1e8;

int main(){
  int n;
  double r, kaku;
  double dis[20][20];
  static double dp[20][20][10001];
  bool gocan[20][20][20];

  fill_n( **dp, 20 * 20 * 10001, INF);

  cin >> n >> r >> kaku;
  Ps pts(n);
  for(int i = 0 ; i < n ; i++ ){
    cin >> pts[i].real() >> pts[i].imag();
  }

  double rad = kaku * M_PI / 180.0;

  for(int i = 0 ; i < n ; i++ ){
    for(int j = 0 ; j < n ; j++ ){
      if(i == j) continue;
      for(int k = 0 ; k < n ; k++ ){
        if( i == k || j == k) continue;
        const P s1 = pts[j] - pts[i], s2 = pts[k] - pts[j];
        gocan[i][j][k] = abs(arg( s2 / s1)) < rad + EPS;
      }
    }
  }

  for(int i = 0 ; i < n ; i++ ){
    for(int j = i + 1 ; j < n ; j++ ){
      dis[i][j] = dis[j][i] = abs( pts[i] - pts[j]);
    }
  }

  for(int i = 1 ; i < n ; i++ ){
    dp[0][i][1] = dis[0][i];
  }

  int ret = 0;
  for(int i = 1 ; i <= 10000 ; i++ ){ //にんじん
    for(int j = 0 ; j < n ; j++ ){ //前
      for(int k = 0 ; k < n ; k++ ){ //今
        if(j == k || dp[j][k][i] > r + EPS) continue;  //j → kの距離が(ry
        for(int l = 0 ; l < n ; l++ ){ //次
          if( j == l || k == l) continue;
          if( gocan[j][k][l]){ //いけたら
            dp[k][l][i + 1] = min( dp[k][l][i + 1], dp[j][k][i] + dis[k][l]);
          }
        }
        ret = max( ret, i);
      }
    }
  }
  cout << ret << endl;
}

Measured memory_bytes: 32600
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using static System.Console;

class Program
{
    static void Main(string[] args)
    {
        var n = int.Parse(ReadLine());

        if (n == 1)
            WriteLine("Hello World");
        else
        {
            var a = int.Parse(ReadLine());
            var b = int.Parse(ReadLine());
            WriteLine(a + b);
        }
    }
}


Measured memory_bytes: 27432
#include <iostream>
#include <vector>
#include <algorithm>
#include <climits>

#define int long long int

using namespace std;

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

    int n, m, l, q;
    cin >> n >> m >> l;
    vector<vector<int>> a(n, vector<int>(n, LLONG_MAX / 2));

    for (int i = 0; i < m; i++)
    {
        int from, to, w;
        cin >> from >> to >> w;
        from--, to--;
        a[from][to] = w;
        a[to][from] = w;
    }

    for (int i = 0; i < n; i++)
        a[i][i] = 0;

    for (int k = 0; k < n; k++)
        for (int i = 0; i < n; i++)
            for (int j = 0; j < n; j++)
                a[i][j] = min(a[i][j], a[i][k] + a[k][j]);

    vector<vector<int>> d(n, vector<int>(n, INT_MAX));

    for (int s = 0; s < n; s++)
    {
        vector<int> q;
        q.push_back(s);
        d[s][s] = 0;

        for (int i = 0; i < q.size(); i++)
        {
            int x = q[i];
            for (int j = 0; j < n; j++)
                if (d[s][j] == INT_MAX && a[x][j] <= l)
                {
                    d[s][j] = d[s][x] + 1;
                    q.push_back(j);
                }
        }
    }

    cin >> q;
    for (int i = 0; i < q; i++)
    {
        int s, t;
        cin >> s >> t;
        s--, t--;
        cout << (d[s][t] == INT_MAX ? -1 : d[s][t] - 1) << "\n";
    }

    return 0;
}


Measured memory_bytes: 2048
K = int(input())
a = list(range(1,10))
for i in a:
  if len(a) > K:
    break
  x = i % 10
  for j in range(max(0, x - 1), min(x + 2, 10)):
    a.append(i * 10 + j)
print(a[K - 1])


Measured memory_bytes: 7320
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
 
int main()
{
  int A, B;
  cin >> A >> B;
  if((B-1)%(A-1)==0){
    cout << (B-1)/(A-1) << endl;
  }else{
    cout << (B-1)/(A-1)+1 << endl;
  }
}

Measured memory_bytes: 256
#include <cstdio>
#include <vector>
using namespace std;
static const int MAX = 100000;

struct bc
{
  long long b, c;
  bc(long long inputted_b, long long inputted_c)
  {
    b = inputted_b;
    c = inputted_c;
  }
};

bool cmp(const bc &x, const bc &y)
{
  return x.c > y.c;
}

int main()
{
  int n, m;
  long long a[MAX], b, c;
  scanf("%d %d", &n, &m);
  for (int i = 0; i < n; i++)
  {
    scanf("%lld", &a[i]);
  }
  std::sort(a, a + n);

  std::vector<bc> change;
  for (int i = 0; i < m; i++)
  {
    scanf("%lld %lld", &b, &c);
    change.push_back(bc(b, c));
  }
  std::sort(change.begin(), change.end(), cmp);

  int count = 0;
  for (int i = 0; i < change.size(); ++i)
  {
    for (int j = 0; j < change[i].b; j++)
    {
      if (a[count] < change[i].c)
      {
        a[count] = change[i].c;
      }
      else
      {
        i = change.size();
        break;
      }
      count++;
    }
  }
  long long sum = 0;
  for (int i = 0; i < n; i++)
  {
    sum += a[i];
  }
  printf("%lld\n", sum);
  return 0;
}

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

//const long double PIL = 3.141592653589793238462643383279502884L;
//const double PI = 3.14159265358979323846;

#define sz(a) (int)((a).size())
#define all(c) (c).begin(), (c).end()
#define debug(v) {for (auto z : v) {cerr << z << ' ';} cerr << endl;}

using ll = long long;
using ii = pair<int,int>;
using vi = vector<int>;
using vll = vector<long long>;
using vii = vector<pair<int,int>>;

int main() {
	//~ ios::sync_with_stdio(0);
	//~ cin.tie(0);
	//~ cout.tie(0);
	string s; cin >> s;
	if (s[2] == s[3] && s[4] == s[5])
		cout << "Yes\n";
	else
		cout << "No\n";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
#define endl '\n'
using namespace std;
const int MOD = 1000000007, MAX = 2000000007, MAXN = 2005;
ll s[MAXN], t[MAXN],sum[MAXN][MAXN];

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int n,m;
    cin>>n>>m;
    for(int i=0; i<n; i++)
        cin>>s[i];
    for(int i=0; i<m; i++)
        cin>>t[i];   
    for(int i=0; i<=n; i++)
        sum[i][0] = 0;
    for(int i=0; i<=m; i++)
        sum[0][i] = 0;
    for(int i=1; i<=n; i++)
    {
        for(int j=1; j<=m; j++)
        {
            sum[i][j] = (sum[i-1][j] + sum[i][j-1] + MOD - sum[i-1][j-1])%MOD;
            if(s[i-1] == t[j-1])
            {
                sum[i][j] += (sum[i-1][j-1] + 1)%MOD;
            }
            sum[i][j]%=MOD;
        }
    }
    cout<<(sum[n][m]+1)%MOD;
	return 0;
}


Measured memory_bytes: 31616
w, h, n = map(int, input().split())
sx, sy, ex, ey = 0, 0, w, h
for _ in range(n):
    x, y, a = map(int, input().split())
    if a == 1:
        sx = max(sx, x)
    if a == 2:
        ex = min(ex, x)
    if a == 3:
        sy = max(sy, y)
    if a == 4:
        ey = min(ey, y)
ans = (ex - sx) * (ey - sy)
if ex - sx < 0 or ey - sy < 0:
    print(0)
else:
    print(ans)


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=1e5+5;
int a[maxn];
int main()
{
    int n;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        scanf("%d",&a[i]);
    }
    ll ans=0;
    for(int i=0;i<n;i++)
    {
        int x;
        scanf("%d",&x);
        ll te=x-a[i];
        ans+=te/(te>=0?2:1);
    }
    if(ans>=0)
        puts("Yes");
    else
        puts("No");



}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s;
    cin>>s;
    int x[27]={0};
    for(int i=0;i<s.size();i++)
    {
        x[s[i]-'A']++;
    }
    int c=0;
    for(int i=0;i<26;i++)
    {
        if(x[i]==2)
        {
            c++;
        }
    }
    if(c==2)
    {
        cout<<"Yes"<<endl;
    }
    else
    {
        cout<<"No"<<endl;
    }
return 0;
}


Measured memory_bytes: 256
N,K=map(int,input().split())
A=list(map(int,input().split()))

SUMA=[0]
for a in A:
    SUMA.append(SUMA[-1]+a)

SUM=[]
for i in range(1,N+1):
    for j in range(i,N+1):
        SUM.append(SUMA[j]-SUMA[i-1])

for i in range(40,-1,-1):
    COUNT=0
    for s in SUM:
        if (s & 1<<i)!=0:
            COUNT+=1

    if COUNT<K:
        continue
    else:
        NLIST=[]
        for s in SUM:
            if (s & 1<<i)!=0:
                NLIST.append(s)

        SUM=NLIST

ANS=SUM[0]
for s in SUM:
    ANS=ANS & s

print(ANS)


Measured memory_bytes: 23856
import heapq
from collections import deque
from enum import Enum
import sys
import math
from _heapq import heappush, heappop
import copy
from test.support import _MemoryWatchdog

BIG_NUM = 2000000000
HUGE_NUM = 99999999999999999
MOD = 1000000007
EPS = 0.000000001
sys.setrecursionlimit(100000)


SIZE = 32
POW = [1]*SIZE

for i in range(1,SIZE):
    POW[i] = POW[i-1]*2


N = int(input())

for _ in range(N):
    start,goal = map(int,input().split())
    ans = 0

    rank = 0
    current = start

    while current != goal:
        rank = 0

        for i in range(SIZE-1,0,-1):
            if abs(current)%POW[i] == 0 and current+POW[i] <= goal:
                rank = i
                break
        current += POW[rank]
        ans += 1

    print("%d"%(ans))


Measured memory_bytes: 13744
import Control.Monad
import Data.Maybe
import Data.Vector.Unboxed (Vector)
import qualified Data.Vector.Unboxed as V
import Data.IntMap (IntMap,(!))
import qualified Data.IntMap as IM

main = do
  n <- readLn
  as <- map read.words <$> getLine
  edges <- replicateM (n-1) $ map read.words <$> getLine
  let
    avec = V.fromList as
    tree = foldr f zeroMap edges
    zeroMap = IM.fromDistinctAscList $ zip [1..n] $ repeat []
    f [a,b] tree = IM.adjust (a:) b $ IM.adjust (b:) a  tree
  putStr $ unwords $ map show $ solve n tree avec

inf = 1000000001
solve :: Int -> IntMap [Int] -> Vector Int -> [Int]
solve n tree avec = filter inner [1..n]
  where
  inner node = go 0 node == inf
  go visited node
    | lose = a
    | otherwise = inf
    where
    a = V.unsafeIndex avec (node-1)
    lose = foldr f True childs
    f child acc
      | child == visited = acc
      | otherwise = acc && a <= go node child
    childs = tree!node

Measured memory_bytes: 5244
void main() {
	auto N = ri;
	ulong A, B;
	if(N.to!string[1..$].uniq.array == ['0'].to!(dchar[])) {
		switch(N.to!string[0]) {
			case '1':
				writeln(10);
				return;
			default:
				writeln(N.to!string[0].to!int);
				return;
		}
	}
	N.to!string.map!(a => a.to!string.to!int).sum.writeln;
}

// ===================================

import std.stdio;
import std.string;
import std.conv;
import std.algorithm;
import std.range;
import std.traits;
import std.math;
import std.container;
import std.bigint;
import std.numeric;
import std.conv;
import std.typecons;
import std.uni;
import std.ascii;
import std.bitmanip;
import core.bitop;

T readAs(T)() if (isBasicType!T) {
	return readln.chomp.to!T;
}
T readAs(T)() if (isArray!T) {
	return readln.split.to!T;
}

T[][] readMatrix(T)(uint height, uint width) if (!isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		res[i] = readAs!(T[]);
	}
	return res;
}

T[][] readMatrix(T)(uint height, uint width) if (isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		auto s = rs;
		foreach(j; 0..width) res[i][j] = s[j].to!T;
	}
	return res;
}

int ri() {
	return readAs!int;
}

double rd() {
	return readAs!double;
}

string rs() {
	return readln.chomp;
}

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

int main(){
  string s;
  long long k,c=0;
  cin>>s>>k;
  for(long long i=0;;i++){
    if(s[i]=='1'){
      k--;
      if(k==0){
        cout<<1<<endl;
        return 0;
      }else{
      continue;
      }
    }else{
      cout<<s[i]<<endl;
      return 0;
    }
  }
}

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

int main(){
    int num1, num2;
    
    while(cin >> num1 >> num2){
        int result = 1;
        
        num1 += num2;
        
        for(;num1/10 > 0;){
            num1 /= 10;
            result++;
        }
        
        cout << result << endl;
    }
    
    return 0;
}

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

int main() {
  int n;
  cin >> n;
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    if (i <= 9) ans++;
    else if (100 <= i && i < 1000) ans++;
    else if (10000 <= i && i < 100000) ans++;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
n = int(input())
res = []

def f(frm, l, head):
    if l == 0:
        res.append(head)
    for i in range(l, 0, -1):
        for j in range(frm):
            f(frm, l - i, head + chr(ord('a') + j) * i)
        f(frm + 1, l - i, head + chr(ord('a') + frm) * i)
    
f(0, n, '')
print(*sorted(list(set(res))), sep='\n')


Measured memory_bytes: 49296