akhauriyash/Code-Regression huggingface dataset:
// 失敗するからこそ そこから立ち向かって行く強さがあってそんな強さが本当の強さだと私は思うから
// ぜったいあきらめない
#if defined(DAIJOBU)
#include "/home/ichigo/includes.hpp"
#include "/home/ichigo/debug.hpp"
#define deb(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#include <bits/stdc++.h>
#define deb(x...)
#endif
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)

using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long lint;
typedef vector<lint> vlint;
typedef vector<vlint> vvlint;
typedef pair<lint, lint> plint;
typedef double ld;

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



int main() {
    ios::sync_with_stdio(false);
	cin.tie(0);
	
	int n;
	cin >> n;
	lint a[n];
	lint pro = 1;
	forn(i, n)cin >> a[i], pro *= a[i];
	ld sum = 0;
	forn(i, n)sum += 1 /(ld)a[i];
	cout << fixed << setprecision(18) << 1 / (ld)sum << '\n';
	return 0;
}


Measured memory_bytes: 256
// #include C/C++ {
#include <bits/stdc++.h>
// }
using namespace std;
// #typedef {
typedef long long int64;
typedef pair <int, int> PII;
typedef pair <int64, int64> PLL;
// }

// #parameter{
#ifdef DEBUG_MODE

#define TYPE decltype
#define RF(filename) {freopen((filename), "r", stdin);}
#define WF(filename) {freopen((filename), "w", stdout);}
#define DF(filename) {freopen((filename), "w", stderr);}
#define eprintf printf

#else

#define TYPE __typeof
#define RF(filename) {;}
#define WF(filename) {;}
#define DF(filename) {;}
#define eprintf(...)
#define fprintf(...)

#endif

// #define {
#define SZ(a) ((int)(a).size())
#define X first
#define Y second
#define MP make_pair
#define L(x) ((x)<<1)
#define R(x) ((x)<<1 | 1)
#define max3(x, y, z) (max(max((x), (y)), (z)))
#define min3(x, y, z) (min(min((x), (y)), (z)))
#define BIT(x, i) (((x) >> (i)) & 1)
#define ALL(it) (it).begin(), (it).end()
#define FILL(__space, __val) memset(__space, __val, sizeof(__space))
#define MOVE(__spaceTo, __spaceFrom) memmove(__spaceTo, __spaceFrom, sizeof(__spaceTo))
#define UNIQUE(__vector) sort(ALL(__vector)), __vector.resize(unique(ALL(__vector)) - __vector.begin())
#define FOR(it, c) for( TYPE((c).begin()) it = (c).begin(); it != (c).end(); it++)
/////////////////////////////////////////////////////////////
const double PI = acos(-1.0);
const double EPS = 1e-6;

#define MAX_N 100005
#define MAX_M 5005
#define MOD (int)(1e9+7)
#define INF ((1 << 30) - 1)
#define BINF ((1LL << 62) - 1LL)
#define NONE -1
#define NIL 0
// }

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

/////////////////////////////////////////////////////////////
int main() {
	RF("input.txt");
	//  WF("output.txt");
	DF("err.txt");

	int A, B, C;
	scanf("%d %d %d", &A, &B, &C);
	printf("%d\n", min(B / A, C));
	return 0;
}

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

int dx[8] = {1,0,-1,0,1,1,-1,-1};
int dy[8] = {0,1,0,-1,1,-1,1,-1};
bool seen[60][60];
int H,W;

void dfs(const vector<vector<int> > &Grid, int y, int x){
    seen[y][x] = true;
    for(int i = 0; i < 8; i++){
        int ny = y + dy[i];
        int nx = x + dx[i];
        if(ny < 0 || ny >= H || nx < 0 || nx >= W) continue;
        if(seen[ny][nx]) continue;
        if(Grid[ny][nx] == 0) continue;
        dfs(Grid,ny,nx);
    }
}

int main(){
    while(true){
        cin >> W >> H;
        if(!H && !W) break;
        vector<vector<int> > Grid(H,vector<int>(W));
        for(int i = 0; i < H; i++){
            for(int j = 0; j < W; j++){
                cin >> Grid[i][j];
            }
        }
        memset(seen,false,sizeof(seen));
        int cnt = 0;
        for(int i = 0; i < H; i++){
            for(int j = 0; j < W; j++){
                if(Grid[i][j] == 0) continue;
                if(seen[i][j]) continue;
                dfs(Grid,i,j);
                cnt++;
            }
        }
        cout << cnt << endl;
    }
    return 0;
}


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

#include <iostream>


#define MOD 1000000007

typedef unsigned long long ull;
typedef long long ll;

using namespace std;
auto f=[]()
{
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
};

int main()
{
	f();
	ll n,a,b;cin>>n>>a>>b;
	ll tot=(a+b);

	ll q=(n/tot);
	ll m=(n%tot);

	//cout<<((n/(a+b)*a)+min(a,n%(a+b)))<<'\n';
	cout<<((a*q)+min(a,m))<<'\n';
	return 0;
}


Measured memory_bytes: 256
n = int(input())
if n % 2 == 1:
  print(0)
elif n == 0:
  print(0)
else:
  m = n // 2
  l = 1
  ans = 0
  while 5**l <= m:
    ans += m//(5**l)
    l += 1
  print(ans)


