akhauriyash/Code-Regression huggingface dataset:
#!/usr/bin/python3
import bisect
from collections import Counter, deque, OrderedDict, defaultdict
# from copy import copy, deepcopy # pythonのみ．copyは1次元，deepcopyは多次元．
# from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN
# from functools import reduce
# from heapq import heapify, heappop, heappush
# from itertools import accumulate, permutations, combinations, combinations_with_replacement, groupby, product
# import math
# import numpy as np  # Pythonのみ！
# from operator import xor
# import re
# from scipy.sparse.csgraph import connected_components  # Pythonのみ！
# ↑cf.  https://note.nkmk.me/python-scipy-connected-components/
# from scipy.sparse import csr_matrix
# import statistics # Pythonのみ
# import string
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

def resolve():
    
    s=input()

    ss=s*2
    d={}
    for k,v in enumerate(ss):
        if v in d:
            d[v].append(k)
        else: d[v]=[k]
    

    

    ls=len(s)
    t=input()
    cur=-1 #見終えた場所
    flag=False
    for i in t:
        if i in d:
            idx=d[i][bisect.bisect_left(d[i],(cur+1)%ls)]
            dif=idx-(cur+1)%ls+1
            cur+=dif
        else:
            flag=True
            break
    print(cur+1 if not flag else -1)




    
resolve()

Measured memory_bytes: 79204
#include <bits/stdc++.h>
#include <string>
#include <cstring>
#include <algorithm>
#include <math.h>
#include <map>
#include <bitset>
#include <cmath>
#include <set>
#include <utility>

#define INF 1000000000000
#define MOD 1000000007 //10^9+7:合同式の法

using namespace std;
typedef long long ll;

//マクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)

int main(){
    int X,Y,s;
    cin >> X >> Y;
    bool fla = false;

    for(int i = 0;i <= X;i++){
        s = X - i;
        if((2 * i + s * 4) == Y){
            fla = true;
            break;
        }
    }

    if(fla)
        cout << "Yes" << endl;
    else
    {
        cout << "No" << endl;
    }
    
}

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

int main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  int l, r;
  l = a + b;
  r = c + d;
  if ( l == r ) {
  	cout << "Balanced" << endl;
  }
  else if ( l < r ){
  	cout << "Right" << endl;
  }
  else {
  	cout << "Left" << endl;}
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <complex>
#include <string>
#include <algorithm>
#include <numeric>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#ifndef LOCAL
#define debug(x) ;
#else
#define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;

template <typename T1, typename T2>
ostream &operator<<(ostream &out, const pair<T1, T2> &p) {
  out << "{" << p.first << ", " << p.second << "}";
  return out;
}

template <typename T>
ostream &operator<<(ostream &out, const vector<T> &v) {
  out << '{';
  for (const T &item : v) out << item << ", ";
  out << "\b\b}";
  return out;
}
#endif

#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 200010


