akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#ifdef __LOCAL
    #define DBG(X) cout << #X << " = " << (X) << endl;
    #define SAY(X) cout << (X) << endl;
    #include <filesystem>
    namespace fs = std::filesystem;
#else
    #define DBG(X)
    #define SAY(X)
#endif

using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

int dx[]={1, 0, -1, 0, 1,-1, 1,-1};
int dy[]={0, 1, 0, -1, 1, 1,-1,-1};
const int INT_INF = (int)(2e9);
const ll  LL_INF = (ll)(2e18);
static mt19937 _g(time(nullptr));
 
inline ll randint(ll a, ll b) { ll w = (_g() << 31LL) ^ _g(); return a + w % (b - a + 1); }
inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const map<T, S> p) { for (auto el : p) cout << "[" << el.first << ";" << el.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }

ll x;
void input(){
    fast_io();
    #ifdef __LOCAL
        fs::path __p = __FILE__;
        fs::path __input, __output;
        __input = __output = __p.parent_path();
        __input += string("/input/") + string(__p.stem()) + string(".txt");
        __output += string("/output/") + string(__p.stem()) + string(".txt");
        freopen(__input.c_str(), "r", stdin);
        freopen(__output.c_str(), "w", stdout);
    #endif
    cin >> x;
}

int solve(){
    ll m=100;
    for (int i = 1; i < 10000; i++)
    {
        m = m*1.01;
        if(m>=x) {cout << i << endl; return 0;}
    }
     
    return 0;
}   

int main()
{
    input();
    solve();
    return 0;
}


Measured memory_bytes: 3656
#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)
#define ALL(vec) vec.begin(), vec.end()
#define rALL(vec) vec.rbegin(), vec.rend()
using namespace std;
using ll = long long;

int main() {
    int N;
    cin >> N;
    vector<int> d(N);
    rep(i, N) {
        cin >> d[i];
    }
    int ans = 0;
    FOR(i, 0, N - 1) FOR(j, i + 1, N) {
        ans += d[i]*d[j];
    }
    cout << ans << endl;
}

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

using ll = long long;

using namespace std;

ll count5(ll x) {
    ll ans = 0, d = 5;
    while (d <= x) {
        ans += x / d;
        d *= 5;
    }
    return ans;
}

int main() {
    ll n;
    cin >> n;
    ll k = 0;;
    if (n % 2) {
        cout << 0 << '\n';
        return 0;
    }
    else n /= 2;
    cout << count5(n) - count5(k) << '\n';
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define rep(i,n) for (int i = (0); i < (n); ++i)
#define rng(x) (x).begin(),(x).end()
#define rrng(x) (x).rbegin(),(x).rend()
#define debug(x) cout << #x << " = " << (x) << endl;
#define SUM(x) accumulate(rng(x),0)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define uni(x) x.erase(unique(rng(x)),x.end())
#define SP << " " <<
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
const int mod = 1000000007;
const double EPS = 1e-9;
const int INF = 1<<30;
const ll INFLL = 1LL<<60;
//cout << fixed << setprecision(10);

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

int n2(int a) {
  int ret = 0;
  while (a%2 == 0) {
    a /= 2;
    ret++;
  }
  return ret;
}

int main () {
  int n;
  cin >> n;
  vi a(n);
  rep(i,n) cin >> a[i];
  
  int ans = 0;
  rep(i,n) {
    ans += n2(a[i]);
  }
  cout << ans << endl;
  return 0;
}

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


#define f(i,a,b) for(int i=(int)(a);i<=(int)(b);i++)
#define char_f(i,a) for(int i=(int)(a);(char)s[i]!='\0';i++)
#define rf(i,a,b) for(int i=(int)(a);i>=(int)(b);i--)
#define llf(i,a,b) for(long long int i=(long long int)(a);i<=(long long int)(b);i++)
#define llrf(i,a,b) for(long long int i=(long long int)(a);i>=(long long int)(b);i--)



#define ll long long
#define fi first
#define se second
#define pb push_back
#define pob pop_back
#define mem(ara,x) memset((ara),x,sizeof(ara))
#define memn(ara) memset((ara),-1,sizeof(ara))
#define bb begin()
#define ee end()
#define em emplace
#define eb emplace_back





#define si set<int>
#define sd set<double>
#define sll set<long long int>
#define ss set<string>
#define sc set<char>

#define pii pair<int,int>
#define pli pair<long long int,int>
#define pil pair<int,long long int>
#define pll pair<long long int,long long int>
#define pci pair<char,int>
#define pic pair<int,char>
#define pcl pair<char,long long int>
#define plc pair<long long int,char>

#define pss pair<string,string>
#define pcc pair<char,char>

#define pis pair<int,string>
#define psi pair<string,int>
#define pls pair<long long int,string>
#define psl pair<string,long long int>
#define pdd pair<double,double>
#define pcs pair<char,string>
#define psc pair<string,char>



#define vi  vector<int>
#define vll vector<long long int>
#define vd vector<double>
#define vs vector<string>
#define vc vector<char>
#define vii vector<pii>



#define mod 1000000007
#define mx (1<<30)-1
#define llmx (1ll<<62)
#define n_size 100005
#define g_size 10000005
double PI=acos(-1);
#define eps 1e-9



///unsigned int uMAX=4294967295;
///unsigned ll int ullMAX=18446744073709551615;





ll int arr[g_size],arr1[101][100001];



int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);

	ll int n,m,T,res;

	int maxi=-mx,mini=mx,count=0;

	int i,j,k;

	bool flag;

	string s1,s2;

	char s[100000];

	ll int val[n_size],wt[n_size];

	cin>>n>>m;

	for(i=0;i<n;i++){
        cin>>wt[i]>>val[i];
	}

	for(i=1;i<=n;i++){
        for(int w=1;w<=m;w++){
            if(w>=wt[i-1]){
                arr1[i][w]=max(val[i-1]+arr1[i-1][w-wt[i-1]],arr1[i-1][w]);
            }
            else{
                arr1[i][w]=arr1[i-1][w];
            }
        }
	}

	cout<<arr1[n][m]<<endl;

}


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

int main(){
  int n,i;
  cin>>n;
  int a[n],dp[n];
  for(i=0;i<n;i++){
    cin>>a[i];
  }
  dp[0]=0;
  dp[1]=abs(a[0]-a[1]);
  for(i=2;i<n;i++){
    dp[i]=min(dp[i-2]+abs(a[i]-a[i-2]),dp[i-1]+abs(a[i-1]-a[i]));
  }
  cout<<dp[n-1];
}

