akhauriyash/Code-Regression huggingface dataset:
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

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

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

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

// hoge hoge hoge

fn main() {
    input! {
        mut a: [i64; 5],
        k: i64,
    }

    // jfkafsdlfjkergogjadfas

    a.sort();

    let ans = if a[4] - a[0] > k { ":(" } else { "Yay!" };
    println!("{}", ans);
}

// asdfasdfasdfsaf


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i, n) for (ll i = 0; i < n; i++)
#define Rep(i, r, n) for (ll i = r; i < n; i++)
#define debug(x) cout << #x << " = " << (x) << endl;
#define pb push_back
#define MOD 1000000007
//#define MOD 998244353
//define MOD 1000000007000000
#define INF 1000000000000
#define EPS 0.00000000001
typedef long long ll;

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

    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
    }
    sort(a.begin(), a.end());
    ll count = 1;
    ll hen = 0;
    rep(i, n - 1)
    {
        if (a.at(i) == a.at(i + 1))
        {
            hen++;
            if (hen % 2 == 1)
            {
                count--;
            }
            else
            {
                count++;
            }
        }
        else
        {
            count++;
            hen = 0;
        }
    }
    cout << count << endl;
}


Measured memory_bytes: 640
#![allow(dead_code,unused_variables,unused_imports)]
use proconio::{fastout, input};
use proconio::marker::Chars;
use std::cmp::{max,min};

#[fastout]
fn main() {
    input!{
        n:usize,
        m:usize,
        mut k:usize,
        a:[usize;n],
        b:[usize;m],
    }
    
    let mut s = vec![0;n+1];
    let mut t = vec![0;m+1];

    for i in 0..n{
        s[i+1] = s[i] + a[i];
    }

    for i in 0..m{
        t[i+1] = t[i] + b[i];
    }

    let mut ans = 0;
    for i in 0..n+1{
        if k < s[i]{
            break;
        }
        let key = k - s[i];
        let id = lower_bound(&t,key);
        ans = max(ans,i+id);
    }
    println!("{}",ans);
}

fn lower_bound(x: &Vec<usize>, key:usize) -> usize{
    let mut l = 0;
    let mut r = x.len();

    while l+1 < r{
        let mid = (r-l)/2 + l;

        if key < x[mid]{
            r = mid;
        }else{
            l = mid;
        }
    }
    l
}

Measured memory_bytes: 12496
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
using namespace std;

int n, a, b, c, d, k;

int check(int mid) {
    int ra = a - mid / (k + 1) * k - mid % (k + 1);
    int rb = b - mid / (k + 1); return rb <= 1ll * ra * k;
}

void write(int l, int r, int op) {
    for (int i = l; i <= r; ++i) {
        if (!op) putchar(i % (k + 1) ? 'A' : 'B');
        else putchar((n - i + 1) % (k + 1) ? 'B' : 'A');
    }
}

void work() {
    scanf("%d%d%d%d", &a, &b, &c, &d);
    n = a + b, k = (max(a, b) - 1) / (min(a, b) + 1) + 1;
    int l = 0, r = n, res = -1;

    while (l <= r) {
        int mid = (l + r) >> 1;
        if (check(mid)) l = (res = mid) + 1;
        else r = mid - 1;
    } ++res;

    if (c <= res && res < d) write(c, res, 0), write(res + 1, d, 1);
    else write(c, d, (res < c));
    puts("");
}

int main() {
#ifdef whyqx
    freopen("work.in", "r", stdin);
    freopen("work.out", "w", stdout);
#endif

    int Q; cin >> Q;
    while (Q--) work();

    return 0;
}


Measured memory_bytes: 384
from math import pi, sqrt, cos

a, b, h, m = map(int, input().split())
r_a = m/60
r_b = (h+m/60)/12
if r_a > r_b:
    r = (r_a - r_b) * 2 * pi
else:
    r = (r_b - r_a) * 2 * pi

c = sqrt(pow(a, 2) + pow(b, 2) -(2*a*b*cos(r)))
print(c)

Measured memory_bytes: 9504
#ifndef LOCAL
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")
#endif
#include "bits/stdc++.h"
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace std;
using namespace __gnu_pbds;
#define sim template < class c
#define int long long
#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 << '\n'; }
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__) << "] "
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);
typedef tree< pair<int,int>, null_type, less<pair<int,int> >, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
typedef long long ll;
const ll MOD = 1e9 + 7 ;
const ll N = 2e5 + 10 ;
const ll INF = 1e18 + 10 ;
int n , m , k ;
int a[3001][3001] ;
int dp[3001][3001][4] ;
int dfs(int x, int y, int cur){
    if ( x == n && y == m ) {
        return 0 ;
    }
    if ( x == n ) return 0 ;
    if ( y == m ) return 0 ;
    if ( dp[x][y][cur] != -1 ) return dp[x][y][cur] ;
    int ans = 0 ;
    if ( a[x][y] == 0 ) {
        ans = max(dfs(x + 1, y, 0), dfs(x, y + 1, cur)) ;
    }
    else{
        int value = a[x][y] ;
        if ( cur < 3 ) {
            ans = max(ans, value + dfs(x, y + 1, cur + 1)) ; 
            ans = max(ans, value + dfs(x + 1, y, 0)) ;
        }
        ans = max(ans, dfs(x, y + 1, cur)) ;
        ans = max(ans, dfs(x + 1, y, 0)) ;
    }
    return dp[x][y][cur] = ans ;
}
signed main(){
    fastio
    memset(dp, -1, sizeof dp) ;
    cin >> n >> m >> k ;
    for(int i = 0; i < k; i++){
        int x , y , z;
        cin >> x >> y >> z ; 
        x--, y-- ;
        a[x][y] = z ;
    }
    int ans = dfs(0, 0, 0) ;
    cout << ans << endl;
    return 0; 
}




Measured memory_bytes: 355800
n = int(input())
a = list(map(int, input().split()))

ans = "APPROVED"
for i in a:
    if i % 2 == 0:
        if i % 3 == 0 or i % 5 == 0:
            ans = "APPROVED"
        else:
            ans = "DENIED"
            break

print(ans)

Measured memory_bytes: 2940
from collections import defaultdict
import sys
readline = sys.stdin.readline

N = int(input())

