akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
using namespace std;
#include <algorithm>

int main() {
	int r, g, b;
	cin >> r >> g >> b;
	
	//下二桁が4で割り切れたたら4の倍数
	
	int u2d = g*10 + b;
	
	if(u2d%4 == 0 ) cout << "YES";
	else cout << "NO";
	
	cout << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cassert>
#include <functional>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
using namespace std;
using llong = long long;

const llong mod = (llong)1e9 + 7;
llong n;
vector<vector<llong> > tree;
llong dp[2][100005];

llong dfs(int c, int u, int par) {
    if (dp[c][u] != -1) return dp[c][u];

    llong sum = 1;
    if (c == 0) {
        for (auto v:tree[u]) {
            if (v == par) continue;
            sum *= (dfs(0, v, u) + dfs(1, v, u)) % mod;
            sum %= mod;
        }
    }
    else {
        for (auto v:tree[u]) {
            if (v == par) continue;
            sum *= dfs(0, v, u);
            sum %= mod;
        }
    }

    return dp[c][u] = sum;
}

int main() {
    for (int i = 0; i < 100005; i++) dp[0][i] = dp[1][i] = -1;
    
    cin >> n;
    tree.resize(n + 1);
    for (int i = 0; i < n - 1; i++) {
        llong a, b;
        cin >> a >> b;
        tree[a].push_back(b);
        tree[b].push_back(a);
    }

    dfs(0, 1, -1);
    dfs(1, 1, -1);

    cout << (dp[0][1] + dp[1][1]) % mod << endl;

    return 0;
}


Measured memory_bytes: 15616
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstring>
#include <sstream>
#include <cassert>
using namespace std;
static const double EPS = 1e-5;
typedef long long ll;
typedef pair<int,int> PI;
typedef vector<int> vi;
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define mp make_pair
#define pb push_back
#define f first
#define s second

int cost[100][100];
int n;
void wf(){
  rep(k,n)rep(i,n)rep(j,n)cost[i][j]=min(cost[i][j],cost[i][k]+cost[k][j]);
}

main(){
  cin>>n;
  rep(i,n)rep(j,n)cost[i][j]=2<<24;

  rep(i,n){
    int r;
    cin>>r;--r;
    int k;
    cin>>k;
    rep(j,k){
      int t;
      cin>>t;t--;
      cost[r][t]=1;
    }
  }
  wf();
  int p;
  cin>>p;
  rep(i,p){
    int s,d,v;
    cin>>s>>d>>v;--s,--d;
    int c=cost[s][d];
    if(c<v)cout<<c+1<<endl;
    else cout<<"NA"<<endl;
  }
}

Measured memory_bytes: 0
#include <stdio.h>
#include <iostream>

using namespace std;

int main() {
	int a,b;
	int zellar;

	while (cin >> a >> b) {
		if (a == 0) {
			break;
		}

		if (a < 3) {
			a = a + 12;
			zellar = (2003 + (2003 / 4) + (2003 / 400) - (2003 / 100) + (((13 * a) + 8) / 5) + b) % 7;
		} else {
			zellar = (2004 + (2004 / 4) + (2004 / 400) - (2004 / 100) + (((13 * a) + 8) / 5) + b) % 7;
		}
		switch(zellar) {
		case 0: 
			cout << "Sunday" << endl;
			break;
		case 1: 
			cout << "Monday" << endl;
			break;
		case 2:
			cout << "Tuesday" << endl;
			break;
		case 3:
			cout << "Wednesday" << endl;
			break;
		case 4:
			cout << "Thursday" << endl;
			break;
		case 5:
			cout << "Friday" << endl;
			break;
		case 6:
			cout << "Saturday" << endl;
			break;
		}

	}

	return 0;
}

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

int main() {
    int64_t N;
    std::cin >> N;

    std::unordered_map<int64_t, int64_t> m;
    int64_t sum = 0;
    int64_t A;
    for (int i = 0; i < N; ++i) {
        std::cin >> A;
        sum += A;
        m[A] += 1;
    }

    int64_t Q;
    std::cin >> Q;

    int64_t B, C;
    for (int i = 0; i < Q; ++i) {
        std::cin >> B >> C;

        if (m.count(B) == 0 || m[B] == 0) {
            std::cout << sum << std::endl;
        } else {
            sum += (C - B) * m[B];

            m[C] += m[B];
            m[B] = 0;

            std::cout << sum << std::endl; 
        }
    }

    return 0;
}


Measured memory_bytes: 6604
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl; 
#define INF 1000000000
#define mod 1000000007
typedef long long ll;
const ll LINF = 1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
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; }

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    
    int k,t;cin>>k>>t;
    int a[t];
    rep(i,t) cin>>a[i];
    int m=-1;
    rep(i,t){
        m=max(m,a[i]);
    }
    //奇数
    if(k%2){
        int x=(k+1)/2;
        m-=x;
        if(m>0)cout<<(2*m)<<endl;
        else cout<<0<<endl;
    }
    //偶数
    else{
        int x=k/2;
        m-=x;
        if(m>0)cout<<(2*m-1)<<endl;
        else cout<<0<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
def snuke(n) :
    s=sum(map(int,str(n)))
    return n/s

k=int(input())
digit=0
ans=1
for _ in range(k):
    print(ans)
    if snuke(ans+10**digit)>snuke(ans+10**(digit+1)):
        digit+=1
    ans+=10**digit

Measured memory_bytes: 3188
import java.util.*;
class Main{
  public static void main(String[] args){
    Scanner stdIn=new Scanner(System.in);
    int A = stdIn.nextInt();
    int B = stdIn.nextInt();
    int w =A+B;
    if(A%3==0||B%3==0||w%3==0){
      System.out.println("Possible");
    }else{
      System.out.println("Impossible");
    }
  }
}

Measured memory_bytes: 21588
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N;cin>>N;
  vector<pair<int,int>>A(N);
  for(int i=0;i<N;i++){
    cin>>A.at(i).first;
    A.at(i).second=i+1;
  }
  sort(A.begin(),A.end());
  for(int i=0;i<N;i++){
    cout<<A.at(i).second;
    if(i<N-1)cout<<" ";
  }
  cout<<endl;
}

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

s=[0]*n
left=[]
right=[]
for i in range(m):
    l,r=map(int,input().split())
    left.append(l)
    right.append(r)
    
if min(right)<max(left):
    print(0)
else:
    print(min(right)-max(left)+1)

