akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <queue>
#include <utility>
#include <map>
#include <bitset>
#include <numeric>
#define ll long long
using namespace std;
using p = pair<ll, ll>;
ll dx[8]={ 0, 1, 0,-1, 1, 1,-1,-1}; // x軸方向への変位
ll dy[8]={ 1, 0,-1, 0, 1,-1, 1,-1}; // y軸方向への変位
vector<ll> ans;
void func(ll n){
    //cout << n << endl;
    ans.push_back(n);
    if(n<=1e+10)
    func(n*10+n%10);
    if(n%10!=0){
        ans.push_back(n-1);
         if(n<=1e+10)
        func((n-1)*10+(n-1)%10);
    }
    if(n%10!=9){
        ans.push_back(n+1);
         if(n<=1e+10)
        func((n+1)*10+(n+1)%10);
    }

}

int main(void) {
    ll k;
    cin >> k;
    for(ll i = 1; i < 10; i++){
        func(i*10+i);
        ans.push_back(i);
    }
    sort(ans.begin(), ans.end());
    cout << ans[k-1] << endl;
  //  for(ll i = 0; i < 50; i++)
    //    cout << i << " " << ans[i] << endl;
    return 0;
}


Measured memory_bytes: 10604
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
const int Maxn=1e5;
char s[Maxn+5];
int cntg,cntp;
int main() {
	#ifdef LOACL
	freopen("in.txt","r",stdin);
	freopen("out.txt","w",stdout);
	#endif
	scanf("%s",s);
	int ans=0;
	int len=strlen(s);
	for(int i=0;i<len;i++) {
		if(s[i]=='g') {
			if(cntg>cntp) {
				cntp++;
				ans++;
			} else {
				cntg++;
			}
		} else {
			if(cntg>cntp) {
				cntp++;
			} else {
				cntg++;
				ans--;
			}
		}
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <array>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <sstream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <list>
#include <numeric>
#include <stack>
#include <iomanip>
#include <random>
#include <complex>
#include <functional>
#include <tuple>

using namespace std;

#define Rep(i,a,b) for(ll i = a; i < b; ++i)
#define rep(i,b) Rep(i,0,b)
#define allof(a) (a).begin(), (a).end()

#define Yes(q) ((q) ? "Yes" : "No")
#define YES(q) ((q) ? "YES" : "NO")
#define Possible(q) ((q) ? "Possible" : "Impossible")
#define POSSIBLE(q) ((q) ? "POSSIBLE" : "IMPOSSIBLE")

using ll = long long;

constexpr int inf = 1e9 + 7;
constexpr ll infll = 1ll << 60ll;
constexpr ll mod = 1e9 + 7;
// 0~3までは右左下上 4~7までは斜め
constexpr int dx[] = { 1, 0, -1, 0, 1, 1, -1, -1 };
constexpr int dy[] = { 0, -1, 0, 1, 1, -1, -1, 1 };

namespace {
    template<typename T> void chmax(T& a, T b) { a = std::max(a, b); }
    template<typename T> void chmin(T& a, T b) { a = std::min(a, b); }
    template<typename T> void chadd(T& a, T b) { a = a + b; }

    void Cout(long long x, const char* end = "\n") { std::cout << x << end; }
    template <typename T> void Cout(const T& x, const char* end = "\n") { std::cout << x << end; }
    template <typename T> void Cout(const std::vector<T>& x, const char* sep = " ", const char* end = "\n") { for (std::size_t i = 0, sz = x.size(); i < sz; i++) { std::cout << x[i] << (i == sz - 1 ? end : sep); } }

    // 標準入出力
    struct inp {
        std::size_t sz;
        inp(std::size_t _sz = 1) : sz(_sz) {}
        template <typename T> operator T () const { T a; std::cin >> a; return a; }
        template <typename T> operator std::vector<T>() const { std::vector<T> a(sz); for (std::size_t i = 0; i < sz; i++) std::cin >> a[i]; return a; }
    };

    // 2次元用の標準入出力
    template<typename T>
    struct inpn {
        std::size_t szi, szj;
        inpn(std::size_t _szi, std::size_t _szj) : szi(_szi), szj(_szj) {}
        operator std::vector<std::vector<T>>() const {
            std::vector<std::vector<T>> a(szi, std::vector<T>(szj));
            for (std::size_t i = 0; i < szi; ++i)
                for (std::size_t j = 0; j < szj; ++j) cin >> a[i][j];
            return a;
        }
    };

    inp inp1; // input one
}

int main() {

    int a, b, c, d;
    cin >> a >> b >> c >> d;

    int cnt = c / b;
    if (c % b != 0) ++cnt;

    int cnt2 = a / d;
    if (a % d != 0) ++cnt2;

    if (cnt <= cnt2) {
        Cout("Yes");
    }
    else {
        Cout("No");
    }

    return 0;
}

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

int max(int *array, int array_size)
{
    int array_max = 0,index=0;
    array_max = array[0];


    for (int i = 1; i < array_size; i++)
    {
        if (array_max <= array[i])
        {
            array_max = array[i];
            index = i;
        }
    }

    array[index] = 0;
    return array_max;
}

int main()
{
    int N, dig, sum = 0, res = 0;
    int array[110];
    for (int i = 0; i < 110; i++)
        array[i] = 0;
    int max_array;
    int alice = 0, bob = 0;
    cin >> N;
    for (int i = 0; i < N; i++)
    {
        cin >> array[i];
    }

    for (int i = 1; i <= N;i++){
        if(i % 2!=0){
           max_array = max(array, N);
         
           alice = alice + max_array;
        }else{
            max_array = max(array, N);
        
            bob = bob + max_array;
        }
    }

    res = alice - bob;

    cout << res << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

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

	int block[N];

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

	int sum = 0;
	int num = 1;

	for(int i = 0; i < N; i++){
		if(block[i] == num){
			sum++;
			num++;
		}else{
			continue;
		}
	}

	if(sum == 0){
		cout << -1 << endl;
	}else{
		cout << N - sum << endl;
	}

	return 0;
}

Measured memory_bytes: 1024
import math
from decimal import Decimal
a, b, H, M = map(Decimal, input().split())

H = (H/Decimal(12) + M/Decimal(720))*Decimal(math.pi)*Decimal(2)
M = (M/Decimal(60))*Decimal(math.pi)*Decimal(2)
c = a**Decimal(2)+b**Decimal(2)-a*b*Decimal(2)*Decimal(math.cos(H-M))
print(math.sqrt(c))

Measured memory_bytes: 10396
#include <bits/stdc++.h>
#define IO_OP std::ios::sync_with_stdio(0); std::cin.tie(0);
#define F first
#define S second
#define V vector
#define PB push_back
#define MP make_pair
#define EB emplace_back
#define ALL(v) (v).begin(), (v).end()
#define debug(x) cerr << #x << " is " << x << endl

using namespace std;

typedef long long ll;
typedef pair<int, int> pi;
typedef V<int> vi;

const int INF = 1e9 + 7;

signed main()
{
	IO_OP;
	
	long double a, b, c;
	cin >> a >> b >> c;
	cout << ((c - (a+b)) >= 0 && 4 * (a * b) < (c - (a+b)) * (c - (a+b)) ? "Yes" : "No") << endl;

}





Measured memory_bytes: 256
#[allow(dead_code)]
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}
#[allow(dead_code)]
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}
#[allow(dead_code)]
fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}
#[allow(dead_code)]
fn yn(result: bool) {
    if result {
        println!("War");
    } else {
        println!("No War");
    }
}

