akhauriyash/Code-Regression huggingface dataset:
import java.io.*;
import java.util.*;

public class Main {
    static Set<Integer> primes = new HashSet<>();
    static{
        for(int i=2; i<=1000; i++){
            if(isprime(i))
                primes.add(i);
        }
    }
    private static void solver(InputReader sc, PrintWriter out) throws Exception {
       int k = sc.nextInt();
       long ans =0;
       for(int i=1;i<=k;i++){
           for(int j=1;j<=k;j++){
               for(int c=1; c<=k ;c++){
                  ans += gcd(i,j,c);
               }
           }
       }
       out.println(ans);
    }
    private static boolean isprime(int x){
        if(x==2)
            return true;
        int sqs = (int)Math.sqrt(x);
        for(int i=2; i<=sqs; i++){
            if(x%i==0)
                return false;
        }
        return true;
    }

    private static int gcd (int a, int b) {
        if (b == 0)
            return a;
        else
            return gcd (b, a % b);
    }
    private static int gcd (int a, int b, int c) {
      int gcd1 = gcd(a,b);
      return gcd(gcd1,c);
    }

    private static long helper(long x){
        long ans = (x * (x-1))/2;
        return ans;
    }
    public static void main(String[] args) throws Exception {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        solver(in,out);
        out.close();
    }
    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }
        public long nextLong() {
            return Long.parseLong(next());
        }
        public int[] readIntArray(int n){
            int arr[] = new int[n];
            for(int i=0;i<n;i++) arr[i] = nextInt();
            return arr;
        }
    }
}
class Pair {
    int x;
    long y;

    Pair(int x, long y) {
        this.x = x;
        this.y = y;
    }

    @Override
    public boolean equals(Object o) {
        Pair pair = (Pair) o;
        return this.x < pair.x && this.y==pair.y;
    }

    @Override
    public int hashCode() {
        return Objects.hash(x, y);
    }
}

Measured memory_bytes: 33072
#include<iostream>
#include<vector>
using namespace std;
#define ll long long

ll A,B,C;

ll gcd(ll a,ll b){
    if(b==0) return a;
    return gcd(b,a%b);
}

int main(){
    cin>>A>>B;
    C=gcd(A,B);
    int cnt=1;
    for(ll i=2;i*i<=C;i++){
        if(C%i!=0) continue;
        while(C%i==0){
            C/=i;
        }
        cnt++;
    }
    if(C!=1) cnt++;
    cout<<cnt<<endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
 public class  Main{ 
     public static void main(String[] args){
      Scanner sc = new Scanner(System.in);
       while(true){
            int a = sc.nextInt();
            int b = sc.nextInt();
            if(a == 0 && b == 0){
                break;
             } 
            for(int i = 0;i<a;i++){
                 for(int j = 0;j<b;j++) {
                     if(i==0 || i==a-1){
                      System.out.printf("#"); 
                    }else{
                        if(j==0 || j==b-1){
                        System.out.printf("#");
                    }else{
                        System.out.printf(".");
                    }
                }
            }
                    System.out.printf("\n");
                 } System.out.printf("\n"); 
                }
            }
        }


Measured memory_bytes: 56308
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>
#define int long long
#define rep(i, n) for (int i = 0; i < (n); i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define FORR(i,a,b)for(int i=(a);i<=(b);i++)
#define repR(i,n) for(int i=n;i>=0;i--)
#define P pair<int, int>
#define sz(x) x.size()
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define VE vector<int>
#define COUT(x) cout<<(x)<<endl
#define MA map<int,int>
#define SE set<int>
#define PQ priority_queue
#define COUT(x) cout<<(x)<<endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl

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

using namespace std;
typedef long long ll;
using Graph = vector<vector<int>>;
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}
bool compare_by_b(pair<int, int> a, pair<int, int> b) {
	if (a.second != b.second) {
		return a.second < b.second;
	}
	else {
		return a.first < b.first;
	}
}

const long long MOD = 1000000007; 
const long long INF = 1LL << 50;
// pair -> vector<pair<int,int>> 
//		   AandB.push_back(make_pair(a[i],b[i]))



signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	string s; cin >> s;
	int ans = 0;
	while (s.size()) {
		if (s[0] == s[s.size() - 1]) {
			if (!s.empty()) { s.erase(s.begin()); if(!s.empty())s.pop_back(); }
		}
		else {
			if (s[0] == 'x') {
				ans++; s = s + 'x';
			}
			else if (s[s.size() - 1] == 'x') {
				ans++; s = 'x' + s;
			}
			else {
				cout << -1 << endl; return 0;
			}
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 804
#include <iostream>
#include <string>
#define rep(i, a, b) for(int i = a; i < b; i++)
using namespace std;

int main() {
  string s;
  cin >> s;
  rep(i, 0, 19) {
    if(i == 5 || i == 13) cout << " ";
    else cout << s[i];
  }
  cout << "\n";
}


Measured memory_bytes: 3568
//Solution for aoj 0547 Commute routes
#include <iostream>
#include <algorithm>
using namespace std;
const int ht = 100000;
int rotes[101][101][2];
int w, h, wh2;
int main(){
	for (int i = 1; i <= 100; i++){
		rotes[i][1][0] = 1;
	}
	for (int i = 1; i <= 100; i++){
		rotes[1][i][1] = 1;
	}
	for (int i = 2; i <= 100; i++){
		for (int j = 2; j <= 100; j++){
			rotes[i][j][0] = rotes[i - 1][j][0] + rotes[i - 1][j][1];
			rotes[i][j][1] = rotes[i][j - 1][0] + rotes[i][j - 1][1];
			if (i >= 3){
				if (rotes[i][j][0]<rotes[i - 2][j - 1][0])
					rotes[i][j][1] += ht;
				rotes[i][j][0] -= rotes[i - 2][j - 1][0];
			}
			if (j >= 3){
				if (rotes[i][j][1]<rotes[i - 1][j - 2][1])
					rotes[i][j][1] += ht;
				rotes[i][j][1] -= rotes[i - 1][j - 2][1];

			}
			rotes[i][j][0] %= ht;
			rotes[i][j][1] %= ht;
		}
	}
	while (cin >> w >> h){
		if (!w&&!h)
			return 0;
		cout << (rotes[w][h][0] + rotes[w][h][1]) % ht << endl;
	}
	return 0;
}

Measured memory_bytes: 1240
#include<stdio.h>
int A[100000];
int partition(int p,int r);
int main(){
  int n,z,i;
  scanf("%d",&n);
  for(i=0;i<n;i++)scanf("%d",&A[i]);
  z=partition(0,n-1);
  for(i=0;i<n-1;i++){
    if(i==z)printf("[%d] ",A[i]);
    else printf("%d ",A[i]);
  }
  printf("%d\n",A[n-1]);
  return 0;
}

int partition(int p,int r){
  int i,j,x,y,z;
  x=A[r];
  i=p-1;
  for(j=p;j<r;j++){
    if(A[j]<=x){
      i++;
      y=A[i];
      A[i]=A[j];
      A[j]=y;
    }
  }
    z=A[i+1];
    A[i+1]=A[r];
    A[r]=z;
    return i+1;
}



Measured memory_bytes: 2144
// E - Sequence Sum
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;

int main(){
	ll n; int x, m; cin>>n>>x>>m;
	int mn = min(n, (ll)m);
	vector<int> P; // pre_sum
	ll sum_p = 0; // sum of pre + cycle
	vector<int> X(m, -1); // for cycle check & pre_len
	for(int i=0; i<mn; ++i){
		if(X[x] > -1){
			int cyc_len = P.size() - X[x];
			ll cyc = (sum_p - P[X[x]]) * ((n - X[x]) / cyc_len);
			ll remain = P[X[x] + (n - X[x]) % cyc_len];
			cout<< cyc + remain <<endl;
			return 0;
		}
		P.push_back(sum_p);
		sum_p += x;
		X[x] = i;
		x = (ll)x*x % m;
	}
	cout<< sum_p <<endl;
}


Measured memory_bytes: 4040
#include <stdio.h>
#define MAX_NUM 200000

int main() {
  int N, C;
  int s, t, c;
  
  scanf("%d %d", &N, &C);
  char programList[C][MAX_NUM];

  int i, j;
  for (i=0; i<C; i++) {
    for (j=0; j<MAX_NUM; j++) {
      programList[i][j] = 0;
    }
  }

  for (i=0; i<N; i++) {
    scanf("%d %d %d", &s, &t, &c);
    for (j=(s*2)-1; j<t*2; j++) {
      programList[c-1][j] = 1;
    }
  }
  
  int sum;
  int deckCount = 0;
  for (i=0; i<MAX_NUM; i++) {
    sum = 0;
    for(j=0; j<C; j++) {
      sum += programList[j][i];
    }
    if (sum > deckCount) {
      deckCount = sum;
    }
  }
  
  printf("%d\n", deckCount);
}

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

//repetition
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)

//container util
#define all(x) (x).begin(),(x).end()

//typedef
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VLL;
typedef vector<VLL> VVLL;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;


//conversion
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
inline ll toLL(string s) {ll v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    VLL a(n);
    rep(i,n){
      cin >> a[i];
    }
    if(a[0] != 0){
      cout << -1 << "\n";
      return 0;
    }
    ll ans = 0;
    FOR(i,1,n){
      if(a[i] > i){
        cout << -1 << "\n";
        return 0;
      }
      if(a[i-1]+2 <= a[i]){
        cout << -1 << "\n";
        return 0;
      }

      if(a[i-1]+1 ==  a[i]){
        ans += 1;
      }else{
        ans += a[i];
      }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1792
import java.util.*

fun main(args: Array<String>) {
    val pw = java.io.PrintWriter(System.out)
    Problem.solve(Scanner(System.`in`), pw)
    pw.flush()
}

fun <A : Comparable<A>> min(a: A, b: A) = if (a < b) a else b
fun <A : Comparable<A>> max(a: A, b: A) = if (a > b) a else b

object Problem {
    fun solve(sc: Scanner, pw: java.io.PrintWriter) {
        val N = sc.next().toInt()
        val A = IntArray(N) { sc.next().toInt() }.sorted()
        val Amax = A.max()!!
        val div = BooleanArray(A.max()!! + 1)
        val ans = mutableSetOf<Int>()
        A.forEach { a ->
            if (!div[a]) {
                ans.add(a)
                for (i in a..Amax step a) div[i] = true
            } else if (ans.contains(a)) {
                ans.remove(a)
            }
        }
        pw.println(ans.count())
    }
}


Measured memory_bytes: 73328
#include <stdio.h>

int main(void)
{
	int S,a,b,c,d;
	
	scanf("%d",&S);
	
	a=S/3600;
	b=S%3600;
	c=b/60;
	d=b%60;
	
	printf("%d:%d:%d\n",a,c,d);
	return 0;
}

Measured memory_bytes: 592
#include<stdio.h>
long long MIN(long long a,long long b){return a<b?a:b;}
int main(){
  long long n,i,a[100010]={};
  long long ans=0,m[100010]={1};
  scanf("%lld",&n);
  n++;
  for(i=0;i<n;i++)scanf("%lld",&a[i]);
  for(i=0;i<n;i++){//printf("%lld %lld\n",m[i],a[i]);
    if(m[i]<a[i]){
      printf("-1\n");
      return 0;
    }
    m[i]-=a[i];
    m[i+1]=MIN(m[i]*2LL,1e15);
  }
  for(i=0;i<n;i++)m[i]+=a[i];
  //for(i=0;i<n;i++)printf("%lld ",m[i]);printf("\n");
  for(i=n;i--;){
    a[i]=MIN(m[i],a[i]+a[i+1]);
    ans+=a[i];
  }
  printf("%lld\n",ans);
  return 0;
}
		       
	


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

using namespace std;

#ifdef DEBUG_MODE
	#define DBG(n) n;
#else
	#define DBG(n) ;
#endif
#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define rep(i,s,g) for(ll (i) = (s);(i) < (g);++i)
#define rrep(i,s,g) for(ll (i) = (s);i >= (g);--(i))
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {for(int W = 0;W < (n);W++)cerr << v[W] << ' ';cerr << endl << endl;}
#define SHOW2d(v,i,j) {for(int aaa = 0;aaa < i;aaa++){for(int bbb = 0;bbb < j;bbb++)cerr << v[aaa][bbb] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define MOD 1000000007

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

int dp[2][1 << 22];

int main(){
	int n,m;
	while(cin >> n >> m,n|m){
		REP(i,1<<22)dp[0][i] = dp[1][i] = -1;
		dp[0][0] = dp[1][0] = 0;
		vector<string> v(n);
		REP(i,n)cin >> v[i];
		
		if(m <= 22){
			REP(i,n){
				REP(j,1<<m)dp[0][j] = dp[1][j];
				REP(j,1<<m){
					if(dp[0][j] == -1)continue;
					int tmp = j;
					REP(k,m)if(v[i][k] == '1')tmp ^= (1 << k);
					dp[1][tmp] = max(dp[1][tmp],dp[0][j]+1);
					dp[1][j] = max(dp[1][j],dp[0][j]);
				}
			}
			cout << dp[1][0] << endl;
		}
		else{
			int ans = 0;
			REP(i,1<<n){
				int now[m] = {};
				int cou = 0;
				REP(j,n){
					if(i & (1 << j)){
						cou++;
						REP(k,m)now[k] ^= (v[j][k] == '1');
					}
				}
				bool flag = true;
				REP(j,m)if(now[j])flag = false;
				if(flag)ans = max(ans,cou);
			}
			cout << ans << endl;
		}
	}
	return 0;
}


Measured memory_bytes: 35864
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <ctime>
#include <cstring>
#include <functional>
#include <iostream>
#include <iomanip>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <regex>
#include <vector>

#define fix(n)          cout<<fixed<<setprecision(n)
#define rep(i,n)        for (int i = 0; i < (n); ++i)
#define all(a)          (a).begin(), (a).end()
#define sort(a)         sort(all(a))
#define uniq(a)         sort(a);(a).erase(unique(all(a)), (a).end())
#define reverse(a)      reverse(all(a))
#define ctos(c)         string(1, (c))
#define out(d)          cout << (d)
#define outl(d)         std::cout<<(d)<<"\n"
#define YES()           cout << "YES" << endl
#define NO()            cout << "NO" << endl
#define Yes()           cout << "Yes" << endl
#define No()            cout << "No" << endl
#define ceil(x, y)      ((x + y - 1) / (y))
#define debug(x)        cerr << #x << ": " << (x) << '\n'
#define debug2(x, y)    cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << '\n'
#define debug3(x, y, z) cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << ", " << #z << ": " << (z) << '\n'
#define dbg(v)          for (size_t _ = 0; _ < v.size(); ++_){ cerr << #v << "[" << _ << "] : " << v[_] << '\n'; }
#define pb              push_back
#define fst             first
#define int             long long
#define INF             __LONG_LONG_MAX__

using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll,ll>;

const ll MOD = 1000000007; // 10^9 + 7
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

void solve() {
  ll h, w; cin >> h >> w;
  vector<string> grid(h); rep(i, h) cin >> grid[i];
  const ll MAX = 400;
  bool visited[MAX][MAX] = {{}};
  ll ans = 0;
  rep(i, h)rep(j, w) {
    if (visited[i][j]) continue;
    ll cntw = 0, cnth = 0;

    visited[i][j] = true;
    queue<ll> qx, qy;
    qx.push(j); qy.push(i);
    while (!qx.empty()) {
      ll x = qx.front(); qx.pop();
      ll y = qy.front(); qy.pop();

      if (grid[y][x] == '.') cntw++;
      else cnth++;

      rep(k, 4) {
        ll nx = x + dx[k];
        ll ny = y + dy[k];
        if (nx >= 0 && nx < w && ny >= 0 && ny < h && grid[y][x] != grid[ny][nx] && !visited[ny][nx]) {
          visited[ny][nx] = true;
          qx.push(nx);
          qy.push(ny);
        }
      }
    }

    ans += cntw * cnth;
  }
  outl(ans);
}

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  srand((unsigned)time(NULL));
  fix(12);

  solve();
}


Measured memory_bytes: 768
def Z(s):
    n=len(s)
    lcp=[0]*n
    lcp[0]=n
    L,R=0,0
    for i in range(1,n):
        if(i>=R): # 過去の結果の再利用が不可
            L=i
            R=i
            while(R<n and s[R-L]==s[R]):
                R+=1
            lcp[i]=R-L
        elif(lcp[i-L]<R-i): # 過去の結果を再利用
            lcp[i]=lcp[i-L]
        else: # 過去の結果を一部再利用
            L=i
            while(R<n and s[R-L]==s[R]):
                R+=1
            lcp[i]=R-L
    return lcp

N = int(input())
S=input()

ans=0
#Zalgorithmでは先頭からしか見れないので，開始位置をずらしてN通り，j文字目を先頭にした時
for j in range(N):
    T=S[j:]
    lcp=Z(T)
    lcp[0]=0
    l=0
    for k in range(len(lcp)):
        l=max(l,min(lcp[k],k))
    ans=max(ans,l)
print(ans)

Measured memory_bytes: 50396
n,m,k=[int(x) for x in input().split()]
#TODO Mutiply wih m
if m==1:
  if k==n-1: print(1)
  else: print(0)
  exit()
sumi=0
mod=998244353
prodi=pow(m-1,n-1,mod)
invi=pow(m-1,mod-2,mod)
for j in range(n-1,n-1-k-1,-1):
  sumi+=prodi
  sumi%=mod
  prodi*=j
  prodi%=mod
  prodi*=pow(n-j,mod-2,mod)
  prodi%=mod
  prodi*=invi
  prodi%=mod 
sumi*=m
sumi%=mod
print(sumi)
  

Measured memory_bytes: 65872
#include<bits/stdc++.h>
using namespace std;
int main(){
    int a,s;cin>>a>>s;
    int e = a+s-1;
    vector<int> v;
    int sum = 0;
    for(int i=s;i<=e;i++){
        v.push_back(i);
        sum+=i;
    }
    int cur = 1000000;
    for(auto x:v){
        if(abs(x)<abs(cur)) cur=x;
    }
    sum -= cur;
    cout<<sum;
}

Measured memory_bytes: 256
import numpy as np
import copy


def main():
    n = input()
    p_arr = list(map(int, input().split()))
    p_arr = np.array(p_arr, dtype=np.int)

    ans = 0
    ans += np.sum(np.logical_and(p_arr[1:-1]
                                 > p_arr[:-2], p_arr[1:-1] < p_arr[2:]))
    ans += np.sum(np.logical_and(p_arr[1:-1]
                                 < p_arr[:-2], p_arr[1:-1] > p_arr[2:]))
    print(int(ans))


if __name__ == '__main__':
    main()


Measured memory_bytes: 21520
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define pb emplace_back
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define quickio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
const ll MOD = 1000000007;
ll power(ll x,ll y){ll R=1;x%=MOD;while(y>0){if(y&1)R=(R*x)%MOD;y=y>>1,x=(x*x)%MOD;}return R;}

int main(){
    ll n,d;
    cin>>n>>d;
    int count=0;
    while(n--){
        ll x,y;
        cin>>x>>y;
        if((x*x + y*y)<= d*d)  count++;
    }
     cout<<count<<endl;
 

}

Measured memory_bytes: 3644
n = int(input())
a = list(map(int, input().split()))
minus = 0
ans = 0
if 0 in a:
  for i in a:
    ans += abs(i)
    
for i,b in enumerate(a):
  if b < 0:
    minus += 1
  a[i] = abs(b)
ans = sum(a)
if minus%2:
  ans -= min(a)*2
print(ans)

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

int n, d, x;
int a[110];

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    //freopen("in.txt", "r", stdin);
    //freopen("out.txt", "w", stdout);
    cin >> n >> d >> x;
    for(int i=0; i<n; i++) cin >> a[i];
    ll cnt = 0;
    for(int i=0; i<n; i++) {
        int j = 0;
        while (true) {
            if (j * a[i] + 1 <= d) {
                cnt++;
            } else break;
            j++;
        }
    }
    cout << cnt + x << "\n";
    return 0;
}

Measured memory_bytes: 256
program main
  implicit none
  integer(8) N, i ,score, saishozantei!暫定トップ
  integer(8) lefts !左側の#
  integer(8) rightd !右側の.
  character(2*(10**5)) S
  read(*, *) N
  read(*, *) S
  lefts = 0
  rightd = 0
  !#の数
  do i = 1,N
    if (S(i:i) == '.') then
      rightd = rightd + 1
    end if
  end do
  saishozantei = rightd
  do i = 1,N
    if (S(i:i) == '#') then
      lefts = lefts + 1
    else
      rightd = rightd - 1
    end if
    score = lefts + rightd
    saishozantei = min(saishozantei,score)
  end do
  write(*,'(i0)') saishozantei
end program main


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

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

  string s;
  cin >> s;

  int len = s.length();

  int l = 0, r = 0;

  // skip '1's
  while (s[r] == '1'){ r++; }
  for (int i = 0; i < k; i++){
    // skip '0's
    while (s[r] == '0'){ r++; }
    // skip '1's
    while (s[r] == '1'){ r++; }
  }

  int ans = r - l;
  
  while (r < len){
    // NEXT L
    // skip '1's
    while (s[l] == '1'){ l++; }
    // skip '0's
    while (s[l] == '0'){ l++; }

    // NEXT R
    // skip '0's
    while (s[r] == '0'){ r++; }
    // skip '1's
    while (s[r] == '1'){ r++; }

    ans = max(ans, r - l);
  }

  cout << ans << endl;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (int i = a; i < b; i++)
#define all(v) v.begin(), v.end()
const int MOD = 1e9 + 7;
const int INF = 1e9;
//'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122

int main() {
    ll s;
    cin >> s;
    ll r = sqrt(s);
    if (r * r != s) r++;
    ll x = r * r - s;
    cout << "0 0" << " " << r << " " << 1 << " " << x << " " << r << endl;
    return 0;
}


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

#define rep(i, n) for(int i = 0; i<(n); i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
using ll = long long;

int main() {
    int N, M;
    cin >> N >> M;
    vector<int> A(N);
    rep(i, N) cin >> A[i];

    int sum = 0;
    rep(i, N) sum += A[i];

    int cnt = 0;
    rep(i, N) if (A[i] * 4 * M >= sum) cnt++;
    if (cnt >= M) cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 256
from bisect import bisect_left, bisect_right
w, h = map(int, input().split())
p = sorted(int(input()) for _ in range(w))
q = sorted(int(input()) for _ in range(h))


# 全ての(i, j)に対して、min(p[i], q[j])
ans = sum(p) + sum(q)
for i in range(w):
    num = h - bisect_left(q, p[i])
    ans += num * p[i]
for i in range(h):
    num = w - bisect_right(p, q[i])
    ans += num * q[i]
print(ans)


Measured memory_bytes: 87772
#include <bits/stdc++.h>
using namespace std;
string hitachi;
string verif ="";
int main() {
  cin >> hitachi;
  bool ans = false;
  for(int i = 0;i<(hitachi.size() / 2);i++){
    verif += "hi";
    if(verif == hitachi){
      ans = true;
    }
  }
  cout<<(ans? "Yes":"No") << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define irep(i,a,b) for(typeof(i) i = (a); i < (b); ++i)
#define itrep(it,c) for(auto it = (c).begin(); it != (c).end(); ++it)

// MOD p でいくつクラス
#define MOD 2019
class mll {
	unsigned long long val = 0;
public:
	mll(long long y = 0) : val(((y % MOD) + MOD) % MOD) {}
	mll operator + (const mll& y) { return mll(*this) += y; }
	mll& operator += (const mll& y) {
		val = (val + y.val) % MOD;
		return *this;
	}
	mll operator - (const mll& y) { return mll(*this) -= y; }
	mll& operator -= (const mll& y) {
		val = (val - y.val + MOD) % MOD;
		return *this;
	}
	mll operator * (const mll& y) { return mll(*this) *= y; }
	mll& operator *= (const mll& y) {
		val = (val * y.val) % MOD;
		return *this;
	}
	mll operator / (const mll& y) { return mll(*this) /= y; }
	mll& operator /= (const mll& y) {
		long long a = y.val, b = MOD, u = 1, v = 0;
		while (b) {
			long long t = a / b;
			a -= t * b; swap(a, b);
			u -= t * v; swap(u, v);
		}
		val = (((val * u) % MOD) + MOD) % MOD;
		return *this;
	}
	bool operator >= (const mll& y) {
		return this->val >= y.val;
	}
	mll pow(long long t) const {
		if (!t) return 1;
		mll a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}
	unsigned long long getVal() {
		return val;
	}
	friend ostream& operator <<(ostream& os, mll& y) {
		os << y.val;
		return os;
	}
};
#undef MOD

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

	char* S = new char[200001];
	cin >> S;
	string s = S;
	int N = s.size();

	vector<mll> T(s.size()+1, 0);
	map<int,int> M;
	T.at(N) = 0;
	for(int i = N - 1; i >= 0; i--){
		T.at(i) = mll(S[i] - 48) * mll(10).pow(N-i-1) + T.at(i + 1);
//		cout << "(" << i << "," << T.at(i) << endl;
		M[T.at(i).getVal()]++;
	}

	ll count = 0;
	itrep(it, M) {
		ll m = it->second;
		count += m * (m - 1) / 2;
		if (it->first == 0){
			count += m;
		}
	}

	cout << count << endl;

}


Measured memory_bytes: 5256
#include <iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<queue>
#define N 10000
using namespace std;
int cnt[10]={0},n,a[N];
int main()
{
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
        a[i]/=400;
        if(a[i]>8)a[i]=8;
        cnt[a[i]]++;
    }
    int tot=0;
    for(int i=0;i<8;i++)if(cnt[i]>0)tot++;
    cout<<max(tot,1)<<" "<<tot+cnt[8];
}
/*
 5
 1 1 1
 111
 3 1 8
 1
 2
 4
 1 2
 2 3
 3 2 10
 4 7
 8 9
 2 3
 1 2
 2 3
 4 2 99
 0 1
 0 1
 0 1
 0 0
 4 1
 2 4
 4 3
 4 3 99
 0 1 0
 0 1 0
 0 1 0
 0 0 0
 4 1
 2 4
 4 3
 */


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <numeric>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <time.h>
#include <list>

using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(n);++i)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define reps(x,c) for(auto x:c)
#define all(x) begin(x), end(x)
#define pb(a) emplace_back(a) 
#define mp(a,b) make_pair((a),(b))
#define pl pair<ll,ll>
#define INF 2147483600
#define MOD 1000000007
#define fi first
#define se second
#define dbg(x) cout << #x"="<< (x) << endl
#define dbgv(x) cout<<#x<<endl;reps(y,x){cout<<y<<" ";}cout<<endl

