akhauriyash/Code-Regression huggingface dataset:
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author aryssoncf
 */



// Taken from: https://github.com/bqi343/USACO/blob/master/Implementations/content/contest/templateShort.cpp

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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ull> vul;
typedef vector<ll> vl;
typedef vector<pii> vpii;

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)
#define trav(a,x) for (auto& a: x)

#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define rsz resize

#define mp make_pair
#define pb push_back
#define f first
#define s second

const int MOD = 1e9+7; // 998244353; // = (119<<23)+1
const int MX = 2e5+5;

template<class T> bool ckmin(T& a, const T& b) {
    return a > b ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) {
    return a < b ? a = b, 1 : 0; }

mt19937 rng((uint32_t)chrono::steady_clock::now().time_since_epoch().count());


//
// Created by aryssoncf on 28/10/2019.
//

#include <type_traits>


#include <iterator>
#include <utility>

template <typename T>
constexpr auto hasBegin(int) -> decltype(std::begin(std::declval<T>()), true) {
    return true;
}

constexpr bool hasBegin(...) {
    return false;
}

template <typename T>
using IsContainer = std::integral_constant<bool, hasBegin<T>(0)>;


#ifndef JHELPER_EXAMPLE_PROJECT_IO_HPP
#define JHELPER_EXAMPLE_PROJECT_IO_HPP

#endif //JHELPER_EXAMPLE_PROJECT_IO_HPP

template<typename T>
std::istream &operator>>(std::istream &is, std::vector<T> &vec) {
    for (T &element: vec) {
        is >> element;
    }
    return is;
}

template<typename T, typename U>
std::istream &operator>>(std::istream &is, std::pair<T, U> &p) {
    is >> p.first;
    is >> p.second;
    return is;
}

template <class X, class Y>
std::ostream & operator << (std::ostream & os, std::pair <X, Y> const& p) {
    return os << p.first << " " << p.second;
}

template <class Ch, class Tr, class Container>
std::basic_ostream <Ch, Tr> & operator << (std::basic_ostream <Ch, Tr>& os, Container const& x) {
    bool first = true;
    for(auto& y : x) {
        if (first) {
            first = false;
        } else {
            os << " ";
        }
        os << y;
    }
    return os;
}

using namespace std;

class CFiveTransportations {
public:
	void solve(std::istream& in, std::ostream& out) {
        ll n;
        in >> n;
        vl cap(5);
        in >> cap;
        ll c = *min_element(all(cap));
        ll res = 4 + (n + c - 1) / c;
        out << res << '\n';
	}

	void setup() {}
};


int main() {
    std::ios_base::sync_with_stdio(false);
	CFiveTransportations solver;
    solver.setup();
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	in.tie(nullptr);
    out << std::fixed;
    out.precision(20);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 3564
#include<bits/stdc++.h>
using namespace std;
const int N=19,MAX=1e9;
int a[1<<N];
struct Treap
{
	struct Node
	{
		int key;
		int pr;
		int ma;
		int sz;
		int br;
		Node *l;
		Node *r;
		Node(int kkey)
		{
			key=kkey;
			pr=rand();
			ma=kkey;
			l=r=NULL;
			sz=1;
			br=1;
		}
		void con()//Keeps everything updated during splits and merges
		{
			ma=key;
			sz=br;
			if(l)
			{
				ma=max(ma,l->ma);
				sz+=l->sz;
			}
			if(r)
			{
				ma=max(ma,r->ma);
				sz+=r->sz;
			}
		}
		void output()//Outputs the keys in the treap in ascending order
		{
			if(l)l->output();
			cout<<key<<endl;
			if(r)r->output();
		}
	};
	Node *node;
	Treap()
	{
		node=NULL;
	}
	void split(Node *T,Node *&L,Node *&R,int key)//splits T into L and R where all the keys of L are <=key and all the keys of R are >key
	{
		if(!T)
		{
			L=R=NULL;
			return;
		}
		if(T->key <= key)
		{
			L=T;
			split(T->r,L->r,R,key);
		}
		else
		{
			R=T;
			split(T->l,L,R->l,key);
		}
		T->con();
	}
	void split_sz(Node *T,Node *&L,Node *&R,int x)//splits T into L and R where L contains the first x elemets ot T and R has everything else
	{
		if(!T)
		{
			L=R=NULL;
			return;
		}
		int size=1;
		if(T->l)size+=T->l->sz;
		if(size <= x)
		{
			L=T;
			split_sz(T->r,L->r,R,x-size);
		}
		else
		{
			R=T;
			split_sz(T->l,L,R->l,x);
		}
		T->con();
	}
	void merge(Node *&T,Node *L,Node *R)//merges L and R into T where all keys of L are <= of all keys in R
	{
		if(!L)
		{
			T=R;
			return;
		}
		if(!R)
		{
			T=L;
			return;
		}
		if(L->pr > R->pr)
		{
			T=L;
			merge(T->r,L->r,R);
		}
		else
		{
			T=R;
			merge(T->l,L,R->l);
		}
		T->con();
	}
	void insert(int key)//inserts an element into the treap
	{
		Node *L,*MID,*R;
		split(node,L,R,key);
		split(L,L,MID,key-1);
		if(MID)
		{
			MID->br+=1;
			MID->sz+=1;
		}
		else MID=new Node(key);
		merge(L,L,MID);
		merge(node,L,R);
	}
	void erase(int x)
	{
		Node *L,*MID,*R;
		split(node,L,R,x);
		split(L,L,MID,x-1);
		MID->br--;
		if(MID->br!=0)merge(L,L,MID);
		merge(node,L,R);
	}
	int query(int x)//answer the qurty how many numbers <=x are in the trap
	{
		Node *L,*R;
		split(node,L,R,x-1);
		int ans=-1;
		if(L)ans=L->ma;
		merge(node,L,R);
		return ans;
	}
}T;
int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n,b,i,j;
	cin>>n;
	for(i=0;i<(1<<n);i++)
	{
		cin>>b;
		T.insert(b);
	}
	int m=1;
	a[0]=T.query(MAX+1);
	T.erase(a[0]);
	for(i=0;i<n;i++)
	{
		for(j=0;j<m;j++)
		{
			a[j+m]=T.query(a[j]);
			if(a[j+m]==-1)
			{
				cout<<"No\n";
				return 0;
			}
			T.erase(a[j+m]);
		}
		m*=2;
	}
	cout<<"Yes\n";
}


Measured memory_bytes: 13568
n, m, x, y = map(int, input().split())
x_cities = list(map(int, input().split()))
y_cities = list(map(int, input().split()))

flag = True

# condition 1
z_list = None
if x < y:
  z_list = range(x+1, y+1)
else:
  flag = False

# condition 2
x_cities.sort()
y_cities.sort()

