akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define dbg(...) do{cerr<<__LINE__<<": ";dbgprint(#__VA_ARGS__, __VA_ARGS__);}while(0);

using namespace std;

namespace std{template<class S,class T>struct hash<pair<S,T>>{size_t operator()(const pair<S,T>&p)const{return ((size_t)1e9+7)*hash<S>()(p.first)+hash<T>()(p.second);}};template<class T>struct hash<vector<T>>{size_t operator()(const vector<T> &v)const{size_t h=0;for(auto i : v)h=h*((size_t)1e9+7)+hash<T>()(i)+1;return h;}};}
template<class T>ostream& operator<<(ostream &os, const vector<T> &v){os<<"[ ";rep(i,v.size())os<<v[i]<<(i==v.size()-1?" ]":", ");return os;}template<class T>ostream& operator<<(ostream &os,const set<T> &v){os<<"{ "; for(const auto &i:v)os<<i<<", ";return os<<"}";}
template<class T,class U>ostream& operator<<(ostream &os,const map<T,U> &v){os<<"{";for(const auto &i:v)os<<" "<<i.first<<": "<<i.second<<",";return os<<"}";}template<class T,class U>ostream& operator<<(ostream &os,const pair<T,U> &p){return os<<"("<<p.first<<", "<<p.second<<")";}
void dbgprint(const string &fmt){cerr<<endl;}template<class H,class... T>void dbgprint(const string &fmt,const H &h,const T&... r){cerr<<fmt.substr(0,fmt.find(","))<<"= "<<h<<" ";dbgprint(fmt.substr(fmt.find(",")+1),r...);}
typedef long long ll;typedef vector<int> vi;typedef pair<int,int> pi;const int inf = (int)1e9;const double INF = 1e12, EPS = 1e-9;
void visit(const vector<vi> &g, int v, vector< vector<int> >& scc,
    stack<int> &S, vector<bool> &inS,
    vector<int> &low, vector<int> &num, int& time) {
  low[v] = num[v] = ++time;
  S.push(v); inS[v] = true;
  for(int w: g[v]) {
    if (num[w] == 0) {
      visit(g, w, scc, S, inS, low, num, time);
      low[v] = min(low[v], low[w]);
    } else if (inS[w])
      low[v] = min(low[v], num[w]);
  }
  if (low[v] == num[v]) {
    scc.push_back(vector<int>());
    while (S.size()) {
      int w = S.top(); S.pop(); inS[w] = false;
      scc.back().push_back(w);
      if (v == w) break;
    }
  }
}
vector<vi> stronglyConnectedComponents(const vector<vi>& g) {
  const int n = g.size();
  vector<int> num(n), low(n);
  stack<int> S;
  vector<bool> inS(n);
	vector< vector<int> > scc;
  int time = 0;
  rep(u, n) if (num[u] == 0)
    visit(g, u, scc, S, inS, low, num, time);
	return scc;
}
int main(){
	cin.tie(0); cin.sync_with_stdio(0);
	int n; cin >> n;
	int ans = 0;
	vector<vi> e(n);
	rep(i, n){
		int x; cin >> x;
		int y = (i + x) % n;
		if(i == y) ans++;
		else e[i].pb(y);
	}
	vector<vi> scc = stronglyConnectedComponents(e);
	for(auto v : scc) if(v.size() > 1) ans += v.size();
	cout << ans << endl;
	return 0;
}


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

#define rep(i, n) for(int i=0; i < n; i++)
#define reps(i, n) for(int i=1; i <= n; i++)
#define INF 1e9
#define ALL(v) v.begin(), v.end()

using namespace std;
using ll=long long;

int main() {
    int n;
    string s;
    cin >> n >> s;
    cout << (s.substr(0, n / 2) == s.substr(n / 2) ? "Yes" : "No");
}

Measured memory_bytes: 256
/* Generated by cf-tool
 * You can download the binary file in here https://github.com/xalanq/cf-tool (win, osx, linux)
 * Author: $%U%$
 * Time: $%Y%$-$%M%$-$%D%$ $%h%$:$%m%$:$%s%$
**/

#include <bits/stdc++.h>
#define rep(i,a,b) for(int i = (a); i <= (b); i++)
#define rng(a) a.begin(), a.end()
#define sz(x) (int)(x).size()
#define se second
#define fi first
#define prev            ioyhhhhhhyoi    
#define next          sdNNNmNNNNNNNmds. 
#define y0          -hNNNNy_yNNNNNN_lNh-
#define y1          mNNNNNdtdNNNNNNtsNNm
#define yn          mNNNNNNNNy--:smNNNms
#define tm          .+oooooosyysooooo+- 
#define read               :yhy/        
#define rank              :mNmo         
#define index              ... 
#define pb push_back
#define pcnt __builtin_popcountll
#define rrep(i,a,b) for(int i = (b); i >= (a); i--)
#define rall(x,a) for(auto x : a)
#define MOD 1000000007
#define endl "\n"
typedef long long ll;
using namespace std;

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int x;
    string a;
    cin >> x >> a;
    cout << (x < 3200 ? "red" : a) << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int a = sc.nextInt() % 10;
		String b = "";
		// 出力
		if (a == 2
				|| a == 4
				|| a == 5
				|| a == 7
				|| a == 9) {

			b = "hon";

		} else if (a == 0
				|| a == 1
				|| a == 6
				|| a == 8) {

			b = "pon";

		} else if (a == 3) {

			b = "bon";

		}
		System.out.println(b);
	}
}

Measured memory_bytes: 35744
#include <stdio.h>
 
#define INF 1e9
#define MAX 150
#define min(a,b) ((a) < (b) ? (a) : (b))
 
int main(){
  int n,i,u,k,j,v,c;
  int A[MAX][MAX];
 
  for(i = 0 ; i < MAX ; i++){
    for(j = 0 ; j < MAX ; j++){
      A[i][j] = INF;
    }
    A[i][i] = 0;
  }
 
  scanf("%d",&n);
  for(i = 0 ; i < n ; i++){
    scanf("%d%d" ,&u ,&k);
    for(j = 0 ; j < k ; j++){
      scanf("%d%d" ,&v ,&c);
      A[u][v] = c;
    }
  }
 
  for(k = 0 ; k < n ; k++){
    for(i = 0 ; i < n ; i++){
      for(j = 0 ; j < n ; j++){
    A[i][j] = min(A[i][j],A[i][k]+A[k][j]);
      }
    }
  }
 
  for(i = 0 ; i < n ; i++){
    printf("%d %d\n" ,i ,A[0][i]);
  }
 
  return 0;
}

