akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

int main(){
    string s;
    cin>>s;
    int cnt=1,ans=1;
    int ls=1,ts=-1;
    while(cnt<s.size()){
        ts=1;
        if(ls!=ts){
            ++ans;
        }
        else{
            if(s[cnt-1]==s[cnt]){
                if(cnt==s.size()-1)break;
                ++ans;
                ++cnt;
                ts=2;
            }
            else{
                ++ans;
                ts=1;
            }
        }
        ls=ts;
        ++cnt;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 1152
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define TRACE
#ifdef TRACE
#define tr(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define tr(...)
#endif

#define ll long long
#define ld long double 
#define endl "\n"
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(a) (ll)(a.size())
#define all(a) a.begin(), a.end() 
#define fr(i,n) for(i=1;i<=n;i++)
#define rp(i,n) for(i=0;i<n;i++)
#define FIO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
// order_of_key (val): returns the no. of values less than val
// find_by_order (k): returns the iterator to kth largest element.(0-based)
typedef pair<ll, ll> ii;
typedef vector<ll> vl;
const ll N = 200010;
ll mod=1e9+7;

ll ffmod(ll x, ll y, ll mod)
{
    ll rt=1;
    while(y)
    {
        if(y&1ll) rt=(rt*x)%mod;
        x=(x*x)%mod, y/=2ll;
    }
    return rt;
}

ll h[N], dp[N];

int main()
{
    FIO;
    ll n,i,j,k;
    cin>>n>>k;
    fr(i,n) cin>>h[i];
    fr(i,n) dp[i]=mod;
    dp[1]=0;
    for(i=2;i<=n;i++)
        for(j=i-1;j>0 && i-j<=k;j--)
            dp[i]=min(dp[i], dp[j]+abs(h[i]-h[j]));
    cout<<dp[n]<<endl;
    return 0;
}


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

typedef long long int ll;

int main()
{
    ll a, b;
    string s, t, u;
    cin >> s >> t >> a >> b >> u;

    if(s == u){
        cout << a - 1 << " " << b;
    }
    else{
        cout << a << " " << b - 1;
    }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int x,n;
  cin >> x >> n;
  int a[n];
  for(int i=0;i<n;i++)	cin >> a[i];
  sort(a,a+n);
  int ans1=0;
  int ans2=0;
  for(int i=x;i>=0;i--){
    if(!binary_search(a,a+n,i)){
      ans1=i;	break;
    }
  }
  for(int i=x;i<100000;i++){
    if(!binary_search(a,a+n,i)){
      ans2=i;	break;
    }
  }
  
  if(min(abs(ans1-x),abs(ans2-x))==abs(x-ans1))	cout << ans1 << endl;
  else	cout << ans2 << endl;
  return 0;
}

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


Measured memory_bytes: 5596
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!{
       a: usize,
       b: usize,
    }
    if (a * b) % 2 == 0 { println!("Even"); } else { println!("Odd"); }
}


Measured memory_bytes: 4352
#include "iostream"
#include "vector"
#include "string"
#include "algorithm"
#include "math.h"
#include "cstring"
#include "stack"
#include "queue"

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;


const int MAX_N = 100;
const int MAX_M = 100;
struct UnionFind
{
  int par[MAX_N];	//親
  int height[MAX_N];	//木の深さ
  int size[MAX_N];

	//n要素で初期化
  void init(int n)
  {
    for (int i = 0; i < n; i++)
    {
      par[i] = i;
      height[i] = 0;
      size[i] = 1;
    }
  }

	//木の根を求める
  int find(int x)
  {
    if (par[x] == x)
    {
      return x;
    }
    else
    {
      return par[x] = find(par[x]);
    }
  }

	//xとyの属する集合を併合
  void unite(int x, int y)
  {
    x = find(x);
    y = find(y);
    if (x == y)
    {
      return;
    }

    if (height[x] < height[y])
    {
      par[x] = y;
      size[y] = size[x] + size[y];
    }
    else
    {
      par[y] = x;
      size[x] = size[x] + size[y];
      if (height[x] == height[y])
      {
        height[x]++;
      }
    }
  }

	//xとyが同じ集合に属するか否か
  bool same(int x, int y)
  {
    return find(x) == find(y);
  }
};

int main()
{
  int n, m;
  cin >> n >> m;
  int a[MAX_M], b[MAX_M];
  for (int i = 0; i < m; i++)
  {
    cin >> a[i] >> b[i];
    a[i]--;
    b[i]--;
  }
  int ans = 0;
  for (int i = 0; i < m; i++)
  {
    UnionFind uf;
    uf.init(n);
    for (int j = 0; j < m; j++)
    {
      if (j != i)
      {
        uf.unite(a[j], b[j]);
      }
    }
    if (!uf.same(a[i], b[i]))
    {
      ans++;
    }
  }
  cout << ans << "\n";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int H,W;
  vector<int> directionx = {1,0,-1,-1,-1,0,1,1};
  vector<int> directiony = {1,1,1,0,-1,-1,-1,0};
  cin >> H >> W;
  vector<string> blocks(H);
  for(int i = 0; i<H; i++){
    cin >> blocks.at(i);
  }
    
  int num;
  for(int ih = 0; ih<H; ih++){
    for(int iw = 0; iw<W; iw++){
      if(blocks.at(ih).at(iw) == '.'){
        num = 0;
        for(int i = 0; i<8; i++){
          if(ih + directionx.at(i) < 0 || ih + directionx.at(i) >= H) continue;
          if(iw + directiony.at(i) < 0 || iw + directiony.at(i) >= W) continue;
          if(blocks.at(ih + directionx.at(i)).at(iw + directiony.at(i)) == '#') num++;
        }
        blocks.at(ih).at(iw) = to_string(num).at(0);
      }
    }
    cout << blocks.at(ih) << endl;
  }
}

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

int n=50;
int m=2500;
set<int>adj[50];
vector<pair<int,int>>edges;
bool marked[50];
int c=0;
void dfs(int s)
{
	marked[s]=true;
	c++;
	for(auto x:adj[s])
	{
	
		if(!marked[x]){
			//cout<<x<<" ";
			dfs(x);
		}
	}
	
}



int main()
{
	for(int i=0;i<50;i++)
		marked[i]=false;
	cin>>n>>m;
	for(int i=0;i<m;i++)
	{
		int a,b;
		cin>>a>>b;
		a--;b--;
		adj[a].insert(b);
		adj[b].insert(a);
		edges.push_back({a,b});
	}
	int count=0;
	for(int i=0;i<m;i++)
	{
		int a = edges[i].first;
		int b = edges[i].second;
		adj[a].erase(b);
		adj[b].erase(a);
		dfs(0);
		if(c<n){
			count++;
			//cout<<c<<" ";
		}
		c=0;
		adj[a].insert(b);
		adj[b].insert(a);
		for(int i=0;i<50;i++)
			marked[i]=false;
	}

	cout<<count<<"\n";

}

Measured memory_bytes: 3644
require 'prime'
include Math
def max(a,b);              a > b ? a : b                              end
def min(a,b);              a < b ?  a : b                             end
def swap(a,b);             a, b = b, a                                end
def gif;                   gets.to_i                                  end
def gff;                   gets.to_f                                  end
def gsf;                   gets.chomp                                 end
def gi;                    gets.split.map(&:to_i)                     end
def gf;                    gets.split.map(&:to_f)                     end
def gs;                    gets.chomp.split.map(&:to_s)               end
def gc;                    gets.chomp.split('')                       end
def pr(num);               num.prime_division                         end
def digit(num);            num.to_s.length                            end
def array(s,ini=nil);      Array.new(s){ini}                          end
def darray(s1,s2,ini=nil); Array.new(s1){Array.new(s2){ini}}          end
def rep(num);              num.times {|i|yield(i)}                    end
def repl(st,en,n=1);       n*= -1 if st>en;st.step(en,n){|i|yield(i)} end
n = []
rep 3 do
	n << gif
end
puts (n[0]+n[1])*n[2]/2


Measured memory_bytes: 2044
#include<stdio.h>
int main()
{
    int a, b, c, d, e;

    scanf("%d %d %d", &a, &b, &c);

    d = a * c;
    if(d<=b){
        printf("%d\n", c);
    }else if(d>b){
        e = b / a;
        printf("%d\n", e);
    }



    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>

using namespace std;

#define REP(i,k,n) for(int i=k;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define all(v) v.begin(),v.end()
#define EXIST(c,e) ( (c).find( e ) != (c).end() )
#define INF 1<<30
#define mp make_pair
#define pb push_back

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
typedef vector<pair<int, int> > vp;
typedef map<int,int> mpii;
typedef priority_queue<int, vi, greater<int> > pqi;

typedef long long ll;


int main(){
	vvi a(3,vi(3));
	rep(i,3) rep(j,3) cin>>a[i][j];

	vvi b;
	b = a;
	rep(i,3){
		int s = min(b[i][0],min(b[i][1],b[i][2]));
		b[i][0]-=s;
		b[i][1]-=s;
		b[i][2]-=s;
	}
	bool f = true;
	rep(i,3){
		f &= (b[0][i] == b[1][i] && b[1][i] == b[2][i]);
	}

	if(f){
		cout<<"Yes"<<endl;
		return 0;
	}

	b = a;
	rep(i,3){
		int s = min(b[0][i],min(b[1][i],b[2][i]));
		b[0][i]-=s;
		b[1][i]-=s;
		b[2][i]-=s;
	}
	f = true;
	rep(i,3){
		f &= (b[i][0] == b[i][1] && b[i][1] == b[i][2]);
	}

	if(f) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<cstdlib>
#include<tuple>
#include<iomanip>
#include<stack>
#include<map>
#include<queue>
#include<set>
#define int long long
using namespace std;
const int INF = 1e10;
const int ZERO = 0;

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = (int)(a); i <= (int)(n); ++i)
#define rrep(i, a, n) for (int i = (int)(a); i >= (int)(n); --i)
#define debug(x) cerr << #x << " = " << x << "\n"
#define debugv(x) \
  rep(f, 0, (x.size() - 1)) cerr << x[f] << (f == (x.size() - 1) ? "\n" : " ")
#define all(x) x.begin(), x.end()
#define int long long
using namespace std;
typedef pair<int, int> pii;
typedef vector<int> vi;
const int MX = 1e5 + 5, INF = 5 << 28, MOD = 1e9 + 7;

int N, M;
vi T;
vector<pii> P;
void input() {
  cin >> N;
  T.resize(N);
  rep(i, 0, N - 1) { cin >> T[i]; }
  cin >> M;
  P.resize(M);
  rep(i, 0, M - 1) {
    int p, x;
    cin >> p >> x;
    p--;
    P[i] = pii(p, x);
  }
}
void solve() {
  int allsum = 0;
  for (auto x : T) {
    allsum += x;
  }
  rep(i, 0, M - 1) {
    int pr = P[i].first;
    cout << allsum - T[pr] + P[i].second << endl;
  };
  ;
}
signed main() {
  input();
  solve();
  return 0;
}

Measured memory_bytes: 256
# unihernandez22 & Vicfred
# https://atcoder.jp/contests/abc166/tasks/abc166_d
# math, probability
from random import randint

n = int(input())

for _ in range(10**6):
    x = randint(-200,200)
    y = randint(-200,200)
    if x**5 - y**5 == n:
        print(x,y)
        break;



Measured memory_bytes: 9468
#include <iostream>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <functional>
using namespace std;
#define int long long
#define All(v) (v).begin(),(v).end()
int dy[8] = {-1,0,1,0,-1,1,1,-1};
int dx[8] = {0,1,0,-1,1,1,-1,-1};
const int mod = 1000000007;
const int inf = mod*mod;
const int d5 = 100100;
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s;
    cin>>s;
    if(s[0]!=s[1]||s[1]!=s[2])cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

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

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep3(i,m,n) for(int (i)=m;(i)<=(n);(i)++)
#define rep3rev(i,m,n) for(int (i)=m;(i)>=(n);(i)--)
#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second

typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef pair<int, int> pii;

void Main()
{
	ll n, m;
  	cin >> n >> m;
  	ll ans = min(n,m/2);
  	if(2*n < m){
      	ll temp = m - 2*n;
      	ans += temp/4;
    }
 	cout << ans << endl;
	return;
}

int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=1000000007,MAX=200005,INF=1<<30;

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    string S;cin>>S;
    if(S=="hi"||S=="hihi"||S=="hihihi"||S=="hihihihi"||S=="hihihihihi") cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}



Measured memory_bytes: 256
# Union Find 木
from sys import setrecursionlimit


def find(parent, i):
    t = parent[i]
    if t < 0:
        return i
    t = find(parent, t)
    parent[i] = t
    return t


def unite(parent, i, j):
    i = find(parent, i)
    j = find(parent, j)
    if i == j:
        return
    parent[j] += parent[i]
    parent[i] = j


setrecursionlimit(10 ** 5)

N, M = map(int, input().split())
ab = [[int(c) - 1 for c in input().split()] for _ in range(M)]

result = 0
for i in range(M):
    parent = [-1] * N
    for j in range(M):
        if j == i:
            continue
        unite(parent, ab[j][0], ab[j][1])
    if len([i for i in parent if i < 0]) != 1:
        result += 1
print(result)

Measured memory_bytes: 3064
#include <iostream>
#include <string>
using namespace std;
const int maxn = 2e5+100;
int a[maxn];
int main(){
    int n;
    cin >> n;
    int odd = 0, even = 0, mul4 = 0;
    for(int i=0;i<n;i++){
        cin >> a[i];
        if(a[i] % 4 == 0) mul4++;
        else if(a[i]&1) odd++;
        else even++;
    }
    if(even) odd++;
    if(odd - mul4 > 1) {
        cout << "No" << endl;
    }
    else {
        cout << "Yes" << endl;
    }


    return 0;
}


Measured memory_bytes: 640
import sys


def work():
    n = int(input())
    s = sys.stdin.readline()
    if n % 2 == 1: print "No"
    else :
        for i in range(n / 2):
            if s[i] != s[i + n / 2]:
		print "No"
		return
	print "Yes"

work()



Measured memory_bytes: 2568
import java.util.*;
import java.io.*;
class Main {
    static long[][] dp1;
    static long recurse1(long[] a, int i, int j) {
        if(i>j)
            return 0;
        if(i==j)
            return a[i];
        if(dp1[i][j]!=-1)
            return dp1[i][j];
        long max = Math.max(a[i]-recurse1(a, i+1, j), a[j]-recurse1(a, i, j-1));
        return dp1[i][j] = max;
    }
    public static void main (String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long[] a = new long[n];
        for(int i = 0; i<n; i++)
            a[i] = sc.nextLong();
        dp1 = new long[n][n];
        for(long[] i: dp1)
            Arrays.fill(i, -1);
        System.out.println(recurse1(a, 0, n-1));
    }
}

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

#define int long long
#define endl "\n"
#define REP(i,a,n) for(int i=a;i<n;++i)
#define REPR(i,a,n) for(int i=a;i>n;--i)
#define RUP(a,b) ((a+b-1)/(b))
#define SORTG(v) sort(v.begin(),v.end(),greater<>())
#define SORT(v) sort(v.begin(),v.end())
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define MOD 1000000007
#define INF LLONG_MAX/3

typedef long long ll;
typedef pair<int,int> Pii;
typedef tuple<int,int,int> Tiii;
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef vector<string> Vs;

template<class T> void chmax(T& a, T b) {if(a<b){a=b;}}
template<class T> void chmin(T& a, T b) {if(a>b){a=b;}}
void YesNo(int a){cout<<((a)?"Yes":"No")<<endl;}
void YESNO(int a){cout<<((a)?"YES":"NO")<<endl;}
void AorB(int a,string b,string c){cout<<((a)?b:c)<<endl;}
int gcd(int a,int b){return b?gcd(b,a%b):a;}
void start(){cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);}