int main(){
  int n;

  cin >> n;

  if (n == 1) {
    cout << "Hello World" << endl;
  } else {
    int a, b;
    cin >> a >> b;
    cout << a + b << endl;
  }

  return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define endl '\n'
#define D(x) cerr << #x << " = " << (x) << '\n'
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
typedef long long ll;



int main()
{
  int S, T, D;
  cin >> D >> T >> S;
  if(S * T >= D) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 3632
#include<iostream>
#include<iomanip>
#include<algorithm>
using namespace std;
#define rep(i,n) for(int i = 0 ; i < (n) ; ++i )
int N,res,cd1[9],cd2[9];
bool used[9];
void dfs(int cnt,int pta,int ptb){
  if(cnt == 9){
    res += pta > ptb ? 1 : 0;
    return;
  }
  rep(i,9){
    if(used[i]) continue;
    used[i] = true;
    int px = cd1[i] > cd2[cnt] ? cd1[i]+cd2[cnt] : 0;
    int py = cd2[cnt] > cd1[i] ? cd1[i]+cd2[cnt] : 0;
    dfs(cnt+1,pta+px,ptb+py);
    used[i] = false;
  }
}
int main(){
  cin >> N;
  while( N-- ){
    res = 0;
    fill_n(used,9,false);
    rep(i,9) cin >> cd1[i];
    rep(i,9) cin >> cd2[i];
    dfs(0,0,0);
    double ans = (double)res / 362880.0 ;
    cout << fixed << setprecision(10) << ans << " " << 1 - ans << endl;
  }
}

Measured memory_bytes: 1236
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;
typedef long double lb;
#define int long long
#define double long double
#define endn "\n"
typedef pair<int,int> P;
template<class T> inline bool chmin(T& a, T b){if(a>b){a = b;return 1;}return 0;}
template<class T> inline bool chmax(T& a, T b){if(a<b){a = b;return 1;}return 0;}
const int MOD = 1000000007;
const ll INF = 1e16;
const double EPS = 1e-10;
const double PI = 3.141592653589793;
const string abc="abcdefghijklmnopqrstuvwxyz";
const string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const pair<int,int> fd[] = {make_pair(1,0),make_pair(-1,0),make_pair(0,1),make_pair(0,-1)}; 


////////////////////////////////////////////////////////////////////

int n,m;int t[110000], c[110000], d[110000];
map<int, int>cc;vector<int> vec;
signed main(){
  cin>>n>>m;
  rep(i,n){
    int x;cin>>x;
    c[x%m]++;
    cc[x%m]++;
    t[x]++;
    if(t[x]%2 == 0)d[x%m]++;//同じ数の2枚組を数える
  }
  int ans = 0;
  for(auto p : cc)vec.push_back(p.first);
  for(auto md : vec){
    if(c[md] == -1)continue;
    int op = (m-md)%m;
    assert(0 <= op && op < m);
    if(md == op){
      ans += c[md]/2;
      c[md] = -1;
    }else{
      int dc = min(c[md], c[op]);
      ans += dc;
      c[md] -= dc;
      c[op] -= dc;
      ans += max(min(d[op], c[op]/2), min(d[md], c[md]/2));
      c[md] = c[op] = -1;
    }
  }
  cout << ans << endl;
}


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

int main(){
  int N, M;
  cin >> N >> M;
  vector<int> H(N+1);
  vector<int> MA(N+1,0);
  for(int i=1; i<=N; i++){
    cin >> H[i];
  }
  for(int i=0; i<M; i++){
    int s, t;
    cin >> s >> t;
    MA[s] = max(MA[s], H[t]);
    MA[t] = max(MA[t], H[s]);
  }
  int ans = 0;
  for(int i=1; i<=N; i++){
    if(H[i]>MA[i]) ans++;
  }
  cout << ans << endl;
  return 0;
}


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

long long gcd(long long a, long long b) {

   	if(a < b) {
       swap(a, b);
   	}

	long long r = a % b;
	while(r != 0) {
		a = b;
		b = r;
		r = a % b;
	}

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

    ll K;
    cin >> K;

    ll ans = 0;

    //vector<vector<ll> > g(K + 1, vector<ll>(K + 1));

    for(ll i = 1; i <= K; i++) {
        for(ll j = 1; j <= K; j++) {
            for(ll k = 1; k <= K; k++) {
                ll x = gcd(i, j);
                ans += gcd(x, k);
            }
        }
    }

    cout << ans << endl;
}

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

using namespace std;

#ifndef ONLINE_JUDGE
  #define pr_debug(...) do { printf("DEBUG: line %d: %s: ", __LINE__, __PRETTY_FUNCTION__); printf(__VA_ARGS__); } while(0)
  #define pr_vars(...) do { pr_debug(" "); pr_var(split(#__VA_ARGS__, ',').begin(), __VA_ARGS__); } while(0)
#else
  __attribute__ ((constructor)) static void fast_cin() { ios_base::sync_with_stdio(false); cin.tie(0); }
  #define pr_debug(...) do { } while(0)
  #define pr_vars(...) do { } while(0)
#endif /* ONLINE_JUDGE */

using ll = int64_t;
using ull = uint64_t;

template<typename X, typename Y> ostream &operator<< (ostream &fout, const pair<X, Y> &p)
{ fout << '{' << p.first << ", " << p.second << "} "; return fout; }

template<typename T> ostream &operator<< (ostream &fout, const vector<T> &vec)
{ for (const auto &el : vec) fout << el << ' '; return fout; }

template<typename T> istream &operator>> (istream &fin, vector<T> &vec)
{ for (size_t i = 0; i < vec.size(); i++) fin >> vec[i]; return fin; }

vector<string> split(const string &s, char c) { vector<string> v; ull st = 0, fn = 0, lvl = 0;
for ( ; fn < s.size(); fn++ ) { if (s[fn] == c && lvl == 0) { v.push_back(s.substr(st, fn - st)); st = fn + 1; }
if (s[fn] == '(') { lvl++; } if (s[fn] == ')') { lvl--; } } v.push_back(s.substr(st, fn - st)); return v; }

void pr_var(vector<string>::iterator it) { (void) it; cout << endl; }
template<typename T, typename... Args> void pr_var(vector<string>::iterator it, T a, Args... args)
{ cout << *it << "=" << a << "  "; pr_var(++it, args...); }

ll div_ceil(ll n, ll d) { ll res = n / d; if (res >= 0) res += n % d ? 1 : 0; return res; }
ll gcd(ll a, ll b) { a = llabs(a); b = llabs(b); while (a && b) a > b ? a %= b : b %= a; return a + b; }
ll lcm(ll a, ll b) { ll c = gcd(a, b); return c == 0 ? 0 : llabs(a / c * b); }

#define setp(a) fixed << setprecision(a)
const double PI = acos(-1.0);
constexpr double EPS = 1e-9;
constexpr double INF = 2e18;

using mp = pair<ll, ll>;
using mt = tuple<ll, ll, ll>;    // unpack: tie(ll, ll, ll) = mt;

constexpr ll MAX = 1e5 + 5;

int main()
{
    ll n; cin >> n;
    ll t = 0, x = 0, y = 0;
    while (n--) {
        ll tt, xx, yy; cin >> tt >> xx >> yy;
        ll dt = tt - t;
        ll dx = llabs(xx - x);
        ll dy = llabs(yy - y);
        ll d = dx + dy;
        t = tt; x = xx; y = yy;
        if (d > dt) { cout << "No" << endl; exit(0); }
        dt -= d;
        if (dt % 2 == 1) { cout << "No" << endl; exit(0); }
//        if ((dt % 2 == 1) && (d % 2 == 1)) continue;
//        if ((dt % 2 == 0) && (d % 2 == 1)) continue;
//        { cout << "No" << endl; exit(0); }
    }
    cout << "Yes" << endl;
    return 0;
}


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

#define ll long long
#define endl '\n'
#define REP(i, a, n) for(int i=a; i<n; ++i)
#define pb push_back
#define sz(x) (int)((x).size())
#define all(x) (x).begin(), (x).end()

typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;

const double PI = 3.141592653589793238460;
const ll mod = 1e9 + 7;

void FAST(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
}

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

int main(){
  FAST();

  int n, i;
  cin >> n;
  vector<tuple<string, int, int> > rest(n);

  REP(i, 0, n){
    string name;
    int score;
    cin >> name >> score;
    rest[i] = make_tuple(name, score, i + 1);
  }

  sort(all(rest), comp);

  REP(i, 0, n)
    cout << get<2>(rest[i]) << endl;


  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, n) for(ll i=0; i<(ll)n; i++)
#define REPR(i, n) for(ll i=(ll)n-1; i>=0; i--)
#define FOR(i, m, n) for(ll i=(ll)m; i<(ll)n; i++)
#define FORR(i, m, n) for(ll i=(ll)m-1; i>=(ll)n; i--)
#define ALL(x) (x).begin(), (x).end()
#define ASC(v) sort(ALL(v));
#define DESC(v) sort(ALL(v), greater<int>());
#define UNIQ(a) sort(ALL(a));(a).resize(unique(ALL(a)) - a.begin());
#define PRINTD(x, d) cout << fixed << setprecision(d) << x << "\n";
#define DEBUG(x) cout<<#x<<": "<<x<<"\n"
const double PI = acos(-1);
ll lcm(ll a, ll b) { return a / __gcd(a, b) * b; }
bool isprime(int x){ int i; if(x<2)return 0; else if(x==2) return 1; if(x%2==0) return 0; for(i=3; i*i<=x; i+=2) if(x%i==0) return 0; return 1; }
int digsum(int n) { int r=0; while(n>0) { r+=n%10; n/=10; } return r; }
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 (a>b) { a = b; return 1; } return 0; }


void solve(string S){
	bool can = false;
	if (S[0]==S[1]) can = true;
	if (S[1]==S[2]) can = true;
	if (S[2]==S[3]) can = true;
	if (can) cout << "Bad" << "\n";
	else cout << "Good" << "\n";
}

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


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

signed main()
{
  int T1, T2, A1, A2, B1, B2;
  cin >> T1 >> T2; 
  cin >> A1 >> A2; 
  cin >> B1 >> B2; 
  A1 *= T1; A2 *= T2; B1 *= T1; B2 *= T2; 

  if(A1+A2 == B1+B2) {puts("infinity"); return 0;}
  if(A1+A2 < B1+B2) { swap(A1, B1); swap(A2, B2); }
  if(A1 > B1) {puts("0"); return 0;}

  // A1 < B1
  int D1=A1-B1;
  int D2=A2-B2;

  assert(D1<0);
  assert(D2>0);

  int S = abs(D1)/(D1+D2);
  int T = abs(D1)%(D1+D2);

  if(T==0) cout << 2*S << endl;
  else cout << 2*S + 1 << endl;
}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"io"
	"log"
	"os"
	"strconv"
)

