akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
int n, k, a[N];

bool check(int mid) {
    int ret = 0;

    for(int i=1 ; i<=n ; ++i) {
        if(a[i] % mid) ret += a[i]/mid;
        else ret += a[i]/mid - 1;

    }

    return ret <= k;
}

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    if(fopen(".inp", "r")) freopen(".inp", "r", stdin);
    cin >> n >> k;
    for(int i=1 ; i<=n ; ++i) cin >> a[i];
    int l = 0, r = 1e9;
    while(r - l > 1) {
        int mid = (r + l) >> 1;
        if(check(mid)) r = mid;
        else l = mid;
    }
    cout << r << '\n';
//    cout << check(292638192);

    return 0;
}


Measured memory_bytes: 4372
#include <iostream>

int main(void){
  int n;
  std::cin >> n;

  int st = -1;
  int p_val = -1;
  int best = -1;
  for(int i=0; i<n; i++){
    int temp;
    std::cin >> temp;
    if(st == -1){
      st = 0;
      p_val = temp;
    }else if(p_val < temp){
      if(best < (i-st-1)) best = i-st-1;
      st = i;
      p_val = temp;
    }else{
      p_val = temp;
    }
    //std::cout << st << " " << p_val << " " << best << " " << i-st << std::endl;
  }

  if(best < (n-1-st)) best = n-1-st;
  std::cout << best << std::endl;
  
  return 0;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline

N = int(input())
H = list(map(int,input().split()))


N = N+1
H.insert(0,-100)

A = [ 0 for _ in range(N)]
tmp=0

for i in range(N-1,0,-1):
    if(H[i] <= H[i-1]):
        tmp +=1
    else:
        A[i]= tmp
        tmp = 0

print(max(A))

Measured memory_bytes: 59632
import java.util.*;

class Main{

  public static void main(String args[]){

    Scanner s=new Scanner(System.in);
    int N=s.nextInt();
    long[] List=new long[N];
    for(int i=0;i<N;i++) List[i]=s.nextLong();
    Arrays.sort(List);
    double d=0d;
    for(int i=0;i<N;i++) d+=Math.log10(List[i]);
    long ans=1;
    long comp=(long)Math.pow(10,18);
    
    if(d<=18){
      for(int i=0;i<N;i++) ans*=List[i];
      if(ans<=1000000000000000000L) System.out.println(ans);
      else System.out.println(-1);
    }
    else System.out.println(-1);  
  }  
}

Measured memory_bytes: 61700
#include <iostream>
#include <sstream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <utility>
#include <map>
#include <list>
#include <climits>
#include <set>
#include <deque>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <bitset>

// #define cerr if(false)cerr
#define watch(x) cerr << "> " << #x << ": " << x << "\n";

using namespace std;

template <typename T>
std::ostream &operator <<(std::ostream &out, vector<T> &v) {
	for (typename vector<T>::size_type i = 0; i < v.size(); ++i)
		out << v[i] << " ";
	out << "\n";
    return out;
}
template <typename T, typename N>
std::ostream &operator <<(std::ostream &out, vector<pair<T, N> > &v) {
	for (size_t i = 0; i < v.size(); ++i)
		out << "(" << v[i].first << ", " << v[i].second << ") ";
	out << "\n";
    return out;
}
template <typename T>
std::ostream &operator <<(std::ostream &out, vector<vector<T> > &v) {
	for (size_t i = 0; i < v.size(); ++i) {
		for (size_t j = 0; j < v[i].size(); ++j) {
			out << v[i][j] << " ";
		}
		out << "\n";
	}
   	return out;
}

int main() {

	std::ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

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

	if (b >= 0 && a <= 0) {
		cout << "Zero\n";
		return 0;
	}

	int negs = 0;
	if (b < 0) {
		negs += abs(a) - abs(b) + 1;
	}

	if (negs % 2 == 0) {
		cout << "Positive\n";
	} else {
		cout << "Negative\n";
	}

	return 0;

}

Measured memory_bytes: 256
import java.io.{PrintWriter, _}
import java.util
import java.util._


object Main {
  def main(args: Array[String]): Unit = {
    val inputStream = System.in
    val outputStream = System.out
    val in = new InputReader(inputStream)
    val out = new PrintWriter(outputStream)
    val solver = new Task
    solver.solve(1, in, out)
    out.close()
  }

  class Task {
    def solve(testNumber: Int, in: InputReader, out: PrintWriter): Unit = {
      val arr = in.next.split("/")
      arr(0) = "2018"
      out.print(arr(0) + "/" + arr(1) + "/" + arr(2))

    }
  }

  class InputReader(val stream: InputStream) extends AutoCloseable {
    //reader = new BufferedReader(new FileReader(stream), 32768);
    private val reader = new BufferedReader(new InputStreamReader(stream), 32768)
    private var tokenizer = new StringTokenizer("")


    def next: String = {
      while ( {
        tokenizer == null || !tokenizer.hasMoreTokens
      }) try
        tokenizer = new StringTokenizer(reader.readLine)
      catch {
        case e: IOException =>
          throw new RuntimeException(e)
      }
      tokenizer.nextToken
    }

    def nextLine: String = {
      try
        return reader.readLine
      catch {
        case e: IOException =>
          e.printStackTrace()
      }
      ""
    }

    def nextInt: Int = next.toInt

    def nextLong: Long = next.toLong

    override def close(): Unit = {
    }
  }

}


Measured memory_bytes: 27204
fn main() {
    let mut buf = String::new();
    let _ = std::io::stdin().read_line(&mut buf);
    let mut iter = buf.split_whitespace();
    let l:usize = iter.next().unwrap().parse().unwrap();
    let r:usize = iter.next().unwrap().parse().unwrap();

    if 2019 < r - l {
        println!("{}", 0);
        return;
    }
    let mut min_mod = 100000000000;
    for i in l..r {
        for j in i + 1..r + 1 {
            min_mod = std::cmp::min(min_mod, i * j % 2019);
        }
    }
    println!("{}", min_mod);
}


Measured memory_bytes: 4352
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <stack>
#include <queue>
#define rep(i,l,r) for(int i=(l);i<=(r);++i)
#define per(i,r,l) for(int i=(r);i>=(l);--i)
using namespace std;
int n,x,a[110],t;
int main(){
	scanf("%d",&n);
	rep(i,1,n) scanf("%d",&x),++a[x],t=max(t,x);
	if(t&1){
		int mid=t+1>>1;
		if(a[mid]^2) return puts("Impossible"),0;
		rep(i,1,mid-1) if(a[i]) return puts("Impossible"),0;
		rep(i,mid+1,t) if(a[i]<2) return puts("Impossible"),0;
		puts("Possible");
	}
	else{
		int mid=t>>1;
		if(a[mid]^1) return puts("Impossible"),0;
		rep(i,1,mid-1) if(a[i]) return puts("Impossible"),0;
		rep(i,mid+1,t) if(a[i]<2) return puts("Impossible"),0;
		puts("Possible");
	}
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <cmath>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <memory.h>
#include <iomanip>
#include <bitset>
#include <list>
#include <stack>
#include <deque>

using namespace std;

#define mod 1000000007

int main()
{
	int n, m;
	cin >> n >> m;
	vector<int> cnt(n + 1, 0);
	for(int i = 0; i < m; i++){
		int a, b;
		cin >> a >> b;
		cnt[a]++;
		cnt[b]++;
	}
	for(int i = 1; i <= n; i++){
		if(cnt[i] % 2 ==1){
			cout << "NO" << endl;
			return 0;
		}
	}
	cout << "YES" << endl;
	return 0;
	return 0;
}

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

 int main() {
 int N, K;
 cin >> N >> K;
 int ans = 0;
 while(N > 0) {
 	N /= K; // N をK で割った商に置き換える
 	ans++;

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

Measured memory_bytes: 3620
//ABC090A
#include <bits/stdc++.h>
#include <iostream>
#include <iomanip>
#include <numeric>
#include <math.h>
#include <stdio.h>
#include <climits>
#include <cfloat>
#include <string>
using namespace std;

int main(){
	vector<vector<char>> s(3,vector<char>(3));
	for(int i=0;i<3;i++){
		for(int j=0;j<3;j++){
			cin >> s.at(i).at(j);
		}
	}
	for(int i=0;i<3;i++){
		cout << s.at(i).at(i);
	}
	return 0;
}

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

using namespace std;



int main() {
    int X;
    while (cin >> X) {
        int sum = 0;
        int i = 0;
        for (i = 1; sum <= X; ++i) {
            sum += i;
            if (sum >= X) {
                break;
            }
        }
        cout << i << endl;
    }
    return 0;
}


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

#define rep(i,n) for(int i = 0;i < (int)(n);i++)
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort(ALL(V))

int main()
{
    int N,X;
    cin >> N >> X;
    int count = 0;
    int d = 0;

    if(X >= d)
        count++;

    int l = 0;

    rep(i,N)
    {
        cin >> l;    
        if(X >= d + l)
        {
            count++;
        }
        d = d + l;
    }
    cout << count;
}

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

int main() {
  int n;
  int size = 0;
  cin >> n;
  long long a[n];
  long long b[n];

  for(int i = 0; i<n; i++){
    cin >> a[i];
    if(i > 0){
      if (a[i] != a[i-1]){
        b[size] = a[i];
        size++;
      }
    }else{
      b[size] = a[i];
      size++;
    }
  }
  b[size] = -1;
  long long my_money = 1000;
  long long c = 0;
  long long d;
  for(int i=0; i<size; i++){
    if(b[i] < b[i+1]){
      if(my_money >= b[i]){
        c = my_money / b[i];
        d = b[i] * c;
        my_money -= d;
      }
    }else{
      d = b[i] * c;
      my_money += d;
      c = 0;
    }
  }
  cout << my_money << endl;
  return 0;
  
}

Measured memory_bytes: 3640
#include<bits/stdc++.h>
using namespace std;
int main(){
    map<string, int> T;
    string S;
    int N;
    cin >> N;
    for(int i = 0; i < N; i++){
        cin >> S;
        T[S]++;
    }
    int M;
    cin >> M;
    for(int i = 0; i < M; i++){
        cin >> S;
        T[S]--;
    }
    int ans = 0;
    map<string, int>::iterator it;
    for(it = T.begin(); it != T.end(); it++){
        pair<string, int> item = *it;
        ans = max(ans, item.second);
    }
    cout << ans << endl;
    return 0;
}

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

int main() {
  int N,i;
  cin >> N;
  vector<int> d(N);
  for(i=0; i<N; i++)
    cin >> d.at(i);
  
  sort(d.begin(), d.end());
  cout << d.at(d.size()/2)-d.at(d.size()/2-1) << endl;
}

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

int main() {
  int N, once, time;
  cin >> N >> once >> time;
  int ans;
  if (N % once == 0) {
    ans= N / once * time;
  }
  else {
    ans= (N/ once + 1) * time;
  }

  cout << ans << endl;
}

Measured memory_bytes: 3592
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		long b = sc.nextLong();
		for(int i = 1; i<a; i++){
			long h=sc.nextLong();
			b=(b/gcd(b,h))*h;
		}
		System.out.println(b);
	}
	public static long gcd(long q,long p){
		if(p==0){
			return q;
		}else{
			return gcd(p,q%p);
		}
	}
}

Measured memory_bytes: 21716
import java.util.*;

public class Main{

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int count = 0;

    for(int i = n;i > 0;i--) {

      if(String.valueOf(i).length() % 2 != 0) {
        count++;
      }

    }

    System.out.println(count);


  }

}


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

using namespace std;

#define sim template <class c
#define ris return *this
#define dor > debug &operator<<
#define eni(x)                                                                        \
	sim > typename enable_if<sizeof dud<c>(0) x 1, debug &>::type operator<<(c i) \
	{
sim > struct rge
{
	c b, e;
};
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c *x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug
{
#ifdef LOCAL
	~debug()
	{
		cerr << endl;
	}
	eni(!=) cerr << boolalpha << i;
	ris;
} eni(==) ris << range(begin(i), end(i));
}
sim, class b dor(pair<b, c> d)
{
	ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d)
{
	*this << "[";
	for (auto it = d.b; it != d.e; ++it)
		*this << ", " + 2 * (it == d.b) << *it;
	ris << "]";
}
#else
	sim dor(const c &)
	{
		ris;
	}
#endif
}
;
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

