akhauriyash/Code-Regression huggingface dataset:
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <unordered_map>
#include <climits>
#include <set>
#include <unordered_set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
#include <random>
#include <complex>
#include <regex>
#include <locale>
#include <random>

using namespace std;

#define SHOW_VECTOR(v) {std::cerr << #v << "\t:";for(const auto& xxx : v){std::cerr << xxx << " ";}std::cerr << "\n";}
#define SHOW_MAP(v){std::cerr << #v << endl; for(const auto& xxx: v){std::cerr << xxx.first << " " << xxx.second << "\n";}}

//_(＾～＾ ｣ ∠)_

using LL = long long;

int main() {

    int N, M;
    cin >> N >> M;

    //b[i] = iを作るときに使うマッチの数
    vector<int> b = {0, 2, 5, 5, 4, 5, 6, 3, 7, 6};

    vector<int> A(M);
    for (int i = 0; i < M; i++) cin >> A[i];
    sort(A.rbegin(), A.rend());

    //dp[i] = 丁度i本使うとき、最大作れる桁数
    vector<int> dp(N + 100, -1);

    //dp[0] = 丁度0本使う時、最大作れる桁数は0
    dp[0] = 0;
    for (int i = 0; i <= N; i++) {
        if (dp[i] >= 0) {
            for (int j = 0; j < M; j++) {
                dp[i + b[A[j]]] = max(dp[i + b[A[j]]], dp[i] + 1);
            }
        }
    }

    SHOW_VECTOR(dp);
    string ans = "";
    int remain = N;
    while (remain > 0) {
        for (int i = 0; i < M; i++) {
            if (remain - b[A[i]] >= 0 && dp[remain] - dp[remain - b[A[i]]] == 1) {
                ans += (char) ('0' + A[i]);
                remain -= b[A[i]];
                break;
            }
        }
    }

    cout << ans << endl;

    return 0;
}



























Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#define BUF_MAX 101

int main(void){
	char buf[BUF_MAX]; int i, count=0;
	
	while(~scanf("%s",buf)){
	
		for(i=0; i<strlen(buf)/2; i++)
			if(buf[i]!=buf[strlen(buf)-1-i]) break;
		
		if(i==strlen(buf)/2) count++;
	}
	
	printf("%d\n",count);
	
	return 0;
}

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

#define fo(i,s,t) for(int i = s; i <= t; ++ i)
#define fd(i,s,t) for(int i = s; i >= t; -- i)
#define go(i,s) for(int i = head[s]; i; i = e[i].next)
#define pb push_back
#define mp make_pair
#define pii pair<int,int>

const int maxn = 100050;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;

struct node
{
	int l, r;
	friend bool operator<(node a, node b){return a.l != b.l ? a.l < b.l : a.r < b.r;}
}seg[maxn];

int n, c, k, t[maxn];

int main()
{
	scanf("%d%d%d",&n,&c,&k);
	fo(i,1,n) scanf("%d",&t[i]);
	fo(i,1,n) seg[i].l = t[i], seg[i].r = t[i]+k;
	sort(seg+1,seg+n+1);
	int k = 1, r = seg[1].r, ned = 1;
	fo(i,2,n)
	{
		if(seg[i].l <= r)
		{
			if(k == c) k = 1, ++ ned, r = seg[i].r;
			else ++ k, r = min(r, seg[i].r);
		}
		else
		{
			k = 1; ++ ned; r = seg[i].r;
		}
	}
	printf("%d\n",ned);
	return 0;
}


Measured memory_bytes: 1408
/**
 * @copyright (c) 2020 Daisuke Hashimoto
 */

#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
using P = pair<int32_t, int32_t>;

struct Node {
  int32_t height{0};
  int32_t is_good{true};
  vector<int32_t> neighbour;
};

Node nodes[100000 + 1];

int main() {
  std::cin.tie(0);
  std::ios::sync_with_stdio(false);
  int32_t number_of_nodes, number_of_vertices;
  cin >> number_of_nodes >> number_of_vertices;
  for (int32_t index_node = 1; index_node <= number_of_nodes; ++index_node) {
    cin >> nodes[index_node].height;
  }
  for (int32_t index_vertex = 0; index_vertex < number_of_vertices; ++index_vertex) {
    int32_t from, to;
    cin >> from >> to;
    nodes[from].neighbour.push_back(to);
    nodes[to].neighbour.push_back(from);
  }
  for (int32_t index_node = 1; index_node <= number_of_nodes; ++index_node) {
    if (!nodes[index_node].is_good) {
      continue;
    }
    const int32_t number_of_neighbours = nodes[index_node].neighbour.size();
    for (int32_t neighbour = 0; neighbour < number_of_neighbours; ++neighbour) {
      int32_t index_neighbour = nodes[index_node].neighbour[neighbour];
      if (nodes[index_node].height <= nodes[index_neighbour].height) {
        nodes[index_node].is_good = false;
      }
    }
    if (nodes[index_node].is_good) {
      for (int32_t neighbour = 0; neighbour < number_of_neighbours; ++neighbour) {
        int32_t index_neighbour = nodes[index_node].neighbour[neighbour];
        nodes[index_neighbour].is_good = false;
      }
    }
  }

  int32_t number_of_good_nodes = 0;
  for (int32_t index_node = 1; index_node <= number_of_nodes; ++index_node) {
    if (nodes[index_node].is_good) {
      ++number_of_good_nodes;
    }
  }
  cout << number_of_good_nodes << endl;

  return 0;
}


Measured memory_bytes: 9544
#![allow(non_snake_case)]
#![allow(dead_code)]
#![allow(unused_macros)]
#![allow(unused_imports)]

use std::str::FromStr;
use std::io::*;
use std::collections::*;
use std::cmp::*;

struct Scanner<I: Iterator<Item = char>> {
    iter: std::iter::Peekable<I>,
}

macro_rules! exit {
    () => {{
        exit!(0)
    }};
    ($code:expr) => {{
        if cfg!(local) {
            writeln!(std::io::stderr(), "===== Terminated =====")
                .expect("failed printing to stderr");
        }
        std::process::exit($code);
    }}
}

impl<I: Iterator<Item = char>> Scanner<I> {
    pub fn new(iter: I) -> Scanner<I> {
        Scanner {
            iter: iter.peekable(),
        }
    }

