akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
void maxHeapify(int * ,int );

int H;

int main()
{
  int A[2000001];//１オリジンだから＋１
  int i;
 
  scanf("%d",&H);
  for(i=1;i<=H;i++) scanf("%d",&A[i]);
  
  /* buildMaxHeap(A) 配列 A を max-ヒープに変換 */
  for(i=H/2;i>=1;i--){
    maxHeapify(A,i);
  }

  for(i=1;i<=H;i++){
    printf(" %d",A[i]);
  }
  printf("\n");

  return 0;
}
  
void maxHeapify(int *A,int i)
{
  int l,r,largest;
  int temp; //交換用
  l = 2*i;
  r = 2*i+1;
  // 左の子、自分、右の子で値が最大のノードを選ぶ
  if( l <= H && A[l] > A[i] ) largest = l;
  else largest = i;
  
  if( r <= H &&  A[r] > A[largest] ) largest = r;
  if(largest != i ){
      temp =  A[i];
    A[i] = A[largest];
    A[largest] = temp;
  maxHeapify(A, largest); // 再帰的に呼び出し
  }
  return;
}



Measured memory_bytes: 3656
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<cstdlib>
using namespace std;
inline int read()
{
    int x=0,f=1;char ch=getchar();
    while(ch<'0' || ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0' && ch<='9')x=x*10+ch-'0',ch=getchar();
    return x*f;
}
inline void write(int x)
{
    if(x<0)putchar('-'),x=-x;
    if(x>9)write(x/10);
    putchar(x%10+'0');
}
inline void pr1(int x){write(x),putchar(' ');}
inline void pr2(int x){write(x),puts("");}
struct node
{
	int t,l;
}a[200010];
bool cmp(node a,node b){return a.l<b.l;}
int main()
{
    //freopen("a.in","r",stdin);
    //freopen("a.out","w",stdout);
    int n=read();
    for(int i=1;i<=n;i++)a[i].t=read(),a[i].l=read();
    sort(a+1,a+n+1,cmp);
    long long sum=0;bool bk=true;
    for(int i=1;i<=n;i++)
    {
    	sum+=a[i].t;
    	if(sum>a[i].l){bk=false;break;}
    }
    if(bk==false)puts("No");
    else puts("Yes");
   	return 0;
}

Measured memory_bytes: 1792
use std::fmt::Debug;
fn sort<T: PartialOrd + Debug>(v: &mut Vec<T>) -> usize {
  let mut cnt = 0;
  let n = v.len();
  for i in 0..n {
    for j in 1..n-i {
      if v[j-1] > v[j] {
        v.swap(j-1,j);
        cnt += 1;
      }
    }
  }
  cnt
}
fn main() {
  let mut n = String::new();
  std::io::stdin().read_line(&mut n).unwrap();
  let _n: usize = n.trim().parse().unwrap();
  let mut v = String::new();
  std::io::stdin().read_line(&mut v).unwrap();
  let mut v: Vec<i32> = v.trim().split_whitespace().map(|x| x.parse().unwrap()).collect();
  let cnt = sort(&mut v);
  for (i, x) in v.iter().enumerate() {
    if i != 0 {
      print!(" ");
    }
    print!("{}", x);
  }
  println!("");
  println!("{}", cnt);
}



Measured memory_bytes: 5032
n, m = map(int, input().split())
if n%2 == 1:
    ans = []
    a = 1
    b = n-1
    for i in range(m):
        ans.append((a, b))
        a += 1
        b -= 1
else:
    ans = []
    a = 1
    b = n-1
    flag = True
    for i in range(m):
        if flag and b-a <= n//2:
            b -= 1
            flag = False
        ans.append((a, b))
        a += 1
        b -= 1
for i in range(m):
    print(*ans[i])


Measured memory_bytes: 73360
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdint>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <utility>
#include <vector>

using namespace std;
using ll = long long;

#define EPS (1e-7)

int main() {
  ll N, M;
  cin >> N >> M;
  vector<ll> A(N);
  for_each(begin(A), end(A), [](auto& x) { cin >> x; });

  double border = (double)accumulate(cbegin(A), cend(A), 0LL) / (double)(4.0 * M);

  ll count = 0;
  for (const auto& x : A) {
    if (x >= border) {
      count++;
    }
  }
  string ans = (count >= M) ? "Yes" : "No";

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


Measured memory_bytes: 256
import java.util.*;
import java.io.*;
 
public class Main {
    public static void main(String[] args) throws Exception {
        FastScanner sc = new FastScanner(System.in);
        int n = sc.nextInt();
        ArrayList<Integer> a = new ArrayList<>();
        for(int i = 0; i < n; i++){
            a.add(sc.nextInt());
        }
        Collections.sort(a,Comparator.reverseOrder());
        long ans = a.get(0);
        int cnt = 1;
        int index = 1;
        while(cnt < n-1){
            if(n-1-cnt == 1){
                ans += a.get(index);
                cnt++;
            }else{
                ans += a.get(index)*2;
                cnt += 2;
            }
            index++;
        }
        System.out.println(ans);
    }
    
}

class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;
    public FastScanner(InputStream in) {
        reader = new BufferedReader(new InputStreamReader(in));
        tokenizer = null;
    }

    public String next() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    public String nextLine() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                return reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken("\n");
    }

    public long nextLong() {
        return Long.parseLong(next());
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

    public double nextDouble() {
         return Double.parseDouble(next());
    }
    
    public String[] nextArray(int n) {
        String[] a = new String[n];
        for (int i = 0; i < n; i++)
            a[i] = next();
        return a;
    }

    public int[] nextIntArray(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++)
            a[i] = nextInt();
        return a;
    }

    public long[] nextLongArray(int n) {
        long[] a = new long[n];
        for (int i = 0; i < n; i++)
            a[i] = nextLong();
        return a;
    } 
}


Measured memory_bytes: 54260
list = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

val = input()
vala = int(val) - 1
print(list[vala])

Measured memory_bytes: 3060
#include <iostream>
#include <queue>
#include <vector>
#include <cmath>
#include <algorithm>
#include <map>
#include <numeric>

using namespace std;
using ll = long long;
const ll INF = 1e9;
const ll MOD = 1e9 + 7;

