akhauriyash/Code-Regression huggingface dataset:
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
import java.util.NoSuchElementException;

public class Main {

	public static void main(String[] args) {
		new Main().run();
	}
	
	final long MOD=(long)1e9+7;

	void run() {
		FastScanner sc=new FastScanner();
		long K=sc.nextLong();
		int ans=0;
		long cur=0;
		boolean[] vis=new boolean[(int)K+1];
		Arrays.fill(vis, false);
		do {
			++ans;
			cur=(10*cur+7)%K;
			if (vis[(int)cur]) {
				System.out.println(-1);
				return;
			}
			vis[(int)cur]=true;
		} while (cur!=0);
		System.out.println(ans);
	}
	
	void tr(Object...objects) {System.out.println(Arrays.deepToString(objects));}
	
	
	class FastScanner {
	    private final InputStream in = System.in;
	    private final byte[] buffer = new byte[1024];
	    private int ptr = 0;
	    private int buflen = 0;
	    private boolean hasNextByte() {
	        if (ptr < buflen) {
	            return true;
	        }else{
	            ptr = 0;
	            try {
	                buflen = in.read(buffer);
	            } catch (IOException e) {
	                e.printStackTrace();
	            }
	            if (buflen <= 0) {
	                return false;
	            }
	        }
	        return true;
	    }
	    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
	    private boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
	    private void skipUnprintable() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;}
	    public boolean hasNext() { skipUnprintable(); return hasNextByte();}
	    public String next() {
	        if (!hasNext()) throw new NoSuchElementException();
	        StringBuilder sb = new StringBuilder();
	        int b = readByte();
	        while(isPrintableChar(b)) {
	            sb.appendCodePoint(b);
	            b = readByte();
	        }
	        return sb.toString();
	    }
	    public long nextLong() {
	        if (!hasNext()) throw new NoSuchElementException();
	        long n = 0;
	        boolean minus = false;
	        int b = readByte();
	        if (b == '-') {
	            minus = true;
	            b = readByte();
	        }
	        if (b < '0' || '9' < b) {
	            throw new NumberFormatException();
	        }
	        while(true){
	            if ('0' <= b && b <= '9') {
	                n *= 10;
	                n += b - '0';
	            }else if(b == -1 || !isPrintableChar(b)){
	                return minus ? -n : n;
	            }else{
	                throw new NumberFormatException();
	            }
	            b = readByte();
	        }
	    }
	    public int nextInt() {
	    	return (int)nextLong();
	    }
	}
}



Measured memory_bytes: 33688
#include <stdio.h>
#include<stdlib.h>
#define CMAX 10000

int main(){
  int i,j,n;
  int *a,*b;
  int c[CMAX+1] = { };

  scanf("%d",&n);

  a = (int*)malloc(n*sizeof(int));
  b = (int*)malloc(n*sizeof(int));

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

  for( i=0 ; i<n ; i++ ){
    c[a[i]]++;
  }
  for( j=1 ; j<=CMAX ; j++ ){
    c[j] += c[j-1];
  }
  for( i=n-1 ; i>=0 ; i-- ){
    b[c[a[i]]-1] = a[i];
    c[a[i]]--;
  }
  
  for( j=0 ; j<n ; j++ ){
    printf("%d",b[j]);
    if( j != n-1 ) printf(" ");
  }
  printf("\n");

  free(a);
  free(b);

  return 0;
}

Measured memory_bytes: 16700
// Wanna Hack? GL...

#include<bits/stdc++.h>

#define F first
#define S second
#define PB push_back
#define sz(s) int((s).size())
#define bit(n,k) (((n)>>(k))&1)

using namespace std;

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

const int maxn=310,mod=1e9+7;
const ll inf=1e18;

int dp[2][maxn][maxn];

int main(){
    ios_base::sync_with_stdio(false);cin.tie(0);
    string s;cin>>s;
    int k,t=0,n=sz(s);cin>>k;
    for(int r=0;r<n;r++){
	dp[0][r][r]=1;
	for(int l=r-1;l>=0;l--)
	    dp[0][l][r]=max(dp[0][l+1][r],max(dp[0][l][r-1],(s[l]==s[r]?2:0) + dp[0][l+1][r-1]));
    }
    for(int i=1;i<=k;i++){
	memset(dp[t^1],0,sizeof dp[t^1]);
	for(int r=0;r<n;r++){
	    dp[t^1][r][r]=1;
	    for(int l=r-1;l>=0;l--)
		dp[t^1][l][r]=max(dp[t^1][l+1][r],max(dp[t^1][l][r-1],s[l]==s[r]?2+dp[t^1][l+1][r-1]:2+dp[t][l+1][r-1]));
	}
	t^=1;
    }
    return cout<<dp[t][0][n-1]<<endl,0;
}


Measured memory_bytes: 1024
Q,H,S,D,N=`dd`.split.map &:to_i

if N ==	1
  ans=[Q*4,H*2,S].min
else
  H=[Q*2,H].min
  S=[H*2,S].min
  D=[S*2,D].min

  ans = (S*(N%2))+N/2*D
end
p ans


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

int next_x(int r, int x, int D){
    int next_x = r*x-D;
    return next_x;
}

int main(){
    int r,D,x;
    cin >> r >> D >> x;
    int temp_x = x;
    for (int i=0; i<10; i++){
        int res = next_x(r, temp_x, D);
        cout << res << endl;
        temp_x = res;
    }
}


