akhauriyash/Code-Regression huggingface dataset:
#1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51
k = gets.to_i               # 単一整数
#数列定義
s = "1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51".chomp
wk =  s.gsub(" ", "").split(/,/, 0)       # => ["a", "b", "c"]
puts wk[k-1]

Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR (i, 0, n)
#define ALL(v) (v).begin(), (v).end()
#define fi first
#define se second
template <typename A, typename B> inline bool chmax(A &a, B b) {if (a < b) {a = b; return 1;} return 0;}
template <typename A, typename B> inline bool chmin(A &a, B b) {if (a > b) {a = b; return 1;} return 0;}
typedef long long ll;
typedef pair<int, int> pii;
const ll INF = 1e9+100;
const bool debug = 0;
/****************************/


int main(){
	int n, l, r;
	int a[50];
	while (cin >> n >> l >> r, n || l || r) {
		REP(i, n) scanf("%d", a + i);
		
		int ans = 0;
		
		FOR(x, l, r + 1) {
			int pos = -1;
			REP(i, n) {
				if (x % a[i] == 0) {
					pos = i;
					break;
				}
			}
			
			if (pos != -1) {
				pos++;
				if (pos & 1) ans++;
			}
			else {
				if (!(n & 1)) ans++;
			}
		}
		
		if (debug) printf("@ ");
		cout << ans << endl;
	}
	return 0;
}

// C


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

using namespace std;

const int INF = 2e9, N = 1e5 + 15;

int n, k, h[ N ], dp[ N ];

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

    cin >> n >> k;
    for(int i = 1; i <= n; i += 1) {
        cin >> h[ i ];
    }
    dp[ 0 ] = dp[ 1 ] = 0;
    for(int i = 2; i <= n; i += 1) {
        dp[ i ] = INF;
        for(int j = 1; j <= k; j += 1) {
            int x = INF;
            if( i - j > 0 )
                x = dp[ i - j ] + abs(h[ i ] - h[ i - j ]);
            else break;
            dp[ i ] = min(dp[ i ], x);
        }
    }
    cout << dp[ n ] << '\n';
    return 0;
}


Measured memory_bytes: 1024
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
inline ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
inline ll lcm(ll a, ll b) { return a / gcd(a, b)*b; }
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T>& V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> >& Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T>& mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }
template<typename T>vector<T> make_v(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>auto make_v(size_t a,Ts... ts){return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));}
template<typename T,typename V> typename enable_if<is_class<T>::value==0>::type fill_v(T &t,const V &v){t=v;}
template<typename T,typename V> typename enable_if<is_class<T>::value!=0>::type fill_v(T &t,const V &v){for(auto &e:t) fill_v(e,v);}
/*
 <url:>
 問題文============================================================
 =================================================================
 解説=============================================================
 ================================================================
 */

template<class Type>
Type solve(Type res = Type()){
    ll N,K;
    string S;
    cin >> N >> K >> S;
    
    vector<ll> num;
    vector<char> state;
    char pre = '*';
    
    for(int i = 0; i < N;i++){
        if(pre != S[i]){
            num.push_back(1);
            state.push_back(S[i]);
            pre = S[i];
        }else{
            num.back()++;
        }
    }
//    cout << num << endl;
//    cout << state << endl;
    
    // [l,r)
    int l = 0,r = 0;
    ll nK = 0;
    ll sum = 0;
    int n = (int)num.size();
    while(true){
        while(r < n && nK <= K){
            if(state[r] == '0' && nK == K){
                break;
            }
            sum += num[r];
            nK += state[r] == '0';
            res = max(res,sum);
            r++;
        }
        if(r == n) break;
        
        sum -= num[l];
        nK -= state[l] == '0';
        l++;
    }
    return res;
}
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    // solve(0);
    cout << fixed << setprecision(15) << solve<ll>() << endl;
    return 0;
}


Measured memory_bytes: 1528
import numpy as p
n,M=map(int,input().split())
l=n*3+1
r=p.roll
d=p.zeros((l,n*5),p.int64)
d[0][0]=d[1][1]=d[2][2]=d[2][-1]=1
for i in range(3,l):j,k=i-1,i-2;d[i]=(d[i-3]*k*j+r(d[k],-1)*j+r(d[j],1))%M
print(d[-1][:l].sum()%M)


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

int n, mx = 0, mn = 2000;

int main()
{
	cin >> n;

	for (int i = 0; i < n; i++) {
		int x;
		cin >> x;

		if (x > mx)
			mx = x;

		if (x < mn)
			mn = x;
	}

	cout << (mx - mn + 1) / 2 << endl;	

	return 0;
}


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

using ll = long long;
static const ll MOD = 1e9 + 7;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int n, k;
  cin >> n >> k;
  
  vector<int> a(n);
  for (int i = 0; i < n; i++) cin >> a.at(i);
  
  vector<vector<ll>> dp(n + 1, vector<ll>(k + 1));
  for (int j = 0; j <= k; j++) dp.at(0).at(j) = 1;
  
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j <= k; j++) {
      if (j <= a.at(i - 1)) dp.at(i).at(j) = dp.at(i - 1).at(j);
      else dp.at(i).at(j) = MOD + dp.at(i - 1).at(j) - dp.at(i - 1).at(j - a.at(i - 1) - 1);
    }
    for (int j = 1; j <= k; j++) {
      if (i < n) dp.at(i).at(j) += dp.at(i).at(j - 1);
      dp.at(i).at(j) %= MOD;
    }
  }
  
  cout << dp.at(n).at(k) << '\n';
}

Measured memory_bytes: 80256
N,M = [int(x) for x in input().split()]
AB =[[int(x) for x in input().split()]for _ in range(M)]
cnt = 0
for j in range(M):
  E = {i:[] for i in range(N)}
  for i in range(M):
    if j==i:
      continue
    a,b= AB[i]
    E[a-1].append(b-1)
    E[b-1].append(a-1)
  visited=[0]*N
  stk=[(0,-1)]
  while stk:
    v,p=stk.pop()
    if visited[v]==1:
      continue
    visited[v]=1
    for i in E[v]:
      if i!=p:
      	stk.append((i,v))
  if 0 in visited:
    cnt+=1
print(cnt)