int main() {
    int N, A;
    cin >> N >> A;
    cout << N * N - A << endl;

    return 0;
}

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

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

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

    long long minTime = 100000000000;
    bool flag = false;
    /*
    if(N == K){
        flag = true;
        long long time = min(2 * abs(x[0]) + abs(x[N-1]),abs(x[0]) + 2 * abs(x[N-1]) );
        if(time < minTime) minTime = time; 
    }
    */
    for(int i = 0; i <= N - K; i++){
        if(x[i+K-1] <= 0){
            flag = true;
            long long time = abs(x[i]);
            if(time < minTime) minTime = time; 
        }
        if(x[i] >= 0){
            flag = true;
            long long time = abs(x[i+K-1]);
            if(time < minTime) minTime = time; 
        }
        if(x[i] < 0 && x[i+K-1] > 0){
            flag = true;
            long long time = min(2 * abs(x[i]) + abs(x[i+K-1]),abs(x[i]) + 2 * abs(x[i+K-1]) );
            if(time < minTime) minTime = time; 
        }
    }

    if(flag) cout << minTime << endl;
    else cout << 0 << endl;
}



Measured memory_bytes: 1024
/*
			███╗   ███╗ █████╗ ███████╗███╗   ███╗ ██████╗ ██╗   ██╗██████╗ ███████╗ █████╗ ███╗   ███╗██████╗ ██╗   ██╗
			████╗ ████║██╔══██╗╚════██║████╗ ████║██╔═══██╗██║   ██║██╔══██╗╚════██║██╔══██╗████╗ ████║██╔══██╗╚██╗ ██╔╝
			██╔████╔██║███████║    ██╔╝██╔████╔██║██║   ██║██║   ██║██║  ██║    ██╔╝███████║██╔████╔██║██║  ██║ ╚████╔╝
			██║╚██╔╝██║██╔══██║   ██╔╝ ██║╚██╔╝██║██║   ██║██║   ██║██║  ██║   ██╔╝ ██╔══██║██║╚██╔╝██║██║  ██║  ╚██╔╝
			██║ ╚═╝ ██║██║  ██║   ██║  ██║ ╚═╝ ██║╚██████╔╝╚██████╔╝██████╔╝██╗██║  ██║  ██║██║ ╚═╝ ██║██████╔╝   ██║
			╚═╝     ╚═╝╚═╝  ╚═╝   ╚═╝  ╚═╝     ╚═╝ ╚═════╝  ╚═════╝ ╚═════╝ ╚═╝╚═╝  ╚═╝  ╚═╝╚═╝     ╚═╝╚═════╝    ╚═╝

			“Nobody but you have to believe in your dreams to make them a reality.” ― Germany Kent
*/
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
using namespace std;
#define Ma7moud_7amdy                 \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL)
#define Open_Sesame Open()
#define pb push_back
#define all(v) ((v).begin()), ((v).end())
#define allr(v) ((v).rbegin()), ((v).rend())
#define sz(v) ((int)((v).size()))
#define clr(arr, x) memset(arr, x, sizeof arr)
#define endl "\n"
#define Accepted 0
#define watch(x) cout << #x << " = " << x << endl;
#define un_map unordered_map
#define RT(x) return cout << (x), 0;
#define sc(a) scanf("%d", &a)
#define scll(x) scanf("%I64d", &x)
#define scan(s) scanf("%[^\n]%*c", &s)
#define pr(s) printf("%s", s.c_str()); // print string
typedef long long ll;
typedef unsigned long long ull;
const double PI = acos(-1.0);
const double EPS = -1e-2;
const int dx[] = { 1, 0, -1, 0, 1, 1, -1, -1 };
const int dy[] = { 0, 1, 0, -1, 1, -1, 1, -1 };
const ll mod = 1000000007;
const int Mx = INT_MAX;
const int Mn = INT_MIN;
const ll MX = LLONG_MAX;
const ll MN = LLONG_MIN;
const int N = 1e5 + 1;
void Open()
{
#ifndef ONLINE_JUDGE
	freopen("Input.txt", "r", stdin);
	freopen("Output.txt", "w", stdout);
#endif
}
int n, k;
int dp[3];
//int mem[N];
vector<int>v;
/*int solve(int i) {
	int& ret = mem[i];
	if (~ret)return ret;
	ret = Mx;
	if (i + 1 < n)
		ret = min(ret, solve(i + 1) + abs(v[i] - v[i + 1]));
	if (i + 2 < n)
		ret = min(ret, solve(i + 2) + abs(v[i] - v[i + 2]));
	ret = ret == Mx ? 0 : ret;
	return ret;
}*/
int main()
{
	Ma7moud_7amdy;
	Open_Sesame;
	//clr(mem, -1);
	cin >> n;
	v = vector<int>(n);
	for (int i = 0; i < n; i++)cin >> v[i];
	//cout << solve(0) << endl;;

	for (int i = 0; i < n; i++) {
		int& ret = dp[i % 3];
		ret = Mx;
		if (i - 1 >= 0)
			ret = min(ret, dp[(i - 1) % 3] + abs(v[i] - v[i - 1]));
		if (i - 2 >= 0)
			ret = min(ret, dp[(i - 2) % 3] + abs(v[i] - v[i - 2]));

		ret = ret == Mx ? 0 : ret;
	}

	cout << dp[(n - 1)%3] << endl;
	return Accepted;
}

Measured memory_bytes: 3724
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
//二項係数の計算
int nCr(int A, int B) {
    ll ans = 1;
    for (int i = 0; i < B; i++) {
        ans *= A - i;
    }
    for (int i = 0; i < B; i++) {
        ans /= i + 1;
    }
    return ans;
}
int main() {
    int A,B,K;
    cin>>A>>B>>K;
    if(K*2<=B-A){
        for(int i=0; i<K; i++){
            cout<<A+i<<endl;
        }
        for(int i=B-K+1; i<B+1; i++){
          cout<<i<<endl;
        }
    }
    else{
        for(int i=A; i<B+1; i++){
            cout<<i<<endl;
        }
    }
}

Measured memory_bytes: 3596
import sys

N,A,B,C = map(int,sys.stdin.readline().rstrip().split())
l = [int(sys.stdin.readline().rstrip()) for _ in range(N)]

from itertools import product

# 各々の竹をAに使うか、Bに使うか、Cに使うか、使わないかで全探索

ans = 10**18
for a in list(product([1,2,3,4],repeat=N)):
    X,Y,Z = [],[],[]
    for i in range(N):
        if a[i] == 1:
            X.append(l[i])
        elif a[i] == 2:
            Y.append(l[i])
        elif a[i] == 3:
            Z.append(l[i])
    if len(X) == 0 or len(Y) == 0 or len(Z) == 0:
        continue
    else:
        a = 0
        a += 10*(len(X)+len(Y)+len(Z)-3)
        a += abs(A-sum(X)) + abs(B-sum(Y)) + abs(C-sum(Z))
        if a < ans:
            ans = a

print(ans)


Measured memory_bytes: 84204
# input
N, M = map(int, input().split())
edge_lst = [list(map(int, input().split())) for i in range(M)]