Measured memory_bytes: 256
//INCLUDE
//------------------------------------------
#include <bits/stdc++.h>
//DEFINE
//------------------------------------------
#define ll long long
#define ld long double
#define ALLv(a)  (a).begin(),(a).end()
#define ALL(a,n)  (a),(a)+n
#define vi vector<long long>
#define vd vector<long double>
#define vs vector<string>
//CONST
//------------------------------------------
#define INF 1010000000000000017LL
#define MOD 1000000007LL
#define EPS 1e-12
#define PI 3.14159265358979323846
//REPEAT
//------------------------------------------
#define   FOR(i,m,n) for(ll (i)=(m);   (i)<(n);  (i)++)
#define   REP(i,n)   for(ll (i)=0;     (i)<(n);  (i)++)
#define  REPS(i,x)   for(ll (i)=1;     (i)<=(x); (i)++)
#define  RREP(i,x)   for(ll (i)=(x)-1; (i)>=0;   (i)--)
#define RREPS(i,x)   for(ll (i)=(x);   (i)> 0;   (i)--)
#define  WREP(i,in,j,jn) REP(i,in)REP(j,jn)
//-----------------------------------------
#define dcml(n) fixed<<setprecision(n)
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; }
ll Factorial(ll n){ ll m=1;while(n>=1)m*=n--;return m; }
ll modPow(ll x,ll n,ll mod=MOD){
    return (!n?1:!n%2?modPow(x*x,n/2,mod)%mod:x%mod*modPow(x,n-1,mod)%mod);
}
using namespace std;
int main(void){
    ll K;cin>>K;
    ll ans=0;
    REPS(i,K){
        REPS(j,K){
            REPS(k,K){
                ans+=GCD(GCD(i,j),k);
            }
        }
    }
    cout<<ans<<"\n";
}

Measured memory_bytes: 3560
dx=[-1,0,1,1,1,0,-1,-1]
dy=[1,1,1,0,-1,-1,-1,0]
h=0
w=0

def Check(px,py,i):
    px+=dx[i]
    py+=dy[i]
    return 0<=px<w and 0<=py<h

h,w=map(int,input().split())
s=list(input() for i in range(h))
for i in range(h):
    for j in range(w):
        if s[i][j]!='#':
            ans=0
            for k in range(8):
                if Check(j,i,k):
                    if s[i+dy[k]][j+dx[k]]=='#':
                        ans+=1
            print(ans,end='')
        else:
            print('#',end='')
    print()
            

Measured memory_bytes: 3444
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <list>
#include <queue>
#include <deque>
#include <algorithm>
#include <numeric>
#include <utility>
#include <complex>
#include <functional>
using namespace std;
const int MOD = 1000000007;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = (1 << 28);
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
int n;
ll h[100000];
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        cin >> h[i];
    }
    bool c = false;
    for (int i = 1; i < n; i++)
    {
        if (h[i] - h[i - 1] == -1 && c == false)
        {
            c = true;
        }
        else if (h[i] - h[i - 1] == -1 && c == true)
        {
            no;
            return 0;
        }
        if (h[i] - h[i - 1] <= -2)
        {
            no;
            return 0;
        }
        if (h[i] - h[i - 1] > 0)
        {
            c = false;
        }
    }
    yes;
}

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

using namespace std;

