akhauriyash/Code-Regression huggingface dataset:
#include <iostream>

using namespace std;

int main() {
	int A1, A2, A3;
	cin >> A1 >> A2 >> A3;

	if (A1 + A2 + A3 >= 22) {
		cout << "bust" << endl;
	}
	else {
		cout << "win" << endl;
	}
	return 0;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
#include <math.h>
#include <cmath>

using namespace std;
using ll =long long;
using vi = vector<int>; 
using vvi = vector<vi>; 
using vl = vector<ll>; 
using vvl = vector<vl>; 
using vs = vector<string>;
using vvs = vector<vs>; 
using vc = vector<char>;
using vvc = vector<vc>; 
using vb = vector<bool>;
using vvb = vector<vb>; 

#define rep(i,n) ;for( int i =0; i < n ; i ++)
#define all(a) a.begin(),a.end()
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define f(i,a,b) for(int i=a;i<b;i++)
#define pri(a)  printf("%.14lf\n",a);
#define sz(a) ((int)a.size())
#define MOD 1000000007
bool is_int_lround(double x){
  return std::lround(x)==x;
}
ll keta(ll x){
  ll n=0;
  while(x>0){
    x /=10 ;
    n ++;
  }
  return n;
}

ll conbi(int n,int m){
  
  cin>>n>>m;
  vector<ll> a(100);
  a[0] =1;
  for(int i=0;i<14;i++){
    a[i+1]=a[i]*(i+1);
  }
  return a[n] /(a[m] *a[n-m]);
}

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;//繰り返し二乗法
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
ll kaijoMOD(ll x){
  ll z=1;
  if(x==0){
    return 1;
  }
  while(x>0){
    z *=x;
    z %=MOD;
    x--;
  }
  return z;
}
ll yakusu_num(ll n){
  vl yakusu(n+1,1);
  for(ll i=2;i*i<=n;i++){ 
    while(n%i==0){
      n /=i;
      yakusu[i]++;
    }
  }
  if(n!=1)yakusu[n]++;
  ll num=1;
  for(ll i=0;i<=n;i++){
    num*=yakusu[i];
  }
  return num;
}

int H,W;
vs s(50);
vi dv ={-1,0,1,0};vi du={0,-1,0,1};
int cnt=1;
int dfs(int u,int v){
  s[u][v]='.';
  
  rep(i,4){
   
      int nu =u +du[i],nv=v+dv[i];
      if(nu<0||nu>=H||nv<0||nv>=W)continue;
      if(s[nu][nv]=='.')continue;
      cnt ++;
      dfs(nu,nv);
    
  }
  return cnt;

}
int keta_wa(int x){
  int tot=0;
  while(x>0){
    tot +=x%10;
    x/=10;
  }
  return tot;
}

//vc alp ={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
//vc Alp ={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
//cout<<""<<endl;
int main(){
  ll N,K,X,Y;cin>>N>>K>>X>>Y;
  cout<<X*min(K,N)+Y*max(0LL,N-K )<<endl;

}





Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<ll,double> LP;
 
#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define dbg(x) cout<<#x"="<<x<<endl
#define all(x) x.begin(),x.end()
#define maxch(x,y) x=max(x,y)
#define bcnt __builtin_popcount
 
#define inf 1e16
 
ll n;
ll x[1010],y[1010];
map<double,vector<P> > vs;
vector<ll> a,b;
 
ll dp[2][1<<16];
 
int main(){
  cin>>n;
  rep(i,n)cin>>x[i]>>y[i];
  rep(i,n)rep(j,i){
    ll dx=x[i]-x[j];
    ll dy=y[i]-y[j];
 
    if(dx==0){
      vs[inf].push_back(P(i,j));
    }else if(dy==0){
      vs[0].push_back(P(i,j));
    }else{
      /*
      ll pdx=dx<0?-dx:dx;
      ll pdy=dy<0?-dy:dy;
      ll g=__gcd(pdx,pdy);
 
      if(dx<0)vs[P(-dx/g,-dy/g)].push_back(P(i,j));
      else vs[P(dx/g,dy/g)].push_back(P(i,j));
      */
      vs[(double)dy/(double)dx].push_back(P(i,j));
    }
  }
 
  for(auto it : vs){
    rep(S,1<<it.se.size()){
      if(bcnt(S)<2)continue;
      a.push_back(bcnt(S)*(bcnt(S)-1)/2);
      ll tmp=0;
      rep(i,it.se.size()){
        if((S>>i)&1){
          tmp|=1<<it.se[i].fi;
          tmp|=1<<it.se[i].se;
        }
      }
      b.push_back(tmp);
    }
  }
  ll m=a.size();
 
  ll crt=0,nxt=1;
  rep(i,m){
    rep(S,1<<n){
      maxch(dp[nxt][S],dp[crt][S]);
      if((S&b[i])==b[i])maxch(dp[nxt][S^b[i]],dp[crt][S]+a[i]);
    }
    swap(crt,nxt);
  }
 
  ll res=0;
  rep(S,1<<n){
    maxch(res,dp[crt][S]);
  }
  cout<<res<<endl;
 
  return 0;
}

Measured memory_bytes: 4212
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include<functional>
#include<numeric>
#include<queue>
#include<stack>
#include<map>
#include<unordered_map>
#include<set>
#include<bitset>
#include<random>

#pragma region
using namespace std;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define rep(i,n) FOR(i,0LL,n)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define rrep(i,n) RFOR(i,0LL,n)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define COUNT(a,y,x) upper_bound(all(a), y) - lower_bound(all(a), x)
#define UNIQUE(a) sort(all(a)); a.erase(unique(all(a)), a.end())
#define pb push_back
typedef long long int ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef vector<string> vs;
typedef map<ll, ll> MAP;
const ll inf = 2222222222222222222LL;
const ll mod = 1000000007LL;

ll n = 0, m = 0, ans = 0, tmp = 0, ma = -inf, mi = inf;
string s;
bool ok;
ll dx[9] = { 0,1,-1,0,0,1,1,-1,-1 }, dy[9] = { 0,0,0,1,-1,1,-1,1,-1 };
#define endl '\n'
#pragma endregion
#define MAX 222222


ll x[11];


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



  ll a, b;
  rep(i, 3) {
    cin >> a >> b;
    x[a]++;
    x[b]++;
  }
  ok = true;
  FOR(i, 1, 5) {
    if (x[i] >= 3) ok = false;
  }
  if (ok) cout << "YES" << endl;
  else cout << "NO" << endl;





  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define rep(i,m,n) for(int i=m;i<n;i++)
ll mod=1e9+7;

int main(){
  int n;
  cin>>n;
  int c=0;
  rep(i,1,n+1){
    int a;
    cin>>a;
    if(i%2!=0 && a%2!=0) c++;
  }
  cout<<c<<endl;
}

Measured memory_bytes: 3632
#!/usr/bin/env python
import string
import sys
from itertools import chain, dropwhile, takewhile


def read(
    *shape, f=int, it=chain.from_iterable(sys.stdin), whitespaces=set(string.whitespace)
):
    def read_word():
        w = lambda c: c in whitespaces
        nw = lambda c: c not in whitespaces
        return f("".join(takewhile(nw, dropwhile(w, it))))

    if not shape:
        return read_word()
    elif len(shape) == 1:
        return [read_word() for _ in range(shape[0])]
    elif len(shape) == 2:
        return [[read_word() for _ in range(shape[1])] for _ in range(shape[0])]


def readi(*shape):
    return read(*shape)


def readi1(*shape):
    return [i - 1 for i in read(*shape)]


def readf(*shape):
    return read(*shape, f=float)


def reads(*shape):
    return read(*shape, f=str)


def arr(*shape, fill_value=0):
    if len(shape) == 1:
        return [fill_value] * shape[fill_value]
    elif len(shape) == 2:
        return [[fill_value] * shape[1] for _ in range(shape[0])]


def dbg(**kwargs):
    print(
        ", ".join("{} = {}".format(k, repr(v)) for k, v in kwargs.items()),
        file=sys.stderr,
    )


def main():
    N = readi()
    a = readi(N)
    ans = 1
    c = a[0]
    g, z = False, False
    for i in range(1, N):
        if c < a[i] and g:
            ans += 1
            g, z, = False, False
        elif c < a[i] and not g:
            z = True
        elif c > a[i] and z:
            ans += 1
            g, z, = False, False
        elif c > a[i] and not z:
            g = True
        c = a[i]

    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 8616
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        for (int i = 1; ; i++) {
            int x = sc.nextInt();
            if (x == 0) {
                break;
            } else {
                System.out.println("Case " + i + ": " + x);
            }
        }
    }
}


