akhauriyash/Code-Regression huggingface dataset:
// header {{{
#include <bits/stdc++.h>
using namespace std;

// {U}{INT,LONG,LLONG}_{MAX,MIN}
#define INF         INT_MAX/3
#define LLINF       LLONG_MAX/3
#define MOD         (1000000007LL)
#define MODA(a, b)  a=((a)+(b))%MOD
#define MODP(a, b)  a=((a)*(b))%MOD
#define inc(i, l, r)   for(int i=(l);i<(r);i++)
#define dec(i, l, r)   for(int i=(r)-1;i>=(l);i--)
#define pb          push_back
#define se          second
#define fi          first
#define mset(a, b)  memset(a, b, sizeof(a))

using LL  = long long;
using G   = vector<vector<int>>;

int di[] = {0, -1, 0, 1};
int dj[] = {1, 0, -1, 0};
// }}}

int dp[100001];

int main() {
    cin.tie(0);ios::sync_with_stdio(false);
    int n;cin >> n;
    vector<int> v = {6, 6*6, 6*6*6, 6*6*6*6, 6*6*6*6*6, 6*6*6*6*6*6, 
                     9, 9*9, 9*9*9, 9*9*9*9, 9*9*9*9*9};
    int m = v.size();
    dp[0] = 0;
    inc(i, 1, 100001){
        dp[i] = dp[i-1]+1;
        inc(j, 0, m){
            if(i-v[j] >= 0){
                dp[i] = min(dp[i], dp[i-v[j]]+1);
            }
        }
    }
    cout << dp[n] << endl;
    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ld long double
#define ll long long
#define P pair<int,int>
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<n;i++)
#define all(v) v.begin(),v.end()
#define pb push_back
#define eb emplace_back
template<class T>void chmax(T &a,T b){if(a<b)a=b;}
template<class T>void chmin(T &a,T b){if(a>b)a=b;}
constexpr int INF=1000000000000000000;
constexpr int mod=1000000007;
constexpr double eps=1e-8;
const double pi=acos(-1);
int dx[]={0,1,0,-1},dy[]={1,0,-1,0};
int Random(int mi,int ma){
    random_device rnd;
    mt19937 mt(rnd());//32bit
    //[mi,ma]
    uniform_int_distribution<int>engine(mi,ma);
    return engine(mt);
}
int gcd(int a,int b){
    if(b==0)return a;
    return gcd(b,a%b);
}
int lcm(int a,int b){
    return a/gcd(a,b)*b;
}
bool prime(int a){
    if(a==1)return false;
    for(int i=2;i*i<=a;i++){
        if(a%i==0)return false;
    }
    return true;
}
int modpow(int a,int b){
    if(b==0)return 1;
    if(b%2)return modpow(a,b-1)*a%mod;
    int memo=modpow(a,b/2);
    return memo*memo%mod;
}
vector<int>kaijo,invkaijo;
void init_fact(int n){
    kaijo.resize(n+1);
    invkaijo.resize(n+1);
    kaijo[0]=1;
    for(int i=1;i<=n;i++){
        kaijo[i]=kaijo[i-1]*i;
        kaijo[i]%=mod;
    }
    rep(i,n+1)invkaijo[i]=modpow(kaijo[i],mod-2);
}
int comb(int a,int b){
    if(a<b)return 0;
    if(a<0||b<0)return 0;
    return kaijo[a]*modpow(kaijo[a-b],mod-2)%mod*modpow(kaijo[b],mod-2)%mod;
}
int inv(int x){
    x=modpow(x,mod-2);
    return x;
}

signed main(){
    cin.tie(0);ios::sync_with_stdio(false);
    int a,b;
    cin>>a>>b;
    cout<<a*b<<endl;
    return 0;
}

Measured memory_bytes: 3648
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
int main()
{
	ios_base :: sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int x = 0, n, fv = 0;
	cin >> n;
	for(int i=0; i<n; i++){
		char s;
		cin >> s;
		if(s=='I') x++;
		else x--;
		fv = max(x, fv);
		//cout << x << " " << fv << endl;
	}
	cout << fv << endl;
	return 0;
}


Measured memory_bytes: 3604
n = int(input())
pointx = []
pointy = []
for i in range(n):
    x, y = list(map(int, input().split()))
    pointx.append(x)
    pointy.append(y)


length = [[0]*n for _ in range(n)]
for i in range(n):
    for j in range(n):
        length[i][j] = ((pointx[i]-pointx[j])**2 + (pointy[i]-pointy[j])**2)**(1/2)

total = sum([sum([length[i][j] for i in range(n)]) for j in range(n) ])
print(total/(n**2-n)*(n-1))
    

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
#define _LIBCPP_DEBUG 0

using namespace std;
#define ll long long
#define rep(i,n) for (int i = 0; i < n; i++)
#define MOD (1000000007)
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int, int>
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()

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

int gcd(int a, int b) {
    if (b == 0) return a;
    else return gcd(b, a % b);
}

const ll INF = 1LL << 60;

