akhauriyash/Code-Regression huggingface dataset:
#define _USE_MATH_DEFINES
#include  <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <string>
#include<math.h>
#include<iomanip>
#include<stdio.h>
#include <stdlib.h>
#include<stdio.h>
#include <queue>
#include<map>
#include <sstream>
#include<set>
#include<stack>

//#include<bits/stdc++.h>


using namespace std;



int main() {
	int n;
	cin >> n;
	string p;
	int t[30] = {};
	cin >> p;
	for (int i = 0; i < p.size(); i++) {
		int a = p[i] - 'a';
		t[a]++;
	}
	long long int r = 1;
	for (int i = 0; i < 30; i++) {
		if (t[i]) {
			r *= (t[i] + 1);
			r %= 1000000007;
		}
	}
	cout << r - 1 << endl;
	return 0;

}

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

#define int long long
#define rep(i,l,r) for(int i=(int)(l);i<(int)(r);i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
template<class T>bool chmax(T &a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a,T b){if(a>b){a=b;return 1;}return 0;}

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;

const int inf = 1LL<<60;
const int mod = 1e9 + 7;
const double eps = 1e-9;

/*{
}*/

signed main()
{
	int n;
	cin >> n;
	
	map<string, priority_queue<pii>> m;
	rep(i, 0, n){
		string s;
		int p;
		cin >> s >> p;
		m[s].push({p, i+1});
	}

	for(auto i : m){
		auto q = i.second;
		while(!q.empty()){
			auto t = q.top();
			q.pop();
			cout << t.second << endl;	
		}
	}

	return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<iostream>
#include<string>
#include<stack>
#include<queue>
#include<vector>
#include<map>
#include<set>
#include<algorithm>
#include<numeric>

#define all(c) c.begin(), c.end()
#define rall(c) c.rbegin(), c.rend()
#define pb(x) push_back(x)
#define eb(x,y) emplace_back(x,y)
#define MOD 1000000007
#define MAX 1000000001
#define INF 1410065408
#define EPS 1e-12
#define DEBUG 0
#define ll long long
#define Pll pair<ll, ll>
#define Pii pair<int, int>
#define rep(n) for(int i=0;i<n;i++)
#define repp(j, n) for(int j=0;j<n;j++)
#define reppp(i, m, n) for(int i=m;i<=n;i++)
 
using namespace std;
struct edge{int from, to; ll cost;};

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

    int N; ll K;
    cin >> N >> K;
    vector<ll> a(N),b(N), ans;
    rep(N) cin >> a[i] >> b[i];
    
    ll bb = 0;
    rep(N) if((a[i]|K) == K) bb += b[i];
    ans.pb(bb);

    ll dec = 2;
    while(dec <= K){
        ll kk = (K - dec)|(dec-1);
        bb = 0;
        rep(N) if((a[i]|kk) == kk) bb += b[i];
        ans.pb(bb);
        dec *= 2;
    }

    cout << *max_element(all(ans)) << endl;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define vll vector<ll>
#define pll pair<ll,ll>
#define forA(i,a,n,x) for(auto i=a;i<n;i+=x)
#define forD(i,a,n,x) for(auto i=n-1;i>=0;i-=x)
#define ranit(it,n) for(auto it:n)
#define testCases ll t;cin>>t;while(t--)
#define mp make_pair
#define pb push_back
#define F first
#define S second
#define mod 1000000007
#define init(a,x) memset(a,x,sizeof(a))

int main()
{
	ios_base::sync_with_stdio(false);	cin.tie(NULL);	cout.tie(NULL);
	ll n; cin>>n; vll v(n); forA(i,0,n,1)cin>>v[i];
	ll sum=0;
	forA(i,1,n,1)
	{
		if(v[i]<v[i-1])
		{
			sum+=v[i-1]-v[i];
			v[i]=v[i-1];
		}
	}
	cout<<sum;
	return 0;
}

Measured memory_bytes: 4784
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
using less_set = tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>;
using great_set = tree<int, null_type, greater<int>, rb_tree_tag, tree_order_statistics_node_update>;
#define FIO ios_base::sync_with_stdio(0);cin.tie(0);
const int N = 2e3+69;
#define ALL(x) begin(x),end(x)
#define sz(x) (ll)x.size()
const int OO = 0x3f3f3f3f;
const int mod = 1000000007;


int n;
int a[200069];
int b[200069];


int main()
{
    FIO
    cin >> n;
    for(int i = 0; i< n; i++)
        cin >> a[i] >> b[i];
    sort(a, a+n);
    sort(b, b+n);
    cout << (n%2 ? (b[n/2]-a[n/2]+1) : b[n/2] + b[n/2-1] - a[n/2] - a[n/2-1] + 1)<< "\n";
    return 0;
}


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

using namespace std;
typedef long long ll;

int main()
{
    ios_base::sync_with_stdio(0);
    int n,k; cin >> n >> k;
    vector<int> v(n);
    for(int i=0;i<n;i++){
        cin >> v[i];
    }
    sort(v.begin(),v.end());
    int sum =0;
    for(int i=0;i<k;i++){
        sum += v[i];
    }
    cout << sum << endl;
}

Measured memory_bytes: 3660
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <list>
#include <string>
#include <numeric>
#include <math.h>
#include <set>
#include <map>
#include <fstream>
#include <sstream>
#include <iterator>
#include <complex>
using namespace std;

long long gcd(long long a,long long b){return b?gcd(b,a%b):a;}
long long lcd(long long a,long long b){return a*b / gcd(a,b) / gcd(a,b);}
int main()
{
	int a;
	cin>>a;
	cout<<a+a*a+a*a*a<<endl;
}

Measured memory_bytes: 3652
#include <iostream>


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

    int r_in, max_val, min_val, diff;
    bool is_max_val_set = false;
    std::cin >> min_val >> max_val;
    diff = max_val - min_val;
    min_val = std::min(max_val, min_val);
    
    for (int i = 2; i < N; i++) {
        std::cin >> r_in;
        if (!is_max_val_set) {
            max_val = r_in;
            diff = std::max(diff, max_val - min_val);
            is_max_val_set = true;
        }
        
        if (r_in > max_val) {
            max_val = r_in;
            diff = std::max(diff, max_val - min_val);
        } else if (r_in < min_val) {
            min_val = r_in;
            is_max_val_set = false;
        }
    }

    std::cout << diff << std::endl;
}



