akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define ff first
#define ss second
vector<set<int>> v;
vector<bool> vi;
set<int> xt;
void dfs(int r)
{
 if(vi[r])
 return;
 vi[r]=true;
 xt.insert(r);
 for(auto it:v[r])
 {
  if(!vi[it])
  dfs(it);
 }
}
int main(void){
    // Your code here!
 int i,ans,n,m,x,y;
 ans=INT_MIN;
 cin >> n >> m;
 v.resize(n);
 vi.resize(n,false);
 while(m--)
 {
  cin >> x >> y;
  v[x-1].insert(y-1);
  v[y-1].insert(x-1);
 }
 for(i=0;i<n;i++)
 {
  if(!vi[i])
  {
   xt.clear();
   dfs(i);
   ans=max(ans,(int)(xt.size()));
  }
 }
 cout << ans;
 return 0;
}

Measured memory_bytes: 53280
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>

int main() {
    int N;
    std::cin >> N;
    std::map<std::string, int> anagram;
    for (int i = 0; i < N; i++) {
        std::string str_in;
        std::cin >> str_in;
        std::sort(str_in.begin(), str_in.end(),
                  [](const auto &lhs, const auto &rhs){return int(lhs) < int(rhs);});
        if (anagram.find(str_in) == anagram.end()) {
            anagram[str_in] = 1;
        } else {
            anagram[str_in]++;
        }
    }

    long long count = 0;
    for (auto && item : anagram) {
        long long num = item.second;
        count += num * (num - 1) / 2;
    }

    std::cout << count << std::endl;
}


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