fn main() {
    let v = read_vec::<i32>();
    let x = v[2];
    let y = v[3];

    let mut xs = read_vec::<i32>();
    xs.push(x);
    let mut ys = read_vec::<i32>();
    ys.push(y);
    let xmax = xs.iter().max().unwrap();
    let ymin = ys.iter().min().unwrap();
    yn(!(xmax < ymin))
}


Measured memory_bytes: 4352
#include <stdio.h>
#define X 100
int main(){
  int flag = 1;
  int i=0;
  int j,n,sum=0,temp;
  int A[X];

  scanf("%d",&n);

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

  while(flag){
    flag = 0;
    for(j=n-1; j>=1; j--){
      if(A[j]<A[j-1]){
	temp = A[j];
	A[j] = A[j-1];
	A[j-1] = temp;
	flag =1;
	sum++;
      }
      i++;    
    }
  }

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

  printf("\n");

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

Measured memory_bytes: 604
import std.stdio;
import std.string;
import std.conv;
import std.algorithm;

void main() {
	string[] inputs = split(readln());
	int a = to!int(inputs[0]);
	int b = to!int(inputs[1]);
	int c = to!int(inputs[2]);
	bool[int] flags;
	flags[a] = true;
	flags[b] = true;
	flags[c] = true;
	flags.length.writeln;
}


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

int main() {
  int N, Q;
  cin >> N >> Q;
  vector<vector<int>> Ki(N);
  for (int i = 0; i < N - 1; i++) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    Ki.at(a).push_back(b);
    Ki.at(b).push_back(a);
  }
  vector<int> S(N);
  for (int i = 0; i < Q; i++) {
    int p, x;
    cin >> p >> x;
    p--;
    S.at(p) += x;
  }
  vector<bool> check(N, false);
  queue<int> BFS;
  check.at(0) = true;
  for (int i = 0; i < Ki.at(0).size(); i++) {
    S.at(Ki.at(0).at(i)) += S.at(0);
    BFS.push(Ki.at(0).at(i));
  }
  while (!(BFS.empty())) {
    int X = BFS.front();
    BFS.pop();
    check.at(X) = true;
    for (int i = 0; i < Ki.at(X).size(); i++) {
      if (!(check.at(Ki.at(X).at(i)))) {
        S.at(Ki.at(X).at(i)) += S.at(X);
        BFS.push(Ki.at(X).at(i));
      }
    }
  }
  for (int i = 0; i < N; i++) {
    cout << S.at(i) << " ";
  }
  cout << endl;
}

Measured memory_bytes: 15604
#include<bits/stdc++.h>
using namespace std;
int ar[105];
int main()
{
    int a,b[5],k=0;
    for(int i=0;i<3;i++)
    {
        cin>>a;
        if(ar[a]==0)
        {
            ar[a]=1;
            b[k]=a;
            k++;
        }
    }
    cout<<k<<endl;
}



Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>

using namespace std;

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

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(b<a){a=b;return 1;}return 0;}

signed main() {
    capi(x);

    if ( x>= 30) {
        cout << "Yes";
    } else {
        cout << "No";
    }

    return 0;
}

Measured memory_bytes: 3048
import java.util.Scanner;

public class Main {

	static int[] f = { 0, 0, 0, 0, 0, 0, 1, 1, 1, 2 };
	static int[] s = { 1, 1, 1, 2, 2, 3, 2, 2, 3, 3 };
	static int[] t = { 2, 3, 4, 3, 4, 4, 3, 4, 4, 4 };

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int N = in.nextInt();
		long[] count = new long[5];
		for (int i = 0; i < N; i++) {
			String S = in.next();
			if (S.charAt(0) == 'M') {
				count[0]++;
			}
			if (S.charAt(0) == 'A') {
				count[1]++;
			}
			if (S.charAt(0) == 'R') {
				count[2]++;
			}
			if (S.charAt(0) == 'C') {
				count[3]++;
			}
			if (S.charAt(0) == 'H') {
				count[4]++;
			}
		}
		long ans = 0;
		for (int i = 0; i < 10; i++) {
			ans += count[f[i]] * count[s[i]] * count[t[i]];
		}
		System.out.println(ans);
		in.close();
	}
}

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

int main()
{
	string s1;
	cin >> s1;
	int slen;
	slen=s1.length();
	int a,b,q,i,flag=1;
	string s2;
	cin >> q;
	for(i=1;i<=q;i++)
	{
		cin >> a;
		if(a==1)
		{
			flag*=-1;
			//reverse(s1.begin(),s1.end());
		}
		if(a==2)
		{
			cin >> b;
			cin >> s2;
			if(b==1)
			{
				if(flag==1)
				{
					s1.insert(0,s2);
					slen++;
				}
				else
				{
					s1.insert(slen,s2);
					slen++;
				}
			}
			if(b==2)
			{
				if(flag==1)
				{
					s1.insert(slen,s2);
					slen++;
				}
				else
				{
					s1.insert(0,s2);
					slen++;
				}
			}
		}
	}
	if(flag==-1)
	{
		reverse(s1.begin(),s1.end());
	}
	cout << s1 << endl;
	return 0;
}

Measured memory_bytes: 1020
import java.io.BufferedInputStream
import java.io.InputStream
import java.util.StringTokenizer


fun solve(S: String){
    val year = S.slice(0..3)!!.toInt()
    val month = S.slice(5..6)!!.toInt()
    val day = S.slice(8..9)!!.toInt()
    val date = year * 10000 + month * 100 + day
    if (date <= 20190430){println("Heisei")}
    else {println("TBD")}
}

