akhauriyash/Code-Regression huggingface dataset:
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<algorithm>
#include<cmath>
#include<queue>
#include<vector>
#include<stack>
using namespace std;

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

int main() {
	string s;
	cin >> s;
	
	string s2 = "CODEFESTIVAL2016";

	int ans = 0;
	REP(i, 16) {
		if (s[i] != s2[i]) ans++;
	}

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

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


int main(){

    int n;
    cin>>n;

    double ar[n+2],br[n+2];

    for(int i=1;i<=n;i++)cin>>ar[i]>>br[i];

    int par[n+2];


    for(int i=1;i<=n;i++)par[i]=i;


    double ans=0,cnt=0;
    do{
    cnt++;


    for(int j=2;j<=n;j++){

       ans+=sqrt((ar[par[j-1]]-ar[par[j]])*(ar[par[j-1]]-ar[par[j]])+(br[par[j-1]]-br[par[j]])*(br[par[j-1]]-br[par[j]]));

    }

    }while(next_permutation(par+1,par+n+1));


//cout<<cnt<<endl;
    printf("%.10lf",ans/cnt);


    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9+7;
//const long long MOD = 998244353;
const long long INF_LL = 1e18+11; const int INF_int = 1e9+11;
#define ll long long
#define mp std::make_pair
#define rep(i,n) for(int i = 0;i<n;i++)
#define lrep(i,n) for(long long i = 0;i<n;i++)
#define All(a) a.begin(),a.end()
#define Debug_Output_ALL(a) for(auto x:a) cout << x << " ";cout << endl;
int main(){
    int k;
    cin >> k;
    int now = 7;
    now%=k;
    int ans = 1;
    rep(i,1e6+5){
        if(now==0) break;
        ans++;
        now*=10;
        now%=k;
        now+=7;
        now%=k;
    }
    if(ans>=1e6+6) cout << -1 << endl;
    else cout << ans << endl;
}

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

typedef long long ll;
typedef long long llong;
typedef long double ld;
typedef unsigned long long ull;

using namespace std;

/*
ll pw(ll a, ll b) {
	ll ans = 1; while (b) {
		while (!(b & 1)) b >>= 1, a = (a * a) % MOD;
		ans = (ans * a) % MOD, --b;
	} return ans;
}
*/
int n;
ll a[120000];

int main() {
	scanf("%d", &n);
	for (int i = 0; i < n; ++i)
		scanf("%lld", a + i);
	ll ans = 0;
	for (int i = 0; i < n; ++i) {
		ans += a[i] / 2;
		a[i] %= 2;
		ll go = min(a[i], a[i + 1]);
		ans += go;
		a[i] -= go;
		a[i + 1] -= go;
	}
	cout << ans << "\n";
	return 0;
}




Measured memory_bytes: 1024
#072C Together
import sys
n = int(sys.stdin.readline())
A = list(map(int, sys.stdin.readline().split()))
maxA = max(A)
L = [0 for _ in range(maxA+2)]

for a in A:
    L[a]+=1
#print(L)
ans = 0
for i in range(0, maxA+1):
    tmp = L[i-1] + L[i] + L[i+1]
    ans = max(ans, tmp)
print(ans)

Measured memory_bytes: 13304
#include<bits/stdc++.h>
using namespace std;
template <typename T> using vec = vector<T>;

const int p = 1000000007;

long mod_fac(long a)
{
    if(a==1)
    {
        return a%p;
    }
    return (a%p*mod_fac(a-1)%p)%p;
};

long mod_pow(long a,long b,long n)
{
    if (n==1)
    {
        return 1;
    }
    
    if(n%2==0)
    {
        return (mod_pow(a,b,n/2)%p * mod_pow(a,b,n/2) %p)%p;
    }
    else
    {
        return a*(mod_pow(a,b,n-1))%p;
    }
};

int main()
{
    long n,m;
    cin >> n >> m;
    if (n-1==m or m-1==n )
    {
        cout << (mod_fac(n)*mod_fac(m))%p << endl;
    }
    else if (n==m)
    {
        cout << (2*(mod_fac(n)*mod_fac(m))%p)%p << endl;
    }
    else
    {
        cout << 0 << endl;
    }
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
int n;
int a[300];
double dp[301][301][301] = {};

double solve(int one, int two, int three){
  if(!(one + two + three)) return 0; // 合計が0だったらreturn
  double *p = &dp[one][two][three];
  if(*p){
    return *p; // dpでもうやってたらreturn
  }
  *p = n;
  if(one) *p += one * solve(one-1, two, three);
  if(two) *p += two * solve(one+1, two-1, three);
  if(three) *p += three * solve(one, two+1, three-1);
  *p /= (one + two + three);
  return *p;
}

int main(){
  cin >> n;
  int one = 0, two = 0, three = 0;
  for(int i=0;i<n;i++){
    cin >> a[i];
    switch(a[i]){
      case 1: one++;break;
      case 2: two++;break;
      case 3: three++;break;
    }
  }
  cout << setprecision(12) << solve(one, two, three) << endl;
}


Measured memory_bytes: 213248
#ifdef LOCAL
#define _GLIBCXX_DEBUG
#endif
#include<bits/stdc++.h>
using namespace std;
#define rep(i,s,t) for(ll i = (ll)(s); i < (ll)(t); i++)
#define rrep(i,s,t) for(ll i = (ll)(s-1);(ll)(t) <= i; i--)
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> Pll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
constexpr ll INF = numeric_limits<ll>::max()/4;
constexpr ll n_max = 2e5+10;
#define int ll

template <typename A, typename B>
string to_string(pair<A, B> p);
string to_string(const string &s) {return '"' + s + '"';}
string to_string(const char *c) {return to_string((string) c);}
string to_string(bool b) {return (b ? "true" : "false");}
template <size_t N>
string to_string(bitset<N> v){
    string res = "";
    for(size_t i = 0; i < N; i++) res += static_cast<char>('0' + v[i]);
    return res;
}
template <typename A>
string to_string(A v) {
    bool first = true;
    string res = "{";
    for(const auto &x : v) {
        if(!first) res += ", ";
        first = false;
        res += to_string(x);
    }
    res += "}";
    return res;
}
template <typename A, typename B>
string to_string(pair<A, B> p){return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";}

void debug_out() {cerr << endl;}
template<typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cerr << " " << to_string(H);
    debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

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

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    ll n,m,k; cin >> n >> m >> k;
    vector<ll> a(n), asum(n+1);
    for(int i = 0; i < n; i++) cin >> a[i];
    vector<ll> b(m), bsum(m+1);
    for(int i = 0; i < m; i++) cin >> b[i];
    rep(i,0,n)asum[i+1] = asum[i] + a[i];
    rep(i,0,m)bsum[i+1] = bsum[i] + b[i];
    ll ans = 0;
    rep(i,0,n+1){
        if(asum[i] > k)break;
        ll t = k - asum[i];
        ll id = upper_bound(all(bsum), t) - bsum.begin();
        id = max(0LL, id-1);
        chmax(ans, i + id);
    }

    cout << ans << endl;
}

Measured memory_bytes: 9540
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
    ll a, b, n;
    cin >> a >> b >> n;
    ll x = min(n, b - 1), y = n;
    cout << max(floor((a * x) / b) - a * floor(x / b), floor((a * y) / b) - a * floor(y / b)) << endl;
}

Measured memory_bytes: 3760
#include <stdio.h>

#define MAX 100

int main()
{
  int a, b;
  char s[MAX];
  
  scanf("%d %d",&a,&b);
  scanf("%s",s);
  
  s[b-1]+='a'-'A';
  
  printf("%s\n",s);
  
  return 0;
}

Measured memory_bytes: 1644
#include<iostream> 
#include<string>
#include<cstring>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<set>
#include<map>
#include<vector>
#include<queue>
#include<sstream>
using namespace std;

#define sf scanf
#define pf printf
#define pfn printf("\n");
#define pfk printf(" ");
#define pf0 printf("0");
#define pf1 printf("1");
#define ll long long
#define ull unsigned long long
#define sfd(n) scanf("%d",&n);
#define sfdd(n,m) scanf("%d%d",&n,&m);
#define sfld(n) scanf("%lld",&n);
#define sfldd(n,m) scanf("%lld%lld",&n,&m);
#define sflf(n) scanf("%lf",&n);
#define sflff(n,m) scanf("%lf%lf",&n,&m);
#define sfc(n) scanf("%c",n);
#define sfcc(n,m) scanf("%c%c",n,m);
#define sfs(n) scanf("%s",n);
#define sfss(n,m) scanf("%s%s",n,m);
#define pfd(n) printf("%d",n);
#define pfld(n) printf("%lld",n);
#define pflf(n) printf("%lf",n);
#define pfc(n) printf("%c",n);
#define pfs(n) printf("%s",n);

#define csh(a,n) memset(a,n,sizeof(a));
int main(){
	int arr[4];
	int n;
	cin>>n;
	for(int i=0;i<n;i++){
		int a;
		cin>>a;
		if(a%2==0){
			if(a%3!=0&a%5!=0){
				cout<<"DENIED"<<endl;
				return 0;
			}
		}
	}
	
				cout<<"APPROVED"<<endl;
}

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

int main() {
  string s;
  cin >> s;
  bool flag1 = false, flag2 = false;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == 'C') {
      flag1 = true;
    }
    if (s[i] == 'F' && flag1) {
      flag2 = true;
    }
  }
  if (flag1 && flag2) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
// ABC079_C
#include <iostream>
#include <string>
#include <vector>
#include <iterator>
#include <tuple>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <stack>
#include <queue>
#include <algorithm>
#include <functional>  // std::greater<T>()
#include <utility>  // std::swap()
#include <numeric>  // accumulate(ALL(vec), 0)  0 は初期値
#include <bitset>  // static_cast<std::bitset<8>>
#include <sstream>  // std::stringstream
#include <cmath>
#include <climits>  // INT_MIN
#include <cctype>  // std::isdigit()
#include <iomanip>  // std::setprecision()
using namespace std;
using ll = long long;

#define REP(i, n) for (ll i=0; i < n; i++)  // 0 ~ n-1
#define MIN(vec) min_element(vec.begin(), vec.end())  // イテレータのため、値を取り出すときは * を先頭につける
#define MAX(vec) max_element(vec.begin(), vec.end())
#define IDX(vec, element_iter) distance((vec).begin(), element_iter)
#define SUM(vec) accumulate(vec.begin(), vec.end(), 0LL)  // 0 は初期値
#define vl vector<ll>
#define pll pair<ll, ll>
#define F first
#define S second

int main() {
    // input
    string N;
    cin >> N;
    
    // calculation
    if ((N[0] == N[1] && N[0] == N[2]) || (N[1] == N[2] && N[1] == N[3])) {
        cout << "Yes" << "\n";
    } else {
        cout << "No" << "\n";
    }
    
    return 0;
}

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

#define REP(type, i, a, b) for( type i = a; i < b; i++ )
typedef long long ll;

using namespace std;

int main (void) {
    string S;
    ll ans;
    cin >> S;
    if ( S == "SUN" ) ans = 7;
    else if ( S == "MON" ) ans = 6;
    else if ( S == "TUE" ) ans = 5;
    else if ( S == "WED" ) ans = 4;
    else if ( S == "THU" ) ans = 3;
    else if ( S == "FRI" ) ans = 2;
    else ans = 1;
    printf("%lld\n", ans);
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

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

    int N,W; cin>>N>>W;
    vector<int> w(N),v(N);
    for(int i=0;i<N;i++) cin>>w[i]>>v[i];

    vector<vector<int>> dp(N+1,vector<int>(W+1,-1));
    dp[0][0]=0;
    for(int i=0;i<N;i++) for(int j=0;j<=W;j++) if(dp[i][j]!=-1){
        chmax(dp[i+1][j],dp[i][j]);
        if(j+w[i]<=W) chmax(dp[i+1][j+w[i]],dp[i][j]+v[i]);
    }
    cout<<*max_element(dp[N].begin(),dp[N].end())<<endl;
    return 0;
}

Measured memory_bytes: 80256
#include<stdio.h>
int main()
{
  int x,y,d;
  while(1){
    scanf("%d %d",&x,&y);
    if(x==0&&y==0)
      break;
    if(x>y){
      d=x;
      x=y;
      y=d;
    }
    printf("%d %d\n",x,y);
  }
   return 0;
 }

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

int main() {
    cin.tie(0)->sync_with_stdio(false);

    ll h, w;
    cin >> h >> w;

    ll ans = 0;
    if (h == 1 || w == 1) ans = 1;
    else if (h % 2 == 0 || w % 2 == 0) ans = h * w / 2;
    else ans = h * w / 2 + 1;

    cout << ans << '\n';
    return 0;
}

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

#define rep(i,n) for(long long i = 0; i < (long long)(n); i++)
#define repi(i,a,b) for(long long i = (long long)(a); i < (long long)(b); i++)
template <typename T> istream& operator>>(istream& i, vector<T>& o) { rep(j, o.size()) i >> o[j]; return i;}

const int tres = 4, vres = 4;
vector<int> dp(20010*tres), lim(20010*tres);
int main(void) {
    int n; cin >> n;
    vector<int> t(n), v(n); cin >> t >> v;
    rep(i, n) v[i] *= vres, t[i] *= tres;
    int s = 0;
    rep(i, n) {
        repi(j, s, s+t[i]) 
            lim[j] = v[i];
        s += t[i];
    }
    
    rep(_, 210*vres) repi(i, 1,dp.size()) 
        if (dp[i] <= min({dp[i+1], dp[i-1], lim[i] -1, lim[i-1]-1}))
            dp[i]++;

    double ret = 0;
    rep(i, dp.size()-1) 
        ret += (dp[i] + dp[i+1]) / (double)vres * (1.0 / (double(tres))) / 2.0;

    cout << setprecision(40) << ret << endl;
    return 0;
}

Measured memory_bytes: 896
package main

import (
	"bufio"
	"fmt"
	"os"
	"strings"
)

var scanner = bufio.NewScanner(os.Stdin)

func main() {
	var n int
	fmt.Scanf("%d", &n)

	result := make([]string, n, n)

	for i := 0; i < n; i++ {
		scanner.Scan()
		input := scanner.Text()

		result[i] = strings.Replace(input, "Hoshino", "Hoshina", -1)
	}

	for _, v := range result {
		fmt.Println(v)
	}
}



Measured memory_bytes: 1136
#include <iostream>

using namespace std;

int main(){
  int N;
  int a[100010];
  cin >> N;
  for (int i; i < N; i++) cin >> a[i];
  bool ans = false;
  for (int i; i < N; i++) {
    if (a[i] % 2) ans = true;
  }
  if (ans) cout << "first";
  else cout << "second" << endl;
}


Measured memory_bytes: 640
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Scanner;
import java.util.Set;

//Infected Land
public class Main{

	class R{
		String s;
		int pos, c;
		public R(String s, int pos, int c) {
			this.s = s;
			this.pos = pos;
			this.c = c;
		}
	}

	void run(){
		Scanner sc = new Scanner(System.in);
		int[][] d = {{-1,-1},{-1,0},{-1,1},{0,-1},{0,1},{1,-1},{1,0},{1,1}};
		for(;;){
			int n = sc.nextInt();
			if(n==0)break;
			char[] m = new char[n*n];
			int pos = 0, c = 0;;
			for(int i=0;i<n;i++){
				char[] t = sc.next().toCharArray();
				for(int j=0;j<n;j++){
					if(t[j]=='@')pos=i*n+j;
					if(t[j]=='#')c++;
					m[i*n+j]=t[j];
				}
			}
			Set<String> v = new HashSet<String>();
			List<R> l = new ArrayList<R>();
			l.add(new R(new String(m), pos, c));
			v.add(l.get(0).s);
			int res = -1, step = 0;
			while(!l.isEmpty()){
				List<R> next = new ArrayList<R>();
				for(R r:l){
					if(r.c==0){
						res = step; next.clear(); break;
					}
					int pi = r.pos/n, pj = r.pos%n;
					for(int k=0;k<8;k++){
						int ni = pi+d[k][0], nj = pj+d[k][1];
						char[] map = r.s.toCharArray();
						if(0<=ni&&ni<n&&0<=nj&&nj<n&&map[ni*n+nj]=='.'){
							map[ni*n+nj] = '@'; map[r.pos] = '.';
							int nc = 0;
							char[] nm = new char[n*n];
							for(int i=0;i<n;i++)for(int j=0;j<n;j++){
								if(map[i*n+j]=='@'){
									nm[i*n+j] = '@';
									continue;
								}
								int adj = 0;
								for(int x=0;x<8;x++){
									int xi = i+d[x][0], xj = j+d[x][1];
									if(0<=xi&&xi<n&&0<=xj&&xj<n&&map[xi*n+xj]!='.')adj++;
								}
								if(map[i*n+j]=='#'&&(adj==2||adj==3)){
									nm[i*n+j] = '#';
									nc++;
								}
								else if(map[i*n+j]=='.'&&adj==3){
									nm[i*n+j] = '#';
									nc++;
								}
								else nm[i*n+j] = '.';
							}
							R nr = new R(new String(nm), ni*n+nj, nc);
							if(!v.contains(nr.s)){
								v.add(nr.s); next.add(nr);
							}
						}
					}
				}
				step++;
				l = next;
			}
			System.out.println(res);
		}
	}

	public static void main(String[] args) {
		new Main().run();
	}
}

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


int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    list<int> ans;
    for(int i=0; i<n; i++){
        cin >> a[i];
        if(i%2==0){
            ans.push_front(a[i]);
        }
        else{
            ans.push_back(a[i]);
        }
    }
    if(n%2==1){
        for(auto itr = ans.begin(); itr != ans.end(); itr++){
            cout << *itr <<" ";
        }
        cout << endl;
    }
    else {
        reverse(ans.begin(),ans.end());
        for(auto itr = ans.begin(); itr != ans.end(); itr++){
            cout << *itr <<" ";
        }
        cout << endl;
    }
}


