akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define lli long long int
#define ll long long
#define M (int)1e9+7
#define I (int)10e5

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

    string s;
    cin>>s;
    int n = s.length();
    ll sum = 0;
    for(int i=0;i<n;i++)
    {
        sum+=(s[i]-'0');
    }
    // cout<<sum;
    if(sum%9==0)
    {
        cout<<"Yes";
    }
    else
    {
        cout<<"No";
    }
    return 0;
}


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

int main(){
    int h,w;
    cin >> h >> w;
    vector<vector<int> > adj(10, vector<int>(10));
    for(int i=0; i<10; i++){
        for(int j=0; j<10; j++){
            cin >> adj[i][j];
        }
    }
    for(int k=0; k<10; k++){
        for(int i=0; i<10; i++){
            for(int j=0; j<10; j++){
                adj[i][j] = min(adj[i][j], adj[i][k] + adj[k][j]);
            }
        }
    }
    
    long long int ans=0;
    for(int i=0; i<h*w; i++){
        int a;
        cin >> a;
        if(a!=-1){
            ans += adj[a][1];
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, A, B, T;
  cin >> N >> A >> B;
  T = A * N;
  if (T > B) {
    cout << B << endl;
  }
  else {
    cout << T << endl;
  }
    
}

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

using namespace std;

int main(void){
	string str;
	string right = "yuiophjklnm";
	while(1){
		getline(cin, str);
		if(str == "#"){
			break;
		}
		int count = 0;
		char position;

		for(int i = 0; i < str.size(); i++){
			if(i == 0){
				if(find(right.begin(),right.end(),str[i]) == right.end()){
					position = 'l';
				}else{
					position = 'r';
				}
			}
			if(position == 'r' and find(right.begin(),right.end(),str[i]) == right.end()){
				count++;
				position = 'l';
			}else if(position == 'l' and find(right.begin(),right.end(),str[i]) != right.end()){
				count++;
				position = 'r';
			}
		}
		cout << count << endl;
	}
	return 0;
}

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

// region template
#define rep(i, a, b) for (int i = (a); i < (b); ++i)
#define trav(a, x) for (auto &a : x)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;

ll gcd(ll a, ll b) { return __gcd(a, b); }

ll euclid(ll a, ll b, ll &x, ll &y) {
    if (b) { ll d = euclid(b, a % b, y, x);
        return y -= a/b * x, d; }
    return x = 1, y = 0, a;
}

typedef unsigned long long ull;
typedef long double ld;
ull mod_mul(ull a, ull b, ull M) {
    ll ret = a * b - M * ull(ld(a) * ld(b) / ld(M));
    return ret + M * (ret < 0) - M * (ret >= (ll)M);
}
ull mod_pow(ull b, ull e, ull mod) {
    ull ans = 1;
    for (; e; b = mod_mul(b, b, mod), e /= 2)
        if (e & 1) ans = mod_mul(ans, b, mod);
    return ans;
}

const ll mod = 1000000007;
struct Mod {
    ll x;
    Mod(ll xx) : x(xx) {}
    Mod operator+(Mod b) { return Mod((x + b.x) % mod); }
    Mod operator-(Mod b) { return Mod((x - b.x) % mod); }
    Mod operator*(Mod b) { return Mod((x * b.x) % mod); }
    Mod operator/(Mod b) { return *this * invert(b); }
    Mod invert(Mod a) {
        ll x, y, g = euclid(a.x, mod, x, y);
        assert(g == 1); return Mod((x + mod) % mod);
    }
    Mod operator^(ll e) {
        if (!e) return Mod(1);
        Mod r = *this ^ (e / 2); r = r * r;
        return e & 1 ? *this * r : r;
    }
};
// endregion

int main() {
    cin.sync_with_stdio(0); cin.tie(0); cin.exceptions(cin.failbit);

    ll n; cin >> n;
    ll ans = 0;
    for (int i = 1; i <= n; i++) {
        if (i % 3 == 0 || i % 5 == 0) continue;
        ans += i;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3644
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

namespace {
	void roll(char c, vector<int>& d)
	{
		switch (c)
		{
		case 'E': swap(d[0], d[3]); swap(d[3], d[5]); swap(d[5], d[2]); break;
		case 'S': swap(d[0], d[1]); swap(d[0], d[4]); swap(d[4], d[5]); break;
		case 'R': swap(d[1], d[2]); swap(d[1], d[4]); swap(d[1], d[3]); break;
		default: break;
		}
	}
}

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

	vector< vector<int> > d(n, vector<int>(6, 0));
	for (int i = 0; i < n; ++i)
		for (int j = 0; j < 6; ++j)
			cin >> d[i][j];

	string ans = "Yes";
	for (int i = 0; i < 7 && ans == "Yes"; ++i)
	{
		roll(" SEEEES"[i], d[0]);

		for (int j = 1; j < n; ++j)
			if (d[0][0] == d[j][0] && d[0][5] == d[j][5])
				for (int k = 0; k < 4; ++k)
				{
					roll(" RRR"[k], d[0]);
					if (equal(d[0].begin(), d[0].end(), d[j].begin()))
						ans = "No";
				}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 1224
#include<iostream>
using namespace std;
int main(){
    long long b,n,a,max,min,sum;
    cin>>n;
    b=0;
    max=-1000001;
    min=1000001;
    sum=0;
    while(b!=n){
        cin>>a;
        if(a>max)max=a;
        if(a<min)min=a;
        sum=sum+a;
        b+=1;
    }
    cout<<min<<" "<<max<<" "<<sum<<endl;
    return 0;
}


Measured memory_bytes: 3108
//#include<stdio.h>
#include<bits/stdc++.h>
using namespace std;
#define pi acos(-1.0)
int main()
{
    int n,m;
    cin>>n>>m;
    int sum=0;
    for(int i=1;i<=m;i++)
    {
        int a;
        cin>>a;
        sum+=a;
    }
    if(sum>n)cout<<"-1"<<endl;
    else cout<<n-sum<<endl;
}


Measured memory_bytes: 3636
/* ＵＴＦ－８ */
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <array>
#include <queue>
#include <stack>
#include <algorithm>
#include <tuple>
#include <numeric>
#include <type_traits>
#include <limits>

#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <string.h>

#define USE_COLORED 1

#ifdef USE_COLORED
static const char stdout_pre[]  = "\033[1m"; // bold black
static const char stderr_pre[]  = "\033[31;1m"; // bold red
static const char stdxxx_post[] = "\033[m";

// 当然ながら GCC(g++)/libstdc++ 依存
#include <ext/stdio_filebuf.h>
using stdio_filebuf = __gnu_cxx::stdio_filebuf<char>;
class colored_stdio_filebuf : public stdio_filebuf {
private:
	const char* const pre_;
	const char* const post_;

public:
	colored_stdio_filebuf(FILE* fp, const char* pre, const char* post) : stdio_filebuf(fp, std::ios_base::out), pre_(pre), post_(post)
	{
	}

protected:
	std::streamsize xsputn(const char* s, std::streamsize count) override
	{
		stdio_filebuf::xsputn(pre_, strlen(pre_));
		auto ret = stdio_filebuf::xsputn(s, count);
		stdio_filebuf::xsputn(post_, strlen(post_));
		return ret;
	}
};
#endif

int main()
{
#ifdef USE_COLORED
	if (getenv("DEBUG")) {
		std::cout.rdbuf(new colored_stdio_filebuf(stdout, stdout_pre, stdxxx_post));
		std::cerr.rdbuf(new colored_stdio_filebuf(stderr, stderr_pre, stdxxx_post));
	} else
#endif
	{
		int fd = open("/dev/null", O_WRONLY);
		dup2(fd, 2);
		close(fd);
	}
	
	int A, B;
	std::string S;
	std::cin >> A >> B;
	std::cin >> S;

	for (int i = 0; i < S.size(); ++i) {
		if (i == A) {
			if (S[i] != '-') {
				std::cout << "No\n";
				return 0;
			}
		} else {
			if (S[i] < '0' || S[i] > '9') {
				std::cout << "No\n";
				return 0;
			}
		}
	}
	std::cout << "Yes\n";
}


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

#define INF_LL (int64)1e18
#define INF (int32)1e9
#define REP(i, n) for(int64 i = 0;i < (n);i++)
#define FOR(i, a, b) for(int64 i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-10;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

const int64 mod = 1e9+7;

using Row = vector<int64>;
using Mat = vector<Row>;

int main(void){
	int32 N, K;
	cin >> N >> K;
	vector<int64> h(N), dp(N+1, INF_LL);
	REP(i, N) cin >> h[i];
	dp[0] = 0;
	REP(i, N){
		REP(j, K){
			if(i+j+1 < N){
				chmin(dp[i+j+1], dp[i]+abs(h[i]-h[i+j+1]));
			}
		}
	}
	cout << dp[N-1] << endl;
}


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

#define nl '\n'

using namespace std;

typedef long long ll;

void solve() {
  ll n;
  cin >> n;

  string name;
  while (n) {
   ll rem = n % 26;
    if (rem == 0) {rem = 26; n--;}
    name += rem + 'a' - 1;
    n /= 26;
  }

  cout << string(name.rbegin(), name.rend());
}

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

  // int t;
  // cin >> t;
  // while (t--) {
  solve();
  // }

  return 0;
}

Measured memory_bytes: 3652
from functools import reduce
from fractions import gcd
import math
import bisect
import itertools
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
INF = float("inf")


# 処理内容
def main():
    X = list(map(int, input().split()))
    for i in range(5):
        if X[i] == 0:
            print(i+1)
            return


if __name__ == '__main__':
    main()

Measured memory_bytes: 72768
#include <bits/stdc++.h>
#pragma GCC optimize ("O2")
#pragma GCC optimize ("unroll-loops")
//#pragma GCC optimize("no-stack-protector,fast-math")

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<pii, int> piii;
typedef pair<ll, ll> pll;
#define debug(x) cerr<<#x<<'='<<(x)<<endl;
#define debugp(x) cerr<<#x<<"= {"<<(x.first)<<", "<<(x.second)<<"}"<<endl;
#define debug2(x, y) cerr<<"{"<<#x<<", "<<#y<<"} = {"<<(x)<<", "<<(y)<<"}"<<endl;
#define debugv(v) cerr<<#v<<" : ";for (auto x:v) cerr<<x<<' ';cerr<<endl;
#define all(x) x.begin(), x.end()
#define pb push_back
#define kill(x) return cout<<x<<'\n', 0;

const ld eps=1e-7;
const int inf=1000000010;
const ll INF=10000000000000010LL;
const int mod = 1000000007;
const int MAXN = 100010, LOG=20;

ll n, m, k, u, v, x, y, t, a, b, ans;
ll A[MAXN], B[MAXN];
int ind[MAXN];

int main(){
	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	cin>>n;
	for (int i=1; i<=n; i++) cin>>A[i], t+=A[i];
	for (int i=1; i<=n; i++) cin>>B[i], ind[i]=i, t-=B[i];
	if (t<0) kill(-1)
	sort(ind+1, ind+n+1, [](int i, int j){
		return A[i]-B[i]<A[j]-B[j];
	});
	
	ll val=0;
	int j=n;
	for (int x=1; x<=n && A[ind[x]]-B[ind[x]]<0; x++){
		int i=ind[x];
		val-=B[i]-A[i];
		ans++;
		if (val<0){
			ans++;
			val+=A[ind[j]]-B[ind[j]];
			j--;
		}
	}
	cout<<ans<<'\n';
	
	return 0;
}


Measured memory_bytes: 2176
#include <stdio.h>

int main()
{
  int n,i,j,k,tmp,tmp2;
  
  scanf("%d",&n);
  
  int m[n][n];
  
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      m[i][j]=0;
    }
  }

  for(i=0;i<n;i++){
    scanf("%d",&tmp);
    scanf("%d",&k);
    for(j=0;j<k;j++){
      scanf("%d",&tmp2);
      m[tmp-1][tmp2-1]=1;
    }
  }
  
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      if(j!=0)printf(" ");
      printf("%d",m[i][j]);
    }
    printf("\n");
  }

  return 0;
  
}



