akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <bitset>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <complex>
#include <string.h>
#include <numeric>
using namespace std;

//#define int long long
#define reps(i,s,n) for(int (i)=(s);(i)<(n);++(i))
#define rep(i,n) reps(i,0,n)
#define rept(i,n) rep(i,(n)+1)
#define repst(i,s,n) reps(i,s,(n)+1)
#define reprt(i,n,t) for(int (i)=(n);(i)>=(t);--(i))
#define repr(i,n) reprt(i,n,0)
#define each(itr,v) for(auto &(itr):(v))
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define tmax(x,y,z) max(x,max(y,z))
#define tmin(x,y,z) min(x,min(y,z))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define ln '\n'
#define bln(i,n) (((i)==(n)-1)?'\n':' ')
#define dbg(x) cout<<#x" = "<<(x)<<ln<<flush
#define dbga(x,n) {cout<<#x" : ";for(int (i)=0;i<(n);++i){cout<<((x)[i])<<(i==((n)-1)?'\n':' ')<<flush;}}
#define zero(a) memset(a,0,sizeof(a))
#define unq(a) sort(all(a)),a.erase(unique(all(a)),a.end())

//typedef complex<double> P;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vst;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vector<int> > mat;

const ll inf = (ll)1e9+10;
const ll linf = (ll)1e18+10;
const ll mod = (ll)(1e9+7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};
const double eps = 1e-10;

ll mop(ll a,ll b,ll m=mod) {ll r=1;a%=m;for(;b;b>>=1){if(b&1)r=r*a%m;a=a*a%m;}return r;}
ll gcd(ll a,ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b) {return a*b/gcd(a,b);}
bool ool(int x,int y,int h,int w) {return((x<0)||(h<=x)||(y<0)||(w<=y));}
bool deq(double a,double b) {return abs(a-b)<eps;}

struct oreno_initializer {
	oreno_initializer() {
		cin.tie(0);
		ios::sync_with_stdio(0);
	}
} oreno_initializer;



int q, n, d;

signed main() {
	cin >> q;
	while (q--) {
		cin >> n >> d;
		priority_queue<int,vector<int>,greater<int>> p;
		p.push(d);
		rep(i,n-1) {
			int t = p.top(); p.pop();
			p.push(127), p.push(127^t);
		}
		int res = 0;
		while (!p.empty()) res += p.top(), p.pop();
		cout << res << endl;
	}
}


Measured memory_bytes: 256
n = int(input())
s = list(map(int, input().split()))
s.sort()
    
count = 0

for i in range(0, n-2):
    for j in range(i + 1, n-1):
        for k in range(j + 1, n):
            if s[i] < s[j] < s[k] and s[i] + s[j] > s[k]:
                count += 1
            else:
                continue

print(count)

Measured memory_bytes: 9200
n = int(input())
a = list(map(int,input().split()))

par = [0] * n
par[0] = a[0]

mod = 10**9 + 7

for i in range(1,n):
  par[i] = par[i-1] + a[i]
  par[i] = par[i] % mod
  
ans = 0
#print(par)

for i in range(n-1):
  ans += a[i] * (par[-1] - par[i])
  ans = ans % mod
  
print(ans%mod)

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

using namespace std;

using ll = long long;
using ld = long double;

using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vs = vector<string>;

typedef pair<ll, ll> P;

#define bit(n) (1LL << (n))

//#define int long long

#define all(v) v.begin(), v.end()
#define sortAl(v) sort(all(v))
#define sortAlr(v)          \
  sort(v.begin(), v.end()); \
  reverse(v.begin(), v.end())

#define rep(i, n) for (ll i = 0; i < n; i++)
#define REP(i, n) for (ll i = 1; i < n; i++)

#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define FORm(i, m) for (auto i = m.begin(); i != m.end(); i++)

template <class T>
inline void chmax(T &a, T b) {
  a = std::max(a, b);
}
template <class T>
inline void chmin(T &a, T b) {
  a = std::min(a, b);
}

#define mod (ll)(1e9 + 7)
#define INF LLONG_MAX

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);

  string s;
  cin >> s;

  ll n = s.size();

  vvll dp(4, vll(n));

  if (s[0] == '?') {
    dp[0][0] = 3;
  } else {
    dp[0][0] = 1;
  }

  if (s[0] == 'A' || s[0] == '?') {
    dp[1][0] = 1;
  }

  REP(i, n) {
    // 1こ前のdpを引き継ぎ
    rep(j, 4) {
      // ? なら3倍に
      if (s[i] == '?') {
        dp[j][i] = dp[j][i - 1] * 3;
      } else {
        dp[j][i] = dp[j][i - 1];
      }
    }

    rep(j, 3) {
      if (s[i] == 'A' + j || s[i] == '?') {
        dp[j + 1][i] += dp[j][i - 1];
      }
    }

    rep(j, 4) {
      dp[j][i] %= mod;
    }
  }

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

  return 0;
}


Measured memory_bytes: 4432
#include<bits/stdc++.h>
using namespace std;
#define Maxn 200005
int n,m,ai,bi,fa[Maxn],cnt = 1,ans = 1;
int find(int r){
	if (fa[r] != r)
		fa[r] = find(fa[r]);
	return fa[r]; 
}
int main(){
	cin >> n >> m;
	for(int i = 1;i <= n;i++)
		fa[i] = i;
	for(int i = 1;i <= m;i++){
		cin >> ai >> bi;
		int r1 = find(ai);
		int r2 = find(bi);
		fa[r1] = r2;
	}
	for(int i = 1;i <= n;i++)
		fa[i] = find(fa[i]);
	sort(fa + 1,fa + 1 + n);
	for(int i = 2;i <= n;i++)
		if (fa[i] == fa[i - 1]){
			cnt++;
			ans = max(ans,cnt);
		}
		else
			cnt = 1;
	cout << ans << endl;
	return 0;	
}

Measured memory_bytes: 10504
// 再帰的下向き構文解析

#include <iostream>
#include <string>
#include <algorithm>
#include <cctype>

using namespace std;

int expression(void);

string str;
int pos;

int factor(void){

  int num = 0;
  if( isdigit( str[pos] ) ){ // '0' <= str[pos] && str[pos] <= '9' 
    while( isdigit( str[pos] ) ){
      num *= 10;
      num += str[pos] - '0';
      pos++;
    }
    return num;
  }else if( str[pos] == '(' ){
    pos++;
    int res = expression();
    pos++; // ')' の分
    return res;
  }

}