int main(){
  int a,b;
  cin >>a >>b;
  int ans = -1;
  for(int i = 1;;i++){
    int hachi = i*0.08;
    int juu = i*0.1;
    if(hachi==a && juu==b) {
      ans = i;
      break;
    }
    if(hachi>a && juu>b) break;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int T, card[9];
bool is_good_set(int a, int b, int c);
bool is_same_number(int a, int b, int c);
bool is_sequence(int a, int b, int c);
bool is_all_good_set();
bool win();
int main(){
  cin >> T;
  for (int t=0; t<T; ++t){
    for (int i=0; i<9; ++i){
      cin >> card[i];
      //      cout << card[i];
    }
    //    cout << endl;
    string color;
    for (int i=0; i<9; ++i){
      cin >> color;
      //      cout << color;
      if (color == "G") card[i] += 10;
      else if (color == "B") card[i] += 20;
      //      cout << card[i];
    }
    cout << win() << endl;
  }
}
bool is_good_set(int a, int b, int c){
  return is_same_number(a,b,c) || is_sequence(a,b,c);
}
bool is_same_number(int a, int b, int c){
  return (a==b)&&(b==c);
}
bool is_sequence(int a, int b, int c){
  return ((a+2)==(b+1))&&((b+1)==c);
}
bool is_all_good_set(){
  return is_good_set(card[0],card[1],card[2])
    &&is_good_set(card[3],card[4],card[5])
    &&is_good_set(card[6],card[7],card[8]);
}
bool win(){
    sort(card, card+9);
    bool win = false;
    do {
      if (is_all_good_set()) win = true;
    } while(next_permutation(card,card+9));
    return win;
}

Measured memory_bytes: 1224
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,N) for(int i = 0;i < (int)(N);i++)
int main(){
  ll n,a,b;
  cin>>n>>a>>b;
  ll i=n/(a+b);
    ll ans=a*i+n%(a+b);
  ll r=n%(a+b);
    if(r>a){
       ans=a*i+a;
    }
  cout<<ans<<endl;
        
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
    static Scanner sc = new Scanner(System.in);
    static int[] array;
    public static void main(String[] args) {
        read();
        solve();
    }
 
    static void read(){
        array = new int[10];
        for(int i = 0; i < 10; i++){
            array[i] = sc.nextInt();
        }
    }
 
    static void solve(){
        Arrays.sort(array);
        System.out.println(array[9]);
        System.out.println(array[8]);
        System.out.println(array[7]);
    }
 
}

Measured memory_bytes: 26076
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>
#include <bitset>
#include <time.h>
#include <tuple>
#include <iomanip>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = 1e12;
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,N) for(int i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second
#define N_SIZE (1LL << 20)
#define NIL -1

int a,b;

int main(){
	cin >> a >> b;
	cout << (a+b)/2 + (a+b)%2 << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <functional>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

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

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

#include <chrono>

struct Timer{
    chrono::system_clock::time_point start_t;
    void start(){
        start_t = chrono::system_clock::now();
    }
    double now(){
        chrono::system_clock::time_point now_t = chrono::system_clock::now();
        return chrono::duration_cast<std::chrono::milliseconds>(now_t - start_t).count() / 1000.0;
    }
} timer;

unsigned long xor128(void){
    static unsigned long x=123456789,y=362436069,z=521288629,w=88675123;
    unsigned long t;
    t=(x^(x<<11));x=y;y=z;z=w; return( w=(w^(w>>19))^(t^(t>>8)) );
}

ll rand(ll x){
    return xor128() % x;
}
ll rand(ll x, ll y){
    return x + (xor128() % (y - x));
}

int n, m = 26;
VI c;
VVI s;

int calc_score(VI t){
    VI last(m, -1);
    int ret = 0;
    REP(i,n){
        ret += s[i][t[i]];
        last[t[i]] = i;
        REP(j,m) ret -= c[j] * (i - last[j]);
    }
    return ret;
}

void output(VI t){
    REP(i,t.size()) printf("%d\n", t[i] + 1);
}

int main(void){
    cin >> n;
    c.assign(m, 0);
    REP(i,m) c[i] = in();
    s.assign(n, VI(m));
    REP(i,n) REP(j,m) s[i][j] = in();

    VI t(n);
    REP(i,n){
        t[i] = max_element(ALL(s[i])) - s[i].begin();
    }

    int score = calc_score(t);

    REP(_,100000){
        VI tt(t);
        int i = rand(n);
        tt[i] = (tt[i] + rand(m - 1)) % m;
        int score_next = calc_score(tt);
        if (score_next > score){
            t = tt;
            score = score_next;
        }
    }

    output(t);

    return 0;
}


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

int main(){
  int n,m;
  cin >> n >> m;

  static int dp[100001] = {0};
  rep(i,m){
    int a;
    cin >> a;
    dp[a] = -1;
  }
  dp[0] = 1;
  rep(i,n+1){

    if(dp[i] == -1) continue;
    
    int ni = i + 1;
    if(ni > n) continue;
    if(dp[ni] != -1) dp[ni] += dp[i];
    dp[ni] = dp[ni]%1000000007;

    int nni = i + 2;
    if(ni > n) continue;
    if(dp[nni] != -1) dp[nni] += dp[i];
    dp[nni] = dp[nni]%1000000007; 
  }
  cout << dp[n] << endl;
}

Measured memory_bytes: 4036
#define rep(i,n) for(ll i=0;i<(n);++i)

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

int n;
string s;
    
void input(){
    cin>>n>>s;
}

void src(){
    int sum=1;
    rep(i,n-1){
        if(s[i]!=s[i+1]) sum++;
    }
    cout<<sum;
    return;
}

int main(int argc,char* argv[]){
    //ifstream in( argv[1] );
    //cin.rdbuf(in.rdbuf());
    input();
    src();    
    return 0;
}

Measured memory_bytes: 512
#include<iostream>
#include<iomanip>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<unordered_map>
#include<stack>
#include<queue>
#include<math.h>
#include<functional>
#include<bitset>
using namespace std;
using ll = long long;
using ld = long double;
using pint = pair<int, int>;
using pll = pair<ll, ll>;
#define MOD 1000000007LL
#define INF 1000000000LL
#define EPS 1e-10
#define FOR(i,n,m) for(ll i=n;i<(int)m;i++)
#define REP(i,n) FOR(i,0,n)
#define DUMP(a) REP(d,a.size()){cout<<a[d];if(d!=a.size()-1)cout<<" ";else cout<<endl;}
#define ALL(v) v.begin(),v.end()
#define UNIQUE(v)  sort(ALL(v));v.erase(unique(ALL(v)),v.end());
#define pb push_back

#define MAX_N 1000000
long long extgcd(long long a, long long b, long long& x, long long& y) {
	long long d = a;
	if (b != 0) {
		d = extgcd(b, a % b, y, x);
		y -= (a / b) * x;
	} else {
		x = 1; y = 0;
	}
	return d;
}
long long mod_inverse(long long a, long long m) {
	long long x, y;
	if(extgcd(a, m, x, y) == 1) return (m + x % m) % m;
	else return -1;
}
vector<long long> fact(MAX_N+1, INF);
long long mod_fact(long long n, long long& e) {
	if(fact[0] == INF) {
		fact[0]=1;
		if(MAX_N != 0) fact[1]=1;
		for(ll i = 2; i <= MAX_N; ++i) {
			fact[i] = (fact[i-1] * i) % MOD;
		}
	}
	e = 0;
	if(n == 0) return 1;
	long long res = mod_fact(n / MOD, e);
	e += n / MOD;
	if((n / MOD) % 2 != 0) return (res * (MOD - fact[n % MOD])) % MOD;
	return (res * fact[n % MOD]) % MOD;
}
// return nCk
long long mod_comb(long long n, long long k) {
	if(n < 0 || k < 0 || n < k) return 0;
	long long e1, e2, e3;
	long long a1 = mod_fact(n, e1), a2 = mod_fact(k, e2), a3 = mod_fact(n - k, e3);
	if(e1 > e2 + e3) return 0;
	return (a1 * mod_inverse((a2 * a3) % MOD, MOD)) % MOD;
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n;
	string s;
	cin >> n >> s;
	vector<ll> c(26, 0);
	REP(i, n) {
		c[s[i] - 'a']++;
	}
	ll ans = 1;
	REP(i, 26) {
		ans *= (c[i] + 1);
		ans %= MOD;
	}
	ans--;
	cout << ((ans % MOD) + MOD) % MOD << endl;
	return 0;
}

/* --------------------------------------- */


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

int calc(int lhs, int rhs, char op)
{
    int result = 0;

    switch (op)
    {
        case '+':
            result = lhs + rhs;
            break;

        case '-':
            result = lhs - rhs;
            break;
    }

    return result;
}

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

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

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

    int arr[n];
    float sum=0;
    for(int i=0; i<n; i++){
        cin>>arr[i];
        sum += arr[i];
    }

    int p = round(sum/n);
    int s = 0;
    for(int i=0; i<n; i++){
        s += (arr[i]-p)*(arr[i]-p);
    }
    cout<<s<<endl;
}

Measured memory_bytes: 512
x=int(input())
#print(x)

list1=[1]
for i in range(2,32):
  n=2
  while i**n <= 1000:
    list1.append(i**n)
    n+=1

list1.sort()
#print(list1)

list1=[i for i in list1 if i <= x]

print(max(list1))

Measured memory_bytes: 3316
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
typedef long double ld;
const ll INF = 1e+14;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
 
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  
  string S; cin >> S;
  ll count = 0, ans = 0;
  rep(i, S.size()) {
      if (S[i] == 'B') count ++;
      if (S[i] == 'W') ans += count;
  }
 cout << ans << endl;

  
  return 0;
}


Measured memory_bytes: 720
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define rep(i,n) for(int i=0;i<n;i++)
#define mod 1000000007 // 10^9+7
#define INF 99999999999 //10^12-1
#define P pair<int,int>
#define prique priority_queue
int n,t,ans=0;
int ti[222222];
signed main(){
    cin>>n>>t;
    rep(i,n)cin>>ti[i];
    rep(i,n-1){
        ans+=min(t,ti[i+1]-ti[i]);
    }
    ans+=t;
    cout<<ans<<endl;
    return 0;
}




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

using namespace std;

