akhauriyash/Code-Regression huggingface dataset:
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<map>
#include<queue>
using namespace std;
typedef long long ll;
const int N=1e5+11,INF=~0u>>2;
struct Edge{int nxt,from,to,w;}edge[N<<2];
struct Point{int x,y,id;}p[N];
int n,num_edge,head[N],fa[N];
ll ans;
int read(){
	int x=0,f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-') f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return f*x;
}
void add_edge(int from,int to,int w){
	edge[++num_edge].nxt=head[from];
	edge[num_edge].to=to;
	edge[num_edge].w=w;
	edge[num_edge].from=from;
	head[from]=num_edge;
}
bool cmpx(Point a,Point b){
	return a.x<b.x;
}
bool cmpy(Point a,Point b){
	return a.y<b.y;
}
bool cmp(Edge a,Edge b){
	return a.w<b.w;
}
int find(int x){
	return x==fa[x]?x:fa[x]=find(fa[x]);
}
void Kruskal(){
	sort(edge+1,edge+1+num_edge,cmp);
	for(int i=1;i<=n;++i) fa[i]=i;
	int cnt=0;
	for(int i=1;i<=num_edge;++i){
		int f1=find(edge[i].from),f2=find(edge[i].to);
		if(f1!=f2){
			cnt++;
			fa[f2]=f1;
			ans+=edge[i].w;
		}
		if(cnt==n-1) return;
	}
}
int main(){
//	freopen("ex.in","r",stsdin);
	n=read();
	for(int i=1;i<=n;++i){
		p[i].x=read();
		p[i].y=read();
		p[i].id=i;
	}
	sort(p+1,p+n+1,cmpx);
	for(int i=1;i<n;++i){
		add_edge(p[i].id,p[i+1].id,p[i+1].x-p[i].x);
//		add_edge(p[i+1].id,p[i].id,p[i+1].x-p[i].x);
	}
	sort(p+1,p+n+1,cmpy);
	for(int i=1;i<n;++i){
		add_edge(p[i].id,p[i+1].id,p[i+1].y-p[i].y);
//		add_edge(p[i+1].id,p[i].id,p[i+1].y-p[i].y);
	}
	Kruskal();
	printf("%lld",ans);
	return 0;
}

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

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N, M, Q;
    cin >> N >> M >> Q;
    vector<vector<ll>> trainLR(N + 1, vector<ll>(N + 1, 0));
    for (int i = 0; i < M; i++)
    {
        ll left, right;
        cin >> left >> right;
        trainLR.at(left).at(right)++;
    }
    vector<vector<ll>> ruisekiTrainLR(N + 1, vector<ll>(N + 1, 0)); //二次元累積
    for (int i = 1; i <= N; i++)
    {
        for (int j = 1; j <= N; j++)
        {
            ruisekiTrainLR.at(i).at(j) = ruisekiTrainLR.at(i).at(j - 1) + ruisekiTrainLR.at(i - 1).at(j) - ruisekiTrainLR.at(i - 1).at(j - 1) + trainLR.at(i).at(j);
        }
    }
    vector<pll> questions;
    for (int i = 0; i < Q; i++)
    {
        ll qLeft, qRight;
        cin >> qLeft >> qRight;
        questions.emplace_back(qLeft, qRight);
    }

    for (auto question : questions)
    {
        ll qLeft, qRight;
        tie(qLeft, qRight) = question;
        cout << ruisekiTrainLR.at(qRight).at(qRight) - ruisekiTrainLR.at(qRight).at(qLeft - 1) - ruisekiTrainLR.at(qLeft - 1).at(qRight) + ruisekiTrainLR.at(qLeft - 1).at(qLeft - 1) << endl;
    }
    return 0;
}


Measured memory_bytes: 6640
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A[3];
  cin >> A[0] >> A[1] >> A[2];
  sort(A,A+3);
  if(A[0] == 5 && A[1] == 5 && A[2] == 7){
  	cout << "YES" << endl;
  }else{
  	cout << "NO" << endl;
  }
}

Measured memory_bytes: 256
struct Restraunt {
    city: String,
    point: usize,
    n: usize,
}

impl Restraunt {
    pub fn new(city: String, point: usize, n: usize) -> Self {
        Restraunt {city: city, point: point, n: n}
    }
}

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).unwrap();
    let mut iter = buf.split_whitespace();
    let n: usize = iter.next().unwrap().parse().unwrap();

    let mut restraunts = Vec::new();

    for i in 0..n {
        let mut buf = String::new();
        std::io::stdin().read_line(&mut buf).unwrap();
        let mut iter = buf.split_whitespace();
        let s = iter.next().unwrap();
        let p: usize = iter.next().unwrap().parse().unwrap();

        restraunts.push(Restraunt::new(s.to_string(), p, i+1));
    }

    restraunts.sort_by(|a, b| if b.city == a.city { b.point.cmp(&a.point) } else { a.city.cmp(&b.city) });

    for restraunt in restraunts {
        println!("{}", restraunt.n);
    }
}


Measured memory_bytes: 4352
#include <iostream>
#include <array>
#include <algorithm>
#include <vector>
#include <bitset>
#include <set>
#include <unordered_set>
#include <cmath>
#include <complex>
#include <deque>
#include <iterator>
#include <numeric>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
#include <functional>
#include <cassert>
// using namespace std;

// using ll=long long;
// template<class T> using V = vector<T>;
// template<class T, class U> using P = pair<T, U>;
// using vll = V<ll>;
// using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)
#define ALL(v) v.begin(),v.end()
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; }
#define DEBUG_VLL(vec) REP(sz, vec.size()) std::cerr<<vec[sz]<<(sz==vec.size()-1?'\n':' ');

const long long MOD = 1000000007;
const long long HIGHINF = (long long)1e18;

