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

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

Measured memory_bytes: 1152
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll partsum[300005],partxor[300005];
bool is[25];
int main(){
    ll cnt=0;
    int N; scanf("%d",&N);
    vector<int> a(N*2);
    for(int i=0;i<N;i++) scanf("%d",&a[i]);
    for(int i=1;i<=N;i++)
    {
        partsum[i]=partsum[i-1]+a[i-1];
        partxor[i]=partxor[i-1]^a[i-1];
    }
    int l=1,r=1;
    while(r<=N)
    {
        while(r>l && partsum[r]-partsum[l-1]!=(partxor[r]^partxor[l-1])) l++;
        cnt+=(r-l+1);
        r++;
    }
    printf("%lld",cnt);
    return 0;
}


Measured memory_bytes: 5376
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<cmath>
#include<tuple>
#include<string>
typedef unsigned long long ll;
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define F first
#define S second
using namespace std;
const ll INF = 1e12;
const int i_INF = 2147483647;

int main() {
  int x;
  cin>>x;
  if(x==3||x==5||x==7)cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define zero_pad(num) setfill('0') << std::right << setw(num)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;

int main() {
    int n, m;
    cin >> n >> m;
    vector<vector<int>> to(n);
    rep(i, m){
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        to[a].push_back(b);
        to[b].push_back(a);
    }
    rep(i, n) cout << to[i].size() << endl;
}

Measured memory_bytes: 256
from collections import Counter
def main():
    n = int(input())
    A = [int(input()) for _ in range(n)]
    c = Counter(A)
    ans = 0
    for v in c.values():
        if v % 2 != 0:
            ans += 1
    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 61400
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define whole(x) (x).begin(),(x).end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
using P = pair<int, int>;
#define debug(var) cerr << "[" << #var << "] " << var << endl
#define chmin(x, y) x = min(x, y)
const ll mod = 1000000007;
const int dx[] = {-1,0,1,0};
const int dy[] = {0,-1,0,1};


int main(){
    string s;
    cin >> s;
    int n = s.size();
    int k;
    cin >> k;
    
    map<string, int> mp;
    rep(i, n) {
        string now;
        rep(j, 5) {
            if (i+j>=n) continue;
            now += s[i+j];
            mp[now]++;
        }
    }
    
    
    auto it = mp.begin();
    rep(i, k-1) it++;
    string ans = it->first;
    
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1920
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <random>
#include <chrono>
#include <queue>
#include <math.h>
#include <string>
#include <sstream>
#include <stack>
#define inf 1e9+7
#define pb push_back
#define make make_pair
#define kaku(a) cout << a << endl;
 
using namespace std;
 
#define ll long long
#define rep(i,n) for(ll i=0;i<n;i++)
#define PI 3.14159265359
long long gcd(long long a,long long b){ return b==0?a:gcd(b,a%b);}
long long lcm(long long a,long long b){ return a/gcd(a,b)*b;}

typedef pair<ll,ll> Pair;

const ll N=100001;
const ll MOD=1e9+7;

string s;
ll d[N][13];

void init(){
    rep(i,s.size()){
        rep(j,13){
            d[i][j]=0;
        }
    }
}

void solve(){
    if(s[0]=='?'){
        rep(i,10) d[0][i]=1;
    }
    else{
        rep(i,13){
            if(i==s[0]-'0') d[0][i]=1;
            else d[0][i]=0;
        }
    }
    for(ll i=1;i<s.size();i++){
        if(s[i]!='?'){
            ll a=s[i]-'0';
            rep(j,13){
                ll c=a+j*10;
                c%=13;
                d[i][c]+=d[i-1][j];
                d[i][c]%=MOD;
            }
        }
        else{
            rep(k,10){
                rep(j,13){
                    ll c=k+j*10;
                    c%=13;
                    d[i][c]+=d[i-1][j];
                    d[i][c]%=MOD;
                }
            }
        }
    }
    kaku(d[s.size()-1][5]);
}

int main(){
    cin >> s;
    init();
    solve();
    return 0;
}



Measured memory_bytes: 10624
#include <iostream>
#include <map>
#include <set>
#include <algorithm>
#include <vector>
#include <sstream>
#include <string>
#include <functional>
#include <queue>
#include <deque>
#include <stack>
#include <limits>
#include <unordered_map>
#include <unordered_set>
#include <math.h>
#include <fstream>
#include <iterator>
#include <random>
#include <chrono>
 
 
#define forr(i,start,count) for (int i = (start); i < (start)+(count); ++i)
#define set_map_includes(set, elt) (set.find((elt)) != set.end())
#define readint(i) int i; cin >> i
#define readll(i) ll i; cin >> i
#define readdouble(i) double i; cin >> i
#define readstring(s) string s; cin >> s
 
typedef long long ll;
 
using namespace std;

ll modd = 1000*1000*1000+7;

ll binary_search(function<bool(ll)> func, ll start, ll end) {
    /*      func:int ->bool
            returns smallest int x where func(x) evaluates to true, searches in [start,end), it is assumed the values are false, .. , false, true ...
             */
    if (end <= start) {   return end;  }   // has to be here, otherwise func(end-1) in next line could be a problem
    if (!func(end-1)) {  return end;  }
    while (end-start>1) {
        ll mid = (start+end)/2;
        if (func(mid)) {  end = mid;  } else { start = mid;   }
    }
    if (func(start)) {  return start;  } else {  return end;   }
}; 


int main()   {

    ios_base::sync_with_stdio(false);

    cout.precision(17);
    mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
    uniform_int_distribution<int> rand_gen(0, modd);   // rand_gen(rng) gets the rand no
 
//    auto start = chrono::steady_clock::now();
  
//    readint(test_cases);
    int test_cases = 1;
    forr(t, 1, test_cases) {
        readint(n);
        vector<int> a(n);
        forr(i,0,n) {
            readint(kk);
            a[kk-1] = i;
        }
        for(auto x : a) {
            cout << x+1 << " ";
        }
        cout << endl;

    }
 
//    auto end = chrono::steady_clock::now();
//    cout << chrono::duration_cast<chrono::milliseconds>(end - start).count() << endl;
 
    return 0;
}

Measured memory_bytes: 3780
#include <iostream>

using namespace std;

int main()
{
    string s,t;

    cin >> s;
    cin >> t;

    bool flag = false;

    auto check = [](string s,string t,int a){
        for (int b = 0; b < t.size(); ++b) {
            if(s[a+b] == '?' || s[a+b] == t[b]) continue;
            return false;
        }
        return true;
    };

    for (int a = s.size() - t.size();a >= 0; --a) {
        if(check(s,t,a)){
            s.replace(a,t.size(),t.c_str());
            flag = true;
            break;
        }
    }

    for(auto& ds : s){
        if(ds == '?'){
            ds = 'a';
        }
    }

    if(flag){
        cout << s << endl;
    }else{
        cout << "UNRESTORABLE" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
using namespace std;

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

    int x = n;
    int f = 0;
    while(x > 0){
        f += x % 10;
        x /= 10;
    }

    if(n % f == 0)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;

    return 0;
}


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

#define debug(x) cout << #x << " = " << x << endl
#define fori(i, ini, lim) for(int i = int(ini); i < int(lim); i++)
#define ford(i, ini, lim) for(int i = int(ini); i >= int(lim); i--)

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;

const int MAX = 1e5 + 5;
vector<int> sub[MAX];

int main() {
    ios_base::sync_with_stdio(false);
    int n;
    cin >> n;
    ll k = 1;
    while((k * (k - 1)) / 2 < n) {
        k++;
    }
    if(((k * (k - 1)) / 2 > n)) {
        cout << "No" << '\n';
        return 0;
    }
    int id = 1;
    for(int i = 1; i <= k; i++) {
        for(int j = i + 1; j <= k; j++) {
            sub[i].push_back(id);
            sub[j].push_back(id);
            id++;
        }
    }
    cout << "Yes" << '\n';
    cout << k << '\n';
    fori(i, 1, k + 1) {
        cout << sub[i].size();
        for(auto &each : sub[i]) {
            cout << " " << each;
        }
        cout << '\n';
    }
    return 0;
}


Measured memory_bytes: 4736
i = 0
loop {
  @datasets = (gets.to_i * 2) if i == 0
  i = (i + 1)

  if i > 0
    if i % 2 == 1
      @a = gets.to_i
    else
      @b = gets.to_i
      @c = @a + @b
      if @c.to_s.length <= 80
        puts @a + @b
      else
        puts 'overflow'
      end
    end
  end
  break if i == @datasets
}

Measured memory_bytes: 8656
#include<cstdio>
int n,t[100005],a,ans,lst;
int main()
{
    scanf("%d",&n);
    for(int i=1;i<=n;i++) scanf("%d",&a),t[a]++;
    for(int i=1;i<=100000;i++) ans+=(t[i]-1)/2,t[i]=(t[i]-1)%2+1;
    lst=-1;
    for(int i=1;i<=100000;i++)
    if(t[i]==2){
        if(lst==-1) lst=i;
        else t[i]--,t[lst]--,ans++,lst=-1;
    }
    for(int i=1;i<=100000;i++)
    if(t[i]==2) ans++;
    printf("%d",n-ans*2);
    return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
    int n;
    cin>>n;
    int a[100000];
    for (int i = 0; i < n; i++)
    {
        cin>>a[i];
    }
    int ans[100000];
    int tmp=0;
    for (int i = 0; i < n/2; i++)
    {
        tmp+=-a[i*2]+a[i*2+1];
    }
    tmp+=a[n-1];
    ans[n-1]=tmp/2;
    for (int i = n-2; i >= 0; i--)
    {
        ans[i]=a[i]-ans[i+1];
    }
    
	for (int i = 0; i < n; i++)
    {
        if (i==n-1)
        {
            cout<<ans[i]*2;
        }else{
            cout<<ans[i]*2<<" ";
        }
    }
	return 0;
}

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

int main() {
    int N;
    cin >> N;
    vector<int> a(N);
    for(int i = 0; i < N; i++){
        cin >> a.at(i);
    }
    int count = 0;
    for(int i = 1; i <= N; i++){
        if(i % 2 == 1&& a.at(i - 1) % 2 == 1){
            count++;
        }
    }
    cout << count << endl;
}

Measured memory_bytes: 3628
s = input()
t = input()

dp = [[0] * (len(t)+1) for _ in range(len(s)+1)]

for i in range(len(s)):
    for j in range(len(t)):
        if s[i] == t[j]:
            dp[i+1][j+1] = dp[i][j] + 1
        else:    
            dp[i+1][j+1] = max(dp[i][j+1], dp[i+1][j])    
st = ""

x = len(s)
y = len(t)


while x > 0 and y > 0:
    if dp[x][y] == dp[x-1][y]:
        x -= 1
    elif dp[x][y] == dp[x][y-1]:
        y -= 1
    else:
        x -= 1
        y -= 1
        st += s[x]
print(st[::-1])        

Measured memory_bytes: 112220
n = int(input())
points = []
points.append([0, 0, 0])
can = True
for i in range(n):
    points.append([i for i in map(int, input().split())])
    move_n = points[i+1][0] - points[i][0]
    dist = abs(points[i+1][1] - points[i][1]) + abs(points[i+1][2] - points[i][2])
    if move_n < dist or dist % 2 != move_n % 2:
        can = False 
        break
# print(points)
# can = True
# for i in range(len(points)-1):
#     move_n = points[i+1][0] - points[i][0]
#     dist = abs(points[i+1][1] - points[i][1]) + abs(points[i+1][2] - points[i][2])
#     if move_n < dist or dist % 2 != move_n % 2:
#         can = False 
#         break

if can:
    print('Yes')
else:
    print('No')

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

// 選ぶのは (Ln,Rm) とする
// 左端（i=0 とする）はBのみ、必ず L になる
// 左端（i=0 とする）のWは2回反転が必要だけど、2回は無理なので、不可
// BW なら、i=1 は2回反転が必要なので、i=1 は L				LL
// BB なら、i=1 は1回反転が必要なので、i=1 は R				LR
// BWW なら、i=2 は2回反転が必要なので、i=2 は R			LLR
// BWB なら、i=2 は1 or 3回反転が必要なので、i=2 は L			LLL
// BBB なら、i=2 は1 or 3回反転が必要なので、i=2 は L			LRL
// BBW なら、i=2 は2回反転が必要だけど、対象となるペアが左に存在しないので、不可
// BWWB なら、i=3 は奇数反転が必要なので、R				LLRR
// BWWW なら、i=3 は偶数回反転が必要なので、L				LLRL
// BWBB なら、i=3 は奇数回反転が必要なので、L				LLLR
// BWBW なら、i=3 は偶数回反転が必要なので、R				LLLL
// BBBB なら、i=3 は奇数回反転が必要なので、R				LRLR
// BBBW なら、i=3 は偶数回反転が必要なので、L				LRLL

// 左  現
// 偶  B	L
// 偶  W	R
// 奇  B	R
// 奇  W	L
// 左の L数-R数 == 0 なら R は選べない

// LRが決まったら、その組み合わせの数を数える。
// 

const int64_t MOD = 1000000007;

int main() {
  int64_t cnt = 1;
  int N;
  string S;
  cin >> N >> S;
  int ln = 1, rn = 0;
  N = N * 2;
  for(int i=1;i<N;++i) {
    if( S[i] == 'B' ) {
      if ( (ln - rn) % 2 == 1 ) {
        // R
        rn++;
        if ( ln-rn < 0 ) break;
        cnt = cnt * (ln-rn+1) % MOD;
//        cout << "ODD  B : R : " << cnt << endl;
      } else {
        // L
        ln++;
//        cout << "EVEN B : L : " << cnt << endl;
      }
    } else {
      if ( (ln - rn) % 2 == 1 ) {
        // L
        ln++;
//        cout << "ODD  W : L : " << cnt << endl;
      } else {
        // R
        rn++;
        if ( ln-rn < 0 ) break;
        cnt = cnt * (ln-rn+1) % MOD;
//        cout << "EVEN W : R : " << cnt << endl;
      }
    }
  }
  if ( ln-rn != 0 ){
    cnt = 0;
  } else {
    for(int i=1;i<N/2+1;i++ ) cnt = cnt * i % MOD;
  }
  cout << cnt << endl;

}


Measured memory_bytes: 640
N, K = map(int, input().split())
A = list(map(int, input().split()))
mod = int(1e+9 + 7)
p = mod - 2
ax = []
while p != 0:
  ax = [p%2] + ax[:]
  p //= 2
A.sort()
S = 0
fact = 1
invK = 1
for i in range(K - 1):
  fact *= i + 1
  fact %= mod
for j in range(len(ax)):
  if ax[j] == 1:
    invK *= fact
    invK %= mod
  if j != len(ax) - 1:
    invK *= invK
    invK %= mod
invf = 1
for k in range(K, N + 1):
  S += ((A[k - 1] - A[N - k]) * (fact * invf)) % mod
  S %= mod
  fact *= k
  fact %= mod
  lead = 1
  for j in range(len(ax)):
    if ax[j] == 1:
      lead *= (k + 1 - K)
      lead %= mod
    if j != len(ax) - 1:
      lead *= lead
      lead %= mod
  invf *= lead
  invf %= mod
print((S*invK) % mod)

Measured memory_bytes: 14172
#include<bits/stdc++.h>
using namespace std;
#define fo(i, n) for(int i=0; i<n; i++)
#define Fo(i, k, n) for(int i=k; i<n; i++)
#define MOD 1000000007
#define vi vector<int>
#define deb(n) cout<<"[ "#n<<" = "<<n<<" ]"<<endl;
#define FIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
const long long  MAX = 1 << 18;
int case_no=1;
#define w(x) int x; cin>>x; while(x--)

int main() {
	FIO
	char ch;
	cin >> ch;
	if(ch >= 65 and ch <= 91) cout << "A" << endl;
	else cout << "a" << endl;

	return 0;
}

Measured memory_bytes: 3616
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>

using namespace std;

int n;
string a, b, s;

int main()
{
    scanf("%d", &n);
    cin >> a >> b;

    for(int i = 0, j = 0; a[i] && b[j]; i++, j++){
        s += a[i];
        s += b[j];
    }

    cout << s << endl;
    return 0;
}

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

const int MAX = 100010;

int parent[MAX];

void init(int n) {
  // n:要素数
  for (int i = 0; i < n; i++) {
    parent[i] = i;
  }
}

int find(int x) {
  // xの根を求める
  if (parent[x] == x) {
    return x;
  } else {
    return parent[x] = find(parent[x]);
    // 繋ぎ変え
  }
}

void unite(int x, int y) {
  // xが入っている集合とyが入っている集合をくっつける
  int rx = find(x);
  int ry = find(y);
  if (rx == ry) {
    // もし同じ集合なら
    return;
  }
  parent[rx] = ry;
}

inline bool issame(int x, int y) { return find(x) == find(y); }

int main() {
  int n, m;
  cin >> n >> m;
  init(n);
  for (int i = 0; i < m; i++) {
    int x, y, z;
    cin >> x >> y >> z;
    x--;
    y--;
    unite(x, y);
  }
  set<int> roots;
  for (int i = 0; i < n; i++) {
    roots.insert(find(i));
  }
  cout << roots.size() << endl;
}


Measured memory_bytes: 5376
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
using namespace std;

#define EPS 1e-6

typedef double Type;

int sign(Type x)
{
    return x<-EPS?-1:(x>EPS?1:0);
}

struct Point
{
    Type x,y;
    Point(Type x,Type y):x(x),y(y) {}
    Point() {}
    void read()
    {
        scanf("%lf %lf",&x,&y);
    }
    bool operator==(const Point& p) const
    {
        return sign(x-p.x)==0&&sign(y-p.y)==0;
    }
    Point operator-(const Point& p) const
    {
        return Point(x-p.x,y-p.y);
    }
    Point operator*(const Type t) const
    {
        return Point(t*x,t*y);
    }
    Point operator+(const Point & p) const
    {
        return Point(x+p.x,y+p.y);
    }
    bool operator<(const Point& p) const
    {
        return sign(x-p.x)==0?sign(y-p.y)<0:sign(x-p.x)<0;
    }
};

ostream& operator<<(ostream& out,Point p)
{
    out<<p.x<<" "<<p.y;
    return out;
}

typedef Point Vector;

//叉?
Type Cross(Vector a,Vector b)
{
    return a.x*b.y-a.y*b.x;
}

//点?
Type Dot(Vector a,Vector b)
{
    return a.x*b.x+a.y*b.y;
}

bool isOrthogonal(Vector a,Vector b)
{
    return Dot(a,b)==0.0;
}

bool isParallel(Vector a,Vector b)
{
    return Cross(a,b)==0.0;
}

int main()
{
    int t;
    scanf("%d",&t);
    while(t--)
    {
        Point a,b,c,d;
        a.read();
        b.read();
        c.read();
        d.read();
        Vector x,y;
        x=a-b;
        y=c-d;
        if(isOrthogonal(x,y))
            puts("1");
        else if(isParallel(x,y))
            puts("2");
        else
            puts("0");
    }
    return 0;
}

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

int a[10];

int main()
{
	for(int i = 1; i <= 9; i++){
		cin >> a[i];
	}
	if(a[1] + a[5] + a[9] == a[2] + a[6] + a[7] &&
	   a[1] + a[5] + a[9] == a[3] + a[4] + a[8]) puts("Yes");
	   else puts("No");
	return 0;
}

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

typedef long long ll;
#define rep(i,x) for(int i=0;i<x;i++)
#define put(ans)    cout << ans << endl;

int main(){
    int l,r,d;
    cin >> l >> r >> d;

    int ans(0);
    for(int i=l;i<=r;i++){
        if(i%d==0)  ans++;
    } 

    cout <<ans << endl;

    return 0;
}

Measured memory_bytes: 3588
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector<bool> vb;
#define pb push_back
#define fi first
#define se second
#define in insert
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int INF = 1e9 + 5;
void solve(){
    int n, k;
    cin >> n >> k;
    vll a(n + 1, 0);
    double ans = 0;
    for (int i = 1; i <= n; ++i) cin >> a[i];
    for (int i = 1; i <= n; ++i) a[i] += a[i-1] + 1;
    for (int i = k; i <= n; ++i) {
        ans = max(ans, double(a[i] - a[i-k]) / 2.0);
    }
    cout << fixed << setprecision(6) << ans;
}
int main(){
    speed;
    int t = 1;
    //cin >> t;
    while(t--) solve();
}

Measured memory_bytes: 1792
n = int(input())
data = [[[0 for i in range(10)] for j in range(3)] for k in range(4)]

for i in range(n):
	b,f,r,v = [int(s) for s in input().split(' ')]
	data[b-1][f-1][r-1] += v

while data:
	building = data.pop(0)
	for floor in building:
		rooms = ' ' + ' '.join([str(room) for room in floor])
		print(rooms)
	if data:
		print('####################')

Measured memory_bytes: 7672
package main

import (
	"fmt"
)

func main() {

	var K, A, B int
	fmt.Scanf("%d", &K)
	fmt.Scanf("%d %d", &A, &B)

	flag := 0
	for i := A; i <= B; i++ {
		if i%K == 0 {
			flag = 1
			break
		}
	}

	if flag == 1 {
		fmt.Println("OK")
	} else {
		fmt.Println("NG")
	}
}


Measured memory_bytes: 1832
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
//#include <math.h>
#include <algorithm>
#include <vector>

typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))

using namespace std;

#define MOD 1000000007

vector<vector<long> > a;

void dfs( long curr, long wall, ll ans[2] )   // ans[0]:black ans[1]:white
{
    long i;
    ans[0]=ans[1]=1;
    for(i=0; i<(long)a[curr].size(); i++) {
        if(a[curr][i]!=wall) {
            ll ans0[2]={0};
            dfs( a[curr][i], curr, ans0 );
            ans[0]=ans[0]*ans0[1]%MOD;
            ans[1]=ans[1]*((ans0[0]+ans0[1])%MOD)%MOD;
        }
    }
    return;
}

int main(int argc, char* argv[])
{
    long n;
    scanf("%ld", &n );

    a.resize(n);

    long i;
    for(i=0; i<n-1; i++) {
        long x, y;
        scanf("%ld %ld", &x, &y);
        a[x-1].push_back(y-1);
        a[y-1].push_back(x-1);
    }

    ll ans[2]={0};
    dfs( 0, -1, ans );

    printf("%lld\n", (ans[0]+ans[1])%MOD);

    return 0;
}


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

int main() {
  int A, B, C, K;
  cin >> A >> B >> C >> K;
  if (K < A){
    cout << K << endl;
  }
  else if (K < A + B){
    cout << A << endl;
  }
  else{
    cout << A - (K - A - B) << endl;
  }
}


Measured memory_bytes: 3636
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

 class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);
		int flag = 0;

		int N = scan.nextInt();
		List<Integer>list = new ArrayList<>();

		for(int i=0;i<N;i++) {
			list.add(scan.nextInt());
		}

		for(int num:list) {
			if(num%2==0) {
				if(num%3!=0 && num%5!=0) {
					flag++;
				}
			}
		}

		if(flag==0) {
			System.out.println("APPROVED");
		}else {
			System.out.println("DENIED");
		}
	}

}

