akhauriyash/Code-Regression huggingface dataset:
def main():
    digits = [int(c) for c in input()]
    print(solve(digits))

def solve(digits):
    s = rec(str(digits[0]), digits[0], digits[1:])
    return '%s=7' % s

def rec(s, n, digits):
    if len(digits) == 0:
        if n == 7:
            return s
        else:
            return None
    
    x = rec('%s+%d' % (s, digits[0]), n + digits[0], digits[1:])
    if x is not None:
        return x
    y = rec('%s-%d' % (s, digits[0]), n - digits[0], digits[1:])
    if y is not None:
        return y

    return None

main()


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

#define LL long long

int main()
{
    int x;
    for(int i = 1 ; i <= 5 ; ++i)   
    {
        cin >> x;
        if(x == 0)
        {
            cout << i ;
            break;
        }
            
    }
    
    return 0;
}

Measured memory_bytes: 3184
n=int(input())
a=[list(map(int,input().split()))for _ in range(n)]
for k in range(n):
 b=a[k];b[3],b[4]=b[4],b[3]
def f():
 for i in range(n-1):
  d=a[i]
  for j in range(i+1,n):
   e=a[j]
   for p in('012345','152043','215304','302541','410352','514320'):
    f=[d[int(k)]for k in p]
    if f[0]==e[0]and f[5]==e[5]:
     f=f[1:5]*2
     for k in range(4):
      if f[k:k+4]==e[1:5]:return 'No'
 return 'Yes'
print(f())


Measured memory_bytes: 5608
#include <iostream>
using namespace std;
int main(void){
    // Your code here!

	int n,m,x;
	cin >>n>>m>>x;
	int L=0;
	int R=0;
	for(int i=0;i<m;i++)
	{
		int a;
		cin >>a;
		if(a<x){
			L++;
			
		}else{
			R++;
		}
		
	}
	cout<<min(L,R)<<endl;
	return 0;


}




Measured memory_bytes: 256
A,B,C=map(int,input().split())
K=int(input())
i=-1
if B<=A:
    for i in range(K):
        B*=2
        if B>A:
            break
if C<=B:
    for j in range(K-i-1):
        C*=2
if A<B and B<C:
    print("Yes")
else:
    print("No")


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

int main(){
  int n,x,cnt,d;
  cin >> n >> x;
  vector<int> L(n);
  for(int i = 0;i < n;i++){
    cin >> L.at(i);
  }
  cnt = 1; d = 0;
  for(int i = 0;i < n;i++){
    d = d + L.at(i);
    if(d <= x){
      cnt++;
    }
  }
  cout << cnt << endl;

  return 0;
}

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

int main() {

	int N;
    std::cin >> N;
    std::vector<int> A(N);

	for (int i = 0; i < N; i++) std::cin >> A[i];

	int ans = 0;

	for (int i = 0; i < N; i++) {
		for (int j = i + 1; j < N; j++) {
			if (abs(A[i] - A[j]) > ans) ans = abs(A[i] - A[j]);
		}
	}

	std::cout << ans << std::endl;

}

Measured memory_bytes: 256
import java.util.*;
public class Main{
	public static void main(String[] args) { 
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int n = sc.nextInt();
		int num[]=new int[w];
		for(int i=0;i<w;i++)
			num[i]=i+1;
		
		for(int i=0;i<n;i++){
			String[] data = sc.next().split(",");
			//System.out.println(data[0]+" "+data[1]);
			
			int a=Integer.parseInt(data[0]);
			int b=Integer.parseInt(data[1]);
			
			int tmp=num[a-1];
			num[a-1]=num[b-1];
			num[b-1]=tmp;
			//System.out.println(num[a-1]+" "+num[b-1]);	
			
		}
		for(int i=0;i<w;i++){
			System.out.println(num[i]);
		}
	}
}

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

int main(){
    int n, t;
    cin >> n >> t;
    vector<pair<int, int>> dish(n);
    for (int i = 0; i < n; i++) cin >> dish[i].first >> dish[i].second;
    sort(dish.begin(), dish.end());
    vector<vector<int>> dp(n + 1, vector<int>(t, 0));
    vector<int> max_b(n, 0);
    for (int i = n - 1; i >= 0; i--){
        max_b[i] = max(max_b[i], dish[i].second);
        if (i != 0) max_b[i - 1] = max_b[i];
    }
    int ans = 0;
    for (int i = 0; i < n; i++){
        if (dish[i].first < t) dp[i + 1][dish[i].first] = max(dp[i + 1][dish[i].first], dish[i].second);
        for (int j = 0; j < t; j++){
            dp[i + 1][j] = max(dp[i + 1][j], dp[i][j]);
            if (j + dish[i].first < t) dp[i + 1][j + dish[i].first] = max(dp[i + 1][j + dish[i].first], dp[i][j] + dish[i].second);
            if (j != t - 1) dp[i + 1][j + 1] = max(dp[i + 1][j], dp[i + 1][j + 1]);
        }
        if (i != n - 1) ans = max(ans, dp[i + 1][t - 1] + max_b[i + 1]);
        else ans = max(ans, dp[i + 1][t - 1]);
    }
    cout << ans << endl;
}

Measured memory_bytes: 35584
#![allow(non_snake_case, unused_macros, unused_imports)]

// Input
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, 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") }; }

// Module
use std::cmp::{min,max};
use std::collections::{HashSet,BTreeMap};

// Main
fn main(){
    input!{
        a: u32,
        b: u32,
    }
    let mut a = a;
    let mut b = b;
    if a==1{
        a = 14;
    }
    if b==1{
        b = 14;
    }
    let mut ans = "";
    if a>b{
        ans = "Alice";
    }else if b>a{
        ans = "Bob";
    }else{
        ans = "Draw";
    }
    println!("{}", ans);
}