int term(void){

  int res = factor();
  while(1){

    if( str[pos] == '*' ){
      pos++;
      res *= factor();
    }else if( str[pos] == '/' ){
      pos++;
      res /= factor();
    }else break;

  }
  return res;
}

int expression(void){

  int res = term();
  while(1){

    if( str[pos] == '+' ){
      pos++;
      res += term();
    }else if( str[pos] == '-' ){
      pos++;
    res -= term();
    }else break;

  }
  return res;
}

int main(void){

  int dn;
  cin >> dn;

  while(dn--){
    pos = 0;
    cin >> str;
    cout << expression() << endl;
  }
  return 0;
}

Measured memory_bytes: 1200
#include<bits/stdc++.h>
using namespace std;
int const MAXN=51;
char v[MAXN][MAXN];
int r, c;
int main(){
	cin>>r>>c;
	for(int i=0;i<r;i++)
		for(int j=0;j<c;j++)
			cin>>v[i][j];
	for(int i=0;i<r;i++)
		for(int j=0;j<c;j++)
			if(v[i][j]=='#'){
				if(i>0 && v[i-1][j]=='#') continue;
				if(i<r-1 && v[i+1][j]=='#') continue;
				if(j>0 && v[i][j-1]=='#') continue;
				if(j<c-1 && v[i][j+1]=='#') continue;
				return cout<<"No", 0;
			}				
	cout<<"Yes";
}

Measured memory_bytes: 384
#include<cstring>
#include<cstdlib>
#include<cstdio>
#include<cmath>
#include<iostream>
#define N 510
using namespace std;
int a[N][N],n,m,h,w;
bool b[N][N];
int main()
{
	scanf("%d%d%d%d",&n,&m,&h,&w);
	for(int i=1;i<=n-h+1;i++)
		for(int j=1;j<=m-w+1;j++)
		{
			if(b[i][j]) continue;
			for(int x=i;x<=i+h-1;x++)
				for(int y=j;y<=j+w-1;y++)
					b[x][y]=1;
			for(int x=i;x<=min(i+2*h-2,n);x++)
				for(int y=j;y<=min(j+2*w-2,m);y++)
					a[x][y]=1000;
			a[i+h-1][j+w-1]=-(h*w-1)*1000-1;
		}
	int sum=0;
	for(int i=1;i<=n;i++)
		for(int j=1;j<=m;j++)
			sum+=a[i][j];
	if(sum>0)
	{
		printf("Yes\n");
		for(int i=1;i<=n;i++)
		{
			for(int j=1;j<=m;j++) printf("%d ",a[i][j]);
			printf("\n");
		}
	}
	else printf("No\n");
	return 0;
}

Measured memory_bytes: 2816
#include<cstdio>
#define tin int
#define itn int
#define tni int
#define nit int
#define nti int
#define pritnf printf
#define scnaf scanf
#define retrun return
#define sizoef sizeof
#define ll long long
#define inl inline
#define br break
#define con continue
#define mst(a,b) memset(a,b,sizeof(a))
#define fora(x,a,b) for(x=a;x<=b;++x)
#define forb(x,a,b) for(x=a;x>=b;--a)
#define infa 0x3f3f3f3f
#define infb 0x7fffffff
#define infc 1061109567
#define infd 0x7f
using namespace std;
#define maxa 54
#define maxb 10004
#include<cstring>
#include<algorithm>

itn i,n,m,x[maxa]={0},sum=0;

bool cpe(tni a,tni b)
{
	return a>b;
}

itn main()
{
	scanf("%d%d",&n,&m);
	fora(i,1,n)
	{
		scanf("%d",&x[i]);
	}
	sort(x+1,x+1+n,cpe);
	fora(i,1,m)
	{
		sum+=x[i];
	}
	//
	pritnf("%d\n",sum);
	return 0;
}

Measured memory_bytes: 128
#include <stdio.h>
#include <stdlib.h>
#include <string.h>


int main(){
  int x,p=0,i;
  int stack[200];
  char s[100];

  while(scanf("%s",s) != EOF){
    if(s[0]=='\n') break;

    /* 演算子よりふたつの数を使う */
    if(s[0]=='+'){
      p--;
      /* printf("%d %d\n",stack[p],stack[p-1]); */
      x=stack[p-1]+stack[p];
      stack[p-1]=x;
      /* printf("%d %d\n",p,stack[p-1]); */
      
    }else if(s[0]=='-'){
      p--;
      x=stack[p-1]-stack[p];
      stack[p-1]=x;
    }else if(s[0]=='*'){
      p--;
      x=stack[p-1]*stack[p];
      stack[p-1]=x;
    }

    else{
      x=atoi(s);
      stack[p]=x;
      p++;
      /* for(i=0;i<p;i++) printf("%d\n",stack[i]); */
    }
  }

  printf("%d\n",stack[0]);

  return 0;
}



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

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

    vector<int> d(N);
    for (int i = 0; i < N; i++)
    {
        cin >> d[i];
    }

    sort(d.begin(), d.end());
    int first = d[N / 2 - 1];
    int second = d[N / 2];
    int ans = second - first;
    cout << ans << endl;
}


Measured memory_bytes: 640
def main():
    import sys
    input = sys.stdin.readline
    
    N = int(input())
    A = list(map(int,input().split()))
    
    one = 0
    two = 0
    four = 0
    for i in A:
        if i%4==0:
            four += 1
        elif i%2==0:
            two += 1
        else:
            one += 1
            
    if two == 0:
        if four+1 >= one:
            print("Yes")
        else:
            print("No")
    else:
        if four >= one:
            print("Yes")
        else:
            print("No")
    
    
main()

Measured memory_bytes: 58736
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var Arr=(input.trim()).split("\n");
for(var i=0;i<Arr.length;i++){
   var arr=Arr[i].split(" ");
   var a=(arr[1]-0)+(arr[2]-0);
   var b=(arr[1]-0)*200+(arr[2]-0)*300;
   console.log(arr[0]+" "+a+" "+b);
}

Measured memory_bytes: 7908
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define sz(x) int(x.size())
#define pb push_back
using ll=long long;

int main()
{
  double ensyu;
  ll r;
  cin >> r;
  ensyu = r * 6.28318530717958623200;
  cout << ensyu << endl;
  return 0;
}  
  

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