func main() {
	n := readInt()
	a := make([]int, n)
	trend := make([]int, n)
	for i := range a {
		a[i] = readInt()
		if i == 0 {
			trend[i] = 0
		} else {
			if a[i] > a[i-1] {
				trend[i] = 1
			} else if a[i] < a[i-1] {
				trend[i] = -1
			} else {
				trend[i] = trend[i-1]
			}
		}
	}

	money := 1000
	stock := 0
	for i := 1; i < n; i++ {
		//buy
		if trend[i] == 1 && trend[i] != trend[i-1] {
			stock = money / a[i-1]
			money = money % a[i-1]
			continue
		}

		//sell
		if trend[i] == -1 && trend[i] != trend[i-1] {
			money += stock * a[i-1]
			stock = 0
		}
	}

	fmt.Println(money + stock*a[n-1])
}

var (
	readString func() string
	readBytes  func() []byte
)

func init() {
	log.SetFlags(log.Lshortfile)
	readString, readBytes = newReadString(os.Stdin)
}

func newReadString(ior io.Reader) (func() string, func() []byte) {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	f1 := func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
	f2 := func() []byte {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Bytes()
	}
	return f1, f2
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 10, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readInt() int {
	return int(readInt64())
}

func readFloat64() float64 {
	f, err := strconv.ParseFloat(readString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func sum(a []int) int {
	var ret int
	for i := range a {
		ret += a[i]
	}
	return ret
}

func sumFloat64(a []float64) float64 {
	var ret float64
	for i := range a {
		ret += a[i]
	}
	return ret
}

func gcd(m, n int) int {
	for m%n != 0 {
		m, n = n, m%n
	}
	return n
}

func lcm(m, n int) int {
	return m / gcd(m, n) * n
}


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

namespace ConsoleApplication21
{
    class Program
    {
        static void Main(string[] args)
        {
            while(true)
            {
                int n = int.Parse(Console.ReadLine());

                if (n == 0)
                {
                    break;
                }

                string[] str = Console.ReadLine().Split(' ');

                int[] S = new int[n];
                int sum1 = 0;

                for (int i = 0; i < n; ++i)
                {
                    S[i] = int.Parse(str[i]);
                    sum1 += S[i];
                }

                double m = (double)sum1 / n;

                double sum2 = 0;

                for (int i = 0; i < n; ++i)
                {
                    sum2 += Math.Pow((S[i] - m), 2);
                }

                double a = Math.Sqrt(sum2 / n);

                Console.WriteLine("{0:f8}",a);

            }
        }
    }
}

Measured memory_bytes: 20056
import sys


N, K = map(int, input().split())
cnt_B = 0
black = [[0] * (2 * K) for _ in range(2 * K)]
for s in sys.stdin.readlines():
    x, y, c = s.split()
    x = int(x); y = int(y)
    y = y if c == 'B' else y + K
    black[x % (2 * K)][y % (2 * K)] += 1
    cnt_B += 1

S_black = [[0] * (2 * K + 1) for _ in range(2 * K)]
for i in range(2 * K):
    for j in range(2 * K):
        S_black[i][j + 1] = S_black[i][j] + black[i][j]

ans = 0
for j in range(K):
    var_B = 0
    for i in range(K):
        var_B += S_black[i][j + K] - S_black[i][j]
        var_B += S_black[i + K][2 * K] - (S_black[i + K][j + K] - S_black[i + K][j])
    ans = max(ans, max(var_B, cnt_B - var_B))

    for i in range(K):
        var_B += (S_black[i + K][j + K] - S_black[i + K][j]) - (S_black[i][j + K] - S_black[i][j])
        var_B -= S_black[i + K][2 * K] - (S_black[i + K][j + K] - S_black[i + K][j])
        var_B += S_black[i][2 * K] - (S_black[i][j + K] - S_black[i][j])
        ans = max(ans, max(var_B, cnt_B - var_B))

print(ans)


Measured memory_bytes: 121564
#include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <string>
#include <bitset>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <sstream>
#include <fstream>
#include <tuple>
#include <set>
#include <functional> 
#include <string.h>

#define X first
#define Y second
#define MP make_pair
#define MT make_tuple
#define FOR(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define REP(i, a, n) for(int (i) = (a); (i) < (n); (i)++)
typedef long long ll;
typedef std::pair<int, int> pii;
typedef std::pair<ll, ll > pll;
using namespace std;
const int MAX = 101;
const double PI = 3.1415926535897932384;

template<class T, class U>
void convert(T &t, U &u){
	stringstream ss;
	ss << t;
	ss >> u;
}

int TakeCustomNum(string s){
	int val = 0, digit = 10;
	FOR(i, s.size()){
		if (s[i] == ',') break;
		else{
			val *= digit;
			val += s[i] - '0';
		}
	}
	return val;
}

void InputLastData(map<int, int> &ans){
	string s;
	while (getline(cin, s) && s != "\0"){
		ans[TakeCustomNum(s)]++;
	}
}

void TakeCommonData(map<int, int> &prev, map<int, int> &now){
	string s;
	while (getline(cin, s) && s != "\0"){
		int key = TakeCustomNum(s);

		if (now.count(key)) now[key]++;
		else if (prev.count(key)) now[key] += prev[key] + 1;
	}
}

void OutputData(map<int, int> &ans){
	for(auto i: ans){
		if (i.second > 1){
			cout << i.first << " " << i.second << endl;
		}
	}
}

int main(){
	ios::sync_with_stdio(false);
	map<int, int> prev, now;
	
	InputLastData(prev); 
	TakeCommonData(prev, now);

	OutputData(now);

	return 0;
}

Measured memory_bytes: 1188
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>

using namespace std;

int main() {
	int n, sum = 0;
	cin >> n;
	vector<int> a(n);
	for (int i = 0; i < n; i++) cin >> a[i];

	for (int i = 0; i < n; i++) {
		sum += a[i];
	}
	cout << sum-n << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <cmath>
#include <climits>
#include <math.h>
#include <bitset>

#define P pair
#define X first
#define Y second
#define VSORT(v) sort(v.begin(), v.end())
#define VREV(v) reverse(v.begin(), v.end())
#define VMAX_P(v) max_element(v.begin(), v.end())
#define VMIN_P(v) min_element(v.begin(), v.end())
#define VMAX_IDX(v) distance(v.begin(), VMAX_P(v))
#define VMIN_IDX(v) distance(v.begin(), VMIN_P(v))
#define VCOPY(src, dst) copy(src.begin(), src.end(), back_inserter(dst))
#define SUPPER(src, dst) transform(src.begin(), src.end(), dst.begin(), toupper);
#define SLOWER(src, dst) transform(src.begin(), src.end(), dst.begin(), tolower);

using namespace std;
using ll = long long;

int main(int argc, const char *argv[])
{
    int x, a;
    cin >> x >> a;
    if (x < a)
    {
        cout << 0 << endl;
    }
    else
    {
        cout << 10 << endl;
    }
}


Measured memory_bytes: 256
#include <cstdio>
using namespace std;int main(){int n,r,i;while(scanf("%d",&n)&&n){r=-n;for(i=1;i*i<=n;i++)if(n%i==0){r+=i+n/i;if(i==n/i)r-=i;}printf("%s",n>r?"deficien":n<r?"abundan":"perfec");puts("t number");}}

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

int main() {
    int a, b;
    cin >> a >> b;

    if (a + b == 15)
        cout << "+";
    else if (a * b == 15)
        cout << "*";
    else
        cout << "x";
    cout << endl;

    return 0;
}


Measured memory_bytes: 3628
#include <algorithm>
#include <iostream> //入出力
#include <stdio.h>
#include <map>
#include <set>
#include <string>
#include <math.h> //算術演算子
#include <vector>
#include <cstdlib>
#include <queue>
#include <stack>
#include <list>
#include <iomanip> //小数点以下を表示させる(setprecision())
//#include <bits/stdc++.h>
using namespace std;
typedef long long ll; //64bit型

#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(a) (a).begin(), (a).end()
#define debug(x) cerr << x << " " \
                      << "(L:" << __LINE__ << ")" << '\n'
#define PRINT(V)                                   \
        {                                          \
                for (int i = 0; i < V.size(); i++) \
                {                                  \
                        cout << V[i] << " ";       \
                }                                  \
                cout << endl;                      \
        }

int gcd(int a, int b)
{
        return b ? gcd(b, a % b) : a;
}

int main()
{
        //input->compute->output//

        int N;
        cin >> N;
        string ans = "";
        while (N != 0)
        {
                if (N % 2 != 0)
                {
                        N--;
                        ans = "1" + ans;
                }
                else
                {
                        ans = "0" + ans;
                }
                N /= -2;
        }
        if (ans == "")
        {
                ans = "0";
        }

        cout << ans << endl;

        return 0;
}


Measured memory_bytes: 256
while 1:
  n,k = map(int,input().split())
  if n == k == 0:
    break
  a = []
  for i in range(n):
    a.append(int(input()))
    c = 0
  for i in range(k):
    c += a[i]
    b = c
  for i in range(k, n):
    c += a[i]
    c -= a[i - k]
    b = max(b,c)
  print(b)


Measured memory_bytes: 9604
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <iomanip>
#include <cmath>
#include <cstdlib>
#include <map>
#include <utility>
#include <numeric>
#define ll long long
#define REP(i, x) for(int (i) = 0; (i) < (x); (i) ++)
#define pi 3.1415926535
const int MOD = 1000000007;
using namespace std;

int main() {
	ll l, r;
	cin >> l >> r;
	if (r - l >= 2018) {
		cout << 0 << endl;
		return 0;
	}
	l %= 2019;
	r %= 2019;
	if (l >= r) {
		cout << 0 << endl;
		return 0;
	}
	ll m = 1000000000000;
	for (ll i = l; i < r; i++) {
		ll num;
		for (ll j = i + 1; j <= r; j++) {
			num = i * j;
			num %= 2019;
			if (num < m) {
				m = num;
			}
		}
	}
	cout << m << endl;
	return 0;
}

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

// Input macro from https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
  (source = $s:expr, $($r:tt)*) => {
    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)*}
  };
}

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

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

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) => {
    read_value!($iter, String).chars().collect::<Vec<char>>()
  };

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

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

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