Measured memory_bytes: 23764
n, q = map(int, input().split())
s = input()
cum_sum = [0] * (n+1)

for i in range(n):
    if s[:i+1][-2:] == 'AC':
        cum_sum[i+1] += 1
    cum_sum[i+1] += cum_sum[i]

for _ in range(q):
    l, r = map(int, input().split())
    print(cum_sum[r]-cum_sum[l])


Measured memory_bytes: 7668
import java.util.*;

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

    int N = scn.nextInt();
    int K = scn.nextInt();

    double winRate = 0;
    for (int i = 1; i <= N; i++) {
      winRate += calcProb(i, K, 1.0 / N);

    }
    System.out.println(winRate);
  }

  public static double calcProb(int N, int K, double prob) {

    if (N >= K) {
      return prob;

    } else {
      return calcProb(N * 2, K, prob * 0.5);

    }
  }
}

Measured memory_bytes: 21460
#include <iostream>
#include <stdio.h>
#include <string>
#include <vector>

using namespace std;

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

	vector <int64_t> a(87);

	a.at(0) = 2;
	a.at(1) = 1;

	for (int i = 2; i < 87; i++) {
		a.at(i) = a.at(i - 1) + a.at(i - 2);
	}

	cout << a.at(n);

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    

    long long int n,a,b;
    
    cin>>n;
    
    long long int numbers[200005];
    
    
    for(b=0;b<=n-2;b++)
    {
    
        cin>>numbers[b];
    
    
    }
    
    
    //sort(numbers,numbers+(n-1));
    
    
    multiset<long long int> s;
    
    for(b=0;b<=n-2;b++)
    {
    
    
        s.insert(numbers[b]);
    
        
    }
        
    for(a=1;a<=n;a++)
    {
    
    
        cout<<s.count(a)<<"\n";
        
    
    }
    
}


