akhauriyash/Code-Regression huggingface dataset:
N, M = map(int, input().split())
C = [tuple(map(int, input().split())) for _ in range(M)]
P = {c[0]: [] for c in C}
for c in C:
    P[c[0]].append(c[1])
for p in P:
    P[p].sort()
    P[p] = {P[p][i]: i + 1 for i in range(len(P[p]))}
for c in C:
    print('{:06}{:06}'.format(c[0], P[c[0]][c[1]]))


Measured memory_bytes: 54568
//BISMILLAHIR RAHMANIR RAHIM

#include <bits/stdc++.h>
#define loop(i,n) for(int i=0;i<n;i++)
#define pi acos(-1.00)

using namespace std;



int main()
{
long long int  a,b,i,c,d;
cin>>a>>b;

    c=min(a,b);
    d=max(a,b);
    for(i=0;i<d;i++)
    {
        cout<<c;
    }


}





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

using namespace std;

int main(){
	int a,b,c,x,y;
	scanf("%d%d%d%d%d",&a,&b,&c,&x,&y);
	long long int ans=0ll;
	if(a+b>2*c){
		int temp=min(x,y);
		ans+=(temp)*2*c;
	}
	else{
		int temp=min(x,y);
		ans+=(temp)*(a+b);
	}
	//printf("%lld\n",ans);
	int temp=min(x,y);
	x-=temp;y-=temp;
	if(x!=0){
		ans+=(a>2*c)?x*2*c:x*a;
		printf("%lld\n",ans);
		return 0;
	}
	ans+=(b>2*c)?y*2*c:y*b;
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
  
int main(){
  int K,N,minsum=1e9;
  cin >> K >> N;
  vector<int> A(2*N);
  for(int i=0;i<N;i++){
    cin >> A.at(i);
    A.at(i+N)=A.at(i)+K;
  }
  for(int i=0;i<N;i++){
    int sum=0;
    sum=A.at(i+N-1)-A.at(i);
    minsum=min(minsum,sum);
  }
  cout << minsum << endl;
}      

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

int main() {
  int N , M ;
  cin >> N >> M ;
  vector<int> A(N) ;
  
  rep(i,N) cin >> A.at(i) ;
  int count = 0 ;
  int ans = 0 ;
  map<int,int> score ;
  rep(i,N) score[A.at(i)]++ ;
  for(auto p : score ) {
	auto key = p.first ;
	auto value = p.second ;
    ans++ ;
  }
  vector<int> B(ans) ;
  ans = 0 ;
  for(auto p : score ) {
	auto key = p.first ;
	auto value = p.second ;
    B.at(ans) = value ;
    ans++ ;
  }
  //cout << ans << endl ;
  sort(B.begin(),B.end()) ;
  //rep(i,ans) cout << " " << B.at(i) ;
  //cout << endl ;
  if ( ans - M < 0 ){
    N = 0 ;
    cout << N << endl;
    return 0 ;
  }
  rep(i,ans - M ) count += B.at(i) ;
  cout << count << endl;
}

Measured memory_bytes: 11136
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<cmath>
using namespace std;
inline void keep_window_open(){char ch; cin >> ch;}

int main(){
    int n;
    cin >> n;
    vector<int>v;
    for(int i = 0;i<n;++i){
        int temp;
        cin>>temp;
        v.push_back(temp);
    }
    sort(v.begin(),v.end());
    double sum = v[0]/pow(2.0,n-1);
    for(int i = 1;i<n;++i){
        sum+=v[i]/pow(2.0,n-i);
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 384
//↓template↓

#include "bits/stdc++.h"
using namespace std;
#define Would
#define you
#define all(n)  n.begin(),n.end()
#define rall(n) n.rbegin(),n.rend()
typedef long long ll;
const ll INF = 1e18;
const ll MOD = 1e9 + 7;
const double EPS = 1e-10;
const double pi = acos(-1);//3.1415926535897932384626433832795028...
const ll SIZE = 1 << 17;
int dx[] = { 1,0,-1,0 }, dy[] = { 0,1,0,-1 }, alp[30];
ll fac[200005], finv[200005], inv[200005];
vector<ll>dij;
struct edge { ll to, cost; };
vector<vector<edge> >G;

ll mod_pow(ll a, ll b) {
	ll res = 1, mul = a;
	for (int i = 0; i < 31; ++i) {
		if (b >> i & 1) {
			res *= mul;
			res %= MOD;
		}
		mul = (mul * mul) % MOD;
	}
	return res;
}

void addedge(int from, int to, int cost) {
	G[from].push_back({ to,cost });
	G[to].push_back({ from,cost });
}

template<typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }

template<typename T, typename... Ts>
auto make_v(size_t a, Ts... ts) {
	return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}

template<typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T & t, const V & v) { t = v; }

template<typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T & t, const V & v) {
	for (auto& e : t) fill_v(e, v);
}

template<typename T>
void outp(vector<T>v) {
	for (int i = 0; i < v.size(); ++i) {
		cout << v[i];
		if (i != v.size() - 1) { cout << " "; }
	}
}

double add(double a, double b) {
	if (abs(a + b) < EPS * (abs(a) + abs(b))) { return 0; }
	return a + b;
}


//↑template↑