int main() {
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    int n;
    std::cin >> n;
    std::vector< std::vector<int> > dig(10, std::vector<int>(10, 0));

    int tmp = 1;
    for (int i = 1; i <= n; i++) {
        if (i >= tmp * 10) tmp *= 10;
        dig[i / tmp][i % 10]++;
    }

    long long ans = 0;
    for (int i = 1; i < 10; i++) for (int j = 1; j < 10; j++) ans += (long long)dig[i][j] * dig[j][i];
    std::cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<list>
#include<set>
#include<map>
#include<utility>
#include<cmath>


#define rep(i,x) for(int i=0;i<(int)(x);i++)
#define reps(i,x) for(int i=1;i<=(int)(x);i++)
#define rrep(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define rreps(i,x) for(int i=((int)(x));i>0;i--)

#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define INF 2e9

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
typedef long long ll;
int gcd(int a,int b){return b?gcd(b,a%b):a;}

using namespace std;

int main()
{
    ll x, y;
    cin >> x >> y;

    ll p = y/x;
    ll d = 1;
    ll cnt = 0;
    while(d <= p){
        d *= 2;
        cnt++;
    }

    cout << cnt;

    
}

Measured memory_bytes: 256
x, k, d = map(int, input().split())

# x >= 0
if x < 0:
    x *= -1

if k * d < x:
    ans = x - k * d
else:
    q, r = divmod(x, d)
    k -= q
    if k & 1:
        ans = d - r
    else:
        ans = r

print(ans)

Measured memory_bytes: 61868
#include<bits/stdc++.h>
    #define REP(i,n) for(int i=0;i<n;i++)
    #define LOOP(i,x,n) for(int i=x;i<n;i++)
    #define ALL(v) (v).begin(),(v).end()
    #define PB push_back
    #define MP make_pair
    #define FIR first
    #define SEC second
    #define int long long
    using namespace std;
    const int MOD=1000000007;
    const int INF=1000000009;
     
    signed main(){
      string s,t;
      cin>>s>>t;
      if(s<t)cout<<'<'<<endl;
      else if(s>t)cout<<'>'<<endl;
      else cout<<'='<<endl;
      return 0;
    }

Measured memory_bytes: 256
#include<cstdio>
#include<queue>
#include<utility>
#include<cstring>
#include<stack>
#include<algorithm>
#include<cmath>
#include<iostream>
#include<map>
#define MAX_N 100001
#define INF_INT 2147483647
#define INF_LL 9223372036854775807
#define REP(i,n) for(int i=0;i<(int)(n);i++)
void init(int n);
int find(int n);
void unite(int x,int y);
bool same(int x, int y);
int dx[4] = {1,0,0,-1};
int dy[4] = {0,1,-1,0};
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> P;
bool cmp_P(const P &a,const P &b){
  return a.second < b.second;
}
int main()
{
  int A,B,C,D,res=0;
  cin >> A >> B >> C >> D;
  REP(i,101){
    if((A <= i && i < B)  && (C <= i && i < D))
      res++;
  }
  cout << res << endl;
  return 0;
}

int par[MAX_N];
int ranks[MAX_N];

//n要素で初期化
void init(int n){
  REP(i,n){
    par[i] = i;
    ranks[i] = 0;
  }

}

//木の根を求める
int find(int x){
  if(par[x] == x){
    return x;
  }else{
    return par[x] = find(par[x]);
  }
}

void unite(int x,int y){
  x = find(x);
  y = find(y);
  if(x == y) return ;
  if(ranks[x] < ranks[y]){
    par[x] = y;
  }else{
    par[y] = x;
    if(ranks[x] == ranks[y]) ranks[x]++;
  }
}

bool same(int x, int y){
  return find(x) == find(y);
}



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

int main()
{
	double result = 0.0;
	int N;
	cin >> N;
	vector<int> V(N, 0);

	repeat(i, N)
	{
		cin >> V[i];
	}

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

	double middle = 0.0;
	result = middle = (double)(V[0] + V[1]) / 2;
	for (int i = 2; i < N; i++) {
		middle = (middle + V[i]) / 2;
		if (middle > result)
			result = middle;
	}

	cout << fixed << setprecision(5) << result << endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
clock_t t=clock();
namespace my_std{
	using namespace std;
	#define pii pair<int,int>
	#define fir first
	#define sec second
	#define MP make_pair
	#define rep(i,x,y) for (int i=(x);i<=(y);i++)
	#define drep(i,x,y) for (int i=(x);i>=(y);i--)
	#define go(x) for (int i=head[x];i;i=edge[i].nxt)
	#define templ template<typename T>
	#define sz 1010
	#define mod 1000000007ll
	typedef long long ll;
	typedef double db;
	mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
	templ inline T rnd(T l,T r) {return uniform_int_distribution<T>(l,r)(rng);}
	templ inline bool chkmax(T &x,T y){return x<y?x=y,1:0;}
	templ inline bool chkmin(T &x,T y){return x>y?x=y,1:0;}
	templ inline void read(T& t)
	{
		t=0;char f=0,ch=getchar();double d=0.1;
		while(ch>'9'||ch<'0') f|=(ch=='-'),ch=getchar();
		while(ch<='9'&&ch>='0') t=t*10+ch-48,ch=getchar();
		if(ch=='.'){ch=getchar();while(ch<='9'&&ch>='0') t+=d*(ch^48),d*=0.1,ch=getchar();}
		t=(f?-t:t);
	}
	template<typename T,typename... Args>inline void read(T& t,Args&... args){read(t); read(args...);}
	char __sr[1<<21],__z[20];int __C=-1,__zz=0;
	inline void Ot(){fwrite(__sr,1,__C+1,stdout),__C=-1;}
	inline void print(register int x)
	{
		if(__C>1<<20)Ot();if(x<0)__sr[++__C]='-',x=-x;
		while(__z[++__zz]=x%10+48,x/=10);
		while(__sr[++__C]=__z[__zz],--__zz);__sr[++__C]='\n';
	}
	void file()
	{
		#ifdef NTFOrz
		freopen("a.in","r",stdin);
		#endif
	}
	inline void chktime()
	{
		#ifdef NTFOrz
		cout<<(clock()-t)/1000.0<<'\n';
		#endif
	}
	#ifdef mod
	ll ksm(ll x,ll y){ll ret=1;for (;y;y>>=1,x=x*x%mod) if (y&1) ret=ret*x%mod;return ret;}
	ll inv(ll x){return ksm(x,mod-2);}
	#else
	ll ksm(ll x,int y){ll ret=1;for (;y;y>>=1,x=x*x) if (y&1) ret=ret*x;return ret;}
	#endif
//	inline ll mul(ll a,ll b){ll d=(ll)(a*(double)b/mod+0.5);ll ret=a*b-d*mod;if (ret<0) ret+=mod;return ret;}
}
using namespace my_std;

int n,m;ll K;
char s[sz][sz];

struct Mat
{
	ll a[2][2];
	const Mat operator * (const Mat &m) const 
	{
		Mat ret;memset(ret.a,0,sizeof(ret.a));
		rep(i,0,1) rep(k,0,1) rep(j,0,1) (ret.a[i][j]+=a[i][k]*m.a[k][j]%mod)%=mod;
		return ret;
	}
}I,A,ret;

void KSM(ll y)
{
	I.a[0][0]=I.a[1][1]=1;ret=I;
	for (;y;y>>=1,A=A*A) if (y&1) ret=ret*A;
}

int main()
{
	file();
	read(n,m,K);
	rep(i,1,n) cin>>(s[i]+1);
	int flg=0;
	rep(i,1,m) if (s[1][i]=='#'&&s[n][i]=='#') flg=1;
	rep(i,1,n) if (s[i][1]=='#'&&s[i][m]=='#') flg|=2;
	if (flg&1) rep(i,1,max(n,m)) rep(j,1,i) swap(s[i][j],s[j][i]);
	if (flg&1) swap(n,m);
	int c1=0,c2=0,c3=0,c4=0;
	rep(i,1,n) c1+=(s[i][1]=='#'&&s[i][m]=='#');
	rep(i,1,n) rep(j,1,m) c2+=(s[i][j]=='#'&&s[i][j-1]!='#');
	rep(i,1,n) rep(j,1,m) c3+=(s[i][j]=='#');
	rep(i,1,n) rep(j,2,m) c4+=(s[i][j]=='#'&&s[i][j-1]=='#');
	if (flg==3||K<=1) return puts("1"),0;
	if (!flg) return printf("%lld\n",ksm(c3,K-1)),0;
	K-=2;
	A.a[0][0]=c1,A.a[1][0]=-c4,A.a[1][1]=c3;
	KSM(K);
	ll ans=(c1*ret.a[1][0]%mod+c2*ret.a[1][1]%mod+mod*2)%mod;
	cout<<ans;
	return 0;
}


Measured memory_bytes: 4736
# coding: utf-8
import sys
# from operator import itemgetter
sysread = sys.stdin.readline
read = sys.stdin.read
sys.setrecursionlimit(10 ** 7)
#from heapq import heappop, heappush
#from collections import OrderedDict, defaultdict
import math
#from itertools import product, accumulate, combinations, product
#import bisect# lower_bound etc
#import numpy as np
#from copy import deepcopy
#from collections import deque
#import numba

def run():
    N = int(sysread())
    A = list(map(int, sysread().split()))
    Q = int(sysread())
    stocks = [0 for _ in range(10** 5 + 1)]
    total = 0
    for a in A:
        stocks[a] += 1
        total += a

    for _ in range(Q):
        b,c = map(int, sysread().split())
        stocks[c] += stocks[b]
        total += c * stocks[b]
        total -= b * stocks[b]
        stocks[b] = 0
        print(total)


if __name__ == "__main__":
    run()

Measured memory_bytes: 21128
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int[] arr = new int[3];
		for(int i = 0 ; i<3;i++) {
			arr[i] = sc.nextInt();
		}
		Arrays.parallelSort(arr);
		int sum = 0;
		for(int i = 0 ;i<2;i++) {
			sum+=arr[i];
		}
		System.out.println(sum);
	}

}


