akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
using namespace std;

int main()
{
    int a, b, c;
    int num = 0;

    cin >> a >> b >> c;

    if ((a >= 1 && a <= 10000) && (b >= 1 && b <= 10000) && (c >= 1 && c <= 10000) &&
       (a <= b)) {
        for (int n = a; n <= b; n++) {
            if (n > c) break;

            if ((c % n) == 0) {
                num++;
            }
        }
     }
  
     cout << num << endl;

    return 0;
}


Measured memory_bytes: 3096
#include <bits/stdc++.h>
#include <typeinfo>
#include <cxxabi.h>
#ifdef LOCAL
#include "dbgtoki.hpp"
#define DUMP(i) dump((string)TOSTRING(i), demangle(typeid(i).name()), __LINE__ , i) 
#else
#define DUMP(i)
#endif

using namespace std;
#define TOSTRING(x) #x
#define SZ(x) (int)(x).size()
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(s) (s).begin(), (s).end()
#define dis distance
#define so(V) sort(ALL(V))
#define rev(V) reverse(ALL(V))
#define uni(v) v.erase( unique(ALL(v)) , v.end());
#define pub push_back
#define sec second
#define fir first

typedef long long unsigned int llu;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vector <int> > vvi;
const int EPS = 1e-9;
const int MOD = 1e9+7;
const int INF = (1 << 30);
const double PI = acos(-1);

vector<bool> isprime(1001);

void eratos(int n){
	REP(i,n+1){
		isprime[i] = true;
	}
	isprime[0] = false;
	isprime[1] = false;
	int last = ((int)sqrt(n)) + 1;
	FOR(i,2,last){
		if(isprime[i]){
			int j = i+i;
			while(j <= n){
				isprime[j] = false;
				j += i;
			}
		}
	}
}


int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	eratos(1000);
	int n;
	cin >> n;
	map<int,ll> M;
	REP(i,n+1){
		if(!isprime[i])continue;
		FOR(j,2,n+1){
			int a = j;
			while(a % i == 0 && a != 1){
				M[i]++;
				a /= i;
				DUMP(a);
			}
		}
	}
	ll ans = 1;
	DUMP(M);
	for(auto m:M){
		ans *= (m.sec+1)%MOD;
		ans %= MOD;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
char change(int a)
{
	char b;
	if(a==0)b='0';
	if(a==1)b='1';
	if(a==2)b='2';
	if(a==3)b='3';
	if(a==4)b='4';
	if(a==5)b='5';
	if(a==6)b='6';
	if(a==7)b='7';
	if(a==8)b='8';
	if(a==9)b='9';
	return (b);
}
struct SAO
{
	char lei[55];
	int flag[55];
}sao[55];
int main()
{
	int h,w;
	scanf("%d%d",&h,&w);
	for(int i=0;i<h;i++)
	{
		memset(sao[i].flag,0,sizeof(sao[i].flag));
		scanf("%s",sao[i].lei);
		for(int j=0;j<w;j++)
		{
			if(sao[i].lei[j]=='.')
			{
				sao[i].flag[j]=2;
			}
			else if(sao[i].lei[j]=='#')
			{
				sao[i].flag[j]=1;
			}
		}	
	}
	for(int i=0;i<h;i++)
	{
		for(int j=0;j<w;j++)
		{
			int temp=0;
			if(sao[i].flag[j]==2&&j!=w-1&&i!=h-1&&i!=0&&j!=0)
			{
				if(sao[i-1].flag[j-1]==1)temp++;
				if(sao[i-1].flag[j]==1)temp++;
				if(sao[i-1].flag[j+1]==1)temp++;
				if(sao[i].flag[j-1]==1)temp++;
				if(sao[i].flag[j+1]==1)temp++;
				if(sao[i+1].flag[j-1]==1)temp++;
				if(sao[i+1].flag[j]==1)temp++;
				if(sao[i+1].flag[j+1]==1)temp++;
				sao[i].lei[j]=change(temp);
			}
			else if(sao[i].flag[j]==2&&j==w-1&&i!=h-1&&i!=0)
			{
				if(sao[i-1].flag[j-1]==1)temp++;
				if(sao[i-1].flag[j]==1)temp++;
				if(sao[i].flag[j-1]==1)temp++;
				if(sao[i+1].flag[j-1]==1)temp++;
				if(sao[i+1].flag[j]==1)temp++;
				sao[i].lei[j]=change(temp);
			}
			else if(sao[i].flag[j]==2&&j!=w-1&&i==h-1&&j!=0)
			{
				if(sao[i-1].flag[j-1]==1)temp++;
				if(sao[i-1].flag[j]==1)temp++;
				if(sao[i-1].flag[j+1]==1)temp++;
				if(sao[i].flag[j-1]==1)temp++;
				if(sao[i].flag[j+1]==1)temp++;
				sao[i].lei[j]=change(temp);
			}
			else if(sao[i].flag[j]==2&&j==w-1&&i==h-1)
			{
				if(sao[i-1].flag[j-1]==1)temp++;
				if(sao[i-1].flag[j]==1)temp++;
				if(sao[i].flag[j-1]==1)temp++;
				sao[i].lei[j]=change(temp);
			}
			else if(sao[i].flag[j]==2&&j==w-1&&i==0)
			{
				if(sao[i].flag[j-1]==1)temp++;
				if(sao[i+1].flag[j-1]==1)temp++;
				if(sao[i+1].flag[j]==1)temp++;
				sao[i].lei[j]=change(temp);
			}
			else if(sao[i].flag[j]==2&&j!=w-1&&i==0&&j!=0)
			{
				if(sao[i].flag[j-1]==1)temp++;
				if(sao[i].flag[j+1]==1)temp++;
				if(sao[i+1].flag[j-1]==1)temp++;
				if(sao[i+1].flag[j]==1)temp++;
				if(sao[i+1].flag[j+1]==1)temp++;
				sao[i].lei[j]=change(temp);
			}
			else if(sao[i].flag[j]==2&&i!=0&&i!=h-1&&j==0)
			{
				if(sao[i-1].flag[j]==1)temp++;
				if(sao[i-1].flag[j+1]==1)temp++;
				if(sao[i].flag[j+1]==1)temp++;
				if(sao[i+1].flag[j]==1)temp++;
				if(sao[i+1].flag[j+1]==1)temp++;
				sao[i].lei[j]=change(temp);
			}
			else if(sao[i].flag[j]==2&&i==0&&j==0)
			{
				if(sao[i].flag[j+1]==1)temp++;
				if(sao[i+1].flag[j]==1)temp++;
				if(sao[i+1].flag[j+1]==1)temp++;
				sao[i].lei[j]=change(temp);
			}
			else if(sao[i].flag[j]==2&&i==h-1&&j==0)
			{
				if(sao[i-1].flag[j]==1)temp++;
				if(sao[i-1].flag[j+1]==1)temp++;
				if(sao[i].flag[j+1]==1)temp++;
				sao[i].lei[j]=change(temp);
			}
		}
	}
	for(int i=0;i<h;i++)
	{
		printf("%s\n",sao[i].lei);
	}
	return 0;
 } 

Measured memory_bytes: 128
s=input()
count=0
s1=str()
s2=str()
for _ in range(int(input())):
  l=list(map(str,input().split()))
  
  if l[0]=='1':
    count+=1
  elif count%2==0:
    if l[1]=='1':
      s1=l[2]+s1
    else:
      s2=s2+l[2]
  else:
    if l[1]=='2':
      s1=l[2]+s1
    else:
      s2=s2+l[2]
s=s1+s+s2
if count%2!=0:
  s=s[::-1]
print(s)

Measured memory_bytes: 4388
#include<stdio.h>
int main()
{
    int n,a,b,c,d;
    scanf("%d", &n);
    if(n<=9){
    if(n==2 || n==4 || n==5 || n==7 || n==9){
        printf("hon\n");}
       else if(n==0 || n==1 || n==6 || n==8 ){
        printf("pon\n");}
         else if(n==3 ){
        printf("bon\n");}


    }
    else if(n>=10 && n<=99){
        a=n%10;
        if(a==2 || a==4 || a==5 || a==7 || a==9){
        printf("hon\n");}
       else if(a==0 || a==1 || a==6 || a==8 ){
        printf("pon\n");}
         else if(a==3 ){
        printf("bon\n");}


    }
    else if(n>=100 && n<=999){
        b=n%100;
        c=b%10;

        if(c==2 || c==4 || c==5 || c==7 || c==9){
        printf("hon\n");}
       else if(c==0 || c==1 || c==6 || c==8 ){
        printf("pon\n");}
         else if(c==3 ){
        printf("bon\n");}

    }

}


Measured memory_bytes: 1620
// 2013/11/05 Tazoe

#include <iostream>
#include <string>
#include <algorithm>
using namespace std;

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

		if(N==0)
			break;

		string c;
		cin >> c;

		int n[10] = {0};
		int m = 0;

		for(int i=0; i<100; i++){
			n[i%N]++;
			if(c[i]=='S'){
				m += n[i%N];
				n[i%N] = 0;
			}
			else if(c[i]=='L'){
				n[i%N] += m;
				m = 0;
			}
		}

		sort(n, n+N);
		for(int i=0; i<N; i++){
			cout << n[i] << ' ';
		}
		cout << m << endl;
	}

	return 0;
}

