akhauriyash/Code-Regression huggingface dataset:
// Problem : B - ... (Triple Dots)
// Contest : AtCoder - AtCoder Beginner Contest 168
// URL : https://atcoder.jp/contests/abc168/tasks/abc168_b
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
#define int long long
#define fastio                      \
  ios_base::sync_with_stdio(false); \
  cin.tie(0);                       \
  cout.tie(0);
#define sz(a) int((a).size())
#define pb push_back
#define mp make_pair
#define db1(x) cout << #x << "=" << x << endl
#define db2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define db3(x, y, z)                                                       \
  cout << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z \
       << endl
#define dbp(x) \
  cout << #x << "= {" << (x.first) << ", " << (x.second) << "}" << endl;
#define dbv(v)                         \
  {                                    \
    cout << #v << " : ";               \
    for (auto x : v) cout << x << ' '; \
    cout << endl;                      \
  }
#define rep(i, a, b) for (int i = a; i <= b; i++)
#define rep2(i, a, b) for (int i = a; i >= b; i--)
#define die(x) return cout << x << '\n', 0;

using namespace std;

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

int32_t main() {
  fastio;
  //  freopen("input.txt", "r", stdin);
  //  freopen("output.txt", "w", stdout);
  int testcases;
  testcases = 1;
  // cin>>testcases;

  while (testcases--) {
    int k;
    string s;
    cin >> k >> s;
    int len = s.length();
    if (len <= k) {
      die(s);
    }
    die(s.substr(0, k) + "...");
  }

  return 0;
}


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

int n,g;
int w[105],v[105];
int dp[105][100005];

int main(){

    cin>>n>>g;
    for(int i=1;i<=n;i++)
        cin>>w[i]>>v[i];

    for(int i=1;i<=100;i++)
        for(int j=1;j<=100000;j++)
            dp[i][j]=g+1;

    for(int i=1;i<=n;i++)
            dp[i][v[i]]=w[i];

    for(int i=2;i<=n;i++)
        for(int j=1;j<=100000;j++){

            dp[i][j]=dp[i-1][j];
            if(j-v[i]>=0)
                dp[i][j]=min(dp[i][j],dp[i-1][j-v[i]]+w[i]);

        }

    int sol;
    for(int i=0;i<=100000;i++)
        if(dp[n][i]<=g)
            sol=i;

    cout<<sol;

}


Measured memory_bytes: 40832
#include<iostream>

int a,b,c,d,e,k;