// Generated by 1.1.4 https://github".com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
fun main(args: Array<String>) {
    fun StringArray(size: Int, init: (Int) -> String = { "\u0000" }): Array<String> {
        return Array<String>(size, init)
    }
    class Scanner(stream: InputStream) {
        private val reader = BufferedInputStream(stream).bufferedReader()
        private var st: StringTokenizer? = null
        fun next(): String {
            while (!(st?.hasMoreTokens() ?: false)) st = StringTokenizer(reader.readLine())
            return st!!.nextToken()
        }
    }
    val sc = Scanner(System.`in`)
    val S = sc.next()
    solve(S)
}


Measured memory_bytes: 29708
import math

n = int(input())
s = [str(input()) for i in range(n)]
ac_cnt = 0
wa_cnt = 0
tle_cnt = 0
re_cnt = 0
for i in range(n) :
    if(s[i] == 'AC') :
        ac_cnt = ac_cnt + 1
    if(s[i] == 'WA') : 
        wa_cnt = wa_cnt + 1 
    if(s[i] == 'TLE') :  
        tle_cnt = tle_cnt+1
    if(s[i] == 'RE') :
        re_cnt = re_cnt+1
print('AC x', ac_cnt)
print('WA x' ,wa_cnt)
print('TLE x' ,tle_cnt)
print('RE x' ,re_cnt)

Measured memory_bytes: 16308
#include <bits/stdc++.h>
using namespace std;
int main () {
	int H,W;
	cin >> H >> W;
	string s[H];
	int result[H][W];
	bool b[H][W];
	for (int i = 0; i < H; ++i)
	{
		cin >> s[i];
	}

	for (int y = 0; y < H; ++y)
	{
		for (int x = 0; x < W; ++x)
		{
			result[y][x] = 0;
			b[y][x] = false;
			b[y][x] = (s[y][x] == '#');
		}
	}
	for (int y = 0; y < H; ++y)
	{
		for (int x = 0; x < W; ++x)
		{
			int bomb = 0;

			for (int dy = -1; dy < 2; ++dy)
			{
				for (int dx = -1; dx < 2; ++dx)
					{
						if((0 <= x + dx && x + dx < W)&&(0 <= y + dy && y + dy < H)){
							if(b[y + dy][x + dx]){
								bomb++;
							}
						}		
					}
			}
			result[y][x] = bomb;
		}
		
	}
	for (int y = 0; y < H; ++y)
	{
		for (int x = 0; x < W; ++x)
		{
			if(b[y][x]){
				cout << "#";
			}else{
				cout << result[y][x];
			}
		}
		cout << endl;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define ld long double
using namespace std;
int main() {
ll l,r;
cin>>l>>r;
ll ans = 1e18;
if ((l-1)/2019!=(r/2019)) {cout<<0;return 0;}
for (ll i = l;i<=r;i++)
    for (ll j = i + 1;j<=r;j++)
        ans = min(ans,(i*j)%2019);
    cout<<ans;return 0;}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
#define ll long long
#define MAX 5100000
const ll mod = 1000000007;
ll fac[MAX], finv[MAX], inv[MAX];

void COMinit(){
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for(int i=2;i<MAX;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;
    }
}
ll COM(int n, int k){
    if(n<k) return 0;
    if(n<0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n-k] % mod) % mod;
}

int main(){
  int x, y;
  scanf("%d%d",&x,&y);
  int a = 2*x-y, b = 2*y-x;
  if(a%3 || b%3)a=-3;
  a/=3;b/=3;
  COMinit();
  printf("%lld\n", COM(a+b,a));
  return 0;
}

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

using namespace std;

int res = 0;
int dist[21][21];
const int INF = 1e9;
int h,w;
int dy[4] = {-1,0,1,0};
int dx[4] = {0,1,0,-1};
char board[21][21];

void dijkstra(int sy,int sx)
{
	priority_queue <pair<int,pair<int,int>>,vector<pair<int,pair<int,int>>>,greater<pair<int,pair<int,int>>>> pque;
	for(int i=0;i<=h;i++)
	{
		for(int j=0;j<=w;j++)
		{
			dist[i][j] = INF;
		}
	}
	dist[sy][sx] = 0;
	pque.push(make_pair(dist[sy][sx],make_pair(sy,sx)));

	while(!pque.empty())
	{
		int y = pque.top().second.first;
		int x = pque.top().second.second;
		pque.pop();

		res = max(res,dist[y][x]);

		for(int k=0;k<4;k++)
		{
			int ny = y + dy[k];
			int nx = x + dx[k];
			if(ny<0 || ny>=h || nx<0 || nx>=w)
			{
				continue;
			}
			if(board[ny][nx]=='#')
			{
				continue;
			}
			if(dist[ny][nx] > dist[y][x] + 1)
			{
				dist[ny][nx] = dist[y][x] + 1;
				pque.push(make_pair(dist[ny][nx],make_pair(ny,nx)));
			}
		}
	}
}
int main(void)
{
	cin.tie(0);
	ios::sync_with_stdio(false);

	cin >> h >> w;

	for(int i=0;i<h;i++)
	{
		for(int j=0;j<w;j++)
		{
			cin >> board[i][j];
		}
	}

	for(int i=0;i<h;i++)
	{
		for(int j=0;j<w;j++)
		{
			if(board[i][j]=='.')
			{
				dijkstra(i,j);
			}
		}
	}

	cout << res << '\n';

	return 0;
}

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

using namespace std;

int main()
{
	vector<vector<int>> M(10, vector<int>(10));
	int n, m;
	cin >> n >> m;
	for (int i = 0; i < 10; i++) {
		for (int j = 0; j < 10; j++) {
			cin >> M[i][j];
		}
	}
	vector<vector<int>> V(n, vector<int>(m));
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < m; j++) {
			cin >> V[i][j];
		}
	}
	for(int k=0;k<10;k++)
		for (int i = 0; i<10; i++)
			for (int j = 0; j<10; j++)
					M[i][j] = min(M[i][j], M[i][k] + M[k][j]);
	int answer = 0;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < m; j++) {
			if (V[i][j] == -1) continue;
			answer += M[V[i][j]][1];
		}
	}
	cout << answer;
}

Measured memory_bytes: 384
#include <vector>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cmath>
using namespace std;

