akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define y1 zzz
#define fi first
#define se second
#define PII pair<int2,int>
#define PII2 pair<int,PII >
#define PII3 pair<PII,int >
#define PII4 pair<PII,PII >
#define all(x) (x).begin(),(x).end()
#define pb push_back
map<string,int> m;
int n,maxa;
string s;
vector<pair<int,string>>v;
int cmp(pair<int,string> a,pair<int,string> b)
{
    if(a.fi==b.fi)return a.se<b.se;
    return a.fi>b.fi;
}
void solve()
{
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>s;
        m[s]++;
        maxa=max(maxa,m[s]);
    }
    for(auto it:m)if(it.se==maxa)v.pb({it.se,it.fi});
    sort(all(v),cmp);
    for(auto it:v)cout<<it.se<<'\n';
}
int32_t main()
{
    //ios_base::sync_with_stdio(0);
    //cin.tie(0);cout.tie(0);
    //freopen("XORQUERY.inp","r",stdin);
    //freopen("XORQUERY.out","w",stdout);
    //int t;cin>>t;while(t--)
    solve();
    return 0;
}


Measured memory_bytes: 29428
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  long H,ans=0,t=1;
  cin >> H;
  while(true){
    ans+=t;
  	t*=2;
    if(H==1)break;
    H/=2;
  }
  cout << ans << endl;
}

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

#define MOD 1000000007
using namespace std;

typedef long long int ll;

ll modulo(ll x, ll y) {
    return ((x % MOD) + (y % MOD)) % MOD;
}

int main() {
    int h, w;
    cin >> h >> w;
    char mat[h][w];
    for (int i = 0; i < h; ++i) {
        for (int j = 0; j < w; ++j) {
            cin >> mat[i][j];
        }
    }
    vector<vector<ll> > dp(h, vector<ll>(w, 0));
    dp[0][0] = 1;
    for (int i = 0; i < h; ++i) {
        for (int j = 0; j < w; ++j) {
            if (mat[i][j] == '#') {
                dp[i][j] = -1;
            } else {
                if (i - 1 >= 0) {
                    if (dp[i - 1][j] > 0) {
                        dp[i][j] += modulo(dp[i][j], dp[i - 1][j]);
                    }
                }
                if (j - 1 >= 0) {
                    if (dp[i][j - 1] > 0) {
                        dp[i][j] = modulo(dp[i][j], dp[i][j - 1]);
                    }
                }
            }
        }
    }
    cout << dp[h - 1][w - 1];
}


Measured memory_bytes: 9088
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split())) + [0]
satis = 0
for i in range(N):
  satis += B[A[i]-1]
  if i > 0 and A[i] == A[i-1]+1:
    satis += C[A[i-1]-1]
print(satis)

Measured memory_bytes: 3064
import java.io.*;
 
class Main {
  public static void main(String[] args)throws IOException{
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    StringBuilder sb = new StringBuilder();
    int n = Integer.parseInt(br.readLine());
 
    String line[] = br.readLine().split(" ");
    int min = Integer.MAX_VALUE;
    int max = Integer.MIN_VALUE;
    long sum = 0;
    int ai;
    
      for(int i = 0; i < n; i++){
    	  ai = Integer.parseInt(line[i]);
    	  if(ai < min)  min = ai;
    	  if(ai > max)  max = ai;
    	  sum += ai;
      }
      
      System.out.println(min +" "+ max +" "+ sum);
  }
}

Measured memory_bytes: 28608
#include <iostream>
#define ll long long

using namespace std;

int main(){
	ll n;
	cin >> n;
	int a[n];
	for (int i = 0; i < n; ++i)
		cin >>a[i];
	ll max =0;
	ll sum =0;
	for (int i = 0; i < n-1; ++i)
	{
		max = (a[i] >max)?a[i]:max;
		if(max>a[i+1]){
			sum +=(max -a[i+1]);
		}
	}
		 
	cout <<sum ;
	return 0;
}

Measured memory_bytes: 4344
#include<stdio.h>
#include<string.h>
int main(){
  int n,i,j,m,m2,s,t,k,T,w;
  char a[1001],b[100],c[1001],d[1001];
  
  scanf("%s",a);
  m=strlen(a);
  
  scanf("%d",&n);
  
  for(j=0;j<n;j++){
    
    scanf("%s",b);
    m2=strlen(b);
    
    scanf("%d %d",&s,&t);
    
    if(b[0]=='r' && b[1]=='e' && b[2]=='p') {
      scanf("%s",c);
      
      for(i=s;i<=t;i++){
	a[i]=c[i-s];
      }
      
    }

  else if(b[0]=='r' && b[1]=='e' && b[2]=='v'){
      
        for(i=s;i<=t;i++){
	d[i]=a[i];
      }
	
      for(k=s;k<=t;k++){
	a[k]=d[t-k+s];
      }
    }
    
    else {
      for(i=s;i<=t;i++){
	printf("%c",a[i]);
      }
      printf("\n");
    }
  }
  
return 0;
}

Measured memory_bytes: 576
using System;
using System.Collections;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Collections.Generic;
using System.Threading.Tasks;

class Program
{
	//Main
	static void Main(string[] args)
	{
		//読み込む
		int N = int.Parse(Console.ReadLine());
		long[] An = Console.ReadLine().Split(' ').Select(i => long.Parse(i)).ToArray();

		//バケツ
		int[] sumArr = new int[100000000];

		for(int i=0; i<N; i++){
				long sum = An[i] + (i+1);
				if(sum <= 100000000){
						sumArr[sum] ++;
				}
		}

		long cnt = 0;
		for(int i=0; i<N; i++){
				long diff = -(An[i] - (i+1));
				if(diff > 0){
						cnt += sumArr[diff];
				}
		}

		Console.WriteLine(cnt);

	}
}



Measured memory_bytes: 78064
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cmath>
typedef long long ll;
typedef double dd;
#define For(i,j,k) for (int i=j;i<=k;++i)
#define Forr(i,j,k) for (int i=j;i>=k;--i)
#define Set(a,p) memset(a,p,sizeof(a))
using namespace std;

template<typename T>bool chkmax(T& a,T b) {return a<b?a=b,1:0;}
template<typename T>bool chkmin(T& a,T b) {return a>b?a=b,1:0;}

const int maxn=100000+100;
const ll inf=1e15;
int n;
ll m,ans=-inf;
ll dis[maxn],val[maxn],pre_val[maxn],suf_val[maxn];
ll pre_big[maxn],suf_big[maxn];

inline void read(ll &x) {
	x=0;
	ll p=1;
	char c=getchar();
	while (!isdigit(c)) {if (c=='-') p=-1; c=getchar();}
	while (isdigit(c)) {x=(x<<1)+(x<<3)+(c-'0'); c=getchar();}
	x*=p;
}

