akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<utility>
#include<map>
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const ll INF = mod * mod;
typedef pair<ll, ll> P;

#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
#define stop char nyaa; cin>>nyaa;


void solve() {
	int n; ll l;
	cin >> n >> l;
	vector<P> v(n);
	rep(i, n) {
		cin >> v[i].first >> v[i].second;
	}
	sort(v.begin(), v.end());
	int ans = 0;
	int cur = 0;
	ll ri = 0;
	while (cur < n&&v[cur].first == 0) {
		ri = max(ri, v[cur].second);
		cur++;
	}
	ans = 1;
	//cout << ri << endl;
	while (ri<l) {
		ans++;
		ll nexri = ri;
		while (cur < n&&v[cur].first <= ri) {
			nexri = max(nexri, v[cur].second);
			cur++;
		}
		ri = nexri;
	}
	ll ans1 = ans;
	ans = 0;
	int c = 0;
	cur = 0;
	vector<P> x;
	rep(i, n) {
		x.push_back({ v[i].first,1 });
		x.push_back({ v[i].second,-1 });
	}
	sort(x.begin(), x.end());
	int ans2 = 0;
	rep(i, x.size()) {
		c += x[i].second;
		while (i + 1 < x.size() && x[i].first == x[i + 1].first) {
			i++; c += x[i].second;
		}
		//cout << i << " " << c << endl;
		if (i+1 != x.size()) {
			ans2 = max(ans2, n - c);
		}
	}
	ans2 = min(ans2+1, n);
	cout << ans1 << " " << ans2 << endl;
}

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	solve();
	//stop
	return 0;
}


Measured memory_bytes: 14096
<?php
	$input_line = fgets(STDIN);
	$array = str_split($input_line);
	$sum = 0;
	for ($i = 0; $i < count($array); $i++) {
      $sum += $array[$i];
    }
	if ($sum % 9 == 0) {
      echo('Yes');
    } else {
      echo('No');
    }
?>

Measured memory_bytes: 28564
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
using ll = long long;
int main(){
    string s;
    int k;
    cin >> k >> s;
    if(s.size() <= k){
        cout << s << endl;
    }
    else{
        rep(i,k){
            cout << s.at(i);
        }
        cout << "..." << endl;
    }
}

Measured memory_bytes: 3632
a = input()
b = int(a[0:1])
c = int(a[1:2])
d = int(a[2:3])

ball = 0

if(b == 1):
  ball += 1

if(c == 1):
  ball += 1

if(d == 1):
  ball += 1
  
print(ball)

Measured memory_bytes: 3064
#include<stdio.h>
int main(void){
    int arr[3] = {0, 0, 0};
    int i,k,t;
    while(arr[0] < 1 || 10000 < arr[0] || arr[1] < 1 || 10000 < arr[1] || arr[2] < 1 || 10000 < arr[2]){
        scanf("%d %d %d",&arr[0], &arr[1], &arr[2]);
    }
    if(arr[0] > arr[1]){
        t = arr[0];
        arr[0] = arr[1];
        arr[1] = t;
    }
    if(arr[1] > arr[2]){
        t = arr[1];
        arr[1] = arr[2];
        arr[2] = t;
    }
    if(arr[0] > arr[1]){
        t = arr[0];
        arr[0] = arr[1];
        arr[1] = t;
    }
    printf("%d %d %d\n", arr[0], arr[1], arr[2]);
    
    return 0;
}


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

using namespace std;

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

int main() {
    ll n, m, i, j, k;
    string s, t;
    cin >> t >> s;
    cout << s << t << endl;
    return 0;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline

def main():
    N, M, K = list(map(int, input().split()))
    MOD = 10**9+7

    class Comb:
        def __init__(self, N):
            self.fac = [1] * (N+1)
            for i in range(2, N+1): self.fac[i] = self.fac[i-1] * i % MOD

        def pow(self, a, b):
            res = 1
            while b:
                if b & 1: res = res * a % MOD
                a = a**2 % MOD
                b >>= 1
            return res

        def comb(self, n, r):
            if r < 0 or r > n: return 0
            return (self.fac[n] * self.pow(self.fac[r], MOD-2)) % MOD * self.pow(self.fac[n-r], MOD-2) % MOD

        def permutation(self, n, r):
            if r == 0: return 1
            return self.fac[n] * self.pow(self.fac[n-r], MOD-2) % MOD

    comb = Comb(N*M-2)

    ans = 0
    for i in range(M):
        ans += i * (M-i) * (N**2)

    for i in range(N):
        ans += i * (N-i) * (M**2)

    print(ans*comb.comb(N*M-2, K-2)%MOD)

if __name__ == '__main__':
    main()

Measured memory_bytes: 10868
import math
import itertools
import statistics
#import numpy as np
#import collections
a, b, k = list(map(int, input().split()))
l = []

"""
if k > b-a:
    k = b-a
"""

for i in range(k):
    l.append(a+i)
    l.append(b-i)


ans = list(set(l))
ans.sort()
for i in range(len(ans)):
    if ans[i] >= a and ans[i] <= b:
        print(ans[i])

Measured memory_bytes: 5148
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep_1(i, n) for (int(i) = 0; (i) <= (n); (i)++)
#define rep_2(i, a, b) for (int(i) = (a); (i) < (b); (i)++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;

int main() {
  int n;
  cin >> n;
  vector<int> a(n - 1);
  rep(i, n - 1) {
    cin >> a[i];
    a[i]--;
  }
  vector<int> b(n);
  for (int i = 0; i < n - 1; ++i) {
    b[a[i]]++;
  }
  rep(i, n) cout << b[i] << endl;
  return 0;
}

Measured memory_bytes: 4792
#include <algorithm>
#include <cassert>
#include <chrono>
#include <cmath>
#include <complex>
#include <cstdlib>
#include <deque>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using namespace std;
typedef long long ll;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  ll n;
  cin >> n;
  string s;
  while (n > 0) {
    int r = (n - 1) % 26;
    char c = r + 'a';
    s = c + s;
    n = (n - 1) / 26;
  }
  cout << s << "\n";
}

Measured memory_bytes: 3648
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
#include <ctype.h>
#include <stdint.h>
#include <string.h>
#include <wchar.h>
#include <math.h>