Measured memory_bytes: 3116
#include <stdio.h>
#include <string.h>
int main(){
        int a,b,i;
        scanf("%d%d",&a,&b);
	char flg[4] = "No";
	a*=b;
	while(i<=3){
	    if((a*i)%2 == 1){
	       strcpy(flg,"Yes");
	    }
            i++;
	}
	printf("%s",flg);
        return 0;
}
		

Measured memory_bytes: 128
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();
        String op = "";

        if (a < b) {
            op = "<";
        } else if (a > b) {
            op = ">";
        } else {
            op = "==";
        }

        System.out.println("a " + op + " b");
    }
}


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

int main() {
	string S;
	cin >> S;
	int N = S.size();
	N = N/2;
	int ans = 0;
	rep(i, N){
		if (S[i] != S[S.size()-i-1]) ans++;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3520
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

N, M = map(int, input().split())
L = []
R = []
for i in range(M):
    l, r, = map(int, input().split())
    L.append(l)
    R.append(r)
max_l = 0
min_r = N
for i in range(M):
    if max_l < L[i]:
        max_l = L[i]
    if min_r > R[i]:
        min_r = R[i]
if max_l > min_r:
    print(0)
else:
    print(min_r - max_l + 1)


Measured memory_bytes: 16716
import java.lang.*;
import java.util.*;
import java.io.*;

public class Main {
    public static void main(String args[]) {
        Scanner scan = new Scanner(System.in);
        
        StringBuilder sb = new StringBuilder(scan.next());
        if(sb.length() == 3) System.out.println(sb.reverse());
        else System.out.println(sb);
        
    }
}


Measured memory_bytes: 21844
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <iomanip>
#include <cmath>
#include <map>
using namespace std;
#define REP(i,n) for (int i=0;i<(n);++i)
#define rep(i,a,b) for(int i=a;i<(b);++i)
constexpr long INF = 1 << 30;
constexpr int MOD = 1e9 + 7;

int n, m, a, b, cnt[1010];
vector<vector<int>> g;

int main() {
  cin.tie(0); ios_base::sync_with_stdio(false);
  cin >> n >> m;
  g.resize(n);
  REP(i,m) {
    cin >> a >> b;
    --a, --b;
    g[a].push_back(b);
  }

  vector<int> ans(n+1);
  REP(i,n) {
    vector<int> dist(n, INF), prev(n,-1);
    queue<int> q;
    q.push(i);
    dist[i] = 0;
    while(!q.empty()) {
      int v = q.front(); q.pop();
      for(int nv : g[v]) {
        if(dist[nv] != INF) continue;
        dist[nv] = dist[v] + 1;
        q.push(nv);
        prev[nv] = v;
      }
    }
    pair<int, int> mini(INF, -1);
    for(int j = 0; j < n; ++j) {
      if(i == j) continue;
      for(int k : g[j]) 
        if(i == k) mini = min(mini, make_pair(dist[j], j));
    }
    if(mini.first == INF) continue;

    int k = mini.second;
    vector<int> tmp;
    while(k != -1) {
      tmp.push_back(k);
      k = prev[k];
    }
    if(ans.size() > tmp.size()) ans = tmp;
  }
  
  if(ans.size() == n+1) cout << -1 << endl;
  else {
    cout << ans.size() << '\n';
    for(int i = 0; i < ans.size(); ++i) {
      cout << ans[i]+1 << '\n';
    }
  }

  return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define rep1(i, n) for (ll i = 1; i <= (n); ++i)
#define rrep(i, n) for (ll i = (n - 1); i >= 0; --i)
#define perm(c) sort(ALL(c));for(bool c##p=1;c##p;c##p=next_permutation(ALL(c)))
#define ALL(obj) (obj).begin(), (obj).end()
#define pb push_back
#define to_s to_string
#define len(v) (ll)v.size()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define print(x) cout << (x) << '\n'
#define debug(x) cout << #x << ": " << (x) << '\n'
using namespace std;
using ll = long long;
typedef pair<ll, ll> P;
typedef vector<ll> vec;
typedef vector<vector<ll>> vec2;
typedef vector<vector<vector<ll>>> vec3;
ll MOD = 1e9 + 7;
ll devc(ll x, ll y) { return 1 + (x - 1) / y; }
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

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

    ll N;
    cin >> N;
    if(N >= 2800) print("AGC");
    else if(N >= 1200) print("ARC");
    else print("ABC");

    return 0;
}

Measured memory_bytes: 256
mod = 10**9+7
S = input()
n = len(S)
dp = [[0]*13 for _ in range(n+1)]
dp[0][0] = 1
for ind,s in enumerate(S):
    if(s=='?'):
        for i in range(10):
            for j in range(13):
                dp[ind+1][(j*10+i)%13] += dp[ind][j]
                dp[ind+1][(j*10+i)%13] %= mod
    else:
        for j in range(13):
            dp[ind+1][(j*10+int(s))%13] += dp[ind][j]
            dp[ind+1][(j*10+int(s))%13] %= mod
print(dp[n][5])

Measured memory_bytes: 61916
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cstdint>
#include <cstdlib>
#include <cmath>
#include <complex>
#include <chrono>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <type_traits>
#include <unordered_map>
#include <vector>
#include <random>
#include <utility>
#include <limits>
#include <list>

/* template start */
 
#define rep(i, a, b) for (long long i = (a); (i) < (b); (i)++)
#define all(i) i.begin(), i.end()

#ifdef LOCAL
#define debug(...) std::cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif

void debug_out(){std::cerr<<std::endl;}

template<typename Head,typename... Tail>
void debug_out(Head h,Tail... t){
  std::cerr<<" "<<h;
  if(sizeof...(t)>0)std::cout<<" :";
  debug_out(t...);
}
 
template <typename T1, typename T2>
std::ostream& operator<<(std::ostream& os, std::pair<T1, T2> pa) {
  return os << pa.first << " " << pa.second;
}
 
template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T> vec) {
  for (std::size_t i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
  return os;
}
 
template<typename T1,typename T2>
inline bool chmax(T1& a,T2 b){return a<b && (a=b,true);}
 
template<typename T1,typename T2>
inline bool chmin(T1& a,T2 b){return a>b && (a=b,true);}

template<typename Num>
constexpr Num mypow(Num a, unsigned long long b) {
  if(b==0)return 1;
  if (a==0)return 0;
  Num x = 1;
  while (b > 0) {
    if(b & 1)x*=a;
    a*=a;
    b >>= 1;
  }
  return x;
}

/* template end */

using ll = long long;

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

  rep(i,0,5){
    ll a;
    std::cin>>a;
    if(a==0){
      std::cout<<i+1<<"\n";
    }
  }

  return 0;
}

Measured memory_bytes: 3596
#include <stdio.h>

int main(void)
{
	long n;
	long time[5];
	long tosi[6];
	long i = 0;
	long gokei = 0;
	long kesan = 0;
	
	scanf("%ld", &n);
	for (i = 0;i < 5; i++){
		scanf("%ld", &time[i]);
	}
	tosi[0] = tosi[1] = tosi[2] = tosi[3] = tosi[4] = tosi[5] = 0;
	tosi[0] = n;
	
	while (tosi[5] == 0){
		for (i = 4;i >= 0;i--){
			if(tosi[i] != 0){
				if(tosi[i] <= time[i]){
					tosi[i + 1] += tosi[i];
					tosi[i] = 0;
				}
				else{
					tosi[i] -= time[i];
					tosi[i + 1] += time[i];
				}
			}
		}
		gokei++;
	}
	kesan = tosi[0] + tosi[1] + tosi[2] + tosi[3] + tosi[4];
	if ((kesan % tosi[5]) == 0){
		kesan /= tosi[5];
	}
	else{
		kesan /= tosi[5];
		kesan++;
	}
	gokei += kesan;
	printf("%ld", gokei);
	return(0);
}

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

int main() {
  string w;
  cin >> w;
  int cnt[26], n = w.size();
  fill(cnt, cnt+26, 0);
  for (int i=0; i<n; i++) {
    int id = w[i]-'a';
    cnt[id]++;
  }
  for (int i=0; i<26; i++) {
    if (cnt[i]%2) {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  return 0;
}


Measured memory_bytes: 3580
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const double PI = 4*atan(1);
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3f;
const double EPS = 1e-6;
const string YES = "Possible";
const string NO = "Impossible";
#define pb push_back
#define mp make_pair

const long MAX_N = 105, MOD = 1000000007;
int dp[MAX_N][5][5][5]; //AGC, ACG, GAC
int N;

void solve()
{
	dp[0][4][4][4]=1; 
	for(int i=0;i<N;++i){
		for(int x=0;x<5;++x)for(int y=0;y<5;++y)for(int z=0;z<5;++z)for(int j=0;j<4;++j){
    			if(y==0 && z==1 && j==2) continue;
    			if(y==0 && z==2 && j==1) continue;
    			if(y==1 && z==0 && j==2) continue;
    			if(x==0 && y==1 && j==2) continue;
    			if(x==0 && z==1 && j==2) continue;
    			(dp[i+1][y][z][j]+=dp[i][x][y][z])%=MOD;
		}
	}
	int ans = 0;
	for(int i=0;i<4;++i)for(int j=0;j<4;++j)for(int k=0;k<4;++k) ans = (ans + dp[N][i][j][k])%MOD;
	cout << ans << endl;
}

int main()
{
	cin >> N;
	solve();
	return 0;
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;

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

	public void run() {
		int N=sc.nextInt();
		
		while(N--!=0){
			int[] edge=new int[]{
					sc.nextInt(),sc.nextInt(),sc.nextInt()
			};
			Arrays.sort(edge);
			ln((edge[2]*edge[2]==edge[0]*edge[0]+edge[1]*edge[1])?"YES":"NO");
		}
	}

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

	public static void pr(Object o) {
		System.out.print(o);
	}

	public static void ln(Object o) {
		System.out.println(o);
	}

	public static void ln() {
		System.out.println();
	}
}

Measured memory_bytes: 12000
let () = Scanf.scanf "%s" @@ fun s -> 
  let ans =
    match s with
    | "SSS" -> 0
    | "SSR" -> 1
    | "SRS" -> 1
    | "SRR" -> 2
    | "RSS" -> 1
    | "RSR" -> 1
    | "RRS" -> 2
    | "RRR" -> 3
    | _ -> raise Not_found
  in
  Printf.printf "%d\n" ans

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

int main(){
  long long n,Red,r;
  cin>>n;
  Red=0;r=0;
  vector<char> a(n);
  for(int i=0;i<n;i++){
cin>>a.at(i);
  }
  for(int i=0;i<n;i++){
if(a.at(i)=='R'){
Red++;
}
  }
  for(int i=Red;i<n;i++){
if(a.at(i)=='R'){
  r++;
}
  }
cout<<r<<endl;
}
  


Measured memory_bytes: 3600
s = int(input())
S = [s]
for i in range(1000000):
  if s % 2 == 0:
    s = s // 2
  else:
    s = 3 * s + 1
  if s in S:
    break
  else:
    S.append(s)
    
print(len(S)+1)

Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  float a;
  float b;
  float ave;
  int i_ave;
  int sum;
  // 変数aで入力を受け取る
  cin >> a >> b;
  ave = (a+b)/2.0;
  i_ave = ave; 
  sum = a + b;
  cout << i_ave+(sum % 2) * (sum % 2) << endl;
}

Measured memory_bytes: 3680
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
using namespace std;
const int RANDOM1 = chrono::high_resolution_clock::now().time_since_epoch().count();
struct chash {
    int operator()(int x) const { return hash<int>{}(x ^ RANDOM1); }
};
#define ll long long
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define deb(x) cout<<#x<<" : "<<x<<"\n";
#define debug(x,y) cout<<#x<<" : "<<x<<"\t"<<#y<<" : "<<y<<"\n";
#define ff first
#define ss second
#define ub upper_bound
#define lb lower_bound
#define all(a) (a).begin(),(a).end()
#define bs binary_search
#define sz size()
#define vi vector<int>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define ld long double
#define clr fflush(stdout);
//#define clr cout.flush();
#define N 100001
#define fpr(i,a,b) for(int i=a;i<b;i++)
#define fdr(i,a,b) for(int i=a;i>b;i--)
#define repp(i,a,b,d) for(int i=a;i<b;i+=d)
#define repd(i,a,b,d) for(int i=a;i>b;i-=d)
#define LLMIN LLONG_MIN
#define LLMAX LLONG_MAX
#define AKASH_PATEL ios_base::sync_with_stdio(false);
#define SVNIT_SURAT cin.tie(NULL);cout.tie(NULL);
#define mset(x,a) memset(x,a,sizeof(x));
#define nl cout<<'\n';
#define print(c) cout<<c<<'\n';
#define setp(n) cout << fixed << setprecision(n)
#define take_arr(a,n) fpr(i,0,n) cin>>a[i];
#define print_arr(a,n) for(int i=0;i<n;i++) {cout<<a[i]<<" ";} cout<<'\n';
#define take_mat(mat,n,m) fpr(i,0,n) fpr(j,0,m) cin>>mat[i][j];
#define set_mat(mat,n,m,k) fpr(i,0,n) fpr(j,0,m) mat[i][j]=k;
#define print_mat(dist,n,m) for(int i=0;i<n;i++){for(int j=0;j<m;j++){cout<<dist[i][j]<<" ";}cout<<'\n';}
template< class T > bool inside(T a, T b, T c) { return a<=b && b<=c; }
int main()
{
    AKASH_PATEL;
    SVNIT_SURAT;
    ll n,m;
    cin>>n>>m;
    if(n==1||m==1)
    {
        print("1")
        return 0;
    }
    cout<<(n*m+1)/2;
    return 0;
}





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

int main(){
    int m,f,r,s;
    while(true){
        cin>>m>>f>>r;
        if(m==-1 and f==-1 and r==-1)break;
        if(m==-1 or f==-1){
            cout<<"F"<<endl;
        }else{
            s=m+f;
            if(s<30){
                cout<<"F"<<endl;
            }else if(s>=30 and s<50 and r<50){
                cout<<"D"<<endl;
            }else if((s>=50 and s<65) or(s>=30 and s<50 and r>=50)){
                cout<<"C"<<endl;
            }else if(s>=65 and s<80){
                cout<<"B"<<endl;
            }else if(s>=80){
                cout<<"A"<<endl;
            }
        }
    }
}


Measured memory_bytes: 3088
let [|N;K|] = stdin.ReadLine().Split() |> Array.map int
let [|R;S;P|] = stdin.ReadLine().Split() |> Array.map int
let T = stdin.ReadLine()

let f x y = if (x + y * K) < N then T.[x + y * K] else 'x'
let t = Array2D.init K ((N / K) + 1) (fun x y -> f x y)

let win x =
 match x with
 |'r' -> 'p'
 |'p' -> 's'
 |'s' -> 'r'
 |_ -> 'y'

let get x =
 match x with
 |'r' -> R
 |'p' -> P
 |'s' -> S
 |_ -> 0

let rec g c ls score = 
 match ls with
 |[] -> score
 |hd :: tl -> if (c = win hd) then (g 'x' tl score) else (g (win hd) tl (score + (get (win hd))))

let ans =[for i in 0..(K - 1) -> (g 'x' [for j in 0..(N / K) -> t.[i,j]] 0)] |> List.sum

ans
|>stdout.WriteLine

Measured memory_bytes: 22720
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 c = sc.nextInt();
		if(a*b*c == 175) {
			System.out.println("YES");
		}
		else {
			System.out.println("NO");
		}
	}
}

