akhauriyash/Code-Regression huggingface dataset:
#include  <iostream>
#include  <stdio.h>
#include <algorithm>
using namespace std;
//#include <vector>
//#include <stack>
//#include <queue>

/*
#include <math.h>
int standerd = int(pow(10.0,9.0)) + 7;
*/
string ans_Yes = "Yes"; 
string ans_No = "No"; 
string ans_yes = "yes"; 
string ans_no = "no"; 
 

int main(){

    int A;
    cin >> A;

    if(A<1200){
        cout << "ABC";
    }else if(A<2800){
        cout << "ARC";
    }else{
        cout << "AGC";
    }
   

}

Measured memory_bytes: 256
from bisect import bisect_right
A, B, Q = map(int, input().split())
INF = float('inf')
S = [-INF] + [int(input()) for _ in range(A)] + [INF]
T = [-INF] + [int(input()) for _ in range(B)] + [INF]
X = [int(input()) for _ in range(Q)]
for x in X:
    b, d =  bisect_right(S, x), bisect_right(T, x)
    ans = INF
    for s in [S[b - 1], S[b]]:
        for t in [T[d - 1], T[d]]:
            d1, d2 = abs(s - x) + abs(s - t), abs(t - x) + abs(s - t)
            ans = min(ans, d1, d2)
    print(ans)

Measured memory_bytes: 17356
from sys import stdin

n, k = map(int, stdin.readline().rstrip().split())
a = map(int, stdin.readline().rstrip().split())

a = list(a) 
count = 0 
for i in range(1, n):
    for j in range(i):
        if a[j] > a[i]:
            count += 1
import copy
b = copy.copy(a)
b.sort()
count *= k
import bisect
ans2 = 0
for i in range(n):
  ans2 += bisect.bisect_left(b, a[i])
print((count + ans2 * (((k-1)* k)//2))%(1000000007)) 

Measured memory_bytes: 3572
n = int(input())
p = [int(num) for num in input().split()]

flag = []
for i in range(n):
    flag.append(False)

for i in range(n):
    if p[i] == i + 1:
        flag[i] = True

count = 0
i = 0
while i < n:
    if flag[i]:
        count += 1
        i += 1
    i += 1

print(count)

Measured memory_bytes: 13880
#include <bits/stdc++.h>
#include <string>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <numeric>
using namespace std;


int main(){
  int A,B;
  cin >> A >> B;
  if(A >= 9 || B >= 9){
    cout << ":(" << endl;
  }
  else{
    cout << "Yay!" << endl;
  }
}

Measured memory_bytes: 256
#[allow(unused_imports)]
use std::cmp::max;
use std::io;

fn main() {
    let input = input_number();
    let n = input[0] as usize;
    let w = input[1] as usize;
    let input = (0..n).map(|_| input_number()).collect::<Vec<Vec<i64>>>();
    let ws: Vec<i64> = input.iter().map(|x| x[0]).collect();
    let vs: Vec<i64> = input.iter().map(|x| x[1]).collect();

    let max_v = 100100usize;

    let mut dp = vec![vec![1000000100; max_v]; 110];
    dp[0][0] = 0;

    for i in 0..n {
        for j in 0..max_v {
            if j >= vs[i] as usize {
                let on_the_left = dp[i][j - vs[i] as usize] + ws[i];
                let target = &mut dp[i + 1][j];
                update_min(target, on_the_left);
            }
            let upper = dp[i][j];
            let target = &mut dp[i + 1][j];
            update_min(target, upper);
        }
    }

    let mut res = 0usize;
    for j in 0..max_v {
        if dp[n][j] <= w as i64 {
            res = j
        }
    }
    println!("{}", res);
}

#[allow(dead_code)]
fn update_max<T>(left: &mut T, right: T)
where
    T: std::cmp::Ord + std::clone::Clone,
{
    if *left < right {
        *left = right.clone();
    }
}

#[allow(dead_code)]
fn update_min<T>(left: &mut T, right: T)
where
    T: std::cmp::Ord + std::clone::Clone,
{
    if *left > right {
        *left = right.clone();
    }
}

#[allow(dead_code)]
fn input_number() -> Vec<i64> {
    let mut input = String::new();
    io::stdin()
        .read_line(&mut input)
        .expect("Failed to read line");
    let vec: Vec<i64> = input
        .split_whitespace()
        .map(|x| x.parse().unwrap_or(0))
        .collect();
    vec
}

#[allow(dead_code)]
fn input() -> (char, usize) {
    let mut s = String::new();
    io::stdin().read_line(&mut s).expect("");
    let mut iter = s.trim().split_whitespace();
    let c: char = iter.next().unwrap().chars().nth(0).unwrap();
    let n: usize = iter.next().unwrap().parse().unwrap();
    (c, n)
}


Measured memory_bytes: 117116
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Programminng
{
    class AOJ_Volume0035
    {
        public static void Main(string[] args)
        {
            double[] a = new double[8];
            while (true)
            {
                string s = Console.ReadLine();
                if (string.IsNullOrEmpty(s)) break;

                string[] _s = s.Split(',');
                for (int i = 0; i < 8; i++)
                {
                    a[i] = double.Parse(_s[i]);
                }

                if(isCross(a[0],a[1],a[4],a[5],a[2],a[3],a[6],a[7]) > 0.0 || isCross(a[2],a[3],a[6],a[7],a[0],a[1],a[4],a[5]) > 0.0)
                {
				    Console.WriteLine("NO");
			    }
                else
                {
                    Console.WriteLine("YES");    
			    }
            }
        }

        private static double isCross(double p1_x, double p1_y, double p2_x, double p2_y, double p3_x, double p3_y, double p4_x, double p4_y)
        {
            return ((p1_x - p2_x) * (p3_y - p1_y) + (p1_y - p2_y) * (p1_x - p3_x)) * ((p1_x - p2_x) * (p4_y - p1_y) + (p1_y - p2_y) * (p1_x - p4_x));
        }
    }
}

Measured memory_bytes: 5740
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    int c = sc.nextInt();
    int d = sc.nextInt();
    int e = sc.nextInt();
    if (a == 0) 
      System.out.println("1");
    if (b == 0) 
      System.out.println("2");
    if (c == 0) 
      System.out.println("3");
    if (d == 0) 
      System.out.println("4");
    if (e == 0) 
      System.out.println("5");
  }
}

Measured memory_bytes: 35476
#include <iostream>
#include<string>
using namespace std;
int main() {
    string s, t;
    cin>>s;
    cin>>t;
    int count=0;
    for(int i=0; i<t.size(); i++){
        if(t[i]==s[i]){
            continue;
        }
        else{
            count++;
        }
        
    }
    cout<<count;
    return 0;


}


Measured memory_bytes: 3916
using System;

class MyClass
{
    static string Repeat(string str, int repeat)
    {
        string str2 = "";
        for (int i = 0; i < repeat; i++)
        {
            str2 += str;
        }
        return str2;
    }

    static void Main(string[] args)
    {
        string str;
        while ((str = Console.ReadLine()) != "0 0")
        {
            int h = int.Parse(str.Split(' ')[0]);
            int w = int.Parse(str.Split(' ')[1]);
            for (int i = 0; i < h; i++)
            {
                if (i == 0 || i == h - 1)
                {
                    Console.WriteLine(Repeat("#", w));
                }
                else
                {
                    Console.WriteLine("#" + Repeat(".", w - 2) + "#");
                }
            }
            Console.WriteLine();
        }
    }
}


Measured memory_bytes: 5568
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, n) for (int i = n; i > 1; i--)
#define rep3(i, s, n) for (int i = (s); i < (int)(n); i++)

