akhauriyash/Code-Regression huggingface dataset:
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int N = sc.nextInt();
        int sen = N/1000;
        int hyaku = (N/100)%10;
        int zyu = (N/10)%10;
        int one = N%10;
        boolean ans = false;
        if (hyaku == zyu) {
          if (sen == hyaku || zyu == one) {
            ans = true;
          }
        }
        if (ans) {
          System.out.println("Yes");
        } else {
		// 出力
		  System.out.println("No");
        }
	}
}

Measured memory_bytes: 21844
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    
    int N, D;
    cin >> N >> D;
    if(N % (2*D + 1) == 0){
        cout << N / (2*D + 1) << endl;        
    } else{
        cout << N / (2*D + 1) + 1 << endl;        
    }
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void){//float?????????double???
int i,j,h,w,a;
a=1;

while(a==1){
scanf("%d %d",&h,&w);
if(h==0&&w==0){
	break;
}
for(i=1;i<=h;i++){
	for(j=1;j<=w;j++){
		printf("#");
	}
	printf("\n");
}
printf("\n");
}
return 0;
}

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

using namespace std;

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

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

int main() {
  int N;
  cin >> N;
  map<int, int> mp;
  for (int i = 0; i < N; i++) {
    int a;
    cin >> a;
    mp[a]++;
  }
  int ans = 0;
  for (auto m : mp) {
    int x = m.first;
    int y = m.second;
    if (x <= y)
      ans += y - x;
    else
      ans += y;
  }
  cout << ans << endl;
}

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

int main(){
    ll x, y;
    cin >> x >> y;

    ll ans = 0, tmp = x;

    if (x <= y) ans++;

    while (tmp * 2 <= y) {
        tmp *= 2;
        ans++;
    }
    
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define exrep(i, a, b) for(long long i = a; i <= b; i++)
#define rep(i,n)for(long long i=0;i<(long long)(n);i++)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
 
const ll MOD=1e9+7;
const ll INF=1e18;
const int MAX=510000;
const double pi=acos(-1);
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
ll modpow(ll a, ll n){
  if(n==0)return 1;
  if(n%2==0){
    ll t=modpow(a,n/2);
    return t*t%MOD;
  }
  return a*modpow(a,n-1)%MOD;
}
ll modinv(ll a){
  return modpow(a,MOD-2);
}
long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
struct UnionFind {
    vector<int> par; // 親ノード
    vector<int> rank; // ランク

    UnionFind(int n = 1) {
        init(n);
    }

    void init(int n = 1) {
        par.resize(n); rank.resize(n);
        for (int i = 0; i < n; ++i) par[i] = i, rank[i] = 0;
    }

    int root(int x) {
        if (par[x] == x) {
            return x;
        }
        else {
            int r = root(par[x]);
            return par[x] = r;
        }
    }

    bool issame(int x, int y) {
        return root(x) == root(y);
    }

    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (rank[x] < rank[y]) swap(x, y);
        if (rank[x] == rank[y]) ++rank[x];
        par[y] = x;
        return true;
    }
};
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false); 
  
  vector<string> vec(8);
  vec[7]="SUN";
  vec[6]="MON";
  vec[5]="TUE";
  vec[4]="WED";
  vec[3]="THU";
  vec[2]="FRI";
  vec[1]="SAT";
  vec[0]="a";
  
  string t;
  cin >> t;
  rep(i,8){
    if(vec[i]==t)cout << i << endl;
  }
}


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

/**
 * 全ノード間の最短距離をもとめる
 * matrix[i][j]には辺e=(i,j)のコスト(辺が存在しない場合はINT_MAX)
 * 負の閉路がある場合は空を返す
 * O(|V|^3)
 */
std::vector<std::vector<int>> warshall_floyd(std::vector<std::vector<int>> matrix) {
    const unsigned long num_node = matrix.size();

    // 自分の距離は0
    for (int i = 0; i < num_node; ++i) {
        matrix.at(i).at(i) = 0;
    }

    for (int m = 0; m < num_node; ++m) {
        for (int s = 0; s < num_node; ++s) {
            for (int e = 0; e < num_node; ++e) {
                // sからeへmを経由して到達可能
                if (matrix.at(s).at(m) != INT_MAX and matrix.at(m).at(e) != INT_MAX) {
                    matrix.at(s).at(e) = std::min(matrix.at(s).at(e), matrix.at(s).at(m) + matrix.at(m).at(e));
                }
            }
        }
    }

    // 負閉路チェック
    for (int u = 0; u < num_node; ++u) {
        if (matrix.at(u).at(u) < 0) {
            return {};
        }
    }

    return matrix;
}

using namespace std;

int main(void) {
    int V, E;
    cin >> V >> E;

    vector<vector<int>> matrix(V, vector<int>(V, INT_MAX));
    for (int i = 0; i < E; ++i) {
        int s, t, d;
        cin >> s >> t >> d;
        matrix[s][t] = d;
    }

    matrix = warshall_floyd(matrix);
    if (matrix.empty()) {
        cout << "NEGATIVE CYCLE" << endl;
        return 0;
    }

    for (int i = 0; i < V; ++i) {
        for (int j = 0; j < V; ++j) {
            if (j != 0) {
                cout << " ";
            }
            if (matrix[i][j] == INT_MAX) {
                cout << "INF";
            } else {
                cout << matrix[i][j];
            }
        }
        cout << endl;
    }

    return 0;
}


