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

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

#define MOD 998244353
//a^n%m
ll modpow(ll a,ll n,ll m=MOD){
    ll r=1;
    while(n>0){
        if(n&1)r=r*a%m;
        a=a*a%m;
        n>>=1;
    }
    return r;
}
const int COMMAX=200002;
ll fac[COMMAX],finv[COMMAX],inv[COMMAX];
void COMinit(int m=MOD){
    fac[0]=fac[1]=1;
    finv[0]=finv[1]=1;
    inv[1]=1;
    for(int i=2;i<COMMAX;i++){
        fac[i]=fac[i-1]*i%m;
        inv[i]=m-inv[m%i]*(m/i)%m;
        finv[i]=finv[i-1]*inv[i]%m;
    }
}ll COM(int n,int k,int m=MOD){
    if(n<k)return 0;
    if(n<0||k<0)return 0;
    return fac[n]*(finv[k]*finv[n-k]%m)%m;
}


int main(){
    ll n,m,k;
    cin>>n>>m>>k;
    ll res=0;
    COMinit();
    for(int i=0;i<=k;i++){
        ll tmp=(COM(n-1,i)*(ll)((m*modpow(m-1,n-1-i))%MOD))%MOD;
        res=(res+tmp)%MOD;
    }
    cout<<res<<endl;

    return 0;
}