int main() {
    int n, k;
    cin >> n >> k;
    int a = 1;
    int b, c;

    rep(i, n) {
        b = a * 2;
        c = a + k;
        if (b < c) {
            a = b;
        } else {
            a = c;
        }
    }
    cout << a << endl;
}


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

void print(int C[], char jenisKartu){
	for(int i=1; i<=13; i++){
		if(C[i]==0) printf("%c %d\n", jenisKartu, i);
	}
}

int main(){
	int kartu, temp;
	char jenisKartu;
	int S[14], H[14], C[14], D[14];
	memset(S, 0, sizeof(S));
	memset(H, 0, sizeof(H));
	memset(C, 0, sizeof(C));
	memset(D, 0, sizeof(D));
	scanf("%d", &kartu);
	for(int i=0; i<kartu; i++){
		scanf(" %c", &jenisKartu);
		scanf("%d", &temp);
		if(jenisKartu=='S'){
			S[temp]=1;
		}
		else if(jenisKartu=='H'){
			H[temp]=1;
		}
		else if(jenisKartu=='C'){
			C[temp]=1;
		}
		else if(jenisKartu=='D'){
			D[temp]=1;
		}
	}
	print(S,'S');
	print(H,'H');
	print(C,'C');
	print(D,'D');
}


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

fn main() {
    let a: u32 = read();
    let b: u32 = read();
    let c: u32 = read();
    let x = transfer(b,a,c);
    println!("{}",  c-x);
}

fn transfer(mut left: u32, mut limit:u32, mut from:u32) -> u32{
    let mut x:u32 = 0;
    while from > 0 && left < limit{
        x += 1;
        from -=1 ;
        left += 1;
    }
    return x
}

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

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

using namespace std;

int main(){
	int N,W;
	
	scanf("%d %d",&N,&W);
	
	vector<int> v(N);
	vector<int> w(N);
	vector<int> dp(10001,0);
	
	for(int i=0;i<N;i++){
		scanf("%d %d",&v[i],&w[i]);
	}
	for(int i=0;i<N;i++){
		for(int j=W;j>=w[i];j--){
			dp[j]=max(dp[j],dp[j-w[i]]+v[i]);
		}
	}
	printf("%d\n",*max_element(dp.begin(),dp.begin()+W+1));
}


Measured memory_bytes: 3280
#include <iostream>
#include <climits>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <deque>
#define INF_INT (INT_MAX / 2)
#define INF_LONG (LONG_MAX / 2)
//#define DEBUG true
#define DEBUG false
using namespace std;

typedef long long ll;
typedef pair< int, int > pii;
typedef pair< ll, ll > pll;
typedef pair< ll, int > pli;
typedef pair< int, ll > pil;

int ceil(int x, int y){
  return (x % y == 0) ? x / y : x / y + 1;
}

int gcd(int x, int y){
  return y ? gcd(y, x % y) : x;
}

int lcm(int x, int y){
  return x / gcd(x, y) * y;
}

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

  int n;
  cin >> n;
  vector< string > w(n);
  for(int i = 0; i < n; i++) cin >> w[i];

  bool ans = true;
  for(int i = 1; i < w.size(); i++){
    for(int j = 0; j < i; j++){
      if(w[i] == w[j]){
        ans = false;
        break;
      }
    }
    if(w[i - 1][w[i - 1].length() - 1] != w[i][0]){
      ans = false;
      break;
    }
    if(!ans) break;
  }

  if(ans) cout << "Yes" << endl;
  else cout << "No" << endl;

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
#define rep(i,j,n) for(int i=j;i<n;i++)
int sosuu[100]={11,31,41,61,71,101,131,151,181,191,211,241,251,271,281,311,331,401,421,431,461,491,521,541,571,601,631,641,661,691,701,751,761,811,821,881,911,941,971,991,1021,1031,1051,1061,1091,1151,1171,1181,1201,1231,1291,1301,1321,1361,1381};
int main(){ int n;cin>>n;rep(i,0,n){cout<<sosuu[i]<<" "; }cout<<endl;return 0;}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define endl '\n'

//Constants

//Data

//Methods