Measured memory_bytes: 1224
#include <bits/stdc++.h>
using namespace std;
int n, m, a[20], len = 0;
bool used[20];

void add() {
	++a[1];
	for(int i = 1; i <= len; i++) a[i + 1] += a[i] / 10, a[i] %= 10;
	for(; a[len + 1]; ++len);
}
bool check() {
	for(int i = 1; i <= len; i++) if(used[a[i]]) return 0;
	return 1;
}
int main() {
	scanf("%d%d", &n, &m);
	for(int i = 1, x; i <= m; i++) scanf("%d", &x), used[x] = 1;
	for(; n;) a[++len] = n % 10, n /= 10;
	for(; !check(); add());
	for(int i = len; i; i--) printf("%d", a[i]);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i=0; i<(int)n; i++)
#define REPR(i, n) for(int i=(int)n-1; i>=0; i--)
#define FOR(i, m, n) for(int i=(int)m; i<(int)n; i++)
#define FORR(i, m, n) for(int i=(int)m-1; i>=(int)n; i--)
#define ASC(v) sort(v.begin(), v.end());
#define DESC(v) sort(v.begin(), v.end(), greater<int>());
#define REVERSE(v) reverse(v.begin(), v.end());
#define DEBUG(x) cout<<#x<<": "<<x<<"\n"
typedef long long ll;
struct nya{ nya(){ cin.tie(0); ios::sync_with_stdio(false); } }nyan;

int main() {
	ll N;
	cin >> N;
	ll res = floor(N/2);
	res += N%2;
	cout << res << "\n";
}


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

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

map<int, int> compress(vector<int>& unzip) {
  map<int, int> zip;
  for (auto x : unzip) REP(d, 3) zip[x + d - 1] = -1;
  int idx = 0;
  unzip = vector<int>();
  for (auto& p : zip) {
    unzip.push_back(p.first);
    p.second = idx;
    idx++;
  }
  return zip;
}

int main() {
  int m, n;
  cin >> m >> n;
  vector<string> c(m);
  REP(i, m) cin >> c[i];

////////////////////////////////////////
  vector<int> xs, ys;
  vector<char> cs;
  REP(i, m) REP(j, n) {
    if (c[i][j] == '.') continue;
    xs.push_back(i);
    ys.push_back(j);
    cs.push_back(c[i][j]);
  }
  vector<int> uzx(xs), uzy(ys);
  auto zx = compress(uzx);
  auto zy = compress(uzy);
  m = zx.size();
  n = zy.size();
  c = vector<string>(m, string(n, '.'));
  REP(k, cs.size()) {
    int x = xs[k];
    int y = ys[k];
    c[zx[x]][zy[y]] = cs[k];
  }
////////////////////////////////////////

  int ans = 0;
  while (true) {
    int sum = 0;
    REP(i, m) REP(j, n) {
      if (c[i][j] != '.') continue;
      vector<int> x(4, i), y(4, j);
      REP(k, 4) {
        while (true) {
          if (c[x[k]][y[k]] != '.') break;
          int tx = x[k] + dx[k];
          int ty = y[k] + dy[k];
          if (tx < 0 || m <= tx || ty < 0 || n <= ty) break;
          x[k] += dx[k];
          y[k] += dy[k];
        }
      }
      REP(k, 4) REP(l, 4) {
        if (k >= l) continue;
        if (c[x[k]][y[k]] != '.' && c[x[k]][y[k]] == c[x[l]][y[l]]) {
          sum += 2;
          c[x[k]][y[k]] = '.';
          c[x[l]][y[l]] = '.';
        }
      }
    }
    if (sum == 0) break;
    ans += sum;
  }
  cout << ans << endl;
}



