akhauriyash/Code-Regression huggingface dataset:
public class Main {
	public static void main(String args[]) {
		java.util.Scanner sc = new java.util.Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();

		if ((A == 1 && B == 2 )|| (A == 2 && B == 1 )) {
			System.out.println(3);
		} else if ((A == 1 && B == 3 )|| (A == 3 && B == 1 )) {
			System.out.println(2);
		} else {
			System.out.println(1);
		}


	}
}

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

using namespace std;
#ifdef _DEBUG
#define _GLIBCXX_DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

//#define int long long
#define ll long long
#define ll1 1ll
#define ONE 1ll
#define DBG 1
#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 loop(n) rep(loop, (0), (n))
#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;
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
using pii = pair<int, int>;
// template<class T> ostream &operator<<(ostream &os,T &t){dump(t);return os;}
template <typename T, typename S>
istream &operator>>(istream &is, pair<T, S> &p) {
  is >> p.first >> p.second;
  return is;
}
template <typename T, typename S>
ostream &operator<<(ostream &os, pair<T, S> &p) {
  os << p.first << " " << p.second;
  return os;
}

template <typename T> void printvv(const vector<vector<T>> &v) {
  cerr << endl;
  rep(i, 0, v.size()) rep(j, 0, v[i].size()) {
    if (typeid(v[i][j]).name() == typeid(INF).name() and v[i][j] == INF) {
      cerr << "INF";
    } else
      cerr << v[i][j];
    cerr << (j == v[i].size() - 1 ? '\n' : ' ');
  }
  cerr << endl;
}
/*
   typedef __int128_t Int;
   std::ostream &operator<<(std::ostream &dest, __int128_t value) {
   std::ostream::sentry s(dest);
   if (s) {
   __uint128_t tmp = value < 0 ? -value : value;
   char buffer[128];
   char *d = std::end(buffer);
   do {
   --d;
 *d = "0123456789"[tmp % 10];
 tmp /= 10;
 } while (tmp != 0);
 if (value < 0) {
 --d;
 *d = '-';
 }
 int len = std::end(buffer) - d;
 if (dest.rdbuf()->sputn(d, len) != len) {
 dest.setstate(std::ios_base::badbit);
 }
 }
 return dest;
 }

 __int128 parse(string &s) {
 __int128 ret = 0;
 for (int i = 0; i < s.length(); i++)
 if ('0' <= s[i] && s[i] <= '9')
 ret = 10 * ret + s[i] - '0';
 return ret;
 }
 */

#ifndef _DEBUG
#define printvv(...)
#endif
void YES(bool f) { cout << (f ? "YES" : "NO") << endl; }
void Yes(bool f) { cout << (f ? "Yes" : "No") << endl; }
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(signed argc, char *argv[]) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(12);

  int a, b, c;
  cin >> a >> b >> c;
  int K;
  cin >> K;
  int m = max({a, b, c});
  int x = m;
  cout << (x<<K) + (a + b + c - m) << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define watch(x) cerr <<"\e[91m"<<__func__<<": "<< #x << " = " << x <<"\e[39m"<< "\n"
typedef pair<int, int> pii;
typedef long long ll;
const double eps = 1e-9;
const int inf = 0x3f3f3f3f;

const int maxn = 2 * 1e5;
int a[maxn+1];