Measured memory_bytes: 40944
#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = a; i < (b); i++)
#define rrep(i, a, b) for (int i = a; i >= b; i--)
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
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;
}

const int INF = 1 << 20;
const int MOD = 1e9 + 7;

int n;
int dfs(ll x, bool is3, bool is5, bool is7) {
   if (x > n) return 0;
   int ans = 0;
   if (is3 & is5 & is7) ans++;
   ans += dfs(10 * x + 3, true, is5, is7);
   ans += dfs(10 * x + 5, is3, true, is7);
   ans += dfs(10 * x + 7, is3, is5, true);
   return ans;
}
int main() {
   cin >> n;
   int ans = dfs(0, 0, 0, 0);
   cout << ans << endl;
   return 0;
}

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

int main(){
    string S;
    cin >> S;
    for(int i=0;i<S.size();++i) cin >> S[i];
    sort(S.begin(),S.end());
    char moji = 0;
    for(char i='a';i<='z';++i) {
        bool match = false;
        for(int j=0;j<S.size();++j) {
            if(i==S[j]) match =true; 
        }
        if(match==false) {
            moji = i;
            break;
        }
    }
    if (moji==0) {
        cout << "None" << endl;
    } else {
        cout << moji << endl;
    }
}

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

using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;

#define fi first
#define se second

const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll MOD3 = 1812447359;
const ll INF = 1ll << 62;
const double PI = 2 * asin(1);

void yes() {printf("yes\n");}
void no() {printf("no\n");}
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

int N, W;
ll w[105], v[105], DP[105][int(1e5+5)];

int main(){
  cin >> N >> W;
  for (int i = 1; i <= N; i++) cin >> w[i] >> v[i];

  fill((ll*)DP, (ll*)(DP+N+1), 1e18);
  DP[0][0] = 0;

  for (int i = 1; i <= N; i++){
    for (int j = 0; j <= 1e5; j++){
      DP[i][j] = DP[i-1][j];
    }
    for (int j = v[i]; j <= 1e5; j++){
      DP[i][j] = min(DP[i][j], DP[i-1][j-v[i]] + w[i]);
    }
    for (int j = 1e5; j >= 0; j--){
      DP[i][j] = min(DP[i][j], DP[i][j+1]);
    }
  }

  for (int j = 1e5; j >= 0; j--){
    if (DP[N][j] <= W){
      cout << j << endl;
      return 0;
    }
  }

  return 0;
}


Measured memory_bytes: 82540
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())
#define ll long long
#define pb(a) push_back(a)
#define INF 1000000000
#define MOD 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

typedef vector<unsigned int>vec;
typedef vector<vec> mat;
//typedef tuple<ll, ll, ll> T;

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; }

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

