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

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

#define ll          long long
#define pb          push_back
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define rs(v,n)     v.resize(n)
#define hell        1000000007
#define peak        9123372036854775807
#define pii         acos(-1)
#define clr(a,x)    memset(a,x,sizeof(a))
#define ios         ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
template<typename T>
using ordered_set = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;
template<class x,class y> x sum(x a,y b){return a+b;}
template<class x,class y> x mul(x a,y b){return a*b;}
template<class x,class y> x sub(x a,y b){return a-b;}
template<class x,class y> x divi(x a,y b){return a/b;}

template<class x,class y>
istream &operator>>(istream &in,pair<x,y> &p) 
{ 
    in>>p.F>>p.S;
    return in;
}
template<class x>
istream &operator>>(istream &in,vector<x> &v) 
{
    for(auto& i:v)
        in>>i;
    return in;
}
template<class x,class y>
ostream &operator<<(ostream &out,pair<x,y> &p) 
{ 
    out<<"("<<p.F<<","<<p.S<<") ";
    return out; 
}
template<class x>
ostream &operator<<(ostream &out,vector<x> &v) 
{ 
    out<<v.size()<<endl;
    for(auto i:v)
        out<<i<<" ";
    out<<endl;
    return out; 
}
#define N  1000005

ll n;
string s;
vector<string> ans;

void solve(string t,ll ind,ll x)
{
	if(x==n)
	{
		ans.pb(t);
		return;
	}
	for(ll i=0;i<=ind+1;i++)
	{
		string tt=t;
		tt.pb(s[i]);
		solve(tt,max(i,ind),x+1);
	}
}

int main()
{	
    ios;
    ll tt=1;
    // cin>>tt;
    while(tt--)
    {
    	ll i,j,k,l,m;
    	cin>>n;
    	for(i=0;i<n;i++)
    	{
    		s.pb(97+i);
    	}
    	string t;
    	solve(t,-1,0);
    	// if(n<=3)
    	for(auto i:ans)
    		cout<<i<<endl;
    	// cout<<ans.size()<<endl;	
    }
    return 0;
}

Measured memory_bytes: 7796
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <cstdlib>
#include <iomanip>
typedef long long ll;
using namespace std;

