akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
const int INF=1e9,MOD=1e9+7,ohara=1e6+10;
const ll LINF=1e18;
using namespace std;
    
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout<<(x)<<endl
#define doublecout(a) cout<<fixed<<setprecision(15)<<a<<endl;
#define Cerr(x) cerr<<(x)<<endl
#define fi first
#define se second
#define P pair<ll,ll> 
#define m_p make_pair
#define V vector<ll> 
#define U_MAP unordered_map<ll,ll>
#define pq priority_queue<ll>
#define rpq priority_queue<ll,vector<ll>,greater<ll>>
#define p_b push_back
    
ll n,cnt,ans,a,b,c,d,tmp,tmpp,m,h,w,x,y,sum,pos,k,q;
ld doua;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
//int dy[]={-1,0,1,-1,1,-1,0,1};
//int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl;
struct edge{int to,cost;};
    
//------ Believe yourself as a genius!!!!!! ------
    
int main(void){
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    
    cin>>s;
    rep(i,4)cout<<s[i];
    cout<<" ";
    rrep(i,4,Size(s))cout<<s[i];
    cout<<"\n";
    return 0;
}

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

int dp[4][MAX];
int a[MAX], b[MAX], c[MAX];
int main(){
	int n, p;
	scanf("%d", &n);
	rep(i,n)scanf("%d", &a[i]);
	rep(i,n)scanf("%d", &b[i]);
	rep(i,n)scanf("%d", &c[i]);
	sort(a, a+n);a[n] = inf;
	sort(b, b+n);b[n] = inf;
	sort(c, c+n);c[n] = inf;
	
	ll ans = 0;
	for(int i = 0;i < n;i++){
		ll an = (lower_bound(a,a+n+1,b[i])-a);
		ll cn = n-(upper_bound(c,c+n+1,b[i])-c);
		ans += an*cn;
	}
	
	printf("%lld\n", ans);
	return 0;
}

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

using namespace std;

typedef long long ll;

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n; cin >> n;
    vector<ll> a(n);
    for (int i = 0; i < n; i++) cin >> a[i];
    for (int i = 1; i < n; i++) a[i] = a[i - 1] + a[i];
    ll ans = 1e18;
    for (int i = 0; i + 1 < n; i++)
    {
        ll x = a[i], y = a[n - 1] - a[i];
        ans = min(ans, abs(x - y));
    }
    cout << ans;
}


Measured memory_bytes: 1792
#include <cstdio>

char S[200'005], T[200'005];

int main(void)
{
    scanf("%s", S);
    scanf("%s", T);

    int ans = 0;
    for(int i = 0; S[i]; i++)
        ans += S[i] != T[i];
    
    printf("%d", ans);
    return 0;
}

Measured memory_bytes: 2080
let MOD = 1000000007L
let add x y = (x + y) % MOD
let sub x y = (x + MOD - y) % MOD

let N = stdin.ReadLine() |> int
let A = stdin.ReadLine().Split() |> Array.map int64

let mutable sum = 0L

for i in [ 0..N - 1 ] do
    sum <- add sum A.[i]

let mutable result = 0L

for i in [ 0..N - 1 ] do
    sum <- sub sum A.[i]
    if sum < 0L then sum <- add sum MOD
    result <- add result (A.[i] * sum)

result |> stdout.WriteLine


Measured memory_bytes: 60840
# coding: utf-8
N = int(input())
A = {}
AA = []
for i in range(N):
    a = int(input())
    if a not in A.keys():
        A[a] = 1
    else:
        A[a] += 1
    AA.append(a)
key = list(A.keys())
key.sort(reverse=True)
ans = []
for i in range(N):
    if AA[i] != key[0]:
        ans.append(key[0])
    else:
        if A[key[0]] < 2:
            ans.append(key[1])
        else:
            ans.append(key[0])
print(*ans, sep="\n")

Measured memory_bytes: 24288
#include <bits/stdc++.h>
#define REP(i,s,e) for(int i=(s); i<(e);i++)
#define rep(i,n) REP(i,0,n)
#define rep1(i,n) REP(i,1,n)
#define repe(i,n) for(auto &&i:n)
#define all(v) (v).begin(),(v).end()
#define decimal fixed<<setprecision(20)
#define fastcin() cin.tie(0);ios::sync_with_stdio(false)
using namespace std;
using LL = long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF = 1e9;
const LL LLINF = 1e16;

int main(){
    int n, m;
    cin >> n >> m;
    int ans = m*1900+(n-m)*100;
    rep(i, m) ans*= 2;
    cout << ans << endl;
}

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


using namespace std;

const long long MOD = 1000000007;

long long c[2010][2010];

long long n, K;

long long getC(long long n, long long m)
{
	if (c[n][m] != 0)
		return c[n][m];
		
	if (m == 0)
	{
		c[n][m] = 1;		
		return c[n][m];
	}
	
	if (n == m)
	{
		c[n][m] = 1;		
		return c[n][m];
	}
	
	if ((n - m) < m)
	{
		c[n][m] = getC(n, n - m) % MOD;
		return c[n][m];
	}

	c[n][m] = (getC(n - 1, m - 1) + getC(n - 1, m)) % MOD;
	return c[n][m];
}


int main()
{
//	printf("%d\n%d\n%d\n", getC(3, 2), getC(5,2), getC(5,1));
	scanf("%lld%lld", &n, &K);
	
	for (int m = 1 ; m <= K ; m++)	//拆成多少份 
	{
		if (n < m)
		{
			printf("0\n");
			continue;
		}
		
		long long A = getC(K - 1, m - 1);
		
		long long left = n - K - (m - 1);
		if (left < 0)
		{
			printf("0\n");
			continue;
		}
		
		int mm = m + 1;
		int nn = left;
		long long B = getC(nn + mm - 1, mm - 1);
		long long ans = (A * B) % MOD;
		
		printf("%lld\n", ans);
	}
	
	return 0;
}



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

int main(){
    int N,A,B,C,D;
    cin>>N>>A>>B>>C>>D;
    int ans1,ans2;
    if(N%A==0){
        ans1=N/A;
    }else{
        ans1=1+N/A;
    }
    if(N%C==0){
        ans2=N/C;
    }else{
        ans2=1+N/C;
    }
    ans1*=B;
    ans2*=D;
    cout<<min(ans1,ans2)<<endl;
}



Measured memory_bytes: 3104
#include<bits/stdc++.h>
#define F first
#define S second
#define MP make_pair
#define pb push_back
#define endl '\n'

