akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <complex>

using namespace std;

typedef complex<double> Point;
#define sq(x) (pow((x), (2.0)))
#define X real()
#define Y imag()

class Triangle{
    private:
        Point a, b, c;
        double edgeA, edgeB, edgeC;
        double angleA, angleB, angleC;
        double getAngle(double a, double b, double c){
            return acos((sq(b) + sq(c) - sq(a)) / (2.0 * b * c));
        }
    public:
        Triangle(Point p1, Point p2, Point p3){
            a = p1;
            b = p2;
            c = p3;
            edgeA = abs(b - c);
            edgeB = abs(a - c);
            edgeC = abs(a - b);
            angleA = getAngle(edgeA, edgeB, edgeC);
            angleB = getAngle(edgeB, edgeC, edgeA);
            angleC = getAngle(edgeC, edgeA, edgeB);
        }
        double circleRadius(){
            return (edgeA / sin(angleA)/ 2.0);
        }
        double circleX(){
            double A = sin(2.0 * angleA);
            double B = sin(2.0 * angleB);
            double C = sin(2.0 * angleC);
            return ((a.X * A + b.X * B + c.X * C) / (A+B+C));
        }
        double circleY(){
            double A = sin(2.0 * angleA);
            double B = sin(2.0 * angleB);
            double C = sin(2.0 * angleC);
            return ((a.Y * A + b.Y * B + c.Y * C) / (A+B+C));
        }
};

int main(){
    int n;
    double x1, y1, x2, y2, x3, y3;
    double r, xp, yp;
    scanf("%d", &n);
    for(int i = 0; i < n; ++i){
        scanf("%lf %lf %lf %lf %lf %lf",
                &x1, &y1, &x2, &y2, &x3, &y3);
        Point a(x1, y1);
        Point b(x2, y2);
        Point c(x3, y3);
        Triangle T(a, b, c);
        r = T.circleRadius();
        xp = T.circleX();
        yp = T.circleY();
        printf("%.3f %.3f %.3f\n", xp, yp, r);
    }
    return 0;
}

Measured memory_bytes: 1332
#include <stdio.h>
 
int main(void)
{
  int a, b, c, d, e;
  
  scanf("%d %d", &a, &b);
  scanf("%d %d", &c, &d);
  
  if (a == c) {
    e = 0;
  } else {
    e = 1;
  }
  printf("%d", e);
  
  return 0;
}

Measured memory_bytes: 128
package main

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

var sc = bufio.NewScanner(os.Stdin)

func main() {

	var s string
	if sc.Scan() {
		s = sc.Text()
	}

	if s == "Sunny" {
		fmt.Println("Cloudy")
	} else if s == "Cloudy" {
		fmt.Println("Rainy")
	} else if s == "Rainy" {
		fmt.Println("Sunny")
	}

}


Measured memory_bytes: 640
#!/usr/bin/env python3
import sys

YES = "Yes"  # type: str
NO = "No"  # type: str

baseb = list("abcdefghijklmnopqrstuvwxyz")

N = 0


def solve(S: str, T: str):
    from collections import Counter

    s = Counter(S)
    t = Counter(T)

    if sorted(s.values()) == sorted(t.values()):
        print("Yes")
    else:
        print("No")
    return
    return


# Generated by 1.1.3 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = next(tokens)  # type: str
    T = next(tokens)  # type: str
    solve(S, T)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3948
S = input()

while True:
    if S.endswith("dream") or S.endswith("erase"):
        S = S[:-5]
    elif S.endswith("dreamer"):
        S = S[:-7]
    elif S.endswith("eraser"):
        S = S[:-6]
    else:
        break
        
if S == "":
    print("YES")
else:
    print("NO")

Measured memory_bytes: 3188
#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
using namespace std;


int main(){
  double r;
  cin >> r;
  cout << fixed << setprecision(10) << pow(r, 2.0) * M_PI << endl;
  cout << fixed << setprecision(10) << 2 * r * M_PI << endl;
  return 0;
}

Measured memory_bytes: 1284
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
 
int main () {
    ll l, r;
    cin >> l >> r;
    if(r - l >= 2019){
        cout << 0 << endl;
        return 0;
    }
    l %= 2019;
    r %= 2019;
    int Min = 2019;
    for(int i = min(l, r); i < max(l, r); i++) {
        for(int j = i + 1; j <= max(l, r); j++) {
            Min = min((i * j) % 2019, Min);
            if (Min == 0) {
                cout << 0 << endl;
                return 0;
            }
        }
    }
    cout << Min << endl;
}

Measured memory_bytes: 3588
N = list(input())

tmp = int(N[-1])

if tmp == 2 or tmp == 4 or tmp == 5 or tmp == 7 or tmp == 9:
    print('hon')
if tmp == 0 or tmp ==1 or tmp == 6 or tmp == 8:
    print('pon')
if tmp == 3:
    print('bon')

Measured memory_bytes: 9180
# include <iostream>
using namespace std;
int main(){
	int n;
	cin>>n;
	long long a, b, c, m = 3500;
	for (a = 1; a <= m; a++){
		for (b = 1; b<= m; b++){
			long d = 4 * a * b - n * b - n * a;
			if (d != 0){
				if (n * a * b % d == 0){
					c = n * a * b / d;
					if (c > 0){
						cout<<a <<" " <<b <<" " <<c <<endl;
						return 0;
					}
				}
			}
		}
	}
}

Measured memory_bytes: 256
open System


[<EntryPoint>]
let main argv =
    let rec dsum n = if n <=0 then 0 else (dsum (n/10))+(n%10)
    let n = stdin.ReadLine()|>int
    if (n%(dsum n))=0 then "Yes" else "No"
    |>stdout.WriteLine
    0

Measured memory_bytes: 11220
s = input()
v=0
for i in range(4):
    v = v*10+int(s[i])
v1 = v//100
v2 = v%100
if 12>=v1>=1 and 12>=v2>=1:
    print("AMBIGUOUS")
elif (v1>=13 or v1==0) and 12>=v2>=1:
    print("YYMM")
elif (v2>=13 or v2==0) and 12>=v1>=1:
    print("MMYY")
else:
    print("NA")

Measured memory_bytes: 9108
// "header" {{{
#include <iostream>
#include <vector>
#include <algorithm>
#include <unordered_map>
#include <string>
#include <deque>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <cstring>
#include <iomanip>
#include <tuple>

