akhauriyash/Code-Regression huggingface dataset:
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <sstream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <iterator>
#include <bitset>
#include <ctime>
#include<unordered_set>
#include<complex>
#include <cassert>

using namespace std;

#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define RFOR(i,b,a) for (int i = (b)-1; i >= (a); i--)
#define ITER(it,a) for (__typeof(a.begin()) it = a.begin(); it != a.end(); it++)
#define FILL(a,value) memset(a, value, sizeof(a))

#define SZ(a) (int)a.size()
#define ALL(a) a.begin(), a.end()
#define PB push_back
#define MP make_pair

typedef long long LL;
typedef vector<int> VI;
typedef pair<int, int> PII;

const double PI = acos(-1.0);
const int INF = 1000 * 1000 * 1000 + 7;
const LL LINF = INF * (LL)INF;

int main()
{
    //freopen("in.txt", "r", stdin);
    //freopen("out.txt", "w", stdout);
    //ios::sync_with_stdio(false); cin.tie(0);
    int a, b;
    cin >> a >> b;
    cout << a * b << endl;
}

Measured memory_bytes: 3632
#include <bits//stdc++.h>
using namespace std;
#define rep(i,n,k) for(int i=n;i<k;i++)
#define int  long long
#define F first 
#define S second
#define P make_pair 
struct Runrun{
    vector<int> r;
};

signed main(void){
 
    
    int n,m,q,p,r,ans,t;
    string s;
    vector<int> v;
    ans=0;
    cin>>n;
    cin>>s;
    m=0;
    rep(i,0,n){
        if(s[i]=='.'){
        m++;
        }
    }
    ans=m;
    rep(i,0,n){
        if(s[i]=='.')
        m--;
        else
        m++;
        ans=min(ans,m);
    }
    cout<<ans<<endl;
  
}


Measured memory_bytes: 640
#include<stdio.h>
#include<iostream>
using namespace std;

int a,b;
int x[1000];
int main (){
    cin >> a >> b;
    int sum = 0;
    for(int i=1; i<1000; i++){
        sum += i;
        x[i] = sum;
    }
    for(int i=0; i<1000; i++){
        if ( (x[i] - a) == (x[i+1] - b)){
            cout << x[i] - a << endl;
            return 0;
        }
    }
    return 0;
}


Measured memory_bytes: 256
//挿入ソートのプログラム
//Ebitani Akira
//2018-12-04

#include <stdio.h>

#define N 100

int main(){
  int i,j,k;
  int array[N];
  int num;
  int key;

  //imput data
  scanf("%d",&num);
  for(i=0; i<num; i++){
    scanf("%d",&array[i]);
  }

  for(j=1; j<num; j++){
    key=array[j];
    i =j-1;

    for(k=0; k<num; k++){
      printf("%d",array[k]);
      if(k!=num-1)printf(" ");
    }
    printf("\n");
    

    while(i>=0 && array[i]>key){
      array[i+1]=array[i];
      i--;
    }
    array[i+1]=key;
  }
  for(k=0; k<num; k++){
    printf("%d",array[k]);
    if(k!=num-1)printf(" ");
  }
  printf("\n");

  return 0;
}
      



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

