akhauriyash/Code-Regression huggingface dataset:
/*
　　こんにちは。あたしはｶｳｶﾞｰﾙ。
　　redcoderになるためAtCoderを巡る旅をしてます。

　　　 　 ＿_
　　　 ヽ|＿_|ノ　　　　ﾓｫ
　　　　||‘‐‘||ﾚ　　_)_, ―‐ 、
　　　　/(Ｙ (ヽ＿ /・ ヽ　　 ￣ヽ
　　　　∠ ＿ ゝ　 ｀^ヽ ﾉ.::::_(ノヽ
　　　　 _/ヽ　 　　  /ヽ￣￣/ヽ
*/

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define dump(x)  cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) << endl

#define rep(i, n) REP(i, 0, n)                              // 0, 1, ..., n-1
#define REP(i, x, n) for(int i = x; i < n; i++)             // x, x + 1, ..., n-1
#define FOREACH(x,a) for(auto& (x) : (a) )

#define ALL(v) (v).begin() , (v).end()
#define RALL(v) (v).rbegin(), (v).rend()

#define COUT(x) cout << (x) << endl

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

// ユークリッドの互除法
ll gcd(ll a, ll b) {
    if (b == 0) return a;
    return gcd(b, a % b);
}

// 最小公倍数(lcm)
ll lcm(ll a, ll b) {
    ll g = gcd(a, b);
    return a / g * b;
}

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

    ll a, b, c, d; cin >> a >> b >> c >> d;
    ll tmp = b - a + 1;
    ll ans = 0;
    ll e = lcm(c, d);
    ans = tmp - (((b / c - (a-1) / c) + (b / d - (a-1) / d)) - (b / e - (a-1) / e));
    cout << ans << endl;
}


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

int main() {
	int T;
	string S;
	vector<char> C[10];
	C[1] = { '.', ',', '!', '?', ' ' };
	for (int i = 2; i <= 7; i++) {
		for (int j = 0; j < 3; j++) C[i].push_back((char)('a' + (i - 2) * 3 + j));
	}
	C[7].push_back('s');
	C[8] = { 't', 'u', 'v' }, C[9] = { 'w', 'x', 'y', 'z' };
	cin >> T;
	for (int t = 0; t < T; t++) {
		cin >> S;
		int X = -1, Y = -1;
		for (int i = 0; i < S.size(); i++) {
			if (S[i] == '0') {
				if (X != -1) {
					cout << C[X][Y % C[X].size()];
				}
				X = -1, Y = -1;
			}
			else {
				if (S[i] - '0' == X) Y++;
				else X = S[i] - '0', Y = 0;
			}
		}
		cout << endl;
	}
}


Measured memory_bytes: 3064
#include<iostream>
#include<string>
#include<algorithm>
#include<math.h>
#include<queue>
#define ll long long
const int MOD= 1000000007;
const int INF = 1000000005;
using namespace std;

ll nCr(ll n, ll r) {
	ll c[51][51];
	for (int i = 0; i <= 50; i++) {
		c[0][i] = 0;
		c[i][0] = 1;
	}
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= r; j++) {
			c[i][j] = c[i - 1][j - 1] + c[i - 1][j];
		}
	}
	return c[n][r];
}

int main() {
	ll n, m = 1, count = 1, a, b, v[50], ans = 0;
	double sum = 0;
	cin >> n >> a >> b;
	for (int i = 0; i < n; i++) {
		cin >> v[i];
	}
	sort(v, v + n);
	for (ll i = n - 1; i > n - a - 1; i--) {
		sum += v[i];
	}
	for (ll i = n - a; i < n; i++) {
		if (v[i] == v[i + 1])count++;
		else {
			m = i + a - n + 1;
			break;
		}
	}
	for (ll i = n - a; i >= 0; i--) {
		if (v[i] == v[i - 1]) count++;
		else break;
	}
	if (v[n - a] == v[n - 1]) {
		for (ll i = a; i <= min(count,b); i++) {
			ans += nCr(count, i);
		} 
	} else {
		ans = nCr(count, m);
	}

	cout << fixed << sum / a << endl;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧  
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     
　　　　／　　　＼　 　 |　|     
　　　 /　　 /￣￣￣￣/　　|  
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿  
　 　　　＼/＿＿＿＿/　（u　⊃  
---------------------------------------------------------------------------------------------------*/





int N, K, P;
//---------------------------------------------------------------------------------------------------
void _main() {
    cin >> N;
    rep(n, 0, N) {
        cin >> K >> P;

        int current = 1;
        while (1 < K) {
            K--;
            current++;
            if (P < current) current = 1;
        }
        printf("%d\n", current);
    }
}



Measured memory_bytes: 3252
import math
A,B,H,M=map(int,input().split())
angA=math.radians(90-((H+M/60.0)/12.0)*360)
angB=math.radians(90-(M/60.0)*360)
ax=A*math.cos(angA)
ay=A*math.sin(angA)
bx=B*math.cos(angB)
by=B*math.sin(angB)
dis=math.sqrt((ax-bx)**2+(ay-by)**2)
print(dis)

Measured memory_bytes: 9520
import java.util.*

fun main(A: Array<String>) {
    val (x, y, a, b, c) = readLine()!!.split(" ").map { it.toInt() }
    val p = readLine()!!.split(" ").map { it.toLong() }.sorted().takeLast(x).toCollection(java.util.PriorityQueue<Long>())
    val q = readLine()!!.split(" ").map { it.toLong() }.sorted().takeLast(y).toCollection(java.util.PriorityQueue<Long>())
    val r = readLine()!!.split(" ").map { it.toLong() }

    for (i in r) {
        val t = if (p.peek()!! < q.peek()!!) p else q
        if (t.peek()!! < i) {
            t.poll()
            t.add(i)
        }
    }
    println(p.sum() + q.sum())
}


Measured memory_bytes: 111940
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        char[] ary = new char[n];
        String s = sc.next();
        ary = s.toCharArray();
        int ans = 1;
        for (int i = 0; i < n - 1; i++) {
            if (ary[i] != ary[i + 1]) {
                ans++;
            }
        }
        System.out.println(ans);
    }
}

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

int selectionSort(int A[],int N)
{
	int sw=0;
	for(int i=0;i<N;i++)
	{
		int minj = i;
		for(int j=i;j<N;j++)
		{
			if(A[j]<A[minj])
			{
				minj=j;
			}
		}
		swap(A[i],A[minj]);
		if(i!=minj)sw++;
	}
	return sw;
}

