akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            List<long> clock = new List<long>();

            for (int i = 0; i < N; i++)
            {
                long input = long.Parse(Console.ReadLine());

                if (!clock.Contains(input))
                {
                    clock.Add(input);
                }
            }

            while (clock.Count > 1)
            {
                long small = (clock[0] > clock[1]) ? clock[1] : clock[0];
                long big = (clock[0] < clock[1]) ? clock[1] : clock[0];
                while (big % small != 0)
                {
                    long rem = big % small;
                    big = small;
                    small = rem;
                }
                clock[0] = clock[0] * (clock[1] / small);
                clock.RemoveAt(1);
            }

            Console.WriteLine(clock[0]);

        }
    }
}


Measured memory_bytes: 13152
# KEYENCE Programming Contest 2019 / キーエンス プログラミング コンテスト 2019: B – KEYENCE String
S = input()

is_keyence = 'NO'

for i in range(0, 8):
    if S[:i] + S[i - 7:] == 'keyence':
        is_keyence = 'YES'
        break

print(is_keyence)

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

using namespace std;

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

  vector<int> cards(N);

  for (int i = 0; i < N; i++) {
    cin >> cards[i];
  }
  sort(cards.begin(), cards.end(), greater<int>());
  int alice = 0, bob = 0;

  for (int i = 0; i < N; i += 2) {
    alice += cards[i];
  }
  for (int i = 1; i < N; i += 2) {
    bob += cards[i];
  }
  cout << alice - bob << endl;

  return 0;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
)



func main() {
	var N, D1, D2, counter int
	fmt.Scan(&N)
	res := "No"
	for i := 0; i < N; i++ {
		fmt.Scan(&D1)
		fmt.Scan(&D2)
		if D1 == D2 {
			counter++
		} else {
			counter = 0
		}
		if counter >= 3 {
			res = "Yes"
			break;
		}
	}
	fmt.Println(res)

}


Measured memory_bytes: 1772
use std::io;

fn main() {
    let mut line = String::new();
    io::stdin().read_line(&mut line).unwrap();
    let mut tmp = line.trim().split_whitespace();
    let mut result: i16 = 0;
    for i in [2, 1, 0].iter() {
        let d: i16 = tmp.next().unwrap().parse().unwrap();
        result += 10i16.pow(*i) * d;
    }
    if result % 4 == 0 {
        println!("YES");
    } else {
        println!("NO");
    }
}


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

int main(){
    string s;    cin >> s;
    int even=0, odd=0;
    int n=s.size();
    
    for(int i=0; i<n; i++){
        if(i%2==0 && s[i]=='1') even+=1;
        if(i%2==1 && s[i]=='0') odd += 1;
    }

    cout << min(even+odd, n-(even+odd)) << endl;
}

Measured memory_bytes: 512
read = lambda: map(int, input().split())
n = int(input())
a = list(read())
from collections import deque
b = deque()
x = 1
for i in range(n):
    if x: b.append(a[i])
    else: b.appendleft(a[i])
    x ^= 1
ans = list(b)
if not x: ans = ans[::-1]
print(*ans)

Measured memory_bytes: 102556
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long int lli;
const lli inf = 1e18;

int lplus(int n, int m){
    if(n+m < 0) return 0;
    if(n+m > 255) return 255;
    return n+m;
}

int main(){
    while(1){
        int n,m;
        cin >> n >> m;
        if(n==0) break;

        vector<int> c(m), x(n+1);
        for(int i=0; i<m; i++) cin >> c[i];
        for(int i=1; i<=n; i++) cin >> x[i];
        vector<vector<lli> > dp(n+1, vector<lli>(256, inf));
        dp[0][128] = 0;
        
        for(int i=0; i<n; i++){
            for(int j=0; j<256; j++){
                for(int k=0; k<m; k++){
                    lli diff = x[i+1] -lplus(j,c[k]);
                    if(dp[i][j] +diff*diff < dp[i+1][lplus(j,c[k])]){
                        dp[i+1][lplus(j,c[k])] = dp[i][j]+diff*diff;
                    }
                }
            }
        }

        lli ans=inf;
        for(int i=0; i<256; i++) ans=min(ans, dp[n][i]);
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 43772
/** 	Author: Apoorva Mittal  **/
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define endl "\n"
#define nl "\n"
#define vi vector<int>
#define vvi vector<vector<int>>
#define vii vector<pair<int, int>>
#define rep(i, a, b) for (int i = a; i < b; i++)
#define repD(i, a, b) for (int i = a; i >= b; i--)
#define speed                     \
    ios_base::sync_with_stdio(0); \
    cin.tie(0);                   \
    cout.tie(0)
#define init(i, k) memset(i, k, sizeof i)
#define pb push_back
#define pii pair<int, int>
#define ff first
#define ss second
#define all(a) a.begin(), a.end()
#define inp(a) rep(i, 0, a.size()) cin >> a[i];
#define out(a)                               \
    cout << #a << ": " << endl;              \
    rep(i, 0, a.size()) cout << a[i] << " "; \
    cout << endl;
#define out2d(a)                \
    cout << #a << ": " << endl; \
    rep(i, 0, a.size())         \
    {                           \
        rep(j, 0, a[0].size())  \
                cout            \
            << a[i][j] << " ";  \
        cout << endl;           \
    }
#define flush fflush(stdout);
#define lb lower_bound
#define ub upper_bound
#define maxe *max_element
#define mine *min_element
#define umap unordered_map
#define uset unordered_set
#define mset multiset
#define pqueue priority_queue
#define precise(x) cout << fixed << showpoint << setprecision(x);
#define setbit(x) __builtin_popcountll(x)
#define gcd(a, b) __gcd(a, b)
#define deb(x) cout << #x << " " << x << endl;
#define Y "YES"
#define N "NO"
const int mod = 1e9 + 7;
// ====== Useful functions begin ======
inline int add(int a, int b) { return ((a % mod) + (b % mod)) % mod; }
inline int sub(int a, int b) { return ((a % mod) - (b % mod) + mod) % mod; }
inline int mul(int a, int b) { return ((a % mod) * (b % mod)) % mod; }
// ====== Useful functions end ======
const int inf = 1e18;
const int maxn = 1e3 + 5;

//--------------------------------------------------------------------------------------------------------------------------------

//--------------------------------------------------------------------------------------------------------------------------------

void solve()
{
    int n;
    cin >> n;
    vi arr(n);
    inp(arr)
        vector<int>
            dp(n, 0);
    dp[n - 2] = abs(arr[n - 1] - arr[n - 2]);
    for (int i = n - 3; i >= 0; i--)
    {
        int &v = dp[i];
        v = abs(arr[i + 1] - arr[i]);
        v += dp[i + 1];
        v = min(v, abs(arr[i + 2] - arr[i]) + dp[i + 2]);
    }

    cout<<dp[0]<<endl;
}
signed main()
{
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);

    speed;
    int t = 1;
    // cin >> t;

    for (int tt = 1; tt <= t; tt++)
    {
        // cout<<"Case #"<<tt<<": ";
        solve();
    }
}

Measured memory_bytes: 1792
import java.util.Arrays;
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N, M;
		N = sc.nextInt();
		M = sc.nextInt();
		int b[] = new int[N];
		Arrays.fill(b, 1);
		b[0] = -1;
		for (int i = 0; i < M; i++) {
			int s = sc.nextInt() - 1;
			int t = sc.nextInt() - 1;
			if (b[t] < 0)
				b[t] = -1 * (Math.abs(b[t]) + 1);
			else
				b[t] = (int) Math.signum(b[s]) * (Math.abs(b[t]) + 1);
			b[s] = (int) Math.signum(b[s]) * (Math.abs(b[s]) - 1);

		}
		int count = 0;
		for (int i = 0; i < b.length; i++) {
			if (b[i] < 0)
				count++;
		}
		System.out.println(count);

	}
}


