akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
using namespace std;


int main()
{
	int n, m;
	cin >> n >> m;
	int A[100][100], b[100],c[100];

	for (int i = 0; i < n; i++)
		for (int j = 0; j < m; j++)cin >> A[i][j];
	for (int i = 0; i < m; i++)cin >> b[i];
	
	for (int i = 0; i < n; i++) {
		c[i] = 0;
		for (int j = 0; j < m; j++)c[i] += A[i][j] * b[j];
	}

	for (int i = 0; i < n; i++)cout << c[i] << endl;

	return 0;
}


Measured memory_bytes: 3136
import java.io.*;
import java.util.*;

class Main {

    public static void main(String[] args) throws Exception {
        final Scanner sc = new Scanner(System.in);
        String S = sc.next();
        StringBuilder sb = new StringBuilder();
		for (int i = 0; i < S.length(); i++) {
			sb.append("x");
		}
		System.out.println(sb.toString());
    }
}


Measured memory_bytes: 21844
#include <assert.h>
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>
 
using ll = long long;
using P = std::pair<ll, ll>;
 
#define rep(i, a, b) for (ll(i) = (a); i < (b); i++)
#define all(i) i.begin(), i.end()
#define debug(i) std::cerr << "debug " << i << std::endl
 
template <typename T1, typename T2>
std::ostream& operator<<(std::ostream& os, std::pair<T1, T2> pa) {
  return os << pa.first << " " << pa.second;
}
 
template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T> vec) {
  for (int i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
  return os;
}
 
template<typename T1,typename T2>
inline bool chmax(T1& a,T2 b){return a<b && (a=b,true);}
 
template<typename T1,typename T2>
inline bool chmin(T1& a,T2 b){return a>b && (a=b,true);}
 
ll pow_mod(ll a, ll b, ll mod=-1) {
  if ((a == 0)||(mod!=-1&&a%mod==0)) {
    return 0;
  }
 
  ll x = 1;
 
  while (b > 0) {
    if (b & 1) {
      x = (mod!=-1)?(x * a) % mod:x*a;
    }
    a = (mod!=-1)?(a * a) % mod:a*a;
    b >>= 1;
  }
  return x;
}
 
// const ll MOD = 998244353;
const ll MOD = 1e9 + 7;
 
int main() {
  std::cin.tie(0);
  std::ios::sync_with_stdio(false);

  ll n;
  std::cin>>n;

  std::vector<P> prob(n);

  rep(i,0,n){
    std::cin>>prob[i].first>>prob[i].second;
  }

  std::vector<ll> r_min(n,MOD);

  ll itr=-1,min=MOD;

  std::sort(all(prob));

  rep(i,0,n){
    if(chmin(min,prob[i].second))itr=i;
  }

  for(ll i=n-2;i>=0;i--){
    r_min[i]=std::min(r_min[i+1],prob[i+1].second);
  }

  ll ans=0;

  rep(i,0,n-1){
    if(itr<=i){
      chmax(ans,std::max(min-prob[i].first+1,0ll)+std::max(r_min[i]-prob[n-1].first+1,0ll));
    }
    chmax(ans,prob[i].second-prob[i].first+1+std::max(min-prob[n-1].first+1,0ll));
  }

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

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

using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;

#define REP(i, n, m) for(ll i=n; i<(ll)m; ++i)
#define IREP(i, n, m) for(ll i=n-1; i>=m; --i)
#define rep(i, n) REP(i, 0, n)
#define irep(i, n) IREP(i, n, 0)
#define all(v) v.begin(), v.end()
#define vprint(v) for(auto e:v){cout<<e<<" ";};cout<<endl;
#define vvprint(vv) for(auto v:vv)vprint(v);

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

    ll A, B, C, K;
    cin >> A >> B >> C >> K;

    ll t = 0;
    if(K<=A) t = K;
    else if(K-A<=B) t = A;
    else t = A - (K-A-B);
    cout << t << endl;
}


Measured memory_bytes: 3648
#include<bits/stdc++.h>
#include<climits>
 
using namespace std;
 
#define debug(x,y) cout<<(#x)<<" " <<(#y)<<" is " << (x) <<" "<< (y) << endl
#define watch(x) cout<<(#x)<<" is " << (x) << endl
#define fast ios_base::sync_with_stdio(false)
#define fie(i,a,b) for(i=a;i<b;i++)
#define MOD 1000000007
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define ll long long
#define lld long long int
#define ALL(x) (x).begin(),(x).end()
 
typedef vector<int> vi;
typedef vector<vector<int>> vii;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<pair<int,int>> vpi;
 
const long long OO = 2e18;
const double pi=2*acos(0.0);
 
bool isprime(long long int a){
    if(a==1){
        return false;
    }
    for(int i=2;i*i<=a;i++){
        if(a%i==0){
            return false;
        }
    }
    return true;
} 

bool iscoprime(int a,int b){
    int i;
    for(i=2;i<=min(a,b);i++){
        if(a%i==0 && b%i==0){
            return false;
        }
    }
    return true;
}

ll gcd(ll a,ll b){
    if(b==0){
        return a;
    }
    else{
        return gcd(b,a%b);
    }
}

int maxA(vi a){
    int m=0;
    for(int i=0;i<a.size();i++){
        m=max(m,a[i]);
    }
    return m;
}

int minA(vi a){
    int m=100000;
    for(int i=0;i<a.size();i++){
        m=min(m,a[i]);
    }
    return m;
}

vi freqN(vi a, int n){
    vi f(n);
    f={0};
    for(int i=0;i<a.size();i++){
        f[a[i]]++;
    }
    return f;
}

vi freqA(vi a){
    vi f(26);
    f={0};
    for(int i=0;i<a.size();i++){
        f[a[i]-'0']++;
    }
    return f;
}

bool mycomp(const pair<long int,long int>&p1 , const pair<long int,long int>&p2){
    if(p1.second < p2.second) return true;
    else if(p1.second==p2.second) return p1.first<p2.first;
    else return false;
}

unsigned int rightmostsetbit(unsigned int n){
    return n & -n;
}

bool cmp(pair<string,int>&p1 , pair<string,int>&p2){
    if(p1.second==p2.second) return p1.first<p2.first;
    return p1.second>p2.second;
}

int main(){
fast;
cin.tie(0);
lld n,a,b;
cin>>n>>a>>b;
lld ans=0;
if((b-a-1)%2==0){
    if(n-b<a-1){
        ans+=n-b;
        ans++;
        a++;
        ans+=(a+b)/2-a;
    }    
    else{
        ans+=a-1;
        ans++;
        b--;
        ans+=(a+b)/2-a;
    }
    cout<<ans<<endl;
}
else{
    cout<<((b+a)/2)-a<<endl;
}
}

Measured memory_bytes: 256
#include<stdio.h>
int binarySearch(int *,int,int);
int main(){
  int n,q;
  int S[1000001],T[50001];
  int ans;
  int i;
  ans=0;
  scanf("%d",&n);
  for(i=0;i<n;i++) scanf("%d",&S[i]);
  scanf("%d",&q);
  for(i=0;i<q;i++) scanf("%d",&T[i]);
  for(i=0;i<q;i++){
    if(binarySearch(S,T[i],n)) ans++;
  }
  printf("%d\n",ans);
  return 0;
}

int binarySearch(int T[],int key,int n){
  int left = 0;
  int right = n;
  int mid;
  while(left<right){
    mid = (left + right)/2;
    if(T[mid] == key) return 1;
    else if(T[mid] > key) right = mid;
    else left = mid + 1;
  }
  return 0;
}



Measured memory_bytes: 2324
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <string>
#include <utility>
#include <cassert>

using namespace std;
typedef long long ll;

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

  int n, x, y;
  cin >> n >> x >> y;

  vector<int> freq(n, 0);

  for (int i = 1; i <= n; i++) {
    for (int j = i+1; j <= n; j++) {
      int d;
      if (j <= x || y <= i) {
        d = j - i;
      } else if (i <= x) {
        d = min(j - i, x - i + 1 + abs(y - j));
      } else {
        d = min(j - i, abs(y - j) + 1 + abs(x - i));
      }
      assert(d > 0);
      freq[d]++;
    }
  }

  for (int i = 1; i < n; i++) {
    cout << freq[i] << endl;
  }

  return 0;
}