for z in z_list:
  if x_cities[-1] < z <= y_cities[0]:
    break
else:
  flag = False
  
if flag == True:
  print('No War')
else:
  print('War')

Measured memory_bytes: 3064
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

from collections import deque

N,M = map(int,readline().split())
if M == 0:
    print(-1)
    exit()
m = map(int,read().split())
P,Q,C = zip(*zip(m,m,m))

V = []
V += [p<<32 for p in range(1,N+1)]
V += [(p<<32)+c for p,c in zip(P,C)]
V += [(q<<32)+c for q,c in zip(Q,C)]
V = set(V)
label = {x:i for i,x in enumerate(V)}
start = label[1<<32]
goal = label[N<<32]

N = len(V)
graph = [[] for _ in range(N)]
for p,q,c in zip(P,Q,C):
    v0 = label[p<<32]; v1 = label[(p<<32)+c]
    w0 = label[q<<32]; w1 = label[(q<<32)+c]
    graph[v0].append((v1,1))
    graph[w0].append((w1,1))
    graph[v1].append((v0,0))
    graph[w1].append((w0,0))
    graph[v1].append((w1,0))
    graph[w1].append((v1,0))

INF = 10 ** 10
dist = [INF] * N
dist[start] = 0
q = deque([start])
ar = q.append; al = q.appendleft
pl = q.popleft
while q:
    v = pl()
    for w,cost in graph[v]:
        dw = dist[v] + cost
        if dw >= dist[w]:
            continue
        dist[w] = dw
        if not cost:
            al(w)
        else:
            ar(w)

answer = dist[goal]
if answer == INF:
    answer = -1
print(answer)

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

//BEGIN CUT HERE
struct UnionFind{
  int num;//連結成分の数
  vector<int> r,p;//そのグループのサイズ,自分の親っぽいやつ
  UnionFind(){}
  UnionFind(int n):num(n),r(n,1),p(n,0){iota(p.begin(),p.end(),0);}

  int find(int x){//どのグループに所属するか
    return (x==p[x]?x:p[x]=find(p[x]));//xがグループの名前と一致するまでxを親にする
  }

  bool same(int x,int y){//同じグループかどうか
    return find(x)==find(y);
  }

  void unite(int x,int y){//xとyを同じグループにする
    x=find(x);y=find(y);//xとyのグループの名前をどっちかが変える
    if(x==y) return;
    if(r[x]<r[y]) swap(x,y);//サイズが大きい方をxとする
    r[x]+=r[y];//yの親をxにする（今までyだったグループ名がxになる）
    p[y]=x;
    num--;
  }

  int size(int x){//グループの大きさ
    return r[find(x)];
  }

  int count() const{//グループの数
    return num;
  }
};
  //END CUT HERE

signed main(){
  int n,q;cin>>n>>q;
  UnionFind uf(n);
  while(q--){
    int t,u,v;cin>>t>>u>>v;
    if(t)cout<<uf.same(u,v)<<endl;
    else uf.unite(u,v);
  }
}


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

using namespace std;

int main() {
	int N;
	cin >> N;
	vector<int> a(N);
	for (int i = 0; i < N;i++)
	{
		cin >> a[i];
	}

	sort(a.begin(),a.end());

	cout << a[N-1] - a[0] << endl;
}

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

int main(){
	string O;
	string E;
	cin >> O >> E;
	string text = "";
	for(int i = 0; i < E.size(); i++){
		text.push_back(O[i]);
		text.push_back(E[i]);
	}
	if(O.size() - E.size() == 1){
		text.push_back(O.back());
	}
	cout << text << endl;
}

Measured memory_bytes: 256
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))


for i in range(n-1):
    if(a[i+1] - a[i] == 1 ):
        b.append(c[a[i]-1])
print(sum(b))


Measured memory_bytes: 3060
/*
Writer: SPD_9X2
https://atcoder.jp/contests/abc136/tasks/abc136_f

やっぱりある点基準に寄与を考える？
長方形を決めるのは最小2点、最大4点

では、逆に含まないのを考える？

0 1
 X
3 2

ある点を中心に,4つの象限に分ける
この時、Xが含まれないのは、差が2(mod4)の範囲に含まれる点が同時に存在しないこと
よって、

(2^N-1) - (0,1内のみ点からなる部分集合) - (1,2)-(2,3)-(3,0) + (0のみから～)+(1)+(2)+(3)
となる (0この場合は毎回ちゃんと取り除いておく)

よって、座圧して2次元累積和を用いれば、O(N)で解ける??
2次元累積和、使えなくね

その点より上下左右にある数、ならO(N)でわかる
→問題は上式の+ (0のみから～)+(1)+(2)+(3)の部分

左上の数を方程式で解ける？
→むりぽ

上と左の点をbitsetでもっておいてand演算？　→　できなくはないけど速くなるか…？

======答えを見る======
BITを持っておき、xが小さい方から見ていく
y座標に関して座圧して置き既にみたBITと、まだ見てないBITを持っておけば、
log(N)で第1象限にある点の数を計算できる
→片方の軸基準で考えるのは典型か…(2D Plane 2N Pointsっぽい)

*/


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

#define rep(i,n,m) for(ll (i)=(n);(i)<(m);(i)++)
#define rrep(i,n,m) for(ll (i)=(n);(i)>(m);(i)--)
using ll = long long;
const ll mod = 998244353;

void bitadd(ll a,ll w, vector<ll>& bit){

    ll x = a;
    if (a == 0){
        exit(1);
    }
    while (x <= (bit.size()-1)){
        bit[x] += w;
        x += (x & (-x));
    }

    return;
}

ll bitsum(ll a,vector<ll>& bit){

    ll ret = 0;
    ll x = a;
    if (a == 0){
        exit(1);
    }
    while (x > 0){
        ret += bit[x];
        x -= (x & (-x));
    }

    return ret;
}