Measured memory_bytes: 8336
// luogu-judger-enable-o2
#include<cstdio>
#include<iostream>
#include<cstring>
using namespace std;
char a[100000];
int x,y,ans;
int main(){
	cin>>a;
	for (register int i=0;i<strlen(a);++i)
		if (x==y){
			++x;
			if (a[i]=='p') --ans;
		}
     	else{
		 	++y;
			 if(a[i]=='g') ++ans;
		}
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 384
#include"bits/stdc++.h"
using namespace std;

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep3(i,m,n) for(int (i)=m;(i)<=(n);(i)++)
#define rep3rev(i,m,n) for(int (i)=m;(i)>=(n);(i)--)
#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define eb emplace_back

using ll = long long;
using vll = vector<ll>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using P = pair<int, int>;

void Main(){
    string s; cin >> s;
    int n = s.size();
    
    int stone = 0;
    int paper = 0;
    
    rep(i, n){
        if(s[i] == 'g'){
            stone++;
        }else{
            paper++;
        }
    }

    cout << (stone - paper)/2 << endl;
    
    return;
}

int main(){
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}

Measured memory_bytes: 512
N = gets.to_i
A = gets.split.map(&:to_i)
B = N.times.map { |i| A[i] ^ A[(i + 1) % N] }

a = A.first ^ B.first

idx = 2
while idx < N
  a ^= B[idx]
  idx += 2
end

ans = [a]

B[0..-2].each do |b|
  ans << (ans.last ^ b)
end

puts ans.join(' ')


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

int main(){
    
    string S;
    cin>>S;
    for(int i=1; i < (1<<4);i += 2){
        string ans;
        ans += S[0];
        int sum = S[0] - '0';
        for(int j = 1; j<4;j++){
            if((i>>j) & 1) ans += "+" , sum += S[j] - '0';
            else ans += "-" , sum -= S[j] - '0'; 
            ans += S[j];
        }
        if(sum == 7){
            cout<<ans<<"=7"<<endl;
            return 0;
        } 
    }
}

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

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

using namespace std;
const int INF = 1 << 30;
const long long MOD = 1000000000 + 7;
const double PI = acos(-1);

bool compare_by_b(tuple <string, int, int> a, tuple<string, int, int> b) {
    if (get<0>(a) != get<0>(b)) {
        return get<0>(a) < get<0>(b);
    }
    else {
        return get<1>(a) > get<1>(b);
    }
}

int main() {
	int N; cin >> N;
    vector < tuple <string, int, int >> R;
    rep(i, N) {
        string s; int p; cin >> s >> p;
        R.push_back(make_tuple( s,p,i+1 ));
    }
    sort(R.begin(), R.end(), compare_by_b);
    rep(i, N) cout << get<2>(R[i]) << endl;

}

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


int main() {
  long N;
  cin >> N;

  long min = 10000000000;
  
  for(int i = 1; i <= sqrt(N); i++) {
  long B = N / i;
  long count = 0;

  while(B > 0) {
    B /= 10;
    ++count;
  }
    if( N % i == 0 && count < min) {
      min = count;
    }
  }

  cout << min << "\n";

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
using Int = long long;
const char newl = '\n';

//INSERT ABOVE HERE
signed main(){
  cin.tie(0);
  ios::sync_with_stdio(0);


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


Measured memory_bytes: 3636
using System;

class IDONTKNOWCSHARP
{
    public static void Main()
    {
        int value = int.Parse(Console.ReadLine());

        decimal pi = 3.14m;

        Console.WriteLine(value *2* pi);
    }


    static int[] Convert(string[] v)
    {
        var temp = new int[v.Length];

        for (int i = 0; i < temp.Length; i++)
        {
            temp[i] = int.Parse(v[i]);
        }

        return temp;
    }




    static string[] GetLines()
    {
        return Console.ReadLine().Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries);
    }


}

Measured memory_bytes: 27612
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
#include<stack>
#include <queue>
#include<map>
#include <set>
using namespace std;
#define int long long
#define ll long long
#define rep(i,n) for(ll i=0;i<n;++i)
#define loop(i,m,n) for(ll i=m;i<n;++i)
#define ggr getchar(); getchar();return 0;
#define pie 3.141592653589793238462643383279
#define INF 1000000007
int bin(int bina) {
	int ans = 0;
	for (int i = 0; bina > 0; i++)
	{
		ans = ans + (bina % 2)*pow(10, i);
		bina = bina / 2;
	}
	return ans;
}
bool prime(int n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x * y / gcd(x, y);
}
int jo(int n) {
	int ans = 1;
	rep(i, n) {
		ans *= 2;
	}
	return ans;
}
int a[100010], n, sum = 0, ans = 0;
signed main() {
	int n;
	cin >> n;
	rep(i, n) {
		cin >> a[i];
	}
	rep(i, n) {
		if (a[i] == 0) {
			ans += sum / 2;
			sum = 0; 
		}
		else {
			sum += a[i];
		}
	}
	cout << ans + sum / 2 << endl;
}

Measured memory_bytes: 1024
macro_rules !read_value {($iter :expr ,($($t :tt ) ,*) ) =>{($(read_value !($iter ,$t ) ) ,*) } ;($iter :expr ,[$t :tt ;$len :expr ] ) =>{(0 ..$len ) .map (|_ |read_value !($iter ,$t ) ) .collect ::<Vec <_ >>() } ;($iter :expr ,{chars :$base :expr } ) =>{read_value !($iter ,String ) .chars () .map (|c |(c as u8 -$base as u8 ) as usize ) .collect ::<Vec <usize >>() } ;($iter :expr ,{char :$base :expr } ) =>{read_value !($iter ,{chars :$base } ) [0 ] } ;($iter :expr ,chars ) =>{read_value !($iter ,String ) .chars () .collect ::<Vec <char >>() } ;($iter :expr ,char ) =>{read_value !($iter ,chars ) [0 ] } ;($iter :expr ,usize1 ) =>{read_value !($iter ,usize ) -1 } ;($iter :expr ,$t :ty ) =>{$iter .next () .unwrap () .parse ::<$t >() .unwrap () } ;}
macro_rules !input_inner {($iter :expr ) =>{} ;($iter :expr ,) =>{} ;($iter :expr ,mut $var :ident :$t :tt $($r :tt ) *) =>{let mut $var =read_value !($iter ,$t ) ;input_inner !{$iter $($r ) *} } ;($iter :expr ,mut $var :ident $($r :tt ) *) =>{input_inner !{$iter ,mut $var :usize $($r ) *} } ;($iter :expr ,$var :ident :$t :tt $($r :tt ) *) =>{let $var =read_value !($iter ,$t ) ;input_inner !{$iter $($r ) *} } ;($iter :expr ,$var :ident $($r :tt ) *) =>{input_inner !{$iter ,$var :usize $($r ) *} } ;}
macro_rules !input {(source =$s :expr ,$($r :tt ) *) =>{let mut iter =$s .split_whitespace () ;input_inner !{iter ,$($r ) *} } ;(iter =$iter :ident ,$($r :tt ) *) =>{let s ={use std ::io ::Read ;let mut s =String ::new () ;std ::io ::stdin () .read_to_string (&mut s ) .unwrap () ;s } ;let mut $iter =s .split_whitespace () ;input_inner !{$iter ,$($r ) *} } ;($($r :tt ) *) =>{let s ={use std ::io ::Read ;let mut s =String ::new () ;std ::io ::stdin () .read_to_string (&mut s ) .unwrap () ;s } ;let mut iter =s .split_whitespace () ;input_inner !{iter ,$($r ) *} } ;}
#[allow(unused_imports)]
use std::io::Write;
pub fn with_bufwriter<F>(f: F) -> std::io::Result<()>
where
    F: FnOnce(&mut std::io::BufWriter<std::io::StdoutLock>) -> std::io::Result<()>,
{
    let stdout = std::io::stdout();
    let mut writer = std::io::BufWriter::new(stdout.lock());
    f(&mut writer)
}
fn main() {
    input! { _n, m };
    let mut ans = vec![];
    let k = (m + 1) / 2;
    for i in 0..k {
        ans.push((i, k * 2 - i - 1));
    }
    for i in 0..m - k {
        ans.push((k * 2 + i, k * 2 + (m - k) * 2 - i));
    }
    with_bufwriter(|out| {
        for (x, y) in ans.into_iter() {
            writeln!(out, "{} {}", x + 1, y + 1)?;
        }
        Ok(())
    })
    .unwrap();
}


Measured memory_bytes: 3428
//台湾旅行中(Day 1)
import java.util.Scanner;

public class Main {

	public static void main(String args[]) {

		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int T = sc.nextInt();

		System.out.println( ((int)(T+0.5)/A) * B);
	}

}


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

#define EMPTY -1

/*
void print(vector<vector<int> >& block, bool flag = false){
  int h = block.size();
  int w = block[0].size();

  for(int i = h - 1; i >= 0; i--){
    for(int j = 0; j < w; j++){
      printf("[%2d]", block[i][j]);
    }
    printf("\n");
  }

  if(flag){ printf("???"); }
  printf("\n");

  return;
}
*/

void drop(vector<vector<int> >& block){
  //print(block, true);
  int h = block.size();
  int w = block[0].size();
  for(int i = 0; i < w; i++)
    for(int j = 0; j < h; j++)
      for(int k = 0; k < h - 1; k++)
        if(block[k][i] == EMPTY)
          swap(block[k][i], block[k + 1][i]);
  //print(block);
  return;
}


bool simulate(vector<vector<int> > block, int n){
  drop(block);
  int h = block.size();
  int w = block[0].size();

  bool flag;
  do{
    flag = false;
    vector<vector<bool> > reservation(h, vector<bool>(w, false));
    for(int i = 0; i < h; i++){
      for(int j = 0; j < w; j++){
        if(block[i][j] != EMPTY){
          int continuity;
          for(continuity = 1; j + continuity < w && block[i][j] == block[i][j + continuity]; continuity++);
          if(continuity >= n){
            for(int k = 0; k < continuity; k++){
              reservation[i][j + k] = true;
            }
          }
          for(continuity = 1; i + continuity < h && block[i][j] == block[i + continuity][j]; continuity++);
          if(continuity >= n)
            for(int k = 0; k < continuity; k++)
              reservation[i + k][j] = true;
        }
      }
    }

    for(int i = 0; i < h; i++)
      for(int j = 0; j < w; j++)
        if(reservation[i][j] && block[i][j] != EMPTY){
          block[i][j] = EMPTY;
          flag = true;
        }

    drop(block);
  }while(flag);

  for(int i = 0; i < h; i++)
    for(int j = 0; j < w; j++)
      if(block[i][j] != EMPTY)
        return false;

  return true;
}


int main(void){
  int h, w, n;
  cin >> h >> w >> n;

  string input;
  vector<vector<int> > block(h, vector<int>(w));
  for(int i = h - 1; i >= 0; i--){
    cin >> input;
    for(int j = 0; j < w; j++){
      if(input[j] == '.'){ block[i][j] = EMPTY; }
      else{ block[i][j] = input[j] - 'A'; }
    }
  }

  for(int i = 0; i < h; i++){
    for(int j = 0; j < w - 1; j++){
      swap(block[i][j], block[i][j + 1]);
      if(simulate(block, n)){
        cout << "YES" << endl;
        return 0;
      }
      swap(block[i][j], block[i][j + 1]);      
    }
  }

  cout << "NO" << endl;
  return 0;
}

Measured memory_bytes: 3180
/*
　　　  ∧＿∧　やあ
　　 （´・ω・｀)　　　　　/　　　　　ようこそ、バーボンハウスへ。
　　 ／∇y:::::＼　　　 [￣]　　　　　このテキーラはサービスだから、まず飲んで落ち着いて欲しい。
　　 |:⊃:|:::::|　　　|──|
￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣|　うん、「また」なんだ。済まない。
￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣|￣　  仏の顔もって言うしね、謝って許してもらおうとも思っていない。
￣￣￣￣￣￣￣￣￣￣￣￣￣￣／|
　　　　∇　∇　∇　∇　　　／.／|　　　でも、この提出を見たとき、君は、きっと言葉では言い表せない
　　　　┴　┴　┴　┴　／ ／　  |　　　「ときめき」みたいなものを感じてくれたと思う。
￣￣￣￣￣￣￣￣￣￣|／　　  |　　　殺伐としたコンテストの中で、そういう気持ちを忘れないで欲しい
￣￣￣￣￣￣￣￣￣￣　　　　 |　　　そう思って、この提出を投げたんだ。
　　　(⊆⊇)　(⊆⊇)　(⊆⊇)　　|
　    ||　　 ||　　||　　|　　　 じゃあ、判定を聞こうか。
　　.／|＼　／|＼ ／|＼
*/

#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <array>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
#define fst first
#define snd second
#define mp make_pair
#define ALL(obj) (obj).begin(),(obj).end()
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i = (b-1);i>=a;i--)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n) 
#define SIZE(x) ((int)(x).size())
#define debug(x) cerr << #x << " -> " << x << " (line:" << __LINE__ << ")" << '\n';
#define debugpair(x, y) cerr << "(" << #x << ", " << #y << ") -> (" << x << ", " << y << ") (line:" << __LINE__ << ")" << '\n';
typedef long long lint;
typedef pair<int, int> pint;
typedef pair<lint, lint> plint;
typedef vector<lint> vec;
typedef vector<vector<lint>> matrix;
typedef priority_queue<lint> p_que;
typedef priority_queue<lint, vector<lint>, greater<lint>> p_que_rev;
const lint INF = INT_MAX;
const lint LINF = LLONG_MAX;
const lint MOD = 1000000000 + 7;
const double EPS = 1e-9;
const double PI = acos(-1);
const int di[]{0, -1, 0, 1, -1, -1, 1, 1};
const int dj[]{1, 0, -1, 0, 1, -1, -1, 1};