int main() {
    while(true) {
        string s;
        if(!(cin >> s)) break;

        int joi = 0;
        int ioi = 0;

        for(int i = 0; i < s.size()-2; ++i) {
            if(s[i] == 'J') {
                if(s[i+1] == 'O' && s[i+2] == 'I') ++joi;
            }
            if(s[i] == 'I') {
                if(s[i+1] == 'O' && s[i+2] == 'I') ++ioi;
            }
        }
        cout << joi << endl;
        cout << ioi << endl;
    }
    return 0;
}

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

int main(int, char**) {
  int n, p;
  std::string s;
  std::cin >> n >> p >> s;

  if(p == 2 || p == 5) {
    unsigned long long cnt{};
    for(int i{}; i < n; ++i) {
      if((s[i] - '0') % p == 0) {
        cnt += i + 1;
      }
    }
    std::cout << cnt << std::endl;
    return 0;
  }

  std::vector<int> us(n);
  int uMod{};
  int pow10Mod{1};
  for(int i{n-1}; i >= 0; --i) {
    int at{s[i] - '0'};
    if(i != n - 1) {
      pow10Mod *= 10;
      pow10Mod %= p;
    }
    uMod = at * pow10Mod + uMod;
    uMod %= p;
    us[i] = uMod;
  }

  /*
  for(auto e: us) std::cout << e << ", ";
  std::cout << std::endl;
  */

  unsigned long long cnt{};
  for(int i{}; i < p; ++i) {
    unsigned long long c = count(begin(us), end(us), i);
    if(i == 0) {
      cnt += c;
    }
    cnt += c * (c - 1) / 2;
 //   std::cout << "i: " << i << ", c: " << c << ", *" << ": " << (c * (c - 1) / 2) << std::endl;
  }
  std::cout << cnt << std::endl;

  return 0;
}



Measured memory_bytes: 1412
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <cstdio>
#include <cstdint>
#include <iostream>
#include <algorithm>
using namespace std;

int_fast8_t d;
uint_fast32_t M = 0;
uint_fast64_t c, sd = -1, sc = -1;
constexpr uint_fast32_t buff_size = 1 << 22;
char buff[buff_size], *ci = buff + buff_size, *ce = ci, ct;

inline char read_input() {
    if (ci == ce) { fread_unlocked(buff, 1, buff_size, stdin); ci = buff; }
	return *ci++;
}

int main() {
    while((ct=read_input()) > 47) M = (M<<1) + (M<<3) + ct - 48;
    while(M--) {
        d = *ci - 48;
        ci += 2;
        for(c=0; *ci > 47;) c = (c<<1) + (c<<3) + *ci++ - 48;
        ci++;
        sc += c;
        sd += c * d;
    }
    printf("%lld", sc + sd / 9);
	return 0;
}


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

int main() {
  int n;
  cin>>n;
  
  int s[n];
  for(int i=0; i<n; i++) cin >> s[i];
  
  int ans=10000000;
  int now=0;
  
  for(int i=1; i<=100; i++){
    for(int j=0; j<n; j++){
      now=now+(s[j]-i)*(s[j]-i);
    }
    ans=min(ans,now);
    now=0;
  }
  
  cout << ans << endl;
  
}

Measured memory_bytes: 256
import java.io.IOException;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws IOException {
		Scanner in = new Scanner(System.in);
		int a = in.nextInt();
		int b = in.nextInt();
		int c = in.nextInt();
		int tempA = 0;
		int tempB = 0;
		int tempC = 0;
		int count = 0;


		if(a==b && b==c){
			if(a%2!=1){
				System.out.println(-1);
			}else{
				System.out.println(0);
			}
		}else{
			while(a%2!=1 && b%2!=1 && c%2!=1){
				tempA = a/2;
				tempB = b/2;
				tempC = c/2;
				a = tempB + tempC;
				b = tempC + tempA;
				c = tempA + tempB;
				count++;
			}
			System.out.println(count);
		}

	}

}


Measured memory_bytes: 24020
using System;

public class Test
{
	public static void Main()
	{
		string s = Console.ReadLine();
		
		if(0<=s.IndexOf('a')&&0<=s.IndexOf('b')&&0<=s.IndexOf('c'))
		{
			Console.WriteLine("Yes");
		}
		else
		{
			Console.WriteLine("No");
		}
	}
}

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




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

	int ans1 = 0;
	rep(i, 0, s.size()) {
		if (i % 2 == 0) {
			if (s[i] == '0')ans1++;
		}
		else {
			if (s[i] == '1')ans1++;
		}
	}
	int ans2 = 0;
	rep(i, 0, s.size()) {
		if (i % 2 == 0) {
			if (s[i] == '1')ans2++;
		}
		else {
			if (s[i] == '0')ans2++;
		}
	}
	cout << min(ans1, ans2) << endl;

	return 0;
}

Measured memory_bytes: 512
import sys
input=sys.stdin.readline

# 0以上整数x未満の素数のリストを返す(0,1は含まない)
import math
def primes(x):
    if x < 2: return []

    primes = [i for i in range(x)]
    primes[1] = 0

    for prime in primes:
        if prime > math.sqrt(x): break
        if prime == 0: continue
        for non_prime in range(2 * prime, x, prime): primes[non_prime] = 0

    return [prime for prime in primes if prime != 0]