int main(){

    ll N;
    cin >> N;

    vector<vector<ll>> xyi(N,vector<ll>(3,0));
    vector<vector<ll>> yi (N,vector<ll>(2,0));

    rep(i,0,N){

        ll x,y;
        cin >> x >> y;

        xyi[i][0] = x;
        xyi[i][1] = y;
        xyi[i][2] = i;
        yi[i][0] = y;
        yi[i][1] = i;

    }

    sort(xyi.begin(),xyi.end());
    sort(yi.begin(),yi.end());

    vector<ll> i_to_psy(N,0);
    rep(j,0,N){
        i_to_psy[yi[j][1]] = j+1;
    }

    vector<ll> YetBIT(N+1,0);
    vector<ll> AftBIT(N+1,0);
    
    vector<ll> powlis(N+10,1);
    rep(i,1,N+10){
        powlis[i] = powlis[i-1] * 2 % mod;
    }

    ll ans = (powlis[N]-1) * N % mod;

    rep(i,0,N){
        bitadd(i+1,1,YetBIT);
    }

    rep(loop,0,N){

        ll x = xyi[loop][0];
        ll y = xyi[loop][1];
        ll ind = xyi[loop][2];

        ll psy = i_to_psy[ind];

        bitadd(psy,-1,YetBIT);

        ll L = N - loop - 1;
        ll R = loop;
        ll ul = bitsum(psy,YetBIT);
        ll ur = bitsum(psy,AftBIT);

        ll U = ul+ur;
        ll D = N-U-1;

        ll dl = L - ul;
        ll dr = R - ur;

        ll now = ((powlis[ul]+powlis[ur]+powlis[dl]+powlis[dr]-4) - (powlis[U]+powlis[D]+powlis[L]+powlis[R]-4));
        now %= mod;
        ans += now;
        ans %= mod;

        bitadd(psy,1,AftBIT);
    }

    while (ans < 0){
        ans += mod;
    }

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

Measured memory_bytes: 28416
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define erep(i, n) for (ll i = 0; i <= (ll)(n); ++i)
#define FOR(i,a,b) for (ll i = (a); i < (ll)(b); ++i)
#define EFOR(i,a,b) for (ll i = (a); i <= (ll)(b); ++i)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } }

#include <iostream>
#include <vector>
#include <queue>
using namespace std;
using Graph = vector<vector<int>>;
using P = pair<int, int>;

ll modnum = 1000000007;


long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}



int main() {
    ll k,n; cin >> k >> n;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];

    ll sum = a[0] + (k-a[n-1]);
    FOR(i,1, n) {
        sum += a[i] - a[i-1];
    }
    ll ans = sum - (a[0] + (k-a[n-1]));
    FOR(i,1, n) {
        chmin(ans, sum-(a[i] - a[i-1]));
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1920
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
#define pb push_back
#define mod 1000000007
#define inf 10000000007
#define ff first
#define ss second
#define endl "\n"
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

int main()
{
    IOS
    string s;
    cin>>s;
    for(int i=0;i<s.size();i++)
    {
    	if(s[i] == '1') cout<<"9";
    	else if(s[i]=='9') cout<<"1";
    	else cout<<s[i];
    }
    return 0;

}


Measured memory_bytes: 256
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inpl(): return list(map(int, input().split()))
def inpl_str(): return list(input().split())

N,L = inpl()
ans = 0
MIN = INF
for i in range(N):
    x = L + i
    ans += x

if L >= 0:
    print(ans-L)
else:
    if abs(L) < N:
        print(ans)
    else:
        print(ans-x)


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


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

  if(abs(A-B)%2==1){
        cout<<"IMPOSSIBLE"<<endl;
  }else{
    P=(A+B)/2;
    cout<<P<<endl;
  }

}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<iterator>

using namespace std;

long long solve(int N,int K,int b){
    long long ret=0;
    int quo = N/b;
    int N_Prime=quo*b;
    ret=(long long)(quo-1)*(b-K)+max(0,N-N_Prime-K+1);
    return ret;
}

int main(){
    int N,K;
    cin>>N>>K;
    if(K==0){
        long long ans = (long long)N*N;
        cout<<ans<<endl;
        return 0;
    }
    long long ans=(long long)(N-K+1)*(N-K)/2;//K <= a < bのケースはあらかじめ勘定
    for(int b=K+1;b<=N-K;b++){//a > b > Kの場合を勘定
        ans += solve(N,K,b);
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int k = sc.nextInt();
        int s = sc.nextInt();
        if (3*k < s) {
            System.out.println(0);
        } else if (3*k == s) {
            System.out.println(1);
        } else {
            int count = 0;
           for (int x = 0; x <= k; x++) {
               for (int y = 0; y <= k; y++) {
                   if (s - (x + y) <= k && s - (x + y) >= 0) count++;
               }
           }
           System.out.println(count);
        }
    }
}


Measured memory_bytes: 9684
#include<bits/stdc++.h>
using namespace std;
int n[2],m[2];
vector<string> bo[2];
vector<vector<int> > adj[2];
int main(){
  for(int i=0;i<2;++i){
    cin >> n[i] >> m[i];
    bo[i].resize(n[i]);
    for(int j=0;j<n[i];++j)
      cin >> bo[i][j];
    adj[i].assign(n[i],vector<int>());
    for(int j=0;j<m[i];++j){
      int a,b;
      cin >> a >> b;
      adj[i][a-1].push_back(b-1);
    }
  }
  int pt[128][128];
  for(int i=0;i<n[0];++i)
    for(int j=0;j<n[1];++j)
      pt[i][j]=0;
  stack<tuple<int,int,int> > q;
  for(int i=0;i<n[0];++i)
    for(int j=0;j<n[1];++j)
      q.push(make_tuple(i,j,0));
  int answer=0;
  while(!q.empty()){
    int aki,maki,p;
    tie(aki,maki,p)=q.top();
    q.pop();
    if(p>100){
      cout << -1 << endl;
      return 0;
    }
    if(bo[0][aki]==bo[1][maki]){
      ++p;
      answer=max(answer,p);
      if(p<=pt[aki][maki])
  continue;
      pt[aki][maki]=p;
      for(int i=0;i<adj[0][aki].size();++i)
  for(int j=0;j<adj[1][maki].size();++j)
    q.push(make_tuple(adj[0][aki][i],adj[1][maki][j],p));
    }
    else{
      if(p<=pt[aki][maki])
  continue;
      pt[aki][maki]=p;
      for(int i=0;i<adj[0][aki].size();++i)
  q.push(make_tuple(adj[0][aki][i],maki,p));
      for(int j=0;j<adj[1][maki].size();++j)
  q.push(make_tuple(aki,adj[1][maki][j],p));
    }
  }
  cout << answer << endl;
  return 0;
}

Measured memory_bytes: 11616
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (int i = a; i < b; i++)
#define all(v) v.begin(), v.end()
#define mod 1000000007
//'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122

