akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#ifdef DEBUG
	#define D(x...) printf(x)
#else
	#define D(x...)
#endif
typedef long long ll;
map<int, int> occ;
int n;
int main()
{
	scanf("%d", &n);
	for (int i = 0; i < n; i++)
	{
		int a;
		scanf("%d", &a);
		occ[a]++;
	}
	if (occ.size() == 1 && !occ.begin()->first) printf("Yes\n");
	else if (occ.size() == 2 && !occ.begin()->first && occ.begin()->second*2 == prev(occ.end())->second) printf("Yes\n");
	else if (occ.size() == 3)
	{
		int mx = 0;
		vector<int> values;
		for (auto it = occ.begin(); it != occ.end(); ++it) values.push_back(it->first), mx = max(mx, it->second);
		if (mx*3 == n && (values[0]^values[1]) == values[2])
		{
			printf("Yes\n");
		}
		else printf("No\n");
	} 
	else printf("No\n");
}

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

int main() {
    string s;
    cin >> s;
    int cnt = 0, ans = 0;
    for(auto c : s){
        if(c == 'R') cnt++;
        else cnt--;
        if(cnt == 4) ans++;
        cnt %= 4;
    }
    cout << ans << endl;
    return 0;
}



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

int main(){
    string s;
    cin >> s;
    int N=s.size();
    int K; 
    cin >> K;
    vector<string> res;
    for(int j=1;j<=min(N,K);j++){
        for(int i=0;i<N-j+1;i++){
            string sub=s.substr(i,j);
            res.push_back(sub);
        }
    }
    sort(res.begin(),res.end());
    res.erase(unique(res.begin(),res.end()),res.end());
    cout << res[K-1] << endl;
}

Measured memory_bytes: 1660
#include <iostream>
#include <vector>
#include <set>
using namespace std;
const long long mod = (1e9) + 7;

struct UnionFind{
  vector<int> data;
  UnionFind(int n) : data(n, -1) {}
  bool unite(int x, int y){
    x = find(x);
    y = find(y);
    if(x != y){
      if(data[y] < data[x]) swap(x,y);
      data[x] += data[y];//高さを更新
      data[y] = x;//親を更新
    }
    return x != y;
  }
  bool same(int x, int y){ return find(x) == find(y); }
  int find(int x){
    if(data[x] < 0) return x;
    return data[x] = find(data[x]);
  }
};

int main(){
  int N, M;
  while(cin >> N >> M, N){
    UnionFind uf(N);
    for(int i = 0; i < M; ++i){
      int a, b;
      cin >> a >> b;
      --a,--b;
      uf.unite(a,b);
    }
    long long ans = 1;
    set<int> S;
    for(int i = 0; i < N; ++i) S.insert(uf.find(i));
    for(size_t i = 0; i < S.size(); ++i) ans *= 2, ans %= mod;
    ans += (N != (int)S.size());
    ans %= mod;
    cout << ans << endl;
  }
  return 0;
}



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

using ll = long long;
using ld = long double;
using pii = pair<int, int>;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))

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

Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<stdlib.h>
using namespace std;



class CPriorityQueue{
	
public:
	CPriorityQueue();
	bool Insert(int key);
	bool Extract(void);
	int countOrder;							//何個目の命令かカウントする
	static const int ORDER_MAX = 2000000;	//命令数のMAX
	const int KEY_MAX = 2000000000;			//要素の最大値
	const int KEY_MIN = 0;					//要素の最小値
	
private:
	int queue[ORDER_MAX];			//Queue
	int indexQueue;					//Queueに格納されているデータ数
};


CPriorityQueue::CPriorityQueue() : countOrder(0), queue(), indexQueue(0){
}


/*
-------------------------------------
関数名：Insert
	in     : 入力"insert"の後につづく要素
	return : bool型
-------------------------------------
*/
bool CPriorityQueue::Insert(int key){
	
	//要素の制約をCheckする
	if((KEY_MIN > key) || (key > KEY_MAX)){
		return false;
	}
	
	//keyを末尾に追加
	queue[indexQueue] = key;
	
	//keyが親ノードより大きければ入れ替える
	int indexParentQueue = (indexQueue - 1) / 2;
	int i = indexQueue;
	while(i != 0){
		if(queue[i] > queue[indexParentQueue]){
			swap(queue[i], queue[indexParentQueue]);
			i = indexParentQueue;
			if(i == 2){
				indexParentQueue = 0;
			}
			else{
				indexParentQueue = (i - 1) / 2;
			}
		}
		else{
			break;
		}
	}
	indexQueue++;
	
	return true;
}


/*
-------------------------------------
extract()
	in     : なし
	return : bool型
-------------------------------------
*/
bool CPriorityQueue::Extract(void){
	
	//Queueにデータが格納されていなければERROR
	if(indexQueue == 0){
		return false;
	}
	
	
	//Queueの先頭を表示
	cout << queue[0] << endl;
	
	
	//Queueの末尾と先頭を入れ替える
	indexQueue--;
	queue[0] = queue[indexQueue];
	
	
	//Queueの先頭と子ノードを比較し、子ノードのほうが値が小さければ入れ替える
	int indexParentQueue = 0;
	while(1){
		if(indexQueue <= ((2 * indexParentQueue) + 1)){
			//子ノードがない
			break;
		}
		else if((indexQueue <= (2 * (indexParentQueue + 1))) ||
				(queue[(2 * indexParentQueue) + 1] > queue[2 * (indexParentQueue + 1)])){
			//子ノードが1つ または 左の子ノードの方が大きい
			if(queue[(2 * indexParentQueue) + 1] > queue[indexParentQueue]){
				swap(queue[(2 * indexParentQueue) + 1], queue[indexParentQueue]);
				indexParentQueue = (2 * indexParentQueue) + 1;
			}
			else{
				//子ノードより親ノードの方が大きい
				break;
			}
		}
		else{
			//右の子ノードの方が大きい
			if(queue[2 * (indexParentQueue + 1)] > queue[indexParentQueue]){
				swap(queue[2 * (indexParentQueue + 1)], queue[indexParentQueue]);
				indexParentQueue = 2 * (indexParentQueue + 1);
			}
			else{
				//子ノードより親ノードの方が大きい
				break;
			}
		}
		
		
	}
	
	return true;
}