adj_matrix = {} # グラフを辺列挙 -> 隣接行列に変換
for i in range(1, N + 1):
    adj_lst = []
    for j in range(M):
        if edge_lst[j][0] == i:
            adj_lst.append(edge_lst[j][1])
        if edge_lst[j][1] == i:
            adj_lst.append(edge_lst[j][0])
    adj_matrix[i] = adj_lst

# root: 葉を探索中の根
# next: 次に探索される葉
# count: 探索回数
# order[1,...,N]: 頂点iが探索された順番
# low[1,...,N]: 頂点iから訪問可能な頂点のうち、最も上にある頂点の探索順

def dfs_bridge(graph, root, next, count, low, order, bridges): # graph is represented by adj. matrix
    count += 1
    order[next] = count
    low[next] = order[next]

    for w in graph[next]: # neighbors of v
        if order[w] == -1: # if w is not visited yet
            dfs_bridge(graph, next, w, count, low, order, bridges)

            low[next] = min(low[next], low[w])
            if low[w] == order[w]: # 頂点w以降から頂点v以前に戻れない
                bridges.append((next, w))
        elif w != root: # 一つ前の頂点（自明に戻れる頂点）より前に戻れる場合
            low[next] = min(low[next], order[w])

def get_bridges(graph):
    bridges = []
    count = 0
    low = {n: -1 for n in graph.keys()}
    order = low.copy()

    for n in graph.keys():
        dfs_bridge(graph, n, n, count, low, order, bridges)
    
    return(bridges) # List of [node, node] lists for all bridges in G
            
ans = get_bridges(adj_matrix)
print(len(ans))
    

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

int gcd(int m, int n) {
    return n != 0 ? gcd(n, m % n) : m;
}

int main() {
    int n, x, z;
    cin >> n >> x;
    vector<int> s;
    s.push_back(x);
    for(int i = 0; i < n; i++) {
        cin >> z;
        s.push_back(z);
    }
    sort(s.begin(), s.end());
    int p = s[1] - s[0];
    int d = p;
    for(int i = 2; i < n + 1; i++) {
        d = gcd(d, s[i] - s[i - 1]);
    }

    cout << d << endl;
}


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

using namespace std;

