akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include <fstream>
#include <time.h>
#include <iterator>
#include<random>



#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define m0(x) memset(x,0,sizeof(x))
#define print(x) cout<<x<<endl;
#define pe(x) cout<<x<<" ";
#define lb(v,n) lower_bound(v.begin(), v.end(), n);
#define ub(v,n) upper_bound(v.begin(), v.end(), n);
#define int long long
#define all(x) (x).begin(), (x).end()
using namespace std;
int MOD = (ll)1000000000 + 7;
const ll INF = 1e17;
const double pi = acos(-1);
const double EPS = 1e-10;
typedef pair<int, int>P;
const int MAX = 500050;

int N;
int p[30];
signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	string S; cin >> S;
	map<char, int>mp;
	REP(i, S.size()) {
		mp[S[i]]++;
	}
	int cnt = 0;
	for(auto x:mp) {
		cnt++;
		if (x.second != 2) {
			print("No"); return 0;
		}
	}
	if (cnt != 2) {
		print("No"); return 0;
	}
	print("Yes");
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep2(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep_inv(i, n, m) for(int i = (int)(n); i > (int)(m); i--)
using namespace std;
using ll = long long;
using vl = vector<ll>;
using vc = vector<char>;
using vvl = vector<vl>;
using vvc = vector<vc>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;

double pi = 3.1415926535;

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

  cout << setprecision(10) << fixed << 2.0 * (double)R * pi << endl;
  
  return 0;
}


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

int main(){
  vector<int> a = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  int K;
  cin >> K;
  cout << a.at(K-1) << endl;
}
  

Measured memory_bytes: 256
arr1 = $stdin.gets.chomp.split(" ")
arr1.map! do |a_j|
a_j.to_i
end
arr2 = $stdin.gets.chomp.split(" ")
arr2.map! do |a_j|
a_j.to_i
end

ans = 0

for i in 0..arr1[0]-1
    if arr2[i] >= arr1[1]
        ans += 1
    end
end
puts ans

Measured memory_bytes: 7428
import java.util.*;

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

        int N = Integer.parseInt(SC.next());
        HashSet<String> HS = new HashSet<String>();
        for(int i=0;i<N;i++){
            HS.add(SC.next());
        }

        System.out.println(HS.size());
    }

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


Measured memory_bytes: 78440
s = int(input())
mul = s//50
ama = s%50
if ama != 0:
    mul += 1
    ama = 50 - ama
print("50")
ans = 49 + mul
for i in range(50):
    if i < ama:
        print(ans + ama- 1 - 50, end=" ")
    else:
        print(ans + ama, end=" ")
print()

Measured memory_bytes: 3060
#include <stdio.h>

int parent(int);
int left(int);
int right(int);
void maxHeapify(int [], int);
void buildMaxHeap(int []);

int H, A[500001];

int main(){
  int i;

  scanf("%d", &H);

  for(i = 1; i <= H; i++) scanf("%d", &A[i]);

  buildMaxHeap(A);

  for(i = 1; i <= H; i++) printf(" %d", A[i]);
  printf("\n");
  
  return 0;
}

int parent(int i){ return i/2; }

int left(int i){ return i*2; }

int right(int i){ return i*2+1; }

void buildMaxHeap(int A[]){
  int i;
  for(i = H/2; i >= 1; i--) maxHeapify(A, i);
}

void maxHeapify(int A[], int i){
  int l = left(i);
  int r = right(i);
  int large, temp;

  if(l <= H && A[l] > A[i]) large = l;
  else large = i;

  if(r <= H && A[r] > A[large]) large = r;

  if(large != i){
    temp = A[i];
    A[i] = A[large];
    A[large] = temp;
    maxHeapify(A, large);
  }
}

Measured memory_bytes: 2552
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
	string s;
	cin>>s;
	ll ans=0;
	for(int i=0;i<(1<<s.size()-1);i++)
	{
		ll last=-1;
		ll res=0;
		for(int j=0;j<s.size();j++)
			if(i&(1<<j))
			{
				ll cur=0;
				for(int k=last+1;k<=j;k++)
					cur=cur*10+(ll)(s[k]-'0');
				res+=cur;
				last=j;
			}
		ll cur=0;
		for(int j=last+1;j<s.size();j++)
			cur=cur*10+(ll)(s[j]-'0');
		res+=cur;
		ans+=res;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <algorithm>

long long gcd(long long a, long long b)
{
    long long x = std::min(a,b);
    long long y = std::max(a,b);
    if(y%x==0){
        return x;
    }
    return gcd(y%x, x);
}

long long lcm(long long a, long long b)
{
    long long g = gcd(a,b);
    long long p = a/g;
    long long q = b/g;
    return g*p*q;
}

int main()
{
    long long n, ans=1;
    std::cin >> n;
    for(long long i=0;i<n;i++)
    {
        long long a;
        std::cin >> a;
        ans = lcm(ans, a);
    }
    std::cout << ans << "\n";
    return 0;
}



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

using namespace std;

const long INF = 1e15;

void solve(void)
{
	int n, m;
	const int s = 256;
	while(cin >> n >> m)
	{
		if (!n && !m) break;
		vector<int> cs(m);
		for (int& c : cs) cin >> c;
		vector<long> dp(s, INF);
		dp[128] = 0;
		for (int i = 0; i < n; i++)
		{
			int x;
			cin >> x;
			vector<long> nx(s, INF);
			for (int j = 0; j < s; j++)
			{
				if (dp[j] == INF) continue;
				for (int c : cs)
				{
					int k = j + c;
					if (k < 0) k = 0;
					if (k >= s) k = s-1;
					nx[k] = min(nx[k], dp[j] + (x-k)*(x-k));
				}
			}
			swap(dp, nx);
		}
		cout << *min_element(dp.begin(), dp.end()) << '\n';
	}
}

int main()
{
	solve();
	//cout << "yui(*-v・)yui" << endl;
	return 0;
}




Measured memory_bytes: 3072
//@formatter:off
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < int(n); ++i)
#define rrep(i,n) for (int i = int(n)-1; i >= 0; i--)
#define rep2(i,s,n) for (int i = int(s); i < int(n); ++i)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define pb push_back
#define eb emplace_back
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vd vector<double>
#define vvd vector<vector<double>>
#define vs vector<string>
#define vc vector<char>
#define vvc vector<vector<char>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define vp vector<P>
#define vvp vector<vector<P>>
using namespace std;
using ll = long long;
using P = pair<int,int>;
using LP = pair<ll,ll>;
template<class S,class T> istream& operator>>(istream &is,pair<S,T> &p) { return is >> p.first >> p.second; }
template<class S,class T> ostream& operator<<(ostream &os,const pair<S,T> &p) { return os<<'{'<<p.first<<","<<p.second<<'}'; }
template<class T> istream& operator>>(istream &is,vector<T> &v) { for(T &t:v){is>>t;} return is; }
template<class T> ostream& operator<<(ostream &os,const vector<T> &v) { os<<'[';rep(i,v.size())os<<v[i]<<(i==int(v.size()-1)?"":","); return os<<']'; }
void Yes(bool b) { cout << (b ? "Yes" : "No") << '\n'; }
void YES(bool b) { cout << (b ? "YES" : "NO") << '\n'; }
template<class T> bool chmin(T& a,T b) {if(a > b){a = b; return true;} return false;}
template<class T> bool chmax(T& a,T b) {if(a < b){a = b; return true;} return false;}
const int inf = 1001001001;
const ll linf = 1001001001001001001;
//@formatter:on

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);
    int k;
    cin >> k;
    rep(_,k) cout << "ACL";
    cout << endl;
}

