akhauriyash/Code-Regression huggingface dataset:
///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
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;
}
int city[1000];

int main()
{
    ios_base::sync_with_stdio(0);
    //ll n,c,cnt=0,prev;
    int n,m,x,y;
    cin>>n>>m;
    for(int i=0; i<m; i++)
    {
        cin>>x>>y;
        city[x-1]++;
        city[y-1]++;
    }
    for(int i=0; i<n; i++)
    {cout<<city[i]<<"\n";}
}


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

int main(){
  string S ; 
  
  cin >> S ; 
  int N = S.size() ;
  int P = 700 ; 
  
  for(int i = 0 ; i < N ; i++){
    if(S.at(i) == 'o'  ){
      P = P + 100 ; 
    }
  
  }
  
  cout << P << endl ; 
  
}

Measured memory_bytes: 3600
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <queue>
#include <list>
#include <cmath>
#include <stack>
#include <iomanip>

using namespace std;
typedef long long ll;
using Pll = pair<ll,ll>;

const ll INF = 1LL<<60;
const ll MOD = 1000000007;

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

int main() {
    ll r;
    cin >> r;
    cout << 3*r*r << endl;

    return 0;
}

Measured memory_bytes: 256
N, A, B = map(int, input().split())
S = [_ for _ in input()]

num_passed = 0
b_passed = 0

for n in range(N):
    if S[n] == 'c':
        print('No')
    elif S[n] == 'b':
        b_passed += 1
        num_passed += 1
        if num_passed > A + B:
            print('No')
        else:
            if b_passed > B:
                print('No')
                num_passed -= 1
            else:
                print('Yes')
    elif S[n] == 'a':
        num_passed += 1
        if num_passed > A + B:
            print('No')
        else:
            print('Yes')


Measured memory_bytes: 4692
#include <iostream>
#include <iomanip>
#include <fstream>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <string>
#include <tuple>
#include <vector>
#include <map>
#include <unordered_map>
#include <list>
#include <set>
#include <stack>
#include <queue>
#include <cstdlib>
#include <algorithm>
#include <random>
#include <cassert>
using namespace std;
#define LL long long
#define MP(a, b) make_pair(a, b)
#define POWER9 1000000000
#define MOD POWER9+7
#undef INT_MIN
#undef INT_MAX
#define INT_MIN -2147483647
#define INT_MAX 2147483647
#define LL_MIN (LL)-9223372036854775807
#define LL_MAX (LL)9223372036854775807
#define PI 3.14159265359

int N,M;
LL ans = 0;
bool already[8] = {};
bool can[8][8] = {};

void dfs(int now){
	bool flg = true;
	for(int i=0; i<N; i++){
		flg = flg && already[i];
		if(!already[i] && can[now][i]){
			already[i] = true;
			dfs(i);
			already[i] = false;
		}
	}
	if(flg) ans++;
}

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

	cin >> N >> M;
	for(int i=0; i<M; i++){
		int a,b;
		cin >> a >> b;
		a--; b--;
		can[a][b] = true;
		can[b][a] = true;
	}
	for(int i=0; i<1; i++){
		already[i] = true;
		dfs(i);
		already[i] = false;
	}
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
int d;
string map[105];
int n;
 
void visit() {
  int dx[4] = {0,1,0,-1};
  int dy[4] = {-1,0,1,0};
  int sum,  flg = 0;
  int x = 2,y = n;
  map[y][x] = ' ';
  int ab[4] = {2,2,2,2};
 
  while(1) {
    sum = 0;
    while(1) {
      if(map[y+dy[flg]*2][x+dx[flg]*2] != '#' && map[y+dy[flg]][x+dx[flg]] != ' ' ) {
    flg++;
    //  cout << sum << endl;
 
    break;
      }
       
      map[y+dy[flg]][x+dx[flg]] = ' ';
      y = y + dy[flg];
      x = x + dx[flg];
      sum++;
    }
    if(flg == 4) flg = 0;
    if(sum == 0) break;
    ab[0] = ab[1];
    ab[1] = ab[2];
    ab[2]  = sum;
    if(ab[0] == 1 && ab[2] == 1 && ab[1] == 1) break;
 
  }
}
 
 
int main() {
   
  cin >> d;
   
  for(int l=0;l<d;l++) {
     
    cin >> n;
 
    if(n == 1) {
      cout << "#" <<endl  ;
    if(l != d-1) cout << endl;
    continue;
    }   
 
    for(int i=0;i<=n+1;i++){
      map[i].resize(n+2);
      for(int j=0;j<=n+1;j++){
    map[i][j] = '#';
    if(i == 0 || j == 0 || i == n+1 || j == n+1) map[i][j] = '.';
      }
    }
     
     
    visit();
     
    for(int i=1;i<=n;i++){
      for(int j=1;j<map[i].size()-1;j++) {
    cout << map[i][j];
      }
      cout << endl;
    }
    if(l != d-1) 
      cout << endl;
     
  }
return 0;
}

Measured memory_bytes: 1232
#include<stdio.h>
int main()
{
	int number[31]={0};
	int i,j,h;
	for(i=1;i<=28;i++){
		scanf("%d",&h);
		number[h]=1;
	}
	for(i=1;i<=30;i++){
		if(0==number[i]){
			printf("%d\n",i);
		}
	}
	return 0;
}


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

int main(){
  double a;
  while(cin>>a){
    double s=0.0;
    s+=a;
    for(int i=2;i<=10;i++){
      if(i%2) a/=3;
      else a*=2;
      s+=a;
    }
    cout<<fixed<<setprecision(8)<<s<<endl;
  }
  return 0;
}

Measured memory_bytes: 1276
#include <cctype>
#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
  char c;
  std::cin>>c;
  if(std::isupper(c)) {
    cout << 'A' << endl;
  } else {
    cout <<'a' << endl;
  }
  return 0;
}


