akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int>pii;
typedef pair<ll,ll>pll;
mt19937 rng(chrono::system_clock::now().time_since_epoch().count());
const int mn=1e2+10;
string s[mn];
int dp[mn][mn];
int main(){
    int n,m;
    scanf("%d%d",&n,&m);
    for(int i=0;i<n;i++)cin>>s[i];
    memset(dp,0x3f,sizeof(dp));
    dp[0][0]=(s[0][0]=='#');
    for(int i=0;i<n;i++)for(int j=0;j<m;j++){
            if(i)dp[i][j]=min(dp[i][j],dp[i-1][j]+(s[i][j]=='#'&&s[i-1][j]=='.'));
            if(j)dp[i][j]=min(dp[i][j],dp[i][j-1]+(s[i][j]=='#'&&s[i][j-1]=='.'));
    }
    printf("%d",dp[n-1][m-1]);
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>
// *テンプレート*
#define int long long
#define rep(i, n) for (int i = 0; i < (n); i++)
#define P pair<int, int>
#define sz(x) x.size()
// aよりbの方が小さかったら、aの値をbの値に置き換える。(swapではない！)
template<class T> inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
// aよりbの方が大きかったら、aの値をbの値に置き換える。
template<class T> inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}

using namespace std;
typedef long long ll;
using Graph = vector<vector<int>>;
//最大公約数
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	return gcd(b, a % b);
}
//最小公倍数
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
// 素数かどうか判定
bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}

const long long MOD = 1000000007;
const long long INF = 1LL << 60;
// *テンプレートここまで*

// pair -> vector<pair<int,int>> 
//		   AandB.push_back(make_pair(a[i],b[i]))



signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n; cin >> n;
	vector<int>p(n); rep(i, n)cin >> p[i];
	int ans = 0;
	rep(i, n - 2) {
		if ((p[i] < p[i + 1] && p[i + 1] < p[i + 2]) || (p[i] > p[i+1] && p[i+1]>p[i+2])) {
			ans++;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(v) v.begin(), v.end()
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; }

#include <bits/stdc++.h>
using namespace std;

int C[55][55]={0};
int W,H;

const int dx[8]={1,1,0,-1,-1,-1,0,1};
const int dy[8]={0,1,1,1,0,-1,-1,-1};

void dfs(int h,int w){
  C[h][w]=0;
  
  rep(i,8){
    int nh=h+dy[i];
    int nw=w+dx[i];
    
    if(nh<0 || nh>=H || nw<0 || nw>=W) continue;
    if(C[nh][nw]==0) continue;
    
    dfs(nh,nw);
  }
}

int main(){
  
  while(cin>>W>>H){
    if(W==0 && H==0) return 0;
    
    int cnt=0;
    rep(i,H){
      rep(j,W) cin>>C[i][j];
    }
    
    rep(i,H){
      rep(j,W){
        if(C[i][j]==0) continue;
        dfs(i,j);
        cnt++;
      }
    }
    
    cout<<cnt<<endl;
  }
  
  return 0;
}


Measured memory_bytes: 3164
from fractions import gcd


# 最小公倍数はGCDを使って算出できる
def lcm(a, b):
    return int(a * b / gcd(a, b))


A, B, C, D = map(int, input().split())

# B以下の整数のうち、CでもDでも割り切れないものの個数
cnt_B = B - (B // C + B // D) + B // lcm(C, D)

# A - 1以下の整数のうち、CでもDでも割り切れないものの個数
A_1 = A - 1
cnt_A = A_1 - (A_1 // C + A_1 // D) + A_1 // lcm(C, D)

print(cnt_B - cnt_A)


Measured memory_bytes: 5048
/* Isn't passion overrated?*/

#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define ll long long
#define mod 1000000007
using namespace std;
ll gcd(ll a, ll b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}
int main()
{
    ios_base:: sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
    ll n;
    string s;
    cin>>n>>s;
    ll m = s.size();
    for(ll i = 0; i <min(m,n); i++)
        cout<<s[i];
    if(m > n)
        cout<<"...";
    return 0;
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
#pragma GCC optimize ("-O3")
using namespace std;

// repr(i,10,13) -> 10,11,12
#define repr(i,a,b) for(int i=a;i<b;i++)
// rep(i,3) -> 0,1,2
#define rep(i,n) for(int i=0;i<n;i++)
// reprrev(i,10,13) -> 12,11,10
#define reprrev(i,a,b) for(int i=b-1;i>=a;i--)
// reprev(i,3) -> 2,1,0
#define reprev(i,n) reprrev(i,0,n)
using ll = long long;
template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }

int dx[] = {1, -1, 0, 0};
int dy[] = {0, 0, 1, -1};
const int inf = 1 << 29;
typedef tuple<int, int> T;
void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }

void _main() {
    ll x = 1, y = 1;
    cin >> x >> y;
    int i = 0;
    ll num = x;
    while (num <= y) {
        i++;
        num = num * 2;
    }
    cout << i << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
double PI = acos(-1);
int main() {
    int a, b, V;
    cin >> a >> b >> V;
    double ans;
    if (a*a*b >= 2*V){
        double x = 2.0*V/(a*b);
        ans = atan(b/x);
    } else {
        double x = 2.0*(b-1.0*V/(a*a));
        ans = atan(x/a);
    }
    ans *= 180/PI;
    printf("%.6lf\n", ans);
    return 0;
}

Measured memory_bytes: 256
import sys


def print_arr(arr):
    ln = ''
    for v in arr:
        ln += str(v) + ' '

    ln = ln.strip()
    print(ln)

def insertion_sort(arr):
    for i in range(1, len(arr)):
        print_arr(arr)
        v = arr[i]
        j = i-1
        while j >= 0 and arr[j] > v:
            arr[j+1] = arr[j]
            j -= 1
        arr[j+1] = v

    print_arr(arr)

input0 = sys.stdin.readline()
input_sample = sys.stdin.readline()
# input_sample = "5 2 4 6 1 3"
input = input_sample.split(" ")
input = [int(i) for i in input]
insertion_sort(input)

Measured memory_bytes: 7756
// Vicfred
// https://atcoder.jp/contests/abc158/tasks/abc158_c
// implementation
import std.stdio;

void main() {
    int a, b;
    readf("%s %s", &a, &b);
    for(int i = 1; i < 1010; i++) {
        if(i/10 == b && a == (i*8)/100) {
            i.writeln;
            return;
        }
    }
    (-1).writeln;
}



Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<climits>
#include<cstdlib>
#include<map>
#include<math.h>
#include<utility>
using namespace std;
typedef long long ll;

int main(){
  int n;
  cin >> n;
  int c[510], s[510], f[501];
  for(int i=0; i<n-1; i++) cin >> c[i] >> s[i] >> f[i];

  ll ans[510];
  for(int j=0; j<n; j++){
    int now=0;
    for(int i=j; i<n-1; i++){
      if(now < s[i]) now = s[i];
      if(now%f[i] != 0) now += f[i] - now%f[i];
      now += c[i];
    }
    ans[j] = now;
  }
  for(int i=0; i<n; i++){
    cout << ans[i] << endl;
  }
}



Measured memory_bytes: 256
n, m = list(map(int, input().split()))
x = list(map(int, input().split()))

if n >= m:
    print(0)
else:
    x.sort()
    y = [x[i+1]-x[i] for i in range(m-1)]
    z = sorted(y, reverse=True)
    a = []
    cnt = 0
    for i in range(n-1):
        dif = z.pop(0)
        idx = y.index(dif)
        a.append(idx)
    a.sort()
    x0 = x[0]
    for ai in a:
        cnt += x[ai] - x0
        x0 = x[ai+1]
    cnt += x[-1] - x0
    print(cnt)
        

Measured memory_bytes: 13960
#include<iostream>
#include<string>
using namespace std ;
int main()
{ 
	string s ;
int j =0,x;
cin>>s;
if(s[0]!='A')
{
	cout<<"WA";
	return 0;
}
else 
{
		if(s[1]>=65&&s[1]<97)
		{
		cout<<"WA";
		return 0;
		}
	
	else
	{
		for(int i=2;i<s.length()-1;i++)
		{
			if(s[i]=='C')
			{
				x=i;
				j+=1;
			}
		}
		if(j>1||j==0)
		{
			cout<<"WA";
			return 0;
		}
		else 
		{
			for(int i=2;i<s.length();i++)
			{
					if(s[i]<97&&i!=x)
					{
						cout<<"WA";
						return 0;
					}
					
				}

			}
		}
	}
cout<<"AC";
return 0;
}

Measured memory_bytes: 256
N,K=map(int,input().split())
B=[0 for i in range(N)]
for i in range(K):
  d=int(input())
  A=list(map(int,input().split()))
  for j in range(d):
    B[A[j]-1]+=1
count=0
for i in range(N):
  if B[i]==0:
    count+=1
print(count)
   

Measured memory_bytes: 9056
#include<bits/stdc++.h>
using namespace std;
int main(){
    int N;
    cin >> N;
    int ans[N];
    for(int i = 0; i< N;i++){
        cin >> ans[i];
    }
    int flag = 1;
    int i = 0;
    int count = 0;
    while(flag){
      flag = 0;
        for(int j = N-1; j>= i+1;j--){
            int temp=0;
            if(ans[j] < ans[j-1]){
                temp = ans[j-1];
                ans[j-1] = ans[j];
                ans[j] = temp;
                flag = 1;
                count++;
            }
        }
      i++;
    }
    for(int i = 0; i< N;i++){
        cout << ans[i];
        if(i != N-1)cout << " ";
    }
    cout << endl;
    cout <<count << endl;
}


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

namespace Aizu
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());

            var nodes = new Dictionary<int, int[]>();
            var costs = new int[n];

            for (var i = 0; i < n; i++)
            {
                var line = Console.ReadLine().Split(' ').Select(value => int.Parse(value) - 1).ToArray();
                nodes.Add(line[0], line.Skip(2).ToArray());

                costs[i] = int.MaxValue;
            }
            costs[0] = 0;

            var queue = new Queue<int>();
            queue.Enqueue(0);

            var isArrived = new bool[n];

            while (queue.Count > 0)
            {
                Bfs(queue, nodes, costs, isArrived);
            }

            for (var i = 0; i < n; i++)
            {
                Console.WriteLine($"{i + 1} {(costs[i] == int.MaxValue ? -1 : costs[i])}");
            }
        }

        private static void Bfs(Queue<int> queue, Dictionary<int, int[]> nodes, int[] costs, bool[] isArrived)
        {
            var id = queue.Dequeue();
            isArrived[id] = true;

            foreach(var nextId in nodes[id])
            {
                if (!isArrived[nextId])
                {
                    queue.Enqueue(nextId);
                    costs[nextId] = Math.Min(costs[nextId], costs[id] + 1);
                }
            }
        }
    }
}



Measured memory_bytes: 18936
// Original macro is in https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = || -> String {
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}
 
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};
 
    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
    
    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}
 
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };
 
    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [$t:tt]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };
 
    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };
 
    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };
 
    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