int main(){
  int n; cin >> n;
  vector<int> w(n + 1);
  for(int i = 0; i < n; i++){
    int a; cin >> a;
    w.at(i + 1) = w.at(i) + a;
  }
  int ans = 0;
  int dff = 100100100;
  for(int i = 1; i <= n; i++){
      dff = min(dff, abs((w.at(n) - w.at(i)) - (w.at(i) - w.at(0))));
  }  
  cout << dff << endl;
}            

Measured memory_bytes: 384
/* imports all std modules {{{*/
import
  std.algorithm,
  std.array,
  std.ascii,
  std.base64,
  std.bigint,
  std.bitmanip,
  std.compiler,
  std.complex,
  std.concurrency,
  std.container,
  std.conv,
  std.csv,
  std.datetime,
  std.demangle,
  std.encoding,
  std.exception,
  std.file,
  std.format,
  std.functional,
  std.getopt,
  std.json,
  std.math,
  std.mathspecial,
  std.meta,
  std.mmfile,
  std.net.curl,
  std.net.isemail,
  std.numeric,
  std.parallelism,
  std.path,
  std.process,
  std.random,
  std.range,
  std.regex,
  std.signals,
  std.socket,
  std.stdint,
  std.stdio,
  std.string,
  std.system,
  std.traits,
  std.typecons,
  std.uni,
  std.uri,
  std.utf,
  std.uuid,
  std.variant,
  std.zip,
  std.zlib;
/*}}}*/

/+---test
3 8
3 30
4 50
5 60
---+/
/+---test
5 5
1 1000000000
1 1000000000
1 1000000000
1 1000000000
1 1000000000
---+/
/+---test
6 15
6 5
5 6
6 4
6 6
3 5
7 2
---+/

void main(string[] args) {
  long N, W;
  readf(" %d %d ", &N, &W);

  struct Item { long w, v; }
  auto items = new Item[N];
  foreach (ref item; items) readf(" %d %d ", &item.w, &item.v);

  long[][] dp;
  dp.length = N+1;
  dp.each!((ref x) => x.length = W+1);

  foreach (n; 0..N) foreach (w; 0..W+1) {
    if (w >= items[n].w) {
      dp[n+1][w] = max(dp[n][w-items[n].w] + items[n].v, dp[n][w]);
    } else {
      dp[n+1][w] = dp[n][w];
    }
  }
  long ans;
  dp[$-1].each!(x => ans = ans.max(x));
  ans.writeln;
}


Measured memory_bytes: 82428
#define _GLIBCXX_DEBUG
#include <iostream>
#include <string>
using namespace std;

int main(void){
    string s;
    cin >> s;
    int n = s.size();
    int n2 = n/2;
    bool suc = true;
    for(int i=0; i<n; i++) if(s[i]!=s[n-1-i]){suc=false; break;}
    for(int i=0; i<n2; i++) if(s[i]!=s[n2-1-i]){suc=false; break;}
    for(int i=0; i<n2; i++) if(s[n2+1+i]!=s[n-1-i]){suc=false; break;}
    if(suc) cout << "Yes\n";
    else cout << "No\n";
    return 0;
}

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

int main() {
    int N; cin >> N;
    vector<int> A(N);
    for(auto &e : A) cin >> e;
    sort(A.begin(), A.end());
    vector<P> ans;
    for(int i = 1; i < N - 1; ++i) {
        if(A[i] < 0) {
            ans.emplace_back(A[N - 1], A[i]);
            A[N - 1] -= A[i];
        } else {
            ans.emplace_back(A[0], A[i]);
            A[0] -= A[i];
        }
    }
    ans.emplace_back(A[N - 1], A[0]);
    cout << A[N - 1] - A[0] << '\n';
    for(auto &[x, y] : ans) cout << x << " " << y << '\n';
    return 0;
}


Measured memory_bytes: 4692
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<(b);i++)
#define erep(i,a,b) for(int i=a;i<=(int)(b);i++)
#define per(i,a,b) for(int i=(b)-1;i>(a);i--)
#define eper(i,a,b) for(int i=((int)(a));i>=b;i--)
#define pb push_back
#define mp make_pair
#define INF (1<<30)-1
#define MOD 1000000007
using namespace std;
typedef long long ll;
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a/gcd(a, b)*b;}