Measured memory_bytes: 45472
local mfl, mce = math.floor, math.ceil
local n = io.read("*n")
local a, b = {}, {}
for i = 1, n do
  a[i], b[i] = io.read("*n", "*n")
end
local sum = 0
for i = n, 1, -1 do
  local dst = mce((a[i] + sum) / b[i])
  sum = sum + dst * b[i] - (a[i] + sum)
end
print(sum)


Measured memory_bytes: 5076
#include <iostream>
#include <stdio.h>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <algorithm>
#define MP make_pair
using ll = long long;
using namespace std;

int main()
{
  int n,m;
  cin >> n >> m;
  cout << (n-1)*(m-1) << endl;
  return 0;
}


Measured memory_bytes: 764
#include<bits/stdc++.h>
#define ll long long
using namespace std;
#define INF 1e9
int main(){
    int n;
    cin>>n;
    vector<int>cost(n,0);
    for(int i=0;i<n;i++){
        cin>>cost[i];
    }
    vector <int> dp(n,INF);
    dp[0]=0;
    for(int i=0;i<n;i++){
        for(int j=i+1;j<=i+2;j++){
            if(j<n){
                dp[j]=min(dp[j],dp[i]+abs(cost[i]-cost[j]));
            }
        }
    }
    cout<<dp[n-1];
    return 0;
}

Measured memory_bytes: 3968
/*
　　こんにちは。あたしはｶｳｶﾞｰﾙ。
　　redcoderになるためAtCoderを巡る旅をしてます。

　　　 　 ＿_
　　　 ヽ|＿_|ノ　　　　ﾓｫ
　　　　||‘‐‘||ﾚ　　_)_, ―‐ 、
　　　　/(Ｙ (ヽ＿ /・ ヽ　　 ￣ヽ
　　　　∠ ＿ ゝ　 ｀^ヽ ﾉ.::::_(ノヽ
　　　　 _/ヽ　 　　  /ヽ￣￣/ヽ
*/

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define dump(x)  cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) << endl

#define rep(i, n) REP(i, 0, n)                              // 0, 1, ..., n-1
#define REP(i, x, n) for(int i = x; i < n; i++)             // x, x + 1, ..., n-1
#define FOREACH(x,a) for(auto& (x) : (a) )

#define ALL(v) (v).begin() , (v).end()
#define RALL(v) (v).rbegin(), (v).rend()

#define COUT(x) cout << (x) << endl

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

// ユークリッドの互除法
ll gcd(ll a, ll b) {
    if (b == 0) return a;
    return gcd(b, a % b);
}

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

    ll n, k; cin >> n >> k;
    int flg = 0;
    ll a; cin >> a;
    ll g = a;
    ll m = a;
    for(int i = 1; i < n; i++){
        cin >> a;
        m = max(m, a);
        g = gcd(g, a);
    }
    if(k % g == 0 && k <= m) flg = 1;
    if(flg) cout << "POSSIBLE" << endl;
    else cout << "IMPOSSIBLE" << endl;
}


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

using namespace std;

int main()
{
        int n,a[1000],i,c,temp,s=0;
        cin>>n;
        for(i=0;i<n;i++)
        {
                cin>>a[i];
        }

        sort(a,a+n);
         for(i=0;i<n-1;i++)
        {
                s=s+a[i];
        }
        if(s>a[n-1])
                cout<<"Yes"<<endl;
        else
                cout<<"No"<<endl;
        return 0;


}


Measured memory_bytes: 256
import sys
readline = sys.stdin.readline

def main():
    x = int(readline())
    ans = x // 11 * 2
    v = ans // 2 * 11
    if v < x:
        v += 6
        ans += 1
    if v < x:
        ans += 1
    print(ans)


if __name__ == '__main__':
    main()

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

#define int long long
#define rep(i, a, n) for (int i = a; i < n; i++)
#define pb push_back
#define eb emplace_back
#define dump(x) cout << #x << " = " << (x) << endl
#define chk() cout << "now" << endl;
#define ALL(x) (x).begin(), (x).end()
#define SORT(c) sort((c).begin(), (c).end())
#define SORTG(c) sort(ALL(c), greater<int>());
#define fi first
#define se second
int INF = 1e9 + 7;

typedef pair<int, int> P;
typedef vector<int> vi;

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 calc(int a) {
  if (a >= INF) {
    a %= INF;
  }
  return a;
}

string s;