int main() {
	ll n;
	cin >> n;
	cout << n * (n - 1) / 2 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  long long A,B,C,D,E,F,G,H,I,J,K,L,M,N,T,W,X,Y;
  string S;
  cin >>  N >> K;
  
  if (N%K>K-(N%K)) {cout << K-(N%K) << endl;} else {cout << N%K << endl;}
  
  
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
int N,L;
signed main(){
  cin >> N >> L;
  int sum=(L+L+N-1)*N/2;
  int tmp=100000,res;
  for(int i=1;i<=N;i++){
    if(abs(L+i-1)<tmp){
      tmp=abs(L+i-1);res=L+i-1;
    }
  }
  cout << sum-res << endl;
  return 0;
}


Measured memory_bytes: 256
from collections import deque

s = input()
q = int(input())
ans = deque(s)

flag = False

for i in range(1, q+1):
    a = input().split()
    if len(a) == 1:
        flag = not flag
    else:
        _, f, c = a
        if (f == "1" and flag == False) or (f == "2" and flag == True):
            ans.extendleft(c)
        elif (f == "1" and flag == True) or (f == "2" and flag == False):
            ans.extend(c)
        else:
            print("fac")
            exit(1)

if flag:
    print("".join(list(ans)[::-1]))
else:
    print("".join(ans))




Measured memory_bytes: 10100
#include <iostream>
#include <string>

int main(int argc, char** argv)
{
	std::string str;
	if (std::getline(std::cin, str))
	{
		for (int i = 0; i < str.size(); ++i)
		{
			if (str[i] >= 'a' && str[i] <= 'z')
			{
				str[i] += ('A' - 'a');
			}
			else if (str[i] >= 'A' && str[i] <= 'Z')
			{
				str[i] -= ('A' - 'a');
			}
		}
	}

	std::cout << str << std::endl;

	return 0;
}


Measured memory_bytes: 3204
c=(0..18).map{[0]*19}
gets
p$<.sum{|a|a=(a.to_r*10**9).to_i
i,j=[2,5].map{|c|(0..17).find{a%c>0||!a/=c}||18}
c[~i..].sum{_1[~j..].sum}+0*c[i][j]+=1}

Measured memory_bytes: 14316
#include<stdio.h>
#define MAX 101

void print(int n,int *A){
  int i;
  for(i=0;i<n-1;i++)
    printf("%d ",A[i]);
  printf("%d\n",A[i]);
}
/*
void insertion_sort(int n,int *A){
  int i,j,v;
  for(i=0;i<n;i++){
    v=A[i];
    j=i-1;
    while(j>=0 && A[j]>v){
      A[j+1]=A[j];
      j--;
    }
    A[j+1]=v;
    print(n,A);
  } 
}
*/

void insertion_sort(int n,int *A){
  int i,j,v;
//  for(i=0;i<n;i++){
  for(i=0;i<n;i++){
    v=A[i];
    j=i-1;
    while(j>=0 && A[j]>v){
      A[j+1]=A[j];
      j--;
    }
    A[j+1]=v;
    print(n,A);
  } 
}
int main(){
  int n,i;
  int a[MAX];
  scanf("%d",&n);
  for(i=0;i<n;i++)
    scanf("%d",&a[i]);
  insertion_sort(n,a);
  return 0;
}



Measured memory_bytes: 2736
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <cmath>
#include <bitset>
#include <iomanip>
#include <stack>
#include <list>
#include <map>
#include <unordered_map>
#include <chrono>
#include <numeric>
using namespace std;
using ll = long long;
const ll INF = (ll)1e18+1;
const ll DIV = 1000000007;
//#define TEST


int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
#ifdef TEST
    chrono::system_clock::time_point start, end;
    start = chrono::system_clock::now();
#endif
    long N, M;
    cin >> N >> M;
    ll A, B;
    vector<vector<ll>> Node(N+1);
    for(size_t i=0;i<M; i++)
    {
        cin >> A >> B;
        Node[A].push_back(B);
        Node[B].push_back(A);
    }

    queue<ll> q;
    q.push(1);
    vector<ll> ans(N+1);
    ans[1]=1;

    while(!q.empty())
    {
        //Node 1からスタート
        ll index = q.front();q.pop();
        cerr << index << endl;
        for(size_t i=0;i<Node[index].size(); i++)
        {
            //探索してなければ足す
            if(!ans[Node[index][i]])
            {
                ans[Node[index][i]] = index;
                q.push(Node[index][i]);
            }
        }
    }

    cout << "Yes" << endl;
    for(size_t i=2;i<=N; i++)
    {
        cout << ans[i] << endl;
    }

#ifdef TEST
    end = chrono::system_clock::now();
    cerr << static_cast<double>(chrono::duration_cast<chrono::microseconds>(end - start).count() / 1000.0) << "[ms]" << endl;
#endif
    return 0;
}

Measured memory_bytes: 12928
#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<<30)-1)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()


int n;
long long a[100001];
long long mi[100001];

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

	cin >> n;
	rep(i, n + 1)cin >> a[i];


	long long c = a[n];
	for (int i = n - 1; i >= 0; i--) {
		mi[i] = (c + 1) / 2;
		c = a[i] + mi[i];
	}
	long long sum = 0;
	rep(i, n + 1)sum += a[i];

	c = 1;
	long long ans = 0;
	rep(i, n + 1) {
		sum -= a[i];
		c -= a[i];
		if (c < mi[i]) {
			cout << -1 << endl;
			return 0;
		}
		c = min(sum, c);
		ans += a[i] + c;
		c *= 2;
		c = min(c, 1LL << 60);
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 5200
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/rope>

//#define DEBUG
#ifdef DEBUG
    #define IFD(...) __VA_ARGS__
    #define IFN(...)
    #define L cout<<__LINE__<<"\n";
    #define PRINT(...) __VA_ARGS__ cout<<__LINE__<<" : "<<#__VA_ARGS__<<"\n"
    #define PRT(x) cout<<__LINE__<<" : "<<#x<<" = "<<x<<"\n"
#else // DEBUG
    #define IFD(...)
    #define IFN(...) __VA_ARGS__
    #define L
    #define PRINT(...) __VA_ARGS__
    #define PRT(x)
#endif // DEBUG

#define it iterator
#define rit reverse_iterator
#define mp make_pair
#define mems(a,b) memset(a,b,sizeof(a))
#define mem0(a) mems(a,0)
#define mem1(a) mems(a,1)
#define mem255(a) mems(a,255)
#define halt(s) cout<<s,exit(0)IFD(,cout<<"\n\nTIME: "<<runtime<<" sec\n\n")
#define all(c) (c).begin() , (c).end()
#define sz(c) ((long long)((c).size()))
#define phb push_back
#define ppb pop_back
#define phf push_front
#define ppf pop_front
#define fort0(i,a,b) for(ll i=a,i##_TO=b;i<i##_TO;i++)
#define for0(i,n) fort0(i,0,n)
#define fort1(i,a,b) for(ll i=a,i##_TO=b;i<=i##_TO;i++)
#define for1(i,n) fort1(i,1,n)
#define ford(i,a,b) for(ll i=a,i##_TO=b;i>=i##_TO;i--)
#define loop(n) for0(LOOP_COUNTER,n)
#define runtime (clock()*1.0/CLOCKS_PER_SEC)
#define x first
#define y second

using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;

#define int ll

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

template
<
    class key,
    class val=null_type, /// null_mapped_type
    class comp=less<key>
>
using ord_set=tree /// find_by_order(), order_of_key()
<
    key,
    val,
    comp,
    rb_tree_tag,
    tree_order_statistics_node_update
>;

typedef trie
<
    string,
    null_type,
    trie_string_access_traits<>,
    pat_trie_tag,
    trie_prefix_search_node_update
>
pref_trie; /// insert(), prefix_range()

template<class T,class U>
ostream&operator<<(ostream&out,pair<T,U> p)
{
    return out<<"("<<p.x<<","<<p.y<<")";
}

template<class Iter>
struct rng
{
    Iter from,to;
    rng(Iter from,Iter to):from(from),to(to){}
};

template<class Iter>
rng<Iter> range(Iter from,Iter to)
{
    return rng<Iter>(from,to);
}

template<class Iter>
ostream&operator<<(ostream&out,rng<Iter> r)
{
    out<<distance(r.from,r.to)<<":";
    for(Iter i=r.from;i!=r.to;i++)
        out<<" "<<*i;
    return out;
}

ll ppow(ll x,ll y,ll mod)
{
    ll res=1;
    while(y)
    {
        if(y&1)
            res=res*x%mod;
        y>>=1;
        x=x*x%mod;
    }
    return res;
}

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

    int n;
    cin>>n;
    int s=-n;
    loop(n)
    {
        int t;
        cin>>t;
        s+=t;
    }
    cout<<s;

    IFD(cout<<"\n\nTIME: "<<runtime<<" sec\n\n";)
}


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