Measured memory_bytes: 3604
#include <bits/stdc++.h>
#include <cassert>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define ok() puts(ok?"Yes":"No");
#define chmax(x,y) x = max(x,y)
#define chmin(x,y) x = min(x,y)
using namespace std;
using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using ii = pair<int, int>;
using vvi = vector<vi>;
using vii = vector<ii>;
using gt = greater<int>;
using minq = priority_queue<int, vector<int>, gt>;
using P = pair<ll,ll>;
const ll LINF = 1e18L + 1;
const int INF = 1e9 + 1;
//clang++ -std=c++11 -stdlib=libc++ 
ll x[100010], v[100010];
ll sumR[100010];
ll sumL[100010];
ll maxL[100010];
ll maxR[100010];
int main() {
  // 095d
  ll n; ll c; cin >> n >> c;
  // vll x(n+4), v(n+4);
  rep(i,n) cin >> x[i+1] >> v[i+1];
  x[n+1] = c; 
  v[n+1] = 0;
  x[0] = v[0] = 0;
  // vll maxR(n+4), maxL(n+4), sumR(n+4), sumL(n+4);
  // rep(i, n+1) {
  //   sumR[i+1] = sumR[i] + v[i+1]-(x[i+1]-x[i]);
  //   maxR[i+1] = max(maxR[i], sumR[i+1]);
  // }
  // for (int i=n; i>=0; i--) {
  //   sumL[i] = sumL[i+1] + v[i]-(x[i+1]-x[i]);
  //   maxL[i] = max(maxL[i+1], sumL[i]);
  // }
  // ll ans = 0;
  // for (int i=n+1; i>=0; i--) {
  //   ll cal = sumL[i] - (c-x[i]);
  //   cal += maxR[i-1];
  //   chmax(ans, cal);
  // }
  // rep(i, n+1) {
  //   ll cal = sumR[i] - x[i];
  //   cal += maxL[i+1];
  //   chmax(ans, cal);
  // } 
  ll ans =0;
  for (int i = 0; i <= n; i++) {
		sumR[i + 1] = sumR[i] + v[i + 1] - (x[i + 1] - x[i]);
		maxR[i + 1] = max(maxR[i], sumR[i + 1]);
	}
	for (int i = n; i >= 0; i--) {
		sumL[i] = sumL[i + 1] + v[i] - (x[i + 1] - x[i]);
		maxL[i] = max(maxL[i + 1], sumL[i]);
	}
	for (int i = n + 1; i >= 0; i--) {
		ll kcal = sumL[i] - (c - x[i]);
		kcal += maxR[i - 1];
		ans = max(ans, kcal);
		//cout << ans << endl;
	}
	for (int i = 0; i <= n; i++) {
		ll kcal = sumR[i] - x[i];
		kcal += maxL[i + 1];
		ans = max(ans, kcal);
		//cout << ans << endl;
	}
  printf("%lld\n", ans);
  return 0;
}

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

int main()
{
    int N;
    string S;
    cin >> N >> S;
    string ans;
    char prev = S[0];
    bool flag = false;
    for (int i = 0; i < N; ++i)
    {
        if (S[i] != prev)
        {
            ans.push_back(prev);
        }
        prev = S[i];
    }
    ans.push_back(prev);
    cout << ans.length() << endl;
}

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

using namespace std;

#define ll long long
#define ld long double
#define ff first
#define ss second
#define rsz resize
#define ins insert 
#define mp make_pair
#define pf push_front 
#define pb push_back
#define eb emplace_back 
#define ft front() 
#define bk back()
#define sz(x) (int)(x).size()
#define all(x) begin(x), end(x)
#define deb(x) cout<<#x<<" "<<x<<'\n';
#define rep(i,a,b) for (int i = (a); i < (b); ++i)

const ll mod = 1e9+7; // 998244353;
const ll inf = 1e18; 
const ld pie = acos((ld)-1);

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



int main(){
    
	string s;
	cin>>s;
	if(s[s.length()-1]!='s'){
		s.pb('s');
	}else{
		s.pb('e');
		s.pb('s');
	}

	cout<<s<<'\n';
	return 0;

	/*STUFF TO LOOK:	
		1. Check the constraints
		2. Corner cases(n==0||n==1)
		3. Variables in loops
		4. Make sure two ints aren’t multiplied to get a long long
		5. Don't use scanf or printf while using ios_base
		6. using the local variable of the same name when global variable was required to be used
	*/
}


Measured memory_bytes: 3580
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip> 
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;

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

	long long n, i, j, k, ans, x, xx;
	cin >> n >> x;
	vector<long long> a(n);
	for (i = 0; i < n; i++) cin >> a[i];
	ans = 0;
	if (a[0] > x) {
		ans += a[0] - x;
		a[0] = x;
	}
	for (i = 1; i < n; i++) {
		if (a[i - 1] + a[i] > x) {
			ans += a[i - 1] + a[i] - x;
			a[i] = x - a[i - 1];
		}
	}
	cout << ans << "\n";

	return 0;
}



Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define PI 3.1415926535