using namespace std;

typedef long long LL;
typedef pair< int, int > P;
typedef pair< LL, LL > LP;
typedef pair< int, P > iP;
typedef pair< P, P > PP;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1000000007;
static const int SIZE = 100005;

int dx[] = {0, -1, 1, 0};
int dy[] = {-1, 0, 0, 1};

map< LL, LL > mp;
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int n;
    cin >> n;
    LL a[n];
    set< LL > st;
    for( int i = 0; i < n; ++i ) {
        cin >> a[i];
        if( i ) a[i] += a[i - 1];
        st.insert( a[i] );
        ++mp[a[i]];
    }

    LL res = 0;
    for( auto itr = st.begin(); itr != st.end(); ++itr ) {
        if( mp[*itr] ) res += mp[*itr] * ( mp[*itr] - 1 ) / 2;

    }

    cout << res + mp[0] << endl;
    return 0;
}



Measured memory_bytes: 23680
S = input()
T = input()
ls = len(S)
lt = len(T)
a = ''
for i in range(ls):
    try:
        s = S[ls-i-lt:ls-i]
        for j in range(lt):
            if not (s[j] == T[j] or s[j] == '?'):
                break
        else:
            a += S[:ls-i-lt].replace('?', 'a') + T + S[ls-i:].replace('?', 'a')
            break
    except:
        pass
print(a if a else 'UNRESTORABLE')

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

int main()
{
  int64_t N;
  cin >> N;
  vector<int64_t> A(N);
  for (int64_t i = 0; i < N; i++)
    cin >> A.at(i);
  sort(A.begin(), A.end());
  int64_t n = A.at(N - 1);
  A.pop_back();
  int64_t mind, r;
  for (int i = 0; i < A.size(); i++)
  {
    if (i == 0)
    {
      mind = abs(2 * A.at(i) - n);
      r = A.at(i);
    }
    else
    {
      int64_t d = abs(2 * A.at(i) - n);
      if (d < mind)
      {
        mind = d;
        r = A.at(i);
      }
    }
  }
  cout << n << ' ' << r << endl;
}


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

int main()
{
	int a,b;
	while (1)
	{
		cin >> a >> b;

		if (a >= -1000 && a <= 1000 && b >= -1000 && b <= 1000)
			break;
	}


	if(a < b)
		cout << "a < b" << endl;
	else if(a > b)
		cout << "a > b" << endl;
	else
		cout << "a == b" << endl;

	return 0;
}

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

int main(int argc, char *argv[])
{
  int X;
  cin >> X;
  int x=abs(X);
  int sum=0;
  if(x==0){
    cout<<0<<"\n";
    return 0;
  }
  for (int i = 0; i < x+1; i++) {
    sum+=i;
    if(sum>=x){
      cout << i <<"\n";
      return 0;
    }
  }
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
  int n;
  scanf("%d",&n);
  int nn,nlength,ans=0,i;
  for(i=1;i<=n;i++){
    nn = i;
    nlength = 0;
    while(nn!=0){
    nn /= 10;
    nlength++;
    }
    if(nlength%2==1)
      ans++;
  }
  printf("%d\n",ans);
  return 0;
}

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

