akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#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 namespace std;
using P = pair<int, int>; 
using ll = long long;

int main()
{
  int a,b;
    cin >> a>>b;
  cout << a*b << endl;
  return 0;
}


Measured memory_bytes: 3580
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner in = new Scanner(System.in);
        int x1 = in.nextInt();
        int y1 = in.nextInt();
        int x2 = in.nextInt();
        int y2 = in.nextInt();

        int dx = Math.abs(x1-x2);
        int dy = Math.abs(y1-y2);

        if (x1 > x2){
            if (y1 > y2) {
                System.out.println((x2 + dy) + " " + (y2 - dx) + " " + (x1 + dy) + " " + (y1 - dx));
            }else {
                System.out.println((x2 - dy) + " " + (y2 - dx) + " " + (x1 - dy) + " " + (y1 - dx));
            }
        }else {
            if (y1 > y2){
                System.out.println((x2 + dy) + " " + (y2 + dx) + " " + (x1 + dy) + " " + (y1 + dx));
            }else {
                System.out.println((x2 - dy) + " " + (y2 + dx) + " " + (x1 - dy) + " " + (y1 + dx));
            }
        }


    }
}

Measured memory_bytes: 21844
s=input()
l=len(s)
c1=-(-l//2)
c2=l//2
c1b=0
c2b=0

for i in range(l):
  if s[i]=='0':
    if i%2==0:
      c1b+=1
    else:
      c2b+=1
print(min(c1b+c2-c2b, c1-c1b+c2b))

Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
string arr;
int d;
int mod=1e9+7;
long long getsum(int ind,int sum,int flag,vector<vector<vector<long long> > >&dp){
	if(ind==arr.size()) {
		if(sum%d==0) return 1;
		return 0;
	}
	if(dp[ind][sum][flag]!=-1) return dp[ind][sum][flag];
	int limit=9;
	if(!flag) limit=arr[ind]-'0';
	long long res=0;
	for(int i=0;i<=limit;i++){
		if(flag||i<limit){
			res+=getsum(ind+1,(sum+i)%d,1,dp);
		}
		else res+=getsum(ind+1,(sum+i)%d,0,dp);
	}
	dp[ind][sum][flag]=res%mod;
	return res%mod;
	
	
}
int main() {
	
		
		cin>>arr;
	    cin>>d;
	
		
		
		
			vector<vector<vector<long long> > >dp(arr.size()+1,vector<vector<long long> >(200,vector<long long>(2,-1)));
		long long u=getsum(0,0,0,dp);
		
		
		cout<<(u-1+mod)%mod<<endl;
		
		
	
	
	return 0;
}

Measured memory_bytes: 114048
import sys

N = int(input())

txy = [(0, 0, 0)] + [tuple(map(int,input().split())) for i in range(N)]

for i in range(N):
    ti,  xi,  yi  = txy[i]
    ti_, xi_, yi_ = txy[i+1]
    # print(ti, xi, yi)
    # print(ti_, xi_, yi_)

    tdiff = ti_ - ti
    xdiff = xi_ - xi
    ydiff = yi_ - yi
    # print(tdiff, xdiff, ydiff)

    # print(
    #     (tdiff % 2 == (xdiff + ydiff) %2),
    #     (abs(xdiff) <= tdiff),
    #     (tdiff % 2 == ydiff % 2),
    #     (abs(ydiff) <= tdiff)
    # )

    if (
            (tdiff % 2 == (xdiff + ydiff) %2)
            and (abs(xdiff) + abs(ydiff) <= tdiff)
    ):
        continue
    else:
        print('No')
        sys.exit()

print('Yes')
sys.exit()


Measured memory_bytes: 18072
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
	static void Main()
	{
		var t = Array.ConvertAll(Console.ReadLine().Split(new[] { ' ' }), number => long.Parse(number));
		var n = t[0] == 1 ? 1 : t[0] - 2;
		var m = t[1] == 1 ? 1 : t[1] - 2;

		Console.WriteLine(n * m);

		//デバッグ実行での確認用。そのまま提出しても問題なし
		Console.ReadKey();
	}
}


Measured memory_bytes: 13268
#include<iostream>
using namespace std;
 
int main(){
  int a,b,c;
  cin>>a>>b>>c;
  int fi,se;
  fi=se=0;
  if(a==5)fi++;
  else if(a==7)se++;
  if(b==5)fi++;
  else if(b==7)se++;
  if(c==5)fi++;
  else if(c==7)se++;
  if(fi==2 && se==1)cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
  return 0;
}

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

using ll = long long;
using Vi = vector<int>;
using Vl = vector<ll>;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

constexpr int I_INF = numeric_limits<int>::max();
constexpr ll L_INF = numeric_limits<ll>::max();

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

using Tup = tuple<ll, ll, ll>;

void solve() {
    ll N, M;
    cin >> N >> M;
    vector<Tup> cities(M);
    for (ll i = 0; i < M; i++) {
        ll pi, yi;
        cin >> pi >> yi;
        cities[i] = make_tuple(yi, pi, i);
    }
    sort(cities.begin(), cities.end());

    vector<Pll> ans(M);
    unordered_map<ll, ll> pref_num;
    for (const auto& t : cities) {
        ll idx, pref, y;
        tie(y, pref, idx) = t;
        ++pref_num[pref];
        ans[idx].first = pref;
        ans[idx].second = pref_num[pref];
    }

    for (const auto& p : ans) {
        cout << setw(12) << setfill('0');
        cout << p.first * 1000000 + p.second << "\n";
    }
}

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

int main() {
#ifdef FASTIO
    cin.tie(0), cout.tie(0);
    ios::sync_with_stdio(false);
#endif
#ifdef FILEINPUT
    ifstream ifs("./in_out/input.txt");
    cin.rdbuf(ifs.rdbuf());
#endif
#ifdef FILEOUTPUT
    ofstream ofs("./in_out/output.txt");
    cout.rdbuf(ofs.rdbuf());
#endif
    solve();
    cout << flush;
    return 0;
}

Measured memory_bytes: 9508
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        
        Scanner sc = new Scanner(System.in);
        
        int n = Integer.parseInt(sc.next());
        int[] s = new int[n];
        for(int i = 0; i < n; i++){
            s[i] = Integer.parseInt(sc.next());
        }
        int q = Integer.parseInt(sc.next());
        int c = 0;
        for(int i = 0; i < q; i++){
            int x = binarySearch(s, n, Integer.parseInt(sc.next()));
            if(x != -1) c++;
        }
        
        System.out.println(c);
    }
    
    static int binarySearch(int[] a, int n, int key){
        
        int left = 0;
        int right = n;
        
        while(left < right){
            int mid = (left + right) / 2;
            if(a[mid] == key){
                return mid;
            }else if(key < a[mid]){
                right = mid;
            }else{
                left = mid + 1;
            }
        }
        return -1;
    }
}


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