Measured memory_bytes: 688
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
int main() {
  ll n,t,a,x;
  cin>>n>>t>>a;
  double min;
  ll ans=1;
  for(int i=1;i<=n;i++){
    cin>>x;
    double num=t-x*0.006;
    if(i==1)min=num;
    if(abs(double(a)-num)<abs(double(a)-min)){
      min=num;
      ans=i;
    }
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#define LL long long
int N, K;
LL A[100010];
LL sum[32];
LL KS[32];
LL ans;
int main() {
	std::cin >> N >> K;
	int tmp = 0;
	KS[0] = K;
	for (int i = 30; i >= 1; i--) {
		if (K >> i & 1) {
			KS[i] += tmp + (1 << i) - 1;
			tmp += 1 << i;
		}
	}
	for (int i = 0; i < N; i++) {
		LL A, B;
		std::cin >> A >> B;
		for (int i = 0; i <= 30; i++) {
			if ((KS[i] & A) == A) {
				sum[i] += B;
			}
		}
	}
	for (int i = 0; i <= 30; i++) {
		ans = std::max(sum[i], ans);
	}
	std::cout << ans << std::endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define speed ios_base::sync_with_stdio(0); cin.tie(0);
#define FL(i,a,n) for(ll i=a;i<n;i++)
#define even(x) (((x)%(2))==(0))
#define odd(x) (((x)%(2))==(1))
#define meme(x) memset(x, 0, sizeof(x))
#define mod 1000000007

#define pb push_back
#define mp make_pair
#define ff first
#define ss second

ll claw[2000003];
ll infant[2000003];
 
int main() 
{
    speed
    ll n,m;cin>>n>>m;
    ll k;cin>>k;
    vector<ll> a(n+1),b(m+1);
    for(ll i=0;i<n;i++)
    {
        cin>>a[i+1];
        a[i+1]+=a[i];
    }
    for(ll i=0;i<m;i++)
    {
        cin>>b[i+1];
        b[i+1]+=b[i];
    }
    
    ll cnt=0;
    ll j=m;
    for(ll i=0;i<=n;i++)
    {
        if(a[i]>k)
        break;
        while(a[i]+b[j]>k)
        {
            --j;
        }
        cnt=max(cnt,i+j);
    }
    
    cout<<cnt;

}

Measured memory_bytes: 6344
#include <vector> 
#include <list> 
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

//math
//-------------------------------------------
template<class T> inline T sqr(T x) { return x * x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << '=' << (x) << endl;
#define debug(x) cerr << #x << '=' << (x) << '('<<'L' << __LINE__ << ')' << ' ' << __FILE__ << endl;

#define YES_ cout<<"YES"<<endl; return 0;
#define NO_ cout<<"NO"<<endl; return 0;



int main() {

	string S;
	LL ans = 0LL;
	
	cin >> S;
	int n = S.size();

	LL jimei = 9*(S.size()-1);


	if (S[0] != '9') {
		
		//先頭が何かの数字かつ下の桁がすべて9ならその数字が答え
		FOR(i, 1, S.size()) {
			if (S[i] != '9') { goto NEXT; }
		}
		FOR(i, 0, S.size()) {
			ans += LL(S[i]-'0');
		}
		cout << max(ans,jimei) << endl;
		return 0;

	NEXT:;
		//したがすべて９ではなかった
		ans += S[0] - '1';
		REP(i, S.size() - 1) {
			ans += 9;
		}
		cout << max(ans,jimei) << endl;
		return 0;
	}
	//先頭が9だった
	else {
	
		FOR(i, 1, S.size()) {
			if (S[i] != '9') { goto NONALL; }
		}
		//全て9
		REP(i, S.size()) {
			ans += 9;
		}
		cout << max(ans, jimei) << endl;

		return 0;

	NONALL:;
		ans += 8;
		FOR(i, 1, S.size()) {
			ans += 9;
		}

		cout << max(ans,jimei) << endl;
		return 0;

	}
	



}


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

int x, y, z;

int main()
{
  cin >> x >> y >> z;
  swap(x, y);
  swap(x, z);
  cout << x << " " << y << " " << z << endl;
  
  return 0;
}

Measured memory_bytes: 256
import java.util.*; import java.io.*; import java.math.*;
public class Main{
	//Don't have to see. start------------------------------------------
	static class InputIterator{
		ArrayList<String> inputLine = new ArrayList<String>(1024);
		int index = 0; int max; String read;
		InputIterator(){
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			try{
				while((read = br.readLine()) != null){
					inputLine.add(read);
				}
			}catch(IOException e){}
			max = inputLine.size();
		}
		boolean hasNext(){return (index < max);}
		String next(){
			if(hasNext()){
				return inputLine.get(index++);
			}else{
				throw new IndexOutOfBoundsException("There is no more input");
			}
		}
	}
	static HashMap<Integer, String> CONVSTR = new HashMap<Integer, String>();
	static InputIterator ii = new InputIterator();//This class cannot be used in reactive problem.
	static PrintWriter out = new PrintWriter(System.out);
	static void flush(){out.flush();}
	static void myout(Object t){out.println(t);}
	static void myerr(Object t){System.err.print("debug:");System.err.println(t);}
	static String next(){return ii.next();}
	static boolean hasNext(){return ii.hasNext();}
	static int nextInt(){return Integer.parseInt(next());}
	static long nextLong(){return Long.parseLong(next());}
	static double nextDouble(){return Double.parseDouble(next());}
	static ArrayList<String> nextStrArray(){return myconv(next(), 8);}
	static ArrayList<String> nextCharArray(){return myconv(next(), 0);}
	static ArrayList<Integer> nextIntArray(){
		ArrayList<String> input = nextStrArray(); ArrayList<Integer> ret = new ArrayList<Integer>(input.size());
		for(int i = 0; i < input.size(); i++){
			ret.add(Integer.parseInt(input.get(i)));
		}
		return ret;
	}
	static ArrayList<Long> nextLongArray(){
		ArrayList<String> input = nextStrArray(); ArrayList<Long> ret = new ArrayList<Long>(input.size());
		for(int i = 0; i < input.size(); i++){
			ret.add(Long.parseLong(input.get(i)));
		}
		return ret;
	}
	static String myconv(Object list, int no){//only join
		String joinString = CONVSTR.get(no);
		if(list instanceof String[]){
			return String.join(joinString, (String[])list);
		}else if(list instanceof ArrayList){
			return String.join(joinString, (ArrayList)list);
		}else{
			throw new ClassCastException("Don't join");
		}
	}
	static ArrayList<String> myconv(String str, int no){//only split
		String splitString = CONVSTR.get(no);
		return new ArrayList<String>(Arrays.asList(str.split(splitString)));
	}
	public static void main(String[] args){
		CONVSTR.put(8, " "); CONVSTR.put(9, "\n"); CONVSTR.put(0, "");
		solve();flush();
	}
	//Don't have to see. end------------------------------------------
	static void solve(){//Here is the main function
      String s = next();
      String check = "aiueo";
      if(check.contains(s)){
        myout("vowel");
      }else{
        myout("consonant");
      }
	}
	//Method addition frame start


  
	//Method addition frame end
}


Measured memory_bytes: 32960
from math import log2
n = int(input())
arr = list(map(int, input().split()))

if n == 0:
    if arr[0] == 1:
        print(1)
    else:
        print(-1)
    exit()

if arr[0] != 0:
    print(-1)
    exit()

arr.reverse()

ar2 = [None] * (n+1)

for i, e in enumerate(arr):
    if i == 0:
        ar2[0] = (e, e)
        continue

    ar2[i] = (ar2[i-1][0]+e, (ar2[i-1][1]+1) // 2 + e)

if ar2[-1][1] > 1:
    print(-1)
    exit()

ar2.reverse()

total = 0
acc = 1
for i, t in enumerate(ar2):
    acc = min(acc, t[0])

    total += acc
    acc -= arr[n-i]
    acc *= 2

print(total)


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

struct edge {int to, cost;};
int INF = 100100;
const int MAX_V = 2010;
vector<edge> G[MAX_V];
int d[MAX_V];
int V;

void dijkstra(int s) {
    priority_queue<P, vector<P>, greater<P>> que;
    fill(d, d + V, INF);
    d[s] = 0;
    que.push(P(0, s));
    while (!que.empty()) {
        P p = que.top(); que.pop();
        int v = p.second;
        if (d[v] < p.first) continue;
        for (int i = 0; i < G[v].size(); i++) {
            edge e = G[v][i];
            if (d[e.to] > d[v] + e.cost) {
                d[e.to] = d[v] + e.cost;
                que.push(P(d[e.to], e.to));
            }
        }
    }
}

int main() {
    cin >> V;
    int x, y;
    cin >> x >> y; x--; y--;
    rep(i,V) {
        if (i < V-1) {
            edge e = {i+1, 1};
            G[i].push_back(e);
        }
        if (i > 0) {
            edge e = {i-1, 1};
            G[i].push_back(e);
        }
    }
    edge e = {x, 1};
    G[y].push_back(e);
    edge f = {y, 1};
    G[x].push_back(f);
    map<int, int> mp;
    rep(i,V) {
        mp[i];
    }
    for (int i = 0; i < V; i++) {
        dijkstra(i);
        for (int j = 0; j < V; j++) {
            mp[d[j]]++;
        }
    }
    for(auto itr = mp.begin(); itr != mp.end(); itr++) {
        if (itr == mp.begin()) continue;
        cout << itr->second / 2 << endl;
    }
}

Measured memory_bytes: 512
import java.io.*;
import java.util.*;

//height 違う
public class Main{
    static int count =0;
    public static void main(String[] args)throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String str;
        str = br.readLine();
        
        String[] tmp = str.split("\\s");
        int[] num = new int[2];
        num[0] = Integer.parseInt(tmp[0]);
        num[1] = Integer.parseInt(tmp[1]);
        run(num[0],num[1]);

    }
    public static void run(int a,int b){
        if(a<b){
            System.out.println("a < b");
        }else if(a > b){
            System.out.println("a > b");
        }else{
            System.out.println("a == b");
        }
    }
}


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

using namespace std;

/*  テンプレここから */
typedef long long ll;

#define rep(i, n) for(int i = 0; i < n; ++i)
#define repi(i, start, end) for(int i = start; i < end; ++i)
#define all(x) (x).begin(), (x).end()
#define INF (1e9)
#define INFL (1e18)
#define add_mod(a, b, x) ( (ll)(a) + (ll)(b) ) % (ll)(x)
#define mul_mod(a, b, x) ( ((ll)(a) % (ll)(x)) * ((ll)(b) % (ll)(x)) ) % (ll)(x)
#define out(x) cout << (x) << endl;
#define outyes(bool_val) cout << (bool_val ? "yes" : "no") << endl;
#define outYes(bool_val) cout << (bool_val ? "Yes" : "No") << endl;
#define outYES(bool_val) cout << (bool_val ? "YES" : "NO") << endl;
#define outPossible(bool_val) cout << (bool_val ? "Possible" : "Impossible") << endl;
#define outPOSSIBLE(bool_val) cout << (bool_val ? "POSSIBLE" : "IMPOSSIBLE") << endl;

ll sub_mod(ll a, ll b, ll x){
    ll tmp = (a - b) % x;
    if(tmp < 0) tmp += x;
    return tmp;
}
ll gcd(ll a, ll b){
    if(b == 0) return a;
    else return gcd(b, a % b);
}

int dx[] = {0, 1, 0, -1};
int dy[] = {-1, 0, 1, 0};
/*  テンプレここまで */

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

    int n;
    cin >> n;

    int sum = 0;
    repi(i, 1, INF){
        sum += i;
        if(sum >= n){
            cout << i << endl;
            break;
        }
    }
}

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

int main(){
	int x, y, z;
  	cin>>x>>y>>z;
  	int count5 = 0, count7 = 0;
  	if(x == 5)
      count5++;
  	if(x == 7)
      count7++;
    if(y == 5)
      count5++;
  	if(y == 7)
      count7++;
    if(z == 5)
      count5++;
  	if(z == 7)
      count7++;
  	if(count5 == 2 && count7 ==1)
      cout << "YES" <<endl;
  	else
      cout << "NO" << endl;
  	
  	return 0;

}

Measured memory_bytes: 256
public class Main{
  static int N = 10001;
  public void run(java.io.InputStream in, java.io.PrintStream out){
    java.util.Scanner sc = new java.util.Scanner(in);
    int[] p;
    int pn, i, n, p1, q1;

    p = new int[N / 6];
    pn = getprime(p);

    for(;;){
      n = sc.nextInt();
      if(n == 0)break;
      p1 = 3; q1 = 5;
      for(i = 2;p[i] <= n && i < pn;i++)if(p[i] - p[i - 1] == 2){
        p1 = p[i - 1]; q1 = p[i];
      }
      out.println(p1 + " " + q1);
    }

    sc.close();
  }
  public static void main(String[] args){
    (new Main()).run(System.in, System.out);
  }
  private static int getprime(int[] p){
    int i, j, count = 0;
    boolean[] e;
    e = new boolean[N];
    e[0] = true; e[1] = true;
    for(i = 2;i < N;i++)if(!e[i]){
      p[count++] = i;
      for(j = i * 2;j < N;j+=i)e[j] = true;
    }
    return count;
  }
}

Measured memory_bytes: 33580
N = int(input())
points = [[int(s) for s in input().split()] for i in range(N)]
h_max = max(h for x, y, h in points)

for H in range(h_max, h_max + 1000):
    for Cx in range(101):
        for Cy in range(101):
            ok = True
            for x, y, h in points:
                h_calc = max(H - abs(x - Cx) - abs(y - Cy), 0)
                if h != h_calc:
                    ok = False
                    break
            if ok:
                print('{} {} {}'.format(Cx, Cy, H))
                exit()


Measured memory_bytes: 3188
using System;
using System.Collections.Generic;
using System.Linq;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            var arrayA = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var arrayB = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var arrayC = Console.ReadLine().Split().Select(int.Parse).ToArray();

            var manzokudo = 0;
            for (int i = 0; i < N; i++)
            {
                manzokudo += arrayB[arrayA[i] - 1];

                if (i >= 1 && arrayA[i] == arrayA[i - 1] + 1)
                {
                    manzokudo += arrayC[arrayA[i - 1] - 1];
                }
            }

            Console.WriteLine(manzokudo);
        }
    }
}