ll q, h, s, d, n;
int main() {
 ios::sync_with_stdio ( false );
 cin.tie ( 0 );
    cin >> q >> h >> s >> d >> n;
    ll minh = min(8*q, 4*h);
    ll mins = min(minh, 2*s);
    ll mind = min(mins, d);
    ll mminh = min(4*q, 2*h);
    ll mmins = min(mminh, s);
    ll ans = n/2*mind+n%2*mmins;
    printf("%lld\n", ans);
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <random>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <numeric>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <sstream>
#include <bitset>
#include <cassert>
#include <fstream>
#include <queue>

#define len(X) ((int)(X).size())

#ifdef __LOCAL
	#define DBG(X) cout << #X << "=" << (X) << '\n';
#else
	#define DBG(X)
#endif

using std::cin;
using std::cout;
using std::vector;
using std::string;
using std::pair;
using std::swap;
using std::sort;
using std::lower_bound;
using std::unique;

using int64 = long long int;
using pii   = pair<int, int>;
using pii64 = pair<int64, int64>;

const int NIL = -1;
const int INF = (int)2e9;
const int64 INF64 = (int64)2e18;

void init_IO() {
	std::ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
}

template<typename T>
std::ostream& operator<<(std::ostream& os, const vector<T>& vec) {
	os << '[';
	int fst = 1;

	for(auto& elem: vec) {
		if(fst == 0) {
			os << ' ';
		}

		os << elem;
		fst = 0;
	}

	os << ']';
	return os;
}

void solve() {
	int n;
	cin >> n;

	vector<int> a(n);

	for(auto& elem: a) {
		cin >> elem;
	}

	sort(a.begin(), a.end());
	vector<int> b;

	for(int i = 0; i < n;) {
		int j = i;
	
		while(j + 1 < n && a[j + 1] == a[i]) {
			++j;
		}

		int cnt = j - i + 1;

		while(cnt > 2) {
			cnt -= 2;
		}

		b.push_back(cnt);
		i = j + 1;
	}

	int m = len(b);
	vector<int> pos;

	for(int i = 0; i < m; ++i) {
		if(b[i] == 2) {
			pos.push_back(i);
		}
	}

	DBG(b); DBG(pos);

	int l = 0, r = len(pos) - 1;

	while(r - l + 1 > 4) {
		--b[pos[l]];
		--b[pos[r]];

		++l;
		--r;
	}

	int sz = r - l + 1;

	if(sz == 2) {
		if(pos[r] - pos[l] > 1) {
			--b[pos[l]];
			--b[pos[r]];
		}
	} else if(sz == 3) {
		--b[pos[l]];
		--b[pos[r]];
	} else if(sz == 4) {
		for(int i = l; i <= r; ++i) {
			--b[pos[i]];
		}
	}

	DBG(b);

	int answ = 0;
	int cnt = 0;

	for(auto& elem: b) {
		answ += elem;
		cnt += (elem == 2);
	}

	answ -= (cnt == 1 ? 2 : 0);
	answ -= (cnt == 2 ? 3 : 0);

	cout << answ << '\n';
}

int main() {
	init_IO();
	solve();

	return 0;
}


Measured memory_bytes: 1276
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long ll;
int main(){
	fast;
	ll t,n; cin>>n;
	(n>=30)?cout<<"Yes\n":cout<<"No\n";
	return 0;
}
//prime func
//subset production
//factorization
 
//dfs/bfs
//prim's/kruskal's
//dijikstra/warshall-floyd
//tree traversal
//DP - Recursion

Measured memory_bytes: 3652
#include <iostream>

int main(void){
    using namespace std;
    long long a, b, c, d;
    cin >> a >> b >> c >> d;
    a--;

    long long count_div_c = b / c - a / c;
    long long count_div_d = b / d - a / d;

    long long x = c, y = d;
    while (true) {
        if(x<y){
            swap(x, y);
        }
        if(y==0){
            break;
        }
        x %= y;
    }
    long long cd_lcm = c * d / x;
    long long count_div_cd_lcm = b / cd_lcm - a / cd_lcm;
    long long ret = b - count_div_d - count_div_c - a + count_div_cd_lcm;

    std::cout << ret << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
#include <numeric>
#include <queue>
#include <numeric>
#include <iomanip>
#include <sstream>
#include <cmath>
#include <map>
#include <functional>
#include <limits>
#include <set>
#define rep(i,a,b) for((i)=a;i<(int)(b);i++)
#define max(a,b) (a < b ? b : a)
#define min(a,b) (a > b ? b : a)
#define AAA (1000000007)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;


int main() {
	int A[3] = { 0 };
	string S;
	cin >> S;
	int i, j, k;
	rep(i, 0, S.size()) {
		A[S[i] - 'a'] += 1;

	}
	int MAX = min(A[0], min(A[1], A[2]));
	A[0] -= MAX;
	A[1] -= MAX;
	A[2] -= MAX;

	if (A[0] > 1 || A[1] > 1 || A[2] > 1) {
		cout << "NO";
		return 0;
	}

	cout << "YES";
	return 0;
}


Measured memory_bytes: 512
//ABC083B - Some Sums
package main

import "fmt"

func sumOfDegit(num int) int {
	sum := 0
	for num > 0 {
		sum += num % 10
		num /= 10
	}
	return sum
}

func main() {
	var n, a, b int
	fmt.Scan(&n, &a, &b)
	ans := 0
	for i := 1; i <= n; i++ {
		v := sumOfDegit(i)
		if a <= v && v <= b {
			ans += i
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 512
#include<iostream>
#include<string>
using namespace std;
int main()
{
	string s;
	cin >> s;
	int ans = 0;
	for (int i = 0; i < s.length(); i++)
	{
		ans += s[i] - '0';
	}
	if (ans % 3 == 0)
	{
		if (ans % 3 == 0)
		{
			printf("Yes");
		}
		else printf("No");
	}
	else printf("No");
	return 0;
}

Measured memory_bytes: 3800
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<map>
#include<set>
#include<bitset>
using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; i++ )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;
int dx[4]={1,0,-1,0} , dy[4]={0,1,0,-1} ;
struct UnionFind{
    vector<int> par;
    UnionFind(int n):par(n,-1){}
    int find(int x){
        if(par[x]<0)return x;
        return par[x]=find(par[x]);
    }
    bool unite(int x,int y){
        x=find(x);
        y=find(y);
        if(x==y)return false;
        if(par[x]>par[y]){
            par[y]+=par[x];
            par[x]=y;
        }
        else{
            par[x]+=par[y];
            par[y]=x;
        }
        return true;
    }

    bool same(int x,int y){
        return find(x)==find(y);
    }
};
int main(){
    int n,q;
    cin>>n>>q;
    UnionFind uf(n);
    rep(i,q){
        int c,x,y;
        cin>>c>>x>>y;
        if(c)cout<<uf.same(x, y)<<endl;
        else uf.unite(x,y);
    }
   return 0;
}


Measured memory_bytes: 3136
use List::Util 'sum';

($x, $y) = split(/ /, <>);
@apple = ();
$min = 100;
for $i (1 .. $x) {
	$n = $y + $i - 1;
	push(@apple, $n);
	$min = $n if((abs($n) - 0) < abs($min));
}

@apple = grep { $_ != $min } @apple;
print sum(@apple) . "\n";


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

using namespace std;
typedef long long ll;

const int N = int(1e8) + 7;

void init(){

}

void solve(){
    vector<pair<int,int>> v;
    int n, m;
    scanf("%d %d", &n, &m);
    int a = 1, b = n;
    for(int i = 0; i < m; i++){
        int p, q;
        scanf("%d %d", &p, &q);
        if(p > a) a = p;
        if(q < b) b = q;
    }
    if(a > b) printf("0\n");
    else printf("%d\n", b-a+1);
}

const bool mtc = false;

int main(){
    int t;
    if(mtc){
        scanf("%d", &t);
        while(t--) solve();
    }
    else solve();
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define ALL(x) x.begin(), x.end()
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
random_device rnd;
mt19937 mt(rnd());
using ll = long long;
using lld = long double;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<ll>;
using VVL = vector<VL>;
using PII = pair<int, int>;
const int IINF = 1 << 30;
const ll INF = 1ll << 60;
const ll MOD = 1000000007;

void solve(int n, int l)
{
    vector<char> dir(n);
    VI pos(n);

    rep(i, n) cin >> dir[i] >> pos[i];

    bool flag = true;
    int ans = 0;
    int id = -1;

    while (flag)
    {
        flag = false;
        rep(i, n)
        {
            if (pos[i] == 0 || pos[i] >= l)
            {
                continue;
            }
            if (dir[i] == 'R')
            {
                pos[i]++;
                if (flag == false)
                {
                    id = i + 1;
                }
                flag = true;
            }
            else
            {
                id = i + 1;
                pos[i]--;
                flag = true;
            }
        }
        rep(i, n) rep(j, i + 1, n)
        {
            if (pos[i] == pos[j])
            {
                swap(dir[i], dir[j]);
            }
        }
        ans++;
    }
    cout << ans - 1 << " " << id << endl;
}

int main()
{
    int n, l;
    while (cin >> n >> l, n)
    {
        solve(n, l);
    }

    return 0;
}


Measured memory_bytes: 2996
#include<bits/stdc++.h>
using namespace std;
#define int long long

vector<int> v;

struct RSQ {
  int n;
  vector<int> node;

  // 元配列 v をセグメント木で表現する
  void init(){
    n = 1; while(n < v.size()) n *= 2;
    node.resize(2*n-1,0);
    for(int i = 0; i < v.size(); i++) node[i+n-1] = v[i];
    for(int i = n-2; i >= 0; i--) node[i] = min(node[2*i+1],node[2*i+2]);
  }

  void update(int k,int val){
    k += n-1;
    node[k] += val;
    while(k > 0){
      k = (k-1) / 2;
      node[k] = node[2*k+1] + node[2*k+2];
    }
  }

  int getsum(int a,int b){ return getsum(a,b,0,0,n); }
  int getsum(int a,int b,int k,int l,int r){
    //区間 [a, b) 中の要素の最小値を返す
    if(r <= a || b <= l) return 0;
    if(a <= l && r <= b) return node[k];
    int vl = getsum(a, b, 2*k+1, l, (l+r)/2);
    int vr = getsum(a, b, 2*k+2, (l+r)/2, r);
    return vl + vr;
  }
}rsq;

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

  int n,q; cin >> n >> q;
  v.resize(n+1,0);
  rsq.init();
  for(int i = 0; i < q; i++){
    int com,x,y; cin >> com >> x >> y;
    if(com) cout << rsq.getsum(x,y+1) << endl;
    else rsq.update(x,y);
  }

  return 0;
}



Measured memory_bytes: 5648
using DataStructures
const double = Float64
const int = Int64

parseint(x) = parse(int, x)
readint() = map(parseint, split(readline()))

function main()
  N = readint()[1]
  A = readint()

  sum = 0
  H = A[1]

  for i in 2:N
    if A[i] < H 
      sum += H-A[i]
    else
      H = A[i]
    end
  end
  println(sum)

  
end

main()

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

using namespace std;
typedef long long ll;

int a[200005];

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

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

    return 0;
}


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

#define ll long long
#define nums vector<int>
#define words vector<string>
#define letrs vector<char>
#define MOD 1000000007
#define pb push_back
#define llnums vector<ll>

using namespace std;

void solve() {

}
int main(void) {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); // A.cpp
    int a,b,c,d, i=0;
    cin >> a >> b >> c >> d;
    while (a > 0 || c > 0) {
        if (i % 2 == 0) {
            c -= b;
            i++;
            if (c <= 0) break;
        }
        else {
            a -= d;
            i++;
            if (a <= 0) break;
        }
    }
    cout << ((a > c) ? "Yes\n" : "No\n");
    return 0;
}



Measured memory_bytes: 3620
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include<numeric>
#include<cmath>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<int,int>;
using pll = pair<ll,ll>;
using vvii = vector<vector<int> >;
using vvll =  vector<vector<ll> >;

const ll inf = 1LL << 60;

int main(){
    cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	//cout << fixed << setprecision(15);
    int N; cin>>N;
    vector<int> ans(N,0);
    FOR(x,1,100){
        FOR(y,1,100){
            FOR(z,1,100){
                int plus = x*x + y*y + z*z + x*y + y*z + z*x;
                if(plus <= N){
                    ans[plus-1]++;
                }
            }
        }
    }
    REP(i,N){
        cout<<ans[i]<<endl;
    }
}

Measured memory_bytes: 3652
#include<stdio.h>
 
int main(void) {
  int K,X;
  scanf("%d %d", &K, &X);
  
  int a[100];
  for(int i = 0; i < K; i++) {
    a[i] = X + i;
  }
  
  int b[100];
  for(int i = 0; i < K - 1; i++) {
    b[i] = X - (K - 1) + i;
  }
  
  for(int i = 0; i < K - 1; i++) {
    printf("%d ", b[i]);
  }
  for(int i =0; i < K; i++) {
    printf("%d ", a[i]);
  }
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <vector>
using namespace std;

int main(void){
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);

  int N;
  cin >> N;
  vector<int> B(N);
  vector<int> A(N);
  for(int i = 0; i < N - 1; i++) {
    cin >> B[i];
  }

  A[0] = B[0];
  for(int i = 1; i <= N - 2; i++) {
    A[i] = min(B[i], B[i - 1]);
  }
  A[N - 1] = B[N - 2];

  int ans = 0;
  for(int i = 0; i < N; i++) {
    ans += A[i];
  }

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


Measured memory_bytes: 3668
#include <bits/stdc++.h>
#define MAX 105
using namespace std;

typedef long long ll;
const int inf = 2147483647;
int n, W, w[MAX], v[MAX];

ll dp[MAX][100005];

ll solve(int pos, int weight)
{
    if(pos >= n){
        return 0;
    }
    if(dp[pos][weight] != -1)
        return dp[pos][weight];
    ll ret = 0;
    if(weight + w[pos] <= W)
        ret = max(ret, v[pos] + solve(pos + 1, weight + w[pos]));
    ret = max(ret, solve(pos + 1, weight));

    return dp[pos][weight] = ret;
}

int main()
{
    // #ifndef ONLINE_JUDGE
    //     freopen("input.txt", "r", stdin);
    //     freopen("output.txt", "w", stdout);
    // #endif
    cin>>n>>W;

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

    memset(dp, -1, sizeof(dp));
    ll result = solve(0, 0);

    cout<<result<<endl;

    return 0;
}

Measured memory_bytes: 82304
#include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <algorithm>

#define rep(i,n) for(int i=0; i<(n); i++)
#define rrep(i,n) for(int i=(n)-1; i>=0; i--)
#define all(X) (X).begin(),(X).end()

using namespace std;
typedef long long int ll;
typedef pair<int,int> pii;

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 (a>b) { a=b; return 1; } return 0; }

template<class A, size_t N, class T> void Fill(A (&a)[N], const T &v){ fill( (T*)a, (T*)(a+N), v ); }

const int INF = 0x3fffffff;


int m[100005][20]={};
int main(){
	int N, L, ans=0;
	int x[100005];

	cin >> N;
	rep(i,N) cin >> x[i];
	cin >> L;

	int dp[100005], l=0;
	Fill(dp, INF);
	dp[0] = 0;
	rep(i,N){
		while( x[i]-x[l] > L ) l++;
		chmin( dp[i], dp[l]+1 );
		int p=l;
		rep(j,20){
			m[i][j] = p;
			p = m[p][j];
		}
	}

	int Q, a[100005], b[100005];
	cin >> Q;
	rep(i,Q){
		cin >> a[i] >> b[i];
		a[i]--; b[i]--;
	}

	rep(i,Q){
		if( a[i] > b[i] ) swap(a[i], b[i]);
//		ans = dp[ b[i] ] - dp[ a[i] ];
		ans = 0;
		for(int p=b[i], k=-1; p>a[i]; p = m[p][k], k=-1){
			for(int j=0; m[p][j] > a[i]; j++ ){
				k++;
			}
			if( k == -1 ) ans++;
			else ans += (1<<k);
		}
		ans = max(1, ans);
		cout << ans << endl;
	}

	return 0;
}


Measured memory_bytes: 10240
#include <bits/stdc++.h>
#include <sstream>
#include <iomanip>
#define ll long long
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define min_3(a,b,c) min(a,min(b,c))
#define max_3(a,b,c) max(a,max(b,c))
#define nout(ans) cout << (ans) << "\n"
#define sout(ans) cout << (ans) << " "
using namespace std;

const double pi = 3.14159265359;
const ll INF = 1e12;
const ll MOD = 1e9 + 7;
const ll N = 1e5 + 5;
/*
Decimal Places: cout << fixed << setprecision(n) << ans << endl

String to integer:
stringstream dark(s);
int x = 0; dark >> x;
*/

bool compare(const pair<int, int>&i, const pair<int, int>&j)
{
    return i.second < j.second;
}


long double a, b;

void solve()
{
    cin >> a >> b; nout(floor(a*b));
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    int t = 1;
    //cin >> t;
    for (int i=1; i<=t; i++)
    {
        solve();
    }
    return 0;
}

Measured memory_bytes: 3812
using System;
using System.Collections.Generic;
using System.Linq;

namespace AtCoderBeginnerContest
{
    public class Program
    {
        public static void Main(string[] args)
        {
            // C
            var N = int.Parse(Console.ReadLine());
            var s = new List<int>();
            for (int i = 0; i < N; i++)
            {
                s.Add(int.Parse(Console.ReadLine()));
            }

            s.Sort();
            var sum = s.Sum();

            if(sum % 10 == 0)
            {
                foreach (var k in s)
                {
                    if (k % 10 != 0)
                    {
                        sum -= k;
                        break;
                    }
                }
            }

            if (sum % 10 == 0)
            {
                Console.WriteLine(0);
            }
            else
            {
                Console.WriteLine(sum);
            }

        }
    }
}


Measured memory_bytes: 13268
from itertools import combinations

def dist(i,j):
    return ((i[0]-j[0])**2+(i[1]-j[1])**2)**0.5
    
n=int(input())
xy=[list(map(int,input().split())) for _ in range(n)]
l=combinations(range(0,n),2)

res=[dist(xy[i],xy[j]) for i,j in l]

print(2*sum(res)/n)

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

using namespace std;

#define LOG(...) fprintf(stderr,__VA_ARGS__)
//#define LOG(...)
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(ALL(c))
#define RSORT(c) sort(RALL(c))

typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

int main() {
    int n;
    while (cin >> n, n) {
        int god = -1;
        vi time(1000);
        vector<pii> prog;
        REP(i, n) {
            int month, day, hour, minute, id;
            char inout;
            scanf("%02d/%02d %02d:%02d %c %03d", &month, &day, &hour, &minute, &inout, &id);
            int t = hour * 60 + minute;
            if (inout == 'I') {
                if (id == 0) {
                    god = t;
                } else {
                    prog.push_back({t, id});
                }
            } else {
                if (id == 0) {
                    for (pii p : prog) {
                        time[p.second] += t - max(p.first, god);
                    }
                    god = -1;
                } else {
                    for (auto it = prog.begin(); it != prog.end(); it++) {
                        if (it->second == id) {
                            if (god != -1) {
                                time[it->second] += t - max(it->first, god);
                            }
                            it = prog.erase(it, it+1);
                            it--;
                        }
                    }
                }
            }
        }

        int ma = 0;
        for (int t : time) {
            ma = max(ma, t);
        }
        cout << ma << endl;
    }
}

Measured memory_bytes: 3140
#include<bits/stdc++.h>
using namespace std;
#define reg register
#define ll long long
inline ll read()
{
	ll x=0,w=0;char ch=getchar();
	while(!isdigit(ch))w|=ch=='-',ch=getchar();
	while(isdigit(ch))x=(x<<3)+(x<<1)+(ch^48),ch=getchar();
	return w?-x:x;
}
int main()
{
    reg int a=read(),b=read();
    cout<<1ll*a/__gcd(a,b)*b<<"\n";
	return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)

int fac(int n) {
  int tmp = 1;
  while (n > 1) {
    tmp *= n;
    --n;
  }
  
  return tmp;
}

int pernum(vector<int> v) {
  int n = v.size();
  
  int ans = 0;
  REP(i, n) {
    int tmp = 0;
    REP(j, i) {
      if (v.at(j) < v.at(i))
        ++tmp;
    }
    ans += (v.at(i) - tmp) * fac(n - 1 - i);
  }
  
  return ans;
}

int main() {
  int n;
  cin >> n;
  
  vector<int> p(n), q(n);
  REP(i, n)
    cin >> p.at(i);
  REP(i, n)
    cin >> q.at(i);
  
  cout << abs(pernum(p) - pernum(q)) << endl;
  
  return 0;
}

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

int main(){
    int n;
    cin >> n;
    int t = 0;
    int x = 0;
    int y = 0;
    int f = 0;
    rep(i, n){
        int tt, tx, ty;
        cin >> tt >> tx >> ty;
        rep(j, tt-t){
            if(x != tx){
                if(x < tx){
                    x++;
                }else{
                    x--;
                }
            }else if(y != ty){
                if(y < ty){
                    y++;
                }else{
                    y--;
                }
            }else{
                x++;
            }
        }
        t = tt;
        if(x != tx || y != ty){
            f = 1;
            break;
        }
    }
    if(f == 0){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include <stdio.h>
using namespace std;
int i, a=0, n, q;
int S[100001];
bool BS(int x) {
	int left = 0, right = n-1;
	while (left < right) {
		int mid = (left + right) / 2;
		
		if (x < S[mid]) {
			right = mid;
			
		}
		else if (x > S[mid]) {
		    left = mid+1;
			
		}
		else {
			return true;
			break;
		}
		if (x == S[right])return true;
	}
	return false;
}
int main() {
	cin >> n;
	for (i = 0; i < n; i++) {
		cin >> S[i];
	}
	cin >> q;
	for (i = 0; i < q; i++) {
		int key;
		cin >> key;
		if (BS(key)) {
			a++;
			
		}
	}
	
    cout<<a<<endl;

	return 0;

}


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

int main()
{
    int m, n;
    cin >> m >> n;
    int a[m + 1][n + 1] = {0};
    int b[n + 1] = {0};
    int sum[m + 1] = {0};

    for (int i = 1; i < m + 1; i++)
    {
        for (int j = 1; j < n + 1; j++)
        {
            cin >> a[i][j];
        }
    }

    for (int j = 1; j < n + 1; j++)
    {
        cin >> b[j];
    }

    for (int i = 1; i < m + 1; i++)
    {
        for (int j = 1; j < n + 1; j++)
        {
            sum[i] += a[i][j] * b[j];
        }
        cout << sum[i] << endl;
    }

    return 0;
}


Measured memory_bytes: 3160
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int a=sc.nextInt();
		int b=sc.nextInt();
		int sum=a*b;
		if(sum%2==0){
			System.out.println("Even");
		}else{
			System.out.println("Odd");
		}
	}
}

Measured memory_bytes: 21716
#include <bits/stdc++.h>
#define itn int
#define REP(i, n) for (int i = 0; i < n; i++)
#define IREP(i, n) for (int i = n - 1; i >= 0; i--)
#define FOR(a, b) for (int i = a; i < b + 1; i++)
#define all(v) v.begin(), v.end()
#define SENTINEL 2000000000
#define NIL -1
using namespace std;
typedef long long ll;

const ll INF = 1LL << 60;
const ll MOD = 1000000007;
template <class T>inline bool chmin(T &a, T b){if(a>b){a=b;return true;}return false;}
template <class T>inline bool chmax(T &a, T b){if(a<b){a=b;return true;}return false;}

const int SIZE=500002;
int sum(int a, vector<int> &BIT);
int sum(int a, int b, vector<int> &BIT);
void add(int a, int x, vector<int> &BIT);
int n;
vector<vector<int>> bit(26, vector<int>(SIZE+1,0));
int main()
{
    int q;string s;
    cin >> n >> s >> q;
    REP(i,n){
        REP(j,26){
            add(i+1,0,bit[j]);
        }
        add(i+1,1,bit[s[i]-'a']);
    }
    REP(i,q){
        int flag;
        cin >> flag;
        if(flag==1){
            int a;char b;
            cin >> a >> b;
            add(a,-1,bit[s[a-1]-'a']);
            add(a,1,bit[b-'a']);
            s[a-1]=b;
        }
        else{
            int a,b;
            cin >> a >> b;
            int ans=0;
            REP(j,26){
                int tmp=0;
                tmp = sum(a, b, bit[j]);
                if(tmp!=0){
                    ans++;
                }
            }
            cout << ans << endl;
        }
    }
}

int sum(int a,vector<int> &BIT)
{
    int ans = 0;
    while (a)
    {
        ans += BIT[a];
        int least = a & -a;
        a -= least;
    }
    return ans;
}
int sum(int a, int b,vector<int> &BIT)
{
    if (a > b)
        return 0;
    return sum(b,BIT) - sum(a - 1,BIT);
}
void add(int a, int x,vector<int> &BIT)
{
    while (a <= n)
    {
        BIT[a] += x;
        int least = a & -a;
        a += least;
    }
}


Measured memory_bytes: 52992
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<sstream>
#include<iterator>
#include<list>

using namespace std;

typedef  long long int lint;

#define rep(i, n) for (lint i = 0; i < n; i++)
#define sort(v) sort((v).begin(), (v).end())
#define reverse(v) reverse((v).begin(), (v).end())
#define upper(v,hoge) upper_bound(v.begin(),v.end(),hoge)
#define lower(v,hoge) lower_bound(v.begin(),v.end(),hoge)
#define mp make_pair
#define IP pair<int,int>
#define enld endl

int main() {
	lint N;
	cin >> N;
	vector<pair<lint, lint>>A(N);
	rep(i, N) {
		cin >> A[i].second >> A[i].first;
	}
	rep(i, N) {
		A[i].second *= -1;
	}
	sort(A);
	cout << A[N - 1].second * (-1) << ' ' << A[N-1].first << endl;
}


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

# define REP(i,n) for (int i=0;i<(n);++i)
# define rep(i,a,b) for(int i=a;i<(b);++i)
# define p(s) std::cout << s ;
# define pl(s)  std::cout << s << endl;
# define printIf(j,s1,s2) cout << (j ? s1 : s2) << endl;
# define YES(j) cout << (j ? "YES" : "NO") << endl;
# define Yes(j) std::cout << (j ? "Yes" : "No") << endl;
# define yes(j) std::cout << (j ? "yes" : "no") << endl;
# define all(v) v.begin(),v.end()
# define showVector(v) REP(i,v.size()){p(v[i]);p(" ")} pl("")
template<class T> inline bool chmin(T &a, T b){ if(a > b) { a = b; return true;} return false;}
template<class T> inline bool chmax(T &a, T b){ if(a < b) { a = b; return true;} return false;}
typedef long long int ll;
typedef pair<ll,ll> P_ii;
typedef pair<double,double> P_dd;

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

    vector<int> a(N);

    int abs_i = -1;
    int abs_val = 0;
    REP(i, N) {
        cin >> a[i];
        if(abs_i == -1 || abs(abs_val) < abs(a[i])){
            abs_val = a[i];
            abs_i = i;
        }
    }

    if(abs_val == 0) {
        cout << 0 << endl;
        return 0;
    }

    cout << 2 * N - 2 << endl;
    REP(i, N) {
        if(abs_i == i) continue;
        printf("%d %d\n", abs_i + 1, i + 1);
    }

    if(abs_val < 0) {
        for(int i = N; i > 1; i--){
            printf("%d %d\n", i, i - 1);
        }
    } else {
        for(int i = 1; i < N; i++){
            printf("%d %d\n", i, i + 1);
        }
    }

    return 0;
}


Measured memory_bytes: 256
from math import gcd
A, B, C, D = map(int,input().split())
 
lcm = C*D // gcd(C,D)
a = (A-1)//C + (A-1)//D - (A-1)//lcm
b = B//C + B//D - B//lcm
 
print(B-A+1-b+a)

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

using namespace std;
using ll = long long;

int main() {
	ll N;
	cin>>N;
	ll ans = 0;
	for (ll k = 1;k*k <= N-1;++k) {
		if ((N-1)%k == 0) {
			if ((N-1)/k != k) {
				ans += 1;
			}
		
			if (k != 1) {
				ans += 1;
			}
		}
	}

	function<void(ll)> compute = [&] (ll x) {
		if (x == 1) return;
		ll z = N;
		while (z%x == 0) {
			z /= x;
		}

		if (z%x == 1) {
			ans += 1;
		}
	};

	for (ll k = 1;k*k <= N;++k) {
		if (N%k == 0) {
			compute(k);
			if (N/k != k) {
				compute(N/k);
			}
		}
	}

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


Measured memory_bytes: 256
#include<iostream>
#include<set>
#include <bitset>
#include<queue>
#include<vector>
#include<map>
#include<stack>
#include <cstdio>
#include<algorithm>
#include <sstream>
#include<string.h>
#include <cmath>
#include <iomanip>
#include <string>
#include<list>
#include <limits>
#include <numeric>
#include <type_traits>
#define int long long
#define ll long long
#define mod  1000000007
#define MOD  1000000007
#define inf 1e17
#define rep(i,j,n) for(int i=j;i<n;i++)
#define P pair<int,int>
#define ps push_back
#define all(x) x.begin(),x.end()
double pi = 3.141592653589793;
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
//ここから始めよう
signed main(){
    double t,x;cin>>t>>x;
    cout<<t/x<<endl;
    return 0;
}


Measured memory_bytes: 764
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
 
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
 
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
 
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
 
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define ins insert
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
const int MOD = 1000000007;
const char nl = '\n';
const int MX = 100001; //check the limits, dummy
 
int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);    
	
    int N, K; cin >> N >> K;

    vi A(N); F0R(i, N) cin >> A[i];

    F0R(q, K) {

        vector<pair<int, bool> > E;
        F0R(i, N) {
            E.pb({max(0, i - A[i]), true});
            E.pb({min(N, i+A[i]+1), false});
        }
        sort(all(E));

        int cur = 0;
        int nxt = 0;
        F0R(i, N) {
            while (nxt < 2*N && E[nxt].f == i) {
                if (E[nxt].s) {
                    cur++;
                } else {
                    cur--;
                }
                nxt++;
            }
            A[i] = cur;
        }

        F0R(i, N) {
            if (A[i] != N) goto done;
        }
        break;
        done:
        ;
    }

    F0R(i, N) {
        cout << A[i] << " ";
    }
    cout << nl;
	
	return 0;
}
 