int main () {
    string s;
    cin >> s;
    int top = s[0] - '0';
    bool f = true;
    ll n = s.size();
    for(int i = 1; i < n; i++)
    {
        if(s[i] != '9') {f=!f;break;}
    }
    if(f) {
        cout << top + 9 * (n - 1) << endl;
    }else {
        cout << top + 9 * (n - 1) - 1 << endl;
    }
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>//sort,reverse
#include<utility>//pair
#include<queue>//queue,priority queue
#include<deque>//double_ended queue
using namespace std;
long long MOD=1000000007;
int main()
{ 
    int n;
    cin>>n;
    long long int ans=1;
    int d[3]={};
    for(int i=0;i<n;i++){
        int a;
        cin>>a;
        if(a==d[0]){
            d[0]++;
            if(a==d[1]){
                if(a==d[2]){
                    ans=ans*3;
                    ans=ans%MOD;
                }
                else{
                    ans=ans*2;
                    ans=ans%MOD;
                }
            }
        }
        else if(a==d[1]){
            d[1]++;
            if(a==d[2]){
                ans=ans*2;
                ans=ans%MOD;
            }
        }
        else if(a==d[2]){
            d[2]++;
        }
        else{ans=0;}
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define pii pair<int,int>
const long long MOD=1000000007;

int main(){
    int n;
    string s,t;
    cin>>n>>s>>t;
    /*調べる一つ前のドミノの状態
    0は何もない,1は縦,2は横*/
    int now=0;
    long long ans=0;
    rep(i,n){
        if(now==0){//はじめ
            if(s[i]==t[i]){//縦の時
                ans=3;
                now=1;
            }
            else{//横の時
                ans=6;
                i++;//次のドミノにとばす
                now=2;
            }
        }
        else if(now==1){//前が縦の時
            if(s[i]==t[i]){//縦の時
                ans=(ans*2)%MOD;
                now=1;
            }
            else{//横の時
                ans=(ans*2)%MOD;
                i++;//次のドミノにとばす
                now=2;
            }
        }
        else{//前が横の時
            if(s[i]==t[i]){//縦の時
                ans=(ans*1)%MOD;
                now=1;
            }
            else{//横の時
                ans=(ans*3)%MOD;
                i++;//次のドミノにとばす
                now=2;
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <vector> 
#include <list> 
 #include <map>
 #include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << '=' << (x) << endl;
#define debug(x) cerr << #x << '=' << (x) << '('<<'L' << __LINE__ << ')' << ' ' << __FILE__ << endl;

#define YES_ cout<<"Yes"<<endl; return 0;
#define NO_ cout<<"No"<<endl; return 0;

int main(){
    
    vector<LL> S(5);
    string aa="MARCH";
    LL N=0;
    cin>>N;
    REP(i,N){
        string s;
        cin>>s;
        if(s[0]=='M'){S[0]++;}
        if(s[0]=='A'){S[1]++;}
        if(s[0]=='R'){S[2]++;}
        if(s[0]=='C'){S[3]++;}
        if(s[0]=='H'){S[4]++;}
    }

    LL ans=0LL;
    REP(i,3){
        FOR(j,i+1,4){
            FOR(k,j+1,5){
                ans+=S[i]*S[j]*S[k];
               // cerr<<aa[i]<<aa[j]<<aa[k]<<endl;
            }
        }
    }

    cout<<ans<<endl;

}


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

namespace AtCoder
{
    class Program
    {
        static void Main()
        {
            Solve();

            Console.ReadKey();
        }

        static void Solve()
        {
            var str = IO.GetIntList();
            var N = str[0];
            var Q = str[1];
            var S = IO.GetString();
            int[][] ques = new int[Q][];
            for(int i = 0; i < Q; i++)
            {
                ques[i] = IO.GetIntList().ToArray();
            }

            int[] sum = new int[N];
            sum[0] = 0;
            for(int i = 1; i < N; i++)
            {
                sum[i] = sum[i - 1];
                if (S[i - 1] == 'A' && S[i] == 'C') sum[i]++;
            }
            for(int i = 0; i < Q; i++)
            {
                Console.WriteLine(sum[ques[i][1]-1] - sum[ques[i][0]-1]);
            }

            //Console.WriteLine(ans);
        }
    }


    static class IO
    {
        static public string GetString() { return Console.ReadLine(); }
        static public int GetInt() { return int.Parse(Console.ReadLine()); }
        static public long GetLong() { return long.Parse(Console.ReadLine()); }
        static public List<string> GetStringList() { return Console.ReadLine().Split(' ').ToList(); }
        static public List<int> GetIntList() { return Console.ReadLine().Split(' ').Select(int.Parse).ToList(); }
        static public List<long> GetLongList() { return Console.ReadLine().Split(' ').Select(long.Parse).ToList(); }
        static public List<double> GetDoubleList() { return Console.ReadLine().Split(' ').Select(double.Parse).ToList(); }
        static public void WriteStrings<T>(IEnumerable<T> values) { foreach (var o in values) { Console.Write(o + " "); } }
    }
}

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

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

using namespace std;

int main(){
  int n;cin>>n;
  vector<string> s(n);
  vector<int> t(n);
  rep(i,n){cin>>s[i]>>t[i];}
  string x;cin>>x;
  bool f=false;
  int result=0;
  rep(i, n){
    if(f)result+=t[i];
    if(s[i]==x)f=true;
  }

  cout<<result;
  
  return 0;
}

Measured memory_bytes: 256
let levenshtein_distance (x, y) =
  if x = y then 0
  else
    let m = String.length x in
    let n = String.length y in
    if m = 0 then n
    else if n = 0 then m
    else begin
      let s = Array.init (n + 1) (fun i -> i) in
      let t = Array.make (n + 1) 0 in
      for i = 0 to m - 1 do
        t.(0) <- i + 1;
        for j = 0 to n - 1 do
          let c = s.(j) + if x.[i] = y.[j] then 0 else 1 in
          let d = 1 + if t.(j) < s.(j+1) then t.(j) else s.(j+1) in
          t.(j+1) <- if c < d then c else d
        done;
        Array.iteri (fun i e -> s.(i) <- e) t
      done;
      t.(n)
    end

let () =
  Scanf.scanf "%s %s " (fun x y -> x, y)
  |> levenshtein_distance
  |> Printf.printf "%d\n"

Measured memory_bytes: 2472
#include<iostream>
#include<string>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<queue>
using namespace std;
typedef long long s64;

#define next nxt

const int ONE = 2005;
const int MOD = 1e9 + 7;

int get()
{
		int res = 1, Q = 1; char c;
		while( (c = getchar()) < 48 || c > 57)
			if(c == '-') Q = -1;
		if(Q) res = c - 48;
		while( (c = getchar()) >= 48 && c <= 57)
			res = res * 10 + c - 48;
		return res * Q;
}

int gcd(int a, int b)
{
		while(int r = a % b) {a = b; b = r;}
		return b;
}

int a[ONE];
priority_queue <int> q;

int n;
int E[ONE][ONE];

int vis[ONE], Input[ONE];
int next[ONE], first[ONE], go[ONE], tot;
void Add(int u, int v)
{
		Input[v]++, next[++tot] = first[u], first[u] = tot, go[tot] = v;
}

void Dfs(int u)
{
		if(vis[u]) return;
		vis[u] = 1;
		for(int i = 1; i <= n; i++)
			if(E[u][i] && !vis[i])
				Add(u, i), Dfs(i);
}

int main()
{
		//freopen(".in","r",stdin);
		//freopen(".out","w",stdout);
		n = get();
		for(int i = 1; i <= n; i++)
			a[i] = get();
		sort(a + 1, a + n + 1);
		for(int i = 1; i <= n; i++)
			for(int j = 1; j <= n; j++)
				if(i != j)
					if(gcd(a[i], a[j]) != 1) E[i][j] = 1;

		for(int i = 1; i <= n; i++)
			Dfs(i);

		for(int i = 1; i <= n; i++)
			if(!Input[i]) q.push(i);

		while(!q.empty())
		{
			int u = q.top(); q.pop();
			printf("%d ", a[u]);
			for(int e = first[u]; e; e = next[e])
			{
				int v = go[e];
				if(--Input[v] == 0) q.push(v);
			}
		}
}

Measured memory_bytes: 16128
#include <iostream>
#include <fstream>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <cmath>
#include <algorithm>
#include <assert.h>
#include <vector>
#include <cstring>
#include <bitset>
#include <random>

#define all(a) (a).begin(), (a).end()
#define sz(a) (int)(a).size()
#define pb push_back

using namespace std;

typedef long long ll;
//typedef __int128 ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef double ld;

struct edge {
    int from, to;
    ll cost;
};

const ll inf = 1e18;

class Dijkstra {
public:
    Dijkstra(vector<vector<edge> > edges, int s) {
        g = edges;
        n = sz(edges);
        dist.assign(n, inf);
        dist[s] = 0;
        auto comp = [&] (int a, int b) {
            if (dist[a] != dist[b]) {
                return dist[a] < dist[b];
            }
            return a < b;
        };
        set<int, decltype(comp)> q(comp);
        q.insert(s);
        while (!q.empty()) {
            int v = *q.begin();
            q.erase(q.begin());
            for (edge& e : g[v]) {
                if (dist[e.to] > dist[v] + e.cost) {
                    q.erase(e.to);
                    dist[e.to] = dist[v] + e.cost;
                    q.insert(e.to);
                }
            }
        }
    }

    vector<ll> get() {
        return dist;
    }
private:
    vector<vector<edge> > g;
    int n;
    vector<ll> dist;
};

int main() {

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

    int n, m, s, t;
    cin >> n >> m >> s >> t;
    --s, --t;

    vector<vector<edge> > a(n), b(n);

    while (m--) {
        int u, v;
        cin >> u >> v;
        --u, --v;
        ll x, y;
        cin >> x >> y;
        a[u].pb({u, v, x});
        a[v].pb({v, u, x});
        b[u].pb({u, v, y});
        b[v].pb({v, u, y});
    }

    Dijkstra D1(a, s);
    vector<ll> dists = D1.get();

    Dijkstra D2(b, t);
    vector<ll> distt = D2.get();

    vector<ll> ans(n);
    for (int i = 0; i < n; ++i) {
        ans[i] = dists[i] + distt[i];
    }

    for (int i = n - 2; i >= 0; --i) {
        ans[i] = min(ans[i], ans[i + 1]);
    }

    for (int i = 0; i < n; ++i) {
        cout << ll(1e15) - ans[i] << "\n";
    }

}

Measured memory_bytes: 41472
#include <bits/stdc++.h>
using namespace std;
using ll= long long;
using vi= vector<int>;
using vvi= vector<vi>;
#define REP(i,x,n) for(int i=x; i<n; i++)
#define rep(i,n) REP(i,0,n)
#define all(x) x.begin(), x.end()

int main(){
  int ans;
  string s,t;
  cin >> s >> t;

  rep(i,3){
    if(s[i]==t[i]){
      ans++;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int h, w;
	int i, j;

	while (1) {
		scanf("%d %d", &h, &w);

		if (h == 0 && w == 0) {
			break;
		}
		for (i = 1; i <= h; i++) {
			for (j = 1; j <= w; j++) {
				if ((i + j) % 2 == 0) {
					printf("#");
				}
				else {
					printf(".");
				}
			}
			printf("\n");
		}
		printf("\n");
	}
	
	return 0;
}


Measured memory_bytes: 2052
//
// Created by HDawn on 2020/6/29.
//
#pragma GCC target("avx,sse2,sse3,sse4,popcnt")
#pragma GCC optimize("O2,Ofast,inline,unroll-all-loops,-ffast-math")

#include <bits/stdc++.h>

using namespace std;
#define IOS ios::sync_with_stdio(false);cin.tie(0); cout.tie(0)
typedef long long ll;
typedef unsigned long long ull;

struct AC {
    string p;
    int n;
} p[100010];

int main() {
    int n, q;
    cin >> n >> q;
    queue<struct AC> q1;
    for (int i = 1; i <= n; ++i) {
        cin >> p[i].p >> p[i].n;
        q1.push(p[i]);
    }
    int sum = 0;
    while (!q1.empty()) {
        AC a = q1.front();
        q1.pop();
        if (a.n > q) {
            sum += q;
            a.n -= q;
            q1.push(a);
        } else {
            sum += a.n;
            cout  << a.p << " " << sum << endl;
        }
    }
    return 0;
}



Measured memory_bytes: 7796
/*
  AOJ 0577
  Title:
  @kankichi573
*/
#include <stdio.h>
int N;
int input[3][200];

void check_dupli()
{
        int i,j,k,c,flag;

        for(i=0;i<3;i++)
                for(j=0;j<N-1;j++)
                {
                        c=input[i][j];
                        if(c==0)
                                continue;
                        flag=0;
                        for(k=j+1;k<N;k++)
                        {
                                if(input[i][k]==c)
                                {
                                        input[i][k]=0;
                                        flag=1;
                                }
                        }
                        if(flag)
                                input[i][j]=0;
                }
}
void output()
{
        int i,j,sum;

        for(i=0;i<N;i++)
        {
                for(j=0,sum=0;j<3;j++)
                        sum += input[j][i];
                printf("%d\n",sum);
        }
}

int main()
{
        int i;

        scanf("%d",&N);

        for(i=0;i<N;i++)
                scanf("%d %d %d",&input[0][i],&input[1][i],&input[2][i]);
                
        check_dupli();
        output();
  return(0);
}

Measured memory_bytes: 596
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n;
  cin >> n;
  if (n<105) {
    cout << 0 << endl;
  }
  if (n>=105 && n<135) {
    cout << 1 << endl;
  }
  if (n>=135 && n<165) {
    cout << 2 << endl;
  }
  if (n>=165 && n<189) {
    cout << 3 << endl;
  }
 if (n>=189 && n<195) {
    cout << 4 << endl;
  }
  if (n>=195) {
    cout << 5 << endl;
  }
}

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

ans = [0] * N

tmp = 0
for i in range(N):
    if i % 2 == 1:
        tmp -= A[i]
    else:
        tmp += A[i]
ans[0] = tmp

for i in reversed(range(N)):
    ans[i] = (A[i] - (ans[i - N + 1] / 2)) * 2

ans = list(map(int, ans))
for i in ans:
    print(i, end=" ")

Measured memory_bytes: 71012
#include <stdio.h>
#include <stdlib.h>

int main()
{
    char a;
    int sum=0,i;
    for(i=1; i<=4; i++)
    {
        scanf("%c",&a);
        if(a=='+')
        {
            sum+=1;
        }
       if(a=='-')
        {
            sum-=1;
        }
    }
printf("%d\n",sum);
    return 0;
}


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

using namespace std;

int main() {

	int n,k;
	cin >> n >> k;

	vector <long long> v(n), dp(n);
	dp.assign(n, 10000000000);

	for (int i = 0; i < n; i++)
		cin >> v[i];

	dp[0] = 0;
	dp[1] = abs(v[1]-v[0]);

	for (int i = 2; i < n; i++) {
		for (int j = i-k; j < i; j++) {
			if(j >= 0)
				dp[i] = min(abs(v[j] - v[i]) + dp[j], dp[i]);
		}
	}

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

	return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
 
#define ll long long
#define vi vector<int>
#define vll vector<long long>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define sll set<long long>
#define si set<int>
#define stk stack<int>
#define que queue<int>
#define pb push_back
#define ff first
#define ss second
#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
 
using namespace std;

void solve(){
	int ans;
	for(int i=0;i<5;i++){
		int x;cin>>x;
		if(x==0)
			ans=i+1;
	}

	cout<<ans<<endl;
}
 
int main(){
    IOS;
    int q=1;
    //cin>>q;
    while(q--){
        solve();
    }
}

Measured memory_bytes: 3640
#include <limits.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <math.h>

#define P 1000000007

int comp(const void *a, const void *b){return *(int*)a-*(int*)b;}

int f(long x){
	int d=0;
	while(x!=0){
		d++;
		x/=10;
	}
	return d;
}

int main(void){
	long n;
	scanf("%ld", &n);
	int m=sqrt(n), i;
	int ans=f(n);
	for(i=2; i<=m; i++){
		if(n%i==0){
			int now = f(n/i);
			if(now<ans) ans=now;
		}
	}
	printf("%d\n", ans);
}


Measured memory_bytes: 128
#include <stdio.h>
int main(){
  char x[2048];
  int i,a[26]={};
  while(fgets(x,2048,stdin)!=NULL){
    i=0;
    while(x[i]!='\0'){
      if('a'<=x[i] && 'z'>=x[i])a[x[i]-'a']++;
      else if('A'<=x[i] && 'Z'>=x[i])a[x[i]-'A']++;
      i++;
    }
  }
  for(i=0;i<26;i++)printf("%c : %d\n",'a'+i,a[i]);
  return 0;
}

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

int main() {
  int n;
  cin >> n;
  vector<int> p(n);
  for (int i=0; i<n; i++){
    cin >> p.at(i);
  }
  sort(p.begin(), p.end());
  int sum = 0;
  for (int i=0; i<n-1; i++){
    sum += p.at(i);
  }
  cout << sum + p.at(n-1)/2 << endl;
  return 0;
}

Measured memory_bytes: 256
//satyaki3794
#include <bits/stdc++.h>
#define ff first
#define ss second
#define pb push_back
#define MOD (1000000007LL)
#define LEFT(n) (2*(n))
#define RIGHT(n) (2*(n)+1)
 
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> ii;
typedef pair<int, ii> iii;
 
ll pwr(ll base, ll p, ll mod = MOD){
ll ans = 1;while(p){if(p&1)ans=(ans*base)%mod;base=(base*base)%mod;p/=2;}return ans;
}
 
ll gcd(ll a, ll b){
    if(b == 0)  return a;
    return gcd(b, a%b);
}




int main(){

    ios_base::sync_with_stdio(0);

    ll a, b, c;
    cin>>a>>b>>c;

    ll ans = (a%2) * b * c;
    ans = min(ans, (b%2) * a * c);
    ans = min(ans, (c%2) * a * b);
    cout<<ans;
    return 0;
}






Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  long long num;
  long long ans = 0;
  cin >> num;
  for(long long i=1;i<=num;i++){
    if((i%3)*(i%5)!=0){
      ans += i;
    }
  }
  cout << ans << endl;
  return 0;
}

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

class Node {
public:
    int location;
    int p, l, r;
    Node() {}
};

class Point {
public:
    int id, x, y;
    Point() {}
    Point(int id, int x, int y): id(id), x(x), y(y) {}
    bool operator < (const Point &p) const {
        return id < p.id;
    }

    void print(){
        printf("%d\n", id); // cout より高速なprintf 関数を使用
    }
};

static const int MAX = 1000000;
static const int NIL = -1;

int N;
Point P[MAX];
Node T[MAX];
int np;

bool lessX(const Point &p1, const Point &p2) { return p1.x < p2.x; }
bool lessY(const Point &p1, const Point &p2) { return p1.y < p2.y; }

int makeKDTree(int l, int r, int depth) {
    if ( !(l < r))  return NIL;
    int mid = (l+r) / 2;
    int t = np++;
    if (depth % 2 == 0) {
        sort(P+l, P+r, lessX);
    } else {
        sort(P+l, P+r, lessY);
    }
    T[t].location = mid;
    T[t].l = makeKDTree(l, mid, depth + 1);
    T[t].r = makeKDTree(mid + 1, r, depth + 1);

    return t;
}

void find(int v, int sx, int tx, int sy, int ty, int depth, vector<Point> &ans) {
    int x = P[T[v].location].x;
    int y = P[T[v].location].y;

    if (sx <= x && x <= tx && sy <= y && y <= ty) {
        ans.push_back(P[T[v].location]);
    }

    if (depth % 2 == 0) {
        if (T[v].l != NIL) {
            if (sx <= x) find(T[v].l, sx, tx, sy, ty, depth + 1, ans);
        }
        if (T[v].r != NIL) {
            if (x <= tx) find(T[v].r, sx, tx, sy, ty, depth + 1, ans);
        }
    } else {
        if (T[v].l != NIL) {
            if (sy <= y) find(T[v].l, sx, tx, sy, ty, depth + 1, ans);
        }
        if (T[v].r != NIL) {
            if (y <= ty) find(T[v].r, sx, tx, sy, ty, depth + 1, ans);
        }
    }
}

int main() {
    int x, y;
    scanf("%d", &N);
    for (int i = 0; i < N; i++) {
        scanf("%d %d", &x, &y); // cin より高速な scanf 関数を使用
        P[i] = Point(i, x, y);
        T[i].l = T[i].p = NIL;
    }

    np = 0;

    int root = makeKDTree(0, N, 0);

    int q;
    scanf("%d", &q);
    int sx, tx, sy, ty;
    vector<Point> ans;
    for (int i = 0; i < q; i++) {
        scanf("%d %d %d %d", &sx, &tx, &sy, &ty);
        ans.clear();
        find(root, sx, tx, sy, ty, 0, ans);
        sort(ans.begin(), ans.end());
        for (int j = 0; j < ans.size(); j++) {
            ans[j].print();
        }
        printf("\n");
    }

    return 0;
}


Measured memory_bytes: 15892
N, M = map(int, input().split())
V = [[0, 0] for i in range(N)]
for i in range(M):
  a, b = map(int, input().split())
  if a == 1:
    V[b - 1][0] = 1
  if b == 1:
    V[a - 1][0] = 1
  if a == N:
    V[b - 1][1] = 1
  if b == N:
    V[a - 1][1] = 1
for v in V:
  if v[0] and v[1]:
    print('POSSIBLE')
    break
else:
  print('IMPOSSIBLE')

Measured memory_bytes: 25460
import sys

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


def main():
    N, D = [int(x) for x in input().split()]
    XY = [[int(x) for x in input().split()] for _ in range(N)]

    ans = 0
    for x, y in XY:
        if D ** 2 >= x ** 2 + y ** 2:
            ans += 1

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 42252
import java.util.*;
public class Main{
	public static void main(String[] args){
		Main obj=new Main();
		Scanner sc=new Scanner(System.in);
		String s=sc.next();
		String t=sc.next();
		int n=s.length(),count=0;

		for(int i=0;i<n;i++){
			if(s.charAt(i)!=t.charAt(i))
				count++;
		}

		System.out.println(count);
	}
}

Measured memory_bytes: 40964
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SZ(x) ((int)(x).size()) //unsignedのサイズをint型に変換
#define dump(x)  cerr << #x << " = " << (x) << endl;

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL; 

 
long long int gcd(long long int a, long long int b) {
	if (a < b)swap(a, b);
	while (b) {
			a %= b;
			swap(a, b);
		}
		return a;
	}


//ここから書き始める
int main(int argc, char const *argv[])
{
	int N, M;
	cin >> N >> M;
	string S, T;
	cin >> S >> T;

	auto nmgcd = gcd(N,M);
	LL n = N / nmgcd;
	LL m = M/ nmgcd;

	int loop = nmgcd;
	int flag = 0;


	FOR(i, 0, loop)
	{
		if(S[i * n] != T[i * m])
		{
			cout << -1 << endl;
			flag = 1;
			break;
		}

	}
	if(flag == 0)
	{
		cout <<  LL(N * m) << endl;
	}



}


Measured memory_bytes: 512
#include<iostream>
#include<utility>
#include<algorithm>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;
typedef pair<int,int> p;

int main(){
	int n;
	cin>>n;
	p a[n];
	long long sum=0;
	rep(i,n){cin>>a[i].first;a[i].second=i;}
	sort(a,a+n);
	rep(i,n){
		if(i%2==0 && a[i].second%2==1)sum++;
	}
	cout<<sum<<endl;
	return 0;
}

Measured memory_bytes: 1024
import java.util.*;
import java.io.*;
import java.lang.*;


class Main{
	public static void main(String args[]){
    	Scanner in = new Scanner(System.in);
      	int n = in.nextInt();
		int m = in.nextInt();
		int[] ar = new int[n];
		for(int i = 0 ; i < n ; i++){
			ar[i] = in.nextInt();
		}
		
		Arrays.sort(ar);

		int cost = 0;
		for(int i = 0 ; i < m ; i++){
			cost += ar[i];
		}
		
		System.out.println(cost);
    }
 
}

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







int main(){

	int n,X,a,ans,flg;
	cin>>n>>X;

	vector<int>x(n);
	for(int i=0;i<n;i++){
		cin>>a;
		x[i]=abs(a-X);
	}
	sort(x.begin(),x.end());

	for(int i =0;i<x[0];i++){
		flg=0;

		for(int j=0;j<n;j++){
			if(x[j]%(x[0]-i)==0){
				flg=1;
			}else{
				flg=0;
				break;
			}
		}

		if(flg==1){
			ans=x[0]-i;
			break;
		}
	}

	cout<<ans;

}



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

#define int int64_t

string construct(vector< vector<int> >&dp , string s1 , string s2 , int n , int m) {
    string ans = "";
    int i , j , k , l;
    i = n;
    j = m;
    while(i > 0 && j > 0) {
        if(s1[i] == s2[j]) {
            ans += s1[i];
            i--;
            j--;
        }
        else if(dp[i-1][j] > dp[i][j-1]) i--;
        else j--;
    }
    if(ans.length() > 0) reverse(ans.begin() , ans.end());
    return ans;
}

void solve(string s1 , string s2, int n , int m ) {
    int i , j, k, l;
    vector< vector<int> >dp(n+1 , vector<int>(m+1 , 0));
    for(i=1;i<=n;++i) {
        for(j=1;j<=m;j++) {
            dp[i][j] = max(dp[i-1][j] , dp[i][j-1]);
            if(s1[i] == s2[j]) 
                dp[i][j] = max(1+dp[i-1][j-1] , dp[i][j]);
        }
    }
    // for(i=1;i<=n;++i) {
    //     for(j=1;j<=m;j++) {
    //         cout << dp[i][j] << ' ';
    //     }
    //     cout << endl;
    // }
    cout << construct(dp , s1 , s2 , n , m) << endl;
}

int32_t main() {
	int n , m , i , j , k , l;
	string s1 , s2;
	cin >> s1 >> s2;
	n = s1.length();
	m = s2.length();
	reverse(s1.begin() , s1.end());
	reverse(s2.begin() , s2.end());
	s1 += '@' ; s2 += '@';
	reverse(s1.begin() , s1.end());
	reverse(s2.begin() , s2.end());
	solve(s1 , s2 , n , m);
	return 0;
}

Measured memory_bytes: 70784
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const ll mod = 1000000007;
const int INF = 1001001001;
const ll LINF = 1001001001001001001;
ll sum;
vector<vector<vector<ld>>> memo(301,vector<vector<ld>>(301,vector<ld>(301,-1.0)));

ld f(int a,int b,int c){
    if(a==-1 || b==-1 || c==-1) return 0.0;
    if(a==0 && b==0 && c==0) return 0.0;
    if(memo.at(a).at(b).at(c) != -1.0) return memo.at(a).at(b).at(c);

    int abc = a+b+c;
    ld onetozero = (ld)(a)/(ld)(abc) * ((ld)(sum)/(ld)(abc) + f(a-1,b,c));
    ld twotoone = (ld)(b)/(ld)(abc) * ((ld)(sum)/(ld)(abc) + f(a+1,b-1,c));
    ld threetotwo = (ld)(c)/(ld)(abc) * ((ld)(sum)/(ld)(abc) + f(a,b+1,c-1));
    ld ret = onetozero + twotoone + threetotwo;
    memo.at(a).at(b).at(c) = ret;
    return ret;    
}

int main(){
    ll n ; cin >> n;
    int x=0,y=0,z=0;
    rep(i,n){
        int a ; cin >> a;
        if(a==1){
            x++;
        }else if(a==2){
            y++;
        }else{
            z++;
        }
    }
    sum = x+y+z;
    cout <<setprecision(12) << f(x,y,z) << endl;        
}

Measured memory_bytes: 431488
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
	vector<pair<int, int> > v(6);
	for (int i = 0; i < 6; i++) {
		cin >> v[i].first >> v[i].second;
		if (v[i].first > v[i].second) swap(v[i].first, v[i].second);
	}
	sort(v.begin(), v.end());
	if (v[0] != v[1] || v[2] != v[3] || v[4] != v[5]) cout << "no" << endl;
	else if (v[0].first != v[2].first || v[0].second != v[4].first || v[2].second != v[4].second) cout << "no" << endl;
	else cout << "yes" << endl;
	return 0;
}

Measured memory_bytes: 3088
#include<bits/stdc++.h>
using namespace std;
char grid[6][6];
bool check(int row[],int col[],int k,int r,int c)
{
    int count=0;
    for(int i=0;i<r;i++)
        for(int j=0;j<c;j++)
        if(row[i]==0 && col[j]==0 && grid[i][j] == '#')
        count++;
    if(count==k)
        return true;
    else
        return false;
}
int main()
{
    int r,c,k;
    cin>>r>>c>>k;
    for(int i=0;i<r;i++)
        for(int j=0;j<c;j++)
            cin>>grid[i][j];
    int ans=0;
    for(int i=0;i<r;i++)
    {
        int row[r] = {0};
        for(int z=0;z<i;z++)
            row[z] = 1;
        for(int j=0;j<c;j++)
        {
            int col[c] = {0};
            for(int z=0;z<j;z++)
                col[z] = 1;
            sort(row,row+r);
            sort(col,col+c);
            do
            {
                do
                {
                    if(check(row,col,k,r,c))
                        ans++;
                }
                while(next_permutation(row,row+r));
            }
            while(next_permutation(col,col+c));
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 3628
#include <cstdio>
int N,C;
int s[100000] ,t[100000] ,c[100000];
int sm [200002];
int tt [200002];
int  main()
{
scanf ("%d%d",&N,&C);
for(int i=0;i<N;i++)
scanf ("%d%d%d",&s[i],&t[i],&c[i]);
for(int i=1;i<=C;i++)
{
for(int j=0;j <200002;j++)tt[j]=0;
for(int j=0;j<N;j++)if(c[j]==i)tt[s[j]*2-1]++ ,tt[t[j]*2]--;
for(int j=1;j <200002;j++)tt[j]+=tt[j-1];
for(int j=0;j <200002;j++)if(tt[j]>0)sm[j]++;
}
int mx=0;
for(int j=0;j <200002;j++)if(mx <sm[j])mx=sm[j];
printf ("%d\n",mx);
}

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

using namespace std;

#pragma GCC diagnostic ignored "-Wunused-variable"
#pragma GCC diagnostic ignored "-Wunused-result"
#pragma GCC diagnostic ignored "-Wunused-label"

#define DEBUG(x) cout << "> " << #x << ": " << x << endl;

typedef long long ll;
typedef long double ld;
const ll MOD = 1e9+7;
const int inf = 1e9+7;
const ll longinf = 1LL<<60;

// Start Coding...

void solve() {
    int K, X;
    cin >> K >> X;
    if (K * 500 >= X) cout << "Yes" << endl;
    else cout << "No" << endl;
    return;
}

int main() {
    solve();
    return 0;
}

Measured memory_bytes: 256
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <queue>
using namespace std;
#define MAX(X, Y) (((X) > (Y)) ? (X) : (Y))
#define MIN(X, Y) (((X) < (Y)) ? (X) : (Y))
int compare_int(const void* a, const void* b)
{
    return *(long long int*)b - *(long long int*)a;  // 大きい順
}
// 公約数
long int gcd(long int a, long int b)
{
    if (b == 0) {
        return a;
    }
    else {
        return gcd(b, a % b);
    }
}
// 最小公倍数 = a * b / 最大公約数
// 公倍数
long int lcm(long int a, long int b) { return a * b / gcd(a, b); }

// min
int main(void)
{
    long int n, m;
    long long int a;
    long long int ans = 0;
    priority_queue<int> q;

    scanf("%ld%ld", &n, &m);

    for (long int i = 0; i < n; i++) {
        scanf("%lld", &a);
        q.push(a);
    }

    for (long int i = m; m > 0; m--) {
        // 大きい順に並び替え
        a = q.top();
        q.pop();
        a /= 2;
        q.push(a);
    }
    // 大きい値段から割引券を使用する。
    // 次に大きい値段と比べてそれより大きい限り、割引を行うようにする

    for (long int i = 0; i < n; i++) {
        a = q.top();
        q.pop();
        ans += a;
    }
    printf("%lld", ans);

    return 0;
}


Measured memory_bytes: 892
#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;
#define ll long long
#define repeat(i,a,b) for(int i=(a),i##__end=(b);i<i##__end;i++)
#define repeat_back(i,a,b) for(int i=(b)-1,i##__end=(a);i>=i##__end;i--)
#define mst(a,x) memset((a),(x),sizeof(a))
#define pii pair<int,int>
#define N 200010
//#define mod 1000000007
#define int ll
#define inf mod
tree<pii,null_type,less<pii>,rb_tree_tag,tree_order_statistics_node_update> t;//红黑树
int a[N];
int n,mod,ans=0;
signed main(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin>>n>>mod;
	repeat(i,1,n+1)cin>>a[i],a[i]--;
	int flag=false;
	t.insert({0,0});
	repeat(i,1,n+1){
		a[i]+=a[i-1]; a[i]%=mod;
		/*if(a[i]==0 && !flag)*///ans++,flag=1;
		ans+=abs(
		t.order_of_key({a[i]+1,-1})
		-t.order_of_key({a[i],i-mod+1})
		);
		//cout<<i<<' '<<a[i]<<' '<<abs(
		//t.order_of_key({a[i]+1,-1})
		//-t.order_of_key({a[i],i-mod+1})
		//)<<endl;
		t.insert({a[i],i});
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 14336
#include <bits/stdc++.h>
//#define cin (type == 0?cin:fin)
//#define cout (type == 0?cout:fout)
#define tcn cin.tie(0);
#define tct cout.tie(0);
#define r_0 return 0
#define ll long long
#define TIME ios_base::sync_with_stdio(0);
using namespace std;

const long long N = 2e5 + 7;
const long long MrBeast = 1e9;


ll T = 1, n, u[N], m, x, pluse, minuse, NAZSHO, cnt, ans;
vector < ll > v, t;
int type = 0;
set< ll > st;
pair< ll ,ll > p[N];
int main()
{
    TIME
    //ifstream  fin("swap.in");
    //ofstream  fout("swap.out");
    string s;
    cin >> s;
    for ( int i=0; i<s.size(); i++ ){
        if ( s[i] == '7' )
        {
            cout << "Yes";
            return 0;
        }
    }
    cout << "No";
}


Measured memory_bytes: 3620
#include <stdio.h>

int main(void) {
	int i,max;
	double x1,y1,x2,y2,x3,y3;
	double _x1,_x2,_y1,_y2;
	double houteisiki[6];
	double cx,cy;
	double x,y;
	double r;
	double keisuu;
	int ht;
	scanf("%d",&max);
	for(i=0;i<max;i++) {
		scanf("%lf %lf %lf %lf %lf %lf",&x1,&y1,&x2,&y2,&x3,&y3);
		ht=0;
		_x1=x1;_x2=x2;_y1=y1;_y2=y2;
		cx=(_x1+_x2)/2;
		cy=(_y1+_y2)/2;
		if(_x1-_x2!=0 && _y1-_y2!=0) {
			keisuu=-1.0/((_y1-_y2)/(_x1-_x2));
			houteisiki[ht]=keisuu;
			houteisiki[ht+1]=-1;
			houteisiki[ht+2]=cx*keisuu-cy;
			ht+=3;
		} else {
			if(_x1-_x2==0 && _y1-_y2!=0) {
				houteisiki[ht]=0;
				houteisiki[ht+1]=1;
				houteisiki[ht+2]=cy;
				ht+=3;
			} else if(_x1-_x2!=0 && _y1-_y2==0) {
				houteisiki[ht]=1;
				houteisiki[ht+1]=0;
				houteisiki[ht+2]=cx;
				ht+=3;
			}
		}
		_x1=x2;_x2=x3;_y1=y2;_y2=y3;
		cx=(_x1+_x2)/2;
		cy=(_y1+_y2)/2;
		if(_x1-_x2!=0 && _y1-_y2!=0) {
			keisuu=-1.0/((_y1-_y2)/(_x1-_x2));
			houteisiki[ht]=keisuu;
			houteisiki[ht+1]=-1;
			houteisiki[ht+2]=cx*keisuu-cy;
			ht+=3;
		} else {
			if(_x1-_x2==0 && _y1-_y2!=0) {
				houteisiki[ht]=0;
				houteisiki[ht+1]=1;
				houteisiki[ht+2]=cy;
				ht+=3;
			} else if(_x1-_x2!=0 && _y1-_y2==0) {
				houteisiki[ht]=1;
				houteisiki[ht+1]=0;
				houteisiki[ht+2]=cx;
				ht+=3;
			}
		}
		if(ht<6) {
			_x1=x3;_x2=x1;_y1=y3;_y2=y1;
			cx=(_x1+_x2)/2;
			cy=(_y1+_y2)/2;
			if(_x1-_x2!=0 && _y1-_y2!=0) {
				keisuu=-1.0/((_y1-_y2)/(_x1-_x2));
				houteisiki[ht]=keisuu;
				houteisiki[ht+1]=-1;
				houteisiki[ht+2]=cx*keisuu-cy;
				ht+=3;
			} else {
				if(_x1-_x2==0 && _y1-_y2!=0) {
					houteisiki[ht]=0;
					houteisiki[ht+1]=1;
					houteisiki[ht+2]=cy;
					ht+=3;
				} else if(_x1-_x2!=0 && _y1-_y2==0) {
					houteisiki[ht]=1;
					houteisiki[ht+1]=0;
					houteisiki[ht+2]=cx;
					ht+=3;
				}
			}
		}
		x=(houteisiki[2]*houteisiki[4]-houteisiki[5]*houteisiki[1])/
			(houteisiki[0]*houteisiki[4]-houteisiki[3]*houteisiki[1]);
		y=(houteisiki[2]*houteisiki[3]-houteisiki[5]*houteisiki[0])/
			(houteisiki[1]*houteisiki[3]-houteisiki[4]*houteisiki[0]);
		if(x>-0.001 && x<0.001)x=0;
		if(y>-0.001 && y<0.001)y=0;
		r=sqrt((x-x1)*(x-x1)+(y-y1)*(y-y1));
		if(r>-0.001 && r<0.001)r=0;
		printf("%1.3f %1.3f %1.3f\n",x,y,r);
	}
	return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std ;
#define ll long long
#define db double
#define ld long double
#define IOS  ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#pragma GCC optimize(2)
#define ull unsigned long long
#define maxn 110
ll lcm(ll a,ll b){return a*b/__gcd(a,b);}
void dfs(){}
int a[maxn];
ll n,k;
signed main()
{
    IOS
    cin>>n>>k;
    if(n%k==0)cout<<0;
    else{
        n%=k;
        cout<<min(n,k-n);
    }
    return 0 ;
}


Measured memory_bytes: 256
S = input()
T = input()

ans = []
for i in range(len(S)-len(T)+1):
    flag = 1
    for j in range(len(T)):
        if S[i+j] == T[j] or S[i+j] == "?":
            continue
        else:
            flag = 0
    if flag == 1:
        S_restore = list(S)
        for j in range(len(T)):
            S_restore[i+j] = T[j]
        for j in range(len(S)):
            if S_restore[j] == "?":
                S_restore[j] = "a"
        ans.append("".join(map(str, S_restore)))
ans.sort()

if len(ans) >= 1:
    print(ans[0])
else:
    print("UNRESTORABLE") 


Measured memory_bytes: 3064
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_set>
#include<unordered_map>
#include<random>
#include<array>
#include<cassert>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define uniq(v) v.erase(unique(all(v)),v.end())


int popcount32(unsigned int x) {
	x = x - ((x >> 1) & 0x55555555);
	x = (x & 0x33333333) + ((x >> 2) & 0x33333333);
	x = (x + (x >> 4)) & 0x0F0F0F0F;
	x = x + (x >> 8);
	x = x + (x >> 16);
	return x & 0x0000003F;
}


int H, W, K;
string S[10];




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

	cin >> H >> W >> K;
	rep(i, H)cin >> S[i];

	int ans = INF;
	rep(i, 1 << H) if ((i & 1) == 0) {
		int s = popcount32(i);
		int c[10] = {};

		rep(j, W) {
			int idx = 0;
			bool over = false;
			rep(k, H) {
				if (i >> k & 1)idx++;
				c[idx] += S[k][j] == '1';
				if (c[idx] > K)over = true;
			}
			if (over) {
				s++;
				memset(c, 0, sizeof(c));
				idx = 0;
				rep(k, H) {
					if (i >> k & 1)idx++;
					c[idx] += S[k][j] == '1';
					if (c[idx] > K)s = INF;
				}
			}
		}
		ans = min(ans, s);
	}
	cout << ans << endl;



	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <memory>
#include <complex>
#include <numeric>
#include <cstdio>
#include <iomanip>

#define REP(i,m,n) for(int i=int(m);i<int(n);i++)
#define RREP(i,m,n) for(int i=int(n)-1;i>=int(m);--i)
#define EACH(i,c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR 
#endif
using namespace std;

using UI = unsigned int;
using UL = unsigned long;
using LL = long long int;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VS = vector<string>;
using PII = pair<int,int>;
using VP = vector<PII>;

//struct edge {int from, to, cost;};

constexpr double EPS = 1e-10;
constexpr double PI  = acos(-1.0);
//constexpr int INF = INT_MAX;

template<class T> inline T sqr(T x) {return x*x;}

void solve() {
    int n;
    cin >> n;
    {
        int sum = 0;
        while (n) {
            sum += n % 10;
            n /= 10;
        }
        if (sum == 1) sum = 10;
        cout << sum << endl;
    }
}

int main() {
    solve();
    
    return 0;
}

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

using namespace std;

template<class T>
using V = vector<T>;
template<class T>
using VV = V<V<T>>;

using ld = long double;
#define ll long long
using ull = unsigned ll;
using PLL = pair<ll, ll>;
using VLL = V<ll>;
using VB = V<bool>;
using VVB = VV<bool>;
using VVLL = VV<ll>;
using Gr = VVLL;
using MLL = map<ll, ll>;
#define UMLL unordered_map<ll, ll, custom_hash>
//typedef __int128 int128;
//typedef __float128 double128;

#define fast ios::sync_with_stdio(0); cin.tie(nullptr); cout.tie(nullptr);

#define INF LLONG_MAX
#define MINF LLONG_MIN

#define R &
#define CR const R

#define FORI(i, a, b) for(ll i = a, max##i = b; i < max##i; ++i)
#define FOR(i, n) FORI(i, 0, n)
#define RFORI(i, a, b) for(ll i = a, min##i = b; i >= min##i; --i)
#define RFOR(i, n) RFORI(i, n, 0)
#define FORA(i, a) for(auto i : a)
#define FORAR(i, a) for(auto R i : a)
#define FORACR(i, a) for(auto CR i : a)
#define ALL(obj) begin(obj), end(obj)
#define Count(q) while(q--)
#define OK cerr << "OK\n";

#define mp make_pair
#define pb push_back

//#define DEBUG

template<class T>
T sqr(T x)
{
    return x * x;
}

void YES(bool g, ostream R os, bool upper = false)
{
    if(g)
        if(upper)
            os << "YES";
        else
            os << "Yes";
    else
        if(upper)
            os << "NO";
        else
            os << "No";

    os << "\n";
}

template<class T>
ll cast(T CR t)
{
    return static_cast<ll>(t);
}

template<class T>
void show(T CR t, ostream R os = cerr)
{
    FORACR(i, t)
        os << i << " ";
    os << "\n";
}

constexpr ll MOD = 1e9 + 7;
//constexpr ll len = 2 * ('z' - 'a' + 1);
//constexpr ld eps = 1e-9;

//constexpr ld unreal = -1e9;

constexpr ld PI = atanl(1.0L) * 4;

struct custom_hash
{
    static uint64_t splitmix64(uint64_t x)
    {
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator() (uint64_t x) const
    {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

struct T
{
    ll sz = 1, p = -1;
};

void solve(istream R is, ostream R os)
{
    ll n, m;
    is >> n >> m;

    V<T> dsu(n);

    function<ll(ll)> get_ = [&dsu, &get_](ll x)
    {
        if(dsu[x].p == -1)
            return x;

        return dsu[x].p = get_(dsu[x].p);
    };

    auto union_ = [&dsu, &get_](ll x, ll y)
    {
        x = get_(x);
        y = get_(y);

        if(x == y)
            return;

        if(dsu[x].sz < dsu[y].sz)
            swap(x, y);

        dsu[y].p = x;
        dsu[x].sz += dsu[y].sz;
    };

    Count(m)
    {
        ll u, v;
        is >> u >> v;

        union_(--u, --v);
    }

    ll ans = 0;
    FORACR(i, dsu)
        ans = max(ans, i.sz);

    os << ans << "\n";
}

int main()
{
    fast
    ll q = 1;
    //cin >> q;
    cout << setprecision(999);
    Count(q)
        solve(cin, cout);
}


Measured memory_bytes: 6364
#include <bits/stdc++.h>
using namespace std;
#define ll int64_t
#define ALL(a)  (a).begin(),(a).end()
 
const ll mod = 1000000007;
const ll LINF = 1e13;
const ll LLINF = 1e18;
const ll ALPHABET = 26;
 
template <class T>
void Swap(T& r, T& l) {
  T tmp = r;
  r = l;
  l = tmp;
}
 
template<typename T>
istream& operator >> (istream& is, vector<T>& vec) {
  for (T& x : vec) is >> x; //for(int i=0; i<vec.size(); i++) is >> x[i]; とかでもいい
  return is;
}


int main(){
    ll N;
    string s;
    cin >> N;
    cin >> s;

    for (ll i = 0; i < s.size(); i++){
        ll siz = s[i] - 'A' + N;
        if (siz >= ALPHABET) siz -= ALPHABET;
        s[i] = siz + 'A';
    }

    cout << s <<endl;    
    
}


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

int lcm(int i,int j){
    if(j==0)return i;
    return lcm(j,i%j);
}

int main(void){
    int n;
    cin>>n;
    int tmp=1;
    for(int i=0;i<n;i++){
        int j;
        cin>>j;
        tmp=tmp*j/lcm(tmp,j);
    }
    cout<<tmp<<endl;

    return 0;
}



Measured memory_bytes: 3096
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()

n, k = na()
s = ns()

ans = ""
for i in range(n):
    if i+1 == k:
        ans = ans + s[i].lower()
    else:
        ans = ans + s[i]


print(ans)



Measured memory_bytes: 2940
n,k = map(int,input().split())
h = []
for _ in range(n):
    h.append(int(input()))

h.sort()
ans = float('inf')
for i in range(n-k+1):
    x = h[i+k-1] - h[i]
    if x < ans:
        ans = x

print (ans)


Measured memory_bytes: 7384
//繝・Φ繝励Ξ
#include <bits/stdc++.h>
#define int long long
#define REP(i, n) for(int i = 0; i < (n); ++i)
#define FOR(i, a, b) for (int i = (a); i <= (b); ++i)
#define ALL(v) (v).begin(), (v).end()
#define PAIR pair<int, int>
#define ios() ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
using namespace std;
//constexpr int MOD = 10e9+7;
//constexpr int INF = 1LL << 60;
template <class T>
inline bool chmin(T &a, T b)
{
  if (a > b)
  {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmax(T &a, T b)
{
  if (a < b)
  {
    a = b;
    return 1;
  }
  return 0;
}
//UP = 0;RIGHT = 1; DOWN = 2; LEFT =3;
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
int gcd(int a, int b)
{
  if (a < b)
    gcd(b, a);
  int r;
  while ((r = a % b))
  {
    a = b;
    b = r;
  }
  return b;
}

void eratos(bool * isPrime,int max){
  fill(isPrime,isPrime + max,true);
  isPrime[0] = false; 
  isPrime[1] = false; 

  for(int i=2; i<=max/i; ++i) 
      if(isPrime[i]) 
          for(int j=2; j<=max/i; ++j) 
              isPrime[i*j] = false;    
}
//


bool isPrime[100010];
int ruisekiwa[100010];
signed main()
{
  ios();
  eratos(isPrime,100001);
  for(int i = 3 ; i< 100000; i += 2)
  {
    if(isPrime[i] && isPrime[(i+1)/2])
    {
      ++ruisekiwa[i] ;
    }
  }
  REP(i,100000)
  {
    ruisekiwa[i+1] += ruisekiwa[i];
  }
  int Q;
  cin >> Q;
  int l[Q],r[Q];
  REP(i,Q)
  {
    cin >> l[i]>> r[i];
  }
  REP(i,Q)
  {
    cout << ruisekiwa[r[i]] - ruisekiwa[l[i]-1] <<endl;
  }
}

//驛ｨ蛻・・譛蟆丞､
//譖ｴ譁ｰ縺励↑縺・ｴ蜷遺・邏ｯ遨阪ｏ REP(i,N) ruiseki[i+1] += ruiseki[i];
//莠梧ｬ｡蜈・↓縺励◆縺・・縺・ｂ縺呎ｳ・
//荳邂・園繧剃ｽ募屓繧よ峩譁ｰ縺励◆縺・・Segment Tree(縺溘□縺怜叙蠕涌(logN))
//遽・峇繧剃ｽ募屓繧よ峩譁ｰ縺励◆縺・・Lazy Segment Tree


Measured memory_bytes: 3072
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  double N, K;
  cin >> N >> K;
  int a = 0;
  
  for (int i = 0; i < N; i++) {
    double x_i;
    cin >> x_i;
    
    if (x_i < K / 2) {
      a += x_i * 2;
    }
    else {
      a += (K - x_i) * 2;
    }
  }
  
  cout << a << endl;
  
}

Measured memory_bytes: 256