int main()
{
    int n, m;
    cin >> n >> m;
    unordered_map<int, set<int>> mp;
    vector<int> p(m);
    for (int i = 0; i < m; i++){
        int k;
        cin >> k;
        for (int j = 0; j < k; j++){
            int x;
            cin >> x;
            mp[i].insert(x - 1);
        }
    }
    for (int i = 0; i < m; i++){
        cin >> p[i];
    }
    int ans = 0;
    for (int i = 0; i < (1 << n); i++){
        vector<int> newP(m);
        for (int j = 0; j < n; j++){
            if (i & (1 << j)){
                for (int k = 0; k < m; k++){
                    if (mp[k].find(j) != mp[k].end()){
                        newP[k] ^= 1;
                    }
                }
            }
        }
        bool flg = 1;
        for (int j = 0; j < m; j++){
            if (newP[j] != p[j]){
                flg = 0;
                break;
            }
        }
        if (flg){
            ans++;
        }
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void) {
	int s[10000],i,a=0;
	for (i = 0; i < 10; i++){
		scanf("%d", &s[i]);
	}
	for (i = 0; i < 10; i++) {
		a+=s[i];
	}
	printf("%d\n",a);
	return 0;
}


Measured memory_bytes: 2120
#B
n, k = map(int, input().split())
d = []
a = []
for i in range(k):
    d.append(int(input()))
    a.append(list(map(int, input().split())))
# print(d, a)
people = [0] * n
for i in range(k):
    for j in range(len(a[i])):
        # print(i, j)
        people[a[i][j] - 1] += 1
# print(people)
ans = 0
for i in people:
    if i <= 0:
        ans += 1
print(ans)

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

int main() {
  int a;
  cin >> a;
  if (a/10 % 111 == 0)
    cout << "Yes" << endl;
  else if (a%1000 % 111 == 0)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <unordered_map>
#include <stdio.h>
#include <list>
#include <vector>
#include <algorithm>
#include <stack>
#include <climits>
#include <cmath>
#include <queue>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; ++i)
#define ALL(v) v.begin(), v.end()
typedef long long ll;

int main()
{
	int q;cin >> q;
	vector<bool> isprime(200001);
	rep(i,200001)isprime[i]=true;
	for(int i=2;i<=2000;i++)
	{
		for(int j=i*2;j<200001;j+=i)
		isprime[j]=false;
	}
	isprime[0]=isprime[1]=false;

	

	vector<bool> likenum(200001);
	rep(i,200001)likenum[i]=false;
	rep(i,200001)
	{
		if(isprime[i]&&isprime[(i+1)/2])likenum[i]=true;
	}
	//rep(i,10)cout<<likenum[i]<<endl;
	vector<int> likenumsum(200002);
	likenumsum[0]=0;

	rep(i,200002)likenumsum[i+1]=likenumsum[i]+likenum[i];
	//rep(i,10)cout<<likenumsum[i];
	rep(i,q)
	{
		int foo, fooo;cin>> foo >> fooo;
		cout<<likenumsum[fooo+1]-likenumsum[foo]<<endl;;
	}






	return 0;
}

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

using namespace std;
using ll = long long;
using ld = long double;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define reps(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
#define allsort(v) sort(v.begin(),v.end())
const ll mod = 1e9 + 7;

int main() {
	cin.sync_with_stdio(false);
	int n,r;
	vector<int>ans;
	while (1) {
		cin >> n >> r;
		if (n == 0 && r == 0)break;
		vector<int>b(n), a(n);
		int p, c;
		rep(i, n)b[i] = n-i;
		rep(i, r) {
			cin >> p >> c;
			rep(j, c)a[j] = b[p - 1 + j];
			rep(j, p-1)a[c + j] = b[j];
			reps(j, p + c - 1, n)a[j] = b[j];
			rep(j, n)b[j] = a[j];			
		}
		ans.push_back(a[0]);

	}
	for (auto x : ans)cout << x << endl;
	return 0;
}

Measured memory_bytes: 3200
num= int (input())
nl = list ( map ( int , input ().split()))
fugo = [0 if i < 0 else 1 for i in nl]
mi = fugo.count(0)
nla =[abs(x) for x in nl]
nlsum = sum (nla)
if mi % 2 == 1 :
    minus = min(nla) * -2
    nlsum += minus
print(nlsum)

Measured memory_bytes: 14412
#include <cstdio>
#include <cassert>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <vector>
#include <queue>
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
using namespace std;

typedef long long ll;

int k;

const int INF = 10000000;
int dist[100000+10];

struct K {
  int v, c;
};
bool operator>(const K& k1, const K& k2) {
  return k1.c > k2.c;
}

int go(void) {
  REP(i, 100000+10) {
    dist[i] = INF;
  }
  priority_queue<K, vector<K>, greater<K> > q;
  for(int i = 1; i <= 9; ++i) {
    q.push((K){i, i});
    dist[i] = i;
  }
  while(!q.empty()) {
    K cur = q.top(); q.pop();
    if(dist[cur.v] < cur.c) {
      continue;
    }
    if(cur.v == 0) {
      break;
    }
    REP(i, 10) {
      K next = {(cur.v*10+i)%k, cur.c + i};
      if(next.c < dist[next.v]) {
        q.push(next);
        dist[next.v] = next.c;
      }
    }
  }
  return dist[0];
}

int main(void) {
  while(~scanf("%d", &k)) {
    int res = go();
    printf("%d\n", res);
  }
  return 0;
}


Measured memory_bytes: 2804
using System;
using System.Collections;

class D
{
	static void Main()
	{
		var n = int.Parse(Console.ReadLine());

		for (var i = 0; i < n; i++)
		{
			for (var j = i + 1; j < n; j++) Console.Write($"{FindDiff(i, j) + 1} ");
			Console.WriteLine();
		}
	}

	static int FindDiff(int x, int y)
	{
		var z = new BitArray(new[] { x ^ y });
		for (var i = 0; ; i++) if (z[i]) return i;
	}
}


Measured memory_bytes: 15552
#include <bits/stdc++.h>
using namespace std;
#define REP(i,x,n) for(int i=x;i<(int)n;i++)
#define rep(i,n) REP(i,0,n)
#define sp(p) cout<<setprecision(16)<<fixed<<p<<endl;
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define SORT(a) sort(all(a))
#define RSORT(a) sort(rall(a))
#define UNIQ(a) unique(all(a))
#define VOUT(v,i) cout<<#v<<": ";for(int i=0;i<(int)v.size();i++){cout<<v[i]<<" ";}cout<<"\n";
#define vout(v) VOUT(v,z);
#define vmin(v) *min_element(all(v))
#define vmax(v) *max_element(all(v))
#define vsum(v) accumulate(all(v), 0LL);
#define MOUT(m,r,c) rep(i,r){rep(j,c){cout<<m[i][j]<<" ";}cout<<endl;}
#define mout(m) MOUT(m,m.size(),m[0].size())
#define debg(a) cout<<#a<<": "<<a<<endl;
#define show(a) for(cont &y:a){for(cont &x:y){cout<<x<<" ";}cout<<endl;}
#define digit(a) to_string(a).length();
template<class T>inline int out(const T &t){ print(t); putchar('\n'); return 0; }
template<class T>inline T gcd(T a,T b){if(b==0)return a; return(gcd(b,a%b));}
template<class T>inline T lcm(T a,T b){return a/gcd(a,b)*b;}
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef vector<ll> V;
// const long long MOD=1000000007;
const long long INF = 1e18;
#define EPS (1e-7)
#define PI (acos(-1))
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) { a = b; return true; }
    return false;
}
template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) { a = b; return true; }
    return false;
}

const long long MOD = 1000000007;

void solve_TLE(long long N, std::vector<long long> A){
    ll sum=0;
    for (ll i = 0; i < N; i++) {
        for (ll j = i+1; j < N; j++) {
            sum += A[i] ^ A[j];
            sum %= MOD;
        }
    }
    cout << sum << "\n";
}

void solve(long long N, std::vector<long long> A){
    ll sum=0;
    for (ll i = 0; i < 60; i++) {
        ll cnt = 0;
        for (ll j = 0; j < N; j++) {
            if((A[j] >> i) & 1) cnt++;
        }
        ll dgt = 1LL << i;
        dgt %= MOD;
        ll val = (dgt * (cnt%MOD * (N-cnt)%MOD)%MOD)%MOD;
        sum += val;
        sum %= MOD;
    }
    cout << sum << "\n";
}

int main(){
    long long N;
    scanf("%lld",&N);
    std::vector<long long> A(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&A[i]);
    }
    solve(N, std::move(A));
    return 0;
}


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

#define fi first
#define se second

typedef pair<int,int> ii;
typedef vector<int> vi;

const int MAXN = 100005;
const int LOGN = 20;

int H[MAXN];        // index of node i in dfs path
ii path[MAXN << 1];
vi adjList[MAXN];

ii ST[LOGN][MAXN<<1];

void build(int n) {
    int h = ceil(log2(n+1));

    for (int i = 0; i < n; i++) ST[0][i] = path[i];
    for (int i = 1; i < h; i++)
        for (int j = 0; j + (1<<i) <= n; j++)
        ST[i][j] = min(ST[i-1][j], ST[i-1][j+(1<<(i-1))]);
}

int RMQ(int l, int r) {     // range [l,r)
    int p = 31 - __builtin_clz(r-l);
    return min(ST[p][l],ST[p][r-(1<<p)]).se;
}

int cnt = 0;
void dfs(int node, int depth){
    H[node] = cnt;

    path[cnt++] = ii(depth,node);
    for (int i = 0; i < adjList[node].size(); i++) {
        dfs(adjList[node][i],depth+1);

        path[cnt++] = ii(depth,node);
    }
}

