akhauriyash/Code-Regression huggingface dataset:
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define E "\n"

using namespace std;
const long long MOD = 1e9 + 7;

string s;

int main()
{
  ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  cin >> s;
  int len = s.length();
  int acc = 0;
  for (int i = 0; i < len; i++) {
    acc += s[i] - '0';
    acc %= 9;
  }
  if (acc == 0) cout << "Yes" << E;
  else cout << "No" << E;
  //system("pause");
  return 0;
}

Measured memory_bytes: 3744
#include <algorithm>
#include <cassert>
#include <cfloat>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
 
#define FOR(i,k,n) for (int (i)=(k); (i)<(n); ++(i))
#define rep(i,n) FOR(i,0,n)
#define all(v) begin(v), end(v)
#define debug(x) cerr<< #x <<": "<<x<<endl
#define debug2(x,y) cerr<< #x <<": "<< x <<", "<< #y <<": "<< y <<endl
 
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<ll> vll;
typedef vector<vector<ll> > vvll;
typedef deque<bool> db;
template<class T> using vv=vector<vector< T > >;

int main() {
  int n, m;
  cin >> n >> m;
  vi cnt(n, 0);
  rep (i, m) {
    int a, b;
    cin >> a >> b;
    cnt[a-1] += 1;
    cnt[b-1] += 1;
  }
  rep (i, n) {
    printf("%d\n", cnt[i]);
  }

  return 0;
}


Measured memory_bytes: 888
#include<iostream>
int main(){
  int n,m;
  int test=0,ans=1;
  std::cin >> n >> m;
  for(int i = m/n;i >=1 ;i=i-1){
    test=m%i;
    if(test == 0){
      ans=i;
      break;
    }
  }
  std::cout << ans << std::endl;
  return 0;
}


Measured memory_bytes: 256
Grade = Struct.new(:point, :num, :bonus) do
  def total
    point * num + bonus
  end

  # required点が与えられて、その点を取るために必要な問題数を返す
  # ただし、全問とかないと届かない場合や全問解いても届かない場合は0を返す
  def required_num(required)
    d = (required + point - 1) / point
    if d < num
      d
    else
      0
    end
  end
end

def main
  g_num, target = ARGF.gets.split.map(&:to_i)
  grades = []
  g_num.times do |i|
    grades << Grade.new((i+1)*100, *ARGF.gets.split.map(&:to_i))
  end
  # pp grades

  min_num = 1000

  # bit mask の生成
  0.upto((1 << g_num) - 1) do |mask|
    # 各bitを下から舐める
    total = 0
    num = 0
    0.upto(g_num-1) do |i|
      # ビットが立っている＝全問解く
      if mask[i] == 1
        total += grades[i].total
        num += grades[i].num
      end

      # すでにmin_num以上の問題を解いている？➾試行を続ける意味なし
      break if min_num < num
    end

    # 得点が足りている場合はここでmin_numを更新
    if target <= total
      min_num = num if num < min_num
      next
    end

    # まだ得点が足りていなかったら、解いていない一番下の問題を解く
    # それでも足りない場合、それは全問回答する組み合わせが不適切ということ
    rest = target - total
    (g_num-1).downto 0 do |i|
      # iビット目が立っていない＝まだ解いていない
      if mask[i] == 0
        added_num = grades[i].required_num(rest)
        if 0 < added_num
          num += added_num
          min_num = num if num < min_num
        end
        break
      end
    end
  end

  puts min_num
end

if __FILE__ == $0
  main
end


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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit32(x) (1 << (x))
#define bit64(x) (1ll << (x))

using namespace std;