int main()
{
    ll n, k;
    cin >> n >> k;
    vector<ll> h(n);
    for(ll i = 0; i < n; i++) cin >> h[i];
    ll ans = 0;
    for(ll i = 0; i < n; i++){
        if(h[i] >= k) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 1024
import java.io.InputStream;
import java.io.PrintStream;
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	InputStream in = System.in;
	PrintStream out = System.out;

	String S;
	char[] s;
	int N;
	int[][] ikisaki;

	private void fun(int oe, int i) {
		if (ikisaki[oe][i] != -1) {
			return; //すでに計算済み
		}

		//いったりきたりを検出
		char c = s[i];

		if (c == 'R') {
			char cr = s[i+1];
			if (cr == 'L') {
				//いったりきたり
				if (oe == 0) { //偶数
					//今の場所が最終地点
					ikisaki[0][i] = i;
					//となりも記録する（左隣の最終地点は（奇数）は、今の場所）
					ikisaki[1][i + 1] = i;
				} else {
					//となりが最終地点
					ikisaki[1][i] = i + 1;
					ikisaki[0][i + 1] = i + 1;
				}
			} else {
				//Lがでてくるまで右に進む。Lが出てくる直前のRの地点より前は、すべて最終地点は直前のRの地点の行先と偶奇できまる
				int p=i;
				while(!( s[p] == 'R' && s[p+1] == 'R' && s[p+2] == 'L')) {
					p++;
				}
//				fun(0, p+1);
//				fun(1, p+1);
				ikisaki[0][p+1] = p+1;
				ikisaki[1][p+1] = p+2;

				for(int q=p;q>=i;q--) {
					ikisaki[0][q] = ikisaki[1][q+1];
					ikisaki[1][q] = ikisaki[0][q+1];
				}
				
//				//となりの最終地点が、iの最終地点でもある
//				fun(oe ^ 1, i + 1);
//				ikisaki[oe][i] = ikisaki[oe ^ 1][i + 1];
			}
		} else { //c=='L'
			char cl = s[i - 1];
			if (cl == 'R') {
				//いったりきたり
				if (oe == 0) {
					//今の場所が最終地点
					ikisaki[0][i] = i;
					
					//左から決まっていくので左を更新する必要はない
				} else {
					//となりが最終地点
					ikisaki[1][i] = i - 1;
					//左から決まっていくので左を更新する必要はない
				}
			} else {
				//となりの最終地点が、iの最終地点でもある
				ikisaki[oe][i] = ikisaki[oe ^ 1][i - 1];
				
				//左から決まっていくので左を更新する必要はない
			}
		}

		//いったりきたりではない
	}

	public void _main(String[] args) {
		Scanner sc = new Scanner(in);

		S = sc.next();
		s = S.toCharArray();
		
		sc.close();

		N = S.length();

		ikisaki = new int[2][N];
		Arrays.fill(ikisaki[0], -1);
		Arrays.fill(ikisaki[1], -1);

		fun(0,0);
		fun(1,0);
		for (int i = 1; i < N; i++) {
			for (int oe = 0; oe <= 1; oe++) {
				fun(oe, i);
			}
		}

		int[] ans = new int[N];

		for (int i = 0; i < N; i++) {
			ans[ikisaki[0][i]]++;
		}

		out.println(join(" ", ans));

	}

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

	@SuppressWarnings("unused")
	private String join(String delimiter, int[] a) {
		StringBuilder sb = new StringBuilder();

		for (int i = 0; i < a.length; i++) {
			sb.append(a[i]);
			sb.append(delimiter);
		}
		return sb.substring(0, Math.max(sb.length() - delimiter.length(), 0));
	}
}


Measured memory_bytes: 31312
#include<iostream>
#include<cmath>
using namespace std;
int power(int i,int j){
	int ans=1;
	for(int k=1;k<=j;k++)
		ans*=i;
	return ans;
}
int main(){
	int x,maxv=0;
	cin>>x;
	if(x==1){
		cout<<'1'<<endl;
		return 0;
	}
	for(int i=2;i<=int(sqrt(x));i++)
		for(int j=2;j<=10;j++)
			if(power(i,j)<=x&&power(i,j)>maxv)
				maxv=power(i,j);
	cout<<maxv<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<cstdio>

int main(){
  char a[20],b[20],c[20];

  scanf("%s %s %s",a,b,c);

  printf("%c%c%c\n",a[0]+'A'-'a',b[0]+'A'-'a',c[0]+'A'-'a');

  return 0;
}


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

using namespace std;

#define INF 1e9
#define MAXN 100005
#define MAXM 100005
#define MOD 1000000007
#define ll long long
#define vi vector<int>
#define vll vector<long long>
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define pii pair<int, int>

ll ans;
int A,B,C,D, cnt;
void solve(){
    cnt = (C+B-1)/B;

    if(A > (cnt-1)*D) cout << "Yes" << endl;
    else cout << "No" << endl;
}

int main(){
    cin >> A >> B >> C >> D;

    solve();
}


Measured memory_bytes: 3636
#include<iostream>
#include<cstdio>
using namespace std;
int main(){
  int n,a[100000],cnt=0,sum,max=0,ka[100000]={};
  cin>>n;
  for(int i=0;i<n;i++)cin>>a[i];
  for(int i=0;i<n-1;i++){
    if(a[i]!=a[i+1]){
      ka[cnt]++;
      if(i==n-2)ka[cnt]++;
    }
    else if(i>0&&a[i-1]==a[i]&&a[i]==a[i+1]){
      ka[cnt]++;
      cnt++;
    }
    else {
      ka[cnt]++;
      cnt++;
      if(i==n-2)ka[cnt]++;
    }
  }
  if(cnt==0)max=ka[0];
  else if(cnt==1)max=ka[0]+ka[1];
  else for(int i=0;i<cnt-1;i++){
      sum=ka[i]+ka[i+1]+ka[i+2];
      if(sum>max)max=sum;
    }
  printf("%d\n",max);
  return 0;
}  

Measured memory_bytes: 3984
N = int(input())
A = [int(input()) for i in range(N)]

diff = []
XOR = 0
for a in A:
    XOR ^= a
    diff.append(a ^ a-1)

diff.sort(reverse=True)
ans = 0
for d in diff:
    if XOR & ((d + 1) >> 1):
        ans += 1
        XOR ^= d


print(ans if XOR == 0 else -1)


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

int n, k;
vector<int> d;
vector<vector<int>> A;

void input(){
	cin >> n >> k;
	d.resize(k);
	A.resize(k, vector<int>());

	rep(i, k){
		cin >> d.at(i);
		A.at(i).resize(d.at(i));
		rep(j, d.at(i)){
			cin >> A.at(i).at(j);
		}
	}
}

void solve(){
	int ans = 0;

	for(int i = 1; i <= n; i++){
		bool have = false;
		for(auto v : A){
			for(auto p : v){
				if(i == p) have = true;
			}
		}
		if(!have) ans++;
	}
	cout << ans << endl;
}

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

Measured memory_bytes: 3648
#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <utility>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;

int main(){
    ll a;
    cin >> a;
    if(a < 1200) cout << "ABC" << endl;
    else if(a < 2800) cout << "ARC" << endl;
    else cout << "AGC" << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <climits>
#include <cstdlib>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define DEBUG 1
using namespace std;
constexpr int kMod = 1000000007;
typedef long long LL;

int main() {
  int N; cin >> N;
  string S; cin >> S;
  int vmax = 0;
  for (int i = 0; i < N; ++i) {
    set<char> ls, rs;
    for (int j = 0; j < i; ++j) {
      ls.insert(S[j]);
    }
    for (int j = i; j < N; ++j) {
      rs.insert(S[j]);
    }

    int cnt = 0;
    for (char l : ls) {
      for (char r : rs) {
        if (l == r) ++cnt;
      }
    }
    vmax = max(vmax, cnt);
  }
  cout << vmax << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>

int max(int a, int b){
  return a >= b ? a : b;
}
int min(int a, int b){
  return b >= a ? a : b;
}
int factorial(int n) {
    if (n > 0) return n*factorial(n - 1);
		else return 1;
}
int compare_up_int(const void *a, const void *b){
   return *(int*)a - *(int*)b;
}
int compare_down_int(const void *a, const void *b){
   return *(int*)b - *(int*)a;
}
int euclid(int a, int b){
  if(a < b){int tmp = a;a = b;b = tmp;}
  int r = a % b;
  if(r < 0) r += b;
  while(r != 0){
    a = b;b = r;r = a % b;
    if(r < 0) r += b;
  }
  return b;
}

int main(){
  int N,X,count=0;
  scanf("%d %d",&N,&X);
  int num[N];
  for(int i=0;i<N;i++) scanf("%d",&num[i]);
  qsort(num,N,sizeof(int),compare_up_int);
  for(int i=0;i<N;i++) X-=num[i];

  printf("%d",X/num[0] + N);
  return 0;
}


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

int main(){
    int N;
    std::cin >> N;
    std::vector< std::vector < int > > Ax(N);
    std::vector< std::vector < int > > Ay(N);
    for(int i=0; i<N; i++){
        int tmp;
        std::cin >> tmp;
        Ax[i].resize(tmp);
        Ay[i].resize(tmp);
        for(int j=0; j<tmp; j++){
            std::cin >> Ax[i][j] >> Ay[i][j];
        }
    }
    std::deque< std::vector< bool > > pat;
    std::deque< std::vector< bool > > pat_pre;
    std::vector< bool > tmp(1, true);
    pat.push_back(tmp);
    tmp.assign(1, false);
    pat.push_back(tmp);
    for(int i=1; i<N; i++){
        pat_pre = pat;
        pat.clear();
        while(!pat_pre.empty()){
            tmp = pat_pre[0];
            tmp.push_back(true);
            pat.push_back(tmp);
            tmp[tmp.size() - 1] = false;
            pat.push_back(tmp);
            pat_pre.pop_front();
        }
    }
    
    int max = 0;
    while(!pat.empty()){
        tmp = pat[0];
        bool ok = true;
        for(int i=0; i<N; i++){
            if(!tmp[i]){
                continue;
            }
            for(int j=0; j<Ax[i].size(); j++){
                if(tmp[Ax[i][j] - 1] != Ay[i][j]){
                    ok = false;
                    break;
                }
            }
        }
        if(ok){
            int cnt = 0;
            for(int i=0; i<N; i++){
                if(tmp[i]){
                    cnt++;
                }
            }
            if(max < cnt){
                max = cnt;
            }
        }
        pat.pop_front();
    }
    
    std::cout << max << std::endl;
    
    
    return 0;
}



Measured memory_bytes: 2688
N, K, Q = map(int,input().split())
A = {}

for i in range(Q):
  a = input()
  if str(A.get(a)) == 'None':
    A[a] = 1
  else:
    A[a] += 1
    
for i in range(1,N+1):
  _i = str(i)
  if _i in A:
    if K - (Q - A[_i]) > 0:
      print('Yes')
    else:
      print('No')
  else:
    if K - Q > 0:
      print('Yes')
    else:
      print('No')

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

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;

#define F first
#define S second
#define PB push_back
#define MP make_pair
#define what_is(x) cerr << #x << " is " << x << endl;
#define MT make_tuple
#define eb emplace_back
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))

#define REP(i,a,b) for (int i = a; i <= b; i++)
#define FOR(i,n) for (int i=0;i < n ; i++)
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);
}