int main()
{
	int N;cin>>N;
	int A[100];for(int i=0;i<N;i++)cin>>A[i];
	int sw=selectionSort(A,N);
	for (int i = 0; i < N; i++)
	{
		if(i)cout<<" ";
		cout<<A[i];
	}
	cout<<endl;
	cout<<sw<<endl;
	return 0;
}


Measured memory_bytes: 3088
#include <stdio.h>
int main(){
 int N,M,i;
 scanf("%d %d",&N,&M);
 int A[N];
 int cnt=0;
 double sum=0.0;
 for(i=0;i<N;i++){
 scanf("%d",&A[i]);
 sum+=A[i];
 }
 for(i=0;i<N;i++){
 if(sum/(4*M)<=A[i])cnt++;
 }
 if(cnt>=M)printf("Yes");
  else printf("No");
 return 0;
}

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

int main(){
    int m,d;
    cin >> m >> d;
    int ans = 0;
    for(int i=1;i<=m;i++){
        for(int j=2;j<=d/10;j++){
            for(int k=2;k<=9;k++){
                if(j*10+k > d){
                    break;
                }
                else if(i == j*k){
                    ans++;
                }
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
import sys
from io import StringIO
import unittest
import os

# 再帰処理上限(dfs作成時に設定するのが面倒なので限度近い値を組み込む)
sys.setrecursionlimit(999999999)


# 実装を行う関数
def resolve(test_def_name=""):
    k = int(input())

    target = 7
    for i in range(1000000):
        target = target % k * 10 + 7
        if target == 7:
            print(i + 1)
            return
    print(-1)
    return


# テストクラス
class TestClass(unittest.TestCase):
    def assertIO(self, assert_input, output):
        stdout, sat_in = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(assert_input)
        resolve(sys._getframe().f_back.f_code.co_name)
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, sat_in
        self.assertEqual(out, output)

    def test_input_1(self):
        test_input = """101"""
        output = """4"""
        self.assertIO(test_input, output)

    def test_input_2(self):
        test_input = """2"""
        output = """-1"""
        self.assertIO(test_input, output)

    def test_input_3(self):
        test_input = """999983"""
        output = """999982"""
        self.assertIO(test_input, output)

    # 自作テストパターンのひな形(利用時は「tes_t」のアンダーバーを削除すること
    def tes_t_1original_1(self):
        test_input = """データ"""
        output = """データ"""
        self.assertIO(test_input, output)


# 実装orテストの呼び出し
if __name__ == "__main__":
    if os.environ.get("USERNAME") is None:
        # AtCoder提出時の場合
        resolve()

    else:
        # 自PCの場合
        unittest.main()


Measured memory_bytes: 70912
#include<bits/stdc++.h>
#define ll long long int

using namespace std;

const ll mod=1000000007;
const ll inf=1e18;

int main(){

  ll n;
  cin >> n;

  if(n%2==1)cout << 0 << endl;
  else{
    ll s=0;//5の個数
    ll d=10;
    while(n>=d){
      //s+=floor(n/d);
      s+=n/d;
      d*=5;
      //cout << floor(n/(2*pow(5,c))) <<" " <<c<< endl;
    }

    cout << s << endl;
  }

}

Measured memory_bytes: 3640
import math

A, B, H, M = map(int, input().split())
theta = abs(0.5*(60*H+M)-6*M)
if theta == 0:
    print(abs(A-B))
elif theta < 180:
    C = A**2+B**2-2*A*B*math.cos(theta*math.pi/180)
    print(math.sqrt(C))
elif theta == 180:
    print(A+B)
else:
    theta = 360-theta
    C = A**2+B**2-2*A*B*math.cos(theta*math.pi/180)
    print(math.sqrt(C))

Measured memory_bytes: 9592
import math
from functools import reduce
k=int(input())
def gcd(*numbers):
    return reduce(math.gcd, numbers)
ans=0
for i in range(1,k+1):
  for j in range(i,k+1):
    for l in range(j,k+1):
      if l==i:
        ans+=gcd(i,j,l)
      elif i==j or j==l:
        ans+=3*gcd(i,j,l)
      else:
        ans+=6*gcd(i,j,l)
print(ans)





Measured memory_bytes: 9656
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

#[derive(PartialEq, PartialOrd)]
pub struct Total<T>(pub T);

impl<T: PartialEq> Eq for Total<T> {}

impl<T: PartialOrd> Ord for Total<T> {
    fn cmp(&self, other: &Total<T>) -> std::cmp::Ordering {
        self.0.partial_cmp(&other.0).unwrap()
    }
}

#[derive(Clone, Default, Copy)]
struct Point {
    x: f64,
    y: f64,
}

impl Point {
    fn angle(&self) -> f64 {
        self.y.atan2(self.x) + std::f64::consts::PI
    }

    fn abs(&self) -> f64 {
        self.x.hypot(self.y)
    }
}

impl std::ops::Add for Point {
    type Output = Point;
    fn add(self, other: Point) -> Point {
        Point {
            x: self.x + other.x,
            y: self.y + other.y,
        }
    }
}

impl std::ops::Sub for Point {
    type Output = Point;
    fn sub(self, other: Point) -> Point {
        Point {
            x: self.x - other.x,
            y: self.y - other.y,
        }
    }
}

fn main() {
    let n = read::<usize>();
    let mut points = vec![];
    for _ in 0..n {
        let v = read_vec::<f64>();
        if v[0] == 0.0 && v[1] == 0.0 {
            continue;
        }
        points.push(Point { x: v[0], y: v[1] });
    }
    let n = points.len();
    let mut clone = points.clone();
    points.append(&mut clone);

    let mut points_angles = vec![];
    for (i, point) in points.into_iter().enumerate() {
        let mut angle = point.angle();
        if i >= n {
            angle += 2.0 * std::f64::consts::PI;
        }
        points_angles.push((angle, point));
    }
    points_angles.sort_by_key(|x| Total(x.0));

    let mut end_pointer = 0;
    let mut sum = Point { x: 0.0, y: 0.0 };
    let mut ans = 0.0;
    for i in 0..n {
        while end_pointer < points_angles.len()
            && sum.abs() < (sum + points_angles[end_pointer].1).abs()
            && end_pointer - i < n
        {
            sum = sum + points_angles[end_pointer].1;
            end_pointer += 1;
        }
        ans = max(Total(ans), Total(sum.abs())).0;
        sum = sum - points_angles[i].1;
    }
    println!("{}", ans);
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}


Measured memory_bytes: 4352
/*input
4 1
10 100
10 100
10 100
10 100
*/
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<double,double> pdd;
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define F first
#define S second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define pb push_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#ifdef leowang
#define debug(...) do{\
	fprintf(stderr,"%s - %d : (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
	_DO(__VA_ARGS__);\
}while(0)
template<typename I> void _DO(I&&x){cerr<<x<<endl;}
template<typename I,typename...T> void _DO(I&&x,T&&...tail){cerr<<x<<", ";_DO(tail...);}
#else
#define debug(...)
#endif
template<typename T1,typename T2>
ostream& operator<<(ostream& out,pair<T1,T2> P){
	out<<'('<<P.F<<','<<P.S<<')';
	return out;
}
//}}}
const ll maxn=300005;
const ll maxlg=__lg(maxn)+2;
const ll INF64=8000000000000000000LL;
const int INF=0x3f3f3f3f;
const ll MOD=ll(1e9+7);
const double PI=acos(-1);
//const ll p=880301;
//const ll P=31;

ll mypow(ll a,ll b){
	ll res=1LL;
	while(b){
		if(b&1) res=res*a%MOD;
		a=a*a%MOD;
		
		b>>=1;
	}
	return res;
}
ll w[maxn],v[maxn];

vector<ll> a[4];
vector<ll> pre[4];
int main()
{
	IOS;
	ll n,W;
	cin>>n>>W;
	REP(i,n) cin>>w[i]>>v[i];

	REP(i,n){
		a[w[i]-w[0]].pb(v[i]);
	}
	REP(i,4) sort(ALL(a[i]),greater<ll>());

	REP(i,4){
		pre[i].pb(0);
		REP(j,SZ(a[i])){
			pre[i].pb(pre[i].back()+a[i][j]);
		}
	}
	ll ans=0;
	REP(i,SZ(a[0])+1) REP(j,SZ(a[1])+1) REP(k,SZ(a[2])+1){
		if(W<i*w[0]+j*(w[0]+1)+k*(w[0]+2)) continue;
		ll rem=W-(i*w[0]+j*(w[0]+1)+k*(w[0]+2));
		rem/=(w[0]+3);
		rem=min(rem,(ll)SZ(a[3]));
		ll cur=pre[0][i]+pre[1][j]+pre[2][k]+pre[3][rem];
		ans=max(ans,cur);
	}
	cout<<ans<<'\n';
	return 0;
}


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

// #define int long long
#define rep(i, n) for (long long i = (long long)(0); i < (long long)(n); ++i)
#define reps(i, n) for (long long i = (long long)(1); i <= (long long)(n); ++i)
#define rrep(i, n) for (long long i = ((long long)(n)-1); i >= 0; i--)
#define rreps(i, n) for (long long i = ((long long)(n)); i > 0; i--)
#define irep(i, m, n) for (long long i = (long long)(m); i < (long long)(n); ++i)
#define ireps(i, m, n) for (long long i = (long long)(m); i <= (long long)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) long long(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;
using vtp = vector<tuple<ll,ll,ll>>;
using vb = vector<bool>;

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

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

ll dp[100005][2];

signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  string s; cin>>s;
  ll n=s.size();
  
  dp[0][0]=1;
  
  rep(i,n){
    // a+b == 0
    if(s[i]=='0'){
      dp[i+1][0]=dp[i][0];
      dp[i+1][1]=dp[i][1];
    }else{
      dp[i+1][1]=(dp[i][0]+dp[i][1])%MOD;
    }
    
    // a+b == 1
    if(s[i]=='0'){
      (dp[i+1][1]+=dp[i][1]*2%MOD)%=MOD;
    }else{
      (dp[i+1][0]+=dp[i][0]*2%MOD)%=MOD;
      (dp[i+1][1]+=dp[i][1]*2%MOD)%=MOD;
    }
  }
  ll ans=(dp[n][0]+dp[n][1])%MOD;
  
  cout<<ans<<endl;
}

Measured memory_bytes: 2000
#include <iostream>
using namespace std;
#define MAX 100

int main(){
    int n,u,k,v;
    int m[MAX][MAX];
    
    cin>>n;
    
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            m[i][j]=0;
        }
    }
    
    for(int i=0;i<n;i++){
        cin >> u >> k;
        u--;
        for(int j=0;j<k;j++){
            cin >>v;
            v--;
            m[u][v]=1;
        }
    }
    
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            if(j!=0)cout<<" ";
            cout << m[i][j];
        }cout<<endl;
    }
    
    return 0;
    
}



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

