akhauriyash/Code-Regression huggingface dataset:
C = [list(map(int,input().split())) for k in range(3)]

N = int(input())
for k in range(N):
    t = int(input())
    for e in C:
        for l in range(3):
            if e[l] == t:
                e[l] = -1

f = 0
for e in C:
    if e == [-1,-1,-1]:
        f = 1
        break

for k in range(3):
    if C[0][k] == C[1][k] == C[2][k] == -1:
        f = 1
        break
if C[0][0] == C[1][1] == C[2][2] == -1:
    f = 1
if C[0][2] == C[1][1] == C[2][0] == -1:
    f = 1

print("Yes" if f == 1 else "No")


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

template<typename T>
struct Segtree {
    int n, n_org;
    T e;
    vector<T> dat;
    typedef function<T(T a, T b)> Func;
    Func f;

    Segtree(){}
    Segtree(int n_input, Func f_input, T e_input){
        initialize(n_input, f_input, e_input);
    }
    void initialize(int n_input, Func f_input, T e_input){
        n_org = n_input;
        f = f_input;
        e = e_input;
        n = 1;
        while(n < n_input) n <<= 1;
        dat.assign(2*n-1, e);
    }

    void build(vector<T>& A){
        for(int k=0; k<int(A.size()); k++) dat[k+n-1] = A[k];
        for(int k=n-2; k>=0; k--) dat[k] = f(dat[2*k+1], dat[2*k+2]);
    }

    void update(int k, T a){
        k += n - 1;
        dat[k] = a;
        while(k > 0){
            k = (k - 1)/2;
            dat[k] = f(dat[2*k+1], dat[2*k+2]);
        }
    }

    T get(int k){
        return dat[k+n-1];
    }

    T between(int a, int b){
        return query(a, b+1, 0, 0, n);
    }

    T query(int a, int b, int k, int l, int r){
        if(r<=a || b<=l) return e;
        if(a<=l && r<=b) return dat[k];
        T vl = query(a, b, 2*k+1, l, (l+r)/2);
        T vr = query(a, b, 2*k+2, (l+r)/2, r);
        return f(vl, vr);
    }

    // [S, t] が条件checkを満たす最大のtを求める
    int bisect(int S, function<bool(T a)> check){
        T val = get(S);
        int k = S+n-1, l = S, r = S+1;
        while(true){
            while(k%2) k = (k-1)/2, r += r-l;
            T val2 = f(val, dat[k]);
            if(check(val2)){
                if(r == n) return n_org-1;
                val = val2;
                k++;
                int d = r-l;
                l += d, r += d;
            }else{
                break;
            }
        }
        while(k<n-1){
            T val2 = f(val, dat[2*k+1]);
            if(check(val2)){
                val = val2;
                k = 2*k+2;
                l = (l+r)/2;
            }else{
                k = 2*k+1;
                r = (l+r)/2;
            }
        }
        return min(l, n_org)-1;
    }
};

