akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using VI = vector<int>;
using VL = vector<ll>;
template<class T> using PQ = priority_queue<T, vector<T>, greater<T>>;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);++(i))
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);++(i))
#define rFOR(i,a,n) for(int (i)=(n)-1;(i)>=(a);--(i))
#define erFOR(i,a,n) for(int (i)=(n);(i)>=(a);--(i))
#define each(i, a) for(auto &i : a)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
#define out(y,x) ((y) < 0 || h <= (y) || (x) < 0 || w <= (x))
#define line cout << "------------------------\n" 
#define ENDL(i,n) ((i) == (n) - 1 ? "\n" : " ")
//#define stop system("pause") //comment out this on AOJ.
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
constexpr ld eps = 1e-10; //1e-9?
constexpr ld pi = 3.1415926535897932;
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; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }
template<class T>inline istream& operator>>(istream& is, vector<T>& v) { for (auto& elemnt : v)is >> elemnt; return is; }
template<class T, class U>inline istream& operator>>(istream& is, pair<T, U>& p) { is >> p.first >> p.second; return is; }
template<class T>inline vector<T> vec(size_t a) { return vector<T>(a); }
template<class T>inline vector<T> defvec(T def, size_t a) { return vector<T>(a, def); }
template<class T, class... Ts>inline auto vec(size_t a, Ts... ts) { return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...)); }
template<class T, class... Ts>inline auto defvec(T def, size_t a, Ts... ts) { return vector<decltype(defvec<T>(def, ts...))>(a, defvec<T>(def, ts...)); }