// for adhoc read (ex. https://atcoder.jp/contests/abc112/tasks/abc112_a)
#[allow(dead_code)]
fn read_line() -> String {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}
fn main() {
    input!{ mut x: i64 }
    let q = x / 11;
    let r = x % 11;
    let mut ans = 2*q;
    if 0 < r && r <= 6 {
        ans += 1;
    } else if 7 <= r && r < 11{
        ans += 2;
    }
    println!("{}", ans);
}

Measured memory_bytes: 4352
// clang-format off
#include <bits/stdc++.h>

#define mp make_pair
#define fst first
#define snd second
#define forn(i,n) for (int i = 0; i < int(n); i++)
#define forn1(i,n) for (int i = 1; i <= int(n); i++)
#define popcnt __builtin_popcount
#define ffs __builtin_ffs
#define ctz __builtin_ctz
#define clz __builtin_clz
#define all(a) (a).begin(), (a).end()
 
using namespace std;

using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pli = pair<ll,int>;
using pil = pair<int,ll>;
using pll = pair<ll,ll>;
template <typename T> using vec = vector<T>;
using vi = vec<int>;
using vl = vec<ll>;
template <typename T> using que = queue<T>;
template <typename T> using deq = deque<T>;

template <typename T> T id(T b) {return b;};
template <typename T> void chmax(T &x, T y) {if (x < y) x = y;}
template <typename T> void chmin(T &x, T y) {if (x > y) x = y;}
template <typename S, typename K> bool contains(S &s, K k) { return s.find(k) != s.end(); }
void fastio() { ios_base::sync_with_stdio(false); cin.tie(nullptr); }
constexpr ll TEN(int n) { if (n == 0) return 1LL; else return 10LL*TEN(n-1); }
// clang-format on

const int MAX_N = 200000;
int n, k;
vi a;

vi next(vi& a) {
    vi b(n, 0);
    forn(i, n) {
        int mn = max(0, i - a[i]);
        int mx = i + a[i];
        b[mn]++;
        if (mx + 1 < n) b[mx + 1]--;
    }

    for (int i = 1; i < n; i++) {
        b[i] += b[i - 1];
    }

    return b;
}

int main() {
    fastio();

    cin >> n >> k;
    a = vi(n);
    forn(i, n) cin >> a[i];

    forn(i, min(k, 100)) {
        vi b = next(a);
        a = b;
    }

    for (auto x : a) {
        cout << x << " ";
    }
    cout << endl;

    return 0;
}

Measured memory_bytes: 4904
import java.util.*;
import java.lang.*;
 
 //O(100000000)
public class Main {
    public static void main(String[] args) {

        Scanner sc  = new Scanner(System.in);
        long N = Long.parseLong(sc.next());

        long[] dp  = new long[(int)N+1];
        for(int i=0;i<N;i++){
            dp[i] = Long.parseLong(sc.next());
        }
        
        Arrays.sort(dp);
        long a = 0;
        long b = 0;
        
        for(int i = dp.length-1; i  >= 1 ; i-- ){
            
            if(i>3){
                
                if(dp[i]==dp[i-3]&&dp[i]>a)
                a = b = dp[i];
                
            }
            
            if(dp[i] == dp[i-1]&&dp[i]>a){
                a = dp[i];
            }
            
            if(dp[i] == dp[i-1]&&a!=0&&a!=dp[i]){
                if(dp[i]>b)b = dp[i];
            }
       
        }
        
  
        System.out.print(a*b);
        System.out.println();
    }

}

Measured memory_bytes: 46572
package main

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

const mod int64 = 1000000007
const maxsize int64 = 50
const size int = 1000000
var reader = bufio.NewReaderSize(os.Stdin,size)
func NextLine() string {
  var line,buffer []byte
  var isPrefix bool = true
  var err error
  for ;isPrefix; {
    line,isPrefix,err = reader.ReadLine()
    if err != nil { panic(err) }
    buffer = append(buffer,line...)
  }
  return string(buffer)
}
func NextInt() int {
  var n int
  n,_ = strconv.Atoi(NextLine())
  return n
}
func NextIntArray() []int {
  var s []string = strings.Split(NextLine()," ")
  var n int = len(s)
  var a []int = make([]int,n)
  for i:=0;i<n;i++ {
    a[i],_ = strconv.Atoi(s[i])
  }
  return a
}

func main() {
  var n int = NextInt()
  var a []int = NextIntArray()
  var d,f,s int = -1,-1,-1
  m := map[int]int{}
  for i:=0;i<n+1;i++ {
    m[a[i]]++
  }
  for key,val := range m {
    if val == 2 {
      d = key
      break
    }
  }
  for i:=0;i<n+1;i++ {
    if a[i] == d {
      if f < 0 {
        f = i
        continue
      }
      s = i
      break
    }
  }
  var c []int64 = make([]int64,n+2)
  var r []int64 = make([]int64,f+n-s+1)
  c[0] = 1
  c[1] = int64(n+1)
  for k:=1;k<n+2;k++ {
    c[k] = (int64(n+2-k)*c[k-1])%mod
    c[k] *= inv(int64(k))
    c[k] %= mod
  }
  r[0] = 1
  for k:=1;k<f+n-s+1;k++ {
    r[k] = (int64(f+n-s+1-k)*r[k-1])%mod
    r[k] *= inv(int64(k))
    r[k] %= mod
  }
  for ;len(r)!=n+2; {
    r = append(r,0)
  }
  for k:=1;k<n+2;k++ {
    var x int64 = c[k]-r[k-1]
    for ;x<0; { x += mod }
    fmt.Println(x)
  }
}
func inv(n int64) int64 {
  if n == int64(1) { return int64(1) }
  var k []int64 = make([]int64,maxsize)
  var t,a,b,ubound,i int64
  var y0,y1 int64
  a,b,t = mod,n,n
  for i=0;i<maxsize;i++ {
    k[i],t = a/b,a%b
    if t == 0 {
      ubound = i+1
      break
    }
    a,b = b,t
  }
  y0,y1 = 1,-k[0]
  for i=2;i<ubound;i++ {
    y0,y1 = y1,y0-k[i-1]*y1
  }
  for ;y1<0; { y1 += mod }
  y1 %= mod
  return y1
}