result = 0
d = defaultdict(int)
for _ in range(N):
    s = input()
    s = ''.join(sorted(s))
    if s in d:
        d[s] += 1
    else:
        d[s] = 1
print(sum([int((v)*(v-1) / 2) for k, v in d.items()]))


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

int main(){
  string S;
  cin >> S;
  
  if(S=="SUN"){
    cout << 7 << endl;
  }  
  
  if(S=="MON"){
    cout << 6 << endl;
  }  
  
  if(S=="TUE"){
    cout << 5 << endl;
  }  
  
  if(S=="WED"){
    cout << 4 << endl;
  }  
    
  if(S=="THU"){
    cout << 3 << endl;
  }  
  
  if(S=="FRI"){
    cout << 2 << endl;
  }  
  
  if(S=="SAT"){
    cout << 1 << endl;
  }  
  
}

Measured memory_bytes: 256
H, W = map(int, input().split())
ch, cw = map(int, input().split())
dh, dw = map(int, input().split())
S = [input() for _ in range(H)]
global_visited = set()

count = [[float("inf")] * W for _ in range(H)]

start = (ch - 1, cw -1)

def judge(start):
    if start in global_visited:
        return False
    if start[0] < 0 or H <= start[0]:
        return False
    if start[1] < 0 or W <= start[1]:
        return False
    if S[start[0]][start[1]] == '#':
        return False
    return True

que = [start]
now_count = 0
while que:
    local_visited = []
    while que:
        start = que.pop()
        global_visited.add(start)
        local_visited.append(start)
        count[start[0]][start[1]] = now_count
        next_list = [
            (start[0], start[1] + 1),
            (start[0], start[1] - 1),
            (start[0] + 1, start[1]),
            (start[0] - 1, start[1]),
        ]
        for next in next_list:
            if judge(next):
                que.append(next)

    now_count += 1

    while local_visited:
        start = local_visited.pop()
        next_list = [
            (start[0] + 2, start[1] + 2),
            (start[0] + 2, start[1] + 1),
            (start[0] + 2, start[1] + 0),
            (start[0] + 2, start[1] - 1),
            (start[0] + 2, start[1] - 2),
            (start[0] + 1, start[1] + 2),
            (start[0] + 1, start[1] + 1),
            (start[0] + 1, start[1] - 1),
            (start[0] + 1, start[1] - 2),
            (start[0] + 0, start[1] + 2),
            (start[0] + 0, start[1] - 2),
            (start[0] - 1, start[1] + 2),
            (start[0] - 1, start[1] + 1),
            (start[0] - 1, start[1] - 1),
            (start[0] - 1, start[1] - 2),
            (start[0] - 2, start[1] + 2),
            (start[0] - 2, start[1] + 1),
            (start[0] - 2, start[1] + 0),
            (start[0] - 2, start[1] - 1),
            (start[0] - 2, start[1] - 2),
        ]
        for next in next_list:
            if judge(next):
                count[next[0]][next[1]] = now_count
                global_visited.add(next)
                que.append(next)

if count[dh-1][dw-1] == float("inf"):
    print(-1)
else:
    print(count[dh-1][dw-1])

Measured memory_bytes: 182640
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
vector<int> v;
int main() {
	int h[100010]; int w[100010]; int i = 0; int a = 0;
	for (;;) {
		cin >> h[i] >> w[i];
		if (w[i] == 0 && h[i] == 0)
			break;
		i++;
		a = i;
	}
	for (int j = 0; j < a;j++) {
		for (int k = 0; k < h[j]; k++) {
			for (int l = 0; l < w[j]; l++) {
				cout << "#";
			}
			cout << endl;
		}
		cout << endl;
	}
}


Measured memory_bytes: 3104
#include <iostream>
#include <iomanip>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <cstdio>
#include <functional>
using namespace std; 
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define FORD(i,a,b) for(int i=(a);i>=(b);i--)
inline bool EQ(double a, double b) { return fabs(a-b) < 1e-9; }
const int INF = (((1<<30)-1)<<1)+1;
const int nINF = 1<<31;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<char, int> pci;

/////////////////////////////////////////////////////////////////////

int main() {
    ios::sync_with_stdio(false);
    //cout << fixed << setprecision(7);
    string s, t;
    cin >> s;
    t = s;
    vector<int> str(s.size());
    vector<bool> have(26, 0);
    REP(i, s.size()) {
    	str[i] = s[i]-'a';
    	have[str[i]] = 1;
    }
    char ans = -1;
    REP(i, 26) {
    	if(!have[i]) {
    		ans = 'a'+i;
    		break;
    	}
    }
    if(s.size() == 26) {
	    if(!next_permutation(str.begin(), str.end())) {
	    	cout << -1 << endl;
	    } else {
	    	REP(i, str.size()) {
	    		cout << char(str[i]+'a');
	    		if(t[i]-'a' < str[i]) break;
	    	}
	    	cout << endl;
	    }
    } else {
    	s.push_back(ans);
    	cout << s << endl;
    }

    return 0;
}

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

using namespace std;

int n, a[3], curdp[3], dp[3];

int main() {
	scanf("%d", &n);
	while(n--) {
		for(int i = 0; i < 3; i++) {
			scanf("%d", &a[i]);
			curdp[i] = 0;
		}
		
		for(int i = 0; i < 3; i++) 
			for(int j = 0; j < 3; j++) 
				if(i != j)
					curdp[j] = max(curdp[j], dp[i] + a[j]);
		
		for(int i = 0; i < 3; i++)
			dp[i] = curdp[i];
	}
	
	printf("%d", max({dp[0], dp[1], dp[2]}));
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
	string s;
	int n;
	cin >> n >> s;
	for(int i = 0;i < s.size();i++)
	{
		if(char(s[i]) + n > char('Z'))
		{
			cout << char(s[i] + n -26);
		}
		else
		{
			cout << char(s[i] +n);
		}
	}
	cout << endl;
}
	

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define lb long double
#define f(i,a,b) for(ll i = a;i <= b;i ++)
#define fi(i,a,b) for(ll i = a;i >= b;i --)
using namespace std;
ll n;
int main()
{
    cin >> n;
    while(n != 0)
    {
        ll dem = n % 10;
        n /= 10;
        if(dem == 7)
        {
            cout << "Yes";
            return 0;
        }
    }
    cout << "No";
    return 0;
}