int main()
{
#ifndef ONLINE_JUDGE
    freopen("../io/in.txt", "r", stdin);
    //freopen("../io/out.txt", "w", stdout);
#endif // ONLINE_JUDGE
    int n;
    cin >> n;
    for(int i=0; i<n; i++) cin >> a[i];
    sort(a, a+n, greater<int>());
    ll ans = 0LL;
    // for(int i=0; i<n; i++) watch(a[i]);
    ans += a[0];
    int idx = 1, cnt = 0;
    for(int i=2; i < n; i++) {
        ans += a[idx];
        cnt += 1;
        if(cnt == 2) {idx += 1; cnt = 0;}
    }

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


Measured memory_bytes: 4352
#include <iostream>
#include <string>
#include <iomanip>
#include <math.h>
using namespace std;
char asd;
int main(){
    cin>>asd;
    if (asd == 'a' || asd == 'e' || asd == 'u' || asd == 'o' || asd == 'i'){
        cout<<"vowel"<<endl;
    }else cout<<"consonant"<<endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
long long lcm(int x, int y) { //xとyの最小公倍数を求める
    long long lcm;
    if(x < y) { swap(x, y);}
    long long X = x, Y = y, xpre;
        while (x % y != 0) {
            xpre = x;
            x = y;
            y = xpre % y;
        }
    lcm = X * Y / y;
    return lcm;
}
int main() {
    int A, B; cin >> A >> B;
    cout << lcm(A, B) << endl;
}

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

int main () {
    int r, g, b;
    cin >> r >> g >> b;
    if ((100 * r + 10 * g + b) % 4 == 0) {
        cout << "YES" << endl;
    }
    else {
        cout << "NO" <<endl;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=2e5+5,mod=998244353;
struct node
{
    int x,y;
    bool operator<(const node&o)const
    {
        return x<o.x;
    }
}a[N];
int n,t[N],hs[N];
ll lu[N],ld[N],ru[N],rd[N];
ll f[N];
void add(int x)
{
    while(x<=n)
        t[x]++,x+=x&-x;
}
int query(int x)
{
    int ans=0;
    while(x) ans+=t[x],x-=x&-x;return ans;
}
int main()
{
    f[0]=1;
    for(int i=1;i<N;i++)
        f[i]=f[i-1]*2%mod;
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
        scanf("%d%d",&a[i].x,&a[i].y),hs[i]=a[i].y;
    sort(a+1,a+1+n);
    sort(hs+1,hs+1+n);
    for(int i=1;i<=n;i++)
        a[i].y=lower_bound(hs+1,hs+1+n,a[i].y)-hs;
    for(int i=1;i<=n;i++)
    {
        ld[i]=query(a[i].y);
        lu[i]=i-1-ld[i];
        add(a[i].y);
    }
    memset(t,0,sizeof(t));
    for(int i=n;i>=1;i--)
    {
        rd[i]=query(a[i].y);
        ru[i]=n-i-rd[i];
        add(a[i].y);
    }
    ll ans=0;
	for(int i=1;i<=n;++i)
    {
		ans=(ans+f[n-1])%mod;//选了点i
		ans=(ans+f[n-1])%mod;//没选点i
		ans=(ans-f[lu[i]+ld[i]]-f[ru[i]+rd[i]]-f[lu[i]+ru[i]]-f[ld[i]+rd[i]])%mod;//减去不合法的
        ans=(ans+f[lu[i]]+f[ru[i]]+f[ld[i]]+f[rd[i]])%mod;//加上重复减的
        ans=(ans-1)%mod;//减去全没选的情况
	}
    ans=(ans+mod)%mod;
    printf("%lld\n",ans);
}


Measured memory_bytes: 11136
def getN():
    return int(input())

def getMN():
    a = input().split()
    b = [int(i) for i in a]
    return b[0],b[1]

def getlist():
    a = input().split()
    b = [int(i) for i in a]
    return b

inp = map(int, input().split())
ins = list(set(inp))

if 1 in ins and 9 in ins and 7 in ins and 4 in ins:
    print("YES")

else:
    print("NO")

Measured memory_bytes: 3064
#include <stdio.h>
#include <stdlib.h>

int main()
{
		int a=0, b=0;
		char ch;
		int total;
		int count;
	
		while( (ch=fgetc(stdin)) != EOF ){
			   	a = ch - '0';
				while( (ch=fgetc(stdin)) != ' ' ){
						a = 10*a + ch - '0';
				}
				while( (ch=fgetc(stdin)) != '\n' ){
						b = 10*b + ch - '0';
				}
				total = a+b;
				count = 0;
				while( total != 0 ){
						total /= 10;
						count++;
				}
				printf("%d\n", count );
				a = b = total = 0;
		}
		return 0;
}

Measured memory_bytes: 524
# coding: utf-8;

def main():
    num = [0,1,2,3,4,5,6,7,8,9]
    n, k = map(int, input().split())
    d = list(map(int, input().split()))
    usable_num = list(set(num) - set(d))

    while True:
        f = True
        for a in str(n):
            if int(a) not in usable_num:
                f = False
                break
        if f: break
        n += 1
    print(n)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
n,k,q=map(int,input().split())
a=[(input()) for l in range(q)]
if q-k<0:
    for i in range(n):
        print('Yes')
else:
    import collections
    c = collections.Counter(a)
    for i in range(n):
        #print(k-c[str(i+1)])
        if q-c[str(i+1)]<k:
            print('Yes')
        else:
            print('No')

Measured memory_bytes: 13604
#![allow(unused_imports)]
use std::io::{ self, Write };
use std::str::FromStr;
use std::cmp::{ min, max };
use std::collections::{ BinaryHeap, VecDeque };

#[allow(unused_macros)]
macro_rules! trace {
    ($var:expr) => {
        let _ = writeln!(&mut std::io::stderr(), ">>> {} = {:?}", stringify!($var), $var);
    };
    ($($args:expr),*) => { trace!(($($args),*)) }
}

#[allow(unused_macros)]
macro_rules! put {
    ($var:expr) => {
        let _ = writeln!(&mut std::io::stdout(), "{}", $var);
    };
    ($var:expr, $($args:expr),*) => {
        let _ = write!(&mut std::io::stdout(), "{} ", $var);
        put!($($args),*);
    };
}

#[derive(Debug)]
struct Topological(Vec<usize>);

impl Topological {

    fn visit(u: usize, mut used: &mut Vec<bool>, rd: &Vec<Vec<usize>>, mut ord: &mut Vec<usize>) {
        if used[u] { return }
        used[u] = true;
        for &v in rd[u].iter() {
            Self::visit(v, &mut used, &rd, &mut ord);
        }
        ord.push(u);
    }

    fn new(neigh: &Vec<Vec<usize>>) -> Self {
        let n = neigh.len();
        let mut rd = vec![vec![]; n];
        for u in 0..n {
            for &v in neigh[u].iter() {
                rd[v].push(u);
            }
        }
        // sort
        let mut used = vec![false; n];
        let mut ord = vec![];
        for u in 0..n { Self::visit(u, &mut used, &rd, &mut ord); }
        Topological(ord)
    }
}

fn main() {
    let mut sc = Scanner::new();
    let n: usize = sc.cin();
    let m: usize = sc.cin();
    let mut g = vec![vec![]; n];
    let mut h = vec![vec![]; n];
    for _ in 0..m {
        let x: usize = sc.cin();
        let y: usize = sc.cin();
        g[x-1].push(y-1);
        h[y-1].push(x-1);
    }

    let Topological(ord) = Topological::new(&g);

    let mut d = vec![0; n];
    for &u in ord.iter() {
        d[u] =
            if let Some(m) = h[u].iter().map(|&i| d[i]).max() {
                m + 1
            } else {
                0
            };
    }

    // trace!(&d);
    let ans = d.iter().max().unwrap();
    put!(ans);

}

#[allow(dead_code)]
struct Scanner { stdin: io::Stdin, buffer: VecDeque<String>, }
#[allow(dead_code)]
impl Scanner {
    fn new() -> Scanner { Scanner { stdin: io::stdin(), buffer: VecDeque::new() } }
    fn reserve(&mut self) {
        while self.buffer.len() == 0 {
            let mut line = String::new();
            let _ = self.stdin.read_line(&mut line);
            for w in line.split_whitespace() {
                self.buffer.push_back(String::from(w));
            }
        }
    }
    fn cin<T: FromStr>(&mut self) -> T {
        self.reserve();
        match self.buffer.pop_front().unwrap().parse::<T>() {
            Ok(a) => a,
            Err(_) => panic!("parse err")
        }
    }
}


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


using namespace std;
#define ll long long

ll N;
int X, M;

vector<ll> A;
map<ll, ll> idxs;
int main()
{
	cin>>N>>X>>M;
	A.push_back(0);
	A.push_back(X);
	idxs[X] = 1;
	ll last = X;
	ll ans = X;
	for(ll i = 2; i <= N; ++i)
	{
		last = last * last % M;
		if(idxs.count(last) != 0)
		{
			ll idx = idxs[last];
			ll len = i - idx;
			ll loop = (N - i + 1) / len;
			ll rest = (N - i + 1) - len * loop;
			ll tmp = 0;
			for(ll j = idx; j < i; ++j)
			{
				tmp += A[j];
			} 
			ans += loop * tmp;
			for(ll j = 0; j < rest; ++j)
				ans += A[idx+j];
			cout<<ans<<endl;
			return 0;
		}
		idxs[last] = i; 
		A.push_back(last);
		ans += last;
	}
	cout<<ans<<endl;
}


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

void solve() {
    ll n, K;
    cin >> n >> K;
    vector<ll> v;
    for (int i = 0; i < n; i++) {
        ll x;
        cin >> x;
        v.push_back(x);
    } 
    vector<ll> dp(n, INT_MAX);
    dp[n - 1] = 0;
    for (ll i = n - 2; i >= 0; i--) {
        for (int j = i + 1; j <= min(n - 1, i + K); j++)  
            dp[i] = min(dp[i], dp[j] + abs(v[j] - v[i]));      
    } 
    cout << dp[0] << endl;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
    return 0;
}

Measured memory_bytes: 5068
#include<bits/stdc++.h>
using namespace std;
typedef long long int uli;
int main(){
  uli x,y;
  cin>>x>>y;
  uli ans=1;
  while((x*2)<=y){
    x*=2;
    ans++;
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
// lcmとかはg++ -std=c++17 default.cppみたいなかんじで
//vector<vector<ll>> piyo(tate,vector<ll> (yoko));
 
#include <bits/stdc++.h>
#define mod 1000000007
#define INF 1000000000
#define ll long long
#define ln cout<<endl;
#define Yes cout<<"Yes"<<endl;
#define No cout<<"No"<<endl;
#define double long double
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
using namespace std;
 
 int main(){
  string str;
   cin>>str;
	ll f=0;
  rep(i,str.length()){
    if(i%2){
      if(str[i]!='i') f=1;
    }
    else {
      if(str[i]!='h') f=1;
    }
    }
    if(str.length()%2) f=1;
  if(f) cout<<"No"<<endl;
  else cout<<"Yes"<<endl;
  return 0;
}


Measured memory_bytes: 3576
#include <bits/stdc++.h>
using namespace std;
string s;
bool f,f2;
int main()
{
	cin>>s;
	int n=s.size(),ans=s.size();
	for (int i=1;i<n;++i)
		if (f==true)
		{
			if (f2==true)
			{
				f=f2=false;
				continue;
			}
			else
			{
				f2=true;
				continue;
			}
		}
		else if (s[i]==s[i-1]) --ans,f=true;
	cout<<ans;
	return 0;
}

Measured memory_bytes: 640
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <utility>
#include <numeric>

using namespace std;

using ll = long long;
using ull = unsigned long long;

const ll inf = (ll)1e9;
const ll mod = (ll)1e9 + 7;

int main()
{
	string s, t;
	cin >> s >> t;

	int ans = 0;
	for (int i = 0; i < 3; i++)
	{
		if (s.at(i) == t.at(i))
		{
			ans++;
		}
	}

	cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;
int main() {
  double x1,y1,x2,y2;
  cin>>x1>>y1>>x2>>y2;
  cout<<fixed<<setprecision(5)<<sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2))<<endl;
  return 0;
}

Measured memory_bytes: 1284
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
const int MAXSIZE = 1e2+7;
const int INF = 1e8+7;
int edge[MAXSIZE][MAXSIZE];
int dis[MAXSIZE];
bool vis[MAXSIZE];
int n;
int prim(){
	memset(vis,false,sizeof(vis));
	for(int i = 1; i <= n; i++){
		dis[i] = edge[1][i];
	}
	vis[1] = true;
	dis[1] = 0;
	int minc, k;
	for(int i = 2; i <= n; i++){
		minc = INF;
		for(int j = 1; j <= n; j++){
			if(!vis[j] && dis[j] < minc){
				minc = dis[j];
				k = j;
			}
		}
		if(minc == INF) break;
		vis[k] = true;
		for(int j = 1; j <= n; j++){
			if(!vis[j] && dis[j] > edge[k][j]){
				dis[j] = edge[k][j];
			}
		}
	}
	int cnt = 0;
	for(int i = 1; i <= n; i++) cnt += dis[i];
	return cnt;
}
int main(){
	while(~scanf("%d",&n)){
		memset(edge,0,sizeof(edge));
		int t;
		for(int i = 1; i <= n; i++){
			for(int j = 1; j <= n; j++){
				scanf("%d",&t);
				if(i == j) continue;
				if(t == -1) edge[i][j] = INF;
				else edge[i][j] = t;
			}
		}
		int res = prim();
		printf("%d\n",res); 
	}
	return 0;
}
 


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

using namespace std;

map<int,vector<int> > m;
int a[100];
int er[100];
int nr;

void dfs(int d){
  int r;
  cin>>r;
  if(r>0){
    nr++;
    a[d]=nr;
    if(d){
      m[a[d]].push_back(a[d-1]);
      m[a[d-1]].push_back(a[d]);
    }
    er[d]=r-1;
    for(int i=0;i<er[d];i++){
      dfs(d+1);
    }
  }else{
    er[d-1+r]--;
    m[a[d-1]].push_back(a[d-1+r]);
    m[a[d-1+r]].push_back(a[d-1]);
  }
}

int main(){
  int n;
  cin>>n;
  while(n--){
    m.clear();
    nr=0;
    dfs(0);
    int d;
    cin>>d;
    for(auto e:m){
      cout<<e.first;
      sort(begin(e.second),end(e.second));
      for(auto f:e.second){
	cout<<' '<<f;
      }
      cout<<endl;
    }
  }
}

    

Measured memory_bytes: 1252
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, s, n) for(int i = s; i < (int)n; i++)
#define per(i, n) for(int i = n; i >= 0; i--)
#define ROF(i, s, n) for(int i = s; i >= (int)n; i--)
#define FORIT(i, A) for (auto i : A)
#define PRINT(x) cout << (x) << "\n"
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define MP make_pair
#define EACH(i, n) for (__typeof((n).begin()) i = (n).begin(); i != (n).end(); ++i)
#define SZ(a) int((a).size())
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define CLR(a) memset((a), 0 ,sizeof(a))
#define dump(x) cout << #x << " = " << (x) << "\n";
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << "\n";
#define sq(n) (n) * (n)
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef priority_queue<int> maxpq;
typedef priority_queue< int, vector<int>, greater<int> > minpq;
static const double EPS = 1e-10;
static const double PI = acos( -1.0 );
static const int mod = 10007;
static const int INF = 1 << 25;
static const LL LL_INF = 1152921504606846976;
static const int dx[] = { -1, 0, 1, 0,  1, -1,  1, -1 };
static const int dy[] = { 0, -1, 0, 1 , 1,  1, -1, -1 };

int n;

int main() {
	while ( ~scanf( "%d", &n ) && n ) {
		int ans = n;
		for ( int i = 0; i * i * i <= n; i++ ) {
			int j = sqrt( n - i * i * i );
			ans = min( ans, i + j + ( n - ( i * i * i + j * j ) ) );
		}
		printf( "%d\n", ans );
	}
	return 0;
}

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

using namespace std;

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

#define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i))
#define REP(i, n) FOR(i,n,0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll) 1e15;

pll A[1005];
ll dp[1005][10005];

int main() {
    ll H, N;
    cin >> H >> N;
    REP(i, N) {
        cin >> A[i].first >> A[i].second;
    }

    REP(i, N + 1) {
        REP(j, H + 1) {
            dp[i][j] = INF;
        }
    }
    dp[0][0] = 0;
    REP(i, N) {
        REP(j, H + 1) {
            dp[i + 1][j] = std::min(dp[i][j], dp[i + 1][j]);
            ll t = std::min(j + A[i].first, H);
            dp[i + 1][t] = std::min(dp[i + 1][t], dp[i][j] + A[i].second);
            dp[i + 1][t] = std::min(dp[i + 1][t], dp[i + 1][j] + A[i].second);

        }
    }

    cout << dp[N][H] << endl;
    return 0;
}

Measured memory_bytes: 78464
#include <iostream>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <queue>
#include <deque>
#include <cmath>
#include <iomanip>
#include <cstdio>

using namespace std;

int main(){
    int h, w, k; cin >> h >> w >> k;
    vector<string> s(h);
    for(int i=0; i<h; ++i){
        cin >> s[i];
    }
    vector<vector<int>> ans(h, vector<int>(w));
    int ki=1;
    for(int hi=0; hi<h; ++hi){
        int last_w=-1;
        for(int wi=0; wi<w; ++wi){
            if(s[hi][wi]=='.') continue;
            for(int i=last_w+1; i<=wi; ++i){
                ans[hi][i]=ki;
            }
            ++ki;
            last_w=wi;
        }
        if(last_w==-1) continue;
        for(int i=last_w+1; i<w; ++i){
            ans[hi][i]=ki-1;
        }
    }
    int last_h=-1;
    for(int hi=0; hi<h; ++hi){
        if(ans[hi][0]==0) continue;
        for(int i=last_h+1; i<hi; ++i){
            for(int wi=0; wi<w; ++wi){
                ans[i][wi]=ans[hi][wi];
            }
        }
        last_h=hi;
    }
    for(int hi=last_h+1; hi<h; ++hi){
        for(int wi=0; wi<w; ++wi){
            ans[hi][wi]=ans[last_h][wi];
        }
    }
    for(int hi=0; hi<h; ++hi){
        for(int wi=0; wi<w; ++wi){
            cout << ans[hi][wi] << (wi==w-1 ? '\n' : ' ');
        }
    }
    return 0;
}


Measured memory_bytes: 1280
#include<stdio.h>
#include<iostream>
using namespace std;
int main(void)
{
  char st[5];
  int ans=0;
  scanf("%s",st);
  for(int i=0;i<5;i++)
    {
      if(st[i]=='A')
	{
	
	  if(st[i+1]=='C')
	    {
	      ans=1;
	    }
	}
    }

  if(ans==0)
    {
      printf("No\n");
    }
  else
    {
      printf("Yes\n");
    }
  return 0;
}

Measured memory_bytes: 256
const main = arg => {
  const [a, b, h, m] = arg.trim().split('\n')[0].split(' ').map(x => Number(x));
  const minuteDeg = m / 60;
  const hourDeg = (h / 12 + m / 720);
  console.log(Math.sqrt(a ** 2 + b ** 2 - 2 * a * b * Math.cos(Math.abs(minuteDeg - hourDeg) * 2 * Math.PI)));
};

main(require('fs').readFileSync('/dev/stdin', 'utf8'));


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

using namespace std;
 
#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

typedef int64_t ll; typedef vector<int> VI; typedef pair<int,int> pii;
const ll mod = 1e9+7;

void dbg(){ cerr << "\n"; }  
template <typename T,typename ...T2>
void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }

int main()
{
 
	//cin.tie(0); ios_base::sync_with_stdio(false);
	int m;
	string s;
	cin >>m;
	
	
	cout << 24 -m +24<<"\n";
	return 0;
}

Measured memory_bytes: 256
a, b, m = map(int, input().split())
ax = list(map(int, input().split()))
bx = list(map(int, input().split()))
x = []
for i in range(m):
    _x = map(int, input().split())
    x.append(list(_x))

min_a = min(ax)
min_b = min(bx)
min_sum = min_a + min_b

for k in x:
    sum = ax[k[0]-1] + bx[k[1]-1] - k[2]
    if sum < min_sum:
        min_sum = sum

print("{}".format(min_sum))

Measured memory_bytes: 38488
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <algorithm>
using namespace std;

typedef long long LL;

const LL MOD = 1000000007LL;

LL dp[100001][13];  //! i-th digit from the bottom, remainder, => count

int main()
{
    string S;
    cin >> S;

    vector<int> rbase = {1, 10, 9, 12, 3, 4};

    memset(dp, 0, sizeof(dp));
    dp[0][0] = 1;
    
    LL fixedR = 0;
    for (int i = 0; i < S.length(); ++i) {
        char c = S[S.length()-i-1];
        if (c == '?') {
            for (int d = 0; d <= 9; ++d) {
                int dr = d * rbase[i%rbase.size()] % 13;
                for (int r = 0; r < 13; ++r) {
                    dp[i+1][(r + dr)%13] = (dp[i+1][(r + dr)%13] + dp[i][r]) % MOD;
                }
            }
        } else {
            int d = (int) (c - '0');
            int dr = d * rbase[i%rbase.size()] % 13;
            for (int r = 0; r < 13; ++r) {
                dp[i+1][(r + dr)%13] = (dp[i+1][(r + dr)%13] + dp[i][r]) % MOD;
            }
        }

        // cout << "After handling " << i << "th digit " << c << ", dp[i] = " << endl << "    ";
        // for (int r = 0; r < 13; ++r) {
        //     cout << dp[i+1][r] << ' ';
        // }
        // cout << endl;
    }

    cout << dp[S.length()][5] << endl;

    return 0;
}



Measured memory_bytes: 10624
#include<iostream>
#include<vector>
#include<algorithm>
#include<cctype>
#include<utility>
#include<string>
#include<cmath>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;

typedef long long int ll;

int main(){

    ll n;
    cin >> n;
    string s="";
    if(n == 0){
        cout << '0' << endl;
    }else{

        while(n!= 0){

            if(n%2 != 0){
                s += '1';
                n--;
            }else{
                s += '0';
            }
            n /= -2;
        }
        reverse(s.begin(),s.end());
        cout << s << endl;
    }

    return 0;
}

Measured memory_bytes: 256
import java.util.Arrays;

public class Main {

	private static void solve() {
		int n = ni();
		long h = ni();
		int[] a = new int[n];
		int[] b = new int[n];
		for (int i = 0; i < n; i ++) {
			a[i] = ni();
			b[i] = ni();
		}
		Arrays.sort(a);
		Arrays.sort(b);
		int amax = a[n - 1];


		long sum = 0;
		long ret = (h + amax - 1) / amax;
		
		for (int i = n - 1; i >= 0; i --) {
			sum += b[i];
			
			long x = Math.max(0, (h - sum + amax - 1) / amax);
			long y = n - i;
			ret = Math.min(ret, x + y);
		}
		System.out.println(ret);
	}

	public static void main(String[] args) {
		new Thread(null, new Runnable() {
			@Override
			public void run() {
				long start = System.currentTimeMillis();
				String debug = args.length > 0 ? args[0] : null;
				if (debug != null) {
					try {
						is = java.nio.file.Files.newInputStream(java.nio.file.Paths.get(debug));
					} catch (Exception e) {
						throw new RuntimeException(e);
					}
				}
				reader = new java.io.BufferedReader(new java.io.InputStreamReader(is), 32768);
				solve();
				out.flush();
				tr((System.currentTimeMillis() - start) + "ms");
			}
		}, "", 64000000).start();
	}

	private static java.io.InputStream is = System.in;
	private static java.io.PrintWriter out = new java.io.PrintWriter(System.out);
	private static java.util.StringTokenizer tokenizer = null;
	private static java.io.BufferedReader reader;

	public static String next() {
		while (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new java.util.StringTokenizer(reader.readLine());
			} catch (Exception e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}

	private static double nd() {
		return Double.parseDouble(next());
	}

	private static long nl() {
		return Long.parseLong(next());
	}

	private static int[] na(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = ni();
		return a;
	}

	private static char[] ns() {
		return next().toCharArray();
	}

	private static long[] nal(int n) {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)
			a[i] = nl();
		return a;
	}

	private static int[][] ntable(int n, int m) {
		int[][] table = new int[n][m];
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < m; j++) {
				table[i][j] = ni();
			}
		}
		return table;
	}

	private static int[][] nlist(int n, int m) {
		int[][] table = new int[m][n];
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < m; j++) {
				table[j][i] = ni();
			}
		}
		return table;
	}

	private static int ni() {
		return Integer.parseInt(next());
	}

	private static void tr(Object... o) {
		if (is != System.in)
			System.out.println(java.util.Arrays.deepToString(o));
	}
}