signed main(){start();
    int n,m,ans=0;
    cin>>n>>m;
    Vi l(m),r(m),a(n);
    REP(i,0,m){
        cin>>l[i]>>r[i];
        l[i]--;r[i]--;
        a[l[i]]++;
        if(r[i]+1<n) a[r[i]+1]--;
    }
    REP(i,1,n) a[i]+=a[i-1];
    REP(i,0,n) if(a[i]==m) ans++;
    cout<<ans<<endl;
}


Measured memory_bytes: 2560
#include <iostream>
using namespace std;
int main(){
  int n;cin>>n;
  long long a[n];
  for(int i = 0; n > i; i++){
    cin>>a[i];
  }
  long long ans = 0;
  long long sm = 0;
  long long smx = 0;
  int prev = 0;
  for(int i = 0; n > i; i++){
    sm += a[i];
    smx ^= a[i];
    while(sm != smx){
      sm -= a[prev];
      smx ^= a[prev];
      prev++;
    }
    ans += i-prev+1;
  }
  cout << ans << endl;
}

Measured memory_bytes: 1920
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int inf = 1000000000; //10^9

int main(void){
    string a, b;
    cin >> a >> b;
    string moji = a + b;
    int num = atoi(moji.c_str());
    for (int i = 1; i < 1000; i++){
        if(i * i == num){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include <algorithm>
#include <string>
#include<vector>
#include<tuple>
#include<iomanip>
//AtCoderC++.cpp

using namespace std;

template<typename T> void Show(const vector<vector<T>>& v, string delimiter = " ") {
	for (int i = 0; i < v.size(); i++) {
		for (int j = 0; j < v[i].size(); j++) {
			cout << v[i][j];
			if (j != v[i].size() - 1) {
				cout << delimiter;
			} else {
				cout << endl;
			}
		}
	}
}
template<typename T> void Show(const vector<T>& v, string delimiter = " ") {
	for (int i = 0; i < v.size(); i++) {
		cout << v[i];
		if (i != v.size() - 1) {
			cout << delimiter;
		} else {
			cout << endl;
		}
	}
}
template<typename T> vector<T> getUniform(T value, int n) {
	vector<vector<T>> ts;
	ts.resize(n);
	for (int i = 0; i < n; i++) {
		ts[i] = value;
	}
	return ts;
}
template<typename T> vector<vector<T>> getUniform(T value, int row, int col) {
	vector<vector<T>> ts;
	ts.resize(row);
	for (int i = 0; i < row; i++) {
		ts[i].resize(col);
		for (int j = 0; j < col; j++) {
			ts[i][j] = value;
		}
	}
	return ts;
}
bool All(vector<vector<bool>> ts) {
	int h = ts.size();
	int w = ts[0].size();
	for (int i = 0; i < h; i++)
		for (int j = 0; j < w; j++)
			if (!ts[i][j])return false;
	return true;
}

vector<string> split(string& content, char delim) {
	auto ss = vector<string>();
	string s = "";
	for (size_t i = 0; i < content.length(); i++) {
		if (content[i] == delim) {
			ss.push_back(s);
			s = "";
			continue;
		}
		s += content[i];
	}
	if (s != "")ss.push_back(s);
	return ss;
}

int main() {
	int n, x; cin >> n >> x;
	int count = 0;
	int d = 0; int l;
	for (size_t i = 0; i < n; i++) {
		if (x >= d)count++;
		cin >> l;
		d += l;
	}
	if (x >= d)count++;
	cout << count << endl;
}



Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstdio>
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);(i)++)
using namespace std;

int main()
{
  while(1){
    int N, T, L, B;
    cin >> N >> T >> L >> B;
    if(N == 0 && T == 0 && L == 0 && B == 0) break;
    bool lose[101] = {}, back[101] = {};
    FOR(i,0,L){
      int x;
      cin >> x;
      lose[x] = true;
    }
    FOR(i,0,B){
      int x;
      cin >> x;
      back[x] = true;
    }
    double board[N+1] = {}, next_board[N+1] = {};
    board[0] = 1;
    double skip1[N] = {}, skip2[N] = {}, skip3[N] = {};
    double ans = 0;
    while(T > 0){
      T--;
      copy(skip2,skip2+N,skip3);
      FOR(i,0,N) board[i] += skip3[i];
      copy(skip1,skip1+N,skip2);
      fill(next_board,next_board+N+1,0);
      fill(skip1,skip1+N,0);
      FOR(i,0,N){
        FOR(j,1,7){
          int n = i+j;
          if(n > N) n = 2*N-n;
          if(back[n]){
            n = 0;
          }else if(lose[n]){
            skip1[n] += board[i]/6;
            continue;
          }
          next_board[n] += board[i]/6;
        }
      }
      ans += next_board[N];
      copy(next_board,next_board+N,board);
    }
    printf("%.6lf\n", ans);
  }
}

Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <bitset>
#include <map>
#include <tuple>
#include <unordered_map>
#include <list>
#include <numeric>
#include <utility>
#include <iterator>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <ctime>
#include <cassert>
#include <random>

#define INF 1000000000
#define LINF 9000000000000000000
#define mod 1000000007

#define rep(i,n) for(int i=0;i<int(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define REP(i,a,b) for(int i=(a);i<int(b);i++)
#define all(x) (x).begin(),x.end()
#define pb push_back
#define mp make_pair

using namespace std;

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

int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
int ddx[8]={-1,-1,0,1,1,1,0,-1};
int ddy[8]={0,1,1,1,0,-1,-1,-1};
bool debug=false;

/*---------------------------------------------------*/

int main(){
  ll N, M;
  cin >> N >> M;
  
  map<ll, ll> mp;
  vector<ll> A(N), B(N + 1, 0);
  rep(i, N) cin >> A[i];

  for(int i = 0; i < N; i++) B[i + 1] += B[i] + A[i];
  for(int i = 0; i < N + 1; i++) B[i] = B[i] % M, mp[B[i]]++;

  ll ans = 0;
  for(auto itr = mp.begin(); itr != mp.end(); itr++){
    ans += (itr->second * (itr->second - 1)) / 2;
  }
  cout << ans << endl;
}


Measured memory_bytes: 5760
import sys
from collections import deque
import copy

from math import *

def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline


def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func().strip().split()
    [A1, A2, A3] =  [int(input_raw[0]), int(input_raw[1]), int(input_raw[2])]
    print   min(abs(A1 - A2) + abs(A2 - A3) ,abs(A1 - A3) + abs(A3 - A2),
                abs(A2 - A1) + abs(A1 - A3), abs(A2 - A3) + abs(A3 - A1),
                abs(A3 - A1) + abs(A1 - A2), abs(A3 - A2) + abs(A3 - A1))

if __name__ == '__main__':
    main()


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

using namespace std;

int main(){
    int n;
    cin>>n;
    int tle=0,wa=0,ac=0,re=0;
    for(int i=0;i<n;i++){
        string s;
        cin>>s;
        // cout<<s[0];
        switch(s[0]){
            case 'T':tle++;break;
            case 'W':wa++;break;
            case 'A':ac++;break;
            case 'R':re++;
        }
    }
    cout<<"AC x "<<ac<<endl;
    cout<<"WA x "<<wa<<endl;
    cout<<"TLE x "<<tle<<endl;
    cout<<"RE x "<<re<<endl;
}

Measured memory_bytes: 3628
// clang-format off
#include <bits/stdc++.h>

#define mp make_pair
#define fst first
#define snd second
#define forn(i,n) for (int i = 0; i < int(n); i++)
#define forn1(i,n) for (int i = 1; i <= int(n); i++)
#define popcnt __builtin_popcount
#define ffs __builtin_ffs
#define ctz __builtin_ctz
#define clz __builtin_clz
#define all(a) (a).begin(), (a).end()
 
using namespace std;

using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pli = pair<ll,int>;
using pil = pair<int,ll>;
using pll = pair<ll,ll>;
template <typename T> using vec = vector<T>;
using vi = vec<int>;
using vl = vec<ll>;
template <typename T> using que = queue<T>;
template <typename T> using deq = deque<T>;

template <typename T> T id(T b) {return b;};
template <typename T> void chmax(T &x, T y) {if (x < y) x = y;}
template <typename T> void chmin(T &x, T y) {if (x > y) x = y;}
template <typename S, typename K> bool contains(S &s, K k) { return s.find(k) != s.end(); }
void fastio() { ios_base::sync_with_stdio(false); cin.tie(nullptr); }
constexpr ll TEN(int n) { if (n == 0) return 1LL; else return 10LL*TEN(n-1); }
// clang-format on

int main() {
    fastio();
    int k;
    string s;
    cin >> k >> s;

    if (s.size() <= k) {
        cout << s << endl;
    } else {
        cout << s.substr(0, k) << "..." << endl;
    }

    return 0;
}

Measured memory_bytes: 3644
#include "bits/stdc++.h"
using namespace std;

int main() {
	int m1, m2;
	int d1, d2;

	cin >> m1 >> d1;
	cin >> m2 >> d2;

	if (m1 != m2) {
		cout << "1" << endl;
	}
	else {
		cout << "0" << endl;
	}
}

Measured memory_bytes: 256
let N = Int(readLine()!)!
let A = readLine()!.split(separator: " ").map { Int($0)! }
let Q = Int(readLine()!)!

var table: [Int: Int] = [:]

var sum = 0
for num in A {
  sum += num
  table[num, default: 0] += 1
}

for _ in 0..<Q {
  let inputs = readLine()!.split(separator: " ").map { Int($0)! }
  
  let from = inputs[0]
  let to = inputs[1]
  
  if let count = table[from] {
    let diff = (to - from) * count
    sum += diff
    table[from] = nil
    table[to, default: 0] += count
  }
  print(sum)
}

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

#define rng(i, a, b) for(int i = int(a); i < int(b); i++)
#define rep(i, b) rng(i, 0, b)
#define urng(i, a, b) for(int i = int(b) - 1; i >= int(a); i--)
#define urep(i, b) urng(i, 0, b)
#define pb push_back
#define eb emplace_back
#define F first
#define S second
#define bg begin()
#define ed end()
#define all(x) x.bg,x.ed

int main() {
  int n, a, b, ans = 0;
  string s, t, u;
  cin >> s >> t >> a >> b >> u;
  //vector<int> v(n), c(n);
  //if(1) {}
  //((a == b)? "Yes" : "No")
  //for(int i = 0; i < n; i++){}
  cout << a - (s == u) << " " << b - (u == t) << endl;
}

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

#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0, a1, a2, a3, a4, x, ...) x
#define dump_1(x1) cerr << #x1 << ": " << x1 << endl
#define dump_2(x1, x2) \
  cerr << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << endl
#define dump_3(x1, x2, x3)                                                \
  cerr << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " \
       << x3 << endl
#define dump_4(x1, x2, x3, x4)                                            \
  cerr << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " \
       << x3 << ", " #x4 << ": " << x4 << endl
#define dump_5(x1, x2, x3, x4, x5)                                        \
  cerr << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " \
       << x3 << ", " #x4 << ": " << x4 << ", " #x5 << ": " << x5 << endl
#define dump(...) \
  CHOOSE((__VA_ARGS__, dump_5, dump_4, dump_3, dump_2, dump_1, ~))(__VA_ARGS__)
#define check(s) cerr << s << endl

#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define unique(v) v.erase(unique(v.begin(), v.end()), v.end());
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)