using namespace std;

#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,n) for(int i=1;i<=(n);++i)
#define all(x) (x).begin(),(x).end()
#define pii pair<int,int> 
#define int long long
#define Fixed fixed << setprecision(10)
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const long long mod = 1000000007;

template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }

template <class T> using min_heap = priority_queue<T,vector<T>,greater<T> >;
template <class T> using max_heap = priority_queue<T>;

inline double sqrt( const double &x) 
{
	double         xHalf = 0.5 * x;
	int64_t  tmp   = 0x5FE6EB50C7B537AAl - ( *(int64_t*)&x >> 1);
	double         xRes  = * (double*)&tmp;

	xRes *= ( 1.5 - ( xHalf * xRes * xRes ) );
	xRes *= ( 1.5 - ( xHalf * xRes * xRes ) );
	xRes *= ( 1.5 - ( xHalf * xRes * xRes ) );
	xRes *= ( 1.5 - ( xHalf * xRes * xRes ) );
	return xRes * x;
}
// }}}

signed main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n,k;
	cin >> n >> k;
	vector<int> ng(10);
	rep(i,k){
		int d;
		cin >> d;
		ng[d] = true;
	}
	for(int i = n;;++i){
		int tmp = i;
		bool flg = true;
		while(tmp){
			if(ng[tmp % 10]){
				flg = false;
				break;
			}
			tmp /= 10;
		}
		if(flg) return cout << i << '\n',0;
	}
	return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i,m,n) for(int i=m; i<n; i++)
#define co(n) cout << n << endl
using namespace std;
int main(){
  long a, b, c=0, d=0, e, f, g, h, n;
  cin >> b >> n;
  rep(i,0,n){
    cin >> a;
    c+=a;
  }
  if(c>=b) co("Yes");
  else co("No");
  
  return 0;
}


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