Measured memory_bytes: 2048
import java.math.BigDecimal;
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    double d = (double)sc.nextInt();

    BigDecimal bd = BigDecimal.valueOf(d / 3.0);

    System.out.println(bd.multiply(bd).multiply(bd).toPlainString());

  }

}

Measured memory_bytes: 21716
#![allow(unused_imports)]
#![allow(non_snake_case, unused)]

use std::cmp::*;
use std::collections::*;
use std::ops::*;

// https://atcoder.jp/contests/hokudai-hitachi2019-1/submissions/10518254

macro_rules! eprint {
    ($($t:tt)*) => {{
        use ::std::io::Write;
        let _ = write!(::std::io::stderr(), $($t)*);
    }};
}
macro_rules! eprintln {
    () => { eprintln!(""); };
    ($($t:tt)*) => {{
        use ::std::io::Write;
        let _ = writeln!(::std::io::stderr(), $($t)*);
    }};
}
macro_rules! dbg {
    ($v:expr) => {{
        let val = $v;
        eprintln!("[{}:{}] {} = {:?}", file!(), line!(), stringify!($v), val);
        val
    }}
}

macro_rules! mat {
    ($($e:expr),*) => { Vec::from(vec![$($e),*]) };
    ($($e:expr,)*) => { Vec::from(vec![$($e),*]) };
    ($e:expr; $d:expr) => { Vec::from(vec![$e; $d]) };
    ($e:expr; $d:expr $(; $ds:expr)+) => { Vec::from(vec![mat![$e $(; $ds)*]; $d]) };
}