Measured memory_bytes: 3632
N = int(input())
A_list = list(map(int, input().split()))
A_filtered = []
for A in A_list:
    if A%2 == 1:
        A_filtered.append(A)
    else:
        if A%3 == 0 or A%5 == 0:
            A_filtered.append(A)
if len(A_filtered) == N:
    print('APPROVED')
else:
    print('DENIED')


Measured memory_bytes: 38384
S_ = list(input())
T = input()
#後ろから探索する

n = len(S_)
m = len(T)
nonexist = 1
for i in range(n-1, m-2, -1):
    flg = True
    for j in range(m):
        if (S_[i-j] != T[-j-1]) and (S_[i-j] != "?"):
            flg = False
            break
    if flg:
        nonexist = 0
        index = i
        break

if nonexist:
    print("UNRESTORABLE")
    exit()

index -= m-1
for i in range(m):
    S_[index+i] = T[i]

for i in range(n):
    if S_[i] == "?":
        S_[i] = "a"
print("".join(S_))


Measured memory_bytes: 9132
#include <bits/stdc++.h>
#include <cmath>
#include <numeric>
using namespace std;
#define rep(i,a,b) for(int64_t i=(a); i<(b); ++i) // a ≦ i < b 
#define Rrep(i,a,b) for(int64_t i=(a);i>=(b);--i) // reverse repeat. a から b まで減少．
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend() //逆イテレータ
#define RANGE(a,b,c) (a).begin()+b,(a).begin()+c // コンテナ a の 要素 b から c へのイテレータ
#define MOD 1000000007
#define INF 1000000000
typedef pair<int64_t, int64_t> PII;
typedef vector<int64_t> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<PII> VP;