Measured memory_bytes: 14568
#include<iostream>
#include <string>
using namespace std;
 int N,A,B,C,l[1000];
int dsf(int n,int a,int b,int c){
  int ans1,ans2;
  if(n>=N){
       if(a&&b&&c){
         return abs(A-a)+abs(B-b)+abs(C-c);
       }else{
         return 1e9; 
       }
     }
  //４つの中で最もMPの消費のないものを返す
  ans1=min(
    dsf(n+1,a,b,c),
    dsf(n+1,a+l[n],b,c)+10*(a>0)
  );
  ans2=min(
    dsf(n+1,a,b+l[n],c)+10*(b>0),
    dsf(n+1,a,b,c+l[n])+10*(c>0)
  );
  return min(ans1,ans2);
}

int main()
{
 
  cin>> N>>A>>B>>C;
  for(int i=0;i<N;i++)cin>>l[i];
  cout << dsf(0,0,0,0);
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <array>
#include <cmath>
#include <iomanip>
using namespace std;
int main(){
    string s;
    cin >> s;
    int ans = 0;
    for(int i = 0; i < s.length()/2; i++){
        if(s[i] != s[s.length()-1-i]){
            ans ++;
        }
    }
    cout << ans << endl; 
    return 0;
}
    



Measured memory_bytes: 256
#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 ok = true;
  vector<int> ans(n);
  for(int i = n-1; i >= 0; i--){
    int ne = (i+1) * 2 - 1;
    int now = a.at(i);
    while(ne < n){
      now ^= a.at(ne);
      ne += i + 1;
    }
    a.at(i) = now;
  }
  
  int cnt = 0;
  for(int i = 0; i < n; i++){
    if(a.at(i)) cnt++;
  }
  
  cout << cnt << endl;
  for(int i = 0; i < n; i++){
    if(a.at(i)) cout << i + 1 << " ";
  }
  cout << endl;
}