int main(){
	const int INF=1<<29;
	for(int n;scanf("%d",&n),n;){
		vector<pair<int,int> >v(n+1);
		vector<vector<int> >m(n+1);
		for(int i=0;i<=n;i++){
			if(i)scanf("%d%d",&v[i].first,&v[i].second);
			m[i].resize(4),fill(m[i].begin(),m[i].end(),INF);
		}
		int fail=0;
		m[0][0]=0;
		for(int i=0;i<n;i++)for(int j=0;j<4;j++)if(m[i][j]<INF){
			int dist=abs(v[i+1].first-v[i].first),dt=v[i+1].second-v[i].second;
			bool f,g;
			if(f = j<3&&dist*(j+1)<=dt)m[i+1][j+1]=min(m[i+1][j+1],m[i][j]+dist);
			if(g = v[i+1].first+v[i].first*(j+1)<=dt)m[i+1][1]=min(m[i+1][1],m[i][j]+v[i+1].first+v[i].first);
			if(!f&&!g)fail=max(fail,i+1);
		}
		int r=INF;
		for(int i=0;i<4;i++)r=min(r,m[n][i]+v[n].first);
		if(r==INF)printf("NG %d\n",fail);
		else printf("OK %d\n",r);
	}
}

Measured memory_bytes: 1036
#include <bits/stdc++.h>
#define eps 1e-6
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=(n-1);i!=-1;i--)
#define snc(a,b,c) ((a)?(b):(c))
#define YES cout<<"YES"<<endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl;
#define No cout<<"No"<<endl;
#define ins insert
#define pi acos(-1.0)
#define pb push_back
using namespace std;

char ban[8][9];
int h,w;

bool filled(vector<string> reached){
    rep(i,h){
        rep(j,w){
            if (reached[i].at(j)!=ban[i][j])
                return false;
        }
    }
    return true;
}