macro_rules! ok {
    ($a:ident$([$i:expr])*.$f:ident()$(@$t:ident)*) => {
        $a$([$i])*.$f($($t),*)
    };
    ($a:ident$([$i:expr])*.$f:ident($e:expr$(,$es:expr)*)$(@$t:ident)*) => { {
        let t = $e;
        ok!($a$([$i])*.$f($($es),*)$(@$t)*@t)
    } };
}

pub fn readln() -> String {
    let mut line = String::new();
    ::std::io::stdin().read_line(&mut line).unwrap_or_else(|e| panic!("{}", e));
    line
}

macro_rules! read {
    ($($t:tt),*; $n:expr) => {{
        let stdin = ::std::io::stdin();
        let ret = ::std::io::BufRead::lines(stdin.lock()).take($n).map(|line| {
            let line = line.unwrap();
            let mut it = line.split_whitespace();
            _read!(it; $($t),*)
        }).collect::<Vec<_>>();
        ret
    }};
    ($($t:tt),*) => {{
        let line = readln();
        let mut it = line.split_whitespace();
        _read!(it; $($t),*)
    }};
}

macro_rules! _read {
    ($it:ident; [char]) => {
        _read!($it; String).chars().collect::<Vec<_>>()
    };
    ($it:ident; [u8]) => {
        Vec::from(_read!($it; String).into_bytes())
    };
    ($it:ident; usize1) => {
        $it.next().unwrap_or_else(|| panic!("input mismatch")).parse::<usize>().unwrap_or_else(|e| panic!("{}", e)) - 1
    };
    ($it:ident; [usize1]) => {
        $it.map(|s| s.parse::<usize>().unwrap_or_else(|e| panic!("{}", e)) - 1).collect::<Vec<_>>()
    };
    ($it:ident; [$t:ty]) => {
        $it.map(|s| s.parse::<$t>().unwrap_or_else(|e| panic!("{}", e))).collect::<Vec<_>>()
    };
    ($it:ident; $t:ty) => {
        $it.next().unwrap_or_else(|| panic!("input mismatch")).parse::<$t>().unwrap_or_else(|e| panic!("{}", e))
    };
    ($it:ident; $($t:tt),+) => {
        ($(_read!($it; $t)),*)
    };
}


pub fn main() {
    let _ = ::std::thread::Builder::new().name("run".to_string()).stack_size(32 * 1024 * 1024).spawn(run).unwrap().join();
}

const MOD: i64 = 1_000_000_007;
const INF: i64 = std::i64::MAX/3;

fn solve() {
    let n = read!(usize);
    let a = read!([i64]);
    let mut sum = 0;
    for i in 0..n {
        sum ^= a[i];
    }
    for i in 0..n {
        print!("{} ",sum^a[i]);
    }
}

fn run() {
    solve();
}


Measured memory_bytes: 4912
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mp make_pair
#define nt _int128
#define mod 1000000007
int main()
{
#ifndef ONLINE_JUDGE
   	freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll t;
    // cin >> t;
    t  = 1;
    while(t--)
    {
    	int n,m,k;
    	cin>>n>>m>>k;
    	int brr[n+1]={0};
    	map<int,int>row,col1;
    	map<int,vector<int>>col;
    	for(int i=1;i<=k;i++)
    	{
    		int a,b;
    		cin>>a>>b;
    		row[a]++;
    		col1[b]++;
    		col[b].push_back(a);
	    }
	    int mx=0,id=-1;
	    for(auto it:col1)
	    {
	    	if(it.second>mx)
	    	{
	    		mx=it.second;
	    		id=it.first;
	    	}
	    }
	    ll cnt=0;
	    for(auto it:col)
	    {
	    	if(col1[it.first]==mx)
	    	{
	    		for(auto pt:it.second)
	    			brr[pt]++;
	    		cnt++;
	    	}
	    }
	    ll ans=0;
	    // cout<<mx<<" "<<cnt<<endl;
	    for(auto it:row)
	    {
	    	ll x=it.second;
	    	if(brr[it.first]==cnt)
	    		ans=max(ans,x+mx-1);
	    	else
	    		ans=max(ans,x+mx);
	    }
	    cout<<ans;
    }
    return 0;
}

Measured memory_bytes: 65704
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)(n); ++i)
using ll = long long;
using P = pair<int,int>;
static const ll INF = 1000000000000000000;
static const ll MOD = 1000000007;

int main(){
	int x;
	rep(i, 5){
		cin >> x;
		if(x == 0){
			cout << i + 1 << endl;
			return 0;
		}
	}
	return 0;
}



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

using namespace std;

const int N = 1e5 + 7;

int a[N];

main()
{
	int n;
	
	cin >> n;
	int c = 0;
	for (int i = 1; i <= n; i++)
	{
		scanf("%d", &a[i]);
		c += (a[i] == i);
	}
	for (int i = 1; i < n; i++)
	{
		if (a[i] == i && a[i + 1] == i + 1)
		{
			c--;
			i++;
		}
	}
	
	cout << c << endl;
}




Measured memory_bytes: 640
/*input
1 100000
1
*/
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <unordered_map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <climits>

using namespace std; 