using namespace std;

using ll = long long;

vector<int> dx = {0, 1, 0, -1};
vector<int> dy = {1, 0, -1, 0};

const ll LINF = 2e18;
const int INF = 1e9;

ll N, M;
std::vector<ll> x, y;
vector<vector<ll>> G;
vector<ll> dp;

ll f(ll v) {
  if (dp.at(v) != -1) return dp.at(v);
  ll xs = 0;
  for (auto nv : G.at(v)) {
    chmax(xs, f(nv) + 1);
  }
  return dp.at(v) = xs;
}

void solve() {
  G.resize(N);
  rep(i, M) { G.at(x.at(i)).push_back(y.at(i)); }
  dp.resize(N, -1);

  ll ans = 0;
  rep(i, N) { chmax(ans, f(i)); }
  cout << ans << endl;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);

  scanf("%lld", &N);
  scanf("%lld", &M);
  x.resize(M);
  y.resize(M);
  for (int i = 0; i < M; i++) {
    scanf("%lld", &x[i]);
    scanf("%lld", &y[i]);
    // 0-indexed
    x.at(i)--;
    y.at(i)--;
  }
  solve();
  return 0;
}


Measured memory_bytes: 13124
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#include<iostream>
#include<unordered_set>

using namespace std;

#define dprint(Exp,...) if(Exp){fprintf(stderr, __VA_ARGS__);}
#define printe(...) fprintf(stderr, __VA_ARGS__);
#define PrtExp(_Exp)  cerr<< #_Exp <<" = "<< (_Exp)
#define PrtExpN(_Exp)  cerr<< #_Exp <<" = "<< (_Exp) <<"\n"