int main(){
  string s;cin>>s;
  ll k;cin>>k;
  set<string> st;
  rep(i,s.size()){
  	FOR(j,1,min(ll(s.size()-i+1),6ll)){
  		st.insert(s.substr(i,j));
  	}
  }
  ll cnt=0;
  reps(x,st){
  	cnt++;
  	if(cnt==k){
  		cout<<x<<endl;
  		return 0;
  	}
  }
  return 0;
}

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

ll N;
ll res = 0;
vector<ll> N_pf;

ll prime_fac_num(ll n){
  ll num = 1;  //nの約数の個数
  ll i;

  ll tmp = n;
  for(i = 2; i * i <= n; i++){
    while(tmp % i == 0){ N_pf.push_back(i); tmp /= i; }
  }

  if(tmp != 1) N_pf.push_back(tmp);  //完全に分解されていない
  sort(N_pf.begin(), N_pf.end());
  
  i = 0;
  while(i < N_pf.size()){
    ll j = 0;  //N_pf[i]の数
    while(i < N_pf.size() && N_pf[i+j] == N_pf[i]) ++j;  //因数N_pf[i]の個数
    num *= (j+1);  //0乗分込
    i += j; j = 0;
  }

  num -= 1;  //すべての素因数の0乗の積を除外
  return num;
}