Measured memory_bytes: 21844
import sys
from collections import defaultdict, deque
import bisect
from heapq import *
from math import factorial
sys.setrecursionlimit(200000)
input = sys.stdin.readline

A, B = map(int, input().split())
# N = int(input())
# L = [int(v) for v in input().split()]
# L = [[int(v) for v in input().split()] for _ in range(N)]
# L = [int(input()) for _ in range(N)]
# L = [list(input().strip())  for _ in range(N)]
# S = input().strip()

def gcd(a, b):
    if a < b:
        a, b = b, a
    if a % b == 0:
        return b
    return gcd(b, a % b)

# https://en.wikipedia.org/wiki/Trial_division
def f(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1: a.append(n)
    # Only odd number is possible
    return a

c = gcd(A, B)

print(len(set(f(c))) + 1)

Measured memory_bytes: 3316
#include <iostream>
#include <string>
#include <math.h>
#include <bitset>
#include <sstream>
using namespace std;
int main(){
    int n,m,x;
    cin >> n >> m >> x;
    int c[n];
    int a[n][m];
    int rr[m]={0};
    long min_cost = 0;
    int i,j, k;
    for(i=0;i<n;i++){
        cin >> c[i];
        min_cost+=c[i];
        for(j=0;j<m;j++){
            cin >> a[i][j];
            rr[j]+=a[i][j];
        }
    }
    
    bool flg=true;
    for(i=0;i<m;i++){
        if(rr[i]<x){
            flg=false;
            break;
        }
    }
    if(flg==false){
        cout << -1 << endl;
        return 0;
    }
    int ll=1;

    for(i=0;i<n;i++)ll*=2;
    int lofst = 12-n;
    for(i = 0; i < ll; i++){
        std::stringstream ss;
        ss << std::bitset<12>(i);
        string s = ss.str();
        int r[m]={0};
        long cost = 0;
        for(j = 0; j < n; j++){
            if(s[j+lofst]=='1'){
                cost += c[j];
                for(k=0;k<m;k++){
                    r[k]+=a[j][k];
                    
                }
            }
        }
        flg=true;
        for(j=0;j<m;j++){
            if(r[j]<x){
                flg=false;
                break;
            }
        }
        if(flg && (cost < min_cost)){
            min_cost = cost;
        }
    }
    cout << min_cost << endl;
    return 0;
}

Measured memory_bytes: 3648
k, a, b = list(map(int, input().split(" ")))

if(a >= b):
    print(k+1)
    exit()


if(k+1 >= k+1+(-2-a+b)):
    print(k+1)
    exit()


if((k+1-a) % 2 == 0):
    print((b-a) * ((k+1-a)//2) + a)
else:
    print((b-a) * ((k+1-a)//2) + a + 1)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n; 
  cin >> n;
  
  vector<int> p(n);
  for(int i=0; i<n; i++){
    cin >> p[i];
  }
 
  vector<int> q(n);
  for(int j=0; j<n; j++){
    q[j] = j+1;
  }
  
  int sum=0;
  int num=0;
  for(int k=0; k<n; k++){
    sum += p[k] - q[k];
    if(p[k] != q[k]){
      num++;
    }
  }
  
  if(sum==0 && num==2){
    cout << "YES" << endl;
  }
  else if(sum==0 && num==0){
    cout << "YES" << endl;
  }
  else{
    cout << "NO" << endl;
  }
  
  
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define int llint
#define rep(i, a, n) for(int (i) = (int)(a);(i) < (int)(n);++(i))
#define repe(i, a, n) for(int (i) = (int)(a);(i) <= (int)(n);++(i))
#define repif(i, a, x) for(int (i) = (int)(a);(x);++(i))
#define repr(i, a, n) for(int (i) = ((int)(a)-1);(i) >= (int)(n);--(i))
#define reper(i, a, n) for(int (i) = (int)(a);(i) >= (int)(n);--(i))
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define SIZE(x) ((int)(x).size())
#define ALL(x) (x).begin(), (x).end()
#define RNG(x, a, n) &((x)[a]), &((x)[n])
#define ADD(a, b) ((((a)%MOD)+((b)%MOD))%MOD)
#define MUL(a, b) ((((a)%MOD)*((b)%MOD))%MOD)
#define CEIL(x) ((int)ceil(((double)x)))
#define POW(x, y) ((int)pow(x, y))
#define UNIQUE(x) (x).erase(unique(ALL((x))), (x).end())
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
#define yes cout << "yes" << endl;
#define no cout << "no" << endl;
#define fcout cout << fixed << setprecision(10)
#define pb push_back
#define pf push_front
#define mp make_pair
#define mt make_tuple
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define EPS (1e-20)
#define INF 2147483647
#define MOD 1000000007
using llint = long long;
using VI = std::vector<int>;
using PII = std::pair<int, int>;
using SI = std::set<int>;
using MII = std::map<int, int>;
using TIII = std::tuple<int, int, int>;
using VLL = std::vector<llint>;
using MCI = std::map<char, int>;
using VPII = std::vector<PII>;
using namespace std;


int N;
string S[2];


int judge(int i){
	if(S[0][(size_t)i] == S[1][(size_t)i]) return 0;
	return 1;
}


int solve(){
	int ans;
	rep(i, 0, N){
		if(i == 0 && judge(i) == 0) ans = 3;
		else if(i == 0 && judge(i) == 1) ans = 6, i++;
		else if(judge(i-1) == 0 && judge(i) == 0) ans = MUL(ans, 2);
		else if(judge(i-1) == 0 && judge(i) == 1) ans = MUL(ans, 2), i++;
		else if(judge(i-1) == 1 && judge(i) == 1) ans = MUL(ans, 3), i++;
	}
	return ans;
}


signed main(){
	cin >> N;
	rep(i, 0, 2) cin >> S[i];

	cout << solve() << endl;

	return 0;
}

Measured memory_bytes: 256
n = int(input())
x = list(map(int,input().split()))

ave = sum(x)//len(x)
ave_1 = ave+1
ans = 0
ans_1 = 0
for i in range(len(x)):
	ans += (x[i]-ave)**2
	ans_1 += (x[i]-ave_1)**2

print(min(ans,ans_1))


Measured memory_bytes: 3060
#include<bits/stdc++.h>
namespace my_std{
	using namespace std;
	#define Rint register int
	#define FOR(i,a,b) for(register int i=(a);i<=(b);++i)
	#define ROF(i,a,b) for(register int i=(a);i>=(b);--i)
	#define GO(x) for(register int i=p[x].head,v;i;i=e[i].link)
	#define FILE(s) freopen(s".in","r",stdin),freopen(s".out","w",stdout)
	#define PII pair<int,int>
	#define MP make_pair
	typedef long long LL;
	typedef double DB;
	inline int read(){
		int ans=0,f=1;char c=getchar();
		while(c>'9'||c<'0'){ f^=(c=='-'); c=getchar(); }
		for(;c<='9'&&c>='0';c=getchar()) ans=ans*10+c-'0'; return f?ans:-ans;
	}
	const int mod = 1e9+7;
	inline void inc(int &x,const int &y){ x+=y; if(x>=mod) x-=mod; }
	inline int ksm(int x,LL y){ int res=1; for(;y;y>>=1,x=1ll*x*x%mod) if(y&1) res=1ll*res*x%mod; return res;}
}
using namespace my_std;

int n,k;

int main(){
	n = read() , k = read();
	printf("%d",max(0,n-k+1));
	return 0;
}


Measured memory_bytes: 256
package main

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

var sc, wr = bufio.NewScanner(os.Stdin), bufio.NewWriter(os.Stdout)

func scanString() string   { sc.Scan(); return sc.Text() }
func scanRunes() []rune    { return []rune(scanString()) }
func scanInt() int         { a, _ := strconv.Atoi(scanString()); return a }
func scanInt64() int64     { a, _ := strconv.ParseInt(scanString(), 10, 64); return a }
func scanFloat64() float64 { a, _ := strconv.ParseFloat(scanString(), 64); return a }

func scanInts(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = scanInt()
	}
	return res
}

func debug(a ...interface{}) { fmt.Fprintln(os.Stderr, a...) }

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}
func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

//•*¨*•.¸¸♪main•*¨*•.¸¸♪(　-ω-)ノ　(　・ω・)
func main() {
	defer wr.Flush()
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 10000), 1001001)

	n := scanInt()
	ps := scanInts(n)

	bit := make(BIT, n+2)
	idx := make([]int, n+1)
	for i := 0; i < n; i++ {
		idx[ps[i]] = i+1
	}

	ans := 0
	for i := 0; i < n; i++ {
		num := n-i
		base := bit.Sum(idx[num])
		r1 := sort.Search(n+1-idx[num], func(idr int) bool {
			return 1 <= bit.Sum(idx[num]+idr)-base
		})+idx[num]
		r2 := sort.Search(n+1-idx[num], func(idr int) bool {
			return 2 <= bit.Sum(idx[num]+idr)-base
		})+idx[num]

		l1 := sort.Search(idx[num], func(idl int) bool {
			return -1 < -(base-bit.Sum(idl))
		})
		l2 := sort.Search(idx[num], func(idl int) bool {
			return -2 < -(base-bit.Sum(idl))
		})

		bit.Add(idx[num], 1)

		ans += ((r1-idx[num])*(l1-l2)+(r2-r1)*(idx[num]-l1))*(num)
		// debug(num,ans)
		// debug(idx[num], l2, l1, r1, r2)
	}

	fmt.Fprintln(wr, ans)

}

// BIT type
type BIT []int

// Sum function calculates a sum to i
func (t BIT) Sum(i int) int {
	s := 0
	for i++; i > 0; i -= i & -i {
		s += t[i]
	}
	return s
}

// Add function add x to i
func (t BIT) Add(i, x int) {
	for i++; i < len(t); i += i & -i {
		t[i] += x
	}
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define endl '\n'
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define pf pop_front
#define yes cout << "YES" << '\n';
#define no cout << "NO" << '\n';
#define watch(x) cout << (#x) << " is " << (x) << endl
using namespace std;

int const MAXS = 1e5 + 5;

void solve(){
    int n;
    cin >> n;
    cout << ((n >= 30) ? "Yes" : "No") << endl;
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    solve();
    return 0;
}

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

using namespace std;

using ll = long long;

const ll MOD = 1000000007;

ll modpow(ll x, ll n, ll mod = MOD) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * x % mod;
        x = x * x % mod;
        n >>= 1;
    }
    return res;
}

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

    vector<int> a(p);
    for (int i = 0; i < p; i++) cin >> a[i];

    vector<int> poly(p + 1, 0);
    poly[0] = 1;
    for (int i = 0; i < p; i++) {
        int hoge = (p - i) % p;
        vector<int> tmp(p + 1, 0);
        for (int j = 0; j < p; j++) {
            tmp[j + 1] = poly[j];
        }

        for (int j = 0; j <= p; j++) {
            (tmp[j] += poly[j] * hoge % p) %= p;
        }

        poly = move(tmp);
    }

    vector<int> ans(p, 0);
    for (int i = 0; i < p; i++) {
        if (a[i] == 0) continue;

        vector<int> tmp_poly(poly);
        vector<int> poly2(p, 0);

        for (int j = p; j >= 1; j--) {
            if (tmp_poly[j] == 0) continue;
            poly2[j - 1] = tmp_poly[j];

            (tmp_poly[j - 1] += tmp_poly[j] * i % p) %= p;
            tmp_poly[j] = 0;
        }

        int calc = 0;
        for (int j = p - 1; j >= 0; j--) {
            calc = ((calc * i) % p + poly2[j]) % p;
        }

        int coef = modpow(calc, p - 2, p);
        for (int j = 0; j < p; j++) {
            (ans[j] += poly2[j] * coef % p) %= p;
        }
    }

    for (int i = 0; i < p; i++) {
        cout << ans[i] << " \n"[i + 1 == p];
    }
    return 0;
}

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