Measured memory_bytes: 13268
#include<bits/stdc++.h>
using namespace std;
/*******  All Required define Pre-Processors and typedef Constants *******/
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.rbegin(), cont.rend()
#define rep(i,n) for(int i=0; i<(n); ++i)
#define rep1(i,n) for(int i=1; i<=(n); ++i)
#define Dcout(a) cout << setprecision(20) << a << endl
#define MP make_pair
#define PB push_back
#define EPS 1e-9
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
using ll = long long;
using PAIR = pair<int, int>;
using Graph = vector<vector<int>>;
const ll INF = (1LL << 60);
const double pi=acos(-1.0);
#define debug cout << "line : " << __LINE__ << " debug" << endl
/****** Template of some basic operations *****/
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; }
/**************************************/
/******** User-defined Function *******/




/**************************************/
/********** Main()  function **********/
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n; cin >> n;
    ll d; cin >> d;
    int ans = 0;
    rep(i,n){
        ll x,y; cin >> x >> y;
        ll a = x*x + y*y;
        if(a<=d*d) ans++;
    }

    cout << ans << endl;

    return 0;
}
/********  Main() Ends Here *************/


Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = (int)(a); i <= (int)(n); ++i)
#define rrep(i, a, n) for (int i = (int)(a); i >= (int)(n); --i)
#define debug(x) cerr << #x << " = " << x << "\n"
#define debugv(x) \
  rep(f, 0, (x.size() - 1)) cerr << x[f] << (f == (x.size() - 1) ? "\n" : " ")