int main(){
  string s;cin>>s;
  int ans=0;
  for(int i=0;i<3;i++){
    ans += s[i]=='1';
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>

using namespace std;

typedef long long ll;

const int MAX_N = 100000;

int n; 
ll m;
vector<int> graph[MAX_N];
vector<ll> dp[MAX_N];
int pi[MAX_N];

ll dfs(int v, int p=-1) {
    ll ret = 1LL;
    for(int i=0;i<graph[v].size();++i) {
        int u = graph[v][i];
        if(u == p) {
            pi[v] = i;
            continue;
        }
        dp[v][i] = dfs(u, v);
        ret *= dp[v][i] + 1LL;
        ret %= m;
    }
    return ret;
}

void bfs(int v, int *ans, ll res_p=0, int p=-1) {
    if(p != -1) {
        dp[v][pi[v]] = res_p;
    }
    vector<ll> dpl(graph[v].size()+1, 1LL);
    for(int i=0;i<graph[v].size();++i) {
        dpl[i+1] = dpl[i] * (dp[v][i]+1LL) % m;
    }
    vector<ll> dpr(graph[v].size()+1, 1LL);
    for(int i=graph[v].size()-1;i>=0;--i) {
        dpr[i] = dpr[i+1] * (dp[v][i]+1LL) % m;
    }
    ans[v] = dpr[0];
    for(int i=0;i<graph[v].size();++i) {
        int u = graph[v][i];
        if(u == p) continue;
        bfs(u, ans, dpl[i]*dpr[i+1]%m, v);
    }
}

int main() {
    cin >> n >> m;
    int a, b;
    for(int i=0;i<n-1;++i) {
        cin >> a >> b;
        --a; --b;
        graph[a].push_back(b);
        graph[b].push_back(a);
    }
  	for(int i=0;i<n;++i) {
      dp[i] = vector<ll>(graph[i].size(), 0LL);
    }

    dfs(0);
  	int ans[n];
    bfs(0, ans);

    for(int i=0;i<n;++i) {
        cout << ans[i] << endl;
    }
}

Measured memory_bytes: 24320
# include <bits/stdc++.h>
# define pb push_back
# define ll long long
# define fi first
# define se second
# define speed ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
# define mkp make_pair
//# define time cerr << "\nTime elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n"

using namespace std;

int q , w , e;

int main()
{
	speed;

    vector<pair<int,int>>vc;

    int n , t ;
    cin >> n >> t ;
    for(int i = 0 ; i < n ; i ++ ){
        int k , l ;
        cin >> k >> l ;
        if( l <= t ){
            vc.push_back(mkp(k , l));
        }
    }
    if(vc.size()==0){
        cout<<"TLE"<<endl;
        return 0;
    }
    sort(vc.begin(),vc.end());
    cout<<vc[0].fi;


	time;
}


Measured memory_bytes: 256
H, W, N = (int(i) for i in input().split())

P = []
for i in range(N):
    pa, pb = input().split()
    P.append((int(pa)-1, int(pb)-1))

Q = {}
for pa, pb in P:
    for i in range(3):
        for j in range(3):
            if (pa - i >= 0) and (pb - j >= 0) and (pa - i <= H - 3) and (pb - j <= W - 3):
                if (pa - i, pb - j) in Q:
                    Q[(pa - i, pb - j)] += 1
                else:
                    Q[(pa - i, pb - j)] = 1
cnt = [0] * 10
for k, v in Q.items():
    cnt[v] += 1
cnt[0] = (H - 2) * (W - 2) - len(Q)
for i in range(10):
    print(cnt[i])

Measured memory_bytes: 180020
x, y = map(int, input().split())

if x >= 0 and y >= 0:
    if y >= x:
        print(y - x)
    else:
        if y == 0:
            print(1 + x - y)
        else:
            print(x - y + 2)
elif x < 0 and y < 0:
    if y >= x:
        print(y - x)
    else:
        print(2 + x - y)
else:
    if y == 0:
        print(abs(x))
    else:
        print(abs(abs(x) - abs(y)) + 1)

Measured memory_bytes: 3064
#include<iostream>
#include<cstdio>
#define REG register
#define LLI long long
#define MOD 1000000007
#define MXN 100010

int n;
LLI a[MXN],
	inv[MXN],
	pre[MXN];

int main() {
	REG int i, j;
	
	scanf("%d", &n);
	for(i = 1; i <= n; i++)
		scanf("%lld", a+i);
	inv[1] = 1;
	for(i = 2; i <= n; i++)
		inv[i] = (MOD - MOD/i) * inv[MOD%i] % MOD;
	for(i = 1; i <= n; i++)
		pre[i] = (pre[i-1] + 1*inv[i]) % MOD;
	REG LLI ans = 0, fac = 1;
	for(i = 1; i <= n; i++)
		ans = (ans + a[i]*(pre[i]+pre[n-i+1]-1) % MOD) % MOD,
		fac = (fac * i) % MOD;
	ans = ans * fac % MOD;
	printf("%lld\n", ans);
	
	return 0;
}


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

#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef complex<double> point;
#define xx real()
#define yy imag()

#define REP(i, a, b) for(int i = (a); i < (int)(b); i++)
#define REPN(i, a, b) for(int i = (a); i <= (int)(b); i++)
#define FA(it, x) for(__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define SZ(x) (int)(x).size()
#define BE(x) (x).begin(), (x).end()
#define SORT(x) sort(BE(x))
#define _1 first
#define _2 second

#define x1 gray_cat_x1
#define y1 gray_cat_y1

template<class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

#define file "I1"

const double EPS = 1e-9;
const double PI = acos(-1.);
const int INF = 1e9;
const ll MOD = 1e9 + 7;

const int MAXN = 3e5 + 5;

vector<vi> ans;
vi tmp;
vi vv;

void solve(){
	ll n, a, b;
	cin >> n >> a >> b;
	if (a * b < n || a + b > n + 1) {
		printf("-1\n");
		return;
	}
	for(int i = 1; i <= n; i += a) {
		vv.pb(i);
	}
	int cnt = 0;
	int fl = 0;
	REP(i, 0, SZ(vv)) {
		int nxt = n;
		if (i < SZ(vv) - 1) {
			nxt = vv[i + 1] - 1;
		}
		tmp.clear();
		REPN(j, vv[i], nxt) {
			tmp.pb(j);
			cnt++;
			if (n - cnt + SZ(ans) + 1 == b) {
				fl = j + 1;
				break;
			}
		}
		ans.pb(tmp);
		if (fl > 0) {
			break;
		}
	}
	if (fl > 0) {
		REPN(i, fl, n) {
			tmp.clear();
			tmp.pb(i);
			ans.pb(tmp);
		}
	}
	for(int i = SZ(ans) - 1; i >= 0; i--) {
		REP(j, 0, SZ(ans[i])) {
			printf("%d ", ans[i][j]);
		}
	}
}   

int main(){

    //freopen(file".in", "r", stdin); freopen(file".out", "w", stdout);
    int t = 1;
    //cin >> t;
    while(t--){
        solve();    
    }
}


Measured memory_bytes: 13868
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;

const ll INF64 = 1LL << 60;
const int INF32 = 1 << 29;
const ll MOD = 1000000007;

int main(){
    int a, b, c, d, e, f;
    cin >> a >> b >> c >> d >> e >> f;
    a *= 100; b *= 100;
    int w = 0, s = 0;
    P ans = {0, a};
    for(int i = 0; i <= 30; ++i){
       w = a*i; s = 0;
       if(w+s>f){break;}
       for(int j = 0; j <= 30; ++j){
       	w = i * a +  j * b;
           if(w+s>f){break;}
           if(w == 0){break;}
           for(int k = 0; k <= f/c+1; ++k){
           	s = k * c;
               if(w+s>f){break;}
               if(100 * s > (w)*e){break;}
               for(int l = 0; l <= f/d+1; ++l){
               	s = k * c + l * d;
                   if(w+s>f){break;}
                   if(100 * s > (w)*e){break;}
                   if(ans.first *(s+w)<s*ans.second){ans = {s, s+w};}
        
              }
           }
       }
    }    

    cout << ans.second << " " << ans.first  << endl;
    
    return 0;
}

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


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



Measured memory_bytes: 3084
#include <bits/stdc++.h>
using namespace std;
const int INF=1e9;
int main(){
	int n, m, x;
	cin >> n >> m >> x;
	vector<int> c(n);
	vector<vector<int>> a(n,vector<int>(m));
	for(int i=0; i<n; ++i){
		cin >> c[i];
		for(int j=0; j<m; ++j){
			cin >> a[i][j];
		}
	}

	int N=(1<<12), ans=INF;
	for(int i=1; i<=N; ++i){
		bool flg=1;
		for(int j=0; j<m; ++j){
			int tx=0;
			for(int k=0; k<n; ++k){
				if((i>>k)&1) tx += a[k][j];
			}
			if(tx<x){
				flg=0;
				break;
			}
		}
		if(!flg) continue;
		int tc=0;
		for(int k=0; k<n; ++k){
			if((i>>k)&1) tc += c[k];
		}
		ans=min(ans,tc);
	}

	cout << (ans==INF? -1 : ans) << endl;
}

Measured memory_bytes: 3636
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
const int N=5e5;
int n,w[N],cnt[N];
int main()
{
    scanf("%d",&n);
    for(int i=1;i<=n;i++)scanf("%d",w+i);
    sort(w+1,w+n+1);
    if(w[n]!=w[n-1]){puts("Impossible");return 0;}
    if(n==2){puts("Possible");return 0;}
    if(w[1]<((w[n]+1)>>1)){puts("Impossible");return 0;}
    for(int i=1;i<=n;i++)cnt[w[i]]++;
    for(int i=(w[n]+3)>>1;i<=w[n];i++)if(cnt[i]<2){puts("Impossible");return 0;}
    if(cnt[(w[n]+1)>>1]>(w[n]&1)+1){puts("Impossible");return 0;}
    puts("Possible");
    return 0;
}

Measured memory_bytes: 3768
import  java.util.*;
class Main{
    int tate,yoko,takasa;
    int n;
    int r;
    
    Main(){
	Scanner sc=new Scanner(System.in);
	while(true){
	    tate=sc.nextInt();
	    yoko=sc.nextInt();
	    takasa=sc.nextInt();
	    if(tate==0 && yoko==0 && takasa==0){
		break;
	    }
	
	    n=sc.nextInt();

	    for(int i=0; i<n; i++){
		r=sc.nextInt();
		if((tate*tate)+(yoko*yoko)<r*2*2*r || (tate*tate)+(takasa*takasa)<r*2*2*r || (takasa*takasa)+(yoko*yoko)<r*2*2*r){
		    System.out.println("OK");
		}else{
		    System.out.println("NA");
	       	}
	    }
	   
	}
    }

    public static void main(String[] args){
	new Main();
    }
}

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

#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < n; i++)
typedef long long ll;

int main() {
    int a, b; cin >> a >> b;
    if(a + b >= 10) cout << "error" << endl;
    else cout << a + b << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define repd(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, n) repd(i, 0, n)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
template <class T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return true;
    }
    return false;
}
template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return true;
    }
    return false;
}