int main() {
  int N,T;
   cin>>N>>T;
  vector<pair<int,int>> vec(N);
  for(int i=0;i<N;i++){
	cin>>vec[i].second>>vec[i].first;
  }
  sort(vec.begin(),vec.end());
  int fast=1001;
  for(int i=0;i<N;i++){
    if(vec[i].first<=T){
      if(vec[i].second<fast){
        fast=vec[i].second;
      }
    }
    else break;
  }
  if(fast==1001) cout<<"TLE"<<endl;
  else cout<<fast<<endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#include <limits.h>
#include <stdbool.h>

#define rep(i, n) for(int i=0; i<(n); ++i)
#define max  200001

//qsort(str, n, sizeof(int), up_comp);
int up_comp(const void *a, const void *b){return *(int*)a - *(int*)b;}
int down_comp(const void *a, const void *b){return *(int*)b - *(int*)a;}
int int_sort( const void * a , const void * b ) {return strcmp(( char * )a , ( char * )b );}
int count_digit(int a){int i=0;while(a!=0){a=a/10;i++;}return i;}
int euclid( int a, int b ){int temp;if(a<b){temp=a;a=b;b=temp;}if(b<1)return -1;if(a%b==0) return b;return euclid(b,a%b);}

int main(void){
 
    int n;
    
    scanf("%d", &n);
    
    printf("ABC%d", n);
    
    return 0;
}



Measured memory_bytes: 1712
n, x = map(int, input().split())
c = []
i = 0

while n != 0 or x != 0:
    x1, x2, x3 = 1, 2, 3
    c.append(0)

    while x1 < int(x / 3):
        while x2 != (x - 1) and x2 <= x3:
            x3 = x - x2 - x1
            if x3 > x2 and n >= x3:
                c[i] += 1
            x2 += 1
        x1 += 1
        x2 = x1 + 1

    n, x = map(int, input().split())
    i += 1

for xc in c:
    print(xc)



Measured memory_bytes: 5600
#include <bits/stdc++.h>
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define ll long long int
#define pii pair<int,int>
#define pll pair<long long int,long long int>
#define pci pair<char,int>
#define mii map<int,int>
#define mll map<long long int,long long int>
#define mci map<char,int>
#define F first
#define S second
#define pb push_back
#define endl '\n'
#define yes cout << "YES\n"
#define no cout << "NO\n" 
#define pi 3.1415926536
#define mod  1000003
using namespace std;


int main(){
    IOS;

  string a,b;
  cin>>a>>b;
  int x=1;
  for(int i=0;i<a.size();i++){
  if(a[i]!=b[i]) {x=0;break;}
  }
if(x==1) cout<<"Yes\n";
else cout<<"No\n";  
    return 0;
}
    


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

using namespace std;

int INF = 1e9 + 5;

int main() {
    string s, t;
    cin >> s >> t;
    int n = (int) s.length();
    if (n != (int) t.length() - 1) {
        cout << "No" << endl;
        return 0;
    }
    for (int i = 0; i < n; i++) {
        if (s[i] != t[i]) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 3628
import qualified Data.ByteString.Char8 as B
import Data.Maybe (fromJust)
import qualified Data.Set as S

getInts :: IO[Int]
getInts = map (fst . fromJust . B.readInt) . B.words <$> B.getLine

main = do
  n <- readLn
  an <- S.fromList <$> getInts
  putStrLn $ if S.size an == n then "YES" else "NO"

Measured memory_bytes: 31100
use std::io::*;
use std::str::FromStr;

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

pub fn read_n<T: FromStr>(n: usize) -> Vec<T> {
    read_n_logic::<T>(n, vec![])
}

pub fn read_n_logic<T: FromStr>(n: usize, mut a: Vec<T>) -> Vec<T> {
    match n {
        0 => a,
        _ => {
            a.push(read::<T>());
            read_n_logic(n - 1, a)
        }
    }

}

use std::cmp::{max, min};
use std::collections::HashMap;
use std::collections::HashSet;

fn gcd(x: i64, y: i64) -> i64 {
    if y == 0 {
        x
    } else {
        gcd(y, x % y)
    }
}

fn trivial_division(n: u64) -> Vec<u64> {
    let mut result = n;
    for i in 2..((n as f64).sqrt() as u64) + 1 {
        if n % i == 0 {
            result = i;
            break;
        }
    }

    if result == n {
        return vec![n];
    } else {
        let mut v1 = vec![result];
        let mut v2 = trivial_division(n / result);

        v1.append(&mut v2);

        return v1;
    }
}

// fn main() {
//     println!("{:?}", trivial_division(238528));
// }

fn main() {
    let a: i64 = read();
    let b: i64 = read();

    let ab = gcd(a, b);

    let mut uniq: HashSet<u64> = HashSet::new();
    let sosuu = trivial_division(ab as u64);

    // println!("{:?}", sosuu);

    let uniq: HashSet<u64> = sosuu.into_iter().collect();

    // println!("{:?}", uniq);

    if uniq.contains(&1) {
        println!("{}", 1);
    } else {
        println!("{}", uniq.len() + 1);
    }

}


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

struct node_t{
    node_t *children[2];
    int value;
};

string::iterator state;
bool consume(char c){
    if(*state != c) return false;
    ++state;
    return true;
}
node_t *node(){
    node_t *ret = new node_t();
    assert(consume('('));
    if(consume(')')) ret->children[0] = nullptr;
    else{
        ret->children[0] = node();
        assert(consume(')'));
    }
    assert(consume('['));
    ret->value = 0;
    while(isdigit(*state)){
        ret->value *= 10;
        ret->value += *state - '0';
        ++state;
    }
    assert(consume(']'));
    assert(consume('('));
    if(consume(')')) ret->children[1] = nullptr;
    else{
        ret->children[1] = node();
        assert(consume(')'));
    }
    return ret;
}

node_t *merge(node_t *lhs, node_t *rhs){
    if(lhs == nullptr || rhs == nullptr) return nullptr;
    node_t *ret = new node_t();
    ret->value = lhs->value + rhs->value;
    ret->children[0] = merge(lhs->children[0], rhs->children[0]);
    ret->children[1] = merge(lhs->children[1], rhs->children[1]);
    return ret;
}

void print(node_t *n){
    printf("(");
    if(n->children[0]) print(n->children[0]);
    printf(")[%d](", n->value);
    if(n->children[1]) print(n->children[1]);
    printf(")");
}

int main(){
    string a, b;
    cin >> a >> b;
    state = a.begin();
    auto na = node();
    assert(state == a.end());
    state = b.begin();
    auto nb = node();
    assert(state == b.end());

    print(merge(na, nb));
    printf("\n");
    return 0;
}


Measured memory_bytes: 3352
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll N, Q, A, B;
ll pos[200000  +10];
ll base = 0;
template <typename T>
class ST {
 public:
  vector<T> tree;
  int n;

  ST() = default;
  ST(const vector<T> &arr) : n(arr.size()) {
    tree = vector<T>(2 * n);
    for (int i = 0; i < n; ++i) {
      update(i, arr[i]);
    }
  }
  void update(int p, T val) {
    int i = n + p;
    tree[i] = val - base;
    i /= 2;
    while (i) {
      tree[i] = tree[i * 2];
      if (i * 2 + 1 < tree.size()) {
        tree[i] = min(tree[i], tree[i * 2 + 1]);
      }
      i /= 2;
    }
  }

  T query(int start, int end) {  // start index - end index
    int l = n + start;
    int r = n + end - 1;
    T ret = INT_MAX;
    while (l <= r) {
      if (l & 1) {
        ret = min(ret, tree[l]);
        l++;
      }

      if ((r & 1) == 0) {
        ret = min(ret, tree[r]);
        r--;
      }

      l /= 2;
      r /= 2;
    }

    return ret + base;
  }

};

ST<ll> st1, st2;


ll getAug(int x) {
  ll r1 = st1.query(x, N) - x;
  ll r2 = st2.query(0, x) + x;
  return min(r1, r2);
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);

  cin >> N >> Q >> A >> B;

  for (int i = 0; i < Q; ++i) {
    int x;
    cin >> x;
    pos[i] = x - 1;
  }

  ll p1 = A - 1;
  ll p2 = B - 1;

  vector<ll> dp(N, INT_MAX);

  ll lp = p1;
  dp[p2] = 0;
  st1 = ST<ll>(dp);
  for (int i = 0; i < N; ++i) {
    st1.update(i, dp[i] + i);
  }


  st2 = ST<ll>(dp);

  for (int i = 0; i < N; ++i) {
    st2.update(i, dp[i] - i);
  }

  for (int i = 0; i < Q; ++i) {
    auto cp = pos[i];
    auto aug = getAug(cp);
    base += abs(cp - lp);

    ll real1 = dp[lp] + base;
    ll real2 = aug;
    ll rreal = min(real1, real2);

    dp[lp] = rreal - base;

    st1.update(lp, dp[lp] + lp + base);
    st2.update(lp, dp[lp] - lp + base);
    lp = cp;
  }

  ll ret = 1LL << 62;

  for (int i = 0; i < N; ++i) {
    ret = min(ret, dp[i] + base);
  }

  cout << ret << endl;
}

Measured memory_bytes: 9600
#include <iostream>
#include <algorithm>
#include <string>
#include <math.h>
#include <bitset>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include<iomanip>

#define i64 int64_t
#define ff(ii,nn,mm) for(int ii=nn;ii<mm;ii++)
#define ffrvs(ii,nn,mm) for(int ii=nn;ii>=mm;ii--)
#define srt(vvv) sort(vvv.begin(),vvv.end())
#define srtrvs(vvv) reverse(vvv.begin(),vvv.end())
#define Graph vector<vector<int>>
i64 inf = 1000000007;
i64 giant = 4000000000000000037;

using namespace std;

//メモリ置き場
int n, k;

//inputします
void input() {
	cin >> n >> k;
}

//ライブラリ置き場



//main
int main() {
    input();
	double ans = 0;
	ff(i, 1, n + 1) {
		i64 pre = n;
		int ii = i;
		while (ii < k) {
			pre *= 2;
			ii *= 2;
		}
		double c = pre;
		ans += 1 / c;
	}
	cout << setprecision(13) << ans << endl;
	return 0;
}

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

#define int long long

using namespace std;

signed main(){
//	int t;
//	cin >> t;
//	while(t--){
		int n;
		cin >> n;
		int a[n];
		for(int i=0;i<n;i++){
			cin >> a[i];
		}
		int amt=1000;
		int stk=0;
		int i=0;
		while(i<n){
			while(i<n-1&&a[i]>=a[i+1]){
				i++;
			}
			if(i==n-1){
				break;
			}
			stk+=(amt/a[i]);
			amt=amt%a[i];
			i++;
			while(i<n&&a[i-1]<=a[i]){
				i++;
			}
			amt+=(stk*a[i-1]);
			stk=0;
		}
		cout << amt << endl;
//	}
}

Measured memory_bytes: 3592
import Control.Applicative
import Control.Monad
import Data.Function

main :: IO()
main = do
    [a,b] <- words <$> getLine
    let c = read (a ++ b) :: Int
    ($ 4) . fix $ \loop i ->
        case compare (i*i) c of
            LT -> loop (i+1)
            EQ -> putStrLn "Yes"
            GT -> putStrLn "No"


Measured memory_bytes: 508
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
  public static void main(String args[]) {

    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    String S = sc.next();

    List<Character> list = new ArrayList<Character>();

    for (int i = 0; i < N; i++) {

      if (i == 0) {
        list.add(S.charAt(i));
        continue;
      }

      if (S.charAt(i) != S.charAt(i - 1)) {
        list.add(S.charAt(i));
      }
    }

    System.out.println(list.size());

    sc.close();
  }
}


Measured memory_bytes: 26848
#include <cstring>
#include <sstream>
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <iomanip>
#include <map>
#include <unordered_map>
#include <cmath>
#include <queue>
#include <set>
#include <numeric>
#include <stack>

using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(ll i = n - 1; i >= 0; i--)
#define repone(i, n) for(ll i = 1; i <= (ll)(n); i++)
#define each(i, mp) for(auto i:mp)
#define eb emplace_back
#define F first
#define S second
#define all(obj) (obj).begin(), (obj).end()
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll mod = 1000000007;
const ll inf = ll(1e9);
const ll half_inf = ll(1e5);
const ll ll_inf = ll(1e9) * ll(1e9);
typedef unordered_map<ll, ll> mpll;
typedef unordered_map<char, ll> mpcl;
typedef unordered_map<string, ll> mpsl;
typedef pair<ll, ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
template<typename T> using PQ = priority_queue<T>;
template<typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;

ll inl() {
    ll x;
    cin >> x;
    return (x);
}

string ins() {
    string x;
    cin >> x;
    return (x);
}

int main() {
#ifdef MY_DEBUG
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wmissing-noreturn"
    while (true) {
#pragma clang diagnostic pop
#endif
        ll h = inl(), w = inl(), n = inl();
        vl a(n), b(n);
        vector<P> ab(n);
        map<P, ll> mp, seen;
        rep(i, n) {
            a[i] = inl(), b[i] = inl();
            a[i]--, b[i]--;
            ab[i] = P(a[i], b[i]);
            mp[ab[i]]++;
        }
        vl ans(10);
        each(m, ab) {
            for (int i = -1; i <= 1; ++i) {
                for (int j = -1; j <= 1; ++j) {
                    ll ni = m.first + i, nj = m.second + j;
                    if (ni < 1 || ni > h - 2 || nj < 1 || nj > w - 2) continue;
                    if (seen[P(ni, nj)] > 0) continue;
                    ll c = 0;
                    for (int k = -1; k <= 1; ++k) {
                        for (int l = -1; l <= 1; ++l) {
                            if (mp[P(ni + k, nj + l)] > 0) c++;
                        }
                    }
                    ans[c]++, seen[P(ni, nj)]++;
                }
            }
        }
        ans[0] = (h - 3 + 1) * (w - 3 + 1) - accumulate(all(ans), 0LL);
        rep(i, 10) cout << ans[i] << endl;


#ifdef MY_DEBUG
    }
#endif
    return 0;
}

Measured memory_bytes: 215936
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <cmath>
#include <queue>
#include <limits>
#include <iomanip>

using namespace std;

int main() {
    int a, b;
    cin >> a >> b;
    for(int c = 1; c <= 3; c++) {
        if((a * b * c) % 2 == 1) {
            cout << "Yes" << endl;
            return 0;
        }
    }

    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
from __future__ import print_function

import sys
input = sys.stdin.readline


def eprint(*args, **kwargs):
    print(*args, file=sys.stderr, **kwargs)
    return


# import re
# import array
# import copy
# import functools
# import operator

# import math
# import string
import fractions
# from fractions import Fraction
from fractions import gcd

# import collections
import itertools
from itertools import combinations
from itertools import permutations

# import bisect

# import heapq
# from heapq import heappush
# from heapq import heappop
# from heapq import heappushpop
# from heapq import heapify
# from heapq import heapreplace
# from queue import PriorityQueue as pq
from queue import Queue

# from itertools import accumulate

# from collections import deque
# from collections import Counter

from operator import mul
from functools import reduce

# def lcm(n,m):
#     return int(n*m/gcd(n,m))


def crange(a, b, i):
    return range(a, b + 1, i)


def coprimize(p, q):
    common = fractions.gcd(p, q)
    return (p // common, q // common)


def combinations_count(n, r):
    r = min(r, n - r)
    numer = reduce(mul, range(n, n - r, -1), 1)
    denom = reduce(mul, range(1, r + 1), 1)
    return numer // denom


# import random
# import time

k, s = map(int, input().strip().split())
cnt = 0
for x in range(0, k + 1):
    for y in range(0, k + 1):
        if 0 <= s - x - y <= k:
            cnt += 1
print(cnt)


Measured memory_bytes: 67048
n,k = map(int,input().split())
h = list(map(int,input().split()))
inf = 10**12
dp = [inf]*n
dp[0] = 0
for i in range(n):
    for j in range(1,k+1):
        if i+j < n:
            dp[i+j] = min(dp[i+j], dp[i]+abs(h[i]-h[i+j]))
print(dp[-1])

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

using namespace std;

typedef long long ll;

const int INF = 1000000000;

int main()
{
  int N, K; scanf("%d %d", &N, &K);
  ll ans = 0;
  for (ll b = 1; b <= N; ++b) {
    ll q = N / b, r = N % b;
    ans += q * max(0LL, b - K) + max(0LL, r - K + 1);
    if (K == 0) { --ans; }
  }
  printf("%lld\n", ans);
  return 0;
}


Measured memory_bytes: 256
s = input()
for i in range(len(s)-1):
  if s[i] == s[i+1]:
    print(i+1,i+2)
    exit()
  elif i <= len(s)-3:
    if s[i] == s[i+2]:
      print(i+1,i+3)
      exit()
print(-1,-1)



Measured memory_bytes: 3188
n = int(input())
lst = []
for i in range(n):
  x = input()
  if i==0:
    lst.append(x)
    continue
  else:
    if (x not in lst)&(str(lst[i-1])[-1:] == x[0]):
      lst.append(x)
      continue
    else:
      print("No")
      quit()
print("Yes")

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

using namespace std;

int main()
{
	int N, M;
	cin >> N >> M;
	vector < int >p(M);
	vector < string > S(M);
	for (int i = 0; i < M; i++) {
		cin >> p[i] >> S[i];
		p[i]--;
	}

	vector < int >isAC(N, 0);
	vector < int >WAcount(N, 0);

	for (int i = 0; i < M; i++) {
		if (isAC[p[i]] == 0) {
			if (S[i] == "AC") {
				isAC[p[i]] = 1;
			} else {
				WAcount[p[i]]++;
			}
		}
	}

	int correct = 0;
	int penalty = 0;
	for (int i = 0; i < N; i++) {
		if (isAC[i] == 1) {
			correct++;
			penalty += WAcount[i];
		}
	}

	cout << correct << " " << penalty << endl;

	return 0;
}


Measured memory_bytes: 6912
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define srt(i) sort(i.begin(), i.end())
#define rvt(i) sort(i.begin(), i.end(), greater<int>())
 
int main() {
  string s;
  cin >> s;
  int64_t ans0=0;
  for(int i=0; i< (1<<(s.length()-1)); i++){
    bitset<11> b(i);
    int64_t ans=0;
    string tmp="";
    for(int j=0; j<s.length(); j++){
      tmp+=s.at(j);
      if(b.test(j)){
        ans+=stol(tmp);
        tmp="";
      }
    }
    if(tmp!=""){
      ans+=stol(tmp);
    }
    ans0+=ans;
  }

  cout << ans0 << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<queue>
#include<map>
using namespace std;
int I,J,x,y,mas[110][110]={{0}};
int dy_k[6]={-1,-1, 0, 0, 1, 1};
int dx_k[6]={ 0, 1,-1, 1, 0, 1};
int dy_g[6]={-1,-1, 0, 0, 1, 1};
int dx_g[6]={-1, 0,-1, 1,-1, 0};
int d[110][110];
int wall=0;
long long int wall_len=0;
typedef pair<int,int>P;
int bfs();
int wall_reck(int,int);
int main(){
  cin >> x >> y;
  for(int i=0;i<y+2;i++){
    for(int j=0;j<x+2;j++){
      mas[i][j]=0;
    }
  }

  for(int i=1;i<y+1;i++){
    for(int j=1;j<x+1;j++){
      cin >> mas[i][j];
    }
  }

  for(int i=0;i<y+2;i++){
    for(int j=0;j<x+2;j++){
      if(mas[i][j]==0){
	if(i==0 || j==0 || i==y+1 || j==x+1){
	  wall_reck(i,j);
	}
	else{
	  I=i;
	  J=j;
	  bfs();
	  //帰ってきた値が1（つまり、抜けられた）、または範囲外（必ず１）なら、周り(六方)の壁の数を計算。
	  if(wall == 1){
	    wall=0;
	    wall_reck(i,j);
	  }
	}
	  
 

      }
    }
  }
  cout << wall_len << endl;
}

int bfs(){
  queue<P>que;
  memset(d,-1,sizeof(d));
  que.push(P(I,J));
  d[I][J] = 0;
  while(!que.empty()){
    P p = que.front();
    que.pop();
    //外につながったか。
    if(p.first==0 || p.second==0 || p.first==y+1 || p.second==x+1){
      wall=1;
      break;
    }
    for(int i=0;i<6;i++){
      int ny,nx;
      if(p.first%2==0){
	ny=p.first+dy_g[i];
	nx=p.second+dx_g[i];
      }
      else{
	ny=p.first+dy_k[i];
	nx=p.second+dx_k[i];
      }
      if(mas[ny][nx]==0 && d[ny][nx]==-1){
	que.push(P(ny,nx));
	d[ny][nx]=d[p.first][p.second]+1;
      }
    }

  }
}

int wall_reck(int i,int j){
  for(int k=0;k<6;k++){

    if(i%2==0){
      if(mas[i+dy_g[k]][j+dx_g[k]]==1){
	wall_len++;
      }
    }
    else{
      if(mas[i+dy_k[k]][j+dx_k[k]]==1){
	wall_len++;
      }
    }

  }
}

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

using namespace std;

#define MODULE 1000000007
#define MP make_pair

template<class T,class U>inline void chmin(T &t,U f){if(t>f)t=f;}
template<class T,class U>inline void chmax(T &t,U f){if(t<f)t=f;}

typedef pair<int, int> P;
typedef long long LL;
const int INF = INT_MAX / 2;    //int_max->2*e+9
const int MAXN = 100001;

/*struct edge {
    edge(int to, int cost) : to(to), cost(cost) {}
    int to, cost;
};
vector<edge> graph[MAXN];*/

int dx[4] = {-1, 0, 1, 0};
int dy[4] = {0, -1, 0, 1};
//-----Template---------
bool isLoopable(char c,int tmpK){
    return ('z'-c+1)<=tmpK;
}
int getRemainK(char c,int tmpK){
    return tmpK-('z'-c+1);
}
string s;
int K,tmp;
int main(){
    ios::sync_with_stdio(false);
    cin>>s;
    cin>>K;
    tmp=K;
    for(int i=0;i<s.length();i++){
        if(isLoopable(s[i],tmp) && s[i]!='a'){
            tmp=getRemainK(s[i],tmp);
            s[i]='a';
        }
    }
    if(tmp!=0){
        tmp=tmp%26;
        if(isLoopable(s[s.length()-1],tmp)){
            s[s.length()-1]='a'+getRemainK(s[s.length()-1],tmp);
        }else{
            s[s.length()-1]+=tmp;
        }
    }
    cout<<s<<endl;

}

Measured memory_bytes: 592
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);++i)
#define ALL(v)   (v).begin(),(v).end()
#define debug(x) cerr<<#x<<": "<<(x)<<endl
#define INF      (int)1e9
#define EPS      (double)1e-9
#define MOD      ((int)1e9+7)
using namespace std;
typedef long long     llong;
typedef vector<int>   vi;
typedef vector<vi >   vvi;
typedef vector<vvi >  vvvi;
typedef pair<int,int> pii;
template<class Type> void line(const Type &a){int cnt=0;for(const auto &elem:a){if(cnt++)cout<<' ';cout<<elem;}cout<<endl;}

int main(){
	int x[5];
	REP(i,5) cin>>x[i];
	
	REP(i,5){
		if(x[i]==0){
			cout<<i+1<<endl;
			return 0;
		}
	}
}

Measured memory_bytes: 3576
/* Author : tushar3105 */

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;

typedef pair<long long int,long long int> ii;					// Pair of integers
typedef vector<long long int> vi;                   				// Vector of integers
typedef vector<vector<long long int>> vvi;                 			// Vector of vi
typedef vector<pair<long long int, long long int>> vii;				// Vector of ii

#define pb push_back								// Push back to vectors
#define mp make_pair								// For pairs
#define ff first								// For pairs
#define ss second								// For pairs
#define all(c) (c).begin(),(c).end()						// Use in sorting
#define sz(a) ((long long int)(a).size())
#define lli long long int
#define ull unsigned long long int
#define ld long double
#define ref(i,x,y) for(long long int i=(x);i<=(y);++i)				// Loop to go forward
#define reb(i,x,y) for(long long int i=(x);i>=(y);--i)				// Loop to go backward
#define trf(c,it) for(auto it = (c).begin(); it != (c).end(); it++)		// Remember it is an iterator
#define trb(c,it) for(auto it = (c).end()-1; it != (c).begin()-1; it--)		// Remember it is an iterator
#define tc(t) long long int (t); cin>>(t);while((t)--)				// Test cases
//fill (dist,dist+110000,pinf);							// For setting default

const long long int mod = 1e9+7;
const long long int pinf = 9223372036854775807;
const long long int ninf = -9223372036854775807;

/*-----------------------------Code begins----------------------------------*/

int main (void)
{
	// ios_base::sync_with_stdio(false);
	// cin.tie(NULL);
	// #ifndef ONLINE_JUDGE
	// freopen("input.txt","r",stdin);
	// freopen("output.txt","w",stdout);
	// #endif

	lli x, sum=0;
	cin>>x;
	sum=1000*(x/500);
	x=x%500;
	sum=sum+(5*(x/5));
	cout<<sum<<endl;
	return 0;
}

Measured memory_bytes: 256
// $%U%$ $%Y%$-$%M%$-$%D%$ $%h%$:$%m%$

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

int main(){
	cin.tie(0);
	ios_base::sync_with_stdio(0);
	set<int> s;
	int n;
	cin>>n;
	for(int i=0; i<n; ++i){
		int t;
		cin>>t;
		if(s.count(t)){
			cout<<"NO\n";
			return 0;
		}
		s.insert(t);
	}
	cout<<"YES\n";
	return 0;
}



Measured memory_bytes: 9600
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		List<Integer> w = new ArrayList<Integer>();
		List<Integer> h = new ArrayList<Integer>();


		 for(int i=0;;i++){
			 h.add(i, scan.nextInt());
			 w.add(i, scan.nextInt());
			 if(w.get(i)==0 && h.get(i)==0) break;
		 }

		 for(int i=0;;i++){
			if(w.get(i)==0 && h.get(i)==0) break;
			if(/*w.get(i)<=100 &&*/ h.get(i)>=3) printFlame(w.get(i),h.get(i));
		 }
	}

	static void printFlame(int w,int h){

		for(int j=0 ; j < w  ;j++){
			System.out.print("#");
		}

		System.out.println();
		
		for(int i=0 ;i< h -2;i++){
			System.out.print("#");
			for(int j=0 ; j < w -2 ;j++){
				System.out.print(".");
			}
			System.out.println("#");
		}
		
		for(int j=0 ; j < w  ;j++){
			System.out.print("#");
		}

		System.out.println();
		System.out.println();

	}

}