listA=[]

try:
    listA = list(input().split())
    #listA<-[1,2,2,3,1]
    #print(listA)
    #ここに逐次処理を書けばいいと思う。
except:
    quit();
    #または、quit(),os.exit()をして止める。


listA.sort()


for i in range(len(listA)-1):
    if listA[i] == listA[i+1]:
        print('NO')
        quit();

print('YES')

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

using namespace std;

typedef unsigned int UI;
typedef long long LL;
typedef unsigned long long ULL;
typedef pair<int,int> pii;
typedef pair<LL, LL> pll;

#define mp make_pair
#define pb push_back
#define fir first
#define sec second

#define fo0(i,a,b) for(int i=(a);i<(b);i++)
#define fo1(i,a,b) for(int i=(a);i<=(b);i++)
#define fd0(i,a,b) for(int i=(a)-1;i>=(b);i--)
#define fd1(i,a,b) for(int i=(a);i>=(b);i--)
#define mset(a,b) memset(a,(b),sizeof(a))
#define mcpy(a,b) memcpy(a,b,sizeof(a))

template<typename T> inline void in(T &x){x=0;int fl=1;char ch=getchar();while(ch<'0'||ch>'9')
{if(ch=='-')fl=-1;ch=getchar();}while(ch>='0'&&ch<='9'){x=(x<<1)+(x<<3)+ch-'0';ch=getchar();}x*=fl;}
template<typename T> void out(T x){if(x<0){putchar('-');x=-x;}if(x/10)out(x/10);putchar(x%10+'0');}
template<typename T> inline void outln(T x){out(x);putchar(10);}
template<typename T> inline void outsp(T x){out(x);putchar(' ');}
template<typename T> inline T gcd(T a, T b){T t;if(a>b){while(b){
t=b;b=a%b;a=t;}return a;}else{while(a){t=a;a=b%a;b=t;}return b;}}
template<typename T> inline T lcm(T a, T b){return a/gcd(a,b)*b;}

const int N = 505;

int n, m, a[N][N], id;
pair<pii, pii> ans[N*N];

int main(){
	in(n); in(m);
	fo1(i, 1, n)
		fo1(j, 1, m)
			in(a[i][j]);
	fo1(i, 1, n){
		fo0(j, 1, m){
			if(a[i][j] & 1){
				a[i][j+1]++;
				a[i][j]--;
				ans[++id] = mp( mp(i, j), mp(i, j+1) );
			}
		}
		if(i != n && a[i][m] & 1){
			a[i+1][m]++;
			a[i][m]--;
			ans[++id] = mp( mp(i, m), mp(i+1, m));
		}
	}
	outln(id);
	fo1(i, 1, id){
		outsp(ans[i].fir.fir);
		outsp(ans[i].fir.sec);
		outsp(ans[i].sec.fir);
		outln(ans[i].sec.sec);
	}
	return 0;
}

Measured memory_bytes: 7040
# 最大公約数を格納するリストを初期化
max_codiv = []
 
# 繰り返す数を入力
n = int(input())
 
import math
# 1からkまでの総当たりで最大公約数を調べる
for i in range(1, n+1):
	for j in range(1, n+1):
		i_j = math.gcd(i, j)
		for k in range(1, n+1):
			i_j_k = math.gcd(i_j, k)
			max_codiv.append(i_j_k)
print(sum(max_codiv))

Measured memory_bytes: 71656
a = [1,3,5,7,8,10,12]
b = [4,6,9,11]
c = [2]

x,y = map(int, input().split())

if x in a and y in a:
	print("Yes")
elif x in b and y in b:
	print("Yes")      
elif x in c and y in c:
	print("Yes")
else:
	print("No")
      


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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))

// mod
const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

// floating
typedef double Real;
const Real EPS = 1e-11;
#define EQ0(x) (abs(x)<EPS)
#define EQ(a,b) (abs(a-b)<EPS)
typedef complex<Real> P;

int n;
int c[525], s[525], f[525];

int main(){
  scanf("%d",&n);
  REP(i,n-1)scanf("%d%d%d",c+i,s+i,f+i);
  REP(i,n){
    ll ans = 0;
    FOR(j,i,n-1){
      CHMAX(ans, (ll)s[j]);
      while(ans%f[j])ans++;
      ans += c[j];
    }
    printf("%lld\n",ans);
  }
  return 0;
}


Measured memory_bytes: 256
using System;

namespace _2271
{
    class Program
    {
        static void Main(string[] args)
        {
            char[] x = new char[] { 'K', 'U', 'P', 'C' };
            int[] n = new int[4];
            string s = Console.ReadLine();
            for (int i = 0; i < s.Length; i++)
            {
                for (int j = 0; j < 4; j++)
                {
                    if (s[i] == x[j])
                    {
                        n[j]++;
                    }
                }
            }
            Array.Sort(n);
            Console.WriteLine(n[0]);
        }
    }
}

Measured memory_bytes: 9280
#include <bits/stdc++.h>
#include <iostream>
#include <math.h>
using namespace std;
 
int main() {
  string S;
  int a;
  cin >> S;
  if(S == "SUN"){a = 7;}
  if(S == "MON"){a = 6;}
  if(S == "TUE"){a = 5;}
  if(S == "WED"){a = 4;}
  if(S == "THU"){a = 3;}
  if(S == "FRI"){a = 2;}
  if(S == "SAT"){a = 1;}
  //SUN,MON,TUE,WED,THU,FRI,SAT
  cout << a << endl;
}

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

int main(){
    int N; cin >> N;
    int h[100100];
    for(int i=1; i<N+1; i++){
        cin >> h[i];
    }
    int ans[100100];
    ans[1]=0;
    ans[2]=abs(h[2]-h[1]);
    for(int i=3; i<=N; i++){
        int a=ans[i-2]+abs(h[i]-h[i-2]);
        int b=ans[i-1]+abs(h[i]-h[i-1]);
        ans[i] = min(a,b);
    }
    cout << ans[N] << endl;
}

Measured memory_bytes: 1024
<?php
//マップを読み込む。左上から一マスずつ読み込んでいく($map['y']['x'])。（分岐）もし該当マスが陸だったら
//深さ優先探索をかける。該当マスの上下左右($move = array(array(1,0),array(0,1),array(-1,0),array(0,-1)))
//を調査。そこにマスがあり且つ陸ならば、さらにそのマスから探索。調査した陸は海扱いして再訪を防ぐ。
//http://d.hatena.ne.jp/nanikaka/20110727/1311790350 参考

$file_handle = fopen('php://stdin', "r");
$move = array(array(1,0),array(0,1),array(-1,0),array(0,-1));