int main() {
    ll N,X,L[100],sum(0),cnt(1);
    cin>>N>>X;
    for (int i(0);i<N;i++) cin>>L[i];
    for (int i(0);i<N;i++) {
      sum+=L[i];
      cnt+=1;
      if(sum>X){
        cout<<cnt-1<<endl;
        return 0;
      }
    }
    cout << N+1 <<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>  
using namespace std;
using ll = long long int;
using pll = pair<long long int,long long int>;
#define rep(i,n) for(int i=0; i<(int)(n); i++)
ll l=1000000007;
string alphabet="abcdefghijklmnopqrstuvwxyz";
using graph = vector<vector<char>>;
double pi=3.14159265358979;

int main() {
  int h,w,k; cin>>h >>w>>k;
  graph v_(h,vector<char>(w));
  int c_=0;
  rep(i,h){
    rep(j,w){
      cin>>v_[i][j];
      if(v_[i][j]=='#'){c_++;}
    }    
  }
  int ans=0;
  rep(i, pow(2,h)){
    rep(j, pow(2,w)){
      int c=c_;
      graph v(h,vector<char>(w));
      v=v_;
      
      bitset<6> bh(i);
      rep(x,h){
        if(bh[x]==1){
          rep(y,w){
            if(v[x][y]=='#'){c--; v[x][y]='.';}
          }                  
        }
      }
      
      bitset<6> bw(j);
      rep(y,w){
        if(bw[y]==1){
          rep(x,h){
            if(v[x][y]=='#'){c--; v[x][y]='.';}
          }                  
        }
      }
      if(c==k){ans++;}
    }   
  }
  cout<<ans<<endl;
}



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

string a;
int main()
{
	cin >> a;
	if (a[0] == a[1] && a[1] == a[2] || a[1] == a[2] && a[2] == a[3]) cout << "Yes";
    else cout << "No";
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(int argc, char const *argv[]) {

    for (int i = 0; i < 50; i++) {
        int m, f, r;
        char grade;
        scanf("%d %d %d", &m, &f, &r);
        if (m == -1 && f == -1 && r == -1) {
            break;
        } else {
            if (m == -1 || f == -1) {
                grade = 'F';
            } else if (m + f >= 80) {
                grade = 'A';
            } else if (65 <= m + f && m + f < 80) {
                grade = 'B';
            } else if (50 <= m + f && m + f < 65) {
                grade = 'C';
            } else if (30 <= m + f && m + f < 50) {
                if (r >= 50) {
                    grade = 'C';
                } else {
                    grade = 'D';
                }
            } else {
                grade = 'F';
            }
            printf("%c\n", grade);
        }

    
    }




    return 0;
}


Measured memory_bytes: 2048
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <string.h>
#include <math.h>
#include <time.h>
#include <stdlib.h>
using namespace std;

int fun(int a,int b){
	if(a>b)return a;
	return b;
}

int main(){
	int W,N,v[1001],w[1001],mat[1001][1001],max,mw;
	for(int c=1;;c++){
		cin >> W;
		if(W==0)break;
		cin >> N;
		for(int i=1;i<=N;i++){
			scanf("%d,%d",&v[i],&w[i]);
		}
max=0;
mw=0;
		for(int i=0;i<=N;i++){
			for(int j=0;j<=W;j++){
				if(i==0) mat[i][j] = 0;
				else{
					if(j<w[i]) mat[i][j] = mat[i-1][j];
					else mat[i][j] = fun(mat[i-1][j],mat[i-1][j-w[i]]+v[i]);
					if(i==N){
						if(max<mat[i][j]){
							max = mat[i][j];
							mw = j;
						}
					}
				}
			}
		}
		printf("Case %d:\n%d\n%d\n",c,max,mw);
	}
	
	return 0;
}


Measured memory_bytes: 7120
N, a, b = map(int, input().split())
total = 0
def FindSum(n):
    sum = 0
    while n > 0:
        sum += n % 10
        n = n //10

    return sum

for i in range(1, N + 1): 
    sum = FindSum(i)
    if a <= sum <= b:
        total += i

print(total)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define e1 first
#define e2 second
#define pb push_back
#define mp make_pair
#define boost ios_base::sync_with_stdio(false)
#define eb emplace_back
#define OUT(x) {cout << x; exit(0); }
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define scanf(...) scanf(__VA_ARGS__)?:0
typedef long long int ll;
typedef unsigned long long ull;
typedef pair <int, int> PII;
typedef pair <ll, ll> PLL;
typedef pair <PLL, int> PLLI;
typedef pair <PLL, PLL> PP;
typedef pair <PII, int> PPI;
typedef pair <ll, int> PLI;
typedef unsigned int ui;
const int inf = 1e9+9;
const ll MOD = 1e9+696969;
const long long INF = 1e18+3;
const int maxn = 1e5 + 100;
int ile[maxn], n;

int main()
{
	int res = 0;
	boost;
	cin >> n;
	FOR(i, 1, n) {
		int a;
		cin >> a;
		ile[a]++;
	}
	
	FOR(i, 1, (int)1e5) res = max(res, ile[i-1] + ile[i] + ile[i+1]);
	cout << res;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define all(x) x.begin(),x.end()
#define rep(i,j,n) for (long long i = j; i < (long long)(n); i++)
#define _GLIBCXX_DEBUG
#define MOD 1000000007
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; }
//name[i][j]-> vvl name(i,vl(j))
//map<int,int>mp
//余りを切り上げる =>  (a + b - 1) / b 

signed main(){
	string s,t; cin>>s>>t;
	reverse(all(t));
	if(s==t){
		cout<<"YES"<<endl;
	}
	else cout<<"NO"<<endl;
	
	return 0;
}

Measured memory_bytes: 3604
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define cmdMax 10
 
typedef struct node *link;
struct node{
    int key;
    link left,right;
};
 
link insert(link head,link z){
    link y=NULL;
    link x=head;
     
    while(x!=NULL){
        y=x;
        if(z->key < x->key)x=x->left;
        else x=x->right;
    }
     
    if(y==NULL)head=z;
    else if(z->key < y->key)y->left=z;
    else y->right=z;
    return head;
}
 
void preorder(link u){
    if(u==NULL)return;
    printf(" %d",u->key);
    preorder(u->left);
    preorder(u->right);
}
 
void inorder(link u){
    if(u==NULL)return;
    inorder(u->left);
    printf(" %d",u->key);
    inorder(u->right);
}
 
int find(link u,int key){
    if(u==NULL)return 0;
    if(u->key==key)return 1;
    if(u->key>key)return find(u->left,key);
    return find(u->right,key);
}
 
int main(void){
    int m,i,key;
    char cmd[cmdMax];
    link head=NULL,z;
    scanf("%d",&m);
    for(i=0;i<m;i++){
        scanf("%s",cmd);
        if(!strcmp(cmd,"insert")){
            scanf("%d",&key);
            z = malloc(sizeof(*z));
            z->key=key;z->left=NULL;z->right=NULL;
            head=insert(head,z);
        }else if(!strcmp(cmd,"print")){
            inorder(head);
            printf("\n");
            preorder(head);
            printf("\n");
        }else if(!strcmp(cmd,"find")){
            scanf("%d",&key);
            if(find(head,key)!=0)printf("yes\n");
            else  printf("no\n");
        }
    }
    return 0;
}



Measured memory_bytes: 14188
import java.io.InputStream;
import java.io.PrintStream;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Scanner;
import java.util.Set;

public class Main {
    public static void main(String[] args) throws Exception {
        solve(System.in, System.out);
    }

    static void solve(InputStream is, PrintStream os) {
        // Your code here!
        Scanner sc = new Scanner(is);
        int N = sc.nextInt();
        long K = sc.nextLong();

        int A[] = new int[N];
        boolean pass[] = new boolean[N];
        int th[] = new int[N];

        for (int i = 0 ; i < N; i++)
            A[i] = sc.nextInt()-1;

        int now = 0;
        int times = 0;

        while(!pass[now]) {
            pass[now] = true;
            th[now] = times++;
            now = A[now];
        }

        if(K < times) {
            now = 0;
            for(int i = 0; i < K; i++) {
                now = A[now];
            }
            os.println(now+1);
            return;
        }

        int interval = times - th[now];

        K = K - th[now];
        long amari = K % interval;

        for(int i = 0; i < amari; i++) {
            now = A[now];
        }

        os.println(now+1);

    }
}

Measured memory_bytes: 52028
#include<bits/stdc++.h>
#define st first
#define nd second

using ll = long long ;
using namespace std;
using pii = pair<int,int>;
const double val = 6.28318530717958623200;
int main(){
	int r;
	scanf("%d", &r);
	printf("%.12f", val * r);


}

Measured memory_bytes: 3828
#pragma GCC optimize ("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse4")
#include"bits/stdc++.h"
using namespace std;
typedef long long ll;
#define int ll
#define all(x) x.begin(), x.end()
#define trav(i,a) for(auto &i:a) 
inline int in(){int x;scanf("%lld",&x);return x;}
int n,m;
int a[101][101];
char c;
int dp[101][101]; //dp[i][j] is cost of reaching i,j
int32_t main()
{
	n=in();m=in();
	for(int i=1;i<=n;i++)
	for(int j=1;j<=m;j++)
	{
		cin>>c;
		if(c=='#')a[i][j]=1;
	}
	
	if(a[1][1])dp[1][1]=1;
	
	for(int j=2;j<=m;j++)dp[1][j]=dp[1][j-1]+(a[1][j-1]==0 and a[1][j]==1);
	for(int i=2;i<=n;i++)dp[i][1]=dp[i-1][1]+(a[i-1][1]==0 and a[i][1]==1);
	
	for(int i=2;i<=n;i++)
	for(int j=2;j<=m;j++)
	{
		int c=0,d=0;
		if(a[i][j]==1)
		{
			if(!a[i-1][j])c=1;
			if(!a[i][j-1])d=1;
		}
		dp[i][j]=min(dp[i-1][j]+c,dp[i][j-1]+d);
	}
	
	cout<<dp[n][m];
	
	
	
	
	
	
}


Measured memory_bytes: 3824
package main

import (
	"fmt"
)

func main() {
	var k int
	fmt.Scanf("%d", &k)
	var s string
	fmt.Scanf("%s", &s)

	if len(s) <= k {
		fmt.Printf("%s", s)
		return
	}

	fmt.Printf("%s...", s[:k])
}


Measured memory_bytes: 1824
#include<iostream>
#include<cstdio>
#include<cstring>
#include <cstdlib>  
#include <math.h>
#include <cmath>
#include<cctype>
#include<string>
#include<set>
#include<iomanip>
#include <map>
#include<algorithm>
#include <functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include<bitset>
#include <deque>
#include <climits>
#include <typeinfo>
#include <utility> 
using namespace std;
using ll = long long;
using R = double;
using Data = pair < ll, vector <ll>>;
template<typename T>using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
const ll MOD = 1e9 + 7;
const ll inf = 1LL << 60;
struct edge { ll from; ll to; ll cost; };
typedef pair<ll, ll>pll;
#define all(x) (x).begin(),(x).end()
#define rep(i,m,n) for(ll i = m;i < n;++i)
#define pb push_back
#define fore(i,a) for(auto &i:a)
#define rrep(i,m,n) for(ll i = m;i >= n;--i)
#define INF INT_MAX/2

class UnionFind {
public:
	vector<int> s, p;

	UnionFind() {}
	UnionFind(int size) {
		s.resize(size, 0);
		p.resize(size, 0);
		rep(i, 0, size)makeSet(i);
	}

	void makeSet(int x) {
		p[x] = x;
		s[x] = 1;
	}

	bool same(int x, int y) {
		return findSet(x) == findSet(y);
	}

	void unite(int x, int y) {
		x = findSet(x);
		y = findSet(y);

		if (x == y)return;

		if (s[x] < s[y])swap(x, y);

		p[y] = x;
		s[x] += s[y];
	}


	int findSet(int x) {
		if (x == p[x]) {
			return x;
		}
		else {
			return p[x] = findSet(p[x]);
		}
	}

	int size(int x) {
		return s[findSet(x)];
	}
};



int main() {
	int N, M;
	cin >> N >> M;
	UnionFind un = UnionFind(N);
	vector<vector<int>>li(M);
	rep(i, 0, N) {
		int K;
		cin >> K;
		rep(j, 0, K) {
			int L;
			cin >> L;
			L--;
			li[L].pb(i);
		}
	}

	rep(i, 0, M) {
		rep(j, 1, li[i].size()) {
			un.unite(li[i][j-1], li[i][j]);
		}
	}

	if (un.size(0) == N)cout << "YES" << endl;
	else cout << "NO" << endl;



	return 0;
}


Measured memory_bytes: 4608
import std.stdio, std.algorithm, std.range, std.conv, std.string, std.math, std.container, std.typecons;
import core.stdc.stdio;
// foreach, foreach_reverse, writeln

void main() {
	int n;
	scanf("%d", &n);
	int[] a = new int[n];
	foreach (i; 0..n) scanf("%d", &a[i]);
	int[int] t;
	t[0] = 0;
	long ans = 0;
	foreach (i; 0..n) {
		int[int] prev;
		swap(prev, t);
		prev[0]++;
		foreach (x; prev.byKey()) {
			if ((x&a[i]) == 0) {
				ans += prev[x];
				int y = x|a[i];
				if (y in t) {
					t[y] += prev[x];
				} else {
					t[y] = prev[x];
				}
			}
		}
		if (!(0 in t)) {
			t[0] = 0;
		}
	}
	writeln(ans);
}

Measured memory_bytes: 4092
#include<stdio.h>

void trace(int A[], int N){
    for(int i = 0; i < N; i++){
        if (i > 0) printf(" ");
        printf("%d", A[i]);
    }
    printf("\n");

}

void insersionSort(int A[], int N){
    for(int i = 1; i < N; i++){
        int v = A[i];
        int j = i - 1;

        while(j >=0 && A[j] > v){
            A[j+1] = A[j];
            j--;
        }
        A[j+1] = v;

        trace(A,N);
    }

}

int main(){
    int A[100];
    int N;

    scanf("%d", &N);
    for(int i = 0; i < N; i++)scanf("%d",&A[i]);

    trace(A, N);
    insersionSort(A,N);

}

Measured memory_bytes: 2756
#include <stdio.h>
#include <ctype.h>
  
int main(void){
  char str[1210];
  int i,alpha[26]={0};
  
  while(gets(str)!=NULL){
    i=0;
    while(str[i]){
      if(isupper(str[i]))  str[i]=tolower(str[i]);
      i++;
    }
    
    i=0;
    while(str[i]){
      if('a'<=str[i] && str[i]<='z')  alpha[(str[i])-'a']++;
      i++;
    }
  }
 
  for(i=0;i<26;i++)  printf("%c : %d\n",'a'+i,alpha[i]);
  
  return 0;
}

Measured memory_bytes: 524
#include <cstdio>
#include <iostream>
#include <cstring>
#include <algorithm> 
#include <cmath>

using namespace std;

int N;
int K;
int D[15];

int main() {
	cin >> N >> K;
	int minD = 9;
	for (int i = 0; i < K; i++) {
		int d;
		cin >> d;
		D[d] = 1;
	}

	for (int i = N; i <= 10 * N; i++) {
		int tmp = i;
		bool good = true;
		while (tmp > 0) {
			int r = tmp % 10;
			if (D[r]) {
				good = false;
				break;
			}
			tmp /= 10;
		}
		if (good) {
			cout << i << endl;
			break;
		}
	}
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <map>

using namespace std;
using llong = long long;
const int MOD=1000000007;


int main(int argc, char**argv){
    int n, c, k;
    cin >> n >> c >> k;
    vector<int> t(n);
    for (int i = 0; i < n; i++){
        cin >> t[i];
    }
    sort(t.begin(), t.end());

    int n_bus = 1;
    int n_riding = 0;
    int first_wait_idx;
    for (int i = 0; i < n; i++){
        if (n_riding == 0){
            first_wait_idx = i;
        }
        // cout << "i:" << i << endl;
        // cout << "n_riding:" << n_riding << endl;
        // cout << "first_wait_idx:" << first_wait_idx << endl;
        // cout << "n_bus:" << n_bus << endl;
        // cout << endl;
        if (n_riding < c && t[first_wait_idx] + k >= t[i]){
            n_riding++;
        }else{
            n_bus++;
            n_riding = 0;
            first_wait_idx = i;
            i--;
        }
    }
    cout << n_bus << endl;

    return 0;
}












Measured memory_bytes: 640
//#include <bits/stdc++.h>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <fstream>
#include <string.h>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <queue>
#include <math.h>
#include <assert.h>
#define ff first
#define ss second
#define ll long long
#define mod 998244353
using namespace std;
long long x;
int main () {
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    cin>>x;
    long long st = 100, ans = 0;
    while(st < x) {
        long long add = st / 100;
        st += add;
        ans++;
    }
    cout<<ans;
}
/*
 2
 1 1
 1 0
 1 1
 1 1
 */


Measured memory_bytes: 3600
s = 'AKIHABARA'
t = raw_input()
n = len(t)
i = 0
j = 0
while i < n and j < len(s): 
	if t[i] == s[j]:
		i += 1
		j += 1
	elif s[j] == 'A':
		j += 1
	else:
		print 'NO'
		exit()
while j < len(s):
	if s[j] == 'A':
		j += 1
	else:
		break
if i == n and j == len(s):
	print 'YES'
else:
	print 'NO'
	



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

typedef long long ll;
typedef unsigned long long int ull;
typedef pair<ll,ll> pii;
typedef tuple<ll,ll,ll> tii;
typedef vector<ll> vi;
typedef vector<pii> vii;
typedef map<ll,ll> mi;
typedef map<pii,ll> mii;


#define endl "\n"
#define pb push_back
#define sq(a) (a)*(a)
#define rep(i,a,b) for(int i = a; i < b; i++)
#define mod 1000000007
#define PI 3.141592653589793238

#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);

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

ll exp(ll x,ll n)
{
    ll result=1;
    while(n>0)
    {
        if(n % 2 ==1)
            result=(result * x)%mod;
        x=(x*x)%mod;
        n=n/2;
    }
    return result;
}



int32_t main()
{
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
    
    IOS

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

    unordered_map<ll,ll> mp;
    ll ans=0;
    for(ll i=0;i<n;i++)
    {
        ans+=mp[i-a[i]];
        mp[i+a[i]]++;
    }

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

Measured memory_bytes: 19992
#include <algorithm>
#include <bitset>
#include <cctype>
#include <chrono>
#include <cmath>
#include <cstdio>
#include <ctime>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <string>
#include <tuple>
#include <unordered_map>
#include <vector>
using namespace std;

#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()

const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
/*----------------------------------------*/

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

  int N, W; cin >> N >> W;
  vector<int> w(N), v(N); REP(i, N) cin >> w[i] >> v[i];
  vector<long long> dp(100001, LINF);
  dp[0] = 0;
  REP(i, N) for (int j = 100000; j >= v[i]; --j) dp[j] = min(dp[j], dp[j-v[i]] + w[i]);
  for (int j = 100000; j >= 0; --j) if (dp[j] <= W) {
    cout << j << '\n';
    return 0;
  }
}


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

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

    int n; cin >> n;
    int c2 = 0;
    int c4 = 0;
    for (int i = 0; i < n; ++i) {
        int a; cin >> a;
        if (a % 4 == 0) ++c4;
        if (a % 2 == 0 && a % 4 != 0) ++c2;
    }

    cout << ((c4 >= n/2 || (c2/2+c4) >= n/2)? "Yes" : "No") << endl;

    return 0;
}

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

string S;

int main(){
  cin >> S;

  if(S == "SUN") cout << 7 << endl;
  else if(S == "MON") cout << 6 << endl;
  else if(S == "TUE") cout << 5 << endl;
  else if(S == "WED") cout << 4 << endl;
  else if(S == "THU") cout << 3 << endl;
  else if(S == "FRI") cout << 2 << endl;
  else if(S == "SAT") cout << 1 << endl;

  return 0;
}

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

#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <algorithm>

#include <bits/stdc++.h>
#include <cmath>
#include <limits>

using namespace std;
typedef long long LL;

long long N;
long long T[1000+2] = {0};
long long A[1000+2] = {0};
long long c[1000+2] = {0};

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

	cin >> N;
	for(int i=1; i<=N; i++){ cin >> T[i] >> A[i]; }

	c[1] = 1;
	for(int i=2; i<=N; i++){
		long long ct = (c[i-1]/T[i]) * T[i-1] ;
		long long ca = (c[i-1]/A[i]) * A[i-1] ;
		while(T[i]*ct < T[i-1]*c[i-1]){ ct++; }
		while(A[i]*ca < A[i-1]*c[i-1]){ ca++; }
		c[i] = max(ct, ca);
	}
	printf("%lld\n", T[N]*c[N] + A[N]*c[N]);
	return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringBuilder sb = new StringBuilder();

		for(;;) {
			String num = br.readLine();
			String[] set = num.split(" ");

			int a = Integer.parseInt(set[0]);
			int b = Integer.parseInt(set[1]);

			if (a==0 && b==0) {
				break;
			}

			for (int i = 0; i < a ; i++) {
				for (int j = 0; j < b ; j++) {
					sb.append("#");
				}
				sb.append("\n");
			}
			sb.append("\n");
		}

		System.out.print(sb);

	}

}

