akhauriyash/Code-Regression huggingface dataset:
import sys
s = input()
K = int(input())
     
# sort_s = sorted(list(s))
temp = set()
# temp = []
for i in range(len(s)):
    for j in range(i+1,i+K+1):
        # if i >j:
        # print("{},{}".format(i,j))
        temp.add(s[i:j])
        # if i+j <= len(s):
            # temp.append(s[i:i+j])
ans = sorted(temp)
print(ans[K-1])

Measured memory_bytes: 4464
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=1;i<=n;i++)
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size())
# define pb push_back
using namespace std;

int main(){
    int s,d[100000];
    cin>>s;
    d[s]++;
    vector<int> a(100000);
    a[0] = s;
    rrep(i,100000){
        if(a[i-1]%2==0) a[i]=a[i-1]/2;
        else a[i]=3*a[i-1]+1;
        d[a[i]]++;
        if(d[a[i]]>=2){
            cout<<i+1<<endl;
            break;
        }
    }
    
    return 0;
}

Measured memory_bytes: 640
import java.util.Iterator;
import java.util.PrimitiveIterator;
import java.util.Scanner;
import java.util.function.Supplier;
import java.util.stream.IntStream;
import java.util.stream.Stream;

public class Main{
	static Scanner s=new Scanner(System.in);

	void solve(){
		int n=gInt(),k=gInt();
		
		long v=0,w=countinmodi(n,0,k);
		if(k%2==0) {
			v=countinmodi(n,k/2,k);
		}
		System.err.println(v+" "+w);
		System.out.println(v*v*v+w*w*w);
	}
	long countinmodi(int n,int i,int m) {
		return (n+i)/m;
	}

	public static void main(String[] A){
		new Main().solve();
	}

	static int gInt(){
		return Integer.parseInt(s.next());
	}
	static long gLong(){
		return Long.parseLong(s.next());
	}
	static double gDouble(){
		return Double.parseDouble(s.next());
	}

	SupplyingIterator<Integer> ints(int n){
		return new SupplyingIterator<>(n,Main::gInt);
	}
	SupplyingIterator<Long> longs(int n){
		return new SupplyingIterator<>(n,Main::gLong);
	}
	SupplyingIterator<Double> doubles(int n){
		return new SupplyingIterator<>(n,Main::gDouble);
	}
	SupplyingIterator<String> strs(int n){
		return new SupplyingIterator<>(n,s::next);
	}

	Range rep(int i){
		return new Range(i);
	}
	Range rep(int f,int t,int d){
		return new Range(f,t,d);
	}
	Range rep(int f,int t){
		return rep(f,t,1);
	}
	Range rrep(int f,int t){
		return rep(t,f,-1);
	}

	IntStream REP(int n){
		return REP(0,n-1);
	}
	IntStream REP(int l,int r){
		return IntStream.rangeClosed(l,r);
	}

	IntStream INTS(int n){
		return IntStream.generate(Main::gInt).limit(n);
	}
	Stream<String> STRS(int n){
		return Stream.generate(s::next).limit(n);
	}

}
class SupplyingIterator<T> implements Iterable<T>,Iterator<T>{
	int t;
	Supplier<T> supplier;

	SupplyingIterator(int t,Supplier<T> supplier){
		this.t=t;
		this.supplier=supplier;
	}

	@Override
	public Iterator<T> iterator(){
		return this;
	}

	@Override
	public boolean hasNext(){
		return t>0;
	}

	@Override
	public T next(){
		--t;
		return supplier.get();
	}
}

class Range implements Iterable<Integer>,PrimitiveIterator.OfInt{
	int to,cur,d;

	Range(int from,int to,int d){
		this.cur=from-d;
		this.to=to;
		this.d=d;
	}

	Range(int n){
		this(0,n-1,1);
	}

	@Override
	public Iterator<Integer> iterator(){
		return this;
	}

	@Override
	public boolean hasNext(){
		return cur+d==to||(cur!=to&&(cur<to==cur+d<to));
	}

	@Override
	public int nextInt(){
		return cur+=d;
	}
}


Measured memory_bytes: 23764
#include<bits/stdc++.h>
using namespace std;
int main(void){
  int n;
  cin>>n;
  int a[n];
  for(int i=1;i<=n;i++){
    cin>>a[i];
  }
  int ans=0;
  for(int i=1;i<=n;i++){
    if(a[i]==i){
      swap(a[i+1],a[i]);
      ans++;
    }
  }
  cout<<ans<<endl;
  return 0;
}

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

int main(){
  int n; string s; cin >> n >> s;
  int count=0; int ans=0;
  rep(i,1000){
    int k3=i%10;
    int k2=(i%100-k3)/10;
    int k1=(i-(k2*10)-k3)/100;
    rep(j,n){
      if(count==0 && s[j]==k1+'0') count++;
      else if(count==1 && s[j]==k2+'0') count++;
      else if(count==2 && s[j]==k3+'0') count++;
    }
    if(count==3) ans++;
    count=0;
  }
  cout << ans << endl;
 return 0;
}


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

#define debug(x) (cerr << #x << " = " << x << endl;)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define FOR(it, b, e) for (typeof(b) it = (b); it != (e); ++it)
#define MSET(c, v) memset(c, v, sizeof(c))

const int INF = 0x3F3F3F3F; 
const int NEGINF = 0xC0C0C0C0;
const int NULO = -1;
const ll mod = 1e9 + 7;
const double EPS = 1e-10;

inline int cmp(double x, double y = 0) 
{  
  if(fabs(x - y) < EPS)
    return 0;
  return x > y ? 1 : -1;
}

const int maxn = 2e5 + 100;

ll qt[maxn];

int a[maxn];

ll C2(ll n)
{
  return (n*(n-1)) / 2;
}

int main()
{
  ios::sync_with_stdio(0);
  int n;

  cin >> n;

  for(int i = 1; i <= n; i++)
  {
    cin >> a[i];
    qt[a[i]]++;
  }

  ll tot = 0;

  for(int i = 1; i <= n; i++)
  {
    tot += C2(qt[i]);
  }

  for(int i = 1; i <= n; i++)
  {
    ll ans =  tot - C2(qt[a[i]]);
    ans += C2(qt[a[i]] - 1);
    cout << ans << endl;
  }

  return 0;
}

Measured memory_bytes: 3968
N = int(input())
nums = str(input()).split(' ')
nums = sorted([int(n) for n in nums])

