akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define endl "\n"
#define ll long long
#define vi vector<int>
#define mod 10000000
#define INF 1000000000000000000 
using namespace std;
ll getans(ll*w,ll*v,ll n,ll W)
{
vector<ll> dp(100001,INF);
dp[0]=0;
for(int i=0;i<n;i++)
{
for(int j=100000;j>=v[i];j--)
dp[j]=min(dp[j],w[i]+dp[j-v[i]]);	
}
int ans=0;
for(int i=0;i<=100000;i++)
if(dp[i]<=W)
ans=max(ans,i);
return ans;
}


int main()
{
   ios_base::sync_with_stdio(false);
   cin.tie(NULL);
   cout.tie(NULL);
ll n,v[100],w[100],W;
cin>>n>>W;
for(int i=0;i<n;i++)
{
	cin>>w[i]>>v[i];
}


cout<<getans(w,v,n,W)<<endl;
return 0;
}



Measured memory_bytes: 1024
#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<array>
#include<iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef int long long ll;
static const int N=100;
static const int white=0;
static const int gray=1;
static const int black=2;

int n,d[N],f[N],tt;
int color[N],nt[N];
int mp[N][N];

int next(int u){
    
    for(int v=nt[u];v<n;v++){
        nt[u]=v+1;
        if(mp[u][v]!=0)return v;
    }
    return -1;
}


void dfs_visit(int r){
    
    rep(i,n)nt[i]=0;
    stack<int> s;
    s.push(r);
    color[r]=gray;
    d[r]=++tt;
    while(!s.empty()){
        int u=s.top();
        int v=next(u);
        if(v!=-1){
            if(color[v]==white){
            d[v]=++tt;
            color[v]=gray;
            s.push(v);
            }
        }else{
            color[u]=black;
            f[u]=++tt;
            s.pop();
        }
    }
}



void dfs(){

    rep(i,n){color[i]=white;nt[i]=0;}
    tt=0;
    
    for(int i=0;i<n;i++){
        if(color[i]==white){
            dfs_visit(i);
        }
    }
    rep(i,n){
        cout<<i+1<<" "<<d[i]<<" "<<f[i]<<endl;
    }
    
}

int main(){
    cin>>n;
    
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            mp[i][j]=0;
        }
    }
    for(int i=0;i<n;i++){
        int a,b;
        cin>>a>>b;
        rep(j,b){
            int c;
            cin>>c;
            mp[a-1][c-1]=1;
        }
    }
    
    dfs();
    
    return 0;
}



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

int main() {
	int h,w;
	cin >> h >> w;
	vector<vector<char>> a(h+1,vector<char>(w+1,'.'));
	vector<vector<char>> b(h+1,vector<char>(w+1,'.'));
	for(int i=0;i<h;i++)
	{
		for(int j=0;j<w;j++)
		{
			cin >> a.at(i).at(j);
		}
	}
	string k = "Possible";
	int x=0,y=0;
	for(int i=0;i<h+w-2;i++)
	{
		b.at(x).at(y) = '#';
		int x1 = x + 1,y1 = y + 1;
		if(a.at(x1).at(y) == '#' && 
		   a.at(x).at(y1) == '#')
		{
			k = "Impossible";
			break;
		}
		else if(a.at(x1).at(y) == '#')
		{
			x++;
		}
		else if(a.at(x).at(y1) == '#')
		{
			y++;
		}
		else
		{
			k = "Impossible";
			break;
		}
	}
	b.at(h-1).at(w-1) = '#';
	if(a == b)
	{
		k = "Possible";
	}
	else
	{
		k = "Impossible";
	}
    cout << k << endl;
	return 0;
}


Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Scanner;
import java.util.stream.Collectors;

public class Main {

	public static void main(String[] args) {

			  Scanner scanner = null;
		      scanner = new Scanner(System.in);

		      int A = scanner.nextInt();
		      List<Integer> B =  new ArrayList<>();
		      
		      try{
		    	  while(true){
		    		  B.add(scanner.nextInt());  
		    	  }
		      } catch(Exception e){
		      }
		      
		      B = B.stream().sorted(Comparator.reverseOrder()).collect(Collectors.toList());
		      
		      int maxL = 0;
		      int etcL = 0;
		      for (int i = 0; A != i ; i++) {
		    	  if (i == 0) {
		    		  maxL = B.get(i);
		    	  } else {
		    		  etcL += B.get(i); 
		    	  }
		      }
		      
		      if (etcL > maxL ) {
		    	  System.out.println("Yes");
		      } else {
		    	  System.out.println("No");
		      }
		}

}



Measured memory_bytes: 30292
#include<stdio.h>
#include<math.h>

int main(){


  int data[1000000], i, j, sum, n;


  while(scanf("%d",&n) != EOF){

    for(i = 2; i < 1000000; i++){
      data[i]  = 1;
    }

    for(i = 2; i <= sqrt(n); i++){
      if(data[i] == 1){
	for(j = 2 * i; j <= n; j+=i){
	  data[j] = 0;
	}
      }
    }
    
    
    sum = 0;
    

    for(i = 2; i <= n; i++){
      if(data[i] == 1){
	sum++;
      }
    }

    printf("%d\n",sum);

  }
  return 0;
  
}

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

