akhauriyash/Code-Regression huggingface dataset:
#!/usr/bin/env python
from __future__ import division, print_function

import os
import sys
from io import BytesIO, IOBase

if sys.version_info[0] < 3:
    from __builtin__ import xrange as range
    from future_builtins import ascii, filter, hex, map, oct, zip


def main():
    n, k = map(int, input().split())

    MOD = 10**9 + 7

    s = 0
    for i in range(k, n + 2):
        a = ((i - 1) * i) // 2
        s = (s + (n * i) - (2 * a) + 1) % MOD

    print(s)


# region fastio

BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


def print(*args, **kwargs):
    """Prints the values to a stream, or to sys.stdout by default."""
    sep, file = kwargs.pop("sep", " "), kwargs.pop("file", sys.stdout)
    at_start = True
    for x in args:
        if not at_start:
            file.write(sep)
        file.write(str(x))
        at_start = False
    file.write(kwargs.pop("end", "\n"))
    if kwargs.pop("flush", False):
        file.flush()


if sys.version_info[0] < 3:
    sys.stdin, sys.stdout = FastIO(sys.stdin), FastIO(sys.stdout)
else:
    sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)

input = lambda: sys.stdin.readline().rstrip("\r\n")

# endregion

if __name__ == "__main__":
    main()


Measured memory_bytes: 67192
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
int c(const void *x,const void *y){return *(int*)x-*(int*)y;}
int t[10005],i,n;
long long w[10005],s,r;
int main()
{
	for(;scanf("%d",&n),n;)
	{
		memset(t,0,sizeof(t));
		memset(w,0,sizeof(w));
		for(i=0;i<n;i++)
			scanf("%d",&t[i]);
		qsort(t,n+1,4,c);
		for(i=s=r=0;i<n-1;i++)
		{
			s+=t[i+1]-t[i];
			r+=w[i+1]+=w[i]+s;
		}
		printf("%lld\n",r);
	}
	return 0;
}

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

#define int long long
#define pb push_back 
#define pf push_front 
#define mp make_pair
#define fr first
#define sc second
#define Rep(i, n) for ( int i = 0 ; i < (n); i++ )
#define All(v) v.begin(), v.end()

typedef pair<int, int> Pii; typedef pair<int, Pii> Pip;
typedef pair<double, Pii> P;
const int INF = 1107110711071107;

signed main() {
  int n, m, p, a, b;
  while ( cin >> n >> m >> p >> a >> b, n + m + p + a + b ) {
    a--; b--;
    int t[8];
    vector<Pii> graph[31];
    Rep(i, n) cin >> t[i];
    Rep(i, p) {
      int x, y, z;
      cin >> x >> y >> z;
      x--; y--;
      graph[x].pb(Pii(y, z));
      graph[y].pb(Pii(x, z));
    }

    priority_queue<P, vector<P>, greater<P> > q;
    double ans = -1;
    q.push(P(0, Pii(a, 0)));
    bool used[1 << 9][31] = {{0}};
    while ( !q.empty() ) {
      P p = q.top(); q.pop();
      double c = p.fr;
      int now = p.sc.fr, bit = p.sc.sc;

      if ( now == b ) {
	ans = c;
	break;
      }

      if ( used[bit][now] ) continue;
      used[bit][now] = true;
      if ( bit == (1 << n)-1 ) continue;
      Rep(i, (int)graph[now].size()) {
	int ne = graph[now][i].fr, co = graph[now][i].sc;
	Rep(j, n) {
	  if ( bit & (1 << j) ) continue;
	  q.push(P(c + (double)co / (double)t[j], Pii(ne, bit | (1 << j))));
	}
      }
    }

    if ( ans < 0 ) cout << "Impossible" << endl;
    else cout << ans << endl;
  }
  
}

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

using namespace std;

pair <long long, long long> arr[110];
long long DP[110][100010];

int main () {
    int N,W;
    cin >> N >> W;
    for (int i=1;i<=N;i++) {
        cin >> arr[i].second >> arr[i].first;
    }
    memset(DP,(1e9)+3,sizeof(DP));
    DP[0][0]=0;
    for (int i=1;i<=N;i++) {
        for (int j=0;j<=100000;j++) {
            DP[i][j]=DP[i-1][j];
            if (j-arr[i].first>=0) {
                DP[i][j] = min(DP[i][j],DP[i-1][j-arr[i].first]+arr[i].second);
            }
        }
    }
    for (int i=100000;i>=0;i--) {
        if (DP[N][i]<=W) {
            cout << i;
            return 0;
        }
    }
    return 0;
}



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


int main(){
	ll r,c;
	cin >> r >> c;
	vector <vector<ll>> grid(r,vector<ll>(c,0));
	ll a,b;
	cin >> a >> b;
	for (int z=0;z<a;z++){
		for (int x=0;x<c;x++){
			grid[z][x] = 1;
		}
	}
	for (int z=0;z<r;z++){
		for (int x=0;x<b;x++){
			grid[z][x] = 1;
		}
	}
	ll answer = 0;
	for (int z=0;z<r;z++){
		for (int x=0;x<c;x++){
			answer += grid[z][x];
		}
	}
	cout << c*r-answer << endl;
	cin >> r;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int a, b;
    cin >> a >> b;
    if ((a + b) % 3 == 0 || a % 3 == 0 || b % 3 == 0)
        cout << "Possible" << endl;
    else
        cout << "Impossible" << endl;
    return 0;
}

Measured memory_bytes: 256
def rect(h, w):
	print('#' * w)
	for _ in range(h - 2):
		print('#' + '.' * (w - 2) + '#')
	print('#' * w)

while True:
	h, w = map(int, input().split())
	if h == 0 & w == 0:
		break
	else:
		rect(h, w)
		print('\r')