a = nums[len(nums) // 2 - 1]
b = nums[len(nums) // 2]

aida = b - a
cnt = 0
for i in range(aida + 1):
    if a < a + i and a + i <= b:
        cnt += 1

print(cnt)


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

int main(){
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  if (a+b > c+d){
    cout << "Left" << endl;
  }else if (a+b < c+d){
    cout << "Right" << endl;
  }else{
    cout << "Balanced" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stdio.h>
#include <string>
#include <vector>
using namespace std;
#define int long long
int MOD = 1000000007;
signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  vector<int> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  vector<int> B(N);
  for (int i = 0; i < N; i++) {
    cin >> B[i];
  }
  vector<int> C(N);
  for (int i = 0; i < N - 1; i++) {
    cin >> C[i];
  }
  //cout << B[3] << endl;
  int sum = 0;
  int tmp = 0;
  for (int i = 0; i < N; i++) {
    int j = A[i] - 1;
    sum += B[j];
    if (i != 0 && tmp == j - 1) {
      sum += C[tmp];
    }
    tmp = j;
    //cout << sum << endl;
  }

  cout << sum << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <iomanip>
#include <queue>
#include <algorithm>
#include <functional>
#include <vector>
#include <math.h>
#include <numeric>
#include <stack>
#include <map>
using namespace std;

int A,B;

int main(){
    cin >> A >> B;
    int ans = A+B;
    ans = max(ans, A-B);
    ans = max(ans, A*B);
    cout << ans << endl;
}


Measured memory_bytes: 888
#include<queue>
#include<cstdio>
#include<algorithm>

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

using namespace std;

typedef long long ll;

int main(){
	int n; scanf("%d",&n);
	static vector<int> G[1000000],G_rev[1000000];
	static int cost[1000000];
	rep(u,n){
		int v; scanf("%d%d",cost+u,&v);
		if(v!=-1){
			G[v].push_back(u);
			G_rev[u].push_back(v);
		}
	}

	vector<int> topo; // topological order
	queue<int> Q;
	rep(u,n) if(G_rev[u].empty()) {
		Q.push(u);
		while(!Q.empty()){
			int v=Q.front(); Q.pop();
			topo.push_back(v);
			rep(i,G[v].size()) Q.push(G[v][i]);
		}
	}

	ll ans=0;
	for(int i=(int)topo.size()-1;i>=0;i--){
		int u=topo[i];

		vector<int> C(G[u].size()); // 頂点 u の子たちの cost
		rep(j,G[u].size()) C[j]=cost[G[u][j]];
		sort(C.begin(),C.end());

		ll sum=0;
		rep(j,C.size()){
			ans+=sum;
			sum+=C[j];
		}
		cost[u]+=sum;
	}

	printf("%lld\n",ans);

	return 0;
}

Measured memory_bytes: 119600
#include<iostream>
using namespace std;
int main(){
	int *a=new int[1000000001]; 
	int n;
	cin>>n;
	while(n--){
		int x;
		cin>>x;
		a[x]=1;
	}
	int cnt=0;
	cin>>n;
	while(n--){
		int x;
		cin>>x;
		if(a[x])
			cnt++;
			
	}
	cout<<cnt<<endl;
	delete[]a;
	return 0;
}


Measured memory_bytes: 6784
#include "math.h"
#include <algorithm>
#include <set>
#include <complex>
#include <stack>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <string>
#include <vector>
#include <random>
#define rep(i, n) for (lli i = 0; i < (n); i++)
#define rrep(i, n) for (lli i = (n)-1; i >= 0; i--)
using namespace std;
typedef long long int lli;
int main()
{
    lli n, t;
    cin >> n >> t;
    lli x[200005];
    rep(i, n) cin >> x[i];
    lli cur = t + x[0];
    lli ans = t;
    rep(i, n)
    {
        if (cur >= x[i]) {
            ans += x[i] + t - cur;
            cur = x[i] + t;
        } else if (cur < x[i]) {
            cur = x[i] + t;
            ans += t;
        }
    }
    cout << ans << endl;
}


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

namespace B
{
    public class Program
    {
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            Solve();
            Console.Out.Flush();
        }

        public static void Solve()
        {
            var S = Console.ReadLine();
            for (var i = S.Length - 1; i > 0; i--)
            {
                if (i % 2 == 1) continue;
                var t = S.Substring(0, i);
                var ok = true;
                for (var j = 0; j < i / 2; j++)
                {
                    if (t[j] != t[i / 2 + j]) ok = false;
                }
                if (ok)
                {
                    Console.WriteLine(i);
                    return;
                }
            }
            Console.WriteLine(0);
        }
    }
}


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

int gcd(int a,int b){ 
 int r;
 r = a % b;
 if(!r){
  return b;
 }else{
  return gcd(b, r);
 }
}

int lcm(int x1, int x2){
 return x1 * x2 / gcd(x1, x2);
}

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

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

int main(void){
    long long int n, k, i, j, min, ans=0, leng=0, po=0;
    scanf("%lld", &n);
    for(i=1; i<10; i++){
        if(n%i==0 && n/i <10) po++;
    }
    if(po>0) printf("Yes");
    else printf("No");
    
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define pb push_back
#define all(x) (x).begin(),(x).end()
using namespace  std ;
typedef long l ;
typedef long long ll ;
typedef vector<int>vi ;
typedef vector<l>vl ;
typedef vector<ll>vll ;
typedef vector<vector<ll> >vvl ;
typedef pair<int,int> pii ;
typedef pair<ll,ll> pll ;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    std::cout.unsetf ( std::ios::floatfield );//this and next line for floating precision upto 6
    std::cout.precision(10);
    ll a,b,c,d,e,x,i,j,n,t,m,k,y;
    double p,q,r,w,u ;
    string str = "",str1 = "" ;
    ll a1,a2,b1,b2 ;
    cin>>a>>b ;
    a-- ;
    c = 0 ;
    if(a%2==0)
    {
    	c ^= a ;
	}
	if(((a+1)/2)%2!=0)
	{
		c ^= 1 ;
	}
	if(b%2==0)
	{
		c^=b ;
	}
	if(((b+1)/2)%2!=0)
	{
		c^=1 ;
	}
    cout<<c ;
}

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

int main(int argc, char const *argv[]) {
  int a,b,max=-10000;

  scanf("%d %d", &a, &b);

  if (a+b > max) {
    max = a+b;
  }
  if (a-b > max) {
    max = a-b;
  }
  if (a*b > max) {
    max = a*b;
  }

  printf("%d\n", max);
  return 0;
}


Measured memory_bytes: 128
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<utility>
#include<vector>
using namespace std;

typedef long long lint;

int main(){
    int n;
    cin >> n;
    vector< vector<int> > tree(n);
    for(int i = 0 ; i < n - 1 ; i++){
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        tree[a].push_back(b);
        tree[b].push_back(a);
    }
    vector<int> f(n, 0), s(n, 0);
    queue<int> bfs;
    bfs.push(0);
    while(!bfs.empty()){
        int tmp = bfs.front();
        bfs.pop();
        for(int i = 0 ; i < tree[tmp].size() ; i++){
            if(tree[tmp][i] != 0 && f[tree[tmp][i]] == 0){
                bfs.push(tree[tmp][i]);
                f[tree[tmp][i]] = f[tmp] + 1;
            }
        }
    }
    bfs.push(n - 1);
    while(!bfs.empty()){
        int tmp = bfs.front();
        bfs.pop();
        for(int i = 0 ; i < tree[tmp].size() ; i++){
            if(tree[tmp][i] != n - 1 && s[tree[tmp][i]] == 0){
                bfs.push(tree[tmp][i]);
                s[tree[tmp][i]] = s[tmp] + 1;
            }
        }
    }
    int fennec = 0, snuke = 0;
    for(int i = 0 ; i < n ; i++){
        if(f[i] <= s[i]){
            fennec++;
        }else{
            snuke++;
        }
    }
    if(fennec > snuke){
        cout << "Fennec" << endl;
    }else{
        cout << "Snuke" << endl;
    }
    return 0;
}

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

int main()
{
    char s[100];
    cin >> s;
    if(s[0]=='S')
        cout <<"Cloudy"<<endl;
    else if(s[0]=='C')
        cout << "Rainy"<<endl;
    else
        cout << "Sunny"<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <unordered_map>
#define int long long int
#define double long double
#define endl "\n"
#define PI 3.141592653589793238462643383279502884
#define sp(x)   setprecision(x)
#define ceil(a,b)   (a+(b-1))/b
#define LCM(a,b)    (a*b)/__gcd(a,b)
#define all(v)  v.begin(),v.end()
#define alls(s,v)  s.begin(),s.end(),v
#define gena(arr,n,nxt)  generate(arr,arr+n, nxt)
#define genv(v,nxt)  generate(v.begin(),v.end(), nxt)
#define base ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
#define exit return 0;
using namespace std;
const int N=1000000;
bool prime[N];
void sieve(){memset(prime, true, sizeof(prime));for (int p=2; p*p<100000000; p++)
{if (prime[p] == true){for (int i=p*p; i<100000; i += p)prime[i] = false;}}}
int power(int x, int y){int res = 1;while (y > 0){if (y & 1)res = res * x;y = y >> 1;x = x*x;}return res;}
int nxt(){int x;cin >> x;return x;}
int findTileCount(int x, int y, int l, int r) {
    int lcm = (x * y) / __gcd(x, y);
    int countl = (l - 1) / lcm;
    int countr = r / lcm;
    return countr - countl;
}
int32_t main(){
    base
    char a,b,c;
    cin>>a>>b>>c;
    string s;
    s+=a;
    s+=b;
    s+=c;
    sort(all(s));
    string asly="557";
    cout<<(s==asly?"YES":"NO");
    exit
}



Measured memory_bytes: 256
#include<stdio.h>

int main(){

  int a[100],num,i,j,minj,swap,count=0;

  scanf("%d",&num);
  for(i = 0; i < num; i++){
    scanf("%d",&a[i]);
  }

  for(i = 0; i < num; i++){
    minj = i;
    for(j = i+1; j < num; j++){
      if(a[j] < a[minj]){
	  minj = j;

      }
    }

      swap =a[i];
      a[i] = a[minj];
      a[minj] = swap;
      if(i != minj){
      count++;
      }
  }

  for(i = 0; i < num-1; i++){
    printf("%d ",a[i]);
  }
  printf("%d\n",a[i]);
  printf("%d\n",count);
  return 0;
}

Measured memory_bytes: 600
#include<iostream>
#include<stdio.h>
using namespace std;
int main()
{
    int a,b,c,k;
    cin>>a>>b>>c>>k;
    int sum=0;
    if(k<=a)
        cout<<k<<endl;
    else
    {
        sum=k-a;
        if(sum<=b)
            cout<<a<<endl;
        else
            cout<<a-(k-a-b)<<endl;
    }
    return 0;
}


Measured memory_bytes: 3552
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <cstring>
#include <math.h>
#include <bitset>
#include <queue>
#include <set>
#include <iomanip>
#include <math.h>
#include <assert.h>
// #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr long long int INFLL = 1001001001001001LL;
constexpr int INF = 1000000007;
const int mod = 1000000007;

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

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

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

//----------------------------------------------------------------

int main()
{
    ll n;
    cin >> n;
    map<ll, ll> rensou;
    ll a;
    ll ans = -INFLL;
    ll tmp;
    for (int i = 0; i < n; i++)
    {
        cin >> a;
        rensou[a]++;
    }
    for (int i = 0; i < 100000 - 2; i++)
    {
        tmp = rensou[i] + rensou[i + 1] + rensou[i + 2];
        chmax(ans, tmp);
    }
    cout << ans << endl;
}


Measured memory_bytes: 6528
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
typedef long long ll;

#define rep(i, a, b) for(int i=a;i<b;i++)

int main() {
	int N, x, y,flag=0;
	cin>>N;
	x=N/10;
	if(x==9)flag++;
	y=N%10;
	if(y==9)flag++;
	if(flag == 0) cout<<"No"<<endl;
	else cout<<"Yes"<<endl;
	return 0; 
}

Measured memory_bytes: 256
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <climits>
#include <numeric>
#include <cmath>
#include <queue>
#include <sstream>
#include <string.h>

using namespace std;
typedef long long ll;

int main()
{
  int n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  
  vector<int> vec;
  int now = 1;
  int cnt = 0;
  for (int i = 0; i < n; i++) {
    if (s[i] == (char)('0' + now)) {
      cnt++;
    } else {
      vec.push_back(cnt);
      cnt = 1;
      now ^= 1;
    }
  }
  if (cnt > 0) {
    vec.push_back(cnt);
  }
  
  if (vec.size() % 2 == 0) {
    vec.push_back(0);
  }
  
  ll ans = 0;
  int right = 0;
  ll sum = 0;
  for (int left = 0; left < vec.size(); left+=2) {
    while (right < min(left + 2 * k + 1, (int)vec.size())) {
      sum += vec[right];
      ++right;
    }
    
    ans = max(ans, sum);
    
    if (right == left) ++right;
    else sum -= vec[left] + vec[left + 1];
  }
  cout << ans << endl;
  return 0;
}


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

int main() {
    int N, M;
    cin >> N >> M;
    vector<vector<int>> jobs(M + 1);
    rep(_, N) {
        int A, B;
        cin >> A >> B;
        if (A > M) continue;
        jobs[A].push_back(B);
    }

    priority_queue<int> pq;
    ll ans = 0;
    for (int d = 1; d <= M; d++) {
        for (auto e : jobs[d]) {
            pq.push(e);
        }
      if(!pq.empty()){
        int m = pq.top();
        pq.pop();
        ans += m;
      }
    }

    cout << ans << endl;
}

Measured memory_bytes: 5632
#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) range(i,0,b)
#define pb(a) push_back(a)
#define all(a) (a).begin(), (a).end()
#define debug(x) cout << "debug " << x << endl;
#define INF 200000000
using namespace std;


int main(){
    int n;
    while(cin >> n,n){
        int edge[20][20], dp[(1<<n)];
        rep(i,n) rep(j,n + 1) cin >> edge[i][j];
        rep(i,(1<<n)) dp[i] = INF;

        dp[0] = 0;

        rep(i,(1<<n)){
            rep(j,n){ //jbitテァツ崢ョテ」ツつ津ァツォツ凝」ツ?ヲテ」ツつ?
                if( (i & (1 << j)) == 0) { //テ」ツつッテ」ツδェテ」ツつ「テヲツクツ暗」ツ?ソテ」ツつ津・ツシツセテ」ツ??
                    int time = edge[j][0];
                    rep(k,n){ //テヲツ慊?ァツ淞ュテ」ツつッテ」ツδェテ」ツつ「テヲツ卍づゥツ鳴禿」ツつ津ヲツ篠「テ」ツ??
                        /*
                           テヲツ個妥ヲツ按ヲテ」ツ?療」ツ?ヲテ」ツ??」ツつ凝」ツつケテ」ツδ?」ツδシテ」ツつク j
                           テ、ツスツソテァツ板ィテ」ツ?凖」ツつ凝」ツつ「テ」ツつ、テ」ツδ?」ツδ?ッツシツ暗、ツサツ甘」ツ?セテ」ツ?ァテ」ツ?ォテ」ツつッテ」ツδェテ」ツつ「テ」ツ?療」ツ?淌」ツつケテ」ツδ?」ツδシテ」ツつクテッツシツ?k
                         */
                        if( (i & (1<<k)) == (1<<k)){
                            time = min(time,edge[j][k + 1]); 
                        }
                    }
                    dp[i | 1<<j] = min(dp[i | 1<<j], dp[i] + time);
                    //rep(i,7){ cout << dp[i] << endl; }
                }
            }
        }
        cout << dp[(1<<n)-1] << endl;
    }
}

Measured memory_bytes: 1416
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String line = br.readLine();
        String[] word = line.split(" ");
        char c1 = word[0].charAt(word[0].length() - 1);
        char c2 = word[1].charAt(0);
        char c3 = word[1].charAt(word[1].length() - 1);
        char c4 = word[2].charAt(0);
        if(c1 == c2 && c3 == c4) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }
}

Measured memory_bytes: 21204
n, m = map(int, input().split())
ans = []
ans_0 = []
for i in range(m):
    ans_0 = list(map(str, input().split()))
    ans.append(ans_0)
list0 = []
listpen = []
for j in range(n):
    list0.append(0)
for k in range(n):
    listpen.append(0)
sei = 0
pen = 0
for lis in ans:
    if list0[int(lis[0])-1] == 0:
        if lis[1] == "AC":
            sei += 1
            list0[int(lis[0])-1] = 1
        else:
            listpen[int(lis[0])-1] += 1
    else:
        pass
for l in range(n):
    if list0[l] == 1:
        pen += listpen[l]
print(str(sei)+" "+str(pen))


Measured memory_bytes: 33768
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <algorithm>
#include <iomanip>
#include <math.h>
#include <string.h>
using namespace std; using ll = long long; using pll = pair<ll, ll>;
using vl = vector<ll>; using vll = vector<vl>; using vpll = vector<pll>;
int ctoi(char c) {
	switch (c) {
	case '0': return 0; case '1': return 1; case '2': return 2;
	case '3': return 3; case '4': return 4; case '5': return 5;
	case '6': return 6; case '7': return 7; case '8': return 8;
	case '9': return 9;  default: return 0;
	}
}
bool pairCompare(const pll firstElof, pll secondElof)
{ return firstElof.second < secondElof.second; }
//**Snippetリスト**//
//rep, vin, all//
//gcdlcm, isPrime, eratos, modinv, bitSearch, bitList, dfs, bfs, dijkstra, UnionFind, COM, digitDP//
ll i, j, k, l, m, n; ll N, M, K, H, W, L; 
ll MOD = 1000000007; ll INF = 9999999999999; ll ans = INF;
vl flag, color; vll path; vl D;
//***********//
vl bitList(ll n, ll k, ll f) {
	vl bitList(k);
	for (ll i = 0; i < k; i++) {
		bitList[i] = f % n;
		f /= n;
	}
	return bitList;
}
int main() {
	ll D, G;
	cin >> D >> G;
	vl P(D), C(D);
	for (i = 0; i < D; i++) {
		cin >> P[i] >> C[i];
	}
	ll L = pow(2, D);
	for (k = 0; k < L; k++) {
		ll sum = 0; ll pre = 0; ll next = 0;
		vl Q = bitList(2, D, k);
		for (i = 0; i < D; i++) {
			if (Q[i]) {
				sum += 100 * (i + 1) * P[i] + C[i];
				pre += P[i];
			}
			else {
				next = i;
			}
		}
		if (sum >= G) ans = min(ans, pre);
		else {
			if ((G - sum) / (100 * (next + 1)) < P[next]) {
				pre += (G - sum - 1) / (100 * (next + 1)) + 1;
				ans = min(ans, pre);
			}
		}
	}
	cout << ans;
}
	


Measured memory_bytes: 512
#include<bits/stdc++.h>
#include<stdio.h>
#include<string>
#include<numeric>
using namespace std;
#define pb push_back
#define pf push_front

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
#define sz(x) int(x.size())
#define INF 1e5
#define MOD 1000000007
int main(){
	float n;
	cin>>n;
	cout<<(n-int(n/2))/n<<endl;

}


Measured memory_bytes: 384
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// ここにコードを挿入
		Scanner s = new Scanner(System.in);
		String[] str = s.nextLine().split(" ");
		String a = str[0];
		String b = str[1];
		String c = str[2];
		boolean ans = false;
		if(a.charAt(a.length() - 1) == b.charAt(0) && b.charAt(b.length() - 1) == c.charAt(0)) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}
	}

}