int main(){
    int N, Q;
    cin >> N >> Q;
    Segtree<int> st(N+1, [](int a, int b){ return max(a, b); }, -1);
    for(int i=1; i<=N; i++){
        int a;
        cin >> a;
        st.update(i, a);
    }
    while(Q--){
        int t, a, b;
        cin >> t >> a >> b;
        if(t == 1){
            st.update(a, b);
        }else if(t == 2){
            cout << st.between(a, b) << endl;
        }else{
            cout << st.bisect(a, [&](int x){ return x < b; })+1 << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 5356
while True:
    m, f, r = map(int, input().split())
    if m == f == r == -1:
        break
    if m == -1 or f == -1:
        print("F")
    elif m + f >= 80:
        print("A")
    elif m + f >= 65:
        print("B")
    elif m + f >= 50:
        print("C")
    elif m + f >= 30:
        if r >= 50:
            print("C")
        else:
            print("D")
    else:
        print("F")



Measured memory_bytes: 5592
N = int(input())
S = input()
r = 0
g = 0
b = 0
for i in range(N):
    if S[i] == "R":
        r += 1
    elif S[i] == "G":
        g += 1
    else:
        b += 1

ms = (N-3)//2
t = 0
for i in range(ms + 1):
    for j in range(N - (2*i + 3) + 1):
        if S[j] != S[j + i + 1] and S[j] != S[j + 2*i + 2] and S[j + i + 1] != S[j + 2*i + 2]:
            t += 1

print(r * g * b - t)

Measured memory_bytes: 9004
#include <bits/stdc++.h>
#define BIT(n) (1LL << (n))
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPB(i, n) for (int i = 0; i < BIT(n); i++)
#define REPS(i, x) for (int i = 1; i <= (int)(x); i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define FORA(i, n) for (auto &&i : n)
#define FORS(i, m, n) for (int i = m; i <= n; i++)
#define DEBUG(x) cerr << #x << ": " << x << "\n"
#define PRINTALL(V)                                                            \
  for (auto v : (V)) {                                                         \
    cerr << v << " ";                                                          \
  }                                                                            \
  cerr << "\n";
#define ALL(v) v.begin(), v.end()
#define fst first
#define snd second
#define mp make_pair
#define pb push_back
#define epb emplace_back
#define int long long
#define pint pair< int, int >
using namespace std;
template < class T > bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template < class T > bool chmin(T &a, const T &b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template < class T > using vec = std::vector< T >;
template < class T > void print(const T &x) { cout << x << "\n"; }
const int MOD = 1000000007, INF = 1061109567, INF2 = INF * INF;
const double EPS = 1e-10, PI = acos(-1.0);
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
signed main() {
  cin.tie(0), ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  string S;
  cin >> S;
  int N = S.size();
  int count = 0;
  REP(i, N) {
    char ss = S[i];
    if (i % 2 == 0) {
      if (ss == 'R' || ss == 'U' || ss == 'D') {
        count++;
      }
    } else {
      if (ss == 'L' || ss == 'U' || ss == 'D') {
        count++;
      }
    }
  }
  if (count == N) {
    print("Yes");
  } else {
    print("No");
  }
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#define ll long long
#define MOD 1000000007
using namespace std;
ll x[100005],y[100005];
ll x1 = 0, y1 = 0;
int main(){
    int n,m; cin >> n >> m;
    cin >> x[0];
    for(int i = 1; i < n; i++){
        cin >> x[i];
        x1 += (x[i] - x[i-1]) * (n-i) * i;
        x1 %= MOD;
    }
    cin >> y[0];
    for(int i = 1; i < m; i++){
        cin >> y[i];
        y1 += (y[i] - y[i-1]) * (m-i) * i;
        y1 %= MOD;
    }
    ll ans = (x1 * y1) % MOD;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1792
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		boolean flag = true;
		while (flag) {
			int a = sc.nextInt();
			String op = sc.next();
			int b = sc.nextInt();

			switch (op) {
			case "+":
				System.out.println((a + b));
				break;
			case "-":
				System.out.println((a - b));
				break;
			case "*":
				System.out.println((a * b));
				break;
			case "/":
				System.out.println((a / b));
				break;
			case "?":
				flag = false;
				break;
			}

		}

	}
}



Measured memory_bytes: 26244
#include <iostream>

using namespace std;

int main(){
  char c[]={'y','u','i','o','p','h','j','k','l','n','m'};
  string s;
  bool flag=false,right;
  while(cin >> s,s[0]!='#'){
    int i,ans=0;
    for(i=0;i<s.size();i++){
      right = false;
      for(int j=0;j<11;j++){
        if(s[i]==c[j])right = true;
      }
      if(right){
        if(i==0)flag = true;
        if(!flag){
          flag = true;
          ans++;
        }
      }else{
        if(i==0)flag =false;
        if(flag){
          flag = false;
          ans++;
        }
      }
    }
    cout << ans << endl;
  }
  return 0;
}



Measured memory_bytes: 3168
package main

import (
  "fmt"
)

func main() {
  var n int
  fmt.Scan(&n)
  t := make([]uint64, n)
  for i := 0; i < n; i++ {
    fmt.Scan(&t[i])
  }
  result := t[0]
  for i := 1; i < n; i++ {
    if result == t[i] {
      continue
    }
    result = result/gcd(result, t[i])*t[i]
  }
  fmt.Println(result)
}

func gcd(a, b uint64)uint64 {
  if b == 0 {
    return a
  }
  return gcd(b, a%b)
}



Measured memory_bytes: 512
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <random>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
typedef unsigned long long ull;
const int med=250000;
ull powmod(ull a, ll k){
    if(a==0) return 0;
    ull ap=a, ans=1;
    while(k>0){
        if(k%2==1){
            ans*=ap;
        }
        ap=ap*ap;
        k/=2;
    }
    return ans;
}
ull inv(ull a){
	return powmod(a, (1ll<<63)-1);
}

int main()
{
	int n;
	cin>>n;
	//char s[250000];
  //for(int i=0; i<n; i++){
    //if(i%4==0) s[i]='+';
    //else if(i%4==1) s[i]='<';
    //else if(i%4==2) s[i]='>';
    //else s[i]='-';
  //}
  string s; cin>>s;
    //random_device rnd;
	//mt19937_64 mt(rnd());
	//uniform_int_distribution<ll> rndn(2, MOD-2);
	//ll b=rndn(mt);
  ull b=67;
	ull binv=inv(b);
	ull bp[500001];
	bp[med]=1;
	for(int i=med+1; i<=med+n; i++) bp[i]=bp[i-1]*b;
	for(int i=med-1; i>=med-n; i--) bp[i]=bp[i+1]*binv;
	ull b0=0; int p=med;
	for(int i=0; i<n; i++){
		if(s[i]=='+'){
			b0=b0+bp[p];
		}else if(s[i]=='-'){
			b0=b0-bp[p];
		}else if(s[i]=='>'){
			p++;
		}else{
			p--;
		}
	}
	ll ans=0;
	ull x[250000]={};
	unordered_map<ull, int> mp[500];
	int c1[500]={};
	ull c0[500]={};
	int sq=2000;
	for(int i=0; i<n; i++){
		if(s[n-1-i]=='+'){
			for(int j=i/sq*sq; j<=i; j++){
				x[j]++;
			}
			for(int j=0; j<i/sq; j++){
				c0[j]++;
			}
		}else if(s[n-1-i]=='-'){
			for(int j=i/sq*sq; j<=i; j++){
				x[j]--;
			}
			for(int j=0; j<i/sq; j++){
				c0[j]--;
			}
		}else if(s[n-1-i]=='>'){
			for(int j=i/sq*sq; j<=i; j++){
				x[j]*=b;
			}
			for(int j=0; j<i/sq; j++){
				c1[j]++;
				c0[j]*=b;
			}
		}else{
			for(int j=i/sq*sq; j<=i; j++){
				x[j]*=binv;
			}
			for(int j=0; j<i/sq; j++){
				c1[j]--;
				c0[j]*=binv;
			}
		}
		for(int j=0; j<i/sq; j++){
			ull x0=(b0-c0[j])*bp[med-c1[j]];
			auto itr=mp[j].find(x0);
          if(itr!=mp[j].end()) ans+=((ll)(itr->second));
		}
		for(int j=i/sq*sq; j<=i; j++){
			if(b0==x[j]) ans++;
		}
		if((i+1)%sq==0){
			for(int j=i/sq*sq; j<=i; j++){
				mp[i/sq][x[j]]++;
			}
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 21116
from operator import itemgetter


def protect(N,M):
    DP = []
    for i in range(N):
        DP.append(list(map(int, input().split())))

    DP.sort(key=itemgetter(1))
    nokori = 0

    for i in range(N):
        if M > DP[N - i - 1][0]:
            M -= DP[N - i - 1][0]
            DP.pop()
        elif M <= DP[N - i - 1][0]:
            nokori = (DP[N - i - 1][0] - M) * DP[N - i - 1][1]
            M = 0
            DP.pop()
            break

    for i in range(len(DP)):
        nokori += DP[i][0] * DP[i][1]

    print(nokori)


while True:
    NM = input().split()
    N = int(NM[0])
    M = int(NM[1])
    if N==0:
        break
    protect(N,M)





Measured memory_bytes: 7196
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n)for(int i=0;i<(n);i++)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
using ll = long long;
using P = pair<int, int>;

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

int main(){
    int n; cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];

    vector<int> left(n+1, 0), right(n+1, 0);
    for(int i = 0; i < n; i++)left[i+1] = gcd(left[i], a[i]);//[0, i)
    for(int i = n-1; i >= 0; --i) right[i] = gcd(right[i+1], a[i]);//[i,n)

    ll res = 0;
    for(int i = 0; i < n; i++){
        int l = left[i];//[0,i)
        int r = right[i+1];//[i+1,n)
        res = max(res, gcd(l, r));
    }
    cout << res << endl;
}

Measured memory_bytes: 1408
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
#include<list>
#include <array>
using namespace std;
#define i64  long long
#define int  long long
 
#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807
#define INF I64_MAX
#define MOD 1000000007


void solve(void)
{
  int A,B,H;
  cin>>A>>B>>H;
  cout<<(A+B)*H/2<<endl;
  
  return;
}



int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  // std::cout << std::fixed;
  // std::cout << std::setprecision(8);

  solve();

 
  return 0;
}

Measured memory_bytes: 256
import re
S = input()
'''
メタ文字：
^ = 文字列の先頭、
| = OR
+ = 直前のパターンを1回以上繰り返し、
$ = 文字列の末尾
'''
if re.match("^(dream|dreamer|erase|eraser)+$", S):
    print('YES')
else:
    print('NO')

Measured memory_bytes: 75004
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<array>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<functional>
#include<limits>
#include<list>
#include<map>
#include<numeric>
#include<set>
#include<stack>
#include<string>
#include<sstream>
#include<unordered_map>
#include<queue>
#include<vector>
using namespace std;

//#define int long long
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;

#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(a) (a).begin(),(a).end()
#define dump(o) {cerr<<#o<<" "<<o<<endl;}
#define dumpc(o) {cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
const int MOD = 1e9 + 7;

signed main() {
	int n; cin >> n;
	rep(i, 0, n) {
		double H = 360, M = 360;
		string s; cin >> s;
		double h = stoi(s.substr(0, 2)), m = stoi(s.substr(3, 2));
		M = M*m / 60;
		H = H*h / 12 + m / 60 * 30;
		double a;
		if (H < M)swap(H, M);
		a = min(H - M, abs(H - M - 360));
		if (a < 30)cout << "alert" << endl;
		else if (a < 90)cout << "warning" << endl;
		else cout << "safe" << endl;
	}
	return 0;
}

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

#define mem(arr, i) fill(arr, arr + sizeof(arr), i)
#define MEM(arr, i) memset(arr, i, sizeof(arr))
#define Push push_back
#define Pair make_pair
#define ALL(x) x.begin(), x.end()
#define X first
#define Y second
#define ACCEL ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
typedef unsigned long long ull;
typedef long long lli;
typedef pair<int,int> pii;
typedef pair<lli,lli> pll;
typedef pair<pll,lli> p3l;
typedef vector<int> vcI;
typedef vector<lli> vcL;
typedef vector<pii> vPI;
typedef vector<pll> vPL;
typedef vector<p3l> v3L;
typedef vector<vcL> vvL;
//typedef priority_queue<T> prior_S<T>;
//typedef priority_queue< T, vector<T>, greater<T> > prior_B<T>;
const double PI = 3.141592653589793;
const lli I_MAX = 1LL << 60;
      lli   mod = 1000000007;

/// templates ///

const lli maxN = 2E5;

vcL inv(maxN+5, 1);
vcL fac(maxN+5, 1);

void ADD(lli &x, lli y) {
	x += y;
	if (x >= mod) x -= mod;
	if (x < 0) x += mod;
}

void MUL(lli &x, lli y) {
	x *= y;
	x = (x % mod + mod) % mod;
}

lli mypow(lli b, lli e) {
	lli ans = 1;
	while (e) {
		if (e & 1) MUL(ans, b);
		MUL(b, b);
		e >>= 1;
	}
	return ans;
}

lli modinv(lli n) {
	return mypow(n, mod - 2);
}

void calcInv(lli n) {
	for (int i = 2; i <= n; ++i) {
		inv[i] = (mod - mod / i) * inv[mod % i] % mod;
	}
}

void calcFac(lli n) {
	for (int i = 2; i <= n; ++i) {
		fac[i] = fac[i - 1] * i % mod;
	}
}

lli cm(lli a, lli b) {
	lli ans = 1;
	if (a < b) return 0;

	MUL(ans, inv[fac[a - b]]);
	MUL(ans, inv[fac[b]]);
	MUL(ans, fac[a]);

	return ans;
}

lli Lucas(lli n, lli m) {
	if (m == 0) return 1;
	return cm(n % mod, m % mod) * Lucas(n / mod, m / mod) % mod;
}

lli doLucas(lli n, lli m) {
	calcInv(mod);
	calcFac(mod);
	return Lucas(n, m);
}

/// coding area ///

const lli maxn = 1E5;

void precal() {

	return;
}

void solve() {
	lli n;
	cin >> n;
	
	vcL num(n);
	for (auto &x : num) cin >> x;
	
	sort(ALL(num));
	
	lli ans = 0;
	
	for (int i = n-1; i >= 1; i -= 2) {
		if (num[i] != num[i - 1]) {
			ans = -1;
		}
	}
	
	if (ans == -1) {
		cout << 0 << '\n';
	}
	else {
		cout << mypow(2, n / 2) << '\n';
	}
}

int main() {
	precal();
	int t = 1;
	#ifdef LOCAL
		t = INT_MAX;
	#else
		ACCEL;
	#endif
//	cin >> t;
	for (int i = 1; i <= t; ++i) {
//		printf("Case #%d: ", i );
		solve();
	}
	return 0;
}



Measured memory_bytes: 4224
from collections import deque
n,q = map(int,input().split())
ad_ls = [[] for _ in range(n+1)]
count_ls = [0] * (n+1)
done_ls = [0] * (n+1)
for i in range(n-1):
    a,b = map(int,input().split())
    ad_ls[a].append(b)
    ad_ls[b].append(a)
for i in range(q):
    p,x = map(int,input().split())
    count_ls[p] += x
def turn(ver):
    if ad_ls[ver]:
        for ad in  ad_ls[ver]:
            if not done_ls[ad]:
                count_ls[ad] += count_ls[ver]
                q.append(ad)
    done_ls[ver] = 1
q = deque()
q.append(1)
while len(q) > 0:
    target = q.popleft()
    turn(target)
count_ls = list(map(str, count_ls))
print(' '.join(count_ls[1:]))

Measured memory_bytes: 65032
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define MOD 1000000007
using namespace std;
using ll = long long;
int n;
void dfs(string s,char mx)
{
    if(s.size() == n)
    {
        cout << s << "\n";
    }
    else
    {
        for(char c = 'a';c <= mx;c++)
        {
            if(c == mx)
            {
                dfs(s + c,(char)(mx + 1));
            }
            else
            {
                dfs(s + c,mx);
            }
        }
    }
}
int main()
{
    cin >> n;
    dfs("",'a');

    return 0;
}

Measured memory_bytes: 1536
#include <bits/stdc++.h>
using namespace std;
 
typedef long long int ll;
 
 
 
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
 
	ll i,j,k,l,m,n,x,y,z,a,b,c;
 
	string s,t;

	cin >> s >> t;

	n = t.size();
	m = s.size();

	ll ans = n;

	for(i=0;i<=(m-n);i++)
	{
		k = 0;
		for(j=0;j<n;j++)
		{
			if(s[i+j] == t[j])
				k++;
			// /else
				// break;

		}
		// cout << k << '\n';
		ans = min(ans,n-k);

	}

	cout << ans << '\n';
 
}

Measured memory_bytes: 3656
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define each(a,x) for(auto a : (x))
#define all(a) (a).begin(),(a).end()
#define chmin(a,b) ((a) = min((a),(b)))
#define chmax(a,b) ((a) = max((a),(b)))
#define in_range(x,l,r) ((l)<=(x) && (x)<(r))
#define fs first
#define sc second
#define pb push_back
#define sz size() 
#define MP make_pair
using namespace std;
typedef long long ll;
typedef double D;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<string> vs;

const static int INF = 1e8;
const static D EPS = 1e-8;

int main(){
  string s;
  cin >> s;
  ll ans = 0, n = s.size(), l = 1;

  reverse(all(s));
  rep(i,s.size()){
    ll d = s[i]-'0';
    ans += d * l * (1<<(n-1-i));
    l = l*10 + (1<<i);
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)

ll ans;
ll a[100010];
int main(){
	int n;
	scanf("%d",&n);
	rep(i,1,n+1)scanf("%lld",a+i);
	ll ans=0;
	rep(i,0,n+1)ans+=llabs(a[i+1]-a[i]);
	rep(i,1,n+1)printf("%lld\n",ans-llabs(a[i]-a[i-1])-llabs(a[i+1]-a[i])+llabs(a[i+1]-a[i-1]));
	return 0;
}

Measured memory_bytes: 1920
n, y = list(map(int, input().split(' ')))

for i in range(n + 1):
    for j in range(n + 1 - i):
        val = 10000 * i + 5000 * j + 1000 * (n - i - j)
        if val == y:
            print(i, j, (n - i - j))
            exit()


print(-1, -1, -1)




Measured memory_bytes: 41304
#include<bits/stdc++.h>
using namespace std;
#define int         long long
#define ull 	    unsigned long long
#define ll 	    long long
#define N	    100005
#define M 	    1000000007
#define pb 	    push_back
#define p_q 	    priority_queue
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define vii         vector<pii>
#define mi          map<ll,ll>
#define mii         map<pii,ll>
#define all(a)      (a).begin(),(a).end()
#define sz(x)       (ll)x.size()
#define endl        '\n'
#define gcd(a,b)    __gcd((a),(b))
#define lcm(a,b)    ((a)*(b)) / gcd((a),(b))
#define ios	    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define mp 	    make_pair
#define lb 	    lower_bound
#define ub	    upper_bound
#define F           first
#define S           second
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define ini(a,n,b)	for(ll int i=0;i<n;i++) a[i]=0;
#define cset(a)		__builtin_popcountll(a)
#define hell 		(ull)1e9
#define re 		resize


signed main(void)
{ios
	int TESTS=1;
	//cin>>TESTS;
	while(TESTS--)
	{
		string s,t;
		cin>>s>>t;
		int n=sz(s);
		int m=sz(t);
		int dp[n+1][m+1];
		rep(i,0,n+1) dp[i][0]=0;
		rep(i,0,m+1) dp[0][i]=0;
		rep(i,1,n+1)
		{
			rep(j,1,m+1)
			{
				if(s[i-1]==t[j-1])
					dp[i][j]=dp[i-1][j-1]+1;
				else
					dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
			}
		}
		//int ans=dp[n][m];
		int i=n,j=m;
		string ans="";
		while(i>0 and j>0)
		{
			if(s[i-1]==t[j-1])
			{
				ans.append(s,i-1,1);
				i--;j--;
			}
			else if(dp[i-1][j]>dp[i][j-1]) i--;
			else	j--;
		}
		for(int k=sz(ans)-1;k>=0;k--) cout<<ans[k];
	}
	
}

Measured memory_bytes: 70656
n = int(input())
a = list(map(int, input().split()))

d = dict()
for key in a:
  if key in d:
    d[key] += 1
  else:
    d[key] = 1

sm = 0
for key in d:
  sm += d[key]*(d[key]-1)//2

for key in a:
  print(sm-d[key]+1)

Measured memory_bytes: 26268
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=(a);i<=(b);++i)
#define rrep(i,a,b) for(int i=(a);i>=(b);--i)
#define PB push_back
#define ar2 array<int, 2>
typedef long long LL;
const LL P = 998244353;
const int N = 3005;
mt19937 rng(time(0));

LL dp[N][N];
int a,b,c,d;

int main(){
	cin>>a>>b>>c>>d;
	
	dp[a][b] = 1;
	rep(i,a,c) rep(j,b,d){
		if(i==a && j==b) continue;
		if(i==a) dp[i][j] = dp[i][j-1]*i%P;
		else if(j==b) dp[i][j] = dp[i-1][j]*j%P;
		else{
			dp[i][j] = (dp[i][j-1]*i%P + dp[i-1][j]*j%P - dp[i-1][j-1]*(i-1)%P*(j-1)%P + P) % P;
		}
	}
	cout<<dp[c][d]<<endl;
	return 0;
}

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

#define task "B"
#define all(v) (v).begin(), (v).end()
#define rep(i, l, r) for (int i = (l); i <= (r); ++i)
#define Rep(i, r, l) for (int i = (r); i >= (l); --i)
#define DB(X) { cerr << #X << " = " << (X) << '\n'; }
#define DB1(A, _) { cerr << #A << "[" << _ << "] = " << (A[_]) << '\n'; }
#define DB2(A, _, __) { cerr << #A << "[" << _ << "][" << __ << "] = " << (A[_][__]) << '\n'; }
#define DB3(A, _, __, ___) { cerr << #A << "[" << _ << "][" << __ << "][" << ___ << "] = " << (A[_][__][___]) << '\n'; }
#define PR(A, l, r) { cerr << '\n'; rep(_, l, r) DB1(A, _); cerr << '\n';}
#define SZ(x) ((int)(x).size())
#define pb push_back
#define eb emplace_back
#define pf push_front
#define F first
#define S second
#define by(x) [](const auto& a, const auto& b) { return a.x < b.x; } // sort(arr, arr + N, by(a));
#define next ___next
#define prev ___prev
#define y1 ___y1
#define left ___left
#define right ___right
#define y0 ___y0
#define div ___div
#define j0 ___j0
#define jn ___jn

using ll = long long;
using ld = long double;
using ull = unsigned long long;
using namespace std;
typedef pair<int, int> ii;
typedef pair<ii, int> iii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<ll> vl;
const int N = 1e6 + 1;
int n;
string a;
bool isodd(int k, int n)
{
    // return if nCk is odd or not
    // Lucas's theorem
    Rep(i, 19, 0)
    {
        int bn = (n >> i & 1);
        int bk = (k >> i & 1);
        if (bn < bk) return 0;
    }
    return 1;
}
int main()
{
#ifdef HynDuf
    freopen(task".in", "r", stdin);
    //freopen(task".out", "w", stdout);
#else
    ios_base::sync_with_stdio(false); cin.tie(nullptr);
#endif
    cin >> n >> a;
    a = '0' + a;
    int num1 = 0;
    rep(i, 1, n) if (a[i] == '2') num1 += isodd(i - 1, n - 1);
    if (num1 & 1) cout << 1;
    else
    {
        bool ok = 0;
        rep(i, 1, n) if (a[i] == '2')
        {
            ok = 1;
            break;
        }
        if (ok) cout << 0;
        else
        {
            num1 = 0;
            rep(i, 1, n) if (a[i] == '3') num1 += isodd(i - 1, n - 1);
            if (num1 & 1) cout << 2;
            else cout << 0;
        }
    }
    return 0;
}


Measured memory_bytes: 5256
import bisect
s = list(input())

ans = [0] * len(s)
rl = []
for i in range(1,len(s)):
    if s[i] == 'L' and s[i-1] == 'R':
        rl.append(i)
# print(rl)
for i in range(len(s)):
    idx = bisect.bisect_left(rl, i)
    if idx < len(rl) and i != rl[idx]:
        if s[i] == 'L':
            idx -= 1
        idx = max(idx,0)
    if idx >= len(rl):
        idx = -1

    # print(i,idx)
    d = abs(i-rl[idx])
    if d % 2 == 0:
        ans[rl[idx]] += 1
    else:
        ans[rl[idx]-1] += 1
    # print(i,idx)
    # print(ans)
a = ''
for i, aa in enumerate(ans):
    a += str(aa) + ' '
print(a)


Measured memory_bytes: 7076
#include "bits/stdc++.h"
#define lp(i,a,b) for(int i=(a);i<(b);++i)
using namespace std;
int main()
{
	string str;
	cin>>str;
	bool k=0;
	for(int i=0;i<str.size();i++)
	{
		for(int j=i+1;j<str.size();j++)
		{
			if(str[i]==str[j])
			{
				k=1;
				break;
			}
		}
	}
	if(k) cout<<"no";
	else cout<<"yes";
}


Measured memory_bytes: 256
using System;

namespace C
{
    class Program
    {
        static void Main(string[] args)
        {
            long N = long.Parse(Console.ReadLine());
            var s = Math.Sqrt(N);
            long minMove = 10000000000000;

            for (long i = 1; i <= s; i++)
            {
                if (N % i == 0)
                {
                    var move = i + (N / i);
                    if (minMove > move)
                        minMove = move;
                }
            }
            Console.WriteLine(minMove-2);
        }
    }
}


Measured memory_bytes: 11220
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
string n;
int k;
vector<int> d;

char ans[11];
bool solve(int m,bool f){
  if(m >= (int)n.size()) return true;

  for(int i = 0; i < k; i++){
    bool ret = false;
    ans[m] = d[i]+'0';
    if(f){
      ret = solve(m+1,true);
    }else if(n[m]-'0' == d[i]){
      ret = solve(m+1,false);
    }else if(n[m]-'0' < d[i]){
      ret = solve(m+1,true);
    }
    if(ret) return true;
  }
  return false;
}

bool ad[11];
int main(void){
  cin >> n >> k;
  for(int i = 0; i < k; i++){
    int dd;
    cin >> dd;
    ad[dd] = true;
  }
  for(int i = 0; i < 10; i++)
    if(!ad[i])
      d.push_back(i);
  k = 10-k;

  memset(ans,0,sizeof(ans));
  if(solve(0,0)){
    cout << ans << endl;
  }else{
    for(int i = 0; i <= (int)n.size(); i++){
      if(i == 0 && d[0] == 0)
	cout << d[1];
      else
	cout << d[0];
    }
    cout << endl;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 2;i<n;++i)
typedef long long ll;
bool IsPrime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return false;
        }
    }

    // 素数である
    return true;
  }


int main(){
  int num;
  cin >> num;
  IsPrime(num);
  while(!IsPrime(num)){
    ++num;
  }
  cout << num << endl;
  return 0;
}


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

int n;
vector<vector<ll>> dist;
vector<vector<ll>> dp;

ll solve(int s, int v){
    if(dp[s][v] >= 0) return dp[s][v];
    if(s==(1<<n)-1 && v==0) return dp[s][v] = 0;

    ll ret = INF;
    rep(nv, n){
        if(!(s & (1<<nv))) ret = min(ret, solve(s|(1<<nv), nv) + dist[v][nv]);
    }

    dp[s][v] = ret;
    return ret;
}


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

    int m;
    cin >> n >> m;

    dist.assign(n, vector<ll>(n, INF));
    rep(i, m){
        int s, t;
        ll d;
        cin >> s >> t >> d;

        dist[s][t] = d;
    }

    dp.assign(1<<n, vector<ll>(n, -1));
    ll res = solve(0, 0);

    if(res == INF) cout << -1 << endl;
    else cout << res << endl;

    return 0;
}