Measured memory_bytes: 1024
#include <iostream>

using namespace std;

const int MAX_HW = 50;

int main(int argc, char const *argv[]) {
  int h, w;
  char s[MAX_HW][MAX_HW];
  cin >> h >> w;
  for (size_t i = 0; i < h; i++) {
    for (size_t j = 0; j < w; j++) cin >> s[i][j];
  }
  int ans[MAX_HW][MAX_HW] = {0};
  for (size_t i = 0; i < h; i++) {
    for (size_t j = 0; j < w; j++) {
      if (s[i][j]=='.') {
        if (i==0) {
          if (j==0) {
            if (s[i][j+1] == '#') ans[i][j]++;
            if (s[i+1][j] == '#') ans[i][j]++;
            if (s[i+1][j+1] == '#') ans[i][j]++;
          }
          else if (j==w-1) {
            if (s[i][j-1] == '#') ans[i][j]++;
            if (s[i+1][j] == '#') ans[i][j]++;
            if (s[i+1][j-1] == '#') ans[i][j]++;
          }
          else {
            if (s[i][j+1] == '#') ans[i][j]++;
            if (s[i+1][j] == '#') ans[i][j]++;
            if (s[i+1][j+1] == '#') ans[i][j]++;
            if (s[i][j-1] == '#') ans[i][j]++;
            if (s[i+1][j-1] == '#') ans[i][j]++;
          }
        }
        else if (i==h-1) {
          if (j==0) {
            if (s[i][j+1] == '#') ans[i][j]++;
            if (s[i-1][j] == '#') ans[i][j]++;
            if (s[i-1][j+1] == '#') ans[i][j]++;
          }
          else if (j==w-1) {
            if (s[i][j-1] == '#') ans[i][j]++;
            if (s[i-1][j] == '#') ans[i][j]++;
            if (s[i-1][j-1] == '#') ans[i][j]++;
          }
          else {
            if (s[i][j+1] == '#') ans[i][j]++;
            if (s[i][j-1] == '#') ans[i][j]++;
            if (s[i-1][j] == '#') ans[i][j]++;
            if (s[i-1][j-1] == '#') ans[i][j]++;
            if (s[i-1][j+1] == '#') ans[i][j]++;
          }
        }
        else{
          if (j==0) {
            if (s[i][j+1] == '#') ans[i][j]++;
            if (s[i+1][j] == '#') ans[i][j]++;
            if (s[i+1][j+1] == '#') ans[i][j]++;
            if (s[i-1][j] == '#') ans[i][j]++;
            if (s[i-1][j+1] == '#') ans[i][j]++;
          }
          else if (j==w-1) {
            if (s[i][j-1] == '#') ans[i][j]++;
            if (s[i+1][j] == '#') ans[i][j]++;
            if (s[i+1][j-1] == '#') ans[i][j]++;
            if (s[i-1][j] == '#') ans[i][j]++;
            if (s[i-1][j-1] == '#') ans[i][j]++;
          }
          else {
            if (s[i][j-1] == '#') ans[i][j]++;
            if (s[i][j+1] == '#') ans[i][j]++;
            if (s[i+1][j] == '#') ans[i][j]++;
            if (s[i+1][j+1] == '#') ans[i][j]++;
            if (s[i+1][j-1] == '#') ans[i][j]++;
            if (s[i-1][j] == '#') ans[i][j]++;
            if (s[i-1][j-1] == '#') ans[i][j]++;
            if (s[i-1][j+1] == '#') ans[i][j]++;
          }
        }
      }
      else ans[i][j]--;
    }
  }

  for (size_t i = 0; i < h; i++) {
    for (size_t j = 0; j < w; j++) {
      if (ans[i][j]>=0) cout << ans[i][j];
      else cout << '#';
    }
    cout << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define forr(i, a, b) for(int i = (a); i < (b); i++)
#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = 1; i <= (n); i++)
#define ALL(a) (a.begin()),(a.end())
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll, ll> LP;
const ll LINF = 1LL<<60;
const int INF = 1001001001;
const int MOD = 1000000007;

/* --------------------------------------------------- */

int main() {
    int n, m;
    cin >> n >> m;
    vector<int> x(m), y(m);
    rep(i, m) {
        cin >> x[i] >> y[i];
        x[i]--; y[i]--;
    }
    vector<int> tot(n + 1, 1);
    vector<bool> check(n + 1, false);
    check[0] = true;
    rep(i, m) {
        tot[x[i]]--;
        tot[y[i]]++;
        if(check[x[i]]) {
            check[y[i]] = true;
            if(tot[x[i]] == 0) check[x[i]] = false;
        }
    }
    int ans = 0;
    for(auto x : check) if(x) ans++;

    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 1536
n = int(raw_input())
l = map(int, raw_input().split())
m = []
i = n-1
while i >= 0:
    m.append(l[i])
    i -= 2
i += 1
while i < 0:
    i += 2
while i < n:
    m.append(l[i])
    i += 2
print ' '.join(map(str, m))


Measured memory_bytes: 23512
def calcDays(A, B, C):
    import math
    weeks = C // (A * 7 + B)
    mod = C % (A * 7 + B)
    if(mod >= A * 7):
        days = 7
    else:
        days = math.ceil(mod / A)
            
    print(days + weeks * 7)

def main():
    A, B, C = map(int, input().split())
    calcDays(A, B, C)

main()


Measured memory_bytes: 5668
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include<limits.h>
#include<iomanip>
#define rep(i, n) for(int i = 0; i < n; i++)
#define rrep(i, n) for(int i = n-1; i >= 0; i--)
#define REP(i, m, n) for(int i = m; i < n; i++)
#define ALL(v) v.begin(),v.end()
#define RALL(v) v.rbegin(),v.rend()
#define lamsort(v,p) sort(v.begin(),v.end(),[](p a, p b){return a.num < b.num;});
#define check(v) rep(i,v.size()) cout << v[i] << " ";\
cout << endl
#define INF 1e8
typedef long long ll;
using namespace std;
//オーバーフローに気をつけろよおおおおおお
//確認忘れるなよおおおおおお

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n; cin >> n;
    string s; cin >> s;
    int ans = 0;
    REP(i,1,s.size()) {
        if(s[i]!=s[i-1]) ans++;
    }
    cout << ans+1 << endl;

    return 0;
}

Measured memory_bytes: 512
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int H = sc.nextInt();
		int W = sc.nextInt();
		System.out.println((N-H+1)*(N-W+1));
	}
}


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