Measured memory_bytes: 3600
N,M=map(int,input().split())
A =list(map(int,input().split()))

Left = [0]*(N+1)
for i in range(1,N+1):
    Left[i] = (Left[i-1]+A[i-1])%M
Left = Left[1:]
Left.sort()

cnt = []
zero = Left.count(0)
Left = Left[zero:]
Num = len(Left)

for i in range(Num):
    if i == 0:
        cnt.append(1)
    else:
        if Left[i-1] == Left[i]:
            cnt[-1] += 1
        else:
            cnt.append(1)

res = 0
res += zero + (zero*(zero-1))//2

for c in cnt:
    if c > 1:
        res += (c*(c-1))//2
print(res)

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

int main() {
	ll N, K;
	cin >> N >> K;
	vector<ll> x(N);
	vector<ll> y(N);
	vector<char> c(N);
	for (int i = 0; i < N; i++) {
		cin >> x[i] >> y[i] >> c[i];
	}

	ll size = 3 * K;
	vector<vector<ll>> tile(size, vector<ll>(size, 0));
	for (int i = 0; i < N; i++) {
		ll xx = x[i], yy = y[i];
		if (c[i] == 'W') xx += K;

		xx %= (2 * K);
		yy %= (2 * K);

		tile[xx][yy]++;
		tile[xx + K][yy]--;
		tile[xx][yy + K]--;
		tile[xx + K][yy + K]++;

		if (xx < K) xx += K;
		else xx -= K;

		if (yy < K) yy += K;
		else yy -= K;

		tile[xx][yy]++;
		tile[xx + K][yy]--;
		tile[xx][yy + K]--;
		tile[xx + K][yy + K]++;
	}

	for (int i = 0; i < size; i++) {
		for (int j = 1; j < size; j++) {
			tile[i][j] += tile[i][j - 1];
		}
	}
	for (int j = 0; j < size; j++) {
		for (int i = 1; i < size; i++) {
			tile[i][j] += tile[i - 1][j];
		}
	}

	for (int i = 0; i < size; i++) {
		for (int j = 0; j < size; j++) {
			if ((i >= 2 * K) || (j >= 2 * K)) {
				ll xx = i % (2 * K);
				ll yy = j % (2 * K);

				tile[xx][yy] += tile[i][j];
			}
		}
	}

	ll res = 0;
	for (int i = 0; i < 2 * K; i++) {
		for (int j = 0; j < 2 * K; j++) {
			res = max(res, tile[i][j]);
		}
	}

	cout << res << endl;
	return 0;
}


Measured memory_bytes: 72320
# https://atcoder.jp/contests/abc066/tasks/abc066_b



s = gets.chomp

(1..(s.length / 2)).each do |i|
  t = s[0...(s.length - 2 * i)]

  x = t[0...(t.length / 2)]
  y = t[(t.length / 2)...(t.length)]
  if x == y
    puts t.length
    exit
  end
end


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

void initilize(int w,int num[]){
	for(int i=0;i<w;i++)
		num[i]=i+1;
}

int main() {
	int w,n,a,b;
	int num[30];
	cin>>w>>n;
	initilize(w,num);
	for(int i=0;i<n;i++){
		scanf("%d,%d",&a,&b);
		swap(num[a-1],num[b-1]);
	}
	for(int i=0;i<w;i++)
		cout<<num[i]<<endl;
	return 0;
}

Measured memory_bytes: 1240
divider = 998244353

num = int(input())
depths = [int(x) for x in input().split()]
max_depth = max(depths)

if depths[0] != 0:
  print(0)
  exit(0)

if max_depth == 0:
  print(0)
  exit(0)

nodes = [0] * (max_depth+1)

for depth in depths:
  nodes[depth] += 1

if nodes[0] != 1 or min(nodes) == 0:
  print(0)
  exit(0)

arr = [nodes[i] ** nodes[i+1] for i in range(max_depth)]

ans = 1
for a in arr:
  ans = (ans * a)  % divider

print(ans)
exit(0)


Measured memory_bytes: 13892
#include <iostream>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <string>
#include <sstream>
#include <algorithm>
#include <random>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>
#include <cassert>
#include <climits>
#include <bitset>
#include <functional>

#define FOR_LT(i, beg, end) for (int i = beg; i < end; i++)
#define FOR_LE(i, beg, end) for (int i = beg; i <= end; i++)
#define FOR_DW(i, beg, end) for (int i = beg; end <= i; i--)

using namespace std;