int main(void) {
    string S;
    cin >> S;
    int N = S.size();

    vector<char> ACGT = {'A', 'C', 'G', 'T'};
    int c = 0;
    int ans = 0;
    for(int i=0; i<N; i++) {
        if(count(ACGT.begin(), ACGT.end(), S.at(i))) {
            c++;
        } else {
            ans = max(ans, c);
            c = 0;
        }
    }
    ans = max(ans, c);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <functional>

using namespace std;

bool isPrime( int n )
{
	for ( int i = 2; i <= sqrt( n ); i++ )
	{
		if ( !( n % i ) )
		{
			return false;
		}
	}

	return true;
}

int main()
{
	set<int> primes;

	for ( int i = 2; i <= 50000; i++ )
	{
		if ( isPrime( i ) )
		{
			primes.insert( i );
		}
	}

	while ( true )
	{
		int n;
		cin >> n;
		
		if ( n == 0 )
		{
			break;
		}

		int count = 0;

		for ( set<int>::iterator it = primes.begin(); *it <= n / 2 && it != primes.end(); it++ )
		{
			if ( primes.find( n - *it ) != primes.end() )
			{
				count++;
			}
		}

		cout << count << endl;
	}

	return 0;
}

Measured memory_bytes: 1028
#include <stdio.h>

int main(void){

    int S, se, M, H;

    scanf("%d", &S);

    H = S / 3600;

    M = (S - H * 3600) / 60;

    se = S - H * 3600 - M * 60;

    printf("%d:%d:%d\n", H, M, se);

    return 0;

}


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

int main(){
  string S;
  cin >> S;
  vector<int> retu;
  
  for(int i=0; i<S.size(); i++){
    if(S.at(i) == '0'){
      retu.push_back(0);
    }
    else if(S.at(i) == '1'){
      retu.push_back(1);
    }
    else if(S.at(i) == 'B' && retu.size() != 0){
      retu.pop_back();
    }
    else continue;
  }
  for(int i=0; i<retu.size(); i++){
    cout << retu.at(i);
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <algorithm>
#include <math.h>
#include <map>
#include <vector>
#include <list>
#include <queue>
#include <stack>

using namespace std;




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


    return 0;
}




Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define ll long long
#define INF INT_MAX 
#define mod 1000000007
using namespace std;
int main(){
    int N;
    cin >> N;
    int V[N],C[N];
    for(int i=0;i<N;i++) cin >> V[i];
    for(int i=0;i<N;i++) cin >> C[i];

    int ans = 0;
    for(int i=0;i<N;i++){
        if(V[i]>=C[i]) ans+=(V[i]-C[i]);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
//-AOJ0042 -----------------------------------------------------------//
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <string>

#define rep(x,to) for(int x=0;x<to;x++)
#define rep2(x,from,to) for(int x=from;x<to;x++)

struct stk{
	int kt,wg,ct; 
	stk(int kt,int wg,int ct) : kt(kt), wg(wg), ct(ct) { }
};
using namespace std;


int main(void){

int w,n,cnt=0;
char k;
	
	while(!cin.eof()){
		cin >> w ;
		if(cin.eof() || w==0) break;
		cin.ignore();
		cin >> n;
		vector<vector<int> >dp(n+1,vector<int>(w+1,0));
		vector<int> tk(n,0);
		vector<int> tw(n,0);

		cnt++;
		rep(i,n) cin >> tk[i] >> k >> tw[i];

		rep(i,n) rep(j,w+1){
			if(tw[i]>j){
				dp[i+1][j]=dp[i][j];
			}else{
				dp[i+1][j]=max(dp[i][j],dp[i][j-tw[i]]+tk[i]);
			}
		}	
//		rep(i,n+1) {rep2(j,1,w+1){
//			cout << dp[i][j] << "\t";
//		} cout <<endl;}

		while(dp[n][w]==dp[n][w-1]){
			w--;
		}
		printf("Case %d:\n%d\n%d\n",cnt,dp[n][w],w);
		dp.clear(); tk.clear(); tw.clear();

	}
	
	return 0;
}

Measured memory_bytes: 5008
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll d,n;
    cin>>d>>n;
    if(n==100){
        n++;
    }
    while(d){
        n*=100;
        d--;
    }
    cout << n<<endl;
    return 0;
}


Measured memory_bytes: 256
n = gets.to_i
a, b = gets.split.map(&:to_i)
ps = gets.split.map(&:to_i)

count = [0, 0, 0]
ps.each do |v|
  idx = if v <= a
          0
        elsif v <= b
          1
        else
          2
        end
  count[idx] += 1
end
puts(count.min)

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

#define INF 100001

struct p_mx {
  int p;
  int mx;
};

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

  int n0[INF];
  int n1[INF];
  fill(n0, n0+INF, 0);
  fill(n1, n1+INF, 0);
  for ( int i = 0; i < n; i+=2 ) { n0[v[i]]++; }
  for ( int i = 1; i < n; i+=2 ) { n1[v[i]]++; }

  p_mx p0_1, p0_2, p1_1, p1_2;
  p0_1.p = p0_2.p = p1_1.p = p1_2.p = 0;
  p0_1.mx = p0_2.mx = p1_1.mx = p1_2.mx = 0;
  for ( int i = 1; i < INF; i++ ) {
    if ( n0[i] > p0_1.mx ) {
      p0_2.mx = p0_1.mx;
      p0_1.mx = n0[i];
      p0_2.p = p0_1.p;
      p0_1.p = i;
    } else if ( n0[i] > p0_2.mx ) {
      p0_2.mx = n0[i];
      p0_2.p = i;
    }
    if ( n1[i] > p1_1.mx ) {
      p1_2.mx = p1_1.mx;
      p1_1.mx = n1[i];
      p1_2.p = p1_1.p;
      p1_1.p = i;
    } else if ( n1[i] > p1_2.mx ) {
      p1_2.mx = n1[i];
      p1_2.p = i;
    }
  }

  int ans = 0;
  if ( p0_1.p != p1_1.p ) {
    ans = n - p0_1.mx - p1_1.mx;
  } else {
    ans = ( n-p0_1.mx-p1_2.mx < n-p0_2.mx-p1_1.mx ) ? n-p0_1.mx-p1_2.mx : n-p0_2.mx-p1_1.mx;
  }

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


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


int main()
{
	long a[100],b[100];
	int i=0;
	while(cin >> a[i] >> b[i]){i++;}
	for(int j=0;j<i;j++){
		long c;
		long d=a[j],e=b[j];
		if (a[j]<b[j]){c=a[j];a[j]=b[j];b[j]=c;}
		while(a[j]%b[j]!=0){
			c=a[j];
			a[j]=b[j];
			b[j]=c%b[j];
		}
		cout << b[j] <<" " <<d/b[j]*e <<  endl;
	}
    return 0;
}

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

#define pb push_back
#define ll long long int
#define mod 100000
#define for1(k,n) for(ll i=k;i<n;i++)
#define for2(k,n) for(ll j=k;j<n;j++)
#define E cout<<endl
#define max 100000




int main()
{
#ifndef ONLINE_JUDGE
	clock_t tStart = clock();
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	ios_base:: sync_with_stdio(false);
	cin.tie(0);
//////////////////////////////////////start...............

	int n, data;
	vector <int> vec;

	cin >> n;
	for1(0, n)
	{
		cin >> data;
		vec.pb(data);
	}
	int xmin = *min_element(vec.begin(), vec.end());
	int xmax = *max_element(vec.begin(), vec.end());

	//cout << xmin << " " << xmax << endl;
	ll ans = 99999999999; ll sum;
	for (int j = xmin; j <= xmax; j++) {
		sum = 0;
		int s;
		for1(0, n)
		{	s = vec[i] - j;
			sum = sum + (s * s);

		}
		if (sum < ans)
			ans = sum;
	}



	cout << ans;


/////////////////////////////end.......................................
#ifndef ONLINE_JUDGE
	cout << "\nDone in " << (double) clock() / CLOCKS_PER_SEC << "sec" << endl;
#endif
	return 0;

}

//c v a s selecting text or x for selecting cut
//ctrl+d after selecting text to select same type
//ctrl+shift+d for copy and paste the line below it
//ctrl+del to delete a text
//ctrl+left to jump left of line or vice versa
//ctrl+shift+"/"  to comment whole block and vice versa for undo
//ctrl+"/" for commenting a line

/*
when N <= 10, then both O(N!) and O(2N) are ok (for 2N probably N <= 20 is ok too)
when N <= 100, then O(N3) is ok (I guess that N4 is also ok, but never tried)
when N <= 1.000, then N2 is also ok
when N <= 1.000.000, then O(N) is fine (I guess that 10.000.000 is fine too, but I never tried in contest)
finally when N = 1.000.000.000 then O(N) is NOT ok, you have to find something better…*/

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

using namespace std;

#define int long long int
#define ld long double
#define F first
#define S second
#define P pair<int,int>
#define pb push_back

const int N = 100005;

vector<int> gr[N];
int dp[N];

void dfs(int cur) {
	for (auto x : gr[cur]) {
		if (!dp[x]) {
			dfs(x);
		}
		dp[cur] = max(dp[cur], dp[x]);
	}
	dp[cur]++;
}

void solve() {
	int i, j, k, n, m, ans = 0, cnt = 0, sum = 0;
	cin >> n >> m;
	for (i = 0; i < m; i++) {
		int x, y;
		cin >> x >> y;
		x--; y--;
		gr[x].pb(y);
	}
	for (i = 0; i < n; i++) {
		if (!dp[i]) {
			dfs(i);
		}
		ans = max(ans, dp[i]);
	}
	cout << ans - 1;
	return ;
}

int32_t main()
{
	ios_base:: sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
	// int t; cin >> t; while (t--)
	solve();
	return 0;
}

Measured memory_bytes: 8576
#include<stdio.h>
#pragma GCC optimize("O2")
#define rep(i,N) for(int i=0;i<(int)N;i++)
static inline long IN(void)
{
  long x=0;int f=0,c=getchar();while(c<48||c>57){f^=c==45,c=getchar();}
  while(c>47&&c<58){x=x*10+c-48,c=getchar();}return f?-x:x;
}
static inline void OUT(long x){if(x<0)putchar('-'),x=-x;if(x>=10)OUT(x/10);putchar(x%10+48);}
static inline void Radix32(int A[],const int sz)
{
  int temp[200001];
  rep(k,0x4)
  {
    int u[0x100]={},v[0x100]={};const int bit=0x8,mask=0xff;
    rep(i,sz)u[A[i]>>bit*k&mask]++;
    rep(i,mask)u[i+1]+=u[i];
    rep(i,sz){temp[--u[A[sz-1-i]>>bit*k&mask]]=A[sz-1-i];}k++;
    rep(i,sz)v[temp[i]>>bit*k&mask]++;
    rep(i,mask)v[i+1]+=v[i];
    rep(i,sz)A[--v[temp[sz-1-i]>>bit*k&mask]]=temp[sz-1-i];
  }
}
int main(void)
{
  int N=IN(),x,p=0,m=0,z=0,minus=0,A[200000];
  long K=IN(),count=0,l=-2e18,r=-l,mid;
  while(N--){x=IN();if(x>0)A[m+p++]=x;else if(x<0)A[p+m++]=x;else z++;}
  Radix32(A,m+p);
  rep(i,m)A[p+i]*=-1;
  if(K>1l*m*p&&K<1l*m*p+1l*z*(N-1)/2)return puts("0"),0;
  if(K<=1l*m*p)r=1l;else l=-1l;
  while(l<=r)
  {
    mid=(l+r)/2;count=0;
    if(mid>=0)
    {
      int plus=p-1,minus=m-1;count+=1l*z*(p+m)+1l*z*(z-1)/2+1l*p*m;
      rep(i,plus){while(1l*A[i]*A[plus]>mid){plus--;}if(i>=plus){break;}count+=1l*plus-i;}
      rep(i,minus){while(1l*A[m+p-1-i]*A[m+p-1-minus]>mid){minus--;}if(i>=minus){break;}count+=1l*minus-i;}
    }
    else{mid*=-1l;minus=1;int low=0;rep(i,m){while(1l*A[low]*A[p+i]<mid&&low<p){low++;}count+=1l*p-low;}}
    if(count>=K){if(minus)r=-mid-1l;else r=mid-1l;}else{if(minus)l=-mid+1l;else l=mid+1l;}
  }
  return OUT(l),0;
}

Measured memory_bytes: 2912
#include<bits/stdc++.h>
#define vll vector<ll>
#define vi vector<int>
#define vpll vector<pair<ll,ll>>
#define pii pair<int,int>
#define REP(i,a) for(int (i)=0; (i)<(a); (i)++)
#define RREP(i,a) for(int (i)=a-1; (i)>=(0); (i)--)
#define REP2(i,a,b) for(int (i)=(a); (i)<(b); (i)++)
#define MOD 1000000007
#define ALL(v) v.begin(), v.end()
#define m0(x) memset(x,0,sizeof(x))
typedef long long ll;
using namespace std;

const ll mod = 2019;
ll mpow(ll x, ll n){ //x^n(mod M) ←普通にpow(x,n)では溢れてしまうため，随時mod計算
    ll ans = 1;
    while(n != 0){//全てのbitが捨てられるまで。
        if(n&1) ans = (ans*x) % mod;//1番右のbitが1のとき。
        x = (x*x) % mod;
        n = n >> 1;//bit全体を右に1つシフトして一番右を捨てる。
    }
    return ans;
}

int main(){
	string S; cin >> S;
    ll n = S.size();
    vll s(n);
    for(int i=0;i<n;i++) s[i] = S[i] - '0';
    ll ans = 0;
    vll t(n,0);
    t[n-1] = s[n-1];
    map<ll,ll> mp;
    mp[0]++;
    for(int i=n-2;i>=0;i--){
      t[i] = t[i+1] + s[i] * mpow(10,n-1-i);
      t[i]%=2019;
    }
    REP(i,n) mp[t[i]]++;
    for(auto itr = mp.begin();itr != mp.end();itr++){
      ans += itr->second*(itr->second-1)/2; 
    }
    
    cout << ans << endl;
  	return 0;
}

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

using namespace std;

#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define all(a) (a).begin(),(a).end()
#define endl "\n"

#define aim_cpo do{ios::sync_with_stdio(false);\
cin.tie(nullptr);cout.precision(10);cout<<fixed;}while(0)

#define LOCAL_INPUT do{FILE *stream1;\
stream1=freopen("/Users/aim_cpo/CLionProjects/competitive/in.txt","r",stdin);\
if(stream1==nullptr)return 0;}while(0)

#define LOCAL_OUTPUT do{FILE *stream2;\
stream2 = freopen("out.txt", "w", stdout);\
if (stream2 == nullptr) return 0;}while(0)