Measured memory_bytes: 4740
#define _USE_MATH_DEFINES
#define INF 0x3f3f3f3f
#include <cstdio>
#include <iostream>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>
#include <cctype>
#include <utility>
 
using namespace std;
 
typedef long long ll;
typedef pair <int,int> P;
typedef pair <int,P > PP;
 
const static int tx[] = {0,1,0,-1};
const static int ty[] = {-1,0,1,0};

const static double EPS = 1e-8;

int main(){
  int lhs,rhs;
  while(~scanf("%d %d",&lhs,&rhs)){
    if(lhs == 0 && rhs == 0) break;

    int res = INF;
    for(int a = 1; a * a <= lhs; a++){
      if(lhs % a != 0) continue;
      int b = lhs / a;
      for(int c = 1; c * c <= rhs; c++){
        if(rhs % c != 0) continue;
        int d = rhs / c;
        int tmp_numbers[4] = {a,b,c,d};
        sort(tmp_numbers, tmp_numbers + 4);

        int sum = 0;
        for(int num_i = 0; num_i < 3; num_i++){
          sum += (tmp_numbers[num_i + 1] - tmp_numbers[num_i])
            * (tmp_numbers[num_i + 1] - tmp_numbers[num_i]);
        }
        res = min(sum,res);
      }
    }

    printf("%d\n",res);
  }
}