#define forn(i, n) for (ll i = 0; i < int(n); i++)
#define rfor(n, i) for (ll i = (n - 1); i >= 0; --i)
#define all(V) V.begin(), V.end()
#define rall(V) V.rbegin(), V.rend()
#define len(V) (int)V.size()
#define ll long long
#define ld long double
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define endl '\n'
#define M_PI 3.14159265358979323846
#define EPS 1e-7

void solve()
{	
        int n; cin >> n;
        vector<int> a(n);
        map<int, int> mp;
        forn(i, n) 
        {
                cin >> a[i];
                mp[a[i]]++;
        }
        ll res = 0, cnt = 0;
        for (auto x: mp)
        {
                cnt = 0;
                if (mp.find(x.first - 1) != mp.end())
                {
                        cnt += mp[x.first - 1];       
                }
                if (mp.find(x.first + 1) != mp.end())
                {
                        cnt += mp[x.first + 1];
                }
                cnt += x.second;
                res = max(res, cnt);
        }
        cout << res;
}

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	solve();
}

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

int main() {
 int N, L;
  cin >> N >> L;
  vector<int> all(N+1);
  int allsum = 0;
  for(int i = 1; i <= N; i++){
    all.at(i) = L+i-1;
    allsum += L+i-1;
  }
  if(L >= 1){
    cout << allsum -L << endl;
  } else {
    int Min = 10000;
    int cnt = 0;
    for(int i = 1; i<= N; i++){
      if(Min>abs(0-all.at(i))) cnt = i;
      Min = min(Min,abs(0-all.at(i)));
    }
     cout << allsum - all.at(cnt) << endl;
  }
               
                
                
                
                
}

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

