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

public class Main {
	public static void main (String[] args) throws java.lang.Exception {
		new Solution();
	}
}
class Solution {
	Scanner scanner;
	public Solution() {
		scanner = new Scanner(System.in);

		// scanner.nextLine();
		while (scanner.hasNext()) {
			run_case();
		}
	}
	private void run_case() {
		// scanner.nextLine();
		String line = scanner.nextLine();
		StringBuilder res = new StringBuilder();
		for (int i=0; i<line.length(); i++) {
			res.append('x');
		}
		System.out.println(res.toString());
		return;
	}

	private int[] strToIntArray(String str) {
	    String[] vals = str.split("\\s+");
	    int sz = vals.length;
	    int[] res = new int[sz];
	    for (int i=0; i<sz; i++) {
	        res[i] = Integer.parseInt(vals[i]);
	    }
	    return res;
	}

}

class LCS {
    int[][] dp;
    public int lcs(String A, String B) {
        int sz_a = A.length(), sz_b = B.length();
        dp = new int[sz_a+1][sz_b+1];

        for (int i=0; i<=sz_a; i++) dp[i][0] = 0;
        for (int j=0; j<=sz_b; j++) dp[0][j] = 0;

        for (int i=1; i<=sz_a; i++) {
            for (int j=1; j<=sz_b; j++) {
                if (A.charAt(i-1) == B.charAt(j-1)) {
                    dp[i][j] = dp[i-1][j-1] + 1;
                } else {
                    dp[i][j] = Math.max(dp[i-1][j], dp[i][j-1]);
                }
            }
        }

        return dp[sz_a][sz_b];
    }

    public String getLCS(String X, String Y) {
		int m = X.length();
		int n = Y.length();
        // Following code is used to print LCS
        int index = dp[m][n];
        int temp = index;

        // Create a character array to store the lcs string
        char[] lcs = new char[index+1];
        lcs[index] = '\0'; // Set the terminating character

        // Start from the right-most-bottom-most corner and
        // one by one store characters in lcs[]
        int i = m;
		int j = n;
        while (i > 0 && j > 0) {
            // If current character in X[] and Y are same, then
            // current character is part of LCS
            if (X.charAt(i-1) == Y.charAt(j-1))
            {
                // Put current character in result
                lcs[index-1] = X.charAt(i-1);

                // reduce values of i, j and index
                i--;
                j--;
                index--;
            }

            // If not same, then find the larger of two and
            // go in the direction of larger value
            else if (dp[i-1][j] > dp[i][j-1])
                i--;
            else
                j--;
        }

        // // Print the lcs
        // System.out.print("LCS of "+X+" and "+Y+" is ");
        // for(int k=0;k<=temp;k++)
        //     System.out.print(lcs[k]);
        //

        return String.valueOf(lcs).substring(0, temp+2);
    }
}


Measured memory_bytes: 25300
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;
using namespace std;
typedef tree<pair<int,int>,null_type,less<pair<int,int>>,rb_tree_tag,tree_order_statistics_node_update> oset;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
	*this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
using ll = long long;

void test_case(){
	int a , b ,c , k; cin >> a >> b >> c >> k;
	if(k <= a){
		cout<<k<<"\n";
		return;
	}
	if(k <= a+b){
		cout<<a<<"\n";
		return;
	}
	cout<<a+(k-(a+b))*-1<<"\n";
}
 
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int T=1;
	//~ cin >> T;
	while(T--){
		test_case();
	}
	return 0;
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const ll INF = 1LL << 60;

int main() {
    string s; cin >> s;
    int num = 0;
    for (int i = 0; i < 4; i++) {
        if (s[i] == '+') num++;
        if (s[i] == '-') num--;
    }
    cout << num << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <functional>
#define int long long int
using namespace std;
int DP[2001][2001] = {0};
pair<int,int> val[2001];
signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin>>n;
    for(int i=1;i<=n;i++)
    {cin>>val[i].first;
    val[i].second = i;    }

    sort(val+1,val+(n+1),greater<pair<int,int>>());
    
    for(int i=1;i<=n;i++)
    {
        for(int j=0;j<i;j++)
        {
            int l = j;
            int r = i-1-j;
            DP[l+1][r] = max(DP[l+1][r], DP[l][r] + abs(val[i].second - l - 1)*val[i].first);
            r = j;
            l = i-1-j;
            DP[l][r+1] = max(DP[l][r+1], DP[l][r] + abs(n - r - val[i].second)*val[i].first); 
        }
    }

    int ans = 0;

    for(int i=0;i<=n;i++)
    ans = max(ans,DP[i][n-i]);

    cout<<ans;

    return 0;
}

Measured memory_bytes: 26344
def cin():
	return map(int,input().split())

def cino(test=False):
    if not test:
        return int(input())
    else:
        return input()
def cina():
  return list(map(int,input().split()))

def ssplit():
    return list(input().split())

a = ssplit()
print("A"+a[1][0].upper()+"C")

Measured memory_bytes: 3060
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <queue>
#include <cstring>
#include <string>
#include <stack>
#include <map>
#include <set>
#include <cmath>
#include <iomanip>
#include <ctime> 
using namespace std;

#define pb push_back
#define All(a) a.begin(), a.end()
#define met(a, b) memset(a, b, sizeof(a))
#define rep1(i, l, r) for(int i = l; i <= r; ++i)
#define rep2(i, l, r) for(int i = l; i < r; ++i) 
#define per(i, r, l) for(int i = r; i >= l; --i)
typedef long long ll;
typedef double db;
typedef long double ldb;
const int NIL = -1;
const int oo = 0x3f3f3f3f;
const ll INF = 2e18;
const db eps = 1e-8;
const db PI = acos(-1.0);

inline int read(void)
{
	int x = 0, f = 1; char ch = getchar();
	while(ch < '0' || ch > '9')	{ if(ch == '-') f = -1; ch = getchar(); } 
	while(ch >= '0' && ch <= '9') {	x = (x << 1) + (x << 3) + ch - '0';	ch = getchar();	}
	return x * f;
}

