akhauriyash/Code-Regression huggingface dataset:
using System;

class AIZU0027{
   enum Day { Monday,Tuesday,Wednesday,Thursday,Friday,Saturday,Sunday }
   public static int[] Cliche(char f) {
      string s = Console.ReadLine();
      string[] ss = s.Split(f);
      int[] Res = new int[ss.Length];
      for (int i = 0; i<ss.Length; i++) Res[i]=int.Parse(ss[i]);
      return Res;
   }

   public static void Main(string[] args) {
      int[] cal2004 = { 31,29,31,30,31,30,31,31,30,31,30,31 };
      int first = 2, month=0,date=0,sumdate=0;
      int[] G;
      while (true) { 
         G=Cliche(' ');
         sumdate=0;  first=2;
         month=G[0];date=G[1];
         if (month==0) break;
         for (int i = 0; i<month-1; i++) 
            sumdate+=cal2004[i];
         sumdate+=date;
         first+=sumdate;
         first%=7;
         Console.WriteLine(((Day)first).ToString());
      }
   }
}

Measured memory_bytes: 9196
import java.util.Scanner;
import java.util.ArrayList;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String str = sc.next();
    ArrayList<String> list = new ArrayList<String>();
    String str1;
    int count = 0;
    for(int i=0;i<str.length();i++){
      list.add(str.substring(i,i+1));
    }
    for(int i=0;i<list.size();i++){
      count = 0;
      str1 = list.get(i);
      for(int m=0;m<list.size();m++){
        if(list.get(m).equals(str1)){
          count++;
        }
      }
      if(count%2==1){
        System.out.println("No");
        return;
      }
    }
    System.out.println("Yes");
  }
}

Measured memory_bytes: 21844
#pragma region
#include <bits/stdc++.h>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define reps(i, n) for (int i = 1, i##_len = (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 all(x) (x).begin(), (x).end()
#define pb push_back
#define eb emplace_back
#define debug(x) cerr << #x << ": " << x << '\n'
#define INF 1e9
using namespace std;
template <class T = int>
T in() {
  T x;
  cin >> x;
  return (x);
}

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

#pragma endregion

int main() {
  int n = in();
  vector<int> x(n), y(n);
  vector<int> v(n);
  rep(i, n) {
    x[i] = in();
    y[i] = in();
    v[i] = i;
  }

  long double ans = 0;
  int num = 0;
  do {
    rep(i, n - 1) {
      ans +=
          sqrt(pow(x[v[i]] - x[v[i + 1]], 2) + pow(y[v[i]] - y[v[i + 1]], 2));
    }
    num++;
  } while (next_permutation(all(v)));

  cout << fixed << setprecision(10) << ans / num << endl;
  return 0;
}


Measured memory_bytes: 256
def I(): return int(input())
def LI(): return list(map(int,input().split()))
N = I()
h = LI()
dp = [float('INF')]*N
dp[0],dp[1] = 0,abs(h[1]-h[0])
for i in range(2,N):
    dp[i] = min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]))
print(dp[-1])

Measured memory_bytes: 13980
### constant

BLACK = 0
WHITE = 1

DXYZS = [
  ## 1D
  [1, 0, 0], [0, 1, 0], [0, 0, 1],
  ## 2D
  [1, 1, 0], [-1, 1, 0], [0, 1, 1], [0, -1, 1], [1, 0, 1], [1, 0, -1],
  ## 3D
  [1, 1, 1], [-1, 1, 1], [1, -1, 1], [-1, -1, 1],
]

### subroutines

def check(n, m, flds, turn)
  for x0 in (0...n)
    for y0 in (0...n)
      for z0 in (0...n)
        next if flds[x0][y0][z0] != turn
        DXYZS.each do |dx, dy, dz|
          seq = 1
          x = x0 + dx
          y = y0 + dy
          z = z0 + dz
          while x >= 0 && x < n && y >= 0 && y < n && z >= 0 && z < n &&
              flds[x][y][z] == turn
            seq += 1
            x += dx
            y += dy
            z += dz
            return true if seq >= m
          end
        end
      end
    end
  end

  false
end

### main

loop do
  n, m, pn = gets.split.map(&:to_i)
  break if (n | m | pn) == 0

  mvs = pn.times.map{gets.split.map{|d| d.to_i - 1}}
  #p mvs

  flds = n.times.map{n.times.map{n.times.map{nil}}}
  zs = n.times.map{n.times.map{0}}

  turn = BLACK
  nmv = 0
  winner = nil

  mvs.each do |x, y|
    nmv += 1
    flds[x][y][zs[x][y]] = turn
    zs[x][y] += 1

    if check(n, m, flds, turn)
      winner = turn
      break
    end

    turn = (turn == BLACK) ? WHITE : BLACK
  end

  if winner.nil?
    puts 'Draw'
  else
    puts [winner == BLACK ? 'Black' : 'White', nmv].join(' ')
  end
end

Measured memory_bytes: 6144
import sys
IS = lambda: sys.stdin.readline().rstrip()
II = lambda: int(IS())
MII = lambda: list(map(int, IS().split()))
MIIZ = lambda: list(map(lambda x: x-1, MII()))

def main():
    a, b, c, d = [II() for _ in range(4)]
    print(min(a,b)+min(c,d))

if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
import cmath

N = int(input())
XY = []
for _ in range(N):
    x, y = map(int, input().split())
    XY.append(x + y * 1j)

XY.sort(key=lambda x: cmath.phase(x))

ans = 0
for i in range(N):
    for j in range(N):
        if i <= j:
            ans = max(ans, abs(sum(XY[i:j + 1])))
        elif i > j:
            ans = max(ans, abs(sum(XY[:j + 1] + XY[i:])))

print(ans)


Measured memory_bytes: 3316
#!/usr/bin/env python3
import sys


def solve(N: int, A: "List[int]"):
    from collections import Counter
    c = Counter(A)
    ans = 0
    for v in c.values():
        if(v%2):
            ans += 1

    print(ans)
    return


# Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, A)

if __name__ == '__main__':
    main()


Measured memory_bytes: 16656
# -*- coding: utf-8 -*-
"""
Created on Sat May  2 22:26:54 2020

@author: Kanaru Sato
"""

a,b,n = list(map(int,input().split()))