int main(){

    std::cin>>a>>b>>c>>d>>e>>k;

    if(e-a<=k)
    std::cout<<"Yay!"<<std::endl;
    else
    std::cout<<":("<<std::endl;
    

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fi first
#define se second
using namespace std;
typedef long long LL;
typedef pair<int, int> P;

const int mod = 20170408;
const int maxn = 2e7 + 5;

int add(int x, int y) {
    x += y;
    if(x >= mod) x -= mod;
    return x;
}

int mul(int x, int y) {
    LL z = 1LL * x * y;
    return z - z / mod * mod;
}

int a[55];
vector<P> f;

int main() {
#ifdef CX_TEST
    freopen("E:\\program--GG\\test_in.txt", "r", stdin);
#endif
    int n, i, j, l, r;
    scanf("%d", &n);
    l = r = 0;
    for(i = 1; i <= n; i++) {
        scanf("%d", &a[i]);
        if(a[i] < 0) l = min(l, a[i]);
        else r = max(r, a[i]);
    }
    if(-l < r) {
        for(j = 1; j <= n; j++) {
            if(a[j] == r) break;
        }
        f.push_back(P(j, 1));
        f.push_back(P(j, 1));
        for(i = 2; i <= n; i++) {
            f.push_back(P(i - 1, i));
            f.push_back(P(i - 1, i));
        }
    } else {
        for(j = 1; j <= n; j++) {
            if(a[j] == l) break;
        }
        f.push_back(P(j, n));
        f.push_back(P(j, n));
        for(i = n - 1; i > 0; i--) {
            f.push_back(P(i + 1, i));
            f.push_back(P(i + 1, i));
        }
    }
    n = f.size();
    printf("%d\n", n);
    for(auto e : f) printf("%d %d\n", e.first, e.second);
    return 0;;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
  int n,m;
  cin>>n>>m;
  int a[m],b[m];
  for(int i=0;i<m;i++) cin>>a[i]>>b[i];
  int c[n];
  memset(c,0,sizeof(c));
  for(int i=0;i<m;i++){
    a[i]--,b[i]--;
    c[a[i]]++;
    c[b[i]]++;
  }
  bool f=0;
  for(int i=0;i<n;i++) f|=c[i]%2;
  cout<<(f?"NO":"YES")<<endl;
  return 0;
}


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

class HorizontalLine
{
public:
	int height;
	int startPoint;
	int endPoint;
};

bool compare(HorizontalLine a, HorizontalLine b)
{
	return a.height > b.height;
}

int main()
{
	while (true)
	{
		int n, m, a;
		std::cin >> n;
		std::cin >> m;
		std::cin >> a;
		if (n == 0)break;

		std::vector<HorizontalLine> horizontalLines(m + 1);
		for (int i = 0; i < m; i++)
		{
			HorizontalLine horizontal;
			std::cin >> horizontal.height;
			std::cin >> horizontal.startPoint;
			std::cin >> horizontal.endPoint;
			horizontalLines[i] = horizontal;
		}

		std::sort(horizontalLines.begin(), horizontalLines.end(), compare);

		for (int i = 0; i < m; i++)
		{
			if (horizontalLines[i].startPoint == a)
			{
				a = horizontalLines[i].endPoint;
			}
			else if (horizontalLines[i].endPoint == a)
			{
				a = horizontalLines[i].startPoint;
			}
		}
		std::cout << a << std::endl;
	}
	return 0;
}

Measured memory_bytes: 3104
#include <iostream>
#include <vector>
#include <algorithm>
 
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 main() {
    string s;
    cin >> s;
    int n = int(s.size());
    int co = 1;
    for (int i = 0; i < n-1; i++) {
        if (s[i] != s[i+1]) co++;
    }
    cout << co-1 << endl;
    return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
using int64 = int64_t;
#define int int64

int gcd(int a,int b){
  return (a%b==0?b:gcd(b,a%b));
}

signed main(){
  int n,m;    cin >> n >> m;
  string s,t; cin >> s >> t;
  
  int l = n*m/gcd(n,m);
  
  map<int,int> mp;
  for(int si=0; si<n; ++si){
    mp[si*l/n] = s[si];
  }
  for(int ti=0; ti<m; ++ti){
    // 上のforループで初期化されていないものは, なんでもok
    if(mp[ti*l/m] == 0) continue;
    // 同じ部分がsとかぶった時はNG
	// (文字列長Lをk倍したとしても, 結局は同じ部分が被るのでやはりNG)
    if(mp[ti*l/m] != t[ti]) {
      cout << -1 << endl;
      return 0;
    }
  }
  cout << l << endl;
  return 0;
}

Measured memory_bytes: 10880
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <climits>
#include <string>
#include <bitset>
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef pair<int,int> P;
typedef vector<pair<int,int> > vpii;
typedef vector<pair<string,int>> vpsi;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define fin(ans) cout<<(ans)<<endl
#define STI(s) atoi(s.c_str())
#define mp(p,q) make_pair(p,q)
#define pb(n) push_back(n)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define Sort(a) sort(a.begin(),a.end())
#define Rort(a) sort(a.rbegin(),a.rend())
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
const int MOD = 1000000007;
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;



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

int k,x;
cin >> k >> x;
500 * k >= x ? fin("Yes") : fin("No");

//////////////////////////////////////////////////////
return 0;}

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

int main()
{
	int n, m, s, t, e, l;
	int b[10000];

	cin >> n >> m >> s >> t >> e;

	vector<vector <pair<int, int>>> a(n);

	while (s != 0 || t != 0 || e != 0) {
		a[s - 1].push_back(make_pair(t, e));
		cin >> s >> t >> e;
	}

	cin >> l;

	for (int i = 0; i < l; i++) {
		for (int j = 0; j < m; j++)
			cin >> b[j];

		for (int k = 0; k < n; k++) {
			int c = 0;
			for (unsigned int u = 0; u < a[k].size(); u++)
				c += a[k][u].second * b[a[k][u].first - 1];

			cout << c;
			if (k < n - 1)
				cout << " ";
			else
				cout << endl;
		}
	}

	return 0;
}


Measured memory_bytes: 3868
import math

def factrize(x):
    f = {}
    if x == 1:
        return f
    tmp = x
    i = 2
    while i**2 <= tmp:
        cnt = 0
        while tmp % i == 0:
            cnt += 1
            tmp = tmp//i
        if cnt > 0:
            f[i] = cnt
        i += 1
    if tmp != 1 or f == {}:
        f[tmp] = 1
    return f
n = int(input())
m = factrize(n)
l = []
for i in m.values():
  l.append(i)
ans=[]
for i in l:
  for j in range(1, 40):
    if i - j >= 0:
      i -= j
      continue
    else:
      ans.append(j-1)
      break
print(sum(ans))

Measured memory_bytes: 9200
n,k=map(int,input().strip().split(" "))
ar=[]
for i in range(n):
    ar.append(int(input()))
ar.sort()
m=999999999999999

for i in range(n-k+1):

    c=ar[i+k-1]-ar[i]
    if c<m:
        m=c
print(m)

Measured memory_bytes: 80932
a=input().split()
for i in range(3):
  a[i]=int(a[i])
a.sort()
A=int(a[0])
B=int(a[1])
C=int(a[2])
A0=A%2
B0=B%2
C0=C%2
ans=0

if( (A0==B0)and(A0==C0) ):
   ans=ans+int((C-B)/2)+int((C-A)/2)
   print(ans)
else:
  if(A0==C0):#B0!=C0
    ans=ans+int((C-B)/2)+int((C-A)/2)+2
    print(ans)
    #偶奇違う一つに ＋２＞他二つに＋１＋１の二回を足す
  if(B0==C0):#A0!=C0
    ans=ans+int((C-B)/2)+int((C-A)/2)+2
    print(ans)
  if((A0!=C0)and(B0!=C0)):
    ans=ans+int((C-B)/2)+int((C-A)/2)+1
    print(ans)
    #A,B　C-1まで行く＞ A,B+1+1
    



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

using namespace std;
using ll = long long;
const int mod = 1e9 + 7;

int main()
{
    int H, W;
    cin >> H >> W;
    vector<string> a(H);
    for (int i = 0; i < H; i++){
        cin >> a[i];
    }
    vector<vector<ll>> dp(H, vector<ll> (W));
    dp[0][0] = 1;
    for (int i = 0; i < H; i++){
        for (int j = 0; j < W; j++){
            if (a[i][j] == '.'){
                if (i >= 1){
                    dp[i][j] += dp[i - 1][j];
                    dp[i][j] %= mod;
                }
                if (j >= 1){
                    dp[i][j] += dp[i][j - 1];
                    dp[i][j] %= mod;
                }
            }
        }
    }
    cout << dp[H - 1][W - 1];
    return 0;
}


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

int main() {
string A,B,C;
  cin >>A>>B>>C;
  if(A[A.size()-1]==B[0] && B[B.size()-1]==C[0]){
    cout <<"YES";
  }
  else{
    cout <<"NO";
  }
      

}
 

Measured memory_bytes: 256
<?php

$s = trim(fgets(STDIN));
$t = trim(fgets(STDIN));

$ans = strlen($t);

for ($i=0; $i<(strlen($s)-strlen($t)+1); $i++) {
    $count = 0;
    for($j=0; $j<strlen($t); $j++) {
        if ($s[$i+$j] != $t[$j]) {
            $count++;
        }
    }
    $ans = min($ans, $count);
}

echo $ans;


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

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

Measured memory_bytes: 5192
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>
#include <climits>
#include <iomanip>
#include <bitset>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <list>
#include <map>

using namespace std;

int main() {
  int arr[3];
  for (int i = 0; i < 3; i++) {
    cin >> arr[i];
  }
  sort(arr, arr + 3);
  int ans = 2e9;
  do {
    ans = min(ans, abs(arr[1] - arr[0]) + abs(arr[2] - arr[1]));
  } while (next_permutation(arr, arr + 3));
  cout << ans << endl;/////////////
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <string>
#include <cmath>
#include <array>
#include <vector>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <utility>
#include <iomanip>
#include <numeric>
#include <climits>
#include <algorithm>
#include <cstdint>
using namespace std;

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

    vector<int> numbers;
    for (int i = 0; i < str.length() - 2; i++)
    {
        string temp;
        temp += str[i];
        temp += str[i + 1];
        temp += str[i + 2];
        numbers.push_back(stoi(temp));
    }
    int min = INT_MAX;
    for (auto x : numbers)
    {
        if (abs(x - 753) < min)
            min = abs(x - 753);
    }
    cout << min;
}


Measured memory_bytes: 3628
// IO library
#include <cstdio>
#include <iomanip>
#include <ios>
#include <iostream>

// algorithm library
#include <algorithm>
#include <cmath>
#include <numeric>

// container library
#include <deque>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>

// namespace
using namespace std;

// typedef
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<VB> VVB;

// conversion
#define INT(c) static_cast<int>(c)
#define CHAR(n) static_cast<char>(n)
#define LL(n) static_cast<ll>(n)

// container
#define EACH(i, c) for (auto i = (c).begin(); i != (c).end(); i++)
#define SORT(c) sort((c).begin(), (c).end())
#define GSORT(c) sort((c).begin(), (c).end(), greater<decltype((c).front())>())
#define SZ(x) (INT((x).size()))
#define MEMSET(c, v) memset((c), v, sizeof(c))

// repetition
#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define NREP(i, n) FOR(i, 1, n + 1)
#define RFOR(i, a, b) for (ll i = (a); i >= (b); i--)
#define RREP(i, n) RFOR(i, n, 0)
#define RNREP(i, n) RFOR(i, n, 1)

// constant
// const ll MOD = 1e9 + 7;
// const int INF = 1 << 25;
// const ll INF = 1LL << 50;
// const int dx[4] = {0, -1, 1, 0};
// const int dy[4] = {-1, 0, 0, 1};
// const int dx[8] = {-1, 0, 1, -1, 1, -1, 0, 1};
// const int dy[8] = {-1, -1, -1, 0, 0, 1, 1, 1};

// debug
#define test(x) cout << #x << " = " << x << endl

// answer output
#define Yes(c) cout << ((c) ? "Yes" : "No") << endl;
#define YES(c) cout << ((c) ? "YES" : "NO") << endl;
#define yes(c) cout << ((c) ? "yes" : "no") << endl;

#define possible(c) cout << ((c) ? "possible" : "impossible") << endl;
#define POSSIBLE(c) cout << ((c) ? "POSSIBLE" : "INPOSSIBLE") << endl;


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


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

  int A, B, K;
  cin >> A >> B >> K;
  if (B - A + 1 <= K * 2) {
    FOR(i, A, B + 1) {
      cout << i << endl;
    }
  } else {
    REP(i, K) {
      cout << A + i << endl;
    }
    REP(i, K) {
      cout << B - K + i + 1 << endl;
    }
  }
  return 0;
}

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