int main()
{
  int k, x;
  cin >> k >> x;
  if(k * 500 >= x) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 256
/*
AizuOnline A0056
Title Goldbach's Conjecture

*/
#include <stdio.h>
// Select Below
//#include <stdlib.h>
//#include <string.h>
//#include <float.h>
//#include <math.h>
//#include <limits.h>
//Global data section
int n;
int prime_f[50001];

int prime_table[]={2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,
		   53,59,61,67,71,73,79,83,89,97,
		   101,103,107,109,113,127,131,137,139,149,151,157,163,
		   167,173,179,181,191,193,197,199,211,223};
//
void make_furui()
{
  int i,j,p;

  prime_f[0]=prime_f[1]=0;
  for(i=0;i<=50000;i++)
    prime_f[i]=1;
  for(i=0;i<sizeof(prime_table)/sizeof(int);i++)
    {
      p = prime_table[i];
      prime_f[p]=1;
      for(j=2;prime_table[i]*j<50000;j++)
	prime_f[p*j]=0;
    }
  //printf("*\n");
}
int isprime(int n)
{
  return(prime_f[n]);
}
main()
{
  int i,c;
  make_furui();
  while(EOF != scanf("%d",&n) && n)
    {     
      c=0;
      if(isprime(n-2))
	c=1;
      for(i=3;i<=n/2;i+=2)
	{
	  if(isprime(i) && isprime(n-i))
	    c++;	    
	}
      printf("%d\n",c);
    }
return(0);
}

Measured memory_bytes: 792
#a=input()
K = int(input())
S = input()
#a,b=map(int,input().split(" "))
#a=[int(_) for _ in input().split(" ")]

ans = ""

if K >= len(S):
    ans = S
else:
    for i in range(K):
        ans += S[i]
    ans += "..."

#print(a,b)
print(ans)


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

int main(void){
    int n, d, x;
    cin >> n >> d >> x;

    int ans = x;

    for(int i = 1; i <= n; i++){
        int a;
        cin >> a;

        int cnt = 0;

        for(int j = 0; j < 200; j++){
            if(j * a + 1 <= d){
                cnt++;
            }
            else{
                ans += cnt;
                break;
            }
        }

    }
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
int acs(const void *a, const void *b) { 
  return *(int*)a - *(int*)b;
} /* 1,2,3,4.. */
int des(const void *a, const void *b) {
  return *(int*)b - *(int*)a;
} /* 8,7,6,5.. */
int cmp_char(const void *a, const void *b) { 
  return *(char*)a - *(char*)b;
} /* a,b,c,d.. */
int cmp_str(const void *a, const void *b) {
  return strcmp(*(const char **)a, *(const char **)b);
} /* aaa,aab.. */
#define min(a,b) (a < b ? a : b)
#define max(a,b) (a > b ? a : b)
#define rep(i, l, r) for (int i = l; i < r; i++)
#define MAX 100001
#define MOD 1000000007
#define INF 1000000009
typedef long long int lli;

int main(void) {
  lli a, b, c, d;
  scanf("%lld %lld %lld %lld", &a, &b, &c, &d);

  printf("%lld\n", max(max(a * c, a * d),max(b * c, b * d)));
  return 0;
}


Measured memory_bytes: 1728
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#ifdef __GXX_EXPERIMENTAL_CXX0X__
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#ifdef __GXX_EXPERIMENTAL_CXX0X__
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif

using namespace std;

int main ()
{
	string str;
	bool f = 0;
	set<int>data2 , data3;
	vector<int>data;
	data.resize ( 10001 );
	while( getline ( cin , str ) )
	{
		if( str == "" )
		{
			f = 1;
		} else
		{
			stringstream ss;
			ss << str;
			int a , b;
			char c;
			ss >> a >> c >> b;
			if( !f )data2.insert ( a );
			else if( data2.find ( a ) != data2.end () )
			{
				data3.insert ( a );
			}
			data[a]++;
		}
	}
	for( auto x : data3 )
	{
		cout << x << " " << data[x] << endl;
	}
	return 0;
}

Measured memory_bytes: 1272
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Prac
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.ReadLine();
            List<int> ai = new List<int>();
            ai = Console.ReadLine().Split(' ').Select(int.Parse).ToList();                             
            Console.WriteLine(Min(ai) + " " + Max(ai) + " " + Sum(ai));

        }

        private static long Sum(List<int> ai)
        {
            long sum=0;
            for (int i = 0; i < ai.Count; i++)
            {
                sum = sum + ai[i];
            }
            return sum;
        }

        private static int Max(List<int> ai)
        {
            int tempMax = int.MinValue;
            for (int i = 0; i < ai.Count; i++)
            {
                if (tempMax < ai[i])
                    tempMax = ai[i];
            }
            return tempMax;
        }

        private static int Min(List<int> ai)
        {
            int tempMin = int.MaxValue;
            for (int i = 0; i < ai.Count; i++)
            {
                if (tempMin > ai[i])
                    tempMin = ai[i];
            }
            return tempMin;
        }
    }
}
    

Measured memory_bytes: 20228
#include <iostream>

using namespace std;

int main()
{
   long long int a,b;
   cin>>a>>b;
   for(long long int i=a;i<=a*b;i=i+a)
   {
       if(i%b==0)
       {
           cout<<i;
           break;
       }
   }

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <iomanip>
using namespace std;

typedef long long ll;
typedef long double ld;

const int N = 2e5 + 10;

int p[N];

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	vector<int> vv;
	for (int i = 2; i < N; i++) {
		if (!p[i]) {
			vv.push_back(i);
			for (int j = i + i; j < N; j += i) {
				p[j] = true;
			}
		}
	}
	int x;
	cin >> x;
	cout << *lower_bound(vv.begin(), vv.end(), x) << endl;
	return 0;
}

Measured memory_bytes: 1280
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_N = 50000;
const int MAX_M = 50000;

const int NSC = 12;

const string scs[NSC] = {
  "C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B"
};

/* typedef */

typedef map<string,int> msi;

/* global variables */

msi scmap;
int n, m;
int tis[MAX_N + 1], sis[MAX_M + 1];

/* subroutines */

inline int mod(int k) { return (k + NSC) % NSC; }

bool check(int ti) {
  for (int si = m - 1; si >= 0; si--) {
    int& t = tis[ti];
    int& s = sis[si];

    if (t == s) ti--;
    else if (mod(t + 1) == s) ti -= 2;
    else if (mod(t - 1) == s) ti++;
    else return false;
  }

  return (ti == -1);
}

/* main */

int main() {
  for (int i = 0; i < NSC; i++) scmap[scs[i]] = i;

  int tn;
  cin >> tn;

  while (tn--) {
    cin >> n >> m;
    string sc;
    
    for (int i = 0; i < n; i++) {
      cin >> sc;
      tis[i] = scmap[sc];
    }

    for (int i = 0; i < m; i++) {
      cin >> sc;
      sis[i] = scmap[sc];
    }

    bool ok = check(n - 1) || check(n - 2);
    cout << (ok ? "Yes" : "No") << endl;
  }

  return 0;
}

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

