akhauriyash/Code-Regression huggingface dataset:
import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline

n = int(input())
s = input() #sys.stdin.readlineは最後が改行

r = [0]*n
g = [0]*n
b = [0]*n

for i in range(n):
    if s[i] == 'R':r[i]+=1
    elif s[i] == 'G':g[i]+=1
    else: b[i]+=1

from itertools import accumulate
r_nokori = list(reversed(r))
r_nokori = list(reversed(list(accumulate(r_nokori))))
g_nokori = list(reversed(g))
g_nokori = list(reversed(list(accumulate(g_nokori))))
b_nokori = list(reversed(b))
b_nokori = list(reversed(list(accumulate(b_nokori))))

ans = 0

for i in range(n-2):
    for j in range(i+1,n-1):
        if s[i]==s[j]: continue

        if (s[i]=='R' and s[j]=='G') or (s[i]=='G' and s[j]=='R'):
            ans += b_nokori[j+1]
            if 2*j-i <= n:
                if s[2*j-i] == 'B': ans-= 1

        if (s[i]=='G' and s[j]=='B') or (s[i]=='B' and s[j]=='G'):
            ans += r_nokori[j+1]
            if 2*j-i <= n:
                if s[2*j-i] == 'R': ans-= 1

        if (s[i]=='B' and s[j]=='R') or (s[i]=='R' and s[j]=='B'):
            ans += g_nokori[j+1]
            if 2*j-i <= n:
                if s[2*j-i] == 'G': ans-= 1

print(ans)



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


