akhauriyash/Code-Regression huggingface dataset:
import java.util.*;

class Main {
    //Bellman-Ford's Algorithm
    private static final int MAX = 99999;
    public static void main(String[] args) throws Exception {
        Scanner scanner = new Scanner(System.in);
        int V = scanner.nextInt();
        int E = scanner.nextInt();
        int src = scanner.nextInt();

        int[] dist = new int[V];
        int[][] edges = new int[E][3];

        for(int i = 0; i < V; ++i){
            dist[i] = MAX;
        }
        dist[src] = 0;

        for(int i = 0; i < E; ++i){
            int[] edge = new int[] {scanner.nextInt(), scanner.nextInt(), scanner.nextInt()};
            edges[i] = edge;
        }

        for(int i = 1; i < V; ++i){
            for(int j = 0; j < E; ++j){
                int[] edge = edges[j];
                if(dist[edge[0]] != MAX && dist[edge[1]] > dist[edge[0]] + edge[2]){
                    dist[edge[1]] = dist[edge[0]] + edge[2];
                }
            }
        }

        boolean containNegativeCycle = false;
        for(int j = 0; j < E; ++j){
            int[] edge = edges[j];
            if(dist[edge[0]] != MAX && dist[edge[1]] > dist[edge[0]] + edge[2]){
                containNegativeCycle = true;
                break;
            }
        }

        if(containNegativeCycle){
            System.out.println("NEGATIVE CYCLE");
            return;
        }

        for(int i = 0; i < V; ++i){
            System.out.println(dist[i] == MAX ? "INF" : dist[i]);
        }
    }
}

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

const int MAX_N = 2e5;
int N, M, cnt[MAX_N+5];

int main(){
    cin >> N >> M;
    
    for(int i=0;i<M;i++){
        int a, b; cin >> a >> b;
        cnt[a]++; cnt[b]++;
    }

    bool ok = true;
    for(int i=1;i<=N;i++)
        if(cnt[i]%2) ok = false;

    if(ok) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}


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

#define fast ios_base::sync_with_stdio(false); cin.tie(nullptr); cin.tie(nullptr);
#define range(v) v.begin(),v.end()
#define int long long
#define pb push_back
#define mod (int)(1e9 + 7)
#define inf (int)(1e15)
#define N (int)(2e5 + 10)

using namespace std;


int solve() {
	int n;
	cin >> n;
	int cnt[N];
	int sum = 0;
	for (int i = 1; i <= n; i++) {
		int a;
		cin >> a;
		cnt[a]++;
		sum += a;
	}

	int q;
	cin >> q;
	while (q--) {
		int b, c;
		cin >> b >> c;
		int diff = c - b;
		sum += cnt[b] * (diff);
		cnt[c] += cnt[b];
		cnt[b] = 0;
		cout << sum << endl;
	}

	return 0;
}

int32_t main() {
	fast
	int t_c = 1;
	// cin >> t_c;
	while (t_c--) {
		auto ans = solve();
		// cout << ans << endl;
	}
}

Measured memory_bytes: 4440
from math import ceil,floor,comb,factorial,gcd,pow,sqrt,log2,cos,sin,tan,acos,asin,atan,degrees,radians,pi,inf
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from collections import deque,defaultdict,Counter
from bisect import bisect_left,bisect_right
from operator import itemgetter
from heapq import heapify,heappop,heappush
from copy import deepcopy
from time import time
import string
import sys
sys.setrecursionlimit(10 ** 7)
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def LIST()  : return list(MAP())

sx, sy, tx, ty = MAP()
dx = tx - sx
dy = ty - sy

print('U'*dy+'R'*dx+'D'*dy+'L'*dx+'L'+'U'*(dy+1)+'R'*(dx+1)+'D'+'R'+'D'*(dy+1)+'L'*(dx+1)+'U')

Measured memory_bytes: 10004
#include <bits/stdc++.h>
#define REP(i, s, n) for (int i = s; i < (int)(n); i++)
#define ALL(a) a.begin(), a.end()
#define MOD 1000000007
using namespace std;
using ll = long long;

