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

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

		int n=s.nextInt(),k=s.nextInt();
		char[]t=s.next().toCharArray();

		ArrayList<Integer>l=new ArrayList<>();
		if(t[0]=='0')
			l.add(0);
		{
			int c=1;
			for(int i=0;i<n;++i) {
				if(i==n-1||t[i+1]!=t[i]) {
					l.add(c);
					c=1;
				}else
					++c;
			}
		}
		if(t[n-1]=='0')
			l.add(0);

		if(k*2+1>=l.size()) {
			System.out.println(t.length);
			return;
		}

		int sum=0,r=0;
		for(int i=0;i<=(k-1)*2;++i)
			sum+=l.get(i);

		for(int i=k*2;i<l.size();i+=2) {
			sum+=l.get(i);
			sum+=l.get(i-1);

			System.err.println(sum);
			r=Math.max(r,sum);

			sum-=l.get(i-k*2);
			sum-=l.get(i-k*2+1);
		}

		System.out.println(r);
	}
}

Measured memory_bytes: 40872
#include<iostream>
#include<string>
#include<algorithm>
#include<math.h>
#include<queue>
#include<set>
#include<map>
#include<random>
#include<functional>
#include<utility>

#define rep(i,n) for(int i=0; i<n; i++)
#define pb push_back
#define P pair<int, int>
#define PLI pair<ll, int>

using namespace std;

typedef long long ll;


int N;
set< vector<int> > sp;
vector<int> p(3);
int main() {
	cin >> N;
	rep(i, N) {
		cin >> p[0] >> p[1] >> p[2];
		sort(p.begin(), p.end());
		sp.insert(p);
	}

	cout << N - sp.size() << endl;

	return 0;
}



Measured memory_bytes: 3276
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <functional>
#include <numeric>
#include <limits>
#include <cmath>
#include <iomanip>
 
#define ALL(a)  (a).begin(),(a).end()
 
using namespace std;
typedef long long int ll;
typedef pair <int,int> P;

 
int main() {
    ll n, ans = 0;
    ll a1, a2, a3;

    cin >> a1 >> a2 >> a3;

    (a1 + a2 + a3 >= 22) ? (cout << "bust" << endl) : (cout << "win" << endl);
    
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <numeric>
#include <map>
#include <limits>

using namespace std;

typedef long long ll;

int main()
{
    int N,W;
    scanf("%d%d",&N,&W);
    int w[129],v[128];
    for(int i=0;i<N;i++)
        scanf("%d%d",&w[i],&v[i]);
    map<ll,ll> bag1,bag2;
    bag1[0]=0;
    bag2[0]=0;
    for(int i=0;i<N;i++)
    {
        for(pair<ll,ll> a:bag1) {
            if(a.first+w[i]<=W)
            {
                ll ww=a.first+w[i];
                bag2[ww]=max(bag2[ww],a.second+v[i]);
            }
        }
        bag1=bag2;
        
    }
    ll res=0;
    for(pair<ll, ll> a:bag2)
        res=max(res,a.second);
    cout<<res<<endl;
    return 0;
}


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

#define debug(x) cerr << #x << ": " << x << endl
#define debugArray(x, n)                                                       \
    for(long long hoge = 0; (hoge) < (n); ++(hoge))                            \
    cerr << #x << "[" << hoge << "]: " << x[hoge] << endl
using namespace std;

using ll = long long;
const ll INF = LLONG_MAX / 2;

struct UnionFind {
    vector<int> par;
    UnionFind(int size) : par(size, -1) {}
    bool unionSet(int x, int y) {
        x = root(x);
        y = root(y);
        if(x != y) {
            if(par[y] < par[x])
                swap(x, y);
            par[x] += par[y];
            par[y] = x;
        }
        return x != y;
    }
    bool same(int x, int y) { return root(x) == root(y); }
    int root(int x) { return par[x] < 0 ? x : par[x] = root(par[x]); }
    int size(int x) { return -par[root(x)]; }
};

signed main() {
    int N;
    cin >> N;
    tuple<int, int, int> edge[N - 1];
    for(int i = 0; i < N - 1; i++) {
        int a, b, c;
        cin >> a >> b >> c;
        edge[i] = make_tuple(-c, a - 1, b - 1);
    }
    sort(edge, edge + (N - 1));
    UnionFind uf(N);
    int id[N];
    for(int i = 0; i < N; i++) {
        id[i] = i;
    }
    vector<pair<int, ll>> G[2 * N - 1];
    for(int i = 0; i < N - 1; i++) {
        int a, b;
        ll w;
        tie(w, a, b) = edge[i];
        w = -w;
        G[N + i].emplace_back(id[uf.root(a)], w * uf.size(b));
        G[N + i].emplace_back(id[uf.root(b)], w * uf.size(a));
        uf.unionSet(a, b);
        id[uf.root(a)] = N + i;
    }
    ll ans[N];
    stack<pair<int, ll>> st;
    st.push({2 * N - 2, 0});
    while(!st.empty()) {
        int v;
        ll w;
        tie(v, w) = st.top();
        st.pop();
        if(v < N) {
            ans[v] = w;
            continue;
        }
        for(auto e : G[v]) {
            int u;
            ll cost;
            tie(u, cost) = e;
            st.push({u, cost + w});
        }
    }
    for(int i = 0; i < N; i++) {
        cout << ans[i] << endl;
    }
    return 0;
}


Measured memory_bytes: 14364
import java.util.Scanner;

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

        if (a + b + c >= 22) {
            System.out.println("bust");
            return;
        }
        System.out.println("win");
    }
}

Measured memory_bytes: 23764
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<queue>
#include<iostream>
#include<algorithm>
#define m(a,b) memset(a,b,sizeof(a));
using namespace std;
const int maxn = 1e5;
int father[maxn + 5];
int main(){
	int x,a,b;
	cin >> x >> a >> b;
	cout << (x-a)%b << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, begin, end) for (int i = begin; i < (int)(end); i++)
#define all(v) v.begin(), v.end()
const int MOD = 1000000007;

