akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define fi first
#define se second
#define pb push_back
#define sz(x) ((int)(x).size())
#define all(x) x.begin(),x.end()
#define dmp(x) cerr<<#x<<":"<<x<<endl
typedef pair<int,int> P;
typedef pair<int,P> PP; 
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
const int MOD = 1e9+7;

struct Dice{
  
  int t,s,e,w,n,b;
  
  Dice(int n1,int n2,int n3,int n4,int n5,int n6){
    t=n1;//top
    s=n2;//south
    e=n3;//east
    w=n4;//west
    n=n5;//north
    b=n6;//bottom
  }
  
  void roll(char direction){
    if(direction=='S'){
	 int tmp=s;
	 s=t,t=n,n=b,b=tmp;
    }
    if(direction=='N'){
	 int tmp=n;
	 n=t,t=s,s=b,b=tmp;
    }
    if(direction=='E'){
	 int tmp=e;
	 e=t,t=w,w=b,b=tmp;
    }
    if(direction=='W'){
	 int tmp=w;
	 w=t,t=e,e=b,b=tmp;
    }
  }

  int get(char direction){
    if(direction=='T')return t;
    if(direction=='S')return s;
    if(direction=='E')return e;
    if(direction=='W')return w;
    if(direction=='N')return n;
    if(direction=='B')return b;
  }

  bool match(Dice d){
    if(t!=d.get('T'))return false;
    if(s!=d.get('S'))return false;
    if(e!=d.get('E'))return false;
    if(w!=d.get('W'))return false;
    if(n!=d.get('N'))return false;
    if(b!=d.get('B'))return false;
    return true;
  }

  bool equal(Dice d){
    for(int i=0;i<8;i++){
	 if(i==4)d.roll('E');
	 for(int j=0;j<4;j++){
	   if(this->match(d))return true;
	   d.roll('E');
	 }
	 d.roll('S');
    }
    return false;
  }
};

signed main(){
  int n1,n2,n3,n4,n5,n6;
  cin>>n1>>n2>>n3>>n4>>n5>>n6;
  Dice dice1(n1,n2,n3,n4,n5,n6);
  cin>>n1>>n2>>n3>>n4>>n5>>n6;
  Dice dice2(n1,n2,n3,n4,n5,n6);
  if(dice1.equal(dice2))cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  return 0;
}



Measured memory_bytes: 3116
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    long n = sc.nextLong();
    long ans = 0;
    for(long i = 1; i * i <= n; i++) {
      if((n % i) == 0) {
        long x = i;
        long m = (n / i) - 1;
        if(x < m) ans += m;
        x = (n / i);
        m = i - 1;
        if(x < m) ans += m;
      }
    }
    System.out.println(ans);
  }
}

Measured memory_bytes: 21972
from itertools import combinations_with_replacement

K = int(input())
k_range = list(range(1, K+1))

result = 0
for comb in combinations_with_replacement(k_range, 3):
    min_abc = min(comb)
    for i in range(min_abc, 0, -1):
        if (comb[0]%i == 0 and comb[1]%i == 0) and comb[2]%i == 0:
            if comb[0]==comb[1] and comb[1]==comb[2]:
                coef = 1
            elif (comb[0]!=comb[1] and comb[1]!=comb[2]) and comb[2]!=comb[0]:
                coef = 6
            else:
                coef = 3
            result += i * coef
            break
print(result)

Measured memory_bytes: 74780
#include<bits/stdc++.h>
using namespace std;
int rec(string &a,string &b,int m,int n,vector<vector<int>>&dp)
{
    
    if(dp[m][n]>=0)
    return dp[m][n];
    if(a[m-1]==b[n-1])
    {   
        dp[m][n]=1+rec(a,b,m-1,n-1,dp );return dp[m][n];
    }else
    {                                                           
        dp[m][n]=max(rec(a,b,m-1,n,dp),rec(a,b,m,n-1,dp)); 
        return dp[m][n];     
    }
    
}
void p(string &a,string &b,int m,int n,vector<vector<int>>&dp,vector<char> &jp)
{   
    if(m==0||n==0)return;
    if(a[m-1]==b[n-1])
    { jp.push_back(a[m-1]);
         p(a,b,m-1,n-1,dp,jp);
    }
    else if(dp[m][n]==dp[m-1][n])
    {
        p(a,b,m-1,n,dp,jp);
    }else
    {
         p(a,b,m,n-1,dp,jp);
    }
}
int main()
{
    string a,b;
    cin>>a>>b;
    int m=a.length(),n=b.length();
    vector<vector<int> > dp( m+1 , vector<int> (n+1, -1)); 
    for(int i=0;i<=n;i++)
    {
        dp[0][i]=0;
    }
    for(int i=0;i<=m;i++)
        dp[i][0]=0;
    int k=rec(a,b,m,n,dp);
    //cout<<k<<endl;
    vector<char>jp;
    p(a,b,m,n,dp,jp);
    for(auto it=jp.rbegin();it!=jp.rend();++it)
    {
        cout<<*it;
    }
    /* for(int i=0;i<=m;i++)
     {
         for(int j=0;j<=n;j++)
    {
        cout<<dp[i][j]<<" ";
    }cout<<"\n";
     }*/

}

Measured memory_bytes: 36096
while True:
    m, f, r = map(int, input().split())
    if m == -1 and f== -1 and r == -1:
        break
    mf = m + f
    if  m == -1 or f == -1 or mf < 30:
       print('F')
    elif mf < 50:
        if r < 50:
            print('D')
        else:
            print('C')
    elif mf < 65:
        print('C')
    elif mf < 80:
        print('B')
    else:
        print('A')

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

int main() {
  int n;
  cin >>n;
  vector<int> a(n);
  for(int i=0;i<n;i++){
    cin >> a.at(i);
  }
  bool ans =true;
  for(int j=0;j<n;j++){
    if(a.at(j)%2 ==0){
     if((a.at(j)%3!=0) && (a.at(j)%5!=0)){
       ans =false;
       break;
     }
    }
  }
    if(ans){
      cout <<"APPROVED" <<endl;
    }
    else cout <<"DENIED" <<endl;
}

Measured memory_bytes: 256
#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;

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

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

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

// mod
const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

// floating
typedef double Real;
const Real EPS = 1e-11;
#define EQ0(x) (abs(x)<EPS)
#define EQ(a,b) (abs(a-b)<EPS)
typedef complex<Real> P;

int n;
ll a[125252];
ll sum[125252];