using i64 = long long;
using f80 = long double;
using vi32 = vector<int>;
using vi64 = vector<i64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << endl; exit(0); }
inline void no() { cout << "No" << endl; exit(0); }
inline i64 gcd(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); if (a % b == 0) return b; return gcd(b, a % b); }
inline i64 lcm(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); return a / gcd(a, b) * b; }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> inline void amax(T &x, T y) { x = max(x, y); }
template <typename T> inline void amin(T &x, T y) { x = min(x, y); }
template <typename T> inline T exp(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { each(x, v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }

void solve() {
  string s;
  cin >> s;
  int n = s.size();
  for (int i = 0; i + 2 <= n; i++) {
    if (s[i] == s[i + 1]) {
      cout << i + 1 << " " << i + 2 << endl;
      return;
    }
  }
  for (int i = 0; i + 3 <= n; i++) {
    if (s[i] == s[i + 2]) {
      cout << i + 1 << " " << i + 3 << endl;
      return;
    }
  }
  cout << "-1 -1" << endl;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
 int main (){
int n;
cin >> n;
 vector<int> a(n);
 int sum=0;
 for(int i=0;i<n;i++){
     cin >> a.at(i);
     while(a.at(i)==(a.at(i)/2)*2){
         a.at(i)=a.at(i)/2;
         sum++;
     }
 }
cout << sum << endl;
 }

Measured memory_bytes: 3660
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
const int INF=1e9,MOD=1e9+7,ohara=1e6+10;
const ll LINF=1e18;
using namespace std;
    
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout<<(x)<<endl
#define doublecout(a) cout<<fixed<<setprecision(15)<<a<<endl;
#define Cerr(x) cerr<<(x)<<endl
#define fi first
#define se second
#define P pair<ll,ll> 
#define m_p make_pair
#define V vector<ll> 
#define U_MAP unordered_map<ll,ll>
#define pq priority_queue<ll>
#define rpq priority_queue<ll,vector<ll>,greater<ll>>
#define p_b push_back
    
ll n,cnt,ans,a,b,c,d,tmp,tmpp,m,h,w,x,y,sum,pos,k;
ld doua;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
//int dy[]={-1,0,1,-1,1,-1,0,1};
//int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"),s,t;
bool fl;
struct edge{int to,cost;};
    
//-------------------------↓↓↓↓↓↓------------------------
    
//------ 自分を天才だと信じる ------
    
int main(void){
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    
    cin>>s>>t;
    rep(i,Size(s)){
        if(s[i]==t[i])ans++;
    }
    Cout(ans);
    return 0;
}

Measured memory_bytes: 256
package main

/*
#include <stdio.h>
#include <stdlib.h>
void print(const char *str){
	printf("%s", str);
}
int nextInt(){
	int n;
	int _ = scanf("%d",&n);
	return n;
}
*/
import "C"

import (
	"bytes"
	"fmt"
	"log"
	"strconv"
)

func main() {
	log.SetFlags(log.Lshortfile)
	// str := C.CString("Hello world\n")
	// C.print(str)
	// ci := C.nextInt()
	// ci2 := int(C.nextInt())
	// n := 10
	// log.Println(ci, ci2+n)
	// var next = newScanner()
	N := int(C.nextInt())
	M := int(C.nextInt())
	Q := int(C.nextInt())
	// var N, M, Q int
	// _, err := fmt.Scanf("%d %d %d", &N, &M, &Q)
	// if err != nil {
	// 	log.Fatal(err)
	// }
	var data [510][510]int
	var l, r int
	for i := 0; i < M; i++ {
		// _, err := fmt.Scanf("%d %d", &l, &r)
		// if err != nil {
		// 	log.Fatal(err)
		// }
		l = int(C.nextInt())
		r = int(C.nextInt())
		data[l][r]++
	}

	for i := N; i >= 1; i-- {
		for j := 1; j <= N; j++ {
			data[i][j] += data[i+1][j]
			data[i][j] += data[i][j-1]
			data[i][j] -= data[i+1][j-1]
		}
	}
	var buf bytes.Buffer
	var p, q int
	for i := 0; i < Q; i++ {
		// _, err := fmt.Scanf("%d %d", &p, &q)
		// if err != nil {
		// 	log.Fatal(err)
		// }
		p = int(C.nextInt())
		q = int(C.nextInt())
		buf.WriteString(strconv.Itoa(data[p][q]))
		buf.WriteString("\n")
	}
	fmt.Println(buf.String())
}

//
// type scanner struct {
// 	r     *bufio.Reader
// 	buf   []byte
// 	begin int
// 	end   int
// 	// p     int
// }
//
// func newScanner() *scanner {
// 	rdr := bufio.NewReaderSize(os.Stdin, 1024)
// 	return &scanner{r: rdr}
// }
// func (s *scanner) next() string {
// 	s.pre()
// 	s.begin = s.end
// 	for ; s.end < len(s.buf); s.end++ {
// 		if s.buf[s.end] == ' ' {
// 			break
// 		}
// 	}
// 	result := s.buf[s.begin:s.end]
// 	s.end++
// 	return *(*string)(unsafe.Pointer(&result))
//
// }
// func (s *scanner) Line() string {
// 	s.pre()
// 	s.begin = s.end
// 	s.end = len(s.buf)
// 	result := s.buf[s.begin:]
// 	return *(*string)(unsafe.Pointer(&result))
// }
// func (s *scanner) String() string {
// 	return s.next()
// }
// func (s *scanner) Int() int {
// 	v, err := strconv.Atoi(s.next())
// 	// v, err := strconv.ParseInt(s.next(), 10, 64)
// 	if err != nil {
// 		log.Fatal(err)
// 	}
// 	return v
// }
// func (s *scanner) Ints(n int) []int {
// 	r := make([]int, n)
// 	for i := 0; i < n; i++ {
// 		r[i] = s.Int()
// 	}
// 	return r
// }
// func (s *scanner) Int64() int64 {
// 	v, err := strconv.ParseInt(s.next(), 10, 64)
// 	if err != nil {
// 		log.Fatal(err)
// 	}
// 	return v
// }
// func (s *scanner) Uint64() uint64 {
// 	v, err := strconv.ParseUint(s.next(), 10, 64)
// 	if err != nil {
// 		log.Fatal(err)
// 	}
// 	return v
// }
// func (s *scanner) Float64() float64 {
// 	v, err := strconv.ParseFloat(s.next(), 64)
// 	if err != nil {
// 		log.Fatal(err)
// 	}
// 	return v
// }
// func (s *scanner) pre() {
// 	if s.end >= len(s.buf) {
// 		s.readLine()
// 		s.end = 0
// 	}
// }
// func (s *scanner) readLine() {
// 	s.buf = make([]byte, 0, 1024)
// 	for {
// 		l, p, err := s.r.ReadLine()
// 		if err != nil {
// 			log.Fatal(err)
// 		}
// 		s.buf = append(s.buf, l...)
// 		if !p {
// 			break
// 		}
// 	}
// }

Measured memory_bytes: 7680
#include <bits/stdc++.h>
#define ft first
#define sc second
#define pt(sth) cout << sth << "\n"
#define chmax(a, b) {if(a<b) a=b;}
#define chmin(a, b) {if(a>b) a=b;}
#define moC(a, s, b) (a)=((a)s(b)+MOD)%MOD
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
static const ll INF=1e18;
static const ll MAX=1e5+7;
static ll MOD=1e9+7;
ll max(ll a, ll b) {return a>b?a:b;}
ll min(ll a, ll b) {return a<b?a:b;}

ll co[]={INF, 2, 5, 5, 4, 5, 6, 3, 7, 6};
set<ll> match;
ll dp[10007];

void rec(ll hon, ll len) {
  if(len==0) return;
  
  ll t=0;
  for(auto m: match) {
    if(hon-co[m]<0) continue;
    
    if(dp[hon-co[m]]==len-1) t=m;
  }
  
  //pt(hon-co[t]);
  cout << t;
  rec(hon-co[t], len-1);
}

int main(void) {
  ll N, M;
  cin >> N >> M;
  ll a[MAX];
  ll i;
  ll f[10]={};
  
  for(i=0; i<M; i++)
    cin >> a[i];
  sort(a, a+M);
  reverse(a, a+M);
  
  for(i=0; i<M; i++) {
    if(f[co[a[i]]]) continue;
    
    match.insert(a[i]);
    f[co[a[i]]]=1;
    
  }
  
  for(i=1; i<=N; i++) dp[i]=-INF;
  dp[0]=0;
  
  for(i=0; i<N; i++) {
    if(dp[i]==-INF) continue;
    for(auto m: match) {
      chmax(dp[i+co[m]], dp[i]+1);
    }
  }
      
  rec(N, dp[N]);
  pt("");
  
}


Measured memory_bytes: 384
#include<cstdio>
#include<iostream>
using namespace std;
char str[200050];
int main(){
	int n;
	scanf("%d",&n);
	scanf("%s",str+1);
	int w=0;
	for(int i=1;i<=n;i++)
		if(str[i]=='W')w++;
	int cnt=0;
	for(int i=n;i>n-w;i--)
		if(str[i]=='W')cnt++;
	printf("%d\n",w-cnt);
	return 0;
} 

Measured memory_bytes: 4020
use std::io::stdin;
use std::str::FromStr;

fn main(){
    let n: usize = get_one();
    let mut ans = 0;
    for i in 1..n+1 {
        ans += g(i, n);
    }
    println!("{}", ans);
}

fn g(i: usize, n: usize) -> usize {
    let m = n / i;
    let s = m * (m+1) / 2;
    s * i
}

#[allow(dead_code)]
fn get_line() -> String {
    let mut s = String::new();
    match stdin().read_line(&mut s){
        Ok(_) => {s.trim().to_string()}
        Err(_) => String::new()
    }
}

#[allow(dead_code)]
fn get_vec<T: std::str::FromStr>() -> Vec<T> {
    let line = get_line();
    line.split_whitespace().filter_map(|x| x.parse().ok()).collect()
}

#[allow(dead_code)]
fn get_one<T: FromStr + Copy>() -> T {
    let v = get_vec();
    v[0]
}

#[allow(dead_code)]
fn get_pair<T: FromStr + Copy>() -> (T, T) {
    let v = get_vec();
    (v[0], v[1])
}

#[allow(dead_code)]
fn get_triple<T: FromStr + Copy>() -> (T, T, T) {
    let v = get_vec();
    (v[0], v[1], v[2])
}

#[allow(dead_code)]
fn get_chars() -> Vec<char> {
    get_line().chars().collect()
}

#[allow(dead_code)]
fn vec_min(xs: &Vec<i64>) -> i64 {
    xs.iter().map(|&x|x).fold(std::i64::MAX, std::cmp::min)
}

#[allow(dead_code)]
fn vec_max(xs: &Vec<i64>) -> i64 {
    xs.iter().map(|&x|x).fold(std::i64::MIN, std::cmp::max)
}

#[allow(dead_code)]
fn vec_sum(xs: &Vec<i64>) -> i64 {
    xs.iter().fold(0, |acc, &x| acc+x)
}


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

using namespace std;
using ll = long long;
 
#define rep(i, n)      for (int i = 0; i < (n); i++)
#define repr(i, n)     for (int i = (n) - 1; i >= 0; i--)
#define repe(i, l, r)  for (int i = (l); i < (r); i++)
#define reper(i, l, r) for (int i = (r) - 1; i >= (l); i--)
#define repi(i, l, r)  for (int i = (l); i <= (r); i++)
#define repir(i, l, r) for (int i = (r); i >= (l); i--)
#define range(a) a.begin(), a.end()
void initio() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }

int main() { initio();
  int N, M; cin >> N >> M;
  string S; cin >> S;
  set<int> st;
  rep(i, N+1) {
    if (S[i] != '1') st.insert(i);
  }
  int i = N;
  vector<int> path;
  path.push_back(N);
  while (i > 0) {
    auto it = st.lower_bound(i - M);
    if (*it >= i) {
      cout << "-1" << endl;
      return 0;
    }
    i = *it;
    path.push_back(i);
  }
  reverse(range(path));
  for (int i = 0; i + 1 < path.size(); i++) {
    cout << path[i + 1] - path[i] << ' ';
  }
  cout << endl;
}


Measured memory_bytes: 5832
using System;
using System.Linq;
class c
{
    static void Main()
    {
        Console.ReadLine();
        var l = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
        l = l.OrderBy(f => f).ToArray();
        int ans = l.Where((f, g) => g % 2 == 0).Sum();
        Console.WriteLine(ans);
    }
}

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

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
#define unless(p) if(!(p))
#define until(p) while(!(p))

using ll = std::int64_t;
using P = std::tuple<int,int>;

int N, M;
std::vector<int> G[610], rG[610];
double dp1[610], dp2[610];
double p2[610];
bool reachable[610];

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

    std::cin >> N >> M;

    for(int i=0;i<M;++i){
        int s, t;
        std::cin >> s >> t;

        G[s].emplace_back(t);
        rG[t].emplace_back(s);
    }

    for(int i=N-1;i>0;--i){
        for(int j : G[i]){
            dp1[i] += dp1[j];
        }

        double p = 1.0 / G[i].size();
        dp1[i] *= p;
        dp1[i] += 1;
    }

    p2[1] = 1;
    reachable[1] = 1;

    for(int i=2;i<=N;++i){
        for(int j : rG[i]){
            double p = 1.0 / G[j].size();
            dp2[i] += (dp2[j] + p2[j]) * p;
            p2[i] += p2[j] * p;
            reachable[i] |= reachable[j];
        }
    }

    double mn = dp1[1];

    for(int s=1;s<N;++s){
        if(!reachable[s] || G[s].size() > 1){
            double total = 0;

            for(int t : G[s]){
                total += dp1[t];
            }

            for(int t : G[s]){
                double x;

                if(G[s].size() == 1){
                    x = dp1[1] - dp2[s] - dp1[s] * p2[s];
                }else{
                    x = dp1[1] - dp1[s] * p2[s] + ((total - dp1[t]) / (G[s].size() - 1) + 1) * p2[s];
                }

                mn = std::min(mn, x);
            }
        }
    }

    printf("%.10f\n", mn);
}


Measured memory_bytes: 2560
#include <stdio.h>

long long maxn(long long a[], int n)
{
  long long max = a[0];
  int i;
  for (i = 0; i < n; i++)
    if (a[i] > max)
      max = a[i];
  return max;
}

int main(void)
{
  long long n, a, b, c, d, e;
  scanf("%lld %lld %lld %lld %lld %lld", &n, &a, &b, &c, &d, &e);
  long long v[5] = {(n - 1) / a,(n - 1) / b,(n - 1) / c,(n - 1)/ d,(n - 1)/ e};
  printf("%lld\n", 5 + maxn(v, 5));

  return 0;
}


Measured memory_bytes: 128
#include "bits/stdc++.h"
#define ll long long
#define rep2(i,a,b) for(int i=a;i<=b;++i)
#define rep(i,n) for(int i=0;i<n;i++)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define tii tuple<int,int,int>
#define pq priority_queue<int>
#define pqg priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define edge(v,a,b) v[a].pb(b);v[b].pb(a);
ll MOD=1e9+7;
#define INF 2*1e9
#define N 1000010
#define MAX_V 900010
#define vec vector<int>
using namespace std;

void print(int a,int b){
    cout<<a<<" "<<b<<endl;
}
main(){
    string s;
    cin>>s;
    if(s[0]=='0'||s[(s.size()-1)]=='1'||s[(s.size()-2)]=='0'){
        cout<<-1;return 0;
    }
    rep(i,s.size()-1){
        if(s[i]!=s[(s.size()-2-i)]){
            cout<<-1;return 0;
        }
    }
    print(1,2);
    int r1=1,r2=2;
    rep2(i,1,(int)(s.size()-2)){
        if(s[i]=='1'){
            print(r2,i+2);
            r1=r2;r2=i+2;
        }
        else if(i==s.size()-2){
          print(r2,i+2);
        }
        else{
            print(r2,i+2);
        }
    }
    return 0;
}

Measured memory_bytes: 1664
package main

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

var sc *bufio.Scanner = bufio.NewScanner(os.Stdin)

func scan() []string {
	sc.Scan()
	return strings.Split(sc.Text(), " ")
}

func main() {
	scan()
	S := scan()
	scan()
	T := scan()

	cnt := 0
	for _, t := range T {
		for _, s := range S {
			if t == s {
				cnt++
				break
			}
		}
	}
	fmt.Println(cnt)
}


Measured memory_bytes: 1416
#include <iostream>
#include <vector>
#include <list>
#include <set>
#include <queue>
#include <map>
#include <algorithm>
#include <functional>
#include <string>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <tuple>
using namespace std;

#define REP(i,p,n) for(ll i=p;i<ll(n);++i)
#define rep(i,n) REP(i,0,n)

using ll = long long int;
using pll = pair<ll, ll>;

const ll mod = static_cast<ll>(1e9) + 7;

ll AN, BN, M;

int main()
{
    cin >> AN >> BN >> M;

    vector<ll> A(AN);
    vector<ll> B(BN);
    for (auto& a : A) { cin >> a; }
    for (auto& b : B) { cin >> b; }

    const auto ma = min_element(A.begin(), A.end());
    const auto mb = min_element(B.begin(), B.end());

    ll ans = *ma + *mb;

    rep (i, M)
    {
        ll x, y, c;
        cin >> x >> y >> c;
        --x;
        --y;

        const ll res = A[x] + B[y] - c;
        ans = min(res, ans);
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
    #define r(i,n) for(int i=0;i<n;i++)
    #define int long long
    using namespace std;
     
    signed main(){
      int a,b,c,d;
      cin>>a>>b>>c>>d;
     
      c=c-a;
      d=d-b;
      
      r(i,c)cout<<'R';
      r(i,d)cout<<'U';
      r(i,c)cout<<'L';
      r(i,d)cout<<'D';
     
      cout<<'L';
      r(i,d+1)cout<<'U';
      r(i,c+1)cout<<'R';
      cout<<"DR";
      r(i,d+1)cout<<'D';
      r(i,c+1)cout<<'L';
      cout<<'U';
      cout<<endl;
    }

Measured memory_bytes: 256
#define _USE_MATH_DEFINES  // M_PI等のフラグ

#include <iostream>
#include <string>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <map>
#include <vector>

#define MOD 1000000007
#define COUNTOF(array) (sizeof(array)/sizeof(array[0]))

using namespace std;

string replace_with_str(string str, string str_from, string str_to) {
    string::size_type pos = 0;
    while (pos = str.find(str_from, pos), pos != string::npos) {
        str.replace(pos, str_from.length(), str_to);
        pos += str_to.length();
    }
    return str;
}

int main(int argc, char const *argv[]){
    int N, K;
    cin >> N >> K;
    vector<long> v(N);
    for(int i=0; i<N; i++){
        long h;
        cin >> h;
        v[i] = h;
    }

    // ソートしてKの範囲をずらす走査すればいいんじゃない？
    stable_sort(v.begin(), v.end());
    long min_h = 10000000000;
    long max_h = -1;
    long ans = 10000000000;
    for(int i=0; i<=N-K; i++){
        long diff_h = v[i+K-1] - v[i];

        if(diff_h < ans){
            ans = diff_h;
        }
    }

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

Measured memory_bytes: 1408
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st;
        PrintWriter pw = new PrintWriter(System.out);
        
        try {
            char[] a = br.readLine().toCharArray();
            char[] b = br.readLine().toCharArray();

            int count = 0;
            for(int i=0 ; i<a.length ; i++) {
                if(a[i] != b[i]) count++;
            }

            pw.println(count);
        }
        finally {
            pw.flush();
            pw.close();
        }
    }
}


Measured memory_bytes: 37448
#include<set>
#include<map>
#include<cmath>
#include<queue>
#include<cctype>
#include<vector>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using std::min;
using std::max;
using std::swap;
using std::vector;
const int N=305;
const int mod=1e9+7;
typedef double db;
typedef long long ll;
#define pb(A) push_back(A)
#define pii std::pair<int,int>
#define mp(A,B) std::make_pair(A,B)

int n,m;
int f[N][N][N];
vector< pii > v[N];

int getint(){
    int X=0,w=0;char ch=0;
    while(!isdigit(ch))w|=ch=='-',ch=getchar();
    while( isdigit(ch))X=X*10+ch-48,ch=getchar();
    if(w) return -X;return X;
}

bool ok(int pos,int a,int b){
    for(auto x:v[pos]){
        if(x.first<=a and x.second!=3) return 0;
        if(x.first<=b and x.first>a and x.second!=2) return 0;
        if(x.first>b and x.second!=1) return 0;
    } return 1;
}

signed main(){
    n=getint(),m=getint();
    for(int i=1;i<=m;i++){
        int l=getint(),r=getint(),x=getint();
        v[r].pb(mp(l,x));
    } f[0][0][0]=1;
    for(int i=0;i<n;i++){
        for(int a=0;a<=i;a++){
            for(int b=a;b<=i;b++){
                if(a==b and a) continue;
                // f[i][a][b]->f[i+1][a][b]/f[i+1][a][i]/f[i+1][b][i] 
                if(ok(i+1,a,b)) (f[i+1][a][b]+=f[i][a][b])%=mod;//,printf("i+1=%d,a=%d,b=%d\n",i+1,a,b);
                if(ok(i+1,a,i)) (f[i+1][a][i]+=f[i][a][b])%=mod;//,printf("i+1=%d,a=%d,i=%d\n",i+1,a,i);
                if(ok(i+1,b,i)) (f[i+1][b][i]+=f[i][a][b])%=mod;//,printf("i+1=%d,b=%d,i=%d\n",i+1,b,i);
            }
        }
    } int ans=0;
    for(int i=0;i<n;i++)
        for(int j=i;j<n;j++)
            (ans+=f[n][i][j])%=mod;
    printf("%d\n",ans);
    return 0;
}

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

int main() {
	int N,K,i,ans=0;
	cin >> N >> K;
	vector<int> data(N);
	
	for (i = 0; i < N; i++) {
		cin >> data[i];
	}

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

	for (i = 0; i < K; i++) {
		ans += data[i];
	}
	
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3628
import java.util.Scanner;

/**
 * @program: leetcode
 * @description:
 * @author: wangtengke
 * @create: 2019-06-16
 **/
public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int a = scanner.nextInt();
        int b = scanner.nextInt();
        int c = scanner.nextInt();
        int max = Math.max(a, Math.max(b, c));
        System.out.println(a+b+c-max);
    }
   

}


Measured memory_bytes: 23636
s = input()
x,y = map(int,input().split())
 
X = []
Y = []
flag = 0
tmp = 0
for i in s:
    if i == "T":
        if flag == 0:
            if tmp != 0:
                X.append(tmp)
            flag = 1
            tmp = 0
        else:
            if tmp != 0:
                Y.append(tmp)
            flag = 0
            tmp = 0
    else:
        tmp += 1
if tmp != 0:
    if flag == 0:
        X.append(tmp)
    else:
        Y.append(tmp)

if s[0] !="T":
    tmpX = X[0]
    del X[0]
else:
    tmpX = 0

X = sorted(X)
Y = sorted(Y)
sumX = sum(X)
sumY = sum(Y)
tmpY = 0
 
ans = 0
 
if (x+sumX-tmpX)%2 == 1:
    ans = 1
else:
    mokuhyoX = (x+sumX-tmpX)//2
if (y+sumY-tmpY)%2 == 1:
    ans = 1
else:
    mokuhyoY = (y+sumY-tmpY)//2
if ans == 0:
	if mokuhyoX < 0 or mokuhyoY < 0:
	    ans = 1

# mokuhyoX
if ans == 0:
    dpX = [[False]*(mokuhyoX+1) for _ in range(len(X)+1)]
    dpX[0][0] = True
    for i in range(len(X)):
        for j in range(mokuhyoX+1):
            dpX[i+1][j] = dpX[i+1][j] or dpX[i][j]
            if j >= X[i]:
                dpX[i+1][j] = dpX[i+1][j] or dpX[i][j-X[i]]
    
    
# mokuhyoY
if ans == 0:
    dpY = [[False]*(mokuhyoY+1) for _ in range(len(Y)+1)]
    dpY[0][0] = True
    for i in range(len(Y)):
        for j in range(mokuhyoY+1):
            dpY[i+1][j] = dpY[i+1][j] or dpY[i][j]
            if j >= Y[i]:
                dpY[i+1][j] = dpY[i+1][j] or dpY[i][j-Y[i]]
 
if ans==0:
    if dpX[len(X)][mokuhyoX] == dpY[len(Y)][mokuhyoY] == True:
        ans = 0
    else:
        ans = 1
    
if ans == 1:
    print("No")
else:
    print("Yes")



Measured memory_bytes: 99932
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  vector<int> a(n);
  int x=0;
  for(int i=0;i<n;i++){
    cin>>a.at(i);
    x^=a.at(i);
  }
  for(int i=0;i<n;i++)
    cout<<(x^a.at(i))<<(i+1<n?" ":"");
  cout<<endl;
}