int main(void){
  int a[5];
  int sum = 0, mini = 10, mini_id = 5;
  for(int i = 0; i < 5; i++){
    cin >> a[i];
    sum += a[i];
    if(a[i]%10 < mini && a[i]%10 != 0){
      mini = a[i]%10;
      mini_id = i;
    }
  }
  if(mini_id == 5){
    cout << sum << endl;
  }
  else{
    sum = 0;
    for(int i = 0; i < 5; i++){
      if(i != mini_id){
        if(a[i]%10 == 0){
          sum += a[i];
        }
        else{
          mini = a[i]/10+1;
          sum += mini*10;
        }
      }
      else{
        sum += a[i];
      }
    }
    cout << sum << endl;
  }
  return 0;
}

Measured memory_bytes: 256
from math import ceil

A, B = map(int, input().split())
# minS = [int(A*(100/8)), int(B*(100/10))]
# maxS = [ceil((A+1)*(100/8)), ceil((B+1)*(100/10))]
# if maxS[1] <= minS[0] or maxS[0] <= minS[1]:
#     print(-1)
# else:
#     print(max(minS))
# print(minS, maxS)
for i in range(max(int(A*(100/8)), int(B*(100/10))), 10000):
    if int(i*8/100) == A and int(i*10/100) == B:
        print(i)
        break
    elif int(i*8/100) > A or int(i*10/100) > B:
        print(-1)
        break
# print(max(int(A*(100/8)), int(B*(100/10))))

Measured memory_bytes: 3060
#include <stdio.h>

void cmpr1(char*, char*);

int main(int argc, char *argv[]){
    int i,r;
    char a[203],b[203];
    for(int i=0; i<100; i++){
        fgets(a, 203, stdin);
        if(a[0] == '.' && a[1] == '\n') break;
		//if (i != 0) printf("\n");
        fgets(b, 203, stdin);
        cmpr1(a,b);
		printf("\n");

    }
}

void cmpr1(char *a, char *b){
	int i = 0, j = 0;
    int q=0, f=0, g=0;
	for (int i = 0; i < 203;) {
        if(a[i] == '\n' || b[j] == '\n') {
			if (a[i] == b[j]){
				if (!f) {
					printf("IDENTICAL");
				}
				else {
					printf("CLOSE");
				}
				return;
			}
			printf("DIFFERENT");
            return;
        }
		if (!f && a[i] == '"' && b[j] == '"') {
			i++;
			j++;
			while (1) {
				if (a[i] == '"') {
					if (a[i] == b[j]) {
						break;
					}
					else {
						while (b[j] != '"') j++;
						f = 1;
						break;
					}
				}
				if (b[j] == '"') {
					while (a[i] != '"') i++;
					f = 1;
					break;
				}
				if (a[i] != b[j]) f = 1;
				i++;
				j++;
			}
		}
        if(a[i] != b[j]) {
            if(q){
                f = 1;
            }
            else{
                printf("DIFFERENT");
                return;
            }
        }
		i++;
		j++;
    }
    printf("ERROR");
}


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