int main () {
  int N,A,i,c,d;
  cin>>N;
  c=0,d=0;
  for(i=0;i<N;i++){
    cin>>A,d=0;
    if(A%2==1){
      c=0;
      break;
    }
    if(i==0){
      while(A%2==0){
          A/=2,c++;
      }
    }
    else{
      while(A%2==0){
          A/=2,d++;
      }
      if(c>d){
        c=d;
      }
    }
  }
  cout<<c<<endl;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

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

    if (n < 105) {
        cout << "0\n";
    } else if (n < 135) {
        cout << "1\n";
    } else if (n < 165) {
        cout << "2\n";
    } else if (n < 189) {
        cout << "3\n";
    } else if (n < 195) {
        cout << "4\n";
    } else {
        cout << "5\n";
    }
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;

const int MAXN = 200005;
const int INF = 0x3f3f3f3f;

char s[MAXN];
int dp[1 << 26];

void load() {
	scanf("%s", s);
}

int solve() {
	memset(dp, INF, sizeof dp);
	dp[0] = 0;
	int pref = 0;
	for (int i = 0; s[i]; i++) {
		pref ^= 1 << s[i] - 'a';
		int tmp = dp[pref];
		for (int j = 0; j < 26; j++)
			tmp = min(tmp, dp[pref ^ 1 << j]);
		dp[pref] = min(dp[pref], tmp + 1);
	}
	return max(dp[pref], 1);
}

int main() {
	load();
	printf("%d\n", solve());
	return 0;
}

Measured memory_bytes: 262656
#include <iostream>
#include <cmath>
#include <vector>

using namespace std;
using LL = long long;
using P = pair<int, int>;

bool ps[31623];

LL pow(LL m, int n) {
    if (n == 0) return 1;
    LL ret = pow(m * m, n / 2);
    if (n % 2) ret *= m;
    return ret;
}

int main() {

    int n;
    cin >> n;

    fill(ps, ps + 31623, true);
    ps[0] = ps[1] = false;

    for (int i = 2; i <= sqrt(n); i++) {
        if (ps[i]) {
            for (int j = i * 2; j <= sqrt(n); j += i) {
                ps[j] = false;
            }
        }
    }

    //
    vector<P> fs;

    for (int i = 2; i <= sqrt(n); i++) {
        if (ps[i] && n % i == 0) {
            int e = 0;
            do {
                n /= i;
                e++;
            } while (n % i == 0);
            fs.emplace_back(make_pair(i, e));
        }
    }

    if (n != 1) fs.emplace_back(make_pair(n, 1));

    //
    int count = 1;

    for (P f : fs) {
        int p, e;
        p = f.first;
        e = f.second;
        count *= pow(p, e) - pow(p, e - 1);
    }

    cout << count << endl;
}


Measured memory_bytes: 3292
#include <iostream>
#include <string>
#include <algorithm>
#include <limits.h>
#include <queue>
#include <tuple>
#include <math.h>
#include <vector>
#include <map>
#include <random>
#include <time.h>
using namespace std;
typedef long long ll;

ll n, a[405];
ll dp[400][400];
ll sum[400];

ll solve(int p, int q) {
    if (dp[p][q] >= 0) return dp[p][q];
    
    if (p == q) dp[p][q] = 0;
    else if (q - p == 1) dp[p][q] = a[p] + a[q];
    else {
        ll mn = 1e18;
        for (int i = 0; i < q - p; i++) {
            mn = min(mn, solve(p, p + i) + solve(p + i + 1, q) + sum[q] - sum[p - 1]);
        }
        dp[p][q] = mn;
    }
    return dp[p][q];
}

int main(void){
    cin >> n;
    for (int i = 0; i < n; i++) sum[i] = 0;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        for (int j = i; j < n; j++) sum[j] += a[i];
    }
    
    for (int i = 0; i < n*n; i++) dp[i/n][i%n]=-1;
    
    cout << solve(0, n-1) << endl;
    
    
}

Measured memory_bytes: 1536
a=input()
s=int(a)
if s<86400 and s>=0:

    h=int(s/3600)
    m=int((s-h*3600)/60)
    s=s-h*3600-m*60
    print("{0}:{1}:{2}".format(h,m,s))

else:
    exit()

Measured memory_bytes: 7708
# ITP1_11_B: Dice2

class Dice
  TOP    = 0
  FRONT  = 1
  RIGHT  = 2
  LEFT   = 3
  BACK   = 4
  BOTTOM = 5

  def initialize(labels)
    @labels = labels
  end

  def pip_of(side)
    @labels[side]
  end
 
  def rotate(p1, p2, p3, p4)
    l = @labels
    l[p1], l[p2], l[p3], l[p4] = l[p4], l[p1], l[p2], l[p3]
  end
 
  def roll_to(direction)
    rotate *case direction
    when 'N'
      [TOP, FRONT, BOTTOM, BACK]
    when 'E'
      [TOP, LEFT, BOTTOM, RIGHT]
    when 'S'
      [TOP, BACK, BOTTOM, FRONT]
    when 'W'
      [TOP, RIGHT, BOTTOM, LEFT]
    end
  end
end
 
labels     = gets.split.map &:to_i
n_changes  = gets.to_i
directions = %w(N E S W)
dice       = Dice.new labels

n_changes.times do
  top, front = gets.split.map &:to_i
  while true
    dice.roll_to directions.sample
    if dice.pip_of(Dice::TOP) == top && dice.pip_of(Dice::FRONT) == front
      puts dice.pip_of(Dice::RIGHT)
      break
    end
  end
end

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

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define range(a) a.begin(), a.end()
#define endl "\n"
#define Yes() cout << "Yes" << endl
#define No() cout << "No" << endl
using Graph = vector<vector<int>>;
const unsigned long long mod = 1e9 + 7;
const long long INF = 1LL<<60;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
void chmin(long long &a, long long b) { if (a > b) a = b; }
void chmax(long long &a, long long b) { if (a < b) a = b; }

int main(void){
	ios::sync_with_stdio(0);
	cin.tie(0);
	ll sum=0,N,d;	cin>>N;
	vector<int> data(N);
	FOR(i,0,N){
		cin>>d;
		data.at(i)=d;
	}
	FOR(i,0,N-1){
		FOR(j,i+1,N){
			sum+=data.at(i)*data.at(j);
		}
	}

	cout<<sum<<endl;

    return 0;
}



Measured memory_bytes: 3616
#include<cstdio>
#include<iostream>
#include<string>
#include<cstring>
#include<map>
#include<vector>
#include<set>
#include<queue>
#include<algorithm>
#define X first
#define Y second
using namespace std;

typedef long long LL;
typedef pair<int,int> PII;

const int N=1000010,mod=1e9+7; 

int a,b;
int ans=-1;

int main()
{
	cin>>a>>b;
	
	for(int i=1;i<=1000;i++)
	{
		if(int(i*0.08)==a&&int(i*0.1)==b)
		{
			ans=i;
			break;
		}
	}
	
	cout<<ans<<endl;
	
	
	
	
	
	
	
	
	
	
	
	
	
	return 0;
}









Measured memory_bytes: 256
#include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(),v.end()
#define INF INT_MAX;
typedef long long ll;
using namespace std;

int main(){
  char a,b; cin >> a >> b;
  if(a==b) puts("H");
  else puts("D");
}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
import java.util.stream.IntStream;

/**
 * 自力で作成したソースコード、解説より計算量が多いが、結果がACになっている
 */
public class Main {