int main() {
    int N; cin >> N;
    vector<int> A(N);
    REP(i, 0, N) cin >> A[i];

    int cur = A[0]; ll ans = 0;
    REP(i, 1, N) {
        if (cur > A[i]) {
            ans += cur - A[i];
        } else {
            cur = A[i];
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4052
#include <iostream>
#include <cassert>
#include <cmath>
#include <vector>
#include <algorithm>

using ll = long long;
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
#define MAX(a, b) (((a) < (b)) ? (b) : (a))

int const nmax = 400;
std::vector<std::pair<int,int>> v;
std::vector<int> used[5 + nmax];
int seen[5 + nmax], failure[5 + nmax];

void computelist(int n, int id) {
  for(int i = 1;i <= n; i++)
    seen[i] = 0;
  seen[id] = 1;
  for(int i = v.size() - 1; 0 <= i; i--) {
    int x = v[i].first;
    int y = v[i].second;
    if(seen[x] == 1 && seen[y] == 1){
      failure[id] = 1;
      return ;
    } else if(seen[x] == 1) {
      seen[y] = 1;
      used[id].push_back(i);
    } else if(seen[y] == 1) {
      seen[x] = 1;
      used[id].push_back(i);
    }
  }
  std::reverse(used[id].begin(), used[id].end());
}

int solve(int n, int x, int y) {
  if(failure[x] == 1 || failure[y] == 1)
    return 0;
  else {
    std::vector<int> newlist(used[x].size() + used[y].size());
    std::merge(used[x].begin(), used[x].end(), used[y].begin(), used[y].end(), newlist.begin());
    newlist.erase(std::unique(newlist.begin(), newlist.end()), newlist.end());
    for(int i = 1;i <= n; i++)
      seen[i] = 0;
    seen[x] = seen[y] = 1;
    
    for(int i = newlist.size() - 1; 0 <= i; i--) {
      int id = newlist[i];
      int x = v[id].first, y = v[id].second;
      if(seen[x] == 1 && seen[y] == 1)
        return 0;
      else
        seen[x] = seen[y] = 1;
    }
    return 1;
  }
}

int main() {
  int n, m;
  std::cin >> n >> m;
  for(int i = 0; i < m; i++) {
    int x, y;
    std::cin >> x >> y;
    v.push_back({x, y});
  }
  for(int i = 1;i <= n; i++)
    computelist(n, i);
  int result = 0;
  for(int i = 1; i <= n; i++)
    for(int j = i + 1; j <= n; j++)
      result += solve(n, i, j);
  std::cout << result;
  return 0;
}


Measured memory_bytes: 4316
# -*- coding: utf-8 -*-
import collections
from collections import Counter

n = int(input())
s = []
for i in range(n):
    s.append(str(input()))
"""
s.sort()
count = 1
max_ = 0
ans = []
for i in range(n - 1):
    if s[i] == s[i + 1]:
        count += 1
    elif s[i] != s[i + 1]:
        if max_ <= count:
            max_ = count
            ans.append(s[i])
            count = 1

for i in range(len(ans)):
    print(ans[i], end = '')
"""

count = Counter(s)
max_number = 0
ans = []
for i in count.most_common():
    ans.append(list(i))
len_ans = len(ans)
ans.sort(key = lambda x : x[1])
tmp = ans[len_ans - 1][1]
ans.sort()
for i in range(len_ans):
    if ans[i][1] == tmp:
        print(ans[i][0])


Measured memory_bytes: 67948
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
#define sc(x) scanf("%d", &x)
#define pb push_back
#define mk make_pair
#define fi first
#define se second
#define ALL(x) x.begin(), x.end()
#define SZ(x) ((int)x.size())
#define sqr(x) ((x)*(x))
#define ABS(x) ((x)>=0?(x):(-(x)))
#define fastio ios::sync_with_stdio(0),cin.tie(0)
template<class T>T gcd(T a, T b){return b?gcd(b, a%b):a;}

int main()
{
    int n;
    sc(n);
    if(n%2 == 0){
        printf("%d\n", n*(n-2)/2);
        for(int i = 1; i <= n; i++){
            for(int j = i+1; j <= n; j++){
                if(i+j == n+1)continue;
                else printf("%d %d\n", i, j);
            }
        }
    }
    else{
        printf("%d\n", (n-1)*(n-1)/2);
        for(int i = 1; i <= n; i++){
            for(int j = i+1; j <= n; j++){
                if(i != n && i+j == n)continue;
                else printf("%d %d\n", i, j);
            }
        }
    }
    return 0;
}



Measured memory_bytes: 256
def right_triangle(a, b, c)
  if a * a + b * b == c * c
    return true
  else
    return false
  end
end

r, l = 0, 0

while line = gets
  arr = line.split(",").map(&:to_i)
  l += 1 if arr[0] == arr[1]
  r += 1 if right_triangle(arr[0], arr[1], arr[2])
end

puts r, l

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

int main() {
    string a;
    int ans = 0;
    cin >> a;
    if (a[0] == '1'){
        ++ans;
    }
    if (a[1] == '1'){
        ++ans;
    }
    if (a[2] == '1'){
        ++ans;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3620
import sys

input = sys.stdin.readline


def main():
    N = int(input())
    h = list(map(int, input().split()))

    dp = [0] * N
    dp[1] = abs(h[1] - h[0])
    for i in range(2, N):
        a = dp[i - 2] + abs(h[i] - h[i - 2])
        b = dp[i - 1] + abs(h[i] - h[i - 1])
        if a < b:
            dp[i] = a
        else:
            dp[i] = b

    ans = dp[-1]
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 20352
#include<iostream>
#include<fstream>
#include<math.h>
#define _cin ios_base::sync_with_stdio(0);  cin.tie(0);
#define ll long long 
using namespace std;

int main(){
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    freopen("error.txt", "w", stderr);
    #endif
    _cin;

    int a,b;
    cin>>a>>b;
    if(b%2!=0)cout<<"No"<<endl;
    else{
        if(b/2 - a >=0 && 2*a - b/2 >= 0)cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
    }
}

Measured memory_bytes: 3132
/*input
1
1

*/
 
/*
                                                    ______________
                                                          |       )
                                                          |   )   /
                                                          |______/
                                                    |     |      \
                                                    |     |   )   \
                                                    |_____|_______)
 
*/
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <iomanip>
#include <fstream>
#include <stack>

using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> PII;
typedef pair<ll , ll> PLL;
typedef long double ld;
 
#define pb push_back
#define all(c) c.begin(),c.end()
#define allr(c) c.rbegin(),c.rend()
int mod = 1000000007;
const int inf = 1034567891;
const ll LL_INF = 1234567890123456789ll;
#define PI 3.14159265
#define endl '\n'
#define F first
#define S second
#define debug(x) cout << #x << " = " << x << endl;
#define TRACE
 
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cout << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif
 
#define out(container) for (auto it : container) cout << it << " "; cout << endl;
 
 
template < typename T > T GCD(T a, T b)            { ll t; while(a) { t = a; a = b % a; b = t; } return b; }
template < typename T > string toString(T a)       { return to_string(a); }
template < typename T > void toInt(string s, T &x) { stringstream str(s); str >> x;}
inline int add(int x, int y){ x += y; if(x >= mod) x -= mod; return x;}
inline int sub(int x, int y){ x -= y; if(x < 0) x += mod; return x;}
inline int mul(int x, int y){ return (x * 1ll * y) % mod;}
inline int powr(int a, ll b){
  int x = 1 % mod;
  while(b){
    if(b & 1) x = mul(x, a);
    a = mul(a, a);
    b >>= 1;
  }
  return x;
}
inline int inv(int a){ return powr(a, mod - 2);}

long long get(long long n) {
  return n * (n + 1) / 2;
}

int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  
  int n;
  cin >> n;
  int u, v;
  long long ans = 0;
  for (int i = 0; i < n - 1; i++) {
    cin >> u >> v;
    if (u > v)
      swap(u, v);
    long long cur = u * 1ll * (n - v + 1);
    ans -= cur;
  }  

  for (int i = 0; i < n; i++) {
    ans += get(n - i);
  }

  cout << ans << endl;


  return 0;
}

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

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

  vector<pair<int, int>> xy(n);
  for (int i = 0; i < n; ++i)
    cin >> xy[i].first >> xy[i].second;

  map<pair<int, int>, int> m;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n; ++j) {
      if (i == j)
        continue;
      int x = xy[i].first - xy[j].first;
      int y = xy[i].second - xy[j].second;
      auto p = make_pair(x, y);
      if (m.find(p) == m.end())
        m.emplace(p, 0);
      m[p]++;
    }
  }

  int cnt = 0;
  for (auto p : m)
    cnt = max(cnt, p.second);

  int cost = n - cnt;
  cout << cost << endl;
}

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

using namespace std;

#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define endl			"\n"

int32_t main(){
	
	float n, m, i, tot = 0, sel = 0;
	cin>>n>>m;
	vector<float> v(n);
	for(i=0; i<n; i++){
		cin>>v[i];
		tot += v[i];
	}
	for(i = 0; i < n; i++){

		if(v[i] >= tot / (4.0 * m))
			sel++;
		if(sel == m)
			break;
	}

	if(sel >= m)
		cout<<"Yes";
	else
		cout<<"No";

	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
  int m,f,r;
  char result;

  while(1){
    scanf("%d %d %d",&m,&f,&r);
    if(m==-1 && f==-1 && r==-1){
      break;
    }
    if(m==-1 || f==-1){
      result='F';
    }else if(m+f>=80){
      result='A';;
    }else if(m+f>=65 && m+f<80){
      result='B';
    }else if(m+f>=50 && m+f<65){
      result='C';
    }else if(m+f>=30 && m+f<50){
      result='D';
      if(r>=50) result = 'C';
    }else if(m+f<30){
      result='F';
    }

    printf("%c\n",result);

  }

  return 0;
}

Measured memory_bytes: 600
def main
  n = gets.chomp.to_i
  n.times do
    mcxi1,mcxi2 = gets.chomp.split(' ').map{ |x| to_integer(x)}
    puts to_mcxi(mcxi1 + mcxi2)
  end
end

def to_integer mcxi
  integer = 0
  num = 1
  0.upto(mcxi.size - 1) do |idx|
    if mcxi[idx] =~ /[2-9]/
      num = mcxi[idx].to_i
      next
    end

    integer += num * begin
      case mcxi[idx]
      when 'm'; 1000
      when 'c'; 100
      when 'x'; 10
      when 'i'; 1
      end
    end
    num = 1
  end
  integer
end

def to_mcxi integer
  mcxi = ''
  m = integer / 1000
  unless m == 0
    mcxi << m.to_s unless m == 1
    mcxi << 'm'
  end

  c = integer % 1000 / 100
  unless c == 0
    mcxi << c.to_s unless c == 1
    mcxi << 'c'
  end

  x = integer % 100 / 10
  unless x == 0
    mcxi << x.to_s unless x == 1
    mcxi << 'x'
  end

  i = integer % 10 / 1
  unless i == 0
    mcxi << i.to_s unless i == 1
    mcxi << 'i'
  end

  mcxi
end

main

Measured memory_bytes: 6136
#include<iostream>
#include<vector>
#include<algorithm>
#include<numeric>
using namespace std;
using ll = long long;
#define int ll

signed main(){
    int N; cin >> N;
    vector<int>A(N);
    for(auto & e : A) cin >> e;
    int sum = A.front() - 1;
    int crt = 2;
    for(int i = 1; i < A.size(); ++i){
        if(crt > A[i])continue;
        if(crt == A[i]){++crt; continue;}
        int mod = A[i] % crt;
        int div = A[i] / crt;
        sum += div - (mod == 0);
        crt = max(crt,(mod != 0 ? 1 : crt));
    }
    cout << sum << endl;
}


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

int main() {
  int N, count;
  cin >> N;
  if(N < 10){ count = N; } 
  else if(10 <= N && N < 100){ count = 9; } 
  else if(100 <= N && N < 1000){ count = 9+N-99; } 
  else if(1000 <= N && N < 10000){ count = 909; } 
  else if(10000 <= N && N < 100000){ count = 909+N-9999; } 
  else if(N == 100000){ count = 90909; } 

  cout << count << endl;
  return 0;
}  

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
	int n;
	while(cin >> n) {
		int a[n+1], m2 = 0, m4 = 0;
		
		for(int i = 1; i <= n; i++) {
			cin >> a[i];
			if(a[i] % 4 == 0) m4++;
			else if(a[i] % 2 == 0) m2++;
		}
		
		if((m4 * 2 + (m2 - 1 >= 0 ? m2 - 1 : 0)) >= n - 1) cout << "Yes" << endl;
		else cout << "No" << endl;
	}
	
	return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <limits>
#include <unordered_map>

using namespace std;
using str = string;

#define rep(a,l,r) for(int a=(l);a<(r);a++)
#define get cin>>
#define put cout<<

void run() {

	str s; get s;
	str t; get t;

	rep(i,0,s.length()){
		if (s == t){
			put "Yes";
			return;
		}

		char tmp = s[0];
		s.erase(s.begin());
		s.push_back(tmp);
	}

	put "No";

}

int main() {ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);run();return 0;}


Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define debug(x) cerr << #x << ": " << x << endl;
#define debug2(x, y) debug(x) debug(y);
#define repn(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(i, a) for(int i = 0; i < (int)(a); i++)
#define all(v) v.begin(), v.end() 
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define sq(x) ((x) * (x))