void solve() {
  cin >> s;
  reverse(s.begin(), s.end());

  int digit[s.length()] = {};
  digit[0] = 1;
  rep(i, 1, s.size()) {
    digit[i] = digit[i - 1] * 10;
    if (digit[i] >= 13) {
      digit[i] %= 13;
    }
  }

  int dp[s.size()][13] = {0};
  if (s[0] != '?') {
    int asa = s[0] - '0';
    dp[0][asa] = 1;
  } else {
    rep(i, 0, 10) { dp[0][i] = 1; }
  }

  rep(i, 1, s.size()) {
    if (s[i] != '?') {
      int a = s[i] - '0';
      a *= digit[i];
      a %= 13;
      rep(j, 0, 13) {
        int b;
        if (j - a < 0) {
          b = 13 + j - a;
        } else {
          b = j - a;
        }
        dp[i][j] = dp[i - 1][b];
        dp[i][j] = calc(dp[i][j]);
      }
    } else {
      rep(j, 0, 10) {
        int a = j * digit[i];
        a %= 13;
        rep(k, 0, 13) {
          int b = k + a;
          b %= 13;
          dp[i][b] += dp[i - 1][k];
          dp[i][b] = calc(dp[i][b]);
        }
      }
    }
  }
  cout << dp[s.size() - 1][5] << endl;
}

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

  // cout << fixed << setprecision(10);

  solve();

  return 0;
}


Measured memory_bytes: 11472
import sys

input = sys.stdin.readline


def main():
    S = input().rstrip()
    Q = int(input())
    query = [None] * Q
    for i in range(Q):
        query[i] = input().split()

    prefix = []
    surfix = []
    is_reversed = False
    for q in query:
        if q[0] == "1":
            is_reversed = not is_reversed
        else:
            F, C = q[1], q[2]
            if F == "1":
                if is_reversed:
                    surfix.append(C)
                else:
                    prefix.append(C)
            else:
                if is_reversed:
                    prefix.append(C)
                else:
                    surfix.append(C)

    ans = "".join(["".join(prefix)[::-1], S, "".join(surfix)])
    if is_reversed:
        ans = ans[::-1]

    print(ans)


if __name__ == "__main__":
    main()


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

int main() {
    int X, A; cin >> X >> A;

    if(X<A){
        cout << 0 << endl;
        return 0;
    }
    else{
        cout << 10 << endl;
        return 0;
    }
}


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

int a,b,c;
string s;

int main(){
	cin >> a >> b >> s;
	if(s.length() != a+b+1){
		cout << "No\n";
		return 0;
	}
	for(int i=0; i<s.length(); i++){
		if(s[i] == '-' && i != a){
			cout << "No\n";
			return 0;
		}
	}
	if(s[a] != '-') cout << "No\n";
	else cout << "Yes\n";
}

Measured memory_bytes: 256
N = int(input())
S = input()
alpha = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
lens = len(S)
ans = ''
for i in range(lens):
    ind = alpha.index(S[i])
    next = ind + N
    if next >= 26:
        next -= 26
    ans += alpha[next]
print(ans)


Measured memory_bytes: 3060
open Printf
open Scanf

module L =
  struct
    include List
  
    let rec drop n = function
        [] -> []
      | h :: t when n > 0 -> drop (n - 1) t
      | l -> l

    let init n f =
      let rec loop x =
        if x = n then []
        else let y = f x in y :: loop (x + 1)
      in loop 0
  end

let id x = x

let flip f x y = f y x

let solve n k =
  L.fold_left (+) 0 @@ L.drop k @@ L.fast_sort (flip compare) @@ L.init n (fun _ -> scanf "%d " id)

let () =
  scanf "%d %d " solve |> printf "%d\n"


Measured memory_bytes: 20896
import java.io.*;
import java.math.BigInteger;
import java.util.Arrays;

public class Main implements Runnable {
    static ContestScanner in;
    static Writer out;
    public static void main(String[] args) {
        new Thread(null, new Main(), "", 16 * 1024 * 1024).start();
    }

    public void run() {
        Main main = new Main();
        try {
            in = new ContestScanner();
            out = new Writer();
            main.solve();
            out.close();
            in.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    void solve() throws IOException {
        char[] s = in.nextToken().toCharArray();
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < s.length; i++) {
            if (i % 2 != 0) continue;
            sb.append(s[i]);
        }
        System.out.println(sb.toString());
    }
}

class Writer extends PrintWriter{
    public Writer(String filename)throws IOException
    {super(new BufferedWriter(new FileWriter(filename)));}
    public Writer()throws IOException {super(System.out);}
}
class ContestScanner implements Closeable {
    private BufferedReader in;private int c=-2;
    public ContestScanner()throws IOException
    {in=new BufferedReader(new InputStreamReader(System.in));}
    public ContestScanner(String filename)throws IOException
    {in=new BufferedReader(new InputStreamReader(new FileInputStream(filename)));}
    public String nextToken()throws IOException {
        StringBuilder sb=new StringBuilder();
        while((c=in.read())!=-1&&Character.isWhitespace(c));
        while(c!=-1&&!Character.isWhitespace(c)){sb.append((char)c);c=in.read();}
        return sb.toString();
    }
    public String readLine()throws IOException{
        StringBuilder sb=new StringBuilder();if(c==-2)c=in.read();
        while(c!=-1&&c!='\n'&&c!='\r'){sb.append((char)c);c=in.read();}
        return sb.toString();
    }
    public long nextLong()throws IOException,NumberFormatException
    {return Long.parseLong(nextToken());}
    public int nextInt()throws NumberFormatException,IOException
    {return(int)nextLong();}
    public double nextDouble()throws NumberFormatException,IOException
    {return Double.parseDouble(nextToken());}
    public void close() throws IOException {in.close();}
}

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

typedef long long ll;

using namespace std;

int main(){
  ll N, M ; cin >> N >> M;
  vector<pair<ll,ll>> X(M+N);
  for(int i = 0 ; i < N;i++){
    X[i].second = (ll) 1;
  cin >> X[i].first ;}
  
  for(int j = 0; j < M; j++){
    cin >> X[j + N].second >> X[j + N].first;}
  
  sort(X.begin(),X.end());
  reverse(X.begin(),X.end());
  
  ll sum  = 0; ll count = 0; ll cnt = 0;
  
  while( count <= N ) {
    sum += X[cnt].first * X[cnt].second;
    count += X[cnt].second; cnt++;
    if( count >= N){ sum -= X[cnt - 1].first * ( count - N); break;}}
  
  cout << sum << endl;
  
  return 0;
}
  

Measured memory_bytes: 3328
#include <string>
#include <string.h>
#include <iostream>
#include <queue>
#include <math.h>
#include <stdio.h>
using namespace std;
const int mod = 100000000;
int a[22][22];
int kind[5000];
int dp[5000];
int n,m;
int num=0;

int main()
{
	int x,a,b;
	scanf("%d %d %d",&x,&a,&b);
	x-=a;
	printf("%d\n",x%b);
	return 0;
}


Measured memory_bytes: 764
#include<cstdio>
#include<algorithm>
#include<iostream>
using namespace std;
const int maxn=2e5+5;
int a[maxn];
double val[maxn],front[maxn];
int main()
{
    int n,k;
    scanf("%d%d",&n,&k);
    for(int i=1;i<=n;i++)
    {
        scanf("%d",&a[i]);
        val[i]=(double)(a[i]+1)/2.0;
        front[i]=front[i-1]+val[i];
    }
    double ans=front[k];
    for(int i=2;i+k-1<=n;i++)
        ans=max(ans,front[i+k-1]-front[i-1]);
    printf("%.12lf\n",ans);
    return 0;
}


Measured memory_bytes: 4096
def resolve():