def main():
    N = 10**5+1
    ps = primes(N)

    P = [0]*N
    for p in ps:
        P[p] = 1

    ruisekiwa = [0]*N
    for i in range(3, N, 2):
        if P[i] and P[(i+1)//2]:
            ruisekiwa[i] = 1
    for i in range(3, N):
        ruisekiwa[i] += ruisekiwa[i-1]
    
    Q = int(input())
    for _ in range(Q):
        l,r = map(int, input().split())
        ans = ruisekiwa[r] - ruisekiwa[l-1]
        print(ans)

if __name__ == '__main__':
    main()


Measured memory_bytes: 8840
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pi;
#define trace3(x, y, z) cerr << #x << ": " << x << ", " << #y < ": " << y << ", " << #z << ": " << z << endl;
#define all(v) v.begin(), v.end()

int main() {
	int n, m;
	cin >> n >> m;
	cout << n * (n - 1) / 2 + m * (m - 1) / 2 << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define all(x) x.begin(),x.end()
#define pll  pair <long long,long long>
#define ss second
#define ff first
#define inf 9223372036854775807
#define maa 1000000007
#define ld long double
#define fast  ios_base::sync_with_stdio(false);cin.tie(NULL);
#define bug(x) cout << #x <<": " << x << '\n';
const ll N=100001 ;
vector<ll>pa(N+1),sz(N+1) ;
ll get(ll i){
   while(pa[i]!=i) i=pa[i] ;

   return i ;
}
void mer(ll i,ll j)
{
    if(sz[i]>sz[j])
    {
        pa[j]=i ;
        sz[i]+=sz[j] ;
    }
    else
    {
        pa[i]=j ;
        sz[j]+=sz[i] ;
    }
}
int main()
{
   fast ;
   ll n,m,k ; cin>>n>>m>>k ;

   for(ll i=1;i<=n;i++) { pa[i]=i ; sz[i]=1 ; }

   vector<ll>f[N],d[N] ;
   for(ll i=0;i<m;i++)
   {
       ll a,b ;
       cin>>a>>b ;
       f[a].pb(b) ; f[b].pb(a) ;
       ll aa=get(a) ;
       ll bb=get(b) ;

       if(aa!=bb)
       {
           mer(aa,bb) ;
       }

   }
   for(ll i=0;i<k;i++){
    ll a,b ;
    cin>>a>>b ;
    d[a].pb(b) ; d[b].pb(a) ;
   }

   for(ll i=1;i<=n;i++)
   {
       ll p=get(i) ;
       ll ans=sz[p]-1 ;
       for(ll j:f[i])
       {
           ans-- ;
       }
       for(ll j:d[i])
       {
           if(get(j)==p) ans-- ;
       }

       cout<<ans<<" " ;

   }

}




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

int main(void) {
	char s[100];//,t[10],u[10];
	int i=0;

	scanf("%s",s);

	while(s[i]!='\0'){
		s[i]='x';
		i++;
	}
	printf("%s",s);
	return 0;
}


Measured memory_bytes: 128
#include <algorithm>
#include <cassert>
#include <deque>
#include <functional>
#include <iostream>
#include <iterator>
#include <limits>
#include <map>
#include <set>
#include <string>
#include <tuple>
#include <utility>
#include <vector>

using namespace std;

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

    vector<int> buckets(9);
    for (int i = 0; i < N; ++i) {
        int v;
        cin >> v;
        if (v >= 3200)
            ++buckets[8];
        else
            ++buckets[v / 400];
    }

    int colors = 0;
    for (int i = 0; i <= 7; ++i) {
        if (buckets[i]) {
            cerr << buckets[i] << '\n';
            ++colors;
        }
    }

    int minColors;
    int maxColors;
    if (buckets[8]) {
        minColors = max(colors, 1);
        maxColors = colors + buckets[8];
    } else {
        minColors = maxColors = colors;
    }

    cout << minColors << ' ' << maxColors << '\n';

    return 0;
}


Measured memory_bytes: 256
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <cstring>
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <cmath>
#include <numeric>
#include <float.h>
using namespace std;
// repマクロの定義
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
// allマクロの定義
#define all(v) v.begin(), v.end()
typedef unsigned long long ll;

 //最大公約数求める関数
auto my_gcd(auto n , auto m){
  if(n < m){
    auto tmp = n;
    n = m;
    m = tmp;
  }
  auto l  = n % m;
  while(l != 0){
    n = m;
    m = l;
    l = n % m;
}
return m;
}

//char⇒int関数
 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;
	}
}