template<class T> T gcd(T a, T b){ return ((b == 0) ? a : gcd(b, a % b)); }

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	//freopen("input.in", "r", stdin);
	//freopen("output.out", "w", stdout);
	int n, x, y;
	cin >> n >> x >> y;
	vi cnt(n + 1, 0);
	repn(i, 1, n + 1) repn(j, i + 1, n + 1){
		cnt[min({abs(i - j), 1 + abs(i - x) + abs(j - y), 1 + abs(i - y) + abs(j - x)})]++;
	}
	repn(i, 1, n) cout << cnt[i] << endl;
	return 0;
}
/*
Things to look out for:
	- Integer overflows
	- Array bounds
	- Special cases
Be careful!
*/


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

#define ll long long
#define mp make_pair
#define pb push_back

const int N = 1 << 18;
const int mod = 998244353;
const int inf = 0x3f3f3f3f;

int mx[N << 1];

void upd(int x, int v) {
	mx[x += N] = v;
	while (x >>= 1) mx[x] = max(mx[x << 1], mx[x << 1 | 1]);
}

int qry(int l, int r) {
	int ans = -inf;
	for (l += N, r += N; l < r; l >>= 1, r >>= 1) {
		if (l & 1) ans = max(ans, mx[l ++]);
		if (r & 1) ans = max(ans, mx[-- r]);
	}
	return ans;
}

