akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;
using LL = long long;

const int MOD = 1e9+7;

class Edge{
public:
    LL from,to, value;
    Edge(int f,int t, int c){
        from = f;
        to = t;
        value = c;
    }
};

int main(){
    int N;cin >> N;
    vector<vector<LL>> dist;
    LL ans = 0;
    for(int i = 0;i < N;i++){
        vector<LL> uku;
        for(int j = 0;j < N;j++){
            LL c;cin >> c;
            ans += c;
            uku.push_back(c);
        }
        dist.push_back(uku);
    }
    vector<vector<LL>> origin = dist;
    vector<vector<int>> flag(N, vector<int>(N));
    for(int i = 0;i < N;i++){
        for(int j = 0;j < N;j++){
            for(int k = 0;k < N;k++){
                dist[j][k] = min(dist[j][k], dist[j][i] + dist[i][k]);
            }
        }
    }
    bool f = true;
    for(int i = 0;i < N;i++){
        for(int j = 0;j < N;j++){
            if(dist[i][j] != origin[i][j]){
                f =false;
            }
        }
    }
    if(!f){
        cout<<-1<<endl;
        return 0;
    }
    for(int i = 0;i < N;i++){
        for(int j = 0;j < N;j++){
            bool f = true;
            for(int k = 0;k < N;k++){
                if(i == k || j == k)continue;
                if(dist[i][k] + dist[k][j] == dist[i][j]){
                    f = false;
                }
            }
            if(!f)ans -= dist[i][j];
        }
    }
    cout<<ans/2<<endl;
}


Measured memory_bytes: 2048
#include <iostream>
#include <math.h>
#include <string>
#include <time.h>
using namespace std;


int main()
{
	int x,a,b;
	cin >> x >> a >> b;
	if (abs(a - x) < abs(b - x))
		cout << "A";
	else cout << "B";

	
	return 0;
}

Measured memory_bytes: 256
import math

A, B, H, M = map(int, input().split())

#長針の角度
P = 30*H + 0.5*M

#短針の角度
Q = 6*M

#角度
S = abs(P-Q)

#Bの座標
xb, yb = B * math.cos(math.radians(S)), B * math.sin(math.radians(S))

#print(S)
if 0 <= S < 90:
    l = math.sqrt((A - xb)**2 + (yb)**2)
    
elif 90 <= S < 180:
    l = math.sqrt((A - xb)**2 + (yb)**2)
    
elif 180 <= S < 270:
    l = math.sqrt((A - xb)**2 + (yb)**2)
    
elif 270 <= S < 360:
    l = math.sqrt((A - xb)**2 + (yb)**2)
print(l)

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

int main () {
    int N; cin >> N;
    map<string, int> S;
    for (int i = 0; i < N; i++) {
        string s; cin >> s;
        S[s]++;
    }
    int m = 0;
    for (auto x: S) {
        m = max(x.second, m);
    }
    vector<string> lst;
    for (auto x: S) {
        if (x.second == m) {
            lst.push_back(x.first);
        }
    }
    sort(lst.begin(), lst.end());
    for (auto x: lst) {
        cout << x << endl;
    }
}


Measured memory_bytes: 26868
/*
 * じょえチャンネル
 * 高評価・チャンネル登録よろしくおねがいします！
 * https://www.youtube.com/channel/UCRXsI3FL_kvaVL9zoolBfbQ
 */
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define all(v) v.begin(),v.end()
#define inf (int)(3e18)
#define P pair<int,int>
#define mod (int)(1e9+7)
template<class T> inline void chmin(T &a, T b) {
	a = min(a, b);
}
template<class T> inline void chmax(T &a, T b) {
	a = max(a, b);
}


signed main() {
	int a,b,c;cin>>a>>b>>c;
	if(c-a-b<0){
		cout<<"No"<<endl;
	}else {
		if(4*a*b<(c-a-b)*(c-a-b))cout<<"Yes"<<endl;
		else cout<<"No"<<endl;
	}
}


Measured memory_bytes: 256
def possible(x):
    global k
    cnt = 0
    for i in a:
        if i % x == 0:
            cnt += i // x - 1
        else:
            cnt += i // x

    if cnt <= k:
        return True
    return False

n, k = map(int, input().split())

a = list(map(int, input().split()))

mini = 1
maxi = max(a)

while mini <= maxi:
    mid = (mini + maxi) // 2
    res = possible(mid)
    if res:
        maxi = mid
    else:
        mini = mid
    # print(mini, mid, maxi)

    if mini+1 >= maxi:
        if maxi < mini:
            mini, maxi = maxi, mini
        if possible(mini):
            ans = mini
        else:
            ans = maxi
        break

print(ans)
# print(possible(4))



Measured memory_bytes: 104236
#include<bits/stdc++.h>
#define int long long
#define ld long double
#define endl '\n'
const int mod=1e9+7;
const int inf=1e17+10;
#define F first
#define S second
#define pb push_back
#define all(x) x.begin(),x.end()
#define si(a) a.size()
#define pii pair<int,int>
using namespace std;
//#if !defined(ONLINE_JUDGE)
//#include "debugging.h"
//#endif



int32_t main() {
   std::ios::sync_with_stdio(false);cin.tie(NULL);
   string s;
   cin>>s;
   int qr,r=0;
   cin>>qr;
   deque<char>q;
   char c;
   for(char c:s)
   {
	   q.pb(c);
   }
   while(qr--)
   {
	   int t;
	   cin>>t;
	   if(t==1)
	   {
		   r^=1;
	   }
	   else
	   {
		   cin>>t>>c;
		   if(t==1)
		   {
			  if(!r)q.push_front(c);
			  else q.push_back(c); 
		   }
		   else
		   {
			   if(!r)q.push_back(c);
			   else q.push_front(c);
		   }
	   }
   }
   while(r==0 && !q.empty())
   {
	   cout<<q.front();
	   q.pop_front();
   }
   while(r==1 && !q.empty())
   {
	   cout<<q.back();
	   q.pop_back();
   }
   return 0;
}


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