Measured memory_bytes: 1204
import std.stdio : readf, readln, writeln;
import std.string;
import std.array;
import std.conv;

void main() {
  int[] v;
  v = readln.split.to!(int[]);
  int H = v[0];
  int W = v[1];
  string[] s;
  for (int i=0; i<H; i++)
    s ~= readln.chomp;
  int[][] dw;
  int[][] dh;
  for (int i = 0; i < H; i++) {
    int[] cw;
    int count = 0;
    for (int j = 0; j < W; j++) {
      if (s[i][j] == '#') {
          cw ~= 0;
      }
      else if (j == 0 || s[i][j - 1] == '#') {
        count = 0;
        for (int k = j; k < W; k++) {
          if (s[i][k] == '.') {
            count++;
          }
          else {
            break;
          }
        }
        cw ~= count;
      }
      else {
        cw ~= count;
      }
    }
    dw ~= cw;
  }
  for (int j = 0; j < W; j++) {
    int[] ch;
    int count = 0;
    for (int i = 0; i < H; i++) {
      if (s[i][j] == '#') {
        ch ~= 0;
      }
      else if (i == 0 || s[i - 1][j] == '#') {
        count = 0;
        for (int k = i; k < H; k++) {
          if (s[k][j] == '.') {
            count++;
          }
          else {
            break;
          }
        }
        ch ~= count;
      }
      else {
        ch ~= count;
      }
    }
    dh ~= ch;
  }
  int max = 0;
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      int sum = dw[i][j] + dh[j][i];
      if (max < sum) {
        max = sum;
      }
    }
  }
  writeln(max - 1);
}


Measured memory_bytes: 42876
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define inf 1000000000000000000
#define io ios_base::sync_with_stdio(false); cin.tie(NULL);
#define pb push_back
#define endl '\n'
#define pii pair<ll, pair<ll, char>>
const ll mod = 1000000007;
ll n;
string solve() {
	string s;
	cin>>s;
	n = s.size();
	if(s[n-1] == 's') {
		//s = s.substr(0, n-1);
		s += "es";
	}
	else {
		s += "s";
	}
	return s;
}
int main() {
	io
	ll t = 1;
	//cin>>t;
	while(t--) {
		cout<<solve()<<endl;
		//solve();
	}
}


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

using namespace std;