Measured memory_bytes: 37060
N = int(input())
#N,M = map(int,input().split())
A = list(map(int,input().split()))
#A = [list(map(int,input().split())) for i in range(N)]
ans = [0 for i in range(N)]
ans[0] = int((A[0]+A[-1]-A[-2])//2)
ans[1] = int((A[1]+A[-2]-A[-1])//2)
ans[0] = sum(((-1)**i)*A[i] for i in range(N))//2
for i in range(1,N):
    ans[i] = A[i-1]-ans[i-1]
for i in ans:
    print(2*i,end = ' ')

Measured memory_bytes: 14032
import java.io.*;
import java.util.*;
public class Main{
    public static void main(String[] args) throws IOException{
        MyReader r = new MyReader();        
        int N, M;
        {int[] a = r.ii(); N = a[0]; M = a[1];}
        int[][] work = new int[N][2];
        for(int i = 0; i < N; i++)
            work[i] = r.ii();
            
        Arrays.sort(work, (x, y) -> -x[0]+y[0]);
        long ans = 0;
        PriorityQueue<Integer> heap = new PriorityQueue<>((x, y) -> -x+y);
        for(int i = Math.min(M-1, N-1), j = N-1; i >= 0; i--){            
            while(j >= 0 && i+work[j][0] <= M){
                heap.add(work[j][1]);
                j--;
            }
            if(heap.size() > 0)
                ans += heap.poll();            
        }
        println(ans);
    }
    static void print(Object o){
        System.out.print(o.toString());
    }
    static void println(Object o){
        System.out.println(o.toString());
    }
    static int Int(String s){
        return Integer.parseInt(s);
    }
    static long Long(String s){
        return Long.parseLong(s);
    }
    static class MyReader extends BufferedReader{
        MyReader(){
            super(new InputStreamReader(System.in));
        }
        String s() throws IOException{
            return readLine();
        }
        String[] ss() throws IOException{
            return s().split(" ");
        }
        int i() throws IOException{
            return Int(s());
        }
        int[] ii() throws IOException{
            String[] ss = ss();
            int size = ss.length;
            int[] ii = new int[size];
            for(int j = 0; j < size; j++) ii[j] = Integer.parseInt(ss[j]);
            return ii;
        }
        long l() throws IOException{
            return Long(s());
        }
        long[] ll() throws IOException{
            String[] ss = ss();
            int size = ss.length;
            long[] ll = new long[size];
            for(int j = 0; j < size; j++) ll[j] = Long.parseLong(ss[j]);            
            return ll;
        }
    }
}

Measured memory_bytes: 47668
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める
typedef long long ll;
typedef long double ld;
int main(){
    string s;cin>>s;
    s[3]='8';
    cout<<s;
    return 0;
}


Measured memory_bytes: 3636
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#define ll long long
#define ld long double
using namespace std;
ll a, b;
set<int>s;
int main()
{
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    cin >> a >> b;
    a = __gcd(a, b);
    for(int i = 2; i <= sqrt(a); i++){
        bool ok = 0;
        while(a % i == 0)
            a /= i, ok = 1;
        if(ok) s.insert(i);
    }
    if(a > 1)
        s.insert(a);
    cout << s.size() + 1 << '\n';
    return 0;
}


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

# define rep(i, n) for(int(i)=0;(i)<(n);(i)++)
# define reps(i, n) for(int(i)=1;(i)<=(n);(i)++)
# define rrep(i, n) for(int i=((int)(n)); i>0; --i)
# define rreps(i, n) for(int i=((int)(n)); i>=0; --i)
# define ALL(v) v.begin(), v.end()
template<class T>inline bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>inline bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
template<typename T> void dump(T e){std::cout << e << std::endl;}
template<typename T> void dump(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void dump(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ dump(v); } }
typedef long long ll;
#define INF (INT_MAX / 4)


int main() {
  int N; cin >> N;
  double T,A; cin >> T >> A;
  vector <double> H(N);
  rep(i, N) cin >> H[i];
  
  vector <double> Temp;
  rep(i, H.size()) {
    double temp = abs(T - H[i] * 0.006 - A);
    Temp.push_back(temp);
  }
  int minElement = min_element(Temp.begin(), Temp.end()) - Temp.begin();
  dump(minElement+1);
}

Measured memory_bytes: 256
//https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8 より
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};
    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };
    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