	/** 計算する最大値 */
	private static final int N = 100_000;

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			// 最大値まで2017に似た数を計算する
			int[] count = new int[N];
			count[0] = count[1] = count[2] = 0;
			List<Integer> primeList = new ArrayList<>();
			primeList.add(2);
			IntStream.range(3, N).forEach(i -> count[i] = count[i - 1] + (is2017LikeNumber(i, primeList) ? 1 : 0));
			int q = scanner.nextInt();
			IntStream.range(0, q).map(i -> {
				int l = scanner.nextInt(), r = scanner.nextInt();
				return count[r] - count[l - 1];
			}).forEach(System.out::println);
		}
	}

	/**
	 * 入力数字が素数かどうかを判定する
	 * 
	 * @param number    入力数字
	 * @param primeList 素数のリスト
	 * @return 入力数字が素数かどうか
	 */
	private static boolean isPrime(int number, List<Integer> primeList) {
		int sqrt = (int) Math.sqrt(number);
		for (int i : primeList) {
			if (i > sqrt) {
				primeList.add(number);
				return true;
			}
			if (0 == (number % i)) {
				return false;
			}
		}
		primeList.add(number);
		return true;
	}

	/**
	 * 入力数字が2017に似た数であるかどうかを計算
	 * 
	 * @param number 入力数字
	 * @return 入力数字が2017に似た数であるかどうか
	 */
	private static boolean is2017LikeNumber(int number, List<Integer> primeList) {
		return (1 == (number & 1)) && isPrime(number, primeList) && primeList.contains((number + 1) / 2);
	}
}


Measured memory_bytes: 64588
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
using ll = long long;
using vec = vector<ll>;
using vect = vector<double>;
using Graph = vector<vector<ll>>;
#define loop(i, n) for (ll i = 0; i < n; i++)
#define Loop(i, m, n) for (ll i = m; i < n; i++)
#define pool(i, n) for (ll i = n; i >= 0; i--)
#define Pool(i, m, n) for (ll i = n; i >= m; i--)
#define mod 1000000007ll
#define flagcount __builtin_popcount
#define flag(x) (1 << x)
#define flagadd(bit, x) bit |= flag(x)
#define flagpop(bit, x) bit &= ~flag(x)
#define flagon(bit, i) bit &flag(i)
#define flagoff(bit, i) !(bit & (1 << i))
#define all(v) v.begin(), v.end()
#define low2way(v, x) lower_bound(all(v), x)
#define high2way(v, x) upper_bound(all(v), x)
#define idx_lower(v, x) (distance(v.begin(), low2way(v, x)))  //配列vでx未満の要素数を返す
#define idx_upper(v, x) (distance(v.begin(), high2way(v, x))) //配列vでx以下の要素数を返す
#define idx_lower2(v, x) (v.size() - idx_lower(v, x))         //配列vでx以上の要素数を返す
#define idx_upper2(v, x) (v.size() - idx_upper(v, x))         //配列vでxより大きい要素の数を返す
#define putout(a) cout << a << endl
#define Gput(a, b) G[a].push_back(b)
#define Sum(v) accumulate(all(v), 0ll)
#define gcd(x, y) __gcd(x, y)
ll ctoi(char c)
{
    if (c >= '0' && c <= '9')
    {
        return c - '0';
    }
    return 0;
}
template <typename T>
T lcm(T x, T y)
{
    T z = gcd(x, y);
    return x * y / z;
}
template <typename T>
bool primejudge(T n)
{
    if (n < 2)
        return false;
    else if (n == 2)
        return true;
    else if (n % 2 == 0)
        return false;
    double sqrtn = sqrt(n);
    for (T i = 3; i < sqrtn + 1; i++)
    {
        if (n % i == 0)
        {
            return false;
        }
        i++;
    }
    return true;
}
//場合によって使い分ける
//const ll dx[4]={1,0,-1,0};
//const ll dy[4]={0,1,0,-1};
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};
//2次元配列の宣言
//vector<vector<ll>> field(h, vector<ll>(w));

int main()
{
    cout << fixed << setprecision(30);
    ll x, n;
    cin >> x >> n;
    vec p(n);
    bool check = true;
    map<ll, ll> count;
    loop(i, n)
    {
        cin >> p[i];
        count[p[i]]++;
        if (p[i] == x)
            check = false;
    }
    if (check)
    {
        putout(x);
        return 0;
    }
    Loop(i, 1, 1000)
    {
        ll a = x - i, b = x + i;
        bool c1 = true, c2 = true;
        if (count[a] > 0)
            c1 = false;
        if (count[b] > 0)
            c2 = false;
        if (c1 && c2)
        {
            putout(a);
            return 0;
        }
        if (c1)
        {
            putout(a);
            return 0;
        }
        if (c2)
        {
            putout(b);
            return 0;
        }
    }
    return 0;
}


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

#define int long long

#define INF (int)(1e17)
#define MAX 110000

int N, D;
int t[MAX], F[MAX];

signed main(){
  int num = 0, ans = 0;

  cin>>N>>D;

  for(int i = 0; i < N; i++){
    cin>>t[i]>>F[i];
  }
  t[N] = INF;
  F[N] = 1;

  if(t[0] < F[0]-1){
    cout<<-1<<endl;
    return 0;
  }
  for(int i = 0; i < N; i++){
    if(num + 1 > D){
      cout<<-1<<endl;
      return 0;
    } else num++;

    if(t[i+1] - t[i] < abs(F[i+1]-F[i])){
      cout<<-1<<endl;
      return 0;
    } else if(t[i+1]-t[i] >= F[i+1] + F[i] - 2){
      ans += num*(F[i]-1);
      num = 0;
    } else {
      ans += num*(t[i+1]-t[i]);
    }
  }

  cout<<ans<<endl;

  
  return 0;
}



Measured memory_bytes: 4668
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
const int inf = 1e9;
const ll INF = 1e18;
const double pi = 3.14159265358979323846;
#define rep(i,n) for(ll i=0;i<n;i++)
using Graph = vector<vector<int>>;
using pint = pair<int,int>;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};

int main(){
    ll n;cin>>n;
    ll a[n];
    rep(i,n) cin>>a[i];
    ll b[n],c[n];
    rep(i,n){
        b[i]=i-a[i];
        c[i]=a[i]+i;
    }
    sort(b,b+n);
    sort(c,c+n);
    ll ans=0;
    rep(i,n){
        auto itr1=lower_bound(c,c+n,b[i]);
        auto itr2=upper_bound(c,c+n,b[i]);
        ans+=distance(itr1,itr2);
    }

    cout<<ans<<"\n";
}

Measured memory_bytes: 8316
import sys
sys.setrecursionlimit(10000)

INF = 2147483647


# initiate the RMQ tree
def initRMQ(n, D):
    n_ = 1
    # search the power of n
    while n_ < n:
        n_ *= 2
    # set a big number to all leaves
    for i in range(2*n_ - 1):
        D.append(INF)

    return n_


def update(k, a):
    k += n_ - 1  # convert array index to tree index
    D[k] = a
    while k != 0:
        k = int((k - 1) / 2)
        D[k] = min(D[k*2 + 1], D[k*2 + 2])


def findMin(qlow, qhigh):
    return query(qlow, qhigh + 1, 0, 0, n_)


