akhauriyash/Code-Regression huggingface dataset:
import java.util.*;
import java.io.*;

public class Main {
	private static final boolean local = false;
	private static BufferedReader br;
	private static StringTokenizer st;
	private static PrintWriter output;
	//char c = line.nextToken().charAt(0);

	private static void openFile() throws IOException {
		if (local) {
			String inp = "C:/Users/ztrong/Desktop/AndroidStudioProjects/Java/src/main/java/input.txt";
			String out = "C:/Users/ztrong/Desktop/AndroidStudioProjects/Java/src/main/java/output.txt";
			br = new BufferedReader(new InputStreamReader(new FileInputStream(inp)));
			output = new PrintWriter(new FileOutputStream(out));
		}
		else {
			br = new BufferedReader(new InputStreamReader(System.in));
			output = new PrintWriter(System.out);
		}
	}

	private static String _next() {
		while (st == null || !st.hasMoreElements()) {
			try {
				st = new StringTokenizer(br.readLine());
			}
			catch (IOException e) {
				e.printStackTrace();
			}
		}
		return st.nextToken();
	}

	private static int nextInt() {
		return Integer.parseInt(_next());
	}

	private static long nextLong() {
		return Long.parseLong(_next());
	}

	private static double nextDouble() {
		return Double.parseDouble(_next());
	}

	private static String nextLine() {
		String str = "";
		try {
			str = br.readLine();
		}
		catch (IOException e) {
			e.printStackTrace();
		}
		return str;
	}

	private static final int maxN = (int) 1e5 + 5;
	private static final int maxM = (int) 1e6 + 5;
	private static final int INF = (int) 1e9 + 7;

	private static int N;
	private static String s1, s2;
	private static long[][][] dp = new long[maxN][3][3];

	private static void init() {

	}

	private static void enter() throws IOException {
		N = nextInt();
		s1 = nextLine();
		s2 = nextLine();
	}

	private static void solve() throws IOException {
		for (int i = 1; i <= N; ++i) {
			if (i < N && s1.charAt(i - 1) == s1.charAt(i)) continue;
			if (s1.charAt(i - 1) == s2.charAt(i - 1)) {
				if (i == 1) {
					for (int u = 0; u < 3; ++u) {
						for (int v = 0; v < 3; ++v) if (u == v) {
							dp[i][u][v] = 1;
						}
					}
				}
				else {
					for (int u = 0; u < 3; ++u)
						for (int v = 0; v < 3; ++v) if (u == v)
							for (int x = 0; x < 3; ++x) if (x != u)
								for (int y = 0; y < 3; ++y) if (y != v) {
									dp[i][u][v] = (dp[i][u][v] + dp[i - 1][x][y]) % INF;
								}
				}
			}
			else {
				if (i == 2) {
					for (int u = 0; u < 3; ++u)
						for (int v = 0; v < 3; ++v) if (u != v) {
							dp[i][u][v] = 1;
						}
				}
				else {
					for (int u = 0; u < 3; ++u) {
						for (int v = 0; v < 3; ++v) if (u != v)
							for (int x = 0; x < 3; ++x) if (x != u) {
								for (int y = 0; y < 3; ++y) if (y != v) {
									dp[i][u][v] = (dp[i][u][v] + dp[i - 2][x][y]) % INF;
								}
							}
					}
				}
			}
		}

		long res = 0;

		for (int u = 0; u < 3; ++u) {
			for (int v = 0; v < 3; ++v) {
				res = (res + dp[N][u][v]) % INF;
			}
		}

		output.println(res);
	}

	public static void main(String[] args) throws IOException {
		openFile();
		init();
		enter();
		solve();
		output.close();
	}
}

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

int main() {
    int n;
    while (true) {
        cin >> n;
        if (n == 0) break;

        vector<int> a(n);
        int sum = 0;
        rep(i, n) {
            cin >> a.at(i);
            sum += a.at(i);
        }
        int average = sum/n;
        int ans = 0;
        rep(i, n) {
            if (a.at(i) <= average) ans++;
        }

        cout << ans << endl;
    }
}



Measured memory_bytes: 3036
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

int main() {
    int n, m, p;
    cin >> n >> m >> p;
    vector<int> val(m);
    for (int i = 0; i < m; ++i) {
        int x;
        scanf("%d", &x);
        val[i] = (x+n-p)%n;
    }
    sort(val.begin(),val.end());
    int ans = min(val.back(), n-val.front());
    for (int i = 0; i+1 < m; ++i) {
        int l = val[i], r = n-val[i+1];
        ans = min(ans, l+r+min(l, r));
    }
    cout << ans*100 << "\n";
    return 0;
}


Measured memory_bytes: 3252
#include <iostream>
using namespace std;
int main(void){
    int a,b;
    std::cin >> a>>b;
    if(a*b*1%2==1 ||a*b*2%2==1 ||a*b*3%2==1)std::cout << "Yes" << std::endl;
    else std::cout << "No" << std::endl;
    
}


Measured memory_bytes: 256
#include <iostream>
#include <string.h>

int main() {
  using namespace std;
  typedef unsigned int uint;
  typedef unsigned long ulong;
  
  ios_base::sync_with_stdio(false);
  
  uint ballCount;
  cin >> ballCount;
  
  uint *ballno = new uint[ballCount];
  for (auto *p = ballno, *end = ballno + ballCount ; p != end ; p++) {
    cin >> *p;
  }
  
  uint dicCount = ballCount + 1;
  uint *dic = new uint[dicCount];
  
  memset(dic, 0, dicCount<<2);
  for (auto *p = ballno, *end = ballno + ballCount ; p != end ; p++) {
    dic[*p]++;
  }

  ulong sum = 2;
  for (auto *p = dic, *end = dic + dicCount; p != end ; p++) {
    sum += ((ulong)*p) * (*p - 1);
  }
  sum >>= 1;
  
  for (auto *p = ballno, *end = ballno + ballCount ; p != end ; p++) {
    cout << sum - dic[*p] << '\n';
  }
  
  delete[] ballno, dic;
}


Measured memory_bytes: 4224
import qualified Data.Map as M                 

main :: IO ()
main = do
    s <- getLine
    t <- getLine
    putStrLn $ if solve s t then "Yes" else "No"

solve :: String -> String -> Bool
solve s t = go M.empty M.empty s t
  where
    go mpxy mpyx [] [] = True
    go mpxy mpyx (x : xs) (y : ys)
        | duplicated x y mpxy = False
        | duplicated y x mpyx = False
        | otherwise = go (M.insert x y mpxy) (M.insert y x mpyx) xs ys 

    duplicated k v mp = maybe False (/= v) $ M.lookup k mp

Measured memory_bytes: 18812
#include <bits/stdc++.h>
using namespace std;
#define rep(i,ini,n) for(int i=ini;i<n;i++)
#define _rep(i,ini,n) for(int i=ini;i>=n;i--)
#define ToEnd(a) a.begin(),a.end()
uint64_t MOD=1000000007;