Measured memory_bytes: 9216
import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools
N, M = [int(_) for _ in input().split()]
AB = [[int(_) for _ in input().split()] for _ in range(N - 1 + M)]

G = [set() for _ in range(N + 1)]
count = [0] * (N + 1)
ans = [0] * (N + 1)
for a, b in AB:
    G[a].add(b)
    count[b] += 1
for i in range(1, N):
    if count[i] == 0:
        root = collections.deque([i])
        break
while root:
    p = root.popleft()
    for c in G[p]:
        count[c] -= 1
        if count[c] == 0:
            ans[c] = p
            root.append(c)
print(*ans[1:], sep='\n')


Measured memory_bytes: 54680
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll>pll;
typedef pair<ll,pair<ll,ll>>plll;
#define fastread() (ios_base:: sync_with_stdio(false),cin.tie(NULL));
#define vll(v) v.begin(),v.end()
#define all(x) x.rbegin(),x.rend()
#define min3(a, b, c)   min(a, min(b, c))
#define max3(a, b, c)   max(a, max(b, c))
#define F first
#define S second
#define in  freopen("input.txt", "r", stdin)
#define out  freopen("output.txt", "w", stdout)
#define minheap int,vector<int>,greater<int>
#define pb push_back
#define eb emplace_back
#define ischar(x)  (('a' <= x && x <= 'z') || ('A' <= x && x <= 'Z'))
#define isvowel(ch) ((ch=='a'||ch=='e'||ch=='i'||ch=='o'||ch=='u')||(ch=='A'|| ch=='E' || ch=='I'|| ch=='O'|| ch=='U'))
#define bug cout<<"BUG"<<endl;
//const int Max = 2e6 + 10;
const int Mod = 1e9 + 7;
const double PI  =3.141592653589793238463;
bool compare(const pair<ll,ll> &a, const pair<ll,ll> &b)
{
    return (a.first > b.first);
}
ll lcm(ll a,ll b)
{
    if(a==0 || b==0)return 0;

    return a/__gcd(a,b)*b;
}