int main(){
    int L;
    cin >> L;
    double ans;
    ans = (L / 3.0) * (L / 3.0) * (L / 3.0);

    cout << fixed << setprecision(10) << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>

using namespace std;
using ll=long long;

#define rep(i, a, n) for (int i = (a); i < (n); ++i)

int main(){
  std::cin.tie(nullptr);                  // 標準入出力高速化
  std::ios_base::sync_with_stdio(false);  // SとS++の入出力出力を非同期
  string s,op={'+','+','+'};
  cin>>s;
  int a[4];
  rep(i,0,4){
      a[i]=s[i]-'0';
  }
  int sum;
  rep(i,0,8){
      sum=a[0];
      rep(j,0,3){
          if(i&(1<<j)){
              op[j]='+';
              sum+=a[j+1];
          }else{
              op[j]='-';
              sum-=a[j+1];
          }
      }
      if(sum==7){
        break;
      }
  }
  rep(i,0,3){
      cout<<a[i]<<op[i];
  }
  cout<<a[3]<<"=7"<<endl;
}


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


int wa(int n){
    int sum = 0;
    //nがゼロになるまで
    while(n > 0){
        sum += n%10;
        n /= 10;
    }
    return sum;
}

int main() {
  int n,a,b;
  cin >> n >> a >> b;
  int count = 0;

  //nが値　a < x , x < b　を満たす必要がある
  for(int i = 1; i <= n; i++){//1以上n以下の整数
    //1回だけではだめ　0になるまでループが必要
    int s = wa(i);
    if(a <= s && s <= b){
        count += i;
    }
  }
  cout << count << endl;

}



Measured memory_bytes: 3576
from collections import deque
import sys
input = sys.stdin.readline

N, Q = [int(i) for i in input().split()]

E = [[] for _ in range(N + 1)]
for _ in range(N - 1):
    a, b = [int(i) for i in input().split()]
    E[a].append(b)
    E[b].append(a)

M = [0] * (N + 1)
for _ in range(Q):
    p, x = [int(i) for i in input().split()]
    M[p] += x

ans = M[:]
visited = [False] * (N + 1)
visited[1] = True
Q = deque([1])
while Q:
    a = Q.popleft()
    for e in E[a]:
        if visited[e]:
            continue
        visited[e] = True
        ans[e] += ans[a]
        Q.append(e)

print(*ans[1:])


Measured memory_bytes: 63608
import itertools

n = int(input())
x = []
y = []
h = []
for i in range(n):
    X, Y, H = map(int, input().split())
    x.append(X)
    y.append(Y)
    h.append(H)
for cx, cy in itertools.product(range(101), range(101)):
    H = []
    for i in range(n):
        if h[i] == 0:
            continue
        H.append(h[i] + abs(x[i] - cx) + abs(y[i] - cy))
    if len(set(H)) == 1 and H[0] >= 1:
        for j in range(n + 1):
            if j == n:
                break
            if max(H[0] - abs(x[j] - cx) - abs(y[j] - cy), 0) != h[j]:
                break
        if j == n:
            break
print("{} {} {}".format(cx, cy, H[0]))


Measured memory_bytes: 3188
#include <stdio.h>

int main(){
   int x, h, m, s;
   scanf("%d",&x);
   h=x/3600;
   m=(x-3600*h)/60;
   s=x-3600*h-60*m;
   printf("%d:%d:%d\n",h, m, s);
   return 0;
}

Measured memory_bytes: 2744
(defun solve (aa bb cc)
  (labels ((rec (a b c n firstp)
             (cond ((or (oddp a) (oddp b) (oddp c)) n)
                   ((and (not firstp) (= a aa) (= b bb) (= c cc)) -1)
                   (t (rec (+ (/ b 2) (/ c 2))
                           (+ (/ a 2) (/ c 2))
                           (+ (/ a 2) (/ b 2))
                           (1+ n) nil)))))
    (rec aa bb cc 0 t)))

(princ (solve (read) (read) (read)))
(terpri)


Measured memory_bytes: 13032
N = int(input())

P = [input() for i in range(N)]

d = {}
for n in P:
    if n not in d.keys():
        d[n] = 0
    d[n] += 1


# valueでソート。降順=True
sorted_list = sorted(d.items(), key=lambda x:x[1], reverse=True)

max_num = sorted_list[0][1]

new_list = [sorted_list[0][0]]
for e in sorted_list[1:]:
    if max_num != e[1]:
        break
    new_list.append(e[0])


for r in sorted(new_list):
    print(r)

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

int main() {
  int H, W;
  cin >> H >> W;
  
  vector < vector <char> > a((H+2), vector <char> ((W+2), '#'));
  for (int i=0; i<H+2; i++) {
    for (int j=0; j<W+2; j++) {
      if (i!=0 && i!=H+1) {
        if (j!=0 && j!=W+1) {
          cin >> a.at(i).at(j);
        }
      }
    }
  }
  
  for (int i=0; i<H+2; i++) {
    for (int j=0; j<W+2; j++) {
      cout << a.at(i).at(j) << flush;
      if (j==W+1) {
        cout << endl;
      }
    }
  }
  
  
  
  /*
  vector<char> a((H+2)*(W+2), "#");
  for (int i=0; i<(H+2)*(W+2); i++) {
    if ( (i !< W+2) || (i !> (H+2)*(W+2)-(W+2)-1 ) ) {
      if ( (i%(W-1)==0) || (i%*W==0) ) {
        cin >> a.at(i);
      }
    }
  }
  
  for (int i=0; i<(H+2)*(W+2); i++) {
    cout << a.at(i) << flush;
    if(i%(W-1)==0) cout << endl;
  }
  */
}

Measured memory_bytes: 256
/*-In the name of God-

Author : Syed Mujtaba
Seek knowledge from the Cradle to the Grave !!
https://www.linkedin.com/in/syed-mujtaba
*/
#include <bits/stdc++.h>
using namespace std;
#define int             long long
#define ld              long double
#define ll              long long
#define pb              push_back
#define fi              first
#define se              second
#define MAXN            200064
#define mod             1000000007  //998244353 // 1e9 + 7
#define MAX             8000000000000000064LL
#define MIN            -8000000000000000064LL
#define mt              make_tuple
#define eps             1e-6
#define endl            '\n'
#define test            int T_T; cin>>T_T; while(T_T--)
#define fast_io         ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

signed main()
{
  	fast_io
  	int n, d;
  	cin >> n >> d;
  	int X[MAXN], Y[MAXN];
  	int ans = 0;
  	for(int i = 0; i < n; ++i)
  	{
  		cin >> X[i] >> Y[i];
  		ld dis = sqrt(X[i] * X[i] + Y[i] * Y[i]);
  		if(dis <= (ld)(d))
  		{
  			++ans;
  		}
  	}
  	cout << ans << '\n';
}

Measured memory_bytes: 6788
#include <stdio.h>
int ctoi(char c){
    switch(c){
        case '0':{return 0;}
        case '1':{return 1;}
        case '2':{return 2;}
        case '3':{return 3;}
        case '4':{return 4;}
        case '5':{return 5;}
        case '6':{return 6;}
        case '7':{return 7;}
        case '8':{return 8;}
        case '9':{return 9;}
        default:{return -1;}
    }
}
int main(){
    int sum;
    char c;
    while(1){
        sum = 0;
        c = getchar();
        if(c=='0')break;
        else ungetc(c,stdin);
        while(1){
            c = getchar();
            if(c == '\n')break;
            sum += ctoi(c);
        }
        printf("%d\n",sum);
    }
}

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

int main() {
  	string S,T;
	int A,B;
  	string U;
    cin>> S >> T;
  	cin>> A >> B;
  	cin>> U;
  	
  	if(U==S){
     	 cout<< A-1 <<" "<< B <<endl;
    }
    else{
     	 cout<< A <<" "<< B-1<<endl;	  
    }
  
}

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

typedef long long ll;
typedef long double ld;
typedef vector<vector<int>> Graph;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
#define pi 3.14159265359
#define inf 2147483647
#define INF 9223372036854775807
#define mod 1000000007
#define mod2 998244353

int main() {
    int N; cin >> N;
    map<int, int> cnt;
    for(int i = 0; i < N; i++) {
        int a; cin >> a;
        if(!cnt.count(a)) cnt[a] = 1;
        else cnt[a]++;
    }
    ll ans = 0;
    for(auto p: cnt) {
        if(p.first < p.second) ans += p.second - p.first;
        else if(p.first > p.second) ans += p.second;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 8128
#include <algorithm>
#include <iostream>
#include <numeric>
#include <set>
#include <string>
#include <vector>

using namespace std;

#define loop(i, times) for(int i = 0; i < times; i++)
#define seloop(i, start_index, end_index) for(int i = start_index; i < end_index; i++)
#define eqseloop(i, start_index, end_index) for(int i = start_index; i <= end_index; i++)

class NyaGadgetVector
{
public:
	/**
	@brief 加算関数
	@note
	 collectionの全要素にadd_valueだけ値を加算する
	**/
	template<typename T> static void Add(vector<T>& collection, T add_value)
	{
		for (auto& e : collection)
			e += add_value;
	}
	/**
	@brief 標準入力関数
	@note
	 標準入力から入力されたsize個の値をcollectionに格納する
	**/
	template<typename T> static void InputStream(vector<T>& collection, int size)
	{
		for (int i = 0; i < size; i++)
			cin >> collection[i];
	}
	/**
	@brief 最大値取得関数
	@note
	 collectionの要素の中で最大値を取得する
	**/
	template<typename T> static T Max(const vector<T>& collection)
	{
		T max = collection[0];
		for (const auto& e : collection)
		{
			if (max < e)
				max = e;
		}
		return max;
	}
	/**
	@brief 最小値取得関数
	@note
	 collectionの要素の中で最大値を取得する
	**/
	template<typename T> static T Min(const vector<T>& collection)
	{
		T min = collection[0];
		for (const auto& e : collection)
		{
			if (min < e)
				min = e;
		}
		return min;
	}
	/**
	@brief 合計関数
	@note
	 collectionの要素を合計して返す(範囲はstart_index以上end_index未満)
	**/
	template<typename T> static T Sum(const vector<T>& collection, int start_index, int end_index)
	{
		int sum = 0;
		for (int i = start_index; i < end_index; i++)
			sum += collection[i];
		return sum;
	}
};

class NyaGadgetCpp17
{
public:
	template <typename T> static T gcd(T a, T b)
	{ 
		return b ? gcd(b, a % b) : a;
	}
};


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

	long temp;
	vector<long> monster_collection(n, 0);
	NyaGadgetVector::InputStream(monster_collection, n);

	long ans = monster_collection[0];
	loop(i, n-1)
		ans = NyaGadgetCpp17::gcd<long>(ans, monster_collection[i+1]);
	
	cout << ans;
	return 0;
}


Measured memory_bytes: 1024
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(); 

       if(a < b){
           System.out.println("a < b");
       }
        if(a > b){
            System.out.println("a > b");
        }
        if(a == b){
            System.out.println("a == b");
        }
    }
}