int main() {
    int n;
    cin >> n;
    string s;
    cin >> s;
    int r = 0;
    rep(i, 0, n) {
        if (s[i] == 'R') r++;
    }

    int b = n - r;
    if (r > b) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
fn read_line() -> String {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s
}

fn read<T: std::str::FromStr>() -> T where T::Err: std::fmt::Debug {
    read_line().trim().parse().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T>
where T::Err: std::fmt::Debug {
    read_line().split_whitespace().map(|s| s.parse().unwrap()).collect()
}

fn read2<T1: std::str::FromStr, T2: std::str::FromStr>() -> (T1, T2)
where T1::Err: std::fmt::Debug, T2::Err: std::fmt::Debug {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    let mut splitted = s.split_whitespace();
    let v1: T1 = splitted.next().unwrap().parse().unwrap();
    let v2: T2 = splitted.next().unwrap().parse().unwrap();
    (v1, v2)
}

fn read3<T1: std::str::FromStr, T2: std::str::FromStr, T3: std::str::FromStr>() -> (T1, T2, T3)
where T1::Err: std::fmt::Debug, T2::Err: std::fmt::Debug, T3::Err: std::fmt::Debug {
    let line = read_line();
    let mut splitted = line.split_whitespace();
    let v1: T1 = splitted.next().unwrap().parse().unwrap();
    let v2: T2 = splitted.next().unwrap().parse().unwrap();
    let v3: T3 = splitted.next().unwrap().parse().unwrap();
    (v1, v2, v3)
}

fn main() {
    let (h, w): (usize, usize)  = read2();
    let mut masu: Vec<Vec<char>> = (0..h).map(|_| read::<String>().chars().collect()).collect();

    for i in 0..h {
        for j in 0..w {
            let c = masu[i][j];
            if c == '#' {
                print!("{}", c);
                continue;
            }

            let num = calc(i, j, &masu);
            print!("{}", num);
        }
        println!();
    }
}

fn calc(i: usize, j: usize, masu: &Vec<Vec<char>>) -> i32 {
    let mut count = 0;
    let min_i = if i == 0 {0} else {i-1};
    let max_i = if i + 1 >= masu.len() {i} else {i + 1};
    let min_j = if j == 0 {0} else {j-1};
    let max_j = if j + 1 >= masu[0].len() {j} else {j + 1};
    for n in min_i..(max_i+1) {
        for m in min_j..(max_j+1) {
            if masu[n][m] == '#' {
                count += 1;
            }
        }
    }
    return count;
}

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



int main(){

  int n; 
  char str[100];
  stack<int> s;

  while(scanf("%s",str) != EOF){

    int a, b;

    if(str[0] == '*'){
      a = s.top();
      s.pop();
      b = s.top();
      s.pop();
      s.push(a*b);
    }else if(str[0] == '/'){
      a = s.top();
      s.pop();
      b = s.top();
      s.pop();
      s.push(b/a);
    }else if(str[0] == '+'){
      a = s.top();
      s.pop();
      b = s.top();
      s.pop();
      s.push(a+b);
    }else if(str[0] == '-'){
      a = s.top();
      s.pop();
      b = s.top();
      s.pop();
      // int ans = a - b;
      //cout << a << b << a-b;
      s.push(b-a);
    }else s.push(atoi(str));
    //cout << s.top() << endl;
  }

  cout << s.top() << endl;
  

  return 0;
}

Measured memory_bytes: 1208
/*
ACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACAC
CACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACA
ACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACAC
CACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACA
ACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACAC
CACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACA
ACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACAC
CACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACA
*/

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <array>
#include <tuple>
#include <random>

#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)

#define all(x) (x).begin(), (x).end()

using namespace std;
typedef long long int ll;

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

    if(n == 1) {
        cout << 1 <<endl;
    return 0;
    }
    int a[7]={2, 4, 8, 16, 32, 64, 128};
    for(int i = 6; i >= 0; i--){
        if(n >= a[i]) {
            c = i;
            break;
        }
    }
    cout << a[c] <<endl;
}


Measured memory_bytes: 256
/**
 * Created by hiramekun at 20:10 on 2019-11-16.
 */
#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using vl = vector<ll>;
using vvl = vector<vl>;
using vb = vector<bool>;
using P = pair<ll, ll>;
template<typename T> using pq = priority_queue<T>;
template<typename T> using minpq = priority_queue<T, vector<T>, greater<T>>;
template<typename T, typename K> using ump = unordered_map<T, K>;
const ll dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll mod = 1000000007;
const ll inf = ll(1e9);
const ll e5 = ll(1e5);
const ll ll_inf = ll(1e9) * ll(1e9);

#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(ll i = ll(n - 1); i >= 0; i--)
#define each(i, mp) for(auto& i:mp)
#define eb emplace_back
#define F first
#define S second
#define all(obj) (obj).begin(), (obj).end()

template<class T>
ostream &operator<<(ostream &out, const vector<T> &list) {
    ll n = list.size();
    rep(i, n) out << list[i] << ' ';
    return out;
}

template<class T>
istream &operator>>(istream &in, vector<T> &list) {
    ll n = list.size();
    rep(i, n) in >> list[i];
    return in;
}

template<class T>
ostream &operator<<(ostream &out, const vector<vector<T>> &list) {
    ll n = list.size();
    rep(i, n) out << list[i] << '\n';
    return out;
}

/* ------------- ANSWER ------------- */
/* ---------------------------------- */

void solve() {
    ll r;
    cin >> r;
    cout << r * r << '\n';
}

int main() {
#ifdef MY_DEBUG
    while (true) {
#endif
        solve();
#ifdef MY_DEBUG
    }
#endif
    return 0;
}

Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

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

print(ans)

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

int main() { 	
 int A,C,D,E,F,G;
 string B;
 cin >>A>>C;
     E=0;
     for(int i=0;i<A;i++){
         cin >>D;
         if(D>=C){
             E++;
         }

     }
        cout <<E<<endl; 
    
 
}

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

#define rep(i,l,r) for(int i=(l);i<(r);i++)
#define pb push_back
#define fi first
#define se second

using ll = long long;
using G = vector<vector<int>>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const ll MOD = 1000000007;

ll GCD(ll x, ll y){
	return y ? GCD(y, x%y) : x;	
}

int main() {
	int n; cin >> n;
	int s[105];
	int sum = 0;
	rep(i, 0, n){
		cin >> s[i];
		sum += s[i];
	}
	sort(s, s+n);
	if(sum%10!=0){
		cout << sum << endl;
		return 0;
	}
	rep(i, 0, n){
		if(s[i]%10!=0){
			cout << sum-s[i] << endl;
			return 0;
		}
	}
	cout << 0 << endl;
	return 0;
}

Measured memory_bytes: 3600
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <cstring>
#include <string>
#include <sstream>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <functional>
#include <bitset>
#include <deque>
#include <cmath>

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;

#define rep(i, a, b) for(int i = a; i <= b; ++i)
#define dow(i, a, b) for(int i = a; i >= b; --i)
#define mem(a) memset(a, 0, sizeof(a))
#define mst(a, b) memset(a, b, sizeof(a))
#define sfi(a) scanf("%d", &a)
#define sfl(a) scanf("%lld", &a)
#define sfd(a) scanf("%lf", &a)
#define sfs(a) scanf("%s", a)
#define pb(a) push_back(a)
#define sync ios::sync_with_stdio(0); cin.tie(0);

const int MAX = 1e2 + 5;
const int L = 2;
const LL MOD = 10000;
const int dir[MAX][MAX] = {{0,1},{0,-1},{1,0},{-1,0},{-1,-1},{-1,1},{1,1},{1,-1}};

const double EPS = 1e-8;
const double PI = acos(-1.0);

typedef struct Point Point;
typedef struct Line Line;

int cmp(double x);
double sqr(double x);
double det(Point a, Point b);
double dot(Point a, Point b);
double dist(Point a, Point b);
Point rotate_point(Point p, double A);
bool parallel(Line a, Line b);
bool orthogonal(Line a, Line b);
Point PointProjLine(Point p, Line l, Point &ans);

struct Point
{
	double x, y;
	Point() {}
	Point(double a, double b): x(a), y(b) {}

	friend Point operator -(Point a, Point b)
	{
		return Point(a.x-b.x,a.y-b.y);
	}
	friend Point operator +(Point a, Point b)
	{
		return Point(a.x+b.x,a.y+b.y);
	}
	friend bool operator ==(Point a, Point b)
	{
		return cmp(a.x-b.x)==0 && cmp(a.y-b.y)==0;
	}
	friend Point operator *(Point a, double b)
	{
		return Point(a.x*b,a.y*b);
	}
	friend Point operator *(double a, Point b)
	{
		return Point(a*b.x,a*b.y);
	}
	friend Point operator /(Point a, double b)
	{
		return Point(a.x/b,a.y/b);
	}
	double norm()
	{
		return sqrt(sqr(x)+sqr(y));
	}
};

struct Line
{
	Point a, b;
	Line() {}
	Line(Point x, Point y): a(x), b(y) {}
};

bool parallel(Line a, Line b)
{
	return !cmp(det(a.a-a.b,b.a-b.b));
}
	
bool orthogonal(Line a, Line b)
{
	return !cmp(dot(a.a - a.b, b.a - b.b));
}

Point PointProjLine(Point p, Line l)
{
	Point ans;
	double r = dot((l.b-l.a),(p-l.a))/dot(l.b-l.a,l.b-l.a);
	ans = l.a + r*(l.b-l.a);
	return ans;
}

int cmp(double x)
{
	if(abs(x) < EPS)
		return 0;
	if(x > 0)
		return 1;
	return -1;
}

double sqr(double x)
{
	return x * x;
}

double det(Point a, Point b)
{
	return a.x*b.y-a.y*b.x;
}

double dot(Point a, Point b)
{
	return a.x*b.x+a.y*b.y;
}
double dist(Point a, Point b)
{
	return (a-b).norm();
}

Point rotate_point(Point p, double A)
{
	double tx = p.x, ty = p.y;
	return Point(tx*cos(A)-ty*sin(A),tx*sin(A)+ty*cos(A));
}

int main()
{	
#ifdef LOCAL
	//~ freopen("in.txt", "r", stdin);
#endif

	Line a;
	scanf("%lf%lf%lf%lf", &a.a.x, &a.a.y, &a.b.x, &a.b.y);
	int q;
	sfi(q);
	while(q--)
	{
		Point p;
		scanf("%lf%lf", &p.x, &p.y);
		Point ans = PointProjLine(p, a);
		printf("%.8lf %.8lf\n", ans.x, ans.y);
	}
	return 0;
}



Measured memory_bytes: 3248
#include<cstdio>
#include<vector>
#include<queue>
#include<map>
#include<algorithm>
using namespace std;

int compress(vector<int> &xs,map<int,int> &x){
  sort(xs.begin(),xs.end());
  xs.erase(unique(xs.begin(),xs.end()),xs.end());
  for(int i=0;i<xs.size();i++){
    x[xs[i]] = i;
  }
  return xs.size() - 1;
}

bool solve(){
  int w,h,n,x1[1000],y1[1000],x2[1000],y2[1000];
  vector<int> xs,ys;
  map<int,int> x,y;
  static int field[2002][2002];
  scanf("%d %d",&w,&h);
  if(w==0&&h==0) return false;
  scanf("%d",&n);
  xs.push_back(0); ys.push_back(0);
  xs.push_back(w); ys.push_back(h);
  for(int i=0;i<n;i++){
    scanf("%d %d %d %d",x1+i,y1+i,x2+i,y2+i);
    xs.push_back(x1[i]); xs.push_back(x2[i]);
    ys.push_back(y1[i]); ys.push_back(y2[i]);
  }
  w = compress(xs,x);
  h = compress(ys,y);
  fill(field[0],field[0]+2002*2002,0);
  for(int i=0;i<n;i++){
    int xx1 = x[x1[i]], yy1 = y[y1[i]], xx2 = x[x2[i]], yy2 = y[y2[i]];
    field[xx1][yy1]++; field[xx2][yy2]++;
    field[xx1][yy2]--; field[xx2][yy1]--;
  }
  for(int i=1;i<=w;i++) for(int j=0;j<=h;j++) field[i][j] += field[i-1][j];
  for(int i=1;i<=h;i++) for(int j=0;j<=w;j++) field[j][i] += field[j][i-1];
  int ans = 0;
  int dx[] = {0,0,1,-1};
  int dy[] = {1,-1,0,0};
  for(int i=0;i<w;i++){
    for(int j=0;j<h;j++){
      if(field[i][j]==0){
        ans++;
        queue<pair<int,int> > q;
        q.push(make_pair(i,j));
        while(!q.empty()){
          pair<int,int> p = q.front(); q.pop();
          if(field[p.first][p.second]>0) continue;
          field[p.first][p.second] = 1;
          for(int k=0;k<4;k++){
            int nx = p.first + dx[k], ny = p.second + dy[k];
            if(nx<0||nx>=w||ny<0||ny>=h) continue;
            q.push(make_pair(nx,ny));
          }
        }
      }
    }
  }
  printf("%d\n",ans);
}

int main(){
  while(true) if(!solve()) return 0;
}

Measured memory_bytes: 18516
import sys
sys.setrecursionlimit(10000000)
N = int(input())
ab = [list(map(int, input().split())) for _ in range(N-1)]

path = [list() for _ in range(N+1)]
for i in range(N-1):
    a, b = ab[i][0], ab[i][1]
    path[a].append([b, i])
    path[b].append([a, i])

color_max = 0
color_list = [0]*(N-1)
visit = [False]*(N+1)
visit[1] = True
def dfs(node, color, used_path):
    global visit
    nxt_color = 0
    for nxt in path[node]:
        nxt_node = nxt[0]
        use_path = nxt[1]
        if visit[nxt_node] == False:
            visit[nxt_node] = True
            nxt_color += 1
            if nxt_color == color:
                nxt_color += 1
            dfs(nxt_node, nxt_color, use_path)
    
    global color_list
    if used_path != -1:
        color_list[used_path] = color

dfs(1, 0, -1)


for c in color_list:
    color_max = max(c, color_max)
print(color_max)
print("\n".join(map(str, color_list)))
            

Measured memory_bytes: 89408
#include <iostream>
#include <iomanip>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <utility>
#include <string>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <numeric>

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;
typedef vector<s32> vs32;
typedef vector<u32> vu32;
typedef vector<s64> vs64;
typedef vector<u64> vu64;

const double PI=3.14159265358979323846;

#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))

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

#define CEIL(x, y) (((x) + (y) - 1) / (y))
#define MOD 1000000007ULL

#define IN(l, r, x) ((l) <= (x) && (x) < (r))

template< typename T >
map<T, int> prime_factorization(T x)
{
    map<T, int> ret;
    for (T i = 2; i * i <= x; ++i)
    {
        while (x % i == 0)
        {
            ++ret[i];
            x /= i;
        }
    }
    if (x != 1) ++ret[x];
    return ret;
}

s64 mypow(s64 x, s64 n)
{
    s64 ret = 1;
    while (n)
    {
        if (n & 1) ret = (ret * x) % MOD;
        x = (x * x) % MOD;
        n >>= 1;
    }
    return ret;
}

const int max_n = 100100;
s64 fac[max_n + 1];
s64 finv[max_n + 1];
void init(int n)
{
    fac[0] = fac[1] = 1;
    for (s64 i = 2; i <= n; ++i)
    {
        fac[i] = fac[i - 1] * i % MOD;
    }
    finv[n] = mypow(fac[n], MOD - 2);
    for (s64 i = n - 1; i >= 0; --i)
    {
        finv[i] = finv[i + 1] * (i + 1) % MOD;
    }
}

s64 comb(int n, int r)
{
    if (n < r || n < 0 || r < 0) return 0;
    return fac[n] * finv[r] % MOD * finv[n - r] % MOD;
}


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

    int n, m;
    cin >> n >> m;

    auto pfac = prime_factorization(m);
    init(max_n);

    s64 ans = 1;
    for (auto& item : pfac)
    {
        int num = item.second;
        ans *= comb(n + num - 1, num);
        ans %= MOD;
    }

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



Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a),i##formax=(b);i<i##formax;i++)
#define FORR(i,a,b) for(int i=(a),i##formax=(b);i>=i##formax;i--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define pcnt __builtin_popcount
#define sz(x) (int)(x).size()
#define maxs(x,y) x=max((x),(y))
#define mins(x,y) x=min((x),(y))
#define show(x) cout<<#x<<" = "<<x<<endl;
#define all(a) ((a).begin()),((a).end())
#define each(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define perm(c) sort(all(c));for(bool c##p=1;c##p;c##p=next_permutation(all(c)))
#define bitComb(a,n,k) for(int a##x,a##y,a=(1<<k)-1;a<(1<<n);a##x=a&-a,a##y=a+a##x,a=(((a&~a##y)/a##x)>>1)|a##y)
#define bit(n) (1LL<<(n))
typedef long long ll;
typedef __int128_t lll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
template<class T>using V=vector<T>;
template<class T>using VV=V<V<T>>;
template<class T,class Y>ostream& operator<<(ostream&o,const pair<T,Y>&p){return o<<"("<<p.fi<<","<<p.se<<")";}
template<class T>ostream& operator<<(ostream&o,V<T>&v){for(T&t:v)o<<t<<",";return o<<endl;}
template<class T>void uniq(V<T>&v){sort(all(v));v.erase(unique(all(v)), v.end());}
mt19937 rnd(random_device{}());