Measured memory_bytes: 3236
import sys
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def II(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def SI(): return input()
YN = lambda b: print('YES') if b else print('NO')
yn = lambda b: print('Yes') if b else print('No')

def main():
    N, K = LI()
    V_li = LI()

    maximum = 0
    for take_count in range(min(K+1, N)):
        for take_left in range(take_count+1):
            # if take_left > N: break
            took = V_li[:take_left] + ([] if take_count == take_left else V_li[-(take_count - take_left):])
            took = sorted(took)
            for trash_count in range(K - take_count):
                if took and took[0] < 0:
                    took.pop(0)
                else:
                    break
            if not took:  # empty
                 took = [0]
            # print(took)
            maximum = max(maximum, sum(took))
    if N==1:
        maximum = max(0, V_li[0])
    if K >= N:
        maximum = max(maximum, sum(V_li))

    print(maximum)


main()

Measured memory_bytes: 3188
/*
--------------              |   /
      |                     |  /
      |                     | /
      |             *       |/          |    |         ------            *
      |                     |           |    |        /      \
      |             |       |\          |    |       |       |\          |
   \  |             |       | \         |    |       |       | \         |
    \ |             |       |  \        |    |        \     /   \        |
     V              |       |   \        \__/|         -----     \       |
*/
#include <bits/stdc++.h>
using namespace std;

#define EmiliaMyWife ios::sync_with_stdio(0); cin.tie(NULL);
#define endl '\n'
#define mem(i,j) memset(i,j,sizeof (i));
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(), (a).end()
#define bit(s,i) (((s)>>(i))&1LL)
#define lowbit(x) ((x)&(-(x)))
#define siz(v) (long long)(v).size()
typedef int64_t ll;
typedef uint64_t ull;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
const double EPS  = 1e-8;
const int INF     = 0x3F3F3F3F;
const ll LINF     = 4611686018427387903;
const int MOD     = 1e9+7;
const int MAXN    = 2e5+9;
/*-----------------------------------------------------------------------------------------------------*/

signed main() {
	EmiliaMyWife

	ll n, r;
	cin >> n >> r;
	cout << max(r, r+(100*(10-n)));


	return 0;
}


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

#define repr(i,a,b) for (int i=a; i<b; i++)
#define rep(i,n) for (int i=0; i<  n; i++)
 
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
 
const long long INF = 1LL << 60;
#define PI 3.14159265359 
bool dp[100100];

template<typename T>
void remove(std::vector<T>& vector, unsigned int index)
{
    vector.erase(vector.begin() + index);
}
 

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

    rep(i,max(a,b)){
        cout << min(a,b);
    }
    cout << endl;



}




Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
	int a, b;
	cin >> a >> b;
	if (a == b) {
		cout << "Draw" << endl;
		return 0;
	}
	if (a == 1) {
		cout << "Alice" << endl;
	} else if (b == 1) {
		cout << "Bob" << endl;
	} else {
		if (a < b) {
			cout << "Bob" << endl;
		} else {
			cout << "Alice" << endl;
		}
	}
	return 0;
}


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

struct Combination{
    vector<ll> fac,finv,inv;
    Combination(int mx){init(mx);}
    void init(int mx){
        fac.resize(mx+1);
        finv.resize(mx+1);
        inv.resize(mx+1);
        fac[0]=fac[1]=1;
        finv[0]=finv[1]=1;
        inv[1]=1;
        for(int i=2;i<=mx;i++){
            fac[i]=fac[i-1]*i%mod;
            inv[i]=mod-inv[mod%i]*(mod/i)%mod;
            finv[i]=finv[i-1]*inv[i]%mod;
        }
    }
    ll operator()(int n,int k){
        if(n<k)return 0;
        return fac[n]*(finv[k]*finv[n-k]%mod)%mod;
    }
};

int main(){
    int n,k;
    cin>>n>>k;
    Combination comb(n);
    for(int i=1;i<=k;++i){
        if(n-k<i-1)cout<<0<<endl;
        else cout<<(comb(k-1,k-i)*comb(n-k+1,n-k-i+1))%mod<<endl;
    }
}