bool dfs(int x,int y,vector<string> reached){
    if (x>=w || y>=h || y<0 || x<0 || ban[y][x]=='.') return false;
    if (ban[y][x]=='#') reached[y].at(x)='#';
    if (x==w-1 && y==h-1){
        if (filled(reached))
            return true;
        else
            return false;
    }
    return (dfs(x+1,y,reached) || dfs(x,y+1,reached));
}
int main(){
    cin >> h >> w;
    rep(i,h) cin>>ban[i];
    vector<string> reached;
    reached.resize(h,"........");
    cout << ((dfs(0,0,reached))?"Possible":"Impossible") << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
    int main(void){
        int N, K;
            cin >> N >> K;
                int x = 1;
        for(int i = 0; i < N; i++){
            if(2*x < x + K){
                x = 2* x;
            }else{
                x = x + K;
            }
        }
            cout << x << endl;
    return 0;}


Measured memory_bytes: 256
#include <cstring>
#include <cmath>
#include <algorithm>
#include <string>
#include <map>
#include <iostream>
#include <vector>
#include <queue>
#include <unordered_map>
#include <random>
#include <stack>
#include <set>
#include <unordered_set>

#define bug(x) cout<<"zdongdebug1: "<<x<<endl;
#define bug2(x, y) cout<<"zdongdebug2: "<<x<<" "<<y<<endl;
#define bug3(x, y, z) cout<<"zdongdebug3: "<<x<<" "<<y<<" "<<z<<endl;
using namespace std;
typedef long long ll;
const int maxn = 100005;
const int mod = 1000000007;


int main() {
#ifdef suiyuan2009
  freopen("/Users/suiyuan2009/CLionProjects/icpc/input.txt", "r", stdin);
  //freopen("/Users/suiyuan2009/CLionProjects/icpc/output.txt", "w", stdout);
#endif
  int x,y;
  cin>>x>>y;
  for(int i=0;i<=x;i++){
    int tt = i * 4 + (x-i)*2;
    if(tt==y){
      cout<<"Yes"<<endl;
      return 0;
    }
  }
  cout<<"No"<<endl;
  return 0;
}

Measured memory_bytes: 3632
from collections import defaultdict

N = int(input())


def prime_factorization(N):
    PC = defaultdict(int)

    P = 2
    while N % P == 0:
        PC[P] += 1
        N //= P

    P = 3
    while P * P <= N:
        if N % P == 0:
            PC[P] += 1
            N //= P
        else:
            P += 2

    if N != 1:
        PC[N] += 1

    return PC


PC = prime_factorization(N)

ans = 0
for PI in PC.values():
    PIc = 1
    while PI >= PIc:
        ans += 1
        PI -= PIc
        PIc += 1

print(ans)


Measured memory_bytes: 9464
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;

namespace AtTest.TokioMarine_2020
{
    class A
    {
        static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(OpenStandardOutput()) { AutoFlush = false };
            SetOut(sw);

            Method(args);

            Out.Flush();
        }

        static void Method(string[] args)
        {
            string s = Read();
            WriteLine(s.Substring(0, 3));
        }

        private static string Read() { return ReadLine(); }
        private static char[] ReadChars() { return Array.ConvertAll(Read().Split(), a => a[0]); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}


Measured memory_bytes: 25892
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
int cmp(const void *a,const void *b){
    if(*(int*)a>*(int*)b){return 1;}
    else if(*(int*)a<*(int*)b){return -1;}
    else {return 0;}
}


long long int min(long long int a,long long int b){

    if(a>=b){return b;}
    return a;
}

int main(void){
int n,d[100005];
scanf("%d",&n);
for(int i=0;i<n;i++){
    scanf("%d",&d[i]);
} 

qsort(d,n,sizeof(int),cmp);



int yes=d[n/2]-d[n/2-1];
if(yes<=0){printf("0\n");}
else{printf("%d\n",yes);}


}


Measured memory_bytes: 892
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <math.h>
#include <cmath>
#include <limits.h>
#include <map>
#include <unordered_map>
#include <set>
#include <queue>
#include <algorithm>
#include <functional>
#include <stdio.h>
using namespace std;

long long MOD = 1000000007;

int main() {
    
    int N;
    cin >> N;
    vector<long long> A(N);
    for ( int i = 0; i < N; i++ ) {
        cin >> A[i];
    }
    long long ans = 0;
    for ( int i = 0; i < N; i++ ) {
        int a = 0;
        while ( A[i]%2 == 0 ) {
            A[i] /= 2;
            a++;
        }
        ans += a;
    }


    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0),cout.tie(0);
	const int mod=1e9+7;
	int h,w;
	cin>>h>>w;
	int dp[h+1][w+1];
	for(int i=0;i<=h;i++)
		dp[i][0]=0;
	for(int j=0;j<=w;j++)
		dp[0][j]=0;
	for(int i=1;i<=h;i++){
		for(int j=1;j<=w;j++){
			char ch;
			cin>>ch;
			if(ch!='#'){
				if(!(i-1)&&!(j-1))
					dp[i][j]=1;
				else
					dp[i][j]=(dp[i-1][j]+dp[i][j-1])%mod;
			}
			else
				dp[i][j]=0;
		}
	}
	dp[1][1]=0;
	cout<<dp[h][w];
}

Measured memory_bytes: 4224
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
#define PI       3.1415926535897932384626433832795028841971
#define INF 1000000000
#define EPS      1e-10
#define MOD      1000000
using namespace std;
typedef long long ll;
typedef pair<double,double> P;
typedef pair<double,P> PQ;

int m, n, N;
int p[10001];

int main(){
    while(cin >> m >> n >> N){
        if(n == 0 && N == 0 && m == 0) break;
        rep(i,m) cin >> p[i];
        sort(p,p+m,greater<int>());
        int ans = 0;
        int out = 0;
        for(int i = n-1; i < N; i++){
            if(ans <= p[i]-p[i+1]){
                ans = p[i]-p[i+1];
                out = i+1;
            }
        }
        cout << out << endl;
    }
}

Measured memory_bytes: 3072
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstring>
#include <cmath>
using namespace std;

typedef long long ll;

ll func(ll);
ll pow(ll, ll);

int main() {

  ll a, n, m, x, cnt = 0;

  cin >> a >> n >> m;

  for(int i=1; pow(i+a, n)<=m; ++i){

    x = pow(i+a, n);

    if(i==func(x)) {
      ++cnt;
    }
  }

  cout << cnt << endl;

  return 0;
}

ll pow(ll x, ll y) {

  ll t = 1;

  while(y--) {
    t *= x;
  }

  return t;
}

ll func(ll n) {

  ll t = 0;

  while(n!=0) {
    t += n%10;
    n /= 10;
  }

  return t;
}



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

typedef long long ll;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define each(itr,c) for(__typeof(c.begin()) itr=c.begin(); itr!=c.end(); ++itr)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second

int n;
int x[24],y[24],r[24],c[24];

inline bool intersect(int p, int q)
{
    double dist=sqrt((x[p]-x[q])*(x[p]-x[q])+(y[p]-y[q])*(y[p]-y[q]));
    return dist<(r[p]+r[q]);
}

unordered_map<int,int> dp;
// int dp[1<<24];
int dfs(int state)
{
    if(dp.find(state) != dp.end()) return dp[state];
    // if(dp[state]>=0) return dp[state];
    if(__builtin_popcount(state)<2) return 0;

    int ret=0;
    rep(i,n)
    {
        if(state>>i&1)
        {
            bool av=true;
            rep(j,i)
            {
                if(state>>j&1 && intersect(i,j))
                {
                    av=false;
                    break;
                }
            }

            if(!av) continue;

            rep(j,n)
            {
                if(i==j) continue;
                if(c[i]!=c[j]) continue;

                if(state>>j&1)
                {
                    bool av2=true;
                    rep(k,j)
                    {
                        if(state>>k&1 && intersect(j,k))
                        {
                            av2=false;
                            break;
                        }
                    }

                    if(!av2) continue;

                    ret = max(ret,dfs(state-(1<<i)-(1<<j))+2);
                }
            }
        }
    }

    return dp[state]=ret;
}

int main()
{
    while(cin >>n,n)
    {
        rep(i,n) scanf(" %d %d %d %d", &x[i], &y[i], &r[i], &c[i]);
        dp.clear();
        cout << dfs((1<<n)-1) << endl;
    }
    return 0;
}

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

int main() {
  
  int N,Y;
  cin >> N >> Y;
  int y=Y/1000;
  
  int s=0;
  for (int i=0; i<N+1; i++) {
    for (int j=0; j<N-i+1; j++) {
      for (int k=0; k<N-i-j+1; k++) {
        if (10*i+5*j+1*k==y && i+j+k==N) {
          s++;
          cout << i << " " << j << " " << k << endl;
          }
        if (s!=0) break;
      }
      if (s!=0) break;
    }
    if (s!=0) break;
  }
  
  if (s==0) cout << -1 << " " << -1 << " " << -1 << endl;
}

Measured memory_bytes: 256
//pragma
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")

#include <bits/stdc++.h>

#define YOU using
#define DONT namespace
#define SAY std

YOU DONT SAY;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ll,int> pli;
typedef pair<int,ll> pil;
typedef vector<int> vi;
typedef vector<pii> vii;
typedef vector<pll> vll;

#define REPP(i,a,b,d) for(int i=a;i<=b;i+=d)
#define REP(i,a,b) REPP(i,a,b,1)
#define REVV(i,a,b,d) for(int i=a;i>=b;i-=d)
#define REV(i,a,b) REVV(i,a,b,1)

#define FOR(i,a) for(int i=0; i<a; i++)
#define FORD(i,a) for(int i=(int)a-1; i>=0; i--)

#define pb push_back
#define F first
#define S second

const int OO = 1e9;
const ll INF = 1e18;

const int irand(int lo,int hi){
    return ((double)rand()/(RAND_MAX + 1.0)) * (hi-lo+1) + lo;
}

const ll lrand(ll lo,ll hi){
    return ((double)rand()/(RAND_MAX + 1.0)) * (hi-lo+1) + lo;
}

#define getc getchar
template<typename T>
T getnum(){
    int sign = 1;
    T ret = 0;
    char c;

    do{
        c = getc();
    }while(c == ' ' || c == '\n');
    if(c == '-')sign = -1;
    else ret = c-'0';
    while(1){
        c = getc();
        if(c < '0' || c > '9')break;
        ret = 10*ret + c-'0';
    }
    return sign * ret;
}

inline void ini(int& x){
    x = getnum<int>();
}

inline void scani(int& x){
    scanf("%d",&x);
}

//end of macro

const ll MOD = 998244353;
inline ll addmod(ll a, ll b){
    if(a+b<MOD)return a+b;
    return a+b-MOD;
}
inline ll mulmod(ll a, ll b){
    return (a*b)%MOD;
}
inline ll submod(ll a, ll b){
    return addmod(a, MOD-b);
}

const int N = 3005;

int a,b,c,d;

int dp[N][N][3]; // 0 white, 1 black, 2 sum

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    #define endl '\n'
    cout.setf(ios::fixed);
    cout.setf(ios::showpoint);
    cout.precision(10);

    cin>>a>>b>>c>>d;

    dp[a][b][0] = 1;
    dp[a][b][2] = 1;
    REP(i,a,c){
        REP(j,b,d){
            if(i == a && j == b)continue;
            
            dp[i][j][1] = addmod(dp[i-1][j][2], dp[i][j-1][2]);
            
            dp[i][j][0] = addmod(mulmod(dp[i-1][j][2], j-1), mulmod(dp[i][j-1][2], i-1));
            dp[i][j][0] = submod(dp[i][j][0], mulmod(dp[i-1][j-1][2], mulmod(i-1, j-1)));

            dp[i][j][2] = addmod(dp[i][j][0], dp[i][j][1]);

            // printf("%d %d--------\n",i,j);
            // printf("0 %d\n",dp[i][j][0]);
            // printf("1 %d\n",dp[i][j][1]);
        }
    }

    cout << dp[c][d][2] << endl;

    return 0;
}


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

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	
	#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	#endif

	int a, b;
	cin >> a >> b;
	int n = 1;
	int cnt = 0;
	while(n < b) {
		cnt += 1;
		n = (n - 1 + a);
	}
	cout << cnt;
	return 0;
}