Measured memory_bytes: 23608
N, K = map(int, input().split(" "))
towns = list(map(lambda x: int(x)-1, input().split(" ")))
assert len(towns) == N

# print(towns)

# score = {0: 0}
# current = 0
# move = 0
# while 1:
#   next_town = towns[current]
#   move += 1
#   # print(f"move {current} to {next_town}")
#   if score.get(next_town) is not None:
#     # print(f"find loop!")
#     loop_move = move - score.get(next_town)
#     loop_town = next_town
#     until_loop = score.get(next_town)
#     # print(f"loop start town : ", loop_town)
#     # print(f"cost to start to loop town : ", until_loop)
#     # print(f"loop length : ", loop_move)
#     break
#   score[next_town] = move
#   current = next_town

# if K < until_loop:
#   result = 0
#   for k in range(K):
#     result = towns[result]
# else:
#   result = loop_town
#   for k in range((K - until_loop) % loop_move):
#     result = towns[result]
# print(result + 1)

L = None
visited = set([])
current = 0
while 1:
  if K == 0:
    break
  current = towns[current]
  K -= 1
  if current in visited:
    L = 0
    tcurrent = current
    while 1:
      tcurrent = towns[tcurrent]
      L += 1
      if tcurrent == current:
        break
    break
  visited.add(current)

if L is not None:
  K = K % L
  # print(K)
  for _ in range(K):
    current = towns[current]
print(current + 1)


Measured memory_bytes: 32288
#AGC002B 12:45:00-12:47:30-
N, M = map(int, input().split())
moveList = [list(map(int, input().split())) for i in range(M)]
redFlag = [False for i in range(N)]
redFlag[0] = True
nums = [1 for i in range(N)]

for m in moveList:
    x, y = m[0]-1, m[1]-1
    
    nums[x] -= 1
    nums[y] += 1
    if redFlag[x]: redFlag[y] = True
    if (nums[x] == 0): redFlag[x] = False
    
print(sum(redFlag))

Measured memory_bytes: 29000
#include <bits/stdc++.h>
#define rep(i,a,n) for(int i=a;i<n;i++)
#define repb(i,a,b) for(int i=a;i>=b;i--)
#define all(a) a.begin(),a.end()
#define o(a) cout<<a<<endl
#define int long long
#define fi first
#define se second
using namespace std;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;


signed main() {
	int n;
	while (cin >> n && n) {
		int w, h;
		cin >> w >> h;
		int a[110][110] = { 0 };
		rep(i, 0, n) {
			int x, y;
			cin >> x >> y;
			a[y][x] = 1;
		}
		int s, t;
		cin >> s >> t;
		rep(i, 0, h + 1) {
			rep(j, 0, w + 1) {
				a[i][j + 1] += a[i][j];
			}
		}
		rep(i, 0, w + 1) {
			rep(j, 0, h + 1) {
				a[j + 1][i] += a[j][i];
			}
		}
		int MAX = 0;
		rep(i, 1, h - t + 2) {
			rep(j, 1, w - s + 2) {
				MAX = max(MAX, a[i - 1][j - 1] - a[i - 1][j + s - 1] - a[i + t - 1][j - 1] + a[i + t - 1][j + s - 1]);
			}
		}
		cout << MAX << endl;
	}
}

Measured memory_bytes: 1256
/*                        ______
 _______   /\     |``\   |        |  /
    |     /  \    |__/   |____    |/
    |    / _ _\   |  \   |        |\
    |   /      \  |   \  |______  |  \

            Dept. of CSE
        Comilla  University

*/
#include<bits/stdc++.h>
#define pi 2*acos(0.0)
#define ll long long
#define FIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define Node struct node
#define spc " "

using namespace std;
///check n=1;
///check corner case;