int main(){
	int n;
	cin >> n;
	int a;
	int ans[100000];
	FOR(i,100000) ans[i]=0;
	FOR(i,n){
		cin >> a;
		ans[a]++;
		ans[a-1]++;
		ans[a+1]++;
	}
	int maxq=0;
	FOR(i,100000) maxq=max(ans[i],maxq);
	cout <<  maxq;

	return 0;
}

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

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

    int i, j,
        min = 1000000;
    string a, b;
    for(i = 1; i < n; i++) {
        a = to_string(i);
        b = to_string(n - i);
        int a_sum = 0,
            b_sum = 0;
        for(j = 0; j < (int)a.size(); j++) {
            a_sum += a[j] - '0';
        }
        for(j = 0; j < (int)b.size(); j++) {
            b_sum += b[j] - '0';
        }
        if (min > a_sum + b_sum) {
            min = a_sum + b_sum;
        }
    }
    cout << min << endl;
}


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

int main(void){
    int N;
    cin >> N;
    pair<int,pair<string,int>> SP[110]; // no , name, point
    for(int i=1;i <= N ;i++){
        cin >> SP[i].second.first >> SP[i].second.second;
        SP[i].first =i;
    }
    
    qsort(SP+1,N,sizeof(pair<int,pair<string,int>>), [](const void* a, const void* b)
    {
        pair<int,pair<string,int>>* arg1 = (pair<int,pair<string,int>>*)(a);
        pair<int,pair<string,int>>* arg2 = (pair<int,pair<string,int>>*)(b);
        // name
        if(arg1->second.first < arg2->second.first) return -1;
        if(arg1->second.first > arg2->second.first) return 1;
        // point
        if(arg1->second.second > arg2->second.second) return -1;
        if(arg1->second.second < arg2->second.second) return 1;        
        
        return 0;
    });
    
    
    for(int i=1;i<=N;i++){
        cout << SP[i].first<< endl;
    }
    
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {

    public static void main(String[] args) {
	    // write your code here
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();

        int gap = a - 2 * b;

        // 出力
        System.out.println(Math.max(gap, 0));
    }
}

Measured memory_bytes: 22612
x = int(input())
a = x // 105
b = x // 100
ans = 0
for i in range(a, b+1):
  s = x - i * 100
  t = s // 5
  if not s % 5 == 0:
    t = t + 1
  if t <= i:
    ans = 1
    break
print(ans)

Measured memory_bytes: 2940
n, k, q = list(map(int,input().split()))

point = [0]*n
seikai = [0]*n

for i in range(q):
    a = int(input())
    seikai[a-1] += 1
    
for i in range(n):
    point[i] = k - q + seikai[i] 
    if point[i] > 0:
        print("Yes")
    else:
        print("No")
        

Measured memory_bytes: 8520
#!/usr/bin/env python3

def solve(N: int):
    ans = 0
    for i in range(1, N):
        if N % i == 0:
            ans += (N / i) -1
        else:
            ans += (N // i)
    print(int(ans))

    return


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    N = int(input())
    solve(N)

if __name__ == '__main__':
    main()


Measured memory_bytes: 63204
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int a[100],n,i,s=0,c=1;
	scanf("%d",&n);
	scanf("%d",&a[0]);
	for(i=1;i<n;i++)
	{
		scanf("%d",&a[i]);
		if(a[i]==a[i-1])
			c++;
		else
		{
			s+=c/2;
			c=1;
		}
	}
	s+=c/2;
	printf("%d",s);
	return 0;
}

Measured memory_bytes: 256
import java.io.*;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.*;

public class Main {
    static Input in = new Input(System.in);
    static PrintWriter out = new PrintWriter(System.out);

    static class Node {
        int num;
        Set<Node> info = new HashSet<>();
        Node(int num) {
            this.num = num;
        }
    }

    public static void main(String[] args) {
        int N = in.nextInt();
        int M = in.nextInt();
        List<Node> nodes = new ArrayList<>();
        for (int n = 0; n < N; n++)
            nodes.add(new Node(n));
        for (int m = 0; m < M; m++) {
            int A = in.nextInt() - 1;
            int B = in.nextInt() - 1;
            nodes.get(A).info.add(nodes.get(B));
            nodes.get(B).info.add(nodes.get(A));
        }
        boolean[] b = new boolean[N];
        int ans = 0;
        for (int n = 0; n < N; n++) {
            if (b[n]) continue;
            int count = 0;
            Deque<Integer> deque = new ArrayDeque<>();
            deque.add(n);
            b[n] = true;
            count++;
            while (!deque.isEmpty()) {
                int i = deque.poll();
                for (Node j : nodes.get(i).info) if (!b[j.num]) {
                    deque.add(j.num);
                    b[j.num] = true;
                    count++;
                }
            }
            ans = Math.max(ans, count);
        }
        out.println(ans);

        out.flush();
    }

    static class Input {
        private BufferedReader br;
        private String[] buff;
        private int index = 0;

        Input(InputStream is) {
            br = new BufferedReader(new InputStreamReader(is));
        }
        String nextLine() {
            try {
                return br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return null;
        }
        String next() {
            while (buff == null || index >= buff.length) {
                buff = nextLine().split(" ");
                index = 0;
            }
            return buff[index++];
        }
        byte nextByte() {
            return Byte.parseByte(next());
        }
        short nextShort() {
            return Short.parseShort(next());
        }
        int nextInt() {
            return Integer.parseInt(next());
        }
        long nextLong() {
            return Long.parseLong(next());
        }
        float nextFloat() {
            return Float.parseFloat(next());
        }
        double nextDouble() {
            return Double.parseDouble(next());
        }
        BigInteger nextBigInteger() {
            return new BigInteger(next());
        }
        BigDecimal nextBigDecimal() {
            return new BigDecimal(next());
        }
    }
}


Measured memory_bytes: 109980
n, k = map(int, input().split())
def Base_10_to_n(X, n):
    if (int(X/n)):
        return Base_10_to_n(int(X/n), n)+str(X%n)
    return str(X%n)
ans = len(Base_10_to_n(n, k))
print(ans)

Measured memory_bytes: 2940
#include<vector>
#include<cmath>
#include<map>
#include<cstdlib>
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<set>
#include<stack>
#include<bitset>
#include<functional>
#include<ctime>
#include<queue>
#include<deque>
#include<complex>
#include<cassert>
using namespace std;
#define pb push_back
#define pf push_front
typedef long long lint;
typedef complex<double> P;
#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
//問題文および制約はちゃんと確認しよう！
//サイズは10^5じゃなくて2×10^5とかかもしれないし、重要な制約・条件を見落としているかも
//とりあえずサンプルを読んでから解法を考えよう？
int main()
{
	int a,p;cin>>a>>p;
	cout<<(a*3+p)/2<<endl;
}


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

using namespace std;



int main(void) {
    long long int H, W, K;
    cin >> H >> W >> K;
    if(W == 1) {
        cout << 1 << endl;
    } else {
        constexpr long long int mod = 1'000'000'007;
        vector<long long int> tmp = {1, 1, 2, 3, 5, 8, 13, 21, 34};
        vector< vector<long long int> > dp(W+2, vector<long long int>(H+1));
        dp[1][0] = 1;
        for(int i=1; i<=H; i++) {
            for(int j=1; j<=W; j++) {
                dp[j][i] = (dp[j-1][i-1]*tmp[j-2]*tmp[W-j] + dp[j][i-1]*tmp[j-1]*tmp[W-j] + dp[j+1][i-1]*tmp[j-1]*tmp[W-j-1]) % mod;
            }
        }
        cout << dp[K][H] << endl;
    }
    return 0;
}


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

using namespace std;

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

    int N;
    cin >> N;
    long long ans = 0;
    unordered_map<string, long long> uo_mp;
    for (int i = 0; i < N; ++i) {
        string s;
        cin >> s;
        sort(s.begin(), s.end());
        if (uo_mp.count(s) == 0) uo_mp[s] = 1;
        else ++uo_mp[s];
    }
    for (auto itr = uo_mp.begin(); itr != uo_mp.end(); ++itr) {
        long long value = itr->second;
        ans += value * (value - 1) / 2;
    }
    cout << ans << '\n';
}

Measured memory_bytes: 10660
#include <iostream>
#include <vector>
using namespace std;
int main(int argc, const char *argv[])
{
    int n, k, x;
    cin >> n >> k;
    bool a[10] = {};
    for (int i = 0; i < k; i++)
    {
        cin >> x;
        a[x] = true;
    }

    int ans;
    for (int i = n;; i++)
    {
        string s = to_string(i);
        bool flag = true;
        for (int j = 0; j < s.length() && flag; j++)
        {
            for (int k = 0; k < 10 && flag; k++)
            {
                if (a[k] == true && s[j] == k + '0')
                {
                    flag = false;
                }
            }
        }
        if (flag)
        {
            ans = i;
            break;
        }
    }

    cout << ans << endl;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayDeque;
import java.util.Deque;

class Main{
    public static void main(String[] args) throws IOException{
        final PrintWriter out = new PrintWriter(System.out);
        final BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        final Deque<Integer> g = new ArrayDeque<Integer>();
        final Deque<lake> lakes = new ArrayDeque<lake>();
        final String in = br.readLine();
        for(int i = 0; i<in.length(); i++){
            if(in.charAt(i)=='\\'){
                g.addLast(i);
            }else if(in.charAt(i)=='/'){
                if(!g.isEmpty()){
                    final int left = g.pollLast();
                    int area = i-left;
                    while(!lakes.isEmpty()&&left<lakes.peekLast().getLeft()){
                        area += lakes.pollLast().getArea();
                    }
                    lakes.addLast(new lake(left, area));
                }
            }
        }
        int sum = 0;
        for(final lake e:lakes){
            sum += e.getArea();
        }
        out.println(sum);
        out.print(lakes.size());
        for(final lake e:lakes){
            out.print(' ');
            out.print(e.getArea());
        }
        out.println();
        out.flush();
    }
}

class lake{
    private final int area;
    private final int left;
    public lake(int left, int area){
        this.area = area;
        this.left = left;
    }
    final public int getArea(){
        return area;
    }
    final public int getLeft(){
        return left;
    }
}

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

static const int N = 100;

int main(){
    int n, p[N+1], m[N+1][N+1];
    cin >> n;
    for (int i = 1; i <= n; i++){
        cin >> p[i-1] >> p[i];
    }
    
    for (int i = 1; i <= n; i++) m[i][i] = 0;
    for (int l = 2; l <= n; l++){
        for (int i = 1; i <= n - l + 1; i++ ){
            int j = i + l -1;
            m[i][j] = (1 << 22);
            for (int k = i; k <= j - 1; k++){
                m[i][j] = min(m[i][j], m[i][k] + m[k+1][j] + p[i-1]*p[k]*p[j]);
            }
        }
    }
    cout << m[1][n] <<endl;
    
    return 0;
}


Measured memory_bytes: 3120
s = int,input()
i = list(map(int,input().split()))
err = 0
total = 0

while err == 0:
    count = 0
    for nom in i:
        if nom % 2 == 1:
            err = 1
            count += 1
        else:
            i[count] = nom / 2
            count += 1
    if err == 0:
        total += 1

print(total)

Measured memory_bytes: 3064
/*----------------by syr----------------*/
/*
  -----  -----  -----
  |   |  |---|    _/
  |   |  | \_    /
  -----  |   \  -----

  |---\  \   /  |\  /|
  |   |   \_/   | \/ |
  |   |   / \   |    |
  |---/  /   \  |    |
*/
#include<algorithm>
#include<bitset>
#include<cctype>
#include<cstring>
#include<cstdlib>
#include<deque>
#include<fstream>
#include<functional>
#include<iomanip>
#include<iostream>
#include<iterator>
#include<limits>
#include<list>
#include<map>
#include<math.h>
#include<queue>
#include<set>
#include<stack>
#include<stdio.h>
#include<sstream>
#include<string>
#include<time.h>
#include<utility>
#include<vector>

#define PH push
#define MP make_pair
#define PB push_back
#define fst first
#define snd second
#define FOR(i,x,y) for(int i=(x);i<(y);++i)
#define REP(i,x,y) for(int i=(x);i<=(y);++i)
#define x2 x123456789
#define y2 y123456789

using namespace std;

typedef double db;
typedef long long ll;
typedef long double ldb;
typedef pair<int,int> pii;

const int INF=1e9+7;
const int maxn=1e5+5;

int n,k;
int l[maxn],r[maxn],a[maxn];
bool ans;
vector<int> g[maxn];

void dfs(int u,int p){
	if(a[u]!=-1) l[u]=r[u]=a[u];
	else l[u]=-INF-1,r[u]=INF+1;
	FOR(i,0,g[u].size()){
		int v=g[u][i];
		if(v==p) continue;
		dfs(v,u);
		if(l[v]<-INF/2) continue;
		if(l[u]<-INF/2){
			l[u]=l[v]-1;r[u]=r[v]+1;
		}else{
			if((abs(l[u])&1)==(abs(l[v])&1)){
				ans=false;
				return;
			}
			l[u]=max(l[u],l[v]-1);
			r[u]=min(r[u],r[v]+1);
		}
	}
	if(l[u]>r[u]) ans=false;
	return;
}

void solve(int u,int p){
	if(u==0&&a[u]==-1) a[u]=l[u];
	FOR(i,0,g[u].size()){
		int v=g[u][i];
		if(v==p) continue;
		if(a[v]==-1){
			if(l[v]<=a[u]-1&&r[v]>=a[u]-1) a[v]=a[u]-1;
			else a[v]=a[u]+1;
		}
		solve(v,u);
	}
	return;
}

int main(){
	scanf("%d",&n);
	FOR(i,0,n-1){
		int u,v;
		scanf("%d%d",&u,&v);
		--u;--v;
		g[u].PB(v);
		g[v].PB(u);
	}
	scanf("%d",&k);
	memset(a,-1,sizeof(a));
	FOR(i,0,k){
		int v,p;
		scanf("%d%d",&v,&p);
		--v;
		a[v]=p;
	}
	ans=true;
	dfs(0,-1);
	if(!ans){
		puts("No");
		return 0;
	}
	puts("Yes");
	solve(0,-1);
	FOR(i,0,n) printf("%d\n",a[i]);
	puts("");
	return 0;
}

Measured memory_bytes: 13824
#include <stdio.h>

int main(void){
	int a, b, c, d, e;
	int x;
	
	scanf("%d%d%d%d%d", &a, &b, &c, &d, &e);

	x = 0;

	if (a < 0) {
		x = -a * c + d + b * e;
	} else {
		x = e * (b - a);
	}

	printf("%d\n", x);
	return 0;
}

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

int main(void){
    int n;
    cin >> n;
    ll a = 2;
    ll b = 1;
    for(int i=1;i<n;i++){
        ll tmp = b;
        b = a + b;
        a = tmp;
    }
    cout << b << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <random>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <numeric>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <sstream>
#include <bitset>
#include <cassert>
#include <fstream>
#include <queue>

#define len(X) ((int)(X).size())

#ifdef __LOCAL
	#define DBG(X) cout << #X << "=" << (X) << '\n';
	#define SAY(X) cout << (X) << '\n';
#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>;

const int INT_INF = (int)(2e9);
const ll  LL_INF  = (ll)(2e18);

const int NIL = -1;
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> inline T sign(T x) { return T(x > 0) - T(x < 0); }
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> inline ostream& operator<<(ostream& os, const vector<T>& v) { for(auto el: v) cout << el << " "; return os; }
template<typename T> inline T fetch() { T ret; cin >> ret; return ret; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for(auto& elem: ret) cin >> elem; return ret; }

void solve() {
	int n = fetch<int>();

	for(int x = 0; x <= n; ++x) {
		int n2 = (108 * x) / 100;

		if(n2 == n) {
			cout << x << '\n';
			return;
		}
	}

	cout << ":(\n";
}

int main() {
	fast_io();
	solve();

	return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int P = sc.nextInt();
		int pie = 0;
		
		A = 3 * A;
		P = P + A;
		pie = P / 2;
		
		System.out.println(pie);
	}
}

Measured memory_bytes: 21204
#include <algorithm>
#include <iostream>
#include <numeric>
#include <queue>

using namespace std;

using ll = long long;
const ll INF = 1LL << 40;

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

    vector<vector<ll>> S(N);
    for (int i = 0; i < N; i++) {
        ll t, d;
        cin >> t >> d;
        S[t - 1].push_back(d);
    }

    for (auto &s : S) {
        sort(begin(s), end(s), greater<ll>());
        if (s.empty()) {
            s.push_back(-INF);
        }
    }

    sort(begin(S), end(S),
         [&](vector<ll> a, vector<ll> b) { return a[0] > b[0]; });

    ll cur = 0;
    priority_queue<ll> Q;
    for (int i = 0; i < K; i++) {
        cur += S[i][0];
        for (int j = 1; j < S[i].size(); j++) {
            Q.push(S[i][j]);
        }
    }
    for (int i = K; i < N; i++) {
        for (int j = 0; j < S[i].size(); j++) {
            Q.push(S[i][j]);
        }
    }

    ll res = cur + K * K;
    for (ll x = K - 1; x >= 1; x--) {
        ll v = S[x][0];
        ll w = Q.top();

        if (v < w) {
            Q.pop();
            cur += w;

            Q.push(v);
            cur -= v;
        }

        res = max(res, cur + x * x);
    }

    cout << res << '\n';
}


Measured memory_bytes: 8696
n = int(input())
line = input().split(" ")
a = list(map(int, line))
line = input().split(" ")
b = list(map(int, line))
ans = 0
for i in range(0, len(a)):
    if ans < sum(a[0:i+1]) + sum(b[i:n]):
        ans = sum(a[0:i+1]) + sum(b[i:n])
print(ans)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
using db = double;
using pii = pair < int, int >;
using pll = pair < ll, ll >;
const int N = 2e5 + 10;
const ll inf = 1e15 + 42;
#define endl "\n"
const ll mod = 1000000007;
 
void testCase() {
    ll n;
    cin >> n;
    ll sum = 0;
    for (int i=1; i<=n; i++) {
        if (i%3==0 || i%5==0)
            continue;
        sum += i;
    }
    cout << sum << endl;
}
 
int main() {
    ios_base :: sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    testCase();
    return 0;
}

Measured memory_bytes: 3652
#include<bits/stdc++.h>
#define ll long long

using namespace std;

int main(int argc, char const *argv[]) {

    char c;
    cin>>c;

    if(c >= 'A' && c <= 'Z') std::cout << 'A' << '\n';
    else std::cout << 'a' << '\n';
    return 0;
}


Measured memory_bytes: 3620
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;

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

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

  int n; cin >> n;
  vector<int> a(n);
  map<int, int> mp;
  rep(i, n) {
    cin >> a[i];
    mp[a[i]]++;
  }

  int ans = 0, even = 0;
  for(auto e : mp) {
    if(e.second&1) ans++;
    else if(e.second != 0)even++;
  }
  if(even&1) ans--;
  cout << ans+even << '\n';
  return 0;
}


