akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define ll long long
#define double long double
#define rep(i,n) for(ll i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define mod (ll)(1e9+7)
#define inf (ll)(3e18+7)
#define pi (double) acos(-1)
#define P pair<int,int>
#define PiP pair<int,pair<int,int>>
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
using namespace std;

int fun(char c){
    if(c == 'r')return 0;
    if(c == 's')return 1;
    return 2;
}

int main() {
    int n, k, r, s, p;
    string t, ret=""; char WinC[3] = {'p', 'r', 's'};
    cin >> n >> k >> r >> s >> p >> t;
    int ans = 0, WinS[3] = {p, r, s};
    rep(i, n){
        if(i < k){
            ans += WinS[fun(t[i])];
            ret += WinC[fun(t[i])];
        }
        else{
            if(WinC[fun(t[i])] == ret[i-k])ret += "A";
            else{
               ans += WinS[fun(t[i])];
                ret += WinC[fun(t[i])]; 
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 640
n = int(input())
c = input()

ans = 0
l, r = 0, n-1
while True:
  while True:
    if c[l] == "W":
      break
    if l >= r:
      break
    l += 1
    
  while True:
    if c[r] == "R":
      break
    if l >= r:
      break
    r -= 1
  if l >= r:
    break
  ans += 1
  l += 1
  r -= 1
print(ans)

Measured memory_bytes: 9480
#include <vector>
#include <queue>
#include <algorithm>
#include <iostream>
#include <string>
#include <tuple>
#include <set>
#include <map>
#include <unordered_map>
#include <complex>
#include <iomanip>
#include <cmath>
using namespace std;
typedef long long ll;

int main()
{
  int a, ans = 1;
  cin >> a;
  if (a == 111) ans = 3;
  if (a == 110 || a == 101 || a == 11) ans = 2;
  if (a == 0) ans = 0;
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int dp[105][10005];
int main()
{
      int n,sum,a,b;
      cin >> n >> sum;
      for (int i = 0;i < n;i++)
      {
            cin >> a >> b;
            for (int j = 0;j<= sum;j++)
            {
            if(j>=b)
                  dp[i+1][j] = max(dp[i][j],dp[i][j-b]+a);
            else
                  dp[i+1][j] = dp[i][j];
            }
      }
      cout <<dp[n][sum]<<endl;

}

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

int main()
{
    int A,B;
    cin >> A >> B ;
    if (A > B && B!=1){
        cout << "Alice" ;}
    else if (B > A  && A!=1){
        cout <<"Bob" ;}
    else if (B == 1  && A!=1){
        cout <<"Bob" ;}
     else if (A==1  && B!=1){
        cout <<"Alice" ;}
    else {
        cout <<"Draw" ;}


           return 0;
}

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

int main() {

  vector<int> count(11);

  int A, B, C;
  cin >> A >> B >> C;
  
  count[A]++;
  count[B]++;
  count[C]++;

  if (count[5] == 2 && count[7] == 1) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()
#define SUM(a)  accumulate((a).begin(),(a).end(),0)
#define SORT(a) sort(ALL(a))
#define REV(a) reverse(ALL(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
typedef long long ll;
const int INF = 999999999;
const int MOD = (int)1e9 + 7;
const int EPS = 1e-9;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  string S;
  cin >> S;
  S[3] = '8';
  cout << S << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int (i) = 0; (i) < (int)(n); i++) 
#define FOR(i, a, b) for(int (i) = a; (i) < (int)b; i++)
#define RREP(i, n) for(int (i)=((int)(n)-1); (i)>=0; i--)
#define RFOR(i, a, b) for(int (i) =((int)(b)-1); (i)>=(int)a; i--)
#define ALL(v) (v).begin(),(v).end()
#define MOD 1000000007
#define FI first
#define SE second
#define MP make_pair
#define PB push_back
#define SZ(x)  (int)x.size()
#define SP(x)  setprecision((int)x)


using namespace std ;
typedef long long ll;
typedef vector<int> vint;
typedef vector<vint> vvint;
typedef vector<string> vstr;
typedef pair<int, int> pii;
const int INF = 1e9;
const ll LINF = 1e18;
const double EPS = 1e-9;
ll gcd(ll a, ll b) {return b ? gcd(b, a % b) : a;} //最大公約数
ll lcm(ll a, ll b) {return a / gcd(a, b) * b;} //最小公倍数


int main()
{
  int n ;
  cin >> n ;
  vector<pair<double,int>> num(n) ;
  double sum, ave ;
  sum = 0 ;
  double ans = INF ;
  double tmp ;
  
  REP(i,n){
    double a ;
    cin >> a ;
    sum += a ;
    num.at(i) = make_pair(a,i) ;
  }
  
  ave = sum/n ;
  
  REP(i,n){
    num.at(i).FI -= ave ;
  }
  
  REP(i,n){
    if(ans>abs(num.at(i).FI)){
      ans = abs(num.at(i).FI) ;
      tmp = num.at(i).SE ;
    }
  }
  
  cout << tmp <<endl;
    
  
  
    


  return 0 ;
}

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

using namespace std;

int main() {
    int n;
    int a, b;
    cin >> n;
    cin >> a >> b;
    int c1 = 0;
    int c2 = 0;
    int c3 = 0;
    while (n--) {
        int x;
        cin >> x;
        if (x <= a) {
            ++c1;
        } else if (x <= b) {
            ++c2;
        } else {
            ++c3;
        }
    }
    cout << min(c1, min(c2, c3)) << endl;
    return 0;
}

Measured memory_bytes: 256
import numpy as np

N = int(input())
h_list = np.array(list(map(int, input().split())))

def water_and_split(h_list):
    if h_list.shape[0] <= 2:
        counter = max(h_list)
    else:
        if np.argmin(h_list) == 0:
            counter = min(h_list)
            counter += water_and_split(h_list[1:]-min(h_list))
        elif np.argmin(h_list) == h_list.shape[0]-1:
            counter = min(h_list)
            counter += water_and_split(h_list[:-1]-min(h_list))
        else:
            counter = min(h_list)
            min_idx = np.argmin(h_list)
            counter += water_and_split(h_list[:min_idx]-min(h_list)) + water_and_split(h_list[min_idx+1:]-min(h_list))
    return counter

count = water_and_split(h_list)
print(count)


Measured memory_bytes: 12512
import math
a,b=map(int,input().split())
c=list(map(int,input().split()))
d=list(map(int,input().split()))
c.sort()
d.sort(reverse=True)
e=[0 for i in range(a)]
for i in range(a):
  e[i]=c[i]*d[i]
def s(e,x):
  k=0
  for i in range(a):
    if e[i]<x:
      continue
    else:
      k+=math.ceil((e[i]-x)/d[i])
  if k>b:
    return False
  else:
    return True
    
left=0
right=max(e)
while left!=right:
  mid=(left+right)//2
  if s(e,mid):
    right=mid
  else:
    left=mid+1
print(left)

Measured memory_bytes: 119756
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define VV vector
#define pb push_back
#define bitc  __builtin_popcountl
#define m_p make_pair
#define inf 200000000000000
#define MAXN 1000001
#define eps 0.0000000001
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
string char_to_str(char c){string tem(1,c);return tem;}
// string to integer stoi()
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();

//////////////

#define S second
#define F first
#define int long long  

///////////// 

signed main()
{
	fastio;
	#ifdef ANIKET_GOYAL
		freopen("inputf.in","r",stdin);
		freopen("outputf.in","w",stdout);
	#endif
	int n,w;
	cin>>n>>w;
	int v[100001]={};
	for(int i=0;i<=100000;++i)
		v[i]=inf;
	v[0]=0;
	for(int i=0;i<n;++i)
	{
		int we,ha;
		cin>>we>>ha;
		for(int j=100000;j-ha>=0;--j)
		{
			v[j]=min(v[j],v[j-ha]+we);
		}
	}
	int ans=0;
	for(int i=0;i<=100000;++i)
	{
		if(v[i]<=w)
			ans=i;
	}
	cout<<ans;
}

Measured memory_bytes: 1024
import sys


def solve(K: int, A: int, B: int):

    n = B // K

    if K*n >= A:
        print("OK")
    else:
        print("NG")

    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    K = int(next(tokens))  # type: int
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    solve(K, A, B)

if __name__ == '__main__':
    main()


Measured memory_bytes: 9196
import java.util.Scanner;

public class Main {

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

        final String S = sc.next();

        if (S.indexOf("A") >= 0 && S.indexOf("B") >= 0) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}


Measured memory_bytes: 21588
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll MOD=(ll)1e9+7;

int main() {
    int N,K; cin>>N>>K;
    vector<int> a(N);

    for (int i = 0; i < N; ++i) {
        cin>>a[i];
    }
    ll ans=0ll;
    for (int i = 0; i < N; ++i) {
        for (int j = 0; j < i; ++j) {
            if(a[i]>a[j]){
                (ans+=(ll)K*(K-1)/2)%=MOD;
            }
        }

        for (int j = i+1; j < N; ++j) {
            if(a[i]>a[j]){
                (ans+=(ll)K*(K+1)/2)%=MOD;
            }
        }

    }

    cout<<ans<<endl;

    return 0;
}


Measured memory_bytes: 256
import bisect,collections,copy,heapq,itertools,math,string
import sys
def I():
    #1 line 1 int
     return int(sys.stdin.readline().rstrip())
def LI():
    #1 line n int
     return list(map(int,sys.stdin.readline().rstrip().split()))
def S():
    #1 line 1 string
     return sys.stdin.readline().rstrip()
def LS():
    #1 line n strings
     return list(sys.stdin.readline().rstrip().split())

x=S()
count=0
for s in x:
    if s == "1":
        count += 1
        
print(count)

Measured memory_bytes: 9964
#include <bits/stdc++.h>
using namespace std;
 
#define REP(i,n) for (int i=0,_n=(int)(n); i < _n; i++)
template<class T> bool chmax(T &a, T b) { return a < b ? (a = b, true) : false; }
template<class T> bool chmin(T &a, T b) { return a > b ? (a = b, true) : false; }
 
typedef long long ll;

int main2() {
  int N;
  scanf("%d", &N);

  int e = 0, o = 0;
  REP(i, N) {
    int A;
    scanf("%d", &A);
    if (A % 2 == 1) o++; else e++;
  }
  if (o % 2 == 1) cout << "NO" << endl;
  else cout << "YES" << endl;

  return 0;
}

int main() {
  for (;!cin.eof();cin>>ws) main2();
  return 0;
}

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

int main(){
	int n, i;
	cin >> n;
	vector<int> t(n+1);
	vector<int> x(n+1);
	vector<int> y(n+1);
	t[0] = x[0] = y[0] = 0;
	for(int i=1; i<n+1; ++i) cin >> t[i] >> x[i] >> y[i];
	for(int i=1; i<n+1; ++i){
		int necessaryTime = abs(x[i]-x[i-1]) + abs(y[i]-y[i-1]);
		bool isOdd = necessaryTime%2;
		if( t[i]-t[i-1] < necessaryTime ){
			cout << "No" << endl;
			return 0;
		}
		if( isOdd != (t[i]-t[i-1])%2 ){
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 1408
import sys
# import re
import math
import collections
# import decimal
import bisect
import itertools
import fractions
# import functools
import copy
# import heapq
import decimal
# import statistics
import queue

# import numpy as np

sys.setrecursionlimit(10000001)
INF = 10 ** 16
MOD = 10 ** 9 + 7
# MOD = 998244353

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))


# ===CODE===

def main():
    s =input()
    t=input()
    
    ans=0
    for i in range(len(s)):
        if s[i] != t[i]:
            ans+=1
    
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 11096
//{{{
#include<algorithm>
#include<cmath>
#include<deque>
#include<fstream>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<random>
#include<set>
#include<sstream>
#include<sys/time.h>
#include<unordered_map>
#include<unordered_set>
#include<vector>
using ll = long long;
enum : int { M = (int)1e9 + 7 };
enum : ll { MLL = (ll)1e18L + 9 };
using namespace std;
#ifdef LOCAL
#include"rprint2.hpp"
#else
#define FUNC(name) template <ostream& out = cout, class... T> void name(T&&...){ }
FUNC(printde) FUNC(printdbe) FUNC(printdwe) FUNC(printdu);
#endif
template <template <class T, class = std::allocator<T>> class V, class E>
istream& operator >> (istream& in, V<E>& v){ for(auto& e : v){ in >> e; } return in; }
//}}}

int main(){
    cin.tie(0); ios::sync_with_stdio(false);
    int x, y;
    cin >> x >> y;
    cout << (x == 1 ? 300000 : x == 2 ? 200000 : x == 3 ? 100000 : 0)
        + (y == 1 ? 300000 : y == 2 ? 200000 : y == 3 ? 100000 : 0)
        + (x + y == 2 ? 400000 : 0) << '\n';
}


Measured memory_bytes: 888
def main(N):
    m = {'AC': 0, 'WA': 0, 'TLE': 0, 'RE': 0}
    for i in range(N):
        m[input()] += 1
    return m


if __name__ == "__main__":
    N = int(input())
    m = main(N)
    print("AC x {}".format(m["AC"]))
    print("WA x {}".format(m["WA"]))
    print("TLE x {}".format(m["TLE"]))
    print("RE x {}".format(m["RE"]))


Measured memory_bytes: 9176
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define int long long
#define mp make_pair
#define endl "\n"
#define pii pair<int,int> 
#define ff first
#define ss second
#define mii map<int,int>
#define si set<int>
#define sti stack<int>
#define qi queue<int>
#define vi vector<int>
#define pq priority_queue<int>
#define vvi vector<vi>
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
const int M=1e9+7;
vvi vec;
vvi mul(vvi &v1,vvi &v2){
    int n=v1.size();
    int k=v2.size();
    int m=v2[0].size();
    vvi v;
    v.resize(n);
    for(int i=0;i<v.size();i++){
        v[i].resize(m);
    }
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
            int sum=0;
            for(int l=0;l<k;l++){
                sum=(sum+(v1[i][l]%M*v2[l][j]%M)%M)%M;
            }
            v[i][j]=sum;
        }
    }
    return(v);
}

vvi power(vvi &v,int x){
    if(x==0) return(vec);
    vvi p=power(v,x/2);
    p=mul(p,p);
    if(x%2==0) return(p);
    return(mul(v,p));
}


int32_t main(){
    IOS;
    int n,k;
    cin>>n>>k;
    vvi mat;
    mat.resize(n);
    for(int i=0;i<n;i++){
    	mat[i].resize(n);
    	for(int j=0;j<n;j++){
    		cin>>mat[i][j];
    	}
    }
    vec.resize(n);
    for(int i=0;i<n;i++){
    	vec[i].resize(n);
    	vec[i][i]=1;
    }
    vvi v=power(mat,k);
    vvi V;
    V.resize(1);
    for(int i=0;i<n;i++){
    	V[0].pb(1);
    }
    V=mul(V,v);
    int ans=0;
    for(int i=0;i<n;i++){
    	ans=(ans+V[0][i])%M;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
#include <iomanip>
#define ll long long int
#define ld long double
#define IOS cin.tie(NULL);cout.tie(NULL)
#define f first
#define inf 100000000000000000
#define ii pair<ll,ll>
#define vi vector<ll>
#define vii vector<ii>
#define MS0(x) memset(x,0,sizeof(x))
#define MS1(x) memset(x,-1,sizeof(x))
#define sc(i) scanf("%lld",&i);
#define s second
#define pb push_back
#define forn(i,n) for(int i=0;i<(int)n;i++)
using namespace std;
ll const mod=1000000007;
 
// ll arr1[1000009];
// ll parent[1000009];
// set<ll> st;
// void sievefun(ll n){
//     for(ll i=2;i<=n;i++){
//         if(arr1[i]==0){
//                parent[i]=i;
//             for(ll j=i*i;j<=n;j+=i){
//             	if(arr1[j]==0)parent[j]=i;
//                 arr1[j]=1;
//             }
//         }
//     }
//     for(int i=2;i<=n;i++){
//     	if(arr1[i]==0)st.insert(i);
//     }
// }
 
ll countDivisors(ll n)
{
    ll cnt = 0;
    for (ll i = 1; i <= sqrt(n); i++) {
        if (n % i == 0) {
            // If divisors are equal,
            // count only one
            if (n / i == i)
                cnt++;
 
            else // Otherwise count both
                cnt = cnt + 2;
        }
    }
    return cnt;
}
ll power(ll x, ll y) {
	ll temp;
	if( y == 0)
		return 1;
	temp = power(x, y/2)%mod;
	if (y%2 == 0)
		return ((temp)*(temp))%mod;
	else
		return (((x))*((temp*temp)%mod))%mod;
}
ll gcd1(ll a, ll b){
if (a == 0)
    return b;
return gcd1(b % a, a);
}
ll lcm(ll a, ll b)
{
return (a*b)/gcd1(a, b);
}
ll dp[409][409];
ll arr[409];
ll val[409][409];
void fun(ll l,ll r){
	if(dp[l][r]!=-1)return ;
	ll ans=inf;
	for(int i=l;i<r;i++){
		fun(l,i);
		fun(i+1,r);
		if(ans>val[l][i]+val[i+1][r]+dp[l][i]+dp[i+1][r]){
			dp[l][r]=dp[l][i]+dp[i+1][r];
		}
		ans=min(ans,val[l][i]+val[i+1][r]+dp[l][i]+dp[i+1][r]);
	}
	val[l][r]=ans;
}
int main()
{	//sievefun(100000);
	//ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	ll n;
	ll x;
	cin>>n;
	forn(i,n){
		cin>>arr[i+1];
	}
	forn(i,n+1){
		forn(j,n+1){
			dp[i][j]=-1;
			val[i][j]=-1;
		}
	}
	for(int i=1;i<=n;i++){
		if(i<n)
			dp[i][i+1]=val[i][i+1]=arr[i]+arr[i+1];
		dp[i][i]=arr[i];
		val[i][i]=0;
	}
	fun(1,n);
	cout<<val[1][n];
}

Measured memory_bytes: 2816
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define lvector vector<ll> 
typedef pair<ll,ll> P;
#define rep(i,n) for(ll (i)=0; i<(n); ++(i))
#define print(a) cout << (a) << endl

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  ll n,sum=0;cin>>n;
  lvector a(n,0),ans(n,0);rep(i,n) {cin>>a[i];sum+=a[i];}
  ans[0]+=sum;
  for(ll i=1;2*i-1<n;++i) ans[0]-=2*a[2*i-1];
  for(ll i=1;i<n;++i) ans[i]=2*a[i-1]-ans[i-1];
  rep(i,n) printf("%lld ",ans[i]);
  return 0;
}


Measured memory_bytes: 2944
import java.util.Scanner;

public class Main{

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int X = sc.nextInt();
        int T = sc.nextInt();
        
        if(N % X != 0)
        	System.out.println((N / X + 1) * T);
        else
        	System.out.println((N / X) * T);
        /*
        if((N - (N / X) * T) > 0)
            System.out.println(((N / X) + 1) * T);
        else {
            System.out.println((N / X) * T);
        }
        */

    }

}


Measured memory_bytes: 35596
s = list(input())

i = 0
j = len(s) - 1
ans = 0
while(i <= j):
    if s[i] == s[j]:
        i += 1
        j -= 1
        continue
    else:
        if s[i] == "x":
            i += 1
            ans += 1
            continue
        elif s[j] == "x":
            j -= 1
            ans += 1
            continue
        else:
            ans = -1
            break

print(ans)


Measured memory_bytes: 4084
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#define MOD 1000000007
using namespace std;

typedef pair<int, int> P;

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

Measured memory_bytes: 256
sx,sy,tx,ty = map(int, input().split())
dx = tx-sx
dy = ty- sy
path = []
path.append('L')
path.append('U'*(dy+1))
path.append('R'*(dx+1))
path.append('D'*(dy+1))
path.append('L'*dx)
path.append('D')
path.append('R'*(dx+1))
path.append('U'*(dy+1))
path.append('L'*(dx+1))
path.append('D'*dy)
print(''.join(path))

Measured memory_bytes: 3064
from heapq import heappop, heappush
import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline


phi = lambda city, silver: city * 2501 + silver
psi = lambda x: (x//2501, x % 2501)


n, m, s = map(int, input().split())
g = [[] for _ in range(n*2501+1)]

for i in range(m):
    u, v, a, b = map(int, input().split())
    for j in range(2501):
        if j-a >= 0:
            g[phi(u-1, j)].append((phi(v-1, j-a), b))
            g[phi(v-1, j)].append((phi(u-1, j-a), b))

for i in range(n):
    c, d = map(int, input().split())
    for j in range(2501):
        if j + c <= 2500:
            g[phi(i, j)].append((phi(i, j+c), d))


def dijkstra(s, n, g):
    # g[i][j] : the cost of i→j  or g[i] = [(target, cost), ...]
    # must import heapq
    # sys.stdin.readline is recommended
    d = [10**18] * n
    d[s] = 0
    q = [(0, s)]
    while q:
        dist_u, u = heappop(q)
        if d[u] < dist_u:
            continue
        for v, c in g[u]:  # 'in g[u]' if g is an adj list.
            if d[v] > dist_u + c:
                d[v] = dist_u + c
                heappush(q, (d[v], v))
    return d


s = min(s, 2500)
d = dijkstra(phi(0, s), n*2501+1, g)

for i in range(1, n):
    print(min(d[phi(i, 0):phi(i+1, 0)]))
    

Measured memory_bytes: 113932
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define repl(i,s,n) for(int i=s; i<=n; ++i)
#define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
#if defined(_MSC_VER) || __cplusplus > 199711L
#define aut(r,v) auto r = (v)
#else
#define aut(r,v) __typeof(v) r = (v)
#endif
#define each(it,o) for(aut(it, (o).begin()); it != (o).end(); ++ it)
#define ktya(x) sort(all(x))
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define all(aa) (aa).begin(), (aa).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset(m,v,sizeof(m))
#define INF 1e18
#define INFLL 1000000000000000007LL
#define SIZE 200105
#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define mind(a,b) (a>b?b:a)
#define maxd(a,b) (a>b?a:b)
#define PI (acos(-1))
typedef vector<int> vi; typedef pair<int, int> pii; typedef vector<pair<int, int> > vpii; typedef long long ll;
typedef pair<int,ll> pill; typedef pair<ll,int> plli; 
typedef pair<double, int> pdi;
template<typename T, typename U> inline void amin(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> inline void amax(T &x, U y) { if(x < y) x = y; }
typedef complex<double> P;
typedef pair<pill,int> PA;
//ll MOD;
//ll MOD = 1000000007;
ll MOD=998244353;
typedef ll Weight;
struct Edge {
	int src, dst;
	ll weight;
};


int N,M;
string str;
int seq[1145141];
int main(){
	std::cin.tie(nullptr);
	std::ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);
	cin>>N;
	cin>>str;
	int a=0,b=0,c=0;
	int ans=0;
	rep(i,N-1){
		int x=str[i]-'0';
		int nex=str[i+1]-'0';
		seq[i]=abs(nex-x);
	}
	int ans2=0;
	rep(i,N-1){
		int x=seq[i];
		if(x==1){
			b++;
			if((i|(N-2))==N-2)ans=1-ans;
		}else if(x==2){
			c++;
			if((i|(N-2))==N-2)ans2=1-ans2;
		}else{
			a++;
		}
	}
	if(b==0){
		cout<<ans2*2<<endl;
	}else{
		cout<<ans<<endl;
	}
}

Measured memory_bytes: 5404
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const long long X=1000000000+7;  

int main() {
  long long a,b,x;
  cin>>a>>b>>x;
  long long ans=b/x-a/x;
  if(a%x==0) ans++;
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
#include <stack>
#include <set>
using namespace std;
#define fast_io ios_base::sync_with_stdio (false) ; cin.tie(0) ; cout.tie(0) ;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define INF (int)(1123456789)
#define LINF (long long int)(112345678901234567)
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define all(v) v.begin(), v.end()

typedef pair<int, int> Pii;
typedef pair<ll, ll> Pll;

const int N = (int)3e5;

ll mpow(ll a, ll b){
  if(b==0) return 1;
  else if(b%2==0){ll memo = mpow(a,b/2); return memo*memo%MOD;}
  else return mpow(a,b-1) * a % MOD;
}
ll lpow(ll a, ll b){
  if(b==0) return 1;
  else if(b%2==0){ll memo = lpow(a,b/2); return memo*memo;}
  else return lpow(a,b-1) * a;
}
ll gcd(ll a, ll b){
  if(b==0) return a;
  else return gcd(b, a%b);
}
vector<ll> kaijo_memo;
ll kaijo(ll n){
  if(kaijo_memo.size() > n) return kaijo_memo[n];
  if(kaijo_memo.size() == 0) kaijo_memo.push_back(1);
  while(kaijo_memo.size() <= n) kaijo_memo.push_back(kaijo_memo[kaijo_memo.size()-1] * kaijo_memo.size() % MOD);
  return kaijo_memo[n];
}
vector<ll> gyaku_kaijo_memo;
ll gyaku_kaijo(ll n){
  if(gyaku_kaijo_memo.size() > n) return gyaku_kaijo_memo[n];
  if(gyaku_kaijo_memo.size() == 0) gyaku_kaijo_memo.push_back(1);
  while(gyaku_kaijo_memo.size() <= n) gyaku_kaijo_memo.push_back(gyaku_kaijo_memo[gyaku_kaijo_memo.size()-1] * mpow(gyaku_kaijo_memo.size(), MOD-2) % MOD);
  return gyaku_kaijo_memo[n];
}

ll nCr(ll n, ll r){
  if(n == r) return 1;//0個の丸と-1個の棒みたいな時に時に効く？不安.
  if(n < r || r < 0) return 0;
  ll ret = 1;
  ret *= kaijo(n); ret %= MOD;
  ret *= gyaku_kaijo(r); ret %= MOD;
  ret *= gyaku_kaijo(n-r); ret %= MOD;
  return ret;
}

int main(void){
  fast_io
  
  ll n;cin>>n;
  vector<ll> X(1+n), E(2*n+3);
  rep(i,n){
    cin>>X[i];
  }

  E[0] = 0;
  reps(i,n+1){
    E[i] = E[i-1] + mpow(i, MOD-2);
    E[i] %= MOD;
  }

  ll ans = 0;
  reps(i,n-1){
    ll dist = X[i] - X[i-1];
    ans += (E[i] * dist) % MOD;
    ans %= MOD;
  }

  reps(i,n-1){
    ans *= i;
    ans %= MOD;
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 2560
H,W,M = map(int,input().split())
T = [0] * M
H_cnt = {}
W_cnt = {}
HW = {}
for i in range(M):
    h,w = map(int,input().split())
    if not h in H_cnt:
        H_cnt[h] = 0
    if not w in W_cnt:
        W_cnt[w] = 0
    H_cnt[h] += 1
    W_cnt[w] += 1
    HW[(h,w)] = 1

HL = [[h,cnt] for h,cnt in H_cnt.items()]
WL = [[w,cnt] for w,cnt in W_cnt.items()]

HL.sort(key=lambda x: x[1],reverse=True)
WL.sort(key=lambda x: x[1],reverse=True)

HS = {}
max_cnth = 0
for h,cnt in HL:
    if max_cnth<=cnt:
        HS[h] = cnt
        max_cnth = max(max_cnth,cnt)
        continue
    break

WS = {}
max_cntw = 0
for w,cnt in WL:
    if max_cntw<=cnt:
        WS[w] = cnt
        max_cntw = max(max_cntw,cnt)
        continue
    break

cnt = 0
ans = 0

# ここの判定を高速にする
cross_cnt = 0
for hw in HW.keys():
    h,w = hw
    if h in HS and w in WS:
        cross_cnt+=1
if len(WS) * len(HS)==cross_cnt:
    print(max_cnth+max_cntw-1)
    exit()
print(max_cnth+max_cntw)



Measured memory_bytes: 163096
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <functional>
#include <bitset>
#include <numeric>
#include <complex>
#include <cassert>
#include <random>


int main() {
	int n; std::cin >> n;
	std::vector<int> a(n);
	for (int i = 0; i < n; i++) std::cin >> a[i];
	int ans = 0;
	for (int i = 0; i < n; i++) {
		for (int j = i + 1; j < n; j++) {
			ans += a[i] * a[j];
		}
	}
	std::cout << ans << std::endl;
	return 0;
}


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

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

  int cnt = 0;
  string tmp;
  cin >> tmp;

  if(tmp == "ooo") cnt = 3;
  else if(tmp == "oox" || tmp == "oxo" || tmp == "xoo") cnt = 2;
  else if(tmp == "xxx") cnt = 0;
  else cnt = 1;

  cout << 700 + 100 * cnt << endl;


}

Measured memory_bytes: 256
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <regex>
#define REP(i,n) for(int i = 0; i < n; i++)
#define FOR(i,j,n) for(int i = j; i < n; i++)
#define RFOR(i,j,n) for(int i = j-1; i >= n; i--)
#define PREC(n) fixed << setprecision(n)
#define print_array(v) REP(__k, v.size()) { cout << v[__k]; if(__k != v.size()-1) cout << " "; else cout << endl; }
#define YesorNo(a) printf(a?"Yes\n":"No\n")
#define _LIBCPP_DEBUG 0
using namespace std;
int64_t MOD = 1000000007;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a, b, c, d, e, k;
  cin >> a >> b >> c >> d >> e >> k;
  int maxi = max({a,b,c,d,e});
  int mini = min({a,b,c,d,e});
  cout << (maxi - mini > k ? ":(" : "Yay!") << endl;
  return 0;
}
//templete by private_yusuke

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

int main(){
	int h, w;
	
	for (;;){
		cin >> h >> w;
		if ( h == 0 && w == 0 ) break;
		for ( int i = 0; i < h; i++ ){
			for ( int j = 0; j < w; j++ ){
				cout << "#";
			}
		cout << endl;
		}
	cout << endl;
	}
return 0;
}


Measured memory_bytes: 3088
#include <bits/stdc++.h>
using namespace std;
bool s(int key,int A[],int n){
	for(int i=0;i<n;i++)
		if(A[i]==key) return 1;
	return 0;
}

int main(){
	int n,q,ans=0;
	int N[10000],Q[500];
	scanf("%d",&n);
	for(int i=0;i<n;i++)
		scanf("%d",&N[i]);
	scanf("%d",&q);
	for(int i=0;i<q;i++){
		scanf("%d",&Q[i]);
		if(s(Q[i],N,n)) ans++;
	}
	printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 3220
#define _USE_MATH_DEFINES
#include <iostream>
#include <memory>
#include <memory.h>
#include <fstream>
#include <cmath>
#include <math.h>
#include <numeric>
#include <vector>
#include <stack>
#include <string>
#include <queue>
#include <sstream>
#include <cstdlib>
#include <cassert>
#include <cstdio>
#include <map>
#include <iomanip>
#include <list>
#include <cctype>
#include <algorithm>
#include <complex>

#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, m, n) for(int i = m; i < n; i++)
using namespace std;

typedef complex<double> xy_t;
typedef pair<xy_t, xy_t> line;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<double, double> Pd;
typedef pair<int, P> PP;
typedef pair<int, PP> PPP;
const int INF = 1 << 29;
const double EPS = 1E-10;

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

int dp[51][4000];
const int mod = 100000;

int main(){
	int N, M, S;
	while(cin >> N >> M >> S && (N || M || S)){
		N = N * N;
		memset(dp, 0, sizeof(dp));
		dp[N][0] = 1;
		for(int i = 1; i <= M; i++){
			for(int j = 0; j <= N; j++){
				for(int s = S; s >= 0; s--){
					int c = dp[j][s];
					if(s - i >= 0) c += dp[j+1][s-i];
					dp[j][s] = c % mod;
				}
			}
		}
		cout << dp[0][S] << endl;
	}
	return 0;
}

Measured memory_bytes: 1664
//
//  atcoder.cpp
//
//
///
#include <bits/stdc++.h>
#include <boost/optional.hpp>
#include <boost/range/irange.hpp>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/bimap/bimap.hpp>
#include <boost/bimap/multiset_of.hpp>
#include <boost/multi_array.hpp>
#include <boost/math/common_factor.hpp>
#include <boost/algorithm/string.hpp>

#define REP(i, N) for(int i=0; i<(N); i++)
#define REC(f, ...) (void)0; const auto f = [&](const auto f, __VA_ARGS__)
using namespace std;
using namespace boost::math;

using ll = long long;
namespace bst = boost;
template<typename T> class in {
    T value;
public:
    in() { cin >> value; }
    operator const T&() const { return value; }
    operator T&() { return value; }
    in& operator=(T source) { value = source; return *this; }
};
template<> class in<string> : public string {
public:
    in() { cin >> *this; }
};
template<class T> class inseq : public T {
public:
    template<typename... Arg> inseq(Arg... arg) : T(forward<Arg>(arg)...) { for (auto&& i : *this) cin >> i; }
};
template<class T> using invec = inseq<vector<T>>;

auto solve() {
  in<string> S;
  if (S.length() % 2)
    return "No";
  
  for(int i = 0; i < S.length(); i += 2){
    if (S[i] != 'h' || S[i+1] != 'i')
      return "No";
  }


  return "Yes";
}

template<typename T> void plot(const T& func) { cout << func() << endl; }
template<> void plot<void()>(void(&func)()) { func(); }
template<> void plot<double()>(double(&func)()) { cout << setprecision(9) << func() << endl; }

int main() {
  plot(solve);

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<map>
#include<stack>
#define FOR(i,a,b) for(int i=(a); i<int(b); ++i)
#define RFOR(i,a,b) for(int i=(b)-1; i>=int(a); --i)
#define rep(i,n) FOR(i,0,n)
#define rep1(i,n) FOR(i,1,int(n)+1)
#define rrep(i, n) RFOR(i, 0, n)
#define rrep1(i, n) RFOR(i, 1, int(n) + 1)
#define all(c) begin(c), end(c)
#define al(d) d.begin(),d.end()
using namespace std;
template <typename T>
void putv(vector<T>& V){
	// cout << "The elements in the vector are: " << endl;
	for(auto x: V)
		cout << x << " ";
	cout << endl;
}
template <class T>
vector<T> getv(int n){
	vector<T> vec;
	rep(i,n){
		T input;
		cin >> input;
		vec.emplace_back(input);
	}
	return vec;
}
using AdjList = vector<vector<int>>;
using Weight = int;
using Flow = int;
struct Edge {
	int src, dst;
	Weight weight;
	Flow cap;
	Edge() : src(0), dst(0), weight(0) {}
	Edge(int s, int d, Weight w) : src(s), dst(d), weight(w) {}
};
using Edges = std::vector<Edge>;
using Graph = std::vector<Edges>;
using Array = std::vector<Weight>;
using Matrix = std::vector<Array>;

void add_edge(Graph &g, int a, int b, Weight w = 1) {
	g[a].emplace_back(a, b, w);
	g[b].emplace_back(b, a, w);
}
void add_arc(Graph &g, int a, int b, Weight w = 1) { g[a].emplace_back(a, b, w); }

// Recieve edge(=(int,int)) as an adj list.
vector<vector<int>> getadj(int N, int M){
	// Initialize all lists of the graph as a empty vector.
	vector<int> init;
	vector<vector<int>> graph(N,init);

	rep(i,M){
		int a, b;
		cin >> a >> b;
		graph[a-1].emplace_back(b-1);
		graph[b-1].emplace_back(a-1);
	}
// rep(i,N)
// 	putv(graph[i]);
	return graph;
}

#include<iostream>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<string>
#include<set>
#include<map>
using namespace std;
long long Manhattan_dist(long long x1, long long y1, long long x2, long long y2){return abs(x1-x2) + abs(y1-y2);}

int main(){
	string A,B;
	cin >> A>>B;
	// string strA = to_string(A);
	// string strB = to_string(B);

	int lenA,lenB;
	lenA = A.length();
	lenB = B.length();
	// cout << A << " " << B << endl;
	// cout << lenA << ' ' << lenB << endl;
	if(lenA>lenB){
		cout << "GREATER" << endl;
		return 0;
	}else if(lenA < lenB){
		cout << "LESS" << endl;
		return 0;
	}else{
		rep(i,lenA)
			if(A[i] > B[i]){
				cout << "GREATER" << endl;
				return 0;
			}else if(A[i] < B[i]){
				cout << "LESS" << endl;
				return 0;
			}
	}
	cout << "EQUAL" << 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++)

int main(){
  int n;
  cin >> n;
  vector<int> a(n), b(n), c(n);
  REP(i, n){
    int x;
    cin >> x;
    a[i] = x - 1;
  }
  REP(i, n) cin >> b[i];
  REP(i, n - 1) cin >> c[i];
  int q = -999;
  int r = 0;
  REP(i, n){
    int x = a[i];
    r += b[x];
    if(x == q + 1) r += c[q];
    q = x;
  }
  cout << r << endl;
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>

int main(void)
{
  int n;
  char s[1000];
  scanf("%d %s", &n, s);
  
  if(strncmp(s, s+n/2, n/2) == 0 && n%2==0)
    puts("Yes");
  else
    puts("No");
  
  return 0;
}

Measured memory_bytes: 128
import std.stdio;
import std.conv;
import std.cstream;
import std.string;
import std.algorithm;

int Map[20][20];
int ms,wp;

int[] dx3 = [0,1,2,1,1,0,0,0,0,-1,-2,-1,-1];
int[] dy3 = [0,0,0,-1,1,-1,-2,1,2,0,0,1,-1];

int[] dx2 = [0,-1,-1,0,1,1,1,0,-1];
int[] dy2 = [0,0,-1,-1,-1,0,1,1,1];

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


void main(){
int x,y,size;
for(int i;i<20;i++)for(int j;j<20;j++)Map[i][j]=0;
wp = 100;


while(scanf("%d,%d,%d",&x,&y,&size) != EOF){
//while(!din.eof()){
//char[] op = din.readLine();
/+
x = to!(int)(op[0])-'0';
y = to!(int)(op[2])-'0';
size = to!(int)(op[4])-'0';
/+printf("%d %d %d\n",x,y,size);+/
+/

transaction(x,y,size);

}
/+
for(int i;i<10;i++){
for(int j;j<10;j++){
printf("%d ",Map[i][j]);
}
printf("\n");
}
+/

printf("%d\n%d\n",wp,ms);

}

void transaction(int x,int y,int size){
if(size == 3){
for(int i;i<dx3.length;i++){
if(0<=y+dy3[i] && y+dy3[i]<10 && 0<=x+dx3[i] && x+dx3[i] < 10){
if(Map[y+dy3[i]][x+dx3[i]] == 0)wp--;
Map[y+dy3[i]][x+dx3[i]]+=1;
if(ms < Map[y+dy3[i]][x+dx3[i]])ms = Map[y+dy3[i]][x+dx3[i]];
}
}
}
else if(size == 2){
for(int i;i<dx2.length;i++){
if(0<=y+dy2[i] && y+dy2[i]<10 && 0<=x+dx2[i] && x+dx2[i] < 10){
if(Map[y+dy2[i]][x+dx2[i]] == 0)wp--;
Map[y+dy2[i]][x+dx2[i]]+=1;
if(ms < Map[y+dy2[i]][x+dx2[i]])ms = Map[y+dy2[i]][x+dx2[i]];
}
}
}else{
for(int i;i<dx.length;i++){
if(0<=y+dy[i] && y+dy[i]<10 && 0<=x+dx[i] && x+dx[i] < 10){
if(Map[y+dy[i]][x+dx[i]] == 0)wp--;
Map[y+dy[i]][x+dx[i]]+=1;
if(ms < Map[y+dy[i]][x+dx[i]])ms = Map[y+dy[i]][x+dx[i]];
}
}

}


}

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

int main(void)
{
    int n;
    cin >> n;
    vector<vector<int>> d(n, vector<int>(2));
    rep(i, n) rep(j, 2) cin >> d[i][j];
    int res = 0;
    rep(i, n)
    {
        if (d[i][0] == d[i][1])
            res++;
        else
            res = 0;
        if (res == 3)
        {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
}


Measured memory_bytes: 3632
import java.util.Scanner;

public class Main {

	private static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		String a = sc.next(), b = sc.next(), c = sc.next();
		System.out.println(("" + a.charAt(0) + b.charAt(0) + c.charAt(0)).toUpperCase());
	}
}

Measured memory_bytes: 21844
n=int(input())
a=list(map(int,input().split()))
cnt=0
ans=0
b=[]
for i in range(n):
  if a[i]<0:
    cnt+=1
    b.append(-a[i])
  else:
    b.append(a[i])
b.sort()
b.reverse()

if cnt%2==1:
  for i in range(n-1):
    ans+=b[i]
  ans-=b[n-1]
else:
  for i in range(n):
    ans+=b[i]
print(ans)


Measured memory_bytes: 14212
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int main() {
    string s;
    cin >> s;
    string ans;
    for(int i=0; i<s.size(); i++){
        if (i%2 == 0)ans += s.at(i);
    }
    cout << ans << endl;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
#define    ll          unsigned long long int
#define    sz          200010
#define    md          1000000007
#define    py          printf("YES\n")
#define    pn          printf("NO\n")
#define    sc1(a)      scanf("%lld",&a)
#define    sc2(a,b)    scanf("%lld %lld",&a,&b)
#define    pv(a)      printf("%lld\n",a)

using namespace std;

map<string,string>mp;

int main()
{

     mp["Sunny"]="Cloudy";
     mp["Cloudy"]="Rainy";
     mp["Rainy"]="Sunny";
     string s;

     cin>>s;
     cout<<mp[s]<<endl;

    return 0;
}


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

int main(){
  int n;cin>>n;
  vector<int> arr(n);
  for(int i=0;i<n;++i)cin>>arr[i];
  vector<int> dp(n);
  dp[0] = 0;
  dp[1] = abs(arr[1]-arr[0]);
  
  for(int i=2;i<n;++i){
    dp[i] = min(dp[i-1]+abs(arr[i]-arr[i-1]),dp[i-2]+abs(arr[i]-arr[i-2]));
  }
  cout<<dp[n-1]<<endl;
  return 0;
}

Measured memory_bytes: 1024
<?php
list($k, $n) = explode(' ', trim(fgets(STDIN)));
$as = explode(' ', trim(fgets(STDIN)));

$max = 0;
for ($i=0; $i < $n; $i++) {
  if (isset($as[$i+1])) {
    $d = $as[$i+1] - $as[$i];
  } else {
    $d = $k + $as[0] - $as[$i];
  }

  if ($max < $d) {
    $max = $d;
  }
}

echo $k - $max;


Measured memory_bytes: 19188
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
void put_uint(int n) {
    if(!n) {
        putchar_unlocked('0');
        return;
    }
    char buf[11];
    int i = 0;
    while(n) buf[i++] = (char)(n % 10 + '0'), n /= 10;
    while(i--)putchar_unlocked(buf[i]);
}
int get_uint() {
    int n = 0;
    int c = getchar_unlocked();
    if(c < 48 || 57 < c) return c;
    while(47 < c && c < 58) {
        n = 10 * n + (c & 0xf);
        c = getchar_unlocked();
    }
    return n;
}
int get_str(char *str) {
    int c;
    while((c = getchar_unlocked()) > 32) *str++ = (char)c;
    *str = 0;
    return c;
}

#define MIN(x, y) ((x) <= (y) ? (x) : (y))
typedef struct QueueKey {
    char str[16];
    int num;
} QueueKey;
typedef struct QueueDat {
    QueueKey key;
    struct QueueDat *next;
} QueueDat;
typedef struct Queue {
    size_t len;
    QueueDat *head;
    QueueDat *tail;
} Queue;
#define queue_init(q) ((q) ? ((q)->len = 0, (q)->head = (q)->tail = NULL) : 0)
#define queue_len(q) ((q) ? (q)->len : 0)
void queue_push(Queue *q, QueueKey x) {
    QueueDat *new_dat = malloc(sizeof(QueueDat));
    *new_dat = (QueueDat){x, NULL};
    if(q->len) {
        q->tail->next = new_dat;
        q->tail = new_dat;
    }else{
        q->head = q->tail = new_dat;
    }
    q->len++;
}
QueueKey queue_pop(Queue *q) {
    assert(q->len);
    QueueDat *old_head = q->head;
    q->head = old_head->next;
    QueueKey key = old_head->key;
    free(old_head);
    q->len--;
    return key;
}

int main(int argc, char **argv) {
    int n = get_uint();
    int q = get_uint();
    Queue Q;
    queue_init(&Q);
    QueueKey key;
    for(int i = 0; i < n; ++i) {
        get_str(key.str);
        key.num = get_uint();
        queue_push(&Q, key);
    }
    int cnt = 0;
    while(queue_len(&Q)){
        key = queue_pop(&Q);
        cnt += MIN(key.num, q);
        if(key.num > q){
            key.num -= q;
            queue_push(&Q, key);
        } else {
            printf("%s %d\n", key.str, cnt);
        }
    }
    return 0;
}




Measured memory_bytes: 4076
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>

using namespace std;

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

	long long ans = n * (n - 1) / 2;
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <functional>
#include <queue>
#include <string>
#include <cstring>
#include <numeric>
#include <cstdlib>
#include <cmath>
using namespace std;

typedef long long ll;

#define INF 10e10
#define rep(i,n) for(int i=0; i<n; i++)
#define rep_r(i,n,m) for(int i=m; i<n; i++)
#define END cout << endl
#define MOD 1000000007
#define pb push_back
// 昇順sort
#define sorti(x) sort(x.begin(), x.end())
// 降順sort
#define sortd(x) sort(x.begin(), x.end(), std::greater<int>())

inline int solve1(int x, int y) {
  if (x % 3 == 0) {
    return 0;
  } else {
    return y;
  }
}

inline int solve2(ll x, ll y) {
  ll res = MOD;
  for (ll i = 1; i < x; ++i) {
    ll buf1, buf2, buf3;
    buf1 = i * y;
    buf2 = (x - i) * (y / 2);
    buf3 = (x - i) * ((y + 1) / 2);


    ll sub = max(max(abs(buf1 - buf2), abs(buf1 - buf3)), abs(buf2 - buf3));
    res = min(sub, res);
  }

  return res;
}

int main() {
  ll h,w; cin >> h >> w;
  int ans = MOD;
  ans = min(ans, solve1(h,w));
  ans = min(ans, solve1(w,h));
  ans = min(ans, solve2(h,w));
  ans = min(ans, solve2(w,h));

  cout << ans << endl;
}


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

using ll = long long;
using Pair = std::pair<ll, ll>;

int main() {
    long long x;

    std::cin >> x;

    long long cnt = x / 11;

    x -= cnt * 11;

    cnt *= 2;

    if(x > 0) {
        if(x <= 6) {
            ++cnt;
        }else {
            cnt += 2;
        }
    }

    std::cout << cnt << std::endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
// Hey! 僕の提出を見てくれてありがとう.
// ロボ子さん可愛いぞ！！！！！君もV沼にはまろう↓
// https://www.youtube.com/channel/UCDqI2jOz0weumE8s7paEk6g
using namespace std;
using ll = long long;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}//a,bの最大公約数(gcd)を求める
ll lcm(ll a,ll b){return abs(a*b)/gcd(a,b);}//a,bの最小公倍数(lcm)を求める
vector<ll> enum_div(ll n){vector<ll> ret;for(int i=1 ; i*i<=n ; i++){if(n%i == 0){ret.push_back(i);if(i!=1 && i*i!=n)ret.push_back(n/i);}}ret.push_back(n);return ret;}
//↑nの約数を求める
vector<bool> IsPrime; void sieve(size_t max){if(max+1 > IsPrime.size())IsPrime.resize(max+1,true);IsPrime[0] = false;IsPrime[1] = false;for(size_t i=2; i*i<=max; ++i)if(IsPrime[i])for(size_t j=2; i*j<=max; ++j)IsPrime[i*j] = false;}
//↑エラトステネスの篩で素数を求める
#define roundup(divisor,dividend) (divisor + (dividend - 1)) / dividend //切り上げ割り算
#define all(x) (x).begin(),(x).end() //xの初めから終わりまでのポインタ
#define size_t ll //size_tは自動でllに変換される
#define pb(x) push_back(x)
#define pri_queue priority_queue //優先度付きキュー
#define syo(x) fixed << setprecision(x) //iostreamで小数をx桁表示
//sortを降順にする時は greater<型>()
void solve(long long K, long long A, long long B){
  bool x=false;
  for (int i = A; i <= B; i++) {
    if(i%K == 0)x = true;
  }
  cout << (x ? "OK":"NG") << endl;
}

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


Measured memory_bytes: 3684
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

// c++11
#include <array>
#include <tuple>
#include <unordered_map>
#include <unordered_set>

#define mp make_pair
#define mt make_tuple
#define rep(i, n) for (int i = 0; i < (n); i++)

using namespace std;

using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
template <class T>
using max_priority_queue = priority_queue<T>;
template <class T>
using min_priority_queue = priority_queue<T, std::vector<T>, std::greater<T>>;

const int INF = 1 << 29;
const ll LL_INF = 1LL << 60;
const double EPS = 1e-9;
const ll MOD = 1000000007;

const int dx[] = {1, 0, -1, 0}, dy[] = {0, -1, 0, 1};
ll A, B, Q;
vector<ll> S, T;
int main()
{
    cin >> A >> B >> Q;
    S.resize(A);
    T.resize(B);
    for (auto &val : S)
    {
        cin >> val;
    }
    for (auto &val : T)
    {
        cin >> val;
    }
    for (int i = 0; i < Q; i++)
    {
        ll x;
        cin >> x;
        vector<ll> s_points;
        int s1 = lower_bound(S.begin(), S.end(), x) - S.begin();
        s_points.emplace_back(S[s1]);

        if (s1 > 0)
        {
            int s2 = s1 - 1;
            s_points.emplace_back(S[s2]);
        }
        vector<ll> t_points;
        int t1 = lower_bound(T.begin(), T.end(), x) - T.begin();
        t_points.emplace_back(T[t1]);
        if (t1 > 0)
        {
            int t2 = t1 - 1;
            t_points.emplace_back(T[t2]);
        }
        ll result = LL_INF;
        for (int i = 0; i < s_points.size(); i++)
        {
            for (int j = 0; j < t_points.size(); j++)
            {
                ll l = min(s_points[i], t_points[j]);
                ll r = max(s_points[i], t_points[j]);
                ll c1 = abs(l - x);
                ll c2 = abs(r - x);
                if (l <= x && x <= r)
                {
                    result = min(result, min(2 * c1 + c2, 2 * c2 + c1));
                }
                else
                {
                    result = min(result, max(c1, c2));
                }
            }
        }
        cout << result << endl;
    }
    return 0;
}


Measured memory_bytes: 2944