int main(){
  scanf("%d",&n);
  REP(i,n)scanf("%lld",a+i);
  sort(a,a+n);
  sum[0] = 0;
  REP(i,n)sum[i+1] = sum[i]+a[i];
  int ans = 0;
  REP(x,n){
    ll size = sum[x+1];
    int it = x;
    while(it < n-1){
      int yo = upper_bound(a,a+n,2*size)-a-1;
      if(yo==it)break;
      it = yo;
      size = sum[yo+1];
    }
    if(it==n-1)ans++;
  }
  printf("%d\n",ans);
  return 0;
}


Measured memory_bytes: 1792
#include<stdio.h>
#include<string.h>
 
int main() {
  char getstr[20], putstr[20];
  int strlength;
  scanf("%s",getstr);

  strlength=strlen(getstr);

  for(int i=0;i<=strlength;i++){
    if(i==strlength) putstr[i]=getstr[i];
    else  putstr[strlength-i-1]=getstr[i];
  }

  printf("%s\n", putstr);
  return 0;
}


Measured memory_bytes: 2044
#include <iostream>
#include <string>
#include <algorithm>
#include <cassert>
#include <limits>
#include <numeric>
#include <type_traits>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <functional>
#include <utility>
#include <sstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <complex>

using namespace std;

typedef long long ll;
typedef vector<ll> vl;
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define REP(i,n)  FOR(i,0,n)
unsigned GetDigit(unsigned num){
    unsigned digit=0;
    while(num!=0){
        num /= 10;
        digit++;
    }
    return digit;
}
int main(){
	ll N;
	ll ans = 0;
	cin >> N;
	for(ll i = 1; i < N + 1; i++){
		if(GetDigit(i) % 2 == 1){
			ans++;
		}
	}
	cout << ans << endl;
}


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

template<typename M>
struct PersistentSegmentTree {
    struct Node {
        Node *l, *r;
        M data;
        Node() : l(nullptr), r(nullptr) {}
    };

    const function<M(M,M)> f;
    const M e;
    const int sz;

    PersistentSegmentTree(const function<M(M,M)>& f, const M& e, int sz) :
            f(f), e(e), sz(sz) {}

    Node* _new(const M& data) const {
        auto t = new Node();
        t->data = data;
        return t;
    }

    Node* _new(Node* l, Node* r) const {
        auto t = new Node();
        t->l = l, t->r = r, t->data = f(l->data, r->data);
        return t;
    }

    Node* _build(int l, int r) const {
        assert(l < r);
        if (l+1 == r) return _new(e);
        return _new(_build(l, (l+r)>>1), _build((l+r)>>1, r));
    }

    Node* build() const {
        return _build(0, sz);
    }

    template<typename UpdateQuery>
    Node* _update(Node* t, const UpdateQuery& q, int pos, int l, int r) const {
        if (pos == l and pos+1 == r) return _new(q(t->data));
        if (r <= pos or pos < l) return t;
        return _new(_update(t->l, q, pos, l, (l+r)>>1),
                    _update(t->r, q, pos, (l+r)>>1, r));
    }

    template<typename UpdateQuery>
    Node* update(Node* root, const UpdateQuery& q, int pos) const {
        return _update(root, q, pos, 0, sz);
    }

    M _query(Node* t, int a, int b, int l, int r) const {
        if (r <= a or b <= l) return e;
        if (a <= l and r <= b) return t->data;
        return f(_query(t->l, a, b, l, (l+r)>>1),
                 _query(t->r, a, b, (l+r)>>1, r));
    }

    M query(Node* root, int a, int b) const {
        // return f[a,b)
        return _query(root, a, b, 0, sz);
    }

};


int main() {
    int N; cin >> N;
    vector<int> a(N);
    map<int,int> comp;
    for (int i = 0; i < N; ++i) {
        cin >> a[i];
        comp[a[i]] = -1;
    }
    int cnt = 0;
    for (auto &tp : comp) tp.second = cnt++;

    vector<vector<int>> G(N);
    for (int i = 0; i < N-1; ++i) {
        int u, v; cin >> u >> v; --u, --v;
        G[u].push_back(v);
        G[v].push_back(u);
    }

    PersistentSegmentTree<int> segt(
            [](int a,int b){ return max(a,b); },
            0, comp.size());

    map<int,PersistentSegmentTree<int>::Node*> root;
    root[-1] = segt.build();

    vector<int> ans(N);

    function<void(int,int)> dfs = [&](int v, int p) {
        int ma = segt.query(root[p], 0, comp[a[v]]);
        root[v] = segt.update(root[p], [&](int x){return max(ma+1, x);}, comp[a[v]]);
        ans[v] = segt.query(root[v], 0, comp.size());

        for (int u : G[v]) {
            if (u == p) continue;
            dfs(u, v);
        }
    };

    dfs(0, -1);

    for (int v : ans) {
        cout << v << endl;
    }

    return 0;
}


Measured memory_bytes: 235876
import java.util.*;

public class Main {
    public static void main(String args[]) {
     
    Scanner sc = new Scanner(System.in);
    
    String s = sc.nextLine();
    if(util(s))
    System.out.println("Yes");
    else
    System.out.println("No");

        
    }
    static boolean util(String s){
        
        
        if( s.charAt(2)==s.charAt(3) &&s.charAt(4)==s.charAt(5))
        return true;
        else
        return false;
    }
}


Measured memory_bytes: 22996
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <complex>
using namespace std;
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define mp make_pair
#define ERASE(v,i) (v).erase(remove(all(v),i),(v).end())
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define each(it,c) for(typeof((c).begin()) it=(c).begin();it!=(c).end();++it)
#define debug(x) cerr<<#x<<" = "<<(x)<<endl;
#define LINE cerr<<"LINE: "<<__LINE__<<endl;
inline int toInt(string s){int v;istringstream i(s);i>>v;return v;}
template<class T> inline string toString(T x){ostringstream o;o<<x;return o.str();}
template<class T> void pv(T a,T b){for(T it=a;it!=b;++it)cerr<<*it<<" ";cerr<<endl;}
const int INF = 1000000000;
const double PI = acos(-1.0), EPS = 1e-10;

int size_list[] = {60, 80, 100, 120, 140, 160};
int size_weight[] = {2, 5, 10, 15, 20, 25};
int cost[] = {600, 800, 1000, 1200, 1400, 1600};