inline void file() {
	freopen("D.in","r",stdin);
	freopen("D.out","w",stdout);
}

int main() {
//	file();
	scanf("%d",&n); read(m);
	For (i,1,n) {
		read(dis[i]); read(val[i]);
		pre_val[i]=suf_val[i]=val[i];
	}
	For (i,1,n) pre_val[i]+=pre_val[i-1];
	Forr (i,n,1) suf_val[i]+=suf_val[i+1];
	For (i,1,n) pre_big[i]=max(pre_big[i-1],pre_val[i]-dis[i]*2);
	Forr (i,n,1) suf_big[i]=max(suf_big[i+1],suf_val[i]-(m-dis[i])*2);
	For (i,1,n) chkmax(ans,suf_big[i+1]+pre_val[i]-dis[i]);
	Forr (i,n,1) chkmax(ans,pre_big[i-1]+suf_val[i]-(m-dis[i]));
	printf("%lld\n",max(ans,0ll));
	return 0;
}


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

int main(){
  string S;
  cin>>S;
  if(S=="SUN"){
    cout<<7<<endl;
  }
  else if(S=="MON"){
    cout<<6<<endl;
  }
  else if(S=="TUE"){
    cout<<5<<endl;
  }
  else if(S=="WED"){
    cout<<4<<endl;
  }
  else if(S=="THU"){
    cout<<3<<endl;
  }
  else if(S=="FRI"){
    cout<<2<<endl;
  }
  else if(S=="SAT"){
    cout<<1<<endl;
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <climits>

using namespace std;
typedef long long unsigned int ll;
typedef pair<int, int> P;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

// #define amari(x) ((x) % 1000000007)
#define amari(x) ((x) % 998244353)

#define fillInt(xs, x)        \
  for (int i = 0; i < (x); i++) \
    scanf("%d", &xs[i]);
#define fillLong(xs, x)       \
  for (int i = 0; i < (x); i++) \
    scanf("%ld", &xs[i]);
#define fillString(xs, x)       \
  for (int i = 0; i < (x); i++) \
    cin >> xs[i];
#define sortv(xs) sort(xs.begin(), xs.end())
#define sortvdi(xs) sort(xs.begin(), xs.end(), std::greater<int>())
#define lbv(xs, x) lower_bound(xs.begin(), xs.end(), x) - xs.begin()
#define ubv(xs, x) upper_bound(xs.begin(), xs.end(), x) - xs.begin()
#define bs(xs, x) binary_search(xs.begin(), xs.end(), x)

#define rep(i,n) for(long i=0; i<(n); i++)
#define isValidPoint(x, y, mx, my) x >= 0 && x  < mx && y >= 0 && y < my

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

std::vector<ll> enum_div(ll n)//nの約数を列挙
{
	std::vector<ll> ret;
	for(ll i=1 ; i*i<=n ; ++i)
	{
		if(n%i == 0)
		{
			ret.push_back(i);
			if(i!=1 && i*i!=n)
			{
				ret.push_back(n/i);
			}
		}
	}
	return ret;
}

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

  int n, k;
  cin >> n >> k;

  string s;

  cin >> s;

  s[k-1] = tolower(s[k-1]);

  cout << s << endl;
}


Measured memory_bytes: 888
h,w = map(int,input().split())
s = [input() for i in range(h)]

def judge(i,j):
  if s[i][j]==".":
    return True
  else:
    return judge_zibun(i-1,j) or judge_zibun(i+1,j) or judge_zibun(i,j-1) or judge_zibun(i,j+1)
    
def judge_zibun(i,j):
  if not(0<=i<h and 0<=j<w):
    return False
  if s[i][j]=="#":
    return True
  else:
    return False

ans = True
for i in range(h):
  for j in range(w):
    ans = ans & judge(i,j)
if ans:
  print("Yes")
else:
  print("No")
      

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

#ifdef DEBUG
#include "inc/debug.hpp"
#else
#define debug(...) 42
#endif

ll dp[102][2][4];

int main() {
    string N;
    cin >> N;
    int D = N.size();
    int K;
    cin >> K;

    dp[0][0][K] = 1;
    for (int i=0; i<D; ++i) {
        for (int j=0; j<2; ++j) {
            for (int k=0; k<=K; ++k) {
                if (j == 0) {
                    // 一致 -> 一致
                    if (N[i] == '0') {
                        dp[i+1][j][k] += dp[i][j][k];
                    } else {
                        if (k > 0) {
                            dp[i+1][j][k-1] += dp[i][j][k];
                        }
                    }
                    // 一致 -> 未満
                    if (N[i] == '0') {
                        // pass
                    } else {
                        if (k > 0) {
                            dp[i+1][1][k-1] += dp[i][j][k] * (N[i] - '1');
                        }
                        dp[i+1][1][k] += dp[i][j][k];
                    }
                } else {
                    // 未満 -> 未満
                    if (k > 0) {
                        dp[i+1][j][k-1] += dp[i][j][k] * 9;
                    }
                    dp[i+1][j][k] += dp[i][j][k];
                }
            }
        }
    }
    cout << dp[D][0][0] + dp[D][1][0] << endl;

    return 0;
}

Measured memory_bytes: 256
def GCD(a:int , b: int) -> int:
    return a if b == 0 else GCD(b, a % b)

def get_divisor(n: int) -> list:
    divisor = []
    for i in range(1, n + 1):
        if i * i > n:
            break
        if n % i == 0:
            divisor.append(i)
            if i != n // i:
                divisor.append(n // i)
    divisor.sort()
    return divisor

a, b = map(int, input().split())
divisor =  get_divisor(GCD(a, b))

ans = 1
used = [0] * len(divisor)
used[0] = 1
for i in range(1, len(divisor)):
    if used[i] == 0:
        ans += 1
        for j in range(i+1, len(divisor)):
            if used[j] == 0 and divisor[j] % divisor[i] == 0:
                used[j] = 1

print(ans)


Measured memory_bytes: 3272
#include <iostream>
#include <vector>
#include <map>
#include <string>
#include <sstream>
#include <math.h>
#include <algorithm>
#include <queue>
using namespace std;
//for (int i = 0; i < N; i++){}
//for (int i = 0; i < N; i++){}

int main() {
    string S;
    cin >> S;
    string t1, t2;
    t1 = S;

    int cnt = 0;
    //最初0ver
    if(t1[0] != '0'){
        t1[0] == '0';
        cnt++;
    }
    for (int i = 1; i < t1.size(); i++){
//        cout << t1[i] << ":" << cnt << endl;
        if(t1[i] == t1[i-1]){
            if(t1[i-1] == ('0')){
                t1[i] = '1';
                cnt++;
            }else if(t1[i-1] == ('1')){
                t1[i] = '0';
                cnt++;
            }
        }
    }
//    cout << cnt << endl;
    t2 = S;

    int cnt2 = 0;
    //最初1ver
    if(t2[0] != '1'){
        t2[0] == '1';
        cnt2++;
    }
    for (int i = 1; i < t2.size(); i++){
//        cout << t2[i] << ":" << cnt2 << endl;
        if(t2[i] == t2[i-1]){
            if(t2[i-1] == '0'){
                t2[i] = '1';
                cnt2++;
            }else if(t2[i-1] == ('1')){
                t2[i] = '0';
                cnt2++;
            }
        }
    }


    int res = min(cnt, cnt2);

    cout << res << endl;
}

Measured memory_bytes: 512
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<iomanip>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<vector>
#define rep(i,x,y) for(register int i=(x);i<=(y);++i)
#define dwn(i,x,y) for(register int i=(x);i>=(y);--i)
#define view(u,k) for(int k=fir[u];~k;k=nxt[k])
#define LL long long
#define maxn 5007
#define maxm 207
#define maxc 2000007
using namespace std;
int read()
{
    int x=0,f=1;char ch=getchar();
    while(!isdigit(ch)&&ch!='-')ch=getchar();
    if(ch=='-')f=-1,ch=getchar();
    while(isdigit(ch))x=(x<<1)+(x<<3)+ch-'0',ch=getchar();
    return x*f;
}
void write(LL x)
{
    if(x==0){putchar('0'),putchar('\n');return;}
    int f=0;char ch[20];
    if(x<0)putchar('-'),x=-x;
    while(x)ch[++f]=x%10+'0',x/=10;
    while(f)putchar(ch[f--]);
    putchar('\n');
    return;
}
struct ad{int l,r,pos;LL a;}c[maxc];
int n,m,lmx[maxn][maxm],rmx[maxn][maxm],stk[maxn],tp,cntc;
LL a[maxn],b[maxn][maxm],tr[maxn],s[maxn],ans;
int lt(int x){return x&(-x);}
void add(int x,LL k){if(!x)return;for(;x<=n;x+=lt(x))tr[x]+=k;return;}
LL ask(int x){LL k=0;for(;x;x-=lt(x))k+=tr[x];return k;}
bool cmpp(ad x,ad y){return x.pos<y.pos;}
int main()
{
    n=read(),m=read();
    rep(i,1,n-1)a[i]=read(),s[i]=s[i-1]+a[i];
    rep(i,1,n)rep(j,1,m)b[i][j]=read();
    rep(i,1,m)
    {
    	tp=0;
    	rep(j,1,n)
    	{
    		while(tp>0&&b[stk[tp]][i]<b[j][i])tp--;
    		lmx[j][i]=tp?stk[tp]+1:1;
    		stk[++tp]=j;
    	}
    	tp=0;
    	dwn(j,n,1)
    	{
    		while(tp>0&&b[stk[tp]][i]<b[j][i])tp--;
    		rmx[j][i]=tp?stk[tp]-1:n;
    		stk[++tp]=j;
    	}
    }
    rep(i,1,n)rep(j,1,m)
	{
		cntc++,c[cntc].l=lmx[i][j],c[cntc].r=i,c[cntc].pos=i,c[cntc].a=b[i][j];
		cntc++,c[cntc].l=lmx[i][j],c[cntc].r=i,c[cntc].pos=rmx[i][j]+1,c[cntc].a=-b[i][j];
	}
	sort(c+1,c+cntc+1,cmpp);
	int now=1;
	rep(i,1,n)
	{
		while(now<=cntc&&c[now].pos==i){add(c[now].r+1,-c[now].a),add(c[now].l,c[now].a);now++;}
		rep(j,1,i)ans=max(ans,ask(j)-(s[i-1]-s[j-1]));
	}
	write(ans);
	return 0;
}

Measured memory_bytes: 63488
// 2020-08-29 21:05:30
// clang-format off
#include<bits/stdc++.h>
#ifdef LOCAL
#include "lib/debug.hpp"
#else
#define debug(...) 1
#endif
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define rep(i, n) REP(i, 0, (n))
#define repc(i, n) REPC(i, 0, (n))
#define REP(i, n, m) for (int i = (int)(n); i < (int)(m); i++)
#define REPC(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define REPCM(i, n, m) for (int i = (int)(n); i >= (int)(m); i--)
using namespace std;
using ll = long long;
using ld = long double;
using pr = pair<ll, ll>;
using vll = vector<ll>;
using vpr = vector<pr>;
using P = pair<int, int>;
template<class T> inline bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; } else return false; }
template<class T> inline bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } else return false; }
const int mod = 1000000007;
struct mint {
  ll val;
  constexpr mint(ll v = 0) noexcept : val(v % mod) {
    if (val < 0) val += mod;
  }
  constexpr mint operator + (const mint& rhs) const noexcept {
    return mint(*this) += rhs;
  }
  constexpr mint operator - (const mint& rhs) const noexcept {
    return mint(*this) -= rhs;
  }
  constexpr mint operator * (const mint& rhs) const noexcept {
    return mint(*this) *= rhs;
  }
  constexpr mint operator / (const mint& rhs) const noexcept {
    return mint(*this) /= rhs;
  }
  constexpr mint operator ~ () const noexcept {
    ll a = this->val, b = mod, u = 1, v = 0;
    while (b > 0) {
      ll t = a / b;
      a -= t * b;
      u -= t * v;
      ll c = a; a = b; b = c;
      ll w = u; u = v; v = w;
    }
    if (u < 0) u += mod;
    u %= mod;
    return u;
  }
  constexpr mint& operator += (const mint& rhs) noexcept {
    val += rhs.val;
    if (val >= mod) val -= mod;
    return *this;
  }
  constexpr mint& operator -= (const mint& rhs) noexcept {
    if (val < rhs.val) val += mod;
    val -= rhs.val;
    return *this;
  }
  constexpr mint& operator *= (const mint& rhs) noexcept {
    val = val * rhs.val % mod;
    return *this;
  }
  constexpr mint& operator /= (const mint& rhs) noexcept {
    val = val * (~(mint(rhs))).val % mod;
    return *this;
  }
  friend mint modpow (mint a, ll n) noexcept {
    auto res = mint(1);
    while(n > 0) {
      if(n&1) res *= a;
      a *= a;
      n >>= 1;
    }
    return res;
  }
  friend std::ostream& operator << (std::ostream& os, const mint& a) noexcept {
    return os << a.val;
  }
  friend std::string debug_s (mint a) noexcept {
    return std::to_string(a.val);
  }
};