Measured memory_bytes: 26228
def main():
    N = int(input())
    s = [int(input()) for _ in range(N)]
    s.sort()

    ans = sum(s)
    if ans % 10 != 0:
        print(ans)
        exit()
    else:
        for ss in s:
            tmp = ans - ss
            if tmp % 10 != 0:
                print(tmp)
                exit()

    print(0)


if __name__ == "__main__":
    main()


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

int main(){
  string p;
  cin >> p;
  bool flag = !((p[0] == p[1])||(p[1]==p[2])||p[2]==p[3]);
  if(flag){
  cout << "Good" << endl;
  }
  else{
  cout << "Bad" <<endl;
  } 
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <stdio.h>
#include <numeric>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define repone(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define Rep(j,n) for(int j=0;j<(int)(n);++j)
#define Repo(j,o,n) for(int j=o;j<(int)(n);++j)
#define Repone(j,n) for(int j=1;j<(int)(n);++j)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define int long long
#define pb(a) push_back(a)
#define pbpair(a,b) push_back(make_pair(a,b))
#define MOD 1000000007
#define INF 9223372036854775807
#define pairint pair<int,int>
int gcd( int x, int y ){ return y ? gcd(y, x%y) : x; }
signed main() {
int x=0,y=0,z=0,w=0,n=0;
int a=0,b=0;
std::cin >> a;
vector< pair<int,int> > v;
rep(i,a){
  std::cin >> x>>y;
  v.pbpair(x,y);
}
std::cin >> b;
rep(i,b){
  std::cin >> x>>y;
  v.pbpair(x,y);
}
sort(all(v));
z=v[0].first;
w=v[0].second;
rep(i,v.size()){

  if(i){
        if(z==v[i].first&&w==v[i].second)continue;
    std::cout << " ";

  }
  if(v[i].second<10)  std::cout << v[i].first <<":" <<0<< v[i].second ;
  else std::cout << v[i].first <<":" << v[i].second;
  z=v[i].first;
  w=v[i].second;
}
std::cout << '\n';

}



Measured memory_bytes: 3112
#include <cstdio>
#include <climits>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <list>
#include <set>
#include <bitset>
#include <iterator>
#define loop(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) for(long long i = 0; i < (long long)(n); i++)
#define debug(x)  cout << #x << " = " << (x) << endl;

using namespace std;
using LL = long long int;
using ULL = unsigned long long;

int main() {
    int a, b, c;
    cin >> a >> b >> c;
    cout << ((c - (a - b) <= 0 ) ? 0 : (c - (a - b))) << endl;
    return 0;
}


Measured memory_bytes: 888
#include <bits/stdc++.h>
using namespace std;
int main(){
  
  string s;
  cin >> s;
  
  int n = s.size();
  int j = 0;
  
  for(int i; i < n; i++){
    if((i%2 == 0) && ((s.at(i) == 'L')))
      break;
    if((i%2 == 1) && ((s.at(i) == 'R')))
      break;
    else
      j++;
  }
  
  if(j == n)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<double, int>;

int main() {
    vector<bool> is_prime(1000000, true);
    vector<int> prime;
    is_prime[0] = is_prime[1] = false;
    for(int i=2; i<is_prime.size(); ++i) {
        if(is_prime[i]) {
            prime.push_back(i);
            for(int j=i+i; j<is_prime.size(); j+=i) {
                is_prime[j] = false;
            }
        }
    }
    int n;
    while(cin >> n) {
        cout << upper_bound(prime.begin(), prime.end(), n) - prime.begin() << endl;
    }
}


Measured memory_bytes: 3388
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <math.h>
#include <assert.h>
#include <vector>
#include <set>

using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
static const double EPS = 1e-9;
static const double PI = acos(-1.0);

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, s, n) for (int i = (s); i < (int)(n); i++)
#define FOREQ(i, s, n) for (int i = (s); i <= (int)(n); i++)
#define FORIT(it, c) for (__typeof((c).begin())it = (c).begin(); it != (c).end(); it++)
#define MEMSET(v, h) memset((v), h, sizeof(v))

int n, k;

int main() {
  while (scanf("%d %d", &n, &k) > 0) {
    if (k > n / 2) { puts("-1"); continue; }
    REP(iter, k) {
      if (iter != 0) { puts(""); }
      int l = iter + 1;
      int r = n - iter;
      if (n % 2 == 1) {
        printf("%d %d\n", l, n / 2 + 1);
        printf("%d %d\n", r, n / 2 + 1);
      } else {
        printf("%d %d\n", l, r);
      }

      REP(i, n / 2) {
        if (i == iter) { continue; }
        if (i < iter) {
          printf("%d %d\n", l, n - i);
          printf("%d %d\n", r, i + 1);
        } else {
          printf("%d %d\n", l, i + 1);
          printf("%d %d\n", r, n - i);
        }
      }
    }
  }
  return 0;
}

Measured memory_bytes: 880
#include<bits/stdc++.h>
#define F first
#define S second
#define MP make_pair
#define pb push_back
#define endl '\n'

using namespace std;

typedef long long LL;
typedef pair< int, int > P;
typedef pair< LL, LL > LP;
typedef pair< int, P > iP;
typedef pair< P, P > PP;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1000000007;
static const int SIZE = 300005;

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

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

    int n;
    cin >> n;
    int a[SIZE];
    for( int i = 0; i < n; ++i ) {
        cin >> a[i];

    }
    vector< int > sorted( SIZE );

    int cnt = 0;
    for( int i = 1; i < n; ++i ) {
        if( a[i] < a[i - 1] ) {
            sorted[i - 1] = -1;
            ++cnt;

        }
    }

    int res = -1;
    int q;
    cin >> q;
    if( cnt == 0 ) {
        res = 0;

    }
    
    for( int i = 0; i < q; ++i ) {
        int x, y;
        cin >> x >> y;
        if( res != -1 ) continue;

        --x, --y;
        swap( a[x], a[y] );

        if( x != 0 ) {
            if( sorted[x - 1] == 0 && a[x] < a[x - 1] ) {
                sorted[x - 1] = -1;
                ++cnt;

            } else if( sorted[x - 1] == -1 && a[x] > a[x - 1] ) {
                sorted[x - 1] = 0;
                --cnt;

            }

        }

        if( x != n - 1 ) {
            if( sorted[x] == 0 && a[x] > a[x + 1] ) {
                sorted[x] = -1;
                ++cnt;

            } else if( sorted[x] == -1 && a[x] < a[x + 1] ) {
                sorted[x] = 0;
                --cnt;

            }

        }

        if( y != 0 ) {
            if( sorted[y - 1] == 0 && a[y] < a[y - 1] ) {
                sorted[y - 1] = -1;
                ++cnt;

            } else if( sorted[y - 1] == -1 && a[y] > a[y - 1] ) {
                sorted[y - 1] = 0;
                --cnt;

            }

        }
        if( y != n - 1 ) {
            if( sorted[y] == 0 && a[y] > a[y + 1] ) {
                sorted[y] = -1;
                ++cnt;

            } else if( sorted[y] == -1 && a[y] < a[y + 1] ) {
                sorted[y] = 0;
                --cnt;

            }
        }

        if( cnt == 0 ) res = i + 1;

    }

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




Measured memory_bytes: 5172
/*
...........__________                                                                           ___  __
.............|       |                                                                           |   /
.............|       |                                                                           |  /
.............|       |                               |                         __                | /      _______
.............|_______|  _______            _______   |______   ________   /|  /  |               |/       |      |
.............| \               | |      | |          |      |          | / | /   |               |\       |
.............|  \       _______| |      | |_______   |      |   _______|   |/    |               | \      |
.............|   \      |      | |      |         |  |      |  |       |   |     |               |  \     |
...........__|    \__|  |______| |______| ________|  |      |_ |_______|   |     |__|           _|   \__ _|        .

*/
#include<bits/stdc++.h>
using namespace std ;
#define int                 long long
#define ull                 unsigned long long int
#define ld                  long double
#define vi                  vector<int>
#define vii                 vector<pair<int,int>>
#define vvi                 vector<vector<int>>
#define pii                 pair<int,int>
#define prec(x)             fixed<<setprecision(15)<<x
#define all(x)              x.begin(),x.end()
#define rall(x)             x.rbegin(),x.rend()
#define rev(x)              reverse(x.begin(),x.end())
#define mset(a,b)           memset(a,b,sizeof(a))
#define mcpy(a,b)           memcpy(a,b,sizeof(a))
#define fo0(i,n)            for(int i=0,i##end=n;i<i##end;i++)
#define fo1(i,n)            for(int i=1,i##end=n;i<=i##end;i++)
#define fo(i,a,b)           for(int i=a,i##end=b;i<=i##end;i++)
#define foe(i,x)            for(__typeof((x).end())i=(x).begin();i!=(x).end();++i)
#define fre(i,x)            for(__typeof((x).rend())i=(x).rbegin();i!=(x).rend();++i)
#define fast ios_base::sync_with_stdio(false); cin.tie(0);cout.tie(0)
int gcd(int a, int b) { return b ? gcd(b, a%b) : a; }
#define inf 1e18
const int mod=1e9+7;
const int N=2e5+9;
int a[N],b[N];

void raushan_kumar(){

    //variables
    int d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m,n,o=0,p=0,q=0,r=0,u=0,v=0,w=0,x=0,y=0,z=0,s=0,t=0;
    double f1=0.0,f2=0.0,f3=0.0,f4=0.0,f5=0.0,f6=0.0;
    int flag=0,ans=0,res=0,cnt=0;

    cin>>n;
    fo1(i,n){
    	fo1(j,n){
    		fo1(k,n){
    			int temp=gcd(i,gcd(j,k));
    			res+=temp;
    		}
    	}
    }
    cout<<res;
    
}

int32_t main()
{
    fast;int t=1;
    //cin>>t;
    while(t--){
        raushan_kumar();
    }

}


Measured memory_bytes: 3660
using System;

namespace AtCoderABC052B
{
    class Program
    {
        static void Main()
        {
            int x = 0;
            int count_max = 0;
            int N = int.Parse(Console.ReadLine());
            string S = Console.ReadLine();
            for(int i = 0;i < N;i++){
                if(S[i]=='I'){
                    x += 1;
                }else if(S[i]=='D'){
                    x -= 1;
                }
                if(x > count_max){
                    count_max = x;
                }else{
                    //
                }
            }
            Console.WriteLine(count_max);
        }
    }
}


Measured memory_bytes: 13140
{-# LANGUAGE BangPatterns #-}
import Control.Monad
import Data.List
import Data.Char
import qualified Data.Vector as V
import qualified Data.Vector.Mutable as VM
import qualified Data.Vector.Unboxed as VU
import qualified Data.Vector.Unboxed.Mutable as VUM
import qualified Data.ByteString.Char8 as BS

main = do
  [n,q] <- unfoldr (BS.readInt . BS.dropWhile isSpace) <$> BS.getLine
  edges <- VU.replicateM (n-1) $ do
    [a,b] <- unfoldr (BS.readInt . BS.dropWhile isSpace) <$> BS.getLine
    return (a-1,b-1)
  operations <- VU.replicateM q $ do
    [p,x] <- unfoldr (BS.readInt . BS.dropWhile isSpace) <$> BS.getLine
    return (p-1,x)
  let graph :: V.Vector [Int]
      graph = V.create $ do
        vec <- VM.replicate n []
        VU.forM_ edges $ \(a,b) -> do
          VM.modify vec (b:) a
          VM.modify vec (a:) b
        return vec
      values :: VU.Vector Int
      values = VU.create $ do
        vec <- VUM.replicate n 0
        VU.forM_ operations $ \(p,x) -> 
          VUM.modify vec (+ x) p
        return vec
      result :: VU.Vector Int
      result = VU.create $ do
        vec <- VUM.new n
        let dfs !parent !q !acc = do
              let !acc' = acc + values VU.! q
              VUM.write vec q acc'
              forM_ (graph V.! q) $ \i ->
                when (i /= parent) $
                  dfs q i acc'
        dfs (-1) 0 0
        return vec
  mapM_ print $ VU.toList result

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

typedef long long ll;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define each(itr,c) for(__typeof(c.begin()) itr=c.begin(); itr!=c.end(); ++itr)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second

inline int dist2(int ax, int ay, int bx, int by)
{
    return (ax-bx)*(ax-bx)+(ay-by)*(ay-by);
}

bool reach(int hx, int hy, int tx, int ty, int d, int w, int a)
{
    // ?????¢?????§??????
    if(dist2(hx,hy,tx,ty)>a*a) return false;

    // ?§?????????§??????
    const double PI=acos(-1);
    double theta = atan2(hy-ty,hx-tx);
    double rad_w=w*PI/180, rad_d=d*PI/180;
    double l=rad_w-rad_d/2, r=rad_w+rad_d/2;

    bool ret=false;
    for(int i=-1; i<=1; ++i)
    {
        if(l<=theta+i*2*PI && theta+i*2*PI<=r) ret=true;
    }
    return ret;
}

int main()
{
    int H,R;
    while(scanf(" %d %d", &H, &R),H)
    {
        // input
        vector<int> hx(H),hy(H);
        rep(i,H) scanf(" %d %d", &hx[i], &hy[i]);

        int num[3],d[3];
        rep(i,3) scanf(" %d", &num[i]);
        rep(i,3) scanf(" %d", &d[i]);

        vector<int> tx[3],ty[3];
        rep(i,3)
        {
            tx[i] = vector<int>(num[i]);
            ty[i] = vector<int>(num[i]);
            rep(j,num[i]) scanf(" %d %d", &tx[i][j], &ty[i][j]);
        }

        vector<int> w(R), a(R);
        rep(i,R) scanf(" %d %d", &w[i], &a[i]);

        // solve
        vector<int> ct(H,0);
        rep(i,R)rep(j,H)
        {
            if(!reach(hx[j],hy[j],0,0,d[0],w[i],a[i])) continue;

            bool other=false;
            rep(k,3)rep(l,num[k]) if(reach(hx[j],hy[j],tx[k][l],ty[k][l],d[k],w[i],a[i])) other=true;

            if(!other) ++ct[j];
        }

        // output
        int max_ct=0;
        rep(i,H) max_ct=max(max_ct,ct[i]);

        if(max_ct==0) printf("NA\n");
        else
        {
            vector<int> ans;
            rep(i,H) if(max_ct == ct[i]) ans.pb(i);

            rep(i,ans.size())
            {
                if(i) printf(" ");
                printf("%d", ans[i]+1);
            }
            printf("\n");
        }
    }
    return 0;
}

Measured memory_bytes: 3528
#include <iostream>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>
#include <queue>
#include <cmath>

using namespace std;

int main() {
	int a,b,c,d,e,k;
	cin >> a;
	cin >> b;
	cin >> c;
	cin >> d;
	cin >> e;
	cin >> k;
	string ans = "Yay!";

	if ((b-a) > k || (c-a) > k || (d-a) > k || (e-a) > k || (c-b) > k || (d-b) > k || (e-b) > k || (e-b) > k || (d-c) > k || (e-c) > k || (e-d) > k){
		ans = ":(";
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n, m;
    cin >> n >> m;
    int like[100]={0};
    for(int i=0; i<n; i++){
        int k;
        cin >> k;
        for(int j=0; j<k; j++){
            int a;
            cin >> a;
            like[a]++;
        }

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

Measured memory_bytes: 256
import heapq


class PriorityQueue:
    def __init__(self):
        self.__heap = []
        self.__count = 0

    def empty(self) -> bool:
        return self.__count == 0

    def dequeue(self):
        if self.empty():
            raise Exception('empty')
        self.__count -= 1
        return heapq.heappop(self.__heap)

    def enqueue(self, v):
        self.__count += 1
        heapq.heappush(self.__heap, v)

    def __len__(self):
        return self.__count


def absolute_minima():
    Q = int(input())

    L, R = PriorityQueue(), PriorityQueue()
    sL, sR = 0, 0
    M = None
    B = 0
    N = 0

    for _ in range(Q):
        query = [int(s) for s in input().split()]

        if query[0] == 1:
            _, a, b = query
            B += b
            N += 1

            if M is None:
                M = a
            elif M < a:
                R.enqueue(a)
                sR += a
            else:
                L.enqueue(-a)
                sL += a

            while len(R)-len(L) > 1:
                L.enqueue(-M)
                sL += M

                M = R.dequeue()
                sR -= M

            while len(L) > len(R):
                R.enqueue(M)
                sR += M

                M = -L.dequeue()
                sL -= M

        else:
            s = - sL + sR + B
            if N % 2 == 0:
                s -= M
            print(M, s)


if __name__ == "__main__":
    absolute_minima()


Measured memory_bytes: 11128
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <climits>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <stack>
#include <queue>
#include <algorithm>
#include <iostream>
#include <string>

#define REP(i,n) for(int i=0;i<n;++i)
#define REPR(i,n) for(int i=n;i>=0;--i)
#define REPI(itr,v) for(auto itr=v.begin();itr!=v.end();++itr)
#define REPIR(itr,v) for(auto itr=v.rbegin();itr!=v.rend();++itr)
#define FOR(i,a,b) for(int i=a;i<b;++i)
#define SORT(v,n) sort(v, v+n)
#define SORTV(v) sort(v.begin(), v.end())
#define ALL(v) v.begin(),v.end()
#define llong long long
#define INF 999999999
#define SUR 1000000007
#define pb(a) push_back(a)
#define pf(a) push_front(a)
#define MP make_pair

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

using namespace std;

typedef pair<int,int> pii;

int main(){

  char s[100001];
  scanf("%s", s);

  int p = 0, len = strlen(s);
  REP(i,len){
    if(s[i] == 'p')
      p++;
  }

  printf("%d\n", (len / 2) - p);

  return 0;
}



Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <array>
#include <set>
#include <cmath>
#include <string>
#include <sstream>
#include <queue> 
#include <list>
#include <stack>
#include <unordered_map>
#include <algorithm> 
#include <numeric>  
#include <functional>
#include <cassert>
#include <bitset>
#include <cctype>  
#include <iomanip> 
#include <limits>  
#include <regex>
// std::numeric_limits<int>::max(), min()
// std::setprecision(X)
// std::islower(), std::isupper(), std::tolower, std::toupper
// std::accumulate(m.begin(), m.end(), 0LL);
// std::sort(begin(),end()) // 0, 1, 2, 3 ,4 (default, less);
// std::priority_queue<int, vector<int>, less<int>> que; // 4, 3, 2, 1 (defualt, less) : 
// if ( std::regex_match(S, std::regex("(dream|dreamer|erase|eraser)*")) ) std::cout << "YES" << std::endl;

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

using ll = long long;

ll gcd ( ll a, ll b ) { if ( b == 0 ) return a; else return gcd ( b, a%b ); }
ll lcm ( ll a, ll b ) { return a * b / gcd(a, b); }

int main (void) {
  std::cin.tie(0);  std::ios::sync_with_stdio(false);
  ll X; std::cin >> X;
  ll money = 100;
  for(int x=1; ; x++) {
    money = money * 1.01;
    if ( money >= X ) {
      std::cout << x << std::endl;
      return 0;
    }
  }
  return 0;
}



Measured memory_bytes: 3652
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<string>
#include<map>
#include<set>
#include<tuple>
#include<cmath>
#include<iomanip>


using namespace std;
typedef long long ll;
typedef vector<ll> v;
typedef vector<vector<ll>> vv;


#define MOD 1000000007
#define INF 1001001001
#define MIN -1001001001
#define rep(i,k,N) for(int i=k;i<N;i++)
#define MP make_pair
#define MT make_tuple //tie,make_tuple は別物
#define PB push_back
#define PF push_front
#define all(x) (x).begin(),(x).end()


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

void YN(bool ans){
    if(ans)cout<<"Yes"<<endl;
    else cout <<"No"<<endl;
    return;
}
int main(){
    string S,T;
    cin>>S>>T;
    bool ans = true;
    rep(i,0,S.size()){
        if(S[i] != T[i])ans = false;
    }
    if(S.size() != T.size()-1)ans = false;
    YN(ans);
    return 0;
}

Measured memory_bytes: 3628
n=int(input())
t,a=map(int,input().split())
h=list(map(int,input().split()))
nr=10**10
ans=0
for i in range(n):
  tmp=t-h[i]*0.006
  tmp=abs(a-tmp)
  if tmp<nr:
    nr=tmp
    ans=i
print(ans+1)

Measured memory_bytes: 3064
#include <stdio.h>

int main(){
    int i,j=1,count=1,a[1000],b[1000],sum=0,n,x,val=0;
    
    scanf("%d %d",&n,&x);
    
    for(i=0;i<n;i++){
        scanf("%d",&a[i]);
    }
    
    b[0]=0;
    
    for(i=0;i<n;i++){
        sum+=a[i];
        b[j]=sum;
        j++;
        count++;
    }
    
    for(j=0;j<count;j++){
        if(b[j]<=x){
            val++;
        }
    }
    
    printf("%d\n",val);
    
    
    return 0;
}

Measured memory_bytes: 128
import scala.collection.mutable.ListBuffer
import scala.util.Random

object Main {
    case class Move (x : Int, y : Int, x_ : Int, y_ : Int)
    def main(args: Array[String]) = {
        val sc = new java.util.Scanner(System.in)
        val h, w = sc.nextInt
        val array = Array.ofDim[Int](h, w+1)
        for (i <- 0 until h; j <- 0 to w) {
            if (j == w) 
                array(i)(j) = -1
            else 
                array(i)(j) = if (sc.nextInt % 2 == 0) 0 else 1
        }
        val ans = new ListBuffer[Move]
        for (i <- 0 until h) {
            var tmp = -1
            for (j <- 0 until w; if array(i)(j) == 1) {
                if (tmp == -1) {
                    tmp = j
                } else {
                    for (k <- tmp until j) ans += Move(i, k, i, k+1)
                    tmp = -1
                }
            }
            if (tmp != -1 && i != h - 1) {
                array(i+1)(tmp) += 1
                ans += Move(i, tmp, i+1, tmp)
            }
        }
        println(ans.size)
        for (Move(x, y, x_, y_) <- ans) println(s"${x+1} ${y+1} ${x_ +1} ${y_ +1}")
    }
}


Measured memory_bytes: 116860
import java.util.HashSet;
import java.util.Scanner;

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

        int N = scanner.nextInt();
        int sqrtN = (int) Math.ceil(Math.sqrt(N));
        int[] cnt = new int[N];


        for (int x = 1; x < sqrtN; x++) {
            for (int y = 1; y < sqrtN; y++) {
                for (int z = 1; z < sqrtN; z++) {
                    int n = x * x +
                            y * y +
                            z * z +
                            x * y +
                            y * z +
                            z * x;

                    if (n > cnt.length) continue;
                    cnt[n - 1]++;
                }
            }
        }

        for (int i = 0; i < N; i++) {
            System.out.println(cnt[i]);
        }
    }
}


Measured memory_bytes: 39164
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define f(i,a,n) for(int i=a;i<n;i++)
#define ve vector
#define ss second 
#define ff first
#define pf pop_front
#define pob pop_back
#define psf push_front
#define res(x) cout<<x<<'\n'
#define read(t) ll t;cin>>t

int main(){

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	cout.tie(NULL);
    read(a);
    read(k);
    ll sum=0;
    ll b[a];
    f(i,0,a){
       cin>>b[i];
    }

    sort(b,b+a);
    if(k>=a){
        cout<<"0"<<endl;
    }
    else{
        a=a-k;
        f(i,0,a){
            sum=sum+b[i];
        }
        cout<<sum<<endl;
    }
   
    
    


   

}

Measured memory_bytes: 1792
#include <iostream>

int main(void) {
    std::string S;
    int length;
    
    std::cin >> S;
    
    length = S.size();
    
    if(S[length-1] == 's') {
        std::cout << S << "es" << std::endl;
    } else {
        std::cout << S << "s" << std::endl;
    }
    
    return 0;
}

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

int cmf(const void *p, const void *q){
    return (int)*(char*)p - (int)*(char*)q;
}

int main(){
    string s,t;
    cin >> s >> t;

    sort(s.begin(), s.end());
    sort(t.begin(), t.end()); reverse(t.begin(), t.end());

    if(s < t) { cout << "Yes" << endl; return 0;}
    cout << "No" << endl; return 0;
}

Measured memory_bytes: 256
# coding: utf-8
# Your code here!
num = input()
a = (num[0])
b = (num[1])
c = (num[2])

count = 0

if int(a) == 1:
    count += 1
if int(b) == 1:
    count += 1
if int(c) == 1:
    count += 1

print(count)

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

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


Measured memory_bytes: 256
import java.util.*;
 
import javax.xml.crypto.Data;
 
import java.math.*;
 
public class Main {
     
     
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int d = sc.nextInt();
        int c = sc.nextInt();
        System.out.println(d * c);
    }
     
}

Measured memory_bytes: 17304
#include<stdio.h>
int cmpfunc(const void *a,const void *b)
{
    return (*(int *)a-*(int *)b);
}
int main()
{
    int t=1,a,b,c,i,sum;
    int num[3];
    //scanf("%d",&t);
    while(t--){
        for(i=0;i<3;i++){
            scanf("%d",&num[i]);
        }
        qsort(num,3,sizeof(int),cmpfunc);
        a=num[0];
        b=num[1];
        c=num[2];
        if(a==b&&b==c){
            printf("0\n");
        }
        else{
             sum=0;
           if(b<c) {while(b<c){
                b++;
                a++;
                sum++;
            }}
            if(a<b){
                while(a<b){
                    a=a+2;
                    sum++;
                }
                if(a>b){
                    while(a>b){
                        b++;
                        c++;
                        sum++;
                    }
                }
            }

           printf("%d\n",sum);
        }
    }return 0;
}


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

int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i,n){
        cin >> a.at(i);
    }
    int odd=0;
    int even=0;
    sort(a.begin(), a.end());
    rep(i,n){
        if(i%2==0) even+=a.at(i);
        else odd+=a.at(i);
    }
    cout << abs(odd-even) << endl;
    return 0;
}