#define debug2(x, y)                       \
  cerr << "(" << #x << "," << #y << ") = " \
       << "(" << x << "," << y << ")\n"
#define all(x) x.begin(), x.end()
#define each(a, x) for (auto& a : (x))
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define int long long
using namespace std;
using pii = pair<int, int>;
using vi = vector<int>;
const int MX = 1e5 + 5, INF = 5LL << 57, MOD = 1e9 + 7;

int N, M;
string S;
vi va, vb;
char c;
void input() {
  cin >> c;
  cout << (char)(c + 1) << endl;
  ;
  ;
}
void solve() {
  ;
  ;
}
signed main() {
  input();
  solve();
  return 0;
}

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

int main() {
  long a,b,c,ans;
  cin >> a >> b >> c;
  ans=a*10+b+c;
  ans=max(ans,a+b*10+c);
  ans=max(ans,a+b+c*10);
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define prArr(Arr,n) for(int _=0;_<n;_++)   cout<<(Arr)[_]<<" ";
using namespace std;
const int INF=(int)1e9+10;
const int MOD=998244353;

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n;
    long double sum=0,tmp=0;
    cin>>n;
    for(int i=0;i<n&&cin>>tmp;i++)
        sum+=1/tmp;
    cout<<fixed<<setprecision(10)<<1/sum;
    return 0;
}



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

using namespace std;