// clang-format on
void answer() {
  int n;
  cin >> n;
  vector<ll> a(n), sum(n);
  rep(i, n) {
    cin >> a[i];
    sum[i] = a[i];
    if (i) sum[i] += sum[i - 1];
  }
  mint ans = 0;
  REP(i, 1, n) { ans += mint(a[i]) * sum[i - 1]; }
  cout << ans << '\n';
}
int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  answer();
  return 0;
}

Measured memory_bytes: 6360
#include <iostream>
#include <vector>
 
int main(){
  int N, M, correct = 0, penalties = 0;
  std::cin>>N>>M;
  std::vector<int> P, penalty(N+1, 0);
  std::vector<std::string> S, R(N+1, "");

  for(int i=0;i<M;++i){
    int a;
    std::string b;
      std::cin>>a>>b;
      P.push_back(a);
      S.push_back(b);
      if(R.at(P.at(i)) != "AC"){
        if(S.at(i) == "AC"){
          R.at(P.at(i)) = "AC";
          ++correct;
          penalties += penalty.at(P.at(i));
        } else {
          ++penalty.at(P.at(i));
        }
      }
  }

  std::cout<<correct<<" "<<penalties;
  return 0;
}


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

int main(void){
    string s;
    cin >> s;
    for(int i{0}; i<s.size(); ++i){
        if(s[i]=='1')
            s[i] = '9';
        else
            s[i] = '1';
    }
    cout << s << endl;

}