int main() {
    init();

    int n, k; cin >> n >> k;
    VL a(n), x(n), y(n); cin >> a;
    // y < 0 < x
    FOR(i, 0, n) {
        if (0 < a[i])x[i] += a[i];
        if (a[i] < 0)y[i] += a[i];
        if (0 < i) {
            a[i] += a[i - 1];
            x[i] += x[i - 1];
            y[i] += y[i - 1];
        }
    }

    ll ans = -LLINF;
    FOR(i, k - 1, n) {
        ll sum = x[n - 1] - x[i] + (0 <= i - k ? x[i - k] : 0);
        ll p = a[i] - (0 <= i - k ? a[i - k] : 0);
        if (0 < p)sum += p;
        chmax(ans, sum);
    }

    cout << ans << "\n";
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using ll = long long;
using vec = vector<ll>;
using vec2 = vector<vector<ll>>;
ll inf = pow(2,62);

ll yakusuu(ll x){
    ll sum = 0;
    for(int i = 1;i <= x;i++){
        if(x%i == 0){
            sum++;
        }
    }
    //約数の個数
    return sum;
}

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

Measured memory_bytes: 3684
def distance_from(x, N, adj):
    ret = [-1] * N
    ret[x] = 0
    q = [x]
    while len(q):
        cur = q.pop()
        for nxt in adj[cur]:
            if ret[nxt] != -1:
                continue
            ret[nxt] = ret[cur] + 1
            q.append(nxt)
    return ret


def main():
    N = int(input())
    adj = [set() for _ in range(N)]
    for _ in range(N-1):
        a, b = map(int, input().split())
        adj[a-1].add(b-1)
        adj[b-1].add(a-1)
    dist = distance_from(0, N, adj)
    idx = 0
    for i in range(N):
        if dist[i] > dist[idx]:
            idx = i
    diameter = max(distance_from(idx, N, adj))
    if diameter % 3 == 1:
        print("Second")
    else:
        print("First")


if __name__ == "__main__":
    main()


Measured memory_bytes: 121292
#include <cstdio>
#include <cstring>
#include <cmath>
#include <utility>
#include <iostream>
#include <functional>
#include <bitset>
#include <algorithm>
#include <vector>
#include <forward_list>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <numeric>
#define ll long long int
#define pb push_back
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
int mx4[] = {0,1,0,-1};
int my4[] = {1,0,-1,0};
int INF = 2e6;
ll MOD = 1e9 + 7;

int main(){
    string s; cin >> s;
    int n = s.size();

    int ans = 0;
    for(int i = 0; i < n - 1; i++){
        if(s[i+1] != s[i]) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A,B;
  cin >> A >> B;
  if ((A+B)%2==0) {
    cout << (A+B)/2 << endl;
  }
  else {
    cout << (A+B+1)/2 << endl;
  }
}

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

int main() {
	
	int n,m; cin>>n>>m;
	vector<int>a(n);
	double sum{};
	for(int i=0; i<n; i++) {
		cin>>a.at(i);
		sum+=a.at(i);
	}
	sort(a.rbegin(),a.rend());
	if(a.at(m-1)>=sum/4/m) cout <<"Yes"<<endl;
	else cout << "No" <<endl;
	
	
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
  int i, j, k;
  int x[3];
  scanf("%d", &i);

  x[0] = i / 100;
  x[1] = i / 10 - x[0] * 10;
  x[2] = i - x[0] * 100 - x[1] * 10;

  for(i = 0; i <= 2; i++){
	if(x[i] == 1){
	  x[i] = 9;
	}else {
	  x[i] = 1;
	}
  }

  printf("%d\n", x[0]*100 + x[1]*10 + x[2]);
  return 0;
}


Measured memory_bytes: 128
import sys

def main():
    input = sys.stdin.readline
    S = input()
    
    l = []
    #even
    l.append([v for k, v in enumerate(S) if k % 2 == 0]) 
    #odd
    l.append([v for k, v in enumerate(S) if k % 2 == 1])
    
    ans = []
    #01
    ans.append(l[0].count('0') + l[1].count('1'))
    #10
    ans.append(l[0].count('1') + l[1].count('0'))
    
    print(min(ans))
    
    
if __name__ == '__main__':
    main()

Measured memory_bytes: 4120
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPR(i, n) for (int i = n - 1; 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 ALL(v) (v).begin(),(v).end()
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const ll INF=1LL<<60;
const int inf=(1<<30)-1;
const int mod=1e9+7;
int dx[8]={1,0,-1,0,-1,-1,1,1};
int dy[8]={0,1,0,-1,-1,1,-1,1};
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;cin >> n;
    vector<ll> x(n),y(n),p(n);
    REP(i,n){
        cin >> x[i] >> y[i] >> p[i];
    }
    vector<vector<ll>> hp(1<<n,vector<ll>(n)),wp(1<<n,vector<ll>(n));
    REP(t,1<<n){
        vector<int> h;
        h.push_back(0);
        REP(i,n){
            if(t&(1<<i)){
                h.push_back(x[i]);
            }
        }
        REP(i,n){
            ll res=INF;
            REP(j,h.size()){
                chmin(res,abs(h[j]-x[i]));
            }
            hp[t][i]=res;
        }
    }
    REP(t,1<<n){
        vector<int> w;
        w.push_back(0);
        REP(i,n){
            if(t&(1<<i)){
                w.push_back(y[i]);
            }
        }
        REP(i,n){
            ll res=INF;
            REP(j,w.size()){
                chmin(res,abs(w[j]-y[i]));
            }
            wp[t][i]=res;
        }
    }
    vector<ll> ans(n+1,INF);
    ll T=1;
    REP(i,n){
        T*=3;
    }
    REP(t,T){
        int u=0,v=0;
        int cnt=0;
        int num=t;
        REP(i,n){
            if(num%3==2){
                cnt++;
                u+=1<<i;
            }
            else if(num%3==1){
                cnt++;
                v+=1<<i;
            }
            num/=3;
        }
        ll res=0;
        REP(i,n){
            res+=min(hp[u][i],wp[v][i])*p[i];
        }
        chmin(ans[cnt],res);
    }
    REP(i,n+1){
        cout << ans[i] << endl;
    }
}


Measured memory_bytes: 12972
#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
// #include <numeric>
#include <complex>

#define FAST ios_base::sync_with_stdio(false); cin.tie(0)
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define repr(i, a, b) for(int i=int(a); i>=int(b); i--)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
typedef long long int ll;
#define iceil(x,y) (x+y-1)/y

using namespace std;
typedef pair<int, int> P;

int main() {
	FAST;

	int a, b, c;
	int k;

	cin >> a >> b >> c >> k;
	
	cout << a+b+c+max({a,b,c})*((1<<k) - 1) << "\n";

	return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {

    void run() {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt(), k = sc.nextInt();
        long MOD = (long) 1e9 + 7;

        List<Integer> units = new ArrayList<>();
        List<Integer> counts = new ArrayList<>();

        for (int i = 1; i * i <= n; i++) {
            units.add(i);
        }

        List<Integer> unitsRev = new ArrayList<>();
        for (int i = 1; i * i < n; i++) {
            if (i != n / i) unitsRev.add(n / i);
        }
        Collections.reverse(unitsRev);
        units.addAll(unitsRev);

        int size = units.size();
        counts.add(1);
        for (int i = 1; i < size; i++) {
            counts.add(units.get(i) - units.get(i - 1));
        }

        long[][] dp = new long[k][size];

        for (int j = 0; j < size; j++) {
            dp[0][j] = 0;
        }

        for (int j = 0; j < size; j++) {
            dp[1][j] = counts.get(j) * (n / units.get(j)) % MOD;
        }

        for (int i = 2; i < k; i++) {
            dp[i][size - 1] = counts.get(size - 1) * dp[i - 1][0] % MOD;
            long[] sums = new long[size];
            sums[0] = dp[i - 1][0];
            for (int l = 1; l < size; l++) {
                sums[l] = (sums[l - 1] + dp[i - 1][l]) % MOD;
            }
            for (int j = size - 2; j >= 0; j--) {
                dp[i][j] = counts.get(j) * sums[size - j - 1] % MOD;
            }
        }

        long ans = 0;
        for (int j = 0; j < size; j++) {
            ans = (ans + dp[k - 1][j]) % MOD;
        }
        System.out.println(ans);

    }

    void debug(Object... os) {
        System.err.println(Arrays.deepToString(os));
    }

    public static void main(String[] args) {
        new Main().run();
    }
}


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

#define fio                           \
	ios_base::sync_with_stdio(false); \
	cin.tie(NULL);                    \
	cout.tie(NULL);
#define ll long long
#define ull unsigned long long
#define ld long double
#define endl "\n"
#define ff first
#define ss second
#define pi pair<ll, ll>
#define PI 3.141592653589793238462643383279502884L
#define mp make_pair
#define pb push_back
#define fall(i, a, b) for (int i = a; i < b; i++)
#define sz(x) (ll) x.size()
#define all(x) x.begin(), x.end()
#define ed cout << "ed";
ll MOD = 1e9 + 7;
ll MOD1 = 1e9 + 123;
ll MOD2 = 1e9 + 321;
ll co(vector<vector<char>> &v, int h, int w, int r, int c)
{
	ll f = 0;
	for (int i = 0; i < h; i++)
		for (int j = 0; j < w; j++)
			if ((r & (1 << i)) && (c & (1 << j)) && v[i][j] == '#')
				f++;
	return f;
}
int main()
{
	fio;
	ll t, a, n, q, k, i, m, c, u, f, j, p, r, x, y, s, b, d;
	ll h, w;
	cin >> h >> w >> k;
	c = 0;
	vector<vector<char>> v(h, vector<char>(w, 0));
	for (int i = 0; i < h; i++)
		for (int j = 0; j < w; j++)
			cin >> v[i][j];
	for (int i = 0; i < (1 << h); i++)
		for (int j = 0; j < (1 << w); j++)
			if (co(v, h, w, i, j) == k)
				c++;
	cout << c;
	return 0;
}


Measured memory_bytes: 3652
#include <iostream>
#include <vector>
using namespace std;
int main(void){
  int n;
  cin >> n;

  vector<int>a(n + 1,0);

  for(int i=1;i<n + 1;i++){
    cin >> a[i];
  }

  vector<int>ans(n + 1,0);

  for(int i=n;i>n/2;i--){
    ans[i] = a[i];
  }

  for(int i=n/2;i>=1;i--){
    int sum = 0;
    for(int j = i * 2;j <= n;j = j + i){
      sum += ans[j];
    }
    ans[i] = (sum % 2 + a[i]) % 2;
  }

  int count = 0;

  for(int i=1;i<n + 1;i++){
    if(ans[i] == 1)
    count++;
  }

  cout << count << endl;
  for(int i=1;i<n + 1;i++){
    if(ans[i] == 1)
      cout << i << " ";
    }
    cout << endl;

    return 0;
  }


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

al = list(map(int,input().split()))
bl = list(map(int,input().split()))
minbl = min(bl)
min_bl = [minbl for i in range(a)]
for _ in range(m):
    x,y,c = map(int,input().split())
    min_bl[x-1] = min(min_bl[x-1], bl[y-1] - c)

ans = float("inf")
for a,b in zip(al, min_bl):
    ans = min(a+b, ans)
print(ans)







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

using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
#define int ll
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<vvc> vvvc;
typedef pair<int, int> pii;
typedef pair<pii, pii> piii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector< vi > vvi;
typedef vector< vvi > vvvi;
typedef vector<short> vs;
typedef vector<vs> vvs;
typedef vector<vvs> vvvs;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef vector<ld> vld;
typedef vector<vld> vvld;
typedef vector<vvld> vvvld;
typedef vector<string> vst;
typedef vector<vst> vvst;
typedef pair<ld, ld> pld;

#define inmin(a, b) a = min(a, (b))
#define inmax(a, b) a = max(a, (b))
#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()
#define sqr(x) ((x) * (x))
#define fori(i, n) for(int i = 0; i < int(n); ++i)
#define SZ(a) ((int)((a).size()))
#define triple(T) tuple<T, T, T>
#define quad(T) tuple<T, T, T, T>
#define watch(x) cerr << (#x) << " = " << (x) << endl;

#ifdef RUS_HOME
#define cerr cout
#else
#define cerr if (false) cerr
#endif

const double PI = 2 * acos(0.0);
#define rand shittttty_shit
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
mt19937_64 rng_64(chrono::steady_clock::now().time_since_epoch().count());

const string DIGITS = "0123456789";
const string ALPH = "abcdefghijklmnopqrstuvwxyz";


template <class T0, class T1>
inline ostream & operator << (ostream &out, pair<T0, T1> &a) {
    return out << "{" << a.first << ", " << a.second << "}";
}

template <class T0, class T1>
inline istream & operator >> (istream &in, pair<T0, T1> &a) {
    return in >> a.first >> a.second;
}

template <class T0, class T1, class T2>
inline ostream & operator << (ostream &out, tuple<T0, T1, T2> &a) {
    return out << "{" << get<0>(a) << ", " << get<1>(a) << ", " << get<2>(a) << "}";
}

template <class T0, class T1, class T2, class T3>
inline ostream & operator << (ostream &out, tuple<T0, T1, T2, T3> &a) {
    return out << "{" << get<0>(a) << ", " << get<1>(a) << ", " << get<2>(a) << ", " <<  get<3>(a) << "}";
}

template<class T>
inline ostream & operator << (ostream &out, vector<T> &a) {
    out << "[";
    fori (i, a.size())
        out << a[i] << vector<string>{", ", "]  "}[i + 1 == a.size()];
    return out;
}


void smain();



signed main() {
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
#ifdef RUS_HOME
    freopen("input", "r", stdin);
    //freopen("output.txt", "w", stdout);
    clock_t start = clock();
#endif
    cout << setprecision(12) << fixed;
    smain();
#ifdef RUS_HOME
    cout << "\n\n\n\nTOTAL EXECUTION TIME: " << float( clock () - start ) /  CLOCKS_PER_SEC << endl;
#endif
    return 0;
}

const int MOD=1e9+7,N=1e5,M=18,oo=1e9;



void smain() {

    int n;
    cin>>n;
    int ans=1,c9=1,c8=1;
    for(int i=0;i<n;i++){
        ans=ans*10%MOD;
        c9=c9*9%MOD;
        c8=c8*8%MOD;
    }
    cout<<(ans-c9-c9+c8+MOD+MOD)%MOD;

}



Measured memory_bytes: 3660
#include <iostream>
#include <cmath>
#include <string>
#include <numeric>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <limits>
using namespace std;
#define MOD 1000000007
#define INF 1000000009
#define ll long long
#define rep(i_, start, end) for(ll i_=(ll)start; i_<(ll)end; i_++)
#define print(a) cout << a << endl;
#define printarray(a, len) rep(ii,0,len) cout << a[ii] << " ";
#define printarray2(aa, len) rep(ij,0,len) printarray(aa[ij], aa[ij].size()); print("");
 
ll lst[10][10] = {};
int main()
{
  ll n, ans=0;
  int x, y;
  string s;
  cin >> n;

  rep(i, 1, n+1){
    s = to_string(i);
    x = (int)(s[0]) - '0';
    y = (int)(s[s.size()-1]) - '0';
    lst[x][y] += 1;
  }
  /*
  rep(i, 1, 10){
    rep(j, 1, 10){
      cout << lst[i][j] << " ";
    }cout<<endl;
  }
  */
  rep(i, 1, 10){
    rep(j, 1, i+1){
      if (i == j){
        ans += lst[i][j] * lst[i][j];
      }else{
        if (lst[i][j] > 0 && lst[j][i] > 0){
          ans += lst[i][j] * lst[j][i] * 2;
        }
      }
    }
  }
  print(ans);

  return 0;
}

Measured memory_bytes: 256
using System;

class ACBC1208_A
{
    public static void Main()
    {
        var ss = Console.ReadLine().Split(' ');
        int i = 0;
        foreach(var s in ss)
            i += int.Parse(s);
        if (i < 22) Console.WriteLine("win");
        else Console.WriteLine("bust");
    }
}

Measured memory_bytes: 13140
#include "bits/stdc++.h"
#define int long long
#define REP(i, s, n) for (signed i = (s); i < signed(n); i++)
#define rep(i, n) REP(i, 0, n)
#define all(c) (c).begin(), (c).end()


const int INF = 1 << 29;

using namespace std;

using VV = vector<vector<int>>;
using V = vector<int>;
using P = pair<int, int>;
using IP = pair<int, P>;

int dr[] = { 0, 1, 0, -1 };
int dc[] = { -1, 0, 1, 0 };
const int MOD = 1000000007;

signed main() {

	int n;

	while (cin >> n && n)
	{
		vector<P> vec(n);
		vec[0] = P(0, 0);
		int minr = 0, minc = 0;
		int maxr = 0, maxc = 0;
		REP(i, 1, n) {
			int idx, dir; cin >> idx >> dir;
			P p = vec[idx];
			P np = P(p.first + dr[dir], p.second + dc[dir]);
			minr = min(minr, np.first);
			minc = min(minc, np.second);
			maxr = max(maxr, np.first);
			maxc = max(maxc, np.second);
			vec[i] = np;
		}

		cout << maxc - minc + 1 << " " << maxr - minr + 1 << endl;

	}
	
}

Measured memory_bytes: 3000
N,M = map(int,input().split())

N,M = min(N,M),max(N,M)
Ans = 0
if N==1 and M==1:
    Ans = 1
elif N==1:
    Ans = M-2
elif N==2:
    Ans = 0
else:
    Ans = (N-2)*(M-2)

print(Ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, from, to) for (int i = from; i < (to); ++i)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
using ll = long long;
using vin=vector<int>;
using vll=vector<ll>;
using P = pair<int, int>;
const int inf=1e9+7;
const ll INF=1e18;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }

int main() {
  double x,t;
  cin>>x>>t;
  cout<<double(x/t)<<endl;
}









Measured memory_bytes: 256
N = int(input())
cnt = 0
flag = 0
for i in range(N):
    d1,d2 = map(int,input().split())
    if d1 == d2:
        cnt += 1
        if cnt == 3:
            flag = 1
    else:
        cnt = 0
if flag == 1:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 9172
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rng(i, a, b) for (int i = int(a); i < int(b); i++)
#define rep(i, b) rng(i, 0, b)
#define gnr(i, a, b) for (int i = int(b) - 1; i >= int(a); i--)
#define per(i, b) gnr(i, 0, b)
#define bg begin()
#define ed end()
#define all(x) x.bg, x.ed
#define vi vector<int>
template <class t, class u>
bool chmax(t &a, u b)
{
    if (a < b)
    {
        a = b;
        return true;
    }
    return false;
}
template <class t, class u>
bool chmin(t &a, u b)
{
    if (b < a)
    {
        a = b;
        return true;
    }
    return false;
}

signed main()
{
    int n, m, k;
    cin >> n >> m >> k;
    vector<ll> a(n);
    vector<ll> b(m);
    vector<ll> c(n + 1);
    vector<ll> d(m + 1);
    rep(i, n)
    {
        cin >> a[i];
        if (i == 0)
        {
            c[i] = 0;
        }
        else
        {
            c[i] = c[i - 1] + a[i - 1];
        }
    }
    c[n] = c[n - 1] + a[n - 1];
    rep(i, m)
    {
        cin >> b[i];
        if (i == 0)
        {
            d[i] = 0;
        }
        else
        {
            d[i] = d[i - 1] + b[i - 1];
        }
    }
    d[m] = d[m - 1] + b[m - 1];
    //    cout << c[n] << d[m] << endl;
    if (k > c[n] + d[m])
    {
        cout << n + m << endl;
    }
    else
    {
        int ans = 0;
        rep(i, n + 1)
        {
            if (c[i] > k)
            {
                break;
            }
            else
            {
                int rest = k - c[i];
                if (rest > d[m])
                {
                    chmax(ans, i + m);
                }
                else
                {
                    auto it = lower_bound(all(d), rest + 1);
                    //                    cout << rest << " " << i << " " << it - d.begin() << endl;
                    chmax(ans, i + (it - d.begin()) - 1);
                }
            }
        }
        cout << ans << endl;
    }

    return 0;
}

Measured memory_bytes: 9540
#include <iostream>
using namespace std;
int main(){
    int n;
    cin >> n;
    int i = 1;
    for(i; i <= n; i++){
        int x = i;
        if(x % 3 == 0) {
            cout << " " << i;
        }else{
            do {
                if (x % 10 == 3) {
                    cout << " " << i;
                    break;
                }
                x /= 10;
            }while(x);
        }
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 3100
#include<bits/stdc++.h>
using namespace std;
const int maxn=100100;
bool vis[maxn];
char str[maxn];
int main(){
//	freopen("A.in","r",stdin);
	int n;
	scanf("%s",str+1);
	n=strlen(str+1);
	if(n<26){
		for(int i=1;i<=n;i++)
			vis[str[i]-'a']=1;
		for(int i=0;i<26;i++){
			if(!vis[i]){
				str[++n]=i+'a';
				str[n+1]=0;
				break;
			}
		}
		printf("%s\n",str+1);
		return 0;
	}
	for(int i=n;i>=1;i--){
		bool bo=0;
		for(int j=str[i]-'a';j<26;j++){
			if(vis[j]){
				str[i]=j+'a';
				str[i+1]=0;
				bo=1;
				break;
			}
		}
		if(bo) break;
		vis[str[i]-'a']=1;
		if(i==1){
			printf("-1\n");
			return 0;
		}
	}
	printf("%s\n",str+1);
	return 0;
}


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


int main(){
    int N, p;
    int count = 0;

    std::cin >> N;
    for(int i = 0; i < N; i++){
        std::cin >> p;
        if(p != i + 1){
            count++;
        }
    }

    if(count <= 2){
        std::cout << "YES";
    }else{
        std::cout << "NO";
    }
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
#define ll long long
#define rep(X,N) for(ll X = 0; X < (N); X++)
#define bitrep(X,N) for(ll X = 0; X < (1 << (N)); X++)
#define PI (acos(-1.0))
#define sorta(V) sort(V.begin(), V.end())
#define pback push_back
#define mpair make_pair
#define MODN 1000000007
#define ALL(V) (V).begin(),(V).end() 
#define CERR if(false) cerr

using namespace std;


int main(){

    int n,d,x;
    cin >> n;
    cin >> d >> x;

    int ans = 0;
    
    rep(i,n){
        int tmp;
        cin >> tmp;

        int day = 1;

        do{
            ans++;
            day = day + tmp;
        }while(day <= d);
    }

    cout << ans + x << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int i=0, i##_lim=(n); i<i##_lim; ++i)
#define FOR(i, a, b) for (int i=(a), i##_lim=(b); i<i##_lim; ++i)
#define mp make_pair
#define pb push_back
using namespace std;
using ll = long long;
using pi = pair<int, int>;

int main()
{
    int N, K;
    cin >> N >> K;
    cout << (N-K+1) << endl;
    return 0;
}

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

typedef long long int ll;

//const double PI=3.14159265358979323846;

int main () {
    int n; cin >> n;
    set<string> s;
    for (int i = 0; i < n; i++) {
        string tmp; cin >> tmp;
        s.insert(tmp);
    }
    cout << s.size() << endl;

    return 0;
}

Measured memory_bytes: 15596
import java.util.*;

public class Main {

    public static void main(String[] args) {
        exec();
    }

    static void exec() {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();

        long[] a = new long[n];
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextLong();
            if (a[i] == 0) {
                System.out.println(0);
                System.exit(0);
            }
        }
        long ans = 1;
        long d = 1000000000000000001L;
        try {
            for (int i = 0; i < n; i++) {
                ans = Math.multiplyExact(ans , a[i]);
                if(ans >= d) {
                    System.out.println(-1);
                    System.exit(0);
                }
            }
        }
        catch (Exception e) {
            System.out.println(-1);
            System.exit(0);
        }
        System.out.println(ans);
   }
}

Measured memory_bytes: 49648
N = input()

hon = [2, 4, 5, 7, 9]
pon = [0, 1, 6, 8]
bon = [3]

if int(N[-1]) in hon:
    print('hon')
elif int(N[-1]) in pon:
    print('pon')
elif int(N[-1]) in bon:
    print('bon')

Measured memory_bytes: 9188
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <numeric>
using namespace std;
string each_digit(long long num, long long count) {
  long long n = num;
  int p=0;
  string ans = "";
  vector<char> str(count, 'a');
  vector<long long> surp(count);
  while (n) {
    surp[p] = n%26;
    n /= 26;
    p++;
  }
  for (int i=count-1; i>=0; i--) {
    ans += (char)(str[i]+surp[i]);
  }
  
  return ans;
};

int main() {
  long long n;
  long long alp_count = 26, base_count = 1;
  string val;
  cin >> n;
  while (1) {
    if (n>alp_count) {
      n -= alp_count;
      alp_count *= 26;
      base_count++;
    } else {
      // cout << base_count << endl;
      cout << each_digit(n-1, base_count) << endl;
      break;
    }
  }
  // cout << (char)('a'+5) << endl;
}

Measured memory_bytes: 3100
from math import ceil
n,k=map(int,input().split())
a=list(map(int,input().split()))
l,r=0,10**9
while r-l>1:
    m=(r+l)//2
    count=0
    for i in a:
        count+=ceil(i/m)-1
    if count<=k:
        r=m
    else:
        l=m
print(r)

Measured memory_bytes: 31052
#include <iostream>

using namespace std;

int main() {
  int r, g, b, n;
  cin >> r >> g >> b >> n;
  int ans = 0;
  for (int i = 0; i <= 3000; ++i) {
    for (int j = 0; j <= 3000; ++j) {
      int k = (n - (i * r + j * g)) / b;
      if (0 <= k && r * i + g * j + b * k == n)
        ++ans;
    }
  }
  cout << ans << endl;
}


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

int main(){
    using namespace std;

    vector<unsigned long> digits;
    {
        string K;
        cin >> K;
        transform(begin(K), end(K), back_inserter(digits), [](char c){return c - 48;});
    }

    unsigned long D, N{digits.size()};
    cin >> D;

    vector<vector<vector<unsigned long>>> dp(N + 1, vector<vector<unsigned long>>(2, vector<unsigned long>(D, numeric_limits<unsigned long>::max())));

    cout << [dfs_impl = [&digits, &D, &N, &dp](auto f, unsigned long d, unsigned long l, unsigned long x) -> unsigned long {
        if(dp[d][l][x] + 1UL)return dp[d][l][x];
        if(d == N)return dp[d][l][x] = x ? 0 : 1;
        if(l){
            unsigned long ret{0};
            for(unsigned long i{0}; i < 10; ++i)ret += f(f, d + 1, l, (x + i) % D);
            return dp[d][l][x] = ret % 1000000007;
        }else{
            unsigned long ret{0};
            for(unsigned long i{0}; i <= digits[d]; ++i)ret += f(f, d + 1, i < digits[d], (x + i) % D);
            return dp[d][l][x] = ret % 1000000007;
        }
    }]{return (dfs_impl(dfs_impl, 0, 0, 0) + 1000000006) % 1000000007;}() << endl;

    return 0;
}

Measured memory_bytes: 22912
a,b=(int(x)-1 for x in input().split())
L=[]
for i in range(b+1):
    L.append(list(map(int,input().split())))
L.sort(key=lambda x:x[1]) 
ans=0
bridge_right=-1
#区間スケジューリング問題：終端でソート！（始端の場合も）
#終端が小さい方から見ていって、解決されてないときは一番右の橋を壊す←「一番右で損しない」が区間スケジューリングの性質
for l in L:
    if not l[0]<=bridge_right<l[1]:
        bridge_right=l[1]-1
        ans+=1
print(ans)

Measured memory_bytes: 29080
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rep1(i,n) for (int i = 1; i <= (n); ++i)

using namespace std;
using ll = long long;
using P = pair<int,int>;
using ull= unsigned long long;
const ll K_MAX=1e5+5;





int main(){
  ll n,p;
  string s;
  vector<ll> u(n);
  cin >>n>>p>>s;
  
  if(10%p==0){// p=2,5の場合
    ll ans =0;
    rep(i,n){
      if((s[i]-'0')%p==0){
        ans +=i+1;
      }
    }
    cout<<ans<<endl;
    return 0;
  }
  
  
  //uの準備
  int ten =1;
  for(int i=n-1; i>=0;--i){
    int  a=(s[i]-'0')*ten%p;
    u[i]= (u[i+1]+a)%p;
    ten=10*ten%p;
  }
  
  vector<int> cnt(p);
  
  ll ans=0;
  
  for (int i=n; i>=0;--i){
    ans+=cnt[u[i]];
    cnt[u[i]]++;
  }
  
  cout<<ans<<endl;
  return 0;

}


Measured memory_bytes: 49796
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <bitset>

using namespace std;

/*
#ifdef LOCAL
	#define eprintf(...) fprintf(stderr, __VA_ARGS__);fflush(stderr);
#else
	#define eprintf(...) 42
#endif
*/
#define pb push_back
#define mp make_pair

typedef long long int ll;

float ans = 0;

ll GCD(ll a, ll b){
	while(b){
		a %= b;
		swap(a,b);
	}
	return a;
}

void solve(){
	int h,w,a,b;
	scanf("%d%d%d%d",&h,&w,&a,&b);
	int v[h][w];
	for(int i=0; i<h; i++){
		for(int j=0; j<w; j++) v[i][j] = 0;
	}

	for(int i=0; i<b; i++){
		for(int j=0; j<w; j++) v[i][j] = 1;
	}

	for(int i=0; i<h; i++){
		for(int j=0; j<a; j++){
			if(v[i][j]==1) v[i][j] = 0;
			else v[i][j] = 1;
		}
	}

	for(int i=0; i<h; i++){
		for(int j=0; j<w; j++) cout<<v[i][j];
		cout<<endl;
	}
}


int main(int argc, char const *arga[])
{	
	ll cant;
	//scanf("%lld",&cant);
	cant = 1;
	while(cant--) solve();
}

Measured memory_bytes: 5120
#include <stdio.h>

int main(void){
 int i = 0,m = 0,a = 0,b = 0,c = 0;
 char s[4];
 
 scanf("%s",s);
 
 for(m = 0;m < 3;m++){
  if(s[m] == 'a'){
   a++;
  }
  if(s[m] == 'b'){
   b++;
  }
  if(s[m] == 'c'){
   c++;
  }
 }
 
 if(a == 1 && b == 1 && c == 1){
  printf("Yes\n");
 }else{
  printf("No\n");
 }
 
 return 0;
}


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

using namespace std;

int main(void) {
    int N, tmp, count = 0;
    vector<int> p;
    cin >> N;
    for (int i = 0; i < N; i++) {
        cin >> tmp;
        p.push_back(tmp);
    }
    for (int i = 0; i < N; i++) {
        int mini = i;
        for (int j = i; j < N; j++) {
            if (p[j] < p[mini]) mini = j;
        }
        if (i != mini) {
            int tmp2 = p[i];
            p[i] = p[mini];
            p[mini] = tmp2;
            count++;
        }
    }
    for (int i = 0; i < N-1; i++) {
        cout << p[i] << " ";
    }
    cout << p[N-1] << endl;
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 1216
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc= new Scanner(System.in);
		int r=sc.nextInt(); int c=sc.nextInt(); int k=sc.nextInt();
		int[][] grid= new int[r][c];
		int ans=Integer.MAX_VALUE;
		for(int i=0;i<r;i++) {
			String s=sc.next();
			for(int j=0;j<c;j++)
				grid[i][j]=s.charAt(j)-'0';
		}
		for(int mask=0;mask<(1<<(r-1));mask++) {
			int[][] arr= new int[countOnes(mask)+1][c];
			int maxValue=0;
			for(int i=0;i<c;i++) {
				int j=0; int y=0;
				for(int shift=0;shift<r;shift++,y++) {
					arr[j][i]+=grid[y][i];
					maxValue=Math.max(maxValue, arr[j][i]);
					if(((1<<shift)&mask)!=0)
						j++;
				}
			}
			if(maxValue>k)
				continue;
//			System.out.println(Arrays.deepToString(arr));
			int cuts=arr.length-1;
			for(int i=0;i<c-1;i++) {
				if(needsCut(i,arr,k))
					cuts++;
				else
					for(int j=0;j<arr.length;j++) 
						arr[j][i+1]+=arr[j][i];
			}
			ans=Math.min(cuts,ans);
			}
		System.out.println(ans);
	}
	public static int countOnes(int x) {
		int count=0;
		for(int i=1;i<=x;i<<=1)
			if((i&x)!=0)
				count++;
		return count;
	}
	public static boolean needsCut(int c, int[][] arr, int k) {
		for(int i=0;i<arr.length;i++)
			if(arr[i][c]+arr[i][c+1]>k)
				return true;
		return false;
	}
}



Measured memory_bytes: 34772
def get_n(k, K):
    ruijo = k

    if k >= K:
        return 0

    for i in range(1, 1000000):
        ruijo = ruijo * 2
        if ruijo >= K:
            return i

    return -1


N, K = map(int, input().split())

p = 0

for i in range(1, N+1):
    tmp = float(1/N) * float(1/2)**(int(get_n(i, K)))
    p = p + tmp

print(p)


Measured memory_bytes: 3060
#include<iostream>
#include<queue>
using namespace std;
const int N = 333333;
int n,a[N];
int solve(int l,int r){
    if(l==r)
        return 0;
    int i,x=0,y=0;
    for(i=l;i<=r;i=i+2){
        if(a[i]<i){
            if(x>a[i])
                return 0;
            x=a[i];
        }
        else{
            if(y>a[i])
                return 0;
            y=a[i];
        }
    }
    x=0,y=N;
    for(i=l;i<=r;i=i+2)
        x=max(x,a[i]),y=min(y,a[i]);
    if(x!=r||y!=l)
        return 0;
    return 1;
}
int main(){
    int i,l,r,x=1;
    scanf("%d",&n);
    for(i=1;i<=n;i=i+1)
        scanf("%d",a+i);
    l=-2,r=-2;
    for(i=1;i<=n;i=i+1){
        if(a[i]!=i){
            if(i-r!=2){
                if(r>0)
                   x&=solve(l,r);
                l=i;
            }
            r=i;
        }
    }
    if(r>0)
        x&=solve(l,r);
    if(x)
        cout<<"Yes";
    else
        cout<<"No";
    return 0;
}

Measured memory_bytes: 1408
// C
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#ifdef __GXX_EXPERIMENTAL_CXX0X__
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#ifdef __GXX_EXPERIMENTAL_CXX0X__
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif
//#include <bits/stdc++.h>

#define all(v) v.begin(), v.end()
typedef long long ll;
#define rep(i, z, n) for(int i = z; i < n; i++)
//const int INF = 1<<29;
//const ll MOD = 1000000007;
using namespace std;

int main(){
    string N;
    cin >> N;
    int x = N.size();
    int ans = 0;
    rep(i, 0, x){
        int y = N.at(i) - 48;
        ans += y;
        ans %= 9;
    }
    if(ans == 0) cout << "Yes" << endl;
    else cout << "No" << endl;
}


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

typedef long long ll;

int main() {
    string s;
    int x, y;
    cin >> s >> x >> y;
    vector<int> d(1, 0);
    rep(i, s.size()) {
        if (s[i] == 'F') d[d.size() - 1]++;
        else d.push_back(0);
    }
    //rep(i, d.size()) cout << d[i] << endl;
    vector<vector<bool>> v(8000, vector<bool>(8000, false));
    v[0][0] = true;
    v[1][0] = true;
    rep(i, d.size() - 1) {
        rep(j, 8000) {
            if (v[i][j]) {
                v[i + 2][j + d[i + 1]] = true;
                v[i + 2][abs(j - d[i + 1])] = true;
            }
        }
    }
    /*
    rep(i, d.size() + 1) {
        rep(j, 8000) {
            if (v[i][j]) cout << i << " " << j << endl;
        }
    }
    */
    if (v[(d.size() - 1) / 2 * 2 + 1][abs(x - d[0])] && v[d.size() / 2 * 2][abs(y)]) cout << "Yes\n";
    else cout << "No\n";
}

Measured memory_bytes: 8448
#include <iostream>
#include <fstream>
#include <algorithm>
#include <vector>
//#define LOCAL
using namespace std;
typedef long long ll;
const int mx=1e5+10;

typedef struct digit{
    int v, w;
    ll d;
    char t;
    string n;
}Infor;
Infor inf[mx];
bool cmp(const Infor &a, const Infor &b){
    if(a.v==b.v){
        if(a.w==b.w){
            if(a.t==b.t){
                if(a.d==b.d){
                    return a.n<b.n;
                }
                return a.d<b.d;
            }
            return a.t<b.t;
        }
        return a.w<b.w;
    }
    return a.v<b.v;
}

int main() {
#ifdef LOCAL
ifstream fin("1.txt");
streambuf*p;
p=cin.rdbuf(fin.rdbuf());
#endif // LOCAL

ll n;
cin>>n;
for(ll i=0;i<n;i++){
    cin>>inf[i].v>>inf[i].w>>inf[i].t>>inf[i].d>>inf[i].n;
   // cout<<inf[i].v<<" "<<inf[i].w<<" "<<inf[i].t<<" "<<inf[i].d<<" "<<inf[i].n<<endl;
}
sort(inf, inf+n, cmp);
for(ll i=0;i<n;i++){
    cout<<inf[i].v<<" "<<inf[i].w<<" "<<inf[i].t<<" "<<inf[i].d<<" "<<inf[i].n<<endl;
}

#ifdef LOCAL
fin.close();
#endif // LOCAL
}




Measured memory_bytes: 12432
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cstring>
#include <cmath>
#include <climits>
#include <deque>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <array>
#include <bitset>
#include <cstring>
#include <deque>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
using namespace std;
#define io() ios_base::sync_with_stdio(false); cin.tie(nullptr)
#define ll long long
#define ull unsigned long long
#define ui unsigned int
#define us unsigned short
#define fi first
#define se second
#define IN(i,l,r) (l<i&&i<r)
#define LINR(i,l,r) (l<=i&&i<=r)
#define LIN(i,l,r) (l<=i&&i<r)
#define INR(i,l,r) (l<i&&i<=r)
#define v(T) vector<T>
#define p(T, N) pair<T, N>
#define tp(A, B, C) tuple<A, B, C>
#define ii p(int, int)
#define vi v(int)
#define vii v(p(int, int))
#define vvi v(v(int))
#define vl v(long long)
#define vll v(p(long long, long long))
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define qsort(a) sort(all(a))
#define qsortd(a) sort(all(a), greater<>())
#define qsortf(a, f) sort(all(a), f)
#define qsortsi(v) sort(v.begin(), v.end(), [](pair<int, int> a, pair<int, int> b){return a.se < b.se;})
#define pb(n) push_back(n)
#define eb(n) emplace_back(n)
#define pp(a, b) emplace_back(make_pair(a, b))
#define pt(a, b, c) emplace_back(make_tuple(a, b, c))
#define elif else if
#define fori(i, n) for(ll i = 0; i < n; ++i)
#define foris(i, a, b) for(ll i = a; i < b; ++i)
#define forise(i, a, b) for(ll i = a; i <= b; ++i)
#define ford(i, n) for(ll i = n; i >= 0; --i)
#define fords(i, a, b) for(ll i = a; i >= b; --i)
#define fordse(i, a, b) for(ll i = a; i > b; --i)
#define fora(i, a) for (auto &i: a)
#define rev(a) reverse(a.begin(), a.end())
#define revf(a, b, c) (reverse(a.begin() + b, a.begin() + c))
#define digits(i) (int)((log(i)/(log(10))+1)
#define umap unordered_map
#define uset unordered_set
#define nl '\n'
#define fileio(in, out) freopen(in, "r", stdin); freopen(out, "w", stdout)
const int mod = 1000000007;

int A, B, C;

int main() {
  io();
  
  cin >> A >> B >> C;
  if(A + B + C >= 22) cout << "bust";
  else cout << "win";
  
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main() {
	int n;cin>>n;
	for(int i=0;i*7<=n;i++){
		if((n-7*i)%4==0){
			cout<<"Yes\n";
			return 0;
		}
	}
	cout<<"No\n";
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan =new Scanner(System.in);
		int n =scan.nextInt();
		int a=0;
		int b=0;
		int sum=0;
		if(n>=10&&n<100) {
			sum=n%10;
		}
		else if(n>=100) {
			a=n%100;
			sum=a%10;
		}
		else {
			sum=n;
		}
		
		
		
		if(sum==2||sum==4||sum==5||sum==7||sum==9) {
			System.out.println("hon");
		}
		else if(sum==0||sum==1||sum==6||sum==8) {
			System.out.println("pon");
		}
		else if(sum==3) {
			System.out.println("bon");
		}
	}

}


Measured memory_bytes: 35704
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

using boost::multiprecision::cpp_int;
using namespace std;

#if __has_include("print.hpp")
  #include "print.hpp"
#endif

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define MOD 1000000007

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; }

typedef long long ll;
typedef pair<ll, ll> p;


int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  string t;
  cin >> t;
  int n = int(t.size());

  for(auto &a : t){
    if(a == '?') a = 'D';
  }
  cout << t << endl;
}


Measured memory_bytes: 3732
#include <bits/stdc++.h>
using namespace std;
//型に気を付けよう

#define rep(i,n) for(int i=0;i<n;i++)
typedef long long  ll;
typedef long double  ld;
typedef pair<int,int> pairii;
const double pi=3.1415926535;
const ll  mod=1000000007;
//桁数指定　cout << fixed << setprecision(2)
int main() {
  vector<int>v(26);
  string w;
  cin>>w;
  char c;
  int cur;
  rep(i,w.size()){
    c=w[i];
    cur=(unsigned char)c;
    cur-=97;
    v[cur]++;
  }
  string ans="Yes";
  rep(j,26){
    if(v[j]%2)ans="No";
  }
  cout<<ans;
}

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

using ll = int64_t;
#define int ll

#define FOR(i, a, b) for (int i = int(a); i < int(b); i++)
#define REP(i, b) FOR(i, 0, b)
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define ALL(x) x.begin(), x.end()

using pi = pair<int, int>;
using vi = vector<int>;
using ld = long double;

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}

template <class T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "{";
  REP(i, (int)v.size()) {
    if (i) os << ",";
    os << v[i];
  }
  os << "}";
  return os;
}