int main()
{
    ll n,a,b;
    cin>>n>>a>>b;
    ll cc=a+b;
    ll ans=n/cc;
    ll rem=n%cc;
    cout<<ans*a+min(rem,a)<<endl;
return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>

using namespace std;

int N,a[200001];
bool b[200001];

bool check(int x){
    for(int i=1;i<=(N<<1)-1;++i)b[i]=(a[i]<=x);
    for(int i=0;i<N;++i){if(b[N-i]==b[N-i-1])return b[N-i];if(b[N+i]==b[N+i+1])return b[N+i];}
    return b[1];
}

int main(){
    scanf("%d",&N);for(int i=1;i<=(N<<1)-1;++i)scanf("%d",a+i);
    int l=1,r=(N<<1)-1,m;
    while(l<r)if(check(m=l+r>>1))r=m;else l=m+1;
    printf("%d",l);
}

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

int main() {
   int N;
   cin >> N;
   char c[N];
   int count=0;
   for (int i=0; i<N; i++) {
       cin >> c[i];
       if (c[i]=='R') count++;
   }
   int total=0;
   for (int i=count; i<N; i++) {
       if (c[i]=='R') total++;
   }
   cout << total << endl;
}

Measured memory_bytes: 3816
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args)throws Exception{
		InputStreamReader isr = new InputStreamReader(System.in);
        BufferedReader br = new BufferedReader(isr);
    
    	String str = br.readLine();
    	int q = Integer.parseInt(br.readLine());
    	
    	for (int i = 0; i < q; i++)
    	{
    		String[] order = br.readLine().split(" ");
    		int a = Integer.parseInt(order[1]);
    		int b = Integer.parseInt(order[2]);
			String cut = str.substring(a, b + 1);
			String hajime = str.substring(0, a);
			String nokori = str.substring(b + 1);
			String newcut = "";
    		
    		if (order[0].equals("print"))
    		{
    			System.out.println(cut);
    		}
    		else if (order[0].equals("reverse"))
    		{
    			for (int j = cut.length() - 1; j >= 0; j--)
    			{
    				newcut += String.valueOf(cut.charAt(j));
    			}
    			str = hajime + newcut + nokori;
    			//System.out.println(str); //test
    		}
    		else if (order[0].equals("replace"))
    		{
    			String p = order[3];
    			str = hajime + p + nokori;
    			//System.out.println(str); //test
    		}
    	}
	}

}

Measured memory_bytes: 43448
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while(true) {
			String s = sc.next();
			if (s.equals("#")) {
				break;
			}
			if (isEquation(s)) {
				System.out.println("YES");
			}else{
				System.out.println("NO");
			}
		}
	}

	public static boolean isEquation(String s) {
		for(int i=0;i<(1<<11);i++) {
			String s2 = String.valueOf(s);
			for(int j=0;j<11;j++) {
				if ((i&(1<<j))>0) {
					s2 = s2.replaceAll(String.valueOf((char) ('a'+j)), "T");
				}else{
					s2 = s2.replaceAll(String.valueOf((char) ('a'+j)), "F");
				}
			}
			String[] exp = s2.split("=");
			if (evaluate(exp[0])!=evaluate(exp[1])) {
				return false;
			}
		}
		return true;
	}

	public static int index = 0;
	public static boolean evaluate(String s) {
		index = 0;
		boolean ret = expression(s);
		return ret;
	}

	public static boolean expression(String s) {
		char c = s.charAt(index);
		if (c == 'T' || c == 'F') {
			index++;
			return c == 'T';
		}
		if (c == '-') {
			index++;
			return !expression(s);
		}
		if (c == '(') {
			index++;
			boolean temp = term(s);
			index++;
			return temp;
		}
		return false;
	}

	public static boolean term(String s) {
		boolean first = expression(s);
		char c = s.charAt(index);
		index += c == '-' ? 2 : 1;
		boolean second = expression(s);
		if (c == '*') {
			return first && second;
		}else if(c == '+') {
			return first || second;
		}else{
			return !(first && !second);
		}
	}

}

