akhauriyash/Code-Regression huggingface dataset:
#define _GLIBCXX_DEBUG
#include<algorithm>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<iostream>
#include<vector>
#include<queue>
#include<deque>
#include<stack>
#include<set>
#include<map>
#include<string>
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define rep2(i,s,n) for(int i=s;i< (int)n; i++)
#define ll long long 
#define all(v) v.begin(),v.end()
using namespace std;
const ll inf = 1000000007;
int main() {
  string s;
  cin >>s;
  string ans=s;
  ans[5]=' ';
  ans[13]=' ';
  cout <<ans<<endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		Integer i=sc.nextInt();
		String k=i.toString();
		String l=new StringBuffer(i.toString()).reverse().toString();
		//System.out.println(l+".."+k);
		if(l.compareTo(k)==0)
			System.out.println("Yes");
		else
			System.out.println("No");
	}
}


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

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

using namespace std;

//v.push_back(123);
//sort(v.begin(), v.end(),greater<int>());
//for(int x : v) {cout << x << endl;}

//for(int x: v) cout << x << endl;
//vector<vector<char>> v(H, vector<char>(W));
//vector<int> v(1000);

long long pow_mod(long long x, long long y, long long MOD){
	long long ret = 1;
	while(y){
		if (y & 1) ret = ret * x % MOD;
		x = x * x % MOD;
		y>>=1;
	}
	return ret;
}

signed main(){
  double W, H;
  double x, y;
  cin>>W>>H>>x>>y;

  cout << (W*H)/2.0 << " ";
  
  if(W/2==x && H/2==y){
    cout << 1 << endl;
  }else{
    cout << 0 << endl;
  }

  return 0;
}


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