int main() {
    ll N;
    cin >> N;
    vector<ll> a(N);
    for(int i=0;i<N;i++){
        cin >> a[i];
    }
    sort(a.begin(),a.end());
    ll maxDepth = a.back();
    bool ok =true;
    if(maxDepth %2 ==0){
        int t = maxDepth/2;
        for(int i=0;i<N;i++){
            if(a[i] != t){
                ok = false;
                break;
            }
            int num =1;
            while(i<N-1 && a[i] == a[i+1]){
                num++;
                i++;
            }
            if(t == maxDepth/2){
                if(num!=1){
                    ok = false;
                    break;
                }
            }else if(num<2){
                ok = false;
                break;
            }
            t++;
        }
    }else{
        int t = (maxDepth+1)/2;
        for(int i=0;i<N;i++){
            if(a[i] != t){
                ok = false;
                break;
            }
            int num =1;
            while(i<N-1 && a[i] == a[i+1]){
                num++;
                i++;
            }
            if(t == (maxDepth+1)/2){
                if(num!=2){
                    ok = false;
                    break;
                }
            }else if(num<2){
                ok = false;
                break;
            }
            t++;
        }

    }
    if(ok){
        cout <<"Possible" << endl;
    }else{
        cout <<"Impossible" << endl;
    }

    return 0;
}

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

int main(void)
{
    int a, b;
    cin >> a >> b;
    int d = a / b;
    int r = a % b;
    double f = double(a) / b;
    cout << d << ' ' << r << ' ' << fixed << setprecision(5) << f << endl;
    return 0;
}

Measured memory_bytes: 3280
from math import factorial as fact
import math
import sys
import itertools
import numpy as np
from collections import Counter
import datetime


#入力:N(int:整数)
def input1():
	return int(input())

#入力:N,M(int:整数)
def input2():
	return map(int,input().split())

#入力:[n1,n2,...nk](int:整数配列)
def input_array():
	return list(map(int,input().split()))

def keta(N):
	return len(str(N))


def input_daytime(input_time):
	time,distance=input_time.split()
	t=time.split(":")
	se=str(t[-1]).split(".")
	dt1 = datetime.timedelta(hours=int(t[0]),minutes=int(t[1]),seconds=int(se[0]),milliseconds=int(se[1]))
	return dt1

def combinations(n,r):
	return list(itertools.combinations(range(n),r))



def all_sets(num_list):
	subsets=[]
	for i in range(2,len(num_list) + 1):
		for c in combinations(num_list, i):
			subsets.append(c) 
	return subsets

#公約数の列挙
def ch(x1):
	cf=[]
	for i in range(2,math.sqrt(x1)+1):
		if x1 % i==0:
			cf.append(i)
	return cf

def CountOneRoots(x,y):
	#x:縦，y:横
	return fact(x+y)/fact(x)/fact(y)

# 素因数分解
def factorization(n):
	tmp=n
	count=0
	for i in range(2,int(n**0.5)+2):
		if tmp%i==0:
			cnt=0
			while tmp%i==0:
				cnt+=1
				tmp//=i
			count+=1
	if tmp!=1:
		count+=1

	return count
			

# s=str(input())

# if s =="ABC":
# 	print("ARC")
# else:
# 	print("ABC")
n,k=input2()
d=[]
A=[]
I=[]
for i in range(k):
	d.append(input1())
	A+=input_array()

print(n-len(Counter(A)))