Measured memory_bytes: 3536
#include <bits/stdc++.h>
#if defined(__GNUC__)
#pragma GCC optimize ("Ofast")
#endif
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<pii, int> piii;
typedef pair<ll, ll> pll;
#define debug(x) cerr<<#x<<'='<<(x)<<endl;
#define debugp(x) cerr<<#x<<"= {"<<(x.first)<<", "<<(x.second)<<"}"<<endl;
#define debug2(x, y) cerr<<"{"<<#x<<", "<<#y<<"} = {"<<(x)<<", "<<(y)<<"}"<<endl;
#define debugv(v) cerr<<#v<<" : ";for (auto x:v) cerr<<x<<' ';cerr<<endl;
#define all(x) x.begin(), x.end()
#define pb push_back
#define kill(x) return cout<<x<<'\n', 0;

const ld eps=1e-7;
const int inf=1000000010;
const ll INF=10000000000000010LL;
const int mod = 1000000007;
const int MAXN = 310, LOG=20;

int n, m, k, u, v, x, y, t, a, b, ans;
int dp[MAXN][MAXN][MAXN];
string S;

int main(){
	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	cin>>S>>k;
	n=S.size();
	S="."+S;
	for (int i=n; i; i--){
		for (int x=0; x<=k; x++) dp[i][i][x]=1;
		for (int j=i+1; j<=n; j++){
			dp[i][j][0]=max(dp[i+1][j][0], dp[i][j-1][0]);
			if (S[i]==S[j]) dp[i][j][0]=max(dp[i][j][0], dp[i+1][j-1][0]+2);
			for (int x=1; x<=k; x++){
				dp[i][j][x]=max(dp[i+1][j][x], dp[i][j-1][x]);
				dp[i][j][x]=max(dp[i][j][x], 2+dp[i+1][j-1][x-(S[i]!=S[j])]);
			}
		}
	}
	cout<<dp[1][n][k]<<'\n';
	
	return 0;
}