Measured memory_bytes: 11788
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
using namespace std;
typedef long long ll;
int INF = (1LL << 30) - 1;
int MOD = 1e9+7;
main(){
    char c;
    cin >> c;
    if(c == 'A')cout << 'T' << endl;
    if(c == 'T')cout << 'A' << endl;
    if(c == 'C')cout << 'G' << endl;
    if(c == 'G')cout << 'C' << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <iterator>
//#include <cmath>
#include <set>
#include <deque> 
#include <string>


using namespace std;

const long long MOD = 1000000000 + 7;

long long n, k;


int main()
{
	scanf("%lld%lld", &n, &k);
	long long total = 0;
	for (long long i = k ; i <= n + 1 ; i++) {
		long long cc = i;
		long long minNum = (0 + cc - 1) * cc / 2;
		long long maxNum = (n + (n - cc + 1)) * cc / 2;
		
		long long dist = maxNum - minNum + 1;
		total = (total + dist) % MOD;
		
	}
	printf("%lld\n", total);
	
	return 0;
}

Measured memory_bytes: 1704
var GET=(function(){function f(s){return new g(s);}function g(s){this._s=s.trim().split("\n");this._y=0;}g.prototype.a=function(f){var s=this._s, y=this._y, r;if(typeof s[y]==="string")s[y]=s[y].split(" ").reverse();r=s[y].pop();if(!s[y].length)this._y++;return f?r:+r;};g.prototype.l=function(f){var s=this._s[this._y++].split(" ");return f?s:s.map(a=>+a);};g.prototype.m=function(n,f){var r=this._s.slice(this._y,this._y+=n).map(a=>a.split(" "));return f?r:r.map(a=>a.map(a=>+a));};g.prototype.r=function(n,f){var r=this._s.slice(this._y,this._y+=n);return f?r:r.map(a=>+a);};return f;})();
var o=GET(require("fs").readFileSync("/dev/stdin","utf8"));

console.log(main());
function main(){
  var s = o.a(1);
  var t = o.a(1);
  var sl = s.length;
  var tl = t.length;
  var dp = Array(sl+1).fill(0).map(a=>Array(tl+1).fill(0));
  for(var i = 0; i < sl; i++){
    for(var j = 0; j < tl; j++){
      if(s[i] === t[j])dp[i+1][j+1] = dp[i][j] + 1;
      else if(dp[i+1][j] > dp[i][j+1])dp[i+1][j+1] = dp[i+1][j];
      else dp[i+1][j+1] = dp[i][j+1];
    }
  }
  var ans = "";
  while(dp[sl][tl]){
    if(dp[sl][tl] === dp[sl][tl-1])tl--;
    else if(dp[sl][tl] === dp[sl-1][tl])sl--;
    else ans = s[--sl] + ans, tl--;
  }
  return ans;
}

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

int main() {
	double A, B;
	cin >> A >> B;
	int min_A, max_A, min_B, max_B;
	min_A = ceil(A / 0.08);
	max_A = (A + 1) / 0.08;
	min_B = ceil(B / 0.1);
	max_B = (B + 1) / 0.1;
	if (min_A < min_B) {
		if (min_B < max_A) {
			cout << min_B << endl;
		} else {
			cout << -1 << endl;
		}
	} else if (min_B < min_A) {
		if (min_A < max_B) {
			cout << min_A << endl;
		} else {
			cout << -1 << endl;
		}
	} else {
		cout << min_A << endl;
	}
}

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

using lli = long long int;

using namespace std;

constexpr int A = 0;
constexpr int B = 1;
constexpr int C = 2;

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

    std::vector<std::vector<lli>> dp(N, std::vector<lli>(3));

    std::vector<lli> a(N), b(N), c(N);
    for (lli i = 0; i < N; ++i) {
        cin >> a[i] >> b[i] >> c[i];
        dp[i][A] = dp[i][B] = dp[i][C] = 0;
    }

    dp[0][A] = a[0];
    dp[0][B] = b[0];
    dp[0][C] = c[0];

    for (lli i = 1; i < N; i++) {
        dp[i][A] = std::max(dp[i - 1][B] + a[i], dp[i - 1][C] + a[i]);
        dp[i][B] = std::max(dp[i - 1][C] + b[i], dp[i - 1][A] + b[i]);
        dp[i][C] = std::max(dp[i - 1][A] + c[i], dp[i - 1][B] + c[i]);
    }

    cout << std::max(dp[N - 1][A], std::max(dp[N - 1][B], dp[N - 1][C])) << endl;

    return 0;
}


Measured memory_bytes: 8064
import math
N=int(input())
A=list(map(int,input().split()))
B=sorted(A)
C=[]
D=[]
E=[]
F=[]
C.append(1)
D.append(B[0])
for i in range(1,N):
    if B[i]==B[i-1]:
        C[-1]+=1
    else:
        C.append(1)
        D.append(B[i])
for i in range(len(C)):
    if C[i]==1:
        E.append(0)
        F.append(0)
    else:
        if C[i]==2:
            E.append(1)
            F.append(0)
        else:
            E.append(int(math.factorial(C[i])/(math.factorial(2)*math.factorial(C[i]-2))))
            F.append(int(math.factorial(C[i]-1)/(math.factorial(2)*math.factorial(C[i]-3))))
e=sum(E)
import bisect
for i in range(N):
    s=bisect.bisect_left(D,A[i])
    print(e-E[s]+F[s])







Measured memory_bytes: 119636
a,b,x = STDIN.gets.strip.split.map(&:to_i)

if a*a*b/2 >= x
  tan = (a*b*b).to_f / (2.0 * x.to_f)
else
  tan = 2*b.to_f/a.to_f - 2*x.to_f/(a.to_f**3)
end

puts Math.atan(tan) / Math::PI * 180


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

int main()
{
	char ch[10],win;
	while (cin>>ch[1])
	{
		for (int i = 2; i < 10; i++)
		{
			cin >> ch[i];
		}

		win = 'd';
		
		for (int i = 1; i < 8; i+=3)	//横の判定
		{
			if ((ch[i] == ch[i + 1]) && (ch[i + 1] == ch[i + 2]) && (ch[i]!='s'))
			{
				win = ch[i];
				break;
			}
		}
		
		for (int i = 1; i < 4; i++)		//縦の判定
		{
			if ((ch[i] == ch[i+3]) && (ch[i+3] == ch[i+6]) && (ch[i]!='s'))
			{
				win = ch[i];
				break;
			}
		}

		if ((ch[1]==ch[5]) && (ch[5]==ch[9]) && (ch[1]!='s'))	//斜めの判定
		{
			win = ch[1];
		}
		if ((ch[3]==ch[5]) && (ch[5]==ch[7]) && (ch[3]!='s'))
		{
			win = ch[3];
		}

		cout << win << endl;
	}
	return 0;
}

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

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