Measured memory_bytes: 25584
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
# define mod 1000000007
# define INF (1 << 29)
# define MAX_N 1000010
/* ちゃんと考えてわかって実装 */

int main(void){
    int a, b, c;
    cin >> a >> b >> c;
    if(a == b && b == c) cout << "No";
    else if(a != b && b != c && c != a) cout << "No";
    else cout << "Yes";
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, s, n) for (int i = (s); i < (int)(n); i++)
#define per(i, n, s) for (int i = (n-1); i >= (int)(s); i--)
#define all(x) (x).begin(),(x).end()
#define debug(x) cout<<#x<<": "<<x<<endl
using namespace std;
using ll = long long;
const ll MOD = 1e9+7;
const ll LINF = LLONG_MAX;
const int INF = INT_MAX;
const double PI=acos(-1);
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){
	int a,b,c,d,k;
	cin>>a>>b>>c>>d>>k;
	cout<<c*60+d-(a*60+b)-k<<endl;
}

Measured memory_bytes: 3636
import sys
sys.setrecursionlimit(10**7) #再帰関数の上限,10**5以上の場合python
import math
from copy import copy, deepcopy
from copy import deepcopy as dcp
from operator import itemgetter
from bisect import bisect_left, bisect, bisect_right#2分探索
#bisect_left(l,x), bisect(l,x)#aはソート済みである必要あり。aの中からx未満の要素数を返す。rightだと以下
from collections import deque
#deque(l), pop(), append(x), popleft(), appendleft(x)
##listでqueの代用をするとO(N)の計算量がかかってしまうので注意
from collections import Counter#文字列を個数カウント辞書に、
#S=Counter(l),S.most_common(x),S.keys(),S.values(),S.items()
from itertools import accumulate,combinations,permutations#累積和
#list(accumulate(l))
from heapq import heapify,heappop,heappush
#heapify(q),heappush(q,a),heappop(q) #q=heapify(q)としないこと、返り値はNone
#import fractions#古いatcoderコンテストの場合GCDなどはここからimportする
from functools import lru_cache#pypyでもうごく
#@lru_cache(maxsize = None)#maxsizeは保存するデータ数の最大値、2**nが最も高効率
from decimal import Decimal