struct UnionFind
{
    vector<int> par, rank;

    UnionFind(int N) : par(N), rank(N)
    {
        rep(i, N) par[i] = i, rank[i] = 0;
    }

    int root(int x)
    {
        if (par[x] == x)
            return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y)
    {
        int rx = root(x);
        int ry = root(y);
        if (rx == ry)
            return;
        if (rank[rx] < rank[ry])
        {
            par[rx] = ry;
        }
        else
        {
            par[ry] = rx;
            if (rank[rx] == rank[ry])
                rank[rx]++;
        }
    }

    bool same(int x, int y)
    {
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

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

    vector<int> num(N);
    rep(i, N) cin >> num[i];

    UnionFind tree(N);
    rep(i, M)
    {
        int x, y;
        cin >> x >> y;
        x--;
        y--;
        tree.unite(x, y);
    }

    int ans = 0;
    rep(i, N)
    {
        if (tree.same(i, num[i] - 1))
        {
            ans++;
        }
    }

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


Measured memory_bytes: 1408
N=int(input())
a=list(map(int,input().split()))
from fractions import gcd
x=a[0]
lcm=a[0]
for i in range(1,N):
    x=gcd(x,a[i])
    lcm=lcm*a[i]//x
ans=0
for i in range(N):
    ans+=(lcm-1)%a[i]
print(ans)


Measured memory_bytes: 66536
#include <bits/stdc++.h>
#define REP(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;
typedef long long ll;
const ll mod = 1e9+7;
#define all(x) (x).begin(),(x).end()

template<class T> inline void chmin(T& a, T b) {
    if (a > b) {
        a = b;
    }
}

template<class T> inline void chmax(T& a, T b) {
    if (a < b) {
        a = b;
    }
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    std::cout<<std::fixed<<std::setprecision(10);
    ll N;
    cin >> N;
    if(N%2 == 1){
        cout <<N/2<< "\n";
    }else{
        cout <<N/2-1<< "\n";
    }
}

Measured memory_bytes: 256
import java.util.*;
 
 
public class Main {
    public static void main(String[] args) {
        // 自分の得意な言語で
        // Let's チャレンジ！！
 
        Scanner sc = new Scanner(System.in);
        String line = sc.nextLine();
      String s[]=line.split(" ",0);
      int n=Integer.parseInt(s[0]);
      int m=Integer.parseInt(s[1]);
      if(n%m==0)
        System.out.println(0);
      else System.out.println(1);
    }
}

Measured memory_bytes: 21844
/*dismint|jjc*/
#include <bits/stdc++.h>
using namespace std;

#define io(F) string t_="";ifstream fin(t_+F+".in");ofstreamfout(t_+F+".out")
#define qio ios_base::sync_with_stdio(false); cin.tie(NULL)
#define forl(V, S, E) for(int V = S; V < E; V++)
#define ford(V, S, E) for(int V = S; V >= E; V--)
#define fore(E, X) for(auto &E:X)
#define println(X) cout << X << endl
#define printe(X) for(auto &E:X) cout << E << " "; cout << endl
#define graph unordered_map<int, unordered_set<int>>
typedef long long ll;

int r[5000], g[5000], b[5000];
int main() {
	qio; int n; string s; cin >> n >> s;
	forl(i, 1, n+1) {
		if(s[i-1] == 'R') r[i]++;
		else if(s[i-1] == 'G') g[i]++;
		else b[i]++;
		r[i+1] += r[i];
		g[i+1] += g[i];
		b[i+1] += b[i];
	}
	ll ans = 0;
	forl(i, 0, n) {
		forl(j, i+1, n) {
			set<char> c = {'R', 'G', 'B'};
			c.erase(s[i]); c.erase(s[j]);
			if(c.size() != 1) continue;
			if(*c.begin() == 'R') {
				ans += r[j+1]-r[i+1];
			}
			else if(*c.begin() == 'G') {
				ans += g[j+1]-g[i+1];
			}
			else {
				ans += b[j+1]-b[i+1];
			}
			if((j-i)%2 == 0) {
				if(s[(i+j)/2] == *c.begin()) ans--;
			}
		}
	}
	println(ans);
}


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

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string a,b;
    cin>>a>>b;
    vector<long long>v1(27,0);
    vector<long long>v2(27,0);
    long cnt = 0;
    for(auto i=0;i<a.length();i++)
    {
        if(a[i]==b[i])
        continue;
        else
        cnt++;
    }
    cout<<cnt<<"\n";
}

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

int main(){
    double L;
    cin >> L;
    double ans = L * L * L;
    ans /= 27;
    printf("%.12lf\n", ans);
    return 0;
}

Measured memory_bytes: 256
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<cmath>
#include<cstdio>
#include<cctype>
#include<string>
#include<vector>
#include<climits>
#include<cstring>
#include<cstdlib>
#include<iostream>
#include<algorithm>
#define endl '\n'
#define max(a, b) (a > b ? a : b)
#define min(a, b) (a < b ? a : b)
#define zero(a) memset(a, 0, sizeof(a))
#define INF(a) memset(a, 0x3f, sizeof(a))
#define IOS ios::sync_with_stdio(false)
#define _test printf("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n")
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<ll, ll> P2;
const double pi = acos(-1.0);
const double eps = 1e-7;
const ll MOD =  1000000007LL;
const int INF = 0x3f3f3f3f;
const int _NAN = -0x3f3f3f3f;
const double EULC = 0.5772156649015328;
const int NIL = -1;
template<typename T> void read(T &x){
    x = 0;char ch = getchar();ll f = 1;
    while(!isdigit(ch)){if(ch == '-')f*=-1;ch=getchar();}
    while(isdigit(ch)){x = x*10+ch-48;ch=getchar();}x*=f;
}
const int maxn = 1e5+10;
ll arr[maxn];
int main(void) {
    ll n, m;
    scanf("%lld%lld", &n, &m);
    ll t, num;
    for (int i = 0; i<n; ++i) {
        scanf("%lld", &arr[i]);
        if (!i)
            t = arr[i]/2;
        else 
            t = arr[i]/2/(__gcd(arr[i]/2, t))*t;
    }
    for (int i = 0; i<n; ++i)
        if (!(t%arr[i])) {
            printf("0\n");
            return 0;
        }
    t = m/t;
    if (t&1)
        ++t;
    printf("%lld\n", t/2);
    return 0;
}


Measured memory_bytes: 1024
#pragma GCC optimize ("O3")

#include <bits/stdc++.h>

using namespace std;

#ifdef LOCAL
#include <prettyprint.hpp>
#define debug(...)  cerr << "[" << #__VA_ARGS__ << "]: ", d_err(__VA_ARGS__);
#else
#define debug(...) 83;
#endif

void d_err() {
    cerr << endl;
}

template <typename H, typename... T>
void d_err(H h, T... t) {
    cerr << h << " ";
    d_err(t...);
}

template <typename T>
void print(T x) {
    cout << x << endl;
}

#define ALL(x) (x).begin(), (x).end()
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define bcnt __builtin_popcountll

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<ll,ll> Pll;
typedef pair<int,int> Pin;

ll INF = 1e16;
int inf = 1e9;
ll MOD = 1e9+7;

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    
    ll N;
    cin >> N;