int main() {
	for(int N; scanf("%d", &N), N;) {
		long long sum = 0;

		for(int i = 0; i < N; i++) {
			int x, y, h, w;
			scanf("%d%d%d%d", &x, &y, &h, &w);

			int size = x + y + h;
			int index_size = lower_bound(size_list, size_list + 6, size) - size_list;
			int index_weight = lower_bound(size_weight, size_weight + 6, w) - size_weight;
			int index = max(index_size, index_weight);
			if(index < 6) sum += cost[index];
		}

		printf("%lld\n", sum);
	}
	return 0;
}

Measured memory_bytes: 0
using System;using System.Linq;
class A{static void Main(){
int[]n=Console.ReadLine().Split().Select(int.Parse).ToArray();
int n1=int.Parse(Console.ReadLine());
int ans=0;
for(int i=0;i<n1;i++){
int []s=Console.ReadLine().Split().Select(int.Parse).ToArray();
	if(s[1]<=n[0]||s[0]>=n[1]){ans++;}

}	Console.WriteLine(n1==ans?0:1);


































	
}}













Measured memory_bytes: 9640
program test
implicit none

integer(8) :: i,j,a,b,c,ans

read(*,*) a,b,c

ans = min(c,b/a)
write(*,*) ans

























contains
subroutine heapsort_down(n,y1,y2)
 
	implicit none
	integer(8),intent(in) :: n
	integer(8),intent(inout) :: y1(1:n)
	integer(8),intent(inout) :: y2(1:n)
	integer(8) :: i,k,j,l
	integer(8) :: t1,t2
	
	l = n/2+1
	k = n
 
	do while (k /= 1)
		 if(l > 1) then
				l = l-1
				t1 = y1(l)
				t2 = y2(l)
				
		 else
				t1 = y1(k)
				t2 = y2(k)
				y1(k) = y1(1)
				y2(k) = y2(1)
				k = k-1
				if(k == 1) then
					 y1(1) = t1
					 y2(1) = t2
					 exit
				endif
		 endif
 
		 i = l
		 j = l+l
 
		 do while(j <= k)
				if(j < k) then
					 if(y1(j) > y1(j+1)) j = j+1
				endif
				
				if (t1 > y1(j)) then
					 y1(i) = y1(j)
					 y2(i) = y2(j)
					 i = j
					 j = j+j
				else
					 j = k+1
				endif
		 
		 enddo
		 
		 y1(i) = t1
		 y2(i) = t2
	
	enddo
	return
 
end subroutine heapsort_down
 
subroutine heapsort_up(n,y1,y2)
 
	implicit none
	integer(8),intent(in) :: n
	integer(8),intent(inout) :: y1(1:n)
	integer(8),intent(inout) :: y2(1:n)
	integer(8) :: i,k,j,l
	integer(8) :: t1,t2
	
	l = n/2+1
	k = n
 
	do while (k /= 1)
		 if(l > 1) then
				l = l-1
				t1 = y1(l)
				t2 = y2(l)
				
		 else
				t1 = y1(k)
				t2 = y2(k)
				y1(k) = y1(1)
				y2(k) = y2(1)
				k = k-1
				if(k == 1) then
					 y1(1) = t1
					 y2(1) = t2
					 exit
				endif
		 endif
 
		 i = l
		 j = l+l
 
		 do while(j <= k)
				if(j < k) then
					 if(y1(j) < y1(j+1)) j = j+1
				endif
				
				if (t1 < y1(j)) then
					 y1(i) = y1(j)
					 y2(i) = y2(j)
					 i = j
					 j = j+j
				else
					 j = k+1
				endif
		 
		 enddo
		 
		 y1(i) = t1
		 y2(i) = t2
	
	enddo
	return
 
end subroutine heapsort_up
 
end program

Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdint>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <utility>
#include <vector>

using namespace std;
using ll = long long;

#define EPS (1e-7)

int main() {
  ll N;
  cin >> N;
  vector<ll> P(N);
  for (ll i = 0; i < N; i++) {
    cin >> P[i];
  }
  ll count = 0;
  for (ll i = 1; i < N - 1; i++) {
    vector<ll> temp{P[i - 1], P[i], P[i + 1]};
    sort(begin(temp), end(temp));
    if (P[i] == temp[1]) {
      count++;
    }
  }

  cout << count << endl;
  return 0;
}


Measured memory_bytes: 256
using System;

namespace ABC104A
{
    class Program
    {
        static void Main(string[] args)
        {
            int a = int.Parse(Console.ReadLine());
            if (a < 1200)
                Console.WriteLine("ABC");
            else if (a >= 1200 && a < 2800)
                Console.WriteLine("ARC");
            else
                Console.WriteLine("AGC");
            Console.ReadKey();
        }
    }
}


Measured memory_bytes: 11092
#include<stdio.h>

#define fr -2
#define n_fr -1
#define N 8

int row[N],col[N],dpos[2*N-1],dneg[2*N-1],k,r,c,Q[N][N];

void print(void){
  int i,j;
  for(i=0;i<N;i++){
    for(j=0;j<N;j++){
      if((Q[i][j]==n_fr)&&(row[i]!=j))
        return ;
    }
  }

  for(i=0;i<N;i++){
    for(j=0;j<N;j++){
      if(row[i]==j)
      printf("Q");
      else
      printf(".");
    }
    printf("\n");
  }

}

void recursive(int i){
  int j;

  if(i==N){
    print();
    return;
  }

  for(j=0;j<N;j++){
    if((col[j]==n_fr)||(dpos[i+j]==n_fr)||(dneg[i-j+N-1]==n_fr))
    continue;
    row[i]=j;col[j]=dpos[i+j]=dneg[i-j+N-1]=n_fr;

    recursive(i+1);

    row[i]=col[j]=dpos[i+j]=dneg[i-j+N-1]=fr;
  }
}