Measured memory_bytes: 22612
#include<bits/stdc++.h>
using namespace std;
 
#define ll long long int
 
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define mp make_pair
#define xx first
#define yy second
 
#define pii pair <int, int >
#define pll pair < ll, ll >
#define xx first
#define yy second
#define vi vector < int >
#define vl vector < ll >
#define vp vector < pii >
 
#define inf  100000000
 
#define f(i, c, n) for(int i = c; i < n; i++)
#define fe(i, c, n) for(int i = c; i <= n; i++)
#define fr(i, n, c) for(int i = n - 1; i >= c; i--)
 
#define be(a) a.begin(), a.end()
#define vsort(a) sort(a.begin(), a.end())
#define mem(a) memset(a, 0, sizeof(a))
#define memn(a) memset(a, -1, sizeof(a))
#define srti(a, n) sort(a, a + n)
#define srtd(a, n) sort(a, a + n, greater<int>())
#define LB(a, x) (lower_bound(vbe(a), x) - a.begin())
#define UB(a, x) (upper_bound(vbe(a), x) - a.begin())
#define S " "
#define N "\n"

//cout << "Case " << ++cs << ": " <<
#define fast ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define FILE freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);


void solve() {
	int a, b, c;
	cin >> a >> b >> c;
	if(a > c) {
		cout << "NO" << N;
	} else {
		if(a + b >= c) {
			cout << "YES" << N;
		} else cout << "NO" << N;
	}
}

