akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define repz(i, z, n) for (decltype(n) i = (z); i < (n); i++)
#define rep(i, n) for (decltype(n) i = 0; i < (n); i++)

#define REPZ(i, z, n) for (decltype(n) i = (z); i <= (n); i++)
#define REP(i, n) for (decltype(n) i = 0; i <= (n); i++)
#define ALL(v) v.begin(), v.end()
#define len(v) ((ll)(v).size())
#define MAX(v) (*max_element(ALL(v)))
#define MIN(v) (*min_element(ALL(v)))
#define INF 1000000000000  // 1E+12

// 略
#define PB push_back
#define F first
#define S second
#define MP make_pair
#define READ cin >>
#define PRINT cout <<
#define PYES cout << "YES" << endl
#define pyes cout << "Yes" << endl
#define POK cout << "OK" << endl
#define PNO cout << "NO" << endl
#define pno cout << "No" << endl
#define PNG cout << "NG" << endl
#define ret return 0

using namespace std;

// デバッグ用
void debug_out() { cout << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cout << H << " ";
  debug_out(T...);
}

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

#ifdef _DEBUG
#define debug(...) debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif

// typedef
typedef long long ll;
typedef unsigned long long ul;
typedef long double ld;
typedef pair<ll, ll> pl;

// const
// 円周率
const ld pi = acos(-1);
// mod用
// 1E+9 +7
const ll mod = (int)1e+9 + 7;
// 1s間で可能なループ回数2E+8回
// int        最大値2147483647         〜2E+9
// long long  最大値9223372036854775807〜9E+18
// 総和accumulate
// 単純リストvector<type> push_back
// 連想配列map<key,value> insert,
// 集合set<type>
// pair キーとバリューを格納 firstとsecondでアクセス
// 小数点指定 cout << fixed << setprecision(15) << endl;
// to_string<->stoi
// stoll(longlong)
// stod(double)
// deep copy v1->v2 copy(v1.begin(), v1.end(), back_inserter(v2) );
// 大文字65-90(-32)
// 小文字97-122(+32)
//  priority_queue<pair<ll, ll>, vector<pair<ll, ll>>, greater<pair<ll, ll>>>

signed main() {
  // faster
  // C言語流の入出力は使用できない
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  int i = 1;
  ll k;
  cin >> k;
  ll m = 7 % k;
  for (i = 1; m != 0 and i < k; i++) {
    m = (10 * m + 7) % k;
  }
  if (m != 0) i = -1;
  cout << i << endl;
  ret;
}


Measured memory_bytes: 3652
#ifndef LOCAL
#pragma GCC optimize("O3")
#endif
#include "bits/stdc++.h"
using namespace std;
#define sim template < class c
#define ris return * this
#define int long long
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << '\n'; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);
typedef long long ll;
const ll MOD = 1e9 + 7 ;
const ll N = 1e5 + 10 ;
const ll INF = 1e18 + 10 ;
signed main(){
    fastio 
    int x ;
    cin >> x ;
    while(x != 0){
        if ( x % 10 == 7 ) return cout << "Yes" << endl, 0;
        x /= 10 ;
    }
    cout << "No" << endl;
    return 0 ; 
}

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

int main() {

  ll n; cin>>n; ll ans=n; ll ka=0;  
  vector<string>a(n);  
  rep(i,n) {
    cin>>a.at(i);  
  }
  
  sort(all(a));
  rep(i,n-1){if(a.at(i)==a.at(i+1))ka++;}
  
  
  
  cout<<ans-ka<<endl;
  
  
  
  
  
  
}


Measured memory_bytes: 9492
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <numeric>
#include <random>
#include <vector>
#include <array>
#include <bitset>
#include <queue>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>

using namespace std;
using ll = long long;
using ull = unsigned long long;
constexpr ll TEN(int n) { return (n==0) ? 1 : 10*TEN(n-1); }
int bsr(int x) { return 31 - __builtin_clz(x); }

int main() {
    ios::sync_with_stdio(0);
    cout << setprecision(20);
    int n;
    cin >> n;
    int sm = 0;
    vector<int> v;
    for (int i = 0; i < n; i++) {
        int a;
        cin >> a;
        sm ^= a;
        v.push_back(a^(a-1));
    }
    sort(v.begin(), v.end(), greater<int>());
    int co = 0;
    for (int d: v) {
        if (sm && bsr(d) == bsr(sm)) {
            co++;
            sm ^= d;
        }
    }
    if (sm) {
        cout << -1 << endl;
    } else {
        cout << co << endl;
    }
    return 0;
}


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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    long long q(1);//cin>>q;
    while(q--){
        long long n,mod(1e9+7),tot(0);cin>>n;long long arr[n],sum[n];
        for(int i=0;i<n;i++){
            cin>>arr[i];
            if(i==0) sum[i]=arr[i];
            else sum[i]=(arr[i]+sum[i-1]);
        }
        for(int i=0;i<n-1;i++){
            tot+=arr[i]*((sum[n-1]-sum[i])%mod);
            tot%=mod;
        }
        cout<<tot<<endl;
    }
    return 0;
}

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

typedef pair<int, int> pii;
typedef long long ll;
typedef vector<int> vi;

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define ALL(c) (c).begin(),(c).end()

const ll MOD = 1000000007;

int H, W;
ll K;
int cnt;
string s[1010];
ll w[2][2], a[2][2];