inline void write(int x)
{
	if(x < 0) { putchar('-'); x = -x; }
    if(x >= 10) write(x/10); 
	putchar(x%10+'0'); 
}

int main(void)
{
	int a, b, c;
	scanf("%1d%1d%1d", &a, &b, &c);
	if(a == 1) a = 9;
	else if(a == 9) a = 1;
	if(b == 1) b = 9;
	else if(b == 9) b = 1;
	if(c == 1) c = 9;
	else if(c == 9) c = 1;
	printf("%d%d%d", a, b, c);
 	
	return 0;
} 

Measured memory_bytes: 256
#ifdef __GNUC__
#pragma GCC diagnostic ignored "-Wunused-result"
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#endif

#include <algorithm>
#include <cmath>
#include <cstring>
#include <iostream>
#include <sstream>
#include <numeric>
#include <map>
#include <set>
#include <queue>
#include <vector>

using namespace std;

typedef long long LL;
typedef long double LD;
typedef pair<LL, LL> II;
typedef pair<LL, II> III;
typedef priority_queue<III, vector<III>, greater<>> Queue;
static const LL INF = 1LL << 60;

template<typename T, long long SIZE, T DEF_VAL, const T& Compare(const T&, const T&)>
class SegmentTree {
	vector<T> val;
public:
	SegmentTree() : val(SIZE * 2, DEF_VAL) { }
	void update(long long i, const T& value) {
		i += SIZE;
		val[i] = value;
		while (i > 1) i >>= 1, val[i] = Compare(val[i * 2], val[i * 2 + 1]);
	}
	T get(long long a, long long b, long long l = 0, long long r = SIZE, long long i = 1) {
		if (r <= a || b <= l) return DEF_VAL;
		if (a <= l && r <= b) return val[i];
		return Compare(get(a, b, l, (l + r) / 2, i * 2), get(a, b, (l + r) / 2, r, i * 2 + 1));
	}
	long long find_leftmost_index(long long a, long long b, const T& value, long long l = 0, long long r = SIZE, long long i = 1) {
		if (Compare(val[i], value) != val[i]) return -1;
		if (r <= a || b <= l) return -1;
		if (i >= SIZE) return i - SIZE;
		long long leftmost_index = find_leftmost_index(a, b, value, l, (l + r) / 2, i * 2);
		if (leftmost_index >= 0) return leftmost_index;
		return find_leftmost_index(a, b, value, (l + r) / 2, r, i * 2 + 1);
	}
	long long find_rightmost_index(long long a, long long b, const T& value, long long l = 0, long long r = SIZE, long long i = 1) {
		if (Compare(val[i], value) != val[i]) return -1;
		if (r <= a || b <= l) return -1;
		if (i >= SIZE) return i - SIZE;
		long long rightmost_index = find_rightmost_index(a, b, value, (l + r) / 2, r, i * 2 + 1);
		if (rightmost_index >= 0) return rightmost_index;
		return find_rightmost_index(a, b, value, l, (l + r) / 2, i * 2);
	}
};
typedef SegmentTree<long long, 1 << 19, -1, max> MaxSegTree;

void solve(long long N, long long K, std::vector<long long> &A) {
	LL ans = 0;
	MaxSegTree st;
	vector<LL> dp(N + 1);
	for (LL i = 0; i < N; ++i) {
		LL x = A[i];
		LL mn = max(0LL, x - K), mx = min(300000LL, x + K);
		LL y = max(0LL, st.get(mn, mx + 1)) + 1;
		st.update(x, y);
		ans = max(ans, y);
	}
	cout << ans << endl;
}

int main() {
    long long N;
	std::cin >> N;
	long long K;
	std::cin >> K;
	std::vector<long long> A(N);
	for (int i = 0; i < N; i++) {
		std::cin >> A[i]; // A[i]--;
	}
	solve(N, K, A);
	return 0;
}


Measured memory_bytes: 16204
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <tuple>
#include <cstdio>
#include <bitset>
#include <sstream>
#include <iterator>
#include <numeric>
#include <map>
#include <cstring>
#include <set>
#include <functional>
#include <iomanip>

using namespace std;

//#define DEBUG_ //!!提出時にコメントアウト!!
#ifdef DEBUG_
	#define dump(x)  cerr << #x << " = " << (x) << endl;
#else
	#define dump(x)  ;
#endif

#define equals(a,b) (fabs((a)-(b)) < EPS)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SZ(x) ((int)(x).size())
#define pb push_back
#define eb emplace_back

//#define int long long

typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;

template <typename T>
std::string printVector(const std::vector<T> &data)
{
    std::stringstream ss;
    std::ostream_iterator<T> out_it(ss, ", ");
    ss << "[";
    std::copy(data.begin(), data.end() - 1, out_it);
    ss << data.back() << "]";
    return ss.str();
}

template <typename T>
void print_array(const T &ary, int size){
    REP(i,size){
        cout << ary[i] << " ";
    }
    cout << endl;
}

const int MOD = 1e9+7;
const LL LINF = 1001002003004005006ll;
const int INF = 1001001001;
const double EPS = (1e-10);

signed main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(12);

    int N; cin >> N;
    int base = 2;
    int cnt = 1;
    while(base < N){
        base *= 2;
        cnt++;
    }
    dump(cnt)
    REP(i,N-1){
        FOR(j,i+1,N){
            dump(i)
            dump(j)
            for(int d = 0; d < cnt; d++){
                if(((i >> d)&1) != ((j >> d)&1)){
                    cout << d+1 << " ";
                    break;
                }
            }
        }
        cout << endl;
    }

}


Measured memory_bytes: 512
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cstdlib>
#include <cmath>
#include<stdio.h>
#include<queue>
#define MAX 1000000000000000000LL
long long inf=1000000007;
using namespace std;