// read the question correctly (ll vs int)
// template by bqi343



Measured memory_bytes: 11152
#include<iostream>
#include<algorithm>
#include<vector>
#include<functional>
using namespace std;
int main() {
	int w = 0;
	int k = 0;
	int ww[20] = {};
	int hh[20] = {};
	for (int i = 0; i < 10; i++) {
		cin >> ww[i];
	}
	for (int i = 0; i < 10; i++) {
		cin >> hh[i];
	}
	sort(ww, ww + 20, greater<int>());
	sort(hh, hh + 20, greater<int>());
	w = ww[0] + ww[1] + ww[2];
	k = hh[0] + hh[1] + hh[2];
	cout << w << " " << k << endl;
	
	return 0;
}

Measured memory_bytes: 3084
// バケット法による解
#include <iostream>
#include <string>
using namespace std;

int main() {
    int N, M;
    cin >> N >> M;
    int load[M*2];
    for (int i = 0; i < M*2; ++i) cin >> load[i];

    int num[N] = {0};  // バケット
    for (int i = 0; i < M*2; ++i) {
        num[load[i]-1]++;
    }
    
    for (int i = 0; i < N; ++i) {
        cout << num[i] << endl;
    }
}



Measured memory_bytes: 256
#include <stdio.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include <vector>
#include <algorithm>