Measured memory_bytes: 114560
import java.util.Scanner;


public class Main {
	public static void main(String[] args) throws Exception {
		try(Scanner sc = new Scanner(System.in)) {
			int A = sc.nextInt();
			int B = sc.nextInt();
			if(A >= 13) System.out.println(B);
			else if(A >= 6) System.out.println(B/2);
			else System.out.println(0);
		}
	}

}


Measured memory_bytes: 21844
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<map>
#include<cstdio>
#include<stack>
#include<queue>
#include<fstream>
#include<cstdio>
#include<deque>
#include<iomanip>
#include <random>

using namespace std;
#define ok1 printf("ok1\n");
#define ok2 printf("ok2\n");
#define M 1000000000000000000LL
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(g);(i)--)
#define all(a) (a).begin(),(a).end()
#define reall(a) (a).rbegin(),(a).rend()
#define pb push_back
#define pf push_front
#define MIN(a,b) a=min((a),(b))
#define MAX(a,b) a=max((a),(b))
#define SIZE(v) (int)v.size()
const double pi = acos(-1.0);

typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef deque<ll> dll;
ll mod = 1e9 + 7;


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

	int a, b;
	cin >> a >> b;
	if (a + b >= 10)
		puts("error");
	else
		cout << a + b << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <map>