int main(){
    int n;
    string s;
    cin>>n;
    int x=0;
    int max=0;
    for(int i=0; i<n; i++){
        cin>>s[i];
        if(s[i]=='I')x++;
        else if(s[i]=='D')x--;
        
        if(max<x)max=x;
    }
    cout<<max<<endl;
    return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
import sys

YES = "Yes"  # type: str
NO = "No"  # type: str


def solve(S: str):
    N = len(S)
    head = S[:(N-1)//2]
    tail = S[(N-1)//2+1:]

    reversed_head = head[::-1]
    reversed_tail = tail[::-1]
    reversed_S = S[::-1]
    if head == reversed_head and tail == reversed_tail and reversed_S == S:
        print("Yes")
    else:
        print("No")
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = next(tokens)  # type: str
    solve(S)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int N=200005;
int ne[N],tot,d[N],fi[N],zz[N],sd[N],Max[N],n,x[N],y[N];
void jb(int x,int y){
	ne[++tot]=fi[x];
	fi[x]=tot;
	zz[tot]=y;
}
void dfs(int x,int y){
	for (int i=fi[x];i;i=ne[i])
		if (zz[i]!=y){
			sd[zz[i]]=sd[x]+1;
			d[x]++;
			dfs(zz[i],x);
		}
	Max[sd[x]]=max(Max[sd[x]],d[x]);
}
signed main(){
	scanf("%lld",&n);
	for (int i=1;i<n;i++){
		scanf("%lld%lld",&x[i],&y[i]);
		jb(x[i],y[i]);jb(y[i],x[i]);
	}
	int Ans1=1e9,Ans2=0;
	for (int i=1;i<=n;i++){
		int t=0,maxsd=0;
		memset(Max,0,sizeof Max);
		memset(d,0,sizeof d);
		memset(sd,0,sizeof sd);
		dfs(i,0);
		for (int i=1;i<=n;i++)maxsd=max(maxsd,sd[i]);
		for (int i=0;i<=n;i++)if (Max[i]){
			t*=Max[i];
			for (int j=1;j<=n;j++)
				if (sd[j]==i)t+=Max[i]-d[j];
		}
		else {
			for (int j=1;j<=n;j++)
				if (sd[j]==i)t++;
			break;
		}
		if (maxsd<Ans1||(maxsd==Ans1&&t<Ans2)){
			Ans1=maxsd;Ans2=t;
		}
	}
	for (int i=1;i<n;i++){
		int t=0,maxsd=0;
		memset(Max,0,sizeof Max);
		memset(d,0,sizeof d);
		memset(sd,0,sizeof sd);
		dfs(x[i],y[i]);dfs(y[i],x[i]);
		for (int i=1;i<=n;i++)maxsd=max(maxsd,sd[i]);
		for (int i=0;i<=n;i++)if (Max[i]){
			t*=Max[i];
			for (int j=1;j<=n;j++)
				if (sd[j]==i)t+=Max[i]-d[j];
		}
		else {
			for (int j=1;j<=n;j++)
				if (sd[j]==i)t++;
			break;
		}
		if (maxsd<Ans1||(maxsd==Ans1&&t<Ans2)){
			Ans1=maxsd;Ans2=t;
		}
	}
	printf("%lld %lld\n",Ans1+1,Ans2);
}

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

L = list(input().strip())
m = {}

for v in L:
    if m.get(v) == None:
        m[v] = 0
    m[v] += 1
    
for v in m.values():
    if v != 2:
        print("No")
        exit()
        
print("Yes")

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

using namespace std;

typedef long long ll;

int main(){
	int n;
	scanf("%d", &n);
	ll v[n];
	ll max_n = 0;
	for(int i=0; i<n; i++){
		cin >> v[i];
		max_n = max(max_n, v[i]);
	}
	
	ll a, b;
	double best = 1123456789.0;
	
	for(int i=0; i<n; i++){
		if(v[i] == max_n) continue;
		
		if(best > abs((double)max_n/2. - (double)v[i])){
			a = max_n;
			b = v[i];
			best = abs((double)max_n/2. - (double)v[i]);
		}
	}
	
	printf("%lld %lld\n", a, b);
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
using P = pair<ll, ll>;

int main(){
    ll N, K;
    cin >> N >> K;
    ll cnt = 0;
    for(ll i = 1; i <= N; i += 2) cnt++;
    cout << (cnt >= K ? "YES\n" : "NO\n");
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<cstdio>
#include<vector>
#include<algorithm>
using namespace std;
#define Maxn 100010
char ch[Maxn];
int len;
int bel[Maxn],cnt=0;
int to[Maxn][110],ans[Maxn];
int Fast_Pow(int a,int b,int mod){
	int ans=1;
	while(b){
		if(b&1)ans=1ll*ans*a%mod;
		b>>=1;
		a=1ll*a*a%mod;
	}
	return ans;
}
int main(){
	scanf("%s",ch);
	len=strlen(ch);
	for(int i=0;i<len;++i)
	    if(ch[i]=='L')to[i][0]=i-1;
	    else to[i][0]=i+1;
	for(register int j=1;j<=100;++j)
	    for(register int i=0;i<len;++i){
	    	int at=i;
	    	for(register int k=1;k<=10;++k){
			     at=to[at][j-1];
			 }
	    	to[i][j]=at;
		}
	for(register int i=0;i<len;++i)ans[to[i][100]]++;
	for(register int i=0;i<len;++i)printf("%d ",ans[i]);
	return 0;
} 

Measured memory_bytes: 43904
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 = sc.nextInt();
		int x = sc.nextInt();
		int[] m = new int[n];
		
		int min = 0;
		int count = 0;
		
		for (int i = 0; i < n; i++) {
			m[i] = sc.nextInt();
			if(x - m[i] > 0) {
				x -= m[i];
				count++;
			}
		}
		sc.close();
		Arrays.sort(m);
		min = m[0];
		while(x >= min) {
			x -= min;
			count++;
		}
		System.out.println(count);
	}
}


Measured memory_bytes: 21844
n,m = map(int, input().split())
h = list(map(int, input().split()))
ma = [0 for i in range(n)]
for i in range(m):
    a,b =  map(int, input().split())
    ma[a-1] = max(ma[a-1],h[b-1])
    ma[b-1] = max(ma[b-1],h[a-1])
ans=0
for i in range(n):
    ans += h[i] > ma[i]

print(ans)

Measured memory_bytes: 20052
cardlist = [[i for i in range(1,14)] for j in range(4)]
n=int(input())
for s in range(0,n):
  x,y=(input().split())
  y=int(y)
  if   x =="S":
    cardlist[0].remove(y)
  elif x =="H":
    cardlist[1].remove(y)
  elif x =="C":
    cardlist[2].remove(y)
  else:
    cardlist[3].remove(y)
for i in cardlist[0]:
  print("S",i)
for i in cardlist[1]:
  print("H",i)
for i in cardlist[2]:
  print("C",i)
for i in cardlist[3]:
  print("D",i)
  

Measured memory_bytes: 7692
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define rep2(i,s,n) for (int i = s; i < n; ++i)
#define all(a) a.begin(),a.end()
#define tmax(a,b,c) max(a,max(b,c))
#define tmin(a,b,c) min(a,min(b,c))
#define pb push_back
using namespace std;
using ll = long long;
using P = pair<int,int>;
template<class T> inline bool chmin(T& a,T b) {if(a > b){a = b; return true;} return false;}
template<class T> inline bool chmax(T& a,T b) {if(a < b){a = b; return true;} return false;}
const int inf = 1001001001;

int main() {
    int n,k,q;
    cin >> n >> k >> q;
    vector<int> mem(n,0);
    rep(i,q) {
        int a;
        cin >> a;
        a--;
        mem[a]++;
    }
    rep(i,n) {
        if(k+mem[i] > q) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
}

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




int main() {
	int N, K,hav,tmp,count=0;
	cin >> N >> K;
	vector<bool> sNum(N,0);
	for (int i = 0; i < K ; i++)
	{
		cin >> hav;
		for (int j =0; j < hav; j++)
		{
			cin >> tmp;
			sNum.at(tmp-1) = 1;
		}
	}
	
	for (int i = 0; i < N; i++)
	{
		if (sNum.at(i) == 0)count++;
	}
	cout << count << endl;
}

Measured memory_bytes: 3632
#include "stdio.h"
int v[10][10],ch[10],c=1,n;
long long int ans=0;
void dfs(int now,int k[10],int cou)
{
    if(cou>=n) {ans++;return;}
    for(int i=1;i<=n;i++)
    {
        if(v[now][i]==1&&k[i]==0)
        {
            int temp[10];
             for(int j=1;j<=n;j++) temp[j]=k[j];
            temp[i]=1;
            dfs(i,temp,cou+1);
        }
    }
    return ;
}
main()
{
    int m,a,b;
    scanf("%d %d",&n,&m);
    for(int i=1;i<=m;i++)
    {
        scanf("%d %d",&a,&b);
        v[a][b]=1; v[b][a]=1;
    }
    ch[1]=1;
    dfs(1,ch,c);
    printf("%d",ans);
}


Measured memory_bytes: 128
#include <bits/stdc++.h>                 // [PRIMES]               1777 ~2^10.80
using namespace std;                     //                       10333 ~2^13.33
using ll=long long;                      // seq 1 128 | factor   100333 ~2^16.61
using vl=vector<ll>;                     //   | grep -v ' .* '  1300111 ~2^20.31
using vvl=vector<vl>;                    //                    10300777 ~2^23.30
using vb=vector<bool>;                   //                   100400999 ~2^26.58
using vs=vector<string>;                 //                  1300400999 ~2^30.28
using pll=pair<ll,ll>;                   //                 10200500333 ~2^33.25
const ll oo =0x3f3f3f3f3f3f3f3fLL;       //                100200400777 ~2^36.54
const double eps=1e-9;                   //               1200300700111 ~2^40.13
#define sz(c) ll((c).size())             //              10200300500777 ~2^43.21
#define all(c) begin(c),end(c)           //             100200300400777 ~2^46.51
#define mp make_pair                     //            1200300400600999 ~2^50.09
#define mt make_tuple                    //           10200300400600111 ~2^53.18
#define pb push_back                     //          100200300400600333 ~2^56.48
#define eb emplace_back                  //         1200300400500800999 ~2^60.06
#define xx first
#define yy second
#define FOR(i,a,b) for(ll i=(a); i<(b); i++)
#define FORD(i,a,b) for(ll i=ll(b)-1;i>=(a);i--)
#define TR(X) ({if(1) cerr << "TR: " << (#X) << " = " << (X) << endl; })

int main(){
	cin.sync_with_stdio(0);
	// cin.tie(0);

	ll a;
	cin >> a;
	if (a < 3200) {
		cout << "red";
	} else {
		string s;
		cin >> s;
		cout << s;
	}
	cout << "\n";

}


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

int main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;

  if ((a + b ) > (c + d)) {
    cout << "Left" << endl;
  }
  else if ((a +b ) < (c + d)) {
    cout << "Right" << endl;
  }
  else {
    cout << "Balanced" << endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    char s[5];
    scanf("%s",s);
    int a=(s[0]-'0')*10+s[1]-'0',b=(s[2]-'0')*10+s[3]-'0';
    if(a>=1&&a<=12&&b>=1&&b<=12)
        printf("AMBIGUOUS\n");
    else if(a>=1&&a<=12)
        printf("MMYY\n");
    else if(b>=1&&b<=12)
        printf("YYMM\n");
    else printf("NA\n");
}


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

int main(){
  int N;
  string s;
  cin >> N;
  int n = N % 28;
  if(n==0|n==4|n==8|n==12|n==16|n==20|n==24|n==7|n==11|n==15|n==19|n==23|n==27|n==14|n==18|n==22|n==26|n==21|n==25){
    s ="Yes";
  }else{
    s ="No";
  }

  cout << s <<"\n";
}

Measured memory_bytes: 256
/*---------------Go Code GO---------------*/

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

template <typename T>
using Order_Set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
//(order) Set.order_of_key(); (pointer) Set.find_by_order();

#define PI acos(-1.0)
#define O_O                           \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL)
#define precision(a) fixed << setprecision(a)
#define endl '\n'
#define Flush cout << flush
#define LLMX 0x3fffffffffffffff

long long N;

int main()
{
    O_O;

    long long N;
    cin >> N;
    long long sum[N], val[N];
    for (int i = 0; i < N; i++)
    {
        cin >> val[i];
    }
    for (int i = 0; i < N; i++)
    {
        cin >> sum[i];
    }
    long long ans = 0;
    for (int i = 0; i < (1LL << N); i++)
    {
        long long x = 0;
        long long y = 0;
        for (int j = 0; j < N; j++)
        {
            if (i & (1LL << j))
            {
                y += sum[j];
                x += val[j];
            }
        }
        ans = max(ans, (x - y));
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3600
import java.io.*;

class Main {
	public static void main(String[] args){
		try{
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			int m, f, r;

			while(true){
				String buf = br.readLine();
				String[] line = buf.split(" ");
				m = Integer.parseInt(line[0]);
				f = Integer.parseInt(line[1]);
				r = Integer.parseInt(line[2]);
				
					if(m == -1 && f == -1 && r == -1) break;			
					if(m == -1 || f == -1){
						System.out.println("F");
					} else if(m+f >= 80 ){
						System.out.println("A");
					} else if ((m+f) >= 65 && 80 > (m+f)){
						System.out.println("B");
					} else if ((m+f) >=50 && 65 > m+f){
						System.out.println("C");
					} else if ( m+f >=30 && 50 > m+f ){
						if(r < 50){
							System.out.println("D");
						}else if ( r >=50){
							System.out.println("C");
						}
					} else if ( m+f < 30){
						System.out.println("F");
					}
			
			}
		}catch(Exception e){
		}
	}
}

Measured memory_bytes: 24392
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define ll long long
using namespace std;

int a, b;


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);

    cin >> a >> b;

    int ans = max(a + b, a - b);
    ans = max(ans, a * b);
    cout << ans << endl;


    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#include<functional>
#define MM 1000000000000000000
using namespace std;
int main(void)
{
	int n,i,flg;
	long long a[100000],mlt,mm;
	scanf("%d",&n);
	for(i=0;i<n;i++)	scanf("%lld",&a[i]);
	flg=1;
	for(i=0;i<n;i++)	{
		if(a[i]==0)	{
			flg=2;
			break;
		}
	}
	if(flg==1)	{
		mlt=a[0];
		for(i=1;i<n;i++)	{
			if(mlt>MM/a[i])	{
				flg=0;	break;
			}
			mlt*=a[i];
			if(mlt>MM)	{
				flg=0;	break;
			}
		}
	}
	if(flg==0)	printf("-1\n");
	else if(flg==2)	printf("0\n");
	else printf("%lld\n",mlt);
	return 0;
}

Measured memory_bytes: 2436
use std::io::{self, BufRead};

fn main() {
    let stdin = io::stdin();
    let mut lines = stdin.lock().lines();
    let n: usize = lines.next().unwrap().unwrap().parse().unwrap();
    let l = lines.next().unwrap().unwrap();
    let mut l: Vec<usize> = l.split_whitespace().map(|s| s.parse().unwrap()).collect();
    l.sort();

    let mut ans = 0;
    for i in 0..n {
        for j in i + 1..n {
            let a = l[i];
            let b = l[j];

            let mut left = j;
            let mut right = n;
            while right - left > 1 {
                let middle = (left + right) / 2;
                if l[middle] < a + b {
                    left = middle;
                } else {
                    right = middle;
                }
            }

            ans += left - j;
        }
    }

    println!("{}", ans);
}


Measured memory_bytes: 4352
#include<iostream>
using namespace std;
#define ll long long
#define ull unsigned long long int
#define fast  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define w(t)            int t; cin>>t; while(t--)
const int mod = 1000000007;
bool comp(pair<ll,ll>& a, pair<ll,ll>& b)
{
    if(a.second == b.second)
    return a.first > b.first;
    else
    return b.second < a.second;
}
int main()
{
    fast

        int n;
        cin>>n;
        cout<<(1000-(n%1000))%1000<<endl;


    return 0;
}


Measured memory_bytes: 3660
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <utility>
#include <set>
#include <stack>
#include <climits>
#include <cmath>
#include <iomanip>
#include <unordered_map>
#include <map>
#include <boost/multiprecision/cpp_int.hpp>

#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 reps(i,s,n) for(int i=s, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define MEMSET(v, h) memset((v), h, sizeof(v))
typedef long long ll;
typedef long double ld;
const char sp = ' ';

using namespace boost::multiprecision;
using namespace std;

int main(void){
    ll N;
    cin>>N;
    ll upp;
    rep1(i, 10000){
        if(i*(i+1)/2>=N){
            
            upp=i; break;
        }
    }
    while(true){
        if(upp<=N){
            N-=upp;
            cout<<upp<<endl;
        }
        if(N==0) break;
        upp--;
    }
    return 0;
}


Measured memory_bytes: 3612
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops")
#pragma GCC optimize("no-stack-protector,fast-math")
#define IO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
#define ld long double
const int N =1e4+5;
map<char , int>mp;
string s;
int main(){
    cin>>s;
    bool flag=1;
    for(int i=0;i<s.size();i++)
         mp[s[i]]++;
    for(auto i=mp.begin();i!=mp.end();i++)
    {
         if(i->second%2!=0)
         {
              flag=0;
              break;
         }
    }
    (flag)?printf("Yes\n"):printf("No\n");
}


Measured memory_bytes: 256
/* #region template */
#![allow(unused_imports)]
use std::io::{stdin, stdout, Bytes, Read, Stdin, StdinLock, Stdout, StdoutLock, Write};
use std::mem::swap;
use std::str::FromStr;
#[allow(dead_code)]
struct Io<'a> {
    reader: Bytes<StdinLock<'a>>,
    writer: StdoutLock<'a>,
    in_buf: [u8; BUF_SIZE],
}
#[allow(dead_code)]
impl<'a> Io<'a> {
    fn new(stdin: &'a Stdin, stdout: &'a Stdout) -> Io<'a> {
        Io {
            reader: stdin.lock().bytes(),
            writer: stdout.lock(),
            in_buf: [0; BUF_SIZE],
        }
    }
    fn r<T: FromStr>(&mut self) -> T {
        let mut count = 0;
        loop {
            match self.reader.next() {
                Some(Ok(b' ')) | Some(Ok(b'\n')) => break,
                Some(Ok(c)) => self.in_buf[count] = c,
                _ => panic!(),
            }
            count += 1;
        }

        let s = unsafe { std::str::from_utf8_unchecked(&self.in_buf[0..count]) };
        s.parse().unwrap_or_else(|_| panic!())
    }
    fn ru(&mut self) -> usize {
        self.r()
    }
    fn iter<'b, T>(&'b mut self) -> IoIter<'a, 'b, T> {
        IoIter::new(self)
    }
    fn c<T: FromStr>(&mut self, n: usize) -> Vec<T> {
        self.iter().take(n).collect()
    }
    fn cu(&mut self, n: usize) -> Vec<usize> {
        self.c(n)
    }
    fn w<T: std::fmt::Display>(&mut self, v: T) {
        writeln!(self.writer, "{}", v).unwrap();
    }
    fn wn<T: std::fmt::Display>(&mut self, v: T) {
        write!(self.writer, "{}", v).unwrap();
    }
}
#[allow(dead_code)]
struct IoIter<'a: 'b, 'b, T> {
    io: &'b mut Io<'a>,
    m: std::marker::PhantomData<T>,
}
#[allow(dead_code)]
impl<'a: 'b, 'b, T> IoIter<'a, 'b, T> {
    fn new(io: &'b mut Io<'a>) -> IoIter<'a, 'b, T> {
        IoIter {
            io,
            m: std::marker::PhantomData,
        }
    }
}
impl<'a, 'b, T: FromStr> Iterator for IoIter<'a, 'b, T> {
    type Item = T;
    fn next(&mut self) -> Option<Self::Item> {
        Some(self.io.r())
    }
}
fn main() {
    let stdin = stdin();
    let stdout = stdout();
    let mut io = Io::new(&stdin, &stdout);
    unsafe {
        solve(&mut io);
    }
}
/* #endregion */

