akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
#ifndef err
#define err(...)(void)0
#endif
using namespace std;
using ll = long long;
using ull = decltype(1ull);
template<class T>int size(T&&a) { return a.size(); }
#define REP(t,a)for(make_signed<decltype(a.second)>::type t=a.first,_l##t=a.second;t<_l##t;t++)
#define RREP(t,a)for(make_signed<decltype(a.second)>::type t=a.second-1,_l##t=a.first;t>=_l##t;t--)
template<class B>pair<int, B>make_pair(B b) { return{ 0,b }; }
#define rep(t,...)REP(t,make_pair(__VA_ARGS__))
#define rrep(t,...)RREP(t,make_pair(__VA_ARGS__))
#define all(a)begin(a),end(a)
#define rall(a)a.rbegin(),a.rend()

void Calc();
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0); cin.exceptions(istream::failbit | istream::badbit);
  cout << fixed << setprecision(15); Calc(); cout.flush(); return 0;
}
template<class A>void amax(A&a, A b) { a = max(a, b); }
template<class A>void amin(A&a, A b) { a = min(a, b); }
struct Scanner {
  template<class A = string>A Next() { A a; cin >> a; return a; }
  template<class A = int>vector<A>Array(int n) { vector<A>a(n); for (A&i : a) cin >> i; return a; }
  string Line() { string s; getline(cin, s); return s; }
  template<class A>Scanner&operator,(A&a) { a = Next<A>(); return *this; }
  template<class A>operator A() { return Next<A>(); }
}in;

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


void Calc() {
  int k, t;
  in, k, t;
  auto a = in.Array(t);

  priority_queue<int> q;
  for (auto& i : a) {
    q.push(i);
  }
  int ans = 0;
  while (q.size()) {
    auto p = q.top(); q.pop();
    if (q.size() == 0) break;
    auto pp = q.top(); q.pop();
    ans += 2;
    if (pp != 1)q.push(pp - 1);
    if (p != 1)q.push(p - 1);
  }
  cout << max(0, k - ans - 1) << endl;
}


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

int main(){
    ll n, a, b;
    scanf("%lld %lld %lld", &n, &a, &b);
    if(a+b-1 > n || a*b < n) { printf("%d\n",-1); return 0; }
    ll k = a*b-n; ll count = 1;
    rep(i,a){
        if(k == 0){
            count += b-1;
            rep(i,b) { printf("%lld ",count); count--; }
            count += b+1;
        }
        else if(k < b-1){
            count += b-k-1;
            rep(i,b-k) { printf("%lld ",count); count--; }
            count += b-k+1;
            k = 0;
        }
        else{
            printf("%lld ",count); count++;
            k -= b-1;
        }
    }
    printf("\n");
    return 0;
}

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

#define pint2 pair<int, int>

int main() {
	vector<pint2> vec; int an; cin >> an; vec.resize(an);
	for (int i = 0; i < an; i++)
		cin >> vec[i].first >> vec[i].second;
	sort(vec.begin(), vec.end());
	for (int i = 0; i < an; i++)
		cout << vec[i].first << " " << vec[i].second << endl;
	return 0;
}


Measured memory_bytes: 3636
n, m = map(int, input().split())

aclist = [0] * n
penaltylist = [0] * n

for _ in range(m):
  p, s = input().split()
  p = int(p)

  if aclist[p-1] != 0:
    continue

  if s == 'AC':
    aclist[p-1] += 1
  else:
    penaltylist[p-1] += 1

ac = 0
penalty = 0
for i in range(n):
  if aclist[i] == 0:
    continue

  ac += 1
  penalty += penaltylist[i]

print(ac, penalty)


Measured memory_bytes: 4596
N, L = input().split()
N, L = int(N), int(L)

a = [0]*N

inputStr = input().split()
for i in range(N):
    a[i] = int(inputStr[i])

def check():
    for i in range(N-1):
        if(a[i]+a[i+1]>=L):
            return i
    return -1

b = check()

if(b==-1):
    print("Impossible")
else:
    print("Possible")
    for i in range(0,b):
        print(i+1)
    for i in range(b+1,N-1):
        print(N - (i-b))
    print(b+1)




Measured memory_bytes: 15168
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <functional>
#include <bitset>

using namespace std;
#define int long long int
const int INF = 1001001001001001LL;
const int MOD = 1000000007;

int di[] = {-1, 0, 1, 0, -1, 1, 1, -1};
int dj[] = {0, 1, 0, -1, 1, 1, -1, -1};


// quoted from beet-aizu
template <typename T, typename E, typename F, typename G>
struct SegmentTree{
    // using F = function<T(T, T)>
    // using G = function<T(T, E)>
    int n;
    F f;
    G g;
    T ti;
    vector<T> dat;
    SegmentTree(){};
    SegmentTree(F f,G g,T ti):f(f),g(g),ti(ti){}
    void init(int n_){    
        n=1;
        while(n<n_) n<<=1;
        dat.assign(n<<1,ti);
    }
    void build(const vector<T> &v){
        int n_=v.size();
        init(n_);
        for(int i=0;i<n_;i++) dat[n+i]=v[i];
        for(int i=n-1;i;i--)
            dat[i]=f(dat[(i<<1)|0],dat[(i<<1)|1]);
    }
    void update(int k,const E &x){
        k += n;
        dat[k] = g(dat[k], x);
        while(k>>=1)
            dat[k]=f(dat[(k<<1)|0],dat[(k<<1)|1]);    
    }
    T operator [](int k) const { return dat[k+n]; }
    T query(int a,int b) const {
        T vl=ti,vr=ti;
        for(int l=a+n,r=b+n;l<r;l>>=1,r>>=1) {
            if(l&1) vl=f(vl,dat[l++]);
            if(r&1) vr=f(dat[--r],vr);
        }
        return f(vl,vr);
    }

    
    