Measured memory_bytes: 7892
#include <iostream>
#include<algorithm>
#include <stdio.h>
#include <string>
#include <string.h>
#include <map>
#include <math.h>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <deque>
//#include <bits/stdc++.h>
using namespace std;
typedef  long long ll;
const int N=1e5+7;
int a[1001];
int main()
{
   int n,l;
   cin>>n>>l;
   int sum=0;
   for(int i=1;i<=n;i++)
       a[i]=l+i-1,sum+=a[i];
   int b[1001]={0};
   for(int i=1;i<=n;i++)
   {
       for(int j=1;j<=n;j++)
       {
           if(j!=i)
               b[i]+=a[j];
       }
   }
   int c=99999999,k;
   for(int i=1;i<=n;i++)
   {
       if(c>abs(sum-b[i]))
       {
           c=abs(sum-b[i]);
           k=i;
       }
   }
   cout<<b[k]<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main (){
    int x[3],n,k;
    scanf("%d %d %d",&x[0],&x[1],&x[2]);
    
    for (n=0; n<2; n++) {
        if (x[n]>x[n+1]) {
            k=x[n];
            x[n]=x[n+1];
            x[n+1]=k;
        }
    }
    
    for (n=0; n<2; n++) {
        if (x[n]>x[n+1]) {
            k=x[n];
            x[n]=x[n+1];
            x[n+1]=k;
        }
    }
    
    printf("%d %d %d\n",x[0],x[1],x[2]);
    
    return 0;

}

Measured memory_bytes: 596
#include <bits/stdc++.h>
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define rep(i,n) for (int i=0;i<(int)(n);i++)
#define codefor int test;scanf("%d",&test);while(test--)
#define INT(...) int __VA_ARGS__;in(__VA_ARGS__)
#define LL(...) ll __VA_ARGS__;in(__VA_ARGS__)
#define yn(ans) if(ans)printf("Yes\n");else printf("No\n")
#define YN(ans) if(ans)printf("YES\n");else printf("NO\n")
#define vector1d(type,name,...) vector<type>name(__VA_ARGS__)
#define vector2d(type,name,h,...) vector<vector<type>>name(h,vector<type>(__VA_ARGS__))
#define umap unordered_map
#define uset unordered_set
using namespace std;
using ll = long long;
const int MOD=1000000007;
//入力系
void scan(int& a){scanf("%d",&a);}
void scan(long long& a){scanf("%lld",&a);}
template<class T> void scan(T& a){cin>>a;}
template<class T> void scan(vector<T>& vec){for(auto&& it:vec)scan(it);}
void in(){}
template <class Head, class... Tail> void in(Head& head, Tail&... tail){scan(head);in(tail...);}
//出力系
void print(const int& a){printf("%d",a);}
void print(const long long& a){printf("%lld",a);}
void print(const double& a){printf("%.15lf",a);}
template<class T> void print(const T& a){cout<<a;}
template<class T> void print(const vector<T>& vec){if(vec.empty())return;print(vec[0]);for(auto it=vec.begin();++it!= vec.end();){putchar(' ');print(*it);}}
void out(){putchar('\n');}
template<class T> void out(const T& t){print(t);putchar('\n');}
template <class Head, class... Tail> void out(const Head& head,const Tail&... tail){print(head);putchar(' ');out(tail...);}
//デバッグ系
template<class T> void dprint(const T& a){cerr<<a;}
template<class T> void dprint(const vector<T>& vec){if(vec.empty())return;cerr<<vec[0];for(auto it=vec.begin();++it!= vec.end();){cerr<<" "<<*it;}}
void debug(){cerr<<endl;}
template<class T> void debug(const T& t){dprint(t);cerr<<endl;}
template <class Head, class... Tail> void debug(const Head& head, const Tail&... tail){dprint(head);cerr<<" ";debug(tail...);}
ll intpow(ll a, ll b){ ll ans = 1; while(b){ if(b & 1) ans *= a; a *= a; b /= 2; } return ans; }
ll modpow(ll a, ll b, ll p){ ll ans = 1; while(b){ if(b & 1) (ans *= a) %= p; (a *= a) %= p; b /= 2; } return ans; }
ll updivide(ll a,ll b){if(a%b==0) return a/b;else return (a/b)+1;}

int main(){
    char c='z';
    c++;
    string s;
    int k;
    in(s,k);
    for(int i=0;i<s.length();i++){
        if(c-s[i]<=k){
            if(s[i]!='a'){
                k-=c-s[i];
                s[i]='a';
            }
        }
        if(i==s.length()-1&&k>0){
            s[i]+=k%26;
            if(s[i]>'z')s[i]-=26;
        }
    }
    out(s);
}

Measured memory_bytes: 3764
using System;

namespace Problem_A
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            var input = Console.ReadLine();
            var count = 0;
            foreach (var c in input)
            {
                if (c == '1') count++;
            }
            Console.WriteLine($"{count}");
        }
    }
}

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