Measured memory_bytes: 44808
#include <bits/stdc++.h>
using namespace std;
#define FAST_IO ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
typedef long long ll;
typedef unsigned int UINT;
typedef unsigned long long ull;
int const maxn = 1e5 + 10;
int a[maxn];
int main(void) {
    FAST_IO;
    int n;
    cin >> n;
    int mx = -1;
    int f = 0;
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
        if (mx - a[i] >= 2){
            f = 1;break;
        }
        mx = max(mx, a[i]);
    }
    
    if (f)
        cout << "No" << endl;
    else 
        cout << "Yes" << endl;

    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using Int = int64_t;
using UInt = uint64_t;
using C = std::complex<double>;
#define rep(i, n) for(Int i = 0; i < (Int)(n); ++i)
#define guard(x) if( not (x) ) continue;
#ifndef LOCAL_
#define fprintf if( false ) fprintf
#endif

int main() {
   Int v, e;
   std::cin >> v >> e;
   std::vector<Int> ss(e), ts(e);
   rep(i, e) std::cin >> ss[i] >> ts[i];
   std::vector<std::vector<Int>> nexts(v);
   rep(i, e) {
      Int s = ss[i], t = ts[i];
      nexts[s].emplace_back(t);
      nexts[t].emplace_back(s);
   }
   std::vector<Int> xs(v,-1);
   std::vector<Int> ys(v);
   std::vector<std::pair<Int,Int>> zs;
   xs[0] = 0;
   Int id = 1;
   std::function<Int(Int,Int)> dfs = [&](Int i, Int prev) {
      xs[i] = id;
      id += 1;
      Int res = 0;
      for(Int k : nexts[i]) {
         guard( k != prev );
         if( xs[k] == -1 ) {
            Int t = dfs(k, i);
            if( t == 0 ) {
               Int a = std::min(i, k);
               Int b = std::max(i, k);
               zs.emplace_back(a, b);
            }
            res += t;
         }
         else if( xs[k] < xs[i] ) {
            ys[i] += 1;
            ys[k] -= 1;
         }
      }
      res += ys[i];
      return res;
   };
   dfs(0, -1);
   std::sort(zs.begin(), zs.end());
   for(auto z : zs) {
      printf("%ld %ld\n", z.first, z.second);
   }
}