#define N_MAX (100)
#define P_MAX (100)
#define DP_ARRAY_SIZE (N_MAX * P_MAX / 32 + 1)

#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define ABS(a) ((a) < 0 ? -(a) : (a))
#define ABSS(a, b) ((a) > (b) ? (a) - (b) : (b) - (a))

int compare_sz_desc(const void* a, const void* b) {
    return *((size_t*)a) > * ((size_t*)b) ? -1 : 1;
}

int compare_i64_asc(const void* a, const void* b) {
    return *((int64_t*)a) < *((int64_t*)b) ? -1 : 1;
}

int compare_f(const void* a, const void* b) {
    return *((int64_t*)a) < *((int64_t*)b) ? -1 : 1;
}

int compare_f2(const void* a, const void* b) {
    return *((uint64_t*)a) > * ((uint64_t*)b) ? -1 : 1;
}

static size_t comb(const size_t n, const size_t r) {
    size_t result = 1;

    for (size_t i = 0; i < r; i++) {
        result *= n - i;
        result /= i + 1;
    }

    return result;
}

static uint64_t combU64(const uint64_t n, const uint64_t r) {
    uint64_t result = 1;

    for (uint64_t i = 0; i < r; i++) {
        result *= n - i;
        result /= i + 1;
    }

    return result;
}

static uint64_t gcdU64(uint64_t m, uint64_t n)
{
    uint64_t temp;

    while (m % n != 0) {
        temp = n;
        n = m % n;
        m = temp;
    }

    return n;
}

static size_t gcdZu(size_t m, size_t n) {
    size_t temp;

    while (m % n != 0) {
        temp = n;
        n = m % n;
        m = temp;
    }

    return n;
}

static int64_t a[200000];

int main(void) {
    size_t N;
    int64_t sum = 0;

    scanf("%zu\n", &N);
    for (size_t i = 0; i < N; i++) {
        scanf("%"PRId64, &(a[i]));
        if (i < N - 1) {
            scanf(" ");
        }

        sum += a[i];
    }

    int64_t xSum = 0;
    int64_t abssMin = INT64_MAX;

    for (size_t i = 0; i < N - 1; i++) {
        xSum += a[i];

        if (ABS(sum - 2 * xSum) < abssMin) {
            abssMin = ABS(sum - 2 * xSum);
        }
    }

    printf("%"PRId64, abssMin);

    return 0;
}


Measured memory_bytes: 1792
n = int(input())
s = input()

r = s.count("R")
g = s.count("G")
b = s.count("B")

ans = r * g * b

for i in range(n):
    for j in range(i+1, n):
        k = 2 * j - i
        if k < n:
            if s[i] != s[j] and s[i] != s[k] and s[j] != s[k]:
                ans -= 1
print(ans)


Measured memory_bytes: 73688
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <map>
typedef long long ll;

using namespace std;

int main(){
  int a,b,c;
  cin >> a >> b >> c;
  if (a == b && b == c) cout << "Yes";
  else cout << "No";

}


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

float inverse(float a){
  float b;
  b = 1/a;

  return b;
}

int main()
{
  int N;
  cin >> N;
  vector <int> A(N);
  for (int i=0; i<N; i++) {
    cin >> A[i];
    A[i] = float(A[i]);
  }

  float sum=0;

  for (int i=0; i<N; i++) {
    sum += inverse(A[i]);
  }

  cout << inverse(sum) << endl;


}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <algorithm>
#include <cmath>
#include <iomanip>

using namespace std;

#define REP(i,n) for(ll (i) = (0); (i) < (n); ++i)
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define ALL(v) v.begin(),v.end()
#define INF 1100000000
#define LLINF 1000000000000000000LL
#define MOD 1000000007
#define Decimal fixed << setpresicion(20)


typedef long long ll;
typedef pair<ll, ll> P;


int main()
{
  int N; cin >> N;
  vector<int> p(N);
  REP(i, N) cin >> p[i];
  sort(ALL(p), greater<int>());
  p[0] /= 2;
  int ans = 0;
  REP(i, N) ans += p[i];
  cout << ans << endl;

  return 0;
}



Measured memory_bytes: 256
h, w = map(int, input().split())
a = [0]*h
for i in range(h):
  a[i] = input()

dp = [[0]*w for i in range(h)]
inf = 10**9+7

dp[0][0] = 1

for i in range(h):
  for j in range(w):
    if a[i][j] == "#":
      continue
    else:
      if i > 0:
        dp[i][j] += dp[i-1][j]
        dp[i][j] %= inf
      if j > 0:
        dp[i][j] += dp[i][j-1]
        dp[i][j] %= inf

print(dp[h-1][w-1])

Measured memory_bytes: 51952
import fileinput


def solve_candies(ch_count, total_canides, capacity_list):
    mod = 10**9 + 7
    last_solutions = [0] * (total_canides + 1)
    last_solutions[0] = 1

    all_total = 0
    for current_child in range(ch_count):
        current_cap = capacity_list[current_child]

        new_total = min(all_total + current_cap, total_canides)

        current_solutions = [0] * (total_canides + 1)

        current_sum = 0
        summed_candies = 0

        for total in range(new_total + 1):
            current_sum += last_solutions[total]
            summed_candies += 1
            if summed_candies > current_cap + 1:
                current_sum -= last_solutions[total - current_cap - 1]

            current_solutions[total] = current_sum % mod

        last_solutions = current_solutions
        all_total = new_total

    return last_solutions[-1]


inp = fileinput.FileInput()

split = inp.readline().split(" ")
children = int(split[0])
total_candies = int(split[1])
caps = [int(v) for v in inp.readline().split()]

print(solve_candies(children, total_candies, caps))

Measured memory_bytes: 116976
#include <bits/stdc++.h>
#include <unistd.h>
 