int main() {
    long long int a, b;
    scanf("%lld %lld", &a, &b);
    if(a > 10) printf("%lld\n", b);
    else printf("%lld\n", 100 * (10 - a) + b);
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <cmath>
#include <map>
#include <numeric>

int main(void) {
	int n, a, b;

	std::cin >> n >> a >> b;

	std::cout << std::min(a, b) << " " << std::max(0, a + b - n) << std::endl;
	return 0;
}

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

int main(void) {
  int N;
  cin >> N;
  vector<int> a(N);
  for (int i = 0; i < N; i++) {
    cin >> a[i];
  }
  vector<int> b(N, 0);

  vector<int> ans;
  for (int i = N - 1; i >= 0; i--) {
    int sum = 0;
    for (int j = i; j < N; j += (i + 1)) {
      sum += b[j];
    }
    if (sum % 2 != a[i]) {
      b[i]++;
      ans.push_back(i + 1);
    }
  }
  cout << ans.size() << endl;
  for (auto a : ans) {
    cout << a << endl;
  }
  return 0;
}

Measured memory_bytes: 3064
S = input()

def saiki(i,s = S[0]):
    if i == 3:
        if eval(s) == 7:
            print(str(s) + "=7")
            exit()
        else:
            return            
    saiki(i + 1, s + "+" + S[i+1])
    saiki(i + 1, s + "-" + S[i+1])

saiki(0)


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

using namespace std;

typedef long long ll;

#define sz(x) ((int)(x).size())
#define in(x) int x;cin>>x
#define bit(n) (1<<(n))

#define out(x) cout<<(x)<<endl;
#define err(x) cerr<<(x)<<endl;
#define errr(x,y) cerr<<(x)<<" "<<(y)<<endl;

#define rep(i,n) for (int i=0;i<(n);i++)
#define repp(i,n) for (int i=1;i<=(n);i++)

#define inf5 100002
#define inf9 1000000002

int main(){
	int a, b, c, ans = 0;
	cin >> a >> b >> c;

	ans = c - (a - b);
	if (ans < 0) ans = 0;
	cout << ans << endl;

	return 0;
}


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

#define ALL(v) v.begin(), v.end()
#define V vector
#define P pair
using ll = long long;
using ld = long double;
using Graph = V<V<int>>;
const int MOD =  1000000007;
const ll INF = 1LL << 60;


int main() {
    ll a, b, c, k;
    cin >> a >> b >> c >> k;
    if(k & 1) cout << b - a << endl;
    else cout << a - b << endl;

    return 0;
}


Measured memory_bytes: 3576
import java.util.*;
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);

    int N = sc.nextInt();
    if(N % 2 == 0){
      System.out.println(N/2);
    }else{
      System.out.println(N/2+1);
    }
  }
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<vector<ll>>> vvvl;
struct edge{ll to,cost;};
const int inf = 1<<28;
//const ll INF = 1LL<<53;
const int COMBMAX = 500005;
const ll MOD = 1e9+7;
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<n;++i)
#define repf(i,n) for(int i=0;i<=n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define eachdo(v, e) for(const auto& e : v)
#define all(v) (v).begin(), (v).end()
#define lower_index(v, e) (ll)distance(v.begin(), lower_bound((v).begin(), (v).end(), e))
#define upper_index(v, e) (ll)distance(v.begin(), upper_bound((v).begin(), (v).end(), e))
ll mpow(ll a, ll n,ll mod=MOD){ll res=1;while(n>0){if(n&1)res=res*a%mod;a=a*a%mod;n>>=1;}return res;}
template<class T1, class T2> ll bcount(T1 v, T2 a){return upper_index(v,a)-lower_index(v,a);} 
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;}
template<class T> void debug(T v){rep(i,v.size()) cout<<v[i]<<" ";cout<<endl;}
template<class T> void debug2(T v){rep(i,v.size()){rep(j,v[i].size())cout<<v[i][j]<<" ";cout<<endl;}}
template<class T> void rdv(T &v){rep(i,v.size())cin>>v[i];}
template<class T> void rdvv(T &v){rep(i,v.size()){rep(j,v[i].size())cin>>v[i][j];}}
// multimap
// mmap.emplace(key,value);
// auto ngw = list.equal_range("");
// for(auto e = ngw.first; it != ngw.second ; ++e)


int main(){
    ll a,b,c; cin >> a >> b >> c;
    ll l = 4 * b * a;
    ll r = (c - a - b) * (c - a - b);
    if (0 <= c-a-b && l < r){
        cout << "Yes" << endl; 
    }else{
        cout << "No" << endl;
    }
    // cout << l << " "  << r << endl; 
}

Measured memory_bytes: 256
#include <bits/stdc++.h> 
using namespace std;
void pairsort(int a[], int b[], int n) 
{ 
    pair<int, int> pairt[n]; 
  
    // Storing the respective array 
    // elements in pairs. 
    for (int i = 0; i < n; i++)  
    { 
        pairt[i].first = a[i]; 
        pairt[i].second = b[i]; 
    } 
  
    // Sorting the pair array. 
    sort(pairt, pairt + n); 
      
    // Modifying original arrays 
    for (int i = 0; i < n; i++)  
    { 
        a[i] = pairt[i].first; 
        b[i] = pairt[i].second; 
    } 
} 
int main()
{
    int a[5],i,b[5],sum=0;
    for(i=0;i<5;i++)
    {
    scanf("%d",&a[i]);
    if(a[i]%10==0)
    b[i]=a[i]%10;
    else
    b[i]=10-(a[i]%10);
    }
    pairsort(b, a, 5);
    for(i=0;i<5;i++)
    {
        if(i<4)
    sum=sum+a[i]+b[i];
    else
    sum=sum+a[i];
    }
    printf("%d",sum);
    return 0;
}


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

#define MP make_pair
#define PB push_back
#define ST first
#define ND second

using namespace std;

typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<PII> VII;
typedef long long LL;

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

string s;
int n;