int main(){
  cin >> N;

  res += prime_fac_num(N-1);

  for(ll K = 2; K * K <= N; K++){
    vector<ll> k; ll tmp = K;
    
    while(tmp <= N){ k.push_back(tmp); tmp *= K; }
    for(int i = 0; i < k.size(); i++){
      if(N % k[i] == 0 && (N/k[i]-1) % K == 0) ++res;
    }
  }

  res += 1;  //K == Nの時

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

Measured memory_bytes: 256
import java.util.*;
import java.io.*;
import static java.lang.Math.*;

public class Main {
    public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		
		// 入力
		int n = sc.nextInt();
		long a = sc.nextLong();
		long b = sc.nextLong();
		long[] d = new long[n-1];
		long pre = 0;
		long result = 0;
		for(int i = 0; i < n; i++){
		    long x = sc.nextLong();
		    if(i > 0){
		        d[i-1] = min(b, (x-pre)*a);
		        result += d[i-1];
		    }
		    pre = x;
		}
		
		// 計算
		
		// 出力
		System.out.println(result);
	}

	public static class Scanner {
		private BufferedReader br; private StringTokenizer tok;
		public Scanner(InputStream is) throws IOException { br = new BufferedReader(new InputStreamReader(is));}
		private void getLine() throws IOException { while(!hasNext()) tok = new StringTokenizer(br.readLine());}
		private boolean hasNext() { return tok != null && tok.hasMoreTokens();}
		public String next() throws IOException { getLine(); return tok.nextToken();}
		public int nextInt() throws IOException { return Integer.parseInt(next());}
		public long nextLong() throws IOException { return Long.parseLong(next());}
		public double nextDouble() throws IOException { return Double.parseDouble(next());}
	}
}


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