fn main() {
  let out = std::io::stdout();
  let mut out = std::io::BufWriter::new(out.lock());
  macro_rules! puts {
    ($($format:tt)*) => (write!(out,$($format)*).unwrap());
  }
  input! {
    n: usize,
    m: usize,
    sc: [(usize1, u32); m],
  }
  for i in 0 .. 10u32.pow(n as u32) {
    if n != 1 && i < 10u32.pow(n as u32-1) {
      continue;
    }
    let mut v = vec![];
    if i == 0 {
      v.push(0);
    }
    let mut x = i;
    while x > 0 {
      v.push(x % 10);
      x /= 10;
    }
    v.reverse();
    let mut ok = true;
    for &(s, c) in &sc {
      if v[s] != c {
        ok = false;
        break;
      }
    }
    if ok {
      puts!("{}\n", i);
      return;
    }
  }

  puts!("-1\n");
}


Measured memory_bytes: 4352
import java.util.Scanner;
 
public class Main {
 
    public static void main(String[] args) {
 
        Scanner sc = new Scanner(System.in);
 
        while(true){
 
            int a = sc.nextInt();
            String op = sc.next();
            int b = sc.nextInt();
 
            if(op.equals("?"))break;
 
            int ans = 0;
 
            switch(op){
            case "+":
                ans = a+b;
                break;
            case "-":
                ans = a-b;
                break;
            case "*":
                ans = a*b;
                break;
            case "/":
                ans = a/b;
                break;
            }
 
            System.out.printf("%d\n", ans);
        }
    }
}