Measured memory_bytes: 5616
#include<bits/stdc++.h>
#define all(vec) vec.begin(),vec.end()
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const ll MOD=10000000;
const ll INF=1000000001;
const ll LINF=4000000000000000010;
const double EPS=1e-9;
int main(){
    string s;cin>>s;
    int n=s.length();
    bool f=true;
    int c=0;
    for(int i=1;i<n;i++){
        if(i>=2&&i<=n-2&&s[i]=='C'){
            c++;
        }else{
            if((s[i]>='a')&&(s[i]<='z'));
            else f=false;
        }
    }
    if(s[0]!='A')f=false;
    if(c!=1)f=false;
    if(f){
        cout<<"AC"<<endl;
    }else{
        cout<<"WA"<<endl;
    }
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
const double PI = 3.141592653589793238;
const double EPS = 1e-10;
ll X[200000];
ll sumL[200000], sumR[200000];
int main() {
	ll L;
	int N;
	cin >> L >> N;
	for (int i = 0; i < N; i++) cin >> X[i];
	sumL[0] = X[0];
	sumR[N - 1] = L - X[N - 1];
	for (int i = 1; i < N; i++) sumL[i] = X[i] + sumL[i - 1];
	for (int i = N - 2; i >= 0; i--) sumR[i] = (L - X[i]) + sumR[i + 1];
	ll ans = max(L - X[0], 2 * (L - X[1]) + X[0]);
	ans = max(X[N - 1], 2 * X[N - 2] + (L - X[N - 1]));
	for (int i = 1; i + 1 < N; i++) {
		if (i < N - 1 - i) {
			ll l = sumL[i - 1];
			ll r = sumR[i + 1] - sumR[2 * i + 1];
			ans = max(ans, 2 * (l + r) + max(X[i], L - X[i]));
			r = sumR[i + 1];
			if (2 * i + 2 < N) r -= sumR[2 * i + 2];
			ans = max(ans, 2 * (l + r) + X[i]);
		}
		else if (i > N - 1 - i) {
			ll r = sumR[i + 1];
			ll l = sumL[i - 1] - sumL[2 * i - N];
			ans = max(ans, 2 * (l + r) + max(X[i], L - X[i]));
			l = sumL[i - 1];
			if (2 * i - N - 1 >= 0) l -= sumL[2 * i - N - 1];
			ans = max(ans, 2 * (l + r) + (L - X[i]));
		}
		else {
			ll l = sumL[i - 1];
			ll r = sumR[i + 1];
			ans = max(ans, 2 * (l + r) + max(X[i], L - X[i]));
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 4992
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<bool> vb;
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define in insert
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int INF = 1e9 + 5;
int main(){
    int a, b;
    cin >> a >> b;
    if((a+b) % 2 == 0) cout << (a+b)/2;
    else cout << "IMPOSSIBLE";
}

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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
#define CLR(t,v) memset(t,(v),sizeof(t))
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}


int nextInt() { int x; scanf("%d", &x); return x;}

int f(vector<int> h) {
  if (h.size() == 0) return 0;
  int mi = *min_element(ALL(h));
  int res = mi;
  vector<int> v;
  REP(i, h.size()) {
    if (h[i] == mi) {
      res += f(v);
      v.clear();
    } else {
      v.push_back(h[i] - mi);
    }
  }
  res += f(v);
  return res;
}

int main2() {
  int N = nextInt();
  vector<int> h(N);
  REP(i, N) h[i] = nextInt();
  int ans = f(h);
  cout << ans << endl;
  return 0;
}

int main() {
  for (;!cin.eof();cin>>ws)
    main2();
  return 0;
}


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

int main(){
  map<string,int> Red;
  map<string,int> Blue;

  int N;
  cin>>N;
  vector<string> s(N);
  for(int i=0;i<N;++i){
    cin>>s.at(i);
    Red[s.at(i)]+=1;
  }

  int M;
  cin>>M;
  vector<string> t(M);
  for(int i=0;i<M;++i){
    cin>>t.at(i);
    Blue[t.at(i)]+=1;
  }

  int ans=0;
  for(int i=0;i<N;++i){
    int score=0;
    if(Blue[s.at(i)]>0){
      score=Red[s.at(i)]-Blue[s.at(i)];
    }
    else{
      score=Red[s.at(i)];
    }
    if(ans<score){
      ans=score;
    }
  }

  cout<<ans<<endl;
}

Measured memory_bytes: 256
using System;
using System.IO;
using System.Linq;

class Solve{
    static void Main(string[] args){
        Console.ReadLine();
        var answer = Console.ReadLine().Split().Min(a => {int ai = int.Parse(a), c = 0; while ((ai & 1) == 0) {ai >>= 1; c++;} return c;});
        var writer = new StreamWriter(Console.OpenStandardOutput()) {AutoFlush = false};
        Console.SetOut(writer);
        Console.WriteLine(answer);
        Console.Out.Flush();}}

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

using VS = vector<string>;    using LL = long long;
using VI = vector<int>;       using VVI = vector<VI>;
using PII = pair<int, int>;   using PLL = pair<LL, LL>;
using VL = vector<LL>;        using VVL = vector<VL>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)
//#pragma GCC optimize ("-O3") 
#ifdef YANG33
#include "mydebug.hpp"
#else
#define DD(x) 
#endif
const int INF = 1e9;                          const LL LINF = 1e16;
const LL MOD = 1000000007;                    const double PI = acos(-1.0);
int DX[8] = { 0, 0, 1, -1, 1, 1, -1, -1 };    int DY[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };

/* -----  2019/03/12  Problem: ABC 078 A / Link: http://abc078.contest.atcoder.jp/tasks/abc078_a  ----- */


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

	char X, Y; cin >> X >> Y;

	string ans = "";
	if (X > Y)ans = ">";
	else if (X < Y)ans = "<";
	else ans = "=";
	
	
	cout << (ans) << "\n";

	return 0;
}


Measured memory_bytes: 256
#define rep(i, n) for(int i = 0; i < (int)(n); i++)

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
using namespace std;

int main(){
    long long int ans = 0;
    vector<int> v;
    vector<int> s;
    int n, vi[200000];
    cin >>n;
    rep(i,n){
        cin >> vi[i];
    }
    rep(i,n){
        v.push_back(i-vi[i]);
    }
    rep(i,n){
        s.push_back(i+vi[i]);
    }
    sort(s.begin(),s.end()); 
    rep(i,n){
        ans+= (long long int)(std::upper_bound(s.begin(), s.end(), v[i])-std::lower_bound(s.begin(),s.end(),v[i]));
    }
    cout << ans << endl;
}

Measured memory_bytes: 6000
n = int(input())
S = list(map(int, input().split()))
q = int(input())
T = list(map(int, input().split()))

cnt = 0
for t in T:
    l = 0
    r = n-1
    while l <= r:
        idx = l + (r-l) // 2
        s = S[idx]
        if t == s:
            cnt += 1
            break
        elif t < s:
            r = idx - 1
        else:
            l = idx + 1
print(cnt)


Measured memory_bytes: 16704
#include<bits/stdc++.h>
using namespace std;
#define MAXN 100100
#define eps 1e-9
#define For(i,a,b) for(int i=a;i<=b;i++) 
#define Fore(i,a,b) for(int i=a;i>=b;i--) 
#define lson l,mid,rt<<1
#define rson mid+1,r,rt<<1|1
#define mkp make_pair
#define pb push_back
#define cr clear()
#define met(a,b) memset(a,b,sizeof(a))
#define iossy ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define fre freopen
#define pi acos(-1.0)
#define inf 1e9+9
#define Vector Point
#define fir first
#define sec second
#define fxx(a) cout<<fixed<<setprecision(a)
#define flu cout.flush()
typedef pair<int,int> pii;
const int Mod=1000000007;
typedef unsigned long long ull;
typedef long long ll;
const int base=227;
const int base1=123;
const int maxn=2005;
char s[maxn];
int vis[30];
int n;
set<char>ss;
void solve() {
	cin>>n;
	cin>>s+1;
	int l=strlen(s+1);
	int ans=0,cnt=0;
	For(i,1,l) {
		met(vis,0);cnt=0;ss.clear();
		For(j,1,i) vis[s[j]-'a']++;
		For(j,i+1,l) if(vis[s[j]-'a']) ss.insert(s[j]);
		ans=max(ans,(int)ss.size());
	}
	cout<<ans<<endl;
}
int main(){
	iossy;
	int t=1;
	For(i,1,t) solve();
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <utility>
#include <cctype>
#include <vector>
using namespace std;

#ifdef __linux
#define _U(s) s##_unlocked
#else
#define _U(s) _##s##_nolock
#define _CRT_DISABLE_PERFCRIT_LOCKS
#endif
#define gcu _U(getchar)
#define pcu _U(putchar)
#define _DEF(r, n, ...) inline r n(__VA_ARGS__) noexcept
#define _T template <typename T>
#define _HT template <typename H,typename... T>
#define _OP(t) inline operator t()
struct _in {
#ifdef _GLIBCXX_STRING
	_OP(string){string s;for(char c;c=gcu(),c!=' '&&c!='\n'&&c!=EOF;)s+=c;return s;}
#define _S
#endif
	_OP(char){char c=gcu();gcu();return c;}
	_OP(double){double d; scanf("%lf",&d); gcu();return d;}
	_T _OP(T){T n{},m{1},c;while(isspace(c = gcu()));if(c=='-')m=-1,c=gcu();do{n=10*n+(c-'0'),c=gcu();}while(c>='0'&&c<='9');return m*n;}
} in;
#define _SCAN(...) _DEF(bool,scan,__VA_ARGS__)
#ifdef _S
_SCAN(string &o) {int c{gcu()};if(c==EOF)return false;else{ungetc(c,stdin);string t=move(in);o=t;return true;}}
#endif
_T _SCAN(T &o) {int c{gcu()};return c==EOF?false:(ungetc(c,stdin),o=in,true);}
_HT _SCAN(H &h,T&&... t){return scan(h)&&scan(t...);}
#define _OUT(...) _DEF(void,out,__VA_ARGS__)
#define _OUTL(...) _DEF(void,outl,__VA_ARGS__)
_OUT(bool b){pcu('0'+b);}
_OUT(const char *s){while(*s)pcu(*s++);}
_OUT(char c){pcu(c);}
#ifdef _S
_OUT(string &s){for(char c:s)pcu(c);}
#endif
_T _OUT(T n){static char b[20];char *p=b;T m=n<0?pcu('-'),-1:1;
	if(!n)*p++='0';else while(n)*p++=(char)(n%10*m+'0'),n/=10;while(p!=b)pcu(*--p);}
_OUTL(){out('\n');}
#ifdef _GLIBCXX_VECTOR
	_T _OUT(vector<T> &v){for(T &x:v)out(&x == &v[0]?"":" "),out(x);}
#endif
	_HT _OUT(H &&h, T... t){out(h);out(t...);}
	template <typename... T> _OUTL(T... t){out(t...);outl();}
	struct range{
		int e,b=0,s=1;range(int _b,int _e,int _s):e(_e),b(_b),s(_s){} range(int _b,int _e): e(_e), b(_b){} range(int _e):e(_e){}
		struct it{int v,s; it(int _v,int _s):v(_v),s(_s){} operator int()const{return v;} operator int&(){return v;}int operator*()const{return v;}
			it& operator++(){v+=s;return *this;} }; it begin(){return {b,s};} it end(){return {e,s};}};
#define times(i,n) for(int i=n;i;i--)

int main() {
	for (int X, Y; X = in, Y = in;) {
		vector<vector<int>> m(Y + 1, vector<int>(X + 2)), d = m;
		for (int i: range(Y))
			for (int j: range(1, X + 1))
				m[i][j] = in;
		for (int i: range(1, X + 1))
			if (!m[0][i])
				d[0][i] = 1;
		for (int i: range(Y - 1))
			for (int j: range(1, X + 1)) {
				if (m[i][j] == 2 && m[i + 2][j] != 1)
					d[i + 2][j] += d[i][j];
				else if (m[i][j] == 0) {
					if (m[i + 1][j] != 1)
						d[i + 1][j] += d[i][j];
					if (m[i + 1][j - 1] == 0)
						d[i + 1][j - 1] += d[i][j];
					if (m[i + 1][j + 1] == 0)
						d[i + 1][j + 1] += d[i][j];
				}
			}
		int r {};
		for (int i: range(1, X + 1))
			r += d[Y - 1][i] + d[Y][i];
		outl(r);
	}
}


Measured memory_bytes: 2592
#include <iostream>
#include <vector>
#include <cmath>
#include <cstdio>
#include <queue>
#include <set>
#include <map>
#include <climits>
#include <string>
#include <string.h>
#include <algorithm>

using namespace std;
#define fast ios::sync_with_stdio(false);cin.tie(0); cout.tie(0)
#define pb push_back
#define sz(s) (int)s.size()
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)

typedef long long ll;
typedef pair<ll, ll> pii;
const ll N = (ll)3e5 + 7;
//const ll inf = (ll)1e12 + 7;

char s[N],t[N];
int n;
int check(int x,int y){
    t[0]=x; t[1]=y;
    for(int i=1;i<n-1;i++){
        if(s[i]=='o') {
            if(t[i]==1) t[i+1]=1-t[i-1];
            else t[i+1]=t[i-1];
        }else{
            if(t[i]==0) t[i+1]=1-t[i-1];
            else t[i+1]=t[i-1];
        }
    }
    if(s[0]=='o'){
        if(t[0]==0&&t[1]!=t[n-1]) return 0;
        else if(t[0]==1&&t[1]==t[n-1]) return 0;
    }else{
        if(t[0]==0&&t[1]==t[n-1]) return 0;
        else if(t[0]==1&&t[1]!=t[n-1]) return 0;
    }
    if(s[n-1]=='o'){
        if(t[n-1]==0&&t[0]!=t[n-2]) return 0;
        else if(t[n-1]==1&&t[0]==t[n-2]) return 0;
    }else{
        if(t[n-1]==0&&t[0]==t[n-2]) return 0;
        else if(t[n-1]==1&&t[0]!=t[n-2]) return 0;
    }
    forn(i,n) if(t[i]) t[i]='W'; else t[i]='S';
    return 1;
}
int main(){
    scanf("%d%s",&n,s);
    n=(int)strlen(s);
    t[n]='\0';
    forn(i,2) forn(j,2){
        if(check(i,j)) {
            printf("%s\n",t);
            exit(0);
        }
    }
    printf("-1\n");
    return 0;
}

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

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

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#define fi first
#define se second
using namespace std;
 
const int N = 100005, M = 100005;
 
int n, m, a[N];
pair<int, int> rep[M];
 
int main()
{
    cin >> n >> m;
    for (int i = 1; i <= n; i++)
        cin >> a[i];
    for (int i = 1; i <= m; i++)
        cin >> rep[i].se >> rep[i].fi;
    sort(a + 1, a + n + 1);
    sort(rep + 1, rep + m + 1, greater<pair<int, int>>());
    for (int i = 1, pt = 1; i <= m && pt <= n; i++)
        while (rep[i].se--)
            if (pt > n || a[pt] >= rep[i].fi)
            {
                pt = n + 1;
                break;
            }
            else
                a[pt++] = rep[i].fi;
    long long su = 0;
    for (int i = 1; i <= n; i++)
        su += a[i];
    cout << su;
}

Measured memory_bytes: 1408
#include<stdio.h>
#define N 100
#define WHITE 0
#define GRAY 1
#define BLACK 2

int n, M[N][N];
int color[N], d[N], f[N], tt;

//再帰関数による深さ優先探索
void dfs_visit(int u){
	int v;
	color[u] = GRAY;
	d[u] = ++tt; //最初の訪問
	for(v=0; v<n; v++){
		if(M[u][v] == 0)continue;
		if(color[v] == WHITE){
			dfs_visit(v);
		}
	}
	color[u] = BLACK;
	f[u] = ++tt;//訪問の完了
}

void dfs(){
	int u;
	//初期化
	for(u=0; u<n; u++)color[u] = WHITE;
	tt = 0;
	
	for(u=0; u<n; u++){
		//未訪問のuを始点として深さ優先探索
		if(color[u] == WHITE)dfs_visit(u);
	}
	for(u=0; u<n; u++){
		printf("%d %d %d\n", u+1, d[u], f[u]);
	}
}

int main(){
	int u,v,k,i,j;
	
	scanf("%d", &n);
	for(i=0; i<n; i++){
		for(j=0; j<n; j++)M[i][j] = 0;
	}
	
	for(i=0; i<n; i++){
		scanf("%d %d", &u, &k);
		u--;
		for(j=0; j<k; j++){
			scanf("%d",&v);
			v--;
			M[u][v] = 1;
		}
	}
	dfs();
	
	return 0;
}


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

#define int long long
#define DEBUG(x) cerr <<#x<<":"<<x<<endl;
#define DEBUG2(x, y) cerr <<#x<<":"<<x<<" "<<#y<<":"<<y<<endl;
#define DEBUG3(x, y, z) cerr <<#x<<":"<<x<<" "<<#y<<":"<<y<<" "<<#z<<":"<<z<<endl;
#define DEBUGVC(x) cerr <<#x<<": "; for(auto a:x) cerr << a <<" "; cerr << endl;
#define DEBUGMP(x) cerr <<#x<<":"<<endl; for(auto a:x) cerr << a.first <<" "<< a.second << endl;
#define MAX_N (1000006)
#define INF (1LL << 60)
const int MOD = (int)1e9+7;


signed main() {
    while(1){
        int x, y, s;
        cin >> x >> y >> s;
        if(x==0&&y==0&&s==0) break;

        int mx = 0;
        for(int i=1; i<s; i++){
            for(int j=1; j<s; j++){
                int v = i*(100+x)/100;
                int u = j*(100+x)/100;
                if(v+u == s) {
                    v = i*(100+y)/100;
                    u = j*(100+y)/100;
                    mx = max(mx, v+u);
                }
            }
        }
        cout << mx << endl;
    }
}


Measured memory_bytes: 3048
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <queue>
#include <set>
#include <stack>
#include <map>
#include <unordered_map>
#include <cmath>
#include <utility> // pair make_pair
#include <algorithm>
#include <functional>
#include <iomanip>
#include <climits> // LLONG_MAX, LLONG_MIN, INT_MIN, INT_MAX
#include <assert.h>

#define m0(x) memset(x,0,sizeof(x))
#define m1(x) memset(x,63,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))
#define ll long long
//#define int ll
#define INF INT_MAX/10
#define MOD 1000000007

using namespace std;
using Pi = pair<int, int>;
using Graph = vector<vector<int> >;
using WeightGraph = vector<vector<Pi> >;

string Input[100100];
const string MINUSINF = "-";


void chmax(string &a, string b) {
    if (a == MINUSINF) a = b;
    else if (a.size() < b.size()) a = b;
    else if (a.size() == b.size()) {
        if (a < b) a = b;
    }
}

int main() {
  int N, M; cin >> N >> M;
  vector<int> Use;
  for (int i = 0; i < M; i++) {
    int a; cin >> a;
    Use.push_back(a);
  }
  int A[10] = {-1, 2, 5, 5, 4, 5, 6, 3, 7, 6};

  for (int i = 0; i < 100100; i++) {
    Input[i] = MINUSINF;
  }
  
  Input[0] = "";

  for (int i = 0; i < N; i++) {
    if (Input[i] == "-") continue;
    for (auto x: Use) {
      chmax(Input[i + A[x]], Input[i] + to_string(x));
    }
  }

  cout << Input[N] << endl;
}


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

int main(){
    string s,t;
    cin >> s >> t;
    int ans=0;
    rep(i,s.size()){
        if(s.at(i)!=t.at(i)){
            ans++;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3848
//https://qiita.com/tanakh/
#[allow(unused_macros)]
macro_rules! input {
	(source = $s:expr, $($r:tt)*) => {
		let mut iter = $s.split_whitespace();
		let mut next = || { iter.next().unwrap() }; 
		input_inner!{next, $($r)*}
	};
	($($r:tt)*) => {

		let stdin = std::io::stdin();
		let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock())); 
		let mut next = move || -> String{
			bytes
				.by_ref()
				.map(|r|r.unwrap() as char) 
				.skip_while(|c|c.is_whitespace()) 
				.take_while(|c|!c.is_whitespace()) 
				.collect()
			};
	input_inner!{next, $($r)*} 
	};
}

#[allow(unused_macros)]
macro_rules! input_inner { 
	($next:expr) => {}; 
	($next:expr, ) => {};

	($next:expr, $var:ident : $t:tt $($r:tt)*) => { 
		let $var = read_value!($next, $t); 
		input_inner!{$next $($r)*}
	}; 
}
#[allow(unused_macros)]
macro_rules! read_value { 
	($next:expr, ( $($t:tt),* )) => {
		( $(read_value!($next, $t)),* ) 
	};
	
	($next:expr, [ $t:tt ; $len:expr ]) => {
		(0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
	};

	($next:expr, chars) => {
		read_value!($next, String).chars().collect::<Vec<char>>()
	};
	
	($next:expr, bytes) => {
		read_value!($next, String).into_bytes()
	};
	
	($next:expr, usize1) => { 
		read_value!($next, usize) - 1
	};

	($next:expr, $t:ty) => {
		$next().parse::<$t>().expect("Parse error")
	};
}
fn calc(a : i64) -> i64 {
    let mut count : i64 = 0;
    let mut ans : i64 = 0;
    count = (a + 1) / 2;
    ans = count % 2;
    if a % 2 == 0{
        ans = ans ^ a;
    }
    return ans;
}
fn main(){
    input!{
        a : i64,
        b : i64,
    }
    let mut ans : i64 = 0;
    ans = calc(a-1) ^ calc(b);
    println!("{}",ans)

    
}

Measured memory_bytes: 4352
#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.at(i);
	sort(D.begin(), D.end());
	int ans = D.at(N / 2) - D.at(N / 2 - 1);
	cout << ans << endl;
}

Measured memory_bytes: 640
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        int aList[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
        int bList[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
        int cList[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
        int dList[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
        try (Scanner scan = new Scanner(System.in)) {
            String inDataStr;
            while ((inDataStr = scan.nextLine()) != null && !"".equals(inDataStr)) {
                int inData = Integer.parseInt(inDataStr);
                int combi = 0;
                for (int a : aList) {
                    for (int b : bList) {
                        for (int c : cList) {
                            for (int d : dList) {
                                if (a + b + c + d == inData) {
                                    combi++;
                                }
                            }
                        }
                    }
                }
                System.out.println(combi);
            }
        } catch (Exception e) {
            System.exit(0);
        }
    }

}

Measured memory_bytes: 26788
# include <iostream>
# include <cstdio>

using namespace std;

int a[200010];

int l[200010], r[200010];
int q[200010];

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

	int top = 0;
	for(int i = 1; i <= n; ++i) {
		while(top && a[i] < a[q[top-1]]) --top;
		l[i] = top ? q[top-1] + 1 : 1;
		q[top++] = i;
	}

	top = 0;
	for(int i = n; i >= 1; --i) {
		while(top && a[i] < a[q[top-1]]) --top;
		r[i] = top ? q[top-1] - 1 : n;
		q[top++] = i;
	}

	long long ans = 0;

	for(int i = 1; i <= n; ++i) {
		ans += 1ll * a[i] * (i - l[i] + 1) * (r[i] - i + 1);
	}

	printf("%lld\n", ans);

	return 0;
}


Measured memory_bytes: 3456
using System;

namespace A_HonestOrDishonest {
    class Program {
        static void Main(string[] args) {
            // スペース区切りの整数の入力
            string[] input = Console.ReadLine().Split(' ');
            int W = int.Parse(input[0]);
            int a = int.Parse(input[1]);
            int b = int.Parse(input[2]);
            int ans = Math.Max(Math.Abs(a - b) - W, 0);
            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 11092
#include <bits/stdc++.h>
using namespace std;
int main(){


int n;
cin>>n;
if(n%10==3) cout<<"bon"<<endl;

else{

    if(n%10==0 || n%10==1||n%10==6 ||n%10==8 ) cout<<"pon"<<endl;

    else cout<<"hon"<<endl;

}






}


Measured memory_bytes: 3572
def mm_check(s):
    if 1 <= int(s) <= 12:
        return True
    return False

def main():
    S = input().rstrip('\n')

    Spre = S[:2]
    Spost = S[2:]

    pre_check = mm_check(Spre)
    post_check = mm_check(Spost)

    if pre_check and post_check:
        print('AMBIGUOUS')
    elif pre_check:
        print('MMYY')
    elif post_check:
        print('YYMM')
    else:
        print('NA')

if __name__ == '__main__':
    main()



Measured memory_bytes: 3060
/**********************************************
 * author : deepak nayan
 * file   : e:/Solutions/atcoder/abc141_a.cpp
 * time   : Sat May  2 13:31:10 2020
 * quest  : A - Weather Prediction
 *********************************************/
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>

using namespace std;

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  string s;
  cin >> s;
  cout << ((s == "Sunny") ? "Cloudy\n" : (s == "Cloudy") ? "Rainy\n" : "Sunny\n");
  return 0;
}


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


int main(){
  rep(i,0,5){
    int a;
    cin >> a;
    if(a==0){
      cout << i+1 << endl;
      return 0;
    }
  }
}



Measured memory_bytes: 3564
import java.util.Scanner;
public class Main{
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    
    int a =scan.nextInt();
     int b = scan.nextInt();
     int c = scan.nextInt();
    if(a+b+c>21){
      System.out.println("bust");
    }else{
      System.out.println("win");
    }
  }
}


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

int main() {
  int N, A;
  if (scanf("%d %d", &N, &A) < 2) {
    fprintf(stderr, "error: ill-formed fraction.\n");
    exit(1);
  }
  if (N % 500 > A) printf("No\n");
  else printf("Yes");
}


Measured memory_bytes: 384
#include<stdio.h>
int main()
{
	int n,i,a,d,t;
	t=9999;
	
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d",&a);
		if(d<a){
			d=a;
		}
		if(t>a){
			t=a;
		}
	}
	printf("%d\n",d-t);
	return 0;
}

Measured memory_bytes: 128
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using namespace std;
using ll=long long;
using ld=long double;
//#define int long long
//#define _CRT_SECURE_NO_WARNINGS
#define rep(i, n) for (int i = 0; i < n; i++)
#define _GLIBCXX_DEBUG
const int MOD = 1e9 + 7;
const int INF = 1e18 + 9;
constexpr long double pi = 3.141592653589793238462643383279;
int fact(int i) {
    if (i == 0) return 1;
    return (fact(i - 1)) * i;
}
int gcd(int a, int b) {
    if (b == 0) return a;
    return gcd(b, a % b);
}
int lcm(int a, int b) {
    return a * b / gcd(a, b);
}
int keta(int n) {
    if (n == 0) return 1;
    int count = 0;
    while (n != 0) {
        n /= 10;
        count++;
    }
    return count;
}
int ketasum(int n) {
    int sum = 0;
    while (n != 0) {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}
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;
}
int main(void){
    char data[3][3];
    rep(i, 3) {
        rep(j, 3) {
            cin >> data[i][j];
        }
    }
    cout << data[0][0] << data[1][1] << data[2][2] << endl;
    return 0;
}

Measured memory_bytes: 3568
//y09-6 ビンゴ(2回目)
#include <iostream>
#include <fstream>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <string>
#include <vector>
#include <map>
#include <list>
#include <set>
#include <stack>
#include <queue>
#include <cstdlib>
#include <algorithm>
#include <random>
#include <cassert>
using namespace std;
#define LL long long
#undef INT_MIN
#undef INT_MAX
#define INT_MIN -2147483648
#define INT_MAX 2147483647
#define LL_MIN -9223372036854775808
#define LL_MAX 9223372036854775807
#define segment_size 65536
#define ROOP() while (true)

int main(){
    ROOP(){
        int N,M,S;
        cin >> N >> M >> S;
        if(N==0) return 0;
        M = min(M,S);

        int dp[50][3001];
        for(int i=0; i<50; i++){
            for(int j=0; j<3001; j++){
                dp[i][j] = 0;
            }
        }
        dp[0][0] = 1;

        for(int i=1; i<=N*N; i++){
            for(int j=1; j<=S; j++){
                if(j>=i) dp[i][j] = dp[i-1][j-i] + dp[i][j-i];
                if(j>M) dp[i][j] -= dp[i-1][j-M-1];
                dp[i][j] %= 100000;
                if(dp[i][j]<0) dp[i][j]+=100000;
            }
        }
        cout << dp[N*N][S] << endl;

    }
    return 0;
}




Measured memory_bytes: 3620
#include <stdio.h>

int bubbleSort(int A[],int N)
{
  int count=0;
  int flag=1;
  int j,temp;

  while(flag==1){
    flag=0;
    
    for(j=N-1; j>=1; j--){
     
      if(A[j]<A[j-1]){
	temp=A[j];
	A[j]=A[j-1];
	A[j-1]=temp;
	flag=1;
	count++;
      }
    }
  }
  
  return count;
}




int main()
{
  int A[100],N,count=0,i;

  scanf("%d",&N);
  for(i=0;i<N;i++){
    scanf("%d",&A[i]);
  }
  

  count=bubbleSort(A,N);

 for(i=0;i<N;i++){
   if(i!=0){
     printf(" ");
   }
  printf("%d",A[i]);
  }
  printf("\n");
  printf("%d\n",count);


  return 0;

}


































































  
  




















Measured memory_bytes: 2064
#include <iostream>

using namespace std;

int main()
{
    int c, p5 = 0, p7 = 0;
    for(int i = 1;i <= 3;i++){
      cin >> c;
      if(c == 5){
        p5++;
      }if(c == 7){
        p7++;
      }
    }
    if(p5 == 2 && p7 == 1){
      cout << "YES";
    }else{
      cout << "NO";
    }
    return 0;
}


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

int main()
{
    ll int a,b,c,d,i,j,k,m,n,p,q,r,sum=0;

    cin>>a;

    for(i=1;i<=a;i++)
    {

        if(i%3==0||i%5==0)
            continue;
        else
        {
            sum=sum+i;
        }

    }

    cout<<sum<<endl;
    return 0;

}


Measured memory_bytes: 3584
#include<bits/stdc++.h>
#define fastio ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define range(i,l,h) for(int i=l;i<h;i++)
#define endl '\n'
#define I INT_MAX
#define L INT_MIN
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define ll long long
#define ull unsigned long long
#define vi vector<int>
using namespace std;
using std::ios;
constexpr int MOD=1e9+7;
constexpr int mod=998244353;
const int mxn=100005;

int main()
{
  fastio;
  
  
  int n;
  cin>>n;
  vi a(n);
  int l=0,ans=0,last=0;
  range(i,0,n)
  {
    cin>>a[i];
    if(i==0)
    {
      last=a[i];
      continue;
    }
    if(a[i]>a[i-1])
    {
      ans=max(ans,l);
      l=0;
      last=a[i];
    }
    else l++;
  }
   ans=max(ans,l);
      l=0;
  cout<<ans;

}


Measured memory_bytes: 3704
#include<iostream>
using namespace std;
int main()
{
    int n;
    cin>>n;
    int x,l=0;
    for(int i=1;i<=n;i++){cin>>x;if(x%2!=0)l++;}
    if(l%2==0){cout<<"YES"<<endl;}
    else cout<<"NO"<<endl;
}


Measured memory_bytes: 384
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<cmath>

using namespace std;
const int MAX=10010;

string s;

inline void input(int &x){
    int k=1; x=0; 
    char ch=0;
    while(ch<'0' || ch>'9') { ch=getchar(); if(ch=='-') k=-1; }
    while(ch>='0' && ch<='9') { x=x*10+ch-48; ch=getchar(); }
    x*=k;
}

int main(){
	cin>>s;
	if(s[0]!='A') printf("WA\n");
	else{
		if(s[1]<'a' || s[1]>'z') printf("WA\n");
		else{
			register bool f=false;
			register int i;
			for(i=2; i<s.size()-1; i++){
				if(s[i]=='C'){
					if(!f) f=true;
					else{
						printf("WA\n");
						break;
					}
				}
				else if(s[i]<'a' || s[i]>'z'){
					printf("WA\n");
					break;
				}
			}
			if(s[s.size()-1]<'a' || s[s.size()-1]>'z') printf("WA\n");
			else if(!f) printf("WA\n");
			else if(i==s.size()-1 && f) printf("AC\n");
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdint>
#include <vector>
#include <algorithm>
#include <cmath>

std::vector<int32_t> a;

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

	uint32_t n;
	std::cin >> n;
	a.resize(n);
	for (uint32_t i = 0;i < n;i++) {
		std::cin >> a[i];
		a[i] -= i;
	}
	std::sort(a.begin(), a.end());
	int32_t b = a[n / 2];
	uint64_t ans = 0;
	for (uint32_t i = 0;i < n;i++) {
		ans += std::abs(a[i] - b);
	}
	std::cout << ans << "\n";
}


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

int main()
{
    int n;
    cin >> n;
    string res = "";
    while(n != 0)
    {
        if(n % 2 == 0) res = "0" + res;
        else
        {
            res = "1" + res;
            n--;
        }
        n /= -2;
    }
    if(res == "") res = "0";
    cout << res << endl;
}

Measured memory_bytes: 3592
#include <iostream>
#include <string>
#include <vector>
#include <numeric>
#include <queue>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <sstream>
#include <stack>
#include <map>
#include <set>

#define REP(i,a) for(int i = 0;i < (a);++i)
#define FOR(i,a,b) for(int i = (a);i < (b); ++i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SIZE(obj) (int)(obj).size()
#define MAX(list) std::max(list)
#define MIN(list) std::min(list)

template<typename T>
T round_up(const T& a, const T& b) {
    return (a + (b - 1)) / b;
}

using ll = long long;
using namespace std;

int main() {
    int N, X;
    cin >> N >> X;
    vector<int> L(N);
    REP(i, N)cin >> L[i];

    int t = 0;
    int cnt = 0;
    REP(i, N) {
        t += L[i];
        cnt++;
        if (t > X)break;
    }
    if (t <= X)cnt++;

    cout << cnt << endl;

    return 0;
}

Measured memory_bytes: 256
def num():
    return int(input())
def nums():
    return list(map(int,input().split()))

import itertools as iter
import math
import fractions
from functools import reduce

def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

H = num()
W = num()
N = num()
u = max(H,W)
print(math.ceil(N/u))

Measured memory_bytes: 66284
#include <stdio.h>
/********
*	????????????????????°
*********/

/*********??¢?????´?????????
*	(1)
*	(2)???????????°i,j,k???1??????????¢?????????????????????????
*********/

int main(void)
{
	int n, x ;			//????¨???????x
	int karigoukei ;//???????¨????
	int i, j, k, h ;//


	
	while(1){				//??°?????\???
	h = 0;		//?????????
		scanf("%d %d\n", &n, &x);
		if(n == 0 && x == 0 ){
			break;
		} else {
			
			for(i = 1 ; i <= (n-2); i++ ){
				for(j= (i+1) ; j <= (n-1) ; j++ ){
					for(k = (j+1) ; k <= (n) ; k++ ){
						
						karigoukei = i + j + k;
						
						if(x == karigoukei){	//????¨???? x ??¨??????
							h++;
						} else {
							//????¨???? x ??¨???????????????
						}
					}
				}
			}
		}
		printf("%d\n", h);
	}
    return 0;
	
}

Measured memory_bytes: 1032
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		//入力値取得
		int N = scan.nextInt();
		long D = scan.nextLong();

		long[] X = new long[N];
		long[] Y = new long[N];

		for (int i = 0; i < N; i++) {
			X[i] = scan.nextLong();
			Y[i] = scan.nextLong();
		}

		//演算
		int result = 0;

		for (int i = 0; i < N; i++) {
			if (D * D >= X[i] * X[i] + Y[i] * Y[i]) {
				result++;
			}

		}


		//結果出力
		System.out.println(result);
	}
}


Measured memory_bytes: 62340
def gcd(x,y):
    ans=0
    if x < y :
        x,y=y,x
    
    if y==0:
        return x
    else:
        return gcd(y,x%y)

def prime_decomposition(x):
  i = 2
  table = []
  while i * i <= x:
    while x % i == 0:
      x //= i
      table.append(i)
    i += 1
  if x > 1:
    table.append(x)
  return table
  
a,b=map(int,input().split())

m=gcd(a,b)
ans=len(list(set(prime_decomposition(m))))+1
print(ans)

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

int main() {
  int n, x;
  cin >> n >> x;
  
  vector<int> l(n+1);
  
  for (int i = 0; i < n; i++) {
    cin >> l.at(i);
  }
  
  int bounce = 1;
  int coordinate = 0;
  
  for (int i = 0; i < n; i++) {
    coordinate += l.at(i);
    if (coordinate > x) break;
    bounce++;
  }
  
  cout << bounce << endl;
  
}

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

if N < S:
    print(-1)
    exit()
if N == S:
    print(N+1)
    exit()

rt = int(N**0.5)
for b in range(2,rt+1):
    a = 0
    n = N
    while n >= b:
        a += n%b
        n //= b
    a += n
    if a == S:
        print(b)
        exit()

d = N-S
divisors = set()
m = 1
while m*m <= d:
    if d%m == 0:
        divisors.add(m)
        divisors.add(d//m)
    m += 1

ans = INF = float('inf')

for p in divisors:
    if p > S: continue
    b = d // p + 1
    if b*b <= N: continue
    q = S - p
    if q >= b: continue
    ans = min(ans, b)

print(-1 if ans == INF else ans)

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

using namespace std;
using ll = long long;

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

int main() {
  int k, x;
  cin >> k >> x;
  if (500 * k >= x)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 256
// Author : Chi
// created : Thursday 2020-06-04
// Sawal : Practice

//header files
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

//namespaces
using    namespace __gnu_pbds;
using    namespace std;
typedef tree <int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update > ordered_set;

//macros
#define ll 		    long long
#define ss          second
#define ff          first
#define vi          vector<int>
#define vll         vector<long long>
#define pb(x)       push_back(x)
#define TEST  	    int TesT;cin>>TesT;while(TesT--)solve();
#define TEST1       solve();
#define mod         1000000007
#define aLL(x)      x.begin(),x.end()
#define r0n(i,n)    for(ll i = 0; i < n; ++i)
#define r1n(i,n)    for(ll i = 1; i <= n; ++i)
#define pdp(d,i)    fixed<<setprecision(i)<<d
#define CHI         ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define db(...)     __f(#__VA_ARGS__, __VA_ARGS__)                      //for debugging
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) { cout << name << " : " << arg1 <<'\n'; }
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...);
}
//LOVE ALGO
int n;
int dp[100001][2];
vector<int>adj[100001];
ll dfs(int s,int p,int pc){
    if(dp[s][pc]!=-1){
        return dp[s][pc];
    }
    long long ans=0;
    long long w=1;
    if(pc==0){
        for(auto i:adj[s])
            if(i != p)
                w = (w*dfs(i,s,1))%mod;
        ans+=w;
        ans%=mod;
        }
    w=1;
    for(auto i:adj[s]){
        if(i != p){
            w=(w*dfs(i,s,0))%mod;
        }
    }
    ans+=w;
    ans%=mod;
    return dp[s][pc]=ans;
}
void solve(){
    cin>>n;
    int a,b;
    memset(dp,-1,sizeof dp);
    for(int i=0;i<n-1;i++){
        cin>>a>>b;
        adj[a].pb(b);
        adj[b].pb(a);
    }
    cout<<dfs(1,-1,0);
    }
// Driver Code
int main(){
    CHI
    TEST1
    return 0;
}


Measured memory_bytes: 14848
package main

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

var sc = bufio.NewScanner(os.Stdin)

func Scanner() string {
	sc.Scan()
	return sc.Text()
}

func intScanner() int {
	n, _ := strconv.Atoi(Scanner())
	return n
}

func floatScanner() float64 {
	n, _ := strconv.ParseFloat(Scanner(), 64)
	return n
}
func stringToInt(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}
func stringSliceScanner(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = Scanner()
	}
	return a
}
func intSliceScanner(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = intScanner()
	}
	return a
}
func larger(a, b int) int {
	if a < b {
		return b
	} else {
		return a
	}
}
func smaller(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}
func max(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x < a[i] {
			x = a[i]
		}
	}
	return x
}
func min(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x > a[i] {
			x = a[i]
		}
	}
	return x
}