    pub fn safe_get_token(&mut self) -> Option<String> {
        let token = self.iter
            .by_ref()
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        if token.is_empty() {
            None
        } else {
            Some(token)
        }
    }

    pub fn token(&mut self) -> String {
        self.safe_get_token().unwrap_or_else(|| exit!())
    }

    pub fn get<T: FromStr>(&mut self) -> T {
        self.token().parse::<T>().unwrap_or_else(|_| exit!())
    }

    pub fn vec<T: FromStr>(&mut self, len: usize) -> Vec<T> {
        (0..len).map(|_| self.get()).collect()
    }

    pub fn mat<T: FromStr>(&mut self, row: usize, col: usize) -> Vec<Vec<T>> {
        (0..row).map(|_| self.vec(col)).collect()
    }

    pub fn char(&mut self) -> char {
        self.iter.next().unwrap_or_else(|| exit!())
    }

    pub fn chars(&mut self) -> Vec<char> {
        self.get::<String>().chars().collect()
    }

    pub fn line(&mut self) -> String {
        if self.peek().is_some() {
            self.iter
                .by_ref()
                .take_while(|&c| !(c == '\n' || c == '\r'))
                .collect::<String>()
        } else {
            exit!();
        }
    }

    pub fn peek(&mut self) -> Option<&char> {
        self.iter.peek()
    }
}

trait Joinable {
    fn join(self, sep: &str) -> String;
}

impl<U: ToString, T: Iterator<Item = U>> Joinable for T {
    fn join(self, sep: &str) -> String {
        self.map(|x| x.to_string()).collect::<Vec<_>>().join(sep)
    }
}
fn main() {
    let cin = stdin();
    let cin = cin.lock();
    let mut sc = Scanner::new(cin.bytes().map(|c| c.unwrap() as char));
    let N: f64 = sc.get();
    if N as usize % 2 == 0 {
        println!("{}", N/(2.*N));
    } else {
        println!("{}", (N+1.)/(2.*N));
    }
}


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

int main() {
    vector<long long> v(3);
    for (int i = 0; i < 3; ++i) cin >> v[i];

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

    if (v[2] % 2 == 0) cout << 0 << endl;
    else cout << v[0] * v[1] << endl;
}

Measured memory_bytes: 256
def kakuinowa(x):
    y=0
    for i in range(5):
        y+=(x%(10**(i+1)))//(10**i)
    return(y)
n,a,b = list(map(int, input().strip().split()))
ans=0
for i in range(n+1):
    if a<=kakuinowa(i) and kakuinowa(i)<=b:
        ans+=i
print(ans)
    

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

using namespace std;
typedef long long ll;

int main() {
  ll n;
  cin >> n;
  
  ll min_rate = 10e9;
  ll max_profit = -10e9;
  while(n--) {
    ll i;
    cin >> i;
    max_profit = max(max_profit, i - min_rate);
    min_rate = min(min_rate, i);
  }

  cout << max_profit << endl;

  return 0;
}



Measured memory_bytes: 3108
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
vector <int> g[100001];
long long mx[100001];
int n,m;
void dfs(int u){
    if (mx[u]==0)
    for (auto i=g[u].begin();i!=g[u].end();++i){
        if (mx[*i]==0) dfs(*i);
        mx[u]=max(mx[u],mx[*i]+1);
    }
}
int main()
{
    cin>>n>>m;
    int u,v;
    for (int i=0;i<m;++i){
        cin>>u>>v;
        g[u].push_back(v);
    }
    long long w=0;
    for (int i=1;i<=n;++i) dfs(i);
    for (int i=1;i<=n;++i) w=max(w,mx[i]);
    cout<<w;
}


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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
#define CLR(t,v) memset(t,(v),sizeof(t))
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}


int nextInt() { int x; scanf("%d", &x); return x;}

const int MAX_N = 512345;
ll A[MAX_N], B[MAX_N];

int main2() {
  int N = nextInt();
  REP(i, N) {
    A[i] = nextInt();
    B[i] = nextInt();
  }
  
  int idx = -1;
  int bb = -1;
  REP(i, N) if(A[i] > B[i]) {
    if (bb == -1 || bb > B[i]) {
      bb = B[i];
      idx = i;
    }
  }
  if (idx == -1) {
    cout << 0 << endl;
    return 0;
  }

  ll ans = 0;
  REP(i, N) if (i != idx) ans += B[i];
  cout << ans << endl;
  return 0;
}

int main() {
  for (;!cin.eof();cin>>ws)
    main2();
  return 0;
}


Measured memory_bytes: 4480
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
 
using namespace std;
 
typedef long long ll;
typedef unsigned long long u_ll;
typedef pair<int, int> pair_;
 
const int INF = 1001001001;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, -1, 0, 1};
int k;
 
int gcd(int a, int b){
    if(b == 0) return a;
 
    return gcd(b, a%b);
}
 
int main(){

    int a,b,c,d;
    int turn,winer;

    cin >> a >> b >> c >> d;
    turn=1;

    while(1){
        if(turn==1){
            c -= b;
            turn=0;
            if(c<=0) {
                winer=1;
                break;
            }
        }
        else {
            a -= d;
            turn=1;
            if(a<=0) {
                winer=0;
                break;
            }
        }
    }

    if(winer==1) cout<<"Yes";
    else cout << "No";

    return 0;
}

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

#define INF ((1<<30)-1)  //int32_t
#define MOD 1000000007
#define MOD2  

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

#define mkp make_pair
#define pb push_back

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



int main(){
    bool flag=true;
    ll ans=0,sum=0;

    int n;
    cin >>n;
    int a[n];

    cin >>a[0];
    for (int i = 1; i < n; i++){
        cin >>a[i];
        
        if(a[i] == a[i-1]){
            ans++;
            a[i]=INF;
        }
    }
    

    //cout <<fixed<<setprecision(16)<< << endl;
    cout << ans << endl;

    //if(flag)cout << "Yes" <<endl;
    //else cout << "No" <<endl;
    
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
    int n,k,a;
    cin>>n>>k;
    a=1;

    for (int i=0;i<n;i++) {
        if(a*2<a+k){
            a*=2;
        }
        else {
            a+=k;
        }
    }

    cout<<a<<endl;

}



Measured memory_bytes: 256
N = int(input())
A1 = list(map(int,input().split()))
A2 = list(map(int,input().split()))