#include <algorithm>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <utility>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define loop(i, x, n) for (int i = (x); i < (n); i++)
#define all(v) (v).begin(), (v).end()
#define int long long
using namespace std;
const int MOD = 1e9 + 7;
const int INF = 1e10;
template<typename T> void cmax(T &a, T b) { a = max(a, b); }
template<typename T> void cmin(T &a, T b) { a = min(a, b); }

vector<int> b(2000006);
signed main() {
  int n, m;
  while (cin >> n >> m) {
    if (n == 0 && m == 0) break;

    vector<int> a(n);
    rep(i, n) cin >> a[i];
    fill(all(b), 0);

    rep(i, n) {
      loop(j, i + 1, n) {
        if (a[i] + a[j] < 2000006) {
          b[a[i] + a[j]] = 1;
        }
      }
    }
    int ans = -INF;
    for (int i = m; i >= 0; i--) {
      if (b[i] == 1) {
        ans = i;
        break;
      }
    }
    cout << (ans == -INF ? "NONE" : to_string(ans)) << endl;
  }
  return 0;
}



Measured memory_bytes: 18252
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(long long i=0; i<(n); i++)
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; }


int main(){
    ll n,m; cin>>n>>m;
    vector<ll> x(n), y(m);
    const ll mod = 1e9+7;
    ll tmp1=0, tmp2=0;
    rep(i,n) cin>>x[i];
    rep(i,m) cin>>y[i];
    rep(i,n){
        tmp1+=(-n+1+2*i)*x[i];
        tmp1%=mod;
    }
    rep(i,m){
        tmp2+=(-m+1+2*i)*y[i];
        tmp2%=mod;
    }
    ll res=tmp1*tmp2;
    res%=mod;
    cout<<res<<endl;
    return 0;
}

