akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <unordered_map>
#include <unordered_set>
using namespace std;
#define endl "\n"
#define ll long long
#define sz(s) (int)(s.size())
#define INF 0x3f3f3f3f3f3f3f3fLL
#define all(v) v.begin(),v.end()
#define watch(x) cout<<(#x)<<" = "<<x<<endl
const int dr[] { -1, -1, 0, 1, 1, 1, 0, -1 };
const int dc[] { 0, 1, 1, 1, 0, -1, -1, -1 };
#if __cplusplus >= 201402L
template<typename T>
vector<T> create(size_t n) {
	return vector<T>(n);
}
template<typename T, typename ... Args>
auto create(size_t n, Args ... args) {
	return vector<decltype(create<T>(args...))>(n, create<T>(args...));
}
#endif
void run() {
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
#ifdef EZZAT
	freopen("input.in", "r", stdin);
	//freopen("output.out", "w", stdout);
#else
#endif
}

const ll MAX = 1e18;

int main() {
	run();
	int n;
	cin >> n;
	vector<int> v(n + 1);
	for (auto &it : v)
		cin >> it;
	vector<ll> can(n + 1);
	ll number_of_nodes = 1;
	for (int i = 0; i <= n; i++) {
		if (v[i] > number_of_nodes)
			return cout << -1, 0;
		can[i] = number_of_nodes;
		number_of_nodes = min(number_of_nodes - v[i] << 1, MAX);
	}
	ll sum = number_of_nodes = v[n];
	for (int i = n - 1; i >= 0; i--) {
		number_of_nodes = min(v[i] + number_of_nodes, can[i]);
		sum += number_of_nodes;
	}
	cout << sum << endl;
}


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

using namespace std;

#define int long long
#define ALL(x) (x).begin(),(x).end()
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))

typedef pair<int,int> PI;
typedef pair<int,pair<int,int>> PII;
static const int INF=1010000000000000017LL;
static const double eps=1e-12;
static const double pi=3.14159265358979323846;
static const int dx[4]={1,-1,0,0};
static const int dy[4]={0,0,1,-1};

template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;}
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;}

int X,N;
int p[105];

int dif=INF,res;

signed main(){
    cin>>X>>N;
    for(int i=0;i<N;++i)cin>>p[i];
    for(int x=-200;x<=200;++x){
        bool contained=false;
        for(int i=0;i<N;++i)if(x==p[i])contained=true;
        if(contained)continue;
        if(dif>abs(X-x)){
            dif=abs(X-x);
            res=x;
        }
    }
    cout<<res<<endl;
}

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