using namespace std;

typedef long long ll;

int n, k;
ll sol;
char cad[100005];
bool bn, bs, be, bw;
int main()
{
    #ifdef acm
    freopen("a.in", "r", stdin);
    #endif // acm

    cin.tie(0);
    ios_base::sync_with_stdio(0);

    cin >> cad;

    n = strlen( cad );

    for( int i = 0; i < n; i ++ ){
        if( cad[i] == 'N' ) bn = true;
        if( cad[i] == 'E' ) be = true;
        if( cad[i] == 'W' ) bw = true;
        if( cad[i] == 'S' ) bs = true;
    }

    if( ( bn != bs ) || bw != be )
        cout << "No";
    else
        cout << "Yes";

    /*for( int i = 1; i <= n; i ++ ){
        Dp[i] = max( Dp[i], Dp[i-1] + A[i]/2 );

        if( i+1 <= n ){
            Dp[i+1] = max( Dp[i+1], Dp[i-1] + min( A[i], A[i-1] ) );
        }

        if( i+2 <= n ){


        }
    }*/




    return 0;
}


Measured memory_bytes: 256
n = int(input())
num = list(map(int, input().split()))
flg = False
num2 = []
for i in range(n):
    if num[i] % 2 == 0:
        num2.append(num[i])

for j in range(len(num2)):
    if len(num2) == 0:
        flg = True
        break        
    elif num2[j] % 3 == 0 or num2[j] % 5 == 0:
        continue
    else:
        flg = True
        break


if flg == False:
    print("APPROVED")
else:
    print("DENIED")

Measured memory_bytes: 3064
#include <iostream>
using namespace std;
int main(){
          long long int X;
          int sum=0;
          cin>>X;
          for(int i=1 ;; i++){   //i=0だとわかりにくい
                     sum+=i;
                     if(sum>=X){
                              cout<<i;
                              break;
                              
                    }
          } 
          return 0;
}

Measured memory_bytes: 256
#include <iostream> 
#include <sstream> 
#include <iomanip> 
#include <algorithm> 
#include <cmath> 
#include <string> 
#include <vector> 
#include <list> 
#include <queue> 
#include <stack> 
#include <set> 
#include <map> 
#include <bitset> 
#include <numeric> 
#include <climits> 
#include <cfloat> 
using namespace std;

const int MAX = 1000000;

void EulerTotient(int n, vector<int>& phi)
{
    vector<int> prime(n+1, true);
    phi.assign(n+1, 0);
    for(int i=1; i<=n; ++i)
        phi[i] = i;

    for(int i=2; i<=n; ++i){
        if(!prime[i])
            continue;
        for(int j=1; i*j<=n; ++j){
            prime[i*j] = false;
            phi[i*j] -= phi[i*j] / i;
        }
    }
}

int main()
{
    vector<int> phi;
    EulerTotient(MAX, phi);

    vector<long long> ret(MAX+1, 0);
    ret[1] = 2;
    for(int i=2; i<=MAX; ++i)
        ret[i] = ret[i-1] + phi[i];

    int t;
    cin >> t;
    while(--t >= 0){
        int n;
        cin >> n;
        cout << ret[n] << endl;
    }

    return 0;
}

Measured memory_bytes: 12000
#include <iostream>
#include <string>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)

int main(int argc, char const *argv[]) {
  int n;
  string s, t;
  cin >> n >> s >> t;
  string ans;
  rep(i, 2 * n) {
    if (i % 2 == 0)
      ans.push_back(s[i / 2]);
    else
      ans.push_back(t[i / 2]);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
from math import ceil
n,h = map(int,input().split())
ab = [tuple(int(i) for i in input().split()) for j in range(n)]
m = max(ab[i][0] for i in range(n))
ab.sort(key=lambda x: x[1],reverse=True)
ans = 0
for a,b in ab:
    # print(b)
    if b <= m:
        break
    ans += 1
    h -= b
    if h <= 0:
        h = 0
        break
print(ans+ceil(h/m))






Measured memory_bytes: 18080
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))

X, Y = MAP()

a = (Y - 2*X)/2
b = (4*X - Y)/2

if a >= 0 and b >= 0 and a%1 == 0 and b%1 == 0:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 61712
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define int long long
#define all(sdk) sdk.begin(),sdk.end()
#define mll map<ll, ll>
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define rep(i,a,b) for(ll i=a;i<b;++i)
#define repd(i,a,b) for(ll i=a;i>=b;--i)
//#define mp make_pair
#define hell 1000000007
#define endl '\n'
#define vvll vector<vector<int> >
#define vll vector<int>
#define mint map<int,int>
#define sz(x) (int)x.size()
#define sll set<int>
#define pll pair<int,int>
#define F first
#define S second
#define INF 1e18
#define NINF -1e16

#define maxn 1000005
int spf[maxn];
vll primes;
void sieve()
{
	rep(i,2,maxn)
	{
		if (spf[i]==0)
		{
			spf[i]=i;
			for(int j=2*i;j<=maxn;j+=i)
			{
				if(spf[j]==0)
					spf[j]=i;
			}
		}
	}
}
// void SieveOfEratosthenes(int n) 
// { 
//     bool prime[n+1]; 
//     memset(prime, true, sizeof(prime)); 
  
//     for (int p=2; p*p<=n; p++) 
//     { 
//         if (prime[p] == true) 
//         { 
//             for (int i=p*2; i<=n; i += p) 
//                 prime[i] = false; 
//         } 
//     }
//     for (int p=2; p<=n; p++) 
//       if (prime[p]) 
//           primes.pb(p); 
// } 
// bool isPrime(ll n) 
// { 
//     if (n <= 1) 
//         return false; 
//     if (n <= 3) 
//         return true; 
//     if (n % 2 == 0 || n % 3 == 0) 
//         return false; 
//     for (int i = 5; i * i <= n; i = i + 6) 
//         if (n % i == 0 || n % (i + 2) == 0) 
//             return false; 
//     return true; 
// } 
// ll power(ll x,ll y)
// {
//     ll X=x;
//     //X=X%p;//if x is greater than p
//     if(X==0)
//     {
//         return 0;
//     }
//     ll res=1ll;
//     while(y>0)
//     {
//         if(y&1)
//         {
//             res=((res)*(X));
//             y--;
//         }
//         y=y>>1;
//         X=((X)*(X));
//     }
//     // res=(res>=0)?(res%p):(res+p)%p;
//     return(res);
// }
// void dfs(int u, int par){
//     cnt[u] = 1;
//     p[u] = par;
//     for(int i : g[u]){
//         if(i != par){
//             dfs(i,u);
//             cnt[u] += cnt[i];
//         }
//     }
// }
// int children(vll v[],int parent,int src,vll& chil)
// {
// 	int ans =0;
// 	for(auto it:v[src])
// 	{
// 		if(it!=parent)
// 		{
// 			ans+= 1+children(v,src,it,chil);
// 		}
// 	}
// 	chil[src] = ans;
// 	return ans;
 