int main(){
  int n,m; cin >> n >> m;
  vvi S(m);
  rep(i, m){
    int k; cin >> k;
    rep(j, k){
      int s; cin >> s; s--;
      S[i].pb(s);
    }
  }

  vi p(m); rep(i, m) cin >> p[i];

  int ans = 0;
  rep(bit, (1<<n)){
    bool ok = true;
    rep(i, m){
      int sum = p[i];
      for(int s : S[i]) if(bit & (1<<s)) sum ^= 1;
      if(sum) ok = false;
    }
    if(ok) ans++;
  }
  std::cout << ans << '\n';
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>
#include <tuple>
#include <unordered_map>

using namespace std;

struct Program {
  int s, t, c;
};

int main()
{
  int N, C;
  cin >> N >> C;

  unordered_map<int, tuple<vector<int>, vector<int>>> times;
  vector<Program> programs(N);
  for (int n = 0; n < N; ++n) {
    int s, t, c;
    cin >> s >> t >> c;
    --c;

    auto time = times.find(s);
    if (time == times.end()) {
      times[s] = make_tuple(vector<int>(), vector<int>());
    }
    get<0>(times[s]).push_back(c);

    time = times.find(t);
    if (time == times.end()) {
      times[t] = make_tuple(vector<int>(), vector<int>());
    }
    get<1>(times[t]).push_back(c);
  }

  for (auto& itor: times) {
    auto& time = itor.second;
    auto& starts = get<0>(time);
    auto& ends = get<1>(time);
    for (int i = starts.size(); i != 0;) {
      --i;
      for (int j = ends.size(); j != 0;) {
        --j;
        if (starts[i] == ends[j]) {
          starts.erase(starts.begin() + i);
          ends.erase(ends.begin() + j);
        }
      }
    }
  }

  vector<int> timepoints;
  timepoints.reserve(times.size());
  for (const auto& t: times) timepoints.push_back(t.first);
  sort(timepoints.begin(), timepoints.end());

  int max_recorders = 0;
  int recorders = 0;
  for (int i = 0; i < timepoints.size(); ++i) {
    int t = timepoints[i];
    // cerr << t << ":" << endl;

    const auto& starts = get<0>(times[t]);
    // cerr << "  start:";
    for (int s = 0; s < starts.size(); ++s) {
      ++recorders;
      if (max_recorders < recorders) max_recorders = recorders;
      // cerr << " " << (starts[s] + 1);
    }
    // cerr << endl;
    // cerr << "max_recorders: " << max_recorders << endl;

    const auto& ends = get<1>(times[t]);
    // cerr << "  end:";
    for (int e = 0; e < ends.size(); ++e) {
      --recorders;
      // cerr << " " << (ends[e] + 1);
    }
    // cerr << endl;
  }

  cout << max_recorders << endl;
  return 0;
}

Measured memory_bytes: 16804
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define ALL(A) A.begin(), A.end()

using namespace std;

typedef long long ll;
typedef pair<int, int> P;

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

	int A[3] = {0};
	rep (i, 3) cin >> A[i];

	set<tuple<ll,ll,ll> > same; same.clear();

	int ans = 0;
	while(A[0] % 2 == 0 && A[1] % 2 == 0 && A[2] % 2 == 0){
		int nA[3] = {0};
		rep (i, 3){
			nA[i] = (A[(i+1)%3] + A[(i+2)%3]) / 2; 
		} // end rep

		sort(nA, nA + 3);

		tuple<int,int,int> next = make_tuple(nA[0], nA[1], nA[2]);
		if (same.count(next)){
			ans = -1;
			break;
		}else{
			same.insert(next);
			++ans;
			rep (i, 3) A[i] = nA[i];
		} // end if
	} // end while

	cout << ans << endl;

	return 0;
}

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

int main(){
 double x1,x2,y1,y2;
 cin >> x1 >> y1 >> x2 >> y2;
 double distance=sqrt(pow(x1-x2,2)+pow(y1-y2,2));

 cout << fixed << setprecision(16) << distance << endl;
 return 0;
}

Measured memory_bytes: 3276
import java.util.InputMismatchException;
import java.util.Scanner;

public class Main
    {
        public static void main (String[] args)
            {
                Scanner scanner = new Scanner(System.in);

                try
                    {
                        int inputA = scanner.nextInt();
                        int inputB = scanner.nextInt();

                        if (inputA > inputB)
                            {
                                System.out.println("a > b");
                            }
                        else if (inputA < inputB)
                            {
                                System.out.println("a < b");
                            }
                        else
                            {
                                System.out.println("a == b");
                            }
                    }
                catch (InputMismatchException e)
                    {
                        System.out.println("整数を入力してください");
                        e.printStackTrace();
                    }
            }
    }

Measured memory_bytes: 17160
//#define DEB1 //input from input.txt
//#define NDEBUG
#include <iostream>
#include <algorithm>
#include <string>
#include <fstream>
#include <vector>
#include <cstdio>
#include <cmath>
#include <queue>
#include <stack>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <thread>
#include <mutex>
#include <iomanip>
#include <cassert>

#define ZERO(a) memset(a, 0, sizeof(a))
#define MINUS(a) memset(a, 0xff, sizeof(a))
#define INF(a) memset(a, 0x3f, sizeof(a))
#define ALL(t) (t).begin(),(t).end()
#define FILL(a,c) fill(a, a+ sizeof(a)/sizeof(*a),c)
#define FILL2D(A,c) fill(A[0], A[0] +sizeof(A)/sizeof(**A),c)
#define FILL3D(A,c) fill(A[0][0], A[0][0] +sizeof(A)/sizeof(***A),c)
#define REP(i,m) for(int i=0;i<(m);++i)
// closed interval, inverse repeat
#define CIREP(i,start,fin) for(int i=(start);i>=(fin);i--)
#define CREP(i,start,fin) for(int i=(start);i<=(fin);i++)
#define RNG(i,start,fin) for(int i=(start);i<(fin);i++)
#define IN(a, x, b) (a<=x && x<b)
#define PB push_back
#define SZ(x) (int)(x).size()

using namespace std;

using LL = long long;
using PAIR = pair<int, int>;
using PAIRLL = pair<LL,LL>;
using VI = vector<int>;
using VLL = vector<LL>;
using VVLL = vector<VLL>;
using VVI = vector<VI>;
const LL LINF = 1001002003004005006ll;
/* 
template<typename T>inline istream& operator>>(istream&i,vector<T>&v)
{REP(j,SZ(v))i>>v[j];return i;}

template<typename T>string join(const vector<T>&v)
{stringstream s;REP(i,SZ(v))s<<' '<<v[i];return s.str().substr(1);}

template<typename T>inline ostream& operator<<(ostream&o,const vector<T>&v)
{if(SZ(v))o<<join(v);return o;}
*/

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




/*
constant values
*/

//const int dx[] = {1,0,-1,0};
//const int dy[] = {0,1,0,-1};
//const int MX = 31001;

//const ll INF= 1LL<<60 ;//INF = 1001001001001; //1e9


// Main program
void solve(){
    int N;
    cin >> N;
    LL res =0;
    CREP(i,1,N){
        int a = i%3;
        int b= i%5;
        if(a!=0 && b != 0){
            res += i;
            //cerr << i << endl;
        }
    }
    cout << res << endl;
    return;
}



// ----------------------------------------------
int main(){

#ifdef DEB1
    cout << "DEBUG MODE"  << endl;
    ifstream in("input.txt"); //for debug
    cin.rdbuf(in.rdbuf()); //for debug
#endif

    int T=1; 

    for (int i = 0; i < T; ++i) {
        solve();
    }

    return 0;
}