void solve(long long A, long long B, long long C){
	printf("%lld\n", min(B/A, C));
}

int main(){
	long long C;
	long long A;
	long long B;
	scanf("%lld",&A);
	scanf("%lld",&B);
	scanf("%lld",&C);
	solve(A, B, C);
	return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int x = sc.nextInt();
		long[] a = new long[N];
		for (int i = 0; i < N; ++i) {
			a[i] = sc.nextInt();
		}
		long c = 0;
		for (int i = 1; i < N; ++i) {
			if (a[i] + a[i - 1] > x) {
				c += a[i] + a[i - 1] - x;
				a[i] -= a[i] + a[i - 1] - x;
				if (a[i] < 0) {
					a[i - 1] += a[i];
					a[i] = 0;
				}
			}
		}

		System.out.println(c);
	}

	static void tr(Object... objects) {
		System.out.println(Arrays.deepToString(objects));
	}
}


Measured memory_bytes: 47420
a, b, k = map(int, input().split())
if b - a > k:
    lst_small = [x for x in range(a, a + k)]
    lst_large = [x for x in range(b - k + 1, b + 1)]
    ans = list(set(lst_small) | set(lst_large))
    ans = sorted(ans)
else:
    ans = [x for x in range(a, b + 1)]

for i in range(len(ans)):
    print(ans[i])

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define co cout
#define ci cin
#define sf1(n) scanf("%lld",&n);
#define sf2(n,m) scanf("%lld %lld",&n,&m);
#define sf3(n,m,p) scanf("%lld %lld %lld",&n,&m,&p);
#define en cout<<endl;
#define pb push_back
#define coy cout<< "YES"<<endl;
#define con cout<< "NO"<<endl;
#define For(a,b) for(ll a=0;a<b;a++)
#define br break;
#define i64 long long
i64 M=10000000;
//ll b[805],ans[805];
map< ll,pair<ll,ll> >mp;

