akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
int main(){
  int z,i,ans=0;
  cin>>z;
  vector<int> y(z);
  for(i=0;i<z;i++) cin>>y.at(i);
  sort(y.begin(),y.end());
  reverse(y.begin(),y.end());
  for(i=0;i<z;i++){
    if(i%2==0) ans+=y.at(i);
    else ans-=y.at(i);
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 3576
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		int N = scan.nextInt();
		int a[] = new int[N];

		for(int i = 0; i < N; i++) {
			a[i] = scan.nextInt();
		}

		int max = 0;
		int count = 0;

		for(int i  = 0; i < N - 1; i++) {
			if(a[i + 1] <= a[i]) {
				count++;
			}else {
				count = 0;
			}
			if(max < count) {
				max = count;
			}
		}
		System.out.println(max);
	}
}

Measured memory_bytes: 50952
#include <algorithm>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for(int(i) = 0; (i) < (n); (i)++)
#define FOR(i, m, n) for(int(i) = (m); (i) < (n); (i)++)
#define All(v) (v).begin(), (v).end()
#define pb push_back
#define MP(a, b) make_pair((a), (b))
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const int INF = 1 << 30;
const ll LINF = 1LL << 60;
const int MOD = 1e9 + 7;

int main() {
    string s, t;
    cin >> s >> t;
    ll N = s.size();
    vector<vector<ll>> dict(N, vector<ll>(26, INF));
    // dict[i][j]:=i文字目以降で、jが初めて出てくる位置
    for(int i = N - 1; i >= 0; i--) {
        if(i != N - 1) {
            rep(j, 26) { dict[i][j] = dict[i + 1][j]; }
        }
        char c = s[i];
        dict[i][c - 'a'] = i;
    }

    ll cur = 0;
    ll res = 0;
    for(int i = 0; i < t.size(); i++) {
        int c = t[i] - 'a';
        if(dict[0][c] == INF) {
            cout << -1 << endl;
            return 0;
        }
        if(dict[cur][c] != INF) {
            cur = dict[cur][c] + 1;
        } else {
            cur = 0;
            res++;
            cur = dict[cur][c] + 1;
        }
        if(cur >= N) {
            cur = 0;
            res++;
        }
    }
    cout << res * N + cur << endl;

    return 0;
}

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

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int x;
    cin >> x;
    int n = 1;
    while(true) {
        if((n * x) % 360 == 0) {
            cout << n << "\n";
            break;
        } else {
            n++;
        }
    }
    return 0;
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
#define all(a) a.begin(),a.end()
#define P pair<long long,long long>
#define double long double
using namespace std;
signed main(){
  int a,b,c;
  cin>>a>>b>>c;
  int d=max(a,b);
    int e=min(a,b);
    int f=max(d,c);
  int g=min(e,c);
  cout<<f-g;
}

Measured memory_bytes: 256
//#define _LIBCPP_DEBUG 0
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <regex>
#define rep(i,n) for(int i = 0; i < n; i++)
#define reps(i,j,n) for(int i = j; i < n; i++)
#define rrep(i,j,n) for(int i = j-1; i >= n; i--)
#define prec(n) fixed << setprecision(n)
#define print_array(v) rep(__k, v.size()) { cout << v[__k]; if(__k != v.size()-1) cout << " "; else cout << endl; }
#define YesorNo(a) printf(a?"Yes\n":"No\n")
#define acc(v) accumulate(v.begin(), v.end(),0);
#define MOD 1e+7
#define inf 1e9
#define fi first
#define se second
using namespace std;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << prec(10);

  double n, ave = 0.0;
  cin >> n;
  vector<pair<double, double>> xy(n);
  rep(i,n) cin >> xy[i].fi >> xy[i].se;
  string per = "";
  rep(i,n) per.push_back((char)(i+'0'));
  //cout << per << endl;
  do {
    //cout << per << endl;
    rep(i,n-1) {

      int a = (int)(per[i]-48);
      int b = (int)(per[i+1]-48);
      double f = (xy[a].fi - xy[b].fi) * (xy[a].fi - xy[b].fi);
      double s = (xy[a].se - xy[b].se) * (xy[a].se - xy[b].se);

      ave += sqrt(f + s);
      //cout << per << " " << a << " <=> " << b << " ===> " << ave << endl;
      //cout << f << " " << s << endl;
    }
    //cout << "--------------" << endl;
  } while(next_permutation(per.begin(), per.end()));
  double pro = 1;
  reps(i,2,n+1) pro *= i;
  //cout << pro << endl;
  ave /= pro;
  cout << ave << endl;
  //rep(i,n) cout << xy[i].fi << " " << xy[i].se << endl;
  return 0;
}
//templete by private_yusuke

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define ls rt << 1
#define rs rt << 1 | 1
#define pb push_back
#define pii pair<int, int>
#define X first
#define Y second
#define pcc pair<char, char>
#define rep(i, x, y) for(int i = x; i <= y; i ++)
#define rrep(i, x, y) for(int i = x; i >= y; i --)
#define eps 1e-9
using namespace std;
inline int read()
{
	int x = 0, f = 1; char ch = getchar();
	while (ch < '0' || ch > '9') { if (ch == '-') f = -1; ch = getchar(); }
	while (ch >= '0' && ch <= '9') { x = x * 10 + ch - '0'; ch = getchar(); }
	return x * f;
}
const int N = 1e6 + 10;
ll n, a[110], b, x;
int main()
{
	cin >> n;
	rep(i, 1, n)
	{
		cin >> a[i];
		b += a[i];
	}
	if(b % n == 0) x = b / n;
	else
	{
		if(double(b) / n - double(b / n) < 0.5)	x = b / n;
		else x = b / n + 1;
	}
	ll ans = 0;
	rep(i, 1, n) ans += (a[i] - x) * (a[i] - x);
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <queue>
#include <algorithm>
#include <utility>
#include <cmath>
#include <map>
#include <set>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>
using namespace std;

#define INF_LL (ll)1e18
#define INF (int)1e9
#define REP(i, n) for(int i = 0;i < (n);i++)
#define FOR(i, a, b) for(int i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
using ll = long long;
using PII = pair<int, int>;

const double eps = 1e-10;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

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

	string s;
	bool a[26] = {};
	cin >> s;
	REP(i, s.size()){
		a[s[i]-'a']=1;
	}
	REP(i, 26){
		if(a[i] == 0){
			cout << (char)(i+'a') << endl;
			return 0;
		}
	}
	cout << "None" << endl;
}


Measured memory_bytes: 512
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <iomanip>
#include <cassert>
#include <bitset>
using namespace std;