using namespace std;
typedef long long ll;

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(ll i=0;i<ll(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=ll(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=ll(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) x.begin(),x.end() //sortなどの引数を省略したい
#define SIZE(x) ll(x.size()) //sizeをsize_tからllに直しておく
#define LEN(x) ll(x.length()) //lengthをsize_tからllに直しておく
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB emplace_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素
#define Umap unordered_map
#define Uset unordered_set

int main(){
    ll n;
    cin >> n;
    vector<ll> a(n);
    REP(i, n) cin >> a[i];
    ll ans = 0;
    REP(i, n-1){
        if(a[i+1] < a[i]){
            ans += a[i] - a[i+1];
            a[i+1] = a[i];
        }
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 4748
#include<bits/stdc++.h>
#include<random>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define rep(i,m,n) for(int (i)=(m);(i)<(n);++(i))
#define rREP(i,m,n) for(int (i)=(n)-1;(i)>=(m);--(i))
#define all(x) (x).begin(),(x).end()
#define out(y,x,h,w) (y)<0||(x)<0||(y)>=(h)||(x)>=(w)
constexpr int INF = 1000000001;
constexpr ll mod = 1000000007;
constexpr double PI = 3.1415926535897932;
template<class T>inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
template<class T>inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}
inline void init() {
	cin.tie(nullptr); cout.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}


int main() {
	init();
	
    int h, w, K;
    cin >> h >> w >> K;
    vector<string> cake(h);
    for (int i = 0; i < h; i++) {
        string s;
        cin >> s;
        cake[i] = s;
    }

    vector<vector<int>> ans(h, vector<int>(w));

    int cake_num = 1;
    int no_cake_line = 0;
    string no_cake = string(w, '.');

    for (int i = 0; i < h; i++) {
        if (cake[i] == no_cake) {
            no_cake_line++;
            continue;
        }

        bool appear = false;
        for (int j = 0; j < w; j++) {
            if (cake[i][j] == '#') {
                if (appear) {
                    cake_num++;
                }
                else {
                    appear = true;
                }
            }
            //何も乗ってないピース
            for (int k = 0; k <= no_cake_line; k++) {
                ans[i - k][j] = cake_num;
            }
        }
        cake_num++;
        no_cake_line = 0;
    }

    if (no_cake_line) {
        for (int i = 0; i < h; i++) {
            if (ans[i][0] == 0) {
                for (int j = i; j < h; j++) {
                    for (int k = 0; k < w; k++) {
                        ans[j][k] = ans[j - 1][k];
                    }
                }
                break;
            }
        }
    }

    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            cout << ans[i][j];
            if (j != w - 1) cout << " ";
            else cout << endl;
        }
    }


	return 0;
}

Measured memory_bytes: 1280
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <string>
#include <cmath>
using namespace std;
int main(){
	int H;
	int W;
	int j;
	int i;
	for(H=1,W=1;;){
		cin>>H>>W;
		if(H==0&&W==0)break;
		for(i=0; i<H; i++){
			for(j=0; j<W; j++){
			if(i==0||j==0||i==H-1||j==W-1)cout<<"#";
			else cout<<".";
			}
			cout<<endl;
		}
		cout<<endl;
	}
	return 0;
}

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

template<class T> void vin(vector<T>& v, int n) {
    v.resize(n);
    for (int i = 0; i < n; ++i) {
        cin >> v[i];
    }
}

ll suml[101010], sumr[101010];

int main() {
    ll n, k;
    cin >> n >> k;
    vector<ll> l, r;
    int rr=0, prev = 0;
    rep(i, n) {
        ll tmp;
        cin >> tmp;
        if (tmp == 0) k--;
        else if (tmp < 0) {
            l.push_back(abs(tmp));
        }
        else {
            r.push_back(tmp);
            sumr[rr+1] = sumr[rr] + abs(prev - tmp);
            prev = tmp;
            rr++;
        }
    }

    reverse(l.begin(), l.end());
    prev = 0;
    for (int i=0; i<l.size(); ++i) {
        suml[i+1] = suml[i] + abs(prev - l[i]);
        prev = l[i];
    }

    if (k == 0) {
        cout << 0 << endl;
        return 0;
    }

    // for (int i=0; i<=n; ++i) cout << suml[i] << " ";
    // cout << endl;
    // for (int i=0; i<=n; ++i) cout << sumr[i] << " ";

    ll ans = -1;
    for (int L=0; L<=k; ++L) {
        if (L > l.size()) break;
        int R = k-L;
        if (R > r.size()) continue;
        ll tmp1 = suml[L];
        ll tmp2 = sumr[R];
        tmp1 = abs(tmp1);
        if (ans == -1) ans = min(tmp1*2+tmp2, tmp1+tmp2*2);
        else ans = min({ans, tmp1*2+tmp2, tmp1+tmp2*2});
    }

    cout << ans << endl;
}


Measured memory_bytes: 2292
n = int(input())
s = list(map(int, input().split()))

if n == 1:
  print('Yes')
  exit(0)

s[0] = s[0] - 1
for i in range(n-1):
  if s[i] > s[i+1]:
    print('No')
    exit()

  if s[i] <= s[i+1] - 1:
    s[i+1] = s[i+1] - 1

print('Yes')


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

using namespace std;

long long a[200005], b[200005], n, m, k, x, j, sol;

int main()
{
    cin>>n>>m>>k;
    for(int i=1;i<=n;i++){
        cin>>x;
        a[i]+=a[i-1]+x;
    }
    for(int i=1;i<=m;i++){
        cin>>x;
        b[i]+=b[i-1]+x;
    }
    j=m;
    for(int i=0;i<=n;i++){
        if(a[i]>k){
            break;
        }
        while(b[j]+a[i]>k){
            j--;
        }
        sol=max(sol, i+j);
    }
    cout<<sol;
    return 0;
}


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

int main(){
    int ans=0;
    string s;
    cin >> s;
    s[3]='8';

    //cout <<fixed<<setprecision(16)<< << endl;
    cout << s << endl;
    //if(flag==1)cout << "Yes" <<endl;
    //else cout << "No" <<endl;
    
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define mp make_pair
#define pb push_back
#define F first
#define S second
#define mod 1000000007
#define PI 3.141592653589793238
#define all(a) a.begin(),a.end()
#define dbg(n) cout<<#n<<' '<<n<<endl;
#define dbg_v(v) cout<<#v<<":";for(auto x:v) cout<<" "<<x; cout<<endl;
int power(ll x,ll y){ll res = 1;while(y>0){if(y&1)res = (res*x)%mod;y=y>>1;x=(x*x)%mod;}return res;}
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);	
	int T=1;
	//cin>>T;
	while(T--){
		int n;
		cin>>n;
		ll a[n];
		for (int i = 0; i < n; i++)
		{
			cin>>a[i];
		}
		int ans=0;
		for(int i=0;i<n;i++){
			for(int j=i+1;j<n;j++){
				for(int k=j+1;k<n;k++){
					if(a[i]!=a[j]&&a[j]!=a[k]&&a[k]!=a[i]&&
						a[i]+a[j]>a[k]&&a[j]+a[k]>a[i]&&a[i]+a[k]>a[j]){
						ans++;
					}
				}
			}
		}
		cout<<ans<<endl;
	}
}


Measured memory_bytes: 3648
// failed to generate code

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

int main(){	
	int N, M;
	cin >> N >> M;
	int k[M], s[M][N], p[M], ss[M];
	for (int i=0; i<M; i++) {
		ss[i] = 0;
		for (int j=0; j<N; j++) {
			s[i][j] = 0;
		}
	}
	for (int i=0; i<M; i++) {
		cin >> k[i];
		for (int j=0; j<k[i]; j++) {
			cin >> s[i][j];
			ss[i] += 1<<(s[i][j]-1);
		}
	}
	for (int i=0; i<M; i++) cin >> p[i];
	int res = 0;
	for (int i=0; i<1<<N; i++) {
		int pp[M];
		for (int j=0; j<M; j++) pp[j] = 0;
		for (int j=0; j<M; j++) {
			for (int k=0; k<N; k++) {
				if (i & 1<<(s[j][k]-1)) pp[j] = (pp[j]+1)%2;
			}
		}
		bool flg = true;
		for (int j=0; j<M; j++) if (p[j] != pp[j]) flg = false;
		if (flg) res++;
	}
	cout << res << endl;
}


Measured memory_bytes: 256
import itertools
n, m, x = map(int, input().split())

states = []
for i in range(n):
    ca = list(map(int, input().split()))
    state = {"cost" : ca[0], "value" :ca[1:]}
    states.append(state)

def check(uselist : list):
    understandings = [0]*m
    cost = 0
    for i, islist in enumerate(uselist):
        if islist == 1:
            for j in range(m):
                understandings[j] += states[i]["value"][j]
            cost += states[i]["cost"]

    for i in range(m):
        if understandings[i] < x:
            return 1000000000
    return cost

ans = 1000000000

for uselist in itertools.product(range(2), repeat=n):
    ans = min(ans, check(uselist))

if ans == 1000000000:
        ans = -1
print(ans)


Measured memory_bytes: 68388
package main

import (
	"fmt"
)

func main() {
	var n, t int
	fmt.Scan(&n, &t)

	cl := make([]int, n)
	tl := make([]int, n)
	for i := 0; i < n; i++ {
		var cn, tn int
		fmt.Scan(&cn, &tn)
		cl[i] = cn
		tl[i] = tn
	}

	tle := true
	minIdx := 0
	for i := 0; i < n; i++ {
		if tl[i] <= t {
			tle = false
			if cl[i] < cl[minIdx] {
				minIdx = i
			}
		}
	}

	if tle {
		fmt.Println("TLE")
	} else {
		fmt.Println(cl[minIdx])
	}
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
#define io freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#define lli long long 
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);
#define fi(i,a,n) for(int i=a; i<=n; i++)
using namespace std;
int main(){
    
    fast
int a,b,c;
    	int x;
    	cin>>a>>b>>c;
    	cin>>x;
int i=0;
     if(c>b && b>a) i=1;
     	else{
     		while(x--){
     			if(b>=c){c=c*2;
     				}
     			else if(a>=b){b=b*2;
     				}
     			else continue;

     if(c>b && b>a) {i=1;break;}
     		}

     	}
     if(i)cout<<"Yes";
     else cout<<"No";
}



Measured memory_bytes: 3596
#include "bits/stdc++.h"
#include "math.h"
 
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<int> vin;
typedef pair<ll,ll> P;
typedef vector<P> vp;
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define SIZE(a) int((a).size())
#define out(a) cout<<(a)<<endl;
const int INF=INT_MAX;
const int MAX = 510000;
const int MOD = 1000000007;

int main(){
  ll n,ans=0;string s;cin>>n>>s;
  rep(i,0,10){
    rep(j,0,10){
      rep(k,0,10){
        bool ok1=false,ok2=false,ok3=false;
        ll x;
        rep(a,0,n-2){
          if(s[a]-'0'==i){ok1=true;x=a;break;}
        }
        rep(b,x+1,n-1){
          if(s[b]-'0'==j){ok2=true;x=b;break;}
        }
        rep(c,x+1,n){
          if(s[c]-'0'==k){ok3=true;break;}
        }
        if(ok1&&ok2&&ok3){ans++;}
      }
    }
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <set>

using std::vector;
template<typename T> void ndarray(vector<T> &vec, int len) { vec.resize(len); }
template<typename T, typename... Args> void ndarray(vector<T> &vec, int len, Args... args) {
    vec.resize(len);
    for (auto &v : vec) ndarray(v, args...);
}

int main() {
    //std::ifstream in("0_normal_2");
    //std::cin.rdbuf(in.rdbuf());
    int N;
    std::cin >> N;
    vector<int> A(N), B(N), C(N-1);
    for (int i = 0; i < N; i++) {
        int a;
        std::cin >> a;
        A[i] = a;
    }
    for (int i = 0; i < N; i++) {
        int b;
        std::cin >> b;
        B[i] = b;
    }
    for (int i = 0; i < N - 1; i++) {
        int c;
        std::cin >> c;
        C[i] = c;
    }
    
    int ans = 0;
    int before = -1;
    for (int i = 0; i < N; i++) {
        int ryori = A[i] - 1;
        ans += B[ryori];
        if (ryori == before+1 && before != -1) {
            ans += C[before];
        }
        //std::cout << ryori << ", " << before << ", " << ans << std::endl;
        before = ryori;
    }
    std::cout << ans << std::endl;
    
    return 0;
}


Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        int W = scanner.nextInt();

        ArrayList<ArrayList<Integer>> meta = new ArrayList<>();

        meta.add(new ArrayList<Integer>());
        meta.add(new ArrayList<Integer>());
        meta.add(new ArrayList<Integer>());
        meta.add(new ArrayList<Integer>());

        meta.get(0).add((int)1e9);
        meta.get(1).add((int)1e9);
        meta.get(2).add((int)1e9);
        meta.get(3).add((int)1e9);


        int W0 = scanner.nextInt();
        int V0 = scanner.nextInt();

        meta.get(0).add(V0);

        for(int i=1; i<N; i++){
            int w = scanner.nextInt() - W0;
            int v = scanner.nextInt();

            meta.get(w).add(v);
        }


        Collections.sort(meta.get(0), Collections.reverseOrder());
        Collections.sort(meta.get(1), Collections.reverseOrder());
        Collections.sort(meta.get(2), Collections.reverseOrder());
        Collections.sort(meta.get(3), Collections.reverseOrder());

        long accV0 = 0;
        long accW0 = 0;

        long ans = 0;

        for(int v0: meta.get(0)){

            if(v0 != (int)1e9) {
                accV0 += v0;
                accW0 += W0;
            }

            long accV1 = 0;
            long accW1 = 0;
            for(int v1: meta.get(1)){
                if(v1 != (int)1e9) {
                    accV1 += v1;
                    accW1 += W0 + 1;
                }

                long accV2 = 0;
                long accW2 = 0;
                for(int v2: meta.get(2)){
                    if(v2 != (int)1e9) {
                        accV2 += v2;
                        accW2 += W0 + 2;
                    }

                    long accV3 = 0;
                    long accW3 = 0;
                    for(int v3: meta.get(3)){

                        if(v3 != (int)1e9) {
                            accV3 += v3;
                            accW3 += W0 + 3;
                        }

                        if(accW0 + accW1 + accW2 + accW3 <= W){
                            ans = Math.max(ans, accV0 + accV1 + accV2 + accV3);
                        }
                    }
                }
            }
        }

        System.out.println(ans);

    }
}

Measured memory_bytes: 25680
#include <string>
#include <vector>
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<stack>
#include<queue>
#include<cmath>
#include<algorithm>
#include<functional>
#include<list>
#include<deque>
#include<bitset>
#include<set>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include<cstring>
#include<sstream>
#include<complex>
#include<iomanip>
#include<numeric>
#include<cassert>
#define X first
#define Y second
#define pb push_back
#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define reps(X,S,Y) for (int (X) = S;(X) < (Y);++(X))
#define rrep(X,Y) for (int (X) = (Y)-1;(X) >=0;--(X))
#define rreps(X,S,Y) for (int (X) = (Y)-1;(X) >= (S);--(X))
#define repe(X,Y) for ((X) = 0;(X) < (Y);++(X))
#define peat(X,Y) for (;(X) < (Y);++(X))
#define all(X) (X).begin(),(X).end()
#define rall(X) (X).rbegin(),(X).rend()
#define eb emplace_back
#define UNIQUE(X) (X).erase(unique(all(X)),(X).end())
#define Endl endl

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
template<class T> using vv=vector<vector<T>>;
template<class T> ostream& operator<<(ostream &os, const vector<T> &t) {
os<<"{"; rep(i,t.size()) {os<<t[i]<<",";} os<<"}"<<endl; return os;}
template<class S, class T> ostream& operator<<(ostream &os, const pair<S,T> &t) { return os<<"("<<t.first<<","<<t.second<<")";}
template<class T> inline bool MX(T &l,const T &r){return l<r?l=r,1:0;}
template<class T> inline bool MN(T &l,const T &r){return l>r?l=r,1:0;}
#define out(args...){vector<string> a_r_g_s=s_p_l_i_t(#args, ','); e_r_r(a_r_g_s.begin(), args); }
vector<string> s_p_l_i_t(const string &s, char c){vector<string> v;int d=0,f=0;string t;for(char c:s){if(!d&&c==',')v.pb(t),t="";else t+=c;if(c=='\"'||c=='\'')f^=1;if(!f&&c=='(')++d;if(!f&&c==')')--d;}v.pb(t);return move(v);}
void e_r_r(vector<string>::iterator it) {}
template<typename T, typename... Args> void e_r_r(vector<string>::iterator it, T a, Args... args){ if(*it==" 1"||*it=="1") cerr<<endl; else cerr << it -> substr((*it)[0] == ' ', it -> length()) << " = " << a << ", "; e_r_r(++it, args...);}
template<typename T>vector<T> table(int n, T v){ return vector<T>(n, v);}
template <class... Args> auto table(int n, Args... args){auto val = table(args...); return vector<decltype(val)>(n, move(val));}
const ll MOD=1e9+7;


int fun(string s){
	int n=s.size();
	int l=0,r=n-1;
	int re=0;
	while(l<r){//out(l,r,1);
		if(s[l]!=s[r]){
			++re;
			if(s[l]=='x') ++l;
			else if(s[r]=='x') --r;
			else return -1;
		}else{
			++l; --r;
		}
	}
	return re;
}

int main(){
  ios_base::sync_with_stdio(false);
  cout<<fixed<<setprecision(0);
	string s;
	cin>>s;
	cout<<fun(s)<<endl;
  return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
string a;
int main()
{
    cin>>a;
    bool flag=false;
    for(int i=0;i<a.size();i++)
    {
        if(a[i]=='C')
            flag=true;
        if(a[i]=='F')
            if(flag)
            {
                cout<<"Yes"<<endl;
                return 0;
            }
            else
                continue;
    }
    cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 256
//abc106_b.cpp
//Sat Aug 18 19:56:02 2018

#include <iostream>
#include <string>
#include <queue>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <math.h>
#define INTINF 2147483647
#define LLINF 9223372036854775807
using namespace std;
using ll=long long;
typedef pair<int,int> P;

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

	int ans=0;
	for (int i=1;i<=n;i+=2){
		int count = 0;
		for (int j=1;j<=n;j++){
			if (i%j==0){
				count++;
			}
		}
		if (count==8){
			ans++;
		}
	}

	cout << ans << endl;
//	printf("%.4f\n",ans);
}

Measured memory_bytes: 256
import math
K = int(input())
ans = 0
#すべて同じ数字
ans += (1+K)*K//2

#2つ同じ
for i in range(1,K,1):
    for j in range(i+1,K+1,1):
        ans += 6*math.gcd(i,j)

#すべて異なる
for i in range(1,K-1,1):
    for j in range(i+1,K,1):
        kari = math.gcd(i,j)
        for h in range(j+1,K+1,1):
            ans += 6*math.gcd(kari,h)

print(ans)


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

#define IOS cin.tie(0);ios::sync_with_stdio(false)

#define ll      long long
#define Fi      first
#define Se      second
#define Pb      push_back
#define vi      vector<int>
#define vs      vector<string>
#define vp      vector<pair<int,int>>
#define vvi     vector<vector<int>>
#define vvp     vector<vector<pair<int,int>>>
using Graph  =  vector<vector<int>>; //Caution!! Segmentation Fault!! Don't forget to add +1!

const int INF = 1e9;
const int MOD = 1e9+7;

#define all(v) v.begin(),v.end()
#define output_s(s) printf("%s\n",(s).c_str())

#define rep(i,n)        for(int i=0;i<(int)(n);i++)
#define Rep(i,n,m)      for(int i=(int)(n);i<(int)(m);i++)
#define RepS(i,n,m)     for(int i=(int)(n);i<=(int)(m);i++)
#define RRepS(i,n,m)    for(int i=(int)(n);i>=(int)(m);i--)
#define RepA(x)         for(auto &item:(x))

void CINT(){} //@shibh308's template
template<class Head,class... Tail> void CINT(Head&& head,Tail&&... tail){cin>>head; CINT(move(tail)...);}    
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)

void OUT(){}
template<class Head,class...Tail> void OUT(Head&& head,Tail&&...tail){cout<<head<<(sizeof...(tail)?' ':'\n'); OUT(move(tail)...);}
#define COUT(...) OUT(__VA_ARGS__)

template<typename TypeInt>TypeInt GCD(TypeInt a,TypeInt b){return a%b==0?b:GCD(b,a%b);} //最大公約数
template<typename TypeInt>TypeInt LCM(TypeInt a,TypeInt b){return a*b/GCD(a,b);}//最小公倍数

void YES(bool f){printf(f?"YES\n":"NO\n");}
void Yes(bool f){printf(f?"Yes\n":"No\n");}
void Possible(bool f){printf(f?"Possible\n":"Impossible\n");}
void POSSIBLE(bool f){printf(f?"POSSIBLE\n":"IMPOSSIBLE\n");}

//----------------------library------------------------//

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

const int NMAX = 200;
bool flag;

bool comp(int x,int y){
    return abs(0-x)<abs(0-y);
}

signed main(){
    IOS;
    CIN(N);
    flag=false;
    for(int i=0;4*i<=N;i++){
        if((N-4*i)%7==0){flag=true;break;}
    }
    Yes(flag);

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector<ll>;
#define all(x) (x).begin(), (x).end()
#define fsp(x) fixed << setprecision(x)
const ll inf = LLONG_MAX;
const long double pi = acos(-1);
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}

//素数判定
//#include <cmath>
bool is_prime(long long n) {
	if (n == 1) return false;
	if (n == 2) return true;
	if (n % 2 == 0) return false;
	for (long long i = 3; i <= sqrt(n); i += 2) {
		if (n % i == 0) return false;
	}
	return true;
}

//二項係数 mod p
//#include <vector>
long long modinv(long long n, long long p) {
	long long a = p, u = 1, v = 0;
	while (a) {
		long long t = n / a;
		n -= t * a;
		std::swap(n, a);
		u -= t * v;
		std::swap(u, v);
	}
	u %= p;
	if (u < 0) u += p;
	return u;
}

std::vector<long long> factorial;
std::vector<long long> factorial_inv;
void make_table(long long n, long long p) {
	factorial.resize(n, 1);
	factorial_inv.resize(n, 1);
	for (long long i = 2; i <= n; i++) {
		factorial[i] = factorial[i - 1] * i % p;
	}
	factorial_inv[n] = modinv(factorial[n], p);
	for (long long i = n - 1; i >= 2; i--) {
		factorial_inv[i] = factorial_inv[i + 1] * (i + 1) % p;
	}
}

long long combination(long long n, long long r, long long p) {
	r = std::min(r, n - r);
	long long ret = factorial[n] * factorial_inv[r] % p;
	ret *= factorial_inv[n - r];
	ret %= p;
	return ret;
}

int main() {
	//ios::sync_with_stdio(false);
	//cin.tie(nullptr);
	const ll p = 1e9 + 7;
	//const ll p = 998244353;

	ll n, m;
	cin >> n >> m;

	map<ll, ll> mp;
	ll x = m;
	for (ll i = 2; i <= x; i++) {
		if (is_prime(x)) {
			mp[x]++;
			break;
		}
		if (!is_prime(i)) continue;
		ll cnt = 0;
		while (x % i == 0) {
			x /= i;
			cnt++;
		}
		mp[i] += cnt;
	}

	make_table(1e7, p);
	ll ans = 1;
	for (auto i = mp.begin(); i != mp.end(); i++) {
		ll a = (i -> first), b = (i -> second);
		ans *= combination(b + n - 1, n - 1, p);
		ans %= p;
	}
	cout << ans << endl;
}


Measured memory_bytes: 156544
#include<bits/stdc++.h>
#pragma GCC target ("avx2")
#pragma GCC optimization ("03")
#pragma GCC optimization ("unroll-loops")
using namespace std;

const int maxn = 100002;
const int maxe = 20;
int n,m,c=0,k=0,d=0,pa[maxn];
string s;
char a[maxn];
int st[maxn][maxe];

void build(int n){
    for(int j=1;(1<<j)<=n;j++){
        for(int i=1;i+(1<<j)-1<=n;i++){
            st[i][j] = min(st[i][j-1], st[i+(1<<(j-1))][j-1]);
        }
    }
}

int query(int a, int b){
    int k = 31- __builtin_clz(b-a+1);
    return min(st[a][k], st[b-(1<<k)+1][k]);
}

int find(int i)
{
    if(pa[i]==i)return i;
    return pa[i]=find(pa[i]);
}

int bs(int l,int r,int x)
{
    while(l!=r)
    {
        int mi=(l+r)/2;
        if(a[mi]>x)r=mi;
        else l=mi+1;
    }
}

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

    cin>>n;
    a[0]='$';
    for(int i=1;i<=n;i++){
    cin>>a[i];
    }
    for(int i=1;i<=n;i++){
    if(a[i]!=a[i-1])c++;
    }
    cout<<c;
}