def input(): 
    x=sys.stdin.readline()
    return x[:-1] if x[-1]=="\n" else x
def printl(li): _=print(*li, sep="\n") if li else None
def argsort(s, return_sorted=False): 
    inds=sorted(range(len(s)), key=lambda k: s[k])
    if return_sorted: return inds, [s[i] for i in inds]
    return inds
def alp2num(c,cap=False): return ord(c)-97 if not cap else ord(c)-65
def num2alp(i,cap=False): return chr(i+97) if not cap else chr(i+65)
def matmat(A,B):
    K,N,M=len(B),len(A),len(B[0])
    return [[sum([(A[i][k]*B[k][j]) for k in range(K)]) for j in range(M)] for i in range(N)]
def matvec(M,v):
    N,size=len(v),len(M)
    return [sum([M[i][j]*v[j] for j in range(N)]) for i in range(size)]
def T(M):
    n,m=len(M),len(M[0])
    return [[M[j][i] for j in range(n)] for i in range(m)]
def main():
    mod = 1000000007
    #w.sort(key=itemgetter(1),reversed=True)  #二個目の要素で降順並び替え

    s = input()
    K= int(input())
    #N, K = map(int, input().split())
    #A = tuple(map(int, input().split())) #1行ベクトル
    #L = tuple(int(input()) for i in range(N)) #改行ベクトル
    #S = tuple(tuple(map(int, input().split())) for i in range(N)) #改行行列
    keta=len(s)
    dp=[[[0,0] for _ in range(keta+1)] for _ in range(keta+1)]
    #dp[i][j][k]前からi桁目まで決め、j個の条件を満たす桁を含み、k=1:i文字目まで一致 k=0:対象の数以下

    dp[0][0][0]=1
    for i in range(0,keta):
        ni=i+1
        nd=int(s[i])
        for j in range(0,keta):
            for k in range(0,2):  
                for d in range(10): 
                    nj=j
                    nk=k
                    if d!=0:nj+=1
                    if k==0:
                        if d>nd:break
                        elif d<nd:nk=1
                    dp[ni][nj][nk]+=dp[i][j][k]
    if K<=keta:
        ans=dp[keta][K][1]+dp[keta][K][0]
    else:
        ans=0
        #与えられた数未満で条件を満たすもの+与えられた数が条件を満たす場合1
    print(ans)
    #print(dp)


    
    

        
    