int main(){
  int N;
  cin >> N;
  if(N<600) cout << 8 << endl;
  else if(N<800)cout << 7 << endl;
  else if(N<1000)cout << 6 << endl;
  else if(N<1200)cout << 5 << endl;
  else if(N<1400)cout << 4 << endl;
  else if(N<1600)cout << 3 << endl;
  else if(N<1800)cout << 2 << endl;
  else if(N<2000)cout << 1 << endl;
}
    





Measured memory_bytes: 3612
#include<bits/stdc++.h>
const int MN=304;
int N,A[4];
double dp[MN][MN][MN];
double solve(int s1, int s2, int s3) {
    if(!s1&&!s2&&!s3) return 0;
    if(dp[s1][s2][s3]>=0.0) return dp[s1][s2][s3];
    double ret = 1.0;
    if(s1) ret += solve(s1-1, s2, s3) * s1 / N;
    if(s2) ret += solve(s1 + 1, s2 - 1, s3) * s2 / N;
    if(s3) ret += solve(s1, s2 + 1, s3 - 1) * s3 / N;
    ret *= 1.0 * N / (s1 + s2 + s3);
    return dp[s1][s2][s3] = ret;
}
int main() {
    scanf("%d",&N);
    for(int i=0,a;i<N;++i) {
        scanf("%d",&a);
        A[a]++;
    }
    for(int i=0;i<MN;++i)
        for(int j=0;j<MN;++j)
            for(int k=0;k<MN;++k)
                dp[i][j][k]=-1.0;
    printf("%.9lf\n",solve(A[1],A[2],A[3]));
}


Measured memory_bytes: 219776
#include <bits/stdc++.h>
#include <string>
using namespace std;
#define ll long long int
#define ld long double
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define mod 1000000007
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define fr(i,a,n) for(i=a;i<n;i++)
#define frn(i,a,n) for(i=a;i<=n;i++)
#define vll vector<ll>
#define pll pair<ll,ll>
#define vp vector<pll>
#define ub upper_bound
#define lb lower_bound
//#define map map<ll,ll>
#define mem(x,y) memset(x,y,sizeof(x))
#define all(v) v.begin(),v.end()
#define bs binary_search
#define qll queue<ll>
#define sll set<ll>
#define ma 500000
ll power(ll x,ll n)
{
    if(n==0)
        return 1;
    else if(n%2 == 0)        //n is even
        return power(x*x,n/2);
    else                             //n is odd
        return x*power(x*x,(n-1)/2);
}
int highestPowerof2(int n)
{
   int p = (int)log2(n);
   return (int)pow(2, p);  
}
ll powermod(ll x, ll y, ll p)  
{  
    ll res = 1;
    x = x % p;
    if (x == 0) return 0;  
  
    while (y > 0)  
    {  
        if (y & 1)  
            res = (res*x) % p;  
        y = y>>1; 
        x = (x*x) % p;  
    }  
    return res;  
}
 
int main()
{
    ll n,i,sum=0,f=0;
    cin>>n;
    ll a[n];
    for(i=0;i<n;i++)
    cin>>a[i];
    
    sort(a,a+n,greater<int>());
    i=1;
   ll count=n-2;
    while(count--)
    {
        if(f==0){
        sum=sum+a[i];
        f=1;
        }
        else
        {
            sum=sum+a[i];
            i++;
            f=0;
        }
        
    }
    sum=sum+a[0];
    cout<<sum<<endl;
    
    
    
    
    
    
    
    
return 0;
}


