akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define mod 1000000007 //998244353
#include<string.h>
#define inf 1000000000000000000
#define maxn 200006
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
#define endl '\n'
#define mapint_iterator map<int,int> :: iterator
#define mapll_iterator map<ll,ll> :: iterator
#define setint_iterator set<int> :: iterator
#define setll_iterator set<ll> :: iterator
#define setpint_iterator set<pint> :: iterator
#define setpll_iterator set<pll> :: iterator
#define trace(x) cout<<#x<<": "<<x<<" "<<endl
#define trace2(x,y) cout<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x,y,z) cout<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a,b,c,d) cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define cout1(a) cout<<a<<endl
#define cout2(a,b) cout<<a<<' '<<b<<endl
#define cout3(a,b,c) cout<<a<<" "<<b<<" "<<c<<endl
#define cout4(a,b,c,d) cout<<a<<" "<<b<<" "<<c<<" "<<d<<endl
#define vcout(v,i) cout<<v[i].fi<<" "<<v[i].se<<endl
typedef priority_queue<ll,vector<ll>,greater<ll> > pqset;
typedef priority_queue<pint,vector<pint>,greater<pint> > pqset_ll;
#define pb push_back
#define fi first
#define se second
#include<ext/pb_ds/assoc_container.hpp>
ll dxk[]={0,0,1,-1,1,1,-1,-1};
ll dyk[]={1,-1,0,0,1,-1,1,-1};
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> os;
typedef tree<pll,null_type,less<pll>,rb_tree_tag,tree_order_statistics_node_update> os_pair;
#define acc (ios::sync_with_stdio(false),cin.tie(0))
#define rep(i,n) for(ll i=0;i<n;i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define rep1(i,n) for(ll i=1;i<=n;i++)
#define per1(i,n) for(ll i=n;i>0;i--)
#define repeat(i,start,n) for(ll i=start;i<n;i++)
#define print(a,n) for(ll i=0;i<n;i++){ cout<<a[i]<<" ";}
ll ll_max(ll a,ll b,ll c){return max(a,max(b,c));}
int int_max(int a,int b,int c){return max(a,max(b,c));}
ll ll_min(ll a,ll b,ll c){return min(a,min(b,c));}
int int_min(int a,int b,int c){return min(a,min(b,c));}
ll max(int a,ll b){ return max((ll)a,b);}
ll min(int a,ll b){ return min((ll)a,b);} 
ll min(ll a,int b){ return min(a,(ll)b);}
ll max(ll a,int b){ return max(a,(ll)b);}
ll dx[]={0,0,1,-1};
ll dy[]={1,-1,0,0};
//ifstream cin("b_read_on.txt"); ofstream cout("output3.txt");
//Chronology: Binary Search,Greedy,dp,dfs and similar
//Use (<<) for multiplication
//Use (>>) for division
// In dp, first try top-down,then bottom-up
//ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);cout<<fixed;cerr.tie(NULL);cout.precision(10);
// find_by_order -> value at index
// order_of_key -> index of value
void solve(int countu){
	ll n,k;
	cin>>n>>k;
	ll p=n/k;
	n-=p*k;
	cout1(min(n,k-n));
}
int main(){
    //ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);cout<<fixed;cerr.tie(NULL);
    int t=1;
	//cin>>t;
	int countu=1;
    while(t--){
    	solve(countu);
    	countu++;
    }
}

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

int main() {
  int N;
  cin >> N;
  for (int i = 0; i < N; i++){
    string S;
    cin >> S;
    if ( S == "Y"){
      cout << "Four" << endl;
      break;
    }
    
    else if( i == N - 1 ){
      cout << "Three" << endl;
    }
    else{
      continue;
    }
  }
}
       
 

Measured memory_bytes: 3608
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <stack>
#include <climits>
#include <map>
#include <set>

using namespace std;

typedef long long ll;
typedef pair<int, int> P;

const ll mod = 1000000007;
const int inf = 1e9;
const long long INF = 1LL << 60;   // INFの値は1152921504606846976

int main()
{
    int a,b,c,d;
    cin >> a >> b >> c >> d;
    if(abs(a-c) <= d || ((abs(a-b) <= d) && abs(b-c) <= d)){
        cout << "Yes";
    }else{
        cout << "No";
    }
}   

Measured memory_bytes: 256
// You got a dream , you gotta protect it .
#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
using namespace std;
typedef long long ll;
typedef long double ld;
const long double EPS = 1e-6;
const long double pi = acos(-1);
const int INF = 1e9 + 10;
int main(){
    FAST
    ll n , m , cnt1 = 0 , cnt2 = 0;
    cin >> n >> m;
    vector<pair<ll,string>>v(m);
    vector<bool>b1(n) , b2(n);
    set<ll>s;
    for(ll i = 0; i < m; i++){
        cin >> v[i].first >> v[i].second;
        if(!b1[v[i].first] && v[i].second == "AC"){
            cnt1++;
            b1[v[i].first] = true;
            s.insert(v[i].first);
        }
    }
     for(ll i = 0; i < m; i++){
        if(v[i].second == "AC" && !b2[v[i].first]) b2[v[i].first] = true;
       else if(s.find(v[i].first) != s.end() && v[i].second == "WA" && !b2[v[i].first]) cnt2++;
    }
    cout << cnt1 << ' ' << cnt2 << endl;
    return 0;
}



Measured memory_bytes: 11264
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MOD 1000000007
#define INF 1LL<<30
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()

int main() {
    int a,b,c,x,y;
    cin>>a>>b>>c>>x>>y;

    ll ans=1LL<<60;
    rep(i,2*(x+y)+10){
        int j=max(0,(2*x-i+2-1)/2);
        int k=max(0,(2*y-i+2-1)/2);
        ll tmp=j*a+k*b+i*c;
        ans=min(ans,tmp);
    }

    cout<<ans<<endl;
}


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

#define ll long long
#define p_q priority_queue
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define str string
#define s_vec(data,name,vertical,horizontal) vector<vector<(data)>> (name)((vertical),vector<(data)>((horizontal)));


int main(){
    vector<int> a(3);
    for(int i=0;i<3;i++){
        cin>>a.at(i);
    }

    sort(a.begin(),a.end(),greater<int>());

    int stn = a.at(1) + a.at(2);

    if(stn==a.at(0)){
        cout<<"Yes";
    }else{
        cout<<"No";
    }
}

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