Measured memory_bytes: 4000
import qualified Data.ByteString.Lazy.Char8 as B
import Data.Maybe (fromJust)

main :: IO ()
main = B.interact
  $ B.pack
  . show
  . solve
  . map (fst . fromJust . B.readInt)
  . B.words

solve :: [Int] -> Int
solve (n:as) = -n + sum as


Measured memory_bytes: 1020
while True:
    m, f, r = map(int, input().split())
    if m == f == r == -1:
        break
    if m == -1 or f == -1 or m+f < 30:
        print("F")
    elif m+f >= 80:
        print("A")
    elif m+f>= 65:
        print("B")
    elif m+f>= 50 or (m+f>=30 and r>=50):
        print("C")
    elif m+f>= 30:
        print("D")


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

#define FOR(i,a,b) for(int i = (a); i < (b); ++i)
#define REP(i,n) FOR(i,0,n)
using ll = long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vvvi = vector<vector<vector<int>>>;
using mii = map<int, int>;
using msi = map<string, int>;
using pii = pair<int, int>;

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

    int n, m;
    cin >> n >> m;
    vi v;
    int ans = 1;
    // mの約数を列挙して，n以下の最大のものが答え．
    for(int i = 1; i * i <= m; ++i) {
        if(m % i != 0) continue;
        int j = m / i;
        if((ll)i * n <= m) ans = max(ans, i);
        if((ll)j * n <= m) ans = max(ans, j);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
     vector<char> s(4);
     for(int i = 0;i < 4;i++) cin >> s[i];
     int ans = 0;
     for(int i = 0;i < 4;i++){
          if(s[i] == '+' ) ans++;
          else if(s[i] == '-' ) ans--;
     }
     cout << ans << endl;
}