int main()
{
	init_ios();	
	cin >> s;
	n = s.size();
	if (s[0] == s.back())
		++n;
	if (n%2 == 1)
		cout<<"First\n";
	else
		cout<<"Second\n";
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define in(s) ll s; cin>>s
#define pr(r) cout<<r<<endl
#define prr(m,n) cout<<m<<" "<<n<<endl
#define prarr(a,i,n) fab(j,i,n) cout<<a[j]<<" "
#define wh(t) ll t; cin>>t; while(t--)
#define sz(u) u.size()
#define all(v) v.begin(),v.end()
#define arr(a,n) ll a[n]; fab(i,0,n) cin>>a[i]
#define showdp(d,n,m) fab(i,0,n){ fab(j,0,m) if(d[i][j]==-1 || d[i][j]>9) cout<<d[i][j]<<" "; else cout<<" "<<d[i][j]<<" "; cout<<endl; }
#define prs(u) cout<<u<<" "
#define fab(i,a,b) for(ll i=a;i<b;i++)
#define fba(i,b,a) for(ll i=b;i>=a;i--)
#define sup ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define MX 1000000007
#define MAX 10000007
#define endl "\n"
#define ll long long int
#define vl vector<ll>
#define vpl vector<pair<ll,ll>>
#define pl pair<ll,ll>
#define pll pair<ll,pl>
#define vvl vector<vl>
#define mxe(x,n) *max_element(x,x+n)
#define mne(x,n) *min_element(x,x+n)
#define mp make_pair
#define pb push_back
#define fs first
#define sd second
#define fr front()
#define bk back()
#define rr return
#define N 300005
#define inf 1e18+7
 
bool rsort1(const pair<ll,ll> &a,const pair<ll,ll> &b) { return (a.first > b.first);}
bool rsort2(const pair<ll,ll> &a,const pair<ll,ll> &b) { return (a.second>b.second);}
bool sort2(const pair<ll,ll> &a,const pair<ll,ll> &b){ return (a.second < b.second);}
 
bool isPrime(ll p)
{
    for(ll i=2;i*i<=p;i++)
        if(p%i==0)
            rr false;
    rr true;
}
 
void sieve(ll n,vl &v)
{
    v.pb(2);
    bool prime[n+1];
    memset(prime,true,sizeof(prime));
    for(ll i=3;i*i<=n;i+=2)
        if(prime[i])
            for(ll j=i;j*i<=n;j+=2)
                prime[j*i]=false;
        
    for(ll i=3;i<=n;i+=2)
        if(prime[i])
            v.pb(i);
}

ll phi(ll n)
{
    ll result=n;
    for(ll p=2;p*p<=n;p++)
    {
        if(n%p==0)
        {
            while(n%p==0)
                n/=p;
            result-=result/p;
        }
    }

    if(n>1)
        result-=result/n;
    return result;
}


int main()
{
	sup;
    
    ll n;
    cin>>n;
    ll mn,ans=0;
    arr(a,n);
    mn=a[0];
    fab(i,0,n)
    {
        if(a[i]<=mn)
            ans++;
        if(mn>a[i])
            mn=a[i];
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 1792
#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[i];
    }

    vector<int> dummy = A;

    vector<int>::iterator maxIt = max_element(A.begin(), A.end());
    size_t maxIndex = distance(A.begin(), maxIt);
    int max = *max_element(A.begin(), A.end());

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

    for (int i = 0; i < N; i++){
        if (i == maxIndex){
            cout << dummy[N-2] << endl;
        } else {
            cout << max << endl;
        }
    }

}


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

const int MOD = (int)1e9+7;

int main(){
  int N,C,K;
  cin >> N >> C >> K;
  vector<int> T(N);
  for(int i=0;i<N;i++)  cin >> T.at(i);

  sort(T.begin(),T.end());
  int ans=0;
  int st;
  int count=0;
  for(int i=0;i<N;i++){
    if(count==0 || count==C || st<T.at(i)){
      st=T.at(i)+K;
      count=1;
      ans++;
    }
    else  count++;
  }
  cout << ans << endl;

  return 0;
}


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

using namespace std;

int main()
{
	int x, n;
	cin >> x >> n;
	vector<int> a(201, 1);
	for (int i = 0; i < n; i++) {
		int b;
		cin >> b;

		a[b] = 0;
	}

	int diff = 1010101010;
	int ans = -100;
	for (int i = -100; i < 0; i++) {
		if (abs(x - i) < diff) {
			diff = abs(x - i);
			ans = i;
		}
	}
	for (int i = 0; i < 201; i++) {
		if (a[i] && abs(x - i) < diff) {
			diff = abs(x - i);
			ans = i;
		}
	}
	cout << ans << endl;

	return 0;
}

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

int main() {
	int N, A, B;	int ans = 0;	int a = 0;	int b = 0;	int c = 0;
	cin >> N;
	cin >> A >> B;
	int P[N];
	for (int i = 0; i < N; i++) {
		cin >> P[i];
	}

	for (int i = 0; i < N; i++) {
		if (P[i] <= A) {
			a += 1;
		}
		else if ((P[i] > A)&&(P[i]<=B)) {
			b += 1;
		}
		else   {
			c += 1;
		}
	}

	int sum = 0;

	if (a < b) {
		sum = a;
	}
	else {
		sum = b;
	}
	if (c < sum) {
		sum = c;
	}

	cout << sum << endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main()
{
  int n, i, p, q;
  long long int tired_num = 0LL;
  long long int a, b;

  scanf("%d%lld%lld", &n, &a, &b);

  scanf("%d", &p);
  for(i=1; i<n; i++){
    scanf("%d", &q);
    tired_num += ((q-p)*a<b ? (q-p)*a : b);
    p = q;
  }

  printf("%lld", tired_num);
  return 0;
}
    

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define ll long long
#define N 100005
using namespace std;
char s[100005];
int len;
bool check(int x){
	int tag=-1,flag=1;
	for (int i=1;i<=len;i++)
		if (i<=x&&len-i+1<=x){
			if (tag==-1) tag=s[i];
			if (tag!=s[i]) flag=0;
		}
	return flag;
}
int main(){
	scanf("%s",s+1);
	len=strlen(s+1);
	int l=1,r=len,ans=0;
	while (l<=r){
		int mid=(l+r)/2;
		if (check(mid))
			ans=mid,l=mid+1;
		else r=mid-1;
	}
	printf("%d\n",ans);
}

Measured memory_bytes: 512
#include <iostream>
//#include <set>
//#include <map>
//#include <vector>

typedef long long int lli;

using namespace std;

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

    for(int a=0; a<=100; a++)
        for(int b=0; b<=100; b++){
            if( 4*a+7*b>n )
                break;
            if( 4*a+7*b == n ){
                cout<<"Yes"<<endl;
                return 0;
            }
        }

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

Measured memory_bytes: 256
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "ctime"

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> Pll;
#define rep(begin, i, end) for (int i = begin; i < (int)(end); i++)
#define all(v) v.begin(), v.end()
const int MOD = 1000000007;

bool IsPrime(ll num)
{
    if (num < 2)
        return false;
    else if (num == 2)
        return true;
    else if (num % 2 == 0)
        return false; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (ll i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return false;
        }
    }

    // 素数である
    return true;
}

int main()
{
    ll N;
    cin >> N;
    vector<ll> A(N);
    map<ll, ll> mp;
    rep(0, i, N)
    {
        cin >> A.at(i);
        mp[A.at(i)]++;
    }
    sort(all(A));

    vector<ll> memo(1000100, 0);
    for (auto m : mp)
    {
        if (m.second > 1)
        {
            if (memo.at(m.first) == 1)
            {
                continue;
            }
            for (ll i = m.first; i <= 1000000; i += m.first)
            {
                memo.at(i) = 1;
            }
        }
    }

    ll ans = 0;

    rep(0, i, N)
    {
        if (memo.at(A.at(i)) == 1)
        {
            continue;
        }
        ans++;
        for (ll j = A.at(i); j <= 1000000; j += A.at(i))
        {
            if (memo.at(j) == 1)
            {
                continue;
            }
            memo.at(j) = 1;
        }
    }

    cout << ans << endl;
}


Measured memory_bytes: 24988
#include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;

int main() {
    ios_base::sync_with_stdio(0);
    int d, t, s; cin >> d >> t >> s;
    cout << (s*t>=d? "Yes": "No") << endl;
}


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

int main(){
    string str;
    cin >> str;
    int N = str.length();
    char a[N];
    for (int i = 0; i < N; i++) a[i] = str.c_str()[i];
    for (int i = 0; i < (N-1)/2; i++) {
        if(a[i] != a[N-1-i]) {
            cout << "No";
            return 0;
        }
    }
    for (int i = 0; i < (N-1)/4; i++) {
        if (a[i] != a[(N-1)/2-1-i]) {
            cout << "No";
            return 0;
        }
    }
    int sizeofb = N-(N+3)/2 + 1;
    char *b = &a[(N+3)/2-1];
    for (int i = 0; i < sizeofb/2;i++){
        if (b[i] != b[sizeofb-1-i]){
            cout << "No";
            return 0;
        }
    }
    cout << "Yes";
}

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

public class Main {

	final static long MOD = 1000000007L;
	public static String[] Ws = null;
	public static int wsIndx = 0;
	public static BufferedReader in = null;
	public static ArrayList<int[]> list = new ArrayList<>();
	public static void main(String[] args) throws Exception {


		long x=nextLong();
		long y=nextLong();
		long ans =Integer.MAX_VALUE;

		if(x<=y){
			ans=y-x;
		}
		if(-x<=y){
			ans=Math.min(ans, y-(-x)+1);
		}
		if(x<=-y){
			ans=Math.min(ans, -y-(x)+1);
		}
		if(-x<=-y){
			ans=Math.min(ans, -y-(-x)+2);
		}

		System.out.println(ans);
	}

	public static String[] toStringArray(String s) {
		String[] tmp = new String[s.length()];
		char[] c = s.toCharArray();
		for (int i = 0; i < tmp.length; i++) {
			tmp[i] = String.valueOf(c[i]);
		}
		return tmp;
	}

	public static String concatStringArray(String[] s){
		StringBuffer sb = new StringBuffer();
		for(String x:s){
			sb.append(x);
		}
		return sb.toString();
	}

	public static void check() throws Exception{
		if(in == null){
			in = new BufferedReader(new InputStreamReader(System.in));
		}
		if(Ws==null || Ws.length<=wsIndx){
			Ws = in.readLine().split(" ");
			wsIndx=0;
		}
	}
	public static int nextInt()throws Exception{
		check();
		return Integer.parseInt(Ws[wsIndx++]);
	}

	public static long nextLong()throws Exception{
		check();
		return Long.parseLong(Ws[wsIndx++]);
	}

	public static String nextString()throws Exception{
		check();
		return Ws[wsIndx++];
	}

	public static int[] nextInts()throws Exception{
		check();
		int[] tmp = new int[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Integer.parseInt(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static long[] nextLongs()throws Exception{
		check();
		long[] tmp = new long[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Long.parseLong(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static String[] nextStrings()throws Exception{
		check();
		wsIndx=Ws.length;
		return Ws;
	}


}

Measured memory_bytes: 22996
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include<limits.h>
#include<iomanip>
#define rep(i, n) for(int i = 0; i < n; i++)
#define rrep(i, n) for(int i = n-1; i >= 0; i--)
#define REP(i, m, n) for(int i = m; i < n; i++)
#define ALL(v) v.begin(),v.end()
#define RALL(v) v.rbegin(),v.rend()
#define check(v) rep(i,v.size()) cout << v[i] << " ";\
cout << endl
const long long LLINF = 1LL<<60;
const int INF = 1e9;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
typedef long long ll;
#define pint pair<int,int>
using namespace std;
//オーバーフローに気をつけろよおおおおおお
//確認忘れるなよおおおおおお

vector<int> tree[100005];
int u_can[100005];
int v_can[100005];

void dfs_v(int now, int pre, int cost) {
    if(tree[now].size()==1 && tree[now][0]==pre) {
        v_can[now] = cost;
        return;
    }
    rep(i,tree[now].size()) {
        if(tree[now][i]==pre) continue;
        dfs_v(tree[now][i], now, cost+1);
    }
}

void dfs_u(int now, int pre, int cost) {
    if(tree[now].size()==1 && tree[now][0]==pre) {
        u_can[now] = cost;
        return;
    }
    rep(i,tree[now].size()) {
        if(tree[now][i]==pre) continue;
        dfs_u(tree[now][i], now, cost+1);
    }
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n, u, v; cin >> n >> u >> v;
    u--; v--;
    rep(i,n-1) {
        int a, b; cin >> a >> b;
        a--; b--;
        tree[a].push_back(b);
        tree[b].push_back(a);
    }
    dfs_v(v,-1,0);
    dfs_u(u,-1,0);

    int ans = 0;
    rep(i,n) {
        if(v_can[i]>u_can[i]) {
            chmax(ans,v_can[i]-1);
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 11648