Measured memory_bytes: 256
n, m = gets.split("\s").map(&:to_i)

s = []
c = []
sc = []

m.times do |i|
  s[i], c[i] = gets.split("\s").map(&:to_i)
  sc << [s[i], c[i]]
end

if (s.size - s.uniq.size) > 0 && (sc.size - sc.uniq.size) <= 0
  print '-1'
elsif n > 1 && s.index(1) && c[s.index(1)].zero?
  print '-1'
else
  num = [0]
  if n > 1
    num = [1]
    (n-1).times do
      num << 0
    end
  end

  m.times do |i|
    num[s[i]-1] = c[i]
  end

  print num.join('')
end


Measured memory_bytes: 3836
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define Fast_IO ios::sync_with_stdio(false);
#define fir first
#define sec second
#define mod 998244353
inline int read()
{
	char ch=getchar(); int nega=1; while(!isdigit(ch)) {if(ch=='-') nega=-1; ch=getchar();}
	int ans=0; while(isdigit(ch)) {ans=ans*10+ch-48;ch=getchar();}
	if(nega==-1) return -ans;
	return ans;
}
typedef pair<int,int> pii;
int add(int x,int y){return x+y>=mod?x+y-mod:x+y;}
int sub(int x,int y){return x-y<0?x-y+mod:x-y;}
int mul(int x,int y){return 1LL*x*y%mod;}
#define N 200005
int a[N];
double sum[N];
signed main()
{
#ifdef __LOCAL__
	freopen("in.txt","r",stdin);
#endif
	int n=read(),k=read();
	for(int i=1;i<=n;i++) a[i]=read();
	for(int i=1;i<=n;i++) sum[i]=sum[i-1]+(a[i]+1.0)/2;
	double ans=0;
	for(int i=k;i<=n;i++)
	{
		double r=sum[i]-sum[i-k];
		if(r>ans) ans=r;
	}
	printf("%.6lf\n",ans);
#ifdef __LOCAL__
	cout<<"Time Used : "<<clock()<<endl;
#endif
	return 0;
}



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

//typedef
//------------------------------------------
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<LL, LL> PLL;

// grid
//--------------------------------------------
VL dx = {0, 1, 0, -1};
VL dy = {1, 0, -1, 0};
VL dx2 = {-1, 0, 1, -1, 1, -1, 0, 1};
VL dy2 = {-1, -1, -1, 0, 0, 1, 1, 1};
 
//debug
//--------------------------------------------
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

//roop
//--------------------------------------------
#define rep(i,s,n) for(LL i = (s); i < (n); i++)
#define rep0(i,n) rep(i,0,n)
#define rep1(i,n) rep(i,1,n+1)

int main(){
    int A, B, C;
    bool can = false;
    cin >> A >> B >> C;
    rep0(i, B){
        if (A * (i + 1) % B == C){
            can = true;
        } 
    }
    if (can) cout << "YES" << endl;
    else cout << "NO" << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <ctype.h>
#include <iostream>
#include <map>
#include <queue>
#include <string>
#include <vector>
using namespace std;

#define REP(i, n) for(int i = 0; i < n; i++)
typedef vector<int> vi;
typedef vector<vector<int>> vvi;

int i, j, k;

int vector_finder(std::vector<int> vec, int number) {
    auto itr = std::find(vec.begin(), vec.end(), number);
    size_t index = std::distance(vec.begin(), itr);
    if(index != vec.size()) { // 発見できたとき
        return 1;
    } else { // 発見できなかったとき
        return 0;
    }
}

int main() {

    string S;
    int f, b;
    cin >> S;

    vi mounth = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12};

    f = atoi(S.substr(0, 2).c_str());
    b = atoi(S.substr(2, 2).c_str());

    if(vector_finder(mounth, b)) {
        if(vector_finder(mounth, f)) {

            cout << "AMBIGUOUS" << endl;
        } else {
            cout << "YYMM" << endl;
        }
    } else {
        if(vector_finder(mounth, f)) {
            cout << "MMYY" << endl;
        } else {
            cout << "NA" << endl;
        }
    }
}

Measured memory_bytes: 256
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;

public class Main {
	public static void main(String args[]) {
		FastScanner scanner = new FastScanner();
		int n=scanner.nextInt();
		int t=scanner.nextInt();
		int[] a=new int[n];
		for(int i=0;i<n;i++) {
			a[i]=scanner.nextInt();
		}
		int min=Integer.MAX_VALUE;
		int adMax=Integer.MIN_VALUE;
		int ans=0;
		for(int i=0;i<n;i++) {
			if(a[i]<min) {
				min=a[i];
			}else if(a[i]>min) {
				int tmp=a[i]-min;
				if(adMax<tmp) {
					ans=1;
					adMax=tmp;
				}else if(adMax==tmp) {
					ans++;
				}
			}
		}
		System.out.println(ans);
	}
}


class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
    public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }
    public double nextDouble() { return Double.parseDouble(next());}
}


Measured memory_bytes: 24020
# coding: utf-8
import sys
import numpy as np

sr = lambda: sys.stdin.buffer.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N, X, Y = lr()
dist = []
for i in range(1, N+1):
    z = np.arange(i+1, N+1)
    d1 = z - i
    d2 = np.abs(i - X) + np.abs(z - Y) + 1
    d = np.minimum(d1, d2)
    dist.append(d)

dist = np.concatenate(dist)
cnt = np.bincount(dist, minlength=N)
print('\n'.join(cnt[1:].astype(str)))


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

#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rep2(i,s,n) for(int i = (s); i < (n); ++i)
#define ll long long
#define ld long double
#define P pair<ll,ll>
#define all(v) v.begin(),v.end()

const ll mod = 1e9+7;
const ll INF = 1e18;
const double pi = acos(-1.0);