Measured memory_bytes: 256
/*===============================================================
*  Filename：a.cpp
*  Author：zhuyutian
*  Date：2016年11月06日
================================================================*/
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
const int N=100005;
int a,b,c;

int main()
{
	scanf("%d%d%d",&a,&b,&c);
	if(a+b==c||a+c==b||b+c==a)
		puts("Yes");
	else 
		puts("No");
    return 0;
}


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


using namespace std;

unsigned long int h[space];

int main(){
	std:ios_base::sync_with_stdio(false);
	cin.tie(0);
	
	unsigned long int n,q;
	unsigned long int t,i,b,c,sum=0;
	
	cin>>n;
	
	for(i=0;i<space;i++)
		h[i]=0;
	
	for(i=0;i<n;i++){
		cin >> t;
		h[t]++;
		sum+=t;
	}
	cin>>q;
	
	for(i=0;i<q;i++)
	{
		cin>>b>>c;
		unsigned long int oc=h[b];
		if(oc > 0){
			sum-=oc*b;
			sum+=oc*c;
			h[b]=0;
			h[c]+=oc;
		}
		cout<<sum<<"\n";
	}
	
}

Measured memory_bytes: 4396
n = list(input())
ans = 0
sub = -1
for i in range(len(n)):
    if sub == n[i]:
        ans += 1
    else:
        sub = n[i]
        ans = 1
    if ans >= 3:
        break