int main(){
int N; cin >> N;
vector<int> h(101);
rep(i,N){
	cin >> h[i];
}
int i = 0;
int cnt = 0;
while(i < N){
	int a = i;
	if(h[i] != 0){
		cnt++;
	}
	while(h[i] != 0){
		h[i]--;
		i++;
	}
	
	if(h[a] != 0){
		i = a;
	}
	else{
		i = a+1;
	}
}
	cout << cnt << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <queue>
using namespace std;
int main(){
	char s[10];
	int key;
	priority_queue<int> p;
	while(1){
		scanf("%s",s);
        if(s[0]=='i'){
			scanf("%d",&key);
			p.push(key);
		}else if(s[1]=='x'){
			printf("%d\n",p.top());
			p.pop();
		}else if(s[0]=='e') {
			break;
		}
	}
	return 0;
}


Measured memory_bytes: 6984
package main

import (
	"fmt"
	"sort"
	"strings"
)

func input() string {
	var N, L int
	fmt.Scanf("%d %d", &N, &L)
	xarr := make([]string, N)
	for index := 0; index < N; index++ {
		fmt.Scanf("%s", &xarr[index])
	}
	sort.Strings(xarr)
	s := strings.Join(xarr, "")
	return s
}

func main() {
	c := input()
	fmt.Println(c)
}

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

void main_()
{
    ll H, W;
    vector<string> ass;
    cin >> H >> W;
    copy_n(istream_iterator<string>(cin), H, back_inserter(ass));

    // 横列が全て空の行を消去
    ass.erase(
        remove_if(begin(ass), end(ass),
            [](auto&& as) {
                return as.find_first_not_of('.') == string::npos;
            }),
        end(ass));

    // 縦列がすべて空のマスに削除マーク'x'をつける
    for (int i = 0; i < W; ++i) {
        if (all_of(begin(ass), end(ass), [i](auto&& as) { return as[i] == '.'; })) {
            for (auto&& as : ass) {
                as[i] = 'x';
            }
        }
    }

    // 削除マークがついたマスを削除
    for (auto&& as : ass) {
        as.erase(
            remove_if(begin(as), end(as),
                [](auto a) {
                    return a == 'x';
                }),
            end(as));
    }

    for (auto&& as : ass) {
        cout << as << "\n";
    }
}
int main()
{
    cin.tie(nullptr);
    cout.tie(nullptr);
    ios_base::sync_with_stdio(false);
    main_();
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <queue>
#include <stack>
#include <set>
using namespace std;
#define fi first
#define se second
typedef long long lli;
typedef pair<int, int> pii;
const int maxn = 1005;
const int MOD = 1e9 + 7;
int n, m;
char a[maxn][maxn];

int dp[maxn][maxn];

void ReadInput()
{
    cin >> n >> m;
    for(int i = 1; i <= n; ++i)
        for(int j = 1; j <= m; ++j)
            cin >> a[i][j];
}

inline void Add(int&tar, int val)
{
    tar += val;
    if(tar >= MOD) tar -= MOD;
}

void Solve()
{
    dp[1][1] = 1;
    for(int i = 1; i <= n; ++i)
        for(int j = 1; j <= m; ++j)
        {
            if(a[i][j] != '.') continue;
            if(i + 1 <= n && a[i + 1][j] == '.') Add(dp[i + 1][j], dp[i][j]);
            if(j + 1 <= m && a[i][j + 1] == '.') Add(dp[i][j + 1], dp[i][j]);
        }
    cout << dp[n][m] << '\n';
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    ReadInput();
    Solve();
}


Measured memory_bytes: 5248
from collections import Counter
from functools import reduce
import fractions
import math
import statistics
import sys
import time
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]  # LIST INT
def LF(): return [float(x) for x in sys.stdin.readline().split()]  # LIST FLOAT
def LS(): return sys.stdin.readline().split()  # LIST STRING
def MI(): return map(int, sys.stdin.readline().split())  # MAP INT
def II(): return int(sys.stdin.readline())  # INPUT INT
def IS(): return input()  # INPUT STRING
def P(x): return print(x)
def C(x): return Counter(x)
def GCD_LIST(numbers):  # greatest common divisor
    return reduce(fractions.gcd, numbers)
def LCM_LIST(numbers):  # least common multiple
    return reduce(LCM, numbers)
def LCM(m, n):
    return (m * n // fractions.gcd(m, n))


a, b = MI()
P('Yes') if a % 2 == 1 and b % 2 == 1 else P('No') 


Measured memory_bytes: 5124
// ヒント: atcoderの億マス計算と同じ?らしい
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#define rep(i, start, end) for (int i = (int)start; i < (int)end; ++i)
#define rrep(i, start, end) for (int i = (int)start - 1; i >= end; --i)
#define iter(i, c) for (auto i = (c).begin(); i != (c).end(); ++i)
#define riter(i, c) for (auto i = (c).rbegin(); i != (c).rend(); ++i)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
using namespace std;
using ll = long long;
using P = pair<ll, ll>;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N, M;
    cin >> N >> M;
    vector<ll> A(N);
    rep(i, 0, N) cin >> A[i];
    sort(all(A));
    vector<ll> cumsum(N + 1, 0);
    rep(i, 0, N) {
        cumsum[i + 1] = A[i] + cumsum[i];
    }
    ll l = 2, r = 202020;
    while (r - l > 1) {
        ll mid = (l + r) / 2;
        ll cnt = 0;
        rep(i, 0, N) {
            auto itr = lower_bound(all(A), mid - A[i]);
            cnt += (ll)(A.end() - itr);
        }
        if (cnt >= M) {
            l = mid;
        }
        else {
            r = mid;
        }
    }
    ll cnt = 0;
    ll ans = 0;
    rep(i, 0, N) {
        auto itr = lower_bound(all(A), l - A[i]);
        ll now_cnt = (ll)(A.end() - itr);
        cnt += now_cnt;
        ans += cumsum[N] - cumsum[(int)(itr - A.begin())];
        ans += A[i] * now_cnt;
    }
    ans -= l * (cnt - M);
    cout << ans << endl;
    return 0;
}

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

typedef long long ll;
const ll INF = (ll)1e18 + 1;
const ll MOD = 1e9 + 7;

void print(){ std::cout << std::endl; }
template <typename Head> void print(Head&& head) { std::cout << head << std::endl; }
template <typename Head, typename... Tail> void print(Head&& head, Tail&&... tail)
{
  std::cout << head << " ";
  print(std::forward<Tail>(tail)...); // or print(tail...);
}
template<typename Iterator> void printVec(Iterator begin, Iterator end)
{
  for (Iterator it = begin; it != end; it++) {
    std::cout << "[" << std::distance(begin, it) << "] " << *it << " ";
    if (std::distance(begin, it) % 20 == 19) { std::cout << std::endl; }
  }
  std::cout << std::endl;
}

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

  ll N, M;
  std::cin >> N >> M;
  std::vector< ll > va(M, 0LL);
  for (ll i = 0; i < N; i++) {
    ll K;
    std::cin >> K;
    for (ll j = 0; j < K; j++) {
      ll a;
      std::cin >> a;
      va[a-1]++;
    }
  }

  ll ans = 0;
  for (ll i = 0; i < M; i++) {
    if (va[i] == N) ans++;
  }

  print(ans);
  return 0;
}


Measured memory_bytes: 256
//
//  main.cpp
//  190113
//

#include <iostream>

int main(int argc, const char * argv[]) {
    // insert code here...
    int a[4];
    for(int i=0;i<4;i++){
        std::cin>>a[i];
    }
    int b[4]={1,9,7,4};
    int count=0;
    for(int i=0;i<4;i++){
        for(int j=0;j<4;j++){
            if(a[i]==b[j]){
                count+=1;
                b[j]=-1;
                break;
            }
        }
    }
    if(count==4){
        std::cout<<"YES\n";
    }else{
        std::cout<<"NO\n";
    }
    return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
import sys
from itertools import accumulate
INF = float("inf")

MOD = 1000000007  # type: int


def solve(N: int, x: "List[int]"):

    # hint[i]はi番目の要素より前のスペースの数
    hint = [(x[i]-1) - i for i in range(N)]
    # print(hint)
    ans = 1
    count = 1
    curr = 0

    # j回数える
    for j in range(N):
        # 前からゴール可能な数の個数を数える
        while True:
            # スペースの数 hint[curr]+j 個
            if curr >= N:
                break
            if count >= N-j:
                break
            if count-(hint[curr]+j) == 2:
                break
            count += 1
            curr += 1
        # print(count)
        ans *= count
        ans %= MOD
        count -= 1
    print(ans % MOD)

    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    x = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, x)