// まずは全探索，次にDP
// 偶奇，逆から，ソート，出現回数，出現位置，DP
// 余事象，包除
// データ構造
// 問題の特徴量
// 存在判定：構成方法，入力の特徴
// gcd, lcm ,素因数分解．
// 例外を十分に含む一般化．想像力の限界
// 小さい系から例示
// 始めは過剰に例示・場合分けしてもいい．各場合を確実に対処．
// 小数のときは，精度の設定する．
int main() {
cin.tie(0);
ios::sync_with_stdio(false);

string S; cin >> S;

// < , > の長さ
VI cnt;
int len = 1;
rep(i, 1, S.size()){
    if (S[i] == S[i-1]) ++len;
    else {
        cnt.push_back(len);
        len = 1;
    }
}
cnt.push_back(len);

int64_t ans = 0;
if (S[0] == '>'){
    ans += cnt[0] * (cnt[0] + 1) / 2;
    cnt.erase(cnt.begin());
}
for (int i = 0; i < cnt.size()/2; ++i){
    PII mima = minmax(cnt[2*i], cnt[2*i+1]);
    ans += (mima.first - 1) * mima.first / 2 + mima.second *(mima.second + 1) / 2;
}
if (cnt.size() % 2){ // odd
    ans += cnt.back() * (cnt.back() + 1) / 2;
}


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

// 境界，出力文字列 チェック



Measured memory_bytes: 3352
#include <iostream>
using namespace std;
int main() {
  int n;
  string s;
  cin >> n >> s;
  long long ans = 0;
  int r = 0, g = 0, b = 0;
  for (char c : s) {
    if (c == 'R') {
      ++r;
    } else if (c == 'G') {
      ++g;
    } else if (c == 'B') {
      ++b;
    }
  }
  int r0, g0, b0, r1, g1, b1;
  if (s.at(0) == 'R') {
    r0 = 1;
    g0 = 0;
    b0 = 0;
    r1 = r-1;
    g1 = g;
    b1 = b;
  } else if (s.at(0) == 'G') {
    r0 = 0;
    g0 = 1;
    b0 = 0;
    r1 = r;
    g1 = g-1;
    b1 = b;
  } else if (s.at(0) == 'B') {
    r0 = 0;
    g0 = 0;
    b0 = 1;
    r1 = r;
    g1 = g;
    b1 = b-1;
  }
  for (int i = 1; i < n-1; ++i) {
    if (s.at(i) == 'R') {
      r1--;
      ans += g0 * b1 + b0 * g1;
      r0++;
      for (int j = 1; j <= min(i, n-i-1); ++j) {
        if ((s.at(i-j) == 'G' and s.at(i+j) == 'B') or (s.at(i-j) == 'B' and s.at(i+j) == 'G')) {
          --ans;
        }
      }
    } else if (s.at(i) == 'G') {
      g1--;
      ans += r0 * b1 + b0 * r1;
      g0++;
      for (int j = 1; j <= min(i, n-i-1); ++j) {
        if ((s.at(i-j) == 'R' and s.at(i+j) == 'B') or (s.at(i-j) == 'B' and s.at(i+j) == 'R')) {
          --ans;
        }
      }
    } else if (s.at(i) == 'B') {
      b1--;
      ans += g0 * r1 + r0 * g1;
      b0++;
      for (int j = 1; j <= min(i, n-i-1); ++j) {
        if ((s.at(i-j) == 'G' and s.at(i+j) == 'R') or (s.at(i-j) == 'R' and s.at(i+j) == 'G')) {
          --ans;
        }
      }
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3644
import sys
from collections import defaultdict

read = sys.stdin.read
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7


def main():
    N = int(readline())
    A = list(map(int, readline().split()))
    L = defaultdict(int)
    R = defaultdict(int)
    for i in range(N):
        L[i+1+A[i]] += 1
        R[i+1-A[i]] += 1
    ans = 0
    for key, value in L.items():
        ans += value*R[key]
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 74100
import java.util.Scanner;

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

		int K = sc.nextInt();
		int S = sc.nextInt();

		int count = 0;
		for(int x=0; x<=K && x<=S; x++) {
			for(int y=0; y<=K && x+y<=S; y++) {
				if(S-x-y <= K) {
					count ++;
				}
			}
		}

		System.out.println(count);
	}
}

Measured memory_bytes: 23252
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

struct key {
  int price;
  int chests;
};

const int inf = numeric_limits<int>::max();

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

  vector<key> keys(m);

  for (int i = 0; i < m; i++) {
    int price, chest_num;
    cin >> price >> chest_num;

    int chests = 0;
    for (int j = 0; j < chest_num; j++) {
      int chest;
      cin >> chest;
      chests |= (1 << (chest - 1));
    }

    keys.push_back(key{ price, chests });
  }

  // based on https://youtu.be/l4pTJy13sbM?t=7430
  vector<int> dp(1 << n, inf);
  dp[0] = 0;
  for (int s = 0; s < 1 << n; s++) {
    if (dp[s] == inf) continue;
    for (auto key : keys) {
      int t = s | key.chests;
      dp[t] = min(dp[t], dp[s] + key.price);
    }
  }

  auto answer = dp.back();
  if (answer == inf) {
    cout << "-1" << endl;
  } else {
    cout << answer << endl;
  }

  return 0;
}


Measured memory_bytes: 256
def inpl(): return list(map(int, input().split()))
N, M = inpl()
f, n = set(), set()
for i in range(M):
    temp = inpl()
    if 1 in temp:
        f.add(temp[1])
    if N in temp:
        n.add(temp[0])
if len(f & n) > 0:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')

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

int main()
{
    double a, b;

    while( cin >> a >> b )
    {
        if( a + b == 0 )
            break;
        
        double min = 1000000;
        for( double i = 0; i <= a / 2; i++ )
        {
            double res = fabs( sqrt( i * i + ( a - i ) * ( a - i ) ) - b );
            if( res < min )
                min = res;
        }
        cout << fixed << setprecision(10) << min << endl;
    }
    return 0;
}


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

int main() {
	int abc[3];
	for (int i = 0; i < 3; i++) {
		cin >> abc[i];
	}
	sort(abc,abc+ 3,greater<int>());
	cout << abc[0] * 10 + abc[1] + abc[2];
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main()
{
    int a=0,b=0,d=0,r=0;
    double f=0;
    
    scanf("%d %d\n",&a,&b);
    
    d=a/b;
    r=a%b;
    f=1.0*a/b;
    
    printf("%d %d %lf\n",d,r,f);
    
    return 0;
}


Measured memory_bytes: 1972
#include <cassert>

#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
//#include <boost/foreach.hpp>
//#include <boost/range/algorithm.hpp>
#define rep(i,j,k) for(int i=(int)j;i<(int)k;i++)
#define ll long long
#define Sort(v) sort(all(v))
#define INF 1000000000
#define END return 0
#define pb push_back
#define se second
#define fi first
#define pb push_back
#define all(v) (v).begin() , (v).end()
#define MP make_pair
//#define MOD 1000000007LL
#define int long long
using namespace std;
int day[12]={31,28,31,30,31,30,31,31,30,31,30,31};

signed main (){
    int n,k;cin>>n>>k;
    k--;
    cout<<(n-1+k-1)/k<<endl;

    


    
}
/*
1-21-2
*/


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

#define rep(i,s,n) for (int i = (int)s; i < (int)n; i++)
#define ll long long

int main() {
  int N;
  cin >> N;
  vector<int> d(N);
  rep(i, 0, N) cin >> d[i];
  sort(d.begin(), d.end());
  int half = N / 2;
  int r = d[half];
  int l = d[half - 1];
  if (r > l) {
    cout << r - l << endl;
  } else cout << 0 << endl;
};


Measured memory_bytes: 640
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <queue>
#include <cmath>
#include <map>
#include <set>
#include <deque>
#define rep(i, n) for(int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const int mod = 1e9+7;
typedef pair<int, int> P;

P calc(int x) {
  int a = x % 10;
  int b;
  while(x) {
    b = x;
    x /= 10;
  }
  return P(a, b);
}

int main() {
  int n; cin >> n;
  map<P, int> mp;
  for(int i = 1; i <= n; i++) {
    P p = calc(i);
    mp[p]++;
  }

  ll ans = 0;
  for(int i = 1; i <= n; i++) {
    P p = calc(i);
    P q(p.second, p.first);
    ans += mp[q];
  }
  cout << ans << endl;

  return 0;
}


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

int main(void) {
    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    vector<int> cost(n, INT_MAX);
    cost[0] = 0;
    int j;
    for (int i = 1; i < n; ++i) {
        j = max(0, i - k);
        for (; j < i; ++j) {
            cost[i] = min(cost[i], abs(a[i] - a[j]) + cost[j]);
        }
    }
    cout << cost[n - 1];
    return 0;
}

Measured memory_bytes: 1024
#include<stdio.h>
int main()
{
  int m1,d1,m2,d2;
  scanf("%d",&m1);
  scanf("%d",&d1);
  scanf("%d",&m2);
  scanf("%d",&d2);
  if((m1+1)!=m2)printf("0");
  else if((d1+1)==d2)printf("0");
  else if(d2!=1)printf("0");
  else printf("1");
  return 0;
}

Measured memory_bytes: 128
//In the name of GOD
//SMani24
#include <bits/stdc++.h>
using namespace std;

const int N = 1e5 + 10;

vector<int> gr[N], vec;
int n, rn, cmp, a[N], b[N], cnt[N], x;
bool mark[N];

void compress() {
	sort(vec.begin(), vec.end());
	vec.resize(unique(vec.begin(), vec.end()) - vec.begin());
	if (vec.size() > n + 1) {
		cout << -1 << endl;
		exit(0);
	}
	for (int i = 0; i < n; i++)
		a[i] = lower_bound(vec.begin(), vec.end(), a[i]) - vec.begin(), b[i] = lower_bound(vec.begin(), vec.end(), b[i]) - vec.begin();
	x = lower_bound(vec.begin(), vec.end(), x) - vec.begin();
	return;

}
void dfs(int v) {
	mark[v] = 1;
	for (auto u : gr[v])
		if (!mark[u])
			dfs(u);
	return;
}

void read_input() {
	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> a[i], x ^= a[i], vec.push_back(a[i]);
	for (int i = 0; i < n; i++)
		cin >> b[i], vec.push_back(b[i]);
	vec.push_back(x);
}
void solve() {
	compress();
	for (int i = 0; i < n; i++)
		cnt[a[i]]++, cnt[b[i]]--;
	cnt[x]++;
	for (int i = 0; i <= n; i++) {
		if (cnt[i] < 0) {
			cout << -1;
			exit(0);
		}
	}
	for (int i = 0; i < n; i++) {
		if (a[i] != b[i])
			rn++, gr[a[i]].push_back(b[i]), gr[b[i]].push_back(a[i]);
	}
	for (int i = 0; i <= n; i++) {
		if (!mark[i] && (i == x || !gr[i].empty()))
			dfs(i), cmp++;
	}
}
void write_output() {
	cout << rn + cmp - 1 << endl;
}

int main() {
	ios :: sync_with_stdio (0), cin.tie(0), cout.tie(0);
	read_input(), solve(), write_output();
	return 0;
}


Measured memory_bytes: 13816
s = raw_input()
a = int(s[0])
b = int(s[1])
c = int(s[2])
d = int(s[3])
op = ['+', '-']

for i in range(0, 8):
	op1 = i / 4
	op2 = (i%4) / 2
	op3 = i % 2
	if a + (1-2*op1)*b + (1-2*op2)*c + (1-2*op3)*d == 7:
		print str(a) + op[op1] + str(b) + op[op2] + str(c) + op[op3] + str(d) + '=7'
		break

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

using ll = long long;
using Pi = pair<int, int>;
using Pl = pair<ll, ll>;
using vint = vector<int>;
using vvint = vector<vint>;
using vvvint = vector<vvint>;
using vdouble = vector<double>;
using vvdouble = vector<vdouble>;
using vvvdouble = vector<vvdouble>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using uint = unsigned int;
using ull = unsigned long long;

template<typename T> using uset = unordered_set<T>;
template<typename T1, typename T2> using umap = unordered_map<T1, T2>;

constexpr int INF = (1 << 30) - 1;
constexpr ll LLINF = 1LL << 60;
constexpr int dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
constexpr int dx[] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr char el = '\n';
constexpr int mod = 1000000007;
constexpr int mod2 = 998244353;
template<typename T> T gcd(T a, T b) { return (b ? gcd(b, a % b) : a); }
template<typename T> T lcm(T a, T b) { return (a / gcd(a, b) * b); }
template<typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) { return (a > b && (a = b, true)); }
template<typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) { return (a < b && (a = b, true)); }