int64_t kRem = 1000000007;

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

	int64_t n, k; cin >> n >> k;
	vector<int64_t> as(n);
	for (auto& a : as) {
		cin >> a;
	}

	vector<int64_t> trs(n);
	vector<int64_t> tas(n);

	FOR_LT(i, 0, n) {
		FOR_LT(j, 0, n) {
			if (as[i] > as[j]) {
				tas[i]++;
				if (i < j) trs[i]++;
			}
		}
	}

	int64_t k2 = (k * (k - 1) / 2) % kRem;
	int64_t ans = 0;
	FOR_LT(i, 0, n) {
		ans += (trs[i] * k) % kRem;
		ans += (tas[i] * k2) % kRem;
		ans %= kRem;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pii;
typedef pair<double,double> pdd;
#define SQ(i) ((i)*(i))
#define MEM(a, b) memset(a, (b), sizeof(a))
#define SZ(i) int(i.size())
#define FOR(i, j, k, in) for (int i=j ; i<k ; i+=in)
#define RFOR(i, j, k, in) for (int i=j ; i>=k ; i-=in)
#define REP(i, j) FOR(i, 0, j, 1)
#define REP1(i,j) FOR(i, 1, j+1, 1)
#define RREP(i, j) RFOR(i, j, 0, 1)
#define ALL(_a) _a.begin(),_a.end()
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define X first
#define Y second
#ifdef tmd
#define debug(...) do{\
    fprintf(stderr,"%s - %d (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
    _do(__VA_ARGS__);\
}while(0)
template<typename T>void _do(T &&_x){cerr<<_x<<endl;}
template<typename T,typename ...S> void _do(T &&_x,S &&..._t){cerr<<_x<<" ,";_do(_t...);}
template<typename _a,typename _b> ostream& operator << (ostream &_s,const pair<_a,_b> &_p){return _s<<"("<<_p.X<<","<<_p.Y<<")";}
template<typename It> ostream& _OUTC(ostream &_s,It _ita,It _itb)
{
    _s<<"{";
    for(It _it=_ita;_it!=_itb;_it++)
    {
        _s<<(_it==_ita?"":",")<<*_it;
    }
    _s<<"}";
    return _s;
}
template<typename _a> ostream &operator << (ostream &_s,vector<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,set<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,deque<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a,typename _b> ostream &operator << (ostream &_s,map<_a,_b> &_c){return _OUTC(_s,ALL(_c));}
template<typename _t> void pary(_t _a,_t _b){_OUTC(cerr,_a,_b);cerr<<endl;}
#define IOS()
#else
#define debug(...)
#define pary(...)
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0)
#endif

const ll MOD = 1000000007;
const ll INF = 0x3f3f3f3f3f3f3f3f;
const int iNF = 0x3f3f3f3f;
// const ll MAXN = 

ll n, x, y, z;
ll dp[42][1<<17];
ll mpow (ll bs, ll ep) {
    ll ret = 1;
    while (ep) {
        if (ep & 1) {
            ret = (ret * bs) % MOD;
        }
        bs = (bs * bs) % MOD;
        ep >>= 1;
    }
    return ret;
}

/********** Good Luck :) **********/
int main()
{
    IOS();
    cin >> n >> x >> y >> z;

    dp[0][0] = 1;

    ll ban = (1LL<<(x+y+z-1)) + (1LL<<(y+z-1)) + (1LL<<(z-1));
    ll mx = (1LL<<(x+y+z))-1;
    REP1 (i, n) {
        REP (st, mx + 1) {
            REP1 (d, 10) {
                ll cur = (st << d) + (1LL << (d-1));
                cur &= mx;
                if ((ban & cur) != ban) {
                    dp[i][cur] = (dp[i][cur] + dp[i-1][st]) % MOD;
                }
            } 
        }
    }
    
    ll ans = 0;
    REP (st, mx+1) {
        ans += dp[n][st];
        ans %= MOD;
    }

    cout << ((mpow(10, n) - ans) % MOD + MOD) % MOD << endl;
    return 0;
}


Measured memory_bytes: 42240
#include <iostream>

#define MAX 100

using namespace std;

int main(void) {

	int iN, iI, iJ, iK, iL;
	int iCounting[(MAX + 1)];
	int iAnswer;

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	cin >> iN;

	iN <<= 1;

	for (iI = 0; iI <= MAX; iI++)
		iCounting[iI] = 0;

	for (iI = 0; iI < iN; iI++) {

		cin >> iL;
		iCounting[iL]++;

	}

	iK = 0;
	for (iI = MAX; iI >= 0; iI--) {

		if (iCounting[iI] > 0) {

			iCounting[iI] += iK;
			iK = iCounting[iI] & 0x01; 
			iAnswer += (iCounting[iI] >> 1) * iI;

		}

	}

	cout << iAnswer << endl;

	return 0;

}

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

void Solve()
{
    int n; cin >> n;
    unsigned long long ans = 1;
    unsigned long long a[n+2] = {};
    for(int i = 1; i <= n; i++)
    {
        cin >> a[i];
    }
    unsigned long long di = 1000000000000000000;
    long double temp =1;
    for(int i = 1; i <= n; i++)
    {
        ans *= a[i];
        temp *= a[i];
    }
    if(temp > di)
    {
        cout << "-1" << endl;
    }
    else
    {
        cout << ans << endl;
    }
}
int main()
{
    Solve();
    return 0;
}


Measured memory_bytes: 4408
//#define TEXT_FILES

#ifdef TEXT_FILES
#include<fstream>
#else
#include<iostream>
#endif
#include<cmath>
#include<cstring>
#include<algorithm>
#include<vector>

using namespace std;

#ifdef TEXT_FILES
ifstream cin("A.in");
ofstream cout("A.out");
#endif

void solve()
{

}

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

	cout << (2 * 3.14159*r) << "\n";

	return 0;
}

Measured memory_bytes: 3784
import sys
input = sys.stdin.readline

def main():
    N = int(input())
    for i in range(1, 10):
        if N%i == 0:
            t=N//i
            if 0 < t and t < 10:
                print("Yes")
                return
    print("No")
    return

if __name__ == "__main__":
    main()

Measured memory_bytes: 3060
#include <stdio.h>
int main(void){
    int A,B,C;
    int n;
    scanf("%d %d %d",&A,&B,&C);
    for(int i=0;i<=C;i++){
        B=B-A;
        n=i;
        if(B<0){
            break;
        }
    }
    printf("%d",n);
}