lint gcd(lint a, lint b) {
    lint r;
    while (b != 0) {
        r = a % b;
        a = b; 
        b = r;
    }
    return a;
}

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

lint power(lint x, lint n, lint mod = MOD) {
    lint ret = 1;
    while(n > 0) {
        if(n & 1){
            (ret *= x) %= mod;
        }
        (x *= x) %= mod;
        n >>= 1;
    }
    return ret;
}

vector<lint> make_power(int n, lint base){
    lint num = 1;
    vector<lint> ret;
    for (int i=0; i<=n; ++i){
        ret.push_back(num);
        num *= base;
    }
    return ret;
}

int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<int> h(n);
    REP(i, n){
        cin >> h[i];
    }
    bool check = true;
    int max_h = h[0];
    REP(i, n-1){
        if(h[i] < h[i+1]){
            h[i+1]--;
        }
    }
    REP(i, n-1){
        if(h[i] > h[i+1]){
            check = false;
        }
    }
    if(check){
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 640
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <algorithm>
#include <array>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include<numeric>

using namespace std;

int main() {
    int s,ans=-1;
    cin>>s;
    long long a[1000000];
    a[0]=s;
    for(long long i=1;i<1000000;i++){
        if(a[i-1]%2==0){
            a[i]=a[i-1]/2;
        }
        else a[i]=3*a[i-1]+1;
        for(int k=0;k<i;k++){
            if(a[k]==a[i]){
                ans=i+1;
                break ;
            }
        }
        if(ans!=-1)break;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cstdio>
#include <queue>
#include <algorithm>
#include <functional>
#include <string>
#include <queue>
#include <cmath>
#include <iomanip>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <random>
#include <unordered_map>
#include <unordered_set>
#define ll long long
#define fr(i,k,N) for(ll i=k; i<N;i++)
#define rep(i,N) for(ll i=0; i<N;i++)
#define ALL(v) v.begin(),v.end()
#define mp make_pair
using namespace std;
template <class X> void pr(X test){cout<<test<<endl;}
template <class X> void prr(X test){for(auto it:test){cout<<it<<endl;}}
template <class X> void prrr(X test){int f=0;for(auto it:test){cout<<(f++!=0?" ":"")<<it;}cout<<endl;}
template<typename X>
istream&operator>>(istream&i,vector<X>&v){for(X&x:v)i>>x;return i;}

class UF { // union find from https://github.com/kartikkukreja/blog-codes (MIT)
    // [usage]
    // auto uf = new UF(n);
    // uf->merge(l, r); // 0 <= l, r <= n-1
    // ...
public:
    int *id; // inner id
    int cnt; // number of all vartices
    int *sz; // sz[i] means size of i's set
    UF(int N)   {
        cnt = N;
        id = new int[N];
        sz = new int[N];
        for(int i=0; i<N; i++) {
            id[i] = i;
            sz[i] = 1;
        }
    }
    ~UF() {
        delete [] id;
        delete [] sz;
    }
    int find(int p) {
        int root = p;
        while (root != id[root]) root = id[root];
        while (p != root) {
            int newp = id[p];
            id[p] = root;
            p = newp;
        }
        return root;
    }
    void merge(int x, int y) {
        int i = find(x);
        int j = find(y);
        if (i == j) return;
        
        if (sz[i] < sz[j]) {
            id[i] = j;
            sz[j] += sz[i];
        } else {
            id[j] = i;
            sz[i] += sz[j];
        }
        cnt--;
    }
    bool connected(int x, int y) {
        return find(x) == find(y);
    }
    int count() {
        return cnt;
    }
};

// return sorted 約数list 1 <= x <= n
vector<ll> divv(ll n) {
  vector<ll> v;
  for(ll i = 1; i*i <= n; i++) {
    if(n%i == 0) {
      v.push_back(i);
      if(i*i != n) v.push_back(n/i);
    }
  }
  sort(ALL(v));
  return v;
}

int main() {
    ll n;
    cin>>n;
    vector<ll> b(n-1);
    cin>>b;
    ll sum = 0;
    sum += b[0]+b[n-2];
    rep(i, n-2){
        sum+=min(b[i], b[i+1]);
    }
    pr(sum);
}


Measured memory_bytes: 256
using System;
using System.Linq;

namespace _0572
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] x = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int[] a = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int[] b = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int ret = 0;
            for (int i = 0; i < x[1]; i++)
            {
                int now = 0;
                for (int j = 0; j < x[0]; j++)
                {
                    if (b[i + now] == a[j]) now++;
                    if (i + now >= x[1]) break;
                }
                ret = Math.Max(ret,now);
            }
            Console.WriteLine(ret);
        }
    }
}


