akhauriyash/Code-Regression huggingface dataset:
import java.io.*;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {
    private static final BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    private static final PrintWriter pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
    private static StringTokenizer st;

    private static int readInt() throws IOException {
        while (st == null || !st.hasMoreTokens()) st = new StringTokenizer(br.readLine());
        return Integer.parseInt(st.nextToken());
    }

    private static String readToken() throws IOException {
        while (st == null || !st.hasMoreTokens()) st = new StringTokenizer(br.readLine());
        return st.nextToken();
    }

    public static void main(String[] args) throws IOException {
        final int BLACK = 1;
        final int RED = 0;
        final int H = readInt();
        final int W = readInt();
        final int K = readInt();
        final int[][] g = new int[H][W];
        for (int i = 0; i < H; i++) {
            String line = readToken();
            for (int j = 0; j < W; j++) {
                if (line.charAt(j) == '#') g[i][j] = BLACK;
            }
        }

        int ways = 0;
        for (int rowSet = 0, rLimit = 1 << H; rowSet < rLimit; rowSet++) {  // unselected rows
            for (int colSet = 0, cLimit = 1 << W; colSet < cLimit; colSet++) { // unselected columns
                int blackCount = 0;
                for (int r = 0; r < H; r++) {
                    if ((rowSet & (1 << r)) > 0) {
                        for (int c = 0; c < W; c++) {
                            blackCount += g[r][c] & ((colSet & (1 << c)) >> c);
                        }
                    }
                }
                if (blackCount == K) {
                    ways++;
                }
            }
        }

        pw.println(ways);
        pw.close();
    }
}


Measured memory_bytes: 33152
#include <iostream>
#include <vector>
#include <utility>
#define llint long long

using namespace std;
typedef pair<llint, char> P;
typedef pair<P, llint> R;

llint n, l;
vector<R> ovec, evec;

R calc(vector<R> &vec)
{
	llint lmax = 0, rmax = 0, lcnt = 0, rcnt = 0;
	for(int i = 0; i < vec.size(); i++){
		if(vec[i].first.second == 'L') lmax = max(lmax, vec[i].first.first), lcnt++;
		else rmax = max(rmax, l-vec[i].first.first), rcnt++;
	}
	R ret = R(P(0, 0), 0);
	ret.first.first = max(lmax, rmax);
	if(lmax >= rmax) ret.second = vec[lcnt-1].second, ret.first.second = 1;
	else ret.second = vec[(int)vec.size()-rcnt].second, ret.first.second = 0;
	
	return ret;
}

int main(void)
{
	while(1){
		cin >> n >> l;
		if(n == 0) break;
		
		ovec.clear(), evec.clear();
		char c; llint p;
		for(int i = 1; i <= n; i++){
			cin >> c >> p;
			if(p % 2) ovec.push_back(R(P(p, c), i));
			else evec.push_back(R(P(p, c), i));
		}
		
		R ans = max(calc(ovec), calc(evec));
		cout << ans.first.first << " " << ans.second << endl;
	}
	
	return 0;
}


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

#define rep(i, n) for (int i = 0; i < n; ++i)
#define ALL(a) (a).begin(), (a).end()
#define rALL(a) (a).rbegin(), (a).rend()
#define SZ(x) ((int)(x).size())
using ll = long long;
using ull = unsigned long long;
using P = pair<int, int>;
using llP = pair<ll, ll>;
using DoP = pair<double, double>;
const int di[] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dj[] = {1, 0, -1, 0, 1, -1, 1, -1};
const int INF = 1 << 28;
const ll INF64 = 1ll << 55;
const int mod = 1000000007;
//const int mod = 998244353;

template <class T>inline bool chmin(T &a, const T b)
{
  if (a > b)
  {
    a = b;
    return true;
  }
  return false;
}
template <class T>inline bool chmax(T &a, const T b)
{
  if (a < b)
  {
    a = b;
    return true;
  }
  return false;
}
template <class T>inline void line_out(const vector<T> vec) {
  int n = SZ(vec);
  rep(i, n) {
    cout << vec[i];
    if(i < n-1) cout << " ";
  }
  cout << endl;
  return;
}

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

  // for prime mod
  mint inv() const
  {
    return pow(mod - 2);
  }
  mint &operator/=(const mint a)
  {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const
  {
    mint res(*this);
    return res /= a;
  }
};

int main()
{
  int n; cin >> n;
  vector<int> p(n);
  rep(i, n) cin >> p[i];

  vector<int> d(n+1);
  rep(i, n) d[p[i]]=i;
  vector<int> x(n+1, 1);

  for(int i = n-1; i > 0; --i) {
    if(d[i] < d[i+1]) x[i] = x[i+1]+1;
  }
  int max_x = *max_element(ALL(x));
  cout << n-max_x << endl;
}

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

using namespace std;
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;