int N, M, Q, v;

int main(){

    scanf("%d",&N);
    for (int u = 0; u < N; u++){
        scanf("%d",&M);
        for (int i = 0; i < M; i++){
            scanf("%d",&v);
            adjList[u].push_back(v);
        }
    }

    // rooted at 0
    dfs(0,0);
    build(cnt);

    scanf("%d",&Q);
    for (int i = 0, u, v, l, r; i < Q; i++){
        scanf("%d%d",&u,&v);

        l = H[u], r = H[v]; if (l > r) swap(l,r);

        printf("%d\n",RMQ(l,r+1));
    }

    return 0;
}

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


int main() {
    int n;
    cin >> n;
    int res = 1;
    while(res <= n){
        res *= 2;
    }
    cout << res/2 << endl;
    return 0;
}
/*
やっほい！
　　　　　　　やほほい！
　　　　+　　 　*
　　　 ∧∧　　. ∧∞∧　*
*　ヽ(=´ω｀)人(´ω｀*)ﾉ
　.～（ O x.） （ 　 O)～　+
。*　 　∪　　　　∪
*/


Measured memory_bytes: 3112
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <vector>

using namespace std;

typedef long long ll;

void solve() {
  int a, b, t;
  cin >> a >> b >> t;
  int ret = 0;
  for(int x = a; x <= t; x += a) ret += b;
  cout << ret << endl;
}

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


Measured memory_bytes: 256
#include <stdio.h>

#define MAX_N 246912

int isPrime[ MAX_N + 1 ], pNum[ MAX_N + 1 ] = { 0 };

int main( void ) {
	int i, j, n;

	isPrime[ 1 ] = 0;
	for ( i = 2; i <= MAX_N; i++ )
		isPrime[ i ] = 1;

	for ( i = 4; i <= MAX_N; i += 2 )
		isPrime[ i ] = 0;

	for ( i = 3; i * i <= MAX_N; i += 2 )
		if ( isPrime[ i ] )
			for ( j = i * 2; j <= MAX_N; j += i )
				isPrime[ j ] = 0;

	for ( i = 1; i <= MAX_N; i++ )
		pNum[ i ] = pNum[ i - 1 ] + isPrime[ i ];

	for ( ; scanf( "%d", &n ), n; printf( "%d\n", pNum[ n * 2 ] - pNum[ n ] ) ) ;

	return 0;
}

Measured memory_bytes: 2528
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Math;

namespace CSharp
{
    static class Program
    {
        private const int MaxValue = 1000000;

        static void Main(string[] args)
        {
            int k, x;
            ReadInt(out k, out x);
            int left = Max(x - k + 1, -MaxValue);
            int right = Min(x + k - 1, MaxValue);
            Console.WriteLine(string.Join(" ", Enumerable.Range(left, right - left + 1)));
        }

        #region Helpers

        static int[] ReadIntArray() => Console.ReadLine().Split().Select(s => int.Parse(s)).ToArray();
        static long[] ReadLongArray() => Console.ReadLine().Split().Select(s => long.Parse(s)).ToArray();

        static int[] ReadLineIntArray(int count) => Enumerable.Repeat(0, count).Select(_ => int.Parse(Console.ReadLine())).ToArray();
        static long[] ReadLineLongArray(int count) => Enumerable.Repeat(0, count).Select(_ => long.Parse(Console.ReadLine())).ToArray();

        static string ReadString() => Console.ReadLine();
        static int ReadInt() => int.Parse(Console.ReadLine());
        static long ReadLong() => long.Parse(Console.ReadLine());

        static void ReadInt(out int first)
        {
            var array = ReadIntArray();
            first = array[0];
        }

        static void ReadInt(out int first, out int second)
        {
            var array = ReadIntArray();
            first = array[0];
            second = array[1];
        }

        static void ReadInt(out int first, out int second, out int third)
        {
            var array = ReadIntArray();
            first = array[0];
            second = array[1];
            third = array[2];
        }

        static void ReadInt(out int first, out int second, out int third, out int fourth)
        {
            var array = ReadIntArray();
            first = array[0];
            second = array[1];
            third = array[2];
            fourth = array[3];
        }

        static void ReadLong(out long first)
        {
            var array = ReadLongArray();
            first = array[0];
        }

        static void ReadLong(out long first, out long second)
        {
            var array = ReadLongArray();
            first = array[0];
            second = array[1];
        }

        static void ReadLong(out long first, out long second, out long third)
        {
            var array = ReadLongArray();
            first = array[0];
            second = array[1];
            third = array[2];
        }

        static void ReadLong(out long first, out long second, out long third, out long fourth)
        {
            var array = ReadLongArray();
            first = array[0];
            second = array[1];
            third = array[2];
            fourth = array[3];
        }

        #endregion
    }
}

Measured memory_bytes: 13396
from itertools import product

N = int(input())
S = input()
for s1, s2 in product('SW', repeat=2):
    temp = s1 + s2
    for s in S[1:N-1]:
        if (s == 'o' and temp[-1] == 'S') or (s == 'x' and temp[-1] == 'W'):
            temp += temp[-2]
        else:
            temp += ''.join(set('SW') - set(temp[-2]))
    for i in [N-1, 0]:
        if S[i] == 'o' and temp[i] == 'S' and temp[(i-1) % N] == temp[(i+1) % N]: continue
        elif S[i] == 'o' and temp[i] == 'W' and temp[(i-1) % N] != temp[(i+1) % N]: continue
        elif S[i] == 'x' and temp[i] == 'S' and temp[(i-1) % N] != temp[(i+1) % N]: continue
        elif S[i] == 'x' and temp[i] == 'W' and temp[(i-1) % N] == temp[(i+1) % N]: continue
        else: break
    else:
        print(temp); break
else:
    print(-1)

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

using namespace std;
using lint = long long;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;