if ans >= 3:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3060
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;

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

  double ans = 0;
  double ai;
  for (int i = 0; i < n; i++) {
    cin >> ai; 
    ans += 1./ai;
  }
  printf("%.10f", 1./ans);
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <utility>
#include <math.h>
#include <stack>
#include <queue>
#include <cstdio>

using namespace std;

int A[200010];
vector<int> a_copy;

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


    for (int i = 0; i < N; ++i) {
        int a;
        cin>>a;
        A[i] = a;
        a_copy.push_back(a);
    }

    sort(a_copy.begin(), a_copy.end(),std::greater<int>());

    if(a_copy[0]==a_copy[1]){
        for (int i = 0; i < N; ++i) {
            cout<<a_copy[0]<<endl;
        }
        return 0;
    }else{
        int max_index;
        int max_temp = -1;

        for (int i = 0; i < N; ++i) {
            if(max_temp<A[i]){
                max_temp = A[i];
                max_index = i;
            }
        }

        for (int i = 0; i < N; ++i) {
            if(i == max_index){
                cout<<a_copy[1]<<endl;
            }else{
                cout<<a_copy[0]<<endl;
            }
        }

        return 0;

    }


    return 0;
}

Measured memory_bytes: 3316
#pragma region
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <map>
#include <queue> 
#include <stack>
#include <set>
#include <list>