typedef long long ll;
typedef pair<int,int> P;
constexpr double EPS = 1e-12;
constexpr int INF = numeric_limits<int>::max()/2;
constexpr int MOD = 1e9+7;

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

    int n;cin>>n;
    vector<ll> x(n),y(n),h(n);
    for(int i=0;i<n;i++){
        cin>>x[i]>>y[i]>>h[i];
    }
    for(int i=0;i<=100;i++){
        for(int j=0;j<=100;j++){
            set<ll> st;
            vector<P> v;
            for(int k=0;k<n;k++){
                if(h[k]==0){
                    v.push_back(P(x[k],y[k]));
                    continue;
                }
                ll p=h[k]+abs(i-x[k])+abs(j-y[k]);
                st.insert(p);
            }
            if(st.size()!=1) continue;
            bool f=true;
            ll p=*(st.begin());
            for(int k=0;k<(int)v.size();k++){
                if(max(p-abs(v[k].first-i)-abs(v[k].second-j),0LL)==0) continue;
                f=false;
            }
            if(!f) continue;
            cout<<i<<" "<<j<<" "<<p<<endl;
            return 0;
        }
    }
}


Measured memory_bytes: 256
# review
n, m= map(int, input().split())
ks = [list(map(int, input().split()))[1:] for _ in range(m)]
p = list(map(int, input().split()))

# 指定された電球(sたち)が全部付いているときを10進数にしてリスト
s = []
for i in ks :
        t = 0
        for j in range(len(i)) :
                t += 2**(n-i[j])
        s.append(t)

# 2**nまでの二進数の中で電球１がつくやつ→電球２がつく→・・・最後まで満たしたら1を足す。を繰り返す
ans = 0
for i in range(2**n) :
        flag = True
        for j in range(m) :
                if bin(s[j] & i).count('1') % 2 != p[j] :
                        flag = False
                        break
        if flag :
                ans += 1
print(ans)

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