typedef pair<int, int> P;
#define rep(i, n) for (int i=0; i<(n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define index(xs, x) (int)(lower_bound(all(xs), x) - xs.begin())
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007

int N;
int A[200000], B[200000];
signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  cin >> N;
  long long sum = 0;
  rep(i, N) cin >> A[i] >> B[i], sum += A[i];
  bool same = true;
  rep(i, N) if (A[i] != B[i]) same = false;
  if (same) {
    cout << 0 << "\n";
    return 0;
  }
  int m = INF;
  rep(i, N) if (A[i] > B[i]) m = min(m, B[i]);
  cout << sum - m << "\n";
  return 0;
}


Measured memory_bytes: 384
num = int(input())
for i in range(1, num + 1):
    if i % 3 == 0:
        print(f' {i}', end='')
    else:
        x = i
        while x:
            if x % 10 == 3:
                print(f' {i}', end='')
                break
            x //= 10  # 切り捨て除算
print()


Measured memory_bytes: 5880
//jinhaonan
#include<set>
#include<map>
#include<list>
#include<ctime>
#include<cmath>
#include<queue>
#include<bitset>
#include<string>
#include<cstdio>
#include<cctype>
#include<vector>
#include<cstdlib>
#include<cstring>
#include<cassert>
#include<sstream>
#include<numeric>
#include<iostream>
#include<algorithm>
#include<functional>
using namespace std;
#define For(i,x,y) for(int i=x,_y=y;i<=_y;++i)
#define Rep(i,x,y) for(int i=x,_y=y;i>=_y;--i)
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fi first
#define se second
#define mp make_pair
typedef long long ll;
typedef double db;
typedef pair<int,int> pii;
typedef vector<int> vi;
inline int read()
{
	int x=0;char c=getchar();bool f=0;
	for(;c>'9'||c<'0';f=c=='-',c=getchar());
	for(;c>='0'&&c<='9';x=(x<<1)+(x<<3)+c-'0',c=getchar());
	return f?-x:x;
}
inline void write(int x)
{
	if(x<0)putchar('-'),x=-x;
	if(x>=10)write(x/10);
	putchar(x%10+48);
}
int n,m,q,f[510][510];
int main()
{
	n=read(),m=read(),q=read();
	For(i,1,m)
	{
		int l=read(),r=read();
		++f[l][r];
	}
	For(i,1,n)For(j,i,n)f[i][j]+=f[i][j-1];
	For(i,1,q)
	{
		int l=read(),r=read(),ans=0;
		For(j,l,r)ans+=f[j][r];
		write(ans),puts("");
	}
}

Measured memory_bytes: 1920
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000
struct UnionFind {
	vector<int> par;
	UnionFind(int x) : par(x, -1) {}
	void init(int x) { par.assign(x, -1); }
	int root(int x) {
		if (par[x] <= -1) return x;
		else return root(par[x]);
	}
	bool issame(int x, int y) {
		return root(x) == root(y);
	}
	bool merge(int x, int y) {
		x = root(x); y = root(y);
		if (x == y) return false;
		if (par[x] > par[y]) swap(x, y);
		par[x] += par[y];
		par[y] = x;
		return true;
	}
	int size(int x) {
		return -par[root(x)];
	}
};

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, M; cin >> N >> M;
    int p[100010];
    rep(i, N) cin >> p[i];
    rep(i, N) p[i]--;
    UnionFind UF(N);
    rep(i, M) {
        int x, y;
        cin >> x >> y;
        x--; y--;
        UF.merge(x, y);
    }
    int ans = 0;
    rep(i, N) {
        if(UF.issame(i, p[i])) ans++;
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1024
<?php
fscanf(STDIN, "%d %d", $X, $Y);

// $ratio = $Y / $X;

// $ans = floor(log($ratio, 2)) + 1;

// echo $ans . PHP_EOL;

$ans = 0;

while($Y >= $X) {
    $ans++;
    $X *= 2;
}

echo $ans . PHP_EOL;

Measured memory_bytes: 4728
/* You can't connect the dots looking forward 
   you can only connect them looking backwards. */
 
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define ull unsigned long long
#define boost ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);cout.precision(10);cout << fixed;
#define dbset(x) for(int i=0 ; i<x.size(); i++) cerr << x[i] << " "; cerr << endl;
#define inf 1000000007
#define INF 1000000000000000000LL
#define PI 3.14159265358979323846
#define mod 1000000007
#define mod1 1000696969
#define flusz fflush(stdout);
#define VI vector<int>
#define VPI vector < pair<int,int> >
#define PII pair<int, int>
#define BIT bitset<N>
#define st first
#define nd second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define endl '\n'
#define REP(x, y) for(int x = 0; x < (y); ++x)
#define FOR(x, y, z) for(int x = y; x <= (z); ++x)
#define FORR(x, y, z) for(int x = y; x >= (z); --x)
using namespace std;
 
template<class TH> void _dbg(const char *sdbg, TH h){cerr<<sdbg<<"="<<h<<"\n";}
template<class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) {
  while(*sdbg!=',')cerr<<*sdbg++;cerr<<"="<<h<<","; _dbg(sdbg+1, a...);
}
#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
 
#define int long long
#define N 500007
 
int test;
 
int x,y,z;
 
int a[N],b[N],c[N];
 
int n;
 
int res,odp=-INF;
 
VI g;
 
bool cmp(int aa,int bb){
    return a[aa]-b[aa] > a[bb]-b[bb];
}
 
multiset<int>s;
 
int t1[N],t2[N];
 
void solve()
{
    cin >> x >> y >> z;
 
    n = x+y+z;
 
    FOR(i,1,n){
        cin >> a[i] >> b[i] >> c[i];
 
        res += c[i];
 
        a[i] -= c[i];
        b[i] -= c[i];
 
        g.pb(i);
    } 

    // debug(res);
 
    sort(g.begin(),g.end(),cmp);
 
    int res1=0,res2=0;

    // for(auto it:g){
    //     cout << it << " ";
    // }
 
    REP(i,x){
        s.insert(a[g[i]]);
        res1+=a[g[i]];
    }
 
    t1[x-1] = res1;
 
    FOR(i,x,g.size()-1){
        auto it = s.begin();
 
        if (*it < a[g[i]]){
            res1 += (a[g[i]] - *it);
            s.erase(it);
            s.insert(a[g[i]]);
        }
 
        t1[i] = res1;
    }
 
    s.clear();
 
    FORR(i,g.size()-1,g.size()-y){
        s.insert(b[g[i]]);
        res2+=b[g[i]];
    }

    odp = res2 + (y!=n ? t1[g.size()-y-1] : 0);
 
    FORR(i,g.size()-y-1,x){
        auto it = s.begin();
 
        if (*it < b[g[i]]){
            res2 += (b[g[i]] - *it);
            s.erase(it);
            s.insert(b[g[i]]);
        }
 
        odp = max(odp,res2+t1[i-1]);

        // debug(t1[i-1],res2,i);
    }
 
    cout << res+odp;
 
    return;
}
 