const BUF_SIZE: usize = 1024;

unsafe fn solve(io: &mut Io) {
    let k = io.ru();
    let a = io.ru();
    let b = io.ru();
    for i in 1..1000 {
        let p = i * k;
        if a <= p && p <= b {
            io.w("OK");
            return;
        }
    }
    io.w("NG");
}


Measured memory_bytes: 2160
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <queue>
#include <set>
#include <numeric>
#include <cmath>

using namespace std;

typedef long long int lld;

const lld mod = 1e9+7;
const lld INF = 1e9;
//const lld MAXN = 1e9;

int main()
{
	int n;
	string c;

	cin >> n >> c;

	int vleft = 0,vright = 0;
	int left = 0,right = 0;
	int p = 0;

	for(int i = 0; i < n; i++)
	{
		if (c[i] == '(')
		{
			left++;
		}else
		{
			right++;
			if (left != 0)
			{
				right--;
				left--;
				p++;
			}
		}
	}

	if (right > 0)
	{
		for(int i = 0; i < right; i++)
		{
			cout << "(";
		}
	}

	cout << c;

	if (left > 0)
	{
		for(int i = 0; i < left; i++)
		{
			cout << ")";
		}
	}

	cout << endl;

	return 0;
}

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

int main() {
	string s;
	getline(cin, s);
	vector<string>v;

	string sa;

	for (int i = 0;i < s.size();i++) {
		if (s[i] == ' ' || s[i] == ','||s[i] == '.'||i+1==s.size()) {
			if (sa.size() >= 3 && sa.size() <= 6)v.push_back(sa);
			sa.clear();
		}
		else sa.push_back(s[i]);
	}

	int a = v.size();
	for (int i = 0;i < a;i++) {
		cout << v[i];
		if (i + 1 != a)cout << ' ';
		else cout << endl;
	}
	return 0;
}

