akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define INF 114514810
#define FOR(i, r, n) for(int i=(r); i<(n); i++) 
#define REP(i, n) FOR(i, (0), n)

using namespace std;

int n, point, out;
bool b[5];
string s;

int main(){
	cin >> n;
	REP(k, n){
		while (true){
			cin >> s;
			if (s == "HIT"){
				if (b[3]) { point++; b[3] = 0; }
				if (b[2]) { b[3] = 1; b[2] = 0; }
				if (b[1]) { b[2] = 1; }
				b[1] = 1;
			}
			else if (s == "OUT") {
				out++;
				if (out == 3) { cout << point << endl; break; }
			}
			else if (s == "HOMERUN"){
				if (b[1]) point++;
				if (b[2]) point++;
				if (b[3]) point++;
				point++;
				b[1] = b[2] = b[3] = 0;
			}
		}
		point = 0;
		out = 0;
		b[1] = b[2] = b[3] = 0;
	}
}

Measured memory_bytes: 1208
#include <iostream>
#include <algorithm>
#include <string>
#include <queue>
#include <cmath>
#include <map>
#include <iomanip>
#include <unordered_map>

using namespace std;
typedef long long  ll;

ll gcd(ll a, ll b)
{
	if (b == 0) return a;
	return gcd(b, a % b);
}

int main()
{
	ll N, M;
	cin >> N >> M;
	string s, t;
	cin >> s >> t;
	ll lms = N * M / gcd(N, M);
	ll p = lms / N, q = lms / M;
	for (ll i = 0; i < N / q; i++)
	{
		if (s[i * q] != t[i * p])
		{
			cout << -1 << endl;
			return 0;
		}
	}
	cout << lms << endl;
	return 0;
}

Measured memory_bytes: 512
package main

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

type bufReader struct {
	r   *bufio.Reader
	buf []byte
	i   int
}

var reader = &bufReader{
	bufio.NewReader(os.Stdin),
	make([]byte, 0),
	0,
}

func (r *bufReader) readLine() {
	if r.i < len(r.buf) {
		return
	}
	r.buf = make([]byte, 0)
	r.i = 0
	for {
		line, isPrefix, err := r.r.ReadLine()
		if err != nil {
			panic(err)
		}
		r.buf = append(r.buf, line...)
		if !isPrefix {
			break
		}
	}
}

func (r *bufReader) next() string {
	r.readLine()
	from := r.i
	for ; r.i < len(r.buf); r.i++ {
		if r.buf[r.i] == ' ' {
			break
		}
	}
	s := string(r.buf[from:r.i])
	r.i++
	return s
}

func (r *bufReader) nextLine() string {
	r.readLine()
	s := string(r.buf[r.i:])
	r.i = len(r.buf)
	return s
}

var writer = bufio.NewWriter(os.Stdout)

func next() string {
	return reader.next()
}

func nextInt64() int64 {
	i, err := strconv.ParseInt(reader.next(), 10, 64)
	if err != nil {
		panic(err)
	}
	return i
}

func nextInt() int {
	return int(nextInt64())
}

func nextLine() string {
	return reader.nextLine()
}

func out(a ...interface{}) {
	fmt.Fprintln(writer, a...)
}

func max64(x, y int64) int64 {
	if x > y {
		return x
	}
	return y
}

func max(x, y int) int {
	return int(max64(int64(x), int64(y)))
}

func min64(x, y int64) int64 {
	if x < y {
		return x
	}
	return y
}

func min(x, y int) int {
	return int(min64(int64(x), int64(y)))
}

func abs64(x int64) int64 {
	if x < 0 {
		return -x
	}
	return x
}

func abs(x int) int {
	return int(abs64(int64(x)))
}

func joinInt64s(a []int64, sep string) string {
	b := make([]string, len(a))
	for i, v := range a {
		b[i] = strconv.FormatInt(v, 10)
	}
	return strings.Join(b, sep)
}

func joinInts(a []int, sep string) string {
	b := make([]string, len(a))
	for i, v := range a {
		b[i] = strconv.Itoa(v)
	}
	return strings.Join(b, sep)
}

func divUp64(x, y int64) int64 {
	return (x + y - 1) / y
}

func divUp(x, y int) int {
	return int(divUp64(int64(x), int64(y)))
}

func gcd64(x, y int64) int64 {
	if x < y {
		x, y = y, x
	}
	for y != 0 {
		x, y = y, x%y
	}
	return x
}

func gcd(x, y int) int {
	return int(gcd64(int64(x), int64(y)))
}

func lcm64(x, y int64) int64 {
	return x * y / gcd64(x, y)
}

func lcm(x, y int) int {
	return int(lcm64(int64(x), int64(y)))
}

func main() {
	solve()
	writer.Flush()
}

func solve() {
	_, A, B := nextInt(), nextInt(), nextInt()
	S := nextLine()
	passed, rankB := 0, 0
	for _, c := range S {
		ans := "No"
		switch c {
		case 'a':
			if passed < A+B {
				passed++
				ans = "Yes"
			}
		case 'b':
			rankB++
			if passed < A+B && rankB <= B {
				passed++
				ans = "Yes"
			}
		}
		out(ans)
	}
}


