akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>

int main(int argc, const char * argv[]) {
    // insert code here...
    int n, a[100];
    int i;
    scanf("%d", &n);
    for(i=0; i<n; i++){
        scanf("%d", &a[i]);
    }
    for(i=n-1; i>=0; i--){
        if(0 <= i && i < n-1){
            printf(" ");
        }
        printf("%d", a[i]);
    }
    printf("\n");
    return 0;
}

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

using namespace std;
using   ll=long long;

#define fast        	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)

#define endl        	"\n"
#define pb          	push_back
#define mp          	make_pair
#define F           	first
#define S           	second
#define int             long long int
#define pll				pair<int , int>

#define ALL(v)      	v.begin(),v.end()
#define ALLR(v)     	v.rbegin(),v.rend()
#define pii         	3.14159265358979323
#define inf     		LLONG_MAX
#define ones(x)     	__builtin_popcount(x)
#define fill(a,b)   	memset(a,b,sizeof(a))
#define mod 			1000000007
#define hell            998244353 

ll mod_pow(ll a,ll b,ll m) 
{
    ll res = 1;
    while(b)	
    {
        if(b&1) 	
        {
        	res=(res*a) % m;
        }
        a=(a*a) % m;
        b>>=1;
    }
    return res;
}

ll mod_inverse(ll a) 
{
	return mod_pow(a , mod-2 , mod);
}

void solve() {
	
	int a , b , c;
	
	cin >> a >> b >> c;
	
	if(a*b < c) {
		cout << a*b;
	}
	else {
		cout << c;
	}
}

signed main() {
    fast;
    
    int t = 1;
    
	//cin >> t;
    
    while(t--) {
        solve();
    }
 
    return 0;
}