Measured memory_bytes: 256
#[allow(unused_macros)]
macro_rules! scan {
    () => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().to_string()
        }
    };
    (;;) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().split_whitespace().map(|s| s.to_string()).collect::<Vec<String>>()
        }
    };
    (;;$n:expr) => {
        {
            (0..$n).map(|_| scan!()).collect::<Vec<_>>()
        }
    };
    ($t:ty) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty;;) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.split_whitespace()
                .map(|t| t.parse::<$t>().unwrap())
                .collect::<Vec<_>>()
        }
    };
    ($t:ty;;$n:expr) => {
        (0..$n).map(|_| scan!($t;;)).collect::<Vec<_>>()
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
                    scan!($t)
        ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
                    scan!($($t),*)
        ).collect::<Vec<_>>()
    };
}

const MOD: i64 = 1_000_000_007;

fn fact(n: i64) -> i64 {
    (1..n + 1).fold(1, |a, b| a * b % MOD)
}

fn pow(n: i64, k: i64) -> i64 {
    match k {
        0 => 1,
        a if a % 2 == 0 => pow(n * n % MOD, k / 2),
        _ => n * pow(n * n % MOD, k / 2) % MOD,
    }
}

fn combination(n: i64, k: i64) -> i64 {
    (fact(n) * pow(fact(k), MOD - 2) % MOD) * pow(fact(n - k), MOD - 2) % MOD
}

fn main() {
    let (n, m, k) = scan!(i64, i64, i64);

    let dxs = (1..n)
        .map(|d| m * m * d * (n - d))
        .fold(0, |sum, i| (sum + i) % MOD);

    let dys = (1..m)
        .map(|d| n * n * d * (m - d))
        .fold(0, |sum, i| (sum + i) % MOD);

    println!("{}", combination(n * m - 2, k - 2) * (dxs + dys) % MOD)
}


Measured memory_bytes: 4352
# coding: utf-8

n = int(input())
takoyaki = [int(s) for s in input().split()]

tairyoku = 0
for i in range(0, n - 1):
    for j in range(i + 1, n):
        tairyoku += takoyaki[i] * takoyaki[j]

print(tairyoku)

Measured memory_bytes: 2940
import numpy as np
import itertools

N = int(input())
count = 0

X = [[3,5,7]]*9
X = np.array(X)

result = [[] for i in range(9)]


for n in range(9):
    X[n] = X[n] * (10 ** n)

result[0] = [3,5,7]

for n in range(1,9):
    for x in X[n]:
        for r in result[n-1]:
            result[n].append(x+r)

result = list(itertools.chain.from_iterable(result))

for r in result:
    if r < 333:
        pass
    elif r > N:
        pass
    else:
        if ('3' in str(r)) and ('5' in str(r)) and ('7' in str(r)):
            count += 1

print(int(count))

Measured memory_bytes: 22036
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;