Measured memory_bytes: 161068
#include <bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
    ll n, w;
    cin >> n >> w;
    ll a[n], W[n];
    ll total = 0;
    for (int i = 0; i < n; i++)
    {
        cin >> W[i] >> a[i];
        total += a[i];
    }
    ll dp[total + 1];
    for (int i = 0; i < total + 1; i++)
        dp[i] = INT_MAX;

    dp[0] = 0;
    for (ll i = 0; i < n; i++)
    {
        for (ll j = total; j >= 0; j--)
        {
            if (a[i] <= j && dp[j - a[i]] < w)
            {
                dp[j] = min(dp[j], dp[j - a[i]] + W[i]);
            }
        }
    }

    for (ll i = total; i >= 0; i--)
    {
        if (dp[i] <= w)
        {
            cout << i << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 4356
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <utility>
#include <algorithm>
#include <cstdio>
#include <iomanip>
#include <queue>
#include <deque>
#include <stack>
#include <fstream>
#include <cmath>
#include <random>
#include <complex>
#include <functional>
#include <bitset>
#include <sstream>
#include <cassert>
#include <time.h>

#define ll int64_t
#define Rep(i, n) for (ll i = 0; i < n; i++)
using namespace std;
typedef vector<ll> vec;
typedef vector<vec> mat;

const ll inf = 1LL << 60;

template<class T> inline void chmin(T& a, T b) {
    if (a > b) {
        a = b;
    }
}
template<class T> inline void chmax(T& a, T b) {
    if (a < b) {
        a = b;
    }
}
void printvec (vec &v) {
    Rep (i, (ll)v.size()) {
        cout << v[i] << " \n"[i+1 == (ll)v.size()];
    }
}

ll D = 365;
vec c(26);
mat s(D, vec(26));
vec last(26, 0);

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

    cin >> D;
    Rep (i, 26) {
        cin >> c[i];
    }
    Rep (i, D) {
        Rep (j, 26) {
            cin >> s[i][j];
        }
    }

    vec t(D);
    Rep (i, D) {
        cin >> t[i];
        t[i]--;
    }

    ll tmp = 0;
    Rep (i, D) {
        tmp += s[i][t[i]];
        Rep (j, 26) {
            if (j == t[i]) last[j] = i+1;
            tmp -= c[j] * (i+1 - last[j]);
        }
        cout << tmp << "\n";
    }
}

Measured memory_bytes: 3744
N = int(input())
S = ["".join(sorted(input())) for i in range(N)]
dict = {}
ans = 0
for i in range(N):
    if S[i] in dict:
        ans += dict[S[i]]
        dict[S[i]] += 1
    else:
        dict[S[i]] = 1

print(ans)

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

int main(){
	int n;
	cin >> n;
	vector<int> a(n);
	for(int i = 0;i<n;++i) cin >> a[i];
	int ans = 0;
	for(int i = 1;i<n-1;++i){
		if(max({a[i-1],a[i],a[i+1]}) != a[i] && min({a[i-1],a[i],a[i+1]}) != a[i]){
			++ans;
		}
	}
	cout << ans << endl;
	return 0;
}

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

const int MAX = 300000;
const int64_t INF = 4611686018427387903; // 10^62-1、使わない辺とかに用いる

int main() {
	int N;
	static int a[MAX];
	cin >> N;
	for (int i = 0;i < 3 * N;i ++) cin >> a[i];
	
	static priority_queue<int, vector<int>, greater<int> > top;
	static priority_queue<int> bottom;
	static int64_t sumTop[MAX], sumBottom[MAX];
	for (int i = 0;i < N;i ++) {
		top.push(a[i]);
		sumTop[0] += a[i];
		bottom.push(a[i + 2 * N]);
		sumBottom[0] += a[i + 2 * N];
	}
	for (int i = 0;i < N;i ++) {
		top.push(a[i + N]);
		sumTop[i + 1] = sumTop[i] + a[i + N] - top.top();
		top.pop();
		bottom.push(a[2 * N - i - 1]);
		sumBottom[i + 1] = sumBottom[i] + a[2 * N - i - 1] - bottom.top();
		bottom.pop();
	}
	int64_t ans = -INF;
	for (int i = 0;i <= N;i ++) {
		ans = max(ans, sumTop[i] - sumBottom[N - i]);
	}
	cout << ans;
	return 0;
}
/*
31536000のコメント解説欄
ここテンプレで用意してるから、A問題とかだとこの先空欄の危険あり
また、コンテスト後に https://31536000.hatenablog.com/ で解説していると思うので、良かったら読んでねー

まず、先頭部分に当たる位置と後方部分に当たる位置は交わらない
つまり、Nから2Nまでの要素のどこかに分割線があって、左側と右側で上位N個の総和が分かれば良い

左側と右側で優先度付キューを用いておくと各操作がO(1)なので全体O(N)
*/

Measured memory_bytes: 5236
#include<iostream>
#include<stdio.h>
#include<fstream>
#include<algorithm>
#include<ctime>
#include<cstdlib>
#include<cstring>
#include<vector>
#include<set>
#include<string>
#include<queue>
#include<map>
#include<iomanip>
#include<cassert>
#include<complex>
#include<functional>
#include<list>
#include<cmath>
#include<stack>
#include<assert.h>
#define LL long long
#define PB push_back
#define MP make_pair
#define PII pair<int,int>
#define F first
#define S second
using namespace std;
int a,b; 
int main(){
  cin>>a>>b;
  if((a+b)%2==1)
    cout<<"IMPOSSIBLE";
  else
    cout<<(a+b)/2;
  return 0;
}

Measured memory_bytes: 256
/*****/

#include <iostream>
#include <array>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <iomanip>	//cout << fixed << setprecision(桁数);
#include <stdexcept>

//#define int long long

using namespace std;
using ll = long long;
using ld = long double;
using vecll = vector<ll>;

#define nextline() (std::cerr << "\n")
#define debug(x) (#x " : " + (x))
#define debug_cout(x) (std::cerr << #x << " : " <<  (x) << "\n")
#define debug_tabcout(n, x) (std::cerr << strMulti("\t",n) << #x << " : " <<  (x) << "\n")
#define debug_headcout(h, x) (std::cerr << h << " : " <<  (x) << "\n")
#define debug_tabheadcout(n, h, x) (std::cerr << strMulti("\t",n) << h << " : " <<  (x) << "\n")

#define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; i++)
#define rep1(i, n) for(int i=1, i##_len=(n); i<=i##_len; i++)
#define rrep(i, n) for(int i=(n)-1; i >= 0; i--)
#define rrep1(i, n) for(int i=(n); i > 0; i--)
#define all(x) (x).begin(), (x).end()
#define pair(a, b) make_pair(a, b);
constexpr int INF = 2000000100;
constexpr ll DIV = 1000000007;	// 10e9+7
template<class T> bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
//template<class T> T divup(T a, T b) { if (a % b == 0) { return a / b; } return a / b + 1; }
#define diup(a, b) (a % b == 0 ? a / b : a / b + 1)
#define exist_in(list, value) (list.end() != std::find(all(list),value))
std::string strMulti(std::string t, int n) { std::string out = ""; for (int i = 0; i < n; i++) { out += t; } return out; }
//template<class T> T math_P(T m, T n) { T ret = 1; for (T i = m; i > m - n; i--) { ret *= i; } return ret; }
//template<class T> T math_C(T m, T n) { T ret = mathP(m, n); for (T i = 2; i <= n; i++) { ret /= i; } return ret; }
//template<class T> bool compare_by_b(pair<T, T> a, pair<T, T> b) { if (a.second != b.second) { return a.second < b.second; } return a.first < b.first; }
//template<class T> T math_gcd(T a, T b) { a = abs(a); b = abs(b); if (a < b) { std::swap(a, b); } T tmp; while (b != 0) { tmp = b; b = a % b; a = tmp; } return a; }
//template<class T> T math_lcm(T a, T b) { a = abs(a); b = abs(b); if (a > b) { std::swap(a, b); } if (a == 1) { return b; } T i = a; while (i % b != 0) { i += a; } return i; }
//template<class T1, class T2> bool exist_in(const T1& list, const T2& v) { return (list.end() != std::find(list.begin(), list.end(), v)); }
//template<class T> bool exist_in(const T& c, const typename T::value_type& v) {	return (c.end() != std::find(c.begin(), c.end(), v));}

/*****/

void Main()
{
	ll x, a, b;
	cin >> x >> a >> b;
	if (a >= b)
		cout << "delicious";
	else if (x + a >= b)
		cout << "safe";
	else
		cout << "dangerous";
}

/*****/

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

	std::cout << std::fixed << std::setprecision(10);


	/*
	while (true)
	{
		Main();
		cout << endl;
	}
	//*/


	Main();

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <map>

using namespace std;

typedef pair<int, string> P;

map<string, P> fam;

vector<string> s;
vector<string> name;
int N, Q;

void output(){
  string op;
  for(int i = 0 ; i < Q ; i++){
    string relation, X, Y;
    for(int j = 0 ; j < 6 ; j++){
      cin >> op;
      if(j == 0) X = op;
      if(j == 3) relation = op;
      if(j == 5) Y = op;
    }
    Y.erase(Y.end()-1);
    
    if(relation == "parent"){
      relation = "child";
      swap(X, Y);
    }
    if(relation == "descendant"){
      relation = "ancestor";
      swap(X, Y);
    }
    
    bool ans = false;
    
    if(relation == "child"){
      ans = fam[X].second == Y;
    }
    else if(relation == "ancestor"){
      while(fam[Y].first != 0){
	if(fam[Y].second == X){
	  ans = true;
	  break;
	}
	Y = fam[Y].second;
      }
    }
    else if(relation == "sibling"){
      int gen = fam[Y].first;
      string par = fam[Y].second;
      for(map<string, P>::iterator it = fam.begin() ; it != fam.end() ; it++){
	if(it->first == X){
	  if(it->second.first == gen && it->second.second == par){
	    ans = true;
	    break;
	  }
	}
      }
    }
    if(ans) cout << "True" << endl;
    else cout << "False" << endl;
  }
}

int main(){
  while(cin >> N >> Q, N|Q){
    fam.clear();
    s.clear();
    name.clear();
    cin.ignore();
    string tmp;
    for(int i = 0 ; i < N ; i++){
      getline(cin, tmp);
      s.push_back(tmp);
    }
    
    name = s;
    
    for(int i = 0 ; i < N ; i++){
      while(name[i][0] == ' ') name[i].erase(name[i].begin());
    }
    
    for(int i = 0 ; i < N ; i++){
      int gen = 0;
      for(int j = 0 ; j < (int)s[i].size() ; j++){
	if(s[i][j] != ' ') break;
	gen++;
      }
      for(int j = i ; j >= 0 ; j--){
	if(s[j][gen-1] != ' '){
	  fam[ name[i] ] = P(gen, name[j]);
	  break;
	}
      }
    }
    
    output();
    cout << endl;
  }
  return 0;
}

Measured memory_bytes: 1536
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		
		Scanner scanner = new Scanner(System.in);
		int r           = scanner.nextInt();
		int D           = scanner.nextInt();
		int x           = scanner.nextInt();
		int answer      = 0;
		//10行出力
		for(int i = 0; i <= 9; i++){
			
			answer = r * x - D;
			//xを一つ前の値にする
			x = answer;
			System.out.println(answer);
		}
	}

}

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