Measured memory_bytes: 6532
import java.util.*;

public class Main {
    public static void main(String[] args) {
        try(Scanner scn = new Scanner(System.in)) {
            int n, m;
            while((n = scn.nextInt()) > 0 | (m = scn.nextInt()) > 0) {
                int[] fld = new int[n];
                for(int i = 0; i < n; i++) {
                    fld[i] = scn.nextInt();
                }
                int pt = 0, cnt = 0;
                try {
                    while(m-- > 0) {
                        cnt++;
                        pt += scn.nextInt();
                        pt += fld[pt];
                        if(-~pt >= n) {
                            throw new ArrayIndexOutOfBoundsException();
                        }
                    }
                } catch(ArrayIndexOutOfBoundsException e) {
                    while(m-- > 0) {
                        scn.nextInt();
                    }
                }
                System.out.println(cnt);
            }
        }
    }
}

Measured memory_bytes: 36036
package main

import (
	"bufio"
	"fmt"
	"log"
	"math"
	"os"
	"strconv"
)

func x(a int) int {
	switch a % 4 {
	case 0:
		return a
	case 1:
		return 1
	case 2:
		return a + 1
	default:
		return 0
	}
}

func main() {
	A := nextInt()
	B := nextInt()
	ans := x(B) ^ x(A-1)
	fmt.Println(ans)
}