Measured memory_bytes: 3300
import java.util.Scanner;

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

	private static void solve() {
		try (Scanner cin = new Scanner(System.in)) {

			int H = cin.nextInt();
			int W = cin.nextInt();
			String[] strArray = new String[H];

			for (int i = 0; i < H; i++) {
				strArray[i] = cin.next();
			}

			int[] array = count(strArray);

			int nopair = 0;
			if (H % 2 != 0 && W % 2 != 0) {
				nopair = 1;
			}
			int pair4 = 0;

			for (int i = 0; i < H / 2; i++) {
				for (int j = 0; j < W / 2; j++) {
					pair4++;
				}
			}
			int pair2 = (H * W - pair4 * 4 - nopair) / 2;

			for (int i = 0; i < pair4; i++) {
				for (int j = 0; j < array.length; j++) {
					if (array[j] >= 4) {
						array[j] -= 4;
						break;
					}
				}
			}
			for (int i = 0; i < pair2; i++) {
				for (int j = 0; j < array.length; j++) {
					if (array[j] >= 2) {
						array[j] -= 2;
						break;
					}
				}
			}
			if (nopair != 0) {
				for (int j = 0; j < array.length; j++) {
					if (array[j] == 1) {
						array[j]--;
						break;
					}
				}
			}

			for (int i : array) {
				if (i != 0) {
					System.out.println("No");
					return;
				}
			}
			System.out.println("Yes");

		} finally {
		}
	}

	private static int[] count(String[] strArray) {
		int[] array = new int[26];

		for (int i = 0; i < strArray.length; i++) {
			char[] cArray = strArray[i].toCharArray();
			for (char c : cArray) {
				array[c - 97] += 1;
			}
		}

		int size = 0;

		for (int i : array) {
			if (i > 0) {
				size++;
			}
		}
		int[] ret = new int[size];
		int index = 0;
		for (int i : array) {
			if (i > 0) {
				ret[index] = i;
				index++;
			}
		}
		return ret;
	}
}


Measured memory_bytes: 22484
while True:
    n,m=map(int,input().split())
    if n==0:
        break
    else:
        pdlist=[]
        for i in range(0,n):
            d,p=map(int,input().split())
            pdlist.append([p,d])
        pdlist.sort()
        i=n-1
        while True:
            if i<0:
                break
            elif pdlist[i][1]-m<0:
                a=pdlist[i][1]
                pdlist[i][1]=0
                m=(m-a)
                i=i-1
            else:
                pdlist[i][1]=pdlist[i][1]-m
                break
        count=0
        for i in range(0,n):
            count=count+pdlist[i][0]*pdlist[i][1]
        print(count)


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

using namespace std;

int a[1000000];
int cnt;

int ai(int s)
{
    cnt++;
    if(a[s] == true)
        return cnt;
    a[s] = true;
    if(s % 2 == 0)
    {
        return ai(s/2);
    }
    else
    {
        return ai(3 * s + 1);
    }
}

int main()
{
    int s, m;
    cin >> s;

    int ans = ai(s);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
// include
// ------------------------------------------------
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <math.h>

using namespace std;

// func
// ------------------------------------------------
int CalcSumOfDigit(int n);      // 各桁の和を計算する。
string upper(string str);       // 英字を大文字に変換する。
string lower(string str);       // 英字を小文字に変換する。

// define
// ------------------------------------------------
#define all(a)        (a).begin(),(a).end()
#define rall(a)       (a).rbegin(),(a).rend()
#define pb            push_back
#define sz(a)         int((a).size())
#define rep(i,n)      for(int(i)=0;(i)<(n);(i)++)
#define repe(i,n)     for(int(i)=0;(i)<=(n);(i)++)
#define vsort(v)      sort((v).begin(),(v).end())
#define rvsort(v)     sort(rall((v)))
#define vi            vector<int>
#define GCD(a,b)      __gcd((a),(b))
#define LCM(a,b)      (a)/GCD((a),(b))*(b)

const int INF = 1e9;

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

  int n;
  string s;

  cin >> n >> s;

  if(n % 2 == 0)
  {
    string t = s.substr(0,n / 2);
    string u = s.substr(n/2,n);

    if(t == u)
      cout << "Yes";
    else
    {
      cout << "No";
    }
    
  }
  else
  {
    cout << "No";
  }
  

  
  return 0;
}

// funcの実体
// ------------------------------------------------
int CalcSumOfDigit(int n)
{
  int s = 0;
  while(n)
  {
    s += n % 10;
    n = n / 10;
  }
  return s;
}

string upper(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(97 <= *itr && *itr <= 122)
    {
      *itr = *itr - 32;
    }
  }
  return str;
}

string lower(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(65 <= *itr && *itr <= 90)
    {
      *itr = *itr + 32;
    }
  }
  return str;
}


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

// def
#define debug(x) cout << #x << ": " << x << endl
#define out(x) cout << x << endl
#define repeat(i, a, b) for (int i = (a); i < (b); i++)
#define revrepeat(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define revrep(i, n) for (int i = (n)-1; i >= 0; i--)
typedef long long ll;
typedef pair<int, int> P;
typedef vector<vector<int>> Graph;
const int M = 1e9 + 7;
const ll INF = 1e9;
const int MAX_V = 100000 + 5;
const int MAX_N = 1e5 + 5;