int n;
pair <int, int> v[N];
int f[N];

int main() {
	ios :: sync_with_stdio(0);
	cin >> n;
	for (int i = 0; i < n; ++ i) cin >> v[i].first >> v[i].second;
	sort(v, v + n);
	memset(mx, -0x3f, sizeof(mx));
	for (int i = n - 1; ~i; -- i) {
		int L = i + 1;
		int R = lower_bound(v, v + n, make_pair(v[i].first + v[i].second, 0)) - v;
		upd(i, max(i, qry(L, R)));
	}
	f[n] = 1;
	for (int i = n - 1; ~i; -- i) {
		int to = qry(i, i + 1);
		//
		(f[i] += f[i + 1]) %= mod;
		//
		(f[i] += f[to + 1]) %= mod;
	}
	cout << f[0] << endl;
	return 0;
}

Measured memory_bytes: 5120
import java.util.*;

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

      int n=sc.nextInt();

      int ans=0;

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

      System.out.println(ans);

    }
}


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

namespace Practice
{
    class Program
    {
        static void Main(string[] args)
        {
            SolveA();
            //SolveB();
            //SolveC();
            //SolveD();
        }
        private const long MOD = 1000000007;

        static void SolveA()
        {
            var o = ReadAndParseIntArr();
            int a = o[0];
            int b = o[1];
            int c = o[2];

            int ans = Math.Min(b + c, Math.Min(a + b, a + c));
            Console.WriteLine(ans);
        }

        #region よく使う便利関数
        private static bool isPrime(long x)
        {
            if (x == 2) { return true; }
            if (x < 2 || x % 2 == 0) { return false; }
            long i = 3;
            while (i * i <= x)
            {
                if (x % i == 0) { return false; }
                i = i + 2;
            }
            return true;
        }
        private static long lcm(long x, long y)
        {
            return x / gcd(x, y) * y;
        }
        private static long gcd(long x, long y)
        {
            return y > 0 ? gcd(y, x % y) : x;
        }
        private static long pow(long x, long n)
        {
            if (n == 0) { return 1; }
            long res = pow(x * x % MOD, n / 2);
            if (n % 2 == 1)
            {
                res = res * x % MOD;
            }
            return res;
        }
        private static int ReadAndParseInt()
        {
            return int.Parse(Console.ReadLine());
        }
        private static int[] ReadAndParseIntArr()
        {
            return Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
        }
        private static long ReadAndParseLong()
        {
            return long.Parse(Console.ReadLine());
        }
        private static long[] ReadAndParseLongArr()
        {
            return Array.ConvertAll(Console.ReadLine().Split(' '), long.Parse);
        }
        #endregion
    }
}

Measured memory_bytes: 13140
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>

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

using namespace std;
#define int long long
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repr(i,n) for(ll i=n;i>=0;i--)
#define P pair<ll, ll>
#define sz(x) (ll)x.size()
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define VE vector<ll>
#define COUT(x) cout<<(x)<<endl
#define MA map<ll,ll>
#define SE set<ll>
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,VE,greater<ll>>
#define COUT(x) cout<<(x)<<endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define EPS (1e-10)


const long long MOD = 1000000007;
//const long long MOD = 998244353;
const long long INF = 1LL << 60;


long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	unsigned r;
	while ((r = a % b)) {
		a = b;
		b = r;
	}
	return b;
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a * g / b;
}
bool prime(ll n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}




const long double PI = 3.14159265359;
const int MAX_N = 100010;
int n;
int ans = 0;

void dfs(int x, int a, int b, int c) {
	if (x > n)return;
	if (a&&b&&c) {
		ans++;
	}
	dfs(x * 10 + 3, 1, b, c);
	dfs(x * 10 + 5, a, 1, c);
	dfs(x * 10 + 7, a, b, 1);
}

signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cin >> n;
	dfs(0, 0, 0, 0);
	cout << ans << endl;
	return 0;
}

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

int h, w;
string S[30];
int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};

int check(int sy, int sx, int gy, int gx) {
    bool used[30][30] = {0};
    queue<pair<int, int>> que;
    que.push({sy, sx});
    used[sy][sx] = 1;
    int cnt = 0;
    while(!que.empty()) {
        int s = que.size();
        for (int _ = 0; _ < s; _++) {
            int y = que.front().first;
            int x = que.front().second;
            que.pop();
            if (y == gy && x == gx) return cnt;
            for (int i = 0; i < 4; i++) {
                int ny = y + dy[i], nx = x + dx[i];
                if(ny < 0 || ny >= h || nx < 0 || nx >= w) continue;
                if(used[ny][nx] || S[ny][nx] == '#') continue;
                used[ny][nx] = 1;
                que.push({ny, nx});
            }
        }
        cnt++;
    }
}