int main(){
    ll N;
    cin >> N;
    
    string ans = "";
    while(N){
        N--;
        char c = 'a' + N%26;
        ans.push_back(c);
        N /= 26;
    }
    reverse(ans.begin(), ans.end());
    cout << ans;
    return 0;
}

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

//#define int long long
#define fi first
#define se second
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rep1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define rep11(i, n) for (int i = 1; i < (int)(n); ++i)
#define repo(i, o, n) for (int i = o; i < (int)(n); ++i)
#define repm(i, n) for (int i = (int)(n)-1; i >= 0; --i)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define pb(n) push_back(n)
#define mp make_pair
#define MOD 1002000007
#define INF LONG_LONG_MAX

int main(){
    int A,P;
    cin>>A>>P;
    cout << (A*3+P)/2 <<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FIND(c, e) ((c).find(e) != (c).end())
#define NFIND(c, e) ((c).find(e) == (c).end())
#define ALL(t) (t).begin(), (t).end()
#define ALLR(t) (t).rbegin(), (t).rend()
#define MP make_pair
template<class T> T max(T a,T b,T c){return max(max(a,b),c);}
template<class T> T min(T a,T b,T c){return min(min(a,b),c);}
const int N = int( 1e5 ) + 69 /** :3 **/;

void __answer()
{
    short ans = 0;
    long long x, y;
    cin >> x >> y;
    while(x <= y) {
        ans++;
        x = x * 2LL;
    }
    cout << ans;
}

int main()
{
    ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    cout << setprecision(11) << fixed;
    #ifdef LOCAL
        freopen("TEST.txt", "r", stdin);
    #endif
    __answer();
    return 0;
}


Measured memory_bytes: 256
import sys
import copy

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

in_n = lambda: int(readline())
in_nn = lambda: map(int, readline().split())
in_s = lambda: readline().rstrip().decode('utf-8')
in_nl = lambda: list(map(int, readline().split()))
in_nl2 = lambda H: [in_nl() for _ in range(H)]
in_map = lambda: [s == ord('.') for s in readline() if s != ord('\n')]
in_map2 = lambda H: [in_map() for _ in range(H)]
in_all = lambda: map(int, read().split())


def main():

    N = in_n()
    A = in_nl()

    def solve():

        ta = copy.copy(A)
        cnt1 = 0

        if ta[0] <= 0:
            t = -ta[0] + 1
            cnt1 += t
            ta[0] += t

        sum_a = ta[0]
        for i in range(1, N):
            if i % 2 == 0:
                if sum_a + ta[i] <= 0:
                    t = -(sum_a + ta[i]) + 1
                    cnt1 += t
                    ta[i] += t
            else:
                if sum_a + ta[i] >= 0:
                    t = sum_a + ta[i] + 1
                    cnt1 += t
                    ta[i] -= t
            sum_a += ta[i]

        #####

        ta = copy.copy(A)
        cnt2 = 0

        if ta[0] >= 0:
            t = ta[0] + 1
            cnt2 += t
            ta[0] -= t

        sum_a = ta[0]
        for i in range(1, N):
            if i % 2 == 1:
                if sum_a + ta[i] <= 0:
                    t = -(sum_a + ta[i]) + 1
                    cnt2 += t
                    ta[i] += t
            else:
                if sum_a + ta[i] >= 0:
                    t = sum_a + ta[i] + 1
                    cnt2 += t
                    ta[i] -= t
            sum_a += ta[i]

        return min(cnt1, cnt2)

    ans = solve()
    print(ans)


if __name__ == '__main__':
    main()


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

#define int long long
#define itn int
#define For(i, a, b) for (int i = (a); i <= static_cast<int>(b); i++)
#define Forr(i, a, b) for (int i = (a); i >= static_cast<int>(b); i--)
#define rep(i, n) For(i, 0, n - 1)
#define repall(i, arr) for (auto& i : (arr))
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define dump(x) cerr << #x << " = " << (x) << '\n'
#define dump2(x, y) \
    cerr << #x << " = " << (x) << " " << #y << " = " << (y) << '\n'
#define SZ(x) ((int)(x).size())
#define bit(n) (1LL << (n))
constexpr int MOD = 1e9 + 7;

template <typename T>
using pq = priority_queue<T>;
template <typename T>
using pqr = priority_queue<T, vector<T>, greater<T>>;
const int INF = LLONG_MAX / 2;
using P = pair<int, int>;
using vec = vector<int>;
template <typename T>
using mat = vector<vector<T>>;

// clang-format off
template <typename T1, typename T2>
ostream& operator<<(ostream& stream, const pair<T1, T2>& p) { return stream << p.first << "," << p.second; }
template <typename T>
void print(const vector<T> vec) { rep (i, vec.size() - 1) cout << vec[i] << ' '; cout << vec[vec.size() - 1] << '\n'; }
template <typename Arg>
void print(const Arg arg) { cout << arg << '\n'; }
template <typename Head, typename... Args>
void print(const Head head, const Args... args) { cout << head << " "; print(args...); }
template <typename T, typename U>
void init(vector<T>& v, vector<U>& w) { rep (i, v.size()) cin >> v[i] >> w[i]; }
template <typename T>
void init(vector<T>& v) { rep (i, v.size()) cin >> v[i]; }
template <typename T>
T sum_(vector<T> vec, T init = 0) { return std::accumulate(all(vec), T(init)); }
template<typename T>
bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } return false; }
template<typename T>
bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; } return false; }
template <typename T>
int index(const T& vec, const typename T::iterator it) { return distance(vec.begin(), it); }
template <typename T = int>
mat<T> mmat(int n, int m=0) { return mat<T>(n, vector<T>(m)); }
template <typename T = int>
vector<T> ivec(int n) { vector<T> v(n); init(v); return v; }
// clang-format on

void yn(bool tf) { print(tf ? "Yes" : "No"); }
void YN(bool tf) { print(tf ? "YES" : "NO"); }

int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
// -------------------------------------------------------------------
// sort 1 2 3 4
// pqr 1 2 3 must impl >