Measured memory_bytes: 1792
var input=`
5
abaaaaaaaa
oneplustwo
aaaaaaaaba
twoplusone
aaaabaaaaa
`;
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var arr=input.trim().split("\n").reverse();
var n=arr.pop()-0;
var s=arr.map(v=> v.split("").sort().join(""));
s.sort();
var sum=0;
var cnt=1;
s.reduce((a,b)=>{
   if(a==b)cnt++;
   else {
      sum+=(cnt*(cnt-1))/2;     
      cnt=1;
   }
   return b;
});
sum+=(cnt*(cnt-1))/2;
console.log(sum);

Measured memory_bytes: 51316
class InputLine
  def self.to_s
    gets.chomp
  end

  def self.to_i
    InputLine.to_s.to_i
  end
  
  def self.to_f
    InputLine.to_s.to_f
  end

  def self.to_sa
    InputLine.to_s.split(' ')
  end

  def self.to_ia
    InputLine.to_sa.map(&:to_i)
  end
  
  def self.to_fa
    InputLine.to_sa.map(&:to_f)
  end
end

def main(argv)
  k = InputLine.to_i

  x = 7
  m = -1
  1e+7.to_i.times do |i|
    if (x % k) == 0 then
      m = i + 1
      break
    end

    x = (x * 10 + 7) % k
  end
  puts m.to_s