int main()
{
    ll t,n,g,k,m,mx=0,mn=1e9,res,c1,x,y,c2;
    ci>>n;
    ll a[n];
    for(ll i=0;i<n;i++)
    {
        ci>>g;
        a[g-1]=i+1;
    }
    for(ll i=0;i<n;i++) co<<a[i]<< " ";
}



Measured memory_bytes: 1536
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <cmath>
#include <iomanip>
#include <functional>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define REP(i, n) for (int i = 1; i < (int)(n); ++i)
using namespace std;
using lint = int64_t;

int main() {
    int N, M;
    cin >> N >> M;
    vector<vector<int>> G(3 * N);
    rep(i, M) {
        int u, v;
        cin >> u >> v;
        --u;
        --v;
        G[3 * u].push_back(3 * v + 1);
        G[3 * u + 1].push_back(3 * v + 2);
        G[3 * u + 2].push_back(3 * v);
    }
    int S, T;
    cin >> S >> T;
    --S;
    --T;
    
    vector<int> dist(3 * N, -1);
    queue<int> q;
    dist[3 * S] = 0;
    q.push(3 * S);
    while (!q.empty()) {
        int u = q.front();
        q.pop();
        for (int v : G[u]) {
            if (dist[v] == -1) {
                dist[v] = dist[u] + 1;
                q.push(v);
            }
        }
    }
    if (dist[3 * T] == -1) cout << -1 << "\n";
    else cout << dist[3 * T] / 3 << "\n";
    return 0;
}


Measured memory_bytes: 17920
#include<bits/stdc++.h>
#define N 1000006
#define LL long long 
#define register reg
using namespace std;

int n,m;
string s;

inline int qr()
{
	int x=0,w=1;char a=0;
	while(a<'0'||a>'9'){if(a=='-')w=-1;a=getchar();}
	while(a<='9'&&a>='0'){x=(x<<3)+(x<<1)+(a^48);a=getchar();}
	return x*w;
}

inline LL qrl()
{
	LL x=0,w=1;char a=0;
	while(a<'0'||a>'9'){if(a=='-')w=-1;a=getchar();}
	while(a<='9'&&a>='0'){x=(x<<3)+(x<<1)+(a^48);a=getchar();}
	return x*w;
}

int main()
{
	LL a,b,c,d;
	a=qrl();
	b=qrl();
	c=qrl();
	d=qrl();
	cout<<max(max(a*c,b*d),max(b*c,a*d))<<endl;
	return 0;
}

Measured memory_bytes: 3632
#include <iostream>
#include <string>
using namespace std;
int main(){
  string s;
  cin >> s;
  bool a = s.length() % 2 == 0;
  bool b = s[0] == s[s.length()-1];
  if(a != b)
    cout << "Second" << endl;
  else
    cout << "First" << endl;
}


Measured memory_bytes: 640
#include <algorithm>
#include <cmath>
#include <complex>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>
#include <functional>
#include <cstring>
#include <regex>
#include <random>
#include <cassert>
using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, s, n) for (int i = (s); i < (int)(n); i++)
#define revrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define revrepr(i, s, n) for (int i = (n) - 1; i >= s; i--)
#define debug(x) cerr << #x << ": " << x << "\n"
#define popcnt(x) __builtin_popcount(x)

using ll = long long;
using P = pair<int, int>;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

template<class T>
istream& operator >>(istream &is, vector<T> &v) {
    for (int i = 0; i < (int)v.size(); i++) cin >> v.at(i);
    return is;
}

template<class T, class U>
ostream& operator <<(ostream &os, pair<T, U> p) {
    cout << '(' << p.first << ", " << p.second << ')';
    return os;
}