Measured memory_bytes: 35652
//#include <bits/stdc++.h>
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <stdio.h>
#include <queue>
#include <deque>
#include <set>
#include <stack>
#include <time.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;
 
const ll nmax = 1e9 + 7;
const ll Mod = 998244353;
const double PI = 2 * asin(1);

int main(){
  int N; cin >> N;
  int A[N], Count[N + 1] = {};
  for (int i = 0; i < N; i++) cin >> A[i];

  for (int i = 0; i < N; i++){
    Count[A[i]] = Count[A[i] - 1] + 1;
  }
  
  int ans = 0;
  for (int i = 0; i < N + 1; i++){
    ans = max(ans, Count[i]);
  }
  cout << N - ans << endl;
  
  return 0;
}


Measured memory_bytes: 1920
#include<iostream>
#include<vector>
#include<sstream>
#include<string>
#include<numeric>
#include <algorithm>
#include<math.h>
#include<cstdio>
#include<string.h>
#include<stdio.h>
#include<stdlib.h>



using namespace std;
typedef long long ll;
int gcd( int m, int n )
{
	// 引数に０がある場合は０を返す
	if ( ( 0 == m ) || ( 0 == n ) )
		return 0;
	
	// ユークリッドの方法
	while( m != n )
	{
		if ( m > n ) m = m - n;
		else         n = n - m;
	}
	return m;
}//gcd
int lcm( int m, int n )
{
	// 引数に０がある場合は０を返す
	if ( ( 0 == m ) || ( 0 == n ) )
		return 0;
	
	return ((m / gcd(m, n)) * n); // lcm = m * n / gcd(m,n)
}//lcm
int input(){
  int x;
  cin>>x;
  return x;
}
int abs(int x){
  if(x>=0){
    return x;
  }else{
    return -x;
  }
}