Measured memory_bytes: 26364
#include<iostream>
using namespace std;
int main() {
	int a, b, c;
	cin >> a >> b >> c;
	bool flag = false;
	for (int n = 1; n <= b; n++) {
		if ((a*n) % b == c) { flag = true; break; }
	}
	if (flag) { cout << "YES" << endl; }
	else { cout << "NO" << endl; }
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
#define ll long long
int a[1000001];
int main()
{
	ll n;
	cin >> n;
	a[0]=0;
	ll sum=0;
	for(ll i=1;i<=n;i++)
	{  if(i%3!=0&&i%5!=0){a[i]=i;}
		else{a[i]=0;}
		sum=sum+a[i];}
	cout << sum << endl;
}


Measured memory_bytes: 7496
#include<bits/stdc++.h>
#define N 2005
#define M 4000005
using namespace std;
int n,a[N],S;
bitset<M> F;
int main()
{
	int i;
	scanf("%d",&n);
	for(i=1;i<=n;i++)
		scanf("%d",&a[i]),S+=a[i];
	sort(a+1,a+n+1);
	F[0]=1;
	for(i=1;i<=n;i++)
		F|=(F<<a[i]);
	for(i=S/2;i>=0;i--)
		if(F[i]) break;
	cout<<S-i;
	return 0;
}


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

int main()
{
	int N, S[10000], Q, T, C = 0;
	cin >> N;
	for(int i = 0; i < N; ++i)
	{
		cin >> S[i];
	}
	cin >> Q;
	for(int i = 0; i < Q; ++i)
	{
		cin >> T;
		for(int j = 0; j < N; ++j)
		{
			if(S[j] == T)
			{
				++C;
				break;
			}
		}
	}
	
	cout << C << endl;

    return 0;
}



Measured memory_bytes: 3104
#include<algorithm>
#include<algorithm>     //sort,二分探索,など
#include<bitset>        //固定長bit集合
#include<cmath>         //pow,logなど
#include<complex>       //複素数
#include<deque>         //両端アクセスのキュー
#include<functional>    //sortのgreater
#include<iomanip>       //setprecision(浮動小数点の出力の誤差)
#include<iostream>      //入出力
#include<iterator>      //集合演算(積集合,和集合,差集合など)
#include<map>           //map(辞書)
#include<numeric>       //iota(整数列の生成),gcdとlcm(c++17)
#include<queue>         //キュー
#include<set>           //集合
#include<stack>         //スタック
#include<string>        //文字列
#include<unordered_map> //イテレータあるけど順序保持しないmap
#include<unordered_set> //イテレータあるけど順序保持しないset
#include<utility>       //pair
#include<vector>        //可変長配列

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvll;
typedef vector<vector<string>> vvs;
typedef vector<vector<bool>> vvb;
const ll MOD = 1000000007;
const ll INF = 1000000000000000000;
#define rep(i,n) for(int i=0;i<n;i++)
#define repl(i,s,e) for(int i=s;i<e;i++)
#define reple(i,s,e) for(int i=s;i<=e;i++)
#define revrep(i,n) for(int i=n-1;i>=0;i--)
#define all(x) (x).begin(),(x).end()

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

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

    char s;
    cin >> s;

    if (isupper(s))
    {
        cout << "A" << endl;
    }
    else
    {
        cout << "a" << endl;
    }

    return 0;
}

Measured memory_bytes: 3644
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.List;
import java.util.Collection;
import java.util.Scanner;
import java.util.Queue;
import java.util.ArrayDeque;
import java.util.ArrayList;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        EHopscotchAddict solver = new EHopscotchAddict();
        solver.solve(1, in, out);
        out.close();
    }

    static class EHopscotchAddict {
        EHopscotchAddict.Vertex[] vertices;

        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            int m = in.nextInt();
            vertices = new EHopscotchAddict.Vertex[n];
            for (int i = 0; i < n; i++) {
                vertices[i] = new EHopscotchAddict.Vertex();
                vertices[i].id = i + 1;
            }
            for (int i = 0; i < m; i++) {
                vertices[in.nextInt() - 1].next.add(vertices[in.nextInt() - 1]);
            }
            int res = solveMe(vertices, n, m, vertices[in.nextInt() - 1], vertices[in.nextInt() - 1]);
            out.println(res);
        }

        private int solveMe(EHopscotchAddict.Vertex[] vertices, int n, int m, EHopscotchAddict.Vertex source, EHopscotchAddict.Vertex dest) {
            Queue<EHopscotchAddict.Vertex> queue = new ArrayDeque<>();
            queue.add(source);
            source.isAdded = 1;
            while (!queue.isEmpty()) {
                EHopscotchAddict.Vertex curr = queue.remove();
                for (int i = 0; i < 3; i++) {
                    if (((curr.isAdded & (1 << i)) != 0) && (curr.isUsed & (1 << i)) == 0) {
                        curr.isUsed |= (1 << i);
                        for (EHopscotchAddict.Vertex v : curr.next) {
                            v.distances[(i + 1) % 3] = curr.distances[i] + 1;
                            if (v == dest && v.distances[(i + 1) % 3] % 3 == 0)
                                return v.distances[(i + 1) % 3] / 3;
                            queue.add(v);
                            v.isAdded |= (1 << ((i + 1) % 3));

                            //System.err.println("[" + v.id + "]  = " + v.distances[(i + 1) % 3] + " isAdded = " + v.isAdded);
                        }
                    }

                }
            }
            return -1;
        }

        public static class Vertex {
            List<EHopscotchAddict.Vertex> next = new ArrayList<>();
            int isAdded;
            int isUsed;
            int[] distances = new int[3];
            int id;

        }

    }
}



Measured memory_bytes: 107132
#include <bits/stdc++.h>
#define all(v) (v).begin(), (v).end()
#define pb push_back
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
using namespace std;
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template<class T>using numr=std::numeric_limits<T>;
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; }
const int INF = 1e9;
const ll LLINF = 1e16;
const int MOD = 1000000007;
const int MOD2 = 998244353;