int main(){
    string S,T; cin>>S>>T;

    string ans="UNRESTORABLE";
    _rep(i,S.size()-1,T.size()-1){
        string _S=S;
        bool unmatch=false;
        rep(j,0,T.size()){
            if(S.at(i-j)=='?' || S.at(i-j)==T.at(T.size()-1-j)){
                _S.at(i-j)=T.at(T.size()-1-j);
            }else{
                unmatch=true;
                break;
            }
        }
        if(unmatch) continue;

        ans=_S;
        break;
    }

    rep(i,0,ans.size()){
        if(ans.at(i)=='?') ans.at(i)='a';
    }
    cout<<ans<<endl;
}

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

int main(){
  int n;cin>>n;
  vector<int> l(n);
  for(int i=0;i<n;i++)cin>>l[i];
  sort(l.begin(),l.end());
  
  int ans=0;
  for(int i=0;i<n-2;i++){
    for(int j=i+1;j<n-1;j++){
      if(l[i]!=l[j]){
        for(int k=j+1;k<n;k++){
          if(l[k]<(l[i]+l[j])&&l[k]!=l[j])ans++;
        }
      }
    }
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 3636
using System;

public class Hello
{
    public static void Main()
    {
        var k = long.Parse(Console.ReadLine().Trim());
        var dk = k / 50L;
        var a = new long[50];
        for (int i = 0; i < 50; i++)
            a[i] = i + dk;
        var imax = k % 50;
        for (int i = 0; i < imax; i++)
        {
            for (int j = 0; j < 50; j++) a[j]--;
            a[i] += 51;
        }
        Console.WriteLine(50);
        Console.WriteLine(string.Join(" ", a));
    }
}

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

int main() {
    int k;
    long long lunlun;
    queue<long long> q;
    cin >> k;

    for(int i=1; i<=9; i++) {
        q.push(i);
    }

    for(int i=0; i<k; i++) {
        lunlun = q.front();
        q.pop();

        if (lunlun % 10 != 0) {
            q.push(lunlun * 10 + (lunlun % 10 - 1));
        }

        q.push(lunlun * 10 + (lunlun % 10));

        if (lunlun % 10 != 9) {
            q.push(lunlun * 10 + (lunlun % 10 + 1));
        }
    }

    cout << lunlun << endl;
}

Measured memory_bytes: 1792
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <climits>
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <string>
#include <sstream>
#include <vector>
#include <map>
#include <set>
#include <complex>
#include <functional>
#include <utility>
#include <iterator>

#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i, m, n) for(int i = (m); i < (int)(n); ++i)
#define ALL(x) (x).begin(), (x).end()
#define INF 2000000000

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef unsigned int uint;

//const double PI = 3.1415926535897932384626433832795;

int main() {
  LL n;
  cin >> n;
  int i = 0;
  map<int, char> mp;

  while(n > 0) {
    int x = n % 26;
    char c = (char)(x + 'a' - 1);
    if(c == '`') {
      c = 'z';
      n -=1;
    }
    mp[i] = c;
    n /= 26;
    i += 1;
  }
  int len = i;
  string ans;
  REP(i, len) {
    ans += mp[i];
  }
  reverse(ans.begin(), ans.end());
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3628
import Control.Applicative
import Control.Monad
import Data.List
import Data.Char
import Data.Maybe
strToInt s = (read :: String -> Int) s

main = do
    [h, w] <- map strToInt . words <$> getLine
    cs <- replicateM h getLine
    mapM (mapM putStrLn) $ map (replicate 2) cs


Measured memory_bytes: 1276
#include<bits/stdc++.h>
using namespace std;
int n,a,b,cnt,aa[605][605],bb[605][605],ly,sum[5][5];
pair<int,pair<int,int> >s[360005];
#define sqr(x) ((x)*(x))
void dfsa(int i,int j,int p)
{
	if (aa[i][j]==0)
	{
		aa[i][j]=p;
		for (int t=0;t*t<=a;t++)
			{
				int tmp=a-t*t,t1=sqrt(tmp);
				if (t1*t1==tmp)
				{
					//cout<<t<<' '<<t1<<endl;
					if (i+t<=2*n&&j+t1<=2*n) dfsa(i+t,j+t1,p^1);
					if (i-t>=1&&j+t1<=2*n) dfsa(i-t,j+t1,p^1);
					if (i+t<=2*n&&j-t1>=1) dfsa(i+t,j-t1,p^1);
					if (i-t>=1&&j-t1>=1) dfsa(i-t,j-t1,p^1);
				}
			}
	}
}
void dfsb(int i,int j,int p)
{
	if (bb[i][j]==0)
	{
		bb[i][j]=p;
		for (int t=0;t*t<=b;t++)
			{
				int tmp=b-t*t,t1=sqrt(tmp);
				if (t1*t1==tmp)
				{
					//cout<<t<<' '<<t1<<endl;
					if (i+t<=2*n&&j+t1<=2*n) dfsb(i+t,j+t1,p^1);
					if (i-t>=1&&j+t1<=2*n) dfsb(i-t,j+t1,p^1);
					if (i+t<=2*n&&j-t1>=1) dfsb(i+t,j-t1,p^1);
					if (i-t>=1&&j-t1>=1) dfsb(i-t,j-t1,p^1);
				}
			}
	}
}

void work()
{
	for (int i=1;i<=n*2;i++)
	for (int j=1;j<=n*2;j++)
	{
		if (aa[i][j]==0)
			dfsa(i,j,2);
		if (bb[i][j]==0)
			dfsb(i,j,2);
		sum[aa[i][j]][bb[i][j]]++;
	}
	for (int A=2;A<=3;A++)
	for (int B=2;B<=3;B++)
	if (n*n<=sum[A][B])
	{
		int cnt=0;
		for (int i=1;i<=n*2;i++)
		for (int j=1;j<=n*2;j++)
		{
			if (aa[i][j]==A&&bb[i][j]==B)
			{
				printf("%d %d\n",i-1,j-1);
				cnt++;
				if (cnt==n*n) return;
			}
		}
		//exit(0);
	}
	//printf("%d %d\n",n*n,cnt);
}
int main()
{
	scanf("%d%d%d",&n,&a,&b);
	/*
	for (int i=1;i<=n*2;i++,puts(""))
	for (int j=1;j<=n*2;j++)*/
	work();
	/*
	reverse(s+1,s+ly+1);
	work();
	*/
}

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

namespace CompetitiveProgCsLib
{
	class MainProg
	{
		static string R => Console.ReadLine();
		static int RI => int.Parse(R);
		static double RD => double.Parse(R);
		static int[] RIs => R.Split(' ').Select(int.Parse).ToArray();
		static double[] RDs => R.Split(' ').Select(double.Parse).ToArray();
		static void Out(object obj) => Console.WriteLine(obj);
		static void Outb(bool b) => Out(b ? "Yes" : "No");
		static void OutB(bool b) => Out(b ? "YES": "NO");

		static void Main(string[] args)
		{
			var n = RIs;
			var li = new List<string>();
			for (int i = 0;i < n[0];i++)
			{
				var str = R;
				li.Add(str);
			}
			bool ans = true;
			for(int i = 0;i < n[0];i++)
			{
				for(int j = 0;j < n[1];j++)
				{
					if (li[i][j] == '#')
					{
						bool flg = false;
						if (isin(j, i + 1, n[0], n[1]) && li[i + 1][j] == '#') flg = true;
						if (isin(j, i - 1, n[0], n[1]) && li[i - 1][j] == '#') flg = true;
						if (isin(j + 1, i, n[0], n[1]) && li[i][j + 1] == '#') flg = true;
						if (isin(j - 1, i, n[0], n[1]) && li[i][j - 1] == '#') flg = true;
						if (!flg) ans = false;
					}
				}
			}
			Outb(ans);
		}

		static bool isin(int x,int y,int h,int w)
		{
			return 0 <= x && x < w && 0 <= y && y < h;
		}
	}
}


Measured memory_bytes: 13396
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(var, begin, end) for (int var = (begin); var <= (end); var++)
#define RFOR(var, begin, end) for (int var = (begin); var >= (end); var--)
#define REP(var, length) FOR(var, 0, length - 1)
#define RREP(var, length) RFOR(var, length - 1, 0)
#define EACH(value, var) for (auto value : var)
#define SORT(var) sort(var.begin(), var.end())
#define REVERSE(var) reverse(var.begin(), var.end())
#define RSORT(var) SORT(var); REVERSE(var)
#define OPTIMIZE_STDIO ios::sync_with_stdio(false);cin.tie(0);cout.precision(10);cout << fixed
#define endl '\n'

const ll MOD = 1e9 + 7;
struct mint {
    ll x;
    mint() : x(0) {}
    mint(ll x) : x((x % MOD + MOD) % MOD) {}
    mint& operator+=(const mint& r) { if ((x += r.x) >= MOD) { x -= MOD; } return *this; }
    mint& operator-=(const mint& r) { if ((x -= r.x) < 0) { x += MOD; } return *this; }
    mint& operator*=(const mint& r) { if ((x *= r.x) > MOD) { x %= MOD; } return *this; }
    mint& operator++() { if ((++x) >= MOD) { x -= MOD; } return *this; }
    mint operator++(int) { mint ret = x; if ((++x) >= MOD) { x-= MOD; } return ret; }
    mint& operator--() { if ((--x) < 0) { x += MOD; } return *this; }
    mint operator--(int) { mint ret = x; if ((--x) < 0) { x += MOD; } return ret; }
    mint operator+(const mint& r) { mint ret; return ret = x + r.x; }
    mint operator-(const mint& r) { mint ret; return ret = x - r.x; }
    mint operator*(const mint& r) { mint ret; return ret = x * r.x; }
    mint operator-() { return mint() - *this; }
    bool operator<(const mint& a) { return x < a.x; }
    bool operator>(const mint& a) { return x > a.x; }
    bool operator<=(const mint& a) { return x <= a.x; }
    bool operator>=(const mint& a) { return x >= a.x; }
    bool operator==(const mint& a) { return x == a.x; }
    bool operator!=(const mint& a) { return x != a.x; }
};
ostream& operator<<(ostream& os, const mint& r) { os << r.x; return os; }
ostream& operator>>(ostream& os, const mint& r) { os >> r.x; return os; }

void solve(istream& cin, ostream& cout) {
  int N;
  cin >> N;
  int ans = 0;
  if (N % 2 == 0) {
    ans = N / 2;
  } else {
    ans = N / 2 + 1;
  }
  cout << ans << endl;
}

#ifndef TEST
int main() {
  OPTIMIZE_STDIO;
  solve(cin, cout);
}
#endif


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

#define FOR(i,l,r) for(int i = (l);i < (r);i++)
#define ALL(x) (x).begin(),(x).end()
template<typename T> bool chmax(T& a,const T& b){return a < b ? (a = b,true) : false;}
template<typename T> bool chmin(T& a,const T& b){return b < a ? (a = b,true) : false;}
typedef long long ll;

ll N,M,K;

void mult(vector<ll>& x,vector<ll>& y)
{
	vector<ll> z = x;
	FOR(i,0,N - 1){
		x [i] = z [y [i]];
	}
	return;
}

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

	cin >> N;
	vector<ll> A(N),diff(N - 1),perm(N - 1);
	FOR(i,0,N){
		cin >> A [i];
		if(i){
			diff [i - 1] = A [i] - A [i - 1];
		}
	}
	FOR(i,0,N - 1){
		perm [i] = i;
	}
	cin >> M >> K;
	FOR(i,0,M){
		int P;
		cin >> P;
		swap(perm [P - 2],perm [P - 1]);
	}

	while(K){
		if(K & 1){
			mult(diff,perm);
		}
		mult(perm,perm);
		K >>= 1;
	}

	ll sum = A.front();
	FOR(i,0,N){
		if(i){
			sum += diff [i - 1];
		}
		cout << sum << endl;
	}

	return 0;
}


Measured memory_bytes: 4464
use proconio::{fastout, input};
use std::collections::HashSet;
#[allow(unused_mut)]
#[fastout]
fn main() {
    input! {
        n: usize,
        m: usize,
        ps: [(usize,String);m]
    }
    let mut v = vec![(false, 0); n];
    for i in ps.iter() {
        match i.1.as_str() {
            "AC" => {
                v[i.0 - 1].0 = true;
            }
            "WA" => {
                if v[i.0 - 1].0 {
                } else {
                    v[i.0 - 1].1 += 1;
                }
            }
            _ => {}
        }
    }
    print!("{} ", v.iter().filter(|x| x.0).count());
    print!("{}", v.iter().filter(|x| x.0).fold(0, |sum, i| sum + i.1));
}


Measured memory_bytes: 9964
#include<iostream>
#include<algorithm>
#include<stdio.h>
#include<cmath>
using namespace std;

struct point{
    int x,y;
};

struct line{
    point s,t;
};

struct bec{
    int x,y;
};

double keisan(point p, line l){
    bec p1,p2,bl,bm;
    p1.x = p.x-l.s.x; p1.y=p.y-l.s.y;
    p2.x = p.x-l.t.x; p2.y=p.y-l.t.y;

    bl.x = l.t.x-l.s.x; bl.y = l.t.y-l.s.y;
    bm.x=-1*bl.x; bm.y=-1*bl.y;

    double cp1,cp2;
    if(sqrt((double)p1.x*(double)p1.x+(double)p1.y*(double)p1.y)==0||sqrt((double)p2.x*(double)p2.x+(double)p2.y*(double)p2.y)==0) return 0;
    cp1 = ((double)p1.x*(double)bl.x+(double)p1.y*(double)bl.y)
    /(sqrt((double)p1.x*(double)p1.x+(double)p1.y*(double)p1.y)*sqrt((double)bl.x*(double)bl.x+(double)bl.y*(double)bl.y));
    cp2 = ((double)p2.x*(double)bm.x+(double)p2.y*(double)bm.y)
    /(sqrt((double)p2.x*(double)p2.x+(double)p2.y*(double)p2.y)*sqrt((double)bm.x*(double)bm.x+(double)bm.y*(double)bm.y));

    if(cp1<=0){
        return sqrt((double)p1.x*(double)p1.x+(double)p1.y*(double)p1.y);
    }
    else if(cp2<=0){
        return sqrt((double)p2.x*(double)p2.x+(double)p2.y*(double)p2.y);
    }
    else{
        double d = sqrt((double)p1.x*(double)p1.x+(double)p1.y*(double)p1.y);
        double k=d*cp1;
        double kyori = sqrt((double)bl.x*(double)bl.x+(double)bl.y*(double)bl.y);
        if(kyori==0) return d;
        double s=((double)l.t.y-(double)l.s.y)/kyori;
        double c=((double)l.t.x-(double)l.s.x)/kyori;
        return sqrt(((k*s+l.s.y)-p.y)*((k*s+l.s.y)-p.y)+((k*c+l.s.x)-p.x)*((k*c+l.s.x)-p.x));

    }
}

void solve(line l,line m){
    double a,b;
    long ta,tb,tc,td;
    ta=(m.s.x-m.t.x)*(l.s.y-m.s.y)+(m.s.y-m.t.y)*(m.s.x-l.s.x);
    tb=(m.s.x-m.t.x)*(l.t.y-m.s.y)+(m.s.y-m.t.y)*(m.s.x-l.t.x);
    tc=(l.s.x-l.t.x)*(m.s.y-l.s.y)+(l.s.y-l.t.y)*(l.s.x-m.s.x);
    td=(l.s.x-l.t.x)*(m.t.y-l.s.y)+(l.s.y-l.t.y)*(l.s.x-m.t.x);
    if(tc*td<0 && ta*tb<0){
        cout<<"0"<<endl;
    }
    else{
        a=min(keisan(l.s,m),keisan(l.t,m));
        b=min(keisan(m.s,l),keisan(m.t,l));
        printf("%.8f\n",min(a,b));
    }
}


int main(){
    int n,x0,x1,x2,x3,y0,y1,y2,y3;
    cin>>n;

    point s1,s2,t1,t2;
    line l,m;

    for(int i=0;i<n;i++){
        cin>>x0>>y0>>x1>>y1>>x2>>y2>>x3>>y3;
        s1.x=x0; s1.y=y0;
        t1.x=x1; t1.y=y1;
        s2.x=x2; s2.y=y2;
        t2.x=x3; t2.y=y3;

        l.s=s1; l.t=t1;
        m.s=s2; m.t=t2;
        solve(l,m);
    }
    return 0;
}


Measured memory_bytes: 3232
#include<iostream>
#include<iomanip>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<string>
#include<utility>
#include<numeric>
#include<algorithm>
#include<cmath>
#include<climits>
using namespace std;

using ll = long long;

class Stream{
public:
    Stream(){

    }
    //配列以外の入力を受け取る
    void read(){

    }
    template<typename First, typename... Rest>
    void read(First& first, Rest&... rest){
        cin >> first;
        read(rest...);
    }
    //配列を区切って出力する
    template<typename T>
    void write_vec(vector<T>& v, char divider){
        for(size_t i = 0; i < v.size(); i++){
            cout << v[i] << divider;
        }
    }
}; 

int main(){
    Stream io;
    
    int N;
    io.read(N);
    string ans = "No";
    for(int i = 0; i <= N; i += 4){
        if((N - i) % 7 == 0){
            ans = "Yes";
            break;
        }
    }
    cout << ans;
    return 0;
}

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

using namespace std;

int main(){
    int a,b,c,x,y;
    cin >> a >> b >> c >> x >> y ;

    int res = 1000000000;
    for(int i=0; i<=max(x,y); i++){
        int m = 2*c*i + max(0,x-i)*a + max(0,y-i)*b;
        res = min(res,m);
    }

    cout << res << endl;

}

Measured memory_bytes: 3600
def mitsukeru(numlist):
	for i in range(2**3):
		listsum=numlist[0]
		outputstring='{}'.format(numlist[0])
		for j in range(3):
			if ((i >> j) & 1):
				listsum +=numlist[j+1]
				outputstring += '+{}'.format(numlist[j+1])
			else:
				listsum -=numlist[j+1]
				outputstring += '-{}'.format(numlist[j+1])
		if listsum == 7:
			return outputstring + '=7'
	return listsum

listnum= [int(x) for x in list(input())]
print(mitsukeru(listnum))
  

Measured memory_bytes: 3060
import math
a, b, x = map(int, input().split())


def calc_deg(a, b, x):
    if x * 2 > a * a * b:
        tmp = 2 * (a * a * b - x) / a / a / a
        ans = math.atan(tmp)
        ans = math.degrees(ans)
    else:
        tmp = a * b * b / x * 0.5
        ans = math.atan(tmp)
        ans = math.degrees(ans)
    return ans


print(calc_deg(a, b, x))


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

int N;
const int MAX_N = 100 + 10;
pair<int, int> ba[MAX_N], cd[MAX_N];

int main() {
    cin >> N;
    for (int i = 0; i < N; i++) {
        int a, b;
        cin >> a >> b;
        ba[i] = make_pair(b, a);
    }
    for (int i = 0; i < N; i++) {
        int c, d;
        cin >> c >> d;
        cd[i] = make_pair(c, d);
    }

    sort(ba, ba+N, greater<>());
    sort(cd, cd+N);
    
    int ans = 0;
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N; j++) {
            if (cd[i].first > ba[j].second && cd[i].second > ba[j].first) {
                ans++;
                ba[j].first = 1.0e9;
                ba[j].second = 1.0e9;
                break;
            }
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;
using namespace std;

int main() {
	int a, b;
	cin >> a >> b;
	cout << a*b - a - b + 1 << endl;
}

Measured memory_bytes: 256
import Data.List

cal m [] = 0
cal m l =
  let v = sum $ take (m-1) l
      r = drop m l
  in
    v + cal m r

ans :: [[Int]] -> [Int]
ans ([0,0]:_) = []
ans (x:y:xs) =
  let [n,m] = x
      v = cal m $ reverse $ sort y
  in
    (v:ans xs)

main = do
  c <- getContents
  let i = map (map read) $ map words $ lines c :: [[Int]]
      o = ans i
  mapM_ print o

Measured memory_bytes: 5420
import java.util.*;

public class Main{
	public static void main(String[] args){
		try(Scanner sc = new Scanner(System.in)){
			int A = sc.nextInt(),
			    B = sc.nextInt(),
			    C = sc.nextInt(),
			    D = sc.nextInt(),
			    E = sc.nextInt(),
			    F = sc.nextInt();
			System.out.println(A + B + C + D + Math.max(E, F) - Math.min(Math.min(A,B),Math.min(C,D)));
		}
	}
}

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

int main(){
  int N;
  cin >> N;
  vector<int> vec(N);
  for (int i = 0; i < N; i++) {
      cin >> vec.at(i);
  }
  int ans = 0;
  bool exist_odd = false;
  while(true){
    for (int i = 0; i < N; i++){
      if(vec.at(i) % 2 == 1){
        exist_odd = true;
      }
    }
    if(exist_odd) break;
    for(int i = 0; i < N; i++){
      vec.at(i) /= 2;
    }
    ans++;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  
  int dig1000,dig100,dig10,dig1;
  
  dig1000 = N / 1000 % 10;
  dig100 = N / 100 % 10;
  dig10 = N / 10 % 10;
  dig1 = N / 1 % 10;
 
if ((dig1000 == dig100 && dig100 == dig10) || (dig100 == dig10 && dig10 == dig1)) cout << "Yes" << endl;
else cout << "No" << endl;
  
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
  public static void main(final String [] args){
       try(Scanner sc = new Scanner(System.in)){
         while (true){
         int a = sc.nextInt();
         String op = sc.next();
         int b = sc.nextInt();
         int c;
           if (op.equals("+")){
             c = a + b;
         } else if(op.equals("-")){
            c = a - b;
         } else if (op.equals("*")){
            c = a * b;
         } else if(op.equals("/")){
            c = a / b;
         } else{
           return;
         }
         System.out.println(c);
        
        }
        
    }
  }
}




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

typedef long long   ll;
const ll mod = 1e9 + 7;

#define speedup_IO      ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define forn(i,a,n)     for(ll i = a; i < n; i++)
#define ford(i,n,a)     for(ll i = n-1; i >= a; i--)
#define pb              push_back
#define lb              lower_bound
#define ub              upper_bound
#define pll             pair<ll,ll>
#define all(a)          (a).begin(),(a).end()
#define reset(a,x)      memset(a,x,sizeof(a))

ll mypow(ll base, ll exp) {ll res = 1; while (exp) {if (exp & 1) res = (res * base) % mod; exp >>= 1, base = (base * base) % mod;} return res;}
ll gcd(ll a, ll b)  { return b ? gcd(b, a % b) : a;            }
ll mult(ll a, ll b) { return ((a % mod) * (b % mod)) % mod;    }
ll add(ll a, ll b)  { return (a % mod + b % mod) % mod;        }
ll sub(ll a, ll b)  { return (a % mod + mod - b % mod) % mod;  }

const ll inf = 1e18;
const int nax = 1e5 + 5;

int main()
{
	speedup_IO;
	ll n,k;
	cin>>n>>k;

	ll p[n];
	forn(i,0,n)
	{
		cin>>p[i];
	}
	ll sum = 0;
	ll st = 0,end = k-1;
	forn(i,0,k)
	{
		sum+=p[i];
	}
	ll maxi = sum;

	forn(i,k,n)
	{
		sum-=p[i-k];
		sum+=p[i];

		if(maxi<sum)
		{
			maxi = sum;
			st = i-k+1;
			end = i;
		}
	}

	double ans = 0;
	forn(i,st,end+1)
	{
		ans += (p[i]+1)/(2.0);
	}

	cout<<fixed<<setprecision(9)<<ans;
	
	return 0;
}

Measured memory_bytes: 1792
a,b=map(int,input().split())
l=[]
for i in range(a,b+1):
    l.append(str(i))
ctr=0
for i in range(len(l)):
    if l[i][0]==l[i][4] and l[i][1]==l[i][3]:
        ctr+=1
print(ctr)


Measured memory_bytes: 8728
#include<bits/stdc++.h>
using namespace std;
const long long LAR=1e16;
long long a[55],b[55];
int main()
{
	int n;
	cin>>n;
	for(int i=1;i<=n;i++)cin>>a[i];
	long long ans=0;
	while(true)
	{
		long long res=0;
		for(int i=1;i<=n;i++)
		{
			res+=a[i]/n;
			b[i]=a[i]/n;
			a[i]%=n;
			a[i]-=b[i];
		}
		if(res==0)break;
		ans+=res;
		for(int i=1;i<=n;i++)a[i]+=res;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <bits/stdc++.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <cmath>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#define rep(i,n) for (int i=0;i<n;i++)
using ll = long long;
using namespace std;


void solve(){

}
int main (){
    ios::sync_with_stdio(0);
    cin.tie(0);
    ll n,x,t;
    cin >> n >> x >> t;
    cout << (n + x - 1) / x * t; 

    return 0;
}

Measured memory_bytes: 3644
x,n = (int(x) for x in input().split())
try:
  p = [int(x) for x in input().split()]
  i = 0
  while 1:
    ans1 = x - i
    ans2 = x + i
    if ans1 not in p:
      print(ans1)
      break
    if ans2 not in p:
      print(ans2)
      break
    i = i + 1
except EOFError:
  print(x)

Measured memory_bytes: 9164
#include <iostream>
#include <iomanip>
typedef long long ll;
using namespace std;
const ll INF = 1e5;
const ll MOD = 1e9 + 7;
#define repi(i, n, init) for (ll i = init; i < (n); i++)

int main()
{
    int N;
    int ans[INF];
    cin >> N;
    repi(i, N, 0)
    {
        int a;
        cin >> a;
        ans[a - 1] = i + 1;
    }
    repi(i, N, 0)
    {
        cout << ans[i] << "\n";
    }
    return 0;
}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define rep2(i, s, n) for (ll i = s; i < (ll)(n); i++)
#define repr(i, n) for (ll i = n; i >= 0; i--)
#define pb push_back
#define COUT(x) cout << (x) << endl
#define COUTF(x) cout << setprecision(15) << (x) << endl
#define ENDL cout << endl
#define DF(x) x.erase(x.begin())  // 先頭文字削除
#define ALL(x) x.begin(), x.end()
#define SORT(x) sort(ALL(x))
#define REVERSE(x) reverse(ALL(x))
#define init() \
  cin.tie(0);  \
  ios::sync_with_stdio(false)
#define debug(x) cerr << "[debug] " << #x << ": " << x << endl;
#define debugV(v)                       \
  cerr << "[debugV] " << #v << ":";     \
  rep(i, v.size()) cerr << " " << v[i]; \
  cerr << endl;
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using P = pair<ll, ll>;
constexpr ll INF = 0x3f3f3f3f3f3f3f3f;
constexpr double PI = 3.141592653589793238462643383279;
ll getDigit(ll x) {
  return x == 0 ? 1 : log10(x) + 1;
}

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

ll lcm(ll a, ll b) {
  return a / gcd(a, b) * b;
}

vector<P> factorize(ll n) {
  vector<P> result;
  for (ll i = 2; i * i <= n; ++i) {
    if (n % i == 0) {
      result.pb({i, 0});
      while (n % i == 0) {
        n /= i;
        result.back().second++;
      }
    }
  }
  if (n != 1) {
    result.pb({n, 1});
  }
  return result;
}

vll divisor(ll n) {
  vll ret;
  for (ll i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      ret.push_back(i);
      if (i * i != n) ret.push_back(n / i);
    }
  }
  SORT(ret);
  return (ret);
}

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

signed main() {
  init();
  ll N;
  cin >> N;
  map<string, ll> m;
  string before = "";
  rep(i, N) {
    string s;
    cin >> s;

    if (i == 0) {
      before = s;
    } else {
      ll c = before[before.size() - 1];
      if (s[0] != c) {
        COUT("No");
        return 0;
      }
      before = s;
    }

    if (m[s] == 0) {
      m[s]++;
    } else {
      COUT("No");
      return 0;
    }
  }
  COUT("Yes");
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
using namespace std;



int main()
{
    int k=0;
    cin >> k;

    if(k %2 == 0)
    {
        cout << (k / 2)*(k / 2) << endl;
    }
    else
    {
        cout << ((k / 2) * (k / 2 +1) ) << endl;
    }
    return 0;
}

Measured memory_bytes: 888
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws Exception {
        // TODO ?????????????????????????????????????????????
        
        
        try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
            String line;
            int sum=0;
            while ((line = br.readLine()) != null) {
            	if(line.equals("0"))break;
            	sum=0;
            	for(int i=0;i<line.length();i++){
            		sum+=Integer.parseInt(line.substring(i, i+1));
            	}
            	System.out.println(sum);
            }
        }
    }

}

Measured memory_bytes: 24528
#include<iostream>
#include<vector>
using namespace std;
int main()
{
    // 入力N
    int n;
    cin >> n;
    n = (n < 1)? 1 : (100 < n)? 100 : n;

    // 入力Ti
    vector<int> t(n);
    for (int i = 0; i < n; i++) {
        cin >> t[i];
    }

    // 入力M
    int m;
    cin >> m;
    m = (m < 1)? 1 : (100 < m)? 100 : m;

    // 入力Pi
    vector<int> p(m*2);
    for (int i = 0; i < m; i++) {
        cin >> p[i*2] >> p[i*2+1];
        p[i*2] = (p[i*2] < 1)? 0 : (100 < p[i*2])? 99 : p[i*2] - 1;
    }

    // 出力（m個分）
    for (int i = 0; i < m; i++) {
        long sum = 0;
        for (int j = 0; j < n; j++) {
             sum += (j == p[i*2])? p[i*2+1] : t[j];
        }
        cout << sum << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#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<int,int>;

int main(){
int a,b;
int x=0;
cin>>a>>b;
rep(i,b-a)x+=i;
cout<<x-a;

}


Measured memory_bytes: 3588
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N; cin>>N;
  vector<long long>A(N,0);
  long long ans=0;
  for(int i=0;i<N;i++){
    int a;cin>>a;
    A[i]=(i==0? 0:A[i-1])+a;
    if(A[i]==0)ans++;
  }
  sort(A.begin(),A.end());
  int count=1;
  for(int i=1;i<N;i++){
    if(A[i]==A[i-1]){ans+=count;count++;}
    else count=1;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 4816
n, m = gets.to_s.split.map{|t|t.to_i}
s = gets.to_s.chomp.bytes

l = []
i = n

begin

  while i >= m
    t = m - s[i-m,m].index(48) # p "0".ord #=> 48
    l << t
    i -= t
  end
  
  l << i if i != 0
  puts l.reverse

rescue

  puts "-1"
  
end

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

typedef long long   signed int LL;
typedef long long unsigned int LU;

#define incID(i, l, r) for(int i = (l)    ; i <  (r); i++)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); i++)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); i--)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); i--)
#define  inc(i, n) incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define  dec(i, n) decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)

#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))

#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define PQ priority_queue

#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
#define  FOR(it, v) for(auto it =  v.begin(); it !=  v.end(); ++it)
#define RFOR(it, v) for(auto it = v.rbegin(); it != v.rend(); ++it)

template<typename T> bool   setmin(T & a, T b) { if(b <  a) { a = b; return true; } else { return false; } }
template<typename T> bool   setmax(T & a, T b) { if(b >  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } }
template<typename T> bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }

// ---- ----

string s, t;
set<string> se;

int main() {
	cin >> s >> t;
	
	dec(i, s.size() - t.size() + 1) {
		string ss = s;
		bool f = true;
		inc(j, t.size()) { if(ss[i + j] != '?' && ss[i + j] != t[j]) { f = false; } }
		if(! f) { continue; }
		inc(j, s.size()) { if(ss[j] == '?') { ss[j] = 'a'; } }
		inc(j, t.size()) { ss[i + j] = t[j]; }
		cout << ss << endl;
		return 0;
	}
	
	cout << "UNRESTORABLE" << endl;
	
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
//#include <iomanip>
#include <string>
//#include <vector>
#include <algorithm>
//#include <utility>
//#include <set>
//#include <map>
//#include <queue>
//#include <deque>
//#include <bitset>
//#include <math.h>
using namespace std ;
//using ll = long long ;
//using ld = long double ;
//using vll = vector<ll> ;
//using vvll = vector<vll> ;
//using vc = vector<char> ;
//using vvc = vector<vc> ;
//using vb = vector<bool> ;
//using vvb = vector<vb> ;
//using pll = pair<ll,ll> ;

//ll mod = 1000000007 ;
//long double pie = acos(-1) ;

void yorn(bool a){if(a) cout << "Yes" << endl ; else cout << "No" << endl ;}
//void YorN(bool a){if(a) cout << "YES" << endl ; else cout << "NO" << endl ;}
//ll gcd(long long a,long long b){if(b==0) return a ; return gcd(b,a%b) ;}
//ll lcm(long long a,long long b){return a/gcd(a,b)*b ;}
//ll sa(long long a,long long b){if(a>b) return a-b ; return b-a ;}
void mysort(string &a){sort(a.begin(),a.end()) ;}
void myrev(string &a){reverse(a.begin(),a.end()) ;}

int main(){
	string s,t ;
	cin >> s >> t ;
	mysort(s) ;
	mysort(t) ; myrev(t) ;
	yorn(s<t) ;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int64_t i=0;i < (int64_t)(n);i++)
#define invrep(i,n) for(int64_t i=n-1;i >= 0L;i--)
#define prep(i,n) for(int64_t i=1;i <= (int64_t)(n);i++)
using namespace std;

//////全探索したいときに開けよ////////
vector<vector<int>> fspattern;
vector<int> fspattern_draft;
int fspcnt = 0;

void setfspattern_core(int floor,int number,int degree){
  if(floor==degree){
    fspattern.at(fspcnt) = fspattern_draft;
    fspcnt++;
  }else{
    rep(i,number){
      fspattern_draft.at(floor) = i;
      setfspattern_core(floor+1,number,degree);
    }
  }
}

void setfspattern(int number,int degree){
  int64_t array_num = 1;
  fspcnt = 0;
  rep(i,degree){
    array_num *= number;
  }
  fspattern = vector<vector<int>>(array_num,vector<int>(degree));
  fspattern_draft = vector<int>(degree);
  setfspattern_core(0,number,degree);
}

//////nCrのmodを求めたいときに開けよ/////////
//int64_t univMod = 1000000007;
//int64_t factnum = 100000
//vector<int64_t> modfact(factnum);
//vector<int64_t> modinvfact(factnum);

/*void setmodfact(){
  for(int i=0;i<factnum;i++){
    if(i == 0){
      modfact.at(i) = 1;
    }else{
      modfact.at(i) = (modfact.at(i-1)*i)%univMod;
    }
  }
}

int64_t calcmodpower(int64_t a,int64_t n){
  int64_t res = 1;
  while(n != 0){
    if(n & 1){
      res = (res * a) % univMod;
    }
    a = (a*a) % univMod;
    n = n >> 1;
  }
  return res;
}

int64_t calcinverse(int64_t n){
	return calcmodpower(n,univMod-2);
}

void setmodinvfact(){
  for(int i=0;i<factnum;i++){
    if(i==0){
      modinvfact.at(i) = 1;
    }else{
      modinvfact.at(i) = calcmodpower(modfact.at(i),univMod-2);
    }
  }
}

int64_t calcmodcomb(int64_t n,int64_t r){
  return (((modfact.at(n)*modinvfact.at(r))%univMod)*modinvfact.at(n-r))%univMod;
}

int64_t calcmodpositive(int64_t n){
  return (n + ((abs(n)+univMod-1)/univMod)*univMod)%univMod;
}
  
    */


/*
int64_t calcGCD(int64_t a,int64_t b){
	int64_t p = a;
	int64_t q = b;
	int64_t c = a%b;
	while(c != 0){
		p = q;
		q = c;
		c = p%q;
	}
	return q;
}
*/

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

Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>

#define N 10000

char isprime(int);

int main(){

  int x,i;
  int X[N+1];
  int count = 0;

  scanf("%d",&x);

  for(i = 1;i <= x;i++){
    scanf("%d",&X[i]);
    if((isprime(X[i])) == 'T'){
      count++;
    }
  }
  printf("%d\n",count);

  return 0;
}

char isprime(x){
  char y;
  int i;
  if(x == 2){
    y = 'T';
    return y;
  }

  if(x < 2 || x % 2 == 0){
    y = 'F';
    return y;
  }

  i = 3;
  while(i <= sqrt(x)){
    if(x % i == 0){
      y = 'F';
      return y;
    }
    i = i + 2;
  }
  y = 'T';
  return y;
}



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

bool in_maze(int, int);

int main(){
	int h, w;
	int max_cost = -1;

	cin >> h >> w;

	vector<string> maze;

	for(int i = 0; i < h; i++) {
		string s;
		cin >> s;
		maze.push_back(s);
	}

	for(int i = 0; i < h; i++) {
		for(int j = 0; j < w; j++) {
			vector<vector<int>> v(h, vector<int>(w, -1));
			queue<pair<int, int>> q;
			int cost = 0;
			int x = j, y = i;

			if(maze[i][j] == '#') { continue; }

			q.push({x, y});
			v[y][x] = 0;

			while(!q.empty()) {
				auto point = q.front();
				q.pop();
				
				x = point.first;
				y = point.second;

				cost = v[y][x];

				if(max_cost < cost) { max_cost = cost; }

				if(in_maze(x - 1, w) && v[y][x - 1] == -1 && maze[y][x - 1] != '#') { q.push({x - 1, y}); v[y][x - 1] = cost + 1; }
				if(in_maze(x + 1, w) && v[y][x + 1] == -1 && maze[y][x + 1] != '#') { q.push({x + 1, y}); v[y][x + 1] = cost + 1; }
				if(in_maze(y - 1, h) && v[y - 1][x] == -1 && maze[y - 1][x] != '#') { q.push({x, y - 1}); v[y - 1][x] = cost + 1; }
				if(in_maze(y + 1, h) && v[y + 1][x] == -1 && maze[y + 1][x] != '#') { q.push({x, y + 1}); v[y + 1][x] = cost + 1; }
			}
		}
	}

	cout << max_cost << endl;
}

bool in_maze(int n, int max) {
	return (0 <= n && n < max);
}

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

#define pb push_back
#define sp " "
#define sl "\n"
#define fi first
#define se second
#define mp make_pair
#define sz(a) ((int)a.size())
#define all(a) a.begin(),a.end()
#define rev(a) reverse(a.begin(),a.end())

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef pair<int,ii> iii;

const int N=1000+5,mod=1000000007;
int a,b,c,d;

int main() {
	cin.tie(0); cout.tie(0);
	ios_base::sync_with_stdio(0);
	cin>>a>>b>>c>>d;
	bool t=true;
	while (a>0 && c>0) {
		if (t) c-=b;
		else a-=d;
		t^=1;
	}
	if (a<=0) cout<<"No";
	else cout<<"Yes";
	return 0;

}


Measured memory_bytes: 3616
import java.io.*;
import java.util.*;

class MyScanner {
    private final InputStream in = System.in;
    private final byte[] buf = new byte[1024];
    private int p = 0;
    private int len = 0;
    private boolean hasNextByte() {
        if (p < len) {
            return true;
        }
        else {
            p = 0;
            try {
                len = in.read(buf);
            } catch (IOException e) {
                e.printStackTrace();
            }
            return len >= 1;
        }
    }
    private int readByte() {
        if (hasNextByte()) {
            return buf[p++];
        }
        else {
            return -1;
        }
    }
    private boolean isPrintableChar(int c) {
        return 33 <= c && c <= 126;
    }
    public boolean hasNext() {
        while (hasNextByte() && !isPrintableChar(buf[p])) p++;
        return hasNextByte();
    }
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b;
        while (isPrintableChar(b = readByte())) {
            sb.appendCodePoint(b);
        }
        return sb.toString();
    }
}

public class Main {
    public static void main(String[] args){
        MyScanner sc = new MyScanner();
        PrintWriter out = new PrintWriter(System.out);
        int n = Integer.parseInt(sc.next());
        long k = Long.parseLong(sc.next());
        Integer[][] a = new Integer[62][n + 1];
        int t = 1;
        for (int i = 1; i <= n; i++) a[0][i] = Integer.parseInt(sc.next());
        for (int i = 0; i < 61; i++) {
            for (int j = 1; j <= n; j++) {
                a[i + 1][j] = a[i][a[i][j]];
            }
            if ((k >> i & 1) == 1) t = a[i][t];
        }
        out.println(t);
        out.flush();
    }
}

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

#define LL long long
#define pii pair<int,int>
#define pLL pair<LL,LL>
#define mp make_pair
#define mt make_tuple
#define pq priority_queue<LL>
#define pqg priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define vec vector<int>
#define vecll vector<LL>
#define vecpii vector<pii>
#define vecpLL vector<pLL>
#define vecbL vector<bool>
#define endl "\n"
#define REP(e,v) for(auto e:v)
#define rep(i, a, n) for(LL i = a; i < n;i++)

using namespace std;


struct edge {
    LL to;
    LL cost;
};

/*
 LL V;

 cin >> V;

 vector<edge> G[V];

 rep(i,0,V){
 	 LL e;

 	 cin >> e;

 	 rep(j,0,e){
 	 	 LL to,cost;
 	 	 cin >> to >> cost;

 	 	 G[j].insert(new edge(to,cost));
 	 }
 }

 */


int inp(){
	int x;
	scanf("%d",&x);
	return x;
}
LL linp(){
	LL x;
	scanf("%lld",&x);
	return x;
}

void outp(int i){
	printf("%d",i);
}

void loutp(LL i){
	printf("%lld",i);
}

LL mod(LL i){
	return i % 1000000007;
}


LL gcd(LL i,LL j){
	if(j != 0)
		return gcd(j, i % j);
	else
		return i;

}

LL A(){
	string s;

	cin >> s;

	if(s == "ABC")
		cout << "ARC";
	else
		cout << "ABC";


	return 0;
}

LL B(){
	LL N,K;

	cin >> N >> K;

	LL d[K] = {0};
	vector<LL> A[K];

	rep(i,0,K){
		cin >> d[i];
		rep(j,0,d[i]){
			LL x;
			cin >> x;
			A[i].push_back(x);
		}
	}

	bool donthave[N];//持っていなければtrue

	rep(i,0,N)
	 donthave[i] = true;

	rep(i,0,K){
		rep(j,0,d[i]){
			if(A[i][j]-1 >= 0)
				donthave[A[i][j]-1] = false;
		}
	}

	LL count = 0;

	rep(i,0,N){
		if(donthave[i]){
			count++;
		}
	}

	cout << count;

	return 0;
}

LL C(){
	LL N,M;

	cin >> N >> M;

	LL H[N];
	rep(i,0,N)
		cin >> H[i];

	rep(i,0,M){


	}
	return 0;
}

LL D(){
	LL X;

	cin >> X;

	rep(A, -1000, 1000){
		rep(B,-1000,1000){
			if(A*A*A*A*A - B*B*B*B*B == X){
				cout << A << " " << B;
				return 0;
			}
		}
	}


	return 0;
}

LL E(){

	return 0;
}

signed main() {
	//A();
	//B();
	//C();
	D();
	//E();
	return 0;
}

Measured memory_bytes: 3628
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<utility>
#include<cmath>
#include<climits>
#include<queue>
#include<stack>
#include<numeric>
#include<tuple>
#include<cassert>
using namespace std;
typedef pair<int, int> P;
typedef long long ll;

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}

const int mod = pow(10, 9) + 7;

int main(){
    int n;
    string s;
    cin >> n >> s;
    int before = 0;
    int ans = 0;
    for(int i = 0; i < n; ++i){
        if(before == s[i])  continue;
        ans++;
        before = s[i];
    }
    cout << ans << endl;
}

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

void printXY(int h, int w)
{
	int min[2] = {150 * 150, 150 * 150};
	for (int y = 1; y <= 149; ++y) {
		for (int x = y + 1; x <= 150; ++x) {
			if (y == x) {
				break;
			}
			int sum = y * y + x * x;
			if (sum >= h * h + w * w && sum < min[0] * min[0] + min[1] * min[1] && !(y == h && x == w)) {
				if (sum == h * h + w * w) {
					if (y > h) {
						min[0] = y;
						min[1] = x;
					}
				} else {
					//if (sum == min[0] * min[0] + min[1] + min)
					//if (y < min[0]) {
						min[0] = y;
						min[1] = x;
					//}
				}
			}


		}
	}

	cout << min[0] << " " << min[1] << endl;
}

int main(void)
{
	while (1) {
		int h, w;
		cin >> h >> w;
		if (h == 0) {
			break;
		}
		printXY(h, w);
		
	}
	return 0;
}


Measured memory_bytes: 3096
void main() {
	auto N = ri;
	ulong res;
	foreach(i; 0..N) {
		auto ip = readAs!(int[]), l = ip[0], r = ip[1];
		res += r - l + 1;
	}
	res.writeln;
}

// ===================================

import std.stdio;
import std.string;
import std.conv;
import std.algorithm;
import std.range;
import std.traits;
import std.math;
import std.container;
import std.bigint;
import std.numeric;
import std.conv;
import std.typecons;
import std.uni;
import std.ascii;
import std.bitmanip;
import core.bitop;

T readAs(T)() if (isBasicType!T) {
	return readln.chomp.to!T;
}
T readAs(T)() if (isArray!T) {
	return readln.split.to!T;
}

T[][] readMatrix(T)(uint height, uint width) if (!isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		res[i] = readAs!(T[]);
	}
	return res;
}

T[][] readMatrix(T)(uint height, uint width) if (isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		auto s = rs;
		foreach(j; 0..width) res[i][j] = s[j].to!T;
	}
	return res;
}

int ri() {
	return readAs!int;
}

double rd() {
	return readAs!double;
}

string rs() {
	return readln.chomp;
}

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

int main(){
	int n,a,b,c;
	cin>>n;
	while(n--){
		cin>>a>>b>>c;
		if(a*a+b*b==c*c || b*b+c*c==a*a || c*c+a*a==b*b){
			cout<<"YES"<<endl;
		}else{
			cout<<"NO"<<endl;
		}
	}
	return 0;
}

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

int main()
{
    int N;
    cin >> N;
    string s;
    cin >> s;
    for(int i = 0; i < s.size(); i++)
    {
        int a = s[i] - 'A';
        a += N;
        if(a>25) a -= 26;
        s[i] = 'A'+a;
    }
    cout << s << endl;
    return 0;
}

Measured memory_bytes: 256