akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>


using namespace std;
typedef long long ll;

int main() {
    int N;
    cin>>N;
    vector<pair<ll,ll> > vp;
    for(int i=0;i!=N;++i){
        ll a,b;
        cin>>a>>b;
        
        vp.push_back(make_pair(a,b));
    }
    
    sort(vp.begin(),vp.end(),[](pair<ll,ll> p1,pair<ll,ll> p2){
        return p1.second <p2.second;
    });
    /*
    for(int i=0;i!=N;++i){
        cout<<vp[i].first<<":"<<vp[i].second<<endl;;
    }
    */
    ll sum=0;
    bool flag=true;
    //cout<<"--------------------------"<<endl;
    
    for(int i=0;i<N;++i){
        sum+=vp[i].first;
        //cout<<sum<<":"<<vp[i].second<<endl;
        if(sum>vp[i].second){
            flag=false;
            break;
        }
    }
    
    if(flag==true){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
    
}


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

typedef long long llong;

int n,k,w[10000004];


int wnm(int p){
    int kn=1;
    int sum=0;
    int pp=p;
    for(int i=0;i<n;i++){
        if(w[i]>p){return 0;}
        else if(pp-w[i]==0){
            kn++;
            sum++;
            pp=p;
            if(i==n-1) return n;
        }
        else if(pp-w[i]>0){
            sum++;
            pp = pp - w[i];
        }
        else if(pp-w[i]<0){
            kn++;
            sum++;
            pp = p - w[i];
        }
        if(kn>k) return i;
    }
    return sum;
}

int binary(llong m){
    llong md;
    llong min=1;
    llong max=m;
    while(min<max){
            md=(min+max)/2;
            if(wnm(md)>n) max=md-1;
            else if(wnm(md)==n)max=md;
            else if(wnm(md)<n) min=md+1;
            //cout<<min<<endl;
            //cout<<max<<endl;
    }
    return max;
}


int main(){
    llong max=100000000000000;
    scanf("%d %d", &n, &k);
    for(int i=0;i<n;i++){
        scanf("%d",&w[i]);
        //if(max<w[i]) max=w[i];
    }

    //printf("%d\n", wnm(37));
    printf("%d\n", binary(max));
    return 0;
}


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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

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

typedef long long ll;

bool is_prime(long long n)
{
    if (n == 1)
        return false;

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

void solve(long long X)
{
    int i = 0;
    while (!is_prime(X + i))
    {
        i++;
    }
    cout << X + i << endl;
}

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


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

int n, x, pos;

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

    if(x==1 || x==2*n-1) cout << "No";
    else {
        cout << "Yes" << endl;
        if(n==1) cout << 1;
        else if(n==2) cout << 1 << endl << 2 << endl << 3 << endl;
        else {
            pos=(2*n-1)/2;

            int cnt=2;
            for(int i=0; i<(2*n-1); i++) {
                if(i==pos-1) cout << 2*n-1 << endl;
                else if(i==pos) cout << x << endl;
                else if(i==pos+1) cout << 1 << endl;
                else {
                    if(cnt==x) cnt++;
                    cout << cnt << endl;
                    cnt++;
                }
            }
        }
    }
    return 0;
}


Measured memory_bytes: 1536
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int width = 0, height = 0, x = 0, y = 0, radius = 0;
		
		width	= sc.nextInt();
		height	= sc.nextInt();
		x		= sc.nextInt();
		y		= sc.nextInt();
		radius	= sc.nextInt();
		
		int lowerLimmitX = radius;
		int lowerLimmitY = radius;
		
		int upperLimmitX = width		- radius;
		int upperLimmitY = height	- radius;
		
		String result = "No";
		
		if (		lowerLimmitX <= x
				&&	x <= upperLimmitX 
				&&	lowerLimmitY <= y
				&&	y <= upperLimmitY ) {
			result = "Yes";
		
		}
		
		System.out.println(result);
		
	}
}

Measured memory_bytes: 17228
N = gets.to_i

k = 0
k += 1 while k*(k-1)/2 < N
if k*(k-1)/2 > N
    puts "No"
    exit
end

s = Array.new(k){[]}
pt = 1
k.times do |i|
    i.times do |j|
        s[i].push(pt)
        s[j].push(pt)
        pt += 1
    end
end
puts "Yes", k
s.each do |arr|
    print arr.length, " "
    puts arr.join(' ')
end

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

using namespace std;

typedef long long ll;

const double pi = 3.14159265358979323846;

#define REP(i, n) for (ll i = 0; i < n; i++)
#define MOD 1000000007LL
#define PS(p) cout << setprecision(15) << fixed << p << endl;
#define UNIQUE(v) v.erase(std::unique(v.begin(), v.end()), v.end());
#define ALL(c) c.begin(), c.end()
#define CIN(v) cin >> v;
#define COUT(v) cout << v << "\n";

ll N;
ll result = 0;

void dfs(string current) {
  // COUT(current);

  if (current != "" && N < stoll(current)) {
    return;
  }

  bool check7 = false;
  bool check5 = false;
  bool check3 = false;
  for (char c : current) {
    if (c == '7')
      check7 = true;
    if (c == '5')
      check5 = true;
    if (c == '3')
      check3 = true;
  }

  if (check7 && check5 && check3)
    result++;

  dfs("7" + current);
  dfs("5" + current);
  dfs("3" + current);
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  CIN(N);

  dfs("");

  COUT(result);

  return 0;
}


Measured memory_bytes: 256
//inlclude before define 
#define _USE_MATH_DEFINES

//include
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<type_traits>
#include<numeric>
#include<assert.h>
#include<deque>
#include<iomanip>
#include<set>
#include<tuple>
#include<map>

using namespace std;

//typedef
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<char> VC;
typedef pair<int, int> P1;
typedef long long int ll;

//define
#define INF 1e9
#define NUM 1000000007
#define all(x) begin(x),end(x)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,a,b) for(int i=int(a);i<int(b);i++)
#define chmin(a,b) a=min((a),(b))
#define chmax(a,b) a=max((a),(b))

//function

/*ll gcd(ll a, ll b) {
	if (b == 0) return a;
	else return gcd(b, a%b);
}*/

/*ll lcm(ll a,ll b) {
	ll g = gcd(a, b);
	return a * (b / g);
}*/

/*int dig(int a) {
	int sum = 0;
	while (a) {
		sum += a % 10;
		a /= 10;
	}
	return sum;
}*/