int main(){
   int a, b;
   cin >> a >> b;
   int64_t c = 0, d = 0;
   if(a > b){
       c = a;
       d = b;
   }
   else{
       c = b;
       d = a;
   }
   int i;
   int e = c;
   for(i = 0; i >= 0; i++){
        if(c % d == 0){
           cout << c << endl;
           return 0;
        }
        else{
            c += e;
        }
   }
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
using namespace std;
typedef long long int ll;

int main()
{
	int n, a, b;
  scanf("%d %d %d", &n, &a, &b);
  if(a%2==b%2){
    printf("Alice\n");
  }else{
    printf("Borys\n");
  }
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
    #define F first
    #define S second
    using ll = long long;
    const ll mod = 1000000007;
    const ll infi = 1000000000000000;
    const ll md = 998244353;
    using namespace std;
    using vl = vector<ll>;
    using pll =  pair<ll,ll>;
     
    int main() {
        int n,w;
        cin>>n>>w;
        vl a(n),v(n);
        for(int i=0;i<n;i++) {cin>>a[i]>>v[i];}
        vl wig(w+1,0);
        for(int i=0;i<n;i++){
            for(int j=w;j-a[i]>=0;j--){
                wig[j]=max(wig[j],wig[j-a[i]]+v[i]);
            }
        }
        ll ans=0;
        for(int i=0;i<=w;i++){ ans=max(ans,wig[i]);}
        cout<<ans;
        return 0;
    } 

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

int main() {
    int n, m;
    cin >> n >> m;
    vector<int> a(n);
    for (int i = 0; i < n; i++) cin >> a[i];
    
    int res = 0, sum = accumulate(a.begin(), a.end(), 0);
    
    for (int i = 0; i < n; i++) {
        res += (a[i] * 4 * m >= sum);
    }
    
    cout << (res >= m ? "Yes" : "No") << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(signed i=0;i<n;++i)
#define repi(n) rep(i,n)
#define repvin(n) vint a(n);rep(i,n)cin>>a[i];
#define int long long
#define str string
#define vint vector<int>
#define pint pair<int,int>
#define pb(a) push_back(a)
#define all(v) v.begin(),v.end()
#define yn(b) cout<<((b)?"Yes":"No")<<endl
#define YN(b) cout<<((b)?"YES":"NO")<<endl
#define call(a) for(auto t:a)cout<<t<<" ";cout<<endl
#define ENDL printf("\n");
#define debg(a) cout<<#a<<":"<<a<<endl;
#define SORT(a) sort(all(a));
#define INF 1LL<<60
#define out(i) cout<<i<<endl;
signed main(){
  int n;
  cin>>n;
  vint a(n),b;
  repi(n)cin>>a[i];
  if(n%2==0){
    for(int i=n-1;i>=0;i-=2)b.pb(a[i]);
    for(int i=0;i<n;i+=2)b.pb(a[i]);
  }
  else {
    for(int i=n-1;i>=0;i-=2)b.pb(a[i]);
    for(int i=1;i<n;i+=2)b.pb(a[i]);
  }
  //TLE
  /*rep(i,n){
    b.pb(a[i]);
    reverse(all(b));
    call(b);
  }*/
  call(b);
  return 0;
}


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

typedef long long ll;
typedef unsigned long long llu;

int main(int argc, char *argv[]) {
  ll n;
  cin >> n;

  vector<ll> bi(n);
  for (ll i = 0; i < n; ++i) {
    ll a;
    cin >> a;
    bi[i] = a - i;
  }

  sort(bi.begin(), bi.end());

  ll ans = 0;
  ll b = bi[n/2];
  for (ll i = 0; i < n; ++i) {
    ans += abs(bi[i] - b);
  }

  cout << ans << endl;

  return 0;
}

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

#define fi first
#define se second
#define eb emplace_back
#define FOR(i, a, b) for(int i = a; i < (int) b; i++)
#define FORD(i, a, b) for(int i = a; i >= (int) b; i--)

using namespace std;

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpii;
typedef vector<vi> vvi;
typedef vector<vpii> vvpii;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
typedef pair<i64, i64> pi64;
typedef vector<pi64> vpi64;

int main () {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int a, b;
  cin >> a >> b;
  b *= 2;
  cout << max (0, a - b) << '\n';
  return 0;
}

Measured memory_bytes: 256
#include <iomanip>
#include <iostream>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;

int main(void) {
  ios::sync_with_stdio(false);
  int N, K;
  cin >> N >> K;
  vector<int> snuke(N, 0);
  rep(i, K) {
    int d;
    cin >> d;
    rep(j, d) {
      int a;
      cin >> a;
      snuke[a - 1]++;
    }
  }
  int answer = 0;
  rep(i, N) {
    if (snuke[i] == 0) answer++;
  }
  cout << answer << endl;
  return 0;
}


Measured memory_bytes: 3644
import Data.List

main = do
  abc <- map read . words <$> getLine :: IO [Int]
  k <- read <$> getLine :: IO Int
  print $  solve abc k

solve abc k =
  ans
  where
    m = maximum abc
    rest = delete m abc
    m' = m*(2^k)
    ans = sum rest + m'
    
  


Measured memory_bytes: 508
#include <iostream>
#include <string>
#include <algorithm>
#define MAX 1e9
using namespace std;


int main()
{
int N;
int K;
char A[N],B[N];
cin>>N>>K;

for(int i=0;i<N;i++){
  cin>>A[i];
  if(i==K-1){
  if(A[K-1]=='A')B[K-1]='a';
  if(A[K-1]=='B')B[K-1]='b';
  if(A[K-1]=='C')B[K-1]='c';
}else{
  B[i]=A[i];
}
};
for(int i=0;i<N;i++)cout<<B[i];
//cout<<endl;
return 0;
}

Measured memory_bytes: 256
/*====Corycle====*/
#include<algorithm>
#include<iostream>
#include<iomanip>
#include<cstring>
#include<cstdlib>
#include<complex>
#include<cstdio>
#include<vector>
#include<cmath>
#include<ctime>
#include<stack>
#include<queue>
#include<map>
#define ll long long
using namespace std;
const int inf=0x3f3f3f3f;
const int Mod=1e9+7;
const int N=2e5+5;
int read(){
	int s=0,f=1;char c=getchar();
	while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}
	while(c>='0'&&c<='9'){s=s*10+c-'0';c=getchar();}
	return s*f;
}
int n,m;
int L[N],R[N],s[N],f[N],sum[N];
struct Node{int x,y;}a[N],P[N];
int mod(int x){return x>=Mod?x-Mod:x;}
bool cmp1(Node A,Node B){return A.y!=B.y?A.y<B.y:A.x<B.x;}
bool cmp2(Node A,Node B){return A.x!=B.x?A.x<B.x:A.y<B.y;}
int main(){
//	freopen("_.in","r",stdin);
//	freopen("_.out","w",stdout);
	n=read();
	for(int i=1;i<=n;i++){a[i].x=read();a[i].y=read();}
	sort(a+1,a+n+1,cmp1);
	s[0]=0;
	for(int i=1;i<=n;i++){
		int l=1,r=i;s[i]=max(s[i-1],a[i].x);
		while(l<=r){int mid=(l+r)>>1;if(s[mid]>=a[i].x){P[i].x=mid;r=mid-1;}else l=mid+1;}
	}
	s[n+1]=inf;
	for(int i=n;i>=1;i--){
		int l=i,r=n;s[i]=min(s[i+1],a[i].x);
		while(l<=r){int mid=(l+r)>>1;if(s[mid]<=a[i].x){P[i].y=mid;l=mid+1;}else r=mid-1;}
	}
	sort(P+1,P+n+1,cmp2);
	int j=0;f[0]=sum[0]=1;
	for(int i=1;i<=n;i++){
		while(P[j].y<P[i].x-1)j++;
		f[i]=mod(sum[i-1]-sum[j-1]+Mod);
		sum[i]=mod(sum[i-1]+f[i]);
	}
	cout<<endl;
	while(P[j].y<n)j++;
	printf("%d\n",mod(sum[n]-sum[j-1]+Mod));
	return 0;
}

Measured memory_bytes: 9140
#include <iostream>
#include <string>
#include <vector>
#include <map>
#define INF (2 << 28)
using namespace std;

map<string, int> item;
map<string, vector<string> > wr;
map<string, int> dp;

void init(){
  
  item.clear(); dp.clear();
  map<string, vector<string> >::iterator it;
  for(it = wr.begin(); it != wr.end(); it++){
    it->second.resize(0);
  }
  wr.clear();

}

int find(string s){
  
  int ret = 0;
  bool judge = false;
  if(dp[s]) return dp[s];
  map<string, vector<string> >::iterator it;
  for(it = wr.begin(); it != wr.end(); it++){
    if(it->first == s){
      for(int i = 0; i < it->second.size(); i++){
	ret += find(it->second[i]);
      }
      judge = true;
      break;
    }
  }
  return dp[s] = min((judge ? ret : INF), (item.find(s) == item.end() ? INF : item[s]));

}

int main(){
  
  int n, m; string trg;
  while(cin >> n, n){
    init();
    for(int i = 0; i < n; i++){
      string s; int v; cin >> s >> v;
      item[s] = v;
    }
    cin >> m;
    for(int i = 0; i < m; i++){
      string s; int v; cin >> s >> v;
      for(int j = 0; j < v; j++){
	string name; cin >> name;
	wr[s].push_back(name);
      }
    }
    cin >> trg;
    cout << find(trg) << endl;
  }

}

Measured memory_bytes: 1236
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <functional>
#include <math.h>
#include <stdlib.h>
#include <map>
#include <deque>
#include <list>
#include <sys/timeb.h>
#include <fstream>
#include <set>
#include <cmath>
#include <iomanip>

using namespace std;

#define repr(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repr(i,0,n)
#define reprrev(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define reprev(i,n) reprrev(i,0,n)
#define repi(itr,ds) for(auto itr=ds.begin();itr!=ds.end();itr++)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define mp make_pair
#define mt make_tuple
#define INF 1050000000
#define INFL 1100000000000000000LL
#define EPS (1e-10)
#define MOD 1000000007
#define PI 3.1415926536
#define RMAX 4294967295

typedef long long ll;
typedef pair<int, int> Pi;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<Pi> vPi;
typedef vector<vector<int> > vvi;
typedef vector<vector<bool> > vvb;
typedef vector<vector<ll> > vvll;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<double> > vvd;
typedef vector<vector<Pi> > vvPi;
typedef priority_queue<int, vector<int>, greater<int> > pqli;
typedef priority_queue<ll, vector<ll>, greater<ll> > pqlll;
typedef priority_queue<Pi, vector<Pi>, greater<Pi> > pqlP;
struct Edge {
	int from, to, cost;
	bool operator<(Edge e) {
		return cost < e.cost;
	}
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;
template <class T>
using vec = vector<T>;
template<class T>
using pql = priority_queue<T, vector<T>, greater<T>>;
string debug_show(Pi a) {
	return "(" + to_string(a.first) + "," + to_string(a.second) + ")";
}

template<class T>
struct augEdge {
	T from, to;
	int cost;
	bool operator<(augEdge e) { return cost < e.cost; }
	bool operator>(augEdge e) { return cost > e.cost; }
};
template<class T>
using augGraph = vector<augEdge<T>>;


bool pairCompare(const Pi& firstElof, const Pi& secondElof)
{
	return firstElof.second > secondElof.second;
}

ll gcd(ll a, ll b) {
	ll temp;
	while (a % b != 0)
	{
		temp = b;
		b = a % b;
		a = temp;
	}
	return b;
}

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

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

	int n;
	cin >> n;
	map<int, int> d;
	rep(i, n) {
		int t;
		cin >> t;
		d[t]++;
	}
	int cnt = 0;
	int ans = 0;
	rep(i, 100000) {
		cnt += d[i];
		if (cnt == n / 2) {
			ans++;
		}
	}
	cout << ans << endl;

	return 0;
}



Measured memory_bytes: 4992
#include <iostream>
#include <vector>
#include <cstdio>
#include <algorithm>
#include <map>
#include <queue>
#define rep(i,n) for(int i = 0; i < n; i++)
#define INF 1000000000
#define MOD 1000000007
#define ll long long
using namespace std;
int n;
int a[100000];
map<int,vector<int>> child;
int solve(int x){
    vector<int> ht;
    for (auto c:child[x]){
        ht.push_back(solve(c));
    }
    sort(ht.begin(),ht.end(),std::greater<int>());
    int cnt=1,ret=1;
    for (auto h:ht){
        ret=max(ret,cnt+h);
        cnt+=1;
    }
    return ret;
}
int main(){
    cin>>n;
    rep(i,n-1) cin>>a[i];
    rep(i,n-1) child[a[i]-1].push_back(i+1);
    cout<<solve(0)-1<<endl;
    return 0;
}

Measured memory_bytes: 19328
package main

import (
	"fmt"
)

func main() {
	for {

		var str string
		var n int

		fmt.Scan(&str)
		fmt.Scan(&n)
		if str == "-" {
			break
		}
		for i := 0; i < n; i++ {
			var m int
			fmt.Scan(&m)
			str = shuffle(str, m)
		}
		fmt.Println(str)
	}
}

func shuffle(str string, num int) string {
	return str[num:] + str[0:num]
}



Measured memory_bytes: 1140
#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 <climits>
#include <cstring>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define all(c) begin(c),end(c)

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

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

typedef long long int ll;
using ll = long long int;
using ull = long long unsigned int;
using Int = long long int;
using namespace std;
#define INF (1 << 30) - 1
#define INFl (ll)5e15
#define DEBUG 0
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007


//edit
class Solve {
public:
    void solve() {
        Int N, K;
        cin >> N >> K;
        int ans = 0;
        for (int i = 0; i < N; ++i) {
            Int tmp;
            cin >> tmp;
            if (tmp >= K) ans++;
        }
        cout << ans << endl;
    }
};


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

    Solve().solve();


    return 0;
}


Measured memory_bytes: 888
n,m,k = map(int,input().split())
a = [0] + list(map(int,input().split()))
b = [0] + list(map(int,input().split()))

x = 0
for i in range(1,n+1) :
    a[i] = a[i-1] + a[i]
    if a[i] <= k :
        x = i

y = 0
for j in range(1,m+1) :
    b[j] = b[j-1] + b[j]
    if b[j] <= k-a[x] :
        y = j
        
cmax = x + y

while x>0 :
    x = x-1
    ynow = y
    for j in range(y,m+1) :
        if b[j] <= k - a[x] :
            ynow = j
        else :
            break
    if x + ynow > cmax :
        cmax = x + ynow
    y = ynow

print(cmax)

Measured memory_bytes: 41872
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <cmath>
#include <queue>
#include <iomanip>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int inf = 1<<30;
const int mod = 1e9+7;


int main() {
  int N; cin >> N;
  vector<int> A(N);
  set<int> st;
  for(int i = 0; i < N; i++) cin >> A[i], st.insert(A[i]);
  if(st.size() % 2 == 1) {
    cout << st.size() << endl;
  } else {
    cout << st.size() - 1 << endl;
  }

  return 0;
}



Measured memory_bytes: 5376
#include<iostream>
using namespace std;
int a, b, n;
int num = 0;
int main()
{
	int flag = 1;
	cin >> n;
	while (n--) {
		cin >> a >> b;
		if (a == b) {
			num += 1;
			if (num >= 3){
				flag = 0;
			}
		}
		else num = 0;
	}
	if (flag) cout << "No" << endl;
	else cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 3588
#include <bits/stdc++.h>
#define mod 998244353
#define db(a) cout << a << endl
#define db2(a,b) cout << a << " " << b << endl
#define dbp(a) cout << a.first << " " << a.second << endl
#define adb(a) for(auto i:a) cout << i << " "; cout << endl
#define adb2(a) for(auto i:a) cout << i.first << " " << i.second << endl;
#define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define N 100010
using namespace std;

long long fast_power(long long base, long long power, long long p)
{
    long long result = 1;
    while(power > 0)
    {
        if(power&1)
        {
            result = (result * base)%p;
        }
        base = (base * base)%p;
        power >>= 1;
    }
    return result;
}

int main()
{
    fastIO;
    int n, p;
    cin >> n >> p;

    string s;
    cin >> s;

    long long ans = 0, i;
    
    if(p == 2 || p == 5)
    {
        for(i=0;i<n;i++) 
        {
            if((s[i]-'0')%p == 0) ans += (i+1);
        }
    }
    else
    {
        long long rem[p] = {0}, currem = 0;
        rem[0] = 1;
        for(i=n-1;i>=0;i--)
        {
            currem = (currem + (s[i]-'0')*fast_power(10, n-i-1, p))%p;
            rem[currem]++;
        }

        for(i=0;i<p;i++) ans += (rem[i]*(rem[i]-1))/2;
    }

    cout << ans << endl;
}

Measured memory_bytes: 720
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
const int N=100050;
int a[N],b[N],c[N],n,id[N];
struct Frac
{
	ll p,q;
	Frac(){}
	Frac(ll a, ll b){ p=a,q=b;}
	Frac operator + (Frac b){ return Frac(q*b.p+p*b.q,q*b.q);}
	bool operator < (Frac b){ return p*b.q<b.p*q;}
} ans[N];
int rev[N];
int main()
{
	scanf("%i",&n);
	ll sum=0;
	for(int i=1;i<=n;i++) scanf("%i %i",&a[i],&b[i]),c[i]=max(b[i],a[i]),sum+=a[i],id[i]=i;
	sort(id+1,id+1+n,[&](int i, int j){ return c[i]>c[j];});
	for(int i=1;i<=n;i++) rev[id[i]]=i;
	int ptr=0;
	while(ptr<n && sum-c[id[ptr+1]]>0) ptr++,sum-=c[id[ptr]];
	if(ptr==n || ptr==n-1 && sum==c[id[n]]) return 0*printf("0 1\n");
	ll lo=0,hi=0;
	for(int i=1;i<=ptr;i++) lo+=c[id[i]];
	hi=lo;
	hi+=c[id[ptr+1]];
	Frac best;
	//printf("ptr:%i\n",ptr);
	sum=0;
	for(int i=1;i<=n;i++) sum+=a[i];
	for(int i=1;i<=n;i++)
	{
		int B=b[i];
		ll tmp;
		if(rev[i]<=ptr) tmp=hi-c[i];
		else tmp=lo;
		ll ost=sum-tmp;
		//printf("%i %lld\n",i,ost);
		ans[i]=Frac(ost,b[i]);
		if(i==1 || ans[i]<best) best=ans[i];
	}
	best.q*=n;
	Frac add(ptr,n);
	Frac out=best+add;
	out.p=out.q-out.p;
	ll g=__gcd(out.p,out.q);
	out.p/=g;
	out.q/=g;
	printf("%lld %lld\n",out.p,out.q);
	return 0;
}

Measured memory_bytes: 3712
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <functional>

using namespace std;

int main()
{
	int train;
	stack<int> rail;

	while ( cin >> train )
	{
		if ( train == 0 )
		{
			train = rail.top();
			rail.pop();
			cout << train << endl;
		}
		else
		{
			rail.push( train );
		}
	}

	return 0;
}

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

int main(void)
{
    string s;
    int cost = 700;

    cin >> s;

    if(s[0] == 'o') cost +=100;
    if(s[1] == 'o') cost +=100;
    if(s[2] == 'o') cost +=100;

    cout << cost <<endl;

    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;

#define INF 0x33433433

int len1;
int len2;
char s1[1001];
char s2[1001];
int dp[1001][1001];

int main() {
    scanf("%s", s1);
    scanf("%s", s2);
    len1 = strlen(s1);
    len2 = strlen(s2);

    for (int i=0; i<=len1; i++) {
        for (int j=0; j<=len2; j++) {
            dp[i][j] = INF;
        }
    }

    for (int i=0; i<=len1; i++) {
        dp[i][0] = i;
    }

    for (int i=0; i<=len2; i++) {
        dp[0][i] = i;
    }

    for (int i=1; i<=len1; i++) {
        for (int j=1; j<=len2; j++) {
            int a = 1;
            if (s1[i-1] == s2[j-1]) a = 0;
            
            dp[i][j] = min(dp[i][j], dp[i-1][j]+1);
            dp[i][j] = min(dp[i][j], dp[i][j-1]+1);
            dp[i][j] = min(dp[i][j], dp[i-1][j-1] + a);
        }
    }

    printf("%d\n", dp[len1][len2]);
}

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

int a[100000];
int n;

ll solve(int tmp, ll cnt) {
  for (int i = 1; i < n; ++i) {
    int prev = tmp;
    tmp += a[i];
    if (prev > 0 && tmp >= 0) {
      cnt += tmp+1;
      tmp = -1;
    }
	else if (prev < 0 && tmp <= 0) {
      cnt += abs(tmp) + 1;
      tmp = 1;
    }
  }
  return cnt;
}

int main() {
  cin >> n;
  rep(i, n) cin >> a[i];
  ll ans;
  if (a[0] == 0) ans = min(solve(1,1), solve(-1,1));
  else if (a[0] > 0) ans = min(solve(a[0],0), solve(-1, a[0]+1));
  else ans = min(solve(a[0],0), solve(1, -a[0]+1));
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define rep(i,n) for(int i=0;i<n;i++)
long long int p(vector<long long int>&a,int s,int e,vector<vector<long long int>>&dp)
{
    if(s>e)
    return 0;
    if(s==e)
    return dp[s][e]=a[s];
    if(e-s==1)
    return dp[s][e]=max(a[s],a[e]);
    if(dp[s][e]!=-1)
    return dp[s][e]; 
    long long int b=a[s]+min(p(a,s+2,e,dp),p(a,s+1,e-1,dp));
    long long int c=a[e]+min(p(a,s,e-2,dp),p(a,s+1,e-1,dp));
    return dp[s][e]=max(b,c);
}
int main() {
	int n;
	cin>>n;
	long long int t=0;
	vector<long long int>nums(n);
	rep(i,n)
	{
	    cin>>nums[i];
	    t+=nums[i];
	}
	vector<vector<long long int>>dp(n,vector<long long int>(n,-1));
 
	long long int r=p(nums,0,n-1,dp);
	cout<<r-(t-r);
	
	
}

Measured memory_bytes: 70912
import java.util.Scanner;
import java.lang.Math;
public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n=1,x=1;
        while(n != 0 || x != 0){
            n = sc.nextInt();
            x = sc.nextInt();
            if(n == 0 && x == 0) break;
            int count = 0;
            for (int i=0; i<(Math.pow(2,10)); i++) {
                int cnt = 0,cn = 0;;
                for (int j=0; j<10; j++) {
                    if ((1&i>>j) == 1){
                        cnt += j;
                        cn++;
                    }
                }
                if(cnt == x && cn == n){
                    count++;
                }
                
            }
        System.out.println(count);
        }
        
        sc.close();
    }
}



Measured memory_bytes: 26388
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()
#define F first
#define S second
#define forn(i, n) for (int i = 0; i < (int)n; i++)
#define pb push_back
#define fastIO ios::sync_with_stdio(0), cin.tie(0);
#define endl '\n'
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int, int> pii;
int main() {
#ifdef LOCAL
    // freopen("in.txt", "r", stdin);
    // freopen("out.txt", "w", stdout);
#else
    fastIO;
#endif
    int x;
    cin >> x;
    int b = 1;
    int p = 2;
    int mx = 1;
    for (int i = 1; i <= 1000; i++) {
        for (int p = 2; p <= 10; p++) {
            int v = pow(i, p);
            if (v > mx && v <= x) {
                mx = v;
            }
        }
    }
    cout << mx << endl;
    return 0;
}

Measured memory_bytes: 384
package main

import "fmt"

func main() {
	var A, B int
	fmt.Scan(&A)
	fmt.Scan(&B)

	if A%3 == 0 || B%3 == 0 || (A+B)%3 == 0 {
		fmt.Println("Possible")
	} else {
		fmt.Println("Impossible")
	}
}


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

int main(){
  long long h, w;
  cin >> h >> w;
  if(h == 1 || w == 1){
    cout << 1 << endl;
    return 0;
  }
  if(h % 2 != 0 && w % 2 != 0){
    cout << h*w/2+1 << endl;
  }else{
    cout << h*w/2 << endl;
  }
  return 0;
}

Measured memory_bytes: 256
def traveling_budget(A: int, B: int, C: int, D: int)->int:
    return min(A, B) + min(C, D)


if __name__ == "__main__":
    A = int(input())
    B = int(input())
    C = int(input())
    D = int(input())
    ans = traveling_budget(A, B, C, D)
    print(ans)


Measured memory_bytes: 3060
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int q = sc.nextInt();
		char[] s = sc.next().toCharArray();
		int[] a = new int[n];
		for (int i = 1; i < n; i++) {
			if(s[i-1]=='A'&&s[i]=='C') a[i] += 1;
			a[i] += a[i-1];
		}
		int l = 0, r = 0;
		for (int i = 0; i < q; i++) {
			l = sc.nextInt()-1;
			r = sc.nextInt()-1;
			if(l == 0) {
				System.out.println(a[r]);
			}else {
				n = (s[l]=='C'&&s[l-1]=='A')?1:0;
				System.out.println(a[r]-a[l-1]-n);
			}
		}
		sc.close();
	}
}