//dfs
function dfs($y, $x){
	global $move;
	global $map;

	$map[$y][$x] = 0;	//海扱い
	for ($i=0; $i<=3; $i++){	//上下左右を調査
		$y2 = $y + $move[$i][1];
		$x2 = $x + $move[$i][0];
		if (!empty($map[$y2][$x2]) && $map[$y2][$x2]==1){
			dfs($y2, $x2);
		}
	}
	return;
}

do {
	$num_island = 0;	//島の数
	$map = array();

	//map 読み込み
	for($y=0; $y<=11; $y++){
		$stdin = trim(fgets($file_handle));
		$map[$y] = str_split($stdin);	//ここで詰まった。今回はデリミターが無い（今までは半角スペース）
	}
	
	//一マスずつ探索
	for($y=0; $y<=11; $y++){
		for($x=0; $x<=11; $x++){
			if ($map[$y][$x] == 1){		//該当マスが陸だった場合
				dfs($y, $x);
				$num_island++;
			}
		}
	}

	//出力
	echo $num_island;
	echo PHP_EOL;
	
	//データセットの終わりを判定
	$stdin = fgets($file_handle);
	$flag = ($stdin == PHP_EOL) ? 1 : 0;
} while ($flag === 1);

fclose($file_handle);

Measured memory_bytes: 6760
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <iomanip>
#include <stack>
#include <queue>
#include <numeric>
#include <map>
#include <unordered_map>
#include <set>
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(x) x.begin(), x.end()
#define pb push_back
#define mod 1000000007
using ll = long long;
using namespace std;

int main(){
  int N,A,B;
  cin >> N >> A >> B;
  int ans = 0;
  for(int i=1;i<=N;i++){
    string s = to_string(i);
    int sum = 0;
    rep(j,(int)s.size()){
      sum += (s[j] - '0');
    }
    if(A<=sum && sum<=B) ans += i;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(void){

    int H,W,a[1000][2],i=0,j=0,x=0,k;

    while(1){
        scanf("%d %d", &a[x][0], &a[x][1]);
        if(a[x][0]==0&&a[x][1]==0)break;
        x++;
    }

    for(i=0;i<x;i++){
        for(j=0;j<a[i][0];j++){
            for(k=0;k<a[i][1];k++){
                printf("#");
            }
            printf("\n");
        }
        printf("\n");
    }

    return 0;
}


Measured memory_bytes: 2036
#include <iostream>

 int main() {

	 int x;
	 int y;
	 int z;
	 int n = 0;

	 std::cin >> x >> y >> z;

	 x -= z;

	 while (true) {
		 x -= y;
		 x -= z;
		
		 if (x < 0) {
			 break;
		 }

		 n += 1;
	 }

	 std::cout << n << std::endl;

	 return 0;

}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <array>
#include <set>
#include <map>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cstdint>
#include <cassert>
#include <random>

using namespace std;
using i64 = int64_t;
using i32 = int32_t;
template<class T, class U> void init_n(vector<T>& v, size_t n, U x) 
{ v = vector<T>(n, x); }
template<class T> void init_n(vector<T>& v, size_t n) { init_n(v, n, T()); }
template<class T> void read_n(vector<T>& v, size_t n, size_t o = 0) 
{ v = vector<T>(n+o); for (size_t i=o; i<n+o; ++i) cin >> v[i]; }
template<class T> void read_n(T a[], size_t n, size_t o = 0)
{ for (size_t i=o; i<n+o; ++i) cin >> a[i]; }
template<class T> T gabs(const T& x) { return max(x, -x); }
#define abs gabs

template<class F>
i64 bisect(i64 l, i64 r, F f) { // (l, r]
  if (r - l <= 1) return r;
  i64 m = l + (r - l) / 2;
  return f(m) ? bisect(l, m, f) : bisect(m, r, f);
}

template<class F>
i64 bisect_left(i64 l, i64 r, F f) {
  return bisect(l, r, [=](i64 x) { return !f(x); }) - 1;
}


i64 n, k;
vector<i64> a, f;
int main() {
  cin >> n >> k;
  read_n(a, n);
  read_n(f, n);

  sort(begin(a), end(a));
  sort(begin(f), end(f), greater<i64>());

  i64 ans = bisect(-1, 1ll << 45, [&](i64 x) {
    i64 res = 0;
    for (int i = 0; i < n; ++i) {
      i64 t = (f[i] * a[i] - x + f[i] - 1) / f[i];
      res += max(i64(0), t);
    }
    cerr << x << '\t' << res << endl;
    return res <= k;
  });
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3328
import java.util.Arrays;
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[n];
        long ans = 0;
        int min = 1500000000;
        int hucnt = 0;
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
            if (a[i] < 0) {
                hucnt++;
            }

            a[i] = Math.abs(a[i]);
            if (min > a[i]) {
                min = a[i];
            }
            ans += a[i];
        }
        Arrays.sort(a);
        if (hucnt % 2 == 1) {
            ans = ans - a[0] * 2;
        }
        System.out.println(ans);
        sc.close();
    }
}

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

int main() {
  string s;
  cin >> s;
  bool ans = false;
  rep(i,3){
    if(s[i] == s[i+1]) ans=true;
  }
  if(ans) cout << "Bad" << endl;
  else cout << "Good" << endl;
}


Measured memory_bytes: 3624
n, q = gets.split.map(&:to_i)
graph = Array.new(n) { [] }

(n - 1).times do
  a, b = gets.split.map(&:to_i)
  graph[a - 1] << b - 1
  graph[b - 1] << a - 1
end

counts = Array.new(n) { 0 }
q.times do
  p, x = gets.split.map(&:to_i)
  counts[p - 1] += x
end

queue = [0]
answer = [counts[0]]

until queue.empty?
  current = queue.shift
  graph[current].each do |child|
    next if answer[child]

    answer[child] = answer[current] + counts[child]
    queue << child
  end
end

puts answer.join(' ')


Measured memory_bytes: 27388
#include <iostream>
#include <limits>
#include <map>
#include <set>
#include <tuple>
#include <vector>

template <class... Ts> using tuple_t = std::tuple<Ts...>;
template <class T, class U> using map_t = std::map<T, U>;
template <class T, class U> using pair_t = std::pair<T, U>;
template <class T> using vector_t = std::vector<T>;
template <class T> using set_t = std::set<T>;

int min(const vector_t<int> &nums) {
  int min_ = std::numeric_limits<int>::max();
  for (auto &i : nums)
    if (min_ > i)
      min_ = i;
  return min_;
}

int max(const vector_t<int> &nums) {
  int max_ = std::numeric_limits<int>::min();
  for (auto &i : nums)
    if (max_ < i)
      max_ = i;
  return max_;
}

int main() {
  int A,B;
  std::cin>>A>>B;
  std::cout<<(A-1)*(B-1)<<std::endl;
  return 0;
}


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