template<typename T>
vector<T> makeVector(size_t a, T b) { return (vector<T>(a, b)); }
template<typename... Ts>
auto makeVector(size_t a, Ts... ts) { 
	return (vector<decltype(makeVector(ts...))>(a, makeVector(ts...)));
}

template<typename T>
bool isin(T y, T x, T h, T w) { return (0 <= y && 0 <= x && y < h && x < w); }
template<typename T>
bool isin1(T y, T x, T h, T w) { return (0 < y && 0 < x && y <= h && x <= w); }

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

template<typename T>
istream& operator >>(istream &is, vector<T> &v) {
	for (auto &u : v) is >> u;
	return (is);
}

template<typename T1, typename T2>
istream& operator >>(istream &is, pair<T1, T2> &p) {
	return (is >> p.first >> p.second);
}


void Main() {
	int N; cin >> N;
	vll X(N), Y(N);
	map<Pl, ll> cnt;
	for (int i = 0; i < N; i++) {
		cin >> X[i] >> Y[i];
	}

	for (int i = 0; i < N; i++) {
		for (int j = i+1; j < N; j++) {
			ll q = Y[i]-Y[j], p = X[i]-X[j];

			if (p < 0) q = -q, p = -p;
			else if (p == 0) q = abs(q);
			cnt[Pl(q, p)]++;
		}
	}
	ll maxv = 0;
	for (auto &c : cnt) chmax(maxv, c.second);
	cout << N - maxv << endl;
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(0);
	cout << fixed << setprecision(20);
	Main();
	return (0);
}


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

int n,m,q,c,t;
bool x[1000][36];
char o;
string a,b[1000];

main(){
	while(cin>>n>>m>>q,n||m||q){
		rep(i,m)rep(j,n)x[i][j]=1;
		rep(i,q){
			cin>>a>>b[i];
			rep(j,a.size()) rep(k,b[i].size()){
				if(a[j]=='0'&&((i==0&&b[i][k]=='1')||(i!=0&&b[i][k]!=b[i-1][k])))x[k][j]=0;
				if(a[j]=='1'&&((i==0&&b[i][k]=='0')||(i!=0&&b[i][k]==b[i-1][k])))x[k][j]=0;
			}
		}
		rep(i,m){
			c=0;
			rep(j,n)if(x[i][j])c++,t=j;
			if(c>=2)o='?';
			else o=(t<=9?'0':'A'-10)+t;
			cout<<o;
		}
		cout<<endl;
	}
}

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