Measured memory_bytes: 5236
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rrep(i,n) for(int (i)=((n)-1);(i)>=0;(i)--)
#define itn int
#define all(x) (x).begin(),(x).end()
#define F first
#define S second
const long long INF = 1LL << 60;
const int MOD = 1000000007;
signed main(void){
    int a,b; cin>>a>>b;
    if(b==1) {cout<<0<<endl; return 0;}
    int now = 1;
    int ans = 0;
    rep(i,30){
        now--;
        now+=a;
        if(now>=b) {cout<<i+1<<endl; return 0;}
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <vector>

using namespace std;

int main() {
    int a,b;
    cin >> a >> b;
    cout << (a-1)*(b-1) << endl;


    return 0;
}

Measured memory_bytes: 256
/*
	author - sekai_no_owari
	date   - 22.01.2020
*/
#include<bits/stdc++.h>
#define ll long long
#define mod 1000000007
#define amaterasu ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;

int
main ()
{
  amaterasu 
  ll a, b;
  cin >> a >> b;
  a==b?cout<<"Yes":cout<<"No";
}


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

#define REP(i,num) for(int i=0;i<(num);++i)
#define LOOP(i) while(i--)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto pitr=c.begin();pitr!=c.end();++pitr){cout<<*pitr;if(next(pitr,1)!=c.end())cout<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);

	string S=in<string>();
	int N=S.size();

	int t=0,s=0;
	REP(i,N){
		if(S[i]=='T'){
			if(s>0) s--;
			else t++;
		}
		if(S[i]=='S') s++;
	}
	out(t+s);
	return 0;
}


Measured memory_bytes: 720
#include "bits/stdc++.h"

using namespace std;

static const int INF = 1e9 + 7;
static int dp[16][1 << 18] = {};
static int cost[16][17];
static int n;

static int dfs(int now, bitset<17> bs)
{
  if (now >= n) return bs.count() == n ? 0 : INF;
  bitset<17> bits = bs;
  if (~dp[now][bs.to_ulong()]) return dp[now][bs.to_ulong()];
  if (bs[bs.size() - 1 - now]) return dfs(now + 1, bs);
  int res = dfs(now + 1, bs);
  if (bs[bs.size() - 1 - now]) return dp[now][bs.to_ulong()] = res;
  bs.set(bs.size() - 1 - now);
  if (bits.none()) return dp[now][0] = min(res, dfs(0, bs) + cost[now][0]);
  for (int i = 0; i < n; i++) {
    if (bits[bits.size() - 1 - i]) {
      res = min(res, dfs(0, bs) + cost[now][i + 1]);
    }
  }
  res = min(res, dfs(0, bs) + cost[now][0]);
  return dp[now][bits.to_ulong()] = res;
}

static void solve()
{
  while (cin >> n && n) {
    memset(dp, -1, sizeof dp);
    for (int i = 0; i < n; i++) {
      for (int j = 0; j <= n; j++) {
        cin >> cost[i][j];
      }
    }
    cout << dfs(0, 0) << "\n";
  }
}

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

Measured memory_bytes: 19484
# include <bits/stdc++.h>
#define flash ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define endl '\n'
#define ll long long int
#include <tr1/unordered_map>
#define ld long double
#define pb push_back
#define mp make_pair
#define MOD 1000000007
#define f(i,a,b)  for(long long i=a;i<b;i++)
#define all(c) (c).begin(),(c).end()
#include <map>

using namespace std;


int main()
{



     flash;
     ///////////////////////////////////////////////////////////////////////////////////////



ll a,b,c,d;
cin>>a>>b>>c>>d;
ll val1 = a*c;
ll val2 = a*d;
ll val3 = b*c;
ll val4 = b*d;
cout<<max(max(max(val1,val2),val3),val4)<<endl;



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

     return 0;

}


Measured memory_bytes: 3632
def get(text,n):
    ans = [""]*n
    i = 0
    for x in text:
        if x==" ":
            i = i + 1
        ans[i] = ans[i]+x
    return ans

nk = input()
textp = input()

N = int(get(nk,2)[0])
K = int(get(nk,2)[1])
ps = get(textp,N)
for i in range(N):
    ps[i] = int(ps[i])

exp = [0] * N
for i in range(N):
    exp[i] = (ps[i]+1)/2

s = 0
for j in range(K):
    s = s + exp[j]
m = s
for i in range(N-K):
    s = s - exp[i] + exp[i+K]
    if m < s:
        m = s

print(m)

Measured memory_bytes: 18444
A, B, C = input().split()
A = int(A)
B = int(B)
C = int(C)

flag = 'No'
if A == B or B == C or C == A:
  if A == B and B == C and C == A:
    flag = 'No'
  else:
    flag = 'Yes'
print(flag)


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

#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define RFOR(i, a, b) for(int i=(a); i>=(b); i--)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) RFOR(i, n, 0)
#define dump(x)  cout << #x << " = " << (x) << endl;

typedef long long ll;
typedef pair<int, int> ii;
const ll INF = 1e18;
const int inf = 1e8;


void solve()
{
  ll N;
  scanf("%lld",&N);
  if (N>=1000) cout << "ABD" << endl;
  else cout << "ABC" << endl;
}

int main()
{
  solve();
  return 0;
}


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

vector<long> inputVector(long n)
{
    vector<long> vec(n);
    rep(i, n)
    {
        scanf("%d", &vec.at(i));
    }
    return vec;
}

void printVector(vector<long> l)
{
    for (long i = 0; i < l.size(); i++)
    {
        if (i != 0)
        {
            cout << " ";
        }
        cout << l.at(i);
    }
    cout << endl;
}

int main()
{
    long n, m, x;
    long init = 10000000;
    long ans = init;
    // scanf("%d", &x);
    cin >> n >> m >> x;
    vector<vector<long>> a;
    rep(i, n)
    {
        a.push_back(inputVector(m + 1));
    }
    rep(i, pow(2, n))
    {
        long sgn = i;
        vector<long> score(m, 0);
        long price = 0;
        bool check = true;
        rep(j, n)
        {
            if (sgn % 2 == 1)
            {
                price += a.at(j).at(0);
                rep(k, m)
                {
                    score.at(k) += a.at(j).at(k + 1);
                }
            }
            sgn /= 2;
        }
        rep(k, m)
        {
            if (score.at(k) < x)
            {
                check = false;
            }
        }
        if (check)
        {
            ans = min(ans, price);
        }
    }
    // cout << k << endl;
    // printf("%d\n", x * x * x);
    if (ans == init)
    {
        ans = -1;
    }
    cout
        << ans << endl;
}

Measured memory_bytes: 4176
n=int(input())
a=list(map(int,input().split()))

sm_al=abs(a[0])+abs(a[n-1])
for i in range(n-1):
    sm_al+=abs(a[i+1]-a[i])

#a1に行かないとき
sm1=sm_al-abs(a[1]-a[0])-abs(a[0])+abs(a[1])
print(sm1)
#a2-an-1に行かないとき
for i in range(1,n-1):
    sm=sm_al-abs(a[i+1]-a[i])-abs(a[i]-a[i-1])+abs(a[i+1]-a[i-1])
    print(sm)
#anに行かない
smn=sm_al-abs(a[n-1]-a[n-2])-abs(a[n-1])+abs(a[n-2])
print(smn)

Measured memory_bytes: 20540
#include <bits/stdc++.h>
using namespace std;
#define int long long
int dp[2000010];
const int mod = 1000000007;
signed main(){
    int n,h,d;
    int x=1,y = 0;
    cin>>n>>h>>d;
    for(int i=1 ; i<=n ; i++){
        (x*=i)%=mod;
        (y+=x)%=mod;
    }
dp[0]=x;
for(int i=0 ; i<=h ; i++){
    if(!i){
        (dp[i+1]+=dp[i])%=mod;
        (dp[i+d+1]+=mod-dp[i])%=mod;
    }
    if(i) {
        (dp[i+1]+=dp[i])%=mod;
        (dp[i+1]+=y*dp[i]%mod)%=mod;
        (dp[i+d+1]+=(mod-y*dp[i]%mod))%=mod;
    }
}
cout<<dp[h];
}


Measured memory_bytes: 15872
#include <stdio.h>
#include <string.h>
#include <iostream>
using namespace std;

int main() {
	int a, b;
	char s[5];
	cin >> a >> s >> b;
	if(strcmp(s,"+")==0){cout << (a + b)<< endl;}
	else{cout << (a - b)<< endl;}
	return 0;
}


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


int main()
{
	int a, b;
	cin >> a >> b;
	if (a<6)
	{
		cout << "0" << endl;
	}
	else
	{
		if (a<13)
		{
			cout << (b / 2) << endl;
		}
		else
		{
			cout << b << endl;
		}
	}
    return 0;
}


Measured memory_bytes: 256
#include<iostream>


#define all(x) (x).begin(),(x).end()
#define puts(x) cout<< x << endl;
#define rep(i,m,n) for(int i=m;i<n;i++)
#define fore(i,a) for(auto i:a)
#define ll long long
using namespace std;
int n,r;

int main(){
    cin>>n>>r;
    if(n>=10){
        puts(r);
    }else{
        puts(r+100*(10-n));
    }
}

Measured memory_bytes: 256
///AJoy Sarker ,CSE JAHANGIRNAGAR UNIVERSITY 48 Batch
#include<bits/stdc++.h>
using namespace std;
#define SORT(c) sort((c).begin(),(c).end());
#define inf INT_MAX/3
#define pb push_back
#define MP make_pair
#define pii pair<int,int>
#define pcc pair<char,char>
#define pic pair<int,char>
#define pci pair<char,int>
#define VS vector<string>
#define VI vector<int>
#define MIN(a,b) (a>b?b:a)
#define MAX(a,b) (a>b?a:b)
#define pi 3.141592653589793
#define in scanf
#define out printf
#define ll long long
#define ull unsigned long long
#define w(x) int x;cin>>x;while(x--)
#define fast ios_base::sync_with_stdio(0)
#define FOR(i,a,b) for( int i=(a),_b=(b);i<=_b;i++)
#define DOW(i,b,a) for( int i=(b),_a=(a);i>=_a;i--)
#define sz size()
typedef unsigned long long UL;
template<typename T>inline T  S(T a)
{
    return a*a;
}
template<class T>inline string tostring(T a)
{
    ostringstream os("");
    os << a;
    return os.str();
}
template<typename T>inline ll tolong(T a)
{
    ll res;
    istringstream os(a);
    os>>res;
    return res;
}
template<typename T>inline T gcd(T a, T b)
{
    if (b == 0)return a;
    else return gcd(b, a % b);
}
template<typename T>inline T bigmod(T a, T b, T m)
{
    if (b == 0)return 1;
    else if (b % 2 == 0)return S(bigmod(a, b / 2, m)) % m;
    else return (a % m*bigmod(a, b - 1, m)) % m;
}
#define N 20000009
bool prime[N];
vector<ll> prm;
void seive ()
{

    memset(prime, true, sizeof(prime));

    for( ll i=2; i*i<=N; i++)
    {
        if (prime[i] == true)
        {
            prm.pb(i);
            for (ll j=i*i; j<=N; j += i)
                prime[j] = false;
        }
    }
}
void pr (int f)
{
    if(f==1)
        cout<<"YES\n";
    else
        cout<<"NO\n";
}
map<int,int>mp;
set<int> s;

int main()
{
    fast;
    ll h,n,t,a,x;
    cin>>n>>t>>a;
    double dif=9223372036854775807;
    for(int i=0;i<n;i++)
    {
        cin>>h;
        if(dif>abs(a-t+0.006*h))
        {
            x=i+1;
            dif=abs(a-t+0.006*h);
        }
    }
    cout<<x<<endl;
}






Measured memory_bytes: 256
parseInt(x)=parse(Int,x)
parseMap(x::Array{SubString{String},1})=map(parseInt,x)
function bsearchg(a,x);l,r=1,length(a);while l<=r;m=r-div(r-l,2);if a[m]>x;r=m-1;else;l=m+1;end;end;return(l-1);end

function main()
	n = readline() |> parseInt
	a = Array{Int}(n)
	for i in 1:n
		a[i] = readline() |> parseInt
	end
	k = 1
	ma = a[n]
	stack=Int[a[n]]
	for i in 1:n-1
		x = bsearchg(stack,a[n-i])
		if x<length(stack)
			stack[x+1] = a[n-i]
		else
			push!(stack,a[n-i])
		end
	end
	println(length(stack))
end

main()

Measured memory_bytes: 181384
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import collections
import fractions
import itertools


def prime_factorization(n):

    assert n > 0
    if n == 1:
        return collections.deque([1])
    else:
        result = collections.deque()
        for i in itertools.count(2):
            if i * i > n:
                break
            else:
                while n % i == 0:
                    n //= i
                    result.append(i)
        if n > 1:
            result.append(n)
        return result


def phi(n):
    distinct_factors = set(prime_factorization(n))
    result = 1
    for f in distinct_factors:
        result *= (1 - fractions.Fraction(1, f))
    result *= n
    return result


if __name__ == "__main__":
    print(phi(int(input())))

Measured memory_bytes: 10268
#include<iostream>
using namespace std;
int main()
{
  int n, i, j, count=0;
    cin >> n;
  char temp, ch[n];
 
  for(i=0; i<n; i++)
    cin >> ch[i];
  i=0;
  j=n-1;
  while(i<j)
  {
    while(ch[i]!='W' && i<n)
      i++;
    while(ch[j]!='R' && j>=0)
      j--;
    if(i < j)
    {
      count++;
      temp = ch[i];
      ch[i] = ch[j];
      ch[j] = temp;
      i++;
      j--;
    }
  }
  cout << count;
  return(0);
}


Measured memory_bytes: 3348
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fr(i,j,k) for(int i=j;i<k;i++)
#define f(n) fr(i,0,n)
#define f1(n) fr(i,1,n+1)
#define ms(i) memset(i,-1,sizeof(i));
#define pb push_back
int main(){
	ios_base::sync_with_stdio(0);
	int n;
	cin >> n;
	int c[n+5]={};
	int v[n+5]={};
	f(n)cin>>v[i];
	f(n)cin>>c[i];
	int sum=0;
	f(n){
		sum+=max(v[i]-c[i],0);
	}
	cout<<sum<<endl;
	
	
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline
from itertools import product

N,M,X=(int(x) for x in input().rstrip('\n').split())
pat = [x for x in product([0,1], repeat=N)]
OK = []
C={}
for i in range(N):
  C[i]=[int(x) for x in input().rstrip('\n').split()]
for i in pat:
  ans = [0]*(M+1)
  for x in range(N):
    add =  [y*i[x] for y in C[x]]
    ans = [y + z for (y,z) in zip(add,ans)]
  if all(y>=X for y in ans[1:]):
    OK.append(ans[0])
if len(OK) >0:
  print(min(OK))
else:
  print('-1')


Measured memory_bytes: 9844
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<queue>
#define rep(index,num) for(int index=0;index<num;index++)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-15
typedef long long ll;
using namespace std;
int main(){
	int n,q;
	queue<string> name;
	queue<int> jikan;
	int nowtime=0;
	scan(n);scan(q);
	rep(i,n){
		string str;
		scan(str);
		int t;
		scan(t);
		name.push(str);
		jikan.push(t);
	}
	while(name.empty()==0){
		nowtime+=min(jikan.front(),q);
		jikan.front()-=q;
		if(jikan.front()<=0){
			printf("%s %d\n",name.front().c_str(),nowtime);
			name.pop();
			jikan.pop();
		}
		else{
			name.push(name.front());
			jikan.push(jikan.front());
			name.pop();
			jikan.pop();
		}
	}
	return 0;
}



Measured memory_bytes: 5796
#include<bits/stdc++.h>
using namespace std;
#define FIO ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define DEBUG(x)           cout << '>' << #x << ':' << x << endl;
#define forn(i,n)          for(int i=0;i<(int)n;++i)
#define for1(i,n)          for(int i=1;i<=(int)n;++i)
#define forr(i,n)          for(int i=(int)n-1;i>=0;--i)
#define forre(i,a,b)       for(int i=(int)b;i>=(int)a;--i)
#define fore(i,a,b)        for(int i=(int)a;i<=(int)b;++i)
#define input(arr,n)       for(int i=0;i<n;i++)cin>>arr[i]
#define output(arr,n)      for(int i=0;i<n;i++)cout<<arr[i]<<" "
#define for_each(arr)      for(auto& it:arr)cout<<it<<" "
#define ff                 first
#define ss                 second
#define PI                 acos(-1.0)
#define all(a)             a.begin(),a.end()
#define rall(a)            a.rbegin(),a.rend()
#define Unique(a)          sort(all(a)),a.erase(unique(all(a)),a.end())
#define pb(x)              push_back(x)
#define eb(x)              emplace_back(x) 
#define ppb(x)             pop_back(x)
#define pf(x)              push_front(x)
#define ppf(x)             pop_front(x)
#define in(x,y)            insert({x,y})
#define Sort(a)            sort(a.begin(),a.end())
#define mem(arr,a)         memset(arr,a,sizeof arr)
#define ins(a)             insert(a)
#define max2(a,b)          max(a,b)
#define max3(a,b,c)        max(a,max(b,c))
#define max4(a,b,c,d)      max(a,max3(b,c,d))
#define min2(a,b)          min(a,b)
#define min3(a,b,c)        min(a,min(b,c))
#define min4(a,b,c,d)      min(a,min3(b,c,d))
typedef long long ll;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<char> vc;
typedef vector<double> vd;
/*inline int two(int n) { return 1 << n; }
inline int test(int n, int b) { return (n>>b)&1; }
inline void Set(int & n, int b) { n |= two(b); }
inline void Reset(int & n, int b) { n &= ~two(b); }
inline int last_bit(int n) { return n & (-n); }
inline int ones(int n) { int res = 0; while(n && ++res) n-=n&(-n); return res; }*/
/*int fx1[]={+1,-1,+0,+0};
int fy1[]={+0,+0,+1,-1};
int fx2={+0,+0,+1,-1,-1,+1,-1,+1};
int fy2={-1,+1,+0,+0,+1,+1,-1,-1};
*/

ll a,b,c,n,ans,cn1,cn2,cn3,t;
string s,s1,s2;


int main()
{
    FIO;
   /* #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif*/
    cin>>n;
    vector<int>v(n+1);
    for(int i=1;i<=n;i++){
    	cin>>a;
    	v[a]=i;
    }
    for(int i=1;i<=n;i++)cout<<v[i]<<" ";
    cout<<endl;

    

    
   	
    #ifdef ONLINE_JUDGE
    cerr<<"Time elapsed: "<<1.0*clock()/CLOCKS_PER_SEC<<"s.\n";
    #endif
   return 0;
}
 


Measured memory_bytes: 1280
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#define _io ios_base::sync_with_stdio(false); cin.tie(nullptr);
using namespace std;

int main() { _io
    long long n, total=0, k=0;
    cin >> n;
    vector<long long> arr(n);
    for (int i=0; i<n; i++) {
        cin >> arr[i];
        if (arr[i] <= 0) k++;
        arr[i] = abs(arr[i]);
        total += arr[i];
    }
    cout << total - (k%2 ? 2*(*min_element(arr.begin(), arr.end())) : 0);
}

Measured memory_bytes: 1024
n,z,w=map(int,input().split())
a=list(map(int,input().split()))
if n==1:
  print(abs(w-a[0]))
else:
  ans=0
  ans=max(ans,abs(a[-1]-w))
  ans=max(ans,abs(a[-1]-a[-2]))
  print(ans)

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

int main(void){

  int N ;
  cin >> N;
  vector<double>a(N);
  int i = 0;
  for(i = 0;i < N ; i++ ){
      cin >> a[i] ;
      
  }
  
  double sum = 0;
  
    for(i = 0;i < N ; i++ ){
      sum += 1 / a[i];
      
  }
  cout << 1/sum << endl;
  return 0;

}


Measured memory_bytes: 256
# AOJ 1028: ICPC: Ideal Coin Payment and Change
# Python3 2018.7.5 bal4u

c = (500, 100, 50, 10, 5, 1)

def pay(p):
	cnt = 0
	for i in range(6):
		if c[i] <= p:
			k = p//c[i]
			if k > n[i]: k = n[i]
			cnt += k
			p -= c[i]*k
	return -1 if p > 0 else cnt

k = [0]*1001
for p in range(1, 1001):
	cnt, q = 0, p
	for j in range(6):
		if c[j] <= q:
			cnt += q//c[j]
			q %= c[j]
	k[p] = cnt;

while True:
	a = list(map(int, input().split()))
	p = a[0]
	if p == 0: break
	del a[0]
	n = a[::-1]
	ans = 0x7fffffff
	for i in range(p, p+1001):
		j = pay(i)
		if j < 0: continue
		ans = min(ans, j + k[i-p])
	print(ans)


Measured memory_bytes: 5612
#include <stdio.h>
int main(){
 int a,b,c,d;
 scanf("%d%d%d", &a, &b, &c);
 if(a > b){
  d = a;
  a = b;
  b = d;
 }
 if(a > c){
  d = a;
  a = c;
  c = d;
 }
 if(b > c){
  d = b;
  b = c;
  c = d;
 }
 printf("%d %d %d\n", a, b, c);
  
 return 0;
}

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

int main() {

    int a,b,c,k;
    int sum = 0;

    cin >> a >> b >> c >> k;

    while(k > 0) {

        if(a != 0) {
            sum += 1;
            a--;
        } else {
            break;
        }
        k--;
    }

    while(k > 0) {

        if(b != 0) {
            sum += 0;
            b--;
        } else {
            break;
        }
        k--;
    }

    while(k > 0) {

        if(c != 0) {
            sum -= 1;
            c--;
        } else {
            break;
        }
        k--;
    }


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

Measured memory_bytes: 3612
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
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()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

def is_prime(num):
	if num < 2:
		return False
	if num in [2, 3, 5]:
		return True
	if any(num%x == 0 for x in [2, 3, 5]):
		return False
	prime = 7
	step = 4
	while prime <= sqrt(num):
		if num%prime == 0:
			return False
		prime += step
		step = 6-step
	return True


A, B = MAP()

C = gcd(A, B)
ans = 1

for i in range(1, int(sqrt(C))+1):
	if C%i == 0:
		ans += is_prime(i) + is_prime(C//i)

	

print(ans)


Measured memory_bytes: 5204
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()

int main(){
    double a,b,s,t;
    cin>>a>>b;
    s=ceil(a/0.08);
    t=ceil(b/0.1);
    if(s<t){
        floor(t*0.08)==a ? cout<<t : cout<<-1;
    }else if(t<s){
        floor(s*0.1)==b ? cout<<s : cout<<-1;
    }else{
        cout<<s;
    }
    return 0;
}


Measured memory_bytes: 256
#include<iostream>

int A[9] = {1,2,4,7,12,20,29,38,52}; long long B[11][11] , N;

int main(){
	std::cin >> N; long long MX = 1;
	for(int i = 2 ; i <= N ; ++i){
		for(int j = 1 ; j < i ; ++j) B[i][j] = B[j][i] = MX * A[j - 1];
		MX += B[i][i - 1] + B[i][i - 2] - B[i - 1][i - 2];
	}
	for(int i = 1 ; i <= N ; ++i) for(int j = 1 ; j <= N ; ++j) std::cout << B[i][j] << " \n"[j == N];
	return 0;
}

Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))

mod = 1000000007
s = 0
for i in range(n):
  s += a[i]
  s %= mod

ans = 0
for i in range(n):
  s -= a[i]
  if s < 0:
    s += mod
  ans += a[i] * s
  ans %= mod
print(ans)
         

Measured memory_bytes: 31604
#include<iostream>

using namespace std;

int main(){
    
    int m,d,out=0;

    cin>>m>>d;


    for(int i = 1; i <= m; i++){

        for(int j = 22; j <= d; j++){

            if(j%10 >= 2){

                if(i == (j/10)*(j%10))
                    out++;

            }

        }

    }

    cout<<out;

    return 0;
}

Measured memory_bytes: 256
//#include <tourist>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <string>
#include <iomanip>
#include <limits>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <list>
#include <queue>
#include <tuple>
#include <deque>
#include <algorithm>
#include <numeric>
#include <iomanip>
#include <utility>
#include <complex>
#include <functional>
using namespace std;
const int MOD = 1000000007;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = (1 << 28);
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
//setprecision(15)有効数字15桁
//-std=c++14
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b)
{
    return a * b / gcd(a, b);
}
struct edge {
    int to, cost;
};
int n, mn;
vector<int> a;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n>>mn;
    map<int,int> m;
    vector<bool> used(100000,false);
    int wa=0;
    int ac=0;
    for (int i = 0; i < mn; i++)
    {
        int temp;
        string s;
        cin >> temp>>s;
        temp--;
        if(used[temp])continue;
        if(s=="WA"){
            m[temp]++;
        }
        else{
            wa+=m[temp];
            ac++;
            used[temp]=true;
        }
    }
    cout << ac <<" "<<wa<< "\n";
}