var dy = []int{1, 0, -1, 0, 0}
var dx = []int{0, 1, 0, -1, 0}
var inf = int(1e9)

func pow(a, b int) int {
	return int(math.Pow(float64(a), float64(b)))
}

func lcm(a, b int) int {
	return a * b / gcd(a, b)
}
func gcd(a, b int) int {
	if a < b {
		a, b = b, a
	}
	for b != 0 {
		a, b = b, a%b
	}
	return a
}
func max(a ...int) int {
	r := a[0]
	for i := 0; i < len(a); i++ {
		if r < a[i] {
			r = a[i]
		}
	}
	return r
}
func min(a ...int) int {
	r := a[0]
	for i := 0; i < len(a); i++ {
		if r > a[i] {
			r = a[i]
		}
	}
	return r
}
func sum(a []int) (r int) {
	for i := range a {
		r += a[i]
	}
	return r
}
func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

type pair struct {
	a, b int
}

type pairs []pair

func (p pairs) Len() int {
	return len(p)
}
func (p pairs) Swap(i, j int) {
	p[i], p[j] = p[j], p[i]
}

func (p pairs) Less(i, j int) bool {
	if p[i].a == p[j].a {
		return p[i].b < p[j].b
	}
	return p[i].a < p[j].a
}

var nextReader func() []byte