lll gcd(lll a,lll b,lll&x,lll&y){if(!b){x=1;y=0;return a;}lll d=gcd(b,a%b,y,x);y-=a/b*x;return d;}
ll modInv(ll a,ll m){lll x,y;gcd(a,m,x,y);return(x%m+m)%m;}
ll modPow(lll a,lll n,ll m){lll p=1;for(;n;n>>=1,a=a*a%m)if(n&1)p=p*a%m;return p;}
bool isPrime(ll n){if(n<2||n%2==0)return n==2;lll t=n-1,d=t/(t&-t);for(lll a:{2,325,9375,28178,450775,9780504,1795265022})if(a%n){for(t=d,a=modPow(a,t,n);t!=n-1&&a!=1&&a!=n-1;a=a*a%n,t=t*2%n);if(a!=n-1&&t%2==0)return 0;}return 1;}
V<ll>fac,rfac; void setFac(int n,int mod){fac=rfac=V<ll>(++n);fac[0]=1;FOR(i,1,n)fac[i]=fac[i-1]*i%mod;rfac[n-1]=modInv(fac[n-1],mod);FORR(i,n-1,1)rfac[i-1]=rfac[i]*i%mod;}

ll randInt(ll l,ll r){return uniform_int_distribution<ll>(l,r)(rnd);}
double randDouble(double l,double r){return uniform_real_distribution<double>(l,r)(rnd);}
void dout(double d){printf("%.12f\n",d);}

