akhauriyash/Code-Regression huggingface dataset:
#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,x;
    cin >> n >> x;
    vector <int> l(n);
    rep(i,n){
        cin >> l[i];
    }
    int now;
    now=0;
    int k=0,j=0;
    while(now<=x){
        now+=l[j];
        ++j;
        if(j==n+1){
            break;
        }
    }

    cout << j << endl;

    return 0;
}

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

# define p(s) std::cout << s << endl;
# define printIf(j,s1,s2) cout << (j ? s1 : s2) << endl;
# define YES(j) cout << (j ? "YES" : "NO") << endl;
# define Yes(j) std::cout << (j ? "Yes" : "No") << endl;



int main()
{
    int n;cin >> n;
    vector<int> v(n+2);

    v[0]=0;
    v[n+1]=0;
    int sum=0;
    for(int i=1;i<=n;i++){
        cin >> v[i];
        sum += abs(v[i-1]-v[i]);
    }
    sum += abs(v[n]-v[n+1]);

    for(int i=1;i<=n;i++){
        p(sum - abs(v[i-1]-v[i]) - abs(v[i]-v[i+1]) + abs(v[i-1]-v[i+1]))
    }
} 

Measured memory_bytes: 1664
#include <bits/stdc++.h>
using namespace std;
#define ALL(A) (A).begin(),(A).end()
#define ll long long
const ll mod = 1e9+7;
const ll INF = 2*1e18;
const int inf = 1e9+7;

int ans[105][105];
int main(void){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int H,W,N;
	cin >> H >> W >> N;
	vector<int> a(N);
	for(int i=0;i<N;i++)cin >> a[i];
	pair<int,int> nowpos = pair<int,int>(0,0);
	for(int i=0;i<N;i++){
		while(a[i]>0){
			int nowx = nowpos.first;
			int nowy = nowpos.second;
			ans[nowx][nowy]=i+1;
			if(nowx%2==0){
				if(nowy+1==W){
					nowx++;
				}else{
					nowy++;
				}
			}else{
				if(nowy-1 == -1){
					nowx++;
				}else{
					nowy--;
				}
			}
			nowpos.first = nowx;
			nowpos.second= nowy;
			a[i]--;
		}
	}
	for(int i=0;i<H;i++){
		for(int j=0;j<W;j++){
			cout << ans[i][j] <<" ";
		}
		cout << endl;
	}
}

Measured memory_bytes: 384
import math
import itertools
N = int(input())
P = []
S = math.factorial(N)
T = []
for i in range(N):
  x,y = (int(x) for x in input().split())
  T.append(i)
  P.append((x,y))
c = list(itertools.combinations(T, 2))
sum = 0
for i in c:
  sum += ((P[i[0]][0] - P[i[1]][0])**2 + (P[i[0]][1] - P[i[1]][1])**2)**(1/2)
print(sum*(math.factorial(N-1))*2/S)