int main(){
    string a, b;
    cin >> a >> b;
    int x = a.size() - b.size();
    string ans;
    if(x>0) ans = "GREATER";
    else if(x<0) ans = "LESS";
    else{
        if(a == b) ans = "EQUAL";
        else{
            for(int i = 0; i < (int)a.size(); i++){
                int y = stoi(a.substr(i,1)) - stoi(b.substr(i,1));
                if(y == 0) continue;
                if(y>0){
                    ans = "GREATER";
                    break;
                }else{
                    ans = "LESS";
                    break;
                }
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
function parse_table(N)
    local tbl = {}
    for i=1,N do
        table.insert(tbl, io.read("n"))
    end
    return tbl
end
function gcd(a,b)
    if b == 0 then
        return a
    else
        return gcd(b, a % b)
    end
end
function gcd_tbl(tbl)
    local ans = tbl[1]
    for i=2,#tbl do
        ans = gcd(ans, tbl[i])
    end
    return ans
end
function main()
    local n = io.read("n")
    io.read("l")
    local hptbl = parse_table(n)
    local ans = gcd_tbl(hptbl)
    print(ans)
end
main()


Measured memory_bytes: 2424
#include<bits/stdc++.h>
using namespace std;
int n,a[200005],b[200005],miny;
long long ans;
bool flag;
int main(){
	flag=true;
	scanf("%d",&n);
	miny=1000000005;
	for(int i=1;i<=n;i++){
		scanf("%d%d",&a[i],&b[i]);
		if(a[i]!=b[i])
			flag=false;
		ans+=a[i];
		if(a[i]>b[i])
			miny=min(miny,b[i]);
	}
	if(flag)
		puts("0");
	else
		printf("%lld\n",ans-miny);
	return 0;
}

Measured memory_bytes: 384
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions
from decimal import Decimal
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

s = input()
print(len(s) - abs(s.count('0') - s.count('1')))

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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define eb emplace_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second

using vint=vector<int>;
using pint=pair<int,int>;
using vpint=vector<pint>;

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;}

template<class A,class B>
ostream& operator<<(ostream& ost,const pair<A,B>&p){
    ost<<"{"<<p.first<<","<<p.second<<"}";
    return ost;
}

template<class T>
ostream& operator<<(ostream& ost,const vector<T>&v){
    ost<<"{";
    for(int i=0;i<v.size();i++){
        if(i)ost<<",";
        ost<<v[i];
    }
    ost<<"}";
    return ost;
}

inline int topbit(unsigned long long x){
    return x?63-__builtin_clzll(x):-1;
}

inline int popcount(unsigned long long x){
    return __builtin_popcountll(x);
}

inline int parity(unsigned long long x){
    return __builtin_parity(x);
}

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

    if((1<<topbit(N))==N){
        cout<<"No"<<endl;
        return 0;
    }

    if(N==3){
        cout<<"Yes"<<endl;
        rep(i,5){
            cout<<i+1<<" "<<i+2<<endl;
        }
        return 0;
    }

    cout<<"Yes"<<endl;
    int l=topbit(N);

    int p=1<<l;
    for(int i=1;i+1<p;i++){
        cout<<i<<" "<<i+1<<endl;
        cout<<i+N<<" "<<i+1+N<<endl;
    }
    cout<<p-1<<" "<<N+1<<endl;

    cout<<1<<" "<<p<<endl;
    cout<<p<<" "<<p+1+N<<endl;
    cout<<1<<" "<<p+1<<endl;
    cout<<p+1<<" "<<p+N<<endl;
    for(int i=p+2;i<=N;i++){
        cout<<i-1<<" "<<i+N<<endl;
        cout<<i-p<<" "<<i<<endl;
    }
    return 0;
}

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

double x[8],y[8];

int main() {
  int n; cin >> n;
  double dd=0;
  for (int i = 0; i < n; i++)
    	cin >> x[i] >> y[i];
	for (int i = 0; i < n; i++)
      for (int j=i+1;j<n;j++)
        dd+=sqrt((x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j]));
  dd/=(0.5*n);
  printf("%.9lf",dd);
}

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

class Program
{
    static void Main(string[] args)
    {
        var n = int.Parse(Console.ReadLine());
        var s = Console.ReadLine().Split(' ');
        var v = new int[n];
        var even = new int[100001];
        var odd = new int[100001];
        for (int i = 0; i < n; i++)
        {
            v[i] = int.Parse(s[i]);
            if (i % 2 == 0) { even[v[i]]++; }
            else { odd[v[i]]++; }
        }
        int e1 = 0, e2 = 0, o1 = 0, o2 = 0;
        for(int i = 1; i < 100000; i++)
        {
            if (even[i] >= even[e1])
            {
                e2 = e1;
                e1 = i;
            }
            else if (even[i] >= even[e2])
            {
                e2 = i;
            }
            if (odd[i] >= odd[o1])
            {
                o2 = o1;
                o1 = i;
            }
            else if (odd[i] >= odd[o2])
            {
                o2 = i;
            }
        }
        if (o1 == e1) { Console.WriteLine(Math.Min(n - even[e2] - odd[o1], n - even[e1] - odd[o2])); }
        else { Console.WriteLine(n - even[e1] - odd[o1]); }
    }
}


Measured memory_bytes: 19680
import sys
readline = sys.stdin.readline
class Tree:
    __slots__ = ['id', 'p', 'depth', 'type', 'c']
    def __init__(self, id):
        self.id = id
        self.p = -1
        self.depth = -1
        self.type = "leaf"
        self.c = []
    def __str__(self):
        return f"node {self.id}: parent = {self.p}, depth = {self.depth}, {self.type}, {self.c}"
n = int(input())
li = tuple(Tree(i) for i in range(n))
for _ in range(n):
    id, k, *c = map(int, readline().split())
    if k != 0:
        li[id].type = "internal node"
        li[id].c = c
        for j in c:
            li[j].p = id
root = 0
while li[root].p != -1:
    root = li[root].p
li[root].type = "root"
li[root].depth = 0
def depth_check(id, d):
    d += 1
    for i in li[id].c:
        li[i].depth = d
        if li[i].type != "leaf":
            depth_check(i, d)
depth_check(root, 0)
print("\n".join(map(str, li)))



Measured memory_bytes: 44768
#include<iostream>
using namespace std;
int main(){
    string s;
    cin >> s;
    if(s.at(0) != s.at(1) && s.at(1) != s.at(2) && s.at(0) != s.at(2)) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int i, j;
	
	for (i = 1; i <= 9; i++){
		for (j = 1; j <= 9; j++){
			printf("%dx%d=%d\n", i, j, i * j);
		}
	}
	
	return (0);
}

Measured memory_bytes: 520
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 c = sc.nextInt();
    int k = sc.nextInt();
    int answer=0;
    int max=a;
    int other1=b;
    int other2=c;
    if(b>max){
      max=b;
      other1=a;
      other2=c;
    }
    if(c>max){
      max=c;
      other1=a;
      other2=b;
    }
    for(int i=0;i<k;i++){
      max *= 2;
    }
    System.out.print(max+other1+other2);
  }
}


Measured memory_bytes: 21844
import sys
input = sys.stdin.buffer.readline


class UnionFind:
    def __init__(self, n=0):
        self.d = [-1]*n
        self.u = n

    def root(self, x):
        if self.d[x] < 0:
            return x
        self.d[x] = self.root(self.d[x])
        return self.d[x]

    def unite(self, x, y):
        x, y = self.root(x), self.root(y)
        if x == y:
            return False
        if x > y:
            x, y = y, x
        self.d[x] += self.d[y]
        self.d[y] = x
        self.u -= 1
        return True

    def same(self, x, y):
        return self.root(x) == self.root(y)

    def size(self, x):
        return -self.d[self.root(x)]

    def num_union(self):
        return self.u


N, M = map(int, input().split())
u = UnionFind(N+M)
for i in range(N):
    K, *L = map(int, input().split())
    for l in L:
        l = N-1+l
        u.unite(i, l)

for i in range(N):
    if not u.same(0, i):
        print('NO')
        break
else:
    print('YES')


Measured memory_bytes: 14728
#include <iostream>
#include <vector>
#include <map>
#include <string>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <functional>
#include <queue>
#include <utility>
using namespace std;
typedef long long ll;
int main(){
  string s;
  cin >> s;
  bool flag = true;
  for(int i = 0;i < s.size();i++){
    if(i % 2 == 0 && s[i] != 'R' && s[i] != 'U' && s[i] != 'D'){
      flag = false;
    }

    if(i % 2 == 1 && s[i] != 'L' && s[i] != 'U' && s[i] != 'D'){
      flag = false;
    }
  }

  if(!flag)cout << "No" << endl;
  else cout << "Yes" << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();

        StringBuilder b = new StringBuilder(s.length()/2);
        for (int i = 1; i <= s.length(); i += 2) {
            b.append(s.substring(i-1, i));
        }

        System.out.println(b.toString());
    }

}