Measured memory_bytes: 4992
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <stack>
using namespace std;

int main()
{
    int a[55][55];
    int h, w;
    cin >> h >> w;
    getchar();
    for (int i = 1; i <= h; i++)
    {
        for (int j = 1; j <= w; j++)
        {
            char temp;
            scanf("%c", &temp);
            if (temp == '#')
                a[i][j] = 1;
            else
                a[i][j] = 0;
        }
        getchar();
    }
    int flag = 1;
    for (int i = 1; i <= h; i++)
    {
        for (int j = 1; j <= w; j++)
        {
            if (a[i][j] == 1)
            {
                int ok = 0;
                if (i - 1 >= 1 && j >= 1 && a[i - 1][j] == 1)
                    ok = 1;
                if (i >= 1 && j - 1 >= 1 && a[i][j - 1] == 1)
                    ok = 1;
                if (i >= 1 && j + 1 <= w && a[i][j + 1] == 1)
                    ok = 1;
                if (i + 1 <= h && j >= 1 && a[i + 1][j] == 1)
                    ok = 1;
                
                if(ok == 0)
                    flag = 0;
            }
        }
    }
    if(flag)
        printf("Yes\n");
    else
        printf("No\n");
}

Measured memory_bytes: 256
import java.util.Scanner;


public class Main {
	public static void main(String[] args) {
		try(Scanner sc = new Scanner(System.in)) {
			int cnt = 0;
			String W = sc.nextLine();
			while(true) {
				String T = sc.nextLine();
				
				if(T.equals("END_OF_TEXT") )	break;
				
				String[] t = T.toLowerCase().split(" ");
				for(String i:t) {
					if(i.equals(W)) {
						cnt++;
					}
				}
				
			}
			System.out.println(cnt);
			
			
			
		}
	}
}