void input(ll ara[],ll n)
{
    for(ll i=0; i<n; i++)cin>>ara[i];
}
int main()
{

    fastread();

    ll i,j,n,m,p,a,sum=0,k,t,b,c,d,cnt=0,q,l,r;


    cin>>n>>k;

    ll ara[n+2],dp[n+2]= {};

    dp[0]=dp[1]=0;



    for(i=1; i<=n; i++)
    {
        cin>>ara[i];



          if(i>1)
          {
              j=i-1;

              dp[i]=1e18;

              while(j>=max(1ll,i-k))
              {
                  dp[i]=min(dp[i],dp[j]+abs(ara[i]-ara[j]));
                  j--;
              }
          }
    }

    cout<<dp[n]<<endl;



}



Measured memory_bytes: 5124
#include <bits/stdc++.h>
#include <unordered_set>
#include <stdio.h>

using namespace std;

#define scan(x) do{while((x=getchar())<'0'); for(x-='0'; '0'<=(_=getchar()); x=(x<<3)+(x<<1)+_-'0');}while(0)
char _;
#define f first
#define s second
#define ll long long
#define ull unsigned long long
#define endl "\n"
#define PI 3.141592653589793
#define vi vector<int>
#define vll vector<long long>
#define p pair<int,int>
const int MOD = 1000000007;
inline double degcos(double ang) {return cos(ang*PI/180);}
inline double degsin(double ang) {return sin(ang*PI/180);}
#define rep(i,j,k,in) for (int i = j; i < k; i += in)