func init() {
	nextReader = newScanner()
	log.SetFlags(log.Lshortfile)
}

func newScanner() func() []byte {
	r := bufio.NewScanner(os.Stdin)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)
	return func() []byte {
		r.Scan()
		return r.Bytes()
	}
}
func nextBytes() []byte {
	return nextReader()
}

func nextString() string {
	return string(nextReader())
}
func nextInt64() int64 {
	v, _ := strconv.ParseInt(string(nextReader()), 10, 64)
	return v
}
func nextInt() int {
	v, _ := strconv.Atoi(string(nextReader()))
	return v
}
func nextInts(n int) []int {
	r := make([]int, n)
	for i := 0; i < n; i++ {
		r[i] = nextInt()
	}
	return r
}
func nextFloat64() float64 {
	f, _ := strconv.ParseFloat(string(nextReader()), 64)
	return f
}


Measured memory_bytes: 640
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
int main()
{
	int n;
	long long a = 2,b = 1,c;
	scanf("%d", &n);
	if(n == 1)printf("1\n");
	n = n - 1;
	if(n>0){
	while(n > 0)
	{
		n--;
		c = a + b;
		a = b;
		b = c;
	}
	printf("%lld",c);
}
}

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


int main(void){
    int n,m=0;
    int p[10];
    cin>>n;
    for(int i = 0; i <n; i++)
    {
        cin>>p[i];
    }
    sort(p,p+n);
    p[n-1]/=2;
    
    for(int i = 0; i < n; i++)
    {
        m+=p[i];
    }
    cout<<m<<endl;
}

Measured memory_bytes: 256
use std::io;
use std::str::FromStr;

fn count_divisors(n : usize) -> usize {
    let mut cnt = 0;
    for i in 1..(n + 1) {
        if n % i == 0 {
            cnt += 1;
        }
    }
    cnt
}
fn main() {
    let stdin = io::stdin();
    let mut buf = String::new();
    stdin.read_line(&mut buf).ok();
    let mut it = buf.split_whitespace().map(|n| usize::from_str(n).unwrap());
    let n = it.next().unwrap();
    let mut ans = 0;
    for i in 1..(n + 1) {
        if i % 2 == 1 && count_divisors(i) == 8 { ans += 1; }
    }
    println!("{}", ans);
}


Measured memory_bytes: 4352
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>
#include <stack>
#include <assert.h>
#include <unordered_set>
#include <random>



using namespace std;
using ll = long long;
using ull = unsigned long long;

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

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










int main(){
    int x;
    cin >> x;
    while(x >= 100){
        x -= 100 + min(x % 100, 5);
    }
    cout << !x << endl;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Collections;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.stream.Stream;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		try {
			BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));

			String[] s1 = reader.readLine().split(" ");
			int[] A = Stream.of(s1).mapToInt(Integer::parseInt).toArray();
			int N = A[0];
			int K = A[1];
			String[] s2 = reader.readLine().split(" ");
			int[] p = Stream.of(s2).mapToInt(Integer::parseInt).toArray();

			Queue<Integer> e = new PriorityQueue<Integer>(Collections.reverseOrder());
			//i=0
			int sum = 0;
			for(int j=0; j<K; j++) {
				sum += p[j];
			}
			e.add(sum);

			for(int i=1; i<=N-K; i++) {
				sum = sum - p[i-1] + p[i+K-1];
				e.add(sum);
			}

			double ans = (double)(e.peek() + K) / 2;
			System.out.println(String.format("%.7f", ans));
		}catch(IOException e) {

		}
	}

}

Measured memory_bytes: 49236
#include<stdio.h>