int N,C,X;
int D[30][39];
int t[3][30];

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin>>n;
    vector<int>H(n);
    REP(i,n) cin>>H[i];
    int ans=1;
    int ma=H[0];
    for(int i=1;i<n;i++){
        if(H[i-1]<=H[i]&&ma<=H[i]) ans++,ma=H[i];
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
//#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <stdio.h>
#include <complex>
#include <iomanip>
#include <queue>
#include <bitset>
//定数
#define MOD 1000000007
//マクロ
#define rep(i,n)    for(int (i)=0;(i)<(n);(i)++)
#define reprev(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))

#define vsort(v) sort((v).begin(), (v).end());

typedef unsigned long long int ull;
typedef long long lint;

using namespace std;




int main(){
    int N;
    string S, T, ans;

    //入力
    cin >> N >> S >> T;
    rep(i, N) ans = ans + S[i] + T[i];

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

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<cmath>
#include<utility>
#include<cstdio>
#include<set>
#include<string>
#include<map>
#include<queue>
#include<stack>
#include <bitset>
using namespace std;
const int mod=1e9+7;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<n;i++)
#define rep2(i,x,n) for(int i= x;i<n;i++)
#define all(v) v.begin(), v.end()
#define nepe(v) next_permutation(all(v))
#define F first 
#define S second
#define PB push_back 
#define MP make_pair
using ll = long long;
using vi = vector<int>; 
using vvi = vector<vi>;
using vl=vector<long long>;
using vp =vector<pair<int,int>>;

typedef pair<int,int> P;
string s;
int k; 
ll INF = 10000000000000000;



int main(){
    int N,W;
    cin >>N>>W;
    vvi w(N+1,vi(2));
    rep(i,N) cin >>w[i+1][0]>>w[i+1][1];
    vector<vl> dp(N+1,vl(W+1,0));
    rep1(i,N+1){
        rep(j,W+1){
            if(j>=w[i][0]) dp[i][j]=max(dp[i-1][j-w[i][0]]+w[i][1],dp[i-1][j]);
            else dp[i][j] = dp[i-1][j];
        }
    }
    cout <<dp[N][W]<<endl;
}


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

int main() {
  string N, M; 
  int k, a1, a2, b1, b2, c1, c2, d1, d2, e1, e2;
  cin >> N;
  cin >> M;
  a1 = 0;
  for ( int64_t i = 0; i < N.size(); i ++){
    if ( N.at(i) == M.at(i) ){
      a1++;
    }
  }
  cout << N.size() - a1 << endl; 
 
}

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

int main() {
    ll l, r;
    cin >> l >> r;
    r = min(r, l + 4038);
    int ans = 2018;
    for(ll i = l; i <= r; i++) {
        for(ll j = i + 1; j <= r; j++) {
            int x = i * j % 2019;
            ans = min(ans, x);
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 384
main :: IO ()
main = do
  x <- read <$> getLine :: IO Double
  let ms = zip (moneyPowers firstMoney) ([0..])
  print . snd $ head $ filter ((>= x) . fst) $ ms
  where
    firstMoney :: Num a => a
    firstMoney = 100

moneyPowers :: Double -> [Double]
moneyPowers x = iterate moneyPower x

moneyPower :: Double -> Double
moneyPower x = fromIntegral . floor $ x * interest
  where
    interest = 1.01


Measured memory_bytes: 4296
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
using namespace std;
int n,k,a[100010],dep[100010],maxn[100100],ans;
struct node{int y,nxt;
}g[100010];int h[100010];
void dfs(int x)
{
    for (int i=h[x];i;i=g[i].nxt)
    if (g[i].y!=x)
    {
        dep[g[i].y]=dep[x]+1;
        dfs(g[i].y);
        maxn[x]=max(maxn[x],maxn[g[i].y]);
    }
    maxn[x]=max(maxn[x],dep[x]);
    if (x==1) return;
    if (maxn[x]-dep[x]>=k-1&&a[x]!=1||(maxn[x]-dep[x]>=k)) maxn[x]=0,ans++;
}
int main()
{
    scanf("%d%d",&n,&k);
    scanf("%d",&a[1]);
    for (int i=2;i<=n;i++) 
    {
        scanf("%d",&a[i]);    
        g[i]=node{i,h[a[i]]};h[a[i]]=i;    
    }
    ans=0;
    dfs(1);
    if (a[1]!=1) ans++;
    printf("%d",ans);
}

Measured memory_bytes: 5760
#include <iostream>

using namespace std;
typedef long long ll;
static const ll Z = 1 << 21;
static const ll INF = 1 << 29;
#define rep(i,s,n)for(ll i = s;i<n;i++)
#define repeq(i,s,n)for(ll i = s;i<=n;i++)
char s[Z];

int N, M;
ll num = 0, res = 0;
int a, b;
ll m[1000][1000];
ll p[1000][1000];
bool v[1000];

void wh() {
	rep(k, 0, N) {
		rep(i, 0, N) {
			rep(j, 0, N) {
				if (m[i][j] > m[i][k] + m[k][j]) {
					m[i][j] = m[i][k] + m[k][j];
				}
			}
		}
	}
}
int main() {
	int H, W; cin >> H >> W;
	N = 10;

	rep(i, 0, N) {
		rep(j, 0, N) {
			cin >> m[i][j];
		}
	}
	int A[200][200];
	rep(i, 0, H) {
		rep(j, 0, W) {
			cin >> A[i][j];
		}
	}
	wh();

	ll sum = 0;
	rep(i, 0, H) {
		rep(j, 0, W) {
			if (A[i][j] != -1 && A[i][j] != 1) {
				sum += m[A[i][j]][1];
			}
		}
	}
	cout << sum << endl;
	return 0;
}

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

int main()
{
  int n;
  cin >> n;
  vector<int> b(n - 1);
  for (int i = 0; i < n - 1; i++)
  {
    cin >> b[i];
  }
  vector<int> a(n);
  a[n - 1] = b[n - 2];
  a[0] = b[0];
  for (int i = 1; i < n - 1; i++)
  {
    a[i] = min(b[i], b[i - 1]);
  }

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


Measured memory_bytes: 3656
#D問題
#UnionFind(normal)
class UnionFind():
    # 作りたい要素数nで初期化
    # 使用するインスタンス変数の初期化
    def __init__(self, n):
        self.n = n
        # root[x]<0ならそのノードが根かつその値が木の要素数
        # rootノードでその木の要素数を記録する
        self.root = [-1]*(n+1)
        # 木をくっつける時にアンバランスにならないように調整する
        self.rnk = [0]*(n+1)

    # ノードxのrootノードを見つける
    def Find_Root(self, x):
        if(self.root[x] < 0):
            return x
        else:
            # ここで代入しておくことで、後の繰り返しを避ける
            self.root[x] = self.Find_Root(self.root[x])
            return self.root[x]
    # 木の併合、入力は併合したい各ノード
    def Unite(self, x, y):
        # 入力ノードのrootノードを見つける
        x = self.Find_Root(x)
        y = self.Find_Root(y)
        # すでに同じ木に属していた場合
        if(x == y):
            return 
        # 違う木に属していた場合rnkを見てくっつける方を決める
        elif(self.rnk[x] > self.rnk[y]):
            self.root[x] += self.root[y]
            self.root[y] = x

        else:
            self.root[y] += self.root[x]
            self.root[x] = y
            # rnkが同じ（深さに差がない場合）は1増やす
            if(self.rnk[x] == self.rnk[y]):
                self.rnk[y] += 1
    # xとyが同じグループに属するか判断
    def isSameGroup(self, x, y):
        return self.Find_Root(x) == self.Find_Root(y)

    # ノードxが属する木のサイズを返す
    def Count(self, x):
        return -self.root[self.Find_Root(x)]
        
"""
Class呼び出しの際には,UnionFind(Number)とする.関数の引数にはUnite(x,y)やisSameGroup(x,y)とする.
"""
    
    
N,M=map(int,input().split())
ABre=[list(map(int,input().split())) for i in range(M)]
AB=ABre[::-1]
cl=UnionFind(N)
maxn=int(N*(N-1)/2)
ans=[maxn]
for i in range(M-1):
    a=AB[i][0]
    b=AB[i][1]
    if cl.isSameGroup(a,b):
        ans.append(maxn)
    else:
        asize=cl.Count(a)
        bsize=cl.Count(b)
        maxn-=asize*bsize
        ans.append(maxn)
    cl.Unite(AB[i][0],AB[i][1])
for i in range(M):
    print(ans[-1-i])

Measured memory_bytes: 34980
package main

import "fmt"

func main() {
    var n, m, ans int
    var t [102]int

    fmt.Scan(&n)

    for i := 0; i < n; i++ {
        fmt.Scan(&t[i])
        ans += t[i]
    }

    fmt.Scan(&m)

    for i := 0; i < m; i++ {
        var p, x int
        fmt.Scan(&p, &x)
        fmt.Println(ans+x-t[p-1])
    }
}

Measured memory_bytes: 512
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		final int n = sc.nextInt();
		final int a = sc.nextInt();
		final int b = sc.nextInt();

		int result = 0;
		for (int i = 1; i <= n; i++) {
			final String iList[] = (String.valueOf(i)).split("");
			int iTotal = 0;
			for (final String item : iList) {
				iTotal = iTotal + Integer.parseInt(item);
			}

			if (a <= iTotal && iTotal <= b) {
				result = result + i;
			}
		}

		System.out.print(result);

	}

}


Measured memory_bytes: 31700
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;
//using System.Diagnostics;
//using System.Linq;

class inputFile
{
	//変数
	bool b_testMode;
	List<string> list_s_line;
	int i_index;

	//コンストラクタ
	public inputFile()
	{
		//変数初期化
		b_testMode = false;
		list_s_line = new List<string>();
		i_index = 0;

		//ファイル読み込み
		read_file();
	}

	//ファイル読み込み
	void read_file()
	{
		//テストモードの場合のみ
		if (b_testMode == true)
		{
			// StreamReader の新しいインスタンスを生成する
			System.IO.StreamReader cReader =
				new System.IO.StreamReader
				(@"D:\Data\VisualStudio-workspace\paiza\inputFile.txt", Encoding.Default);

			// 読み込みできる文字がなくなるまで繰り返す
			while (cReader.Peek() >= 0)
			{
				// ファイルを 1 行ずつ読み込む
				string s_temp = cReader.ReadLine();
				// 読み込んだものを追加で格納する
				list_s_line.Add(s_temp);
			}

			// cReader を閉じる (正しくは オブジェクトの破棄を保証する を参照)
			cReader.Close();
		}
	}

	//1行ずつ取得
	public string get()
	{
		//テストモードの場合
		if (b_testMode == true)
		{
			if (i_index >= list_s_line.Count)
			{
				return "";
			}

			return list_s_line[i_index++];
		}
		//本番モードの場合
		else
		{
			string s_temp = Console.ReadLine();
			if(s_temp == null || s_temp == "")
			{
				return "";
			}
			else
			{
				return s_temp;
			}
		}
	}
}

static class DeepCopyUtils
{
	public static object DeepCopy(this object target)
	{

		object result;
		BinaryFormatter b = new BinaryFormatter();

		MemoryStream mem = new MemoryStream();

		try
		{
			b.Serialize(mem, target);
			mem.Position = 0;
			result = b.Deserialize(mem);
		}
		finally
		{
			mem.Close();
		}

		return result;

	}
}

class Program
{
	//クラス変数
	static inputFile input;
	static Param PRM;

	//Main
	static void Main(string[] args)
	{
		//ファイル読み込み
		input = new inputFile();

		//データ作成
		PRM = new Param();

		//実行
		PRM.exec();
	}

	//データ作成
	[Serializable]
	class Param
	{
		//==================================================
		int cl_i_num;
		//==================================================
		public Param()
		{
			//string[] a_s = input.get().Split(' ');
			//string s_result = string.Join(" ", cl_list_i_num);
			//==================================================
			//入力
			//入力は以下の形式で標準入力から与えられる。
			cl_i_num = int.Parse(input.get());
			//==================================================
		}
		public void exec()
		{
			//==================================================
			/*問題文
			競プロ幼稚園にはN人の子供がいます。
			えび先生は、子供たちを一列に並べ、一人目にはキャンディーを1個,二人目には2個,...,
			N人目にはN個あげることにしました。必要なキャンディーの個数の合計は何個でしょう ?*/
			int i_result = 0;
			for (int aaa=1; aaa<=cl_i_num; aaa++)
			{
				i_result += aaa;
			}

			//出力
			//必要なキャンディーの個数の合計を出力せよ。
			Console.WriteLine(i_result);
			//==================================================
		}
		//==================================================

		//==================================================
	}
}


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

a = list(map(int,input().split()))
b = [i for i in range(1,n+1)]

z = zip(a,b)
sorted_z = sorted(z)

new_a = []
new_b = []

for a_dash,b_dash in sorted_z:
	new_a.append(a_dash)
	new_b.append(b_dash)

print(new_b[0],end="")
for i in range(1,n):
	print(" ",end="")
	print(new_b[i],end="")


Measured memory_bytes: 69612
use std::io::Read;

fn run() {
    let mut s = String::new();
    std::io::stdin().read_to_string(&mut s).unwrap();
    let mut it = s.trim().split_whitespace();
    let n: usize = it.next().unwrap().parse().unwrap();
    let m: usize = it.next().unwrap().parse().unwrap();
    let mut g = vec![vec![]; n];
    let mut ig = vec![vec![]; n];
    for _ in 0..m {
        let a = it.next().unwrap().parse::<usize>().unwrap() - 1;
        let b = it.next().unwrap().parse::<usize>().unwrap() - 1;
        g[a].push(b);
        ig[b].push(a);
    }
    let mut ans = vec![0; 10000];
    for s in 0..n {
        for &t in &g[s] {
            let inf = 10000;
            let mut d = vec![inf; n];
            d[t] = 0;
            let mut q = std::collections::VecDeque::new();
            q.push_back(t);
            while let Some(v) = q.pop_front() {
                for &u in &g[v] {
                    if d[u] > d[v] + 1 {
                        d[u] = d[v] + 1;
                        q.push_back(u);
                    }
                }
            }
            if d[s] == inf {
                continue;
            }
            if ans.len() > d[s] {
                ans.clear();
                let mut now = s;
                while now != t {
                    ans.push(now);
                    for &u in &ig[now] {
                        if d[u] + 1 == d[now] {
                            now = u;
                            break;
                        }
                    }
                }
                ans.push(t);
            }
        }
    }
    if ans.len() <= n {
        println!("{}", ans.len());
        for v in ans {
            println!("{}", v + 1);
        }
    } else {
        println!("-1");
    }
}

fn main() {
    run();
}


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

int main()
{
	int n;
	string s;
	cin >> n >> s;
	
	int cnt = 0;
	char* h = new char[n + 1];
	::strcpy(h, s.c_str());
	char* p = h;
	do
	{
		p = ::strstr(p, "ABC");
		if(p != nullptr)
		{
			cnt++;
			p += 3;
		}
	}while(p);
	delete [] p;
	cout << cnt << endl;
	
	return 0;
}

Measured memory_bytes: 384
using System;
using System.Linq;

public class Sample21{
    public static void Main(){
        
        int n = int.Parse(Console.ReadLine().Trim());
        string[] str_numbers = Console.ReadLine().Trim().Split(' ');
        
        //数列の長さに対するバリデーション
        if( n > 100 ){
            Console.WriteLine("入力された列の長さは範囲外です。");
            Environment.Exit(0);
        }
            
        int[] numbers = new int[n];
            
        //数列の要素の範囲に対するバリデーション
        for(int i = 0 ; i < n ;i++ ){
                
            numbers[i] = int.Parse(str_numbers[i]);
                
            if( numbers[i] < 0 || 1000 <= numbers[i]){
                Console.WriteLine("入力された列の長さは範囲外です。");
                Environment.Exit(0);
            }
        }
            
        Array.Reverse(numbers);
            
        for(int i = 0 ; i < n ; i++){
            if(i == 0 ){
                Console.Write(numbers[i]);
            }else{
                Console.Write(" {0}",numbers[i]);
            }
        }
    
        Console.WriteLine();
    }
    
}


Measured memory_bytes: 17984
#include<iostream>
#include<algorithm>
#include<math.h>
#include<queue>
#include<vector>
#include<climits>
#include<map>
#include<string>
#include<functional>
#include<iomanip>

using namespace std;
typedef long long ll;

ll n, u, k, v, c;

const int INF = 7 + (1e+9);
typedef int Weight;
struct Edge {  //src:辺の始点,dst:辺の終点,weight:辺の重さ
	int src, dst;
	Weight weight;
	Edge(int src, int dst, Weight weight) :
		src(src), dst(dst), weight(weight) { }
};
bool operator < (const Edge &e, const Edge &f) {
	return e.weight != f.weight ? e.weight > f.weight : //辺は重さが重いものを"小さい"と定義する
	e.src != f.src ? e.src < f.src : e.dst < f.dst;
}
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

//引数 g:隣接リスト,s:始点,dist:各頂点までの距離が入る,prev:最短路木の親頂点が入る
//戻値 なし
void shortestPath(const Graph &g, int s, vector<Weight> &dist, vector<int> &prev) {
	int n = g.size();
	dist.assign(n, INF); dist[s] = 0;
	prev.assign(n, -1);
	priority_queue<Edge> Q;
	Q.push(Edge(-2, s, 0));
	while (!Q.empty()) {
		Edge e = Q.top(); Q.pop();
		if (prev[e.dst] != -1) continue;
		prev[e.dst] = e.src;
		for (auto f = g[e.dst].begin(); f != g[e.dst].end(); f++) {
			if (dist[f->dst] > e.weight + f->weight) {
				dist[f->dst] = e.weight + f->weight;
				Q.push(Edge(f->src, f->dst, e.weight + f->weight));
			}
		}
	}
}

int main() {
	cin >> n;
	Graph g(n);
	for (int i = 0; i < n; i++) {
		cin >> u >> k;
		for (int j = 0; j < k; j++) {
			cin >> v >> c;
			g[u].push_back(Edge(u, v, c));
		}
	}
	vector<Weight> dist;
	vector<int> prev;
	shortestPath(g, 0, dist, prev);
	for (int i = 0; i < n; i++) {
		cout << i << " " << dist[i] << endl;
	}
}


Measured memory_bytes: 3088
/*
 * AIZU ALDS1_1_C - Prime Numbers
 *
 * Time:
 * Memory:
 *
 * Author: DragonLee
 */

#include <cstdio>

using namespace std;

bool prime(int n) {
    for (int i = 2; i * i <= n; i++) {
        if (n % i == 0) {
            return false;
        }
    }
    return true;
}

int main() {
    int n, m, cnt = 0;
    scanf("%d", &n);
    while (n--) {
        scanf("%d", &m);
        if (m == 2) {
            cnt += 1;
        } else {
            if (prime(m)) {
                cnt += 1;
            }
        }
    }
    printf("%d\n", cnt);
    return 0;
}


Measured memory_bytes: 2708
// https://atcoder.jp/contests/abc131/tasks/abc131_d

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

#define REP(i,n)   for(int i=0; i<(int)(n); i++)
#define FOR(i,b,e) for(int i=(b); i<=(int)(e); i++)
#define DUMP(a, n) REP(_i, n) printf("%d%c", a[_i], _i + 1 == n ? '\n' : ' ')
#define DUMP2D(a, n, m) REP(_i, n) REP(_j, m) printf("%d%c", a[_i][_j], _j + 1 == m ? '\n' : ' '); puts("")

const int N_MAX = 2*1e5;
const int A_I_MAX = 1e9;
const int B_I_MAX = 1e9;

int N;
pair<ll, ll> AB[N_MAX];

void solve() {
  sort(AB, AB + N);
  ll t = 0;
  REP(i, N) {
    t += AB[i].second;
    if (t > AB[i].first) {
      puts("No");
      return;
    }
  }
  puts("Yes");
}

void input() {
  scanf("%d", &N);
  REP(i, N) {
    int A, B;
    scanf("%d%d", &A, &B);
    AB[i] = { B, A };
  }
}

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


Measured memory_bytes: 3328
#include <iostream>

using namespace std;
typedef long long ll;

const ll MAXN = 1e5+10;

ll n, k;
ll arr[MAXN];

ll gcd(ll x, ll y) {
  if (x < y) {
    swap(x, y);
  }
  if (y == 0) {
    return x;
  }
  return gcd(y, x % y);
}

void solve() {
  ll d = arr[0];
  for (int i=0;i<n;i++) {
    d = gcd(d, arr[i]);
  }
  for (int i=0;i<n;i++) {
    if (k <= arr[i] && (k - arr[i]) % d == 0) {
      cout<<"POSSIBLE";
      return;
    }
  }
  cout<<"IMPOSSIBLE";
}

int main() {
  cin >> n >> k;
  for (int i=0;i<n;i++) {
    cin >> arr[i];
  }
  solve();
  return 0;
  
}


Measured memory_bytes: 4348
#include <stdio.h>

int max2(int a, int b);

int main(void)
{
	int area[100][100] = {0};
	int x, y, size;
	int a, b, c;
	int white, max;
	
	for (a = 0; a <= 9; a++) {
		for (b = 0; b <= 9; b++) {
			area[a][b] = 0;
		}
	}
	
	while (scanf("%d,%d,%d", &x, &y, &size) != EOF){
		if (size == 1) {
			for (a = -1; a < 2; a++) {
				for (b = -1; b < 2; b++) {
					if (b == 0 || a == 0) {
						area[y + a][x + b]++;
					}
				}
			}
		}
		else if (size == 2) {
			for (a = -1; a < 2; a++) {
				for (b = -1; b < 2; b++) {
					area[y + a][x + b]++;
				}
			}
		}
		else {
			for (a = -1; a < 2; a++) {
				for (b = -1; b < 2; b++) {
					area[y + a][x + b]++;
				}
			}
			area[y - 2][x]++;
			area[y][x - 2]++;
			area[y + 2][x]++;
			area[y][x + 2]++;
		}
	}
	white = 0;
	max = area[0][0];
	for (a = 0; a <= 9; a++) {
		for (b = 0; b <= 9; b++) {
			if (area[a][b] == 0) {
				white++;
			}
			max = max2(max, area[a][b]);
		}
	}
	
	printf("%d\n%d\n", white, max);
	
	return (0);
}
int max2(int a, int b)
{
	if (a > b) {
		return (a);
	}
	else {
		return (b);
	}
}	

Measured memory_bytes: 644
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<iostream>
#include<cmath>
#include<vector>
using namespace std;
bool prime(int cur)
{
    if(cur==1||cur==0)return false;
    for(int i=2;i<=sqrt(cur);i++)
    {
        if(cur%i==0)
        {
            return false;
        }
    }
    return true;
}
int cnt[1000005];
int main()
{
    for(int i=1;i<=1000005;i++)
    {
        if(prime(i))cnt[i]=cnt[i-1]+1;
        else cnt[i]=cnt[i-1];
    }
    int n;
    while(scanf("%d",&n)!=EOF)
    {
        cout<<cnt[n]<<endl;
    }
    return 0;
}


Measured memory_bytes: 7020
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<deque>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<string>
#define MOD 1000000007
typedef long long ll;
using namespace std;

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    int n; cin >> n;
    ll A[100100];
    for(int i=0;i<n;i++) cin >> A[i];
    bool flag = true;
    ll lim = 1000000000000000000;
    ll ans = 1;
    for(int i=0;i<n;i++){
        if(A[i] == 0){
            cout << 0 << endl;
            return 0;
        }
    }
    for(int i=0;i<n;i++){
        if(A[i] <= lim){
            lim /= A[i];
            ans *= A[i];
        }else{
            flag = false;
            break;
        }
    }
    if(flag){
        cout << ans << endl;
    }else{
        cout << -1 << endl;
    }
    return 0;
}

Measured memory_bytes: 4420
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder.Abc
{
    class QuestionC
    {
        public static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            var arr = Console.ReadLine().Split(' ').Select(i => decimal.Parse(i)).ToArray();
            var r = arr[0] * arr[1];
            Console.WriteLine(Math.Truncate(r));

            Console.Out.Flush();
        }
    }
}


Measured memory_bytes: 28316
// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools

#include <bits/stdc++.h>

using namespace std;

using i64 = long long;

const i64 MOD = 1e9 + 7;
const i64 INF = i64(1e18) + 7;


template <typename T>
bool chmin(T& x, T y){
    if(x > y){
        x = y;
        return true;
    }
    return false;
}

template <typename T>
bool chmax(T& x, T y){
    if(x < y){
        x = y;
        return true;
    }
    return false;
}


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


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


Measured memory_bytes: 3760
N, K = map(int, input().split())
ct = [0] * N
for _ in range(K):
    d = int(input())
    As = list(map(int, input().split()))
    for a in As:
        ct[a-1] += 1
ans = 0
for c in ct:
    if c == 0:
        ans += 1
print(ans)


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

int n, m;
int s, c;
int sum=0;

int main(){
  cin >> n >> m;
  vector<int> ans(n, -1);
  
  bool flag=0;
  for(int i=0; i<m; i++){
    cin >> s >> c;
    if(ans[s-1] != c && ans[s-1] != -1){
      flag = 1;
      break;
    }
    else{
      ans[s-1] = c;
    }
    //cout << flag << endl;
  }
  
  
  if(n > 1 && ans[0] == 0) flag = 1;
  if(flag == 1) cout << -1 << endl;
  else{
    for(int i=0; i<n; i++){
      if(ans[i] == -1 && i == 0 && n != 1){
        sum += 1 * pow(10, n-i-1);
      }
      else if(ans[i] == -1 && i == 0 && n == 1){
        sum += 0;
      }
      else if(ans[i] == -1 && i != 0){
        sum += 0;
      }
      else{
        sum += ans[i] * pow(10, n-i-1);
      }
    }
    cout << sum << endl;
  }
}

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

#define rep(i, N) for (int i = 0; i < N; i++)
#define pb push_back

typedef long long ll;
typedef pair<int, int> i_i;
const ll INF = LLONG_MAX / 2;
const int MOD = 1e9 + 7;

int pow_mod(ll x, ll n, int M) {
	ll ans = 1;
	for (; n; n>>=1) {
		if (n & 1) ans = ans * x % M;
		x = x * x % M;
	}
	return ans;
}

int inv_mod(int x, int p) {
	return pow_mod(x, p - 2, p);
}

int main() {
	int N, K; cin >> N >> K;
	vector<int> dp(10001);
	dp[0] = 1;
	for (int i = N; i >= 1; i--) {
		vector<int> _dp(10001);
		rep(x, 10001) if (dp[x]) rep(k, K + 1) {
			int _x = x;
			if (k <= i) _x += (k + x) / i;
			_dp[_x] = (_dp[_x] + dp[x]) % MOD;
		}
		dp = _dp;
	}
	ll ans = (ll)K * inv_mod(2, MOD) % MOD * N % MOD * pow_mod(K + 1, N, MOD) % MOD;
	// cout << ans << endl;
	rep(x, 10001) ans = (ans - (ll)dp[x] * x) % MOD;
	cout << (ans + MOD) % MOD << endl;
}


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

import sys
from heapq import heappop, heappush

sys.setrecursionlimit(10 ** 9)
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
INF=float('inf')

# ダイクストラ(頂点数, 隣接リスト(0-indexed), 始点)
def dijkstra(N: int, nodes: list, src: int) -> list:
    # 頂点[ある始点からの最短距離]
    # (経路自体を知りたい時はここに前の頂点も持たせる)
    res = [float('inf')] * N
    # スタート位置
    que = [(0, src)]
    res[src] = 0
    # キューが空になるまで
    while len(que) != 0:
        # srcからの距離, 現在のノード
        dist, cur = heappop(que)
        # 出発ノードcurの到着ノードでループ
        for nxt, cost in nodes[cur]:
            # 今回の経路のが短い時
            if res[cur] + cost < res[nxt]:
                res[nxt] = res[cur] + cost
                # 現在の移動距離をキューの優先度として、早い方から先に処理するようにする
                heappush(que, (res[nxt], nxt))
    # ノードsrcからの最短距離リストを返却
    return res

N=INT()
nodes=[[] for i in range(N)]
for i in range(N-1):
    u,v,w=MAP()
    nodes[u].append((v, w))
    nodes[v].append((u, w))

res=dijkstra(N, nodes, 0)
x=res.index(max(res))
res=dijkstra(N, nodes, x)
print(max(res))



Measured memory_bytes: 46324
#include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define it ::iterator
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double ESP=1e-10;
using namespace std;
int main(){
  /*  (a+b)m<=60*t+c<=(a+b)*m+a
    0<=60*t+c-(a+b)*m<=a
    0 <= c-(a+b)*m<=a
    c-a<=(a+b)*m
(c-a)/(a+b)<=m


  */
  int a,b,c;
  cin>>a>>b>>c;
  rep(i,1e9){
    if(i==10000000){cout<<-1<<endl;break;}
    double m=(60*i+c-a)/(double)(a+b);
    if(m<0){cout<<c<<endl;break;}
    int mm=(int)(m+0.99999999999999);
    if(0<=60*i+c-(a+b)*mm){cout<<60*i+c<<endl;break;}
  }
}

Measured memory_bytes: 1164
#include <bits/stdc++.h>
using namespace std;
/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<typename T> using gpp_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T, typename L> using gpp_map = tree<T, L, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T> using gpp_multiset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;*/
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define all(v) v.begin(),v.end()
#define SZ(v) ((int)v.size())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)
#define bit(n) (1LL<<(n))
#define bit_exist(x, n) ((x >> n) & 1)
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) cout << #v << "=" << endl; REP(i_debug, v.size()){ cout << v[i_debug] << ","; } cout << endl;
#define mdebug(m) cout << #m << "=" << endl; REP(i_debug, m.size()){ REP(j_debug, m[i_debug].size()){ cout << m[i_debug][j_debug] << ","; } cout << endl;}
#define pb push_back
#define f first
#define s second
#define int long long
#define INF 1000000000000000000
template<typename T> istream &operator>>(istream &is, vector<T> &v){ for (auto &x : v) is >> x; return is; }
template<typename T> ostream &operator<<(ostream &os, vector<T> &v){ for(int i = 0; i < v.size(); i++) { cout << v[i]; if(i != v.size() - 1) cout << endl; }; return os; }
template<typename T> void Out(T x) { cout << x << endl; }
template<typename T1, typename T2> void Ans(bool f, T1 y, T2 n) { if(f) Out(y); else Out(n); }