const double PI = acos(-1);
const double EPS = 1e-10;
const int IINF = 1e9+6;
const ll LINF = 1e18;
const int MOD = 1e9+7; //998244353;

const int N = 2500;
int n, m;
bool z1[N], z2[N];
ll p, d[N];
V<pair<int, ll>> e[N], r[N];
void dfs(int a, V<pair<int, ll>>(&e)[N], bool(&z)[N]){
  z[a] = true;
  for(auto t:e[a]) if(!z[t.fi]) dfs(t.fi, e, z);
}

main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n >> m >> p;
  FOR(i, 0, m){
    ll a, b, c;
    cin >> a >> b >> c;
    a--; b--; c-=p;
    e[a].pb({b, c});
    r[b].pb({a, c});
  }
  dfs(n-1, r, z1);
  dfs(0, e, z2);
  FOR(i, 0, n) z1[i] &= z2[i];
  fill(d, d+n, -LINF);
  d[0] = 0;
  FOR(i, 1, n)FOR(j, 0, n)for(auto&t:e[j])if(z1[t.fi] && t.se+d[j]>d[t.fi]) d[t.fi] = t.se+d[j];
  FOR(j, 0, n)for(auto&t:e[j])if(z1[t.fi] && t.se+d[j]>d[t.fi]){
    cout << -1 << endl;
    return 0;
  }
  cout << max(0ll, d[n-1]) << endl;
}

Measured memory_bytes: 768
public class Main {
    private static java.util.Scanner scanner = new java.util.Scanner(System.in);

    public static void main(String[] args) {
        long a = scanner.nextLong(), b = scanner.nextLong(), ans = 0;
        for (long i = 1; i <= Long.highestOneBit(b); i *= 2)
            ans += (f(b, i) - f(a - 1, i) & 1) * i;
        System.out.println(ans);
    }