#define SINT(n) scanf("%d",&n)
#define SINT2(n,m) scanf("%d %d",&n,&m)
#define SINT3(n,m,o) scanf("%d %d %d",&n,&m,&o)
#define SINT4(n,m,o,P) scanf("%d %d %d %d",&n,&m,&o,&P)
#define SINT5(n,m,o,P,q) scanf("%d %d %d %d %d",&n,&m,&o,&P,&q)
#define SLL(n) scanf("%lld",&n)
#define SLL2(n,m) scanf("%lld %lld",&n,&m)
#define SLL3(n,m,o) scanf("%lld %lld %lld",&n,&m,&o)
#define SST(s) scanf("%s",s)
#define SCH(c) scanf("%c",&c)

#define GC() getchar()

#define PINT(n) printf("%d",(int)(n))
#define PINT2(n,m) printf("%d %d",(int)(n),(int)(m))
#define PINT3(n,m,l) printf("%d %d %d",(int)(n),(int)(m),(int)(l))
#define PLL(n) printf("%lld",(long long)(n))
#define PST(s) printf("%s",(s))
#define PCH(s) printf("%c",(s))

#define PINTN(n) printf("%d\n",(int)(n))
#define PINT2N(n,m) printf("%d %d\n",(int)(n),(int)(m))
#define PINT3N(n,m,l) printf("%d %d %d\n",(int)(n),(int)(m),(int)(l))
#define PLLN(n) printf("%lld\n",(long long)(n))
#define PSTN(s) printf("%s\n",(s))
#define PCHN(s) printf("%c\n",(s))