int main() {
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);
    ll n;
    cin >> n;
    vector<ll> num(n+1);
    for(ll i = 1; i <= n; i++){
        for(ll j = i; j <= n; j+= i) num[j]++;
    }
    ll ans = 0;
    for(int i=1;i <= n;i++) ans += i * num[i];
    cout << ans << endl;
}

Measured memory_bytes: 81336
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll mod=1e9+7;

int main(){
    int N;
    cin >> N;
    vector<int> d(N);
    for(int i=0; i<N; i++){
        cin >> d[i];
    }
    sort(d.begin(), d.end());
    cout << d[int(N/2)]-d[int(N/2)-1];
}

Measured memory_bytes: 640
#include <iostream>

using namespace std;

int n, a, b, c, d;
string s;
bool flag;

int main()
{
    cin >> n >> a >> b >> c >> d >> s;
    if (a > b)
    {
        swap(a, b);
        swap(c, d);
    }
    flag = 1;
    if (c < a || d < b) flag = 0;
    if (s[a - 1] == '#' || s[b - 1] == '#' || s[c - 1] == '#' || s[d - 1] == '#') flag = 0;
    if (c == d) flag = 0;
    for (int i = a + 1; i < c; i++) if (s[i - 1] == '#' && s[i] == '#') flag = 0;
    for (int i = b + 1; i < d; i++) if (s[i - 1] == '#' && s[i] == '#') flag = 0;
    if (c > d)
    {
        bool mk = 0;
        for (int i = b; i <= d; i++) if (i < n && i > 1 && s[i - 2] == '.' && s[i - 1] == '.' && s[i] == '.') mk = 1;
        if (!mk) flag = 0;
    }
    if (flag) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

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

using namespace std;
 
#define PB(x)	push_back(x)
#define ALL(x)	(x).begin(), (x).end()
#define ALLR(x)	(x).rbegin(), (x).rend()
#define MP(x)	make_pair(x)
 
#define debug(_x)		cerr << #_x << '=' << _x << endl;
#define debug2(_x, _y)	cerr << #_x << '=' << _x << ' ' << #_y << '=' << _y << endl;
#define debugn(_a)		cerr << #_a << ": "; for (const auto _x: _a) cerr << _x << ' '; cerr << endl;

#define FAST_IO ios::sync_with_stdio(false); cin.tie(0)

#define int long long int

typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef unsigned long long ull;

const int INF = LONG_LONG_MAX>>1;
const int NINF = LONG_LONG_MIN/2;

const int N = 2005;
int dp[N][N];

int32_t main() {
	FAST_IO;
		
	int s, w;
	cin >> s >> w;
	
	if (w >= s) cout << "unsafe" << endl;
	else cout << "safe" << endl;
}

// g++ -Wall -Wextra -Wshadow -fsanitize=undefined


Measured memory_bytes: 3640
//#include<bits/stdc++.h>
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<string>
#include<numeric>
#include<vector>
#include<set>
#include<map>
#include<unordered_map>
#include<stack>
#include<queue>
#include<list>
using namespace std;

typedef long long ll;

#define MOD 1000000007

class Comb{
private:
  ll *fac,*finv,*inv;
public:
  Comb(){
    fac = new ll[1000000];
    finv = new ll[1000000];
    inv = new ll[1000000];
    fac[0] = 1;
    for(int i=1;i<1000000;i++){
      fac[i] = i*fac[i-1];
      fac[i] %= MOD;
    }
    inv[1] = 1;
    for(int i=2;i<1000000;i++){
      inv[i] = MOD-inv[MOD%i]*(MOD/i)%MOD;
    }
    finv[0] = 1;
    for(int i=1;i<1000000;i++){
      finv[i] = inv[i]*finv[i-1];
      finv[i] %= MOD;
    }
  }
  ll calc(ll n,ll k){
    ll c = fac[n];
    c *= finv[k];c %= MOD;
    c *= finv[n-k];c %= MOD;
    return c;
  }
};

int main(){
  string s;
  cin >> s;
  bool flag=true;
  int n = s.length();
  for(int i=0;i<n/2;i++){
    if(s[i] != s[n-1-i]) flag = false;
  }
  for(int i=0;i<(n/2)/2;i++){
    if(s[i] != s[n/2-1-i]) flag = false;
  }
  for(int i=0;i<n/2;i++){
    if(s[n/2+1+i] != s[n-1-i]) flag = false;
  }
  if(flag) cout << "Yes" << endl;
  else cout << "No" << endl;
}


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

int main() {
 
    int x=1,y=1,z=1;
    int N;

    cin >> N;
    
    vector<int> count(N);

    for(int i=0;i<=N;i++){
        count[i] = 0;
    }

    for(int n=1;n<=N;n++){
        for(x=1;x*x <= n;x++){
            for(y=1;x*x+y*y+x+y <= n;y++){
                for(z=1;x*x + y*y +z*z + x*y+y*z+x*z <=n;z++){
                    if(x*x + y*y +z*z + x*y+y*z+x*z == n){
                        count[n]++;
                    }
                }
            }
        }
    }

    for(int i=1;i<=N;i++){
        cout << count[i] << endl;
    }

    return 0;
}

Measured memory_bytes: 3572
use std::io::*;

fn main() {
  let stdin = stdin();
  let line = stdin.lock().lines().next().unwrap().unwrap();

  let mut args = line.split_whitespace().map(|str| str.parse::<i32>().unwrap());
  let a = args.next().unwrap();
  let b = args.next().unwrap();
  let c = args.next().unwrap();

  let count = (a..(b + 1)).fold(0, |acc, x| {
    if c % x == 0 { acc + 1 }
    else { acc }
  });
  println!("{}", count);
}



Measured memory_bytes: 5032
program ARC073D
    implicit none
    integer(8)::N,W,i,j,k,l,a,b,c,d,Vall(100,4),wi,w1,vi,vcount(4),ans,wall,v
    read*,N,W
    vcount=0
    Vall=0
    ans=0
    do i=1,N
        read*,wi,vi
        if(i==1)w1=wi
        vcount(wi-w1+1)=vcount(wi-w1+1)+1
        Vall(vcount(wi-w1+1),wi-w1+1)=vi
    end do

    do i=1,4
        call heapsort(100,Vall(:,i))
    end do

    do i=0,vcount(1)
        do j=0,vcount(2)
            do k=0,vcount(3)
                do l=0,vcount(4)
                    wall=i*w1+j*(w1+1)+k*(w1+2)+l*(w1+3)
                    if(wall<=W)then
                        v=0
                        do a=0,i-1
                            v=v+Vall(100-a,1)
                        end do

                        do b=0,j-1
                            v=v+Vall(100-b,2)
                        end do

                        do c=0,k-1
                            v=v+Vall(100-c,3)
                        end do

                        do d=0,l-1
                            v=v+Vall(100-d,4)
                        end do
                        ans=max(ans,v)
                    end if
                end do
            end do
        end do
    end do

    print'(i0)',ans
end program ARC073D

subroutine heapsort(n,array)
    implicit none
    integer,intent(in) :: n
    integer(8),intent(inout) :: array(1:n)
   
    integer(8) ::i,k,j,l
    integer(8) :: t
   
    if(n.eq.1)return
  
    l=n/2+1
    k=n
    do while(k.ne.1)
       if(l.gt.1)then
          l=l-1
          t=array(L)
       else
          t=array(k)
          array(k)=array(1)
          k=k-1
          if(k.eq.1) then
             array(1)=t
             exit
          endif
       endif
       i=l
       j=l+l
       do while(j.le.k)
          if(j.lt.k)then
             if(array(j).lt.array(j+1))j=j+1
          endif
          if (t.lt.array(j))then
             array(i)=array(j)
             i=j
             j=j+j
          else
             j=k+1
          endif
       enddo
       array(i)=t
    enddo
  
    return
  end subroutine heapsort

Measured memory_bytes: 512
#include<stdio.h>

int main(){
    int n,m,l;
    int A[100][100] = {{0}};
    int B[100][100] = {{0}};
    long long int pro[100][100] = {{0}};
    scanf("%d %d %d",&n,&m,&l);
    //読み取り部
    for(int i = 0;i < n;i++)for(int j = 0;j < m;j++) scanf("%d",&A[i][j]);
    for(int i = 0;i < m;i++)for(int j = 0;j < l;j++) scanf("%d",&B[i][j]);

    for(int i = 0;i < n;i++){
        for(int j = 0; j < l;j++){
            for(int k = 0; k < m; k++){
                pro[i][j] += A[i][k] * B[k][j];

            }
        }
    }
    for(int i = 0; i < n;i++){
        for(int j = 0; j < l;j++){
            printf("%lld",pro[i][j]);
            if(j != l - 1) printf(" ");
        }
        printf("\n");
    }
}


Measured memory_bytes: 2924
import java.util.Scanner;

public class Main{
	public static void main(String[] args){

		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		char[] S = sc.next().toCharArray();
		sc.close();
		System.out.println(GetRGBCnt(N, S));
	}
	// public static void main(String[] args) throws Exception {

	// 	// char t[] = {'G','R','B','R'};
	// 	// int r55 = GetRGBCnt2(t.length, t);

	// 	for(int i=0; ; i++){
	// 		char[] S = getRGB(i);
	// 		if(4000<S.length){
	// 			System.out.println("--Complite--");
	// 		}
	// 		System.out.println(S);

	// 		int r1 = GetRGBCnt(S.length, S);
	// 		int r2 = GetRGBCnt2(S.length, S);
	// 		if(r1 != r2){
	// 			System.out.println("--------NG---------");
	// 			System.out.println(S.length);
	// 			System.out.println(S);
	// 			System.out.println(r1);
	// 			System.out.println(r2);
	// 			throw new Exception();
	// 		}
	// 	}
	// }

	public static char[] getRGB(int N){
		String base3 = Integer.toString(N, 3);
		char[] c = base3.toCharArray();
		for(int i=0; i<c.length; i++){
			if(c[i]=='0'){c[i]='R';continue;};
			if(c[i]=='1'){c[i]='G';continue;};
			if(c[i]=='2'){c[i]='B';continue;};
		}
		return c;
	}

	public static long GetRGBCnt(int N, char[] S){
		// RGB個数をカウント
		int[] iRGB = {0, 0, 0, 0}; // RGB Count
		for(int i=0; i<N; i++){
			if('R'==S[i]) {iRGB[0]++; continue;}
			if('G'==S[i]) {iRGB[1]++; continue;}
			if('B'==S[i]) {iRGB[2]++; continue;}
			iRGB[3]++;
		}

		// RGBとなる組合せ数を計算
		long max = (long)iRGB[0] * (long)iRGB[1] * (long)iRGB[2];

		// 除外
		long jogai = 0;
		// 開始点を0から順に設定
		for(int pit=0; pit<N-2; pit++){
			// 間隔を1から順に設定し、開始点から同間隔の2点を設定
			for(int len=1; pit+len*2<N; len++){
				// 3点を取得
				int[] p = {0, 0, 0};
				p[0] = pit;
				p[1] = pit+len;
				p[2] = pit+len*2;
				// 3点の間隔が同じでRGBになっている場合は除外
				if(S[p[0]]!=S[p[1]] && S[p[0]]!=S[p[2]] && S[p[1]]!=S[p[2]]){
					jogai++;
				}
			}
		}
		return max - jogai;
	}

	public static int GetRGBCnt2(int N, char[] S){
		int cnt = 0;
		for(int i=0; i<N-2; i++){
			for(int j=i+1; j<N-1; j++){
				for(int k=j+1; k<N; k++){
					// RGB判定
					if(S[i]!=S[j] && S[i]!=S[k] && S[j]!=S[k]){
						if(j-i != k-j){
							cnt++;
						}
					}
				}
			}
		}
		return cnt;
	}
}

Measured memory_bytes: 30472
package main
import (
   "fmt"
   "os"
   "bufio"
   "strconv"
)
var sc = bufio.NewScanner(os.Stdin)

func main() {
  sc.Split(bufio.ScanWords)
  s := nextString()

  if (s == "BBB" || s == "AAA") {
	  fmt.Println("No")
  } else {
	  fmt.Println("Yes")
  }
}

func nextString() (string) {
	sc.Scan()
	v := sc.Text()
	return v
}

func nextInt() (int) {
	sc.Scan()
	v, e := strconv.Atoi(sc.Text())
    if e != nil { panic(e) }
    return v
}

func nextFloat() (float64) {
	sc.Scan()
	v, e := strconv.ParseFloat(sc.Text(), 64)
    if e != nil { panic(e) }
    return v
}


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

void swap(int &x, int &y)
{
    int t = x;
    x = y;
    y = t;
}

int gcd(int x, int y)
{
    if (x < y)
        swap(x, y);
    while (y > 0) {
        int r = x % y;
        x = y;
        y = r;
    }
    return x;
}

int main()
{
    int x, y;

    cin >> x >> y;
    cout << gcd(x, y) << endl;
}


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

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

    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a.at(i);
    }

    for (int i = k; i < n; i++) {
        if (a.at(i-k) < a.at(i)) {
            cout << "Yes" << endl;
        } else {
            cout << "No" << endl;
        }
    }

    return 0;
}