template<class T>
void print(const vector<T> &v, const string &delimiter) { rep(i, v.size()) cout << (0 < i ? delimiter : "") << v.at(i); cout << endl; }

template<class T>
void print(const vector<vector<T>> &vv, const string &delimiter) { for (const auto &v: vv) print(v, delimiter); }

const int N = 200001;
ll bit[N + 1];

//[1, i]
ll maximum(int i) {
    ll mx = 0;
    while (i > 0) {
        mx = max(mx, bit[i]);
        i -= i & -i;
    }
    return mx;
}

void add(int i, ll x) {
    while (i <= N) {
        bit[i] = max(bit[i], x);
        i += i & -i;
    }
}

int main() {
    int n;
    cin >> n;
    vector<int> h(n);
    vector<ll> a(n);
    cin >> h >> a;
    rep(i, n) add(h[i], a[i] + maximum(h[i] - 1));
    cout << maximum(n) << endl;
}

Measured memory_bytes: 4224
n, k = map(int, raw_input().split())
arr = map(int, raw_input().split())

def gcd(a, b):
    if b == 0: return a
    return gcd(b, a % b)

cur = arr[0]
for x in arr:
    cur = gcd(cur, x)

if k % cur == 0 and k <= max(arr):
    print "POSSIBLE"
else:
    print "IMPOSSIBLE"


Measured memory_bytes: 40940
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <unordered_map>
#include <cstdlib>
using namespace std;
#define Ma_PI 3.141592653589793
#define eps 0.00000001
#define LONG_INF 3000000000000000000
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define MOD 998244353
#define REP(i,n) for(long long i = 0;i < n;++i)    
#define seg_size 524288
#include <complex>
typedef complex<double> P;
double dot(P a, P b) {
	return (a.real() * b.real() + a.imag() * b.imag());
}
double cross(P a, P b) {
	return (a.real() * b.imag() - a.imag() * b.real());
}
int ccw(P a, P b,P c) {
	P e = b - a;
	P f = c - a;
	if (cross(e, f) > eps) {
		return 1;
	}
	if (cross(e, f) < -eps) {
		return -1;
	}
	if (dot(e, f) < -eps) return 2;
	if (abs(e) < abs(f)) return -2;
	return 0;
}
bool intersect(P a, P b, P c, P d) {
	if (ccw(a, b, c) * ccw(a, b, d) <= 0) {
		if (ccw(c, d, a) * ccw(c, d, b) <= 0){
			return 1;
		}
	}
	return 0;
}
double getDistanceLP(P a, P b, P c) {
	return abs(cross(b - a, c - a) / abs(b - a));
}
double getDistanceSP(P a, P b, P c) {
	if (dot(b - a, c - a) < 0.0) return abs(c - a);
	if (dot(a - b, c - b) < 0.0) return abs(c - b);
	return getDistanceLP(a, b, c);
}
double getDistance(P a, P b, P c, P d) {
	if (intersect(a, b, c, d)) return 0.0;
	return min({ getDistanceSP(a, b, c), getDistanceSP(a, b, d), getDistanceSP(c, d, a), getDistanceSP(c, d, b) });
}
int main() {
	int n, m;
	cin >> n >> m;
	vector<int> aa(n+1), bb(m+1);
	cin >> aa[0] >> bb[0];
	REP(i, n) {
		cin >> aa[i + 1];
	}
	REP(i, m) {
		cin >> bb[i + 1];
	}
	sort(aa.begin(), aa.end());
	sort(bb.begin(), bb.end());
	if (aa[n] < bb[0]) {
		cout << "No War" << endl;
	}
	else cout << "War" << endl;
	return 0;
}

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

using namespace std;

int main(){
	int n,ans = 0;
	scanf("%d",&n);
	for(int i = 1; i <= n; i++){
		int tmp = 0;
		for(int j = 1; j <= i; j++){
			if(i % j == 0){
				tmp++;
			}
		}
		if((tmp == 8) && (i % 2)){
			ans++;
		}
	}
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 256
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var Arr=(input.trim()).split("\n").map(Number);
Arr.shift();
var min=Arr[0];
var fx=Arr[1]-Arr[0];
Arr.shift();
Arr.forEach(function(v){
fx=Math.max(fx,v-min);
min=Math.min(min,v);
});
console.log(fx);

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


int main() {
  string S;
  cin>>S;
  vector<string> days={"SUN","MON","TUE","WED","THU","FRI","SAT"};
  
  for(int i=0;i<days.size();i++){
    if(S==days.at(i)){
      cout<<7-i;
    }
  }
  
  
  return 0;
}

Measured memory_bytes: 256
#[warn(dead_code)]
fn read<T: std::str::FromStr>() -> T {
   let mut s = String::new();
   std::io::stdin().read_line(&mut s).ok();
   s.trim().parse().ok().unwrap()
}

#[warn(dead_code)]
fn readn<T: std::str::FromStr>(delimiter: &str) -> Vec<T> {
   let s = read::<String>();
   s.split(delimiter)
      .map(|e| e.parse().ok().unwrap())
      .collect::<Vec<T>>()
}

fn main() {
    let nm = readn::<i32>(" ");
    let n = nm[0];
    let A = readn::<i32>(" ").iter().fold(n, |diff, x| diff - x);
    if A < 0 {
        println!("-1");
    } else {
        println!("{}", A);
    }
}


Measured memory_bytes: 2136
const MOD: i64 = 1000000007;

fn main() {
	let mut s = String::new();
	use std::io::Read;
	std::io::stdin().read_to_string(&mut s).unwrap();
	let mut s = s.split_whitespace();
	let n: i64 = s.next().unwrap().parse().unwrap();
	let k: i64 = s.next().unwrap().parse().unwrap();
	let mut ans = 0;
	for k in k..=n + 1 {
		let x = sum(n - k + 1, n) - sum(0, k - 1) + 1;
		ans = (ans + x) % MOD;
	}
	println!("{}", ans);
}

fn sum(l: i64, r: i64) -> i64 {
	(r - l + 1) * (r + l) / 2
}


Measured memory_bytes: 2144
//#include <tourist>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = 1e9;
const ll LINF = ll(1e18);
const int MOD = 1000000007;
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 ALL(v) v.begin(), v.end()
#define debug(v)          \
    cout << #v << ":";    \
    for (auto x : v)      \
    {                     \
        cout << x << ' '; \
    }                     \
    cout << endl;
template <class T>
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}
//cout<<fixed<<setprecision(15);有効数字15桁
//-std=c++14
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 n, k;
vector<int> a;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n>>k;
    if(n>=k){
        n=(n-k)%k;
    }
    ll ans=min(n,k-n);
    cout << ans << "\n";
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <cmath>
#include <vector>
#include <numeric>

typedef long long ll;
const ll LL_MAX (1LL<<60);