#ifdef LOCAL_DEFINE
#define show(x) cerr << #x << " = " << x << endl
#else
#define show(x)
#endif

typedef long long ll;
typedef unsigned long long ull;

constexpr const int INT_INF=0x3f3f3f3f; // 1061109567
constexpr const ll LL_INF=0x3f3f3f3f3f3f3f3f; // 4557430888798830399

template <typename T> bool chmin(T &a, T b) {
    if (a > b) {a = b;return true;}return false;
}

template <typename T> bool chmax(T &a, T b) {
    if (a < b) {a = b;return true;}return false;
}

// INT
#define GCD(a, b) __gcd(a, b)
template <typename T> T LCM(T a, T b) {return a / GCD(a, b) * b;}
template <typename T> T EXTGCD(T a, T b, T& x, T& y) {
    T d = a;
    if (b != 0) {d=EXTGCD(b,a%b,y,x);y-=(a/b)*x;}
    else x=1,y=0;
    return d;
}
template <typename T> bool is_prime(T a) {
    for(int i=2;i*i<=a;i++)if(a%i==0)return 1;
    return 0;
}

// MOD
const ll MOD = (ll)1e9 + 7;
#define add(a, b) ((a % MOD) + (b % MOD)) % MOD
#define mul(a, b) ((a % MOD) * (b % MOD)) % MOD
#define sub(a, b) ((a % MOD) + MOD - (b % MOD)) % MOD
template <typename T> T mod_inverse(T a, T mod, bool prime){ // if mod is prime, "prime" is true.
    if(prime){
        T tmp=mod-2,now=a,res=1;while(tmp){if(tmp&1)res=mul(res,now);now=mul(now,now);tmp>>=1;}
        return res;
    }else{T x,y;EXTGCD(a,mod,x,y);return (mod+x%mod)%mod;}
}
#define divide(a, b) ((a % MOD) * (mod_inverse(b, MOD, true))) % MOD

//LLの数値をつかう時は最後にLをつける癖をつけよう
//
//  ┏┓┏┓　┓　┏┓
//  ┏┛┃┃　┃　┗┫
//  ┗┛┗┛　┻　┗┛
//
//   謹┃賀┃新┃年┃
//   ━┛━┛━┛━┛
//WWWWWWWWWWWWWWWWWWWWWW

int n, m, w, k;
string s;
ll dp[10001][2][101];

int main() {
    aim_cpo; // インタラクティブのときは消すように.
#ifdef LOCAL_DEFINE
    LOCAL_INPUT; // インタラクティブのときは消すように.
//    LOCAL_OUTPUT; // ファイルに出力したいときのみ
    show(MOD);
#endif
    cin >> s >> k;
    n = (int)s.size();
    dp[0][0][0] = 1L;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < 2; j++) {
            for (int l = 0; l < k; l++) {
                int lim = (j == 1 ? 9 : s[i] - '0');
                for (int d = 0; d <= lim; d++) {
                    if (d == lim && j == 0) {
                        dp[i + 1][0][(l + d) % k] = add(dp[i + 1][0][(l + d) % k], dp[i][j][l]);
                    } else {
                        dp[i + 1][1][(l + d) % k] = add(dp[i + 1][1][(l + d) % k], dp[i][j][l]);
                    }
                }
            }
        }
    }
    cout << sub(add(dp[n][1][0], dp[n][0][0]), 1) << endl;