    static long f(long x, long bit) {
        return x / (bit * 2) * bit + Math.max(0, (x % (bit * 2)) - bit + 1);
    }
}

Measured memory_bytes: 23892
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;
import java.util.stream.Collectors;

public class Main {

    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        // int N = Integer.parseInt(s.next());
        String S = s.next();
        List<String> ret = Arrays.asList(S.split("")).stream().distinct().collect(Collectors.toList());
        System.out.println(ret.size() == 1 ? "No" : "Yes");
    }
}

Measured memory_bytes: 26704
#include<bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < (int)n; i++)
#define REPvec(itr, mp) for(auto itr = mp.begin();itr != mp.end(); itr ++)
#define all(x) x.begin(), x.end()
#define MOD 1000000007//1e9+7
using namespace std;
typedef long long int ll;
typedef vector<int >    vecint;
typedef vector<ll >      vecll;
typedef vector<double >   vecd;
typedef vector<string > vecstr;
typedef vector<bool >  vecbool;
typedef vector<vector<bool> >  vec2bool;
typedef vector<vector<int> >    vec2int;
typedef vector<vector<double> >   vec2d;
////////////////////////////////////////////////
int main()
{
  int h, w, a, b; cin >> h >> w >> a >>b;
  REP(i,h - b){
    REP(j,w){
      if(j < a){
	cout << 1;
      }else{
	cout << 0;
      }
    }
    cout << endl;
  }
  REP(i,b){
    REP(j,w){
      if(j < a){
	cout << 0;
      }else{
	cout << 1;
      }
    }
    cout << endl;
  }
}


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

int main (void) {
    int N;
    cin >> N;
    vector<P> coord(N);
    rep(i, N) cin >> coord.at(i).first >> coord.at(i).second;
    
    vector<int> order(N);
    rep(i, N) order.at(i) = i;
    
    double sum = 0;
    int cnt = 0;
    do {
        cnt++;
        rep(i, N-1) {
            int x = pow(coord.at(order.at(i)).first - coord.at(order.at(i+1)).first, 2);
            int y = pow(coord.at(order.at(i)).second - coord.at(order.at(i+1)).second, 2);
            sum += sqrt(x + y);
        }
    } while (next_permutation(order.begin(), order.end()));
    
    printf("%.10f\n", sum / cnt);

}


Measured memory_bytes: 256
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 result = a * b;

      	if (result % 2 == 0) {
        	System.out.println("Even");
      	} else {
        	System.out.println("Odd");
        }
    }
}


Measured memory_bytes: 22356
#include <iostream>
#include <string>
#include <algorithm> 
#include <cstdlib>
#include <map>
#include <queue>
#include <vector>
#include <utility>
#include <climits>
#include <numeric>
#define ll long long
#define INF INT_MAX 
using namespace std;
int main(){
    double a,b;
    cin >> a >> b;
    printf("%.10f\n",a/b);
}

Measured memory_bytes: 256
k = int(input())
ls=[list() for _ in range(10)]

for i in range(10):
    ls[0].append(i)

for digit in range(1,10):
    for n in ls[digit-1]:
        fst=n//10**(digit-1)
        if fst>0:
            ls[digit].append((fst-1)*10**digit+n)
        if fst<9:
            ls[digit].append((fst+1)*10**digit+n)
        ls[digit].append((fst)*10**digit+n)

ansls=set()
for l in ls:
    ansls = ansls.union(set(l))

ansls=list(ansls)
ansls.sort()
print(ansls[k])
        


Measured memory_bytes: 81776
#include<bits/stdc++.h>
#define N 100
#define M 26
using namespace std;
string s;
int p,len;
 
string bnf(bool rev){
  string res;
  int cnt=0;
  while(p!=len){
    if(s[p]=='+')p++,cnt++;
    if(s[p]=='-')p++,cnt--;
    if('A'<=s[p]&&s[p]<='Z')
      res+=((s[p++]+cnt+M*N)-'A')%M+'A',cnt=0;
    if(s[p]=='?')res+=s[p++],cnt=0;
    if(s[p]=='[')p++,res+=bnf(true);
    if(s[p]==']'){
      p++;
      break;
    }
  }
  if(rev)reverse(res.begin(),res.end());
  return res;
}
 
int main(){
  while(1){
    cin>>s;
    if(s==".")break;
    len=s.size();
    p=0;
    string ans=bnf(false);
    for(int i=0;i<(int)ans.size();i++)
      if(ans[i]=='?')ans[i]='A';
    cout<<ans<<endl;
  }
  return 0;
}

Measured memory_bytes: 1196
import bisect

n = int(input())
X = list(map(int, input().split()))

sorted_x = sorted(X)