int main() {
	int n, k;
	cin >> n >> k;
	int sum = 0;
	for (int i = 0; i < n; i++) {
		int num;
		cin >> num;
		sum += (num < k - num ? 2 * num : 2 * (k - num));
	}
	cout << sum << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
using namespace std;
int main(){ 
    int H,W; cin >> H >> W;
    string line[H];
    for (int i=0;i<H;i++) cin >> line[i];
    for (int i=0;i<H;i++) {
            cout << line[i] << endl;
            cout << line[i] << endl;
    }
    

}

Measured memory_bytes: 256
import numpy as np
N, M, C = map(int, input().split())
B = list(map(int, input().split()))
B = np.array(B)

get_count = 0
for i in range(N):
    A  = list(map(int, input().split()))
    A = np.array(A)
    if sum(A*B) + C >0:
        get_count += 1

print(get_count)

Measured memory_bytes: 12420
use std::str::FromStr;
use std::collections::{HashMap,HashSet,VecDeque,BinaryHeap};
use std::cmp::{max,min,Ordering};
use std::io::Read;

fn main() {

    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();
    let mut buf_it = buf.split_whitespace();

    let N = buf_it.next().unwrap().parse::<usize>().unwrap();
    let mut A = (0..N).map(|_| buf_it.next().unwrap().parse::<isize>().unwrap()).collect::<Vec<_>>();

    let mut G = Vec::new();
    let mut k = N/2;
    while k>0{
        G.push(k);
        k /= 2;
    }
    G.push(1);
    let m = G.len();

    let cnt = shellSort(&mut A,&G,N);

    println!("{}",m);
    println!("{}",G.iter().map(|&a| format!("{}",a)).collect::<Vec<_>>().join(" "));
    println!("{}",cnt);
    for &a in &A{
        println!("{}",a);
    }
}

fn shellSort(A:&mut Vec<isize>,G:&Vec<usize>,N:usize)->usize{
    let mut cnt = 0;
    for &g in G{
        cnt += insertionSort(A,N,g);
    }
    cnt
}

fn insertionSort(A:&mut Vec<isize>,N:usize,g:usize)->usize{
    let mut cnt = 0;
    for i in g..N{
        let v = A[i];
        let mut j = (i-g) as isize;
        while j >= 0 && A[j as usize]>v{
            A[j as usize +g] = A[j as usize];
            cnt += 1;
            j = j - g as isize;
        }
        A[(j+g as isize) as usize] = v;
    }
    cnt
}


Measured memory_bytes: 22396
n=int(input())
w=[[] for i in range(n)]
for i in range(n):
    a=int(input())
    for j in range(a):
        x,y=map(int,input().split())
        w[i].append((x,y))
ans=0
for i in range(1<<n):
    x="0"*15+bin(i)[2:]
    z=[int(i) for i in x[-n:]]
    f=1
    for p,q in enumerate(w):
        if z[p]==1:
            for r in q:
                if (z[r[0]-1]!=r[1]):
                    f=0
    if f:
        ans=max(ans,z.count(1))
print(ans)


Measured memory_bytes: 43372
#include <stdio.h>
int main()
{
	int A,B,C,D;
	scanf("%d%d", &A,&B);
	if(2*B>0)
		D = A+B;
	else
		D = A-B;
	if(D>A*B)
		printf("%d",D);
	else
		printf("%d",A*B);
}

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

using namespace std;

using int64 = long long;

int main() {
  int64 bit[51][2501] = {{}};
  bit[0][0] = 1;

  int N, A;
  cin >> N >> A;
  for(int i = 0; i < N; i++) {
    int x;
    cin >> x;
    for(int j = 50; j > 0; j--) {
      for(int k = 2500; k >= x; k--) {
        bit[j][k] += bit[j - 1][k - x];
      }
    }
  }

  int64 ret = 0;
  for(int i = 1; i <= N; i++) {
    ret += bit[i][A * i];
  }
  cout << ret << endl;
}

Measured memory_bytes: 1280
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
#include <sstream>
using namespace std;
#define INF 100000000
struct T{
	T(int a,int b,int d){
		p = a;
		c = b;
		k = d;
	}
	int p;
	int c;
	int k;
};


int main(){
	int D,G;
	int min = INF;
	cin >> D >> G;
	vector<T> to;
	int tmp1,tmp2,tmp3;
	
	for(int i=1;i<D+1;i++){
		cin >> tmp1 >> tmp2;
		to.push_back(T(tmp1,tmp2,100*i));
	}
	//完全に解くやつだけON
	for(int i=0;i<(1<<D);i++){
		int sum = 0;
		int count = 0;
		for(int shift=0;shift<D;shift++){
			if(i & (1<<shift)){
				sum += to[shift].p * to[shift].k + to[shift].c;
				count += to[shift].p;
			}
		}
		if(sum >= G){
			if(min > count){
				min = count;
			}
			continue;
		}
		for(int j=D-1;j>=0;j--){
			int j_count = to[j].p;
			while(j_count != 0 && sum < G && !(i & (1<<j))){
				sum += to[j].k;
				j_count--;
				count++;
			}
			if(sum >= G){
				if(min > count){
					min = count;
				}
				continue;
			}
		}
	}
	cout << min << endl;

}


Measured memory_bytes: 384
// ===================================
//   author: M_sea
//   website: http://m-sea-blog.com/
// ===================================
#include <algorithm>
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <cstdio>
#include <cmath>
#define re register
using namespace std;

inline int read() {
    int X=0,w=1; char c=getchar();
    while (c<'0'||c>'9') { if (c=='-') w=-1; c=getchar(); }
    while (c>='0'&&c<='9') X=X*10+c-'0',c=getchar();
    return X*w;
}

const int N=100000+10;

int n,m;
int f[N],s[N];

int main() {
    n=read(),m=read();
    f[1]=1;
    for (re int i=1;i<=n;++i) s[i]=1;
    for (re int i=1;i<=m;++i) {
        int x=read(),y=read();
        if (f[x]) {
            if (s[x]==1) f[x]=0,f[y]=1;
            else f[y]=1;
        }
        --s[x],++s[y];
    }
    int ans=0;
    for (re int i=1;i<=n;++i) ans+=f[i];
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define FIO ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define DEBUG(x)           cout << '>' << #x << ':' << x << endl;
#define forn(i,n)          for(int i=0;i<(int)n;++i)
#define for1(i,n)          for(int i=1;i<=(int)n;++i)
#define forr(i,n)          for(int i=(int)n-1;i>=0;--i)
#define forre(i,a,b)       for(int i=(int)b;i>=(int)a;--i)
#define fore(i,a,b)        for(int i=(int)a;i<=(int)b;++i)
#define input(arr,n)       for(int i=0;i<n;i++)cin>>arr[i]
#define output(arr,n)      for(int i=0;i<n;i++)cout<<arr[i]<<" "
#define for_each(arr)      for(auto& it:arr)cout<<it<<" "
#define ff                 first
#define ss                 second
#define PI                 acos(-1.0)
#define all(a)             a.begin(),a.end()
#define rall(a)            a.rbegin(),a.rend()
#define Unique(a)          sort(all(a)),a.erase(unique(all(a)),a.end())
#define pb(x)              push_back(x)
#define eb(x)              emplace_back(x) 
#define ppb(x)             pop_back(x)
#define pf(x)              push_front(x)
#define ppf(x)             pop_front(x)
#define in(x,y)            insert({x,y})
#define Sort(a)            sort(a.begin(),a.end())
#define mem(arr,a)         memset(arr,a,sizeof arr)
#define ins(a)             insert(a)
#define max2(a,b)          max(a,b)
#define max3(a,b,c)        max(a,max(b,c))
#define max4(a,b,c,d)      max(a,max3(b,c,d))
#define min2(a,b)          min(a,b)
#define min3(a,b,c)        min(a,min(b,c))
#define min4(a,b,c,d)      min(a,min3(b,c,d))
typedef long long ll;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<char> vc;
typedef vector<double> vd;
/*inline int two(int n) { return 1 << n; }
inline int test(int n, int b) { return (n>>b)&1; }
inline void Set(int & n, int b) { n |= two(b); }
inline void Reset(int & n, int b) { n &= ~two(b); }
inline int last_bit(int n) { return n & (-n); }
inline int ones(int n) { int res = 0; while(n && ++res) n-=n&(-n); return res; }*/
/*int fx1[]={+1,-1,+0,+0};
int fy1[]={+0,+0,+1,-1};
int fx2={+0,+0,+1,-1,-1,+1,-1,+1};
int fy2={-1,+1,+0,+0,+1,+1,-1,-1};
*/

ll a,b,c,n,ans,cn1,cn2,cn3,t;
string s,s1,s2;


int main()
{
    FIO;
    /*#ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif*/
    cin>>a>>b;
    bool besi=false;
    if(a>9||b>9)besi=true;

    if(besi)cout<<-1<<endl;
    else cout<<a*b<<endl;
    

    
   	
    #ifdef ONLINE_JUDGE
    cerr<<"Time elapsed: "<<1.0*clock()/CLOCKS_PER_SEC<<"s.\n";
    #endif
   return 0;
}
 


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		long a=sc.nextLong();
		long b=sc.nextLong();
		long x=sc.nextLong();
		long ans=0;
		ans = b / x - a / x;
		if(a % x == 0){
			ans++;
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 24020
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define lvector vector<ll>
#define P pair<ll,ll>
#define rep(i,n) for(ll (i)=0; (i)<(n); ++(i))
#define print(a) cout << (a) << endl

ll dp[1000+1][100000+1];
vector<int> A,B;
ll n,h;

void solve() {
  for(ll i=0;i<n;++i) {
    for(ll j=1;j<=h;++j) {
      if(dp[i][j]==0) dp[i+1][j]=dp[i+1][j-A[i]]+B[i];
      else dp[i+1][j]=min(dp[i][j],dp[i+1][j-A[i]]+B[i]);
    }
  }
  print(dp[n][h]);
  return;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cin>>h>>n;
  A.resize(n,0), B.resize(n,0);
  rep(i,n) {cin>>A[i]>>B[i];}
  solve();
  return 0;
}


Measured memory_bytes: 778880
/*********************************************************************************\
*  _________  _      _  ________  _       _       __       ________               *
* |___   ___|| |    | ||  ______|| |     | |     /  \     |  ____  |              *
*     | |    | |    | || |______ | |_____| |    / /\ \    | |____| |              *
*     | |    | |    | ||______  ||  _____  |   / /__\ \   |  __  __|              *
*     | |    | |____| | ______| || |     | |  / ______ \  | |  \ \                *
*     |_|    |________||________||_|     |_| /_/      \_\ |_|   \_\               *
*                                                                                 *
*   Department of Computer Science & Engineering                                  *
*   Student ID : 18CSE035                                                         *
*   Bangabnadhu Sheikh Mujibur Rahman Science & Technology University,Gopalgonj.  *
*                                                                                 *
\*********************************************************************************/

//Now Write to Code ___________________________


#include <bits/stdc++.h>
using namespace std ;
 
 
typedef long long                ll;
typedef long double              ld;
typedef unsigned long long       ull;
typedef pair <int,int>           pii;
typedef pair <ll,ll>             pll;
typedef vector <int>             vi;
typedef vector <ll>              vll;
typedef vector <vector <int> >   vvi;
 
inline int    Int(){int x; cin >> x; return x;}
inline ll     Long(){ll x; cin >> x; return x;}
inline float  Float(){float x; cin >> x; return x;}
inline double Double(){double x; cin >> x; return x;}
inline void   Yes(){cout << "Yes" << endl;}
inline void   No(){cout << "No" << endl;}
inline void   YES(){cout << "YES" << endl;}
inline void   NO(){cout << "NO" << endl;}
 
const int N             =(int)2e5 + 5;
const int maxN          =(int)1e6 + 6;
const ll  Mod           =(ll)1e9 + 7;
const int inf           =(int)2e9;
const ll  Inf           =(ll)1e18;
 
#define     T           int t,q; cin >> t; for(q=1;q<=t;q++)
#define     debug(x)    cerr << #x << " = " << x << '\n' ;
#define     rep(i,b,e)  for(__typeof(e) i=(b); i!=(e+1)-2*(b > e); i =i+1-2*(b > e))
#define     Int         Int()
#define     Long        Long()
#define     Float       Float()
#define     Double      Double()
#define     all(x)      x.begin() , x.end()
#define     sz(x)       (int)x.size()
#define     ff          first
#define     ss          second
#define     pb          push_back
#define     eb          emplace_back
#define     mem(a)      memset(a , 0 ,sizeof a)
#define     memn(a)     memset(a , -1 ,sizeof a)
#define     biday       return 0 
#define     PI          3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342
 
 
int main()
{
	ll N,K,i;
	cin >> N >> K;

       ll A[N],sum=0;
	for(i=0; i<N; i++)cin >> A[i];
	sort(A,A+N);
	for(i=0; i<K; i++)sum+=A[i];
	cout << sum << endl;	
    

    biday;
}
 
//...............BYE BYE................

Measured memory_bytes: 3572
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


xs,ys,xt,yt = list(map(int, input().split()))
n = int(input())
xyr = [None]*(n+2)
for i in range(n):
    xyr[i] = tuple(map(int, input().split()))
from itertools import product
# ns = [[] for _ in range(n+2)]
data = []
rs = []
cs = []
s = n
t = n+1
xyr[s] = (xs,ys,0)
xyr[t] = (xt,yt,0)
for i,j in product(range(n+2), range(n+2)):
    if i<j:
        d = max(0, ((xyr[i][0]-xyr[j][0])**2 + (xyr[i][1]-xyr[j][1])**2)**0.5 - (xyr[i][2]+xyr[j][2]))
        data.append(d)
        rs.append(i)
        cs.append(j)
import scipy.sparse
m = scipy.sparse.csr_matrix((data, (rs, cs)), shape=(n+2, n+2))
ans = scipy.sparse.csgraph.dijkstra(m, indices=t, directed=False)
print(ans[s])

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

s = [input() for i in range(n)]

c0 = s.count('AC')
c1 = s.count('WA')
c2 = s.count('TLE')
c3 = s.count('RE')

print('AC x', c0)
print('WA x', c1)
print('TLE x', c2)
print('RE x', c3)

Measured memory_bytes: 16276
#pragma GCC optimze("Ofast")
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
using namespace std;
using namespace __gnu_pbds;
#define ll long long
#define pp pair<ll,ll>
#define ppp pair<ll,pp >
#define trace(...) cout<<"Line:"<<__LINE__<<" "; __f(#__VA_ARGS__, __VA_ARGS__)
template<typename Arg1>
void __f(const char* name, Arg1&& arg1) {
	cout<<name<<" : "<<arg1<<endl;
}
template<typename Arg1, typename ... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
	const char* comma=strchr(names+1,',');
	cout.write(names,comma-names)<<" : "<<arg1<<" | ";
	__f(comma+1,args...);
}
typedef tree<pp,null_type,less<pp>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
#define ld long double
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define rep(i,a,b) for(ll i=a;i<b;i+=1)
#define sz(v) (ll)(v.size())
#define hell (ll)1000000007
#define slld(x) scanf("%lld",&x)
ll t=1, tt;
const ll inf=1e18, N=200005;
inline ll mult(ll x,ll y){x%=hell;y%=hell;return (1LL*x*y)%hell;}
inline ll add(ll x,ll y){x+=y;return x%hell;}
inline ll powMod(ll base,ll expo){
	if(base==0)return 0;
	ll ans=1;
	while(expo){
		if(expo&1)ans=mult(ans,base);
		base=mult(base,base); 
		expo>>=1;
	}
	return ans;
}
void solve(){
	ll n;
	cin>>n;
	ll a[n][n];
	rep(i,0,n)
		rep(j,0,n)
			cin>>a[i][j];
	vector<ll> dp(1<<n);
	dp[0]=1;
	rep(mask,0,(1<<n)-1){
		ll cnt=__builtin_popcount(mask);
		rep(i,0,n){
			if(a[cnt][i] and !((mask>>i)&1))
				dp[mask|(1<<i)]=add(dp[mask|(1<<i)],dp[mask]);
		}
	}
	cout<<dp[(1<<n)-1];
}
signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
   	//cin>>t;
   	tt=t;
    while(t--){
        solve();
        if(t)cout<<"\n";
    }
    return 0 ;
}


Measured memory_bytes: 16640
using System;


namespace ConsoleApplication35
{
    class Program
    {
        static void Main(string[] args)
        {
            int S = int.Parse(Console.ReadLine());
            int h = S / 3600;
            int m = (S % 3600)/60;
            int s =((S % 3600)%60);


            Console.WriteLine(h+":"+m+":"+s);
        }
    }
}

Measured memory_bytes: 9064
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = n - 1; i >= 0; i--)
using namespace std;
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;
const int MOD2 = 998244353;