// }
signed main() {
	//freopen("output.txt","w",stdout);
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	srand (static_cast <unsigned> (time(0)));
// 	SieveOfEratosthenes(300001); 
// 	sort(all(primes));
    //sieve();
	int t=1;
	//cin >> t;
	while (t--) 
	{
	    int n,x,t;
      cin >> n >> x >> t;
      int c=n/x;
      if (n%x!=0)
        c++;
      cout << c*t<<endl;
		
		
	}
	return 0;
}


Measured memory_bytes: 3644
#include <iostream>

using namespace std;

int main()
{
    int n, a = 2;
    cin>>n;
    cout<<n<<":";
    while (a*a <= n && n > 1)
    {
        if (n % a == 0)
        {
            cout<<" "<<a;
            n = n/a;
        }
        else a++;
    }
    if (n > 1) cout<<" "<<n;
    cout<<"\n";
    return 0;
}

Measured memory_bytes: 3084
#include<iostream>
#include<algorithm>
#define ll long long 
using namespace std;

const int mod = 1e9 + 7;
const int maxn = 2e5 + 10000;
ll f[maxn]; ll inv[maxn];

void init()
{
	f[0] = 1;
	for (int i = 1; i < maxn; i++) f[i] = (f[i - 1] * i) % mod;
}

ll POW(ll a, ll b, ll mod)
{
	ll s = 1;
	while (b != 0)
	{
		if (b & 1) s = s * a % mod;
		a = a * a % mod;
		b >>= 1;
	}
	return s % mod;
}

ll Lucas(ll n, ll k, ll p)        //C (n, k) % p
{
	ll ret = 1;
	while (n && k)
	{
		ll nn = n % p, kk = k % p;
		if (nn < kk) return 0;  //inv (f[kk]) = f[kk] ^ (p - 2) % p
		ret = ret * f[nn] * POW(f[kk] * f[nn - kk] % p, p - 2, p) % p;
		n /= p, k /= p;
	}
	return ret;
}
int main()
{
	init();
	ll N; ll M; ll K;
	cin >> N >> M >> K;
	ll ans = 0;
	for (ll d = 1; d < N; d++)
		ans = (ans + (N - d) % mod * M % mod * M % mod * d % mod) % mod;
	for (ll d = 1; d < M; d++)
		ans = (ans + (M - d) % mod * N % mod * N % mod * d % mod) % mod;

	ans = ans * Lucas(N * M - 2, K - 2, mod) % mod;
	cout << ans % mod << endl;

	return 0;
}

Measured memory_bytes: 1920
#include <bits/stdc++.h>
#define rep(i,n) for (int i = (0); i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(x) (x).begin(),(x).end()
#define rrng(x) (x).rbegin(),(x).rend()
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define show(x) cout << #x << " = " << (x) << endl
#define show2(x,y) cout << #x << " = " << (x) << ", " << #y << " = " << (y) << endl
#define show3(x,y,z) cout << #x << " = " << (x) << ", " << #y << " = " << (y) <<  ", " << #z << " = " << (z) << endl
#define showv(v) rep(i,v.size()) printf("%d%c", v[i], i==v.size()-1?'\n':' ')
#define showv2(v) rep(j,v.size()) showv(v[j])
#define showt(t,n) rep(i,n) printf("%d%c", t[i], i==n-1?'\n':' ')
#define showt2(t,r,c) rep(j,r) showt(t[j],c)
#define showvp(p) rep(i,p.size()) printf("%d %d\n", p[i].first, p[i].second);
#define printv(v) rep(i,v.size()) printf("%d\n", v[i])
#define printt(t,n) rep(i,n) printf("%d\n", t[i])
#define incl(v,x) find(rng(v),x)!=v.end()
#define incls(s,c) s.find(c)!=string::npos
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define bit(n,k) ((n>>k)&1) // nのk bit目
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define uni(x) x.erase(unique(rng(x)),x.end())
#define SP << " " <<
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vs = vector<string>;
using P = pair<int, int>;
using T = tuple<int, int, int>;
using vp = vector<P>;
using vt = vector<T>;
const int mod = 1000000007;
const double EPS = 1e-9;
//const long double EPS = 1e-14;
const int INF = (1<<30)-1;
//const ll INF = (1LL<<62)-1;
#define dame { puts("No"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
inline int in() { int x; scanf("%d",&x); return x;}
//template<class T = int> inline T in() { T x; cin >> x; return (x);}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
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; }