Measured memory_bytes: 3996
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include <bitset>
using namespace std;
#define INF 110000000000
#define MOD 1000000007
typedef long long ll;
typedef pair<ll,int> P;

ll dp[110000][13];

int main(){
  string S;
  cin>>S;
  int bai=1,temp;
  dp[0][0]=1;
  for(int i=0;i<S.size();i++,bai=bai*10%13){
    //cout<<i<<endl;
    for(int j=0;j<13;j++){
      if(S[S.size()-1-i]!='?'){
        temp=S[S.size()-1-i]-'0';
        dp[i+1][(j+temp*bai)%13]+=dp[i][j];
        //cout<<i<<" "<<j<<" "<<dp[i+1][(j+temp*bai)%13]<<endl;
        dp[i+1][(j+temp*bai)%13]%=MOD;
      }else{
        for(int k=0;k<10;k++){
          dp[i+1][(j+k*bai)%13]+=dp[i][j];
          dp[i+1][(j+k*bai)%13]%=MOD;
        }
      }
    }
  }
  for(int i=0;i<=S.size();i++){
    for(int j=0;j<13;j++){
      //cout<<i<<" "<<j<<" "<<dp[i][j]<<endl;
    }
  }
  cout<<dp[S.size()][5]<<endl;
}


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

int main(void){
  int n, a;
  int min = 2000000;
  int max = -2000000;
  long long int sum = 0;

  cin >> n;
  for(int i = 0; i < n; i++){
    cin >> a;
    if(a > max){ max = a; }
    if(a < min){ min = a; }
    sum += a;
  }

  cout << min << " " << max << " " << sum << endl;

  return 0;
}