    /* TODO わからない 聞く 
    template<typename C>
    int find(int a,int b,C &check,int k,int l,int r){
        if(!check(dat[k])||r<=a||b<=l) return -1;
        if(k>=n) return k-n;
        int m=(l+r)>>1;
        int vl=find(a,b,check,(k<<1)|0,l,m);
        if(~vl) return vl;
        return find(a,b,check,(k<<1)|1,m,r);
    }
    template<typename C>
    int find(int a,int b,C &check){
        return find(a,b,check,1,0,n);
    }*/
    
};

signed main(){
  
    int n; cin >> n;
    vector<int> a(n);
    for(int i = 0; i < n; i++){
        cin >> a[i];
    }

    vector<pair<int, int>> dat(n);
    for(int i = 0; i < n; i++){
        dat[i] = {a[i], i};
    }

    auto f = [](pair<int, int> a, pair<int, int> b){
      if(a.first != b.first) return min(a, b);
      else return max(a, b);
    };
    
    auto g = [](pair<int, int> a, pair<int, int> b){ return b; };
    SegmentTree<pair<int, int>, pair<int, int>, decltype(f), decltype(g)> sg(f, g, {INF, INF});
    sg.build(dat);
    
    int ans = 0;

    while(1){
        auto pi = sg.query(0, n);
        if(pi.first == INF) break;
        else ans++;
        int l = pi.second;
        sg.update(l, {INF, INF});
        while(1){
            auto sec = sg.query(l, n);
            if(sec.first == INF) break;
            l = sec.second;
            sg.update(l, {INF, INF});
        }
    }

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


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

#define ll long long

void swap (int *x, int *y) {
  int temp;

  temp = *x;
  *x = *y;
  *y = temp;

  return;
}


long int gcd(long int a, long int b){
  long int c;

  while (b > 0){
    c = a % b;
    a = b;
    b = c;
  }

  return a;
}

int upll(const void*a, const void*b){
  return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;
}

int downll(const void*a, const void*b){
  return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;
}

void sortup(ll*a,int n){
  qsort(a,n,sizeof(ll),upll);
}

void sortdown(ll*a,int n){
  qsort(a,n,sizeof(ll),downll);
}

long int modpow(long int a,long int n,long int mod){
  long int ans=1;
  while(n>0){
    if(n & 1){
      ans=ans*a%mod;
    }
    a=a*a%mod;
    n/=2;
  }
  return ans;
}

long int modinv(long int a,long int mod){
  return modpow(a,mod-2,mod);
}

int max(int a,int b){
  if(a<b){
    return b;
  }
  else{
    return a;
  }
}

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

void chmax(int *a,int b){
  if(*a < b){
    *a = b;
  }

  return;
}

void chmin(int *a,int b){
  if(*a > b){
    *a =b;
  }

  return;
}


int main(void){
  char o[60],e[60],s[110];
  scanf("%s%s",o,e);
  int l=strlen(o),k=strlen(e),n=l+k;
  for(int i=0;i<l;i++){
    s[2*i]=o[i];
  }
  for(int i=0;i<k;i++){
    s[2*i+1]=e[i];
  }
  for(int i=0;i<n;i++){
    printf("%c",s[i]);
  }
  printf("\n");
  return 0;
}

Measured memory_bytes: 1656
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10**9 + 7
#from decimal import *

N = INT()
xyh = [LIST() for _ in range(N)]

h_dict = defaultdict(int)
xyh.sort(key = lambda x:[x[0], x[1]])

for Cx in range(101):
	for Cy in range(101):
		H = 0
		H_max = INF
		for x, y, h in xyh:
			if h == 0:
				H_max = min(H_max, h + abs(x-Cx) + abs(y-Cy))
			else:
				if H == 0:
					H = h + abs(x-Cx) + abs(y-Cy)
				else:
					if H != h + abs(x-Cx) + abs(y-Cy):
						break

		else:
			if H <= H_max:
				print(Cx, Cy, H)
				break
	else:
		continue
	break



Measured memory_bytes: 5204
#include<iostream>
#include<set>
using namespace std;
typedef long long ll;

int main(){
    ll n;
    cin >> n;
    ll ans = 0;
    for(ll i = 1; i*i <= n; i++){
        if(n%i) continue;
        ll m = n/i-1;
        if(m > 0 && n/m == n%m)   ans += m;
        if(i == n/i)    continue;
        m = i-1;
        if(m > 0 && n/m == n%m) ans += m;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import std.algorithm;
import std.array;
import std.container;
import std.conv;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

void scan(T...)(ref T a) {
    string[] ss = readln.split;
    foreach (i, t; T) a[i] = ss[i].to!t;
}
T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;

int calc(string s) {
    // 全ての文字を c にする
    int f(dchar c, string s) {
        auto cs = s.dup.array;
        int n = cast(int)s.length - 1; // 次の文字列の長さ
        foreach (i; 0..n) {
            bool ok = true;
            foreach (j; 0..n) {
                cs[j] = cs[j] == c ? cs[j] : cs[j+1];
                if (cs[j] != c) ok = false;
            }
            if (ok) return i + 1;
            n--;
        }
        return 0;
    }

    if (s.all!(c => c== s[0])) return 0;
    return s.map!(c => f(c, s)).reduce!min;
}

void main() {
    string s = read!string;
    writeln(calc(s));
}


Measured memory_bytes: 380
///A drunk man will find his way home, but a drunk bird may get lost forever...
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define f first
#define s second
#define int long long
#define sz(x) (int)x.size()
int a[1000 * 100 + 5];
int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
	int n, k = 1, ans = 0;
	cin >> n;
	for(int i = 0; i < n; i++){
		cin >> a[i];
		if(a[i] == k){
			k++;
			continue;
		}
		if(a[i] < k)
			continue;
		ans += (a[i] - 1) / k;
		if(k == 1)
			k++;
	}
	cout << ans << endl;
	return 0;
}


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

int main(){
  int a;
  int f1=0,f2=0,f3=0;
  string S;
  cin >> S;
  if(S.at(0)=='A')
    f1 = 1;
  for(int i=2;i<=S.size()-2;i++){
    if(S.at(i)=='C'){
    	f2++;
     	a = i;
    }
  }
  for(int j=1;j<S.size();j++){
    f3 = 1;
    if(64 < S.at(j) && S.at(j)< 91 && S.at(j)!='C'){
      f3 = 0;
      break;
    }
  }
  if(f1==1&& f2==1&&f3==1)
    cout << "AC" << endl;
  else 
    cout << "WA" << endl;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

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

    if(!(N % 4) || !(N % 7)){
        cout << "Yes" << endl;
        return 0;
    }else{
        for(int i = 1; i < (N / 4); ++i){
            if(!((N - 4 * i) % 7)) {
                cout << "Yes" << endl;
                return 0;
            }
        }
    }

    cout << "No" << endl;

    return 0;
}

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

int main(void){
  int N;
  cin >> N;
  int A[N];
  int count = 0;
  for(int i = 0;i < N;i++){
    cin >> A[i];
    count += A[i];
  }
  cout << count - N << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  long long K;
  cin >> K;
  if(K == 7 || K == 1){
    cout << "1" << endl;
    return 0;
  }
  long long amari = fmod(7,K);
  for(long long i = 1; i <= K; i++){
    if(fmod((amari*10+7),K) == 0){
      cout << i+1 << endl;
      return 0;
    }
    amari = fmod((amari*10+7),K);
  }
  cout << -1 << endl;
}

Measured memory_bytes: 3664
#define _CRT_SECURE_NO_WARNINGS
#include <algorithm>
#include <iomanip>
#include <vector>
#include <stack>
#include <string>
#include <bitset>
#include <queue>
#include <iostream>
#include <cmath>
#define cz size_t
#define fx(x) << fixed;cout << setprecision(x)
#define u unsigned
#define ll long long
using namespace std;
int a, n, in, r, t, c = 0, k, mx, b, j = 1, m, l, y, rd;
double pi = 3.1415926535;
vector<int > f;
vector<vector<int>> g;
bitset<13> bt(0x0);
string s;
bool ch = true;
stack<cz> q, ans;
vector<bool> used;

int main()
{
	cin.tie();
	cout.tie();
	ios::sync_with_stdio(false);
	//freopen("aquarium.out", "w", stdout); freopen("aquarium.in", "r", stdin);
	cin >> n>>m;
	for (cz i = 0; i < m; i++)
	{
		cin >> a;
		b += a;
	}
	n -= b;
	if (n < 0)
		n = -1;
	cout << n;
	return 0;
}





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

using namespace std;
typedef long long ll;

int main()
{
	int n, m;
	cin >> n >> m;
	vector<int> A(n);
	for (int i = 0; i < n; i++)  cin >> A[i];

	long double sum = 0;
	sort(A.begin(), A.end());
	for (int i = 0; i < n; i++)  sum += A[i];
	sum = sum / (4 * m);

	int cnt = 0;
	for (int i = 0; i < n; i++) {
		if (A[i] >= sum)  cnt++;
	}

	if (cnt >= m) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include<stdio.h>

void Initialization(int[][11]);

int main() {
	int d[11][11], n, i, sum, j;
	while (scanf("%d", &n),n!=0) {
		Initialization(d);
		for (i = 0; i < n; i++) {
			sum = 0;
			for (j = 0; j < n; j++) {
				scanf("%d", &d[i][j]);
				sum += d[i][j];
			}
			d[i][n] = sum;
		}
		for (i = 0; i <= n; i++) {
			sum = 0;
			for (j = 0; j < n; j++) {
				sum += d[j][i];
			}
			d[n][i] = sum;
		}
		for (i = 0; i <= n; i++) {
			for (j = 0; j <= n; j++)  printf("%5d", d[i][j]); 
			printf("\n");
		}
	}
	return 0;
}

void Initialization(int d[][11])
{
	int i, j;
	for (i = 0; i <= 10; i++) for (j = 0; j <= 10; j++)  d[i][j] = 0;
}

Measured memory_bytes: 616
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <vector>
#include <math.h>
#include <bitset>
#include <queue>

using namespace std;

void solve() {
    int a, b;
    cin >> a >> b;
    int count = 0;
    for(int i = a; i <= b; i++) {
        string tmp = to_string(i);
        bool flag = true;
        for(int i = 0; i < tmp.size()/2; i++) {
            if(tmp.substr(i,1) != tmp.substr(tmp.size()-i-1, 1)) {
                flag = false;
                break;
            }
        }
        if (flag) {
            count++;
        }
    }
    cout << count;
}

int main() {
    solve();
    return 0;
}

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

using namespace std;

int main()
{
    long long x,y;
    cin >> x >> y;
    if(x%y==0)
        printf("-1\n");
    else
    {
        int flag=0;
        for(int i=2;i*x<=1000000000000000000;i++)
        {
            long long z=i*x;
            if(z%y)
            {
                printf("%lld\n",i*x);
                flag=1;
                break;
            }
        }
        if(flag==0)
            printf("-1\n");
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ALL(a)  (a).begin(),(a).end()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<long long, long long> Pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
template <typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template <typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
const int INT_INF = 1 << 30;
#define MOD 1000000007LL
#define endl "\n"

int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  ll N, K;
  cin >> N >> K;
  vector<bool> flag(N, false);
  for(int i = 0; i < K; i++){
    int d;
    cin >> d;
    for(int i = 0; i < d; i++){
      ll A;
      cin >> A;
      A--;
      flag.at(A) = true;
    }
  }
  ll counter = 0;
  for(int i = 0; i < N; i++){
    if(!flag.at(i)) counter++;
  }
  cout<< counter << endl;
}

Measured memory_bytes: 3652
s = input()
if s == 'SUN':
    print(7)
elif s == 'MON':
    print(6)
elif s=='TUE':
    print(5)
elif s=='WED':
    print(4)
elif s=='THU':
    print(3)
elif s=='FRI':
    print(2)
elif s=='SAT':
    print(1)

Measured memory_bytes: 2940
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<cmath>
using namespace std;
const int maxn = 10005;
int a[maxn];
int main(){
	string s;
	cin>>s;
	int res=maxn;
	for(int i=0;i<s.length()-2;i++){
		int value =0;
		int j=i+2;
		int k=i;
		while(j!=i-1){
			value =value*10+s[k++]-'0';
			j--;
		}
		res=min(abs(value-753),res);
	} 
	printf("%d",res);
} 

Measured memory_bytes: 256
fun main(args: Array<String>) {
    val N = nextInt()
    val A = listOfLong(-1)
    val ans = A.sum()
    println(ans)
}
fun next() = readLine()!!
fun nextInt() = Integer.parseInt(next())
fun listOfString() = next().split(" ")
fun listOfLong(offset: Long = 0L) = listOfString().map { java.lang.Long.parseLong(it) + offset }



Measured memory_bytes: 40460
#include <iostream>
#include<algorithm>
#include<string>
#include<vector>
#define _USE_MATH_DEFINES
#include <math.h>
#include <iomanip>
#include <stdio.h>
#include <numeric>
#include <cmath>
#include <limits>
using namespace std;


int main()
{
	int n, a, b, tmp = 0, tmp2 = 0, sum = 0, ans = 0;
	cin >> n >> a >> b;
	string s;
	
	for (int i = 1; i <= n; i++) {
		tmp = i;
		tmp2 = i;
		s = to_string(tmp);
		for (int j = 0; j < s.length(); j++) {
			sum += tmp % 10;
			tmp /= 10;
		}
		if (a <= sum && sum <= b)ans += tmp2;
		sum = 0;
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
# class UnionFind:
#
#     def __init__(self,n):
#         self.roots = range(n)
#
#     def

def root(i):
    if par[i] == i:
        return i

    par[i]=root(par[i])
    return par[i]

def unite(x,y):
    xr = root(x)
    yr = root(y)
    par[yr] = xr

def same(x,y):
    return root(x)==root(y)



n,q = map(int,input().split())

par = list(range(n))

for i in range(q):
    commands = list(map(int,input().split()))
    if commands[0] == 0:
        unite(commands[1], commands[2])
    if commands[0] == 1:
        if same(commands[1], commands[2]):
            print(1)
        else:
            print(0)

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

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

#define For(i, a, b) for(int i = (a); i < (b); i++)
#define Rep(i, n) For(i, 0, (n))
#define Rrep(i, n) for(int i = (n - 1); i >= 0; i--)
#define Itr(i, c) for(typeof(c.begin()) i = c.begin(); i != c.end(); i++)
#define pb push_back

const int inf = 999999999;
const int mod = 1000000007;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

int c1[26], c2[26];

int main(){
	string s, t; cin >> s >> t;
	int l = s.size();
	Rep(i, l){
		int k = s[i] - 'a';
		c1[k] += 1;
		k = t[i] - 'a';
		c2[k] += 1;
	}
	sort(c1, c1 + 26);
	sort(c2, c2 + 26);
	bool flag = true;
	Rep(i, 26){
		if(c1[i] == c2[i]){
			continue;
		}else{
			flag = false;
		}
	}
	if(flag){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}
	return 0;
}


Measured memory_bytes: 776
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rep2(i, s, n) for(int i=s; i<(n); ++i)
#define ALL(v) (v).begin(), (v).end()

using namespace std;

typedef long long ll;

static const int INTINF = (2147483647);
static const ll LLINF = (9223372036854775807);
static const int MAX = 1e5+1;
static const ll MOD = 1e9+7;

namespace Printer{
    template<class T>
    void print(T x){
        cout << x << endl;
    }

    template<class T>
    void print(T x, T y){
        cout << x << "," << y << endl;
    }

    template<class T>
    void print(vector<T> v){
        rep(i, v.size()){
            if(i) cout << " ";
            cout<< v[i];
        }
        cout << endl;
    }

    template<class T>
    void print(vector<vector<T> > vv){
        rep(i, vv.size()){
            rep(j, vv[i].size()){
                if(j) cout << " ";
                cout << vv[i][j];
            }
            cout << endl;
        }
    }

    void print(pair<int, int> p){
        cout << "(" << p.first << ", " << p.second << ")" << endl;
    }
};
using namespace Printer;

//--global--//



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

int main(int argc, const char * argv[]) {
    //提出時、消す----//
    //--------------//

    int n;
    string str;
    cin >> n >> str;
    int cnt = 0;
    rep(i, n-2){
        if(str[i] == 'A' && str[i+1] == 'B' && str[i+2] == 'C'){
            cnt++;
        }
    }

    cout << cnt << endl;
    
    
    return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
#include <random>
#include <unordered_set>
#include <complex>
using namespace std;
 
#define rep(i, N) for (int i = 0; i < N; i++)
#define pb push_back
 
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<ll, int> ll_i;
typedef pair<double, int> d_i;
typedef pair<ll, ll> ll_ll;
typedef pair<double, double> d_d;
struct edge { int u, v; ll w; };
// typedef complex<double> C;
 
ll MOD = 1000000007;
ll _MOD = 1000000009;
int INF = INT_MAX / 2;
double EPS = 1e-10;

template <int M>
struct ModInt {
	int x;
	ModInt() : x(0) {}
	ModInt(int _x) { if ((x = _x % M) < 0) x += M; }
	int operator () () const { return x; }
	ModInt operator - () const { ModInt a = *this; if (a.x) a.x = M - a.x; return a; }
	ModInt& operator += (const ModInt &a) { if ((x += a.x) >= M) x -= M; return *this; }
	ModInt& operator -= (const ModInt &a) { if ((x -= a.x) < M) x += M; return *this; }
	ModInt& operator *= (const ModInt &a) { x = (ll)x * a.x % M; return *this; }
	ModInt operator + (const ModInt &a) const { return ModInt(*this) += a; }
	ModInt operator - (const ModInt &a) const { return ModInt(*this) -= a; }
	ModInt operator * (const ModInt &a) const { return ModInt(*this) *= a; }
};
typedef ModInt<1000000007> mint;

int main() {
	int N, A, B, C, D;
	cin >> N >> A >> B >> C >> D;
	vector<vector<mint> > comb(N + 1, vector<mint>(N + 1));
	for (int x = 0; x <= N; x++) {
		comb[x][0] = 1;
		for (int y = 1; y <= x; y++)
			comb[x][y] = comb[x - 1][y - 1] + comb[x - 1][y];
	}
	vector<vector<mint> > dp(N + 1, vector<mint>(N + 2));
	dp[0][1] = 1;
	for (int x = 0; x <= N; x++) for (int y = 1; y <= N; y++) {
		dp[x][y + 1] += dp[x][y];
		mint a = 1;
		if (A <= y && y <= B)
			for (int z = 1; x + y * z <= N; z++) {
				a *= comb[y * z - 1][y - 1];
				if (C <= z && z <= D)
					dp[x + y * z][y + 1] += dp[x][y] * comb[N - x][y * z] * a;
			}
	}
	cout << dp[N][N + 1]() << endl;
}


Measured memory_bytes: 8192
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <tuple>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cassert>
#include <cstdint>
#include <numeric>
#include <bitset>
#include <functional>

using namespace std;

using ll =  long long;
using Pll = pair<ll, ll>;
using Pii = pair<int, int>;

constexpr ll MOD = 1000000007;
constexpr long double EPS = 1e-10;
constexpr int dyx[4][2] = {
    { 0, 1}, {-1, 0}, {0,-1}, {1, 0}
};

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    string s;
    cin >> s;
    if(s == "SUN") {
        cout << 7 << endl;
    } else if(s == "MON") {
        cout << 6 << endl;
    } else if(s == "TUE") {
        cout << 5 << endl;
    } else if(s == "WED") {
        cout << 4 << endl;
    } else if(s == "THU") {
        cout << 3 << endl;
    } else if(s == "FRI") {
        cout << 2 << endl;
    } else if(s == "SAT") {
        cout << 1 << endl;
    }
}


Measured memory_bytes: 256
import java.util.*;

public class Main{
	public static void main(String[] args){
      Scanner scanner = new Scanner(System.in);
      int a = scanner.nextInt();
      int b = scanner.nextInt();
      int c = scanner.nextInt();
      
      int count=0;
      int compare=0;
      
      for(int i = a; i > 0 ; i--){
          compare = 0;
        
        List<String> split = Arrays.asList(String.valueOf(i).split(""));
        for(int j = 0; j < split.size(); j++ ){
            compare += Integer.parseInt(split.get(j));
        }
        
        if(b<= compare && compare <= c){
            count += i;
        }
      }
    System.out.println(count);
  }
}


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

using pi = pair<int, int>;
using vi = vector<int>;
using vpi = vector<pi>;
using vvi = vector<vi>;
using vvpi = vector<vpi>;
using pl = pair<long long, long long>;
using vl = vector<long long>;
using vpl = vector<pl>;
using vvl = vector<vl>;
using vvpl = vector<vpl>;

void resuelveCaso() {
	int x; cin >> x;
	cout << (x >= 30? "Yes" : "No") << endl;
}

int main() {
	int T= 1;
	for (int i = 1; i <= T; i++) {
		//cout << "Case #" << i << ": ";
		resuelveCaso();
	}
	return 0;
}




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

using namespace std;

#define forn(i, x, n) for (int i = int(x); i <= int(n); ++i)
#define for1(i, n, x) for (int i = int(n); i >= int(x); --i)
#define F first
#define S second
#define pb push_back

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

const int N = 2e2 + 1;
const int INF = 1e9 + 9;
const int B = 1e9 + 7;

int n;
ll d[N], p[N], c[N], dg[N];
vi g[N], v[N];

void dfs(int x) {
    for (auto to : g[x])
        if (to != p[x])
            {d[to] = d[x] + 1; p[to] = x; dfs(to);}
}

void dcount(int x, int p, int lvl) {
    dg[x] = 0;
    v[lvl].pb(x);
    for (auto to : g[x])
        if (to != p)
            {dcount(to, x, lvl + 1); ++dg[x];}
}

ll sav[N][N];

ll solveforv(int x, int y) {
    if (x > y) swap(x, y);
    if (sav[x][y]) return sav[x][y];
    forn(i, 0, n - 1) v[i].clear();
    dcount(x, y, 0);
    if (x != y) dcount(y, x, 0);
    ll ans = 0;
    for1(i, n - 1, 0) {
        if (!v[i].size()) continue;
        if (!v[i + 1].size()) {
            ans = v[i].size();
            c[i] = 1;
            continue;
        }
        ll mx = 0;
        for (auto q : v[i])
            mx = max(mx, dg[q]);
        for (auto q : v[i])
            ans += (mx - dg[q]) * c[i + 1];
        c[i] = mx * c[i + 1];
    }
    return sav[x][y] = ans;
}

ll solve(int x, int y) {
    bool ok = (x == 1 && y == 7);
    int len = d[y];
    forn(i, 1, len / 2) y = p[y];
    ll ans = 0;
    if (len % 2 == 0) {
        ans = solveforv(y, y);
        for (auto to : g[y])
            ans = min(ans, solveforv(y, to));
    }
    else
        ans = solveforv(y, p[y]);
    return ans;
}

int main() {
    #ifdef black
    freopen("in", "r", stdin);
    #endif // black
    ios_base :: sync_with_stdio(0);
    cin.tie(0);

    cin >> n;
    forn(i, 1, n - 1) {
        int f, t;
        cin >> f >> t;
        g[f].pb(t);
        g[t].pb(f);
    }

    pii ans = {INF, INF};
    int diam = 0;
    forn(i, 1, n) {
        d[i] = 0, p[i] = 0;
        dfs(i);
        forn(j, i + 1, n) {
            if (d[j] < diam) continue;
            if (d[j] == diam) {
                ans.S = min(ans.S, solve(i, j));
            }
            if (d[j] > diam) {
                diam = d[j];
                ans = {diam / 2 + 1, solve(i, j)};
            }
        }
    }

    cout << ans.F << " " << ans.S << "\n";

    return 0;
}


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

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<vvd> vvvd;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
typedef long long LL;
#define REP(i,N) for (int i=0; i<N; i++)

int main() {
  string s;
  cin >> s;
  for (int i = 0; 2*i < s.length(); i++) {
    cout << s[2*i];
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
using namespace std;

const long long N = 3e6 + 17;
ll a[N], b[N], cnt = 1, ans, lnt, n, m, r1, r0, l1, l0, sum, mx, h, c[N], t[N], mn = N, x, y;
pair<ll,ll>pr[N];
vector<ll>v,v2;
map<ll,ll>mp;
bool used[N];
char ch[N];
ll prime[N] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53};

int main()
{
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    ll siz = 5;
    for(ll i = 0; i < siz; i ++)
    {
        cin >> a[i];
    }
    cin >> h;
    for(ll i = 0; i < siz; i ++)
    {
        for(ll j = 0; j < siz; j ++)
        {
            if(abs(a[i] - a[j]) > h and i != j)
            {
                cout << ":(";
                return 0;
            }
        }
    }
    cout << "Yay!";
    return 0;
}


Measured memory_bytes: 6400
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String {
            bytes
                .by_ref()
                .map(|r| r.unwrap() as char)
                .skip_while(|c| c.is_whitespace())
                .take_while(|c| !c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!{
        s: chars
    }
    let sum: usize = s.iter().map(|c| if *c == 'x' {1} else {0}).sum();
    if sum > 7 {
        println!("NO");
    } else {
        println!("YES");
    }
}


Measured memory_bytes: 4352
N,K,Q = [int(i) for i in input().split(" ")]
A = [int(input()) for _ in range(Q)]
point = [K for i in range(N)]

for q in A:
    point[q-1]+=1
for i in list(map(lambda x: x - Q,point)):
    if 0 < i:
        print("Yes")
    else:
        print("No")

Measured memory_bytes: 58200
#include <bits/stdc++.h>
using namespace std;
using ll = long long; // ll は long long　と同じとする。
int main () {
    int A , B , C;
    cin >> A >> B >> C;
    for(int i = 1; i <= B; i++){
        if((i * A) % B == C){
            cout << "YES" << endl;
            return 0;
        }
    }
    cout << "NO" << endl;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

bool isYYMM(int n)
{
  int m = n % 100;
  if(m >= 1 && m <= 12) {
    return true;
  }
  return false;
}

bool isMMYY(int n)
{
  int m = n / 100;
  m = m % 100;
  if(m >= 1 && m <= 12) {
    return true;
  }
  return false;
}

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

  bool isyymm = isYYMM(n);
  bool ismmyy = isMMYY(n);

  if(isyymm && ismmyy) {
    cout << "AMBIGUOUS" << endl;
    return 0;
  }
  
  if(!isyymm && !ismmyy) {
    cout << "NA" << endl;
    return 0;
  }
  
  if(isyymm) {
    cout << "YYMM" << endl;
    return 0;
  }

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


Measured memory_bytes: 256
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

#define SORT(c) sort((c).begin(),(c).end())
#define ANS(ans) cout<<(ans)<<endl;


//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)



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

	int a[100000 + 2];
	a[0] = 0;
	a[n + 1] = 0;
	int sum = 0;
	FOR(i,1, n+1) {
		cin >> a[i];
	}
	int b[100000 + 1];
	REP(i, n+1) {
		b[i] = abs(a[i + 1] - a[i]);
		sum += b[i];
	}

	REP(i, n) {
		cout << sum - b[i] - b[i + 1] + abs(a[i + 2] - a[i]) << endl;
	}





	return 0;
}



Measured memory_bytes: 2048
#include <bits/stdc++.h>
#define ll long long
#define MODV 1000000007
#define INF INT_MAX // 2147483647
#define INFLL LLONG_MAX // 9223372036854775807
#define rep(i, n) for(ll i=0, i##_len=(ll)(n); i<i##_len; i++)
#define repf(i, n) for(ll i=1, i##_len=(ll)(n+1); i<i##_len; i++)
#define per(i, n) for(ll i=((ll)(n))-1; i>=0; i--)
#define perf(i, n) for(ll i=((ll)(n)); i>0; i--)
#define all(v) v.begin(), v.end()
#define endl "\n"
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define Yes() cout << "Yes" << endl
#define YES() cout << "YES" << endl
#define No() cout << "No" << endl
#define NO() cout << "NO" << endl
#define Init() std::ios::sync_with_stdio(false); std::cin.tie(0); std::cout<<fixed<<setprecision(15);
template<class T>bool chmax(T &a, const T &b){ if(a<b){ a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b){ if(b<a){ a=b; return 1; } return 0; }
using namespace std;

int main(){
    Init();
    ll a, b; cin >> a >> b;
    cout << (((a*b)%2 == 0) ? "Even" : "Odd") << endl; 
}

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

#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 foreach(it, v) for(typeof(v.begin()) it=v.begin(); it!=v.end(); ++it)
#define pb push_back
#define sz(x) (int)(x).size()
#define fi first
#define se second

typedef unsigned int uint;
typedef long long int ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef vector<pii> vpii;
typedef set<int> si;

//MOD//
const ll MOD = 1000000007;
struct big;
big ex(big a, ll tms);
typedef struct big{
  ll val;
  big():val(0){}
  big(ll val):val((val%MOD+MOD)%MOD){}
  big& operator += (const big& obj){ (val+=obj.val)%=MOD; return *this;}
  big& operator -= (const big& obj){ (val+=MOD-obj.val)%=MOD; return *this;}
  big& operator *= (const big& obj){ (val*=obj.val)%=MOD; return *this;}
  big& operator /= (const big& obj){ (val*=ex(obj,MOD-2).val)%=MOD; return *this;}
  big operator + (const big& obj)const{ return big(*this) += obj;}
  big operator - (const big& obj)const{ return big(*this) -= obj;}
  big operator * (const big& obj)const{ return big(*this) *= obj;}
  big operator / (const big& obj)const{ return big(*this) /= obj;}
  bool operator < (const big& obj)const{ return val < obj.val;}
  bool operator == (const big& obj)const{ return val == obj.val;}
} big;
istream& operator >> (istream& i, big& obj){ i>>obj.val; return i;}
ostream& operator << (ostream& o, const big& obj){ o<<obj.val; return o;}
big ex(big obj, ll tms){
  if(!tms) return 1;
  big ret = ex(obj, tms/2);
  ret *= ret;
  return (tms&1) ? ret*obj : ret;
}
//MOD//

ll pow(ll n, int m){
  if(!m) return 1;
  ll ret = pow(n, m/2);
  ret *= ret;
  return (m&1) ? ret*n : ret;
}

template <class F, class T>
void convert(const F &f, T &t){
  stringstream ss;
  ss << f;
  ss >> t;
}

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


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

using namespace std;

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

int main(){
	int n;
	cin >> n;
	vector<int>A(n);
	for(int i = 0; i < n; i++){
		cin >> A[i];
	}

	int ans = gcd(A[0], A[1]);

	for(int i = 2; i < n; i++){
		ans = gcd(ans , A[i]);
	}

	cout << ans << endl;

}

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

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back

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

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

	int sum=0;
	for (int i = 1; i <= n ; ++i){
		sum+=i;
		if(sum>=n){
			for (int j = 1; j <= i ; ++j){
				if(j!=sum-n){
					cout<<j<<endl;
				}
			}
			return 0;
		}
	}

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
typedef long long ll;
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REP(i,num,n) for(int i=num, i##_len=(n); i<i##_len; ++i)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
#define print(x) (cout << (x) << endl)
#define pb push_back
#define mp make_pair
#define sz(x) int(x.size())
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class itr> void cins(itr first, itr last){ for(auto i = first; i != last; i++){ cin >> (*i); } }
template<class itr> void array_output(itr start, itr goal){ string ans; for(auto i = start; i != goal; i++) ans += to_string(*i) + " "; if(!ans.empty()) ans.pop_back(); cout << ans << endl; }
#define fs first
#define sc second

const int INF = 1e9;
const ll LLINF = 1e16;
const ll MOD = 1e9+7;
template<class T> inline void add(T &a, T b){a = ((a+b) % MOD + MOD) % MOD;};

template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}
 
template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}
 

// 指定した文字cが文字列に何文字入ってるか
ll stringcount(string s, char c) {
    return count(s.cbegin(), s.cend(), c);
}


// 割り算の切り上げ処理
template<typename T>
T rp(T a, T b) {
  return (a + b - 1) / b;
}

// 桁和
template<typename T>
T digsum(T n) {
    T res = 0;
    while(n > 0) {
        res += n%10;
        n /= 10;
    }
    return res;
}

// 回文判定
bool kai (string s) {
    string t{s};
    reverse(begin(t), end(t));
    return s == t;
}

using pint = pair<int, int>;
using pll = pair<ll, ll>;

vector<pair<long long, long long> > prime_factorize(long long n) { //素因数分解、pairのfirstに底、secondに底の何乗
    vector<pair<long long, long long> > res;
    for (long long p = 2; p * p <= n; ++p) {
        if (n % p != 0) continue;
        int num = 0;
        while (n % p == 0) { ++num; n /= p; }
        res.push_back(make_pair(p, num));
    }
    if (n != 1) res.push_back(make_pair(n, 1));
    return res;
}

int main(void)
{
    cout.tie(0);
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    ll n;
    cin >> n;
    ll ans = 0;
    vector<pll> p = prime_factorize(n);
    rep(i, sz(p)){
        ll tmp = p[i].sc;
        ll j = 1;
        ll j2 = 2;
        ll count = 1;
        while(true){
            j += j2;
            j2++;
            if(j > tmp) break;
            count++;
        }
        ans += count;

    }
    print(ans);


}



Measured memory_bytes: 3656
#include<bits/stdc++.h>
using namespace std;
int main(){
char b; cin>>b;
  if(b=='A') cout<<"T\n";
  else if(b=='T') cout<<"A\n";
  else if(b=='G') cout<<"C\n";
  else if(b=='C') cout<<"G\n";
 return 0;
          }


Measured memory_bytes: 256
class Integer

  # O(min(n-k,k) log m)
  # combination: nPk / k! (mod p), note: m must be a prime number
  def cmb(k, m=10**9+7)
    n = self
    k = n - k if k > n - k
    n.prm(k, m) * k.prm(k,m).modinv(m) % m
  end

  # mod must be a prime number
  # O(log m)
  def modinv(mod = 10**9+7)
    pow(mod-2, mod)
  end

  # O(log n)
  def pow(n , mod = nil )
    a = self.to_i
    res = 1
    while n > 0
      if (n & 1) != 0
        res *= a
        res %= mod if mod
      end
      a *= a
      a %= mod if mod
      n >>= 1
    end
    res
  end
end


class Facts

  def initialize(mod=10**9+7, n_max=1)
    @mod = mod
    @n_max = n_max
    @fact = [1, 1]
    @inv = [0,1]
    @factinv = [1, 1]
    @perms = Hash.new{|h,k| h[k] = [1] }
    setup_table(n_max) if 1 < @n_max
  end

  def cmb(n,r)
    return 0 if r < 0 || n < r
    r = n - r if r > n - r
    setup_table(r) if @n_max < r
    return prm(n,r) * @factinv[r] % @mod
    # @fact[n] * (@factinv[r] * @factinv[n-r] % @mod) % @mod
  end

  def factorial(n)
    setup_table(n) if @n_max < n
    @fact[n]
  end

  def prm(n,k)
    
    if @perms[n][k].nil?
      perm = @perms[n]
      (n-perm.size+1).downto(n-k){|i| perm.push( perm[-1] * i % @mod )  }
    end
    return @perms[n][k]
    
    setup_table(n) if @n_max < n
    @fact[n] * @factinv[n-k] % @mod
  end

  private
    # O(t)
    def setup_table(t)
      (@n_max+1).upto(t) do |i|
        @fact.push( @fact[-1] * i % @mod )
        @inv.push( -@inv[@mod % i] * (@mod / i) % @mod )
        @factinv.push( @factinv[-1] * @inv[-1] % @mod )
      end
      @n_max = t
    end
end

mod = 10 ** 9 + 7

n,a,b = gets.split.map(&:to_i)

#何も選ばない1通りを除く
f = Facts.new
# ans = 2.pow(n, mod) - 1
# p f.cmb(n,a)
ans = 2.pow(n, mod) - 1 - f.cmb(n,a) - f.cmb(n,b)
ans %= mod
 
puts ans

# p nil.to_i
# p h = Hash.new{|h,k| h[k] = [1] }
# p h[1][4]
# p h[4]

Measured memory_bytes: 8124
#include <iostream>
#include <bits/stdc++.h>
#include <string>
#include <algorithm>
#include <vector>

using namespace std;

int main() {
    int n, a, b;
    cin >> n >> a >> b;

    int res = 0;
    for (int i = 1; i <= n; ++i){
        int tmp = i % 10 +
                 (i % 100 / 10) + 
                 (i % 1000 / 100) + 
                 (i % 10000 / 1000) +
                 i / 10000;
        if (a <= tmp && tmp <= b) {
            res += i;
        }
    }

    cout << res << endl;
}


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

typedef long long int Int;

void faster()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}

int main()
{
    faster();
    
    Int n;
    cin>>n;
    Int i,j;
    Int a[n][3];
    for(i=0; i<n; i++) cin>>a[i][0]>>a[i][1]>>a[i][2];
    
    Int c[n][3];
    
    c[0][0] = a[0][0];
    c[0][1] = a[0][1];
    c[0][2] = a[0][2];
    
    for(i=1; i<n; i++)
    {
        for(j=0; j<3; j++)
        {
            c[i][j] = a[i][j] + max( c[i-1][(j+1)%3] , c[i-1][(j+2)%3] );
        }
    }
    Int ans = max( c[n-1][0] , c[n-1][1]  );
    ans = max( ans , c[n-1][2] );
    cout<<ans<<'\n';
    
    
    
    
    return 0;
}

Measured memory_bytes: 4992
N, K = map(int, input().split())
logs = list(map(int, input().split()))
maxL = max(logs)

minz = 0
maxz = maxL+1
while minz < maxz-1:
    midz = (maxz + minz)//2
    ncut = 0
    for i in range(N):
        thiscut = int((logs[i] + midz - 1) / midz) - 1
        ncut += thiscut

    if ncut > K:
        minz = midz
    else:
        maxz = midz

print(maxz)

Measured memory_bytes: 104412
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1e9+7;
int main() {
    string s;
    cin >> s;
    ll w;
    cin >> w;
    string ans="";
    for(ll i=0;i<s.size();i+=w){
        ans.push_back(s[i]);
    }
    cout << ans << endl;
}

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

using namespace std;

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

	vector<int> inputs;
	for (int i = 0; i < num; ++i)
	{
		int input;
		cin >> input;
		inputs.push_back(input);
	}

	int max = 0;
	for (const int n : inputs)
	{
		if (max < n) max = n;
	}

	int sum = 0;
	bool coupon = false;
	for (const int n : inputs)
	{
		if (n == max && !coupon)
		{
			sum += n / 2;
			coupon = true;
		}
		else
		{
			sum += n;
		}
	}

	cout << sum << endl;
}

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


#define li          long long int
#define rep(i,to)   for(li i=0;i<((li)(to));i++)
#define repp(i,start,to)    for(li i=(li)(start);i<((li)(to));i++)
#define pb          push_back
#define sz(v)       ((li)(v).size())
#define bgn(v)      ((v).begin())
#define eend(v)     ((v).end())
#define allof(v)    (v).begin(), (v).end()
#define dodp(v,n)       memset(v,(li)n,sizeof(v))
#define bit(n)      (1ll<<(li)(n))
#define mp(a,b)     make_pair(a,b)
#define rin rep(i,n)
#define EPS 1e-12
#define ETOL 1e-8
#define MOD 1777777777ll
typedef pair<li, li> PI;

#define INF bit(60)

#define DBGP 1


#define idp if(DBGP)
#define F first
#define S second
#define p2(a,b)     idp cout<<a<<"\t"<<b<<endl
#define p3(a,b,c)       idp cout<<a<<"\t"<<b<<"\t"<<c<<endl
#define p4(a,b,c,d)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<endl
#define p5(a,b,c,d,e)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<endl
#define p6(a,b,c,d,e,f)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<endl
#define p7(a,b,c,d,e,f,g)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<endl
#define p8(a,b,c,d,e,f,g,h)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<endl
#define p9(a,b,c,d,e,f,g,h,i)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<endl
#define p10(a,b,c,d,e,f,g,h,i,j)        idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<"\t"<<j<<endl
#define foreach(it,v)   for(__typeof((v).begin()) it=(v).begin(); it!=(v).end(); ++it)
#define p2p(x)      idp p2((x).F, (x).S)
#define dump(x,n)   idp{rep(i,n){cout<<x[i]<<" ";}puts("");}
#define dump2(x,n)  idp{rep(i,n){cout<<"["<<x[i].F<<" , "<<x[i].S<<"] ";}puts("");}
#define dumpi(x)    idp{foreach(it, x){cout<<(*it)<<" ";}puts("");}
#define dumpi2(x)   idp{foreach(it, x){cout<<"["<<(it)->F<<" , "<<(it)->S<<"] ";}puts("");}

#define read(a,n) rep(i,n)cin>>a[i]

#define read2d(a,w,h)   rep(i,h)rep(j,w)cin>>a[i][j]
#define dump2d(a,w,h)   rep(i,h){rep(j,w)cout<<a[i][j]<<" ";puts("");}

typedef pair<li, li> PI;

bool isp[200200];


int main() {
    rep(i, 200200) {
        isp[i] = true;
    }
    isp[0] = false;
    isp[1] = false;
    repp(i, 2, 200200) {
        if (!isp[i]) {
            continue;
        }
        for (li j = i * 2; j < 200200; j += i) {
            isp[j] = false;
        }
    }

    li x;
    cin >> x;
    repp(i, x, 200200) {
        if (isp[i]) {
            cout << i << endl;
            return 0;
        }
    }
    puts("NO");

    return 0;
}


Measured memory_bytes: 384