def query(qlow, qhigh, k, l, r):
    # print('q', a, b, k, l, r)
    if r <= qlow or qhigh <= l:
        return INF

    if qlow <= l and r <= qhigh:
        return D[k]

    mid = (l + r) // 2
    vl = query(qlow, qhigh, k*2 + 1, l, mid)
    vr = query(qlow, qhigh, k*2 + 2, mid, r)

    return min(vl, vr)


if __name__ == '__main__':
    n, q = map(int, input().split())

    D = []
    n_ = initRMQ(n, D)

    for _ in range(q):
        # print(D)
        c, x, y = map(int, input().split())

        if c == 0:
            update(x, y)

        else:
            print(findMin(x, y))



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

int main() {
    ll A,B;
    cin >> A >>B;
    ll ans =0;
    if(A*B<0){
        ans++;
        A *= (-1);
        
    }else if(A*B==0){
        if(A>B){
            ans++;
        }
    }else{
        if( A >B ){
            ans+=2;
        }
    }
    ans += abs(B-A);
    cout << ans << endl;


    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
using namespace std;
#define sz(x) ((int)(x).size())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define MEMSET(v, h) memset((v), h, sizeof(v))
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
#define pb push_back
#define mp make_pair
#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
const ll INF = 1LL<<58;
 
int main(){
    ll N;
  	cin >> N;
  	ll temp = N;
  	ll ans = 0;
  	ll A = 1;
  	ll sum = 0;
  	ll sum2 = 0;
  	while(temp > 10){
      temp /= 10;
      A *= 10;
    }
  	ll B = N - A;
  	while(A > 0){
      sum += A % 10;
      A /= 10;
    }
  	while(B > 0){
      sum2 += B % 10;
      B /= 10;
    }
  	
  	cout << sum + sum2 << endl;
}

Measured memory_bytes: 256
//********************************************************************//
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define fi first 
#define se second 
#define RANGE(i, n) for (int i = 0; i < n; ++i)
#define FOR(i, a, b) for (int i = a; i < b; ++i)
#define DFOR(i, a, b) for(int i = a; i > b; --i)
#define DEB(x) cout << #x << ": " << x << endl
#define ALL(v) v.begin(), v.end() 
#define SORT(v) sort(ALL(v))
#define DISPV(v) { for(auto x___: v) cout << x___ << " "; cout << endl; }
#define DISPM(m) { for(auto x____: m){ cout << x____.first << ": " << x____.second << endl; } };
#define DISPMV(m) { for(auto x_____: m){ cout << x_____.first << ": " ;DISPV(x_____.second);} };
using LL = long long;
using VI = vector <int>;
using VC = vector <char>;
using VS = vector <string>;
using VL = vector <long long>;
using VVI = vector<VI>;
using VVL = vector <VL>;
using MII = map<int, int>;
using MIVI = map<int, VI>;
using MSS = map<string, string>;
using MLL = map<LL, LL>;
int READ_INT(){int temp;cin>>temp;return temp;}      // read an int
LL READ_LONG(){LL temp;cin>>temp;return temp;}      // read a long long
void mcs(VI &series, int &max_sum){                    // maximum contigous sub sum(kadane)
    int s=0;
    for(auto x: series){
        s += x;
        max_sum = max(max_sum, s);
        if(s < 0)s = 0;
    }
}
template<typename T>
T MAX(T t){ return t;}
template <typename T, typename... Args>
T MAX(T t, Args... args){ return max(t, MAX(args...)); }
const int MOD = int(1e9) + 7;
const int INF = 1e9 + 5;
const double PI = acos(-1.0); //M_PI;
const double EPS = 1e-9;
//********************************************************************//

int n, m;
int mat[1001][1001], paths[1001][1001];

int main(){
    ios::sync_with_stdio(false);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    memset(mat, 0, sizeof(mat));
    memset(paths, 0, sizeof(paths));

    cin >> n >> m;
    for(int i = 1; i <= n; ++i){
        string s;
        cin >> s;
        for(int j = 1; j <= m; ++j){
            if(s[j-1] == '.'){
                mat[i][j] = 1;
                paths[i][j] = 1;
            }
        }
    }

    for(int i = 1; i <= n; ++i){
        for(int j = 1; j <= m; ++j){
            if(i*j != 1 && paths[i][j])
                paths[i][j] = (paths[i-1][j] + paths[i][j-1])%MOD;
        }
    }
    // RANGE(i, n+1){
    //     RANGE(j, m+1){
    //         cout << paths[i][j] << " ";
    //     }cout << endl;
    // }
    cout << paths[n][m] << endl;
    return 0;
}



/* complie flags
-Wall -Wextra -pedantic -std=c++11 -O2 -Wshadow -Wformat=2 -Wfloat-equal -Wconversion -Wlogical-op -Wshift-overflow=2 -Wduplicated-cond -Wcast-qual -Wcast-align -D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC -D_FORTIFY_SOURCE=2 -fsanitize=address -fsanitize=undefined -fno-sanitize-recover -fstack-protector
*/

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

int main(){
	int N;
	cin >> N;
	int i, x=0, max=0;
	char s[N];
	for(i=0; i<N; i++){
		cin >> s[i];
		if(s[i] == 'I')	x++;
		else		x--;
		if(max<x)	max=x;
	}
	cout << max << endl;
	return 0;
}


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

int N,M,a[200009],b[200009];
map<pair<int,int>,int>MM;

int main(){
	cin>>N>>M;
	for(int i=1;i<=M;i++){
		cin>>a[i]>>b[i];
		MM[make_pair(a[i],b[i])]=1;
		MM[make_pair(b[i],a[i])]=1;
	}
	int G=0;
	for(int i=2;i<=N-1;i++){
		if(MM[make_pair(1,i)]==1 && MM[make_pair(i,N)]==1) G=1;
	}
	if(G==0) cout<<"IMPOSSIBLE"<<endl;
	else cout<<"POSSIBLE"<<endl;
	return 0;
}


Measured memory_bytes: 39296
#include<bits/stdc++.h>
using namespace std;
const double pi = acos(-1);

int main() {
    double a, b, x;
    cin >> a >> b >> x;
    if (2.0 * x / a / b >= a )    printf("%.10lf", 180 / pi * atan(1.0 * (2.0 * b / a) - (1.0 * 2 * x / a / a / a)));
    else
        printf("%.10lf", 180 / pi * atan(1.0 * b / (2.0 * x / a / b) ) );
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define rep2(i, l, r) for (int i = (l); i < (r); i++)
#define ALL(x) (x).begin(), (x).end()     //昇順
#define RALL(x) (x).rbegin(), (x).rend()  // 降順
#define pri(x) cout << (x) << "\n"
#define pri2(x, y) cout << (x) << " " << (y) << "\n"
#define pri3(x, y, z) cout << (x) << " " << (y) << " " << (z) << "\n"
const long long mod = 1e9 + 7;
typedef long long ll;
typedef priority_queue<int> PQ;
typedef vector<long long> VL;
typedef vector<bool> VB;
typedef vector<int> VI;  // VI a(n);
typedef vector<double> VD;
typedef vector<string> VS;
typedef vector<char> VC;
typedef vector<VS> VSS;
typedef vector<VC> VCC;
typedef vector<VI> VII;  // VII a(n,vector<int>(m)) n * m
typedef vector<VL> VLL;
typedef pair<int, int> PII;
typedef map<int, int> MP;  // MP a;
typedef vector<pair<ll, ll>> PS;

template <class T, class U> bool chmax(T &a, U b) { if (a <= b) {a = b; return 1;} return 0; }
template <class T, class U>  bool chmin(T &a, U b) { if (a > b) { a = b; return 1; } return 0; }
template <typename T>  ostream &operator<<(ostream &os, vector<T> &v) { os << "{"; rep(i, (int)v.size()) { os << v[i] << (i < v.size() - 1 ? ", " : ""); } os << "}"; return os; }

// g++ -std=c++11 prac.cpp
// operator << (cout,a);
// chmin(min,a)

int main() {
    ll x=0,y=0,z=0,n,h,m,k,w,ans=0,sum=0,Max=-1,Min=1e9+1;
    bool ok = true;
    string s,t,u;
    cin >> s >> t;
    rep(i,s.size()){
      if(s[i]!=t[i]){
        pri("No");
        return 0;
      }
    }
    pri("Yes");
    return 0;
}


Measured memory_bytes: 3596
#include<bits/stdc++.h>
#define For(i,k,n) for(ll i=k;i<n;i++)
#define endl "\n"
#define ll long long int
using namespace std;
#define test int t; cin>>t; while(t--)
#define vi vector<int>
#define vl vector<ll>
#define umapii unordered_map<int,int>
#define umapll unordered_map<ll,ll>

void dummy(){
    for(int i=0;i<23;i++);
}
void scanArr(ll a[],ll n){
    For(i,0,n)cin>>a[i];
}
void scanArr(int a[],int n){
    For(i,0,n)cin>>a[i];
}
void printl(){
  cout<<endl;
}
void dummy2(){
  For(i,0,10)cout<<"";
}
ll mexp(ll a,ll b){
  if(a==0) return 0;
  if (b==0) return 1;
  ll ans=1;
  while(b>0){
    if(b&1){
      ans*=a;b--;
    }
    else{
      a*=a;b=b>>1;
    }
  }
  return ans;
}

int main() {
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
  
  //        ------Code Here------
    int a,b;
    cin>>a>>b;
    cout<<a*b<<endl;
	return 0;
}

Measured memory_bytes: 3612
#include <stdio.h>

int gcd(int a, int b);

int main(void)
{
	int a, b;
	int tmp;
	int g;
	
	while (scanf("%d %d", &a, &b) != EOF){
		
		g = gcd(a, b);
		printf("%d %d\n", g, a / g * b);
		
	}
	
	return (0);
}

int gcd(int a, int b)
{
	int r;
	int g;
	int tmp;
	
	if (b > a){
		tmp = a;
		a = b;
		b = tmp;
	}
	
	do {
		r = a % b;
		g = b;
		a = b;
		b = r;
	}while (r != 0);
	
	return (g);
}

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

using namespace std;

int main(void)
{
	int dp[17][17];
	int H,W;
	int x,y;
	int keepouts;
	
	while (cin >> W >> H&&W){
		
		for (int i=1;i<=H;i++){
			for (int j=1;j<=W;j++){
				dp[i][j]=0;
			}
		}
		
		cin >> keepouts;
		
		dp[1][1]=1;
		
		for(int i=1;i<=keepouts;i++){
			cin >> x >> y;
			dp[y][x]=-1;
		}
		
		for (int i=2;i<=H;i++){
			if (dp[i][1]==-1||dp[i-1][1]==-1){
				dp[i][1]=-1;
			}else{
				dp[i][1]=1;
			}
		}
		for (int i=2;i<=W;i++){
			if (dp[1][i]==-1||dp[1][i-1]==-1){
				dp[1][i]=-1;
			}else{
				dp[1][i]=1;
			}
		}
		
		
		for (int i=2;i<=H;i++){
			for (int j=2;j<=W;j++){
				if(dp[i][j]==-1){
					continue;
				}
				int total=0;
				
				if (dp[i-1][j]>=0){
					total+=dp[i-1][j];
				}
				if (dp[i][j-1]>=0){
					total+=dp[i][j-1];
				}
				dp[i][j]=total;
			}
		}
	
	cout << dp[H][W] << endl;
	
	}
	return 0;
}


Measured memory_bytes: 3084
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1e9;
const ll mod = 1e9+7;
ll N, K;
vector<ll> G[100000];
ll rk[100000];


void getrank() {
  for (ll i = 0; i < 100000; i++) {
    rk[i] = INF;
  }
  rk[0] = 0;
  queue<ll> que;
  que.push(0);
  while (!que.empty()) {
    ll v = que.front();
    que.pop();
    for (ll i = 0; i < G[v].size(); i++) {
      ll to = G[v][i];
      if (rk[to] == INF) {
        rk[to] = rk[v]+1;
        que.push(to);
      } else {
        continue;
      }
    }
  }
}

ll solve() {
  ll res = K;
  queue<ll> que;
  que.push(0);
  while (!que.empty()) {
    ll v = que.front();
    que.pop();
    if (rk[v] == 0) {
      for (ll i = 0; i < G[v].size(); i++) {
        ll to = G[v][i];
        res = res * (K-1-i) % mod;
        que.push(to);
      }
    } else {
      for (ll i = 0; i < G[v].size(); i++) {
        ll to = G[v][i];
        if (rk[to] > rk[v]) {que.push(to);}
      }
      if (K-1 >= G[v].size()) {
        for (ll i = 0; i < G[v].size()-1; i++) {
          res = res * (K-2-i) % mod;
        }
      } else {
        res = 0;
      }
    }
  }
  return res;
}

int main() {
  cin >> N >> K;
  for (ll i = 0; i < N-1; i++) {
    ll a, b; cin >> a >> b; a--; b--;
    G[a].push_back(b); G[b].push_back(a);
  }
  
  getrank();
  cout << solve() << endl;
}

Measured memory_bytes: 8052
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int a = sc.nextInt();
        int b = sc.nextInt();
        if (Math.abs(a - b) > 1) {
            int c = Math.max(a, b);
            System.out.println(2 * c  - 1);
        } else {
            System.out.println(a + b);
        }

    }

}