signed main() {
    cin.tie(0), cout.tie(0), ios::sync_with_stdio(false);
    int n, l;
    cin >> n >> l;

    vec apple;
    rep (i, n)
        apple.pb(l + i);
    int sum = sum_(apple);
    if (apple[0] * apple[n - 1] <= 0)
        print(sum);
    else {
        if (apple[0] > 0)
            print(sum - apple[0]);
        else
            print(sum - apple[n - 1]);
    }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<n;i++)
#define inf 1e9+7
using namespace std;
typedef long long ll;
const double pi=acos(-1);

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

int main(){
    int d,t,s;
    cin >> d >> t >> s;
    if(s*t>=d) cout << "Yes" << endl;
    else cout << "No" << endl;
}

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

int main()
{
    int n;
    cin>>n;
    vector<int> v(n+1,0);
    for(int i=1;i<sqrt(n);i++)
        for(int j=1;j<sqrt(n);j++)
            for(int k=1;k<sqrt(n);k++)
                if(i*i+j*j+k*k+i*j+j*k+i*k<=n)
                    v[i*i+j*j+k*k+i*j+j*k+i*k]++;
    for(int i=1;i<=n;i++)
        cout<<v[i]<<endl;
}


Measured memory_bytes: 3556
import java.util.Scanner;
public class Main {
    public static void main(String[] args){
    
    Scanner sc = new Scanner(System.in);
    String S = sc.next();
    char[]ss = S.toCharArray();
    
    int a=0, b=0, c=0, d=0, e=0, f=0, g=0, h=0, i=0, j=0, k=0, l=0, m=0, o=0, p=0, q=0, r=0, s=0, t=0, u=0, v=0, w=0, x=0, y=0, z=0;
    for(int I=0; I<S.length(); I++) {
    	if(ss[I] == 'a') {
    		a++;
    	}else if(ss[I] == 'b') {
    		b++;
    	}else if(ss[I] == 'c') {
    		c++;
    	}else if(ss[I] == 'd') {
    		d++;
    	}else if(ss[I] == 'e') {
    		e++;    	
    	}else if(ss[I] == 'f') {
    		f++;   	
    	}else if(ss[I] == 'g') {
    		g++;   	
    	}else if(ss[I] == 'h') {
    		h++;   	
    	}else if(ss[I] == 'i') {
    		i++;
    	}else if(ss[I] == 'j') {
    		j++;
    	}else if(ss[I] == 'k') {
    		k++;   	
    	}else if(ss[I] == 'l') {
    		l++;
    	}else if(ss[I] == 'm') {
    		m++;    	
    	}else if(ss[I] == 'o') {
    		o++;
    	}else if(ss[I] == 'p') {
    		p++;
    	}else if(ss[I] == 'q') {
    		q++;   		
    	}else if(ss[I] == 'r') {
    		r++;
    	}else if(ss[I] == 's') {
    		s++;    		
    	}else if(ss[I] == 't') {
    		t++;    		
    	}else if(ss[I] == 'u') {
    		u++;    		
    	}else if(ss[I] == 'v') {
    		v++;    		
    	}else if(ss[I] == 'w') {
    		w++;    		
    	}else if(ss[I] == 'x') {
    		x++;
    	}else if(ss[I] == 'y') {
    		y++;    	
    	}else if(ss[I] == 'z') {
    		z++;   	
    	}
    }
    	if(a%2==0 && b%2==0 && c%2==0 && d%2==0 && e%2==0 && f%2==0 && g%2==0 && h%2==0 && i%2==0 && j%2==0 && k%2==0 && l%2==0 && m%2==0 && o%2==0 && p%2==0 && q%2==0 && r%2==0 && s%2==0 && t%2==0 && u%2==0 && v%2==0 && w%2==0 && x%2==0 && y%2==0 && z%2==0) {
    		System.out.println("Yes");
    	}else {
    	System.out.println("No");
    }
}
    }



Measured memory_bytes: 35596
#include <iostream>
#include <iomanip> //! for setprecision(10)
#include <math.h>
#include <algorithm>
#include <functional> 
#include <string>
#include <vector>

#include <cstring>
#include <set>
#include <map>
#include <queue>
#include <utility>

using namespace std;

typedef long long LL;

#define dump(c) { for (auto it = c.begin(); it != c.end(); ++it) if (it == c.begin()) cout << *it; else cout << ' ' << *it; cout << endl; } 
#define rep(i,n) for (int i = 0; i < (n); ++i)

const int MOD = 1000000007;

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

    double L;
    cin >> L;

    L /= 3.0;

    double ans = L * L * L;
    cout << setprecision(10) << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int s;
int a;
string into(int n,int radix)    //n是待转数字，radix是指定的进制
{
	string ans="";
	do{
		int t=n%radix;
		if(t>=0&&t<=9)	ans+=t+'0';
		else ans+=t-10+'a';
		n/=radix;
	}while(n!=0);	//使用do{}while（）以防止输入为0的情况
	reverse(ans.begin(),ans.end());
	return ans;	
}
int main()
  {
    cin>>s>>a;
    string w=into(s,a);
    cout<<w.length()<<endl;
    return 0;
  }

Measured memory_bytes: 256
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <list>

using namespace std;

typedef long long ll;

#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define ctos(d) string(1,d)
#define print(x) cout<<#x<<" = "<<x<<endl;

#define MOD 1000000007

int main() {
  ll h, w;
  cin >> h >> w;
  vector<string> vs;
  rep(i, 0, h) {
    string s;
    cin >> s;
    vs.pb(s);
  }
  ll d[300][300];
  clr(d, 0);
  rep(y, 0, h) {
    rep(x, 0, w) {
      if (vs[y][x] == 'o') {
        d[y + 100][x + 100] = 1;
      }
      if (vs[y][x] == 'x') {
        d[y + 100][x + 100] = 2;
      }
    }
  }
  ll c = 0;
  rep(y,101,100+h){
    rep(x,100,100+w){
      if(d[y][x]!=0)continue;
      if(d[y][x-1]==1||d[y][x+1]==1)continue;
      if(d[y][x-1]==2||d[y][x+1]==2)continue;
      if(d[y-1][x]==2||d[y+1][x]==2)continue;
      if(d[y-1][x-1]==2||d[y-1][x+1]==2)continue;
      if(d[y+1][x-1]==2||d[y+1][x+1]==2)continue;
      c++;
    }
  }
  cout << c << endl;
  return 0;
}

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

using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;
using LL = long long;
using VL = vector<LL>;
using VVL = vector<VL>;
using PLL = pair<LL, LL>;
using VS = vector<string>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))

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