Measured memory_bytes: 1164
#include<iostream>
#include<algorithm>
using namespace std;
int main() {

	int a[10000], ax[10000], ans = 0,kouho=0;
	cin >> a[0];
	bool tr = false;

	for (int i = 0;; i++) {

		if (a[i] % 2 == 0) {//偶数
			a[i + 1] = a[i] / 2;
		}
		else {//奇数
			a[i + 1] = (a[i] * 3) + 1;
		}

		for (int q = 0; q != i; q++)ax[q] = a[q];

		sort(ax, ax + i);

		for (int w = 0; w != i; w++) {
			if (ax[w] == ax[w + 1]) {
				tr = true;
				ans = ax[w];
				w = i - 1;
			}
		}

		if (tr) {
			for (int e = 0; e != i; e++) {
				if (a[e] == ans) {
					if (kouho < e) {
						kouho = e;
					}
				}
			}
			cout << kouho+1 << endl;
			return 0;
		}
		
	}

	return 0;
}

Measured memory_bytes: 888
# -*- coding: utf-8 -*-
 
## Library
 
import sys
from fractions import gcd
import math
from math import ceil,floor
import collections
from collections import Counter
import itertools
import copy
 
## input
 
# N=int(input())
# A,B,C,D=map(int, input().split())
# S = input()
# yoko = list(map(int, input().split()))
# tate = [int(input()) for _ in range(N)]
# N, M = map(int,input().split()) 
#    P = [list(map(int,input().split())) for i in range(M)]
#    S = []
#    for _ in range(N):
#        S.append(list(input()))
 
K,A,B=map(int, input().split())

if B<=A+2:
    print(K+1)
else:
    if K < A-1:
        print(K+1)
    else:
        K = K - (A-1)
        N = A
        if K%2==0:
            N += K//2 * (B-A)
        else:
            N += K//2 * (B-A) + 1
        print(N)
                



Measured memory_bytes: 77468
import sys
n, a, b = map(int, sys.stdin.readline().split())

def sumDigits(x):
    s = 0
    while x > 0:
        s += x % 10
        x = x // 10
    return s

s = 0
for i in range(1, n+1):
    if a <= sumDigits(i) <= b:
        s += i

print(s)

Measured memory_bytes: 2940
#include <iostream>
#include <stdio.h>

using namespace std;
typedef long long int lint;

bool inRectangle(int W, int H, int x, int y, int r)
{
	if (x - r < 0 || x + r > W || y - r < 0 || y + r > H) return false;
	return true;
}

void answer()
{
	int W, H, x, y, r;
	cin >> W >> H >> x >> y >> r;
	if (inRectangle(W, H, x, y, r)) cout << "Yes";
	else cout << "No";
	cout << endl;
}

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

Measured memory_bytes: 1156
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <queue>
#include <iostream>
#include <bitset>
#include <set>
using namespace std;
#define N 10000005
#define ll long long
int n,sum,a[N];char s[N];
int main()
{
	scanf("%s",s+1);n=strlen(s+1);
	for(int i=1;i<=n;i++)a[i]=(s[i]^48)*9;
	reverse(a+1,a+n+1);
	for(int i=1;i<=n;i++)a[i+1]+=a[i]/10,a[i]%=10;
	if(a[n+1])n++;
	for(int i=1;i<=n;i++)sum+=a[i];
	for(int k=1;k<=n;k++)
	{
		int t=a[1];a[1]+=9;int i=1;
		while(a[i]>=10)sum-=t,t=a[i+1],a[i]-=10,sum+=a[i],a[++i]++;
		sum-=t;sum+=a[i];if(sum<=k*9)return printf("%d\n",k),0;
	}
}

Measured memory_bytes: 4864
using System;

class main
{
    public static int n = 1000001;
    static void Main()
    {
        string s;
        int q;
        int[] p = new int[n];
        for (int i = 2; i < 1001; ++i)
                for (int j = i * 2; j < n; j += i)
                    p[j] = 1;
        while ((s = Console.ReadLine()) != null){
                q = 0;
                for (int i = 2; i <= int.Parse(s); ++i)
                    if (p[i] != 1) ++q;
                Console.WriteLine("{0}", q);
        }    
    }
}

Measured memory_bytes: 9540