int main() {
  vector<int> a(3);
  for(int i =0; i<3; i++)
    cin>>a[i];
  sort(a.begin(), a.end());
  if(a[0] == 5 && a[1] ==5 && a[2] ==7) cout<<"YES"; else cout<<"NO";
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <iostream>
#define MAXN 200010
using namespace std;

int n;
int A[MAXN];
struct item{
	int num;
	int pos;
	inline bool operator <(item rhs) const{
		return num < rhs.num;
	}
};
item B[MAXN];
int C[MAXN];

int judge(int j){
	if(j > n / 2){
		return n / 2;
	}
	if(j <= n / 2) return n / 2 + 1;
}

int main(){
	scanf("%d",&n);
	for(int i = 1;i <= n;i++){
		int t;
		scanf("%d",&t);	
		A[i] = t;
		B[i].num = t;
		B[i].pos = i;
	}
	sort(B + 1,B + n + 1);
	for(int i = 1;i <= n;i++){
		int p = B[i].pos;
		C[p] = i;
	//	printf("[%d]%d\n",B[i].num,p);
	}
	//for(int i = 1;i <= n;i++){
	//	printf("[%d]\n",C[i]);
//	}	
	for(int i = 1;i <= n;i++){
		//printf("[%d]",judge(C[i]));
		printf("%d\n",B[judge(C[i])].num);
	}
	return 0;
} 

Measured memory_bytes: 5376
import sys

N = int(input())
l_N = len(str(N))

if l_N == 1:
    print(N)
    sys.exit()

ans = int("".join(["9", "0"] * (l_N // 2 - 1) + ["9"]))

if l_N % 2 != 0:
    ans += N - 10 ** (l_N - 1) + 1

print(ans)

Measured memory_bytes: 38384
import itertools
from collections import deque,defaultdict,Counter
from itertools import accumulate
import bisect
from heapq import heappop,heappush,heapify
from fractions import gcd
from copy import deepcopy
import math
import queue
import numpy as np
#import sympy as syp(素因数分解とか)
Mod = 1000000007
import sys
sys.setrecursionlimit(100000) 
  
def sieve_of_eratosthenes(n):
    if not isinstance(n,int):
        raise TypeError("n is not int")
    if n<2:
        raise ValueError("n is not effective")
    prime = [1]*(n+1)
    for i in range(2,int(math.sqrt(n))+1):
        if prime[i] == 1:
            for j in range(2*i,n+1):
                if j%i == 0:
                    prime[j] = 0
    res = []
    for i in range(2,n+1):
        if prime[i] == 1:
            res.append(i)
    return res

 
class UnionFind:
    def __init__(self,n):
        self.parent = [i for i in range(n+1)]
        self.rank = [0 for i in range(n+1)]
    
    def findroot(self,x):
        if x == self.parent[x]:
            return x
        else:
            y = self.parent[x]
            y = self.findroot(self.parent[x])
            return y
    
    def union(self,x,y):
        px = self.findroot(x)
        py = self.findroot(y)
        if px < py:
            self.parent[py] = px
        else:
            self.parent[px] = py
 
    def same_group_or_no(self,x,y):
        return self.findroot(x) == self.findroot(y)

def main(): #startline-------------------------------------------
    n,m = map(int,input().split())
    print(n*(n-1)//2 + m*(m-1)//2)
if __name__ == "__main__":
    main() #endline===============================================

Measured memory_bytes: 23452
using System;

public class Test
{
	public static void Main()
	{
        var n=int.Parse(Console.ReadLine());
        for (int i=1; i<=n; ++i)
        {
            string[] input=Console.ReadLine().Split(' ');
            var a = int.Parse(input[0]);
            var b = int.Parse(input[1]);
            var c = int.Parse(input[2]);
            if ((-(a*a)+(b*b)+(c*c))*((a*a)-(b*b)+(c*c))*((a*a)+(b*b)-(c*c)) == 0)
            {
                Console.WriteLine("YES");
            }
            else
            {
                Console.WriteLine("NO");
            }
        }
	}
}

Measured memory_bytes: 8812
using System;

namespace ITP1_2_B
{
    class Program
    {
        static void Main(string[] args)
        {
            String[] inputs = Console.ReadLine().Split(' ');
            int a = Convert.ToInt32(inputs[0], 10);
            int b = Convert.ToInt32(inputs[1], 10);
            int c = Convert.ToInt32(inputs[2], 10);

            if (a < b && b < c && a < c) Console.WriteLine("Yes");
            else Console.WriteLine("No");
        }
    }
}

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

int main() {
    int N;
    cin >> N;
    map<long long, long long> L, R;
    for(int i = 0; i < N; ++i) {
        int A;
        cin >> A;
        ++L[i + 1 + A];
        ++R[i + 1 - A];
    }
    long long res = 0;
    for(auto &p : L) {
        res += p.second*R[p.first];
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 37916
#include <stdio.h>


int main(void){
	int num, sum[30], first, second;
	char ch[101];

	while(1){
		scanf("%d", &num);
		if(num == 0) break;
		for(int i=0; i<num; i++){
			scanf(" %c", &ch[i]);
			ch[i] -= 'A';
		}

        for(int i=0; i<30; i++){
            sum[i] = 0;
        }
		first = ch[0];
		second = 29;
		for(int i=0; i<num; i++){
			sum[ch[i]]++;
			if(sum[ch[i]] > sum[first]){
				second = first;
				first = ch[i];
			} else if(sum[second] < sum[ch[i]] && ch[i] != first){
				second = ch[i];
			}
			if(sum[first] > sum[second] + num - i - 1){
				printf("%c %d\n", first+'A', i+1);
				goto END;
			}
		}
		printf("TIE\n");
END:;
	}//endwhile

	return 0;
}


Measured memory_bytes: 2044
(* O(k^2) (k = max n m) *)
Scanf.scanf " %d" @@ fun n ->
  let ss = Array.init n @@ fun _ -> Scanf.scanf " %s" @@ fun s -> s in
  let m = Scanf.scanf " %d" @@ (+) 0 in
  let ts = Array.init m @@ fun _ -> Scanf.scanf " %s" @@ fun t -> t in
  let ans = ref 0 in
  for i = 0 to n - 1 do
    let c = ref 0 in
    let s = ss.(i) in
    for j = 0 to n - 1 do
      if s = ss.(j) then incr c
    done;
    for j = 0 to m - 1 do
      if s = ts.(j) then decr c
    done;
    ans := max !ans !c
  done;
  Printf.printf "%d\n" !ans

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

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String in[] = br.readLine().split(" ");
        int n = Integer.parseInt(in[0]);
        in = br.readLine().split(" ");
        double arr[]=new double[n];
        double dp[] = new double[n+1];
        for(int i=0;i<n;i++){
            arr[i]=Double.parseDouble(in[i]);
        }
        dp[0]=1;
        for(int i=0;i<n;i++){
            for(int coin=i+1;coin>=0;coin--){
                dp[coin]= ((coin==0)?0:dp[coin-1]*arr[i])+dp[coin]*(1-arr[i]);
            }
        }
        double ans = 0;
        for(int i=0;i<=n;i++){
            int tail = n-i;
            if(tail<i){
                ans+=dp[i];
            }
        }

        System.out.println(ans);
    }
}


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

using namespace std;

int main() {


	int N, L;
	vector<double> V;
	int sum1 = 0; //食べる前の味
	int sum2 = 0; //食べた後の味
	int wk=99999;

	cin >> N >> L;

	for (int i = 0; i < N; i++) {
		sum1 = sum1 + (L + i);
	}

	for (int i = 0; i < N; i++) {
		for (int j = 0; j < N; j++) {
			sum2 = sum1 - (L+i);
		}
		if ((abs(sum2 - sum1)) < abs(wk-sum1)) {
			wk = sum2;
		}
	}

	cout << wk << endl;

	return 0;
}

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

#define N 105

char s[N], t[N];

int main() {
	int n;
	cin >> n >> s >> t;
    for (int i = 0; i < n; i ++) cout << s[i] << t[i];
    cout << endl;
	return 0;
}


Measured memory_bytes: 3580
#include <bits/stdc++.h>
using namespace std;
using ll=long long int;
using lld=long double;
#define all(c) (c).begin(), (c).end()
#define rep( i, a, n ) for( int i=a; i<n; i++ )
#define repp( i, a, n, p ) for( int i=a; i<n; i+=p )
#define per( i, a, n ) for( int i=n-1; i>=a; i--)
#define pb push_back
#define mp make_pair
#define acc accumulate

bool comp ( pair < int, pair <int, float > > a, pair <int, pair <int, float >> b ) { 
    return a.second.second > b.second.second;
}

int main () { 
    int n;
    cin >> n;

    vector <int> a(n), b(n);
    rep ( i, 0, n ) cin >> a[i];
    rep ( i, 0, n ) cin >> b[i];

    vector <int> c(n);
    rep ( i, 0, n ) c[i] = a[i] - b[i];

    sort ( all (c) );
    ll count=0;

    per ( i, 0, n ) if ( c[i] > 0 ) count += c[i];

    cout << count << endl;
}


Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main()
{
    int n;
    cin>>n;
    string s;
    int a=0,b=0,c=0,d=0;
    while(n--)
    {
        cin>>s;
        if (s=="AC")
            a++;
        if (s=="WA")
            b++;
        if (s=="TLE")
            c++;
        if (s=="RE")
            d++;
    }
    cout<<"AC x "<<a<<endl;
    cout<<"WA x "<<b<<endl;
    cout<<"TLE x "<<c<<endl;
    cout<<"RE x "<<d<<endl;
    return 0;
}


Measured memory_bytes: 3628
N = int(input())
a = [list(map(int, input().split())) for i in range(N)]

dp = [[0 for i in range(3)] for j in range(N)]
dp[0][0] = a[0][0]
dp[0][1] = a[0][1]
dp[0][2] = a[0][2]

for i in range(1, N):
    for place in range(3):
        for place_y in range(3):
            if place == place_y:
                continue
            dp[i][place] = max(dp[i][place], dp[i-1][place_y]+a[i][place])


print(max(dp[N-1]))


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

using namespace std;

typedef long long ll;

const ll N = 2e5 + 100;

ll a[N];

int main() {
	ll n, ans = 0;
	cin >> n;
	for (ll i = 0; i < n; ++i)
		cin >> a[i];
	for (ll i = 0; i < n; ++i) {
		if (a[i] > i || (i != 0 && a[i - 1] + 1 < a[i])) {
			cout << "-1\n";
			return 0;
		}
	}
	for (ll i = 0; i < n - 1; ++i) {
		if (a[i] + 1 != a[i + 1])
			ans += a[i];
	}
	ans += a[n - 1];
	cout << ans << '\n';
}

Measured memory_bytes: 1792
NK = list(map(int,input().split()))
A = []
c = 0
for i in range(NK[1]):
    dk = int(input())
    Aid = list(map(int,input().split()))
    for k in Aid:
        A += [k]
for i in range(1,NK[0]+1):
    if not i in A:
        c += 1
print(c)

Measured memory_bytes: 9184
#include <string>
#include <iostream>
#include <stack>
#include <queue> // priority_queue も入ってる
#include <set>   // 要素数は size() で取得 multisetもある
#include <map>
#include <array> // sizeはコンパイル時定数で固定
#include <vector>
#include <numeric>   // accumulate, gcd
#include <algorithm> // count_ifに必要
#include <iomanip>   // cout << setprecision(15) << x で小数の出力精度を指定
#include <tuple>
#include <utility> //pair
#include <cmath>

using namespace std;
// 問題が起こるまでintは使用禁止2020-04-13
using ll = long long;

#define rep(i, n) for (int i = 0; i < (n); ++i)

template <class InputIterator, class T>
bool contains_itr(InputIterator iterator, const T &value)
{
    if (find(iterator.begin(), iterator.end(), value) == iterator.end())
        return false;
    else
        return true;
}

template <class T>
bool contains_set(set<T> st, const T &value)
{
    if (st.find(value) == st.end())
    {
        return false;
    }
    else
    {
        return true;
    }
}

template <class InputIterator>
auto sum(InputIterator iterator)
{
    return accumulate(iterator.begin(), iterator.end(), 0);
}

// endは排他的(exclusive)なので注意
vector<ll> range(ll begin, ll end)
{
    vector<ll> result;
    for (ll i = begin; i < end; ++i)
    {
        result.push_back(i);
    }
    return result;
}

// =========ここまでテンプレ============

int main()
{
    ll d;
    cin >> d;
    array<ll, 26> c;
    rep(i, 26) cin >> c[i];
    vector<array<ll, 26>> s(d, array<ll, 26>());
    rep(i, d)
    {
        rep(j, 26) cin >> s[i][j];
    }
    // ここまでA問の入力と同じ
    vector<ll> t(d);
    rep(i, d)
    {
        ll tempT;
        cin >> tempT;
        t[i] = tempT - 1;
    };

    array<ll, 26> last;
    rep(i, 26) last[i] = -1;
    ll satis = 0;
    rep(i, d)
    {
        satis += s[i][t[i]];
        last[t[i]] = i;
        rep(j, 26)
        {
            satis -= c[j] * (i - last[j]);
        }
        cout << satis << endl;
    }
}

Measured memory_bytes: 3244
s =input()
t =input()

ls = len(s)
lt = len(t)

res = ls

for i in range(ls-lt+1):
    x = s[i:i+lt]
    temp = 0
    for j in range(lt):
        if x[j] ==t[j]:
            pass
        else:
            temp +=1
    res = min(res,temp)
    
print(res)

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

using namespace std;

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int n, m;
  cin >> n >> m;
  vector<vector<char>> grid(n + 2, vector<char>(m + 2, '#'));
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      cin >> grid[i][j];
    }
  }
  for (int i = 0; i <= n + 1; i++) {
    for (int j = 0; j <= m + 1; j++) {
      cout << grid[i][j];
    }
    cout << '\n';
  }
  return 0;
}

Measured memory_bytes: 3616
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <vector>
#define Rep(i, n) for(int i=0;i<n;++i)
#define rep(i, n) for(int i=1;i<=n;++i)
#define ll long long int
#define INF 1e9
#define LINF 1e18
#define MOD 1000000007
#define PI 3.14159265359
#define EPS 1e-10
#define All(a) (a).begin(), (a).end()

using namespace std;
using P = pair<ll, ll>;
 
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};

/**
 * Usage:
 * 
 * G[from].push_back(Edge(to, weight));
 * using Graph = vector<vector<Edge>>;
 * 
 */ 
struct Edge {
  int to;     
  ll weight; 
  Edge(int t, ll w) : to(t), weight(w) { }
};

/**
 * Usage:
 * 
 * chmin(old, new);
 * chmax(old, new);
 * 
 */ 
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;
}