int main() {
    ll n, a, b;
    cin >> n >> a >> b;
    ll diff = b - a;
    ll ans = 0;
    if (diff % 2 == 0) {
        ans = diff / 2;
    } else {
        ll go_left_round = a - 1;
        ll go_right_round = n - b;
        if (go_left_round >= go_right_round) {
            go_right_round++;
            a += go_right_round;
            ans = (n - a) / 2 + go_right_round;
        } else {
            go_left_round++;
            b -= go_left_round;
            ans = (b - 1) / 2 + go_left_round;
        }
    }
    out(ans);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
int GCD(int a, int b)
{
    if (a < b) swap(a, b);
    if (b == 0) return a;
    int r;
    while ((r = a % b))
    {
        a = b;
        b = r;
    }
    return b;
}

void _main()
{
    int N;
    cin >> N;
    vector<int> A(N);
    rep(i, 0, N) cin >> A[i];

    vector<int> left(N + 1), right(N + 1);
    left[0] = 0;
    right[N] = 0;

    rep(i, 0, N)
    {
        left[i + 1] = GCD(left[i], A[i]);
    }

    rrep(i, N - 1, 0)
    {
        right[i] = GCD(right[i + 1], A[i]);
    }

    int ans = 0;
    rep(i, 0, N)
    {
        const int gcd = GCD(left[i], right[i + 1]);
        chmax(ans, gcd);
    }
    cout << ans << endl;
}


Measured memory_bytes: 1408
//#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
using namespace std;

#define pb push_back
#define mp make_pair
#define fs first
#define se second
#define pi 2*acos(0)
#define PI 3.14159265358979323846264338

typedef long long ll;
typedef unsigned long long ull;
typedef pair < int , int > pii;
typedef pair < ll , ll > pll;

const int N = 100009;
const int MX = 123456;
const int mod = (int)1e9 + 7;
const int base = 97;
const ull BS1 = 10000019ULL;
const int INF = (1 << 29);

template < class T > inline void fastScan(T &x){
    register char c = getchar();
    int neg = 0; x = 0;
    for(   ; (c < 48 || c > 57) && (c != '-'); c = getchar());
    if(c == '-') { neg = 1; c = getchar(); }
    for(   ; c > 47 && c < 58; c = getchar()){
        x = (x << 1) + (x << 3) + c - 48;
    }
    if(neg) x = -x;
}

// OrderedSet
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
// template < typename T > using ordered_set = tree < T, null_type, greater < T >, rb_tree_tag, tree_order_statistics_node_update >;

//typedef uint64_t hash_t;
//mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
//const int HASH_COUNT = 2;
//const hash_t HASH_P = (uint32_t)-13337;
//uniform_int_distribution<hash_t> MULT_DIST(0.25 * HASH_P, 0.75 * HASH_P);
//const hash_t HASH_MULT[HASH_COUNT] = {MULT_DIST(rng), MULT_DIST(rng)};

int n;
int d, a;

pll inp[N + N];
ll cum[N + N];

int main(){
  fastScan(n);
  fastScan(d);
  fastScan(a);
  for(int i = 0; i < n; i++){
    fastScan(inp[i].fs);
    fastScan(inp[i].se);
  }
  sort(inp, inp + n);
  ll ans = 0;
  for(int i = 0; i < n; i++){
    ll nxt = inp[i].fs + d + d;
    ll dec = cum[i];
    ll rem = inp[i].se - dec;
    if(rem > 0){
      int low = i, high = n - 1;
      int l = i, r = n;
      while(low <= high){
        int mid = (low + high) >> 1;
        if(inp[mid].first <= nxt){
          low = mid + 1;
          r = mid + 1;
        } else {
          high = mid - 1;
        }
      }
      ll need = (rem / a) + (rem % a != 0);
      ans += need;
      cum[l] += need * a;
      cum[r] -= need * a;
      //cout << l << " " << r << " " << ans << '\n';
    }
    cum[i + 1] += cum[i];
  }
  printf("%lld\n", ans);
}


Measured memory_bytes: 4992
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;
using vc = vector<char>;
using vvc = vector<vc>;
using pll = pair<ll, ll>;
using stkll = vector<pll>;
const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;
#define rep(i, n) for (ll i = 0; i < (n); i++)
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
#ifndef ONLINE_JUDGE
    #define debug(x) cerr << #x << ": " << x << endl;
#else
    #define debug(x)
#endif

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

    ll K;
    cin >> K;
    
    ll ans = 0;
    for(ll a = 1; a <= K; a++) {
        for(ll b = 1; b <= K; b++) {
            for(ll c = 1; c <= K; c++) {
                ans += gcd(gcd(a, b), c);
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3636
#include <iostream>
using namespace std;
int main()
{
	int cell[10][10] = {{0}}, x, y, size, i, j, max = 0, num = 0;
	char c;
	while (1)
	{
		cin >> x;
		if (cin.eof()) break;
		cin >> c >> y >> c >> size;
		switch (size)
		{
			case 1:
				for (i = y-1; i <= y+1; i++)
				{
					for (j = ((i == y-1 || i == y+1) ? x : x-1); j <= ((i == y-1 || i == y+1) ? x : x+1); j++)
					{
						if ((0 <= i && i < 10) && (0 <= j && j < 10))
							cell[j][i]++;
					}
				}
				break;
			case 2:
				for (i = y-1; i <= y+1; i++)
				{
					for (j = x-1; j <= x+1; j++)
					{
						if ((0 <= i && i < 10) && (0 <= j && j < 10))
							cell[j][i]++;
					}
				}
				break;
			case 3:
				for (i = y-2; i <= y+2; i++)
				{
					for (j = ((i == y-2 || i == y+2) ? x : ((i == y-1 || i == y+1) ? x-1 : x-2)); j <= ((i == y-2 || i == y+2) ? x : ((i == y-1 || i == y+1) ? x+1 : x+2)); j++)
					{
						if ((0 <= i && i < 10) && (0 <= j && j < 10))
							cell[j][i]++;
					}
				}
				break;
		}
	}
	for (i = 0; i < 10; i++)
	{
		for (j = 0; j < 10; j++)
		{
			if (cell[j][i] >= max)
				max = cell[j][i];
			if (cell[j][i] == 0)
				num++;
		}
	}
	cout << num << endl << max << endl;
	return 0;
}

Measured memory_bytes: 0
<?php
fscanf(STDIN, "%d", $a);
fscanf(STDIN, "%d", $b);
fscanf(STDIN, "%d", $c);
fscanf(STDIN, "%d", $x);
$ret = 0;
for($i = 0; $i <= $a; $i++) {
    for($j = 0; $j <= $b; $j++) {
        for($k = 0; $k <= $c; $k++) {
            $sum = 500 * $i + 100 * $j + 50 * $k;
            if($x - $sum == 0) {
                $ret++;
            }
        }
    }
}
echo $ret. "\n";

Measured memory_bytes: 4604
n,x,y = gets.split.map(&:to_i)
z = y-x-1
a = Array.new(n,0)
for i in 1..(n-1)
  for j in (i+1)..n
    if i <= x && y <= j
      a[j-i-z] += 1
    else
      b = [j-i,((x-i).abs)+((y-j).abs)+1].min
      a[b] += 1
    end
  end
end
for k in 1..(n-1)
  puts a[k]
end


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

const ll INF = 1LL << 60;

ll N, Q;
string S;

// map<int, set<ll>> mp;
map<int, set<int>> mp;

int main() {
    // set<ll> v = {2, 4, 5, 7};
    // auto it = v.lower_bound(5);
    // cout << *it << endl;
    // v.erase(it);
    // rep(i, v.size()) {
    //     cout << v[i] << " ";
    // }
    // return 0;

    cin >> N >> S >> Q;

    rep(i, S.size()) {
        mp[S[i] - 'a'].insert(i);
    }

    // cout << (upper_bound(v.begin(), v.end(), 5) - v.begin()) - (lower_bound(v.begin(), v.end(), 4) - v.begin()) << endl;
    // for (auto m : mp) {
    //     cout << m.first << endl;
    //     cout << "  ";
    //     for (auto s : m.second) {
    //         cout << s << " ";
    //     }
    //     cout << endl;
    // }

    rep(k, Q) {
        ll t;
        cin >> t;
        if (t == 1) {
            ll i;
            char c;
            cin >> i >> c;
            i--;

            // // idx 消す
            // for (int j = 0; j < 26; j++) {
            //     set<ll> target = mp[j];
            //     // auto idx = find(target.begin(), target.end(), i);
            //     if (target.count(i)) {
            //         // cout << "erase" << endl;
            //         // cout << *idx << endl;
            //         target.erase(i);
            //         mp[j] = target;
            //         break;
            //     }
            // }
            // i文字めを消す
            mp[S[i] - 'a'].erase(i);
            S[i] = c;

            // idx 挿入
            mp[c - 'a'].insert(i);
        } else {
            ll l, r;
            cin >> l >> r;
            l--; r--;
            ll ans = 0;
            for (int j = 0; j < 26; j++) {
                auto it = mp[j].lower_bound(l);
                if (it != mp[j].end() && *it <= r) {
                    ans++;
                };
                // ll tmp = (upper_bound(v.begin(), v.end(), r) - v.begin()) - (lower_bound(v.begin(), v.end(), l) - v.begin());
                // if (tmp > 0) {
                //    ans++;
                // }
            } 
            cout << ans << endl;
        }
    }

    // for (auto m : mp) {
    //     cout << m.first << endl;
    //     cout << "  ";
    //     for (auto s : m.second) {
    //         cout << s << " ";
    //     }
    //     cout << endl;
    // }
}

Measured memory_bytes: 27236
import java.util.Scanner;

public class Main{
  public static void main(String[]args){
   
   try(Scanner sc = new Scanner(System.in)){
      while(true){
       int n = sc.nextInt();
      if(n == 0){
	break;
      }
	int[]score = new int[n];
	for(int i = 0;i < n;i++){
	score[i] = sc.nextInt();
	}
	double average = 0,variance = 0;
	for(int i = 0;i < n;i++){
	average = average+score[i];
	}
	average = average/n;
	for(int i = 0;i < n;i++){
	variance = (score[i]-average)*(score[i]-average)+variance;
	}
	variance = variance/n;
	System.out.println(Math.sqrt(variance));
     }   
   }
  }
}


Measured memory_bytes: 31800
H, W = map(int, input().split())
data = []
for i in range(H):
  data.append(input())
x = [1,1,1,0,-1,-1,-1,0]
y = [1,0,-1,-1,-1,0,1,1]
ans = []
for i in range(H):
  s = ""
  for j in range(W):
    if data[i][j] == "#":
      s += "#"
      continue
    else:
      count = 0
      for k in range(8):
        if 0 <= i + x[k] and i + x[k] < H and 0 <= j + y[k] and j + y[k] < W:
          if data[i + x[k]][j + y[k]] == "#":
            count += 1
      count = str(count)
      s += count
  ans.append(s)
for i in range(H):
  print(ans[i])

Measured memory_bytes: 9276
#include <iostream>

using namespace std;
typedef long long ll;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int x;
  cin>>x;
  int ans;
  if(x>=400&&x<=599) ans=8;
  if(x>=600&&x<=799) ans=7;
  if(x>=800&&x<=999) ans=6;
  if(x>=1000&&x<=1199) ans=5;
  if(x>=1200&&x<=1399) ans=4;
  if(x>=1400&&x<=1599) ans=3;
  if(x>=1600&&x<=1799) ans=2;
  if(x>=1800&&x<=1999) ans=1;
  cout <<ans<<endl;

  return 0;
}


Measured memory_bytes: 3164
N, M = map(int, input().split())
K = [[] for i in range(M)]
for i in range(M):
    k = list(map(int, input().split()))
    K[i] = k[1:]
 
P = list(map(int, input().split()))

ans = 0
for i in range(2 ** N):
    switch = [0] * M
    for j in range(N):
        if (i >> j) & 1: # bitチェック、1桁目が1かどうか、1ならスイッチがオン
            for l in range(M):
                if j + 1 in K[l]: # j+1番のスイッチがオンだがl番の電球につながっているか？
                    switch[l] += 1 # l番目の電球につながっているスイッチがオンの数
     
    for j in range(M):
        if switch[j] % 2 != P[j]:
            break 
    else:
        ans += 1
        
print(ans)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define ull unsigned long long
#define vi vector<ll>
#define vvi vector<vi>
#define DBG_N(hoge) cerr<<" "<<(hoge)<<endl;
#define DBG cerr<<"!"<<endl;
#define BITLE(n) (1LL<<((ll)n))
#define BITCNT(n) (__builtin_popcountll(n))
#define SUBS(s,f,t) ((s).substr((f)-1,(t)-(f)+1))
#define ALL(a) (a).begin(),(a).end()
using namespace std;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll a,b,c,d,e;
  string s,ss,sss;
  cin>>s;
  string hoge[3]={"Sunny","Cloudy","Rainy"};
  for(int i=0;i<3;i++)
    if(s==hoge[i])
      cout<<hoge[(i+1)%3]<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <climits>
#include <cmath>
#include <set>
#include <vector>
#include <algorithm>
#include <unordered_set>
#include <unordered_map>

typedef long long ll;

using namespace std;

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

  int S = 0;
  for (int j = 0; j <= n; j++) {
    S += abs(a[j] - a[j + 1]);
  }
  for (int i = 1; i <= n; i++) {
    int si = S + abs(a[i-1] - a[i+1]) - abs(a[i-1] - a[i]) - abs(a[i] - a[i+1]);
    cout << si << endl;
  }
}


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

int main()
{
	int k,x;
	cin>>k>>x;
	for(int i=k-1;i>0;i--)
	printf("%d ",x-i);

	for(int i=0;i<k;i++)
	printf("%d ",x+i);
	printf("\n");
	return 0;
}

Measured memory_bytes: 256
object Main extends App {
  val n = readInt
  //ai >= 1 としておく
  val a = readLine.split(" ").map{_.toInt + 1}
  
  val arr = Array.fill[Int](a.max+2)(0)
  
  for (i <- 0 until n) {
    arr(a(i)-1) += 1
    arr(a(i)) += 1
    arr(a(i)+1) += 1
  }
  
  val k = arr.indexOf(arr.max)
  
  var ans = 0
  ans += a.count{_ == k-1}
  ans += a.count{_ == k}
  ans += a.count{_ == k+1}
  
  println(ans)
}

Measured memory_bytes: 46812
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

void solve()
{
	int n;
	while (cin >> n, n)
	{
		vector<int> a(n);
		for (int i = 0; i < n; ++i)
		{
			cin >> a[i];
		}
		sort(a.begin(), a.end());
		int minv = a[1] - a[0];
		for (int i = 1; i < n - 1; ++i)
		{
			minv = min(minv, a[i + 1] - a[i]);
		}
		cout << minv << endl;
	}
}

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

Measured memory_bytes: 3164
#include <iostream>
#include <vector>

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

    int left = 1;
    int right = N;

    for (int i = 0; i < M; i += 1) {
        int L, R;
        std::cin >> L >> R;

        if (left < L) {
            left = L;
        }
        if (right > R) {
            right = R;
        }
    }
    
    if (left <= right) {
        std::cout << right - left + 1 << std::endl;
    } else {
        std::cout << 0 << std::endl;
    }

    return 0;
}


Measured memory_bytes: 256
str_line = input()
str_line2 = list(str_line)
#print(str_line2)
length = len(str_line2)
line = []

for i in range(length):
    if (str_line2[i] == "1")or(str_line2[i] == "0"):
        line.append(str_line2[i])
        #print(line)
        
    else:
        if len(line) != 0:
            del line[-1]
            #print(line)
for i in range(len(line)):
    print(line[i],end="")

Measured memory_bytes: 9012
#include<iostream>
#include<iomanip>
#include<stdio.h>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<string>
#include<algorithm>
#include<functional>
#include<math.h>
#include<unordered_set>
using namespace std;

int INF = 1 << 30;

int main() {
	int N;
	string s;

	int ans = INF;
	int cnt = 0;

	cin >> N >> s;

	for (int i = 1; i < N; i++) {
		if (s[i] == 'E')cnt++;
	}

	ans = min(cnt, ans);

	for (int i = 1; i < N; i++) {
		if (s[i - 1] == 'W')cnt++;
		if (s[i] == 'E')cnt--;
		ans = min(cnt, ans);
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 900
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#define For(i, n) for(int i = 0; i < (n); i ++)
#define Range(c) c.begin(), c.end()
#define RevRange(c) c.begin(), c.end()
#define Cin(T, x) T x; cin >> x;
#define Cins(T, n, xs) vector<T> xs(n); For(i, n) cin >> xs[i];
#define Cout(val) cout << (val) << "\n";
#define Sort(a) sort(Range(a));
#define DeSort(a) sort(RevRange(a));

using namespace std;
using ll = long long;

int main(void){
    Cins(int, 3, a);
    Sort(a);
    auto x = unique(Range(a));
    Cout(distance(a.begin(), x));
    //Cout(() ? "Yes" : "No");
    //Cout(() ? "YES" : "NO");
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
  int a=0,b=0,i,t;
  for(i=0;i<8;i++){
    scanf("%d",&t);
    if(i<4)a+=t;
    else b+=t;
  }
  if(a>=b)printf("%d\n",a);
  else printf("%d\n",b);
  return 0;
}

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

public class Hello
{
    public static void Main()
    {
       
        int[] a = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
        int N = a[0];
        int K = a[1];
        int num = 0;
        for(int i = 1; i <= N; i += 2)
        {
            num++;
        }
        
        if(num >= K) Console.WriteLine("YES");
        else Console.WriteLine("NO");
    }
}

Measured memory_bytes: 13268
#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 100;

int fa[N];
int cnt[N];
int ans[N];

int Find(int x) {
	return x == fa[x] ? x : fa[x] = Find(fa[x]);
}

void Union(int x, int y) {
	int fa_x = Find(x);
	int fa_y = Find(y);
	if (fa_x != fa_y) fa[fa_y] = fa_x;
}

void Init() {
	iota(fa, fa + N, 0);
}

int main() {
	Init();
	int n, m, k; cin >> n >> m >> k;
	int x[m] = {}, y[m] = {};
	for (int i = 0; i < m; i++) {
		cin >> x[i] >> y[i];
		Union(x[i], y[i]);
	}
	for (int i = 0; i < m; i++) {
		if (Find(x[i]) == Find(y[i])) {
			--ans[x[i]];
			--ans[y[i]];
		}
	}
	for (int i = 0; i < k; i++) {
		int x, y; cin >> x >> y;
		if (Find(x) == Find(y)) {
			--ans[x];
			--ans[y];
		}
	}
	for (int i = 1; i <= n; i++) {
		++cnt[Find(i)];
	}
	for (int i = 1; i <= n; i++) {
		ans[i] += cnt[Find(i)] - 1;
		cout << ans[i] << ' ';
	}
}

Measured memory_bytes: 3456
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    String[] c = new String[n];
    String[] results = { "AC", "WA", "TLE", "RE" };
    int[] resultCnt = { 0, 0, 0, 0 };
    for (int cnt = 0; cnt < n; cnt++) {
      c[cnt] = sc.next();
      for (int cntj = 0; cntj < 4; cntj++) {
        if (c[cnt].equals(results[cntj])) {
          resultCnt[cntj] += 1;
        }
      }
    }
    for (int cnt = 0; cnt < 4; cnt++) {
      System.out.println(results[cnt] + " x " + resultCnt[cnt]);
    }
    sc.close();
  }
}

Measured memory_bytes: 63712
#include <stdio.h>
#include <math.h>
int main(void){
    int l, r, d, i, a;
    scanf("%d%d%d", &l, &r, &d);
    a = 0;
    
    for(i = l; i <= r; i++){
        if(i % d == 0) a++;
    }
    printf("%d\n", a);
}

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

int getF(int n){
    //if(n < 10) n = 0;
    while(n > 9){
        n /= 10;
    }
    return n;
}

int getL(int n){
    return n % 10;
}



int main(){
    int N; cin >> N;
    int V[10][10];
    int ans = 0;
    for(int i = 0; i < 10; i++){
        for(int j = 0; j < 10; j++){
            V[i][j] = 0;
        }
    }
    for(int i = 0; i <= N; i++){
        int F = getF(i);
        int L = getL(i);
        V[F][L]++;
    }
    for(int i = 0; i <= N; i++){
        int F = getF(i);
        int L = getL(i);
        if(F == 0 || L == 0) continue;
        ans += V[L][F];
        //cout << i << " "<< F << " " << L << " " << V[F][L] << endl;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
import sys

import numpy as np

input = sys.stdin.readline


def main():
    N, K = map(int, input().split())
    h = np.array(input().split(), dtype=np.int64)

    dp = np.zeros(shape=N, dtype=np.int64)
    dp[1] = abs(h[1] - h[0])
    for i in range(2, N):
        i_m = max(0, i - K)
        dp[i] = (dp[i_m:i] + np.abs(h[i] - h[i_m:i])).min()

    ans = dp[-1]
    print(ans)


if __name__ == "__main__":
    main()


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

#define endl            "\n"
#define ll              long long
#define ld              long double 
#define ull             unsigned long long int
#define MOD             (ll)(1e9 + 7)
#define vi              vector<int>
#define vl              vector<long>
#define vll             vector<ll>
#define pll             pair<ll,ll>
#define mll             map<ll,ll>
#define len(x)          x.length()
#define all(x)          x.begin(),x.end()
#define deb1(x)         cout<<#x<<" "<<x<<endl;
#define deb2(x,y)       cout<<#x<<" "<<x<<"\t"<<#y<<" "<<y<<endl;
#define deb3(x,y,z)     cout<<#x<<" "<<x<<"\t"<<#y<<" "<<y<<"\t"<<#z<<" "<<z<<endl;
#define debug1(x)       cerr<<#x<<" "<<x<<endl;
#define debug2(x,y)     cerr<<#x<<" "<<x<<"\t"<<#y<<" "<<y<<endl;
#define debug3(x,y,z)   cerr<<#x<<" "<<x<<"\t"<<#y<<" "<<y<<"\t"<<#z<<" "<<z<<endl;
#define info(s)         cerr<<s<<" "<<endl;
#define fr(a,b,c)       for(auto a=b;b<c?a<c:a>=c;b<c?a++:a--)
#define frc(a,b,c)      for(auto a=b;a!=c;a++)
#define tr(it, a)       for(auto it = a.begin(); it != a.end(); it++)
#define lb(v,x)         lower_bound(v.begin(), v.end(), x)
#define ub(v,x)         upper_bound(v.begin(), v.end(), x)
#define clr(x)          memset(x, 0, sizeof(x))
#define GR              (double)(1 + sqrt(5)) / 2
#define fib(n)          (ll)round(pow(GR,n) / sqrt(5))
#define FIO             ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define out1(x)         cout<<x<<" "<<endl
#define out2(x,y)       cout<<x<<" "<<y<<endl
#define SORT(a)         sort(all(a));
#define SORTR(a)        sort(all(a),greater<ll>());
#define ARRAY(a,n)      vll a; fr(i,0,n) { ll temp; cin>>temp; a.pb(temp); }  
#define PRINT(a)        for(auto x:a)cout<<x<<" ";cout<<endl
#define MAX             100050
#define pb              push_back
#define mp              make_pair
#define F               first
#define S               second


template<typename T>
void output_vector(const vector<T> , bool ,bool ,int ,int );

template<typename T>
ostream& operator<<(ostream &out,const vector<T> &v);

template<typename T>
istream& operator>>(istream &in,vector<T> &v);


void solve()
{   
    char a;cin>>a;
    cout<<(isupper(a)?'A':'a')<<endl;
}

int main()
{   
    // #ifndef ONLINE_JUDGE 
    //     freopen("input.txt", "r", stdin); 
    //     freopen("output.txt", "w", stdout); 
    // #endif 
    FIO;
    solve();
    return 0;
}






template<typename T>
void output_vector(const vector<T> &v, bool debug_print=false,bool add_one = false,int start = -1, int end = -1) {
    if (start < 0) start = 0;
    if (end < 0) end = int(v.size());
 
    for (int i = start; i < end; i++)
        (debug_print)?(cerr << v[i] + (add_one ? 1 : 0) << (i < end - 1 ? ' ' : '\n')):(cout << v[i] + (add_one ? 1 : 0) << (i < end - 1 ? ' ' : '\n'));
}   

template<typename T>
ostream& operator<<(ostream &out,const vector<T> &v){
    int i=0;
    for(T x:v){
        out<<x;
        (i++!=v.size())?out<<" ":out<<"\n";    
    }
    return out;
}

template<typename T>
istream& operator>>(istream &in,vector<T> &v){
    for(T &i:v)
        in>>i;
    return in;
}

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

public class Main {
    public static void main(String[] args) throws Exception {
        try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {

            String[] in = br.readLine().split(" ");
            int n = Integer.parseInt(in[0]);
            long k = Long.parseLong(in[1]);
            in = br.readLine().split(" ");
            int[] a = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = Integer.parseInt(in[i]) - 1;
            }

            br.close();

            int now = 0;
            while (k != 0) {
                if (k % 2 == 1) {
                    now = a[now];
                }
                int[] tmp = new int[n];
                for (int i = 0; i < n; i++) {
                    tmp[i] = a[a[i]];
                }
                a = tmp;
                k /= 2;
            }

            System.out.println(now + 1);

        }
    }
}

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

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 func2(ll n){
  ll res = 0;
  while(n%2 == 0){
    n /= 2;
    res++;
  }
  return res;
}

ll zyou(ll a,ll b){//a＾b
  ll res = 1;
  for(int i = 1;i<=b;i++){
    res *= a;
  }
  return res;
}
struct Edge{
  int to;
  int weight;
  Edge(int t, int w) : to(t),weight(w){ }
};

typedef pair<int,int> P;
using Graph = vector<vector<Edge>>;

ll calc(ll a, ll b, ll p){//aのb乗をpで割った余り
  if(b == 0) return 1;

  else if(b%2 == 0){
    ll d = calc(a,b/2,p);
    return (d*d)%p;
  }
  else if(b%2 == 1){
    return (a * calc(a,b-1,p))%p;
  }
}


bool is_prime(int n){//nが素数であるかどうか判定 iで割り切れると素数でない
    if(n == 1) return false;//1は例外
    for(int i = 2;i*i <= n;i++){
        if(n%i == 0) return false;
    }
    
    return true;
}

bool palin(string S){//回文判定
  int n = S.size();
  bool flag = true;
  if(n%2 == 0){
    for(int i = 0;i<=n/2-1;i++){
      if(S[i] != S[n-i-1]){
        flag = false;
        break;
      }
    }
  }
  else if(n%2 == 1){
    for(int i = 0;i<=n/2-1;i++){
      if(S[i] != S[n-i-1]){
        flag = false;
        break;
      }
    }
  }
  return flag;
}
void dfs(string S,int N,vector<string> &v){
  if(S.size() == N) return;
  if(S.size() == N-1){
  v.push_back(S+'A');
  v.push_back(S+'B');
  v.push_back(S+'C');
  v.push_back(S+'x');
  }
  dfs(S+'A',N,v);
  dfs(S+'B',N,v);
  dfs(S+'C',N,v);
  dfs(S+'x',N,v);
}


int main(){
  string S;
  cin >> S;
  if(S[2] == S[3] && S[4] == S[5]) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        try(Scanner sc = new Scanner(System.in)){
            while(true){
                int n = sc.nextInt();
                int a=0;
                if(n==0){ break; }
                int[] scores = new int[n];
                for(int i=0; i<scores.length;i++){
                    scores[i] = sc.nextInt();
                    a=a+scores[i];
                }
                double average = 0.0;
                double variance = 0.0;
                average = (double)a/n;
                for(int i=0;i<scores.length;i++) {
                    variance = variance + (scores[i] - average) * (scores[i] - average);
                }
                variance=variance/n;
                System.out.println(Math.sqrt(variance));
            }
        }
    }
}



Measured memory_bytes: 31372
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const int infint = 1e9;
const int MOD = (int)1e9 + 7;
const int MAXN = (int)2e3 + 7;
ll ted = 0;
map< pair<int, pair<int, int> >, bool > M;
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	ll a, b, c;
	cin >> a >> b >> c;
	while(a % 2 == 0 && b % 2 == 0 && c % 2 == 0)
	{
		if(M.count({a, {b, c}}))
			return cout << -1, 0;
		
		
		ll tmp1 = a, tmp2 = b, tmp3 = c;
		M[{tmp1, {tmp2, tmp3}}] = 1;
		ted++;
		a = (tmp2 + tmp3) / 2, b = (tmp1 + tmp3) / 2, c = (tmp2 + tmp1) / 2;
	}
	cout << ted;
}