#define FF first
#define SS second
template<class S, class T>
istream& operator>>(istream& is, pair<S,T>& p){
  return is >> p.FF >> p.SS;
}
template<class S, class T>
ostream& operator<<(ostream& os, const pair<S,T>& p){
  return os << p.FF << " " << p.SS;
}
template<class T>
void maxi(T& x, T y){
  if(x < y) x = y;
}
template<class T>
void mini(T& x, T y){
  if(x > y) x = y;
}


const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD = 1e9+7;

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

  int N, M;
  cin >> N >> M;
  VVI G(N+1);
  REP(i,M){
	int a, b;
	cin >> a >> b;
	G[a].PB(b);
	G[b].PB(a);
  }
  FOR(i,1,N+1)
	cout << SZ(G[i]) << endl;

  return 0;
}


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

int main() {
  //入力M
  int R;	//現在のレーティング
  int G;	//目標のレーティング
  int x;	//目標のレーティングになるために必要なレーティング
  
  cin >> R;
  cin >> G; 
  //( R + x ) / 2 = G
  //2 * G = R + x
  //x = 2 * G -R
  x = 2 * G -R; 
  
  cout << x << endl; 
}

Measured memory_bytes: 256
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::{Bytes, Chars};
#[allow(unused_imports)]
use std::cmp::{min, max};

fn main() {
	input! {
		a: usize,
		b: usize,
		c: usize,
		d: usize,
	}

	if b <= c {
		println!("0");
		return;
	}
	if d <= a {
		println!("0");
		return;
	}

	if a <= c {
		if b <= d {
			println!("{}", b-c);
			return;				
		}
		else {
			println!("{}", d-c);
			return;				
		}
	}
	else {
		if d <= b {
			println!("{}", d-a);
			return;				
		}
		else {
			println!("{}", b-a);
			return;				
		}
	}
}



Measured memory_bytes: 2068
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int n2 = sc.nextInt();
		int d = sc.nextInt();
		System.out.println(n2 / d - (n - 1) / d);

	}
}




Measured memory_bytes: 35708
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int w = sc.nextInt();
        int h = sc.nextInt();
        int n = sc.nextInt();
        boolean[][] area = new boolean[h][w];

        for (int i = 0; i < n; i++) {
            int x = sc.nextInt();
            int y = sc.nextInt();
            int a = sc.nextInt();

            switch (a) {
                case 1:
                    for (int y1 = 0; y1 < h; y1++) {
                        for (int x1 = 0; x1 < x; x1++) {
                            area[y1][x1] = true;
                        }
                    }
                    break;

                case 2:
                    for (int y1 = 0; y1 < h; y1++) {
                        for (int x1 = x; x1 < w; x1++) {
                            area[y1][x1] = true;
                        }
                    }
                    break;

                case 3:
                    for (int y1 = 0; y1 < y; y1++) {
                        for (int x1 = 0; x1 < w; x1++) {
                            area[y1][x1] = true;
                        }
                    }
                    break;

                case 4:
                    for (int y1 = y; y1 < h; y1++) {
                        for (int x1 = 0; x1 < w; x1++) {
                            area[y1][x1] = true;
                        }
                    }
                    break;
            }
        }

        int ans = 0;
        for (boolean[] isArray : area) {
            for (boolean isCell : isArray) {
                if (!(isCell))
                    ans++;
            }
        }

        System.out.println(ans);
    }
}


Measured memory_bytes: 23708
# -*- coding: utf-8 -*-
import heapq

N, M, X = map(int, input().split())
C = list()
A = [[] for _ in range(N)]
for i in range(N):
  arg = list(map(int, input().split()))
  C.append(arg[0])
  A[i] = arg[1:]
h = []
# 参考書を選択するパターンは2のN乗通り
for i in range(2**N):
  cost = 0
  rikaido = [0] * (M)
  sankosyo = list()
  for j in range(N):
    if (i >> j) & 1:
      # 参考書jを選択
      sankosyo.append(j)
      cost += C[j]
  for k in sankosyo:
    for l in range(M):
      rikaido[l] += A[k][l]
  if min(rikaido) >=  X:
    heapq.heappush(h, cost)
if len(h) > 0:
  print(h[0])
else:
  print(-1)

Measured memory_bytes: 73876
class SegTree():
    def __init__(self, lists, function, basement):
        self.n = len(lists)
        self.K = (self.n-1).bit_length()
        self.f = function
        self.b = basement
        self.seg = [basement]*2**(self.K+1)
        X = 2**self.K
        for i, v in enumerate(lists):
            self.seg[i+X-1] = v

        for i in range(2*X-2, 0, -2):
            self.seg[(i-1) >> 1] = self.f(self.seg[i], self.seg[i-1])

    def update(self, k, value):
        X = 2**self.K
        k += X-1
        self.seg[k] = value
        while k:
            k = (k-1) >> 1
            self.seg[k] = self.f(self.seg[(k << 1)+1], self.seg[(k << 1)+2])

    def query(self, L, R):
        num = 2**self.K-1
        L += num
        R += num
        vL = self.b
        vR = self.b
        while L < R:
            if L & 1 == 0:
                vL = self.f(vL, self.seg[L])
                L += 1
            if R & 1 == 0:
                R -= 1
                vR = self.f(self.seg[R], vR)
            L >>= 1
            R >>= 1
        return self.f(vL, vR)


#gcd on blackboard
#セグ木（区間gcd) verify
from fractions import gcd
N=int(input())
A=list(map(int,input().split()))
seg=SegTree(A,gcd,0)
ans=1
for i in range(-1,N):
    v=gcd(seg.query(0,i),seg.query(i+1,N))
    ans=max(v,ans)
print(ans)


Measured memory_bytes: 92392
#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#include<bits/stdc++.h>
using namespace std;

void test_case(){
	int n;
	cin >> n;
	int cnt =0;
	for(int i=1;i<=n;i++){
		int a;
		cin >> a;
		if((a&1)&&(i&1)) cnt++;
	}
	cout << cnt << endl;
}

int main(){
	ios_base::sync_with_stdio(false); cin.tie(nullptr);
	int t=1;
	// cin >> t;

	while(t--) test_case();
	
	return 0;
}


Measured memory_bytes: 3564
#include <stdio.h>

int bubbleSort(int*,int);

int main(){
  int A[100],N,i,cnt;
  scanf("%d",&N);
    for(i=0;i<N;i++){
      scanf("%d",&A[i]);
    }
  cnt=bubbleSort(A,N);
  for(i=0;i<N;i++){
    if (i!=0){
        printf(" ");
    }
    printf("%d",A[i]);
  }
  printf("\n%d\n",cnt);
  return 0;
}