int main(){
    string s;
    cin >> s;
    int n = s.size();
    int a = 0, b = 0, c = 0;
    bool flag = true;
    rep(i, n) {
        if (s[i] == 'a') a++;
        if (s[i] == 'b') b++;
        if (s[i] == 'c') c++;
    }
    if (a == 0 || b == 0 || c == 0) flag = false;
    else if (abs(a-b) > 1 || abs(b-c) > 1 || abs(c-a) > 1) flag = false;
    if (s=="ab" || s=="ba" || s=="bc" || s=="cb" || s=="ca" || s=="ac" || s.size()==1) flag = true;

    if (flag) cout << "YES" << endl;
    else cout << "NO" << endl;


    return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = (s); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) for(int i = (n); i >= 0; i--)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << '\n';
#define CFYN(n) cout << ( (n) ? "YES":"NO") << '\n';
#define OUT(n) cout << (n) << '\n';
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;

int main(void)
{
    IOS
    int n, x, y;
    cin >> n >> x >> y;
    x--; y--;

    vector<int> ans(n+1);
    REP(i,n) FOR(j,i+1,n) {
        int d = j-i;
        int dx = abs(x-i);
        int dy = abs(y-j);
        d = min(d,dx+dy+1);
        ans[d]++;
    }

    FOR(i,1,n) {
        OUT(ans[i])
    }

    return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4") 
#include <bits/stdc++.h> 
using namespace std;
 
typedef long long ll;
typedef long double ld;
#define PI 3.1415926535897932384626 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd; 
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
 
#define Rep(i, a, b) for (int i=a; i<(b); i++)
#define rep(i, a) for (int i=0; i<(a); i++)
#define Dep(i,a,b) for (int i = (b)-1; i >= a; i--)
#define dep(i,a) for (int i = (a)-1; i >= 0; i--)
#define trav(a,x) for(auto& a : x)
 
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define ins insert
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); // Random No.
 