Measured memory_bytes: 3092
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		String s=sc.next();
		int bl=s.replaceAll("R","" ).length();
		int rl=s.replaceAll("B","" ).length();
		if(rl>bl) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
	}

}

Measured memory_bytes: 23764
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {

    static int H, W;

    public static void main(String[] args) {
        FastScanner sc = new FastScanner(System.in);
        H = sc.nextInt();
        W = sc.nextInt();

        System.out.println(solve());
    }

    static long solve() {
        if( H == 1 && W == 1 ) {
            return 1;
        } else if( H == 1 ) {
            return W - 2;
        } else if ( W == 1 ) {
            return H - 2;
        } else {
            return (long)(H-2) * (W-2);
        }
    }

    @SuppressWarnings("unused")
    static class FastScanner {
        private BufferedReader reader;
        private StringTokenizer tokenizer;

        FastScanner(InputStream in) {
            reader = new BufferedReader(new InputStreamReader(in));
            tokenizer = null;
        }

        String next() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        String nextLine() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    return reader.readLine();
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken("\n");
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        int[] nextIntArray(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt();
            return a;
        }

        long[] nextLongArray(int n) {
            long[] a = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = nextLong();
            return a;
        }
    }
}


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

using namespace std;

#define rep(i, x)   for (__typeof(x) i = 0; i < x; i++)
#define mp             make_pair
#define pb             push_back
#define fi             first
#define se             second
#define sz(x)          (int)((x).size())
#define all(x)         (x).begin(), (x).end()
#define sci(x)         int x;       scanf("%d", &x);
#define scii(x, y)     int x, y;    scanf("%d %d", &x, &y);
#define sciii(x, y, z) int x, y, z; scanf("%d %d %d", &x, &y, &z);
#define TC(x)          sci(x); while(x --)
#define eprintf(...)   fprintf(stderr, __VA_ARGS__)
#define debug(x)       { cerr << #x << " = " << x << endl; }
#define repi(i, x)  for (__typeof(x) i = x-1; i >= 0; i --)
#define fore(itr, x)   for (__typeof(x.begin()) itr = x.begin(); itr != x.end(); itr ++)
#define forei(itr, x)  for (__typeof(x.end()) itr = x.end() - 1; itr != x.begin() - 1; itr --)
typedef long long      ll;
typedef pair<int, int> ii;
typedef pair<ii, int>  iii;
typedef vector<int>    vi;
typedef vector<ii>     vii;
typedef vector<iii>    viii;
typedef vector<vector<int>> VVI;
const   int            infi = numeric_limits<int>::max();
const   double         eps = 0;
const   int            ms  = 0;