Measured memory_bytes: 10244
#include <stdio.h>

int main() {
    int n, m;
    while (scanf("%d%d", &n, &m) == 2 && n != 0) {
        int i, j;
        for (i = 0; i < n; i++) {
            for (j = 0; j < m; j++)
				if((i + j) % 2 == 0)
					printf("#");
				else
					printf(".");
			printf("\n");
        }
        printf("\n");
    }
    return 0;
}


Measured memory_bytes: 2104
#include <iostream>
#include <string>

using ll = long long int;
const int INF = (1<<30);
const ll INFLL = (1ll<<60);
const ll MOD = (ll)(1e9+7);

#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	a = (a<MOD)?a:(a-MOD);
	b = (b<MOD)?b:(b-MOD);
	a += b;
	a = (a<MOD)?a:(a-MOD);
}

int main(void){
	int n,i,j,k;
	ll ans,r=0ll,g=0ll,b=0ll;
	std::string s;
	std::cin >> n;
	std::cin >> s;
	for(i=0; i<n; ++i){
		switch(s[i]){
			case 'R': ++r; break;
			case 'G': ++g; break;
			case 'B': ++b; break;
		}
	}
	ans = r*g*b;
	for(i=0; i<n; ++i){
		for(j=1; j<=n; ++j){
			if(i+j*2>=n){
				break;
			}
			if((s[i]!=s[i+j])&&(s[i+j]!=s[i+j*2])&&(s[i+j*2]!=s[i])){
				--ans;
			}
		}
	}
	std::cout << ans << std::endl;
	return 0;
}


Measured memory_bytes: 3584
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;

class Myon
{
    public Myon() { }
    public static int Main()
    {
        cin = new Scanner();
        new Myon().calc();
        return 0;
    }

    static Scanner cin;

    // メンバ変数---
    long N;
    long M;
    // -------------

    void calc()
    {
        N = cin.nextInt();
        M = cin.nextInt();
        // Mの約数リスト
        long ret = 0;
        for(long i = 1;i < Math.Sqrt(M) + 1; i++)
        {
            if(M % i == 0)
            {
                if(i * N <= M)
                {
                    ret = Math.Max(ret, i);
                }
                if(M/i * N <= M)
                {
                    ret = Math.Max(ret, M / i);
                }
            }
        }

        write(ret);
    }

    void write(string v)
    {
        Console.WriteLine(v);
    }

    void write(int v)
    {
        Console.WriteLine(v);
    }

    void write(double v)
    {
        Console.WriteLine(v);
    }
    void write(long v)
    {
        Console.WriteLine(v);
    }

    int Pow(int x, int y)
    {
        return (int)Math.Pow(double.Parse(x.ToString()), double.Parse(y.ToString()));
    }

    double Pow(double x, double y)
    {
        return Math.Pow(x, y);
    }

    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);
            if (s.Length == 0) return next();
            i = 0;
            return s[i++];
        }

        public int nextInt()
        {
            return int.Parse(next());
        }
        public int[] ArrayInt(int N, int add = 0)
        {
            int[] Array = new int[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextInt() + add;
            }
            return Array;
        }

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

        public long[] ArrayLong(int N, long add = 0)
        {
            long[] Array = new long[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextLong() + add;
            }
            return Array;
        }

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


        public double[] ArrayDouble(int N, double add = 0)
        {
            double[] Array = new double[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextDouble() + add;
            }
            return Array;
        }
    }
}