using namespace std;
#define dTolerance 1.0e-10

int main(){
    long double x1,x2,y1,y2,r1,r2;
    scanf("%Lf %Lf %Lf", &x1, &y1, &r1);
    scanf("%Lf %Lf %Lf", &x2, &y2, &r2);
    
    long double dDist = sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
    long double dSquare;
    if(fabs (r1 - r2) > dDist - dTolerance){
        dSquare = min(r1, r2) * min(r1, r2) * M_PI;
    } else if(r1 + r2 < dDist - dTolerance) {
        dSquare = 0;
    } else {
        long double dTheta1, dTheta2;
        dTheta1 = acos( (dDist * dDist + r1 * r1 - r2 * r2) / (2 * dDist * r1));
        dTheta2 = acos( (dDist * dDist - r1 * r1 + r2 * r2) / (2 * dDist * r2));
        dSquare = r1 * r1 * dTheta1 + r2 * r2 * dTheta2 - sqrt( (2 * r1 * r1 + 2 * r2 * r2 - dDist * dDist) * dDist * dDist - (r1 * r1 - r2 * r2) * (r1 * r1 - r2 * r2) ) / 2;
    }
     printf("%.20Lf", dSquare);
     return 0;
    
}


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

using namespace std;

int main(void)
{
    int k, a, b;
    cin >> k >> a >> b;

    for(int i = a; i <= b;i++)
    {
        if(i % k == 0)
        {
            cout << "OK" << endl;
            return 0;
        }
    }

    cout << "NG" << endl;
    return 0;
}

Measured memory_bytes: 3632
n = gets.to_i
hs = gets.chomp.split.map(&:to_i)

n.times do |i|
  if i == 0 || hs[i-1] < hs[i]
    hs[i] -= 1
  end
end

if hs.each_cons(2).all?{|a,b| a <= b}
  puts "Yes"
else
  puts "No"
end


Measured memory_bytes: 12292
import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    x = I()

    # 5を上にして、6と5を交互に出す
    ans = 0
    ans += x // 11 * 2
    x %= 11
    if x == 0:
        print(ans)
    elif 0 < x <= 6:
        print(ans + 1)
    else:
        print(ans + 2)

if __name__ == '__main__':
    resolve()


Measured memory_bytes: 10132