if __name__ == "__main__":
    main()

Measured memory_bytes: 64108
#include <bits/stdc++.h>
#define ll long long
#define pq priority_queue
using namespace std;
const ll INF=(ll)1e9;
const ll MOD=(ll)1e9+7;
vector<int> dx={1,0,-1,0},dy={0,1,0,-1};
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; }

ll N,W;
vector<ll> w(110),v(110);
vector<vector<ll>> dp(110,vector<ll> (100100,INF+1000));

int main(){
    ll ans=0;
    cin>>N>>W;
    for(ll i=0;i<N;i++) cin>>w[i]>>v[i];
    dp[0][0]=0;
    for(ll i=0;i<N;i++){
        for(ll j=0;j<=100100;j++){
           if(j-v[i]>=0) chmin(dp[i+1][j],dp[i][j-v[i]]+w[i]);
            chmin(dp[i+1][j],dp[i][j]);
        }
    }
    for(ll i=0;i<100100;i++){
        if(dp[N][i]<=W) ans=i;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 87296
#include <bits/stdc++.h>
using namespace std;
vector<string>v(200005);
map<string,int>mp;
set<string> st;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    cin>>n;
    for(int i=0;i<n;i++){
            cin>>v[i];
             mp[v[i]]++;
             st.insert(v[i]);

              }
              int maxe=0;
              for(int i=0;i<n;i++){
                maxe=max(mp[v[i]],maxe);
              }
                set<string>:: iterator it1=st.begin();
              for(;it1!=st.end();*it1++){
                if(mp[*it1]==maxe){
                    cout<<*it1<<endl;
                }
              }





    return 0;
}


Measured memory_bytes: 34816
import sys


def main():
    s = list(input())
    set_s = set(s)
    if len(set_s) != 2:
        print("No")
        sys.exit(0)
    for x in set_s:
        if s.count(x) != 2:
            print("No")
            sys.exit(0)
    print("Yes")


if __name__ == "__main__":
    main()


Measured memory_bytes: 2940
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <cmath>
#include <iomanip>
#include <ctype.h>

using namespace std;
using ll = long long;

#define rep(i,N) for(int i=0;i<(int)N;++i)

ll GCD(ll x, ll y) {
    if (y == 0) return x;
    else return GCD(y, x % y);
}

bool my_compare(pair<string, int> a, pair<string, int> b) {
    if (a.first != b.first) {
        return a.first < b.first;
    }

    if (a.second != b.second) {
        return a.second > b.second;
    }
    else {
        return true;
    }
}

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

    vector<string> S(N);
    vector<int> P(N);

    rep(i, N) cin >> S[i] >> P[i];

    map<string, map<int, int> > J;

    rep(i, N) J[S[i]][P[i]] = i+1;

    vector<pair<string, int> > pairs(N);

    rep(i, N) pairs[i] = make_pair(S[i], P[i]);

    sort(pairs.begin(), pairs.end(), my_compare);

    rep(i, N) cout << J[pairs[i].first][pairs[i].second] << endl;

}

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

		static void solve() {
			Scanner sc = new Scanner (System.in);
			int n = sc.nextInt();
			double sum = 0;
			double array[] = new double[n];
			for(int i = 0;i<n;i++) {
				array[i] = sc.nextDouble();
				String u = sc.next();
				if(u.equals("BTC"))
					array[i]*=380000.0;
			}
			for(int i = 0;i<n;i++) {
				sum+=array[i];
			}
			System.out.println(sum);
			sc.close();
		}
	public static void main(String[] args) {
		solve();

	}

}


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