Measured memory_bytes: 27800
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define ld long double
#define fi first
#define se second
#define pb push_back
#define all(v) v.begin(),v.end()
#define repf(i,a,b) for(ll i=a;i<b;i++)
#define repb(i,a,b) for(ll i=a;i>=b;i--)
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define mod 1000000007
#define MOD 998244353 

using namespace std;
using namespace __gnu_pbds;

typedef
tree<
	pair<int, int>,
	null_type,
	less<pair<int, int>>,
	rb_tree_tag,
	tree_order_statistics_node_update>
ordered_set;

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

ll power(ll a, ll n, ll m)
{
    ll ans=1;
    while(n)
    {
        if(n&1) ans=(ans*a)%m;
        n>>=1;
        a=(a*a)%m;
    }
    return ans;
}

ll invmod(ll a, ll m)
{
    return power(a,m-2,m);
}

ll n;
ll fac[200001];
ll dp[200001],sz[200001];
vector<ll> v[200001];
ll ans[200001];

void dfs(ll x, ll p)
{
    sz[x]=1;
    for(auto i:v[x])
    {
        if(i==p) continue;
        dfs(i,x);
        sz[x]+=sz[i];
    }
    dp[x]=fac[sz[x]-1];
    ll num=1,den=1;
    for(auto i:v[x])
    {
        if(i==p) continue;
        num=(num*dp[i])%mod;
        den=(den*fac[sz[i]])%mod;
    }
    ll val=(num*invmod(den,mod))%mod;
    dp[x]=(dp[x]*val)%mod;
}

void dfs1(ll x, ll p)
{
    ll val1=(dp[p]*invmod(fac[n-1],mod))%mod;
    val1=(val1*fac[sz[x]])%mod;
    val1=(val1*invmod(dp[x],mod))%mod;
    val1=(val1*fac[n-sz[x]-1])%mod;
    dp[x]=(dp[x]*invmod(fac[sz[x]-1],mod))%mod;
    dp[x]=(dp[x]*val1)%mod;
    dp[x]=(dp[x]*invmod(fac[n-sz[x]],mod))%mod;
    dp[x]=(dp[x]*fac[n-1])%mod;
    ans[x]=dp[x];
    for(auto i:v[x])
    {
        if(i==p) continue;
        dfs1(i,x);
    }
}

int main()
{
    IOS;
    fac[0]=1;
    repf(i,1,200001) fac[i]=(fac[i-1]*i)%mod;
    cin>>n;
    repf(i,0,n-1)
    {
        ll x,y;
        cin>>x>>y;
        v[x].pb(y);
        v[y].pb(x);
    }
    dfs(1,-1);
    ans[1]=dp[1];
    for(auto i:v[1])
    {
        dfs1(i,1);
    }
    repf(i,1,n+1) cout<<ans[i]<<endl;
}     

Measured memory_bytes: 20976
#include <bits/stdc++.h>
#define inf 1000000007
#define mod 1000000007LL
//#pragma GCC optimize(2)
//#define int long long
#define ll long long
using namespace std;
template <typename T> void read(T &x){
	x=0;char ch=getchar();int fh=1;
	while (ch<'0'||ch>'9'){if (ch=='-')fh=-1;ch=getchar();}
	while (ch>='0'&&ch<='9')x=x*10+ch-'0',ch=getchar();
	x*=fh;
}
template <typename T> void write(T x) {
	if (x<0) x=-x,putchar('-');
	if (x>9) write(x/10);
	putchar(x%10+'0');
}
template <typename T> void writeln(T x) {
	write(x);
	puts("");
}
ll pow(ll a, ll b, ll m)
{
    ll ans = 1;
    a %= m;
    while(b)
    {
        if(b & 1)ans = (ans % m) * (a % m) % m;
        b /= 2;
        a = (a % m) * (a % m) % m;
    }
    ans %= m;
    return ans;
}
ll inv(ll x, ll p)//x??p???,p???
{
    return pow(x, p - 2, p);
}
ll C(ll n, ll m, ll p)//???C(n, m) % p
{
    if(m > n)return 0;
    ll up = 1, down = 1;//????;
    for(int i = n - m + 1; i <= n; i++)up = up * i % p;
    for(int i = 1; i <= m; i++)down = down * i % p;
    return up * inv(down, p) % p;
}
ll Lucas(ll n, ll m, ll p)
{
    if(m == 0)return 1;
    return C(n % p, m % p, p) * Lucas(n / p, m / p, p) % p;
}
signed main()
{
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	ll n,a,b;
	cin>>n>>a>>b;
	cout<<(pow(2LL,n,mod)-1LL-Lucas(n,a,mod)-Lucas(n,b,mod)+10LL*mod)%mod<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "debug.h"
#else
#define dump(...)
#endif
#define endl "\n"
#define ll long long
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define REP(i, x) for (int i = 0; i < (int)(x); i++)
#define REPS(i, x) for (int i = 1; i <= (int)(x); i++)
#define RREP(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define RREPS(i, x) for (int i = ((int)(x)); i > 0; i--)
#define INF (1 << 30 - 1)
#define LLINF (1LL << 60)
#define vi vector<int>
#define vvi vector<vector<int>>
#define pi pair<int, int>
#define ALL(a) (a).begin(), (a).end()
#define BIT(n) (1LL << (n))
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end()) //sortしてからつかうこと
constexpr ll MOD = 1e9 + 7;
int dx[8] = {1, 0, -1, 0, 1, 1, -1, -1};
int dy[8] = {0, 1, 0, -1, 1, -1, 1, -1};
ll A, B, C, D, E, F, G, H, N, M, L, K, P, Q, R, W, X, Y, Z;
string S, T;
ll ans = 0;

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

signed main() {
    cin >> S;
    if (S == "ABC") {
        cout << "ARC" << endl;
    } else {
        cout << "ABC" << endl;
    }
}

Measured memory_bytes: 3616
#include <algorithm>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
//#include <regex>

/* g++ -g -std=c++0x */
/* g++ -g -std=c++11 */

using namespace std;

// std::ios::sync_with_stdio(false);

// freopen("input.txt", "rt", stdin);
// freopen("output.txt", "wt", stdout);