#define PSP() printf(" ")
#define PN() printf("\n")

#define PC(c) putchar(c)
#define CSP (' ')
#define SN ("\n")

#define rep(i,a) for(int i=0;i<a;i++)
#define reP(i,a) for(int i=0;i<=a;i++)
#define Rep(i,a) for(int i=a-1;i>=0;i--)
#define ReP(i,a) for(int i=a;i>=0;i--)

#define rEp(i,a) for(i=0;i<a;i++)
#define rEP(i,a) for(i=0;i<=a;i++)
#define REp(i,a) for(i=a-1;i>=0;i--)
#define REP(i,a) for(i=a;i>=0;i--)

#define repft(i,a,b) for(int i=a;i<b;i++)
#define repfT(i,a,b) for(int i=a;i<=b;i++)
#define Repft(i,a,b) for(int i=a-1;i>=b;i--)
#define RepfT(i,a,b) for(int i=a;i>=b;i--)

#define foreach(a,it) for(auto it = a.begin(); it != a.end(); ++it)

#define FILL(a,v) fill(begin(a),end(a), v)
#define FILL0(a) memset(a,0,sizeof(a))
#define FILL1(a) memset(a,-1,sizeof(a))

typedef long long ll;

typedef unsigned long long ull;
typedef pair<int, int> Pi;
typedef pair<ll, ll>   Pll;