using namespace std;

int main(){
	
	int N = 100000;
	
	bool a[100000];
	
	for(int i = 0; i < N; i++){
		a[i] = true;
	}
	
	a[0] = false;
	a[1] = false;
	
	for(int i = 2; i < N; i++){
		if(a[i]){
			for(int j = i * 2; j < N; j += i){
				a[j] = false;
			}
		}
	}
	
	int m, p, q;
	
	while(true){
		cin >> m >> p >> q;
		if(m == 0){
			break;
		}
		
		int min = m;
		int ans1 = 0;
		int ans2 = 0;
		
		for(int i = 2; i < 1000; i++){
			for(int j = i; i * j <= m; j++){
				if(a[i] && a[j]){
					if(m - i * j < min && i * q >= j * p){
						min = m - i * j;
						ans1 = i;
						ans2 = j;
					}
				}
			}
		}
		cout << ans1 << " " << ans2 << endl;
	}
	return 0;
}

Measured memory_bytes: 3080
#include <iostream>
#include <map>
#include <vector>

using namespace std;
int main(){
  int N;
  cin >> N;
  vector<bool> A(N,false), B(N,false);
  vector<int> a(N), b(N), ans(N);
  for(int i = 0; i < N; ++i){
    cin >> a[i];
  }
  for(int i = 0; i < N; ++i){
    cin >> b[i];
    B[b[i]-1] = true;
  }
  bool f = true;
  for(int i = 0; i < N; ++i){
    if(B[a[i] - 1]) ans[i] = a[i];
    else{
      ans[i] = (a[i])%N + 1;
      f = false;
    }
  }
  if(f){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
    for(int i = 0; i < N-1; ++i) cout << a[i] << " ";
    cout << a.back() << endl;
    for(int i = 0; i < N-1; ++i) cout << ans[i] << " ";
    cout << ans.back() << endl;
  }
  return 0;
}