Measured memory_bytes: 10880
import statistics
import math
import fractions
from functools import reduce

def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

n = int(input())
nums = list(map(int, input().split()))
lcm = lcm_list(nums)

# print(nums, lcm)
sum =0
for num in nums:
    sum += (lcm-1)%num
print(sum)


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

#define int long long
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<n;++i)
#define exrep(i, a, b) for(ll i = a; i < b; i++)
#define out(x) cout << x << endl
#define EPS (1e-7)
#define gearup ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<bool> > vvb;
typedef vector<vector<double> > vvd;
typedef vector<vector<string> > vvs;
typedef vector<ll> vl;
typedef vector<vector<ll> > vvl;
typedef vector<vector<vector<ll> > > vvvl;
ll MOD = 1000000007;
const long long L_INF = 1LL << 60;
const int INF = 2147483647; // 2^31-1
const double PI = acos(-1);
//cout<<fixed<<setprecision(10);

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
template<class T> void debug(T v){rep(i,v.size()) cout<<v[i]<<" ";cout<<endl;}
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};
//以降 cin の入力元が 'input.txt' になる
//std::ifstream in("input.txt");
//std::cin.rdbuf(in.rdbuf());

const int max_n = 8100;
bool pos_x[max_n][max_n*2];
bool pos_y[max_n][max_n*2];
signed main()
{
    gearup;
    
    ll k; cin >> k;
    vl a(k);
    rep(i,k)cin>>a[i];
    reverse(all(a));
    ll mi = 2;
    ll ma = 2;
    rep(i,k){
        mi = a[i] * ((mi + a[i] -1)/a[i]);
        ma = a[i] * (ma / a[i]) + a[i] -1;
    }
    if(mi > ma)out(-1);
    else cout << mi << " " << ma << endl;
}

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

int main() {
  string s;
  int n;
  cin >>n >>s;
  if(n%2==1){
    cout <<"No" <<endl;
    return 0;
  }
  else{
    for(int i=0; i<n/2;i++){
      if(s.at(i)==s.at(n/2+i)){
        continue;
      }
      else{
        cout <<"No" <<endl;
        return 0;
      }
    }
    cout <<"Yes" <<endl;
  }
}

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

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

fn main() {
    loop {
        let v: Vec<String> = read_vec();
        let (a,op,b) = (
            v[0].parse::<i32>().unwrap(),
            v[1].chars().next().unwrap(),
            v[2].parse::<i32>().unwrap());
        if op == '?' {
            break;
        }
        println!("{}",
            match op {
                '+' => a + b,
                '-' => a - b,
                '*' => a * b,
                '/' => a / b,
                _   => 0,
            });
    }
}



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

int main(){
  double ans = 0;
  int N;
  cin >> N;
  while(N--){
    double cash;
    string cur;
    cin >> cash >> cur;
    if (cur == "JPY") ans += cash;
    else ans += (cash * 380000.0);
  }
  cout << fixed << setprecision(20) << ans << '\n';
}

Measured memory_bytes: 256
#include <vector>
#include <list>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <cassert>
using namespace std;
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define EACH(t,i,c) for(t::iterator i=(c).begin(); i!=(c).end(); ++i)
const double EPS = 1e-10;
const double PI  = acos(-1.0);

struct a{
	int cnt,flag;
};
int main(){
	int n,k;
	while(cin>>n>>k,n&&k){
		vi c;
		int zero=0;
		REP(i,k){
			int cc;
			cin>>cc;
			if(cc!=0){
				c.push_back(cc);
			}else{
				zero=1;
			}
		}
		vector<a> as;
		k-=zero;

		sort(ALL(c));
		int prev=0;
		as.push_back(a());
		REP(i,k){
			if(prev==0||prev==c[i]-1){
				REP(j,as.size()){
					if(as[j].flag!=2){
						as[j].cnt++;
					}
				}
			}else{
				REP(j,as.size()){
					if(zero){
						if(as[j].flag==0){
							as[j].flag=1;
							as[j].cnt+=2;
						}else if(as[j].flag==1){
							as[j].flag=2;
						}
					}else{
						as[j].flag=2;
					}
				}
				as.push_back(a());
				as.back().cnt++;
			}
			prev=c[i];
		}
		int best=0;
		REP(i,as.size()){
			best=max(best,as[i].cnt);
		}
		cout<<best<<endl;
	}
}