#define ll long long int
#define endl "\n"
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

//const int MOD = 1e9 + 7;
//typedef unsigned long long u64;
//const double pi = 3.141592653589793238460;
const int MAX = 1e5 + 5;
ll arr[MAX];

int main()
{
	IOS
	int t = 1;
	//cin >> t;
	while(t--)
	{
		int n;
		cin >> n;
		int ct0 = 0, ct = 0;
		for(int i = 1; i <= n; i++)
		{
			cin >> arr[i];
			if(arr[i] == 0)ct0++;
			else if(arr[i] > 1000000000)ct++;
		}
		if(ct0 > 0)cout << "0\n";
		else if(ct > 1)cout << "-1\n";
		else
		{
			sort(arr + 1, arr + n);
			ll prod = 1, chck = 1e18;
			for(int i = 1; i <= n; i++)
			{
				if(arr[i] * prod > chck)
				{
					prod = -1;
					break;
				}
				else
					prod = arr[i] * prod;
			}
			cout << prod << endl;
		}
	}
	return 0;
}


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

int main()
{
	int H[10],temp,it;
	for(int i = 0;i < 10;i++)
		cin >> H[i];
	for(int j = 0;j < 3;j++){
		temp = 0;
		for(int i = 0;i < 10;i++)
			if(temp < H[i]){
				temp = H[i];
				it = i;
			}
		cout << temp << endl;
		H[it] = 0;
	}
	return 0;
}

Measured memory_bytes: 1160
/*
ID: hzhu7271 
LANG: C++
TASK: 
*/
#include <bits/stdc++.h>

using namespace std;
using ll = long long;

/* FILE IO */
void setIO(string filename = "") {
    ios_base::sync_with_stdio(0); cin.tie(0);
    if ((int)filename.size()) { /* USACO */
        freopen((filename+".in").c_str(), "r", stdin);
        freopen((filename+".out").c_str(), "w", stdout);
    }
}

int N,K;
ll a[100000];
ll dp[100000];

int main(){
    setIO();
    cin >> N >> K;
    for(int i=0;i<N;++i)
        cin >> a[i];
    for(int i=1;i<=K;++i){
        dp[i]=abs(a[i]-a[0]);
    }
    for(int i=K+1;i<N;++i){
        ll small=1e18;
        for(int j=i-1,cnt=0;cnt<K;--j,++cnt){
            small=min(small,abs(a[i]-a[j])+dp[j]);
        }
        dp[i]=small;
    }
    cout << dp[N-1] << endl;
    return 0;
}


Measured memory_bytes: 5112
package main

import (
	"fmt"
	"math"
)

const MOD = 1000000007

func ModAdd(a, b int64) int64 {
	return (a + b) % MOD
}

func ModMul(a, b int64) int64 {
	return a * b % MOD
}

func ModSub(a, b int64) int64 {
	r := (a%MOD - b%MOD) % MOD
	if r < 0 {
		r += MOD
	}
	return r
}

func ModDiv(a, b int64) int64 {
	return a % MOD * ModInv(b) % MOD
}

func ModPow(a, n int64) int64 {
	var r int64 = 1
	for n > 0 {
		if n&1 == 1 {
			r = r * a % MOD
		}
		a = a * a % MOD
		n >>= 1
	}
	return r
}

func ModInv(a int64) int64 {
	var b, u, v int64 = MOD, 1, 0
	for b > 0 {
		t := a / b
		a -= t * b
		a, b = b, a
		u -= t * v
		u, v = v, u
	}
	u %= MOD
	if u < 0 {
		u += MOD
	}
	return u
}

type Q struct {
	idx, value int
	index      int
}

type QS []*Q

func (p QS) Len() int           { return len(p) }
func (p QS) Less(i, j int) bool { return p[i].value > p[j].value }
func (pq QS) Swap(i, j int) {
	pq[i], pq[j] = pq[j], pq[i]
	pq[i].index = i
	pq[j].index = j
}

func (pq *QS) Push(x interface{}) {
	n := len(*pq)
	item := x.(*Q)
	item.index = n
	*pq = append(*pq, item)
}

func (pq *QS) Pop() interface{} {
	old := *pq
	n := len(old)
	item := old[n-1]
	old[n-1] = nil  // avoid memory leak
	item.index = -1 // for safety
	*pq = old[0 : n-1]
	return item
}
func main() {
	var R int
	fmt.Scan(&R)
	fmt.Println(float64(R) * 2 * math.Pi)
}


Measured memory_bytes: 1756
#include <cstdio>
#include <utility>
using namespace std;

#define gcu getchar_unlocked
#define pcu putchar_unlocked
#define _il inline
#define _in _il int in
#define _sc _il bool scan
_in(int c){int n=0;bool m=false;if(c=='-')m=true,c=gcu();
	do{n=10*n+(c-'0'),c=gcu();}while(c>='0');return m?-n:n;} //&&c<='9'
_in() {return in(gcu());}
_sc(int &n){int c=gcu();return c==EOF?false:(n=in(c),true);}
_sc(char &c){c=gcu();gcu();return c!=EOF;}
//_sc(string &s){int c;s="";
//	for(;;){c=gcu();if(c=='\n'||c==' ')return true;else if(c==EOF)return false;s+=c;}}
template <typename H,typename... T> _sc(H &h, T&&... t){return scan(h)&&scan(t...);}
#define _vo _il void out
#define _vl _il void outl
template <typename T>
_vo(T n){static char buf[20];char *p=buf;
	if(n<0)pcu('-'),n*=-1;if(!n)*p++='0';else while(n)*p++=n%10+'0',n/=10;
	while (p!=buf)pcu(*--p);}
_vo(const char *s){while(*s)pcu(*s++);}
_vo(char c){pcu(c);}
//_vo(string &s){for (char c: s) pcu(c);}
template <typename H,typename... T> _vo(H&& h, T&&... t){out(h);out(move(t)...);}
//template <typename T> _vo(vector<T> &v){for(T &x:v)out(&x == &v[0]?"":" "),out(x);out('\n');}
_vl(){out('\n');}
template <typename... T> _vl(T&&... t){out(move(t)...);outl();}

int main() {
	int s[] = {6, 4, 3, 2}, c = 4;
	while (c--)
		outl((s[in() - 1] * 1000) * in());
}


Measured memory_bytes: 2552
n,y = gets.chomp.split(" ").map(&:to_i)
for i in 0..n
  for j in 0..n-i
    if i*9000+j*4000+n*1000 == y
      print i,"\s",j,"\s",n-i-j,"\n"
      exit
    end
  end
end
puts "-1 -1 -1"