int main() {
  string N, temp;
  int sum = 0;
  cin >> N;
  int numN = stoi(N);
  
  for(int i = 0; i < N.size(); i++){
    temp = N.at(i);
    sum += stoi(temp);
  }
  if(numN % sum == 0){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
Scanf.scanf "%d %d %d" (fun rr cc k ->
    let mat = Array.make_matrix rr cc 0 in
    for i = 1 to k do
        Scanf.scanf " %d %d %d" (fun rr cc v ->
            mat.(rr - 1).(cc - 1) <- v
        )
    done;
    let max (a:int) (b:int) = if a < b then b else a in

    let prev = Array.make cc 0 in
    for y = 0 to rr - 1 do
        let m = mat.(y) in
        let rec loop x work0 work1 work2 work3 =
            if x < cc then (
                let work0 = max work0 prev.(x) in
                let v = m.(x) in
                let work3 = max work3 (work2 + v) in
                let work2 = max work2 (work1 + v) in
                let work1 = max work1 (work0 + v) in
                prev.(x) <- max (max work3 work2) (max work1 work0);
                loop (x + 1) work0 work1 work2 work3
            )
        in
        loop 0 0 0 0 0
    done;
    Printf.printf "%d\n" (prev.(cc - 1))
)

Measured memory_bytes: 77092
#include <bits/stdc++.h>
#define ll long long
#define INF (1LL << 60)
#define MOD 1000000007
#define EPS 1e-10
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define each(a, b) for(auto (a): (b))
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define pb push_back
#define show(x) cout<<#x<<" = "<<(x)<<endl
#define spair(p) cout<<#p<<": "<<p.fi<<" "<<p.se<<endl
#define svec(v) cout<<#v<<":";rep(kbrni,v.size())cout<<" "<<v[kbrni];cout<<endl
#define sset(s) cout<<#s<<":";each(kbrni,s)cout<<" "<<kbrni;cout<<endl
#define smap(m) cout<<#m<<":";each(kbrni,m)cout<<" {"<<kbrni.first<<":"<<kbrni.second<<"}";cout<<endl
using namespace std;

typedef pair<int,int>P;

const int MAX_N = 500005;

struct edge{
	int to;
	int cost;
};

ll d[MAX_N];
vector<edge> G[MAX_N];
map<P,int> mp;
vector<int> eki[MAX_N];

void dijkstra(int s)
{
	priority_queue<P,vector<P>,greater<P> > que;
	d[s] = 0;
	que.push(P(0,s));
	while(!que.empty()){
		P p = que.top();
		que.pop();
		int v = p.second;
		if(d[v] < p.first) continue;
		vector<edge>::iterator it = G[v].begin();
		rep(i,G[v].size()){
			if(d[G[v][i].to] > d[v] + G[v][i].cost){
				d[G[v][i].to] = d[v] + G[v][i].cost;
				que.push(P(d[G[v][i].to],G[v][i].to));
			}
		}
	}
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,m;
    cin >> n >> m;
    int cnt = 0;
    rep(i,m){
        int p,q,c;
        cin >> p >> q >> c;
        p--,q--;
        if(mp.count(P(p,c)) == 0){
            mp[P(p,c)] = cnt++;
        }
        if(mp.count(P(q,c)) == 0){
            mp[P(q,c)] = cnt++;
        }
        eki[p].pb(c),eki[q].pb(c);
        G[mp[P(p,c)]].pb((edge){mp[P(q,c)],0});
        G[mp[P(q,c)]].pb((edge){mp[P(p,c)],0});
    }
    rep(i,n){
        rep(j,eki[i].size()){
            if(mp.count(P(i,-1)) == 0){
                mp[P(i,-1)] = cnt++;
            }
            G[mp[P(i,eki[i][j])]].pb((edge){mp[P(i,-1)],0});
            G[mp[P(i,-1)]].pb((edge){mp[P(i,eki[i][j])],1});
        }
    }
    rep(i,max(n,cnt)){
        d[i] = INF;
    }
    if(mp.count(P(0,-1)) == 0 || mp.count(P(n-1,-1)) == 0){
        cout << "-1\n";
        return 0;
    }
    dijkstra(mp[P(0,-1)]);
    ll res = d[mp[P(n-1,-1)]];
    if(res == (1LL << 60)){
        cout << "-1\n";
    }else{
        cout << res << endl;
    }
    return 0;
}


Measured memory_bytes: 81656
#include <iostream>
#include <algorithm>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<iomanip>
#define sqr(x) (x)*(x)
using namespace std;
string st;
int n,m,i,j;
int main()
{
	cin>>st;
	if (((int)st.find("AC"))!=-1) cout<<"Yes"; else cout<<"No";
	return 0;
}

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

int dp[100000];
vector<int> pillar;
 
int jump(int now, int cost){
    if(dp[now] != -1){
        return cost + dp[now];
    }
    if(pillar.size() == now + 1){
        dp[now] = 0;
    }else if(pillar.size() == now + 2){
        dp[now] = abs(pillar[now] - pillar[now + 1]);
    }else{
        dp[now] = min(jump(now + 1, abs(pillar[now] - pillar[now + 1])), jump(now + 2, abs(pillar[now] - pillar[now + 2])));
    }
    return cost + dp[now];
}
 
int main(){
    int N;
    cin >> N;
    for(int i = 0; i < N; i++){
        int input;
        cin >> input;
        pillar.push_back(input);
    }
    for(int i = 0; i < 100000; i++){
        dp[i] = -1;
    }
    cout << jump(0, 0) << endl;
}

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

int main()
{
    int A, B;
    cin>>A >>B;
    if(A==B)
        cout << "Draw\n";
    else if(A==1 || (B!=1 && A>B))
        cout << "Alice\n";
    else if(B==1 || (A!=1 && B>A))
        cout << "Bob\n";

    return 0;
}


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

#define   ll    long long int

ll n, k;

int main( )
{
    string s;
    int l, i, j, k;
    cin >> s;
    l = (int) s.size( );
    i = 0;
    j = l - 1;
    l /= 2;
    int c = 0;
    for ( ; i < j; i++, j--)
        if (s[i] != s[j]) c++;
    cout << c << '\n';
    return 0;
}


Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#include <numeric>
typedef long long Int;
#define rep(i,a,b) for(Int i=a;i<b;++i)
#define rrep(i,a,b) for(Int i=a;i>=b;--i)
using namespace std;

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

    string a, x, c; cin >> a >> x >> c;
    cout << a[0] << x[0] << c[0] << endl;
}


Measured memory_bytes: 256
#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 = 1ll << 60;
const ll mod = (ll)1e9 + 7;

#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

#define print(s) cout << s;
#define println(s) cout << s << endl;
#define printd(s, f) cout << fixed << setprecision(f) << s << endl;


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

	map<string, ll> a;
	for (int i = 0; i < n; i++)
	{
		int q;
		cin >> q;

		string s;
		cin >> s;

		switch (q)
		{
			case 0:
				ll x;
				cin >> x;
				a[s] = x;
				break;

			case 1:
				println(a[s]);
				break;
		}
	}
}