int main () {
  int d;
  cin >> d;
  int n = 25 - d;
  string ans = "Christmas";
  rep(i,n) {
    ans += " Eve";
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
class Factorial():
    def __init__(self, mod=10**9 + 7):
        self.mod = mod
        self._factorial = [1]
        self._size = 1
        self._factorial_inv = [1]
        self._size_inv = 1

    def __call__(self, n):
        return self.fact(n)

    def fact(self, n):
        ''' n! % mod '''
        if n >= self.mod:
            return 0
        self._make(n)
        return self._factorial[n]
    
    def _make(self, n):
        if n >= self.mod:
            n = self.mod
        if self._size < n+1:
            for i in range(self._size, n+1):
                self._factorial.append(self._factorial[i-1]*i % self.mod)
            self._size = n+1

    def fact_inv(self, n):
        ''' n!^-1 % mod '''
        if n >= self.mod:
            raise ValueError('Modinv is not exist! arg={}'.format(n))
        self._make(n)
        if self._size_inv < n+1:
            self._factorial_inv += [-1] * (n+1-self._size_inv)
            self._size_inv = n+1
        if self._factorial_inv[n] == -1:
            self._factorial_inv[n] = self.modinv(self._factorial[n])
        return self._factorial_inv[n]
    
    @staticmethod
    def xgcd(a, b):
        '''
        Return (gcd(a, b), x, y) such that a*x + b*y = gcd(a, b)
        '''
        x0, x1, y0, y1 = 0, 1, 1, 0
        while a != 0:
            (q, a), b = divmod(b, a), a
            y0, y1 = y1, y0 - q * y1
            x0, x1 = x1, x0 - q * x1
        return b, x0, y0

    def modinv(self, n):
        g, x, _ = self.xgcd(n, self.mod)
        if g != 1:
            raise ValueError('Modinv is not exist! arg={}'.format(n))
        return x % self.mod

    def comb(self, n, r):
        ''' nCr % mod '''
        if r > n:
            return 0
        t = self(n)*self.fact_inv(n-r) % self.mod
        return t*self.fact_inv(r) % self.mod
    
    def comb_(self, n, r):
        '''
        nCr % mod
        when r is not large and n is too large
        '''
        c = 1
        for i in range(1, r+1):
            c *= (n-i+1) * self.modinv(i)
            c %= self.mod
        return c

    def comb_with_repetition(self, n, r):
        ''' nHr % mod '''
        t = self(n+r-1)*self.fact_inv(n-1) % self.mod
        return t*self.fact_inv(r) % self.mod

    def perm(self, n, r):
        ''' nPr % mod '''
        if r > n:
            return 0
        return self(n)*self.fact_inv(n-r) % self.mod

mod = 10**9 + 7
n, a, b = map(int, input().split())
comb = Factorial().comb_
print((pow(2, n, mod) - comb(n, a) - comb(n, b) - 1) % mod)

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

int main(){
  int a,b,c;
  cin>>a>>b>>c;
  if(a==b&a!=c)cout<<"Yes"<<endl;
  else if(b==c&b!=a)cout<<"Yes"<<endl;
  else if(c==a&a!=b)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  
}

Measured memory_bytes: 256
N = int(input())
A = [int(input()) for _ in range(N)]
S = sorted(A)
cnt = 0

for i in range(N):
    if i == 0:
        tmpnum = S[i]
        tmpcnt = 1
    else:
        if S[i] == tmpnum:
            tmpcnt += 1
        else:
            if tmpcnt % 2 != 0:
                cnt += 1
            tmpnum = S[i]
            tmpcnt = 1

if tmpcnt % 2 != 0:
    cnt += 1
            
print(cnt)

Measured memory_bytes: 8280
#include<cstdio>
#include<algorithm>
#include<vector>
#define N_ 201000
using namespace std;
vector<int>E[N_], G[N_], Ch[N_];
int n, UF[N_], par[N_], Dep[N_], BIT[N_], Num[N_], Ed[N_], cnt, C[N_];
void DFS(int a, int pp, int Mx) {
	G[Mx].push_back(a);
	par[a] = pp;
	Num[a] = ++cnt;
	C[a] = 1;
	for (auto &x : E[a]) {
		if (x == pp)continue;
		Dep[x] = Dep[a] + 1;
		Ch[a].push_back(x);
		DFS(x, a, max(Mx, a));
		C[a] += C[x];
	}
	Ed[a] = cnt;
}
int Find(int a) {
	if (a == UF[a])return a;
	return UF[a] = Find(UF[a]);
}
int T[N_];
void Add(int a, int b) {
	T[a] += b;
	a = Num[a];
	while (a <= n) {
		BIT[a] += b;
		a += (a&-a);
	}
}
int Sum(int a) {
	int r = 0;
	while (a) {
		r += BIT[a];
		a -= (a&-a);
	}
	return r;
}
void Del(int a) {
	int t = T[a];
	Add(a, -t);
	UF[a] = Find(par[a]);
	int x = Find(a);
	if (x != 1)Add(x, t);
}
int U[N_], V[N_], Res[N_];
void Do(int a) {
	int s = 0;
	for (auto &x : Ch[a]) {
		U[x] = C[x] - (Sum(Ed[x]) - Sum(Num[x] - 1));
		s += U[x];
	}
	for (auto &x : Ch[a]) {
		U[x] = s - U[x];
	}
	V[a] = s;
}
void Get(int a, int c) {
	if (a != 1) {
		Res[a] = c + V[a];
	}
	for (auto &x : Ch[a]) {
		int tc = c + 1;
		if (a != 1)tc += U[x];
		Get(x, tc);
	}
}
int main() {
	int i, a, b;
	scanf("%d", &n);
	for (i = 1; i < n; i++) {
		scanf("%d%d", &a, &b);
		E[a].push_back(b);
		E[b].push_back(a);
	}
	for (i = 1; i <= n; i++) {
		UF[i] = i;
	}
	DFS(1, 0, 0);
	for (i = 2; i <= n; i++) {
		Add(i, 1);
	}
	for (i = 1; i <= n; i++) {
		if(i!=1)Del(i);
		for (auto &x : G[i]) {
			Do(x);
		}
	}
	Get(1, 0);
	for (i = 2; i <= n; i++)printf("%d ", Res[i]);
}

Measured memory_bytes: 50164
#include <stdio.h>
int main() {
  char S[3];
  char T[3];
  int ans = 0;
  int i;

  //入力
  for (i = 0; i < 3; i++) {
    scanf("%c", &S[i]);
  }

  for (i = 0; i < 3; i++) {
    scanf(" %c", &T[i]);
  }

  //判定
  for (i = 0; i < 3; i++) {
    if (S[i] == T[i]) {
      ans += 1;
    }
  }

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

  return 0;
}


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

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (a); i > (b); i--)
#define ALL(a) (a).begin(), (a).end()

int main() {
    string A, B, C;
    cin >> A >> B >> C;
    cout << (char)(A[0] + 'A' - 'a') << (char)(B[0] + 'A' - 'a') << (char)(C[0] + 'A' - 'a') << endl;
    return 0;
}

Measured memory_bytes: 256
N, K = map(int, input().split())
mod = pow(10, 9)+7
Cmax = ((N+N-K+1)*K)//2
Cmin = ((K-1)*K)//2
ans = 1
for i in range(K, N+1):
    ans = (ans+Cmax-Cmin+1)
    Cmin += i
    Cmax += (N-i)

print(ans % mod)


Measured memory_bytes: 9116
#include <iostream>
using namespace std;
int main() {
    string s;
    int n,h,H,i;
    while (cin >> s) {
        if (s == "-") break;
        cin >> n;
        H = 0;
        for (i=0;i<n;i++) {
            cin >> h;
            H += h;
        }
        H %= s.size();
        cout << s.substr(H) << s.substr(0,H) << endl;
    }
    return 0;
}

Measured memory_bytes: 3136
K, A, B = map(int, input().split())
if A >= B-2:
    print(K+1)
else:
    nokoriK = K + 1 - A
    if nokoriK % 2 == 0:
        maisu = A + (B-A) * nokoriK // 2
    else:
        maisu = A + (B-A) * (nokoriK-1) // 2 + 1
    print(maisu)


Measured memory_bytes: 2940
#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define vi vector<ll>
#define vvi vector<vi>
#define BITLE(n) (1LL<<((ll)n))
#define SHIFT_LEFT(n) (1LL<<((ll)n))
#define SUBS(s,f,t) ((s).substr((f)-1,(t)-(f)+1))
#define ALL(a) (a).begin(),(a).end()
using namespace std;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n,k;cin>>n>>k;
  double ans = 0;
  vi A(n);
  double sum = 0;
  for(auto &a:A)cin>>a;
  for(ll i=0;i<n;i++){
    sum += (double)((double)(A[i])*(A[i]+1)/2)/(double)A[i];
    if(i >= k){
      sum -= (double)((double)(A[i-k])*(A[i-k]+1)/2)/(double)A[i-k];
    }
    //cout<<sum<<endl;
    ans = max(ans,sum);
  }
  printf("%.10f\n",ans);
  
  return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <set>
using namespace std;
int main(){
	set<string> s;
	int n;
	cin >> n;
	for(int i = 0;i < n;i++){
		string buf;
		cin >> buf;
		s.insert(buf);
	}
	cout << s.size();

}


Measured memory_bytes: 19252
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<cmath>
using namespace std;
#define MAXN 100000
int n,cnt,ans;
int A[MAXN+5];
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)scanf("%d",&A[i]);
	sort(A+1,A+n+1);
	if(A[1]<0&&A[n]>=0)
	{
		for(int i=1;i<=n;i++)
		if(A[i]<0)cnt++,ans-=A[i];else ans+=A[i];
		printf("%d\n",ans);cnt--;
		if(cnt*2<=n-2)
		{
			for(int p1=2,p2=cnt+2;p1<=cnt+1;p1++,p2++){printf("%d %d\n",A[p2],A[p1]);A[p2]-=A[p1];}
			for(int i=cnt+2;i<n;i++){printf("%d %d\n",A[1],A[i]);A[1]-=A[i];}
			printf("%d %d\n",A[n],A[1]);
		}
		else
		{
			for(int p1=2,p2=cnt+2;p2<n;p1++,p2++){printf("%d %d\n",A[p1],A[p2]);A[p1]-=A[p2];}
			for(int i=1;i<=cnt+1;i++){printf("%d %d\n",A[n],A[i]);A[n]-=A[i];}
		}
	}
	else if(A[1]>=0)
	{
		for(int i=1;i<=n;i++)ans+=A[i];
		printf("%d\n",ans-A[1]*2);
		for(int i=2;i<n;i++)
		{printf("%d %d\n",A[1],A[i]);A[1]-=A[i];}
		printf("%d %d\n",A[n],A[1]);
	}
	else
	{
		for(int i=1;i<=n;i++)ans-=A[i];
		printf("%d\n",ans+A[n]*2);
		for(int i=1;i<n;i++)
		{printf("%d %d\n",A[n],A[i]);A[n]-=A[i];}
	}
}