Measured memory_bytes: 4352
import java.text.Bidi;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Scanner;

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

        int n = sc.nextInt();
        long k = sc.nextLong();

        //System.out.println("n = " + n);
        //System.out.println("k = " + k);

        int[] towns = new int[n];
        for(int i = 0; i < n; i++){
            towns[i] = sc.nextInt();
        }

        int nextPlace = 1;
        HashMap<Integer, Integer> visitedPlaces = new HashMap<>(); //<K,V> = <town, index>
        ArrayList<Integer> visitedPlacesList = new ArrayList<>();
        visitedPlacesList.add(nextPlace);
        visitedPlaces.put(nextPlace, 0);

        int reIndex = 0;
        int loopSize = 0;
        int visitCount = 0;
        for(int i = 1; i < n+1; i++) {
            nextPlace = towns[nextPlace - 1];
            if (visitedPlaces.containsKey(nextPlace)) {
                reIndex = visitedPlaces.get(nextPlace);
                loopSize = visitedPlaces.size() - reIndex;
                break;
            }
            visitCount++;
            visitedPlaces.put(nextPlace, i);
            visitedPlacesList.add(nextPlace);
            if(i == k){
                System.out.println(nextPlace);
                return;
            }
        }

        int rem = (int)((k-visitCount) % loopSize);

        //System.out.println("rem = " + rem);
        //System.out.println("visitCount = " + visitCount);
        //System.out.println("reIndex = " + reIndex);
        //System.out.println("loopSize = " + loopSize);

        //for(int e : visitedPlaces){
        //    System.out.print(e + " ");
        //}
        //System.out.println();

        if(rem == 0) {
            System.out.println(visitedPlacesList.get(visitedPlacesList.size() - 1));
        }else{
            System.out.println(visitedPlacesList.get(reIndex + rem - 1));
        }
    }
}

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

int main(void) {
    int H1,M1,H2,M2,K;
    int hm2,hm1;
    cin >> H1 >> M1 >> H2 >> M2 >> K;
    hm2 = H2 * 60 + M2;
    hm1 = H1 * 60 + M1;
    cout << hm2 - hm1 - K << endl;
    
    return 0;
}


Measured memory_bytes: 3592
import java.math.BigDecimal;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		try(Scanner sc = new Scanner(System.in)){
			int N = Integer.parseInt(sc.nextLine());
			String[] target = new String[N*2];
			
			for(int i = 0; i < target.length; i ++) {
				target[i] = sc.next();
			}
			
			BigDecimal ret = new BigDecimal("0");
			BigDecimal mulVal = new BigDecimal("380000");
			for(int i = 0; i < target.length; i += 2) {
				if(target[i + 1].equals("JPY")) {
					ret = ret.add(new BigDecimal(target[i]));
				} else {
					ret = ret.add((new BigDecimal(target[i])).multiply(mulVal));
				}
			}
			System.out.println(ret);
		}
	}
	
}


Measured memory_bytes: 22860
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    static final Scanner sc  = new Scanner(System.in);
    static final int MOD = (int) 1E9 + 7;
    static final int INF = Integer.MAX_VALUE;
    static final char BLACK = '#';
    static final char WHITE = '.';
    
    public static void main(String[] args) {
        int H = nint();
        int W = nint();
        int A = nint();
        int B = nint();
        
        int[][] ans = new int[H][W];
        for (int h = 0; h < B; h++) {
            for (int w = 0; w < A; w++) {
                ans[h][w] = 1;
            }
        }
        
        for (int h = B; h < H; h++) {
            for (int w = A; w < W; w++) {
                ans[h][w] = 1;
            }
        }
        
        PrintWriter out = new PrintWriter(System.out);
        for (int h = 0; h < H; h++) {
            for (int w = 0; w < W; w++) {
                out.print(ans[h][w]);
            }
            out.println();
        }
        out.flush();
    }
    
    private static int nint() {
        return sc.nextInt();
    }

    private static int[] nints(int n) {
        return nints(n, 0, 0);
    }

    private static int[] nints(int n, int padL, int padR) {
        int[] a = new int[padL + n + padR];
        for (int i = 0; i < n; i++)
            a[padL + i] = nint();
        return a;
    }

    private static long nlong() {
        return sc.nextLong();
    }

    private static long[] nlongs(int n) {
        return nlongs(n, 0, 0);
    }

    private static long[] nlongs(int n, int padL, int padR) {
        long[] a = new long[padL + n + padR];
        for (int i = 0; i < n; i++)
            a[padL + i] = nlong();
        return a;
    }

    private static double ndouble() {
        return sc.nextDouble();
    }
    
    private static double[] ndoubles(int n) {
        return ndoubles(n, 0, 0);
    }
    
    private static double[] ndoubles(int n, int padL, int padR) {
        double[] d = new double[n + padL + padR];
        for (int i = 0; i < n; i++) {
            d[padL + i] = ndouble();
        }
        return d;
    }

    private static String nstr() {
        return sc.next();
    }

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

    private static char[] nchars(int padL, int padR) {
        char[] temp = sc.next().toCharArray();
        char[] ret = new char[temp.length + padL + padR];
        System.arraycopy(temp, 0, ret, padL, temp.length);
        return ret;
    }
    
    private static char[][] nchars2(int h, int w) {
        return nchars2(h, w, 0, 0);
    }

    private static char[][] nchars2(int h, int w, int padLU, int padRD) {
        char[][] a2 = new char[h + padLU + padRD][w + padLU + padRD];
        for (int i = 0; i < h; i++)
            System.arraycopy(nchars(), 0, a2[padLU + i], padLU, w);
        return a2;
    }
    
    private static long min(long... ls) {
        return Arrays.stream(ls).min().getAsLong();
    }
    
    private static long max(long... ls) {
        return Arrays.stream(ls).max().getAsLong();
    }
}


Measured memory_bytes: 47012
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
using namespace std;

const int MAXN = 1000 + 10;

#define y1 MyY1
#define y2 MyY2
struct barrier
{
    int x, y, r;
};