    s = input()

    ans = 0

    for i in range(2 ** (len(s) - 1)):

        pos = 0
        for j in range(len(s) - 1):

            if (i >> j) & 1:
                ans += int(s[pos:j+1])
                pos = j+1

        ans += int(s[pos:len(s)])

    print(ans)
    
resolve()

Measured memory_bytes: 39280
#include <iostream> // C++の入出力
#include <stdio.h> // C の入出力
#include <algorithm> // sort などのアルゴリズム
#include <string.h> // C の文字列用
#include <ctype.h> // C の文字種用
#include <string> // C++の文字列
using namespace std;
const int Max=10000000;
bool prime[Max];
int main(void){
    int in,i;
    for(int i=0;i<Max;i++)prime[i]=true;
    prime[1]=false;
    for(int i=2;i<Max;i++){
        if(prime[i]){
            for(int s=i*2;s<=Max;s+=i)prime[s]=false;
        }
    }
    while(1){
        cin>>in;
        if(in==0)break;
        for(i=in;i>0;i--){
            if(prime[i]==true&&prime[i-2]==true){
                cout<<i-2<<" "<<i<<"\n";
                break;
            }
        }
        
    }
    return 0;
}

Measured memory_bytes: 10928
import sys
input = sys.stdin.readline
sys.setrecursionlimit(2 * 10**6)


def inpl():
    return list(map(int, input().split()))


def gcd(a, b):
    # greatest common divisor
    while b > 0:
        a, b = b, a % b

    return a


MOD = 10**9 + 7


def POW(a, p):
    if a == 1 or p == 0:
        return 1

    if p == 1:
        return a
    else:
        return (POW(a, p // 2)**2 * (a**(p % 2))) % MOD


def ShinKosuu(k, kosuu, shinkosuu):
    ret = kosuu[k]
    for t in range(k * 2, K + 1, k):
        ret -= shinkosuu[t]
    return ret


def main():

    ans = 0
    kosuu = [0] * (K + 1)
    shinkosuu = [0] * (K + 1)
    for k in range(K, 0, -1):
        kosuu[k] = POW(K // k, N)
        shinkosuu[k] = ShinKosuu(k, kosuu, shinkosuu)
        ans = (ans + k * shinkosuu[k]) % MOD
    # print(kosuu)

    print(ans)


if __name__ == '__main__':
    N, K = inpl()
    main()


Measured memory_bytes: 77588
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <string>
#include <stack> // s.top()
#include <bitset>
#include <queue> // s.front()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define print(x) cout<<(x)<<endl
#define INF10 1001001001 
#define INF5 100000
#define EPS 1e-10



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

	for (ll i = 1; i <= 3500; i++) {
		for (ll j = 1; j <= 3500; j++) {
			ll child = N * i * j;
			ll moth = 4 * i*j - N * i - N * j;
			if (moth > 0 && child%moth == 0) {
				cout << child / moth << " " << i << " " << j << endl;
				return 0;
			}

		}
	}







	return 0;
}


Measured memory_bytes: 256
using System;
using System.Linq;//リストの使用
using System.Collections.Generic;
class Program
{
	static void Main()
	{
		long n = long.Parse(Console.ReadLine());
		long[] nums = Array.ConvertAll(Console.ReadLine().Split(' '),long.Parse);
    long answer = 0;
    long answerMemo = 0;
    string answerString = "";

    while(true)
    {
      answerMemo = answer;
      for(long i = 0; i < n-1; i++)
      {
        if(nums[i] > nums[i+1])
        {
          long swapMemo = nums[i];
          nums[i] = nums[i+1];
          nums[i+1] = swapMemo;
          answer++;
        }
      }
      if(answerMemo == answer) break;
    }

    answerString = nums[0].ToString();
    for(long i = 1; i < n; i++) answerString += " " + nums[i].ToString();
    
    Console.WriteLine(answerString);
		Console.WriteLine(answer);
	}
}


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

using namespace std;

#define int long long
#define all(v) (v).begin(), (v).end()
#define resz(v, ...) (v).clear(), (v).resize(__VA_ARGS__)
#define reps(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep(i, n) reps(i, 0, n)

template<class T1, class T2> void chmin(T1 &a, T2 b){if(a>b)a=b;}
template<class T1, class T2> void chmax(T1 &a, T2 b){if(a<b)a=b;}

using Pi = pair<int, int>;
using Tapris = tuple<int, int, int>;
using vint = vector<int>;

const int inf = 1LL << 55;
const int mod = 1e9 + 7;

signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  int n, y;
  cin >> n >> y;
  rep(i, n+1) rep(j, n+1) {
    int k = n-i-j;
    if(k < 0) continue;
    if(10000*i+5000*j+1000*k == y) {
      cout << i << " " << j << " " << k << endl;
      return 0;
    }
  }
  cout << -1 << " " << -1 << " " << -1 << endl;


  return 0;
}


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


/********************************************************************/
#define M1 1000000007
#define M2 998244353
#define ll long long
#define pll pair<ll,ll>
#define REP(i,a,b) for(ll i=a;i<b;i++)
#define REPR(i,a,b) for(ll i=b-1;i>=a;i--)
#define forr(i,n) for(ll i=0;i<n;i++)
#define F first
#define S second
#define pb push_back
#define DB pop_back
#define mp make_pair
#define MT make_tuple
#define V(a) vector<a>
#define vi vector<ll>
#define endl '\n'
#define ce(ele) cout<<ele<<' '
#define cs(ele) cout<<ele<<'\n'
#define CASE(t) ll t; cin>>t; while(t--)
/********************************************************************/
// const int mx = 1e7 + 5;
const double pi = 3.1415926535;
/********************************************************************/
//FAST IO//
void FAST() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
}
const int mx = 1e5 + 5;
ll freq[mx] = {};

/********************************************************************/
int main() {
	FAST();
	ll x, n;
	cin >> x >> n;
	ll ele;
	set<ll> nos;
	for (int i =  0; i < n; i++) {
		cin >> ele;
		nos.insert(ele);
	}
	ll l = x, r = x;
	while (true) {
		if (nos.count(l) == 0) {
			cout << l << endl;
			break;
		}
		if (nos.count(r) == 0) {
			cout << r << endl;
			break;
		}
		l--;
		r++;
	}
	return 0;
}

Measured memory_bytes: 3648
class Main {
    private static void solve() {
        for (int i = 1; i < 10; i++) {
            for (int j = 1; j < 10; j++) {
                System.out.println(String.format("%dx%d=%d", i, j, i * j));
            }
        }
    }