/*---END OF TEMPLATE---*/




int main() {
    cin.sync_with_stdio(0);
    cin.tie(0);
    //ifstream fin("data.in");
    //ofstream fout("data.out");
    int h,w;
    cin >> h >> w;
    string arr[h];
    rep(i,0,h,1) cin >> arr[i];
    int dp[h][w];
    memset(dp,0,sizeof(dp));
    dp[0][0] = 1;
    rep(i,1,h,1) {
        if (arr[i][0] == '#') break;
        dp[i][0] = 1;
    }
    rep(i,1,w,1) {
        if (arr[0][i] == '#') break;
        dp[0][i] = 1;
    }
    rep(i,1,h,1) {
        rep(j,1,w,1) {
            if (arr[i][j] == '#') continue;
            dp[i][j] = dp[i-1][j] + dp[i][j-1];
            dp[i][j] = dp[i][j] % MOD;
        }
    }
    cout << dp[h-1][w-1] << endl;

}

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

{
	int m,n,k,j,i,sum,l;
	string s;
	cin>>s;
	l=s.size();
	for(i=0;i<l;i++)
	{
		if(s[i]!=s[l-i-1])
		{
			cout<<"No";
			break;
		}
	}
	if(i==l)
	{
		for(j=0;j<(l-1)/2;j++)
		{
			if(s[j]!=s[(l-3)/2-j])
			{
				cout<<"No";
				break;
			}
		}
	}
	if(j==(l-1)/2)
	cout<<"Yes";
	
}


Measured memory_bytes: 256
#include <stack>
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <cmath>
#include <array>
#include <iomanip>
#include <string>
#include <limits>
using namespace std;
int gcd(int a, int b)//最大公約数
{
   if (a%b == 0)
   {
       return(b);
   }
   else
   {
       return(gcd(b, a%b));
   }
}
int mod = 1000000000 + 7;
vector<int> v;
class Calc
{
    // 宣言
    long long a;

    public:
        // 素因数分解
        void decompositPrime(long long a);
};

/*
 * 素因数分解
 */