const int INF = 1010000000; // 0x3C33'6080
const ll INFLL = 0x1f1f1f1f1f1f1f1fLL;//2,242,545,357,980,376,863

template <class A, class B> inline ostream& operator<<(ostream& st, const pair<A, B>& P) { return st << "(" << P.first << "," << P.second << ")"; };
template <class A, class B> inline pair<A, B> operator+(const pair<A, B>& P, const pair<A, B>& Q) { return pair<A, B>(P.first + Q.first, P.second + Q.second); };
template <class A, class B> inline pair<A, B> operator-(const pair<A, B>& P, const pair<A, B>& Q) { return pair<A, B>(P.first - Q.first, P.second - Q.second); };

#define fs  first
#define sc  second


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

	int ret = INF;
	rep(i, n) {
		int a, b;
		cin >> a >> b;
		if (b <= t) ret = min(ret, a);
	}
	if (ret == INF) {
		cout << "TLE" << endl;
	} else {
		cout << ret << endl;
	}

}

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

int main() {
	string s;
    cin >> s;
    int ans = 0;
    int n = s.size();
    for (int i = 0, rc = 0; i < n; ++i) {
        if(s[i] == 'R') {
            rc++;
            ans = max(ans, rc);
        } else rc = 0;
    }
    cout << ans << endl;
}


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


int main(void){
	char str[100000];
	scanf("%s",str);
	char abc[26]="abcdefghijklmnopqrstuvwxyz";
	int str_length=strlen(str);
	//for(str_length=0;str[str_length]!='\0';str_length++){printf("%d",str_length);}
	
	int flag=0;
	int temp=-1;
	for(int j=0;j<26;j++){
		for(int i=0;i<str_length;i++){
			if(abc[j]==str[i]){flag=1;}
		}
		if(flag==0){temp=j;break;}
		flag=0;
	}
	if(temp==-1){printf("None");}
	else{printf("%c",abc[temp]);}
	return 0;
} 

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
int main(void){
	ll n;
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cin>>n;
	vector<int> arr(n);
	for(int i=0;i<n;i++){
		cin>>arr[i];
	}
	if(n==1) {
		cout<<"Yes"<<endl;
		return 0;
	}
	if(arr[0]-2>=arr[1]){
		cout<<"No"<<endl;
		return 0;
	}
	for(int i=1;i<n;i++){
		if(arr[i-1]<arr[i]){
			arr[i]--;
		}
	}
	for(int i=0;i<n-1;i++){
		if(arr[i]>arr[i+1]){
			cout<<"No"<<endl; return 0;
		}
	}
	cout<<"Yes"<<endl;
	return 0;
}

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

using namespace std;

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

	int n;
	cin >> n;

	vector<int> x(1e5+5);
	int dup = 0;

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

		if (x[v]) dup++;
		x[v]++;
	}

	n -= dup;
	if (dup%2) n--;

	cout << n << endl;
}


Measured memory_bytes: 1148
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
//namespace mp = boost::multiprecision;

using namespace std;

const double PI = 3.14159265358979323846;
typedef long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
typedef pair<ll, ll> P;
const ll INF = 10e17;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
#define ret() return 0;

double equal(double a, double b) {
    return fabs(a - b) < DBL_EPSILON;
}

std::istream &operator>>(std::istream &in, set<int> &o) {
    int a;
    in >> a;
    o.insert(a);
    return in;
}

std::istream &operator>>(std::istream &in, queue<int> &o) {
    ll a;
    in >> a;
    o.push(a);
    return in;
}

bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }

//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);
//const ll mod = 1e10;

typedef priority_queue<ll, vector<ll>, greater<ll> > PQ_ASK;

int main() {
    int h, w, n;
    cin >> h >> w >> n;

    auto cid = [&](int y, int x) {
        if (x == 0) return y;
        if (y == h) return h + x;
        if (x == w) return h + w + (h - y);
        if (y == 0) return h + w + h + (w - x);
        return -1;
    };

    vector<P> v;
    rep(i, n) {
        int x1, y1, x2, y2;
        cin >> y1 >> x1 >> y2 >> x2;
        int i1 = cid(y1, x1);
        int i2 = cid(y2, x2);
        if (i1 == -1 || i2 == -1) continue;
        v.emplace_back(i1, i);
        v.emplace_back(i2, i);
    }

    sort(v.begin(), v.end());

    stack<int> s;
    for (P p : v) {
        if (!s.empty() && s.top() == p.second) s.pop();
        else s.push(p.second);
    }

    cout << (s.empty() ? "YES" : "NO") << endl;

}