Measured memory_bytes: 68240
#include <iostream>
#include <vector>
#include <algorithm>
int main(){
    using namespace std;
    int n,a,i;
    cin >> n;
    char b;
    vector<int> s;
    vector<int> h;
    vector<int> c;
    vector<int> d;
    for(i=0;i<13;i++){
        s.push_back(i+1);
        h.push_back(i+1);
        c.push_back(i+1);
        d.push_back(i+1);
    }
    vector<int> ss;
    vector<int> hh;
    vector<int> cc;
    vector<int> dd;
    for(i=0;i<n;i++){
        cin >> b >> a;
        if(b=='S'){
            ss.push_back(a);
        }
        if(b=='H'){
            hh.push_back(a);
        }
        if(b=='C'){
            cc.push_back(a);
        }
        if(b=='D'){
            dd.push_back(a);
        }
    }
    sort(ss.begin(),ss.end());
    sort(hh.begin(),hh.end());
    sort(cc.begin(),cc.end());
    sort(dd.begin(),dd.end());
    int xs,xh,xc,xd,ys,yh,yc,yd;
    xs = 0;
    xh = 0;
    xc = 0;
    xd = 0;
    ys = 1;
    yh = 1;
    yc = 1;
    yd = 1;
    int size_s = ss.size();
    int size_h = hh.size();
    int size_c = cc.size();
    int size_d = dd.size();
    for(i=0;i<13;i++){
        if(ss[xs]==ys){
            xs++;
            ys++;
        }else{
            cout << "S " << ys << endl;
            ys++;
        }
    }
    for(i=0;i<13;i++){
        if(hh[xh]==yh){
            xh++;
            yh++;
        }else{
            cout << "H " << yh << endl;
            yh++;
        }
    }
    for(i=0;i<13;i++){
        if(cc[xc]==yc){
            xc++;
            yc++;
        }else{
            cout << "C " << yc << endl;
            yc++;
        }
    }
    for(i=0;i<13;i++){
        if(dd[xd]==yd){
            xd++;
            yd++;
        }else{
            cout << "D " << yd << endl;
            yd++;
        }
    }
    return 0;
}