int main(void)
{
    ll n; cin>>n;
    bool can=false;
    for(int i=1;i<=9;i++){
        for(int j=1;j<=9;j++){
            if(n==i*j) can=true;
        }
    }
    cout<<(can?"Yes":"No")<<endl;
    return 0;
}

Measured memory_bytes: 3628
#include <iostream>
#include <string>
#include <cctype>
using namespace std;
int main(void){
    
    string S1, S2, S3;
    cin >> S1 >> S2 >> S3;
    
    cout << (char)toupper(S1[0]) << (char)toupper(S2[0]) << (char)toupper(S3[0]) << endl;

}


Measured memory_bytes: 256
# encoding: UTF-8

array = gets.chomp.split

register = Hash.new
# array.each do |value|
for value in array
  if register.keys.include?(value)
    register[value] = register[value] + 1
  else
    register[value] = 1
  end
end

freq_word = ''

for key in register
  if key[1] == register.values.max
    freq_word = key[0]
    break
  end
end



long_word = ''
array.each do |s|
  if long_word.length < s.length
    long_word = s
  end
end

puts freq_word + ' ' + long_word

Measured memory_bytes: 6124
import java.util.*;
import java.io.*;
public class Main{
    public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		PrintWriter ou = new PrintWriter(System.out);
		int n = Integer.parseInt(sc.next());
		long a = 0;
		long b = 0;
		long c = 0;
		for(int i = 0 ; i < n ; i++){
			a = Integer.parseInt(sc.next());
			b += a;
			c += (a * a) % 1000000007;
			b %= 1000000007;
			c %= 1000000007;
		}
		b *= b;
		b %= 1000000007;
		b -= c;
		b %= 1000000007;
		while(b < 0){
			b += 1000000007;
		}
		if(b % 2 != 0){
			b += 1000000007;
		}
		b /= 2;
		ou.print(b + "\n");
		ou.flush();
    }
}

Measured memory_bytes: 59356
# -*- coding: utf-8 -*-
n = int(input())
a,b = map(int, input().split())
pl = list(map(int, input().split()))

na = 0
nb = 0
nc = 0
for p in pl:
    if p<=a:
        na += 1
    elif a+1<=p<=b:
        nb += 1
    else:
        nc += 1

print(min(na,nb,nc))


Measured memory_bytes: 3060
#include <algorithm>
#include <numeric>
#include <map>
#include <vector>
#include <cmath>
#include <iostream>

using namespace std;

int main() {
  vector<double> sx(510), sy(510), sz(510), norms(510);
  vector<double> tx(55), ty(55), tz(55), phi(55);
  vector<bool> visible(510);
  double eps = 1e-9;
  while (true) {
	int n, m;
	cin >> n;
	if (n == 0) break;
	for (int i = 0; i < n; i++) {
	  cin >> sx[i] >> sy[i] >> sz[i];
	}
	for (int i = 0; i < n; i++) {
	  norms[i] = sqrt(sx[i]*sx[i] + sy[i]*sy[i] + sz[i]*sz[i]);
	}
	cin >> m;
	for (int i = 0; i < m; i++) {
	  cin >> tx[i] >> ty[i] >> tz[i] >> phi[i];
	}
	fill(visible.begin(), visible.end(), false);
	for (int i = 0; i < m; i++) {
	  double normt = sqrt(tx[i]*tx[i] + ty[i]*ty[i] + tz[i]*tz[i]);
	  for (int j = 0; j < n; j++) {
		double inp = tx[i]*sx[j] + ty[i]*sy[j] + tz[i]*sz[j];
		double ang = acos(inp / normt / norms[j]);
		if (ang - phi[i] < -eps)
		  visible[j] = true;
	  }
	}
	int res = 0;
	for (int i = 0; i < n; i++)
	  if (visible[i])
		res++;
	cout << res << endl;
  }
}

Measured memory_bytes: 1328
use std::io::*;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
  let stdin = stdin();
  let stdin = stdin.lock();
  let token: String = stdin
    .bytes()
    .map(|c| c.expect("failed to read char") as char)
    .skip_while(|c| c.is_whitespace())
    .take_while(|c| !c.is_whitespace())
    .collect();
  token.parse().ok().expect("failed to parse token")
}

use std::cmp::{max, min};

fn main() {
  let s = read::<String>();

  let mut a: i32 = 0;
  let mut b: i32 = 0;
  let mut c: i32 = 0;
  let mut ans: i32 = 1000;

  for (i, v) in s.chars().enumerate() {
    if (i == 0) {
      a = v.to_string().parse::<i32>().unwrap();
    } else if (i == 1) {
      b = v.to_string().parse::<i32>().unwrap();
    } else {
      c = v.to_string().parse::<i32>().unwrap();
      ans = min(ans, (753 - (a * 100 + b * 10 + c)).abs());
      a = b;
      b = c;
    }
  }

  println!("{}", ans);
}



Measured memory_bytes: 4352
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <list>
#include <set>
#include <string>
#include <vector>

#define endl '\n'

using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int t = 1;
    // cin >> t;
    while (t--) {
    	int a[5];
    	for(auto &i:a)
    		cin>>i;
    	for(int i=1;i<=5;i++){
    		if(!a[i-1])cout<<i;
    	}
    }
}

Measured memory_bytes: 3640
#![allow(unused_imports)]
#![allow(non_snake_case)]

use std::collections::BinaryHeap;
use std::fmt::Debug;
use std::io::stdin;
use std::str::FromStr;

macro_rules! read {
  ($($t: ty),+) => ({
    let mut input = String::new();
    stdin().read_line(&mut input).expect("read error");
    let mut iter = input.split_whitespace();
    ($(iter.next().unwrap().parse::<$t>().expect("parse error"),)+)
  })
}

type A = i64;

fn main() {
  let (_, m) = read!(i32, i32);
  let mut heap = BinaryHeap::<A>::new();

  for i in read_vec() {
    heap.push(i);
  }

  for _ in 0..m {
    let n: A = heap.pop().unwrap();
    heap.push(n / 2);
  }

  println!("{}", heap.iter().sum::<A>());
}


// read from stdin as whitespace separated vector
#[allow(dead_code)]
fn read_vec<T: FromStr>() -> Vec<T> {
  let mut s = String::new();
  stdin().read_line(&mut s).ok();
  s.trim()
    .split_whitespace()
    .map(|e| e.parse().ok().unwrap())
    .collect()
}

Measured memory_bytes: 8444
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include <bitset>
#include <cmath>
#include <limits>
#include <iostream>
#include<set>
#include<tuple>
using namespace std;
#define INF 11000000000
#define MAX 100000
#define MOD 1000000007
typedef long long ll;
typedef pair<int,int> P;
typedef pair<pair<int,int>,int> p;
typedef pair< pair<int,int>, int> p; 
#define bit(n,k) ((n>>k)&1) /*nのk bit目*/
#define rad_to_deg(rad) (((rad)/2/M_PI)*360)