using namespace std;
 
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl
#define DEBUG_MAT(v) cerr<<#v<<endl;for(int i=0;i<v.size();i++){for(int j=0;j<v[i].size();j++) {cerr<<v[i][j]<<" ";}cerr<<endl;}
 
 
typedef long long ll;
#define int 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>
template<class S, class T> pair<S, T> operator+(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first + t.first, s.second + t.second); }
template<class S, class T> pair<S, T> operator-(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first - t.first, s.second - t.second); }
template<class S, class T> ostream& operator<<(ostream& os, pair<S, T> p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
#define X first
#define Y second
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define rrep1(i,n) for(int i=(n);i>0;i--)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define in(x, a, b) (a <= x && x < b)
#define all(c) c.begin(),c.end()
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a = b; return 1; } return 0; }
#define UNIQUE(v) v.erase(std::unique(v.begin(), v.end()), v.end());
const ll inf = 1000000001;
const ll INF = (ll)1e18 + 1;
const ll MOD = 1000000007;
//const ll MOD = 998244353;
const double pi = 3.14159265358979323846;
#define Sp(p) cout<<setprecision(15)<< fixed<<p<<endl;
int dx[4] = { -1,0, 1,0 }, dy[4] = { 0,1,0,-1 };
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };
#define fio() cin.tie(0); ios::sync_with_stdio(false);
// #define mp make_pair
//#define endl '\n'


signed main() {
  fio();
  int x, a;
  cin >> x >> a;
  if (x < a) cout << 0 << endl;
  else cout << 10 << endl;
}


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

int main() {
	//0000
	/*
	int i, j;

	for (i = 1; i < 10; i++) {
		for (j = 1; j < 10; j++) {
			cout << i << "x" << j << "=" << i*j << endl;
		}
	}
	*/
	//0001
	/*
	int i;
	const size_t MNum = 10;
	int MHeight[MNum];
	int MH1 = 0, MH2 = 0, MH3 = 0;
	for (i = 0; i < 10; i++) {
		cin >> MHeight[i];
		if (MHeight[i] > MH1) {
			MH3 = MH2;
			MH2 = MH1;
			MH1 = MHeight[i];
		}
		else if (MHeight[i] > MH2) {
			MH3 = MH2;
			MH2 = MHeight[i];
		}
		else if (MHeight[i] > MH3) {
			MH3 = MHeight[i];
		}
	}
	cout << MH1 << endl << MH2 << endl << MH3 << endl;
	*/
	/*
	priority_queue<int, vector<int>, less<int> > que;
	int MH;

	for (int i = 0; i < 10; i++) {
		cin >> MH;
		que.push(MH);
	}

	for (int j = 0; j < 3; j++) {
		cout << que.top() << endl;
		que.pop();
	}
	*/
	//0002
	int a, b;
	while (cin >> a >> b) {
		int sum = a + b;
		int count = 0;
		while (sum > 0) {
			sum = sum / 10;
			count++;
		}
		cout << count << endl;
	}
	return 0;
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
constexpr ll mod=1e9+7;

int main()
{
  int n;
  cin>>n;
  int cnt=0,ans=0;
  for (int i = 0; i < n; ++i)
  {
    int a,b;
    cin>>a>>b;
    if (a!=b) {
      cnt=0;
    } else {
      cnt++;
    }
    ans = max(ans,cnt);
  }
  ans = max(ans,cnt);

  cout<<(ans>=3?"Yes":"No");
}

Measured memory_bytes: 3620
import std.stdio;
import std.algorithm;
import std.string;
import std.range;
import std.array;
import std.conv;
import std.complex;
import std.math;
import std.ascii;
import std.bigint;
import std.container;
import std.typecons;

auto readInts() {
	return array(map!(to!int)(readln().strip().split()));
}
auto readInt() {
	return readInts()[0];
}
auto readLongs() {
	return array(map!(to!long)(readln().strip().split()));
}
auto readLong() {
	return readLongs()[0];
}

void readlnTo(T...)(ref T t) {
    auto s = readln().split();
    assert(s.length == t.length);
    foreach(ref ti; t) {
        ti = s[0].to!(typeof(ti));
        s = s[1..$];
    }
}

const real eps = 1e-10;

void main(){
    long a, b;
    readlnTo(a, b);
    if(a*b <= 0) {
        writeln("Zero");
        return;
    }
    if(a > 0) {
        writeln("Positive");
        return;
    }
    writeln((b-a+1)%2 == 1 ? "Negative": "Positive");
}



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

using namespace std;

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

#define dump(x)  cerr << #x << " = " << (x) << endl
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back


int dist( pii a,pii b){
    int y=a.first-b.first;
    int x=a.second-b.second;
    
    return (x*x + y*y);
}



int main(){
    int loop;
    cin>>loop;
    rep(i,loop){
        
        int n,x,y;
        cin>>n>>x>>y;
        
        pii start;
        cin>>start.second>>start.first;
        
        pii cat[2000];
        rep(i,n){
            cin>>cat[i].second>>cat[i].first;
        }
        
//        if( x>=y ){cout<<"You're always welcome!"<<endl;continue;}
        
        vi connect[2000];
        
        rep(i,n){
            rep(j,n){
                if(i!=j){
                    if( dist(cat[i],cat[j])<=2500 ){
                        connect[i].pb(j);
                        connect[j].pb(i);
                    }
                }
            }
        }
        
        int used[2000];
        rep(i,2000)used[i]=-9999;

        queue<int> que;
        
        rep(i,n){
            if( dist(start,cat[i])<=100 ){
                que.push(i);
                used[i]=x;
            }
        }
        int term=0;
        if( que.size() )term++;
        
        int now=0;
        int times=0;
        while(que.size()){
            times++;
            now=term*x;
            int len=que.size();
            rep(i,len){
                int qf=que.front();
                for( int j=0;j<connect[qf].size();j++){
                    int connected = connect[qf][j];
                    if( now-used[ connected ]>y ){
                        que.push( connected );
                        used[ connected ] = now+x;
                    }
                }
                que.pop();
            }
            if(times>2000)break;
            term++;
        }
        
//        while( que.size() ){
//            now=term*x;
//            bool flag=true;
//            times++;
//            int qf=que.front();
//            for( int i=0;i<connect[qf].size();i++ ){
//                int connected = connect[qf][i];
//                if( now-used[ connected ]>y ){  // >= ?
//                    if(flag)term++;
//                    flag=false;
//                    que.push( connected );
//                    used[ connected ]=now+x;    // now+x-1 ?
//                }
//            }
//            que.pop();
//            if(times>10000)break;
//        }
        
        
        if(times>2000)cout<<"You're always welcome!"<<endl;
        else cout<<now<<endl;
    }
}

Measured memory_bytes: 9432
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include<numeric>
#include<cmath>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll,ll> pll;
const ll inf = 1LL << 60;

int main(){
    cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	//cout << fixed << setprecision(15);
    int N,K,C; cin>>N>>K>>C;
    string S; cin>>S;
    vector<int> work;
    REP(i,N){
        if(S[i] == 'o'){
            work.push_back(i+1);
        }
    }
    vector<int> L(K), R(K); //(i)日目に働くのはL[i]日目以降(i =0スタート)
    int lnow = 0;
    int lnext = 1;
    L[0] = work[0];
    FOR(i,1,K){
        while(work[lnext] - work[lnow] <= C){
            lnext++;
        }
        L[i] = work[lnext];
        lnow = lnext;
        lnext++;
    }
    int rnow = work.size()-1;
    int rnext = work.size() -2;
    R[K-1] = work[work.size()-1];
    REPR(i,K-2){
        while(work[rnow] - work[rnext] <= C){
            rnext--;
        }
        R[i] = work[rnext];
        rnow = rnext;
        rnext--;
    }
    /*REP(i,K){
        cout<<L[i]<<" ";
    }
    cout<<endl;
    cout<<work.size()<<endl;
    REP(i,K){
        cout<<R[i]<<" ";
    }
    cout<<endl;*/
    vector<int> ans;
    REP(i,K){
        if(L[i] == R[i]) ans.push_back(L[i]);
    }
    if(ans.size() == 0){
        cout<<endl;
    }
    else{
        REP(i,ans.size()){
            cout<<ans[i]<<endl;
        }
    }
}

Measured memory_bytes: 7372
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
  string s,t;
  cin>>s>>t;
  ll a,b,i,j,c=0,l=0;
  a=s.length();
  b=t.length();
  
  for(i=0;i<a-b+1;i++)
  {c=0;
    for(j=0;j<b;j++){
       if(s[j+i]==t[j])
       {c++;
        
       }
    }
   l=max(l,c);
   
  }
  
  cout<<b-l;
}