int main(){
  	int arr[]= {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    int k;
   	scanf("%d",&k);
    printf("%d",arr[k-1]);
    return 0;
  
 return 0 ;
}


Measured memory_bytes: 128
#include <iostream>


using namespace std;

typedef long long ll;

const ll INF = -1e17;

ll n;
ll a[200005];
ll dp[200005][3];
int main() {
  cin >> n;

  for(int i = n; i > 0; i--) {
    cin >> a[i];
  }

  for(int i = 0; i <= n; i++) {
    for(int j = 0; j < 3; j++) {
      dp[i][j] = INF;
    }
  }

  dp[0][0] = dp[0][1] = dp[0][2] = 0;
  dp[1][2] = a[1];
  dp[1][0] = 0;

  dp[2][0] = max(a[2],a[1]);
 

  for(int i = 3; i <= n; i++) {
    if(i & 1) {
      dp[i][0] = max(a[i]+dp[i-2][0],dp[i-1][0]);
      dp[i][2] = a[i] + dp[i-2][2];
    }
    else {
      dp[i][0] = max(a[i]+dp[i-2][0],a[i-1]+dp[i-3][2]);
    }
  }

  /*    for(int i = 0; i <= n; i++) {
    for(int j = 0; j < 3; j++) {
      cout <<" dp["<<i<<"]["<<j<<"] = "<<dp[i][j] <<  endl;
    }
    }*/
  
  if(n & 1) {
    cout << max(dp[n][0],max(dp[n-1][0],dp[n-2][2])) << endl;
  }
  else {
    cout << max(dp[n][0],dp[n-1][2]) << endl;
  }
  
}


  
  
  


Measured memory_bytes: 9828
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
using namespace std;

int main(){
    string a, b;
    cin >> a >> b;
    string s = a+b;
    int n = atoi(s.c_str());

    for ( int i=1; i*i<=100100; i++ ){
        if(i*i==n){
            cout << "Yes" << endl;
            return 0;
        }
    } 

    cout << "No" << 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++)

typedef long long ll;
typedef pair<int, int> P;

const ll mod =  1000000007;  //出力は (ans % mod + mod) % mod  (負の剰余を正にする)
const int inf = 1e9;
const long long INF = 1LL << 60;   // INF = 1152921504606846976

int dp[105][4][2];

int main()
{
    string s; cin >> s;
    int K; cin >> K;
    int n = s.size();
    dp[0][0][0] = 1;
    rep(i,n) rep(j,4) rep(k,2) {
        int nd = s[i] - '0';
        rep(d,10){
            int ni = i+1, nj = j, nk = k;
            if(d != 0){
                if(j+1>K) continue;
                nj++;
            }
            if(k==0){
                if(d > nd) continue;
                if(d < nd) nk = 1;
            }
            dp[ni][nj][nk] += dp[i][j][k];
        }
    }
    cout << dp[n][K][0] + dp[n][K][1] << endl;
}

Measured memory_bytes: 256
//i ll be the king
#include<bits/stdc++.h>
#define ll long long int
#define sync ios_base::sync_with_stdio(false); cin.tie(NULL) 
#define input(arr,n) for(ll i1=0;i1<n;i1++ )cin>>arr[i1]
#define rep(n) for(ll i2=0;i2<n;i2++)
#define vmp(v,a,b) v.push_back(make_pair(a,b))
#define si(a) scanf("%lld",&a)
#define pi(a) printf("%lld",a)
#define aset(a,n,k) for(ll i3=0;i3<n;i3++)a[i3]=k; 	
#define mod 1000000007
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
using namespace std;
int main()
{
//	sync;
	ll y,m,d;
	scanf("%lld/%lld/%lld",&y,&m,&d);
	ll sum=y-1+31*(m-1)+d;
	if(sum<=(2018+3*31+30))
	printf("Heisei");
	else
	printf("TBD");
}


Measured memory_bytes: 256
n = int(input())
A = list(map(int,input().split()))
minus = 0
ans = 0
abs_min = float('inf')
for a in A:
  if a < 0:
    minus += 1
  ans += abs(a)
  abs_min = min(abs_min, abs(a))
if minus%2:
  ans -= abs_min*2

print(ans)



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


int main() {
    int N, A, B;

    cin >> N ;
    cin >> A ;

    B = N % 500;

    if (B == 0) {
        cout << "Yes" << endl;
    }
    else if (B <= A) {
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }

}

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

int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    if (a % 2 == 0 && (a % 3 != 0 && a % 5 != 0)) {
      puts("DENIED");
      return 0;
    }
  }
  puts("APPROVED");
}


Measured memory_bytes: 256
// In The Name Of The Queen
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a, b;
    scanf("%d%d", &a, &b);
    if (a > 0)
        return !printf("Positive\n");
    if (0 <= b)
        return !printf("Zero\n");
    if ((b - a + 1) & 1)
        return !printf("Negative\n");
    return !printf("Positive\n");
}

Measured memory_bytes: 256
#! ruby -Ku

ans = ""
d = Array.new(4)

num = gets.to_i

4.times do |i|
	d[4-i-1] = num%10
	num /= 10
end

str = "#{d[0]}+#{d[1]}+#{d[2]}+#{d[3]}=7"
astr = Array.new(3)
f1 = 0
f2 = 0

check = d[0]
2.times do |e|
	if e == 0 then
		check += d[1]
		astr[0] = "+"
	else
		check -= 2*d[1]
		astr[0] = "-"
	end
	2.times do |f|
		if f == 0 then
			check += d[2]
			check += d[2] if f1 > 0
			astr[1] = "+"
			f1 += 1
		else
			check -= 2*d[2]
			astr[1] = "-"
		end
		2.times do |g|
			if g == 0 then
				check += d[3]
				check += d[3] if f2 > 0
				astr[2] = "+"
				f2 += 1
			else
				check -= 2*d[3]
				astr[2] = "-"
			end
			#find answer
			if check == 7 then
				3.times do |i|
					str[2*i+1] = astr[i]
				end
				ans = str
			end
		end
	end
end

puts ans

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

using namespace std;