using namespace std;
typedef long long ll;
//#define rep(i, s, e) for (int(i) = (s); (i) < (e); ++(i))
#define rep(i, e) for (int(i) = 0; (i) < (e); ++(i))
#define rrep(i, s) for (int(i) = (s) - 1; (i) >= 0; --(i))
#define all(x) x.begin(),x.end()
#pragma endregion


int main()
{
	vector<int> a(3);
	rep(i, 3)cin >> a[i];
	sort(all(a));
	if (a[0] == a[1] && a[1] != a[2])cout << "Yes" << endl;
	else if (a[0] != a[1] && a[1] == a[2])cout << "Yes" << endl;
	else cout << "No" << endl;
}

Measured memory_bytes: 256
n = int(input())

xyss = [[] for i in range(n)]

for i in range(n):
  num_a = int(input())
  for j in range(num_a):
    x, y = [int(i) for i in input().split()]
    xyss[i].append([x, y])

cnt = 0

for i in range(2 ** n - 1, 0, -1):
  b = format(i, '0' + str(n) + 'b')
  ok = True

  for j in range(n):
    if b[j] == "0":
      continue
    
    for xy in xyss[j]:
      x, y = xy[0], xy[1]
      if b[x - 1] != str(y):
        ok = False
        continue
  
  if ok == True:
    num = sum([int(s) for s in list(b)])
    if cnt < num:
      cnt = num
  
print(cnt)


Measured memory_bytes: 3192
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <climits>
#include <random>
#include <iomanip>

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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

// #define amari(x) ((x) % 1000000007)
#define amari(x) ((x) % 998244353)

#define fillInt(xs, x)        \
  for (int i = 0; i < (x); i++) \
    scanf("%d", &xs[i]);
#define fillLong(xs, x)       \
  for (int i = 0; i < (x); i++) \
    scanf("%ld", &xs[i]);
#define fillString(xs, x)       \
  for (int i = 0; i < (x); i++) \
    cin >> xs[i];
#define sortv(xs) sort(xs.begin(), xs.end())
#define sortvdi(xs) sort(xs.begin(), xs.end(), std::greater<int>())
#define lbv(xs, x) lower_bound(xs.begin(), xs.end(), x) - xs.begin()
#define ubv(xs, x) upper_bound(xs.begin(), xs.end(), x) - xs.begin()
#define bs(xs, x) binary_search(xs.begin(), xs.end(), x)

#define rep(i,n) for(long i=0; i<(n); i++)
#define isValidPoint(x, y, mx, my) x >= 0 && x  < mx && y >= 0 && y < my

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

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

  long n, m;

  cin >> n >> m;

  long mi = 1;
  long ma = n;

  rep(i, m) {
    long l, r;
    cin >> l >> r;
    mi = max(mi, l);
    ma = min(ma, r);
  }

  cout << max(0L, ma-mi+1) << endl;
}


Measured memory_bytes: 888
import scipy.optimize

L = int(input())

func = lambda x: -1 * (x[0] * x[1] * (L - x[0] - x[1]))

res = scipy.optimize.minimize(func, (0.1 ,0.2), bounds = ((0, None), (0, None)), tol=1e-6)

print(-1 * res.fun)

Measured memory_bytes: 29620
use std::io::*;
use std::str::FromStr;
use std::cmp;

fn main() {
    let a: [i16; 2] = [read(), read()];
    let b: [i16; 2] = [read(), read()];

    let l = cmp::max(a[0], b[0]);
    let r = cmp::min(a[1], b[1]);

    println!("{}", cmp::max(0, r - l));
}

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


Measured memory_bytes: 4352
#include <iostream>
#define max(a,b) a > b ? a : b
#define int long long int
#define lowbit(x) (x&-x)
using namespace std;
int bit[200005] , a[200005] , h[200005], n, mx, t;
void modify(int pos, int val){
	for(int i = pos ; i <=  n ; i += lowbit(i))
		bit[i] = max(bit[i], val);
}
int query(int pos){
	int ans = 0;
	for(int i = pos ; i > 0 ; i -= lowbit(i))
		ans = max(ans,bit[i]);
	return ans;
}
signed main(){
  	ios_base::sync_with_stdio(0); cin.tie(0);
	cin >> n;
	for(int i = 0 ; i < n ; i++) cin >> h[i];
	for(int i = 0 ; i < n ; i++) cin >> a[i];
	for(int i = 0 ; i < n ; i++){
		t = query(h[i]-1);
		modify(h[i], t + a[i]);
		mx = max(mx, t + a[i]);
	}
	cout << mx << endl;
}

Measured memory_bytes: 7820
/*
    ThunderClap and Flash.
    Raunaq Singh
*/
#include <bits/stdc++.h> 
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pll;
#define ThunderClap ios::sync_with_stdio(0),cin.tie(NULL),cout.tie(NULL);
#define debugg(something)   cout<<#something<<" - "<<something<<"\n";
#define vi vector
#define umap unordered_map
#define uset unordered_set
#define mset multiset
#define LB lower_bound
#define UB upper_bound
#define mp make_pair
#define pb push_back
#define in insert
#define s second
#define f first
#define pQueue priority_queue
#define maxElement *max_element
#define minElement *min_element
#define MAX 100000LL
#define mod 1000000007LL
#define inf 1000000000000000000LL
#define mI2 500000004LL
inline ll add(ll a, ll b){ return ((a%mod)+(b%mod))%mod;}
inline ll mul(ll a, ll b){ return ((a%mod)*(b%mod))%mod;}
inline ll sub(ll a, ll b){ return ((a%mod)-(b%mod)+mod)%mod;}

void Flash(){
    string s;
    cin>>s;
    ll a=0,b=0;
    for(auto it:s){
        if(it=='A'){
            ++a;
        }else{
            ++b;
        }
    }
    if(a>0 && b>0){
        cout<<"Yes\n";
    }else{
        cout<<"No\n";
    }
}