Measured memory_bytes: 2304
#include<stdio.h>

main()
{
  int a,b,c,d,n,i,j,ans;

  while(scanf("%d",&n)!=EOF){
    ans=0;
    for(a=0;a<=9;a++){
      for(b=0;b<=9;b++){
	for(c=0;c<=9;c++){
	  for(d=0;d<=9;d++){
	    if(a+b+c+d==n){
	      ans++;
	    }
	  }
	}
      }
    }

    printf("%d\n",ans);


  }
  return 0;
}

Measured memory_bytes: 596
#include <stdio.h>
void swap(int *a, int *b)
{
	int tmp;
	tmp = *a;
	*a = *b;
	*b = tmp;
}

void sort(int *c, int *d)
{
	if (*c > *d)
		swap(c, d);
}

int main(void) 
{
	int x, y;
	while (scanf("%d %d", &x, &y) != EOF) {
		if (x == 0 && y == 0)
			break;
		if (x > y) {
			sort(&x, &y);
			printf("%d %d\n", x, y);
		}
		else {
			printf("%d %d\n", x, y);
		}
	}
	return 0;
}


Measured memory_bytes: 2036
package main

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

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 500001), 500000)
	return scanner
}

func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}

func main() {
	fp := os.Stdin
	if len(os.Args) > 1 {
		fp, _ = os.Open(os.Args[1])
	}

	scanner := getScanner(fp)
	writer := bufio.NewWriter(os.Stdout)

	n := getNextInt(scanner)
	c := getNextInt64(scanner)

	sushi := make([]Sushi, n)
	for i := 0; i < n; i++ {
		sushi[i].x = getNextInt64(scanner)
		sushi[i].v = getNextInt64(scanner)
	}
	sumL := make([]int64, n+1)
	sumR := make([]int64, n+1)
	ml := make([]Max, n+1)
	mr := make([]Max, n+1)

	var ans, maxL, maxR int64

	for i := 0; i < n; i++ {
		sumL[i+1] = sumL[i] + sushi[i].v - sushi[i].x
		if i > 0 {
			sumL[i+1] += sushi[i-1].x
		}
		ml[i+1] = ml[i]
		if sumL[i+1] > maxL {
			maxL = sumL[i+1]
			ml[i+1].v = maxL
			ml[i+1].i = i
		}

		sumR[i+1] = sumR[i] + sushi[n-i-1].v - (c - sushi[n-i-1].x)
		if i > 0 {
			sumR[i+1] += c - sushi[n-i].x
		}
		mr[i+1] = mr[i]

		if sumR[i+1] > maxR {
			maxR = sumR[i+1]
			mr[i+1].v = maxR
			mr[i+1].i = i
		}
	}

	ans = 0

	for i := 0; i < n; i++ {
		if ans < ml[i+1].v {
			ans = ml[i+1].v
		}
		if ans < ml[i+1].v+mr[n-i-1].v-sushi[i].x {
			ans = ml[i+1].v + mr[n-i-1].v - sushi[i].x
		}
		if ans < mr[i+1].v {
			ans = mr[i+1].v
		}
		if ans < mr[i+1].v+ml[n-i-1].v-(c-sushi[n-i-1].x) {
			ans = mr[i+1].v + ml[n-i-1].v - (c - sushi[n-i-1].x)
		}
	}

	fmt.Fprintln(writer, ans)

	writer.Flush()
}