int N;
int x1, x2, y1, y2;
vector <barrier> vbar;
double dist[MAXN];
bool inQueue[MAXN];

double precalcDist[MAXN][MAXN];
double getDist(int from, int to)
{
    double deltaX = vbar[from].x - vbar[to].x;
    double deltaY = vbar[from].y - vbar[to].y;
    return max(sqrt(deltaX * deltaX + deltaY * deltaY) - vbar[from].r - vbar[to].r, 0.0);
}

void SPFA()
{
    fill(dist, dist + N + 2, 1e100);
    memset(inQueue, 0x00, sizeof inQueue);

    queue <int> q;
    q.push(0);
    dist[0] = 0, inQueue[0] = true;

    while(!q.empty())
    {
        int to = q.front();
        inQueue[to] = false;
        q.pop();

        for(int i = 0; i <= N + 1; i++)
        {
            if(i == to)
                continue;

            if(dist[i] > dist[to] + precalcDist[i][to])
            {
                dist[i] = dist[to] + precalcDist[i][to];
                if(!inQueue[i])
                {
                    inQueue[i] = true;
                    q.push(i);
                }
            }
        }
    }
}

int main()
{
    int u, v, w;

    cin >> x1 >> y1 >> x2 >> y2 ;
    vbar.push_back(barrier{x1, y1, 0});
    vbar.push_back(barrier{x2, y2, 0});

    cin >> N ;
    for(int i = 1; i <= N; i++)
        cin >> u >> v >> w, vbar.push_back(barrier{u, v, w});

    for(int i = 0; i <= N + 1; i++)
        for(int j = 0; j < i; j++)
            precalcDist[i][j] = precalcDist[j][i] = getDist(i, j);

    SPFA();

    cout << fixed << setprecision(10) << dist[1] << endl ;

    return 0;
}


Measured memory_bytes: 8192
#include <bits/stdc++.h>
#define show(x) cerr << #x << " = " << x << endl
using namespace std;
using ll = long long;
int main()
{
    int N, K;
    cin >> N >> K;
    vector<ll> a(N);
    for (int i = 0; i < N; i++) { cin >> a[i]; }
    vector<ll> p(N);
    for (int i = 0; i < N; i++) { p[i] = max(a[i], 0LL) + (i == 0 ? 0LL : p[i - 1]); }
    for (int i = 1; i < N; i++) { a[i] += a[i - 1]; }
    const ll P = p[N - 1];
    ll ans = -(1LL << 60);
    auto get = [=](const vector<ll>& v, const int i) { return v[i + K - 1] - (i == 0 ? 0LL : v[i - 1]); };
    for (int i = 0; i + K - 1 < N; i++) {
        ans = max(ans, P - get(p, i));
        ans = max(ans, P - get(p, i) + get(a, i));
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1792
/*
god taekyu
*/

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;

int n;
int x;
int A[105];
ll sum[105];
int main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin>>n>>x;
    for(int i=1;i<=n;i++) cin>>A[i];
    sort(A+1,A+n+1);
    for(int i=1;i<=n;i++) {
        sum[i] = sum[i-1] + A[i];
    }
    if(sum[n] == x) {
        cout<<n;
        return 0;
    } else if(sum[n] < x) {
        cout<<n-1;
        return 0;
    }
    for(int i=n-1;i>=0;i--) {
        if(x >= sum[i]) {
            cout<<i;
            return 0;
        }
    }
    return 0;
}

/*
god taekyu
*/


Measured memory_bytes: 256
from fractions import gcd


def lcm(a, b):
    return a * b / gcd(a, b)



MOD = 10 ** 9 + 7

N = int(input())
A = list(map(int, input().split()))


_lcm = 1
for a in A:
    # _lcm = lcm(_lcm, a)
    _lcm = _lcm * a // gcd(_lcm, a)

ans = _lcm * sum([pow(s, MOD - 2, MOD) for s in A]) % MOD

print(int(ans % MOD))


Measured memory_bytes: 6136
#include <stdio.h>

int gcd(int a,int b);
int gcds(int a,int b,int c);

int main(){

	int k,i,j,l;
	long int sum=0;
	
	scanf("%d",&k);

	for(i=1;i<=k;i++){
		for(j=1;j<=k;j++){
			for(l=1;l<=k;l++){
				sum+=gcds(i,j,l);
			}
		}
	}
	printf("%ld\n",sum);
	return 0;
}

int gcds(int a,int b,int c){
	int gcd_ab,gcd_abc;
	gcd_ab=gcd(a,b);
	gcd_abc=gcd(gcd_ab,c);
	return gcd_abc;
}

int gcd(int a,int b){
	int tmp,r;
	if(a<b){
   	 tmp = a;
   	 a = b;
   	 b = tmp;
  }

  r = a % b;
  while(r!=0){
    a = b;
    b = r;
    r = a % b;
  }

return b;
}

Measured memory_bytes: 1732
#define LOCAL
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rrep(i, n) for(int i=(n-1); i>=0; --i)
#define rep2(i, s, n) for(int i=s; i<(n); ++i)
#define ALL(v) (v).begin(), (v).end()
#define memr(dp, val) memset(dp, val, sizeof(dp))
using namespace std;
typedef long long ll;
static const int INTINF = (INT_MAX >> 1); // 10^9 + 10^7
static const ll LLINF = (LLONG_MAX >> 1);
static const int MAX = 1e5+1;
static const ll MOD = 1e9+7;
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; }
template<typename T>
using min_priority_queue = priority_queue<T, vector<T>, greater<T> >;
string to_string(string s) { return '"' + s + '"'; }
string to_string(bool b) { return b ? "true" : "false"; }
template <size_t N> string to_string(bitset<N> bs) {
  string res;
  for (size_t i = 0; i < N; ++i) res += '0' + bs[i];
  return res;
}
string to_string(vector<bool> v) {
  string res = "{";
  for (bool e : v) res += to_string(e) + ", ";
  return res += "}";
}
template <class T, class U> string to_string(pair<T, U> p);
template <class C> string to_string(C c) {
  string res = "{";
  for (auto e : c) res += to_string(e) + ", ";
  return res += "}";
}
template <class T, class U> string to_string(pair<T, U> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
void debug() { cerr << '\n'; }
template <class Head, class... Tail> void debug(Head head, Tail... tail) {
  cerr << '\t' << to_string(head), debug(tail...);
}
#ifdef LOCAL
#define print(...) cerr << "[" << #__VA_ARGS__ << "]:", debug(__VA_ARGS__)
#else
#define print(...)
#endif

int main(int argc, const char * argv[]) {
	std::cout << std::fixed << std::setprecision(15);

	int a, b; cin >> a >> b;

	int c = a * b;

	cout << c << endl;



	return 0;
}


Measured memory_bytes: 3644
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <stack>
#include <queue>
#include <tuple>
#include <cassert>
#include <functional>
#include <set>
#include <deque>
using namespace std;
typedef long long ll;
int dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};
const int INF = 1<<29;
#define LNF __LONG_LONG_MAX__
const ll MOD = 1000000007;
const int MAX = 200000;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
// 法mでのaの逆元を計算
long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
// a^n mod を計算する
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
//最大公約数
int gcd(int x, int y) { return (x % y)? gcd(y, x % y): y; }
//最小公倍数
int lcm(int x, int y) { return x / gcd(x, y) * y; }
// nが大きく,kが10^7程度の時の二項係数
long long com[200005];
void combination(long long n,long long k){
    com[0] = 1;
    for(int i=1;i<=k;i++){
        com[i] = (com[i-1]*(n-i+1)%MOD)*modinv(i,MOD)%MOD;
    }
}