Measured memory_bytes: 22228
<?php

fscanf(STDIN, "%d %d %d", $a, $b, $m);
$aa = explode(" ", fgets(STDIN));
$bb = explode(" ", fgets(STDIN));

$t = [min($aa) + min($bb)];

for ($i = 0; $i < $m; $i++) {
    fscanf(STDIN, "%d %d %d", $x, $y, $c);
    $t[] = ($aa[$x - 1] + $bb[$y - 1]) - $c;
}

echo (min($t));


Measured memory_bytes: 25072
#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
using namespace std;
const int MAX=1e2+5;
//显示数组 
void showArray(int a[],int n){
	for(int i=0;i<n;i++){
		if(i>0){
			printf(" ");
		}
		printf("%d",a[i]);
	}
	printf("\n");
}
//选择排序 
void selectSort(int ss[],int n){
	int te=0;
	for(int i=0;i<n-1;i++){
		int tep=ss[i];
		int mmi=i;
		for(int j=i+1;j<n;j++){
			if(ss[j]<ss[mmi]){
				mmi=j;
				tep=ss[j];
			}
		}
		if(mmi!=i){
			ss[mmi]=ss[i];
			ss[i]=tep;
			te++;
		}
	}
	showArray(ss,n); 
	printf("%d\n",te);
}
int main(){
	int n;
	int num[MAX];
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		scanf("%d",&num[i]);
	}
	selectSort(num,n);
	return 0;
}


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