using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using PiP = pair<int, Pii>;
using PPi = pair<Pii, int>;
using bools = vector<bool>;
using pairs = vector<Pii>;

//int dx[4] = {1,0,-1,0};
//int dy[4] = {0,1,0,-1};
//char d[4] = {'D','R','U','L'};

const int mod = 1000000007;
//const int mod = 998244353;
//#define Add(x, y) x = (x + (y)) % mod
//#define Mult(x, y) x = (x * (y)) % mod



signed main(){

    int N; cin >> N;
    Out(N * N * N);

    return 0;
}


Measured memory_bytes: 256
n, a, b = map(int,input().split())
mod = 10 ** 9 + 7

def com(n, r, mod):
    k = min(r, n - r)
    res = 1
    for i in range(k):
        res = (res * (n - i) * pow(i + 1, mod - 2, mod))%mod

    return res

ans = pow(2, n, mod) - 1 - (com(n, a, mod) + com(n, b, mod))
print(ans%mod)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define P pair<int,int>
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<n;i++)
#define all(v) v.begin(),v.end()
#define pb push_back
template<class T>void chmax(T &a,T b){if(a<b)a=b;}
template<class T>void chmin(T &a,T b){if(a>b)a=b;}
constexpr int INF=1000000000000000000;
constexpr int mod=1000000007;
int dx[]={0,1,0,-1},dy[]={1,0,-1,0};
int gcd(int a,int b){
    if(b==0)return a;
    return gcd(b,a%b);
}
int lcm(int a,int b){
    return a/gcd(a,b)*b;
}
bool prime(int a){
    if(a==1)return false;
    for(int i=2;i*i<=a;i++){
        if(a%i==0)return false;
    }
    return true;
}
vector<int>kaijo;
void init_fact(int n){
    kaijo.resize(n+1);
    kaijo[0]=1;
    for(int i=1;i<=n;i++){
        kaijo[i]=kaijo[i-1]*i;
        kaijo[i]%=mod;
    }
}
int modpow(int a,int b){
    if(b==0)return 1;
    if(b%2)return modpow(a,b-1)*a%mod;
    int memo=modpow(a,b/2);
    return memo*memo%mod;
}
int comb(int a,int b){
    //if(!kaijo[0])init_fact(2000010);
    return kaijo[a]*modpow(kaijo[a-b],mod-2)%mod*modpow(kaijo[b],mod-2)%mod;
}
int inv(int x){
    x=modpow(x,mod-2);
    return x;
}
bool kosa(double ax,double ay,double bx,double by,double cx,double cy,double dx,double dy){
    double ta=(cx-dx)*(ay-cy)+(cy-dy)*(cx-ax);
    double tb=(cx-dx)*(by-cy)+(cy-dy)*(cx-bx);
    double tc=(ax-bx)*(cy-ay)+(ay-by)*(ax-cx);
    double td=(ax-bx)*(dy-ay)+(ay-by)*(ax-dx);
    return tc*td<0&&ta*tb<0;
}
int n,m;
signed main(){
    cin>>n>>m;
    if(n%2==0){
        int le=1,ri=n;
        bool f=true;
        for(int i=1;i<=m;i++){
            if(ri-le<=n/2&&f){
                f=false;
                ri--;
            }
            cout<<le<<" "<<ri<<endl;
            le++,ri--;
        }
    }
    else{
        for(int i=1;i<=m;i++){
            cout<<i<<" "<<n-i+1<<endl;
        }
    }
    return 0;
}