Measured memory_bytes: 3636
import java.io.*;
public class Main {
    public static void main(String[] args)throws IOException {
        int i,memo=0,flag1=0,flag2=0;
        InputStreamReader is = new InputStreamReader(System.in);
        BufferedReader br = new BufferedReader(is);
        
        String str = br.readLine();
        
        for(i=0;i<str.length();i++){
            char c = str.charAt(i);
            if(c =='C'){
                flag1 = 1;
                memo = i;
            }
        }
        while(memo<str.length()){
            char c = str.charAt(memo);
            if(c == 'F'){
                flag2 = 1;
            }
            memo++;
        }
        if(flag1 ==1&& flag2 == 1 ){
            System.out.println("Yes");
        }
        else
            System.out.println("No");
    }   
}

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

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

using namespace std;

using ll = long long;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int x;
  cin >> x;
  if (x == 2) {
    cout << 2;
    return 0;
  }
  if (x % 2 == 0) x++;
  while (true) {
    bool ok = true;
    for (int i = 3; i * i <= x; i += 2) {
      if (x % i == 0) {
        ok = false;
        break;
      }
    }
    if (ok) break;
    x += 2;
  }
  cout << x;
  return 0;
}


Measured memory_bytes: 3624
import math
x=int(input())
if x==2:
    print(2)
else:   
    l=0
    a=[i for i in range(2,x)]
    prime=[]
    limit=math.sqrt(x)
    while True:
        p = a[0]
        if limit <= p:
            break
        prime.append(p)
        a = [e for e in a if e % p != 0]
    co=0
    x-=1
    l=len(prime)
    while co==0:
        c=0
        x+=1
        for i in range(l):
            if x%prime[i]!=0:
                c+=1
            else:
                break
        if c==l:
            print(x)
            co+=1