int main(){
    int N, K, Q;
    int ans = infi;
    cin >> N >> K >> Q;
    vi A(N);
    rep(i, N)cin >> A[i];
    A.pb(-1);
    rep(i, N+1){
        vi ca;

        int Y = A[i];
        vi c;
        rep(j, N+1){
            if(A[j] < Y){
                if(c.size() >= K){
                sort(all(c));
                rep(k, c.size()-K+1)ca.pb(c[k]);
                }
                c.clear();
            }
            else c.pb(A[j]);
        }
        sort(all(ca));
        if(ca.size() < Q)continue;
        ans = min(ca[Q-1]-ca[0], ans);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#ifdef ENABLE_DEBUG_OUTPUT
#define DEBUG_LOG(s) cout << s << endl;
#else
#define DEBUG_LOG(s) void();
#endif

int main(){
    int n;
    string s, t;
    cin >> n >> s >> t;

    string ans(n * 2, '0');
    for (auto i = 0; i < n; i++) {
        ans[i * 2] = s[i];
        ans[i * 2 + 1] = t[i];
    }

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import sys


class BitFlag:
    #ALL_ON  = 0xffffffffffffffff
    ALL_OFF = 0x0000000000000000

    def __init__(self, mask_digits):
        self.FLAGS = self.ALL_OFF
        self.MaskFor1bit = [1 << i for i in range(64)]
        self.Masks = [self.make_mask(digits) for digits in mask_digits]

    @staticmethod
    def make_mask(digits):
        ret = 0
        for digit in digits:
            ret += 1 << digit
        return ret

    def _test(self, i):
        return self.FLAGS & self.MaskFor1bit[i] != self.ALL_OFF

    def _set(self, m):
        self.FLAGS |= self.Masks[m]

    def _clear(self, m):
        self.FLAGS &= ~self.Masks[m]

    def _flip(self, m):
        self.FLAGS ^= self.Masks[m]

    def _all(self, m):
        return self.FLAGS & self.Masks[m] == self.Masks[m]

    def _any(self, m):
        return self.FLAGS & self.Masks[m] != self.ALL_OFF

    def _none(self, m):
        return self.FLAGS & self.Masks[m] == self.ALL_OFF

    def _count(self, m):
        return bin(self.FLAGS & self.Masks[m]).count('1')

    def _val(self, m):
        return self.FLAGS & self.Masks[m]


nm = int(input())
digits = []
for i in range(nm):
    k, *arg = map(int, input().split())
    digits.append(arg)

bf = BitFlag(digits)

commands = {'0': bf._test,
            '1': bf._set,
            '2': bf._clear,
            '3': bf._flip,
            '4': bf._all,
            '5': bf._any,
            '6': bf._none,
            '7': bf._count,
            '8': bf._val
            }

qn = int(input())
lines = sys.stdin.readlines()
ans = [None] * qn

for i in range(qn):
    q, arg = lines[i].split()
    ans[i] = commands[q](int(arg))

[print(int(x)) for x in ans if x is not None]


Measured memory_bytes: 22132
#include<stdio.h>
int main ()
{ int a,b,c,d,e=0;
 scanf("%d",&a);
 b=a/3600;
 c=a%3600;
 d=c/60;
 e=c%60;
  printf("%d:%d:%d\n",b,d,e);
  return 0;
}
  

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

ans = 0
paper = {} #key:数字 value:出てきた回数

#いちいち書いて消してするのはTLEになりそうなので、出た回数で記録する

for i in range(N):
    A = int(input())
    
    if A not in paper:
        paper[A] = 1
        ans += 1
    else:
        paper[A] += 1
        if paper[A]%2 == 0:
            ans -= 1
        else:
            ans += 1
    
print(ans)

Measured memory_bytes: 15076
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1000000007;
const ll LINF=1LL<<60;
const int INF=1<<30;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){
	int x;cin>>x;
	x -= 400;
	x /= 200;
	cout << 8 - x << endl;
	return 0;
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define watch(x) cout << #x << " is " << x << endl;
#define print(a, l, r) \
    for (int i = l; i < r; i++) cout << a[i] << (i == (r - 1) ? endl : " ");
const long long M = 1000000007;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    long long n;
    cin >> n;
    pair<long long, long long> a[n];
    for (int i = 0; i < n; i++) {
        long long s, t;
        cin >> s >> t;
        long long l = s - t, r = s + t;
        a[i] = {l, r};
    }

    sort(a, a + n, [](const pair<long long, long long> &pa, const pair<long long, long long> &pb) {
        return pa.second < pb.second;
    });

    long long ans = 0;
    long long maxEnd = LLONG_MIN;
    for (int i = 0; i < n; i++) {
        if (maxEnd <= a[i].first) {
            ans++;
            maxEnd = max(maxEnd, a[i].second);
        }
    }
    cout << ans << endl;
    return 0;
}


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

using namespace std;

#define pb push_back
#define mp make_pair
#define fs first
#define fst first
#define sc second
#define snd second
#define sz(X) (int)(X).size()
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define fornr(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define forab(i, a, b) for(int i = int(a); i < int(b); i++)
#define all(X) X.begin(), X.end()

typedef long long ll;
typedef pair<int, int> pii;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef double dbl;
typedef long double ld;
typedef vector<int> vi;
typedef vector<pair<ll, ll>> vpll;

//mt19937 random(566);
//uniform_int_distribution<ll> distr;
//ll rnd(ll a, ll b) {return a + distr(random) % (b - a + 1);}

const int N = 2e3;
const ll MOD = 1e9 + 7;

vi g[N];

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    forn(i, n - 1) {
        g[i].pb(i + 1);
        g[i + 1].pb(i);
    }
    int x, y;
    cin >> x >> y;
    x--, y--;
    g[x].pb(y);
    g[y].pb(x);
    vi ans(n);
    forn(i, n) {
        vi d(n, -1);
        queue<int> q;
        q.push(i);
        d[i] = 0;
        while (!q.empty()) {
            int u = q.front();
            q.pop();
            for (int v : g[u]) {
                if (d[v] == -1) {
                    d[v] = d[u] + 1;
                    q.push(v);
                }
            }
        }
        forn(i, n) ans[d[i]]++;
    }
    forab(i, 1, n) cout << ans[i] / 2 << "\n";
    return 0;

}

Measured memory_bytes: 384
import sys
import numpy as np

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N = ir()
A = np.arange(1, 10)
B = A[:, None] * A[None, :]
bl = np.in1d(N, B)
print('Yes' if bl else 'No')


Measured memory_bytes: 12384
// luogu-judger-enable-o2
#include<bits/stdc++.h>
#pragma GCC optimize(3)
#pragma GCC optimize(2)
#pragma GCC optimize(1)
#define q register
#define ll long long
using namespace std;
string s;
ll tag1,tag2,ans,tot;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin>>s;
    for(q ll i=0;i<s.length();i++){
        if((s[i]=='C')&&(!ans)){
            tag1=i,ans++;
               tot=tag1;    
        }
        if(s[i]=='F'){
            tag2=i;   
            if(ans)   {
                puts("Yes");
                return 0;
            }
        }
    }
    puts("No");
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long int ll;
#define pb push_back
#define mp make_pair

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

    ll n;
    cin>>n;

    long double ans=(long double)n/3;
    ans=ans*ans*ans;
    printf("%.7llf",ans);


    return 0;
}


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

const long long MOD = 1000000007;
const long long INF = 1e9;

int main(){
  long long n,x,m;
  const long long max_x = 1e5;
  cin >> n >> x >> m;

  long long a = x;
  long long num[max_x + 1] = {};
  vector<long long> ans;
  ans.push_back(a);
  long long e = 0;
  num[x] = 1;
  do{
    a = a * a % m;
    num[a] = 1;
    ans.push_back(a);
    e = a*a%m;
  }while(num[a*a%m] == 0);

  // for(long long i = 0; i < ans.size(); i++) cout << ans[i] << endl;
  
  a = x;
  long long pos;
  for(long long i = 0; i < ans.size(); i++){
    if(ans[i] == e) pos = i;
  }

  long long cnt = ans.size() - pos;
  // cout << pos << endl;
  // cout << cnt << endl;
  // cout << ans.size() << endl;

  long long sum = 0;
  long long part = 0;
  for(long long i = pos; i < ans.size(); i++){
    part += ans[i];
  }

  for(long long i = 0; i < pos; i++){
    sum += ans[i];
  }
  long long n2 = n - pos;
  long long c = n2 / cnt;
  sum += part * c;
  for(long long i = pos; i < pos + n2 % cnt; i++){
    sum += ans[i];
  }
  cout << sum << endl;
  
  return 0;
}

Measured memory_bytes: 4636
#include<cstdio>
#include<iostream>
#include<cctype>
#include<cstring>
using namespace std;

#define ll long long
#define REP(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
#define MD 1000000007

char sep[2] = {' ', '\n'};

int main() {
  int i, j, k, n, m, l;

  char s1[210], s2[110], s3[210];
  cin >> s1 >> s2;
  strcpy(s3, s1);
  strcat(s3, s1);
  if (nullptr == strstr(s3, s2)) cout << "No" << endl;
  else cout << "Yes" << endl;

  return 0;
}
  

Measured memory_bytes: 1172
#include<stdio.h>
#include<math.h>
int main()
{
	long long a,b,c,k;
	scanf("%lld%lld%lld%lld",&a,&b,&c,&k);
		if(abs(a-b)>1000000000000000000)
		{
			printf("Unfair\n");
		}
	else{
		if(k%2==0)
		{
			printf("%lld\n",a-b);
		}
		else
		{
			printf("%lld\n",b-a);
		}
	}
	return 0;
}

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

int main() {
    const df pi = 3.141592653589793238463;
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    df n;
    cin >> n;
    df c = 2 * pi * n;
    cout << c << endl;
    return 0;
}

Measured memory_bytes: 3804
#include<bits/stdc++.h>
using namespace std;
 #include <ext/pb_ds/assoc_container.hpp> // Common file  
#include <ext/pb_ds/tree_policy.hpp>  
#include <functional> // for less  
#include <iostream>  
using namespace __gnu_pbds;  
using namespace std;

// typedef tree<int, null_type, less<int>, rb_tree_tag,tree_order_statistics_node_update>  ordered_set;
#define ll long long
typedef tree<pair<ll,ll>, null_type, less<pair<ll,ll> >, rb_tree_tag,tree_order_statistics_node_update>  ordered_set;
 
#define fr(i,a,b) for (ll i = (a), _b = (b); i <= _b; i++)
#define frr(i,a,b) for (ll i = (a), _b = (b); i >= _b; i--)
#define rep(i,n) for (ll i = 0, _n = (n); i < _n; i++)
#define repr(i,n) for (ll i = n - 1; i >= 0; i--)
#define fill(ar,val) memset(ar, val, sizeof(ar))
#define fill0(ar) fill((ar), 0)
#define debug(x) cout<<#x<<": "<<x<<endl
 
#define ld double
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
 
typedef pair<int, int> ii;
typedef pair<ii, int> iii;
typedef vector<ii> vii;
typedef vector<int> vi;
vector<ll> v[100005];
ll dp[100005];
ll mark[100005];
ll ans=0;
ll dfs(ll n)
{
    mark[n]=1;
    ll mx=0;
    rep(i,v[n].size())
    {
        ll x=v[n][i];
        if(mark[x])
        {
            mx=max(mx,dp[x]);
        }
        else
        {
            mx=max(mx,dfs(x));
        }
    }
    ans=max(ans,mx+1);
    return dp[n]=mx+1;
}
#define INF 1000000000000000000
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    long double pi= 3.14159265358979323846;
    ll n,m;
    cin>>n>>m;
    rep(i,m)
    {
        ll a,b;
        cin>>a>>b;
        a--;
        b--;
        v[a].pb(b);
    }
    rep(i,n)
    {
        rep(j,v[i].size())
        {
            if(!mark[v[i][j]])
            {
                dfs(v[i][j]);
            }
        }
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 9344