void Calc::decompositPrime(long long n)
{
    // 割る数の初期値
    a = 2;
    // √n ≧ a ( n ≧ a * a ) の間ループ処理
    while (n >= a * a) {
        // a で割り切れたら、a は素因数
        // そして、割られる数を a で割る
        // a で割り切れなかったら、 a を 1 増加させる
        if (n % a == 0) {
            //printf("%d * ", a);
             v.push_back(a);
            n /= a;
        } else {
            a++;
        }
    }
    // 最後に残った n は素因数
    v.push_back(n);
    //printf("%d\n", n);
}
vector<int> divisor(int n) {//約数発見
    vector<int> ret;
    for (int i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            ret.push_back(i);
            if (i * i != n) ret.push_back(n / i);
        }
    }
    std::sort(ret.begin(), ret.end());
    return ret;
}
long nc2(long n){
    return n*(n-1)/2;
}
template<typename TypeInt>
std::string Itoa(const TypeInt v, int base)
{
	static const char table[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
	string ret;
	static numeric_limits<TypeInt> t;
	TypeInt n = v;
	if (t.is_signed) {
		if (v < 0) n *= -1;
	}

	while (n >= base) {
		ret += table[n%base];
		n /= base;
	}
	ret += table[n];
	if (t.is_signed) {
		if (v < 0 && base == 10) ret += '-';
	}
	// 文字列の順番を逆にする
	std::reverse(ret.begin(), ret.end());

	return ret;
}
int main(){
    //std::stack<int> stack;
    string s,t;
    cin >> s >> t;
    int ans = 0;
    for(int i = 0; i < s.length(); i++){
        if(s[i] != t[i]){
            ans ++;
        }
    }
    cout << ans << endl;
    return 0;
}






Measured memory_bytes: 3828
#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <vector>
#include <math.h>
#include <fstream>
#include <sstream>
#include <unordered_map>
using namespace std;

const unsigned long long BASE = (unsigned long long)(1e9 + 7);
bool flagBuffer[1000001][26];

struct Node
{
    Node(int i, Node* f, bool * flag)
    {
        idx = i;
        father = f;
        for (int i = 0; i < 26; i++)
        {
            child[i] = NULL;
            count[i] = int(flag[i]);
        }
        sum = 1;    // itself
    }
    Node * father;
    Node * child[26];
    int idx;
    int count[26];  // count of all child strings has the char
    int sum;    // count of all strings has this node
};

Node * push(Node * root, const string & s, vector<Node*> & newNode)
{
    // construct flag buffer
    memset(flagBuffer, 0, sizeof(bool) * s.length() * 26);
    for (int i = 1; i < (int)s.length(); i++)
    {
        for (int j = 0; j < 26; j++)
        {
            flagBuffer[i][j] = flagBuffer[i - 1][j] || (int(s[i - 1] - 'a') == j);
        }
    }
    // push into tree
    Node * pCurrent = root; // root can be ignored
    for (int i = (int)s.length() - 1; i >= 0; i--)
    {
        int idx = s[i] - 'a';
        if (pCurrent->child[idx] != NULL)
        {
            pCurrent = pCurrent->child[idx];
            for (int j = 0; j < 26; j++)
            {
                pCurrent->count[j] += flagBuffer[i][j];
            }
            pCurrent->sum++;
        }
        else
        {
            while (i >= 0)
            {
                idx = s[i] - 'a';
                Node * pNew = new Node(idx, pCurrent, flagBuffer[i]);
                pCurrent->child[idx] = pNew;
                pCurrent = pNew;
                newNode.push_back(pNew);
                i--;
            }
            break;
        }
    }
    return pCurrent;
}

int main()
{
    int n;
    cin >> n;
    // construct tree
    memset(flagBuffer, 0, sizeof(flagBuffer));
    Node root(0, NULL, flagBuffer[0]);
    vector<Node*> allNode;
    vector<Node*> newNode;
    allNode.reserve(n);
    newNode.reserve(n);
    for (int i = 0; i < n; i++)
    {
        string s;
        cin >> s;
        Node * pNode = push(&root, s, newNode);
        allNode.push_back(pNode);
    }
    // count
    int count = 0;
    for (int i = 0; i < (int)allNode.size(); i++)
    {
        count += allNode[i]->sum - 1;
        int idx = allNode[i]->idx;
        Node * pFather = allNode[i]->father;
        for (int j = 0; j < 26; j++)
        {
            if (j != idx && pFather->child[j] != NULL)
            {
                count += pFather->child[j]->count[idx];
            }
        }
    }
    cout << count << endl;

    for (int i = 0; i < (int)newNode.size(); i++)
    {
        delete newNode[i];
    }
    return 0;
}


Measured memory_bytes: 364216
#include <bits/stdc++.h>
 
#define int long long int
#define pii pair<int,int>
#define vi vector<int>
#define vii vector<pii>
#define mii map<int,int>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define MOD 1000000007
#define FOR(i,a,n) for(int i=a;i<n;i++)
#define FORD(i,a,n) for(int i=n-1;i>=0;i--)
using namespace std;
 
 
int32_t main(){
 
   
    
    int n,wt,w[101],v[101];
    cin>>n>>wt;
    for(int i=1;i<=n;i++)
        cin>>w[i]>>v[i];
    int dp[n+1][wt+1];
    for(int i=0;i<=wt;i++)
    {
        dp[0][i]=0;
        dp[1][i]=0;
    }
    dp[1][w[1]]=v[1];

    for(int i=2;i<=n;i++)
    {
        for(int j=0;j<=wt;j++)
        {
            if(j-w[i]>=0)
                dp[i][j]=max(dp[i-1][j-w[i]]+v[i],dp[i-1][j]);
            else
                dp[i][j]=dp[i-1][j];
        }
    }
    int ans=0;
    for(int i=0;i<=wt;i++)
       ans=max(ans,dp[n][i]);
   cout<<ans;

 
    return 0;
 
}


Measured memory_bytes: 82392
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; 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)
using namespace std;
using ll = long long;

int main() {
  int n;
  cin >> n;
  map<string, int> cnt;
  rep(i, n) {
    string s;
    cin >> s;
    cnt[s]++;
  }
  for (string s : {"AC", "WA", "TLE", "RE"}) {
    cout << s << " x " << cnt[s] << endl;
  }
  return 0;
}


Measured memory_bytes: 3576
#include <iostream>
#include <cstring>
#include <stdlib.h>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <math.h>
#include <string>
#include <map>
#include <cstdlib>
using namespace std;

typedef long long ll;

int main()
{
    double W,H,x,y;
    cin >> W >> H >> x >> y;
    cout << W*H/2 << ' ';
    if(W/2==x && H/2==y) cout << 1;
    else cout << 0;



    return 0;
}

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

#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define ALL(x) x.begin(),x.end()
#define EPS (1e-8)
#define equals(a,b) (fabs((a)-(b))<EPS)

using namespace std;

typedef long long ll;
const int IINF = INT_MAX;
const ll LLINF = LLONG_MAX;

inline bool LT(double a,double b) { return !equals(a,b) && a < b; }
inline bool LTE(double a,double b) { return equals(a,b) || a < b; }

string s;
int gx,gy;

#define MAX 100000
const int BASE = MAX / 2;
int dp[2][MAX];

bool ok(vector<int> d,int sp,int g) {
  memset(dp,0,sizeof dp);
  dp[0][BASE+sp] = 1;
  rep(i,(int)d.size()) {
    int cur = i & 1;
    int nex = (i+1) & 1;
    rep(j,MAX) {
      if( dp[cur][j] == 0 ) continue;
      if( 0 <= j+d[i] && j+d[i] < MAX ) {
	dp[nex][j+d[i]] = 1;
      }
      if( 0 <= j-d[i] && j-d[i] < MAX ) {
	dp[nex][j-d[i]] = 1;
      }
    }
    rep(j,MAX) dp[cur][j] = 0;
  }
  return dp[(int)d.size()&1][BASE+g];
}

void compute() {
  vector<int> d[2];
  int phase=0, cnt = 0;
  int sx = 0;
  int what = 0;
  while( what < (int)s.size() && s[what] == 'F' ) {
    ++what;
    ++sx;
  }
  REP(i,what,(int)s.size()) {
    if( s[i] == 'F' ) {
      ++cnt;
    } else {
      d[phase].push_back(cnt);
      cnt = 0;
      (phase+=1)%=2;
    }
  }
  if( cnt ) d[phase].push_back(cnt);


  puts(( ok(d[0],sx,gx) && ok(d[1],0,gy) )?"Yes":"No");
}

int main() {
  cin >> s;
  cin >> gx >> gy;
  compute();
  return 0;
}


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

int main() {
    int n;
    while (cin >> n, n) {
        vector<int> vec(n);
        for (auto& i : vec) cin >> i;
        int sum = 0;
        for (auto i : vec) sum += i;

        int count = 0;
        for (auto i : vec)
            if (i <= sum / n) count++;

        cout << count << endl;
    }

    return 0;
}


Measured memory_bytes: 3120
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
using namespace std;

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

    vector<int> H(N, 0);
    for (auto &h : H)
    {
        cin >> h;
    }
    vector<int> ans(N + 1, 0);

    for (int i = 0; i < N-1; ++i){
        if(H[i+1] <= H[i]){
            ans[i + 1] = ans[i] + 1;
        }
    }

    auto iter = max_element(ans.begin(), ans.end());
    cout << *iter << endl;
    return 0;
}

Measured memory_bytes: 1024
n,q=gets.split.map(&:to_i)
l=(1..n).map{a,b=gets.split;[a,b.to_i]}
t=0
while(a,b=l.shift;a)
q<b ?(l<<[a,b-q];t+=q):(t+=b;puts [a,t]*" ")
end