l, r = sorted_x[n//2], sorted_x[n//2-1]

for x in X:
    if bisect.bisect_left(sorted_x, x) < n // 2:
        print(l)
    else:
        print(r)

Measured memory_bytes: 30756
from collections import deque
N, M, Q = map(int, input().split())
I = [list(map(int, input().split())) for _ in range(Q)]

que = deque()
ans = 0
for i in range(1, M+1):
    que.append([i])

while que:
    seq = que.popleft()
    
    if len(seq) == N:
        p = 0
        for i in range(Q):
            if seq[I[i][1]-1] - seq[I[i][0]-1] == I[i][2]:
                p += I[i][3]
        ans = max(ans, p)
    else:
        for i in range(seq[-1], M+1):
            seq_next = seq + [i]
            que.append(seq_next)

print(ans)

Measured memory_bytes: 23092
N,K = map(int,(input().split()))
A = list(map(int,input().split()))

def f(X):
    return sum([X ^ a for a in A])

if K==0:
    print(f(0))
else:
    l = len(bin(K)[2:])
    a_bit = [N - 2*sum([(a>>i) & 1 for a in A]) for i in range(l)]
    k_bit = [a > 0 for a in a_bit]
    k = 0
    ans = f(0)
    for j in range(l+1):
        for i,b in enumerate(k_bit[::-1],1):
            if i==j:continue
            if b and (k + (1<<(l-i)) <= K):
                k += (1<<(l-i))
        ans = max(ans,f(k))
    print(ans)

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

#define ALL(a) (a).begin(), (a).end()
#define int long long
const int MOD = 1000000007;
using namespace std;

int dp[2000];

int f(int node, vector<vector<int>> &g, vector<string> &c){
	
	if(dp[node] != 0) return dp[node];
	int sz = g[node].size();
	// きていけーす
	if(sz == 0){
		int ret;
		if(c[node] == "E") ret = 1;
		else ret = 2;
	}

	if(c[node][0] == 'E'){

		int ret = 1;
		for(int j = 0; j < sz; j++){
			int next = g[node][j];
			ret *= f(next, g, c);
			ret %= MOD;
		}

		if(c[node].size() == 2) ret++;
		ret %= MOD;
		dp[node] = ret;
		return ret;

	}else if(c[node][0] == 'A'){
		
		int ret = 0;
		for(int j = 0; j < sz; j++){
			int next = g[node][j];
			ret += f(next, g, c);
			ret %= MOD;
		}

		if(c[node].size() == 2) ret++;
		ret %= MOD;
		dp[node] = ret;
		return ret;

	}else if(c[node][0] == 'R'){
		
		int ret = 0;
		for(int bit = 1; bit < (1 << sz); bit++){
			
			int add = 1;
			for(int j = 0; j < sz; j++){
				int next = g[node][j];
				if(bit & (1 << j)) add *= f(next, g, c);
				add %= MOD;
			}
			ret += add;
		}

		if(c[node].size() == 2) ret++;
		ret %= MOD;
		dp[node] = ret;
		return ret;

	}else assert(false);
	return 0;
}

signed main(){

	int n; cin >> n;
	vector<string> c(n);
	for(int i = 0; i < n; i++){
		cin >> c[i];
	}

	vector<vector<int>> g(n);
	for(int i = 0; i < n - 1; i++){
		int s, t; cin >> s >> t;
		s--;
		t--;
		g[s].push_back(t);
	}

	cout << f(0, g, c) << endl;

	return 0;
}




Measured memory_bytes: 3236
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <iomanip>
#include <map>
#include <set>
#include <tuple>
#include <unordered_map>
#include <iterator>
#include <string>
#include <limits>

using namespace std;

using i64 = int64_t;
using P = pair<i64, i64>;
i64 mod = 1000000007;
int int_max = 2147483647;
i64 INF = 1e16;
int max_n = 1e5;


int main(int argc, char **argv) {
    i64 n,m;
    string s;
    cin >> n >> m >> s;
    std::vector<i64> leftest(n);
    i64 jump{1};
    leftest[0] = n;
    i64 left{n};
    while (true) {
        for (i64 i=left; i>=0&&i>=left-m; --i) {
            if (s[i] == '0') {
                leftest[jump] = i;
            }
        }
        if (leftest[jump] == leftest[jump-1]) {
            cout << -1 << endl;
            return 0;
        }
        left = leftest[jump];

        if (left==0) break;
        ++jump;
    }
    for (i64 j = jump; j > 0; --j) {
        cout << (leftest[j-1] - leftest[j]) << " ";
    }

    cout << endl;

    return 0;
}

Measured memory_bytes: 1408
#include <cstdio>

/*
g(L, R) := \prod_{i=L}^{R} (1 + q^{A_i})
f(L, R) = [q^S] g(L, R)
\sum_{1<=L<=R<=N} f(L, R)
p[i] := \sum_{1<=L<=i} g(L, i)
p[i] = (p[i-1] + 1) * (1 + q^{A_i})
*/

constexpr unsigned mod = 998244353;

int n, s;
unsigned dp[3001];

int main(){
  scanf("%d%d", &n, &s);

  long long int ans = 0;
  for(int i = 0; i < n; i++){
    int a;
    scanf("%d", &a);
    dp[0]++;
    for(int j = s; j >= a; j--)
      dp[j] = (dp[j] + dp[j - a]) % mod;
    ans += dp[s];
  }
  printf("%d\n", (int) (ans % mod));
  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
int main(){
	long long x,k,d;
	cin>>x>>k>>d;
    long long need = abs(x) / d;
	if(need >= k){
		if(x < 0) x += k * d;
		else x -= k * d;
	}
	else{
		if(x < 0) x += need * d;
		else x -= need * d;
		k -= need;
		k &= 1;
		if(k){
			if(x < 0) x += d;
			else x -= d;
		}
	}
	printf("%lld\n", abs(x));
    return 0;
}


Measured memory_bytes: 3708
# include <iostream>
using namespace std;
int n,*a,cnt = 0;
void Merge(int left,int mid,int right)
{
	int n1 = mid-left,n2 = right-mid;
	int *L,*R;
	L = new int [n1+1]; R = new int [n2+1];
	for(int i = 0;i < n1;i++) L[i] = a[left+i];
	for(int i = 0;i < n2;i++) R[i] = a[mid+i];
	L[n1] = R[n2] = 1e9+1;
	int i = 0,j = 0;
	for(int k = left;k < right;k++)
	{
		cnt++;
		if(L[i] <= R[j]) a[k] = L[i++];
		else a[k] = R[j++];
	}
}
void Merge_Sort(int left,int right)
{
	if(right-left <= 1) return ;
	int mid = (left+right)/2;
	Merge_Sort(left,mid);
	Merge_Sort(mid,right);
	Merge(left,mid,right); 
}
int main(void)
{

	scanf("%d",&n); a = new int [n];
	for(int i = 0;i < n;i++) scanf("%d",&a[i]);
	Merge_Sort(0,n);
	for(int i = 0;i < n;i++) printf("%d%c",a[i],(i == n-1)?'\n':' ');
	printf("%d\n",cnt);
	return 0;
}


Measured memory_bytes: 65928
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <cmath>

using namespace std;
typedef long long int ll;

int main()
{
    ll H, N;
    ll A[100000];
    cin >> H >> N;
    for (ll i = 0; i < N; i++) cin >> A[i];

    ll sum = 0;
    for (ll i = 0; i < N; i++) {
        sum += A[i];
    }
    if (sum >= H) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
    return 0;
}

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

using VS = vector<string>;    using LL = long long;
using VI = vector<int>;       using VVI = vector<VI>;
using PII = pair<int, int>;   using PLL = pair<LL, LL>;
using VL = vector<LL>;        using VVL = vector<VL>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)
//#pragma GCC optimize ("-O3") 
#ifdef YANG33
#include "mydebug.hpp"
#else
#define DD(x) 
#endif
const int INF = 1e9;                          const LL LINF = 1e16;
const LL MOD = 1000000007;                    const double PI = acos(-1.0);
int DX[8] = { 0, 0, 1, -1, 1, 1, -1, -1 };    int DY[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };

/* -----  2019/03/21  Problem: ABC 059 B / Link: http://abc059.contest.atcoder.jp/tasks/abc059_b  ----- */


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

	string A, B; cin >> A >> B;

	auto f = [&]() {
		if (SZ(A) != SZ(B))return (int)(SZ(A) < SZ(B));
		FOR(i, 0, SZ(A)) {
			if (A[i] == B[i])continue;
			else return (int)(A[i] < B[i]);
		}
		return 2;
	};
	LL ans = f();
	if (ans == 0)cout << "GREATER" << endl;
	else if (ans == 1)cout << "LESS" << endl;
	else cout << "EQUAL" << endl;

	return 0;
}


Measured memory_bytes: 256