int GCD(int x,int y){return y?GCD(y,x%y):x;}
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define rep(i,n) for(int i=0;i<(n);i++)
#define repl(i,a,b) for(int i=(a);i<(b);i++)
#define repm(i,a,b) for(int i=(a);i>(b);i--)
#define rept(v) for(auto it=v.begin();it<v.end();it++)
#define all(v) v.begin(),v.end()
const int INF = 1<<30;
typedef long long ll;
typedef pair<int,int> pii;

int const MOD = 1e9+7;
 
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(0);
	int n, k;
	cin >> n >> k;
	int a[n];
	rep(i, n) cin >> a[i];
	bool dp[k+1];
	memset(dp, 0, sizeof(dp));
	repl(i, 1, k+1) {
		rep(j, n) {
			if(i-a[j]>=0) {
				dp[i]|=!dp[i-a[j]];
			}
		}
	}
	cout << (dp[k] ? "First" : "Second");
	return 0;
}

Measured memory_bytes: 3736
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        
        
        Scanner sc = new Scanner(System.in);
		String s = sc.next();
		
		if (s.charAt(0)!='A') {
		    
			System.out.println("WA");
			return ;
			
		}
		int count =0;
		for (int i=2;i<s.length()-1;i++) {
		    
			if (s.charAt(i)=='C') {
			    
				count ++;
			}
		}
		
		if (count!=1) {
			System.out.println("WA");
			return ;
		}
		
		for (int i=1;i<s.length();i++) {
		    
			if (s.charAt(i)!='C'&&(s.charAt(i)<'a'||s.charAt(i)>'z')) {
				System.out.println("WA");
				return ;
			}
			
			if (s.charAt(i)=='C') {
				if (i==1||i==s.length()-1) {
				    
					System.out.println("WA");
					return ;
				}
			}
		}
		
		System.out.println("AC");
		return ;
	}
}


Measured memory_bytes: 35500
#include<stdio.h>
int main(){
  int N;
  scanf("%d",&N);
  int i;
  int H[100];
  for(i=0;i<N;i++){
    scanf("%d ",&H[i]);
  }
  
  int flag=0,cnt=0;
  
  int j;
  for(i=1;i<N;i++){
    for(j=0;j<i;j++){
      if(H[i]>=H[j]) flag++;
      else{
        flag=0;
        break;
      }
    }
    if(flag>0) cnt++;
  }
  printf("%d",cnt+1);
  return 0;
}
  	
  

Measured memory_bytes: 128
import java.util.Scanner;

public class Main {

	@SuppressWarnings("resource")
	public static void main(String args[]) {
		Scanner scanner = new Scanner(System.in);
		String[] a = scanner.next().split("");
		String[] b = scanner.next().split("");
		String[] c = scanner.next().split("");
		String ans = "";

		if (a[a.length - 1].equals(b[0]) && b[b.length - 1].equals(c[0])) {
			ans = "YES";
		} else {
			ans = "NO";
		}

		System.out.println(ans);
	}
}


Measured memory_bytes: 21844
// #pragma GCC target("avx2")
#pragma GCC optimize("O3", "unroll-loops")

// #include <bits/extc++.h>
// using namespace __gnu_pbds;

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

#define int long long
#define double long double
// template <typename T>
// using pbds_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
using pii = pair<int, int>;
template<typename T>
using prior = priority_queue<T, vector<T>, greater<T>>;
template<typename T>
using Prior = priority_queue<T>;

#define X first
#define Y second
#define ALL(x) (x).begin(), (x).end()
#define eb emplace_back
#define pb push_back

#define fastIO() ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define RANDOM() random_device __rd; \
                 mt19937 __gen = mt19937(__rd()); \
                 uniform_int_distribution<int> __dis(0, 1); \
                 auto rnd = bind(__dis, __gen);

const int INF = 1E18;
const int mod = 1E9 + 7;

int32_t main() {
    fastIO();
    
    int n;
    cin >> n;
    
    vector<int> v(n);
    for (auto &x : v) cin >> x;
    partial_sum(ALL(v), v.begin());
    
    vector<vector<int>>  dp(n, vector<int>(n, INF));
    vector<vector<int>> lst(n, vector<int>(n));
    for (int i = 0; i < n; ++i) dp[i][i] = 0, lst[i][i] = i;
    for (int len = 2; len <= n; ++len) {
        for (int l = 0, r = len-1; r < n; ++l, ++r) {
            for (int m = lst[l][r-1]; m <= lst[l+1][r] and m < n-1; ++m) {
                if (dp[l][m] + dp[m+1][r] < dp[l][r]) {
                    dp[l][r] = dp[l][m] + dp[m+1][r];
                    lst[l][r] = m;
                }
            }
            dp[l][r] += v[r] - (l ? v[l-1] : 0);
        }
    }
    
    cout << dp[0][n-1] << "\n";
    
    return 0;
}

Measured memory_bytes: 2816
#include <cstdio>
#include <cctype>
#include <utility>
#include <vector>
using namespace std;

#define gcu getchar_unlocked
#define pcu putchar_unlocked
#define _T template <typename T>
#define _HT template <typename H, typename... T>
#define _il inline
#define _in _il int in
#define _sc _il bool scan
_T T in(int c){T n=0;bool m=false;while(isspace(c)){c=gcu();}if(c=='-')m=true,c=gcu();
	do{n=10*n+(c-'0'),c=gcu();}while(c>='0'&&c<='9');return m?-n:n;}
_in() {return in<int>(gcu());}
_T T scan(T &n){int c=gcu();return c==EOF?false:(n=in<T>(c),true);}
_sc(char &c){c=gcu();gcu();return c!=EOF;}
#ifdef _GLIBCXX_STRING
_sc(string &s){int c;s="";
	for(;;){c=gcu();if(c=='\n'||c==' ')return true;else if(c==EOF)return false;s+=c;}}
#endif
_HT _sc(H &h, T&&... t){return scan(h)&&scan(t...);}
#define _vo _il void out
#define _vl _il void outl
_vo(bool b) {pcu('0'+b);}
_vo(const char *s){while(*s)pcu(*s++);}
_vo(char c){pcu(c);}
#ifdef _GLIBCXX_STRING
_vo(string s){for(char c:s)pcu(c);}
#endif
_T _vo(T n){static char buf[20];char *p=buf;
	if(n<0)pcu('-'),n*=-1;if(!n)*p++='0';else while(n)*p++=n%10+'0',n/=10;
	while (p!=buf)pcu(*--p);}