Measured memory_bytes: 26104
N = int(input())
a = [int(i) for i in input().split()]
ls = [0]*9
b = [1,400,800,1200,1600,2000,2400,2800,3200,4810]
for i in range(N):
    for j, (x, y) in enumerate(zip(b, b[1:])):
        if x <= a[i] and a[i] < y:
            ls[j] += 1
l = 8 - ls[:-1].count(0)
if l == 0:
    print(1, ls[-1])
else:
    print(l, l+ls[-1])

Measured memory_bytes: 3064
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Scanner;
import java.util.Set;
import java.util.stream.IntStream;

public class Main {

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			int n = scanner.nextInt();
			long k = scanner.nextLong();
			int[] a = new int[n + 1];
			IntStream.rangeClosed(1, n).forEach(i -> a[i] = scanner.nextInt());
			List<Integer> list = new ArrayList<>();
			// containsを計算用
			Set<Integer> set = new HashSet<>();
			list.add(1);
			set.add(1);
			int index = 1, count = 0;
			while (!set.contains(a[index])) {
				list.add(a[index]);
				set.add(a[index]);
				count++;
				if (k == count) {
					System.out.println(a[index]);
					return;
				}
				index = a[index];
			}
			int start = list.indexOf(a[index]);
			System.out.println(list.get(start + (int) ((k - list.size()) % (list.size() - start))));
		}
	}
}


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