    vector<char> ans;

    while(N > 0) {
        int c = N % 26;
        if (c == 0) c = 25;
        else c--;

        ans.pb('a' + c);
        N = N / 26 - int(N % 26 == 0);
    }

    reverse(ALL(ans));

    REP(i, ans.size()) {
        cout << ans[i];
    }

    cout << endl;
    
}


Measured memory_bytes: 3648
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#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++)
using namespace std;

int f(int n) {
  int res = 0;
  for (int i = 1; i <= n; ++i) {
    if (n % i == 0) ++res;
  }
  return res;
}

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

  int n;
  cin >> n;

  int res = 0;
  for (int i = 1; i <= n; i += 2) if (f(i) == 8) ++res;

  cout << res << endl;
  return 0;
}

Measured memory_bytes: 3648
N = int(input())
X = sorted([int(x) for x in input().split()])
min_cost = 0
is_first = True
for p in range(X[0]+1, X[-1]):
    cost_sum = 0
    for x in X:
        cost_sum += (x-p)**2
    if is_first:
        min_cost = cost_sum
        is_first = False
    else:
        min_cost = min(min_cost, cost_sum)

print(min_cost)

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

long long n, k, p = 0, mnum = 0;
vector<long long> a;
long long dp[70][2][2] = {0};
long long cnt[70] = {0};

long long solve();

int main() {
  cin >> n >> k;
  for(long long i = 0; i < n; ++i) {
    long long x;
    cin >> x;
    a.push_back(x);
    mnum = max(x, mnum);
  }
  mnum = max(k, mnum);
  while((1LL << p) <= mnum) ++p;
  cout << solve() << endl;
  return 0;
}

long long solve() {
  long long ans = 0;
  for(long long i = 0; i < n; ++i)
    for(long long j = 0; j < p; ++j)
      cnt[j] += (a[i] >> j) % 2;
  for(int i = p - 1; i >= 0; --i) {
    long long one = cnt[i] * (1LL << i),
              two = (n - cnt[i]) * (1LL << i);
    if((k >> i) % 2) {
      dp[i][0][1] =
          one + max(max(dp[i + 1][0][1], dp[i + 1][1][1]),
                    max(dp[i + 1][1][0], dp[i + 1][0][0]));
      if(i != p - 1)
        dp[i][1][1] =

            two + max(dp[i + 1][1][1], dp[i + 1][0][1]);
      dp[i][1][0] =

          two + max(dp[i + 1][0][0], dp[i + 1][1][0]);
    }
    else {
      if((1LL << i) <= k)
        dp[i][0][1] =
            one + max(dp[i + 1][1][1], dp[i + 1][0][1]);
      dp[i][0][0] =
          one + max(dp[i + 1][1][0], dp[i + 1][0][0]);
      if((1LL << i) <= k)
        dp[i][1][1] =
            two + max(dp[i + 1][1][1], dp[i + 1][0][1]);
    }
  }
  for(int j = 0; j < 2; ++j)
    for(int l = 0; l < 2; ++l) ans = max(ans, dp[0][j][l]);
  return ans;
}

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

ll solve(ll n, ll c, ll d, ll g) {
	return n / c + n / d - n / g;
}
ll gcd(ll a, ll b) {
	return b ? gcd(b, a % b) : a;
}
int main() {
	ll a, b, c, d;
	cin >> a >> b >> c >> d;
	ll x1 = solve(a - 1, c, d, c * d / gcd(c, d));
	ll x2 = solve(b, c, d, c * d / gcd(c, d));
	cout << (b - a + 1) - (x2 - x1) << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip> 
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;


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

	int a, b, i, ct = 0;
	string s, ss;
	cin >> a >> b;
	for (i = a; i <= b; i++) {
		s = to_string(i);
		ss = s;
		reverse(ss.begin(), ss.end());
		if (s == ss) ct++;
	}
	cout << ct << "\n";

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pt(sth) cout << sth << "\n"
#define chmax(a, b) {if(a<b) a=b;}
#define chmin(a, b) {if(a>b) a=b;}
#define moC(a, s, b) (a)=((a)s(b)+MOD)%MOD
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
static const ll INF=1e18;
static const ll MAX=101010;
static const ll MOD=1e9+7;





int main(void) {
  ll N;
  cin >> N;
  ll i, j;
  
  for(i=1; i<=3500; i++) {
    for(j=1; j<=3500; j++) {
      ll n=N*i*j;
      ll d=4*i*j-N*i-N*j;
      
      if(d<=0) continue;
      
      if(n%d==0) {
        pt(i<<" "<<j<<" "<<n/d);
        return 0;
      }
      
    }
  }
  
  
  
}








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

using namespace std;

int main(){
    int k;
    int t;
    cin >> k>>t;
    int b=0,sum=0;
    for(int i=0;i<t;i++){
        int k1;
        cin >> k1;
        sum+=k1;
        if(b<k1){b=k1;}
    }
    if(sum-b>=b){cout << 0<<endl;}
    else {cout << 2*b-sum-1<<endl;}
return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0), cout.tie(0);
	
	int n, mxw;
	cin >> n >> mxw;
	pair<int, int> z[n];
	for (int i = 0; i < n; i++) {
		int x, y;
		cin >> x >> y;
		z[i].first = x;
		z[i].second = y;
	}
	
	long long dp[n + 1][mxw + 1];
	fill(dp[0], dp[0] + mxw + 1, 0);
	for (int i = 1; i <= n; i++) {
		for (int j = 0; j <= mxw; j++) {
			dp[i][j] = dp[i - 1][j];
			if (j + z[i - 1].first <= mxw) dp[i][j] = max(dp[i][j], dp[i - 1][j + z[i - 1].first] + z[i - 1].second);
		}
	}
	cout << dp[n][0];
}