int main(){
    string s;
    cin>>s;
    if( (int)s.size()== 2 ) cout<<s<<endl;
    else cout<<s[2]<<s[1]<<s[0]<<endl;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long   // <-----!!!!!!!!!!!!!!!!!!!

#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n)-1;i>=0;i--)
#define rrep2(i,a,b) for (int i=(a)-1;i>=b;i--)
#define chmin(a,b) (a)=min((a),(b));
#define chmax(a,b) (a)=max((a),(b));
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define printV(v) cout<<(#v)<<":";for(auto(x):(v)){cout<<" "<<(x);}cout<<endl;
#define printVS(vs) cout<<(#vs)<<":"<<endl;for(auto(s):(vs)){cout<<(s)<< endl;}
#define printVV(vv) cout<<(#vv)<<":"<<endl;for(auto(v):(vv)){for(auto(x):(v)){cout<<" "<<(x);}cout<<endl;}
#define printP(p) cout<<(#p)<<(p).first<<" "<<(p).second<<endl;
#define printVP(vp) cout<<(#vp)<<":"<<endl;for(auto(p):(vp)){cout<<(p).first<<" "<<(p).second<<endl;}

inline void output(){ cout << endl; }
template<typename First, typename... Rest>
inline void output(const First& first, const Rest&... rest) {
    cout << first << " "; output(rest...);
}

using ll = long long;
using Pii = pair<int, int>;
using TUPLE = tuple<int, int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
const int inf = 1e9;
const int mod = 1e9 + 7;
using Graph = vector<vector<int>>;

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

    string s;
    cin >> s;
    int n = s.size();
    s += "#";
    int ans = 0;
    for(int i = 0; i < n;) {
        map<char, int> mp;
        for (auto c : "JOI") {
            while (s[i] == c) {
                mp[c]++;
                i++;
            }
        }
        if (mp['J'] >= mp['O'] && mp['O'] <= mp['I']) {
            chmax(ans, mp['O']);
        }
    }
    cout << ans << endl;

}

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

int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	int n; cin>>n;
	vector<int>h(n); for(auto&&i:h)cin>>i;
	vector<int>dp(n); dp.front()=0;
	dp.at(1)=abs(h.at(0)-h.at(1));
	for(int i=2;i<n;++i){
		dp.at(i)=min(dp.at(i-1)+abs(h.at(i-1)-h.at(i)),dp.at(i-2)+abs(h.at(i-2)-h.at(i)));
	}
	cout<<dp.back()<<"\n"s;
}


Measured memory_bytes: 3924
#include <stdio.h>

int main(void){

  int n,m,Lx,Ly;
	scanf("%d %d %d %d", &n, &m, &Lx, &Ly);
	int x[n];
	for (int i = 0; i < n; i++) {
		scanf("%d", &x[i]);
	}
	int y[m];
	for (int i = 0; i < m; i++) {
		scanf("%d", &y[i]);
	}
	int max = x[0];
	for (int i = 1; i < n; i++) {
		if (x[i] > max) {
			max = x[i];
		}
	}
	int min = y[0];
	for (int i = 1; i < m; i++) {
		if (y[i] < min) {
			min = y[i];
		}
	}
	int flag = 1;
	for (int z = Lx+1; z <= Ly; z++) {
		if (z > max && z <= min) {
			flag = 0;
			break;
		}
	}
	if (flag == 1) {
		printf("War\n");
	} else {
		printf("No War\n");
	}

  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <algorithm>
#include <sstream>
#include <map>
#include <set>

#define REP(i,k,n) for(int i=k;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1<<30
#define pb push_back
#define mp make_pair

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

int main() {
	int n, m;
	while(cin >> n >> m) {
		if(n == 0 && m == 0) break;

		vector<string> v(n), v2(m);
		rep(i, n) cin >> v[i];
		rep(i, m) cin >> v2[i];

		int r[105], c[105], s[105];
		memset(r, 0, sizeof(r));
		memset(c, 0, sizeof(c));
		memset(s, 0, sizeof(s));

		REP(i, 1, n) {
			r[i] = r[i-1];
			c[i] = c[i-1];
			s[i] = s[i-1];
			rep(j, v[i-1].size()) {
				char ch = v[i-1][j];
				if(ch == '(') r[i]++;
				if(ch == ')') r[i]--;
				if(ch == '{') c[i]++;
				if(ch == '}') c[i]--;
				if(ch == '[') s[i]++;
				if(ch == ']') s[i]--;
			}
		}

		int r2[105], c2[105], s2[105];
		memset(r2, 0, sizeof(r2));
		memset(c2, 0, sizeof(c2));
		memset(s2, 0, sizeof(s2));

		REP(i, 1, m) {
			r2[i] = r2[i-1];
			c2[i] = c2[i-1];
			s2[i] = s2[i-1];
			rep(j, v2[i-1].size()) {
				char ch = v2[i-1][j];
				if(ch == '(') r2[i]++;
				if(ch == ')') r2[i]--;
				if(ch == '{') c2[i]++;
				if(ch == '}') c2[i]--;
				if(ch == '[') s2[i]++;
				if(ch == ']') s2[i]--;
			}
		}

		int d[105];
		memset(d, 0, sizeof(d));

		rep(i, n) {
			rep(j, v[i].size()) {
				if(v[i][j] != '.') {
					d[i] = j;
					break;
				}
			}
		}

		vector<int> ans(m);
		rep(i, m) ans[i] = INF;

		REP(i, 1, 21) {
			REP(j, 1, 21) {
				REP(k, 1, 21) {
					bool flag = true;

					rep(l, n) {
						if(d[l] == i * r[l] + j * c[l] + k * s[l]) continue;
						flag = false;
					}

					if(flag) {
						rep(l, m) {
							int d = i * r2[l] + j * c2[l] + k * s2[l];

							if(ans[l] == INF) ans[l] = d;
							else if(ans[l] != d) ans[l] = -1;
						}
					}
				}
			}
		}

		rep(i, m) {
			cout << ans[i];
			if(i == m-1) cout << endl;
			else cout << " ";
		}
	}

	return 0;
}

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

int main(){
  string s,t;
  cin >> s >> t;
   int ans = 0;
   int l = s.length();
 for(int i=0;i<l;i++){
   if(s[i] != t[i]){
     ans++;
   }
 }
  cout << ans<< endl;
}

Measured memory_bytes: 3828
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <array>
#include <algorithm>
#include <utility>
#include <numeric>
#include <deque>
#include <stack>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cmath>
#include <limits>
#include <cassert>
#include <bitset>
#include <list>
#include <iomanip>
#include <cctype>
#include<chrono>
#include<random>

#define for0(i, N)    for (long long i = 0  ; i <  (N); ++i)
#define for1n(i, N)   for (long long i = 1  ; i <= (N); ++i)
#define for1(i, N)    for (long long i = 1  ; i <  (N); ++i)
#define forn(i, N)    for (long long i = 0  ; i <= (N); ++i)
#define forx(i, N, x) for (long long i = (x); i <  (N); ++i)
#define forl(i, N, x, a) for (long long i = (x), a = 0; a < (N);    \
                              i = (i + 1) % (N), ++a)