int main() {
	ll a, b, c;
	cin >> a >> b >> c;
	ll ans = 0;
	if (a + b < c) {
		ans += (a + b) + b+1;
	} else {
		ans = b + c;
	}
	cout << ans << endl;
	return 0;
}



Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main (){
    int a, b, i;
    for(i=0; i<3000; i++){
    cin>>a>>b;
    if(a==0&&b==0){
    return 0;
    }
    else if(b>=a){
    cout<<a<<" "<<b<<endl;
    }
    else{
    cout<<b<<" "<<a<<endl;
    }
    }
    cout<<endl;
}




Measured memory_bytes: 3092
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <numeric>
#include <map>
#include <iomanip>
#include <cmath>
#include <queue>
#include <limits.h>

using namespace std;    
typedef long long ll;
typedef pair<ll, ll> pll;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
const bool DEBUG = true;

int main(){

    int s, w;
    cin >> s >> w;
    if(w >= s){
        cout << "unsafe" << endl;
    }
    else{
        cout << "safe" << endl;
    }

    return 0;
}

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

using ll = long long;
// #define int long long

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPS(i, r, n) for (int i = (r); i < (n); ++i)
#define REPR(i, n) for(int i = (n); i >= 0; --i) // from n to 0
#define REPRS(i, r, n) for(int i = (n); i >= (r); --i) // from n to r
#define COUTB(x) cout << (x) << "\n"
#define COUTS(x) cout << (x) << " "
#define PB push_back
#define SORT(obj) sort((obj).begin(), (obj).end())
#define SORTR(obj) sort((obj).begin(), (obj).end(), greater<>())
#define ALL(obj) (obj).begin(), (obj).end()
#define MOD 1000000007
#define PI (acos(-1))
/***** MAIN *****/
signed main() {
  double h, w, n;
  cin >> h;
  cin >> w;
  cin >> n;
  double bigger = max(h,w);
  double smaller = min(h,w);
  cout << ceil(n / bigger);

  
  cout << "\n";
  return 0;
}
/***** MAIN *****/


Measured memory_bytes: 256
import sys
s=sys.stdin.readline()

l=(len(s)-1)//2
judge=1
for i in range(l):
    if s[i]==s[l-i-1] and s[l+i+1]==s[2*l-i] and s[i]==s[l+i+1]:
        pass
    else:
        judge=0
        break
if judge==1:
    print('Yes')
else:
    print('No')


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