typedef long long int lli;
set<lli> se;

void list_maker(string s, int n)
{
    if(n == 9)
    {
        return;
    }

    s += "7";
    se.insert(stol(s));
    list_maker(s, n+1);
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    double n, d;
    cin >> n >> d;

    int counter = 0;

    for(int i = 1; i <= (int)n; i++)
    {
        double x, y;
        cin >> x >> y;

        double dis = x*x + y*y;
        dis = sqrt(dis);

        if(dis - d <= 0)
        {
            counter++;
        }
    }

    cout << counter << endl;
}



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

int main(){
    string mW;
    cin>>mW;
    int result=0;
    while(1){
        string str;
        cin>>str;
        if(str=="END_OF_TEXT")break;
        for(int i=0;i<str.length();i++){
            if(str[i]>='A'&&str[i]<='Z')str[i]=str[i]-'A'+'a';
        }
        if(str==mW)result++;
    }
    cout<<result<<endl;
    return 0;
}


Measured memory_bytes: 3208
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair< P , int > PP;
int n;
int A,B,C;
int x,y,z;
int nx,ny,nz;
int dx[]={1,0,0,-1,0,0};
int dy[]={0,1,0,0,-1,0};
int dz[]={0,0,1,0,0,-1};
map< PP , bool > mp;
  
bool check(int x,int y,int z){
  if(x==-1||y==-1||z==-1)return false;
  if(x==A||y==B||z==C)return false;
  PP key=PP( P(x,y) , z);
  if( mp.count(key) > 0)return false;
  return true;
}
  
int main(){
  while(scanf("%d %d %d %d",&A,&B,&C,&n)!=EOF){
    ll ans=(ll)A*(ll)B*2LL+(ll)B*(ll)C*2LL+(ll)C*(ll)A*2LL;    
    for(int i=0;i<n;i++){
      scanf("%d %d %d",&x,&y,&z);
      for(int i=0;i<6;i++){
        nx=x+dx[i];
        ny=y+dy[i];
        nz=z+dz[i];
        if(check(nx,ny,nz))ans++;
        else ans--;
      }
      mp[ PP(P(x,y),z) ] = true;
    }
    cout<<ans<<endl;
    mp.clear();
  }
  
  return 0;
}