int32_t main()
{
    boost
 
    test=1;
 
    while(test--)
    {
        solve();
    }
 
  return 0;
}

Measured memory_bytes: 21876
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <unordered_set>
#include <utility>
#include <vector>
#define rep(i,n) for(int i=0 ; i < (n) ; ++i)
using namespace std;
int main(){
    string s;
    cin >> s;
    stack<char>a;
    int temp = 0;
    rep(i,s.length()){
        if(s[i] == 'S'){
            a.push(s[i]);
        }else if(a.empty() || a.top() =='T'){
            a.push(s[i]);
        }else{
            a.pop();
            temp ++ ;
        }
    }
    cout << s.length()-temp*2 << endl;
}

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

int N, R;
int S[50];

int main() {
  while (cin >> N >> R) {
    if (N == 0 && R == 0) break;
    for (int i=0; i<N; i++) S[i] = N-i;
    for (int i=0; i<R; i++) {
      int p, c;
      cin >> p >> c;
      vector<int> t;
      for (int i=p-1; i<p+c-1; i++) t.push_back(S[i]);
      for (int i=p-2; i>=0; i--) {
        S[i+c] = S[i];
      }
      for (int i=0; i<c; i++) S[i] = t[i];
    }
    cout << S[0] << "\n";
  }
  return 0;
}

Measured memory_bytes: 2960
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) (v).begin(),(v).end()
#define out(a) cout << (a) << endl
using namespace std;
using ll = long long;
int main(){
    int n;
    cin >> n;
    vector<int> vec(n);
    for(int i=0; i<n; i++) cin >> vec[i];

    sort(all(vec));
    int maxm = vec[n-1];

    int sum = 0;
    rep(i, n-1){
        sum += vec[i];
    }
    if(maxm < sum) out("Yes");
    else out("No");
}

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

int sisya(double ave,int count)
{
	ave = ave / static_cast<double>(count);
	int a = static_cast<int>(ave*10);
	if(a%10 >= 5){
		ave++;
	}
	return static_cast<int>(ave);
}

int main()
{
	int y,m;
	int count = 0;
	int sum = 0;
	int ave = 0;
	char dot;
	while(cin >> y >> dot >> m){
		sum += y*m;
		ave += m;
		count++;
	}
	cout << sum << endl;
	cout << sisya(static_cast<double>(ave),count) << endl;
	return 0;
}

Measured memory_bytes: 0
#pragma region
#include <bits/stdc++.h>
using namespace std;
inline void ci(void){
  return;
}
template <typename First, typename... Rest>
void ci(First& first, Rest&... rest){
  cin >> first;
  ci(rest...);
  return;
}
inline void co(void){
  cout << "\n";
  return;
}
template <typename First, typename... Rest>
void co(First first, Rest... rest){
  cout << first << " ";
  co(rest...);
  return;
}
#define ll long long
#define ld long double
#define st string
#define dl double
#define wh while
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define tp tuple
#define ft first
#define sc second
#define ve vector
#define tos to_string
#define len length
#define rt return 0
#define gcd __gcd
#define lcm(n, m) n * m / gcd(n, m)
#define np next_permutation
#define repi(i, m, n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i, n) repi(i, 0, n)
#define sz(v) ((int)(v).size()) 
#define ea(i, n) for(auto&& i: n)
#define so(n) sort(n.begin(), n.end())
#define sp(n) cout << fixed << setprecision(n)
#pragma endregion
// rtsq ルート, int 2*10^9, __gcd

int main() {
  st S;
  ci(S);
  ve<int> A(sz(S), 0);
  rep(i, sz(S)){
    if(S.at(i) == 'T' || S.at(i) == 'C' || S.at(i) == 'G' || S.at(i) == 'A'){
      A.at(i) = 1;
    }
  }
  int a = 0, b = 0;
  rep(i, sz(S)){
    if(A.at(i) == 1){
      a++;
    }
    else{
      b = max(a, b);
      a = 0;
    }
    b = max(a, b);
  }
  co(b);
}

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

int main(){
    unsigned int a,b,c;

    scanf("%d%d",&a,&b);
    if(b*2>=a){
        printf("%d\n",0);
    }else{
        printf("%d\n",a-b*2);
    }
}

Measured memory_bytes: 128
#include <iostream>

using namespace std;

int main() {
    int i, h, m, s;
    cin >> i;
    h = i / 3600;
    m = i % 3600 / 60;
    s = i % 3600 % 60 ;
    cout << h << ":" << m << ":" << s << endl;
}


Measured memory_bytes: 3112
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse2")
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
#define int long long
#define boost() ios_base :: sync_with_stdio(0); cin.tie(); cout.tie(); cout << fixed; cout << setprecision(15); srand(time(NULL))
#define all(x) x.begin(), x.end()
using namespace std;

int n, h, w;