int main(){
    string str;
    int n,s = 0;
    cin >> str;
    istringstream sin(str);
    sin >> n;
    for(int i = 0;i < str.size();i++){
        s += str[i] - '0';
    }
    if(n % s == 0){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define rep2(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
using namespace std;
using ll = long long;
 
int main()
{
    int n, x;
    cin >> n >> x;
    vector<int> l(n);
    rep(i, n) cin >> l[i];
    int ans=1;
    int sum = 0;
    rep(i, n){
        sum += l[i];
        if(sum>x){
            cout << i+1 << endl;
            break;
        }
        if(i==n-1){
            cout << n+1 << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 256
<?php
  list($s) = explode(" ", trim(fgets(STDIN)));

  if($s[0] != 'A'){
    echo "WA";
    exit;
  }

  if (!preg_match('/^[a-z]+$/', $s[1])) {
    echo "WA";
    exit;
  }

  $isC = false;
  for($i=2;$i<strlen($s)-1;$i++){
    if($s[$i]=="C"){
      if($isC){
        echo "WA";
        exit;
      }else{
        $isC = true;
      }
    }else if(!preg_match('/^[a-z]+$/', $s[$i])){
      echo "WA4";
      exit;
    }
  }

  if (!preg_match('/^[a-z]+$/', $s[strlen($s)-1])) {
    echo "WA";
    exit;
  }

  if($isC) echo "AC";
  else echo "WA";


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

int h;
int w;

int room[120][120];

pair<int,int> nex(int x, int y){
	if (y & 1){
		x--;
	}
	else{
		x++;
	}
	if (x < 0){
		x = 0;
		y++;
	}
	if (x >= h){
		x = h - 1;
		y++;
	}
	return make_pair(x, y);
}
int main(){
	cin >> h >> w;
	int n;
	scanf("%d", &n);
	pair<int, int> p=make_pair(0,0) ;
	for (int i = 1; i <= n; i++){
		int a;
		scanf("%d", &a);
		while (a--){
			room[p.first][p.second] = i;
			p = nex(p.first, p.second);
		}
	}
	for (int i = 0; i < h; i++){
		for (int j = 0; j < w; j++){
			if (j){
				printf(" ");
			}
				printf("%d", room[i][j]);
			
		}
		puts("");
	}
	return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <tuple>
#include <numeric>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;

int main() {
    ll q, h, s, d, n;
    cin >> q >> h >> s >> d >> n;

    q *= 4;
    h *= 2;

    ll x = min({q, h, s});
    ll y = d;

    if(2*x <= y) {
        out(n*x);
    }
    else {
        ll m = n/2;
        if(n%2 == 0) {
            out(m*y);
        }
        else {
            out(m*y + x);
        }
    }

    re0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long
#define all(aaa) aaa.begin(), aaa.end()

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

    int n;
    string s;
    cin >> n >> s;

    int x = 0;
    for (const char &c : s)
        x += (c == 'R');

    cout << (x * 2 > s.size() ? "Yes" : "No");
    
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
  
int main() {
  int a,b;
  cin >> a >> b;
  int cnt=0;
  for (int i=a;i<=b;i++){	
	if(i/1000 == (i%10)*10+(i%100-i%10)/10) cnt++;
  }
  cout << cnt;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define null NULL
#define mp make_pair
#define pb(a) push_back(a)
#define sz(a) ((int)(a).size())
#define all(a) a.begin() , a.end()
#define fi first
#define se second
#define relaxMin(a , b) (a) = min((a),(b))
#define relaxMax(a , b) (a) = max((a),(b))
#define SQR(a) ((a)*(a))
#define PI 3.14159265358979323846
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef long long ll;

const int MAX = 100010;

int k;
int min_sum[MAX];

struct Compare{
  bool operator()(const int& f, const int& s) const {
    return mp(min_sum[f], f) < mp(min_sum[s], s);
  }
};
set<int, Compare> nal;

int Solve(){
  for(int i = 9;i > 0;--i)
    min_sum[i % k] = i;
  for(int i = 1;i <= 9;++i)
    nal.insert(i % k);

  while(!nal.empty()){
    int vr = *nal.begin();
    nal.erase(vr);
    if(vr == 0) return min_sum[vr];
    for(int neo = 0;neo < 10;++neo){
      int ost = (10 * vr + neo) % k;
      if(min_sum[ost] == -1 ||
         min_sum[vr] + neo < min_sum[ost]){
        nal.erase(ost);
        min_sum[ost] = min_sum[vr] + neo;
        nal.insert(ost);
      }
    }
  }

  return -1;
}

int main(){
  memset(min_sum, -1, sizeof min_sum);
  scanf("%d", &k);
  printf("%d\n", Solve());
  return 0;
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#include <iostream>
using namespace std;
int main()
{
    long long int n,temp,sum=0,j;
    cin>>n;
    temp = n;
    while(temp!=0){
        j = temp%10;
        sum+=j;
        temp/=10;
    }
    if(n%sum)
        cout<<"No";
    else
        cout<<"Yes";
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<cstdlib>
int main()
{
	char a[1001],b[1001];
	int i,lena,lenb;
	scanf("%s %s",a,b);
	lena=strlen(a);
	lenb=strlen(b);
	if(lena>lenb)
	{
		for(i=0;i<=lena-2;i++)
			printf("%c%c",a[i],b[i]);
		printf("%c",a[i]);
	}
	else
	{
		for(i=0;i<=lena-1;i++)
			printf("%c%c",a[i],b[i]);
	}
	return 0;
}

Measured memory_bytes: 128
def dfs(N):
    if N == 0:
        return 1
    component = dfs(N-1)
    tower = 2 * component + 1 
    return tower

N, X = map(int, input().split())
ans = 0
while X > 0:
    for n in range(0, N+1):
        if X < 2**(n+3) - 3 + (N-(n+1)):
            if X > 2**(n+2) - 3 + (N-n):
                ans += dfs(n) + 1 
                X -= 2**(n+2) - 3 + (N-n) + 1
                N = n
            else:
                if n == 0 and X <= N:
                    X = 0
                else:
                    ans += dfs(n)
                    X -= 2**(n+2) - 3 + (N-n)
                    N = n
            break

print(ans)


Measured memory_bytes: 38512
#include<bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> P;
typedef long long ll;
#define rep(i,a,n) for(int i=a;i<n;i++)
#define rrep(i,n,a) for(int i=n;i>=a;i--)
#define FOR(i,n) for(int i=0;i<n;i++)
#define all(s) s.begin(),s.end()
#define vi vector<int>
#define vvi vector<vector<int>>
#define pcnt(n) __builtin_popcount(n)
const int MOD = 1e9 + 7;
//const int MOD = 998244353;
const int INF = 1e18;
const double PI = acos(-1);

int n,m,x;

vector<int>c(15);
int a[15][15];
int cost(int bits){
    vector<int>sat(13,0);
    int ret = 0;
    rep(i,0,n){
        if((bits>>i)&1){
            ret+=c[i];
            rep(j,0,m){
                sat[j]+=a[i][j];
            }
        }
    }
    rep(i,0,m){
        if(sat[i]<x){return INF;}
    }
    return ret;
}

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cin>>n>>m>>x;
    rep(i,0,n){
        cin>>c[i];
        rep(j,0,m){
            cin>>a[i][j];
        }
    }
    int B = 1<<n;
    int ans = INF;
    rep(i,0,B){
        ans = min(ans,cost(i));
    }
    if(ans==INF){ans=-1;}
    cout<<ans<<endl;
}

Measured memory_bytes: 3632
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <map>
typedef long long LL;

int int_vector_find(std::vector<int> vec,int num) {
	auto itr = std::find(vec.begin(), vec.end(), num);
	int index = std::distance(vec.begin(), itr);

	if (index != vec.size()) {
		return 1;
	}
	else {
		return 0;
	}
}

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

	if (n % 111 == 0) {
		std::cout << n << std::endl;
	}
	else {
		std::cout << ((n / 111) + 1) * 111 << std::endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>

typedef long long ll;

using namespace std;

int main() {
	ll n;
	cin >> n;
	
	int ans = 0;
	for(int i = 1; i * 1ll * i <= n - 1; i++) {
		if((n - 1) % i == 0) {
			if(i > 1) ans++;
			if((n - 1) / i != i) ans++;
		}
	}
	
	auto check = [&](ll v) {
		ll x = n;
		while(x % v == 0) x /= v;
		if(x % v == 1) ans++;
	};
	
	for(int i = 1; i * 1ll * i <= n; i++) {
		if(n % i == 0) {
			if(i > 1) check(i);
			if((n / i) != i) check(n / i);
		}
	}
	
	cout << ans << endl;
}

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

#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define ALL(x) x.begin(),x.end()
#define EPS (1e-8)
#define equals(a,b) (fabs((a)-(b))<EPS)

using namespace std;

typedef long long ll;
bool LTE(double a,double b) { return equals(a,b) || a < b; }
bool LT(double a,double b) { return !equals(a,b) && a < b; }

void compute() {

}

int main() {
  string s[3];
  rep(i,3) cin >> s[i];
  rep(i,3) cout << s[i][i]; puts("");
  compute();
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cstring>

using namespace std;
ifstream fin("p.in");
ofstream fout("p.out");

long long MOD = 1e9+7;

int main()
{
    char s[10001];
    cin>>s;
    int d;
    cin>>d;

    long long dp[100001][101][2];

    dp[0][0][0]=1;
    for(int i = 0; s[i] != '\0'; i++)
        {
            int cif = s[i] - '0';
            for(int j = 0; j < d ; j++)
                for(int k = 0; k < 10; k++)
                    {
                        dp[i+1][(j+k)%d][1] = (dp[i+1][(j+k)%d][1] + dp[i][j][1]) % MOD;
                        if(cif == k)
                            {
                                dp[i+1][(j+k)%d][0] = ( dp[i+1][(j+k)%d][0] + dp[i][j][0] ) % MOD;
                            }
                        else if(cif > k)
                                {
                                    dp[i+1][(j+k)%d][1] = (dp[i+1][(j+k)%d][1] + dp[i][j][0]) % MOD;
                                }
                    }
        }

    cout<<(dp[strlen(s)][0][0] + dp[strlen(s)][0][1] - 1 + MOD) % MOD;

    return 0;
}


Measured memory_bytes: 18048
// #include {{{
#include <iostream>
#include <cassert>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <ctime>
#include <queue>
#include <set>
#include <map>
#include <stack>
#include <string>
#include <bitset>
#include <vector>
#include <complex>
#include <algorithm>
using namespace std;
// }}}
// #define {{{
typedef long long ll;
typedef double db;
typedef pair<int,int> pii;
typedef vector<int> vi;
#define de(x) cout << #x << "=" << x << endl
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define per(i,a,b) for(int i=(b)-1;i>=(a);--i)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define fi first
#define se second
// }}}

const int N = 3001;
int A , B , C , D , E , F;
int f[N] , g[N];

void solve(int *a,int x,int y,int n){
    a[0] = 1;
    rep(i,0,n+1) if(a[i]){
        if(i+x<=n) a[i+x]=1;
        if(i+y<=n) a[i+y]=1;
    }
}

int main(){
    cin >> A >> B >> C >> D >> E >> F;
    solve(f , A * 100 , B * 100 , F);
    solve(g , C , D , F);
    pii best(-1,-1);
    g[0] = 0;
    rep(i,1,F+1) g[i] = max(g[i] ? i : 0 , g[i-1]);
    rep(i,1,F+1) if(f[i]){
        int j = min(F - i , i / 100 * E);
        j = g[j];
        if(best.fi == -1 || j * best.fi > (i + j) * best.se)
            best = mp((i + j) , j);
    }
    printf("%d %d\n",best.fi,best.se);
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,k;
  cin>>n>>k;
  vector<int> a(n);
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  sort(a.begin(),a.end());
  int ans=1000000001;
  for(int i=0;i+k-1<n;i++){
    ans=min(ans,a[i+k-1]-a[i]);
  }
  cout<<ans;
}

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

int main() {
  int n,h,w;
  cin >> n>>h>>w;
  vector<int>a(n),b(n);
  rep(i,n){
    cin>>a.at(i)>>b.at(i);
  }
  int ans=0;
  rep(i,n){
    if(a.at(i)>=h&&b.at(i)>=w){
      ans++;
    }
  }
  
 
  cout<<ans<<endl;  
}



Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main(){
	long long a;
	int n,b;
	cin>>n;
	a=0;
	for(int i=0;i<n;i++){
		cin>>b;
		a+=b;
	}
	cout<<a/n<<endl;
    return 0;
}

Measured memory_bytes: 1156
#include<bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<string>
#include<numeric>
#include<vector>
#include<set>
#include<map>
using namespace std;

int main() {
    string s;
    cin >> s;
    int n;
    n = s.length();
    long long sum = 0;
    for (int bit = 0; bit < (1<<n-1); ++bit) {
        vector<int> P;
        P.push_back(0);
        for (int i = 0; i < n-1; ++i) {
            if (bit & (1<<i)) { // i が bit に入るかどうか
                P.push_back(i+1);
            }
        }
        P.push_back(n);
        for (int j = 0; j < P.size()-1;j++){
          long long s_i;
          s_i = atoll(s.substr(P[j],P[j+1]-P[j]).c_str());
          sum += s_i;
        }
    }
    cout << sum << endl;
    return 0;
}

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

int main() {
    int a, b, c, d, e, k; cin >> a >> b >> c >> d >> e >> k;
    int flg = 0;
    if(abs(a - b) <= k) flg++;
    if(abs(a - c) <= k) flg++;
    if(abs(a - d) <= k) flg++;
    if(abs(a - e) <= k) flg++;
    if(abs(b - c) <= k) flg++;
    if(abs(b - d) <= k) flg++;
    if(abs(b - e) <= k) flg++;
    if(abs(c - d) <= k) flg++;
    if(abs(c - e) <= k) flg++;
    if(abs(d - e) <= k) flg++;
    
    if(flg == 10) {
        cout << "Yay!\n";
    } else {
        cout << ":(\n";
    }
}


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

using namespace std;

#define INF 2000000000
#define MOD 1000000007
typedef long long ll;
typedef pair<int, int> P;


int main()
{
	double n, m;
	cin >> n >> m;

	double ans = pow(2, m) * (1900 * m + 100 * (n-m));
	cout << ans << "\n";
}


Measured memory_bytes: 512
class UnionFind:
    def __init__(self, size):
        self.parent = [-1 for i in range(size)]#非負なら親ノード，負ならグループの要素数

    def root(self, x): #root(x): xの根ノードを返す．
        if self.parent[x] < 0:
            return x
        else:
            while self.parent[x] >= 0:
                if self.parent[self.parent[x]] >= 0:
                    self.parent[x] = self.parent[self.parent[x]]
                x = self.parent[x]
#        self.parent[x] = self.root(self.parent[x]) #xをxの根に直接つなぐ
            return x

    def merge(self, x, y): #merge(x,y): xのいるグループと$y$のいるグループをまとめる
        x = self.root(x)
        y = self.root(y)
        if x == y:
            return False
        if self.parent[x] > self.parent[y]: #xの要素数がyの要素数より「小さい」とき入れ替える
            x,y=y,x
        self.parent[x] += self.parent[y] #xの要素数を更新
        self.parent[y] = x #yをxにつなぐ
        return True

    def issame(self, x, y): #same(x,y): xとyが同じグループにあるならTrue
        return self.root(x) == self.root(y)
        
    def size(self,x): #size(x): xのいるグループの要素数を返す
        return -self.parent[self.root(x)]


n,m=[int(i) for i in input().split()]

A=[[int(i)-1 for i in input().split()] for _ in range(m)]

ans = [0]*(m+1)
a = n*(n-1)//2
ans[0] = a

uf = UnionFind(n)
for i in range(m):
    j = m-i-1
    v1 = A[j][0]
    v2 = A[j][1]
#    print(v1,v2)
    if not uf.issame(v1,v2):
#        print(uf.parent)
        a -= uf.size(v1) * uf.size(v2)
        uf.merge(v1,v2)

    ans[i+1]=a

for i in range(m):
    print(ans[m-i-1])
    
    
    
    
    
    





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

int main() {
  long A,B,K;
  cin >> A >> B >> K;
  int i=0;
  while (K>i) {
    if (i%2==0) {
      B+=A/2;
      A/=2;
      i++;
    }
    else {
      A+=B/2;
      B/=2;
      i++;
    }
  }
  cout << A << " " << B << endl;
}

Measured memory_bytes: 3588
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <functional>
#include <vector>
#define numarr 12
using namespace std;

int main() {
	int T, X;
	double ans;
	cin >> T >> X;
	ans = (double)T / (double)X;
		cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000000
int x;
stack<int>s;
int main() {
	while (cin >> x) {
		if (x)s.push(x);
		else {
			cout << s.top() << endl;
			s.pop();
		}
	}
	
	getchar();getchar();
	return 0;
}


Measured memory_bytes: 3000
#include<cstdio>
int N,K,M=1e9+7;long dp[55][55][2525];
int main(){
    scanf("%d%d",&N,&K);
    dp[0][0][0]=1;
    for(int i=1;i<=N;++i)
        for(int j=0;j<=i;++j)
            for(int k=j*2;k<=K;++k) {
                (dp[i][j][k]+=dp[i-1][j][k-j*2]*(j*2+1)+dp[i-1][j+1][k-j*2]*(j+1)*(j+1))%=M;
                if(j)(dp[i][j][k]+=dp[i-1][j-1][k-j*2])%=M;
            }
    printf("%d", dp[N][0][K]);
}

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

int main(){
  vector<vector<int>> bingo(3, vector<int>(3));
  rep(i,3){
    rep(j,3)
      cin >> bingo[i][j];
  }
  int n, b;
  //ビンゴの穴あけ作業
  cin >> n;
  rep(i,n){
    cin >> b;
    rep(j, 3){
      rep(k,3){
        if (bingo[j][k] == b)
          bingo[j][k] = 0;
      }
    }
  }
  //ビンゴしているかの判定
  string answer = "No";
  rep(i,3){
    if (bingo[i][0]==0 && bingo[i][1]==0 && bingo[i][2]==0)
      answer = "Yes";
    else if (bingo[0][i]==0 && bingo[1][i]==0 && bingo[2][i]==0)
      answer ="Yes";
  }
  if(bingo[0][0]==0 && bingo[1][1]==0 && bingo[2][2]==0)
    answer ="Yes";
  if(bingo[0][2]==0 && bingo[1][1]==0 && bingo[2][0]==0)
    answer ="Yes";
  
  cout << answer << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        String[] in = s.nextLine().split(" ");
        int A = Integer.parseInt(in[0]);
        int B = Integer.parseInt(in[1]);
        int C = Integer.parseInt(in[2]);
        int D = Integer.parseInt(in[3]);

        while (true) {
            C -= B;
            if (C <= 0) {
                System.out.println("Yes");
                break;
            }

            A -= D;
            if (A <= 0) {
                System.out.println("No");
                break;
            }
        }
    }
}

Measured memory_bytes: 35444
import numpy as np

S = np.array([int(s) for s in input()])
p1 = np.tile(np.arange(2), len(S) // 2 + 1)[:len(S)]
p2 = np.tile([1,0], len(S) // 2 + 1)[:len(S)]

c1 = np.abs(S - p1).sum()
c2 = np.abs(S - p2).sum()

print(min(c1, c2))

Measured memory_bytes: 20784
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
using namespace std;
int main()
{
	int n;
	scanf("%d", &n);
	vector <int> a(n + 1);
	int l = 1E9, r = 0;
	for (int i = 1; i <= n; i++)
	{
		scanf("%d", &a[i]);
		if (a[i] < l) l = a[i];
		if (a[i] > r) r = a[i];
	}
	int ans = 1E9, sum;
	for (int j = l; j <= r; j++)
	{
		sum = 0;
		for (int i = 1; i <= n; i++)
			sum += (a[i] - j) * (a[i] - j);
		if (sum < ans) ans = sum;
	}
	printf("%d\n", ans);
	return 0;
}

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

#define int long long

signed main() {
    int N;
    cin >> N;
    int ryuka[87];
    ryuka[0] = 2;
    ryuka[1] = 1;
    for (int i = 2; i < 87; i++) {
        ryuka[i] = ryuka[i - 1] + ryuka[i - 2];
    }
    cout << ryuka[N] << endl;
    return 0;
}


Measured memory_bytes: 256
n, c = map(int, input().split())
x = [0]*(n+2)
v = [0]*(n+2)
for i in range(1, n+1):
    x[i], v[i] = map(int, input().split())
x[n+1] = c
dp = [[0]*100100 for _ in range(2)]

ans = 0
cal = 0
for i in range(1, n+1):
    cal -= x[i] - x[i-1]
    cal += v[i]
    dp[0][i] = max(dp[0][i-1], cal)

cal = 0
for i in range(n, 0, -1):
    cal -= x[i+1] - x[i]
    cal += v[i]
    dp[1][i] = max(dp[1][i+1], cal)

ans = 0
for i in range(n+1):
    cal = dp[0][i] + dp[1][i+1] - x[i]
    ans = max(ans, cal)

    cal = dp[0][i] + dp[1][i+1] - c + x[i+1]
    ans = max(ans, cal)
print(ans)


Measured memory_bytes: 27108
#define taskname "test"

#include <bits/stdc++.h>

using namespace std;

#define sz(x) (int)x.size()
#define fi first
#define se second

typedef long long lli;
typedef pair<int, int> pii;

const lli inf = 1e18;

int n, m;

void read_input()
{
    cin >> n >> m;
}

lli calc1(int n, int m)
{
    lli res = inf;
    for(int x = 1; x <= n - 2; ++x)
    {
        int y = (n - x) / 2;
        vector<lli> v({x * 1LL * m, y * 1LL * m, (n - x - y) * 1LL * m});
        sort(v.begin(), v.end());
        res = min(res, v.back() - v.front());
    }
    return res;
}

lli calc2(int n, int m)
{
    lli res = inf;
    for(int x = 1; x <= n - 1; ++x)
    {
        int y = m / 2;
        vector<lli> v({x * 1LL * m, (n - x) * 1LL * y, (n - x) * 1LL * (m - y)});
        sort(v.begin(), v.end());
        res = min(res, v.back() - v.front());
    }
    return res;
}

void solve()
{
    cout << min(calc1(n, m), min(calc1(m, n), min(calc2(n, m), calc2(m, n)))) << '\n';
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    read_input();
    solve();
}



Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)
	var ans float64
	for i := 0; i < n; i++ {
		var ni int
		fmt.Scan(&ni)
		ans += 1.0 / float64(ni)
	}
	fmt.Println(1.0 / ans)
}


Measured memory_bytes: 512
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
#include<cstring>
#include<math.h>
#include<bitset>
#include<queue>
#include<set>
#include<iomanip>
#include<math.h>
#include<assert.h>
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr long long int INFLL = 1LL << 60;
constexpr int INF = 3000000007;
const double INFD = 1e100;
const int mod = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
// ----------------------------------------------------------------------------

int main(){
  int N,X;
  cin >> N >> X;
  vector<int> L(N);
  for(int i=0; i<N; i++){
    cin >> L[i];
  }
  int ans=0;
  int sum=0;
  for(int i=0; i<N; i++){
    sum += L[i];
    if(sum<=X){
      ans++;
    }
  }
  cout << ans+1 << endl;
  return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPR(i, n) for (int i = n - 1; i >= 0; --i)
#define FOR(i, m, n) for (int i = m; i < n; ++i)
#define FORR(i, m, n) for (int i = m; i >= n; --i)
#define ALL(v) (v).begin(),(v).end()
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const ll INF=1LL<<60;
const int inf=(1<<30)-1;
const int mod=1e9+7;
int dx[8]={1,0,-1,0,-1,-1,1,1};
int dy[8]={0,1,0,-1,-1,1,-1,1};
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;cin >> n;
    vector<ll> x(n),y(n),p(n);
    REP(i,n){
        cin >> x[i] >> y[i] >> p[i];
    }
    vector<vector<ll>> hp(1<<n,vector<ll>(n)),wp(1<<n,vector<ll>(n));
    REP(t,1<<n){
        vector<int> h;
        h.push_back(0);
        REP(i,n){
            if(t&(1<<i)){
                h.push_back(x[i]);
            }
        }
        REP(i,n){
            ll res=INF;
            REP(j,h.size()){
                chmin(res,abs(h[j]-x[i]));
            }
            hp[t][i]=res;
        }
    }
    REP(t,1<<n){
        vector<int> w;
        w.push_back(0);
        REP(i,n){
            if(t&(1<<i)){
                w.push_back(y[i]);
            }
        }
        REP(i,n){
            ll res=INF;
            REP(j,w.size()){
                chmin(res,abs(w[j]-y[i]));
            }
            wp[t][i]=res;
        }
    }
    vector<ll> ans(n+1,INF);
    ll T=1;
    REP(i,n){
        T*=3;
    }
    REP(t,T){
        int u=0,v=0;
        int cnt=0;
        int num=t;
        REP(i,n){
            if(num%3==2){
                cnt++;
                u+=1<<i;
            }
            else if(num%3==1){
                cnt++;
                v+=1<<i;
            }
            num/=3;
        }
        ll res=0;
        REP(i,n){
            res+=min(hp[u][i],wp[v][i])*p[i];
        }
        chmin(ans[cnt],res);
    }
    REP(i,n+1){
        cout << ans[i] << endl;
    }
}


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

int main(){
	int N;
  
  cin >> N;
  
  char S[N+1];
  int K;

  cin >> S >> K;
  
  for(int i = 0; i < N; i++){
  	if(S[K-1] != S[i])
      S[i] = '*';
  }
  
  cout << S << "\n" << endl;
  
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(void){
	int n,i,a[101],x,y;
	scanf("%d",&n);
	for(i=1;i<=n;i++){
		scanf("%d",&a[i]);
	}
	if((n%2)==1){
		for(i=1;i<=(n-1)/2;i++){
			x=a[i];y=a[n-i+1];
			a[i]=y;a[n-i+1]=x;
		}
	}
	else{
		for(i=1;i<=n/2;i++){
			x=a[i];y=a[n-i+1];
			a[i]=y;a[n-i+1]=x;
		}
	}
	for(i=1;i<=n-1;i++){
		printf("%d ",a[i]);
	}
	printf("%d\n",a[n]);
	return 0;
}

Measured memory_bytes: 596
/*
	In the name of Allah.
*/
 
#include <iostream>
#include <cstring>
#include <vector>
#include <set>
#include <algorithm>
#include <cmath>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
#define gap ' '
#define INF 999999
 
const int MAXN = 2 * 1e5 + 5;
 
 
int main(){
	vector<int> a(5);
	int ans = 0;
	for(int i = 0; i < 5; ++i){
		cin >> a[i];
		if(a[i] == 0){
			ans = i+1;
		}
	}
	cout << ans << endl;


 
    return 0;
}



Measured memory_bytes: 3164
n,k = gets.chomp.split(" ").map(&:to_i)
ary1 = gets.chomp.split(" ").map(&:to_i)
count =0
nokori = n
while(nokori>0)
  nokori -= k
  if(nokori >0)
    nokori +=1
  end
  count +=1
end
puts count

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

int main() {
 int a, b, c, d;
  cin >> a >> b >> c >> d;
  if(a+b > c+d){
    cout << "Left" << endl;
  }
  else if(a+b == c+d){
    cout << "Balanced" << endl;
  }
  else{
    cout << "Right" << endl;
  }
}

Measured memory_bytes: 384
#include <stdio.h>

void swap(int *a,int *b){
  int tmp = *a;
  *a = *b;
  *b = tmp;
}

int gcd(int a,int b){
  int r;
  if(a < b){
    swap(&a,&b);
  }
  if(b==0){
    return a;
  }
  r = a % b;
  if(r == 0){
    return b;
  }else{
    gcd(r,b);
  }
}

int main(){
  int n;
  int a[100002];
  scanf("%d",&n);
  for(int i=1;i<=n;i++){
    scanf("%d",a+i);
  }
  int x[100002];
  int y[100002];
  x[0] = 0;
  y[n+1] = 0;
  int s,t;
  for(s=1; s<=n; s++){
    t = n - s + 1;
    x[s] = gcd(a[s],x[s-1]);
    y[t] = gcd(a[t],y[t+1]);
  }
  int max = 1;
  int tmp;
  for(int i=1;i<=n;i++){
    tmp = gcd(x[i-1],y[i+1]);
    if(tmp > max) max = tmp;
  }
  printf("%d\n",max);
  return 0;
}

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

using namespace std;
const int N = 2e5 + 5;
int n, m, cnt, t = 2;
vector <int> V[N<<2];

int main() {
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    cin >> n >> m;
    for (int i = 0; i < n; i++) {
        int l, r; cin >> l >> r;
        if (l + 1 == r) {cnt++; continue ;}
        if (l == 0 && r == m + 1) continue ;
        int len = l + m - r + 1;
        if (r == m + 1) V[0].push_back(len);
        else V[r - 1].push_back(r + len - 1);
    }
    priority_queue <int, vector <int>, greater <int>> pq;
    for (int i = 0; i < t * m; i++) {
        for (int j : V[i]) pq.push(j);
        while (!pq.empty() && pq.top() <= i) pq.pop();
        if (!pq.empty()) V[i + m].push_back(pq.top() + m), pq.pop();
    }
    int ans = 0;
    for (int i = t * m; i < t * m + m; i++) ans += V[i].size();
    cout << n - min(ans + cnt, m) << "\n";

    return 0;
}


Measured memory_bytes: 36872
N, W = map(int, input().split())

dp = [[0 for _ in range(W+1)] for _ in range(N+1)]
weight = [0]
value = [0]
for i in range(N):
    w, v = map(int, input().split())
    weight.append(w)
    value.append(v)

for i in range(N):
    i += 1
    for sum_w in range(W+1):
        # i 番目の品物を選ぶ場合
        if sum_w >= weight[i]:
            dp[i][sum_w] = max(dp[i][sum_w], dp[i-1][sum_w - weight[i]] + value[i])
        # i 番目の品物を選ばない場合
        dp[i][sum_w] = max(dp[i][sum_w], dp[i-1][sum_w])

print(dp[N][W])

Measured memory_bytes: 171400
<?php
list($H, $W, $M) = ints();
for ($i = 0; $i < $M; ++$i) {
    list($h, $w) = ints();
    --$h;
    --$w;
    $exist[$h][$w] = true;
    if (isset($row[$h])) ++$row[$h];
    else $row[$h] = 1;
    if (isset($col[$w])) ++$col[$w];
    else $col[$w] = 1;
}
$rowMax = 0;
foreach ($row as $i => $cnt) {
    if ($cnt > $rowMax) {
        $rowMax = $cnt;
        $maxi = [$i];
    }
    if ($cnt === $rowMax) {
        $maxi[] = $i;
    }
}
$colMax = 0;
foreach ($col as $j => $cnt) {
    if ($cnt > $colMax) {
        $colMax = $cnt;
        $maxj = [$j];
    }
    if ($cnt === $colMax) {
        $maxj[] = $j;
    }
}
foreach ($maxi as $i) {
    foreach ($maxj as $j) {
        if (!isset($exist[$i][$j])) {
            echo $rowMax + $colMax;
            exit();
        }
    }
}
echo $rowMax + $colMax - 1;
function ints()
{
    return array_map('intval', explode(' ', trim(fgets(STDIN))));
}


Measured memory_bytes: 193360
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <cstdio>
#include <string>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
static const int MOD = 1e9 + 7;

int dp0[2005][2005];
int dp1[2005][2005];

int main() {
    
    int n, m;
    cin >> n >> m;
    vector<int> s(n+1), t(m+1);
    for (int i = 0; i < n; i++) {
        scanf("%d", &s[i]);
    }
    for (int i = 0; i < m; i++) {
        scanf("%d", &t[i]);
    }
    dp0[0][0] = 1
        ;
    for (int i = 0; i < n+1; i ++) {
        for (int j = 0; j < m+1; j ++) {
            dp0[i+1][j] += (dp0[i][j] % MOD);
            dp0[i+1][j] %= MOD;
            dp1[i][j] += (dp0[i][j] % MOD);
            dp1[i][j] %= MOD;
            dp1[i][j+1] += (dp1[i][j] % MOD);
            dp1[i][j+1] %= MOD;
            if (s[i] == t[j]) {
                dp0[i+1][j+1] += dp1[i][j];
            }
        }
    }

    int ans = dp1[n][m];
    cout << ans << '\n';



}


Measured memory_bytes: 31616
use std::io::stdin;

fn main () {
    let mut n = String::new();
    stdin().read_line(&mut n);
    let mut n: Vec<i32> = n.trim().split_whitespace().map(|i|i.parse().unwrap()).collect();
    n.sort();
    println!("{:?}", n[2] - n[0]);
}


Measured memory_bytes: 4352
#include <cstdio>
#include <cstring>

char str[1000];

int main() {
	// freopen("a.in", "r", stdin);
	while (scanf("%s", str) != EOF) {
		int c = 999;
		int f = -1;
		int len = strlen(str);
		for (int i = 0; i < len; i++) {
			if (str[i] == 'C') {
				if (i < c) c = i;
			}
			if (str[i] == 'F') {
				f = i;
			}
		}
		puts(c<f?"Yes":"No");
	}
	return 0;
}

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

#include <iostream>
//#include <algorithm>
// #include <iomanip>
#define ll long long
#define map unordered_map
#define set unordered_set
#define pll pair<ll, ll>
#define vll vector<ll>
#define mll map<ll, ll>

using namespace std;

const ll MOD = 1000000007LL;
const ll INF = (1LL << 60LL);

int main() {
  ll X;
  scanf("%lld", &X);

  ll r = 0;
  for (ll i = 0; i <= 1000; i++) {
    if (X >= 100 * i && X <= 105 * i) {
      r = 1;
    }
  }

  cout << r << endl;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#define Maxn 200
#define Inf 0x3f3f3f3f
int mp[Maxn+5][Maxn+5];
int n;
int num[Maxn+5];
int sum[Maxn+5];
int f[Maxn+5][Maxn+5];
int mn(int a,int b){
	return a<b?a:b;
}
int mx(int a,int b){
	return a>b?a:b;
}
void floyd(){
	memset(f,0x3f,sizeof f);
	for(int i=1;i<=n;i++){
		for(int j=1;j<=n;j++){
			f[i][j]=(mp[i][j]==0?Inf:1);
		}
		f[i][i]=0;
	}
	for(int k=1;k<=n;k++){
		for(int i=1;i<=n;i++){
			for(int j=1;j<=n;j++){
				f[i][j]=mn(f[i][j],f[i][k]+f[k][j]);
			}
		}
	}
}
int main(){
	scanf("%d",&n);
	int x=0;
	sum[0]=n+1;
	for(int i=1;i<=n;i++){
		for(int j=1;j<=n;j++){
			scanf("%1d",&mp[i][j]);
			sum[i]+=mp[i][j];
		}
		if(sum[i]<sum[x]){
			x=i;
		}
	}
	num[x]=1;
	int mx_sz=1;
	for(int k=1;k<=mx_sz;k++){
		for(int i=1;i<=n;i++){
			if(num[i]==k){
				for(int j=1;j<=n;j++){
					if(mp[i][j]){
						if(num[j]){
							if(num[j]!=k-1&&num[j]!=k+1){
								puts("-1");
								return 0;
							}
						}
						else{
							num[j]=k+1;
							mx_sz=k+1;
						}
					}
				}
			}
		}
	}
	floyd();
	int ans=0;
	for(int i=1;i<=n;i++){
		for(int j=1;j<=n;j++){
			ans=mx(ans,f[i][j]+1);
		}
	}
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 512
#include <stdio.h>
int main(){
  int N,L,S=0;
  scanf("%d %d",&N,&L);
  S=N*L+(N*(N-1))/2;
  if(L>=0) S-=L;
  else if(L+(N-1)<0) S-=L+(N-1);
  printf("%d\n",S);
  return 0;
}


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

int main() {
  int a, b;
  string s;
  cin >> a >> b >> s;
  bool res = true;

  string A = "", B = "";
  for (int i = 0; i < s.size(); i++) {
    if (i < a || i > a) {
      if (i < a) {
        A += s[i];
      } else {
        B += s[i];
      };
      int tmp = s[i] - '0';
      if (!(tmp >= 0 && tmp <= 9)) {
        res = false;
        break;
      }
    } else {
      if (!(s[i] == '-')) {
        res = false;
        break;
      }
    }
  }
  if (!(A + "-" + B == s)) res = false;

  if (res) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
namespace QiFeng233{
	void solve(){
		int x,y,z;
		scanf("%d%d%d",&x,&y,&z);
		printf("%d %d %d",z,x,y);
	}
}
signed main(){
	QiFeng233::solve();
	return 0;
}

Measured memory_bytes: 256
#float型を許すな
#numpyはpythonで
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi,factorial,sin
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def SI(): return input().rstrip()
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7

n,k=MI()
lis=LI()
for i in range(n-k):
    if lis[i]<lis[i+k]:
        print("Yes")
    else:
        print("No")
        



        
    
    


    


    


Measured memory_bytes: 31968
#include <bits/stdc++.h>
//---------------------------
using namespace std;
//---------------------------
#define REP(i,n) for(int i = 0; i < (n); i++)
#define P(x) cout << (x) << "\n"

#define MOD 1000000007 // 1e9+7
#define PI acos(-1.0)
#define ll long long int // 10^18
#define INF 1000000001 // 1e9+1

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

ll power2(ll n){
  ll res=1;
  while(n>0){
    res*=2;
    res%=MOD;
    n--;
  }
  return res;
}

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

  // ifstream in("input.txt");
  // cin.rdbuf(in.rdbuf());

  int n;cin>>n;
  bool flag=false;
  if(n%2==0){
    int arr[100000]={};
    REP(i,n){
      int a;cin>>a;
      if(a%2==0){
        flag=true;
        break;
      }else{
        arr[(a-1)/2]++;
      }
    }
    REP(i,n/2){
      if(arr[i]!=2){
        flag=true;
        break;
      }
    }
    if(flag){
      P(0);
      return 0;
    }else{
      P(power2(n/2));
      return 0;
    }
  }
  if(n%2==1){
    int arr2[100000]={};
    REP(i,n){
      int a;cin>>a;
      if(a%2==1){
        flag=true;
        break;
      }else{
        arr2[a/2]++;
      }
    }
    REP(i,n/2){
      if(arr2[0]!=1){
        flag=true;
        break;
      }
      if(i!=0 && arr2[i]!=2){
        flag=true;
        break;
      }
    }
    if(flag){
      P(0);
      return 0;
    }else{
      P(power2((n-1)/2));
      return 0;
    }
  }
  return 0;
}


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

int main() {
	std::ios::sync_with_stdio(false);
	
	std::string str;
	std::string now;
	
	std::cin >> str;

	for (int i = 0; i < str.length(); i++) {
		if (str[i] == 'T' && now.size() != 0 && now.back() == 'S')
			now.pop_back();
		else
			now.push_back(str[i]);
	}

	std::cout << now.length() << std::endl;
}

Measured memory_bytes: 916
#include <iostream>
#include <iomanip> // << fixed << setprecision(xxx)
#include <algorithm> // do { } while ( next_permutation(A, A+xxx) ) ;
#include <vector>
#include <string> // to_string(nnn) // substr(m, n) // stoi(nnn)
#include <complex>
#include <tuple> // get<n>(xxx)
#include <queue>
#include <stack>
#include <map> // if (M.find(key) != M.end()) { }
#include <set> // S.insert(M);
// if (S.find(key) != S.end()) { }
// for (auto it=S.begin(); it != S.end(); it++) { }
// auto it = S.lower_bound(M);
#include <random> // random_device rd; mt19937 mt(rd());
#include <cctype>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib> // atoi(xxx)
using namespace std;

#define DEBUG 0 // change 0 -> 1 if we need debug.
// insert #if<tab> by my emacs. #if DEBUG == 1 ... #end

typedef long long ll;

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

// const int C = 1e6+10;
// const ll M = 1000000007;

int N;
ll T;
ll t[200010];

int main () {
  cin >> N >> T;
  for (auto i = 0; i < N; ++i) {
    cin >> t[i];
  }
  ll ans = 0;
  ll now = 0;
  ll from = 0;
  for (auto i = 0; i < N; ++i) {
    if (now + T < t[i]) {
      ans += now + T - from;
      from = t[i];
      now = t[i];
    } else {
      now = t[i];
    }
  }
  ans += now + T - from;
  cout << ans << endl;
}


Measured memory_bytes: 1792
N, M = map(int, input().split())

minimum = 0
maximum = 10**8
for _ in range(M):
    L, R = map(int, input().split())
    minimum = L if minimum < L else minimum
    maximum = R if R < maximum else maximum
maximum = N if N < maximum else maximum

print(max(min(maximum - minimum + 1, N), 0))


Measured memory_bytes: 3060
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <queue>
#include <iostream>
#include <string.h>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <cstdint>
#include <climits>
#include <unordered_set>
#include <sstream>
#include <stack>

using namespace std;

#define ll long long int

ll n;
vector<ll> vs;
vector<ll> buf;

bool ok()
{
    for(auto e: vs)
    {
        if(e >= n)
        {
            return false;
        }
    }
    return true;
}

int main()
{
    cin >> n;
    vs.resize(n);
    buf.resize(n);
    for(int i = 0;i < n;i++)
    {
        cin >> vs[i];
    }
    ll sum = 0;
    while(!ok())
    {
        fill(buf.begin(), buf.end(), 0);
        ll c = 0;
        for(int i = 0;i < n;i++)
        {
            buf[i] += vs[i] / n;
            c += buf[i];
        }
        for(int i = 0;i < n;i++)
        {
            ll diff = buf[i] * n - (c - buf[i]);
            vs[i] -= diff;
        }
        sum += c;
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 256