_vl(){out('\n');}
#ifdef _GLIBCXX_VECTOR
_T _vo(vector<T> &v){for(T &x:v)out(&x == &v[0]?"":" "),out(x);outl();}
#endif
_HT _vo(H&& h, T&&... t){out(h);out(move(t)...);}
template <typename... T> _vl(T&&... t){out(move(t)...);outl();}

template<typename T>
using V = vector<T>;

int main() {
	for (int N; (N = in());) {
		int W = in() + 1, H = in() + 1;
		V<V<int>> v = V<V<int>>(H, V<int>(W)), w = v;
		while (N--) {
			int x = in(), y = in();
			v[y][x] = 1;
		}
		auto g = [](int si, int ei, int sj, int ej, auto f) {
			for (int i = si; i < ei; i++)
				for (int j = sj; j < ej; j++)
					f(i, j);};
		g(1, H, 1, W, [&](int i, int j) {
			  v[i][j] = v[i - 1][j] + v[i][j], w[i][j] = v[i][j] + w[i][j - 1];});
		int S = in(), T = in(), m = 0;
		g(T, H, S, W, [&](int i, int j) {
				m = max(m, w[i][j] - w[i - T][j] - w[i][j - S] + w[i - T][j - S]);});
		outl(m);
	}
}


Measured memory_bytes: 2596
#define _USE_MATH_DEFINES
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
#include <random>
#include <cassert>
using namespace std;

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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<ll, int> ll_i;
typedef pair<int, ll> i_ll;
typedef pair<double, int> d_i;
typedef pair<ll, ll> ll_ll;
typedef pair<double, double> d_d;
struct edge { int v; ll w; };

ll _MOD = 1000000009;
double EPS = 1e-10;
int INF = INT_MAX / 2;

const int M = 1000000, MOD = 1e9+7;
ll inv[M + 1], f[M + 1], fi[M + 1];

int main() {
	inv[1] = 1;
	for (int i = 2; i <= M; i++)
		inv[i] = -MOD / i * inv[MOD % i] % MOD;
	f[0] = fi[0] = 1;
	for (int i = 1; i <= M; i++) {
		f[i] = f[i - 1] * i % MOD;
		fi[i] = fi[i - 1] * inv[i] % MOD;
	}
	int N, x, y;
	cin >> N >> x >> y;
	vector<int> c(N), w(N);
	rep(i, N) scanf("%d%d", &c[i], &w[i]), c[i]--;
	vector<int> mi(N, INF);
	rep(i, N) mi[c[i]] = min(mi[c[i]], w[i]);
	vector<i_i> mis;
	rep(k, N) if (mi[k] < INF) mis.pb(i_i(mi[k], k));
	sort(mis.begin(), mis.end());
	vector<bool> pos(N), pos_c(N);
	rep(i, N) rep(t, 2) {
		if (t == mis.size()) break;
		if (c[i] != mis[t].second && w[i] + mis[t].first <= y)
			pos[i] = pos_c[c[i]] = true;
	}
	rep(i, N) if (pos_c[c[i]] && w[i] + mi[c[i]] <= x) pos[i] = true;
	vector<int> num(N);
	int tot = 0;
	rep(i, N) if (pos[i]) num[c[i]]++, tot++;
	ll ans = f[tot];
	rep(k, N) ans = ans * fi[num[k]] % MOD;
	cout << (ans + MOD) % MOD << endl;
}


Measured memory_bytes: 28148
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp> // Include for built in treap
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
const int MOD = 1e9 + 7;
#define ll long long int
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pb push_back
#define eb emplace_back
#define ff first
#define ss second
#define vi vector<int>
#define vl vector<ll>
#define vpii vector<pii>
#define vpll vector<pll>
#define si set<int>
#define mpii map<int, int>
#define prq priority_queue
#define sz(s) (int) s.size()
#define pf(a) printf("%d\n",a)
#define sc1(a) scanf("%d",&a)
#define sc2(a, b) scanf("%d%d",&a,&b)
#define pi 2 * acos (0.0)
#define inf 1e9
#define dbg cout<<"ok"<<endl;
#define FOR(i, j, k) for(int i=(j); i<(k); i++)
#define REV(i, j, k) for(int i=(n-1); i>=k; i--)
#define rnd(a, b) ((((rand()<<15)^rand())%((b)-(a) + 1))+(a))
//#define FAST_IO ios_base::sync_with_stdio(false),cin.tie(NULL)
#define mem(x, y) memset(x, y, sizeof(x))
typedef tree <int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pb_ds;
const double EPS = 1e-9;
const int MXX = 1e5 + 5;
int dp[1002][1002];
int main()
{

    int t;
    int r, c;
        string s[1002];
        scanf("%d %d",&r,&c);

        memset(dp,0,sizeof(dp));

       for(int i=0;i<=r-1;i++)
       {
           cin >> s[i];
       }


        for(int i=0;i<=r-1;i++)
        {
            for(int j=0;j<=c-1;j++)
            {
                if(s[i][j]=='#')
                {
                  dp[i][j]=0;
                }
                else if(i==0&&j==0&&s[i][j]=='.')
                {
                    dp[i][j]=1;
                }
                else
                {
                    if(i-1>=0)
                    {
                        dp[i][j]=((dp[i][j]%MOD)+(dp[i-1][j]%MOD))%MOD;
                       // cout << dp[i][j] << endl;
                    }
                    if(j-1>=0)
                    {
                        dp[i][j]=((dp[i][j]%MOD)+(dp[i][j-1]%MOD))%MOD;
                        //cout << dp[i][j] << endl;
                    }
                }
            }
        }
        printf("%d\n",dp[r-1][c-1]);


    return 0;
}


Measured memory_bytes: 5248
#include<stdio.h>
#include<iostream>
#include<string>
using namespace std;
struct EE{string st;};

int main(){

int n,m;
while(cin>>n){
struct EE R[260];
for(int i=0;i<n;i++)
cin>>R[i].st;
cin>>m;string str;
bool f=true;
for(int i=0;i<m;i++)
{cin>>str;
for(int j=0;j<n;j++)
if(R[j].st==str&&f==false){
cout<<"Closed by "<<str<<endl;
f=true;break;
}
else if(R[j].st==str&&f==true){
cout<<"Opened by "<<str<<endl;
f=false;break;
}
else if(j==n-1){
cout<<"Unknown "<<str<<endl;
}
}
}
return 0;
}