l = []
sum = 0
sum1 = 0
ans = 0
for i in range(N):
    sum1 += A1[i]
    sum2 = 0
    for j in range(i,N):
        sum2 += A2[j]
    sum = sum1 + sum2
    ans = max(ans,sum)
print(ans)

Measured memory_bytes: 3064
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

//#define int long long
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
const double PI = acos(-1);
const double EPS = 1e-9;
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; } return false; }

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	string s; cin >> s;
	int sum(0); stack<int>s1; stack<pair<int, int>>s2;
	rep(i, 0, s.size()) {
		if (s[i] == '\\')s1.push(i);
		else if (s[i] == '/' && !s1.empty()) {
			int x = s1.top(); s1.pop();
			int a = i - x;
			sum += a;
			while (!s2.empty() && x < s2.top().first) {
				a += s2.top().second;
				s2.pop();
			}
			s2.push(make_pair(x, a));
		}
	}
	cout << sum << endl;
	vector<int>ans;
	while (!s2.empty()) {
		ans.emplace_back(s2.top().second);
		s2.pop();
	}
	reverse(all(ans));
	cout << ans.size();
	rep(i, 0, ans.size())cout << " " << ans[i];
	cout << endl;
	return 0;
}

Measured memory_bytes: 3268
#include <bits/stdc++.h>
using namespace std;
#define nin(n) int n; cin >> n;
#define kin(k) int k; cin >> k;
 
int main() {
  long long a,b,n;
  cin >> a >> b >> n;
  if(b<=n){
    cout << a*(b-1)/b;
  }
  else{
    cout << a*n/b;
  }
}
  

Measured memory_bytes: 3568
<?php
  fscanf(STDIN, "%d", $amout);  
  $array = explode(' ', fgets(STDIN));

  $nums = array();
  for($i=0 ; $i < $amout; $i++){
    $value = (int)$array[$i];
    $nums[] = $value;
    $nums[] = $value - 1;
    $nums[] = $value + 1;
  }

$tmpArray = array_count_values($nums);
ksort($tmpArray);

echo max($tmpArray);

Measured memory_bytes: 31216
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,l;
    cin>>n>>l;
    vector<string> vec;
    for(int i=0;i<n;i++){
        string st;
        cin>>st;
        vec.push_back(st);
    }
    sort(vec.begin(),vec.end());
    for(int i=0;i<n;i++){
        cout<<vec[i];
    }
    cout<<endl;
    return 0;
}

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

int main(){
string W;
  cin>>W;
  
  int count=0;
  bool ans=true;
  for(int i=0; i<W.size(); i++){
    for(int j=0; j<W.size(); j++){
     if(W[i]==W[j]){count++;}
    }
  if(count%2!=0){ans=false;}
    count=0;
  }
  
  if(!ans){cout<<"No"<<endl;}
  else{cout<<"Yes"<<endl;}
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<map>
#include<list>
#include<string>
#include<algorithm>
 
using namespace std;
 
int main() {
  long long n,m;
  cin >> n >> m;
  int ans=0;
  if(n>=2){
    ans += (n*(n-1))/2;
  }
  if(m>=2){
    ans += (m*(m-1))/2;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#define rep(i,n) for (int i = 0; i < (n); i++)
using namespace std;

int main() {
	int n, k;
	cin >> n >> k;
	vector<int> c(n, 0);
	rep(i, k) {
		int d;
		cin >> d;
		rep(i, d) {
			int a;
			cin >> a;
			c[a - 1] = 1;
		}
	}

	int count = 0;
	rep(i, n) {
		if (c[i] == 0) count++;
	}
	
	cout << count;
	return 0;
}

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

using namespace std;

typedef long long ll;

const ll INF = 1e15;
const ll MOD = 1e9 + 7; 

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

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

using namespace std;

int main() {
  int a, b;
  std::cin >> a >> b;
  if (a > 8 || b > 8) {
    std::cout << ":(" << std::endl;
  } else {
    std::cout << "Yay!" << std::endl;
  }
  return 0;
}


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define vi vector<int>
#define vivi vector<vector<int>>
const int INF = 1<<29;
typedef long long ll;

int main(){
  int N;cin >> N;
  ll S = 0,Sodd = 0;
  ll A[100000];rep(i, N){cin >> A[i];S += A[i];if(i%2)Sodd+=A[i];}
  ll ans[100000];
  ans[0] = S - 2 * Sodd;
  rep(i, N - 1)ans[i+1] = 2*A[i] - ans[i];
  rep(i, N)cout << ans[i] << ' ';
}


Measured memory_bytes: 2816
import java.util.*;
// warm-up
public class Main {

	static void solve() {
		Scanner sc = new Scanner(System.in);
		int X = sc.nextInt(), Y = sc.nextInt(), Z = sc.nextInt();
		System.out.println((X-Z)/(Y+Z));
		sc.close();		
	}

	public static void main(String args[]) {
		solve();
	}

}

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

const int inf = 1000000000000000LL;

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

signed main() {
	int n;
	cin >> n;
	int d;
	cin >> d;
	rep(i, n - 1) {
		int a;
		cin >> a;
		d = gcd(a, d);
	}
	cout << d << endl;
}

Measured memory_bytes: 256
/* ファイル名：ITP1_7_B.c	*/
/* 内容：1 から n までの数の中から、重複無しで３つの数を選びそれらの合計が x となる組み合わせの数を求める	*/

/* include	*/
#include <stdio.h>

/* 外部変数宣言	*/

/* プロトタイプ宣言	*/

/* 関数名:main	*/
/* 処理内容:1 から n までの数の中から、重複無しで３つの数を選びそれらの合計が x となる組み合わせの数を求める	*/
int main( void )
{
	/* 内部変数定義	*/
	/* 入力	*/
	int n;	/* 足し算に使われる最大の数	*/
	int x;	/* 目標の合計	*/
	
	/* 処理	*/
	int i;	/* ループ用変数1	*/
	int j;	/* ループ用変数2	*/
	int k;	/* ループ用変数3	*/
	
	/* 出力	*/
	int cnt;	/* 合計が x となる組み合わせの数	*/
	
	/* 無限ループ	*/
	while(1){
		cnt = 0;	/* カウントの初期化	*/
		
		scanf("%d %d",&n,&x);	/* nとxの取得	*/
		/* nとxに0が入力されたとき	*/
		if((n == 0)
		&& (x == 0)){
			break;	/* 処理を終了する	*/
		}
		else{
			/* 処理を続行する	*/
		}
		
		/* 1からnの中で、重複なしで3つの数を足していく*/
		for(i = 1; i <= n; i++){
			for(j = i + 1; j <= n; j++){
				for(k = j + 1; k <= n; k++){
					/* 合計がxとなる組み合わせだった場合	*/
					if((i + j + k) == x){
						cnt++;	/* カウントする	*/
					}
					/* 合計がxとなる組み合わせではなかった場合	*/
					else{
						/* 処理なし	*/
					}
				}
			}
		}
		
		printf("%d\n",cnt);	/* 合計が x となる組み合わせの数を出力*/
	}
	
	return 0;
}



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

typedef unsigned long long ull;

int main(){
  int A, B;
  cin >> A >> B;
  for(int i=1; i<=10000; i++){
    if (floor(i*0.08)==A && floor(i*0.1)==B){
      cout << i << endl;
      return 0;
    }
  }
  cout << -1 <<endl;
}

Measured memory_bytes: 256
n, m = map(int, input().split())
a = [list(map(int, input().split())) for _ in range(n)]
b = [int(input()) for _ in range(m)]
for i in range(n):
    c = 0
    for j in range(m):
        c += a[i][j] * b[j]
    print(c)


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

int main(){

int N, M, X, Y;
cin >> N >> M >> X >> Y;

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

vector<int>y(M);
for(int i = 0; i < M; i++){ 
     cin >> y[i];
}

sort(x.begin(), x.end());
sort(y.begin(), y.end());

int x_max = max(x[N - 1], X);
int y_min = min(y[0], Y);

if(y_min > x_max) cout << "No War" << endl;
else  cout << "War" << endl;



}


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

int main() {
  string s;
  cin >> s;
  if((s.at(5)=='0'&&s.at(6)=='4')||(s.at(5)=='0'&&s.at(6)=='3')||(s.at(5)=='0'&&s.at(6)=='2')||(s.at(5)=='0'&&s.at(6)=='1'))
     cout << "Heisei" << endl;
  else
    cout<<"TBD"<<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 str;
        String w="";
        while(sc.hasNext()){
            System.out.print(w);
            w=" ";
            str=sc.next();
            /*System.out.print(str+" ");*/
            for(int i=0;i<str.length();i++){
                char a=str.charAt(i);
                if (Character.isUpperCase(a)){
                    a+=32;
                }else if(Character.isLowerCase(a)){
                    a-=32;
                }
                System.out.print(a);
            }
            
        }
    System.out.println("");
    }
}


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

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,n) FOR(i,0,n)
#define RFOR(i,a,b) for(int i=(a)-1;i>=(b);i--)
#define rrep(i,n) RFOR(i,n,0)

using namespace std;
struct pdd{double x, y;};

typedef long long ll;
typedef unsigned long long ull;

double dist(pdd a, pdd b){
	double sqd = (a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y);
	return sqrt(sqd);
}

double calccos(double a, double b, double c){
	return (b*b + c*c - a*a) / (2*b*c);
}

double calcr(double l, double th1, double th2){
	return l / (2 + 1 / tan(th1 / 2) + 1 / tan(th2 / 2));
}

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

	pdd p1, p2, p3;
	cin >> p1.x >> p1.y;
	cin >> p2.x >> p2.y;
	cin >> p3.x >> p3.y;

	double l1, l2, l3;
	l1 = dist(p2, p3);
	l2 = dist(p1, p3);
	l3 = dist(p1, p2);

	double th1, th2, th3;
	th1 = acos(calccos(l1, l2, l3));
	th2 = acos(calccos(l2, l1, l3));
	th3 = acos(calccos(l3, l1, l2));

	double r1, r2, r3;
	r1 = calcr(l1, th2, th3);
	r2 = calcr(l2, th1, th3);
	r3 = calcr(l3, th1, th2);

	cout << fixed << setprecision(12) << max({r1, r2, r3}) << endl;
}


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