Measured memory_bytes: 128
#[allow(unused_imports)]
use std::char::*;
#[allow(unused_imports)]
use std::cmp::*;
use std::io::*;
use std::str::FromStr;
#[allow(unused_imports)]
use std::collections::*;

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

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

#[derive(PartialEq, PartialOrd)]
pub struct Total<T>(pub T);

impl<T: PartialEq> Eq for Total<T> {}

impl<T: PartialOrd> Ord for Total<T> {
    fn cmp(&self, other: &Total<T>) -> std::cmp::Ordering {
        self.0.partial_cmp(&other.0).unwrap()
    }
}

#[allow(dead_code)]
const MAX:usize = 100006;
#[allow(dead_code)]
const INF_U32:u32 = 1 << 31;
#[allow(dead_code)]
const INF_I32:i32 = 1 << 30;
#[allow(dead_code)]
const INF_U64:u64 = 1 << 63;
#[allow(dead_code)]
const INF_I64:i64 = 1 << 62;

fn main() {
    let n:usize = read();
    let w:Vec<String> = (0..n).map(|_| read()).collect();

    let mut map = HashMap::new();
    for s in w.iter() {
        if map.contains_key(s) {
            println!("No");
            return ();
        }
        map.insert(s, true);
    }

    let mut prev = &(w[0])[w[0].len()-1..];
    //debug!(prev);
    for s in w.iter().skip(1) {
        //debug!(&s[0..1],prev);
        if &s[0..1] != prev {
            println!("No");
            return ();
        }
        prev = &s[s.len()-1..];
    }

    println!("Yes");

}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#include<list>
#include<algorithm>
#define ll long long int
#define ld long double
#define pb push_back
#define ff first
#define ss second
#define rep(a,b,c) for(a=b;a<c;a++)
#define repr for(i=n-1;i>=0;i--)
#define pll pair<ll, ll>
#define inf 100000001
#define mod 1000000007
#define lb lower_bound
#define up upper_bound
#define rep1 for(i=1;i<=n;i++)
#define vr vector
#define ef else if
#define all(x) (x).begin(), (x).end()
#define SORT(A) sort(A.begin(), A.end());
#define REVERSE(A) reverse(A.begin(), A.end());
#define MAX LLONG_MAX
#define MIN LLONG_MIN
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
ll myXOR(unsigned long long int x, unsigned long long int y)
{
    return (x|y)&(~x|~y);   
}
ll powerLL(ll x, ll n) 
{ 
    ll result = 1; 
    while (n) { 
        if (n & 1) 
            result = result * x % mod; 
        n = n / 2; 
        x = x * x % mod; 
    }
    return result; 
}
int main()
{
    fastio
    ll a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,r,t,u,w,x,y,z;
    string str, ss, str1;
    double rad;
    cin>>rad;
    double res = (double)((double)(44.0)/(double)7.0)*rad;
    printf("%0.20f\n", res);
}

Measured memory_bytes: 3832
while True:
    x = int(input())
    if x == 0:
        break
    dcl = {}
    for i in range(x):
        inp = list(map(str, input().split()))
        dcl[inp[0]] = inp[1]
    ans = ""
    x = int(input())
    for i in range(x):
        y = str(input()[0])
        if y in dcl:
            ans += dcl[y]
        else:
            ans += y
    print(ans)

Measured memory_bytes: 7744
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#include <boost/function.hpp>
#define rep(i,n) for(int i=0,i##_len=(n);i<i##_len;++i)
#define repr(i,j,n) for(int i=(j),i##_len=(n);i<i##_len;++i)
#define all(x) (x).begin(),(x).end()
using namespace std;

struct UnionFind
{
    vector<int> par;

    UnionFind(int n) : par(n)
    {
        rep(i, n) par[i] = i;
    }

    int root(int x)
    {
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y)
    {
        int rx = root(x);
        int ry = root(y);
        if (rx == ry) return;
        par[rx] = ry;
    }

    int same(int x, int y)
    {
        return root(x) == root(y);
    }
};

int main()
{
    cin.tie(0); cout.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(numeric_limits<double>::max_digits10);

    int n, k; cin >> n >> k;
    string s; cin >> s;
    char c = s[0];
    int count = 1;
    vector<pair<int,int>> v;
    repr(i, 1, n)
    {
        if (c == s[i])
        {
            count++;
        }
        else
        {
            v.emplace_back(c == '1', count);
            c = s[i];
            count = 1;
        }
    }
    v.emplace_back(s[n-1] == '1', count);
    if (2 * k - 1 + v[0].first >= v.size())
    {
        cout << n << endl;
        return 0;
    }
    v.emplace_back(false, 0);
    v.emplace_back(false, 0);
    int sum = 0;
    rep(i, 2*k+v[0].first)
    {
        sum += v[i].second;
    }
    int m = sum;
    for (int i = v[0].first+1; i < v.size() && i+2*k < v.size(); i += 2)
    {
        int d;
        if (i == 1)
        {
            d = -v[0].second + v[i+2*k].second + v[i+2*k-1].second;
        }
        else
        {
            d = -v[i-2].second - v[i-1].second + v[i+2*k].second + v[i+2*k-1].second;
        }
        sum += d;
        m = max(m, sum);
    }
    cout << m << endl;

    return 0;
}

Measured memory_bytes: 1528
#include<stdio.h>
#include <stdlib.h>
#include <bits/stdc++.h>

//クイックソート用　昇順
int compare_int(const void *a, const void *b)
{
    return *(int*)a - *(int*)b;
}
//qsort(配列の先頭ポインタ, データ数, 1データのサイズ, compare_int);

int main()
{
    long x = 0;
    long mny =100;
    long cnt = 0;
    scanf("%lu",&x);
    while( x > mny)
    {
      mny = mny * 1.01;
      cnt++;
    }    
  
    printf("%lu",cnt);
   
    return 0;
}

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