#ifdef  LOCAL_DEFINE
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << "s." << endl;
#endif
    return 0;
}

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

using namespace std; 
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>; 

#define INF 100000000
#define MOD 10007
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()

struct UnionFindTree{
  vector<int>par,rank,sum;

  void init(int n){
    par.resize(n);
    rank.resize(n);
    sum.resize(n);
    for(int i=0;i<n;i++){
      par[i]=i;
      rank[i]=0;
      sum[i]=1;
    }
  }

  int find(int x){
    if(par[x]==x)return x;
    else return par[x]=find(par[x]);
  }

  void unite(int x,int y){
    x=find(x);
    y=find(y);
    if(x==y)return;
    if(rank[x]<rank[y]){
      par[x]=y;
      sum[y]+=sum[x];
    }
    else{
      par[y]=x;
      sum[x]+=sum[y];
      if(rank[x]==rank[y])rank[x]++;
    }
  }

  bool same(int x,int y){
    return find(x)==find(y);
  }

};

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

  int N,M;
  cin>>N>>M;
  vector<ll>A(M),B(M);
  for(int i=0;i<M;i++)cin>>A[i]>>B[i];
  UnionFindTree uf;
  uf.init(N+1);
  ll ANS = 0;
  for(int i=0;i<N;i++)ANS+=i;
  vector<ll>ans(M+1,1);
  for(int i=M;i>0;i--){
    //for(int i=1;i<=N;i++)cout<<uf.sum[uf.find(i)]<<" ";
    //cout<<endl;
    //for(int i=1;i<=N;i++)cout<<uf.old[uf.find(i)]<<" ";
    //cout<<endl<<endl;
    //
    //cout<<a<<" "<<b<<endl;
    if(i==M)ans[i]=ANS;
    else {
      ll a = uf.sum[uf.find(A[i])];
      ll b = uf.sum[uf.find(B[i])];
      if(uf.same(A[i],B[i]))ans[i]=ans[i+1];
      else ans[i]=ans[i+1]-a*b;
    }
    //cout<<uf.same(A[i],B[i])<<endl;
    uf.unite(A[i],B[i]);
  }
  for(int i=1;i<=M;i++)cout<<ans[i]<<endl;
  return 0;
}


Measured memory_bytes: 4864
from copy import deepcopy
import math
import string
import collections
from collections import Counter
from collections import deque
from decimal import Decimal
import sys
import fractions
from operator import itemgetter
import itertools
import copy


def readints():
    return list(map(int, input().split()))


def nCr(n, r):
    return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))


def has_duplicates2(seq):
    seen = []
    for item in seq:
        if not(item in seen):
            seen.append(item)
    return len(seq) != len(seen)


def divisor(n):
    divisor = []
    for i in range(1, n+1):
        if n % i == 0:
            divisor.append(i)
    return divisor


# coordinates
dx = [-1, -1, -1, 0, 0, 1, 1, 1]
dy = [-1, 0, 1, -1, 1, -1, 0, 1]

s = list(map(int, input()))

if s[0]+s[1]+s[2]+s[3] == 7:
    print(str(s[0]), '+', str(s[1]), '+',
          str(s[2]), '+', str(s[3]), '=', 7, sep='')
    exit()
if s[0]+s[1]-s[2]+s[3] == 7:
    print(str(s[0]), '+', str(s[1]), '-', str(s[2]),
          '+', str(s[3]),  '=', 7, sep='')
    exit()
if s[0]-s[1]+s[2]+s[3] == 7:
    print(str(s[0]), '-', str(s[1]), '+', str(s[2]),
          '+', str(s[3]),  '=', 7, sep='')
    exit()
if s[0]-s[1]-s[2]+s[3] == 7:
    print(str(s[0]), '-', str(s[1]), '-', str(s[2]),
          '+', str(s[3]),  '=', 7, sep='')
    exit()
if s[0]+s[1]+s[2]-s[3] == 7:
    print(str(s[0]), '+', str(s[1]), '+', str(s[2]),
          '-', str(s[3]),  '=', 7, sep='')
    exit()
if s[0]-s[1]-s[2]-s[3] == 7:
    print(str(s[0]), '-', str(s[1]), '-', str(s[2]),
          '-', str(s[3]),  '=', 7, sep='')
    exit()
if s[0]-s[1]+s[2]-s[3] == 7:
    print(str(s[0]), '-', str(s[1]), '+', str(s[2]),
          '-', str(s[3]),  '=', 7, sep='')
    exit()
if s[0]+s[1]-s[2]-s[3] == 7:
    print(str(s[0]), '+', str(s[1]), '-', str(s[2]),
          '-', str(s[3]),  '=', 7, sep='')
    exit()


Measured memory_bytes: 77244
N,M,C = map(int,input().split())
B = [int(i) for i in input().split()]
A = [list(map(int,input().split())) for i in range(N)]
count = 0

for i in range(N):
    t = []
    for j in range(M):
        t.append(A[i][j]*B[j])
    if (sum(t)+C) > 0:
        count +=1
        
print(count)


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

using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((lint)(x).size())
#define POW2(n) (1LL << (n))
#define FOR(i, begin, end) for (int i = (begin), i##_end_ = (end); i < i##_end_; i++)
#define IFOR(i, begin, end) for (int i = (end)-1, i##_begin_ = (begin); i >= i##_begin_; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)

int main()
{
    lint mod = 1000000007;
    lint n;
    cin >> n;
    string s;
    cin >> s;
    vector<lint> c(26);
    //REP(i, n) {p[i];}

    REP(i,SZ(s)){
        int x = s[i] - 'a';
        c[x] += 1;
    }
    lint ans = 1;
    REP(i,26){
        ans *= c[i] + 1;
        ans = ans % mod;
        //cout << c[i] << "\n";
    }

    ans -= 1;
    cout << ans <<"\n";

    return 0;
}

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

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int N = Integer.parseInt(br.readLine());
		int H = Integer.parseInt(br.readLine());
		int W = Integer.parseInt(br.readLine());

		System.out.println( (N-H+1) * (N-W+1) );


	}
}

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