int main()
{
    int a[101];
    int n;
    cin >> n;
    for(int i = 1; i <= n; i ++) {
        cin >> a[i];
        if(a[i] % 3 != 0 && a[i] % 5 != 0 && a[i] % 2 == 0) {
            cout << "DENIED";
            return 0;
        }
    }
    cout << "APPROVED";
    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

using ll = long long;
using ii = pair<int,int>;
using vi = vector<int>;
using vii = vector<ii>;

const int oo = 1e8+7;

int main() {
    
    int n;
    scanf("%d",&n);
    
    ll dp1 = 0, dp2 = 0, dp3 = 0;
    
    for(int i = 0; i < n; ++i) {
        ll a, b, c;
        scanf("%lld%lld%lld",&a,&b,&c);
        
        ll one = dp1, two = dp2, three = dp3;
        
        dp1 = max(dp1, two+a);
        dp1 = max(dp1, three+a);
        
        dp2 = max(dp2, one+b);
        dp2 = max(dp2, three+b);
        
        dp3 = max(dp3, one+c);
        dp3 = max(dp3, two+c);
    }
    
    cout << max(dp1, max(dp2,dp3)) << endl;
    
    return 0;
}




Measured memory_bytes: 256
#include<stdio.h>

int main(void){
    int a,b;

    scanf("%d %d",&a,&b);
    if(a==b){
        printf("a == b\n");
        return 0;
    }

    if(a>b){
        printf("a > b\n");
    }else{
        printf("a < b\n");
    }
    return 0;
}


Measured memory_bytes: 2104
import std.algorithm;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;
import std.format;

void main() {
  auto s = readln;
  int n;
  formattedRead (s, " %d", n);
  int t;
  bool[string] h;
  foreach (i; 0 .. n) {
    s = readln.strip;
    if (s in h) {
    } else {
      h[s] = true;
      ++t;
    }
  }
  writeln (t);
}



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

class AizuOnlineJudge {
    static void Main() {
        var max = Console.ReadLine();
        Console.WriteLine(Console.ReadLine().Split().Select(int.Parse).Aggregate(new[] { 0, 0 }, (p, c) => {
            if (p[0] >= c) {
                p[1]++;
            }
            p[0] = c;
            return p;
        })[1] + 1);
        Console.WriteLine(max);
    }
}



Measured memory_bytes: 22992
from itertools import combinations
from collections import Counter
N, K, L, R, *A = map(int, open(0).read().split())
def make(A, K):
    return [Counter(map(sum, combinations(A, l))) for l in range(0, K+1)]

P = make(A[:N//2], K)
Q = make(A[N//2:], K)

ans = 0
for i in range(K+1):
    p = P[i]; q = Q[K-i]
    sq = sorted(q)
    l = r = len(q)
    s = 0
    for k, v in sorted(p.items()):
        while r and k+sq[r-1] > R:
            r -= 1
            s -= q[sq[r]]
        while l and k+sq[l-1] >= L:
            l -= 1
            s += q[sq[l]]
        ans += v * s
print(ans)



Measured memory_bytes: 168736
#include  <bits/stdc++.h>
using namespace std;
static int fast_io = []() { std::ios::sync_with_stdio(false); cin.tie(nullptr); return 0; }();
int main(){
  int n;
  cin>>n;
  long long int sum=0;
  for(int i = 1;i<=n;i++){
    if(i%3==0||i%5==0)
      continue;
    else
      sum+=i;
  }
  cout<<sum<<"\n";  
 
  
  return 0;
}

Measured memory_bytes: 3656
package main

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

var sc = bufio.NewScanner(os.Stdin)

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

func main() {
	s := nextLine()

	if s[1]==s[2] {
		if s[0]==s[1] || s[2]==s[3] {
			fmt.Println("Yes")
			return
		}
	}

	fmt.Println("No")
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string str;
    cin >> str;
    for(int i = str.length() - 1, j = 0; i >= 0; i--, j++)
    {
        if(!(str[i] == 'p' && str[j] == 'q' || str[i] == 'q' && str[j] == 'p' || str[i] == 'd' && str[j] == 'b' || str[i] == 'b' && str[j] == 'd'))
        {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
using namespace std;

#define rep(i,n) for(int i = 0; i<n; ++i)
#define REP(i,n) for(int i = 1; i<=n; ++i)
#define all(x) begin(x),end(x)
#define show(obj) {for(auto x:obj)cout<<x<<' ';cout<<endl;}
#define line "----------"
typedef long long ll;
typedef pair<int,int> P;
const int inf = 1001001000;
const ll INF = 1LL<<60;
const ll MOD = 1e9 + 7;

int main(){
	ll N; cin>>N;
	vector<ll> A(N);
	rep(i,N)cin>>A[i];
	map<ll,ll> cnt;
	rep(i,N){
		cnt[A[i]+i]++;
	}
	ll ans = 0;
	rep(j,N){
		ans += cnt[j-A[j]];
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 27308
let _ = 
  let ar = Array.make 101 0 in
  try
    while true do
      let n = read_int () in
      ar.(n) <- ar.(n) + 1
    done
  with
    End_of_file -> 
    let mx = ref 0 in
    let idx = ref [] in
    Array.iteri (fun i x -> if x = !mx then idx := i :: !idx else if x > !mx then (mx := x; idx := [i]) else ()) ar;
    List.iter (Printf.printf "%d\n") @@ List.rev !idx

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

int main() {

	int n; cin >> n;
	int ans;
	if (n % 1000 == 0) ans = 0;
	else ans = 1000 - n % 1000;
	cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3580
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var scanner = bufio.NewScanner(os.Stdin)

func nextString() string {
	scanner.Scan()
	return scanner.Text()
}

func nextInt() int {
	n, err := strconv.Atoi(nextString())
	if err != nil {
		fmt.Printf("strconv.Atoi failed: %v\n", err)
	}
	return n
}

func maxValue(p []int) int {
	highest := 0
	for i := 0; i < len(p); i++ {
		if p[i] > highest {
			highest = p[i]
		}
	}
	return highest
}

func main() {
	scanner.Split(bufio.ScanWords)
	for {
		n := nextInt()
		m := nextInt()
		if n == 0 && m == 0 {
			break
		}

		pSum := make([]int, n)
		for i := 0; i < m; i++ {
			for j := 0; j < n; j++ {
				pSum[j] += nextInt()
			}
		}
		fmt.Println(maxValue(pSum))
	}
}



Measured memory_bytes: 1540