#define ll long long
#define ld long double
#define COIN const int
#define ite iterator
#define PII pair<int,int>
#define PSI pair<string,int>
#define PIS pair<int,string>

#define REP(i,n) for((i)=0;(i)<(int)(n);(i)++)
#define REPD(i,n) for((i)=(n)-1;(i)>=0;(i)--)

#define ALL(c) (c).begin(), (c).end()
#define sz(s) (s).size()
#define CLEAR(x) memset(x,0,sizeof x);

#define MP make_pair
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define X first
#define Y second

#define VI vector<int>
#define VS vector<string>
#define VII vector<PII>
#define VVI vector<VI>

#define PIII 3.1415926
#define PI 3.14
/*****************************************************************************/
const ll mod=1e9+7;
const ll INF=1e18;
/*****************************************************************************/

using namespace std;

int main()
{
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	ll n,m,v,w,t; cin >>n>>v>>m>>w>>t;
	ll s=abs(n-m),cnt=v-w;
	if (cnt*t>=s) cout <<"YES";
	else cout <<"NO";
	return 0;
}
/******************************************************************************
******************************************************************************/


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

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

    int a,b;
    cin >> a >> b;

    int c = 0;
    if(a == 1 and b == 2) c = 3;
    else if(a == 1 and b == 3) c = 2;
    else if(a == 2 and b == 3) c = 1;
    else if(a == 2 and b == 1) c = 3;
    else if(a == 3 and b == 2) c = 1;
    else if(a == 3 and b == 1) c = 2;

    cout << c << endl;
}

Measured memory_bytes: 256
def transformate(s, command):
    command, *op = command.split()

    op[0] = int(op[0])
    op[1] = int(op[1])

    if command == 'replace':
        return s[0:op[0]] + op[2] + s[op[1]+1:]
    elif command == 'reverse':
        return s[0:op[0]] + s[op[0]:op[1]+1][::-1] + s[op[1]+1:]
    elif command == 'print':
        print(s[op[0]:op[1]+1])
        return s

if __name__ == '__main__':
    s = input()
    for _ in range(int(input())):
        s = transformate(s, input())



Measured memory_bytes: 5624
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N ,A, count;
  cin >> N;
  int MIN = 10000000000;
 
  for(int i = 0; i < N; i++){
    cin >> A;
    count = 0;
     while(A % 2 == 0){
       A = A / 2;
       count = count + 1;
     }
   
    if(MIN > count){
      MIN = count;
    }

 }
  
  cout << MIN << endl;
  
}

Measured memory_bytes: 3600
#![allow(unused_imports)]
use proconio::{input, fastout};
use proconio::marker::*;
use std::cmp::Ordering;
use std::collections::HashMap;

#[fastout]
fn main() {
  input! {
    n: usize,
    vals: [usize;n]
  }

  let mut vis = vals
  .into_iter()
  .enumerate()
  .map(|(i, v)| (i, v))
  .collect::<Vec<(usize, usize)>>();
  vis.sort_by(|b,a| {
    let v = b.1.cmp(&a.1);
    if v == Ordering::Equal {
      b.0.cmp(&a.0)
    } else {
      v
    }
  });
  
  let mut map:Vec<usize> = vec![0;n];
  for i in 0..n {
    map[vis[i].0] = i;
  }
  
  let mi = n / 2 - 1;
  for i in 0..n {
    let ti = map[i];
    if ti <= mi {
      println!("{}", vis[n/2].1);
    } else {
      println!("{}", vis[n/2 - 1].1);
    }
  }
}

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

int main() {
  string s;
  cin>>s;
  if(s=="Sunny"){
    cout<<"Cloudy"<<endl;
  }
  else if(s=="Cloudy"){
    cout<<"Rainy"<<endl;
  }
  else{
    cout<<"Sunny"<<endl;
  }
  
}

Measured memory_bytes: 256
/*  -*- coding: utf-8 -*-
 *
 * f.cc: F - Simplified Reversi
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_N = 200000;
const int MAX_Q = 200000;

/* typedef */

typedef long long ll;

struct Range {
  int l, r, d;
  Range() {}
  Range(int _l, int _r, int _d): l(_l), r(_r), d(_d) {}

  bool operator<(const Range &e) const { return r < e.r; }
};

typedef deque<Range> dr;

/* global variables */

dr hrs, vrs;

/* subroutines */

/* main */

int main() {
  int n, q;
  scanf("%d%d", &n, &q);
  n -= 2;

  hrs.push_front(Range(0, n, n));
  vrs.push_front(Range(0, n, n));
  ll sum = 0;

  while (q--) {
    int op, x;
    scanf("%d%d", &op, &x);
    x -= 2;

    if (op == 1) { // to down
      int k =
	lower_bound(hrs.begin(), hrs.end(), Range(x, x, 0)) - hrs.begin();
      if (hrs[k].d > 0) {
	sum += hrs[k].d;
	if (k == 0) {
	  if (x == hrs[0].r - 1) hrs[0].r--;
	  else {
	    hrs[0].l = x + 1;
	    hrs.push_front(Range(0, x, hrs[0].d));
	  }
	  vrs[0].d = x;
	}
      }
    }
    else { // to right
      int k =
	lower_bound(vrs.begin(), vrs.end(), Range(x, x, 0)) - vrs.begin();
      if (vrs[k].d > 0) {
	sum += vrs[k].d;
	if (k == 0) {
	  if (x == vrs[0].r - 1) vrs[0].r--;
	  else {
	    vrs[0].l = x + 1;
	    vrs.push_front(Range(0, x, vrs[0].d));
	  }
	  hrs[0].d = x;
	}
      }
    }
  }
  //printf("sum=%lld\n", sum);

  printf("%lld\n", (ll)n * n - sum);
  return 0;
}