string judgeDate(string s)
{
    int year = atoi(s.substr(0, 4).c_str());
    int month = atoi(s.substr(5, 2).c_str());
    int date = atoi(s.substr(8, 2).c_str());
    
    if (year > 2019)
        return "TBD";
    else
    {
        if (month > 4)
            return "TBD";
    }
    
    return "Heisei";
}

int main()
{
    string s;
    while (cin >> s)
    {
        cout<<judgeDate(s)<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
long long N, A[87], CurrentMoney = 1000;
int main() {
cin >> N;
for (int i = 1; i <= N; i++) cin >> A[i];
for (int i = 1; i <= N - 1; i++) {
long long Stocks = 0;
if (A[i] < A[i + 1]) Stocks = CurrentMoney / A[i];
 CurrentMoney += (A[i + 1] - A[i]) * Stocks;
 }
 cout << CurrentMoney << endl;
 }

Measured memory_bytes: 3608
N, M, X = map(int, input().split())

C = []
A = []
for _ in range(N):
    x = list(map(int, input().split()))
    C.append(x[0])
    A.append(x[1::])

ans = 10**10
for bit in range(1<<N):
    sum_p = 0
    p = [ 0 for _ in range(M) ]
    for i in range(N):
        if bit & 1<<i:
            for j, a in enumerate(A[i]):
                p[j] = p[j] + a
            sum_p = sum_p + C[i]

    n = sum( x >= X for x in p )
    if n == M:
        ans = min(ans, sum_p)

if ans == 10**10:
    print(-1)
else:
    print(ans)


Measured memory_bytes: 9176
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <iomanip>
#include <stack>
#include <queue>
#include <numeric>
#include <map>
#include <unordered_map>
#include <set>
#include <fstream>
#include <chrono>
#include <random>
#include <bitset>
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define sz(x) ((int)(x).size())
#define pb push_back
using ll = long long;
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
ll gcd(ll a, ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}

int main(){
  ll X; cin >> X;
  vector<pair<ll,ll>> p5s;
  

  for(ll B = -3800; B<=3800; B++){
    ll t = B*B*B*B*B;
    p5s.pb({t, B});
  }
  sort(all(p5s));
  rep(i,sz(p5s)){
    rep(j,sz(p5s)){
      if(p5s[i].first-p5s[j].first==X){
        cout << p5s[i].second << " " << p5s[j].second<< endl;
        return 0;
      }
    }
  }
  return 0;
}


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

using namespace std;
int memo[1000500];

int main(){
  int x;
  cin >> x;
  for(int i=0;i<1000000;i++){
      if(i==0 || i==100 || i==101 || i==102 || i==103 || i==104 || i==105){
          memo[i]=1;
      }
      if(memo[i]==1){
          memo[i+100]=1;
          memo[i+101]=1;
          memo[i+102]=1;
          memo[i+103]=1;
          memo[i+104]=1;
          memo[i+105]=1;
      }
  }
  if(memo[x]==1){
      cout << 1 << endl;
  }
  else {
      cout << 0 << endl;
  }
}

Measured memory_bytes: 4224
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
ll N,A,B,C;
vector<ll> l;
ll ans = 100100100ll;

void dfs(int t, vector<int> &AL, vector<int> &BL,vector<int> &CL){
    if(t==N){
        //評価
        if(AL.size() ==0 || BL.size()==0||CL.size()==0){
            return;
        }
        ll sum=0;
        ll temp =0;
        for(ll a:AL){
            temp+=a;
        }
        // cerr << "AL" << AL.size()<<"temp="<<temp << endl;
        sum += (abs(temp-A)+(AL.size()-1)*10);
        temp =0;
        for(ll b:BL){
            temp +=b;
        }
        // cerr << "BL" << BL.size()<<"temp="<<temp << endl;
        sum += (abs(temp-B)+(BL.size()-1)*10);
        temp =0;
        for(ll c:CL){
            temp +=c;
        }
        // cerr << "CL" << CL.size()<<"temp="<<temp << endl;
        sum += (abs(temp-C)+(CL.size()-1)*10);
        // cerr << sum << endl;
        ans = min(ans,sum);
        return;
    }
    dfs(t+1,AL,BL,CL);
    
    AL.push_back(l[t]);
    dfs(t+1,AL,BL,CL);
    AL.pop_back();
    
    BL.push_back(l[t]);
    dfs(t+1,AL,BL,CL);
    BL.pop_back();
    
    CL.push_back(l[t]);
    dfs(t+1,AL,BL,CL);
    CL.pop_back();
}

int main() {
    cin >> N >>A >>B >>C;
    l.resize(N);
    for(int i=0;i<N;i++){
        cin >> l[i];
    }
    vector<int> a,b,c;
    dfs(0,a,b,c);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <ostream>
#include<cmath>
#include<cstdio>
#include <vector>
#include <string>
#include <sstream>
using namespace std;
double x[101],y[101];
int a[101],r[101];
#define PI 3.14159265358979324

struct point{
	double x,y;
	point(double x,double y):x(x),y(y){}
	point operator-(point ano){
		return point(x-ano.x,y-ano.y);
	}
	double operator*(point ano){
		return x*ano.x+y*ano.y;
	}
	double abs(){
		return sqrt(x*x+y*y);
	}
	string to_str(){
		stringstream s;
		s<<"("<<x<<","<<y<<")";
		return s.str();
	}
};
double dist(point a,point b){
	return (a-b).abs();
}
struct line{
	point a,b;
	double A,B,C;
	line(point a,point b):a(a),b(b){
		A=(a.y-b.y);B=-(a.x-b.x);C=a.x*b.y-a.y*b.x;
	}
	point diff(){return b-a;}
	bool inc(double x,double y){
		return (a.x-x)*(b.x-x)<=0 && (a.y-y)*(b.y-y)<=0;
	}
	string to_str(){
		stringstream s;
		s<<a.to_str()<<"~";
		s<<b.to_str();
		return s.str();
	}
};
double dist_point_line(point x,line l){
	double xl1=(x-l.a)*l.diff();
	double xl2=(x-l.b)*l.diff();
	if(xl1*xl2>0){
		return min(dist(l.a,x),dist(l.b,x));
	}else{
		return abs(l.A*x.x+l.B*x.y+l.C)/sqrt(l.A*l.A+l.B*l.B);
	}
}
bool cross(line a,line b){
	double d=a.A*b.B-a.B*b.A;
	if(abs(d)<1e-8)return false;
	double x=-(b.B*a.C-a.B*b.C)/d;
	double y=-(a.A*b.C-b.A*a.C)/d;
	return a.inc(x,y)&&b.inc(x,y);

}
bool nonparalell(){return false;}
double dist_lines(line a,line b){
	//cross
	if(cross(a,b)){
		return 0;
	}
	double mind=10000000000;
	mind=min(mind,dist_point_line(a.a,b));
	mind=min(mind,dist_point_line(a.b,b));
	mind=min(mind,dist_point_line(b.a,a));
	mind=min(mind,dist_point_line(b.b,a));
	return mind;
}
class star{
public:
	double sx[5],sy[5];
	vector<line> l;
	int x,y,a,r;
	star(double X,double Y,int A,int R){
		x=X;y=Y;a=A;r=R;
		init();
	}
	void init(){
			for(int i=0;i<5;i++){
				sx[i]=(double)x-(double)r*sin(PI/180*(a+72*i));
				sy[i]=y+r*cos(PI/180*(a+72*i));
			}
			for(int i=0;i<5;i++){
				l.push_back(line(point(sx[i],sy[i]),point(sx[(i+2)%5],sy[(i+2)%5])));
			}
	}
	string to_str()const{
		stringstream s;
		s<<"[";
		for(int i=0;i<5;i++){
			s<<"(";
			s<<sx[i];
			s<<", ";
			s<<sy[i];
			s<<")";
		}
		s<<"]";
		return s.str();
	}
};
double dist(star a,star b){
	double s=1e+9;
		for(int i=0;i<5;i++){
			for(int j=0;j<5;j++){
				s=min(s,dist_lines(a.l[i],b.l[j]));
			}
		}
		return s;
}

double mp[101][101];
int main(void){
	int n,m,l;
	vector<star> stars;
	while(cin>>n>>m>>l&&n){
		stars.clear();
		for(int i=0;i<n;i++){
			cin>>x[i]>>y[i]>>a[i]>>r[i];
			star st(x[i],y[i],a[i],r[i]);
			stars.push_back(st);
			//cout<<st.to_str()<<endl;
		}
		for(int i=0;i<n;i++){
			for(int j=0;j<n;j++){
				double d=dist(stars[i],stars[j]);
				mp[i][j]=d;
				//cout<<"dist["<<i<<","<<j<<"]="<<d<<endl;
			}
		}
		for(int k=0;k<n;k++){
			for(int i=0;i<n;i++){
				for(int j=0;j<n;j++){
					double t=mp[i][k]+mp[k][j];
					if(t<mp[i][j]){
						mp[i][j]=t;
					}
				}
			}
		}
		printf("%.10f\n",mp[m-1][l-1]);
	}

}

Measured memory_bytes: 1400
#include <bits/stdc++.h>
using namespace std;
#define mod (long)(1e9+7)
#define f(a) (a-1?a:2)
int main(){
  long n,r=1;
  cin>>n;
  map<int,int> pn;
  for(int m=2;m<=n;++m){
    int l=m;
    for(int i=1;i<1000&&l>1;i+=2){
      while(l%f(i)==0){pn[f(i)]++;l/=f(i);}
    }
  }
  for(auto p:pn)r=((r%mod)*((p.second+1)%mod))%mod;
  cout<<r;
  return 0;
}

Measured memory_bytes: 256
N,M = map(int, input().split())
S = [0]*M
for i in range(M):
    S[i] = list(map(int, input().split()))
P = list(map(int, input().split()))


def check(bit):
    f = True
    for i in range(M):
        cnt = 0
        for si in range(len(S[i])):
            if si == 0:
                pass
            else:
                cnt += int(bit[S[i][si]-1])
        if cnt%2 != P[i]:
            f = False
    return f    
    

ans = 0
for i in range(2**N):
    bit = bin(i)[2:].zfill(N)
    if check(bit):
        ans += 1

print(ans)


Measured memory_bytes: 41456
#include<iostream>
#include<string>
#include<vector>
#include <algorithm>
#include<math.h>

using namespace std;

int main() {
	 long long h;
	 cin >> h;
	 if (h == 1)cout << 1;
	 else {
		 long long cou = 0;
		 while (h > 1) {
			 h /= 2;
			 cou++;
		 }
		 long long ans = 0;
		 for (int i = 0; i <= cou; i++) {
			 ans += pow(2.0,double(i));
		 }
		 
		 cout << ans << endl;
	 }
	
}


Measured memory_bytes: 256
#include<iostream>
#include<math.h>
#include<stdio.h>
#include<algorithm>
#include<queue>
#include<map>
#include<stack>
#include<set>
#include<vector>
#include<string.h>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ll, int> pli;
typedef pair <db, db> pdd;

const int maxn = 2005;
const int Mod=1000000007;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const db PI = acos(-1);
const db ERR = 1e-10;

#define Se second
#define Fi first
int pic [maxn][maxn];
int dp[maxn][maxn];
int main()
{
    int n;
    cin>>n;
    for(int i=1;i<=2;i++)
    {
        for(int j=1;j<=n;j++)
        {
            cin>>pic[i][j];
        }
    }
    for(int i=1;i<=2;i++)
    {
        for(int j=1;j<=n;j++)
        {
            dp[i][j]=pic[i][j]+max(dp[i-1][j],dp[i][j-1]);
        }
    }
    cout<<dp[2][n]<<endl;
    return 0;
}


Measured memory_bytes: 2304
import java.util.*;

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

        int times = T / A;

        System.out.println(times*B);
    }
}


Measured memory_bytes: 23124
#include<iostream>
#include<cstdio>
#include<cmath>
#include<vector>
#include<queue>
#include<map>
#include<algorithm>
#include<set>
#include<complex>
#include<string>
#include<cstring>
using namespace std;
#define rep2(x,from,to) for(int x=(from);(x)<(to);(x)++)
#define rep(x,to) rep2(x,0,to)
#define INF 100000000
#define debug(x) cout<<#x<<": "<<x<<endl

#define all(x) x.begin(),x.end()
typedef pair<int,int> P;
typedef pair<int,P> PP;
int n;
string s;
int a[14];
int k;
int main()
{
	cin>>s;
	for(int i=0;i<s.size();i++)
	{
		k=(int)(s[i]-'0');
		a[i]=k;
	}
	int y=1000*a[0]+100*a[1]+10*a[2]+a[3];
	int m=10*a[5]+a[6];
	int d=10*a[8]+a[9];
	if(y>2019)
	{
		cout<<"TBD"<<endl;
	}
	else if(m>4)
	{
		cout<<"TBD"<<endl;
	}
	else if(d>30)
	{
		cout<<"TBD"<<endl;
	}
	else cout<<"Heisei"<<endl;
	return 0;
}

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

int main(){
  int l,r,d;
  std::cin >> l >> r>>d;

  int ans=0;
  for (int i = l; i <= r; i++) {
    if(i%d==0 && i/d>0)ans++;
  }

  std::cout << ans << '\n';
  return 0;
}


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

signed main(){
	string s;cin>>s;
	if(s[0]!=s[1]&&s[1]!=s[2]&&s[2]!=s[0])puts("Yes");
	else puts("No");
	}

Measured memory_bytes: 256
#include <bits/stdc++.h>
        using namespace std;
        #define int long long
const int MAX = 510000;
const int MOD = 1000000007;

        signed main() {
        int n,k,s;
        cin>>n>>k>>s;
      if(s==2){
          for(int i=0;i<k;i++)cout<<2<<' ';
          for(int i=k;i<n;i++)cout<<3<<' ';
          return 0;
      }
      if(s==1){
          for(int i=0;i<k;i++)cout<<1<<' ';
          for(int i=k;i<n;i++)cout<<2<<' ';
          return 0;
      }
      for(int i=0;i<k;i++)cout<<s<<' ';
      int t=k;
      while(t<n){
          cout<<s-1<<' ';
          t++;
          if(t<n){
              cout<<2<<' ';
              t++;
          }
      }
        
         return 0;

        }


Measured memory_bytes: 1280
def main():
    n=int(input())
    m=int((2*n)**0.5)
    if m*(m+1)==n*2:
        print("Yes")
        m+=1
        print(m)
    else:
        print("No")
        exit()
    
    ans=[[m-1] for i in range(m)]
    c=1
    for i in range(m):
        for j in range(i+1,m):
            ans[i].append(c)
            ans[j].append(c)
            c+=1
    for i in ans:
        print(" ".join(map(str,i)))


if __name__ == '__main__':
    main()








Measured memory_bytes: 9076
using System;

namespace ABC169C
{
    class Program
    {
        static void Main(string[] args)
        {
            var t = Console.ReadLine().Trim().Split(' ');
            ulong a = ulong.Parse(t[0]);
            string s = t[1].Replace(".", ""); // 3桁の整数になる
            ulong b = ulong.Parse(s);
            ulong ans = a * b / 100;
            Console.WriteLine(ans);
        }
    }
}

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

using namespace std;

int main(int argc, char* argv[]) {
  string s; cin >> s;
  string p; cin >> p;

  int i;
  for (i = 0; i < p.length(); i++) {
    int s2_b = s.length() - i, s2_e = s.length();
    int s1_b = 0, s1_e = s2_b;

    string s1 = s.substr(s1_b, s1_e);
    string s2 = s.substr(s2_b, s2_e);
    string new_s = s2 + s1;
    if (new_s.find(p) != string::npos) {
      break;
    }
  }
  if (i == p.length()) cout << "No" << endl;
  else cout << "Yes" << endl;
  return 0;
}

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

#define fastio 			ios::sync_with_stdio(0);	cin.tie(0); cout.tie(0);  cout<<fixed;  cout<<setprecision(12);
#define randomINT 		mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define	newl 			cout<<"\n"
#define DISP(as)		for(auto it : as) cout<<it<<" ";newl;
#define DISP1(as)		for(auto it : as) cout<<it.f<<" "<<it.s<<") ";newl;
#define all(x)         	(x).begin(),(x).end()
#define mset(x,val)    	memset(x,val,sizeof(x))
#define newl           	cout<<"\n"
#define pb             	push_back
#define mp             	make_pair
#define f 				first
#define s 				second
#define dline          cerr<<"///REACHED///\n";
#define deb1(x)        cerr<<#x<<" = "<<x<<'\n';
#define deb2(x,y)      cerr<<'['<<#x<<','<<#y<<"] = "<<'['<<x<<','<<y<<']'<<'\n';
#define deb3(x,y,z)    cerr<<'['<<#x<<','<<#y<<','<<#z<<"] = "<<'['<<x<<','<<y<<','<<z<<']'<<'\n';

typedef long long 				ll;
typedef long double 			ld;
typedef vector<ll> 				vll;
typedef pair<ll , ll> 			pll;
typedef pair<ld, ld> 			pld;
typedef unordered_map<ll, ll> 	um;
typedef vector<pll> 			vpll;

const ll 	MAX5 	= 	2e+5 + 99;
const ll 	MAX7 	= 	1e+7 + 7;
const ll 	MAXN 	= 	MAX7;
const ll   	INF   	=  	0x7f7f7f7f7f7f7f7f;
const int  	INFi 	=  	0x7f7f7f7f;
const ll 	MOD		=  	1e+9 + 7;

// <------------- Declare Variables Here ------------> //

ll T = 1;
ll n, k, l, q, x, y;
string s;
ll res = 0;

// < ----------- func eh ---------------- ? //


// <------------- Start of main() -------------------> //

void MAIN() {
	cin>>x>>y;
	if(x==1 || y==1) cout<<1;
	else
	cout<<(x*y + 1)/2;
}

int main() {
	fastio; randomINT;
	//cin >> T;
	while (T--) {
		MAIN();
	}
	return 0;
}


Measured memory_bytes: 3640
import Text.Printf (printf)

data Point = Point
    { x :: Double
    , y :: Double
    } deriving Show


koch :: Int -> Point -> Point -> IO ()
koch 0 p1 p2 = do
    return ()
koch n p1 p2 = do
    koch (n - 1) p1 s
    printf "%.8f %.8f\n" (x s) (y s)
    koch (n - 1) s u
    printf "%.8f %.8f\n" (x u) (y u)
    koch (n - 1) u t
    printf "%.8f %.8f\n" (x t) (y t)
    koch (n - 1) t p2
  where
    s = Point
            ((x p1 * 2 + x p2) / 3)
            ((y p1 * 2 + y p2) / 3)
    t = Point
            ((x p1 + x p2 * 2) / 3)
            ((y p1 + y p2 * 2) / 3)
    u = Point
            ((x t - x s) * cos (pi / 3) - (y t - y s) * sin (pi / 3) + x s)
            ((x t - x s) * sin (pi / 3) + (y t - y s) * cos (pi / 3) + y s)


main :: IO ()
main = do
    n <- readLn :: IO Int
    printf "%.8f %.8f\n" (x p1) (y p1)
    koch n p1 p2
    printf "%.8f %.8f\n" (x p2) (y p2)
  where
    p1 = Point 0 0
    p2 = Point 100 0


Measured memory_bytes: 5764
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scn = new Scanner(System.in);
		int n = scn.nextInt();
		double x,ans=0;
		for(int i = 0;i<n;i++) {
			x=scn.nextDouble();
			if(scn.next().equals("JPY")) {
				ans+=x;
			}else {
				ans+=x*380000;
			}
		}
		System.out.println(ans);
		scn.close();
	}
}

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