Measured memory_bytes: 3644
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <utility>
#include <map>

#include <stdio.h>

#define rep(i, n) for (int i = 0; i < (n); i++)
#define irep(i, k, n) for (int i = (k); i < (n); i++)
#define rrep(i, k, n) for (int i = (k); i >= (n); i++)
#define pb push_back
#define eb emplace_back
#define vec vector

typedef long long ll;

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

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

template<class T> T gcd(T m, T n) {
  if (n == 0) return m;
  return gcd(n, m % n);
}

template<class T> T lcm(T m, T n) {
  return m * n / gcd(m, n);
}

const ll inf = 1LL << 60;
const ll mod = 1e9 + 7;

using namespace std;

/* Input variables. */
int w, h, x, y;

/* Solve! */
void solve() {
  cout << double(w) * double(h) / 2.0 << " " << (w == x * 2 && h == y * 2) << endl;
}

int main() {
  /* Input handling. */
  cin >> w >> h >> x >> y;

  solve();
  return 0;
}

Measured memory_bytes: 888
#include<cstdio>
#include<map>
using namespace std;
#define N 500200
#define mod1 1000000009
#define mod2 1000000007
#define ch1 131
#define ch2 233
map<long long,int> tp;
int pw1[N],pw2[N],n,su[N],vl[N],ha1[N],ha2[N],as1,as2;
long long as;
char s[N];
int pw(int a,int p,int mod){int as=1;while(p){if(p&1)as=1ll*as*a%mod;a=1ll*a*a%mod;p>>=1;}return as;}
int main()
{
	scanf("%d%s",&n,s+1);
	su[0]=n;
	pw1[0]=pw2[0]=1;
	for(int i=1;i<=n*2;i++)pw1[i]=1ll*pw1[i-1]*ch1%mod1,pw2[i]=1ll*pw2[i-1]*ch2%mod2;
	for(int i=1;i<=n;i++)
	{
		su[i]=su[i-1];
		if(s[i]=='<')su[i]--;
		if(s[i]=='>')su[i]++;
		if(s[i]=='+')as1=(as1+pw1[su[i]])%mod1,as2=(as2+pw2[su[i]])%mod2;
		if(s[i]=='-')as1=(as1-pw1[su[i]]+mod1)%mod1,as2=(as2-pw2[su[i]]+mod2)%mod2;
	}
	for(int i=n;i>=1;i--)ha1[i]=(ha1[i+1]+mod1+(s[i]=='+'?1ll:(s[i]=='-'?-1ll:0))*pw1[su[i]])%mod1,ha2[i]=(ha2[i+1]+mod2+(s[i]=='+'?1ll:(s[i]=='-'?-1ll:0))*pw2[su[i]])%mod2;
	tp[0]=1;
	for(int i=n;i>=1;i--)
	{
		int nas1,nas2;
		if(su[i-1]>=su[0])nas1=1ll*as1*pw1[su[i-1]-su[0]]%mod1,nas2=1ll*as2*pw2[su[i-1]-su[0]]%mod2;
		else nas1=1ll*as1*pw(pw(ch1,mod1-2,mod1),su[0]-su[i-1],mod1)%mod1,nas2=1ll*as2*pw(pw(ch2,mod2-2,mod2),su[0]-su[i-1],mod2)%mod2;
		nas1=(ha1[i]-nas1+mod1)%mod1,nas2=(ha2[i]-nas2+mod2)%mod2;
		as+=tp[nas1*10000000000ll+nas2];
		tp[ha1[i]*10000000000ll+ha2[i]]++;
	}
	printf("%lld\n",as);
}

Measured memory_bytes: 40832
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <queue>
#include <algorithm>
#include<iostream>
#include<vector>
#include<map>
#include<string>
#include <iomanip>
#include<deque>
#include<stack>
#include<set>
#include <numeric>

using namespace std;
typedef unsigned int uint;
typedef long long ll;
//typedef pair<int, int> P;
const int INF = 1e9 + 1;
const ll LLINF = 1e17 + 1;
const int DX[9] = { 0,0,1,-1, 1, 1, -1, -1, 0 }; // 4;４近傍
const int DY[9] = { 1,-1,0,0, 1, -1, 1, -1, 0 }; // 8:８近傍 9:(0,0)を含む
const int MOD = 1e9 + 7; //10^9 + 7
const double PI = 3.14159265358979323846264338327950288;




int main() {

	//==================================
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	//==================================

	int N;
	cin >> N;
	vector<string> S(N);
	for (int i = 0; i < N; i++) {
		cin >> S[i];
	}

	vector<vector<int>> alp(N);
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < 26; j++) {
			alp[i].emplace_back(0);
		}
	}


	int base = 'a';
	for (int i = 0; i < N; i++) {

		for (int j = 0; j < S[i].size(); j++) {
			alp[i][S[i][j] - base]++;
		}
	}

	vector<char> ans;
	for (int i = 0; i < 26; i++) {

		int times = INF;
		for (int j = 0; j < N; j++){
			times = min(times, alp[j][i]);
		}

		for (int j = 0; j < times; j++) {
			ans.emplace_back(char(base + i));
		}

	}

	for (int i = 0; i < ans.size(); i++) {
		cout << ans[i];
	}


}	




Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
  int a,b;
  cin>>a>>b;
  cout<<max({2*a-1,2*b-1, a+b})<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <algorithm>
using namespace std;
int main() {
	string s;
	int n, a, b;
	std::cin >> a >> b;
	string ans;
	
	if((a*b)%2){
	    ans = "Odd";
	}else{
	    ans = "Even";
	}
	
	std::cout << ans << std::endl;
	return 0;
}

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