#define ll long long
#define all(x) (x).begin(), (x).end()
const long long INF = 1LL << 60;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)  //(i, 10) i=0～i=9まで
#define repr(i, n) for (int i = n; i >= 0; i--)   // (i, 10) i=10～i=0まで
#define FOR(i, m, n) for (int i = m; i < n; i++)  // (i, 3, 10) i=3～i=9まで

// 総数を1000000007で割った余り
const long long mod = 1e9 + 7;

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

    // 入力
    int a, b;
    cin >> a >> b;

    // 処理
    // 出力
    cout << ((a % 3 == 0 || b % 3 == 0 || (a + b) % 3 == 0) ? "Possible"
                                                            : "Impossible")
         << endl;
    return 0;
}


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

int getNumber( string& str, int* index )
{
	int ret = 0;
	while( *index < (int)str.size() ){
		if( str[ *index ] < '0' || str[ *index ] > '9' ){
			break;
		}
		ret *= 10;
		ret += ( str[ *index ] - '0' );
		++(*index);
	}
	return ret;
}

int rec( string& formula, int* index )
{
	int ret = 0;
	vector<int> num_list;
	vector<char> sign_list( 1, '.' );
	bool end = false;

	while( !end && *index < (int)formula.size() ){
		if( formula[ *index ] >= '0' && formula[ *index ] <= '9' ){
			num_list.push_back( getNumber( formula, index ) );
			continue;
		}else{
			switch( formula[ *index ] ){
				case '(':
					++(*index);
					num_list.push_back( rec( formula, index ) );
					break;
				case ')':
				case '=':
					++(*index);
					end = true;
					break;
				default:
					sign_list.push_back( formula[ *index ] );
					++(*index);
					break;
			}
		}
	}

	vector<int> num2_list;
	vector<char> sign2_list( 1, '.' );

	for( int i = 0; i < (int)num_list.size(); ++i ){
		int num = num_list[ i ];
		switch( sign_list[ i ] ){
			case '.':
				ret = num;
				break;
			case '*':
				ret *= num;
				break;
			case '/':
				ret /= num;
				break;
			default:
				num2_list.push_back( ret );
				ret = num;
				sign2_list.push_back( sign_list[ i ] );
				break;
		}
	}
	num2_list.push_back( ret );

	for( int i = 0; i < (int)num2_list.size(); ++i ){
		int num = num2_list[ i ];
		switch( sign2_list[ i ] ){
			case '.':
				ret = num;
				break;
			case '+':
				ret += num;
				break;
			case '-':
				ret -= num;
				break;
		}
	}

	return ret;
}