Measured memory_bytes: 46768
#include <bits/stdc++.h>
#define Maxn 207
#define Maxm 30007
#define inf 20000007
using namespace std;
int read()
{
	int x=0,f=1;char ch=getchar();
	while (ch<'0'||ch>'9'){if (ch=='-') f=-1;ch=getchar();}
	while (ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}
int h,w,S,T,cnt=-1;
int l[Maxn],que[Maxn*2];
int last[Maxn],other[Maxm],pre[Maxm],flow[Maxm];
char ch;
void insert(int u,int v,int f)
{
	other[++cnt]=v,pre[cnt]=last[u],last[u]=cnt,flow[cnt]=f;
}
bool bfs()
{
	memset(l,0,sizeof(l));
	memset(que,0,sizeof(que));
	l[S]=1,que[1]=S;
	int lx=0,rx=1;
	while (lx<rx)
	{
		int u=que[++lx];
		for (int q=last[u];q>-1;q=pre[q])
		{
			int v=other[q];
			if (l[v]==0&&flow[q]>0)
			{
				l[v]=l[u]+1;
				que[++rx]=v;
			}
		}
	}
	if (l[T]==0) return false; else return true;
}
int find(int u,int maxf)
{
	if (u==T) return maxf;
	int ans=0;
	for (int q=last[u];q>-1;q=pre[q])
	{
		int v=other[q];
		if (l[v]==l[u]+1)
		{
			int t=find(v,min(maxf-ans,flow[q]));
			ans+=t;
			flow[q]-=t;
			flow[q^1]+=t;
			if (ans==maxf) return ans;
		}
	}
	if (ans<maxf) l[u]=-1;
	return ans;
}
int dinic()
{
	int ans=0;
	while (bfs())
	{
		int e=find(S,inf);
		ans+=e;
	}
	return ans;
}
int main()
{
	h=read(),w=read();
	memset(last,-1,sizeof(last));
	S=0,T=h+w+1;
	for (int i=1;i<=h;i++)
		for (int j=1;j<=w;j++)
		{
			ch=getchar();
			while (ch!='S'&&ch!='o'&&ch!='.'&&ch!='T') ch=getchar();
			if (ch=='S')
			{
				insert(S,i,inf),insert(i,S,0);
				insert(S,h+j,inf),insert(h+j,S,0);
			} else if (ch=='T')
			{
				insert(i,T,inf),insert(T,i,0);
				insert(h+j,T,inf),insert(T,h+j,0);
			} else if (ch=='o')
			{
				insert(i,h+j,1),insert(h+j,i,1);
			}
		}
	int ans=dinic();
	if (ans<inf) printf("%d\n",ans); else printf("%d\n",-1);
	return 0;
}


Measured memory_bytes: 512
def resolve():
    import itertools
    n = int(input())
    target = tuple(int(i) for i in input().split())
    before = None
    found = False
    for a in sorted(itertools.permutations(target)):
        if found:
            print(*a)
            return
        elif a == target:
            if before is not None:
                print(*before)
            print(*target)
            found = True
        else:
            before = a


resolve()



Measured memory_bytes: 53356
#include<bits/stdc++.h>
using namespace std;
long long arr[1000000];
int main()
{
	long long n,m,i,j,k;
	cin>>n>>m;
	j=0;
	for (i=1;i*i<=m;i++)
	{
		if (m%i==0)
		{
			arr[j]=i;
			arr[j+1]=m/i;
			j+=2;
		}
	}
	sort(arr,arr+j);
	for (i=0;i<j;i++)
	{
		if (arr[i]>=n)
		{
			cout<<m/arr[i]<<endl;
			return 0;
		}
	}
		
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <cstdio>
using namespace std;
int n,special,a[100000];
long long ans=0;
bool flag=false;
int main(){
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		int t;
		scanf("%d",&t);
		if(t==0)	flag=true;
		if(t<0)	special++;
		ans+=abs(t);
		a[i]=abs(t);
	}
	if(special%2==0||flag)	printf("%lld",ans);
	else{
		sort(a,a+n);
		printf("%lld",ans-2*a[0]);
	}
	return 0;
}

Measured memory_bytes: 512
import numpy as np
from copy import deepcopy

N, K = map(int,input().split())
H = [int(input()) for i in range(N)]

H = sorted(H)

solve = []
for i in range(N-K+1):
  solve.append(H[i+K-1] - H[i])
  
ans = min(solve)
print(ans)




Measured memory_bytes: 20692
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
#define cases long long test;cin>>test;while(test--)
#define f_io ios::sync_with_stdio(false); cin.tie(0)
#define foi(a,n) for(long long i=a;i<n;i++)
#define foj(a,n) for(long long j=a;j<n;j++)
#define fok(a,n) for(long long k=a;k<n;k++)
#define ll long long
#define MOD 1000000007
#define INF 1000000000
using namespace std;
const int N=1000000;
long long dp[N],height[N];
//using namespace __gnu_pbds;
//typedef tree<ll,null_type,less<ll>,rb_tree_tag, tree_order_statistics_node_update> indexed_set;
int main()
{
    f_io;
    int n;
    cin>>n;
    foi(0,n)
    {
        cin>>height[i];
        
    }
    dp[1]=abs(height[1]-height[0]);
    foi(2,n)
    {
        dp[i]=min(dp[i-1]+abs(height[i]-height[i-1]),dp[i-2]+abs(height[i]-height[i-2]));
    }
    cout<<dp[n-1];
}

Measured memory_bytes: 5120
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <queue>
#include <map>
#include <stack>
#include <bitset>
#include <numeric> //lcm
#include <iomanip> //double精度 setprecision

using namespace std;

#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = n-1; i >= 0; --i)
#define rep1(i,n) for(int i = 1; i <= (n); ++i)
#define all(vec) (vec).begin(),(vec).end()

#define debug(vec) for(auto v : vec) cout << v << " "; cout << endl;
#define debug2D(vec2D) for(auto vec : vec2D) { for (auto v : vec) cout << v << " "; cout << endl; } 
#define debugP(vec) for(auto v : vec) cout << "(" << v.first << "," << v.second << ") "; cout << endl;
#define debug2DP(vec2D) for(auto vec : vec2D) { for (auto v : vec) cout << "(" << v.first << "," << v.second << ") "; cout << endl; } 

typedef long long ll;

constexpr ll INF = 1000000000; //10^10
//const ll MOD = 998244353;
constexpr ll MOD = 1000000007;

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

int main() {
		int n; cin >> n;
		vector<int> a(n);
		rep(i,n) cin >> a[i];

		vector<int> digit(20,0);

		ll ans = 0;
		int r = 0;
		rep(l, n) {
			while (r < l) r++;
			bool ok = true;
			if (r < n) rep(i,20) if (a[r] >> i & 1 && digit[i] >= 1) ok = false;
			while (r < n && ok) {
				rep(i, 20) if (a[r] >> i & 1) digit[i]++;
				r++;
				if (r < n) rep(i, 20) if (a[r] >> i & 1 && digit[i] >= 1) ok = false;
			}

			ans += (r-l);

			rep(i, 20) if (a[l] >> i & 1) digit[i]--;
		}
		cout << ans << endl;
}

Measured memory_bytes: 1024
// 標準入力
var fs = require('fs'),
length = fs.fstatSync(process.stdin.fd).size,
buffer = new Buffer(length),
bytesRead = fs.readSync(process.stdin.fd, buffer, 0, length, 0),
input = buffer.toString('utf8', 0, bytesRead).trim().split('\n');
main();
  
// ここから
function main(){
  var x = y = 0;
  var sumt = 0;
  for(var i = 0, len = input.length; i < len; i++){
    var inp = input[i].split(',');
    var r = inp[0] - 0;
    var t = inp[1] - 0;

    if(!r && !t){
      break;
    }

    x += r * Math.sin(sumt * Math.PI/180);
    y += r * Math.cos(sumt * Math.PI/180);

    sumt += t;
  }

  console.log(~~x);
  console.log(~~y);
}

Measured memory_bytes: 7644
import java.io.*;
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
        
        final int N = Integer.parseInt(sc.next());
        final int D = Integer.parseInt(sc.next());
        final int X = Integer.parseInt(sc.next());
        int[] a = new int[N];
        int chocolate = 0;
        for (int i = 0; i < N; i++) {
            a[i] = Integer.parseInt(sc.next());
        }
        for (int i = 0; i < N; i++) {
            int times = 0;
            int days = 1;
            while (days <= D) {
                chocolate++;
                times++;
                days = times * a[i] + 1;
            }
        }
        out.println(chocolate + X);
        
        out.flush();
    }

}