Measured memory_bytes: 3280
#include <bits/stdc++.h>
#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 srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(x) (x).begin(),(x).end()
#define rrng(x) (x).rbegin(),(x).rend()
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define show(x) cout << #x << " = " << (x) << endl
#define show2(x,y) cout << #x << " = " << (x) << ", " << #y << " = " << (y) << endl
#define show3(x,y,z) cout << #x << " = " << (x) << ", " << #y << " = " << (y) <<  ", " << #z << " = " << (z) << endl
#define showv(v) rep(i,v.size()) printf("%d%c", v[i], i==v.size()-1?'\n':' ')
#define showv2(v) rep(j,v.size()) showv(v[j])
#define showt(t,n) rep(i,n) printf("%d%c", t[i], i==n-1?'\n':' ')
#define showt2(t,r,c) rep(j,r) showt(t[j],c)
#define showvp(p) rep(i,p.size()) printf("%d %d\n", p[i].first, p[i].second);
#define printv(v) rep(i,v.size()) printf("%d\n", v[i])
#define printt(t,n) rep(i,n) printf("%d\n", t[i])
#define incl(v,x) find(rng(v),x)!=v.end()
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define uni(x) x.erase(unique(rng(x)),x.end())
#define SP << " " <<
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
typedef vector<pii> vp;
typedef vector<tiii> vt;
const int mod = 1000000007;
const double EPS = 1e-9;
const int INF = (1<<30)-1;
const ll INFLL = (1LL<<62)-1;
#define dame { puts("No"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
inline int in() { int x; scanf("%d",&x); return x;}
//cout << fixed << setprecision(10);
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int main () {
  int n = in();

  vi divisorNum(n+1);
  for (int i = 1; i <= n; ++i) {
    for (int j = i; j <= n; j += i) {
      divisorNum[j]++;
    }
  }

  int ans = 0;
  for (int i = 1; i <= n; i += 2) {
    if (divisorNum[i] == 8) ans++;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
import numpy as np

def make_divisors(n):
	divisors = []
	for i in range(1, int(n**0.5)+1):
		if n % i == 0 and n//i < 10**12:
			if i != n // i:
				divisors.append((i, n//i))
			else:
				divisors.append((i, n//i))
	return divisors


def main():
	#A, B = [int(x) for x in input().split()]
	N = int(input())
	
	R = make_divisors(N)
	A = 10**12
	B = 10**12
	M = 10**12
	for a, b in R:
		if M > max(a, b):
			M = max(a, b)
		A = a
		B = b
	print(A - 1 + B - 1)

if __name__ == "__main__":
	main()


Measured memory_bytes: 21540
using System;
using System.Linq;
class Program
{
    static void Main(string[] args)
    {
        int[] nums = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
        int W = nums[0];
        int H = nums[1];
        int N = nums[2];
        int rightBorder = W;
        int leftBorder = 0;
        int topBorder = H;
        int bottomBorder = 0;
        for(int i = 0; i < N; i++)
        {
            nums = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            switch (nums[2])
            {
                case 1:
                    leftBorder = Math.Max(nums[0],leftBorder);
                    break;
                case 2:
                    rightBorder = Math.Min(nums[0], rightBorder);
                    break;
                case 3:
                    bottomBorder = Math.Max(nums[1], bottomBorder);
                    break;
                case 4:
                    topBorder = Math.Min(nums[1], topBorder);
                    break;
            }
        }
        if (bottomBorder < topBorder && leftBorder < rightBorder)
            Console.WriteLine((topBorder - bottomBorder) * (rightBorder - leftBorder));
        else
            Console.WriteLine(0);
    }
}


Measured memory_bytes: 13396
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#define maxn 100100
#define LL long long
using namespace std;
int n;
int fa[maxn];

void init() {
	for(int i = 0; i <= n; i++) {
		fa[i] = i;
	}
}

int find(int x) {
	return (fa[x] == x ? x : fa[x] = find(fa[x]));
}

bool connect(int a, int b) {
	int x = find(a);
	int y = find(b);
	if(x != y) {
		fa[x] = y;
		return true;
	}
	else {
		return false;
	}
}

struct Node {
	int x, y;
	int sign;
} node[maxn];

struct Segment {
	int a, b;
	int dis;
};

bool cmp1(Node a, Node b) {
	return a.x < b.x;
}

bool cmp2(Node a, Node b) {
	return a.y < b.y;
}

bool cmp(Segment x, Segment y) {
	return x.dis < y.dis;
}

int main() {
	while(~scanf("%d", &n)) {
		init();
		for(int i = 1; i <= n; i++) {
			int _x, _y;
			scanf("%d%d", &_x, &_y);
			node[i].x = _x;
			node[i].y = _y;
			node[i].sign = i;
		}
		vector<Segment> vec;
		sort(node + 1, node + 1 + n, cmp1);
		for(int i = 2; i <= n; i++) {
			Segment segment;
			segment.a = node[i - 1].sign;
			segment.b = node[i].sign;
			segment.dis = node[i].x - node[i - 1].x;
			vec.push_back(segment);
		}
		sort(node + 1, node + 1 + n, cmp2);
		for(int i = 2; i <= n; i++) {
			Segment segment;
			segment.a = node[i - 1].sign;
			segment.b = node[i].sign;
			segment.dis = node[i].y - node[i - 1].y;
			vec.push_back(segment);
		}
		sort(vec.begin(), vec.end(), cmp);
		LL ans = 0;
		for(int i = 0; i < vec.size(); i++) {
			if(connect(vec[i].a, vec[i].b)) {
				ans += vec[i].dis;
			}
		}
		printf("%lld\n", ans);
	}
	return 0;
}

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

int main(){
 int N;
  cin>>N;
  vector<int> A(N);
  bool ans=true;
  for(int i=0;i<N;i++){
    cin>>A.at(i);
    if(A.at(i)%2==0&&A.at(i)%3!=0&&A.at(i)%5!=0){
      cout<<"DENIED"<<endl;
      ans =false;
      break;
    }
  }
  if(ans){
    cout<<"APPROVED"<<endl;
  }
}

Measured memory_bytes: 3604
#include <stdio.h>
int main()
{
    int S;
    int h,m,s;
    scanf("%d",&S);

    h = S / 3600;
    S %= 3600;

    m = S / 60;
    S %= 60;

    s = S;

    printf("%d:%d:%d\n",h,m,s);
}




Measured memory_bytes: 2044
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <utility> //pairを使う
using namespace std;

typedef unsigned long long ll;

const ll inf = 1000000000000;
const ll mod = 100000;

int main(){
	ll n, m, t = 0;
	cin >> n >> m;
	if(m >= n * 2){
		t += n;
		t += (m - n * 2) / 4;
	}else{
		t += m / 2;
	}
	cout << t << endl;
	return 0;
}

Measured memory_bytes: 256
//By MagicSpark
/*
Problem:
Main Idea:
Status:
*/
#include<bits/stdc++.h>
//#include<ext/pb_ds/assoc_container.hpp>
using namespace std;
//using namespace __gnu_pbds;
const int inf=0x3f3f3f3f;
const long long inf2=0x3f3f3f3f3f3f3f3f;
const double eps=1e-6;
const int mod=1000000007;
typedef long long ll;
namespace fastio{
	char in[100000];
	int itr=0,llen=0;
	char get(){
		if(itr==llen)llen=fread(in,1,100000,stdin),itr=0;
		if(llen==0)return EOF;
		return in[itr++];
	}
	char out[100000];
	int itr2=0;
	void put(char c){
		out[itr2++]=c;
		if(itr2==100000){
			fwrite(out,1,100000,stdout);
			itr2=0;
		}
	}
	int clear(){
		fwrite(out,1,itr2,stdout);
		itr2=0;
		return 0;
	}
	int getint(){
    	int r=0; bool ng=0; char c; c=get();
    	while (c!='-'&&(c<'0'||c>'9')) c=get();
   		if (c=='-') ng=1, c=get();
    	while (c>='0'&&c<='9') r=r*10+c-'0', c=get();
    	return ng?-r:r;
	}
	string getstr(){
		string ret="";
		char ch=get();
		while(ch==' '||ch=='\n')ch=get();
		while(ch!=' '&&ch!='\n')ret.push_back(ch),ch=get();
		return ret;
	}
	void putstr(string s){
		for(int i=0;i<s.size();i++)put(s[i]);
	}
	void putint(int x){
		if(x<0){
			put('-');
			x=-x;
		}
		if(x==0){
			put('0');
			return;
		}
		char c[20];int pos=0;
		while(x){
			c[pos++]='0'+x%10;
			x/=10;
		}
		for(int i=pos-1;i>=0;i--)put(c[i]);
	}
	void getarr(int arrname[],int size){
		 for(int i=0;i<size;i++)arrname[i]=getint();
	}
}
using namespace fastio;
#define fastio

#define SZ 100005
int mem[SZ];
vector<int>g[SZ];
int dfs(int x){
	if(mem[x]!=-1)return mem[x];
	int ret=0;
	for(auto p:g[x])ret=max(ret,dfs(p)+1);
	return mem[x]=ret;
}
int main(){
	memset(mem,-1,sizeof(mem));
	int n=getint(),m=getint();
	for(int i=0;i<m;i++){
		int a=getint(),b=getint();
		g[a].push_back(b);
	}
	int ans=0;
	for(int i=1;i<=n;i++){
		ans=max(ans,dfs(i));
	}
	cout<<ans<<endl;
	clear();
	return 0;
}

Measured memory_bytes: 8192
# coding: utf-8
# Your code here!
#########行列読み込み ##############################################
"""
from sys import stdin
n = int(stdin.readline().rstrip())
data = [stdin.readline().rstrip().split() for _ in range(n)]
print(data)
print(*data, sep='\n')
"""
##################################################################
#########入力系####################################################
"""
s =input()
s=list(input())
a=int(input())
x,y = map(int,input().split())	
li = input().split()	
li = list(map(int,input().split()))	
li = input().split('T')	
"""
##################################################################
S =list(input())
T = list(input())
cnt = 0
#print(S)
#print(T)
num = len(S)
for i in range(num):
    if S[i]==T[i]:
        cnt+=1
if cnt==num:
    print("Yes")
else:
    print("No")
    
    

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

int main(){
    int h, w;
    char s[55][55];
    int num = 0;
    cin >> h >> w;
    for(int i = 0; i < h+2; i++){
        for(int j = 0; j < w+2; j++){
            if(i == 0 || i == (h+1)){
                s[i][j] = '%';
            }
            else if(j == 0 || j == (w+1)){
                s[i][j] = '%';
            }
            else{
                cin >> s[i][j];
            }
        }
    }
    for(int i = 1; i < h+1; i++){
        for(int j = 1; j < (w+1); j++){
            if(s[i][j] == '#'){
                if(s[i][j] != s[i][j-1] && s[i][j] != s[i][j+1] && s[i-1][j] != s[i][j] && s[i][j] != s[i+1][j]){
                    num = 1;
                }
            }        
        }
    }
    if(num == 1)cout << "No" << endl;
    else cout << "Yes" << endl;

    return 0;

    
}

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

using namespace std;

/*int main(){
    int n;
    cin>>n;
    vector<int>a(n),b(n),c(n);
    for(int i=0;i<n;++i){
        cin>>a[i];
    }
    for(int i=0;i<n;++i){
        cin>>b[i];
    }
    for(int i=0;i<n;++i){
        cin>>c[i];
    }
    sort(a.begin(),a.end());
    sort(b.begin(),b.end());
    sort(c.begin(),c.end());
    cout<<ans<<endl;
}*/

int main(){
    int w,a,b;
    cin>>w>>a>>b;
    int ans=0;
    ans=max(ans,abs(a-b)-w);
    cout<<ans<<endl;
}

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

typedef long long ll;
const int N = 1e5;

int n;

int main(){
	scanf("%d",&n);
	ll ans = 0ll;
	ll bef = 1;
	for(int i=1;i<=n;i++){
		ll x;
		scanf("%lld",&x);
		x-=bef;
		if(i==1){
			ans+=x;
		} else if(x<=1){
			bef = max(bef,x+bef);
		} else if(x > 1){
			ans+=(x+bef-1)/(bef+1);
		}
//		cout << ">> " << ans << " <> " << bef << endl;
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 256
/* 
	Author: ankrypt
*/

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;
template<class T> using oset=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define MOD 1000000007
#define ll long long int
#define u64 unsigned long long int
#define ff first
#define ss second
#define all(x) x.begin(), x.end() 
#define ub upper_bound
#define lb lower_bound
#define MAX_INT 15
#define fi(a, b, c, d) for(int a = b; i < c; i += d)
#define fl(a, b, c, d) for(ll a = b; i < c; i += d)
#define quit exit(0)

ll N, M, A, B, C;
ll arr[MAX_INT], arr1[MAX_INT], data[MAX_INT];
vector<ll> V;
string S = "";


int main() {
	cin >> S;
	if(S[2] == S[3] && S[4] == S[5]) {
		printf("Yes\n");
	}
	else {
		printf("No\n");
	}
	return 0;
}
/*
	Powered by Buggy Plugin
*/




Measured memory_bytes: 256
#include <iostream>
#include<time.h>
#include<string>
#include<cstring>
#include <cstdio>
#include<utility>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<bitset>
#include<queue>
#include<stack>
#include<set>
#include <limits>
#include <climits>
#include <numeric>
#include<cassert>
#include<cctype>
#include<iterator>
#include<unordered_map>
using namespace std;
typedef long long ll;
typedef unsigned long long LL;
typedef vector<ll>VI;
typedef vector<bool>VB;
typedef pair<ll,ll>P;
typedef pair<double,double>P_D;
#define VV(T) vector<vector<T>>
#define PI 3.1415926535897932384626433832795
#define rep(i, n) for (ll i = 0; i < (ll)n; i++)
#define reprev(i, n) for (ll i = (ll)n - 1; i >= 0; i--)
#define bitrep(bit,A) for(int bit=A; ;bit=(bit-1)&A)
#define ALL(a)  (a).begin(),(a).end()
#define SZ(a) (ll)((a).size())
#define c_max(a, b) (((ll)a)>((ll)b)?(a):(b))
#define c_min(a,b) (((ll)a)<((ll)b)?(a):(b))
#define chmax(x,a) x=c_max(x,a)
#define chmin(x,a) x=c_min(x,a)
#define vmax(v) *max_element(ALL(v))
#define vmin(v) *min_element(ALL(v))
#define SORT(c) stable_sort(ALL(c))
#define $(x) {cout<<#x<<" = " <<(x)<<endl;}
#define fi first
#define se second
#define MAX 100100//5
#define MAX2 200100
#define MAX_6 1001001//6
#define MAX_7 10010010//7
#define SENTINEL 2000000000//9
#define NIL -1
const int MOD = 1000000007;
#define INF 1<<30
#define INFTY 1LL<<61
#define MAX_INT INT_MAX
#define Endl '\n'
#define greater greater<int>()
inline ll GCD(ll a,ll b){return b?GCD(b,a%b):a;}
inline ll lcm(ll a,ll b){return a*b/GCD(a,b);}
using Edge=pair<int,ll>;
using Graph=vector<vector<ll> >;//ll or Edge
using Edge=pair<int,ll>;
//const int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
// g++ -o a a.cpp -Wall -lm -std=c++14
int main(){
    ll n,m,k;cin>>n>>m>>k;
    ll r[MAX2],l[MAX2];
    rep(i,n)cin>>l[i];rep(i,m)cin>>r[i];
    vector<ll> rsum(m+1),lsum(n+1);
    rsum[0]=0;lsum[0]=0;
    rep(i,m){
        rsum[i+1]=rsum[i]+r[i];
    }
    rep(i,n){
        lsum[i+1]=lsum[i]+l[i];
    }
    int ans=0;
    rep(i,m+1){
        int key=k;
        if(rsum[m-i]<=k){
            key=k-rsum[m-i];
        }
    auto iter_upper = upper_bound(lsum.begin(),lsum.end(),key);
    long idx_upper = distance(lsum.begin(), iter_upper);
    if(key==k){
        chmax(ans,idx_upper-1);
    }
    else chmax(ans,idx_upper+m-i-1);
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 9596
#include <bits/stdc++.h>
#define rep(i,n) for(long long int i = 0; i < n; i++)
#define _rep(i,m,n) for(long long int i = m; i < n; i++)
#define print(n) std::cout << n << std::endl
#define _print(n) std::cout << n
using namespace std;
typedef long long ll;
const int N = 1000000;
const ll mod = 1000000007;

int n; 
int all_sum;
vector<int> a;
bool judge(int N,int M){

    for(int bit = 0; bit < (1 << n); bit++){
        int sum = 0;
        if(M < N)return false;
        for(int i = 0; i < n; i++){
            if(bit & (1 << i)){
                sum += a[i];
            }
        }
        if(sum == N) return true;
    }
    return false;
}

int main(){
    scanf("%d",&n);
    a.resize(n);
    int all_sum = 0;
    for(int i = 0; i < n; i++){
        scanf("%d",&a[i]);
        all_sum += a[i];
    }

    int q;
    scanf("%d",&q);
    vector<int> m(q);
    for(int i = 0; i < q; i++){
        scanf("%d",&m[i]);
        if(judge(m[i],all_sum))printf("%s\n","yes");
        else printf("%s\n","no");
    }
}


Measured memory_bytes: 3172
import std.algorithm, std.container, std.conv, std.math, std.range, std.typecons, std.stdio, std.string;

auto rdsp(){return readln.splitter;}
void pick(R,T)(ref R r,ref T t){t=r.front.to!T;r.popFront;}
void readV(T...)(ref T t){auto r=rdsp;foreach(ref v;t)pick(r,v);}

void main()
{
  string s; readV(s);
  long k; readV(k);

  auto i = s.countUntil!(si => si != '1');
  if (i == -1 || i >= k)
    writeln(1);
  else
    writeln(s[i]);
}


Measured memory_bytes: 256
from collections import defaultdict
N, = map(int, input().split())

def normal(xs):
    mnx = min(xs)
    xi = xs.index(mnx)
    if xs[(xi+3)%4] == mnx:
        if xs[(xi+2)%4] == mnx:
            xi = (xi+2)%4
        else:
            xi = (xi+3)%4
    if xs[(xi+1)%4] > xs[(xi+3)%4]:
        xi = (xi+2)%4
    return (xs[xi%4], xs[(xi+1)%4], xs[(xi+2)%4], xs[(xi+3)%4])
#x = (0,2,2,0)
#print(normal(x))

dd = defaultdict(int)
cc = defaultdict(int)
ss = []
for _ in range(N):
    a, b, c, d = map(int, input().split())
    x = normal([a,b,c,d])
    n=1
    if x[0] == x[2] and x[1] == x[3]:
        n *= 2
        if x[0] == x[1]:
            n *= 2
    dd[x] += 1
    cc[x] = n
    ss.append(x)

def icr(x):
    dd[x] += 1

def dcr(x):
    dd[x] -= 1

def f(ff, gg):
    #print(dd)
    a,b,c,d=ff
    e,h,g,f=gg
    tl = list(map(normal, [(a,e,f,b), (b,f,g,c), (c,g,h,d), (d,h,e,a)]))
    r = 1
    for cp in tl:
        if cp not in dd:
            r = 0
            break
        r *= dd[cp]*cc[cp]
        dcr(cp)
    for cp in tl:
        if cp not in dd:
            break
        icr(cp)
    return r

r = 0
for i in range(N):
    ff = ss[i]
    dcr(ff)
    for j in range(i+1, N):
        sl = ss[j]
        dcr(sl)
        x, y, z, w = sl
        sls = [(x,y,z,w), (y,z,w,x), (z,w,x,y), (w,x,y,z)]
        for s in sls:
            r += f(ff, s)
        icr(sl)
    icr(ff)
print(r//3)


Measured memory_bytes: 57564
#include<bits/stdc++.h>
#define fo(i,a,b) for(int i=(a);i<(b);i++)
#define qi queue<int>
#define vi vector<int>
#define ll long long
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define pii pair<int,int>
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define fi first
#define se second
#define prq priority_queue
#define foreach(it,c) for(__typeof((c).begin()) it=c.begin();it!=c.end();it++)
//#define KEY_DOWN(VK_NONAME) ((GetAsyncKeyState(VK_NONAME) & 0x8000) ? 1:0)
using namespace std;
inline ll read(){
	ll x=0;
	int f=1;
	char c=getchar();
	for(;!isdigit(c);c=getchar()) if(c=='-')f=-f;
	for(;isdigit(c);c=getchar())x=x*10+(c-'0');
	return x*f;
}
inline void out(int x){
	if(x>=10)out(x/10);
	putchar(x%10+'0');
}
int main(){
	//freopen("a.in","r",stdin);
	//freopen("a.out","w",stdout);
	string s;
	cin>>s;
	int n=s.size();
	string s1="",s2="";
	fo(i,0,(n-1)/2)s1+=s[i];
	fo(i,(n+1)/2,n)s2+=s[i];
	fo(i,0,n) if(s[i]!=s[n-i-1]){
		cout<<"No\n";
		return 0;
	}
	fo(i,0,s1.size()) if(s1[i]!=s1[s1.size()-i-1]){
		cout<<"No\n";
		return 0;
	}
	fo(i,0,s2.size()) if(s2[i]!=s2[s2.size()-i-1]){
		cout<<"No\n";
		return 0;
	}
	cout<<"Yes\n";
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
using namespace std;
// #define TEST

int main ()
{
    int n, a, b, c, d;
    string s;
    cin >> n >> a >> b >> c >> d;
    cin >> s;

    vector<bool> isRock(n);
    for (int i = 0; i < n; ++i)
    {
        isRock[i] = (s[i] == '#');
    }

    // 区間(A, C)および(B, D)それぞれ2連続以上の岩は、1箇所でも存在したら不可
    for (int i = a; i <= (c - 3); ++i)
    {
        if (isRock[i] && isRock[i + 1])
        {
            #ifdef TEST
                cout << "Consecutive rocks in (A, C)" << endl;
            #endif
            cout << "No" << endl;
            return 0;
        }
    }
    for (int i = b; i <= (d - 3); ++i)
    {
        if (isRock[i] && isRock[i + 1])
        {
            #ifdef TEST
                cout << "Consecutive rocks in (B, D)" << endl;
            #endif
            cout << "No" << endl;
            return 0;
        }
    }

    // C < Dなら追い越さなければ行く方法は絶対にある
    if (c < d)
    {
        cout << "Yes" << endl;
        return 0;
    }

    // 区間[B-1, D+1]に3連続平地が存在するなら追い越し可能→題意満たす
    for (int i = (b - 2); i <= (d - 2); ++i)
    {
        if (!isRock[i] && !isRock[i+1] && !isRock[i+2])
        {
            cout << "Yes" << endl;
            return 0;
        }
    }

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

Measured memory_bytes: 640
#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;
  double a[n];
  for(int i=0;i<n;i++)cin >> a[i];

  double s=0;
  for(int i=0;i<n;i++)s+=1/a[i];
  s=1/s;

  printf("%.12f",s);

}

Measured memory_bytes: 3724
#include <bits/stdc++.h>
typedef long long ll;

bool check(ll *d, ll x, ll K) {
    std::string s = std::to_string(x);
    for (size_t i = 0; i < K; i++) {
        if ((int)s.find(std::to_string(d[i])) != -1) {
            return false;
        }
    }
    return true;
}

int main(int argc, char const *argv[]) {
    ll N, K;
    std::cin >> N >> K;
    ll D[K];
    for (size_t i = 0; i < K; i++) {
        std::cin >> D[i];
    }
    ll ans = N;
    while (true) {
        if (check(D, ans, K)) {
            std::cout << ans << '\n';
            break;
        }
        ans++;
    }
    return 0;
}


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

int parent(int index) {
    if (index == 1) {
        return 0;
    }

    return index / 2;
}

int get_left(int index) {
    return 2 * index;
}

int get_right(int index) {
    return (2 * index) + 1;
}

int main() {
    int N;
    cin >> N;
    vector<int>vec(N);
    for (int i=0; i < N; i++) {
        cin >> vec.at(i);
    }

    for (int i=0; i < N; i++) {
        int index = i + 1;
        cout << "node " << index << ": key = " << vec[i] << ", ";
        int parent_ = parent(index);
        if (parent_ > 0) {
            cout << "parent key = " << vec[parent_-1] << ", ";
        }

        int left_key = get_left(index);
        if (N >= left_key) {
            cout << "left key = " << vec[left_key-1] << ", ";
        }

        int right_key = get_right(index);
        if (N >= right_key) {
            cout << "right key = " << vec[right_key-1] << ", ";
        }
        cout << endl;
    }

    return 0;
}


Measured memory_bytes: 3096
#coding: utf-8
import math
import heapq
import bisect
import numpy as np
from collections import Counter
#from scipy.misc import comb

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

for i in range(N):
    A[i] -= i
A.sort()

if(N%2):
    b = A[N//2]
else:
    b = (A[N//2]+A[N//2-1])//2

ans1 = 0
ans2 = 0
for a in A:
    ans1 += abs(a-b)
    ans2 += abs(a-(b+1))

print(min(ans1, ans2))

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

int main(void)
{
    int n;
    cin >> n;
    rep(i, (n + 3) / 4)
    {
        int x = 4 * i;
        if (n % 4 == 0)
        {
            cout << "Yes" << endl;
            return 0;
        }
        if ((n - x) % 7 == 0)
        {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
}


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

using namespace std;

int main(){
	int a,b;
	cin >> a >> b;

	int ans = -1;

	for(int i=1;i<=100000;++i){
		double temp1 = floor(i*0.08);
		double temp2 = floor(i*0.1);
		if(temp1 == a && temp2 == b){
			ans = i;
			break;
		}
	}

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

Measured memory_bytes: 256
void main()
{
    long[] tmp = rdRow;
    long n = tmp[0], m = tmp[1];
    long[] a = rdRow;

    long cnt;
    while (a.all!"a % 2 == 0")
    {
        a[] /= 2;
        ++cnt;
    }
    long l = a[0];
    foreach (i; 1 .. n)
    {
        long g = gcd(l, a[i]);
        l = l * a[i] / g;
        if (l > m)
        {
            0.writeln;
            return;
        }
    }

    long result;
    if (l & 1)
    {
        l *= 1 << cnt;
        result = (m + l / 2) / l;
    }

    result.writeln;
}

T rdElem(T = long)()
{
    //import std.stdio : readln;
    //import std.string : chomp;
    //import std.conv : to;

    return readln.chomp.to!T;
}

alias rdStr = rdElem!string;

dchar[] rdDchar()
{
    //import std.conv : to;

    return rdStr.to!(dchar[]);
}

T[] rdRow(T = long)()
{
    //import std.stdio : readln;
    //import std.array : split;
    //import std.conv : to;

    return readln.split.to!(T[]);
}

T[] rdCol(T = long)(long col)
{
    //import std.range : iota;
    //import std.algorithm : map;
    //import std.array : array;

    return iota(col).map!(x => rdElem!T).array;
}

T[][] rdMat(T = long)(long col)
{
    //import std.range : iota;
    //import std.algorithm : map;
    //import std.array : array;

    return iota(col).map!(x => rdRow!T).array;
}

void wrMat(T = long)(T[][] mat)
{
    //import std.stdio : write, writeln;

    foreach (row; mat)
    {
        foreach (j, compo; row)
        {
            compo.write;
            if (j == row.length - 1) writeln;
            else " ".write;
        }
    }
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.container;
import std.typecons;
import std.ascii;
import std.uni;

Measured memory_bytes: 4308
#include <stdio.h>
int main() {
	int a, b, ans = 0, n;
	int num[5];
	scanf("%d%d", &a, &b);
	for (int i = a; i <= b; i++) {
		n = i;
		for (int j = 0; j < 5; j++) {
			num[j] = n % 10;
			n /= 10;
		}
		if (num[0] == num[4] && num[1] == num[3]) {
			ans++;
		}
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 128