    public static void main(String... args) {
        solve();
    }
}

Measured memory_bytes: 12000
_ = input()
X = list(map(int, input().split()))


def get_vital_sum(pos):
    ret = 0
    for x in X:
        ret += (pos - x) ** 2
    return ret


ans = 100000000
for p in range(1,101):
    ans = min(ans, get_vital_sum(p))

print(ans)

Measured memory_bytes: 3060
def digits_sum(number)
  if !number.kind_of?(Integer)
    # 整数以外の場合
    puts "[ERROR] digits_sum: argument must be an INTEGER"
    -1
  elsif number < 0
    # 負の整数の場合
    puts "[ERROR] digits_sum: argument must be a POSITIVE integer"
    -1
  else
    # 0もしくは正の整数の場合
    sum = 0
    while number > 0 do
      sum += number % 10
      number /= 10
    end
    sum
  end
end

n = gets.chomp
m = n.split("").map.with_index { |num, i|
  if i == 0
    num.to_i - 1
  else
    9
  end
}.join("").to_i
puts [digits_sum(m), digits_sum(n.to_i)].max


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


int main() {
  ll A, B, K;
  cin >> A >> B >> K;
  if (K <= A) {
    cout << A - K << ' ' << B << endl;
  } else if (K <= A + B) {
    cout << 0 << ' ' << A + B - K << endl;
  } else {
    cout << 0 << ' ' << 0 << endl;
  }
  return 0;
}


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

int main() {
	int n;
	cin >> n;
	vector<int> xs(n), ys(n);
	for (int i = 0; i < n; i++) {
		cin >> xs[i] >> ys[i];
	}
	if (n == 1) {
		cout << fixed << setprecision(17) << 1 << endl;
		return 0;
	}
	for (int i = 0; i < n; i++) {
		vector<double> ang;
		for (int j = 0; j < n; j++) {
			if (i == j) {
				continue;
			}
			ang.emplace_back(atan2(ys[j] - ys[i], xs[j] - xs[i]));
		}
		sort(ang.begin(), ang.end());
		double mx = 0;
		for (int j = 0; j < n - 2; j++) {
			mx = max(mx, ang[j + 1] - ang[j]);
		}
		mx = max(mx, 2 * M_PI + ang[0] - ang[n - 2]);
		cout << fixed << setprecision(17) << (M_PI < mx ? (mx - M_PI) / (2 * M_PI) : 0) << endl;
	}
	return 0;
}

Measured memory_bytes: 256
/* ex3_4
   moka223711 */

#include <stdio.h>

int main(void){
	int num, dis = 0;
	scanf("%d", &num);

	// numを1から9で割って、余りが0かつ商が9以下になっているものを探す
	// 割れるものが見つかったらdを1に変える
	for(int i = 1; i <= 9; i++){
		if(num % i == 0 && num / i <= 9){
			dis = 1;
			break;
		}
	}
	
	// 上のfor文で1から9で割り切れるものが見つかったときd == 1となっているため
	// if文が実行される、なかったときはelse文の実行
	if(dis){
		printf("Yes");
	}
	else{
		printf("No");
	}
  
	return 0;
}


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

int main() {
    string s, t;
    cin >> s >> t;

    string r;
    int n = s.size(), m = t.size();
    for (int i = 0; i <= n - m; i++) {
        string u = s;
        int b = 0;
        for (int j = i; j < i + m; j++) {
            if (u[j] == '?') u[j] = t[j - i]; else if (u[j] != t[j - i]) b = 1;
        }
        if (b) continue;
        for (int j = 0; j < n; j++) {
            if (u[j] == '?') u[j] = 'a';
        }
        if (r.empty() || u < r) r = u;
    }

    cout << (r.empty() ? "UNRESTORABLE" : r) << endl;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
typedef long long li;
#define rep(i,n) for(int i=0;i<(n);i++)
#define df 0
template<class T> void print(const T& t){ cout << t << "\n"; }
template<class T, class... Ts> void print(const T& t, const Ts&... ts) { cout << t; if (sizeof...(ts)) cout << " "; print(ts...); }

int main(){
  li a; cin >>a;
  long double x; cin >>x;
  li b=x*100+0.01;
  print((li)(a*x));
}


Measured memory_bytes: 3728
#include<stdio.h>
int max(int a,int b){
	return a>b?a:b;
}
int main(){
    int n;
    while(~scanf("%d",&n)){
    	int map[2][n],dp[2][n];
    	for(int i=0;i<2;i++) for(int j=0;j<n;j++) scanf("%d",&map[i][j]);
    	for(int i=0;i<2;i++) for(int j=0;j<n;j++) dp[i][j]=0;
    	dp[0][0]=map[0][0],dp[1][0]=map[0][0]+map[1][0];
    	for(int i=1;i<n;i++) dp[0][i]=dp[0][i-1]+map[0][i];
    	for(int i=1;i<n;i++) dp[1][i]=max(dp[1][i-1],dp[0][i])+map[1][i];
    	printf("%d\n",dp[1][n-1]);
    }
}

Measured memory_bytes: 128
function Main(input) {
  input = input.split("\n");
  var N = parseInt(input[0].split(" ")[0]);
  var L = parseInt(input[0].split(" ")[1]);
  var sum=0;
  var min=10000;
  for(var i=1;i<N+1;i++){
    sum+=(L+i-1);
    if(Math.abs(min)>Math.abs(L+i-1)){
      min=L+i-1
    }
  }
  var ans=sum-min;

  console.log('%s', ans);
  return ans;
}

function debug(n){
  var input = document.getElementById("input"+n).value;
  var ans=Main(input);
  var result="WA";
  if(ans==document.getElementById("output"+n).value.split("\n")[0]){
    result="AC";
  }
  document.getElementById("result"+n).innerHTML=result;
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 21064
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy,copy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

def main():
    n, k = MAP()
    print(ceil(n/k) - n//k)

if  __name__=='__main__':
    main()


Measured memory_bytes: 5712
s = str(input())
a = ['A','T','G','C']
b = []
c = 0
for i in s:
    if i in a:
        c += 1
    else:
        b += [c]
        c = 0
b += [c]
if b == []:
    print(len(s))
else:
    print(max(b))

Measured memory_bytes: 8984
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string a,b;
  cin >>a>>b;
  string q;
  for(int i=0;i<b.size();i++){
    q.push_back(b[i]);
  }
  
  for(int i=0;i<a.size();i++){
    if(a==q){
      cout<<"Yes"<<endl;
      return 0;
    }else{
      char x=q.front();
      q.erase(0,1);
      q.push_back(x);
      //cout<<q<<endl;
    }
  }
  cout<<"No"<<endl;
  return 0;  
}

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

pair<int,int> p[300001];

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n,m;
	cin>>n>>m;
	for(int i=0;i<n;i++)
		cin>>p[i].first>>p[i].second;
	sort(p,p+n);
	priority_queue<int,vector<int>,greater<int> > R,F;
	for(int i=0,M=1;M<=m;M++){
		while(i<n&&p[i].first<M)	R.push(p[i++].second);
		while(i<n&&p[i].first==M)	F.push(p[i++].second);
		while(F.size()>M)
			R.push(F.top()),F.pop();
	}
	for(int M=F.size()+1;M<=m;M++)
		if(!R.empty()&&R.top()<=M)	R.pop();
	cout<<R.size()<<endl;
}


Measured memory_bytes: 3320
def equal(s1, s2):
    flag = True
    for i in range(len(s1)):
        if s1[i] != s2[i]:
            flag = False
            break
    return flag

S = list(input())

L = len(S)

ans = -1
for i in range(L):
    if (L - (i+1)) % 2 == 1:
        continue
    elif equal(S[:int((L - (i+1))/2)], S[int((L - (i+1))/2):(L - (i+1))]):
        ans = L - (i+1)
        break

print(ans)

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

using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vector<int>> vvi;
typedef vector<string> vs;
typedef unordered_set<int> si;
typedef pair<int, int> pp;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#define all(e) (e).begin(), (e).end()


template <typename T>
void printV(vector<T> A) {
    if (A.empty()) cerr << "EMTPY\n";
    else { 
        cerr << "[";
        for (int i = 0; i < A.size() -1 ; ++i) {
            cerr << A[i] << ", ";
        }
        if (A.size()) cerr << A.back() << "]\n";
    }
}


template <typename T>
void printVV(vector<vector<T>> A) {
    cerr << "[";
    for (auto v : A) {
        printV<T>(v);
    }
    cerr << "]";
}

template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
    cerr << name << ": " << arg1 << endl;
}

template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&& ...args) {
    const char* comma = strchr(names + 1, ',');
    cerr.write(names, comma - names) << ": " << arg1 << " |";
    __f(comma + 1, args...);
}