Measured memory_bytes: 13140
#include <stdio.h>
#include <string.h>
int main(){
	
	
	char str[100];
	int length = 0;
	bool valid = false;
	
	scanf("%s", str);
	
	length = strlen(str);
	
	for(int i=0 ; i<length ; i++){
		if(i % 2 == 0){
			if(str[i] == 'L')
				valid = true;
		}
		else{
			if(str[i] == 'R')
				valid = true;
		}
		if(valid)
			break;
	}
	
	printf("%s\n", valid ? "No" : "Yes");
	
	return 0;
}

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

int main() {

    int n; cin >> n;

    vector<int> a(n);
    for (int i = 0; i < n; i++) cin >> a[i];    
    
    int sum = 0;
    vector<int> d(n);
    for (int i = 0; i < n + 1; i++) {
        if (i == 0) {
            d[i] = abs(a[i]);
        }
        else if (i == n) {
            d[i] = abs(a[i - 1]);
        }
        else {
            d[i] = abs(a[i] - a[i - 1]);            
        }
        sum += d[i];
    }

    
    for (int i = 0; i < n; i++) {
        int tmpSum = sum;
        tmpSum -= d[i] + d[i + 1];
        
        if (i == 0) {
            tmpSum += abs(a[1]);
        }
        else if (i == n - 1) {
            tmpSum += abs(a[n - 2]);
        }
        else {
            tmpSum += abs(a[i + 1] - a[i - 1]);
        }

        cout << tmpSum << endl;
    }

    return 0;
}

Measured memory_bytes: 2048
#include<bits/stdc++.h>
using namespace std;
#define pb  					push_back
#define mp 						make_pair
#define all(v) 					((v).begin()) ,((v).end())
#define let(o,v)				memset(o,v,sizeof (o))
typedef long long 				ll;
typedef vector<int>				vi;
typedef vector<vi>				vvi;
typedef vector<string>			vs;

const int MOD = 998244353;
const int oo = (int)1e9;
const ll OO = (ll)1e18;
const double PI = acos(-1.0);
const int N = (int)1e5 + 9;

bool isprime(ll n) {
	if (n <= 1)
		return 0;
	for (ll i = 2; i*i <= n; i++)
		if (n%i == 0)
			return false;
	return 1;
}
ll intlog(ll base, ll x) {
	return (log(x) / log(base));
}
bool prime[N];
void primee()
{

	for (int p = 2; p*p <= N; p++)
	{

		if (prime[p] == true)
		{
			for (int i = p * 2; i < N; i += p)
				prime[i] = false;
		}
	}

}
string decToBinary(ll n)
{
	string z = "";
	int i = 0;
	while (n > 0) {

		z += (n % 2) + 48;
		n = n / 2;
		i++;
	}
	reverse(all(z));
	return z;
}
ll gcd(ll a, ll b) {
	return b == 0 ? a : gcd(b, a%b);
}
ll power(ll x, int y)
{
	ll temp;
	if (y == 0)
		return 1;
	temp = power(x, y / 2);
	if (y % 2 == 0)
		return temp * temp;
	else
		return x * temp*temp;
}
int n,k;
vector<int> v;
ll dp[100005];
int main()
{
	scanf("%d %d", &n,&k);
	v.resize(n);
	for (int i = 0; i < n; i++)
	{
		scanf("%d", &v[i]);
	}
	ll sum = 0;
	for (int i = 1; i < n; i++)
	{
		dp[i] = OO;
		for (int j = i-k; j < i; j++)
		{
			if (j < 0) continue;
			dp[i] = min(dp[i], (ll)fabs(v[i] - v[j])+dp[j]);
		}
	}
	printf("%lld\n", dp[n - 1]);
	return 0;
}

Measured memory_bytes: 1408
#include <iostream>
#include <cstdio>
#include <cmath>

using namespace std;

int main()
{
	double x, h;
	
	while(1){
		cin >> x >> h;
		if(x == 0 && h == 0)    break;
		
		printf("%.6f\n", ((x*x) + x * sqrt(4*h*h + x*x)));
	}
	
	return 0;
}

Measured memory_bytes: 1236
#include <iostream>
#include <vector>
#include <string>

using namespace std;

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

	vector<int> sum(c + 1, 0);
	string sheet;

	while (r--)
	{
		vector<int> cell(c + 1, 0);

		for (int i = 0; i < c; ++i)
		{
			cin >> skipws >> cell[i];
			cell[c] += cell[i];
			sum[i] += cell[i];

			sheet += to_string(cell[i]) + " ";
		}

		sum[c] += cell[c];
		sheet += to_string(cell[c]) + "\n";
	}

	for (int i = 0; i <= c; ++i)
		sheet += to_string(sum[i]) + (i != c ? " " : "\n");

	for (int i = 0; i < sheet.size(); ++i)
		cout << sheet[i];

	return 0;
}

Measured memory_bytes: 3284
#define _CRT_SECURE_NO_WARNINGS

#include<iostream>
#include<string>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<map>
#include<tuple>
#include<algorithm>
#include<numeric>
#include<math.h>

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

using namespace std;

using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;

const int mod = 1e9 + 7;
const long double pi = 3.141592653589793238462643383279502884197;
const long double eps = 1e-7;

int main() {
	string str;
	cin >> str;
	int result = 0;

	for (int i = 0; i < 4; ++i) {
		if (str[i] == '+') {
			result++;
		}
		else {
			result--;
		}
	}
	cout << result;
	system("pause");
	return 0;
}

Measured memory_bytes: 504
#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 = 1e9 + 7;
#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 < typename T >
void vprint(T &v){
	REP(i, v.size()){
		cout << v[i] << " ";
	}
	cout << endl;
}

int main(){
	ll X, Y;
	cin >> X >> Y;
	cout << X + (Y/2) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
  int s;
  int t,m,ss;

  cin>>s;

  t=s/3600;
  m=s%3600/60;
  ss=s%3600%60;

  cout<<t<<":"<<m<<":"<<ss<<'\n';
  return 0;
}