Measured memory_bytes: 3784
#include <bits/stdc++.h>
#define LL long long
using namespace std;
const int maxn = 1010;
int n;
LL x[maxn],y[maxn],u[maxn],v[maxn],bs[35];

LL power_int(int a, int b) {
  LL x = 1;
  while (b > 0) {x *= a;b--;}
  return x;
}

void work() {
  cin >> n;
  for (int i = 0; i < n; i++) cin >> x[i] >> y[i];

  LL parity = (x[0] + y[0]) % 2;

  for (int i = 0; i < n; i++) if ((x[i] + y[i] - parity) % 2 != 0) {cout<<"-1"<<endl;return;}

    if (parity == 0) {
      cout << 32 << endl;
      for (int i = 30; i > -1; i--) {
        cout << power_int(2, i) << " ";
      }
      cout << 1 << endl;
      for (int i = 0; i < n; i++) {
        x[i]++;
      }
    }
    else {
      cout << 31 << endl;
      for (int i = 30; i > -1; i--) {
        cout << power_int(2, i) << " ";
      }
      cout << endl;
    }

    for (int i = 0; i < n; i++) u[i] = x[i] + y[i], v[i] = x[i] - y[i];

    for (int i = 0; i < n; i++) {
        for (int j = 30; j > -1; j--) {
            if (u[i] > 0 && v[i] > 0) {cout << 'R'; u[i] -= power_int(2, j); v[i] -= power_int(2, j); }
            else if (u[i] > 0 && v[i] < 0) { cout << 'U'; u[i] -= power_int(2, j); v[i] += power_int(2, j); }
            else if (u[i] < 0 && v[i] > 0) { cout << 'D'; u[i] += power_int(2, j); v[i] -= power_int(2, j); }
            else { cout << 'L'; u[i] += power_int(2, j); v[i] += power_int(2, j);}
        }
        if (parity == 0) cout << 'L';
        cout << endl;
    }
}
int main(){
    work();
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <math.h>
#include <sstream>
#include <numeric>
#include <string>
#include <cassert>
#include <bitset>

using namespace std;
typedef long long ll;

int K;
int num_digits;
int cnt;
vector<int> digits;

void dfs(int depth, int d) {
  if (depth == num_digits - 1) {
    ++cnt;
    if (cnt == K) {
      for (auto x : digits) {
	cout << x;
      }
      cout << endl;
      exit(0);
    }
  } else {
    for (int nd = max(0, d - 1); nd <= min(9, d + 1); ++nd) {
      digits.push_back(nd);
      dfs(depth + 1, nd);
      digits.pop_back();
    }
  }
}

int main() {
  cin >> K;
  cnt = 0;
  for (num_digits = 1; num_digits <= 10; ++num_digits) {
    for (int d = 1; d < 10; ++d) {
      digits.push_back(d);
      dfs(0, d);
      digits.pop_back();
    }
  }
  return 0;
}


Measured memory_bytes: 256
N, K, C = map(int, input().split())
S = input()

cand_l = []
cnt = 0
rest = 0
for i in range(N):
    if S[i] == "o" and rest <= 0 and cnt < K:
        cand_l.append(i + 1)
        rest = C
        cnt += 1
    else:
        rest -= 1

cand_r = []
cnt = 0
rest = 0
for i in reversed(range(N)):
    if S[i] == "o" and rest <= 0 and cnt < K:
        cand_r.append(i + 1)
        rest = C
        cnt += 1
    else:
        rest -= 1

for l, r in zip(cand_l, cand_r[::-1]):
    if l == r:
        print(l)


Measured memory_bytes: 101244
using System;
using System.Collections.Generic;

namespace Application
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            var ans = new Dictionary<string, int> {
                { "SUN", 7 },
                { "MON", 6 },
                { "TUE", 5 },
                { "WED", 4 },
                { "THU", 3 },
                { "FRI", 2 },
                { "SAT", 1 },
            };

            Console.WriteLine(ans[Console.ReadLine()]);
        }
    }
}


Measured memory_bytes: 11104
N,A,B,C = map(int,input().split())
take = [int(input()) for i in range(N)]
INF = 10**9

def dfs(num,a,b,c):
  if num == N:
    return abs(a-A)+abs(b-B)+abs(c-C)-30 if min(a,b,c)>0 else INF
  ret0 = dfs(num+1,a,b,c)
  ret1 = dfs(num+1,a+take[num],b,c) + 10
  ret2 = dfs(num+1,a,b+take[num],c) + 10
  ret3 = dfs(num+1,a,b,c+take[num]) + 10
  return min(ret0,ret1,ret2,ret3)

print(dfs(0,0,0,0))
  

Measured memory_bytes: 43996
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <map>
#include <set>
#include <math.h>
#define rep(i,a,b) for(int i=(a); i<(b); ++i)
typedef long long ll;
using namespace std;

int main() {
    int a,b ;
    cin >> a >> b;
    cout << a*b << endl;
}

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

int main() {

    double N,K;
    cin>>N>>K;
    vector<int> a(N);
    for(int i=0;i<N;i++){
        cin>>a.at(i);
    }

    double stn = N-1;

    K--;
    double ans = ceil(stn/K);
    cout<<ans<<endl;




    return 0;
}



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

int main() {
	int n, d, a;
	cin >> n >> d >> a;
	vector<pair<int, int>> xh(n);
	rep(i, n){
		int x, h;
		cin >> x >> h;
		xh[i] = make_pair(x, (h + a - 1) / a);
	}
	sort(all(xh));
	ll tot = 0;
	ll cnt = 0;
	queue<pair<ll,ll>> q;
	for(int i = 0; i < n; i++){
		ll x = xh[i].first;
		ll h = xh[i].second;
		while(q.size() && q.front().first < x){
			tot -= q.front().second;
			q.pop();
		}
		h -= tot;
		if(h > 0) {
			cnt += h;
			tot += h;
			q.emplace(x+d*2, h);
		}
	}
	
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 3456
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;

namespace AizuOnlineJudge
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.ReadLine();

            var arr = Console.ReadLine().Split(' ').Select(double.Parse);
            var ab = Console.ReadLine().Split(' ').Select(double.Parse).Zip(arr, (a, b) => Math.Abs(a - b));

            var r1 = ab.Sum();
            var r2 = Math.Pow(ab.Select(e => Math.Pow(e, 2)).Sum(), 1.0 / 2.0);
            var r3 = Math.Pow(ab.Select(e => Math.Pow(e, 3)).Sum(), 1.0 / 3.0);
            var rinf = ab.Max();
            Console.WriteLine($"{r1:0.000000}\n{r2:0.000000}\n{r3:0.000000}\n{rinf:0.000000}");
        }
    }
}