Measured memory_bytes: 23124
n = int(input())
string = input()
a = []
a_01 = []
a_02 = []
bit_1 = 0
for i in range(n):
    a.append(int(string[i])-1)
    a_01.append((int(string[i])-1)%2)
    a_02.append((int(string[i])-1)//2)
    if int(string[i])-1 == 1: bit_1 = 1

### n-1Ciの偶奇を求めるパート
num_lst = [0 for i in range(n)]
for i in range(1, n):
    p = i
    cnt = 0
    while p % 2 == 0:
        p = p / 2
        cnt += 1
    num_lst[i] = cnt
n_1Ci = [0 for i in range(n)]
for i in range(1, n):
    n_1Ci[i] = n_1Ci[i-1] + num_lst[n-i] - num_lst[i]
### n-1Ciの偶奇を求めるパートここまで

# まずは答えが1かどうか判定
cnt_01 = [0, 0]
for i in range(n):
    cnt_01[a_01[i]] += 1 if n_1Ci[i] == 0 else 0
if cnt_01[1] % 2 == 1:
    print(1)
    exit()

# 答えが1でない時、配列に1が含まれるなら答えは0
if bit_1 == 1:
    print(0)
    exit()

# 配列が0と2で構成されている時
cnt_02 = [0, 0]
for i in range(n):
    cnt_02[a_02[i]] += 1 if n_1Ci[i] == 0 else 0
if cnt_02[1] % 2 == 1:
    print(2)
else:
    print(0)

Measured memory_bytes: 135648
#include <iostream>
#include<vector>
#include<algorithm>
#define ll long long 
#define rep(n) for(int i=0;i<n;++i)
using namespace std;
int main(void){
    // Your code here!

int n;
cin>>n;
vector<int> vec(n);
rep(n){
    cin>>vec[i];
}

for(int i=n-1;i>0;i--){
    if(vec[i] < vec[i-1]){
        if(abs(vec[i]-vec[i-1])>1){
            cout<<"No";
            return 0;
        }
        else
            vec[i-1]--;
    }
        
}
cout<<"Yes";
}


Measured memory_bytes: 3244
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<functional>
#include<fstream>
#include<utility>
#include<bitset>
#include<map>
#include<deque>
#include<cmath>
#include<random>
#include<string.h>
#define FOR(i, a, b) for (int i = a; i < b; ++i)
#define rep(N) for (int i = 0; i < N; ++i)
#define Rep(a, b) for (int i = a; i < b; ++i)
#define For(i, N) for (int i = 0; i < N; ++i)
#define all(v) v.begin(), v.end()
#define rev(v) v.rbegin(), v.rend()
#define makei(N) int N; cin >> N;
#define makel(N) ll N; cin >> N;
#define makes(s) string s; cin >> s;
#define maked(d) double d; cin >> d;
#define makev(v, N) vi v(N); rep(N)cin >> v[i];
#define mod 1000000007
#define re return 0

using namespace std;
using ll = long long int;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vector<bool>>;
using vs = vector<string>;
using pii = pair<int, int>;
using pis = pair<int, string>;
using msi = map<string, int>;

template<typename T>
void say(T s) {
	cout << s << "\n";
}

template<typename T>
void say(vector<T> s) {
	auto itr = s.begin();
	cout << *(itr++);
	while (itr != s.end()) {
		cout << " " << *(itr++);
	}
	cout << "\n";
}

void yn(bool b) {
	if (b)say("YES");
	else say("NO");
}

int c[9];

int main() {
	makei(N);
	makev(a, N);
	for (int x : a) {
		if (x < 400)++c[0];
		else if (x < 800)++c[1];
		else if (x < 1200)++c[2];
		else if (x < 1600)++c[3];
		else if (x < 2000)++c[4];
		else if (x < 2400)++c[5];
		else if (x < 2800)++c[6];
		else if (x < 3200)++c[7];
		else ++c[8];
	}
	int ans = 0;
	rep(8)if (c[i] > 0)++ans;
	cout << max(1, ans) << " ";
	ans += c[8];
	say(ans);
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
const long long INF = (long long)(1e18) + 1;
int main() {
	int N,K;
	cin >> N >> K;
	vector<int>P(N);
	for (int n = 0;n<N;++n) {
		cin >> P[n]; 
		P[n]++;
	}
	int ans = 0;
	int tmp = 0;
	for (int n = 0;n<K;++n) {
		tmp += P[n];
	}
	ans = tmp;
	for (int n = 1;n <= N - K;++n) {
		tmp = tmp - P[n - 1] + P[n - 1 + K];
		ans = max(tmp, ans);
	}
	//double dans = ans;
	//dans /= 2;
	//printf("%.10f\n", dans);
	//cout << (ans)/2.0<<endl;
	if (0 == ans%2) {
		cout << ans/ 2 << endl;
	}
	else{
		cout << ans/ 2 << ".5"<<endl;
	}
	return 0;
}

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

ll n,c;
ll D[33][33];
ll C[555][555];
ll A[3][33];

int main(){
    cin >> n >> c;
    for(ll i=1;i<=c;i++){
        for(ll j=1;j<=c;j++) cin >> D[i][j];
    }
    for(ll i=1;i<=n;i++){
        for(ll j=1;j<=n;j++){
            cin >> C[i][j];
            if((i+j)%3==0) A[0][C[i][j]]++;
            else if((i+j)%3==1) A[1][C[i][j]]++;
            else if((i+j)%3==2) A[2][C[i][j]]++;
        }
    }
    ll res=1e18;
    for(ll i=1;i<=c;i++){
        for(ll j=1;j<=c;j++){
            if(j==i) continue;
            for(ll k=1;k<=c;k++){
                if(k==i||k==j) continue;
                else{
                    ll count=0;
                    for(ll l=1;l<=c;l++) count+=A[0][l]*D[l][i];
                    for(ll l=1;l<=c;l++) count+=A[1][l]*D[l][j];
                    for(ll l=1;l<=c;l++) count+=A[2][l]*D[l][k];
                    res=min(res,count);
                }
            }
        }
    }
    cout << res << endl;
}


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

#define debug(a) cout << #a << " " << a << endl;
#define _debug(a, i) cout << #a << "[" << i << "]" << " = " << a[i] << endl;
#define fastio ios_base::sync_with_stdio(false); \
			cin.tie(0);							 \
			cout.tie(0);
#define PI 3.141592654

using namespace std;

using ll = long long;
const int MOD = 998244353;
const ll INF = 1e18 + 9;

ll powmod(ll base, ll exp, const ll MOD) { ll ans = 1; while (exp) { if (exp & 1)	ans = (ans * base) % MOD; base = (base * base) % MOD; exp >>= 1; } return ans; }
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return (a * b) / gcd(a, b); }
ll modInverse(ll n, const ll p) { return powmod(n, p - 2, p); }
void add(ll& x, ll v) { x = (x + v) % MOD; if (x < 0) x += MOD; }
//ll f[500005];
//ll kCn(ll k, ll n) { return (f[n] * modInverse((f[n - k] * f[k]) % MOD, MOD)) % MOD; }


void test_case() {
	
}


int main() {
	fastio;

	
	int n = 5;
	int ans, x;
	for (int i = 1; i <= n; ++i) {
		cin >> x;
		if (x == 0)
			ans = i;
	}
	cout << ans;
	return 0;
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n; cin>>n;
    vector<int> t(n+1),x(n+1),y(n+1); t.at(0)=0; x.at(0)=0; y.at(0)=0;
    for(int i=0; i<n; i++){
        cin>>t.at(i+1)>>x.at(i+1)>>y.at(i+1);
    }
    for(int i=0; i<n; i++){
        int a=abs(x.at(i+1)-x.at(i))+abs(y.at(i+1)-y.at(i)), b=t.at(i+1)-t.at(i);
        if (a>b) {
            cout<<"No"<<endl; return 0;
        }
        if((b-a)%2 == 1){
            cout<<"No"<<endl; return 0;
        }
    }
    cout<<"Yes"<<endl; return 0;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define ALL(c) (c).begin(), (c).end()
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v, x) (std::find(v.begin(), v.end(), x) != v.end())
using namespace std;

using ll = long long;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline void dump(vector<T> v) { for (auto& x : v) cerr << x << " "; cerr << endl; }
template<class T> inline void dump(vector<pair<T, T>> v) { for (auto& p : v) cerr << p.first << " " << p.second << endl; }
template<class T> inline void dump(vector<vector<T>> vv) { for (auto& v : vv) {for (auto& x : v) cerr << x << " "; cerr << endl;} }

constexpr int INF = 1e9+5;
constexpr long long INFLL = 1LL<<60;
constexpr double eps = (1e-9);

constexpr ll mod = 1000000007;



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

  int n, k;
  cin >> n >> k;
  vector<int> h(n);
  rep(i, n) cin >> h[i];

  vector<int> dp(n, INF);

  dp[0] = 0;

  rep(i, n) {
    for (int j = 1; j <= k; j++) {
      if (i + j >= n) break;
      chmin(dp[i+j], dp[i] + abs(h[i] - h[i+j]));
    }
  }

  cout << dp[n-1] << endl;

  return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,c=0,m=0;
	string s;
	cin>>n>>s;
	if(1<=n<=100)
	{
		for(int i=0;i<n;i++){
			if(s[i]=='I'){
				c++;
			}
			else if(s[i]=='D')
			   c--;
			if(m<c){
			   m=c; 
	}
		
		}
	}
	cout<<m;	
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
clock_t t=clock();
namespace my_std{
	using namespace std;
	#define pii pair<int,int>
	#define fir first
	#define sec second
	#define MP make_pair
	#define rep(i,x,y) for (int i=(x);i<=(y);i++)
	#define drep(i,x,y) for (int i=(x);i>=(y);i--)
	#define go(x) for (int i=head[x];i;i=edge[i].nxt)
	#define templ template<typename T>
	#define sz 1010
	typedef long long ll;
	typedef double db;
	mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
	templ inline T rnd(T l,T r) {return uniform_int_distribution<T>(l,r)(rng);}
	templ inline bool chkmax(T &x,T y){return x<y?x=y,1:0;}
	templ inline bool chkmin(T &x,T y){return x>y?x=y,1:0;}
	templ inline void read(T& t)
	{
		t=0;char f=0,ch=getchar();double d=0.1;
		while(ch>'9'||ch<'0') f|=(ch=='-'),ch=getchar();
		while(ch<='9'&&ch>='0') t=t*10+ch-48,ch=getchar();
		if(ch=='.'){ch=getchar();while(ch<='9'&&ch>='0') t+=d*(ch^48),d*=0.1,ch=getchar();}
		t=(f?-t:t);
	}
	template<typename T,typename... Args>inline void read(T& t,Args&... args){read(t); read(args...);}
	char __sr[1<<21],__z[20];int __C=-1,__zz=0;
	inline void Ot(){fwrite(__sr,1,__C+1,stdout),__C=-1;}
	inline void print(register int x)
	{
		if(__C>1<<20)Ot();if(x<0)__sr[++__C]='-',x=-x;
		while(__z[++__zz]=x%10+48,x/=10);
		while(__sr[++__C]=__z[__zz],--__zz);__sr[++__C]='\n';
	}
	void file()
	{
		#ifdef NTFOrz
		freopen("a.in","r",stdin);
		#endif
	}
	inline void chktime()
	{
		#ifdef NTFOrz
		cout<<(clock()-t)/1000.0<<'\n';
		#endif
	}
	#ifdef mod
	ll ksm(ll x,int y){ll ret=1;for (;y;y>>=1,x=x*x%mod) if (y&1) ret=ret*x%mod;return ret;}
	ll inv(ll x){return ksm(x,mod-2);}
	#else
	ll ksm(ll x,int y){ll ret=1;for (;y;y>>=1,x=x*x) if (y&1) ret=ret*x;return ret;}
	#endif
//	inline ll mul(ll a,ll b){ll d=(ll)(a*(double)b/mod+0.5);ll ret=a*b-d*mod;if (ret<0) ret+=mod;return ret;}
}
using namespace my_std;

int n,m,d;
int a[sz][sz],b[sz][sz],c[5]={0,4,3,2,1};
int ans[sz][sz];

int main()
{
	file();
	read(n,m,d);
	rep(i,1,(d+1)/2) rep(j,i,d-i+1) a[i][j]=1,a[d-i+1][j]=3;
	rep(i,1,d) rep(j,1,d) if (!a[i][j]) a[i][j]=((j<=d/2)?2:4);
	rep(i,1,d) rep(j,1,d) b[i][j]=c[a[j][i]]; 
	rep(i,0,d-1) rep(j,0,d-1) a[i][j]=a[i+1][j+1],b[i][j]=b[i+1][j+1];
	rep(i,0,n-1) rep(j,0,m-1) { int k=((i/d)&1)^((j/d)&1); ans[i][j]=(k?a:b)[i%d][j%d]; }
	rep(i,0,n-1) rep(j,0,m-1) printf("%c","RGBY"[ans[i][j]-1]),(j==m-1?puts(""):0);
	return 0; 
}

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

#include <assert.h>    // LON
#include <math.h>    // sqrt()


using namespace std;
#define rep(i, n) for (ll i = 0; i < (n); ++i)
//#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) ll(x.size())
typedef long long ll;
//typedef pair<int, int> P;
typedef pair<ll, ll> P;
//const double INF = 1e10;
//const ll INF = LONG_LONG_MAX;
const ll MINF = -10e10;
const int INF = INT_MAX;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)