Measured memory_bytes: 256
N = int(input())
A = list(map(int,input().split()))
X = []
ans = []
x0 = 0
for i,a in enumerate(A) :
    x0 += (a if i % 2 == 0 else -a)
x0 //= 2
X.append(x0)
ans.append(2*x0)
for i in range(1,N) :
    xi = A[i-1] - X[-1]
    X.append(xi)
    ans.append(2*xi)
print(*ans)

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

int main(void){
    int i, j, W, H;
    while(1){
        cin >> H >> W;
        if(H==0 && W==0) break;
        for(i=0; i<H; i++){
            for(j=0; j<W; j++){
                cout << "#";
            }
            cout << endl;
        }
        cout << endl;
    }
    return 0;
}

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

int main(){
	string str;
	cin>>str;
	if(str[0]==str[1]){
		cout<<"Bad";
		
	}
		else if(str[1]==str[2]){
		cout<<"Bad";
	}
		else if(str[2]==str[3]){
		cout<<"Bad";
	}
	else{
		cout<<"Good";
	}
	return 0;
}

Measured memory_bytes: 3580
//Littleboy123 Template 1.7
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;

//pragmas

// #pragma comment(linker, "/stack:200000000")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
// #pragma GCC target ("avx2")
// #pragma GCC optimization ("O3")
// #pragma GCC optimization ("unroll-loops")


typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef long long int ll;
typedef pair<ll, ll> pll;
typedef unsigned long long int ull;
typedef long double ld;
typedef unsigned long long ull;

const long double pi = acos(-1.0);

#define FOR(a,b,c) for(ll (a)=(b);(a)<(c);++(a))
#define FORE(a,b,c) for(ll (a)=(b);(a)<=(c);++(a))
#define FORN(a,b,c) for(ll (a)=(b);(a)>(c);--(a))
#define FORNE(a,b,c) for(ll (a)=(b);(a)>=(c);--(a))
#define TC(n) cout << "Case #" << (n) << ": "
#define DEBUG(x) cout << "DEBUG " << #x << ' ' << x << '\n';
#define MEM(a,b) memset((a), (b), sizeof((a)))
#define MAX(a,b) (a) = max((a), (b))
#define MIN(a,b) (a) = min((a), (b))
#define nl '\n'
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define ordered_set tree<ll, null_type,less_equal<ll>, rb_tree_tag,tree_order_statistics_node_update>

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

void infile(){
    freopen("output.out", "r", stdin);
}

void outfile(){
    freopen("output.out", "w", stdout);
}

ll modex(ll a, ll b, ll mod){
    if(b == 0)
        return 1;
    if(b == 1)
        return a;
    ll tmp = modex(a, b/2, mod);
    tmp = (tmp * tmp) % mod;
    if(b & 1)
        tmp = (tmp * a) % mod;
    return tmp;
}