int main(){
  int n,a=0,sum=0;
  cin>>n;
  vector<int> l(n);
  for(int i=0;i<n;i++){
    cin>>l.at(i);
  }
  for(int i=0;i<n;i++){
    a = max(l.at(i),a);
  }
  for(int i=0;i<n;i++){
    sum += l.at(i);
  }

  if(a < sum-a){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cassert>
#include <vector>
#include <string>
#include <cmath>
#include <map> 
using namespace std;
 
const int MAX= 10000100;

#define loop(i,a,b) for(int i = a ; i < b ; i ++)
#define rep(i,a) loop(i,0,a)
#define all(a) (a).begin(),(a).end()

int main(void){
  int n,m;
  cin>>n>>m;
  vector<vector<int> > town(n,vector<int>(n+1,1000));
  
  int a,b,c,d;
  for(int i = 0 ; i < m ; i ++){
    scanf("%d,%d,%d,%d",&a,&b,&c,&d);
    town[--a][--b] = c;
    town[b][a] = d;
  }
  scanf("%d,%d,%d,%d",&a,&b,&c,&d);
  int start = --a;
  int end = --b;
  int get = c;
  int lose = d;
  
  int max = 0;
  /*
  rep(i,town.size()){
    cout<<i<< " : ";
    rep(j,town[i].size()){
      printf("%4d ",town[i][j]);
    }
    cout<<endl;
  }
  */
  for(int k = 0 ; k < n ; k ++){
    for(int i = 0 ; i < n ; i ++){
      for(int j = 0 ; j < n ; j ++){
        town[i][j]=min(town[i][j],town[i][k]+town[k][j]);
      }
    }
  }
  //cout<<town[start][end]<<" "<<town[end][start]<<endl;
  cout<<get-lose-town[start][end]-town[end][start]<<endl;
  return 0;
}

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

int main() {
  int n, m, x, y; cin >> n >> m >> x >> y;
  int maxx, miny;
  if (x < y) maxx = x, miny = y;
  else {cout << "War" << endl; return 0;}

  for (int i = 0; i < n; i++) {
    int xi; cin >> xi;
    maxx = max(maxx, xi);
  }
  for (int i = 0; i < m; i++) {
    int yi; cin >> yi;
    miny = min(miny, yi);
  }
  cout << (maxx < miny ? "No War" : "War") << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
typedef pair<ll,ll> P;
#define M 1000000007
int main(){
  string s,t[3]={"Sunny","Cloudy","Rainy"};
  cin>>s;
  for(int i=0;i<3;i++){
    if(s==t[i]){
      cout<<t[(i+1)%3];
    }
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <algorithm>

using namespace std;

char trump;
pair<char, char> hands[4][13];
bool used[4][13];
char dealerSuit;

int val(char c){
  if('2' <= c && c <= '9') return c - '0';
  if(c == 'T') return 10;
  if(c == 'J') return 11;
  if(c == 'Q') return 12;
  if(c == 'K') return 13;
  if(c == 'A') return 14;
}

main(){
  while(cin >> trump){
    if(trump == '#') break;
    for(int i=0;i<4;i++){
      for(int j=0;j<13;j++){
	cin >> hands[i][j].first >> hands[i][j].second;
      }
    }
    int dealer = 3;
    int cntEw = 0, cntNs = 0;
    for(int i=0;i<13;i++){
      dealerSuit = hands[dealer][i].second;
      int turn = dealer;
      int value[4];
      for(int k=0;k<4;k++){
	value[k] = val(hands[k][i].first);
      }
      int winner;
      int valMax = -1;
      for(int j=0;j<4;j++){
	if(hands[j][i].second != trump) continue;
	if(valMax < value[j]){
	  winner = j;
	  valMax = value[j];
	}
      }
      if(valMax == -1){
	for(int j=0;j<4;j++){
	  if(hands[j][i].second != dealerSuit) continue;
	  if(valMax < value[j]){
	    winner = j;
	    valMax = value[j];
	  }
	}
	if(valMax == -1){
	  for(int j=0;j<4;j++){
	    if(valMax < value[j]){
	      winner = j;
	      valMax = value[j];
	    }
	  }
	}
      }
      dealer = winner;
      if(winner == 0 || winner == 2){
	cntNs++;
      }else{
	cntEw++;
      }
      /*if(winner == 0){
	cout << "north" << endl;
      }else if(winner == 1){
	cout << "east" << endl;
      }else if(winner == 2){
	cout << "south" << endl;
      }else{
	cout << "west" << endl;
	}*/
    }
    if(cntEw > cntNs){
      cout << "EW " << cntEw%6 << endl;
    }else{
      cout << "NS " << cntNs%6 << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 0
import sys

N,M=[int(x) for x in input().split()]
X = [int(x) for x in input().split()]

if N>=M:
    print(0)
    sys.exit()

X.sort();

dif = [X[i+1]-X[i] for i in range(M-1)]
dif.sort()
dif.reverse()
if M==1:
    dif = [0]

ans = sum(dif)
for i in range(N-1):
    ans -= dif[i]

print(ans)


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

int main() {
  int H, W;
  string S[200];
  int a[200][200];

  cin >> H >> W;

  rep(i,H){
    cin >> S[i];
  }

  rep(i,H){
    rep(j,W){
      if(S[i].at(j) == '#'){
        rep(p,3){
          rep(q,3){
            a[(i+1)-(p-1)][(j+1)-(q-1)] += 1;
          }
        }        
      }
    }
  }

  rep(i,H){
    rep(j,W){
      if(S[i].at(j) != '#'){
        cout << a[i+1][j+1];          
      }
      else{
        cout << S[i].at(j);          
      }
    }
    cout << endl;
  }

  return 0;
}

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

int64_t lucas(int n){
  int i = 2;
  int64_t l_1 = 1;
  int64_t l_2 = 2;
  int64_t lucas_n = 0;
  
  if(n == 0){
    return 2;
  }else if(n ==1){
    return 1;
  }
  
  while(i <= n){
    lucas_n = l_2 + l_1;
//    cout << lucas_n << " " << l_2 << " " << l_1 << endl;
    l_2 = l_1;
    l_1 = lucas_n;
    i++;
  }
  return lucas_n;
}

int main(){
  int N;
  cin >> N;
  
  cout << lucas(N) << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = s; i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << '\n';
#define CFYN(n) cout << ( (n) ? "YES":"NO") << '\n';
#define OUT(n) cout << (n) << '\n';
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;

int main(void)
{
    IOS
    std::vector<ll> v(7);
    REP(i,7) cin >> v[i];
    
    ll ans = 0;
    ans += v[0] / 2 * 2;
    ans += v[1] ;
    ans += v[3] / 2 * 2;
    ans += v[4] / 2 * 2;
    
    int LIJ = 0;
    LIJ += v[0] % 2 == 1; 
    LIJ += v[3] % 2 == 1; 
    LIJ += v[4] % 2 == 1;
    if (v[0] == 0 || v[3] == 0 || v[4] == 0) LIJ = 0;
    if (LIJ == 2) ans +=1;
    if (LIJ == 3) ans +=3;
    
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <algorithm>
#include <cstdio>

using namespace std;

int main()
{
    int N, K;

    cin >> N >> K;

    double sum = 0;
    for (int i = 1; i <= N; i++)
    {
        double c = log2(((double)K) / i);
        c = ceil(c);
        c = max(0.0, c);
        double p = exp2(-c);
        sum += p;
    }

    printf("%.20lf\n", sum / N);

    return 0;
}

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

using namespace std;
typedef long long ll;
typedef long double ld;
#define X first;
#define Y second;
typedef pair<int,int> pii;
typedef pair<ll,int> pli;
typedef pair<ll,ll> pll;
const ll INF = 2e18;
const int inf = 1e9+10;
const int maxN = 2e5 + 10;
const int maxK = 1e4+10;
const int maxD = 15;
const int maxH = 100; 
const int MOD = 1e9+7;


int main()
{
	ll n,D;
	cin>>n>>D;
	int ans = 0;
	for(int i=1;i<=n;i++)
	{
		ll x,y;
		cin>>x>>y;
		ll sum = x*x + y*y;
		if(sum<= D*D)
		{
			ans++;
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3632
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
typedef vector<vector<P>> vvP;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;

int main() {
    ll n;
    cin >> n;
    if(n%2 == 1) {
        out(2*n);
    }
    else {
        out(n);
    }
    re0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<vector>
using namespace std;
int main(){
    int n;
    while(~scanf("%d",&n)){
        vector<int> ar;
        for(int i=512;i>=1;i/=2){
            if(n>=i){
                ar.push_back(i);
                n-=i;
            }
        }
        for(int i=ar.size()-1;i>0;i--){
            printf("%d ",ar[i]);
        }
        printf("%d",ar[0]);
        printf("\n");
    }
}

Measured memory_bytes: 0
#ABC-107-B
def main():
    H, W = map(int, input().split())
    grid = []
    for _ in range(H):
        row = list(input())
        grid.append(row)

    for i in reversed(range(H)):
        if not "#" in grid[i]:
            del grid[i]
            H -= 1

    for j in reversed(range(W)):
        flag = True
        for i in reversed(range(H)):
            if grid[i][j] == "#":
                flag = False
                break
        if flag == True:
            for i in range(H):
                del grid[i][j]
    for row in grid:
        print("".join(row))

if __name__ == "__main__":
    main()


Measured memory_bytes: 3188
/*Code by Codercjh*/
#include<bits/stdc++.h>
#define fr(i,a,b) for(int i=(a);i<=(b);++i)
#define rf(i,a,b) for(int i=(a);i>=(b);--i)
#define min(a,b) (a<b?a:b)
#define max(a,b) (a>b?a:b)
using namespace std;
typedef long long ll;
template<typename T>
inline void read(T &x){
	char c=getchar();T fh=0;bool f=false;
	while(!isdigit(c))f|=(c=='-'),c=getchar();
	while(isdigit(c))fh=(fh<<1)+(fh<<3)+(c^48),c=getchar();
	x=f?-fh:fh;
	return;
}
char s[2005][2005];
int n,m,u[2005][2005],d[2005][2005],l[2005][2005],r[2005][2005],ans;
int main(){
    read(n),read(m);
	fr(i,1,n)cin>>s[i]+1;
	fr(i,1,n)fr(j,1,m)if(s[i][j]=='.'){
		u[i][j]=s[i-1][j]=='.'?u[i-1][j]+1:1;
		l[i][j]=s[i][j-1]=='.'?l[i][j-1]+1:1;
	} 
	rf(i,n,1)rf(j,m,1)if(s[i][j]=='.'){
		d[i][j]=s[i+1][j]=='.'?d[i+1][j]+1:1;
		r[i][j]=s[i][j+1]=='.'?r[i][j+1]+1:1;
	}
	fr(i,1,n)fr(j,1,m)ans=max(ans,u[i][j]+d[i][j]+l[i][j]+r[i][j]-3);
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 66944
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <iomanip>
#include <cassert>
using namespace std;

#define GET_ARG(a,b,c,F,...) F
#define REP3(i,s,e) for (i = s; i <= e; i++)
#define REP2(i,n) REP3 (i,0,(int)(n)-1)
#define REP(...) GET_ARG (__VA_ARGS__,REP3,REP2) (__VA_ARGS__)
#define RREP3(i,s,e) for (i = s; i >= e; i--)
#define RREP2(i,n) RREP3 (i,(int)(n)-1,0)
#define RREP(...) GET_ARG (__VA_ARGS__,RREP3,RREP2) (__VA_ARGS__)
#define DEBUG(x) cerr << #x ": " << x << endl

typedef long long ll;

int main(void) {
    ll a, b, c;
    cin >> a >> b >> c;
    if (a % 2 == 0 || b % 2 == 0 || c % 2 == 0)
        cout << 0 << endl;
    else
        cout << min({a*b,b*c,c*a}) << endl;
    return 0;
}


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

typedef long long ll;
const int INF = 1e9;
const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll LINF = 1e18;
#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define next asdnext
#define prev asdprev
#define MP make_pair
#define F first
#define S second
#define PB push_back
#define dump(x)  cout << #x << " = " << (x) << endl;	// debug
#define SZ(x) ((ll)(x).size())
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define RFOR(i, a, b) for (ll i = (a); i >= (b); i--)
#define ps(s) cout << #s << endl;
#define pv(v) cout << (v) << endl;
#define pvd(v) cout << setprecision(16) << (v) << endl;
#define ALL(a)  (a).begin(),(a).end()
#define RANGE(a, left, right)  (a).begin()+(left),(a).begin()+(right)	// left to (right-1)


int main() {
	int n, k;
	cin >> n >> k;
	vector<int> a(n);
	int pos1;
	FOR(i, 0, n - 1) {
		cin >> a[i];
		if (a[i] == 1) {
			pos1 = i;
		}
	}
	int res = 0;
	int range = k - 1;
	res += (pos1 + range-1) / range;
	int left = res * range;
	if (left >= n - 1) {
		pv(res)
	}
	else {
		res += (n - 1 - left +range-1) / range;
		pv(res)
	}
	return 0;
}

Measured memory_bytes: 3756
#include <iostream>
#include <sstream>
#include <fstream>

#include <ctime>
#include <cstdlib>
#include <cstring>
#include <cctype>

#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>

#include <cmath>
#include <algorithm>
#include <functional>
#include <numeric>

using namespace std;

template<typename T> ostream& operator<<(ostream& os, const vector<T>& v){
    os << "{ ";
    for (typename vector<T>::const_iterator it = v.begin(); it != v.end(); ++it)
        os << '\"' << *it << '\"' << (it + 1 == v.end() ? "" : ", ");
    os << " }";
    return os;
}

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef vector<vb> vvb;
#define vv(type,w,h,init) vector<vector<type>>(h,vector<type>(w,init))
typedef vector<string> vs;
typedef long long ll;
typedef unsigned uint;
typedef unsigned long ul;
typedef unsigned long long ull;

#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define loop(i,a,b) for(int i=(a); i<(int)(b); i++)
#define rep(i,b) loop(i,0,b)
#define pb push_back
#define mp make_pair

int main(){
    int x;
    cin >> x;
    while (x--){
        int n; cin >> n;

        int down = 0;
        int up = 0;

        int prev; cin >> prev;

        rep(i, n - 1){
            int cur;
            cin >> cur;
            int d = cur - prev;
            if (d > 0){
                up = max(up, d);
            }
            else{
                down = max(down, -d);
            }
            prev = cur;
        }
        cout << up << " " << down << endl;
    }
}

Measured memory_bytes: 1160
#include <stdio.h>
#include<math.h>
#include<stdbool.h>
#include<string.h>
typedef long long lint;
int i,j;
int dp[5050][5050]={};
#define INF (1<<30)

int main(void){
    char S[5050],T[5050];
    scanf("%s",S);
    scanf("%s",T);
    int N=strlen(S),K=strlen(T);
    for(i=0;i<=N;i++) dp[i][0]=i;
    for(i=0;i<=K;i++) dp[0][i]=i;
    for(i=1;i<=N;i++) for(j=1;j<=K;j++){
        int min=INF;
        int add=S[i-1]==T[j-1]?0:1;
        if(dp[i-1][j-1]+add<min) min=dp[i-1][j-1]+add;
        if(dp[i-1][j]+1<min) min=dp[i-1][j]+1;
        if(dp[i][j-1]+1<min) min=dp[i][j-1]+1;
        dp[i][j]=min;
    }
    printf("%d\n",dp[N][K]);
}


Measured memory_bytes: 10612
use proconio::input;

#[proconio::fastout]
fn main() {
    input! {
        d: i32,
        c: [i32; 26],
        s: [[i32; 26]; d],
        t: [i32; d]
    }
    let mut satification = 0;
    let mut last: Vec<i32> = vec![0; 26];
    for (i, t) in t.into_iter().enumerate() {
        last[t as usize - 1] = i as i32 + 1;
        satification += s[i][t as usize - 1];
        satification -= last.iter().zip(&c).map(|(l, c)| {c*(i as i32 - l + 1)}).sum::<i32>();
        println!("{}", satification);
    }
}


Measured memory_bytes: 2256
#include <algorithm>
#include <cassert>
#include <cmath>
#include <iostream>
#include <map>
#include <queue>
#include <vector>

static const int IINF = 1 << 30;
static const long long LINF = 1LL << 60;
static const long long MOD = 1.0e+9 + 7;

template <typename T> std::vector<T> vectors(std::size_t n, T val) {
  return std::vector<T>(n, val);
}

template <typename T, typename... Args>
auto vectors(std::size_t n, Args... args) {
  return std::vector<decltype(vectors<T>(args...))>(n, vectors<T>(args...));
}

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

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

template <class T> inline void chadd(T &a, const T &b) {
  a += b, a %= MOD;
  // TODO minus case
}

template <class T>
std::ostream &operator<<(std::ostream &s, const std::vector<T> &v) {
  if (v.empty())
    return s;
  s << *v.begin();
  for (auto iter = v.begin() + 1; iter != v.end(); ++iter)
    if (std::is_fundamental<T>::value)
      s << " " << *iter;
    else
      s << std::endl << *iter;
  return s;
}

int main() {
  // Input
  int N, D;
  std::cin >> N >> D;

  // Main
  int res = 0;
  while (res * (2 * D + 1) < N)
    res += 1;

  std::cout << res << std::endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < (int)n; i++)
#define all(x) x.begin(), x.end()
#define MOD 1000000007//1e9+7
typedef long long ll;
using namespace std;
int main()
{
  int n;
  cin >> n;
  string ans = "Three";
  string tmp;
  REP(i,n){
    cin >> tmp;
    if(tmp == "Y"){ans = "Four";break;}
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define rep2(i,s,n) for (int i = s; i < n; ++i)
#define all(a) a.begin(),a.end()
#define tmax(a,b,c) max(a,max(b,c))
#define tmin(a,b,c) min(a,min(b,c))
#define pb push_back
#define fi first
#define se second
using namespace std;
using ll = long long;
using P = pair<int,int>;
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 int inf = 1001001001;

int main() {
    int k,x;
    cin >> k >> x;
    rep2(i,x-k+1,x+k) cout << i << " ";
    cout << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  
  int n;
  cin >> n;
  
  int i = 1;
  int s, t = 0;
  
  while(i <= n){
    
    int j = i;
    
    while(j > 0){
      j /= 10;
      t++;
    }
    
    if(t % 2 == 1){
      s++;
    }
    
    i++;
    t = 0;
  }
  
  cout << s << endl;
}
   

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

using namespace std;
#define PB push_back
#define MP make_pair
#define LL long long
#define int LL
#define FOR(i,a,b) for(int i = (a); i <= (b); i++)
#define RE(i,n) FOR(i,1,n)
#define REP(i,n) FOR(i,0,(int)(n)-1)
#define R(i,n) REP(i,n)
#define VI vector<int>
#define PII pair<int,int>
#define LD long double
#define FI first
#define SE second
#define st FI
#define nd SE
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())

template<class C> void mini(C &a4, C b4) { a4 = min(a4, b4); }
template<class C> void maxi(C &a4, C b4) { a4 = max(a4, b4); }

template<class TH> void _dbg(const char *sdbg, TH h){ cerr<<sdbg<<'='<<h<<endl; }
template<class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) {
  while(*sdbg!=',')cerr<<*sdbg++;cerr<<'='<<h<<','; _dbg(sdbg+1, a...);
}

template<class T> ostream &operator<<(ostream& os, vector<T> V) {
  os << "["; for (auto vv : V) os << vv << ","; return os << "]";
}
template<class L, class R> ostream &operator<<(ostream &os, pair<L,R> P) {
  return os << "(" << P.st << "," << P.nd << ")";
}

#ifdef LOCAL
#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
#define debug(...) (__VA_ARGS__)
#define cerr if(0)cout
#endif

const int P = 1e9 + 7;
const int MAX = 2001;
int dp[MAX][MAX];
int dp2[MAX][MAX];
int dp3[MAX][MAX];

int licz3(int a,int b){
  if(a == 0 || b == 0)return 1;
  if(dp3[a][b] != 0)return dp3[a][b];
  int &res = dp3[a][b];
  res = licz3(a-1,b-1) + licz3(a,b-1);
  if(res >= P)res -= P;
  return res;
}
int licz2(int a,int b){
  if(a == 0 || b == 0)return 1;
  if(dp2[a][b] != 0)return dp2[a][b];
  int &res = dp2[a][b];
  if(a)res += licz2(a-1,b);
  res += licz3(a,b-1);
  if(res >= P)res -= P;
  return res;
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout << fixed << setprecision(11);
  cerr << fixed << setprecision(6);
  R(i,MAX)R(j,i+1){
    if(j==0){
      dp[i][j] = 1;
    }else{
      dp[i][j] = dp[i-1][j] + dp[i-1][j-1];
      if(dp[i][j] >= P)dp[i][j] -= P;
    }
  }
  int a,b;
  cin >> a >> b;
  int res = 0;
  R(i,a+1){
    R(j,min(a-i+1,b)){
      res = (res + dp[b-1][j] * licz2(a-i-j, j) )% P;
    //  debug(j, res);
    }
    debug(i,res);
  }
  cout << res << "\n";
}


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

vector<vector<ll>> dp;

ll aCb(ll a, ll b) {
    if(b < 0) return 0;
    if(dp[a][b] != -1) {
        return dp[a][b];
    }
    if(a == b) {
        return 1;
    } else if(b == 0) {
        return 1;
    } else if(b == 1) {
        return a;
    } else {
        return dp[a][b] = (aCb(a - 1, b - 1) + aCb(a - 1, b)) % 1000000007;
    }
}

int main() {
    ll n, k;
    cin >> n >> k;
    ll ANS = 0;
    dp.assign(n, vector<ll>(n, -1));
    for(ll i = 1; i <= k; i++) {
        if(i == 1) {
            ANS = n - k + 1;
        } else {
            if(i - 1 < k - 1 - (i - 1)) {
                ANS = aCb(k - 1, i - 1);
            } else {
                ANS = aCb(k - 1, k - 1 - (i - 1));
            }
            ANS %= 1000000007;
            if(i < n - k + 1 - i) {
                ANS *= aCb(n - k + 1, i);
            } else {
                ANS *= aCb(n - k + 1, n - k + 1 - i);
            }
            ANS %= 1000000007;
        }
        cout << ANS << endl;
    }
}


Measured memory_bytes: 31616
x,y,a,b,c=map(int, input().split())
p=list(map(int, input().split()))
q=list(map(int, input().split()))
r=list(map(int, input().split()))

p.sort()
q.sort()
r.sort()

ans=[]
ans.append(p[a-x:])
ans.append(q[b-y:])
ans.append(r[c-x-y if c >= x+y else 0:])

ans=sum(ans, [])
ans.sort()

print(sum(ans[len(ans)-x-y:]))


Measured memory_bytes: 112492
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;


int main(){
  ll N;
  cin >> N;

  cout << 180 * (N-2) << endl;
  
  return 0;
}

Measured memory_bytes: 256
A = int(input())
B = int(input())
C = int(input())
X = int(input())

count = 0

for a in range(A+1):
    for b in range(B+1):
        for c in range(C+1):
            if 500*a + 100*b + 50*c == X:
                count +=1

print(count)

Measured memory_bytes: 3060
use proconio::fastout;
use proconio::input;
use proconio::marker::Usize1;

#[fastout]
fn main() {
    input! {
        h: usize, w: usize, m: usize,
        bs: [(Usize1, Usize1); m],
    }
    let mut hs = vec![0; h];
    let mut ws = vec![0; w];
    for &(i, j) in &bs {
        hs[i] += 1;
        ws[j] += 1;
    }
    let h_max = hs.iter().max().unwrap();
    let w_max = ws.iter().max().unwrap();
    let h_cnt = hs.iter().filter(|&x| x == h_max).count();
    let w_cnt = ws.iter().filter(|&x| x == w_max).count();

    let dup = bs
        .iter()
        .filter(|&&(i, j)| &hs[i] == h_max && &ws[j] == w_max)
        .count();
    // println!("h_cnt={},w_cnt={},dup={}", h_cnt, w_cnt, dup);
    let ans = h_max + w_max - if h_cnt * w_cnt - dup >= 1 { 0 } else { 1 };
    println!("{}", ans);
}


Measured memory_bytes: 12984
#include<iostream>
using namespace std;
int n;
int p[51];
int sum=0;
int main(){
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>p[i];
		if(p[i]!=i)
			sum++;
	}
	if(sum>=3)
		cout<<"NO\n";
	else cout<<"YES\n";
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void){
	int d, t, s;
	scanf("%d", &d);
	scanf("%d", &t);
	scanf("%d", &s);
	int need_time = d%s == 0 ? d/s : d/s + 1;
	if(t < need_time){
		printf("No\n");
	} else{
		printf("Yes\n");
	}
}


Measured memory_bytes: 1660
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,m,sum=0;
	cin>>n>>m;
  	int a[m+1];
	for(int i=0;i<m;i++){
		cin>>a[i];
		sum+=a[i];
	}
	if(n>=sum) cout<<n-sum<<endl;
  	else cout<<-1<<endl;
	return 0;
}


Measured memory_bytes: 3660
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <random>
#include <chrono>
#include <queue>
#include <math.h>
#include <string>
#include <sstream>
#include <stack>
#include <deque>
#define pb push_back
#define make make_pair
#define kaku(a) cout << a << endl
#define isort(a) sort(a.begin(),a.end())
#define ll long long

using namespace std;


#define rep(i,n) for(ll i=0;i<n;i++)
#define PI 3.14159265359
long long gcd(long long a,long long b){ return b==0?a:gcd(b,a%b);}
long long lcm(long long a,long long b){ return a/gcd(a,b)*b;}

const ll inf =1000000007;
typedef pair<ll,ll> Pair;


typedef vector<ll> vl;

void asolve(){
    rep(i,5){
        ll a;
        cin >>a;
        if(a==0){
            kaku(i+1);
        }
    }

}

void bsolve(){

}

void csolve(){

}

void dsolve(){

}

int main(){
    asolve();
}

Measured memory_bytes: 3632
fn func(input_str: &str) -> f64 {
    let mut iter = input_str.split_whitespace();
    let n: usize = iter.next().unwrap().parse().unwrap();
    let mut ans = 0.0;
    for _ in 0..n {
        let x: f64 = iter.next().unwrap().parse().unwrap();
        let u: &str = iter.next().unwrap();
        match u {
            "JPY" => ans += x,
            "BTC" => ans += x * 380000.0,
            _ => panic!(),
        };
    }
    ans
}

use std::io::Read;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();
    println!("{}", func(&buf[..]));
}

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

max_N = 1000000
memo = [False]*max_N
import sys
import threading
sys.setrecursionlimit(100000)
threading.stack_size(128*1024*1024)


# 貰う DPではなく、再帰を使ったメモ化再帰
from functools import lru_cache

lru_cache(maxsize=100000)
def f(n):
	if n < 6:
		return n
	if memo[n]:
		# print(f"at n: {n}, memo[n]:", memo[n])
		return memo[n]
	
	ans = n
	# メモ化
	x = 6
	while x <= n:
		ans = min(ans, f(n-x)+1)
		x *= 6
	
	x = 9
	while x <= n:
		ans = min(ans, f(n-x)+1)
		x *= 9
	
	memo[n] = ans
	return ans

def main():
	print(f(n))
	
threading.Thread(target=main).start()

Measured memory_bytes: 27744
# -*- coding: utf-8 -*-


def main():
    from itertools import accumulate

    n, k = map(int, input().split())
    p = [int(i) + 1 for i in input().split()]
    e = list(accumulate([0] + p))
    ans = 0

    for j in range(n - k + 1):
        ans = max(ans, e[j + k] - e[j])

    print(ans / 2)


if __name__ == '__main__':
    main()


Measured memory_bytes: 25152
import re
n,a,b,c,d = map(int,input().split())
s = input()
#a,b,c,d = map(lambda x:x-1,[a,b,c,d])

if re.search(r'##',s[a-1:max(b,d)]):
    print('No')
else:
    if c>d:
        if (re.search(r'\.{3,}',s[b-2:d+1])):
            print('Yes')
        else:
            print('No')
    else:
        print('Yes')

Measured memory_bytes: 3700
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
#include <vector>
#include <queue>
#define INF 105

using namespace std;
vector <int> vec[INF*INF];
int dis[INF][INF],Dif[INF],Dfn,Du[INF*INF],MAXN=5000;
bool vis[INF*INF];
void Pre_vec(int i,int j)
{
    vec[i].push_back(j),vec[j].push_back(i);
    if (i<MAXN) Du[i]++;
    if (j<MAXN) Du[j]++;
}
void Pre_node()
{
    int i;
    for (Dfn=0,i=1;i+1<dis[1][2];i++)
        Pre_vec(i,i+1); Dfn=i;
    Pre_vec(1,1+MAXN),Pre_vec(i,2+MAXN);
}
void dfs(int n,int dis)
{
    if (n>MAXN) {
        Dif[n-MAXN]=dis; return ;
    }
    int i,j,siz=vec[n].size();
    for (i=vis[n]=0;i<siz;i++)
        if (vis[j=vec[n][i]])
            dfs(j,dis+1);
}
void Pre_dfs(int n)
{
    memset(vis,true,sizeof(vis));
    dfs(n,0);
}
int Check(int n)
{
    int i,dif=dis[n][1]-Dif[1];
    for (i=2;i<n;i++)
        if (dif!=dis[n][i]-Dif[i])
            return 0;
    return dif;
}
void Inc_node(int n)
{
    int i,j,dif;
    for (i=1;i<=Dfn;i++)
        if (Pre_dfs(i),dif=Check(n),dif)
            break;
    if (dif==1) {
        Pre_vec(i,n+MAXN); return ;
    }
    Pre_vec(i,++Dfn);
    for (j=1;j+1<dif;j++)
        Pre_vec(Dfn,Dfn+1),++Dfn;
    Pre_vec(Dfn,n+MAXN);
}
int main()
{
    int i,j,n;
    while (scanf("%d",&n),n)
    {
        memset(Du,0,sizeof(Du));
        for (i=1;i<=n;i++)
            for (j=1;j<=n;j++)
                scanf("%d",&dis[i][j]);
        Pre_node();
        for (i=3;i<=n;i++)
            Inc_node(i);
        for (sort(Du+1,Du+Dfn+1),i=1;i<=Dfn;i++)
            printf("%d%c",Du[i],i==Dfn?'\n':' '),vec[i].clear();
    }
    return 0;
}

Measured memory_bytes: 1580
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {
	defer writer.Flush()
	n, q := ReadInt(), ReadInt()
	t := NewLazySegTree(n)
	for ; q > 0; q-- {
		if ReadInt() == 0 {
			t.Add(ReadInt()-1, ReadInt(), ReadInt())
		} else {
			Println(t.GetSum(ReadInt()-1, ReadInt()))
		}
	}
}

type LazySegTree struct {
	nodes []int
	lazy  []int
}

const Inf = 1 << 62
const None = -Inf

func NewLazySegTree(n_ int) *LazySegTree {
	n := 1
	for n < n_ {
		n <<= 1
	}
	t := &LazySegTree{
		nodes: make([]int, n*2),
		lazy:  make([]int, n*2),
	}
	for i := 1; i < len(t.lazy); i++ {
		t.lazy[i] = None
	}
	return t
}

func (t *LazySegTree) addLazy(k, x int) {
	if t.lazy[k] == None {
		t.lazy[k] = x
	} else {
		t.lazy[k] += x
	}
}

func (t *LazySegTree) lazyEval(k, l, r int) {
	if t.lazy[k] == None {
		return
	}
	t.nodes[k] += t.lazy[k]
	if r-l > 1 {
		t.addLazy(k*2, t.lazy[k]>>1)
		t.addLazy(k*2+1, t.lazy[k]>>1)
	}
	t.lazy[k] = None
}

func (t *LazySegTree) Add(a, b, x int) {
	t.addRecur(a, b, x, 1, 0, len(t.nodes)>>1)
}
func (t *LazySegTree) addRecur(a, b, x, k, l, r int) {
	t.lazyEval(k, l, r)
	if r <= a || b <= l {
		return
	}
	if a <= l && r <= b {
		t.addLazy(k, (r-l)*x)
		t.lazyEval(k, l, r)
	} else {
		t.addRecur(a, b, x, k*2, l, (l+r)/2)
		t.addRecur(a, b, x, k*2+1, (l+r)/2, r)
		t.nodes[k] = t.nodes[k*2] + t.nodes[k*2+1]
	}
}

func (t *LazySegTree) GetSum(a, b int) int {
	return t.getSumRecur(a, b, 1, 0, len(t.nodes)>>1)
}
func (t *LazySegTree) getSumRecur(a, b, k, l, r int) int {
	t.lazyEval(k, l, r)
	if r <= a || b <= l {
		return 0
	}
	if a <= l && r <= b {
		return t.nodes[k]
	} else {
		return t.getSumRecur(a, b, k*2, l, (l+r)/2) +
			t.getSumRecur(a, b, k*2+1, (l+r)/2, r)
	}
}

var scanner = bufio.NewScanner(os.Stdin)

func init() {
	scanner.Buffer(make([]byte, 256), 1e9)
	scanner.Split(bufio.ScanWords)
}
func ReadString() string { scanner.Scan(); return scanner.Text() }
func ReadInt() int {
	a, err := strconv.Atoi(ReadString())
	if err != nil {
		panic(err)
	}
	return a
}

var writer = bufio.NewWriter(os.Stdout)

func Println(a ...interface{}) { fmt.Fprintln(writer, a...) }



Measured memory_bytes: 7328
"""
import random
import functools
import copy
import bisect
import array
import re
import collections
import heapq
import fractions
import itertools
import string
import math
from operator import itemgetter as ig
from bisect import bisect_left, bisect_right, insort_left, insort_right
from itertools import permutations, combinations, product, accumulate, groupby
from heapq import heappush, heappop
from collections import deque, defaultdict, Counter
import sys
sys.setrecursionlimit(10 ** 7)
# import numpy as np

inf = 10 ** 20
INF = float("INF")
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = dd + [(-1, 1), (1, 1), (1, -1), (-1, -1)]
ddn9 = ddn + [(0, 0)]
'''for dx, dy in dd:
        nx = j + dx; ny = i + dy
            if 0 <= nx < w and 0 <= ny < h:'''
"""
from collections import deque, defaultdict, Counter
import math
import sys
sys.setrecursionlimit(10 ** 7)


def wi(): return list(map(int, sys.stdin.readline().split()))
# WideIntPoint


def wip(): return [int(x) - 1 for x in sys.stdin.readline().split()]


def ws(): return sys.stdin.readline().split()


def si(): return int(sys.stdin.readline())  # SingleInt


def ss(): return input()


def hi(n): return [si() for _ in range(n)]


def hs(n): return [ss() for _ in range(n)]  # HeightString


def s_list(): return list(input())


def mi(n): return [wi() for _ in range(n)]  # MatrixInt


def mip(n): return [wip() for _ in range(n)]


def ms(n): return [ws() for _ in range(n)]


def num_grid(n): return [[int(i) for i in sys.stdin.readline().split()[
    0]] for _ in range(n)]  # NumberGrid


def grid(n): return [s_list() for _ in range(n)]


def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

# a/b の切り上げ


def round_up(a, b):
    """ a/b の切り上げ """
    c = (a + b - 1) / b
    return c


def lcm(a, b):
    """a,bの最小公倍数"""
    return a * b // gcd(a, b)


def main():
    n = int(input())
    s = defaultdict(int)
    for i in range(n):
        s[input()] += 1

    print(len(s))


if __name__ == '__main__':
    main()


Measured memory_bytes: 133404
import functools


def sum_of_digits(digits):
    """culculate the sum of each digit of 'digits'

    >>> sum_of_digits("123")
    6
    >>> sum_of_digits("100")
    1
    >>> sum_of_digits("")
    0
    """
    return functools.reduce(lambda x, y: x+int(y), digits, 0)


def run():
    d = input()

    while d != '0':
        print(sum_of_digits(d))
        d = input()


if __name__ == '__main__':
    run()



Measured memory_bytes: 6284
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long ll;
#define rep(i,n) for (int i=0;i < (int)(n);i++)

int main(){
   int n,m,x;
   cin >> n >> m >> x;
   vector<vector<int>> c(n,vector<int> (m+1));
   rep(i,n){
      rep(j,m+1){
         cin >> c[i][j];
      }
   }
   int ans = 1e9;
   for (int bit = 0; bit < 1 << n; bit++){
      vector<int> v(m+1,0);
      int cost = 0;
      for (int j = 0; j < n;j++){
         if (bit & 1 << j){
            cost += c[j][0];
            for (int k =1;k < m+1;k++){
               v[k] += c[j][k];
            }
         }
      }
      bool can = true;
      for (int w = 1; w < m+1;w++){
         if (v[w] < x){
            can = false;
            break;
         }
      }
      if (can) ans = min(ans,cost);
      //cout << bit << " " << cost << endl; 
   }
   
   if (ans == 1e9) cout << -1 << endl;
   else cout << ans << endl;
  

   return 0;
}


Measured memory_bytes: 3632
a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

print(a[int(input())-1])

Measured memory_bytes: 3060
n = int(input())
l = list(map(int,input().split()))
l.sort()

ans = 0
for i in range(n-2):
    li = l[i]
    for j in range(i+1,n-1):
        lj = l[j]
        for k in range(j+1,n):
            lk = l[k]
            if(li==lj)|(lj==lk):
                continue
            if(li+lj <= lk):
                continue
            ans += 1
print(ans)

Measured memory_bytes: 68188
#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <map>
#include <set>
#include <stack>
#include <queue>
 
using namespace std;
 
#define pb(n)	push_back(n)
#define mp(n,m) make_pair(n,m)
#define fi 	first
#define se 	second
#define all(r) (r).begin(),(r).end()

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

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
 
const int IMAX=((1<<30)-1)*2+1;
const double EPS=1e-10;
//int mod=1000000007


string t[10]={
	"",
	".,!? ",
	"abc",
	"def",
	"ghi",
	"jkl",
	"mno",
	"pqrs",
	"tuv",
	"wxyz"
};



int main(){
	int n;
	string s;
	cin>>n;
	rep(i,n){
		cin>>s;
		string a;
		rep(j,s.size()){
			if(s[j]!='0'){
				char c=t[s[j]-'0'][0];
				int k=0;
				while(1){
					j++;
					if(j>s.size())break;
					if(s[j]=='0'){
						a+=c;
						break;
					}
					k=(k+1)%t[s[j]-'0'].size();
					c=t[s[j]-'0'][k];
				}
			}
		}
		cout<<a<<endl;
	}
}

Measured memory_bytes: 1216
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,a,n) for(int i=(a); i<(n); i++)
#define all(v) v.begin(), v.end()
#define fi first
#define se second
#define sz(x) int(x.size())
using namespace std;
using ll = long long;
using P = pair<int ,int>;
const int INF = 1001001001;
const int MOD = 1000000007;
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 (b<a) {a=b; return 1;} return 0;}

#ifdef _DEBUG
#include "debug.h"
#else
#define debug(...)
#define print(...)
#endif

int main() {
    int n; cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    sort(all(a));
    int ans = a.back();
    int pre = INF;
    vector<P> xy;
    rep(i, n-1) {
        if (a[i]<0&&a[i+1]<0) {
            xy.emplace_back(ans, a[i]);
            ans -= a[i];
        } else {
            if (pre == INF) pre = a[i];
            else {
                xy.emplace_back(pre, a[i]);
                pre -= a[i];
            }
        }
    }
    if (pre!=INF) xy.emplace_back(ans, pre);
    if (pre!=INF) ans -= pre;
    cout << ans << endl;
    for(const auto& p: xy) {
        cout << p.fi << " " << p.se << endl;
    }
}

Measured memory_bytes: 3188
from scipy.sparse.csgraph import floyd_warshall
N,M,L=map(int,input().split())
inf=10**9+1

distance=[[inf for n in range(N)] for n in range(N)]
for n in range(N):
    distance[n][n]=0
for m in range(M):
    a,b,c=map(int,input().split())
    distance[a-1][b-1]=c
    distance[b-1][a-1]=c
distance=floyd_warshall(distance)

distance2=[[inf for n in range(N)] for n in range(N)]
for i in range(N):
    for j in range(N):
        if distance[i][j]<=L:
            distance2[i][j]=1
for n in range(N):
    distance2[n][n]=0
distance2=floyd_warshall(distance2)

Q=int(input())
for q in range(Q):
    s,t=map(int,input().split())
    if distance2[s-1][t-1]==inf:
        print(-1)
    else:
        print(int(distance2[s-1][t-1]-1))

Measured memory_bytes: 18760
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <regex>
#define REP(i,n) for(int i = 0; i < n; i++)
#define FOR(i,j,n) for(int i = j; i < n; i++)
#define RFOR(i,j,n) for(int i = j-1; i >= n; i--)
#define PREC(n) fixed << setprecision(n)
#define print_array(v) REP(__k, v.size()) { cout << v[__k]; if(__k != v.size()-1) cout << " "; else cout << endl; }
#define YesorNo(a) printf(a?"Yes\n":"No\n")
#define _LIBCPP_DEBUG 0
using namespace std;
int64_t MOD = 1000000007;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a, b;
  cin >> a >> b;
  cout << a + b / 2 << endl;
  return 0;
}
//templete by private_yusuke

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

int main(){
  int n,k;cin>>n>>k;
  vector<int> p(n);
  rep(i,n)cin>>p[i];
  sort(all(p));
  int sum=0;
  rep(i,k)sum+=p[i];
  cout<<sum;
}

Measured memory_bytes: 3632
// #include {{{
#include <iostream>
#include <cassert>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <ctime>
#include <queue>
#include <set>
#include <map>
#include <stack>
#include <string>
#include <bitset>
#include <vector>
#include <complex>
#include <algorithm>
using namespace std;
// }}}
// #define {{{
typedef long long ll;
typedef double db;
typedef pair<int,int> pii;
typedef vector<int> vi;
#define de(x) cout << #x << "=" << x << endl
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define per(i,a,b) for(int i=(b)-1;i>=(a);--i)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define fi first
#define se second
// }}}

const int N = 303 , P = 1e9 + 7;
inline void pp(int &x,int d) {if((x+=d)>=P)x-=P;}
inline int mul(int a,int b) {return ll(a)*b%P;}
int f[N][N][N];
int n , m;

int main(){
  cin >> n >> m;
  f[0][1][1] = 1;
  rep(i,0,m) {
    for(int j=1;j<=n&&j<=i+1;++j)
      for(int k=1;k<=j;++k) if(f[i][j][k]){
        pp(f[i+1][j][k] , mul(f[i][j][k] , j - k));
        pp(f[i+1][j][j] , mul(f[i][j][k] , k));
        pp(f[i+1][j+1][k] , mul(f[i][j][k] , n - j));
      }
  }
  cout << f[m][n][n] << endl;
  return 0;
}


Measured memory_bytes: 106752
import sys
import numpy as np

N = int(input())
T, A = list(map(int, input().split()))
H = np.array(list(map(int, input().split())))

m = abs(A - (T - 0.006 * H[0]))
num = 1

for n in range(1, N):
    d = abs(A - (T - 0.006 * H[n]))
    if d < m:
        m = d
        num = n+1

print(num)


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


int main(){
    string S;
    cin >> S;
    int count=0;
    for(int i=0; i<S.size()/2; i++){
        if(S.at(i)!=S.at(S.size()-1-i)){
            count++;
        }
    }
    cout << count << endl;
}
	

Measured memory_bytes: 256
N,K=map(int, input().split())
AA=list(map(int, input().split()))
A=sorted(AA)
B=sorted(AA)[::-1]
mod=10**9+7

def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod
mod = 10**9+7 #出力の制限
n = 10**5+1
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, n+1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )

ans=0
for i in range(N-K+1):
  d=(A[K-1+i]%mod)*cmb(K-1+i,K-1,mod)
  e=(B[K-1+i]%mod)*cmb(K-1+i,K-1,mod)
  ans+=d%mod-e%mod
  ans%=mod
print(ans)


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

using namespace std;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
typedef vector<vpii> vvpii;
typedef long long ll;
typedef long double ld;

#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()
#define fi first
#define se second

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

    string s;
    cin >> s;
    int ans = 0;
    if(count(all(s), 'R') == 3)
        ans = 3;
    else if((s[0] == 'R' && s[1] == 'R') || (s[1] == 'R' && s[2] == 'R'))
        ans = 2;
    else if(count(all(s), 'R') != 0)
        ans = 1;
    cout << ans << "\n";
} 


Measured memory_bytes: 3612
#include<bits/stdc++.h>
using namespace std;
int main() {
	int N;
	cin >> N;
	while (N > 0) {
		if (N % 10 == 9) {
			cout << "Yes" << endl;
			return 0;
		}
		N /= 10;
	}
	cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
//in the name of ALLAH
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
   int n,k;
   cin>>n>>k;
   set<int>s;
   int d[k+1];
   for(int i=0;i<k;i++)
   {
       cin>>d[i];
       int a[d[i]+1];
       for(int j=0;j<d[i];j++)
       {
           cin>>a[j];
           s.insert(a[j]);
       }
   }
   cout<<n-s.size()<<endl;
}



Measured memory_bytes: 3640
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Silviase
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        CAttackSurvival solver = new CAttackSurvival();
        solver.solve(1, in, out);
        out.close();
    }

    static class CAttackSurvival {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            StringBuilder sb = new StringBuilder();
            int n = in.nextInt();
            int k = in.nextInt();
            int q = in.nextInt();
            int[] score = new int[n];
            for (int i = 0; i < n; i++) {
                score[i] = k - q;
            }
            for (int i = 0; i < q; i++) {
                score[in.nextInt() - 1]++;
            }

            for (int i = 0; i < n; i++) {
                out.println(score[i] > 0 ? "Yes" : "No");
            }

        }

    }
}



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

int main(void) {
  int N, M, X, Y;
  cin >> N >> M >> X >> Y;
  
  vector<int> XCities(N);
  for (int i = 0; i < N; i++) {
    cin >> XCities.at(i);
  }
  sort(XCities.begin(), XCities.end());
  
  vector<int> YCities(M);
  for (int i = 0; i < M; i++) {
    cin >> YCities.at(i);
  }
  sort(YCities.begin(), YCities.end());
  
  if (X < YCities.at(0) && YCities.at(0) <= Y && XCities.at(N-1) < YCities.at(0)) {
    cout << "No War" << endl;
  }
  else {
    cout << "War" << endl;
  }
  
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
typedef long long ll;
int main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  int e = c / b + (c % b ? 1 : 0);
  int f = a / d + (a % d ? 1 : 0);
  if (e <= f)
    cout << "Yes";
  else
    cout << "No";
}


Measured memory_bytes: 3572
#include <iostream>

int main(){
    int a,b,c,d,e,f;
    std::cin >> a >> b >> c >> d >> e >> f ;
    if(a + b*5 + c*10 + d*50 + e*100 + f*500 >= 1000){
        std::cout << "1" << std::endl;
    }else{
        std::cout << "0" << std::endl;
    }
    return 0;
}

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

bool solve(map<int, int>& count, int n) {
    if (count.size() == 1 && count.count(0) != 0) {
        return true;
    } else if (n % 3 == 0) {
        if (count.size() == 2 && count.begin()->second == n / 3) {
            return true;
        } else if (count.size() == 3) {
            int sum = 0;
            for (auto& p : count) {
                if (p.second != n / 3) {
                    return false;
                }
                sum ^= p.first;
            }
            if (sum != 0) {
                return false;
            }
            return true;
        }
    }
    return false;
}

int main() {
    map<int, int> count;
    int n;
    cin >> n;
    for (int a; cin >> a; ) {
        count[a]++;
    }
    if (solve(count, n)) {
        cout << "Yes";
    } else {
        cout << "No";
    }
    return 0;
}

Measured memory_bytes: 3840
#include<stdio.h>
int main(){
	int a,b,c,d,e,f;
	while(scanf("%d%d%d%d%d%d",&a,&b,&c,&d,&e,&f),a+b+c+d+e+f){
		printf("%d\n",100-((5*a+3*b)*2)-(f-5*a-3*b-e)*3+15*a+15*b+15*(5*a+3*b)+c*7+d*2);
	}
}

Measured memory_bytes: 0