int a, b;
char op;

int calc(int a, int b, char op){
    if(op == '+'){
        return a + b;
    }else if(op == '-'){
        return a - b;
    }else if(op == '*'){
        return a * b;
    }else if(op == '/'){
        return a / b;
    }else{
        return 0;
    }

}

int main(int argc, const char * argv[]) {
    int answer;
    while(1){
    cin >> a >> op >> b;
        if(op == '?') break;
    answer = calc(a, b, op);
    cout << answer << endl;
    }
    return 0;
}


Measured memory_bytes: 3104
#include <iostream>
using namespace std;
int n;
int a[53];
int main(){
	int ans=0;
	cin>>n;for (int i=0;i<n;i++) cin>>a[i];
	for (int i=0;i<n;i++)
		for (int j=i+1;j<n;j++)
			ans+=a[i]*a[j];
	cout<<ans;
}

Measured memory_bytes: 256
# include <iostream>
using namespace std;
const int maxn=1e6+2;
int n;
long long dp[maxn], mod=1e9+7, sum=0;

int main()
{
    cin>>n;
    dp[1] = n;
    dp[2] = 1ll*n*n%mod;
    for(int i=3; i<=n; ++i)
    {
        sum = (sum + dp[i-3])%mod;
        dp[i] = (dp[i-1] + sum + 1ll*(n-1)*(n-1)%mod + n-i+2)%mod;
    }
    cout<<dp[n];
}

Measured memory_bytes: 8064
N,K=map(int,input().split())
A=[int(i) for i in input().split()]
ans=0
for i in range(40,-1,-1):
    bit=0
    for a in A:
        bit+=((a>>i)&1)
    cond=2**i
    if (N-bit)>bit and K>=cond:
        ans+=(N-bit)*cond
        K-=cond
    else:
        ans+=bit*cond
print(ans)

Measured memory_bytes: 14620
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include <bitset>
#include <math.h>
#define INPUT(X) cin >> X
#define OUTPUT(X) cout << X << endl
#define REPEAT(i,n) for(int i=0;i<n;i++ )
#define SORT(A) sort(A.begin(),A.end())
using namespace std;

typedef long long int ll;
const ll MOD = 1e9+7;
#define INF 10000000000000


inline ll Upstair(ll n){
	ll rt;
	if(n==1) return 1;
	return n*Upstair(n-1);
}

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

class Tree
{
	public:
//		Tree(int _root);
		int root;
		vector<int> next;
		int value = 0;
};

template<class T>
class Vec3
{
	public:
		T act[3];
};

int Stair( int now, vector<ll> &H )
{
	if( H[now] >= H[now+1] ){}
	
}

int main(void) {


	ll N;
	INPUT(N);
	ll ans = 0;

	ans = (N-1)*N/2;

	OUTPUT(ans);
	
		
}