Measured memory_bytes: 24852
N, X = map(int,input().split())

a = [1 for i in range(N+1)]
p = [1 for i in range(N+1)]
for i in range(1,N+1):
	a[i] = 3 + 2 * a[i-1]
	p[i] = 1 + 2 * p[i-1]

def f(i,X):
	if i == 0 and X == 1:
		return 1
	elif X == 1:
		return 0
	elif X <= a[i-1]+1:
		return f(i-1,X-1)
	elif X == a[i-1]+2:
		return p[i-1]+1
	elif X <= 2*a[i-1]+2:
		return f(i-1,X-(a[i-1]+2)) + p[i-1] + 1
	elif X == 2*a[i-1]+3:
		return 2*p[i-1] + 1
print(f(N,X))


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

int main() {

        int a, b, k;

        std::cin >> a >> b >> k;

        for (auto i = 0; i < k; ++i) {
                if (i % 2 == 0) {
                        if (a % 2 != 0) {
                                --a;
                        }
                        b += a / 2;
                        a /= 2;
                }
                else {
                        if (b % 2 != 0) {
                                --b;
                        }
                        a += b / 2;
                        b /= 2;
                }
        }

        std::cout << a << " " << b << std::endl;

        return 0;
}

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

using namespace std;

#define mp make_pair
#define fi first
#define se second
#define all(v) v.begin(),v.end()
#define allarr(a) a , a + n
#define ll long long
#define ull unsigned long long 
#define pb push_back
#define fastio ios_base::sync_with_stdio(false) ; cin.tie(NULL); cout.tie(NULL)
typedef pair<int, int> pi;
typedef pair<ll,ll> pll; 
typedef pair<int,pi> trp ;
typedef vector<pi> vpi;
typedef vector<pll> vpll ;
// int ab  (int  x ) { return (x>0?x:-x); }

int main(){
	int n ; 
	cin >> n ; 
	vector<ll> h(n); 
	for(ll& a : h )cin >> a ;
	for(int i = 1 ; i < n ; i++ ){
		if(h[i]-1 >= h[i-1])h[i]--; 
	}
	cout << (is_sorted(all(h))?"Yes":"No")<<endl; 
}

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

def td(x):
    a = x % 10
    b = 0
    while(x):
        b = x
        x //= 10
    return (a, b)

pc = dict()
for i in range(N):
    p = td(i + 1)
    if p in pc:
        pc[p] += 1
    else:
        pc[p] = 1
ans = 0
for i in range(N):
    p = td(i + 1)
    q = (p[1], p[0])
    if q in pc:
        ans += pc[q]
print(ans)


Measured memory_bytes: 3064
#include <cstdio>
#include <vector>
#include <iostream>
#include <functional>
#include <algorithm>
using namespace std;