Measured memory_bytes: 256
import bisect
import sys
sys.setrecursionlimit(10**7)
INTMAX = 9223372036854775807
INTMIN = -9223372036854775808
DVSR = 1000000007
def POW(x, y): return pow(x, y, DVSR)
def INV(x, d=DVSR): return pow(x, d - 2, d)
def DIV(x, y, d=DVSR): return (x * INV(y, d)) % d
def LI(): return [int(x) for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LS(): return input().split()
def II(): return int(input())

N=II()
INL=[]
for i in range(N):
    INL.append(II())
INL2=list(sorted(INL))
M = INL2[-1]

for i in INL:
    if i == M:
        if INL2[-2] == M:
            print(M)
        else:
            print(INL2[-2])
    else:
        print(M)


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

int main(){
int d[3];
  for(int i=0;i<3;i++) cin >> d[i];
  sort(d,d+3);
  int a=d[0];
  int b=d[1];
  int c=d[2];
  int count=0;

count+=c-b;
a+=c-b;  
if((c-a)%2==0)count+=(c-a)/2;
else{
  count+=(c-a)/2+2;
}


  cout << count << endl;
}


Measured memory_bytes: 3604
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <deque>
#include <cstdio>
#include <set>
#include <map>
#include <bitset>
#include <stack>
using namespace std;
int main(){
	long long co = 1, ans = 0;
	int n;
	int a[100010];
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	sort(a, a + n);
	for (int j = 0; j < n; j++) {
		if (a[j] != a[j + 1] || j == n - 1) {
			if (co > a[j]) {
				ans += co - a[j];
			}
			else if (co < a[j]) {
				ans += co;
			}
			co = 1;
		}
		else {
			co++;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 640
n = int(input())
lis = list(map(int, input().split()))
if abs(max(lis)) >= abs(min(lis)):
    ind = lis.index(max(lis)) + 1
else:
    ind = lis.index(min(lis)) + 1
opere = []
if lis[ind-1] > 0:
    for i in range(1, n+1):
        opere.append([ind, i])
    for i in range(1, n):
        opere.append([i, i + 1])
else:
    for i in range(1, n+1):
        opere.append([ind, i])
    for i in range(n-1):
        opere.append([n-i, n-i-1])

print(2*n-1)
if opere:
    for i in opere:
        print(" ".join(list(map(str, i))))

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MAX 100005
ll N,M,x;
ll a[MAX],b[MAX];
ll A[MAX],B[MAX];
vector<ll> s,t,p;

int main(){  
  cin>>N>>M;
  s.resize(N);
  t.resize(N);
  for(int i=0;i<N;i++){
    cin>>s[i]>>t[i];
  }
  for(int i=0;i<M;i++){
    cin>>x;
    p.push_back(x);
  }
  p.push_back(0);
  p.push_back(1e9);
  sort(p.begin(),p.end());

  for(int i=0;i+1<(int)p.size();i++){
    if(i%2)a[i]=p[i+1]-p[i];
    else b[i]=p[i+1]-p[i];
  }
  A[0]=a[0];
  B[0]=b[0];
  for(int i=0;i<(int)p.size();i++){
    A[i]=A[i-1]+a[i];
    B[i]=B[i-1]+b[i];
  }
  
  ll ans=0;
  for(int i=0;i<N;i++){
    ll si=upper_bound(p.begin(),p.end(),s[i])-p.begin()-1;
    ll ti=upper_bound(p.begin(),p.end(),t[i])-p.begin()-1;

    if(s[i]<t[i]){
      ans-=(s[i]-p[si]);
      if(a[si]>0){
	ans+=A[ti];
	if(si)ans-=A[si-1];
	if(a[ti]>0)ans-=(p[ti+1]-t[i]);
      }else if(b[si]>0){
	ans+=B[ti];
	if(si)ans-=B[si-1];
	if(b[ti]>0)ans-=(p[ti+1]-t[i]);
      }
    }else{
      if(s[i]==p[si])si--;
      ans-=(p[si+1]-s[i]);
      if(a[si]>0){
	ans+=A[si];
	if(ti)ans-=A[ti-1];
	if(a[ti]>0)ans-=(t[i]-p[ti]);
      }else{
	ans+=B[si];
	if(ti)ans-=B[ti-1];
	if(b[ti]>0)ans-=(t[i]-p[ti]);	
      }      
    }

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

Measured memory_bytes: 6804
use std::io;
use std::io::{Read, Stdin};
use std::str;
use std::str::FromStr;
use std::usize;
use std::fmt::Debug;

fn main() {
    let mut sc = Scanner::new();
    let n = sc.parse::<usize>();
    let a = (0..n).map(|_| {
        return sc.parse::<i32>();
    }).collect::<Vec<i32>>();

    let mut count = vec![0; 2];
    for x in &a {
        if x % 4 == 0 {
            count[0] += 1;
        } else if x % 2 != 0 {
            count[1] += 1;
        }
    }
    if count[0] >= count[1] || (count[0] + 1 == count[1] && count[0] + count[1] == n) {
        println!("Yes");
    } else { println!("No"); }
}

struct Scanner {
    stdin: Stdin,
    buf: Vec<u8>,
}

impl Scanner {
    fn new() -> Scanner {
        Scanner {
            stdin: io::stdin(),
            buf: Vec::with_capacity(256),
        }
    }

    fn parse<T: FromStr>(&mut self) -> T
        where <T as FromStr>::Err: Debug
    {
        self.buf.clear();
        let mut it = self.stdin.lock().bytes();
        let mut c = it.next().unwrap().unwrap();
        while c == ' ' as u8 || c == '\n' as u8 {
            c = it.next().unwrap().unwrap();
        }
        while !(c == ' ' as u8 || c == '\n' as u8) {
            self.buf.push(c);
            c = it.next().unwrap().unwrap();
        }
        str::from_utf8(&self.buf).unwrap().parse::<T>().unwrap()
    }
}

Measured memory_bytes: 4352
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
int n,a[100005],sum=0,head;
void f1()
{
	for(int i=head+1;i<=n;i++)
	{
		if(a[i]<a[i+1]) 
		{
		    sum++;
		    head=i+1;
			break;
		}
		if(i==n)
		{
			sum++;
		    head=i+1;
			break;
		}
	}
}
void f2()
{
	for(int i=head+1;i<=n;i++)
	{
		if(a[i]>a[i+1]) 
		{
		    sum++;
		    head=i+1;
			break;
		}
		if(i==n)
		{
			sum++;
		    head=i+1;
			break;
		}
	}
}
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
       cin>>a[i];
    head=1;
    while(head!=n)
    {
    	
    	if(head>n) break;
    	if(a[head]>a[head+1])
    	{
    		f1();
		}
		if(a[head]<a[head+1])
		{
			f2();
		}
		if(a[head]==a[head+1])
		{
			head++;
		}

	}
	if(head==n) sum++;
	cout<<sum;
	return 0;
} 

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

#define each(i, c) for (auto& i : c)
#define mkp(a, b) make_pair(a, b)

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> Pll;
const ll MOD = 1e9+7;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << ": " << p.second << ")"; return os; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; each (i, v) os << i << ", "; os << ")"; return os; }
template<typename K, typename V> ostream& operator << (ostream& os, map<K, V> m) { os << "{"; each (i, m) os << i << ", "; os << "}"; return os; }

class modint {
  private:
    ll m_val;
    ll m_mod;
  public:
    constexpr modint() : m_val(0), m_mod() { m_mod = MOD; }
    constexpr modint(const ll x) : m_val(0), m_mod(0) { m_mod = MOD; m_val = x % m_mod; }
    constexpr modint(const ll x, const ll mod) : m_val(0), m_mod(0) { m_mod = mod; m_val = x % m_mod; }
    constexpr ll val() const { return m_val; }
    constexpr modint operator+(const modint &rhs) const { return modint(*this) += rhs; }
    constexpr modint operator-(const modint &rhs) const { return modint(*this) -= rhs; }
    constexpr modint operator*(const modint &rhs) const { return modint(*this) *= rhs; }
    constexpr modint operator/(const modint &rhs) const { return modint(*this) /= rhs; }
    constexpr modint &operator+=(const modint &rhs) {
      m_val += rhs.m_val;
      if (m_val >= m_mod) m_val -= m_mod;
      return *this;
    }
    constexpr modint &operator-=(const modint &rhs) {
      if (m_val < rhs.m_val) m_val += m_mod;
      m_val -= rhs.m_val;
      return *this;
    }
    constexpr modint &operator*=(const modint &rhs) {
      m_val = m_val * rhs.m_val % m_mod;
      return *this;
    }
    constexpr modint &operator/=(const modint &rhs) {
      *this *= rhs.pow(m_mod - 2);
      return *this;
    }
    constexpr modint pow(ll n) const {
      if (n == 0) return 1;
      modint o = pow(n >> 1);
      o *= o;
      if (n & 1) o *= *this;
      return o;
    }
    friend ostream& operator<<(ostream& os, const modint &a) { os << a.val(); return os; }
};

ll modpow(ll x, ll n) {
  ll res = 1;
  while (n != 0){
    if (n & 1) res = res * x % MOD;
    x = x * x % MOD;
    n = n >> 1;
  }
  return res;
}

const ll FAC_MAX = 1e6+10;
vector<ll> fac(FAC_MAX);
vector<ll> invfac(FAC_MAX);
void init_fac() {
  fac[0] = 1;
  invfac[0] = 1;
  for (ll i = 0; i < FAC_MAX; i++) {
    fac[i+1] = fac[i] * (i+1) % MOD;
    invfac[i+1] = invfac[i] * modpow(i+1, MOD-2) % MOD;
  }
}

ll comb(ll n, ll r) { // nCr: O(n)
  if (n == 0 && r == 0) return 1;
  if (n < r || n < 0) return 0;
  ll res = invfac[n-r] * invfac[r] % MOD;
  return res * fac[n] % MOD;
}

int main() {
  ll x, y;
  cin >> x >> y;

  ll n = 0, m = 0;
  n = (2*x-y)/3;
  m = (2*y-x)/3;

  if (n < 0 || m < 0 || (x+y)%3 != 0) {
    cout << 0 << endl;
    return 0;
  }

  init_fac();
  cout << comb(n+m, n) << endl;

  return 0;
}


Measured memory_bytes: 15872
n,k = map(int,input().split())

if k > (n-1)*(n-2)//2:
    print(-1)
    exit()

b = (n-1)*(n-2)//2-k

print(b+n-1)
for i in range(n-1):
    print(1,i+2)

a = 2
d = 3
for i in range(b):
    print(a,d)
    if d == n:
        a += 1
        d = a+1
    else:
        d += 1

Measured memory_bytes: 3608
#include <stdio.h>

#define MAX_X 600

int main(void)
{
	int d;
	int i;
	int j;
	int num;
	int integral;
	int z=0;
		

	while(~scanf("%d", &d)){

		integral = 0;
		j=1;

		

		num = MAX_X / d;

		for(i=0; i<num-1; i++){

			integral = integral + (j*d)*(j*d)*d;
			j++;

		}


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

		
	}


	return 0;
}

Measured memory_bytes: 596
///////////////////////////////////////////////////////////
#include <algorithm>
#include <array>
#include <iostream>
#include <numeric>
#include <string>
#include <vector>
using namespace std;
///////////////////////////////////////////////////////////
#define ll long long
#define ull unsigned lon long
///////////////////////////////////////////////////////////
int absolute(int n); double absolute(double n);
void input(vector<int>& vec);
void print(vector<int> vec); void print(vector<double> vec);
int sum(vector<int> vec); double sum(vector<double> vec);
void upsort(vector<int>& vec);
void downsort(vector<int>& vec);
int maxvec(vector<int> vec);
int minvec(vector<int> vec);
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
int main()
{
    int a, b, c;
    cin>>a>>b>>c;
    int d=b/a;
    cout << min(c,d) << endl;
    return 0;
}
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
int absolute(int n)
{
    if (n < 0) {
        return (-n);
    }
    return n;
}

double absolute(double n)
{
    if (n < 0) {
        return (-n);
    }
    return n;
}

void input(vector<int>& vec)
{
    for (size_t i = 0; i < vec.size(); ++i) {
        cin >> vec.at(i);
    }
}

void print(vector<int> vec)
{
    for (size_t i = 0; i < vec.size(); ++i) {
        cout << vec.at(i) << " ";
    }
    cout << endl;
}

void print(vector<double> vec)
{
    for (size_t i = 0; i < vec.size(); ++i) {
        cout << vec.at(i) << " ";
    }
    cout << endl;
}

int sum(vector<int> vec)
{
    int s = accumulate(vec.begin(), vec.end(), 0);
    return s;
}

double sum(vector<double> vec)
{
    double s = accumulate(vec.begin(), vec.end(), 0.0);
    return s;
}

void upsort(vector<int>& vec)
{
    sort(vec.begin(), vec.end());
}

void downsort(vector<int>& vec)
{
    sort(vec.begin(), vec.end(), greater<int>());
}

int maxvec(vector<int> vec)
{
    int m = vec.at(0);
    for (size_t i = 0; i < vec.size(); ++i) {
        m = max(m, vec.at(i));
    }
    return m;
}

int minvec(vector<int> vec)
{
    int m = vec.at(0);
    for (size_t i = 0; i < vec.size(); ++i) {
        m = min(m, vec.at(i));
    }
    return m;
}
///////////////////////////////////////////////////////////

Measured memory_bytes: 256
#include <stdio.h>

int main()
{
   int a,b,c;
   scanf("%d", &a);
   scanf("%d", &b);
   c = a + b;
   
   if(a%3 == 0 || b%3==0 || c%3==0){
   printf("Possible");
   }else{
   printf("Impossible");
   }
   
   return 0;
}

Measured memory_bytes: 128
fun main(args: Array<String>) {
    abc147c()
}

private fun bits(x: Int): Int {
    var ret = 1
    repeat(x) { ret *= 2 }
    return ret - 1
}

fun abc147c() {
    val n = readLine()!!.toInt()
    val xyList = mutableListOf<List<Pair<Int, Boolean>>>()
    (1..n).forEach { i ->
        val num = readLine()!!.toInt()
        xyList.add((1..num).map { readLine()!!.split(' ').map { it.toInt() } }
            .map { Pair(it[0] - 1, it[1] == 1) })
    }

    var answer = 0
    for (i in 0..bits(n)) {
        val list = BooleanArray(n)
        (0 until n).forEach {
            list[it] = (i shr it) % 2 == 0
        }

        val all = xyList.withIndex().all { iv ->
            val youHonest = list[iv.index]
            iv.value.all {
                val (he, heHonest) = it
                 if (youHonest)list[he] ==  heHonest else true
            }
        }

        if (all) {
            answer = Math.max(answer, list.count { it })
        }
    }

    println(answer)
}


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

int main(){
    int A,B;
    cin >> A >> B;
    int i = 1;
    while(true){
        if ((A * i - i + 1) >= B) break;
        i++;
    }
    if (B == 1) cout << 0 << endl;
    else cout << i << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0;i < (n);i++)
#define rrep(i,n) for (int i = (n - 1);i >= 0;i--)
#define all(v) v.begin(),v.end()
using namespace std;
using ll = long long;
using P = pair<int,int>;
using vi = vector<int>;
using vvi = vector<vi>;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a,b;
    cin >> a >> b;
    if(a==b) cout << "IMPOSSIBLE" << endl;
    else if((a % 2 == 0 && b % 2 == 0)||(a%2==1&&b%2==1)){
        cout << (a+b)/2 << endl;
    }else{
        cout << "IMPOSSIBLE" << endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
#include <queue>
#include <stack>

using namespace std;

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

const ll mod = 1000000007;

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

  ll n, a, b;
  cin >> n >> a >> b;

  ll ab = a + b;
  ll loop = n / ab;
  ll remaining = n - ab * loop;

  ll bc = a * loop;
  ll ans = bc + min(remaining, a);

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define reps(i,n) for(int i=1;i<(int)(n);i++)

typedef long long ll;
using namespace std;
int main()
{
  ll n,a[110];
  cin>>n;
  rep(i,n)cin>>a[i];
  ll cnt[9]={0};
  rep(i,n){
    if(a[i]>=1&&a[i]<400){
      cnt[0]++;
    }else if(a[i]>=400&&a[i]<800){
      cnt[1]++;
    }else if(a[i]>=800&&a[i]<1200){
      cnt[2]++;
    }else if(a[i]>=1200&&a[i]<1600){
      cnt[3]++;
    }else if(a[i]>=1600&&a[i]<2000){
      cnt[4]++;
    }else if(a[i]>=2000&&a[i]<2400){
      cnt[5]++;
    }else if(a[i]>=2400&&a[i]<2800){
      cnt[6]++;
    }else if(a[i]>=2800&&a[i]<3200){
      cnt[7]++;
    }else if(a[i]>=3200){
      cnt[8]++;
    }
  }
  ll m=0;
  rep(i,8){
    if(cnt[i]>0)m++;
  }

  cout<<max(1LL,m)<<" "<<m+cnt[8]<<endl;
  return 0;
}


Measured memory_bytes: 3588
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		try(Scanner sc = new Scanner(System.in)) {
			
			int x = sc.nextInt();
			
			int max = 100003;
			
			int[] nums = new int[max + 1];
			
			int current = 2;
			
			while(current <= max ) {
				
				if ( nums[current] == 1 ) {
					current++;
					continue;
				}
				
				int mult = current * 2;
				while( mult <= max) {
					nums[mult] = 1; // not prime number
					mult += current;
				}
				
				current++;
			}
			
			while(x <= max) {
				if ( nums[x] == 1 ) {
					x++;
				}
				else {
					System.out.println(x);
					return;
				}
			}
		}
	}
}

Measured memory_bytes: 36924
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.HashSet;
import java.util.StringTokenizer;

public class Main {


    public static void main(String[] args) throws IOException {
        Scanner s = new Scanner(System.in);
        int d = s.nextInt();
        if(d==22) System.out.println("Christmas Eve Eve Eve");
        else if(d==23) System.out.println("Christmas Eve Eve ");
        else if(d==24) System.out.println("Christmas Eve ");
        else System.out.println("Christmas ");
    }




}


class Scanner
{
    StringTokenizer st;
    BufferedReader br;

    public Scanner(InputStream s){	br = new BufferedReader(new InputStreamReader(s));}

    public String next() throws IOException
    {
        while (st == null || !st.hasMoreTokens())
            st = new StringTokenizer(br.readLine());
        return st.nextToken();
    }

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

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

    public String nextLine() throws IOException {return br.readLine();}

    public double nextDouble() throws IOException
    {
        String x = next();
        StringBuilder sb = new StringBuilder("0");
        double res = 0, f = 1;
        boolean dec = false, neg = false;
        int start = 0;
        if(x.charAt(0) == '-')
        {
            neg = true;
            start++;
        }
        for(int i = start; i < x.length(); i++)
            if(x.charAt(i) == '.')
            {
                res = Long.parseLong(sb.toString());
                sb = new StringBuilder("0");
                dec = true;
            }
            else
            {
                sb.append(x.charAt(i));
                if(dec)
                    f *= 10;
            }
        res += Long.parseLong(sb.toString()) / f;
        return res * (neg?-1:1);
    }

    public boolean ready() throws IOException {return br.ready();}


}

Measured memory_bytes: 25276
#include"bits/stdc++.h"
using namespace std;
#define ll long long
#define FOR(i, j, k, in) for (int i=j ; i<k ; i+=in)
#define RFOR(i, j, k, in) for (int i=j ; i>=k ; i-=in)
#define rep(i, j) FOR(i, 0, j, 1)
#define rrep(i, j) RFOR(i, j, 0, 1)
#define MP make_pair
#define PB push_back
#define INF (int)1e9
#define endl "\n"
#define MOD 1000000007
#define DEB(x) cout<<"##"<<x<<"##"<<endl;
void solve()
{ 
	int n,x,y;
	cin>>n;
	int a[n],b[n];
	rep(i,n)
	{
		cin>>a[i]>>b[i];
	}
	sort(a,a+n);
	sort(b,b+n);
	if(n&1)
	{
		x=a[n/2];
		y=b[n/2];
	}
	else
	{
		x=a[n/2]+a[n/2-1];
		y=b[n/2]+b[n/2-1];
	}
	cout<<y-x+1;
} 
int main()
{
	ios_base::sync_with_stdio(false); cin.tie(NULL);
	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	#endif
	int tt=1;
	//cin>>tt;
	while(tt--)
	solve(); 	
	return 0;
}


Measured memory_bytes: 5224
#include<bits/stdc++.h>
using namespace std;
struct linear_base
{
	long long a[66],mxlog;
	void Insert(long long x)
	{
		for (long long i=mxlog;i>=0;i--)
		{
			if (x&(1ll<<i))
			{
				if (!a[i]) 
				{
					a[i]=x;
					return;
				}
				else x^=a[i];
			}
		}
	}
	bool check(long long x)
	{
		for (long long i=mxlog;i>=0;i--)
		{
			if (x&(1ll<<i))
			{
				if (!a[i]) return 0;
				else x^=a[i];
			}
		}
		return 1;
	}
	void merge(const linear_base &b) 
	{
		for (long long i=mxlog;i>=0;i--) 
		{
			if (b.a[i]) Insert(b.a[i]);
		}
	}
	long long findmax(int Xor)
	{
		long long res=Xor;
		for (long long i=mxlog;i>=0;i--) 
		{
			if ((res^a[i])>res) res^=a[i];
		}
		return res;
	}
	long long findmin()
	{
		for (long long i=0;i<=mxlog;i++)
		{
			if (a[i]) return a[i];
		}
	}
	long long findkth(long long k)
	{
		long long tmp[66],cnt=0,res=0;
		for (long long i=0;i<=mxlog;i++)
		{
			for (long long j=i-1;j>=0;j--)
			{
				if (a[i]&(1ll<<j)) a[i]^=a[j];
			}
			if (a[i]) tmp[cnt++]=a[i];
		}
		for (long long i=0;i<cnt;i++)
		{
			if (k&(1ll<<i)) res^=tmp[i];
		}
		return res;
	}
}l;
int test,n;
long long a[222];
char s[222];
bool flg;
int main()
{
	l.mxlog=60;
	scanf("%d",&test);
	while(test--)
	{
		scanf("%d",&n);
		for (int i=1;i<=n;i++)
		{
			scanf("%lld",&a[i]);
		}
		for (int i=0;i<=l.mxlog;i++) l.a[i]=0;
		scanf("%s",s);flg=0;
		for (int i=n-1;i>=0;i--)
		{
			if (s[i]=='1')
			{
				if (!l.check(a[i+1])) 
				{
					flg=1;
					break;
				}
			}
			else
			{
				l.Insert(a[i+1]); 
			}
		}
		if (flg) printf("1\n");
		else printf("0\n");
	}
	return 0;
}

Measured memory_bytes: 3764
N = int(input())
A = list(map(int, input().split()))
B = [-1 for i in range(2*100000)]

ans = 0
for a in A:
    B[a-1] += 1

    if B[a-1] != 0:
        ans += B[a-1]


A.append(0)
ans -= B[A[0] - 1]
for k in range(N):
    print(ans)
    ans += B[A[k] - 1] - B[A[k+1] - 1]



Measured memory_bytes: 26268
#include<iostream>
using namespace std;
int main(){
  int a,b;
  cin >> a >> b;
  if(a==1){
    if(b==2){
      cout << 3 << endl;
    }
    else if(b==3){
      cout << 2 << endl;
    }
  }
  else if(a==2){
    if(b==1){
      cout << 3 << endl;
    }
    else if(b==3){
      cout << 1 << endl;
    }
  }
  else if(a==3){
      if(b==1){
        cout << 2 << endl;
      }
      else if(b==2){
        cout << 1 << endl;
      }
  }
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<array>
#include<algorithm>
#include<list>
#include<cmath>
#include<iomanip>
#include<queue>
#include<functional>
#include<climits>
#include<iterator>
#include<unordered_set>
#include<unordered_map>
using namespace std;

const double pi=4*atan(1.0);

constexpr long long mod=static_cast<long long>(1e9+7);

using cEdges=vector<vector<int>>;

int main() {
	long long a[3];
	cin>>a[0]>>a[1]>>a[2];
	sort(begin(a),end(a));
	if(a[0]%2==0 || a[1]%2==0 || a[2]%2==0){
		cout<<0<<endl;
	}
	else{
		cout<<a[0]*a[1]<<endl;
	}

	//system("pause");
	return 0;
}

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

#define ll long long
#define ld long double

using namespace std; 
void solve(); 
int main() 
{ 
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL); 
  
    int t = 1; 
    // cin >> t; 
    while (t--) { 
        solve(); 
    } 
  
    cerr << "time taken : " << (float)clock() / CLOCKS_PER_SEC << " secs" << endl; 
    return 0; 
} 

void solve() 
{ 
	int a, b;
    cin >> a >> b;

    int ans = ceil((b - 1) / (double)(a - 1));

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

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>

static const int MOD = 1000000007;
using ll = int64_t;
using u32 = uint32_t;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

int main() {
    int Q;
    cin >> Q;
    for (int i = 0; i < Q; ++i) {
        ll a, b;
        cin >> a >> b;
        ll c = 0, notc = INF<int>;
        if(a > b) swap(a, b);
        if(llabs(b-a) <= 1) {
            cout << 2*a-2 << "\n";
            continue;
        }
        while(notc - c > 1){
            ll mid = (c+notc)/2;
            if(mid*mid < a*b) c = mid;
            else notc = mid;
        }
        if(c*(c+1) < a*b) cout << 2*c-1 << "\n";
        else cout << 2*c-2 << "\n";
    }
    return 0;
}


Measured memory_bytes: 256
/*** author: yuji9511 ***/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> lpair;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i = (m); i < (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define print2(x,y) cout << (x) << " " << (y) << endl;
#define printa(x,n) for(ll i = 0; i < n; i++){ cout << (x[i]) << " \n"[i==n-1];};
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N;
    cin >> N;
    double A[110];
    rep(i,0,N) cin >> A[i];
    double bunbo = 1;
    rep(i,0,N) bunbo *= A[i];
    double bunshi = 0.0;
    rep(i,0,N){
        double v = 1;
        rep(j,0,N){
            if(i == j) continue;
            v *= A[j];
        }
        bunshi += v;
    }
    double ans = bunbo / bunshi;
    cout << setprecision(10) << ans << endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rrep(i, n) for (int i = (n - 1); i >= 0; i--)
#define ALL(v) v.begin(), v.end()
using namespace std;
using P = pair<int, int>;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const ll INF = (1LL << 60);
int n, m;

struct Edge {
  int from, to;
  ll cost;
};

vector<Edge> v;
ll dist[2200];
bool negative[2200];

void bellman_ford(int start){
  rep(i, n) dist[i] = INF;
  dist[start] = 0;
  for (int i = 0; i < n; i++){
    for (int j = 0; j < v.size(); j++){
      Edge e = v[j];
      if(dist[e.from] != INF && dist[e.to] > dist[e.from] + e.cost){
        dist[e.to] = dist[e.from] + e.cost;
      }
    }
  }
  return;
}

void negative_loop(){
  rep(i, n) negative[i] = false;
  rep(i, n){
    for (int j = 0; j < v.size(); j++){
      Edge e = v[j];
      if(dist[e.to] != INF && dist[e.to] > dist[e.from] + e.cost){
        dist[e.to] = dist[e.from] + e.cost;
        negative[e.to] = true;
      }
      if(negative[e.from])negative[e.to] = true;
    }
  }
}

int main() {
  cin >> n >> m;
  rep(i, m){
    int a, b;
    ll c;
    cin >> a >> b >> c;
    a--, b--;
    v.push_back((Edge{a, b, -c}));
  }
  bellman_ford(0);
  ll ans = -dist[n-1];
  negative_loop();
  if(negative[n-1]){
    cout << "inf" << endl;
  }else{
    cout << ans << endl;
  }
}

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

using namespace std;

int main( )
{	
    int n;
    cin>>n;
    
    vector<int> A(n);
    
    for( int i=0; i<n; i++ ) {
    	cin>>A[i];
    }
    int cnt = 0, minj;
    for( int i=0; i<n; i++ ) {
    	minj = i;
    	for( int j=i; j<n; j++ ) {
    		if( A[j] < A[minj] ) {
				minj = j;
    		}
    	}
    	if( i != minj ) {
    		swap( A[i], A[ minj ] );
    		cnt++;
    	}
    }
    for( int i=0; i<n; i++ ) {
    	cout<<A[i];
    	if( i != n-1 ) { cout<<" "; }
    }
    cout<<"\n"<<cnt<<endl;
	
	return 0;
}

Measured memory_bytes: 1200
#include<iostream>
#include <fstream>
#include <vector>

#define LOCAL  1
#define UPLOAD 2

using namespace std;

int main()
{
#if ENVIRONMENT == LOCAL
    std::ifstream in("input.txt");
    std::cin.rdbuf(in.rdbuf());
#endif

    int N;
    string S;
    int K;
    cin >> N;
    cin >> S;
    cin >> K;

    for(int i=0;i<N;i++){
        if(S[i] != S[K-1]){
            S[i] = '*';
        }
    }
    
    cout << S << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7;

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

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

int N, A, B, C;
vector<int> l;

int dfs(int itr, int a, int b, int c) {
  /* itr番目の竹までで、Aの材料の長さの合計がa、……のときの使用MP */
  if (itr == N) {
    if (min(a, min(b, c)) > 0)
      return abs(a - A) + abs(b - B) + abs(c - C);
    else
      return INF;
  }
  int next = dfs(itr + 1, a, b, c);
  chmin(next, dfs(itr + 1, a + l[itr], b, c) + (a == 0 ? 0 : 10));
  chmin(next, dfs(itr + 1, a, b + l[itr], c) + (b == 0 ? 0 : 10));
  chmin(next, dfs(itr + 1, a, b, c + l[itr]) + (c == 0 ? 0 : 10));
  return next;
}

int main() {
  cin >> N >> A >> B >> C;
  l.resize(N);
  rep(i, N) cin >> l[i];

  cout << dfs(0, 0, 0, 0) << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<vector>
#include<algorithm>
using namespace std;
#define SZ(v) ((int)(v).size())
#define rep(i,n) for(int i=0;i<(n);i++)
#define foreach(it,c) for(__typeof(c.begin()) it=c.begin();it!=c.end();it++)
#define all(v) (v).begin(),(v).end()
typedef long long ll;
typedef unsigned uint;
const int INF=0x3f3f3f3f;
int inline in(){int x=0,c;for(;(uint)((c=getchar())-'0')>=10;)
{if(c=='-')return -in();if(!~c)throw ~0;}do{x=(x<<3)+(x<<1)+(c-'0');}
while((uint)((c=getchar())-'0')<10);return x;}
const int Maxn=2e5+5;
int n,m,v,p,a[Maxn];
const int comp(const int &x,const int &y){
	return x>y;
}
bool check(int pos){
	int kill=n-p;ll sum=0;
	for(int i=n;i>=1&&kill;i--){
		if(i!=pos){
			if(a[i]-a[pos]>m)return false;
			sum+=max(a[i]-a[pos],0);
			kill--;
		}
	}
	return sum<=(ll)m*v;
}
int main(){
	cin>>n>>m>>v>>p;
	v=n-v;
	for(int i=1;i<=n;i++){
		cin>>a[i];
	}
	sort(a+1,a+n+1,comp);
	int l=1,r=n+1;
	while(r-l>1){
		int mid=l+r>>1;
		if(check(mid))l=mid;
		else r=mid;
	}
	cout<<l<<endl;
	return 0;
}

Measured memory_bytes: 640
n, m = map(int, input().split())
sc = [list(map(int, input().split())) for _ in range(m)]

for i in range(1000):
    ans = str(i)
    if len(ans) != n:
        continue
    for s, c in sc:
        if int(ans[s-1]) != c:
            break
    else:
        print(ans)
        exit()

print(-1)

Measured memory_bytes: 3064
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main
{

  public static void main(String[] args) throws IOException
  {
    BufferedReader r = new BufferedReader(new InputStreamReader(System.in), 1);
    String s = r.readLine();
    String[] sl = s.split(" ");
    int n = Integer.parseInt(sl[0]);
    int m = Integer.parseInt(sl[1]);

    System.out.println((double)n / m);
  }


}


Measured memory_bytes: 21076
#include<stdio.h>
int main(){
  int w,h,i,j,r,t,x[10000],y[10000],d[51][51],c[51][51];
  char s;
  for(i=0;i<51*51;i++)d[i/51][i%51]=c[i/51][i%51]=210000000;
  scanf("%d %d",&h,&w);
  for(i=t=0;i<h;i++){
    for(j=0;j<w;j++){
      scanf(" %c",&s);
      d[i][j]=s-'0';
    }
  }
  c[y[0]=0][x[0]=0]=0;
  for(r=1;r-t;t++){
    if(c[y[t]][x[t]+1]>c[y[t]][x[t]]+d[y[t]][x[t]+1]){
      c[y[r]=y[t]][x[r]=x[t]+1]=c[y[t]][x[t]]+d[y[t]][x[t]+1];
      r++;
    }
    if(c[y[t]+1][x[t]]>c[y[t]][x[t]]+d[y[t]+1][x[t]]){
      c[y[r]=y[t]+1][x[r]=x[t]]=c[y[t]][x[t]]+d[y[t]+1][x[t]];
      r++;
    }
  }
  /*for(i=0;i<h;i++){
    for(j=0;j<w;j++)printf("%2d ",c[i][j]);
    printf("\n");
    }//*/
  printf("%d\n",c[h-1][w-1]);
  return 0;
}

Measured memory_bytes: 656
def solve():
    def segfunc(x, y):
        return max(x, y)

    def init(init_val):
        for i in range(n):
            seg[i + num - 1] = init_val[i]
        for i in range(num - 2, -1, -1):
            seg[i] = segfunc(seg[2 * i + 1], seg[2 * i + 2])

    def update(k, x):
        k += num - 1
        seg[k] = x
        while k:
            k = (k - 1) // 2
            seg[k] = segfunc(seg[k * 2 + 1], seg[k * 2 + 2])

    def query(p, q):
        if q <= p:
            return ide_ele
        p += num - 1
        q += num - 2
        res = ide_ele
        while q - p > 1:
            if p & 1 == 0:
                res = segfunc(res, seg[p])
            if q & 1 == 1:
                res = segfunc(res, seg[q])
                q -= 1
            p = p // 2
            q = (q - 1) // 2
        if p == q:
            res = segfunc(res, seg[p])
        else:
            res = segfunc(segfunc(res, seg[p]), seg[q])
        return res

    n, q = map(int, input().split())
    a = list(map(int, input().split()))

    ide_ele = 0

    num = 2 ** (n - 1).bit_length()
    seg = [ide_ele] * 2 * num
    init(a)

    for _ in range(q):
        t, a, b = map(int, input().split())
        if t == 1:
            update(a - 1, b)
        elif t == 2:
            print(query(a - 1, b))
        elif t == 3:
            ng = a - 1
            ok = n + 1
            while ok > ng + 1:
                mid = (ok + ng) // 2
                if query(ng, mid) >= b:
                    ok = mid
                else:
                    ng = mid
            print(ok)


solve()


Measured memory_bytes: 99896
package main

import (
	"fmt"
	"regexp"
)

func main() {
	var H, W int
	var m [100]string
	var del_h [100]bool
	var use_w [100]bool
	r := regexp.MustCompile(`#`)
	fmt.Scanf("%d %d", &H, &W)
	for i := 0; i < H; i++ {
		fmt.Scanf("%s", &(m[i]))
		matches := r.FindAllStringIndex(m[i], -1)
		if len(matches) == 0 {
			del_h[i] = true
			continue
		}
		for _, m := range matches {
			use_w[m[0]] = true
		}
	}

	for i := 0; i < H; i++ {
		if !del_h[i] {
			for j, v := range m[i] {
				if use_w[j] {
					fmt.Printf("%c", rune(v))
				}
			}
			fmt.Println("")
		}
	}
}


Measured memory_bytes: 1664
#include<bits/stdc++.h>
inline int read(){
   int s=0,w=1;
   char ch=getchar();
   while(ch<'0'||ch>'9'){if(ch=='-')w=-1;ch=getchar();}
   while(ch>='0'&&ch<='9') s=s*10+ch-'0',ch=getchar();
   return s*w;
}
using namespace std;
int main()
{
	int a=read(),b=read(),c=read();
	cout<<c<<' '<<a<<' '<<b;
	return 0;
}




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

# 1
a1 = 10 - 1 # o
# 2
a2 = 100 - 10 # e

a3 = 1000 - 100 # o
# 3
a4 = 10000 - 1000 # e

# 4
a5 = 100000 - 10000 # o

if N // 10**5 > 0:
  print(a1+a3+a5)
elif N // 10**4 > 0:
  print(N - 10**4+1+a1 + a3)
elif N // 10**3 > 0:
  print(a3+a1)
elif N // 10**2 > 0:
  print(N - 10**2+ 1  + a1)
elif N // 10 > 0:
  print(a1)
else:
  print(N)


Measured memory_bytes: 3060
#include <stdio.h>
#include <stdlib.h>
#include <string.h>


int main(){
	int i,j,k;
	int a,b;
	char c[101];
	int key[101];
	
	while(1){
		scanf("%d",&a);
		if(a==0){
			break;
		}
		for(i=0;i<a;i++){
			scanf("%d\n",&key[i]);
		}
		gets(c);
		i=0;
		int flag=0;
		while(c[i]){
			if(c[i]<='Z'&&c[i]>='A'){
				c[i]-='A'+26;
				flag=1;
			}else{
				c[i]-='a';
			}
			c[i]-=key[i%a];
			while(c[i]<0){
				c[i]+=52;
			}
			if(c[i]>=26){
				c[i]+='A'-26;
			}else{
				c[i]+='a';
			}
			i++;
		}
		printf("%s\n",c);
	}
	return 0;
}

Measured memory_bytes: 592
import java.util.Scanner;

public class Main{
  public static void main(String[]args){
      try(Scanner sc = new Scanner(System.in)){
        String line = sc.nextLine();
        String answer = "";
        int length = line.length();
        for(int i = 0; i<length; i++){
          char ch = line.charAt(i);
          if(Character.isLowerCase(ch)){
              System.out.printf("%s", Character.toUpperCase(ch));
          }else{
              System.out.printf("%s", Character.toLowerCase(ch));
          }
        }
        System.out.println("");
    }
  }
}



Measured memory_bytes: 29128
#include <bits/stdc++.h>
using namespace std;
 int main() {
    vector<int>a(12);
    a ={0,1,3,1,2,1,2,1,1,2,1,2,1};
	int x,y;
    cin >> x >>y;
    cout << (a.at(x) == a.at(y) ? "Yes" : "No" ) <<endl; 
}


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

#define CPP_STR(x) CPP_STR_I(x)
#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_STR_I(args...) #args
#define CPP_CAT_I(x,y) x ## y

using i8  = int8_t;
using u8  = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;

using f32 = float;
using f64 = double;

#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define REPS(i, n) for(i64 i = 1; i <= n; ++i)
#define RREP(i, n) for(i64 i = n - 1; i >= 0 ; --i)
#define RREPS(i, n) for(i64 i = n; i >= 1; --i)

#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))

#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

#define pb push_back
#define mp make_pair
#define F first
#define S second

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; }

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }

template<typename T, size_t N>
i64 SIZE(const T (&)[N]) { return static_cast<i64>(N); }


struct ProconInit {
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;

    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if(AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;


#define MAX_X 1000
#define MAX_Y 1000
#define MAX_Z 1000
#define MAX_K 3000
#define MAX_A 10'000'000'000
#define MAX_ABC 30'000'000'000

int main() {
    i64 X, Y, Z, K; cin >> X >> Y >> Z >> K;
    vector<i64> A(X);
    vector<i64> B(Y);
    vector<i64> C(Z);
    REP(i, X) cin >> A[i];
    REP(i, Y) cin >> B[i];
    REP(i, Z) cin >> C[i];
    sort(C.rbegin(), C.rend());

    vector<i64> AB(X * Y);
    REP(i, X) REP(j, Y) AB[i * Y + j] = A[i] + B[j];
    sort(AB.rbegin(), AB.rend());

    vector<i64> ans(K * Z);
    REP(i, min(K, X * Y)) {
        REP(j, Z) {
            ans[i * Z + j] = AB[i] + C[j];
        }
    }
    sort(ans.rbegin(), ans.rend());

    REP(i, K) {
        cout << ans[i] << endl;
    }

    return 0;
}

Measured memory_bytes: 31616