Measured memory_bytes: 3316
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using bint = boost::multiprecision::cpp_int;
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repSE(i,s,n) for (int i = (s); i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
  int n;
  string s;
  cin >> n >> s;
  vector<int> a(n);
  rep(i,n) {
    if (s[i] == 'R') a[i] = 0;
    if (s[i] == 'G') a[i] = 1;
    if (s[i] == 'B') a[i] = 2;
  }
  vector<ll> cnt(3);
  rep(i,n) cnt[a[i]]++;
  ll ans = 1;
  rep(i,3) ans *= cnt[i];
  rep(j,n)rep(i,j) {
    int k = j + (j-i);
    if (k < n) {
      if (a[i] == a[j]) continue;
      if (a[i] == a[k]) continue;
      if (a[k] == a[j]) continue;
      ans--;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3636
def my_gcd(a, b):
    p = max(a, b)
    q = min(a, b)
    r = p % q
    while r > 0:
        p = q
        q = r
        r = p % q
    return q

A, B = map(int, input().split())
d = my_gcd(A, B)
print((A * B) // d)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;

template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()

const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001;

int gcd(int A, int B) {
    if (A > B) swap(A, B);
    if (A == 0) return B;
    return gcd(B % A, A);
}


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

    int N; cin >> N;

    int data[N]; F0R(i, N) cin >> data[i];

    int l[N], r[N];
    l[0] = data[0];
    FOR(i, 1, N) l[i] = gcd(l[i-1], data[i]);

    r[N-1] = data[N-1];
    F0Rd(i, N-1) {
        r[i] = gcd(r[i+1], data[i]);
    }

    int ans = 1;
    FOR(i, 1, N-1) {
        ans = max(ans, gcd(l[i-1], r[i+1]));
    }
    ans = max(ans, max(r[1], l[N-2]));

    cout << ans << endl;

    return 0;
}

// read the question correctly (ll vs int)
// template by bqi343

Measured memory_bytes: 1408
s=input()
first=int(s[:2])
end=int(s[2:])
if first<=12 and first>=1:
    if end<=12 and end>=1:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if end<=12 and end>=1:
        print("YYMM")
    else:
        print("NA")


Measured memory_bytes: 2940
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        try(Scanner sc = new Scanner(System.in)){
            while(true){
                int n = sc.nextInt();
                if(n == 0){
                    break;
                }
                int[] scores = new int[n];
                for(int i = 0;i < scores.length;i++){
                    scores[i]=sc.nextInt();
                }
                double avg = 0, variance = 0;
                for(int j = 0; j < scores.length;j++){
                    avg = avg + scores[j];
                }
                avg = (double)avg/scores.length;
                for(int k = 0;k < scores.length;k++){
                    variance = variance+Math.pow(scores[k]-avg, 2);
                }
                variance = variance/n;
                System.out.println(Math.sqrt(variance));
        }
    }
}
}


Measured memory_bytes: 30960
#include<iostream>
#include<cmath>

using namespace std;

long long N;

long long res;

int main() {

	cin >> N;

	for (int i = sqrt(N); i >=1; i--) {
		if (N % i == 0) {
			res = i;
			break;
		}
	}

	cout << res + N / res - 2 << endl;

	return 0;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  string S;
  cin>>S;
  vector<int> s(S.size());
    for(int i=0;i<S.size();i++){
       s.at(i)=S.at(i);}
  int a=0;
  int b=0;
  for(int i=0;i<s.size();i++){
    if(i%2==s.at(i)%2){a++;}
    else{b++;}
  }
  cout<<min(a,b)<<endl;
}

Measured memory_bytes: 896
#include <stdio.h>
#include <stdlib.h>

int main(void)
{
	int n, x;
	scanf("%d %d",&n,&x);
	int *l;
	l = (int*)malloc(sizeof(int)*(n+2));
	int i =0;
	while (i < n)
	{
		scanf("%d",&(l[i]));
		i++;
	}
	i = 0;
	int *d;
	int sum = 1;
	d = (int*)malloc(sizeof(int)*(n+3));
	d[0] = 0;
	d[1] = 0;
	i = 2;
	while (i < n+2)
	{
		d[i] = d[i-1]+l[i-2];
		if(d[i]<=x)
		{
			sum++;
		}
		i++;
	}
	printf("%d\n",sum);

	return(0);
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
template<class A, class B> ostream& operator <<(ostream& out, const pair<A, B> &p) {
    return out << "(" << p.first << ", " << p.second << ")";
}
template<class A> ostream& operator <<(ostream& out, const vector<A> &v) {
    out << "[";
    for (int i = 0; i < (int)v.size(); i++) {
        if(i) out << ", ";
        out << v[i];
    }
    return out << "]";
}

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

    double n;
    cin >> n;
    cout << 2.0 * 3.141592653589 * n << '\n';

    return 0;
}


Measured memory_bytes: 3804
#include<bits/stdc++.h>
#define REP(x,y,z) for(int x=y;x<=z;x++)
#define MSET(x,y) memset(x,y,sizeof(x))
#define M 100005
using namespace std;
int n,in[M][3];
int dp[M][3];
int main()
{
    scanf("%d", &n);
    REP(i,1,n) REP(j,0,2) scanf("%d", &in[i][j]);
    
    dp[1][0] = in[1][0];
    dp[1][1] = in[1][1];
    dp[1][2] = in[1][2];
    REP(i,2,n)REP(j,0,2) {
        dp[i][j] = 0;
        REP(k,0,2) if(j!=k) {
            dp[i][j] = max(dp[i][j], dp[i-1][k] + in[i][j]);
        }
    }
    printf("%d\n", *max_element(dp[n], dp[n]+3));

    return 0;
}


Measured memory_bytes: 6008
using System;
using System.Text;

class AtCoder
{
    static void Main(){
		int n = int.Parse(Console.ReadLine());
		string[] s = Console.ReadLine().Split();
		double sum = 0;
		for(int cnt =0; cnt < n ; cnt++){
			sum += (1/(double.Parse(s[cnt])));
		}
		sum=(1/sum);
		Console.WriteLine(sum.ToString());
    }
}

Measured memory_bytes: 11092
import std.stdio,std.string,std.conv,std.algorithm;
import std.algorithm:rev=reverse;

int main(){
    auto s=readln.chomp.dup;
    foreach(t;s[1..3]){
        if(t!=s[0]){
            writeln("Yes");
            return 0;
        }
    }   
    writeln("No");
    return 0;
}

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

using ll = long long;

const int INF = 1001001001;
const ll INF_LL = 1001001001001001001LL;

int main(void){
  int n; cin >> n;
  vector<int> h(n);
  rep(i,n) cin >> h[i];

  int ans = 0;
  rep(i,n){
    bool see = true;
    for(int j=0;j<i;j++){
      if(h[j]>h[i]) see = false;
    }
    if(see) ans++;
  }

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


Measured memory_bytes: 3612
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>

using namespace std;

int main()
{
    int n, p;
    int a[100010];
    int ocnt = 0, ecnt = 0;

    cin >> n >> p;

    for (int i = 0; i < n; i++) {
        cin >> a[i];
        if (a[i]%2) ocnt++;
    }

    long long int ans = 1;

    for (int i = 0; i < n; i++) {
        ans *= 2;
    }

    if (ocnt==0 && p == 0) {
        cout << ans << endl;
    }
    else if (ocnt == 0 && p == 1) {
        cout << 0 << endl;
    }
    else {
        cout << ans/2 << endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1e9 + 7;
//const ll MOD = 998244353;
//const ll MOD = ;
ll mod(ll A, ll M) {return (A % M + M) % M;}
const ll INF = 1LL << 60;
template<class T> bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template<class T> bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
ll divceil(ll A, ll B) {return (A + (B - 1)) / B;}
ll myctoi(char C) {return C - '0';}
char myitoc(ll N) {return '0' + N;}
#define FINALANS(A) do {cout << (A) << '\n'; exit(0);} while (false)

ll N, K;
vector<ll> A, B;
ll zero;
ll n, m;

ll orlesscount(ll t)
{
  ll ret = 0;

  if (t >= 0)
  {
    ret += n * m;
    ret += zero * (N - 1) - (zero * (zero - 1) / 2);

    ll reta = 0;
    for (ll i = 0; i < n; i++)
    {
      ll a = A.at(i);

      auto it = upper_bound(A.begin(), A.end(), t / a);
      ll tmp = it - A.begin();
      if (a * a <= t)
        tmp--;

      reta += tmp;
    }
    reta /= 2;

    ll retb = 0;
    for (ll i = 0; i < m; i++)
    {
      ll b = B.at(i);

      auto it = upper_bound(B.begin(), B.end(), t / b);
      ll tmp = it - B.begin();
      if (b * b <= t)
        tmp--;

      retb += tmp;
    }
    retb /= 2;

    ret += reta + retb;
  }
  else
  { 
    t = -t;

    for (ll i = 0; i < n; i++)
    {
      ll a = A.at(i);

      auto it = lower_bound(B.begin(), B.end(), divceil(t, a));
      ll tmp = m - (it - B.begin());

      ret += tmp;
    }
  }

  return ret;
}

int main()
{
  cin >> N >> K;
  for (ll i = 0; i < N; i++)
  {
    ll a;
    cin >> a;
    if (a > 0)
      A.push_back(a);
    else if (a < 0)
      B.push_back(-a);
    else
      zero++;
  }
  n = A.size(), m = B.size();
  sort(A.begin(), A.end());
  sort(B.begin(), B.end());
  
  ll ok = 1e18 + 1, ng = -1e18 - 1;
  while (abs(ok - ng) > 1)
  {
    ll mid = (ok + ng) / 2;
    if (orlesscount(mid) >= K)
      ok = mid;
    else
      ng = mid;
  }
  cout << ok << endl;
}

Measured memory_bytes: 2420
import numpy as np

def main():
    A = np.loadtxt(open(0), np.int32, skiprows=1, ndmin=2)

    N = ans = len(A)

    while A.any():
        b = np.bincount(A[:, 0])
        A = np.reshape(A[A != b.argmax()], (N, -1))
        ans = min(ans, b.max())

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 13508
N = int(input())
s = [0] * N 
for i in range(N):
    s[i] = input()
M = int(input())
t = [0] * M 
for i in range(M):
    t[i] = input()

ans_list = []

for i in range(N):
    tmp = s.count(s[i]) - t.count(s[i])
    ans_list.append(tmp)

ans = max(0, max(ans_list))

print(ans)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define Rep(i,j,n) for(int i=j; i<n; i++)
#define rep(i,n) for(int i=0; i<n; i++)
#define PI 3.14159265359
#define INF 1000100100//000000000
#define MOD 1000000007
#define all(x) (x).begin(),(x).end()
typedef long long ll;
#define P pair<int, int>
#define PP pair<P,P>
#define T tuple<int,int,int> 
using namespace std;

int main(){
    ll n,x,m; cin >> n >> x >> m;
    ll ans=0;
    vector<ll> lop;
    unordered_map<int,int> u;
    //u[x]++;
    //n--;
    //lop.push_back(x);
    while(n-->0){
        x%=m;
        u[x]++;
        lop.push_back(x);
        if(u[x]>=2) break;
        ans+=x;
        x*=x;
    }
    if(n<=0){
        cout << ans << endl;
        return 0;
    }
    int index,index2;
    index=-1;
    index2=lop.size()-2;
    rep(i,lop.size()){
        if(lop[i]==x){
            if(index==-1){
                index=i;
                break;
            }
        }
    }

    ll lsum=0;
    ll leni=index2-index+1;
    rep(i,leni){
        lsum+=lop[index+i];
    }

    ans+=lsum*(n/leni);
    n-=(n/(leni))*leni;

    while(n-->=0) ans+=lop[index++];
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 5632
N,M,Q = map(int,input().split())
num = [[0 for i in range(N)] for j in range(N)]
lr = [list(map(int,input().split())) for i in range(M)]
for l,r in lr:
    num[l-1][r-1] += 1

for j in range(N):
    for i in range(N-1,0,-1):
        num[i-1][j] += num[i][j]
for i in range(N):
    for j in range(N-1):
        num[i][j+1] += num[i][j]
for i in range(Q):
    p,q = map(int,input().split())
    print(num[p-1][q-1])

Measured memory_bytes: 51784
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = (int)(a); i <= (int)(n); ++i)
#define rrep(i, a, n) for (int i = (int)(a); i >= (int)(n); --i)
#define debug(x) cerr << #x << " = " << x << "\n"
#define debugv(x) \
  rep(f, 0, (x.size() - 1)) cerr << x[f] << (f == (x.size() - 1) ? "\n" : " ")
#define all(x) x.begin(), x.end()
#define int long long
using namespace std;
typedef pair<int, int> pii;
typedef vector<int> vi;
const int MX = 1e5 + 5, INF = 5 << 28, MOD = 1e9 + 7;

int N, M, K;
vi A, B;
string S1, S2, S3;

void input() {
  int x, y, z;
  cin >> S1;
  cin >> S2;
  cin >> S3;
  ;
}
void solve() {
  queue<int> qa, qb, qc;
  for (auto x : S1) {
    if (x == 'a')
      qa.push(0);
    else if (x == 'b')
      qa.push(1);
    else
      qa.push(2);
  }
  for (auto x : S2) {
    if (x == 'a')
      qb.push(0);
    else if (x == 'b')
      qb.push(1);
    else
      qb.push(2);
  }
  for (auto x : S3) {
    if (x == 'a')
      qc.push(0);
    else if (x == 'b')
      qc.push(1);
    else
      qc.push(2);
  }
  vector<queue<int>> Q(3);
  Q[0] = qa, Q[1] = qb, Q[2] = qc;

  int teban = 0;
  int next;
  int kati;
  while (true) {
    if (Q[teban].size()) {
      next = Q[teban].front();
      Q[teban].pop();
    } else {
      kati = teban;
      break;
    }
    teban = next;
  };
  cout << (kati == 0 ? 'A' : (kati == 1 ? 'B' : 'C')) << endl;
  ;
}
signed main() {
  input();
  solve();
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int n,k,a[1002],dp[100005];
main () {
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cin>>n>>k;
	for (int i=1; i<=n; i++)
		cin>>a[i];
	dp[0]=-1;
	for (int i=1; i<=k; i++) {
		int ko=0;
		for (int j=1; j<=n; j++) {
			if (i-a[j]<0) continue;
			if (dp[i-a[j]]==-1) ko=1;
		}
		if (ko) dp[i]=1;
			else dp[i]=-1;
	}
	if (dp[k]==1) cout<<"First\n";
		else cout<<"Second\n";
}

Measured memory_bytes: 640
//---------------------------------------------------------------
#include <bits/stdc++.h>
using namespace std;
#include <iostream>
#include <vector>
#include <cstdlib>
#include <cmath>
#include <math.h>
#include <sstream>
#include <numeric>
#include <cctype>
#include <bitset>
#include <cassert>
#include<algorithm>
//---------------------------------------------------------------
#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 rep2(i, s, n) for (int i = (s); i <= (int)(n); i++)
#define SIZE 100005
#define INF 1e18
#define all(x) x.begin(),x.end()
#define fi first
#define se second
#define vec vector
using pint = pair<int,int>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
//---------------------------------------------------------------
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const double pi = acos(-1);
//---------------------------------------------------------------

//↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓


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

    ll n;
    cin>>n;

    ll ans=0;
    for(ll a=n;a>=1;a--){
        ll b= (n+(a-1))/a;
        ans+=b;
    }
    cout<<ans-n<<endl;
}

Measured memory_bytes: 3648
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines

def main():
    S = readline().strip()

    ans = 0
    for s in S:
        if s == "+":
            ans += 1
        else:
            ans -= 1
    
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
#define ll int64_t
const ll N = 1e5 + 5;
ll dp[N];
int main()
{
    ios::sync_with_stdio(0), cin.tie(0);
    int n, m, v, w;
    cin >> n >> m;
    for (ll i = 0; i < n; i++)
    {
        cin >> w >> v;
        for (ll j = m; j >= w; j--)
            dp[j] = max(dp[j], dp[j - w] + v);
    }
    cout << dp[m];
}

Measured memory_bytes: 1024
#!/usr/bin/env python

def gcd(a, b):
    if a < b:
        a, b = b, a

    if b == 1:
        return 1
    m = a % b
    if m == 0:
        return b
    return gcd(b, m)


def main():
    N, M = [int(a) for a in input().split()]

    S = input()
    T = input()
    L = N * M // gcd(N, M)
    a1 = L // N
    a2 = L // M
    cc = a1 * a2 // gcd(a1, a2)
    for i in range(0, L, cc):
        if S[i // a1] != T[i // a2]:
            print(-1)
            return
    print(L)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3316
n = int(input())
p = list(map(float, input().split()))
dp = [0]*(n+2)
dp[1] = 1
for i in p:
    newdp = dp[:]
    for j in range(n+1):
        newdp[j+1] = dp[j]*i + dp[j+1]*(1-i)
    dp = newdp

print(sum(dp[n//2+2:]))

Measured memory_bytes: 45404
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#define rep(i, n) for(i = 0; i < n; i++)
using namespace std;

signed main() {
	int n, a;
	cin >> n >> a;
	n %= 500;
	if (n > a) cout << "No" << endl;
	else cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 256
import collections
N = int(input())
counter = 0
if N == 1:
  print(0)
  exit()
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

def cc(n):
    ans = 0
    i = 1
    while True:
        n = n - i
        ans += 1
        i += 1
        if n < i:
            break
    return ans

s_list = prime_factorize(N)
c = collections.Counter(s_list)
values,counts = zip(*c.most_common())
j = 0
for i in range(len(counts)):
    counter += cc(counts[i])
print(counter)

Measured memory_bytes: 9476
# -*- coding:utf-8 -*-
N = int(input())

D_list = []
for _ in range(N):
    D_list.append(list(map(int,input().split())))

lenD = 0
zorome = 0
for x,y in D_list:
    if x == y:
        zorome += 1
        if zorome == 3:
            print("Yes")
            break
        else:
            pass
    else:
        zorome = 0
    lenD += 1
    if lenD >= N:
        print("No")
        break




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

int main() {
    int n;
    cin >> n;
    int cnt = 0, ans = 0;
    for (int i=1; i<=n; i++) {
        int cnt = 0;
        for (int j=1; j<=i; j+=2) {
            if (i % j == 0) cnt++;
        }
        if (cnt == 8) ans++;
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
n,m = map(int,input().split())
A =[int(input()) for _ in range(m)]
dict = {i:False for i in range(n)}
for a in A:
    dict[a]=True
dp = [0 for _ in range(n+2)]
dp[0] = 1
MOD = 1000000007
for i in range(n):
    if not dict[i]:
        dp[i+1] = (dp[i]+dp[i+1])%MOD
        dp[i+2] = (dp[i]+dp[i+2])%MOD
print(dp[n])


Measured memory_bytes: 18976
n,m=map(int,input().split())
h=list(map(int,input().split()))
good=[True for i in range(n)]
ans=n
for i in range(m):
  a,b=map(int,input().split())
  a-=1
  b-=1
  if h[a]>h[b]:
    if good[b]:
      ans-=1
    good[b]=False
  elif h[a]<h[b]:
    if good[a]:
      ans-=1
    good[a]=False
  else:
    if good[a]:
      ans-=1
    good[a]=False
    if good[b]:
      ans-=1
    good[b]=False
print(ans)

Measured memory_bytes: 84828
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n= sc.nextInt();
		long k= sc.nextLong();
		long d;
		boolean[] a=new boolean[n];
		for(int i=0;i<k;i++){
			d=sc.nextLong();
			for(int j=0;j<d;j++){
				a[sc.nextInt()-1]=true;
			}
		}
		long ans=0;
		for(int i=0;i<n;i++){
			if(!a[i]){
				ans++;
			}
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 37332
<?php
fscanf(STDIN, "%d", $n);

$format = join(' ', array_fill(0, $n, '%d'));
$nums = array_map('intval', fscanf(STDIN, $format));

$count = selectionSort($nums);

vprintf($format."\n", $nums);
echo "$count\n";

function selectionSort(&$nums)
{
    $count = 0;
    $N = count($nums);

    for ($i = 0; $i < $N; $i++) {
        $minj = $i;

        for ($j = $i; $j < $N; $j++) {
            if ($nums[$j] < $nums[$minj]) {
                $minj = $j;
            }
        }

        if ($i != $minj) {
            $tmp         = $nums[$i];
            $nums[$i]    = $nums[$minj];
            $nums[$minj] = $tmp;

            $count += 1;
        }
    }

    return $count;
}

Measured memory_bytes: 6668
////////////////////////////////////////////
///                                      ///
///         Template ver. 1 rapel        ///
/// Fear is Temporary, Regret is Forever ///
///          Must Try and Get AC         ///
///                                      ///
////////////////////////////////////////////
#include <stdio.h>
#include <iostream>
#include <sstream>
#include <iomanip>

#include <algorithm>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <utility>

#include <math.h>
#include <complex>

#include <assert.h>
#include <time.h>
//#include <chrono>
//#include <random>

#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <list>
#include <bitset>

#define FI first
#define SE second
#define MP make_pair
#define PB push_back
#define PF push_front
#define POB pop_back
#define POF pop_front
#define endl '\n'
using namespace std;

typedef long long LL;
typedef unsigned long long ULL;

void desperate_optimization(int precision){
  	ios_base::sync_with_stdio(false);
  	cin.tie(0);
  	cout.tie(0);
  	cout.setf(ios::fixed);
  	cout.setf(ios::showpoint);
  	cout.precision(precision);
}

priority_queue<int> pqpos, pqneg;
const int N = 1e5;
int arr[N + 5];

vector<pair<int,int> > op;

void hora(int tc) {
	int n;
	cin>>n;
	for(int i = 0;i < n;i++) {
		cin>>arr[i];
		if(arr[i] >= 0) pqpos.push(-arr[i]);
		else pqneg.push(arr[i]);
	}
	if(n == 2) {
		sort(arr, arr + 2);
		cout<<arr[1] - arr[0]<<endl;
		cout<<arr[1]<<" "<<arr[0]<<endl;
		return ;
	} else {
		if(pqneg.size() == 0) {
			int t1 = -pqpos.top();
			pqpos.pop();
			int t2 = -pqpos.top();
			pqpos.pop();
			pqneg.push(t1 - t2);
			op.PB({t1, t2});
		}
		if(pqpos.size() == 0) {
			int t1 = pqneg.top();
			pqneg.pop();
			int t2 = pqneg.top();
			pqneg.pop();
			pqpos.push(-(t1 - t2));
			op.PB({t1, t2});
		}
		while(pqpos.size() > 1) {
			int t1 = -pqpos.top();
			pqpos.pop();
			int t2 = pqneg.top();
			pqneg.pop();
			pqneg.push(t2 - t1);
			op.PB({t2, t1});
		}
		while(pqneg.size() > 1) {
			int t1 = -pqpos.top();
			pqpos.pop();
			int t2 = pqneg.top();
			pqneg.pop();
			pqpos.push(t2 - t1);
			op.PB({t1, t2});
		}
		op.PB({-pqpos.top(), pqneg.top()});
		cout<<-pqpos.top() - pqneg.top()<<endl;
		for(auto x: op) cout<<x.FI<<" "<<x.SE<<endl;
	}
}

int main(){
	desperate_optimization(10);
	int ntc = 1;
	//cin>>ntc;
	for(int tc = 1;tc <= ntc;tc++) hora(tc);
	return 0;
}




Measured memory_bytes: 3700
import java.util.Scanner

import scala.collection.Searching._
import scala.annotation.tailrec
import scala.collection.immutable.Queue

class IUnionFind(val size: Int) {

  private case class Node(var parent: Option[Int], var treeSize: Int)

  private val nodes = Array.fill[Node](size)(new Node(None, 1))

  def union(t1: Int, t2: Int): IUnionFind = {
    if (t1 == t2) return this

    val root1 = root(t1)
    val root2 = root(t2)
    if (root1 == root2) return this

    val node1 = nodes(root1)
    val node2 = nodes(root2)

    if (node1.treeSize < node2.treeSize) {
      node1.parent = Some(t2)
      node2.treeSize += node1.treeSize
    } else {
      node2.parent = Some(t1)
      node1.treeSize += node2.treeSize
    }
    this
  }

  def connected(t1: Int, t2: Int): Boolean = t1 == t2 || root(t1) == root(t2)

  @tailrec
  private def root(t: Int): Int = nodes(t).parent match {
    case None => t
    case Some(p) => root(p)
  }
}


object Main {
  def solve(sc: => Scanner): Unit = {
    val N, Q = sc.nextInt
    val A = Array.fill(N)((sc.nextInt, sc.next)).reverse.dropWhile(X => X._1 > Q)
    if (A.length == 0) {
      println("kogakubu10gokan")
    } else {
      println(A(0)._2)
    }
  }

  def main(args: Array[String]): Unit = {
    val sc: Scanner = new Scanner(System.in)
    solve(sc)
  }
}

Measured memory_bytes: 45184
#include <bits/stdc++.h>
#define ll long long int
#define f first
#define s second
using namespace std;

void fast(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
}

int main(){
	fast();
	ll h,a;
	cin>>h>>a;
	cout<<ceil(h*1.0/a);
}

Measured memory_bytes: 256
#![allow(unused_imports)]
use itertools::Itertools;
use num_traits::clamp;
use ordered_float::OrderedFloat;
use proconio::{fastout, input, marker::*};
use std::cmp::*;
use std::collections::*;
use superslice::*;

#[fastout()]
fn main() {
    input! {
        n: usize, k: usize,
        mut a: [i64; n],
    }
    let m = 1000000007i64;
    let mod_product = |acc: i64, &value: &i64| {
        (acc * value).rem_euclid(m)
    };

    if k == n || k % 2 == 1 && a.iter().all(|v| *v <= 0) {
        a.sort_by_key(|v| -*v);
        let ans = a.iter().take(k).fold(1, mod_product);
        println!("{}", ans);
        return;
    }

    a.sort_by_key(|v| Reverse(v.abs()));
    let mut plus = Vec::new();
    let mut minus = Vec::new();
    for i in 0..n {
        if a[i] >= 0 {
            plus.push(a[i]);
        } else {
            minus.push(a[i]);
        }
    }

    let mut ppos = 0;
    let mut mpos = 0;
    let mut vals = Vec::new();
    let mut retry = false;
    while vals.len() < k {
        if vals.len() < k - 1 && ppos + 1< plus.len() && mpos + 1 < minus.len() {
            if plus[ppos] * plus[ppos+1] < minus[mpos] * minus[mpos+1] {
                vals.push(minus[mpos]);
                vals.push(minus[mpos+1]);
                mpos += 2;
            } else {
                vals.push(plus[ppos]);
                vals.push(plus[ppos+1]);
                ppos += 2;
            }
        } else if vals.len() < k - 1 && mpos + 1 < minus.len() {
            vals.push(minus[mpos]);
            vals.push(minus[mpos+1]);
            mpos += 2;
        } else if ppos < plus.len() {
            vals.push(plus[ppos]);
            ppos += 1;
        } else {
            retry = true;
            break;
        }
    }
    let ans = if !retry {
        vals.iter().fold(1, mod_product)
    } else {
        a.sort_by_key(|v| v.abs());
        assert!(a.iter().filter(|v| **v > 0).count() == 2);
        a.iter().take(k).fold(1, mod_product)
    };
    println!("{}", ans);
}


Measured memory_bytes: 9876
#define _USE_MATH_DEFINES
#include <iostream>
#include <algorithm>
#include <queue>
#include <stack>
#include <deque>
#include <climits>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
//#include <tuple>

#define INF INT_MAX>>1 
#define SIZE 100010
#define MOD 1000000007
#define rep(i, n) for(int i=0; i<(int)(n); i++)
#define rep2(i, from, to) for(int i=(from); i<(int)(to); i++)
#define all(obj) (obj).begin(), (obj).end()
#define lpair pair<ll, ll>
#define vint vector<ll>
#define vinput(name) for(int i=0; i<(int)(name.size()); i++) cin >> name[i];
#define voutput(name) for(int i=0; i<(int)(name.size()); i++) cout << name[i] << endl;
typedef long long ll;

using namespace std;

ll ans = 0;

int main(void){
	string s, t; cin >> s >> t;
	int a, b; cin >> a >> b;
	string u; cin >> u;
	if(s == u) a--;
	else b--;
	cout << a << " " << b << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.*;

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

        int N = sc.nextInt();
        int[] p = new int[N];
        for (int i = 0; i < N; i++) p[i] = sc.nextInt();

        int[] pSorted = p.clone();
        Arrays.sort(pSorted);

        int cnt = 0;

        for (int i = 0; i < N; i++) {
            if (p[i] != pSorted[i]) {
                cnt++;
            }
        }

        System.out.println(cnt > 2 ? "NO" : "YES");
    }
}

Measured memory_bytes: 22228
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
#define ll long long
#define r register
using namespace std;
inline void rd(int &x)
{
    int f=1;x=0;char s=getchar();
    while(s<'0'||s>'9'){if(s=='-')f=-1;s=getchar();}
    while(s>='0'&&s<='9'){x=x*10+s-'0';s=getchar();}
    x*=f;
}
void pt(int x)
{
	if(x<0)putchar('-'),x=-x;
	if(x>9)pt(x/10);putchar(x%10+48);
}
int main()
{
    int n,m;
    cin>>n>>m;
    if(n%m==0)cout<<0;
    else cout<<1;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <queue>
using namespace std;
typedef long long ll;
const int INF = 1<<30; 
const int MOD = 1e9 + 7;
const int dy[] = {1, 0, -1, 0};
const int dx[] = {0, 1, 0, -1};
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    int A[n + 1];
    for(int i = 0; i < n; i++) cin >> A[i];
    int q;
    cin >> q;
    for(int i = 0; i < q; i++)
    {
        int com, b, e;
        int ans;
        cin >> com >> b >> e;
        if(com == 0)
        {
            ans = INF;
            for(int i = b; i < e; i++) ans = min(A[i], ans);
        }
        else if(com == 1)
        {
            ans = -INF;
            for(int i = b; i < e; i++) ans = max(A[i], ans);
        }
        cout << ans << "\n";
    }
    return 0;
}




Measured memory_bytes: 3220
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double EPS=1e-10;
const int inf=1e8;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
ll nCr(int n,int r){
	return (r==0|| n==r) ? 1 : nCr(n-1,r) + nCr(n-1,r-1);
}
int main(){
	string s;
	cin>>s;
	int in[30]={0};
	rep(i,s.size())in[s[i]-'a']++;
	int sum=0;
	int co=0;
	rep(i,30){
		if(in[i]%2)co++;
		in[i]/=2;
		sum+=in[i];
	}
	if(co>1){
		cout<<0<<endl;
		return 0;
	}
	ll out=1;
	rep(i,30)if(in[i]){
		out*=nCr(sum,min(in[i],sum-in[i]));
		sum-=in[i];
	}
	cout<<out<<endl;
}

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

int main()
{
	int n;
	cin >> n;
	int a = 0, b = 0, cnt = 0;
	bool head = false;
	for(auto i = 0; i < n; ++i){
		string s;
		cin >> s;
		for(auto j = 0; j < (int)s.size() - 1; ++j){
			if(s[j] == 'A' && s[j + 1] == 'B') ++cnt;
		}
		if(s[0] == 'B') ++b;
		if(s[s.size() - 1] == 'A') ++a;
		if(s[0] != 'B' && s[s.size() - 1] == 'A') head = true;
	}
	cout << cnt + max(0, min(a, b - !head)) << endl;
	return 0;
}

Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

public class Hello{
    public static void Main(){
        string[] input = ReadLine().Split(' ');
        long n = long.Parse(input[0]);
        long m = long.Parse(input[1]);

        long tempn = n;
        long tempm = m;
        while(tempn != tempm && tempm%tempn != 0 && tempn%tempm != 0){  //最大公約数を求める
            if(tempn < tempm && tempn != 1 && tempm%tempn != 0){
                tempm %= tempn;
            }
            if(tempm < tempn && tempm != 1 && tempn%tempm != 0){
                tempn %= tempm;
            }
//            WriteLine("{0} {1}",tempn,tempm);
        }
        
        long kouyaku = Min(tempn,tempm);
        long koubai = n*m/kouyaku;
//        WriteLine(koubai);
        
        int count = 0;
        string mojin = ReadLine();
        string mojim = ReadLine();
        int lengn = mojin.Length;
        for(int i=0;i<lengn;i++){
            long mojim_n = i * m;
            if(mojim_n % n == 0){
                long tempo = mojim_n / n;
                int tem = (int)tempo;
                if(mojin[i] != mojim[tem]){
                    count++;
                }
            }
        }
        
        if(count == 0){
            WriteLine(koubai);
        }else{
            WriteLine("-1");
        }
    }
}

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

int main() {
	int n;
	cin >> n;
	int b[n-1];
	for(int i=0;i<n-1;i++){
		cin >> b[i];
	}
	
	int sum = b[0];
	
	for(int i=0;i<n-2;i++){
		sum += min(b[i],b[i+1]);
	}
	
	sum += b[n-2];
	
	cout << sum << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
int main(void){
    int a,b,c,x,y,z;
    std::cin>>a>>b>>c;
    if(a>=b){
        x=a;
        a=b;
        b=x;
    }
    if(b>=c){
        y=b;
        b=c;
        c=y;
    }
    if(a>=b){
        z=a;
        a=b;
        b=z;
    }
    std::cout<<a<<" "<<b<<" "<<c<<std::endl;
    return 0;
}



Measured memory_bytes: 3108
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <cstring>
#include <deque>
#include <fstream>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
using ll = long long;
#define fst first
#define snd second

/* clang-format off */
template <class T, size_t D> struct _vec { using type = vector<typename _vec<T, D - 1>::type>; };
template <class T> struct _vec<T, 0> { using type = T; };
template <class T, size_t D> using vec = typename _vec<T, D>::type;
template <class T> vector<T> make_v(size_t size, const T& init) { return vector<T>(size, init); }
template <class... Ts> auto make_v(size_t size, Ts... rest) { return vector<decltype(make_v(rest...))>(size, make_v(rest...)); }
template <class T> inline void chmin(T &a, const T& b) { if (b < a) a = b; }
template <class T> inline void chmax(T &a, const T& b) { if (b > a) a = b; }
/* clang-format on */

int main() {
#ifdef DEBUG
  ifstream ifs("in.txt");
  cin.rdbuf(ifs.rdbuf());
#endif
  ll A, B;
  while (cin >> A >> B) {
    if (A > B) swap(A, B);
    if ((B - A) % 2 == 1) {
      cout << "IMPOSSIBLE" << endl;
    } else {
      cout << (B - A) / 2 + A << endl;
    }
  }
  return 0;
}


Measured memory_bytes: 256
#coding:utf-8

X,K,D = map(int,input().split())

X = abs(X)

ans = 0
kan = X // D

if kan > K:
    ans = abs(X - K * D)
else:
    rest = K - kan
    if rest % 2 == 0:
        ans = abs(X - kan * D)
    else:
        ans = abs(X - (kan + 1) * D)

print("{}".format(ans))

Measured memory_bytes: 9188
n=int(input())
s=[]
for i in range(n):
  s.append(input())
print('AC x ' + str(s.count('AC')))
print('WA x ' + str(s.count('WA')))
print('TLE x ' + str(s.count('TLE')))
print('RE x ' + str(s.count('RE')))

Measured memory_bytes: 16188
<?php
$numbers = fgets(STDIN);
$w = intval($numbers);
$numbers = fgets(STDIN);
$n = intval($numbers);

$line = [];
for ($i=0; $i < $n; $i++) {
    $numbers = preg_split("/[\s,]+/", rtrim(fgets(STDIN)));
    $x = intval($numbers[0]);
    $y = intval($numbers[1]);
    $line[] = [$x, $y];
}

for ($i=1; $i <= $w; $i++) { 
    $num = $i;
    for ($j= $n -1; $j >= 0; $j--) {
        if($num == $line[$j][0]){
            $num = $line[$j][1];
        } else if(($num == $line[$j][1])){
            $num = $line[$j][0];
        }
    }
    print $num;
    print PHP_EOL;
}


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

int main(){
int a;
cin >> a;
int L=a/100;
int R=a%100;
if(1<=L&&L<=12){
if(1<=R&&R<=12)cout<<("AMBIGUOUS\n");
else cout <<("MMYY\n");
}else{
if(1<=R&&R<=12)cout<<("YYMM\n");
else cout<<("NA\n");
}
}


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

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

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

#define CHMIN(a, b) (a) = min((a), (b))
#define CHMAX(a, b) (a) = max((a), (b))

#define DEBUG(x) cout << #x << ": " << (x) << endl
#define PRINT(x) cout << x << endl
#define all(x) x.begin(),x.end()


int main() {
    int N,K;
    cin >> N >> K;
    string s;
    cin >> s;

    int series = 0;
    char c = s[0];
    int sw = 0;

    vi V;

    V.push_back(0);

    REP(i,N){ //累積和
        if(s[i]==c){
            series++;
        }else{
            V.push_back(series);
            c = s[i];
            series++;
        }
        if(i==N-1)V.push_back(series);
    }


    int vsize =V.size();
    int d=1;
    if(s[0]=='1')d=0;
    int m=-1;
    for(int i=0;;i++){ //1と1の間にある0はK個1にできる。
        if(i%2==d)m = max(V[min(i+K*2+1,vsize-1)]-V[i],m); //1から始まる時
        else m = max(V[min(i+K*2,vsize-1)]-V[i],m); 

        // max = V[min(i+2*K-1)]
        if((i+K+1)>=vsize-1) break;
    }

    cout << m << endl;


}



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

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

ll lcm(ll a,ll b){
    ll g=gcd(a,b);
    return a/g*b;
}

int main(){
    ll n;
    cin>>n;
    vector<ll>t(n);
    rep(i,n)cin>>t[i];
    sort(t.begin(),t.end());
    ll ans=1;
    rep(i,n){
       ans=lcm(ans,t[i]);
        
    }
    printf("%lld",ans);
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin >> n;
	int m;
	cin >> m;
	int sum = 0, x;
	for(int i=0;i<m;i++)
	{
		cin >> x;
		sum += x;
	}
	if(n-sum>=0)
		cout << n-sum << endl;
	else
		cout << -1 << endl;
	return 0;
}

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

int main(){
    int a,b;
    while(1){
        cin >> a >>b;
        if(a==0 && b==0) break;
        for(int i=1; i<=a; i++){
            for(int j=1; j<=b; j++){
                if((i+j)%2==0)
                    cout << "#";
                else
                    cout << ".";
            }   
            cout << endl;
        }
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 3128
N,K = map(int,input().split())
	
from decimal import Decimal
from decimal import *

getcontext().prec = 12


list_prob = []
for n in range(1,N+1):
  prob = Decimal("1.0")
  while n <= K-1:
    n *= 2
    prob = prob * Decimal('0.5')
    
  list_prob.append(prob)

sum_list = Decimal(str(sum(list_prob)))
len_list = Decimal(str(len(list_prob)))

ave = sum_list / len_list
print(ave)

Measured memory_bytes: 18832
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <sstream>
#include <unordered_map>
#include <vector>


#define INF 4000000000000000000LL
#define MOD 1000000007
#define ALL(x) std::begin(x), std::end(x)


int main(int argc, char** argv)
{
  std::cin.tie(0);
  std::ios_base::sync_with_stdio(0);

  std::cout << std::fixed << std::setprecision(6);
  std::cerr << std::fixed << std::setprecision(6);

  int N, V[22], C[22], ap = 0;

  std::cin >> N;

  for (int i = 0; i < N; i ++)
    std::cin >> V[i];
  
  for (int i = 0; i < N; i ++)
    std::cin >> C[i];

  for (int i = 0, size = 1 << N; i < size; i ++) {
    int X = 0, Y = 0;
    
    for (int j = 0; j < N; j ++)
      if (i & (1 << j)) {
        X += V[j];
        Y += C[j];
      }

    ap = std::max(ap, X - Y);
  }

  std::cout << ap << std::endl;
  
  return 0;
}


Measured memory_bytes: 256
class Main{
	public static void main(String[] a)throws Exception{
		for(java.lang.reflect.Method m:new java.lang.reflect.Method[]{
				java.io.PrintStream.class.getMethod("println",String.class)
		}){
			for(int i:new int[]{1}) {
				for(int x:new int[9]){
					for(int j : new int[]{1}){
						for(int y:new int[9]){
							if(m.invoke(System.out,""+i+"x"+j+"="+i*j)==null){}
							if(++j==0){}
						}
					}
					if(++i==0){}
				}
			}
		}
	}
}

Measured memory_bytes: 16872
import java.util.Scanner;

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

		// 入力値の取得
		int X = sc.nextInt();
		int Y = sc.nextInt();
		
		// 結果の出力
		if (Y % 2 == 1 || X * 4 < Y || X * 2 > Y) {
			System.out.println("No");
		}
		else {
			System.out.println("Yes");
		}

		sc.close();
	}
}


Measured memory_bytes: 27072
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <climits>
using namespace std;
#define MOD int(1e9 + 7)
#define INF (long long)(1e18)

int main()
{
    cout.precision(18);

    string S, T;
    cin >> S;
    cin >> T;

    bool f = false;
    for(long long i = 0; i < S.size(); i++){
        if(S[i] != T[i])
            f = true;
    }

    if(f)
        cout << "No" << endl;
    else
        cout << "Yes" << endl;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ub upper_bound
#define int long long
#define vbe(sdk) sdk.begin(), sdk.end()
#define pb push_back
#define loop(i, a, b) for (int i = a; i < b; ++i)
#define rloop(i, a, b) for (int i = a; i >= b; --i)
#define mp make_pair
#define mod 1000000007
#define endl '\n'
#define vvll vector<vector<int>>
#define vll vector<int>
#define mint map<int, int>
#define sz(x) (int)x.size()
#define sll set<int>
#define pll pair<int, int>
#define F first
#define S second
#define pi 3.14159265358979323846
using namespace std;

void solve()
{
    string a;
    cin>>a;
    int cnt=0;
    if(a[0]=='R')
    cnt=1;
    if(a[0]==a[1] && a[1]=='R')
    {
      cnt+=1;
    }
    else if(a[1]=='R')
    {
      cnt=1;
    }
    
    if(a[1]==a[2] && a[2]=='R')
    {
      cnt+=1;
    }
    else if(a[2]=='R')
    {
      cnt=1;
    }
    cout<<cnt<<"\n";
}
signed main()
{
   ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
  int t=1;
//   cin>>t;
  while(t--)
  {
    solve();
  }

  return 0;
}


Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a,b,c;
  cin >> a >> b >> c;
  int d=(a+b+c)/2;
  if ((a+b+c)%2==0){
    if (d==a||d==b||d==c){
      cout << "Yes" << endl;
    }
    else {
      cout << "No" << endl;
    }
  }
  else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
h,w,k = map(int,input().split())
c = [list(input()) for _ in range(h)]
ans = 0
for i in range(1 << h):
    for j in range(1 << w):
        cnt = 0
        for l in range(h):
            for m in range(w):
                if (i >> l) & 1 == 0 and (j >> m) & 1 == 0: #塗りつぶされていなければTrue
                    if c[l][m] == "#": #Trueかつ'#'であればカウント
                        cnt += 1
        if cnt == k:
            ans += 1
print(ans)

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

int main(){
    int a,b,c,x;
    cin >> a >> b >> c >> x;
    int cnt=0;
    for(int i=0;i<=a;i++){
        for(int j=0;j<=b;j++){
            for(int k=0;k<=c;k++){
                if(i*500+j*100+k*50==x){
                    cnt++;
                }
            }
        }
    }
    cout << cnt << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cmath>
# define PI acos(-1)
using namespace std;
int main()
{
    int a,b;
    char op;
    while (cin>>a>>op>>b && op !='?')
    {
        switch (op)
        {
        case '+':
            cout<<a+b<<endl;
            break;
        case '-':
            cout<<a-b<<endl;
            break;
        case '*':
            cout<<a*b<<endl;
            break;
        case '/':
            cout<<a/b<<endl;
            break;
        default:
            break;
        }
    }
    return 0;
}


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

int main() {

	string s;
	cin >> s;

	int sum = 0;
	int len = s.size();
	for (int i = 0; i < len; i++) {
		int x = s[i] - '0';
		sum += x;
	}

	if (stoi(s) % sum == 0) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,x,y) for (int i=(x);i<=(y);i++)
#define ll long long
using namespace std;
const int N=4100,mod=924844033;
int n,m,K,b[N],f[N][N][2],vis[N],g[N],ans,fac[N];
int main(){
	scanf("%d%d",&n,&K); fac[0]=1;
	rep (i,1,n){
		if (!vis[i]){
			for (int j=i;j<=n;j+=K) ++m;
			b[m]=1;
			for (int j=i;j<=n;j+=K) ++m,vis[j]=1;
			b[m]=1;
		}
		fac[i]=(ll)fac[i-1]*i%mod;
	}
	f[1][0][0]=1;
	rep (i,2,m)
		rep (j,0,n){
			f[i][j][0]=(f[i-1][j][0]+f[i-1][j][1])%mod;
			if (!b[i-1]&&j) f[i][j][1]=f[i-1][j-1][0];
		}
	for (int i=0,op=1;i<=n;i++,op=-op){
		g[i]=(f[m][i][0]+f[m][i][1])%mod;
		ans=(ans+(ll)g[i]*fac[n-i]%mod*op+mod)%mod;
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 128512