int main(){
    int N; cin >> N; 
    int L; cin >> L;
    vector<string> S(N);
    for(int i=0;i<N;i++){
        cin >> S[i];
    }
    sort(S.begin(),S.end());
    for(int i=0;i<N;i++){
        cout << S[i];
    }
    cout << "\n";
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    int i,n,j;
    cin>>n;
    int arr[n];
    for(i=0;i<n;i++)
    {
        cin>>arr[i];

    }
    ll sum;
    sum=0;
    for(i=0;i<n;i++)
    {
        for(j=i+1;j<n;j++)
        {
            sum+=arr[i]*arr[j];
        }
    }
    cout<<sum<<endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#include <queue>
#include <map>
 
using namespace std;
typedef long long int ll;
typedef pair <int,int> pii;
typedef pair<ll,ll> pll;
 
 
/*bool compare_function(const pair<int, int> a, const pair<int, int> b)
{
    return a.first < b.first;
}*/
// use case
//sort(V.begin(), V.end(), compare_function);
 
/*struct compare
{
    bool operator ()(const pair<int, int> &a, const pair<int, int> &b) {
    if (a.second-a.first==b.second-b.first)
    {
        return a.first>b.first;
    }
    return a.second-a.first < b.second-b.first;}
};
priority_queue <pair<int,int>, vector <pair<int,int>>, compare> Q;*/
 
/*void print1(vector <int> X)
{
    for (int i=0; i<X.size(); i++)
    {
        cout<<X[i]<<" ";
    }
    cout<<endl;
    return;
}
 
void print2(vector <vector <int>> X)
{
    for (int i=0; i<X.size(); i++)
    {
    for (int j=0;j<X[i].size();j++) {
        cout<<X[i][j]<<" ";}
    cout<<endl;}
    return;
}*/

 
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
	int a;
	cin>>a;
	if (a>=30) {cout<<"Yes"<<endl;} 
	else {cout<<"No"<<endl;}
    return 0;
}


Measured memory_bytes: 3648
#include<algorithm>
#include<bits/allocator.h>
#include<bits/basic_ios.h>
#include<bits/basic_string.h>
#include<bits/basic_string.tcc>
#include<bits/c++config.h>
#include<bits/char_traits.h>
#include<bits/cpp_type_traits.h>
#include<bits/cxxabi_forced.h>
#include<bits/ios_base.h>
#include<bits/locale_classes.h>
#include<bits/localefwd.h>
#include<bits/ostream_insert.h>
#include<bits/postypes.h>
#include<bits/range_access.h>
#include<bits/stl_algobase.h>
#include<bits/stl_function.h>
#include<bits/stl_iterator.h>
#include<bits/stl_iterator_base_funcs.h>
#include<bits/stl_iterator_base_types.h>
#include<bits/stringfwd.h>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cctype>
#include<cerrno>
#include<cfloat>
#include<ciso646>
#include<climits>
#include<clocale>
#include<cmath>
#include<complex>
#include<csetjmp>
#include<csignal>
#include<cstdarg>
#include<cstddef>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<cwchar>
#include<cwchar>
#include<cwctype>
#include<debug/debug.h>
#include<deque>
#include<exception>
#include<ext/atomicity.h>
#include<ext/numeric_traits.h>
#include<fstream>
#include<functional>
#include<iomanip>
#include<ios>
#include<iosfwd>
#include<iostream>
#include<istream>
#include<limits>
#include<list>
#include<locale>
#include<map>
#include<new>
#include<numeric>
#include<ostream>
#include<queue>
#include<set>
#include<sstream>
#include<stack>
#include<stdexcept>
#include<streambuf>
#include<string>
#include<utility>
#include<valarray>
#include<vector>
using namespace std;
int main()
{
	int a,b;
	cin>>a>>b;
	if ((a+b)%2==1)
		cout<<(a+b)/2+1;
	else
		cout<<(a+b)/2;
	return 0;
}

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

int main() {
  int n;
  cin >> n;
  while(n--) {
    double a[4][2];

    for(int i=0; i<4; i++) cin >> a[i][0] >> a[i][1];
    if(abs((a[3][0]-a[2][0])*(a[1][1]-a[0][1])-(a[1][0]-a[0][0])*(a[3][1]-a[2][1]))<1e-10) cout << "YES" << endl;
    else cout << "NO" << endl;
  }
  return 0;
}


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