// Sushi ...
type Sushi struct {
	x, v int64
}

// Max ...
type Max struct {
	i int
	v int64
}


Measured memory_bytes: 9472
import Control.Monad

main :: IO ()
main = do
  n <- readLn
  xs <- replicateM n $ do
          [x,y,h] <- getInts
          return (x,y,h)
  let x = head $ dropWhile (\(_,_,h) -> h < 1) xs
  putStrLn $ format $ solve x xs

getInts :: IO [Int]
getInts = map read . words <$> getLine

format :: (Int,Int,Int) -> String
format (x,y,h) = unwords $ map show [x,y,h]

solve :: (Int,Int,Int) -> [(Int,Int,Int)] -> (Int,Int,Int)
solve x xs = head [c | x0 <- [0..100], y0 <- [0..100], let c = (x0,y0,calcH x x0 y0), check xs c]

calcH :: (Int,Int,Int) -> Int -> Int -> Int
calcH (x1,y1,h1) x0 y0 = h1 + abs (x1-x0) + abs (y1-y0)

check :: [(Int,Int,Int)] -> (Int,Int,Int) -> Bool
check xs (x0,y0,h0) = all valid xs
  where
    valid (x1,y1,h1) = h1 == max 0 (h0 - abs (x0-x1) - abs (y0-y1))


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