Measured memory_bytes: 4152
#include <stdio.h>

char arr[1000002];
char res[1000002];
int main(void) {
    scanf("%s", arr);
    
    char *p = res;
    char *q = arr;
    
    
    while(*q != '\0'){
        if(*q == 'B' && p != res) {
            --p;
            ++q;
        }else if(*q != 'B') {
            *p = *q;
            ++p;
            ++q;
        } else {
        	++p;
        }
    }
    
    *p = '\0';
    printf("%s", res);
    
    return 0;
}

Measured memory_bytes: 128
//Weather Prediction
#include <iostream>
#include <vector>
#include <math.h>
#include <string>
#include <map>
#include <stdio.h>
#include <string.h>
#include <initializer_list>
#include <algorithm>
#include <numeric>
#include <iomanip>
#include <queue>
#include <set>

using namespace std;

int main()
{
    string S;
    cin >> S;
    if (S  == "Sunny") {
        cout << "Cloudy";
    } else if (S == "Cloudy") {
        cout << "Rainy";
    } else {
        cout << "Sunny";
    }
    return 0;
}

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

def calc():
  n=int(input())
  table=[0]*(n+1)
  for i in range(1,n+1):
    for j in range(i,n+1,i):
      table[j]+=1
  ans=0
  for i in range(1,n+1):
    ans+=i*table[i]
  print(ans)