Measured memory_bytes: 2304
#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>

int main() {
  std::string s;
  std::cin >> s;

  for (size_t i = 0; i < s.length(); i += 2) {
    std::cout << s[i];
  }

  std::cout << std::endl;

  return 0;
}

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

using namespace std;

int sum, n, m, a[100], cnt;

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

	for(int i = 0; i < n; ++i){
		if(4*m*a[i] >= sum){
			cnt++;
		}
	}

	if(cnt >= m) cout << "Yes" << endl;
	else cout << "No" << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int t,i,n,max=0,sum=0;
    scanf("%d",&t);
    for(i=1;i<=t;i++)
    {
        scanf("%d",&n);
        sum+=n;
        if(n>max)
        {
            max=n;
        }
    }
    printf("%d\n",max/2+sum-max);
    return 0;
}


Measured memory_bytes: 128
#include "bits/stdc++.h"
using namespace std;

const int INF = numeric_limits<int>::max();

int main(void) {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    int W[N];
    for (int i = 0; i < N; i++) {
        cin >> W[i];
    }
    int result = INF;
    for (int t = 0; t < N; t++) {
        int i_sum = 0;
        for (int i = 0; i < t; i++) {
            i_sum += W[i];
        }
        int j_sum = 0;
        for (int j = t; j < N; j++) {
            j_sum += W[j];
        }
        result = min(result, abs(i_sum - j_sum));
    }
    cout << result << '\n';
    return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Logger;

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

	private static void printAnswer() {
		Logger logger = Logger.getLogger(Logger.GLOBAL_LOGGER_NAME);

		try {
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			List<Integer> trainList = new ArrayList<>();
			String dataset = br.readLine();

			while (dataset != null) {
				int integer = Integer.parseInt(dataset);
				if(integer != 0){
					trainList.add(integer);
				}else{
					int lastIndex = trainList.size() -1 ;
					System.out.println(trainList.get(lastIndex));
					trainList.remove(lastIndex);
				}
				dataset = br.readLine();
			}
		} catch (IOException e) {
			logger.info("Error:  Reading input data is failed.");
		}
	}
}

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

#define REP(i, x) REPI(i, 0, x)
#define REPI(i, a, b) for (int i = int(a); i < int(b); ++i)
#define ALL(x) (x).begin(), (x).end()

typedef long long ll;
using namespace std;

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

  ll N, T;
  cin >> N >> T;
  vector<ll> diff(N - 1);
  ll t, prev_t;
  cin >> prev_t;

  REP(i, N - 1) {
    cin >> t;
    diff.at(i) = t - prev_t;
    prev_t = t;
  }

  ll ans = 0;
  REP(i, N - 1) { ans += min(T, diff.at(i)); }
  ans += T;

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 1792
//Love and Freedom.
#include<cstring>
#include<cmath>
#include<algorithm>
#include<cstdio>
#define ll long long
#define inf 20021225
#define mdn 998244353
#define N 3000001
using namespace std;
int read()
{
	int s=0,f=1; char ch=getchar();
	while(ch<'0' || ch>'9')	{if(ch=='-') f=-1;ch=getchar();}
	while(ch>='0' && ch<='9')	s=s*10+ch-'0',ch=getchar();
	return f*s;
}
int fac[N],inv[N];
void upd(int &x,int y){x+=x+y>=mdn?y-mdn:y;}
int ksm(int bs,int mi)
{
	int ans=1;
	while(mi)
	{
		if(mi&1)	ans=1ll*ans*bs%mdn;
		bs=1ll*bs*bs%mdn; mi>>=1;
	}
	return ans;
}
void init(int n)
{
	fac[0]=1;
	for(int i=1;i<=n;i++)	fac[i]=1ll*fac[i-1]*i%mdn;
	inv[n]=ksm(fac[n],mdn-2);
	for(int i=n;i;i--)		inv[i-1]=1ll*inv[i]*i%mdn;
}
int C(int n,int m)
{
	if(n<m)	return 0;
	return 1ll*fac[n]*inv[n-m]%mdn*inv[m]%mdn;
}
int F(int n,int m,int k)
{
	int top=min(n,k),ans=0;
	for(int i=0;i<=top;i++)	if(!((m-i)&1) && m>=i)
		upd(ans,1ll*C(n,i)*C(n-1+(m-i)/2,n-1)%mdn);
	return ans;
}
int main()
{
	int n=read(),m=read(); init(n+3*m);
	int ans=F(n,m*3,m)-1ll*(F(n,m,m)-F(n-1,m,m)+mdn)%mdn*n%mdn;
	printf("%d\n",(ans+mdn)%mdn);
	return 0;
}