int main(int argc, char **argv) {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n; cin >> n;
    auto arr = vll(n+1);
    ll s = 0, other = 0;
    for (int i = 1; i <= n; ++i) {
        cin >> arr[i];
        if ((i & 1) == 0) other += arr[i];
        s += arr[i];
    }

    ll cur = s - 2 * other;
    cout << cur << ' ';
    for (int i = 2; i <= n; ++i) {
        cout << 2 * arr[i-1] - cur << ' ';
        cur = 2 * arr[i-1] - cur;
    }
    return 0;
}


Measured memory_bytes: 2176
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

int main() {
	ll n;
	cin>>n;
	ll a[200010];
	for(ll i=0;i<n;i++){
		ll x;
		cin>>x;
		x--;
		a[x]=i;
	}
	ll cnt=1;
	ll ans=1;
	for(ll i=1;i<n;i++){
		if(a[i-1]<a[i]){
			cnt++;
			ans=max(ans,cnt);
		}
		else{
			cnt=1;
		}
	}
	cout << n-ans;
	// your code goes here
	return 0;
}

Measured memory_bytes: 1792
import bisect,collections,copy,heapq,itertools,math,numpy,string
import sys
sys.setrecursionlimit(10**7)

def S(): return sys.stdin.readline().rstrip()
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())


def isBingoYoko(ans):
    for bool_i_list in ans:
        for bj in bool_i_list:
            if bj==False:
                break
            else:
                pass
        else:
            print("Yes")
            exit(0)

def isBingoNaname(ans):
    if (ans[0][0] and ans[1][1] and ans[2][2]) or ((ans[0][2] and ans[1][1] and ans[2][0])):
        print("Yes")
        exit(0)
    else:
        pass

def main():
    A = [LI() for _ in range(3)]
    N = I()
    B = [I() for _ in range(N)]
    ans = [[False for _ in range(3)] for _ in range(3)]
    for b in B:
        for i in range(len(A)):
            if b in A[i]:
                j = A[i].index(b)
                ans[i][j] = True

    isBingoYoko(ans)
    isBingoYoko(list(numpy.array(ans).T))
    isBingoNaname(ans)
    print("No")

main()



Measured memory_bytes: 12488
N = int(input())
a = list(map(int, input().split()))
ans = [0]*N
ct = 0
for i in reversed(range(N)):
    balls = sum(ans[2*i+1::i+1])
    if a[i] % 2:
        if balls % 2:
            pass
        else:
            ans[i] = 1
            ct += 1
    else:
        if balls % 2:
            ans[i] = 1
            ct += 1
        else:
            pass
print(ct)
for i in range(N):
    if ans[i]:
        print(i+1)


Measured memory_bytes: 8384
package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)
	var arr []int
	for tmp := n; tmp > 0; tmp = (tmp - 1) / 26 {
		arr = append(arr, (tmp-1)%26)
	}
	var runes = make([]rune, len(arr))
	for i := 0; i < len(arr); i++ {
		runes[i] = rune('a' + arr[len(arr)-1-i])
	}
	fmt.Println(string(runes))
}


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

using namespace std;