//End of template

struct tanya{
    int l, r;
    int id;

    tanya() {}
    tanya(int l, int r, int id): l(l), r(r), id(id) {}
};

ll n, q;
ll arr[500005];
tanya query[500005];
int fenwick[500005];
int jawab[500005], vis[500005];

bool compar(tanya a, tanya b){
    return a.r < b.r;
}

void update(int id, int val){
    while(id <= n){
        fenwick[id] += val;
        id += (id)&(-id);
    }
}

int ask(int id){
    int res = 0;
    while(id > 0){
        res += fenwick[id];
        id -= (id)&(-id);
    }
    return res;
}

int main(){
    init();

    cin >> n >> q;
    FOR(i, 0, n){
        cin >> arr[i];
    }
    FOR(i, 0, q){
        cin >> query[i].l >> query[i].r;
        query[i].l--;
        query[i].r--;
        query[i].id = i;
    }
    sort(query, query+q, compar);
    FOR(i, 0, 500005){
        fenwick[i] = 0;
        vis[i] = -1;
    }
    int tmp = 0;
    FOR(i, 0, n){
        if(vis[arr[i]] != -1){
            update(vis[arr[i]] + 1, -1);
        }
        vis[arr[i]] = i;
        update(i+1, 1);
        while(tmp < q && query[tmp].r == i){
            jawab[query[tmp].id] = ask(query[tmp].r+1)-ask(query[tmp].l);
            tmp++;
        }
    }
    FOR(i, 0, q){
        cout << jawab[i] << endl;
    }
    return 0;
}


Measured memory_bytes: 19364
N = int(input())
MAX = 10**6
table = [0]*(MAX+1)
for x in map(int,input().split()):
    table[x] += 1
for i in range(MAX+1):
    if table[i]:
        for j in range(2*i if table[i] == 1 else i, MAX+1, i):
            table[j] = 0
print(sum(table))

Measured memory_bytes: 32420