int moji(char in)
{
    int ans = (int)in-(int)'a'+1;
    if((in < 1) || (in > 26)){
        ans = 100;
    }
    return ans;
}
const int VV=10;//場合に応じてVVの値のみ変更する必要あり
//dijkstra(s)sがスタート地点でそこからの最短距離を配列dで表す。正の重みのみ使用可能
int cost[VV][VV];
int d[VV];
bool used[VV];
void dijkstra(int s){
  fill(d,d+VV,100000);
  fill(used,used+VV,false);
  d[s]=0;
  while(true){
    int v=-1;
    for(int u=0;u<VV;u++){
      if(!used[u]&&(v==-1||d[u]<d[v]))v=u;
    }
    if(v==-1)break;
    used[v]=true;
    for(int u=0;u<VV;u++){
      d[u]=min(d[u],d[v]+cost[v][u]);
    }
  }

}

int compare_int(const void *a, const void *b)//qsort(quick sort利用時に使用)
{
    return *(int*)a - *(int*)b;
}









int main() {
  int N;
  cin>>N;
  int a[N];
  for(int i=0;i<N;i++){
    cin>>a[i];
  }
  sort(a,a+N);
  int Asum=0;
  int Bsum=0;
  for(int i=N-1;i>=0;i--){
    if(i%2==(N-1)%2){
      Asum+=a[i];
    }else{
      Bsum+=a[i];
    }
  }
  cout<<Asum-Bsum<<endl;




  


  

  


  

    


  

  
  
  
  
}


  
  

  

  

Measured memory_bytes: 256
package main

import "fmt"
import "strings"

func main() {
	var w string
	fmt.Scan(&w)

	ws := strings.Split(w, "")
	cns := make(map[string]int)
	for _, ww := range ws {
		cns[ww] += 1
	}

	for _, v := range cns {
		if v%2 != 0 {
			fmt.Println("No")
			return
		}
	}

	fmt.Println("Yes")
}