long d[310][310];
bool deleted[310][310];
int n;

void warshall_floyd(){
  for(int k = 0;k < n;k++){
    for(int i = 0;i < n;i++){
      for(int j = i+1;j < n;j++){
        if(i == k || j == k) continue;
        if(d[i][j] >= d[i][k] + d[k][j]){
          d[i][j] = d[i][k] + d[k][j];
          deleted[i][j] = true;
        }
      }
    }
  }
  return;
}

int main(){
  cin >> n;
  long a[n][n];
  for(int i = 0;i < n;i++){
    for(int j = 0;j < n;j++){
      cin >> d[i][j];
      a[i][j] = d[i][j];
      deleted[i][j] = false;
    }
  }
  warshall_floyd();
  bool ok = true;
  for(int i = 0;i < n;i++){
    for(int j = 0;j < n;j++){
      if(a[i][j] != d[i][j]){
        ok = false;
      }
    }
  }
  long ans = 0;
  if(ok == false){
    ans = -1;
  }
  else{
    for(int i = 0;i < n;i++){
      for(int j = 0;j < n;j++){
        if(deleted[i][j] == true){
          a[i][j] = 0;
        }
      }
    }
    for(int i = 0;i < n;i++){
      for(int j = i+1;j < n;j++){
        ans += a[i][j];
      }
    }
  }
  cout << ans << endl;
}

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

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

    int a[n];

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

    for(int i=n-1; i>=0; i--){
	if(i>0) cout << a[i] << ' ' << flush;
	else if(i==0) cout << a[i] << endl;
    }
}

Measured memory_bytes: 3068
#include<stdio.h>
#define N 3

int dx[4]={0,1,0,-1};
int dy[4]={1,0,-1,0};
int count;
int A[N][N];

int abs(int a){
  if(a > 0) return a;
  else return a*-1;
}

void swap(int *x,int *y){
  int tmp=*x;
  *x=*y;
  *y=tmp;
  return ;
}

int Heuristic(){
  int i,j,sum = 0,x;
  for(i=0;i<N;i++){
    for(j=0;j<N;j++){
    if(A[i][j]==0)continue;
    x = A[i][j] - 1;
    sum+=abs(x/N - i)+abs(x%N - j);
    }
  }
  return sum;
}

int move(int d,int pre,int s,int t){
  int i,x,y,h = Heuristic();
  if(h==0)return 1;
  if(d+h > count)return 0;
  for(i=0;i<4;i++){
    if(abs(i - pre)==2)continue;/*return move*/

    x = s + dy[i];
    y = t + dx[i];

    if(x<0||y<0||x>=N||y>=N)continue;/*frame over*/

    swap(&A[x][y],&A[s][t]);
    if(move(d+1,i,x,y))return 1;
    swap(&A[x][y],&A[s][t]);/*return move because next move's starat is same this one */
  }
  return 0;
}

void counter(int s,int t){
  count = 0;
  while(1){
    if(move(0,10,s,t)){
      printf("%d\n",count);
      return ;
    }
    count++;
  }
}

int main(){
  int i,j,s,t;
  for(i=0;i<N;i++){
    for(j=0;j<N;j++){
      scanf("%d",&A[i][j]);
      if(A[i][j]==0){
        s = i;
        t = j;
      }
    }
  }
  counter(s,t);
  return 0;
}



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

using namespace std;
typedef long long ll;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vd = vector<double>;
using vvd = vector<vd>;

#define out(a) cout << a << endl
#define out1(a) cout << a
#define in(a) cin >> a
#define in2(a, b) cin >> a >> b
#define in3(a, b, c) cin >> a >> b >> c
#define rep(i, N) for (ll i = 0; i < (ll)N; i++)
#define rep1(i, N) for (ll i = 1; i <= (ll)N; i++)
#define repi(i, j, N) for (ll j = (ll)i + 1; j < (ll)N; j++)
#define all(v) v.begin(), v.end()

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

constexpr int inf = 1e9;
constexpr ll linf = 1e18;
constexpr ll mod = 1e9 + 7;

void solve();

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