signed main () {
  boost ();
  cin >> n >> h >> w;
  int res = 0;
  for (int i = 0; i < n; i++) {
    int a, b;
    cin >> a >> b;
    res += ((a >= h) && (b >= w));
  }
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 256
// -*- coding:utf-8-unix -*-

use proconio::{input, fastout};
use num_traits::{pow, One};
use std::ops::{Add, Div, Mul, Sub};

const MODULUS: usize = 1000000007;

// ABC086C - Traveling
// https://atcoder.jp/contests/abs/fasks/arc089_a

#[fastout]
fn main() {
    input! {
        n: usize,
        a: [usize; n],
    }

    let mut harmonic = vec![ModP(0);n];
    harmonic[0] = ModP(1);
    for i in 1..n {
        harmonic[i] = harmonic[i-1] + ModP(1) / ModP(i+1);
    }

    let mut n_fac = ModP(1);
    for i in 1..=n {
        n_fac = n_fac * ModP(i);
    }

    let mut coeff = Vec::new();
    for i in 1..=n {
        let mut val = ModP(1);
        if i > 1 {
            val = val + harmonic[i-1] - ModP(1);
        }
        if i < n {
            val = val + harmonic[n-i] - ModP(1);
        }
        coeff.push(val * n_fac);
    }

    let mut result = ModP(0);
    for i in 1..=n {
        result = result + coeff[i-1] * ModP(a[i-1]);
    }
    println!("{}", result.0);
}


#[derive(Clone, Copy, PartialEq, Debug)]
struct ModP(usize);

impl One for ModP {
    fn one() -> Self {
        return ModP(1);
    }
}
impl Add for ModP {
    type Output = Self;
    fn add(self, rhs: Self) -> Self {
        return ModP((self.0 + rhs.0) % MODULUS);
    }
}
impl Sub for ModP {
    type Output = Self;
    fn sub(self, rhs: Self) -> Self {
        return ModP((self.0 + MODULUS - rhs.0) % MODULUS);
    }
}
impl Mul for ModP {
    type Output = Self;
    fn mul(self, rhs: Self) -> Self {
        return ModP((self.0 * rhs.0) % MODULUS);
    }
}
impl Div for ModP {
    type Output = Self;
    fn div(self, rhs: Self) -> Self {
        if rhs.0 == 0 {
            panic!("Tried to divide by ModP(0)!");
        }
        let rhs_inv = pow(rhs, MODULUS - 2);
        return self * rhs_inv;
    }
}


Measured memory_bytes: 5504
#!/usr/bin/env python
n, m = map(int, input().split())
a = [0 for _ in range(m)]
b = [0 for _ in range(m)]
for i in range(m):
    a[i], b[i] = map(int, input().split())

for i in range(m):
    a[i] -= 1
    b[i] -= 1

# union find
def find(x):
    if par[x] < 0:
        return x
    else:
        par[x] = find(par[x])
        return par[x]

def unite(x,y):
    x = find(x)
    y = find(y)
    if x == y:
        return False
    else:
        if par[x] > par[y]:
            x,y = y,x
        par[x] += par[y]
        par[y] = x
        return True

#xとyが同じ集合に属するかの判定
def same(x,y):
    return find(x) == find(y)

#xが属する集合の個数
def size(x):
    return -par[find(x)]

#初期化
#根なら-size,子なら親の頂点
par = [-1]*n

for i in range(m):
    unite(a[i], b[i])

ans = 0
for i in range(n):
    tmp = size(i)
    if ans <= tmp:
        ans = tmp

print(ans)

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

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

  string S;
  cin >> S;

  S.at(K-1) = tolower(S.at(K-1));

  cout << S << endl;
}


Measured memory_bytes: 768
a,b,m=map(int,input().split())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
ans=min(A)+min(B)
for i in range(m):
  x,y,c=map(int,input().split())
  k=A[x-1]+B[y-1]-c
  if k<ans:
    ans=k
print(ans)

Measured memory_bytes: 70340
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define mp make_pair
#define pb push_back
#define all(v) v.begin(), v.end()
#define ub upper_bound
#define lb lower_bound

int main(){
    fastio;
    set<string> s;
    int n;
    cin >> n;
    string str;
    for(int i=0; i<n; i++){
        cin >> str;
        s.insert(str);
    }
    cout << s.size() << endl;
    return 0;
}

Measured memory_bytes: 19128
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

// 内部変数 - テスト用
#ifdef D_TEST
	static int siRes;
	static FILE *szpFpT, *szpFpA;
#endif

// 実行メイン
int
fMain(
	int piTNo					// <I> テスト番号 1～
)
{
	int i;
	char lc1Buf[1024], lc1Out[1024];

	// テストファイルオープン
#ifdef D_TEST
	sprintf(lc1Buf, ".\\Test\\T%d.txt", piTNo);
	szpFpT = fopen(lc1Buf, "r");
	sprintf(lc1Buf, ".\\Test\\A%d.txt", piTNo);
	szpFpA = fopen(lc1Buf, "r");
	siRes = 0;
#endif

	// 人数・時間取得
	int liHCnt;
	long long llSec;
#ifdef D_TEST
	fgets(lc1Buf, sizeof(lc1Buf), szpFpT);
#else
	fgets(lc1Buf, sizeof(lc1Buf), stdin);
#endif
	sscanf(lc1Buf, "%d%lld", &liHCnt, &llSec);

	// 押下時間取得
	long long llSum = 0;
	long long llPast = 0;
	for (i = 0; i < liHCnt; i++) {
		long long llPush;
#ifdef D_TEST
		fscanf(szpFpT, "%lld", &llPush);
#else
		fscanf(stdin, "%lld", &llPush);
#endif

		// 経過時間チェック
		long long llMinus = llPush - llPast;
		if (llMinus < 1) {
			llSum += llMinus;
		}

		// 経過時間
		llPast = llPush + llSec;

		// 合計
		llSum += llSec;
	}
#ifdef D_TEST
	fgets(lc1Buf, sizeof(lc1Buf), szpFpT);
#else
	fgets(lc1Buf, sizeof(lc1Buf), stdin);
#endif

	// 結果セット
	sprintf(lc1Out, "%lld\n", llSum);

	// 結果表示
#ifdef D_TEST
	fgets(lc1Buf, sizeof(lc1Buf), szpFpA);
	if (strcmp(lc1Buf, lc1Out)) {
		siRes = -1;
	}
#else
	printf("%s", lc1Out);
#endif

	// テストファイルクローズ
#ifdef D_TEST
	fclose(szpFpT);
	fclose(szpFpA);
#endif

	// テスト結果
#ifdef D_TEST
	if (siRes == 0) {
		printf("OK %d\n", piTNo);
	}
	else {
		printf("NG %d\n", piTNo);
	}
#endif

	return 0;
}

int
main()
{

#ifdef D_TEST
	int i;
	for (i = D_TEST_SNO; i <= D_TEST_ENO; i++) {
		fMain(i);
	}
#else
	fMain(0);
#endif

	return 0;
}



Measured memory_bytes: 128
program main
 implicit none
 integer*8 n,l,ans,i
 read(*,*) n,l
 ans = 0
 do i = l,l+n-1
  ans = ans + i
 end do
 if(l >= 0) then
  write(*,*) ans - l
 else if(l+n-1 < 0) then
  write(*,*) ans - (l+n-1)
 else
  write(*,*) ans
 end if
end program main

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	long long int n, a, b, c, d;
	scanf("%lld %lld %lld %lld %lld", &n, &a, &b, &c, &d);
	long long int max, min;
	long long int i;
	for (i = 0; i < n; i++)
	{
		max = min = a;
		max += i * d;
		min += i * c;
		max -= (n - i - 1) * c;
		min -= (n - i - 1) * d;
		if (min <= b && b <= max)
		{
			printf("YES\n");
			return 0;
		}
	}
	printf("NO\n");
	return 0;
}

Measured memory_bytes: 128
n = int(input())

cs = []
ss = []
fs = []

for i in range(n-1):
    c, s, f = map(int, input().split(' '))
    cs.append(c)
    ss.append(s)
    fs.append(f)