Measured memory_bytes: 3132
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
import java.util.stream.Collectors;
import java.util.stream.IntStream;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		List<Integer> list = IntStream.range(0, N).mapToObj(x -> sc.nextInt())
				.sorted((a, b) -> Integer.compare(b, a))
				.collect(Collectors.toCollection(ArrayList::new));
		int max=list.get(0);
		int min=list.get(list.size()-1);
		int sum=0;
		
		boolean firstOrnot=true;
		
		for (int i = min; i < max; i++) {
			int sumInter=0;
			for (int j = 0; j < list.size(); j++) {
				sumInter+=Math.pow(list.get(j)-i, 2);
			}
			if (firstOrnot) {
				firstOrnot=false;
				sum=sumInter;
			}else {
				if (sumInter<sum) {
					sum=sumInter;
				}
			}
		}
		
		System.out.println(sum);

	}

}


Measured memory_bytes: 16456
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;

class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        int[] merry = { 4, 1, 4, 1, 2, 1, 2, 1 };

        String line;
        String[] input;
        int[] customer = new int[8];

        while ((line = br.readLine()) != null) {
            input = line.split(" ");
            for (int i = 0; i < 8; i++) {
                customer[i] = Integer.parseInt(input[i]);
            }

            int answer = -1; // index
            int V = 0;
            int min = Integer.MAX_VALUE;
            int tens;

            for (int i = 0; i < 8; i++) {
                tens = 10000000;
                int score = 0;
                int tmpv = 0;
                for (int j = 0; j < 8; j++) {
                    score += Math.max(0, merry[(i + j) % 8] - customer[j]);
                    tmpv += tens * merry[(i + j) % 8];
                    tens /= 10;
                }
                if (min == score && tmpv < V) {
                    answer = i;
                    V = tmpv;
                    min = score; // do nothing. ritual
                } else if (score < min) {
                    answer = i;
                    V = tmpv;
                    min = score;
                }
            }

            for (int i = 0; i < 8; i++) {
                if (i == 0)
                    System.out.print(merry[answer]);
                else
                    System.out.print(" " + merry[(answer + i) % 8]);
            }
            System.out.println();
        }
    }
}