Measured memory_bytes: 1732
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
//xにはvectorなどのコンテナ
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define inf 2147483647 //int値の最大値
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素
#define cint(n) int n;cin>>n;
#define CST(x) cout<<fixed<<setprecision(x)//小数点以下の桁数指定
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
int gcd(int a, int b) {
    if (b==0) return a;
    else return gcd(b, a%b);
}
int lcm(int a, int b) {
    return a * b / gcd(a, b);
}
int main() {
	cin.tie(0);
	cout.tie(0);
	ios::sync_with_stdio(false);
	int sx,sy,tx,ty;cin>>sx>>sy>>tx>>ty;
	rep(i,tx-sx){
	    cout<<"R";
	}
	rep(i,ty-sy){
	    cout<<"U";
	}
	rep(i,tx-sx){
	    cout<<"L";
	}
	rep(i,ty-sy){
	    cout<<"D";
	}
	cout<<"D";
	rep(i,tx-sx){
	    cout<<"R";
	}
	cout<<"RU";
	rep(i,ty-sy){
	    cout<<"U";
	}
	cout<<"LU";
	rep(i,tx-sx){
	    cout<<"L";
	}
	cout<<"LD";
	rep(i,ty-sy){
	    cout<<"D";
	}
	cout<<"R"<<endl;
	return 0;
}