int main() {
    // FILE;
    fast;
    // int t; cin >> t; while(t--)
    solve();
}

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

int main(){
    char s[12];
    scanf("%s", s);
    int a = 1000, n = strlen(s);
    int i, x;
    for(i = 0; i < n-2; i++){
        x = (int)(s[i] - '0') * 100 + (int)(s[i+1] -  '0') * 10 + (int)(s[i+2] - '0') ;
        x = abs(753 - x);
        if(x < a) a = x;
    }
    printf("%d\n", a);
    return 0;
}

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

int main() {
  int n,m,i,j,x=1;
  cin >> n>>m;
  vector <vector<char>> hyou(n,vector<char>(m));
  //入力と横チェック
  for(i=0;i<n;i++){
      for(j=0;j<m;j++){
          cin>>hyou[i][j];
       //   cout<<hyou[i][j];
          if(hyou[i][j]=='#') x=0;
      }
      if(x){
          for(j=0;j<m;j++) hyou[i][j]='0';
      } 
      //cout<<endl;
      x=1;
  }
  for(i=0;i<m;i++){
      for(j=0;j<n;j++){
          if(hyou[j][i]=='#') x=0;
      }
      if(x){
          for(j=0;j<n;j++) hyou[j][i]='0';
      } 
      x=1;
  }
  for(i=0;i<n;i++){
      x=0;
      for(j=0;j<m;j++){
          if(hyou[i][j]!='0') {
              cout<<hyou[i][j];
              x=1;
              }
      }
      if(x) cout<<endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
const long long LINF = 1e18;
#define dump(x)  cout << 'x' << ' = ' << (x) << ` `;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
typedef long long ll;
using namespace std;
int main(int argc, char const *argv[]) {
    int a, b, c;
    cin >> a >> b >>c;
    if (a <= c && c <= b) {
        cout << "Yes" << endl;
    } 
    else if (b <= c && c <= a) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define MAX_N 100
#define INF 1000000000


int N;
int r[MAX_N],c[MAX_N];
int memo[MAX_N][MAX_N];
int saiki(int i ,int j){
    if(memo[i][j] > -1)
        return memo[i][j];
    if(i == j)
        return 0;
    int mini = INF;
    FOR(k,i,j){
        mini = min(mini,saiki(i,k) + saiki(k + 1,j) + r[i] * c[k] * c[j]);
    }
    return memo[i][j] = mini;
}

int main(){
    scanf("%d",&N);
    REP(i,N){
        scanf("%d%d",&r[i],&c[i]);
    }
    REP(i,N)REP(j,N)memo[i][j] = -1;
    printf("%d\n",saiki(0,N-1));
    return 0;
}

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

using namespace std;

#define int long long 
#define M 1000000007

signed main(){
//	int t;
//	cin >> t;
//	while(t--){
		string s;
		cin >> s;
		int ans=0;
		for(int i=0;i<s.length();i++){
			ans+=(s[i]-'0');
		}
		if(ans%9==0){
			cout << "Yes";
		}
		else{
			cout << "No";
		}
//	}
}
 

Measured memory_bytes: 3720
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Scanner;
import java.util.function.BiFunction;

public class Main {
  Scanner sc = new Scanner(System.in);

  public static void main(String[] args) {
    new Main().run();
  }

  void run() {
    HashSet<Integer> set = new HashSet<>();
    for (int i = 0; i < 3; ++i) {
      set.add(ni());
    }
    System.out.println(set.size());
  }

  int ni() {
    return Integer.parseInt(sc.next());
  }

  void debug(Object... os) {
    System.err.println(Arrays.deepToString(os));
  }

  class BIT<T> {
    int n;
    ArrayList<T> bit;
    BiFunction<T, T, T> bif;

    BIT(int n, BiFunction<T, T, T> bif, T defaultValue) {
      this.n = n;
      bit = new ArrayList<>(n + 1);
      for (int i = 0; i < n + 1; ++i) {
        bit.add(defaultValue);
      }
      this.bif = bif;
    }

    void update(int i, T v) {
      for (int x = i; x <= n; x += x & -x) {
        bit.set(x, bif.apply(bit.get(x), v));
      }
    }

    T reduce(int i, T defaultValue) {
      T ret = defaultValue;
      for (int x = i; x > 0; x -= x & -x) {
        ret = bif.apply(ret, bit.get(x));
      }
      return ret;
    }
  }

}

Measured memory_bytes: 9684
import java.util.Scanner;


public class Main {
	
	public static void main(String[] args){
		try(Scanner sc = new Scanner(System.in)){
			final int H = sc.nextInt();
			final int W = sc.nextInt();
			
			for(int i = 0; i < H; i++){
				for(int j = 0; j < W; j++){
					if(sc.next().equals("snuke")){
						System.out.println((char)('A' + j) + "" + (i + 1));
						return;
					}
				}
			}
			
		}
	}
	
	
}


Measured memory_bytes: 10316
#include <bits/stdc++.h>
#define LL long long
#define FOR(i,c) for(__typeof(c.begin()) i = c.begin(); i != c.end(); i++)
#define F first
#define S second
using namespace std;

const LL mod = 1e9 + 7;

template<typename T> T gcd(T a, T b) { return b == 0?a: gcd(b, a % b); }
template<typename T> T LCM(T a, T b) { return a*(b/gcd(a, b)); }
template<typename T> T expo(T base, T e, T mod) { T res = 1;
  while(e > 0) { if(e&1) res = res * base % mod; base = base * base % mod; e >>= 1; }
  return res;
}
template<typename T, typename S> T expo(T b, S e){if(e <= 1)return e == 0?1: b;\
	return (e&1) == 0?expo((b*b), e>>1): (b*expo((b*b), e>>1));}
template<typename T, typename S> T modinv(T a, S mod) { return expo(a, mod-2, mod); }
template<class T, class S> std::ostream& operator<<(std::ostream &os, const std::pair<T, S> &t) {
	os<<"("<<t.first<<", "<<t.second<<")";
	return os;
}
template<class T> std::ostream& operator<<(std::ostream &os, const std::vector<T> &t) {
	os<<"["; FOR(it,t) { if(it != t.begin()) os<<", "; os<<*it; } os<<"]";
	return os;
}

const int MAXN = 1e5 + 100;

int n;
pair<LL, LL> arr[MAXN];
vector<pair<LL, int> > xs;
vector<pair<LL, int> > ys;

struct dsu {
  vector<int> Rank, P;
  int V;
  dsu(int v = 0) : V(v) {
    Rank = vector<int>(v + 1, 0);
    P = vector<int>(v + 1, 0);
    for(int i = 0; i < P.size(); i++) {
      P[i] = i, Rank[i] = 1;
    }
  }
  int find_root(int x) { return x == P[x] ? x : P[x] = find_root(P[x]); }
  void merge(int x, int y) {
    int xr = find_root(P[x]), yr = find_root(P[y]);
    if(xr == yr) return ;
    if(Rank[xr] < Rank[yr]) swap(xr, yr), swap(x, y);
    Rank[xr] += Rank[yr];
    P[yr] = xr;
  }
};

int main() {
  ios_base::sync_with_stdio(false);
	cin >> n;
	for(int i = 0; i < n; i++) {
		cin >> arr[i].F >> arr[i].S;
	}
	sort(arr, arr + n);
	n = unique(arr, arr + n) - arr;
	for(int i = 0; i < n; i++) {
		xs.push_back({arr[i].F, i});
		ys.push_back({arr[i].S, i});
	}
	sort(xs.begin(), xs.end());
	sort(ys.begin(), ys.end());
	dsu tester(n);
	vector<pair<LL, pair<int, int> > > edges;
	for(int i = 0; i < n; i++) {
		LL x = arr[i].F, y = arr[i].S;
		auto it = lower_bound(xs.begin(), xs.end(), make_pair(x, i));
		if(next(it) != xs.end()) {
			int other = next(it)->S;
			edges.push_back({min(abs(arr[other].F - arr[i].F), abs(arr[other].S - arr[i].S)), {i, other}});
		}
		if(it != xs.begin()) {
			int other = prev(it)->S;
			edges.push_back({min(abs(arr[other].F - arr[i].F), abs(arr[other].S - arr[i].S)), {i, other}});
		}
		it = lower_bound(ys.begin(), ys.end(), make_pair(y, i));
		if(next(it) != ys.end()) {
			int other = next(it)->S;
			edges.push_back({min(abs(arr[other].F - arr[i].F), abs(arr[other].S - arr[i].S)), {i, other}});
		}
		if(it != ys.begin()) {
			int other = prev(it)->S;
			edges.push_back({min(abs(arr[other].F - arr[i].F), abs(arr[other].S - arr[i].S)), {i, other}});
		}
	}
	sort(edges.begin(), edges.end());
	LL res = 0;
	for(auto &elem: edges) {
		LL wt = elem.F;
		int u = elem.S.F, v = elem.S.S;
		if(tester.find_root(u) != tester.find_root(v)) {
			tester.merge(u, v);
			res += elem.F;
		}
	}
	cout << res << '\n';
  return 0;
}


Measured memory_bytes: 16096
#include<bits/stdc++.h>
using namespace std;
int main() {
    int n;
    cin >> n;
    vector <int> a(n), b(n);
    vector <int> c(n-1);
    for(int i=0;i<n;++i) cin >> a[i];
    for(int i=0;i<n;++i) cin >> b[i];
    for(int i=0;i<n-1;++i) cin >> c[i];
    int sum=0;
    for(int i=0;i<n;++i) {
        sum+=b[i];
        if(a[i]-a[i+1]==-1) sum+=c[a[i]-1];
    }
    cout << sum << endl;
}

                   

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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define ALL(a)     (a).begin(),(a).end()
#define PRINT(a)   cout << (a) << endl
#define RALL(v) rbegin(v), rend(v)

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define Fi first
#define Se second

#define debug(x) cerr << x << " " << "(L:" << __LINE__ << ")" << '\n';

using ll = long long int;
using P = pair<int,int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using pii = pair<int, int>;

template <typename T> using PQ = priority_queue<T>;
template <typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7;

int main(){
  int N;
  cin >> N;
  map<string, int> mp;
  REP(i,N){
    string s;
    cin >> s;
    mp[s]++;
  }

  string c[4] = {"AC","WA","TLE","RE"};
  REP(i,4){
    cout << c[i] << " x " << mp[c[i]] << endl;
  }
}



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



int main()
{
	int n;
	cin >> n;
	int a[10000];
	for (int i = 0; i < n; i++)
	{
		cin >> a[i];
	}
	int ans = 0;
	int k = 0;
	
	for (int i = 1; i < n; i++)
	{
		if (a[i - 1] == a[i])
		{
			a[i] = -1 ;
			ans++;
		}
	}
	cout << ans << endl;

}

Measured memory_bytes: 764
#include <algorithm>
#include <iostream>
#include <queue>
#include <string>
#include <utility>
#include <vector>

using namespace std;

int main() {
  long long n, a = 100LL;
  cin >> n;
  int cnt = 0;
  while (n > a) {
    a += a / 100LL;
    cnt++;
  }
  cout << cnt << endl;
}

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

int H, W;
vector<vector<char>> S;

int bfs(int x, int y) {
  vector<vector<int>> dist(H, vector<int>(W, -1));
  dist.at(x).at(y) = 0;
  vector<int> mx(4), my(4);
  mx = {1, 0, -1, 0};
  my = {0, 1, 0, -1};

  queue<pair<int,int>> Q;
  Q.push({x, y});

  int res = 0;
  while (Q.size()) {
    int x = Q.front().first;
    int y = Q.front().second;
    Q.pop();
    res = max(res, dist.at(x).at(y));
    for (int i = 0; i < 4; i++) {
      int nx = x + mx.at(i);
      int ny = y + my.at(i);
      if (nx < 0 || nx >= H || ny < 0 || ny >= W) continue;
      if (S.at(nx).at(ny) == '.' && dist.at(nx).at(ny) == -1) {
        dist.at(nx).at(ny) = dist.at(x).at(y) + 1;
        Q.push({nx, ny});
      }
    }
  }
  return res;
}

int main() {
  cin >> H >> W;
  S.resize(H, vector<char>(W));
  for (int i = 0; i < H; i++)
    for (int j = 0; j < W; j++) cin >> S.at(i).at(j);

  int ans = 0;
  for (int i = 0; i < H; i++)
    for (int j = 0; j < W; j++)
      if (S.at(i).at(j) == '.') ans = max(ans, bfs(i, j));

  cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>//dp;
using namespace std;
int h[100010];
int main(){
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    int n;
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>h[i];
    }
    int cost[n+10];
    cost[1]=0;
    cost[2]=abs(h[2]-h[1]);
    for(int i=3;i<=n;i++){
        cost[i]=min(cost[i-1]+abs(h[i]-h[i-1]),cost[i-2]+abs(h[i]-h[i-2]));
    }    
    cout<<cost[n]<<"\n";
    return(0);
}

Measured memory_bytes: 4344
var i,j,n,m,a:longint;
    s1,s2:string;
 begin
  readln(s1);
  readln(s2);
  if s1[1]=s2[3] then
   if s1[2]=s2[2] then
    if s1[3]=s2[1] then
     begin
      writeln('YES');
      halt;
     end;
  writeln('NO');
 end.


Measured memory_bytes: 128
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int tmpk;
        boolean[][] nums = new boolean[n][m];
        for (int i = 0; i < n; i++) {
            tmpk = sc.nextInt();
            for (int j = 0; j < tmpk; j++) {
                nums[i][sc.nextInt() - 1] = true;
            }

        }
        boolean b;
        int output=0;
        for(int i=0;i<m;i++){
            b=true;
            for(int j=0;j<n;j++){
                if(!nums[j][i]){
                    b=false;
                }
            }
            if(b){
                output++;
            }
        }
        System.out.println(output);

    }
}

Measured memory_bytes: 25172
#include<iostream>
#include<iomanip>
#include<string>
#include<algorithm>
#include<functional>
#include<vector>
#include<math.h>

using namespace std;

typedef long long int lli;

int main()
{
	double x1, x2, x3, xp;
	double y1, y2, y3, yp;
	double abc[3];
	while (cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp) {
		abc[0] = (x3 - x2)*(yp - y2) - (y3 - y2)*(xp - x2);
		abc[1] = (x1 - x3)*(yp - y3) - (y1 - y3)*(xp - x3);
		abc[2] = (x2 - x1)*(yp - y1) - (y2 - y1)*(xp - x1);
		if ((abc[0] > 0 && abc[1] > 0 && abc[2] > 0) || (abc[0] < 0 && abc[1] < 0 && abc[2] < 0)) cout << "YES" << endl;
		else cout << "NO" << endl;
	}

	return 0;
}

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

int main() {
    string s;
    cin >> s;
    int q;
    cin >> q;
    string t;
    for(int i=0;i<q;i++){
        int ty;
        cin >> ty;
        if(ty==1){
            swap(s,t);
        }
        else{
            int f; char c;
            cin >> f >> c;
            if(f==1){
                t+=c;
            }
            else{
                s+=c;
            }
        }
    }
    reverse(t.begin(),t.end());
    t+=s;
    cout << t << endl;
}

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

bool check(long x);

int main(){
    int n;
    cin >> n;
    queue<int> a;
    a.push(0);
    int counter = 0;

    while(true){
        long top = a.front();
        if(top > n)break;
        a.pop();
        if(check(top))counter++;
        top *= 10;
        a.push(top+3);
        a.push(top+5);
        a.push(top+7);
    }
    cout << counter << endl;
    return 0;
}

bool check(long x){
    int a = 0, b = 0, c = 0;
    while(x > 0){
        if(x % 10 == 3)a++;
        if(x % 10 == 5)b++;
        if(x % 10 == 7)c++;
        x /= 10;
    }
    if(a > 0 && b > 0 && c > 0)return true;
    else return false;
}


Measured memory_bytes: 640
#define LOCAL
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rrep(i, n) for(int i=(n-1); i>=0; --i)
#define rep2(i, s, n) for(int i=s; i<(n); ++i)
#define ALL(v) (v).begin(), (v).end()
#define memr(dp, val) memset(dp, val, sizeof(dp))
using namespace std;
typedef long long ll;
static const int INTINF = (INT_MAX >> 1); // 10^9 + 10^7
static const ll LLINF = (LLONG_MAX >> 1);
static const int MAX = 1e5+1;
static const ll MOD = 1e9+7;
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; }
string to_string(string s) { return '"' + s + '"'; }
string to_string(bool b) { return b ? "true" : "false"; }
template <size_t N> string to_string(bitset<N> bs) {
  string res;
  for (size_t i = 0; i < N; ++i) res += '0' + bs[i];
  return res;
}
string to_string(vector<bool> v) {
  string res = "{";
  for (bool e : v) res += to_string(e) + ", ";
  return res += "}";
}
template <class T, class U> string to_string(pair<T, U> p);
template <class C> string to_string(C c) {
  string res = "{";
  for (auto e : c) res += to_string(e) + ", ";
  return res += "}";
}
template <class T, class U> string to_string(pair<T, U> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
void debug() { cerr << '\n'; }
template <class Head, class... Tail> void debug(Head head, Tail... tail) {
  cerr << '\t' << to_string(head), debug(tail...);
}
#ifdef LOCAL
#define print(...) cerr << "[" << #__VA_ARGS__ << "]:", debug(__VA_ARGS__)
#else
#define print(...)
#endif

int main(int argc, const char * argv[]) {
	std::cout << std::fixed << std::setprecision(15);

	int N, K; cin >> N >> K;
	vector<int> v(N);
	rep(i, K){
		int d; cin >> d;
		rep(j, d)
		{
			int a; cin >> a; a--;
			v[a]++;
		}
	}
	int ans = 0;
	rep(i, N){
		if(!v[i]) ans++;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3596
/*Always success does not build on success,success build on failure and hardwork*/
#include <bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define vec         vector<int>
#define map         map<int,int>
#define scn(t)      scanf("%d",&t);
#define lscn(t)      scanf("%lld",&t);
#define mod         1000000007
#define rep(i,a,b)  for(int i=a;i<b;i++)
#define endl        "\n"
using namespace std;
const int N=2e5+5;

int main()
{
    string s;
    cin>>s;

    int arr[26]={0};

    for(int i=0;i<(int)s.length();i++)
    {
        arr[s[i]-'a']++;
    }

    for(int i=0;i<26;i++)
    {
        if(arr[i]%2)
        {
            cout<<"No"<<endl;
            return 0;
        }
    }
    cout<<"Yes"<<endl;
}



Measured memory_bytes: 3600
n = int(input())
a = list(map(int, input().split()))
a_sum = sum(a)
a_list = []
for num in a:
    a_sum -= num
    a_list.append(a_sum)
total = 0
for i in range(n-1):
    ans = a[i] * a_list[i]
    total += ans
    if total > 10 ** 9 + 7:
        total = total % (10 ** 9 + 7)
print(total)


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

using namespace std;

int main(int argc, char const *argv[]) {
  string a, b, ans = "EQUAL";
  cin >> a >> b;
  if (a.size() > b.size()) ans = "GREATER";
  else if (a.size() < b.size()) ans = "LESS";
  else {
    for (size_t i = 0; i < a.size(); i++) {
      if (a[i]>b[i]) {
        ans = "GREATER";
        break;
      }
      else if (a[i] < b[i]){
        ans = "LESS";
        break;
      }
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
    using namespace std;
    const int M=3e5+5,mod=1e9+7;
    int mmp[8][2]={3,1,5,2,2,2,4,7,3,3,6,1,5,5,3,1},dp[M][8],len,i,j;
    char ch[M];
    void add(int &x,int v){x+=v;if(x>=mod)x-=mod;}
    int main(){
    	scanf("%s",ch);int n = strlen(ch);
    	dp[0][0] = 1;
    	for(int i=0;ch[i];++i){
    		for(int j=0;j<8;++j){
    			if(dp[i][j]){
    				if(ch[i]!='0') add(dp[i+1][mmp[j][1]],dp[i][j]);
    				if(ch[i]!='1') add(dp[i+1][mmp[j][0]],dp[i][j]);
    			}
    		}
    	}
    	printf("%d\n",(dp[n][1]+dp[n][2])%mod);
    }

Measured memory_bytes: 9984
#include "bits/stdc++.h"
using namespace std;
using ll = long long;

int main () {
	cin.tie(0);
	cin.sync_with_stdio(0);

	int n, m;
	cin >> n >> m;
	vector<int> a(n);
	for(int& x : a) cin >> x;
	ll ans = 0;
	for(int i = 1; i < n; ++i) {
		if(a[i-1] + a[i] >= m) {
			int take = a[i-1] + a[i] - m;
			int take_i = min(take, a[i]);
			take -= take_i;
			int take_i_1 = min(take, a[i-1]);
			take -= take_i_1;
			a[i] -= take_i;
			a[i-1] -= take_i_1;
			ans += take_i + take_i_1;
		}
	}
	cout << ans << flush;
}

Measured memory_bytes: 640
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<limits.h>
typedef long long LL;
#define rep(i,N) for(int i=0;i<(LL)N;i++)
int compare(const LL*a,const LL*b){if(*a<*b)return -1;else if(*a==*b)return 0;else return 1;}
signed main(void)
{
  int NG,OK,BASE,minus;
  LL N,K,L=-pow(16,16)/16,M,R=LLONG_MAX/3,count;
  count=scanf("%lld %lld",&N,&K);
  LL A[N];
  rep(i,N)count=scanf("%lld",&A[i]);
  qsort(A,N,sizeof(LL),(int(*)(const void*,const void*))compare);
  while(R-L>1)
  {
    M=(L+R)/2,count=0;
    rep(i,N)
    {
      NG=i,OK=N,minus=(A[i]<0);
      while(OK-NG>1)
      {
        BASE=(NG+OK)/2;
        if(A[i]*A[BASE]<=M){if(minus)OK=BASE;else NG=BASE;}
        else{if(minus)NG=BASE;else OK=BASE;}
      }
      count+=(minus)?N-OK:NG-i;
    }
    if(count<K)L=M;else R=M;
  }
  return printf("%lld\n",R),0;
}

Measured memory_bytes: 3324
#include <iostream>
#include <iomanip>
#include <random>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <numeric>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <sstream>
#include <bitset>
#include <cassert>
#include <fstream>
#include <queue>

#define len(X) ((int)(X).size())

#ifdef __LOCAL
	#define DBG(X) cout << #X << "=" << (X) << '\n';
#else
	#define DBG(X)
#endif

using std::cin;
using std::cout;
using std::vector;
using std::string;
using std::pair;
using std::swap;
using std::sort;
using std::lower_bound;
using std::unique;

using int64 = long long int;
using pii   = pair<int, int>;
using pii64 = pair<int64, int64>;

const int NIL = -1;
const int INF = (int)2e9;
const int64 INF64 = (int64)2e18;

void init_IO() {
	std::ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
}

const int A = 26;

vector<vector<int>> get(const string& s) {
	vector<vector<int>> hash(A, vector<int>());

	for(int i = 0; i < len(s); ++i) {
		int code = s[i] - 'a';
		hash[code].push_back(i);
	}

	sort(hash.begin(), hash.end());
	return hash;
}

void solve() {
	string s, t;
	cin >> s >> t;

	cout << (get(s) == get(t) ? "Yes\n" : "No\n");
}

int main() {
	init_IO();
	solve();

	return 0;
}


Measured memory_bytes: 2964