Measured memory_bytes: 1216
#include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<pii, int> ppiii;

int flip[10];
void solve() {
  int n, m;
  cin >> n >> m;
  for(int i = 0; i < m; i++) {
    int k;
    cin >> k;
    while(k--) {
      int t;
      cin >> t;
      flip[--t] |= 1 << i;
    }
  }
  int desire = 0;
  for(int i = 0; i < m; i++) {
    int t;
    cin >> t;
    desire |= t << i;
  }
  int ret = 0;
  for(int mask = 0; mask < (1<<n); mask++) {
    int curr = 0;
    for(int i = 0; i < n; i++) {
      if(mask&(1<<i)) curr ^= flip[i];
    }
    if(curr == desire) ret++;
  }
  cout << ret << "\n";
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL); cout.tie(NULL);
  /*
  int t;
  cin >> t;
  for(int i = 1; i <= t; i++) {
    cout << "Case #" << i << ": ";
    solve();
  }
  */
  solve();
}


Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))
s = sum(a)
ans = []
dif = 0

for i in range(1, n, 2):
    dif += a[i]

ans.append(s-2*dif)

for i in range(1, n):
    ans.append(2*a[i-1]-ans[i-1])


print(*ans)


Measured memory_bytes: 14032
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)n; i++)
#define PI 3.14159265358979323846
#define vll vector<long long>
using namespace std;
using ll = long long;
using ld = long double;

// ----本問について----
// 問題：英語の文章
// 問題文URL：https://onlinejudge.u-aizu.ac.jp/problems/0029
// 所要時間：
// 学んだこと：
// ------------------

// ----ここから本問のソースコード----

// グローバル変数（入力）
unordered_map<string, ll> m;

void solve() {
  string s;
  ll maxL = 0;
  string maxS;
  while (cin >> s) {
    m[s]++;
    if ((ll)s.size() > maxL) {
      maxL = s.size();
      maxS = s;
    }
  }
  ll maxH = 0;
  string maxHS;
  for (auto itr = m.begin(); itr != m.end(); itr++) {
    string key = itr->first;
    ll value = itr->second;
    if (value > maxH) {
      maxH = value;
      maxHS = key;
    }
  }
  cout << maxHS << " " << maxS << endl;
}

int main() {
  solve();
  return 0;
}



Measured memory_bytes: 3112
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
const ll MAX = 1001001;
const ll MOD = 1000000007;
const ll INF = 1001001001;

int main()
{
    ll n;
    cin >> n;
    vector<ll> d(n, 0);
    rep(i, n)
    {
        ll a, b;
        cin >> a >> b;
        if (a == b)
        {
            d[i] = 1;
        }
        }
    rep(i, n - 2)
    {
        if (d[i] == 1 && d[i + 1] == 1 && d[i + 2] == 1)
        {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
}

Measured memory_bytes: 3632
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($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)*}
    };
    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $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:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}
use std::collections::HashMap;
use std::cmp::{max,min};
fn main(){
    input!{
        n:usize,
        mut an:[i64;n+1],
        bn:[i64;n],
    }
    let mut ans =0 ;
    for i in 0..n{
        if an[i] <= bn[i]{
            ans += an[i];
            if an[i+1] >= (bn[i]-an[i]){
                ans += bn[i]-an[i];
                an[i+1] -= (bn[i]-an[i]);
            } else {
                ans += an[i+1];
                an[i+1] = 0;
            }
            an[i] = 0;
        } else {
            ans += bn[i];
        }
    }
    println!("{}",ans);
}


fn is_prime(x:i64) -> bool {
    if x == 2 {return true;}
    if x < 2 || x % 2 == 0 {return false;}
    let mut j = 3;
    while j <= (x as f64).sqrt() as i64 {
        if x % j == 0 {
            return false;
        }
        j += 2;
    }
    true
}


Measured memory_bytes: 6396
#include <iostream>
#include <cmath>
#include <cstdio>
#include <stack>
#include <queue>
#include <bits/stdc++.h>
typedef long long int ll;
using namespace std;

int main(){
    char n[4];
    ll ans=0;
    for(ll i=0;i<4;++i){
        cin>>n[i];
        if(n[i]=='2'){
            ans+=1;
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(void)
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);

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

  if(a<=9 && a>=1 && b<=9 && b>=1)
    cout<<a*b<<"\n";

  else
    cout<<-1<<"\n";

 
  return 0;
} 



Measured memory_bytes: 256
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i,n) for(int i=0, i##_len=(int)(n); i<i##_len; i++)
#define reps(i,n) for(int i=1 , i##_len=(int)(n);i<=i##_len;i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;i--)
#define rreps(i,n) for(int i=((int)(n));i>0;i--)
#define repi(i,x) for(auto i=(x).begin(),i##_fin=(x).end();i!=i##_fin;i++)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define solve(a) ((a)?"YES":"NO")
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef pair<int , int> Pi;
typedef vector<Pi> VPi;
typedef vector<long long> V;
typedef vector<V> VV;
typedef pair<long long , long long> P;
typedef vector<P> VP;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1;} return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1;} return 0;}
const long long INFLL = 1LL<<60;
const int INF = 1<<30;
const double PI=acos(-1);
int main(){
	string s;
	string ans="";
	cin >>s;
	reverse(all(s));
	vector<string> t;
	t.push_back("dreamer");
	t.push_back("dream");
	
	t.push_back("eraser");
	t.push_back("erase");
	
	rep(i,t.size()){
		reverse(all(t[i]));
	}
	bool cnt=false;
	int at=0;
	while(s.size()!=ans.size() ){
		cnt=false;
		rep(i,4){
			cnt=equal(all(t[i]),s.begin()+ans.size());
			if(cnt){
				ans+=t[i];
				at+=t[i].size();
				break;
			}
		}
		if(cnt==false){
			break;
		}
	}
	cout<<solve(cnt)<<endl;
	//cout<<ans<<endl;
}

Measured memory_bytes: 640
// Date: 2020-03-13

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