int main() {
    cin >> h >> w;
    for (int i = 0; i < h; i++) cin >> S[i];
    int ans = 0;
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            for (int k = 0; k < h; k++) {
                for (int l = 0; l < w; l++) {
                    if (S[i][j] == '#' || S[k][l] == '#') continue;
                    ans = max(ans, check(i, j, k, l));
                }
            }
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int Mod=1e9+7;
int n,f[110][5][5][5],ans;
int main()
{
	scanf("%d",&n);
	for(register int i=0;i<4;i++)
		for(register int j=0;j<4;j++)
			for(register int k=0;k<4;k++)
				f[3][i][j][k]=1;
	f[3][0][2][1]=0;
	f[3][0][1][2]=0;
	f[3][2][0][1]=0;
	for(register int i=4;i<=n;i++)
		for(register int a1=0;a1<4;a1++)
			for(register int a2=0;a2<4;a2++)
				for(register int a3=0;a3<4;a3++)
					for(register int a4=0;a4<4;a4++)
					{
						if(a1==0 && a3==2 && a4==1 || a2==2 && a3==0 && a4==1 || a2==0 && a3==2 && a4==1 || a2==0 && a3==1 && a4==2 || a1==0 && a2==2 && a4==1)
						continue;
						(f[i][a2][a3][a4]+=f[i-1][a1][a2][a3])%=Mod;
					}
	for(register int i=0;i<4;i++)
		for(register int j=0;j<4;j++)
			for(register int k=0;k<4;k++)
				(ans+=f[n][i][j][k])%=Mod;
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 256
fun main() {
    val n = readLine()!!.toInt()
    val arr = readLine()!!.split(" ").map { it.toInt() }.toIntArray()
    arr.sort()
    var count = 0
    for (i in arr.indices) {
        for (j in i + 1..arr.lastIndex) {
            for (k in j + 1..arr.lastIndex) {
                val a = arr[i]
                val b = arr[j]
                val c = arr[k]
                if (a != b && b != c && isValidTriangle(a, b, c)) {
                    count++
                }
            }
        }
    }
    println(count)
}

private fun isValidTriangle(a: Int, b: Int, c: Int): Boolean {
    return a - b < c && c < a + b
}

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

signed main(){
	int k; cin >> k;
	string s; cin >> s;
	if(s.size() <= k) cout << s << endl;
	else{
		for(int i = 0; i < k; i++) cout << s[i];
		cout << "..." << endl;
	}
}

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

const int MAX_N = 2e5+10;
const int MOD = 1e9+7;
int a[MAX_N],b[MAX_N];
ll dp[MAX_N],sum[MAX_N];
int n;

void solve()
{
    n = unique(a+1,a+n+1)-(a+1);
	dp[0] = 1LL; 
	for(int i=1; i<=n; i++){
		dp[i] = dp[i-1];
		(dp[i]+=sum[a[i]])%=MOD;
		(sum[a[i]]+= dp[i-1])%=MOD;
	}
	printf("%lld\n",dp[n]);
}

int main()
{
	scanf("%d",&n);
	for(int i=1; i<=n; i++) scanf("%d",&a[i]);
    solve();
	return 0;
}

Measured memory_bytes: 7684
s=input()
n=len(s)
if s[0]!="A":
    print("WA")
    exit()
if all(s[i]!="C" for i in range(2,n-1)):
    print("WA")
    exit()
f=0
for i in range(n):
    if s[i]==s[i].upper():
        f+=1
print("AC" if f==2 else "WA")
    
    


Measured memory_bytes: 9036
/*
 * Author: Utkal Sinha
 * Created on: 2020-08-22, Sat, 18:9
 * Problem:
 * Platfrom: General
 * */
#if USE_BOOST2
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_bin_float.hpp>
namespace bst = boost::multiprecision;
typedef bst::int1024_t vll; //int512_t or //int128_t
typedef bst::cpp_bin_float_100 vdouble;
#endif

#include <bits/stdc++.h>
using namespace std;
#define GETTIME std::chrono::system_clock::now()
#define DURATION std::chrono::duration<double>
#ifdef MY_DEV_ENV2
#define LOCALDEV
#endif
typedef long long ll;
typedef std::chrono::system_clock::time_point TPT;
static TPT starttime, endtime, timelimit;
static double problem_tle = 1.5;
static inline void calc_problem_end_time() {timelimit = starttime + std::chrono::milliseconds(int (problem_tle * 1000));}
// template end



void love() {
    int n, x, t;
    cin >> n >> x >> t;
    int ans = ceil(1.0 * n/x) * t;
    cout << ans << endl;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);
    srand(time(0));
#ifdef LOCALDEV
    freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
#endif
    int t = 1;
    //cin >> t;
#ifdef LOCALDEV
    starttime = GETTIME;
    calc_problem_end_time();
#endif
    while(t--) love();
#ifdef LOCALDEV
    endtime = GETTIME;
    DURATION elapsed_seconds = endtime - starttime;
    DURATION time_limit_seconds = timelimit - starttime;
    clog << "Elapsed time: " << elapsed_seconds.count() << "s\n";
    clog << "Time limit: " << time_limit_seconds.count() << "s\n";
#endif
    return 0;
}

Measured memory_bytes: 3624
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ld long double
#define al(a) (a).begin(),(a).end()
#define mk make_pair
#define check cout<<"?"<<endl;

ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;

int main(){
    string s; cin>>s;
    rep(i,s.size()-1){
        if(s[i]==s[i+1]){
            cout<<i+1<<" "<<i+2<<endl;
            break;
        }
        if(i<s.size()-2 && s[i]==s[i+2]){
            cout<<i+1<<" "<<i+3<<endl;
            break;
        }
        if(i==s.size()-2) cout<<"-1 -1"<<endl;
    }
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define int long long
struct FenwickTreeMax {
    vector<int> bit;
    int n;
    const int INF = (int)1e9;

    FenwickTreeMax(int n) {
        this->n = n;
        bit.assign(n, 0);
    }

    FenwickTreeMax(vector<int> a) : FenwickTreeMax(a.size()) {
        for (size_t i = 0; i < a.size(); i++)
            update(i, a[i]);
    }

    int getmax(int r) {
        int ret = 0;
        for (; r >= 0; r = (r & (r + 1)) - 1)
            ret = max(ret, bit[r]);
        return ret;
    }

    void update(int idx, int val) {
        for (; idx < n; idx = idx | (idx + 1))
            bit[idx] = max(bit[idx], val);
    }
};
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0); cout.tie(0);
  int n;
  cin >> n;
  vector<array<int,3>> h(n);
  int idx=0;
  for(auto &e: h) {
    e[2] = idx++;
    cin >> e[0];
  }
  for(auto &e: h) cin >> e[1];
  sort(h.begin(),h.end());
  auto ft = FenwickTreeMax(n);
  for(int i=0;i<n;i++) {
    int val = ft.getmax(h[i][2]);
    // cerr << "Max for " << h[i][0] << " = " << val << '\n';
    ft.update(h[i][2],val+h[i][1]);
  }
  cout << ft.getmax(n-1);
  return 0;
}