typedef long long          	ll;
typedef long long unsigned 	llu;
typedef double             	dl;
typedef pair<int,int>      	pii;
typedef pair<ll,ll>     	pll;
typedef vector<int>        	vi;
typedef vector<ll>        	vl;
typedef map<int,int> 		mii;
typedef map<ll,ll>         	mll;
typedef map<string,int>    	msi;
typedef map<char,int>      	mci;
typedef pair<int ,pii>      piii;
typedef vector<pii>         vpii;
typedef vector<piii>        vpiii;

#define pi                  acos(-1.0)
#define S                   second
#define F                   first
#define pb                  push_back
#define MP                  make_pair
#define mem(a,b)            memset(a,b,sizeof a)
#define all(v)              v.begin(),v.end()
#define vsort(v)            sort(v.begin(),v.end())
#define IO                  ios_base::sync_with_stdio(false);cin.tie(NULL)
#define gcd(a,b)            __gcd(a,b)

#define I(a)                scanf("%d",&a)
#define I2(a,b)             scanf("%d%d",&a,&b)
#define L(a)                scanf("%lld",&a)
#define L2(a,b)             scanf("%lld%lld",&a,&b)
#define D(a)                scanf("%lf",&a)

#define SP                  cout<<" ";
#define PI(a)               printf("%d",a)
#define PL(a)               printf("%lld",a)
#define PD(a)               printf("%lf",a)
#define CHK                 cout<<"MK"<<endl

template <class T> inline T BMOD(T p,T e,T m){T ret=1;while(e){if(e&1) ret=(ret*p)%m;p=(p*p)%m;e>>=1;}return (T)ret;}
template <class T> inline T MODINV(T a,T m){return BMOD(a,m-2,m);}
template <class T> inline T isPrime(T a){for(T i=2;i<=sqrt(double(a));i++){if(a%i==0){return 0;}}return 1;}
template <class T> inline T lcm(T a, T b){return (a/gcd(a,b))*b;}
template <class T> inline T power(T a, T b){return (b==0)?1:a*power(a,b-1);}
template <class T> inline string to_str(T t) { stringstream ss; ss<<t; return ss.str();}
template <class T> inline long long toLong(T t) {stringstream ss;ss<<t;long long ret;ss>>ret;return ret;}
template <class T> inline int toInt(T t) {stringstream ss;ss<<t;int ret;ss>>ret;return ret;}

//~ cout << fixed << setprecision(20) << Ans << endl;
//~ priority_queue<piii,vpiii, greater<piii> >pq; //for dijkstra
/*                 _                      */
/*____________|\/||_||\||_________________*/



string buffer;
int INT(){
	getline(cin,buffer);
	return toInt(buffer);
}
int LONG(){
	getline(cin,buffer);
	return toLong(buffer);
}

#define MX 150010
const ll MD = 1e9+7;


int main()
{
    IO;
    int n, m;
    ll a[55], b[55], x[55], y[55];
    cin >> n >> m;
    for(int i = 0; i < n; i++) cin >> a[i] >> b[i];
    for(int i = 0; i < m; i++) cin >> x[i] >> y[i];
    for(int i = 0; i < n; i++) {
        ll mx = 1e14, id = 1;
        for(int j = 0; j < m; j++) {
            ll t  = abs(a[i] - x[j]) + abs(b[i] - y[j]);
            if(t < mx) {
                mx=t;
                id = j + 1;
            }
        }
        cout << id << endl;
    }
    return 0;
}


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

int main () {
	string s, result="";
	int n;
	cin>>n;
	cin>>s;
	
	for (int i=0;i<s.length();i++) {
		result+=char(int(s[i])+ n- 65) % 26 + 65;
	}
	cout<<result<<endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int num = Integer.parseInt(sc.nextLine());
		sc.close();
		int ans = 0;

		if (num < 10) {
			ans = num;
		} else if (num < 100) {
			ans = 9;
		} else if (num < 1000) {
			ans = num - 99 + 9;
		} else if (num < 10000) {
			ans = 999 - 99 + 9;
		} else if (num < 100000) {
			ans = num - 9999 + 999 - 99 + 9;
		} else if (num < 1000000) {
			ans = 99999 - 9999 + 999 - 99 + 9;
		}

		System.out.println(ans);

	}
}


Measured memory_bytes: 23764
import java.util.*;

public class Main {
    static Scanner scanner = new Scanner(System.in);