template<unsigned P> struct ModInt {
  using M = ModInt;
  unsigned v;
  constexpr ModInt() : v(0) {}
  constexpr ModInt(unsigned _v, int) : v(_v) {}
  template<class Z> ModInt(const Z& a) : v((a < 0 ? P - -a % P : a) % P) {}
  static constexpr unsigned p() { return P; }
  M operator+() const { return *this; }
  M operator-() const { return {v ? P - v : 0, 0}; }
  explicit operator bool() const noexcept { return v; }
  bool operator!() const noexcept { return !(bool)*this; }
  M& operator*=(M r) { v = (uint64_t)v * r.v % P; return *this; }
  M& operator/=(M r) { return *this *= r.inv(); }
  M& operator+=(M r) { if ((v += r.v) >= P) v -= P; return *this; }
  M& operator-=(M r) { if ((v += P - r.v) >= P) v -= P; return *this; }
  friend M operator*(M l, M r) { return M(l) *= r; }
  friend M operator/(M l, M r) { return M(l) /= r; }
  friend M operator+(M l, M r) { return M(l) += r; }
  friend M operator-(M l, M r) { return M(l) -= r; }
  friend ostream& operator<<(ostream& os, M r) { return os << r.v; }
  friend bool operator==(M l, M r) { return l.v == r.v; }
  friend bool operator!=(M l, M r) { return !(l == r); }
  M inv() const {
    int a = v, b = P, x = 1, u = 0;
    while (b) {
      int q = a / b;
      swap(a -= q * b, b);
      swap(x -= q * u, u);
    }
    assert(a == 1);
    return x;
  }
  template<class Z> M pow(Z n) const {
    if (n < 0) return pow(-n).inv();
    M res = 1;
    for (M a = *this; n; a *= a, n >>= 1) if (n & 1) res *= a;
    return res;
  }
};
using Mint = ModInt<1000000007>;
constexpr int N = 1 << 24;
struct Fact {
  V<Mint> v;
  Fact(int n) : v(n + 1, 1) {
    for (int i = 1; i <= n; ++i) v[i] = i * v[i - 1];
  }
  Mint operator[](int i) const { return v[i]; }
} fact(N);
struct Finv {
  V<Mint> v;
  Finv(int n) : v(n + 1, 1 / fact[n]) {
    for (int i = n; i; --i) v[i - 1] = i * v[i];
  }
  Mint operator[](int i) const { return v[i]; }
} finv(N);
struct Minv {
  V<Mint> v;
  Minv(int n) : v(n) {
    for (int i = 1; i <= n; ++i) v[i - 1] = fact[i - 1] * finv[i];
  }
  Mint operator[](int i) const { return v[i - 1]; }
} minv(N);
Mint comb(int n, int r) {
  if (r < 0 or r > n) return 0;
  return fact[n] * finv[r] * finv[n - r];
}

int main() {
  cin.tie(nullptr); ios::sync_with_stdio(false);
  int x, y; cin >> x >> y;
  if ((x + y) % 3) {
    cout << 0 << endl;
  } else {
    int n = (x + y) / 3;
    // a+2(n-a)=x a=2n-x
    cout << comb(n, 2 * n - x) << endl;
  }
}

Measured memory_bytes: 196864
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws Exception {

    	Scanner sc = new Scanner(System.in);

    	int A = sc.nextInt();
    	int B = sc.nextInt();
    	int C = sc.nextInt();

    	int cnt = 0;

    	cnt = B / A;
    	if(cnt > C) cnt = C;

		System.out.println(cnt);
    }
}

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

//region Template
#include "ext/pb_ds/assoc_container.hpp"
using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef long double ld;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;

const int MOD = 1000000007;

using namespace std;
typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_multiset;

#define finish(x) cout << x; exit(0);
#define fastIO cin.tie(0); cin.sync_with_stdio(false);

void setIn(string s) { freopen(s.c_str(), "r", stdin); }
void setOut(string s) { freopen(s.c_str(),"w",stdout); }

//const string USCAO_TAG = "mountains";
void usaco(const string& USACO_TAG) { setIn(USACO_TAG + ".in"); setOut(USACO_TAG + ".out"); }
/*
template<typename... Args>
void print(Args... args) {
	#ifdef LOCAL
	((std::cout << args << " "), ...);
	cout << endl;
	#endif
}
 */
//endregion

/* Notes:
 * Farah </3
 */
const int MAXN = 2e5 + 6;
bool a[MAXN];

int b[MAXN];

int main() {
	#ifdef LOCAL
		setIn("in.txt");
		setOut("out.txt");
	#endif

	int n;
	cin >> n;

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

	for(int i = n; i >= 1; i--){
		int sum = 0;
		for(int j = i; j <= n; j += i){
			sum += b[j];
		}

		if(a[i] == 1 && (sum % 2 == 0)){
			b[i] += 1;
		}
		if(a[i] == 0 && (sum % 2 != 0)){
			b[i] += 1;
		}
	}

	int cnt = 0;
	vector<int> ans;
	for(int i = 1; i <= n; i++){
		if(b[i] != 0) cnt++, ans.push_back(i);
	}
	cout << cnt << endl;
	for(auto x : ans){
		cout << x << " ";
	}
}

Measured memory_bytes: 2424
n=int(input())
h=list(map(int,input().split()))
from itertools import groupby
t=[]
for i in range(1,n):
  if h[i]-h[i-1]<=0:t.append(1)
  else:t.append(0)
gr=groupby(t)
ans=0
for k,g in gr:
  if k==1:
    t=len(list(g))
    ans=max(ans,t)
print(ans)



Measured memory_bytes: 20416
N,K = map(int,input().split())
p = list(map(int,input().split()))


def cal_expect(value):
    return ((value*(value+1))/2)*(1/value)

expect_value = [0]*N
expect_value[0] = cal_expect(p[0])

for i in range(1,K):
    expect_value[i] += expect_value[i-1] + cal_expect(p[i])

for i in range(K,N):
    expect_value[i] = expect_value[i-1] + cal_expect(p[i]) - cal_expect(p[i - K])

print(max(expect_value))