#define ALL(c)          (c).begin(), (c).end()
#define ALLR(c)         (c).rbegin(), (c).rend()
#define FOR(i,a,b)      for (int i=(a); i < (b); ++i)
#define FORR(i,a,b)     for (int i=(a); i > (b); --i)
#define FOR_ALL(i,c)    for (__typeof((c).begin()) i=(c).begin();   \
                             i != (c).end(); ++i)
#define FOR_ALLR(i,c)   for (__typeof((c).rbegin()) i=(c).rbegin(); \
                             i != (c).rend(); ++i)
#define SZ(array)       (sizeof(array)/sizeof(array[0]))
#define lc(x)           (x<<1)     /* 2*x */
#define rc(x)           (x<<1 | 1) /* 2*x+1 */
#define lowbit(x)       (x & (-x)) /* 0b10100 -> 0b100 */

typedef long long       LL;
typedef map<int,int>    MII;
typedef pair<int,int>   PII;
typedef set<int>        SI;
typedef vector<bool>    VB;
typedef vector<double>  VD;
typedef vector<int>     VI;
typedef vector<string>  VS;

/* check if a key is in container C */
template <class C>
inline bool in_(const typename C::key_type& k, const C& A)
{ return A.find(k) != A.end(); }
inline bool in_(const string& s, const string& S)
{ return S.find(s) != string::npos; }

int main()
{
    int N; cin >> N;
    map<int,int> M;
    FOR(_,0,N) {
        int a; cin >> a;
        M[a]++;
    }
    int ans = 0;
    FOR_ALL(i,M) {
        const int k = i->first;
        const int x = i->second;
        if (x > k)
            ans += x-k;
        if (x < k)
            ans += x;
    }
    cout << ans << endl;
}


Measured memory_bytes: 4736
#include <bits/stdc++.h>
using namespace std;
const int n = 50;