ll read() {
  ll i;
  scanf("%" SCNd64, &i);
  return i;
}

void printSpace() { printf(" "); }

void printEoln() { printf("\n"); }

void print(ll x, int suc = 1) {
  printf("%" PRId64, x);
  if (suc == 1) printEoln();
  if (suc == 2) printSpace();
}

string readString() {
  static char buf[3341000];
  scanf("%s", buf);
  return string(buf);
}

char *readCharArray() {
  static char buf[3341000];
  static int bufUsed = 0;
  char *ret = buf + bufUsed;
  scanf("%s", ret);
  bufUsed += strlen(ret) + 1;
  return ret;
}

template <class T, class U>
void chmax(T &a, U b) {
  if (a < b) a = b;
}

template <class T, class U>
void chmin(T &a, U b) {
  if (b < a) a = b;
}

template <class T>
T Sq(const T &t) {
  return t * t;
}

signed main() {
  string s;
  int k;
  cin >> s >> k;
  set<string> ss;
  for (int i = 0; i < s.length(); i++) {
    for (int j = 1; j <= 5; j++) {
      if (i + j > s.length()) break;
      ss.insert(s.substr(i, j));
    }
  }
  set<string>::iterator it = ss.begin();
  advance(it, k - 1);
  cout << *it << endl;
}