namespace EHopscotchAddict
{
    class Program
    {
        static void Main(string[] args)
        {
            // 入力の取得
            var inputNM = Console.ReadLine().Split().ToArray();
            var n = int.Parse(inputNM[0]);
            var m = long.Parse(inputNM[1]);

            var nodes = new List<int>[n + 1];
            for (var i = 0; i < n + 1; i++) nodes[i] = new List<int>();
            for (var i = 0; i < m; i++)
            {
                var inputUV = Console.ReadLine().Split().Select(int.Parse).ToArray();
                int u = inputUV[0], v = inputUV[1];
                nodes[u].Add(v);
            }

            var inputST = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int s = inputST[0], t = inputST[1];

            var distances = new int[n + 1, 3];
            var queue = new Queue<Tuple<int, int>>();

            for (var i = 0; i < n + 1; i++)
            {
                distances[i, 0] = -1;
                distances[i, 1] = -1;
                distances[i, 2] = -1;
            }
            distances[s, 0] = 0;
            queue.Enqueue(Tuple.Create(s, 0));

            while (queue.Any())
            {
                var path = queue.Dequeue();
                int node = path.Item1, state = path.Item2;

                var nextState = (state + 1) % 3;
                foreach (var dest in nodes[node])
                {
                    if (distances[dest, nextState] != -1) continue;
                    distances[dest, nextState] = distances[node, state] + 1;
                    queue.Enqueue(Tuple.Create(dest, nextState));
                }
            }

            var goalDistance = distances[t, 0];
            var answer = goalDistance < 0 ? -1 : goalDistance / 3;

            // 解答の出力
            Console.WriteLine(answer);
        }
    }
}


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

const long long mod = 1e9 + 7;

using ll = long long;
using pii  = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

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

ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }

double f(double a, double b, double theta) {
    if (theta > PI/2.0 - EPS) return 0.0;
    double res = 0.0;
    if (tan(theta) <= b/a) {
        res = (a*a*b - a*a*a*tan(theta)/2.0);
    }
    else {
        res = a*b*b/tan(theta)/2.0;
    }
    return res;
}

int main(){
    double a, b, x;
    cin >> a >> b >> x;
    double ok = PI / 2.0, ng = 0.0;
    rep(i, 1e6) {
        double mid = (ok+ng) / 2.0;
        if (f(a, b, mid) < x) ok = mid;
        else ng = mid;
    }
    cout << fixed << setprecision(7) << (ok/PI*180.0) << endl;
    return 0;
}


Measured memory_bytes: 4300
#include <bits/stdc++.h>
using  namespace std;
typedef long long ll;
#define RAP(i, n) for(ll i=0;i<(n);i++)
#define FOR(i, a, b) for(ll i=(a);i<(b);i++)
int main(){
    string s;
    bool flagR = true;
    ll countR = 0, countL = 0;
    ll pointR=0;
    cin >> s;
    ll ans[s.length()] = {};
    RAP(i, s.length()){
        if(flagR==true){
            if(s[i+1] == 'L'){
                pointR=i;
                flagR=false;
            }  
            countR++;
        }else{
            countL++;
            if(i==(s.length()-1) || s[i+1] == 'R'){
                if(countR%2){
                    ans[pointR]=countR/2+1;
                    ans[pointR+1]=countR/2;
                }else{
                    ans[pointR]=countR/2;
                    ans[pointR+1]=countR/2;
                }
                if(countL%2){
                    ans[pointR+1]+=countL/2+1;
                    ans[pointR]+=countL/2;
                }else{
                    ans[pointR]+=countL/2;
                    ans[pointR+1]+=countL/2;
                }
              	countL = 0;
              	countR = 0;
                flagR=true;
            }
        }
    }
    RAP(i, s.length()){
        cout << ans[i] << " ";
    }
    cout << endl;
    return 0;
}


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

int main() {
  int N,i,j;
  cin>>N;
  int count=N;
  vector<int> num(N);
  for(i=0;i<N;i++)cin>>num[i];
  for(i=1;i<N;i++){
    for(j=0;j<i;j++){
      if(num[i]==num[j]){
        count--;
        num[j]=0;
      }
    }
  }
  cout<<count<<endl;
}


Measured memory_bytes: 256
Imports System.Console
Module Program
 	Sub Main()
	    Dim s As String= Console.ReadLine()

	    Dim indexOfC As Integer = inStr(s, "C")
	    Dim indexOfF As Integer = inStr(indexOfC+1, s, "F")

        Console.WriteLine(IIF(indexOfC>=1 And indexOfF >=1 And indexOfC<indexOfF, "Yes", "No"))
    End Sub
End Module



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

int main(){
    int A,B,C;

    cin>>A>>B>>C;
    int count=0;
    while( count<C){
        if( (B-=A)>=0 )   count++;
        else break;
    }
    cout<<count<<endl;
}

Measured memory_bytes: 256
fn main() {
    let (r, w) = (std::io::stdin(), std::io::stdout());
    let mut sc = IO::new(r.lock(), w.lock());
    let mut n: usize = sc.read();
    let k: usize = sc.read();
    let mut count = 0;
    while n > 0 {
        n /= k;
        count += 1;
    }
    println!("{}", count);
}

pub struct IO<R, W: std::io::Write>(R, std::io::BufWriter<W>);

impl<R: std::io::Read, W: std::io::Write> IO<R, W> {
    pub fn new(r: R, w: W) -> IO<R, W> {
        IO(r, std::io::BufWriter::new(w))
    }
    pub fn write<S: std::ops::Deref<Target = str>>(&mut self, s: S) {
        use std::io::Write;
        self.1.write(s.as_bytes()).unwrap();
    }
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .0
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r' || b == b'\t')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r' && b != b'\t')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
#define cyes cout<<"YES"<<endl
#define cno cout<<"NO"<<endl
#define sp <<" "<<
#define cst(x) cout<<fixed<<setprecision(x)
#define pi 3.14159265359
#define mod 1000000007
struct edge {
    int to; 
    int weight;
    edge(int t, int w) : to(t),weight(w) {}
};
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vl = vector<ll>;
using Graphi = vector<vi>;
using Graphe = vector<vector<edge> >;
using que_a = priority_queue<int, vector<int>, greater<int> >;
using que_d = priority_queue<int>;
using pint = pair<int,int>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

Graphi G;
vl ans,w;

void dfs(int v = 0,int p = -1, ll flow = 0){
    ans.at(v) = flow + w.at(v);
    for(auto nv : G.at(v)){
        if(nv == p) continue;
        dfs(nv,v,ans.at(v));
    }
}
int main(){

    int n,q; cin >> n >> q;
    G.resize(n);
    rep(i,n-1){
        int a,b; cin >> a >> b;
        --a;--b;
        G.at(a).push_back(b);
        G.at(b).push_back(a);
    }
    w.assign(n,0);
    rep(i,q){
        int a,b; cin >> a >> b;
        --a;
        w.at(a) += b;
    }
    ans.resize(n);
    dfs();
    rep(i,n){
        if(i != 0) cout << " ";
        cout << ans.at(i);
    }
    cout << endl;


}