#define int long long

long double constexpr pi = 3.141592653589793;

template<class T>
constexpr T sigma1(T i, T n){
    return (n - i + 1) * (i + n) / 2;
}

template<class T>
constexpr T sigma2(T i, T n){
    return (i == 1 ? n * (n + 1) * (2 * n + 1) / 6 :
            sigma2(1, n) - sigma2(1, i - 1));
}

template<class T>
constexpr T sigma3(T i, T n){
    if (i == 1) {
        auto temp = sigma1(i, n);
        return temp * temp;
    }
    return sigma2(1, n) - sigma2(1, i - 1);
}

template<size_t i>
std::bitset<i> operator++(std::bitset<i> b, signed){
    static_assert(i <= 64, "Cannot cast 64bit int.");
    return b = (unsigned long long)b + 1;
}

template<size_t i>
std::bitset<i> operator++(std::bitset<i> b){
    static_assert(i <= 64, "Cannot cast 64bit int.");
    auto temp = b;
    b++;
    return temp;
}

template<size_t i>
std::bitset<i> operator--(std::bitset<i> b, signed){
    static_assert(i <= 64, "Cannot cast 64bit int.");
    return b = (unsigned long long)b - 1;
}

template<size_t i>
std::bitset<i> operator--(std::bitset<i> b){
    static_assert(i <= 64, "Cannot cast 64bit int.");
    auto temp = b;
    b--;
    return temp;
}

long long constexpr inf = std::numeric_limits<long long>::max();

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef priority_queue<ll> pq;
typedef priority_queue<ll,vector<ll>, greater<ll>> pql;
typedef stack<ll> stk;
typedef queue<ll> qu;
typedef pair<ll, ll> pll;
typedef map<ll, ll> mll;
typedef unordered_map<ll, ll> umll;
typedef set<ll> sll;
typedef unordered_set<ll> usll;
typedef vector<ll> vll;
typedef vector<ld> vld;
typedef vector<vector<ll>> vvll;


signed main(void){
    cin.tie(0); ios::sync_with_stdio(false);cout<<fixed<<setprecision(10);
    ll n, k;
    cin >> n >> k;

    vll a(n, 0);

    for0(i, n){
        cin >> a[i];
    }

    sort(a.begin(), a.end());
    cout << accumulate(a.begin(), a.begin() + k, 0);

    return 0;
}


Measured memory_bytes: 3664
#include<iostream>
using namespace std;
int main(){
  int t,h,m,s;
  cin>>t;
  s=t%60;
  //cout<<"s:"<<s<<endl;
  t-=s;
  t/=60;
  m=t%60;
  //cout<<"m:"<<m<<endl;
  t-=m;
  t/=60;
  h=t%60;
  //cout<<"h:"<<h<<endl;
  cout<<h<<":"<<m<<":"<<s<<endl;
  return 0;
}