for i in range(n-1):
    t = 0
    for j in range(i, n - 1):
        if t < ss[j]:
            t = ss[j]
        else:
            if t % fs[j] != 0:
                t += fs[j] - (t % fs[j])
        t += cs[j]
    print(t)
print(0)


Measured memory_bytes: 3064
#include <cstdio>
#include <iostream>
#include <cstdlib>
#include <unordered_map>
#include <map>
#include <unordered_set>
#include <set>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <list>
#include <array>
#include <deque>
#include <bitset>
typedef long long ll;
using namespace std;
#define trace(x) cerr << #x << " is " << x << endl;

int main() {
    int N, K, Q;
    cin >> N >> K >> Q;
    int n;
    vector<int> cnt(N + 1, 0);
    for (int i = 0; i < Q; i++) {
        cin >> n;
        cnt[n]++;
    }
    int total = 0;
    for(int i = 1; i <=N; i++) {
        total += cnt[i];
    }
    for (int i  = 1; i <= N; i++) {
        if ((K - (total - cnt[i])) <= 0) {
            cout << "No" <<endl;
        } else {
            cout <<"Yes"<<endl;
        }
    }
    return 0;

}



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

int main(){
    int N; cin >> N;
    vector<int> p(N);

    for( auto & k : p ) cin >> k;

    int check = 0;
    for( int i  = 0; i < N; i++ ){
        if( p[i] != i+1 ) check++;
    }

    if( check == 2 || check == 0 )
    cout << "YES" << endl;
    else 
    cout << "NO" << endl;
}

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

using namespace std;

int main()
{
  ios::sync_with_stdio(0);
  cin.tie(0);
  
  string s,t,u;
  int a,b;
  
  cin >> s >> t >> a >> b >> u;
  
  if(s == u){
    printf("%d %d",--a,b);
  }
  else{
    printf("%d %d",a,--b);
  }
  
  return 0;
}
  

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <algorithm>
#include <climits>
#include <cstring>
#include <cmath>
#include <stack>
#include <iomanip>
#include <tuple>
#include <functional>
#include <cfloat>
#include <map>
#include <set>
#include <array>
#include <stdio.h>
#include <string.h>
using ll = long long;
using ull = unsigned long long;
using namespace std;
#define int long long
#define CONTAINS(v,n) (find((v).begin(), (v).end(), (n)) != (v).end())
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define ARY_SORT(a, size) sort((a), (a)+(size))
#define REMOVE(v,a) (v.erase(remove((v).begin(), (v).end(), (a)), (v).end()))
#define REVERSE(v) (reverse((v).begin(), (v).end()))
#define ARY_REVERSE(v,a) (reverse((v), (v)+(a)))
#define LOWER_BOUND(v,a) (lower_bound((v).begin(), (v).end(), (a)))
#define UPPER_BOUND(v,a) (upper_bound((v).begin(), (v).end(), (a)))
#define REP(i, n) for (int (i)=0; (i) < (n); (i)++)
#define CONTAINS_MAP(m, a) (m).find((a)) != m.end()
void YesNo(bool b) { cout << (b ? "Yes" : "No"); }
void Yes() { cout << "Yes"; }
void No() { cout << "No"; }
//max_element


signed main()
{
	string ss[10] = { "SUN","MON","TUE","WED","THU","FRI","SAT" };

	string S;
	cin >> S;
	for (int i = 0; i < 7; i++)
	{
		if (S == ss[i])
		{
			cout << (7 - i) << endl;
		}
	}

}




Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>

int main()
{
	char n[202];
	char s[202];
	int h,m,j,i=0,len=0;
	
	
	while(1){
		
		scanf("%s",n);
		if(n[0]=='-') break;
		len = strlen(n);
		
		scanf("%d",&m);
		
		for(j=0;j<m;j++){
			scanf("%d",&h);
		

		strncpy(s,n+h,len-h+1);
		strncat(s,n,h);
		
		strcpy(n,s);
		}
		
		puts(n);
	}
	
	
	
	return 0;
}
	


Measured memory_bytes: 1992
n,m=map(int,input().split())

def ans(n):
    if n%4==0:
        return n
    elif n%4==1:
        return (n-1)^n
    elif n%4==2:
        return (n-2)^(n-1)^n
    else:
        return (n-3)^(n-2)^(n-1)^n
print(ans(m)^ans(n-1))

Measured memory_bytes: 3060
def judge(h, hset):
  rest = hset - {h}
  if len(rest) in (0, 2):
    return 3
  if h % 3 + 1 in rest:
    return 1
  else:
    return 2

while True:
  h1 = int(input())
  if h1 == 0:
    break
  hlst = []
  hset = set()
  hlst.append(h1)
  hset.add(h1)
  for _ in range(4):
    h = int(input())
    hlst.append(h)
    hset.add(h)
  for h in hlst:
    print(judge(h, hset))




Measured memory_bytes: 5596
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
template<typename T> bool chmax(T &a,T b){if(a<b){a=b;return true;}return false;}
template<typename T> bool chmin(T &a,T b){if(a>b){a=b;return true;}return false;}
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(vec) vec.begin(),vec.end()
typedef long long ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef tuple<ll,ll,ll> tlll;
typedef tuple<int,int,int> tiii;
const ll mod=1e9+7;
const int inf=1<<30;

struct unionfind{
  vector<int> par;
  vector<int> rank;
  unionfind(int n=1){
    init(n);
  }
  void init(int n=1){
      par.resize(n); rank.resize(n);
      for(int i=0;i<n;++i) par[i]=i,rank[i]=0;
  }
  int root(int x){
    if(par[x]==x){
      return x;
    }
    else{
      int r=root(par[x]);
      return par[x]=r;
    }
  }
  bool issame(int x,int y){
    return root(x)==root(y);
  }
  bool merge(int x,int y){
    x=root(x); y=root(y);
    if(x==y) return false;
    if(rank[x]<rank[y]) swap(x,y);
    if(rank[x]==rank[y]) ++rank[x];
    par[y]=x;
    return true;
  }
};

struct edge{int u,v,cost;};

bool comp(const edge& e1,const edge& e2){
  return e1.cost<e2.cost;
}

ll kruskal(int n,int m,vector<edge>& es){
  sort(es.begin(),es.end(),comp);
  unionfind uf(n);
  ll res=0;
  rep(i,m){
    if(!uf.issame(es[i].u,es[i].v)){
      uf.merge(es[i].u,es[i].v);
      res+=es[i].cost;
    }
  }
  return res;
}