#define rep(i,s,e) for(ll i=(s); i<(e); i++) 

using namespace std;

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

    ll n;
    cin >> n;

    vector<ll> a(n);

    iota(a.begin(), a.end(), 1);

    ll neum(0), denm(n);

    for (auto i: a)
    {
        if (i % 2 != 0)
            neum++;
    }

    cout << neum * (1.0/n) << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
#ifndef STOP_DEBUG
#define debug(...)\
    do { cerr << boolalpha << "[" << #__VA_ARGS__ << "]:";\
    debug_cerr(__VA_ARGS__); cerr << noboolalpha; } while (0)
#else
#define debug(...)
#endif
void debug_cerr(){ cerr << '\n'; }
template<class Head, class... Tail>
void debug_cerr(Head head, Tail... tail){
  cerr << ' ' << head;
  debug_cerr(tail...);
}
void chmax(lint &a, lint b) { if (a < b) a = b; }
void chmin(lint &a, lint b) { if (a > b) a = b; }
struct IoSetup{
    IoSetup(){
      ios::sync_with_stdio(false);
      cin.tie(nullptr);
      cout << fixed << setprecision(20);
    }
} iosetup;

char table[27*2];
int main() {
  for (int i = 0; i < 27; ++i) {
    table[i] = char(i + 65);
  }
  for (int i = 0; i < 27; ++i) {
    table[i + 26] = table[i];
  }
  for (int i = 0; i < sizeof(table); ++i) {
    cerr << table[i];
  }
  cerr << '\n';
  int n; cin >> n;
  string s;
  cin >> s;
  for (int i = 0; i < s.size(); ++i) {
    cout <<  table[s[i] - 'A' + n];
  }
  cout << '\n';
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(v) v.begin(), v.end()
#define sz(x) ((int)(x).size())
#define fill(v, h) memset((v), h, sizeof(v))
using namespace std;
const int MOD = 1000000007;

template <class T>
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}

template <class T>
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}

int main(void)
{
    int k, a, b;
    cin >> k >> a >> b;
    for (int i = a; i <= b; i++)
    {
        if (i % k == 0)
        {
            cout << "OK" << endl;
            return 0;
        }
    }
    cout << "NG" << endl;
    return 0;
}

Measured memory_bytes: 3596
//#pragma GCC optimize(2)
//#pragma GCC optimize(3)
#include<bits/stdc++.h>
#define fo(x,a,b) for(register int x=a;x<=b;x++)
#define dfo(x,a,b) for(register int x=a;x>b;x--)
using namespace std;
int a[1000],x,n,m;
char c;
int main ()
{
	//、、freopen("modeval.in","r",stdin);
	//freopen("modeval.out","w",stdout);
	do
	{
		scanf("%d",&x);
		if (getchar()!='\n') break;
		a[x]++;
		m=max(a[x],m);
	}while (true);
	fo(i,1,100)
	{
		if (a[i]==m)
		{
			printf("%d\n",i);
		}
	}

	return 0;
}




Measured memory_bytes: 3188
#include <iostream>
#include <math.h>
#include <string>
#include <string.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <stdlib.h>
#include <deque>  
#include <iomanip>

using namespace std;

#define ll long long
#define INF 1e9
const ll MOD = 1e9 + 7;
#define rep(i, n) for(int i = 0; i < n; i++)
#define loop(i, a, n) for(int i = a; i < n; i++)
#define all(in) in.begin(), in.end()
int main(){
    int N, K;
    cin >> N >> K;
    vector<int> a(N);
    rep(i, N) cin >> a[i];
    ll ans = 0;
    for (int i = 0; i < N; i++) {
        ll count = 0;
        ll count_low = 0, count_upper = 0;
        for (int j = 0; j < N; j++) {
            if (a[i] > a[j]){
                if (j < i) count_low++;
                else count_upper++;
            }
        }
        ll sum = 0;
        //sum = (count_upper % MOD + count_upper % MOD + (count_upper + count_low) % MOD  * (K - 1) % MOD) % MOD  * K /2  % MOD;
		sum = (count_upper % MOD + count_upper % MOD + (count_upper + count_low) % MOD  * (K - 1) % MOD) % MOD  * K   % MOD;
      	sum = sum  * 500000004 % MOD;
      
        ans += sum;
        ans %= MOD;
    }
    cout << ans % MOD << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define F first
#define S second
#define ll long long
#define ld long double
#define pb push_back
#define sz size

using namespace std;

int ans;

string s;

stack<char>st;

int main()
{
    cin >> s;
    for (int i=0;i<s.length();i++)
    {
        char ch='A';
        if (!st.empty())ch=st.top();
        st.push(s[i]);
        if (ch!='A')
        {
            if ((ch=='0'&&st.top()=='1')||(ch=='1'&&st.top()=='0'))
            {
                ans+=2;
                st.pop();
                st.pop();
            }
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 512
#include <string>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <iostream>
#include <functional>
#include <algorithm>
#include <sstream>
#include <iterator>
#include <cmath>
#include <limits>
#include <tuple>
#include <queue>
#include <stack>

using namespace std;
typedef long long ll;

int main()
{
	int N;
	cin >> N;
	vector<vector<int>> A(N, vector<int>(N));
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < N; j++) {
			cin >> A[i][j];
		}
	}
	ll ans = 0;
	for (int i = 0; i < N - 1; i++) {
		for (int j = i + 1; j < N; j++) {
			int tmp = numeric_limits<int>::max();
			for (int k = 0; k < N; k++) {
				if (k != i && k != j) {
					tmp = min(tmp, A[i][k] + A[k][j]);
				}
			}
			if (tmp < A[i][j]) {
				ans = -1;
				goto exit;
			}
			if (tmp > A[i][j])
				ans += A[i][j];
		}
	}
exit:
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 640
#include "bits/stdc++.h"
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a),i##_len=(b);i<i##_len;++i)
#define MSVC_UNKO(x) x
#define rep(...) MSVC_UNKO(_overload3(__VA_ARGS__,repi,_rep,_rep)(__VA_ARGS__))
#define all(c) c.begin(),c.end()
#define mp make_pair
#define write(x) cout<<(x)<<"\n"
using namespace std; typedef long long ll;
typedef vector<int> vi; typedef vector<ll> vll; template<class T>using vv = vector<vector<T>>;
template<class T>vv<T> vvec(size_t n, size_t m, T v) { return vv<T>(n, vector<T>(m, v)); }
template<class T>bool chmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }
template<class T>bool chmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
constexpr int INF = 1 << 28, MOD = int(1e9) + 7; constexpr ll LINF = 1LL << 60;
struct aaa { aaa() { cin.tie(0); ios::sync_with_stdio(0); }; }aaaa;

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

    vector<bool> broken(N, false);
    rep(i, M) {
        int a;
        cin >> a;
        broken[a] = true;
    }

    vll dp(N + 1, 0);
    dp[0] = 1;
    if (!broken[1]) dp[1] = 1;

    rep(i, 2, N + 1) {
        if (broken[i]) continue;

        dp[i] = (dp[i - 2] + dp[i - 1]) % MOD;
    }
    write(dp[N]);
}

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