Measured memory_bytes: 82568
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
using ll = long long;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-8;
const int MOD = 1000000007;
// const int MOD = 998244353;
const int dy[] = {1, 0, -1, 0}, dx[] = {0, -1, 0, 1};
const int dy8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dx8[] = {0, -1, -1, -1, 0, 1, 1, 1};
template <typename T, typename U> inline bool chmax(T &a, U b) { return a < b ? (a = b, true) : false; }
template <typename T, typename U> inline bool chmin(T &a, U b) { return a > b ? (a = b, true) : false; }
struct IOSetup {
  IOSetup() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
  }
} iosetup;

int main() {
  string t; cin >> t;
  int n = t.length();
  if (n == 1) {
    cout << (t[0] == '?' ? "D" : t) << '\n';
    return 0;
  }
  vector dp(n + 1, vector(2, -INF)), prev(n + 1, vector(2, -1));
  dp[0][1] = 0;
  REP(i, n) REP(j, 2) {
    if (t[i] == 'P' || t[i] == '?') {
      int pd = dp[i][j];
      if (pd > dp[i + 1][0]) {
        dp[i + 1][0] = pd;
        prev[i + 1][0] = j;
      }
    }
    if (t[i] == 'D' || t[i] == '?') {
      int pd = dp[i][j] + 1 + (j == 0);
      if (pd > dp[i + 1][1]) {
        dp[i + 1][1] = pd;
        prev[i + 1][1] = j;
      }
    }
  }
  int j = dp[n][0] > dp[n][1] ? 0 : 1;
  string ans = j == 0 ? "P" : "D";
  for (int i = n; i >= 2; --i) {
    ans += prev[i][j] == 0 ? 'P' : 'D';
    j = prev[i][j];
  }
  reverse(ALL(ans));
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 25696
def main():
    s, t = input(), input()
    ans = len(t)
    for i in range(len(s) - len(t)+1):
        substr = s[i:i+len(t)]
        diff = 0
        for a, b in zip(substr, t):
            if a != b:
                diff += 1
        if ans > diff:
            ans = diff
    print(ans)

if __name__=="__main__":
    main()

Measured memory_bytes: 8940
import java.util.Scanner;

public class Main {

    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String str = sc.nextLine();
        for(char c : str.toCharArray()){
            if(65 <= c && c <= 90) System.out.print((char)(c + 32));
            else if(97 <= c && c <= 122) System.out.print((char)(c - 32));
            else System.out.print(c);
        }
        System.out.println();
    }

}

Measured memory_bytes: 26620
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
    public static void main(final String[] args) {
        final FastScanner scanner = new FastScanner(System.in);
        final double n = scanner.nextInt();
        final double m = scanner.nextInt();
        final double d = scanner.nextInt();

        final double nodes = d == 0 ? n : (n - d) * 2;

        System.out.println(nodes / (n * n) * (m - 1));
    }

    private static class FastScanner {
        private final BufferedReader reader;
        private StringTokenizer tokenizer;

        FastScanner(final InputStream in) {
            reader = new BufferedReader(new InputStreamReader(in));
            tokenizer = null;
        }

        String next() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }
    }
}
    

Measured memory_bytes: 21844
#include<stdio.h>

int main()
{
    int n, a, b;

    scanf("%d", &n);

    if(n==1)
    {
        printf("Hello World");
    }
    else{
        scanf("%d%d", &a, &b);

        printf("%d", a+b);
    }
    //printf("\n");

    return 0;
}


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

using namespace std;

typedef long long ll;
typedef long double ld;

#define INF numeric_limits<int>::max()
#define st string
#define pb push_back
#define eb emplace_back
#define pii pair<int, int>
#define mp make_pair
#define fopen freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL);

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

void solve(){
    st s; cin >> s;
    int l = s.length();
    if(s[l-1] != 's') cout << s << 's' << endl;
    else cout << s << "es" << endl;
}

int main(){
    fastio
    solve();
    return 0;
}


Measured memory_bytes: 3660
#include <bits/stdc++.h>
using namespace std;
  