int main(){
  int n; cin >> n;
  vector<pii> x(n);
  vector<pii> y(n);
  rep(i,n){
    cin >> x[i].first >> y[i].first;
    x[i].second=i; y[i].second=i;
  }
  sort(all(x));
  sort(all(y));
  vector<edge> es(0);
  rep(i,n-1){
    int a=x[i].second;
    int b=x[i+1].second;
    int c=x[i+1].first-x[i].first;
    //cout << a << b << c << endl;
    es.push_back({a,b,c});
  }
  rep(i,n-1){
    int a=y[i].second;
    int b=y[i+1].second;
    int c=y[i+1].first-y[i].first;
    //cout << a << b << c << endl;
    es.push_back({a,b,c});
  }
  int m=es.size();
  cout << kruskal(n,m,es) << endl;
}

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

int main() {
    int a,b,c;
    cin >> a >> b >>c;
    
    if (a+b+c<22)
    {cout << "win" << endl;
    }else{
        cout << "bust" << endl;
    }
    
    
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
int S[100010];
int main()
{
    int q,n,k,sum=0;
    scanf("%d",&n);
    for(int i=0;i<n;i++)
        scanf("%d",&S[i]);
    scanf("%d",&q);

    for(int i=0;i<q;i++){
            scanf("%d",&k);
    int mid=n/2,left=0,right=n;
    while(left<right)
    {
        mid=(left+right)/2;
        if(k>S[mid])
          {
              left=mid+1;
          }
        if(k<S[mid])
           {
               right=mid;
           }
        else if(k==S[mid])
        {
            sum++;
            break;
        }
    }
    }
    printf("%d\n",sum);
    return 0;
}

Measured memory_bytes: 3028
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define P pair<int,int>
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<n;i++)
#define all(v) v.begin(),v.end()
#define pb push_back
template<class T>void chmax(T &a,T b){if(a<b)a=b;}
template<class T>void chmin(T &a,T b){if(a>b)a=b;}
constexpr int INF=1000000000000000000;
constexpr int mod=1000000007;
int dx[]={0,1,0,-1},dy[]={1,0,-1,0};
int kaijo[2000010];
int gcd(int a,int b){
    if(b==0)return a;
    return gcd(b,a%b);
}
int lcm(int a,int b){
    return a/gcd(a,b)*b;
}
bool prime(int a){
    if(a==1)return false;
    for(int i=2;i*i<=a;i++){
        if(a%i==0)return false;
    }
    return true;
}
void init_fact(){
    kaijo[0]=1;
    for(int i=1;i<=2000000;i++){
        kaijo[i]=kaijo[i-1]*i;
        kaijo[i]%=mod;
    }
}
int modpow(int a,int b){
    if(b==0)return 1;
    if(b%2)return modpow(a,b-1)*a%mod;
    int memo=modpow(a,b/2);
    return memo*memo%mod;
}
int comb(int a,int b){
    if(!kaijo[0])init_fact();
    return kaijo[a]*modpow(kaijo[a-b],mod-2)%mod*modpow(kaijo[b],mod-2)%mod;
}
int inv(int x){
    x=modpow(x,mod-2);
    return x;
}
bool kosa(double ax,double ay,double bx,double by,double cx,double cy,double dx,double dy){
    double ta=(cx-dx)*(ay-cy)+(cy-dy)*(cx-ax);
    double tb=(cx-dx)*(by-cy)+(cy-dy)*(cx-bx);
    double tc=(ax-bx)*(cy-ay)+(ay-by)*(ax-cx);
    double td=(ax-bx)*(dy-ay)+(ay-by)*(ax-dx);
    return tc*td<0&&ta*tb<0;
}
int n;
pair<double,double>p[110];
bool comp(const pair<double,double> &p1,const pair<double,double> &p2){
    return atan2(p1.se,p1.fi)<atan2(p2.se,p2.fi);
}
signed main(){
    cin>>n;
    rep(i,n)cin>>p[i].fi>>p[i].se;
    sort(p,p+n,comp);
    double ans=0;
    rep(i,36000){
        double x=0,y=0;
        rep(j,n){
            x+=p[(i+j)%n].fi;
            y+=p[(i+j)%n].se;
            chmax(ans,x*x+y*y);
        }
    }
    printf("%.12lf\n",sqrt(ans));
    return 0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
 
int main()
{
 int n;
 cin>>n;
 int a[n];
 int ans=0;
 for(int i=0;i<n;i++)
 {
  cin>>a[i];
  ans=ans^a[i];
 }

 for(int i=0;i<n;i++)
 {
  int out=ans^a[i];
  cout<<out<<' ';
 }



  return 0;
}


Measured memory_bytes: 4372
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<int,int> P;
const int N=100100;
int n;
P a[N];
P b[N];
P c[N];
P mg(P a,P b){
	return P(max(a.first,b.first),min(a.second,b.second));
}
int len(P x){
	return max(x.second-x.first+1,0);
}
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%d%d",&a[i].first,&a[i].second);
	}
	sort(a+1,a+n+1);
	b[0]=c[n+1]=P(1,1e9);
	for(int i=1;i<=n;i++){
		b[i]=mg(b[i-1],a[i]);
	}
	for(int i=n;i>=1;i--){
		c[i]=mg(c[i+1],a[i]);
	}
	int ans=0;
	for(int i=1;i+1<=n;i++){
		ans=max(ans,len(b[i])+len(c[i+1]));
	}
	for(int i=2;i+1<=n;i++){
		ans=max(ans,len(a[i])+len(mg(b[i-1],c[i+1])));
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 2560
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <queue>
#include <cstring>
#include <vector>
#include <map>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <bitset>
#include <set>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define all(i,n) (i),(i+n)

int dx4[4]={1,0,-1,0};
int dy4[4]={0,-1,0,1};
int dx8[8]={1,0,-1,1,-1,1,0,-1};
int dy8[8]={1,1,1,0,0,-1,-1,-1};

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

const int INF = 1e9;
const ll LLINF = 1e18;
const int MAX_V = 1e6+1;
const ll mod = 1000000007;

// --------------------------------------
int n;
map<string, int> mp;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  cin >> n;
  int ma = 0;
  REP(i, n) {
    string s;
    cin >> s;
    mp[s] += 1;

    ma = max(ma, mp[s]);
  }

  for (auto iter = mp.begin(); iter != mp.end(); iter++) {
    if(iter->second == ma) cout << iter->first << endl;
  }
}


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