int main(void)
{
    ios_base::sync_with_stdio(0);   cin.tie(0);
    int n;
    cin >> n;
    int b[105];
    b[0] = b[n] = 1e9 + 7;
    for(int i = 1; i < n; ++i)  cin >> b[i];
    int ans = 0;
    for(int i = 1; i <= n; ++i) ans += min(b[i - 1], b[i]);
    cout << ans;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>

using namespace std;

const int N = 1e5 + 99;
const int INF = 0x3F3F3F3F;

int a[N];

int main() {
    int n;
    cin >> n;
    for (int i = 1; i <= n; ++i) cin >> a[i];
    int ans = 0, cnt = 0, pre = INF;
    for (int i = n; i >= 1; --i) {
        if (a[i] >= pre) {
            ans = max(ans, ++cnt);
        } else {
            cnt = 0;
        }
        pre = a[i];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 640
package main

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

const (
	initialBufSize = 100000
	maxBufSize     = 1000000
)

var sc *bufio.Scanner

func initScanner(r io.Reader) *bufio.Scanner {
	buf := make([]byte, initialBufSize)

	sc := bufio.NewScanner(r)
	sc.Buffer(buf, maxBufSize)
	sc.Split(bufio.ScanWords) // bufio.ScanLines
	return sc
}

func main() {
	sc = initScanner(os.Stdin)
	fmt.Println(resolve(parseProblem()))
}

func parseProblem() int {
	return scanInt(sc)
}

func resolve(n int) int {
	total := 0
	for j := 1; j <= n; j++ {
		total += multipleTotal(j, n)
	}
	return total
}

func multipleTotal(j, n int) int {
	q := n / j
	return (q*j + j) * q >> 1
}

// snip-scan-funcs
func scanInt(sc *bufio.Scanner) int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return int(i)
}
func scanString(sc *bufio.Scanner) string {
	sc.Scan()
	return sc.Text()
}


Measured memory_bytes: 1796
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        if (S.equals("hi") || S.equals("hihi") || S.equals("hihihi") || S.equals("hihihihi") || S.equals("hihihihihi")) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}

Measured memory_bytes: 23764
fun main(args : Array<String>) {
    val N = readLine()!!.toInt()
    val A = readLine()!!.split(" ").map { it.toInt() }
    val B = readLine()!!.split(" ").map { it.toInt() }
    val C = readLine()!!.split(" ").map { it.toInt() }

    var pre = -100
    var sum = 0
    A.forEach {
        val a = it - 1
        sum += B[a]
        if (a == pre + 1) {
           sum += C[pre]
        }
        pre = a
    }
    println(sum)
}

Measured memory_bytes: 36116
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  
  if (a + b > c + d){
    cout << "Left" << endl;
  }if (a + b == c + d){
      cout << "Balanced" << endl;
    }if (a + b < c + d){
         cout << "Right" << endl;
  }
}


Measured memory_bytes: 3628
N=int(input())
for i in range(N):

    a,b,c=map(int,input().split())
    
    if (a**2==b**2+c**2) or (b**2==a**2+c**2) or (c**2==a**2+b**2):
        print("YES")
    else:
        print("NO")


Measured memory_bytes: 5600
d = list(input())
d.sort()

l = list("abcdefghijklmnopqrstuvwxyz")
l.remove(d[0])
for i in range(len(d)-1):
    if d[i+1] != d[i]:
        l.remove(d[i+1])
if len(l) == 0:
    print("None")
else:
    print(l[0])


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

int main() {
	int n;
	cin >> n;
	int F[50];
	F[0] = F[1] = 1;
	for (int i = 2; i <= n; i++)F[i] = F[i - 1] + F[i - 2];

	cout << F[n] << endl;

	return 0;
}

Measured memory_bytes: 3068
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

#define rep(i, n) for (int i = 0; i < (n); ++i)

using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;

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

  string s = "";
  while (true)
  {
    N--;
    char c = 'a' + (N % 26);
    s += c;
    if (N < 26)
      break;
    N /= 26;
  }

  std::reverse(s.begin(), s.end());

  cout << s << endl;

  return 0;
}


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

typedef long long ll;
typedef pair<int,int> P;

int dp[1145][1145];

int main(){
        string s1,s2;
        cin>>s1>>s2;
        int n=s1.size(),m=s2.size();
        for(int i=0;i<=n;i++){
                for(int j=0;j<=m;j++){
                        dp[i][j]=1e9;
                }
        }
        for(int i=0;i<=n;i++)dp[i][0]=i;
        for(int j=0;j<=m;j++)dp[0][j]=j;
        for(int i=1;i<=n;i++){
                for(int j=1;j<=m;j++){
                        dp[i][j]=min(dp[i][j],dp[i-1][j]+1);
                        dp[i][j]=min(dp[i][j],dp[i][j-1]+1);
                        dp[i][j]=min(dp[i][j],dp[i-1][j-1]+(s1[i-1]!=s2[j-1]));
                }
        }
        cout<<dp[n][m]<<endl;
        return 0;
}



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

using namespace std;

long long arr[100];

int main() {
	long long n;
	scanf("%lld", &n);
	arr[0] = 2;
	arr[1] = 1;
	for (int i = 2; i <= n; i++)
		arr[i] = arr[i - 1] + arr[i - 2];
	printf("%lld\n", arr[n]);
	return 0;
} 

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <algorithm>
#include <utility>
#include <vector>
#include <string>
#include <unordered_map>

using namespace std;

unordered_map<string, bool> check;

int main()
{
    int n;
    cin >> n;
    for (int i = 0; i < n; i++) {
        string str;
        cin >> str;
        check[str] = true;
    }
    int m;
    cin >> m;
    bool closed = true;
    for (int i = 0; i < m; i++) {
        string str;
        cin >> str;
        if (check.find(str) == check.end()) {
            cout << "Unknown " << str << endl;
        } else {
            if (not closed) {
                cout << "Closed by " << str << endl;
                closed = true;
            } else {
                cout << "Opened by " << str << endl;
                closed = false;
            }
        }
    }
    return 0;
}