Measured memory_bytes: 25604
'use strict'
// inputに入力データ全体が入る
function Main(input) {
    let v = input.trim().split('\n').map((v)=>parseInt(v));
    
    let amari = [];
    for(let i=0;i<5;i++){
        amari.push({v:v[i],a:(v[i]+9)%10});
    }
    amari.sort((a,b)=>(a.a-b.a));
    
    let sum = 0;
    for(let i=1;i<5;i++){
        if(amari[i].a%10 === 9){
            sum += amari[i].v;
        } else {
            sum += Math.floor(amari[i].v/10)*10+10
        }
    }
    sum += amari[0].v;
    console.log(sum);
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 21192
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
	int x, y;
	bool flag = false;
	cin >> x >> y;
	for (int i = x; i != -1; i--) {
		if (i * 4 + (x - i) * 2 == y) {
			flag = true;
		}
	}
	if (flag) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}

Measured memory_bytes: 3672
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <iomanip>
using namespace std;
#define int long long


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

    int n,k; cin >> n >> k;
    vector<int> a(n);

    for(int i = 0;i < n;i ++) cin >> a.at(i);

    int ans;
    ans = ((n-1)+k-2) / (k-1);

    cout << ans << endl;
}



Measured memory_bytes: 1024
#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <set>
#include <map>
#include <queue>
#define ll long long
using namespace std;

int main(){
    char moji;
    cin>>moji;
    if('A'<=moji&&moji<='Z') cout<<"A"<<endl;
    else cout<<"a"<<endl;
}

Measured memory_bytes: 3576
#include<stdio.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<string.h>
using namespace std;

typedef long long LL;
typedef vector<int> VI;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define EACH(i,c) for(__typeof((c).begin()) i=(c).begin(),i##_end=(c).end();i!=i##_end;++i)
#define eprintf(...) fprintf(stderr, __VA_ARGS__)

template<class T> inline void amin(T &x, const T &y) { if (y<x) x=y; }
template<class T> inline void amax(T &x, const T &y) { if (x<y) x=y; }
template<class Iter> void rprintf(const char *fmt, Iter begin, Iter end) {
    for (bool sp=0; begin!=end; ++begin) { if (sp) putchar(' '); else sp = true; printf(fmt, *begin); }
    putchar('\n');
}


void MAIN() {
    int H, W, N;
    scanf("%d%d%d", &N, &H, &W);
    int ans = (N - H + 1) * (N - W + 1);
    printf("%d\n", ans);

}

int main() {
    int TC = 1;
//    scanf("%d", &TC);
    REP (tc, TC) MAIN();
    return 0;
}



Measured memory_bytes: 256
H,W, K = [int(v) for v in input().split()]
S = [list(input()) for _ in range(H)]

total = 0
for s in S:
    total += s.count("#")

ans = 0

def check(h_l,w_l):
    S_copy = []
    for s in S:
        S_copy.append(s[:])
    for h,b1 in enumerate(h_l):
        if b1: continue
        for i in range(W):
            S_copy[h][i] = 'r'

    for w,b1 in enumerate(w_l):
        if b1: continue
        for i in range(H):
            S_copy[i][w] = 'r'

    c = 0
    for s in S_copy:
        c += s.count("#")
    return c == K





def bit(N):
    r = []
    for i in range(2**N):
        ret = []
        for j in range(N):
            ret.append(i>>j & 1 == 1)
        r.append(ret)
    return r

H_L = bit(H)
W_L = bit(W)

ans = 0
for h_l in H_L:
    S_c = S[:]
    for w_l in W_L:
        if check(h_l,w_l):
            ans += 1
print(ans)


Measured memory_bytes: 9264
import sys
MOD = pow(10,9)+7
N,M = map(int,input().split())
if N < M:
  N,M = M,N

if abs(N-M) >1 :
  print(0)
  sys.exit()
  
if N == M:
  ans = 2
  while N>0 and M>0:
    ans = ans*M*N%MOD
    M -= 1; N -= 1
else:
  if N == M:
    ans = 2
    while N>0 and M>0:
      ans = ans*M*N%MOD
      M -= 1; N -= 1
  else:
    ans = N
    N -= 1
    while N>0 and M>0:
      ans = ans*M*N%MOD
      M -= 1; N -= 1
print(ans)

Measured memory_bytes: 3064
# AOJ 0085 Joseph's Potato
# Python3 2018.6.15 bal4u

while True:
	n, m = map(int, input().split())
	if n == 0:
		break
	k = 1;
	for j in range(2, n+1):
		k = (k + m) % j
		if k == 0: k = j
	print(k)


Measured memory_bytes: 5596
#include<stdio.h>
#include<math.h>

int calc(int x,int N,int Y){
    double y,z;
    y = (Y-1000*N-9000*x)/4000.0;
    z = (5000*x+5000*N-Y)/4000.0;
    //printf("%f,%f\n",y,z);
    if(ceil(y)!=floor(y)||ceil(z)!=floor(z)){
        return -1;
    }
    if(y<0 || z<0){
        return -1;
    }
    if(x+y+z!=N){
        return -1;
    }
    return y;
}

int main(void){
    int N,Y,y;
    scanf("%d %d",&N,&Y);
    for(int i=0;i<=N;i++){
        y = calc(i,N,Y);
        if(y!=-1){
            printf("%d %d %d",i,y,N-i-y);
            return 0;
        }
    }
    printf("-1 -1 -1");
    return 0;
}

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

int N, K;
vector<int> a;
vector<bool> dp;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	
	cin >> N >> K;
	a.resize(N);
	dp.resize(K + 1, false);
	for (int i = 0; i < N; i++) {
		cin >> a[i];
	}
	for (int i = 0; i <= K; i++) {
		for (int j = 0; j < N; j++) {
			if (dp[i]) {
				continue;
			}
			if (i < a[j]) {
				continue;
			}
			if (!dp[i - a[j]]) {
				dp[i] = true;
			}
		}
	}
	(dp[K])? cout << "First" : cout << "Second";
	
	return 0;
}