Measured memory_bytes: 18568
#include <cmath>
#include <iostream>
#include <numeric>

using namespace std;

int main(void) {
  int N;
  cin >> N;
  int W_array[110];
  for (int i = 1; i <= N; i++) {
    cin >> W_array[i];
  }

  int min_abs = 1000;  // tekitou
  for (int T = 1; T < N; T++) {
    int S1 = 0;
    int S2 = 0;
    for (int j = 1; j <= T; j++) {
      S1 = S1 + W_array[j];
    }
    for (int k = T + 1; k <= N; k++) {
      S2 = S2 + W_array[k];
    }
    if (min_abs > abs(S1 - S2)) {
      min_abs = abs(S1 - S2);
    }
  }
  cout << min_abs << endl;
  return 0;
}


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

typedef enum {
  A = 0,
  G = 1,
  C = 2,
  T = 3,
} Gene;

long long kMod = 1e9+7;

int main()
{
  int n;
  cin >> n;
  vector<vector<vector<vector<long long>>>> dp(n, vector<vector<vector<long long>>>(4, vector<vector<long long>>(4, vector<long long>(4))));
  for (int x = 0; x < 4; x++) {
    for (int y = 0; y < 4; y++) {
      for (int z = 0; z < 4; z++) {
        if (          x == A && y == G && z == C) continue;
        if (          x == A && y == C && z == G) continue;
        if (          x == G && y == A && z == C) continue;
        dp.at(2).at(x).at(y).at(z) = 1;
      }
    }
  }
  for (int i = 3; i < n; i++) {
    for (int w = 0; w < 4; w++) {
      for (int x = 0; x < 4; x++) {
        for (int y = 0; y < 4; y++) {
          for (int z = 0; z < 4; z++) {
            if (w == A && x == G &&           z == C) continue;
            if (w == A &&           y == G && z == C) continue;
            if (          x == A && y == G && z == C) continue;
            if (          x == A && y == C && z == G) continue;
            if (          x == G && y == A && z == C) continue;
            dp.at(i).at(x).at(y).at(z) += dp.at(i-1).at(w).at(x).at(y);
            dp.at(i).at(x).at(y).at(z) %= kMod;
          }
        }
      }
    }
  }
  int res = 0;
  for (int x = 0; x < 4; x++) {
    for (int y = 0; y < 4; y++) {
      for (int z = 0; z < 4; z++) {
        res += dp.back().at(x).at(y).at(z);
        res %= kMod;
      }
    }
  }
  cout << res << '\n';
  return 0;
}


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

bool judgeBingo(int bingo[]){
  if (bingo[0] == bingo[1] && bingo[1] == bingo[2] && bingo[2] == bingo[0])
  {
    return true;
  }
  if (bingo[3] == bingo[4] && bingo[4] == bingo[5] && bingo[5] == bingo[3])
  {
    return true;
  }
  if (bingo[6] == bingo[7] && bingo[7] == bingo[8] && bingo[8] == bingo[6])
  {
    return true;
  }
  if (bingo[0] == bingo[3] && bingo[3] == bingo[6] && bingo[6] == bingo[0])
  {
    return true;
  }
  if (bingo[1] == bingo[4] && bingo[4] == bingo[7] && bingo[7] == bingo[1])
  {
    return true;
  }
  if (bingo[2] == bingo[5] && bingo[5] == bingo[8] && bingo[8] == bingo[2])
  {
    return true;
  }
  if (bingo[0] == bingo[4] && bingo[4] == bingo[8] && bingo[8] == bingo[0])
  {
    return true;
  }
  if (bingo[2] == bingo[4] && bingo[4] == bingo[6] && bingo[6] == bingo[2])
  {
    return true;
  }
  return false;
}

int main()
{
  int bingo[9];
  for (int i = 0; i < 3; i++)
  {
    for (int j = 0; j < 3; j++)
    {
      cin >> bingo[i*3 + j];
    }
  }

  int n;
  cin >> n;
  int array[n];
  for (int i = 0; i < n; i++)
  {
    cin >> array[i];
  }
  
  for (int i = 0; i < n; i++)
  {
    for (int j = 0; j < 9; j++)
    {
      if (array[i] == bingo[j])
      {
        bingo[j] = 0;
      }
    }
  }
  bool res = judgeBingo(bingo);
  if (res)
  {
    cout << "Yes" << "\n";
  }
  else
  {
    cout << "No" << "\n";
  }
  
  return 0;
}


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

int main() {
	std::string s1 = "\0";
	std::string s2 = "\0";
	std::string s3 = "\0";

	std::cin >> s1 >> s2 >> s3;

	std::cout << s1.substr(0,1) << s2.substr(0, 1) << s3.substr(0,1);

	return 0;
}

Measured memory_bytes: 256
N=int(input())
lis = list(map(int, input().split()))
ans=1
j=True
if lis.count(0) > 0:
    print(0)
else:
    for a in lis:
        ans*=a
        if ans > pow(10,18):
            j=False
            break
    if j:
        print(ans)
    else:
        print(-1)

Measured memory_bytes: 21472
a = [list(map(int, input().split())) for i in range(3)]
n = int(input())
b = [int(input()) for _ in range(n)]

if a[0][0] in b and a[0][1] in b and a[0][2] in b:
    print('Yes')
    exit()
if a[1][0] in b and a[1][1] in b and a[1][2] in b:
    print('Yes')
    exit()
if a[2][0] in b and a[2][1] in b and a[2][2] in b:
    print('Yes')
    exit()
if a[0][0] in b and a[1][0] in b and a[2][0] in b:
    print('Yes')
    exit()
if a[0][1] in b and a[1][1] in b and a[2][1] in b:
    print('Yes')
    exit()
if a[0][2] in b and a[1][2] in b and a[2][2] in b:
    print('Yes')
    exit()
if a[0][0] in b and a[1][1] in b and a[2][2] in b:
    print('Yes')
    exit()
if a[0][2] in b and a[1][1] in b and a[2][0] in b:
    print('Yes')
    exit()
print('No')


Measured memory_bytes: 38384