Measured memory_bytes: 6656
using System;
using System.Linq;
using static System.Console;
using static ConsoleApp.Util;
using static System.Math;
namespace ConsoleApp
{
    class Program
    {
        static void Main(string[] args)
        {
			long n,h;
			var arr = ReadLine().Split().Select(long.Parse).ToArray();
			n = arr[1];
			h = arr[0];
			long[] a = new long[n];
			long[] b = new long[n];
			for(int i = 0;i < n;i++){
				arr = ReadLine().Split().Select(long.Parse).ToArray();
				a[i] = arr[0];
				b[i] = arr[1];
			}
			//dp[i] モンスターのHPがjになる消費魔力の最小値
			long[] dp = new long[h+1];

			for(int i = 0;i <= h;i++){
				
					dp[i] = long.MaxValue;
			}

			dp[h] = 0;

			for(long i = h;i >= 0;i--){
				if(dp[i] == long.MaxValue)continue;
				for(long j = 0;j < n;j++){
					
					ChMin(ref dp[Math.Max(0,i-a[j])],dp[i] + b[j]);
				}
			}
			WriteLine(dp[0]);

        }

    }


    static class Util{
        public static void ChMin(ref long a,long b){
            
            if(a > b){
                a = b;
            }
        }

        public static void ChMax(ref long a,long b){
            if(a < b){
                a = b;
            }
        }

    }
}