end

if self.to_s == 'main' then
  main(ARGV)
end

Measured memory_bytes: 14332
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#include<algorithm>//next_permutation
#define rep(i,n) for (int i = 0;i < (n);i++)
#define all(v) v.begin(),v.end()
#define dec(n) cout << fixed << setprecision(n);
#define large "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
#define small "abcdefghijklmnopqrstuvwxyz"
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using vl = vector<ll>;
using vvl = vector<vl>;

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

const ll MOD = 1000000007;
const ll MAX = 2000001;

ll mod(ll a){
  return a % MOD;
}

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

ll fac[MAX], finv[MAX], inv[MAX];

void nCrprep() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

ll nCr(ll n, ll r){
    if (n < r) return 0;
    if (n < 0 || r < 0) return 0;
    return fac[n] * (finv[r] * finv[n - r] % MOD) % MOD;
}

ll nCrcheep(ll n,ll r){
  if(r == 0) return 1;
  else if(r == 1) return n;
  else return nCrcheep(n-1,r-1)*n/r;
}

vector<pair<ll,ll>> prime_factorize(ll n){
  vector<pair<ll,ll>> res;
  
  for(ll i=2; i*i <= n; i++){
    if(n % i != 0) continue;
    
    ll ex = 0;
    while(n % i == 0){
      ex++;
      n /= i;
    }
    
    res.push_back({i,ex});
  }
  
  if(n != 1) res.push_back({n,1});
  
  return res;
  
}