int main(void){
  int a;
  cin >> a;
  string b;
  for (int i = 0; i < a; i++)
  {
    cin >> b;
    if (b == "Y")
    {
        cout << "Four" << endl;
        return 0;
    }
  }
  cout << "Three" <<endl;
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(void){
    char s[26+5];
    scanf("%s", s);
    qsort(s, strlen(s), sizeof(char), strcmp);
    
    for(int i=1; i<strlen(s); i++){
        if(s[i-1]==s[i]){
            printf("no\n");
            return 0;
        }
    }
    printf("yes\n");
    return 0;
}


Measured memory_bytes: 1616
var
 s:ansistring;
 i,a,b,ans:longint;
begin
 readln(s);
 for i:=1 to length(s) do
  if a=b then begin inc(a);if s[i]='p' then dec(ans);end
         else begin inc(b);if s[i]='g' then inc(ans);end;
 writeln(ans);
end.

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**7)

readline = sys.stdin.buffer.readline
def readstr():return readline().rstrip().decode()
def readstrs():return list(readline().decode().split())
def readint():return int(readline())
def readints():return list(map(int,readline().split()))
def printrows(x):print('\n'.join(map(str,x)))
def printline(x):print(' '.join(map(str,x)))

a,b,c,d = readints()

ans = -10**20