int main() {
    long long k;
    cin >> k;
    
    long long b = k/n + n-1;
    long long p = k%n;
    vector<long long> a(n, b - p);
    for (int i = 0; i < p; i++) a[i] += n;
    
    cout << n << endl;
    for (auto ans : a) cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
//120 B - K-th Common Divisor 2019/03/03
#include <bits/stdc++.h>
#define rep(i ,n) for(int i=0;i<(int)(n);++i)
using namespace std;
typedef long long int int64;
typedef unsigned long long uint64;

int main(){
    int a , b , k;cin >> a >> b >> k;
    vector<int> div_a,div_b;
    while(true){
        for(int i=1;i<=a;++i){
            if(a%i==0) div_a.push_back(i);
        }
        for(int i=1;i<=b;++i){
            if(b%i==0) div_b.push_back(i);
    }
    int counter=0;int tmp;
    for(int i=div_a.size()-1;i>=0;--i){
        for(int j=div_b.size()-1;j>=0;--j){
            if(div_a[i]==div_b[j]) { 
                ++counter; 
                tmp=div_a[i]; 
                if(counter==k){
                    cout << tmp << endl; return 0;
                    }
                }
            }
        }
    }
}   

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

const long long int INF = 1000000007;

int n, p[1001];
long long int ans;

void factor(int x){
  while(x > 1){
    for(int i = 2; i <= x; i++){
      if(x % i == 0){
	x = x / i;
	p[i]++;
	break;
      }
    }
  }
}

int main(void){
  cin >> n;
  for(int i = 2; i <= n; i++){
    factor(i);
  }
  ans = 1;
  for(int i = 0; i <= n; i++){
    ans = (ans * (p[i] + 1)) % INF;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
n=int(input())
l=[int(i) for i in input().split()]
a=0;b=0;c=0
for i in l:
    if i%4==0:
        a+=1
    elif i%4==2:
        b+=1
    else:
        c+=1
if b==0:
    if a>=c-1:
        bool=True
    else:
        bool=False
else:
    c+=1
    if a>=c-1:
        bool=True
    else:
        bool=False
if bool:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 14252
#include<iostream>
using namespace std;
int main()
{
    int n, l;
    cin >> n >> l;
    
    int start = l;
    int end = l + n - 1;
    if (l > 0) {
      start++;
    } else if (-l >= n) {
      end--;
    }
    int sum = 0;
    for (int i = start; i <= end; i++) {
      sum += i;
    }
    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.*;
import java.math.*;
import java.awt.geom.*;
import java.io.*;
    
    
public class Main {
	static int INF = 2 << 27;
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while (true) {
			int n = sc.nextInt();
			int m = sc.nextInt();
			int p = sc.nextInt();
			int a = sc.nextInt()-1;
			int b = sc.nextInt()-1;
			if(n == 0 && m == 0 && p == 0 && a == -1 && b == -1) break;
			int[] t = new int[n];
			for(int i = 0; i < n; i++) {
				t[i] = sc.nextInt();
			}
			Node[] node = new Node[m];
			for(int i = 0; i < m; i++) {
				node[i] = new Node();
			}
			for(int i = 0; i < p; i++) {
				int x = sc.nextInt()-1;
				int y = sc.nextInt()-1;
				int z = sc.nextInt();
				node[x].to.add(new Edge(y,x,z));
				node[y].to.add(new Edge(x,y,z));
			}
			PriorityQueue<Data> queue = new PriorityQueue<Data>();
			double[][] dp = new double[m][1 << n];
			for(int i = 0; i < m; i++) {
				Arrays.fill(dp[i], 2 << 27);
			}
			queue.add(new Data(a,0,0));
			double ans = 2 << 27;
			while(!queue.isEmpty()) {
				Data tmp = queue.poll();
				//System.out.println(tmp.now + " " + tmp.cost + " " + Integer.toBinaryString(tmp.use));
				if(dp[tmp.now][tmp.use] <= tmp.cost) continue;
				if(tmp.now == b) ans = Math.min(tmp.cost,ans);
				dp[tmp.now][tmp.use] = tmp.cost;
				for(int i = 0; i < node[tmp.now].to.size(); i++) {
					for(int k = 0; k < n; k++) {
						if((tmp.use & (1 << k)) != 0) continue;
						queue.add(new Data(node[tmp.now].to.get(i).to,(tmp.use | (1 << k)),(node[tmp.now].to.get(i).cost / (double)t[k]) + tmp.cost));
					}
				}
				
			}
			if(ans == 2 << 27) {
				System.out.println("Impossible");
			}
			else {
				System.out.printf("%.20f\n",ans);
			}
			
			
			
			
 		}
	}
	static class Data implements Comparable<Data>{
		int now;
		int use;
		double cost;
		@Override
		public int compareTo(Data o) {
			if(this.cost < o.cost) return -1;
			else if(this.cost > o.cost) return 1;
			return 0;
		}
		Data(int a, int b, double c) {
			now = a;
			use = b;
			cost = c;
		}
		
		
	}
	
	
	static class Node {
		static int ID = 0;
		int id;
		Node() {
			id = ID++;
		}
		ArrayList<Edge> to = new ArrayList<Edge>();
	}
	static class Edge {
		int to;
		int from;
		int cost;
		Edge(int a, int b, int c) {
			to = a;
			from = b;
			cost = c;
		}
	}
	
}

Measured memory_bytes: 159756
#include <stdio.h>
 #define N 100
int main(){
   
  int i,j,min,n;
int mi,count = 0;
int array[N][N],farray[N],num[N];
 
  scanf("%d",&n);
   
   
  for(i = 0;i < n;i++){

    for(j = 0;j < n;j++){

      scanf("%d",&array[i][j]);
    }
  }

  for(i = 0;i < n;i++){
    farray[i] = 0;
    num[i] = 2000;
  }
  num[0] = 0; 
  for(i = 0;i < n-1;i++){
    min = 2000;
    for(j = 0;j < n;j++){
      if(num[j] < min && farray[j] == 0){
    min = num[j];
    mi = j;
      }
    }
    farray[mi] = 1;
    for(j = 0;j < n;j++){
      if(array[mi][j] != -1 && array[mi][j] < num[j] && farray[j] == 0){
    num[j] = array[mi][j];
      }
    }
  }
  for(i = 0;i < n;i++){
    count += num[i];
  }
  printf("%d\n",count);
  return 0;
}



Measured memory_bytes: 2048
import java.util.*;

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

	public void execute() {
		Scanner sc = new Scanner(System.in);
		final int N = sc.nextInt();

		final String S = sc.next();

		int[] wcnt = new int[N];
		int[] ecnt = new int[N];

		for (int i = 0; i < N - 1; i++) {
			wcnt[i + 1] = wcnt[i];
			if (S.charAt(i) == 'W') {
				wcnt[i + 1] += 1;
			}
			ecnt[N - 2 - i] = ecnt[N - 1 - i];
			if (S.charAt(N - i - 1) == 'E') {
				ecnt[N - 2 - i] += 1;
			}
		}

		int minTurn = N;
		for (int i = 0; i < N; i++) {
			minTurn = Math.min(minTurn, wcnt[i] + ecnt[i]);
		}
		System.out.println(minTurn);

		sc.close();
	}

}


Measured memory_bytes: 31456
n = int(input())
a = [[int(x) for x in input().split()] for i in range(n)]
dp = [-1 for i in range(1 << n)]
dp[0] = 1
mod=10**9+7
def gethelp(bit, i):
    if dp[bit] != -1:
        return dp[bit]
    else:
        tmp = 0
        for j in range(n):
            if bit & (1 << j) and a[i][j]:
                tmp += gethelp(bit ^ (1 << j), i+1)
    dp[bit] = tmp % mod
    return dp[bit]
print(gethelp(2**n-1, 0))

Measured memory_bytes: 123496
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
const int maxn = 100010;
int a[maxn];

int main()
{
	int n;
	scanf("%d",&n);
	for (int i=1;i<=n;i++) scanf("%d",&a[i]);
	sort(a+1,a+n+1);
	int ans = a[n] - a[1];
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip> //! for setprecision(10)
#include <math.h>
#include <algorithm>
#include <functional> 
#include <string>
#include <vector>

#include <cstring>
#include <set>
#include <map>
#include <queue>
#include <utility>
#include <limits.h>

using namespace std;

typedef long long LL;

#define rep(i,n) for (int i = 0; i < (n); ++i)
#define dump(c) { for (auto it = c.begin(); it != c.end(); ++it) if (it == c.begin()) cout << *it; else cout << ' ' << *it; cout << endl; } 
#define dumpMap(m) { for (auto it: m) cout << it.first << "=>" << it.second << ' '; }

const int MOD = 1000000007;

int main()
{
	cin.tie(0);
	ios::sync_with_stdio(0);
    
    int D, T, S;
    cin >> D >> T >> S;

    cout << (D <= T*S ? "Yes" : "No") << endl;

    return 0;
}


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

int main() {
    int N;  cin >> N;
    vector<int> X(N), Y(N);
    for (int i = 0; i < N; ++i) {
        cin >> X[i];
        Y[i] = X[i];
    }
    sort(Y.begin(), Y.end());
    int cent1 = Y[N / 2 - 1], cent2 = Y[N / 2];

    for (int i = 0; i < N; ++i) {
        if (X[i] <= cent1) cout << cent2 << endl;
        else cout << cent1 << endl;
    }
}


Measured memory_bytes: 4796
import sys
input = lambda: sys.stdin.readline().rstrip()

#https://www.slideshare.net/chokudai/union-find-49066733
class UnionFind():
  def __init__(self, n):
    self.n = n
    self.parents = [-1] * self.n

  def find(self, x):
    if self.parents[x] < 0:
      return x
    else:
      self.parents[x] = self.find(self.parents[x])
      return self.parents[x]

  def union(self, x, y):
    x = self.find(x)
    y = self.find(y)

    if x == y: return False
    if self.parents[x] > self.parents[y]:
      x, y = y, x
    self.parents[x] += self.parents[y]
    self.parents[y] = x
        
  def issame(self, x, y):
    return self.find(x) == self.find(y)
  
  def get_node_members(self):
    return [[j for j in range(self.n) if self.issame(i, j)] for i in range(self.n)]
  
  def size(self, x):
    return -self.parents[self.find(x)]

N = list(map(int, input().split()))
parents = [-1] * N[0]
def find(x):
  if parents[x] < 0:
    return x
  else:
    parents[x] = find(parents[x])
    return parents[x]

def union(x, y):
  x = find(x)
  y = find(y)

  if x == y: return False
  if parents[x] > parents[y]:
    x, y = y, x
  parents[x] += parents[y]
  parents[y] = x
        
def issame(x, y):
  return find(x) == find(y)
  
def size(x):
  return -parents[find(x)]
  

results = [0 for i in range(N[0])]
for i in range(N[1]):
  x, y = list(map(int, input().split()))
  x, y = x - 1, y - 1
  results[x] += 1
  results[y] += 1
  union(x, y)
#print(uf.parents)

for i in range(N[2]):
  x, y = list(map(int, input().split()))
  x, y = x - 1, y - 1
  if issame(x, y):
  	results[x] += 1
  	results[y] += 1
  
#print(node_members, results)

print(" ".join([str(size(i) - results[i] - 1) for i in range(N[0])]))

Measured memory_bytes: 14768
//https://atcoder.jp/contests/abc146/tasks/abc146_a
#include <bits/stdc++.h>
#if LOCAL
#include "dump.hpp"
#else
#define dump(...)
#endif
using namespace std;
using ll=long long;
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
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;}
int main() {
    string S; cin>>S;
    map<string,ll> tbl={
        {"SUN",7},
        {"MON",6},
        {"TUE",5},
        {"WED",4},
        {"THU",3},
        {"FRI",2},
        {"SAT",1},
    };    
    cout<<tbl[S]<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
using namespace std;

int main(){
    int N;
    cin >> N;
    long A[N], B[N];
    for(int i = 0; i < N; i++){
        cin >> A[i];
    }
    for(int i = 0; i < N; i++){
        cin >> B[i];   
    }
    // tarinai kosuu
    int tarinai_count = 0;
    long tarinai_sum = 0;
    long dif[N];
    for(int i = 0; i < N; i++){
        if(A[i] < B[i]){
            tarinai_count++;
            tarinai_sum += B[i] - A[i];
        }
        dif[i] = -B[i] + A[i];
    }
    int tariteru_count = 0;
    long tariteru_sum = 0;
    sort(dif, &dif[N]);
    if(tarinai_count == 0){
        cout << 0 << endl;
        return 0;
    }
    for(int i = N-1; i >= 0; i--){
        tariteru_sum += dif[i];
        tariteru_count++;
        if(tariteru_sum > tarinai_sum){
            cout << tarinai_count + tariteru_count << endl;
            return 0;
        }
    }
    cout << -1 << endl;
    return 0;
}

Measured memory_bytes: 2560
#include<iomanip>
#include<limits>
#include<thread>
#include<utility>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<numeric>
#include<cassert>
#include<random>
#include<chrono>
#include<unordered_map>
#include<fstream>
#include<list>
#include<functional>
#include<bitset>
#include<complex>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pi;
typedef pair<double,double> pd;
typedef pair<double,ll> pdl;
#define F first
#define S second
const ll E=1e18+7;
const ll MOD=1000000007;





int main(){
    ll l,k;
    cin>>l>>k;
    vector<vector<ll>> dp(l+1,vector<ll>(2,0));
    dp[0][0]=1;
    ll ans=0;
    for(int i=0;i<=l;i++){
        ans+=dp[i][1];
        if(i<l){
            dp[i+1][0]+=dp[i][1];
            dp[i+1][1]+=dp[i][0];
        }
        if(i+k<=l){
            dp[i+k][1]+=dp[i][0];
        }
    }
    cout<<ans<<endl;
    
    
    return 0;
}



Measured memory_bytes: 3168
/*author: hyperion_1724
  date: 
*/

//Required Libraries

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>

//Required namespaces

using namespace std;
using namespace __gnu_pbds;

//Required defines

#define endl '\n'

#define READ(X) cin>>X;
#define READV(X) long long X; cin>>X;
#define READAR(A,N) long long A[N]; for(long long i=0;i<N;i++) {cin>>A[i];}
#define rz(A,N) A.resize(N);
#define sz(X) (long long)(X.size())
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define trav(x,A) for(auto &x:A)
#define FORI(a,b,c) for(long long a=b;a<c;a++)
#define FORD(a,b,c) for(long long a=b;a>c;a--)

//Required typedefs

typedef tree<long long,null_type,less<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
typedef tree<long long,null_type,greater<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set1;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<long,long> pll;
typedef vector<int> veci;
typedef vector<long long> vecl;

//Required Constants

const long long inf=(long long)1e18;
const long long MOD=(long long)(1e9+7);
const long long INIT=(long long)(1e6+1);

//Required Functions

ll power(ll x,ll y) 
{ 
	if (y == 0) 
		return 1; 
	ll p = power(x, y/2) % MOD; 
	p = (p * p) % MOD; 
  
	return (y%2 == 0)? p : (x * p) % MOD; 
}
ll modInverse(ll a) 
{ 
   return power(a,MOD-2); 
   
}

//Work

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	
	READV(a);
	string S;
	READ(S);
	if(a>=3200)
	{
		cout<<S<<endl;
	}
	else
	{
		cout<<"red"<<endl;
	}
	

	return 0;
}

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


int main() {
    ll n,m,sol=0,c;
    ll k,a,b,zb=0;
    cin >> n >> m >> k;
    vector<ll>V1;
    vector<ll>V2;
    for (ll i=0;i<n;i++) {
        cin >> a;
        zb+=a;
        V1.push_back(zb);
    }

    zb=0;
    for (ll i=0;i<m;i++) {
        cin >> a;
        zb+=a;
        V2.push_back(zb);
    }

    vector<ll>::iterator it;
    for (ll i=0;i<n;i++) {
        a=V1[i];
        if (a>k) continue;
        it=upper_bound(V2.begin(),V2.end(),k-a);
//        if (it==V2.begin()) {
//            sol=max(sol,i+1);
//            continue;
//        }
        c=it-V2.begin();
//        if (it==V2.end()) {c=m;}
//        else {c=it-V2.begin();}
        sol=max(sol,i+1+c);
    }
    it=upper_bound(V2.begin(),V2.end(),k);
    c=it-V2.begin();
    sol=max(sol,c);
    cout << sol;


}


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

int main()
{
	int nInput;
	int nH, nM, nS;

	while (cin >> nInput)
	{
		nH = nInput / 3600;
		nInput = nInput - nH * 3600;
		nM = nInput / 60;
		nInput = nInput - nM * 60;
		nS = nInput;
		cout << nH << ":" << nM << ":" << nS << endl;
	}
	return 0;
}

Measured memory_bytes: 3096
#include <cstdio>
#include <bitset>
#define mod 998244353

typedef std::bitset<301> BS;

BS d[301];
BS a[301];

int qpow(int x, int p)
{
	int ans = 1;
	while(p)
	{
		if(p & 1) ans = 1ll * ans * x % mod;
		x = 1ll * x * x % mod; p >>= 1; 
	}
	return ans;
}

int main()
{
	int n, m; scanf("%d%d", &n, &m);
	for(int i = 1; i <= n; i++)
		for(int j = 1; j <= m; j++)
		{
			int x; scanf("%d", &x);
			a[j][i] = x;
		}
	int cnt = 0;
	for(int i = 1; i <= m; i++)
		for(int j = n; j >= 1; j--)
		{
			if(a[i][j] == 1)
			{
				if(!d[j][j]) d[j] = a[i], cnt++;
				a[i] ^= d[j];
			}
		}
	printf("%lld\n", 1ll * qpow(2, n - 1) * (qpow(2, m) - qpow(2, m - cnt) + mod) % mod);
}

//对于一维的情况，如果有1，那么答案是2^(len-1)，否则为0
//考虑选出某几列，如果把这几列中每一行的数字xor起来后有至少一行为1，那么就有2^(n-1)的贡献
//把每一列看成一个数，题目转化成 问有多少个列的子集异或和不为0
//考虑异或和为0的子集个数，构造线性基，那么对每个不在线性基中的数，都可以选或不选(加上几个在线性基中的数都能xor出0)
//所以为2^(m-cnt)，cnt为在线性基中的数的个数
//ans = 2 ^ (n-1) * (2 ^ m - 2 ^ (m-cnt) ) 

Measured memory_bytes: 128
#include <algorithm>  // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <bitset>     // bitset
#include <cctype>     // isupper, islower, isdigit, toupper, tolower
#include <cstdint>    // int64_t, int*_t
#include <cstdio>     // printf
#include <deque>      // deque
#include <iomanip>    // fixed, setprecision
#include <iostream>   // cout, endl, cin
#include <map>        // map
#include <queue>      // queue, priority_queue
#include <set>        // set
#include <stack>      // stack
#include <string>     // string, to_string, stoi
#include <tuple>      // tuple, make_tuple
#include <unordered_map>  // unordered_map
#include <unordered_set>  // unordered_set
#include <utility>        // pair, make_pair
#include <vector>         // vector
using namespace std;

int main() {
  int N;
  cin >> N;
  int tb = 0, xb = 0, yb = 0, tc, xc, yc, td, dd;
  for (int i = 0; i < N; i++) {
    cin >> tc >> xc >> yc;
    td = tc - tb;
    dd = abs(xc - xb) + abs(yc - yb);
    if (td >= dd && (td - dd) % 2 == 0) {
      xb = xc;
      yb = yc;
      tb = tc;
      continue;
    } else {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
}


Measured memory_bytes: 3124
import qualified Data.ByteString.Lazy.Char8 as B
import Data.Maybe
import Data.List

solve :: Int -> Int -> [Int] -> Int
solve n bigX xs = cost n bigX rs d0
  where
    rs = reverse xs
    d0 = if n <= 2 then 1
         else if cost n bigX rs 1 < cost n bigX rs 2 then 1
              else search n bigX rs 1 (n-1)

cost :: Int -> Int -> [Int] -> Int -> Int
cost n bigX rs d = bigX * (n + d)
                   + (sum $ zipWith (*) (5 : [5,7..]) (gsumA d n rs))

-- gsum d rs = gsumA d (length rs) rs

gsumA :: Int -> Int -> [Int] -> [Int]
gsumA d k rs | k <= d = [sum rs]
             | otherwise = (sum rs1) : gsumA d (k-d) rs2
  where (rs1, rs2) = splitAt d rs

search :: Int -> Int -> [Int] -> Int -> Int -> Int
search n bigX rs low high
  | high == low + 1 = high
  | theCost mid < theCost (mid+1) = search n bigX rs low mid
  | otherwise                     = search n bigX rs mid high
  where
    theCost d = cost n bigX rs d
    mid = (low + high) `div` 2

bsReadInts :: B.ByteString -> [Int]
bsReadInts = map (fst . fromJust . B.readInt) . B.words

tmain :: B.ByteString -> Int
tmain cont =
  let n : bigx : xs = bsReadInts cont
  in solve n bigx xs

main = putStrLn . show . tmain =<< B.getContents


Measured memory_bytes: 59900
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>

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

// Inserted snippets: io, opt, root
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
template<typename H> bool chmin(H& v1, const H v2) { if (v1 > v2) { v1 = v2; return true; } return false; }
template<typename H> bool chmax(H& v1, const H v2) { if (v1 < v2) { v1 = v2; return true; } return false; }
template<typename H> void read(H& head) { cin >> head; }
template<typename H, typename ...T> void read(H& head, T& ...tail) { cin >> head; read(tail...); }
template<typename H> void write(H head) { cout << head << '\n'; }
template<typename H, typename ...T> void write(H head, T ...tail) { cout << head << " "; write(tail...); }
template<typename ...T> void die(T ...tok) { write(tok...); exit(0); }
#pragma GCC optimize("O3")
#pragma GCC target("avx2")
// End snippets

struct It { int v, w; };

vector<pii> dp,dp2,rv;

vector<pii> solve(vector<It>::iterator it1, vector<It>::iterator it2, int L) {
	dp.clear();
	dp.push_back({0, 0});

	for (auto ii=it1; ii!=it2; ii++) {
		int s=sz(dp);
		auto it=*ii;
		for (int i=0;i<s;i++) {
			auto p=dp[i];
			if (p.first + it.w <= L) {
				dp.push_back({ p.first + it.w, p.second + it.v });
			}
		}
	}

	sort(all(dp), [](const pii a, const pii b) {
			if (a.first != b.first) return a.first < b.first;
			return a.second > b.second;
			});
	
	rv.clear();
	int cv = 0;

	for (auto p : dp) {
		chmax(cv, p.second);
		if (rv.empty() || p.first != rv.back().first)
			rv.push_back({ p.first, cv });
	}

	return rv;
}

vector<It> k;

const int BLK = 1<<10;
vector<pii> pre[BLK+1];

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

	int n; read(n);
	vector<It> kk(n + 1);
	rep(i, 1, n + 1) read(kk[i].v, kk[i].w);

	dp.reserve(1<<10);
	dp2.reserve(1<<10);
	rv.reserve(1<<10);
	k.reserve(20);

	rep(i,1,BLK+1) {
		k.clear();
		for (int j=min(i,n);j>=1;j>>=1)
			k.push_back(kk[j]);
		pre[i]=solve(k.begin(),k.end(),100000);
	}

	int q; read(q);
	rep(i, 0, q) {
		int v, l; read(v, l);

		k.clear();
		int j = v;
		for (j = v; j > BLK; j >>= 1)
			k.push_back(kk[j]);
		vector<pii> &p1 = pre[j];
		vector<pii> p2 = solve(k.begin(), k.end(), l);

		/*	cout << "1" << endl;
			for (auto p : p1) write(p.first, p.second);
			cout << "2" << endl;
			for (auto p : p2) write(p.first, p.second);
		 */
		int ans = 0;

		auto it = prev(p2.end());
		for (auto p : p1) {
			if(p.first>l) break;
			while (it != p2.begin() && it->first + p.first > l)
				--it;
			if (it->first + p.first > l)
				continue;
			chmax(ans, p.second + it->second);
		}

		write(ans);
	}
}


Measured memory_bytes: 10412