Measured memory_bytes: 2940
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
using namespace std;
int a[10000005];
int main()
{
    int n, cnt = 0;
    cin >> n;
    for(ll i = 0; i < n; i ++)
    {
        cin >> a[i];
    }
    for(ll i = 0; i < n; i ++)
    {
        if(i > 0 and i < n - 1)
        {

        if(a[i] > a[i-1] and a[i] < a[i+1] or a[i] < a[i-1] and a[i] > a[i+1])
        {
            //cout << a[i] << endl;
            cnt ++;
        }
        }
    }
    cout << cnt;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <iomanip>
#include <vector>
#include <cstdlib>
#include <cmath>
#include <numeric>
#include <algorithm>
#include <sstream>
#include <string>
#include <map>
#include <set>
#include <stack>
using namespace std;

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


int main() {
	int n;
	cin >> n;
	int H[n];
	rep(i, n) cin >> H[i];

	int ans = H[n-1];
	for (int i=1; i<n; i++) {
		if (H[i]<H[i-1]) ans += H[i-1] - H[i];
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
typedef long long ll;
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
#define tll tuple<ll, ll, ll>
#define all(c) c.begin(),c.end()
 
const ll inf = 1000000001;
const ll INF = 1e18;
const ll MOD = 1000000007;

int main() {
  ll n;
  cin >> n;
  ll so[n+1];
  fill(so,so+n+1,0);
  
  for (int i=2;i<=n;i++){
    ll num = i;
    for (int j=2;j<=n;j++){
      while(num % j == 0){
        so[j] += 1;
        num /= j;
      }
    }
  }
  //cout << so[0] << endl;
  //for (int i=0;i<=n;i++) cout << so[i] << " ";
  //cout << endl;
  
  ll ans = 0;
  ll ans2 = 0;
  for (int i=2;i<=n;i++){
    if (so[i] >= 74) ans += 1;
    for (int j=2;j<=n;j++){
      if (j==i) continue;
      if (so[i] >= 14 && so[j] >= 4) ans += 1;
      if (so[i] >= 24 && so[j] >= 2) ans += 1;
      for (int k=2;k<=n;k++){
        if (i==k || j==k) continue;
        if (so[i] >= 4 && so[j] >= 4 && so[k] >= 2) ans2 += 1;
      }
    }
  }
        
  cout << ans + ans2/2 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int H, W, N, K;
int query(int xa, int ya, int xb, int yb) {
	cout << "? " << xa << ' ' << ya << ' ' << xb - 1 << ' ' << yb - 1 << endl;
	int ret; cin >> ret;
	return ret;
}
int modpow(int a, int b, int m) {
	int ret = 1;
	while(b) {
		if(b & 1) ret = 1LL * ret * a % m;
		a = 1LL * a * a % m;
		b >>= 1;
	}
	return ret;
}
int a[55][55];
int main() {
	cin >> H >> W >> N >> K;
	int r = 2, b = H / r;
	for(int i = 0; i < b; i++) {
		for(int j = 0; j < b; j++) {
			int xl = i * H / b, xr = (i + 1) * H / b, yl = j * W / b, yr = (j + 1) * W / b;
			int cnt = query(xl, yl, xr, yr);
			for(int k = xl; k < xr && cnt > 0; k++) {
				for(int l = yl; l < yr && cnt > 0; l++) {
					a[k][l] = query(k, l, k + 1, l + 1);
					cnt -= a[k][l];
				}
			}
		}
	}
	int ret = 0;
	for(int i = 0; i < H; i++) {
		for(int j = 0; j < W; j++) {
			ret += a[i][j] * modpow(2, i * W + j, K);
			ret %= K;
		}
	}
	cout << "! " << ret << endl;
	return 0;
}

Measured memory_bytes: 720
#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
using ld = long double;
const int INF = 1 << 29;
const ll LINF = 1l << 61;
const ld PI = abs(acos(-1));
#define pq priotity_queue
#define P pair<int, int>
#define P2 pair<int, P>
#define P3 pair<int, P2>
#define fr(i, a, b) for (int i = a; i < b; i++)    //[a, b)
#define frr(i, a, b) for (int i = b; i >= a; i--)  //[a, b]
#define rp(i, b) for (int i = 0; i < b; i++)       //[0, b)
#define rrp(i, b) for (int i = b; i >= 0; i--)     //[0, b]
#define cbuf(buf, init) memset(buf, init, sizeof(buf))

int N;

int main()
{
    /*
    //
    cin >> N;

    int p = N % 10;
    N /= 10;
    if (p == N % 10) {
        N /= 10;
        if (p == N % 10) {
            cout << "Yes" << endl;
        }
        else {
            cout << "No" << endl;
        }
    }
    else {
        p = N % 10;
        N /= 10;
        if (p == N % 10) {
            N /= 10;
            if (p == N % 10) {
                cout << "Yes" << endl;
            }
            else {
                cout << "No" << endl;
            }
        }
        else {
            cout << "No" << endl;
        }
    }
    */

    int c = 0;
    string input;
    cin >> input;
    rp(i, 3)
    {
        if (c >= 2) break;
        if (input[i] == input[i + 1])
            c++;
        else
            c = 0;
    }
    cout << (c >= 2 ? "Yes" : "No") << endl;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        String in = s.nextLine();
        int r = 700;
        for(char c  : in.toCharArray()){
            if(c == 'o'){
                r += 100;
            }
        }
        System.out.println(r);
    }
}

Measured memory_bytes: 21972
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#define ll long long int
#define mod 998244353


ll sum=0;


ll ruijo(ll a,ll n){ 
  if(n==0) return 1;
  if(n%2==0){
    ll tmp=ruijo(a,n/2);
    tmp*=tmp;
    return tmp%mod;}
  else{
    ll tmp=a*ruijo(a,n-1)%mod;
    return tmp;}
}

int main(){

  ll n,m,k;
  scanf("%lld%lld%lld",&n,&m,&k);
  ll tmp=1;
  sum += m*ruijo(m-1,n-1)%mod;
  for(ll i=1;i<=k;i++){
    tmp = tmp*(n-i)%mod*ruijo(i,mod-2)%mod; //combination
    //printf("%lld\n",tmp);
    sum += tmp*m%mod*ruijo(m-1,n-1-i)%mod;
    sum %= mod;}

  printf("%lld\n",sum);
  
  return 0;
}


Measured memory_bytes: 1736
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

int main()
{
	int l, r;
	std::cin >> l >> r;
	int result = 2019;
	long int temp;


	for ( int i = l; i < r; i++) {
		for (long int j = i + 1; j <= r; j++) {
			temp = i * j % 2019;
			if (temp == 0) {
				std::cout << 0 << std::endl;
				return 0;
			}
			else if (result > temp) {
				result = temp;
			}
		}
	}

	std::cout << result << std::endl;

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<iomanip>



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

using namespace std;
string a;

int main(){
  cin >> a;
  if(a[0]==a[1]&&a[1]==a[2]) cout << "Yes" <<endl;
  else if(a[1]==a[2]&&a[2]==a[3]) cout << "Yes" <<endl;
  else cout << "No" <<endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

#define N 100
#define INF 100000

int matrixChainOrder(int *);
int min(int, int);

int n,A[N][2],m[N][N];

int main(){

  int i, p[N];

  scanf("%d",&n);

  for(i =0;i<n;i++){
    scanf("%d%d", &A[i][0], &A[i][1]);
    p[i] = A[i][0];
    if(i == n-1) p[i+1] =A[i][1];
  }

  printf("%d\n",  matrixChainOrder(p));

  return 0;

}

int  matrixChainOrder(int *p){
  int i,l,k,j,q;

  for(i = 1;i<=n;i++)
    m[i][i] = 0;
  for(l = 2;l<=n;l++)
    for(i = 1;i<=n-l+1;i++){
      j = i+l-1;
      m[i][j] = INF;
      for(k = i;k<=j-1;k++){
	q= m[i][k] + m[k+1][j] +p[i-1]*p[k]*p[j];
	m[i][j] = min(m[i][j],q);
      }
    }
  return m[1][n];
}

int min(int a, int b){
  if(a>b) return b;
  else return a;
}

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

long long int A, B, K;

long long int max(long long int A, long long int B) { return A > B ? A : B; }

int main() {
    cin >> A >> B >> K;
    if (K >= A) cout << 0 << " " << max(0, B-(K-A));
    else cout << (long long) (A-K) << " " << B;
    return 0;
}


Measured memory_bytes: 3672
import sys
n = int(input())
ls = list(map(int,input().split()))
m = int(input())
di = list(map(int,input().split()))
dic = {}
for i in range(n):
    if dic.get(ls[i],0) == 0:
        dic[ls[i]] = 1
    else:
        dic[ls[i]] += 1
for k in range(m):
    if dic.get(di[k],0) == 0:
        print("NO")
        sys.exit()
    else:
        dic[di[k]] -= 1
print("YES")

Measured memory_bytes: 43772
#include<bits/stdc++.h>
#define mod 1000000007
using namespace std;
int dy[4]={1,0,-1,0};
int dx[4]={0,1,0,-1};
vector<vector<int>> graph;

bool sort_sec(const pair<int,int> &a,const pair<int,int> &b){
   if(a.second<b.second){
      return true;
   }
   return false;
}

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

int gcd(int a,int b){
   if(a%b==0) return b;
   return gcd(b,a%b);
}

int main(void){
   string S;
   cin>>S;
   bool flag=false;
   int N=S.size();
   for(int i=0;i<=N;i++){
      for(int j=1;j<=N-i;j++){
         string temp=S.substr(0,i)+S.substr(N-j,j);
         if(temp=="keyence"){
            flag=true;
         }
      }
   }
   if(flag) cout<<"YES"<<endl;
   else cout<<"NO"<<endl;
   return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(void)
{
    int W,H,x,y,r;
    scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);
    if(x+r<=W&&y+r<=H&&x-r>=0&&y-r>=0){
        printf("Yes\n");
    }else{
        printf("No\n");
    }

    
    return 0;
}



Measured memory_bytes: 2100
#include <iostream>
#include <cstdio>
#define mem(i,a) memset(i,a,sizeof(i))
#define PI acos(-1.0)
#define DMAX 100005
#define MOD 20190823
#define eps 1e-8
#define mp make_pair
#define INF 1000000000+9
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
template<class T> inline void read(T &f){
	f=0;
    T x=1;
    char ch=getchar();
    while(ch<48 || ch>57) {
        if(ch=='-') {
            x=-1;
        }
        ch=getchar();
    }
    while(ch<=57 && ch>=48) {
        f=f*10+ch-'0';
        ch=getchar();
    }
    f*=x;
}
ll a,b,t;
int main(){
	read(a),read(b),read(t);
	ll p=t/a;
	cout<<p*b<<endl;
	return 0;
}

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

#define NMAX 200100
#define INF 2000000000

#define MOD 1000000007

typedef unsigned long long ull;

using namespace std;

int main()
{
    char vect[][10] = {"Sunny", "Cloudy", "Rainy"};
    char today[10];

    cin >> today;
    for(int i = 0; i < 3; i++)
        if(strcmp(vect[i], today) == 0)
            cout << vect[(i + 1) % 3] << '\n';

    return 0;
}


Measured memory_bytes: 256
import java.util.Map;
import java.util.Scanner;
import java.util.TreeMap;

public class Main {
	public static void main(String[]args) {
		try(Scanner scan = new Scanner(System.in)){
			
			int N = scan.nextInt();
			int []a = new int[N];
			Map<Integer,Integer>map = new TreeMap<Integer,Integer>();
			for(int i = 0;i<N;i++) {
				a[i] = scan.nextInt();
				
				if(map.containsKey(a[i])) {
					map.put(a[i], map.get(a[i])+1);
				}else {
					map.put(a[i], 1);
				}
			
			}
			
			
			int count = 0;
			for(Integer key:map.keySet()) {
				if(key>map.get(key))count+=map.get(key);
				if(key<map.get(key))count+=(map.get(key)-key);
				
				//System.out.print(key);
				//System.out.print(" ");
				//System.out.println(map.get(key));
			}
			System.out.println(count);


			
		}
		
		
	}
		

}


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

int main()
{
  std::cin.tie(nullptr);
  std::ios::sync_with_stdio(false);
  
  std::string S,T;
  std::cin>>S>>T;
  
  int64_t result=size(T);
  
  for(auto i=0;i!=size(S)-size(T)+1;i++)
  {
    int64_t dif=0;
    for(int j=0;j!=size(T);j++)
    {
      if(S[i+j]!=T[j])
        dif++;
    }
    if(dif<result)
      result=dif;
  }
  
  std::cout<<result<<std::endl;
  
  return 0;
}

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

#define rep(i, n) REP(i, 0, n)
#define REP(i,k,n) for(int i = k; i < n; i++)
#define mmax(start, end) *max_element(start, end)
#define mmin(start, end) *min_element(start, end)
#define argmax max_element
#define argmin min_element
#define push push_back
#define pop pop_back
#define ALL(x) (x).begin(), (x).end()

typedef long long ll;
typedef string str;

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

template<class T = ll> T in() {
    T _in;
    cin >> _in;
    return _in;
}

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

    // ロジックはメモ参照
    long long int A, B, C, K;
    cin >> A >> B >> C >> K;
    K %= 2;

    long long int ans = (A-B)*pow(-1, K);
    cout << ans << endl;
    // printf("%llu\n", ans);

    return 0;
}


Measured memory_bytes: 384
package main

import (
        "bufio"
        "fmt"
        "os"
        "strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func nextInt() int {
        sc.Scan()
        i, e := strconv.Atoi(sc.Text())
        if e != nil {
                panic(e)
        }
        return i
}

func main() {
        for x := 1; x <= 10000; x++ {
                i := nextInt()
                if i == 0 {
                        break
                }
                fmt.Printf("Case %d: %d\n", x, i)
        }
}


Measured memory_bytes: 1308
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
const long long LINF = 1e18;
#define dump(x)  cout << 'x' << ' = ' << (x) << ` `;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
typedef long long ll;
using namespace std;
typedef pair<ll, ll> P;

int main(int argc, char const *argv[]) {
    int n;cin>>n;
    int ans = 0;
    for (int i = 1; i <= n; ++i) {
        int x = i;
        int cnt=0;
        while (x>0) {
            x/=10;
            ++cnt;
        }
        if (cnt%2) ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val n = sc.nextInt()
    val a = (1..n).map { sc.nextInt() }.count { it % 2 != 0 || it % 3 == 0 || it % 5 == 0 }
    println(if (a == n) "APPROVED" else "DENIED")
}


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

L = []
R = []
for i in [0]*M:
	l,r = map(int,input().split(' '))
	L.append(l)
	R.append(r)

LT = max(L)
RB = min(R)

print(max(RB-LT+1,0))


Measured memory_bytes: 11892
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

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

#define maxN 2018

int n, k, mod, i, j, x, y;
vector< vector<int> > sumb, sumw;
string c;
int ans;

int query(vector< vector<int> >& data, int x, int y, int xx, int yy) {
    int ans = data[xx][yy];
    if (x != 0) ans -= data[x - 1][yy];
    if (y != 0) ans -= data[xx][y - 1];
    if (x != 0 && y != 0) ans += data[x - 1][y - 1];
    return ans;
}

int add_square(vector< vector<int> >& data, int x, int y, int xx, int yy) {
    while (x >= mod) {
        x -= mod;
        xx -= mod;
    }

    while (y >= mod) {
        y -= mod;
        yy -= mod;
    }

    int ans = query(data, x, y, min(mod - 1, xx), min(mod - 1, yy));
    if (xx >= mod) ans += add_square(data, mod, y, xx, yy);
    if (yy >= mod) ans += add_square(data, x, mod, xx, yy);
    if (xx >= mod && yy >= mod) ans -= add_square(data, mod, mod, xx, yy);

    return ans;
}

int main()
{
    //freopen("test.in","r",stdin);

    cin >> n >> k; k *= 2;
    sumb = sumw = vector< vector<int> >(k + 2, vector<int>(k + 2, 0));

    for (i = 1; i <= n; i++) {
        cin >> x >> y >> c;

        if (c[0] == 'B')
            sumb[x % k][y % k]++;
        else
            sumw[x % k][y % k]++;
    }

    for (i = 0; i < k; i++) {
        for (j = 0; j < k; j++) {
            if (i != 0) {
                sumb[i][j] += sumb[i - 1][j];
                sumw[i][j] += sumw[i - 1][j];
            }

            if (j != 0) {
                sumb[i][j] += sumb[i][j - 1];
                sumw[i][j] += sumw[i][j - 1];
            }

            if (i * j != 0) {
                sumb[i][j] -= sumb[i - 1][j - 1];
                sumw[i][j] -= sumw[i - 1][j - 1];
            }
        }
    }

    mod = k;
    k >>= 1;

    for (i = 0; i < mod; i++) {

        for (j = 0; j < mod; j++) {
            int aux = 0;

            aux += add_square(sumb, i, j, i + k - 1, j + k - 1);
            aux += add_square(sumb, i + k, j + k, i + k + k - 1, j + k + k - 1);
            aux += add_square(sumw, i, j + k, i + k - 1, j + k + k - 1);
            aux += add_square(sumw, i + k, j, i + k + k - 1, j + k - 1);

            ans = max(ans, aux);
        }
    }

    cout << ans;


    return 0;
}


Measured memory_bytes: 33792
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace atcoder
{
	class Program
	{
		static void Main(string[] args)
		{
			var n = Console.ReadLine();
			//int N = int.Parse(Console.ReadLine());
			//var input = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
			bool flg = false;
			for (int i = 0;i < n.Length;i++)
			{
				if (n[i] == '9') flg = true;
			}
			Console.WriteLine((flg) ? "Yes" : "No");

			//Console.ReadLine();
		}
	}
}

Measured memory_bytes: 11092
#include<bits/stdc++.h>	
#define int long long int
#define pb push_back
#define endl "\n"
#define F first
#define S second 
#define mod 1000000007     
using namespace std;

main()
{	
	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	int x, y, a, b, c, ans = 0;
	cin >> x >> y >> a >> b >> c;
	int red[a], green[b], white[c];
	for(int i = 0; i < a; i++)
		cin >> red[i];
	for(int i = 0; i < b; i++)
		cin >> green[i];
	for(int i = 0; i < c; i++)
		cin >> white[i];
	sort(red, red + a, greater<int>());
	sort(green, green + b, greater<int>());
	sort(white, white + c, greater<int>());
	priority_queue<int, vector<int>, greater<int>> pq;
	priority_queue<int> w;
	for(int i = 0; i < x; i++)
		pq.push(red[i]), ans += red[i];
	for(int i = 0; i < y; i++)
		pq.push(green[i]), ans += green[i];
	for(int i = 0; i < c; i++)
		w.push(white[i]);
	while(true){
		if(pq.empty() or w.empty())
			break;
		int ele = pq.top();
		int sec = w.top();
		if(sec > ele){
			ans += sec - ele;
			w.pop();
			pq.pop();
		}
		else if(sec == ele){
			pq.pop();
		}
		else break;
	}
	cout << ans << endl;
}

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

int sum = 0;
int main(){
  int N, M;
  cin >> N >> M;
  int count = 0;
  vector<int> A(N);
  for(int i = 0; i < N; i++){
    cin >> A.at(i);
    sum = sum + A.at(i);
  }
  int min;
  if(sum % (4*M) == 0){
    min = sum / (4*M) ;
  }else{
    min = sum / (4*M) + 1;
  }
  for(int i = 0; i < N; i++){
    if(A.at(i) >= min){
     count++;
    }
  }
  if(count >= M){
    cout << "Yes" <<endl;
  }else{
    cout << "No" <<endl;
  }
}

Measured memory_bytes: 256
import java.util.*;
import java.io.*;
import java.nio.charset.StandardCharsets;

public class Main {
	int A, B, result;

	public static void main(String[] args) throws IOException {
		InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
		BufferedReader in = new BufferedReader(reader);
		Main ins = new Main(in);
		ins.calc();
		ins.showResult();
	}

	Main(BufferedReader in) throws IOException {
		A = Integer.parseInt(in.readLine());
		B = Integer.parseInt(in.readLine());

	}

	void calc() {
		for (int i = 1; i <= 3; ++i) {
			if (A != i && B != i) {
				result = i;
			}
		}
	}

	void showResult() {
		System.out.println(result);
	}
}


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

int main() {
  int N;
  int a = 0;
  int b = 0;
  int c = 0;
  int d = 0;
  cin >> N;
  for (int i = 0; i < N; i++)
  {
    string S;
    cin >> S;
    if (S == "AC")
    {
      a++;
    }
    else if (S == "WA")
    {
      b++;
    }
    else if (S == "TLE")
    {
      c++;
    }
    else if (S == "RE")
    {
      d++;
    }
  }
  cout << "AC x " << a << endl;
  cout << "WA x " << b << endl;
  cout << "TLE x " << c << endl;
  cout << "RE x " << d << endl;
}

Measured memory_bytes: 3600
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

vector<int> clone(vector<int> p, int n){
  vector<int> tmp(n);
  for(int i = 0; i<n; i++){
    tmp[i] = p[i];
  }
  return tmp;
}

int main(){
  int N;
  cin >> N;
  vector<int> p(N);
  vector<int> sorted(N);
  for(int i=0; i<N; i++){
    int tmp;
    cin >> tmp;
    p[i] = tmp;
    sorted[i] = tmp;
  }
  bool ans = false;
  sort(sorted.begin(), sorted.end());
  bool flg = true;
  for(int i=0; i<N; i++){
    if(p[i] != sorted[i]) flg = false;
    if(i == N-1 && flg){
      ans = true;
    }
  }
  for(int i=0; i<N; i++){
    for(int j=i+1; j<N; j++){
      vector<int> tmp = clone(p, N);
      tmp[i] = p[j];
      tmp[j] = p[i];
      flg = true;
      for(int k=0; k<N; k++){
        if(tmp[k] != sorted[k]) flg = false;
      }
      if(flg){
        ans = true;
      }
    }
  }
  if(ans){
    cout << "YES" << endl;
  }else{
    cout << "NO" << endl;
  }
  return 0;
}



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

const int N = 1e5 + 7;

char s[N], t[N];
int ne[N][26];
int fir[26];

int main() {
	scanf("%s%s", s + 1, t + 1);
	int len1 = strlen(s + 1), len2 = strlen(t + 1);
	for (int i = len1; i >= 0; i--) {
		for (int j = 0; j < 26; j++)
			ne[i][j] = fir[j];
		if (i) fir[s[i] - 'a'] = i;
	}
	int id = 0, ans = 1;
	for (int i = 1; i <= len2; i++) {
		if (ne[id][t[i] - 'a']) {
			id = ne[id][t[i] - 'a'];
		} else {
			if (!fir[t[i] - 'a']) {
				puts("-1");
				return 0;
			}
			id = fir[t[i] - 'a'];
			ans++;
		}
	}
	printf("%lld\n", 1LL * (ans - 1) * len1 + id);
	return 0;
}

Measured memory_bytes: 10624
#include <stdio.h>
int F[50];
int main()
{
  int i,n;
scanf("%d",&n);
 F[0] = 1;
 F[1] = 1;
 for (i = 2 ;i<=n;i++)
   F[i] = F[i - 2] + F[i - 1];

 printf("%d\n",F[n]);
return 0;
}

Measured memory_bytes: 596
n=int(input())
s=input()
lst1=[0]*n
lst2=[0]*n
if s[0]=='W':
  lst1[0]=1
if s[0]=='E':
  lst2[0]=1
for i in range(1,n):
  if s[i]=='W':
    lst1[i]=lst1[i-1]+1
    lst2[i]=lst2[i-1]
  if s[i]=='E':
    lst2[i]=lst2[i-1]+1
    lst1[i]=lst1[i-1]
l=[]
l.append(lst2[n-1]-lst2[0])
for j in range(1,n-1):
  l.append(lst1[j-1]+lst2[n-1]-lst2[j])
l.append(lst1[n-2])

print(min(l))
  
  


Measured memory_bytes: 29708
n = int(input())

data = list(map(int,input().split()))

d = dict()

for x in data:
    if d.__contains__(x):
        d[x]+=1
    else:
        d[x]=1
data = [list(item) for item in d.items()]
data.sort(reverse=True,key= lambda x:x[0])
a = 0
b = 0
i = 0
for i in range(len(data)):
    if data[i][1]>=2:
        data[i][1]-=2
        a=data[i][0]
        break
for j in range(i,len(data)):
    if data[j][1]>=2:
        data[j][1]-=2
        b=data[j][0]
        break
print(a*b)


Measured memory_bytes: 25992
N = int(input())
B = list(map(int, input().split()))

A = [0] * N
for i in range(N):
    Ai_tmp = 10 ** 18
    if i > 0:
        Ai_tmp = min(Ai_tmp, B[i - 1])
    if i < (N - 1):
        Ai_tmp = min(Ai_tmp, B[i])
    A[i] = Ai_tmp

print(sum(A))

Measured memory_bytes: 3064
#include<stdio.h>
int main(){
	int a,b,c,d,l,off,kokugo=0,sansu=0,i;   
	scanf("%d",&l);
	scanf("%d",&a);
	scanf("%d",&b);
	scanf("%d",&c);
	scanf("%d",&d);
	for(i=0;i<a;i+=c){
		kokugo=kokugo+1;
	} 
	for(i=0;i<b;i+=d){
             sansu=sansu+1;
	}
         if(kokugo<=sansu){
		off=l-sansu;
	}else{
		off=l-kokugo;
	}
         printf("%d\n",off);
         return 0;
}

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

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

    int n;
    cin >> n;
    string s;
    cin >> s;
    vector<vector<int>> pos(10);
    for (int i = 0; i < n; i++) {
        pos[s[i] - '0'].push_back(i);
    }
    int ans = 0;
    for (int i = 0; i < 10; i++) {
        if (pos[i].empty()) continue;
        int p = pos[i][0];
        for (int j = 0; j < 10; j++) {
            auto it = lower_bound(pos[j].begin(), pos[j].end(), p + 1);
            if (it == pos[j].end()) continue;
            int q = *it;
            for (int k = 0; k < 10; k++) {
                auto it = lower_bound(pos[k].begin(), pos[k].end(), q + 1);
                if (it == pos[k].end()) continue;
                // cout << i << ' ' << j << ' ' << k << endl;
                ans++;
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 512
#include <iostream>
#include <algorithm>
#include <iterator>

int main()
{
  unsigned long long x[5], N;
  std::cin >> N;
  for (auto& v : x) std::cin >> v;
  
  auto i = std::min_element(std::begin(x), std::end(x));
  auto t = (N + *i - 1) / *i;
  std::cout << t + 4 << std::endl;
}

Measured memory_bytes: 256
#include<stdio.h>

typedef long long int int64;

void run(void){
  int64 a,b,c,k;
  scanf("%lld%lld%lld%lld",&a,&b,&c,&k);
  printf("%lld\n",k%2==0?a-b:b-a);
}

int main(void){
  run();
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
int main()
{
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(NULL);
    long long n;
    cin >> n;
    int m;
    m = n + 2;
    long long a[m] ;
    for (int i = 0; i < m;i++)
    {
        a[i] = 0;
    }

    for (int i = 2; i <= n; i++)
    {
        int b;
        cin >> b;
        a[b] += 1;
    }
    for (int i = 1; i <= n; i++)
    {
        cout << a[i] << endl;
    }
}

Measured memory_bytes: 5148
#include <bits/stdc++.h>
#define MOD 1000000007
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> T;

int A, B, C, D;

int main(void){
    
    scanf("%d %d %d %d", &A, &B, &C, &D);
    
    int ans = min(B, D) - max(A, C);
    if(ans < 0) printf("0\n");
    else printf("%d\n", ans);
    
    return 0;
}


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

int main() {
	int n, m;
	cin >> n >> m;
	vector<vector<int>> g(n);
	rep(i, m) {
		int a, b;
		cin >> a >> b;
		a--, b--;
		g[a].push_back(b);
		g[b].push_back(a);
	}

	// queue<int> q;
	// q.push(0);
	// const int inf = 1e9;
	// vector<int> d(n, inf);
	// d[0] = 0;
	// while (!q.empty()) {
	// 	int v = q.front();
	// 	q.pop();
	// 	for (auto nv : g[v]) {
	// 		if (d[nv] != inf) continue;
	// 		d[nv] = d[v] + 1;
	// 		q.push(nv);
	// 	}
	// }

	priority_queue<pii, vector<pii>, greater<pii>> q;
	q.push(make_pair(0, 0));
	vector<int> d(n, 1e9);
	d[0] = 0;
	while (!q.empty()) {
		pii p = q.top();
		q.pop();
		if (d[p.second] < p.first) continue;
		for (auto a : g[p.second]) {
			if (d[a] > p.first + 1) {
				d[a] = p.first + 1;
				q.push(make_pair(d[a], a));
			}
		}
	}

	if (d[n - 1] <= 2) cout << "POSSIBLE" << endl;
	else cout << "IMPOSSIBLE " << endl;
	return 0;
}

Measured memory_bytes: 16660
#include <cstdio>
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string.h>

#define rep(i,n) for(long long i=0;i<(n);i++)
#define INT(n) int n;scanf("%d",&n);
#define LL(n) long long n;scanf("%lld",&n);
#define pint(n) printf("%d",n);
#define pll(n) printf("%lld",n);
#define psp printf(" ");
#define pln puts("");

int main(){
	char temp[100];
	scanf("%s",temp);
	for (int i=0;i<strlen(temp)-8;i++){
		printf("%c",temp[i]);
	}
	pln
	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
int main() {
	int n, y, a, b, c, s, t, m;
	scanf("%d%d", &n, &y);
	y /= 1000;
	c = y % 5;
	s = n - c;
	t = (y - c) / 5;
	a = t - s;
	b = 2 * s - t;
	if (a >= 0 && b >= 0) {
		printf("%d %d %d", a, b, c);
		return 0;
	}
	if (b < 0) {
		printf("-1 -1 -1");
		return 0;
	}
	if (a<0 && (3 - a) / 4 <= b / 9) {
		m = (3 - a) / 4;
		printf("%d %d %d", a + 4 * m, b - 9 * m, c + 5 * m);
		return 0;
	}
	printf("-1 -1 -1");
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <string>

using namespace std;

int main(){
		string s;
		cin >> s;
		int len = s.size();
		char at = s[0];
		int cnt = 0;
		for(int i=1; i<len; i++){
				char now = s[i];
				if(at == now){
						s[i] = now=='0'?'1':'0';
						cnt++;
				}
				at = s[i];
		}
		cout << cnt << endl;
}

Measured memory_bytes: 512
//
//  main.cpp
//  Empty_Test_Keep_Empty
//
//  Created by Davidia on 2018-09-26.
//  Copyright © 2018 Davidia. All rights reserved.
//

#include <bits/stdc++.h>
/*
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif
*/
using namespace std;

#define MAXN 100
#define INF 1000000001 // watch it
#define MAXV 100000

typedef long long  ll;
typedef pair<int,int> vw;



int dp[MAXV+5][MAXN+5];
vw items[MAXN+5];


int process(int v, int p){
    if (v <= 0) {
        return 0;
    }
    if (p < 0){
        return INF;
    }
    if (dp[v][p] != 0){
        return dp[v][p];
    }
    int best = min(process(v, p-1), process(v-items[p].first, p-1) + items[p].second);
    return dp[v][p] = best;
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n,W; cin >> n >> W;
    for (int i = 0; i < n; i++){
        cin >> items[i].second >> items[i].first;
    }
    /*
    int l = 1, r = 100002;
    int best_so_far = r;
    while (l <= r){
        int mid = (l+r)/2;
        if (process(mid, n) <= W){
            best_so_far = mid;
            l = mid+1;
        }
        else{
            r = mid-1;
        }
    }*/
    int l = 1, r =100004; // l is inclusive, right is exclusive
    while(l < r-1){
        int mid = (l+r)/2;
        if (process(mid, n) <= W){
            l = mid;
        }
        else{
            r = mid;
        }
    }
    
    cout << l << '\n';
    
    
    
    return 0;
}






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

int main()
{
    string week[] = {"SUN","MON","TUE","WED","THU","FRI","SAT"};

    string S;
    cin >> S;

    rep(i, 7) {
        if (S == week[i]){
            cout << 7 - i << endl;
            break;
        }
    }
}

Measured memory_bytes: 256
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int[] a = new int[n];
        long[] b = new long[n];
        Map<Integer, Integer> map = new HashMap<>();

        long sum = 0;
        for (int i = 0 ; i < n ; i++) {
            a[i] = sc.nextInt();
            sum += (long) a[i];
            b[i] = sum;
            int p = (int) (b[i] % m);
            if (map.containsKey(p)) {
               map.put(p, map.get(p) + 1);
            } else {
                map.put(p, 1);
            }


        }
        long ans = 0;
        if (map.containsKey(0)) {
            map.put(0, map.get(0) + 1);
        } else {
            map.put(0, 1);
        }

        for (Integer key : map.keySet()) {
            ans += (long) map.get(key) * (map.get(key) - 1) / 2;
           // System.out.println(key + "  " + map.get(key));
        }
        System.out.println(ans);
    }

}

Measured memory_bytes: 64484
// E - Sum Equals Xor

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

template<int MOD> struct ModInt {
    long long val;
    constexpr ModInt(long long v = 0) noexcept : val(v % MOD) {
        if (val < 0) val += MOD;
    }
    constexpr int getmod() { return MOD; }
    constexpr ModInt operator - () const noexcept {
        return val ? MOD - val : 0;
    }
    constexpr ModInt operator + (const ModInt& r) const noexcept { return ModInt(*this) += r; }
    constexpr ModInt operator - (const ModInt& r) const noexcept { return ModInt(*this) -= r; }
    constexpr ModInt operator * (const ModInt& r) const noexcept { return ModInt(*this) *= r; }
    constexpr ModInt operator / (const ModInt& r) const noexcept { return ModInt(*this) /= r; }
    constexpr ModInt& operator += (const ModInt& r) noexcept {
        val += r.val;
        if (val >= MOD) val -= MOD;
        return *this;
    }
    constexpr ModInt& operator -= (const ModInt& r) noexcept {
        val -= r.val;
        if (val < 0) val += MOD;
        return *this;
    }
    constexpr ModInt& operator *= (const ModInt& r) noexcept {
        val = val * r.val % MOD;
        return *this;
    }
    constexpr ModInt& operator /= (const ModInt& r) noexcept {
        long long a = r.val, b = MOD, u = 1, v = 0;
        while (b) {
            long long t = a / b;
            a -= t * b; swap(a, b);
            u -= t * v; swap(u, v);
        }
        val = val * u % MOD;
        if (val < 0) val += MOD;
        return *this;
    }
    constexpr bool operator == (const ModInt& r) const noexcept {
        return this->val == r.val;
    }
    constexpr bool operator != (const ModInt& r) const noexcept {
        return this->val != r.val;
    }
    friend constexpr ostream& operator << (ostream &os, const ModInt<MOD>& x) noexcept {
        return os << x.val;
    }
    friend constexpr ModInt<MOD> modpow(const ModInt<MOD> &a, long long n) noexcept {
        if (n == 0) return 1;
        auto t = modpow(a, n / 2);
        t = t * t;
        if (n & 1) t = t * a;
        return t;
    }
};

const int MOD = 1000000007;
using mint = ModInt<MOD>;

// 桁DP : dp[i][j]左からi桁目までの時点での組み合わせの数（j:未満フラグ）
mint dp[100001][2];

int main() {
	string L;
	cin >> L;
	int N = L.size();
	L = " " + L;


	dp[0][0] = 1;

	for (int i=1; i<=N; i++) {
		if (L[i] == '0') {
			// 未満フラグ0からの遷移
			dp[i][0] += dp[i-1][0]; // どちらも0のみ

			// 未満フラグ1からの遷移
			dp[i][1] += dp[i-1][1] * 3; // どちらも0 or どちらかのみ1
		} else {
			// L[i] == '1'
			// 未満フラグ0からの遷移
			dp[i][0] += dp[i-1][0] * 2; // aのみ1 or bのみ1
			dp[i][1] += dp[i-1][0]; // どちらも0のみ

			// 未満フラグ1からの遷移
			dp[i][1] += dp[i-1][1] * 3; // どちらも0 or どちらかのみ1
		}
	}

	mint ans = dp[N][0] + dp[N][1];

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 2044
#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
char s[100]; 
int main(){
	bool c=false;
    for(int i=0;scanf("%c",&s[i])!=EOF;i++){
    	if(s[i]=='C'){
    		c=true;
		}
		if((s[i]=='F')&&(c)){
			cout<<"Yes"<<endl;
			return 0;
		}
	}
 	cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
N = int(input())
def m_bit(N):
    global temp
    global judge
    if N == 0:
        temp = [0]
        n = 0
        judge = "OK"
        return N
    else:
        n = 0
        while abs((-2)**n) <= abs(N):
            if (-2)**n == N:
                temp = [n] + temp
                judge = "OK"
                return N
            n += 1
    if abs((-2)**n) > abs(N):
        if N%2 == 0:
            temp = ["2times"] + temp
            return N*(-1)/2
        else:
            temp = ["minus1"] + temp
            return N-1

temp = []
ans = []
judge = "Yet"

while judge == "Yet":
    N = m_bit(N)

if N == 0:
    print("0")
else:
    ans.append(temp[0])
    for i in range(len(temp)):
        if temp[i] == "minus1":
            ans.append(0)
        elif temp[i] == "2times":
            for j in range(len(ans)):
                ans[j] += 1
    c = 0
    for k in range(len(ans)):
        c += 2**ans[k]
    anser = format(c, "b")
    print(anser)

Measured memory_bytes: 3064
import java.util.*;
 
public class Main{
 public static void main(String[] args){
  Scanner sc = new Scanner (System.in);
  int a = sc.nextInt();
  int b = sc.nextInt();
  System.out.println( (a * b) + " " + ((a * 2 ) + (b * 2)));
 }
}


Measured memory_bytes: 26316
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin >> N;
  vector<int> a(N);
  vector<int> b(N,0);
  for(int i = 0; i< N; i++) {
    cin >> a.at(i);
    b.at(i) += a.at(i);
  }
  sort(b.begin(),b.end());
  int p = b.at(N-1);
  int q;
  if(b.at(N-2)!=p){
    q = b.at(N-2);
  }
  else{
    q = b.at(N-1);
  }
  
  for(int i = 0; i<N; i++){
    if(a.at(i)==p){
      cout << q << endl;
    }
    else{
      cout << p << endl;
    }
  }
}

Measured memory_bytes: 3200
#include<iostream>
int search_pn(int x){
    //std::cout << x << "は";
    for (int i=2; i*i<=x; i++){
        if ( x%i == 0){
            //std::cout << i << "で割り切れる\n";
            return 0;
        }
    }
    //std::cout << "素数\n";
    return 1;
}


int main(){
    int n;
    std::cin >> n;
    int a[n],count = 0;
    for (int i=0; i<n; i++){
        std::cin >> a[i];
        count += search_pn(a[i]);
    }
    std::cout << count << '\n';
    return 0;
}


Measured memory_bytes: 3112
#include<bits/stdc++.h>
#include<algorithm>
using namespace std;
#define str string
#define rep(x,y) for(int i=x;i<y;i++)
#define REP(x,y) for(int j=x;j<y;j++)
#define all(x) x.begin(),x.end()
#define int long long
signed  main(){
  int N,K;
  str S;
  cin>>N;
  if(N<1200)cout<<"ABC"<<endl;
  else if(N<2800)cout<<"ARC"<<endl;
  else cout<<"AGC"<<endl;
}


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

const int MOD=1000000007;
const int INF=0x3f3f3f3f;
const ll INFL=0x3f3f3f3f3f3f3f3f;

ll ppow(ll a,ll b){
	a%=MOD;
	ll res=1;
	while(b){
		if(b&1)res=(res*a)%MOD;
		a=(a*a)%MOD;
		b>>=1;
	}
	return res;
}
class Fact{
	vector<ll>fact;
	vector<ll>inv;
public:
	Fact(){}
	Fact(int n){
		n=n*2+10;
		fact=inv=vector<ll>(n);
		fact[0]=inv[0]=1;
		for(int i=1;i<n;i++){
			fact[i]=(fact[i-1]*i)%MOD;
			inv[i]=ppow(fact[i],MOD-2);
		}
	}
	ll get(int n){
		return fact[n];
	}
	ll nPr(int n,int r){
		return fact[n]*inv[n-r]%MOD;
	}
	ll nCr(int n,int r){
		return nPr(n,r)*inv[r]%MOD;
	}
	ll nrP(int n,int r){
		return nPr(n+r,n);
	}
	ll nrC(int n,int r){
		return nCr(n+r,n);
	}
};
char s[300000];
int main(){
	int n;cin>>n;
	scanf("%s",s);
	if(s[0]=='W'){
		puts("0");return 0;
	}
	ll cnt=1;
	ll ans=1;
	int b=1;
	for(int i=1;i<2*n;i++){
		if((s[i]=='B'&&b==0)||(s[i]=='W'&&b==1))cnt++,b=!b;
		else{
			if(cnt<=0){
				puts("0");return 0;
			}
			(ans*=cnt)%=MOD;
			cnt--;
			b=!b;
		}
	}
	if(cnt){
		puts("0");return 0;
	}
	Fact fac(2*n);
	cout<<ans*fac.get(n)%MOD<<endl;
}

Measured memory_bytes: 6656
import sys
from collections import Counter
input = sys.stdin.readline

def main():
    N = int(input())
    A = sorted(list(map(int, input().split())))
    ng = [False] * (A[-1] + 1)
    check = [False] * (A[-1] + 1)
    for a in A:
        if check[a]:
            ng[a] = True
        check[a] = True

    if len(A) == 0:
        print(0)
        return
    MAX_PRIME = A[-1] + 1
    primes = []
    is_prime = [True] * (MAX_PRIME+1)
    for i in A:
        if is_prime[i]:
            primes.append(i)
            for j in range(2*i, MAX_PRIME+1, i):
                is_prime[j] = False
    
    ans = 0
    for a in A:
        if is_prime[a] and not ng[a]:
            ans += 1
    print(ans)


if __name__ == "__main__":
    main()

Measured memory_bytes: 43604
#include <iostream>
#include <algorithm>
int main() {
	int a, b, c, d;
	std::cin >> a >> b >> c >> d;
	if (b <= c || d <= a)
		std::cout << 0 << std::endl;
	else
		std::cout << std::abs(std::max(a, c) - std::min(b, d)) << std::endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b)  for(int i=(a),i##formax=(b);i< i##formax;i++)
#define FORR(i,a,b) for(int i=(a),i##formin=(b);i>=i##formin;i--)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define pcnt __builtin_popcount
#define sz(x) (int)(x).size()
#define maxs(x,y) x=max((x),(y))
#define mins(x,y) x=min((x),(y))
#define show(x) cout<<#x<<" = "<<(x)<<endl;
#define all(a) ((a).begin()),((a).end())
#define each(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define bit(n) (1LL<<(n))
typedef long long ll;
typedef __int128_t lll;
template<class T>using V=vector<T>;
template<class T>using VV=V<V<T>>;
template<class T,class Y>using P=pair<T,Y>;
template<class T,class Y>ostream& operator<<(ostream&o,P<T,Y>&p){return o<<"("<<p.fi<<","<<p.se<<")";}
template<class T>ostream& operator<<(ostream&o,V<T>&v){for(T&t:v)o<<t<<",";return o;}
template<class T>void uniq(V<T>&v){sort(all(v));v.erase(unique(all(v)), v.end());}
template<class A,size_t N,class T>void Fill(A(&a)[N],const T&v){fill((T*)a,(T*)(a+N),v);}

const int MOD = 1e9+7; //998244353;

lll gcd(lll a,lll b,lll&x,lll&y){if(!b){x=1;y=0;return a;}lll d=gcd(b,a%b,y,x);y-=a/b*x;return d;}
ll modInv(ll a,ll m=MOD){lll x,y;gcd(a,m,x,y);return(x%m+m)%m;}
ll modPow(lll a,lll n,ll m=MOD){lll p=1;for(;n;n>>=1,a=a*a%m)if(n&1)p=p*a%m;return p;}
//V<ll>Fac,Rac;void setF(int n,int m=MOD){Fac=Rac=V<ll>(++n);Fac[0]=1;FOR(i,1,n)Fac[i]=Fac[i-1]*i%m;Rac[n-1]=modInv(Fac[n-1],m);FORR(i,n-1,1)Rac[i-1]=Rac[i]*i%m;}
//ll comb(int a,int b,int m=MOD){return a<b||b<0?0:Fac[a]*Rac[b]%m*Rac[a-b]%m;}

const int IINF = 1e9+6;
const ll LINF = 1e18;
const int N = 2e5;
int n, a[N], ans[N];
V<int> z, e[N];
struct Seg{
  typedef int T;
  const T e = 0;
  void merge(const T &a, const T &b, T &c){
    c = max(a, b);
  }

  int n;
  vector<T> d;

  void init(int m){
    n = 1<<(32-__builtin_clz(m-1));
    d = vector<T>(2*n, e);
  }
  void init(vector<T> &v){
    init(v.size());
    FOR(j, 0, v.size()) d[j+n] = v[j];
    for(int k=n-1;k>0;k--) merge(d[k*2], d[k*2+1], d[k]);
  }
  void update(int k, T a){
    k+=n;
    d[k]=a;
    while(k){
      k >>= 1;
      merge(d[k*2], d[k*2+1], d[k]);
    }
  }
  T query(int L, int R) {
    L += n; R += n;
    T l=e, r=e;
    while (L < R) {
      if (L & 1) merge(l, d[L++], l);
      if (R & 1) merge(d[--R], r, r);
      L >>= 1; R >>= 1;
    }
    merge(l, r, l);
    return l;
  }
  T get(int a){
    return d[n+a];
  }
} seg;
void dfs(int c, int p){
  int s = a[c];
  int t = seg.query(0, s) + 1;
  int u = seg.get(s);
  seg.update(s, t);
  ans[c] = seg.query(0, sz(z));
  for(int d:e[c]) if(d!=p) dfs(d, c);
  seg.update(s, u);
}

main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n;
  z.pb(0);
  FOR(i, 0, n) cin >> a[i], z.pb(a[i]);
  uniq(z);
  FOR(i, 0, n) a[i] = lower_bound(all(z), a[i])-z.begin();
  FOR(_, 1, n){
    int v, w;
    cin >> v >> w;
    v--; w--;
    e[v].pb(w);
    e[w].pb(v);
  }
  seg.init(sz(z));
  dfs(0, -1);
  FOR(i, 0, n) cout << ans[i] << endl;
}

Measured memory_bytes: 30680