akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using i64 = long long;
using std::cout;
using std::endl;
using std::cin;

int main() {
	int n, a, b; scanf("%d%d%d", &n, &a, &b);
	
	printf("%d\n", std::min(a * n, b));
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,k,n) for(int i=(k);i<(int)(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(x) begin(x),end(x)

using namespace std;
using ll = int64_t;

int search(const vector<vector<int>>& g, int i, int j) {
  if (g[j].size() > 2) return j;
  for (int k : g[j]) {
    if (k != i) return search(g, j, k);
  }
  return -1;
}

int main() {
  int n,m;
  cin>>n>>m;
  vector<vector<int>> g(n);
  REP(i,m) {
    int a,b;
    cin>>a>>b;
    --a;--b;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  bool ok = true;
  int k = 0;
  vector<int> idx(n, -1);
  REP(i,n) {
    if (g[i].size() % 2) ok = false;
    if (g[i].size() >= 4) {
      idx[i] = k;
      ++k;
    }
  }
  if (!ok) {
    cout << "No" << endl;
    return 0;
  }
  int cnt = 0;
  vector<vector<int>> h(k);
  ok = false;
  REP(i,n) {
    if (g[i].size() < 4) continue;
    if (g[i].size() >= 6) ok = true;
    for (int j : g[i]) {
      int nx = search(g, i, j);
      if (nx == i) {
        ++cnt;
      } else {
        h[idx[i]].push_back(idx[nx]);
      }
    }
  }
  if (cnt >= 6 || ok) {
    cout << "Yes" << endl;
    return 0;
  } else if (cnt >= 4) {
    if (k >= 2) {
      cout << "Yes" << endl;
      return 0;
    }
  } else if (cnt >= 2) {
    if (k >= 2) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  if (k >= 3) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 6144
import java.io.*; 
import java.util.*; 

public class Main{ 
	
	static class FastReader{ 
		BufferedReader br; 
		StringTokenizer st; 

		public FastReader() 
		{ 
			br = new BufferedReader(new
					InputStreamReader(System.in)); 
		} 

		String next() 
		{ 
			while (st == null || !st.hasMoreElements()) 
			{ 
				try
				{ 
					st = new StringTokenizer(br.readLine()); 
				} 
				catch (IOException e) 
				{ 
					e.printStackTrace(); 
				} 
			} 
			return st.nextToken(); 
		} 

		int nextInt() 
		{ 
			return Integer.parseInt(next()); 
		} 

		long nextLong() 
		{ 
			return Long.parseLong(next()); 
		} 

		double nextDouble() 
		{ 
			return Double.parseDouble(next()); 
		} 

		String nextLine() 
		{ 
			String str = ""; 
			try
			{ 
				str = br.readLine(); 
			} 
			catch (IOException e) 
			{ 
				e.printStackTrace(); 
			} 
			return str; 
		} 
	}

	public static void main(String[] args) 
	{ 
        FastReader sc = new FastReader(); 
        PrintWriter out = new PrintWriter(System.out); 

        long max = -1L;
		int n = sc.nextInt();
        long[] arr = new long[n], dp = new long[n];
        Arrays.fill(dp, max);

        dp[0] = 0L;
        for(int i=0;i<n;i++){
            arr[i] = sc.nextLong();
            if(i>0)
            	dp[i] = dp[i-1]+Math.abs(arr[i]-arr[i-1]);
            if(i>1)
            	dp[i] = Math.min(dp[i-2]+Math.abs(arr[i]-arr[i-2]), dp[i]);
        }

        out.println(dp[n-1]);
        out.close();
	} 
} 


Measured memory_bytes: 31516
#include<stdio.h>
#include<string.h>
main(){
  char str[21],tmp;
  int n,i,j,k;
  scanf("%s",str);
  n=strlen(str);
  for(i=0;i<n;i++){
    for(j=n-1;j>i;j--){
      tmp=str[j];
      str[j]=str[j-1];
      str[j-1]=tmp;
    }
  }
  printf("%s\n",str);
  return 0;
}
 

Measured memory_bytes: 524
import java.util.*;
import java.util.Map.Entry;
 
class Main {
	 static int mod =  (int) (Math.pow(10,9)+7);
   	 static List<ArrayList<Integer>> list= new ArrayList<ArrayList<Integer>>();
   	 static int a_dist[];
//	 static int mod = 998244353;
	 public static void main(String[] args) {
	        Scanner sc = new Scanner(System.in);
	        int N = sc.nextInt();
	        int K = sc.nextInt();
	        long[] mp= new long[K+5];
	        
	        long ans=0;

	        
	        mp[0]=1;
	        for(int i=2;i<=K;i++) {
	        	mp[i-1]=i;
	        	for(int j=1;(double)j<=Math.pow(i, 0.5);j++) {
	        		if(i%j==0) {
	        			mp[i-1]=mp[i-1]-mp[j-1];
	        			if(i/j>j&&i/j<i) {
	        				mp[i-1]=mp[i-1]-mp[i/j-1];
	        			}
	        		}
	        	}
	        }
	        for(int i=1;i<=K;i++) {
	        	long tmp=K/i;
	        	ans = (ans + (mp[i-1]*pow(tmp,N)%mod)%mod)%mod;
	        }
	    	System.out.println(ans);
	        
	        	        	        
	 }
		public static long pow(long a,long n) {
		    long res=1;
		    while (n>0) {
		        if ((n-n/2*2)==1) {
		            res=(res*a)%mod;
		        }
		        a=(a*a)%mod;
		        n>>=1;
		    }
		    return res;
		}
}


Measured memory_bytes: 36692
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll inf=1e17;
int n,cnt[10],p[10];ll w;;
struct product{ll v,p;}pro[110],qian[10][110];
inline bool cmp(product a,product b){return a.v!=b.v?a.v<b.v:a.p>b.p;}
int main()
{
//FUCK!!!
int i,j;ll xiao=inf;
scanf("%d%lld",&n,&w);
for (i=1;i<=n;i++) scanf("%lld%lld",&pro[i].v,&pro[i].p),xiao=min(xiao,pro[i].v);
sort(pro+1,pro+n+1,cmp);
for (i=1;i<=n;i++) qian[pro[i].v-xiao][++p[pro[i].v-xiao]]=pro[i];
for (i=0;i<4;i++) for (j=1;j<=p[i];j++) qian[i][j].p+=qian[i][j-1].p;
ll a,b,c,d,da=0;
for (a=0;a<=p[0];a++)
for (b=0;b<=p[1];b++)
for (c=0;c<=p[2];c++)
for (d=0;d<=p[3];d++) 
if (a*xiao+b*(xiao+1)+c*(xiao+2)+d*(xiao+3)<=w) da=max(da,qian[0][a].p+qian[1][b].p+qian[2][c].p+qian[3][d].p);
printf("%lld",da); 
}

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

#define REP(i, s, n) for (int i = s; i < n; i++)
#define rep(i, n) REP(i, 0, n)

using namespace std;

// info
int board[8][8];
int res[8];

void fillBoard(int row, int col, int cnt);
void printBoard();
void recur(int row);
int main()
{
    fill(res, res+8, -1);
    // rep(i, 8){
    //     fill(board[i], board[i]+8, 0);
    // }

    int n; cin >> n;
    rep(i, n){
        int row, col;
        cin >> row >> col;
        fillBoard(row, col, 1);
        res[row] = col;
    }

    // printBoard();
    // rep(i, 8)
    // {
    //     rep(j, 8)
    //     {
    //         cout << board[i][j]
    //              << (j < 7 ? " " : "\n");
    //     }
    // }
    recur(0);
    return 0;
}

void fillBoard(int row, int col, int cnt)
{
    board[row][col] += cnt;

    rep(i, 8)
    {
        if (i != col)
        {
            board[row][i] += cnt;

            int j1 = row - col + i;
            if (j1 >= 0 && j1 < 8)
                board[j1][i] += cnt;

            int j2 = col + row - i;
            if (j2 >= 0 && j2 < 8) // here!!
                board[j2][i] += cnt;
        }

        if (i != row)
            board[i][col] += cnt;
    }
}
void printBoard()
{
    rep(i, 8)
    {
        rep(j, 8)
        {
            cout << (res[i] == j?"Q":".") 
             << (j < 7 ? "" : "\n");
        }
    }
}
void recur(int row)
{
    if (row == 8)
    {
        printBoard();
        return;
    }

    if (res[row] < 0)
    {
        // int flag = -1;
        rep(col, 8)
        {
            if (board[row][col] == 0)
            {
                // flag++;

                fillBoard(row, col, 1);
                res[row] = col;
                recur(row + 1);
                res[row] = -1;
                fillBoard(row, col, -1);
            }
        }
        // if(flag < 0) return;
    }
    else
        recur(row + 1);
}


Measured memory_bytes: 3084
#define __USE_MINGW_ANSI_STDIO 0
#include <iostream>
#include <iomanip>
#include <stdio.h>
#include <stdlib.h>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <stack>
#include <deque>
#include <string.h>
#include <math.h>

using namespace std;

#define PI 4.0*atan(1.0)
#define epsilon 0.000000001
#define INF 1000000000000000000
#define MOD 1000000007

int N, M, color [100010];
vector<int> adjacency [100010];
queue<int> q;
long long black = 0ll, white = 0ll;

int main(){
    //freopen("roboherd.in", "r", stdin); freopen("roboherd.out", "w", stdout);
    ios_base::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(18);
    cin >> N >> M; memset(color, -1, sizeof(color));
    color[1] = 0; white++; q.push(1);
    for(int i = 0; i < M; i++){
        int a, b; cin >> a >> b;
        adjacency[a].push_back(b); adjacency[b].push_back(a);
    }
    while(q.size() > 0){
        int now = q.front(); q.pop();
        for(int i : adjacency[now]){
            if(color[i] == color[now]){
                cout << (long long)N*(long long)(N-1ll)/2ll-(long long)M << '\n';
                return 0;
            }
            if(color[i] == -1){
                q.push(i);
                if(color[now] == 1){ color[i] = 0; white++; }
                else{ color[i] = 1; black++; }
            }
        }
    }
    cout << black*white-(long long)M << '\n';
    return 0;
}


Measured memory_bytes: 6272
#include<bits/stdc++.h>
#include<tr1/unordered_map>
#define CLR(a,x) memset(a,x,sizeof(a))
#define MP make_pair
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int,int> pa;
const int maxn=1e5+10,P=1e9+7;

inline ll rd(){
    ll x=0;char c=getchar();int neg=1;
    while(c<'0'||c>'9'){if(c=='-') neg=-1;c=getchar();}
    while(c>='0'&&c<='9') x=x*10+c-'0',c=getchar();
    return x*neg;
}

int N,a[maxn];

int main(){
    //freopen("","r",stdin);
	N=rd();
	for(int i=1;i<=N;i++) a[rd()]++;
	int ans=1;
	if(N&1){
		for(int i=2;i<=N-1;i+=2) if(a[i]!=2) ans=0;
		if(a[0]!=1) ans=0;
	}else{
		for(int i=1;i<=N-1;i+=2) if(a[i]!=2) ans=0;
	}
	for(int i=1;i<=N/2;i++) ans=ans*2%P;
	printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
typedef long long int ll;
const int N = 1e5 + 5;
//const int INF = 1e9 + 5;
//int a[N];
void solve_test_case(){
	int n;//a,b,c;
	cin>>n;
	vector<int> dp(3);
	for(int it = 0;it < n;++it){
		vector<int> dp1(3,0);
		vector<int> cost(3);
		for(int i = 0;i < 3;++i){
			cin>>cost[i];
		}
		for(int i = 0;i < 3;++i){
			for(int j = 0;j < 3;++j){
				if(i != j){
					dp1[j] = max(dp1[j], dp[i] + cost[j]);
				}
			}
		}
		dp = dp1;
	}
	cout<<max({dp[0],dp[1],dp[2]})<<"\n";
}
 
signed main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int t = 1;
	//cin>>t;
	for(int i = 0;i < t;++i){
		solve_test_case();
	}
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define MOD 1000000007
#define MAX 200010
using namespace std;

long long dp[MAX], n, lft[MAX], lst[MAX], x;
vector<long long>v;

int main() {
    cin >> n;

    v.push_back(0);
    for(int i = 1; i <= n; ++i) {
        cin >> x;
        v.push_back(x);
        lft[i] = lst[x];
        lst[x] = i;
    }

    long long ans = 0;

    dp[0] = 1;
    for(int i = 1; i <= n; ++i) {
        if(lft[i] == 0 or v[i-1] == v[i])
            dp[i] = dp[i-1];
        else
            dp[i] = (dp[i-1] + dp[lft[i]])%MOD;// cerr << lft[i] << ", " << dp[lft[i]] << endl;
        //cerr << i << " :: " << dp[i] << endl;
    }

    cout << dp[n] << endl;
    return 0;
}

Measured memory_bytes: 6640
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define ll          long long
#define pb          push_back
#define eb 			emplace_back
#define mp 			make_pair
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define vii         vector<pii>
#define mi          map<ll,ll>
#define mii         map<pii,ll>
#define all(a)      (a).begin(),(a).end()
#define fi          first
#define si          second
#define sz(x)       (ll)x.size()
#define endl        '\n'
#define checkbit(n, b) ((n >> b) & 1)
#define mod        1000000007
#define inf        1000000000000000000
#define puts(n)		cout<<n;
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define setbits(x) __builtin_popcount(x)
#define mset(m,v) memset(m,v,sizeof(m))
using namespace std;
string s;
ll n;
ll dp[200005][2];
ll solve(ll i,ll last){
	if(i==n) return 0;
	if(dp[i][last]!=-1) return dp[i][last];
	ll ans=0;
	if(i==0){
		if(s[i]=='D') ans = max(ans, solve(i+1,0)+1);
		else if(s[i]=='P') ans = max(ans,solve(i+1,1));
		else {
			ll v1,v2;
			v1  = solve(i+1,0)+1;
			v2 = solve(i+1,1);
			if(v1>ans) {
				ans=v1;
				s[i]='D';
			}
			if(v2>ans){
				ans = v2;
				s[i]='P';
			}
		}
	}
	else {
		if(s[i]=='D') ans = max(ans, solve(i+1,0)+1+(last==1));
		else if(s[i]=='P') ans = max(ans , solve(i+1,1));
		else {
			ll v1,v2;
			v1 = solve(i+1,0)+1+(last==1);
			v2 = solve(i+1,1);
			if(v1>ans){
				ans = v1;
				s[i]='D';
			}
			if(v2>ans){
				ans = v2;
				s[i]='P';
			}
		}
	}
	dp[i][last]= ans;
	return ans;
}
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cin>>s;
	n = s.size();
	for(ll i=0;i<n;i++){
		dp[i][0]=dp[i][1]=-1;
	}
	ll ans=solve(0,0);
	//cout<<ans<<"\n";
	cout<<s;
	
	return 0;
}

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

int N,M,r,q;
int t,m,n,s,ts,te;
int main(void){
    while(true){
        cin>>N>>M;
        if(N==0&&M==0)break;
        cin>>r;
        vector<vector<int>> time(M+1,vector<int>(730,0));
        vector<vector<int>> eq(M+1,vector<int>(730,0));
        for(int i=0;i<r;i++){
            cin>>t>>n>>m>>s;
            t-=540;
            if(s==1) time[m][t+1]++;
            else time[m][t+1]--;
        }
        for(int i=1;i<=M;i++){
            for(int k=1;k<730;k++){
                time[i][k]+=time[i][k-1];
                eq[i][k]=eq[i][k-1]+(time[i][k]>0 ? 1 : 0);
            }
        }
        cin>>q;
        for(int i=0;i<q;i++){
            cin>>ts>>te>>m;
            ts-=540;te-=540;
            cout<<eq[m][te]-eq[m][ts]<<endl;
        }

    }
    return 0;
}



Measured memory_bytes: 58504
x = int(input())
a = []
def cont(y):
    n = 0
    while True:
          if n - int(y ** (1/2)) + 1 == 0:
               a.append(y)
               break
                
          for j in range(2,int(y ** (1/2)) + 1):
                 if y % j == 0:
                    y = y // j
                    a.append(j)
                    n = 0
                    break
                 else:
                    n = n + 1

ans = 1
for k in range(2, x + 1):
    cont(k)
for h in range(2, x + 1):
    ans = ans * (a.count(h) + 1)

print(ans % 1000000007)

Measured memory_bytes: 9356
#include <stdio.h>
int main(void){ 
 char num[1010];
  int a;
  while(1){
      scanf("%s", &num);
      if(num[0]=='0')
      break; 
     else{
        //   printf("%lld\n", num); 
     int sum = 0;
      for(int i=0;
 i<strlen(num);
 i++){
          sum+=num[i]-'0';
//i桁目の文字を数字に変換 
     } 
     printf("%d\n", sum);
      }  
}  
return 0; 
}


Measured memory_bytes: 2100
#include<bits/stdc++.h>
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define int long long int

using namespace std;
typedef pair<int, int> PII;
typedef pair<PII, int> PPI;
typedef pair<int, PII> PIP;
typedef pair<PII, PII> PPP;
typedef vector<PII> VP;
typedef VP::iterator VPI;
typedef vector<int> VI;
const int INF = 3e18;
const double PI = acos(-1);
const int MOD = 1e9 + 7;

int n, a[100010];

int nowmx = 0;
int ans = 0;

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

  for(int i = 0; i < n; i++){
    if(i == 0){
      ans += a[i] - 1;
      nowmx = 1;
    }
    else{
      if(a[i] > nowmx + 1){
	ans += (a[i] - 1) / (nowmx + 1);
      }
      else if(a[i] == nowmx + 1){
	nowmx += 1;
      }
    }
  }

  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1024
M[100],i,j,h,s;char*N[100],B[9];main(n,m){for(;scanf("%d%d",&n,&m)*n;printf("%d\n",s)){for(i=n;i--;)scanf("%as%d",N+i,M+i);for(s=0;m--;)for(scanf("%s",B),i=n;i--;s+=M[i]*!h)for(h=j=0;j<8;j++)h|=N[i][j]-42&&N[i][j]-B[j];}}

Measured memory_bytes: 0
#include <iostream>
#include <vector>
#include <math.h>
using namespace std;
using ll = long long;

int main() {
  int n; cin >> n;
  vector<int> h(n);
  for (int i = 0; i < n; i++) {
    cin >> h[i];
  }
  vector<int> dp(n); dp[n-1] = 0;
  dp[n-2] = abs(h[n-1] - h[n-2]);
  for (int i = n-3; i >= 0; i--) {
    dp[i] = min(abs(h[i+1]-h[i])+dp[i+1], abs(h[i+2]-h[i])+dp[i+2]);
  }
  cout << dp[0];
}

Measured memory_bytes: 1024
use proconio::*;
use proconio::marker::*;
use std::cmp::*;

#[fastout]
fn run() {
    input! {
        n: usize,
        q: usize,
        c: [Usize1; n],
        ask: [(Usize1, usize); q],
    }
    let batch = 1024;
    let mut query = vec![vec![]; n / batch + 1];
    for (i, (l, r)) in ask.into_iter().enumerate() {
        query[l / batch].push((r, l, i));
    }
    let mut cnt = vec![0; n];
    let mut ans = vec![0; q];
    let mut sum = 0;
    let mut x = 0;
    let mut y = 0;
    for (i, mut query) in query.into_iter().enumerate() {
        query.sort_unstable_by_key(|p| p.0);
        if i & 1 == 1 {
            query.reverse();
        }
        for (r, l, k) in query {
            for c in c[min(l, x)..x].iter().rev() {
                let c = &mut cnt[*c];
                if *c == 0 {
                    sum += 1;
                }
                *c += 1;
                x = l;
            }
            for c in c[min(r, y)..r].iter() {
                let c = &mut cnt[*c];
                if *c == 0 {
                    sum += 1;
                }
                *c += 1;
                y = r;
            }
            for c in c[min(r, y)..y].iter().rev() {
                let c = &mut cnt[*c];
                if *c == 1 {
                    sum -= 1;
                }
                *c -= 1;
                y = r;
            }
            for c in c[min(l, x)..l].iter() {
                let c = &mut cnt[*c];
                if *c == 1 {
                    sum -= 1;
                }
                *c -= 1;
                x = l;
            }
            ans[k] = sum;
        }
    }
    for a in ans {
        println!("{}", a);
    }
}

fn main() {
    run();
}


Measured memory_bytes: 40044
#pragma GCC optimize("Ofast")
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define PI 3.141592
#define MOD7 1000000007
#define LL_INF 9000000000000000000
#define LL_MINF -9000000000000000000
#define INT_INF 2000000000
#define INT_MINF -2000000000
#define all(a) (a).begin(), (a).end()
#define fi first
#define se second
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

int main(){
    ll N;
    cin >> N;
    int n = pow(N, 0.5);
    ll min_n = LL_INF;
    for(int a = 1; a <= n; a++){
        if(N % a == 0) min_n = min(min_n, a + (ll)N / a - 2);
    }
    cout << min_n << endl;
}

Measured memory_bytes: 3660
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, d, x;		cin >> n >> d >> x;
  vector<int>a(n);
  for(int i=0; i<n; i++) cin >> a[i];
  int ans=0;
  for(int i=0; i<n; i++){
    if(d%a[i]==0)  ans += d/a[i];
    else ans += d/a[i]+1;
  }
  ans += x;
  cout << ans << endl;
}



Measured memory_bytes: 256
#include<stdio.h>

int n, p;
int a1[40], a2[40];

void solve(int l,int r){

  if(l>r) return;

  if(l==r){
    if(a2[l]==a1[0])printf("%d", a2[l]);
    else printf("%d ", a2[l]);
    p++;
    return;
  }

  int x=a1[p], i;
  p++;

  for(i=l; i<=r; i++)
    if(a2[i]==x) break;

  solve(l,i-1);
  solve(i+1,r);

  if(x==a1[0]) printf("%d",x);
  else printf("%d ",x);
}

int main(){

  int i;

  scanf("%d",&n);

  for(i=0; i<n; i++) scanf("%d",&a1[i]);
  for(i=0; i<n; i++) scanf("%d",&a2[i]);
  p=0;
  solve(0, n-1);
  printf("\n");

  return 0;
}

Measured memory_bytes: 2732
#include <bits/stdc++.h>
using namespace std;
int main() {
    int N;
    cin >> N;
    vector<int>d(N);
    for(int i = 0; i < N; i++) {
        cin >> d[i];
    }
    int res = 0;
    for(int i = 0; i < N; i++) {
        for(int j = i+1; j < N; j++) {
            res+=d[i]*d[j];
        }
    }
    cout << res << endl;
}


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

int main(void) {
	int N, K;
	int b;
	uint64_t answer = 0;
	if (scanf("%d%d", &N, &K) != 2) return 1;
	for (b = K + 1; b <= N; b++) {
		int kazu = N + 1;
		int blockCount = (kazu + b - 1) / b;
		int saigo = N % b;
		/* uint64_t bak = answer; */
		answer += blockCount * (b - K);
		if (saigo >= K) answer -= b - (saigo + 1); else answer -= b - K;
		if (K == 0) answer--;
		/* printf("debug %d %d\n", b, (int)(answer - bak)); */
	}
	printf("%" SCNu64 "\n", answer);
	return 0;
}


Measured memory_bytes: 128
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication21
{
	class Program
	{
		static void Main(string[] args)
		{
			var n = int.Parse(Console.ReadLine());
			int[] L = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();
			List<int> list = new List<int>();
			list.AddRange(L);
			list.Sort();
			list.Reverse();
			int sum = 0;
			for (int i = 0; i < n; i++)
			{
				int a = list[0];
				list.RemoveAt(0);
				int b = list[0];
				list.RemoveAt(0);
				sum += Math.Min(a, b);
			}
			Console.WriteLine(sum);
		}
	}
}


Measured memory_bytes: 2904
#include<bits/stdc++.h>
#define pii pair<int,int>
#define fi first
#define se second
using namespace std;
 double x(int hour, int minutes) {
        double hourAngle = ((hour % 12) + minutes * 1.0/60) * 30;
        double minutesAngle = minutes * 6;
        double a = abs(hourAngle - minutesAngle);
        double b = 360 - a;
        return a < b ? a : b;
    } 
int main(){
    int a,b,h,m;
    cin>>a>>b>>h>>m;
    double z;
    z=x(h,m);
    z=z*3.1415926535897932384626433832795028841971/180;
    double k;
    k=sqrt((a*a)+(b*b)-(2*a*b*cos(z)));
    cout<<setprecision(10)<<k;
    return 0;
}
  

Measured memory_bytes: 4144
import java.util.Scanner;
import java.util.Formatter;
public class Main {
    public static void main(String[]args){
        Scanner sc = new Scanner(System.in);
        Formatter fm = new Formatter();
            String line = sc.nextLine();
            String answer = "";
            int length = line.length();
            for(int i=0;i<length;i++){
                char ch = line.charAt(i);
                char ch2;
                if(Character.isLowerCase(ch))ch2 = Character.toUpperCase(ch);
                else ch2 = Character.toLowerCase(ch);
                fm.format(answer+"%c",ch2);
            }
            System.out.println(fm);
        
    }
}



Measured memory_bytes: 29132
#include "bits/stdc++.h"
#define in std::cin
#define out std::cout
#define rep(i,N) for(LL i=0;i<N;++i)
typedef long long int LL;

const LL inf = 1000 * 1000 * 1000 + 114514;
int N, M, D[1123], C[1123];
int memo[1123][1123];

int dp(int p, int t)
{
	if (memo[p][t] != -1) { return memo[p][t]; }
	if (p == N)
	{
		if (t <= M) { return memo[p][t] = 0; }
		return memo[p][t] = inf;
	}
	if (t > M) { return memo[p][t] = inf; }
	return memo[p][t] = std::min(dp(p + 1, t + 1) + C[t] * D[p], dp(p, t + 1));
}

int main()
{
	memset(memo, -1, sizeof(memo));
	in >> N >> M;
	rep(i, N) { in >> D[i]; }
	rep(i, M) { in >> C[i]; }
	out << dp(0, 0) << std::endl;
	return 0;
}

Measured memory_bytes: 8080
from collections import Counter
from itertools import combinations
s = input()
sc = Counter(s)
if len(sc.keys()) == 1:
    if len(s) == 1:
        print('YES')
    else:
        print('NO')
elif len(sc.keys()) == 2:
    if len(s) == 2:
        print('YES')
    else:
        print('NO')
else:
    ans = 'YES'
    for i,j in combinations(sc.values(),2):
        if abs(i-j) > 1:
            ans = 'NO'
            break
    print(ans)

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

typedef long long ll;


int n, k;
vector<int> v(100010);

int main(){
    cin >> n >> k;
    v.resize(n);

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

    cout << (n-1 + k - 1 - 1)/(k-1) << endl;
    
}

Measured memory_bytes: 640
import math

n = int(input())
a = sorted([int(input()) for i in range(n)])
max_sqrt = int(math.sqrt(a[-1]))
screen = list(range(2, max_sqrt+1))
index = 0

while index < len(screen):
    screen = screen[:index+1] + list(filter(lambda x: x % screen[index] != 0, screen[index+1:]))
    index += 1

b = []
for i in range(len(a)):
    is_prime = True
    for j in range(len(screen)):
        if a[i] != screen[j] and a[i] % screen[j] == 0:
            is_prime = False
            break
    if is_prime:
        b.append(a[i])

print(len(b))



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

using namespace std;

typedef long long ll;
typedef long double ld;

const int INF = (int) 1e9 + 123;
const ll LINF = (ll) 1e18 + 123;
const ld EPS = (ld) 1e-12;
const ll MOD = (ll) 1e9 + 7;

#define sz(x) (int) (x).size()
#define mp(x, y) make_pair(x, y)
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define lb(s, t, x) (int) (lower_bound(s, t, x) - s)
#define ub(s, t, x) (int) (upper_bound(s, t, x) - s)
#define rep(i, f, t) for (auto i = f; i < t; i++)
#define per(i, f, t) for (auto i = f; i >= t; i--)

ll power(ll x, ll y, ll mod = MOD) {
    if (y == 0) {
        return 1;
    }
    if (y & 1) {
        return power(x, y - 1, mod) * x % mod;
    } else {
        ll tmp = power(x, y / 2, mod);
        return tmp * tmp % mod;
    }
}

void add(ll &x, ll y, ll mod = MOD) {
    x += y;
    if (x >= mod) x -= mod;
    if (x < 0) x += mod;
}

ll sum(ll x, ll y, ll mod = MOD) {
    add(x, y, mod);
    return x;
}

ll mult(ll x, ll y, ll mod = MOD) {
    return (x * y) % mod;
}

ll div(ll x, ll y, ll mod) {
    return x * power(y, mod - 2, mod);
}

template<typename A, typename B> bool mini(A &x, const B &y) {
    if (y < x) {
        x = y;
        return true;
    }
    return false;
}

template<typename A, typename B> bool maxi(A &x, const B &y) {
    if (y > x) {
        x = y;
        return true;
    }
    return false;
}

template<typename T> void read(T first, T last) {
    while (first != last) {
        cin >> *(first++);
    }
}

template<typename T> void print(T first, T last) {
    while (first != last) {
        cout << *(first++) << " ";
    }
    cout << "\n";
}

void run();

#define TASK ""

int main() {
#ifdef LOCAL
    if (strlen(TASK) > 0) {
        cerr << "Reminder: you are using file i/o, filename: " TASK "!" << endl << endl;
    }
#endif
#ifndef LOCAL
    if (strlen(TASK)) {
        freopen(TASK ".in", "r", stdin);
        freopen(TASK ".out", "w", stdout);
    }
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
#endif
    cout << fixed << setprecision(12);
    run();
    return 0;
}

// == SOLUTION == //

void run() {
    string s;
    cin >> s;
    int n = sz(s);
    set<char> q;
    rep(i, 0, n) q.insert(s[i]);
    if (sz(q) == 1) {
        cout << "0\n";
        return;
    }
    int ans = n;
    for (char c = 'a'; c <= 'z'; c++) {
        int left = 0;
        int right = n + 1;
        while (right - left > 1) {
            int mid = (left + right) / 2;
            int pos = INF;
            bool ok = 1;
            per(i, n - 1, 0) {
                if (s[i] == c) pos = i;
                if (i < n - mid && pos - i > mid) ok = 0;
            }
            if (ok) right = mid;
            else left = mid;
        }
        mini(ans, right);
    }
    cout << ans << "\n";
}


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

using namespace std;

template<typename T> void drop(const T &x){cout<<x<<'\n';exit(0);}

void milkshake() {
  int n, k;
  cin >> n >> k;
  int ans = 0;
  for(int i = 0; i < n; i++) {
    int x;
    cin >> x;
    ans += min(x-0, k-x)*2;
  }
  cout << ans << '\n';
}

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int tt=1;
  //cin >> tt;
  while(tt--) milkshake();

  return 0;
}


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

int	main(void)
{
  int time, price_p_hour, flat_rate;
  cin >> time >> price_p_hour >> flat_rate;
  if ((time * price_p_hour) > flat_rate)
    cout << flat_rate << endl;
  else if ((time * price_p_hour) == flat_rate)
    cout << flat_rate << endl;
  else
    cout << time * price_p_hour << endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<cstdlib>
#include<iomanip>
#include<queue>
#include<set>
#include <valarray>
#include<stack>
#include<sstream>
#include<math.h>
   
using namespace std;
    
void Solution()
{
    int r, c;
    int a[150][150] = {{0}};
    int sumC, sumR = 0;
    
    cin>>r>>c;
      
    for(int i = 0; i < r; i++)
    {
        for (int j = 0; j < c; j++)
        {
            cin>>a[i][j];
        }
    }
    
       for(int i = 0; i < r; i++)
    {
        for (int j = 0; j < c; j++)
        {
            sumC += a[i][j];
        }
         a[i][c] = sumC;
           sumC = 0;
    }
    
        for(int i = 0; i < c + 1; i++)
    {
        for (int j = 0; j < r; j++)
        {
            sumR += a[j][i];
        }
         a[r][i] = sumR;
            sumR = 0;
    }
    
    
    for(int i = 0; i < r + 1; i++)
    {
         for (int j = 0; j < c; j++)
        {
            cout<<a[i][j]<<" ";
        }
        cout<<a[i][c]<<endl;
    }
  
}
   
int main()
{
    Solution();
    return 0;
}

Measured memory_bytes: 1256
import java.lang.Math.*

fun main(args: Array<String>) {
    val (N) = readLine()!!.split(" ").map {it.toInt()}
    val a = Array(N){readLine()!!.split(" ").map{it.toInt()}}
    val dp = Array(N){Array(3){0} }
    for(i in 0 until 3) {
        dp[0][i] = a[0][i]
    }
        
    for(i in 1 until N) {
        for(k in 0 until 3)
        for(j in 0 until 3) {
            if(j==k)continue
            dp[i][k] = max(dp[i][k], dp[i-1][j] + a[i][k])
        }
    }
    println(dp[N-1].max())
}



Measured memory_bytes: 96924
#include<iostream>
#include<string>
#include<algorithm>	
#include<cmath>
#include<map>
#include<vector>
#include<math.h>
#include<stdio.h>
#define int long long
using namespace std;
int test[123456];
signed main() {
	//std::map<long long, long long>test;
	int n, k, a = 100000000000000, b = 0; string s; cin >> n;
	for (int h = 0; h < n; h++) {
		cin >> test[h];
	}
	sort(test, test + n);
	for (int h = 1; h < n; h++) {
		if (test[h - 1] != test[h]) {
			b++;
		}
	}
	cout << b + 1<< endl;
}


Measured memory_bytes: 3892
import itertools

N = int(input())
F = [list(map(int,input().split())) for i in range(N)]
P = [list(map(int,input().split())) for i in range(N)]

ans =int(-10e15)
for k in range(1,11):
  for j in itertools.combinations(range(10),k):
    tmp = 0
    for f,p in zip(F, P):
      num = sum([f[cnt] for cnt in j])
      tmp += p[num]
    ans = max(ans,tmp)
    
print(ans)

Measured memory_bytes: 3064
from heapq import heappush, heappop
N,Q,*L = map(int, open(0).read().split())
X = L[:3*N]
D = L[3*N:]
ls = []
for s,t,x in zip(*[iter(X)]*3):
  ls.append((s-x,1,x))
  ls.append((t-x,0,x))
for i,d in enumerate(D):
  ls.append((d,2,i))
ls.sort()
ans = [0]*Q
S = set()
hq = []
for a,b,c in ls:
  if b==0:
    S.remove(c)
  elif b==1:
    S.add(c)
    heappush(hq,c)
  else:
    while hq and hq[0] not in S:
      heappop(hq)
    ans[c] = hq[0] if hq else -1
print('\n'.join(map(str,ans)))

Measured memory_bytes: 137260
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1000000007;
const ll LINF=1LL<<60;
const int INF=1<<30;

int main(){
	ll n,k;cin>>n>>k;
	vector<ll> p(n);
	for(int i = 0; i < n; i++) {
		cin>>p[i];
	}
	vector<ll> sum(200000 + 1,0LL);
	ll s = 0;
	for(int i = 1; i <= 200000; i++) {
		s += i;
		sum[i] = s;
	}
	vector<double> q(n);
	for(int i = 0; i < n; i++) {
		double tmp = double(sum[p[i]]);
		q[i] = double(tmp)/ double(p[i]);
	}
	vector<double> ans(n + 1,0.0);
	for(int i = 0; i < n; i++) {
		ans[i + 1] = ans[i] + q[i];
	}
	double res = 0.0;
	for(int i = 0; i < n - k + 1; i++) {
		double w = ans[i + k] - ans[i];
		res = max(res,w);
	}
	cout << fixed <<setprecision(10) << res << endl;
	return 0;
}

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

using namespace std;

int main() {
	unordered_set<int> Hash;
	int s, m = 1;
	cin >> s;
	Hash.insert(s);
	while (s <= 1000000){
		if (s & 1)
			s = 3 * s + 1;
		else
			s >>= 1;
		if (Hash.find(s) != Hash.end()){
			cout << ++m;
			break;
		} else {
			Hash.insert(s);
			++m;	
		}
	}	
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define rep(i, n) for(int i=0;i<n;++i)
#define rrep(i, n) for(int i=n;i>=0;--i)
const int inf=1e9+7;
const ll mod=1e9+7;
const ll mod1=998244353;
const ll big=1e18;
const double PI=2*asin(1);

ll DP[200005][2];

int main() {
  for(int i=0;i<200005;++i) {
    for(int j=0;j<2;++j) {
      DP[i][j] = -big;
    }
  }
  int N;
  cin>>N;
  ll A[N];
  for(int i=0;i<N;++i) cin>>A[i];
  if(N==2) {
    cout<<max(A[0], A[1])<<endl;
    return 0;
  }
  DP[0][1] = A[0];
  DP[1][0] = A[1];
  DP[2][0] = A[2];
  DP[2][1] = DP[0][1]+A[2];
  for(int i=3;i<N;++i) {
    if(i%2==0) {
      DP[i][0] = max(DP[i-4][1], max(DP[i-3][0], DP[i-2][0]))+A[i];
      DP[i][1] = DP[i-2][1]+A[i];
    }
    else {
      DP[i][0] = max(DP[i-3][1], DP[i-2][0])+A[i];
    }
  }
  if(N%2==0) {
    cout<<max(DP[N-1][0], DP[N-2][1])<<endl;
  }
  else {
    cout<<max(DP[N-1][0], max(DP[N-2][0], DP[N-3][1]))<<endl;
  }
}



Measured memory_bytes: 8304
def gcd(m, n)
    if m < n
        gcd(n, m)
    elsif n == 0
        [m, 0]
    else
        g, step = gcd(n, m % n)
        [g, step + 1]
    end
end

loop do
    x, y = gets.split.map &:to_i
    break if x == 0
    puts gcd(x, y) * ' '
end

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

static const auto fast_io = [] {
 ios_base::sync_with_stdio(false); 
 cin.tie(nullptr); cout.tie(nullptr); 
 return nullptr;
}();

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

template<class A> 
A rnd() {
 return uniform_int_distribution<A> (1, (int) 1e9) (rng);
}

template<class A> 
A rnd(A x, A y) {
 return uniform_int_distribution<A> (x, y) (rng);
}

string to_string(string s) {
 return '"' + s + '"';
}

string to_string(const char* ch) {
 return to_string((string)ch);
}

string to_string(char ch) {
 return (string)"'" + ch + (string)"'";
}

string to_string(bool b) {
 return (b ? "true" : "false");
}

template<class A, class B>
string to_string(pair<A, B> p) {
 return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template<class A>
string to_string(A a) {
 string res = "{";
 bool first = true;
 for(const auto& x: a) {
  if(first == false) res += ", ";
  first = false;
  res += to_string(x);
 }
 res += "}";
 return res;
}

template<class A, class B, class C>
string to_string(priority_queue<A, B, C> a) {
 vector<A> res;
 while(a.empty() == false) {
  res.push_back(a.top());
  a.pop();
 }
 reverse(res.begin(), res.end());
 return to_string(res);
}

template<class A>
string to_string(priority_queue<A> a) {
 vector<A> res;
 while(a.empty() == false) {
  res.push_back(a.top());
  a.pop();
 }
 reverse(res.begin(), res.end());
 return to_string(res);
}

template<class A>
string to_string(stack<A> a) {
 vector<A> res;
 while(a.empty() == false) {
  res.push_back(a.top());
  a.pop();
 }
 return to_string(res);
}

template<class A>
string to_string(queue<A> a) {
 vector<A> res;
 while(a.empty() == false) {
  res.push_back(a.front());
  a.pop();
 }
 return to_string(res);
}

vector<string> __vector_tuple;
template<int index, class... A>
struct print_tuple {
 auto operator() (tuple<A...> a) {
  __vector_tuple.push_back(to_string(get<index>(a)));
  print_tuple<index-1, A...>{}(a);
 }
};

template<class... A>
struct print_tuple<0, A...> {
 auto operator() (tuple<A...> a) {
  __vector_tuple.push_back(to_string(get<0>(a)));
 }
};

template<class... T>
string to_string(tuple<T...> a) {
 const int ttsz = tuple_size<decltype(a)>::value;
 print_tuple<ttsz-1, T...>{}(a);
 string __ss = to_string(__vector_tuple);
 __vector_tuple.clear();
 return __ss;
}

void debug() {cerr << "]\n";}

template<class H, class... T>
void debug(H head, T... tail) {
 cerr << to_string(head) << " ";
 debug(tail...);
}

#ifdef LOCAL
 #define debug(...) cerr << "[" << #__VA_ARGS__ << " ] = ["; debug(__VA_ARGS__);
#else 
 #define debug(...) 
#endif

typedef long long int ll;

int main()
{
 ll n;
 cin >> n;
 vector<ll> a(n);
 ll ans = 0;
 for(ll& i: a) cin >> i;
 sort(a.begin(), a.end());
 int m = n-2;
 ans += a[n-1];
 debug(1,a[n-1]);
 for(int i = n-2; i >= 0; i--) {
  if(m == 0) break;
  if(m >= 2) {
   ans += 2LL* a[i];
   m -= 2;
   debug(2,a[i]);
   continue;
  }
  if(m == 1) {
   ans += a[i];
   m--;
   debug(1,a[i]);
   continue;
  }
 }
 cout << ans << '\n';
 return 0;
}
// 1 2 3 4 5 6 7 - 7 6 5 4 3 2
// 0 7 6 6 5 5 4


Measured memory_bytes: 4808
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Math;
 
class Program
{
    static void Main()
    {
        var N = int.Parse(ReadLine());
        var A = ReadLine().Split().Select(int.Parse).ToArray();
        var segtree = new SegmentTree<int>(A, GCD,0);
        var ans = 0;
        for (int i = 0; i < N; i++)
        {
            ans = Max(ans, GCD(segtree.Query(0, i), segtree.Query(i + 1, N)));
        }
        WriteLine(ans);
    }
 
    static int GCD(int a, int b)
    {
        while (b != 0)
        {
            var c = a;
            a = b;
            b = c % b;
        }
        return a;
    }
}
 
public class SegmentTree<T>
{
    T[] buffer;
    int N;
    T IE;
    Func<T, T, T> Op;//デリゲート遅そう　

    public SegmentTree(int cap,  Func<T, T, T> op, T E)//モノイドが直接渡せれば　C#9.0ではいるか
    {
        N = cap;
        buffer = new T[N * 2 - 1];
        for (int i = 0; i < buffer.Length; i++) buffer[i] = E; //Array.Fill(buffer, E);// NETCOREAPP Only
        Op = op;
        IE = E;
    }

    public SegmentTree(T[] init, Func<T, T, T> op,T E)
    {
        N = init.Length;
        buffer = new T[N * 2 - 1];
        Array.Copy(init, 0, buffer, N - 1, init.Length);
        for (int i = N - 2; i >= 0; i--)
        {
            buffer[i] = op(buffer[i * 2 + 1], buffer[i * 2 + 2]);
        }
        Op = op;
        IE = E;
    }

    public void Update(int index, T value)//index [0, N)
    {
        index += N - 1;
        buffer[index] = value;
        while (index > 0)
        {
            index = (index - 1) >> 1;
            buffer[index] = Op(buffer[index * 2 + 1], buffer[index * 2 + 2]);
        }
    }

    public T this[int index]
    {
        set//setの式形式はC#7.0以降
        {
            Update(index, value);
        }
        get
        {
            return buffer[index + N - 1];
        }
    }

    public T Query(int l, int r)//[l, r) 0 <= l, r <= N // 0 <= r - l のとき空区間
    {
        var lv = IE;
        var rv = IE;
        l += N - 1;
        r += N - 1;
        while (l < r)
        {
            if ((l & 1) == 0)
            {
                lv = Op(lv, buffer[l]);
            }
            if ((r & 1) == 0)
            {
                rv = Op(buffer[r - 1], rv);
            }
            l >>= 1;
            r = (r - 1) >> 1;
        }
        return Op(lv, rv);
    }
}



Measured memory_bytes: 26972
#include<bits/stdc++.h>
using namespace std;
#define LL long long int
#define DL double
#define MLL map<LL,LL>::iterator
#define MSL map<string,L>::iterator
#define MLS map<LL,string>::iterator
#define MSS map<string,string>::iterator
#define MCL map<char,LL>::iterator
#define SL set<LL>::iterator
#define SS set<string>::iterator sl
#define G getline
#define SZ size()
#define IN insert
#define C clear()
#define B begin()
#define F front()
#define T top()
#define E end()
#define EM empty()
#define V vector
#define Q queue
#define DQ deque
#define PQ priority_queue
#define ST stack
#define FI first
#define SE second
#define PI acos(-1)
#define PS push
#define PP pop()
#define PSF push_front
#define PSB push_back
#define PPF pop_front()
#define PPB pop_back()
#define endl "\n"
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
V<LL>v;
map<LL,LL>u;
int main()
{
    FAST;
    LL n,m,i,j,k,p,q,o,l,s,t,z;
    cin>>n;
    s=0;
    for(i=0; i<n; i++)
    {
        cin>>o;
        if(o%2==1)
        {
            s=1;
        }
        v.PSB(o);
    }
    if(s==1)
    {
        cout<<0<<endl;
        return 0;
    }
   z=0;
   for(i=(268435456*2);i>=4;i/=2)
   {
       k=0;
       for(j=0;j<v.SZ;j++)
       {
           if(v[j]%i!=0)
           {
               k=1;
               break;
           }
       }
       if(k==0)
       {
           z=1;
           l=0;
           i/=2;
           while(i)
           {
               l++;
               i/=2;
           }
           cout<<l<<endl;
           break;
       }
   }
   if(z==0)
   {
       cout<<1<<endl;
   }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
 
int main() {
 
  int n;
  cin>>n;

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

  sort(a.begin(),a.end());

  cout<<a.back()-a.front()<<endl;

	return 0;
}

Measured memory_bytes: 3608
n, w = map(int, input().split())

#wvn = [ list( map(int,input().split()) ) for _ in range(n) ]

wvn = [ tuple( map(int,input().split())) for _ in range(n) ]

#print(wvn)

VMAX = 10**3 * (10**2)
# 1 <= vi <= 10**3
tab = [ [10**10] *(VMAX+1) for _ in range(n+1)]

#print(type(tab[0]))

for i in range(1, len(wvn)+1 ):
    
    wv = wvn[i-1]
    wi = wv[0]
    vi = wv[1]
    
    for j in range( VMAX + 1 ):

        t = tab[i-1][j]
        
        if j >= vi:
            t = min(t, tab[i-1][j-vi]+wi)

        else:
            t = min(t, wi)
        
        tab[i][j] = t

ans = 0
while tab[n][ans] <= w:
    #print( (tab[n][ans],ans) )
    ans += 1

#print("ANS")
print(ans)



def debug0():
    row1 = tab[1]
    
    print("DEBUG0--START")
    print([(i, row1[i]) for i in range(0,50,5)])
    print("DEBUG0--END")
#debug0()


def debug1():

    for i in range(n+1):
        t = tab[i][0]
        sss = set(tab[i])
        print(sss)
        for j in range( 1, len(tab[i]) ):
            v = tab[i][j]

            if not t == v:
                t = v
                print( (i,j,v) )
 #end


def debug3():
    t = -1

    for i in range( len(tab[n])-1 ):
        e = tab[n][i]

        if not t == e:
            t = e
            print( (i, e) )
            
#debug3()





def debug2():
    t = -1
    for vi in range(len(tab[0])):

        v = tab[n][vi]
        if not t == v:
            t = v
            print((t,vi))


Measured memory_bytes: 120428
#include<iostream>
#include<string>
#include<math.h>
using namespace std;

int main() {
	char S[20];
	string T;
	string p;
	string Q;
	double m;
	int a = 0;
	int A = 0;
	int b = 0;
	int B = 0;
	int c = 0;
	int C = 0;
	int q, w, z;
	int n = 0;
	int x = 0;
	int y = 0;
	int ans = 0;
	cin >> T;
	for (int i = 0; i < 3; i++) {
		if (T[i] == 'o') {
			n++;
		}
	}

	cout << 700+n*100;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <cassert>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <list>


using namespace std;

#ifdef _MSC_VER
#define __typeof__ decltype
template <class T> int __builtin_popcount(T n) { return n ? 1 + __builtin_popcount(n & (n - 1)) : 0; }
#endif

#define foreach(it, c) for (__typeof__((c).begin()) it=(c).begin(); it != (c).end(); ++it)
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define CLEAR(arr, val) memset(arr, val, sizeof(arr))

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

template <class T> void max_swap(T& a, const T& b) { a = max(a, b); }
template <class T> void min_swap(T& a, const T& b) { a = min(a, b); }

typedef long long ll;
typedef pair<int, int> pint;

const double EPS = 1e-8;
const double PI = acos(-1.0);
const int dx[] = { 0, 1, 0, -1 };
const int dy[] = { 1, 0, -1, 0 };


int p, q, a, n;
int dfs(int use, int last_deno, int nume, int deno)
{
	if (p * deno == nume * q)
		return 1;
	else if (use == n || p * deno < nume * q)
		return 0;

	int res = 0;
	for (int i = last_deno; i * deno <= a; ++i)
		res += dfs(use + 1, i, i * nume + deno, i * deno);
	return res;
}
int main()
{
	while (cin >> p >> q >> a >> n, p | q | a | n)
		cout << dfs(0, 1, 0, 1) << endl;
}

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

#define pb push_back
#define S second
#define F first
typedef long long ll;

using namespace std;

const ll maxn = 5e5 + 10;
const ll inf = 1e18;
const ll mod = 1e9 + 7;



int main(){

//	freopen("input.txt", "r", stdin);
	
	int k;
	cin >> k;
	while(k--){
		cout << "ACL";
	}

	return 0;
}

Measured memory_bytes: 3564
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		int[] name = new int[24];
		double[] time = new double[24];
		for(int i = 0;i < 24;i++){
			name[i] = scan.nextInt();
			time[i] = scan.nextDouble();
		}
		for(int i = 0;i < 24;i += 8){
			for(int j = i;j < i+8;j++){
				for(int k = i+7;k > j;k--){
					if(time[k-1] > time[k]){
						swap(name,time,k,k-1);
					}
				}
			}
		}
		System.out.printf("%d %.2f\n",name[0],time[0]);
		System.out.printf("%d %.2f\n",name[1],time[1]);
		System.out.printf("%d %.2f\n",name[8],time[8]);
		System.out.printf("%d %.2f\n",name[9],time[9]);
		System.out.printf("%d %.2f\n",name[16],time[16]);
		System.out.printf("%d %.2f\n",name[17],time[17]);
		int[] a = {2,10,18};
		int min = sMin(time,a);
		System.out.printf("%d %.2f\n",name[min],time[min]);
		min = sMin(time,a);
		System.out.printf("%d %.2f\n",name[min],time[min]);
	}
	
	public static void swap(int[] a,double[] b,int i,int j){
		int t = a[j];a[j] = a[i];a[i] = t;
		double tt = b[j];b[j] = b[i];b[i] = tt;
	}

	public static int sMin(double[] time,int[] a){
		int min = a[0];
		if(time[a[0]] < time[a[1]]){
			if(time[a[1]] < time[a[2]]){
				min = a[0]++;
			}else if(time[a[0]] < time[a[2]]){
				min = a[0]++;
			}else{
				min = a[2]++;
			}
		}else if(time[a[1]] < time[a[2]]){
			min = a[1]++;
		}else{
			min = a[2]++;
		}
		return min;
	}
}

Measured memory_bytes: 20436
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <tuple>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <bitset>
#include <cstdio>
#include <cmath>

using namespace std;

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

    if (a == b && a != c) {
        cout << "Yes" << endl;
    } else if (b == c && b != a) {
        cout << "Yes" << endl;
    } else if (c == a && c != b) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}


Measured memory_bytes: 256