Measured memory_bytes: 3604
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#define ll int
#define ld long double
using namespace std;
string s, ss;
int main()
{
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    cin >> s >> ss;
    reverse(s.begin(), s.end());
    if(s == ss)
        cout << "YES\n";
    else
        cout << "NO\n";
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

#define N 100

int main()
{
  int i,j,key,n,l;
  int A[N];

  scanf("%d",&n);

  for(i = 0 ; i < n ; i++){
    scanf("%d",&A[i]);
  }
  for(l = 0 ; l < n - 1 ; l++){
    printf("%d ",A[l]);
  }
  printf("%d\n",A[n-1]);

  for(i = 1 ; i <= n-1 ; i++){
    key = A[i];
    j = i - 1;

    while(j >= 0 && A[j] > key){
      A[j + 1] = A[j];
      j--;
      A[j + 1] = key;
    }
      for(l = 0 ; l < n-1 ; l++){
	printf("%d ",A[l]);
      }
      printf("%d\n",A[n-1]);
  
    }
  return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N, H, W;
  cin >> N >> H >> W;
  vector<int> x(N);
  for (int i = 0; i < N; i++){
    cin >> x[i];
  }
  vector<bool> e(N * W, false);
  for (int i = 0; i < N; i++){
    int p;
    if (i % 2 == 0){
      p = i * W + x[i];
    } else {
      p = i * W - x[i];
    }
    for (int j = p; j < p + W; j++){
      e[j] = true;
    }
  }
  int ans = 0;
  for (int i = 0; i < N * W; i++){
    if (!e[i]){
      ans += H;
    }
  }
  cout << ans << endl;
}


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

int main(){
  double a,b;cin>>a>>b;
  int ave = (int)((a+b)/2.0+0.9);
  cout << ave << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
#include <deque>
#include <iomanip>
#include <limits>
#include <fstream>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
typedef long long ll;

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N, x;
  cin >> N >> x;
  int a[N];
  FOR(i,0,N) cin >> a[i];
  sort(a, a + N);
  int ans = 0;
  FOR(i,0,N) {
    if(a[i] <= x) {
      ans++;
      if(i == N - 1 && a[i] != x) ans--;
      x -= a[i];
    }
  }
  cout << ans << endl;

}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
using namespace std;



int main(){
    int N;
    double T,A;
    double a[10100];
    cin>>N>>T>>A;
    for(int i=0;i<N;++i){
        cin>>a[i];
    }
    int ans=0;
    double dis=100000;
    double b;
    for(int i=0;i<N;++i){
        if(A-T+a[i]*0.006<0){
            b=-A+T-a[i]*0.006;
        }
        else{
            b=A-T+a[i]*0.006;
        }
        if(b<dis){
            ans=i;
            dis=b;
        }
    }
    cout<<ans+1<<endl;
    
    
    
    
    

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,l,r) for(long long i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define int long long
const int MOD=1e9+7;
const int INF=1e15;

signed main(){
    int N,I;cin>>N>>I;
    cout<<(N-1)*(I-1)<<endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#pragma warning(disable:4996)
#pragma comment(linker, "/STACK:336777216")
using namespace std;

#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define ldb ldouble

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

int IT_MAX = 1 << 18;
const ll MOD = 1000000007;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const db PI = acos(-1);
const db ERR = 1e-9;
#define szz(x) (int)(x).size()
#define rep(i, n) for(int i=0;i<n;i++)
#define Se second
#define Fi first

int main() {
	while (1) {
		int n; ll i, j;
		scanf("%d%lld%lld", &n, &i, &j);
		if (n == 0 && i == 0 && j == 0) break;
		vector <int> f;
		ll mi = i;
		for (int m = n; m; m--) {
			if (mi <= 1LL << (m - 1)) f.push_back(1), mi = (1LL << (m - 1)) + 1 - mi;
			else f.push_back(0), mi = mi - (1LL << (m - 1));
		}
		reverse(all(f));
		int m = n;
		for (int e : f) {
			if (e == 1) {
				if (j <= 1LL << (m - 1)) putchar('L'), j = (1LL << (m - 1)) + 1 - j;
				else putchar('R'), j = (1LL << m) + 1 - j;
			}
			else {
				if (j <= 1LL << (m - 1)) putchar('R');
				else putchar('L'), j = j - (1LL << (m - 1));
			}
			--m;
		}
		puts("");
	}
	return 0;
}

Measured memory_bytes: 3168
#include <bits/stdc++.h>
using namespace std;
int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	long long n,a,b;
	cin >> n >> a >> b;
	cout << (n / (a + b)) * a + min(a, n - (n / (a + b)) * (a + b));	
	return 0;
}

Measured memory_bytes: 256
#prag\
ma GCC optimize("Ofast")
#include <bits/stdc++.h>
typedef long long ll;
#define N 100005
using namespace std;
int n,m,fa[N],dist[N];
int fl,fr;
int Find(int x)
{
    if(fa[x]==x) return x;
    int tmp=fa[x]; fa[x]=Find(fa[x]); dist[x]+=dist[tmp];
    return fa[x];
}
int main()
{
    scanf("%d%d",&n,&m);
    for(int i=1;i<=n;++i)
    {
    	fa[i]=i;
		dist[i]=0;
	}
    while(m--)
    {
        int l,r,d; scanf("%d%d%d",&l,&r,&d); 
        int tl=Find(l),tr=Find(r);
        if(tl!=tr)
        {
            fa[tr]=tl;
    		dist[tr]=dist[l]-dist[r]+d;
        }
        else if(dist[r]-dist[l]!=d)
        {
            printf("No\n");
            return 0;
		}
    }
    printf("Yes\n");
    return 0;
}

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

int main() {
  int a, b;
  cin >> a >> b;
  
  if (a == b){
    cout << "Draw" << endl;
  }
  else if (a == 1){
    cout << "Alice" << endl;
  }
  else if (b == 1){
    cout << "Bob" << endl;
  }
  else if (a < b){
    cout << "Bob" << endl;
  }
  else{
    cout << "Alice" << endl;
  }
}   

Measured memory_bytes: 256
#include<stdio.h>

int main(void){
  long int a,b,c,d;
  long long max;
  scanf("%ld",&a);
  scanf("%ld",&b);
  scanf("%ld",&c);
  scanf("%ld",&d);
  max=a*c>b*d?a*c:b*d;
  max=max>a*d?max:a*d;
  max=max>b*c?max:b*c;
  
  printf("%lld",max);
  
  return 0;
}
    

Measured memory_bytes: 2152
#include<iostream>
#include <vector>
#include <string>


struct Card { char suit; int number;};

void selection_sort(std::vector<Card>& a){
    for (int i = 0; i < a.size(); i++){
        int minj{i};
        for (int j = i; j < a.size(); j++){
            if (a[minj].number > a[j].number) {
                minj = j;
            };
        }
        std::swap(a[minj], a[i]);
    };
}

void bubble_sort(std::vector<Card>& a){
    for (int i = 0; i < a.size(); i++){
        for (int j = a.size() - 1; j >= i + 1; j--){
            if (a[j].number < a[j-1].number){
                std:: swap(a[j], a[j-1]);
            }
        }
    }
}

void print_card(std::vector<Card>& a){
    for (int i = 0; i < a.size(); i++) {
            if (i) std::cout << " ";
            std::cout << a[i].suit << a[i].number;
        }
    std::cout << std::endl;
}

bool isStable(std::vector<Card>& a, std::vector<Card>& a2){
    for (int i = 0; i < a.size(); i++){
        if (a[i].suit != a2[i].suit){
            return false;
        }
    }
    return true;
}

int main(){

    int N{0};
    std::cin >> N;
    std::vector<Card> a(N);
    std::vector<Card> a2(N);
    for (int i = 0; i < N; i++) {
        std::cin >> a[i].suit >> a[i].number;
    }
    std::copy(a.begin(), a.end(), a2.begin());
    bubble_sort(a);
    selection_sort(a2);

    print_card(a);
    std::cout << "Stable" << std::endl;
    print_card(a2);
    if (isStable(a, a2)){
        std::cout << "Stable" << std::endl;
    }else{
        std::cout << "Not stable" << std::endl;
    }
    
    return 0;
}



Measured memory_bytes: 3152
#include <bits/stdc++.h> //けんちょんさんのブログより
using namespace std;
int main(void){
    int n,k; cin>>n>>k;
    vector <long long> num(k, 0);
    for (int i=1;i<=n;i++) num[i%k]++;
    long long res = 0;
    for (int a=0;a<k;a++){
        int b= (k-a)%k;
        int c= (k-a)%k;
        if((b+c)%k!=0) continue;
        res += num[a]*num[b]*num[c];
    }
    cout<<res<<endl;
}

Measured memory_bytes: 1792
import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.Map.Entry;

import java.util.StringTokenizer;

public class Main {
	
	public static void main(String[] args) throws IOException {
		try(final Scanner sc = new Scanner(System.in)){
			final char[] chs = sc.next().toCharArray();
			
			for(int i = 0; i < chs.length - 1; i++) {
				if(chs[i] == chs[i + 1]) {
					System.out.println("Bad"); return;
				}
			}
			
			System.out.println("Good");
		}
	}

	public static class Scanner implements Closeable {
		private BufferedReader br;
		private StringTokenizer tok;

		public Scanner(InputStream is) throws IOException {
			br = new BufferedReader(new InputStreamReader(is));
		}

		private void getLine() throws IOException {
			while(!hasNext()){
				tok = new StringTokenizer(br.readLine());
			}
		}

		private boolean hasNext() {
			return tok != null && tok.hasMoreTokens();
		}

		public String next() throws IOException {
			getLine();
			return tok.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}

		public int[] nextIntArray(int n) throws IOException {
			final int[] ret = new int[n];
			for(int i = 0; i < n; i++){
				ret[i] = this.nextInt();
			}
			return ret;
		}

		public long[] nextLongArray(int n) throws IOException {
			final long[] ret = new long[n];
			for(int i = 0; i < n; i++){
				ret[i] = this.nextLong();
			}
			return ret;
		}

		public void close() throws IOException {
			br.close();
		}
	}
}

Measured memory_bytes: 24916
while (n=gets.to_i)!=-1
  l,rad=2**0.5,Math.atan(1/1)
  (n-2).times do
    rad+=Math.atan(1/l)
    l=(l**2+1)**0.5
  end
  puts "#{(l*Math.cos(rad)).round(2)}\n#{(l*Math.sin(rad)).round(2)}"
end

Measured memory_bytes: 9068
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

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

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

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

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

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

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

fn main() {
    let mut index = 1;
    input! {
        n: [i32;5],
    }

    while true {
        if n[index - 1] == 0 {
            break;
        }
        index += 1;
    }

    print!("{}", index);
}


Measured memory_bytes: 2040
#pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
using namespace std;
template<class S, class T> inline S min_L(S a,T b){
  return a<=b?a:b;
}
inline void rd(long long &x){
  int k;
  int m=0;
  x=0;
  for(;;){
    k = getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
inline void wt_L(char a){
  putchar_unlocked(a);
}
inline void wt_L(long long x){
  int s=0;
  int m=0;
  char f[20];
  if(x<0){
    m=1;
    x=-x;
  }
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  if(m){
    putchar_unlocked('-');
  }
  while(s--){
    putchar_unlocked(f[s]+'0');
  }
}
long long A;
long long B;
long long K;
long long t;
int main(){
  rd(A);
  rd(B);
  rd(K);
  t =min_L(A, K);
  A -= t;
  K -= t;
  t =min_L(B, K);
  B -= t;
  wt_L(A);
  wt_L(' ');
  wt_L(B);
  wt_L('\n');
  return 0;
}
// cLay varsion 20191229-1 [beta]

// --- original code ---
// ll A, B, K, t;
// {
//   rd(A,B,K);
//   t = min(A,K);
//   A -= t;
//   K -= t;
//   t = min(B,K);
//   B -= t;
//   wt(A,B);
// }


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using i64 = int64_t;
typedef long long ll;
typedef long double ld;
const long long INF = 1e18;
# define len(x) ((int)(x).size())
# 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 foreps(i, m, n) for(int i = m;i < n;i++)
# define ALL(x) (x).begin(), (x).end()
# define rall(x) (x).rbegin(), (x).rend()
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; }

int main() {
    ll X; cin >> X;
    ll Q = X / 100;
    ll R = X % 100;
    cout << (R <= Q * 5) << endl;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = s; i < (int)(n); i++)
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

using namespace std;
using ll = long long;
using pii = pair<int, int>;

//const ll INF = 1e18L + 5;
const int INF = 1e9 + 5;
//const double pi = 3.14159265358979323846;

void	solve()
{
	int a;
	string s;
	cin >> a >> s;
	if (a >= 3200)
		cout << s << endl;
	else
		cout << "red" << endl;
}

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

	solve();
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define inf 999999999999
#define N 666666
int arr[N];
signed main(){
	int n,m;cin>>n>>m;
	string s1="";
	string s2="";
	for(int i=0;i<n;i++) s1+=(m+'0');
	for(int i=0;i<m;i++) s2+=(n+'0');
	if(s1>s2) cout<<s2;
	else cout<<s1;
	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
void debug() {cout<<endl;}
template<typename T,typename... Args>
void debug(T x,Args... args) {cout<<x<<" ";debug(args...);}
#define forn(i,a,b) for(int i=a;i<b;++i)
#define pb push_back
#define F first
#define S second
#define endl "\n"
typedef long long ll;
typedef pair<int, int> pii;

const int N = 1005;
string grid[N];
ll dp[N][N];
int n, m, mod = 1e9+7;

ll f(int i, int j){
	if(i >= n || j >= m)return 0;
	if(grid[i][j] == '#')return 0;
	if(i == n-1 && j == m-1)return 1;
	ll &ans = dp[i][j];
	if(ans != -1)return ans;
	ans = 0;
	ans = (ans + f(i+1, j))%mod;
	ans = (ans + f(i, j+1))%mod;
	return ans;
}


int main() {
  ios::sync_with_stdio(0); cin.tie(0);
	cin >> n >> m;
	forn(i, 0, n){
		cin >> grid[i];
	}

	memset(dp, -1, sizeof dp);
	cout << f(0, 0) << endl;

}





Measured memory_bytes: 12628
#define _USE_MATH_DEFINES

#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <iterator>
#include <cmath>
#include <complex>

#include <string>
#include <cstring>
#include <vector>
#include <bitset>

#include <queue>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <ctime>
////
//#include <random>//
/////////

typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;

////定数
const int INF = (int)1e9 + 10;
const LL MOD = (LL)1e9 + 7;
const LL LINF = (LL)4e18 + 20;
const LD PI = acos(-1.0);
const double EPS = 1e-9; 
/////////
using namespace::std;
void chmax(LL& a, LL b) {
	a = max(a, b);
}
void chmin(LL& a, LL b) {
	a = min(a, b);
}
//////////////
int N,M;
vector<vector<int>>G;
vector<bool>use;
vector < pair<int, int>> E;

bool go(int a, int b,int now) {
	//a-bを使わずにaからb
	if (b == now) {
		return true;
	}
	if (use[now] == true) return false;
	use[now] = true;
	
	int len = G[now].size();
	for (int i = 0; i < len; ++i) {
		int ter = G[now][i];
		if (a == now && b == ter)continue;
		if (a == ter && b == now)continue;
		bool res = go(a, b, ter);
		if (res == true)return true;
	}
	return false;
}
void solve() {
	cin >> N>>M;
	G = vector<vector<int>>(N);
	use = vector<bool>(N, false);

	for (int i = 0; i < M; ++i) {
		int a, b;
		cin >> a >> b;
		--a; --b;
		G[a].push_back(b);
		G[b].push_back(a);
		E.push_back(pair<int,int>(a, b));
	}
	
	int ans = 0;
	for (int i = 0; i < M; ++i) {
		use = vector<bool>(N, false);
		bool res = go(E[i].first,E[i].second,E[i].first);
		if (res == false) {
			ans++;
		}
	}
	cout << ans << endl;
}

signed main(void) {
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cout << std::fixed;//小数を10進数表示
	cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別	

	solve();
}


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

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <map>

using namespace std;

#define lli long long
#define sz(A) (int)A.size()
#define lsz(A) (long long)A.size()
#define INT_INF (int)(1e9 + 7)
#define MOD ((long long int)(1e9 + 7))

lli power(lli x, lli n){
    if(n == 0) return 1;
    lli ans = power(x, n / 2);
    ans = (ans * ans) % MOD;
    if(n % 2) ans = (ans * x) % MOD;
    return ans;
}


// Compiling command
// g++ -02 -Wall <question_name>.cpp -o <question_name>

int main(int argc, char const *argv[]){

    ios::sync_with_stdio(false);
    cin.tie(NULL);

    lli N;
    cin >> N;

    lli final = power((lli)10, N);
    // cout << final << endl;
    final = (final + power((lli)8, N) + MOD) % MOD;
    final = (final - power((lli)9, N) + MOD) % MOD;
    final = (final - power((lli)9, N) + MOD) % MOD;
    cout << final << endl;
    
    
    return 0;
}



Measured memory_bytes: 3644
#include<iostream>
#include<string>
#include<vector>
#include<numeric>
#include<math.h>
#include<algorithm>
#include<iomanip>
#include<bitset>
using namespace std;

int main() {

	long long A, B, C, K;
	cin >> A >> B >> C >> K;

	if (K < A) {
		cout << K << endl;
	}
	else if (A <= K && K <= A + B) {
		cout << A << endl;
	}
	else {
		cout << A - (K -A -B) << endl;
	}

	return 0;
}



Measured memory_bytes: 3632
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		final int max_size = 100;
		final char flag = 1;
		
		char map[][] = new char[max_size][max_size];
		Scanner scanner = new Scanner(System.in);
		int w, h;
		
		h = scanner.nextInt();
		w = scanner.nextInt();
		scanner.nextLine();
		
		while(w != 0 || h != 0) {
			//
			map = new char[max_size][max_size];
			//
			for(int i = 0; i < h; i++) {
				String s = scanner.nextLine();
				map[i] = s.toCharArray();
			}
			//
			int x = 0;
			int y = 0;
			
			while (map[y][x] != flag && map[y][x] != '.') {
				switch (map[y][x]) {
					case '>':
						map[y][x] = flag;
						x++;
						break;
					case 'v':
						map[y][x] = flag;
						y++;
						break;
					case '<':
						map[y][x] = flag;
						x--;
						break;
					case '^':
						map[y][x] = flag;
						y--;
						break;
				}
			}
			
			if (map[y][x] == flag) {
				System.out.println("LOOP");
			} else {
				System.out.println(String.format("%d %d", x, y));
			}
			
			h = scanner.nextInt();
			w = scanner.nextInt();
			scanner.nextLine();
		}
	}
}

Measured memory_bytes: 29320
#include <bits/stdc++.h>
using namespace std;
using ll = long long;


void solve(std::string s){
    cout << s.at(0) << s.length()-2 << s.at(s.length()-1) << endl;
}

int main(){
    std::string s;
    std::cin >> s;
    solve(s);
    return 0;
}


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

ll cnt[200000],N,K,ans;

int main(void){
    cin >> N >> K;
    for(ll i=1;i<=N;i++)cnt[i%K]++;
    ans =0;
    rep(i,K)if((K-2*i)%K==0)ans+=cnt[i]*cnt[(K-i)%K]*cnt[i];     
    cout << ans << endl;
}


Measured memory_bytes: 1024
//include,namespace
 #include<bits/stdc++.h>
 #include<iostream> 
 #include <queue>
 #include <vector>
 #include <string>
 using namespace std;
//REPmacro
 #define all(x) (x).begin(),(x).end()             //ソート
 #define FOR(i,x,n)for(int i=(x);i<(n);i++)
 #define FOR_R(i,x,n) for(int i=(n-1);i>=(x);i--)
 #define REP(i, n) FOR(i, 0, n)
 #define REP_R(i, n) FOR_R(i, 0, n)
//long long(define)
 using ll = long long;
 typedef long long ll;
 typedef long long int64;
 typedef long long lint;
 typedef long long lli;

struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};
////////////////いろいろあるよ//////////////////////////////////
int main(){
	int a,b,c;
  	cin >> a >> b >> c;
    int piyo=c;
  while(piyo>=b){
  	if(piyo%a==0){cout << "OK" << endl; return 0;}
    piyo--;
  }
  cout << "NG" << endl;
}


Measured memory_bytes: 3652
#C問題
S=str(input())
Slist=list(S)
Slen=len(Slist)
count=0
for i in range(Slen-1):
    if Slist[i] == Slist[i+1]:
        if Slist[i+1] == "0":
            Slist[i+1] = "1"
        else:
            Slist[i+1] = "0"
        count+=1
print(count)

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

using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    vector<int> h(n);
    for (int i = 0; i < n; ++i) {
        cin >> h[i];
    }
    vector<long long> dp(n);
    dp[0] = 0;
    for (int i = 1; i < n; ++i) {
        dp[i] = dp[i - 1] + abs(h[i] - h[i - 1]);
        if (i != 1) dp[i] = min(dp[i], dp[i - 2] + abs(h[i] - h[i - 2]));
    }
    cout << dp[n-1] << endl;
    return 0;
}

Measured memory_bytes: 1408