var mod int

func main() {
	mod = 1000000007
	buf := make([]byte, 0)
	sc.Buffer(buf, mod)
	sc.Split(bufio.ScanWords)
	a := Scanner()
	n := len(a)
	ans := n*(n-1)/2 + n + 1
	d := make(map[rune]int)
	for _, r := range a {
		d[r]++
	}
	for _, v := range d {
		ans -= v*(v-1)/2 + v
	}
	fmt.Println(ans)
}


Measured memory_bytes: 1280
#include <stdio.h>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
#include <functional>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef vector<vector<int>> v2int;
typedef vector<ll> vll;
typedef vector<vector<ll>> v2ll;
typedef list<int> liint;
typedef pair<int, int> pint;
const int INF = int(2e9);
const ll LINF = ll(2e9) * ll(2e9);
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T, class C> void chmax(T& a, C b) { a > b ? : a = b; }
template<class T, class C> void chmin(T& a, C b) { a < b ? : a = b; }



int main() {
    int n, m;
    ll  p = 1000000007;
    cin >> n >> m;
    vll x(n), y(m);
    rep(i, n) {
        cin >> x[i];
    }
    rep(i, m) {
        cin >> y[i];
    }
    ll ans_x = 0, ans_y = 0;
    vll coef_x(n - 1), coef_y(m - 1);
    coef_x[0] = n - 1;
    ll coef = n - 1 - 2;
    REP(i, 1, n - 1) {
        coef_x[i] = coef_x[i - 1] + coef;
        //if (coef - 2 > 0)
            coef -= 2;
        //else
        //    coef += 2;
    }

    coef_y[0] = m - 1;
    coef = m - 1 - 2;
    REP(i, 1, m - 1) {
        coef_y[i] = coef_y[i - 1] + coef;
       // if (coef - 2 > 0)
            coef -= 2;
       // else
       //     coef += 2;
    }

    rep(i, n - 1) {
        ans_x += abs(x[i + 1] - x[i]) * coef_x[i];
        ans_x %= p;
    }
    rep(i, m - 1) {
        ans_y += abs(y[i + 1] - y[i]) * coef_y[i];
        ans_y %= p;
    }
    cout << (ans_x * ans_y) % p << endl;
    return 0;
}

Measured memory_bytes: 3456
#include<cstdio>
inline int in();
inline void wr(int);
int main(int argc,char**argv){
#ifndef ONLINE_JUDGE
//	freopen("B.in","r",stdin);
//	freopen("B.ans","w",stdout);
#endif
	register int n=in();
	for(register int i=1;i<=9;++i)
		for(register int j=1;j<=9;++j)
			if(i*j==n){
				puts("Yes");
				return 0;
			}
	puts("No");
}
inline int in(){
	register char c=getchar();
	register int x=0,f=1;
	for(;c<'0'||c>'9';c=getchar())
		if(c=='-')f=-1;
	for(;c>='0'&&c<='9';c=getchar())
		x=(x<<1)+(x<<3)+(c&15);
	return x*f;
}
inline void wr(int x){
	if(x<0)putchar('-'),x=-x;
	if(x/10)wr(x/10);
	putchar(x%10+'0');
}


Measured memory_bytes: 128
object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val a, b = sc.next()
  if (a == b) {
    println("EQUAL")
  } else if (a.length < b.length) {
    println("LESS")
  } else if (a.length > b.length) {
    println("GREATER")
  } else if (a < b) {
    println("LESS")
  } else {
    println("GREATER")
  }
}


Measured memory_bytes: 55340