int main(){
	
	CPriorityQueue* pQueue = new CPriorityQueue;
	string str;
	char num[11];
	int key = 0;						//insertで挿入する要素
	
	while(pQueue->countOrder <= pQueue->ORDER_MAX){
		cin >> str;
		pQueue->countOrder++;
		
		if(str == "end"){
			break;
		}
		else if(str.compare(0, 6, "insert") == 0){
			//insertに続く要素を取得
			cin >> num;
			key = atoi(num);
			
			if(pQueue->Insert(key) == false){
				return -1;
			}
		}
		else if(str.compare(0, 7, "extract") == 0){
			if(pQueue->Extract() == false){
				return -1;
			}
		}
		else{
			//ここに入ることはない
		}
	}
	
	delete pQueue;
	
	return 0;
}





Measured memory_bytes: 10592
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE BinaryLiterals #-}
{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE NumDecimals #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TupleSections #-}

import Control.Applicative
import Control.Arrow
import Control.Monad
import Control.Monad.ST

import Data.Char
import Data.List
import Data.Maybe

import qualified Data.ByteString.Char8 as B

import Data.Array.ST.Safe
import Data.STRef

import Debug.Trace
import Text.Printf

readInt = readLn :: IO Int
readInteger = readLn :: IO Integer
readInts = map ( fst . fromJust . B.readInt ) . B.words <$> B.getLine
readIntegers = map ( fst . fromJust . B.readInteger ) . B.words <$> B.getLine

which a b f = if f then a else b
mp [ a, b ] = ( a, b )

modifyArray a i f = writeArray a i =<< f <$> readArray a i

base = 1000000007

main = do
	[ n, k ] <- readIntegers
	print $ foldl1 ( \a b -> ( a + b ) `mod` base ) $ do
		i <- [ k .. n + 1 ] 
		let
			lb = i * ( i - 1 ) `div` 2
			ub = i * ( ( n - i + 1 ) + n ) `div` 2
		return $ ub - lb + 1

Measured memory_bytes: 4912
#include <bits/stdc++.h>
#define int long long
#define ll long long
#define rep(i,n) for(int i=0;i<n;i++)
#define INF (((ll)1<<31)-1)
#define eps LDBL_EPSILON
#define moder (1000000007)
#define pie acos(-1)
#define P std::pair<int,int>
#define prique priority_queue
#define ggr getchar();getchar();return 0;
using namespace std;
double a,b,c;
signed main(){
	cin>>a>>b>>c;
	double h=b*sin(pie*c/180);
	double i=b*cos(pie*c/180);
	printf("%.12lf\n%.12lf\n%.12lf\n",a*h/2,hypot(a-i,h)+a+b,h);
	return 0;
}


Measured memory_bytes: 3480
// #include <bits/stdc++.h>
#include<iostream>
#include<iomanip>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<set>
#include<map>
#include<queue>
#define rep(i,n) for(int i=0;i<n;i++)
#define reps(i,x,n) for(int i=x;i<n;i++)
#define exrep(x,vec) for(auto&& x : vec);
#define PI 3.14159265358979323846264338327950288
const int MOD{ int(1e9 + 7) };	// = 1000000007
const int inf{ 2100000000 };	// = 2100000000 (MAX:2147483647)
typedef long long ll;
using namespace std;

// -------------------------------------------------- //
// ------------------ ここから本編 ------------------ //
// -------------------------------------------------- //

int main(void) {

	int N; cin >> N;
	ll sum = 0;
	ll MIN = inf;
	bool isOdd = false;
	bool isZero = false;
	vector<ll> A(N);
	rep(i, N) {
		cin >> A[i];
		if (A[i] < 0) isOdd = !isOdd;
		if (A[i] == 0) isZero = true;
		sum += abs(A[i]);
		MIN = min(MIN, abs(A[i]));
	}

	if (!isOdd || isZero) {
		cout << sum << endl;
	}
	else {
		cout << sum - MIN * 2 << endl;
	}
	
	return 0;
}


Measured memory_bytes: 3980
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
typedef pair<int, int> pii;
typedef priority_queue<int> PQ;
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//vector<vector<int> > dp;
//vector<vector<vector<int> > > vvvi;
//dp=vector<vector<int> >(N, vector<int>(M,0));
//vector<pair<int,int> > v;
//v.push_back(make_pair(x,y));
//priority_queue<int,vector<int>, greater<int> > q2;



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

	int N, K;
	cin >> N >> K;
	
	vector<pii> S;

	for (int i = 1; i*i <= N; i++) {
		S.push_back(pii(i, 0));
		S.push_back(pii(N / i, 0));
	}
	SORT(S);
	S.erase(unique(S.begin(), S.end()), S.end());

	REP(i, S.size() - 1) {
		int L = N / S[i + 1].first;
		int R = N / S[i].first;
		S[i].second = R - L;
	}
	S.back().second = 1;
	int M = S.size();
	map<int, int>mp;
	REP(i, M)mp[S[i].first] = i;
	vector<VI> dp(K + 1, VI(M));
	dp[0][mp[N]] = 1;
	REP(i, K) {
		for (int j = M - 2; j >= 0; j--) {
			dp[i][j] += dp[i][j + 1];
			dp[i][j] %= mod;
		}
		REP(j, M) {
			int nj = mp[N / S[j].first];
			dp[i + 1][j] += dp[i][nj]*S[j].second;
			dp[i + 1][j] %= mod;
		}
	}



	int ans = 0;
	REP(i, M) {
		ans += dp[K][i];
		ans %= mod;
	}

	cout << ans << endl;


	return 0;
}



Measured memory_bytes: 55668
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using PII = pair<ll, ll>;
#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
template<typename T> void chmin(T &a, const T &b) { a = min(a, b); }
template<typename T> void chmax(T &a, const T &b) { a = max(a, b); }
struct FastIO {FastIO() { cin.tie(0); ios::sync_with_stdio(0); }}fastiofastio;
#ifdef DEBUG
#include "../program_contest_library/memo/dump.hpp"
#else
#define dump(...)
#endif
const ll INF = 1LL<<60;