int main() {
	cin >> H >> W >> K;
	--K;

	rep(i, H) {
		cin >> s[i];
		rep(j, W) {
			if (s[i][j] == '#') {
				++cnt;
			}
		}
	}

	bool f1 = 0, f2 = 0;

	rep(i, H) {
		if (s[i][0] == '#' && s[i][W-1] == '#') {
			f1 = 1;
		}
	}

	rep(j, W) {
		if (s[0][j] == '#' && s[H-1][j] == '#') {
			f2 = 1;
		}
	}

	if (f1 && f2) {
		puts("1");
	} else if (!f1 && !f2) {
		ll t = cnt;
		ll ans = 1;

		while (K) {
			if (K & 1) {
				ans = ans * t % MOD;
			}
			K /= 2;
			t = t * t % MOD;
		}
		cout << ans << endl;
	} else {
		if (f2) {
			vector<string> vec(W);
			rep(i, H) rep(j, W) {
				vec[j].pb(s[i][j]);
			}
			swap(H, W);
			rep(i, H) s[i] = vec[i];
		}

		int both = 0;

		rep(i, H) {
			if (s[i][0] == '#' && s[i][W-1] == '#') {
				++both;
			}
		}

		w[0][0] = cnt;
		int adj = 0;
		rep(i, H) {
			rep(j, W-1) {
				if (s[i][j] == '#' && s[i][j+1] == '#') {
					++adj;
				}
			}
		}

		w[0][1] = MOD - adj;
		w[1][0] = 0;
		w[1][1] = both;

		a[0][0] = a[1][1] = 1;

		while (K) {
			if (K & 1) {
				ll b[2][2] = {0};
				rep(i, 2) {
					rep(j, 2) {
						rep(k, 2) {
							b[i][k] = (b[i][k] + a[i][j] * w[j][k]) % MOD;
						}
					}
				}
				rep(i, 2) {
					rep(j, 2) {
						a[i][j] = b[i][j];
					}
				}
			}

			K /= 2;

			ll b[2][2] = {0};
			rep(i, 2) {
				rep(j, 2) {
					rep(k, 2) {
						b[i][k] = (b[i][k] + w[i][j] * w[j][k]) % MOD;
					}
				}
			}

			rep(i, 2) {
				rep(j, 2) {
					w[i][j] = b[i][j];
				}
			}			
		}
		ll ans = (a[0][0] + a[0][1]) % MOD;
		cout << ans << endl;
	}

	return 0;
}

Measured memory_bytes: 2304
// AOJ 1622 Go around the Labyrinth
// 2018.2.13 bal4u

#include <stdio.h>
#include <string.h>

typedef struct { char r, c, d, k; } S;
S s[3000]; int top;
char map[53][53];
char mk[53][53];
int mv[4][2] = {{-1,0},{0,1},{1,0},{0,-1}};

int check(int h, int w)
{
	int i, r, c, d, k, nr, nc;

	memset(mk, 0, sizeof(mk));
	s[0].r = 1, s[0].c = 1, s[0].d = 1, s[0].k = 1, top = 1;
	while (top) {
		r = s[--top].r, c = s[top].c, d = s[top].d, k = s[top].k;

		if (mk[r][c]) continue;
		mk[r][c] = 1;

		if      ((k & 1) && r == h && c == 1) k |= 2;
		else if ((k & 2) && r == h && c == w) k |= 4;
		else if ((k & 4) && r == 1 && c == w) k |= 8;
		else if ((k & 8) && r == 1 && c == 2) return 1;

		d += 2; if (d >= 4) d -= 4;
		for (i = 0; i < 4; i++) {
			if (++d == 4) d = 0; 
			nr = r + mv[d][0], nc = c + mv[d][1];
			if (map[nr][nc] && !mk[nr][nc]) {
				s[top].r = nr, s[top].c = nc, s[top].d = d, s[top++].k = k;
			}
		}
	}
	return 0;
}

int main()
{
	int h, w, r, c;
	char b[10], *p;

	while (fgets(b, 10, stdin) && *b != '0') {
		sscanf(b, "%d%d", &h, &w);
		for (r = 1; r <= h; r++) {
			fgets(p=map[r]+1, 52, stdin);
			c = w; while (c--) *p = (*p == '.'), p++; *p = 0;
		}
		memset(map[r], 0, w+2); 
		puts(check(h, w)? "YES": "NO");
	}
	return 0;
}



Measured memory_bytes: 2020
def main():
    INF = float("inf")

    N, M = map(int, input().split())

    dp = [INF] * (2 ** N)
    dp[0] = 0

    for _ in range(M):
        a, b = map(int, input().split())
        C = [int(i) for i in input().split()]
        mask = sum(1 << (c - 1) for c in C)
        for i in range(len(dp)):
            if dp[i | mask] > dp[i] + a:
                dp[i | mask] = dp[i] + a

    ans = dp[-1]
    print(-1 if ans == INF else ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3188
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(v) v.begin(),v.end()
#define len(x) (ll)(x).length()
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const int INF=1e9;
const ll INFS=1e18;
const int di[] = {-1,0,1,0};
const int dj[] = {0,-1,0,1};


int a[4];
 
int main() {
  string s;
  cin>>s;
  rep(i,4) a[i]=s[i]-'0';
  for(int x=0;x<8;x++){
    int sum=a[0];
    string s;
    s+='0'+a[0];
    rep(i,3){
      if(x&(1<<i)){
        sum+=a[i+1];
        s+='+';
        s+='0'+a[i+1];
      }else{
        sum-=a[i+1];
        s+='-';
        s+='0'+a[i+1];
      }
    }
    if(sum==7){
      cout<<s<<"=7"<<endl;
      return 0;
    }
  }
}

Measured memory_bytes: 3624
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<vector>
#define M 100000
using namespace std;

struct edge {
	int t, w;
};

int D = 0, x;
vector<edge> G[M];

void Serch(int u, int v, int d) {
	for (int i = 0; i < G[u].size(); i++) {
		if (G[u][i].t != v) {
			Serch(G[u][i].t, u, d + G[u][i].w);
		}
	}
	if (D < d) { D = d; x = u; }
}

int main() {
	int n, s, t, w, dia = 0;
	cin >> n;
	for (int i = 0; i < n-1; i++) {
		cin >> s >> t >> w;
		edge a, b; a.t = t; b.t = s; a.w = b.w = w;
		G[s].push_back(a); G[t].push_back(b);
	}

	Serch(0, -1, 0);
	D = 0;
	Serch(x, -1, 0);

	cout << D << endl;
	return 0;
}


Measured memory_bytes: 13200
#include<bits/stdc++.h>
using namespace std;
#define LL long long
#define M(a,b) memset(a,b,sizeof(a))
LL a,b,x;
int main()
{
    while(~scanf("%lld %lld %lld",&a,&b,&x))
    {
        if(a%x==0) printf("%lld\n",b/x-a/x+1);
        else printf("%lld\n",b/x-a/x);
    }
    return 0;
}


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

using namespace std;

template<typename T>
class SegTree {
public:
    explicit SegTree(int n, T def) : N(calcN_(n)), def(def), mVal(2*calcN_(n)-1, def) {}
    void update(int idx, T value){
        int i = N + idx - 1;
        update_(mVal[i], value);
        while(i > 0){
            i = (i-1)/2;
            mVal[i] = operate(mVal[2*i+1], mVal[2*i+2]);
        }
    }
    T get(int l, int r){
        l = max(0, l);
        r = min(N, r);
        int offset = N;
        T resL = def;
        T resR = def;
        while(offset > 0){
            if(l >= r) break;
            if(l&1){ resL = operate(resL, mVal[offset+l-1]); l++; }
            if(r&1){ resR = operate(mVal[offset+r-2], resR); }
            l /= 2;
            r /= 2;
            offset /= 2;
        }
        return operate(resL, resR);
    }
    int maxRight(int l, T v){
        l = max(0, l) + N;
        T resL = def;
        while(l){
            if(l&1){
                T next = operate(resL, mVal[l-1]);
                if(next >= v){
                    while(l < N){
                        l *= 2;
                        next = operate(resL, mVal[l-1]);
                        if(next < v){
                            resL = next;
                            ++l;
                        }
                    }
                    return l - N;
                }
                resL = next;
                if(!(l&(l+1))) break;
                l++;
            }
            l /= 2;
        }
        return N;
    }
private:
    int calcN_(int n){
        int res = 1;
        while(res < n) res *= 2;
        return res;
    }
    void update_(T& data, T val) { data = val; }
    T operate(T a, T b) { return max(a, b); }
    const int N;
    const T def;
    vector<T> mVal;
};

int main(){
    int N, Q; cin >> N >> Q;
    SegTree<int> seg(N, 0);
    for(int i=0;i<N;i++){
        int a; cin >> a;
        seg.update(i, a);
    }
    for(int i=0;i<Q;i++){
        int t, x, v; cin >> t >> x >> v;
        if(t==1){
            seg.update(x-1, v);
        } else if(t==2){
            cout << seg.get(x-1, v) << endl;
        } else {
            cout << min(seg.maxRight(x-1, v), N) + 1 << endl;
        }
    }
}

Measured memory_bytes: 5340
#pragma GCC optimize ("O3")
//こういうの意味あるのかな
#pragma GCC target ("avx")
//効果てきめんワロタ

//#include<bits/stdc++.h>
#include<cstdio>
#include<algorithm>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

const int cm = 1 << 17;
char cn[cm], * ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	int A = 0;
	if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
	else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}

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


	int N = getint(), K = getint();
	int dp[101], h[101] = {};
	rep(i, K) dp[i] = 1e9;

	int H = getint();
	int kotae = 0;
	rep(i, N - 1) {
		h[i % K] = H;
		dp[i % K] = kotae;
		H = getint();
		kotae = 1e9;
		rep(j, K) chmin(kotae, dp[j] + abs(h[j] - H));
	}

	printf("%d", kotae);

	Would you please 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) {
		Scanner sc = new Scanner();
		int n = sc.nextInt();
		String s = sc.next();
		int k = sc.nextInt();
		
		char c = s.charAt(k-1);
		for(char C : s.toCharArray()) {
			if(C == c)
				System.out.print(C);
			else
				System.out.print("*");
		}
		System.out.println();
	}
}