int main(){
  int N, i;
  bool flag = false;
  string V;
  cin >> N;
  for(i=0; i < N; i++){
    cin >> V;
    if( V == "Y"){
      flag = true;
    } 
  }
  if(flag == true){
    cout << "Four" << endl;
  }
  else{
    cout << "Three" << endl;
  }
}

Measured memory_bytes: 256
a = gets.chomp.split(" ").map(&:to_i)

count = 0
flg=0

if (a[0] == a[1] && a[1] == a[2] && a[0] % 2 == 0 && a[1] % 2 == 0 && a[2] % 2 == 0)
    print(-1)
else
    while(1)
        if((a[0] % 2 == 1) || (a[1] % 2 == 1) || (a[2] % 2 == 1))
            break()
        end
        tmp0 = a[1] / 2 + a[2] / 2
        tmp1 = a[0] / 2 + a[2] / 2
        tmp2 = a[0] / 2 + a[1] / 2
        a[0] = tmp0
        a[1] = tmp1
        a[2] = tmp2
        count += 1
    end
        print(count)
end



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

using namespace std;
typedef long long ll;
#define int ll

#define REP(i,n) for(int i=0;i<n;++i)
#define ALL(name) name.begin(),name.end()
#define SORT(name) sort(name.begin(), name.end())
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))
#if 1
#  define DBG(fmt, ...) printf(fmt, ##__VA_ARGS__)
#else
#  define DBG(fmt, ...)
#endif

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const double DINF = std::numeric_limits<double>::infinity();
const int MOD = 1000000007;
#define MAX_N 100010

vector<int> GetDivisor(int n) {
    vector<int> v;
    for(int i = 1; i*i <= n; ++i) {
        if(n % i == 0) {
            v.push_back(i);
            if(i != n / i) { v.push_back(n / i); }
        }
    }
    sort(v.begin(), v.end());
    return v;
}

vector<ll> GetCommonDivisor(ll a, ll b) {
    auto a_res = GetDivisor(a);
    auto b_res = GetDivisor(b);
    vector<ll> res;
    for(auto& a_t : a_res) {
        for(auto& b_t : b_res) {
            if(a_t > 0 && a_t == b_t) {
                res.push_back(a_t);
                break;
            }
        }
    }
    return res;
}

// 入力は全て正とする
bool is_prime(int n) {
    for(int i = 2; i * i <= n; ++i) {
        if(n % i == 0){ return false; }
    }
    return n != 1;  // 1 の場合は例外
}

ll A, B;

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

    cin >> A >> B;

    vector<ll> res = GetCommonDivisor(A, B);

    int ans = 1;
    for(auto& r : res) {
        if(is_prime(r)) { ans++; }
    }

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

    return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define F first
#define S second
constexpr char ln = '\n';

const int mx=100010;
const ll mod=1e9+7;

int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  unordered_map<int,int> mp;
  rep(i,n){
    cin >> a[i];
    mp[a[i]]++;
  }
  sort(a.begin(),a.end());
  if(a[0]==1){
    if(a[1]==1){
      cout << 0 << ln; return 0;
    } else {
      cout << 1 << ln; return 0;
    }
  }

  int ans = 0;
  rep(i,n){
    bool flag = true;
    for(int j=2; j*j<=a[i]; j++)if(a[i]%j==0){
      if(mp[j]>0 || mp[a[i]/j]>0){
        flag = false; break;
      }
    }
    if(mp[a[i]]>1){ flag=false; }
    if(flag){
      ans++;
    }
  }

  cout << ans << ln;

  return 0;
}

Measured memory_bytes: 32512
use std::io::prelude::*;
use std::io::stdin;
use std::str::FromStr;

fn main() {
    let s = read::<String>().as_bytes().to_vec();
    let k: u64 = read();

    let mut count = 1;
    let mut v = vec![];

    for sub in s.windows(2) {
        if sub[0] == sub[1] {
            count += 1;
        } else {
            v.push(count);
            count = 1;
        }
    }
    v.push(count);

    let ans: u64 = if v.len() == 1 {
        v[0] * k / 2
    } else {
        let sum = v.iter().map(|x| x / 2).sum::<u64>();
        if s.first() == s.last() {
            let first = *v.first().unwrap();
            let last = *v.last().unwrap();
            sum * k - (first / 2 + last / 2 - (first + last) / 2) * (k - 1)
        } else {
            sum * k
        }
    };

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

#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|b| b.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}


Measured memory_bytes: 4352
#include <algorithm>
#include <cmath>
#include <iostream>
#include <iterator>
#include <map>
#include <queue>
#include <unordered_map>
#include <vector>

using namespace std;

#define ll long long
#define el '\n'
#define rep(i, a, b) for (int i = a; i < b; i++)
#define repi(i, a, b) for (int i = a; i >= b; i--)
#define vi vector<int>
#define vii vector<pair<int, int>>
#define pii pair<int, int>
#define mp make_pair
#ifdef LOCAL
#define debug(fmt, ...) printf(fmt, ##__VA_ARGS__)
#define check(...) assert(__VA_ARGS__)
#else
#define debug(fmt, ...)
#define check(...)
#endif

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

    int n;
    cin >> n;
    vi a(n);
    vi ans(n, 0);
    rep(i,1,n) {
        cin >> a[i];
        a[i]--;
        ans[a[i]]++;
    }
    rep(i,0,n) {
        cout << ans[i] << el;
    }
}


Measured memory_bytes: 4464
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
int gcd(int a,int b){return b?gcd(b,a%b):a;}    //最大公約数
int lcm(int a, int b) {return a * b / gcd(a, b);}   //最小公倍数

int main()
{
    int n;
    cin >> n;    
    int a[n+1];
    a[0] = 0;
    for (int i = 1; i <= n; i++)
        cin >> a[i];
    int count = 0;
    int b[n+1];
    b[0] = 0;
    int tama = 0;

    //どこにボールを入れるか・・
    bool ireru = false;
    for (int i = n; i > 0; i--)
    {
        for (int j = 2; j <= n; j++){ //倍数チェック
            if (i * j > n)
                break;
            count += b[j * i];
        }
        if(a[i]==1&&count%2==0)
            ireru = true;
        if(a[i]==0&&count%2==1)
            ireru = true;
        if(ireru){
            b[i] = 1;
            tama++;
        }
        else
        {
            b[i] = 0;
        }

        count = 0;
        ireru = false;
    }

    cout << tama << endl;
    for (int i = 1; i < n+1;i++){
    if(b[i]==1)
        cout << i << endl;
    }
    return 0;
}