int main() {
  int N;
  cin >> N;
  vector<int> V(N - 1);
  for (int i = 0; i < N - 1; i++)
    cin >> V.at(i);
 
  vector<int> ans(N,0);
  for (int j = 0; j < N - 1; j++) 
    ans.at(V.at(j) - 1)++;
  for (int k = 0; k < N; k++)
    cout << ans.at(k) << endl;
    
    
}

Measured memory_bytes: 4848
import java.util.*;
import java.io.*;
 
class Main {
    public static void main(String[] args) throws IOException{
        Scanner br = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
 
        int[] alp = new int[26];
 
        while (br.hasNext()) {
            String line = br.nextLine();
            line = line.toLowerCase();
            char[] c = line.toCharArray();
            for (int i=0; i<c.length; i++) {
                if (c[i] >= 'a' && c[i] <= 'z')
                    alp[c[i]-'a']++;
            }
        }
 
        for (int i=0; i<26; i++) {
            System.out.println((char)('a'+i)+" : "+alp[i]);
        }
 
        br.close();
    }
}

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

int main()
{
	int n;
	cin >> n;
	n--;
	int h;
	cin >> h;
	int max = h;
	int cnt = 1;
	while (n--) {
		cin >> h;
		if (h >= max) {
			cnt++;
			max = h;
		}
	}
	cout << cnt << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#define MAX 100000
int main(){
  int A[MAX],H,i;
  scanf("%d",&H);
  for(i=1;i<=H;i++){
    scanf("%d",&A[i]);
  }
  for(i=1;i<=H;i++){
    printf("node %d: key = %d, ",i,A[i]);
    if(i/2>=1)printf("parent key = %d, ",A[i/2]);
    if(2*i<=H)printf("left key = %d, ",A[2*i]);
    if(2*i+1<=H)printf("right key = %d, ",A[2*i+1]);
    printf("\n");
  }
  return 0;
}



Measured memory_bytes: 2112
#include<stdio.h>
#define min(a,b) a<b ? a:b
#define max(a,b) a>b ? a:b
int main()
{
    int a, b,c,m;
    while(scanf("%d %d %d", &a,&b, &c)!=EOF)
    {
        m = min(a,(min(b,c)));
        if(m == a)
            printf("%d %d %d\n", a, min(b,c),max(b,c));
        else if(m == b)
            printf("%d %d %d\n", b, min(a,c),max(a,c));
        else
            printf("%d %d %d\n", c, min(a,b),max(a,b));
    }
    return 0;
}


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

using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define PRINT(item) cout << (item) << endl;
#define PRINT_VEC(V) \
    for (auto v : (V)) cout << v << ' ';
#define PRINT_ENTER() cout << endl;

int main() {
    /* code */
    int a, b, c, x;
    cin >> a >> b >> c >> x;
    int ans{};
    REP(ai, a + 1) {
        REP(bi, b + 1) {
            REP(ci, c + 1) {
                int total = ai * 500 + bi * 100 + ci * 50;
                if (total == x) ans++;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

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

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

  unordered_map<string, int> freq;

  rep(i, n) {
    string s;
    cin >> s;
    freq[s]++;
  }

  cout << "AC x ";
  cout << freq["AC"] << endl;
  cout << "WA x ";
  cout << freq["WA"] << endl;
  cout << "TLE x ";
  cout << freq["TLE"] << endl;
  cout << "RE x ";
  cout << freq["RE"] << endl;

  return 0;
}


Measured memory_bytes: 3624
package main

import (
	"fmt"
	"sort"
)

func main() {
	var in = make([]int, 3)
	fmt.Scanf("%d %d %d", &in[0], &in[1], &in[2])

	sort.Ints(in)

	var r = true
	for i := 0; i < len(in); i++ {
		if i == len(in)-1 {
			if in[i] != 7 {
				r = false
			}
			break
		}
		if in[i] != 5 {
			r = false
			break
		}
	}

	if r {
		fmt.Print("YES")
		return
	}
	fmt.Print("NO")
}

Measured memory_bytes: 1836
A, B = map(int, input().split())
S = input()

checkset = [str(x) for x in range(10)]

def main():
    SA = S[:A]; SB = S[A+1:]
    for i in SA:
        if i not in checkset:
            print('No')
            return

    if S[A] != '-':
        print('No')
        return

    for i in SB:
        if i not in checkset:
            print('No')
            return

    print('Yes')

if __name__ == "__main__":
    main()


Measured memory_bytes: 3060
alphabet = 'a b c d e f g h i j k l m n o p q r s t u v w x y z'
alpList = list(map(str, alphabet.split()))
countList = [0] * 26
message = ''

while True:
    try:
        message += str(input()).lower()
    except:
        break
        
for i in range(len(message)):
    for j in alpList:
        if message[i] == j:
            countList[alpList.index(j)] += 1

for i in alpList:
    print(i + ' : ', end = '')
    print(countList[alpList.index(i)])


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

int main(){
    long result=0;
    long N,K;
    cin >> N >> K;
    long h[N];
    for(int i=0;i<N;i++){
        cin >> h[i];
    }
    sort(h,h+N);
    for(int i=0;i<N-K+1;i++){
        if(i==0 || h[K+i-1]-h[i]<result){
            result = h[K+i-1]-h[i];
        }
    }
    cout << result << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, ans = 0;
  cin >> n;
  int a[n];
  for (int i = 0; i < n; i++)
    cin >> a[i];
  sort(a, a + n);
  bool b[a[n - 1] + 1];
  for (int i = 0; i < a[n - 1] + 1; i++)
    b[i] = true;

  for (int i = 0; i < n; i++) {
    if (b[a[i]] == true) {
      for (int j = 1; j < a[n - 1] / a[i] + 1; j++)
        b[j * a[i]] = false;
      if (i != n - 1)
        if (a[i] != a[i + 1])
          ans++;
      if (i == n - 1)
        ans++;
    }
  }
  cout << ans;
  return 0;
}


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

using namespace std;

#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a, 0, sizeof a)
#define minus(a) memset(a, -1, sizeof a)
#define watch(a) { std::cout << #a << " = " << a << "\n"; }
template<class T1, class T2> inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); }
template<class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); }
template<class T, class V> istream& operator>> (istream& ist, pair<T, V>& p) { return ist >> p.first >> p.second; }
template<class T> ostream& operator<< (ostream& ost, pair<T, T>& p) { return ost << p.first << ", " << p.second; }
template<class T> istream& operator>> (istream& ist, vector<T>& vs) { for(auto& e: vs) ist >> e; return ist; }

typedef long long ll;

int const inf = INT_MAX / 2;