int main(){
  ll n,h,w; cin >> n >> h >> w;
  
  cout << (n-h+1)*(n-w+1) << endl;
  
  
}

Measured memory_bytes: 3624
import sys
k=int(input())
A=[0]*k
C=[7%k]
A[7%k]=1
if 7%k==0:
    print(1)
    sys.exit()
while True:
    now=(C[-1]*10+7)%k
    if A[now]==1:
        print(-1)
        break
    A[now]=1
    C.append(now)
    if now==0:
        print(len(C))
        break

Measured memory_bytes: 56308
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define MOD 1000000007
#define print(A,n) for(ll i=0;i<n;++i)cout<<A[i]<<' ';cout<<endl;
#define take(A,n) for(ll i=0;i<n;++i)cin>>A[i];
//    for(auto& it : m)
void fastio(){ios_base::sync_with_stdio(false);cin.tie(NULL);}
//  priority_queue<ll int> pq;
//  priority_queue <ll int, vector<ll int>, greater<ll int> > pq;
//  vector<ll int> v;
//  vector< pair<ll int,ll int> > v;
//  set<ll int>::iterator it=s.begin();
//  unordered_map<  pair<ll int,ll int>, ll int> mp;

 

ll int power(ll int x, ll int y, ll int p)  
{  
    ll int res = 1;     // Initialize result  
  
    x = x % p; // Update x if it is more than or  
                // equal to p 
   
    if (x == 0) return 0; // In case x is divisible by p; 
  
    while (y > 0)  
    {  
        // If y is odd, multiply x with result  
        if (y & 1)  
            res = (res*x) % p;  
  
        // y must be even now  
        y = y>>1; // y = y/2  
        x = (x*x) % p;  
    }  
    return res;  
}  

void computeLPSArray(string pat, int M, int* lps) 
{ 
    // length of the previous longest prefix suffix 
    int len = 0; 
  
    lps[0] = 0; // lps[0] is always 0 
  
    // the loop calculates lps[i] for i = 1 to M-1 
    int i = 1; 
    while (i < M) { 
        if (pat[i] == pat[len]) { 
            len++; 
            lps[i] = len; 
            i++; 
        } 
        else // (pat[i] != pat[len]) 
        { 
            // This is tricky. Consider the example. 
            // AAACAAAA and i = 7. The idea is similar 
            // to search step. 
            if (len != 0) { 
                len = lps[len - 1]; 
  
                // Also, note that we do not increment 
                // i here 
            } 
            else // if (len == 0) 
            { 
                lps[i] = 0; 
                i++; 
            } 
        } 
    } 
}
bool isPrime(int n) 
{ 
    // Corner cases 
    if (n <= 1)  return false; 
    if (n <= 3)  return true; 
  
    // This is checked so that we can skip  
    // middle five numbers in below loop 
    if (n%2 == 0 || n%3 == 0) return false; 
  
    for (int i=5; i*i<=n; i=i+6) 
        if (n%i == 0 || n%(i+2) == 0) 
           return false; 
  
    return true; 
} 
  

int main()
{
  fastio();

 
ll int T;
T=1;

while(T--)
{ 
  string s;
  cin>>s;
  s=s.substr(0,3);
  cout<<s<<endl;

}



    
  



    return 0;
}


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