int main(int argc, char const *argv[]){
    ThunderClap;
    ll t=1;
    //cin>>t;
    for(ll i=1;i<=t;i++){
        //cout<<"Case #"<<i<<": ";
        Flash();
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cmath>
#include <string>
#include <vector>
#include <cstdlib>
#include <map>
#include <queue>
#include <deque>
#include <algorithm>
#include <stack>
#include <functional>
#include <sstream>
#define rep(i,j,n) for(i=j;i<(n);i++)
#define rrep(i,j,n) for(i=(n)-1;i>j-1;i--)
typedef long long int lli;
#define N 1000000007
#define M 998244353

using namespace std;

struct trader{
    
    vector<lli> vec;
    
    trader(lli n){
        lli i,a;
        rep(i,0,n){
            cin>>a;
            vec.push_back(a);
        }
    }
    
    lli trading(lli p){
        lli i,t=0;
        string s="down";
        rep(i,0,vec.size()){
            if(i!=vec.size()-1){
                if(s=="down"&&vec[i]<vec[i+1]){
                    t=p/vec[i];
                    p%=vec[i];
//                    cout<<"株を"<<t<<"枚購入し、残金は"<<p<<"円"<<endl;
                    s="up";
                }
                else if(s=="up"&&vec[i]>vec[i+1]){
                    p+=t*vec[i];
//                    cout<<"株を"<<t<<"枚売却し、残金は"<<p<<"円"<<endl;
                    s="down";
                }
            }
            else{
                if(s=="up"){
                    p+=t*vec[i];
//                    cout<<"株を"<<t<<"枚売却し、残金は"<<p<<"円"<<endl;
                }
            }
        }
        return p;
    }
    
};

int main(){
    lli n,ans,p=1000;
    lli i,j;
    cin>>n;
    trader trade(n);
    ans=trade.trading(p);
    cout<<ans<<endl;
}


Measured memory_bytes: 3608
#pragma warning(disable:4996)

#include <stdio.h>
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <cmath>
#include <map>
#include <set>
#include <queue>
#include <complex>
#include <iterator>
#include <random>
#include <time.h>
#include <tuple>
#include <functional>
#include <list>
#include <limits.h>
#define mp make_pair
#define ni(x) scanf("%d", &(x))
#define nii(x,y) scanf("%d%d",&(x),&(y))
#define mul(x,y) ((ll)(x)*(y)%mod)
#define mtp make_tuple
#define F(i,n) for(int i = 0; i < (n); i++)
#define FF(i,n) for(int i = 1; i <= (n); i++)
#define FE(i,n) for(int i = 0; i <= (n); i++)

#ifndef __GNUG__
int __builtin_popcount(int n) {
	int x = 0;
	while (n)n -= n&(-n), x++;
	return x;
}
#endif

using namespace std;
typedef pair<int, int> pii;
typedef long long ll;
const int mod = 1000000007;
const int inf = 2012345678;
const ll infl = 9012345678901234567;
const double pi = 3.1415926535897932384626433832795;
//----------------------------------------------------------------------------//

int main() {
#ifndef __GNUG__
	freopen("input.txt", "r", stdin);
#endif
	int n, a, b, c, d;
	ni(n);
	nii(a, b); nii(c, d);
	n--;
	ll L = (ll)n*c, R = (ll)n*d, dif = c + d;
	b -= a;
	for (int i = 0; i <= n; i++) {
		if (b >= L - i*dif && b <= R - i*dif)return puts("YES"), 0;
	}
	puts("NO");
	return 0;
}


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

namespace testing
{
    class Program
    {

        static void Main(string[] args)
        {
            int[] a = Console.ReadLine().Split().Select(int.Parse).ToArray();
            if (a[0] <= 9 && a[1] <= 9) { Console.WriteLine(a[0]*a[1] ); }
            else { Console.WriteLine("-1"); }
        }
    }
}


Measured memory_bytes: 28296
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ABC169B
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine().Trim());
            List<ulong> x = new List<ulong>();
            var t = Console.ReadLine().Trim().Split(' ');
            for(int i=0;i<N;i++) {
                x.Add(ulong.Parse(t[i]));
                if(ulong.Parse(t[i]) == 0) {Console.WriteLine("0"); return; }
            }
            ulong c = 1ul;
            double c2 = 0.0;
            foreach(var k in x ){
                c2 += Math.Log10((double)k);
                if(c2 > 18.0) {Console.WriteLine("-1"); return; }
                c *= k;
                if(c > 1000000000000000000ul) {Console.WriteLine("-1"); return; }
            }
            Console.WriteLine(c);
//            Console.WriteLine(c2);
        }
    }
}


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

int main(){
  int N,X,d,cnt=0,ans=1;
  cin >> N >> X;
  for(int i=0;i<N;i++){
    cin >> d;
    cnt+=d;
    if(cnt>X){
      cout << ans << endl;
      break;
    }
    else
      ans++;
    if(i==N-1)
      cout << N+1 << endl;
  }
}

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

using namespace std;

int c[2005];