long long n, ans;

long long digit(long long x) {
    long long res = 0;
    while (x) {
        res++;
        x/=10;
    }
    return res;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    
    cin >> n;
    ans = 1e18;
    for (long long i = 1; i*i <= n; i++) {
        if (n%i == 0) {
            ans = min(ans, max(digit(i), digit(n/i)));
        }
    }
    cout << ans << '\n';

    return 0;
}

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

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

#define loop(i, n) for(int i = 0;i < n;i++)

int main(void){

    double a, b, h, m;
    cin >> a >> b >> h >> m;

    cout << fixed << setprecision(20);
    double pi = acos(-1);

    double h_arrow_angle = (pi/6.0*h+pi/360.0*m);
    double m_arrow_angle = (pi/30.0*m);


    double angle = min(abs(h_arrow_angle-m_arrow_angle), abs(h_arrow_angle-m_arrow_angle-180.0));

    double ans = sqrt(a*a+b*b-2*a*b*cos(angle));

    cout << ans << endl;

    return 0;
}

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

#define int long long

#define pii pair<int,int> 
#define fi first
#define se second

#define mid ((l+r)>>1)

const int maxn=100010;

int N,C;
pii a[maxn];
int v[maxn][5];

int data1[maxn<<2];
int data3[maxn<<2];