Measured memory_bytes: 1788
#include<bits/stdc++.h>
using namespace std;
#define num 1000000007
//#define num 998244353
#define REP(i,a,n) for(ll i=a;i<n;i++)
#define inarr(i,a,n,A) for(ll i=a;i<n;i++) { cin>>A[i]; }
#define vll vector<long long>
#define pii pair <int,int>
#define pll pair<long long, long long>
#define vpii vector< pair <int,int>>
#define vpll vector< pair<long long, long long>>
#define max(a,b) ((a>b)?a:b)
#define min(a,b) ((a>b)?b:a)
#define max3(a,b,c) ((a>b)?(a>c)?a:c:(b>c)?b:c)
#define min3(a,b,c) ((a<b)?(a<c)?a:c:(b<c)?b:c)
#define avg(a,b) ((a)+(b))/2
#define push push_back
#define pop pop_back
#define mp make_pair
#define sf int flag=0     //Remember semicolon
#define assmin(a,b) if(b<=a) { a=b; }
#define assmax(a,b) if(b>=a) { a=b; }
#define f first
#define s second
#define fix(f,n) std::fixed<<std::setprecision(n)<<f
typedef long long ll;
ll mod(ll a, ll b)
{
	if(a%b<0)
	{
		return a%b + b;
	}
	return a%b;
}
 
 
ll mod_exp(ll a, ll b, ll c)
{
	ll res=1;
	a=a%c;
	while(b>0)
	{
		if(b%2==1)
		{
			res=(res*a)%c;
		}
		b/=2;
		a=(a*a)%c;
	}
	return res;
}
ll mymod(ll a,ll b)
{
    return ((a%b)+b)%b;
}
bool prime[3001];
void SieveOfEratosthenes() 
{ 
    memset(prime, true, sizeof(prime)); 
    prime[1]=false;
    for (int p=2; p*p<=3000; p++) 
    { 
        if (prime[p] == true) 
        { 
            for (int i=p*p; i<=3000; i += p) 
                prime[i] = false; 
        } 
    } 
}
ll powe[100005];
void power()
{
    powe[0]=1;
    REP(i,1,100005)
    {
        powe[i]=mymod(2*powe[i-1],num);
    }
}
ll gcdExtended(ll,ll,ll *,ll *);
ll modInverse(ll a, ll m) 
{ 
    ll x, y; 
    ll g = gcdExtended(a, m, &x, &y); 
        ll res = (x%m + m) % m;
        return res;
} 
ll gcdExtended(ll a, ll b, ll *x, ll *y) 
{ 
    if (a == 0) 
    { 
        *x = 0, *y = 1; 
        return b; 
    } 
    ll x1, y1; 
    ll gcd = gcdExtended(b%a, a, &x1, &y1); 
    *x = y1 - (b/a) * x1; 
    *y = x1; 
    return gcd; 
} 
ll fact[100005];
void factorial()
{
    fact[0]=1;
    REP(i,1,100002)
    {
        fact[i]=mymod(i*fact[i-1], num);
    }
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    char c;
    cin>>c;
    int x=(int)c;
    x++;
    char d=(char)x;
    cout<<d<<"\n";
	return 0;
}

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

int main() {
    int n;
    cin >> n;
    int a[n], b[n];
    for(int i = 0; i < n; i++) {
        cin >> a[i];
        b[i] = a[i];
    }

    sort(b, b + n);
    int max = b[n - 1];
    int max_2 = b[n - 2];

    bool isTwo;
    if(max == max_2) isTwo = true;
    else isTwo = false;

    for(int i = 0; i < n; i++) {
        if(a[i] == max && !isTwo) cout << max_2 << endl;
        else cout << max << endl;
    }

    return 0;
}

Measured memory_bytes: 3200
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n,c,p,i;
  cin>>n;
  vector<int> a(n);
  for (i=0;i<n;i++) {
    cin>>a.at(i);
  }
  p=1;
  c=1;
  while (a.at(p-1)!=2 && c<n) {
    p=a.at(p-1);
    c++;
  }
  if (c<n) cout<<c<<endl;
  else cout<<-1<<endl;
}


Measured memory_bytes: 3756
### SNIPPET
  # n = gets.split.map(&:to_i)
  # array = n.times.map { gets.split.map(&:to_i) }
  # [].all?(&:even?)
  # a = [*1..m].repeated_combination(n).to_a
  # [1,2,3,4,5].select { |num| num.even? }  # => [2, 4]
  # ["a","a","b"].group_by(&:itself).map{|k,v| [k, v.count]}.to_h #=> {"a"=>2, "b"=>1}
  # 切り捨て: .floor(2).to_f ,切り上げ： .ceil(2).to_f,四捨五入: round(2)
  # 3.upto(6) do |i|, 6.downto(3) do |i|
  # 公約数125.gcd(100)、公倍数125.lcm(100)
  # PI = Math::PI
  # 高さ = a * Math.sin(w / 180.0 * Math::PI), 底辺 = a * Math.cos(w / 180.0 * Math::PI)
  def chmax(a, b) a > b ? a : b end
  # INF = Float::INFINITY
  # def chmin(a, b) a < b ? a : b end

n = gets.to_i
a = gets.split.map(&:to_i)

fumi = 0
dp = Array.new(n+1)
dp[0] = a[0]
1.upto(n) do |i|
  dp[i] = chmax(dp[i-1], a[i-1])
  if dp[i] - a[i-1] >= 0
    fumi += dp[i] - a[i-1]
  end
end
puts fumi


Measured memory_bytes: 29452
import java.util.*;

public class Main{
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		
		PriorityQueue<Long> queue = new PriorityQueue<>(Collections.reverseOrder());
		
		for(int i = 0; i < N; i++){
			queue.add(sc.nextLong());
		}
		sc.close();
		
		for(int i = 0; i < M; i++) {
			long x = queue.poll();
			x /= 2;
			queue.add(x);
		}
		
		long sum = 0;
		for(int i = 0; i < N; i++) {
			sum += queue.poll();
		}
		System.out.println(sum);
	}
}

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

#define LL long long
typedef pair<int, int> pii;

template< typename T > inline void read(T &x)
{
    static char _c;
    static bool _f;

    x = 0;
    _f = 0;
    _c = getchar();

    while(_c < '0' || '9' < _c) {if(_c == '-') _f = true; _c = getchar();}
    while('0' <= _c && _c <= '9') {x = (x << 1) + (x << 3) + (_c & 15); _c = getchar();}
    if(_f) x = -x;
}

template < typename T > inline void Min(T &x, T y) {if(y < x) x = y;}
template < typename T > inline void Max(T &x, T y) {if(x < y) x = y;}


#define lowbit(x) ((x) & -(x))
#define lson l,mid,id<<1
#define rson mid+1,r,id<<1|1
#define ls id<<1
#define rs id<<1|1
#define MID(l,r) ((l)+(((r)-(l))>>1))
#define fi first
#define se second
#define mk make_pair
#define pb push_back

const int INF = 0x3f3f3f3f;
const double pi = (double) acos(-1.0);
const double eps = (double) 1e-8;
const int e5 = (int) 1e5 + 5;
//const int MOD = (int) 1e9 + 7;
const int MOD = (int) 998244353;
//int MOD = 998244353;