Measured memory_bytes: 27796
#include <iostream>
using namespace std;
int main()
{
    int n, k;
    string s;
    cin >> n >> s >> k;

    const char c = s[k-1];

    for (int i = 0; i < n; i++)
    {
        if (s[i] == c)
        {
            cout << c;
        } else {
            cout << '*';
        }
    }

    cout << '\n';
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<queue>
using namespace std;
vector<int>g[20];
int bfs[1<<15][15];
int rev[1<<15][15];
int r[16];
int can[16][16];
int ans[1000000];
int main(){
	int a,b;
	while(scanf("%d%d",&a,&b),a){
		for(int i=0;i<a;i++)g[i].clear();
		for(int i=0;i<b;i++){
			int p,q;
			scanf("%d%d",&p,&q);p--;q--;
			g[p].push_back(q);
			g[q].push_back(p);
		}
		for(int i=0;i<a;i++)scanf("%d",r+i);
		for(int i=0;i<a;i++)for(int j=0;j<a;j++)can[i][j]=0;
		for(int i=0;i<a;i++){
			int c;scanf("%d",&c);
			for(int j=0;j<c;j++){
				int d;scanf("%d",&d);
				d--;
				can[i][d]=1;
			}
		}
		for(int i=0;i<(1<<a);i++)for(int j=0;j<a;j++)
			bfs[i][j]=-1;
		int now=0;
		for(int i=0;i<a;i++)now+=r[i]*(1<<i);
		bfs[now][0]=0;
		queue<pair<int,int> > Q;
		Q.push(make_pair(now,0));
		while(Q.size()){
			int bit=Q.front().first;
			int at=Q.front().second;
			Q.pop();
			for(int i=0;i<g[at].size();i++){
				if((bit&(1<<g[at][i]))&&!~bfs[bit][g[at][i]]){
					bfs[bit][g[at][i]]=bfs[bit][at]+1;
					rev[bit][g[at][i]]=at;
					Q.push(make_pair(bit,g[at][i]));
				}
			}
			for(int i=0;i<a;i++){
				if(at!=i&&can[at][i]&&!~bfs[bit^(1<<i)][at]){
					bfs[bit^(1<<i)][at]=bfs[bit][at]+1;
					rev[bit^(1<<i)][at]=-1-i;
					Q.push(make_pair(bit^(1<<i),at));
				}
			}
		}
		if(r[0]==0){
			printf("Help me!\n");
			continue;
		}
		if(~bfs[(1<<(a-1))][a-1]){
			printf("You can go home in %d steps.\n",bfs[(1<<(a-1))][a-1]);
			int bit=(1<<(a-1));
			int at=a-1;
			for(int i=0;i<bfs[(1<<(a-1))][a-1];i++){
				
				if(rev[bit][at]>=0){
					ans[bfs[(1<<(a-1))][a-1]-i-1]=at;
					at=rev[bit][at];
				}
				else{
					ans[bfs[(1<<(a-1))][a-1]-i-1]=rev[bit][at];
					bit^=(1<<(-rev[bit][at]-1));
				}
			}
			for(int i=0;i<bfs[(1<<(a-1))][a-1];i++){
				if(ans[i]>=0)printf("Move to room %d.\n",ans[i]+1);
				else if(now&(1<<(-ans[i]-1))){
					printf("Switch off room %d.\n",-ans[i]);
					now^=(1<<(-ans[i]-1));
				}else {
					printf("Switch on room %d.\n",-ans[i]);
					now^=(1<<(-ans[i]-1));
				}
			}
		}else{
			bool ok=false;
			for(int i=0;i<(1<<a);i++)if(~bfs[i][a-1])ok=true;
			if(ok)printf("You can not switch off all lights.\n");
			else printf("Help me!\n");
		}
	}
}

Measured memory_bytes: 6848
#include <iostream>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <utility>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cassert>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
using namespace std;

//const long double PIL = 3.141592653589793238462643383279502884L;
const double PI = 3.14159265358979323846;

typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector<pair<int,int>> vii;
#define sz(a) int((a).size())
#define all(c) (c).begin(), (c).end()

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

	double a, b, x;
	scanf("%lf%lf%lf", &a, &b, &x);

	double ans;
	if (2 * x <= a * a * b) {
		double y = 2 * x / (a * b);
		ans = atan(b / y);
	}
	else {
		double y = (2*x) / (a*a) - b;
		ans = atan((b - y) / a);
	}
	//printf("ans = %f\n", ans);
	printf("%.10f\n", 180 * ans / PI);
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <vector>
#include <cstdio>
#include <algorithm>
using namespace std;
int main ()
{
	int a[110]={};
	int x;
	while(scanf("%d",&x)!=EOF)a[x]++;
	int m=-1;
	for(int i=1;i<=100;i++)m=max(m,a[i]);

		for(int i=1;i<=100;i++)if(a[i]==m)cout<<i<<endl;
			

	return 0;
}

Measured memory_bytes: 1208
# -*- coding: utf-8 -*-
"""
B - Can you solve this?
https://atcoder.jp/contests/abc121/tasks/abc121_b

"""
import sys


def solve(A, B, C):
    ans = 0
    for a in A:
        if sum([x*y for x, y in zip(B, a)]) + C > 0:
            ans += 1
    return ans


def main(args):
    N, M, C = map(int, input().split())
    B = [int(i) for i in input().split()]
    A = []
    for _ in range(N):
        A.append([int(i) for i in input().split()])
    ans = solve(A, B, C)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])


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

using namespace std;

int n,q;
int a[1000];

main()
{
	cin >> n;
	for(int i = 0; i < n; i++)cin>>a[i];
	cin >> q;
	for(int i = 0;i < q; i++)
	{
		int c, b, e;
		cin >> b >> e >> c;
		cout << count(a + b, a + e, c)<<endl;
	}
	return 0;
}


Measured memory_bytes: 3076
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		long P = 1;
		
		for(int i = 1; i <= N; i++){
			P = P * i;
			P = P % 1000000007;
		}
		System.out.println(P);

	}

}


Measured memory_bytes: 21716
#include<bits/stdc++.h>
using namespace std;
int main(){
    int A, B, C;
    cin >> A >> B >> C;
    int M = max(max(A, B), C);
    if((3 * M) % 2 == (A + B + C) % 2){
        cout << ((3 * M) - (A + B + C)) / 2 << endl;
    }
    else{
        cout << ((3 * M + 3) - (A + B + C)) / 2 << endl;
    }
    return 0;
}

Measured memory_bytes: 3580
import java.io.*;
import java.util.*;
import java.math.BigInteger;
public class Main{

  public static void main(String[] args) {
    InputReader in = new InputReader(System.in);
    PrintWriter w = new PrintWriter(System.out);
    int a=in.nextInt(),b=in.nextInt();
    w.println((a+b)%24);
    w.close();
    }

  static class InputReader {