int main()
{
    int k;
    vector<int> A(5);
    rep(i, 0, 5)
    {
        cin >> A.at(i);
    }
    cin >> k;
    rep(i, 0, 5)
    {
        rep(j, i + 1, 5)
        {
            if (fabs(A.at(i) - A.at(j)) > k)
            {
                cout << ":(" << endl;
                return 0;
            }
        }
    }
    cout << "Yay!" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
using namespace std;

#define rep(i,n) for(int i = 0; i<n; ++i)
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
typedef long long ll;

int main(){
    int n,k; cin >> n >> k;
    string s; cin >> s;
    int st = 1;
    if(s[0] == '0')st = 0;

//群数列化
    vector <int> sec; int p = 0;
    rep(i,n){
        sec.push_back(1);
        while(s[i] == s[i+1]){ ++i; ++sec[p]; }
        ++p;
    }

//累積和
    vector <int> sum(sec.size()+3,0);
    rep(i,sec.size()) sum[i+2] = sum[i+1] + sec[i]; 
    sum[sum.size()-1] = sum[sum.size()-2];

//処理
    int ans = -INF; k = k*2+1;
    for(int i = 0; i+k < sum.size(); ++i){
        if(i%2 == st){
            ans = max(ans, sum[i+k] - sum[i]);
        }
    }
    if(ans == -INF)ans = n;
    cout << ans << endl; return 0;
}

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

int main(void){
    int A, B;
    cin >> A >> B;
    if(A>B and (A-B)%2 == 0){
        cout << A-(A-B)/2 << endl;
    }
    else if (A<B and (B-A)%2 == 0){
        cout << B-(B-A)/2 << endl;
    }
    else{
        cout << "IMPOSSIBLE" << endl;
    }

}


Measured memory_bytes: 256
n,k = map(int,input().split())
a = tuple(map(int,input().split()))
mod = 10**9+7
rng = 1001
fctr = [1]
finv = [1]
for i in range(1,rng):
  fctr.append(fctr[-1]*i%mod)
  finv.append(pow(fctr[i],mod-2,mod))
dp = [[0 for i in range(n+1)] for j in range(k+1)]
dp[0][0] = 1
for i in range(1,k+1):
  x = a[i-1]
  for j in range(n+1):
    if dp[i-1][j] == 0:
      continue
    y = dp[i-1][j]*fctr[n-j]*finv[n-x]%mod
    for t in range(min(n-j,x)+1):
      dp[i][j+t]=(dp[i][j+t]+y*fctr[n-t]*finv[n-j-t]*finv[t]*finv[x-t])%mod
print(dp[k][n])

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

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

int level(int j, int o, int i) {
    int c = min(j, o, i);
    if (c == o) return c;
    else return 0;
}

int main() {
    string s; cin >> s;
    int j_count = 0, o_count = 0, i_count = 0;
    int count = 0;
    char state = 'f';  // f: first, J: J, O: O, I: I
    for (string::iterator p = s.begin(); p != s.end(); p++) {
        switch (state) {
            case 'f':
                if (*p == 'J') {
                    j_count = 1;
                    state = 'J';
                }
                break;
            case 'J':
                if (*p == 'J') {
                    j_count++;
                } else if (*p == 'O') {
                    o_count = 1;
                    state = 'O';
                } else {
                    j_count = 0;
                    o_count = 0;
                    i_count = 0;
                    state = 'f';
                }
                break;
            case 'O':
                if (*p == 'O') {
                    o_count++;
                } else if(*p == 'I') {
                    i_count = 1;
                    state = 'I';
                    if (p == s.end()-1) {
                        int _count = level(j_count, o_count, i_count);
                        if (count < _count) {
                            count = _count;
                        }
                    }
                } else {
                    if (*p == 'J') {
                        j_count = 1;
                        o_count = 0;
                        i_count = 0;
                        state = 'J';
                    } else {
                        j_count = 0;
                        o_count = 0;
                        i_count = 0;
                        state = 'f';
                    }
                }
                break;
            case 'I':
                if (*p == 'I') {
                    i_count++;
                    if (p == s.end()-1) {
                        int _count = level(j_count, o_count, i_count);
                        if (count < _count) {
                            count = _count;
                        }
                    }
                } 
                if (*p != 'I') {
                    int _count = level(j_count, o_count, i_count);
                    if (count < _count) {
                        count = _count;
                    }
                    if (*p == 'J') {
                        state = 'J';
                        j_count = 1;
                        o_count = 0;
                        i_count = 0;
                    } else {
                        state = 'f';
                        j_count = 0;
                        o_count = 0;
                        i_count = 0;
                    }
                }
                break;
        }
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 1984
#include <iostream>
#include <cmath>

using namespace std;

int main(void) {
    double a, b, x, h;

    cin >> a >> b >> x;

    h = x / (a * a);

    double radian;
    if (h > b / 2) {
        double v = a / (2 * (b - h));
        radian = atan(v);
    } else {
        // double v = (2 * h + a - b) / b;
        double v = (2 * a * h) / (b * b);
        radian = atan(v);
    }

    // cout << radian << endl;
    fprintf(stdout, "%2.7f\n", 90 - radian * 180 / M_PI);
    // cout << 90 - radian * 180 / M_PI << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
	
	int n;
	cin >> n;
	int s[14] = { 0 }, h[14] = { 0 }, c[14] = { 0 }, d[14] = { 0 };
	for (int i = 0; i < n; i++) {

		char ch;
		int num;
		cin >> ch >> num;

		switch (ch)
		{
		case 'S': s[num] = 1; break;
		case 'H': h[num] = 1; break;
		case 'C': c[num] = 1; break;
		case 'D': d[num] = 1; break;
		default:
			break;
		}
	}

	for (int j = 1; j < 14; j++) {
		if (s[j] != 1) cout << "S " << j << endl;
	}
	for (int j = 1; j < 14; j++) {
		if (h[j] != 1) cout << "H " << j << endl;
	}
	for (int j = 1; j < 14; j++) {
		if (c[j] != 1) cout << "C " << j << endl;
	}
	for (int j = 1; j < 14; j++) {
		if (d[j] != 1) cout << "D " << j << endl;
	}

	return 0;
}





Measured memory_bytes: 3104
#[allow(unused_imports)]
use std::char::*;
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;

#[allow(unused_macros)]
macro_rules! debug {($($a:expr),*) => {println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);}}
#[allow(unused_macros)]
macro_rules! input { ( source = $ s : expr , $ ( $ r : tt ) * ) => { let mut iter = $ s . split_whitespace ( ) ; let mut next = || { iter . next ( ) . unwrap ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; ( $ ( $ r : tt ) * ) => { let stdin = std :: io :: stdin ( ) ; let mut bytes = std :: io :: Read :: bytes ( std :: io :: BufReader :: new ( stdin . lock ( ) ) ) ; let mut next = move || -> String { bytes . by_ref ( ) . map ( | r | r . unwrap ( ) as char ) . skip_while ( | c | c . is_whitespace ( ) ) . take_while ( | c |! c . is_whitespace ( ) ) . collect ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; }
#[allow(unused_macros)]
macro_rules! input_inner { ( $ next : expr ) => { } ; ( $ next : expr , ) => { } ; ( $ next : expr , $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let $ var = read_value ! ( $ next , $ t ) ; input_inner ! { $ next $ ( $ r ) * } } ; }
#[allow(unused_macros)]
macro_rules! read_value { ( $ next : expr , ( $ ( $ t : tt ) ,* ) ) => { ( $ ( read_value ! ( $ next , $ t ) ) ,* ) } ; ( $ next : expr , [ $ t : tt ; $ len : expr ] ) => { ( 0 ..$ len ) . map ( | _ | read_value ! ( $ next , $ t ) ) . collect ::< Vec < _ >> ( ) } ; ( $ next : expr , chars ) => { read_value ! ( $ next , String ) . chars ( ) . collect ::< Vec < char >> ( ) } ; ( $ next : expr , usize1 ) => { read_value ! ( $ next , usize ) - 1 } ; ( $ next : expr , $ t : ty ) => { $ next ( ) . parse ::<$ t > ( ) . expect ( "Parse error" ) } ; }

#[derive(PartialEq, PartialOrd)]
pub struct Total<T>(pub T);
impl<T: PartialEq> Eq for Total<T> {}
impl<T: PartialOrd> Ord for Total<T> { fn cmp(&self, other: &Total<T>) -> std::cmp::Ordering { self.0.partial_cmp(&other.0).unwrap() }}

#[allow(dead_code)]
const MAX:usize = 100006;
#[allow(dead_code)]
const INF_U32:u32 = 1 << 31;
#[allow(dead_code)]
const INF_I32:i32 = 1 << 30;
#[allow(dead_code)]
const INF_U64:u64 = 1 << 63;
#[allow(dead_code)]
const INF_I64:i64 = 1 << 62;
#[allow(dead_code)]
const MOD:i64 = 1e9 as i64 + 7;

#[allow(dead_code)]
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().split_whitespace()
        .map(|e| e.parse().ok().unwrap()).collect()
}


#[allow(unused_imports)]
use std::f64;


fn main() {
    input!{n:usize, k:usize, p:[i64;n]};

    let mut ans = 0.0;
    let mut crt = 0.0;
    for i in 0..n {
        let q = (1..p[i]+1).sum::<i64>() as f64 / p[i] as f64;
        //debug!(p[i],q);
        crt += q;
        if i >= k { crt -= (1..p[i-k]+1).sum::<i64>() as f64 / p[i-k] as f64; }
        ans = f64::max(ans, crt);
        //debug!(ans);
    }

    println!("{}", ans);

}

Measured memory_bytes: 6396
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <queue>
#include <climits>
#include <set>
#include <map>
#include <stack>
#include <iomanip>
#include <tuple>
#define ll long long
#define rep(i,s,n) for(ll i = (ll)(s); i < (ll)(n); i++)
#define all(a) (a).begin(),a.end()
#define mod 1000000007
using namespace std;
using graph =vector<vector<ll>>;
/*階乗*/
ll factorial(ll n){
    if(n==0){
        return 1;
    }
    else{
        return n*factorial(n-1);
    }
}

/* ユークリッドの互除法 最大公約数*/
ll gcd(ll a, ll b) {
	return b ? gcd(b,a%b) : a;
}



/*最小公倍数*/

ll lcm(ll a,ll b){
	return a/gcd(a,b)*b;
}


/*二点間の距離*/
double dist(pair<double,double> a,pair<double,double> b){
	return sqrt(pow((a.first - b.first) ,2) + pow((a.second - b.second),2));
}

//繰り返し自乗法
double ism(double aa,ll p){
    double ap=aa;
    double ans=1;
    while(p>0){
        //cout<<"p="<<p<<",ap="<<ap<<endl;
        if(p&1){//奇数が真
            ans*=ap;
        }
        p/=2;
        ap=ap*ap;
    }
    return ans;

}
//繰り返し自乗法(アマリトリバージョン)
ll ismm(ll aa,ll p,ll m){
    ll ap=aa;
    ll ans=1;
    while(p>0){
        //cout<<"p="<<p<<",ap="<<ap<<endl;
        if(p&1){//奇数が真
            ans=(ans*ap)%m;    
        }
        p/=2;              
        ap=(ap*ap)%m;
    }
    return ans;

}
/*
ll solve(ll i,ll m,vector<ll>t,ll n){
    if(m==0){
        return 1;
    }
    if(i>=n){
        return 0;
    }
    
    
    cout<<i+1<<" "<<m<<endl;
    cout<<i+1<<" "<<m-t[i]<<endl;
    ll res=solve(i+1,m,t,n)||solve(i+1,m-t[i],t,n);
    return res;
}
*/

//小数点12桁
struct all_init
{
    all_init()
    {
        cout << fixed << setprecision(12);
    }
} All_init;


int main()
{
    ll n;
    cin>>n;
    vector<ll>ans(26,LLONG_MAX);
    rep(i,0,n){
        string o;
        cin>>o;
        vector<ll>cnt(26,0);
        rep(j,0,o.size()){
            cnt[o[j]-'a']++;
        }
        rep(j,0,26){
            ans[j]=min(ans[j],cnt[j]);
        }
    }
    string s; 
    rep(j,0,26){
        if(ans[j]>0){
            s+=string(ans[j],j+'a');
        }
    }
    cout<<s<<endl;


    
    
}


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

int main(){
	int a,b;cin>>a>>b;
  	if(a>=13){
      cout<<b<<endl;
    }else if(a<13&&a>=6){
      cout<<b/2<<endl;
    }else{
      cout<<0<<endl;
    }
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h> 
using namespace std;
using i64 = int_fast64_t;
#define rep(i, N) for(int i = 0; i < N; i++)

int main(){
    int N, M;
    i64 X;
    cin >> N >> M >> X;
    vector<i64> C(N);
    vector<valarray<i64>> A(N, valarray<i64>(M));
    rep(i, N){
        cin >> C[i];
        rep(j, M) cin >> A[i][j];
    }

    i64 ans = (i64)1e18;
    for(int bit = 0; bit < (1 << N); bit++){
        i64 cost = 0;
        valarray<i64> und(M);
        for(int i = 0; i < N; i++){
            if(bit & (1 << i)) {
                cost += C[i];
                und += A[i];
            }
        }
        if(und.min() >= X) ans = min(ans, cost);
    }
    
    if(ans == (i64)1e18) ans = -1;
    cout << ans << endl;
}


Measured memory_bytes: 3636
# -*- coding: utf-8 -*-
import sys
 
def main():
    N = int(input())
    A = [int(input()) for a in range(N)]
    now = 1
    count = 0
    
    for i in range(N):
        count += 1
        now = A[now-1]
        if(now == 2):
            print(count)
            exit()
    print(-1)

if __name__ == "__main__":
    main()

Measured memory_bytes: 7212
use std::io::*;
use std::str::FromStr;

#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n = read::<usize>();
    let mut orders = vec![0; n];
    let mut bonuss = vec![0; n - 1];
    let mut ans = 0;
    for i in 0..n {
        orders[i] = read::<usize>() - 1;
    }
    for _i in 0..n {
        let b = read::<usize>();
        ans += b;
    }
    for i in 0..n - 1 {
        bonuss[i] = read::<usize>();
    }
    let mut prev = n;
    for i in 0..n {
        let next = orders[i];
        if prev < next && next - prev == 1 {
            ans += bonuss[prev]
        }
        prev = next;
    }
    println!("{}", ans);
}


Measured memory_bytes: 4352
N,H,W = (int(x) for x in input().split())
A = []
B = []
for i in range(N):
    a,b = (int(x) for x in input().split())
    A.append(a)
    B.append(b)

num = []

for i in range(N):
    if A[i] >= H:
        num.append(i)

l = len(num)
ans = 0
for i in range(l):
    if B[num[i]] >= W:
        ans += 1

print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <map>
#define chmin(a, b) ((a)=min((a), (b)))
#define chmax(a, b) ((a)=max((a), (b)))
#define fs first
#define sc second
#define eb emplace_back
using namespace std;
 
typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int, int, int, int> T;
 
const ll MOD=1e9+7;
//const ll INF=1e18;
int INF = 1000000;


int dx[2][9]= { { 1,1,1,1,1,2,2,2,3},
                {-1,-1,-1,-1,-1,-2,-2,-2,-3}};
int dy[2][9] = {{ 2,1,0,-1,-2,1,0,-1,0},
                {2,1,0,-1,-2,1,0,-1,0}};


int w,h;
char cliff[65][35];
int dp[65][35][2];

bool check(int i,int j){
    if(i < 0 || i >= h || j < 0 || j >= w) return false;
    if(cliff[i][j] == 'X')return false;
    return true;
}

int main(){
    while(true){
        cin >> w >> h;
        if(w + h == 0)break;
        queue<T> que;
        for(int i = 0;i < h;i++){
            for(int j = 0;j < w;j++){
                dp[i][j][0] = INF;
                dp[i][j][1] = INF;
                cin >> cliff[i][j];
                if(cliff[i][j] == 'S'){
                    dp[i][j][0] = 0;
                    dp[i][j][1] = 0;
                    que.push(make_tuple(i,j,0,0));
                    que.push(make_tuple(i,j,1,0));
                    cliff[i][j] = '0';
                }
            }
        }
        while(!que.empty()){
            T t = que.front(); que.pop();
            int y = get<0>(t),x = get<1>(t),lr = get<2>(t),m = get<3>(t);
            if(dp[y][x][lr] != m)continue;
            for(int k = 0;k < 9;k++){
                int i = y + dy[lr][k],j = x + dx[lr][k];
                if(check(i,j) == false)continue;
                if(dp[i][j][(lr+1)%2] > m + (int) (cliff[y][x] - '0') ){
                    dp[i][j][(lr+1)%2] = m +  (int) (cliff[y][x] - '0') ;
                    if(cliff[i][j] != 'T'){
                        que.push(make_tuple(i,j,(lr+1)%2,dp[i][j][(lr+1)%2]));
                    }
                }
            }
        }
        int ans = INF;
        for(int i = 0;i < h;i++){
            for(int j = 0;j < w;j++){
                for(int k = 0;k < 2;k++){
                    if(cliff[i][j] == 'T') ans = min(ans,dp[i][j][k]);
                }
            }
        }
        if(ans == INF)ans = -1;
        cout << ans << endl;
    }
}


Measured memory_bytes: 3116
use whiteread::parse_line;

fn main() {
    let (h, w): (usize, usize) = parse_line().unwrap();
    let mut a: Vec<String> = Vec::new();

    for _ in 0..h {
        a.push(parse_line().unwrap());
    }

    a.retain(|x| x.contains('#'));
    let mut a: Vec<Vec<char>> = a.iter().map(|x| x.chars().collect()).collect();
    let mut iswhite: Vec<bool> = vec![true; w];
    for k in 0..w {
        for i in 0..a.len() {
            if a[i][k] == '#' {
                iswhite[k] = false;
                break;
            }
        }
    }
    for i in 0..a.len() {
        let mut k = 0;
        a[i].retain(|_| (!iswhite[k], k += 1).0);
    }
    println!(
        "{}",
        a.iter()
            .map(|x| x.iter().collect::<String>())
            .collect::<Vec<String>>()
            .join("\n")
    );
}


Measured memory_bytes: 2216
#include <stdio.h>

int main(void){

  int n,m,l;
  int i,j,k;
  int a[101][101],b[101][101];
  long long c[101][101],s;
  
  scanf("%d%d%d",&n,&m,&l);
  for(i=0;i<n;i++){
    for(j=0;j<m;j++)scanf("%d",&a[i][j]);
  }
  for(i=0;i<m;i++){
    for(j=0;j<l;j++)scanf("%d",&b[i][j]);
  }
  
  for(i=0;i<n;i++){
    for(j=0;j<l;j++){
      s=0;
      for(k=0;k<m;k++){
	s+=a[i][k]*b[k][j];
      }
      c[i][j]=s;
    }
  }
  
  for(i=0;i<n;i++){
     printf("%lld",c[i][0]);
    for(j=1;j<l;j++)printf(" %lld",c[i][j]);
    putchar('\n');
  }
  
  
  return 0;
}



Measured memory_bytes: 2100
#include <algorithm>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for(int(i) = 0; (i) < (n); (i)++)
#define FOR(i, m, n) for(int(i) = (m); (i) < (n); (i)++)
#define All(v) (v).begin(), (v).end()
#define pb push_back
#define MP(a, b) make_pair((a), (b))
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const int INF = 1 << 30;
const ll LINF = 1LL << 60;
const int MOD = 1e9 + 7;

int main() {
    int m;
    while(cin >> m, m) {
        vector<pii> seiza(m);
        rep(i, m) { cin >> seiza[i].first >> seiza[i].second; }
        int n;
        cin >> n;
        vector<pii> stars(n);
        set<pii> se;
        rep(i, n) {
            cin >> stars[i].first >> stars[i].second;
            se.insert(stars[i]);
        }
        pii del = seiza[0];
        rep(i, n) {
            int dx = stars[i].first - del.first;
            int dy = stars[i].second - del.second;

            int flag = 1;
            for(int j = 1; j < m; j++) {
                if(!(se.count(MP(seiza[j].first + dx, seiza[j].second + dy)))) {
                    flag = 0;
                }
                if(!flag)
                    break;
            }
            if(flag) {
                cout << dx << " " << dy << "\n";
                break;
            }
        }
    }
    return 0;
}


Measured memory_bytes: 3068
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <cmath>
#include <iomanip>
#include <cassert>
#include <cstdio>
#include <queue>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
using namespace std;
 
#define db(x) cerr << #x << " = " << x << endl;
 
typedef long long   ll;
typedef long double ld;
 
const ll   MOD       = 1000000007;
const ll   INF       = 1000000007;
const ll   N         = 1000002;
const ll   logN      = 20;
const ld   PI        = acos(-1);
const ll   HashPrime = 31;
 
inline void No() {
    cout << "NO\n";
}
inline void Yes() {
    cout << "YES\n";
}
 
#define fi first
#define se second
 
int n, a[N];
bool b[102];
 
void solve() {
  cin >> n;
  int ans = 0;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    if (b[a[i]]) continue;
    ans++, b[a[i]] = true;
  }
  cout << ans << endl;
}
 
int main() {
  ll t = 1;
//  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}

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

#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define ALL(x) x.begin(),x.end()
#define EPS (1e-8)
#define equals(a,b) (fabs((a)-(b))<EPS)

using namespace std;

typedef long long ll;
bool LTE(double a,double b) { return equals(a,b) || a < b; }
bool LT(double a,double b) { return !equals(a,b) && a < b; }

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

void compute() {

}

int main() {
  cin >> n;
  rep(i,n)  cin >> x[i] >> y[i];
  vector<int> id(n);
  rep(i,n) id[i] = i;
  double ans = 0;
  do {
    double dist = 0;
    rep(i,n-1) {
      int s = id[i], t = id[i+1];
      double dx = x[t] - x[s], dy = y[t] - y[s];
      dist += sqrt( dx * dx + dy * dy );
    }
    ans += dist;
  } while(next_permutation(ALL(id)));
  REP(i,2,n+1) ans /= (double)i;
  printf("%.10f\n",ans);
  compute();
  return 0;
}


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

using namespace std;

#define ll long long
#define ld long double
#define pb push_back
#define mp make_pair
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pdd pair<ld, ld>
#define all(x) (x).begin(), (x).end()
#define fi first
#define se second

const int kMaxN = 200005;

ll a[kMaxN];
ll b[kMaxN];

int main() {
  cin.sync_with_stdio(false);

  int n;
  cin >> n;

  bool bad = 0;
  for (int i = 1; i <= n; i++) {
    cin >> a[i] >> b[i];
    if (a[i] != b[i]) {
      bad = 1;
    }
  }

  if (!bad) {
    cout << 0 << '\n';
    return 0;
  }

  ll ans = 0;
  ll best = 1LL << 60;
  for (int i = 1; i <= n; i++) {
    ans += a[i];
    if (a[i] > b[i] && b[i] < best) {
      best = b[i];
    }
  }
  ans -= best;
  cout << ans << '\n';

  return 0;
}

Measured memory_bytes: 640
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
using namespace std;
typedef long long ll;
const int N = 1e+5;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T, class C> void chmax(T& a, C b){ a>b?:a=b; }
template<class T, class C> void chmin(T& a, C b){ a<b?:a=b; }

void solve() {
    int n;
    int t[N], x[N], y[N];

    cin >> n;
    rep(i, n) {
        cin >> t[i] >> x[i] >> y[i];
    }

    int time = t[0], dist = x[0] + y[0];
    if (time >= dist && time % 2 == dist % 2) {
    }
    else {
        cout << "No" << endl;
        return;
    }
    rep(i, n-1) {
        time = t[i+1] - t[i];
        dist = abs(x[i+1]-x[i]) + abs(y[i+1]-y[i]);
        if (time >= dist && time % 2 == dist % 2) {
        }
        else {
            cout << "No" << endl;
            return;
        }
    }
    cout << "Yes" << endl;
}

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


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

int main() {
	int a, b, c, d;
	int time;

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

	time = a;
	time += b;
	time += c;
	time += d;

	printf("%d\n%d\n", time / 60, time % 60);

	return 0;
}

Measured memory_bytes: 1024
n,k = map(int,input().split())
p = [int(i) for i in input().split()]


j = n-k
s = p[0:k]
max = sum(s)
su = max

for i in range(j):
    t = su+p[i+k]
    u = t-p[i]
    if max < u:
        max = t-p[i]
        s = p[i+1:i+1+k]

    su = u

def summ(i):
    return i*(i+1)/2

ss = 0


for i in s:
    ss += summ(i)/i

print(ss)

Measured memory_bytes: 25188
#include<iostream>
#include<vector>
#include <bits/stdc++.h>
#include<string>
#include<stack>

using namespace std;
typedef long long ll;

int main(){
    int x,y;
    cin>>x>>y;
    if(y%2 == 0){
        if(y>4*x || y<2*x){
            cout<<"No";
        }
        else{
            cout<<"Yes";
        }
    }
    else{
        cout<<"No";
    }
}

Measured memory_bytes: 3620
fun main(args: Array<String>){
    val (isshuukyori,ienokazu) = readLine()!!.split(" ").map(String::toInt)
    val kyoriList: List<Int> = readLine()!!.split(" ").map { it.toInt() }

    // K - An を含む,Ai+1 - Ai の距離が最大のところを通らないようにする
    val saList = mutableListOf<Int>()
    saList.add(isshuukyori - kyoriList.max()!! + kyoriList.min()!!)
    for (i in 0 until kyoriList.size -1){
        saList.add(kyoriList[i+1] - kyoriList[i])
    }
    println(isshuukyori - saList.max()!!)
}

Measured memory_bytes: 80936
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <vector>

using namespace std;
typedef long long ll;

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define reps(i, f, n) for (ll i = (f); i < (n); i++)
#define repr(i, n) for (ll i = n; i >= 0; i--)
#define repv(v) for (auto it = (v).begin(); it != (v).end(); it++)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define pb push_back
#define INIT    \
    cin.tie(0); \
    ios::sync_with_stdio(false);

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

ll const INF = 1LL << 60;
ll const MOD = 1000000007;

int main() {
    INIT;
    ll N;
    cin >> N;

    vector<string> s(N);
    rep(i, N) cin >> s[i];

    rep(i, N) { sort(ALL(s[i])); }

    map<string, ll> dic;
    ll ans = 0;
    rep(i, N) {
        if (dic.find(s[i]) == dic.end()) {
            dic.insert(make_pair(s[i], 0));
        } else {
            dic[s[i]]++;
            ans += dic[s[i]];
        }
    }

    // repv(dic) { cout << (*it).first << ", " << (*it).second << endl; }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 14288
#include <bits/stdc++.h>
using namespace std;
int main() {
	string s;
	cin >> s;
	
	string rev = s;
	int cont = 0;
	reverse(rev.begin(), rev.end());
	
	
	for(int i = 0; i < s.size(); i++){
		if(s[i] != rev[i])cont++;
	}
	cout << cont/2;
	
	
	
}

Measured memory_bytes: 256
# python 3.4.3
import sys
input = sys.stdin.readline

# -------------------------------------------------------------
# function
# -------------------------------------------------------------



# -------------------------------------------------------------
# main
# -------------------------------------------------------------

N = int(input())
CSF = [tuple(map(int,input().split())) for _ in range(N-1)]

Ans = []
for i in range(N):
    ans = 0
    for j in range(i,N-1):
        c,s,f = CSF[j]
        if ans < s:
            ans = s
        if ans%f != 0:
            ans += f - ans%f
        ans += c
    Ans.append(ans)

for ans in Ans:
    print(ans)


Measured memory_bytes: 3188
#include<stdio.h>
int main(void)
{
	int a,b;
	scanf("%d %d",&a,&b);
	if(a<b){
		printf("a < b\n");
	}
	if (a>b) {
		printf("a > b\n");
	}
	if (a==b) {
		printf("a == b\n");
	}
	return 0;
}

Measured memory_bytes: 580
if __name__ == '__main__':

	n = int(input())
	
	cnt=0
	flg = False
	for i in range(n):
		x,y = map(int,input().split())
		
		if x == y:
			cnt += 1
			if cnt == 3:
				flg=True
		else:
			cnt = 0

	if flg:
		print("Yes")
	else:
		print("No")


Measured memory_bytes: 9164
#include<stdio.h>
#include<math.h>
#include<string.h>
#include<stdlib.h>
#include<ctype.h>
#define in scanf
#define out printf
#define lin puts("");
int main()
{
    char s[7];
    gets(s);

    if(s[2]==s[3]&&s[4]==s[5])
        out("Yes");
    else
        out("No");
    lin
}


Measured memory_bytes: 128
#pragma warning(disable:4996)
#include <bits/stdc++.h>

using namespace std;

//macro
#define FOR(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()
#define EPS (1e-8)
#define equals(a,b)(fabs((a)-(b))<EPS)

using ll = long long;
using ull = unsigned long long;
using vb = vector<bool>;
using vi = vector<int>;
using vll = vector<ll>;
using vs = vector<string>;
using vvb = vector<vb>;
using vvi = vector<vi>;
using vvll = vector<vll>;
//func
template<typename A, typename T>void assign2d(A&arr, ll H, ll W, T t) { arr.resize(H); REP(i, H) arr[i].assign(W, t); }
template<class T> ostream &operator<<(ostream &os, const vector<T> &v) { int n = v.size(); REP(i, n)os << v[i] << (i == n - 1 ? "" : " "); return os; }
template <class T = int> inline T IN() { T x; cin >> x; return x; }
template<class T> inline void OUT(const T &x) { cout << x << "\n"; }
void YESNO(bool c) { OUT(c ? "YES" : "NO"); };
void YesNo(bool c) { OUT(c ? "Yes" : "No"); };
struct pre_ { pre_() { cin.tie(nullptr); ios::sync_with_stdio(false); /*cout << fixed << setprecision(6);*/ } } pre__;

int main() {
	int A, B;
	cin >> A >> B;
	if (A + B >= 10) {
		OUT("error");
	}
	else {
		OUT(A + B);
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>
#include <map>
#include <set>
#include <bitset>
#include <sstream>
#include <cstdlib>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <climits>
#include <ctype.h>
using namespace std;

#define PI acos(-1.0)
#define EPS 1e-8
#define MOD 1000000007
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define fi first
#define se second

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

template <class L, class R> ostream &operator <<(ostream &os, pair<L, R> P){
    return os << "(" << P.fi << "," << P.se << ")";
}
template <class T> ostream &operator <<(ostream &os, vector<T> V){
    os << "["; for (auto vv: V) os << vv << ","; return os << "]";
}

struct Matrix {
    vvi data;
    int r, c;
    Matrix(int row, int col, bool identity = false) : r(row), c(col) {
        data.assign(row, vector<int>(col, 0));
        if (identity) {
            for (int i = 0; i < r; ++i) {
                data[i][i] = 1;
            }
        }
    }
    Matrix operator * (Matrix& other) {
        int m = r, n = c, p = other.c;
        Matrix res(m, p);
        for (int i = 0; i < m; ++i) {
            for (int j = 0; j < p; ++j) {
                for (int k = 0; k < n; ++k) {
                    res.data[i][j] += data[i][k] * other.data[k][j];
                }
            }
        }
        return res;
    }
};

// 扩展欧几里得算法 res[1] * a + res[2] * b = res[0] = gcd(a, b)
vector<int> extendGcd(int a, int b) {
    if (b == 0) {
        return {a, 1, 0};
    } else {
        vector<int> tmp = extendGcd(b, a % b);
        return {tmp[0], tmp[2], tmp[1] - (a / b) * tmp[2]};
    }
}

// 矩阵快速幂
Matrix matrix_power(Matrix base, ll exp) {
    int n = base.r;
    Matrix res(n, n, true);
    while (exp) {
        if (exp & 1) {
            res = res * base;
        }
        base = base * base;
        exp >>= 1;
    }
    return res;
}

// 带模快速幂
template <typename T>
T power_mod(T base, int exp, int mod = MOD) {
    T res = 1;
    while (exp) {
        if (exp & 1) res = res * base % mod;
        base = base * base % mod;
        exp >>= 1;
    }
    return res;
}

// 快速幂
template <typename T>
T power(T base, int exp) {
    T res = 1;
    while (exp) {
        if (exp & 1) res *= base;
        base *= base;
        exp >>= 1;
    }
    return res;
}

// 求逆元
ll inv(ll a) {
    return power_mod(a, MOD - 2);
}

/******************************** template ********************************/
#define N 200010
int n, y;

int main() {
    cin >> n >> y;
    if (y < n * 1000 || y > n * 10000) {
        cout << "-1 -1 -1";
        return 0;
    }
    int a, b, c;
    y /= 1000;
    for (int i = 0; i <= (y - n) / 9; ++i) {
        int j = y - n - 9 * i;
        if (j % 4 != 0) continue;
        j /= 4;
        int k = n - i - j;
        if (k < 0) continue;
        cout << i << " " << j << " " << k;
        return 0;
    }
    cout << "-1 -1 -1";

    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main()
{
    int x,y,z;
    int temp=0;
    scanf("%d %d %d",&x,&y,&z);
  if(x>y){
      temp=x;
      x=y;
      y=temp;
    }
    if(y>z){
        temp=y;
        y=z;
        z=temp;
    }
    if(x>y){
      temp=x;
      x=y;
      y=temp;
    }
    printf("%d %d %d\n",x ,y ,z);
    return 0;
}


Measured memory_bytes: 2736
package main

import (
	"fmt"
)

func main() {
	var A, B int
	fmt.Scan(&A, &B)

	inc := B
	if A > B {
		inc = A
	}
	ans := 0
	for i := inc; i <= A*B; i += inc {
		if i%A == 0 && i%B == 0 {
			ans = i
			break
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 512
#include<iostream>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<utility>
#include<algorithm>
#include<cmath>
#include<climits>
using namespace std;

int main(){
	int n;
	cin >> n;
	vector<int> a(n);
	for(int i=0; i<n; i++)
		cin >> a[i];
	int sum1=0;
	long long num1=0;
	for(int i=0; i<n; i++){
		int tmp = a[i];
		if(i==0 && tmp==0){
			num1++;
			tmp++;
		}
		if(sum1 > 0 && sum1+tmp>=0){
			num1 += sum1+tmp+1;
			tmp -= sum1+tmp+1;
		}
		else if(sum1 < 0 && sum1+tmp<=0){
			num1 += abs(sum1+tmp)+1;
			tmp += abs(sum1+tmp)+1;
		}
		sum1+=tmp;
	}
	int sum2;
	long long num2=0;
	if(a[0] > 0){
		sum2 = -1;
		num2 += a[0]+1;
	}
	else if(a[0] < 0){
		sum2 = 1;
		num2 += abs(a[0])+1;
	}else{
		sum2 = -1;
		num2++;
	}
	for(int i=1; i<n; i++){
		int tmp = a[i];
		if(sum2 > 0 && sum2+tmp>=0){
			num2 += sum2+tmp+1;
			tmp -= sum2+tmp+1;
		}
		else if(sum2 < 0 && sum2+tmp<=0){
			num2 += abs(sum2+tmp)+1;
			tmp += abs(sum2+tmp)+1;
		}
		sum2+=tmp;
	}
	cout << min(num1, num2) << endl;
	return 0;
}

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

using namespace std;

int main() {
    int a, b, d, r;
    
    double f;
    
    cin>> a >> b;
    
    d = a / b;
    
    r = a % b;
    
    f = (double) a / b;
    
    cout<< d << " " << r << " " << fixed << setprecision(5) << f << endl;
}


Measured memory_bytes: 3260
#include <bits/stdc++.h>
 
using namespace std;
 
#define xx         first
#define yy         second
#define pb         push_back
#define mp         make_pair
#define LL         long long
#define inf        INT_MAX/3
#define mod        1000000007ll
#define PI         acos(-1.0)
#define linf       (1ll<<60)-1
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define REP(I,N)   FOR(I,0,N)
#define For(I,N)   for(int I=1;I<=(N);I++)
#define ALL(A)     ((A).begin(), (A).end())
#define set0(ar)   memset(ar,0,sizeof ar)
#define vsort(v)   sort(v.begin(),v.end())
#define setinf(ar) memset(ar,126,sizeof ar)
#define SZ(X) ((int)(X.size()))
#define LG(X) ((int)(X.length()))
#define CL(X) (X).clear()
#define MAXEL(A,B) (*max_element(A,B))
#define MINEL(A,B) (*min_element(A,B))
#define ROPEN(X) freopen(X,"r",stdin)
#define WOPEN(X) freopen(X,"w",stdout)
#define BG(X) (X.begin())
#define EN(X) (X.end())
#define VI vector<int>
#define PII pair<int,int>
 
//cout << fixed << setprecision(20) << p << endl;
 
template <class T> inline T bigmod(T p,T e,T M){
    LL ret = 1;
    for(; e > 0; e >>= 1){
        if(e & 1) ret = (ret * p) % M;
        p = (p * p) % M;
    } return (T)ret;
}
template <class T> inline T gcd(T a,T b){if(b==0)return a;return gcd(b,a%b);}
template <class T> inline T modinverse(T a,T M){return bigmod(a,M-2,M);}


int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	int n;
	cin>>n;
	set<char>st;
	for(int i=1;i<=n;i++){
		char c;
		cin>>c;
		st.insert(c);
	}
	int ans=0;
	for(char c='A';c<='Z';c++){
		if(st.count(c))ans++;
	}
	if(ans==4)cout<<"Four"<<endl;
	else cout<<"Three"<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int dp[10002][102][2];
int mod=1000000007;
int d;
int get(vector<int>& v,int i,int f,int sum)
{
   if(i==v.size())
   {
     if(sum%d==0)
     return 1;
     else
       return 0;
     
   }
  int& ans=dp[i][sum][f];
  if(dp[i][sum][f]!=-1) return ans;
  ans=0;
  
   int l=(f)? v[i]:9;
    for(int k=0;k<=l;k++)
    {
      int f1=f & (k==l);
      
      ans=((long long)ans+get(v,i+1,f1,(sum+k)%d))%mod;
     
    }
  
    return ans;
  
  
  
}
 
 
int main()
{
  string n;
  cin>>n>>d;
  vector<int> v;
  int i=0;
  while(i<n.size())
  {
    v.push_back(n[i]-'0');
    i++;
   // cout<<v.back()<<" ";
  }
  //reverse(v.begin(),v.end());
  memset(dp,-1,sizeof(dp));
  
  int ans=get(v,0,1,0);
  cout<<((ans-1+mod)%mod); 
  
  
  
  
  
}

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

int main() {
	int a[3];
	cin >> a[0] >> a[1] >> a[2];
	int cnt5 = 0, cnt7 = 0;
	for (int i = 0; i < 3; i++) {
		if (a[i] == 5) cnt5++;
		else if (a[i] == 7) cnt7++;
	}
	if (cnt5 == 2 && cnt7 == 1) cout << "YES" << endl;
	else cout << "NO" << endl;
}

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


void solve(long long N, long long X, std::vector<long long> m){

  cout << (N + ((X-accumulate(m.begin(), m.end(), 0ll))/(*min_element(m.begin(), m.end())))) << endl;
}

// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
  scanf("%lld",&N);
  long long X;
  scanf("%lld",&X);
  std::vector<long long> m(N);
  for(int i = 0 ; i < N ; i++){
    scanf("%lld",&m[i]);
  }
    solve(N, X, std::move(m));
    return 0;
}


Measured memory_bytes: 3700
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using namespace std;
//using ll=long long;
#define int long long
#define _CRT_SECURE_NO_WARNINGS
#define rep(i, n) for (int i = 0; i < n; i++)
#define _GLIBCXX_DEBUG
const int MOD = 1e9 + 7;
const int INF = 1e18 + 9;
constexpr long double pi = 3.141592653589793238462643383279; //円周率
/*---------------------便利な関数--------------------------------------*/
int fact(int i) {       //階乗
    if (i == 0) return 1;
    return (fact(i - 1)) * i;
}
 
int gcd(int a, int b) {        //最大公約数
    if (b == 0) return a;
    return gcd(b, a % b);
}
 
int lcm(int a, int b) {      //最小公倍数
    return a * b / gcd(a, b);
}
 
int keta(int n) {        //桁数を求める
    if (n == 0) return 1;
    int count = 0;
    while (n != 0) {
        n /= 10;
        count++;
    }
    return count;
}
 
int ketasum(int n) {    //各桁の和
    int sum = 0;
    while (n != 0) {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}
//最小化問題(DP)
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
//最大化問題(DP)
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

//dp注意点
//問題の種類	 初期化する値	 備考
//最小化問題 	INF	
//最大化問題	    -INF	 テーブル全体で 00 以上の値しかとらないことがわかっていれば −1−1 でもいいですし、00 でもいい場合もあります
//数え上げ問題	00	
//確率問題	      00	
//Yes/No 判定問題	False
/*-------------ここまで---------------------------------------------*/
 
signed main(){
  int n,m;
  cin>>n>>m;
  if(n==m) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  return 0;
}

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

int main(){
  int N; cin >> N;
  vector<double> v(N);
  for(int i=0;i<N;i++){
    cin >> v.at(i);
  }
  sort(v.begin(),v.end());
  for(int i=0;i<N-1;i++){
    v.at(i+1) = (v.at(i) + v.at(i+1))/2;
  }
  cout << v.at(N-1) << endl;
}


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

int main() {
    string s1, s2, s3;
    cin >> s1 >> s2 >> s3;

    int ascii = 'A' - 'a';
    char S1 = s1.front() + ascii;
    char S2 = s2.front() + ascii;
    char S3 = s3.front() + ascii;

    cout << S1 << S2 << S3 << endl;
}

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

int main() {

    int q;

    cin >> q;

    while(q--) {

        int c, a, n;

        cin >> c >> a >> n;

        int ans = 0;

        int minnum;

        minnum = min(c,min(a,n));

        ans += minnum;

        c -= minnum; a -= minnum; n -= minnum;

        minnum = min(c/2,a);

        ans += minnum;

        c -= minnum*2; a-=minnum;

        ans += c/3;

        cout << ans << endl;

    }


    return 0;
}

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

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

using namespace std;

template <class T, class U> void amax(T& x, U y) {if (x < y) x = y;}

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

    string S;
    cin >> S;

    int N = S.size();

    vector<vector<int>> dp(N + 1, vector<int>(2, -100));
    dp[0][0] = 0;
    dp[0][1] = 0;
    FOR(i, 1, N + 1) {
        FOR(c, 1, 2 + 1) {
            if (i - c < 0) continue;
            string T = S.substr(i - c, c);
            FOR(c0, 1, 2 + 1) {
                int i0 = max(i - c - c0, 0);
                string T0 = S.substr(i0, min(c0, i - c));
                if (T != T0) {
                    amax(dp[i][c - 1], dp[i - c][c0 - 1] + 1);
                }
            }
        }
    }

    int result = max(dp[N][0], dp[N][1]);

    cout << result << endl;

    return 0;
}


Measured memory_bytes: 14440