Measured memory_bytes: 13356
/*{{{*/
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<string>
#include<iostream>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include<bitset>
#include<vector>
#include<limits.h>
#include<assert.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define FOR(I, A, B) for (int I = (A); I <= (B); ++I)
#define FORS(I, S) for (int I = 0; S[I]; ++I)
#define RS(X) scanf("%s", (X))
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
#define MP make_pair
#define PB emplace_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<PII> VPII;
typedef pair<LL,LL> PLL;
typedef vector<PLL> VPLL;
template<class T> void _R(T &x) { cin >> x; }
void _R(int &x) { scanf("%d", &x); }
void _R(int64_t &x) { scanf("%lld", &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template<class T, class... U> void R(T &head, U &... tail) { _R(head); R(tail...); }
template<class T> void _W(const T &x) { cout << x; }
void _W(const int &x) { printf("%d", x); }
void _W(const int64_t &x) { printf("%lld", x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template<class T,class U> void _W(const pair<T,U> &x) {_W(x.F); putchar(' '); _W(x.S);}
template<class T> void _W(const vector<T> &x) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W(const T &head, const U &... tail) { _W(head); putchar(sizeof...(tail) ? ' ' : '\n'); W(tail...); }
#ifdef HOME
 #define DEBUG(...) {printf("[DEBUG] ");W(__VA_ARGS__);}
#else
 #define DEBUG(...)
#endif
int MOD = 1e9+7;
void ADD(LL& x,LL v){x=(x+v)%MOD;if(x<0)x+=MOD;}
/*}}}*/
const int SIZE = 1<<20;
void solve() {
    LL N;
    R(N);
    LL now=26;
    int len=1;
    while(N>now){
        N-=now;
        now*=26;
        len++;
    }
    string an(len,'0');
    N--;
    for(int i=len-1;i>=0;i--){
        an[i]=N%26+'a';
        N/=26;
    }
    W(an);
}
int main(){
#define MULTITEST 0
#if MULTITEST    
    CASET{
        solve();
    }
#else
    solve();
#endif
    return 0;
}


Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize ("-ffloat-store")  
#pragma GCC optimize ("-fno-defer-pop")
#define all(a) a.begin(),a.end()
#define ll long long int
#define ld long double
ll power(ll a,ll b,ll m){ if(b==0) return 1; if(b==1) return a%m; ll t=power(a,b/2,m)%m; t=(t*t)%m; if(b&1) t=((t%m)*(a%m))%m; return t;}
ll modInverse(ll a, ll m) { return power(a, m-2, m); }
#define ps push_back
#define fs first
#define sc second
#define N 3000005
#define endl "\n"
#define mod 1000000007
string a,b;
ll dp[3001][3001],fl[3001][3001];
ll maxval(ll i,ll j){
	if(i==a.length()||j==b.length()){
		return 0;
	}
	if(dp[i][j]!=-1){
		return dp[i][j];
	}
	if(a[i]==b[j]){	
		fl[i][j]=0;
		return dp[i][j]=maxval(i+1,j+1)+1;
	}
	else {
		ll x,y;
		x=maxval(i+1,j);
		y=maxval(i,j+1);
		if(x>y){
			fl[i][j]=1;
			return dp[i][j]=x;
		}
		else {
			fl[i][j]=2;
			return dp[i][j]=y;
		}
	}
}
void prit(ll i,ll j){
	if(i==a.length()||j==b.length()){
		return ;
	}

	if(fl[i][j]==0){
		cout<<a[i];
		prit(i+1,j+1);
	}
	else if(fl[i][j]==1){
		prit(i+1,j);
	}
	else {
		prit(i,j+1);
	}
}
int main(){

	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	
	cin>>a>>b;
	ll i,j;
	memset(dp,-1,sizeof(dp));
	ll k=maxval(0,0);
	prit(0,0);
	return 0;
}


Measured memory_bytes: 141312
#include <cstdio>
#include <iostream>

using namespace std;

typedef long long LL;


const int N = 100005;

int n, m, h[N];

int head[N], numE = 0, v1, v2;

bool vis[N];

struct E{
	int next, v;
} e[N << 1];

void add(int u, int v) {
	e[++numE] = (E) { head[u], v };
	head[u] = numE;
}

int main() {
	scanf("%d%d", &n, &m);
	for (int i = 1; i <= n; i++) scanf("%d", h + i);
		int ans = 0;
	for (int i = 1; i <= m; i++) {
		int u, v; scanf("%d%d", &u, &v);
		add(u, v); add(v, u);
	}
	for (int u = 1; u <= n; u++) {
		bool ok = true;
		for (int i = head[u]; i ; i = e[i].next) {
			int v=  e[i].v;
			if (h[u] <= h[v]) { ok = false; break; }
		}
		if (ok) ans++;
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 5568
/*input
4 100000
100000 100000 100000 100000
*/

#include <bits/stdc++.h>

using namespace std;
using ll = long long;
/********************* MODULAR ARITHMETIC *******************************/

ll MOD = 1000000007;

void mod(ll &a){ if(a >= MOD) a %= MOD; }
ll add(ll a, ll b) { a += b; mod(a); return a; }
ll mul(ll a, ll b) { mod(a); mod(b); a *= b; mod(a); return a; }
ll sub(ll a, ll b) { mod(a); mod(b); a -= b; a += MOD; mod(a); return a; }

ll powr(ll a, ll b) {
  ll x = 1LL;
  while(b) {
    if(b & 1) x = mul(x, a);
    a = mul(a, a), b >>= 1;
  }
  return x;
}

ll inv(ll a) { return powr(a, (MOD - 2)); }

/************************************************************************/
vector < int > v;

int main()
{
  int n, k;
  cin >> n >> k;
  v.resize(n);
  for(auto &x: v) {
    cin >> x;
  }

  vector < ll > dp(k + 1, 1);

  for(int i = 1; i <= n; i ++) {
  	vector < ll > dp2(k + 1, 0);
    for(int j = 1; j <= k; j ++) {
    	int high = j;
    	int low = max(j - v[i - 1], 0);
    	if(low == 0) {
    		dp2[j] = dp[high];
    	} else {
    		dp2[j] = sub(dp[high], dp[low - 1]);
    	}
    }
    dp2[0] = 1;
    if(i < n) {
	    for(int j = 1; j <= k; j ++) {
	    	dp2[j] = add(dp2[j], dp2[j - 1]);
	    }
  	}
  	dp = dp2;
  }

  cout << dp[k];
  return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define ll long long
#define pb push_back
#define ff first
#define ss second
#define pll pair<ll,ll>
#define all(v) v.begin(),v.end()
#define mod 1000000007
#define mx 1000002
mt19937 myrand(time(0));

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(),cout.tie();
    ll ans=0;
    for(int i=1;i<=5;i++){
        ll x;
        cin>>x;
        if(x==0) ans=i;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repp(i, n, m) for (int i = (int)(n); i < (int)(m); i++)
#define rrep(i, n, m) for (int i = n; i >= m; i--)
#define p(a,b) printf(a,b);
#define o(s) cout<< s << endl;
typedef long long LL;
template <class T>
bool contain(const std::string &s, const T &v)
{
    return s.find(v) != std::string::npos;
}

int main()
{
    string s;
    bool flag=false, flag2=false;
    cin >> s;
    rep(i,s.size()){
        if(s[i]=='C'){
            flag=true;
        }else if(flag && s[i]=='F'){
            flag2=true;
        }
    }
    if(flag2){
        o("Yes");
    }else{
        o("No");
    }
}


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

int main(){
    int h, w;
    while(true){
        cin >> h >> w;
        if(h == 0 && w == 0) break;
        for(int i = 0; i < h; i++){
            for(int j = 0; j < w; j++){
                if(i == 0 || i == h - 1 || j == 0 || j == w - 1){
                    cout << "#";
                }
                else{
                    cout << ".";
                }
            }
            cout << endl;
        }
        cout << endl;
    }
    return 0;
}


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

using namespace std;
using ll = long long;

long long powe(long long base,long long exp){
    long long res = 1;
    while(exp>0){
        if(exp & 1)res = res * base;
        base = base * base;
        exp >>= 1;
    }
    return res;
}

int main()
{
    int n,m;
    cin >> n >> m;
    vector<int> q(m),c(m);
    for(int i = 0; i < m; i++){cin >> q[i] >> c[i];q[i]--;}

    int i = powe(10, n - 1);
    if(n == 1)i = 0;
    for(; i < powe(10,n); i++){
        string s = to_string(i);
        bool res = true;
        for(int j = 0; j < m; j++){
            if(s[q[j]] != ('0' + c[j]))res = false;
        }
        if(!res)continue;
        cout << i << endl;
        return 0;
    }

    cout << -1 << endl;
}

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

int main() {

	
	long long N;
	cin >> N;

	string S;
	cin >> S;


	if(S.length()%2 !=0){
		cout << "No";
	}
	else if (S.compare(0, (N / 2) , S, (N / 2), (N/2)) == 0)
	{
		cout << "Yes";
	}
	else {
		cout << "No";
	}
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
    int H, W;

    while(true){
        cin >> H >> W;
        if(H == 0 && W == 0)
            break;
        for(int i = 0; i < H; i++){
            for(int j = 0; j < W; j++)
                cout << "#";
        cout << endl;
        }
        cout << endl;
    }
}


Measured memory_bytes: 3084
#!/usr/bin/env python3


def solve(AB, BC, CA):
    print(int(AB * BC * 0.5))

# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)


def main():
    AB, BC, CA = list(map(int, input().split()))
    solve(AB, BC, CA)
    # Failed to predict input format
    pass


if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
using System;
using System.IO;
using System.Linq;
using System.Collections.Generic;

public class Program
{

    public void Proc() {
        int len = int.Parse(Reader.ReadLine());
        for (int i = 0; i < len;i++) {
            int[] tmp = new int[len];
            int[] inpt = Reader.ReadLine().Split(' ').Select(a => int.Parse(a)).Skip(2).ToArray();
            for (int j = 0; j < len; j++) {
                if(inpt.Contains(j+1)) {
                    tmp[j] = 1;
                }
            }
            Console.WriteLine(string.Join(" ", tmp.Select(a=>a.ToString()).ToArray()));
        }
    
    
    }



    public class Reader
    {
        private static StringReader sr;
        public static bool IsDebug = false;
        public static string ReadLine() {
            if(IsDebug) {
                if(sr == null) {
                    sr = new StringReader(InputText.Trim());
                }
                return sr.ReadLine();
            } else {
                return Console.ReadLine();
            }
        }
        private static string InputText = @"


6
1 2 2 4
2 1 5
3 2 5 6
4 0
5 1 4
6 1 6



";
    }

    public static void Main(string[] args)
    {
#if DEBUG
        Reader.IsDebug = true;
#endif
        Program prg = new Program();
        prg.Proc();
	}
}

Measured memory_bytes: 9784
from heapq import heappush,heappop,heapify
from collections import deque,defaultdict,Counter
import itertools
from functools import *
from itertools import permutations,combinations,groupby
import sys
import bisect
import string
import math
import time
import random
def Golf():
    *a,=map(int,open(0))
def S_():
    return input()
def IS():
    return input().split()
def LS():
    return [i for i in input().split()]
def I():
    return int(input())
def MI():
    return map(int,input().split())
def LI():
    return [int(i) for i in input().split()]
def LI_():
    return [int(i)-1 for i in input().split()]
def NI(n):
    return [int(input()) for i in range(n)]
def NI_(n):
    return [int(input())-1 for i in range(n)]
def StoI():
    return [ord(i)-97 for i in input()]
def ItoS(nn):
    return chr(nn+97)
def LtoS(ls):
    return ''.join([chr(i+97) for i in ls])
def GI(V,E,Directed=False,index=0):
    org_inp=[]
    g=[[] for i in range(n)]
    for i in range(E):
        inp=LI()
        org_inp.append(inp)
        if index==0:
            inp[0]-=1
            inp[1]-=1
        if len(inp)==2:
            a,b=inp
            g[a].append(b)
            if not Directed:
                g[b].append(a)
        elif len(inp)==3:
            a,b,c=inp
            aa=(inp[0],inp[2])
            bb=(inp[1],inp[2])
            g[a].append(bb)
            if not Directed:
                g[b].append(aa)
    return g,org_inp
def GGI(h,w,search=None,replacement_of_found='.',mp_def={'#':1,'.':0}):
#h,w,g,sg=GGI(h,w,search=['S','G'],replacement_of_found='.',mp_def={'#':1,'.':0}) # sample usage
    mp=[1]*(w+2)
    found={}
    for i in range(h):
        s=input()
        for char in search:
            if char in s:
                found[char]=((i+1)*(w+2)+s.index(char)+1)
                mp_def[char]=mp_def[replacement_of_found]
        mp+=[1]+[mp_def[j] for j in s]+[1]
    mp+=[1]*(w+2)
    return h+2,w+2,mp,found
def bit_combination(k,n=2):
    rt=[]
    for tb in range(n**k):
        s=[tb//(n**bt)%n for bt in range(k)]
        rt+=[s]
    return rt
def show(*inp,end='\n'):
    if show_flg:
        print(*inp,end=end)
YN=['YES','NO']
Yn=['Yes','No']
 
mo=10**9+7
inf=float('inf')
l_alp=string.ascii_lowercase
u_alp=string.ascii_uppercase
#ts=time.time()
#sys.setrecursionlimit(10**7)
input=lambda: sys.stdin.readline().rstrip()
 
def ran_input():
    import random
    n=random.randint(4,16)
    rmin,rmax=1,10
    a=[random.randint(rmin,rmax) for _ in range(n)]
    return n,a

def ran_input():
    import random
    n=random.randint(4,16)
    rmin,rmax=1,10
    a=[random.randint(rmin,rmax) for _ in range(n)]
    return n,a

show_flg=False
show_flg=True


st=set(input())
print(Yn[2-len(st)])



Measured memory_bytes: 38764
use itertools::Itertools;

const INF: i64 = 1_000_000_000;
fn main() {
	proconio::input!(n: usize, m: usize, r: usize, cities: [usize; r], mut roads: [(usize, usize, i64); m]);

	let mut dists = vec![vec![INF; n]; n];
	for (a, b, c) in roads {
		dists[a-1][b-1] = c;
		dists[b-1][a-1] = c;
	}
	for k in 0..n {
		for i in 0..n {
			for j in 0..n {
				if dists[i][j] > dists[i][k] + dists[k][j] {
					dists[i][j] = dists[i][k] + dists[k][j];
				}
			}
		}
	}

	let mut d_min = INF;
	(0..r).permutations(r).for_each(|js| {
		let mut d = 0;
		for i in 0..r-1 {
			d += dists[cities[js[i]]-1][cities[js[i+1]]-1];
		}
		if d_min > d {
			d_min = d;
		}
	});

	println!("{}", d_min);
}


Measured memory_bytes: 2968