int main(void) {
    ll n, sum = 0;
    cin >> n;
    vector<ll> a(n);
    REP(i, n) cin >> a[i], sum += a[i];

    if(sum%(n*(n+1)/2)) {
        cout << "NO" << endl;
        return 0;
    }
    ll num = sum / (n*(n+1)/2);

    vector<ll> b(n);
    REP(i, n) b[i] = a[(i+1)%n] - a[i];
    REP(i, n) {
        if((num-b[i])%n || b[i]>num) {
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES" << endl;

    return 0;
}

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

int main(){
    ll x;
    cin>>x;
    vector<ll>hai(100010);
    hai[0]=0;
    for(int i=1;i<100010;i++)hai[i]=hai[i-1]+i;
    ll ans=0;
    rep(i,100010){
        if(x<=hai[i]){
            ans=i;
            break;
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 1024
#include"bits/stdc++.h"

using namespace std; 

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef pair<LL, LL> PLL;
typedef vector<PLL> VPLL;
typedef priority_queue<LL> PQ_DESC;
typedef priority_queue<LL, VL, greater<LL>> PQ_ASC;
typedef priority_queue<PII> PQ_DESC_PII;
typedef priority_queue<PII, vector<PII>, greater<PII>> PQ_ASC_PII;
typedef priority_queue<VL> PQ_DESC_VL;
typedef priority_queue<VL, vector<VL>, greater<VL>> PQ_ASC_VL;
typedef priority_queue<PLL> PQ_DESC_PLL;
typedef priority_queue<PLL, vector<PLL>, greater<PLL>> PQ_ASC_PLL;

#define ALL(c) (c).begin(),(c).end()
#define PB push_back
#define MP make_pair
#define SORT_ASC(c) sort(ALL(c))
//#define SORT_DESC(c) sort(ALL(c), greater<typeof(*((c).begin()))>())
#define SORT_DESC(c) sort((c).rbegin(),(c).rend())
#define REV(c) reverse((c).begin(), (c).end())
#define SIZE(a) int((a).size())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ROF(i,a,b) for(int i=(b-1);i>=(a);--i)
#define REP(i,n) FOR(i,0,n)
#define PER(i,n) ROF(i,0,n)

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int LARGE_INT = 1e9+100;
const int INF = 2e9+100;
const LL INF_LL = (LL)INF*(LL)INF;
const int MOD = 1e9+7;

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

LL modpow(LL a, LL n) {
    LL res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return res;
}

void Main()
{
    int a,b,c,k;cin>>a>>b>>c>>k;

    REP(i,k){
        if(a>=b){
            b*=2;
        }
        else{
            c*=2;
        }
    }
    if(a<b && b<c){
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }
    
	return;
}

int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
    return 0;
}

Measured memory_bytes: 3652
#include<iostream>
using namespace std;
#define ll long long
int main()
{
  ll n;
  cin>>n;
  ll count=0;
  ll a[n+1],b[n];
  for(ll i=0;i<n+1;++i)
  {
    cin>>a[i];
  }
  for(ll i=0;i<n;++i)
  {
    cin>>b[i];
    if(b[i]>a[i])
    {
      if(b[i]-a[i]>=a[i+1]){count=count+a[i]+a[i+1];a[i+1]=0;}
      else{count=count+b[i];a[i+1]=a[i+1]-b[i]+a[i];}
    }
    else
    {
      count=count+b[i];
    }
  }
  cout<<count;
}
  

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

#define rep(i,x,y) for(int i=(x);i<(y);++i)
#define debug(x) #x << "=" << (x)

#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define print(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define print(x)
#endif

const int inf=1e9;
const int64_t inf64=1e18;
const double eps=1e-9;

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){
    os << "[";
    for (const auto &v : vec) {
    	os << v << ",";
    }
    os << "]";
    return os;
}

void solve(){
    string s;
    cin >> s;
    bool c=false,f=false;
    for(char ch:s){
        if(ch=='C') c=true;
        if(c and ch=='F') f=true;
    }
    if(c and f) cout << "Yes" << endl;
    else cout << "No" << endl;
}

int main(){
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(10);
    solve();
    return 0;
}


Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))
se = set()
for i in range(1<<N):
    tot = 0
    for j in range(N):
        if i&(1<<j): tot += A[j]
    se.add(tot)
_ = int(input())
Q = list(map(int, input().split()))
for q in Q:
    if q in se:
        print("yes")
    else:
        print("no")



Measured memory_bytes: 5660
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n,m,k;
  cin>>n>>m>>k;
  
  long long int a[n];
  long long int b[m];
  
  for(int i=0;i<n;i++)
  {
    cin>>a[i];
  }
  for(int i=0;i<m;i++)
  {
    cin>>b[i];
  }
  
  vector<long long int >prea(n+1,0);
  vector<long long int >preb(m+1,0);
  
  for(int i=0;i<n;i++)
  {
    prea[i+1]=prea[i]+a[i];
  }
  
  for(int i=0;i<m;i++)
  {
    preb[i+1]=preb[i]+b[i];
  }
  
  int ans=0;
  for(int i=0;i<=n;i++)
  {
    long long int left = k-prea[i];
    if(left<0)
      continue;
    
    int searchb = lower_bound(preb.begin(),preb.end(),left)-preb.begin();
    if(searchb>m || preb[searchb]>left)
      searchb--;
    
    ans=max(ans,i+searchb);
  }
  cout<<ans;
}


Measured memory_bytes: 9584
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
int StoN(int a[]) {
    int ans = 0;
    int idx = 0;
    while(a[idx]==0) {
        idx++;
    }
    for(int i=idx;i<3;i++) {
        ans += a[i];
        ans *= 10;
    }ans /= 10;
    return ans;
}
int main(void) {
    int n, m;
    cin >> n >> m;
    int x[3] = {-1,-1,-1};
    bool ok = true;
    if(n==1 && m == 0) {
        cout << 0;
        return 0;
    }
    rep(i, m) {
        int s, c;
        cin >> s >> c;
        s--;
        if(x[s]!=-1&&x[s]!=c) ok = false;
        x[s] = c;
    }
    if(!ok) {
        cout << -1;
        return 0;
    }
    if(n > 1 && x[0] == 0) {
        cout << -1;
        return 0;
    }
    rep(i, n) {
        if(i==0&&x[i]==-1) cout << 1;
        else if(x[i]==-1) cout << 0;
        else cout << x[i];
    }
}



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

int main(){
  while(1){
    int w,h;
    cin>>w>>h;
    if(!w&&!h)break;
    int n;
    cin>>n;
    int mp[20][20]={};
    for(int i=0,a,b;i<n;i++)cin>>a>>b,mp[b-1][a-1]=1;
    
    int dp[20][20]={1};
    for(int i=0;i<h;i++)
      for(int j=0;j<w;j++){
	if(!mp[i+1][j])dp[i+1][j]+=dp[i][j];
	if(!mp[i][j+1])dp[i][j+1]+=dp[i][j];
      }
    cout <<dp[h-1][w-1]<<endl;
  }
  return 0;
}