int solve( string& formula ){
	int index = 0;
	return (int)rec( formula, &index );
}

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

	for( int i = 0; i < n; ++i ){
		string formula;
		cin >> formula;
		cout << solve( formula ) << endl;
	}

	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a) for(int i = 0; i < (a); i++)
#define ALL(a) (a).begin(),(a).end()
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9;
const long long LINF = 1e18;
const long long MOD = 1e9 + 7;

/*
    SegmentTree<int> seg(f, def) のように宣言する
    RMQ の場合 : 
    auto f = [](int a, int b){return min(a, b);};
    int def = INF;
*/
template <typename Monoid>
struct SegmentTree{
    using F = function<Monoid(Monoid, Monoid)>;
    int n;
    vector<Monoid> dat;
    F f;
    Monoid def;

    SegmentTree(F f, Monoid def) : f(f), def(def) {}

    void build(const vector<Monoid> & vec){
        int siz = vec.size();
        n = 1;
        while(n < siz) n *= 2;
        dat.assign(2 * n - 1, def);
        for(int i = 0; i < siz; i++) dat[n - 1 + i] = vec[i];
        for(int i = n - 2; i >= 0; i--) dat[i] = f(dat[2 * i + 1], dat[2 * i + 2]);
    }

    void update(int k, Monoid x){
        k += (n - 1);
        dat[k] = x;
        while(k > 0){
            k = (k - 1) / 2;
            dat[k] = f(dat[2 * k + 1], dat[2 * k + 2]);
        }
    }

    Monoid query(int a, int b){
        return query(a, b, 0, 0, n);
    }

private:
    Monoid query(int a, int b, int k, int l, int r){
        if(r <= a || b <= l) return def;
        if(a <= l && r <= b) return dat[k];
        Monoid vl = query(a, b, 2 * k + 1, l, (l + r) / 2);
        Monoid vr = query(a, b, 2 * k + 2, (l + r) / 2, r);
        return f(vl, vr);
    }
};

/*
    vector<long long> a(n) を座圧する場合 : 
    auto v = compress(a);
    auto m = dict(v);
    i番目の要素の取り出し方 : 
    m[a[i]]
*/
template<typename T>
vector<T> compress(vector<T> vec){//ソートしてユニークを取ったvectorを返す
    sort(vec.begin(), vec.end());
    vec.erase(unique(vec.begin(), vec.end()), vec.end());
    return vec;
}

template<typename T>
map<T, int> dict(vector<T> & vec){//座圧する
    map<T, int> res;
    for(int i = 0; i < (int)vec.size(); i++){
        res[vec[i]] = i;
    }
    return res;
}

signed main(){
    int n;
    cin >> n;
    vector<ll> vec;
    ll mx = 0;
    ll t[n];
    double a[n];
    REP(i,n){
        cin >> t[i] >> a[i];
        a[i] = 1 - a[i] / 10.0;
        vec.emplace_back(t[i]);
    }
    int q;
    cin >> q;
    ll l[q], r[q];
    REP(i,q){
        cin >> l[i] >> r[i];
        vec.emplace_back(l[i]);
        vec.emplace_back(r[i]);
    }
    auto v = compress(vec);
    auto m = dict(v);
    auto f = [](double a, double b){return a * b;};
    SegmentTree<double> seg(f, 1.0);
    seg.build(vector<double> (m.size(), 1.0));
    REP(i,n){
        seg.update(m[t[i]], a[i]);
    }
    REP(i,q){
        printf("%.10lf\n", 1e9 * seg.query(m[l[i]], m[r[i]] + 1));
    }
    return 0;
}


Measured memory_bytes: 40056
#include <bits/stdc++.h>
#include <cassert>
typedef long long int ll;
using namespace std;


int main(int argc, char *argv[]) {
  // C-style stdio functions should not be used.
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << setprecision(20);

  string S; cin >> S;
  int m = (S.at(5) - '0') * 10 + (S.at(6) - '0');
  cout << ((m <= 4) ? "Heisei" : "TBD") << endl;

  return 0;
}



Measured memory_bytes: 256
N,K=map(int,input().split())
p=list(map(int,input().split()))
l=0
for i in range(K):
  l=l+(p[i]+1)/2
t=l
for i in range(N-K):
  l=l-(p[i]+1)/2+(p[i+K]+1)/2
  if l>t:
    t=l
print(t)

Measured memory_bytes: 71792
import math

S = input()
ans = [0 for i in range(len(S))]
count = idx = i = 0

while i < len(S):
    if S[i:i+2] == 'RL':
        idx = i
        ans[idx] += count//2+1
        ans[idx+1] += math.ceil(count/2)+1
        i += 2
        count = 0
    elif S[i:i+2] == 'LR':
        count += 1
        ans[idx] += math.ceil(count/2)
        ans[idx+1] += count//2
        count = 0
        i += 1
    else:
        count += 1
        i += 1

ans[idx] += math.ceil(count/2)
ans[idx+1] += count//2
print(' '.join(map(str, ans)))

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

int main(){
  double r;
  cin >> r;
  cout << fixed << setprecision(15) << 2*r*3.1415926535897932384626 << endl;
}