Measured memory_bytes: 28928
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <functional>
#include <utility>
#include <tuple>
#include <cctype>
#include <bitset>
#include <complex>
#include <cmath>
#include <array>
using namespace std;
#define INF 0x3f3f3f3f
#define INFLL 0x3f3f3f3f3f3f3f3fLL
#define MOD 1000000007
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pint;
typedef pair<ll,ll> pll;
typedef tuple<int,int,int> tint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
int dx[8]={0,0,-1,1,1,1,-1,-1};
int dy[8]={-1,1,0,0,1,-1,1,-1};
const int SIZE=300050;
//ここまでテンプレ
//↓Binary Indexed Tree
struct BIT{
private:
	int n;
	vector<int> node;
public:
	//N要素のBITを作り、すべて0で初期化する
	//1-indexedであることに注意！！
	BIT(int N){
		node.resize(N+1,0);
		n=N;
	}
	//ノードiまでの和を計算する
	int sum(int i){
		if(!i)
			return 0;
		return node[i]+sum(i-(i&-i));
	}
	//ノードiにxを足す
	void add(int i,int x){
		if(i>n)
			return;
		node[i]+=x;
		add(i+(i&-i),x);
	}
};
//↑Binary Indexed Tree
int main(){
	int N,M;
	cin>>N>>M;
	//x=l,y=r
	//クエリ<x,0:区間,1:質問,y>
	vector<tint> Q;
	//クエリに質問を入れていく
	for(int i=1;i<=M;i++){
		for(int j=i;j<=M;j+=i){
			int a=j-i,b=j;
			Q.eb(b,1,b);
			Q.eb(a,1,b);
		}
	}
	sort(Q.begin(),Q.end());
	Q.erase(unique(Q.begin(),Q.end()),Q.end());
	//クエリに区間を入れる
	for(int i=0;i<N;i++){
		int l,r;
		cin>>l>>r;
		Q.eb(l,0,r);
	}
	sort(Q.begin(),Q.end());
	//BIT
	BIT B(M+2);
	//クエリを処理する
	vector<unordered_map<int,int>> pam(M+2);
	for(tint T:Q){
		int a,b,c;
		tie(a,c,b)=T;
		//区間クエリなら、区間を追加する
		if(c==0){
			//S.update(b,S.getsum(b,b+1)+1);
			B.add(b+1,1);
		}
		//質問クエリなら、質問に答える
		else{
			//pam[mp(a,b)]=S.getsum(b,M+1);
			pam[a][b]=B.sum(M+1)-B.sum(b);
		}
	}
	//答えを求める
	for(int i=1;i<=M;i++){
		int ans=0;
		for(int j=i;j<=M;j+=i){
			int a=j-i,b=j;
			ans+=pam[b][b]-pam[a][b];
		}
		cout<<ans<<endl;
	}
	return 0;
}

Measured memory_bytes: 91744
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <cmath>
#include <algorithm>
#include <utility>
#include <functional>
#define debug(x) cout << #x << " = " << x << endl
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;
const double EPS = 1e-9;

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

   string a,b;
   cin>>a>>b;
   string ans[3] = {"GREATER", "LESS", "EQUAL"};
   if(a.size() < b.size()) {
     cout << ans[1] << endl;
     return 0;
   } else if(a.size() > b.size()) {
     cout << ans[0] << endl;
     return 0;
   } else {
     rep(i, a.size()) {
       if(a[i] > b[i]) {
         cout << ans[0] << endl;
         return 0;
       } else if(a[i] < b[i]) {
         cout << ans[1] << endl;
         return 0;
       }
     }
   }
  cout << ans[2] << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define loop(n, i) for(int i=0;i<n;i++)
#define loop1(n, i) for(int i=1;i<=n;i++)
#define rloop(n, i) for(int i=n;i;i++)
#define HERE cout << "HERE: " << __LINE__ << endl;
#define INSP(v) cout << v << " at " << __LINE__ << endl;
using namespace std;
using ll = long long;
template <class T>
using V = vector<T>;

int main() {
    int n; cin >> n;
    cout << 3 * n * n << endl;
    return 0;
}



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

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

  vector<int> v(n);
  for (int i = 0; i < k; ++i) {
    int d;
    cin >> d;
    int x;
    for (int j = 0; j < d; ++j) {
      cin >> x;
      v.at(x - 1) = 1;
    }
  }

  int count = 0;
  for (auto elem : v) {
    if (elem == 0) {
      count++;
    }
  }

  cout << count << endl;
}


Measured memory_bytes: 3600
#include <bits/stdc++.h>
#define mod 1000000007
#define sp ' '
#define intmax 2147483647
#define llmax 9223372036854775807
#define mkp make_pair
typedef long long ll;
using namespace std;

int N, a, c;

int main(){
	cin >> N;
	for (int i = 0; i < N; ++i) {
		cin >> a;
		while (!(a & 1)) {
			a >>= 1;
			++c;
		}
	}
	cout << c << endl;
	return 0;
}



Measured memory_bytes: 256
#include <stdio.h>

int main(){
	int n1,n2,n3;
	int ans = 0;
	
	scanf("%d %d %d",&n1,&n2,&n3);
	
	if(n1 >= n2 && n1 >= n3)
	ans = n2+n3;
	else if(n2 >= n1 && n2 >= n3)
	ans = n1+n3;
	else
	ans = n2+n1;
	
	printf("%d",ans);
	
	return 0;
}

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


int dp[100001][101];
int minCost(int * arr,int n,int idx,int k)
{
	if(idx==n-1)
	return 0;
	
	if(dp[idx][k]!=-1)
	return dp[idx][k];
	
	int ans=INT_MAX;
	for(int d=1;d<=k;d++)
	{
		if(idx+d<n)
		ans=min(ans,abs(arr[idx]-arr[idx+d])+minCost(arr,n,idx+d,k));
	}
	dp[idx][k]=ans;
	return ans;
}

int main()
{
		int n,k;
	cin>>n>>k;
	
	int arr[n];
	for(int i=0;i<n;i++)
	{
		cin>>arr[i];
	}
	memset(dp,-1,sizeof(dp));
	cout<<minCost(arr,n,0,k);
}


Measured memory_bytes: 52760
#include<stdio.h>
int main()
{
    double fir, sec;
    long long int x, y, ans, i;
    scanf("%lld %lld", &x, &y);
    for(i=0;i<1000000000;i++)
    {
        fir=fabs(x-i);
        //printf("%.0lf ", fir);
        sec=fabs(y-i);
        //printf("%.0lf\n", sec);
        if(fir==sec)
        {
            ans=i;
            printf("%lld\n", i);
            break;
        }
    }
    if(fir!=sec)
    {
        printf("IMPOSSIBLE\n");
    }
    return 0;
}


Measured memory_bytes: 1720