Measured memory_bytes: 25468
#include <iostream>
#include <stack>

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

    long long int n;
    std::stack<long long int> s;

    while (std::cin >> n) {
        if (n) {
            s.push(n);
        }
        else {
            std::cout << s.top() << std::endl;
            s.pop();
        }
    }

    return 0;
}

Measured memory_bytes: 1192
#include <stdio.h>

int main(){
 int i,j,h,w;
 while(1){
  scanf("%d %d",&h,&w);
  if(h==0 && w==0){
   break;
  }else{
   for(i=0;i<h;i++){
    for(j=0;j<w;j++){
     printf("#");
    }
    printf("\n");
   }
   printf("\n");
  }
 }
 return 0;
}

Measured memory_bytes: 572
X,Y = [int(zz) for zz in input().split()]

mod = 10**9+7
g1 = [1, 1]
g2 = [1, 1]
inverse = [0, 1]

def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

a = (2*Y-X)/3
b = (2*X-Y)/3

if a != int(a):
    print(0)
    exit()

a = int(a)
b = int(b)
N = a+b

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )

ans = cmb(N,a,mod)%(10**9+7)
print(int(ans))


Measured memory_bytes: 118764
#include <bits/stdc++.h>
using namespace std;
long long n,f[100005][4],a[100005][4],res;
main()
{
    cin>>n;
    for(int i=1; i<=n; i++)
        for(int j=1; j<=3; j++)
            cin>>f[i][j];
    for(int i=1; i<=n; i++)
        for(int j=1; j<=3; j++)
        {
            if(j==1)
            a[i][j]=max(a[i-1][2],a[i-1][3])+f[i][j];
            if(j==2)
            a[i][j]=max(a[i-1][1],a[i-1][3])+f[i][j];
            if(j==3)
            a[i][j]=max(a[i-1][2],a[i-1][1])+f[i][j];
            res=max(res,a[i][j]);
        }
        cout<<res;
}