Measured memory_bytes: 3604
//============================================================================
// Name        : JOI.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
using namespace std;
int H,W;
char C[51][51];
int main() {
	cin>>H>>W;
	for(int i=0;i<H;i++){
		for(int j=0;j<W;j++){
			cin>>C[i][j];
		}
	}
	int S[51][51]={};
	for(int i=0;i<H;i++){
		for(int j=0;j<W;j++){
				if(C[i][j+1]=='#')S[i][j]++;
				if(C[i][j-1]=='#')S[i][j]++;
				if(C[i+1][j]=='#')S[i][j]++;
				if(C[i+1][j+1]=='#')S[i][j]++;
				if(C[i+1][j-1]=='#')S[i][j]++;
				if(C[i-1][j]=='#')S[i][j]++;
				if(C[i-1][j+1]=='#')S[i][j]++;
				if(C[i-1][j-1]=='#')S[i][j]++;
		}
	}

	for(int i=0;i<H;i++){
		for(int j=0;j<W;j++){
			if(C[i][j]=='.')cout<<S[i][j];
			if(C[i][j]=='#')cout<<'#';
		}
		cout<<endl;
	}

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <iomanip>
#include <vector>
#include <cstring>
#include <queue>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
ll MAX(ll a,ll b,ll c){return max(a,max(b,c));}
ll MIN(ll a,ll b,ll c){return min(a,min(b,c));}
const int dx[4] = {0,1,0,-1};
const int dy[4] = {1,0,-1,0};
template<class T> inline bool chmax(T &a,T& b){if(a < b){a = b; return true;} else return false;}
template<class T> inline bool chmin(T &a,T& b){if(a > b){a = b; return true;} else return false;}
int main(){
    ll a,b,c;
    cin >> a >> b >> c;
    ll counter = 0;
    if(a==b && b==c){
        if(a%2==1) counter = 0;
        else counter = -1;
    }
    else{
        while(true){
            if(a%2==0 && b%2==0 && c%2==0){
                ll na,nb,nc;
                na = ( b + c ) / 2; nb = ( a + c ) / 2; nc = ( a + b ) / 2;
                a = na; b = nb; c = nc;
                counter++;
            }
            else break;
        }
    }
    cout << counter << endl;
}

Measured memory_bytes: 256
import sys
from collections import deque


def main():
    n, m = map(int, sys.stdin.readline().split())

    to = [[] for _ in range(n + 1)]
    for _ in range(m):
        a, b = map(int, sys.stdin.readline().split())
        to[a].append(b)
        to[b].append(a)
    INF = float("inf")

    dist = [INF] * (n + 1)
    dist[1] = 0
    pre = [0] * (n + 1)
    que = deque([])
    que.append(1)

    while que:
        p = que.popleft()
        for i in to[p]:
            if dist[i] > dist[p] + 1:
                dist[i] = dist[p] + 1
                pre[i] = p
                que.append(i)

    print("Yes")
    for i in range(2, n + 1):
        print(pre[i])


if __name__ == "__main__":
    main()

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

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

    if(fmod(n,1.08) == 0){
        int ans = n/1.08;
        printf("%d",ans);
    }else{
        //printf("もどした :%d\n",(int)floor(ceil(n/1.08)*1.08));
        if((int)floor(ceil(n/1.08)*1.08) == n){
            printf("%d",(int)ceil(n/1.08));
        }else{
            printf(":(");
        }

    }
}

Measured memory_bytes: 3772
N = int(input())
A = input().split()
print(" ".join(A))
A = [int(l) for l in A]
for i in range(1,N):
    v = A[i]
    j = i-1
    while j>=0 and A[j] >v:
        A[j+1] = A[j]
        j -=1
    A[j+1] = v
    A = [str(l) for l in A]
    print(" ".join(A))
    A = [int(l) for l in A]


Measured memory_bytes: 5608
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 9223372036854775807;
const ll half_inf = 0x3f3f3f3f;
const ll inf = 0x7fffffff;
const ll mod = 1e9 + 7;
const ll maxn = 200005;
int ms[10][10]={0},b[10][10]={0};
int main(){  
	cin.tie(0);
    ios::sync_with_stdio(false);
	int T,n,m;
	//scanf("%d",&T);
	/*while(T--){
					
	}*/
	for(int i=1;i<=3;i++)
		for(int j=1;j<=3;j++)
			scanf("%d",&ms[i][j]);
	scanf("%d",&n);
	while(n--){
		scanf("%d",&m);
		for(int i=1;i<=3;i++)
			for(int j=1;j<=3;j++)
				if(ms[i][j]==m) b[i][j]=1;
	}
	int flag=0;
	for(int i=1;i<=3;i++){
		if(b[i][1]&&b[i][2]&&b[i][3]){
			flag=1;
			break;
		}
		if(b[1][i]&&b[2][i]&&b[3][i]){
			flag=1;
			break;
		}
		if(b[1][1]&&b[2][2]&&b[3][3]){
			flag=1;
			break;
		}
		if(b[1][3]&&b[2][2]&&b[3][1]){
			flag=1;
			break;
		}
	}
	
	if(flag) printf("Yes");
	else printf("No");
    return 0;
}


Measured memory_bytes: 256
n = int(input())
G = []
checked = [False for i in range(n + 1)]
d = [0 for i in range(n + 1)]
f = [0 for i in range(n + 1)]
G.append([])
for i in range(n):
    u, k, *v = map(int, input().split())
    G.append(v)

timestamp = 1

def dfs(id):
    global timestamp

    checked[id] = True
    d[id] = timestamp
    timestamp += 1
    for v in G[id]:
        if not checked[v]:
            dfs(v)
    f[id] = timestamp
    timestamp += 1

for id in range(1, n + 1):
    if not checked[id]:
        dfs(id)

for i in range(1, n + 1):
    print("{0} {1} {2}".format(i, d[i], f[i]))

Measured memory_bytes: 7748
#include<bits/stdc++.h>
using namespace std;
int main(){

   int a,b;
   cin>>a>>b;
   if((a==1 && b==2) || (b==1&& a==2)){
        cout<<3<<endl;
   }

   else if((a==2 && b==3) || (b==2&& a==3)){
        cout<<1<<endl;
   }
   else{
    cout<<2<<endl;
   }

}




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

using namespace std;

int main(){
	int a[26];
	string t;
	cin >> t;
        int count= 0;
for (int i=0;i<26;i++){
a[i]=0;
}

for (int i=0;i<t.size();i++){
a[t[i]-97]=1;
}
for (int i=0;i<26;i++){
if(a[i]==1) count++;
}

if(count==t.size()){cout << "yes" <<endl;}
else{cout << "no" <<endl;}

return 0;
}


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