    private final InputStream stream;
    private final byte[] buf = new byte[8192];
    private int curChar, snumChars;
    private SpaceCharFilter filter;

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

    public int snext() {
      if (snumChars == -1)
      throw new InputMismatchException();
      if (curChar >= snumChars) {
        curChar = 0;
        try {
          snumChars = stream.read(buf);
        } catch (IOException e) {
          throw new InputMismatchException();
        }
        if (snumChars <= 0)
        return -1;
      }
      return buf[curChar++];
    }

    public int nextInt() {
      int c = snext();
      while (isSpaceChar(c)) {
        c = snext();
      }
      int sgn = 1;
      if (c == '-') {
        sgn = -1;
        c = snext();
      }
      int res = 0;
      do {
        if (c < '0' || c > '9')
        throw new InputMismatchException();
        res *= 10;
        res += c - '0';
        c = snext();
      } while (!isSpaceChar(c));
      return res * sgn;
    }

    public long nextLong() {
      int c = snext();
      while (isSpaceChar(c)) {
        c = snext();
      }
      int sgn = 1;
      if (c == '-') {
        sgn = -1;
        c = snext();
      }
      long res = 0;
      do {
        if (c < '0' || c > '9')
        throw new InputMismatchException();
        res *= 10;
        res += c - '0';
        c = snext();
      } while (!isSpaceChar(c));
      return res * sgn;
    }

    public int[] nextIntArray(int n) {
      int a[] = new int[n];
      for (int i = 0; i < n; i++) {
        a[i] = nextInt();
      }
      return a;
    }

    public String readString() {
      int c = snext();
      while (isSpaceChar(c)) {
        c = snext();
      }
      StringBuilder res = new StringBuilder();
      do {
        res.appendCodePoint(c);
        c = snext();
      } while (!isSpaceChar(c));
      return res.toString();
    }

    public String nextLine() {
      int c = snext();
      while (isSpaceChar(c))
      c = snext();
      StringBuilder res = new StringBuilder();
      do {
        res.appendCodePoint(c);
        c = snext();
      } while (!isEndOfLine(c));
      return res.toString();
    }

    public boolean isSpaceChar(int c) {
      if (filter != null)
      return filter.isSpaceChar(c);
      return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    }

    private boolean isEndOfLine(int c) {
      return c == '\n' || c == '\r' || c == -1;
    }

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


Measured memory_bytes: 21204
s=input()
q=int(input())
dir=True
ans=s
right=""
left=""
query=[]
for i in range(q):
  temp=input()
  if temp[0] == "1":
    dir = dir ^ True
  if temp[0] == "2":
    t,f,c = temp.split()

    if (f == "1" and dir) or (f=="2" and not dir):
      left=c+left
    else:
      right=right+c

def reverse(s):
  t=""
  for i in range(len(s)-1,-1,-1):
    t+=s[i]
  return t

if dir:
  print(left+ans+right)
else:
  t=reverse(right)+reverse(ans)+reverse(left)
  print(t)


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

using namespace std;

int n, z[55];
char x[55][25];
long long c[55], dp[55][25][2], ans = LLONG_MAX;
priority_queue<pair<long long, int>, vector<pair<long long, int>>, greater<pair<long long, int>>> q;

void go(int a, int b, int cc, long long d) {
	if (d < dp[a][b][cc])
		q.emplace(dp[a][b][cc] = d, (a << 10) | (b << 5) | cc);
}

int main() {
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		scanf("%s%lld", x[i], c + i);
		z[i] = strlen(x[i]);
		for (int j = 0; j <= z[i]; j++)
			for (int k = 0; k < 2; k++)
				dp[i][j][k] = LLONG_MAX;
	}
	for (int i = 0; i < n; i++)
		q.emplace(dp[i][0][0] = c[i], i << 10);
	while (!q.empty()) {
		long long tmp = q.top().first;
		int ta = q.top().second >> 10;
		int tb = (q.top().second >> 5) & 31;
		int tc = q.top().second & 31;
		q.pop();
		if (dp[ta][tb][tc] != tmp)
			continue;
		if (tc == 0) {
			bool ok = 1;
			int le = z[ta] - tb;
			for (int i = 0; i < le; i++)
				if (x[ta][tb + i] != x[ta][z[ta] - 1 - i]) {
					ok = 0;
					break;
				}
			if (ok)
				ans = min(ans, tmp);
		} else {
			bool ok = 1;
			int le = tb;
			for (int i = 0; i < le; i++)
				if (x[ta][tb - 1 - i] != x[ta][i]) {
					ok = 0;
					break;
				}
			if (ok)
				ans = min(ans, tmp);
		}
		if (tc == 0) {
			for (int i = 0; i < n; i++) {
				bool ok = 1;
				int le = min(z[ta] - tb, z[i]);
				for (int j = 0; j < le; j++)
					if (x[ta][tb + j] != x[i][z[i] - 1 - j]) {
						ok = 0;
						break;
					}
				if (ok) {
					long long tt = tmp + c[i];
					if (le == max(z[ta] - tb, z[i]))
						ans = min(ans, tt);
					else if (le == z[ta] - tb)
						go(i, z[i] - le, 1, tt);
					else
						go(ta, tb + le, 0, tt);
				}
			}
		} else {
			for (int i = 0; i < n; i++) {
				bool ok = 1;
				int le = min(tb, z[i]);
				for (int j = 0; j < le; j++)
					if (x[ta][tb - 1 - j] != x[i][j]) {
						ok = 0;
						break;
					}
				if (ok) {
					long long tt = tmp + c[i];
					if (le == max(tb, z[i]))
						ans = min(ans, tt);
					else if (le == tb)
						go(i, le, 0, tt);
					else
						go(ta, tb - le, 1, tt);
				}
			}
		}
	}
	printf("%lld\n", ans == LLONG_MAX ? -1 : ans);
}

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

int main()
{
	int N,M;
	cin >> N >> M;
	int c = (M+1)/2;
	int l = 1;
	for (int i = c; i > 0; --i)
	{
		cout << l << " " << l+2*i-1 << endl;
		l++;
	}
	l = 1+2*c;
	for (int i = M-c; i > 0; --i)
	{
		cout << l << " " << l+2*i << endl;
		l++;
	}
	return 0;
}

Measured memory_bytes: 3632