Measured memory_bytes: 6528
import qualified Data.ByteString.Char8 as BS
import Data.Maybe
import Data.List

main :: IO ()
main = do
    n <- readLn :: IO Int
    a <- map (map (fst . fromJust . BS.readInt) . BS.words) . BS.lines <$> BS.getContents
    print . length . filter odd . map length . group . sort $ a

Measured memory_bytes: 31996
#include <bits/stdc++.h>
using namespace std;
const string c = "AB";
int cal(string &s){
    int ans = 0;
    for (int i = 0; i < s.size() - 1; i++){
        if (s[i] == c[0] && s[i + 1] == c[1])
            ans++;
    }
    return ans;
}
int a[10];
int main(){
    int n;
    cin >> n;
    string s;
    int ans = 0;

    for (int i = 0; i < n; i++){
         cin >> s;
         ans += cal(s);
         if (s[0] == 'B'){
              if (s[s.size() - 1] == 'A'){
                 a[0]++;
              }else {
                 a[1]++;
              }
         }else if (s[s.size() - 1] == 'A'){
               a[2]++;
         }
    }
    if (a[1] > 0  && a[2] > 0){
         ans += a[0] + 1 + min(a[1] - 1, a[2] - 1); 
    }else if (a[1] > 0 && a[2] == 0){
        ans += a[0];
    }else if (a[1] == 0 && a[2] > 0){
        ans += a[0];
    }else {
          ans += max(0,a[0] - 1);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n)for(long long i=0;i<(n);i++)
using namespace std;
using P=pair<int,int>;
typedef unsigned long long ull;
typedef long long ll;
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; }
 