Measured memory_bytes: 1160
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cassert>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
#include <cassert>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
int n; ll S;
int main(){
	scanf("%d%lld",&n,&S);
	ll pre = 0;
	for(int i=1;i<=n;i++){
		ll x; scanf("%lld",&x);
		if(i>=2 && pre+x >= S){
			puts("Possible");
			for(int j=n-1;j>=i;j--) printf("%d\n",j);
			for(int j=1;j<=i-2;j++) printf("%d\n",j);
			printf("%d\n",i-1);
			return 0;
		}
		pre = x;
	}
	puts("Impossible");
}

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

string S;

int Check(int a)
{
  if(S[a]!='m')return 0;
  a++;
  if(S[a]!='e'){
    a=Check(a);
    if(a==0)return 0;
  }
  a++;
  if(S[a]!='w'){
    a=Check(a);
    if(a==0)return 0;
  }
  a++;
  return a;
}

int main()
{
  cin>>S;
  if(Check(0)==S.length())cout<<"Cat"<<endl;
  else cout<<"Rabbit"<<endl;
  return 0;
}

Measured memory_bytes: 1184
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A, B, C;
  cin >> A >> B >> C;
  if(A==B && B!= C){
    cout << "Yes" << endl;
  }
  else if(A==C && B!= C){
    cout << "Yes" << endl;
  }
  else if(B==C && A!= C){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var (
		n int
		k int
	)
	fmt.Scan(&n, &k)

	count := 0

	for i := 0; i < n; i++ {
		var h int
		fmt.Scan(&h)
		if h >= k {
			count++
		}
	}

	fmt.Println(count)
}


Measured memory_bytes: 6320
#include <iostream>
#include <list>

#define MAX_ELEM 100000

template<class X> class Queue {
  public:
    void enqueue(X elem) {
      Box[tail] = elem;
      tail = (tail + 1) % MAX_ELEM;
    }
    X dequeue(void) {
      auto temp = Box[head];
      head = (head + 1) % MAX_ELEM;
      return temp;
    }
    bool empty(void) {
      return head == tail;
    }
  private:
    X Box[MAX_ELEM];
    unsigned int head = 0;
    unsigned int tail = 0;
};

int main() {
  int n, q;
  std::cin >> n >> q;
  
  Queue<std::pair<std::string, int>> queue;
  std::string name;
  int time;
  
  for (auto i=0; i<n; ++i) {
    std::cin >> name >> time;
    queue.enqueue(std::make_pair(name, time));
  }
  
  auto current_time = 0;
  
  while (!queue.empty()) {
    auto cur = queue.dequeue();
    if (cur.second > q) {
      queue.enqueue(std::make_pair(cur.first, cur.second - q));
      current_time += q;
    } else if (cur.second == q) {
      current_time += q;
      std::cout << cur.first << " " << current_time << std::endl;
    } else {
      current_time += cur.second;
      std::cout << cur.first << " " << current_time << std::endl;
    }
  }
}


Measured memory_bytes: 7028
#include <bits/stdc++.h>
#define rep(i,n) for(int64_t i=0;i < (int64_t)(n);i++)
#define invrep(i,n) for(int64_t i=n-1;i >= 0;i--)
using namespace std;

//////全探索したいときに開けよ////////
vector<vector<int>> fspattern;
vector<int> fspattern_draft;
int fspcnt = 0;

void setfspattern_core(int floor,int number,int degree){
  if(floor==degree){
    fspattern.at(fspcnt) = fspattern_draft;
    fspcnt++;
  }else{
    rep(i,number){
      fspattern_draft.at(floor) = i;
      setfspattern_core(floor+1,number,degree);
    }
  }
}

void setfspattern(int number,int degree){
  fspcnt = 0;
  int64_t array_num = 1;
  rep(i,degree){
    array_num *= number;
  }
  fspattern = vector<vector<int>>(array_num,vector<int>(degree));
  fspattern_draft = vector<int>(degree);
  setfspattern_core(0,number,degree);
}

//////nCrのmodを求めたいときに開けよ/////////
//int64_t univMod = 1000000007;
//int64_t factnum = 100000
//vector<int64_t> modfact(factnum);
//vector<int64_t> modinvfact(factnum);

/*void setmodfact(){
  for(int i=0;i<factnum;i++){
    if(i == 0){
      modfact.at(i) = 1;
    }else{
      modfact.at(i) = (modfact.at(i-1)*i)%univMod;
    }
  }
}

int64_t calcmodpower(int64_t a,int64_t n){
  int64_t res = 1;
  while(n != 0){
    if(n & 1){
      res = (res * a) % univMod;
    }
    a = (a*a) % univMod;
    n = n >> 1;
  }
  return res;
}

int64_t calcinverse(int64_t n){
	return calcmodpower(n,univMod-2);
}

void setmodinvfact(){
  for(int i=0;i<factnum;i++){
    if(i==0){
      modinvfact.at(i) = 1;
    }else{
      modinvfact.at(i) = calcmodpower(modfact.at(i),univMod-2);
    }
  }
}*/


/*
int64_t calcGCD(int64_t a,int64_t b){
	int64_t p = a;
	int64_t q = b;
	int64_t c = a%b;
	while(c != 0){
		p = q;
		q = c;
		c = p%q;
	}
	return q;
}
*/

int main(){
  int n;
  cin >> n;
  int cnt = 0;
  int maxcnt = 0;
  int hoge = 1;
  for(int i=1;i <= n;i++){
    int k = i;
    cnt = 0;
    while(k % 2 == 0){
      k = k/2;
      cnt++;
    }
    if(maxcnt < cnt){
      hoge = i;
    }
    maxcnt = max(cnt,maxcnt);
  }
  cout << hoge << endl;
  
}

Measured memory_bytes: 256
#include <cstdio>
#include <utility>
#include <queue>
#include <vector>
#include <iostream>
#include <algorithm>
#include <math.h>
#include <map>
#include <string.h>

using namespace std;