//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);

//typedef priority_queue<P, vector<P>, greater<P>> PQ_ASK;
const int mod = 1000000007;

int main() {

    int n;
    cin >> n;

    vector<int> numbers(n);
    rep(i, n) cin >> numbers[i];

    int sum = accumulate(numbers.begin(), numbers.end(), 0);
    if (sum % 10 != 0) {
        cout << sum << endl;
        return 0;
    }

    bool hasNot10 = [&] {
        for (int s : numbers) {
            if (s % 10 != 0) {
                return true;
            }
        }
        return false;
    }();

    if (!hasNot10) {
        cout << 0 << endl;
        return 0;
    }

    int m = INF;

    for (int i : numbers) {
        if (i % 10 == 0) continue;
        cmin(m, i);
    }

    cout << sum - m << endl;

}

Measured memory_bytes: 256
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.NoSuchElementException;

public class Main {

	static final int mod = 1000000007;
	static long[] fac;
	static long[] inv;
	static long[] finv;
	

	public static void main(String[] args) {

		FastScanner sc = new FastScanner();
		PrintWriter out=new PrintWriter(System.out);
		int N = sc.nextInt();
		int A = sc.nextInt();
		int B = sc.nextInt();
		
		if(N*A<B) {
			out.println(N*A);
		}else {
			out.print(B);
		}
		
		out.flush();
	}
	