Measured memory_bytes: 5376
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
int main()
{
    int n,k;
    cin>>n>>k;
    int p[n];
    for(int i=0;i<n;i++) cin>>p[i];
    vector<int> sum(n);
    for(int i=0;i<n;i++)
    {
        sum[i]=(p[i]*(p[i]+1))/2;
    }
    double calc=0,ans=-1.00;;
    for(int i=0;i<=n-k;i++)
    {
        
        if(!i)
            {

             for(int j=0;j<k;j++)
             {
                calc+=((double)sum[i+j])/p[i+j];
               
             }
              ans=max(ans,calc);
             // cout<<calc<<endl;
            }
            else
            {
                calc+=((double)sum[i+k-1])/p[i+k-1];
               // calc+=sum[i+k];
               calc-=((double)sum[i-1])/p[i-1];
               // calc-=sum[i-1];
                ans=max(ans,calc);

            }

            

        }
        printf("%.7f",ans);
       // cout<<setprecision(7)<<ans<<endl;

    }




Measured memory_bytes: 1792
N = int(input())
S = input()

le, lw, re, rw = 0, 0, S.count('E'), S.count('W')
ret = float('inf')
for s in S :
    if s == 'E' :
        re -= 1
        ret = min(ret, lw + re)
        le += 1
    else :
        rw -= 1
        ret = min(ret, lw + re)
        lw += 1