Measured memory_bytes: 3328
#include <stdio.h>
#define sz 200009
typedef long long ll;
int ar[sz],br[sz];
int i,j,n,r,max=0;
int main()
{
	
	scanf("%d",&n);
	for (i=1; i<=n; i++)
	{
		scanf("%d",&r);
		if (r>max) max=r;
		br[i]=r;
		ar[r]++;
	}
	for (i=1; i<=n; i++)
	{
		for (j=max; ; j-- )
		{
			if (ar[j]>0)
			{
				if (j==br[i]){
			if (br[i]==max && ar[max]==1) continue;}
	         printf("%d\n",j);
	         break;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 2944
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using ll = long long;
using pii = pair<int,int>;
using vi = vector<int>;
using vs = vector<string>;
using vll = vector<long long>;
using vpii = vector<pair<int,int>>;
using vivi = vector<vector<int>>;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};



int main(void) {
  int a,b;
  cin >> a >> b;
  int k;
  k = (a+b)/2;
  if((a+b)%2==0) cout << k << endl;
  else cout << "IMPOSSIBLE" << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
//Optimisations
#pragma GCC target ("avx2")
#pragma GCC optimization ("unroll-loops")
#pragma GCC optimize("O2")
//shortcuts for functions
#define pb push_back
#define mp make_pair
#define ff first 
#define ss second
#define all(v) v.begin(),v.end()
#define prec(n) fixed<<setprecision(n)
#define n_l '\n'
// make it python 
#define gcd __gcd
#define append push_back
#define str to_string
// utility functions shortcuts
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define sswap(a,b) {a=a^b;b=a^b;a=a^b;}
#define swap(a,b) {auto temp=a; a=b; b=temp;}
#define init(dp) memset(dp,-1,sizeof(dp));
#define set0(dp) memset(dp,0,sizeof(dp));
#define bits(x) __builtin_popcount(x)
#define SORT(v) sort(all(v))
#define endl "\n"
#define forr(i,n) for(ll i=0;i<n;i++)
// declaration shortcuts
typedef long long int ll;
#define int ll
// Constants
constexpr int dx[] = {-1, 0, 1, 0, 1, 1, -1, -1};
constexpr int dy[] = {0, -1, 0, 1, 1, -1, 1, -1};
constexpr ll INF = 1999999999999999997; 
constexpr int inf= INT_MAX;
constexpr int MAXSIZE = int(1e6)+5;
constexpr auto PI  = 3.14159265358979323846L;
constexpr auto oo  = numeric_limits<int>::max() / 2 - 2;
constexpr auto eps = 1e-6;
constexpr auto mod = 1000000007;
constexpr auto MOD = 1000000007;
constexpr auto MOD9 = 1000000009;
constexpr auto maxn = 100006;
//void IOfile(){
//freopen(file_name, reade_mode, stdin);
//freopen(file_name, write_mode, stdout);
//}
void fastio(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
}
int32_t main(){
	fastio();
	int n;
	cin >> n;
	vector<pair<int,int>>v;
	for(int i = 0 ; i < n; i++){
		int a,b;
		cin >> a >> b;
		v.push_back({a,b});
	}
	int ans =0;
	for(int i = 0; i + 2 < n; i++){
		if(v[i].ff == v[i].ss and v[i + 1].ff == v[i + 1].ss and v[i + 2].ff == v[i + 2].ss){
			cout << "Yes";
			return 0;
		}
	}
	cout << "No";
}

Measured memory_bytes: 3676
import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for _ in range(N)]
def dp2(ini, i, j): return [[ini]*i for _ in range(j)]
def dp3(ini, i, j, k): return [[[ini]*i for _ in range(j)] for _ in range(k)]
#import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value
#from itertools import accumulate #list(accumulate(A))

# 繰り返し二乗法
def pow_r_mod(x:int, n:int, mod=10**9+7)->int:
    # 計算量 : log N
    if n == 0:
        return 1
    K = 1
    while n > 1:
        if n % 2 != 0:
            K *= x
        x *= x
        x %= mod
        n //= 2
    return (K * x) % mod

def table(n:int, p=10**9+7):
    global fact, factinv, inv
    fact = [1, 1]
    factinv = [1, 1]
    inv = [0, 1]
    for i in range(2, n+1):
        #fact.append((fact[-1] * i) % p)
        inv.append((-inv[p % i] * (p // i)) % p)
        #factinv.append((factinv[-1] * inv[-1]) % p)

m, a, b = mi()

P = 10**9+7
N = 2*(10**5)
#inv_t = [0]+[1]
# 逆元
#for i in range(2, N):
  #inv_t += [inv_t[P % i] * (P - int(P / i)) % P]
table(N)

mca = 1
for i in range(1, a+1):
    mca *= (m-i+1) * inv[i]
    mca %= P

mcb = mca
for i in range(a+1, b+1):
    mcb *= (m-i+1) * inv[i]
    mcb %= P

print((pow_r_mod(2, m)-1-mca-mcb) % P)
#print((mod_pow(2, m, P)-1-mca-mcb) % P)

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

#ifdef LOCAL
#define DEBUG(...) debug(#__VA_ARGS__, __VA_ARGS__);
#else
#define DEBUG(...) 6;
#endif

template<typename T, typename S> ostream& operator << (ostream &os, const pair<T, S> &p) {return os << "(" << p.first << ", " << p.second << ")";}
template<typename C, typename T = decay<decltype(*begin(declval<C>()))>, typename enable_if<!is_same<C, string>::value>::type* = nullptr>
ostream& operator << (ostream &os, const C &c) {bool f = true; os << "["; for (const auto &x : c) {if (!f) os << ", "; f = false; os << x;} return os << "]";}
template<typename T> void debug(string s, T x) {cerr << s << " = " << x << "\n";}
template<typename T, typename... Args> void debug(string s, T x, Args... args) {cerr << s.substr(0, s.find(',')) << " = " << x << " | "; debug(s.substr(s.find(',') + 2), args...);}

int n, a[200005], st[800005];

void build(int p, int l, int r) {
    if (l == r) {
        st[p] = a[l];
        return;
    }
    int m = (l + r) / 2;
    build(2*p, l, m);
    build(2*p+1, m+1, r);
    st[p] = max(st[2*p], st[2*p+1]);
}

void update(int p, int l, int r, int i, int v) {
    if (l == r) {
        st[p] = v;
        return;
    }
    int m = (l + r) / 2;
    if (i <= m)
        update(2*p, l, m, i, v);
    else
        update(2*p+1, m+1, r, i, v);
    st[p] = max(st[2*p], st[2*p+1]);
}

int queryMax(int p, int l, int r, int i, int j) {
    if (i > r || j < l)
        return INT_MIN;
    if (i <= l && r <= j)
        return st[p];
    int m = (l + r) / 2;
    return max(queryMax(2*p, l, m, i, j), queryMax(2*p+1, m+1, r, i, j));
}

int queryJ(int p, int l, int r, int i, int v) {
    if (i > r || st[p] < v)
        return n;
    if (l == r)
        return l;
    int m = (l + r) / 2, ret = queryJ(2*p, l, m, i, v);
    if (ret == n)
        ret = queryJ(2*p+1, m+1, r, i, v);
    return ret;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    int q;
    cin >> n >> q;
    for (int i=0; i<n; i++)
        cin >> a[i];

    build(1, 0, n-1);
    for (int i=0; i<q; i++) {
        int t, x, y;
        cin >> t >> x >> y;
        x--;
        if (t == 1)
            update(1, 0, n-1, x, y);
        else if (t == 2)
            cout << queryMax(1, 0, n-1, x, y-1) << "\n";
        else
            cout << queryJ(1, 0, n-1, x, y) + 1 << "\n";
    }

    return 0;
}


Measured memory_bytes: 6448
#include<bits/stdc++.h>
 
using namespace std;
 
using ll=long long;
 
const ll maxn=100005;
 
ll dp[101][111111];
 
int main()
{
  	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
  
    ll n,W;
    cin>>n>>W;
    vector<pair<ll,ll>>v;
    for(int i=0;i<n;i++)
    {
        ll w,va;
        cin>>w>>va;
        v.push_back({w,va});
    }
 
    for(ll j=1;j<=maxn;j++)
    {
        dp[0][j]=(ll)(1e18);
    }
 
    for(ll i=1;i<=n;i++)
    {
        for(ll j=1;j<=maxn;j++)
        {
 
            if(j>=v[i-1].second)
 
                dp[i][j]=min(dp[i-1][j],dp[i-1][j-v[i-1].second]+v[i-1].first);
 
            else
 
                dp[i][j]=dp[i-1][j];
 
        }
    }
 
    ll ans=0;
 
    for(ll j=1;j<=maxn;j++)
    {
        if(dp[n][j]<=W)
            ans=max(ans,j);
    }
 
    cout<<ans<<endl;
 
}

Measured memory_bytes: 87552
import math
a,b,h,m = map(int, input().split())
if abs(30*h-5.5*m)%360<=180:
    t = abs(30*h-5.5*m)%360
    cost = math.cos(math.radians(t))
    r = a*a + b*b - 2*a*b*cost
    print(math.sqrt(r))
else:
    t = 360-abs(30*h-5.5*m)%360
    cost = math.cos(math.radians(t))
    r = a*a + b*b - 2*a*b*cost
    print(math.sqrt(r))

Measured memory_bytes: 9408
#include <bits/stdc++.h>
using namespace std;
#define maxn 55
#define maxm 125005
#define int long long
#define INF 1e9 + 10
int n, X, D, ans, cnt, dp[maxm];
int w[maxn], val[maxn], pos[maxn];
int tot, V[maxn * maxn], W[maxn * maxn];

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

struct edge
{
    int cnp, to[maxn], last[maxn], head[maxn];
    edge() { cnp = 1; }
    void add(int u, int v)
    { to[cnp] = v, last[cnp] = head[u], head[u] = cnp ++; }
}E1;

void dfs(int u)
{
    val[u] = 1;
    for(int i = E1.head[u]; i; i = E1.last[i])
    {
        int v = E1.to[i];
        dfs(v);
        w[u] += w[v]; val[u] += val[v];
    }
    pos[u] = u;
}

bool cmp(int x, int y) { return val[x] * w[y] > val[y] * w[x]; }
void Get_min(int &x, int y) { x = x < y ? x : y; }

int num[60];

signed main()
{
    n = read(), X = read(), D = read();
    w[1] = read();
    for(int i = 2; i <= n; i ++)
    {
        w[i] = read(); int x = read();
        E1.add(x, i);
    }
    dfs(1);
    for(int i = 1; i <= n*n*n; i ++) dp[i] = INF;
    for(int i = 1; i <= n; i ++)
    {
        int len = 1, lim = X/w[i];
		if(i>1) lim=min(lim,D);

		if(lim>n) num[i]=lim-n,lim=n;

        while(lim >= len)
        {
            V[++ tot] = len * val[pos[i]];
            W[tot] = len * w[pos[i]];
            lim -= len, len <<= 1;
        }
        if(lim) V[++ tot] = lim * val[pos[i]], W[tot] = lim * w[pos[i]];
    }
    for(int i = 1; i <= tot; i ++)
        for(int j = n*n*n; ~j; j --)
                if(j >= V[i]) Get_min(dp[j], dp[j - V[i]] + W[i]); // k件物品

	sort(pos + 1, pos + n + 1, cmp);
    int ans = 0;
    for(int i = 0; i <= n*n*n; i ++)
       {
        if(dp[i] > X) continue;
        int ret = i, left = X - dp[i];
        for(int j = 1; j <= n; j ++)
        {
            int tem = pos[j];
			int used = min(num[tem], left / w[tem]);

            left -= w[tem] * used;
            ret += val[tem] * used;
        }
        ans = max(ans, ret);
    }
    printf("%lld\n", ans);
    return 0;
}


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

///******************************** C o n t a i n e r ********************************///

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef map<int,int> mii;
typedef map<ll,int> mli;

///*********************************** C o n s t ***********************************///

int const N=1e6+3;
const double PI = acos(-1);

///********************************** M a r c o ***********************************///

#define pb push_back
#define F first
#define S second
#define test int tc; cin>>tc; while(tc--)
#define forn(i,n) for(i=0;i<n;i++)
#define rforn(i,n) for(i=n-1;i>=0;i--)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define sz(x) x.size()
#define el <<'\n'
#define sp <<' '
#define print(a) {for(auto x:a)cout<<x<<" ";cout<<endl;}
#define mem(a,b) memset(a, b, sizeof(a))
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b)))
#define sqr(a) (a)*(a)

#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define file() freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define fraction() cout.unsetf(ios::floatfield); cout.precision(10); cout.setf(ios::fixed,ios::floatfield);

///*********************************** F u n c t i o n ***********************************///

///ll powmod(ll a,ll b){ll p=MOD;a%=p;if(!a) return 0;ll pr=1;while(b>0){if(b&1){pr*=a;pr%=p;--b;}a*=a;a%=p;b/=2;}return pr;}
///bool isPrime(ll n){ if(n<=1)return false;if(n<=3)return true;if(n%2==0 or n%3==0)return false;for(ll i=5;i*i<=n;i+=6){if(n%i==0n%(i+2)==0)return false;}return true;}

///************************************************ C o d e ************************************************///
///-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=///



void _case()
{
    ll n,s=0,i;
    cin>>n;
    vector<ll> a(n);
    for(i=0;i<n;i++){
        cin>>a[i];
        s ^= a[i];
    }
    for(i=0;i<n;i++) a[i]=s^a[i];
    for(auto i:a) cout<<i sp;
}

main()
{
///    test
///    while(1)
        _case();

}


///Thank you.


///Brainless_Loco Terminates Here!


Measured memory_bytes: 4808
#include<iostream>

#define SIZE 1000000007

using namespace std;

int N, A[2000], bef[2000], aft[2000];
unsigned long long K, ans = 0;

void set() {
	for (int i = 0; i < N - 1; i++) {
		for (int j = i + 1; j < N; j++) {
			if		(A[i] > A[j])   aft[i]++;
			else if (A[i] < A[j]) { aft[j]++; bef[j]++; }
		}
	}
}
void solve() {
	unsigned int afterSum = 0, beforeSum = 0;
	for (int i = 0; i < N; i++) {
		afterSum  += aft[i];
		beforeSum += bef[i];
	}

	unsigned long long 
		k = K * (K + 1) / 2 % SIZE,
		a_k = afterSum * k;
	for (unsigned long long i = 0; true; i++) {
		if (a_k + i * SIZE < beforeSum * K) continue;

		ans = (a_k + i * SIZE - beforeSum * K) % SIZE;
		break;
	}
}
int main() {
	
	cin >> N >> K;

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

	set();
	solve();

	cout << ans;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
using namespace std;
int main() {
  int N, A, B;
  cin >> N >> A >> B;
  int result = 0;
  for (int i = 1; i <= N; ++i) {
    int total = 0;
    int n = i;
    while (n > 0) {
      total += n % 10;
      n /= 10;
    }
    if (total >= A && total <= B) {
      result += i;
    }
  }
  cout << result << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <queue>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <climits>
//#include "h.h"
using namespace std;

#define MOD1097 1000000007

#define ll long long
#define pint pair<int, int>
#define pll pair<ll, ll>
#define pb push_back
#define mp make_pair
#define pm(first, second) pb(mp(first, second))
#define SPACE " "
#define fpf first.first
#define fps first.second
#define spf second.first
#define sps second.second

#define all(X) (X).begin(), (X).end()

int main(){

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

//"Hiroakimm0415"
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

using namespace std;
using ll = long long;

template<typename T>
using vec2 = vector<vector<T>>;
template<typename T>
using vec3 = vec2<vector<T>>;
template<typename T>
using vec4 = vec3<vector<T>>;
template<typename T>
using vec5 = vec4<vector<T>>;
template<typename T>
using vec6 = vec5<vector<T>>;

struct UnionFind{
    vector<int> parents;
    vector<int> sizes;
    int N;

    UnionFind(int N): N(N){
        parents = vector<int>(N,-1);
        for(int i = 0;i < N;i++)parents[i]=i;
        sizes = vector<int>(N,1);
    }

    int find(int a){
        if(parents[a] == a)return a;
        int root = find(parents[a]);
        parents[a] = root;
        return root;
    }

    bool connect(int a, int b){
        a = find(a);
        b = find(b);
        if(a == b)return false;
        if(sizes[a]<=sizes[b])swap(a,b);
        sizes[a] += sizes[b];
        parents[b] = a;
        return true;
    }
    int size(int a){
        return sizes[find(a)];
    }
};

int main(){
    int N,M;cin>>N>>M;
    UnionFind u(N);
    for(int i = 0;i < M;i++){
        int a,b;cin>>a>>b;a--;b--;
        u.connect(a,b);
    }
    int ans = 0;
    
    for(int i = 0;i < N;i++){
        // cout<<u.size(i)<<endl;
        ans = max(ans,u.size(i));
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 4832
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a; i< (int)(b); ++i)
//using ll=long long;
using namespace std;
//const auto mod=1e9+7;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);
  
  int n,q; 
  cin >> n;
  vector<int> s(n);
  rep(i,0,n) cin >> s[i];
  cin >> q;
  vector<int> t(q);
  rep(i,0,q) cin >> t[i];
  
  int ans=0;
  rep(i,0,q) {
    if( binary_search(s.begin(),s.end(),t[i]) ) ans++;
  }
 

  cout << ans << endl;
}







Measured memory_bytes: 3372
#include <bits/stdc++.h>
  
using namespace std;
  
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define repr(i, n) REPR(i, n, 0)
#define REPR(i, s, e) for(int i=(int)(s-1); i>=(int)(e); i--)
#define pb push_back
#define all(r) (r).begin(),(r).end()
#define rall(r) (r).rbegin(),(r).rend()
#define fi first
#define se second
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
const int INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;

int main(){
#ifdef LOCAL_TEST
    freopen("in", "r", stdin);
    freopen("out", "w", stdout);
#endif
    string s, t;
    cin >> s;
    if(s.size() < 4) cout << "No" << endl;
    else if(s.substr(0, 4) == "YAKI") cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
while True:
    H,W = map(int,input().split())
    if H == 0 and W ==0:
        break
    for i in range(H):
        if i % 2 == 0:
            c = 0
        else:
            c = 1
        for j in range(W):
           if c % 2 == 0:
              print("#",end="")
           else:
              print(".",end="")
           c += 1
        print()
    print()
        



Measured memory_bytes: 6996
#include <iostream>
#include <vector>
#include <fstream>
#include <string>
#include <algorithm>

using namespace std;

int main(){

	int n;
	cin>>n;
	string str;
	getline(cin,str);
	for(int i = 0; i < n; i++){
		getline(cin,str);
		bool f =false;
		for(int a=0; a < 26; a++){
			if(a%2!=0&&a%13!=0){
				for(int b=0; b < 26; b++){
					if(a==0&&b==10){
//						cout<<endl;
					}

					string nstr;
					// Ï·e[uðì¬
					char table[200];
					fill(table,table+200,0);

					for(int c = 'a'; c <= 'z'; c++){
						table[((a*(c-'a')+b)%26)+'a']=c;
					}
					
					// Ï·e[uð³É¡
					for(int i = 0; i < str.size(); i++){
						if(str[i]>='a'&&str[i]<='z'){
							nstr+=table[str[i]];
						}
						else
							nstr+=str[i];
					}

					// àµthatÜ½ÍthisÌ¶ªmFÅ«êÎI¹
					for(int i = 0; i + 3 < str.size(); i++){
						if(nstr.substr(i,4)=="this"||nstr.substr(i,4)=="that"){
							f=true;
							cout<<nstr<<endl;
							break;
						}
					}
					if(f)
						break;
				}
				if(f)
					break;
			}
		}
	}

	return 0;
}

Measured memory_bytes: 0
iN , iX = [int(x) for x in input().split()]
aX = [abs(int(x) - iX) for x in input().split()]
def gcd(a,b):
    return a if b == 0 else gcd( b, a % b)

if iN == 1 :
    print( aX[0] )
else:
    g = gcd(aX[0],aX[1])
    if 2 < iN :
        for i in range(2,iN):
            g = gcd(g,aX[i])
    print (g)


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

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

    for(i=1; i<=9; i++)
        if(N%i==0 && N/i<=9) {
            cout << "Yes" << endl;
            return 0;
        }
    
    cout << "No" << endl;
}

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

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REPl(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define REPRl(i, n) for(ll i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < (int)n; i++)
#define FORl(i, m, n) for(ll i = m; i < (ll)n; i++)
#define ALL(v) v.begin(), v.end()
ll gcd(ll a,ll b) {
  return b? gcd(b,a%b): a;  
}
ll lcm(ll a,ll b) {
  return a*b/gcd(a,b);
}
bool isLowerCase(char c){
  return (c>='a'&&c<='z');
}
int main() {
  int n;cin>>n;
  string s;cin>>s;
  int ans=0;
  int m=0;
  FOR(i,1,n-1){
    string X=s.substr(0,i);
    string Y=s.substr(i,s.size());
    set<char> Xc,Yc;
    REP(j,X.size()){
      Xc.insert(X[j]);
    }
    REP(j,Y.size()){
      Yc.insert(Y[j]);
    }
    m=0;
    for(auto j=Xc.begin();j!=Xc.end();++j){
      if(Yc.find(*j)!=Yc.end()){
        m++;
      }
    }
    ans=max(ans,m);
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <stack>
#include <queue>

#define ST_ARR_LEN(array) (sizeof(array)/sizeof(*array))

typedef std::stack<int> IntStack;
typedef std::queue<int> IntQueue;
 
using namespace std;
  
int main(){
  string S;
  cin >> S;
  
  string ans = "";
  for(int i=0;i<S.size();i++){
    ans = ans + "x";
  }
  
  cout << ans << endl;
}

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

int main() {
    int A, B; cin >> A >> B;
    if (A <= B * 2) {
        cout << 0 << endl;
    } else {
        cout << A - B * 2 << endl;
    }
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	int r;
	scanf("%d", &r);
	if (r < 1200) {
		printf("ABC");
	}
	else if (r >= 1200 && r < 2800) {
		printf("ARC");
	}
	else {
		printf("AGC");
	}
	return 0;
}

Measured memory_bytes: 128
#include <stdio.h>
#include <stdlib.h>

int main()
{
    long long  n,m;
    long long sum;
    while(scanf("%lld%lld",&n,&m)!=EOF)
    {
        if(n==1&&m==1)
            sum=1;
        else if(n==1)
            sum=m-2;
        else if(m==1)
            sum=n-2;
        else
            sum=n*m-m*2-(n-2)*2;
        printf("%lld\n",sum);
    }
    return 0;
}


Measured memory_bytes: 128
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String {
            bytes
                .by_ref()
                .map(|r| r.unwrap() as char)
                .skip_while(|c| c.is_whitespace())
                .take_while(|c| !c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_imports)]
use std::cmp::{min, max};

fn main() {
    input!{
        a: usize,
        b: usize
    }
    println!("{}", a * b / gcd(a, b));
}

fn gcd(n: usize, m: usize) -> usize {
    let mut l = min(n, m);
    let mut r = max(n, m);
    while l > 0 {
        let t = l;
        l = r % l;
        r = t;
    }
    r
}


Measured memory_bytes: 4352
#include <iostream>
#include <algorithm>

using namespace std;

int main(void){

  int a,b,c;

  while( cin >> a >> b ){

    if( a < b ) swap(a,b);

    while(1){
    c = a % b;
    a = b;
    b = c;
    if( b == 0 )break;
    }
    cout << a << endl;
  }
  return 0;
}

Measured memory_bytes: 1160
def main():
    n, c = map(int, input().split())
    x, v = [0] * n, [0] * n
    for i in range(n):
        x[i], v[i] = map(int, input().split())

    ss, sr = [0] * n, [0] * n
    ss[0], sr[0] = v[0] - x[0], v[-1] - c + x[-1]

    mx, mxr = [0] * n, [0] * n
    mx[0], mxr[0] = ss[0], sr[0]

    for i in range(n-1):
        ss[i+1] = ss[i] + v[i+1] - x[i+1] + x[i]
        sr[i+1] = sr[i] + v[n-i-2] - x[n-i-1] + x[n-i-2]
        mx[i+1] = max(mx[i], ss[i+1])
        mxr[i+1] = max(mxr[i], sr[i+1])

    r1, r2 = max(0, mx[n-1]), max(0, mxr[n-1])
    for i in range(n-1):
        r1 = max(r1, sr[i]+mx[n-i-2]-c+x[n-i-1])
        r2 = max(r2, ss[i]+mxr[n-i-2]-x[i])

    print(max(r1, r2))


if __name__ == '__main__':
    main()


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


int main() {
#ifdef HOME
    freopen("in", "r", stdin);
#endif

    int n;
    while (scanf("%d", &n) == 1) {
        vector<int> a(n);
        for (int i = 0; i < n; i++) scanf("%d", &a[i]);

        vector<int> res;
        res.push_back(a[0]);
        for (int i = 1; i < n; i += 2) res.push_back(a[i]);
        reverse(res.begin(), res.end());
        for (int i = 2; i < n; i += 2) res.push_back(a[i]);
        if (n % 2 == 1) reverse(res.begin(), res.end());
        for (int i = 0; i < n; i++) printf("%d%c", res[i], " \n"[i + 1 == n]);
    }

#ifdef HOME
    cerr << clock() / (double)CLOCKS_PER_SEC << endl;
#endif
    return 0;
}

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

int main(){
	int i;
	char S[3], flg[3];
	for(i=0; i<3; i++){
		flg[i]=1;
	}
	for(i=0; i<3; i++){
		cin >> S[i];
		if(S[i]=='a')		flg[0]=0;
		else if(S[i]=='b')	flg[1]=0;
		else if(S[i]=='c')	flg[2]=0;
	}
	
	int sum=0;
	for(i=0; i<3; i++){
		sum += flg[i];
	}
	
	if(sum == 0)	cout << "Yes" << endl;
	else		cout << "No" << endl;
	return 0;
}


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

vector<pair<long long int, long long int>> vec;
void ss(long long int price[],long long int n) 
{ 
    if (n == 1) 
        return; 
   long long int i = 0; 
    while (i < n - 1) { 
        while ((i < n - 1) && (price[i + 1] <= price[i])) 
            i++; 
        if (i == n - 1) 
            break; 
       long long int buy = i++; 
        while ((i < n) && (price[i] >= price[i - 1])) 
            i++; 
       long long int sell = i - 1; 
  
       vec.push_back({buy, sell});
    } 
} 
int main()
{
	ios_base :: sync_with_stdio(false),cin.tie(NULL),cout.tie(0);
	
	long long int a,ct=1000;
	cin>>a;
	long long int b[a]={};
	forr(i,0,a)
		cin>>b[i];
	
	ss(b, a);
	forr(i,0,vec.size())
	{
		long long int x=ct/b[vec[i].first];
		ct-=x*b[vec[i].first];
		ct+=x*b[vec[i].second];
	}
	cout<<ct;
			
	return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
int main() {
    ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
    int n;
    long double D;
    cin >> n >> D;
    int ans = 0;
    for (int i=0; i<n; i++){
        long double x, y, cd;
        cin >> x >> y ;
        cd = sqrt(x*x+y*y);
        if (cd<=D)
            ans++;
    }
    cout << ans <<"\n";
}

Measured memory_bytes: 3796
#include<cstdio>
#include<algorithm>
using namespace std;
int n;
int x[512];
int a[260000], m;
int cnt[512];
pair<int, pair<int, int>> dat[512];
int main()
{
	scanf("%d", &n);
	for (int i = 1; i <= n; i++)
	{
		scanf("%d", &x[i]);
		// position, remaining times, number
		dat[i] = make_pair(x[i], make_pair(i - 1, i));
	}
	sort(&dat[1], &dat[n + 1]);
	int q = 1; // slack
	bool flag = false;
	for (int i = 1; i <= n; i++)
	{
		for (int j = i; j <= n && m < dat[i].first - 1; j++)
		{
			while (m < dat[i].first - 1 && dat[j].second.first>0)
			{
				a[++m] = dat[j].second.second;
				dat[j].second.first--;
				cnt[dat[j].second.second]++;
			}
		}
		while (q < i && m < dat[i].first - 1)
		{
			if (cnt[dat[q].second.second] == n) {
				q++; continue;
			}
			a[++m] = dat[q].second.second;
			cnt[dat[q].second.second]++;
		}
		if (m != dat[i].first - 1 || dat[i].second.first != 0)
		{
			flag = true; break;
		}
		a[++m] = dat[i].second.second;
		dat[i].second.first--;
		cnt[dat[i].second.second]++;
	}
	if (flag) printf("No\n");
	else
	{
		while (q <= n)
		{
			if (cnt[dat[q].second.second] == n) {
				q++; continue;
			}
			a[++m] = dat[q].second.second;
			cnt[dat[q].second.second]++;
		}
		printf("Yes\n");
		for (int i = 1; i <= m; i++) printf("%d%c", a[i], i == m ? '\n' : ' ');
	}
	return 0;
}


Measured memory_bytes: 2176
#include<iostream>
#include<vector>
#include<algorithm>
#include<math.h>

using namespace std;

#define INF 1e9

int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  for(int i = 0; i < n ; i++){
    cin >> a[i];
  }

  vector<int> dp(n+2, INF);
  dp[0] = 0;
  for(int i = 0; i < n; i++){
    auto t = lower_bound(dp.begin(), dp.end(), a[i]);
    if(t != dp.end()){
      if(*prev(t,1) == a[i]-1){
        *t = a[i];
      }
    }
  }
  int m = *prev(lower_bound(dp.begin(), dp.end(), n+1));
  // cout << m << endl;
  if(dp[1] == INF) cout << -1 << endl;
  else cout << n - m << endl;
}


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


class Program {

	static int testN=3;
	static long mod = 1000000007;
	//static long mod =998244353; 
	static System.IO.StringReader sr;
	static void Main(string[] args) {
		char[] cs = new char[] { ' ' };
		//char[] cs = new char[] { ' ', ',' };

		//int n = int.Parse(Console.ReadLine());
		//int val = int.Parse(Console.ReadLine());
		//int[] vals = parseAry(Console.ReadLine().Split(cs));
		//string str = Console.ReadLine();
		//string[] strs = Console.ReadLine().Split(cs);

		//string res = "";
		long res = long.MaxValue; ;
		int n = int.Parse(Console.ReadLine());

		int[] vals = parseAry(Console.ReadLine().Split(cs));

		

		for ( int p = 1; p < 101; p++ ) {
			long t=0;
			for ( int i = 0; i < n; i++ ) {
				t += ( vals[i] - p ) * ( vals[i] - p );
			}
			res = Math.Min(res, t);
		}


			Console.WriteLine(res);

		return;

	}


	//	int配列をスペース区切りの文字列に変換
	static string stringBuilderArrayInt(int[] a) {
		StringBuilder sb = new StringBuilder();

		for ( int i = 0; i < a.Length; i++ ) {
			sb.Append(a[i] + " "); 
		}
		if ( sb.Length > 1 ) {
			sb = sb.Remove(sb.Length - 1, 1);
		}
		return sb.ToString(); ;
	}


	//	文字列strをindex番目からdで上書き
	static string strOverWrite(string str, int i, string s) {
		return str.Remove(i, s.Length).Insert(i, s);
	}

	//　String[]  ----->  int[]
	static int[] parseAry(string[] str) {
		int[] nums = new int[str.Length];
		for ( int i = 0; i < str.Length; i++ ) { nums[i] = int.Parse(str[i]); }
		return nums;
	}
	//　String[]  ----->  long[]
	static long[] parseAryL(string[] str) {
		long[] nums = new long[str.Length];
		for ( int i = 0; i < str.Length; i++ ) { nums[i] = long.Parse(str[i]); }
		return nums;
	}

	//文字列を1文字ずつString[]に入れる
	static string[] strAry(String str) {
		string[] re = new string[str.Length];
		for ( int i = 0; i < str.Length; i++ ) { re[i] = str[i].ToString(); }
		return re;
	}



}

Measured memory_bytes: 11092
#include<bits/stdc++.h>
#define int long long

using namespace std;

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

    int a, b, ans = 1;
    cin >> a >> b;
    while (a * 2 <= b)
        ans++, a *= 2;
    cout << ans << '\n';

    return 0;
}


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

#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define RFOR(i,b,a) for(int i = (b) - 1; i >= (a); i--)
#define ITER(it, a) for(typeof(a.begin()) it = a.begin(); it != a.end(); it++)
#define FILL(a, value) memset(a, value, sizeof(a))

#define SZ(a) (int) a.size()
#define ALL(a) a.begin(),a.end()
#define PB push_back
#define MP make_pair

typedef long long LL;
typedef vector<int> VI;
typedef pair<int, int> PII;

const double PI = acos(-1.0);
const LL INF = 1000 * 1000 *1000 + 7;
const LL LINF = INF * (LL)INF;



int main()
{
	//freopen("in.txt","r", stdin);
	//ios::sync_with_stdio(false); cin.tie(0);

	int a, b;
	cin>>a>>b;
	if (a <= 0 && b >= 0)
	{
		cout<<"Zero"<<endl;
		return 0;
	}

	if (b < 0)
	{
		int cnt = (b - a + 1);
		if (cnt & 1)
		{
			cout<<"Negative"<<endl;
			return 0;
		}
	}

	cout<<"Positive"<<endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int A, B, C, D, L, R;
    cin >> A >> B >> C >> D;
    L = A + B;
    R = C + D;
    if (L > R) {
        cout << "Left" << endl;
    } else if (L == R) {
        cout << "Balanced" << endl;
    } else {
        cout << "Right" << endl;
    }
}

Measured memory_bytes: 256
require 'pp'
# IS_DEBUG = true
IS_DEBUG = false
def dputs str
	if(IS_DEBUG)
		puts str
	end
end
def dpp str
	if(IS_DEBUG)
		pp str
	end
end

A,B=gets.chomp.split(' ').map{|n| n.to_i}
n = (B-A)-1
puts n*(n+1)/2 - A


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

int main(){
  int D,N;  cin >> D >> N;
  long long lstart = pow(100,D);
  int count = 0;
  for(long long i = lstart;count < N;i++){
    switch(D){
      case 0:if(i % 100 != 0){
                count++;
             }
             break;
      case 1:if(i % 100 == 0 and i % 10000 != 0){
                count++;
             }
             break;
      case 2:if(i % 10000 == 0 and i % 1000000 != 0){
                count++;
             }
             break;
    }
    if(count == N)cout << i << endl;
  }


}

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

int a[2000],b[2000];

int main(){
	int w,h;cin>>w>>h;
	priority_queue<int>que;
	rep(i,w){
		scanf("%d",&a[i]);
		if(a[i])que.push(a[i]);
	}
	rep(i,h){
		scanf("%d",&b[i]);
		vector<int>v;
		rep(j,b[i]){
			if(que.empty()){
				puts("0");return 0;
			}
			int p=que.top();que.pop();
			p--;
			if(p)v.push_back(p);
		}
		for(int i:v)que.push(i);
	}
	if(!que.empty())puts("0");
	else puts("1");
}


Measured memory_bytes: 3188
#include<iostream>

using namespace std;

int main(){
  int x[4], y[4];

  for(int i = 0;i < 2;i++) cin >> x[i] >> y[i];

  int d[3][2];
  d[0][0] = x[1] - x[0];
  d[0][1] = y[1] - y[0];
  d[1][0] = -y[1] + y[0];
  d[1][1] = x[1] - x[0];
  d[2][0] = x[0] - x[1];
  d[2][1] = y[0] - y[1];

  x[2] = x[1] + d[1][0];
  y[2] = y[1] + d[1][1];
  x[3] = x[2] + d[2][0];
  y[3] = y[2] + d[2][1];


  cout << x[2] << " " << y[2] << " " << x[3] << " " << y[3] << endl;

}


Measured memory_bytes: 256
import networkx as nx
n,m=map(int, input().split())
uf=nx.utils.UnionFind()
for _ in range(m):
    a,b=map(int, input().split())
    uf.union(a, b)
ans=1
for i in uf.to_sets():
    ans=max(ans,len(i))
print(ans)

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

int main()
{
   string j;
   cin>>j;
   if (j=="SUN")
   {
       cout<< 7;
   }
   if (j=="MON")
   {
       cout<< 6;
   }
   if (j=="TUE")
   {
       cout<< 5;
   }
   if (j=="WED")
   {
       cout<< 4;
   }
   if (j=="THU")
   {
       cout<< 3;
   }
   if (j=="FRI")
   {
       cout<< 2;
   }
   if (j=="SAT")
   {
       cout<< 1;
   }


}


Measured memory_bytes: 256
while True:
    try:
        s = raw_input()
        for i in range(26):
            r = ''
            for c in s:
                if c.islower():
                    n = ord(c) - ord('a') + i
                    n = n % 26
                    r += chr(n + ord('a'))
                else:
                    r += c
            if 'the' in r or 'this' in r or 'that' in r:
                print r
                break
    except EOFError:
        break

Measured memory_bytes: 4228
//
//  main.cpp
//  poll-problem
//
//  Created by Alaa Agwa on 2/24/20.
//  Copyright © 2020 Alaa Agwa. All rights reserved.
//

#include <iostream>
#include <iomanip>
#include <map>
#include <string>
#include <algorithm>
#include <vector>
using namespace std;

 

int main()
{
    int a = 8;
    cin >> a;
    vector<string> myNames;
    for(int i=0;i<a;i++){
        string tmp;
        cin >> tmp;
        myNames.push_back(tmp);
    }
    
    sort(myNames.begin(),myNames.end());
    map<string,int> pollsCount;
    int max=0;
    for(int i=0;i<a;i++){
        
        pollsCount[myNames.at(i)] = pollsCount[myNames.at(i)] + 1;
        if(pollsCount[myNames.at(i)] > max){
            max = pollsCount[myNames.at(i)];
        }
    }
    
    for(map<string,int>::iterator it = pollsCount.begin();it != pollsCount.end(); ++it){
        
        if(it->second == max){
            
            cout << it->first << endl;
        }
    }

    return 0;
}


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

int main(){ 
  int N;
  string S,T;
  cin >> N >> S >> T;

  string ans;
  for(int i=0; i<N; i++){
    ans.push_back(S.at(i));
    ans.push_back(T.at(i));
  }

  cout << ans << endl;
}

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

int main(){
	long n;
	cin>>n;
	for(int i=0;i<n;i++){
		int hh,mm;
		char cc;
		cin>>hh>>cc>>mm;
		double tyousin=mm*6;
		double tansin=hh*30+mm*0.5;
		double sita=abs(tyousin-tansin);
		if(sita>180)sita=360-sita;
		if(0<=sita &&sita<30)cout<<"alert"<<endl;
		else if(sita>=90 && sita<=180)cout<<"safe"<<endl;
		else cout<<"warning"<<endl;
	}
	return 0;
}

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

int mod = 1000000007;

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

    string S;

    unordered_map<string, int64_t> list;
    for (int i = 0; i < N; i++)
    {
        cin >> S;
        sort(S.begin(), S.end());
        list[S]++;
    }

    int64_t ans = 0;
    for (auto pair:list)
    {
        ans += pair.second * (pair.second - 1) / 2;
    }

    cout << ans;
}

Measured memory_bytes: 10660
K = int(input())
A = 0
b = 7
if K %2 == 0 or K%5 == 0:
    print(-1)
else:
    for i in range(K+2):
        A += b
        b = (b*10)%K
        if A%K == 0:
            print(i+1)
            break

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

int main()
{
    int count5 = 0;
    int count7 = 0;
    int temp = 0;

    for(int i = 0;i < 3;i++)
    {
        cin >> temp;
        if(temp == 5)
        {
            count5++;
        }
        if(temp == 7)
        {
            count7++;
        }
    }

    if(count5 == 2 & count7 == 1)
    {
        cout << "YES" << endl;
    }
    else
    {
        cout << "NO" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
import java.io.*;
import java.util.*;
public class Main
{
	public static void main(String[] args)throws IOException {
		InputStreamReader read=new InputStreamReader(System.in);
		BufferedReader in=new BufferedReader(read);
		String str=in.readLine();
		String line[]=str.trim().split(" ");
		int k=Integer.parseInt(line[0]);
		int n=Integer.parseInt(line[1]);
		String st=in.readLine();
		int a[]=new int[n];
		int diff[]=new int[n];
		String l[]=st.trim().split(" ");
		int i;
		for(i=0;i<n;i++)
		{
		    a[i]=Integer.parseInt(l[i]);
		}
		diff[0]=a[0];
		for(i=1;i<n;i++)
		{
		    diff[i]=a[i]-a[i-1];
		}
		Arrays.sort(diff);
		int ans=Math.max((k-a[n-1]+a[0]),diff[n-1]);
		System.out.println((k-ans));
	}
}


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

// 総数を1000000007で割った余り
const long long mod = 1e9 + 7;

using ll  = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#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 repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }

const string YES = "Yes";
const string NO  = "No";

int func(long long N, std::vector<long long> H) {
    // cout << N << endl;

    // for (auto& e : H) {
    //     cout << e << " ";
    // }
    for (ll i = N - 1; i > 0; i--) {
        if (H[i - 1] == H[i] + 1) {
            H[i - 1]--;
        } else if (H[i - 1] > H[i]) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    // cout << fixed << setprecision(5);

    long long N;
    // scanf("%lld", &N);
    cin >> N;
    std::vector<long long> H(N);
    for (int i = 0; i < N; i++) {
        // scanf("%lld", &H[i]);
        cin >> H[i];
    }
    func(N, std::move(H));
    return 0;
}


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

typedef long long ll;

static const int MAX = 200000;
// static const int NIL = -1;
// static const ll INF = 1<<21;
// static const ll MOD = 1e9 + 7;

bool compPair(const pair<int, int>& arg1, const pair<int, int>& arg2) {
    return arg1.first > arg2.first;
}

int main(void) {
    int n, k;
    cin >> n >> k;

    vector<int> a(MAX);
    int ain;
    for(int i=0;i<n;i++) {
        cin >> ain;
        a.at(ain-1)++;
    }

    sort(a.begin(), a.end(), greater<int>());

    int ans=0;
    for(int i=0;i<k;i++) {
        ans += a.at(i);
    }
    ans = n - ans;

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


Measured memory_bytes: 1024
// #include <bits/stdc++.h>
#include<iostream>
#include<stack>
#include<string>
#include<vector>
#include<queue>
#include<map>
#include<algorithm>
#include<iomanip>
#include<set>
#include<bitset>
#include<cmath>
#include<numeric>
#include<limits>
#include<functional>
#include <bitset>

#define REP(i, m, n) for(int i = (m); i < (n); i++)
#define rep(i,n) REP(i,0,n)
#define NIL -1
#define INFTY (1 << 21)
using namespace std;

typedef long long ll;
typedef long long int lli;
// static const int MOD = 10000007;
// static const int MAX = 100005;
static const int ln = 201;
static const int WHITE = 0;
static const int GRAY = 1;
static const int BLACK = 2;

int N;
int color[ln], d[ln];
int M[ln][ln];
// int tree[ln][ln];
bool flag = false;


void bfs(int s) { // sを始点としたBFS
  // initialization
  queue<int> Q;
  rep(i, N) {
    color[i] = WHITE;
    d[i] = INFTY;
  }
  color[s] = GRAY;
  d[s] = 0;
  Q.push(s);
  while ( !Q.empty() ) {
    int u = Q.front(); Q.pop();
    rep(v, N) {
      if ( M[u][v] && color[v] == WHITE ) {
        Q.push(v);
        // tree[u][v] = tree[v][u] = 1;
        d[v] = d[u] + 1;
        color[v] = GRAY;
      } else if (M[u][v] && color[v] == GRAY && (d[v] == d[u]) ) {
        flag = true;
        return;
      }
    }
    color[u] = BLACK;
    // cout << "u : " << u << endl;
  }
}


int main(){
  cin >> N;
  string s;
  rep(i,N) {
    cin >> s;
    rep(j, N) {
      if (s[j] == '0') M[i][j] = 0;
      else M[i][j] = 1;
    }
  }
  // rep(i, N) rep(j,N) {
  //   tree[i][j] = 0;
  // }
  bfs(0);
  // cout << "first" << endl;
  int maxv = 0;
  rep(i, N) {
    bfs(i);
    if (flag) {
      cout << -1 << endl;
      return 0;
    }
    int tgt = 0;
    rep(i, N) {
      if(d[i] == INFTY) continue;
      if(maxv < d[i]) {
        maxv = d[i];
        tgt = i;
      }
    }
  }

  // cout << " second" << endl;
  // if (flag) {
  //   cout << maxv+1 << endl;
  //   return 0;
  // }
  cout << maxv+1 << endl;
}


Measured memory_bytes: 384