void solve()
{
    int n;
    in(n);
    out((n + 1) / 2);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ALL(v) v.begin(), v.end()
#define MOD 1000000007
#define INF 1000000007
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define req(i, j, n) for(int i = j; i <= (int)(n); i++)
using namespace std;
typedef long long ll;
typedef pair<string, int> P;

int main() {
int n;
  cin>>n;
pair<pair<string, int>, int> P[n];
  
  for(int i=0;i<=n-1;i++){
    string s;
    cin>>s;
    int a;
    cin>>a;
    a*=-1;
    P[i]=make_pair(make_pair(s, a), i+1);
  }
  sort(P, P+n);
  for(int i=0;i<=n-1;i++){
    cout<<P[i].second<<endl;}
  return 0;
    


}

Measured memory_bytes: 256
#include <iostream>
#include <string>
//#include <algorithm>
#include <vector>

using namespace std;

int main(){
    int c[9];
    for (int i = 0; i < 9; i++){
        cin >> c[i];
    }
    int l1,l2,l3,l4,l5,l6;
    l1 = c[0] + c[1] + c[2];
    l2 = c[3] + c[4] + c[5];
    l3 = c[6] + c[7] + c[8];
    l4 = c[0] + c[3] + c[6];
    l5 = c[1] + c[4] + c[7];
    l6 = c[2] + c[5] + c[8];
    if((l1-l2) % 3 != 0 or (l2-l3) % 3 != 0 or (l3-l1) % 3 != 0){
        //printf("Horizontal\n");
        cout << "No" << endl;
    }else if ((l4-l5) % 3 != 0 or (l5-l6) % 3 != 0 or (l6-l4) % 3 != 0){
        //printf("Vertical\n");
        cout << "No" << endl;
    }else{
        cout << "Yes" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>

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

using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define P pair<ll, ll>
#define sz(x) (ll)x.size()
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define VE vector<ll>
#define COUT(x) cout<<(x)<<endl
#define MA map<ll,ll>
#define SE set<ll>
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,VE,greater<ll>>
#define COUT(x) cout<<(x)<<endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define EPS (1e-10)
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
bool prime(ll n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}


const long long MOD = 1000000007;
const long long INF = 1e16;
#define int long long

const int MAX_N = 1010;


signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n; cin >> n;
	VE a(n); rep(i, n)cin >> a[i];
	int sum = 0; int sum2 = 0;
	rep(i, n)sum += a[i];
	int ans = INF;
	rep(i, n) {
		if(i != 0)chmin(ans, abs(sum - sum2));
		sum -= a[i]; sum2 += a[i];
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 1792
n, d = gets.chomp.split.map(&:to_i)
matrix = n.times.map { gets.chomp.split.map(&:to_i) }

count = 0
matrix.combination(2).each do |x|
  square_sum = d.times.inject(0) { |sum, i| sum + (x[0][i] - x[1][i])**2 }
  count += 1 if Math.sqrt(square_sum) % 1 == 0
end

puts count


Measured memory_bytes: 1788
#include <iostream>
#include <unordered_map>
#include <vector>
#include <set>
#include <string.h>
#include <algorithm>
#define mod 1000000007
#define ll long long
#define pr pair<int,int>
#define all vec.begin(),vec.end()
#define REP(i,a,b) for (int i = a; i < b; i++)
#define fi first
#define se second
#define pushb push_back
#define makep make_pair

using namespace std;

int main(){
	ll n,W;
	cin >> n >> W;
	int k = 0; 
	ll w[n];
	ll v[n];
	while(cin >> w[k] >> v[k])
		k++;
	unordered_map<ll, ll> dp;
	dp[0] = 0;
	ll res = 0;
	for(int i = 0; i < n; i++){
		auto dup = dp;
		for(auto el : dup){
			ll x = el.first + w[i];
			ll y = el.second + v[i];
			if(x <= W) res = max(res, dp[x] = max(dp[x], y));
		}
	}
	cout << res;
	return 0;
	
}



Measured memory_bytes: 512
package main

import "fmt"

func main() {

	var a string
	fmt.Scan(&a)

	result := "Good"
	for i := 0; i < len(a)-1; i++ {
		if a[i] == a[i+1] {
			result = "Bad"
			break
		}
	}
	fmt.Println(result)
}


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

int main() {

  long long K,sum=0;
  cin >> K;

  for(long long i=1;i<K+1;i++){
    for(long long j=1;j<K+1;j++){
      for(long long l=1;l<K+1;l++){
        sum += __gcd(__gcd(i,j),l);
      }
    }
  }

  cout << sum << endl;
}


Measured memory_bytes: 3632
#include <iostream>
#include <cstring>
#include <cmath>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
#include <sstream>
#include <stack>
#include <deque>
using namespace std;
#define ll long long
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define pi pair<int,int>
#define pii pair<pi,int>
#define sqr(x) ((x)*(x))
#define FOR for(int i=0;i<n;i++)for(int j=0;j<m;j++)
const int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);cout.tie(0);
	int a,b;
	cin>>a>>b;
	if(a==2||b==2)puts("No"); 
	else puts("Yes");
   // system("pause");
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n;
	int f=0;
	cin>>n;
	if(n>81) cout<<"No";
	else{
		int a[36]={1,2,3,4,5,6,7,8,9,10,12,14,16,18,15,21,24,27,20,28,32,36,25,30,35,40,45,42,48,54,63,56,49,72,64,81};
		for(int i=0;i<36;++i){
			if(a[i]==n){ f=1;cout<<"Yes";return 0; }
		}
		if(f==0){
			cout<<"No";
			return 0;
		}
	}
} 

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

using ll = long long;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define ddrep(i, n) for (int i = n; i > 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define ssrep(i, s, t) for (int i = s; i <= t; ++i)

#define rng(a) a.begin(), a.end()
#define rrng(a) a.rbegin(), a.rend()
#define pb push_back
#define eb emplace_back
#define fi first
#define se second

#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))

using pi = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using ld = long double;

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}

template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "{";
  rep(i, (int)v.size()) {
    if (i)
      os << ",";
    os << v[i];
  }
  os << "}";
  return os;
}

template <typename T, size_t S> void printArray(const T (&array)[S]) {
  for (auto val : array)
    std::cout << val << ", ";
  std::cout << "\n";
}

const int mod = 1e9 + 7;
const int inf = 1e9 + 5;

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

  int x, a, b; std::cin >> x >> a >> b;
  x -= a;
  std::cout << x - x / b * b << "\n";
}


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

using namespace std;

int main(){
    string S;
    cin >> S;
    deque<char> T = {};
    for (const auto &s: S)
        T.push_back(s);
    int Q;
    cin >> Q;
    bool r = false;
    for (int q = 0; q < Q; q++){
        int p;
        cin >> p;
        if (p == 1){
            r = r ^ 1;
        } else {
            int f;
            char c;
            cin >> f >> c;
            f--;
            f ^= r;
            if (f){
                T.push_back(c);
            } else {
                T.push_front(c);
            }
        }
    }

    if (r)
        reverse(T.begin(), T.end());
    
    for (const auto &t: T)
        cout << t;
    cout << endl;
}

Measured memory_bytes: 896
#include<algorithm>
#include<cassert>
#include<climits>
#include<cmath>
#include<cstring>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>

using namespace std;

using lint = long long;
using P = pair<int, int>;
using LLP = pair<long long, long long>;