Measured memory_bytes: 27152
#include <bits/stdc++.h>
using namespace std;
#define L 8001
char ch;
int len=0,l1=0,l2=0,res[L]={0},re1[L]={0},re2[L]={0};
bool cmp(int a,int b)
{
    return a>b;
}
void solve()
{
    while((ch=getchar())=='T'||ch=='F')
        if (ch=='T') len++;
        else res[len]++;
    int i,tmp1,tmp2,res1,res2;
    for (i=1;i<=len;i++)
        if (i%2==0) re1[l1++]=res[i];
        else re2[l2++]=res[i];
    scanf("%d%d",&res1,&res2);
    sort(re1,re1+l1,cmp);
    sort(re2,re2+l2,cmp);
    tmp1=res[0];
    for (i=0;i<l1;i++)
        if (tmp1>=res1) tmp1-=re1[i];
        else tmp1+=re1[i];
    tmp2=0;
    for (i=0;i<l2;i++)
        if (tmp2>=res2) tmp2-=re2[i];
        else tmp2+=re2[i];
    if (tmp1==res1&&tmp2==res2) puts("Yes");
    else puts("No");
}
int main()
{
    solve();
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <cassert>
#include <string>
#include <set>
#include <map>
#include <random>
#include <bitset>
#include <string>
#include <unordered_set>
#include <unordered_map>
#include <deque>
#include <queue>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

using namespace std;
using ll = long long;
using ul = unsigned long long;
using ld = long double;

int main() {
#ifdef ONPC
    freopen("a.in", "r", stdin);
#endif
    ios_base::sync_with_stdio(0); cin.tie(0);
	ll h, w, n;
    cin >> h >> w >> n;
    cout << min((n + h - 1) / h, (n + w - 1) / w);
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ALL(obj) (obj).begin(), (obj).end()
#define RALL(obj) (obj).rbegin(), (obj).rend()
#define REP(i, n) for(int i = 0;i < (n);++i)
#define RREP(i, n) for(int i = (n)-1; i >= 0; --i)

#define endl '\n'
#define pb push_back
#define eb emplace_back
#define pque priority_queue
#define umap unordered_map
#define BIG 2000000000
#define VERYBIG 1000000000000000ll
#define PI 3.1415926
#define coutdb cout<<fixed<<setprecision(15)

const int dx[]={1,0,-1,0,1,1,-1,-1}, dy[]={0,-1,0,1,1,-1,1,-1};
const long long MOD = 1e9+7;

// typedef int_fast64_t ll;
#define int int_fast64_t

template<typename T> inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template<typename T> inline T LCM(T a,T b){T c=GCD(a,b);a/=c;return a*b;}
template<typename T> inline T nCr(T a,T b){T i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
template<typename T> inline T nHr(T a,T b){return nCr(a+b-1,b);}

typedef pair<int, int> INTP;
typedef vector<int> INTV;
struct edge2 {int to, cost;};
struct edge3 {int from, to, cost;};

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

  int N; cin >> N;
  int odd = (N+1)/2;
  double ans = (double)odd / (double)N;
  coutdb << ans << endl;
}

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

typedef long long ll;
typedef long double ld;

#define MOD 1000000007
#define all(x) (x).begin(),(x).end()
#define rep(i, n) for(int i = 0; i < (int)(n); i++)

ll gcd(ll a, ll b){return b ? gcd(b, a % b) : a;}

int main(){

    ll X, A, B;

    cin >> X >> A >> B;

    cout << (X - A) % B << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,m,n) for(int i=m;i<=n;i++)
#define sd(n) scanf("%d",&n)
#define sl(n) scanf("%lld",&n)
#define met(a,b); memset(a,b,sizeof(a));
typedef long long ll;
using namespace std;
double pai=3.141592653589793;
 
inline int read()
{
    int x=0,f=1;
    char ch=getchar();
    while(ch<'0'||ch>'9')
    {
        if(ch=='-')
            f=-1;
        ch=getchar();
    }
    while(ch>='0'&&ch<='9')
    {
        x=(x<<1)+(x<<3)+(ch^48);
        ch=getchar();
    }
    return x*f;
}
 
// inline long long read() {
//     long long tmp=0, fh=1; char c=getchar();
//     while (c<'0'||c>'9') {if (c=='-') fh=-1; c=getchar();}
//     while (c>='0'&&c<='9') tmp=tmp*10+c-48, c=getchar();
//     return tmp*fh;
// }
ll h[200005];
int main(){
    int n,k;
    cin>>n>>k;
    for(int i=0;i<n;i++)
    {
        scanf("%lld",&h[i]);
    }
    sort(h,h+n);
    ll ans=0;
    for(int i=0;i<n-k;i++)
    {
        ans+=h[i];
    }
    cout<<ans;
}

Measured memory_bytes: 1792
import java.util.*;
public class Main {
	public static void main(String[] args) { 
		Scanner scn = new Scanner(System.in);
		int n =scn.nextInt();
		String s=scn.next();
		int ans=1;
		for(int j=1;j<n;j++) {
			if(s.charAt(j)!=s.charAt(j-1)) {
				ans++;
			}
		}System.out.println(ans);
    }
}

Measured memory_bytes: 30276
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;

int main()
{
    long long int H;
    long long int N;
    
    cin >> H;
    cin >> N;
    
    long long int ans = 0;
    for(int i=0; i<N; i++){
        long long int a;
        cin >> a;
        ans += a;
    }
    if(ans >= H){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
    
    return 0;
}


Measured memory_bytes: 256
package main

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

//Util
func nextStr() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func maxInt(a, b int) int {
	if a > b {
		return a
	} else {
		return b
	}
}

func minInt(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}

func absInt(a int) int {
	if a >= 0 {
		return a
	} else {
		return -a
	}
}

//Main
var sc = bufio.NewScanner(os.Stdin)
var n int

func main() {
	sc.Split(bufio.ScanWords)
	n = nextInt()
	test := n % 10
	if test == 3 {
		fmt.Println("bon")
	} else if test == 0 || test == 1 || test == 6 || test == 8 {
		fmt.Println("pon")
	} else {
		fmt.Println("hon")
	}
}


Measured memory_bytes: 1756
#include <stdio.h>
#include <math.h>

double toRadian(int degree)
{
    return (degree / (180 / M_PI));
}

int main()
{
    int a, b, C;
    scanf("%d%d%d", &a, &b, &C);

    double S, L, h;
    S = (double)(a * b * sin(toRadian(C)) / 2);
    double c = sqrt(pow(a, 2) - 2*a*b*cos(toRadian(C)) + pow(b, 2));
    L = (double)(a + b + c);
    h = (double)(2 * S / a);
    printf("%lf\n%lf\n%lf\n", S, L, h);

    return 0;
}


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

int main() {

    int N, K;
    cin >> N >> K;

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

    sort(H.begin(), H.end());

    if (K >= N)
        cout << 0;
    else {
        ll ans = 0;
        rep(i, N - K)
            ans += H[i];
        cout << ans;
    }
    cout << endl;

    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repf(i,a,b) for (int i = (a); i < (b); i++)
#define repi(i,a,b) for (int i = (a); i <= (b); i++)
#define repr(i,a,b) for (int i = (a); i >= (b); i--)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define debug(x)  cout << #x << " = " << (x) << endl;
#define SORT(x) sort(all(x));
#define RSORT(x) sort(rall(x));
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vd = vector<double>;
using vb = vector<bool>;
using pii = pair<int, int>;
using vc = vector<char>;
using vvc = vector<vc>;
using vs = vector<string>;
using tiii = tuple<int, int, int>;
const ll inf = 1ll<<29;
const ll mod = 1000000007;
const double eps = 1e-9;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};

int main() {
  int r, D, x; cin >> r >> D >>x;

  rep(i,10) {
    x = r*x - D;
    cout << x << endl;
  }
}

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

using ll = long long;

int main() {
    int q; cin >> q;
    while(q--) {
        ll a, b; cin >> a >> b;
        if(a == b) {
            cout << 2*a - 2 << endl;
            continue;
        }
        auto check = [&] (ll x) {
            return (x + 1) / 2 * (x - (x + 1) / 2 + 1) < a * b;
        };
        ll lb = 1, ub = 1LL << 31;
        while(ub - lb > 1) {
            const ll mid = (lb + ub) / 2;
            (check(mid) ? lb : ub) = mid;
        }
        cout << lb - 1 << endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <cmath>
#include <numeric>
using namespace std;
#define rep(i,a,b) for(int64_t i=(a);i<(b);++i) // a ≦ i < b 
#define Rrep(i,a,b) for(int64_t i=(a);i>=(b);--i) // reverse repeat. a から b まで減少．
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend() //逆イテレータ
#define RANGE(a,b,c) (a).begin()+(b),(a).begin()+(c) // [b,c) イテレータ
#define INF 1000000000000000
#define MOD 1000000007
using PII = pair<int64_t, int64_t>;
using VI = vector<int64_t>;
using VVI = vector<VI>;
using VS = vector<string>;
using VP = vector<PII>;
using i64 = int64_t;
template<typename T> void invec(vector<T> &A){for(T& a:A) cin >> a;}


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

int N; cin >> N;
VS S(N); invec(S);

unordered_map<string, int> m;
for(string s: S) ++m[s];

cout << m.size() << "\n";

return 0;
}
// コンテスト前はtemplate振り返り。
// 書いて考える．場合分け．情報整理．
// 問題文から考える。自分ができることから考える。
// 単純に分かる量から．愚直解を実装して研究．
// 境界，出力文字列 チェック．行末にスペース入れない．
// 可読性優先．高速化次点．
// まずは全探索，分割，次にDP(小さい問題から大きな問題)
// 制限を見る．境界に注意．求めたい量の変域．動かせる量．
// 偶奇，逆から，ソート，出現回数，出現位置，DP， 余事象，包除
// データ構造． 問題の特徴量．単調性→二分探索。逆から考える。
// 存在判定：構成方法，入力の特徴
// 構築問題。極端解を試す。
// 例外を十分に含む一般化．想像力の限界
// 小さい系から例示
// 代数的処理．前処理によるクエリ高速化．
// 始めは過剰に例示・場合分けしてもいい．各場合を確実に対処．
// 自明な例から処理，除外．
// 小数のときは，精度の設定する．doubel 変数に数値を入力するときは 123. とする．
// コーナーケース。境界値。数表出力プログラム作る
// 実行エラー：vector添え字超え．0割り．



Measured memory_bytes: 23912
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < int(n); i++)
using namespace std;
using ll = long long;
const int INF = (1<<30)-1;
const long long LINF = (1LL<<62)-1;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i, n) cin >> a[i];
  int ans = 0;
  for (int i = 0; i < n; i+=2) {
    if (a[i]%2)
      ans++;
  }
  cout << ans << endl;
  return 0;
}

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

int main() {
	int d, n; scanf("%d%d", &d, &n);

	int ans = pow(100, d) * n;
	if (n == 100) ans = pow(100, d) * (n + 1);

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

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define ll long long
#define double long double
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define mod (ll)(1e9+7)
#define inf (ll)(3e18+7)
#define pi (double) acos(-1)
#define P pair<int,int>
#define PiP pair<int,pair<int,int>>
#define all(x) x.begin(),x.end()
using namespace std;

int main() {
    vector<vector<int>> c(3, vector<int>(3));
    rep(i, 3)rep(j, 3)cin >> c[i][j];
    int a[2] = {c[0][1]-c[0][0], c[0][2]-c[0][1]}, ans=true;
    rep(i, 2){
        rep(j,2)if(c[i+1][j+1]-c[i+1][j] != a[j])ans=false;
    }
    if(ans)cout << "Yes";
    else cout << "No";
}

Measured memory_bytes: 256
M=998244353
class BIT:
    def __init__(self,n):
        self.size=n
        self.tree=[0]*-~n
    def sum(self,i):
        s=0
        while i:
            s=(s+self.tree[i])%M
            i-=i&-i
        return s
    def add(self,i,x):
        while i<=self.size:
            self.tree[i]=(self.tree[i]+x)%M
            i+=i&-i
(n,k),*s=[[*map(int,t.split())]for t in open(0)]
bit=BIT(n+5)
bit.add(1,1)
bit.add(2,-1)
for i in range(1,n):
    p=bit.sum(i)
    for l,r in s:
        l+=i
        r+=i
        if l>n:l=n+1
        if r>n:r=n+1
        bit.add(l,p)
        bit.add(r+1,-p)
print(bit.sum(n))

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

int main() {
    int K;
    cin >> K;
    int sum = 0;
    for (int a = 1; a <= K; a++) {
        for (int b = 1; b <= K; b++) {
            for (int c = 1; c <= K; c++) {
                sum += gcd(max(gcd(max(a, b), min(a, b)), c), min(gcd(max(a, b), min(a, b)), c));
            }
        }
    }
    cout << sum << endl;
}

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

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

#define int long long

vector<int> basisa , basisb;

void inserta(int x){
	for(int i = 0 ; i < 60 ; i++){
		if((x & 1LL << i) == 0) continue ;
		if(basisa[i] == 0){
			basisa[i] = x ;
			return  ;
		}
		x ^= basisa[i] ;
	}
	return  ;
}

void insertb(int x){
	for(int i = 0 ; i < 60 ; i++){
		if((x & 1LL << i) == 0) continue ;
		if(basisb[i] == 0){
			basisb[i] = x ;
			return  ;
		}
		x ^= basisb[i] ;
	}
	return  ;
}

bool ok(int x){
	for(int i = 0 ; i < 60 ; i++){
		if((x & 1LL << i) == 0) continue ;
		if(basisb[i] == 0){
			return false ;
		}
		x ^= basisb[i] ;
	}
	return true ;
}

int32_t main(){
	int t ;
	cin >> t ;
	while(t--){
		basisa.clear() ;
		basisa.resize(60) ;
		basisb.clear() ;
		basisb.resize(60) ;
		int n ; 
		cin >> n ;
		int a[n] ;
		for(int i = 0 ; i < n ; i++){
			cin >> a[i] ;
		}
		string s ; 
		cin >> s ;
		bool found = true ;
		for(int i = n - 1 ; i >= 0 ; i--){
			if(s[i] == '0') insertb(a[i]) ;
			else{
				inserta(a[i]) ;
				for(int j = 0 ; j < 60 ; j++){
					found &= ok(basisa[j]) ;
				}
			}
		}
		cout << 1 - found << '\n' ;
	}
	return 0 ;
}


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

using namespace std;

int32_t main() {

    ios_base::sync_with_stdio(false);

    cin.tie(0);

    set<long long> s;

    for(long long i = 0 ; i < 6 ; i++) {

        s.insert(i);

    }

    vector<long long> a(5);

    for(long long i = 0 ; i < 5 ; i++) {

        cin >> a[i];

    }

    for(long long i = 0 ; i < a.size() ; i++) {

        if(s.find(a[i])!=s.end()) {

            s.erase(a[i]);

        }

    }

    cout << (*s.begin()) << '\n';

    return 0;

}



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

#define st first
#define nd second
#define all(x) (x).begin(), (x).end()

using namespace std;
using namespace placeholders;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

template <class T> void mini(T &l, T r){l = min(l, r);}
template <class T> void maxi(T &l, T r){l = max(l, r);}

template <class TH> void _dbg(const char *sdbg, TH h){cerr << sdbg << "=" << h << "\n";}
template <class TH, class ...TA> void _dbg(const char *sdbg, TH h, TA... a){
	while (*sdbg != ',') cerr << *sdbg++; cerr << "=" << h << ","; _dbg(sdbg + 1, a...);
}
template <class T> ostream &operator <<(ostream &os, vector<T> V){
	os << "["; for (auto vv: V) os << vv << ","; return os << "]";
}
template <class L, class R> ostream &operator <<(ostream &os, pair<L, R> P){
	return os << "(" << P.st << "," << P.nd << ")";
}

#ifdef SFIC
	#define eput(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
	#define eput(...) 218
#endif

int main(){
	string s;
	cin >> s;
	puts(s.size() >= 4 && s.substr(0, 4) == "YAKI" ? "Yes" : "No");
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define i64 long long
#define N (int)(1e5)
using namespace std;
int cnt_2(int n){
	int cnt=0;
	while(n>0 and n%2==0){
		n/=2;
		cnt++;
	}
	return cnt;
}
int main() {
	// your code goes here
	int n;
	cin>>n;
	int mx = 0,ans = 1;
	for(int i=2;i<=n;i++){
		int cnt = cnt_2(i);
		if(cnt > mx){
			mx = cnt;
			ans = i;
		}
	}
	printf("%d\n",ans);
	return 0;
}

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

int main(){
	double A,B,C;
	double S,L,h;
	scanf("%lf %lf %lf",&A,&B,&C);
	S=A*B*sin(C*M_PI/180)/2;
	L=A+B+sqrt(A*A+B*B-2*A*B*cos(C*M_PI/180));
	h=2*S/A;
	printf("%lf\n%lf\n%lf\n",S,L,h);
	return 0;
}

Measured memory_bytes: 648
#include <iostream>
using namespace std;
int main(){
	char a[52][52];
	int n,m,b[52][52]={0};
	cin>>n>>m;
	for(int i=1;i<=n;i++)
		for(int j=1;j<=m;j++)
			cin>>a[i][j];
	for(int i=1;i<=n;i++)
		for(int j=1;j<=m;j++)
			if(a[i][j]=='#'){
				b[i-1][j-1]++;
				b[i-1][j]++;
				b[i-1][j+1]++;
				b[i][j-1]++;
				b[i][j+1]++;
				b[i+1][j-1]++;
				b[i+1][j]++;
				b[i+1][j+1]++;
			}
	for(int i=1;i<=n;i++){
		for(int j=1;j<=m;j++)
			if(a[i][j]=='#')
				cout<<a[i][j];
			else cout<<b[i][j];
		cout<<endl;
	}
	return 0;
}

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


int compare_int(const void *a, const void *b)
{
    return *(int*)a - *(int*)b;
//    return *(long long*)a - *(long long*)b;
}
//  qsort(A, b, sizeof(int), compare_int);

int compare_string(const void *a, const void *b) {
  return strcmp(*(const char **)a, *(const char **)b);
}
//  qsort(names, 3, sizeof *names, compare_string);

//long long  factorial(long long n) {
//    if (n > 0) {
//        return n * factorial(n - 1);
//    } else {
//        return 1;
//    }
//}
long long  factorial(long long n, long long depth) {
    if (n > 1) {
        depth++;
        return factorial(n / 2, depth);
    } else {
        return depth;
    }
}

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

int distance(int a, int b) {
  return abs(a-b)*abs(a-b);
}



//int ()
/*
int triangle(int a, int b, int c){
  if(a<b+c){
    if(b<c+a){
      if(c<a+b){
        printf("1\n");
        return 1;
      }
    }
  }
  printf("1\n");
  return 0;
}
*/

int main()
{
  int  a, b, c, d, e, X, Y ,r;
  //unsigned long long a, b, c, d, e, X, Y;
  //  double  c;
// long long  A[200003]={};
  int  A[200003]={};
  int  B[100003]={};
//  int  C[100003][100001]={};
  int  C[100003]={};

  int  flg=0;

//  char s[101][101]={};
  char s[10000001][11]={};
  char t[100001]={};
//  int N, M;
//  int A[1000000001]={};
//  long long  C[101]={};
  int i,j,k;
  long long p=0,q=0;
  int sosuu[46] ={2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199};
  int min =100000001;
  int len=0;
  int l=0;
  int cnt=0;
  int num=0;
  int num1=0;
  int num2=0;
  long long  ans=0;
  int ans_ac=0;
  int ans_wa=0;
  int max=0;
  long long sum=0;
  int addr=0;
  int ptn=0;
  int  tmp=0;
  double per=0; 
//  bool on_off[100]={};
  
//  char alp[26]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
//  b=100;
  //  a=0;
  scanf("%d%d", &A[0], &A[1]);
  if(A[1]%2==1) {
    printf("No\n");
    return 0;
  }
//  printf("%llu\n",);
  int trrg=0;
  int kmrg=0;
  int tr=0;
  int km=0;

  
  trrg=A[0]*2;
  kmrg=A[1]-trrg;
  km=kmrg/2;
  tr=A[0]-km;
  if(km<0 | tr<0)  printf("No\n");
  
  else printf("Yes\n");
return 0;
}


Measured memory_bytes: 2444
n=int(input())
a=[0]+list(map(int,input().split()))+[0]
l=[0]*n
for i in range(n):l[i]=abs(a[i]-a[i+2])-abs(a[i]-a[i+1])-abs(a[i+1]-a[i+2])
s=sum(abs(a[i]-a[i+1]) for i in range(n+1))
for i in range(n):print(s+l[i])

Measured memory_bytes: 14048
def main(): 
    mod = 998244353
    n,k = map(int,input().split())
    LR = [list(map(int,input().split())) for _ in range(k)]

    dp = [0]*(n*2 + 100)
    dp[1] = 1
    dp[2] = -1
    for i in range(1,n + 1):
        dp[i] = (dp[i] + dp[i - 1])%mod
        for l,r in LR:
            if i + l > n:
                continue
            dp[l + i] = (dp[l+i] + dp[i])%mod
            dp[r + i + 1] = dp[r+i+1] - dp[i]  if dp[r+i+1] - dp[i] > 0 else dp[r+i+1] - dp[i] + 998244353
    print(dp[n]%998244353) 
    return

if __name__ == "__main__":
    main()

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


int main(){
	
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
 
    // #ifndef ONLINE_JUDGE
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    // #endif

	int n;
	string s;
	cin >> n >> s;
	int cnt=0;
	for(auto i:s) if(i=='R') cnt++; else cnt--;
	if(cnt>0) cout << "Yes";
	else cout << "No";


	


 
 
	
 
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <string.h>
#include <map>
#include <set>
#include <vector>
#include <stdio.h>
#include <math.h>
#include <algorithm>
#include <queue>
#include <cmath>
#include <cstdio>
using namespace std;
int main(){
int a,b;
int ans=0;
int d=0;
int c[5];
cin>>a>>b;
for(int i=a;i<=b;i++){
d=i;
int j=0;
while(d>0)
{
c[j]=d%10;
d/=10;
j++;}
for(int k=0;k<5;k++){
if(c[k]!=c[4-k])
break;
else if(k==4)
ans++;}}
cout<<ans;
system("pause");
return 0;
}

Measured memory_bytes: 504
#include<bits/stdc++.h>
using namespace std;
int main() {
    int n,i,j;
    cin>>n;
    int dp[n][3];
    for(i=0;i<n;i++)
    {
        for(j=0;j<3;j++)
        cin>>dp[i][j];
    }
    for(i=1;i<n;i++)
    {
        dp[i][0]+=max(dp[i-1][1],dp[i-1][2]);
        dp[i][1]+=max(dp[i-1][0],dp[i-1][2]);
        dp[i][2]+=max(dp[i-1][0],dp[i-1][1]);
    }
    cout<<max(max(dp[n-1][0],dp[n-1][1]),dp[n-1][2])<<endl;
}


Measured memory_bytes: 1408
/*
 It's better to sleep happy and tired rather than disappointed and frustrated
 There's only 1 thing that's impossible and that is defeating a man who doesn't give up
*/
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define mx2 102
#define mx3 1003
#define mx4 10004
#define mx5 100005
#define mx6 1000006
#define mod 1000000007
#define PI 3.14159265
#define deb(x) cout << #x << " " << x << endl;
#define fo(i,n) for(int i=0 ; i<n ; i++)
#define Fo(i,k,n) for(int i=k ; i<n ; i++)
 
typedef long long int ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<pair<int,int>,int> piii;

const int inf=0x3f3f3f3f;
string str;
 
int main() {
	ios::sync_with_stdio(false);
	//int t;cin>>t;while(t--)
	{
		ll n , k , x ;
		cin>>n>>k;
		if(n == k) {
			cout<< "0";
		} else if (n < k) {
			cout << min(n,k-n);
		} else {
			x = n/k;
			cout<< min(n-x*k,(x+1)*k-n);
		}
		
	}
	return 0;
}


Measured memory_bytes: 256
import java.util.*;
import java.lang.*;
import java.io.*;

public class Main {
    static class Fast {
        BufferedReader br;
        StringTokenizer st;

        public Fast() {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
    public static void main(String args[]) throws Exception {
        Fast in = new Fast();
        String t="";
        String str=in.nextLine();
        String arr[]=str.split("eraser");
        StringBuilder sb=new StringBuilder();
        for (int i = 0; i < arr.length; i++) {
            sb.append(arr[i]);
        }
        if(sb.length()==0){
            System.out.println("YES");
            return;
        }
        String arr1[]=sb.toString().split("erase");
        StringBuilder sb2=new StringBuilder();
        for (int i = 0; i < arr1.length; i++) {
            sb2.append(arr1[i]);
        }
        if(sb2.length()==0){
            System.out.println("YES");
            return;
        }
        String arr2[]=sb2.toString().split("dreamer");
        StringBuilder sb3=new StringBuilder();
        for (int i = 0; i < arr2.length; i++) {
            sb3.append(arr2[i]);
        }
        if(sb3.length()==0){
            System.out.println("YES");
            return;
        }
        String arr3[]=sb3.toString().split("dream");
        StringBuilder sb4=new StringBuilder();
        for (int i = 0; i < arr3.length; i++) {
            sb4.append(arr3[i]);
        }
        if(sb4.length()==0){
            System.out.println("YES");
            return;
        }else{
            System.out.println("NO");
        }

    }
}

Measured memory_bytes: 26452
#include<bits/stdc++.h>
// Begin Header {{{
#define all(x) (x).begin(), (x).end()
#define lli long long int
#define rep(i,n) for(lli i=0; i<n; i++)
#define loop(i, j, n) for(lli i=j; i<n; i++)
lli combi(lli n, lli r)
{
	if(r==0 || r==n) return 1;
	else return combi(n-1,r) + combi(n-1,r-1);
}
double sigma1(double n){return n*(n+1)/2;}
lli sigma2(lli s, lli n){return sigma1(n) - sigma1(s -1);}
using namespace std;
// }}} End Header

int main()
{
	lli n, k;
	double P, sum=0, max;
	cin >> n >> k;
	queue<double> que;
	rep(i,k){
		cin >> P;
		sum += sigma1(P)/P;
		que.push(sigma1(P)/P);
	}
	max = sum;
	rep(i,n-k){
		cin >> P;
		sum += sigma1(P)/P;
		sum -= que.front();
		if(max < sum) max = sum;
		que.push(sigma1(P)/P);
		que.pop();
	}
	printf("%.10lf", max);

	return 0;
}


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

int main(){
    int n, a;
    cin >> n;
    int num[100010]={0};
    int ans = 0;
    for (int i=0; i<n; i++) {
        cin >> a;
        num[a]++;
        num[a+1]++;
        num[a-1]++;
    }
    for (int i=0; i<100000; i++) {
        ans = max(ans, num[i]);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std; 
typedef long long ll;
#define pb push_back
#define fi first
#define se second
const ll mod = 1e9+7;
const int N = 1e5+6;
void solve(){
	int r,g,b,n; 
	cin>>r>>g>>b>>n; 
	int ans = 0;
	for(int i=0;i<=n;i++){
		for(int j=0;j<=n;j++){
			int cst = n-r*i-g*j;
			if(cst>=0 and cst%b==0)ans++;
		}
	}
	cout<<ans<<endl;
}
int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	int t=1; 
//	cin>>t; 
	while(t--){
		solve();
	}
	return 0;
}


Measured memory_bytes: 3572