	static void calcNumOfCombinationInit(int N) {
		
		fac=new long[N];
		inv=new long[N];
		finv=new long[N];
		fac[0]=1;
		fac[1]=1;
		finv[0]=1;
		finv[1]=1;
		inv[1]=1;
		for(int i=2;i<N;i++) {
			fac[i]=fac[i-1]*i%mod;
			inv[i]=mod-inv[mod%i]*(mod/i)%mod;
			finv[i]=finv[i-1]*inv[i]%mod;
		}
		
	}

	static long calcNumOfCombination(int n, int r) {
		if(n<r || n<0 || r<0) {
			return 0;
		}
		return fac[n]*(finv[r]*finv[n-r]%mod)%mod;
	}

}

class FastScanner {
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;

	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) {
				return false;
			}
		}
		return true;
	}

	private int readByte() {
		if (hasNextByte())
			return buffer[ptr++];
		else
			return -1;
	}

	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <= 126;
	}

	public boolean hasNext() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr]))
			ptr++;
		return hasNextByte();
	}

	public String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	public long nextLong() {
		if (!hasNext())
			throw new NoSuchElementException();
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}

	public int nextInt() {
		long nl = nextLong();
		if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
			throw new NumberFormatException();
		return (int) nl;
	}

	public double nextDouble() {
		return Double.parseDouble(next());
	}

	public char[][] nextCharsHW(int H, int W) {
		char[][] chars = new char[H][W];
		for (int i = 0; i < H; i++) {
			String str = next();
			for (int j = 0; j < W; j++) {
				chars[i][j] = str.charAt(j);
			}
		}
		return chars;
	}

	public int[][] nextIntsNM(int N, int M) {
		int[][] ints = new int[N][M];
		for (int i = 0; i < N; i++) {
			for (int j = 0; j < M; j++) {
				ints[i][j] = nextInt();
			}
		}
		return ints;
	}
}


Measured memory_bytes: 20820
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<string> vs;
typedef pair<int, int> p;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    int n;
    cin >> n;
    vector<int> h(n);
    for(int i = 0; i < n; i++) {
        cin >> h[i];
    }

    vector<int> c(n);

    c[0] = 0;
    c[1] = abs(h[0] - h[1]);

    for(int i = 2; i < n; i++)
    {
        c[i] = min(c[i-1] + abs(h[i] - h[i - 1]), c[i-2] + abs(h[i] - h[i - 2]));
    }

    cout << c[n - 1] << endl;


}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
int main(){
int s;
cin>>s;
if(((s/100)>=1&&(s/100)<=12)&&((s%100)>=1)&&((s%100)<=12))cout<<"AMBIGUOUS";
else if(((s/100)<1||(s/100)>12)&&(((s%100)<1)||((s%100)>12)))cout<<"NA";
else if(s%100>=1&&s%100<=12)cout<<"YYMM";
else cout<<"MMYY";
return 0;
}

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

using ll = long long;
using ull = unsigned long long;
using ld = long double;
#define FOR(NAME, START, NUM) for (int NAME = START; NAME < (NUM); NAME++)
#define REP(NAME, NUM) for (int NAME = 0; NAME < (NUM); NAME++)
#define BREP(NAME, NUM) for (int NAME = (NUM)-1; NAME >= 0; NAME--)
#define ALL(NAME) (NAME).begin(), (NAME).end()
const ll INF =1000000000000000;

int main(){
  int a,b,c;
  cin>>a>>b>>c;
  c=(c/a)*b;
  cout<<c<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <iomanip>

using namespace std;

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

	int ans = 0;

	for (int i = 0; i <= K; i++) {
		for (int j = 0; j <= K; j++) {
			int k = S - i - j;
			if (k >= 0 && k <= K) ans++;
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
        int a,b,c,ab,bc,ac;
        scanf("%d%d%d",&a,&b,&c);
        ab=a+b;
        ac=a+c;
        bc=b+c;
        if(ab==c || ac==b || bc==a)printf("Yes");
        else printf("No");
        return 0;
}


Measured memory_bytes: 1680