int main() {
  int n;
  cin >> n;
  
  if (n > 81) {
    cout << "No" << endl;
    return 0;
  }
  for (int i = 1; i <= 9; i++) {
    for (int j = 1; j <= 9; j++) {
      if (i*j == n) {
        cout << "Yes" << endl;
        return 0;
      }
    }
  }
  cout << "No" << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cmath>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<functional>
#include<algorithm>
#include<cstdio>
#include<math.h>
#include<unordered_map>
using namespace std;
typedef long long ll;
typedef long double ld;
const long double pi= 3.14159265358979323846264338327950288;
char a[800][800];
const ll inf = 99999999999999;
int b[800][800];
struct Q {
	ll x, y;
};
int u1[4] = { 0,0,-1,1 }, u2[4] = { -1,1,0,0 };
signed main() {
	ll h, w, x, y, k;
	cin >> h >> w >> k;
	for (ll i = 0; i < h; i++) {
		string s;
		cin >> s;
		for (ll j = 0; j < w; j++) {
			a[i][j] = s[j];
			b[i][j] = inf;
			if (s[j] == 'S')
				x = j, y = i;
		}
	}
	queue<Q>q;
	q.push(Q{ x,y });
	b[y][x] = 0;
	ll ans = inf;
	while (!q.empty()) {
		Q t = q.front(); q.pop();
		if (t.y == 0 || t.y == h - 1 || t.x == 0 || t.x == w - 1) ans = 1;
		ans = min(ans, (ll)ceil(min(t.x, min(w - 1 - t.x, min(h - 1 - t.y, t.y)))*1.0 / k) + 1);
		for (int i = 0; i < 4; i++) {
			ll x = t.x + u1[i];
			ll y = t.y + u2[i];
			if (x < w&&x >= 0 && y < h&&y >= 0 && a[y][x] == '.'&&b[t.y][t.x] + 1 < b[y][x] && b[t.y][t.x] + 1 <= k) {
				q.push(Q{ x,y });
				b[y][x] = b[t.y][t.x] + 1;
			}
		}
	}
	cout << ans << endl;
	cin >> h;
}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll MOD = 1000000007;
const long long INF = 1LL << 60;

template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

int main()
{   
    int n,a; cin >> n >> a;
    if(n % 500 <= a)cout << "Yes" << endl;
    else cout << "No" << endl;
}
    

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

int main() {
    int N; cin >> N;
    char S[N]; for (int i = 0; i < N; ++i) cin >> S[i];

    ll r = 0, g = 0, b = 0;
    for (int i = 0; i < N; ++i) {
        if (S[i] == 'R') r++;
        if (S[i] == 'G') g++;
        if (S[i] == 'B') b++;
    }

    ll ans = r * g * b;
    
    for (int i = 0; i < N; ++i) {
        for (int j = i + 1; j < N; ++j) {
            if (S[i] == S[j]) continue;

            int k = j * 2 - i;
            if (k < N && S[i] != S[k] && S[j] != S[k]) ans--;
        }
    }

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

Measured memory_bytes: 3636
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <string>
#include <iostream>
using namespace std;

int main()
{
	string a,b;
	cin >> a >> b;
	int len = a.size();
	bool ans = 0;
	for (int i = 0;i < len;i++)
	{
		bool f = 0;
		for (int j = 0;j < len;j++)
		{
			if (a[j] != b[(j+i) % len]) f = 1;
		}
		if (!f) ans = 1;
	}
	if (ans) cout << "Yes";
	else cout << "No";
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<cctype>
using namespace std;
#define rep(i,n) for (int i=0;i<(n);i++)
#define all(v) (v).begin(),(v).end()
typedef long long int ll;
#define pi 3.1415926535897932384
#define E9 1000000000
#define eps 1e-4
#define pii pair<int,int>


int main(){
  int N; cin >> N;
  int h[N]; rep(i,N) cin >> h[i];

  bool flag = true;
  bool uno = false;
  rep(i,N){
    if (i>=1 && h[i]<=h[i-1]-2) flag = false;
    else if (i>=2 && h[i]==h[i-1]-1){
      if (uno) flag = false;
      else uno = true;
    }
    else if (i>=2 && h[i]>h[i-1]) uno = false;
    else continue;

  }
  cout << (flag ? "Yes" : "No")  << endl;


  

  // cout << fixed << setprecision(6);
  return 0;
}



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

int main() {
  int n;
  cin >> n;
  vector<vector<int>> d(n, vector<int> (2));
  rep(i, n) cin >> d.at(i).at(0) >> d.at(i).at(1);
  
  int cnt = 0;
  int ans = 0;
  bool flag = true;
  
  if(d.at(0).at(0) == d.at(0).at(1)){
  	cnt++;
    flag = true;
  }
  
  for(int i = 1; i < n; i++){
  	if(d.at(i).at(0) == d.at(i).at(1)){
      flag = true;
      cnt++;
    }
    else{
      flag = false;
      cnt = 0;
    }
    ans = max(cnt, ans);
  }
  
  if(ans >= 3) cout << "Yes" << endl;
  else cout << "No" << endl;
  
  //cout << ans << endl;
  
  return 0;
}



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

int main() {
  int N, K;
  cin >> N >> K;

  int result = 1;
  rep(i, N) {
    int tmp_a = result * 2;
    int tmp_b = result + K;
    result = (tmp_a > tmp_b) ? tmp_b : tmp_a;
  }
  cout << result << endl;
}



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

int main() {
  int n;
  int total = 0;
  int coins[] = {1, 5, 10, 50, 100, 500};
  for(int i = 0; i < 6; ++i) {
    cin >> n;
    total += n * coins[i];
  }
  cout<<  (total >= 1000) << endl;
  return 0;
}

Measured memory_bytes: 1164
#include <iostream>
using namespace std;
int main() {
    int A,B;
    cin >> A >> B;
    if(0 <= A && A <= 9 && 0 <= B && B <= 9){
        std::cout << A * B << std::endl;
    }else{

        std::cout << -1 << std::endl;
    }
    return 0;
}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        StringFormation solver = new StringFormation();
        solver.solve(1, in, out);
        out.close();
    }

    static class StringFormation {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            String s = in.next();

            StringBuilder sb = new StringBuilder();
            sb.append(s);

            int q = in.nextInt();
            boolean reverse = false;
            for (int i = 0; i < q; i++) {
                int type = in.nextInt();
                if (type == 1) {
                    reverse = !reverse;
                } else {
                    int ope = in.nextInt();
                    String f = in.next();

                    if (ope == 1) {
                        if (reverse) {
                            // add suffix
                            sb.append(f);
                        } else {
                            sb.insert(0, f);
                            // add prefix
                        }
                    } else {
                        if (reverse) {
                            // add prefix
                            sb.insert(0, f);
                        } else {
                            // add suffix
                            sb.append(f);
                        }
                    }
                }
            }
            if (reverse) {
                sb.reverse();
            }
            out.append(sb.toString());
        }

    }
}



Measured memory_bytes: 64764
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
//using System.Text;
//using System.Text.RegularExpressions;
//using System.Globalization;
//using System.Diagnostics;
using static System.Console;
//using System.Numerics;
//using static System.Math;
//using pair = Pair<int, int>;