const int N=305;
int n,k;
long long m,dp[N][N][N];

int main()
{
	scanf("%d%d%lld",&n,&k,&m);
	for(int i=1;i<=k;i++) dp[0][i][0]=1;
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=k;j++)
		{
			dp[i][j][i]=dp[i][j-1][0];
			for(int l=i;l>=0;l--)
			{
				dp[i][j][l]+=dp[i][j][l+1];
				dp[i][j][l]+=dp[i-1][j][l]*(l+1)%m;
				dp[i][j][l]%=m;
//				cout<<i<<' '<<j<<' '<<l<<' '<<dp[i][j][l]<<endl;
			}
		}
	}
	printf("%lld\n",dp[n][k][0]);
}

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

int selectionSort(int A[], int N);

int main() {
	int A[100]; //??°?????????
	int N; //??????

	//??\???
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> A[i];
	}

	//?¨????
	int swCount; //???????????°
	swCount = selectionSort(A, N);

	//??????
	for (int i = 0; i < N; i++) {
		if (i) cout << " ";
		cout << A[i];
	}
	cout << endl;
	cout << swCount << endl;
}

int selectionSort(int A[], int N) {
	int swCount = 0;
	for (int i = 0; i < N-1; i++) {
		int minj = i;
		for (int j = i + 1; j < N; j++) {
			if (A[j] < A[minj]) minj = j;
		}
		swap(A[i], A[minj]);
		if (i != minj) swCount++;
	}

	return swCount;
}