int main() {
  
  int c[3][3];//3×3の配列
  
  for(int i=0; i<3; i++){
    for(int j=0; j<3; j++){
      cin >> c[i][j];
    }
  }
  
  if(
    (abs(c[0][0]-c[0][1])==abs(c[1][0]-c[1][1]))&&
    (abs(c[1][0]-c[1][1])==abs(c[2][0]-c[2][1])) && 
    
    (abs(c[0][1]-c[0][2])==abs(c[1][1]-c[1][2])) &&
    (abs(c[1][1]-c[1][2])==abs(c[2][1]-c[2][2])) && 
    
     (abs(c[1][0]-c[0][0])==abs(c[1][1]-c[0][1]))&&
    (abs(c[1][1]-c[0][1])==abs(c[1][2]-c[0][2])) && 
    
     (abs(c[2][0]-c[1][0])==abs(c[2][1]-c[1][1])) &&
    (abs(c[2][1]-c[1][1])==abs(c[2][2]-c[1][2]))
  ){
    cout << "Yes" << endl;
  }else{
    cout << "No" << 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 calc_figure(ll num){
    int res = 0;
    while (num >= 10)
    {
        num = num / 10.0;
        res++;
    }
    res++;
    return res;

}

int main() {
    ll N; cin >> N;
    int ans = 1000000;
    int fAB = 0;
    // cout << sqrt(N) << endl;
    for(ll A = 1; A <= sqrt(N); A++){
        if( N % A == 0){
            ll B = N / A;
            int A_figure = calc_figure(A);
            int B_figure = calc_figure(B);
            fAB =  max(A_figure, B_figure);
            ans = min(ans, fAB);  
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define dump(a) cout << (a) << '\n';
typedef int64_t Int;
Int mod = 1e9+7;
// Int MOD = 998244353;

int main() {
    ios::sync_with_stdio(false);
    Int n, k;
    cin >> n >> k;
    if (n % 2 == 0) {
        dump(k <= n / 2 ? "YES" : "NO");
    }
    else {
        dump(k - 1 <= n / 2 ? "YES" : "NO");
    }
    return 0;  
} 

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

int charToInt(char c){
    char zero_num = '0';
    return (int)c - (int)zero_num;
}

signed main(){
    int N, D; cin>>N>>D;
    vec_int X(N), Y(N);
    rep(i,N){
        cin>>X.at(i)>>Y.at(i);
    }
    int count = 0;
    rep(i,N){
        int Distance = X.at(i)*X.at(i)+Y.at(i)*Y.at(i);
        if(Distance<=D*D){
            count++;
        }
    }

    cout<<count<<endl;


    return 0;
}

Measured memory_bytes: 6424
import sys
sys.setrecursionlimit(10**6)
n, m = map(int, input().split())
edges = [[] for _ in range(n)]
rank = [0 for _ in range(n)]
is_root = [True for _ in range(n)]

for _ in range(m):
	x, y = map(int, input().split())
	edges[x-1].append(y-1)
	rank[y-1] += 1
	is_root[y-1] = False

dp = [0 for _ in range(n)]
def dfs(x):
	global dp
	for c in edges[x]:
		rank[c] -= 1
		dp[c] = max(dp[c], dp[x]+1)
		if rank[c] == 0:
			dfs(c)
	return

for i in range(n):
	if is_root[i]:
		dfs(i)

#print(dp)
print(max(dp))

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

int main(){
    int i, j, k;

    cin >> i >> j >> k;

    if(i == j && j == k){
        cout << "No";
    }
    else if(i != j && i != k && j != k){
        cout << "No";
    }
    else cout << "Yes";

    cout << "\n";

    return 0;
}

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

using namespace std;
const int N=2e5+5;
int a[N];
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    int n;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        int x;cin>>x;
        if(x%2==0&&x%5&&x%3) return cout<<"DENIED"<<'\n',0;
    }
    cout<<"APPROVED"<<'\n';
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<numeric>
#include<string>
#include<cmath>
#include<set>
#include<queue>
#include<deque>
#include<bitset>
#include<iomanip>
#include<cctype>
#include<map>
#include<cstring>
#include<bitset>
#include<cassert>

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep2(i,a,b) for (int (i)=a;(i)<(b);(i)++)
#define all(x) (x).begin(),(x).end()

using namespace std;
using ll = long long int;

const int inf = 1001001000;
const long long int Inf = 1001001001001001000;



void print(vector<vector<int>> a){
	for (int i = 0; i < a.size(); i++)
	{
		for (int j=0;j<a[i].size();j++){
			cout << a[i][j] << " ";
		}
		cout << endl;
	}
}

void print(vector<vector<long long int>> a){
	for (int i=0;i<a.size();i++){
		for (int j=0;j<a[i].size();j++){
			cout << a[i][j] << " ";
		}
		cout << endl;
	}
}

void print(vector<int> a){
    int n = a.size();
    for (int j=0;j<n;j++) {
        if (j != n-1) cout << a[j] << " ";
        else cout << a[j] << endl;
    }
}

void print(vector<long long int> a){
    int n = a.size();
    for (int j=0;j<n;j++) {
        if (j != n-1) cout << a[j] << " ";
        else cout << a[j] << endl;
    }
}

void print(set<int> a){
	for (auto x:a)
		cout << x << " ";
	cout << endl;
}

int main(){
	int k, x;
	cin >> k >> x;
	rep2(i, x - k + 1, x + k) cout << i << " ";
	cout << endl;
	return 0;
}


Measured memory_bytes: 256
readlines[0...-1].map { |s| s.split.map &:to_i }.each { |h,w|
    puts ("#"*w<<"\n")
    (1...h-1).each{ print "#","."*(w-2),"#\n" }
    puts ("#"*w<<"\n") if h > 1
    puts
}

Measured memory_bytes: 8784
import java.io.BufferedInputStream;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc=new Scanner(new BufferedInputStream(System.in));
        int a=sc.nextInt();
        int b=sc.nextInt();
        int max=(a>b)?a:b;
        int min=(a<b)?a:b;
        for(int i=0;i<max;i++)
            System.out.print(min);
    }
}


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

int main() {
  int n,k,q; cin >>n >>k >>q;
  vector<int> a(n, k-q);
  int buf;
  for (int i=0; i<q; i++){
    cin >>buf;
    a.at(buf-1)++;
  }
  for (int i=0; i<n; i++){
    if (a.at(i)<=0) cout <<"No";
    else cout <<"Yes";
    cout <<endl;
  }
  
  //cout <<ans;
  //cout <<endl;
}

Measured memory_bytes: 1024
n, k = [int(i) for i in input().split()]
a = [int(j) for j in input().split()]
dp = [0] * (n + 1)
start = 0
period = 0
for i in range(1, n + 1):
    dp[i] = a[dp[i - 1]] - 1
b = dp[n]
if k < n:
    print(dp[k] + 1)
else:
    for j in range(n - 1, -1, -1):
        if dp[j] == b:
            period = n - j
            break
    for i in range(n + 1 - period):
        if dp[i] == dp[i + period]:
            start = i
            break
    k = start + (k - start) % period
    print(dp[k] + 1)
    
        
    

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


#define li			long long int
#define rep(i,to)	for(li i=0;i<((li)(to));i++)
#define repp(i,start,to)	for(li i=(li)(start);i<((li)(to));i++)
#define pb			push_back
#define sz(v)		((li)(v).size())
#define bgn(v)		((v).begin())
#define eend(v)		((v).end())
#define allof(v)	(v).begin(), (v).end()
#define dodp(v,n)		memset(v,(li)n,sizeof(v))
#define bit(n)		(1ll<<(li)(n))
#define mp(a,b)		make_pair(a,b)
#define rin	rep(i,n)
#define EPS 1e-12
#define ETOL 1e-8
#define MOD 1000000007
typedef pair<li, li> PI;

#define INF bit(60)

#define DBGP 1


#define idp if(DBGP)
#define F first
#define S second
#define p2(a,b)		idp cout<<a<<"\t"<<b<<endl
#define p3(a,b,c)		idp cout<<a<<"\t"<<b<<"\t"<<c<<endl
#define p4(a,b,c,d)		idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<endl
#define p5(a,b,c,d,e)		idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<endl
#define p6(a,b,c,d,e,f)		idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<endl
#define p7(a,b,c,d,e,f,g)		idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<endl
#define p8(a,b,c,d,e,f,g,h)		idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<endl
#define p9(a,b,c,d,e,f,g,h,i)		idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<endl
#define p10(a,b,c,d,e,f,g,h,i,j)		idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<"\t"<<j<<endl
#define foreach(it,v)	for(__typeof((v).begin()) it=(v).begin(); it!=(v).end(); ++it)
#define p2p(x)		idp p2((x).F, (x).S)
#define dump(x,n)	idp{rep(i,n){cout<<x[i]<<" ";}puts("");}
#define dump2(x,n)	idp{rep(i,n){cout<<"["<<x[i].F<<" , "<<x[i].S<<"] ";}puts("");}
#define dumpi(x)	idp{foreach(it, x){cout<<(*it)<<" ";}puts("");}
#define dumpi2(x)	idp{foreach(it, x){cout<<"["<<(it)->F<<" , "<<(it)->S<<"] ";}puts("");}

#define read2d(a,w,h)	rep(i,h)rep(j,w)cin>>a[i][j]
#define dump2d(a,w,h)	rep(i,h){rep(j,w)cout<<a[i][j]<<" ";puts("");}

typedef pair<li, li> PI;

li a[200200];
li cnt[111];

int main() {
	li n;
	cin >> n;
	rin{
		cin >> a[i];
		cnt[a[i]]++;
	}
	sort(a, a + n);
	li half = (a[n - 1] + 1) / 2;
	if (a[0] < half) {
		puts("Impossible");
		return 0;
	}
	if (half * 2 == a[n - 1]) {
		if (cnt[half] != 1) {
			puts("Impossible");
			return 0;
		}
	} else if (cnt[half] != 2) {
		puts("Impossible");
		return 0;
	}
	repp(i, half + 1, a[n - 1]) {
		if (cnt[i] < 2) {
			puts("Impossible");
			return 0;
		}
	}
	puts("Possible");


	return 0;
}

Measured memory_bytes: 256
import java.util.*
import java.math.*
import java.lang.Math.*

val readString: ()->String = {readLine()!!}
val readInt: ()->Int = {readLine()!!.toInt()}
val readLong: ()->Long = {readLine()!!.toLong()}
val readIntArray: ()->IntArray = {readLine()!!.split(' ').map{it.toInt()}.toIntArray()}
val readLongArray: ()->LongArray = {readLine()!!.split(' ').map{it.toLong()}.toLongArray()}
val errPrintln: (String)->Unit = {msg -> System.err.println(msg)}
val MOD = 1e9.toLong()+7
val INF = Int.MAX_VALUE/2
val LINF = Long.MAX_VALUE/2
data class IntPair(val first: Int, val second: Int)
data class To(val idx: Int, val cost: Long)


class Bellman(val eg: Array<ArrayList<To>>, val start: Int) {
    private var dist = LongArray(0)

    var hasCycle = false
    private set

    init {
        val N = eg.size

        dist = LongArray(N){-LINF}
        dist[start] = 0L

        for (i in 0 until N) {
            var updating = false
            for (x in 0 until N)  {
                for (t in eg[x]) {
                    val y = t.idx

                    if (dist[x] + t.cost > dist[y]) {
                        dist[y] = dist[x] + t.cost
                        updating = true
                    }
                }
            }
            if (!updating) break
        }

        hasCycle = calcCycle()
    }


    private fun calcCycle(): Boolean {
        val N = eg.size
        val ndst = dist.clone()
        for (i in 0 until N) {
            var updating = false
            for (x in 0 until N)  {
                for (t in eg[x]) {
                    val y = t.idx
                    if (ndst[x] + t.cost > ndst[y]) {
                        ndst[y] = ndst[x] + t.cost
                        updating = true
                    }
                }
            }
            if (!updating) break
        }

        return ndst[N-1] != dist[N-1]
    }


    fun distance(i: Int): Long {
        return if(hasCycle) LINF else dist[i]
    }
}


fun solve(eg: Array<ArrayList<To>>): Long {
    val N = eg.size

    val bm = Bellman(eg, 0)

    return bm.distance(N-1)
}


fun main(args: Array<String>) {
    val (N, M) = readIntArray()
    val eg = Array(N){ArrayList<To>()}
    for (i in 0 until M) {
        var (a, b, c) = readLongArray()
        a--;b--;
        eg[a.toInt()].add(To(b.toInt(), c))  // 有向グラフ
    }

    val ans = solve(eg)

    if (ans == LINF) println("inf")
    else println(ans)
}


Measured memory_bytes: 53300
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <bits/stdc++.h>
#include <iomanip>
#include <numeric>
#include <map>
#include <algorithm>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (ll i = a; i < (ll)b; ++i)
#define P pair<ll, ll>
#define INF 10e12
#define MAX 51000
#define all(x) (x).begin(), (x).end()
#define MX(x) *max_element(all(x))
#define MN(x) *min_element(all(x))

int main(void)
{
    int n, m;
    cin >> n >> m;
    vector<P> que(m);
    rep(i, 0, m)
    {
        int a, b;
        cin >> a >> b;
        que[i].first = a, que[i].second = b;
    }
    sort(all(que));
    ll ans = 1;
    P tmp = {que[0].first, que[0].second};
    rep(i, 0, m - 1)
    {
        if (tmp.second <= que[i + 1].first)
            ans++, tmp.first = que[i + 1].first, tmp.second = que[i + 1].second;
        else
            tmp.first = max(tmp.first, que[i + 1].first), tmp.second = min(tmp.second, que[i + 1].second);
    }
    cout << ans << endl;
}

Measured memory_bytes: 4808