int dp[3001][3001];
string s, t;

int recurse(int i, int j) {
	if(dp[i][j] != -1) {
    	return dp[i][j];
    } else if(!i or !j) {
    	return dp[i][j] = 0;
    } else if(s[i - 1] == t[j - 1]) {
    	return dp[i][j] = recurse(i - 1, j - 1) + 1;
    } else {
    	return dp[i][j] = max(recurse(i - 1, j), recurse(i, j - 1));
    }
}

signed main() {
	string lcs = ""; cin >> s >> t;
  	int n = int(s.length()), m = int(t.length());
	memset(dp, -1, sizeof dp);
  	recurse(n, m);
  	int x = n, y = m;
  	while(x > 0 and y > 0) {
    	if(s[x - 1] == t[y - 1]) {
        	lcs = s[x - 1] + lcs;
        	x = x - 1; y = y - 1;
        } else if(dp[x - 1][y] > dp[x][y - 1]) {
        	x = x - 1;
        } else {
        	y = y - 1;
        }
    }
  	cout << lcs;
  	return 0;
}

Measured memory_bytes: 35968
open Batteries
module EnumL = Enum.Labels
module ListL = List.Labels
module ArrayL = Array.Labels

let dbg0 x = Printf.eprintf "[debug]%s\n" @@ dump x
let dbg1 x = dbg0 x; x