Measured memory_bytes: 640
#include "bits/stdc++.h"
using namespace std;
const int maxn=1000;
int vis[maxn],n;
int main()
{
	cin>>n;
	int cnt=0;
	for(int i=1;i<=n;i++){
		int x;
		cin>>x;
		vis[x]=1;
	}
	for(int i=1;i<=100;i++){
		if(vis[i]) cnt++;
	}
	cout<<cnt<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
 
int main() {
    int n;
    cin >> n;
    vector<int> d(n);
    for(int i = 0; i < n; i++){
        cin >> d[i];
    }
 
    int sum = 0;
    for(int i = 0; i < n; i++){
        for(int j = i+1; j < n; j++){
            sum += d[i] * d[j];
        }
    }
    cout << sum << endl;
}


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

using namespace std;

namespace {

    typedef double real;
    typedef long long ll;

    template<class T> ostream& operator<<(ostream& os, const vector<T>& vs) {
        if (vs.empty()) return os << "[]";
        auto i = vs.begin();
        os << "[" << *i;
        for (++i; i != vs.end(); ++i) os << " " << *i;
        return os << "]";
    }
    template<class T> istream& operator>>(istream& is, vector<T>& vs) {
        for (auto it = vs.begin(); it != vs.end(); it++) is >> *it;
        return is;
    }

    map<ll, int> primeFactorize(ll n) {
        map<ll, int> ret;
        for (ll i = 2; i * i <= n; i++) {
            while (n % i == 0) {
                ret[i]++;
                n /= i;
            }
        }
        if (n != 1) ret[n]++;
        return ret;
    }
    ll pow(ll x, ll n) {
        ll ret = 1;
        for (int i = 0; i < n; i++) ret *= x;
        return ret;
    }
    ll eulersTotientFunction(ll n) {
        typedef map<ll, int> M;
        M factor = primeFactorize(n);
        ll ret = 1;
        for (M::iterator it = factor.begin(); it != factor.end(); it++) {
            ret *= pow(it->first, it->second) - pow(it->first, it->second - 1);
        }
        return ret;
    }

    int N;
    void input() {
        cin >> N;
    }

    void solve() {
        cout << eulersTotientFunction(N) << endl;
    }
}

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

Measured memory_bytes: 3080
import sys
import math
def i():return int(sys.stdin.readline().replace("\n",""))
def i2():return map(int,sys.stdin.readline().replace("\n","").split())
def s():return str(sys.stdin.readline().replace("\n",""))
def l():return list(sys.stdin.readline().replace("\n",""))
def intl():return [int(k) for k in sys.stdin.readline().replace("\n","").split()]
def lx():return list(map(lambda x:int(x)*-1,sys.stdin.readline().replace("\n","").split()))
def t():return tuple(map(int,sys.stdin.readline().replace("\n","").split()))

if __name__ == "__main__":pass

n = len(l())
s = ""
for i in range(n):
    s = s + "x"
print(s)


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

long long n;

int main() {
	cin >> n;
	for (int i = 1; i <= 1000; i++) {
		string S = "";
		if (i % 9 != 0) S += (char)('0' + (i % 9));
		for (int j = 0; j < i / 9; j++) S += "9";
		if (stoll(S) <= n) continue;
		cout << i - 1 << endl;
		break;
	}
	return 0;
}

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

// #undef DEBUG  // Uncomment this line to forcefully disable debug print.
#if DEBUG
template <typename T>
void debug(T value) {
  std::cerr << value;
}
template <typename T, typename... Ts>
void debug(T value, Ts... args) {
  std::cerr << value << ", ";
  debug(args...);
}
#define dbg(...)                              \
  do {                                        \
    cerr << #__VA_ARGS__ << ": ";             \
    debug(__VA_ARGS__);                       \
    cerr << " (L" << __LINE__ << ")" << endl; \
  } while (0)
#else
#define dbg(...)
#endif

void read_from_cin() {}
template <typename T, typename... Ts>
void read_from_cin(T& value, Ts&... args) {
  std::cin >> value;
  read_from_cin(args...);
}
#define in(type, ...) \
  type __VA_ARGS__;   \
  read_from_cin(__VA_ARGS__);

template <typename T>
void write_to_cout(const T& value) {
  std::cout << value << std::endl;
}
template <typename T, typename... Ts>
void write_to_cout(const T& value, const Ts&... args) {
  std::cout << value << ' ';
  write_to_cout(args...);
}
#define out(...) write_to_cout(__VA_ARGS__);

#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)

using ll = long long;

using namespace std;

int main() {
  in(double, w, h, x, y);
  cout << setprecision(20) << (w * h / 2) << " ";
  if (x * 2 == w && y * 2 == h) {
    cout << "1";
  } else {
    cout << "0";
  }
  cout << endl;
}


Measured memory_bytes: 3748
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <iomanip>
using namespace std;
const int inf = 1e9;

struct info{
    char curr;
    char prev;
    char v;
    double t;
    info(int c, int p, int v, double t):curr(c),prev(p),v(v),t(t){}
};
namespace std{
    bool operator < (const info &a, const info &b){
        return b.t < a.t;
    }
}

int main(){
    while(1){
        int n,m;
        cin >> n >> m;
        if(n==0) break;

        int s,g;
        cin >> s >> g;
        vector<vector<int> > dist(n+1, vector<int>(n+1, inf));
        vector<vector<int> > limit(n+1, vector<int>(n+1, 0));
        vector<info> map[31][31][31];
        
        for(int i=0; i<m; i++){
            int x,y,d,c;
            cin >> x >> y >> d >> c;
            dist[x][y] = dist[y][x] = d;
            limit[x][y] = limit[y][x] = c;
        }

        for(int i=1; i<=n; i++){ //curr
            for(int j=1; j<=n; j++){ //prev
                for(int k=1; k<=n; k++){ //next
                    if(k==j || dist[i][k]==inf) continue;
                    for(int v=1; v<=30; v++){ //speed
                        for(int r=-1; r<=1; r++){
                            if(v+r>0 && v+r <= limit[i][k]){
                                map[i][j][v].push_back(info(k, i, v+r, (double)dist[i][k]/(v+r)));
                            }
                        }
                    }
                }
            }
        }
        for(int i=1; i<=n; i++){
            if(dist[s][i] != inf){
                map[s][0][1].push_back(info(i, s, 1, dist[s][i]));
            }
        }

        priority_queue<info> pq;
        pq.push(info(s, 0, 1, 0));
        vector<vector<vector<double> > > mincost(n+1, vector<vector<double> >(n+1, vector<double>(31, inf)));
        mincost[s][0][1] = 0;
        while(!pq.empty()){
            int curr = pq.top().curr;
            int prev = pq.top().prev;
            int v = pq.top().v;
            double cost = pq.top().t;
            pq.pop();
            if(cost > mincost[curr][prev][v]) continue;
            if(curr==g && v==1) break;
            for(int i=0; i<(int)map[curr][prev][v].size(); i++){
                info next = map[curr][prev][v][i];
                if(cost + next.t < mincost[next.curr][next.prev][next.v]){
                    pq.push(info(next.curr, next.prev, next.v, cost+next.t));
                    mincost[next.curr][next.prev][next.v] = cost + next.t;
                }
            }
        }
        double ans=inf;
        for(int i=1; i<=n; i++){
            ans = min(ans, mincost[g][i][1]);
        }
        if(ans == inf){
            cout << "unreachable" << endl;
        }else{
            cout << fixed;
            cout << setprecision(10);
            cout << ans << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 56724
<?php
fscanf(STDIN,'%d%d%d',$N,$M,$C);
$B=explode(' ',fgets(STDIN));
$count=0;
for ($i=0; $i <$N ; $i++) {
  // code...
  $A=explode(' ',fgets(STDIN));
  $ANS=$C;
  for ($j=0; $j <$M ; $j++) {
    // code...
    $ANS=$ANS+$A[$j]*$B[$j];
  }
  if($ANS>0){
    $count++;
  }
}
echo $count;

 ?>


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

int main(){
  int a;
  int s;
  cin >> s;
  int h=s/100;
  a=h*100+h*10+h;
  if(a>=s){
    cout << a;
  }else{
    cout << (h+1)*100+(h+1)*10+h+1;
  }
}

Measured memory_bytes: 256
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

fn main() {
    let n = read::<usize>();
    let mut a = vec![];
    for _ in 0..n {
        a.push(read::<usize>());
    }
    let mut a_sorted = a.clone();
    a_sorted.sort();
    a_sorted.reverse();
    let a_max = a_sorted[0];
    let a2_max = a_sorted[1];
    for anum in a {
        if anum == a_max {
            println!("{}", a2_max);
        } else {
            println!("{}", a_max);
        }
    }
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}


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

typedef long long   signed int LL;
typedef long long unsigned int LU;

#define incID(i, l, r) for(int i = (l)    ; i <  (r); i++)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); i++)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); i--)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); i--)
#define  inc(i, n) incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define  dec(i, n) decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)

#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))

#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define PQ priority_queue

#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
#define  FOR(it, v) for(auto it =  v.begin(); it !=  v.end(); ++it)
#define RFOR(it, v) for(auto it = v.rbegin(); it != v.rend(); ++it)

template<typename T> bool   setmin(T & a, T b) { if(b <  a) { a = b; return true; } else { return false; } }
template<typename T> bool   setmax(T & a, T b) { if(b >  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } }
template<typename T> bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }

// ---- ----

int n, a[101];

int main() {
	cin >> n;
	inc(i, n) { cin >> a[i]; }
	a[n] = -1;
	
	int p = -2, c = 1, ans = 0;
	inc(i, n + 1) {
		if(a[i] == p) { c++; } else { ans += c / 2; c = 1; p = a[i]; }
	}
	
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,N) for(ll (i)=0;(i)<(N);(i)++)
#define chmax(x,y) x=max(x,y)
#define chmin(x,y) x=min(x,y)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const int mod = 1000000007;

int main() {
  string s;
  cin >> s;
  rep(i, 3) cout << s[i];
  cout << endl;
}

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

int main(){
  int N,K;
  cin >> N >> K;
  int count=0;
  vector<int> h(N);
  for(int i=0;i<N;i++){
    cin >> h.at(i);
    if(h.at(i)>=K){
      count++;
    }
  }
  cout << count << endl;
}

Measured memory_bytes: 640
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<tuple>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<deque>
#include<cmath>
#include<stack>
#define rep(i,n) for(int i = 0;i<n;i++)
#define _GLIBCXX_DEBUG
using ll = long long; 
using namespace std;

static const int N = 100;
static const int INF = (1<<21);

int n,M[N][N];
int d[N];

void bfs(int s) {
    queue<int>q;
    q.push(s);
    for(int i = 0; i< n;i++) d[i] = INF;
    d[s] = 0;
    int u;
    while(!q.empty()) {
        u = q.front();q.pop();
        for(int v = 0;v < n;v++) {
            if(M[u][v] == 0) continue;
            if(d[v] != INF) continue;
            d[v] = d[u]+1;
            q.push(v);
        }
    }
    for(int i = 0;i < n; i++) {
        cout << i+1 << " " << ( (d[i] == INF) ? (-1):d[i]) << endl;
    }}

    int main() {
        int u,k,v;
        rep(i,n) {
            rep(j,n) {
                M[i][j] = 0;
            }
        }
        cin >> n;
        for(int i = 0;i < n;i++) {
            cin >> u >> k;
            u--;
            for(int j = 0;j<k;j++) {
                cin >> v;
                v--;
                M[u][v] = 1;
            }
        }
        bfs(0);
        return 0;
    }



Measured memory_bytes: 3112
#include<iostream>
#include<cmath>
using namespace std;
struct Circle { long double x, y, r; };
int main() {
	Circle p, q;
	cin >> p.x >> p.y >> p.r;
	cin >> q.x >> q.y >> q.r;
	long double dist = sqrt((p.x - q.x)*(p.x - q.x) + (p.y - q.y)*(p.y - q.y));
	if (dist > p.r + q.r)cout << "4" << endl;
	else if (dist == p.r + q.r) {
		cout << "3" << endl;
	}
	else if (p.r <= q.r) {
		if (p.r + dist == q.r)cout << "1" << endl;
		if (p.r + dist < q.r)cout << "0" << endl;
		if (p.r + dist > q.r)cout << "2" << endl;
	}
	else {
		if (q.r + dist == p.r)cout << "1" << endl;
		if (q.r + dist < p.r)cout << "0" << endl;
		if (q.r + dist > p.r)cout << "2" << endl;
	}
	return 0;
}

Measured memory_bytes: 1220
#include<iostream>
using namespace std;
#define int long long int
#define mod 1000000007
int fac[2000001];
void function()
{
	fac[0]=1;
	int j;
	for(j=1;j<=2000000;j++)
	{
		fac[j]=(j*fac[j-1])%mod;
	}
}
int power(int x, int y, int p) 
{ 
    int res = 1;
  
    x = x % p;  
  
    while (y > 0) 
    { 
        if (y & 1) 
            res = (res*x) % p; 
        y = y>>1; 
        x = (x*x) % p; 
    } 
    return res; 
} 
int modInverse(int n, int p) 
{ 
    return power(n, p-2, p); 
} 
int nCrModPFermat(int n, int r, int p) 
{ 
	if(r>n||r<0)
	  return 0;
   if (r==0) 
      return 1; 
    return (fac[n]* modInverse(fac[r], p) % p * 
            modInverse(fac[n-r], p) % p) % p; 
} 
int32_t main()
{
	function();
	int h,w,a,b;
	cin>>h>>w>>a>>b;
	if(h==1)
	{
		if(a<h)
		cout<<1<<endl;
		else
		cout<<0<<endl;
		exit(0);
	}
	if(w==1)
	{
		if(b<w)
		cout<<1<<endl;
		else
		cout<<0<<endl;
		exit(0);
	}
	int val[h+1]={0};
	int i;
	int col=b+1;
	for(i=1;i<=h;i++)
	{
		if(i>h-a)
		{
			val[i]=val[i-1];
			continue;
		}
		int total=i+col-2;
		val[i]=nCrModPFermat(total,b,mod);
	}
	int answer=0;
	for(i=1;i<=h-1;i++)
	{
		col=b+2;
		int total=h+w-(i+col);
		int r=(w-col);
		int temp=nCrModPFermat(total,r,mod);
		int temp2=val[i];
		int curr=(temp*temp2)%mod;
		answer+=curr;
		answer%=mod;
	}
	answer+=val[h];
	answer=answer%mod;
	cout<<answer<<endl;
}


Measured memory_bytes: 16640
import bisect
n,k=map(int,input().split())
num_list=[i for i in range(10)]
d=list(input().split())
ans=n
while(True):
	n_digit=str(ans)
	for i in range(len(d)):
		if d[i] in n_digit :
			break
	else:
		print(ans)
		exit()
	ans+=1
	

Measured memory_bytes: 3060
N, A, B, C = map(int, input().split())
takes = []
for i in range(N):
    takes.append(int(input()))

takes = takes+[0,0,0,0,0,0,0]
takes = takes[:8]
g = [A, B, C]
combis = []
for i in range(4):
    for j in range(4):
        for k in range(4):
            for l in range(4):
                for m in range(4):
                    for n in range(4):
                        for o in range(4):
                            for p in range(4):
                                combis.append([i,j,k,l,m,n,o,p])

min_diff = 10**10
for combi in combis:
    A,B,C = 0,0,0
    for idx, el in enumerate(combi):
        if el == 0:
            A += takes[idx]
        elif el == 1:
            B += takes[idx]
        elif el == 2:
            C += takes[idx]

        if A == 0 or B == 0 or C == 0:
            continue

        A_diff = abs(g[0] - A) + (len([_ for _ in combi if _ == 0]) - 1)*10
        B_diff = abs(g[1] - B) + (len([_ for _ in combi if _ == 1]) - 1)*10
        C_diff = abs(g[2] - C) + (len([_ for _ in combi if _ == 2]) - 1)*10
        diff = A_diff + B_diff + C_diff
        min_diff = min(diff, min_diff)

print(min_diff)


Measured memory_bytes: 12788
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <tuple>
#include <queue>
using namespace std;
using ll=long long;
//using R=double;

const int INF = 10000000;
typedef pair<int, int> p;

int main(){
    string S;

    cin >> S;

    if(S[0] != 'A'){
        puts("WA");
        return 0;
    }else{

        if(isupper(S[1])){
            puts("WA");
            return 0;
        }

        int C_counter = 0;
        for(int i = 2; i < S.length()-1; i++){
            if(S[i] == 'C'){
                C_counter++;
            }else if(isupper(S[i])){
                puts("WA");
                return 0;
            }
        }

        if(isupper(S[S.length()-1])){
            puts("WA");
            return 0;
        }

        if(C_counter == 1){
            puts("AC");
        }else{
            puts("WA");
        }

    }

    return 0;
}


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

int main() {

	int n,i,ans;
	cin >> n;

	for (i = n; i <= (n*2)/2; i++) {
		if (i % 2 == 0 && i%n == 0) {
			ans = i;
			break;
		}
		else if (i == (n * 2) / 2) {
			ans = n * 2;
		}
	}

	cout << ans;

	return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse4")
#include"bits/stdc++.h"
using namespace std;
typedef long long ll;
#define int ll
#define sz(x) (int)(x).size();
#define all(x) x.begin(), x.end()
#define trav(i,a) for(auto &i:a) 
inline int in(){int x;scanf("%lld",&x);return x;}
int32_t main()
{
	map<int,int> a;
	int x,t;
	int n=in();int k=in();
	for(int i=0;i<n;i++)
	{
		x=in();t=in();
		a[x]+=t;
	}
	vector<pair<int,int>> f;
	trav(i,a)f.push_back({i.first,i.second});
	int i=0;
	while(k>0)
	{
		if(f[i].second<k)k-=f[i].second;
		else if(f[i].second>=k){cout<<f[i].first;return 0;}
		i++;
		
	}
	
}

Measured memory_bytes: 8172
#include<bits/stdc++.h>
#define int long long
#define inf 1000000000000000000
#define mod 1000000007
#define FLASH cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(false);
#define FILEIO freopen("/home/aman/Desktop/Kachda/input.txt", "r", stdin); //freopen("/home/aman/Desktop/Kachda/output.txt", "w", stdout);
using namespace std;


signed main()
{
    FLASH
	
	int n, k;
	cin>>n>>k;
	int ans  = inf;
	
	n %= k;
	ans = min(n, k - n);
	
	cout<<ans<<'\n';
}

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
using namespace std;
int n,a[200001],b[200001];
inline int rd()
{
	char tmp=getchar();
	int ddd=0;
	while('0'>tmp&&tmp<'9')
	{
		tmp=getchar();
	}
	while('0'<=tmp&&tmp<='9')
	{
		ddd=(ddd<<3)+(ddd<<1)+(tmp^48);
		tmp=getchar();
	}
	return ddd;
}
int main()
{
	n=rd();
	for(int i=1;i<=n;++i)
	{
		a[i]=b[i]=rd();
	}
	sort(a+1,a+1+n);
	for(int i=1;i<=n;++i)
	{
		if(a[n]==b[i])
		{
			printf("%d\n",a[n-1]);
		}
		else
		{
			printf("%d\n",a[n]);
		}
	}
	return 0;
}


Measured memory_bytes: 3072
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#define FOR(n) for(int i=0;i<n;i++)
#define FORJ(n) for(int j=0;j<n;j++)
#define PRN(n) printf("%d\n",n)
#define PRF(n) printf("%lf\n",n)
#define PRL(n) printf("%lld\n",n)
#define PRS(s) printf("%s\n",s)
#define PRC(c) printf("%c",c)
#define INF 10000000000
#define mod 1000000007
typedef long long int ll;
ll u(const void *a, const void *b){
    return *(ll*)a-*(ll*)b;
}
ll d(const void *a, const void *b){
    return *(ll*)b-*(ll*)a;
}
ll min(ll a,ll b){
  if(a>b)return b;
  return a;
}
ll max(ll a,ll b){
  if(a>b)return a;
  return b;
}
ll gcd(ll a,ll b){
  if(!b)return a;
  return gcd(b,a%b);
}
int kt(ll a){
  int sum=0;
  while(a){
    a/=10;
    sum++;
  }
  return sum;
}
int ks(ll a){
  int sum=0;
  while(a){
    sum+=a%10;
    a/=10;
  }
  return sum;
}
int f(ll a){
  for(int i=2;i<=sqrt(a);i++)if(a%i<1)return 0;
  return 1;
}
int main(void){
  int n;
  scanf("%d",&n);
  int x=1;
  while(x<=n)x*=2;
  PRN(x/2);
  return 0;
}



Measured memory_bytes: 2096
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; i++)
#define all(v) v.begin(), v.end()
#define INF 10000000000
#define MOD 1000000007
using namespace std;
int main() {
    int a, b, c, x, y;
    cin >> a >> b >> c >> x >> y;
    int sa;
    if(x < y) {
        sa = y - x;
        if(a * x + b * y < x * 2 * c + sa * b) {
            cout << a * x + b * y;
        } else {
            cout << min(x * 2 * c + sa * b, y * 2 * c);
        }
    } else {
        sa = x - y;
        if(a * x + b * y < y * 2 * c + sa * a) {
            cout << a * x + b * y;
        } else {
            cout << min(y * 2 * c + sa * a, x * 2 * c);
        }
    }
    return 0;
}

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

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

    int a=0, b=0;
    for(int i=0; i<n; i++){
        string s,t;
        cin >> s >> t;
        if(s==t){
            a++;
            b++;
        }else if(s > t){
            a += 3;
        }else{
            b += 3;
        }
    }
    cout << a << " " << b << endl;
    return 0;
}


Measured memory_bytes: 3216
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text.RegularExpressions;

    class Program
    {
        static void Main(string[] args)
        {
            var line = Console.ReadLine();

            Regex reRainyDay = new Regex("R+");

            var match = reRainyDay.Match(line);

            if(match.Success)
            {
                Console.WriteLine(match.Length);
            }
            else
            {
                Console.WriteLine("0");
            }
        }
    }

Measured memory_bytes: 26856
#include <bits/stdc++.h>
#include <stdlib.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> P;
typedef priority_queue<P,vector<P>,greater<P>> P_queue;

#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define mp make_pair
#define ALL(a) a.begin(),a.end()
#define SORT(a) sort(ALL(a))
#define U_ERASE(V) V.erase(unique(ALL(V)), V.end());

const ll MOD=998244353;
const ll mod=1000000007;
const ll INF=1e15;
vec dx={1,0,-1,0};
vec dy={0,1,0,-1};

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


int main(){
    ll N; cin>>N;
    vec d=divisor(N-1);
    vec D=divisor(N);

    ll ans=d.size()-1;
    ll K=D.size();
    REP(i,1,K){
        ll A=D.at(i);
        ll B=N/A;
        while(B%A==0) B/=A;
        if(B%A==1) ans++;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 384
def main():
    n = int(input())
    abc = [list(map(int,input().split())) for i in range(n)]

    dp = [[0] * 3 for _ in range(n)]

    dp[0][0] = abc[0][0]
    dp[0][1] = abc[0][1]
    dp[0][2] = abc[0][2]

    for i in range(n-1):
        for j in range(3):
            dp[i+1][j] = max(dp[i][(j+1) % 3], dp[i][(j+2) % 3]) + abc[i+1][j]

    print(max(dp[n-1]))

if __name__ == "__main__":
    main()

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

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define REP(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) std::cout << x << '\n'
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define sz(x) ((int)(x).size())
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { ll g = gcd(a, b); return a / g * b; }
const int dx[4] = { 1, 0, -1,  0 };
const int dy[4] = { 0, 1,  0, -1 };
const int INF = INT_MAX / 2;
const ll  inf = LLONG_MAX / 2;
const int mod = 1000000007;
const int MAX_N = 101010;
const long double PI = acos(-1);

ll dp[101][5][5][5] = {};
//0:dammy, 1:A, 2:, 3:G, 4:T
//AGC, GAC, ACG, A*GC, AG*Cを含まない(123, 213, 132がダメ)

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

	int a, b;
	cin >> a >> b;

	for (int i = 0; i < 1010; i++) {
		if (floor(i * 0.08) == a
			&& floor(i * 0.10) == b) {
			out(i);
			return 0;
		}
	}

	out(-1);

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
using namespace std;
typedef long long int ll;

ll mod=1e9+7;
int main(){
    int n; cin >> n;
    string s; cin >> s;
    for(int i=0;i<2*n;i++){
        if(i%2==0){
            s[i]=(s[i]=='B'?'W':'B');
        }
    }
    ll ans=1;
    ll w=0;
    for(int i=0;i<2*n;i++){
        if(s[i]=='W')w++;
        else if(w==0&&s[i]=='B'){
            cout << 0 << endl;
            return 0;
        }
        else{
            ans*=w;
            ans%=mod;
            w--;
        }
    }
    if(w>0){
        cout << 0 << endl;
        return 0;
    }
    for(int i=1;i<=n;i++){
        (ans*=i)%=mod;
    }
    cout << ans << endl;
}

Measured memory_bytes: 640