Measured memory_bytes: 1168
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
const int mod = 1e9+7;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;
vector<long long> calc_divisor(long long n) {//約数列挙
    vector<long long> res;
    for (long long i = 1LL; i*i <= n; ++i) {
        if (n % i == 0) {
            res.push_back(i);
            long long j = n / i;
            if (j != i) res.push_back(j);
        }
    }
    sort(res.begin(), res.end());
    return res;
}
int main(){
    cout << fixed << setprecision(10);
    int n;
    cin >> n;
    vector<int> v(n);
    rep(i,n) cin >> v[i];
    vector<int> div(1000100,0);
    rep(i,n){
        div[v[i]]++;
    }
    int ans = 0;
    rep(i,n){
        bool ok = 1;
        //cout << v[i] << "tern" << endl;
        for(auto u : calc_divisor(v[i])){
            if(div[u]>0 && u != v[i]){
                //cout << u << endl;
                ok = 0;
                break;
            }
        }
        if(div[v[i]] > 1) ok = 0;
        if(ok) ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 7924
#include<iostream>
#include<cmath>
#include<cstdio>
#include<vector>
#include<algorithm>
  
using namespace std;
  
double EPS = 1e-10;
  
double add(double a,double b){
  if(abs(a+b)<EPS*(abs(a)+abs(b)))return 0;
  return a+b;
}
  
struct point{
  double x,y;
  point() {}
  point(double x,double y):x(x),y(y){
  }
  point operator + (point p){
    return point(add(x,p.x),add(y,p.y));
  }
  point operator - (point p){
    return point(add(x,-p.x),add(y,-p.y));
  }
  point operator * (double d){
    return point(x*d,y*d);
  }
  point operator / (double d){
    return point(x/d,y/d);
  }
};
  
double dist(point a,point b){
    return sqrt(pow(a.x-b.x,2)+pow(a.y-b.y,2));
}

int main(void){
    int n,x,y,v;
    vector<point>P;
    vector<double>V;
     
    while(cin >> n,n){
        P.clear();
        V.clear();
         
        for(int i=0;i<n;i++){
            cin >> x >> y >> v;
            P.push_back(point(x,y));
            V.push_back(v);
        }
        
        double r=0.99;
        point now(0,0);
         
        for(double d=10;d>EPS;d*=r){
            int mx=0;
            double mxd=0;
             
            for(int j=0;j<P.size();j++)
                if(dist(now,P[j])/V[j]>mxd)
		  mx=j,mxd=dist(now,P[j])/V[j];
             
            now=now+((P[mx]-now)/dist(P[mx],now)*d);
        }
         
        double ans=0;
        for(int i=0;i<P.size();i++){
	  ans=max(ans,dist(now,P[i])/V[i]);
        }
        printf("%.8f\n",ans);
    }
    return 0;
}

Measured memory_bytes: 1248
N = int(input())
T = [0]*5
for i in range(N):
    S = input()
    if S[0]=="M":
        T[0]+=1
    elif S[0]=="A":
        T[1]+=1
    elif S[0]=="R":
        T[2]+=1
    elif S[0]=="C":
        T[3]+=1
    elif S[0]=="H":
        T[4]+=1
from itertools import combinations
Ls = list(combinations([0,1,2,3,4],3))
out = 0
for L in Ls:
    out += T[L[0]]*T[L[1]]*T[L[2]]
print(out)

Measured memory_bytes: 70232
import bisect,collections,copy,itertools,math,string
def I(): return int(input())
def S(): return input()
def LI(): return list(map(int,input().split()))
def SI(): return list(input().split())
##################################################
def main(N,C):
    SHCD = 'SHCD'
    _52card = [[0]*13 for _ in range(4)]
    for x in C:
        x1,x2 = x[0],int(x[1])
        _52card[SHCD.index(x1)][x2-1] = 1
    for i,x in enumerate(_52card):
        for j in range(13):
            if x[j]==0:
                print(SHCD[i],j+1)
    
N = I()
C = [SI() for _ in range(N)]
main(N,C)


Measured memory_bytes: 6800
#include<bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define yesno(flg) if(flg){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define MAX_N 1002
#define i197 1000000007
#define Vi vector<int>
#define Vl vector<long long>
#define pb(a) push_back(a)

using namespace std;

typedef long long ll;
typedef pair<ll,ll> P1;
typedef pair<int,int> Pi;
typedef pair<double,Pi> Pdi;
typedef pair<ll,int>Pli;
typedef pair<P1,ll> P2;
const ll INF=10000000000000000001;
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
struct Road{double cost;int a,b;};
struct edge{int to,cost;};
struct pos{
	int x,y;
};

int main() {

	while(1){
		int h,w;
		char c[21][21]={};
		int dp[21][21]={},ans=0;
		cin>>h>>w;
		if(h==0&&w==0)return 0;
		queue<pos> que;
		int si=0,sj=0;
		rep(i,w){
			rep(j,h){
				cin>>c[j][i];
				if(c[j][i]=='@'){
					dp[j][i]=1;
					sj=j;
					si=i;
				}
			}
		}
		pos pos1={sj,si};
		que.push(pos1);
		while(!que.empty()){
			pos pos2=que.front();que.pop();
			ans++;
			if(c[pos2.x+1][pos2.y]=='.'&&dp[pos2.x+1][pos2.y]==0){
				pos pos3={pos2.x+1,pos2.y};
				que.push(pos3);
				dp[pos2.x+1][pos2.y]=1;
			}
			if(c[pos2.x-1][pos2.y]=='.'&&dp[pos2.x-1][pos2.y]==0){
				pos pos4={pos2.x-1,pos2.y};
				que.push(pos4);
				dp[pos2.x-1][pos2.y]=1;
			}
			if(c[pos2.x][pos2.y+1]=='.'&&dp[pos2.x][pos2.y+1]==0){
				pos pos5={pos2.x,pos2.y+1};
				que.push(pos5);
				dp[pos2.x][pos2.y+1]=1;
			}
			if(c[pos2.x][pos2.y-1]=='.'&&dp[pos2.x][pos2.y-1]==0){
				pos pos6={pos2.x,pos2.y-1};
				que.push(pos6);
				dp[pos2.x][pos2.y-1]=1;
			}
		}
		cout<<ans<<endl;
	}

	return 0;
}



Measured memory_bytes: 3068
#include<bits/stdc++.h>
using namespace std;
long long n,l,a[100001];
int main()
{
    cin>>n>>l;
    
        for(int i=1;i<=n;i++)
            cin>>a[i];
        int flag=0;
        for(int i=1;i<=n-1;i++)
        {
            if(a[i]+a[i+1]>=l)
            {
                flag=i;
                break;
            }
        }
        if(flag!=0)
            cout<<"Possible"<<endl;
        else{
        	 cout<<"Impossible";
        	 return 0;
		}
        for(int i=1;i<flag;++i)
        {
        	printf("%d\n",i);
		}
		for(int j=n-1;j>=flag+1;--j){
			printf("%d\n",j);
		}
		cout<<flag;
    
}

Measured memory_bytes: 1536
#include<stdio.h>
int main()
{
  int n,m,i;
  char s[1000];

scanf("%d",&n);
scanf("%s",s);
scanf("%d",&m);
for(i=0;i<n;i++)
{
  if(s[i]!=s[m-1])
	  s[i]='*';
}
for(i=0;i<n;i++)
{
printf("%c",s[i]);
}
printf("\n");
return 0;
}

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

using namespace std;

int main() {
  int M1, M2, D1, D2;
  cin >> M1 >> D1;
  cin >> M2 >> D2;
  if (D2 == 1) cout << 1 << endl;
  else cout << 0 << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
using namespace std;

#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 1000000007;
const ll MAX = 1000001;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

ll gcd(ll a, ll b) {
	if (b == 0) { return a; }
	if (a < b) { return gcd(b, a); }
	return gcd(b, a%b);
}

ll lcm(ll a, ll b) {
	return a * b / gcd(a, b);
}



///////////////////////////




int main() {

	ll A, B, C;
	cin >> A >> B >> C;

	if (A + B >= C) { cout << "Yes"; }
	else { cout << "No"; }


	system("PAUSE");

}


Measured memory_bytes: 504
#include <stdio.h>
int main(void)
{
	int a,b,c,x,s=0;
	scanf("%d%d%d%d",&a,&b,&c,&x);
	for(int i=0;i<=a;i++)
	{
		for(int j=0;j<=b;j++)
		{
			for(int k=0;k<=c;k++)
			{
				if(500*i+100*j+50*k==x)
				   s++;
			}
		}
	}
	printf("%d\n",s);
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
#include <tuple>
#define mkp make_pair
#define mkt make_tuple
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
const ll MOD=1e9+7;
template<class T> void chmin(T &a,const T &b){if(a>b) a=b;}
template<class T> void chmax(T &a,const T &b){if(a<b) a=b;}

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

  string T;
  cin>>T;
  int N=T.size();

  ll one=0;
  rep(i,N) if(T[i]=='1') one++;

  ll ans=0;
  if(one%2) ans=(one/2)*((one/2)+1)+(one+1)/2;
  else ans=(one/2)*((one/2)+1);

  ll rest=N-one;
  vector<int> A;
  A.push_back(0);
  ll tmp=0;
  for(int i=0;i<N;i++){
    if(tmp==0){
      if(T[i]=='1') tmp++;
      else A[A.size()-1]++;
    }else{
      if(T[i]=='1') tmp++;
      else{
        if(tmp%2) A.push_back(1);
        else A[A.size()-1]++;
        ans+=(tmp/2)*rest;
        tmp=0;
      }
    }
  }
  if(tmp>0){
    if(tmp%2) A.push_back(0);
    ans+=(tmp/2)*rest;
  }

  int K=A.size();
  ll res=0;
  vector<ll> sum(K+1,0);
  for(int i=0;i<K;i++) sum[i+1]=sum[i]+A[i];
  for(int i=0;i+1<K;i++){
    if((sum[i+1]+i+1)%2) res+=(sum[i+1]+1)/2;
    else res+=(sum[i+1])/2;
  }
  for(int i=0;i+1<K;i++){
    res+=sum[K]-sum[i+1];
  }
  ans+=res;
  cout<<ans<<endl;


  return 0;
}


Measured memory_bytes: 4664