int main() {

    int n; cin >> n;
    string s; cin >> s;

    int need_left = 0;
    int pointer = 0;

    for (int i = 0; i < s.size(); ++i) {
        if (s[i] == '(') {
            ++pointer;
        } else {
            if (pointer == 0) {
                ++need_left;
            } else {
                --pointer;
            }
        }
    }

    int need_right = pointer;

    string ans = "";
    for (int i = 0; i < need_left; ++i) {
        ans += '(';
    }

    ans += s;

    for (int i = 0; i < need_right; ++i) {
        ans += ')';
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define F first
#define S second
#define MP make_pair
#define pb push_back
#define endl '\n'

using namespace std;

typedef long long LL;
typedef pair< int, int > P;
typedef pair< LL, LL > LP;
typedef pair< int, P > iP;
typedef pair< P, P > PP;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1000000007;

int dx[] = {0, -1, 1, 0};
int dy[] = {-1, 0, 0, 1};

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    string s;
    cin >> s;
    for( int i = 0; i < s.size(); ++i ) {
        if( i == 4 ) cout << ' ';
        cout << s[i];
    }
    cout << endl;
    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int maxn=5e3+5;
char s[maxn];
ll dp[maxn][3];
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
    ll n;
    cin>>n;
    cin>>(s+1);
    if(n<=3)
    {
        cout<<0<<'\n';
        return 0;
    }
    ll tol=n*(n-1)*(n-2)/6;
    ll sum=0;
    for(int i=1;i<=n;i++)
    {
        for(int j=0;j<3;j++)
        dp[i][j]=dp[i-1][j];
        if(s[i]=='R')
            dp[i][0]++;
        else if(s[i]=='G')
            dp[i][1]++;
        else
            dp[i][2]++;
    }
    for(int i=1;i<=n;i++)
    {
        for(int j=i+1;j<n;j++)
        {
            if(s[i]==s[j])
                sum+=n-j;
            else
            {
                 if(j+j-i<=n)
                    sum++;
                char x='R'+'G'+'B'-s[i]-s[j];
                if(x=='R')
                {
                    sum+=dp[n][1]-dp[j][1]+dp[n][2]-dp[j][2];
                    if(j+j-i<=n&&s[j+j-i]!='R')
                    {
                        sum--;
                    }
                }
                else if(x=='G')
                {
                    sum+=dp[n][2]-dp[j][2]+dp[n][0]-dp[j][0];
                    if(j+j-i<=n&&s[j+j-i]!='G')
                    {
                        sum--;
                    }
                }
                else
                {
                    sum+=dp[n][1]-dp[j][1]+dp[n][0]-dp[j][0];
                    if(j+j-i<=n&&s[j+j-i]!='B')
                    {
                        sum--;
                    }
                }
            }
        }

    }

    cout<<tol-sum<<'\n';


}


Measured memory_bytes: 3656
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstring>
#include <cctype>
#include <cassert>
#include <limits>
#include <functional>
#include <iomanip>
#include <complex>
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
#if defined(_MSC_VER) || __cplusplus > 199711L
#define aut(r,v) auto r = (v)
#else
#define aut(r,v) __typeof(v) r = (v)
#endif
#define each(it,o) for(aut(it, (o).begin()); it != (o).end(); ++ it)
#define all(o) (o).begin(), (o).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset(m,v,sizeof(m))
#define INF 123456789
//0x3f3f3f3f
#define INFL 10000000000000000
using namespace std;
typedef vector<int> vi; typedef pair<int, int> pii; typedef vector<pair<int, int> > vpii; typedef long long ll;
template<typename T, typename U> inline void amin(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> inline void amax(T &x, U y) { if(x < y) x = y; }
typedef complex<double> P;
typedef pair<int,pii> pdii;
long long int MOD = 1000000007;


int main(void){
	int N;
	ll T;
	cin>>N>>T;
	ll ans=0;
	vector<ll> a(N);
	rep(i,N)cin>>a[i];
	a.pb(2000000000);
	
	
	for(int i=0;i<N;i++){
		ll sa=a[i+1]-a[i];
		ans=ans+min(sa,T);
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 4608
#include <bits/stdc++.h>
using namespace std;
#define watch(x) cout << (#x) << " is " << (x) << '\n'
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_bacm
#define mp mame_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pi;
typedef pair<ll, ll> pll;
typedef double db;
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a; }
//head

void solve(){
    string s;
    cin >> s;
    if (s[2] == s[3] && s[4] == s[5]) cout << "Yes\n";
    else cout << "No\n";
}

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

    //int t; cin >> t; while (t--)
        solve();
}


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

namespace CSharpSample01
{
    
    class Program
    {
    
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            int X = int.Parse(input[0]);
            int A = int.Parse(input[1]);

            if(X < A)
            {
                Console.WriteLine(0);
            }
            else
            {
                Console.WriteLine(10);
            }

        }
    }
}

Measured memory_bytes: 11092
n, k = map(int, input().split())
r, s, p = map(int, input().split())
ts = input()
hands = []

ans = 0
for i, t in enumerate(ts):
  if t == "r":
    if not i - k < 0:
      if hands[i - k] == "p":
        ans += 0
        hands.append("no")
        continue
    ans += p
    hands.append("p")
  elif t == "s":
    if not i - k < 0:
      if hands[i - k] == "r":
        ans += 0
        hands.append("no")
        continue
    ans += r
    hands.append("r")
  elif t == "p":
    if not i - k < 0:
      if hands[i - k] == "s":
        ans += 0
        hands.append("no")
        continue
    ans += s
    hands.append("s")

print(ans)


Measured memory_bytes: 4212
#include<stdio.h>
#include<stdlib.h>
#define max 10000

int main(){
  unsigned short *A,*B;

  int C[max +1];
  int n,i;
  scanf("%d",&n);

  A = malloc(sizeof(short)*n+1);
  B = malloc(sizeof(short)*n+1);

  for(i=0;i<=max;i++){
    C[i] = 0;
  }

    for(i=0;i<n;i++){
      scanf("%hu",&A[i+1]);
      C[A[i+1]]++;
    }

  for(i=1;i<=max;i++){
    C[i]=C[i]+C[i-1];
  }

  for(i=1;i<=n;i++){
    B[C[A[i]]] = A[i];
    C[A[i]]--;
  }

printf("%d",B[1]);
  for(i=2;i<=n;i++){
    printf(" %d",B[i]);
  }
  printf("\n");

  return 0;
}



Measured memory_bytes: 9620
//*************************************************************************
#include<iostream>
#include<cstdio>
#include<string>
#include<cstring>
#include<algorithm>
#include<vector>
#include<cmath>
#include<stack>
#include<queue>
#include<set>
#include<regex>

#include<map>
using namespace std;

int main(){
	int n;
	cin>>n;
	int a=n/10;
	int b=n%10;
	if (a==9 || b==9) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;

}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <sstream>
#include <algorithm>

using namespace std;

#define	numberof(a)	(sizeof(a) / sizeof(a[0]))
#define	INF		(1000000)
#define Rep(i,n) for(int i = 0; i < (n); i++ )

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

//debug
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define	show(x)	 copy( (x).begin(), (x).end(), ostream_iterator<int>(cout, ",") );	// container<int>を全て表示

using namespace std;

typedef long long ll;

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

ll kaijo( ll N )
{
	// 階乗
	if( N == 0 ) return 1;
	return N * kaijo(N - 1);
}

map<ll, ll> prime_factor(ll N)
{
	// 素因数分解
	map<ll, ll> ret;
	for( ll i = 2; i * i <= N; i++ ){
		while( N % i == 0 ){
			ret[i]++;
			N /= i;
		}
	}
	if(N != 1) ret[N] = 1;
	return ret;
}

ll gcd( ll a, ll b )
{
	// a >= b
	if( b > a ) swap(a, b);
	if( b == 0 ) return a;
	return gcd( a % b, b );
}

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

ll max( ll a, ll b )
{
	if( a > b ) return a;
	return b;
}
ll min( ll a, ll b )
{
	if( a > b ) return b;
	return a;
}

class UnionFind
{
public:
	vector<int> parent;
	vector<int> rank;

	UnionFind(int n)
	{
		Rep(i, n){
			parent.push_back(i);
			rank.push_back(1);
		}
	}
	int root(int x)
	{
		if( parent[x] != x ) parent[x] = root(parent[x]);
		return parent[x];
	}
	void unite(int x, int y)
	{
		int rx = root(x);
		int ry = root(y);
		if( rx == ry ) return;
		if( rank[rx] > rank[ry] ){
			parent[ry] = rx;
			rank[rx] += rank[ry];
		}
		if( rank[rx] <= rank[ry] ){
			parent[rx] = ry;
			rank[ry] += rank[rx];
		}
	}
};

int main()
{
	ll a = 0;
	ll b = 0;
	ll ans = 0;

	cin >> a >> b;
	ll N = b - a;
	ans = N * (N + 1) / 2 - b;
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
import sys

def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  #空白あり

n = I()
a = LI()
mod = 10**9+7

from collections import defaultdict

d = defaultdict(list)

for i in range(n+1):
    d[a[i]].append(i)

for i in range(1,n+1):
    if len(d[i]) == 2:
        b,c = d[i]  # 重複する数字があるindex

kaijou = [1]  # kaijou[i] = i!
for i in range(1,n+2):
    kaijou.append((kaijou[-1]*i) % mod)

def comb(m,i):  # comb(m,i) = m_C_i
    if m < i:
        return 0
    else:
        return (kaijou[m]*pow(kaijou[i],mod-2,mod)*pow(kaijou[m-i],mod-2,mod)) % mod

for i in range(1,n+2):
    print((comb(n+1,i)-comb(n-c+b,i-1)) % mod)

Measured memory_bytes: 103116
#include<iostream>
#include<string>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<vector>
#include<functional>
#include<iomanip>
#include<queue>
#include<cassert>
#include<tuple>
#include<set>
#include<map>
#include<list>
#include<bitset>
#include<utility>
#include<numeric>

#define PB push_back
#define all(a)  (a).begin(),(a).end()
#define ALL(v) begin(v), end(v)
#define DWN(a)  (a).begin(),(a).end(), greater<int>()
#define rep(i, m) for (int i = 0; i < m; i++)
#define REP(i, n, m) for (int i = n; i < m; i++)
#define V vector<int>
#define VV vector<V>
#define VVV vector<VV>

using namespace std;

typedef long long ll;
typedef pair<int, int> P;

const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };
const int inf = (int)1e9;
const ll INF = (ll)1e18;
const ll MOD{ (ll)1e9 + 7 };
const long double EPS = 1e-10;

int main() {
	int N, T;
	cin >> N >> T;
	vector<int> c(N), t(N), ans;
	rep(i, N) {
		cin >> c[i] >> t[i];
		if (t[i] <= T) {
			ans.push_back(c[i]);
		}
	}
	if (ans.size() > 0) {
		sort(ans.begin(), ans.end());
		cout << ans[0] << endl;
	}
	else {
		cout << "TLE" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i, s, n, m) for(int i = s; i < (int)(n); i+=m)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007
#define INF (1e5)

#define PI (acos(-1))
#define print(x) cout << x << endl
 
ll gcd(ll a, ll b) { return b ? gcd(b,a%b) : a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
typedef pair <ll,ll> P;

template <typename T> 
ostream& operator<<(ostream& os, const vector<T>& v) 
{ 
    for (int i = 0; i < (int)v.size(); ++i) { 
        os << v[i]; 
        if (i != (int)v.size() - 1) 
            os << " "; 
    } 
    return os; 
} 

int main()
{
    ll A, B;
    cin >> A >> B;
    print(max(A+B, max(A-B, A*B)));
    return 0;
}

Measured memory_bytes: 256
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <unordered_map>
#include <cstdlib>
using namespace std;
#define Ma_PI 3.141592653589793
#define eps 0.00000001
#define LONG_INF 3000000000000000000
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define REP(i,n) for(long long i = 0;i < n;++i)
#define seg_size 524288
long long dp[200000] = {};
int visited[200000] = {};
int main() {
	long long k;
	cin >> k;
	for (int i = 0;i <= k;++i) {
		dp[i] = LONG_INF;
	}
	priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>> wow;
	wow.push(make_pair(0, 0));
	while (wow.empty() == false) {
		pair<int, int> now = wow.top();
		wow.pop();
		if (visited[now.second] == 0) {
			visited[now.second] = 1;
			if (now.second != 0&&dp[(now.second * 10) % k] > now.first) {
				dp[(now.second * 10)%k] = now.first;
				wow.push(make_pair(now.first,(now.second*10)%k));
			}
			if (dp[(now.second + 1)% k] > now.first+1) {
				dp[(now.second + 1) % k] = now.first + 1;
				wow.push(make_pair(now.first+1, (now.second + 1)%k));
			}
		}
	}
	cout << dp[0] << endl;
	return 0;
}

Measured memory_bytes: 2044
#include "bits/stdc++.h"

using namespace std;

#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl

typedef long long ll;
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
template<class S, class T> pair<S, T> operator+(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first + t.first, s.second + t.second); }
template<class S, class T> pair<S, T> operator-(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first - t.first, s.second - t.second); }
template<class S, class T> ostream& operator<<(ostream& os, pair<S, T> p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
#define X first
#define Y second
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define rep1(i,n) for(ll i=1;i<=(ll)(n);i++)
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define rrep1(i,n) for(ll i=(ll)(n);i>0;i--)
#define REP(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define in(x, a, b) (a <= x && x < b)
#define all(c) c.begin(),c.end()
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; }
#define UNIQUE(v) v.erase(std::unique(v.begin(), v.end()), v.end());
const ll inf = 1000000001;
const ll INF = 1e18;
const ll MOD = 1000000007;
const double pi = 3.14159265358979323846;
#define Sp(p) cout<<setprecision(15)<< fixed<<p<<endl;
int dx[4] = { 1,0, -1,0 }, dy[4] = { 0,1,0,-1 };
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };
#define fio() cin.tie(0); ios::sync_with_stdio(false);
#define mp make_pair