#define MAX 100000

vector<int> G[MAX];
int N;
bool visited[MAX];
int prenum[MAX], parent[MAX], lowest[MAX], timer;

void dfs(int current, int prev)
{
  prenum[current] = lowest[current] = timer;
  timer++;

  visited[current] = true;

  int next;

  for (int i = 0; i < G[current].size(); i++)
  {
    next = G[current][i];
    if (!visited[next])
    {
      parent[next] = current;

      dfs(next, current);

      lowest[current] = min(lowest[current], lowest[next]);
    }
    else if (next != prev)
    {
      lowest[current] = min(lowest[current], prenum[next]);
    }
  }
}

void art_points()
{
  for (int i = 0; i < N; i++)
  {
    visited[i] = false;
  }
  timer = 1;
  dfs(0, -1);

  set<int> ap;
  int np = 0;
  for (int i = 1; i < N; i++)
  {
    int p = parent[i];
    if (p == 0)
    {
      np++;
    }
    else if (prenum[p] <= lowest[i])
    {
      ap.insert(p);
    }
  }
  if (np > 1)
  {
    ap.insert(0);
  }

  for (set<int>::iterator it = ap.begin(); it != ap.end(); it++)
  {
    cout << *it << endl;
  }
}

int main()
{
  int E;
  cin >> N >> E;

  for (int i = 0; i < E; i++)
  {
    int s, t;
    cin >> s >> t;
    G[s].push_back(t);
    G[t].push_back(s);
  }

  art_points();

  return 0;
}


Measured memory_bytes: 6928
#include <bits/stdc++.h>
#define rep(i, N) for (int i = 0; i < (N); i++)
#define swap(a, b) (a += b, b = a - b, a -= b)
using namespace std;
int main(void)
{
    string S;
    cin >> S;
    if (S == "Sunny")
    {
        cout << "Cloudy" << endl;
    }
    else if (S == "Cloudy")
    {
        cout << "Rainy" << endl;
    }
    else if (S == "Rainy")
    {
        cout << "Sunny" << endl;
    }
}


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

unsigned GetDigit(unsigned num){
    return log10(num)+1;
}

int main(void){
    int n;
    cin >> n;
    int ans = 0;
    for (int i = 1; i <n+1; ++i){
        if (GetDigit(i)%2 == 1){
            ans += 1;
        }
    }
    cout <<  ans <<endl;
    
};

Measured memory_bytes: 512
#include<bits/stdc++.h>
#include<iomanip>
using namespace std;
#define int long long
#define rep(i,n) for(int i=1;i<=n;i++)
const int inf = 1000000007;
bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}
int a[100010], b[100010],cnt[100000];
signed main() {
	int n;
	cin >> n;
	rep(i, n) {
		cin >> a[i] >> b[i];
	}
	int sum = 0;
	for (int i = 1; i <= 99999; i += 2) {
		if (prime(i) == true && prime((i + 1) / 2) == true)sum++;
		cnt[i / 2] = sum;
	}
	rep(i, n) {
		cout << cnt[b[i]/2]-cnt[(a[i]-2)/2]<< endl;
	}
}

Measured memory_bytes: 2560
#input of int(split by space)
def get_i()
  return gets.chomp.split(" ").map(&:to_i)
end
#input of float(split by space)
def get_f()
  return gets.chomp.split(" ").map(&:to_f)
end
#input of string(split by space)
def get()
  return gets.chomp.split(" ")
end
#input of string(split per one character)
def get_nsp()
  return gets.chomp.split("")
end
#yes or no decision
def yn_judge(bool,y="Yes",n="No")
  return bool ? y : n 
end
#create of array
def array(size1,init=nil,size2=-1)
  if size2==-1
    return Array.new(size1){init}
  else
    return Array.new(size2){Array.new(size1){init}}
  end
end

def max(a,b)
    return a>b ? a : b
end

def min(a,b)
    return a>b ? b : a
end

INF=Float::INFINITY

N,M,X=get_i
ca=array(N)
N.times do|i|
    ca[i]=get_i
end
ans=INF
(2**N).times do|bit|
    algo=array(M,0)
    val=0
    N.times do|i|
        unless (bit&(2**i)).zero?
          M.times do|j|
            algo[j]+=ca[i][j+1] 
          end
          val+=ca[i][0]
        end
    end
    flag=true
    algo.each do|a|
      if a<X
          flag=false
          break
      end
    end
    if flag
        ans=min(ans,val)
    end
end
if ans==INF
    puts -1
else
    puts ans
end

Measured memory_bytes: 14588
S = input()
T = input()


if S == T :
    ans = "Yes"
else:
    list_S =list(S) 
    list_T =list(T) 
    L = list_S
    L  =  tuple(L)
    ans = "No"
    #i:移動距離
    for i in range(1,len(S)+1):
        #移動
        for j in range(len(S)):
            list_S[j] = L[-i+j]
        if list_S == list_T :
            ans = "Yes"
            break
print(ans)   

Measured memory_bytes: 3064
n, k = map(int, input().split())
ans = n
dic = {}

for i in range(k):
    d = int(input())
    a = list(map(int, input().split()))
    for j in range(d):
        if a[j] not in dic.keys():
            dic[a[j]] = True
            ans -= 1
print(ans)

Measured memory_bytes: 9188
/******************
*  Writer: Oh no  *
******************/
#include<algorithm>
#include<cstdio>
#include<iostream>
#include<cstring>
#include<cmath>
#include<map>
#include<queue>
#include<set>
#include<sstream>
#include<stack>
#include<string>
#include<vector>
using namespace std;
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int a,b;
	cin>>a>>b;
	a--;b--;
	cout<<a*b;
	return 0;
}


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

int main()
{
  int n, m;
  cin >> n >> m;
  vector<int> x(m);
  int i;
  for(i = 0; i < m; i++)
  {
    cin >> x.at(i);
  }
  sort(x.begin(), x.end());
  vector<int> xx(m-1);
  for(i = 0; i < m-1; i++)
  {
    xx.at(i) = x.at(i+1) - x.at(i);
  }
  sort(xx.begin(), xx.end());
  long long sum = 0;
  for(i = 0; i < m - n; i++)
  {
    sum += xx.at(i);
  }
  cout << sum << endl;
}

Measured memory_bytes: 1024