int main()
{
	ll n,k;
	cin >> n >> k;
	ll ans = 0;
	for(int i = 1;i<=n;i++)
	{
		if(i%k==0)
		{
			ans += (n/k)*(n/k);
		}
		if(k%2==0&&i%k==k/2)
		{
			ans += (n/k+(n%k<k/2?0:1))*(n/k+(n%k<k/2?0:1));
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<vector>
#include<cctype>
using namespace std;
int n;
inline int gwstot()
{
	int tot(0);
	while(n){tot+=(n%10),n/=10;}
	return tot;
}
signed main()
{
	scanf("%d",&n);
	puts(((n%(gwstot()))?("No"):("Yes")));
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define int long long int
#define double long double
#define inf (int)(1e15)
#define all(x) (x).begin(), (x).end()
#define pair pair<int, int>
typedef vector<int> vi;   // Vector of long long
typedef vector<vi> vvi;   // Vector of vi
typedef vector<pair> vii; // Vector of pairs
typedef vector<vii> vvii; // Vector of Vector of pairs
typedef vector<bool> vb;  // Vector of bool
#define pq priority_queue // Max heap (To convert to min heap, use negative sign before every value)
#define ff first          // For pairs
#define ss second
const int dx4[] = {1, 0, -1, 0}, dy4[] = {0, -1, 0, 1};
const int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1}, dy8[] = {1, -1, 1, 0, -1, 1, -0, -1};
#define testcases(t) \
    int(t);          \
    cin >> (t);      \
    while ((t)--)
vvi adj;
int n, m, u, v;
int dp[(int)(1e5 + 4)][2];
void dfs(int v, int p)
{
    dp[v][0] = 1, dp[v][1] = 1;
    for (auto it : adj[v])
    {
        if (it == p)
            continue;
        dfs(it, v);
        dp[v][1] *= dp[it][0];
        dp[v][1] %= mod;
        dp[v][0] *= (dp[it][0] + dp[it][1]);
        dp[v][0] %= mod;
    }
    return;
}
signed main()
{
    cin >> n;
    adj.resize(n + 1);
    for (int i = 1; i < n; i++)
    {
        cin >> u >> v;
        adj[u].pb(v);
        adj[v].pb(u);
    }
    dfs(1, 1);
    cout << ((dp[1][0] + dp[1][1]) % mod) << endl;
    return 0;
}

Measured memory_bytes: 16984
#include <bits/stdc++.h>
#include <numeric>
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;

int main(){
    string s;
    cin >> s;
    int c=0;
    for(int i=0;i<3;i++) if(s[i]=='1') c++;
    cout << c << endl;
}


Measured memory_bytes: 256
fun main(args: Array<String>) {
    val (x, y) = readLine()!!.split(" ").map(String::toLong)
    var m = Long.MAX_VALUE
    m = calc008(y - x, m)
    m = calc008(x + y + 1, m)
    m = calc008(-x - y + 1, m)
    m = calc008(x - y + 2, m)
    println(m)
}
fun calc008(a: Long, b: Long): Long {
    return if (a < 0) b else Math.min(a, b)
}

Measured memory_bytes: 37864
#pragma GCC optimize("O3")
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
using P=pair<ll,ll>;
template<class T> using V=vector<T>; 
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
const ll inf=(1e18);
//const ll mod=998244353;
const ll mod=1000000007;
ll GCD(ll a,ll b) {return b ? GCD(b,a%b):a;}
ll LCM(ll c,ll d){return c/GCD(c,d)*d;}
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
int main(){
  ll n,k;
  cin>>n>>k;
  ll ans=0;
  V<P> d(n);
  V<int> cnt(n,0);
  priority_queue<P> pq;
  priority_queue<P,V<P>,greater<P>> q;
  for(int i=0;i<n;i++){
	  cin>>d[i].se>>d[i].fi;
	  d[i].se--;
	  pq.push(d[i]);
  }
  ll res=0;
  ll sum=0;
  while(pq.size()){
	  res+=pq.top().fi;
	  cnt[pq.top().se]++;
	  q.push(pq.top());
	  pq.pop();
	  sum++;
	  if(sum==k)break;
  }
  ll t=0;
  for(int i=0;i<n;i++)if(cnt[i])t++;
  ans=res+t*t;
  sum=0;
  while(pq.size()){
	  if(cnt[pq.top().se]){
		  pq.pop();
		  continue;
	  }
	  while(q.size()){
		  if(cnt[q.top().se]==1){
			  sum+=q.top().fi;
			  res-=q.top().fi;
			  q.pop();
		  }else{
			  res-=q.top().fi;
			  cnt[q.top().se]--;
			  q.pop();
			  sum+=pq.top().fi;
			  cnt[pq.top().se]=1;
			  t++;
			  break;
		  }
	  }
	  chmax(ans,res+sum+t*t);
	  pq.pop();
  }
  cout<<ans<<"\n";
}

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

int main(){
	int n,v;
	long long dp[101][21]={};
	cin>>n;
	cin>>v;
	dp[0][v]=1;
	for(int i=0;i<n-2;i++){
		cin>>v;
		for(int j=0;j<=20;j++){
			if(j+v<=20)dp[i+1][j+v] += dp[i][j];
			if(0<=j-v)dp[i+1][j-v] += dp[i][j];
		}
	}
	cin>>v;
	cout<<dp[n-2][v]<<endl;
	return 0;
}

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

int main(){
  int A, B, K;
  cin >> A >> B >> K;
  
  vector<int> what;
  for(int i = 100; i >= 1; --i){
    if(A % i == 0 && B % i == 0){	
    what.push_back (i);
    }
  }
  
  cout << what[K - 1] << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <math.h>
#include <numeric>
#include <complex>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <bitset>
#include <functional>
#include <assert.h>
using ll=long long;
#define int ll
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define eb emplace_back
#define all(x) x.begin(),x.end()
#define SZ(x) ((int)x.size())
#define fi first
#define se second
const int INF = 1e15;
using namespace std;

template<class T> using vc=vector<T>;
template<class T> using vvc=vc<vc<T>>;

using pi=pair<int,int>;
using vi=vc<int>;

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

signed main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout<<fixed<<setprecision(20);

    string S,T; cin >> S >> T;
    if(SZ(S)+1==SZ(T) && S==T.substr(0,SZ(S))) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 3632
// TEMPLATE
#include <algorithm>
#include <iostream>
#include <set>
#include <vector>
#include <cmath>
#include <utility>
#include <numeric>
#include <queue>

using namespace std;
#define REP(i, n) for (int i=0;(i)<(n);(i)++)
#define len(x) ((int)(x).size())
#define print(x) (cout<<(x)<<"\n")

// LIBRARY
struct BipartiteMatching {
    vector<vector<int>> G;
    vector<int> match;
    vector<bool> used;
    BipartiteMatching(int n) {
        G.resize(n);
        used.assign(n, 0);
        match.assign(n, -1);
    }
    void add_edge(int u, int v) {
        G[u].push_back(v);
        G[v].push_back(u);
    }
    bool dfs(int v) {
        used[v] = 1;
        REP(i, G[v].size()) {
            int u = G[v][i], w = match[u];
            if (w == -1 or (not used[w] and dfs(w))) {
                match[v] = u;
                match[u] = v;
                return true;
            }
        } 
        return false;
    }
    int bipartite_matching() {
        int res = 0;
        REP(i, G.size()) {
            used.assign(G.size(), 0);
            if (match[i] == -1 and dfs(i)) res++;
        }
        return res;
    }
};

// SOLVE
signed main() {
    using P = pair<int, int>;
    int N; cin>>N;
    vector<P> red;
    vector<P> blue;
    REP(i, N) {
        int a, b; cin>>a>>b;
        red.push_back(P(a, b));
    }    
    REP(i, N) {
        int c, d; cin>>c>>d;
        blue.push_back(P(c, d));
    }
    BipartiteMatching bm(2*N);
    REP(r, N) {
        REP(b, N) {
            if (red[r].first < blue[b].first and red[r].second < blue[b].second) {
                bm.add_edge(r, b+N);
            }
        }
    }
    print(bm.bipartite_matching());
}

Measured memory_bytes: 256