Measured memory_bytes: 3104
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
inline ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
inline ll lcm(ll a, ll b) { return a / gcd(a, b)*b; }
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T>& V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> >& Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T>& mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }
template<typename T>vector<T> make_v(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>auto make_v(size_t a,Ts... ts){return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));}
template<typename T,typename V> typename enable_if<is_class<T>::value==0>::type fill_v(T &t,const V &v){t=v;}
template<typename T,typename V> typename enable_if<is_class<T>::value!=0>::type fill_v(T &t,const V &v){for(auto &e:t) fill_v(e,v);}
/*
 <url:>
 問題文============================================================
 =================================================================
 解説=============================================================
 ================================================================
 */


template<class Type>
Type solve(Type res = Type()){
    int N; cin >> N;
    vector<int> a(N); for(auto& in:a) cin >> in;
    vector<vector<int>> G(N);
    for(int i = 0; i < N-1;i++){
        int u,v; cin >> u >> v; u--; v--;
        G[u].emplace_back(v);
        G[v].emplace_back(u);
    }
    vector<int> dep(N,INF);
    dep[0] = 0;
    queue<int> q; q.push(0);
    while(q.size()){
        int n = q.front(); q.pop();

        for(int next:G[n]){
            if(dep[next] > dep[n] + 1){
                dep[next] = dep[n] + 1;
                q.push(next);
            }
        }
    }
    
    vector<int> dp(N,INF);
    vector<int> ans(N,-1);
    
    function<void(int,int)> dfs = [&](int n,int pre){
        int idx = (int)(lower_bound(dp.begin(),dp.end(),a[n]) - dp.begin());
        int pre_val = dp[idx];
        dp[idx] = a[n];
        
        ans[n] = (int)(lower_bound(dp.begin(),dp.end(),INF) - dp.begin());
        for(int next:G[n]){
            if(next == pre) continue;
            dfs(next,n);
        }
        dp[idx] = pre_val;
    };
    dfs(0,-1);
    
    for(int i = 0; i < N;i++){
        cout << ans[i] << endl;
    }


    return res;
}
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    solve(0);
    // cout << fixed << setprecision(15) << solve<ll>() << endl;
    return 0;
}


Measured memory_bytes: 34404
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>


using namespace std;


int main()
{
    vector<long long> a(10e5);
    long long N;
    cin >> N;
    a[0] = 0;
    a[N + 1] = 0;
    for (auto i = 1; i <= N; i++) {
        cin >> a[i];
    }

    long long cost = 0;
    for (auto i = 1; i <= N + 1; i++) {
        cost += abs(a[i] - a[i - 1]);
    }

    for (auto i = 1; i <= N; i++) {
        long long diff = 0;
        if ((a[i] - a[i - 1]) * (a[i + 1] - a[i]) < 0) {
            // cout << "remove: " << a[i] << endl;
            diff = min(abs(a[i] - a[i - 1]), abs(a[i + 1] - a[i])) * 2;
        }
        cout << cost - diff << endl;
    }
}


Measured memory_bytes: 9088
fn main() {
    let s = std::io::stdin();
    let mut sc = Scanner { stdin: s.lock() };
    let n: usize = sc.read();
    let a: usize = sc.read();
    let b: usize = sc.read();
    if (a.count_ones() & 1) == (b.count_ones() & 1) {
        println!("NO");
        return;
    }
    let ans = solve(n, a, b);
    println!("YES");
    for (i, ans) in ans.into_iter().enumerate() {
        if i > 0 {
            print!(" ");
        }
        print!("{}", ans);
    }
    println!();
}

fn solve(n: usize, a: usize, b: usize) -> Vec<usize> {
    if n == 1 {
        vec![a, b]
    } else {
        assert!((a.count_ones() & 1) != (b.count_ones() & 1));
        let x = (0..)
            .filter(|&i| (a & (1 << i)) != (b & (1 << i)))
            .next()
            .unwrap();
        let na = ((a >> (x + 1)) << x) + (((1 << x) - 1) & a);
        let nb = ((b >> (x + 1)) << x) + (((1 << x) - 1) & b);
        assert_eq!((na.count_ones() & 1), (nb.count_ones() & 1));

        let c = na ^ 1;
        let q = solve(n - 1, na, c);
        let r = solve(n - 1, c, nb);
        let m = 1 << n;
        let mut ans = vec![0; m];
        for i in 0..(m / 2) {
            let q = q[i];
            ans[i] = (a & (1 << x)) + ((q >> x) << (x + 1)) + (((1 << x) - 1) & q);
        }
        for i in (m / 2)..m {
            let r = r[i - (m / 2)];
            ans[i] = (b & (1 << x)) + ((r >> x) << (x + 1)) + (((1 << x) - 1) & r);
        }
        ans
    }
}