Measured memory_bytes: 3108
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
#define bit(n) (1LL << (n))
#define len(x) ((ll)(x).size())
#define debug(var) cout << "[" << #var << "]\n" << var << endl
#define int long long
typedef long long ll;
const int INF = 1001001001001001001ll;
const ll LINF = 1001001001001001001ll;
const int MOD = 1000000007;
const double EPS = 1e-9;

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

template <typename T>
ostream& operator<<(ostream& s, const vector<vector<T>>& vv) {
  int len = vv.size();
  for (int i = 0; i < len; ++i) {
    s << vv[i];
    if (i != len - 1)
      s << '\n';
  }
  return s;
}

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

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

__attribute__((constructor)) void initial() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
}

signed main() {
  int N;
  cin >> N;
  vector<int> L(2 * N);
  rep(i, 2 * N) {
    cin >> L[i];
  }

  int ans = 0;
  sort(all(L), greater<int>());
  rep(i, N) {
    ans += L[i * 2 + 1];
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i <= n; i++)
#define FORR(i, m, n) for(int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
 
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;

int main(){
    ll h, w;
    cin >> h >> w;
    vvll a(h, vll(w));
    char c;
    REP(i, h){
        REP(j, w){
            cin >> c;
            if(c == '#') a[i][j] = 1;
            else a[i][j] = 0;
        }
    }
    ll flg = 0;
    REP(i, h - 1){
        REP(j, w - 1){
            if(a[i][j] && a[i + 1][j] && a[i][j + 1]){
                flg = 1;
                break;
            }
        }
        if(flg) break;
    }
    REP(i, w - 2){
        if(a[h - 1][i] && a[h - 2][i + 1] && a[h - 1][i + 1] && a[h - 1][i + 2]){
            flg = 1;
            break;
        }
    }
    REP(i, h - 2){
        if(a[i][w - 1] && a[i + 1][w - 2] && a[i + 1][w - 1] && a[i + 2][w - 1]){
            flg = 1;
            break;
        }
    }
    if(a[h - 1][w - 2] && a[h - 2][w - 1]) flg = 1;
    if(flg) cout << "Impossible" << endl;
    else cout << "Possible" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;
using ll = long long;

int main(){
  string S,T;
  cin >> S >> T;
  if(S[0]==T[2] && S[1]==T[1] && S[2]==T[0]){
    cout << "YES" << endl;
    return 0;
  }
  cout << "NO" << endl;
}

Measured memory_bytes: 3504
#include <iostream>                                                                                                                                                        
using namespace std;
                                                                                                                                                                          int main() {                                                                                                                                                                int i = 1;                                                                                                                                                                int x;
  for (;;) {
    cin >> x;
    if (!x)
      break;
    cout << "Case " << i << ": " << x << endl;                                                                                                                                i++;                                                                                                                                                                    }
  return 0;
}

Measured memory_bytes: 2992
#include <bits/stdc++.h>
using namespace std;
#define Fast_IO ios_base::sync_with_stdio(false);cin.tie(NULL);
int dp[3005][3005];

int solvedp(char a[],int n,char b[],int m){
	for(int i=1;i<=n;i++){
		for(int j=1;j<=m;j++){
			if(a[i-1] == b[j-1]){
				dp[i][j] = 1 + dp[i-1][j-1];
				//cout<<a[i-1];
			}
			else
				dp[i][j] = max(dp[i-1][j],dp[i][j-1]);
		}
	}	
	return dp[n][m];
	// if(a[i]=='\0')
	// 	return 0;
	// if(b[j]=='\0')
	// 	return 0;
	// if(dp[i][j]!=0)
	// 	return dp[i][j];
	// if(a[i]==b[j]){
	// 	//dp[i][j]=c++;
	// 	return dp[i][j] = 1 + solvedp(a,i+1,b,j+1);
	// }
	// else
	// 	return dp[i][j] = max(solvedp(a,i+1,b,j),solvedp(a,i,b,j+1));
}

int main()
{	
	Fast_IO
	#ifdef _WIN32 
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w",stdout);
	#endif
	char a[3005],b[3005];
	cin>>a>>b;
	int index = solvedp(a,strlen(a),b,strlen(b));//<<endl;
	char lcs[index+1]; 
    lcs[index] = '\0'; 
    int i = strlen(a), j=strlen(b); 
    while (i>0 and j>0){ 
       if (a[i-1] == b[j-1]){ 
        	lcs[index-1] = a[i-1];  
        	i--; j--; index--;
        	// cout<<"ve"; 
      }
      else if (dp[i-1][j]>dp[i][j-1]) 
         i--; 
      else
         j--; 
   } 
  	cout<<lcs;//<<endl;

	// for(int i=0;i<=1;i++){
	// 	for(int j=0;j<=1;j++)
	// 		cout<<dp[j][i];
	// 	cout<<endl;
	// }
}

Measured memory_bytes: 35456
#include<bits/stdc++.h>
#define MOD 1000000007
#define MAX 5001
using namespace std;
int Total;
int Ans;
vector<int>Edge[MAX];
int Factorial[MAX];
int Dp[MAX][MAX];
int Size[MAX];
inline void Dfs(int Now,int Father)
{
	register int i;
	Size[Now]=1;
	Dp[Now][1]=1;
	for(i=0;i<Edge[Now].size();i++)
	{
		register int Next;
		Next=Edge[Now][i];
		if(Next!=Father)
		{
			Dfs(Next,Now);
			register int Tmp[MAX];
			register int j,k;
			for(j=1;j<=Size[Now]+Size[Next];j++)
			{
				Tmp[j]=0;
			}
			for(j=1;j<=Size[Now];j++)
			{
				for(k=1;k<=Size[Next];k++)
				{
					Tmp[j]=(Tmp[j]-(long long)Dp[Now][j]*Dp[Next][k]%MOD*Factorial[k])%MOD;
					Tmp[j+k]=(Tmp[j+k]+(long long)Dp[Now][j]*Dp[Next][k])%MOD;
				}
			}
			Size[Now]+=Size[Next];
			for(j=1;j<=Size[Now];j++)
			{
				Dp[Now][j]=Tmp[j];
			}
		}
	}
}
int main(void)
{
	register int i;
	cin>>Total;
	for(i=1;i<Total;i++)
	{
		register int U,V;
		cin>>U>>V;
		Edge[U].push_back(V);
		Edge[V].push_back(U);
	}
	Factorial[0]=1;
	for(i=2;i<=Total;i+=2)
	{
		Factorial[i]=(long long)Factorial[i-2]*(i-1)%MOD;
	}
	Dfs(1,0);
	for(i=2;i<=Total;i+=2)
	{
		Ans=(Ans+(long long)Dp[1][i]*Factorial[i])%MOD;
	}
	cout<<(Ans+MOD)%MOD<<endl;
	return 0;
}


Measured memory_bytes: 107280
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>


int main(void) {
	char s[21];
	scanf("%s",s);
	int i;
	for(i=0; i<strlen(s); i++){
		printf("%c",s[strlen(s)-1-i]);
	}
	printf("\n");

	return 0;
}

Measured memory_bytes: 524
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<tuple>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<deque>
#include<cmath>
#include<stack>
#include<string.h>
#include <iomanip>
#define rep(i,n) for(int i = 0;i<n;i++)
#define _GLIBCXX_DEBUG
using ll = long long; 
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main() {
    int n;
    cin >> n;
    vector<string> s(n);
    rep(i,n) cin >> s[i];
    set<string> ss;
    rep(i,n) {
        ss.insert(s[i]);
    }
    cout << ss.size()<<endl;
}

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

using namespace std;

enum animal { unk = 0, sheep, wolf };

bool check(vector<animal> &as, string S) {
	int n = as.size();
	for (int i = 0; i < n; i++) {
		if ((as[i] == sheep && S[i] == 'o') || (as[i] == wolf && S[i] == 'x')) {
			if (as[(i-1+n) % n] == unk) {
				as[(i-1+n) % n] = as[(i+1) % n];
			} else if (as[(i+1) % n] == unk) {
				as[(i+1) % n] = as[(i-1+n) % n];
			} else if (as[(i-1+n) % n] != as[(i+1) % n]) {
				return false;
			}
		} else if ((as[i] == sheep && S[i] == 'x') || (as[i] == wolf && S[i] == 'o')) {
			if (as[(i-1+n) % n] == unk) {
				as[(i-1+n) % n] = (as[(i+1) % n] == sheep) ? wolf : sheep;
			} else if (as[(i+1) % n] == unk) {
				as[(i+1) % n] = (as[(i-1+n) % n] == sheep) ? wolf : sheep;
			} else if (as[(i-1+n) % n] == as[(i+1) % n]) {
				return false;
			}
		}
	}

	return true;
}

int main(int argc, char *argv[]) {
	int N;
	cin >> N;

	string S;
	cin >> S;

	vector<animal> ans(N);


	bool solved;
	for (int i = 0; i < N; i++) ans[i] = unk;
	ans[0] = sheep;
	ans[1] = sheep;
	solved = check(ans, S);
	if (solved) {
		for (int i = 0; i < N; i++) {
			if (ans[i] == sheep) printf("S");
			if (ans[i] == wolf) printf("W");
		}
		cout << endl;
		return 0;
	}

	for (int i = 0; i < N; i++) ans[i] = unk;
	ans[0] = sheep;
	ans[1] = wolf;
	solved = check(ans, S);
	if (solved) {
		for (int i = 0; i < N; i++) {
			if (ans[i] == sheep) printf("S");
			if (ans[i] == wolf) printf("W");
		}
		cout << endl;
		return 0;
	}

	for (int i = 0; i < N; i++) ans[i] = unk;
	ans[0] = wolf;
	ans[1] = sheep;
	solved = check(ans, S);
	if (solved) {
		for (int i = 0; i < N; i++) {
			if (ans[i] == sheep) printf("S");
			if (ans[i] == wolf) printf("W");
		}
		cout << endl;
		return 0;
	}

	for (int i = 0; i < N; i++) ans[i] = unk;
	ans[0] = wolf;
	ans[1] = wolf;
	solved = check(ans, S);
	if (solved) {
		for (int i = 0; i < N; i++) {
			if (ans[i] == sheep) printf("S");
			if (ans[i] == wolf) printf("W");
		}
		cout << endl;
		return 0;
	}

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

Measured memory_bytes: 1024
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)*}
    };
}

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)*}
    };
}

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, usize1) => {
        read_value!($next, usize) - 1
    };

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

fn main() {
    input! {
        a: i32,
        s: String,
    }

    if a >= 3200 {
        println!("{}", s);
    } else {
        println!("red");
    }
}



Measured memory_bytes: 4352
#include <iostream>
#include <algorithm>
#include <string>
#include <cstdio>
#include <cmath>
#include <stack>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <numeric>
#include <iomanip>


int main()
{
	long long a, b, c;

	std::cin >> a >> b >> c;

	std::cout << (b - a == c - b ? "YES" : "NO") << std::endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main() {
	
	int x, A, B, sum1, sum2;
	scanf("%d %d %d", &x, &A, &B);
	sum1 = x - A;
	sum2 = x - B;
	
	if(sum1 < 0){
		sum1 *= -1;
	}
	else{
		sum1 *= 1;
	}
	
	if(sum2 < 0){
		sum2 *= -1;
	}
	else{
		sum2 *= 1;
	}
	
	if(sum1 > sum2){
		printf("B");	
	}
	else{
		printf("A");
	}
	
	return 0;
}

Measured memory_bytes: 1592