//

use std::io::Write;

fn run() {
    input! {
        a: [u32; 3],
    }
    let s: u32 = a.iter().sum();
    for i in 0..3 {
        if s - a[i] == a[i] {
            println!("Yes");
            return;
        }
    }
    println!("No");
}

fn main() {
    run();
}


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

void solve() {
    int n; cin >> n;
    int a[n];
    for (int i = 0; i < n; i++)  cin >> a[i];
    vector<int> dp(n, 0);
    dp[1] = abs(a[1] - a[0]);
    for (int i = 2; i < n; i++) {
        int op1 = abs(a[i] - a[i - 1]) + dp[i - 1];
        int op2 = abs(a[i] - a[i - 2]) + dp[i - 2];
        dp[i] = min(op1, op2);

    }

    cout << dp.back();



}

int main() {
    solve();
    return 0;

}

Measured memory_bytes: 4000
# -*- coding: utf-8 -*-

N = int(input())
conditions = []
for i in range(N):
    x,y,h = map(int, input().split())
    conditions.append([x,y,h])


for cx in range(101):
    for cy in range(101):
        H = -1
        for _,cond in enumerate(conditions):
            if cond[2] > 0:
                H_tmp = cond[2] + abs(cond[0]-cx) + abs(cond[1]-cy)
                if H == -1:
                    H = H_tmp
                else:
                    if H_tmp != H:
                        H = -2
                        break

        if H == -2:
            continue

        for _,cond in enumerate(conditions):
            if cond[2] == 0:
                if H > abs(cond[0]-cx) + abs(cond[1]-cy):
                    H = -2
                    break
        
        if H == -2:
            continue
        
        print(cx,cy,H)