Measured memory_bytes: 22656
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
int main(){
  int n,m;
  cin>>n;
  string s;
  vector<int> ans(26,50),c(26,0),b;
  for(int i=0;i<n;i++){
    b=c;
    cin>>s;
    m=s.size();
    for(int j=0;j<m;j++){
      b[(int)(s[j]-'a')]++;
    }
    for(int j=0;j<26;j++){
      ans[j]=min(ans[j],b[j]);
    }
  }
  for(int i=0;i<26;i++){
    for(int j=0;j<ans[i];j++){
      cout<<(char)(i+'a');
    }
  }
}

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,n) for(int (i)=(l);i<(n);i++)
#define vector<int> vi
#define vector<vector<int>> vvi

int main(){
    int a,b;
    char op;
    cin >> a >> op >> b;
    if(op=='+') cout << a+b << endl;
    else cout << a-b << endl;
    return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std; 
#define LIM 100003

#define M 1000000007
#define inf 99999999999999999LL	//long long inf
typedef long long ll;

#define sc(x) scanf("%d",&x);
#define sc2(x,y) scanf("%d%d",&x,&y);
#define sc3(x,y,z) scanf("%d%d%d",&x,&y,&z);
#define scl(x) scanf("%lld",&x);
#define scl2(x,y) scanf("%lld%lld",&x,&y);
#define scl3(x,y,z) scanf("%lld%lld%lld",&x,&y,&z);

#define pb push_back
#define mp make_pair
#define fi first
#define se second 
ll power(ll x,ll y,ll z) {	ll ret = 1;	while(y > 0) {	if(y & 1) ret = (ret*x)%z;x = (x*x)%z;y >>= 1;}return ret;}


#define debug(x) cerr<<#x<<" :: "<<x<<"\n";
#define debug2(x,y) cerr<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\n";
#define debug3(x,y,z) cerr<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<"\n";
#define debug4(x,y,z,a) cerr<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<"\t"<<#a<<" :: "<<a<<"\n";




// dp[n][w] = max till n and max w weight allowed
ll n, w, dp[102][LIM], weight[102], value[103], answer=0;

void doit() {
	ll i, j;
	for(i=1; i<=n; i++) {
		for(j=1; j<=w; j++) {
			if( j - weight[i] >=0 )	
				dp[i][j] = max(dp[i-1][j], dp[i-1][j - weight[i]]+ value[i]) ;
			else
				dp[i][j] = dp[i-1][j] ;
			answer = max(answer, dp[i][j]) ;
		}
	}

}

int main() {
	int i, j, t;
	scl2(n, w) ;
	for(i=1; i<=n; i++)		scl2(weight[i], value[i]) ;
	doit() ;
	assert(answer == dp[n][w]) ;
	cout << answer<< endl ;
	return 0;
}




Measured memory_bytes: 78336
#include<iostream>
#include<cstdio>
#include<cstring>
#include<vector>
#include<algorithm>
#include<cmath>
using namespace std;
#define INF 0x3f3f3f3f
const int maxn=60;
#define _rep(i,a,b) for(int i=(a);i<=(b);++i)
int n,a[maxn][2];
double EPS=1e-10;

double dist(int x1,int y1,double x2,double y2)
{
    double lenth=(x1-x2)*(x1-x2)+(y1-y2)*(y1-y2);
    return sqrt(lenth);
}
double f(double x,double y)
{
    double ans=0;
    for(int i=1;i<=n;i++)
        ans=max(ans,dist(a[i][0],a[i][1],x,y));
    return ans;
}
double checky(double x)
{
    double l=-1000,r=1000;
    while(r-l>EPS)    
    {
        double y1=(l*2+r)/3,y2=(l+2*r)/3;
        if(f(x,y1)>f(x,y2))
            l=y1;
        else
            r=y2;
    }
    // cout<<x<<" "<<l<<endl;
    return f(x,l);
}  

int main()
{
    #ifdef __LOCAL__
        freopen("1.in","r",stdin);
        freopen("1.out","w",stdout);
    #endif
    cin>>n;
    _rep(i,1,n)
        cin>>a[i][0]>>a[i][1];
    double l=-1000,r=1000;
    while(r-l>EPS)
    {
        double x1=(l*2+r)/3,x2=(l+2*r)/3;
        double f1=checky(x1),f2=checky(x2);
        if(f1>f2)
            l=x1;
        else
            r=x2;
    }
    printf("%.18lf\n",checky(l));
    return 0;
}

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

using namespace std;

string s;
long long k;

int main()
{
	cin >> s >> k;
	k--;
	for(int i=0;i<s.size();i++)
	{
		if(s[i]!='1')
		{
			cout << s[i] << endl;
			return 0;
		}
		if(i==k)
		{
			cout << s[i] << endl;
			return 0;
		}
	}
	assert(false);
	return 0;
}

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

int main() {
  int a = 0, b = 0, N;
  cin >> N;
  vector<int> v(N);
  for (int i = 0; i < N; i++) cin >> v.at(i);
  sort(v.begin(), v.end());
  reverse(v.begin(), v.end());
  
  for (int i = 0; i < N; i++) {
    if (i % 2 == 0) a += v.at(i);
    else b += v.at(i);
  }
  cout << a - b << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#pragma GCC optimize("Os")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define rep(i,N) for(int i=0;i<(int)N;i++)
const int MOD=1e9+7,MAX=1e6;
static inline char CH()
{
  static char buf[100000],*ptr1=buf,*ptr2=buf;
  return ptr1==ptr2&&(ptr2=(ptr1=buf)+fread(buf,1,100000,stdin),ptr1==ptr2)?EOF:*ptr1++;
}
static inline int IN(void)
{
  int x=0,f=0,c=CH();while(c<48||c>57){f^=c==45,c=CH();}
  while(c>47&&c<58){x=x*10+c-48,c=CH();}return f?-x:x;
}
typedef struct{int SPF[1000001];int Primes[78498];int sz;}Template;
Template P;
static inline int MPow(int a,int b){return b?1l*MPow(1l*a*a%MOD,b>>1)*(b&1?a:1)%MOD:1;}
static inline void ready(void)
{
  *P.SPF=1,*P.Primes=2,P.sz=1;
  rep(i,MAX/2)P.SPF[2*(i+1)]=2,P.SPF[2*(i+1)-1]=2*(i+1)-1;
  rep(i,MAX/2-1)
  {
    int x=2*(i+1)+1;if(P.SPF[x]==x){P.Primes[P.sz++]=x;}
    rep(j,P.sz){if(P.Primes[j]<=P.SPF[x]&&x*P.Primes[j]<=MAX)P.SPF[x*P.Primes[j]]=P.Primes[j];else break;}
  }
}
int main(void)
{
  int N=IN(),A=0,factor=0,invsum=0,lcm=1,x=0,box[1000001]={0};ready();
  rep(i,N)
  {
    A=IN();invsum=(invsum+1l*MPow(A,MOD-2))%MOD;
    while(A>1)
    {
      factor=P.SPF[A];x=0;
      while(A%factor==0)A/=factor,x++;
      if(box[factor]<x)box[factor]=x; 
    }
  }
  rep(i,P.sz){if(box[P.Primes[i]])lcm=1l*lcm*MPow(P.Primes[i],box[P.Primes[i]])%MOD;}
  return printf("%ld\n",1l*lcm*invsum%MOD),0;
}

Measured memory_bytes: 9772
#include <bits/stdc++.h>
using namespace std;
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; }
using ll = long long;
using P = pair<ll, ll>;
const long double PI = acos(-1.0L);
ll GCD(ll a, ll b) { return b?GCD(b, a%b):a; }
ll LCM(ll a, ll b) { return a/GCD(a, b)*b; }

const int INF = 1e9;

int n;

int main() {
    while(1) {
        cin >> n;
        if(n == 0) break;
        vector<int> a(n, 0);
        for(int i = 0; i < n; ++i) cin >> a[i];
        int ans = INF;
        for(int i = 0; i < n; ++i) {
            for(int j = i+1; j < n; ++j) {
                chmin(ans, abs(a[i]-a[j]));
            }
        }
        cout << ans << endl;
    }
}


Measured memory_bytes: 3116
import sys

sys.setrecursionlimit(10 ** 6)
input = sys.stdin.readline
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")

def main():
    x=int(input())
    a = int(input())
    b = int(input())
    print((x-a)%b)

main()

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

bool vis[50];
int main()
{
	string s;
	cin>>s;
	for(int i=0;i<s.length();++i){
        if(i+1<s.length()&&s[i]==s[i+1]){
            cout<<i+1<<" "<<i+2<<endl;return 0;
        }
        if(i+2<s.length()&&s[i]==s[i+2]){
            cout<<i+1<<" "<<i+3<<endl;return 0;
        }
	}
	cout<<-1<<" "<<-1<<endl;
	return 0;
}


Measured memory_bytes: 512
#include "bits/stdc++.h"
using namespace std;

int main() {
	long long D, N;
	cin >> D >> N;
	if (D == 2 && N == 100) {
		cout << 1010000 << endl;
		return 0;
	}
	if (N < 100) {
		cout << N * pow(100, D) << endl;
	}
	else {
		cout << 101 * pow(100, D) << endl;
	}
}

Measured memory_bytes: 256
// SeeAlso: https://atcoder.jp/contests/abc142/tasks/abc142_b

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

#define MAX 100000
#define NIL -1
#define MOD 1000000007

typedef int _loop_int;
#define REP(i,n) for(int i = 0; i < n; i++)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))

// 最大公約数
inline constexpr ll gcd(ll a,ll b){if(!a||!b)return 0;while(b){ll c=b;b=a%b;a=c;}return a;}
// 最小公倍数
inline constexpr ll lcm(ll a,ll b){if(!a||!b)return 0;return a*b/gcd(a,b);}

#define print2D(h, w, arr) REP(i, h) { REP(j, w) cout << arr[i][j] << " "; cout << endl; }
template<class T> void print(const T& x){cout << setprecision(12) << x << endl;}
template<class T, class... A> void print(const T& first, const A&... rest) { cout << first << " "; print(rest...); }

ll N, K;

int main() {
    cin >> N >> K;
    ll ans = 0;
    REP(i, N) {
        int h;
        cin >> h;
        if (h>=K) {
            ans++;
        }
    }
    print(ans);
    return 0;
}


Measured memory_bytes: 256
n,*a=map(int,open(0).read().split());b={};M=10**9+7
for i,x in enumerate(a):b.setdefault(x,[]).append(i)
p=n+1;q=r=1;d=[abs(j[0]-j[1])for x,j in b.items()if len(j)>1][0]
for k in range(n+1):print((p-q)%M);q=q*(n-d-k)*r%M;r=pow(k+2,M-2,M);p=p*(n-k)*r%M

Measured memory_bytes: 75060
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int64_t N;
  int64_t G=1;
  int64_t ans=0;
  cin >> N;
  vector<int64_t> A(3*N);
  for(int i=0; i<3*N ; i++)
  {
    cin >> A.at(i);
  }
  sort(A.begin(),A.end());
  
  reverse(A.begin(),A.end());
  for(int j=0; j<N;j++)
  {
    ans=ans+A.at(G);
    G=G+2;
  }
  cout << ans << endl;
}