void pushup1(int o)
{
	data1[o]=max(data1[o<<1],data1[o<<1|1]);
}

void build1(int o,int l,int r)
{
	if(l==r)
	{
		data1[o]=v[l][1];
		return;
	}
	build1(o<<1,l,mid);
	build1(o<<1|1,mid+1,r);
	pushup1(o);
}

int query1(int o,int l,int r,int ql,int qr)
{
	if(ql>qr) return 0;
	if(l==r) return data1[o];
	if(ql<=l && r<=qr) return data1[o];
	int res=0;
	if(ql<=mid) res=max(res,query1(o<<1,l,mid,ql,qr));
	if(mid+1<=qr) res=max(res,query1(o<<1|1,mid+1,r,ql,qr));
	return res;
}

void pushup3(int o)
{
	data3[o]=max(data3[o<<1],data3[o<<1|1]);
}

void build3(int o,int l,int r)
{
	if(l==r)
	{
		data3[o]=v[l][3];
		return;
	}
	build3(o<<1,l,mid);
	build3(o<<1|1,mid+1,r);
	pushup3(o);
}

int query3(int o,int l,int r,int ql,int qr)
{
	if(ql>qr) return 0;
	if(l==r) return data3[o];
	if(ql<=l && r<=qr) return data3[o];
	int res=0;
	if(ql<=mid) res=max(res,query3(o<<1,l,mid,ql,qr));
	if(mid+1<=qr) res=max(res,query3(o<<1|1,mid+1,r,ql,qr));
	return res;
}

main()
{
	ios::sync_with_stdio(false);
	
	cin>>N>>C;
	for(int i=1;i<=N;i++)
	{
		cin>>a[i].fi>>a[i].se;
	}
	a[N+1]={C,0};
	sort(a+1,a+1+N+1);
	for(int i=1;i<=N;i++)
	{
		v[i][1]=v[i-1][1]+a[i].se-(a[i].fi-a[i-1].fi);
		v[i][2]=v[i-1][2]+a[i].se-2*(a[i].fi-a[i-1].fi);
	}
	for(int i=N;i>=1;i--)
	{
		v[i][3]=v[i+1][3]+a[i].se-(a[i+1].fi-a[i].fi);
		v[i][4]=v[i+1][4]+a[i].se-2*(a[i+1].fi-a[i].fi);
	}
	
//	for(int i=1;i<=N;i++)
//	{
//		cout<<"{ "<<v[i][1]<<" "<<v[i][2]<<" "<<v[i][3]<<" "<<v[i][4]<<endl;
//	}
	
	build1(1,1,N);
	build3(1,1,N);
	
	int ans=0;
	ans=max(ans,v[N][1]);
	ans=max(ans,v[1][3]);
	for(int i=1;i<=N;i++)
	{
		if(v[i][4]<0) ans=max(ans,query1(1,1,N,1,i-1));
		else ans=max(ans,v[i][4]+query1(1,1,N,1,i-1));
//		cout<<"i="<<i<<" ("<<1<<" "<<i-1<<")"<<v[i][4]<<" "<<query1(1,1,N,1,i-1)<<" "<<ans<<endl;
		if(v[i][2]<0) ans=max(ans,query3(1,1,N,i+1,N));
		else ans=max(ans,v[i][2]+query3(1,1,N,i+1,N));
//		cout<<"i="<<i<<" ("<<1<<" "<<i-1<<")"<<v[i][2]<<" "<<query3(1,1,N,i+1,N)<<" "<<ans<<endl;
	}
	cout<<ans<<endl;
}

/*
1:

*/










Measured memory_bytes: 12032
#include <iostream>
#include <vector>
#include <string>
#include <tuple>
#include <algorithm>
#include <numeric>
#include <climits>
#include <map>
#include <functional>
#include <cmath>
#include <cassert>
#include <set>

using namespace std;

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

    set<int> a;
    for (int i = 0; i < m; i++) {
        int tmp;
        cin >> tmp;
        a.insert(tmp);
    }

    vector<int> c(n+1);
    for (int i = 0; i <= n; i++) {
        if (a.count(i)) {
            c[i] = 0;
        } else if (i == 0) {
            c[i] = 1;
        } else if (i == 1) {
            c[i] = 1;
        } else {
            c[i] = ((long)c[i-1] + c[i-2]) % 1000000007;
        }
    }
    cout << c[n] << endl;

    return 0;
}

Measured memory_bytes: 5376
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define SZ(X) ((int)(X).size())
#define endl "\n";
int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	// freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);
	
  int n;
  cin>>n;
  if(n==1) {
  	cout<<1;
  	return 0;
  }
  for (int i = 0; i < n; ++i)
  {
  	 if((1<<i)>n){
  	 	cout<<(1<<(i-1));
  	 	return 0;
  	 }
  }
   return 0;
}


Measured memory_bytes: 3608