#define REP(i, x, n) for(int i = (x), i##_len = int(n) ; i < i##_len ; ++i)
#define rep(i, n) for(int i = 0, i##_len = int(n) ; i < i##_len ; ++i)
#define reps(i, n) for(int i = 1, i##_len = int(n) ; i <= i##_len ; ++i)
#define rrep(i, n) for(int i = int(n) - 1 ; i >= 0 ; --i)
#define rreps(i, n) for(int i = int(n) ; i > 0 ; --i)
#define SORT(x) sort((x).begin(), (x).end())
#define SORT_INV(x) sort((x).rbegin(), (x).rend())
#define TWINS(x) cout << ((x) ? "Yay!" : ":(") << endl

constexpr int IINF = (1 << 30) - 1;
constexpr long long LLINF = 1LL << 61;
constexpr double EPS = 1e-8;

const int dx4[] = {1, 0, -1, 0}, dy4[] = {0, 1, 0, -1};
const int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};

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

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

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

    int n;
    cin >> n;

    vector< vector<bool> > ans(n, vector<bool>(n, false));
    rep(i, n){
        int u, k;
        cin >> u >> k;
        --u;
        rep(j, k){
            int v;
            cin >> v;
            ans[u][--v] = true;
        }
    }

    rep(i, n){
        rep(j, n){
            if(j) cout << ' ';
            cout << ans[i][j];
        }
        cout << endl;
    }

    return 0;
}


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

int N,C;

const int MAX = 31;
int A[MAX],B[MAX];
int dp[MAX][1 << 16];

void input(){
  for(int i = 0 ; i < N ; i++){
    A[i] = 0;
    for(int j = 0 ; j < 16 ; j++){
      int tmp;
      cin >> tmp;
      if(tmp)A[i] |= (1 << j);
    }
  }
  for(int i = 0 ; i < C ; i++){
    B[i] = 0;
    for(int j = 0 ; j < 16 ; j++){
      int tmp;
      cin >> tmp;
      if(tmp)B[i] |= (1 << j);
    }
  }
}

int getScore(int a,int b){
  return __builtin_popcount(a&b);
}

void solve(){
  input();

  for(int i = 0 ; i < MAX ; i++){
    for(int j = 0 ; j < (1 << 16) ; j++){
      dp[i][j] = -1;
    }
  }

  dp[0][0] = 0;

  int res = 0;
  for(int i = 0 ; i < N ; i++){
    for(int bit = 0 ; bit < (1 << 16) ; bit++){
      if(dp[i][bit] < 0)continue;
      for(int j = 0 ; j < C ; j++){
	int nbit = (bit|A[i]) & (~((bit|A[i])&B[j]));
	dp[i+1][nbit] = max(dp[i+1][nbit],dp[i][bit] + getScore((bit|A[i]),B[j]));
	res = max(res,dp[i+1][nbit]);
      }
    }
  }
  cout << res << endl;
}

int main(){
  while(cin >> N >> C,N && C){
    solve();
  }
  return 0;
}

Measured memory_bytes: 9100
package main

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

var sc = bufio.NewScanner(os.Stdin)

func main() {
	sc.Split(bufio.ScanWords)
	T := readInt()
	X := readInt()
	a := float64(T) / float64(X)
	fmt.Println(a)
}

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

func readInt() int {
	i, e := strconv.Atoi(read())
	if e != nil {
		panic(e)
	}
	return i
}


Measured memory_bytes: 640
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<string>
#include<utility>
#include<chrono>
#include<random>
#include<cstdio>
#include<set>
#include<map>
#include<numeric>
#include<cfenv>
#include<cmath>
#define MAX_N pow(10,6)
#define MAX_M pow(10,6)
#define INF pow(10,6)
#define REP(i,n) for(long long i=0;i<n;i++)
typedef long long ll;
using namespace std;
vector<ll>h(MAX_N);
vector<bool>seen(MAX_N);
vector<vector<ll>>miti(MAX_N,vector<ll>(2));
using Graph = vector<vector<int>>;
Graph G(MAX_N);
ll ans=0;

int main(){
    
    ll n,k;
    cin>>n>>k;
    vector<bool>h(n);
    REP(i,n){
        h[i]=1;
    }
    REP(i,k){
        ll a;
        cin>>a;
        REP(j,a){
            ll b;
            cin>>b;
            b--;
            h[b]=0;
        }
    }
    ll sum=0;
    REP(i,n){
        sum+=h[i];
    }
    cout<<sum;
}


Measured memory_bytes: 89096
#include<stdio.h>
int main(){
	int cs, ang, max=-1000000, min=1000001;
	long long int sum=0;
	scanf("%d", &cs);
	for(int i=0; i<cs; i++){
		scanf("%d",  &ang);
		if(max<ang)max=ang;
		if(min>ang)min=ang;
		sum = sum + ang;
	}
	printf("%d %d %lld\n", min, max, sum);
}


Measured memory_bytes: 2760
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

L = INT()
print((L/3)**3)

Measured memory_bytes: 5144
#include  <iostream>

using namespace std;

int main()
{
	int a, b;

	cin >> a >> b;

	if (a <= 5)
		cout << 0 << endl;
	else if (a >= 6 && a <= 12)
		cout << b / 2 << endl;
	else
		cout << b << endl;
}

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

using namespace std;

int main()
{
    int X, N; 
    vector<int> p;

    cin >> X >> N;

    if(N == 0)
    {
        cout << X << endl;
        return 0;    
    }
    
    // N >= 1 のとき    
    p.resize(N);
    for(int i = 0; i < N; ++i)
    {
        cin >> p[i];
    }

    // p のあると頃にフラグ
    vector<int> flag(101, 0);
    for(int i = 0; i < N; ++i)
    {
        flag[p[i]] = 1;
    }
    
    // X 以下でフラグのない整数の最大値
    int min_i = 0;
    for(int i = 1; i <= X; ++i)
    {
        if(flag[i] != 1)
        {
            min_i = i;    
        }
    }
    int dist_min_i = X - min_i;

    // X 異常でフラグのない整数の最小値
    int max_i = 101;
    for(int i = X; i <= 100; ++i)
    {
        if(flag[i] != 1)
        {
            max_i = i;
            break;    
        }
    }

    int dist_max_i = max_i - X;

    if(dist_max_i < dist_min_i)
    {
        cout << max_i << endl;    
    }
    else
    {
        cout << min_i << endl;    
    }


    return 0;    
}