int main(){

  string s; cin>>s;  
  string t="\""+s+"\"";
   
  int count=0;
   
  while(1){
    
    string w; cin>>w;
    
    bool flag1=true,flag2=true;
    
    for(int i=0; i<s.size(); ++i){
      if(w.size()!=s.size()){
        flag1=false; break;
        }
      char a,b;
      a=tolower(w[i]); b=tolower(s[i]);
      if(a!=b) flag1=false;
      }
      
    for(int i=0; i<t.size(); ++i){
       if(w.size()!=t.size()){
        flag2=false; break;
        }
      char a,b;
      a=tolower(w[i]); b=tolower(t[i]);
      if(a!=b) flag2=false;
      }
    
    if(flag1||flag2) count++;
    
    if(w=="END_OF_TEXT") break;
     }

     cout<<count<<endl;

}

Measured memory_bytes: 1200
n, m = map(int, input().split())
h = list(map(int, input().split()))
ab = []
lst = [1 for _ in range(n)]
for _ in range(m):
    a, b = map(int, input().split())
    if h[a-1] < h[b-1]:
        lst[a-1] = 0
    elif h[a-1] > h[b-1]:
        lst[b-1] = 0
    elif h[a-1] == h[b-1]:
        lst[a-1] = lst[b-1] = 0
count = sum(lst)
print(count)

Measured memory_bytes: 20120
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <bitset>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <string>
#include <chrono>
#include <random>
#include <cmath>
#include <cassert>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <functional>
#include <sstream>

using namespace std;

class Solution {
public:
    vector<int> solve(vector<pair<int,int>>& edges) {
        int n = edges.size() + 1;

        vector<vector<pair<int,int>>> graph(n);
        for (int i = 0; i < n - 1; ++i) {
            int u = edges[i].first, v = edges[i].second;
            graph[u].emplace_back(v, i);
            graph[v].emplace_back(u, i);
        }

        vector<int> res(n - 1, -1);

        vector<int> ord;
        vector<int> pars(n, -1);
        ord.push_back(0);
        vector<int> clr(n, -1);

        for (int i = 0; i < ord.size(); ++i) {
            int u = ord[i];
            int c = 0;
            for (auto& e : graph[u]) {
                int v = e.first;
                int idx = e.second;
                if (v == pars[u]) {
                    continue;
                }
                if (c == clr[u]) {
                    ++c;
                }
                res[idx] = c;
                clr[v] = c;
                pars[v] = u;
                ord.push_back(v);
                ++c;
            }
        }
        return res;
    }
};

int main(int argc, char** argv) {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    vector<pair<int,int>> edges;
    for (int i = 0; i + 1 < n; ++i) {
        int u, v;
        cin >> u >> v;
        --u, --v;
        edges.emplace_back(u, v);
    }

    Solution sol;
    auto res = sol.solve(edges);
    int C = *max_element(res.begin(), res.end());
    cout << C + 1 << "\n";
    for (auto r : res) {
        cout << r + 1 << "\n";
    }
    return 0;
}

Measured memory_bytes: 9204
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <sstream>
#include <unordered_map>
#include <vector>


#define INF 4000000000000000000LL
#define MOD 1000000007
#define ALL(x) std::begin(x), std::end(x)


int main(int argc, char** argv)
{
  std::cin.tie(0);
  std::ios_base::sync_with_stdio(0);

  std::cout << std::fixed << std::setprecision(6);
  std::cerr << std::fixed << std::setprecision(6);

  long long N;

  std::cin >> N;

  std::cout << (N - 1) * N / 2 << std::endl;

  return 0;
}


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

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