if __name__ == '__main__':
    main()


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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP0(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REP1(i,n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
#define RREP0(i,n) for(int i=n-1; i>=0; --i)
#define RREP1(i,n) for(int i=n; i>=1; --i)
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())
#define FILL(c, v) std::fill((c).begin(),(c).end(), v)
#define SZ(a) int((a).size())
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define CLR(a) memset((a), 0 ,sizeof(a))

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

typedef long long LL;

const int INTINF = 2147483647;
const LL LLINF = 9223372036854775807;
int gcd(int a,int b){return b?gcd(b,a%b):a;}

void solve() {
  int N; cin >> N;
  LL a, S = 0;
  vector<LL> A; A.reserve(N+1); FILL(A, 0);
  vector<LL> X; X.reserve(N+1); FILL(X, 0);
  REP1(i, N) { cin >> a; A[i] = a; S += a; }
  
  LL A_even=0;
  for (int i = 2; i < N; i+=2) A_even += A[i];
  X[1] = S - 2 * A_even;
  FOR(i, 1, N) X[i+1] = 2*A[i] - X[i];
  REP1(i, N) {
      cout << X[i];
      if (i!=N) cout << " ";
  }
  cout << endl;
}

int main(int argc, char const *argv[])
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  std::cout<<std::fixed<<std::setprecision(10);
  solve();
  return 0;
}

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

int main(int argc, char const *argv[]) {
  int R,G,B,N;
  scanf("%d %d %d %d",&R,&G,&B,&N);
  int ans = 0;
  int **matrix;
  int row = 3000, column = 3000;
  matrix = (int **)malloc(sizeof (int*) * row);
  int i,j;
  for(i = 0; i < row+1; i++){
     matrix[i] = (int *)malloc(sizeof (int) * column);
     for(j = 0; j < column+1;j++){
       if(G*i+B*j > N){
         matrix[i][j] = -1;
       }else{
         matrix[i][j] = G*i+B*j;
       }
     }
  }

  if(N%R == 0){
    ans++;
  }

  i = 0;
  j = 1;
  while(matrix[i][0]!=-1){
    while(matrix[i][j] != -1){
      if((N-matrix[i][j])%R == 0){
        ans++;
      }
      j++;
      if(j == 3001)break;
    }
    j = 0;
    i++;
    if(i == 3001)break;
  }

  free(matrix);

  printf("%d",ans);



  return 0;
}


Measured memory_bytes: 35456
package main

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

func scanInt() int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return i
}

func scanInt64() int64 {
	sc.Scan()
	i, _ := strconv.ParseInt(sc.Text(), 10, 64)
	return i
}

func scanInts(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = scanInt()
	}
	return res
}

func scanInts64(n int) []int64 {
	res := make([]int64, n)
	for i := range res {
		res[i] = scanInt64()
	}
	return res
}

var sc = bufio.NewScanner(os.Stdin)

type graph struct {
	d map[int]int
}

func main() {
	sc.Split(bufio.ScanWords)
	// INF := 100000000000000000

	n, k := scanInt(), scanInt()
	a := []int{0}
	a = append(a, scanInts(n)...)

	journey := []int{1}
	for i := 0; i < 2*n+100; i++ {
		next := a[journey[len(journey)-1]]
		journey = append(journey, next)
	}

	if k < n+1 {
		fmt.Println(journey[k])
		return
	}
	loopEnd := n
	loopStart := n - 1

	// ループを見つける
	for journey[loopStart] != journey[loopEnd] {
		loopStart--
	}
	period := loopEnd - loopStart

	k %= period

	for k < n {
		k += period
	}
	fmt.Println(journey[k])
}


Measured memory_bytes: 16356
#include<set>
#include<map>
#include<cmath>
#include<ctime>
#include<queue>
#include<stack>
#include<cstdio>
#include<string>
#include<vector>
#include<random>
#include<cstdlib>
#include<cstring>
#include<iomanip>
#include<iostream>
#include<algorithm>
#include<unordered_map>
#define endl "\n"
#define fi first
#define se second
#define db double
#define gcd __gcd
#define pb push_back
#define mp make_pair
#define lowbit(x) (x & (-x))
#define PII  pair<int, int> 
#define all(x) x.begin(), x.end()
#define debug(x) cout << #x << " = " << x << endl
#define rep(i, a, b) for(__typeof(b) i = a; i <= (b); i++)
#define Rep(i, a, b) for(__typeof(a) i = a; i >= (b); i--)
#define FAST ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
template<class T> inline T qmin(T a, T b) { return a < b ? a : b; }
template<class T> inline T qmax(T a, T b) { return a > b ? a : b; }
typedef long long ll;
typedef unsigned long long ull;
const db eps = 1e-9;
const db PI = acos(-1);
const int inf = 0x3f3f3f3f;
const int mod = (int)1e9 + 7;
const int maxn = (int)1e5 + 5;//remember to modify it, No RE or MLE
const ll INF = 0x3f3f3f3f3f3f3f3f;
using namespace std;

int n, k;
int dp[105][maxn];
int a[maxn], sum[maxn];

int cal(int r, int l){
	if(l <= 0) return sum[r];
	return (sum[r] - sum[l-1] + mod) % mod;
}

int main()
{
	scanf("%d %d", &n, &k);
	dp[0][0] = 1;
	rep(i, 1, n) scanf("%d", a + i), dp[i][0] = 1;
	rep(i, 1, n){
		sum[0] = dp[i-1][0];
		rep(j, 1, k) sum[j] = (sum[j-1] + dp[i-1][j]) % mod;
		rep(j, 1, k){
			dp[i][j] = cal(j, j - a[i]);
		}
	}
	printf("%d\n", dp[n][k]);
	return 0;
}

Measured memory_bytes: 40448
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define all(c) begin(c),end(c)

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; }

//改造
typedef long long int ll;
using namespace std;
#define INF (1 << 30) - 1
#define INFl (ll)5e15
#define DEBUG 0 //デバッグする時1にしてね
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007