Measured memory_bytes: 3580
N,M = map(int,input().split())
L = []
for _ in range(N):
    l = list(map(int,input().split()))
    L.append(l)
cand = []
for bit in range(8):
    plus_minus = [1,1,1]
    for  b in range(3):
        if bit & (1 << b):
            plus_minus[b] = -1
    L = sorted(L, key = lambda x:x[0]*plus_minus[0]+x[1]*plus_minus[1]+x[2]*plus_minus[2])
    tmp = 0
    for i in range(M):
        for j in range(3):
            tmp += L[i][j] * plus_minus[j]
    cand.append(tmp)

print(max(abs(min(cand)),max(cand)))




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

N = int(input())
S = [input() for i in range(N)]

ans = sum([s.count('AB') for s in S])
count_A = 0
count_B = 0
count_AB = 0
for s in S:
    if s[0] == 'B':
        count_B += 1
        if s[-1] == 'A':
            count_AB += 1
    if s[-1] == 'A':
        count_A += 1

if max(count_A, count_B) != 0 and max(count_A, count_B) == count_AB:
    ans += count_AB-1
else:
    ans += min(count_A, count_B)

print(ans)


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

long long odd_xor_sum(long long n){
    return ((n + 1) / 2) % 2;
}

long long xor_sum(long long n){
    if(n % 2 == 1) return odd_xor_sum(n);
    else return odd_xor_sum(n + 1) ^ (n + 1);
}

int main(){

    long long A, B;
    cin >> A >> B;

    long long ans = xor_sum(A - 1) ^ xor_sum(B);

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define re(i,n) for(ll i=0;i<(n);++i)
#define itn int
#define ocut cout
#define ouct cout
#define outc cout

int main(){
    int a,b;
    cin >> a >> b;
    if(a==b){
        cout << "Yes";
    }
    else{
        cout << "No";
    }
}



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

using namespace std;

int main(){

	int i = 0;
	int N;
	int can[2][101] = { 0 };
	int sum = 0;
	int ans = 0;
	int kouho = 0;

	cin >> N;
	for (int j = 0; j < 2; j++) {
		for (int i = 1; i <= N; i++) {
			cin >> can[j][i];
		}
	}

	for (int i = 1; i <= N; i++) {     //上段はiまで
		kouho = 0;
		for (int k = 1; k <= i; k++) {
			kouho += can[0][k];
		}
		for (int l = i + 1; l <= N; l++) {
			kouho += can[1][l];
		}
		ans = max(ans, kouho+can[1][i]);
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include<vector>
#include<algorithm>
#include<map>
#include<queue>
#include<cmath>
#include<set>
#include<deque>
using namespace std;
typedef long long ll;

typedef pair<int, int> pii;

const ll MOD_CONST = 1000000007;


const int INF = 1000000000;
const ll BIG_NUM = 1000000000000000000;



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

	int n1 = (n - 1) / 2;
	for (int i = 0; i < n1; i++) {
		if (s[i] != s[n1 - 1 - i]) {
			cout << "No" << endl;
			return 0;
		}
	}

	int n2 = (n + 1) / 2;
	for (int i = n2; i < n; i++) {
		if (s[i] != s[n - 1 - i]) {
			cout << "No" << endl;
			return 0;
		}
	}

	cout << "Yes" << endl;


}




Measured memory_bytes: 256
import java.util.*;

public class Main {

    static long[][] cmemo = new long[2001][2001];
    private static long mod = 1000000007;

    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int blue = sc.nextInt();

        int red = n-blue;
        for(int i = 1;i <= blue;i++){
            long ans = 0;
            if(i == 1 && red == 0){
                System.out.println(1);
                continue;
            }
            ans += combination(blue-1,i-1) * combination(red-1,i-2) % mod;
            ans += combination(blue-1,i-1) * combination(red-1,i-1) * 2 % mod;
            ans += combination(blue-1,i-1) * combination(red-1,i) % mod;
            System.out.println(ans % mod);
        }
    }

    private static long combination(int n, int k){
        if(n < 0){
            return 0;
        }
        if(k < 0 || n < k){
            return 0;
        }
        if(cmemo[n][k] == 0){
            long ans = 1;
            for(int i = 0;i < k;i++){
                ans = (ans * (n-i)) % mod;
            }
            long r = 1;
            for(int i = k;i > 0;i--){
                r = (r * i) % mod;
            }
            cmemo[n][k] = (ans * modinv(r, mod)) % mod;
        }
        return cmemo[n][k];
    }

    private static long modinv(long num, long mod){
        long result = 1;
        long n = mod - 2;
        BitSet bs = BitSet.valueOf(new long[]{n});
        for(int i = 0;i < bs.size();i++){
            if(bs.get(i)){
                result = result * num % mod;
            }
            num = num * num % mod;
        }
        return result;
    }
}



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

int main() {
    int n;
    cin >> n;
    vector<int> l(2 * n);
    for(int i = 0; i < 2 * n; i++) cin >> l.at(i);
    
    sort(l.begin(), l.end());
    int ans = 0;
    for(int i = 0; i < 2 * n; i += 2) {
        ans += l.at(i);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
int main(){
while(1){int n,m,i,j,a,b,x[501]={},c[501][501]={},num[501]={},sum=0;
scanf("%d%d",&n,&m); if(n==0) break; for(i=1;i<=m;i++){scanf("%d %d",&a,&b); if(a==1){
num[b]++;}c[a][b]=1;c[b][a]=1;
}for(i=1;i<=n;i++){for(j=1;j<=n;j++){
if(c[1][i]==1 && c[i][j]==1){num[j]++;}}}
for(i=2;i<=n;i++)
{if(num[i]!=0) sum++;}
printf("%d\n",sum);}return 0;}

Measured memory_bytes: 1592