int main(void)
{
    int n,x,y;
    cin>>n>>x>>y;
    for(int i=1;i<x;++i){
        for(int j=i+1;j<x;++j) ++c[j-i];
        for(int j=x+1;j<y;++j) {
            int l = j-i;
            l = min(l,x-i+1+y-j);
            ++c[l];
        }
        for(int j=y+1;j<=n;++j) ++c[(x-i)+1+(j-y)];
    }
    for(int i=x+1;i<y;++i){
        for(int j=i+1;j<y;++j) {
            int l = j-i;
            l = min(l,i-x+1+y-j);
            ++c[l];
        }
        for(int j=y+1;j<=n;++j) {
            int l = j-i;
            l = min(l,j-y+1+i-x);
            ++c[l];
        }
    }
    for(int i=y+1;i<=n;++i)
        for(int j=i+1;j<=n;++j) ++c[j-i];
    for(int i=1;i<x;++i) ++c[x-i], ++c[x-i+1];
    for(int i=x+1;i<y;++i) {
        int l = i-x;
        l = min(l,y-i+1);
        ++c[l];
        l = y-i;
        l = min(l,i-x+1);
         ++c[l];
    }
    for(int i=y+1;i<=n;++i) ++c[1+(i-y)], ++c[i-y];
    ++c[1];
    for(int i=1;i<n;++i) cout<<c[i]<<'\n';
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <iomanip>

using namespace std;

int main () {
    while (true) {
        // input
        int n;
        cin >> n;
        if (n == 0) break;
        
        int arr[1000];
        for (int i=0; i<n; i++) {
            int s;
            cin >> s;
            arr[i] = s;
        }

        // solve
        int sum = 0;
        double m, sum2 = 0, alpha2, alpha;
        for (int i=0; i<n; i++) {
            sum += arr[i];
        }
        m = double(sum) / n;
        for (int i=0; i<n; i++) {
            sum2 += pow( arr[i] - m, 2 );
        }
        alpha2 = sum2 / n;
        alpha = sqrt(alpha2);

        // output
        cout << fixed;
        cout << setprecision(5)
             << alpha << endl;
    }
}


Measured memory_bytes: 3224
#include <stdio.h>
int main(void){
    
    int a, b, c, x;
    scanf("%d %d %d", &a, &b, &c);
    
    if(a>b){
        x=a;
        a=b;
        b=x;
    }
    
    if(b>c){
        x=b;
        b=c;
        c=x;
    }
    
    if(a>b){
        x=a;
        a=b;
        b=x;
    }
    
    printf("%d %d %d\n", a, b, c);
    
return 0;

}



Measured memory_bytes: 2044
import string
abc=string.ascii_uppercase
abc_l=[abc[i] for i in range(26)]
n=int(input())
a=input()
a_l=[a[_] for _ in range(len(a))]
for i in range(len(a)):
	new_index=(n+abc_l.index(a_l[i]))%26
	a_l[i]=abc_l[new_index]
print(''.join(a_l))

Measured memory_bytes: 3900
#include <iostream>
#include <sstream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>

using namespace std;

#define FOR(i,k,n) for(int i=(k); i<(int)n; ++i)
#define REP(i,n) FOR(i,0,n)
#define FORIT(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
typedef pair<int,int> P;

int main(){
  int n,m;
  while(cin>>n>>m,n){
    vector<int> v(n);
    REP(i,n)cin>>v[i];
    vector<int> a(n);
    REP(i,n)a[i] = (m/v[i]) * v[i];
    vector<P> ck(n);
    REP(i,n)ck[i] = P(a[i],v[i]);
    sort(ck.begin(), ck.end());
    if(ck[0] != ck[1]){
      REP(i,n)if(ck[0] == P(a[i],v[i])){
        cout<<i+1<<endl;
        break;
      }
    }else{
      cout<<n<<endl;
    }
  }
  return 0;
}

Measured memory_bytes: 0
//#define __USE_MINGW_ANSI_STDIO 0
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<int, int> PII;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define IN(a, b, x) (a<=x&&x<b)
#define MP make_pair
#define PB push_back
#define MOD 1000000007
#define INF (1LL<<30)
#define LLINF (1LL<<60)
#define PI 3.14159265359
#define EPS 1e-12
#define int ll

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

int d[510][510];
signed main(void)
{
  int H, W, h, w;
  cin >> H >> W >> h >> w;
  if(h == 1 && w == 1) {
    cout << "No" << endl;
    return 0;
  }
  const int M = 100000000;
  REP(i, H) REP(j, W) d[i][j] = 1;
  for(int i=h-1; i<H; i+=h) {
    for(int j=w-1; j<W; j+=w) {
      d[i][j] = -h*w - 100000000;
    }
  }
  for(int i=0; i<H; i+=h) {
    for(int j=0; j<W; j+=w) {
      d[i][j] = 100000001;
    }
  }

  ll sum = 0;
  REP(i, H) REP(j, W) {
    if(d[i][j] < -1000000000 || d[i][j] > 1000000000) assert(false);
    sum += d[i][j];
  }
  if(sum > 0) {
    cout << "Yes" << endl;
    REP(i, H) {
      REP(j, W) {
        cout << d[i][j];
        if(j != W-1) cout << " ";
      }
      cout << endl;
    }
  } else {
    cout << "No" << endl;
  }

	return 0;
}


Measured memory_bytes: 4736
#include <stdio.h>
#include <string.h>
#define LEN 100005
 
typedef struct pp {
  char name[100];
  int t;
} P;
 
P Q[LEN];
int head, tail, n;
 
void enqueue(P x) {
  Q[tail] = x;
  tail = (tail + 1) % LEN;
}
 
P dequeue() {
  P x = Q[head];
  head = (head + 1) % LEN;
  return x;
}
 
int min(int a,int b) {
  return a < b ? a : b; 
}
 
int main() {
  int elaps = 0, c;
  int i, q;
  P u;
  char str[64];
  
  scanf("%d %d",&n ,&q);
  for(i=1; i<=n; i++) {
    scanf("%s", Q[i].name);
    scanf("%d", &Q[i].t);
  }
  head = 1; tail = n + 1;
 
  while(head != tail) {
    u = dequeue();
    c = min(q, u.t);
    u.t -= c;
    elaps += c;
    if(u.t > 0) enqueue(u);
    else {
      printf("%s %d\n",u.name,elaps);
    }
  }
  return 0;
}


Measured memory_bytes: 11844
#include <cstdio>
#include<iostream>
#include<map>
#include<algorithm>
#include<vector>
#include <cmath>
#include <iomanip>
#include <regex>
#include <bits/stdc++.h>
#include <string>
using namespace std;
using ll = long long;

int main(){
    int N;
    cin>>N;
    string S[N];
    for(ll i=0;i<N;i++){
        cin>>S[i];
    }
    map<char,ll> mp[N];
    for(ll i=0;i<N;i++){
        for(ll j=0;j<S[i].length();j++){
            mp[i][S[i][j]] ++;
        }
    }
    for(auto p:mp[0]){
        ll _min=9999999;
        for(ll i=0;i<N;i++){
            _min = min(_min,mp[i][p.first]);
        }
        for(ll i=0;i<_min;i++){
            cout<<p.first;
        }
    }
    cout<<endl;

}


Measured memory_bytes: 384
import java.util.*;

class Main {


	public static void main(String args[]){
		Scanner in = new Scanner(System.in);
		for(;;){
			int n = in.nextInt(), m = in.nextInt();
			if(n==0 && m==0) break;
			System.out.println(solve(n,m));
		}
	}

	static int solve(int n, int m){
		Vector<Integer> ns = new Vector<Integer>(), ms = new Vector<Integer>();
		for(int i=1; i*i<=n; i++){
			if(n%i==0) ns.add(new Integer(i));
		}
		for(int j=1; j*j<=m; j++){
			if(m%j==0) ms.add(new Integer(j));
		}
		int ans = 1<<29;
		int fs[] = new int[4];
		for(int i=0; i<ns.size(); i++)
			for(int j=0; j<ms.size(); j++){
				fs[0] = ns.get(i).intValue();
				fs[1] = n/fs[0];
				fs[2] = ms.get(j).intValue();
				fs[3] = m/fs[2];
				Arrays.sort(fs);
				int t=0;
				for(int k=0; k<3; k++)
					t += (fs[k+1] - fs[k])*(fs[k+1] - fs[k]);
				if(t < ans) ans = t;
			}
		
		return ans;
	}
}

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

using namespace std;

uint64_t a[100'000];
vector<int> answer;

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

    int idx = -1;
    for (int i = 0; i < N - 1; i++)
    {
        if (a[i] + a[i + 1] >= L)
        {
            idx = i;
        }
    }
    if (idx == -1)
    {
        cout << "Impossible" << endl;
        return 0;
    }

    answer.push_back(idx);
    for (int i = idx + 1; i < N - 1; i++)
    {
        answer.push_back(i);
    }
    for (int i = idx - 1; i >= 0; i--)
    {
        answer.push_back(i);
    }

    cout << "Possible" << endl;
    for (auto it = answer.rbegin(); it != answer.rend(); it++)
    {
        cout << *it + 1 << endl;
    }

    return 0;
}

Measured memory_bytes: 2168