typedef long long LL;
typedef long double LD;
typedef vector<int> VI;
typedef pair<LL, LL> pll;
typedef pair<int, int> pii;
#define FIO ios::sync_with_stdio(false);cin.tie(0)
#define rep(i, a, b) for(int i = int(a); i <= int(b); ++i)
#define per(i, b, a) for(int i = int(b); i >= int(a); --i)
#define mem(x, y) memset(x, y, sizeof(x))
#define all(x) (x).begin(),(x).end()
#define mk make_pair
#define pb push_back
#define fi first
#define se second
const LL INF = 1e18;
const LL mod = 1e9 + 7;
const int inf = 0x3f3f3f3f;
const int N = 1e5 + 10;
template <typename T> void chkmax(T &x, T y) { x = max(x, y); }
template <typename T> void chkmin(T &x, T y) { x = min(x, y); }
LL qpow(LL x, LL y, LL MOD) {LL a=1; while(y){ if(y&1) a=a*x%MOD; x=x*x%MOD; y>>=1; } return a;}

int n, W;
LL w[N], v[N], dp[N];

int main() {
    cin >> n >> W;
    int sum = 0;
    rep(i, 1, n) cin >> w[i] >> v[i], sum += v[i];
    mem(dp, 0x3f);
    dp[0] = 0;
    rep(i, 1, n) per(j, sum, v[i]) chkmin(dp[j], dp[j-v[i]] + w[i]);
    per(j, sum, 0) {
        if(dp[j] <= W) {
            cout << j;
            break;
        }
    }

    return 0;
}

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

//repetition
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)

//container util
#define all(x) (x).begin(),(x).end()

//typedef
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VLL;
typedef vector<VLL> VVLL;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;

//const value
//const ll MOD = 1e9 + 7;
//const int dx[] = {0,1,0,-1};//{0,0,1,1,1,-1,-1,-1};
//const int dy[] = {1,0,-1,0};//{1,-1,0,1,-1,0,1,-1};

//conversion
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
inline ll toLL(string s) {ll v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

int n,m;
vector<PII> edge[55];
ll used[55];
bool dfs(int mid, int now, int goal, int prev = -1){
  if(now == goal) return true;
  for(auto x :edge[now]){
    int next = x.first;
    if(next == prev) continue;
    if(dfs(mid,next,goal,now)){
      used[mid] |= 1LL<<x.second;
      return true;
    }
  }
  return false;
}

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  
  cin >> n ;
  rep(i,n-1) {
    int a,b;
    cin >> a >> b; a--,b--;
    edge[a].push_back(PII(b,i));
    edge[b].push_back(PII(a,i));
  }

  cin >> m;
  rep(i,m){
    int a,b;
    cin >> a >> b; a--,b--;
    dfs(i,a,b);
  }
  ll ans = 1LL<<(n-1);
  // cout << ans << endl;
  FOR(bit,1,(1LL<<m)){
    ll sum = 0;
    ll bitCnt = 0;
    rep(mid,m){
      if(((bit>>mid) & 1) == 1) {
        sum |= used[mid];
        bitCnt ++;
      }
    }
    
    ll cnt = n-1;
    cnt -= __builtin_popcountll(sum);
    
    if( bitCnt % 2 == 0) ans += 1LL<<cnt;
    else ans -= 1LL<<cnt;
  }

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


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

int main() {
  int N;
  cin >> N; 
  double ans = 1;
  
  if (N % 2 == 0) {
    ans = (double) 1 /  (double)2;
  }
  else {
    ans = (double)(N + 1) /(double) (N * 2);
  }
    cout << ans << endl;
  
}










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

typedef long long ll;
typedef int64_t i6;
typedef std::vector<std::vector<int64_t> > Graph;

#define rep(i, n) for (int64_t i = 0; i < n; ++i)
#define rep2(i, n) for (int64_t i = 1; i <= n; ++i)
#define repb(i, l, n) for (int64_t i = l; i < n; ++i)
#define repb2(i, l, n) for (int64_t i = l; i <= n; ++i)
#define repe(a, b) for (auto&(a) : (b))
#define ALL(v) (v).begin(), (v).end()
#define Sort(x) sort(ALL(x))
#define Sort_rev(x) Sort(x);reverse(ALL(x))
#define mp(a, b) make_pair((a), (b))
#define Push_back(a, b) push_back( mp( (a), (b) ) )

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1;  } return 0;  }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1;  } return 0;  }
template<typename V,typename T> bool find_num(V v, T num) { if ( find(ALL(v), num) == v.end() ) { return false; } return true; }

const int inf = 0x3fffffff;
const int64_t INF = 0x3fffffffffffffff;
const int64_t MOD = 1e9+7;

int main() {
    int64_t a, b, c, d;
    cin >> a >> b >> c >> d;
    int64_t ac = a*c;
    int64_t ad = a*d;
    int64_t bc = b*c;
    int64_t bd = b*d;
    cout << max(max(ac, ad), max(bc, bd)) << endl;
    return 0;
}


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

using namespace std;
typedef long long ll;
typedef pair<int,int> P;

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

	int ans = false;
	int cnt = 1;
	char c,p; cin >> p;

	for (int i = 0;i < 3;i++){
		cin >> c;
		if(c == p) cnt++;
		else cnt = 1;
		if(cnt == 3) ans = true;
		p = c;
	}

	cout << (ans?"Yes":"No") << endl;

	return 0;

}


Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<numeric>
#include<algorithm>
#include<vector>
#include<queue>
#include <iostream>
using namespace std;


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

int N,W,v[101],w[101],dp[101][10001];

int main(){
  cin>>N>>W;
  REP(i,1,N+1)cin >>v[i]>>w[i];
  REP(j,0,W+1)dp[0][j]=0;
  REP(i,1,N+1) REP(j,1,W+1){
    if(j-w[i]<0)dp[i][j] = dp[i-1][j];
    else dp[i][j] = max(dp[i-1][j],dp[i-1][j-w[i]]+v[i]);
  }
  cout << dp[N][W] << endl;

  return 0;
}



Measured memory_bytes: 7016
#include <bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin>>s;
  sort(s.begin(),s.end());
  if(s[0]==s[1] && s[1]!=s[2] && s[2]==s[3]){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
}


Measured memory_bytes: 256
using System;

namespace B
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] instr = Console.ReadLine().Split(' ');
            int a = int.Parse(instr[0]);
            int b = int.Parse(instr[1]);

            int ab = 0;
            int ba = 0;


            for(int i = 0; i < b; i++){
                ab = ab + a * (int)Math.Pow(10, i);
            }

            for(int i = 0; i < a; i++){
                ba = ba + b * (int)Math.Pow(10, i);
            }

            if(ab > ba){
                Console.WriteLine(ab);
            }else{
                Console.WriteLine(ba);
            }
        }
    }
}