const int MOD = 1000000007;
const char nl = '\n';

void sol() {
    map<string, int> m;
    int N;
    m["AC"] = 0;
    m["WA"] = 0;
    m["TLE"] = 0;
    m["RE"] = 0;
    cin >> N;
    rep(i,N){
        string s;
        cin >> s;
        if(s=="AC"){m["AC"]++;}
        else if(s=="WA"){m["WA"]++;}
        else if(s=="TLE"){m["TLE"]++;}
        else if(s=="RE"){m["RE"]++;}
        
    }
    

    cout << "AC" << " x " << m["AC"]<<nl;
    cout << "WA" << " x " << m["WA"]<<nl;
    cout << "TLE" << " x " << m["TLE"]<<nl;
    cout << "RE" << " x " << m["RE"]<<nl;
    

}               

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

    #ifndef ONLINE_JUDGE
    	freopen("inputB.txt", "r", stdin);
	  #endif    
	
    int T=1;
    while(T--) {            
        sol();                
    }
	
	return 0;
}

Measured memory_bytes: 3672
#include "bits/stdc++.h"
using namespace std;
const int MOD = 1e9 + 7;
typedef long long lint;
#define int lint
const int INF =1e7;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repi(i, k, n) for (int i = (k); i < (int)(n); ++i)
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define all(x) (x).begin(),(x).end()
#define pb push_back
signed main(){
    int n;
    cin>>n;
    vi l(n);
    rep(i, n)
    {
        cin >> l[i];
    }
    sort(all(l));
    int sum = 0;
    rep(i,n-1){
        sum += l[i];
    }
    if(sum>l[n-1]){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}

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

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

	int N;
	int i,k;
	int ans=0;
	int ctr=0;

	cin >> N;

	if(N>=30)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;

	return 0;
}