void solve() {
	ll n;
	cin >> n;
	set<ll> s;
	s.insert(2); s.insert(n); 
	if(n > 2) s.insert(n - 1);
	for(ll i = 2; i * i <= n - 1; i++) {
		if((n - 1) % i == 0) {
			s.insert(i);
			s.insert((n - 1) / i);
		}
	}
	for(ll i = 2; i * i <= n; i++) {
		if(n % i == 0) {
			ll num = n;
			while(num > 1 && num >= i) {
				if(num % i == 0) num /= i;
				else num = num % i;
			}
			if(num == 1) {
				s.insert(i);
			}
		}
	}
	cout << s.size() << endl;
}

int main() {
//	freopen("in.txt", "r", stdin);
	solve();
	return 0;
}

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

typedef long long ll;

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

    vector<char> name;

    while(n>0){
        char s;
        //cout<<n<<endl;
        n--;
        s = n%26 + 'a';

        //cout<<s<<endl;
        //cout<<n<<endl;
        name.push_back(s);
        n/=26;


    }
    
    reverse(name.begin(), name.end());
    for(int i=0; i<name.size(); i++){
        cout<<name[i];
    }
    cout<<endl;

    return 0;
}

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

using namespace std;

#define all(x) begin(x), end(x)

using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using vi = vector<int>;

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

    int r;
    cin >> r;
    cout << r * r << '\n';
    
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<iomanip>
#include<numeric>
#include<array>
using namespace std;
typedef long long ll;
const int INF=1000000000;
const int MOD=1000000007;
const int MAX = 2000000;

long long fac[MAX], finv[MAX], inv[MAX];

void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