const ll MOD=1e9+7;
const double pi=acos(-1);
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
ll gcd(ll x,ll y){
  if(x%y==0)return y;
  else return gcd(y,x%y);
}
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);  
  
  int a,b,c;
  cin >> a >> b >> c;
  int d=0,e=0,f=0;
  d=max({a,b,c});
  e=a+b+c-max({a,b,c})-min({a,b,c});
  f=min({a,b,c});
  int ans=0;
  ans+=d-e;
  e+=ans;
  f+=ans;
  if(f%2!=d%2)ans++;
  ans+=(e+1-f)/2;
  cout << ans << endl;
  
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF (1<<30)
#define MOD 1000000007
#define l_ength size
using ll = long long;
using namespace std;

int main(){
	int a, b, c, x, y;
	cin >> a >> b >> c >> x >> y;
	long long int sum = 0;
	if( 2*c < a+b ){
		sum += min(x, y) * 2*c;
		if( x > y ){
			sum += (x-y) * ( ( 2*c < a ) ? 2*c : a );
		} else {
			// x = y のときは 0 が追加されるから問題ないはず
			sum += (y-x) * ( ( 2*c < b ) ? 2*c : b );
		}
	} else {
		sum += x*a + y*b;
	}
	cout << sum << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double dd;
const int INF = 1e9;
int a[45], b[45], c[45];
int dp[45][450][450];

int main(){
  int n, ma, mb;
  cin >> n >> ma >> mb;
  for (int i = 0; i < n; i++) cin >> a[i] >> b[i] >> c[i];
  for (int i = 0; i <= n; i++) {
    for (int j = 0; j <= 400; j++) {
      for (int k = 0; k <= 400; k++) {
        dp[i][j][k] = INF;
      }
    }
  }
  dp[0][0][0] = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j <= 400; j++) {
      for (int k = 0; k <= 400; k++) {
        dp[i + 1][j][k] = min(dp[i + 1][j][k], dp[i][j][k]);
        dp[i + 1][j + a[i]][k + b[i]] = min(dp[i + 1][j + a[i]][k + b[i]], dp[i][j][k] + c[i]);
      }
    }
  }
  int ans = INF;
  int aa = ma, bb = mb;
  while (aa <= 400 && bb <= 400) {
    ans = min(dp[n][aa][bb], ans);
    aa += ma;
    bb += mb;
  }
  if (ans == INF) cout << -1 << endl;
  else cout << ans << endl;
  return 0;
}


Measured memory_bytes: 32896
#!/usr/bin/env python
# coding: utf-8

# In[14]:


n, y = map(int, input().split())


# In[6]:


import sys


# In[15]:


for i in range(n+1):
    for j in range(n+1-i):
        k = n-(i+j)
        if (y-(i*10000 + j*5000)) /1000 == k:
            print('{} {} {}'.format(i, j, k))
            sys.exit()
else:
    print('-1 -1 -1')


# In[ ]:






Measured memory_bytes: 3060
#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#define gc getchar()
#define N 1000
#define lint long long
using namespace std;
inline int inn()
{
	int x,ch;while((ch=gc)<'0'||ch>'9');
	x=ch^'0';while((ch=gc)>='0'&&ch<='9')
		x=(x<<1)+(x<<3)+(ch^'0');
	return x;
}
int a[N],pre[N];
int main()
{
	lint n;cin>>n;int d=0,ans=0;
	while(n) a[++d]=n%10,n/=10,ans+=a[d];
	for(int i=1;i<=d/2;i++) swap(a[i],a[d-i+1]);
	for(int i=1;i<=d;i++) pre[i]=pre[i-1]+a[i];
	for(int i=1;i<=d;i++)
		if(a[i]) ans=max(ans,pre[i-1]+a[i]-1+9*(d-i));
	return !printf("%d\n",ans);
}

Measured memory_bytes: 256
import java.util.*;
 
class Main{
 
public static void main(String args[]){
 
Scanner s =  new Scanner(System.in);
		String s1 = s.next();
		 
		int count=0;int 
		maxcount=0;
		for(int i=0;i<s1.length();i++){
		 
		if(s1.charAt(i) == 'R') {
			count++;
			if(count>maxcount)
		        maxcount=count;
			//System.out.println(count);
		}
		else {
			
		count=0;
		       
		}
		    
		}
		 
		System.out.println(maxcount);
}
}

Measured memory_bytes: 35584
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.NoSuchElementException;
import java.util.Random;

class Main {
	public static void main(String[] args) {
		new Main().run();
	}
	
	void run() {
		FastScanner sc=new FastScanner();
		PrintWriter pw=new PrintWriter(System.out);
		int N=sc.nextInt();
		int K=sc.nextInt()-1;
		char[] cs=sc.next().toCharArray();
		cs[K]=String.valueOf(cs[K]).toLowerCase().charAt(0);
		pw.println(String.valueOf(cs));
		pw.close();
	}
	
	static void tr(Object... objects) {
		System.out.println(Arrays.deepToString(objects));
	}

}


class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
    public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }

    public int nextInt() {
    	return Integer.parseInt(next());
    }
    
    public long nextLong() {
    	return Long.parseLong(next());
    }
}