Measured memory_bytes: 6384
/* 

*/
// #pragma GCC optimize("Ofast")
// #pragma GCC target("avx,avx2,fma")
#include <iostream>
#include <iomanip>
#include <sstream>
#include <fstream>
#include <string>
#include <cstring>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <queue>
#include <stack>
#include <deque>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <utility>
#include <bitset>
 
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
 
#define LSOne(S) (S & (-S))
#define EPS 1e-9
 
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pd;
typedef tree<pi, null_type, less<pi>, rb_tree_tag, tree_order_statistics_node_update> ordered_multiset;

int main()
{
    std::ios::sync_with_stdio(false);
    cin.tie(0); // BEFORE SUBMIT DON'T FORGET TO UNCOMMENT THIS
    int n;
    cin >> n;
    vector<double> p(n+5);
    for(int i = 1; i <= n; ++i) cin >> p[i];

    vector<double> dp(n+5);
    dp[0] = (1-p[1]); dp[1] = p[1];

    for(int i = 2; i <= n; ++i)
    {
        vector<double> prev = dp;
        for(int numHead = i; numHead >= 0; --numHead)
        {
            dp[numHead] = p[i] * dp[numHead-1] + (1-p[i]) * dp[numHead]; 
        }
    }
    
    double ans = 0;
    for(int i = n/2+1; i <= n; ++i) ans += dp[i];
    cout << fixed << setprecision(9);
    cout << ans << "\n";
    return 0; 
}


Measured memory_bytes: 512
#include <stdio.h>
int main()
{
	int a;
	scanf("%d",&a);
	for(int i=1;i<=9;i++)
	{
		if(a%i==0&&a/i>0&&a/i<10)
		{
		    printf("Yes\n");
		    break;
		}
		else
		{
			if(i==9)
			printf("No\n");
			else
			continue;
		}
	
	}
	return 0;
}

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

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

  ll H; cin >> H;

  ll ans = 0;
  ll cnt = 1;
  while (H > 0) {
    ans += cnt;
    cnt *= 2;
    H /= 2;
  }
  cout << ans << '\n';
  return 0;
}

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

using namespace std;

#define SZ(x) (int)(x.size())

using ll = long long;
using ld = long double;
using P = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
const ld eps = 1e-9;
const ll MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1ll<<50;

template<typename T>
void printv(const vector<T>& s) {
  for(int i=0;i<(int)(s.size());++i) {
    cout << s[i];
    if(i == (int)(s.size())-1) cout << endl;
    else cout << " ";
  }
}

template<typename T1, typename T2>
ostream& operator<<(ostream &os, const pair<T1, T2> p) {
  os << p.first << ":" << p.second;
  return os;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);

  ll n; cin >> n;
  ll su = 0;
  for(int i=1;i<=n;++i) {
    if(i%3 != 0 && i%5 != 0) {
      su += i;
    }
  }
  cout << su << endl;
  
}


Measured memory_bytes: 3652
import java.util.*;


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

		int n=sc.nextInt();
		int count=0;

		for(int i=1;i<=n;i++){
			if(i<=9){
				count++;
			}else if(i>=100 && i<=999){
				count++;
			}else if(i>=10000 && i<=99999){
				count++;
			}
		}

		System.out.println(count);


	}
}


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

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	string s;cin >> s;
	bool c=false,f=false;
	rep(i,s.size()){
		if(s[i]=='C') c=true;
		if(c && s[i]=='F') f=true;
	}
	if(c && f) cout << "Yes" << endl;
	else cout << "No" << endl;
}

Measured memory_bytes: 256
class UnionFind
    def initialize(n)
        @have_node_num = Array.new(n, -1)
    end
    def findSet(x)
        return x if @have_node_num[x] < 0
        @have_node_num[x] = findSet(@have_node_num[x])
        return @have_node_num[x]
    end
    def link(x, y)
        return if x == y
        x, y = y, x if @have_node_num[x] > @have_node_num[y]
        @have_node_num[x] += @have_node_num[y]
        @have_node_num[y] = x
    end
    def unite(x, y)
        link(findSet(x), findSet(y))
    end
    def same(x, y)
        findSet(x) == findSet(y)
    end
    def size(idx)
        return -@have_node_num[findSet(idx)]
    end
end

n, m = gets.chomp.split.map(&:to_i)
ans = [n*(n-1)/2]
uf = UnionFind.new(n+1)
inputs = []
m.times do
    inputs << gets.chomp.split.map(&:to_i)
end

(m-1).downto(1) do |i|
    a, b = inputs[i]
    if uf.same(a, b) then
        ans << ans[-1]
    else
        ans << ans[-1] - uf.size(a) * uf.size(b)
        uf.unite(a, b)
    end
end

ans.reverse!
puts ans.join("\n")

Measured memory_bytes: 23856
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <utility>
#include <algorithm>
#include <unordered_map>
#include <math.h>
#include <cctype>
using namespace std;
#define _USE_MATH_DEFINES


int main() {
	string str;
	getline(cin, str);
	for (int i = 0; i < str.size(); i++) {
		if (isupper(str[i]))
			str[i] = tolower(str[i]);
		else if (islower(str[i]))
			str[i] = toupper(str[i]);
		else
			continue;
	}
	cout << str << endl;
	return 0;
}

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