Measured memory_bytes: 2432
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3f
#define MOD 1000000007
#define EPS (1e-10)
using namespace std;
typedef long long ll;
typedef pair<int,int>P;

ll x[2000],y[2000],z[2000];
struct st{
	ll a,b,c;
};
st p[2000];
signed main(){
	int n,m;cin>>n>>m;
	rep(i,n)cin>>x[i]>>y[i]>>z[i];
	ll ans=0;
	rep(i,2)rep(j,2)rep(t,2){
		rep(k,n){
			p[k].a=x[k];
			p[k].b=y[k];
			p[k].c=z[k];
			if(i)p[k].a=-p[k].a;
			if(j)p[k].b=-p[k].b;
			if(t)p[k].c=-p[k].c;
		}
		sort(p,p+n,[](st a,st b){
			return a.a+a.b+a.c<b.a+b.b+b.c;
		});
		ll A=0,B=0,C=0;
		rep(k,m){
			A+=p[k].a;
			B+=p[k].b;
			C+=p[k].c;
		}
		ans=max(ans,abs(A)+abs(B)+abs(C));
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 256
n = gets.chomp.to_i
a = []
a = gets.split.map(&:to_i)
b = []
d = 0
e = []
for i in 0..n-1
  b[i] = a[i]-i-1
  #d += a[i]-i-1
end
#d /= n
#p b
e = b.clone
e.sort!
#p d
#p b
#p e
    
#end
if n%2 ==0
   t = 0
   for j in 0..n-1
     t += (b[j] - e[n/2-1]).abs
   end
else
    t = 0
    for j in 0..n-1
     t += (b[j] - e[n/2]).abs
   end
end
puts t

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

int main(){
    int n;
    long long h, w;
    cin >> n >> h >> w;
    int ans = 0;
    for(int i = 0; i < n; i++){
        long long a, b;
        cin >> a >> b;
        if(a >= h && b >= w){
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>

int main(){
  long long n;
  std::cin >> n;
  
  long long mod = 1e9 + 7;
  
  long long ans = 1;
  for(int i = 2; i <= n; i++){
    ans = ans * i % mod;
  }
  std::cout << ans << std::endl;
  return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AtCoder
{
    class Modulo
    {
        public readonly int M = 998244353;
        private readonly int[] m_facs;
        public Modulo(int n)
        {
            m_facs = new int[n + 1];
            m_facs[0] = 1;
            for (int i = 1; i <= n; ++i)
            {
                m_facs[i] = (int)(Math.BigMul(m_facs[i - 1], i) % M);
            }
        }
        public int Fac(int n)
        {
            return m_facs[n];
        }
        public int Pow(int a, int m)
        {
            switch (m)
            {
            case 0:
                return 1;
            case 1:
                return a;
            default:
                int p1 = Pow(a, m / 2);
                long p2 = Math.BigMul(p1, p1) % M;
                return (int)(((m & 1) == 0) ? p2 : p2 * a % M);
            }
        }
        public long Ncr(int n, int r)
        {
            if (n < r) { return 0; }
            if (n == r) { return 1; }
            long res = Fac(n);
            res *= Pow(Fac(r), M - 2);
            res %= M;
            res *= Pow(Fac(n - r), M - 2);
            res %= M;
            return res;
        }
    }
    class Program
    {
        private const int MODULO = 998244353;
        private static string Read() { return Console.ReadLine(); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }

        static long Solve(int N, int A, int B, long K)
        {
            var modulo = new Modulo(N);
            long sum = 0;
            for (int i = 0; i <= N; ++i)
            {
                long L = Math.BigMul(A, i);
                if ((K - L) >= 0 && (K - L) % B == 0 && (K - L) / B <= N)
                {
                    int j = (int)((K - L) / B);
                    sum += (modulo.Ncr(N, i) * modulo.Ncr(N, j)) % MODULO;
                    sum %= MODULO;
                }
            }
            return sum;
        }
        static void Main(string[] args)
        {
            var V = ReadLongs();
            Console.WriteLine(Solve((int)V[0], (int)V[1], (int)V[2], V[3]));
        }
    }
}


Measured memory_bytes: 13248
#include <iostream>
#include <string>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <list>
#include <iomanip>
#include <vector>
#include <functional>
#include <algorithm>
#include <cstdio>
#include <random>
#include <ctime>
#include <cstdlib>
#include <unordered_map>
#include <string.h>
#include <iostream>

using namespace std;
typedef long long ll;
typedef pair<int, int> Pint;
typedef pair<ll, ll> Pll;
#define rep(begin, i, end) for (int i = begin; i < (int)(end); i++)
#define all(v) v.begin(), v.end()
const int MOD = 1000000007;

int main()
{
    ll A, B, C, X, Y;
    cin >> A >> B >> C >> X >> Y;
    ll sum1 = A * X + B * Y;
    ll sum2 = max(X, Y) * 2 * C;
    ll sum3;
    if (X < Y)
    {
        sum3 = X * 2 * C + (Y - X) * B;
    }
    else
    {
        sum3 = Y * 2 * C + (X - Y) * A;
    }

    cout << min(min(sum1, sum2), sum3) << endl;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace cswork
{
    class Program
    {
        class Scanner
        {
            string[] s;
            int i;

            char[] cs = new char[] { ' ' };

            public Scanner()
            {
                s = new string[0];
                i = 0;
            }

            public string next()
            {
                if (i < s.Length) return s[i++];
                string st = Console.ReadLine();
                while (st == "") st = Console.ReadLine();

                s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
                i = 0;
                return next();
            }

            public int nextInt()
            {
                return int.Parse(next());
            }

            public long nextLong()
            {
                return long.Parse(next());
            }

            public double nextDouble()
            {
                return double.Parse(next());
            }
        }

        public Program() { }

        static void Main(string[] args)
        {
            new Program().Omame();
        }

        Scanner cin;
        const int MAXIN = 1024;
        bool[] used = new bool[MAXIN];
        int[] perm = new int[MAXIN];

        List<int[]> permList = new List<int[]>();

        public void Permutation(int pos, int n, int length)
        {
            if (pos == n)
            {
                permList.Add((int[])perm.Clone());
            }

            for (int i = 0; i < n; i++)
            {
                if (!used[i])
                {
                    perm[pos] = i;
                    used[i] = true;
                    Permutation(pos + 1, n, length);
                    used[i] = false;
                }
            }
        }

        public static List<long> GeneratePrime(long max)
        {
            long prime;
            double sqrtMax = Math.Sqrt(max);
            var primeList = new List<long>();

            List<long> searchList = new List<long>();
            for (long i = 2; i <= max - 1; i++)
            {
                searchList.Add(i);
            }

            do
            {
                prime = searchList.First();
                primeList.Add(prime);
                searchList.RemoveAll(n => n % prime == 0);
            } while (prime < sqrtMax);

            primeList.AddRange(searchList);

            return primeList;
        }

        void Omame()
        {
            cin = new Scanner();
            long N = cin.nextLong();
            long K = cin.nextLong();

            List<long> HList = new List<long>();
            for (int i = 0; i < N; i++)
            {
                HList.Add(cin.nextLong());
            }
            HList.Sort();

            long ans = 0;
            for (int i = 0; i < N -K; i++)
            {
                ans += HList[i];
            }

            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 31744
//Love and Freedom.
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<cstring>
#define ll long long
#define inf 20021225
using namespace std;

int main()
{
	int n,k;
	scanf("%d%d",&n,&k);
	if((n+1)/2 >= k)	printf("YES\n");
	else	printf("NO\n");
	return 0;
}


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

int n, w;
int dp[100001][101];
int v[100001][101];
int w1[101];
int v1[101];

int s1(int wr, int i){
	if(wr<0){
		return INT_MIN;
	}
	if(i==n+1){
		return 0;
	}
	if(v[wr][i]){
		return dp[wr][i];
	}
	v[wr][i]=1;

	dp[wr][i] = max(v1[i] + s1(wr-w1[i], i+1), s1(wr, i+1));

	return dp[wr][i];
}


signed main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int t=1;
	// cin>>t;
	// int k=1;
	while(t--){
			cin>>n>>w;

			for(int i=1; i<=n; i++){
				cin>>w1[i]>>v1[i];
			}

			cout<<s1(w, 1)<<'\n';
	}
}

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

int main()
{
	int x,y,t;
	cin >> x >> y;
	t = abs(x - y);
	if(x > y) swap(x,y);
	if( t % 2 == 0){
		cout << x + t / 2;
	}else{
		cout << "IMPOSSIBLE";
	}
	return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
    using namespace std;
    int main(){
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    if(abs(a-b)<=d&&abs(b-c)<=d||abs(a-c)<=d) cout<<"Yes\n";
    else cout<<"No\n";
    }

Measured memory_bytes: 256
// Aizu Vol-1 0186: Aizu Chicken
// 2017.8.27 bal4u@uu
// 2017.10.30 retry

#include <stdio.h>

int main()
{
	int q1, b, c1, c2, q2;
	long long x, y;

	while (scanf("%d", &q1) && q1 > 0) {
		scanf("%d%d%d%d", &b, &c1, &c2, &q2);
		if (b < q1*c2) { puts("NA"); continue; }
		x = q2, y = 1 + (b - c1*x)/c2;
		if (y * c2 + x * c1 <= b) y++;
		while (y * c2 + x * c1 > b) y--;

		while (y < 0 || x + y < q1 || c1*x + c2*y > b) {
			if (--x <= 0) break;
			y = 1 + (b - c1*x)/c2;
			if (y * c2 + x * c1 <= b) y++;
			while (y * c2 + x * c1 > b) y--;
		}
		if (x < 0) x = 1, y = (b-c1)/c2;
		while (y * c2 + x * c1 <= b) y++;
		if (y * c2 + x * c1 > b) y--;
		if (x <= 0 || x + y < q1) puts("NA");
		else printf("%lld %lld\n", x, y);
	}
	return 0;
}

Measured memory_bytes: 1808
#pragma GCC target ("avx2")
#pragma GCC optimize "trapv"
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#include <bits/stdc++.h>
#define input(a,n) for(ll i1=0;i1<n;i1++)cin>>a[i1]
#define ll long long
#define pi 2 * acos(0.0)
#define usll unordered_set<ll>
#define sll set<ll>
#define vll vector<ll>
#define mll map<ll,ll>
#define pll pair<ll,ll>
#define umll unordered_map<ll,ll>
#define S second
#define sz size()
#define all(v) v.begin(),v.end()
#define Y cout<< "YES"<< "\n"
#define N cout<< "NO"<< "\n"
#define F first
#define mp make_pair
#define pb push_back
#define pf push_front
#define ld long double
#define mod 1000000007
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
       ll a;
       cin>>a;
       ll p=a+a*a+a*a*a;
       cout<<p;
    return 0;
}


Measured memory_bytes: 3652
ma = lambda :map(int,input().split())
lma = lambda :list(map(int,input().split()))
ni = lambda:int(input())
yn = lambda fl:print("Yes") if fl else print("No")
import collections
import math
import itertools
import heapq as hq
N,C = ma()
nn = 10**5+4
times = [[0 for i in range(nn)] for j in range(C+1)]
for i in range(N):
    s,t,c = ma()
    times[c][s] +=1
    times[c][t] -=1
for c in range(1,C+1):
    for i in range(nn-1):
        times[c][i+1] += times[c][i]

tot = [0 for i in range(nn)]
for c in range(C+1):
    for i in range(nn-1):
        tot[i] += times[c][i]
        if times[c][i] == 0 and times[c][i+1] ==1:
            tot[i] +=1
print(max(tot))


Measured memory_bytes: 34292
#include"bits/stdc++.h"
using namespace std;
using ll=long long;
template<typename T=ll>inline T in(istream&is=cin){T ret;is>>ret;return ret;}
template<typename T>inline auto vec2(typename vector<T>::size_type h,typename vector<T>::size_type w,T v=T()){return vector<vector<T>>(h,vector<T>(w,v));}

int main()
{
    ll n=in(),m=in();
    vector<ll>a(n);
    ll sum=0;
    for(ll i=0;i<n;++i)sum+=a[i]=in();
    ll cnt=0;
    for(ll i=0;i<n;++i){
        if(a[i]*4*m>=sum)++cnt;
    }
    cout<<(cnt>=m?"Yes":"No")<<endl;
}



Measured memory_bytes: 256
class UnionFind:
    def __init__(self, n):
        self.parent = [i for i in range(n + 1)]
        self.rank = [0 for _ in range(n + 1)]
        self.size = [1] * (n + 1)

    def find(self, x):
        if x == self.parent[x]:
            return x
        else:
            self.parent[x] = self.find(self.parent[x])
            return self.parent[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return
        if self.rank[x] < self.rank[y]:
            self.parent[x] = y
            self.size[y] += self.size[x]

        else:
            self.parent[y] = x
            self.size[x] += self.size[y]
            if self.size[x] == self.rank[y]:
                self.rank[x] += 1

    def check_same(self, x, y):
        return self.find(x) == self.find(y)

    def get_size(self, x):
        return self.size(self.find(x))


N, M = map(int, input().split())
lang_list = []
k_list = []
for i in range(N):
    tmp = tuple(map(int, input().split()))
    k_list.append(tmp[0])
    lang_list.append(tmp[1:])
union_find = UnionFind(M)

for lang in lang_list:
    tmp = lang[0]
    for l in lang[1:]:
        union_find.union(tmp, l)

p = union_find.find(lang_list[0][0])
for lang in lang_list[1:]:
    if p == union_find.find(lang[0]):
        continue
    else:
        print("NO")
        exit()
print("YES")



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

class Main{
	public static void main(String args[]){
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		try {
			while(true){
					String strs[] = br.readLine().split(" ");
					int s = Integer.parseInt(strs[0]);
					int d = Integer.parseInt(strs[1]);
					if(s == 0 && d == 0) return;
					
					// 水が通じてるかどうかフラグ
					boolean pipeline_flag[] = new boolean[d];
					// printArray(pipeline_flag);
					
					int d_to_s[][] = new int[d][s];
					for(int i = 0; i < s; i++){
						strs = br.readLine().split(" ");
						for(int j = 0; j < d; j++){
							d_to_s[j][i] = Integer.parseInt(strs[j]);
						}
					}

					int d_to_d[][] = new int[d][d];
					for(int i = 0; i < d-1; i++){
						strs = br.readLine().split(" ");
						for(int j = 0; j < strs.length; j++){
							d_to_d[i][i + j + 1] = Integer.parseInt(strs[j]);
							d_to_d[i + j + 1][i] = Integer.parseInt(strs[j]);
						}
					}
					// printMatrix(d_to_s);
					// printMatrix(d_to_d);
					solve(s, d, d_to_s, d_to_d);
			}
		} catch (IOException e) {
				e.printStackTrace();
		}
	}
	
	public static void solve(int s, int d, int d_to_s[][], int d_to_d[][]){
		boolean pipeline_flag[] = new boolean[d];
		int sum = 0;
		
		while(true){
			int min_d = -1;
			int min = 101;
			for(int i = 0; i < d; i++){
				if(pipeline_flag[i]) continue;
				for(int j = 0; j < s; j++){
					if(d_to_s[i][j] == 0) continue; // 接続されてない場合
					// 最小値を更新した場合
					if(min > d_to_s[i][j]){
						min = d_to_s[i][j];
						min_d = i;
					}
				}
				for(int j = 0; j < d; j++){
					if(d_to_d[i][j] == 0) continue; // 接続されてない場合
					// 最小値を更新した場合
					if(pipeline_flag[j] && min > d_to_d[i][j]){
						min = d_to_d[i][j];
						min_d = i;
					}
				}
			}
			//System.out.println(min_d + ":" + min);
			sum += min;
			pipeline_flag[min_d] = true;
			if(flagCheckAnd(pipeline_flag)){
				System.out.println(sum);
				return;
			}
		}
	}
	
	public static boolean flagCheckAnd(boolean flags[]){
		for(int i = 0; i < flags.length; i++){
			if(!flags[i]) return false;
		}
		return true;
	}
}

Measured memory_bytes: 19160
import java.util.Scanner;
public class Main {
	public static void calcu(int a,int b){
		int ans=a;
		while(b!=0){
			ans = a % b; 
			a = b; 
			b = ans; 
		}
		System.out.println(a);
	}
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int a = scan.nextInt();
		int b = scan.nextInt();
		if(a>b)
			calcu(a,b);
		else
			calcu(b,a);
	}

}

Measured memory_bytes: 17312
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String {
            bytes
                .by_ref()
                .map(|r| r.unwrap() as char)
                .skip_while(|c| c.is_whitespace())
                .take_while(|c| !c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!{
        h: usize,
        w: usize,
        x: usize,
        y: usize,
    }
    println!("{}", (h - x) * (w - y));
}


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


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

    int n;
    cin >> n;
    for (int i = 1; i <= 9; i++)
        if (n % i == 0 && n/i <= 9)
            return cout << "Yes", 0;
    cout << "No";

}

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

int main() {
  int n;
  cin >> n;
  map<int,int> mp;
  rep(i,n) {
    int x;
    cin >> x;
    mp[x]++;
  }
  bool ok=true;
  if(mp.size()>3) ok=false;
  else if(mp.size()==1) {
    if(!mp.count(0)) ok=false;
  }
  else if(mp.size()==2) {
    if(n%3!=0) ok=false;
    else if(mp.at(0)!=n/3) ok=false;
  }
  else {
    if(n%3!=0) ok=false;
    vector<int> a;
    for(auto p : mp) {
      if(p.second!=n/3) ok=false;
      a.push_back(p.first);
    }
    int q=a[0]^a[1]^a[2];
    if(q!=0) ok=false;
  }

  cout << (ok? "Yes" : "No") << endl;
}



Measured memory_bytes: 3840