/************************** definations *******************************/
#define pi              2*acos(0.0)
#define ll              long long int
#define sc(a)           scanf("%d",&a)
#define scc(a,b)        scanf("%d %d",&a,&b)
#define sc1(a)          scanf("%lld",&a)
#define sc2(a,b)        scanf("%lld %lld",&a,&b)
#define pf1(a)          printf("%lld\n",a)
#define pf2(a,b)        printf("%lld %lld\n",a,b)
#define Case(a)         printf("Case %d: ",a)
#define Casel(a)        printf("Case %lld: ",a)
#define mem(a,x)        memset(a,x,sizeof(a))
#define INF             1e9
#define INFL            1e18
#define XX              first
#define YY              second
#define PB              push_back
#define MP              make_pair
#define NL              cout << endl;
#define DONE            cerr << "Done" << endl
#define PAUSE           system("pause")
#define DEBUG(x)        cerr << #x << " = " << x << endl
#define READ            freopen("alu.txt", "r", stdin)
#define WRITE           freopen("vorta.txt", "w", stdout)
#define FASTIO          ios_base::sync_with_stdio(false);cin.tie(NULL)
#define M               10000007
#define mod             100000007
#define Mod             1000000007
#define MAX             1001
/************************** definations *******************************/

/*int edg[MAX][MAX],color[MAX][MAX],cost[MAX][MAX],x,y;
int fx[]={-1,0,0,1};
int fy[]={0,-1,1,0};
char grid[40][100];
int vis[MAX][MAX];
void bfs(int s, int d){
    queue<int> q; int ux,uy,vx,vy,i;
    q.push(s); q.push(d);
    color[s][d] = 1;
    cost[s][d] = 0;
    while(!q.empty()){
        ux=q.front(); q.pop();
        uy=q.front(); q.pop();
        for(i=0;i<4;i++){
            vx = ux + fx[i];
            vy = uy + fy[i];
            if(vx>=0 && vx<=x && vy>=0 && vy<=y && !edg[vx][vy]){
                if(!color[vx][vy] && !cost[vx][vy]){
                    cost[vx][vy] = cost[ux][uy] + 1;
                    color[vx][vy] = 1;
                    q.push(vx); q.push(vy);
                }
            }
        }
    }
}

void dfs(int x, int y, char c){
    if(vis[x][y]) return;
    if(grid[x][y]=='X') return;
    vis[x][y] = 1;
    grid[x][y] = c;
    for(int i=0;i<4;i++) dfs(x+fx[i],y+fy[i],c);
}*/
//int a[110];
int main()
{
    int a,b;
    cin >> a >> b;
    if(a<=9 && b<=9) cout << a*b;
    else cout << "-1";
}

Measured memory_bytes: 256
// luogu-judger-enable-o2
#include <cstdio>
#include <iostream>
#include <cstdlib>

namespace IO
{
//    inline char gc()
//    {
//        static char s[1<<20|1]={0},*p1=s,*p2=s;
//        return (p1==p2)&&(p2=(p1=s)+fread(s,1,1<<20,stdin),p1==p2)?EOF:*(p1++);
//    }
	inline char gc() { return getchar(); }
	inline long long read()
	{
		long long ret=0;bool flag=0;char c=gc();
		while ((c<'0')|(c>'9')) flag ^= !(c^'-'),c=gc();
		while ((c>='0')&(c<='9')) ret=(ret<<1)+(ret<<3)+(c^'0'),c=gc();
		return flag?-ret:ret;
 	}
 	char OutputAns[1<<20|1],*OutputCur = OutputAns;
 	inline void output()
 	{
 		OutputCur -= fwrite(OutputAns,1,OutputCur - OutputAns,stdout);
	}
	inline void print(long long ans)
	{
		char s[20]={0};
		if (OutputCur - OutputAns + sprintf(s,"%lld",ans) >> 20) output();
		OutputCur += sprintf(OutputCur,"%lld",ans);
	}
	inline void printc(char c)
	{
		if (OutputCur - OutputAns + 1 >> 20) output();
		*(OutputCur++) = c;
	}
}

using IO::read;
using IO::print;
using IO::printc;
using IO::output;

const int M = 3e5 + 11;

const int INF = 1e9 + 7;

int End[25][M], Fir[25][M], Dp1[M], Dp2[M], Pos[M], T[25];

int n, lim, top, sumBlock;

inline void Input()
{
	n = read(), lim = read(); for (int i = 1;i <= n; ++i) Pos[i] = read();
	int tmp = lim; while (tmp) { T[top++] = tmp >> 1; tmp >>= 1; } T[top] = lim;
}

inline void Solve()
{
	for (int i = 0;i <= top; ++i)
	{
		Fir[i][1] = 1;
		for (int j = 2;j <= n; ++j)
		{
			if (Pos[j] - Pos[j - 1] <= T[i]) Fir[i][j] = Fir[i][j - 1];
			else Fir[i][j] = j;
		}
	}
	for (int i = 0;i <= top; ++i)
	{
		End[i][n] = n;
		for (int j = n - 1; j >= 1; --j)
		{
			if (Pos[j + 1] - Pos[j] <= T[i]) End[i][j] = End[i][j + 1];
			else { End[i][j] = j; if (i == top) ++sumBlock; }
		}
	} 
	if (sumBlock > top)
	{
		for (int i = 1;i <= n; ++i) puts("Impossible");
		exit(0);
	} int all = (1<<top);
	for (int s = 0;s < all; ++s) Dp2[s] = n + 1;
	for (int S = 0;S < all; ++S)
		for (int i = 0;i <= top; ++i)
			if (!((1<<i) & S))	
				Dp1[S | (1<<i)] = std::max(Dp1[S | (1<<i)], End[i][Dp1[S] + 1]),
				Dp2[S | (1<<i)] = std::min(Dp2[S | (1<<i)], Fir[i][Dp2[S] - 1]);
	for (int i = 1;i <= n; ++i)
	{
		bool ok = 0;
		for (int S = 0;S < all; ++S)
		{
			int ss = (all - 1) ^ S;
			if (Dp1[S] >= i - 1 && Dp2[ss] <= End[top][i] + 1) { ok = 1; break; }
		}
		for (int j = i;j <= End[top][i]; ++j)
		{
			if (ok) puts("Possible");
			else puts("Impossible");
		} i = End[top][i];
	}
}

int main(void)
{
//	freopen("jump.in","r",stdin);
///	freopen("jump.out","w",stdout);
	Input();
	Solve();
	return 0;
}

Measured memory_bytes: 51200
#pragma region Macros
#pragma GCC target("avx2")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define rep2(i, a, b) for(ll i = a; i <= b; ++i)
#define rep(i, n) for(i = 0; i < n; ++i)
#define rep3(i, a, b) for(ll i = a; i >= b; --i)
using namespace std;

// _________コーディングはここから！！___________