int main() {
    int n;
    cin >> n;
    
    for(int i = 0; i < 30; i++)
    {
        for(int j = 0; j < 30; j++)
        {
            if (4 * i + 7 * j == n) {
                cout << "Yes" << endl;
                return 0;
            } 
        }
        
    }
    cout << "No" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define pb push_back
#define int long long
using namespace std;
typedef long long ll;
ll a,b,c;
signed main()
{

    //ios_base::sync_with_stdio(0),cin.tie(0);
    while(cin>>a>>b>>c)
    {
        cout<<max(0LL,c-a+b)<<"\n";
    }

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int main() {
    int S, h, m, s;
    scanf("%d", &S);
    h = S / 3600;
    m = (S / 60) - (h * 60);
    s = S - (m * 60) - (h * 3600);
    printf("%d:%d:%d\n", h, m, s);
    return 0;
}

Measured memory_bytes: 1852
import java.util.*;
public class Main {
	static Scanner sc = new Scanner(System.in);
	static int value, pay;
	public static void main(String[] args) {
		while(read()){
			solve();
		}
	}
	static boolean read(){
		value = sc.nextInt(); pay = sc.nextInt();
		if(value == 0 && pay == 0)
			return false;
		return true;
	}
	static void solve(){
		int n_five = 0, n_handred = 0, n_thousand = 0;
		int diff = pay - value;
		n_thousand = diff / 1000;
		diff = diff % 1000;
		n_five = diff / 500;
		diff = diff % 500;
		n_handred = diff / 100;
		System.out.println(n_handred + " " + n_five + " " + n_thousand);
	}

}

Measured memory_bytes: 12000
#include <bits/stdc++.h>
#define ALL(a) (a).begin(), (a).end()
#define FOR(x,n) for(int x = 0; x < n; x++)
#define FORR(x,n) for(int x = n-1; x >= 0; x--)
#define FIN ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define SZ(a) ((int)(a).size())
using namespace std;
typedef long long ll;

const int MXN = 20001;
int N, P[MXN];
int A[MXN], B[MXN];

int main(){
  cin >> N;
  int tmp1 = 2 * N, tmp2 = 2 * N * N;
  FOR(x,N) cin >> P[x], P[x]--, A[x] += tmp1, B[x] = tmp2, tmp1 += 2*N, tmp2 -= 2*N;
  FOR(x,N) {
    A[P[x]] -= (N-x);
    B[P[x]] -= (N-x);
  }
  
  FOR(x,N)
    cout << A[x] << " \n"[x+1==N];
  FOR(x,N)
    cout << B[x] << " \n"[x+1==N];
}

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

int n, m, g, d;

int check(int line[30][10])
{
    int now = m-1;
    for (int i = 0; i < d; i++) {
        now += line[i][now];
    }
    return (now == g - 1) ? 1 : 0;
}

int main()
{
    while (1) {
        int line[30][10] = { 0 };
        string s;
        int flag = 0;
        // 入力
        cin >> n;
        if (n == 0) break;
        cin >> m >> g >> d;
        memset(line, 0, sizeof(line));
        for (int i = 0; i < d; i++) {
            cin >> s;
            for (int j = 0; j < s.size(); j++) {
                if (line[i][j] != 0) continue;
                line[i][j] = s[j] - '0';
                line[i][j+1] = -(s[j] - '0');
            }
        }
        // 線を引かない
        if (check(line)) {
            puts("0");
            continue;
        }
        // 線を引く
        for (int i = 0; i < d; i++) {
            for (int j = 0; j < n; j++) {
                if (line[i][j] != 0) continue;
                if (j > 0 && line[i][j - 1] == 1) continue;
                if (line[i][j + 1] != 0) continue;
                // 引く
                line[i][j + 1] = -1;
                line[i][j] = 1;
                // 調べる
                if (check(line)) {
                    printf("%d %d\n", i + 1, j + 1);
                    flag = 1;
                    break;
                }
                // 戻す
                line[i][j + 1] = 0;
                line[i][j] = 0;
            }
            if (flag) break;
        }
        if (flag == 0) {
            puts("1");
        }
    }
    return 0;
}


Measured memory_bytes: 3080
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < (n); i++)
#define RREP(i, s, n) for (int i = s; i < (n); i++)
#define ALL(a) a.begin(), a.end()
#define RALL(a) a.rbegin(), a.rend()
using namespace std;
using ll = long long;
typedef pair<int, int> pint;
typedef pair<ll, ll> pll;
const ll MOD = 1000000007;
const ll INF = MOD * MOD;
const int inf = (1<<29);

int n;
int x[10], y[10];

double dist(int i, int j) {
    double dx = x[i]-x[j];
    double dy = y[i]-y[j];
    return pow(dx*dx + dy*dy, 0.5);
}

void solve() {
    cin >> n;
    RREP(i, 1, n+1) cin >> x[i] >> y[i];
    double sum = 0.0;
    vector<int> v(n);
    REP(i, n) v[i] = i+1;
    do {
        REP(i, n-1) sum += dist(v[i], v[i+1]);
    } while(next_permutation(v.begin(), v.end()));
    int factorial = 1;
    RREP(i, 2, n+1) factorial *= i;
    cout << fixed << setprecision(10) << sum / factorial << endl; 
    return;
}

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



// int main() {

//     int N;
//     cin >> N;
    
//     vector<pair<double, double>> pos(N);
//     for(int i = 0; i < N; i++) {
//         cin >> pos[i].first >> pos[i].second;
//     }

//     double sum = 0;
//     int tt  = 0;
//     for(int i = 0; i < N-1; i++) {
//         for(int j = i+1; j < N; j++) {
//             sum += pow((pow(abs(pos[i].first - pos[j].first), 2) + pow(abs(pos[i].second - pos[j].second), 2)), 0.5);
//             tt ++;
//         }
//     }

//     int tmp = 1;
//     for(int i = 1; i < N+1; i++) {
//         tmp *= i;
//     }

//     sum *= 2 * tmp / N;
//     double ave = 0;
//     ave = sum / tmp;

//     printf("%.10f", ave);
//     // cout << ave << endl;
    
 
//     return 0;
// }

Measured memory_bytes: 384
n,k,q = map(int,input().split())
attend = [k-q for i in range(n)]
a = 0
for i in range(q):
    a = int(input())
    attend[a-1]+= 1
for i in range(n):
    if (attend[i] <= 0):
        print("No")
    else:
        print("Yes")

Measured memory_bytes: 7916