inline int sig(double x) {return x < -eps ? -1 : eps < x;}
LL fp(LL a, LL n, LL mod = MOD)
{
    if(n < 0) a = fp(a, mod - 2, mod), n = -n;
    LL res = 1; for(; n; n >>= 1, a = a * a % mod) if(n & 1) res = res * a % mod; return res;
}

struct Mint
{
    int x;
    Mint() {x = 0;}
    Mint(int _x): x(_x) {if(x < 0 || x >= MOD) x = (x % MOD + MOD) % MOD;}
    Mint(LL _x): x(_x) {if(x < 0 || x >= MOD) x = (x % MOD + MOD) % MOD;}
    Mint operator - () const{
        return Mint(MOD - x);
    }
    Mint operator + (const Mint &rhs) const{
        return Mint(x + rhs.x >= MOD ? x + rhs.x - MOD : x + rhs.x);
    }
    Mint operator - (const Mint &rhs) const{
        return Mint(x - rhs.x < 0 ? x - rhs.x + MOD : x - rhs.x);
    }
    Mint operator * (const Mint &rhs) const{
        return Mint((LL)x * rhs.x % MOD);
    }
    Mint operator / (const Mint &rhs) const{
        return Mint(x * fp(rhs.x, -1) % MOD);
    }
    Mint& operator += (const Mint &rhs) {
        x += rhs.x; if(x >= MOD) x -= MOD; return *this;
    }
    Mint& operator *= (const Mint &rhs) {
        x = ((LL)x * rhs.x) % MOD; return *this;
    }
    bool operator == (const Mint &rhs) const{
        return x == rhs.x;
    }
    bool operator != (const Mint &rhs) const{
        return x != rhs.x;
    }
    friend ostream& operator << (ostream &out, const Mint &rhs){
        return out << rhs.x;
    }
    friend istream& operator >> (istream &in, Mint &rhs){
        return in >> rhs.x;
    }
};


const int maxn = (int) 2e5 + 20;
const int maxm = (int) 1e6 + 20;


void work()
{
    double x;
    cin >>x;
    printf("%.12f\n", 2 * pi * x);
}

int main(int argc, char **argv)
{
#ifdef yukihana0416
freopen("in.txt", "r", stdin);
//freopen("out.txt", "w", stdout);
#endif // yukihana0416
//    get_prime();
//    pre();
    int tc = 1;
//    read(tc);
    for(int ca = 1; ca <= tc; ca++)
    {
//        printf("Case #%d: ", ca);
        work();
    }
    return 0;
}


Measured memory_bytes: 3788
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <sstream>
#include <string>
#include <vector>
using namespace std;
int main(void){
    int t, x;
    cin >> t >> x;
    cout << fixed << setprecision(10) << t / static_cast<double>(x);
}

Measured memory_bytes: 256
//

fun main() {
    abc173b()
}

fun abc173b() {
    val n = readLine()!!.toInt()
    val map = mutableMapOf("AC" to 0, "WA" to 0, "RE" to 0, "TLE" to 0)
    repeat(n) {
        val result = readLine()!!
        map[result] = map.getOrDefault(result, 0) + 1
    }
    println("AC x ${map["AC"]}")
    println("WA x ${map["WA"]}")
    println("TLE x ${map["TLE"]}")
    println("RE x ${map["RE"]}")
}


Measured memory_bytes: 57704
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,n) for(int i=0;i<n;i++)
#define why(n,x) int n;while(cin >>n,n!=x)
#define iFOR(i,x,n)for(int i=x;i<n;i++)
#define unless(flg) if ( !(flg) )
#define read cin<<
#define echo cout<<
#define fin <<'\n'
#define __ <<" "<<
#define ___ <<" "
#define bash push_back
#define ALL(x) x.begin(),x.end()
#define SWAP(a,b) ((a != b) && (a += b,b = a - b,a -= b))
#define cinf(n,x) for(int UNCH=0;UNCH<(n);UNCH++) cin >> x[UNCH];
#define fcin(n,x) for(int UNCH=1;UNCH<=(n);UNCH++) cin>> x[UNCH];
#define memmin(x) memset((x),-1,sizeof((x)))
#define memzer(x) memset((x), 0,sizeof((x)))
#define meminf(x) memset((x),0x3f,sizeof((x)))
#define int long long
typedef long long ll;
typedef pair < int , int >  pii;
typedef vector < int > vit;
typedef map < string , int > mstit;
typedef vector < pii > vpi ;
typedef greater < pii > gpi;
typedef priority_queue < pii , vpi , gpi > dijk ;
static const signed int INF = 0x3f3f3f3f;
static const signed long long LINF = 0x3f3f3f3f3f3f3f3fLL;
static const signed int SMOD = 1000000007;
static const signed int NMOD = 1000000009;
static const signed int dx[]={1,0,-1,0,1,1,-1,-1};
static const signed int dy[]={0,-1,0,1,-1,1,-1,1};