// Verified: https://atcoder.jp/contests/arc026/tasks/arc026_2
template<class T> vector<T> divisors(T x) {
  if (x <= 1) return {};
  vector<T> ret;
  int p = 1;
  while((ll)p * p <= x) {
    if(x % p == 0) {
      if (p > 1) ret.push_back(p);
      if (p != x/p) {
        ret.push_back(x/p);
      }
    }
    p ++;
  }
  return ret;
}

int main() {
  ll N; cin >> N;
  // N / K をしない場合；
  // N = 1 + q * K = 1 (mod K)
  // => K: N - 1 の約数の個数
  auto ans = divisors(N - 1).size();

  // N / K をする場合；
  // N の各約数について、Kの条件を満たすか
  for (auto K: divisors(N)) {
    auto n = N;
    while(n % K == 0) n /= K;
    ans += n % K == 1;
  }

  cout << ans << endl;
}


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

int h,m,s;

int main(int argc, const char * argv[]) {
    int S;
    cin >> S;
    
    h = S / 3600;
    S = S - h * 3600;
    m = S / 60;
    s = S % 60;
    
    cout << h << ":" << m << ":" << s << endl;
    
    return 0;
}



Measured memory_bytes: 3092
N = int(input())

MOD_CONST = 10 ** 9 + 7

if N <= 2:
    print(0)
    exit()

res = [1] * N
res[0] = res[1] = 0

for i in range(5, N):
    res[i] = res[i - 4] + res[i - 3] + res[i - 2]

print(res[N-1] % MOD_CONST)



Measured memory_bytes: 9196
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<math.h>
#include<queue>
#include<deque>
#include<stack>
#include<cstdio>
#include<utility>
#include<set>
#include<list>
#include<cmath>
#include<stdio.h>
#include<string.h>
#include<cstdio>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using piii = pair<pii, pii>;
const int INF = 1e9 + 7;
int main() {
	int N;
	ll W;
	ll w[110], v[110];
	ll dp[110][100100];//dp[i][j]で価値総和がjになる時の重さ総和min
	cin >> N >> W;
	for (int i = 0; i < 110; ++i) {
		for (int j = 0; j < 100100; ++j) {
			dp[i][j] = INF;
		}
	}
	dp[0][0] = 0;
	for (int i = 0; i < N; ++i) {
		cin >> w[i] >> v[i];
	}
	for (int i = 0; i < N; ++i) {
		for (int j = 0; j < 100100; ++j) {
			if (j >= v[i]) {
				dp[i + 1][j] = min(dp[i][j], dp[i][j - v[i]] + w[i]);
			}
			else {
				dp[i + 1][j] = dp[i][j];
			}
		}
	}
	ll ans = 0;
	for (int i = 0; i <= 100100; ++i) {
		if (dp[N][i] <= W)ans = i;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 86272
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

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

  int a, b, c, d;
  cin >> a >> b >> c >> d;

  map<int, int> m;
  m[a]++;
  m[b]++;
  m[c]++;
  m[d]++;

  string ans = "NO";
  if (m[1] && m[9] && m[7] && m[4]) {
    ans = "YES";
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
package main

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

// I/O
type Scanner struct {
	sc *bufio.Scanner
}

func NewScanner() *Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &Scanner{sc}
}

func (s *Scanner) nextStr() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *Scanner) nextInt() int {
	i, e := strconv.Atoi(s.nextStr())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *Scanner) nextFloat() float64 {
	f, e := strconv.ParseFloat(s.nextStr(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *Scanner) nextRuneSlice() []rune {
	return []rune(s.nextStr())
}

func (s *Scanner) nextIntSlice(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextInt()
	}
	return res
}

func (s *Scanner) nextFloatSlice(n int) []float64 {
	res := make([]float64, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextFloat()
	}
	return res
}

// Arithmetic
func max(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m < i {
			m = i
		}
	}
	return m
}

func min(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m > i {
			m = i
		}
	}
	return m
}

func abs(x int) int {
	if x > 0 {
		return x
	}
	return -x
}

func pow(x, y int) int {
	res := 1
	for i := 0; i < y; i++ {
		res *= x
	}
	return res
}

// Sort
type Val struct {
	id, num int
}
type ByNum []Val

func (a ByNum) Len() int           { return len(a) }
func (a ByNum) Less(i, j int) bool { return a[i].num < a[j].num }
func (a ByNum) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }

func main() {
	sc := NewScanner()
	wtr := bufio.NewWriter(os.Stdout)
	N, M, X, Y := sc.nextInt(), sc.nextInt(), sc.nextInt(), sc.nextInt()
	x := sc.nextIntSlice(N)
	y := sc.nextIntSlice(M)
	ok := false
	for z := X + 1; z <= Y; z++ {
		xOk := true
		for _, v := range x {
			if z <= v {
				xOk = false
				break
			}
		}
		yOk := true
		for _, v := range y {
			if z > v {
				yOk = false
				break
			}
		}
		if xOk && yOk {
			ok = true
			break
		}
	}

	if ok {
		fmt.Fprintln(wtr, "No War")
	} else {
		fmt.Fprintln(wtr, "War")
	}
	wtr.Flush()
}


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

public class MainClass
{
	public const long Giri = 1000000007;
	public const long DpInf = 99999999999999;

	
	public static void Main(string[] args)
	{
		var p = Input();
		int n = p[0].ToInt();
		long y = p[1].ToLong();
		
		for(int i = 0; i <= n; i++)
		{
			for(int j = 0; j <= n; j++)
			{
				int k = (n-i-j);
				if(i+j+k != n || i < 0 || j < 0 || k < 0)
					continue;
				long wa = i * 10000 + j * 5000 + k * 1000;
				if(wa == y)
				{
					Console.WriteLine("{0} {1} {2}", i, j, (n-i-j));
					return;
				}
			}
		}
		Console.WriteLine("-1 -1 -1");
	}
	
	static long GCD(long a, long b)
	{
		var v = new[] { a, b };
		while (v[1] != 0) { v = new[] { v[1], v[0] % v[1] }; }
		return v[0];
	}
	public static string[] Input() { return Console.ReadLine().Split(); }
}

public static class Smarter
{
	public static int ToInt(this string str) { return int.Parse(str); }
	public static long ToLong(this string str) { return long.Parse(str); }
	public static int[] ToInt(this string[] str, int offset = 0)
	{
		var r = new int[str.Length];
		for(int i = 0; i < str.Length; i++) r[i] = str[i].ToInt() + offset;
		return r;
	}
}

Measured memory_bytes: 11092