Measured memory_bytes: 3232
#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <vector>
#include <assert.h>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <math.h>
#include <string>
#include <string.h>
#include <queue>
#include <complex>
#include <iomanip>
#include <stack>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
ll mod=998244353;
double eps=1e-7;
ll exp(ll x,ll y){if(y<0) return 0; ll ret=1;for(;y;y>>=1,x=(x*x)%mod){if(y&1)ret=(ret*x)%mod;}return ret;}
ull pexp(ull x,ull y){if(y<0) return 0; ull ret=1; for(;y;y>>=1,x=(x*x)){if(y&1)ret=(ret*x);}return ret;}
ll gcd(ll x,ll y){if(!x||!y) return x+y; return x%y==0?y:gcd(y,x%y);}
ll lcm(ll x,ll y){return x*(y/gcd(x,y));}
ll bsum(ll u,ll b){ll ret=0;if(u<b)return u;while(u){ret+=u%b;u/=b;}return ret;}
ll prival(ll u,ll p){ll cn=0;while(u%p==0){cn++;u=u/p;}return cn;}
ll minv(ll a,ll b){return 1<a?b-minv(b%a,a)*b/a:1;}
ll extm(ll a,ll b){ll ret=0;while(a!=0){if(a%2==1){ret+=b;ret%=mod;}a>>=1;b=(2LL*b)%mod;}return ret;}   
ll eaphi(ll x){ll t=x,ret=x,i;for(i=2;i*i<=x;i++){if(t%i==0){ret-=ret/i;while(t%i==0) t/=i;}}if(t!=1) ret-=ret/t;return ret;}
ll eadivc(ll x){ll ret=0;ll i;for(i=1;i*i<=x;i++){if(x%i==0 && i*i!=x) ret+=2;if(x%i==0 && i*i==x) ret+=1;}return ret;}
ll eadivs(ll x){ll ret=0;ll i;for(i=1;i*i<=x;i++){if(x%i==0 && i*i!=x) ret+=i+x/i;if(x%i==0 && i*i==x) ret+=i;}return ret;}
ll ndig(ll x, ll b){ll ret=0;while(x){x/=b; ret++;}return ret;}
ll rev(ll n, ll b){ll ret=0;while(n){ret=b*ret+n%b; n/=b;}return ret;}
ll sq(ll x){ll t=(ll)sqrt(x); for(ll i=t-2 ; i<=t+2 ; i++) if(i*i==x) return abs(i); return -1;}
ll extexp(ll x,ll y){if(y<0) return 0; ll ret=1;for(;y;y>>=1,x=extm(x,x)){if(y&1)ret=extm(ret,x);}return ret;}
bool isprime(ll x){if(x<=1) return false; for(ll i=2;i*i<=x;i++){if(x%i==0){return false;}}return true;}
ll n;

int main(void)
{
	cin>>n;
	cout<<n*(n+1)/2;
	return 0;
}

// 제출하기 전에 생각햇나요?
// it may be easier/harder than you think
// ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        int K = sc.nextInt();
        
        Set<String> SS = new TreeSet<>();
        
        for( int i = 0; i < S.length(); i++ ) {
            for( int j = 1; j <= K; j++ ) {
                if( i + j > S.length() ) {
                    continue;
                }
                SS.add( S.substring(i, i+j) );
            }
        }
        
        Iterator<String> it = SS.iterator();
        int index = 0;
        String ans = null;
        while (it.hasNext()) {
            String x = it.next();
            if( ++index == K){
                ans = x;
            }
        }
        
        System.out.println( ans );
    }
}


Measured memory_bytes: 39808
#include <iostream>
#include <string>
using namespace std;
string s;

int main(){
    cin>>s;
    int ans=s.size();
    for(int i=0;i<s.size()-1;i++){
        if(s[i]==s[i+1]){
            ans--;
            i+=2;
        }
    }
    cout<<ans;
}

Measured memory_bytes: 640
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

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

        String s = sc.next();
        int K = sc.nextInt();

        System.out.println(solve(s, K));

        sc.close();
    }

    static String solve(String s, int K) {
        List<String> candidates = new ArrayList<>();
        for (int beginIndex = 0; beginIndex < s.length(); ++beginIndex) {
            for (int endIndex = beginIndex; endIndex < s.length() && endIndex - beginIndex + 1 <= K; ++endIndex) {
                candidates.add(s.substring(beginIndex, endIndex + 1));
            }
        }

        return candidates.stream().distinct().sorted().skip(K - 1).findFirst().get();
    }
}

Measured memory_bytes: 29936
def div(n):
    i = 2
    a = n
    D = {}
    tmp = 1
    while i*i <= n:
        cnt = 0
        while a%i == 0:
            a = a // i
            tmp *= i
            cnt += 1
        if cnt > 0:
            D[i] = cnt
        i += 1
    if tmp != n:
        D[n] = 1
    return D

N = int(input())
D = div(N)
ans = 0
for v in D.values():
    i = 1
    total = 1
    while v >= total+(i+1):
        i += 1
        total += i
    ans += i

print(ans)

Measured memory_bytes: 9128
#include <iostream>
 #include <algorithm>
 #include <cstring>
 #include <cstdio>
#include <vector>
#include <cstdlib>
#include <iomanip>
 #include <cmath>
 #include <ctime>
 #include <map>
 #include <set>
 #include <queue>
 using namespace std;
 #define lowbit(x) (x&(-x))
 #define max(x,y) (x>y?x:y)
 #define min(x,y) (x<y?x:y)
#define MAX 100000000000000000
 #define MOD 1000000007
#define pi acos(-1.0)
#define ei exp(1)
 #define PI 3.141592653589793238462
 #define INF 0x3f3f3f3f3f
 #define mem(a) (memset(a,0,sizeof(a)))
 typedef long long ll;
 ll gcd(ll a,ll b){
    return b?gcd(b,a%b):a;
}
bool cmp(int x,int y)
 {
   return x>y;
 }
 const int N=10005;
const int mod=1e9+7;
int main()
{
   std::ios::sync_with_stdio(false);
   int n,l;
 cin>>n>>l;
     string a;
    priority_queue<string,vector<string>,greater<string> >q;
     for(int i=0;i<n;i++){
       cin>>a;
       q.push(a);
    }
     while(q.size()>0){
       string b=q.top();
     cout<<b;
      q.pop();
   }
    cout<<endl;
   return 0;
 }

Measured memory_bytes: 256