Measured memory_bytes: 256
#include <iostream>
#include <cassert>
#include <cmath>
using namespace std;
using Int = int64_t;
static const Int e9 = (Int)1e9;
int main() {
    Int S;
    cin >> S;
    Int x = (e9 - S % e9) % e9;
    Int y = (S + x) / e9;
    cout << "0 0 1000000000 1 " << x << " " << y << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int N = 102, K = 100005, M = 1000000007;

int n, k;
int a[N];

int dp[K], p[K];
int ndp[K];

int main()
{
    scanf("%d%d", &n, &k);
    for (int i = 1; i <= n; ++i)
        scanf("%d", &a[i]);
    dp[0] = 1;
    for (int j = 0; j <= k; ++j)
        p[j] = 1;
    for (int i = 1; i <= n; ++i)
    {
        for (int j = 0; j <= k; ++j)
        {
            int jj = max(0, j - a[i]);
            if (jj == 0)
                ndp[j] = p[j];
            else
                ndp[j] = (p[j] - p[jj - 1] + M) % M;
        }
        memcpy(dp, ndp, sizeof ndp);
        p[0] = dp[0];
        for (int j = 1; j <= k; ++j)
            p[j] = (p[j - 1] + dp[j]) % M;
    }
    cout << dp[k] << endl;
    return 0;
}


Measured memory_bytes: 1536
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<cstring>
#include<vector>
#include<cmath>
#include<queue>
#include<stack>
using namespace std;
#define INT(x) int x; scanf("%d",&x)
#define LL(x) ll x; scanf("%lld",&x)
#define INPUT(x) cin >> x
#define REP1(x,n) for(int x = 0; x < n; x++)
#define REP2(x,s,e) for(int x = s; x <= e; x++)
#define RREP1(x,n) for(int x = n-1; x >= 0; x--)
#define RREP2(x,s,e) for(int x = s; x >= e; x--)
#define BR printf("\n")
#define INF_INT 2147483647
#define INF_LL 9223372036854775807

typedef long long ll;

ll llmax(ll a, ll b){
    if(a > b){
        return a;
    }else{
        return b;
    }
}

int main(){
    INT(n);INT(k);
    
    ll N = n;
    ll K = k;
    
    ll counter = 0;
    
    if(K == 0){
        counter = N;
        counter *= counter;
        cout << counter << endl;
        return 0;
    }
    
    REP2(i,1,N){
        ll amari = N%i;//Kを引いた個数だけ保証
        ll syou = N/i;//最低限保証されてる。
        counter += syou*(llmax(i-K, 0)) + llmax(amari-(K-1), 0);
    }
    
    cout << counter << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll unsigned long long int
int main()
{ ios_base::sync_with_stdio(0);
cin.tie(0);
    int n,t;
    cin>>n>>t;
    int c,T;
    int ans=1000000000;
    for(int i=0;i<n;i++)
    {
        cin>>c>>T;
        if(T<=t)
            ans=min(c,ans);
    }
    if(ans==1000000000)
        cout<<"TLE";
    else 
cout<<ans;
}


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

int main(){
  int N;
  cin >> N;
  vector<int> a(N);
  for(int i = 0; i < N; i++) cin >> a[i];
  
  int k = a[0],j = 1;
  if(k == 2){
    cout << 1 << endl;
    return 0;
  }
  bool flag = false;
  while(j < N){
    k = a[k - 1];
    j++;
    if(k == 2){
      flag = true;
      break;
    }
  }
  
  if(flag) cout << j << endl;
  else cout << -1 << endl;
  
  return 0;
}
//意味わからないで貼り付けました


Measured memory_bytes: 640
#include <iostream>
#include <stdio.h>
using namespace std;

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

void solve(long long K){

    long long a, b, c;
    long long gcd_ab, gcd_abc;
    long long N = 0;

    for(long long i = 1; i <= K; i++){
        for(long long j = 1; j <= K; j++){
            gcd_ab = gcd(i, j);
            //cout << "gcd_ab: (" << i << ", " << j << ") " << gcd_ab << endl;
            for(long long k = 1; k <= K; k++){
                gcd_abc = gcd(gcd_ab, k);
                //cout << "gcd_abc: (" << i << ", " << j << ", " << k << ") " << gcd_abc << endl;
                N += gcd_abc;
            }
        }
    }

    cout << N << endl;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long K;
    scanf("%lld",&K);
    solve(K);
    return 0;
}


Measured memory_bytes: 3764
def main():
	s = input()
	n = len(s)
	dif = 999
	love = 753
	for i in range(n-2):
		x = int(s[i]+s[i+1]+s[i+2])
		this_dif = abs(x-love)
		if this_dif < dif:
			dif = this_dif
	print(dif)



if __name__ == '__main__':
    main()

Measured memory_bytes: 3060
A, B, C, D = map(int, input().split())

def gcd(a,b):
    while b!=0:
        a,b=b,a%b
    return a


ans_C = B//C - (A-1)//C
ans_D = B//D - (A-1)//D
CD = (C*D) // gcd(C, D)
ans_CD = B//CD - (A-1)//CD

print(B-A+1 -(ans_C + ans_D - ans_CD))

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <functional>

using namespace std;
typedef pair<int, int> P;   //cost, to
static const int INF = 1e9;
static const int SIZE = 101;
int par[SIZE];
int rk[SIZE];
int d[SIZE];
int n;

struct edge
{
	int u, v, cost;
};

struct edge2
{
	int to, cost;
};

bool comp(const edge& e1, const edge& e2)
{
	return(e1.cost < e2.cost);
}

void init()
{
	for (int i = 0; i < SIZE; ++i)
	{
		par[i] = i;
		rk[i] = 0;
	}
}

int find(int x)
{
	if (x == par[x])
	{
		return(x);
	}
	else
	{
		return(par[x] = find(par[x]));
	}
}

void unite(int a, int b)
{
	int x = find(a);
	int y = find(b);
	if (x == y)
	{
		return;
	}
	if (rk[x] < rk[y])
	{
		par[x] = y;
	}
	else
	{
		par[y] = x;
		if (rk[x] == rk[y])
		{
			++rk[x];
		}
	}
}

bool same(int a, int b)
{
	return(find(a) == find(b));
}

int kruskal(vector<edge>& es)
{
	init();
	int res = 0;
	sort(es.begin(), es.end(), comp);
	for (int i = 0; i < es.size(); ++i)
	{
		edge e = es[i];
		if (!same(e.u, e.v))
		{
			unite(e.u, e.v);
			res += e.cost;
		}
	}
	return(res);
}

int prim(vector<edge2>* G)
{
	vector<bool> isUsed(n);
	for (int i = 0; i < n; ++i)
	{
		isUsed[i] = false;
	}
	priority_queue<P, vector<P>, greater<P> > pque;
	P p = make_pair(0, 0);
	pque.push(p);
	int res = 0;
	while (!pque.empty())
	{
		P p = pque.top();
		pque.pop();
		int v = p.second;
		if (isUsed[v])
		{
			continue;
		}
		isUsed[v] = true;
		res += p.first;
		for (int i = 0; i < G[v].size(); ++i)
		{
			edge2 e = G[v][i];
			pque.push(P(e.cost, e.to));
		}
	}
	return(res);
}


void solve()
{
	cin >> n;

// For Kruskal
	vector<edge> es;
	for (int i = 0; i < n; ++i)
	{
		for (int j = 0; j < n; ++j)
		{
			int cost;
			cin >> cost;
			if (cost != -1)
			{
				edge e;
				e.u = i;
				e.v = j;
				e.cost = cost;
				es.push_back(e);
			}
		}
	}
	cout << kruskal(es) << endl;

// For Prim
	//vector<edge2> G[SIZE];
	//for (int i = 0; i < n; ++i)
	//{
	//	for (int j = 0; j < n; ++j)
	//	{
	//		int cost;
	//		cin >> cost;
	//		if (j >= i && cost != -1)
	//		{
	//			edge2 e1, e2;
	//			e1.to = j;
	//			e1.cost = cost;
	//			e2.to = i;
	//			e2.cost = cost;
	//			G[i].push_back(e1);
	//			G[j].push_back(e2);
	//		}
	//	}
	//}
	//cout << prim(G) << endl;
}

int main()
{
	solve();
	return(0);
}

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

int main() {

    int N;
    cin >> N;
    vector<int> P(N);
    rep(i, N) cin >> P[i];

    int now = INF, ans = 0;
    for (int i = 0; i < N; i++) {
        if (now >= P[i]) {
            ans++;
            now = P[i];
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

long long MOD = 1e9+7;
int MAX_INT = 1e9;

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

  int N;
  cin >> N;
  int X = ((N + 1) / 1.08);
  if((int)(X * 1.08) == N) cout << X << endl;
  else cout << ":(" << endl;

  return 0;
}


Measured memory_bytes: 3660
#include <bits/stdc++.h>
#define debug(x) cerr << #x << ": " << x << '\n';
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = (int)1e9;

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

	string res;
	if(N == 0) res = res + "0";

	while(N != 0){
		if(N % 2 == 0){
			res = res + "0";
			N = N / (-2);
		}else{
			res = res + "1";
			N = (N - 1) / (-2);
		}
	}

	reverse(begin(res), end(res));
	cout << res << '\n';

	return 0;
}


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

const int N = 1e5 + 10;
const int T = 2e9;

int n, to[N], ans[N];
char a[N];

int main() {
  scanf("%s", a);
  n = strlen(a);

  for (int i = 0; i < n; i++)
    if (a[i] == 'L') {
      to[0] = i;
      break;
    }

  for (int i = 0; i < n; i++)
    if (a[i] == 'R')
      to[n - 1] = i;

  for (int i = 1; i < n; i++)
    if (a[i] == 'L') {
      if (a[i] == a[i - 1])
        to[i] = to[i - 1];
      else
        to[i] = i - 1;
    }

  for (int i = n - 2; i >= 0; i--)
    if (a[i] == 'R') {
      if (a[i] == a[i + 1])
        to[i] = to[i + 1];
      else
        to[i] = i + 1;
    }

  fill(ans, ans + n, 1);
  for (int i = 0; i < n; i++) {
    ans[i]--;
    int k = T - (to[i] - i);
    if (k & 1) {
      if (a[to[i]] == 'R')
        ans[to[i] + 1]++;
      else
        ans[to[i] - 1]++;
    } else {
      ans[to[i]]++;
    }
  }

  for (int i = 0; i < n; i++) {
    if (i > 0)
      printf(" ");
    printf("%d", ans[i]);
  }
  puts("");
  return 0;
}

Measured memory_bytes: 1280
#include <iostream>
#include<algorithm>
#include<string>
#include <cmath>
#include <vector>
#include <map>
#include <cstdio>
#include <iomanip>
#include <numeric>
#pragma region Macros
#define int long long
#define double long double
constexpr int MOD = 1000000007;
constexpr double PI = 3.14159265358979323846;
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<=n;i++)
#define LAST(x) x[x.size()-1]
#define ALL(x) (x).begin(),(x).end()
#define swap(a,b) (a += b,b = a - b,a -= b)
#define CEIL(a,b) ((a+b-1)/b)
int FACT(int a) {
	if (a == 0)
		return 1;
	else
		return a * FACT(a - 1);
}
int nPr(int n, int r) {
	int s = n - r + 1;
	int sum = 1;
	for (int i = s; i <= n; i++)
		sum *= i;
	return sum;
}
//int nCr(int n, int r)
int nCr2(int n, int r) {
	return FACT(n) / (FACT(r) * FACT(n - r));
}
int GCD(int a, int b)
{
	if (a < b)
		swap(a, b);
	if (b == 0)
		return a;
	if (a % b == 0)
		return b;
	return GCD(b, a % b);
}
int LCM(int a, int b)
{
	return  a * b / GCD(a, b);
}
//int NUMOFDIV(int n) 素因数分解して+1してかける奴
int NUMOFDIV2(int n) {
	int ans = 0;
	REP(i, n) {
		if (n % i == 0)
			ans++;
	}
	return ans;
}
double LOG(int a, int b) {
	return log(b) / log(a);
}
inline bool BETWEEN(int x, int min, int max) {
	if (min <= x && x <= max)
		return true;
	else
		return false;
}
inline bool PRIMEOR(int x) {
	if (x == 1)
		return false;
	if (x == 2)
		return true;
	if (x % 2 == 0)
		return false;
	double sqrtx = sqrt(x);
	for (int i = 3; i <= sqrtx; i += 2) {
		if (x % i == 0)
			return false;
	}
	return true;
}
bool SQRTOR(int n) {
	if (sqrt(n) == (int)sqrt(n))
		return true;
	else
		return false;
}
using namespace std;
#pragma endregion
signed main() {
	int N;
	char x;
	string ans = "Three";
	cin >> N;
	rep(i, N) {
		cin >> x;
		if (x == 'Y')
			ans = "Four";
	}
	cout << ans;
}

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

#define rep(i, a, b) for ( int i = (a); i < (b); i++ )
#define per(i, a, b) for ( int i = (b)-1; i >= (a); i--)
#define pb push_back
#define mp make_pair
#define bg begin()
#define en end()

using namespace std;

typedef long long ll;

static const long long MOD = 1000000007;

int n;
int c[200005];
int main(void) {
  cin >> n;
  rep(i,0,n) {
    int p;
    scanf("%d", &p);
    c[p] = c[p-1]+1;
  }
  int mx = -1;
  rep(i,1,n+1) mx = max(mx, c[i]);

  
  cout << n-mx << endl;
  
  
    return 0;
}



Measured memory_bytes: 1024
S = input()

answer = 0
left = 0
right = len(S) - 1
while left < right:
    if S[left] == S[right]:
        left += 1
        right -= 1
    elif S[left] == 'x':
        left += 1
        answer += 1
    elif S[right] == 'x':
        right -= 1
        answer += 1
    else:
        print(-1)
        exit()
print(answer)


Measured memory_bytes: 3316
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int(i) = 0; (i) < (n); (i)++)
typedef long long ll;
int gcd(int x, int y) { return (x % y) ? gcd(y, x % y) : y; }

ll gcd3(int a, int b, int c)
{
    return gcd(gcd(a, b), c);
}

int main()
{
    ll K;
    cin >> K;
    ll ans = 0;
    for (int i = 1; i <= K; ++i)
    {
        for (int j = 1; j <= K; ++j)
        {
            for (int k = 1; k <= K; ++k)
            {
                ans += gcd3(i, j, k);
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
 
int main() {
    int n,r;
    cin>>n>>r;
    if(n>=10){
        cout<<r<<endl;
    }else{
        cout<<r+100*(10-n)<<endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <math.h>
#include <iomanip>
#include <bitset>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <utility>
#include <set>
using namespace std;
typedef long long int ll;

#define MOD 998244353


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

int main(){
    ll n;
    cin >> n;
    ll a[n],ans=0,count=1;
    for (ll i=0;i<n;i++)cin >> a[i];
    for (ll i=0;i<n;i++){
        if (a[i]==count){
            count++;
            continue;
        }
        ans++;
    }
    if (ans==n){
        cout << -1 << endl;
        return 0;
    }
    cout << ans << endl;
}








Measured memory_bytes: 1792
#include "bits/stdc++.h"
using namespace std;    

#define COUNTOF(array) (sizeof(array) / sizeof(array[0]))    
#define OUT(P) cout << (P) << endl    
#define OUT2(P1, P2) cout << (P1) << " " << (P2) << endl    
#define PRINT_ARRAY(P) for(int i=0; i<P.size(); i++) cout << P[i] << endl;    
#define PRINT_ARRAY_INLINE(P) do { for(int i=0; i<P.size(); i++) cout << P[i] << " "; cout << endl; } while(0)    
#define PRINT_ARRAY_WITH_LABEL(L, P) do { cout << L << ": "; PRINT_ARRAY_INLINE(P); cout << endl; } while(0)    
typedef long long ll;    
const long DIVIDE = 1e9+7;

int sum_digits(int num);    
template <class T>    
vector<T> copy_vector(vector<T> vec);    
long gcd(long a, long b);    
long lcm(long a, long b);
vector<vector<long>> comb(long n, long r);
// ****** print functions ****** //
template <class T, class U>
void print_pairs(const vector<pair<T, U>> pairs);
template <class K, class V>
void print_map(const map<K, V> m);


int n;
const int cake = 4;
const int donut = 7;
bool dfs(int k) {
    if(n < k) return false;
    if(n==k) return true;
    else {
        bool eat_cake = dfs(k+cake);
        bool eat_donut = dfs(k+donut);
        return eat_cake || eat_donut;
    }
}

int main() {    
    cin >> n;
    
    bool rtn = dfs(0);
    string ans = (rtn)? "Yes" : "No";

    cout << ans << endl;

    return 0;    
}    

/******************************/    
/***** DECRARED FUNCTIONS *****/    
/******************************/    

int sum_digits(int num) {    
    int rtn = 0;    
    while(num != 0) {    
        int tmp = num % 10;    
        rtn += tmp;    
        num /= 10;    
    }    
    return rtn;    
}    

// vectorのコピー    
template <class T>    
vector<T> copy_vector(vector<T> vec) {    
    vector<T> rtn;    
    rtn.reserve(vec.size());    
    copy(vec.begin(), vec.end(), back_inserter(rtn));    
    return rtn;    
}    

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

long lcm(long a, long b) {
    long gcd_ = gcd(a, b);
    return (a * b) / gcd_;
}

vector<vector<long>> comb(long n, long r) {                                                                             
    vector<vector<long>> v(n+1, vector<long>(n+1, 0));    
    for(int i=0; i<v.size(); i++) {    
        v[i][0] = 1;    
        v[i][i] = 1;    
    }    
    for(int i=1; i<v.size(); i++) {    
        for(int j=1; j < i; j++) {    
            v[i][j] = (v[i-1][j-1] + v[i-1][j]) % DIVIDE;    
        }    
    }    
    return v;    
} 

template <class T, class U>
void print_pairs(const vector<pair<T, U>> &pairs) {
    for(int i=0; i<pairs.size(); i++) { 
        cout << "(" << pairs[i].first << ", " << pairs[i].second << ")" << " "; 
    } 
    cout << endl;
}

template <class K, class V>
void print_map(const map<K, V> &m) {
    for(auto it=m.cbegin(); it!=m.cend(); it++) {
        cout << it->first << ": " << it->second << endl;
    }
}


Measured memory_bytes: 256
#include<iostream>
#include <algorithm>
#include <vector>
#include <string>
using namespace std;
int main()
{
    int k,x;
    cin >> k >> x;

    int min = x - (k - 1);
    int max = x + (k - 1);
    for(int i=min;i<=max;i++) {
        cout << i << " ";
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
#ifdef _WIN32
#include "stdc++.h"
#else
#include <bits/stdc++.h>
#endif

// 継承可能な型
template <class Type>
struct IN : Type
{
	IN()
	{
		std::cin >> *this;
	}
};

// 継承不可能な型
template <class Type>
struct IN_
{
	Type val;

	IN_()
	{
		std::cin >> val;
	}

	operator Type&()
	{
		return val;
	}

	IN_<Type>& operator=(const Type& _value)
	{
		val = _value;
		return *this;
	}
};

template <class Char, class Type>
std::basic_ostream<Char>& operator <<(std::basic_ostream<Char>& os, const IN_<Type>& value)
{
	return os << value.val;
}

template <class Char, class Type>
std::basic_istream<Char>& operator >>(std::basic_istream<Char>& is, IN_<Type>& value)
{
	return is >> value.val;
}

template <class Type>
void OUT(const Type& value)
{
	std::cout << value << std::endl;
}

template <class Type, class ... Args>
void OUT(const Type& value, const Args& ... args)
{
	std::cout << value << ' ';
	OUT(args...);
}

void YESNO(const bool cond)
{
	OUT(cond ? "YES" : "NO");
}
void YesNo(const bool cond)
{
	OUT(cond ? "Yes" : "No");
}

using ll = long long;
using inll = IN_<ll>;
using vll = std::vector<ll>;
using setll = std::set<ll>;
using msetll = std::multiset<ll>;
using instr = IN<std::string>;

// 階乗を計算 O(N) (N=10^7 で O(10^7))
ll factorial(ll n)
{
	for (ll i = n - 1; i > 1; --i)
		n *= i;
	return n;
}

// nCrを計算 O(N) (N=10^7 で O(10^7))
ll comb(const ll n, ll r)
{
	if (r * 2 > n) r = n - r;

	ll dividend = 1, divisor  = 1;

	for (ll i = 1; i <= r; ++i) {
		dividend *= n - i + 1;
		divisor *= i;
	}

	return dividend / divisor;
}

// 素数判定 O(sqrt(N)) (N=10^7 で O(10^3))
bool isprime(const ll num)
{
    if (num < 2) return false;
    if (num == 2) return true;
    if (num % 2 == 0) return false;

    double sqrtNum = sqrt(num);
    for (ll i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0) return false;
    }

    return true;
}

// 各桁の和を計算 O(logN) (N=10^7 で O(7))
ll digsum(ll n)
{
	ll sum = 0;
	while(n != 0){
		sum += n % 10;
		n /= 10;
	}
	return sum;
}

#define FOR(i, m, n) for (ll (i) = (m); (i) < (n); ++(i))
#define REP(i, n) for (ll (i) = 0; (i) < (n); ++(i))
#define REPR(i, n) for (ll (i) = (n); (i) >= 0; --(i))
#define ITRREP(it, v) for (auto (it) = (v).begin(); (it) != (v).end(); ++(it))
#define ITRREPR(it, v) for (auto (it) = (v).rbegin(); (it) != (v).rend(); ++(it))
#define DIVUP(a, b) (((a) + (b) - 1) / (b))

void Main();

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

	Main();

#ifdef _DEBUG
	system("pause");
#endif

	return 0;
}

using namespace std;

//////////////////////////////

void Main()
{
	inll a, b;

	if (a + b == 15)
		return OUT('+');
	if (a * b == 15)
		return OUT('*');

	OUT('x');
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
 
int main()
{
 
int a,b,c;
cin >> a >> b >> c;
int i = 0;
if (a == 5 && b == 7 && c == 5){
    i++;
}else if (a == 5 && b == 5 && c == 7){
    i++;
}else if (a == 7 && b == 5 && c == 5){
    i++;
}
 
if (i == 1){
    cout << "YES";
}else {
    cout << "NO";
}
 
return 0;
}

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

const int N = 1e5;
vector<pair<int, ll>> g[2][N];
int n, m, s, t;
ll inf = 1e18;
int main() {
  ios::sync_with_stdio(false), cin.tie(0);
  cin >> n >> m >> s >> t;
  s--; t--;
  for(int i = 0; i < m; i++) {
    ll a, b, x, y; cin >> a >> b >> x >> y;
    a--; b--;
    g[0][a].emplace_back(b, x);
    g[0][b].emplace_back(a, x);
    g[1][a].emplace_back(b, y);
    g[1][b].emplace_back(a, y);
  }
  // dijkstra
  using P = pair<ll, int>;
  priority_queue<P, vector<P>, greater<P>> pq;
  vector<vector<ll>> dists(2, vector<ll>(n, inf));
  for(int p = 0; p < 2; p++) {
    auto & dist = dists[p];
    pq.emplace(0, p ? t : s);
    for(int i = 0; i < n; i++) dist[i] = inf;
    dist[p ? t : s] = 0;
    while(pq.size()) {
      int i; ll di;
      tie(di, i) = pq.top();
      pq.pop();
      if(dist[i] < di) continue;
      for(auto to : g[p][i]) {
        ll j, cost;
        tie(j, cost) = to;
        if(dist[j] > di + cost) {
          dist[j] = di + cost;
          pq.emplace(di + cost, j);
        }
      }
    }
  }
  vector<ll> ans(n+1);
  ans[n] = inf;
  for(int i = n-1; i >=0; i--) {
    ans[i] = min(ans[i+1], dists[0][i] + dists[1][i]);
  }
  for(int i = 0; i < n; i++) cout << ll(1e15) - ans[i] << endl;
  return 0;
}


Measured memory_bytes: 20260
#include<stdio.h>
 int main(void)
 {
     int N,X,m[1000];
     int i,j,sum=0,tmp;
     int x=0,S=0;

     scanf("%d%d",&N,&X);

     for(i=0;i<N;i++){
       scanf("%d",&m[i]);
       sum+=m[i];
     }

     x=X-sum;

     for(i=0;i<N;i++){
       for(j=i+1;j<N;j++){
         if(m[i]>m[j]){
           tmp=m[i];
           m[i]=m[j];
           m[j]=tmp;
         }
       }
     }

     S=x/m[0];

     printf("%d\n",N+S);

     return 0;
 }


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

int main()
{
	int n, k;
	string s;
	cin >> n >> k >> s;
	auto a = vector<int>();
	if(s[0] == '0') a.push_back(0);
	s += '2';
	int cnt = 1;
	for(auto i = 1; i < n + 1; ++i){
		if(s[i] != s[i - 1]){
			a.push_back(cnt);
			cnt = 1;
		}else{
			++cnt;
		}
	}
	if(s[n - 1] == '0')a.push_back(0);
	int m = a.size();
	auto b = vector<int>(m / 2 + 1);
	b[0] = a[0];
	for(auto i = 1; i < m / 2 + 1; ++i){
		b[i] += b[i - 1] + a[i * 2 - 1] + a[i * 2];
	}
	k = min(k, m / 2 * 1);
	int ans = b[k];
	for(auto i = k + 1; i < (int)b.size(); ++i){
		ans = max(ans, b[i] - b[i - k] + a[(i - k) * 2]);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1020
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String n = sc.next();
        String ans = "No";
        if (n.charAt(0) == n.charAt(2)) {
            ans = "Yes";
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 21844
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <utility>
#include <tuple>
#include <string>
#include <cctype>
#include <cstdio>
#include <math.h>
using f32 = float;
using f64 = double;
using f80 = __float80;
using namespace std;
using LL = long long;
using ULL = unsigned long long;
using vi = vector<int>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvi = vector<vi>;
using vs = vector<string>;
using vl = vector<LL>;
using vvl = vector<vl>;
using P = pair<int, int>;
using T = tuple<int, int, int>;
using vp = vector<P>;
#define REP(i, n) for (LL i = 0; i < (int)(n); i++)
#define FOR(i, m, n) for (LL i = m; i < n; i++)
#define SORT(x) sort(x.begin(), x.end())
#define REVE(x) reverse(x.begin(), x.end())
#define all(x) (x).begin(), (x).end()
#define fst first
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define pob pop_back
#define sw swap
#define UP(x) transform(x.begin(), x.end(), x.begin(), ::toupper);
#define LOW(x) transform(x.begin(), x.end(), x.begin(), ::tolower);
struct initon
{
    initon()
    {
        cin.tie(0);
        ios::sync_with_stdio(false);
    };
};
template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return 1;
    }
    return 0;
}
int main()
{
    LL n,a=0;
    cin >> n;
    vector<LL>t(n+1);
    REP(i,n+1)cin>>t[i];
    vector<LL>y(n);
    REP(i,n)cin>>y[i];
    REP(i,n){
    if(y[i]>=t[i]+t[i+1]){
        a+=t[i]+t[i+1];
        t[i]=0;
        t[i+1]=0;
    }else if(y[i]>=t[i]){
        a+=t[i];
        y[i]-=t[i];
        t[i]=0;
        a+=y[i];
        t[i+1]-=y[i];
      y[i]=0;
    }else if(y[i]<t[i]){
        a+=y[i];
      y[i]=0;
      t[i]-=y[i];
    }
    }
  cout <<a;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define sz(c)      int(c.size())
#define rep(i,a,b) for (int i=a; i<(b); ++i)
#define per(i,a,b) for (int i=(b)-1; i>=(a); --i)
using namespace std;
using ll = long long;



int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout<<fixed<<setprecision(10);

  int N;
  cin>>N;
  int res=0;
  rep(i,1,N+1) if (i%2==1) {
    int c=0;
    rep(j,1,i+1) if (i%j==0) ++c;
    if (c==8) ++res;
  }
  cout<<res<<"\n";
}


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

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;
        }
        int num = 0;
        
        while (n % i == 0)
        {
            ++num;
            n /= i;
        }
        res.push_back(make_pair(i, num));
       
    }
     if (n != 1) 
        {
            res.push_back(make_pair(n, 1));
        }
        return res;
        
} 
long long GCD(long long a, long long b) {
    if (b == 0) return a;
    else return GCD(b, a % b);
}
ll lcm(ll x, ll y) {
    return x / GCD(x, y) * y;//先に割り算をして掛けられる数を小さくして掛け算を行う
}
const int MAX = 510000;
const int MOD = 1000000007;

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

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
int main() {
  ll N;
  cin >> N;
  vector<ll> p;

  auto s = prime_factorize(N);
    ll ans = 0;
  for (auto i : s)
  {
      int num = i.second;
      int a = 1;
      while (num - a >= 0)
      {
          num -= a;
          a++;
          ans++; 
      }
      //cout << i.first << " " <<  i.second << endl;

  }
  

    cout << ans << endl;
  

 
    return 0;

}


Measured memory_bytes: 3588
import java.io.*;
import java.util.*;
public class Main{
	public static void main(String[] args)throws Exception
	{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		//Scanner sc = new Scanner(System.in);
		String str[] =br.readLine().split(" ");
		int n =  Integer.parseInt(str[0]);
		int p =  Integer.parseInt(str[1]);
		int A[] = new int[n];
		int even = 0 , odd ;
		str = br.readLine().split(" ");
		for(int i = 0 ; i< n ; i++){
			A[i] = Integer.parseInt(str[i]);
			if (A[i] % 2 == 0) even++;
		}
		odd = n - even ;
		long ans = 1;
		if(odd == 0){
			ans <<= n;
			if(p == 1) ans = 0;
		}else{
			ans <<= n-1;
		}
		System.out.println(ans);
	}
}

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

int main(){
  int N, K; cin >> N >> K;
  vector<int> h(N);
  for(int i=0;i<N;i++){
    cin >> h.at(i);
  }
  sort(h.begin(), h.end());
  int ans=1e9;
  for(int i=0;i<=N-K;i++){
    ans=min(ans, h.at(i+K-1)-h.at(i));
  }
  cout << ans << endl;
}

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

final class Solver {
	static final Solver INSTANCE = new Solver();

	void solve(Scanner sc) {
		int N = sc.nextInt();
		int L = sc.nextInt();
		String[] S = new String[N];
		for (int i = 0; i < N; i++) {
			S[i] = sc.next();
		}
		Arrays.sort(S);

		StringBuilder sb = new StringBuilder();
		for (String s : S) {
			sb.append(s);
		}
		System.out.println(sb.toString());

	}
}

class Main {
	public static void main(String... args) {
		Scanner in = new Scanner(System.in);

		Solver.INSTANCE.solve(in);

		in.close();
	}
}

Measured memory_bytes: 24020
#include <bits/stdc++.h>
typedef long long ll;
#define rep(i,n) for(ll i = 0; i < (n); ++i )
#define rep_rev(n,i) for(ll i = n; i >= 0; --i )
using namespace std;
using P = pair<int, int>;
const long long INF = 1LL << 60;

int main(){
  int N; cin >> N;
  vector<int> A(N,0);
  rep(i,N){
    cin >> A[i];
  }
  rep(i,N){
    if(A[i]%2 == 0){
      if(A[i]%3 != 0 && A[i]%5 != 0){
        cout << "DENIED" << endl;
        return 0;
      }
    }
  }
  cout << "APPROVED" << endl;
  return 0;
}


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

#define ld long double
#define ll long long
#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()
#define spa << " " <<
#define MP make_pair
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
ll INF = 1e18;
void chmin(ll &a,ll b){if(a>b)a=b;}
void chmax(ll &a,ll b){if(a<b)a=b;}
void pmod(ll &a,ll b){a=(a+b)%MOD;}
void qmod(ll &a,ll b){a=(a*b)%MOD;}
void ans1(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
void ans(bool x,ll y,ll z){if(x)cout<<y<<endl;else cout<<z<<endl;}
void ans(bool x,string y,string z){if(x)cout<<y<<endl;else cout<<z<<endl;}   
ll gcd(ll x,ll y){ll r;while((r=x%y)!=0){x=y;y=r;}return y;}

int main(){
  ll i,j,o;
  ll res=0,res1=INF,res2=-INF,buf=0,buf1=0,buf2=0,buf3=0,buf4=0,sum=0;
  ll l,r;
  bool judge = true;
  ll q,h,s,d,n;cin>>q>>h>>s>>d>>n;
  chmin(res1,q*n*4);
  chmin(res1,h*n*2);
  chmin(res1,s*n);
  chmin(res1,d*(n/2)+q*4*(n%2));
  chmin(res1,d*(n/2)+h*2*(n%2));
  chmin(res1,d*(n/2)+s*(n%2));
  cout<<res1<<endl;
  return 0;
}

Measured memory_bytes: 256
from itertools import combinations
from math import sqrt

n, d = list(map(int, input().split()))
xs = [list(map(int, input().split())) for _ in range(n)]
# print(xs)

count = 0
for c in combinations(xs, 2):
    a = c[0]
    b = c[1]
    y = sqrt(sum([(b[i] - a[i]) ** 2 for i in range(len(a))]))
    if y.is_integer():
        count += 1

print(count)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N, M;
  cin >>N >>M;
  vector<bool> A(N+1, false), B(N+1, false);
  for(int i=0; i<M; i++){
    int a, b;
    cin >>a >>b;
    if(a==1) A[b]=true;
    if(b==1) A[a]=true;
    if(a==N) B[b]=true;
    if(b==N) B[a]=true;
  }
  string ans="IMPOSSIBLE";
  for(int i=2; i<N; i++){
    if(A[i] && B[i]){
      ans="POSSIBLE";
      break;
    }
  }
  cout <<ans <<endl;
}

Measured memory_bytes: 256
/*
　　　∫ ∫ ∫
　　　ノヽ
　　（＿　 ）
　（＿　　　 ）
（＿＿＿＿＿＿ ）
　ヽ(´･ω･)ﾉ　
　　 |　 /
　　 UU
*/
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
using P = pair<ll, ll>;
typedef vector<int> vi;
const ll INF = 1LL << 60;
const int inf = 1<<30;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
#define REP(i, n) for (int i = 0; i < (n); i++)
#define FOR(i,s,n) for (int i = s; i < (n); i++)
#define ALL(obj) (obj).begin(), (obj).end() //コンテナじゃないと使えない!!
#define debug(x) cerr << #x << ": " << x << "\n";
#define mp make_pair
template <typename T>
ostream& operator<<(ostream& os, vector<T> &V){
    int N = V.size();
    REP(i,N){
        os << V[i];
        if (i!=N-1) os << " ";
    }
    os << "\n";
    return os;
}
template <typename T>
ostream& operator<<(ostream& os, pair<T,T> const&P){
    os << P.first;
    os << " ";
    os << P.second;
    return os;
}
template <typename T>
ostream& operator<<(ostream& os, set<T> &S){
    auto it=S.begin();
    while(it!=S.end()){
        os << *it;
        os << " ";
        it++;
    }
    os << "\n";
    return os;
}
template <typename T>
ostream& operator<<(ostream& os, deque<T> &q){
    for(auto it=q.begin();it<q.end();it++){
        os<<*it;
        os<<" ";
    }
     os<<endl;
    return os;
}

const int MAX = 5000000;
const int MOD = 1000000007;

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

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
//fixed<<setprecision(10)<<ans<<endl;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll X,Y;
    cin >> X >> Y;
    if ((X+Y)%3 != 0){
        cout << 0 << endl;
        return 0;
    }
    ll S = (X+Y);
    X -= S/3;
    Y -= S/3;
    COMinit();
    ll ans = COM(X+Y,X);
    cout << ans << endl;
}

Measured memory_bytes: 117504
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define double long double
#define sp(p) cout<<setprecision(16)<<fixed<<p<<endl;
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define all(a) a.begin(),a.end()
#define sort(a) sort(all(a))
#define rsort(a) sort(all(a),greater<>())
#define debg(a) cout<<#a<<" "<<a<<endl;
#define show(a) for(cont &y:a){for(cont &x:y){cout<<x<<" ";}cout<<endl;}
template<class T> inline int out(const T &t){ print(t); putchar('\n'); return 0; }
template<class T>inline T gcd(T a,T b){if(b==0)return a; return(gcd(b,a%b));}
template<class T>inline T lcm(T a,T b){return a/gcd(a,b)*b;}
typedef long long ll;
typedef pair<int,int> P;
const long long MOD=1000000007;
clock_t time_ini = clock();
double time_diff(){
  ll time_tmp = clock();
  const double time = static_cast<double>(time_tmp - time_ini) / CLOCKS_PER_SEC * 1000.0;
  return time;
}
#define saiaku if(time_diff() > 1990)
vector <ll> dp;

const ll INF = 1e+3;
const int MAX_N = 100;
ll cost[MAX_N][MAX_N];
ll d[MAX_N];
bool used[MAX_N];
ll V;
vector<ll> H;

void dijkstra(ll s){
  fill(d, d+V, INF);
  fill(used, used+V, false);
  fill(cost[0], cost[MAX_N], INF);
  d[s] = 0;

  for (ll i = 0; i < V; i++)
  {
    cost[i][i+1] = abs(H[i] - H[i+1]);
    cost[i][i+2] = abs(H[i] - H[i+2]);
  }

  while (true)
  {
    int v = -1;
    for (int u = 0; u < V; u++)
    {
      if(!used[u] && (v == -1 || d[u] < d[v])) v=u;
    }
    if (v == -1) break;
    used[v] = true;

    for (int u = 0; u < V; u++)
    {
      d[u] = min(d[u], d[v] + cost[v][u]);
    }
  }
}

void solve_dijkstra(long long N, std::vector<long long> h){
  V = N;
  H = h;
  dijkstra(0);
  cout << d[V-1] << endl;
}

ll dfs(ll i){
  if(dp[i] >= 0) return dp[i];
  ll d1, d2;
  d1 = abs(H[i] - H[i-1]);
  if (i == 1) return d1;
  d2 = abs(H[i] - H[i-2]);
  if (i == 2) return d2;
  // dp[i] = min(dfs(i-1) + d1, dfs(i-2) + d2);
  dp[i] = min(dfs(i-2) + d2, dfs(i-1) + d1);
  return dp[i];
}

void solve(long long N, std::vector<long long> h){
  H = h;
  dp = vector<ll> (N+1, -1);
  cout << dfs(N-1) << endl;
}

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


Measured memory_bytes: 7296
n = int(input())
x = [[0,0] for i in range(n)]
for i in range(n):
    x[i][0] , x[i][1] = map(int,input().split())

x.sort()
cnt = 0
i = 0
while i < len(x)-1:
    if x[i][0] + x[i][1] > x[i+1][0] - x[i+1][1]:
        if x[i][0] + x[i][1] > x[i+1][0] + x[i+1][1]:
            del x[i]
        else:
            del x[i+1]
    else:
        i += 1

print(len(x))

Measured memory_bytes: 20016
times = int(input())
xy = [map(int, input().split()) for _ in range(times)]
x, y = [list(i) for i in zip(*xy)]

counts = [0]
count = 0

for i in range(times):
  if x[i] == y[i]:
    count += 1
  else:
    counts.append(count)
    count = 0
counts.append(count)

counti = max(counts)

if counti >= 3:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 9204
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,K,d,a;
  cin >> N >> K;
  vector<int> vec(N);

  for(int i = 0; i<K; i++){
    cin >> d;
    	for(int j = 0; j<d; j++){
          cin >> a;
          if (vec.at(a-1) ==0){
            vec.at(a-1)=1;
          }
        }
  }
  int count = 0;
  for(int k =0; k<N; k++){
    count += vec.at(k);
  }
  cout << N- count << endl;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
#include <string.h>
using namespace std;
 
int main() {

  uint bule_count;
  cin >> bule_count;
  string input_str;
  // 100要素の配列で初期化
  map<string,int> card;
  //cout << "bule_count:" << bule_card.size() << endl;
  // 100個の入力を受け取る
  for (uint i = 0; bule_count > i ; i++) {
    cin >> input_str;
    if(card.count(input_str)){
      card.at(input_str)++;
    }else{
      card[input_str] = 1;
    }
  }

  uint red_count;
  cin >> red_count;
  for (uint i = 0; red_count > i ; i++) {
    cin >> input_str;
    if(card.count(input_str)){
      card.at(input_str)--;
    }else{
      card[input_str] = -1;
    }
  }

  string max_key;
  int max_val = 0;
  //debug print
  for(auto itr = card.begin(); itr != card.end(); ++itr) {
    //std::cout << "key = " << itr->first << ", val = " << itr->second << "\n";
    if(max_val < itr->second){
      max_key = itr->first;
      max_val = itr->second;
    }
  }

  //cout << card.at(max_key) << endl;
  cout << max_val << endl;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define MOD (int) 1e9+7
#define fio ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL)
#define vi vector<int>
ll xpow(ll a, ll b)
{
	if (b == 0)
		return 1;
	if (b % 2 == 0)
	{
		ll k = xpow(a, b / 2);
		return k * k;
	}
	if (b % 2 != 0)
		return a * xpow(a, b - 1);
}
int main()
{

#ifndef ONLINE_JUDGE
	freopen("in.txt", "r", stdin);
	freopen("out1.txt", "w", stdout);
#endif
	fio;
	int n;
	cin >> n;
	vector<int> v(n);
	for (int i = 0; i < n; i++)
		cin >> v[i];
	sort(v.rbegin(), v.rend());
	ll sum = v[0];
	for (int i = 1; i < n / 2; i++) {
		sum += v[i] * 2;
	}
	if (n % 2 != 0)
		sum += v[n / 2];
	cout << sum << endl;
	return 0;
}

Measured memory_bytes: 3864
#line 1 "/mnt/c/Users/leafc/dev/compro/lib/template.hpp"


#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) (v).begin(), (v).end()
#define coutd(n) cout << fixed << setprecision(n)
#define ll long long int
#define vl vector<ll>
#define vi vector<int>
#define MM << " " <<

using namespace std;

template <class T> void say(bool val, T yes = "Yes", T no = "No") { cout << (val ? yes : no) << endl; }

template <class T> void chmin(T &a, T b) {
  if (a > b)
    a = b;
}

template <class T> void chmax(T &a, T b) {
  if (a < b)
    a = b;
}


#line 2 "tmp.cpp"

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

  int a, b, ans = 0;
  cin >> a >> b;
  FOR(i, a, b + 1) {
    string s = std::to_string(i);
    string rev = s;
    reverse(rev.begin(), rev.end());
    if (s == rev)
      ans++;
  }
  cout << ans << endl;
  return 0;
}


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

int main()
{
	int a,b,c;
	scanf("%d%d",&a,&b);
	if (a % 3 == 0 || b % 3 == 0 || (a + b)%3 == 0)
		printf("Possible");
	else printf("Impossible");
	return 0;
}

Measured memory_bytes: 128