//ここから編集する
class Solve {
public:

    void input() {

    }

    void solve() {
        input();
        string s;
        cin >> s;
        vector<int> v;
        for (int i = 0; i < s.size(); ++i) {
            v.push_back(s[i] - '0');
        }

        int ans = INF;
        for (int i = 0; i < v.size() - 2; ++i) {
            int j = i + 1;
            int k = j + 1;
            int num = v[i] * 100 + v[j] * 10 + v[k];
            chmin(ans, abs(num - 753));

//            for (int j = 0; j < v.size(); ++j) {
//                for (int k = 0; k < v.size(); ++k) {
//                    if (i != j && j != k && k != i) {
//                    }
//                }
//            }
        }
        cout << ans << endl;

    }
};


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

    Solve().solve();


    return 0;
}


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

char S[4];

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

  int result = 0;
  for (int i = 0; i < 4; ++i) {
    if (S[i] == '+') ++result;
    else --result;
  }

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

Measured memory_bytes: 256
from subprocess import*
call(('pypy3','-c',"""
s=input()
t=input()
a=len(s)
b=len(t)
dp=[[0]*(b+1) for i in range(a+1)]
for i in range(a):
  for j in range(b):
    if s[i]==t[j]:
      dp[i+1][j+1]=dp[i][j]+1
    else:
      dp[i+1][j+1]=max(dp[i][j+1],dp[i+1][j])
res=''
while a!=0 and b!=0:
  if dp[a][b]==dp[a-1][b]:
    a-=1
  elif dp[a][b]==dp[a][b-1]:
    b-=1
  else:
    a-=1
    b-=1
    res=s[a]+res
print(res)
"""))


Measured memory_bytes: 116396
// /**
// *    author:  Dooloper
// *    created: 12.04.2020 20:51:07
// **/

// #include <iostream>
// #include <vector>
// #include <map>
// #include <string>
// #include <utility>
// #include <algorithm>

// using namespace std;
// typedef unsigned long ll;

// ll GCD(int a, int b, int c,int k){
//     if(a == b== c)return __gcd(__gcd(a,b),c);
//     else return __gcd(__gcd(a,b),c)*k;
// }

// int main() {
//    cin.tie(0);
//    int K;cin>>K;

//    ll sum = 0;

//     sum += 1;
//    int a = 1;
//    int b = 1;
//    int c = 1;

//    for(int i = 0;i < K; i++){
//     //    sum += __gcd(__gcd(a,b),c);
//        a++;
//        sum += GCD(a,b,c, K);
//        b++;
//        sum += GCD(a,b,c, K);
//        c++;
//        sum += GCD(a,b,c, K);
//    }
//     // sum = GCD(1,1,1);
//    cout<<sum <<endl;
//    return 0;
// }
/**
*    author:  Dooloper
*    created: 12.04.2020 20:51:07
**/

#include <iostream>
#include <vector>
#include <map>
#include <string>
#include <utility>
#include <algorithm>

using namespace std;
typedef unsigned long ll;

int main() {
   cin.tie(0);
    int N;cin>>N;
    for(int i = 0; i < 3; i++){
    if(N%10 == 7){
        cout<<"Yes"<<endl;
        return 0;
    }else{
        N = N/10;
    }
    }
    cout<<"No"<<endl;

   return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")

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

using ll = long long;
using ull = unsigned long long;
using namespace std;

int main() {
    int N, result = 0;
    cin >> N;
    vector<int> l(N), r(N);
    REP(i, N) {
        cin >> l[i] >> r[i];
    }
    REP(i, N) {
        result += r[i] - l[i] + 1;
    }
    cout << result << endl;
}


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

ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }	//最大公約数(Greatest Common Divisor)
ll lcm(ll a, ll b) { return a / gcd(a, b)*b; }			//最小公倍数(Least Common Multiple)

long long comb(long long m) {
	return (m * (m - 1)) / 2;
}


int main() {
	int x[5];
	rep(i, 5)	cin >> x[i];

	int ans;
	rep(i, 5){
		if (x[i] == 0)
			ans = i + 1;
	}

	cout << ans << endl;


}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define INF (1LL<<57)
#define MV 200001
#define LMV 21
#define ff first
#define ss second
#define pb push_back
#define eb emplace_back
#define emp emplace
#define whoami(x) cerr<<#x<<" "<<x<<"\n";
#define mp make_pair
#define ins insert
#define sz size

void FLASH() {ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);}
void SETF() {cout.ios_base::setf(ios_base::fixed);}
void UNSETF() {cout.ios_base::unsetf(ios_base::fixed);}

typedef long long ll;
typedef long double ld;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
typedef pair<PII, int> PPII;
typedef pair<PLL, ll> PPLL;
typedef map<int, int> MII;
typedef map<ll, ll> MLL;
typedef map<PII, int> MPII;
typedef map<PLL, ll> MPLL;
typedef set<int> SI;
typedef set<ll> SL;

int ar[MV];
ll arr[MV];
string s[301];
int res[301][301];

void solve(int T)
{
	int h,w,k;
	cin>>h>>w>>k;
	for(int i=0;i<h;i++)
	cin>>s[i];	
	for(int i=0;i<h;i++)
	{
		int ct = 0;
		for(int j=0;j<w;j++)
		ct += (s[i][j] == '#');
		ar[i] = ct;
	}
	int f = -1, cx = 1;
	for(int i=0;i<h;i++)
	{
		if(ar[i])
		{
			int pf = -1;
			for(int j=0;j<w;j++)
			{
				if(ar[i] == 1)
				{
					pf = j;
					break;
				}	
				res[i][j] = cx;	
				cx += (s[i][j] == '#');
				ar[i] -= (s[i][j] == '#');
			}	
			for(int j=pf;j<w;j++)
			res[i][j] = cx;
			cx++;
			for(int j=i-1;j>f;j--)
			{
				for(int x=0;x<w;x++)
				res[j][x] = res[i][x];	
			}
			f = i;
		}
	}
	for(int i=f+1;i<h;i++)
	{
		for(int j=0;j<w;j++)
		res[i][j] = res[f][j];	
	}
	for(int i=0;i<h;i++)
	{
		for(int j=0;j<w;j++)
		cout<<res[i][j]<<" \n"[j == w-1];	
	}	
	return;
}