Measured memory_bytes: 11092
N = int(input())
H = list(map(int, input().split()))

preValue, count, Maxcount = H[0], 0, 0
for h in H[1:]:
    #print(preValue, h, count)
    if preValue >= h:
        count += 1
    else:
        count = 0
    Maxcount = max(Maxcount, count)
    preValue = h

print(Maxcount)

Measured memory_bytes: 14224
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <queue>
#include <map>
using namespace std;
typedef long long ll;
const int INF = 1<<30; 
const int MOD = 1e9 + 7;
const int dy[] = {1, 0, -1, 0};
const int dx[] = {0, 1, 0, -1};
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    while(cin >> n, n)
    {
        int A = 0, B = 0;
        for(int i = 0; i < n; i++)
        {
            int a, b;
            cin >> a >> b;
            if(a == b)
            {
                A += a;
                B += b;
            }
            else if(a > b)
            {
                A += a + b;
            }
            else
            {
                B += a + b;
            }
        }
        cout << A << " " << B << endl;
    }
    return 0;
}


Measured memory_bytes: 3124
#include<iostream>
#include<stdio.h>
using namespace std;
int main(){
	long long a,b,c,k;
	scanf("%lld%lld%lld%lld",&a,&b,&c,&k);
	if(k%2==0) printf("%lld",a-b);
	else printf("%lld",b-a);
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
using namespace std;
//FILE *fi = freopen("1.txt", "r", stdin);
//FILE *fo = freopen("1", "w", stdout);
int n, m;
int k;
long long a[3011][3011];
long long dp[3011][3011][5];
int main()
{
    //------------------------------
    // Faster
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    //-------------------------------
    cin >> n >> m >> k;
    for (int i = 1; i <= k; i++)
    {
        int u, v;
        long long x;
        cin >> u >> v >> x;
        a[u][v] = x;
    }
    for (int i = 1; i <= n; i++)
    {
        for (int j = 1; j <= m; j++)
        {
            if (a[i][j])
            {
                for (int k = 0; k <= 3; k++)
                    dp[i][j][1] = max(dp[i - 1][j][k] + a[i][j], dp[i][j][1]);
                for (int k = 1; k <= 3; k++)
                {
                    dp[i][j][k] = max(dp[i][j][k], dp[i][j - 1][k - 1] + a[i][j]);
                }
            }
            for (int k = 0; k <= 3; k++)
            {
                dp[i][j][0] = max(dp[i - 1][j][k], dp[i][j][0]);
            }
            for (int k = 1; k <= 3; k++)
            {
                dp[i][j][k] = max(dp[i][j - 1][k], dp[i][j][k]);
            }
        }
    }
    long long res = 0;
    for (int i = 0; i <= 3; i++)
        res = max(res, dp[n][m][i]);
    cout << res;
    return 0;
}

Measured memory_bytes: 426916
import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for _ in range(N)]
def dp2(ini, i, j): return [[ini]*i for _ in range(j)]
def dp3(ini, i, j, k): return [[[ini]*i for _ in range(j)] for _ in range(k)]
#import bisect #bisect.bisect_left(B, a)
from collections import defaultdict #d = defaultdict(int) d[key] += value
#from itertools import accumulate #list(accumulate(A))

A, B = mi()
if A%2 and B%2:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 3316
def main():
    n=int(input())
    a=list(map(int,input().split()))
    ans=0
    temp=0
    MOD=10**9+7
    cnt1=[0]*60
    for num in a:
        for i in range(60):
            cnt1[i] += (num >> i) & 1
    for i in range(60):
        ans += cnt1[i] * (n - cnt1[i]) * pow(2,i,MOD)
    print(ans % MOD)


if __name__=='__main__':
    main()


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

#include <vector>
#include <cctype>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <string>
#include <map>
#include <climits>

using namespace std;

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

	int count=0;
	int ans = 0;

	for (int i = 100; i > 0; i--) {
		if (a % i == 0 && b % i == 0)count++;

		if (count == k) {
			ans = i;
			break;
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3592
#include<bits/stdc++.h>
    using namespace std;
    # define LL long long
    # define int long long
    #define gok ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    # define mo 998244353
    # define pi acos(-1)
    //vector<pair<int,int>> v;
    //int x0=INT_MAX,y0=INT_MAX;
    /*int crossprod(pair<int,int> a,pair<int,int> b,pair<int,int> c)
    {
        int x1 = a.first-b.first;
        int x2 = a.first-c.first;
        int y1 = a.second-b.second;
        int y2 = a.second-c.second;
        return x1*y2 - y1*x2;
    }
    int direction(pair<int,int> a,pair<int,int> b,pair<int,int> c) {
       int val = (b.y-a.y)*(c.x-b.x)-(b.x-a.x)*(c.y-b.y);
       if (val == 0)
          return 0;     //colinear
       else if(val < 0)
          return 2;    //anti-clockwise direction
          return 1;    //clockwise direction
    }*/
   int a[11][1005];
   int tmp[11],per[11];
    signed main(){
        gok

     int r,c,kk;
     cin>>r>>c>>kk;
     for(int i=0;i<r;i++){
            string s;
     cin>>s;
        for(int j=0;j<c;j++){
        a[i][j] = s[j]-'0';
        }
     }
    int an=INT_MAX;
    for(int i=0;i<(1<<r)-1;i++)
    {
        int tt = __builtin_popcount(i);
        memset(per,0,sizeof(per));
        bool ch=false;
        for(int j=0;j<c;j++)
        {
            memset(tmp,0,sizeof(tmp));
            int id=0;

            for(int k=0;k<r;k++)
            {
                tmp[id] += a[k][j];
                if(tmp[id]>kk){
                    ch=true;
                 break;
                }
                if((i>>k)&1)
                    id++;
            }
            if(ch)
                break;
             int ma=0;
             for(int k=0;k<r;k++)
             {
                 if(per[k]+tmp[k]>kk)
                 {
                     ma=1;
                     break;
                 }
             }
             tt += ma;
            for(int k=0;k<r;k++)
            {
                if(!ma)
                {
                    per[k]+=tmp[k];
                }
                else
                {
                    per[k]=tmp[k];
                }
            }
        }
        if(!ch)
            an = min(an,tt);
    }
   cout<<an;















        return 0;
    }


Measured memory_bytes: 384