for x in (a,b):
    for y in (c,d):
        ans = max(x*y,ans)
print(ans)

Measured memory_bytes: 61892
#include "bits/stdc++.h"
using namespace std;
#define int long long
#define endl '\n'
int mod=1e9+7;
int mod2=998244353;

signed main(){
string s;
cin>>s;
int ans=0;
int tmp=0;
for(int i=0;i<s.size();i++){
if(s[i]=='A'||s[i]=='C'||s[i]=='T'||s[i]=='G')tmp++;
else{
ans=max(ans,tmp);
tmp=0;
}
}
cout<<max(ans,tmp)<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<iterator>
#include<string>
#include<queue>
#include<set>
#include<stack>
#include<map>

using namespace std;

int main(){
    int N;
    cin>>N;
    if(N%2==0){
        cout<<((N-2)*N)/2<<endl;
        for(int i=1;i<=N;i++){
            for(int j=i+1;j<=N;j++){
                if( j!=N+1-i ){
                    cout<<i<<' '<<j<<endl;
                }
            }
        }
    }else{
        cout<< ((N-1)*(N-1))/2 <<endl;
        for(int i=1;i<=N;i++){
            for(int j=i+1;j<=N;j++){
                if( j!=N-i ){
                    cout<<i<<' '<<j<<endl;
                }
            }
        }
    }
    
    return 0;
}


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

int main()
{
   int n;
   int ans = 0;
   cin >> n;
   vector<int> h(n*2);
   for(int i=1; i<n+1;++i)cin >> h[i];
   h[0] = 0;
   h[n+1] = 0;
   rep(i,n+1){
       if(h[i]>h[i+1]){
           ans+=h[i]-h[i+1];
       }
   }
   cout << ans << endl;
   return 0;
}

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

int main() {
	
	int n, x;
	cin >> n >> x;
	
	while (!(n == 0 && x == 0)) {
		
		int count = 0;
						
		for (int a=1; a*3 <= x; a++)
			for (int b=a+1; a+b*2 < x; b++)
				if (x-a-b > b && x-a-b <= n)
					count++;

		cout << count << endl;
		cin >> n >> x;		
	}	
	
	return 0;
}


Measured memory_bytes: 3068
using AtCoderBeginnerContest125.Questions;
using AtCoderBeginnerContest125.Extensions;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;

namespace AtCoderBeginnerContest125.Questions
{
    public class QuestionA : AtCoderQuestionBase
    {
        public override IEnumerable<object> Solve(TextReader inputStream)
        {
            var abt = inputStream.ReadIntArray();
            var a = abt[0];
            var b = abt[1];
            var t = abt[2];

            yield return (t / a) * b;
        }
    }
}


namespace AtCoderBeginnerContest125
{
    class Program
    {
        static void Main(string[] args)
        {
            IAtCoderQuestion question = new QuestionA();    // 問題に合わせて書き換え
            var answers = question.Solve(Console.In);
            foreach (var answer in answers)
            {
                Console.WriteLine(answer);
            }
        }
    }
}

#region Base Classes

namespace AtCoderBeginnerContest125.Questions
{

    public interface IAtCoderQuestion
    {
        IEnumerable<object> Solve(string input);
        IEnumerable<object> Solve(TextReader inputStream);
    }

    public abstract class AtCoderQuestionBase : IAtCoderQuestion
    {
        public IEnumerable<object> Solve(string input)
        {
            var stream = new MemoryStream(Encoding.Unicode.GetBytes(input));
            var reader = new StreamReader(stream, Encoding.Unicode);

            return Solve(reader);
        }

        public abstract IEnumerable<object> Solve(TextReader inputStream);
    }

}

#endregion

#region Extensions

namespace AtCoderBeginnerContest125.Extensions
{
    internal static class TextReaderExtensions
    {
        internal static int ReadInt(this TextReader reader) => int.Parse(ReadString(reader));
        internal static long ReadLong(this TextReader reader) => long.Parse(ReadString(reader));
        internal static double ReadDouble(this TextReader reader) => double.Parse(ReadString(reader));
        internal static string ReadString(this TextReader reader) => reader.ReadLine();

        internal static int[] ReadIntArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(int.Parse).ToArray();
        internal static long[] ReadLongArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(long.Parse).ToArray();
        internal static double[] ReadDoubleArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(double.Parse).ToArray();
        internal static string[] ReadStringArray(this TextReader reader, char separator = ' ') => reader.ReadLine().Split(separator);
    }
}

#endregion

Measured memory_bytes: 13396
from collections import deque
def solve():
    max_cost = 0
    stack = deque()
    used = [[False for _ in range(W)] for _ in range(H)]
    for i in range(H):
        for j in range(W):
            if A[i][j] == '.':
                continue
            stack.append([(i, j), 0])
            used[i][j] = True
    while stack:
        (i, j), cost = stack.popleft()
        max_cost = max(max_cost, cost)
        for x, y in [(i + 1, j), (i - 1, j), (i, j + 1), (i, j - 1)]:
            if not 0 <= x < H or not 0 <= y < W or used[x][y]:
                continue
            stack.append([(x, y), cost + 1])
            used[x][y] = True
    print(max_cost)

if __name__ == "__main__":
    H, W = map(int, input().split())
    A = []
    for _ in range(H):
        A.append(list(input()))
    solve()

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

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

    if(a + b >= 10)
    {
        cout << "error" << endl;
    }
    else
    {
        cout << a+b << endl;
    }
    
    return 0;
}

Measured memory_bytes: 256
// coded by zeffy
#pragma GCC optimize("O3","unroll-loops","omit-frame-pointer","inline") //Optimization flags
#pragma GCC option("arch=native","tune=native","no-zeroupper") //Enable AVX
#pragma GCC target("avx","popcnt")  //Enable AVX
#include <x86intrin.h> //SSE Extensions
#include <bits/stdc++.h> 
using namespace std;
#define eb emplace_back
#define mp make_pair
#define hello cout<<"hello"<<"\n"
#define forr(i,a,b) for(int i=a;i<b;i++)
#define it(s)	for(auto itr:s)
#define dvg(s) 	for(auto itr:s)	cout<<itr<<" ";cout<<endl;
#define dbg(s)	cout<<#s<<"= "<<s<<endl;
typedef long long int lli;
typedef unsigned long long int ulli;
const lli INF=(lli)1e17+5;
const lli MOD=1e9+7;