pub struct Scanner<R> {
    stdin: R,
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


Measured memory_bytes: 6780
// https://beta.atcoder.jp/contests/abc045
// status:

#define SUBMIT
//#define DEBUG
#include <bits/stdc++.h>
using namespace std;
using ui64 = unsigned long long;

map<pair<int, int>, int> pos_to_count;
ui64 black_count[10];
ui64 H, W, N;

int main() {
#ifdef SUBMIT
    auto& stream = cin;
#else
    stringstream stream(R"(1000000000 1000000000 0
)");
#endif
    stream >> H >> W >> N;
    int x, y;
    for (int i = 0; i < N; ++i) {
        stream >> y >> x;
        y--; x--;
        for (int r = y - 2; r <= y; ++r) {
            for (int c = x - 2; c <= x; ++c) {
                if (r < 0 || c < 0 || H - 2 <= r || W - 2 <= c) continue;
                pos_to_count[make_pair(r, c)]++;
            }
        }
    }

    for (const auto& p : pos_to_count) black_count[p.second]++;
    black_count[0] = (H - 2) * (W - 2) - pos_to_count.size();

    for (int i = 0; i < 10; ++i) cout << black_count[i] << endl;
    return 0;
}

Measured memory_bytes: 56448
// {{{
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdint>
#include <cstdio>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;
// }}}

using ll = long long;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string S, T;
    cin >> S >> T;
    cout << T << S << endl;
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep0(i, n) for (long long i = 0; i < (long long)(n); i++)
#define rep1(i,n) for(long long i=1;i<=(long long)(n);i++)
#define all(v) v.begin(),v.end()
typedef long long ll;

int main() {
  ll N,x,sum,cnt;
  cin>>N>>x;
  vector<ll> a(N);
  rep0(i,N){cin>>a[i];}
  sort(all(a));
  rep0(i,N){
    if(x>sum){sum+=a[i]; cnt++;}
    else{break;}
  }
  if(x-sum!=0){cnt-=1;}
  cout<<cnt<<endl;
}

Measured memory_bytes: 256
<?php
    while(fscanf(STDIN, "%lf %lf %lf %lf %lf %lf", $a, $b, $c, $d, $e, $f)) {
        $x = ($c * $e - $b * $f) / ($a * $e - $b * $d);
        $y = ($c * $d - $a * $f) / ($b * $d - $a * $e);
        printf("%.3f %.3f\n", $x, $y);
    }
?>

Measured memory_bytes: 6556
//AtCoder ABC052 C - Back and Forth
#include <bits/stdc++.h>
using namespace std;
using lli=int64_t;
struct Pos{
    int x=0,y=0;
};
int main() {
#if LOCAL&0
    std::ifstream in("input.txt");
    std::cin.rdbuf(in.rdbuf());
#endif
    Pos st,ed;
    cin>>st.x>>st.y;
    cin>>ed.x>>ed.y;
    auto difx=ed.x-st.x;
    auto dify=ed.y-st.y;
    //1
    cout<<string(dify,'U');
    cout<<string(difx,'R');
    //2
    cout<<string(dify,'D');
    cout<<string(difx,'L');
    //3
    cout<<"L"<<"U";
    cout<<string(dify,'U');
    cout<<string(difx,'R');
    cout<<"R"<<"D";
    //4
    cout<<"R"<<"D";
    cout<<string(dify,'D');
    cout<<string(difx,'L');
    cout<<"L"<<"U";
    cout<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define A_MAX 1000000
#define A_MAX_HALF 500000
 
using namespace std;
 
int min_factor[A_MAX + 1];
int q[A_MAX + 1];
int a[A_MAX + 1];
vector<int> primes{ 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997 };
int N;
 
// 入力読み込みは uzzy 氏のコードを真似した
const int cm = 1 << 24;
char cn[cm], * ci = cn, ct;
inline int getint() {
    int A = 0;
    while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
    return A;
}
 
int main() {
    fread(cn, 1, cm, stdin);
  
    for (int i = 2; i <= A_MAX_HALF; ++i) {
        if (!min_factor[i]) {
            min_factor[i] = i;
        }
        int min_factor_i = min_factor[i];
        for (int p : primes) {
            int n = i * p;
            if (n > A_MAX) {
                break;
            }
            min_factor[n] = p;
            if (p == min_factor_i) {
                q[n] = q[i];
                break;
            } else {
                q[n] = i;
            }
        }
    }
 
    N = getint();
    for (int i = 0; i < N; ++i) {
        ++a[getint()];
    }
 
    int is_pairwise_coprime = 1;
    for (int n = A_MAX; n > 1; --n) {
        int an = a[n];
        if (an) {
            if (an > 1) {
                if (an == N) {
                    printf("not coprime\n");
                    return 0;
                }
                is_pairwise_coprime = 0;
            }
            a[min_factor[n]] += an;
            a[q[n]] += an;
        }
    }
    if (is_pairwise_coprime) {
        printf("pairwise coprime\n");
    } else {
        printf("setwise coprime\n");
    }
 
    return 0;
}

Measured memory_bytes: 21900
import math
import itertools

n,d=map(int,input().split())
l=list()
for i in range(n):
    l.append(list(map(int,input().split())))
pp=0
for i,j in itertools.combinations(range(n),2):
    p=0
    for k in range(d):
        p += (l[i][k]-l[j][k])**2
    if math.sqrt(p)%1==0:
        pp+=1
print(pp)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> PI;
typedef pair<PI,int> PII;
int last_submit[50][10];
int AC[50][10];
int WA[50][10];

int main() {
  int M,T,P,R;
  while(cin>>M>>T>>P>>R,M) {
    for(int i=0;i<T;i++) {
      for(int j=0;j<P;j++) {
        last_submit[i][j]=AC[i][j]=WA[i][j]=0;
      }
    }
    for(int i=0;i<R;i++) {
      int m,t,p,j;
      scanf("%d %d %d %d",&m,&t,&p,&j);
      t--;p--;
      last_submit[t][p]=m;
      if(j==0) AC[t][p]=1;
      else WA[t][p]++;
    }
    vector<PII> v;
    for(int i=0;i<T;i++) {
      int AC_count=0;
      int penalty=0;
      for(int j=0;j<P;j++) {
        AC_count+=AC[i][j];
        if(AC[i][j]) {
          penalty+=last_submit[i][j];
          penalty+=WA[i][j]*20;
        }
      }
      v.push_back(PII(PI(-AC_count,penalty),-i));
    }
    sort(v.begin(),v.end());
    printf("%d",-v[0].second+1);
    for(int i=1;i<T;i++) {
      if(v[i-1].first<v[i].first) {
        printf(",");
      }else {
        printf("=");
      }
      printf("%d",-v[i].second+1);
    }
    printf("\n");
  }
}

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


int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    sort(a.begin(), a.end());
    ll m = a[n-1];
    int s = 0;
    bool flag = false;
    rep(i, n){
        double med = double(m) / 2;
        if (med <= a[i]) {
            if (i > 0){
                if (a[i] - med >= med - a[i - 1]) s = a[i - 1];
                else s = a[i];
            }
            else s = a[0];
            break;
        }
    }
    cout << m << " " << s << endl;
}


Measured memory_bytes: 640
s = int(input())
a_list = [s]

for i in range(2, 1000000):
    if a_list[-1] % 2 != 0:
        tmp = 3 * a_list[-1] + 1
        if tmp in a_list:
            print(i)
            exit()
        else:
            a_list.append(tmp)
    else:
        tmp = a_list[-1] / 2
        if tmp in a_list:
            print(i)
            exit()
        else:
            a_list.append(tmp)

Measured memory_bytes: 3060
#include <stdio.h>

#include <iostream>
#include <vector>
using namespace std;

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