int bubbleSort(int A[],int N){
  int i,j,tmp,sw=0;
  for(i=0;i<(N-1);i++){
    for(j=(N-1);j>i;j--){
      if(A[j-1]>A[j]){
        tmp=A[j-1];
        A[j-1]=A[j];
        A[j]=tmp;
        sw++;
      }
    }
  }
  return sw;
}


Measured memory_bytes: 2072
#include <bits/stdc++.h>
using namespace std;
char a[1005];
char R[27]="zabcdefghijklmnopqrstuvwxy";
int main()
{
    long long n;
    int i,j;
    cin>>n;
    for(i=0; n; i++)
    {
        if((a[i]=n%26)==0)
            n--;
        n/=26;
    }
    for(j=i-1; j>=0; j--)
        printf("%c",R[a[j]]);
    return 0;
}


Measured memory_bytes: 3648
package main

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

// global
var sc = bufio.NewScanner(os.Stdin)

func main() {
	var N int
	fmt.Scan(&N)

	var A [][]int
	// var st string
	for i := 0; i < N; i++ {
		stt := strings.Split(nextLine(), " ")
		A = append(A, Filter(stt))
	}
	//fmt.Println(A)

	ans := 0
	for i := 0; i < N; i++ {
		for j := 0; j < N; j++ {
			if i <= j {
				continue
			}
			ret := 100000000000
			for k := 0; k < N; k++ {
				if i == k || j == k {
					continue
				}

				if A[i][j] > A[i][k]+A[k][j] {
					fmt.Println(-1)
					os.Exit(0)
				} else {
					ret = min(ret, A[i][k]+A[k][j])
				}
			}
			if A[i][j] < ret {
				//fmt.Println("found",i,j)
				ans += A[i][j]
			}
		}
	}
	fmt.Println(ans)
}

// ----------------------------------//
//              utils                //
// ----------------------------------//

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

func Filter(s []string) []int {
	var p []int // == nil
	var val int
	for _, v := range s {
		val, _ = strconv.Atoi(v)
		p = append(p, val)
	}
	return p
}

func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}

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

int main() {
    int N;
    string S;
    cin >> N >> S;
    for (int i = 0; i < (int)S.size(); i++) {
        if ((char)(S[i] + N) <= 'Z') {
            S[i] += N;
        } else {
            int tmp = N - (int)('Z' - S[i]) - 1;
            S[i] = char('A' + tmp);
        }
    }
    cout << S << endl;
}


Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin >> n;
    int h[n];
    for(int i = 0;i < n;i++)
    {
        cin >> h[i];
    }
    int count = 0;
    bool end = true;
    while(end)
    {
        int i = 0;
        while(i < n)
        {
            if(h[i] != 0)
            {
                while(i < n && h[i] != 0)
                {
                    h[i] -= 1;
                    i++;
                }
                count++;
            }
            if(h[i] == 0)
            {
                int flag = 0;
                while(i < n && h[i] == 0)
                {
                    i++;
                    flag++;
                }
                if(flag == n)
                {
                    end = false;
                    break;
                }
            }
        }
    }
    cout << count;

    return 0;
}

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

# define C continue;
# define R return

#define int long long
# define D double
# define I insert
# define ld long double
# define ull unsigned long long
# define ui unsigned int

# define pb emplace_back
# define pf push_front

# define vi vector < int >
# define vc vector < char >
# define vs vector < string >
# define vb vector < bool >
# define vd vector < D >
# define vull vector < ull >
# define vld vector < ld >

# define vvi vector < vector < int > >
# define vvb vector < vector < bool > >
# define vvc vector < vector < char > >
# define vvs vector < vs >
# define vvd vector < vector < D > >
# define vvld vector < vector < ld > >

# define all(v) v.begin() , v.end()
# define allcomp(v) v.begin() , v.end() , comp

# define pii pair < int , int >
# define pll pair < ll , ll >
# define pld pair < ld , ld >
# define pDD pair < D , D >

# define vpld vector < pld >
# define vpii vector < pii >
# define vpDD vector < pDD >

# define vvpii vector < vector < pii > >
# define F first
# define S second
# define mp make_pair

#define PQ(type) priority_queue<type>
#define PQD(type) priority_queue<type, vector<type>, greater<type>>

#define mii map<int, int>
#define mll map<ll, ll>
#define mci map<char, int>
#define msi map<string, int>
#define mis map<int, string>
#define mib map<int, bool>
#define mcb map<char,bool>

#define umii unordered_map<int, int>
#define umib unordered_map<int, bool>
#define umci unordered_map<char, int>
#define umsi unordered_map<string, int>
#define umis unordered_map<int, string>

#define init(arr,val) memset(arr,val,sizeof(arr))
#define REP(i,a,b) for(int i=a; i<b; i++)
#define distance(a,b,p,q) sqrt((p-a)*(p-a) + (q-b)*(q-b))

# define pp(n) printf("%.10Lf",n);
# define nl "\n"
# define fast ios_base::sync_with_stdio(false) ; cin.tie(0) ; cout.tie(0);