Measured memory_bytes: 9088
#include<cstdio>
using namespace std;
int n,a[100005],sum[100005],mx,mn;
int main()
{
	scanf("%d",&n);for(int i=1;i<=n;++i) {scanf("%d",&a[i]);sum[a[i]]++;}
	for(int i=n;i;--i) if(sum[i]) {mx=i;break;}
	for(int i=1;i<=n;++i) if(sum[i]) {mn=i;break;}
	if(!(mx&1)&&mn==mx/2&&sum[mn]>=2) printf("Impossible");
	else if((mx&1)&&mn==mx/2+1&&sum[mn]!=2) printf("Impossible");
	else {
		for(int i=mn+1;i<=mx;++i) if(sum[i]<=1) {printf("Impossible");return 0;}
		printf("Possible");
	}
	return 0;
}

Measured memory_bytes: 128
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <cmath>
#include <sstream>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define all(c) (c).begin(), (c).end()
#define loop(i,a,b) for(ll i=a; i<ll(b); i++)
#define rep(i,b) loop(i,0,b)
#ifdef DEBUG
#define dump(...) (cerr<<#__VA_ARGS__<<" = "<<(DUMP(),__VA_ARGS__).str()<<" ["<<__LINE__<<"]"<<endl)
struct DUMP:ostringstream{template<class T>DUMP &operator,(const T&t){if(this->tellp())*this<<", ";*this<<t;return *this;}};
#else
#define dump(...)
#endif