    public static void main(String[]$) {
        String s = scanner.next();
        int n = s.length();
        List<Integer> list = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            if (s.charAt(i) == 'A') {
                list.add(1);
            } else if (i != n - 1 && s.charAt(i) == 'B' && s.charAt(i + 1) == 'C') {
                list.add(2);
                i++;
            } else if (list.isEmpty() || list.get(list.size() - 1) != 3) {
                list.add(3);
            }
        }
        long ans = 0;
        int count = 0;
        for (int i = list.size() - 1; i >= 0; i--) {
            if (list.get(i) == 1) {
                ans += count;
            } else if (list.get(i) == 2) {
                count++;
            } else {
                count = 0;
            }
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 28856
#include <stdio.h>
#include <string.h>
#include <limits.h>
#include <math.h>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <stack>
#include <queue>

typedef unsigned long long ULLONG;
typedef long long LLONG;
static const LLONG MOD_NUM = 1000000007;//998244353;

template<class _T> static void get(_T& a) {
	std::cin >> a;
}
template<class _T> static void get(_T& a, _T& b) {
	std::cin >> a >> b;
}
template<class _T> static void get(_T& a, _T& b, _T& c) {
	std::cin >> a >> b >> c;
}

static void exec();

int main()
{
	exec();
	fflush(stdout);
	return 0;
}
template <class _T> static _T tp_modpow(_T a, _T n, _T mod = (_T)1) {
	_T ans = 1;
	while (n > 0) {
		if (n & 1) {
			ans = (ans * a) % mod;
		}
		a = (a * a) % mod;
		n >>= 1;
	}
	return ans;
}
template <class _Ty> class PermComb
{
protected:

	_Ty _maxNum = 0;
	_Ty _use_mod = 0;
	_Ty* _fact = 0;
	_Ty* _inv = 0;
	_Ty* _finv = 0;

	PermComb() {}

public:
	PermComb(_Ty maxNum, _Ty use_mod = 0) {
		_maxNum = maxNum;
		_use_mod = use_mod;
		_fact = new _Ty[(unsigned int)maxNum + 1];
		_fact[0] = _fact[1] = 1;

		if (_use_mod) {
			_inv = new _Ty[(unsigned int)maxNum + 1];
			_finv = new _Ty[(unsigned int)maxNum + 1];
			_inv[0] = _inv[1] = 1;
			_finv[0] = _finv[1] = 1;
		}

		for (_Ty i = 2; i <= maxNum; i++) {
			_fact[i] = _fact[i - 1] * i;
			if (_use_mod) {
				_fact[i] %= _use_mod;
				_inv[i] = _use_mod - _inv[_use_mod % i] * (_use_mod / i) % _use_mod;
				_finv[i] = _finv[i - 1] * _inv[i] % _use_mod;
			}
		}
	}

	//	get permutation value
	virtual _Ty nPk(int n, int k) {
		if ((k > _maxNum) || (n > _maxNum) || (k > n) || (k < 0) || (n < 0)) {
			return 0;
		}
		return(_fact[n] / _fact[n - k]);
	}

	//	get combination value
	virtual _Ty nCk(int n, int k) {
		_Ty ans = 0;
		if ((k > _maxNum) || (n > _maxNum) || (k > n) || (k < 0) || (n < 0)) {
			ans = 0;
		}
		else if (_use_mod == 0) {
			ans = nPk(n, k);
			ans /= _fact[k];
		}
		else {
			ans = _fact[n] * (_finv[k] * _finv[n - k] % _use_mod) % _use_mod;
		}
		return ans;
	}

	//	destructor
	~PermComb() {
		delete[] _fact;
		delete[] _inv;
		delete[] _finv;
	}
};

static void exec()
{
	int K;
	get(K);

	std::string orgs;
	get(orgs);

	int len = orgs.length();
	LLONG ans = 0;
	PermComb<LLONG> cmb(len + K, MOD_NUM);

	for (int k = 0; k <= K; k++) {
		LLONG tmp = (cmb.nCk(len + K - k - 1, len - 1) * tp_modpow<LLONG>(25, K - k, MOD_NUM)) % MOD_NUM;
		tmp *= tp_modpow<LLONG>(26, k, MOD_NUM);
		ans = (ans + tmp) % MOD_NUM;
	}

	printf("%lld\n", ans);
}


Measured memory_bytes: 51124
#include <bits/stdc++.h>
using namespace std;
int main(void){
  int N, M;
  int sum = 0;
  cin >> N >> M;
  vector<int> A(N);
  for(int i = 0; i < N; i++){
    cin >> A[i];
    sum += A[i];
  }
  sort(A.begin(), A.end());
  for(int i = 1; i <= M; i++){
    if(A[N - i] < (double)sum / 4 / M){
      cout << "No";
      return 0;
    }
  }
  cout << "Yes";
  return 0;
}


Measured memory_bytes: 256
import java.util.*;
import static java.lang.Integer.*;
//import static java.lang.Long.*;
//import static java.lang.Math.*;
import static java.lang.Math.*;
import static java.lang.System.*;

public class Main {
	public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(in);
		int n = parseInt(sc.next());
		int k = parseInt(sc.next());
		sc.close();
		int m=1;
		while(m<k&&n>0) {
			m*=2;
			n--;
		}
		out.println(m+n*k);
	}
}


Measured memory_bytes: 23892
#include <bits/stdc++.h>
#define int long long
#define N 110
using namespace std;
const int INF = 1LL<<55;
const int mod = (1e9)+7;
const double EPS = 1e-8;
const double PI = 6.0 * asin(0.5);
template<class T> T Max(T &a,T b){return a=max(a,b);}
template<class T> T Min(T &a,T b){return a=min(a,b);}
vector<vector<int> >D;

signed main(){
  
  while(1){
    int n;
    cin>>n;
    if(!n) break;
    D.clear(); D.resize(25);
    for(int i=0;i<25;i++) D[i].resize(i,0);
    
    for(int i=0;i<n;i++){
      int d,t;
      cin>>d>>t;
      for(int j=0,a;j<d;j++) cin>>a, D[d][(j-t+d)%d]+=a;
    }
    
    vector<vector<int> > dp(N);
    dp[1].push_back(0);
    for(int i=1;i<=24;i++){
      int d = dp[i].size();
      if(i == 13 || i == 17 || i == 19 || i == 23) {
        int mx = 0;
        for(int j=0;j<i;j++) Max(mx,D[i][j]);
        dp[i+1].resize(d);
        for(int j=0;j<d;j++) dp[i+1][j] = dp[i][j] + mx;
        continue;
      }
      int lcm = d * i / __gcd(d,i);
      dp[i+1].resize(lcm);
      for(int j=0;j<lcm;j++) dp[i+1][j] = dp[i][j%d] + D[i][j%i];
    }
    int ans = 0;
    for(int a:dp[25]) Max(ans,a);
    cout<<ans<<endl;
  }  
  return 0;
}

Measured memory_bytes: 7804
N = int(input())
s = [''.join(sorted(input())) for i in range(N)]
 
dic = {}
cnt = 0
for i in range(N):
    if s[i] in dic:
        cnt += dic[s[i]]
        dic[s[i]] += 1
    else:
        dic[s[i]] = 1
print(cnt)
 

Measured memory_bytes: 19400
let N = Int(readLine()!)!
var ans = 0
if N >= 105 {
  	ans += 1
    for i in 107.stride(to: N+1, by: 2) {
        var cnt = 0
        for j in 3.stride(to: i, by: 2) {
            if i % j == 0 {
                cnt += 1
            }
        }
        if cnt == 6 {
            ans += 1
        }
    }
}
print(ans)


Measured memory_bytes: 640
#include <cstdio>
#include<iostream>
#include<algorithm>

using namespace std;
 
int main(void){

	double inp;

	while(cin>>inp){
		if(inp<=48) cout<<"light fly"<<endl;
		else if(inp<=51) cout<<"fly"<<endl;
		else if(inp<=54) cout<<"bantam"<<endl;
		else if(inp<=57) cout<<"feather"<<endl;
		else if(inp<=60) cout<<"light"<<endl;
		else if(inp<=64) cout<<"light welter"<<endl;
		else if(inp<=69) cout<<"welter"<<endl;
		else if(inp<=75) cout<<"light middle"<<endl;
		else if(inp<=81) cout<<"middle"<<endl;
		else if(inp<=91) cout<<"light heavy"<<endl;
		else cout<<"heavy"<<endl;
	}

    return 0;
}

Measured memory_bytes: 1220
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

/**
 *
 * @author yoovraj.shinde
 */
public class Main {
    public static void main(String[] args) {
    //        if (true) return;
        Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int num  = in.nextInt();
        System.out.println(num * 6.2832);
    }

}


Measured memory_bytes: 35912