Measured memory_bytes: 3640
#include<bits/stdc++.h>
using namespace std;
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int inf=1e9+7;
ll GCD(ll p,ll q){
  if(p<q)swap(p,q);
  if(q==0)return p;
  return GCD(q,p%q);
}
ll LCM(ll p,ll q){
  return (p/GCD(p,q))*(q/GCD(p,q))*GCD(p,q);
}
int main(){
  int n;cin>>n;
  ll ans=1;
  rep(i,n){
    ll t;cin>>t;
    ans=LCM(ans,t);
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <bitset>    // bitset
#include <cctype>    // isupper, islower, isdigit, toupper, tolower
#include <cstdint>   // int64_t, int*_t
#include <cstdio>    // printf
#include <deque>     // deque
#include <iomanip>
#include <iostream> // cout, endl, cin
#include <map>      // map
#include <math.h>
#include <numeric>
#include <queue>         // queue, priority_queue
#include <set>           // set
#include <stack>         // stack
#include <string>        // string, to_string, stoi
#include <tuple>         // tuple, make_tuple
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <utility>       // pair, make_pair
#include <vector>        // vector
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
const int INF = 1001001001;
const int BG = 1000000007;

int main()
{
    string a;
    string b;
    cin >> a >> b;
    rep(i, a.size())
    {
        if (a[i] != b[a.size() - i - 1])
        {
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES" << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
using namespace std;
int main(){
	int a,b;
	cin>>a>>b;
	while(a!=0&&b!=0){
		for(int i=0;i<a;i++){
			if((i+1)%2==1){
				for(int o=0;o<b;o++){
					if((o+1)%2==1)cout<<"#";
					else cout<<".";
				}
				cout<<endl;
			}
			else{
				for(int p=0;p<b;p++){
					if((p+1)%2==1)cout<<".";
					else cout<<"#";
				}
				cout<<endl;
			}
		}
		cout<<endl;
		cin>>a>>b;
	}
}



Measured memory_bytes: 3096
#include <bits/stdc++.h>
using namespace std;
//========================
#define gc getchar_unlocked
#define fo(i, n) for (int i = 0; i < n; i++)
#define Fo(i, k, n) for (int i = k; k < n ? i < n : i > n; k < n ? i += 1 : i -= 1)
#define ll long long int
#define ull unsigned long long int
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define sortrev(x) sort(all(x), greater<int>())
#define tr(it, a) for (auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
#define ss second
#define setbits(x) _builtin_popcount(x)
#define parity(x) _builtin_parity(x)
#define leadzero(x) __builtin_clz(x)
#define trailzero(x) __builtin_ctz(x)
#define endl "\n"
#define FAST ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define CHRONO srand(chrono::high_resolution_clock::now().time_since_epoch().count())

// =======================
typedef pair<int, int> pii;
typedef pair<ll, ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pii> vpii;
typedef vector<pl> vpl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef map<int, int> mii;
mt19937_64 rang(chrono::high_resolution_clock::now().time_since_epoch().count());
int rng(int lim)
{
    uniform_int_distribution<int> uid(0, lim - 1);
    return uid(rang);
}
int mpow(int base, int exp);
void yes() { cout << "YES\n"; }
void no() { cout << "NO\n"; }

const int mod = 1'000'000'007;
const int N = 3e5, M = N;
// =======================
string s;
void input()
{
    cin >> s;
}

void solve()
{
    if (s.back() == 's')
        s += "es";
    else
        s += "s";
    cout << s;
}

int main()
{
    FAST;
    CHRONO;
    int t = 1;
    //cin >> t;
    while (t--)
    {
        input();
        solve();
    }
    return 0;
}

int mpow(int base, int exp)
{
    base %= mod;
    int result = 1;
    while (exp > 0)
    {
        if (exp & 1)
            result = ((ll)result * base) % mod;
        base = ((ll)base * base) % mod;
        exp >>= 1;
    }
    return result;
}


Measured memory_bytes: 3620
import sys
N = int(input())
t_param = 0
x_param = 0
y_param = 0

for i in range(N):
    t, x, y = map(int, input().split())
    if (abs(x - x_param) + abs(y - y_param))  > (abs(t - t_param)) or ((x + y + t)%2) != 0 :
        print('No')
        sys.exit()
    t_param = t
    x_param = x
    y_param = y
print('Yes')

Measured memory_bytes: 9156
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7
#import numpy as np
#from decimal import *


N, X, Y = MAP()

graph = [[] for _ in range(N)]

for i in range(N-1):
	graph[i].append(i+1)
	graph[i+1].append(i)

graph[X-1].append(Y-1)
graph[Y-1].append(X-1)

dic = defaultdict(int)
for i in range(N):
	q = deque([i])
	dist = [-1]*N
	dist[i] = 0

	while q:
		n = q.popleft()
		for node in graph[n]:
			if dist[node] == -1:
				dist[node] = dist[n] + 1
				q.append(node)

	for i in range(N):
		dic[dist[i]] += 1

for k in range(1, N):
	print(dic[k]//2)

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

int main() {
    int N; cin >> N;
    vector<long long> H(N);
    int ans = 0, subans = 0;
    for( auto &k : H )cin >> k;
    for( int i = 0; i < N; i++ ){
        if( i == N-1 ){
            ans = max(ans,subans);
            subans=0;
        } 
        if( H[i] >= H[i+1] ){
            subans++;
        } else {
            ans = max(ans,subans);
            subans=0;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 1024
// 2600_KotoMunicipalSubway.cpp
//
#include <bits/stdc++.h>
using namespace std;
int d, e;
double _min;
int main() {
  while(cin >> d >> e && d && e) {
    _min = 1000000;
    for(int i = 0; i <= d; ++i) {
      _min = min(_min, abs(sqrt(i*i + (d-i)*(d-i)) - e) );
    }
    cout << _min << endl;
  }
  return 0;
}



Measured memory_bytes: 3244