int n;
int x[55],y[55],xx[55],yy[55];

ll mask[102][102];
int col[102][102];
typedef pair<int,int> P;

inline bool valid(int x, int y){
    return 0 <= x && x < 102 && 0 <= y && y < 102;
}

int xs[102], ys[102];

int solve(){
    int cx=0, cy=0;
    rep(i,n){
        xs[cx++]=x[i];
        xs[cx++]=xx[i];
        ys[cy++]=y[i];
        ys[cy++]=yy[i];
    }
    xs[cx++]=-1;
    ys[cy++]=-1;
    sort(xs,xs+cx);
    sort(ys,ys+cy);
    cx = unique(xs,xs+cx)-xs, cy = unique(ys,ys+cy)-ys;

    memset(mask,0,sizeof(mask));
    rep(i,n){
        int x1=lower_bound(xs,xs+cx,x[i])-xs;
        int x2=lower_bound(xs,xs+cx,xx[i])-xs;
        int y1=lower_bound(ys,ys+cy,y[i])-ys;
        int y2=lower_bound(ys,ys+cy,yy[i])-ys;
        loop(x,x1,x2){
            loop(y,y2,y1){
                mask[y][x]|=1LL<<i;
            }
        }
    }

    int cnt = 0;
    memset(col,0,sizeof(col));
    int dx[]={0,0,1,-1};
    int dy[]={1,-1,0,0};
    rep(i,102)rep(j,102)if(col[i][j]==0){
        cnt++;
        stack<P> s; s.push(P(j,i));
        while(s.size()){
            int x,y;
            tie(x,y) = s.top(); s.pop();
            if(col[y][x]) continue;
            col[y][x] = cnt;
            rep(d,4){
                int nx,ny;
                tie(nx,ny) = P(x+dx[d], y+dy[d]);
                if(!valid(nx,ny)) continue;
                if(mask[y][x]!=mask[ny][nx]) continue;
                if(col[ny][nx]) continue;
                s.push(P(nx,ny));
            }
        }
    }
    return cnt;
}