calc()

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

int main() {
	int n;
	cin >> n;
	int a, c;
	a = n / 100;
	c = (n % 100) % 10;
	if (a == c) {
		cout << "Yes";
	}
	else {
		cout << "No";
	}

	return 0;
}

Measured memory_bytes: 256
//In the name of Allah
#include <bits/stdc++.h>
using namespace std; 

const int maxN = 1000 * 100 + 100; 
vector<int> c[maxN]; 
int mark[maxN]; 
vector<int> ans; 

void dfs( int s ) { 
    mark[s] = true; 
    for( auto x : c[s] ) 
        if( !mark[x] ) { 
            dfs( x ) ; 
            ans.push_back( s + 1 ); 
            return; 
        }
    ans.push_back( s + 1 ); 
}

void sfd( int s , int o ) { 
    if( s != o ) {
        mark[s] = true; 
        ans.push_back( s + 1 ) ;
    }
    for( auto x : c[s] ) 
        if( !mark[x] ) { 
            sfd( x , o ) ; 
            return; 
        }
}


int main() { 
    int n,m; cin >> n >> m; 
    int s = -1; 
    for( int i = 0 ;i < m ; i++ ) { 
        int u,v; cin >> u >> v; 
        u--; v--; 
        s = u;
        c[u].push_back(v); 
        c[v].push_back(u); 
    }
    dfs( s ); 
    sfd( s , s ); 
    cout << ans.size() << endl ; 
    for( auto x : ans ) 
        cout << x << " " ; 
    cout << endl;
}


Measured memory_bytes: 11000
#include <iostream>

using namespace std;

typedef long long ll;

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

  if (a % 2 == 0 || b % 2 == 0 || c % 2 == 0) {
    cout << 0 << endl;
    return 0;
  }

  cout << min(min(b * c, a * c), a * b) << endl;
}


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

vector<int> val;
vector<vector<int>> g;

void dfs(int x) {
  val[x] = 0;
  for (auto v : g[x]) {
    if (val[v] == -1) dfs(v);
    val[x] = max(val[x], 1 + val[v]);
  }
}

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

  int n, m;
  cin >> n >> m;
  
  g.resize(n);
  val.resize(n, -1);

  for (int i = 0; i < m; ++i) {
    int u, v;
    cin >> u >> v;
    --u; --v;
    g[u].push_back(v);
  }
  
  int ans = 0;
  for (int i = 0; i < n; ++i) {
    if (val[i] == -1) dfs(i);
    ans = max(ans, val[i]);
  }

  cout << ans << '\n';
}


Measured memory_bytes: 11060
/*
これを入れて実行
g++ code.cpp
./a.out
 */
 
#include <iostream>
#include <stdio.h>
#include <vector>
#include <string>
#include <cstring>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <math.h>
#include <tuple>
#include <iomanip>
#include <bitset>
#include <functional>

#define all(x) (x).begin(),(x).end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
 
using namespace std;
typedef long long ll;
typedef long double ld;
 
int dy4[4] = {-1, 0, +1, 0};
int dx4[4] = {0, +1, 0, -1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};
 
const long long INF = 1LL << 62;
const ll MOD = 1e9 + 7;
 
bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}
 
ll gcd(ll a, ll b){
	if (b == 0)return a;
	return gcd(b, a % b);
}
 
ll lcm(ll a, ll b){
    return a / gcd(a, b) * b;
}

ll conbinationMemo[100][100];

ll cmemoInit(){
    rep(i, 100){
        rep(j, 100){
            conbinationMemo[i][j] = -1;
        }
    }
}
 
ll nCr(ll n, ll r){
    if(conbinationMemo[n][r] != -1) return conbinationMemo[n][r];
    if(r == 0 || r == n){
        return 1;
    } else if(r == 1){
        return n;
    }
    return conbinationMemo[n][r] = (nCr(n - 1, r) + nCr(n - 1, r - 1));
}
 
ll nPr(ll n, ll r){
    r = n - r;
    ll ret = 1;
    for (ll i = n; i >= r + 1; i--) ret *= i;
    return ret;
}
 
//-----------------------ここから-----------
int main(void){
    ll n;
    string s;
    cin >> n >> s;

    vector<map<char,ll>> sum(n + 1);

    vector<char> c = {'R', 'G', 'B'};
    for(ll i = 0; i < n; i++){
        rep(j, 3){
            if(s[i] == c[j]){
                sum[i + 1][c[j]] += sum[i][c[j]] + 1;
            } else {
                sum[i + 1][c[j]] += sum[i][c[j]];
            }
        }
    }

    ll ans = 0;
    for(ll i = n - 1; i >= 0; i--){
        for(ll j = i - 1; j >= 0; j--){
            if(s[i] == s[j]) continue;
            if((s[i] == 'R' && s[j] == 'G') || (s[i] == 'G' && s[j] == 'R')){
                ans += sum[j]['B'];
                if(j - (abs(j - i)) >= 0){
                    if(s[j - (abs(j - i))] == 'B'){
                        ans--;
                    }
                }
            } else if((s[i] == 'R' && s[j] == 'B') || (s[i] == 'B' && s[j] == 'R')){
                ans += sum[j]['G'];
                if(j - (abs(j - i)) >= 0){
                    if(s[j - (abs(j - i))] == 'G'){
                        ans--;
                    }
                }
            } else {
                ans += sum[j]['R'];
                if(j - (abs(j - i)) >= 0){
                    if(s[j - (abs(j - i))] == 'R'){
                        ans--;
                    }
                }
            }
            //cout << i << j << ans << endl;
        }
    }

    cout << ans << endl;



}

Measured memory_bytes: 4360