int main(){
    int A, B, K;
    cin >> A;
    cin >> B;
    cin >> K;

    vector<int> xs;
    for(int i=1; i<101; i++){
        if(A % i == 0 && B % i == 0){
            xs.push_back(i);
        }
    }

    sort(xs.begin(), xs.end(), greater<int>());

    cout << xs[K-1] << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll mat[100005][1000];
bool sortbysec(const pair<int, int> &a,
               const pair<int, int> &b)
{
    return (a.second < b.second);
}

void knapsack(vector<pair<ll, ll>> v, int weight)
{

    for (ll i = 0; i < v.size(); i++)
    {
        for (ll j = 0; j <= weight; j++)
        {

            if (j >= v[i].second)
            {
                if (i != 0)
                {
                    mat[j][i] = max((v[i].first + mat[j - v[i].second][i - 1]), mat[j][i - 1]);
                    // cout << j << " " << i
                    //      << " " << v[i].first + mat[j - v[i].second][i - 1] << " " << mat[j][i - 1] << endl;
                }
                else
                {
                    mat[j][i] = v[i].first;
                }
            }
            else
            {
                if (j == 0)
                {
                    mat[j][i] = 0;
                }
                else
                {
                    mat[j][i] = mat[j][i - 1];
                }
            }
        }
    }
}
int main()
{
    vector<pair<ll, ll>> v;
    ll n, a, w, thole;
    cin >> n >> thole;

    for (int i = 0; i < n; i++)
    {
        cin >> w >> a;
        v.push_back(make_pair(a, w));
    }
    sort(v.begin(), v.end());

    knapsack(v, thole);
    // cout << "      ";
    // for (int i = 0; i <= thole; i++)
    // {
    //     cout << i << " ";
    // }
    // cout << endl;
    // for (int i = 0; i < v.size(); i++)
    // {
    //     cout << "     ";
    //     for (int j = 0; j <= thole; j++)
    //     {
    //         cout << mat[j][i] << " ";
    //     }
    //     cout << endl;
    // }
    cout << mat[thole][v.size() - 1] << endl;
}

Measured memory_bytes: 780288
#include<map>
#include<cmath>
#include<queue>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<fstream>
#include<iostream>
#include<algorithm>
#define re register
#define ll long long
using namespace std;
int n,k;
int main(){
	scanf("%d",&n);
	if(n>=105&&n<135)printf("1");
	if(n>=135&&n<165)printf("2");
	if(n>=165&&n<189)printf("3");
	if(n>=189&&n<195)printf("4");
	if(n>=195)printf("5");
	if(n<105)printf("0");
}

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

namespace abc144_c
{
  class Program
  {
    static void Main(string[] args)
    {
      var n = CIn.ReadLong();

      for (var i = (long)Math.Sqrt(n); i > 0; i--)
      {
        if (n % i == 0)
        {
          Console.WriteLine(i + n / i - 2);
          return;
        }
      }
    }
  }

  class CIn
  {
    private static readonly Queue<string> fieldBuffer = new Queue<string>();

    public static string Read()
    {
      if (fieldBuffer.Count == 0)
      {
        foreach (var field in Console.ReadLine().Split())
        {
          fieldBuffer.Enqueue(field);
        }
      }
      return fieldBuffer.Dequeue();
    }

    public static int ReadInt() => int.Parse(Read());
    public static long ReadLong() => long.Parse(Read());
    public static double ReadDouble() => double.Parse(Read());

    public static string[] ReadStringArray(long n)
    {
      var array = new string[n];
      for (var i = 0; i < n; i++)
      {
        array[i] = Read();
      }
      return array;
    }

    public static int[] ReadIntArray(long n)
    {
      var array = new int[n];
      for (var i = 0; i < n; i++)
      {
        array[i] = ReadInt();
      }
      return array;
    }

    public static long[] ReadLongArray(long n)
    {
      var array = new long[n];
      for (var i = 0; i < n; i++)
      {
        array[i] = ReadLong();
      }
      return array;
    }

    public static double[] ReadDoubleArray(long n)
    {
      var array = new double[n];
      for (var i = 0; i < n; i++)
      {
        array[i] = ReadDouble();
      }
      return array;
    }
  }
}

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

#define MP make_pair
#define PB push_back
#define ALL(x)      (x).begin(),(x).end()
#define REP(i,n)    for(int i=0;i<(n);i++)
#define REP1(i,n)   for(int i=1;i<(n);i++)
#define REP2(i,d,n) for(int i=(d);i<(n);i++)
#define RREP(i,n)   for(int i=(n);i>=0;i--)
#define CLR(a)      memset((a),0,sizeof(a))
#define MCLR(a)     memset((a),-1,sizeof(a))
#define RANGE(x,y,maxX,maxY) (0 <= (x) && 0 <= (y) && (x) < (maxX) && (y) < (maxY))

typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI > VVI;
typedef vector<string> VS;
typedef vector<LL> VLL;
typedef pair<int,int> PII;

const int INF = 0x3f3f3f3f;
const LL INFL = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-9;

const int DX[]={1,0,-1,0},DY[]={0,-1,0,1};


void solve(long long K, long long A, long long B){
    REP2(i, A, B+1) {
        if (i % K == 0) {
            cout << "OK" << endl;
            return;
        }
    }

    cout << "NG" << endl;
}

int main(){
    long long K;
    scanf("%lld",&K);
    long long A;
    scanf("%lld",&A);
    long long B;
    scanf("%lld",&B);
    solve(K, A, B);
    return 0;
}



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

using namespace std;

const int N = 2002;
int md;
int dp[3 * N][N];

inline void sadd(int &x, int y) {
  x += y;
  if (x >= md) {
    x -= md;
  }
  if (x < 0) {
    x += md;
  }
}

inline int mult(int x, int y) {
  return (long long) x * y % md;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n >> md;
  dp[3 * n][0] = 1;
  for (int rem = 3 * n; rem > 0; rem--) {
    for (int cnt = 0; cnt <= n; cnt++) {
      sadd(dp[rem - 1][cnt], dp[rem][cnt]);
      if (rem >= 2) {
        sadd(dp[rem - 2][cnt + 1], mult(dp[rem][cnt], rem - 1));
      }
      if (rem >= 3) {
        sadd(dp[rem - 3][cnt + 1], mult(dp[rem][cnt], mult(rem - 1, rem - 2)));
      }
    }
  }
  int ans = 0;
  for (int i = 0; i <= n; i++) {
    sadd(ans, dp[0][i]);
  }
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 47232
N,M = map(int,input().split())
intx = lambda x:int(x)-1
#mp = [list(map(intx,input().split())) for _ in range(M)]
adj = [[0]*N for _ in range(N)]
for i in range(M):
    a,b = map(intx,input().split())
    adj[a][b] = 1
    adj[b][a] = 1
#print(adj)

visited = [False]*N
def dfs(loc,depth):
    if visited[loc]:
        return 0
    if depth == N-1:
        return 1
        
    visited[loc] = True
    path = 0
    for i in range(N):
        if adj[loc][i]:
            path+=dfs(i,depth+1)
    
    visited[loc] = False
    
    return path
    
print(dfs(0,0))

Measured memory_bytes: 9192
#include<iostream>
#include<vector>
#include<string>
int main() {
	int count=0;
	std::string str;
	std::cin >> str;
	int n;
	std::cin >> n;
	for (int i = 0; i < n; ++i) {
		std::string s;
		std::cin >> s;
		s += s;
		for (int j = 0; j < 20; ++j) {
			if (str[0] == s[j]) {
				int chec = 0;
				for (int m = 0; m < str.size(); ++m) {
					if (str[m] == s[j + m])++chec;
				}
				if (chec == str.size()) { ++count; break; }
			}
		}
	}
	std::cout << count << std::endl;
	return 0;
}

Measured memory_bytes: 3172
s = input()
q = int(input())
appendix = [[], []]
reverse = False
for _ in range(q):
  query = input().split()
  if query[0] == '1':
    reverse ^= True
  else:
    f = bool(int(query[1]) - 1)
    appendix[int(f ^ reverse)].append(query[2])
if reverse:
  print(''.join(appendix[1][::-1]) + s[::-1] + ''.join(appendix[0]))
else:
  print(''.join(appendix[0][::-1]) + s + ''.join(appendix[1]))

Measured memory_bytes: 6272
def insertionsort(A, N):
    for i in range(N):
        v = A[i]
        j = i - 1
        while j >= 0  and A[j] > v:
            A[j + 1] = A[j]
            j -= 1
        A[j + 1] = v
        print(" ".join(map(str,A)))
    return A

N = int(input())
A = list(map(int, input().split()))
A = insertionsort(A, N)


Measured memory_bytes: 5608
//自称高知能系Vtuberの高井茅乃です。
//Twitter: https://twitter.com/takaichino
//YouTube: https://www.youtube.com/channel/UCTOxnI3eOI_o1HRgzq-LEZw

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

#define INF 1999999999
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define MODA 1000000007 

int main() {
    int ans = 0;
    int tmp;
    vector<int> c(3);
    REP(i, 3) cin >> c[i];
    sort(c.begin(), c.end());
    if (c[0]+c[1]==c[2]) cout << "Yes" << endl;
    else cout << "No" << endl;
    
    //cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
ll a7=1000000007;
ll inf=1000000000000000;
typedef pair<ll,ll> l_l;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back


ll min(ll a,ll b){
    if(a<b)return a;
    return b;
}
ll max(ll a,ll b){
    if(a>b)return a;
    return b;
}



int main(){
    ll n,t;cin>>n>>t;
    ll a[n+1],b[n+1];
    rep(i,1,n){
        cin>>a[i]>>b[i];
    }
    pair<ll,ll> dp[n+1][t+1];
    rep(i,0,n){
        rep(j,0,t){
            dp[i][j]=make_pair(-1,-1);
        }
    }
    dp[0][0]=make_pair(0,0);
    rep(i,1,n){
        rep(j,0,t-1){
            if(j-a[i]>=0){
                if(dp[i-1][j-a[i]].first<0){
                    if(dp[i-1][j].first<0){
                        dp[i][j]=make_pair(-1,-1);
                    }else{
                        dp[i][j]=make_pair(dp[i-1][j].first,max(dp[i-1][j].second,b[i]));
                    }
                }else{
                    if(dp[i-1][j].first<0){
                        dp[i][j]=make_pair(dp[i-1][j-a[i]].first+b[i],dp[i-1][j-a[i]].second);
                    }else{
                        if(dp[i-1][j-a[i]].first+b[i]>dp[i-1][j].first){
                            dp[i][j]=make_pair(dp[i-1][j-a[i]].first+b[i],dp[i-1][j-a[i]].second);
                        }else if(dp[i-1][j-a[i]].first+b[i]==dp[i-1][j].first){
                            dp[i][j]=make_pair(dp[i-1][j].first,max(dp[i-1][j].second,b[i]));
                        }else{
                            dp[i][j]=make_pair(dp[i-1][j].first,max(dp[i-1][j].second,b[i]));
                        }
                            
                    }
                }
            }else{
                if(dp[i-1][j].first<0){
                    dp[i][j]=make_pair(-1,-1);
                }else{
                    dp[i][j]=make_pair(dp[i-1][j].first,max(dp[i-1][j].second,b[i]));
                }
            }
            //cout<<j<<' '<<dp[i][j].first<<' '<<dp[i][j].second<<' ';
        }
        //cout<<endl;
    }
    ll ans=-1;
    rep(i,0,t-1){
        if(dp[n][i].first>=0){
            ans=max(ans,dp[n][i].first+dp[n][i].second);
        }
    }
    if(ans<0){
        cout<<0<<endl;
    }else{
        cout<<ans<<endl;
    }
    
    return 0;
}







Measured memory_bytes: 141056
#!/usr/bin/env python3
import sys, os

def main():
    inp = [int(x) for x in os.read(0, os.fstat(0).st_size).split()]
    n, m = inp[0],inp[1]

    wi, vi = inp[2], inp[3]


    dp = [0] * (m + 1)
    for j in range(wi, m + 1):
        dp[j] = vi

    for i in range(n - 1):
        wi = inp[2*i + 4]
        vi = inp[2*i + 5]
        for j in range(m, wi-1, -1):
            if dp[j] < vi + dp[j - wi]:
                dp[j] = vi + dp[j - wi]

    print(dp[-1])
main()

Measured memory_bytes: 39536
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn kth(i: usize) -> i32 {
    let elements = [
        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,
    ];

    match elements.get(i - 1) {
        Some(e) => *e,
        None => 0,
    }
}

fn main() {
    let input: usize = read();
    let output = kth(input);

    println!("{}", output);
}

Measured memory_bytes: 4352
#include<iostream>
#include<iomanip>
#include<string>
#include<algorithm>
#include<cmath>
using namespace std;
int main(){
    double s,w,h;
    char g;
    while(cin>>s>>g>>w>>g>>h){
        if(w/(h*h)>=25)cout<<s<<endl;
    }
    return 0;
}

Measured memory_bytes: 3176
/*|In The Name Of Allah|*/

#include <bits/stdc++.h>

using namespace std;

const int N = 2e5+5;

int n;
int ar[N];
map < int , int > cnt;

int main(){
    scanf("%d" , &n);
    for(int i = 1; i <= n; i++){
        scanf("%d" , &ar[i]);
        cnt[ar[i]]++;
    }
    sort(ar + 1 , ar + n + 1);
    reverse(ar + 1 , ar + n + 1);
    int ans = 0;
    for(int i = 1; i <= n; i++){
        int x = ar[i];
        if(!cnt[x])
            continue;
        cnt[x]--;
        bool done = 0;
        for(int j = 30; j >= 0; j--){
            int pw = (1 << j) - x;
            if(pw > 0 && cnt[pw]){
                cnt[pw]--;
                ans++;
                done = 1;
                break;
            }
        }
        if(!done)
            cnt[x]++;
    }
    printf("%d\n" , ans);
}



Measured memory_bytes: 29824
parseInt(x) = parse(Int,x)
parseMap(x::Array{SubString{String}, 1}) = map(parseInt, x)

function main()
    N = parseInt(readline())
    A= parseMap(split(readline()))
    B = zeros(Int,N)
    for i = 1:(N-1)
        B[A[i]] += 1
    end
    for i = 1:N
        println(B[i])
    end
end

main()

Measured memory_bytes: 201124
import numpy as np
import math
import sys
sys.setrecursionlimit(10000000)

def main():
    N = int(input())
    jobs = []
    for i in range(N):
        time_consume, deadline = map(int, input().split())
        jobs.append([deadline, time_consume])
    jobs = sorted(jobs)
    # print(jobs)
    time_ = 0
    for i in range(N):
        time_ += jobs[i][1]
        if (time_ <= jobs[i][0]):
            # 締め切りより時間が立っていなければ、
            pass
        else:
            print("No")
            break
    else:
        print("Yes")



if __name__ == '__main__':
    main()

Measured memory_bytes: 46240
import java.util.*;

public class Main {
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
      
        int a = sc.nextInt();
        int b = sc.nextInt();
        int h = sc.nextInt();
      
        int area = (((a + b) * h) / 2 );
          
        System.out.println(area);
	} 
}

Measured memory_bytes: 21972
#include <bits/stdc++.h>
using namespace std;
//#include <boost/multiprecision/cpp_int.hpp>
//using multiInt = boost::multiprecision::cpp_int;

using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template <typename Q_type>
using smaller_queue = priority_queue<Q_type, vector<Q_type>, greater<Q_type>>;

const int MOD_TYPE = 1;
const ll MOD = (MOD_TYPE == 1 ? (ll)(1e9 + 7) : 998244353);
const int INF = (int)1e9;
const ll LINF = (ll)4e18;
const double PI = acos(-1.0);

#define REP(i, m, n) for (ll i = m; i < (ll)(n); ++i)
#define rep(i, n) REP(i, 0, n)
#define MP make_pair
#define MT make_tuple
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << endl
#define possible(n) cout << ((n) ? "possible" : "impossible") << endl
#define Yay(n) cout << ((n) ? "Yay!" : ":(") << endl
#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define dbg(x) cerr << #x << ":" << x << endl;

vector<int> Dx = {0, 0, -1, 1, -1, 1, -1, 1, 0};
vector<int> Dy = {1, -1, 0, 0, -1, -1, 1, 1, 0};

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(50) << setiosflags(ios::fixed);
  int n;
  cin >> n;
  vector<tuple<ll, ll, char, ll, string>> v(n);
  rep(i, n)
  {
    cin >> get<0>(v[i]);
    cin >> get<1>(v[i]);
    cin >> get<2>(v[i]);
    cin >> get<3>(v[i]);
    cin >> get<4>(v[i]);
  }
  sort(all(v));
  for (auto t : v)
  {
    cout << get<0>(t) << " ";
    cout << get<1>(t)  << " ";
    cout << get<2>(t)  << " ";
    cout << get<3>(t)  << " ";
    cout << get<4>(t)  << "\n";
  }
  return 0;
}



Measured memory_bytes: 11840