class Scanner {
	private static final int SPACE = (int)' ';
	private static final int LINE_END_0 = 13;
	private static final int LINE_END_1 = 10;
	private static final int BEFORE = -1;
	private BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	
	public String next(){
		StringBuilder sb = new StringBuilder();
		
		int length = BEFORE;
		readLoop: while(true) {
			try {
				int value = br.read();
				switch(value) {
				case LINE_END_1:
					if(length == BEFORE)
						break;
					
					if((int)sb.charAt(length) == LINE_END_0)
						sb.deleteCharAt(length);
				case SPACE:
					break readLoop;
				}
				sb.append((char)value);
				length++;

			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
		return sb.toString();
	}
	
	public String[] nextArray(int length) {
		String[] array = new String[length];
		for(int i = 0; i < length; i++)
			array[i] = next();
		return array;
	}
	
	public double nextDouble() {
		return Double.parseDouble(next());
	}
	
	public double[] nextDoubleArray(int length) {
		double[] array = new double[length];
		for(int i = 0; i < length; i++)
			array[i] = nextDouble();
		return array;
	}
	
	public int nextInt() {
		return Integer.parseInt(next());
	}
	
	public int[] nextIntArray(int length) {
		int[] array = new int[length];
		for(int i = 0; i < length; i++)
			array[i] = nextInt();
		return array;
	}
	
	public long nextLong() {
		return Long.parseLong(next());
	}
	
	public long[] nextLongArray(int length) {
		long[] array = new long[length];
		for(int i = 0; i < length; i++)
			array[i] = nextLong();
		return array;
	}
	
	public boolean ready() {
		try {
			return br.ready();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return false;
	}
}


Measured memory_bytes: 21844
#include <iostream>
#include <set>
#include <map>
#include <algorithm>

using namespace std;

#define int long long

set<pair<int, int> > ydk;

signed main(){
    int h, w, n;
    cin >> h >> w >> n;

    int ans[20] = {};

    ans[0] = (h-2)*(w-2);

    int x[100010];
    int y[100010];

    set<pair<int, int> > st;

    for(int i = 0;i < n;i++){
        cin >> y[i] >> x[i];
        x[i]--;
        y[i]--;
        ydk.insert(make_pair(x[i], y[i]));

        for(int a = -2;a <= 2;a++){
            for(int b = -2;b <= 2;b++){
                int xx = x[i]+a;
                int yy = y[i]+b;
                if(0 <= xx && xx < w-2 && 0 <= yy && yy < h-2){
                    st.insert(make_pair(xx, yy));
                }
            }
        }
    }

    for(auto itr = st.begin(); itr != st.end();itr++){
        int xx = (*itr).first;
        int yy = (*itr).second;

        int cnt = 0;
        for(int a = 0;a < 3;a++){
            for(int b = 0;b < 3;b++){
                if(ydk.find(make_pair(xx+a, yy+b)) != ydk.end()){
                    cnt++;
                }
            }
        }

        ans[0]--;
        ans[cnt]++;
    }


    for(int i = 0;i <= 9;i++){
        cout << ans[i] << endl;
    }

    return 0;
}



Measured memory_bytes: 164352
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
#include <boost/multiprecision/cpp_int.hpp>
using namespace boost::multiprecision;
using dint = cpp_int;
//using number = int;
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧  
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     
　　　　／　　　＼　 　  |　|     
　　　 /　　 /￣￣￣￣/　　|  
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿  
　 　　　＼/＿＿＿＿/　（u　⊃  
---------------------------------------------------------------------------------------------------*/
 




dint A, B; string op;
//---------------------------------------------------------------------------------------------------
void _main() {
    cin >> A >> op >> B;
    dint ans;
    if (op == "+") ans = A + B;
    else ans = A - B;
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>

int main () {
    int a, b, c , tmp;
    
    std :: cin >> a >> b >> c ;
    

    if (a > c){
        tmp = a ;
        a = c ;
        c = tmp;
    }
    if (a > b ){
        tmp = a ;
        a = b;
        b = tmp;

    }
    if ( b > c) {
        tmp = b ;
        b = c;
        c = tmp;
    }
    std :: cout << a <<" "<< b <<" "<< c << std :: endl;
    
}


Measured memory_bytes: 3096
let sum_of_digits x =
  let rec f ans n =
    if n = 0 then ans else f (ans + (n mod 10)) (n / 10)
  in f 0 x

let () =
  Scanf.scanf "%d" (fun n -> 
      if n mod (sum_of_digits n) = 0 then "Yes" else "No")
  |> Printf.printf "%s\n"

Measured memory_bytes: 384
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define E "\n"

using namespace std;
const long long MOD = (long long)1e9 + 7;

int n, a[100009];
multiset<int> mst;

int main()
{
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	int cur = 1;
	mst.insert(a[0]);
	cur++;
	for (int i = 1; i < n; i++) {
		auto p = mst.lower_bound(a[i]);
		if (p == mst.begin()) {
			cur++;
			mst.insert(a[i]);
		}
		else {
			p--;
			mst.erase(p);
			mst.insert(a[i]);
		}
	}
	cout << cur - 1 << E;
	//system("pause");
	return 0;
}

Measured memory_bytes: 5376
import java.util.*;
class Main
{
    public static void main (String[] args)
    {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt(), b = sc.nextInt(), k = sc.nextInt();
        if( b - a >= 2 * k - 1){
            for(int i = 0; i < k; i++){
                System.out.println(a + i);
            }
            for(int i = k - 1; i >= 0; i--){
                System.out.println(b - i);
            }
        }
        else{
            for(int i = a; i <= b; i++){
                System.out.println(i);
            }
        }
    }
}


Measured memory_bytes: 21844
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<string>
#include<cstring>
using namespace std;

int main(void) {
	int i, j, k, l, m, a, b;
	bool flag = {false};
	cin >> a >> b;
	if (b < 10) {
		for (i = 1; i <= 103; i++) {
			if (a * 10 + b == i * i) {
				flag = true;
			}
		}
	}
	else if(b<100) {
		for (i = 1; i <= 103; i++) {
			if (a * 100 + b == i * i) {
				flag = true;
			}
		}

	}
  else{for (i = 1; i <= 400; i++) {
			if (a * 1000 + b == i * i) {
				flag = true;
			}
		}
  }
	if (flag)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
	
	return 0;
}



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

int main() {
  int n;
  cin >> n;
  vector<ll> a(n);
  rep(i, n) cin >> a[i];
  sort(a.begin(), a.end(), greater<ll>());
  ll ans = 0;
  int n1 = n - 1;
  for (int i = 0; i < n; i++) {
    if (i == 0) {
      ans += a[i];
      n1--;
      if (n1 == 0) break;
    } else {
      ans += a[i];
      n1--;
      if (n1 == 0) break;
      ans += a[i];
      n1--;
      if (n1 == 0) break;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 4848
(n,m,*b),a,*q=[map(int,t.split())for t in open(0)]
t=[-1]*n
def r(x):
 while-1<t[x]:x=t[x]
 return x
def u(x):
 x,y=map(r,x)
 if x!=y:
  if t[x]>t[y]:x,y=y,x
  t[x]+=t[y];t[y]=x
[*map(u,q)]
i=c=0
k=j=n+~m<<1
*d,=eval('[],'*n)
for v in a:d[r(i)]+=v,;i+=1
for p in d:x,*y=sorted(p)+[0];c+=x;b+=y[:-1];j-=p>[]
print((c+sum(sorted(b)[:j]),'Impossible')[k>n]*(k>0))

Measured memory_bytes: 138736
//Zory-2020
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
// typedef __int128 ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define FR first
#define SE second
#define MP make_pair
#define PB push_back
#define vc vector
#define db double
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define bin(x) (1ll<<(x))
#define fo(i,l,r) for(int i=(l),I=(r);i<=I;i++)
#define fd(i,r,l) for(int i=(r),I=(l);i>=I;i--)
#define mem(x,val) memset(x,val,sizeof x)
#define Swap(a,b,n) for(int I=0;I<=n;I++) swap(a[I],b[I])
#define PC __builtin_popcountll
#ifdef DEBUG
	#define debug(A,args...) fprintf(stderr,A,##args)
#else
	#define debug(A,args...) 
#endif
namespace mine
{
	ll qread()
	{
		ll ans=0,f=1;char c=getchar();
		while(c<'0' or c>'9') {if(c=='-')f=-1;c=getchar();}
		while('0'<=c and c<='9') ans=ans*10+c-'0',c=getchar();
		return ans*f;
	}
	void write(ll num){if(num<0) putchar('-'),num=-num;if(num>=10) write(num/10);putchar('0'+num%10);}
	void write1(ll num){write(num);putchar(' ');}
	void write2(ll num){write(num);putchar('\n');}
	template<typename T>inline bool chmax(T&a,const T&b){return a<b?a=b,1:0;}
	template<typename T>inline bool chmin(T&a,const T&b){return a>b?a=b,1:0;}
	ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}
	bool IN(ll x,ll l,ll r){return l<=x and x<=r;}
	void GG(){puts("NO");exit(0);}
	
	const db eps=1e-8;
	const int INF=0x3f3f3f3f;
	const int MOD=1e9+7;
	int mm(const int x){return x>=MOD?x-MOD:x;}
	template<typename T> void add(T &x,const int &y){x=(x+y>=MOD?x+y-MOD:x+y);}
	ll qpower(ll x,ll e,int mod=MOD){ll ans=1;while(e){if(e&1)ans=ans*x%mod;x=x*x%mod;e>>=1;}return ans;}
	ll invm(ll x){return qpower(x,MOD-2);}
	const int M=5e6+10;
	ll fac[M],facinv[M],Inv[M];ll C(int n,int m){return n<0 or n<m?0:fac[n]*facinv[m]%MOD*facinv[n-m]%MOD;}
	void PRE()
	{
		fac[0]=1;fo(i,1,M-1) fac[i]=fac[i-1]*i%MOD;
		facinv[M-1]=invm(fac[M-1]);fd(i,M-1,1) facinv[i-1]=facinv[i]*i%MOD;
		Inv[1]=1;fo(i,2,M-1) Inv[i]=(MOD-MOD/i)*Inv[MOD%i]%MOD;
	}
	const int N=1e6+10;
	//------------------FIXED------------------
	vc<int> to[N];ll a[N],f[N];
	void solve(int x,int fa)
	{
		if(sz(to[x])==1) return f[x]=a[x],void();
		ll sum=0,mx=0;for(auto y:to[x]) if(y!=fa) solve(y,x),chmax(mx,f[y]),sum+=f[y];
		mx=(mx*2<=sum?sum/2:sum-mx);ll cnt=sum-a[x];if(cnt<0 or cnt>mx) GG();f[x]=sum-2*cnt;
	}
	void main()
	{
		int n=qread();fo(i,1,n) a[i]=qread();fo(i,2,n){ int x=qread(),y=qread();to[x].PB(y),to[y].PB(x); }
		if(n==2){ puts(a[1]==a[2]?"YES":"NO");return; }//debug
		int rt=0;fo(i,1,n) if(sz(to[i])>1) rt=i;solve(rt,0);puts(f[rt]?"NO":"YES");
	}
};//����������
signed main()
{
	#ifdef DEBUG
	//freopen("a.in","r",stdin);
	freopen("z.txt","r",stdin);
	//freopen("a.out","w",stdout);
	#endif
	srand(time(0));
	mine::PRE();//����Ԥ����ģ����
	mine::main();
	debug("\n---------------------Zory---------------------\nTime: %.2lf s",1.0*clock()/CLOCKS_PER_SEC);
}

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

#define scv(a) #a

using namespace std;

void solve() {
    int n, k;
    cin >> n >> k;
    vector<int> a(n + 1);
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
    }
    vector<int> dp(n + 1);
    for (int i = 2; i <= n; i++) {
        int t = 1e9 + 123;
        for (int j = i - 1; j >= i - k; j--) {
            if (j < 1) {
                break;
            }
            t = min(t, dp[j] + abs(a[i] - a[j]));
        }
        dp[i] = t;
    }
    cout << dp[n] << endl;  
}

int main() {
    #ifdef DEBUG
        freopen("solve.inp", "r", stdin);
        freopen("solve.out", "w", stdout);
    #endif
    solve();
    return 0;
}   

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
using namespace std;
int n;
long long int kk;
const int mod=1e9+7;
struct matrix{
    vector<vector<int>>m;
    matrix(){
        m.resize(n,vector<int>(n));
    }
    matrix operator* (const matrix&b) const{
        matrix c=matrix();
        for(int i=0;i<n;i+=1){
            for(int j=0;j<n;j+=1){
                for(int k=0;k<n;k+=1){
                    int q=(long long int)m[i][j]*b.m[j][k]%mod;
                    c.m[i][k]=(c.m[i][k]+q)%mod;
                }
            }
        }
        return c;
    }
};
int main() {
	scanf("%d %lld",&n,&kk);
	vector<vector<int>>a(n,vector<int>(n));
	for(int i=0;i<n;i+=1){
	    for(int j=0;j<n;j+=1){
	        scanf("%d",&a[i][j]);
	    }
	}
	matrix res=matrix();
	for(int i=0;i<n;i+=1){
	    res.m[i][i]=1;
	}
	matrix b=matrix();
	b.m=a;
	while(kk){
	    if(kk%2){
	        res=res*b;
	    }
	    b=b*b;
	    kk>>=1;
	}
	int ans=0;
	for(int i=0;i<n;i+=1){
	    for(int j=0;j<n;j+=1){
	        ans=(ans+res.m[i][j])%mod;
	    }
	}
	printf("%d",ans);
	return 0;
}


Measured memory_bytes: 256
def main():
    n,m = map(int,input().split())
    h = list(map(int,input().split()))
    good = [1]*n
    for i in range(m):
        a,b = map(int,input().split())
        if h[a-1] >= h[b-1]:
            good[b-1] = 0
        if h[b-1] >= h[a-1]:
            good[a-1] = 0
    print(sum(good))
    
if __name__ == '__main__':
    main()


Measured memory_bytes: 84948
import java.util.*;
public class Main {
	public static void main(String[] args){
    	Scanner scanner = new Scanner(System.in);
      
      	int A = scanner.nextInt();
      	int B = scanner.nextInt();
      	int C = scanner.nextInt();
      
      	if(A == 7 && B == 5 && C == 5 || A == 5 && B == 7 && C == 5 || A == 5 && B == 5 && C == 7) {
        	System.out.println("YES");
          	return;
        }
      	System.out.println("NO");
	}
}
 

 



Measured memory_bytes: 21204
#include <iostream>
#include <iomanip>
#include<vector>
#include <algorithm>
#include <queue>
#include<string>
#include <map>
#include <cmath>
#define rep(i,n) for(int i=0;i<(n);++i)
using namespace std;
typedef long long ll;
typedef long double ld;

int main() {
	int N, Y;
	cin >> N >> Y;
	int x = -1, y = -1, z = -1;
	for(int i = 0; i <= N; ++i) {
		for (int j = 0; j <= N;++j) {
			int k = N - i - j;
			if (0<=k&&k<=N) {
				if (i*10000+j*5000+k*1000==Y) {
					x = i; y = j; z = k;
					break;
				}
			}
		}
	}
	cout << x<<" "<< y <<" " << z << endl;
	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define rep1(i,n) for(int i=1;i<=n;++i)

int a[100001];
int main(void){
	int N,cnt=0;
	cin>>N;
	rep1(i,N)cin>>a[i];
	rep1(i,N)if(a[a[i]]==i)cnt++;
	cout<<cnt/2<<endl;
	return 0;
}


Measured memory_bytes: 768
#include <iostream>
#include <queue>
#include <cstdlib>
#include <vector>

using namespace std;


int main() {
  // create a vector to store inputs
  vector<int> inputs;
  int n_inputs = 0;
  int max_prime = 0;
  int input;
  while (cin >> input) {
    if (input == 0) break;
    if (input > max_prime) max_prime = input;
    ++n_inputs;
    inputs.push_back(input);
  }

  vector<bool> primes_bool(max_prime + 1, true);

  int cur_prime = 2;
  while (cur_prime <= max_prime) {
    if (primes_bool[cur_prime] == true) {
      for (int l = cur_prime * 2; l <= max_prime; l += cur_prime) {
	primes_bool[l] = false;
      }
    }
    ++cur_prime;
  }



  //solve for each inputs
  for (int i = 0; i < n_inputs; ++i) {
    queue<int> primes_Q;
    int cur_input = inputs[i];
    for (int j = 2; j <= cur_input; ++j) {
      if (primes_bool[j] == true) { //if prime
	primes_Q.push(j);
      }
    }
    queue<int> sum_Q;

    int count = 0; //count of sums
    int cur_sum = 0; //dynamic sum

    while (true) {
      if (cur_sum == cur_input) {
	++count;
	cur_sum -= sum_Q.front();
	sum_Q.pop();
      } else if (cur_sum < cur_input) {
	if (primes_Q.empty()) break;
	cur_sum += primes_Q.front();
	sum_Q.push(primes_Q.front());
	primes_Q.pop();
      } else if (cur_sum > cur_input) {
	cur_sum -= sum_Q.front();
	sum_Q.pop();
      }
    }

    cout << count << endl;
  }
}
    
      
      

  
  

  
  
  
    

Measured memory_bytes: 1228
#include <map>
#include <list>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#define fast ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
using namespace std;
int n,m;
int main()
{
	fast;
	cin>>n>>m;
	cout<<n*n-m<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<long long> vll;
typedef vector<pair<int,int>> vpi;
typedef vector<pair<long long, long long>> vpl;
typedef pair<int,int> pii;
typedef pair<long long, long long> pll;
#define INF (int)(1e9)
#define MAXX 1.1529215e+18
#define inf 999999
#define EPS (1e-7)
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define REP(i,n) for(int i=1;i<=(int)(n);i++)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define ALL(a)  a.begin(),a.end()
#define RALL(a) a.begin(),a.end(),greater<int>()
#define ROT(a) a.begin(),a.begin()+1,a.end()
#define RROT(a) a.begin(),a.end()-1,a.end()
#define PB push_back
#define MP make_pair
#define PI acos(-1.0)
#define sz(a) a.size()
const ll MOD = 1e9+7;
const int MAX = 10000000;
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }
//cout << 'H' << endl;
/*--------------------------------------------*/

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

    int N;
    cin >> N;

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


    ll ans = MAXX;

    for(int i = 1;i <= 100;i++){
        ll tmp = 0;
        rep(j,N){
            tmp += (x[j] - i) * (x[j] - i); 
        }

        chmin(ans,tmp);
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
s = int(input())
a = [s]
for i in range(1, 1000001):
    ai = (a[i - 1] / 2) * (a[i - 1] % 2 == 0) + (3 * a[i - 1] + 1) * (a[i - 1] % 2 == 1)
    a.append(ai)
    #print(a)
    if ai in a[:-1]:
        print(i+1)
        break

Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {

    private final static Scanner sc = new Scanner(System.in);

    /**
     * 本処理を実行します。
     */
    public static void execute() {
        String s = nextString();

        for (int i = 0; i < s.length(); i++) {
            if (s.charAt(i) == '9') {
                out("Yes");
                return;
            }
        }
        out("No");
    }

    /**
     * 次の標準入力をintで受け取ります。
     * @return 標準入力値(int)
     */
    public static int nextInt() {
        return sc.nextInt();
    }

    /**
     * 次の標準入力をStringで受け取ります。
     * @return 標準入力値(String)
     */
    public static String nextString() {
        return sc.next();
    }

    /**
     * 次の標準入力を指定回数分intで受け取ります。
     * @param n 取得回数
     * @return 取得した標準入力値の配列(int)
     */
    public static int[] nextInts(int n) {
        int[] arr = new int[n];

        for (int i = 0; i < n; i++) {
            arr[i] = nextInt();
        }

        return arr;
    }

    /**
     * 標準出力にオブジェクトを出力します。
     * @param o 出力対象
     */
    public static void out(Object o) {
        System.out.println(o);
    }

    public static void main(String[] args) {
        execute();
    }
}


Measured memory_bytes: 22228
#include<bits/stdc++.h>
using namespace std;
#define lli long long int
const lli mod=1e9+7;
const lli pINF=100000000000000000;
const lli nINF=-LLONG_MAX;
void fast() {std::ios::sync_with_stdio(false);cin.tie(NULL);}
lli power(lli a,lli b){lli ans=1;while(b!=0){ if(b%2==1){ans*=a;}b/=2;a*=a;} return ans;}
lli invmod(lli a) {return pow(a,mod-2);}
#define vi vector<int>
#define vlli vector<lli>
#define pb push_back
#define mp make_pair
#define F first
const int INF = 0x3f3f3f3f ;
#define PII pair<int,int>
#define S second
#define si(n) scanf("%d",&n)
#define sli(n) scanf("%lld",&n)
#define printi(n) printf("%d\n",n)
#define printli(n) printf("%lld\n",n)
#define all(v) v.begin(),v.end()
#define forn(i,n) for(int i=0;i<n;i++)
void print(int a[],int n){for(int i=0;i<n;i++) cout<<a[i]<<" ";}
 
int main() 
{
    int a,b,c,d;
    si(a);si(b);si(c);si(d);
    
    if((abs(a-b)<=d && abs(b-c)<=d) || (abs(a-c)<=d)) cout<<"Yes\n";
    else cout<<"No\n";
    return 0;
} 

Measured memory_bytes: 256
/*
 *  Created on: 24-October-2019
 *      Author: ankur314
 */
#include <bits/stdc++.h>
#define lli long long int
#define li long int
#define db double
#define ldb long double
#define vr vector
#define it iterator
#define fi(i,a,n) for(int i=a;i<n;i++)
#define fli(i,a,n) for(long int i=a;i<n;i++)
#define flli(i,a,n) for(long long int i=a;i<n;i++)
#define pb(n) push_back(n)
#define ppf() pop_front()
#define pii pair<int,int>
#define MOD 1000000007
 
#define debug1(x) cout<<x<<"\n"
#define debug2(x,y) cout<<x<<" "<<y<<"\n"
#define debug3(x,y,z) cout<<x<<" "<<y<<" "<<z<<"\n"
#define debug4(x,y,z,w) cout<<x<<" "<<y<<" "<<z<<" "<<w<<"\n"
 
using namespace std;

int main(){
    ios_base::sync_with_stdio(false);cin.tie(NULL);
    /*freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);*/
    int n; cin>>n;
    int k; cin>>k;
    lli h[n+1];
    fi(i,1,n+1) cin>>h[i];
    lli dp[n+1];
    dp[0] = dp[1] = 0;
    fi(i,2,n+1) dp[i] = INT_MAX;
    fi(i,2,n+1)
    {
    	fi(j,1,k+1)
    	{
    		if(i-j > 0) dp[i] = min(dp[i], dp[i-j] + abs(h[i] - h[i-j]));
    	}
    }
    cout<<dp[n];
    return 0;
}

Measured memory_bytes: 1792
#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 itrep(it, a) for(it = (a).begin(); it != (a).end(); it++)
#define all(a) (a).begin(), (a).end()
#define debug(x) cout << "debug " << x << endl;
#define INF (1 << 30)
using namespace std;

string solve(int n){
    int k = 1;
    string ans;
    while(k <= n) k*=4;
    k/=4;

    if(k == 0) return "0";
    while(k != 0){
        int a = n / k;
        ans+=a + '0';
        n%=k;
        k/=4;
    }
    return ans;
}

int main(){
    int n;
    while(cin >> n, n != -1){
        cout << solve(n) << endl;
    }
}

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

using namespace std;

struct Initializer {
  Initializer() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(15);
  }
} initializer;

int main() {
  int n, a, b, r = 0;
  cin >> n >> a >> b;
  for (int i = 0; i < n; ++i) {
    int t;
    cin >> t;
    if (a <= t && t < b) ++r;
  }
  cout << n - r << endl;
}



Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<set>
#define int long long
#define mod 1000000007
#define for0(i, n) for(int i = 0; i < (n); i++)
#define for1(i, n) for(int i = 1; i <= (n);i++)
using namespace std;
int ans;
signed main() {
	string s; cin >> s >> s;
	for (char i = '0'; i <= '9'; i++) {
		for (char j = '0'; j <= '9'; j++) {
			for (char k = '0'; k <= '9'; k++) {
				int flag = 0;
				for (char si : s) {
					if (flag == 0 && si == i)flag++;
					else if (flag == 1 && si == j)flag++;
					else if (flag == 2 && si == k)flag++;
				}
				if (flag == 3) 	ans++;
			}
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
/*
    ahuhu :((
*/
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <utility>
#include <queue>
#include <deque>
#include <string>
#include <cstring>
using namespace std;

#define SZ size()
#define BG begin()
#define ED end()
#define pb push_back
#define mp make_pair
#define st first
#define nd second
#define FOR(i, a, b)  for (int i = (a), _b = (b);  i< _b; ++i)
#define FORD(i, a, b) for (int i = (a), _b = (b); i >= _b; --i)
#define FORE(i, a, b) for (int i = (a), _b = (b); i <= _b; ++i)
#define openfile ({freopen(TASK".inp", "r", stdin); freopen(TASK".out", "w", stdout);})

typedef vector <int> VI;
typedef pair <int, int> II;
typedef long long LL;
typedef long double LD;

const int N = (int) (2505);
const int LOGN = log2(N) + 2;
const LL MOD = (LL) (1e9 + 7);
const LL INF = (LL) 1e18;
const double PI = 2 * acos(0);
const double EPS = 1e-9;

template <typename T> inline void read(T &n) {
    n = 0; char ch; bool neg = false;
    for (ch = getchar(); ch < '0' || ch > '9'; ch = getchar()) if (ch == '-') neg = !neg; n = ch - 48;
    for (ch = getchar(); ch >= '0' && ch <= '9'; ch = getchar()) n = (n << 1) + (n << 3) + ch - 48; if (neg) n = -n;
}
template <typename T> inline void writee(T n) { if (n > 9) writee(n / 10); putchar(n % 10 + 48); }
template <typename T> inline void write(T n) { if (n < 0) { putchar('-'); n = -n; } writee(n); }
template <typename T> inline void writeln(T x) { write(x); putchar('\n'); }
inline long long __lcm(long long a, long long b) { return a / __gcd(a, b) * b; }
inline long long power(long long a, long long n) {
    long long r = 1;
    while (n) {
        if (n & 1) r = r * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return r;
}
inline void add(int &a, const int& b) { a = (a + b) % MOD; }
inline void sub(int &a, const int& b) { a = (a - b + MOD) % MOD; }

char s[100];


int main() {
    ios_base :: sync_with_stdio(false); cin.tie(NULL);
    cin >> s + 1;
    int n = strlen(s + 1);
    for (int i = 1; i <= n - 8; i++) cout << s[i];
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string.h>
using namespace std;
int main()
{
    int p=0,r=0,ans=0,i;
    char s[100001];
    cin>>s;
    for(i=0;i<strlen(s);i++){
        if(p==r){
            r++;
            if(s[i]=='p') ans--;
        }
        else{
            p++;
            if(s[i]=='g') ans++;
        }
    }
    cout<<ans<<endl;
}



Measured memory_bytes: 384
#include <stdio.h>
#include <iostream>
#include <string>
#include <stdlib.h>
#include<cmath>
#include<vector>
#include<map>
#include<algorithm>

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

using namespace std;
typedef long long ll;



int main(void){
	int a = 1, b = 0, c = -1, k;
	int A, B, C;
	cin >> A >> B >> C >> k;

	if (k < A ) {
		cout << k;
	}
	else if(k<=(A+B)){
		cout << A;
	}
	else {
		int ans = A * a + (k-A-B) * c;
		cout << ans;
	}
	

	cout << endl;
}


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

int main() {
  int a, b;
  cin >> a >> b;
  for(int i = 0; i < 3; i++) {
    if(i + 1 != a && i + 1 != b) {
      cout << i + 1 << endl;
    }
  }
}

Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG

#include<bits/stdc++.h>
using namespace std;

#define endl '\n'
#define lfs cout<<fixed<<setprecision(10)
#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()
#define spa << " " <<
#define fi first
#define se second
#define MP make_pair
#define MT make_tuple
#define PB push_back
#define EB emplace_back
#define rep(i,n,m) for(ll i = (n); i < (ll)(m); i++)
#define rrep(i,n,m) for(ll i = (ll)(m) - 1; i >= (ll)(n); i--)
using ll = long long;
using ld = long double;
const ll MOD1 = 1e9+7;
const ll MOD9 = 998244353;
const ll INF = 1e18;
using P = pair<ll, ll>;
template<typename T1, typename T2>
bool chmin(T1 &a,T2 b){if(a>b){a=b;return true;}else return false;}
template<typename T1, typename T2>
bool chmax(T1 &a,T2 b){if(a<b){a=b;return true;}else return false;}
ll median(ll a,ll b, ll c){return a+b+c-max({a,b,c})-min({a,b,c});}
void ans1(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
template<typename T1,typename T2>
void ans(bool x,T1 y,T2 z){if(x)cout<<y<<endl;else cout<<z<<endl;}  
template<typename T>
void debug(vector<vector<T>>&v,ll h,ll w){for(ll i=0;i<h;i++)
{cout<<v[i][0];for(ll j=1;j<w;j++)cout spa v[i][j];cout<<endl;}};
void debug(vector<string>&v,ll h,ll w){for(ll i=0;i<h;i++)
{for(ll j=0;j<w;j++)cout<<v[i][j];cout<<endl;}};
template<typename T>
void debug(vector<T>&v,ll n){if(n!=0)cout<<v[0];
for(ll i=1;i<n;i++)cout spa v[i];cout<<endl;};
template<typename T>
vector<vector<T>>vec(ll x, ll y, T w){
  vector<vector<T>>v(x,vector<T>(y,w));return v;}
ll gcd(ll x,ll y){ll r;while(y!=0&&(r=x%y)!=0){x=y;y=r;}return y==0?x:y;}
vector<ll>dx={1,0,-1,0,1,1,-1,-1};
vector<ll>dy={0,1,0,-1,1,-1,1,-1};
template<typename T>
vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
template<typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v(ts...))>(a,make_v(ts...));
}
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2>&p){
  return os << p.first << " " << p.second;
}  
vector<ll>a(200005),ret(200005);
void dfs(ll k,vector<vector<ll>>&g,ll par,vector<ll>&dp){
  ll idx=lower_bound(ALL(dp),a[k])-dp.begin();
  ll pre_val=dp[idx];
  dp[idx]=a[k];
  ret[k]=lower_bound(ALL(dp),INF)-dp.begin()-1;
  //cout<<k<<endl;debug(dp,7);
  for(auto to:g[k]){
    if(to != par){
      dfs(to,g,k,dp); 
    }
  }
  dp[idx]=pre_val;
}
int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  ll res=0,buf=0;
  bool judge = true;
  ll n;cin>>n;
  rep(i,0,n)cin>>a[i];
  vector<vector<ll>>g(n);
  rep(i,0,n-1){
    ll u,v;cin>>u>>v;u--;v--;
    g[u].PB(v);
    g[v].PB(u);
  }
  vector<ll>dp(n+2,INF);
  dp[0]=0;
  dfs(0,g,-1,dp);
  rep(i,0,n)cout<<ret[i]<<endl;
  return 0;
}

Measured memory_bytes: 33268
// In The Name Of God
#include<bits/stdc++.h>
using namespace std;

#define F first
#define S second
#define mp make_pair
#define pb push_back
#define int long long
#define ll long long
#define for2(a,b,c) for(int (a) = (b); (a) < (c); (a)++)
#define setp cout << fixed << setprecision(15)
//#define endl "\n"
#define minit(a,b) a = min(a,b)
#define maxit(a,b) a = max(a,b)
#define PII pair<int,int>
#define Vec vector<int>
#define error(x) cerr << #x << " = " << (x) << endl;
#define all(x) (x).begin() , (x).end()

const int maxn = 52;
int dp[maxn][maxn];
int a[maxn],b[maxn];
int can[maxn];

int32_t main(){
   // ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    int n; cin >> n;
    for2(i,0,n) cin >> a[i];
    for2(i,0,n) cin >> b[i];
    for2(i,0,maxn) for2(j,0,maxn){
        dp[i][j] = (1ll<<51);
        for2(k,1,maxn) dp[i][j] = min(dp[i][j],(1ll<<k) + dp[i%k][j] );
        if(i==j) dp[i][j] = 0;
    }
 //   cout << 36 << endl;
    int ans = 0;
    vector<int> v;
    for2(stp,0,52){
        int mx = 0;
        for2(i,0,n){
            int x = a[i];
            int y = b[i];
            fill(can,can+maxn,0);
            can[x] = 1;
            int cost = dp[x][y];
            for(int i = x; i >= 0; i--)if(can[i]){
                for(auto t : v) can[i%t] = 1;
                cost = min(cost,dp[i][y]);
            }
            mx = max(mx,cost);
        }
        if(!mx)break;
        for(int i = 51; i >= 0;i--)if((1ll<<i)&mx){
            v.pb(i);
            ans += (1ll<<i);
            break;
        }
    }
    if(ans >= (1ll<<51)) ans = -1;
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
typedef pair<int, int> Pint;
typedef pair<int64_t, int64_t> Pll;


int main() {
    int H, W;
    cin >> H >> W;
    for (int i = 0; i < H; i++){
        for (int j = 0; j < W; j++){
            string S;
            cin >> S;
            if (S == "snuke"){
                cout << char('A' + j) << i + 1 << endl;
                return 0;
            }
        }
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std ;
 
#define lli long long int
#define pb push_back
#define MAXN 500001

set <int> s [26] ;
int main()
{
    int n ;
    cin >> n ;

    string st ;
    cin >> st ;

    for (int i = 0 ; i < st.size() ; i++)
    {
        s[st[i] - 'a'].insert(i) ;
    }
    
    int q ;
    cin >> q ;

    while(q--)
    {
        int type ;
        cin >> type ;

        if (type == 1)
        {
            int k ;
            char c ;

            cin >> k >> c ;
            k-- ;

            s[st[k] - 'a'].erase(k) ;
            s[c - 'a'].insert(k) ;
            st[k] = c ;
        }
        else if (type == 2)
        {
            int l , r ;
            cin >> l >> r ;

            l-- ;
            r-- ;

            int ans = 0 ;

            for (int i = 0 ; i < 26 ; i++)
            {
                auto it = s[i].lower_bound(l) ;

                if (it != s[i].end() && *it <= r)
                {
                    ans++ ;
                } 
            }

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

Measured memory_bytes: 24196
#include<iostream>
#include<queue>
#include<algorithm>
using namespace std;
priority_queue<int,vector<int>,greater<int> > que;
const int maxn=1e5+10;
struct ak{
    int num,val;
}a[maxn];

bool cmp(ak x,ak y){
    return x.val>y.val;
}

int main()
{
    int n,m;
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    while(cin >> n >> m){
        int x;
        for(int i=0;i<n;i++){
            cin >> x;
            que.push(x);
        }

        for(int i=1;i<=m;i++)
            cin >> a[i].num >> a[i].val;
        sort(a+1,a+1+m,cmp);


        for(int i=1;i<=m;i++){
            if(a[i].val<que.top())
                break;

            for(int j=0;j<a[i].num;j++){
                if(que.top()<a[i].val){
                    int y=a[i].val;
                    que.pop();
                    que.push(y);
                }else{
                    break;
                }
            }

        }


        long long sum=0;
        while(!que.empty()){
            sum+=que.top();
            //cout << que.top() << " ";
            que.pop();
        }
        //cout << endl;
        cout << sum << endl;
    }
    return 0;
}

Measured memory_bytes: 1528