class Program
{
    static void Main()
    {
        //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
        new Program().solve();
        Out.Flush();
    }
    Scanner cin = new Scanner();
    readonly int[] dd = { 0, 1, 0, -1, 0 }; //→↓←↑
    readonly int mod = 1000000007;
    void chmax<T>(ref T a, T b) where T : IComparable<T> { a = a.CompareTo(b) < 0 ? b : a; }
    void chmin<T>(ref T a, T b) where T : IComparable<T> { a = a.CompareTo(b) < 0 ? a : b; }

    void solve()
    {
        var S = cin.next;
        if (S.Contains('a') && S.Contains('b') && S.Contains('c'))
        {
            WriteLine("Yes");
        }
        else
        {
            WriteLine("No");
        }
    }

}

class Scanner
{
    string[] s; int i;
    char[] cs = new char[] { ' ' };
    public Scanner() { s = new string[0]; i = 0; }
    public string[] scan { get { return ReadLine().Split(); } }
    public int[] scanint { get { return Array.ConvertAll(scan, int.Parse); } }
    public long[] scanlong { get { return Array.ConvertAll(scan, long.Parse); } }
    public double[] scandouble { get { return Array.ConvertAll(scan, double.Parse); } }
    public string next
    {
        get
        {
            if (i < s.Length) return s[i++];
            string st = ReadLine();
            while (st == "") st = ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            i = 0;
            return next;
        }
    }
    public int nextint { get { return int.Parse(next); } }
    public long nextlong { get { return long.Parse(next); } }
    public double nextdouble { get { return double.Parse(next); } }
}

Measured memory_bytes: 13268
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
const int INF=1145141919,MOD=1e9+7;
const long long LINF=8931145141919364364,LMOD=998244353;
// const int dx[]={1,0,-1,0,1,1,-1,-1},dy[]={0,-1,0,1,1,-1,-1,1};

long long dp[5010];
int main(){
    string s; cin>>s;
    int n=s.size();
    int ansl=-1,ansr=-1;
    for(int r=1;r<n;r++){
        if(s[r]==s[r-1]){
            ansr=r+1;
            ansl=r;
            break;
        }
        if(r>1&&s[r]==s[r-2]){
            ansr=r+1;
            ansl=r-1;
            break;
        }
    }
    printf("%d %d\n",ansl,ansr);
    return 0;
}


Measured memory_bytes: 512
#include "bits/stdc++.h"
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a),i##_len=(b);i<i##_len;++i)
#define BUGAVOID(x) x
#define rep(...) BUGAVOID(_overload3(__VA_ARGS__,repi,_rep,_rep)(__VA_ARGS__))
#define sz(c) (int)(c.size())
#define all(c) c.begin(),c.end()
#define mp make_pair
#define write(x) cout<<(x)<<"\n"
using namespace std; typedef long long ll;
typedef vector<int> vi; typedef vector<ll> vll; template<class T, class U>using vp = vector<pair<T, U>>;
template<class T>using vv = vector<vector<T>>; template<class T, class U>using vvp = vv<pair<T, U>>;
template<class T>vv<T> vvec(size_t n, size_t m, T v) { return vv<T>(n, vector<T>(m, v)); }
template<class T>bool chmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }
template<class T>bool chmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
constexpr int INF = 1 << 28, MAX = 1e5 + 5, MOD = 998244353;
constexpr ll LINF = 1ll << 60; constexpr double EPS = 1e-6;
constexpr int dy[4] = { 0,1,0,-1 }, dx[4] = { 1,0,-1,0 };
struct aaa { aaa() { cin.tie(0); ios::sync_with_stdio(0); }; }aaaa;

ll modulo_pow(ll x, int n) { ll y = 1; for (; n > 0; n /= 2) { y = n % 2 ? y * x % MOD : y; x = x * x % MOD; } return y; }

int N;
vi A;
int sumA;

int main() {
    cin >> N;
    A.resize(N);
    rep(i, N) {
        cin >> A[i];
        sumA += A[i];
    }

    vv<ll> dp = vvec<ll>(N + 1, sumA + 300 + 1, 0);
    dp[0][0] = 1;
    rep(i, 1, N + 1) {
        rep(j, 0, sumA + 1) {
            dp[i][j] += 2 * dp[i - 1][j];
            dp[i][j] %= MOD;
            dp[i][j + A[i - 1]] += dp[i - 1][j];
            dp[i][j + A[i - 1]] %= MOD;
        }
    }
    ll ge_half = 0;
    rep(j, (sumA + 1) / 2, sumA + 1) {
        ge_half += dp[N][j];
        ge_half %= MOD;
    }

    vv<ll> dp2 = vvec<ll>(N + 1, sumA + 300 + 1, 0);
    dp2[0][0] = 1;
    rep(i, 1, N + 1) {
        rep(j, 0, sumA + 1) {
            dp2[i][j] += dp2[i - 1][j];
            dp2[i][j] %= MOD;
            dp2[i][j + A[i - 1]] += dp2[i - 1][j];
            dp2[i][j + A[i - 1]] %= MOD;
        }
    }
    ll half = sumA % 2 ? 0 : dp2[N][sumA / 2];

    ll ans = (modulo_pow(3, N) + MOD - 3 * ge_half % MOD + 3 * half) % MOD;
    write(ans);
}


Measured memory_bytes: 427396
import sys
sys.stdin.readline

def dfs(dmax, now):
    if len(now) == N:
        P.append(now)
        return
    for n in range(dmax, M+1):
        dfs(n, now+[n])

N, M ,Q = map(int,input().split())
ABCD = [list(map(int, input().split())) for _ in range(Q)]
P = []

dfs(1, [])
ans = 0
for A in P:
    score = 0
    for a, b, c, d in ABCD:
        if A[b-1] - A[a-1] == c:
            score += d
    ans = max(ans, score)

print(ans)


Measured memory_bytes: 22844
#include <bits/stdc++.h>
using namespace std;
#define rep(i,c,n) for(int i=c;i<n;i++)

int main(){
  string s;
  cin>>s;
  
  if(s=="A"){cout<<"T"<<endl;}
  if(s=="T"){cout<<"A"<<endl;}
  if(s=="C"){cout<<"G"<<endl;}
  if(s=="G"){cout<<"C"<<endl;}
  
  return 0;
}

Measured memory_bytes: 256