Measured memory_bytes: 3644
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scan s = new Scan();
        String S = s.nS();
        String res = "Yes";
        if(S.equals("AAA") || S.equals("BBB"))res = "No";
        System.out.println(res);
    }
    
    static class Scan{
        private static Scanner sc = new Scanner(System.in);
        public static int nI(){
            return Integer.parseInt(sc.next());
        }
        public static long nL(){
            return Long.parseLong(sc.next());
        }
        public static String nS(){
            return sc.next();
        }
        public static double nD(){
            return Double.parseDouble(sc.next());
        }
    }
}


Measured memory_bytes: 23252
import sys
import os

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

MOD = 10 ** 9 + 7


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    S = iss()
    print('AC' if 'A' == S[0] and 'C' in S[2:-1] and S[1:].replace('C', '', 1).islower() else 'WA')


if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
from collections import defaultdict

def read_input():
    n = int(input())

    return n


def factorizer(x):
    limit = x

    factors = []
    t = x
    for i in range(2, limit + 1):
        while t % i == 0:
            factors.append(i)
            t /= i

    if not factors:
        factors.append(x)

    return factors


def submit():
    n = read_input()

    factors_occur = defaultdict(int)

    for i in range(2, n + 1):
        factors = factorizer(i)

        for f in factors:
            factors_occur[f] += 1

    occurs = [o for (k, o) in factors_occur.items()]

    acc = 1
    maxmod = (10**9) + 7
    for power in occurs:
        acc *= (power + 1)

    print(acc % maxmod)

if __name__ == '__main__':
    submit()


Measured memory_bytes: 43500
import java.util.*;

public class Main {
  
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String S = sc.next();
    String yyyy = S.substring(0, 4);
    String mm  = S.substring(5, 7);
    String dd = S.substring(8, 10);
    
    if (Integer.parseInt(yyyy) >= 2019 && Integer.parseInt(mm) >= 5) {
      System.out.println("TBD");
    } else {
      System.out.println("Heisei");
    }   
  }
}

Measured memory_bytes: 23636