int n, m, k, i;
constexpr int N = 200010;
int a[N], b[N];
constexpr int sz = 5000000;
char reader[sz];
char *pos = reader;
int nn, now, ans;
int kk;
main() {
    reader[fread(reader, sizeof(char), sizeof(char) * sz, stdin)];
    while('0' <= *pos) n = n * 10 + *pos++ - '0';
    pos++;
    while('0' <= *pos) m = m * 10 + *pos++ - '0';
    pos++;
    while('0' <= *pos) k = k * 10 + *pos++ - '0';
    nn = n;
    pos++;
    rep(i, n) {
        while('0' <= *pos) a[i + 1] = a[i + 1] * 10 + *pos++ - '0';
        pos++;
        a[i + 1] += a[i];
        if(a[i + 1] > k) {
            nn = i;
            ++i;
            for(; i < n; ++i) {
                while('0' <= *pos) pos++;
                pos++;
            }
            break;
        }
    }
    while(*pos and *pos <= 32) pos++;
    rep(i, m) {
        while('0' <= *pos) b[i + 1] = b[i + 1] * 10 + *pos++ - '0';
        pos++;
        b[i + 1] += b[i];
        if(b[i + 1] > k) {
            m = i;
            break;
        }
    }
    now = ans = nn;
    for(i = 1; i <= m; i++) {
        kk = k - b[i];
        while(a[now] > kk) now--;
        ans = max(ans, i + now);
    }
    pos = reader;
    i = 0;
    do {
        *pos++ = ans % 10 + '0';
        ans /= 10;
        i++;
    } while(ans);
    reverse(reader, reader + i);
    fwrite(reader, sizeof(char), sizeof(char) * i, stdout);
}


Measured memory_bytes: 7760
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <math.h>
#include <vector>
#include <map>
#include <queue>
#include <utility>
#include <algorithm>
using namespace std;
int main() {
  int A, B, T;
  cin >> A >> B >> T;
  cout << (T / A) * B << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)

using namespace std;
typedef long long int lli;

int main(){
	int A,B,C;
	cin>>A>>B>>C;
	if(A==B) cout<<C;
	else if(B==C) cout<<A;
	else cout<<B;
	
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    string S;
    cin>>S;
    map<char,int>m;
    int N=S.size();
    for(int i=0;i<N;i++){
        m[S[i]]=1;
    }
    char moji = 'a';
    for(int i=0;i<26;i++){
        if(m[moji]==0){
            cout<<moji<<endl;
            exit(0);
        }
        moji+=1;
    }
    cout<<"None"<<endl;
}

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

using namespace std;
using ll = long long;

int n, W;
vector<int> v, w;
int memo[110][10010];

int rec(int i, int c) {
  if (memo[i][c] > 0) {
    return memo[i][c];
  }
  int ret;
  if (i == n) {
    ret = 0;
  } else if (c < w[i]) {
    ret = rec(i + 1, c);
  } else {
    ret = max(rec(i + 1, c), rec(i + 1, c - w[i]) + v[i]);
  }
  memo[i][c] = ret;
  return ret;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> W;
  v = vector<int>(n);
  w = vector<int>(n);
  for (int i = 0; i < n; i++) {
    cin >> v[i] >> w[i];
  }
  for (int i = 0; i <= n; i++) {
    for (int j = 0; j <= W; j++) {
      memo[i][j] = 0;
    }
  }
  cout << rec(0, W) << endl;
  return 0;
}


Measured memory_bytes: 7176
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;

public class Main {

	static BufferedReader reader;
	final static boolean MODE_DEBUG = false;
	//static field here
	
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		reader = new BufferedReader(new InputStreamReader(System.in));
		//code here
		int[] NM = readLineInt();
		int H1 = NM[0];
		int M1 = NM[1];
		int H2 = NM[2];
		int M2 = NM[3];
		int K = NM[4];
		
		
		
		print(H2*60+M2-H1*60-M1-K);
		//String[] s = readLine();
		//print(num);
	}
	
	//functions here
	//note that all methods should be STATIC


	private static <T> int arraySearch(T needle, T[] heystack) {
		for(int i=0;i<heystack.length;i++) {
			if(needle.equals(heystack[i])) {
				return i;
			}
		}
		return -1;
	}
	private static int[] sort(int[] base) {
		int[] copy = array_copy(base);
		Arrays.sort(copy);
		return copy;
	}
	private static int[] array_copy(int[] base) {
		int[] copy = new int[base.length];
		for(int i=0;i<base.length;i++) {
			copy[i] = base[i];
		}
		return copy;
	}
	private static int[] asArray(ArrayList<Integer> ints) {
		int[] intlist = new int[ints.size()];
		for(int i=0;i<intlist.length;i++) {
			intlist[i] = ints.get(i);
		}
		return intlist;
	}
	private static String[] readLine(){
		try{
			return reader.readLine().split(" ");
		}catch(Exception e){
			e.printStackTrace();
			return new String[]{e.getMessage()};
		}
	}
	private static int[] readLineInt(){
		try{
			String[] s = readLine();
			int[] ints = new int[s.length];
			for(int i=0;i<ints.length;i++) {
				ints[i] = Integer.parseInt(s[i]);
			}
			return ints;
		}catch(Exception e){
			e.printStackTrace();
			return null;
		}
	}
	private static long[] readLineLong(){
		try{
			String[] s = readLine();
			long[] ints = new long[s.length];
			for(int i=0;i<ints.length;i++) {
				ints[i] = Long.parseLong(s[i]);
			}
			return ints;
		}catch(Exception e){
			e.printStackTrace();
			return null;
		}
	}
	private static byte[] readLineByte(){
		try{
			String[] s = readLine();
			byte[] bytes = new byte[s.length];
			for(int i=0;i<bytes.length;i++) {
				bytes[i] = Byte.parseByte(s[i]);
			}
			return bytes;
		}catch(Exception e){
			e.printStackTrace();
			return null;
		}
	}
	private static char[] readLineChar(){
		try{
			String[] s = readLine();
			char[] chars = new char[s.length];
			for(int i=0;i<chars.length;i++) {
				chars[i] = (char)Integer.parseInt(s[i]);
			}
			return chars;
		}catch(Exception e){
			e.printStackTrace();
			return null;
		}
	}
	private static void print(Object o){
		System.out.println(o);
	}
	private static void print(){
		System.out.println();
	}
	private static void printd(Object o){
		if(MODE_DEBUG)System.err.println(o);
	}
	private static void printd(){
		if(MODE_DEBUG)System.err.println();
	}
}


Measured memory_bytes: 32888
<?php

fscanf(STDIN, '%d', $n);
$d = 100000;
for ($i = 0; $i < $n; $i++) {
    $d *= 1.05;
    if ($d % 1000 !== 0) {
        $d += 1000 - $d % 1000;
    }
}

echo $d . PHP_EOL;

Measured memory_bytes: 6568