long long COM(long long n, long long k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main()
{
 long long x, y, a, b;
 COMinit();
 cin >> x >> y;
 if((2*y-x)%3!=0||(2*x-y)%3!=0){
   cout << 0;
 }else{
   a=(2*y-x)/3;
   b=(2*x-y)/3;
//   cout << a <<" " << b << endl;
   if(a>0&&b>0){
    cout << COM(a+b,b);
   }else if(a>0&&b==0){
    cout << 1;
   }else if(b>0&&a==0){
    cout << 1; 
   }else{
     cout << 0;
   }
 }
 return 0;
}

Measured memory_bytes: 47104
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AtCoder169
{
    public class ProgramE
    {
        static void Main(string[] args)
        {
            var inputNumStr = Console.ReadLine();
            var inputNum = int.Parse(inputNumStr);

            var aList = new List<long>();
            var bList = new List<long>();

            for (var i = 0; i < inputNum; i++)
            {
                var input = Console.ReadLine();
                var vallist = input.Split(" ").Select(long.Parse);

                var ai = vallist.First();
                var bi = vallist.Skip(1).First();

                aList.Add(ai);
                bList.Add(bi);
            }

            if (inputNum % 2 == 1)
            {
                var a = aList.OrderBy(d => d).Skip((inputNum - 1) / 2).First();
                var b = bList.OrderBy(d => d).Skip((inputNum - 1) / 2).First();

                Console.WriteLine(b - a + 1);
            }
            else
            {
                var a1 = aList.OrderBy(d => d).Skip(inputNum / 2 - 1).First();
                var b1 = bList.OrderBy(d => d).Skip(inputNum / 2 - 1).First();
                var a2 = aList.OrderBy(d => d).Skip(inputNum / 2).First();
                var b2 = bList.OrderBy(d => d).Skip(inputNum / 2).First();

                Console.WriteLine((b1 + b2) - (a1 + a2) + 1);
            }

        }
    }
}

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

int main() {
 int H,W;
  cin >> H >> W;
  vector<vector<char>> data(H, vector<char>(W));
  for(int i=0;i<H;i++){
  for(int j=0;j<W;j++){
  cin >> data.at(i).at(j);
  }
  }
  for(int i=0;i<W+2;i++){
  cout << "#";
  if(i==W+1){
  cout << endl;
  }
  }
  for(int i=0;i<H;i++){
  for(int j=0;j<W;j++){
  if(j==0){
  cout << "#";
  }
  cout << data.at(i).at(j);
  if(j==W-1){
  cout << "#" << endl;
  }
  }
  }
  for(int i=0;i<W+2;i++){
  cout << "#";
  if(i==W+1){
  cout << endl;
  }
  }
}

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
using namespace std;
const int N=2e5+5;
const int mod=998244353;
int n,f[N],ans;char str[N],ss[N];
int sum(int m){
	int res=0;
	for(int i=1;i<=m;++i)res=(res<<1|str[i]-'0')%mod;
	return res;
}
int check(int m){
	for(int i=1;i<=m;++i)ss[i]=str[i];
	for(int i=m+1;i<=n;++i)ss[i]=ss[i-m]^1;
	for(int i=1;i<=n;++i)
		if(ss[i]!=str[i])
			return ss[i]<str[i];
	return 1;
}
int main(){
	scanf("%d",&n);
	scanf("%s",str+1);
	for(int i=1;i<=n;++i)
		if(n%i==0&&n/i&1)
			f[i]=sum(i)+check(i);
	for(int i=1;i<=n;++i)
		if(n%i==0)
			for(int j=1;j<i;++j)
				if(i%j==0)
					f[i]=(f[i]-f[j]+mod)%mod;
	for(int i=1;i<=n;++i)
		ans=(ans+2ll*f[i]*i)%mod;
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 640
from collections import deque

s = input()
d = deque(s)
q = int(input())

rev = False

for i in range(q):
    inp = input()
    if inp == '1':
        rev = True if rev == False else False
    else:
        n = inp.split()[1]
        t = inp.split()[2]
        if n == '1':
            d.append(t) if rev == True else d.appendleft(t)
        else:
            d.appendleft(t) if rev == True else d.append(t)

if rev == True:
    d.reverse()

print(''.join(d))


Measured memory_bytes: 8564
/*
ID: anonymo14
TASK: wormhole
LANG: C++                 
*/
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<pair<int,int>> vpii;

#define F first
#define S second
#define PU push
#define PUF push_front
#define PUB push_back
#define PO pop
#define POF pop_front
#define POB pop_back

#define REP(i,a,b) for(int i=a; i<=b; i++)

#define MOD 1000000007

void solve(int test_case) {//236
	int n,ans=0;
	cin>>n;
	string s;
	cin>>s;
	bitset<10> a;
	REP(i,0,n-3) {
		if(a[s[i]-'0'])continue;
		a[s[i]-'0']=1;
		bitset<10> b;
		REP(j,i+1,n-2) {
			if(b[s[j]-'0'])continue;
			b[s[j]-'0']=1;
			bitset<10> c;
			REP(k,j+1,n-1)c[s[k]-'0']=1;
			ans+=c.count();
		}
	}
	cout<<ans;
}

int main() {
	
	////// FILE BASED IO////
	//freopen("wormhole.in", "r", stdin);
	//freopen("wormhole.out", "w", stdout);
	///////////////
	
	ios::sync_with_stdio(0);
	cin.tie(0);
	int t=1;
	//cin>>t;
	REP(i,1,t) {
		solve(i);
	}
	return 0;
}	


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

typedef long long ll;
const int N = 2000006;



int main(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	
	string s;
	cin>>s;
	
	int ans = 0;
	int n = s.size();
	for(int i=0;i<n;i++){
		if(s[i] != s[n-i-1])ans++;
	}
	cout<<ans/2;
	return 0;
}


Measured memory_bytes: 3660
# Binary Indexed Tree (Fenwick Tree)
class BIT:
    # 1-index
    def __init__(self, n):
        self.size = n
        self.tree = [0] * (n + 1)
 
    def sum(self, i):
        s = 0
        while i > 0:
            s += self.tree[i]
            i -= i & -i
        return s
 
    def add(self, i, x):
        while i <= self.size:
            self.tree[i] += x
            i += i & -i

N, Q = map(int, input().split())
c = list(map(int, input().split()))
q = []
for k in range(Q):
  l, r = map(int, input().split())
  l -= 1
  r -= 1
  q.append([l, r, k])


q.sort(key = lambda x: x[1])
ans = [0 for k in range(Q)]


good = BIT(N)
lastapp = [-1 for _ in range(N)]
end = -1
for k in range(Q):
  l = q[k][0]
  r = q[k][1]
  a = q[k][2]
  for j in range(r, end, -1):
    if lastapp[c[j]-1] == -1:
      lastapp[c[j]-1] = j
      good.add(j+1, 1)
    elif lastapp[c[j]-1] < j:
      good.add(lastapp[c[j]-1]+1, -1)
      good.add(j+1, 1)
      lastapp[c[j]-1] = j
  ans[a] = good.sum(r+1) - good.sum(l)
  end = r
  
for k in range(Q):
  print(ans[k])

Measured memory_bytes: 299844
#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 ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

inline void fastio () {
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
}

#define whats(x) cerr << #x << " = " << (x) << "\n"; 

using LL = long long;
using LD = long double;

const LL INF = LLONG_MAX;
const LL MOD = 998244353;
const LL N = 2e5+1;

int main() {
	fastio();

	LL x;
	cin >>x;

	LL cnt = 1;
	LL tot = x;
	while (tot % 360 != 0) {
		cnt++;
		tot += x;
	}

	cout << cnt << "\n";
	
}

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

int main() 
{
	int n;
	cin >> n;
	map<int, int> m;
	int a;
	for(int i = 0; i < n; ++i){
		cin >> a;
		if (m.find(a) == m.end()) {
			m[a] = 1;
		}
		else {
			m[a] += 1;
		}
	}

	int ret = 0;
	for (auto& i : m) {
		if (i.first < i.second)
		{
			ret += i.second - i.first;
		}
		else if (i.first > i.second) {
			ret += i.second;
		}
	}

	cout << ret << endl;

	return 0;
}

Measured memory_bytes: 4736
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a,b,c,sum;
  vector<int> vec(5);
  vector<int> vee(5);
  for(int i=0;i<5;i++){
  	cin>>vec.at(i);
  }
 
  for(int i=0;i<5;i++){
   vee.at(i) = ((vec.at(i)+9)/10)*10;
  }
  
  c=10000;
  for(int i=0;i<5;i++){
  	sum=0;
    for(int j=0;j<5;j++){
    	if(j!=i){
           sum += vee.at(j);
        }
    }
    	sum +=vec.at(i);
      c = min({c,sum});
  }
  
  cout<<c<<endl;
  
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>



typedef struct {
	char moji;
	int num;
	int id;
}Card;

void Bubblesort(Card tramp[], int N);
void Selectionsort(Card tramp[], int N);
void Trampprintf(Card tramp[], int N);
void Stablehantei(Card tramp[], int N);

int main(void) {
	int N, i;

	Card tramp1[36]; //tramp1がBubblesort用。tramp2がselectionsort用。
	Card tramp2[36];

	scanf("%d", &N);

	for (i = 1; i <= N; i++) {
		scanf(" %c", &tramp1[i].moji);
		scanf(" %d",  &tramp1[i].num);
		tramp1[i].id = i;
		tramp2[i] = tramp1[i];
	}

	Bubblesort(tramp1, N);
	Trampprintf(tramp1, N);
	Stablehantei(tramp1, N);

	Selectionsort(tramp2, N);
	Trampprintf(tramp2, N);
	Stablehantei(tramp2, N);

		return 0;
}

void Stablehantei(Card tramp[], int N) {
	int i;
	int hantei=1;
	for (i = 1; i<N; i++) {
		if (tramp[i].num == tramp[i + 1].num&&tramp[i].id>tramp[i + 1].id) {
			hantei = 0;
		}
	}
	if (hantei == 0) {
		printf("Not stable\n");
	}else printf("Stable\n");
}



void Bubblesort(Card tramp[], int N){
	int i;
	Card tmp;
	int flag = 1;

	while (flag) {
		flag = 0;
		for (i = 1; i<N; i++) {
			if (tramp[i].num>tramp[i + 1].num) {
				tmp= tramp[i];
				tramp[i] = tramp[i + 1];
				tramp[i + 1] = tmp;
				
				flag = 1;
			}
		}
	}

}


void Selectionsort(Card tramp[], int N) {
	int i, m, min, ichi;
	Card tmp;


	for (m = 1; m<N; m++) {
		min = m; //最小値を最初は先頭にする。最小値が入っている配列の番号を記憶。
		for (i = m + 1; i <= N; i++) {
			if (tramp[i].num<tramp[min].num) {
				min = i; //最小値があった場所を更新
			}
		}
		tmp = tramp[m];
		tramp[m]= tramp[min];
		tramp[min]= tmp;
	}

}

void Trampprintf(Card tramp[], int N) {
	int i;
	for (i = 1; i <= N; i++) {
		if (i != N) {
			printf("%c%d ", tramp[i].moji, tramp[i].num);
		}
		else {
			printf("%c%d\n", tramp[i].moji, tramp[i].num);
		}

	}
}


Measured memory_bytes: 2108
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <cstring>
#include <set>
#include <utility>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <stack>
#include <string>
#include <map>
#include <cmath>
#include <deque>
#include <bitset>
#define ll long long
#define PI 3.1415926535897932384626433832795
#define read(x) scanf("%d",&x);
#define readll(x) cin>>x;
#define FOR(x,a,b) for(int x=a;x<b;x++)
#define MP make_pair
#define PB push_back
#define pii pair<int,int>
#define readN(N,X) for(int i=0;i<N;i++) cin>>X[i];
#define pff pair<double,double>
using namespace std;

int N;
int a[100005];


void No(){
	cout<<"No"<<endl;
	exit(0);
}

void Yes(){
	cout<<"Yes"<<endl;
	exit(0);
}

int main(){
   std::ios::sync_with_stdio(false); 
   cin>>N;
   FOR(i,0,N){
   		int x;
   		cin>>x;
   		a[x]++;
   		if (x == N || x == 0) No();
   }

   int ada=0;
   FOR(i,0,N){
   		if (a[i]) ada++;
   }
   if (ada > 2) No();

   if (a[N-1] == N) Yes();
   int wow = N-1;
   int L = 2;
   for (int i=2;i<=N;i++){
   		if ( a[wow] >= i && a[wow] <= L && a[wow-1] + a[wow] == N) Yes();
   		wow--;
   		L+=2;
   }
   No();
}




Measured memory_bytes: 640
def distance(p1,p2):
	return abs(p1[0]-p2[0]) + abs(p1[1]-p2[1])

n = int(input())
anslist = [None for i in range(n)]
point = [0, 0]
t = 0

for i in range(n):
	tn, nx, ny =  [ int(v) for v in input().split() ]
	dt = tn - t
	t = tn
	next_point = [nx, ny]
	
	anslist[i] =  distance(point,next_point) <= dt and (dt - distance(point,next_point)) % 2 == 0
	point = next_point

if all(anslist):
	ans = "Yes"
else:
	ans = "No"

print(ans)


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

#define ll long long

ll gcd(ll a, ll b) {
    ll r, temp;

    while(1) {
        if(a < b) {
            temp = a;
            a = b;
            b = temp;
        }
        if(b < 1) continue;

        while((r = a % b) != 0) {
            a = b;
            b = r;
        }
        return b;
    }
}

int main() {
    int N;
    cin >> N;
    int A[N];
    for(int i = 0;i < N;i++) {
        cin >> A[i];
    }
    int g = gcd(A[0], A[1]);
    for(int i = 2;i < N;i++) {
        g = gcd(g, A[i]);
    }
    cout << g << endl;
    return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

int main()	{
  string input;
  string dream = "maerd";
  string dreamer = "remaerd";
  string erase = "esare";
  string eraser = "resare";
  cin >> input;
  reverse(input.begin(), input.end());
  //cout << input << endl;
  bool flag = true;
  while (flag && input.length() > 0)	{
    if (input.substr(0, 5) == dream)	{
      input = input.substr(5);
      continue;
    }
    else if (input.substr(0, 7) == dreamer)	{
      input = input.substr(7);
      continue;
    }
    else if (input.substr(0, 5) == erase)	{
      input = input.substr(5);
      continue;
    }
    else if (input.substr(0, 6) == eraser)	{
      input = input.substr(6);
      continue;
    }
    flag = false;
  }
  if (flag == false && input.length() > 0)	{
    cout << "NO" << endl;
  }
  else	{
    cout << "YES" << endl;
  }
  return 0;
}

Measured memory_bytes: 512
import copy

class Dice(object):
	def __init__(self,List):
		self.face=List
		
	def n_spin(self,a_list):
		List=copy.copy(a_list)
		temp=List[0]
		List[0]=List[1]
		List[1]=List[5]
		List[5]=List[4]
		List[4]=temp
		return List
		
 	def s_spin(self,a_list):
 		List=copy.copy(a_list)
 		temp=List[0]
 		List[0]=List[4]
 		List[4]=List[5]
		List[5]=List[1]
		List[1]=temp
		return List
		
	def e_spin(self,a_list):
		List=copy.copy(a_list)
		temp=List[0]
		List[0]=List[3]
		List[3]=List[5]
		List[5]=List[2]
		List[2]=temp
		return List
		
 	def w_spin(self,a_list):
 		List = copy.copy(a_list)
 		temp=List[0]
 		List[0]=List[2]
 		List[2]=List[5]
		List[5]=List[3]
		List[3]=temp
		return List

dice_1=Dice(map(int,raw_input().split()))
dice_2=Dice(map(int,raw_input().split()))
emer=copy.copy(dice_2.face)
face_storage=[]
face_storage.append(emer)
judge=False
for a in range(24):
	face_storage.append(dice_2.n_spin(face_storage[a]))
	face_storage.append(dice_2.s_spin(face_storage[a]))
	face_storage.append(dice_2.e_spin(face_storage[a]))
	face_storage.append(dice_2.w_spin(face_storage[a]))
for c in face_storage:
	if c==dice_1.face:
		judge=True
if judge :
	print("Yes")
else :
	print("No")

Measured memory_bytes: 6556
while True:
    n,x = map(int,input().split())
    if n == 0 and x == 0:
        break
    cnt = 0
    for i in range(1,n+1):
        for j in range(i+1,n+1):
            for k in range(j+1,n+1):
                if i + j + k == x:
                    cnt+=1
    print(cnt)


Measured memory_bytes: 5588
//g++ -std=c++14 test.cpp -o test.out

#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <iomanip>
#include <vector>
#include <queue>
#include <map> 
#include <utility>
#include <limits.h>
#include <bitset>
#include <set>
using namespace std;
 
#define LL long long int
const LL INF = (1LL<<60);
const int INF_INT = 2147483647-1e6-1;
const LL mod = 1000000007ll;
const int mod_int = 1000000007;

LL N;
string S;

LL ans = 0;

int binser(vector<LL> a,LL num,bool lower_or_upper=false,bool debug=true){//numは実数値
	if(debug){
		cout << "inputed array:\n";
		for(int i=0;i<a.size();i++) cout << a[i] << " ";
		cout << endl;
		cout << "inputed num=" << num << endl;
	}
	if(a[a.size()-1]<num) return a.size();
	if(a[0]>num) return -1;

	int left = -1;//ギリOKライン
	int right = a.size();//ギリダメライン
	while(left+1<right){
		int center = (left+right)/2;
		if(lower_or_upper){
			if(a[center]>num) right = center;
			else left = center;
		}
		else{
			if(a[center]>=num) right = center;
			else left = center;
		}
	}
	return left+1;
}

void solve(){
	//上からi桁目まで見た時、
	//桁数jの
	//暗証番号kを作れるかどうかを
	//dp[i][j][k]とする
	reverse(S.begin(),S.end());
	vector<vector<vector<LL>>> dp(N+1,vector<vector<LL>>(4,vector<LL>(1000,0)));
	dp[0][0][0] = 1;
	for(int i=0;i<N;i++){
		int num = S[i] - '0';
		//ばらまくイメージ
		for(int j=0;j<=3;j++){
			for(int k=0;k<=999;k++){
				if(dp[i][j][k]==0) continue;
				//cout << i+1 <<" " << j+1<<" " << k+pow(10,j)*num<< endl;
				if(j+1<=3) dp[i+1][j+1][k+pow(10,j)*num] = dp[i][j][k];
				dp[i+1][j][k] = dp[i][j][k];
			}
		}
	}
	for(int k=0;k<=999;k++){
		//if(dp[N][3][k]==1) cout << k << endl;
		ans += dp[N][3][k];
	}
}
 
int main(){
    cin >> N;
    cin >> S;
 
    solve();

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

Measured memory_bytes: 943744
#include <iostream>
#include <cassert>
#include <vector>
#include <cmath>
#include <ctime>
#include <cstdlib>
#include <fstream>
#include <string>
#include <sstream>
#include <iterator>
#include <map>
#include <algorithm>
#include <memory>
#include <iomanip>
#include <limits>
#include <typeinfo>

#include <stdio.h>
#include <string.h>


using namespace std;

int main(int argc, char* argv[])
{
  int N,ans,flg,index;

  cin >> N;

  vector<int> a(N);

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

  flg=0;
  index=0;
  for(int i=0;i<N;i++){
    if(a[index]==2){
      flg=1;
      ans = i + 1;
      break;
    }
    index = a[index] - 1;
  }

  if(flg){
    cout << ans <<endl;
  }else{
    cout << -1 <<endl;
  }

  return 0;
}


Measured memory_bytes: 640
#include <cstdio>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <iterator>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define debug(x)  cout << #x << " = " << (x) << endl;

using namespace std;

const int64_t mod = 1e9 + 7;

struct Combination {
    vector<int64_t> fac, finv, inv;
    const int64_t MOD = 1e9 + 7;
    Combination(int size)
        : fac(size + 1), finv(size + 1), inv(size + 1) {
        fac[0] = fac[1] = 1;
        finv[0] = finv[1] = 1;
        inv[1] = 1;
        for (int i = 2; i < size + 1; i++){
            fac[i] = fac[i - 1] * i % MOD;
            inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
            finv[i] = finv[i - 1] * inv[i] % MOD;
        }
    }
    int64_t com(int n, int k){
        if (n < k) return 0;
        if (n < 0 || k < 0) return 0;
        return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
    }

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

int main() {
    int64_t n, a, b; cin >> n >> a >> b;

    Combination cm(510000);

    int64_t v1 = 1;
    for (int64_t i = n; i > n - a; i--) {
        v1 *= i;
        v1 %= mod;
    }
    int64_t v2 = 1;
    for (int64_t i = n; i > n - b; i--) {
        v2 *= i;
        v2 %= mod;
    }

    v1 *= cm.finv[a];
    v2 *= cm.finv[b];
    v1 %= mod;
    v2 %= mod;
    int64_t ans = cm.modpow(2, n) - 1 - v1 - v2;
    ans += 10 * mod;
    ans %= mod;
    cout << ans % mod << endl;
}


Measured memory_bytes: 12792
#include <bits/stdc++.h>
#define FOR(i, m, n) for (int i = m; i < (n); i++)
#define RFOR(i, m, n) for (int i = (m - 1); i >= 0; i--)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, n, 0)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
using namespace std;
typedef long long ll;
const int mod = 1e9 + 7;

int main()
{
  string s;
  cin >> s;
  if (s == "Sunny")
  {
    cout << "Cloudy" << endl;
  }
  else if (s == "Cloudy")
  {
    cout << "Rainy" << endl;
  }
  else
  {
    cout << "Sunny" << endl;
  }

  return 0;
}

Measured memory_bytes: 256
use std::io::prelude::*;

fn input<T: std::str::FromStr>() -> T {
    let stdin = std::io::stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}

fn main() {
    let x: i32 = input();
    let a: i32 = input();
    println!("{}", if x < a { 0 } else { 10 });
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std ;
typedef long long ll;
int main()
{
    ll d,m,n,p;
    while(cin>>n)
    {
        p=0;
        d=100;
        while(n>d)
        {
            d+=d/100;
            p++;
        }
        cout<<p<<endl;
    }
    return 0;
}


Measured memory_bytes: 3588
#include<string>
#include<iostream>
#include<algorithm>
#include<set>
#include<math.h>
#include<vector>
#include<sstream>
#include<queue>
#include<functional>
#include<bitset>
#include<cstdio>
#include<iomanip>
#include <cstring>
#include <climits>
using namespace std;
#define REP(i,n) for(int i=0;i < n; i++)
#define RREP(i,n) for(int i=n-1;i >=0; i--)
#define p(a) (a) * (a)
#define p2(a,b) p((a) - (b)) 
#define MAX 101
#define MAX_V 15

int a[100000];
int b[100000];
int main() {
	long long n,res = 0;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i] >> b[i];
	}
	long long na;
	for (int i = n - 1; i >= 0; i--) {
		na = a[i] + res;
		if (na % b[i]) {
			res += b[i] * (na / b[i] + 1)- na;
		}
	}
	cout << res << endl;
	return 0;
}

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

#############
# Libraries #
#############

import sys
input = sys.stdin.readline

import math
#from math import gcd
import bisect
from collections import defaultdict
from collections import deque
from functools import lru_cache


#############
# Constants #
#############

MOD = 10**9+7
INF = float('inf')

#############
# Functions #
#############

######INPUT######
def inputI(): return int(input().strip())
def inputS(): return input().strip()
def inputIL(): return list(map(int,input().split()))
def inputSL(): return list(map(str,input().split()))
def inputILs(n): return list(int(input()) for _ in range(n))
def inputSLs(n): return list(input().strip() for _ in range(n))
def inputILL(n): return [list(map(int, input().split())) for _ in range(n)]
def inputSLL(n): return [list(map(str, input().split())) for _ in range(n)]

######OUTPUT######
def Yes(): print("Yes"); return
def No(): print("No"); return

#####Inverse#####
def inv(n): return pow(n, MOD-2, MOD)

######Combination######
kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret

######Factorization######
def factorization(n):
  arr = []
  temp = n
  for i in range(2, int(-(-n**0.5//1))+1):
    if temp%i==0:
      cnt=0
      while temp%i==0: 
        cnt+=1 
        temp //= i
      arr.append([i, cnt])
  if temp!=1:
    arr.append([temp, 1])
  if arr==[]:
    arr.append([n, 1])
  return arr

#####MakeDivisors######
def make_divisors(n):
  divisors = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      divisors.append(i)
      if i != n // i: 
        divisors.append(n//i)
  return divisors

#####LCM#####
def lcm(a, b):
    return a * b // gcd (a, b)

#####BitCount#####
def count_bit(n):
  count = 0
  while n:
    n &= n -1
    count += 1
  return count

#####ChangeBase#####
def Base_10_to_n(X, n):
  if X//n:
    return Base_10_to_n(X//n, n)+[X%n]
  return [X%n]

def Base_n_to_10(X, n):
  return sum(int(str(X)[-i])*n**i for i in range(len(str(X))))

#####IntLog#####
def int_log(n, a):
  count = 0
  while n>=a:
    n //= a
    count += 1
  return count

#############
# Main Code #
#############

a,b = inputSL()
x = int(a+b)

if x**0.5 == int(x**0.5):
  Yes()
else:
  No()

Measured memory_bytes: 38512
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;

public class Main {

	public static void main(String[] args) {

		int intJudge = 0;
		int intCount = 0;

		int inta = 0;
		int intb = 0;
		int intc = 0;

		try {
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			String strInput = br.readLine();

			ArrayList<Integer> NumList = new ArrayList<Integer>();

			String[] strNumList = strInput.split(" ", 0);

			for (int i = 0; i < strNumList.length; i++) {
				NumList.add(Integer.parseInt(strNumList[i]));

			}

			inta = NumList.get(0);
			intb = NumList.get(1);
			intc = NumList.get(2);

			for (int i =inta ; i <= intb; i++) {
				intJudge = intc % i;
				if (intJudge == 0) {
					//?´???°???????????????
					intCount++;
				}
			}
			//???????????????
			System.out.println(intCount);

		} catch (IOException e1) {
			System.out.println(e1);
		}catch (NumberFormatException e2) {
			System.out.println(e2);
		}
	}

}

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

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            Scan sc = new Scan();
            write wr = new write();

            int[] kx = sc.intarr;
            int k = kx[0];
            int x = kx[1];

            int[] array = new int[k * 2 -1];

            int index = 0;
            for (int i = x-k+1; i<=x+k-1; i++)
            {
                
                array[index] = i;
                index += 1;
            }

            foreach(var num in array)
            {
                Console.Write($"{num} ");
            }
            Console.WriteLine("");
            
        }
    }

    class Scan
    {
        public string str => Console.ReadLine();

        public string[] strarr => str.Split(' ');

        public long[] longarr => strarr.Select(long.Parse).ToArray();
        public int[] intarr => strarr.Select(int.Parse).ToArray();
        public char[] chararr => str.ToArray();
    }


    //出力クラス
    class write
    {
        public void wri<Type>(Type x)
        {
            Console.WriteLine(x);
        }
    }

    class Method
    {
        static public int max(params int[] nums)
        {

            int maxx = nums[0];
            for (int i = 1; i < nums.Length; i++)
            {
                maxx = Math.Max(maxx, nums[i]);
            }
            return maxx;
        }
    }
}


Measured memory_bytes: 13396
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        Integer d[] = new Integer[N];
        for(int i = 0; i<N; i++){
            d[i] = sc.nextInt();
        }
        int sum = 0;
        for(int j = 0; j < N-1; j++){
            for(int k = j+1; k < N; k++){
                sum = sum + d[k] * d[j];
            }
        }
        System.out.println(sum);
    }
}

Measured memory_bytes: 23764
#include <iostream>
#include <set>
#include <utility>
#include <algorithm>

using namespace std;

typedef long long int ll;

const int MAXN = 400000;

ll curpos = 0;
ll X;

int main() {

    scanf("%lld", &X);


    int ans = 0;
    ll delta = 1;
    while (curpos < X) {
        curpos += delta;
        ++delta;
        ++ans;
    }

    printf("%d", ans);

    return 0;
}

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

using namespace std;

int a, b, c, d;

int main()
{
    cin>>a>>b>>c>>d;
    while(a != 0 || c != 0) {
        if(c > b) c -= b;
        else {
            c = 0;
            break;
        }
        if(a > d) a -= d;
        else {
            a = 0;
            break;
        }
    } 
    if(c == 0) cout<<"Yes";
    else cout<<"No";
    return 0;
}

Measured memory_bytes: 3636
n, m, c = list(map(int, input().split()))
b = list(map(int, input().split()))

s = 0

for i in range(n):
    y = 0
    a = list(map(int, input().split()))
    for j in range(m):
        y += a[j] * b[j]
    
    if y + c > 0:
        s += 1

print(s)

Measured memory_bytes: 61956
#include<bits/stdc++.h>
using namespace std;
int main(){
  long long  n,k;
  cin>>n>>k;
  long long x=n%k;
  if(x<0){
    x=-x;
  }
  long long y=x-k;
  if(y<0){
    y=-y;
  }
  if(x<y){
    cout<<x<<endl;
  }
  else{
    cout<<y<<endl;
  }
}

Measured memory_bytes: 3644
/*
Author:		CraZYali
LANG: 		C++
FileName:	.cpp

CopyRIGHT!!!
*/

#define REP(i, s, e) for(register int i = s; i <= e ;i++)

#include <bits/stdc++.h>

using namespace std;

int main() {
	char c;
	while ((c = getchar()) != EOF)
		if (c == '9') {
			cout << "Yes";
			return 0;
		}
	cout << "No";
	return 0;
}

Measured memory_bytes: 256
import itertools
import numpy as np
import sys
MAX_INT = int(10e10)
MIN_INT = -MAX_INT
mod = 1000000007
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

s = [i for i in S()]
t = [i for i in S()]
f = 0
if len(s)<len(t):
    f = len(s)
s.sort()
t.sort(reverse=True)
for a,b in zip(s,t):
    if a < b:
        print("Yes")
        exit()
    elif a == b:
        f -= 1
if f == 0:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 12472
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std;

int main()
{
	int a,b;
	cin>>a>>b;
	if(a*b%2==0)
	{
		cout<<"Even";
	 } 
	 else
	 {
	 	cout<<"Odd";
	 }
	return 0;
}

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

//repetition
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)

//container util
#define all(x) (x).begin(),(x).end()

//typedef
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VLL;
typedef vector<VLL> VVLL;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;

//const value
//const ll MOD = 1e9 + 7;
//const int dx[] = {0,1,0,-1};//{0,0,1,1,1,-1,-1,-1};
//const int dy[] = {1,0,-1,0};//{1,-1,0,1,-1,0,1,-1};

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


int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll K;
  const ll N = 50;
  cin >> K;
  cout << N << endl;
  ll add_Cnt = K/N;
  ll amari_Cnt = K%N;
  VLL ans(N,0);

  rep(i,N){
    ans[i] += N - 1 + add_Cnt;
    if(i < N - amari_Cnt){
      ans[i] -= amari_Cnt;
    } else {
      ans[i] += N - amari_Cnt + 1;
    }
  }

  rep(i,N){
    cout << ans[i] << " ";
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
# define ll long long int
#define mp	make_pair
#define pb	push_back
ll mod=1000000007;

int main() {
   
   ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
	ll n;
	cin>>n;
	int h[n+1];
	for(int i=1;i<=n;i++){
	   cin>>h[i];
	}
	int dp[n+1];
	dp[0]=0;
	dp[1]=0;
	dp[2]=abs(h[1]-h[2]);
	for(int i=3;i<=n;i++){
	   dp[i]=min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]));
	}
	cout<<dp[n];
}

Measured memory_bytes: 1024
#include<iostream>
using namespace std;
static const int MAX =100;
static const int INFTY = (1<<21);
static const int WHITE = 0;
static const int GRAY = 1;
static const int BLACK = 2;

int n, M[MAX][MAX];

void dijkstra(){
    int minv;
    int d[MAX], color[MAX]; //始点sからvまでの最短コスト

    // 全ての頂点uについて, colorを未訪問とし、dをINFTYに初期化
    for(int i=0; i<n; i++){
        d[i] = INFTY;
        color[i] = WHITE;
    }

    d[0] = 0;
    color[0] = GRAY;
    while(1){
        minv = INFTY;
        int u = -1;
        for(int i=0; i<n; i++){
            if(minv > d[i] && color[i] != BLACK){ // 距離が最小で、未訪問だったら
                u=i;
                minv = d[i];
            }
        }
        
        if(u == -1) break;
        color[u] = BLACK;

        for(int v=0; v<n; v++){
            if(color[v] != BLACK && M[u][v] != INFTY){
                if(d[v] > d[u] + M[u][v]){
                    d[v] = d[u] + M[u][v];
                    color[v] = GRAY;
                }
            }
        }
    }
    
    for(int i=0; i<n; i++){
        cout << i << " " << (d[i] == INFTY ? -1 : d[i]) << endl;
    }

}

int main(int argc, char const *argv[])
{
    cin >> n;
    for(int i=0; i<n; i++){
        for(int j=0; j<n; j++){
            M[i][j] = INFTY;
        }
    }

    int k, c, u,v;
    for(int i=0; i<n; i++){
        cin >> u >> k;
        for(int j=0; j<k; j++){
            cin >> v >> c;
            M[u][v] = c;
        }
    }

    dijkstra();

    return 0;
}



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

int f(int n, int c){
    int count = 0;
    for (int i = 1; i <= n; ++i) {
        if(c % i == 0) count++;
    }
    return count;
}
int main() {
    int a,b,c;
    cin >> a >> b >> c ;
    cout << f(b,c) - f(a-1,c) << endl;

    return 0;
}


Measured memory_bytes: 3096
#include<bits/stdc++.h>
#define pb emplace_back
using namespace std;
using ll = long long;
const int maxn = 300010;
signed main(){
	ios_base::sync_with_stdio(0), cin.tie(0);
	int a, b;
	cin >> a >> b;
	cout << (a <= b ? "unsafe" : "safe") << '\n';
}



Measured memory_bytes: 3640
#include<bits/stdc++.h>
#define ll                  long long
#define dl                 double
#define pb                push_back
#define F                  first
#define S                  second
#define endl              "\n"
#define rep(i,a,b)       for(i=a;i<b;i++)
#define all(v)             v.begin(),v.end()
#define allr(v)            v.rbegin(),v.rend()
#define mod              1000000007LL
#define CIN(V,s,n)      for(int i=s;i<n;i++){cin >> V[i];}
#define COUT(V,s,n)   {for(int i=s;i<n;i++){cout <<  V[i] << " "  ;} cout << endl;}
#define fast               ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define CLEAR(V);      for(ll i=0;i<V.size();i++) V[i] = 0;
#define N                  150
#define tmod             998244353LL
using namespace std;

bool sBs(const pair<int,int> &a,const pair<int,int> &b)
{   return (a.second < b.second);   }

ll SUMD(ll n);
ll BS(vector<pair< ll ,ll > > &PS,ll s,ll e,ll ser);
ll MI(ll a, ll m);
//bool P[N+1];
void Sieve(int n=N);
ll Powb(ll b,ll n,ll m);

int main()
{
fast;
ll q=1,t;
//cin >> q;
while(q--)
{
    ll i,j,n,m,k,l,r,a,b,c=0,d=0,e,g,p,q,u,v,w,x,y,flag=1;
    //n=m=k=i=j=l=r=a=b=c=d=u=v=w=p=x=y=0;
    string s; cin >> s;
    cout << (s=="ABC" ? "ARC":"ABC");
}
    return 0;
}

//*****************************************************************************************************************************************

ll Powb(ll b,ll n,ll m)
{
    if(n==0) return 1LL;
    if(n==1) return b;
    ll temp = Powb(b,n/2,m);
    if(n%2==0){return (temp*temp)%m;}
    else{return (b*((temp*temp)%m))%m;}
}

ll SUMD(ll n)
{   ll sum=0;
    while(n>0){sum += n%10;n = n/10;}
    return sum;

}
ll BS(vector<pair<ll,ll> > &PS,ll s,ll e,ll ser)
{
    if(s>e)
        return s;
    ll mid = (s+e)/2;
    if(PS[mid].F==ser)
    {
        return mid;
    }
    else if(PS[mid].F > ser)
    {
        return BS(PS,s,mid-1,ser);
    }
    else
        return BS(PS,mid+1,e,ser);
}
ll MI(ll a, ll m)
{
    ll m0 = m;
    ll y = 0, x = 1;
    if (m == 1)
      return 0;
    while (a > 1)
    {
        ll q = a / m;
        ll t = m;
        m = a % m, a = t;
        t = y;
        y = x - q * y;
        x = t;
    }
    if (x < 0)
       x += m0;
    return x;
}
/*
void Sieve(int n)
{
    memset(P,true,sizeof(P));
    P[0] = false;
    P[1]= false;
    for(ll i=2;i*i<=n;i++)
    {
        if(P[i])
        {
            for(ll j=i*i;j<=n;j+=i)
            {
                P[j]=false;
            }
        }
    }

}

*/


Measured memory_bytes: 3652
#include <iostream> 
#include <string> 
#include <vector> 
#include <cmath> 
#include <algorithm> 
#include <cstdlib> 
#include <ctime> 
#include <cstdio> 
#include <functional> 
#include <set> 
#include <sstream> 

using namespace std; 

#define MP make_pair

long gcd(long a, long b){ 

  if(a%b==0) return b; 
  else return gcd(b,a%b); 

} 

long lcm(long a, long b){ 
  return a*b/gcd(a,b); 
} 

int main(){

	while(1){

		int x,y,s;
		cin>>x>>y>>s;
		if(((x|y)|s)==0) break;

		int res=0;
		for(int a=1;a<s;a++){
			for(int b=1;b<s;b++){
				int vx=a*(100+x)/100 + b*(100+x)/100;
				int vy=a*(100+y)/100 + b*(100+y)/100;

				if(vx==s && res<vy) res=vy;
			}
		}
		cout<<res<<endl;
	}

	return 0;
}

Measured memory_bytes: 1160
line = input().split(" ")
a = list(map(int, line))
t = []
ans = 0
for i in range(0, a[0]):
    t.append(int(input()))
t.sort()
while len(t) > 0:
    if len(t) < a[1]:
        a[1]=len(t)
    if t[0] + a[2] > t[a[1] - 1]:
        ans += 1
        del t[0:a[1]]
    else:
        for i in range(0, a[1]):
            if t[i] > t[0] + a[2]:
                del t[0:i]
                ans += 1
                break
print(ans)

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

#define NOT_FOUND -1

using namespace std;

int n, q;
int S[100010];

int binary_Search(int A[], int key) {
    int left = 0;
    int right = n; // 0オリジンなのでrightは末尾の次を指していることに気をつける
    while (left < right) {
        int mid = (left + right) / 2;

        if (A[mid] == key) {
            return mid;
        }
        // 中央値が求める値より大きい
        else if (key < A[mid]) {
            // 中央値をrightに設定
            right = mid;
        }
        // 中央値が求める値より小さい
        else {
            // 中央値 + 1をleftに設定
            left = mid + 1;
        }
    }

    return NOT_FOUND;
}

int main(void) {
    cin >> n;
    for (int i = 0; i < n; ++i) {
        cin >> S[i];
    }

    cin >> q;
    int ans_len = 0;
    for (int i = 0; i < q; ++i) {
        int key;
        cin >> key;

        int result = binary_Search(S, key);
        if (result != NOT_FOUND) {
            ans_len++;
        }
    }

    cout << ans_len << endl;


    return 0;
}


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


int main(){
long long l,r,d;
cin>>l>>r>>d;
long long ans=0;
for(long long i=l;i<=r;i++){
  if(i%d==0){
    ans++;
  }
}
cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 3616
#include <iostream>

using namespace std;

int main()
{
    int n;
    cin>>n;
    int arr[n+5];

    int arr2[n+5];
    for(int i=1;i<=n;i++){
        cin>>arr[i];
    }
    int y;
    int ans=0;
        for(int i=1;i<=n;i++){
        cin>>y;
        ans+=y;
    }
    int a ,b;
    for(int i=1;i<=n-1;i++){
        cin>>arr2[i];
    }

    for(int i=1;i<n;i++){
        if(arr[i]+1==arr[i+1]){
            ans+=arr2[arr[i]];
        }
    }
    cout<<ans;

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>
#include<cmath>
#include<cstdio>
#include<tuple>
#include<bitset>
#include<map>

using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define ALL(x) x.begin(),x.end()
using ll = long long;
using lint = long long;
typedef pair<int,int> P;
const lint inf=1e18+7;
const int MOD=1000000007;
long long myPow(int x,int n,int rest){
    int res=1;
    int cur=x;
    while(n>0){
        if(n&1){
            res*=cur;
            res%=rest;
        }
        n/=2;cur*=cur;
        cur%=rest;
    }
    return res;
}
signed main(){
  int n,k;cin>>n>>k;
  string s;cin>>s;
  string rev_s=s;
  reverse(ALL(rev_s));
  s+=rev_s;
  vector<int> num(n*2,0);
  char mn='z'+1;
  rep(i,n)mn=min(mn,s[i]);
  if(k==1){
      string res;res+='z'+1;
      rep(i,n+1){
          string buf=s.substr(i,n);
          res=min(res,buf);
      }
      cout<<res<<"\n";
      return 0;
  }
  int cur=0;
  s+='.';
  int mx=-1;
  rep(i,n*2+1){
      if(cur==0){
          if(s[i]==mn)++cur;
          else continue;
      }
      else{
          if(s[i]==mn)++cur;
          else{
              num[i-1]=cur;
              mx=max(mx,cur);
              cur=0;
          }
      }
  }
  string res;res+='z'+1;
  string add;
  lint kazu=mx*myPow(2,k-1,MOD);
  if(k>=15)kazu=n+1;
  kazu=min(n+1,kazu);
  rep(i,kazu)add+=mn;
  for(int i=n-1;i<=2*n-1;++i){
      if(num[i]==mx){
          string buf=s.substr(i-(n-1),n);
          buf+=add;
          reverse(ALL(buf));
          string hoge=buf.substr(mx,n);
          res=min(res,hoge);
      }
  }
  cout<<res<<"\n";
  return 0;
}

Measured memory_bytes: 3736