print(ret)

Measured memory_bytes: 42464
#include <algorithm>
#include <cmath>
#include <complex>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>
#include <functional>
#include <cstring>
#include <regex>
#include <random>
#include <cassert>
#include <stack>
#include <climits>
using namespace std;

#pragma region

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, s, n) for (int i = (s); i < (int)(n); i++)
#define revrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define revrepr(i, s, n) for (int i = (n) - 1; i >= s; i--)
#define debug(x) cerr << #x << ": " << x << "\n"
#define popcnt(x) __builtin_popcount(x)

const double PI = acos(-1.0);

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

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

template<class T>
istream& operator >>(istream &is, vector<T> &v) {
    for (int i = 0; i < (int)v.size(); i++) cin >> v.at(i);
    return is;
}

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

template<class T>
void print(const vector<T> &v, const string &delimiter = " ") { rep(i, v.size()) cout << (0 < i ? delimiter : "") << v.at(i); cout << endl; }

template<class T>
void print(const vector<vector<T>> &vv, const string &delimiter) { for (const auto &v: vv) print(v, delimiter); }

#pragma endregion


int main() {
    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    cin >> a;
    repr(i, k, n) {
        if (a[i - k] < a[i]) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
}

Measured memory_bytes: 4048
#include <bits/stdc++.h>
#define fi first
#define se second
#define ll long long
using namespace std;

const int N=1e5+5;
bool f[N];

int main() {
	#ifdef kvutxdy
	freopen("C:/Users/khanh/OneDrive/RoadtoPurple/Code/Codeforces/input.in", "r", stdin);
	#endif
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	string x[4]={"dream","dreamer","erase","eraser"};
	string s;
	cin>>s;
	s='$'+s;
	int n=s.size();
	f[0]=true;
	for(int i=1;i<=n;++i){
		for(int j=0;j<4;++j) if(i>=(int)x[j].size()&&x[j]==s.substr(i-(int)x[j].size()+1,(int)x[j].size())){
			f[i]|=f[i-(int)x[j].size()];
		}
	}
	cout<<(f[n-1]?"YES\n":"NO\n");
}

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

int main() {
	int A, B;

	cin >> A >> B;

	int ans = 0;
	if(  A == 1 || B == 1 ) {
		if( A == 1 && B != 1 ) {
			ans = 1;
		}
		if( B == 1 && A != 1 ) {
			ans = -1;
		}
	}
	else {
		if( A > B ) {
			ans = 1;
		}
		else if( A < B ) {
			ans = -1;
		}
	}

	if( ans > 0 ) {
		cout << "Alice" << endl;
	}
	else if( ans < 0 ) {
		cout << "Bob" << endl;
	}
	else {
		cout << "Draw" << endl;
	}

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,x;cin >> n >> x;
  if(n==2){
    if(x==2){
      cout << "Yes" << endl;
      for(int i=1;i<=3;i++){
        cout << i << endl;
      }
    }
    else{
      cout << "No" << endl;
    }
    return 0;
  }
  if(x==1||x==2*n-1){
    cout << "No" << endl;
    return 0;
  }
  if(n==x){
    cout << "Yes" << endl;
    for(int i=1;i<=2*n-1;i++){
      cout << i << endl;
    }
    return 0;
  }
  int cnt=1;
  cout << "Yes" << endl;
  if(x!=2){
    for(int i=1;i<=2*n-1;i++){
      if(i<n-1){
        if(cnt==x-2){
          cnt+=4;
        }
        cout << cnt << endl;
        cnt++;
      }
      else if(i==n-1){
        cout << x-1 << endl;
      }
      else if(i==n){
        cout << x << endl;
      }
      else if(i==n+1){
        cout << x+1 << endl;
      }
      else if(i==n+2){
        cout << x-2 << endl;
      }
      else{
        if(cnt==x-2){
          cnt+=4;
        }
        cout << cnt << endl;
        cnt++;
      }
    }
    return 0;
  }
  for(int i=1;i<=2*n-1;i++){
    if(i<n-1){
      if(cnt==x-1){
        cnt+=4;
      }
      cout << cnt << endl;
      cnt++;
    }
    else if(i==n-1){
      cout << x+1 << endl;
    }
    else if(i==n){
      cout << x << endl;
    }
    else if(i==n+1){
      cout << x-1 << endl;
    }
    else if(i==n+2){
      cout << x+2 << endl;
    }
    else{
      if(cnt==x-1){
        cnt+=4;
      }
      cout << cnt << endl;
      cnt++;
    }
  }
}

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

signed main() {
  int N;
  cin >> N;
  vector<int> A(N);

  int S = 0;
  for( int i = 0; i < N; i++ ){
    cin >> A.at(i);
    S += A.at(i);
    if( i%2 == 1 ) S -= 2*A.at(i);
  }

  cout << S << endl;
  for( int i = 0; i < N-1; i++ ){
    cout <<(A.at(i) - S/2)*2 << endl;
    S = (A.at(i) - S/2)*2;
  }



}


Measured memory_bytes: 2048
n = [int(input()) for _ in range(5)]
first_digit = []
for num in n:
    z = int(str(num)[-1])
    if z > 0:
        first_digit.append(z)


# print(first_digit)
t = 0
for i in range(len(n)):
    t += -(-n[i] // 10) * 10
if len(first_digit) == 0:
    print(t)
else:
    print(t - (10 - min(first_digit)))


Measured memory_bytes: 3060
import java.util.*

class Scanner(`in`: java.io.InputStream) {
    private val reader = java.io.BufferedReader(java.io.InputStreamReader(`in`))
    private var tokenizer: StringTokenizer? = null

    fun next(): String {
        if (tokenizer?.hasMoreTokens() != true) {
            tokenizer = StringTokenizer(reader.readLine())
        }
        return tokenizer!!.nextToken()
    }

    fun nextLine(): String {
        return if (tokenizer?.hasMoreTokens() != true) {
            reader.readLine()
        } else tokenizer!!.nextToken("\n")
    }
}

fun main(args: Array<String>) {
    val pw = java.io.PrintWriter(System.out)
    Problem.solve(Scanner(System.`in`), pw)
    pw.flush()
}

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

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

object Problem {
    fun solve(sc: Scanner, pw: java.io.PrintWriter) {
        val N = sc.next().toLong()
        for (x in 1..3500) {
            for (y in 1..3500) {
                val n = N * x * y
                val d = 4 * x * y - N * x - N * y
                if (d > 0 && n % d == 0L) {
                    val z = n / d
                    pw.println("$x $y $z")
                    return
                }
            }
        }
    }
}


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

int main() {
  int N;
  cin >> N;
  int ans = 0;
  for (int i = 0; i < N; ++i) {
    int l, r;
    cin >> l >> r;
    ans += r - l + 1;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256