Measured memory_bytes: 1664
#include <bits/stdc++.h>
    using namespace std;
    #define el "\n"
    #define ll long long
    #define ull unsigned long long int
    #define pb push_back
    #define mp make_pair
    #define X first
    #define Y second
    #define M 1000000007
    #define all(v) v.begin(), v.end()
    long long pow(long long int a,long long int b,long long int MOD)
    {
        long long x=1,y=a; 
        while(b > 0)
        {
            if(b%2 == 1)
            {
                x=(x*y);
                if(x>MOD) x%=MOD;
            }
            y = (y*y);
            if(y>MOD) y%=MOD; 
            b /= 2;
        }
        return x;
    }
    long long InverseEuler(long long int n, long long int MOD)
    {
        return pow(n,MOD-2,MOD);
    }
   
    int main() {
      ios_base::sync_with_stdio(false);
      cin.tie(NULL);
      ll n;
      cin>>n;
      ll a[n]={0};
      for(int i=0;i<n;i++)cin>>a[i];
      sort(a,a+n);
      ll x=(n-1)/2;
      ll y=x+1;
      cout<<max(a[y]-a[x],(ll)0)<<el;
      return 0;
    }


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

#define N 200123
#define mod 1000000007

int main(){
    ios::sync_with_stdio(false);
	cin.tie(0);
    if(fopen("input.in", "r")){
        freopen("input.in", "r", stdin);
        freopen("output.out", "w", stdout);
    }
    long long n, sqr= 1;
    int ans;
    cin >> n;
    while(sqr*sqr <= n) sqr++;
    sqr--;
    if(n == 2) ans = 1;
    else {
    	ans = 2;
    	for(long long i = 2 ; i*i <= n ; i++){
    		long long curr = n;
    		while(curr % i == 0) curr/=i;
    		if(curr % i == 1) ans++;
    		if((n-1) % i == 0){
    			if(curr % i != 1) ans++;
    			if((n-1)/i > sqr) ans++;
    		}
    	}
    }
	cout << ans << endl;
    return 0;
}

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

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

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

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int DX[] = {0, 1, 0, -1};
const int DY[] = {-1, 0, 1, 0};


//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

VI memo;

int calc(int n){
	if(n < 0){
		return 0;
	}else if(n == 0){
		return 1;
	}else{
		if(memo[n] >= 0){
			return memo[n];
		}else{
			int value = calc(n - 1)  + calc(n - 2) + calc(n - 3);
			memo[n] = value;
			return value;
		}
	}
}

int main(int argc, char const *argv[])
{
	cin.tie(0);
	ios::sync_with_stdio(false);

	int n;
	while(cin >> n, n){
		memo.resize(31, -1);
		int ret = calc(n);
		cout << ceil(ret / 10 / 365) + 1 << endl;
	}

	return 0;
}

Measured memory_bytes: 1272