Measured memory_bytes: 3668
#include <iostream>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<sstream>
#include<cmath>
#include<numeric>
#include<map>
#include<stack>
#include<queue>
#include<random>
using namespace std;
int main() {

  int n, k;
  cin >> n >> k;

  int ans = 1;
  for(int i=0; i<n; i++){
    if( ans * 2 < ans + k ){
      ans *= 2;
    }else{
      ans += k;
    }
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		int n = Integer.parseInt(br.readLine());

		String str[] = br.readLine().split(" ");

		int a[] = new int[n];
		int s[] = new int[100010];

		for (int i = 0; i < n; i++) {
			a[i] = Integer.parseInt(str[i]);

			s[a[i]]++;
			if (s[a[i]] > 2 || (n % 2 == 0 && a[i] % 2 == 0) || (n % 2 != 0 && a[i] % 2 != 0)) {
				System.out.println("0");
				return;
			}
		}

		if (s[0] != 0 && s[0] > 1) {
			System.out.println("0");
			return;
		}

		System.out.println(modpow(2, n / 2, 1000000007) % 1000000007);

	}

	static long modpow(long a, long n, long mod) {
		long res = 1;
		while (n > 0) {
			if ((n & 1) == 1)
				res = res * a % mod;
			a = a * a % mod;
			n >>= 1;
		}
		return res;
	}
}


Measured memory_bytes: 45364
#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>
#include <numeric>
#include <complex>
 
 
using namespace std;
 
 
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
 
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
 
 
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#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 MOD =  1e9 + 7; 
 
 
 
ll power(ll a, ll b){
	if(b == 0) return 1;
	else {
		ll x = power(a,b/2);
		x = (x*x)%MOD;
		if(b&1) return (x*a)%MOD;
		else return x;
	}
}
 
 
ll& Mod(ll& a) {
    if (a >= MOD) {
        return Mod(a -= MOD);
    } else if (a < 0) {
        return Mod(a += MOD);
    } else {
        return a;
    }
}
 
ll gcd(ll a, ll b) { 
	// b < a
    if (b == 0) 
        return a; 
    return gcd(b, a % b); 
} 


int main() {
	fast_cin();	
	ll n; cin >> n;
	string s; cin >> s;
	ll r = 0, g = 0, b = 0;
	for(int i = 0; i < n; i++){
		if(s[i] == 'R') r++;
		if(s[i] == 'G') g++;
		if(s[i] == 'B') b++;
	}
	ll bleh = r*g*b; 
	for(int i = 0; i < n; i++){
		for(int j = i+2; j < n; j++){
			if(s[j] == s[i]) continue;
			if((i+j)%2 == 0){
				if(s[(i+j)/2] != s[j] and s[(i+j)/2] != s[i]) bleh--;
			}
		}
	}
	cout << bleh << '\n';
	
}


Measured memory_bytes: 3648
#include<stdio.h>

int main(){
  int sn,tn,count=0,i,j,t;
  int s[100000];
  scanf("%d",&sn);
  for(i=0;i<sn;i++){
    scanf("%d",&s[i]);
  }
  scanf("%d",&tn);
  for(i=0;i<tn;i++){
    scanf("%d",&t);
    int left=0;
    int right=sn;
    while(left<right){
      int mid;
      mid=(left+right)/2;
      if(s[mid]==t){
	count++;
	break;
      }
      else  if(t<s[mid])right=mid;
      else left=mid+1;
    }
  }
  printf("%d\n",count);
  return 0;
}

Measured memory_bytes: 988
import numpy as np
step = input()
step = list(step)
a = 0


for i, j in enumerate(step):
  if (i+1)%2 == 0 and j == "R":
    a += 1
    print("No")
    break
  elif (i+1)%2 == 1 and j=="L":
    a +=1
    print("No")
    break

if a == 0:
  print("Yes")
  

Measured memory_bytes: 21388
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
const long long INF = numeric_limits<long long>::max();
int main() {
    ll A,B,N;
    cin >> A>>B>>N;
    ll ans=0;
    if(B-1<=N){
        ll inst;
        if(A%B==0) inst=A/B;
        else inst=(ll)(A/B+1);
        inst*=-1;
        ans=A+inst;
    }else{
        ans=(ll)(A*N/B);
    }

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

Measured memory_bytes: 3624
#include <stdio.h>
	int main(void){
		int r,c,i,j,d[1000][1000];
		scanf("%d %d",&r,&c);
		for(i=0;i<r;i++){
			for(j=0;j<c;j++){
				scanf("%d",&d[i][j]);
			}
		}

		for(i=0;i<r;i++){
			for(j=0;j<c;j++){
				d[i][c]+=d[i][j];
				printf("%d ",d[i][j]);
			}
			printf("%d\n",d[i][c]);
		}

		for(i=0;i<c;i++){
			for(j=0;j<r;j++){
				d[r][i]+=d[j][i];
			}
			printf("%d ",d[r][i]);
		}
		for(j=0;j<c;j++){
			d[r][c]+=d[r][j];
		}

		printf("%d\n",d[r][c]);
		return 0;
}

Measured memory_bytes: 996
import java.io.*;
import java.io.BufferedReader; 
import java.io.IOException; 
import java.io.InputStreamReader; 
import java.util.StringTokenizer; 
import java.util.*;


public  class Main 
{

	   
	   static class FastReader 
	    { 
	        BufferedReader br; 
	        StringTokenizer st; 
	       
	  
	        public FastReader() 
	        { 
	            br = new BufferedReader(new
	                     InputStreamReader(System.in)); 
	        } 
	  
	        String next() 
	        { 
	            while (st == null || !st.hasMoreTokens()) 
	            { 
	                try
	                { 
	                    st = new StringTokenizer(br.readLine()); 
	                } 
	                catch (IOException  e) 
	                { 
	                    e.printStackTrace(); 
	                } 
	            } 
	            return st.nextToken();
	            
	        } 
	  
	        int nextInt() 
	        { 
	            return Integer.parseInt(next()); 
	        } 
	  
	        long nextLong() 
	        { 
	            return Long.parseLong(next()); 
	        } 
	  
	        double nextDouble() 
	        { 
	            return Double.parseDouble(next()); 
	        } 
	  
	        String nextLine() 
	        { 
	            String str = ""; 
	            try
	            { 
	                str = br.readLine(); 
	            } 
	            catch (IOException e) 
	            { 
	                e.printStackTrace(); 
	            } 
	            return str; 
	        }

			public Character charAt(int i) {
				// TODO Auto-generated method stub
				return null;
			} 
	    } 

  

	  // Complete the hurdleRace function below.
//    public static void solve() {
//    	FastReader s=new FastReader();

    public static void main(String[] args) throws IOException {
    	FastReader s=new FastReader();
   			int a = s.nextInt();
			int b = s.nextInt();
			if(a>=2*b)System.out.println(a-2*b);
			else System.out.println("0");
		
    }	
}





        
    

      
 

Measured memory_bytes: 32568
#include<bits/stdc++.h>
using namespace std;
#define rep(i,x) for(long long i=0; i<x;i++)
#define mod 1000000007
#define INF 10000000000000000
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }


struct UnionFind {
	vector<int> par;
  
  UnionFind(int N): par(N){
  	for(int i=0;i<N;i++) par[i] =i;
  }
};





int main(){
  ios::sync_with_stdio(false);
  
  int N;
  cin>>N;
  int a[N],b[N],c[N];
  rep(i,N) cin>>a[i]>>b[i]>>c[i];

    ll DP[N][3];
	DP[0][0] = a[0];
  DP[0][1] = b[0];
  DP[0][2] = c[0];
   
  for(int i=1;i<N;i++){
  	rep(j,3){
      if(j==0) DP[i][0] = max(DP[i-1][1],DP[i-1][2]) + a[i];
      if(j==1)	DP[i][1]= max(DP[i-1][0],DP[i-1][2]) + b[i];
      if(j==2) DP[i][2] = max(DP[i-1][0],DP[i-1][1]) +c[i];
    }
  }
  ll ans = max(DP[N-1][0],DP[N-1][1]);
  cout<< max(ans,DP[N-1][2]);
  
  
  
}

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

int main(){
    int w,h,n;
    cin>>w>>h>>n;
    int l=0,b=0;
    for(int i=0;i<n;i++){
        int x,y,a;
        cin>>x>>y>>a;
        if(a==1) l=max(x,l);
        if(a==2) w=min(x,w);
        if(a==3) b=max(y,b);
        if(a==4) h=min(y,h);
    }
    if(w-l<0||h-b<0) cout<<0<<endl;
    else cout<<max(0,(w-l)*(h-b))<<endl;
}

Measured memory_bytes: 3588
#include <iostream>
#include <cstdint>
#include <cmath>
#include <limits>

int main() {
  uint64_t target;
  std::cin >> target;
  
  uint64_t sq_target = std::sqrt(target);
  uint64_t ans = std::numeric_limits<uint64_t>::max();
  
  for (uint64_t i=1; i<=sq_target; ++i) {
    if (target % i == 0) {
      ans = std::min(ans, i + (target/i) - 2);
    }
  }
  std::cout << ans << std::endl;
}

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

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n, k;
	cin >> n >> k;
	vector<int> a(n);
	rep(i, n) cin >> a[i];
	int res;
	int ans = 1;
	if ((n - k) % (k - 1) == 0) {
		ans += (n - k) / (k - 1);
	}
	else {
		ans += (n - k) / (k - 1) + 1;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 640
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;

#define MOD 1000000007

int main() {
  ll x, k, d;
  cin >> x >> k >> d;
  x = abs(x);
  ll t = x / d;
  ll ans = 0;
  if (k < t) {
    ans = x - k * d;
  } else {
    ans = x - t * d;
    k -= t;
    if (k & 1) {
      ans = abs(ans - d);
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3644
import java.util.*;

import static java.lang.Math.round;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int d = sc.nextInt();
        double[][] b = new double[n][d];
        double sum =0;
        int count =0;
//        格納
        for(int i=0; i <n; i++) {
            for(int j =0; j <d ; j++ ) {
                b[i][j] = sc.nextDouble();
            }
        }



//        三重（何番目の座標なのか、ひかくする先の座標、何次元なのか)
        for(int k=0; k< n-1; k++){
            for(int l=k+1; l< n; l++){
                sum =0;
                for(int m=0; m< d; m++){
                    sum += Math.pow((b[k][m] - b[l][m]),2);

                }
                sum = Math.pow(sum, 0.5);
                if(sum - round(sum)==0){
                    count++;
                }
            }
        }

        System.out.println(count);

        }
    }

Measured memory_bytes: 23380
import java.util.*;
public class Main{
	public static void main(String[] args){
		int ans = 0;
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		if(N == 1){
			System.out.println("Hello World");
		}
		else if(N == 2){
			int a = sc.nextInt();
			int b = sc.nextInt();
			System.out.println(a+b);
		}
	}
}

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

using namespace std;

using int64 = long long;
const int mod = 1e9 + 7;

const int64 infll = (1LL << 62) - 1;
const int inf = (1 << 30) - 1;

struct IoSetup {
  IoSetup() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    cerr << fixed << setprecision(10);
  }
} iosetup;


template< typename T1, typename T2 >
ostream &operator<<(ostream &os, const pair< T1, T2 > &p) {
  os << p.first << " " << p.second;
  return os;
}

template< typename T1, typename T2 >
istream &operator>>(istream &is, pair< T1, T2 > &p) {
  is >> p.first >> p.second;
  return is;
}

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

template< typename T >
istream &operator>>(istream &is, vector< T > &v) {
  for(T &in : v) is >> in;
  return is;
}

template< typename T1, typename T2 >
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }

template< typename T1, typename T2 >
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

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

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

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

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


int main() {
  int N;
  cin >> N;
  vector< int64 > X(N), Y(N);
  set< pair< int, int > > mx;
  for(int i = 0; i < N; i++) {
    cin >> X[i] >> Y[i];
    mx.emplace(X[i], Y[i]);
  }
  vector< pair< int, int > > dd;
  for(int i = 0; i < N; i++) {
    for(int j = 0; j < N; j++) {
      dd.emplace_back(X[i] - X[j], Y[i] - Y[j]);
    }
  }

  sort(begin(dd), end(dd));
  dd.erase(unique(begin(dd), end(dd)), end(dd));

  int ret = N;
  for(int k = 0; k < dd.size(); k++) {
    int x = dd[k].first, y = dd[k].second;
    if(x == 0 && y == 0) continue;
    int path = N;
    for(int i = 0; i < N; i++) {
      path -= mx.count({X[i] - x, Y[i] - y});
    }
    chmin(ret, path);
  }

  cout << ret << endl;

}



Measured memory_bytes: 384