    int checker = 0;
    for (int i=0; i<N; i++){
        int A;
        cin >> A;
        if (A%2==0){ //偶数
            if(A%5!= 0 && A%3!=0){
                checker++;
            }
        }
    }
    if (checker>0){
        cout << "DENIED" << endl;
    }else{
        cout << "APPROVED" << endl;
    }
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
str = input()
s = list(str)
n = len(s)


def is_kaibun(kaibun):
    for i in range(len(kaibun) // 2):
        if kaibun[i] != kaibun[-i - 1]:
            return False
    return True


if is_kaibun(str):
    before = int((n - 1) / 2)
    later = int((n + 3) / 2)
    str_before = str[0:before]
    if is_kaibun(str_before):
        str_later = str[int(n / 2 + 1):later]
        if is_kaibun(str_later):
            print("Yes")
        else:
            print("No")
    else:
        print("No")
else:
    print("No")


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

int main() {
	int N, M, sum = 0;	
	cin >> N >> M;
	vector<int> A(N);
	for (int i = 0; i < N; i++) {
		int tmp;
		cin >> tmp;
		sum += tmp;
		A.at(i) = tmp;
	}
	int stand = sum / (4 * M);
	if (stand * (4 * M) != sum) stand++;
	int cnt = 0;
	for (int i = 0; i < N; i++) {
		if (A.at(i) >= stand) cnt++;
	}
	if (cnt >= M) {
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}
}

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

#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define ALL(a)  (a).begin(),(a).end()

template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}
typedef long long ll;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}

void solve() {
    string s;
    cin >> s;
    bool ok = true;
    REP(i,s.size()) {
        if (ok) {
            if (s[i]=='h') ok = false;
            else {
                cout << "No" << endl;
                return;
            }
        } else {
            if (s[i]=='i') ok = true;
            else {
                cout << "No" << endl;
                return;
            }
        }
    }
    if (!ok) cout << "No" << endl;
    else cout << "Yes" << endl;
}

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


Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var a int;
	fmt.Scan(&a);
	switch a % 10 {
	case 2,4,5,7,9:
		fmt.Println("hon");
	case 3:
		fmt.Println("bon");
	case 0,1,6,8:
		fmt.Println("pon");
	}
}

Measured memory_bytes: 1752
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 1e9;
const ll LINF = 1e15;
const int MOD = 1000000007;
const double PI = acos(-1);
int dx[4] = {0,1,0,-1};
int dy[4] = {1,0,-1,0};

int dp[3001][3001];

int main() {
	string s, t;
	cin >> s >> t;
	int n = s.size();
	int m = t.size();
	memset(dp, 0, sizeof(dp));
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < m; j++) {
			if (s[i] == t[j]) {
				dp[i+1][j+1] = dp[i][j] + 1;
			} else {
				dp[i+1][j+1] = max(dp[i+1][j], dp[i][j+1]);
			}
		}
	}

	int length = dp[n][m];
	int l = n;
	int r = m;
	string ans = "";
	while (length > 0) {
		if (s[l-1] == t[r-1]) {
			ans += s[l-1];
			l--;
			r--;
			length--;
		} else if (dp[l][r] == dp[l-1][r]) l--;
		else r--;
	}
	reverse(ALL(ans));
	cout << ans << endl;
}

Measured memory_bytes: 38820
#include<stdio.h>
int main(){
  int N;
  scanf("%d",&N);
  int M;
  if(N % 2 == 0){
    M = (N*(N - 1) - N)/2;
    printf("%d\n",M);
    for(int i = 0;i < N;i ++){
      for(int j = 0;j < i;j ++){
        if(j + i != N - 1){
          printf("%d %d\n",j +1,i +1);
        }
      }
    }
  }else{
    M = (N*(N-1)-N+1)/2;
    printf("%d\n",M);
    for(int i = 0;i < N;i ++){
      for(int j = 0;j < i;j ++){
        if(j + i != N - 2){
          printf("%d %d\n",j +1,i +1);
        }
      }
    }
  }
  return 0;
}

Measured memory_bytes: 128
# -*- coding: utf-8 -*-
import copy

sf=str(input())
x=int(0)
s=copy.copy(sf)

if "keyence" in s:
    s=s.replace("keyence","",1)
    if s in sf:
        x=1
elif s.find("keyenc") == 0:
    if s.rfind("e") == len(s)-1:
        x=1 
elif s.find("keyen") == 0:
    if s.rfind("ce") == len(s)-2:
        x=1 
elif s.find("keye") == 0:
    if s.rfind("nce") == len(s)-3:
        x=1
elif s.find("key") == 0:
    if s.rfind("ence") == len(s)-4:
        x=1
elif s.find("ke") == 0:
    if s.rfind("yence") == len(s)-5:
        x=1
elif s.find("k") == 0:
    if s.rfind("eyence") == len(s)-6:
        x=1 

if x==1:
    print("YES")
else:
    print("NO")


Measured memory_bytes: 3444