Measured memory_bytes: 3596
#include<iostream>
using namespace std;
int main()
{
  int m,n;
  cin>>m>>n;
  int a[m+1];
  a[0]=0;
  for(int i=1;i<=m;i++)
  {
    int k;
    cin>>k;
    a[i]=k+a[i-1];
  }
  int s=0;
  for(int i=0;i<=m;i++)
  {
    if(a[i]<=n)
      s++;
  }
  cout<<s;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <bits/c++io.h>
#include <algorithm>
#include <iomanip>
#include <math.h>
using namespace std;

int main()
{
 int x,y;
 cin>>x>>y;
 if(x+y<24)
    cout<<x+y<<endl;
 else
    cout<<(x+y)-24<<endl;

}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define rrep2(ri,x,n) for(int ri = (int)(n-1); ri >= (int)(x); ri--)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(x) x.begin(), x.end()
using ll = long long;
using namespace std;

int main(){
  int n;
  cin >> n;
  vector<int> b(n);
  rep(i, n) cin >> b.at(i);
  vector<int> ans;
  while(b.size() > 0){
    int co = b.size();
    rrepit(itr, b){
      if(*itr == co){
        auto er = b.begin();
        rep(_, co-1) er++;
        b.erase(er);
        ans.push_back(co);
        co = -1;
        break;
      }
      co--;
    }
    if(co != -1){
      cout << -1 << endl;
      return 0;
    }
  }
  reverse(ALL(ans));
  for(auto i : ans){
    cout << i << endl;
  }
  return 0;
}

Measured memory_bytes: 3608
from collections import defaultdict
S = input()
N = len(S)

memo = defaultdict(int)
memo[0] += 1

mod = 2019
d = 1
val = 0

for s in S[::-1]:
    s = int(s)
    val += s * d
    val %= mod
    memo[val] += 1
    d *= 10
    d %= mod

print(sum(v * (v - 1) // 2 for v in memo.values()))

Measured memory_bytes: 9800
#include <bits/stdc++.h>
using namespace std;
#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++)
typedef long long ll;

int main() {
    char C; cin >> C;
    printf("%c",C+1);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define F first
#define S second
#define endl "\n"
#define nl cout<<endl
#define pb push_back
#define f(i,a,b) for(ll i=a;i<b;i++)
#define Knucklehead ios_base::sync_with_stdio(false);cin.tie(NULL);
#define txti freopen("input.txt", "r", stdin);
#define txto freopen("output.txt", "w", stdout);
//#define mod 100000007

#define mat vector<vector<ll>>
mat cn(ll n, ll m){return vector< vector<ll> >(n, vector<ll>(m));}
bool compare(char &s1,char &s2){return s1 > s2;} 

bool sortmahstyle(const pair<ll,ll> &a,  const pair<ll,ll> &b) 
{ 
    if(a.second > b.second )
        return true;
    if( a.second==b.second && a.first > b.second )
       return true;
 
    return false;
 }
//me
ll const mod = 1e9+7;
ll const inf = 1e6+2;
ll fact[inf];
void factfill()
{
    fact[0]=1;
    for(ll i=1; i<inf; i++)
        fact[i] = ( fact[i-1]*i ) % mod;
}

ll powmod(ll a, ll b)
{
    ll res = 1;
    while(b){
        if(b%2) res = ( res*a )%mod;
        a = (a*a)%mod;
        b/=2;
    }
    return res;
}

ll inv(ll x)
{
    return powmod(x,mod-2) % mod;
}

ll choose(ll n, ll r)
{
    return ( (fact[n]* inv(fact[n-r] ) )%mod *inv(fact[r]))%mod;
}
void solve()
{   

    string s; cin >> s;

    ll n = s.size();

    stack<char> st;
    f(i,0,n){

        if(s[i]=='0')
            st.push('0');
        else if(s[i]=='1')
            st.push('1');
        else{
            if(!st.empty())
                st.pop();
        }

    }
    string ans="";
    while(!st.empty()){
        ans += st.top();
        st.pop();
    }
    reverse(ans.begin(), ans.end());
    cout << ans << endl;
}

int main() {
Knucklehead 
//*
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
/**/


        //factfill();
        ll t;
        /**/t=1;
        /*/cin>>t;/**/
        f(testcases,0,t){
            solve();
        }
 
 
 
 
    return 0;
}

Measured memory_bytes: 3652
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>

#define MOD 1000000007
#define INF 1e9
#define sum(a) accumulate(begin(a), end(a), 0, [](int a, int b) {return a+b;})

using namespace std;
using ll = long long;

unordered_map<int, int> bfs_dist(int v, unordered_map<int, vector<int>> &edges) {
    unordered_map<int, int> distances;
    unordered_set<int> seen;
    deque<tuple<int, int>> q;
    q.push_back(make_tuple(v,0));
    while (!q.empty()) {
        int curr, dist;
        tie(curr, dist) = q.front(); q.pop_front();
        if (seen.find(curr) != seen.end()) continue;
        seen.insert(curr);
        distances[curr] = dist;
        for (int ne : edges[curr]) {
            q.push_back(make_tuple(ne, dist+1));
        }
    }
    return distances;
}

int main() {
    // get a integer
    int N, u, v;
    cin >> N >> u >> v;
    unordered_map<int, vector<int>> edges;
    for (int i = 1; i < N; i++) {
      int a, b;
      cin >> a >> b;
      edges[a].push_back(b);
      edges[b].push_back(a);
    }
    auto udist = bfs_dist(u, edges);
    auto vdist = bfs_dist(v, edges);
    int bestdist = -INF;
    for (int i = 1; i < N+1; i++) {
       if (udist[i] < vdist[i]) {
           bestdist = max(bestdist, vdist[i]);
       }
    }
    cout << bestdist-1 << endl;
}


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

int main() {
    ll x;
    cin >> x;
    ll ans = 100;
    int count = 0;
    while (ans < x) {
        ans += ans / 100;
        count++;
    }
    cout << count << endl;
}

Measured memory_bytes: 3628
#include "bits/stdc++.h"

using namespace std;

typedef pair<int, int> P;
#define int long long
#define ll long long
#define mod 1000000007
#define INF (1LL<<60)

#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define YES cout << "YES" << endl;
#define Yes cout << "Yes" << endl;
#define NO cout << "NO" << endl;
#define No cout << "No" << endl;


struct edge { int to, cost; };
vector<vector<edge>> g;
vector<int> dist;

bool shortest_path(int s){
	int N = g.size();
	dist.assign(N, INF);
	dist[s] = 0;

	bool negative_cycle = false;

	for (int i = 0; i < N; i++){
		for (int v = 0; v < N; v++){
			for (edge e : g[v]){

				if (dist[v] != INF && dist[e.to] > dist[v] + e.cost){
					dist[e.to] = dist[v] + e.cost;
					// n回目にも更新があれば負サイクルあり
					if (i == N - 1){
						dist[e.to] = -INF;
						negative_cycle = true;
					}
				}
			}
		}
	}
	return negative_cycle;
}

signed main(){

	int V, E, s;
	cin >> V >> E >> s;
	g.assign(V, vector<edge>());
	for (int i = 0; i < E; i++){
		int a, b, c;
		cin >> a >> b >> c;
		g[a].push_back(edge{ b, c });
	}
	bool negative_cycle = shortest_path(s);

	if (negative_cycle){
		cout << "NEGATIVE CYCLE" << endl;
	}
	else{
		for (int i = 0; i < V; i++)
			if (dist[i] == INF) cout << "INF" << endl;
			else cout << dist[i] << endl;
	}


	return 0;
}


Measured memory_bytes: 3132
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
const int MAXS = 1 << 16;
const int MAXN = 1e5 + 5;
int dp[MAXS] , n , S , a[MAXN];
int DP(int now) {
	if(now == 0) return 0;
	if(dp[now] != -1) return dp[now];
	dp[now] = 1e9;
	for (int i = 0; i < 15; ++i) {
		if(!(now & (1 << i))) continue;
		for (int j = i + 1; j < 15; ++j) {
			if(!(now & (1 << j))) continue;
			int nnow = now ^ (1 << i) ^ (1 << j) ^ (1 << (((i+1) ^ (j+1)) - 1));
//			if(now == 7) printf("%d %d %d\n" , nnow);
			int f;
			if(((now ^ (1 << i) ^ (1 << j)) & (1 << (((i+1) ^ (j+1)) - 1)))) f = 1;
			else f = 0;
			dp[now] = min(dp[now] , DP(nnow) + 1 + f);
		}
	}
	return dp[now];	
}
int main() {
	scanf("%d" , &n);
	for (int i = 1; i < n; ++i) {
		int u , v , w;
		scanf("%d %d %d" , &u , &v , &w);
		a[u] ^= w;
		a[v] ^= w;
	}
	int ans = 0;
	for (int i = 0; i < n; ++i) {
//		printf("%d\n" , a[i]);
		if(!a[i]) continue;
		if(S & (1 << (a[i] - 1))) ans ++;
		S ^= (1 << (a[i] - 1));
	} 
//	printf("%d " , S);
	memset(dp , -1 , sizeof dp);
	dp[0] = 0;
	ans += DP(S);
//	for (int now = 1; now < (1 << 15); ++now) {
//		for (int i = 0; i < 15; ++i) {
////			if(!(now & (1 << i))) continue;
//			for (int j = i + 1; j < 15; ++j) {
////				if(!(now & (1 << j))) continue;
//				int nnow = now ^ (1 << i) ^ (1 << j) ^ (1 << (((i+1) ^ (j+1)) - 1));
////				if(now == 7) printf("%d %d %d\n" , nnow);
//				dp[now] = min(dp[now] , dp[nnow] + 1 + ((now ^ (1 << i) ^ (1 << j)) & (1 << (((i+1) ^ (j+1)) - 1))));
//			}
//		}
//	}
	printf("%d" , ans);
	return 0;
}

Measured memory_bytes: 3876
#include<stdio.h>
#define N 1000

int main(){
  int i,j = 0,l,m,A[N],v;
  
  scanf("%d",&j);
  for(i = 0;i < j;i++){
    scanf("%d",&A[i]);
  }
  
  for(i = 0;i < j;i++){
    v = A[i];
    m = i-1;
    while(m >= 0 && A[m] > v){
      A[m+1] = A[m];
      m--;
      A[m+1] = v;
    }
    
    for(l = 0; l <  j; l++){
      printf("%d",A[l]);
       if(l != j-1)printf(" ");
    }
    printf("\n");
  }
  return 0;
}



Measured memory_bytes: 2128
import sys
sys.setrecursionlimit(100000000)
def input():
    return sys.stdin.readline()[:-1]
from bisect import *
from collections import *
from heapq import *
from math import *
from copy import *

H, W = map(int, input().split())
A = [input() for i in range(H)]
q = deque()
c = [[-1] * W for i in range(H)]
for i in range(H):
    for j in range(W):
        if A[i][j] == '#':
            q.append((i, j))
            c[i][j] = 0
D = [[0, 1], [1, 0], [0, -1], [-1, 0]]
while q:
    y, x = q.popleft()
    for dy, dx in D:
        ny, nx = y+dy, x+dx
        if 0 <= ny < H and 0 <= nx < W and c[ny][nx] == -1:
            q.append((ny, nx))
            c[ny][nx] = c[y][x]+1
print(max([max(l) for l in c]))


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

int main() {
	int n; cin >> n;
	vector<int>B(n, (int)1e9); 
	for (int i = 0; i < n-1;i++)cin >> B[i];
	
	long long ans = B[0];
	for (int i = 1; i < n; i++) {
		ans += min(B[i - 1], B[i]);
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void) {
	int i,max=0;
	double w[50];
	for(i=0;i<50;i++){
		int ret=scanf("%lf",&w[i]);
		if(ret==EOF) break;
		if(i>max) max=i;
	}
	for(i=0;i<=max;i++){
		if(w[i]<=48.0)
			puts("light fly");
		else if(w[i]>48.0&&w[i]<=51.0)
			puts("fly");
		else if(w[i]>51.0&&w[i]<=54.0)
			puts("bantam");
		else if(w[i]>54.0&&w[i]<=57.0)
			puts("feather");
		else if(w[i]>57.0&&w[i]<=60.0)
			puts("light");
		else if(w[i]>60.0&&w[i]<=64.0)
			puts("light welter");
		else if(w[i]>64.0&&w[i]<=69.0)
			puts("welter");
		else if(w[i]>69.0&&w[i]<=75.0)
			puts("light middle");
		else if(w[i]>75.0&&w[i]<=81.0)
			puts("middle");
		else if(w[i]>81.0&&w[i]<=91.0)
			puts("light heavy");
		else
			puts("heavy");	
	}
	return 0;
}


Measured memory_bytes: 2032
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 

using namespace __gnu_pbds; 
using namespace std;

#define int           long long 
#define S             second
#define F             first
#define pb            push_back
#define all(c)        (c).begin(),(c).end()
#define rall(c)       (c).rbegin(),(c).rend() 
#define lb            lower_bound
#define ub            upper_bound
#define si(c)         (int)((c).size())
#define lcm(a, b)      (a * (b / __gcd(a,b)))  
#define inf           (int)(4e18)
// #define endl          '\n'
#define mp            make_pair
#define time(s)       (double(clock()-s)/double(CLOCKS_PER_SEC))
#define debug(args...)    _F(#args, args)
#define vi            std::vector<int>
#define pii           pair<int, int> 
#define vpi           vector<pii>
#define ordered_set   tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 

clock_t start;
mt19937_64 rng(chrono::system_clock::now().time_since_epoch().count());

template<typename T> void _F(const char *name, T arg1){ cerr << name << " = " << arg1 << endl;}
template<typename T, typename... Args> void _F(const char *names, T arg1, Args... args)
{ const char *name = strchr(names, ',');cerr.write(names, name-names) << " = " << arg1 << endl;_F(name+2, args...);}

template< typename T1, typename T2 > istream& operator>>(istream& in, pair<T1, T2> &q){ in >> q.F >> q.S; return in;}
template< typename T1, typename T2 > ostream& operator<<(ostream& out, pair<T1, T2> &q){ out << q.F << " " << q.S; return out;}
template< typename T1, typename T2 > pair<T1, T2> operator+(pair<T1, T2> p1, pair<T1, T2> p2){ return {p1.F+p2.F, p1.S+p2.S};}
template< typename T1, typename T2 > pair<T1, T2> operator-(pair<T1, T2> p1, pair<T1, T2> p2){ return {p1.F-p2.F, p1.S-p2.S};}
template< typename T1, typename T2 > bool operator<(pair<T1, T2> p1, pair<T1, T2> p2){ return p1 < p2 ;}

template<typename T> void Unique(vector<T> &v){
    sort(all(v)), v.resize(distance(v.begin(), unique(all(v))));
}


void solve() {
	bool x; cin >> x;
	cout << (!x) << endl;
}

signed main(){

    ios_base::sync_with_stdio(0); 
    cin.tie(0); cout.tie(0);   
    start = clock(); 

    // #ifndef ONLINE_JUDGE
    // freopen("input.txt", "r", stdin); 
    // freopen("output.txt", "w", stdout);
    // freopen("error.txt", "w", stderr);
    // #endif

    int test = 1;
    // cin >> test;
    
    cout << fixed << setprecision(2);
     
    for(int i = 1; i <= test; ++i){
    	solve();
    }

    cerr << time(start);
    return 0;
}


Measured memory_bytes: 3716
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
use std::io::{Write, BufWriter};
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, [ $t:tt ]) => {{
        let len = read_value!($next, usize);
        (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    }};

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn solve() {
    let out = std::io::stdout();
    let mut out = BufWriter::new(out.lock());
    macro_rules! puts {
        ($($format:tt)*) => (write!(out,$($format)*).unwrap());
    }
    input! {
        n: usize,
        x: i32,
        l: [i32; n],
    }
    let mut dist: i32 = 0;
    let mut ans: i32 = 1;
    for i in 0..n{
        dist = dist + l[i];
        if dist > x {break;}
        ans = ans + 1;
    }
    puts!("{}\n", ans);
}

fn main() {
    // In order to avoid potential stack overflow, spawn a new thread.
    let stack_size = 104_857_600; // 100 MB
    let thd = std::thread::Builder::new().stack_size(stack_size);
    thd.spawn(|| solve()).unwrap().join().unwrap();
}


Measured memory_bytes: 8572
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<set>
#include<map>
#include<iostream>
using namespace std;
#define re register
#define ll int
inline int gi()
{
	int f=1,sum=0;char ch=getchar();
	while(ch>'9' || ch<'0'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0' && ch<='9'){sum=(sum<<3)+(sum<<1)+ch-'0';ch=getchar();}
	return f*sum;
}
const int N=1000010,Mod=4;
int n,a[N];
bool C(int n,int m)
{
	while(n|m)
	{
		if((n&1)<(m&1))return false;
		n>>=1;
		m>>=1;
	}
	return true;
}
bool fl[4];
int main()
{
	n=gi();
	for(int i=1;i<=n;i++)scanf("%1d",&a[i]);
	for(int i=n;i;i--)
	{
		for(int j=1;j<i;j++)a[j]=abs(a[j]-a[j+1]);
		fl[0]=fl[1]=fl[2]=0;
		for(int j=1;j<i;j++)fl[a[j]]=1;
		if(!(fl[1]&fl[2]))
		{
			int ans=0;
			for(int j=1;j<i;j++)if(C(i-2,j-1))ans^=a[j];
			printf("%d\n", ans);
			break;
		}
	}
	return 0;
}


Measured memory_bytes: 4224
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main(){
  int n,l;
  string o,k;
  cin>>n;
  while(n--){
    cin>>o>>k;
    int l=k.size();
    for(int i=o.size()-1;i>=0;i--){
      if(o[i]=='J')
	k=k[l-1]+k.substr(0,l-1);
      else if(o[i]=='C')
	k=k.substr(1,l-1)+k[0];
      else if(o[i]=='E'){
	if(l%2)
	  k=k.substr(l/2+1)+k[l/2]+k.substr(0,l/2);
	else
	  k=k.substr(l/2)+k.substr(0,l/2);
      }
      else if(o[i]=='A')
	reverse(k.begin(),k.end());
      else if(o[i]=='P'){
	for(int j=0;j<l;j++){
	  if('1'<=k[j]&&k[j]<='9')
	    k[j]--;
	  else if(k[j]=='0')
	    k[j]='9';
	}
      }
      else if(o[i]=='M'){
	for(int j=0;j<l;j++){
	  if('0'<=k[j]&&k[j]<='8')
	    k[j]++;
	  else if(k[j]=='9')
	    k[j]='0';
	}
      }
    }
    cout<<k<<endl;
  }
  return 0;
}

Measured memory_bytes: 3148
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int MOD = 1000000007LL;
const int INF = LLONG_MAX;

signed main(){
    
    int a, b; cin >> a >> b;
    if((a * b) % 2 == 0) cout << "No" << endl;
    else cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void _main()
{
    int A, B, Q;
    cin >> A >> B >> Q;
    vector<ll> s(A), t(B);
    rep(i, 0, A) cin >> s[i];
    rep(i, 0, B) cin >> t[i];
    sort(s.begin(), s.end());
    sort(t.begin(), t.end());

    ll x;
    rep(i, 0, Q)
    {
        cin >> x;
        const auto sIt = lower_bound(s.begin(), s.end(), x);
        const auto tIt = lower_bound(t.begin(), t.end(), x);
        ll ans = 20000000000LL;
        rep(j, 0, 2)
        {
            rep(k, 0, 2)
            {
                // s -> & t ->
                if (j == 0 && k == 0)
                {
                    if ((sIt != s.end()) && (tIt != t.end()))
                    {
                        chmin(ans, max(*sIt - x, *tIt - x));
                    }
                }
                // s -> & t <-
                else if (j == 0 && k == 1)
                {
                    if ((sIt != s.end()) && ((tIt - t.begin()) > 0))
                    {
                        const ll r = *sIt - x;
                        const ll l = x - *(tIt - 1);
                        chmin(ans, min(l * 2 + r, r * 2 + l));
                    }
                }
                // s <- & t ->
                else if (j == 1 && k == 0)
                {
                    if (((sIt - s.begin()) > 0) && (tIt != t.end()))
                    {
                        const ll l = x - *(sIt - 1);
                        const ll r = *tIt - x;
                        chmin(ans, min(l * 2 + r, r * 2 + l));
                    }
                }
                // s <- & t <-
                else
                {
                    if (((sIt - s.begin()) > 0) && ((tIt - t.begin()) > 0))
                    {
                        chmin(ans, max(x - *(sIt - 1), x - *(tIt - 1)));
                    }
                }
            }
        }
        cout << ans << endl;
    }
}


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

int main() {
    int n; cin>>n;
    int m; cin>>m;
    int a[m];
    rep(i,0,m) cin>>a[i];
    rep(i,0,m){
        n-=a[i];
    }
    if(n<0)cout<<-1<<endl;
    else cout<<n<<endl;
}

Measured memory_bytes: 3628
#include <algorithm>
#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <map>
#include <ctime>
using namespace std;

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

typedef vector<int> vi;
typedef pair<int,int> pii;

const int inf=1<<29;

int dp[1<<16];

int table[16][17];

int main(void){
	int n;
	while(cin >> n,n){
		rep(i,1<<n) dp[i]=inf;\
		rep(i,n)rep(j,n+1) cin >> table[i][j];

		dp[0]=0;
		rep(i,(1<<n)-1)rep(j,n){
			if(i&(1<<j)) continue;

			int cost=table[j][0];

			rep(k,n) if(i&(1<<k)) cost=min(cost,table[j][k+1]);

			int next=i|(1<<j);
			dp[next]=min(dp[next],dp[i]+cost);
		}
		cout << dp[(1<<n)-1] << endl;
	}
	return 0;
}

Measured memory_bytes: 1416
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<utility>
#include<vector>
#include<queue>
#include<functional>
#include<map>
#include<set>
#include<cstring>
#include<string>
#include<stack>
#include<math.h>
#include<stdlib.h>
#include <iomanip>
using namespace std;
#define int long long
//#define double long double
typedef pair<int, int> pii;
typedef pair<pii, int> ppi;
typedef pair<int, pii > pip;
typedef pair<pii, pii > piipii;
typedef pair<double, double> pdd;
typedef pair<int, char> pic;
typedef priority_queue<pii, vector<pii>, greater<pii> > RPQ;
#define all(vec) vec.begin(), vec.end()
#define mk make_pair
#define INF (1 << 30)
#define INFL (1ll << 60)
#define mod 1000000007
#define se second
#define fi first

int X;

signed main(){
    cin >> X;
    int N = X / 100;
    int n = X % 100;
    int cnt = 0;
    for(int i = 5; i > 0; i--){
        cnt += n / i;
        n = n % i;
    }
    if(cnt > N){
        cout << 0 << endl;
    }
    else {
        cout << 1 << endl;
    }
    
    
    return 0;
}

/*

*/

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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define deg_to_rad(deg) (((deg) / 360) * 2 * M_PI)
#define rad_to_deg(rad) (((rad) / 2 / M_PI) * 360)

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

int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

typedef long long ll;

void solve(long long A, long long B, long long C, long long K) {
    int tot = 0;
    if (A > K) {
        tot += K;
        cout << tot << endl;
        return;
    } else {
        tot += A;
        K -= A;
    }

    if (B > K) {
        cout << tot << endl;
        return;
    } else {
        K -= B;
    }
    tot -= K;
    cout << tot << endl;
    return;
}
int main() {
    long long A;
    scanf("%lld", &A);
    long long B;
    scanf("%lld", &B);
    long long C;
    scanf("%lld", &C);
    long long K;
    scanf("%lld", &K);
    solve(A, B, C, K);
    return 0;
}


Measured memory_bytes: 3684
#include<stdio.h>
#include<string.h>
#include<string>
#include<iostream>
#include<algorithm>
#include<map>
using namespace std;
int judge[10];
int pan(int n){
	int ret = 1;
	while(n){
		if(judge[n%10] == 1){
			ret = 0;
			break;
		}
		n /= 10;	
	}
	return ret;
}



int main(){
	int dol,n,num;
	scanf("%d %d",&dol,&n);
	memset(judge,0,sizeof(judge));
	for(int i = 0 ;i  < n ; i++){
		scanf("%d",&num);
		judge[num] = 1; 
	}
	while(!pan(dol)){
		dol++;
	}
	printf("%d",dol);
	return 0;
}

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

int dp[40][1<<14];
int v[40];

int pnt(int c){
    return c>0?50+c*10:0;
}

int toBit(int c[7],int p){
    int bit=0;
    for(int i=1;i<7;i++){
        bit=(bit<<2)|c[i];
    }
    bit=(bit<<2)|(~v[p+7]?v[p+7]:0);
    return bit;
}

void solve(){
    memset(v,-1,sizeof(v));
    for(int i=0;i<25;i++)cin>>v[i],v[i]--;
    memset(dp,-1,sizeof(dp));
    int start=0;
    for(int i=0;i<7;i++)start=(start<<2)|(~v[i]?v[i]:0);
    dp[0][start]=0;
    for(int i=0;i<25;i++){

        for(int S=0;S<(1<<14);S++){
            if(dp[i][S]==-1)continue;
            int c[7];
            for(int j=0;j<7;j++)c[6-j]=S>>(j*2)&3;

            int to=toBit(c,i);
            if(i%5==4||i>=20){
                dp[i+1][to]=max(dp[i+1][to],dp[i][S]+pnt(c[0]));
                continue;
            }
            for(int j=0;j<4;j++){
                to=toBit(c,i);
                dp[i+1][to]=max(dp[i+1][to],dp[i][S]+pnt(c[0]));

                if(~v[i])c[0]=(c[0]+1)%4;
                if(~v[i+1])c[1]=(c[1]+1)%4;
                if(~v[i+5])c[5]=(c[5]+1)%4;
                if(~v[i+6])c[6]=(c[6]+1)%4;
            }

        }
    }

    int ans=0;
    for(int i=0;i<(1<<14);i++)ans=max(ans,dp[25][i]);

    cout<<ans<<endl;

}

int main(){
    int n;cin>>n;
    while(n--)solve();
    return 0;
}

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

int main(){
    int N,num;
    
    //入力
	cin>>N;
    vector<int> vec(N);
    vector<int> copy(N);
    for (int i=0; i<N; i++){
        cin >> vec.at(i);
    }
    char F='?';
    num=0;
    //かぶりをなくした配列を作る
    for (int i=0;i<N; i++){
        F='?';
        for(int j=0;j<num; j++){
            if(vec.at(i)==copy.at(j) ){//キャンセル条件
                F='q';
            }
        }
        if(F!='q'){//かぶりがなかった
            copy.at(num)=vec.at(i);
            num++;
        }
    }
    
    for(int i=0;i<num;i++){
        //cout<<copy.at(i)<<endl;//かぶりのない配列が見れる
    }
    
    cout<<num<<endl;
}

Measured memory_bytes: 256
#include <stdio.h>
 
int main(void)
{
    int A[100][100];
    int b[100];
    int c,i,j,n,m;
     
    scanf("%d %d",&n,&m);
     
    for(i=0;i<n;i++){
        for(j=0;j<m;j++){
            scanf("%d",&A[i][j]);
        }
    }
    for(i=0;i<m;i++){
        scanf("%d",&b[i]);
    }
     
    for(i=0;i<n;i++){
        c=0;
        for(j=0;j<m;j++){
            c+=A[i][j]*b[j];
        }
        printf("%d\n",c);
    }
     
    return 0;
}


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

int main(){
    int n,m;
    cin >> n >> m;
    int ans = n*(n-1)/2 + m*(m-1)/2;
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<algorithm>
#include<cstdio>
#include<vector>
#include<set>
#include<map>
#include<string>

using namespace std;

	long long a[409];
	long long kumu[409];
	
	long long dp[409][409];
	long long sum[409][409];

int main(){
	
	int n; cin >> n;
	
	memset(dp,63,sizeof dp);
	memset(sum,63,sizeof sum);
	
	for(int i = 1; i <= n; i++){
		
		cin >> a[i];
		kumu[i] += a[i] + kumu[i-1]; 
		dp[i][i] = a[i];
		sum[i][i] = 0;
		
	}
	
	
	for(int d = 1; d <= n; d++){
		
		for(int i = 1, j = d; i <= n && j <= n; i++,j++){
			
			
			if(j - i == 0) continue;
			
			
			for(int k = i; k < j; k++){
				
				if(sum[i][k] + sum[k+1][j] + dp[i][k] + dp[k+1][j] < sum[i][j]){
					
					sum[i][j] = sum[i][k] + sum[k+1][j] + dp[i][k] + dp[k+1][j];
					dp[i][j] = dp[i][k] + dp[k+1][j];
					
				}
				
				
			//	cout << dp[i][k] << " " << dp[k+1][j] << " " << i << " " << k << " " << j << endl;
			//	system("pause");
				
			}
			
			//cout << sum[i][j] << " " << dp[i][j] << " " << i << " " << j << endl;
			
		}
		
	}
	cout << sum[1][n];






	return 0;
}

Measured memory_bytes: 2816
n, q = map(int, input().split())
s = input()

acc = [0]
sum = 0
for i in range(n-1):
    # if s[i:i+2] == "AC":
    if s[i] == "A" and s[i+1] == "C":
        acc.append(acc[-1] + 1)
    else:
        acc.append(acc[-1])


for _ in range(q):
    l, r = map(int, input().split())
    print(acc[r-1] - acc[l-1])


Measured memory_bytes: 51504
import copy
def partition(a, p, r):
    x = a[r]
    i = p - 1
    for j in range(p,r):
        if a[j][1] <= x[1]:
            i += 1
            a[i], a[j] = a[j], a[i]
    a[i+1], a[r] = a[r], a[i+1]
    return(i+1)

def quickSort(a, p, r):
    if p<r:
        q = partition(a, p, r)
        quickSort(a, p, q - 1)
        quickSort(a, q+1, r)  


    #รับ input
n = int(input())
a = []
for i in range(n):
    a.append(list(input().split()))
    a[i][1]=int(a[i][1])
b = copy.deepcopy(a)

quickSort(a, 0, n-1)

for i in range(n-1):
    if a[i][1] == a[i+1][1]:
        if b.index(a[i]) > b.index(a[i+1]):
            print("Not stable")
            break
else:
    print("Stable")

for i in a:
    print(" ".join(map(str,i)))



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

int main() {
    int H,W;
    while(true) {
        cin >> H >> W;
        if(H == 0 && W == 0) {
            break;
        }
        
        for(int j=0; j<H; j++) {
            for(int i=0; i<W; i++) {
                if(j == 0 || j == H-1 || i == 0 || i == W-1) {
                    cout << "#";
                }else{
                    cout << ".";
                }
            }
            cout << endl;
        }
        cout << endl;
    }
}


Measured memory_bytes: 3060
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 height =0;
    for (int i=0; i<b-a; i++) {
      height += i;
    }
    height -= a;
    System.out.println(height);
  }
}

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

int main(void){
	int a[3];
	for(int i = 0; i < 3; i++){
		cin >> a[i];
	}
	sort(a, a+3);
	cout << a[0] <<" " << a[1] <<" " << a[2] << "\n";
	return 0;

}


Measured memory_bytes: 3140
k,n=map(int,input().split())
a = list(map(int,input().split()))
a_l = 0
a_s = 0
a_g = 0
for i in range(n):
    if i < n -1:
        a_short = min(abs(k-abs(a[i]-a[i+1])),abs(a[i]-a[i+1]))
        if a_l < a_short:
            a_l = a_short
            a_s = i
            a_g = i+1
    else:
        a_short = min(abs(k-abs(a[0]-a[n-1])),abs(a[0]-a[n-1]))
        if a_l < a_short:
            a_l = a_short
            a_s = 0
            a_g = n-1
print(max(abs(k-abs(a[a_s]-a[a_g])),abs(a[a_s]-a[a_g])))

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

int main(){

	double ans = 0, sum = 0;
	int n, x, d;
	scanf("%d%d%d", &n, &x, &d);
	
	sum = x * 2 * n + 1.0 * n * (2 * n - 1) * d;
	while(n){
		ans += sum * 0.5 / n;
		sum -= sum / n / n;
		--n;
	}
	printf("%.10lf\n", ans);

	return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define MOD 1000000007
using namespace std;
int main()
{
    int t[4] = {};
    for(int i = 0;i < 3;i++)
    {
        int a,b;
        cin >> a >> b;
        t[a - 1]++;
        t[b - 1] ++;
    }
    for(int i = 0;i < 4;i++)
    {
        if(t[i] == 0 || t[i] > 2)
        {
            cout << "NO\n";
            return 0;
        }
    }
    cout << "YES\n";

    return 0;
}

Measured memory_bytes: 256
package main

import "fmt"

func mini(x int64, y int64) int64 {
	if x < y {
		return x
	} else {
		return y
	}
}

func main(){
	var n,i,temp,ans int64
	//var temp,ans uint64
	fmt.Scan(&n)
	a := make([]int64,n+1)
	capa := make([]int64,n)
	c := make([]int64,n)
	temp = 1
	flag := true
	//k := 1
	for i=0 ; i<n ; i++ {
		fmt.Scan(&a[i])
		/*if temp <= a[i] {
			flag = false
		}*/
		//capa[i] = temp - a[i]
		//temp = capa[i]*2
		/*if capa[i] <= 0 || a[i] >= k{
			flag = false
		}*/
		//k *= 2
//fmt.Println(capa)
	}
	fmt.Scan(&ans)
	if n==0 && ans != 1{
		flag = false
	}
	//p := make([]int64,n)
	if !flag{
		fmt.Println("-1")
	} else {
		ss := ans
		for i=n-1; i>=0 ; i-- {
			c[i] = ss
			ss += a[i]
		}
//fmt.Println(c)
		for i=0 ; i<n ; i++ {
			capa[i] = mini(temp-a[i],c[i])
			if capa[i] < 0 {
				flag = false
				break
			}
			temp = capa[i]*2
		}
//fmt.Println(capa)
		child := ans
		var j int64
		if flag{
			for j=n-1 ; j>=0 ; j-- {
				//t = child - capa[j]*2
//fmt.Println(t,child,int64(capa[i]))
				if child > capa[j]*2 {
					//decrease child
					//tが足りない親の頂点
					//減らせる分だけその深さから調べてみる
					flag = false
					break
				}
				temp = mini(child,capa[j]) + a[j]
//fmt.Println(temp)
				ans += temp
				child = temp
				//p[j] = ttemp
			}
		}
//fmt.Println(p)
		if flag {
			/*child = 1
			for i=0 ; i<n ; i++ {
				if p[i] > child {
					flag = false
					break
				}
				child = (child-a[i])*2
			}
			if flag {*/
			fmt.Println(ans)
			/*} else {
				fmt.Println("-1")
			}*/
		} else {
			fmt.Println("-1")
		}
	}
}


Measured memory_bytes: 6832
//http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0003
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
	cin.tie(0);ios::sync_with_stdio(false);
	int n; cin >> n;
	for (int i = 0; i < n;i++) {
		int d[3]; for (int i = 0; i < 3; i++) cin >> d[i];
		sort(d, d + 3);
		if (d[0] * d[0] + d[1] * d[1] == d[2] * d[2]) {
			cout << "YES" << endl;
		}
		else {
			cout << "NO" << endl;
		}
	}
}

Measured memory_bytes: 3076
import java.util.Scanner;
public class Main{
  public static void main(String [] args){
    Scanner sc=new Scanner(System.in);
    int a=sc.nextInt(), b=sc.nextInt();
    int d=a/b;
    int r=a%b;
    double f=(double)a/b;
    System.out.printf("%d %d %.5f",d,r,f);
  }
}


Measured memory_bytes: 26636
#include <bitset>
#include <iostream>

int main(int argc, char *argv[]) {
  std::bitset<64> bs;
  int q;
  std::cin >> q;
  for (int j = 0; j < q; ++j) {
    int c, i;
    std::cin >> c;
    switch (c) {

    case 0:
      std::cin >> i;
      std::cout << bs.test(i) << std::endl;
      break;

    case 1:
      std::cin >> i;
      bs[i] = 1;
      break;

    case 2:
      std::cin >> i;
      bs[i] = 0;
      break;

    case 3:
      std::cin >> i;
      bs.flip(i);
      break;

    case 4:
      std::cout << bs.all() << std::endl;
      break;

    case 5:
      std::cout << bs.any() << std::endl;
      break;

    case 6:
      std::cout << bs.none() << std::endl;
      break;

    case 7:
      std::cout << bs.count() << std::endl;
      break;

    case 8:
      std::cout << bs.to_ulong() << std::endl;
      break;
    }
  }
}



Measured memory_bytes: 3108
import sys
N=int(input())
for h in range(1,3501):
    for n in range(h,3501):
        if 4*n*h-N*h-N*n >0:
            if (N*h*n)%(4*n*h-N*h-N*n)==0:
                w=int((N*h*n)/(4*n*h-N*h-N*n))
                print(h,n,w)
                sys.exit()

Measured memory_bytes: 3064
import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline
ra = range
enu = enumerate


def exit(*argv, **kwarg):
    print(*argv, **kwarg)
    sys.exit()


def mina(*argv, sub=1): return list(map(lambda x: x - sub, argv))
# 受け渡されたすべての要素からsubだけ引く.リストを*をつけて展開しておくこと


def a_int(): return int(read())


def ints(): return list(map(int, read().split()))


def read_col(H):
    '''H is number of rows
    A列、B列が与えられるようなとき
    ex1)A,B=read_col(H)    ex2) A,=read_col(H) #一列の場合'''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return tuple(map(list, zip(*ret)))


def read_tuple(H):
    '''H is number of rows'''
    ret = []
    for _ in range(H):
        ret.append(tuple(map(int, read().split())))
    return ret


def read_matrix(H):
    '''H is number of rows'''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return ret
    # return [list(map(int, read().split())) for _ in range(H)] # 内包表記はpypyでは遅いため


MOD = 10**9 + 7
INF = 2**31  # 2147483648 > 10**9
# default import
from collections import defaultdict, Counter, deque
from operator import itemgetter, xor, add
from itertools import product, permutations, combinations
from bisect import bisect_left, bisect_right  # , insort_left, insort_right
from functools import reduce
from math import gcd


def lcm(a, b):
    # 最小公倍数
    g = gcd(a, b)
    return a // g * b


# 入れ替えだけ考えればいいのかな？
N = int(input())
C = read()[:-1]
cntR = C.count('R')
print(C[:cntR].count('W'))


Measured memory_bytes: 68472
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		String s = sc.next();
		int count =0;
		int temp =0;
		for (int i=0;i<N;i++) {
			if (s.charAt(i)=='#') {
				temp++;
			} else if (s.charAt(i)=='.') {
				if (temp>0) {
					temp--;
					count ++;
				}
			}
		}
		System.out.println(count);
	}
}

Measured memory_bytes: 40624
#include<iostream>
#include<algorithm>
#include<queue>
#include<cmath>
#include<map>
#include<vector>
#include<iomanip>
using namespace std;
typedef long long ll;
ll inf = 100000000;
ll v[205];
ll x[20000005];
ll a[10000005];
ll b[10000005];
ll dp[10005][10005];
ll ex = 1000000007;
int dx[4] = { 1,-1,0,0 };
int dy[4] = { 0,0,1,-1 };
typedef pair<ll, ll> P;
double q[200005];
ll gcd(ll a, ll b) {
	return b ? gcd(b, a % b) : a;
}

P c(int x) {
	int a = x % 10;
	int b = 0;
	while (x) {
		b = x % 10;
		x = x / 10;
	}
	return P({ a,b });
}


int main() {
	int n;
	cin >> n;
	map<P,int>mp;
	for (int i = 1; i <= n; i++) {
		P p = c(i);
		mp[p]++;
	}
	ll ans = 0;
	for (int i = 1; i <= n; i++) {
		P p = c(i);
		P q = make_pair(p.second, p.first);
		ans += mp[q];
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int INF = (int)1e9;

int n,W;
vector<int > value;
vector<int > weight;
vector<vector<long long int > >dp;
long long int solve (int i, int w){
	if(w <= 0 or i == n) return 0;
	else if(dp[i][w]!=-1) return dp[i][w];
	else {
		dp[i][w] = solve(i + 1, w); // don't take this object!
		if (weight[i] <= w)
			dp[i][w] = max(dp[i][w], (value[i] + solve(i + 1, w - weight[i]))); 	
	}
	return dp[i][w];
}

	
int main(){
	cin>>n>>W;
	value.assign(n,0);
	weight.assign(n,0);
	for(int i=0;i<n;i++) cin>>weight[i]>>value[i];
	dp.assign(n + 1,vector<long long int>(W + 1,-1));
	cout<<solve(0,W);
}
	

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

int main(){
  int keta = 0;
  int pow=1;
  int n; cin>>n;
  int tmp=n;
  int ans=0;
  
  while(tmp>=10){
    tmp/=10;
    keta++;
      if(keta%2==1){
        ans+=pow*9;
      }
    pow*=10;
  }
  
  if(keta%2==0){
    ans+=n-pow+1;
  }
    
  cout<<ans<<endl;
  
}

Measured memory_bytes: 256
program prob46
    implicit none
    integer :: a
    character(20) :: s
    read(*,*) a
    read(*,*) s
    if(a >= 3200) then
        write(*,'(a)') trim(adjustl(s))
    else
        write(*,'(a)') "red"
    end if

    stop
contains
end program prob46

Measured memory_bytes: 2792
#include<stdio.h>

int dx[3] = {-1, 0, 1};
int dy[3] = {1, 1, 1};

int main(void)
{
	int **map, f1, f2, f3, **temp, x, y, sum, px, py;
	
	while(scanf("%d %d", &x, &y) && y > 0)
	{
		map = new int *[y];
		temp = new int *[y];
		sum = 0;

		//マップ土地&動的計画作成
		for(f1 = 0; f1 < y; f1++)
		{
			map[f1] = new int [x];
			temp[f1] = new int [x];
		}
		//マップ構成入力&初期化
		for(f1 = 0; f1 < y; f1++)
		{
			for(f2 = 0; f2 < x; f2++)
			{
				scanf("%d",&map[f1][f2]);
				temp[f1][f2] = 0;
			}
		}
		//最上のスタート地点設定
		for(f1 = 0; f1 < x; f1++)
		{
			if(map[0][f1] != 1)
			{
				temp[0][f1] = 1;
				sum++;
			}
		}
		//探索
		if(y >= 2)
		{
			sum = 0;
			for(f1 = 0; f1 < y - 1; f1++)
			{
				for(f2 = 0; f2 < x; f2++)
				{
					if(map[f1][f2] == 0 && temp[f1][f2] > 0)
					{
						for(f3 = 0; f3 < 3; f3++)
						{
							//移動
							px = f2 + dx[f3];
							py = f1 + dy[f3];
							//範囲内か
							if(px >= 0 && px < x)
							{
								//同じｘ座標からのジャンプ台
								if(f3 == 1 && py < y - 1){
									//ｙ軸2つ先へ
									while(py <= y - 1 && map[py][px] == 2)
										py += 2;
								}
								//着地した場所がゴール地点のｙ座標と同じで障害物にぶつかってないか
								//ゴール地点のｙ座標を超えたか
								if(py > y - 1 || py == y - 1 &&(f3 != 1 && map[py][px] == 0 || f3 == 1 && map[py][px] != 1))
									sum += temp[f1][f2];
								//超えてないが、障害物がない地点に着地したか
								else if(map[py][px] == 0)
									temp[py][px] += temp[f1][f2];
							}
						}
					}
				}
			}
		}
		//出力
		printf("%d\n",sum);
	}

	return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <functional>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <cassert>
#include <exception>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<P> vp;
#define rep(i,a,n) for(ll i = (a);i < (n);i++)
#define per(i,a,n) for(ll i = (a);i > (n);i--)
#define lep(i,a,n) for(ll i = (a);i <= (n);i++)
#define pel(i,a,n) for(ll i = (a);i >= (n);i--)
#define clr(a,b) memset((a),(b),sizeof(a))
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(),(c).end()
#define sz size()
#define print(X) cout << (X) << endl
const ll INF = 1e+9+7;
ll n,m,l;
string s,t;
ll d[200010],dp[600][600];

int main(){
  cin >> n;
  lep(i,0,n){
    if(n <= i*(i+1)/2){
      print(i);
      break;
    }
  }
  return 0;
}

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

#define ll long long
#define fornum(A,B,C) for(A=B;A<C;++A)
#define pii pair<int,int>
#define pll pair<ll,ll>

using namespace std;

/////////////////////////////////////////////////////

char S[10];

ll i, j, k;

int main(){
    scanf("%s", S);
    if('a'<=S[0]&&S[0]<='z'){
        printf("a\n");
    }else{
        printf("A\n");
    }
    return 0;
}

Measured memory_bytes: 3656
#include <iostream>
#include <map>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <sstream>
#include <cmath>
#include <math.h>
#include <string>
using namespace std;
typedef long long ll;
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s;
    cin >> s;
    for ( int i = (int)s.length() - 1 ; i > 0 ; i-- ) {
        if ( s.substr( 0 , i / 2 ) == s.substr( i / 2 , i / 2 ) && i % 2 == 0 ) {
            cout << i;
            return 0;
        }
    }
}



Measured memory_bytes: 256
#include<cstdio>
#include<cmath>
#include<algorithm>
using std::max;
using std::sort;
#define reg register
typedef long long ll;
#define INF 0X3F3F3F3F3F3F3F3F
#define getchar() (p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++)
static char buf[100000],*p1=buf,*p2=buf;
inline ll read(void){
	reg bool f=false;
	reg char ch=getchar();
	reg ll res=0;
	while(ch<'0'||'9'<ch)f|=(ch=='-'),ch=getchar();
	while('0'<=ch&&ch<='9')res=10*res+ch-'0',ch=getchar();
	return f?-res:res;
}

const int MAXN=200000+5;

int n;
ll k;
ll tmp[MAXN];
ll a[MAXN],f[MAXN];

inline void Read(void);
inline void Work(void);

int main(void){
	Read();
	Work();
    return 0;
}

inline void Read(void){
    reg int i;
	n=read(),k=read();
	for(i=1;i<=n;++i)
		a[i]=read();
	for(i=1;i<=n;++i)
		f[i]=read();
	return;
}

inline bool check(reg ll mid){
	reg ll i;
	for(i=1;i<=n;++i)
		tmp[i]=mid/f[i];
	sort(tmp+1,tmp+n+1);
	ll ans=0;
	for(i=n;i>=1;--i)
		ans+=max(0ll,a[i]-tmp[i]);
	return ans<=k;
}

inline void Work(void){
	sort(a+1,a+n+1);
	sort(f+1,f+n+1);
	reg ll l=0,r=1e13,mid,ans=0;
	while(l<=r){
		mid=(l+r)>>1;
		if(check(mid)){
			ans=mid;
			r=mid-1;
		}
		else
			l=mid+1;
	}
	printf("%lld\n",ans);
	return;
}

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

int main() {
    int n;
    std::cin >> n;
    std::vector<int> d(n);
    for (int i = 0; i < n; i++) {
        std::cin >> d[i];
    }

    int ans = 0;
    for (int i = 0; i < n; i++) {
        for (int j = i + 1; j < n; j++) {
            ans += d[i] * d[j];
        }
    }

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(a,b,c) for((a)=(b);(a)<(c);(a)++)

using namespace std;

bool ok(vector<vector<pair<int,int>>> &X, vector<int> &S){
    int i;
    REP(i,0,S.size()){
        if(S[i]){
            for(auto x : X[i]){
                if(S[x.first] != x.second) return false;        
            }
        }
    }
    return true;
}

int main(){
    int N, A;
    cin >> N;
    vector<vector<pair<int,int>>> X(N);
    int i, j;
    REP(i,0,N){
        cin >> A;
        REP(j,0,A){
            int a, b;
            cin >> a >> b;
            X[i].emplace_back(a-1,b);
        }
    }

    int m = 0;
    for(int b=0; b<(1<<N); b++){
        vector<int> S;
        REP(i,0,N){
            S.emplace_back((b & (1<<i))>0);
        }
        if(ok(X, S)){
            m = max(m, accumulate(S.begin(), S.end(), 0));
        }
    }

    cout << m << endl;

    return 0;
}

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

int main(){
  int a,b,x;
  cin >>a>>b>>x;
  if(x >= a*a*b/2) cout << setprecision(12) << atan(double(2)*(a*a*b-x)/(a*a*a))*45/atan(1) << endl;
  else cout << setprecision(12) << 90-atan(double(2)*x/(a*b*b))*45/atan(1) << endl;
}

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

int main() {
  int n, x(0);
  cin >> n;
  int arr[n];
  for (int i = 0; i < n; ++i) {
    cin >> arr[i];
    x ^= arr[i];
  }
  for (int i = 0; i < n; ++i) {
    cout << (x ^ arr[i]) << ' ';
  }
  cout << endl;
  return 0;
}

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

int main() {
    int n;
    cin >>n;
    int ans=0, bef=-1, now, tmp=0;
    for (int i = 0; i < n; i++) {
        cin >>now;
        if (bef >= now) {
            tmp++;
        }
        else {
            ans = max(ans, tmp);
            tmp = 0;
        }
        bef = now;
    }
    cout << max(ans, tmp) << endl;
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
typedef long long ll;
const int MAXN = 2e5 + 5;
const int mod = 2019;
const int MOD = mod + 5;

inline ll pw(ll a,int b)
{
	ll res=1;
	while(b)
	{
		if(b&1) res=res*a%mod;
		a=a*a%mod;
		b>>=1;
	}
	return res;
}

char s[MAXN];
int t[MOD],t2[MOD];

int main(void)
{
	scanf("%s",s+1);
	int n = strlen(s+1);
	
	t[0] = 1;
	int now=0;
	ll ans=0;
	for(int i=1; i<=n; ++i)
	{
		now = (now*10 + (s[i]-'0')) %mod;
		
		ans += t[now];
		++t[now];
		
		for(int j=0; j<mod; ++j) t2[j*10%mod] = t[j];
		for(int j=0; j<mod; ++j) t[j] = t2[j];
	}	
	printf("%lld",ans);
	return 0;
}

Measured memory_bytes: 1920