int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    std::cout<< std::fixed;
    std::cout.precision(10);
	
	lli x;cin>>x;
	if(x==0) cout<<"1\n";
	else 	cout<<"0\n";
	
    return 0;
    
    
}


Measured memory_bytes: 3632
#if 0
????????£????????????25m
????????¨????§???????????????¨????????¨???????????¨???????§£?????????
?°???????????§£????????£???????????????????????????
#endif

#include <iostream>
using namespace std;

int main() {
	int N,W;
	cin>>N>>W;
	int v[1000+10];
	int w[10000+10];

	for(int i=1;i<N+1;i++)
		cin>>v[i]>>w[i];
		
		int ans[N+10][W+10];
		for (int i=0;i<N+1;++i) { 
			for (int j=0;j<W+1;++j) { //j????????????????????¶?????¨?????£?????????
				if (i==0||j==0)
					ans[i][j]=0; //??????????????????
				else if(j-w[i]<0) //????????¶???????¶??????????????????????????????°??????
					ans[i][j]=ans[i-1][j];  
				else
					ans[i][j]=max(v[i]+ans[i-1][j-w[i]],ans[i-1][j]);
		}
	}
	cout<< ans[N][W]<< endl;
}

Measured memory_bytes: 7016
function Main(input) {
    input = input.split(' ');
    a = (input[0]);
    b = (input[1]);
    tunageru = a+b;
    tunageta = parseInt(tunageru);
    if (Math.sqrt(tunageta) % 1 === 0) {
        console.log('Yes');
    } else {
        console.log('No');
    }
}
 Main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 7372
a, b, c, x, y = map(int, input().split())
center = (a + b) / 2
res = 0
if center >= c:
    buy = min(x, y)
    res += buy * 2 * c
    x -= buy
    y -= buy
if x > 0 and a >= c * 2:
    res += x * 2 * c
    x = 0
if y > 0 and b >= c * 2:
    res += y * 2 * c
    y = 0
res += a * x
res += b * y
print(res)


Measured memory_bytes: 3064
#include<stdio.h>

int main(){
  int a, b, i, j;
  
  scanf("%d",&a);
  
  for(i=1;i<10;i++){
    for(j=1;j<10;j++){
      b = i * j;
      if(a==b){
        printf("Yes");
        return 0;
      }
    }
  }
  
  printf("No");
  
  return 0;
}
    

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

int solve_lsb(ll a, ll b) {
  // a<b
  if((b-a+1)%2==0) {
    ll c=(b-a-1)/2;
    if(b%2==1)
      c++;
    if(a%2==1)
      c++;
    return c%2;
  }
  ll c=(b-a)/2;
  return (c+b%2)%2;
}

ll f(ll a, ll b) {
  if(a==b)
    return a;
  ll ret=solve_lsb(a,b);
  for(ll i=1; i<50; i++) {
    ll base=1LL<<i;
    ll c=0;
    if((b-a+1<base)&&((base&b)==(base&a))) {
      c+=(b-a+1)*((base&a)!=0);
      if(c%2==1)
        ret+=base;
      continue;
    }
    c+=(base-(a%base))*((base&a) !=0);
    // cout << "i="<<i<<endl;
    // cout << "((base&a) !=0) = " << ((base&a) !=0) << endl;
    // cout << "((base&b) !=0) = " << ((base&b) !=0) << endl;
    // cout << "(base-(a%basse))=" << (base-(a%base)) << endl;
    // cout << "b%base="<<b%base<<endl;
    c+=(b%base+1)*((base&b) !=0);
    // if((base&b)==(base&a)) {
    //   c+=base;
    // }
    if(c%2==1) {
      // cout << "c="<<c<<endl;
      // cout << "base="<<base<<endl;
      ret+=base;
      // cout << "ret="<<ret<<endl;
    }
  }
  return ret;
}