bool inside(int x,int y,int w,int h){return (x>=0 && y>=0 && x<w && y<h);}
template<class T>T abs(T &x){return x<0 ? -x : x;}
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
int qp(int a,ll b,int mo){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
int gcd(int a,int b){return b?gcd(b,a%b):a;}


signed main(){
  int n;
  cin >> n;
  int ans = 0;
  FOR(i,n)
    ans+=i+1;
  cout << ans fin;
  return 0;
}

  

struct xyz{ xyz(){ cin.tie(0), ios::sync_with_stdio(false); cout <<fixed<<setprecision(12);};}xyzzy;



Measured memory_bytes: 256
object Main {

  import java.util.Scanner
  import java.lang.String

  def main(args: Array[String]): Unit = {
    val scanner = new Scanner(System.in)
    val str :String = scanner.next()

    var count : Int = 0
    if(str.charAt(0) == '1')
      count += 1;
    if(str.charAt(1) == '1')
      count += 1;
    if(str.charAt(2) == '1')
      count += 1;
    println(count)
  }
}


Measured memory_bytes: 25784
import sys


def log(s):
    # print("| " + str(s), file=sys.stderr)
    pass


def output(x):
    print(x, flush=True)


def input_ints():
    return list(map(int, input().split()))


def main():
    t = input()
    print("A" if t.isupper() else "a")


main()


Measured memory_bytes: 9072
import math
def main():
    n,d = tuple([int(t)for t in input().split()])

    a = [tuple([int(t)for t in input().split()])for _ in [0]*n]

    ans = 0
    for x,y in a:
        if x**2+y**2<=d**2:
            ans+=1

    print(ans)

if __name__ == "__main__":
    main()

Measured memory_bytes: 37696
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef double db;
typedef vector <ll> vll;
typedef pair <ll, ll> pll;
#define pb push_back
#define mp make_pair
#define MAX 1000000
#define mod 1000000007
#define all(_) _.begin(), _.end()
#define F first
#define S second
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
vll g[MAX];
bool vis[MAX];
ll ans = 1;
void dfs(ll cur, ll k, ll d, ll ck, ll nbv)
{
    vis[cur] = true;
    if(d > 2 && d > 0)
        k++;
    // cout << cur << ' ' << k << endl;
    ans = (ans * k) % mod;
    if(k)
    {
        bool p = true;
        ll nv = 0;
        for(auto x : g[cur])
        {
            if(!vis[x])
            {
                dfs(x, k - 1 + nbv, d + 1, ck, nv);
                nv++;
                k--;
            }
        }
    }
}
int main()
{
    ios_base :: sync_with_stdio(false);
    cin.tie(NULL), cout.tie(NULL);
    ll n, i, u, v, k;
    cin >> n >> k;
    for(i = 0; i < n - 1; i++)
    {
        cin >> u >> v;
        g[u].pb(v);
        g[v].pb(u);
    }
    dfs(1, k, 0, k, 0);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 32768
/*
author: Apoorv Singh
*/
 
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace std;
using namespace __gnu_pbds;
 
typedef vector <int> vi;
typedef pair <int, int> pii;
typedef vector <long long> vll;
typedef pair <long long, long long> pll;
#define pb push_back   
#define all(c) c.begin(), c.end()
#define For(i, a, b) for (long long i = a; i < b; ++i)
#define Forr(i, a, b) for (long long i = a; i > b; --i)
#define um unordered_map
#define F first
#define S second
#define ll long long 
#define endl "\n"
#define min(a,b) (a < b ? a : b)
#define max(a,b) (a > b ? a : b)
#define fast_io() ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

#define TRACE
#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
	cout << name << " : " << arg1 << endl;  
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
	const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

template <class X>
void printarr(X arr[], int n) {
	for (int i = 0; i < n; ++i)
		cout << arr[i] << ' ';
	cout << endl;
}
 
template <class T, class cmp = less<T>> using ordered_set = tree<T, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
 
ll modulo = 1e9 + 7;

ll fpow(ll a, ll n) {
	ll ans = 1;
	while (n) {
		if (n&1) ans = (ans*a)%modulo;
		a = (a*a)%modulo; n = n >> 1;
	}
	return ans;
}

void solve() {
	int a;
	cin >> a;
	cout << a + a*a + a*a*a << endl;			
}

int main() {
	fast_io();
	int t = 1;
	// cin >> t;
	while (t--) solve();
	return 0;
}

Measured memory_bytes: 3652
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<utility>
#include<cmath>
#include<climits>
#include<queue>
#include<stack>
#include<numeric>
#include<set>
#include<iomanip>
#include<map>
#include<type_traits>
#include<tuple>
#include<deque>
#include<cassert>
#include<bitset>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define rep(i,N) for(ll (i)=0;(i)<(N);(i)++)
#define chmax(x,y) x=max(x,y)
#define chmin(x,y) x=min(x,y)
const int mod = 1000000007;

struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

vector<pair<ll, int>> factorize(ll n) {
  vector<pair<ll, int>> res;
  for( ll i = 2; i * i <= n; ++i){
    if(n % i) continue;
    res.emplace_back(i, 0);
    while(n%i == 0) {
      n /= i;
      res.back().second++;
    }
  }
  if(n != 1) res.emplace_back(n, 1);
  return res;
}

struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
};

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

  auto primes = factorize(m);
  mint ans = 1;

  combination comb(200100);

  rep(i, primes.size()) {
    ans *= comb(n + primes[i].second - 1, primes[i].second);
  }
  cout << ans << endl;
}


Measured memory_bytes: 3328
#include<stdio.h>
#include<algorithm>

using namespace std;

int main(){
	int n,a,b,c;
	int m=0;
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		int a[3];
		for(int j=0;j<3;j++)scanf("%d",&a[j]);
		std::sort(a,a+3);
		
		int d = 40;
		if(a[0]>d || a[1]>d || a[2]>d)puts("hogehogehoge");
		
		if(a[0]*a[0]+a[1]*a[1] == a[2]*a[2]){
			puts("YES");
		}else{
			puts("NO");
		}
	}
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
typedef int64_t Int;

int main(){ 
    string N;
    int K, l;
    cin >> N >> K;

    l = N.size();
    vector<int> n(l);
    rep(i,l) n[i] = N.at(i) - '0';

    vector<vector<Int>> dp0(l+1,vector<Int>(K+1, 0)), dp1(l+1,vector<Int>(K+1, 0));
    // dp0[i][j] : 上からi桁目まで決めて、0でない桁がj個、Nより必ず小さい、ようなものの個数
    // dp1[i][j] : 上からi桁目まで決めて、0でない桁がj個、Nより小さいかはまだ確定していない、ようなものの個数

    dp0[1][1] = n[0] - 1;
    dp1[1][1] = 1;
    dp0[1][0] = 1;

    rep1(i,l-1) rep(j,K+1) {
        if (n[i] != 0) {
            if (j > 0) dp0[i+1][j] = 9 * dp0[i][j-1] + dp0[i][j] + dp1[i][j-1] * (n[i] - 1) + dp1[i][j];
            else dp0[i+1][j] = dp0[i][j] + dp1[i][j];
        }
        else {
            if (j > 0) dp0[i+1][j] = 9 * dp0[i][j-1] + dp0[i][j];
            else dp0[i+1][j] = dp0[i][j];
        }

        if (n[i] != 0) {
            if (j > 0) dp1[i+1][j] = dp1[i][j-1];
        }
        else dp1[i+1][j] = dp1[i][j];

    }

    cout << dp0[l][K] + dp1[l][K] << endl;
}


Measured memory_bytes: 3644
s=input()

c1=0
c2=0

for i in range(len(s)):
    if i%2==0:
        c1+=1 if s[i]=='1' else 0
        c2+=1 if s[i]=='0' else 0
    else:
        c1+=1 if s[i]=='0' else 0
        c2+=1 if s[i]=='1' else 0
    
print(min(c1,c2))

Measured memory_bytes: 67600
/*|In The Name of Allah|*/

#include <bits/stdc++.h>

using namespace std;

const int N = 1e6+5;

long long n;

int main(){
    scanf("%lld" , &n);
    long long cnt = n / 11;
    cnt *= 2;
    n %= 11;
    if(n > 6){
        cnt += 2;
    } else if(n <= 6 && n > 0) {
        cnt ++;
    } else {
        cnt += 0;
    }
    printf("%lld\n" , cnt);
}


Measured memory_bytes: 256
import java.io.*;
import java.util.*;


class Main {
  private static int minOperations(String str1, String str2){
    int count = 0;
    for(int i=0;i<str1.length();i++){
      if(str1.charAt(i) != str2.charAt(i)) count++;
    }
    return count;
  }
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    
    String str1 = sc.nextLine();
    String str2 = sc.nextLine();
    
    System.out.println(minOperations(str1,str2));
  }
}


Measured memory_bytes: 33808