let id = identity

let (++) n m = List.range n `To m
let (++-) n m = if n >= m then List.range n `Downto m else []
let (++^) n m = if n < m then List.range n `To (pred m) else []

let scan fmt = Scanf.sscanf (read_line ()) fmt

let scan_lines n fmt f =
  if n = 0 then []
  else List.map (fun _ -> scan fmt f) (1 ++ n)

let scan_list ?sep cnv =
  let line = read_line () in
  (match sep with
   | None -> List.map String.of_char @@ String.to_list line
   | Some sep -> String.split_on_char sep line)
  |> List.map cnv

let scan_array ?sep cnv = Array.of_list @@ scan_list ?sep cnv

let scan_matrix n m e ?sep conv =
  let arr = Array.make_matrix n m e in
  ListL.iter (0 ++^ n)
    ~f:(fun i -> arr.(i) <- Array.of_list @@ scan_list ?sep conv);
  arr

let atoi c = Char.code c - Char.code '0'

let rec powerset e =
  match Enum.get e with
  | None -> Enum.singleton @@ Enum.empty ()
  | Some v ->
    let f = powerset e in
    let g = Enum.clone f in
    EnumL.map f ~f:(fun x -> let y = Enum.clone x in push y v; y)
    |>  Enum.append g

let permutations l =
  let rec aux l =
    let rec interleave x = function
      | [] -> [[x]]
      | (hd::tl) as lst ->
        (x::lst) ::
        (ListL.map ~f:(List.cons hd)  @@ interleave x tl)
    in
    match l with
    | [] -> [[]]
    | hd::tl -> List.concat @@ List.map (interleave hd) @@ aux tl in
  let l = List.sort (List.compare Int.compare) @@ aux @@ List.of_enum l in
  List.enum % ListL.map ~f:List.enum @@ l

let intersection l =
  EnumL.filter ~f:(fun x -> EnumL.exists ~f:((=) x) @@ Enum.clone l)

let zip l m =
  let n = min (List.length l) (List.length m) in
  List.combine (List.take n l) (List.take n m)

let lower_bound n f =
  let rec aux l u =
    if u - l > 1 then
      let m = (l + u) / 2 in
      if f m then aux l m
      else aux m u
    else u in aux (-1) n

let between n x m = n <= x && x < m

let n = scan "%d" id
let s =  scan "%s" id

let () =
  ListL.map (0++9) ~f:(fun i ->
      ListL.map (0++9) ~f:(fun j ->
          ListL.map (0++9) ~f:(fun k ->
              try
                let x =
                  String.find_from s 0 @@ String.of_char @@ Char.chr (i + Char.code '0') in
                let y = String.find_from s (succ x) @@ String.of_char @@ Char.chr (j + Char.code '0') in
                String.find_from s (succ y) @@ String.of_char @@ Char.chr (k + Char.code '0') |> ignore;
                1
              with
              | Not_found -> 0
            )
        )
    )
  |> List.concat |> List.concat
  |> List.sum
  |> Printf.printf "%d\n"


Measured memory_bytes: 3584
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc = new Scanner(System.in);

		//入力表示
		int A = sc.nextInt();
		int B = sc.nextInt();
		int C = sc.nextInt();
		
	
		int mx = Math.max ( A ,Math.max( B , C ));

		int ans = A + B + C + 9 * mx ;
		System.out.println(ans);
	}
}

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

int main(){
  string S;
  cin>>S;
  string week[3]={"Sunny","Cloudy","Rainy"};
  
  for(int i=0;i<3;i++){
    if(week[i]==S){
      cout<<week[(i+1)%3]<<endl;
    }
  }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
template <typename T> using vec = vector<T>;

int main()
{
	int x,n;
	cin >> x >> n;
	vec<bool> p(102);
	int hoge;
	while (cin >> hoge)
	{
		p[hoge]=true;
	}
	int dif;
	int Min=114515;
	int ans = 0;
	for (int i = 0; i <= 101; i++)
	{
		if (p[i]==false)
		{
			dif = abs(x-i);
			if (Min > dif)
			{
				Min = dif;
				ans = i;
			}
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 3620
#include<iostream>
using namespace std;
long long factorial(long long n);
int main()
{
	long long n = 0;
	cin >> n;
	bool flag = 0;
	if (n == 0 || (n & 1) == 1)
	{
		cout << "0";
	}
	else
	{
		long long temp = factorial(n);
		cout << temp;
	}
	return 0;
}
long long factorial(long long n)
{
	long long count = 0;
	n = n - (n % 10);
	n = n / 2;
	while (n != 0)
	{
		count = count + n / 5;
		n = n / 5;
	}
	return count;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<string>
using namespace std;
#define ll long long
#define pb push_back
#define endl '\n'
ll solve(){
	ll n,k,mul=1;
	cin>>n>>k;
	ll arr[n+1];
	double gra;
	arr[0]=1;
	for(int i=1;i<=n;i++) {
		cin>>arr[i];
	}
	for(int i=k+1;i<=n;i++){
		gra=((arr[i]+0.00)/(arr[i-k]+0.00));
		if(gra>1.00) cout<<"Yes";
		else cout<<"No";
		cout<<endl;
	}
	
	return 0;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	ll t=1;
	//cin>>t;
	while(t--){
		solve();
	}
	return 0;
}


Measured memory_bytes: 5200
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  string S;
  
  cin >> N;
  cin >> S;
  
  int T=0;
  
  for(int i=0; i<N ; i++){
    if(S[i]=='A' && S[i+1]=='B' && S[i+2]=='C'){
      T++;
    }
    
    else{
      T+=0;
    }
  }
  
  cout << T << endl;
  
}

Measured memory_bytes: 256
a=input()
b=input()
c=input()
d=input()

a=int(a)
b=int(b)
c=int(c)
d=int(d)

if a > b:
    if c > d:
        print(b+d)
    else:
        print(b+c)
else:
    if c > d:
        print(a+d)
    else:
        print(a+c)

Measured memory_bytes: 3316
#include<iostream>
using namespace std;
typedef long long ll;
#define INF 1LL<<60

ll f(ll b, ll n){
	if(b<2) return INF;
	ll ret=0;
	while(n>=b){
		ret+=n%b;
		n/=b;
	}
	return ret+n;
}

int main(){
	ll n,s;
	cin >> n >> s;
	if(s==n){
		cout << n+1 << endl;
		return 0;
	}
	ll ans=INF;
	for(ll i=2;i*i<=n;i++){
		if(f(i,n)==s) ans=min(ans,i);
	}
	for(ll i=1;i*i<n;i++){
		ll b=(n-s)/i+1;
		if(f(b,n)==s) ans=min(ans,b);
	}
	if(ans==INF) cout << -1 << endl;
	else cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <math.h>
#include <iomanip>
#include <bitset>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <utility>
#include <set>
using namespace std;
typedef long long int ll;
typedef long double ld;
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; }
const long long INF = 1LL << 60;
 
typedef pair<ll,ll> pairs;
vector<pairs> p;
bool pairCompare(const pair<double,ll>& firstElof, const pair<double,ll>& secondElof){
    return firstElof.first < secondElof.first;
}
#define MAX_N 100100
bool x[MAX_N];
ll num[MAX_N];
ll fibl[MAX_N]={0};
 
ll fib(ll a){
    if (fibl[a]!=0)return fibl[a];
    if (a==0){
        return 0;
    }else if (a==1){
        return 1;
    }
    return fibl[a]=fib(a-1)+fib(a-2);
}
 
ll eratosthenes(ll n) {
    int p = 0;
    for (ll i=0; i<=n; ++i) x[i] = true;
    x[0] = x[1] = false;
    for(int i=2; i<=n; ++i) {
        if(x[i]) {
            p++;
            for(int j=2*i; j<=n; j+=i) x[j] = false;
        }
        
        num[i] = p;
    }
    return p;
}
 
ll gcd(ll a,ll b){
    if (a%b==0)return(b);
    else return(gcd(b,a%b));
}
 
ll keta(ll N){
    int tmp{};
    while( N > 0 ){
        tmp += ( N % 10 );
        N /= 10;
    }
    N = tmp;
    return N;
}

bool kaibun(string s,ll x,ll y){
    for (ll i=x;i<y;i++){
        if (s[i]!=s[y-1-i]){
            return false;
        }
    }
    return true;
}

int main(){
    ll n;
    cin >> n;
    ll a[n],nl[n+1];
    fill(nl,nl+n+1,0);
    for (ll i=0;i<n;i++){
        cin >> a[i];
        nl[a[i]]=nl[a[i]]+1;
    }
    ll ans[n+1],count=0;
    for (ll i=1;i<=n;i++){
        ll x=nl[i];
        ans[i]=x*(x-1)/2;
        count+=ans[i];
    }
    for (ll i=0;i<n;i++){
        ll x=a[i];
        cout << count-(nl[x]-1) << endl;
    }
    return 0;
}


Measured memory_bytes: 7296
#include <iostream>
#include <vector>
#include <algorithm>

int main()
{
	
	int n = 1;
	std::cin >> n;


	while (n)
	{
		std::vector<int32_t> num_list{};

		while (n--)
		{
			int tmp = 0;
			std::cin >> tmp;
			num_list.push_back(tmp);
		}
		int32_t max_num = *(num_list.begin());
		std::vector<int32_t> sum_list{};
		for( auto num : num_list )
		{
			for (auto& sum : sum_list)
			{
				sum += num;
			}
			sum_list.push_back(num);

			int32_t tmp_max_sum = *(std::max_element(sum_list.begin(), sum_list.end()));
			if (max_num < tmp_max_sum)
			{
				max_num = tmp_max_sum;
			}
		}

		std::cout << max_num << std::endl;
	
		std::cin >> n;
	}

	return 0;
}

Measured memory_bytes: 3044
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define MOD 1000000007
#define INF 1e9
#define All(x) (x).begin(), (x).end()
typedef long long ll;
using namespace std;


int main() {
  string s,t;
  cin>>s>>t;
  int sz=s.size();

  rep(i,sz){
    if(s==t){
      cout<<"Yes\n";
      return 0;
    }

    char c=s[sz-1];
    s.pop_back();
    s=c+s;
  }

  if(s==t){
      cout<<"Yes\n";
      return 0;
  }
  cout<<"No\n";


  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define bit(n) (1<<(n))
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
template < typename T > string tost( const T& n ) { ostringstream stm; stm << n; return stm.str();}
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;}
int const INF = 1001001001;


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

int a,b,c;
cin >> a >> b >> c;
int ans = max(10*a + b + c, max(a + 10*b + c, a + b + 10*c));
cout << ans << endl;
return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
import java.util.Stack;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String expr = sc.nextLine();
        System.out.println(reversePolishNotationCalc(expr));
    }

    private static int reversePolishNotationCalc(String expr) {
        String[] e = expr.split(" ");
        Stack<Integer> s = new Stack<>();
        for (int i = 0; i < e.length; i++) {
            switch (e[i]) {
                case "+":
                    s.push(s.pop() + s.pop());
                    break;
                case "-":
                    s.push(-s.pop() + s.pop());
                    break;
                case "*":
                    s.push(s.pop() * s.pop());
                    break;
                default:
                    s.push(Integer.valueOf(e[i]));
                    break;
            }
        }
        return s.pop();
    }
}

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

int recur(int st,int k,vector<vector<int>>&dp,vector<vector<int>>&vec){
    if(st<0) return 0;
    int &ret=dp[st][k];
    if(ret!=-1) return ret;
    for(int i=0;i<3;++i)
        if(i!=k) 
            ret=max(ret,recur(st-1,i,dp,vec)+vec[st][k]);
    return ret;
}

signed main(){
    int i,n,k,j; scanf("%d",&n);
    vector<vector<int>> hap(n,vector<int>(3)),dp(n,vector<int>(3,-1));
    for(i=0;i<n;++i) 
        for(j=0;j<3;++j)
            scanf("%d",&hap[i][j]);
    int ans=0;
    for(i=0;i<3;++i) ans=max(ans,recur(n-1,i,dp,hap));
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 22000
#include <algorithm>
#include <iostream>
#include <queue>
#include <cmath>
#include <string>
#include <iterator>
#include <map>
#include <set>
#include <iomanip>
#include <vector>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using Graph = vector<vector<int>>;
int dx[] = {0, 1, 0, -1};
int dy[] = {1, 0, -1, 0};
#define INF 100000000
#define MAX 200001
#define MOD 1000000007
ll fac[MAX], finv[MAX], inv[MAX];
const int MX = 1000005;

int main()
{
    int n;
    cin >> n;
    int ans = 0;
    vector<int> a(n);
    vector<int> is_prime(1000010, 1);
    vector<int> check(1000010, 0);
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
        check[a[i]] += 1;
    }
    sort(a.begin(), a.end());
    for (int i = 0; i < n; i++)
    {
        if (is_prime[a[i]])
        {
            if (check[a[i]] == -1){
                continue;
                ans--;
            }
            for (int j = 2 * a[i]; j <= 1000000; j += a[i])
            {
                is_prime[j] = 0;
            }
            if (check[a[i]] == 1)
                ans++;
            check[a[i]] = -1;
        }
    }
    cout << ans << endl;
}



Measured memory_bytes: 11936
/*
confirm 0LL and 1LL
confirm cornercases such as 0
confirm times of cin < 10^6
*/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
using Pld = pair<ld, ld>;
using Vec = vector<ll>;
using VecP = vector<P>;
using VecB = vector<bool>;
using VecC = vector<char>;
using VecD = vector<ld>;
using VecS = vector<string>;
using Graph = vector<VecP>;
template <typename T>
using Vec1 = vector<T>;
template <typename T>
using Vec2 = vector<Vec1<T> >;
#define REP(i, m, n) for(ll (i) = (m); (i) < (n); ++(i))
#define REPN(i, m, n) for(ll (i) = (m); (i) <= (n); ++(i))
#define REPR(i, m, n) for(ll (i) = (m)-1; (i) >= (n); --(i))
#define REPNR(i, m, n) for(ll (i) = (m); (i) >= (n); --(i))
#define rep(i, n) REP(i, 0, n)
#define repn(i, n) REPN(i, 1, n)
#define repr(i, n) REPR(i, n, 0)
#define repnr(i, n) REPNR(i, n, 1)
#define all(s) (s).begin(), (s).end()
#define pb push_back
#define fs first
#define sc second
template <typename T>
bool chmax(T &a, const T b){if(a < b){a = b; return true;} return false;}
template <typename T>
bool chmin(T &a, const T b){if(a > b){a = b; return true;} return false;}
template <typename T>
ll pow2(const T n){return (1LL << n);}
template <typename T>
void cosp(const T n){cout << n << ' ';}
void co(void){cout << '\n';}
template <typename T>
void co(const T n){cout << n << '\n';}
template <typename T1, typename T2>
void co(pair<T1, T2> p){cout << p.fs << ' ' << p.sc << '\n';}
template <typename T>
void co(const Vec1<T> &v){for(T i : v) cosp(i); co();}
template <typename T>
void co(initializer_list<T> v){for(T i : v) cosp(i); co();}
template <typename T>
void ce(const T n){cerr << n << endl;}
template <typename T>
void ce(initializer_list<T> v){for(T i : v) cerr << i << ' '; cout << endl;}
void sonic(){ios::sync_with_stdio(false); cin.tie(0);}
void setp(const ll n){cout << fixed << setprecision(n);}
constexpr int INF = 1e9+1;
constexpr ll LINF = 1e18+1;
constexpr ll MOD = 1e9+7;
//constexpr ll MOD = 998244353;
constexpr ld EPS = 1e-11;
const ld PI = acos(-1);

int main(void){
	ll n, m;
	cin >> n >> m;
	Vec a(n);
	rep(i, n) cin >> a[i];

	unordered_map<ll, ll> ump;
	ump[0]++;
	ll ans = 0;
	ll r = 0;
	rep(i, n){
		r += a[i];
		r %= m;
		ans += ump[r];
		ump[r]++;
	}
	co(ans);

	return 0;
}


Measured memory_bytes: 4492
#include <bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define pb push_back
#define mp make_pair
#define INF (int)1e9
#define cBits(x) __builtin_popcount(x)
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) a/gcd(a,b)*b
#define FOR(i,a,b) for (int i=a;i<b;i++)
#define FORr(i,a,b) for (int i=a;i>=b;i--)
#define MAX3(a,b,c) max(a,max(b,c))
#define MIN3(a,b,c) min(a,min(b,c))
#define eachTest int t; cin >> t; while(t--) solve();

using namespace std;

typedef long long int ll;
typedef unsigned long long int ull;
typedef pair<ll,ll> PLL;
typedef pair<int,int> PII;

const int MOD=1000000007;

void solve() {
	;
}

int main() {

	fastio;
	// #ifndef ONLINE_JUDGE
	// 	freopen("input.txt", "r", stdin);
	// 	freopen("output.txt", "w", stdout);
	// #endif

	// eachTest

	int n;
	cin >> n;
	double arr[n+1];
	FOR(i,1,n+1) {
		cin >> arr[i];
	}
	double table[n+1][n+1];
	
	FOR(i,0,n+1) {
		table[0][i] = 0;
		// table[i][0] = 
		if (i==0) {
			// table[i][0] = 1-arr[i];
			table[i][0] = 1;
		}
		else {
			table[i][0] = table[i-1][0]*(1-arr[i]);
		}
	}
	FOR(i,1,n+1) {
		FOR(j,1,n+1) {
			// considering upto i elements, probability of getting j numbero f heads
			table[i][j] = (1-arr[i])*table[i-1][j] + arr[i]*table[i-1][j-1];
		}
	}
	double ans = 0;
	FOR(j,n/2+1,n+1) {
		ans += table[n][j];
	}
	// FOR(i,0,n+1) {
	// 	FOR(j,0,n+1) {
	// 		cout << table[i][j] << " ";
	// 	}
	// 	cout << "\n";
	// }
	cout << fixed << setprecision(10) << ans << "\n";

	return 0;
}


Measured memory_bytes: 70656
#include <iostream>
#include <cstdio>

using namespace std;

typedef long long LL;

LL ans = 0;

int n;

int main() {
	scanf("%d", &n);
	for (int i = 1; i <= n; i++) {
		if (i % 3 && i % 5) ans += i;
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 3228
#include <iostream>
#include <string>
#include <cctype> 
using namespace std;
int main(){
	int k,i,z;
	string s;
	int c=0;
	cin>>s;
	if ((s[0]!='A')|| (isupper(s[s.size()-1])) || (isupper(s[1] ) )){
		cout<<"WA";
		return 0;
	}	
	bool c_found = false;
	for(int i = 2;i< s.size()-1;i++)
	{
		if (s[i]=='C')
		{
			if(c_found)
			{
				cout<<"WA";
				return 0;
			}
			else
			{
				c_found = true;
				continue;
			}
		}
		if(!islower(s[i]))
		{
			cout<<"WA";
			return 0;
		}
	}
	if (!c_found)
	{
		cout<<"WA";
		return 0;
	}		
	cout<<"AC";
		

	return 0;
}

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

bool is_prime[10001];
int main() {
	memset(is_prime, 1, sizeof(is_prime));
	is_prime[0] = is_prime[1] = false;
	for (int i = 2; i <= 10000; i++) {
		if (is_prime[i]) {
			for (int j = i * 2; j <= 10000; j += i)is_prime[j] = false;
		}
	}
	int n;
	while (cin >> n) {
		int cnt = 0;
		for (int i = 1; i <= n; i++) {
			if (is_prime[i] && is_prime[n - i + 1])cnt++;
		}
		cout << cnt << endl;
	}
}

Measured memory_bytes: 3048