int main() {
    Int n;
    cin >> n;
    vector<pair<int64_t, int64_t>> pf = prime_factorize(n);
    vector<Int> zs;
    for (auto p : pf) {
        for (int i = 1; i <= p.second; i++) {
            zs.push_back(pow(p.first, i));
        }
    }
    sort(zs.begin(), zs.end());
    int ans = 0;
    for (int i = 0; i < zs.size(); i++) {
        if (n % zs[i] == 0) {
            n /= zs[i];
            ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3992
#include<iostream>
#include<algorithm>
using namespace std;
#define rep(i, n) for ( int i = 0; i < n; i++)
static const int MAX = 30;
int H, W, N;
char G[MAX][MAX], T[MAX][MAX];

bool isSolved(){
  rep(i, H) rep(j, W) if ( T[i][j] != '.' ) return false;
  return true;
}

bool remove(){
  bool rem = false;
  bool R[MAX][MAX];
  rep(i, H) rep(j, W) R[i][j] = false;
  rep(i, H){
    int j = 0;
    int cnt = 1;
    while( j < W ){
      int s = j;
      while( j+1 < W && T[i][j] == T[i][j+1] ){ j++; cnt++;}
      if ( cnt >= N ){
	rem = true;
	for ( int k = s; k < s+cnt; k++ ) R[i][k] = true;
      }
      j++; cnt = 1;
    }
  }

  rep(j, W){
    int i = 0;
    int cnt = 1;
    while( i < H ){
      int s = i;
      while( i+1 < H && T[i][j] == T[i+1][j] ){ i++; cnt++;}
      if ( cnt >= N ){
	rem = true;
	for ( int k = s; k < s+cnt; k++ ) R[k][j] = true;
      }
      i++; cnt = 1;
    }
  }
  rep(i, H) rep(j, W) if ( R[i][j] ) T[i][j] = '.';

  return rem;
}

bool down(){
  int m = 0;
  while(1){
    bool moved = false;
    for ( int i = H-1; i >= 1; i-- ){
      rep(j, W){
	if ( T[i][j] == '.' && T[i-1][j] != '.' ){
	  moved = true;
	  m++;
	  swap(T[i][j], T[i-1][j]);
	}
      }
    }
    if ( !moved) break;
  }
  return m > 0;
}

bool solve(){
  down();
  while(1){
    if (!remove()) break;
    if (!down()) break;
  }
  return isSolved();
}

main(){
  cin >> H >> W >> N;
  rep(i, H) rep(j, W ) cin >> G[i][j];
  bool suc = false;
  rep(i, H) rep(j, W-1 ) {
    rep(a, H) rep(b, W ) T[a][b] = G[a][b];
    swap(T[i][j], T[i][j+1]);
    if ( solve() ){
      suc = true;
      break;
    }
  }
  cout << (suc?"YES":"NO") << endl;
}

Measured memory_bytes: 0
#include<iostream>
#include<vector>
#include<algorithm>

using namespace std;

long long A[200000];
long long sum_A[200000];

long long diff(int start, int end) {
	long long diff = 0;

	diff = sum_A[end - 1] - sum_A[start - 1];

	return diff;
}

int find_position(int start,int end,int &slash) {
	while (abs(diff(start, slash) - diff(slash, end)) >= abs(diff(start, slash+1) - diff(slash+1, end)) && slash < end) {
		slash++;
	}
	return slash;
}

int main() {
	long long ans;

	int N;
	cin >> N;
	for (int i = 0;i < N;i++) {
		cin >> A[i];
		if (i == 0) {
			sum_A[i] = A[i];
		}
		else {
			sum_A[i] = sum_A[i - 1] + A[i];
		}
		//cout << sum_A[i] << endl;
	}

	int l = 1;
	int r = 3;
	for (int middle = 2;middle <= N - 2;middle++) {
		//cout << l << " " << r << endl;
		int left = find_position(0, middle,l);
		int right = find_position(middle, N,r);
		vector<long long> P_Q_R_S(4);
		P_Q_R_S[0] = sum_A[left - 1];
		P_Q_R_S[1] = sum_A[middle - 1] - sum_A[left - 1];
		P_Q_R_S[2] = sum_A[right - 1] - sum_A[middle - 1];
		P_Q_R_S[3] = sum_A[N - 1] - sum_A[right - 1];
		
		if (middle == 2) {
			ans = *max_element(P_Q_R_S.begin(), P_Q_R_S.end()) - *min_element(P_Q_R_S.begin(), P_Q_R_S.end());
		}
		else if (ans > *max_element(P_Q_R_S.begin(), P_Q_R_S.end()) - *min_element(P_Q_R_S.begin(), P_Q_R_S.end())) {
			ans = *max_element(P_Q_R_S.begin(), P_Q_R_S.end()) - *min_element(P_Q_R_S.begin(), P_Q_R_S.end());
		}
	}
	
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3328
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <iomanip>
#include <fstream>
#include <stack>

using namespace std;
 
#define ll long long
typedef unsigned long long ull;
typedef long double ld;

#define pii         pair<ll ,ll >
#define vi          vector<ll >
#define vii         vector<pii>
#define mi          map<ll ,ll >
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define pb          push_back
#define hell        1000000007 
#define rep(i,a,b)  for(ll int i=a;i<b;i++)
#define take        rep(i,0,n) cin>>v[i];
#define MAXN        1000005


#define allr(c) (c).rbegin(),(c).rend()
int mod = 1000000007;
const int inf = 1034567891;
const ll LL_INF = 1234567890123456789ll;
#define PI 3.14159265
#define endl '\n'
#define F first
#define S second
#define debug(x) cout << #x << " = " << x << endl;
#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cout << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif
 
#define out(container) for (auto it : container) cout << it << " "; cout << endl;
 
 
template < typename T > T GCD(T a, T b)            { ll t; while(a) { t = a; a = b % a; b = t; } return b; }
template < typename T > string toString(T a)       { return to_string(a); }
template < typename T > void toInt(string s, T &x) { stringstream str(s); str >> x;}
inline int add(int x, int y){ x += y; if(x >= mod) x -= mod; return x;}
inline int sub(int x, int y){ x -= y; if(x < 0) x += mod; return x;}
inline int mul(int x, int y){ return (x * 1ll * y) % mod;}
inline int powr(int a, ll b){
  int x = 1 % mod;
  while(b){
    if(b & 1) x = mul(x, a);
    a = mul(a, a);
    b >>= 1;
  }
  return x;
}
inline int inv(int a){ return powr(a, mod - 2);}



void solve()
{
	ll n;
	cin>>n;
	vi v(n);
	take;
	vi ps(n+1);
	for(ll i=n-1;i>=0;i--)
	{
		ps[i]=add(ps[i+1],v[i]);
	}
	ll a=0;
	for(ll i=0;i<n;i++)
	{
		ll b= mul(ps[i+1],v[i]);
		a=add(a,b);
	}
	cout<<a<<endl;
}
int main()
    {
    	ios::sync_with_stdio(false);
        cin.tie(0);
        cout.tie(0);
      
        ll t;
        
        t=1;
        
    
 //   cin>>t;
        while(t--)
        solve();
    }

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

using ll = long long;

ll dp[50]; // dp[i]: i段目まで上り方の種類

void init() {
   dp[1] = 1, dp[2] = 2, dp[3] = 4;
   for (int i = 4; i <= 30; i++) {
      dp[i] = dp[i-1] + dp[i-2] + dp[i-3];
   }
}

int main() {
   init();
   while (1) {
      int n;
      cin >> n;
      if (!n) break;
      ll day = max(1LL, dp[n] / 10);
      cout << day / 365 + (day%365 != 0) << endl;
   }

   return 0;
}


Measured memory_bytes: 2988
#include<iostream>
#include<cstring>
using  namespace std;
int main()
{
	int a,b,c;
	while(scanf("%d%d%d",&a,&b,&c)!=EOF)
	{
		if(a+b+c>=22)
		printf("bust\n");
		else
		printf("win\n");
	}
 } 

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

typedef long long ll;
const ll INF = 1e9, MOD = 1e9 + 7;
const double EPS = 1e-9, PI = 3.141592653589793;
#define REP(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
#define REPR(i,a,b) for(ll i=b;i>=a;i--)
#define repr(i,n) REPR(i,0,n)
#define all(v) (v).begin(), (v).end()
#define pb push_back

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

    ll h,w,H,W;
    cin >> H >> W >> h >> w;
    cout << (H-h)*(W-w) << "\n";
    return 0;
}

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

int char_to_int(char c){
	return (int)c - (int)'a';
}

int main(){
	int N, i;
	char *S = (char *)malloc(sizeof(char) * 200001);
	char *T = (char *)malloc(sizeof(char) * 200001);
	scanf("%s", S);
	scanf("%s", T);
	int will[26], did[26], alfS[26], alfT[26];
	for(i = 0; i < 26; i++){
		will[i] = -1;
		did[i] = -1;
		alfS[i] = 0;
		alfT[i] = 0;
	}
	for(N = 0; S[N] != '\0'; N++){}
	for(i = 0; i < N; i++){
		if(will[char_to_int(S[i])] == -1){
//			printf("i = %d\n", i);
			will[char_to_int(S[i])] = char_to_int(T[i]);
//			printf("will[%d] = %d\n", char_to_int(S[i]), char_to_int(T[i]));
		}
		else{
			if(will[char_to_int(S[i])] != char_to_int(T[i])){
				printf("No\n");
				return 0;
			}
		}
		if(did[char_to_int(T[i])] == -1){
			did[char_to_int(T[i])] = char_to_int(S[i]);
		}
		else{
			if(did[char_to_int(T[i])] != char_to_int(S[i])){
				printf("No\n");
				return 0;
			}
		}
	}
	printf("Yes\n");
	return 0;
}

Measured memory_bytes: 512
from collections import deque
s = deque(input())
cou = 0
while len(s)!=0:
  a = s[0]
  b = s[-1]
  if a=='x' and b!='x':
    cou += 1
    s.popleft()
  elif a!="x" and b=='x':
    cou += 1
    s.pop()
  elif a=="x" and b=='x':
    if len(s)==1:
      s.popleft()
    else:   
      s.popleft()
      s.pop()
  elif a==b:
    if len(s)==1:
      s.popleft()
    else:   
      s.popleft()
      s.pop()
  else:
    print(-1)
    exit()
print(cou)

Measured memory_bytes: 4204
import java.io.*;
import java.util.*;

import javax.lang.model.element.*;

public class Main {

	final static long MOD = 1000000007;
	public static String[] Ws = null;
	public static int wsIndx = 0;
	public static BufferedReader in = null;
	public static long cnt=0;
	public static PrintWriter pw = new PrintWriter(System.out);
	public static void main(String[] args) throws Exception {
		solutionB(args);
		if(in!=null){
			in.close();
		}
		pw.flush();
		pw.close();
	}

	public static void solutionA(String[] args) throws Exception{

		int N = nextInt();
		N=N%10;
		if(N==2||N==4||N==5||N==7||N==9){
			pw.println("hon");
		}else if(N==0||N==1||N==6||N==8){
			pw.println("pon");
		}else{
			pw.println("bon");
		}


	}
	public static void solutionB(String[] args) throws Exception{

		int K=nextInt();
		String S = nextString();
		if(S.length()<=K){
			pw.println(S);
		}else{
			pw.println(S.substring(0,K)+"...");
		}


	}
public static class Pair {
	String N;
	int V;

	Pair(String N, int V) {
		this.N = N;
		this.V = V;
	}

	public String getN() {
		return N;
	}

	public int getV() {
		return V;
	}

	public static Comparator<Pair> getComparator() {
		return Comparator.comparing(Pair::getN).thenComparing(Pair::getV, Comparator.reverseOrder());
	}
}


	public static void check() throws Exception{
		if(in == null){
			in = new BufferedReader(new InputStreamReader(System.in));
		}
		if(Ws==null || Ws.length<=wsIndx){
			Ws = in.readLine().split(" ");
			wsIndx=0;
		}
	}
	public static int nextInt()throws Exception{
		check();
		return Integer.parseInt(Ws[wsIndx++]);
	}

	public static long nextLong()throws Exception{
		check();
		return Long.parseLong(Ws[wsIndx++]);
	}

	public static String nextString()throws Exception{
		check();
		return Ws[wsIndx++];
	}

	public static int[] nextInts()throws Exception{
		check();
		int[] tmp = new int[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Integer.parseInt(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static long[] nextLongs()throws Exception{
		check();
		long[] tmp = new long[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Long.parseLong(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static String[] nextStrings()throws Exception{
		check();
		wsIndx=Ws.length;
		return Ws;
	}

}



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

int main(){
	int hen[3],n,i,max;
	cin>>n;
	for(i = 0;i < n;i++){
		cin>>hen[0]>>hen[1]>>hen[2];
		sort(hen,hen+3,greater<int>());

		if(pow(hen[0],2) == (pow(hen[2],2)+pow(hen[1],2)))
				cout<<"YES"<<endl;

		else
				cout<<"NO"<<endl;
	}
	return 0;
}

Measured memory_bytes: 1168
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i < (n); i++)
#define all(v) (v).begin(), (v).end()
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
using namespace std;
typedef long long LL;
const int INF = 999999999;

int K, R, L;
double P, E, T;

double dfs(double l, double r, int k){
    // cout << l << " " << r << endl;
    double h = (l+r)/2.;
    if(k == K) return abs(h-T) <= E ? 1 : 0;

    if(max(abs(l-T), abs(r-T)) <= E) return 1;
    if(T < l && l-T > E) return 0;
    if(r < T && T-r > E) return 0;
    if(T <= h) return (1-P)*dfs(l, h, k+1)+P*dfs(h, r, k+1);
    else return P*dfs(l, h, k+1)+(1-P)*dfs(h, r, k+1);
}

int main(){
    // LとRを取り違えたマン
    cin >> K >> L >> R;
    cin >> P >> E >> T;
    cout << fixed << setprecision(15) << dfs(L, R, 0) << endl;

}




Measured memory_bytes: 3284
#include<bits/stdc++.h>
using namespace std;
int x[105],y[105],w[105];
int main(){
	int n;
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		scanf("%d%d%d",&x[i],&y[i],&w[i]);
	}
	for(int i=0;i<n;i++){
		if(w[i]!=0){
			swap(x[0],x[i]);
			swap(y[0],y[i]);
			swap(w[0],w[i]);
			break;
		}
	}
	if(w[0]==0){
		int t=1;
		for(int i=0;i<=100;i++){
			for(int j=0;j<=100;j++){
				int f=0;
				for(int k=0;k<n;k++){
					if(max(t-abs(i-x[k])-abs(j-y[k]),0)!=w[k]){
						f=1;
						break;
					}
				}
				if(f==0)
					return 0*printf("%d %d %d\n",i,j,t);
			}
		}
	}
	for(int i=0;i<=100;i++){
		for(int j=0;j<=100;j++){
			int f=0;
			int t=w[0]+abs(i-x[0])+abs(j-y[0]);
			if(t==0)
				continue;
			for(int k=1;k<n;k++){
				if(max(t-abs(i-x[k])-abs(j-y[k]),0)!=w[k]){
					f=1;
					break;
				}
			}
			if(f==0){
				return 0*printf("%d %d %d\n",i,j,t);
			}
		}
	}
}

Measured memory_bytes: 256
from sys import stdin
N = int(stdin.readline().rstrip())
LIS = [0] * (N + 1)
P = [0]*N
for i in range(N):
    P[i] = int(stdin.readline().rstrip())
for p in P:
    LIS[p] = LIS[p-1] + 1 
print(N - max(LIS))

Measured memory_bytes: 18832
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vel;
typedef vector<int> vei;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> ve_vel;
typedef vector<vector<int>> ve_vei;
typedef vector<vector<char>> ve_vec;
typedef vector<vector<bool>> ve_veb;
typedef vector<vector<string>> ve_ves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pub push_back
#define puf push_front
#define pob pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
//#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
typedef long long int64;
const int64 INF = 1LL << 58;
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<typename T> void remove(T & vector, unsigned int index){vector.erase(vector.begin() + index);}

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

    int N,K; cin>>N>>K;
  	int a = (N+1) / 2;
  	if(a < K) cout << "NO" << endl;
  	else cout << "YES" << endl;
  	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a) for(int i = 0; i < (a); i++)
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9;
const int MOD = 1e9 + 7;

int main(){
	int a,b;
	cin >> a >> b;
	string s;
	cin >> s;
	REP(i,a){
		if(!('0' <= s[i] && s[i] <= '9')){
			cout << "No" << endl;
			return 0;
		}
	}
	if(s[a] != '-'){
		cout << "No" << endl;
		return 0;
	}
	for(int i = a + 1; i <= a + b; i++){
		if(!('0' <= s[i] && s[i] <= '9')){
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int N = scanner.nextInt();
		int i = scanner.nextInt();

		scanner.close();

		int num;

		num = N - i + 1;

		if (num <= 0) {
			num = 1;
		}

		System.out.println(num);
	}
}


Measured memory_bytes: 24020
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

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

    int n, k, c;
    cin >> n >> k >> c;

    string s;
    cin >> s;

    vector<int> a[2];
    for (int h = 0; h < 2; h++) {
        a[h] = vector<int>(k);
        int i = 0, l = 0;
        for (;;) {
            while (s[i] != 'o') i++;
            a[h][l++] = i;
            if (l == k) break;
            i += c + 1;
        }
        reverse(s.begin(), s.end());
    }

    reverse(a[1].begin(), a[1].end());
    for (int l = 0; l < k; l++) {
        a[1][l] = n - 1 - a[1][l];
    }

    for (int l = 0; l < k; l++) {
        if (a[0][l] == a[1][l]) cout << a[0][l] + 1 << '\n';
    }

    return 0;
}

Measured memory_bytes: 3348
#include <iostream>
#include <cstdio>
#include <math.h>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <cstring>
#include <algorithm>
using namespace std;
typedef long long ll;

const int maxn =  2e5 + 7;

int n, a, b, c, d;
string s;
int dp[maxn];

int main() {
  scanf("%d%d%d%d%d", &n, &a, &b, &c, &d);
  a -= 1, b -= 1, c -= 1, d -= 1;
  cin >> s;
  memset(dp, 0, sizeof(dp));
  dp[a] = 1;
  for (int i = a + 1; i < n; i++) {
    if (s[i] == '.' && s[i - 1] == '.') {
      dp[i] = max(dp[i], dp[i - 1]);
    }
    if (s[i] == '.' && s[i - 2] == '.') {
      dp[i] = max(dp[i], dp[i - 2]);
    }
  }
  int cnt = 0;
  if (dp[c] == 1) ++cnt;
  memset(dp, 0, sizeof(dp));
  dp[b] = 1;
  for (int i = b + 1; i < n; i++) {
    if (s[i] == '.' && s[i - 1] == '.') {
      dp[i] = max(dp[i], dp[i - 1]);
    }
    if (s[i] == '.' && s[i - 2] == '.') {
      dp[i] = max(dp[i], dp[i - 2]);
    }
  }
  bool flag = false;
  for (int i = b; i <= d; i++) {
    if (s[i - 1] == '.' && s[i] == '.' && s[i + 1] == '.') {
      flag = true;
      break;
    }
  }
  if (dp[d] == 1) ++cnt;
  if (c < d) {
    if (cnt == 2) puts("Yes");
    else puts("No");
  }
  else {
    if (cnt == 2 && flag) puts("Yes");
    else puts("No");
  }
  return 0;
}

Measured memory_bytes: 1284
function main()
  
  (N,M) = map(x -> parse(Int,x), split(readline()))
  A = map(x -> parse(Int,x), split(readline()))
  
  check = sum(A) * (1 / 4M)
  ans = false
  count = 0
  
  for i in 1:N
    
    if check <= A[i]
      count += 1
    end
    
    if count >= M
      ans = true
      break
    end
    
  end
  
  if ans
    println("Yes")
  else
    println("No")
  end
  
end

main()

Measured memory_bytes: 168136
#include <iostream>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;

int main(void) {
  ios::sync_with_stdio(false);
  int K, T;
  cin >> K >> T;
  int SUM_K = 0;
  int MAX_K = 0;
  rep(i, T) {
    int a;
    cin >> a;
    SUM_K += a;
    MAX_K = max(MAX_K, a);
  }
  SUM_K -= MAX_K;
  int answer = 0;
  answer = max(answer, MAX_K - SUM_K - 1);
  cout << answer << endl;
  return 0;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

from collections import deque

N = int(input())
A = sorted((int(x) for x in input().split()))

parent = [A[-1]]
rest = A[:-1]
bl = True
for _ in range(N):
    next_parent = []
    next_rest = []
    for p in parent[::-1]:
        while rest:
            x = rest.pop()
            if x < p:
                next_parent.append(x)
                break
            else:
                next_rest.append(x)
                continue
    parent += next_parent
    parent.sort()
    rest = rest + next_rest[::-1]

bl = len(parent) == (2**N)
answer = 'Yes' if bl else 'No'
print(answer)



Measured memory_bytes: 33004
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))

ans = 0
pre = 10**9+7
for i in range(N):
    ans += B[A[i]-1]
    if (A[i]-1)-pre == 1:
        ans += C[pre]
    
    pre = A[i]-1
    
print(ans)
    

Measured memory_bytes: 62000
S=list(input())
T=list(input())
SS=len(S)
TS=len(T)
ans=TS
for i in range(SS-TS+1):
  cnt=0 #
  for j in range(TS):
    #print(T[j] ,S[i+j])
    if T[j] != S[i+j] :
      cnt +=1
  ans=min(cnt,ans)

print(ans)

Measured memory_bytes: 9060