template<typename T>
void printv(vector<T>& v) {
  if (v.size() == 0) {
    cout << "\n";
    return;
  }

  Rep(i, v.size()) {
    cout << v[i] << ((i + 1 < v.size()) ? ' ' : '\n');
  }
}





int N, K;
vector<ll> x;

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

  Rep(i, N) {
    ll tmp;
    cin >> tmp;
    x.push_back(tmp);
  }

  sort(All(x));

  ll ans = LINF;

  Rep(i, N-K+1) {
    //cout << x[i] << " " << x[i+K-1] << "\n";

    if (x[i] >= 0 && x[i+K-1] >= 0) {
      chmin(ans, x[i+K-1]);
    } else if (x[i] <= 0 && x[i+K-1] <= 0) {
      chmin(ans, -x[i]);
    } else {
      chmin(ans, min(-x[i], x[i+K-1]) + x[i+K-1] - x[i]);
    }
  }

  cout << ans << "\n";
}

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

# 0番についてクエリを投げ、結果を受け取る
q = 0
print(q)
zero = input()

if zero == "Vacant":
    exit()

left = 1
right = n - 1

"""
0が男だったとする。

偶数(例えば10)が男だったら、
0, 1, ..., 10 = 男, 女, ..., 男　と並べることができる。
10, 11, ..., N-1(偶数) には空席がないと辻褄が合わない。

偶数(例えば10)が女だったら、
0, 1, ..., 10 には空席がないと辻褄が合わない。
10, 11, ..., N-1(偶数) = 女, 男, ..., 女 と並べることができる。

奇数(例えば11)が男だったら、
0, 1, ..., 11 には空席がないと辻褄が合わない。
11, 12, ...,N-1(偶数) = 男, 女, ..., 女 と並べることができる。

奇数(例えば11)が女だったら、
0, 1, ..., 11 = 男, 女, ..., 女　と並べることができる。
11, 12, ..., N-1(偶数) には空席がないと辻褄が合わない。
"""