int main(){
    int cnt = 0;
    while(cin>>n && n){
        cnt++;
        rep(i,n)cin>>x[i]>>y[i]>>xx[i]>>yy[i];
        cout << solve() << endl;
    }
}

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

int main() {
  int n,m;
  cin>>n>>m;
  priority_queue<long long>p;
  for(int i=0;i<n;i++){
    long long k;
    cin>>k;
    p.push(k);
  }
  for(int i=0;i<m;i++){
    p.push(p.top()/2);
    p.pop();
  }
  long long ans=0;
  for(int i=0;i<n;i++){
    ans+=p.top();
    p.pop();
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 1400
#include <bits/stdc++.h>
#define ll long long int
#define ld long double
#define ull unsigned long long int
#define forn(i,n)for(ll i=0;i<(n);i++)
#define forn_rev(i,n)for(ll i=(n)-1;i>=0;i--)
#define for1n(i,n) for(ll i=1;i<=(n);i++)
#define ARRAY_SIZE(a) sizeof(a)/sizeof(*a)
#define MOD 1000000007
#define MAXN 100005

using namespace std;

bool s2cmp(const pair<ll,ll> &a,const pair<ll,ll> &b){
    return a.second>b.second;
}


int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(NULL); cout.tie(NULL);
    ll T=1;
    //cin>>T;
    while(T--)
    {


       ll N;
       cin>>N;
       vector<string> arr(N);
       forn(i,N) cin>>arr[i];
       vector<vector<ll>> dp(2,vector<ll>(N));
       forn(i,N){
            ll l=0,r=0;
            stack<char> st;
            forn(j,arr[i].length()){
                if(st.empty()){
                    st.push(arr[i][j]);
                }
                else if(st.top()=='(' && arr[i][j]==')'){
                    st.pop();
                }
                else{
                    st.push(arr[i][j]);
                }
            }
            while(!st.empty()){
                if(st.top()=='(') l++;
                else if(st.top()==')') r++;
                st.pop();
            }


            dp[0][i]=l;
            dp[1][i]=r;
       }
       vector<pair<ll,ll>> s1,s2;
       forn(i,N){
        if(dp[1][i]-dp[0][i]>=0){
            s1.push_back({dp[0][i],dp[1][i]});
        }
        else{
            s2.push_back({dp[0][i],dp[1][i]});
        }

       }
       sort(s1.begin(),s1.end());
       sort(s2.begin(),s2.end(),s2cmp);
       for(auto x:s2) s1.push_back(x);
       ll S=0;
       for(auto x:s1){
            S-=x.first;
            if(S<0){
                cout<<"No";
                return 0;
            }
            S+=x.second;
       }
       if(S==0) cout<<"Yes";
      else cout<<"No";







    }



    return 0;
}

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

using Graph = vector<vector<int>>;
using P = pair<int, int>;
using Tuple = tuple<int, int, int>;


int main() {
    string n; cin >> n;
    rep(i, n.size()) {
        if(n[i] == '7'){
            cout << "Yes" << endl;
            return 0;
        }
    }


    cout << "No" << endl;
    return 0;

}


Measured memory_bytes: 3628
s = int(input())

n = s
a = [s]
while True:
    if n % 2 == 0:
        n /= 2
        a.append(n)
    else:
        n = n * 3 + 1
        a.append(n)

    if n in a[:len(a) - 1]:
        break

print(len(a))

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


int main() {
    
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    int f=-1;
    while(a!=0||c!=0)
    {
        if(c>0)
        c=c-b;
        if(c<=0)
        {
          f=1;
          break;
        }
        if(a>0)
        a=a-d;
        if(a<=0)
        {
            f=0;
            break;
        }
    }
    if(f==1)
    cout<<"Yes"<<endl;
    else
    cout<<"No"<<endl;
	// your code goes here
	return 0;
}



Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> lpair;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define rREP(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define printa(x,n) for(ll i = 0; i < n; i++){ cout << (x[i]) << " ";} cout<<endl;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int x,a,b;
    cin >> x >> a >> b;

    if (b-a <= 0)
    {
      cout << "delicious" << endl;
    }
    else if (b-a <= x)
    {
      cout << "safe" << endl;
    }
    else
    {
      cout << "dangerous" << endl;
    }
}


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

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author KharYusuf
 */
public class Main {
    public static void main(String[] args) throws Exception {
        Thread thread = new Thread(null, new TaskAdapter(), "KharYusuf", 1 << 27);
        thread.start();
        thread.join();
    }

    static class TaskAdapter implements Runnable {
        @Override
        public void run() {
            InputStream inputStream = System.in;
            OutputStream outputStream = System.out;
            FastReader in = new FastReader(inputStream);
            PrintWriter out = new PrintWriter(outputStream);
            ATakahashikunTheStrider solver = new ATakahashikunTheStrider();
            solver.solve(1, in, out);
            out.close();
        }
    }

    static class ATakahashikunTheStrider {
        public void solve(int testNumber, FastReader s, PrintWriter w) {
            int x = s.nextInt();
            w.println(360 / func.gcd(x, 360));
        }

    }

    static class FastReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private FastReader.SpaceCharFilter filter;

        public FastReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {

            if (numChars == -1)
                throw new InputMismatchException();

            if (curChar >= numChars) {

                curChar = 0;

                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }

                if (numChars <= 0)
                    return -1;
            }

            return buf[curChar++];
        }

        public int nextInt() {

            int c = read();

            while (isSpaceChar(c))
                c = read();

            int sgn = 1;

            if (c == '-') {
                sgn = -1;
                c = read();
            }

            int res = 0;

            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();

                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));

            return res * sgn;
        }

        public boolean isSpaceChar(int c) {

            if (filter != null)
                return filter.isSpaceChar(c);

            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }

    static class func {
        public static int gcd(int a, int b) {
            int t;
            while (b != 0) {
                t = b;
                b = a % b;
                a = t;
            }
            return a;
        }

    }
}



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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

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

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

    ll r;
    cin >> r;
    cout << r*r << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    string show[]={"0111111","0000110","1011011",
    "1001111","1100110","1101101","1111101","0100111","1111111","1101111"};
    while(cin>>n&&n!=-1){
        string str="0000000";
        for(int i=0,num;i<n;i++){
            cin>>num;
            for(int j=0;j<7;j++){
                if(str[j]==show[num][j])cout<<"0";
                else cout<<"1";
            }
            cout<<endl;
            str=show[num];
        }
    }
}

Measured memory_bytes: 1200