def floorspecial(x):
    u = (a*x)//b
    v = a*(x//b)
    print(int(u-v))

if a == 1:
    print(0)
elif n < b:
    floorspecial(n)
else:
    p = (n//b)*b
    p = p-1
    floorspecial(p)

Measured memory_bytes: 9192
#include <stdio.h>
int main(){
  int n;
  scanf("%d",&n);
  if(n%10==7){
    printf("Yes");
  }else if(n/10%10==7){
    printf("Yes");
  }else if(n/100%10==7){
    printf("Yes");
  }else{
    printf("No");
  }
  return 0;
}

Measured memory_bytes: 1732
/**
 * クイックソート
 */
fun main(args: Array<String>) {

    Main.init()

    Main.execute()

    Main.display()
}

class Main {

    companion object {

        private var outs = arrayListOf<Item>()

        fun init() {
            val size = readLine()!!.toInt()
            for (index in 1..size) {
                val input = readLine()!!.split(" ")
                outs.add(Item(input[0], input[1].toInt(), index))
            }
        }

        fun execute() {
            quickSort(outs, 0, outs.size - 1)
        }

        fun display() {

            // 安定かどうかをチェック
            var isStable = true

            for (index in 1 until outs.size) {
                val lastItem = outs[index - 1]
                val currentItem = outs[index]

                if (lastItem.key == outs[index].key) {
                    if (lastItem.originalIndex > currentItem.originalIndex) {
                        isStable = false
                        break
                    }
                }
            }

            println(if (isStable) "Stable" else "Not stable")

            outs.forEach {
                println(it.symbol + " " + it.key)
            }
        }


        /**
         * 配列をクイックソート
         */
        fun quickSort(list: ArrayList<Item>, startIndex: Int, endIndex: Int) {

            if (startIndex >= endIndex) {
                return
            }

            val lastItem = list[endIndex]

            var cursorBefore = startIndex
            var cursorAfter = startIndex

            while (cursorAfter != endIndex + 1) {
                val target = list[cursorAfter]

                if (target.key <= lastItem.key) {
                    swap(list, cursorAfter, cursorBefore)
                    cursorBefore++
                }

                cursorAfter++
            }

            quickSort(list, startIndex, cursorBefore - 2)
            quickSort(list, cursorBefore, endIndex)
        }

        fun swap(list: ArrayList<Item>, a: Int, b: Int): ArrayList<Item> {
            val temp = list[a]
            list[a] = list[b]
            list[b] = temp
            return list
        }
    }
}


data class Item(val symbol: String, val key: Int, val originalIndex: Int)





Measured memory_bytes: 83272
#include<iostream>
#include<string>
#include<vector>
#include<sstream>
#define fs first
#define sc second
using namespace std;
 
typedef pair<char,int> Run;
typedef vector<Run> RLE;
 
RLE decode(string s){
  stringstream ss(s);
  int l;
  RLE res;
 
  ss >> s;
  while(s!="$"){
    ss >> l;
    res.push_back(make_pair(s[0],l));
    ss >> s;
  }
  return res;
}
 
int main(){
  string a,b,c;
  RLE ra,rb,rc;
 
  while(getline(cin,a)){
    //input
    ra = decode(a);
    getline(cin,b);
    rb = decode(b);
    getline(cin,c);
    rc = decode(c);
 
    int n = ra.size(), m = rb.size();
    
    if(m==1){
      for(int i=0;i<n;i++){
	//check matching
	if(ra[i].fs == rb[0].fs && ra[i].sc >= rb[0].sc){
	  //replace
	  RLE tmp;
	  for(int j=0;j<i;j++)tmp.push_back(ra[j]);
	  for(int j=0;j<(int)rc.size();j++)tmp.push_back(rc[j]);
	  if(ra[i].sc > rb[0].sc){
	    tmp.push_back(make_pair(ra[i].fs, ra[i].sc - rb[0].sc));
	  }
	  for(int j=i+1;j<n;j++)tmp.push_back(ra[j]);
	  ra = tmp;
	  break;
	}
      }
    }else{
      for(int i=0;i<n-m+1;i++){
	//check matching
	bool f = true;
	if(ra[i].fs != rb[0].fs || ra[i].sc < rb[0].sc)f = false;
	for(int j=1;j<m-1;j++){
	  if(ra[i+j].fs != rb[j].fs || ra[i+j].sc != rb[j].sc)f = false;
	}
	if(ra[i+m-1].fs != rb[m-1].fs || ra[i+m-1].sc < rb[m-1].sc)f = false;
	
	if(f){
	  //replace
	  RLE tmp;
	  for(int j=0;j<i;j++)tmp.push_back(ra[j]);	  
	  if(ra[i].sc != rb[0].sc){
	    tmp.push_back(make_pair(ra[i].fs,ra[i].sc-rb[0].sc));
	  }
	  for(int j=0;j<(int)rc.size();j++)tmp.push_back(rc[j]);
	  if(ra[i+m-1].sc != rb[m-1].sc){
	    tmp.push_back(make_pair(ra[i+m-1].fs,ra[i+m-1].sc-rb[m-1].sc));
	  }
      	  for(int j=i+m;j<n;j++)tmp.push_back(ra[j]);
	  ra = tmp;
	  break;
	}
      }
    }
 
    //output with modifying
    char c = ra[0].fs;
    int l = ra[0].sc;
    for(int i=1;i<(int)ra.size();i++){
      if(ra[i].fs == c){
	l += ra[i].sc;
      }else{
	cout << c << " " << l << " ";
	c = ra[i].fs; l = ra[i].sc;
      }
    }
    cout << c << " " << l << " $" << endl;
  }
}

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

int sumofdigits(int x){
  int sum = 0;
  while(x > 0){
    sum += x % 10;
      x /= 10;
  }
  return sum;
}
  
int main() {
  int x;
  cin >> x;
  if(x % sumofdigits(x) == 0){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<iomanip>
using namespace std;

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define INF 2e9
#define MOD 1e9+7
#define LINF (long long)4e18


int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i,n){
      cin >> a[i];
  }
  vector<int> b;
  if(n % 2 == 0){
      for(int i = n-1; i >= 0; i--){
          if((i+1) % 2 == 0)b.push_back(a[i]);
      }
      rep(i,n){
          if((i+1) % 2 == 1)b.push_back(a[i]);
      }
  }
  else{
      for(int i = n-1; i >= 0; i--){
          if((i+1) % 2 == 1)b.push_back(a[i]);
      }
      rep(i,n){
          if((i+1) % 2 == 0)b.push_back(a[i]);
      }
  }
  rep(i,n-1){
      cout << b[i] << " ";
  }
  cout << b[n-1] << endl;
} 

Measured memory_bytes: 3828
# -*- coding: utf-8 -*-
'''Snippets for lcm.
Available functions:
- lcm: Compute least common multiple of a and b.
'''


def lcm(a: int, b: int) -> int:
    '''Compute least common multiple of a and b.
    Args:
        a: Int of number (greater than 0).
        b: Int of number (greater than 0).
    Returns:
        least common multiple.
    Landau notation: O(log n)
    See:
    https://gist.github.com/endolith/114336/eff2dc13535f139d0d6a2db68597fad2826b53c3
    https://docs.python.org/3/library/sys.html#sys.version_info
    '''

    from sys import version_info

    if version_info.major == 3 and version_info.minor >= 5:
        from math import gcd
    else:
        from fractions import gcd

    return a * b // gcd(a, b)


def main():
    a, b, c, d = map(int, input().split())
    l = lcm(c, d)
    x = b // c - (a - 1) // c
    y = b // d - (a - 1) // d
    z = b // l - (a - 1) // l
    w = b - a + 1

    if c % d == 0 or d % c == 0:
        print(w - x)
    else:
        print(w - (x + y - z))


if __name__ == '__main__':
    main()


Measured memory_bytes: 5296
#include <cstdio>
#include <iostream>
#include <cmath>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <memory.h>
#include <iomanip>
#include <bitset>
#include <list>
#include <stack>
#include <deque>

using namespace std;

#define mod 1000000007


int main()
{
	int x, y;
	cin >> x >> y;
	if(x == 2 || y == 2) cout << "No" << endl;
	else if(y == 6 || y == 9 || y == 11){
		if(x == 4 || x == 6 || x == 9) cout << "Yes" << endl;
		else cout << "No" << endl;
	} else {
		if(x == 4 || x == 6 || x == 9 || x == 11) cout << "No" << endl;
		else cout << "Yes" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
n,y=map(int,input().split())
for i in range(y//10000+1):
  num=y-i*10000
  for j in range(num//5000+1):
    if n-i-j>=0 and (n-i-j)*1000==num-j*5000:
      print(i,j,n-i-j)
      exit()
print(-1,-1,-1)

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

int main(){
    int K, S;
    cin >> K >> S;

    int count = 0;
    for (int i = 0; i <= K; i++) {
        for (int j = 0; j <= K; j++) {
            if (S - i - j <= K && S - i - j >= 0) count++;
        }
    }

    cout << count << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const ll mod = 1e9 + 7;
using Graph = vector<vector<int>>;

int main() {
    // 頂点数と辺数
    int N, X, Y, M;
    cin >> N >> X >> Y;
    X--;
    Y--;
    // グラフ入力受取 (ここでは無向グラフを想定)
    Graph G(N);
    int ans[N];
    for(int i = 0; i < N; i++) ans[i] = 0;
    for(int i = 0; i < N - 1; ++i) {
        int a = i, b = i + 1;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    G[X].push_back(Y);
    G[Y].push_back(X);
    for(int i = 0; i < N - 1; i++) {
        // BFS のためのデータ構造
        vector<int> dist(N, -1);  // 全頂点を「未訪問」に初期化
        queue<int> que;

        // 初期条件 (頂点 0 を初期ノードとする)
        dist[i] = 0;
        que.push(i);  // 0 を橙色頂点にする

        // BFS 開始 (キューが空になるまで探索を行う)
        while(!que.empty()) {
            int v = que.front();  // キューから先頭頂点を取り出す
            que.pop();

            // v から辿れる頂点をすべて調べる
            for(int nv : G[v]) {
                if(dist[nv] != -1) continue;  // すでに発見済みの頂点は探索しない

                // 新たな白色頂点 nv について距離情報を更新してキューに追加する
                dist[nv] = dist[v] + 1;
                que.push(nv);
            }
        }

        // 結果出力 (各頂点の頂点 0 からの距離を見る)
        // for(int v = 0; v < N; ++v) cout << v << ": " << dist[v] << endl;
        for(int v = i; v < N; ++v) ans[dist[v]]++;
    }
    // cout << "\n";
    for(int i = 1; i < N; i++) cout << ans[i] << "\n";
    return 0;
}


Measured memory_bytes: 384
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#define popcount __builtin_popcount
using namespace std;
typedef long long ll;
typedef pair<ll, int> P;
vector<int> g[10001];
int main()
{
    int n; cin>>n;
    for(int i=0; i<n-1; i++){
        int a, b; cin>>a>>b;
        a--; b--;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    int ans=0;
    int c[10010];
    for(int i=0; i<n; i++) cin>>c[i];
    sort(c, c+n, greater<int>());
    for(int i=1; i<n; i++) ans+=c[i];
    cout<<ans<<endl;
    queue<int> que;
    que.push(0);
    int t=0;
    int v[10001];
    bool used[10001]={};
    used[0]=1;
    while(!que.empty()){
        int x=que.front(); que.pop();
        v[x]=c[t]; t++;
        for(auto y:g[x]){
            if(!used[y]){
                used[y]=1;
                que.push(y);
            }
        }
    }
    for(int i=0; i<n; i++){
        cout<<v[i];
        if(i<n-1) cout<<" ";
    }
    cout<<endl;
    return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main()
{
   int N;
   cin >> N;
   vector<int64_t> L(N+1);
   L.at(0)=2LL;
   L.at(1)=1LL;
   for (int i=1; i<N; i++){
       L.at(i+1)=L.at(i)+L.at(i-1);
   }
   cout << L.at(N);
    return 0;
}

Measured memory_bytes: 256
import sys
import math
from collections import deque
from collections import defaultdict
from copy import deepcopy
from itertools import accumulate #リストを与えると累積和を返す
def input(): return sys.stdin.readline().rstrip()
from functools import lru_cache #メモ化

def main():
    S = list(input())
    print(''.join(S[0:3]))
    
    return 0

if __name__ == "__main__":
    main()

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

const int m=1e9+7;

void solve()
{
    int h,w;
    cin>>h>>w;
    char a[h+1][w+1];
    for(int i=0;i<h;i++)
    {
        for(int j=0;j<w;j++)
            cin>>a[i][j];
    }
    int dp[h+1][w+1];
    dp[0][0]=0;
    bool hash=false;
    for(int i=1;i<h;i++)
    {
        if(a[i][0]=='#')
        {
            hash=true;
            dp[i][0]=0;
        }
        else if(!hash)
            dp[i][0]=1;
        else
            dp[i][0]=0;
    }
    hash=false;
    for(int i=1;i<w;i++)
    {
        if(a[0][i]=='#')
        {
            hash=true;
            dp[0][i]=0;
        }
        else if(!hash)
            dp[0][i]=1;
        else
            dp[0][i]=0;
    }
    for(int i=1;i<h;i++)
    {
        for(int j=1;j<w;j++)
        {
            if(a[i][j]=='#')
                dp[i][j]=0;
            else
                dp[i][j]=(dp[i-1][j]%m+dp[i][j-1]%m)%m;
        }
    }
    cout<<dp[h-1][w-1]<<"\n";
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    solve();
    return 0;
}

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

int euclid(long long a, long long b){

    long long A = max(a,b);
    long long B = min(a,b);

    if(A%B == 0) return B;
    else return euclid(B,A%B);
}

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

    long long g = euclid(a,b);

    cout << a*b/g << endl;

}


Measured memory_bytes: 256
//In the name of God
#include<bits/stdc++.h>

using namespace std;

int n , k;
bool mark[10];

bool ok(int x){
        while(x){
                int y = x % 10; x/= 10;
                if(mark[y])
                        return 0;
        }
        return 1;
}

int main(){
        cin >> n >> k;
        for(int i=0 ; i < k ; i++){
                int d;  cin >> d;
                mark[d] = 1;
        }
        while(true){
                if(ok(n))
                        return cout << n , 0;
                n++;
        }
}      

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

int main(){
  
  string _;
  char b;
  cin >> _ >> b;
  cout << 'A' << b << 'C' << endl;

}

Measured memory_bytes: 256
import itertools

input = raw_input
n, m, x = map(int, input().split(" "))

inputs = []
for _ in range(n):
    input_ = map(int, input().split(" "))
    inputs.append(input_)


first = True
min_cost = None
for ui, uses in enumerate(list(itertools.product(*(tuple([[True, False]] * n))))):
    cur_cost = 0
    a_list = [0 for _ in range(m)]
    for i in range(n):
        if uses[i]:
            cur_input = inputs[i]
            c = cur_input[0]
            cur_cost += c
            for ai, a in enumerate(cur_input[1:]):
                a_list[ai] += a


    if first or min_cost > cur_cost:
        count = 0
        ok = True
        for ai, a in enumerate(a_list):
            if a < x:
                ok = False
                break

        if ok:
            first = False
            min_cost = cur_cost

if min_cost is None:
    min_cost = -1
print(min_cost)



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

int main() {
  int a, b;
  char op;

  while (true) {
    cin >> a >> op >> b;
    if (op == '?') {
      break;
    } else if (op == '+') {
      cout << a + b << endl;
    } else if (op == '-') {
      cout << a - b << endl;
    } else if (op == '*') {
      cout << a * b << endl;
    } else if (op == '/') {
      cout << a / b << endl;
    }
  }
  return 0;
}



Measured memory_bytes: 3116
#include <iostream>
#include <cstdio>
#include <iomanip>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <bitset>
#include <stack>
#include <utility>
#include <numeric>
#include <algorithm>
#include <functional>
#include <cctype>
#include <complex>
#include <string>
#include <sstream>
#include <cassert>
using namespace std;

//common
typedef long long ll;
// using i32=int;using i64=long long;using ll =i64;
// using uint=unsigned int;using ull=unsigned long long;
// template<typename T> using matrix=vector<vector<T> >;

#define BR "\n"
#define ALL(c) (c).begin(),(c).end()
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define EACH(it,o) for(auto it = (o).begin(); it != (o).end(); ++it)
#define IN(l,v,r) ((l)<=(v) && (v)<(r))

//config
//#undef NDEBUG
//#define INF 1<<30
//#define EPS 1e-8
//const ll MOD =100000007;

//debug
#ifdef NDEBUG
#define DUMP(x)
#define DUMPLN(x)
#define DEBUG(x)
#define DEBUGLN(x)
#define LINE()
#define LINELN()
#define CHECK(exp,act)
#define STOP(e)
#else
#define DUMP(x)  cerr << #x << " = " << (x)
#define DUMPLN(x)  DUMP(x) <<endl
#define DEBUG(x) DUMP(x) << LINE() << " " << __FILE__
#define DEBUGLN(x) DEBUG(x)<<endl
#define LINE()    cerr<< " (L" << __LINE__ << ")"
#define LINELN()    LINE()<<endl
#define CHECK(exp,act)  if(exp!=act){DUMPLN(exp);DEBUGLN(act);}
#define STOP(e)  CHECK(e,true);if(!(e)) exit(1);
#endif

template<class T> inline string toString(const vector<T>& x) {
	stringstream ss;
	REP(i,x.size()){
		if(i!=0)ss<<" ";
		ss<< x[i];
	}
	return ss.str();
}

template<class T> inline string toString(const vector<vector<T> >& map) {
	stringstream ss;
	REP(i,map.size()){
		if(i!=0)ss<<BR;
		ss<< toString(map[i]);
	}
	return ss.str();
}
template<class K,class V>  string toString(map<K,V>& x) {
	string res;stringstream ss;
	for(auto& p:x)ss<< p.first<<":" << p.second<<" ";
	return ss.str();
}

string BITtoString(int bit){
    stringstream ss;
    while(bit!=0){ss<<(bit%2);bit/=2;}
    string res=ss.str();reverse(ALL(res));
    return res;
}

template<typename T,typename V> inline T mod(T v,V MOD){
	return (v%MOD+MOD)%MOD;
}

class Main{
public:
	void run(){
		while(true){
			int N;cin >>N;
			if(N==0)break;
			vector<int> xs(N),ys(N);
			REP(i,N) cin >>xs[i] >>ys[i];

			set<pair<int,int> > ex;REP(i,N)ex.insert(make_pair(xs[i],ys[i]));
			int Mv=0;
			REP(i,N)REP(j,N){
				if(i==j)continue;
				{
					int chx0=xs[i]-(ys[i]-ys[j]),chy0=ys[i]+(xs[i]-xs[j]);
					int chx1=xs[j]-(ys[i]-ys[j]),chy1=ys[j]+(xs[i]-xs[j]);
					if(ex.count(make_pair(chx0,chy0))>0 &&ex.count(make_pair(chx1,chy1))>0){
						Mv=max(Mv,(ys[i]-ys[j])*(ys[i]-ys[j])+(xs[i]-xs[j])*(xs[i]-xs[j]));
					}
				}
				{
					int chx0=xs[i]-(ys[j]-ys[i]),chy0=ys[i]+(xs[j]-xs[i]);
					int chx1=xs[j]-(ys[j]-ys[i]),chy1=ys[j]+(xs[j]-xs[i]);
					if(ex.count(make_pair(chx0,chy0))>0 &&ex.count(make_pair(chx1,chy1))>0){
						Mv=max(Mv,(ys[i]-ys[j])*(ys[i]-ys[j])+(xs[i]-xs[j])*(xs[i]-xs[j]));
					}
				}
			}
			cout <<Mv<<endl;
		}
	}
};
int main(){
  	Main().run();
  	return 0;
 }

Measured memory_bytes: 1368
n, m = map(int, input().split())
if n == 1:
    if m == 1:
        print(1)
    else:
        print(m-2)
    exit()
if m == 1:
    if n == 1:
        print(1)
    else:
        print(n-2)
    exit()
print((n-2) * (m-2))


Measured memory_bytes: 2940
#include <iostream>
#include <algorithm>

using namespace std;


int main()
{
    int N, L[10];
    cin >> N;

    int max_i = 0;
    for (int i = 0; i < N; i++) {
        cin >> L[i];
        if (L[max_i] < L[i])
            max_i = i;
    }

    int acc =0;
    for (int i = 0; i < N; i++) {
        if (max_i != i)
            acc += L[i];
    }
    if (acc > L[max_i])
        cout << "Yes";
    else
        cout << "No";
    cout << endl;

    return 0;
}

Measured memory_bytes: 256
n = int(input())

h = [int(i) for i in input().split()]

result = 0
tmp = 0
h.append(h[-1] + 1)

for i in range(n):
    if h[i] >= h[i+1]:
        tmp += 1
    else:
        if result < tmp:
            result = tmp
        tmp = 0
print(result)

Measured memory_bytes: 14252
#include<stdio.h>
#include<stdlib.h>

int main(void){

  int a,b,out1,out2;

  scanf("%d%d",&a,&b);

  if(1>a || a>100)exit(0);
  if(1>b || b>100)exit(0);

  out1 = a*b;
  out2 = a+a+b+b;

  printf("%d %d\n",out1,out2);

  return 0;
}

Measured memory_bytes: 1812
#include <cstdio>
#include <iostream>
#include <string>
#include <algorithm>
#include <utility>
#include <queue>
#include <stack>
#include <string>
#include <cstring>
#include <cmath>
#include <map>
#include <vector>
#include <array>
#include <set>
#include <climits>
#include <sstream>
#include <iomanip>
#include <cassert>
#include <bitset>
#include <numeric>
using namespace std;
#define MOD 1000000007
#define MAXN 101
int H , W;
int arr[MAXN][MAXN];
string grid[MAXN];
int main(void){
#ifdef HELL_JUDGE
    freopen("input","r",stdin);
    freopen("output","w",stdout);
    freopen("error","w",stderr);
#endif 
    scanf("%d%d",&H,&W);
    for(int i=0;i<H;++i){
        cin>>grid[i];
    }
    for(int i=0;i<H;++i){
        for(int j=0;j<W;++j){
            if(i==0 && j==0){
                arr[i][j] = (grid[i][j]=='#');
                continue;
            }
            arr[i][j] = INT_MAX;
            if(i!=0){
                arr[i][j] = min(arr[i][j] , arr[i-1][j]+(grid[i-1][j]=='.' && grid[i][j]=='#'));
            }
            if(j!=0){
                arr[i][j] = min(arr[i][j] , arr[i][j-1]+(grid[i][j-1]=='.' && grid[i][j]=='#'));
            }
        }
    }
    printf("%d",arr[H-1][W-1]);
    return 0;
}

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

int N, M;
const int MAX_N = 200005, MAX_M = 200005;
std::vector<int> adj[MAX_N];
int posts[MAX_N];
bool seen[MAX_N];

int main() {
  scanf("%d %d", &N, &M);
  for (int i = 0; i < M; ++i) {
    int a, b;
    scanf("%d %d", &a, &b);
    a--; b--;
    adj[a].push_back(b);
    adj[b].push_back(a);
  }
  std::deque<std::pair<int, int>> q;
  q.push_back({0, -1});
  int count = 0;
  while (!q.empty()) {
    auto next = q.front();
    q.pop_front();
    if (seen[next.first]) continue;
    count++;
    seen[next.first] = true;
    if (next.second >= 0) {
      posts[next.first] = next.second;
    }
    for (int nn : adj[next.first]) {
      q.push_back({nn, next.first});
    }
  }
  if (count == N) {
    printf("Yes\n");
    for (int i = 1; i < N; ++i)
      printf("%d\n", posts[i] + 1);
  } else {
    printf("No\n");
  }
}


Measured memory_bytes: 14812
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1LL << 60;
ll MOD = 1000000000 + 7;

int main() {
    int n, m;
    cin >> n >> m;
    vector<tuple<int, int, int, int>> data(m);  // p,y,order,city
    for (int i = 0; i < m; i++) {
        int p, y;
        cin >> p >> y;
        data[i] = {p, y, 0, i};
    }
    vector<int> cnt(n + 1, 0);
    sort(data.begin(), data.end());
    for (int i = 0; i < m; i++) {
        get<2>(data[i]) = (++cnt[get<0>(data[i])]);
    }
    vector<pair<int, int>> id(m);  // p,order
    for (int i = 0; i < m; i++) {
        id[get<3>(data[i])] = {get<0>(data[i]), get<2>(data[i])};
        // cout << get<3>(data[i]) << " " << get<0>(data[i]) << " "
        //      << get<2>(data[i]) << endl;
    }
    for (int i = 0; i < m; i++) {
        cout << setw(6) << right << setfill('0') << id[i].first;
        cout << setw(6) << right << setfill('0') << id[i].second << endl;
    }
    return 0;
}

Measured memory_bytes: 5896
#include <bits/stdc++.h>
using namespace std;
#define watch(x) cout << (#x) << " is " << (x) << '\n'
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pi;
typedef pair<ll, ll> pll;
typedef double db;
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a; }
//head
 
void solve(){
    int x, a;
    cin >> x >> a;
    if (x < a) cout << 0;
    else cout << 10;
    cout << '\n';
}

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

    //int t; cin >> t; while (t--)
        solve();
}

Measured memory_bytes: 3664
//負閉路中の変化量が小さく、元のD[n−１]が大きいと、ベルマンフォード二回回し程度ではD[n-1]が更新されない!
//1から到達できる かつ nに到達できる 頂点集合をチェック、そこで更新が止まらなければ負閉路あり
#include<bits/stdc++.h>
using namespace std;
int INF=5e8;

int main(){
  int n,m,p,a,b,c;
  set<tuple<int,int,int>> E;
  cin>> n >> m >> p;
  for (int i=0; i<m; i++){
    cin>> a >> b >> c;
    E.insert(make_tuple(a-1,b-1,p-c));
  }
  
  vector<int> go(n,INF); go[0]=0;
  for (int i=0; i<n-1; i++){ //順方向ベルマンフォード
    for (auto e: E){
      tie(a,b,c)=e;
      if (go[a]==INF) continue; //1からiに到達できればgo[i]!=INF
      if (go[b]>go[a]+c) go[b]=go[a]+c;
    }
  }
  
  vector<int> back(n,INF); back[n-1]=0;
  for (int i=0; i<n-1; i++){ //逆方向ベルマンフォード
    for (auto e: E){
      tie(a,b,c)=e;
      if (back[b]==INF) continue; //iからnに到達できればgo[i]!=INF
      if (back[a]>back[b]+c) back[a]=back[b]+c;
    }
  }
  
  bool inf=false;
  for (auto e: E){
    tie(a,b,c)=e;
    if (go[a]==INF || back[b]==INF) continue;
    if (go[b]>go[a]+c){inf=true; break;}
  }
  
  if (inf) cout<<-1<<endl;
  else cout<<max(0,-go[n-1])<<endl;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define forE(i,x) for(int i=head[x];i!=-1;i=ne[i])
using namespace std;
typedef long long i64;
typedef unsigned long long u64;
typedef unsigned u32;
typedef pair<int,int> pin;
#define mk(a,b) make_pair(a,b)
#define lowbit(x) ((x)&(-(x)))
#define sqr(a) ((a)*(a))
#define clr(a) (memset((a),0,sizeof(a)))
#define ls ((x)<<1)
#define rs (((x)<<1)|1)
#define mid (((l)+(r))>>1)
#define pb push_back
#define w1 first
#define w2 second
inline void read(int &x){
	x=0;int f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	x*=f;
}
inline void judge(){
	freopen("in.txt","r",stdin);
	freopen("out.txt","w",stdout);
}
/*******************************head*******************************/
const int maxn=2005;
int n,k,f[maxn][maxn][2];
const int mod=1e9+7;
inline void add(int &x,int y){
	x=(x+y)>=mod?(x+y-mod):(x+y);
}
int main(){
	read(n);read(k);f[n+1][0][0]=1;
	per(i,n+1,2)per(j,n+1-i,0){
		add(f[i][j][0],f[i][j+1][0]);
		rep(x,0,1){
			add(f[i-1][j+1][1],f[i][j][x]);
			add(f[i-1][j][0],f[i][j][x]);
		}
	}int ans=f[1][n-k][0];
	rep(i,1,n-k-1)ans=1ll*ans*2%mod;
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 31104
n = int(input())
s = set()
for i in range(1, 32):
    s.add(i ** 2)

for i in range(1, 11):
    s.add(i ** 3)

for i in range(1, 7):
    s.add(i ** 4)

for i in range(1, 5):
    s.add(i ** 5)
    s.add(i ** 6)
    s.add(i ** 7)
    s.add(i ** 8)
    s.add(i ** 9)
    s.add(i ** 10)

t = list(s)
t.sort()
t = [x for x in t if x <= 1000]

res = 0
for tt in t:
    res = tt if tt <= n else res
print(res)

Measured memory_bytes: 9192
import java.io.IOException;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws IOException {
		Scanner scanner = new Scanner(System.in);
		String string = scanner.nextLine();
		boolean flag = true;
		for(int i = 0; i < string.length(); i++){
			char x = string.charAt(i);
			if(string.indexOf(x,i+1) != -1){
				System.out.println("no");
				flag = false;
				break;
			}
		}
		if(flag){
			System.out.println("yes");
		}
	}
}


Measured memory_bytes: 23764
#include<iostream>
#include<string>
using namespace std;
int main(){
  string s;
  int cnt[30]={};
  cin >> s;
  for(int i=0;i<4;i++){
    cnt[s[i]-'A']++;
  }
  for(int i=0;i<='Z'-'A';i++){
    if(cnt[i]!=0&&cnt[i]!=2){
      cout << "No\n";
      return 0;
    }
  }
  cout <<"Yes\n";
}


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

#define rep(i,n) for(int i=0 ; i<(n) ; i++)
#define repr(i,n) for(int i=(n) ; i>=0 ; i--)
#define ALL(x) (x).begin(),(x).end()

typedef long long ll;
typedef unsigned long long ull;
 
const ll INF = 1LL<<60;
const int MINF = 1e9;
const int MOD = 1e9+7;

using vi = vector<int>;
using vii = vector<vi>;

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 (a > b) { a = b; return true; } return false; }

template<typename T>
T GCD(T a,T b){ return b ? GCD(b,a%b) : a ;}
template<typename T>
T LCM(T a,T b){ return a*b / GCD(a,b) ;}

int main(){
    int h,n;cin >> h >> n;
    vi a(n);
    rep(i,n)cin >> a[i];
    for(int i=0;i<n;i++){
        h -= a[i];
        if(h <= 0)break;
    }
    if(h <= 0)cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 640
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoders {
	class Program {
		static void Main(string[] args) {

			var S = Console.ReadLine();
			var Q = int.Parse(Console.ReadLine());

			var l = new LinkedList<string>();
			foreach (var item in S) {
				l.AddLast(item.ToString());
			}

			//反転フラグ
			Boolean hantenFlag = false;
			for (int i = 0; i < Q; i++) {
				var inputArray = Console.ReadLine().Split(' ');

				
				// 最初に与えられるのは1か2のみ
				if (int.Parse(inputArray[0]) == 1) {
					//1が与えられたときは反転フラグを逆にする
					hantenFlag = !hantenFlag;
				}
				else {
					//要素が足りない場合はエラーメッセージ
					if (inputArray.Length < 3) {
						Console.WriteLine("不正な入力");
						return;
					}

					//反転フラグがFlaseのときは、1の時に前にたす　trueのときは2の時まえにたす
					if ((int.Parse(inputArray[1]) == 1 & hantenFlag == false) | (int.Parse(inputArray[1]) == 2 & hantenFlag == true)) {
						l.AddFirst(inputArray[2]);
					}
					else {
						l.AddLast(inputArray[2]);
					}

				}

			}

		var fin = new List<string>();
			if (hantenFlag) {
				 fin =l.Reverse().ToList();
			}
			else {
				fin = l.ToList();
			}

			var sb = new StringBuilder();
			foreach (var item in fin) {
				sb.Append(item);
			}
		Console.WriteLine(sb.ToString());

		}

		
	}
}


Measured memory_bytes: 49568
N = int(input())
arr = list(map(int, input().split()))
if N == 0:
    print(1 if arr[0]==1 else -1)
    exit()
elif arr[0] != 0:
    print(-1)
    exit()
sum_arr = [arr[-1]]*N
for i in range(1,N):
    sum_arr[i] = sum_arr[i-1]+arr[N-i]
sum_arr = sum_arr[::-1]
ans = [1]*(N+1)
for i in range(1,N+1):
    if ans[i-1]-arr[i-1] < 0:
        print(-1)
        exit()
    tmp = min((ans[i-1]-arr[i-1])*2,sum_arr[i-1])
    ans[i] = tmp
for i in range(min(25,N+1)):
    if ans[i] > 2**i:
        print(-1)
        exit()
if ans[N] != arr[-1]:
    print(-1)
    exit()
print(sum(ans))

Measured memory_bytes: 22356
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#define il inline
#define ri register
#define ll long long
using namespace std;
struct point{
    point*next;int to;
}*t,*head[100001];
ll ans;
int dep[100001],s[100001],
    u,v,rl,check,te[100001],
    round[100001],rt;
il int Abs(int);
il void read(int&),link(int,int);
void dfs1(int,int),dfs2(int,int),dfs3(int,int);
int main(){
    int n,m,i,j,k;read(n),read(m);
    for(i=1;i<=m;++i)read(j),read(k),link(j,k);
    s[0]=-1,dfs1(1,0);
    if(m==n-1){
        if(check)puts("-1"),exit(0);
        dfs2(1,0),printf("%lld",ans);return 0;
    }
    else if(rl&1){
        if(check&1)puts("-1"),exit(0);
        check/=2,ans+=Abs(check);
        s[u]-=check,s[v]-=check,dfs2(1,0);
        printf("%lld",ans);return 0;
    }
    else{
        if(check)puts("-1"),exit(0);
        te[u]=1,te[v]=-1,dfs3(1,0);
        round[++rt]=0,sort(round+1,round+rt+1);
        j=round[rt+1>>1];
        for(i=1;i<=rt;++i)ans+=Abs(round[i]-j);
        printf("%lld",ans);
    }
    return 0;
}
void dfs3(int x,int pa){
    for(point*i(head[x]);i!=NULL;i=i->next)
        if(i->to!=pa)
            dfs3(i->to,x),s[x]+=s[i->to],
                te[x]+=te[i->to];
    if(te[x])round[++rt]=te[x]*s[x];
    else ans+=Abs(s[x]);
}
void dfs2(int x,int pa){
    for(point*i(head[x]);i!=NULL;i=i->next)
        if(i->to!=pa)
            dfs2(i->to,x),s[x]+=s[i->to];
    ans+=Abs(s[x]);
}
void dfs1(int x,int pa){
    dep[x]=dep[pa]+1,s[x]=~s[pa]+1,check+=s[x];
    for(point*i(head[x]);i!=NULL;i=i->next)
        if(i->to!=pa){
            if(dep[i->to])
                u=x,v=i->to,rl=Abs(dep[x]-dep[i->to])+1,
                    i->to=pa;
            else dfs1(i->to,x);
        }
}
il int Abs(int x){
    return x<0?-x:x;
}
il void link(int i,int j){
    t=new point,t->next=head[i],head[i]=t,t->to=j;
    t=new point,t->next=head[j],head[j]=t,t->to=i;
}
il void read(int&x){
    x&=0;ri char c;while(c=getchar(),c<'0'||c>'9');
    while(c>='0'&&c<='9')x=(x<<1)+(x<<3)+(c^48),c=getchar();
}


Measured memory_bytes: 13568
// Aizu 1617: Almost Identical Programs
// 2017.9.21 bal4u@uu

#include <stdio.h>
#include <string.h>

char a[205], b[205];

int main()
{
	int k, ans;
	char *p, *q, *wp, *wq;
	char *s[3] = { "IDENTICAL", "CLOSE", "DIFFERENT" };

	while (scanf("%s", a) && a[0] != '.') {
		scanf("%s", b); p = a, q = b; ans = -1, k = 0;
		while (*p && *q) {
			if (*p != *q) { ans = 2; break; }
			if (*p == '"') { wp = ++p, wq = ++q;
				while (*p != '"') p++;
				while (*q != '"') q++;
				*p = *q = 0;
				k += 1 - (strcmp(wp, wq) == 0);
				if (k > 1) { ans = 2; break; }
			}
			p++, q++;
		}
		if (ans < 0) if (*p == *q) ans = k; else ans = 2;
		puts(s[ans]);
	}
	return 0;
}

Measured memory_bytes: 1680
from collections import deque


n, d, a = map(int, input().split())
monsters = []
for _ in range(n):
    pos, hp = map(int, input().split())
    monsters.append([pos, hp])

monsters.sort()

bomb_area = deque([])
bomb_power = deque([])
total_damage = 0
ans = 0
for pos, hp in monsters:
    while bomb_area:
        area = bomb_area[0]
        if area < pos:
            bomb_area.popleft()
            power = bomb_power.popleft()
            total_damage -= power
        else:
            break
    if hp <= total_damage:
        continue
    else:
        count = (hp-total_damage + a-1) // a
        ans += count
        power = a * count
        total_damage += power
        bomb_area.append(pos+2*d)
        bomb_power.append(power)

print(ans)

Measured memory_bytes: 45244
let s = read_int ()
let f n = if n mod 2 = 0 then n / 2 else 3 * n + 1
let cs, p = Array.make 1000001 0, ref s
let _ = cs.(s) <- 1; for i = 2 to 1000000 do p := f !p; if cs.(!p) = 0 then cs.(!p) <- 1 else (Printf.printf "%d\n" i; exit 0) done

Measured memory_bytes: 10624
#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector< ll > vi;
typedef vector< vi > vvi;
typedef pair< ll,ll > ii;
#define fr(i,a,b) for(ll i=a;i<=b;i++)
#define rfr(i,a,b) for(ll i=a;i>=b;i--)
#define tr(x,i) for(vi::iterator i = x.begin() ; i != x.end() ; i++)
#define sz(a) ll((a).size())
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())
#define T ll t;cin>>t;while(t--)
ll powmod(ll a,ll b){ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
signed main() 
{
	ios_base::sync_with_stdio(false); 
	cin.tie(NULL);
	ll l;
	ld a,b,h;
	cin>>l;
	a = b = h = ( ld )l/3;
	printf("%Lf", a*b*h);

}


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

ans = 0
for a in [-1, 1]:
    for b in [-1, 1]:
        for c in [-1, 1]:
            s = []
            for x, y, z in X:
                s.append(a*x + b*y + c*z)
            s.sort(reverse=1)
            ans = max(ans, sum(s[:M]))

print(ans)

Measured memory_bytes: 3316
import scala.collection.mutable
import java.io.{BufferedReader, InputStreamReader}

object Main extends App {

  val in = new BufferedReader(new InputStreamReader(System.in))
  val Array(a, b, c, d, e, f) = in.readLine.split(" ").map(_.toInt)
  // 入れる水の量 100a 100b
  // 入れる砂糖の量 c d
  // 100gあたりとける量 e
  // ビーカーに入る量 f
  // 濃度 0% の砂糖水 : water > 0 , sugar >= 0
  val water = {
    val set = mutable.HashSet[Int]()
    for {
      i <- 0 to f/(a*100)
      j <- 0 to f/(b*100)
      w = 100 * a * i + 100 * b * j
      if 0 < w && w <= f
    } set += w
    set
  }
  val sugar = {
    val set = mutable.HashSet[Int]()
    for {
      i <- 0 to (f-100)/c
      j <- 0 to (f-100)/d
      w = c * i + d * j
      if w <= f
    } set += w
    set
  }

  // println(water.length + " " + sugar.length)

  val ans = {
    var max = (-1d, 0, 0)
    for {
      w <- water
      wd = w.toDouble/100d
      s <- sugar
      weight = w + s
      concent = s.toDouble / wd
      if weight <= f && concent <= e
    } {
      if(concent > max._1) {
        // println(weight + " " + concent)
        max = (concent, weight, s)
      }
    }
    max
  }
  
  println(ans._2 + " " + ans._3)
}

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

#define dump(x) cout << (x) << '\n'
#define Int int64_t
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
 
Int INF = 1e18;
int inf = 1e9;
Int mod = 1e9+7;

Int n;
vector<string> res;

void rec(string s, Int x) {
    if ((Int)s.size() == n) {
        res.push_back(s);
        return;
    }
    for (Int i = 0; i < x + 1; i++) {
        char c = 'a';
        s += (c + i);
        rec(s, max(x, i + 1));
        s.pop_back();
    }
}

int main() {
    cin >> n;
    vector<Int> v;
    rec("a", 1);
    sort(all(res));
    for (Int i = 0; i <(Int)res.size(); i++) {
        dump(res[i]);
    }
    return 0;
}

Measured memory_bytes: 9332
#include <iostream>
#include <string>
#include <string.h>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <stdio.h>
#include <vector>
#define int long long
#define endre getchar();getchar();return 0
#define moder 1000000007
#define inf 1000000000000000000
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define P pair<int,int>
#define all(v) v.begin(),v.end()
#define prique(T) priority_queue<T,vector<T>,greater<T>>
#define vecunique(vec) sort(vec.begin(), vec.end());decltype(vec)::iterator result = std::unique(vec.begin(), vec.end());vec.erase(result, vec.end())
using namespace std;

bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x * y / gcd(x, y);
}
int mod_pow(int x, int y, int mod) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x%mod;
		}
		x = x * x%mod;
		y >>= 1;
	}
	return res;
}
int kai(int x) {
	if (x == 0)return 1;
	return (kai(x - 1)*x) % moder;
}
int comb(int x, int y) {
	return kai(x)*mod_pow(kai(x - y), moder - 2, moder) % moder*mod_pow(kai(y), moder - 2, moder) % moder;
}
struct edge { int to, cost; };
int dx[5] = { 0,1,0,-1 }, dy[5] = { 1,0,-1,0 };
map<int, int>factor(int x) {
	map<int, int>res;
	for (int i = 2; i*i <= x; i++) {
		while (x%i == 0) {
			x /= i;
			res[i]++;
		}
	}
	if (x != 1)res[x]++;
	return res;
}
/*--------Library Zone!--------*/


signed main() {
	int n, k;
	cin >> n >> k;
	if (n % 2) {
		if (n / 2 + 1 >= k)cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	else {
		if (n / 2 >= k)cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	endre;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            //[summary]C - Unification
            string s = Console.ReadLine();

            int zeros = s.Count(x => x == '0');
            int ones = s.Length - zeros;

            if (zeros > ones)
            {
                Console.WriteLine(ones * 2);
            }
            else
            {
                Console.WriteLine(zeros * 2);
            }
        }
    }
}

Measured memory_bytes: 11360
#!/usr/bin/env python3
def YesNo(T):
    if T:
        print('Yes')
    else:
        print('No')

S = input()
T = input()
flag = True
for i in range(len(S)):
    if S[i] != T[i]:
        print("No")
        flag = False
        break
if flag and len(S) == len(T)-1:
    print("Yes")

Measured memory_bytes: 9116
#include<iostream>
#include<climits>
#include<vector>
#include<list>
#include<functional>
#include<algorithm>
#include<string>
#include<cmath>
#include<complex>
#include<set>
#include<map>
#include<stack>
#include<queue>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

class question {
public:
	string S;
	int ctoi(char c) {
		return c - '0';
	}
	void ans() {
		cin >> S;
		int res = INT_MAX;
		REP(i, S.size() - 2) {
			res = min(res, abs(753 - (100 * ctoi(S[i]) + 10 * ctoi(S[i + 1]) + ctoi(S[i + 2]))));
		}
		cout << res << "\n";
	}
};

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

	question q;
	q.ans();

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n,i,j,k,max,ans; 
cin >>n;
max=0;
vector<int>  h(n);
for(i=0;i<n;i++)
{
cin >> h.at(i);
}
for(i=0;i<n;i++)
{
if(max<=h.at(i))
   {
    ans++;
     max=h.at(i);
   }
}
cout << ans <<endl;
}





Measured memory_bytes: 256
n,q=map(int,input().split())
es=[[] for i in range(n)]
rank=[-1]*n
rank[0]=0
for i in range(n-1):
    a,b=map(int,input().split())
    es[a-1].append(b-1)
    es[b-1].append(a-1)

px=[0]*n
for i in range(q):
    p,x=map(int,input().split())
    px[p-1]+=x

score=[0]*n
score[0]=px[0]
from collections import deque
que=deque([0])
while que:
    s=que.popleft()
    for g in es[s]:
        if rank[g]==-1:
            rank[g]=rank[s]+1
            score[g]=score[s]+px[g]
            que.append(g)
print(*score)

Measured memory_bytes: 127024
package main

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

func main() {
  sc := bufio.NewScanner(os.Stdin)
  sc.Scan()
  strArr := strings.Split(sc.Text(), " ")
  A, _ := strconv.Atoi(strArr[0])
  B, _ := strconv.Atoi(strArr[1])
  C, _ := strconv.Atoi(strArr[2])
  v := 0
  for i:=0; i<100; i++ {
    v = (v+A) % B
    if v == C {
      fmt.Println("YES")
      return
    }
  }
  fmt.Println("NO")
  return
}


Measured memory_bytes: 640