ll g(ll n) { // returns f(0,n)
  if(n%2==1) {
    return ((n+1)/2)%2;
  } else {
    return n^ ((n/2)%2);
  }
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<setprecision(std::numeric_limits<float>::max_digits10);
  cout<<fixed;
  ll a,b;
  cin>>a>>b;
//  cout << f(a,b) << endl;
  if(a==0) {
    cout << g(b) << endl;
  } else {
    cout << (f(0,a-1)^f(0,b)) << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<vector>
#include<queue>
#include<stack>
#include<cmath>
using namespace std;
int a[4];
int main(){
	cin>>a[0]>>a[1]>>a[2];
	sort(a,a+3);
	cout<<a[2]-a[0];
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
 
#define ff first
#define ss second

const long long MOD = 1000000007;
int main() {
	ios::sync_with_stdio(0);
	int N, M;
	cin >> N >> M;

	long long dptable[N][M];
	string grid[N];
	for (int i = 0; i < N; i++) {
		cin >> grid[i];
	}

	memset(dptable, 0, sizeof(dptable));
	
	if (grid[1][0] == '.') {
		dptable[1][0] = 1;
	}

	if (grid[0][1] == '.') {
		dptable[0][1] = 1;
	}


	for (int i = 2; i < N; i++) {
		if (grid[i][0] == '#') {
			dptable[i][0] = 0;
		}
		else {
			dptable[i][0] = dptable[i - 1][0];
		}
	}

	for (int i = 2; i < M; i++) {
		if (grid[0][i] == '#') {
			dptable[0][i] = 0;
		}
		else {
			dptable[0][i] = dptable[0][i - 1];
		}
	}
	for (int i = 1; i < N; i++) {
		for (int j = 1; j < M; j++) {
			if (grid[i][j] == '#') {
				dptable[i][j] = 0;
			}
			else {
				dptable[i][j] = ((dptable[i - 1][j] % MOD) + (dptable[i][j - 1] % MOD)) % MOD;
			}
		}
	}
	cout << dptable[N - 1][M - 1] << endl;


	
	return 0;
}

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

using namespace std;

using ll = long long;
using ld = long double;

using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vs = vector<string>;
using vld = vector<ld>;
using vvld = vector<vld>;

typedef pair<ll, ll> P;

#define bit(n) (1LL << (n))

//#define int long long

#define all(v) v.begin(), v.end()

#define rep(i, n) for (ll i = 0; i < n; i++)
#define REP(i, n) for (ll i = 1; i < n; i++)

#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define FORm(i, m) for (auto i = m.begin(); i != m.end(); i++)

template <class T>
inline void chmax(T& a, T b) {
  a = std::max(a, b);
}
template <class T>
inline void chmin(T& a, T b) {
  a = std::min(a, b);
}

#define mod (ll)(1e9 + 7)
const long long INF = 1LL << 60;

ll safeMul(ll a, ll b, bool& overflow) {
  overflow = false;
  if (b > 0 ? a > INT64_MAX / b || a < INT64_MIN / b
            : (b < -1 ? a > INT64_MIN / b || a < INT64_MAX / b : b == -1 && a == INT64_MIN)) {
    overflow = true;
    return INT64_MAX;
  }
  return a * b;
}

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

  ll n;
  cin >> n;
  bool zero = false;
  vll a(n);
  rep(i, n) {
    cin >> a[i];
    if (a[i] == 0) {
      zero = true;
    }
  }

  if (zero) {
    cout << 0 << endl;
    return 0;
  }

  ll ans = 1;
  rep(i, n) {
    ll cnt = 0;
    ll tmp = ans;

    bool of;
    ans = safeMul(ans, a[i], of);

    if (of || ans > (long long)(1e18)) {
      cout << -1 << endl;
      return 0;
    }
  }

  cout << ans << endl;

  return 0;
}


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

using namespace std;

template <typename T> T gcd(T x, T y) {
  if (y == 0)
    return x;
  return gcd(y, x % y);
}

template <typename T> T lcm(T x, T y) {
  if (x == 0 || y == 0)
    return 0;
  return x / gcd(x, y) * y;
}

int main() {
  const string abc = "abc";
  string S;
  cin >> S;
  sort(S.begin(), S.end());
  cout << (S == abc ? "Yes" : "No") << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main{
 
    public static void main(String[] args) {
        Scanner scan=new Scanner(System.in);
        int n=scan.nextInt();
        int i=1;
        int x;
        while(true){
            x=i;
            if(x%3==0){
                System.out.print(" "+i);
            }else{
                while(true){
                    if(x%10==3){
                        System.out.print(" "+i);
                        break;
                    }
                    x/=10;
                    if(x!=0){
                        continue;
                    }else{
                        break;
                    }
                }
            }
             
            if(++i<=n){
 
            }else{
                System.out.println();
                break;
            }
        }
        scan.close();
    }
}

Measured memory_bytes: 24508
n = int(input())

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    return divisors

cnt = len(make_divisors(n-1))-1
base = make_divisors(n)
for x in base[1:]:
    org = n
    while org % x == 0:
        org = org / x
    if org % x == 1:
        cnt += 1

print(cnt)

Measured memory_bytes: 3188
/*
	Auther:_Destiny
	time:2020.5.3
*/
#include <bits/stdc++.h>
#define ll long long
#define N 100010
#define M 1010

using namespace std;

int k,l,r;

int read() {
	int s = 0, f = 0; char ch = getchar();
	while (!isdigit(ch)) f |= (ch == '-'), ch = getchar();
	while (isdigit(ch)) s = s * 10 + (ch ^ 48), ch = getchar();
	return f ? -s : s;
}

signed main() {
	k = read();
	l = read();
	r = read();
	for (int i = l ;i <= r; i++) 
		if (i % k == 0) {
			cout << "OK\n";
			return 0;
		}
	cout << "NG\n";
}



Measured memory_bytes: 3588
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;

int main()
{
    int n;
    cin >> n;
    vector<P> v(n);
    for(int i = 0;i<n;i++){

        int x;
        cin >> x;
        v[i] = P(x,i+1);
    }
    sort(v.begin(),v.end());
    for(auto i:v){
        cout << i.second << ' ';
    }
    cout << endl;
}

Measured memory_bytes: 1664
n = list(map(int, input()))

even_list = list()
odd_list = list()

even_list = n[0::2]
odd_list = n[1::2]

count_zero = 0
count_one = 0

#print(len(even_list))
for i in range(len(even_list)):
    if even_list[i] == 1:
        count_zero += 1
for j in range(len(odd_list)):
    if odd_list[j] == 0:
        count_zero += 1

for n in range(len(even_list)):
    if even_list[n] == 0:
        count_one += 1
for m in range(len(odd_list)):
    if odd_list[m] == 1:
        count_one += 1

print(min(count_zero, count_one))


Measured memory_bytes: 4640
#include <iostream>
#include <cmath>
using namespace std;
int main(){
    int n;
    cin >> n;
    int a[n];
    int ans = 0;
    for(int i=0;i<n;i++){
        cin >> a[i];
    }

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

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

using namespace std;
using ll = long long;
using ull = unsigned long long;

#ifndef __MACRO_H__
#define __MACRO_H__

#define all(collection) (collection).begin(), (collection).end()  // begin to end
#define rep(i, begin, end) for (ll i = begin; i < end; i++)       // repeat
#define repr(i, begin, end) for (ll i = begin; end < i; i--)      // repeat reverse
#define size(collection) ((ll) (collection).size())               // collection size

#endif



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

	ll ans = 1;
	ll sum = a;
	if (b == 1)
	{
		cout << 0;
		return 0;
	}
	while (sum < b)
	{
		sum += (a - 1);
		ans++;
	}

	cout << ans;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>

int main() {
  int i ,n , a[100],j,min,k=0,ire,t,ff;
  scanf("%d",&n);
  if(n<1 || 100< n) exit(0);

  for(i=0;i<n;i++) {
    scanf("%d",&a[i]);
  }

  for(i=0;i<n;i++) {
    min = i;
    ff=0;
    for(j=i;j<n;j++) {

      if(a[j]<a[min]) {
	min=j;
	ff=1;
    }
    }
      if(ff==1) {
      ire=a[i];
      a[i]=a[min];
      a[min]=ire;
      k++;
      }
  }

  for(i=0;i<n;i++) {
    printf("%d",a[i]);
    if(i!=n-1) printf(" ");
  }
  printf("\n%d\n",k);
  return 0;
}
     
      



Measured memory_bytes: 2124