int main(void)
{
	FLASH();
	int T;
	T = 1;

/*#ifndef ONLINE_JUDGE
	time_t time_t1, time_t2;
	time_t1 = clock();
#endif*/

	while(T--)
	solve(T);

/*#ifndef ONLINE_JUDGE
	time_t2 = clock();
	SETF();
	cout<<"Time taken: "<<setprecision(7)<<(time_t2 - time_t1)/(double)CLOCKS_PER_SEC<<"\n";
	UNSETF();
#endif*/

	return 0;
}

Measured memory_bytes: 1280
sub i{$t=<STDIN>;return split/ /,$t;}@c=i;for($j=0;$j<$c[2];$j++){@d=i;if($d[1]<=$d[0]){${$s[$d[1]]}[@{$s[$d[1]]}]=$d[0];}}$e=$c[0]+1;$f=1;for($j=1;$j<=$c[1];$j++){foreach $g(sort{$a<=>$b}@{$s[$j]}){if($f==$g){$f++;}if($f<$g&&$e>$g){$e=$g;}}$f++;}$e--;print"$e";

Measured memory_bytes: 28156
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 1000000007;

int main() {
    int s;
    cin >> s;
    vector<int> dp(s+1);
    dp[0] = 1;
    dp[1] = 0;
    dp[2] = 0;
    for (int i = 3; i <= s; i++) {
        dp[i] = dp[i -3] + dp[i - 1];
        dp[i] %= mod;
    }
    cout << dp[s] << endl;
}

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

using namespace std;
using ll = long long;

const int MOD = 1e9 + 7;
#define REP(i, n)  for(int i = 0; i < n; ++i)
#define FOR(i, t, n)  for(ll i = t; i <= (ll)n; ++i)
struct edge {
    int from, to;
    ll cost;
};


class Eratosthenes {
public:
    vector<bool> prime;

    Eratosthenes(ll size) {
        size = max((int) sqrt(size) + 1, 101010);
        prime.resize(size, 1);
        prime[0] = 0;
        prime[1] = 0;
        for (size_t i = 2; i * i <= size; ++i)
            if (prime[i]) {
                for (size_t j = 2; i * j <= size; ++j)prime[i * j] = false;
            }
    }
};


class Combination {
    vector<ll> fac; //n!(mod M)
    vector<ll> ifac; //k!^{M-2} (mod M)
public:
    Combination(ll size) {
        fac.resize(size);
        ifac.resize(size);
        fac[0] = 1;
        ifac[0] = 1;
        for (ll i = 0; i < size; i++) {
            fac[i + 1] = fac[i] * (i + 1) % MOD;
            ifac[i + 1] = ifac[i] * mpow(i + 1, MOD - 2) % MOD;
        }
    }

    ll mpow(ll x, ll n) {
        ll ans = 1;
        while (n != 0) {
            if (n & 1) ans = ans * x % MOD;
            x = x * x % MOD;
            n = n >> 1;
        }
        return ans;
    }

    ll comb(ll a, ll b) {
        if (a == 0 && b == 0)return 1;
        if (a < b || a < 0)return 0;
        ll tmp = ifac[a - b] * ifac[b] % MOD;
        return tmp * fac[a] % MOD;
    }
};


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

ll LCM(ll a, ll b) {
    ll gcd = GCD(a, b);
    return a / gcd * b;
}

ll N, K;

int main() {
    cin >> N >> K;
    vector<int> A(N), B(N), C(N);
    REP(i, N)cin >> A[i];
    reverse(A.begin(), A.end());
    REP(i, N) {
        REP(k, N) {
            if (i < k)if (A[i] < A[k])B[i]++;
            if (i > k)if (A[i] < A[k])C[i]++;
        }
    }
    ll res = 0;
    REP(i, N) {
        res += K * (K + 1) / 2 % MOD * B[i] % MOD;
        res %= MOD;
        res += K * (K - 1) / 2 % MOD * C[i] % MOD;
        res %= MOD;
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 384
#include<iostream>
using namespace std;
int main(){
long n,y,b,r,t,i,j,a;
double x,u;
while(cin>>n,n){
cin>>y;u=b=1;
for(i=0;i<n;i++){
cin>>b>>r>>t;
if(t==1)x=1+y*r*0.01;
else{x=1;for(j=0;j<y;j++)x*=(1+r*0.01);}
if(u<x){a=b;u=x;}
}
cout<<a<<endl;
}
return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=a;i<b;i++)
#define INF 1<<30
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;

int n, m, k;
ll dfs(int index, ll sum)
{
	if (index == n)
	{
		sum -= k;
		if (sum <= 0) sum = 1;
		return sum;
	}

	ll ret = 0;
	rep(i, 1, m + 1)
	{
		ret += dfs(index + 1, sum + i);
	}
	return ret;
}

int main()
{
	while (1)
	{
		cin >> n >> m >> k;
		if (n == 0) return 0;

		ll up = dfs(0, 0);
		ll down = 1;
		rep(i, 0, n) down *= m;
		double ans = (double)up / (double)down;
		printf("%.8f\n", ans);
	}
}

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

int main() {
    long long n, m;
    cin >> n >> m;

    int a[n];
    long long sum = 0;
    for(int i = 0; i < n; i++) {
        cin >> a[i];
        sum += a[i];
    }
    long long count = 0;

    long long val = sum / (4 * m);
    if(sum % (4 * m)) {
        val++;
    }

    for(int i = 0; i < n; i++) {
        if(a[i] >= val) {
            count++;
        }
    }

    if(count >= m) {
        cout << "Yes" << endl;
        return 0;
    }

    cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String a = sc.next();
		String b = sc.next();
		
		if (b.substring(0, a.length()).equals(a)) {
		    System.out.println("Yes");  
		} else {
		    System.out.println("No");   
		}
		
	}
}

Measured memory_bytes: 35668