Measured memory_bytes: 5604
/*Collectionsクラスのソートを使う場合は
intなどのプリミティブ型は使えなくて
Integerなどのクラス型でないとダメらしい。
昇順->Arrays.sort(配列名)なのでintでもok*/

import java.util.*;
import java.io.*;

public class Main{
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    int n = scan.nextInt();
    Integer[] a = new Integer[n];
    //int[] a = new int[n];
    int AliceSum = 0;
    int BobSum = 0;

    for(int i = 0; i < n; i++){a[i] = scan.nextInt();}
    Arrays.sort(a, Collections.reverseOrder());

    for(int i = 0; i < n; i+=2)
      AliceSum += a[i];
    for(int i = 1; i < n; i+=2)
      BobSum += a[i];

      System.out.println(AliceSum-BobSum);

    }
  }


Measured memory_bytes: 24020
N = int(input())
a = int(str(N)[0])
b = int(str(N)[1])
c = int(str(N)[2])
A = (a + 1) * 100 + (a + 1) * 10 + (a + 1)
B = a * 100 + a * 10 + a
if a < b:
    ans = A
elif a > b:
    ans = B
else:
    if b >= c:
        ans = B
    else:
        ans = A

print(ans)

Measured memory_bytes: 3064
import java.util.Scanner;

public class Main
{
    public static void main(String[] args)
    {
        Scanner read = new Scanner(System.in);
        int n = read. nextInt();
        int k = read.nextInt();
        int count =0;
        for (int i=0;i<n;i++)
        {
            int h = read.nextInt();
            if (h>=k) {
                count++;
            }
        }
        System.out.println(count);
    }
}


Measured memory_bytes: 51404