Measured memory_bytes: 21204
#include <cstdio>
#include <cstring>
int n;
char s[10005];
int main(){
  scanf("%s", s + 1), n = strlen(s + 1);
  for (register int i = 1; i <= n; ++i)
    if (s[i] != s[n - i + 1]) return puts("No"), 0;
  for (register int i = 1; i <= (n - 1) / 2; ++i)
    if (s[i] != s[(n - 1) / 2 - i + 1]) return puts("No"), 0;
  puts("Yes");
}

Measured memory_bytes: 128
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<functional>
#include<map>
#include<cstdlib>
#include<complex>
#include<numeric>
#include<set>
#include<deque>
#include<queue>

using namespace std;
using Int = long long;
Int INF = 1LL << 60;
const Int MOD = 1000000000 + 7;

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	Int N;
	cin >> N;

	string S;
	cin >> S;

	if (N % 2) {
		cout << "No" << "\n";
	}
	else {

		Int flag = 1;
		for (Int i = 0; i < N/2; i++) {
			if (S[i] != S[N / 2 + i])flag = 0;
		}

		if (flag)cout << "Yes" << "\n";
		else cout << "No" << "\n";

	}


}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("O0")
typedef long long int ll;
typedef long double ld;
const ll mod = 1e9+7;
const ll INF = 1e18;
#define rep(i,n) for (ll i = 0; i < (n); ++i)
#define Rep(i,a,n) for (ll i = (a); i < (n); ++i)
#define All(a) (a).begin(),(a).end()
#define Pi acos(-1)
using Graph = vector<vector<ll>>;
using V = vector<ll>;
using P = pair<ll,ll>;


// 素集合データ構造
struct UnionFind {
    //自身が親であれば、その集合に属する頂点数に-1を掛けたもの
    //そうでなければ親のid
    vector<ll> r;
 
    UnionFind(ll N) {
        r = vector<ll>(N, -1);
    }

  // データxが属する木の根を得る 
    ll root(ll x) {
        if (r[x] < 0) return x;
        return r[x] = root(r[x]);
    }

  // 2つのデータx, yが属する木をマージする 
    bool unite(int x, int y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        if (r[x] > r[y]) swap(x, y);
        r[x] += r[y];
        r[y] = x;
        return true;
    }

  // 2つのデータx, yが属する木が同じならtrueを返す
    bool same(int x, int y) {
      return root(x) == root(y);
    }

  // データxが含まれる木の大きさを返す
    ll size(int x) {
        return -r[root(x)];
    }
};

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << setprecision(15) << fixed;
  chrono::system_clock::time_point start,end;
  start = chrono::system_clock::now();

  ll n, m;
  cin >> n >> m;
  UnionFind UF(n);
  rep(i,m) {
    ll a, b;
    cin >> a >> b;
    --a;--b;
    UF.unite(a,b);
  }
  ll ans = 0;
  rep(i,n) {
    if (UF.root(i) == i) ++ans;
  }
  cout << ans - 1 << '\n';

  end = chrono::system_clock::now();
  auto elapsed = chrono::duration_cast< chrono::milliseconds >(end - start).count();
  cerr << elapsed << "ms" << '\n';
}

Measured memory_bytes: 4048
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using static System.Console;
using static System.Math;

namespace CP
{
    class Atria
    {
        static int[] rsp;
        static void Main(string[] args)
        {
            int[] s = ReadLine().Split(' ').Select(int.Parse).ToArray();
            WriteLine(
                s[0]*500 >= s[1] ? "Yes":"No"
                );
        }

        
    }
}


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

int main()
{
    int a[3][3], b[3][3];
    memset(b, 0, sizeof(b));
    map<int, pair<int, int>> m;
    for (int i = 0; i < 3; i++)
    {
        for (int j = 0; j < 3; j++)
        {
            cin >> a[i][j];
            m[a[i][j]] = {i, j};
        }
    }
    int n;
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        int k;
        cin >> k;
        if (m.find(k) != m.end())
        {
            b[m[k].first][m[k].second] = 1;
        }
    }

    bool f = false;
    for (int i = 0; i < 3; i++)
    {
        if (b[i][0] + b[i][1] + b[i][2] == 3)
            f = true;
        if (b[0][i] + b[1][i] + b[2][i] == 3)
            f = true;
    }
    if (b[0][0] + b[1][1] + b[2][2] == 3)
        f = true;
    if (b[2][0] + b[1][1] + b[0][2] == 3)
        f = true;
    if (f)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<utility>
#include<map>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vi;
typedef vector<string> vs;
typedef pair<ll,ll> P;
typedef vector<P> vp;
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define REPR(i,n) for(int i=n-1;i>=0;i--)
#define FORR(i,n,m) for(int i=n-1;i>=m;i--)
#define all(in) in.begin(),in.end()
#define ALL(in,K) in,in+K
#define INF 1e18
#define MOD 100000007
#define SIZE 100005
#define PI 	3.14159265358979323846

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,k;
    cin >> n >> k;
    ll h[100050];
    REP(i,n)cin >> h[i];
    sort(h,h+n);
    ll minDiff = INF;
    REP(i,n-k+1){
        ll diff = (ll)abs(h[i]-h[i+k-1]);
        minDiff = (ll)min(diff,minDiff);
    }
    cout << minDiff << endl;
    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <queue>
#include <numeric>
#include <string>
#include <string.h>
#include <map>
#include <set>
#include <functional>
#include <complex>

using namespace std;

const int INF = (1<<30) - 1;

const int T = 24 * 60 * 60;
int d[T];

int to_int(string s){
    int res = 0;
    res += ((s[0]-'0')*10 + s[1]-'0') * 3600;
    res += ((s[3]-'0')*10 + s[4]-'0') * 60;
    res += ((s[6]-'0')*10 + s[7]-'0');
    return res;
}

int main(){
    //ios::sync_with_stdio(false);
    //cin.tie(0);
    int N;
    while(cin>>N, N){
        memset(d, 0, sizeof(d));
        
        while(N--){
            string s, e;
            cin >> s >> e;
            d[to_int(s)]++;
            d[to_int(e)]--;
        }
        for(int i=1; i<T; i++)
            d[i] += d[i-1];
        
        int ans = 0;
        for(int i=0; i<T; i++)
            ans = max(ans, d[i]);
        
        cout << ans << endl;
    }
    
    return 0;
}

Measured memory_bytes: 1556