for _ in range(19):
    q = (left + right) // 2
    print(q)
    s = input()
    if s == "Vacant":
        exit()
    elif q % 2 == 0:
        if s == zero:
            left = q + 1
        else:
            right = q
    else:
        if s == zero:
            right = q
        else:
            left = q + 1


Measured memory_bytes: 62080
A = gets.to_i
B = gets.to_i
C = gets.to_i
D = gets.to_i
E = gets.to_i

number = []

[A, B, C, D, E].permutation(5).each do |abcde|
  sum = 0
  abcde.each_with_index do |n, i|
    sum += n
    if i != 4 and sum%10 != 0
      sum = sum + (10 - sum%10)
    end
  end
  number << sum
end

p number.min

Measured memory_bytes: 1788
import java.util.*;

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

       int N = sc.nextInt();
       int M = sc.nextInt();
       
       int a[] = new int[N];
       int b[] = new int[N];
       
       int c[] = new int[M];
       int d[] = new int[M];
       
       for(int i =0;i < N;i++){
           a[i] = sc.nextInt();
           b[i] = sc.nextInt();
       }
       
       for(int j = 0;j < M;j++){
           c[j] = sc.nextInt();
           d[j] = sc.nextInt();
       }
       
       
       int ans[] = new int[N];

       for(int i = 0;i < N;i++){
          int min = Integer.MAX_VALUE;
          int cur = 50;
          for(int k = 0;k < M;k++){
              int dist = Math.abs(a[i] - c[k]) + Math.abs(b[i] - d[k]);
              if(dist < min) cur = k;
              if(dist == min) cur = Math.min(cur,k);
              min = Math.min(min,dist);
          }                  
          System.out.println(cur + 1);
       }                     
       
    }            
}
        

Measured memory_bytes: 22100
using System;
using System.Linq;
using System.Text;

namespace ALDS1_6_B {
    public static class MyExtension {
        public static int Pertition(this int[] arr,int p,int r) {
            int x = arr[r];
            int i = p - 1;
            for(int j = p; j < r; j++) {
                if (arr[j] <= x) {
                    i++;
                    arr.Replace(i, j);
                }
            }
            arr.Replace(i + 1, r);
            return i + 1;
        }

        public static void Replace(this int[] arr,int indexA,int indexB) {
            int temp = arr[indexA];
            arr[indexA] = arr[indexB];
            arr[indexB] = temp;
        }
    }

    class Program {
        static void Main(string[] args) {
            int n = int.Parse(Console.ReadLine());
            int[] A = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();

            int q = A.Pertition(0, n - 1);
            
            StringBuilder sb = new StringBuilder();
            for (int i = 0; i < q; i++)
                sb.Append(A[i] + " ");
            sb.Append("[" + A[q] + "]");
            for (int i = q + 1; i < n; i++)
                sb.Append(" " + A[i]);
            Console.WriteLine(sb);
        }
    }
}

Measured memory_bytes: 20908
#include <bits/stdc++.h>
using namespace std;
int main() {
    string s;
    cin >> s;
    if (s == "SUN") {
        cout << 7 << endl;
        return 0;
    }
    if (s == "MON") {
        cout << 6 << endl;
        return 0;
    }
    if (s == "TUE") {
        cout << 5 << endl;
        return 0;
    }
    if (s == "WED") {
        cout << 4 << endl;
        return 0;
    }
    if (s == "THU") {
        cout << 3 << endl;
        return 0;
    }
    if (s == "FRI") {
        cout << 2 << endl;
        return 0;
    }
    cout << 1 << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <sstream>
#include <string>
#define _repargs(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _repargs(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define inf 2000000007
#define mp make_pair
#define pb push_back
typedef long long ll;
using namespace std;
template <typename T>
inline void output(T a, int p = 0) {
    if(p) cout << fixed << setprecision(p)  << a << "\n";
    else cout << a << "\n";
}
// end of template
template <typename T> inline void voutput(T &v){
    rep(i, v.size()){
        if (i) cout << " " << v[i];
        else cout << v[i];
    }
    cout << endl;
}

int gcd(int a, int b) {
    if(b == 0) return a;
    return gcd(b, a % b);
}

bool is_valid(vector<int> &A) {
    vector<int> B(30001);
    int sum = 0;
    rep(i, A.size()) {
        B[A[i]]++;
        if(B[A[i]] >= 2) {
            cerr << "double" << A[i] << endl;
            return false;
        }
        sum += A[i];
    }
    rep(i, A.size()) {
        if(gcd(sum - A[i], A[i]) == 1) {
            cerr << "gcd " << sum - A[i] << "," << A[i] << endl;
            return false;
        }
    }
    return true;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    // source code
    int N;
    cin >> N;
    if(N == 3){
        cout << 2 << " " << 5 << " " << 63 << endl;
    }
    else if(N == 4) {
        cout << 2 << " " << 5 << " "  << 20 << " " << 63 << endl;
    }
    else {
        vector<int> ret;
        ret.pb(2);
        ret.pb(3);
        ret.pb(4);
        ret.pb(6);
        int diff = N - 4;
        int mi = min(diff, 4999);
        if(mi % 2 == 0) mi--;
        int even = diff - mi;
        rep(i, mi) {
            ret.pb(9 + i * 6);
        }
        
        int e = min(even, 9998);
        e /= 2;
        int six = even - e * 2;
        
        rep(i, e) {
            ret.pb(8 + i * 6);
            ret.pb(10 + i * 6);
        }
        rep(i, six) {
            ret.pb(12 + i * 6);
        }
//        is_valid(ret);
//        if(is_valid(ret)) {
//            cerr << "invalid" << endl;
//        }
//        cout <<  ret.size()  << endl;
        voutput(ret);
    }
    
    
    return 0;
}


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

int main(){
  string s,t;
  cin >> s >> t;
  
  bool flag=false;
  rep(i,s.length()){
    if(s==t){
      flag=true;
      break;
    }else{
      rotate(s.begin(),s.begin()+1,s.end());
    }
  }
    
  if(flag) cout << "Yes" << endl;
  else cout << "No" << endl;
  
  return 0;
  
}


Measured memory_bytes: 256