int main () {
  ll d, g;
  cin >> d >> g;
  vl p(d), c(d);
  rep (i, d) {
    cin >> p[i] >> c[i];
  }
  vi idx(d);
  rep1 (i, d) {
    idx[i - 1] = i;
  }
  ll res = INF;
  do {
    ll sum = 0;
    ll cnt = 0;
    rep (i, d) {
      if (sum >= g) {
        break;
      }
      int j = idx[i];
      ll nokori = g - sum;
      if (nokori > p[j - 1] * j * 100) {
        cnt += p[j - 1];
        sum += p[j - 1] * j * 100;
        sum += c[j - 1];
      }
      else {
        if (nokori % (j * 100) == 0) {
          cnt += nokori / (j * 100);
          sum += j * nokori / (j * 100) * 100;
        }
        else {
          cnt += nokori / (j * 100) + 1;
          sum += j * (nokori / (j * 100) + 1) * 100;
        }
      }
    }
    chmin(res, cnt);
    
          
  }while (next_permutation(all(idx)));
  cout << res << endl;
}


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

int main(){
  long  sum=0,x,amin=10000000001;
  int cnt=0,N;
  cin >> N ;
  for(int i=0;i<N;i++){
    cin >> x;
    sum+=abs(x);
    if(x<=0){cnt++;}
    amin=min(amin,abs(x));
  }
  if(cnt%2==1)sum-=2*amin;
  cout << sum << endl;
  return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int main(){
    while(1){
        string s; cin >> s;
        if(s == "-") break;
        int m; cin >> m;
        for(int i = 0; i < m; i++){
            int h; cin >> h;
            s = s.substr(h) + s.substr(0,h);
        }
        cout << s << endl;
    }
}


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

int main(){
  ll n;
  while(cin>>n,n){
    bool a[50][30]={};
    ll m,g[50]={};
    for(ll i=0;i<n;i++){
      cin>>m;
      for(ll j=0,x;j<m;j++){
	cin>>x,x--;
	a[i][x]=1;
	g[x]|=1LL<<i;
      }
    }
    ll ans=-1,f=1,c[50]={};
    for(ll i=0;i<30&&f;i++)
      for(ll j=0;j<n;j++){
	if(a[j][i])
	  for(ll k=0;k<n;k++)
	    if(a[k][i])c[j]|=c[k]|g[i];
	if(c[j]+1==(1LL<<n))f=0,ans=i+1;
      }
    cout<<ans<<endl;
  }
  return 0;
}

Measured memory_bytes: 3000
#include<iostream>
#include<map>
#include<vector>
using namespace std;

int main() {
	int N, M;
	cin >> N >> M;
	vector<int> A(N);
	for (int i = 0; i < A.size(); i++)
	{
		cin >> A[i];
	}
	
	map<int, int> m;
	vector<int> SUM(N + 1);
	SUM[0] = 0;
	for (int i = 0; i < N; i++)
	{
		SUM[i + 1] = (SUM[i] + A[i]) % M;
	}

	long long ans = 0;
	for (int i = 0; i < SUM.size(); i++)
	{
		ans += m[SUM[i]];
		m[SUM[i]]++;
	}

	cout << ans << endl;
}

Measured memory_bytes: 3968
# include <cstdio>
# include <iostream>
# define R register int

using namespace std;

const int maxn=200005;
const int mod=1e9+7;
int n,k;
int a[maxn],b[maxn];
int s[4010][4010],ans;
int f[10010],inv[10010];

int ad (int a,int b) { a+=b; if(a>=mod) a-=mod; return a; }

int qui (int a,int b)
{
    int s=1;
    while(b)
    {
        if(b&1) s=1LL*s*a%mod;
        a=1LL*a*a%mod;
        b>>=1;
    }
    return s;
}

int C (int x,int y)
{
	return 1LL*f[x]*inv[y]%mod*inv[x-y]%mod;
}

int main()
{
    scanf("%d",&n);
    for (R i=1;i<=n;++i)
    {
        scanf("%d%d",&a[i],&b[i]);
        k=max(a[i],k); k=max(b[i],k);
    }
    f[0]=1; for (R i=1;i<=4*k;++i) f[i]=1LL*f[i-1]*i%mod;
    inv[4*k]=qui(f[4*k],mod-2);
    for (R i=4*k;i>=1;--i) inv[i-1]=1LL*inv[i]*i%mod;
    k++;
    for (R i=1;i<=n;++i)
        s[ -a[i]+k ][ -b[i]+k ]++;
    for (R i=1;i<=2*k;++i)
        for (R j=1;j<=2*k;++j)
            s[i][j]=ad(ad(s[i][j],s[i-1][j]),s[i][j-1]);
    for (R i=1;i<=n;++i)
        ans=ad(ans,s[ a[i]+k ][ b[i]+k ]);
    for (R i=1;i<=n;++i)
        ans=(ans-C(2*a[i]+2*b[i],2*a[i])+mod)%mod;
    printf("%lld",1LL*ans*qui(2,mod-2)%mod);
    return 0;
}

Measured memory_bytes: 64640
import collections
import math

def comb(n, r):
  if n < r:
      return 0
  return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


N=input()
a = list(map(int, input().split()))
c = collections.Counter(a)

ans = sum([comb(v, 2) for v in c.values()])
for ai in a:
    print(ans - c[ai] + 1)


Measured memory_bytes: 26780
#include <cmath>
#include <cstdio>

using namespace std;

int main() {

	int n=0;
	double S=0, x[20], y[20];

	while(scanf("%lf, %lf", &x[n], &y[n])!=EOF) {
		n++;
	}
	for(int i=1; i<n-1; i++) {
		double a=sqrt(pow(x[0]-x[i], 2)+pow(y[0]-y[i], 2));
		double b=sqrt(pow(x[i]-x[i+1], 2)+pow(y[i]-y[i+1], 2));
		double c=sqrt(pow(x[i+1]-x[0], 2)+pow(y[i+1]-y[0], 2));
		double z=(a+b+c)/2;
		S+=sqrt(z*(z-a)*(z-b)*(z-c));
	}

	printf("%.6f\n", S);

	return 0;

}

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

int main() {
  char x,y;
  cin >> x >> y;
  if(x > y) cout << ">" << endl;
  else if(x < y) cout << "<" << endl;
  else cout << "=" << endl;
}

Measured memory_bytes: 3640
n, k = map(int, input().split())
E = list(map(lambda x: (x + 1) * 0.5, list(map(int, input().split()))))
esum = sum(E[:k])
ans = esum
for i in range(n - k):
    esum = esum - E[i] + E[i + k]
    ans = max(ans, esum)
print(ans)


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

int main() {
  int a,b;
  cin>>a>>b;
  string x[a];
  for(int i=0;i<a;i++) cin>>x[i];
  bool r[a]={},c[b]={};
  for(int i=0;i<a;i++){
    for(int k=0;k<b;k++){
  if(x[i][k]=='#') r[i]=true,c[k]=true;
    }
  }
  for(int i=0;i<a;i++){
  if(r[i]) {
    for(int k=0;k<b;k++){
    if(c[k]) cout<<x[i][k];
    	}
   cout<< endl;
	  }
  	}
}

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

int main(){
    string a,b,c;cin >> a >> b >> c;
    a.at(0) = toupper(a.at(0));
    b.at(0) = toupper(b.at(0));
    c.at(0) = toupper(c.at(0));
    cout << a.at(0) << b.at(0) << c.at(0) << endl;
	return 0;
}

Measured memory_bytes: 256
/*bismillah ->                                                                                                         << Suirkhanov Meyirlan >>
  GL HF


                                                                                                                      42

    bless my code =)
                                                                                                            NEVER FOLLOW YOUR RULES :D HAHAHAHA
*/


///scanf ("%d%d", &x, &y);
///printf("%d", &a)

#include <bits/stdc++.h>

#define fast ios_base::sync_with_stdio();   cin.tie(0);   cout.tie(0);
#define randoperation srand(time(0));
#define pii pair < int , int >
#define pll pair < ll, ll >
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define fast ios_base::sync_with_stdio();   cin.tie(0);   cout.tie(0);
#define randoperation srand(time(0));

using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

const ll N = 1e3 + 7;
const ld pi = 3.14159265359;
const int INF = (1 << 20) + 7;
const double eps = 1e-9;

const int xi[4] = {-1, 0, +1, 0};
const int yj[4] = {0, +1, 0, -1};
const int xxi[4] = {+1, 0, -1, 0};
const int yyj[4] = {0, -1, 0, +1};

ll n;

int main(){

  //freopen("bridge.in", "r", stdin);
  //freopen("bridge.out", "w", stdout);

  fast
  randoperation;

  ///           ||
  ///start here \/

  cin >> n;
  
  if(n % 2 == 0){
    cout << n;
    return 0;
  }
  else{
    cout << n * 2;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#ifndef ONLINE_JUDGE
#include"custom_header.h"
#else
#define openfile 
#endif
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
#define ll long long
#define ld long double
#define fo(i,v,e) for(v=i;v<e;v++)
#define rfo(i,v,e) for(v=i;v>e;v--)
#define pll pair<ll,ll>
#define all(x) x.begin(),x.end()
#define vl vector<ll>
#define sz(x) (ll)x.size()
#define vvl vector<vl>
#define vpl vector<pll>
const ll mod = 1000000007;
const ll N = 3005;
ll dp[N][N][4];
void solve()
{
    ll n,m,i,j,k,x,y;cin>>n>>m>>k;
    vvl mat(n,vl(m,0));
    fo(0,i,k)
    {
        cin>>x>>y>>j;
        x--;y--;
        mat[x][y] = j;
    }
    dp[0][0][1] = mat[0][0];
    fo(0,i,n)
    {
        fo(0,j,m)
        {
            if(j>0)
            {
                dp[i][j][0] = dp[i][j-1][0];
                dp[i][j][1] = max(dp[i][j-1][1],dp[i][j-1][0]+mat[i][j]);
                dp[i][j][2] = max(dp[i][j-1][2],dp[i][j-1][1]+mat[i][j]);
                dp[i][j][3] = max(dp[i][j-1][3],dp[i][j-1][2]+mat[i][j]);
            }
            if(i>0)
            {
                ll temp = max({dp[i-1][j][0],dp[i-1][j][1],dp[i-1][j][2],dp[i-1][j][3]});
                dp[i][j][0] = max(dp[i][j][0],temp);
                dp[i][j][1] = max(dp[i][j][1],temp+mat[i][j]);
            }
        }
    }
    cout<<max({dp[n-1][m-1][0],dp[n-1][m-1][1],dp[n-1][m-1][2],dp[n-1][m-1][3]});
}
int main()
{
    // openfile;fastio;
    ll T = 1; 
    // cin>>T;
    while(T--)
    {solve();}
}

Measured memory_bytes: 355028
#include <bits/stdc++.h>
#define ALL(a)  (a).begin(),(a).end()
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<long long, long long> Pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
template <typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template <typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
const int INT_INF = 1LL << 30;

ll count(ll n){
  if(n % 2 == 1) return 0LL;

  return 1LL + count(n/2);
}

int main(){
  ll N;
  cin >> N;
  vll a(N);
  ll ans = 0;
  for(int i = 0; i < N; i++){
    cin >> a.at(i);
    ans += count(a.at(i));
  }
  cout << ans << endl;

}

Measured memory_bytes: 384
#include<iostream>

using namespace std;

char map[7][7];
char tem[7][7];

int main()
{
	int h,w,k;
	cin>>h>>w>>k;
	int cnt = 0;
	for(int i=0; i<h; i++) 
	{
		scanf("%s",map[i]);
		for(int j=0; j<w; j++) 
		{
			if(map[i][j] == '#') cnt++;
		}
	}
//	cout<<cnt<<endl;
	int ans = 0;
	for(int i=0; i<(1<<h); i++)
	{
		for(int j=0; j<(1<<w); j++)
		{
			int res = 0;
			for(int a=0; a<h; a++)
			{
				for(int b=0; b<w; b++)
				{
					if( (((1<<a)&i) || ((1<<b)&j)) && map[a][b] == '#' ) res++;
				}
			}
			if(cnt - res == k) 
				ans++;
//			if(i == 1 && j == 1) cout<<res<<endl;
		}
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 3216
'use strict'

function main(s) {

  s = s.split('\n')[0].split(' ').map(n => Number(n));

  const a = s[0];
  const b = s[1];
  const ans = (a % b === 0) ? -1 : a;

  console.log(ans);
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 7372
#include <bits/stdc++.h>
using namespace std;
#define ALL(x) (x).begin(),(x).end()
#define COUT(x) cout<<(x)<<"\n"
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define REP(i, n) for(int i=0;i<n;i++)
#define YES(x) cout<<(x?"YES":"NO")<<"\n"
#define Yes(x) cout<<(x?"Yes":"No")<<"\n"
#define dump(x) cout<<#x<<" = "<<(x)<<"\n"
#define endl "\n"
using G = vector<vector<int>>;
using M = map<int,int>;
using P = pair<int,int>;
using PQ = priority_queue<int>;
using PQG = priority_queue<int,vector<int>,greater<int>>;
using V = vector<int>;
using ll = long long;
using edge = struct { int to; int cost; };
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

int main() {
  IOS;
  int n; cin >> n;
  int ma = 0;
  int mab;
  REP(i,n) {
    int a,b;
    cin >> a >> b;
    if (ma < a) { ma = a; mab = b; }
  }
  COUT(ma + mab);

  return 0;
}

Measured memory_bytes: 3560
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <climits>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
using namespace std;

#define rep(i,n) for(ll (i)=0;(i)<(n);(i)++ )
#define repf(i,m,n) for(ll (i)=m;(i)<n;(i)++)
#define all(v) (v).begin(), (v).end()
#define ll long long
#define vec(name,num) vector<ll> name((num),0);
#define op(i) cout<<(i)<<endl;
#define opf(i) cout<<fixed<<setprecision(10)<<(i)<<endl;
#define ip(i) cin>>(i);
#define opN cout<<"No"<<endl;
#define opY cout<<"Yes"<<endl;
#define opP cout<<"Possible"<<endl;
#define opI cout<<"Impossible"<<endl;
#define mat(name,fnum,snum); vector<vector<ll>> name((fnum),vector<ll>((snum),0));
#define matC(name,fnum,snum); vector<vector<char>> name((fnum),vector<char>((snum),0));
#define debugP int debug_point; cin>>debug_point;
#define FI first
#define SE second
const ll MOD= 1e9 + 7;

//
void solve(long long A, long long B){
  if(A>0&&A<10&&B>0&&B<10){
    op(A*B)
  }else{
    op(-1)
  }
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long A;
    scanf("%lld",&A);
    long long B;
    scanf("%lld",&B);
    solve(A, B);
    return 0;
}


Measured memory_bytes: 256
/*BISMILLAH
THE WHITE WOLF
NO DREAM IS TOO BIG AND NO DREAMER IS TOO SMALL*/

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<long long> vll;
typedef vector<int> vi;

#define io ios_base::sync_with_stdio(false)
#define pb push_back

#define eb emplace_back
#define mod   1000000007
#define PI 2*acos(0.0)
#define all(r)(r).begin(),(r).end()
#define dbg(a) cout<<#a<<" ->->->-> "<<a<<"\n"
#define inf 1000000000000000000
#define N 500000
int dirx[] = {1, -1,0, 0, 1, 1, -1, -1}, diry[] = {0, 0, 1, -1, 1, -1, 1, -1};



//=============================================ASIFAZAD==============================================//


int32_t main()
{
    io;
    string s;
    cin>>s;
    if(s.back() == 's')
        s += "es";
    else
        s += "s";
    cout<<s;
    return 0;
}


Measured memory_bytes: 3636
#include <iostream>
#include <algorithm>
#include <climits>
#include <vector>
#include <utility>
#include <functional>
#include <map>
#include <string>
#include <set>
#include <math.h>

using namespace std;

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

  int a, b, k;
  cin >> a >> b >> k;

  set<int> set;
  for (int i = 0; i < k; i++) {
    int x = a + i;
    int y = b - i;

    if (x <= b) {
      set.insert(x);
    }
    if (a <= y) {
      set.insert(y);
    }
  }

  for (auto s : set) {
    cout << s << endl;
  }
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-

###
# main
if(__name__ == '__main__'):
    # input
    x, y, z = map(int, input().split(" "))

    x, y = y, x
    x, z = z, x

    print(str(x)+" "+str(y)+" "+str(z))

# else:
    # do nothing


Measured memory_bytes: 2940
#include <bits/stdc++.h>
#define ll long long
#define double long double
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define mod (ll)(1e9+7)
#define inf (ll)(3e18+7)
#define pi (double) acos(-1)
#define P pair<int,int>
#define PiP pair<int,pair<int,int>>
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
using namespace std;

class UnionFind {
public:
	vector < ll > par;
	vector < ll > siz;
	UnionFind(ll sz_) : par(sz_), siz(sz_, 1) {
		for (ll i = 0; i < sz_; ++i) par[i] = i;
	}
	void init(ll sz_) {
		par.resize(sz_);
		siz.assign(sz_, 1);
		for (ll i = 0; i < sz_; ++i) par[i] = i;
	}
	ll root(ll x) {
		while (par[x] != x) {
			x = par[x] = par[par[x]];
		}
		return x;
	}
	bool unite(ll x, ll y) {
		x = root(x);
		y = root(y);
		if (x == y) return false;
		if (siz[x] < siz[y]) swap(x, y);
		siz[x] += siz[y];
		par[y] = x;
		return true;
	}
	bool same(ll x, ll y) {
		return root(x) == root(y);
	}
	ll size(ll x) {
		return siz[root(x)];
	}
};

int main() {
    int n, m, k;
    cin >> n >> m >> k;
    vector<ll> a(m), b(m), c(k), d(k), num(n, 1), fri(n, 0), bl(n, 0);
    UnionFind tree(n);
    rep(i, m){
        cin >> a.at(i) >> b.at(i);
        a[i]--; b[i]--;
        tree.unite(a[i], b[i]);
        fri[a[i]]++;
        fri[b[i]]++;
    }
    rep(i, k){
        cin >> c.at(i) >> d.at(i);
        if(tree.same(c[i]-1, d[i]-1)){
            bl[c[i]-1]++;
            bl[d[i]-1]++;
        }
    }
    rep(i, n)cout << tree.size(i)-fri[i]-bl[i]-1 << " ";
    cout << endl;
}


Measured memory_bytes: 7936
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll,ll> Pl;
#define all(a) (a).begin(),(a).end()
#define rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=(a);i<(b);i++)
#define rrep(i,n) for(ll (i)=(n)-1;(i)>=0;i--)
#define SHOW(x) cout << #x << ": " << x << endl;
const ll INF=1e18,MOD = 1e9+7;
const int iINF = 1e9;

int main(){   
    ll h;
    cin>>h;
    ll cmp = 2,ans = 1;
    while(cmp <= h){
        cmp *= 2;
        ans = ans * 2 + 1;
    }
    cout<<ans<<endl;



}


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


def lcm(x,y):
    return x/gcd(x, y)*y


while True:
    try:
        x, y = map(int, raw_input().split())
    except EOFError:
        break

    print "%d %d" % (gcd(x, y), lcm(x, y))

Measured memory_bytes: 6452
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;

namespace kyoupuro
{
    class MainClass
    {
        public static void Main()
        {
            MainClass mainClass = new MainClass();
            //var myarray = mainClass.IntInit();
            var myarray = new List<int>(Console.ReadLine().Split(' ').Select(int.Parse));
            mainClass.Start(myarray);
        }

        List<List<String>> Init() {
            int maxindex = int.Parse(Console.ReadLine());

            List<List<String>> array = new List<List<String>>();

            for (int i = 0; i < maxindex; i++)
                array.Add(new List<String>(Console.ReadLine().Split(' ')));

            return array;
        }

        List<List<int>> IntInit() {
            int maxindex = int.Parse(Console.ReadLine());

            List<List<int>> array = new List<List<int>>();

            for (int i = 0; i < maxindex; i++) {
                array.Add(new List<int>(
                    Console.ReadLine().Split(' ').Select(int.Parse)));
            }

            return array;
        }

        void Start(List<int> e) {
            if (e[1] % e[0] == 0) Console.WriteLine(e[1] + e[0]);
            else Console.WriteLine(e[1] - e[0]);

        }
    }
}


Measured memory_bytes: 11220
#include <bits/stdc++.h>
#define pb push_back
#define cmin(a,b) (a>b?a=b:a)
#define cmax(a,b) (a<b?a=b:a)
#define lop(i,s,t) for(int i=s;i<(t);++i)
#define rep(i,s,t) for(int i=s;i<=(t);++i)
#define dec(i,s,t) for(int i=s;i>=(t);--i)
#define fore(i,v) for(int i=g[v],d=es[i].d;i;i=es[i].nxt,d=es[i].d)
using namespace std;

#define Pr(f,...) printf(f,##__VA_ARGS__),fflush(stdout)

typedef long long ll;

const int N=1e5+50; 

int n,a[N],c[N],fail; 

void chk(bool x){ if(!x)fail=1; }

int main(int argc,char *argv[]){
#ifdef CURIOUSCAT
	//freopen("dat.in","r",stdin);
	//freopen("my.out","w",stdout);
#endif
	scanf("%d",&n); 
	rep(i,1,n){
		scanf("%d",a+i); 
		++c[a[i]];
	}
	rep(i,1,n){
		if(c[i]){
			if(c[i]+c[i+1]!=n)fail=1;
			else{
				int y=i+1-c[i]; 
				chk(c[i+1]>=2*y); 
				chk(y>=0); 
				if(y==0)chk(c[i+1]==0); 
				chk(y-1==i-c[i]); 
				if(c[i+1]==0){
					if(i<=n/2)fail=0; 
				}
			}
			break;
		}
	}
	puts(fail?"No":"Yes"); 
	return 0; 
}


Measured memory_bytes: 1024
import java.util.Scanner;
 
public class Main {
  public static void main(String[] args ) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int i =1;
    if (N==0) {
      System.out.println(i);
    } else {
      i = i + 1;
      N = sc.nextInt();
      if (N==0) {
        System.out.println(i);
   	  } else {
        i = i + 1;
        N = sc.nextInt();
        if (N==0) {
     	 System.out.println(i);
   		 } else {
     		 i = i + 1;
     		 N = sc.nextInt();
          	if (N==0) {
      			System.out.println(i);
   			 } else {
     			 i = i + 1;
     			 System.out.println(i);
   			 }
          }
      }
  }
}
}




Measured memory_bytes: 27016
/* cerberus97 - Hanit Banga */

#include <iostream>
#include <iomanip>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>

using namespace std;

#define pb push_back
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL)

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

const int N = 2e5 + 10;

int a[N], b[N];

void fail();

int main() {
	fast_cin();
	int n; cin >> n;
	for (int i = 0; i < n; ++i) {
		cin >> a[i];
	}
	priority_queue<pii> pq;
	for (int i = 0; i < n; ++i) {
		cin >> b[i];
		pq.push({b[i], i});
	}
	ll ans = 0;
	while (!pq.empty()) {
		auto cur = pq.top();
		pq.pop();
		int i = cur.second;
		if (b[i] == a[i]) {
			continue;
		} else if (b[i] < a[i]) {
			fail();
		}
		int l = (i + n - 1) % n, r = (i + 1) % n;
		ll t = (b[i] - a[i]) / (b[l] + b[r]);
		if (t == 0) {
			fail();
		}
		ans += t;
		b[i] -= t * (b[l] + b[r]);
		pq.push({b[i], i});
	}
	cout << ans << endl;
}

void fail() {
	cout << -1 << endl;
	exit(0);
}

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

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

using namespace std;

template<class G>
class Fenwick_tree_dual{
	vector<G> a;
public:
	Fenwick_tree_dual(int n):a(n){}
	void add(int l,int r,G val){
		if(l==0){
			for(;r>0;r-=r&-r) a[r-1]+=val;
			return;
		}
		add(0,r,val);
		add(0,l,-val);
	}
	G sum(int i){
		G res{};
		for(i++;i<=a.size();i+=i&-i) res+=a[i-1];
		return res;
	}
};

struct interval{
	int l,r;
	bool operator<(const interval& I)const{ return r-l<I.r-I.l; }
};

int main(){
	int n,m; scanf("%d%d",&n,&m);
	vector<interval> I(n);
	rep(i,n) scanf("%d%d",&I[i].l,&I[i].r), I[i].r++;

	sort(I.begin(),I.end());

	int idx=0;
	Fenwick_tree_dual<int> F(m+1);
	for(int d=1;d<=m;d++){
		while(idx<n && I[idx].r-I[idx].l<=d){
			F.add(I[idx].l,I[idx].r,1);
			idx++;
		}

		int ans=n-idx;
		for(int x=d;x<=m;x+=d) ans+=F.sum(x);
		printf("%d\n",ans);
	}

	return 0;
}


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

using namespace std;

int main()
{
    string op;
    int A,B;
    cin >>A;
    cin >>op;
    cin >>B;
    if(op == "+")
    {
        cout <<A+B<<endl;
    }
    else if(op == "-")
    {
        cout << A-B <<endl;
    }
    return 0;

}


Measured memory_bytes: 256
#include<stdio.h>

int main()

{
    char a;
    scanf("%c",&a);

    switch(a)
    {
    case 'a':
    case 'e':
    case 'i':
    case 'o':
    case 'u': printf("vowel");
            break;

    default :

        printf("consonant");

    }

    return 0;
}

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

int main(){

  string s;
  int sum;
  string prev;
  int n;


  while(cin >> n){
    if(n==0){break;}
    sum=0;

    cin >> s;
    prev = s;

    for(int i=1; i<n; i++){
      cin >> s;
      if((prev=="lu"&&s=="ru") || (prev=="ru"&&s=="lu") || 
	 (prev=="ld"&&s=="rd") || (prev=="rd"&&s=="ld")){
	sum++;
      }
      prev = s;
    }

    cout << sum << endl;

  }

  return 0;
}

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



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

    if((a[0]==0&&a[1]==0&&a[2]==0)||(a[3]==0&&a[4]==0&&a[5]==0)||(a[6]==0&&a[7]==0&&a[8]==0)||(a[0]==0&&a[3]==0&&a[6]==0)||(a[1]==0&&a[4]==0&&a[7]==0)||(a[2]==0&&a[5]==0&&a[8]==0)||(a[0]==0&&a[4]==0&&a[8]==0)||(a[2]==0&&a[4]==0&&a[6]==0)){
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include<list>
#include <algorithm>
#include <string>
#include <math.h>
#include<map>
#include <utility>

#include<queue>
using namespace std;
#define REP(i,k,n) for(int i=k;i<n;i++)
 
#define INF (1e10)
typedef long long unsigned int ll;
#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))
#define MOD 1000000007

template<typename T>
int vector_finder(std::vector<T> vec, T number) {
  auto itr = std::find(vec.begin(), vec.end(), number);
  size_t index = std::distance( vec.begin(), itr );
  if (index != vec.size()) { // 発見できたとき
    return 1;
  }
  else { // 発見できなかったとき
    return 0;
  }
}

template<typename T>
T gcd(T a,T b){
	if(b>0){
		return gcd(b, a % b);
	}else{
		return a;
	}
}

template<typename T>
T lcm(T a,T b){
	T g = gcd(a, b);
	return a * b / g;
}

void clear( std::queue<pair<int,int> > &q )
{
   std::queue<pair<int,int> > empty;
   std::swap( q, empty );
}
bool IsPrime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return false;
        }
    }

    // 素数である
    return true;
}
template<typename T>
std::vector<T> enum_div(T n)//nの約数を列挙
{
	std::vector<T> ret;
	for(T i=1 ; i*i<=n ; ++i)
	{
		if(n%i == 0)
		{
			ret.push_back(i);
			if(i!=1 && i*i!=n)
			{
				ret.push_back(n/i);
			}
		}
	}
	return ret;
}

int N,M;


int main()
{
  cin>>N;
  long long a[N];
  long long mx=0;
  int idx=0;
  REP(i,0,N){
    cin>>a[i];
    if(a[i]>mx){
      mx=a[i];
      idx=i;
    }
  }

  long long mx2=mx/2;
  long long dif=INF;
  int id=0;
  REP(i,0,N){
    if(dif>abs(a[i]-mx2)){
      dif=abs(a[i]-mx2);
      id=i;
    }

  }

  
  if(a[idx]==100&&a[id]==100){
    cout<<100<<" "<<0<<endl;
  }else{
    cout<<a[idx]<<" "<<a[id]<<endl;
  }




  return 0;
}

Measured memory_bytes: 1024
N,D=map(int,input().split())
X=[list(map(int,input().split())) for i in range(N)]
D+=1e-12
P=0
for i in range(N):
  if D>=(X[i][0]*X[i][0]+X[i][1]*X[i][1])**0.5:
    P+=1
print(P)


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

using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef long double ld;

#define fi first
#define se second
#define pb push_back
#define mp make_pair

const int MOD = 1e9 + 7;

void zero()
{
	cout << "Zero";
}
void positive()
{
	cout << "Positive";
}
void negative()
{
	cout << "Negative";
}

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	int a, b;
	cin >> a >> b;
	if(a <= 0 && b >= 0) 
	{
		zero();
		return 0;
	}
	if(a == 0 || b == 0)
	{
		zero();
		return 0;
	}
	if(a > 0)
	{
		positive();
		return 0;
	}
	if(b < 0)
	{
		b = -b; a = -a;
		if((a-b)%2)
		{
			positive();
		}
		else
		{
			negative();
		}
		return 0;
	}
	return 0;
}


Measured memory_bytes: 256