int main(){
  int i,j;

  for(i=0;i<N;i++){
    row[i]=col[i]=fr;
    for(j=0;j<N;j++){
      Q[i][j]=fr;
    }
  }
  for(i=0;i<2*N-1;i++){dpos[i]=dneg[i]=fr;}

  scanf("%d",&k);

  for(i=0;i<k;i++){
    scanf("%d %d",&r ,&c);
    Q[r][c]=n_fr;
  }

  recursive(0);

  return 0;
}



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

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

    int64_t ans = 0;

    //N = (a * K + 1) * K ^ b (a >= 0, b >= 0)の形なら最終的に1になる
    //(1)b = 0のとき
    //N = a * K + 1
    //つまりN - 1の約数の個数
    for (int64_t i = 1; i * i <= N - 1; i++) {
        if ((N - 1) % i != 0) {
            continue;
        }

        //K = i
        if (i != 1) {
            ans++;
        }

        //K = (N - 1) / i
        if ((N - 1) / i != i) {
            ans++;
        }
    }

    //(2)b = 1のとき
    //N = (a * K + 1) * K
    auto ok1 = [&](int64_t K) {
        if (K == 1 || N % K != 0) {
            return false;
        }
        return (N / K - 1) % K == 0;
    };

    for (int64_t i = 1; i * i <= N; i++) {
        if (N % i != 0) {
            continue;
        }

        if (ok1(i)) {
            ans++;
        }
        if (N / i != i && ok1(N / i)) {
            ans++;
        }
    }

    //(2)b >= 2のとき
    //Kの2乗で増えていくので全探索できる
    for (int64_t b = 2; pow(2, b) <= N; b++) {
        for (int64_t K = 2; ; K++) {
            int64_t K_pow_b = pow(K, b);
            if (K_pow_b > N) {
                break;
            }
            if (N % K_pow_b == 0 && (N / K_pow_b - 1) % K == 0) {
                ans++;
            }
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 384
#include <stdio.h>
#define ABMAX 16
int main(void)
{
  int a, b, n, x, y;
  while (scanf("%d %d", &a, &b), a) {
    int map[ABMAX][ABMAX] = {0}, mcase[ABMAX][ABMAX] = {0};
    scanf("%d", &n);
    while (n--) {
      scanf("%d %d", &x, &y);
      map[x-1][y-1] = 1;
    }
    for (x = 0; x < a; x++) {
      if (map[x][0]) break;
      mcase[x][0] = 1;
    }
    for (y = 0; y < b; y++) {
      if (map[0][y]) break;
      mcase[0][y] = 1;
    }
    for (x = 1; x < a; x++) {
      for (y = 1; y < b; y++) {
	if (!map[x-1][y]) mcase[x][y] += mcase[x-1][y];
	if (!map[x][y-1])mcase[x][y] += mcase[x][y-1];
      }
    }
    printf("%d\n", mcase[a-1][b-1]);
  }
}


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

typedef long long ll;
typedef long long LL;
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;

#ifdef DEBUG
    #define cek(x) cout<<x
#else
    #define cek(x) if(false){}
#endif // DEBUG

#define fi first
#define se second
#define INF 1000000000
#define INFLL 1000000000000000000LL
#define EPS 1e-9
#define PI acos(-1.0)
#define pb push_back
#define TC() while(tc--)
#define FOR(i,n) for(int i=0;i<n;i++)
#define FORN(i,n) for(int i=0;i<=n;i++)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define REPN(i,a,b) for(int i=a;i<=b;i++)
#define reset(a,b) memset(a,b,sizeof(a))
#define ALL(v) v.begin(), v.end()
#define SORT(v) sort(ALL(v))
#define SORTA(v,n) sort(v, v + n)
#define SZ(v) (int) v.size()
#define sc(x) scanf("%d",&x)

void open(){
	freopen("D:/Code/in.txt","r",stdin);
	freopen("D:/Code/out.txt", "w", stdout);
}

int n,k;
int arr[5020];
	
bool valid(int idx){
	if(arr[idx] >= k)return true;

	int memo[5020];
	reset(memo, 0);
	memo[0] = 1;	
	FOR(j,n){
		if(idx == j)continue;
		for(int l = k-1;l>=0;l--){
			if(!memo[l])continue;
			if(l + arr[j] <= k)memo[l+arr[j]] = memo[l];
		}
	}

	for(int j = k-arr[idx];j<k;j++){
		if(memo[j])return true;
	}

	return false;
}

int main(void){
	sc(n);sc(k);
	FOR(i,n)sc(arr[i]);
	sort(arr, arr + n);

	int lo = 0;
	int hi = n-1;
	while(lo < hi){
		int mid = lo + (hi - lo + 1)/2;
		if(valid(mid)){
			hi = mid - 1;
		}else{
			lo = mid;
		}
	}
	if(lo > 0)
		cout << (lo+1) << endl;
	else if(valid(lo)){
		cout << 0 << endl;
	}else cout << 1 << endl;
    return 0;

}




Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr int IINF = INT_MAX;

int main() {
    int n, m;
    vector<int> a;
    while(cin >> n >> m, n){
        int sum[2]{};
        a.resize(n+m);
        for(int i=0;i<n+m;i++){
            cin >> a[i];
            if(i<n) sum[0] += a[i];
            else sum[1] += a[i];
        }
        int x=IINF/3, y=IINF/3;
        for(int i=0;i<n;i++){
            for(int j=0;j<m;j++){
                if(sum[0]-a[i]+a[n+j] == sum[1]+a[i]-a[n+j]){
                    if(x+y > a[i]+a[n+j]){
                        x = a[i];
                        y = a[n+j];
                    }
                }
            }
        }
        if(x < IINF/3){
            cout << x << " " << y << endl;
        }
        else{
            cout << -1 << endl;
        }
    }
    return 0;
}



Measured memory_bytes: 3024
import sys
sys.setrecursionlimit(4100000)

import logging
import math

logging.basicConfig(level=logging.DEBUG)

logger = logging.getLogger(__name__)


def resolve():
    a, b, x = [float(x) for x in sys.stdin.readline().split()]

    logger.debug([a, b, x])

    y_0 = 2 * x / a**2
    logger.debug(y_0)

    if y_0 >= b:
        if b - x / a**2 == 0:
            print(0)
        else:
            theta = 90 - math.degrees(math.atan(
                (a / 2) * (1 / (b - x / a**2))))
            print(theta)
    else:
        theta = 90 - math.degrees(math.atan(2 * x / (a * (b**2))))
        print(theta)


if __name__ == "__main__":
    resolve()

# AtCoder Unit Test で自動生成できる, 最後のunittest.main は消す
# python -m unittest template/template.py
# pypy3 -m unittest template/template.py
import sys
from io import StringIO
import unittest


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """2 2 4"""
        output = """45.0000000000"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """12 21 10"""
        output = """89.7834636934"""
        self.assertIO(input, output)

    def test_入力例_3(self):
        input = """3 1 8"""
        output = """4.2363947991"""
        self.assertIO(input, output)


Measured memory_bytes: 6504
#include<bits/stdc++.h> 
using namespace std; 
#define ll long long
int n,c,x; 
int d[34][34],t[3][34];
int main(){ 
	scanf("%d%d",&n,&c);
	for(int i=1;i<=c;i++)
		for(int j=1;j<=c;j++)
			scanf("%d",&d[i][j]);
	for(int i=1;i<=n;i++)
		for(int j=1;j<=n;j++){
			scanf("%d",&x);
			t[(i+j)%3][x]++;
		}	
	int minn=1<<30;
	for(int i=1;i<=c;i++){
		for(int j=1;j<=c;j++){					
			if(i==j)continue;
			for(int k=1;k<=c;k++){
				if(i==k||j==k)
					continue;
				int tt=0;
				for(int l=1;l<=c;l++)tt+=d[l][i]*t[0][l];
				for(int l=1;l<=c;l++)tt+=d[l][j]*t[1][l];
				for(int l=1;l<=c;l++)tt+=d[l][k]*t[2][l];
				if(tt<minn)minn=tt;
			}
		}
	} 
	printf("%d\n",minn);
	return 0;
}

Measured memory_bytes: 256
//includes
#include<iostream>
#include<vector>
#include<set>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<string>
#include<stack>
#include<map>
#include<queue>
#include<iomanip>
#include<numeric>
#include<assert.h>
#include<cstring>
#include<unordered_map>
#include<bitset>

//macros and consts
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define all(a) (a).begin(),(a).end()
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define FORE(i,a) for(auto &i : a)
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define accm accumulate
#define Fi first
#define Se second
#define INF 1e9
#define llINF (1LL<<60)
#define mINF -1e9
#define mllINF -(1LL<<60)
#define endl "\n"
#define CONT continue
#define BRK break
#define modulo(n, m) (((n)%(m)+(m))%m)

//shorter types
using namespace std;
using ll = long long;
using vi = std::vector<int>;
using vc = std::vector<char>;
using vll = std::vector<long long>;
using vs = std::vector<string>;
using Mi = map<int,int>;
using Mll = map<ll,ll>;
using UMi = unordered_map<int,int>;
using UMll = unordered_map<ll,ll>;
using Pi = pair<int,int>;
using Pll = pair<ll,ll>;
using vPi = vector<Pi>;
using vPll = vector<Pll>;
using vvi = vector<vector<int>>;
using vvll = vector<vector<ll>>;
using vvc = vector<vector<char>>;
using vvs = vector<vector<string>>;
using pqgi = priority_queue<int,vector<int>,greater<int>>;
using pqsi = priority_queue<int,vector<int>,less<int>>;
using pqgll = priority_queue<int,vector<int>,greater<int>>;
using pssll = priority_queue<int,vector<int>,less<int>>;
template<class T>
using vec = vector<T>;
#define int long long

const int MOD = 1000000007;
struct mint{
	ll x;
	mint(ll x=0) : x((x%MOD + MOD) % MOD){}
	mint& operator += (const mint a){
		if((x += a.x) >= MOD){
			x -= MOD;
		}
		return *this;
	}
	mint& operator -= (const mint a){
		if((x += MOD-a.x) >= MOD){
			x -= MOD;
		}
		return *this;
	}
	mint& operator *= (const mint a){
		(x *= a.x ) %= MOD;
		return *this;
	}
	mint operator + (const mint a) const{
		mint res(*this);
		return res +=a;
	}
	mint operator - (const mint a) const{
		mint res(*this);
		return res -=a;
	}
	mint operator * (const mint a) const{
		mint res(*this);
		return res *=a;
	}
	mint pow(ll t) const{
		if(!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if(t & 1) a *= *this;
		return a;
	}
	mint inv() const{
		return pow(MOD - 2);
	}
	mint& operator /= (const mint a){
		return (*this) *= a.inv();
	}
	mint operator /(const mint a) const{
		mint res(*this);
		return res/=a;
	}
};

int N;
vector<long long> A;
//here begins your code
signed main(){
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  cin >> N;
  A.resize(N);
  for(int i = 0 ; i < N ; i++){
  	cin >> A[i];
  }
  mint ans = 0;
  for(int bit = 0; bit < 60; bit++){
  	int zero = 0LL;
  	int one = 0LL;
  	for(int i = 0; i < N; i++){
  		if(A[i] & (1LL << bit)) one++;
  		else zero++;
  	}
  	ans += mint(one) * mint(zero) * (1LL << bit);
  }
  cout << ans.x << endl;
  //check types
  //do not eb if you resize
  //resize before you access by idx
  return 0;
} 

Measured memory_bytes: 2560
#include<iostream>
#include<vector>
#include<algorithm>
#include<cctype>
#include<utility>
#include<string>
#include<cmath>
#include<cstring>
#include<queue>
#include<map>
#include<queue>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;
typedef long long int ll;
ll dx[4] = {1,0,0,-1};
ll dy[4] = {0,1,-1,0};

#define ARRAY_MAX 205
int mp[ARRAY_MAX][ARRAY_MAX];
int magic[ARRAY_MAX][ARRAY_MAX];
int h,w;

int main(){

    cin >> h >> w;
    REP(i,10){
        REP(j,10){
            cin >> mp[i][j];
        }
    }
    REP(i,h){
        REP(j,w){
            cin >> magic[i][j];
        }
    }

    vector<int> mini(10,INF);//iから1にするのに必要な最小コスト
    vector<int> num(10);
    mini[1] = 0;
    REP(i,10){
        num[i] = i;
    }

    do{
        int power = 0;
        if(num[0] == 1){
            continue;
        }
        REP(i,9){
            power += mp[num[i]][num[i+1]];
            if(num[i+1] == 1){
                break;
            }
        }
        mini[num[0]] = min(mini[num[0]],power);

    }while(next_permutation(num.begin(),num.end()));

    int ans = 0;
    REP(i,h){
        REP(j,w){
            if(magic[i][j] == -1){
                continue;
            }
            ans += mini[magic[i][j]];
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 384
/**
 *  http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_1_B
 */
#include <iostream>

using namespace std;

int
gcd(const int a, const int b)
{
    if (a == b) {
        return a;
    } else if (a > b) {
        return gcd(a - b, b);
    } else {
        return gcd(a, b - a);
    }
}

int
main()
{
    int a, b;
    cin >> a >> b; cin.ignore();

    cout << gcd(a, b) << endl;

    return 0;
}

Measured memory_bytes: 3108
#include <stdio.h>
int main(void){
    int i,N,s[100]={};
    for(scanf("%d",&N),i=0;i<N;i++)
    scanf("%d",&s[N-i-1]);
    for(i=0;i<N;i++)
    printf("%d%s",s[i],i==N-1?"\n":" ");
}

Measured memory_bytes: 1808
//https://codeforces.com/contest/988/problem/A
//BROWNIE TK

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

typedef long long int lli;
typedef unsigned long long int ulli;
typedef long double ldb;

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

#define pb push_back
#define popb pop_back()
#define pf push_front
#define popf pop_front()

#define si size()
#define be begin()
#define en end()
#define all(v) v.be, v.en

#define le length()
#define mp make_pair
#define mt make_tuple
#define acc(v) accumulate(all(v), 0)
#define F first
#define S second

#define pll pair<lli, lli>
#define pii pair<int, int>
#define pil pair<int, lli>

#define forz(i, n) for (int i = 0; i < n; i++)
#define fore(i, m, n) for (int i = m; i <= n; i++)
#define rforz(i, n) for (int i = n - 1; i >= 0; i--)
#define rfore(i, m, n) for (int i = n; i >= m; i--)

#define deci(n) fixed << setprecision(n)
#define high(n) __builtin_popcount(n)
#define highll(n) __builtin_popcountll(n)
#define parity(n) __builtin_parity(n)
#define ctz(n) __builtin_ctz(n)

#define bset(a, p) ((a) | (1ll << (p)))
#define bchk(a, p) ((a) & (1ll << (p)))
#define bxor(a, p) ((a) ^ (1ll << (p)));
#define brem(a, p) (bchk(a, p) ? (bxor(a, p)) : (a))
/*SOME BITMASK KNOWLEDGE
1)x & (x - 1):sets the last one bit of x to zero
power of two exactly when x & (x − 1) = 0.
2)x & -x:sets all the one bits to zero, except last one bit
3)x | (x - 1):inverts all the bits after the last one bit*/

#define lb lower_bound
#define ub upper_bound
#define er equal_range

#define findnot find_first_not_of

#define maxe *max_element
#define mine *min_element

#define mod2 1000000007
#define mod 998244353
#define gcd __gcd
#define kira ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)

#define endl "\n"
#define p0(a) cout << a << " "
#define p1(a) cout << a << endl
#define p2(a, b) cout << a << " " << b << endl
#define p3(a, b, c) cout << a << " " << b << " " << c << endl
#define p4(a, b, c, d) cout << a << " " << b << " " << c << " " << d << endl

#define oset tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define osetlli tree<lli, null_type, less<lli>, rb_tree_tag, tree_order_statistics_node_update>
//member functions :
//1. order_of_key(k) : number of elements sbtriectly lesser than k
//2. find_by_order(k) : k-th element in the set
#define ofk order_of_key
#define fbo find_by_order

/*STD funcions*/
lli power(lli x, lli y, lli p)
{
    lli res = 1;
    x = x % p;
    while (y > 0)
    {
        if (y & 1)
            res = (res * x) % p;
        y = y >> 1;
        x = (x * x) % p;
    }
    return res;
}
lli modi(lli a, lli m) { return power(a, m - 2, m); }
/*CODE BEGINS*/

int main()
{
    kira;
    lli n, k;
    cin >> n >> k;
    n=n%k;
    if (k > n)
        cout << min(k - n, n);
    else
        cout << n % k;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define BIG 1000000010
#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define repn(i,n) for(int i=n;i>=0;i--)
typedef long long int ll;


int main(){
  int a,b,c;
  cin>>a>>b>>c;
  int s[b];
  rep(i,b){
    s[i]=0;
  }
  int i=1;
  while(1){
    if(s[(a*i)%b]) break;
    s[(a*i)%b]=1;
    //cout<<(a*i)%b<<endl;
    i++;
  }
  if(s[c]) cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
  return 0;
}




Measured memory_bytes: 256
H,W = map(int,input().split())

ans = float("inf")

for w in range(1,W-1) :
    #print("yay")
    s1 = H*w
    
    w2 = (W-w)//2
    s2 = H*w2
    s3 = H*(W-(w+w2))
    calc = max([s1,s2,s3]) - min([s1,s2,s3])
    ans = min(ans,calc)
    #print(s1,s2,s3)
    h2 = H//2
    s2 = h2*(W-w)
    s3 = (H-h2)*(W-w)
    calc = max([s1,s2,s3]) - min([s1,s2,s3])
    ans = min(ans,calc)
    #print(s1,s2,s3)

H,W = W,H    

for w in range(1,W-1) :
    #print("wow")
    s1 = H*w
    
    w2 = (W-w)//2
    s2 = H*w2
    s3 = H*(W-(w+w2))
    calc = max([s1,s2,s3]) - min([s1,s2,s3])
    ans = min(ans,calc)
    #print(s1,s2,s3)
    h2 = H//2
    s2 = h2*(W-w)
    s3 = (H-h2)*(W-w)
    calc = max([s1,s2,s3]) - min([s1,s2,s3])
    ans = min(ans,calc)
    #print(s1,s2,s3)
    
if (H == 2) and (W == 2) :
    ans = 1

print(ans)


Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {

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

		int n = sc.nextInt();
		int i = 1;

		while (i <= n) {
			if (i % 10 == 3 || i % 3 == 0) {
				System.out.print(" " + i);
			} else {
				String s_i = Integer.toString(i);
				if (s_i.contains("3")) {
					System.out.print(" " + i);
				}
			}
			i++;
		}
		System.out.println();
	}
}


Measured memory_bytes: 29124
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        
        double r = scan.nextDouble();
        
        double S = r * r * Math.PI;
        double R = 2 * r * Math.PI;

        String str = String.format("%.6f", S);
        String rstr = String.format("%.6f", R);
        System.out.println(str + " " + rstr);
    }
}

Measured memory_bytes: 28104
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class AtCoderD
{
    private static List<Tuple<int, int>>[] to;
    private static int[] answer;


    static void Main()
    {
        int n = int.Parse(Console.ReadLine());

        to = new List<Tuple<int, int>>[n];
        for (int i = 0; i < n; i++)
        {
            to[i] = new List<Tuple<int, int>>();
        }
        for (int i = 0; i < n - 1; i++)
        {
            var line = Console.ReadLine();
            var words = line.Split(' ');
            int a = int.Parse(words[0]) - 1;
            int b = int.Parse(words[1]) - 1;
            to[a].Add(Tuple.Create(i, b));
            to[b].Add(Tuple.Create(i, a));
        }

        answer = new int[n - 1];

        SetColer(0, 0);

        Console.WriteLine(answer.Max());
        for (int i = 0; i < n - 1; i++)
        {
            Console.WriteLine(answer[i]);
        }
    }

    private static void SetColer(int node, int prevColor)
    {
        int nextColor = 1;
        foreach (var nextEdge in to[node])
        {
            if (nextColor == prevColor)
            {
                nextColor++;
            }

            if (answer[nextEdge.Item1] != 0)
            {
                continue;
            }
            answer[nextEdge.Item1] = nextColor;
            SetColer(nextEdge.Item2, nextColor);

            nextColor++;
        }
    }
}

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

#define INF_LL (int64)1e18
#define INF (int32)1e9
#define REP(i, n) for(int64 i = 0;i < (n);i++)
#define FOR(i, a, b) for(int64 i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-10;

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

template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

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

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value!=0>::type
fill_v(U &u,const V... v){u=U(v...);}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value==0>::type
fill_v(U &u,const V... v){
  for(auto &e:u) fill_v<T>(e,v...);
}


int main(void) {
  int64 N, X;
  using T = tuple<int64, int64, int64>;
  cin >> N >> X;
  vector<T> test(N);
  int64 sa = 0;
  REP(i, N) {
    int64 b, l, u;
    cin >> b >> l >> u;
    sa += b*l;
    test[i] = T(b, l, u);
  }

  int64 l = -1, r = (int64)1e11, m;
  vector<PLL> mx(N);
  REP(i, N) {
    int64 b, l, u;
    tie(b, l, u) = test[i];
    mx[i] = PLL(u*(X-b)+l*b, i);
  }
  sort(all(mx), greater<PLL>());

  auto ok = [&](int64 x) {
    vector<int64> used(N, 0);
    int64 sum = 0, res = 0;
    REP(i, min(x/X, N)) {
      sum += mx[i].fs;
      used[mx[i].sc] = 1;
    }
    res = sum;
    REP(i, N) {
      int64 b, l, u;
      tie(b, l, u) = test[i];
      int64 ei = 0;
      if (b < x%X) ei = u*(x%X-b) + l*b;
      else ei = l*(x%X);
      if (used[i]) {
        ei -= u*(X-b)+l*b;
        if (x/X < N)
          ei += mx[x/X].fs;
      }
      res = max(res, sum+ei);
    }
    return res >= sa;
  };

  while (r - l > 1) {
    m = (l + r) >> 1;
    if (ok(m)) {
      r = m;
    } else {
      l = m;
    }
  }
  cout << r << endl;
}

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

using namespace std;

#define LL long long

const LL MAXN = 1000000;

int main () {

	ios_base::sync_with_stdio(false); cin.tie(NULL);
	
	LL k, x;
	cin >> k >> x;

	for (LL i = max (-MAXN, x - k + 1); i <= min (MAXN, x + k - 1); ++i) {
		cout << i << ' ';
	}
	cout << endl;
	


	return 0;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
	"math"
)

func main() {
	ss := ScanNums(5)
	k := SingleInt()

	for idx, _ := range ss {
		for _, item := range ss {
			if math.Abs(float64(ss[idx]-item)) > float64(k) {
				fmt.Println(":(")
				return
			}
		}
	}

	fmt.Println("Yay!")
}

func SingleInt() int {
	var n int
	fmt.Scan(&n)
	return n
}

func ScanNums(len int) (nums []int) {
	var num int
	for i := 0; i < len; i++ {
		fmt.Scan(&num)
		nums = append(nums, num)
	}
	return
}


Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <iomanip>
#include <bitset>
#include <set>
#include <map>
#include <stdio.h>

#define rep(i,n) for (int i = 0; i < (n); i++)
#define FOR(i,a,b) for (int i=(a); i < (b); i++)
#define INF 100000000000
#define MOD 1000000007 //10^9+7
using namespace std;
using ll = long long;
using P = pair<int, int>;

// 負の数にも対応した % 演算
long long mod(long long val, long long m) {
    long long res = val % m;
    if (res < 0) res += m;
    return res;
}

int main()
{
    int n;
    cin >> n;
    map<string, int> s;
    s.clear();
    int maxx = 0;
    rep(i,n) {
        string tmp;
        cin >> tmp;
        s[tmp]++;
        maxx = max(maxx, s[tmp]);
    }
    
    vector<string> v;
    for(auto it = s.begin(); it != s.end(); it++) {
        if (it->second == maxx) {
            v.push_back(it->first);
        }
    }
    sort(v.begin(), v.end());
    rep(i,v.size()) {
        cout << v[i] << endl;
    }

    return 0;
}


Measured memory_bytes: 26868
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		String w = scanner.next();
		char[] c = w.toCharArray();
		int[] alph = new int[26];
		boolean result = true;

		for(int i=0;i<w.length();i++) {
			alph[(int)(c[i]-'a')]++;
		}

		for(int i=0;i<26;i++) {
			if(alph[i]%2!=0) result=false;
		}

		if(result) System.out.println("Yes");
		else System.out.println("No");
		scanner.close();
	}

}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
int main()
{
    int h, w, k;
    cin >> h >> w >> k;
    vector<vector<char>> field(h, vector<char>(w));
    for(int i = 0; i < h; i++)
    {
        for(int j = 0; j < w; j++)
        {
            cin >> field[i][j];
        }
    }
    int n = pow(2, h + w);
    int ans = 0;
    for(int i = 0; i < n; i++)
    {
        int black = 0;
        for(int x = 0; x < h; x++)
        {
            for(int y = 0; y < w; y++)
            {
                if((i >> x & 1) && (i >> (y+h) & 1) && field[x][y] == '#') black++;
            }
        }
        if(black == k) ans++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 4028
#include<bits/stdc++.h>
using namespace std ;
int main () {
  int x[5] = {} ;
  int p = 0;
  string a[5] ;
  for(int i = 0 ; i < 3 ; i++ ) cin >> a[i]  ;
  while(a[p][x[p]]) p=a[p][x[p]++]-'a' ;
  cout << char ('A' + p ) << endl ;
}


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

using namespace std;

int main()
{
    int k;
    cin>>k;
    int a=0;
    for(int i=1; i<=10000000; i++){
        a=(a*10+7)%k;
        if(a==0){
            cout<<i;
            return 0;
        }
    }
    cout<<-1;

}


Measured memory_bytes: 3624
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <cmath>
#include <cstdio>

using namespace std;

int main(){
  long n;
  long c = 0;
  long a;
  map<long, bool> m;
  cin >> n;
  for (long i=0;i<n;i++) {
    cin >> a;
    if (m.find(a) != m.end()) {
      m[a] = !m[a];
    } else {
      m[a] = true;
    }
  }
  for (auto it = m.begin();it != m.end();it++) {
    if (it->second) {
      c++;
    }
  }
  cout << c << endl;
}


Measured memory_bytes: 6528
def main():
    while True:
        H, W = map(int, input().split())
        if H == 0 and W == 0:
            break
        print('#' * W)
        for _ in range(H - 2):
            col = '#'
            for _ in range(W - 2):
                col += '.'
            col += '#'
            print(col)
        print('#' * W)
        print()


main()



Measured memory_bytes: 5616
INFTY = 10**14+5
N,M = map(int,input().split())
A = sorted([list(map(int,input().split())) for _ in range(M)],key=lambda x:x[1])
A = sorted(A,key=lambda x:x[0])
d = [INFTY for _ in range(N+1)]
d[1] = 0
for i in range(M):
    L,R,C = A[i]
    d[R] = min(d[R],d[L]+C)
    j = R-1
    while d[j]>d[R]:
        d[j] = d[R]
        j -= 1
if d[N]>=INFTY:
    print(-1)
else:
    print(d[N])

Measured memory_bytes: 75224
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cstring>
#include <map>
#include <queue>
#include <cmath>
#include <complex> // complex<double> a(1.2 , 2.3);// real(): 1.2, imag()2.3
using namespace std;

#define MOD 1000000007
#define ll long long
#define ld long double
#define FOR(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rmsame(a) sort(all(a)),a.erase(unique(all(a)), a.end())
#define rmvector(a,b) rep(i,a.size())rep(j,b.size())if(a[i]==b[j]){a.erase(a.begin()+i);i--;break;}
#define pq_pair_tB priority_queue <pair<ll,ll>, vector<pair<ll,ll> > , greater<pair<ll,ll> > > 
#define pq_pair_ts priority_queue <pair<ll,ll> > //第二成分の大きさが関係ない
template<typename X> bool exist(vector<X> vec, X item){return find(all(vec), item)!=vec.end();}
ll gcd(ll a, ll b){if(b==0)return a;return gcd(b,a%b);}
ll lcm(ll a, ll b){return a/gcd(a,b)*b;}

bool check[100001];
ll ans[100001];
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    check[0] = true;
    check[1] = true;
    rep(i,100001)rep(j,100001){
        if( i == 1 || j == 1) continue;
        if(i*j >100000) break;
        check[i*j] = true;
    }
    
    rep(i,100001){
        if((check[i] == false) && (check[(i+1)/2] == false)) ans[i]++;

        if(i == 0) continue;
        ans[i] += ans[i-1];
    }
    ll Q; cin >> Q;
    rep(i,Q){
        ll l,r; cin >> l >> r;
        cout << ans[r]-ans[l-1] << endl;
    }
    
    
    //cout << fixed << setprecision(16) << ans << endl;
    return 0;
}


Measured memory_bytes: 1536
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
#define INF 1145141919810893364
#define PI 3.141592653589
typedef pair<int,int> PP;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
#define int ll
#define setdouble setprecision
#define REP(i,n) for(int i=0;i<(n);++i)
#define OREP(i,n) for(int i=1;i<=(n);++i)
#define RREP(i,n) for(int i=(n)-1;i>=0;--i)
#define GOODBYE cout << "NO" << endl;return 0
#define MM <<" "<<
#define Endl endl
 
signed main(void){
    string S;
    cin >> S;
    int N=S.size(),Ans=0;
    char pre='Z';
    REP(i,N){
        if(i==N-2 && S[N-2]==S[N-1]){
            cerr << S[i] << S[i+1] << endl;
            i+=2;
            Ans++;
            break;
        }
        if(pre!=S[i]){
            Ans++;
            cerr << S[i] << endl;
            pre={S[i]};
        }else{
            Ans++;
            cerr << S[i] << S[i+1] << endl;
            i++;
            pre='Z';
        }
    }
    cout << Ans << endl;
    
    return 0;
}


Measured memory_bytes: 640
/*
* @Author: _dp95
* @Date:   2020-04-13 13:17:28
*/
#include "bits/stdc++.h"
using namespace std ;

#define timesaver ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

typedef long long ll ;
typedef long double ldb ;

#define mp make_pair
#define pb push_back
#define F first
#define S second
#define nl '\n'

#define all( x ) x.begin(),x.end() 
#define sz( x ) ( int )( x ).size( )
#define mem( a, val ) memset(a, val, sizeof( a ) )
#define deci( x ) cout<<fixed<<setprecision( x );
#define bitcount( x ) __builtin_popcountll( x )

const int dx[8] = {-1, -1, -1, 0, 1, 1, 1, 0};
const int dy[8] = {-1, 0, 1, 1, 1, 0, -1, -1};

const int MAX = 2*1000*1000 + 10 ;
const ll INF = 1e18 ;
const int MOD = 1e9 + 7 ;

ll has[MAX] ;
bool isprime[MAX] ;

signed main( ){
  timesaver ;
  ll n ;
  cin >> n ;
  for( ll i = 2 ; i <= n ; i++ ){
    if(isprime[i])
      continue ;
    for(ll j = i ; j <= n ; j+= i ){
      isprime[j]=1;
      ll x = j ;
      while( x%i == 0 ){
        x /= i ;
        has[i]++; 
      }
    }
  }
  ll ans(1) ;
  for( ll i = 2 ; i <= n ; i++ )
    ans = ( ans * (has[i]+1) )%MOD ;
  cout << ans << nl ; 
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
using namespace std;
int main(){
    int N;
    int kawadasan=0;
    cin>>N;
    vector<int> a(N);
    for(int i=0;i<N;i++){
        cin>>a[i];
        while(true){
            if(a[i]%2==0){
                a[i]/=2;
                kawadasan++;
            }else{
                break;
            }
        }
    }
    cout<<kawadasan;
}

Measured memory_bytes: 3636
N, P = map(int, input().split())
A_li = list(map(int, input().split()))
for i, a in enumerate(A_li) :
    if a % 2 == 1 :
        break
    if i == N - 1 :
        if P == 0 : 
            print(2 ** N)
        else :
            print(0)
        exit()
print(2 ** (N - 1))


Measured memory_bytes: 38256
n,x,m = map(int,input().split())
ans = 0
l = [x]
s = [0]*m
s[0] = 1

for i in range(n):
	x = (x*x)%m
	if s[x] == 1:
		break
	s[x] = 1
	l.append(x)

if x == 0:
	print(sum(l))
else:
	p = l[0]
	k = 1
	Su = 0
	while p != x and k < len(l):
		Su += p
		p = l[k]
		k += 1
	l = l[k-1:]

	Su2 = 0
	for r in range((n-k)%len(l) + 1):
		Su2 += l[r]
	print(Su + ((n-k)//len(l))*sum(l) + Su2)

Measured memory_bytes: 12268