Measured memory_bytes: 3636
n = int(input())
c = list(input())
sc = list(reversed(c))
ans = 0
r = 0
flg  = False

if 'W' not in set(c) or 'R' not in set(c):
    print(ans)


else:
    for i in range(n):
        if flg:
            break
        if c[i] == 'W':
            for j in range(r, n):
                r += 1
                if sc[j] == 'R':
                    if n >= i+j+2:
                        c[i] = 'R'
                        c[-1*j-1] = 'W'
                        ans += 1
                        break
                    else:
                        flg = True
                        break

                
            

    print(ans)

Measured memory_bytes: 79076
import sys
def rs(): return sys.stdin.readline().rstrip()
def ri(): return int(rs())
def rs_(): return [_ for _ in rs().split()]
def ri_(): return [int(_) for _ in rs().split()]

N = ri()
a = ri_()
ans = 0
for i in range(N):
    if (i + 1) % 2 == 1 and a[i] % 2 == 1:
        ans += 1
print(ans)

Measured memory_bytes: 9180
from functools import reduce


def count_factors(a, factor):
    count = 0
    while a % factor == 0:
        count += 1
        a //= factor
    return count


def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)


def lcm(a, b):
    return a * b // gcd(a, b)


if __name__ == "__main__":
    n, m = map(int, input().split())
    a = list(set(map(lambda x: int(x) // 2, input().split())))
    num_of_two = count_factors(a[0], 2)
    for ai in a[1:]:
        if count_factors(ai, 2) != num_of_two:
            print(0)
            exit()

    a_lcm = reduce(lambda x, y: lcm(x, y), a)
    if a_lcm > m:
        print(0)
        exit()

    print((m // a_lcm + 1) // 2)


Measured memory_bytes: 11760
program main
  implicit none
  integer::n
  !integer,allocatable::
  character(200)::s

  read(*,*)n
  read(*,*)s

  if(mod(n,2)==0.and.s(1:n/2)==s(n/2+1:2*n)) then
    write(*,*) 'Yes'
  else
    write(*,*) 'No'
  end if
  stop
end program


Measured memory_bytes: 256
parseInt(x) = parse(Int, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)
function main()
    n=parseInt(readline())
    p=parseMap(split(readline()))
    cnt=0
    for i in 1:n
        if p[i]!=i
            cnt+=1
        end
    end
    println(ifelse(cnt<=2,"YES","NO"))
end
main()

Measured memory_bytes: 168724
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;
int N,Y;
int main(){
  cin >> N >> Y;
  for(int i=0;i<=N;i++){
    for(int j=0;i+j<=N;j++){
      int k=N-i-j;
      int ans;
      ans=10000*i+5000*j+1000*k;
      if(ans==Y){
	printf("%d %d %d\n",i,j,k);
	return 0;
      }
    }
  }
  printf("-1 -1 -1\n");
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin>>n;
	int a[n];
	for(int i = 0; i<n; i++){
		cin>>a[i];
	}
	sort(a, a+n);
	float sum = (float)(a[0] + a[1])/2;
	for(int i = 2; i<n; i++){
		sum = (float)((sum + a[i])/2);
	}
	cout<<sum<<"\n";
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define cmin(a,b) (a>(b)?a=(b),1:0)
#define cmax(a,b) (a<(b)?a=(b),1:0)
#define dmin(a,b) ((a)<(b)?(a):(b))
#define dmax(a,b) ((a)>(b)?(a):(b))
namespace io
{
	int F()
	{
		 int F=1,n=0;
		 char ch;
		 while((ch=getchar())!='-'&&(ch<'0'||ch>'9'));
		 ch=='-'?F=0:n=ch-'0';
		 while((ch=getchar())>='0'&&ch<='9')n=n*10+ch-'0';
		 return F?n:-n;
	}
	long long G()
	{
		 long long F=1,n=0;
		 char ch;
		 while((ch=getchar())!='-'&&(ch<'0'||ch>'9'));
		 ch=='-'?F=0:n=ch-'0';
		 while((ch=getchar())>='0'&&ch<='9')n=n*10+ch-'0';
		 return F?n:-n;
	}
}
int R(int l,int r)
{
	return (rand()<<15|rand())%(r-l+1)+l;
}
const int M=998244353;
char s[3333]; 
int b[4444][4444],f[4444][4444];
int sub[5][2]={{'3',0},{'4','3'},{0,'4'}};
int main()
{
	scanf("%s",s+1);
	int n=strlen(s+1);
	int R=0,B=0;
	for(register int i=1;i<=n;++i)
	{
		if(s[i]=='0')R+=2;
		if(s[i]=='1')++R,++B;
		if(s[i]=='2')B+=2;
	}
	int x=0,y=0;
	while(1)
	{
		int pl=0;
		for(register int i=1;i<=n;++i)
			if(s[i]=='0'||s[i]=='2'){pl=i;break;}
		if(pl==0)break;
		if(s[pl]=='0')
		{
			b[x][y+pl]=1;
			s[1]=sub[s[1]-'0'][0];
			++x;
		}
		else
		{
			b[x+pl][y]=1;
			s[1]=sub[s[1]-'0'][1];
			++y;
		}
		for(register int i=1;i<n;++i)
		{
			if(s[i]=='3')
			{
				if(s[i+1]!='0'&&s[i+1]!='3')s[i]='1',s[i+1]=sub[s[i+1]-'0'][1];
					else s[i]='0',s[i+1]=sub[s[i+1]-'0'][0];
			}
			else
			{
				if(s[i+1]!='2'&&s[i+1]!='4')s[i]='1',s[i+1]=sub[s[i+1]-'0'][0];
					else s[i]='2',s[i+1]=sub[s[i+1]-'0'][1];
			}
		}
		if(!s[n])--n;
	}
	f[0][0]=1;
	for(register int i=0;i<=R;++i)
		for(register int j=0;j<=B;++j)
			if(b[i][j]==0)
			{
				if(i)f[i][j]=(f[i][j]+f[i-1][j])%M;
				if(j)f[i][j]=(f[i][j]+f[i][j-1])%M;
			}
	printf("%d\n",f[R][B]);
	return 0;
}


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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 998244353;
#define REP(i,n) for(int i=0;i<(int)n;++i)

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
  os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
  for(int i = 0; i < v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
  for(int i = 0; i < v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}

ll fact(ll x){
	if(x==0) return 1;
	return x*fact(x-1)%mod;
}

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

    ll N;
    string S;
    cin >> N >> S;
    map<ll, ll> mp = {{'R', 0}, {'G', 1}, {'B', 2}};

    ll res = 1;
    vector<ll> cnt(3, 0);
    REP(i, 3*N){
    	ll idx = mp[S[i]];
    	ll ot1 = (idx+1)%3, ot2 = (idx+2)%3;
    	if(cnt[idx] < cnt[ot1] && cnt[idx] < cnt[ot2]){
    		res *= (min(cnt[ot1], cnt[ot2]) - cnt[idx]);
    	}else if(cnt[idx] < cnt[ot1]){
    		res *= (cnt[ot1] - cnt[idx]);
    	}else if(cnt[idx] < cnt[ot2]){
    		res *= (cnt[ot2] - cnt[idx]);
    	}
    	res %= mod;
    	cnt[idx]++;
    	//cout << cnt << endl;
    }
    cout << res * fact(N) % mod << endl;
    return 0;
}

Measured memory_bytes: 2196
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>

using namespace std;

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

	string s, t;
	cin >> s >> t;

	string ans;

	for (int i = 0; i < n; i++) {
		ans += s[i];
		ans += t[i];
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
typedef unsigned long long int ulli;
#define vec(s) vector
;
#define vvec(s) vector<vector
> ;
typedef vector<lli> vi;
typedef vector<vi> vvi;
typedef pair<lli,lli> pii;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define YN(x) cout<<(bool x?"Yes":"No")<<endl;
#define out(s) cout<<s<<endl;
#define pb(s) push_back(s);
#define sp " ";
#define INF 10000000000
#define all(s) s.begin(),s.end()
void vout(vector<int> v){
    for(int i=0;i<v.size();i++)
    cout<<v.at(i)<<endl;
}
int main(){
    lli x,y;
    cin>>x>>y;
    lli ma=x*4,mi=x*2;
    if(ma>=y&&mi<=y&&y%2==0){
        out("Yes");
    }
    else{
        out("No");
    }
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=(a);i<=(b);++i)
#define rrep(i,a,b) for(int i=(a);i>=(b);--i)
#define PB push_back
typedef long long LL;
const LL P = 998244353;
const int INF = 0x3fffffff;
const int N = 1005;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

char s[110];
LL k,ans; 

int main(){
	cin>>(s+1)>>k;
	int n = strlen(s+1), cnt = 0;
	rep(i,1,n) s[i+n] = s[i];
	rep(i,2,n) if(s[i]==s[i-1]){
		++cnt; s[i] = -1;
	}
	if(s[1]!=s[n]){
		cout<<k*cnt<<endl;
	}else{
		int cnt2 = 0;
		rep(i,n+1,2*n)if(s[i]==s[i-1]){
			++cnt2; s[i] = -1;
		}
		if(s[2*n]!=s[1]){
			cout<<k/2*(cnt+cnt2)+(k%2?cnt:0)<<endl;
		}else{
			cout<<cnt2*(k-1)+cnt<<endl;
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include <iostream> 
#include <algorithm> 
#include<string>
#include<queue>
#include<utility>
#include<fstream>
#include<queue>
#include<set>
#include<stack>
#include<bits/stdc++.h>
#define ll long long int
#define ull unsigned long long int
#define I(a) scanf("%d",&a)
#define I2(a,b) scanf("%d%d",&a,&b)
#define I3(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define L(a) scanf("%lld",&a)
#define L2(a,b) scanf("%lld%lld",&a,&b)
#define L3(a,b,c) scanf("%lld%lld%lld",&a,&b,&c)
#define PI(a) printf("%d",a)
#define PL(a) printf("%lld",a)
#define PT(t) printf("Case %d: ",t)
#define PB push_back
#define x first
#define y second
#define xx first.first
#define xy first.second
#define yx second.first
#define yy second.second
#define SC scanf
#define PC printf
#define NL printf("\n")
#define SET(a) memset(a,0,sizeof a)
#define SETR(a) memset(a,-1,sizeof a)
#define SZ(a) ((int)a.size())-1
#define f(i,a,b) for(int i=a;i<=b; i++)
#define fr(i,a,b) for(int i=a;i<=b; i++)
#define frr(i,a,b) for(int i=a;i>=b; i--)
#define frv(i,a)  for(int i=0;i<a.size();i++)
#define pi 2.0*acos(0.0)
#define R(a) freopen(a, "r", stdin);
#define W(a) freopen(a, "w", stdout);
#define CB(x) __builtin_popcount(x)
#define STN(a) stringtonumber<ll>(a)
#define lol printf("BUG\n")
#define Endl "\n"
#define mk make_pair
using namespace std;
template <class T> inline T BM(T p, T e, T M)
{
    ll ret = 1;
    for(; e > 0; e >>= 1)
    {
        if(e & 1) ret = (ret * p) % M;
        p = (p * p) % M;
    }
    return (T)ret;
}
template <class T> inline T gcd(T a, T b)
{
    if(b == 0)return a;
    return gcd(b, a % b);
}
template <class T> inline T mdINV(T a, T M)
{
    return BM(a, M - 2, M);
}
template <class T> inline T PW(T p, T e)
{
    ll ret = 1;
    for(; e > 0; e >>= 1)
    {
        if(e & 1) ret = (ret * p);
        p = (p * p);
    }
    return (T)ret;
}
 
 
template <class T>bool ISLEFT(T a, T b, T c)
{
    if(((a.xx - b.xx) * (b.yy - c.yy) - (b.xx - c.xx) * (a.yy - b.yy)) < 0.0)return 1;  //Uporer dike //A,b,c, x okkher ordera sorted
    else return 0;
}
 
 
typedef pair<int,int >P;
//////////////////////////
/////////////////////////
int main(){

    string s;
    int cnt =0;
    cin>>s;
    int ans = 0;
    for(int i=0;i<s.size();i++){
        if(s[i] == 'R')cnt++;
        else {
            
            ans = max(ans, cnt);
            cnt = 0;
        }
    }
    ans = max(ans, cnt);
    cout<<ans<<endl;
    return 0;
}

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

int main(){
  string s;
  cin >> s;
  int v=0,maxi=-100;
  FOR(i,s.size()){
    if(s[i]=='A' || s[i]=='C' || s[i]=='G' || s[i]=='T'){
      v++;
    }else{
      v=0;
    }
    if(maxi<v){
      maxi=v;
    }
  }
  cout << maxi << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,a,b) for(int i=(a);i<(b);i++)
#define RREP(i,a,b) for(int i=(a);i>=(b);i--)
#define pq priority_queue
#define P pair<ll,int>
#define P2 pair<int,P>
#define P3 pair<int,P2>
typedef long long ll; typedef long double ld;
using namespace std;
const int INF=1e9, MOD=1e9+7, around[]={0,1,1,-1,-1,0,-1,1,0,0};
const ll LINF=1e18;
const ld PI=abs(acos(-1));

ll h,w,n;
vector<P> vec;

bool ch(int x, int y){
	if(x == h) return true;
	if(x == 0) return true;
	if(y == w) return true;
	if(y == 0) return true;
	return false;
} 

ll f(int x, int y){
	if(x == 0){
		return (ll)y;
	}else if(x == h){
		return (ll)INF + (ll)INF + (ll)w - (ll)y;
	}else if(y == 0){
		return (ll)INF + (ll)INF + (ll)INF + (ll)h - (ll)x;
	}else if(y == w){
		return (ll)INF + (ll)x;
	}
}

int main(){
	cin >> h >> w >> n;
	int c = 0;
	REP(i,0,n){
		int x,y,xx,yy; cin >> x >> y >> xx >> yy;
		if(ch(x, y) and ch(xx, yy)){
			vec.push_back({f(x, y), c});
			vec.push_back({f(xx, yy), c++});
		}
	}
	sort(vec.begin(), vec.end());
	
	stack<int> st;
	REP(i,0,vec.size()){
		if(!st.empty() and st.top() == vec[i].second) st.pop();
		else st.push(vec[i].second);
	}
	
	if(st.empty()) cout << "YES" << endl;
	else cout << "NO" << endl;
	return 0;
}


Measured memory_bytes: 6384
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<iostream>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<cmath>
#include<string>

#define ls (t<<1)
#define rs ((t<<1)+1)
#define mid ((l+r)>>1)
#define fi first
#define se second
#define mk make_pair
#define pb push_back

#define N 5010
#define M 200005
#define seed 23333

using namespace std;
const long long inf=1e17;
int i,j,m,n,p,k;
long long ans;
struct Node{
	int l,r,len;
}a[N];
long long f[N][N/2],g[N][N/2];
inline int cmp(Node a,Node b)
{
		return a.len<b.len;
}
void Max(long long &x,long long y)
{
		if (x>y) x=y;
}
long long work(int lim)//we have x in the left,and the left number is n/2 or n/2-1 just
{
		memset(f,60,sizeof(f));
		memset(g,60,sizeof(g));
		f[0][0]=0;
		for (i=0;i<n;++i)
			for (j=0;j<=min(i,lim);++j)
				if (f[i][j]<inf)
				{
						Max(f[i+1][j],f[i][j]-a[i+1].l+1ll*a[i+1].len*(n-lim-1-(i-j)-1));
						Max(f[i+1][j+1],f[i][j]+a[i+1].r+1ll*a[i+1].len*(lim-j-1));
				}
		g[n+1][0]=0;
		for (i=n+1;i>1;--i)
			for (j=0;j<=lim;++j)
				if (g[i][j]<inf)
				{
						Max(g[i-1][j],g[i][j]-a[i-1].l+1ll*a[i-1].len*((n-i+1)-j));
						Max(g[i-1][j+1],g[i][j]+a[i-1].r+1ll*a[i-1].len*j);
				}
		long long ans=inf;
		for (i=1;i<=n;++i)
		{
				long long s=inf;
				for (j=0;j<=lim;++j) s=min(s,f[i-1][j]+g[i+1][lim-j]);
				ans=min(ans,s-1ll*a[i].l*lim+1ll*a[i].r*(n-lim-1));
		}
		return ans;
}
int main()
{
	scanf("%d",&n); 
	for (i=1;i<=n;++i) scanf("%d%d",&a[i].l,&a[i].r),a[i].l=-a[i].l,a[i].len=a[i].r-a[i].l;	
	sort(a+1,a+n+1,cmp);
	ans=work(n/2);
	if (n%2==0) ans=min(ans,work(n/2-1));
	cout<<ans<<endl;
}


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

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

template<class T> inline T sqr(T x) {return x*x;}

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef unsigned long long ULL;

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

const double EPS = 1e-10;
const double PI  = acos(-1.0);

#define CLR(a) memset((a), 0 ,sizeof(a))

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

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

int main() {
  int c[3], n;

  while(cin >> c[0] >> c[1] >> c[2], c[0]+c[1]+c[2]) {
    sort(c, c+3);
    int size = sqrt(c[0]*c[0] + c[1]*c[1]);
    cin >> n;
    REP(i, n) {
      int r;
      cin >> r;
      if(2*r > size) cout << "OK" << endl;
      else cout << "NA" << endl;
    }
  }
}

Measured memory_bytes: 1172
#include <bits/stdc++.h>
using namespace std;
int main () {
	int n;
	cin>>n;
	for (int i=1;i<=9;i++)for(int j=1;j<=9;j++){
		if(n==i*j){
			puts("Yes");
			return 0;
		}
	}
	puts("No");
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ALL(obj) (obj).begin(), (obj).end()
#define REP(i, n) for(int i = 0;i < (n);++i)
#define RREP(i, n) for(int i = (n)-1; i >= 0; --i)
#define RANGE(i, a, b) for(int i=(a);i<(b);++i)

#define endl '\n'
#define pb push_back
#define eb emplace_back
#define pque priority_queue
#define umap unordered_map
#define uset unordered_set
#define BIG 2000000000
#define VERYBIG 1000000000000000ll
#define PI 3.1415926
#define coutdb cout<<fixed<<setprecision(15)

const int dx[]={1,0,-1,0,1,1,-1,-1}, dy[]={0,-1,0,1,1,-1,1,-1};
const long long MOD = 1e9+7;

// typedef int_fast64_t ll;
#define int long long

template<typename T> inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template<typename T> inline T LCM(T a,T b){T c=GCD(a,b);a/=c;return a*b;}
template<typename T> inline T nCr(T a,T b){T i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
template<typename T> inline T nHr(T a,T b){return nCr(a+b-1,b);}
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}

typedef pair<int, int> INTP;
typedef vector<int> INTV;
struct edge2 {int to, cost;};
struct edge3 {int from, to, cost;};

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

  int N, A[100000]; cin >> N;
  int allxor = 0;
  REP(i, N){
    cin >> A[i];
    allxor ^= A[i];
  }
  REP(i, N) A[i] &= ~allxor;

  int rank = 0;
  for(int i = 59; i >= 0; i--){
    int j;
    for(j = rank; j < N; j++){
      if(A[j] & (1ll << i)) break;
    }
    if(j == N) continue;
    if(j > rank) A[rank] ^= A[j];
    for(j = rank+1; j < N; j++){
      chmin(A[j], A[j] ^ A[rank]);
    }
    rank++;
  }
  int ans = 0;
  REP(i, N){
    chmax(ans, ans ^ A[i]);
  }
  ans *= 2; ans += allxor;
  cout << ans << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i) = 0; (i) < (n); ++(i))
#define rrep(i,n) for(int (i) = (n) - 1; (i) >= 0; --(i)) //Reversi rep
#define nfor(i,a,b) for(int (i) = (a); (i) < (b); ++(i)) //Natural for
#define rfor(i,a,b) for(int (i) = (b); (i) >= (a); --(i)) //Reversi for
#define ll long long
#define mod (1000000007)
#define YES cout << "YES" << endl;
#define Yes cout << "Yes" << endl;
#define NO cout << "NO" << endl;
#define No cout << "No" << endl;

int asc(const void *a, const void *b) {
    return *(int *)a - *(int *)b;
}

int desc(const void *a, const void *b) {
    return *(int *)b - *(int *)a;
}

int main()
{
    int h,w;
    cin >> h >> w;
    string a[h];
    rep(i, h)cin >> a[i];
    rep(i, h + 2){
        if (i == 0 || i == h + 1) {
            rep(j, w + 2)cout << "#";
            cout << endl;
        }else{
            cout << "#" << a[i - 1] << "#" << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
#ABC66 C

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

color = [False]*8
ans = 0
change = 0
for i in a:
    if 1 <= i <= 399 and not color[0]:
        color[0] = True
        ans += 1
    elif 400 <= i <= 799 and not color[1]:
        color[1] = True
        ans += 1
    elif 800 <= i <= 1199 and not color[2]:
        color[2] = True
        ans += 1
    elif 1200 <= i <= 1599 and not color[3]:
        color[3] = True
        ans += 1
    elif 1600 <= i <= 1999 and not color[4]:
        color[4] = True
        ans += 1
    elif 2000 <= i <= 2399 and not color[5]:
        color[5] = True
        ans += 1
    elif 2400 <= i <= 2799 and not color[6]:
        color[6] = True
        ans += 1
    elif 2800 <= i <= 3199 and not color[7]:
        color[7] = True
        ans += 1
    elif 3200 <= i:
        change += 1
if ans == 0:
    print(1,change)
else:
    print(ans,ans + change)


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

int main() {
	int N;
    cin >> N;
    int A, count;
    int Max = 30;
    for(int i = 0; i < N; i++){
        cin >> A;
        count = 0;
        while(A % 2 == 0){
        	A /= 2;
            count++;
        }
        if(Max > count){
        	Max = count;
        }
    }
    cout << Max << endl;
}


Measured memory_bytes: 3560
#include <iostream>
#include <cstdio>
using namespace std;
long long a, b, c, k;
long long ans;
int main() {
	scanf("%lld%lld%lld%lld", &a, &b, &c, &k);
	if (k >= a) {
		k -= a;
		ans += a;
		if (k >= b) {
			k -= b;
			if (k) {
				ans -= k;
			}
		}
	} else {
		ans += k;
	}
	cout << ans;
	return 0;
}

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

using namespace std;

#define int long long int
#define ld long double
#define F first
#define S second
#define P pair<int,int>
#define pb push_back

const int N = 100005;

void solve() {
	int i, j, k, n, m, ans = 0, cnt = 0, sum = 0;
	cin >> n;
	int a[n];
	int res[n];
	memset(res, 0, sizeof(res));
	for (i = 0; i < n - 1; i++) {
		cin >> a[i];
		res[a[i] - 1]++;
	}
	for (i = 0; i < n; i++) {
		cout << res[i] << '\n';
	}
	return ;
}

int32_t main()
{
	ios_base:: sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
	// int t; cin >> t; while (t--)
	solve();
	return 0;
}

Measured memory_bytes: 6740
import sys
input = sys.stdin.readline
from operator import itemgetter
import heapq
n, k = map(int, input().split())
TD = sorted([list(map(int, input().split())) for _ in range(n)], reverse=True, key=itemgetter(1))
L = [[] for _ in range(n+1)]
P = []
a = 0
cnt = 0
F = [-float("inf")]*(n+1)
for t, d in TD[:k]:
  L[t].append(d)
  if len(L[t]) == 1:
    a += 1
  cnt += d
F[a] = cnt
for i in range(1, n+1):
  while len(L[i]) > 1:
    heapq.heappush(P, L[i].pop())
now = k
for i in range(a, n):
  if len(P) == 0:
    break
  while now < n and L[TD[now][0]]:
    now += 1
  if now == n:
    break
  t, d = TD[now]
  L[t].append(d)
  F[i+1] = F[i] - heapq.heappop(P) + d
ans = 0
for i in range(a, n+1):
  ans = max(ans, F[i] + i*i)
print(ans)

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

using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define ll long long int

int main(){
  int n;
  cin>>n;
  rep(i,9){
    if(n>i*100+i*10+i&&n<=(i+1)*100+(i+1)*10+i+1){
      cout<<(i+1)*100+(i+1)*10+i+1<<endl;
    }


  }



  return 0;
}


Measured memory_bytes: 256
#include <cctype>
#include <cstring>
#include <iostream>

using namespace std;

int main() {
  char str1[201];
  char str2[101];
  cin >> str1 >> str2;
  char str1_2[101];
  strcpy(str1_2, str1);
  strcat(str1, str1_2);

  if (strstr(str1, str2) == NULL) {
    cout << "No" << endl;
  } else {
    cout << "Yes" << endl;
  }

  return 0;
}


Measured memory_bytes: 3116
#include<bits/stdc++.h>
using namespace std;
#ifdef LOCAL_DEBUG
  #include "LOCAL_DEBUG.hpp"
#endif
#define int long long

signed main(){

  int n; cin >> n;
  map<string, int> mp;
  for(int i = 0; i < n; i++){
    string s; cin >> s;
    mp[s]++;
  }

  int Max = 0;
  for(auto p : mp){
    Max = max(Max, p.second);
  }

  vector<string> v;
  for(auto p : mp){
    if(p.second == Max) v.push_back(p.first);
  }
  sort(v.begin(),v.end());

  for(int i = 0; i < v.size(); i++){
    cout << v[i] << endl;
  }

  return 0;
}


Measured memory_bytes: 26868
#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 reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit32(x) (1 << (x))
#define bit64(x) (1ll << (x))
#define sz(v) ((int) v.size())

using namespace std;

using i64 = long long;
using f80 = long double;
using vi32 = vector<int>;
using vi64 = vector<i64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << endl; exit(0); }
inline void no() { cout << "No" << endl; exit(0); }
inline i64 gcd(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); if (a % b == 0) return b; return gcd(b, a % b); }
inline i64 lcm(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); return a / gcd(a, b) * b; }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> inline void amax(T &x, T y) { x = max(x, y); }
template <typename T> inline void amin(T &x, T y) { x = min(x, y); }
template <typename T> inline T exp(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { each(x, v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }

void solve() {
  i64 n, k;
  cin >> n >> k;
  vi32 a(n);
  cin >> a;
  sort(all(a));
  // {
  //   vi64 v;
  //   rep(i, n) rep(j, i) {
  //     v.push_back((i64) a[i] * a[j]);
  //   }
  //   sort(all(v));
  //   cerr << v << endl;
  //   cerr << v[k - 1] << endl;
  // }
  i64 ok = -2e18;
  i64 ng = 2e18;
  while (abs(ok - ng) > 1) {
    i64 x = (ok + ng) / 2;
    i64 cnt = 0;
    rep(i, n) {
      if (a[i] == 0) {
        if (x <= 0) {
          cnt += n - i - 1;
        }
        continue;
      }
      if (x >= 0) {
        i64 y = (x + abs(a[i]) - 1) / a[i];
        if (a[i] > 0) {
          i64 c = a.end() - lower_bound(all(a), y);
          cnt += min(c, n - i - 1);
        } else if (a[i] < 0) {
          i64 c = upper_bound(all(a), y) - a.begin();
          cnt += max(0ll, c - i - 1);
        }
      } else {
        i64 y = x / a[i];
        if (a[i] > 0) {
          i64 c = a.end() - lower_bound(all(a), y);
          cnt += min(c, n - i - 1);
        } else if (a[i] < 0) {
          i64 c = upper_bound(all(a), y) - a.begin();
          cnt += max(0ll, c - i - 1);
        }
      }
    }
    cnt = n * (n - 1) / 2 - cnt;
    (cnt < k ? ok : ng) = x;
  }
  cout << ok << endl;
}


Measured memory_bytes: 1024
let rec calc i cum n =
  if i > n
  then cum
  else 
    if i mod 3 <> 0 && i mod 5 <> 0
    then calc (i+1) (cum+i) n
    else calc (i+1) (cum) n


let () = Printf.printf "%d\n" @@ Scanf.scanf "%d" (calc 1 0)


Measured memory_bytes: 3840
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <functional>
#include <stack>
#include <iomanip>
#include <limits>
using namespace std;
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
using Graph=vector<vector<int>>;
using edge= struct{int to;ll cost;};


template<class t,class u> void chmax(t&a,u b){if(a<b)a=b;}
template<class t,class u> void chmin(t&a,u b){if(b<a)a=b;}
using Graph =vector<vector<int>>;
//xor


int main(){
  int N;cin>>N;
  int X,Y;cin>>X>>Y;
  X--,Y--;
  int data[N][N];
  int kk[N];
  REP(i,N){
    kk[i]=0;
  }
  for(int i=0;i<N;i++){
    for(int j=0;j<N;j++){
      int root1=0;
      int root2=0;
      if(i==j){
        data[i][j]=0;
      }
      else if(j>i){
        if(j<=X){
          data[i][j]=j-i;
          kk[j-i]++;
        }
        else if(i>=Y){
          data[i][j]=j-i;
          kk[j-i]++;
        }
        else if(i<=X&&j>=X&&j<=Y){
          root1=j-i;
          root2=X-i+1+Y-j;
          if(root1>root2){
            data[i][j]=root2;
            kk[root2]++;
          }else{
            data[i][j]=root1;
            kk[root1]++;
          }
        }
        else if(i>=X&&j<=Y){
          root1=j-i;
          root2=i-X+1+Y-j;
          if(root1>root2){
            data[i][j]=root2;
            kk[root2]++;
          }else{
            data[i][j]=root1;
            kk[root1]++;
          }
        }
        else if(i<=Y&&j>=Y&&i>=X){
          root1=j-i;
          root2=i-X+1+j-Y;
          if(root1>root2){
            data[i][j]=root2;
            kk[root2]++;
          }else{
            data[i][j]=root1;
            kk[root1]++;
          }
        }
        else if(i<=X&&j>=Y){
          //
          root1=X-i+j-Y+1;
          root2=j-i;
          if(root1>root2){
            data[i][j]=root2;
            kk[root2]++;
          }else{
            data[i][j]=root1;
            kk[root1]++;
          }
        }
        else{
        }
      }else{
        data[i][j]=0;
      }
    }
  }
  for(int i=1;i<N;i++){
    cout<<kk[i]<<endl;
  }
}

Measured memory_bytes: 15872
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main{
	public static void main(String[] args)throws Exception{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String word = br.readLine();
		int[] count = new int [30];
		for(int i = 0 ; i < count.length ; i++){
			count[i] = 0;
		}
		
		for(int i = 0 ; i < word.length() ; i++){
			count[word.charAt(i) - 'a']++;
		}
		boolean result = true;
		for(int i = 0 ; i < count.length ; i++){
			result = result && count[i]%2==0;
		}
		
		System.out.println(result ? "Yes" : "No");
	}
}


Measured memory_bytes: 7636
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;
import java.util.List;

public class Main {
    public static Scanner sc = new Scanner(System.in);
    public static void main(String[] args) throws Exception {
        int n = sc.nextInt();
        long[] ary = new long[n];
        
        for (int i = 0; i < n; i++) {
            ary[n-1-i] = sc.nextLong();
        }
        
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < n; i++) {
            sb.append(ary[i]).append(" ");
        }
        sb.delete(sb.length()-1, sb.length());
        System.out.println(sb.toString());
    }
}

Measured memory_bytes: 26300
#include <iostream>
#include <vector>
#include <numeric>
#include <algorithm>
int n, d, a;
std::vector<std::pair<int, int>> m;
std::vector<int> c;
int main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    std::cin >> n >> d >> a;
    m.resize(n);
    c.resize(n);
    for (int i = 0; i < n; ++i) {
        int x, h;
        std::cin >> x >> h;
        h = (h + a - 1) / a;
        m[i] = {x, h};
    }
    std::sort(m.begin(), m.end());
    for (int i = 0, j = 0, sum = 0; i < n; ++i) {
        while (m[i].first - m[j].first > 2 * d) {
            sum -= c[j];
            ++j;
        }
        c[i] = std::max(0, m[i].second - sum);
        sum += c[i];
    }
    std::cout << std::accumulate(c.begin(), c.end(), 0LL) << "\n";
    return 0;
}

Measured memory_bytes: 2560
import math
import copy

def average(points):
    sum = 0
    for i in points:
        sum += i
    return sum / len(points)

outputs = []

while True:
    num = int(input())
    if num == 0:
        break

    points = []
    for _ in range(num):
        point = int(input())
        points.append(point)

    points = sorted(points)
    points = points[1:len(points)-1]

    ave = average(points)
    outputs.append(int(ave))

for ave in outputs:
    print(ave)

Measured memory_bytes: 8160
#include<iostream>
#include<cstdlib>
#include<cstring>
#include<stack>
#include<queue>
#include<algorithm>
#include<vector>
using namespace std;

typedef stack<int> IntStack;
typedef queue<int> IntQueue;

/*ここまでテンプレ*/



/*ここからmain関数*/

int main()
{
	int R, G, B, N;
	cin >> R >> G >> B >> N;

	int ans = 0;

	for (int i = 0; i <= N/R; i++)
	{
		for (int j = 0; j <= (N-R*i)/G; j++)
		{
			if ((N-R*i-G*j)%B==0)
			{
				ans++;
			}
		}
	}

	cout << ans;

	return 0;
}


Measured memory_bytes: 256
import sys
def Ii():return int(sys.stdin.readline())
def Mi():return map(int,sys.stdin.buffer.readline().split())
def Li():return list(map(int,sys.stdin.buffer.readline().split()))

n = Ii()
ac = 0
wa = 0
tle = 0
re = 0

for i in range(n):
  ip = input()
  if ip == 'AC':
    ac += 1
  elif ip == 'WA':
    wa += 1
  elif ip == 'TLE':
    tle += 1
  else:
    re += 1
    
print('AC','x',ac)
print('WA','x',wa)
print('TLE','x',tle)
print('RE','x',re)

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

int main()
{
	int N,M;
	cin >>N >>M;

	if(N==M){
		cout <<"Yes" <<endl;
	}
	else{
		cout <<"No" <<endl;
	}
}

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

using namespace std;

using ll = long long;

constexpr ll MOD = 1000000007;

#ifndef ONLINE_JUDGE
template <class T, class U>ostream &operator<<(ostream &o, const map<T, U>&obj) {o << "{"; for (auto &x : obj) o << " {" << x.first << " : " << x.second << "}" << ","; o << " }"; return o;}
template <class T>ostream &operator<<(ostream &o, const set<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const multiset<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const vector<T>&obj) {o << "{"; for (int i = 0; i < (int)obj.size(); ++i)o << (i > 0 ? ", " : "") << obj[i]; o << "}"; return o;}
template <class T, class U>ostream &operator<<(ostream &o, const pair<T, U>&obj) {o << "{" << obj.first << ", " << obj.second << "}"; return o;}
template <template <class tmp>  class T, class U> ostream &operator<<(ostream &o, const T<U> &obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr)o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
void print(void) {cout << endl;}
template <class Head> void print(Head&& head) {cout << head;print();}
template <class Head, class... Tail> void print(Head&& head, Tail&&... tail) {cout << head << " ";print(forward<Tail>(tail)...);}
#else
#define print(...)
#endif

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

    ll a,b,c,d;

    cin >> a >> b >> c >> d;

    for(int i=0; a > 0 && c > 0; i++){
        if(i%2){
            a -= d;
        }else{
            c -= b;
        }
    }
    if(a>0){
        cout << "Yes\n";
    }else{
        cout << "No\n";
    }

    return 0;
}

Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<int, int> P;
template<typename T> inline void chkmin(T &a, const T &b) { a = a < b ? a : b; }
template<typename T> inline void chkmax(T &a, const T &b) { a = a > b ? a : b; }

const int MAXN = 100005;
int A[MAXN], n, m;
vector<int> B;

int main() {
	scanf("%d%d", &n, &m);
	int odd = 0;
	for (int i = 1; i <= m; i++) {
		scanf("%d", A + i);
		if (A[i] & 1) ++odd;
	}
	if (odd > 2) return puts("Impossible") * 0;
	if (m == 1) {
		if (A[1] > 1) B.push_back(A[1] - 1);
		B.push_back(1);
	} else {
		for (int i = 1; i <= m; i++)
			if (A[i] & 1) swap(A[i], A[1]);
		for (int i = 2; i <= m; i++)
			if (A[i] & 1) swap(A[m], A[i]);
		if (A[1] & 1) B.push_back(A[1] + 1);
		else B.push_back(1), B.push_back(A[1]);
		for (int i = 2; i < m; i++) B.push_back(A[i]);
		if (A[m] & 1) { if (A[m] > 1) B.push_back(A[m] - 1); }
		else { B.push_back(1); if (A[m] > 2) B.push_back(A[m] - 2); }
	}
	for (int i = 1; i <= m; i++) printf("%d ", A[i]);
	printf("\n%d\n", (int)B.size());
	for (int i : B) printf("%d ", i);
	return 0;
}

Measured memory_bytes: 256