string vow = "aeiou";
int month[] = { -1, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

const int dxhorse[] = { -2, -2, -1, -1, 1, 1, 2, 2};
const int dyhorse[] = {1, -1, 2, -2, 2, -2, 1, -1};

const int dx4[] = { -1 , 0 , 1 , 0 } ;
const int dy4[] = { 0 , 1 , 0 , -1 } ;
const int dx8[] = { -1, -1, -1, 0, 0, 1, 1, 1 };
const int dy8[] = { -1, 0, 1, -1, 1, -1, 0, 1 };
const ld pie = 3.1415926535897932384626 ;
const int mod = 1e9 + 7 ;

# define fast ios_base::sync_with_stdio(false) ; cin.tie(0) ; cout.tie(0);
/// Tip : If a and b are positive integers ; we may say - ceil (a/b) = 1 + floor ( (a-1)/b ) .
void a_b_c()
{
    #ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
    #endif
}

void solve()
{
float d,t,s;
cin>>d>>t>>s;
float t1=d/s;
if(t1<=t) cout<<"Yes";
else cout<<"No";
}
int32_t main()
{	fast
   int t=1;
    //freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
    //int t;  cin>>t;
    //cin>>ws;
    for(int i=1; i<=t; i++) solve();

}


Measured memory_bytes: 3620
a, b = map(int, input().split())

if a <= 0 and b >= 0:
    print("Zero")
elif a < 0 and b < 0:
    if (abs(a - b) + 1) % 2 == 0:
        print("Positive")
    else:
        print("Negative")
else:
    print("Positive")

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using vl = vector<ll>;
using Map = map<ll,ll>;
using T = tuple<ll,ll,ll>;
using vvl = vector<vector<ll>>;
#define all(v) v.begin(), v.end()
#define print(v) cout<<v<<endl;
#define fi(v) get<0>(v)
#define se(v) get<1>(v)
#define th(v) get<2>(v)
template <typename T> bool chmax(T &a, const T &b){if (a<b){a=b;return 1;}return 0;}
template <typename T> bool chmin(T &a, const T &b){if (a>b){a=b;return 1;}return 0;}
const ll INF=1LL<<60;
const ll MOD=1000000007;


int main(){
    ll K;
    cin >> K;
    string S;
    cin >> S;
    ll N=S.size();
    if(N<=K)print(S)
    else cout<<S.substr(0,K)<<"..."<<endl;

    return 0;
}

Measured memory_bytes: 3632
H, W, K = map(int, input().split())
css = [input().rstrip() for _ in range(H)]

ans = 0
for rows in range(1<<H):
    for columns in range(1<<W):
        num = 0
        for i in range(H):
            for j in range(W):
                if (rows>>i) & 1 and (columns>>j) & 1:
                    if css[i][j] == '#':
                        num += 1
        if num == K:
            ans += 1

print(ans)


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

#define pb push_back
#define fi first
#define se second
#define eb emplace_back

using namespace std;

typedef pair<int, int> ii;
typedef long long ll;
const int N = 1000007, inf = 0x3f3f3f3f;

int d[N];
vector<int> e[N];
int pai[N];

void no() {
	cout << "No";
	exit(0);
}
int main() {
	memset(d, -1, sizeof d);
	ios::sync_with_stdio(0); cin.tie(0);

	int n, m; cin >> n >> m;
	for(int i = 0; i < m; ++i) {
		int u, v; cin >> u >> v;
		e[u].pb(v);
		e[v].pb(u);
	}


	queue<int> q;
	d[1] = 0;
	q.push(1);

	while(q.size()) {
		int u = q.front(); q.pop();

		for(int v : e[u]) {
			if(d[v] == -1) {
				d[v] = d[u] + 1;
				pai[v] = u;
				q.push(v);
			}
		}
	}

	for(int i = 1; i <= n; i++) {
		if(d[i] == -1) {
			no();
		}
	}

	cout << "Yes\n";

	for(int i = 2; i <= n; ++i) cout << pai[i] << '\n';
}

Measured memory_bytes: 35416
#include<bits/stdc++.h>
using namespace std;
int h,w,a[100][100];
int d1[]={0,0,1,-1},d2[]={1,-1,0,0};
void dfs(int y,int x,int c){
  a[y][x]=0;
  for(int i=0;i<4;i++){
    int yy=d2[i]+y,xx=d1[i]+x;
    if(yy>=0&&xx>=0&&xx<w&&yy<h)
      if(a[yy][xx]==c)
        dfs(yy,xx,c);
  }
}
int main(){
  while(cin>>w>>h,h){
    memset(a,0,sizeof(a));
    int sx,sy,gx,gy;
    cin>>sx>>sy>>gx>>gy;
    sx--;sy--;gx--;gy--;
    int m;
    cin>>m;
    while(m--){
      int q,w,e,r;
      cin>>q>>w>>e>>r;
      w;e--;r--;
      int dy[2][8] = {{0,0,0,0,1,1,1,1},{0,0,1,1,2,2,3,3}}, dx[2][8] = {{0,1,2,3,0,1,2,3},{0,1,0,1,0,1,0,1}};
      for(int i=0;i<8;i++)
        a[r+dy[w][i]][e+dx[w][i]]=q;
    }
    if(a[sy][sx]!=0&&a[gy][gx]==a[sy][sx]){
      dfs(sy,sx,a[sy][sx]);
      if(a[gy][gx]==0)cout<<"OK"<<endl;
      else goto L;
    }
    else{L:;
      cout<<"NG"<<endl;
    }
  }
}

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

int main() {
    int n;
    cin >> n;
    if(n/100 == 7 || (n%100)/10 == 7 || n%10 == 7){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(k,i,n) for(ll i=k;i<n;++i)
int main(void){
    // Your code here!
    ll n,m;
    cin>>n>>m;
    vector<vector<ll>>s(m);
    vector<ll>p(m);
    vector<ll>k(m);
    rep(0,i,m){
        cin>>k[i];
        rep(0,j,k[i]){
            ll x;
            cin>>x;
            s[i].push_back(x);
        }
    }
    rep(0,i,m)cin>>p[i];
    ll ans=0;
    rep(0,bit,1<<n){
        ll s0[n];
        rep(0,i,n){
            if(bit&(1<<i)){
                s0[i]=1;
            }else{
                s0[i]=0;
            }
        }
        //rep(0,i,n)cout<<s0[n-i-1];
        //cout<<endl;
        rep(0,i,m){
            ll p0=0;
            rep(0,j,k[i]){
                p0+=s0[s[i][j]-1];
            }
            //cout<<"p0="<<p0<<endl;
            p0%=2;
            if(p0!=p[i])break;
            if(i==m-1)++ans;
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
#[allow(unused_imports)]
use std::cmp;
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::*;
#[allow(unused_imports)]
use proconio::derive_readable;
use proconio::fastout;
#[allow(unused_imports)]
use num::Integer;
#[allow(unused_imports)]
use itertools::Itertools;

#[fastout]
fn main() {
  input! {
    s: i32,
    w: i32,
  }

  println!("{}", if w >= s { "unsafe" } else {"safe"});
}


Measured memory_bytes: 2148
#include "bits/stdc++.h"
//#define scanf scanf_s
using namespace std;

int main(int argc, char** argv)
{
	int N, A;
	scanf("%d %d", &N, &A);

	N = N % 500;

	if (N <= A)
	{
		printf("Yes");
	}
	else
	{
		printf("No");
	}

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <math.h>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <set>
#include <queue>
#include <deque>
#include <map>
#include <stack>
using namespace std;

#define mod 1000000007
#define ten5 100005
#define ten52 200005
#define ten6 1000005
#define PI 3.1415926
#define pb(x) push_back(x)
#define all(x) x.begin(),x.end()

typedef long long int ll;

//ll num[50];
//ll num2[50];
ll num[ten52];
//stack<char> stk;
//set<ll> sll;
//map<string,ll> mp,mp1;
//map<string,ll>::iterator iter;
//map<ll,ll> mp;
//deque<char> deq;


int main(void)
{
    double ans=0.0,d,d1,d2;
    //float f,g,h;
    long long int m,n,i,j,k=1;
    long long int a,a1,a2,a3,sum;
    string s,s1,s2;
    char c,c1;
    sum=a=a1=a2=a3=0;
    cin>>a1>>a2>>a3;
    cout<<a3<<' '<<a1<<' '<<a2;

    return 0;
}


Measured memory_bytes: 256
a = list(map(int,input().split()))
A = list(map(int,input().split()))

K = a[0]
N = a[1]

A_nplus1 = K + A[0]
A.append(A_nplus1)

max = -1
max_id = -1

for i in range(0,N):
    if A[i+1]-A[i] > max:
        max = A[i+1] - A[i]
print(K-max)

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

using namespace std;

#define pb push_back
#define mp make_pair
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
typedef long long LL;
typedef pair<int, int> PII;

int n;
int a[300000];
LL ans = -LL(1e18);
priority_queue<int, vector<int>, greater<int> > pq;
LL pref[200001], suf[200001];

int main() {
    scanf("%d", &n);
    forn(i, 3 * n) scanf("%d", a + i);
    LL cur = 0;
    forn(i, n) {
        pq.push(a[i]);
        cur += a[i];
    }
    pref[n] = cur;
    for (int i = n; i < 2 * n; ++i) {
        pq.push(a[i]);
        cur += a[i];
        cur -= pq.top();
        pq.pop();
        pref[i + 1] = cur;
    }
    while (!pq.empty()) {
        pq.pop();
    }
    cur = 0;
    for (int i = 3 * n - 1; i >= 2 * n; --i) {
        pq.push(-a[i]);
        cur += -a[i];
    }
    suf[2 * n] = cur;
    for (int i = 2 * n - 1; i >= n; --i) {
        pq.push(-a[i]);
        cur += -a[i];
        cur -= pq.top();
        pq.pop();
        suf[i] = cur;
    }
    for (int i = n; i <= 2 * n; ++i) {
        ans = max(ans, pref[i] + suf[i]);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3832
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ld long double
#define al(a) (a).begin(),(a).end()
#define mk make_pair
#define check cout<<"?"<<endl;

ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;

int main() {
    ll n,a,b,ans=0; cin>>n>>a>>b;
    ll p,m; cin>>p;
    rep(i,n-1){
        cin>>m;
        ans+=min(b,a*(m-p));
        p=m;
        
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(x) x.begin(), x.end()
using namespace std;
 bool validYear(int y){
 	return y>=0;
 }
 bool validMonth(int m){
 	return (m>0 and m<=12);
 }
int main() {
	string s;
	cin>>s;
	int num1 = (s[0]-'0')*10 + (s[1]-'0');
	int num2 = (s[2]-'0')*10 + (s[3]-'0');
	if(validMonth(num1)){
		if(validMonth(num2)) printf("AMBIGUOUS\n");
		else if(validYear(num2)) printf("MMYY\n");
		else printf("NA\n");
	}
	else if(validMonth(num2)){
		 if(validYear(num1)) printf("YYMM\n");
		 else printf("NA\n");
	}
	else printf("NA\n");
	return 0;
}

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

int main(){
    int n;
    std::cin >> n;
    std::list<int> out;
    for(int i = 0; i < n; i++){
        int a;
        std::cin >> a;
        if(i % 2 == 0){
            out.push_back(a);
        }else{
            out.push_front(a);
        }
    }

    std::size_t size = out.size();
    // 偶数は頭から、奇数は後ろから読む
    if(size % 2 != 0){
        auto iter = out.end();
        while(iter != out.begin()){
            iter--;
            std::cout << *iter << " ";
        }
    }else{
        auto iter = out.begin();
        while(iter != out.end()){
            std::cout << *iter << " ";
            iter++;
        }
    }

    std::cout << std::endl;

    return 0;
}


Measured memory_bytes: 8448
/***********************
*  Author: xuziyuan    * 
***********************/

#include <bits/stdc++.h>

#define rt0 return 0
#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define replet(c) for(char c='a';c<='z';c++) 
#define LL long long
#define pii pair <int,int>
#define pb push_back
#define fi first
#define se second
#define mpr make_pair
#define sqr(a) ((a)*(a))

using namespace std;

const LL MOD=1e9+7;

LL n,k,dp[2010][2010],dp2[2010][2010];

int main()
{
	cin>>n>>k;
	dp[0][0]=1;
	repn(i,k)
	{
		repn(j,k)
		{
			dp[i][j]=(dp[i-1][j-1]+dp[i-1][j])%MOD;
		}
	}
	dp2[0][0]=1;
	repn(i,n-k)
	{
		repn(j,n-k)
		{
			dp2[i][j]=(dp2[i-1][j-1]+dp2[i-1][j])%MOD;
		}
	}
	repn(i,k)
	{
		if(i-1>=k)
		{
			puts("0");
			continue;
		}
		cout<<(dp2[n-k][i]*dp[k][i]*2+dp2[n-k][i+1]*dp[k][i]+dp2[n-k][i-1]*dp[k][i])%MOD<<endl;
	}
	rt0;
}

Measured memory_bytes: 34176
import java.util.Scanner;
public class Main {
    public static void main(String[] args){
        Scanner scan=new Scanner(System.in);
        String[] a=new String[555555];
        int i=0;
        while(true){
            a[i]=scan.next();
            if(a[i].equals("0")) break;
            i++;
        }

        
        i=0;

        while(true){
            if(a[i].equals("0")) break;
            int ans=0;
            for(int j=0;j<a[i].length();j++){
                ans+=Integer.parseInt(a[i].substring(j,j+1));
                //System.out.printf(":"+ans+":");
            }
            System.out.println(ans);
            i++;
        }
    }
}


Measured memory_bytes: 28820
#include<bits/stdc++.h>
using namespace std;
#define arep(i,x,n) for(int i=int(x);i<(int)(n);i++)
#define rep(i,n) for(long long i = 0;i < n;++i)
#define pi 3.141592653589793
#define eps 0.00000001
#define INF 1e9+7  
using ll = long long; 
using P=pair<int,int>;
using lP=pair<ll,ll>;
using fP=pair<double,double>;


int main(){
    int a,b;
    cin>>a>>b;
    int ans=0;
    while(a>0){
        a-=b;
        ans++;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256