akhauriyash/Code-Regression huggingface dataset:
S = input()
T = input()

ls = len(S)
lt = len(T)

ans = 10 ** 10
for i in range(ls - lt + 1):
    cnt = 0
    for j in range(lt):
        if S[i + j] != T[j]:
            cnt += 1
    ans = min(ans, cnt)
print(ans)


Measured memory_bytes: 67492
import scala.io.StdIn._

object Main extends App {

  val Array(a,b,c) = readLine().split(" ").map(_.toInt)
  val k = readInt()

  def solve() = {
    var(bb, cc) = (b,c)
    var mp = k
    while(mp > 0 && a >= bb) {
      mp -= 1
      bb *= 2
    }
    while(mp > 0 && bb >= cc) {
      mp -= 1
      cc *= 2
    }
    if(cc > bb && bb > a) "Yes" else "No"
  }


  println(solve())

}



Measured memory_bytes: 54828
// https://atcoder.jp/contests/abc068/tasks/arc079_a

#include <bits/stdc++.h>
#define REP(i, n) for (int(i) = 0; (i) < (n); (i)++)
#define REPR(i, n) for (int(i) = (n); (i) >= 0; (i)--)
#define FOR(i, m, n) for (int(i) = (m); (i) < (n); i++)
#define INF 1e9
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;

ll N, M, a, b;
set<ll> s, g;
bool c;
string r;

int main()
{
  cin >> N >> M;

  c = false;
  REP(i, M)
  {
    cin >> a >> b;
    if (!c)
    {
      if (a == 1)
      {
        if (g.count(b - 1) == 1)
          c = true;
        else
          s.insert(b - 1);
      }
      if (b == N)
      {
        if (s.count(a - 1) == 1)
          c = true;
        else
          g.insert(a - 1);
      }
    }
  }

  r = c ? "POSSIBLE" : "IMPOSSIBLE";

  cout << r << '\n';

  return 0;
}


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

int main() {
  ll sum;
  sum = 0;
  ll n;
  cin >> n;
  vector<ll> anum(n);
  rep(i,n){
    cin >> anum[i];
  }
  vector<ll> vec(100001);
  rep(i,n){
    vec[anum[i]]++;
    sum += anum[i];
  }

  ll q;
  cin >> q;
  
  rep(i,q){
    ll b, c;
    cin >> b >> c;
    if(vec[b] == 0){
      cout << sum << endl;
    }
    else{
    sum = sum + vec[b] * (c - b);
    cout << sum << endl;
    vec[c] += vec[b];
    vec[b] = 0;
    }
  }
  
  return 0;
}

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

#define REP(i, n) for(int i = 0;i < n;i++)
#define ll long long
#define ull unsigned long long
using namespace std;


ull gcd(ull a, ull b){
    if(b == 0) return a;
    return gcd(b,a % b);
}


int main(){
    ll N,X;
    cin >> N >> X;
    ll x;
    ll last = 0;
    REP(i,N){
        cin >> x;
        ll diff = abs(x-X);
        last = gcd(last, diff);
    }

    cout << last << endl;
    return 0;
}


Measured memory_bytes: 384
using System;
class Program
{
  static void Main()
  {
    var lines=Console.ReadLine().Split(' ');
    var H=long.Parse(lines[0]);
    var M=long.Parse(lines[1]);
    var L=long.Parse(lines[2]);
    if(L-H-M<0)
      Console.WriteLine("No");
    else{
      
    var N=(L-H-M)*(L-H-M)-4*H*M;
    if(N>0)
    Console.WriteLine("Yes");
    else
       Console.WriteLine("No");
    }
      
    
  }
}

Measured memory_bytes: 11092
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
const int MaxN = 2e5;
using namespace std;
char s[MaxN + 5];
int dp[1 << 26], f[MaxN + 5], a[MaxN + 5];
int main() 
{
	scanf("%s", s + 1);
	int len = strlen(s + 1);
	a[0] = 0;
	for (int i = 1; i <= len; i++) a[i] = a[i - 1] ^ (1 << (s[i] - 'a'));
	dp[0] = 0;
	for (int i = 1; i < (1 << 26); i++) dp[i] = 1 << 30;
	for (int i = 1; i <= len; i++) f[i] = 1 << 30;
	for (int i = 1; i <= len; i++) {
		for (int bit = -1; bit <= 25; bit++) {
			int now = a[i];
			if(bit >= 0) {
				now ^= (1 << bit);
			}
			f[i] = min(f[i], dp[now] + 1);
		}
		dp[a[i]] = min(dp[a[i]], f[i]);
	}
	printf("%d\n", f[len]);
}

Measured memory_bytes: 264064
#include<bits/stdc++.h>
#define fo(i,a,b) for((i)=(a);i<=(b);i++)
#define rfo(i,a,b) for((i)=(a);i>=(b);i--)
#define inrange(x,y,z) (((x)>=(y))&&((x)<=(z)))
#define ALL(vec) (vec).begin(),(vec).end()
#define SOR(vec) sort(ALL(vec))
#define UNI(vec) (vec).erase(unique(ALL(vec)),(vec).end())
using namespace std;
int n,p[5020];
long long k,c[5020],sum,res;
vector<long long> cyc;
long long get(int x){
	if(x==0) return 0;
	long long sum=cyc[0],cur=cyc[0];
	for(int i=1;i<x;i++){
		cur+=cyc[i];
		sum=max(sum,cur);
	} 
	return sum;
}
int main(){
	#ifdef FILIN
		#ifndef DavidDesktop
			freopen(FILIN,"r",stdin);
			freopen(FILOUT,"w",stdout);
		#endif
	#endif
	ios::sync_with_stdio(0);
	cin.tie(NULL);
	cout.tie(NULL);
	cin>>n>>k;
	for(int i=1;i<=n;i++) cin>>p[i];
	for(int i=1;i<=n;i++) cin>>c[i];
	res=-1e18;
	for(int i=1;i<=n;i++){
		cyc.clear();
		int pos=p[i];
		while(pos!=i){
			cyc.push_back(c[pos]);
			pos=p[pos];
		}
		cyc.push_back(c[i]);
		sum=0;
		for(int j=0;j<cyc.size();j++) sum+=cyc[j];
		if(sum>0){
			res=max(res,(long long)(sum*(k/cyc.size())+get(k%cyc.size())));
			if(k<cyc.size()) continue;
			res=max(res,(long long)(sum*(k/cyc.size()-1)+get(cyc.size())));
		}
		else
			res=max(res,get(min((long long)(cyc.size()),k)));
	}
	cout<<res<<endl;
	return 0;
}


Measured memory_bytes: 3816
from heapq import *
from collections import deque

intinf = 10 ** 15

def bfs_01(n, graph, start):
    min_distance = [intinf] * n

    deq = deque()
    min_distance[start] = 0
    deq.append(start)

    while deq:
        src = deq.popleft()
        for dst, cost in graph[src]:
            next_d = min_distance[src] + cost
            if min_distance[dst] <= next_d:
                continue

            min_distance[dst] = next_d
            if cost == 0:
                deq.appendleft(dst)
            elif cost == 1:
                deq.append(dst)
            else:
                print('invalid cost in graph')
                raise ValueError

    return min_distance

def dijkstra(n, graph, start):
    min_distance = [intinf] * n

    # min-heap of (distance, vertex)
    heap = []

    heappush(heap, (0, start))
    min_distance[start] = 0

    while heap != []:
        d, src = heappop(heap)
        if min_distance[src] < d:
            continue
        for dst, cost in graph[src]:
            next_d = d + cost
            if next_d < min_distance[dst]:
                min_distance[dst] = next_d
                heappush(heap, (next_d, dst))

    return min_distance

def main():
    K = int(input())

    # (v, c) in graph[u] <=> u -> v with cost = c
    graph = [[] for _ in range(K)]

    for i in range(K):
        graph[i].append(((i+1) % K, 1))
        graph[i].append((i * 10 % K, 0))

    # dist = dijkstra(K, graph, 1)
    dist = bfs_01(K, graph, 1)

    print(dist[0] + 1)

if __name__ == '__main__':
    main()



Measured memory_bytes: 59440
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin>>N;
  int a[N];
  for(int i=0;i<N;i++) cin>>a[i];
  sort(a,a+N,greater<int>());
  int ans=0;
  for(int i=0;i<N;i++)ans+=(i%2==0)?a[i]:-a[i];
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
# coding=utf-8

###
### for atcorder program
###

import sys
import math

# math class
class mymath:
    ### pi
    pi = 3.14159265358979323846264338

    ### Prime Number
    def pnum_eratosthenes(self, n):
        ptable = [0 for i in range(n+1)]
        plist = []

        for i in range(2, n+1):
            if ptable[i]==0:
                plist.append(i)
                for j in range(i+i, n+1, i):
                    ptable[j] = 1
        return plist

    ### GCD
    def gcd(self, a, b):
        if b == 0:
            return a
        return self.gcd(b, a%b)

    ### LCM
    def lcm(self, a, b):
        return (a*b)//self.gcd(a,b)

    ### Mat Multiplication
    def mul(self, A, B):
        ans = []
        for a in A:
            c = 0
            for j, row in enumerate(a):
                c += row*B[j]
            ans.append(c)
        return ans

mymath = mymath()

### output class
class output:
    ### list
    def list(self, l):
        l = list(l)
        #print(" ", end="")
        for i, num in enumerate(l):
            print(num, end="")
            if i != len(l)-1:
                print(" ", end="")
        print()

output = output()

### input sample
#i = input()
#N = int(input())
#A, B, C = [x for x in input().split()]
#N, K = [int(x) for x in input().split()]
#inlist = [int(w) for w in input().split()]

#R = float(input())
#A.append(list(map(int,input().split())))

#for line in sys.stdin.readlines():
#    x, y = [int(temp) for temp in line.split()]

#abc list
#abc = [chr(ord('a') + i) for i in range(26)]

### output sample
#print("{0} {1} {2:.5f}".format(A//B, A%B, A/B))
#print("{0:.6f} {1:.6f}".format(R*R*math.pi,R*2*math.pi))
#print(" {}".format(i), end="")

def get_input():
    N = []
    while True:
        try:
            N.append(input())
        except EOFError:
            break
    return N

def main():
    A, B, C = [float(x) for x in input().split()]
    
    S = 0.5 * A * B * math.sin(math.radians(C))
    D = math.sqrt(A**2 + B**2 - 2*(A*B)*math.cos(math.radians(C)))
    L = A + B + D
    H = (2 * S) / A

    print("%.15f"%S)
    print("%.15f"%L)
    print("%.15f"%H)

if __name__ == '__main__':
    main()




Measured memory_bytes: 5716
import math

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

B = []
for i in range(N):
    B.append(A[i] - (i+1))

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

ans = 0
for i in range(N):
    ans += abs(B[i] - b)

print(ans)

Measured memory_bytes: 26832
import numpy as np

N,M = map(int ,input().split())
ans = np.array([0 for _ in range(M+1)])
for i in range(N):
    S = list(map(int,input().split()))
    for s in S[1:]:
        ans[s] += 1
cnt = 0
for a in ans:
    if a == N:
        cnt += 1

print(cnt)


Measured memory_bytes: 12500
#include<bits/stdc++.h>
using namespace std;
int n;
long long a,b;
pair<long long,long long>v[100001];
int main()
{
    int m;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>a>>b;
        v[i]=make_pair(a-b,a+b);
    }
    sort(v,v+n);
    int last=0,ans=1;
    for(int i=1;i<n;i++)
    {
        if(v[last].second<=v[i].first)
        {
            last=i;
            ans++;
            continue;
        }
        if(v[last].second>=v[i].second)
        {
            last=i;
            continue;
        }
    }
    cout<<ans;

    return 0;
}


Measured memory_bytes: 1792
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

import itertools
import numpy as np

n, m = map(int, readline().split())
xyz = np.array([tuple(map(int, readline().split())) for _ in range(n)], dtype=np.int64)
bit = list(itertools.product([-1, 1], repeat=3))
ans = 0
for check in bit:
    v = (xyz * check).sum(axis=1)
    v.sort()
    if m != 0:
        ans = max(ans, v[-m:].sum())
print(ans)


Measured memory_bytes: 21064
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp> // Common file
//#include <ext/pb_ds/tree_policy.hpp>
//#include <functional> // for less
#define PI acos(-1.0)
#define eps 1e-9
#define ll long long
#define ull unsigned long long
#define nl printf("\n")
#define sf scanf
#define pf printf
#define INF (ll)1e15
#define mod 1000000007

///#define isValid(n,m,nx,ny)nx>=0&&nx<n&&ny>=0&&ny<m
///int kx[]={1, 1, -1, -1, 2, 2, -2, -2}; //knight moves
///int ky[]={2,-2,  2, -2, 1,-1,  1, -1}; //knight moves
///int dx[]={1,-1,0,0,1,-1,1,-1};//eight direction
///int dy[]={0,0,1,-1,1,-1,-1,1};//eight direction
 
///using namespace __gnu_pbds;
using namespace std;
 
///inline double toRad(double deg){return deg*PI/180;}
///inline double toDeg(double rad){return rad*180/PI;}
///typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> new_data_set;
 
const int S=123456;
int main()
{
    #ifndef ONLINE_JUDGE
    //freopen("input.txt","r",stdin);
    #endif
    string s,t;
    while(cin>>s>>t)
    {
    	s+=t.back();
    	if(s==t)puts("Yes");
    	else puts("No");
    }
    return 0;
}
 









 




























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

typedef long long lint;
typedef pair<int, int> P;
#define REP(i, x, n) for(int i = x ; i < n ; ++i)
#define rep(i, n) for(int i = 0 ; i < n ; ++i)
#define repr(i, n) for(int i = n - 1 ; i >= 0 ; --i)
#define ALL(x) (x).begin(), (x).end()
#define SORT(x) sort((x).begin(), (x).end())

const int IINF = 1e9 + 10;
const long long LLINF = (long long)1e18 + 10;
const long long MOD = (long long)1e9 + 7;
const int dx4[] = {1, 0, -1, 0}, dy4[] = {0, 1, 0, -1};
const int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};
const double EPS = 1e-8;

int main(){
    int n;
    while(cin >> n, n){
        int dis[10][10];
        fill(dis[0], dis[10], IINF);
        rep(i, 10){
            dis[i][i] = 0;
        }
        int maxi = 0;
        rep(i, n){
            int a, b, c;
            cin >> a >> b >> c;
            dis[a][b] = c;
            dis[b][a] = c;
            maxi = max({maxi, a, b});
        }
        ++maxi;
        for(int k = 0 ; k < maxi ; ++k){
            for(int i = 0 ; i < maxi ; ++i){
                for(int j = 0 ; j < maxi ; ++j){
                    dis[i][j] = min(dis[i][j], dis[i][k] + dis[k][j]);
                }
            }
        }
        int tmp = IINF, ans1, ans2;
        rep(i, maxi){
            int cnt = 0;
            rep(j, maxi){
                cnt += dis[i][j];
            }
            if(cnt < tmp){
                tmp = cnt;
                ans1 = i;
                ans2 = cnt;
            }
        }
        printf("%d %d\n", ans1, ans2);
    }
    return 0;
}


Measured memory_bytes: 3092
#include <iostream>
#include <cstdio>
#include <iomanip>
using namespace std;
const int M = 100000;
const double pi = 3.141592653589;

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

		for (int i = 0; i < h; i++) {
			for (int k = 0; k < w; k++) {
				if ((i + k) % 2 == 0) {
					cout << '#';
				}
				else {
					cout << '.';
				}
			}
			cout << endl;
		}
		cout << endl;
	}
	return 0;
}

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

int main() {
  int N;
  cin>>N;
  vector<vector<int>> A(N,vector<int>(2));
  for(int i=0;i<N;i++){
    cin>>A[i][0];
    A[i][1]=i+1;
  }
  sort(A.begin(),A.end());
  for(int i=0;i<N;i++){
  cout << A[i][1]<<" ";
  }
}

Measured memory_bytes: 6272
a, b = map(int, input().split())
#a,bの最大公約数
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a   
#a,bの最小公倍数
def lcm(a, b):
    return a * b // gcd (a, b)

print(lcm(a,b))

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

#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(int i = int(a); i < int(b); i++)
#define REP(...) _overload3(__VA_ARGS__, repi, _rep,)(__VA_ARGS__)
typedef long long int ll;
const int MOD=(int)1e9+7;

ll gcd(ll a,ll 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;
}
ll digitsum(ll a){
    ll x=0;
    while(a>0){
        x+=a%10;
        a/=10;
    }
    return x;
}

int main(){
    int n,ans=0;
    cin>>n;
    vector<int> p(n);
    REP(i,n)cin>>p.at(i);
    sort(p.begin(),p.end(),greater<int>());
    REP(i,n){
        if(i==0)ans+=p.at(0)/2;
        else ans+=p.at(i);
    }
    cout<<ans<<endl;
}

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

using namespace std;

typedef long long ll;
const int maxn = 100005;

inline ll read() {
    reg ll s = 0, t = 0; reg char ch = getchar();
    while (!isdigit(ch)) t |= ch == '-', ch = getchar();
    while (isdigit(ch)) s = (s << 1) + (s << 3) + (ch ^ 48), ch = getchar();
    return t ? -s : s;
}

int n, a[maxn];
int main() {
    n = read(); reg int ans = 0;
    for (reg int i = 1; i <= n; i++) a[i] = read();
    for (reg int i = 2; i < n; i++) {
        if (a[i - 1] < a[i] && a[i] < a[i + 1]) ans++;
        else if (a[i + 1] < a[i] && a[i] < a[i - 1]) ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#define pi 3.14159265358979323846

#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;

int main() {

    long double a, b, h, m;
    cin >> a >> b >> h >> m;
    //calculating deg
    long double hdeg = h * 30;
    long double mdeg = m * 6;
    hdeg += mdeg / 12;
    long double deg = abs(hdeg - mdeg);
    //apply law of cosines
    long double cosdeg = cos(deg * pi / 180);
    long double asqr = a * a;
    long double bsqr = b * b;
    long double c = sqrt(asqr + bsqr - 2 * a * b * cosdeg);
    cout << fixed << showpoint;
    cout << setprecision(20);
    cout << c << endl;
    return 0;


}


Measured memory_bytes: 4112
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <queue>
using ll = long long;
using namespace std;

int const MOD = 1e9 + 7;

int main(void)
{
    int A, B, C, D, E, F;

    int max_w, max_s, s, w;
    double maxV = 0.0;
    cin >> A >> B >> C >> D >> E >> F;
    for (int i = 0; 100 * A * i <= F; ++i)
    {
        for (int j = 0; 100 * (i * A + j * B) <= F; ++j)
        {
            for (int k = 0; 100 * (i * A + j * B) + k * C <= F; ++k)
            {
                for (int l = 0; 100 * (i * A + j * B) + k * C + l * D <= F; ++l)
                {

                    s = k * C + l * D;
                    w = 100 * (i * A + j * B);

                    if (i == 0 && j == 0 && k == 0 && l == 0)
                        continue;
                    if ((w * E) / 100 < s)
                        continue;

                    double p = (double)100.0 * s / (s + w);
                    if (p >= maxV)
                    {
                        maxV = p;
                        max_w = w;
                        max_s = s;
                    }
                }
            }
        }
    }
    cout << max_w + max_s << " " << max_s << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int second = sc.nextInt();
        int hours = second / 3600;
        int minutes = (second - 3600 * hours)/60;
        int seconds = second - 3600 * hours - 60 * minutes;
        
        System.out.println(hours + ":" + minutes + ":" + seconds);
    }
}


Measured memory_bytes: 26268
#define TEMPLATE_USED
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pl;
typedef vector<pl> vp;
const ll INF=1001001001;
const ll LINF=1001001001001001001;
const ll D4[]={0,1,0,-1,0};
const ll D8[]={0,1,1,0,-1,-1,1,-1,0};
#define _overload3(_1,_2,_3,name,...) name
#define _rep2(i,n) for(ll i=0;i<(n);++i)
#define _rep3(i,a,b) for(ll i=(ll)(a);i<(ll)(b);++i)
#define rep(...) _overload3(__VA_ARGS__,_rep3,_rep2)(__VA_ARGS__)
#define _repe2(i,n) for(ll i=0;i<=(ll)(n);++i)
#define _repe3(i,a,b) for(ll i=(ll)(a);i<=(ll)(b);++i)
#define repe(...) _overload3(__VA_ARGS__,_repe3,_repe2)(__VA_ARGS__)
#define _rrep2(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define _rrep3(i,a,b) for(ll i=(ll)(b)-1;i>=(ll)(a);i--)
#define rrep(...) _overload3(__VA_ARGS__,_rrep3,_rrep2)(__VA_ARGS__)
#define _rrepe2(i,n) for(ll i=(ll)(n);i>=0;i--)
#define _rrepe3(i,a,b) for(ll i=(ll)(b);i>=(ll)(a);i--)
#define rrepe(...) _overload3(__VA_ARGS__,_rrepe3,_rrepe2)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
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;}

ll A;
ll B;
ll K;

void solve();

int main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    cin >> A;
    cin >> B;
    cin >> K;
    solve();
}

// 入力は全て整数である。
// 1 <= A, B <= 100
// A も B も割り切る正整数のうち、K 番目に大きいものが存在する。
// K >= 1

// ll A, ll B, ll K
// A も B も割り切る正整数のうち、K 番目に大きいものを出力せよ。
void solve(){
    vl a;
    repe(i,1,100){
        if(A%i==0&&B%i==0){
            a.push_back(i);
        }
    }
    sort(all(a),greater<ll>());
    cout<<a[K-1]<<endl;
}


Measured memory_bytes: 3648
#include <iostream>
using namespace std;
int main()
{
    int l,r;
    while (cin>>l>>r)
    {
        int flag=0;
        for (int i=min(l,r);i<=max(l,r);i++)
        {
            if (i*l*r%2==1)
                {
                    flag=1;
                }
        }
        if (flag)
        {
            cout<<"Yes"<<endl;
        }
        else
        {
            cout<<"No"<<endl;
        }
    }

    return 0;
}


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

int main(){
	char ch;
	while(1) {
		scanf("%c", &ch);
		if(ch == '0'){
			//cout << endl;
			break;
		}
		int sum = ch - '0';
		while(1){
			scanf("%c", &ch);
			if(ch == '\n') break;
			sum += int(ch) - '0';
		}
		cout << sum <<endl;
	}
	return 0;
}

Measured memory_bytes: 1156
# -*- coding: utf-8 -*-
"""
@author: H_Hoshigi
"""
def main():
    D, T, S = map(int, input().split())

    answer = ""    
    if S * T >= D:
        answer = "Yes"
    else:
        answer = "No"
    print(answer)

if __name__ == "__main__":
    main()



Measured memory_bytes: 9156
#include <bits/stdc++.h>
struct Istream {
	template <class T> 
	Istream &operator >>(T &x) {
		static char ch;static bool neg;
		for(ch=neg=0;ch<'0' || '9'<ch;neg|=ch=='-',ch=getchar());
		for(x=0;'0'<=ch && ch<='9';(x*=10)+=ch-'0',ch=getchar());
		x=neg?-x:x;
		return *this;
	}
	template <class T>
	operator T() {
		static T x;
		*this>>x;
		return x;
	}
}is;
struct Ostream {
	template <class T>
	Ostream &operator <<(T x) {
		x<0 && (putchar('-'),x=-x);
		static char stack[233];static int top;
		for(top=0;x;stack[++top]=x%10+'0',x/=10);
		for(top==0 && (stack[top=1]='0');top;putchar(stack[top--]));
		return *this;
	}
	Ostream &operator <<(char ch) {
		putchar(ch);
		return *this;
	}
}os;

int main() {
	int n=is,P=is;
	static long long f[52][2];
	f[0][0]=1;
	for(int i=1;i<=n;++i) {
		int x=is;
		f[i][0]=f[i-1][0]+f[i-1][x&1];
		f[i][1]=f[i-1][1]+f[i-1][~x&1];
	}
	os<<f[n][P]<<'\n';
	return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#define N 1551
inline int min(int x,int y){return x<y?x:y;}
inline int max(int x,int y){return x<y?y:x;}
int A[N],B[N][N],C[N][N],D[N][N],E[N][N],F[N][N],X,a[N][N],b[N][N],d[N],e[N],f[N][N],g[N],h,i,j,k,o,p,q[N],t;char c[N][N],s[N][N];long long x;
inline int get(int x,int y,int z){return f[x][y]<=z?z=min(z,min(d[x],d[y])),A[z]-B[z][x+1]-C[z][y-1]+D[x+1][y-1]:0;}
inline void solve(int m,int n)
{
    for(i=1;i<=m;i++)a[i][0]=a[i][n+1]=n+1,b[i][0]=b[i][n+1]=E[i][n+1]=0,E[i][0]=m+1;
    for(j=1;j<=n;j++)a[0][j]=a[m+1][j]=n+1,b[0][j]=b[m+1][j]=E[m+1][j]=0,E[0][j]=m+1;
    for(i=0;i<=n;i++)memset(D[i+1],0,n+1<<2),memset(F[i]+1,0x3f,n+1<<2);
    for(h=m+2>>1,memset(A+h-1,0,m-h+2<<2),i=h-1;i<=m;i++)memset(B[i]+1,0,n+1<<2),memset(C[i],0,n+1<<2);
    for(j=1;j<=n;j++)!c[h][j]?a[h][j]=n+1,b[h][j]=0:a[h][b[h][j]=j]=min(a[h][j-1],j);
    for(i=h+1;i<=m;i++)for(j=1;j<=n;j++)c[i][j]?a[i][j]=min(a[i-1][j],a[i][j-1]),b[i][j]=max(b[i-1][j],b[i][j-1]):(a[i][j]=n+1,b[i][j]=0);
    for(i=m;i>=h;i--)for(j=n;j;j--)E[i][j]=c[i][j]?max(max(E[i+1][j],E[i][j+1]),i):0;
    for(memcpy(d+1,E[h]+1,n<<2),i=1;i<=h;i++)for(j=1;j<=n;j++)E[i][j]=c[i][j]?min(min(E[i-1][j],E[i][j-1]),i):m+1;
    for(memcpy(e+1,E[h]+1,n<<2),i=m;h<=i;i--)for(j=1;j<=n;j++)if(a[i][j]<=b[i][j])A[i]+=c[i][j],B[i][a[i][j]]+=c[i][j],C[i][b[i][j]]+=c[i][j],D[a[i][j]][b[i][j]]+=c[i][j],F[a[i][j]][b[i][j]]=i;
    for(i=h;i<=m;i++)for(j=1;j<=n;j++)C[i][j]+=C[i-1][j]+C[i][j-1]-C[i-1][j-1];
    for(i=h;i<=m;A[i]+=A[i-1],i++)for(j=n;j;j--)B[i][j]+=B[i-1][j]+B[i][j+1]-B[i-1][j+1];
    for(i=n;i;i--)for(j=1;j<=n;j++)D[i][j]+=D[i+1][j]+D[i][j-1]-D[i+1][j-1];
    for(i=1;i<=n;i++)for(j=n;j;j--)F[i][j]=min(min(F[i-1][j],F[i][j+1]),F[i][j]);
    for(i=1;i<=n;i++)for(j=i;j<=n;j++)f[i][j]=F[i][j]<=min(d[i],d[j])?F[i][j]:m+1;
    for(j=n;j;j--)!c[h][j]?a[h][j]=n+1,b[h][j]=0:b[h][a[h][j]=j]=max(b[h][j+1],j);
    for(i=h;--i;)for(j=n;j;j--)c[i][j]?a[i][j]=min(a[i+1][j],a[i][j+1]),b[i][j]=max(b[i+1][j],b[i][j+1]):(a[i][j]=n+1,b[i][j]=0);
    for(i=1;i<h;i++)for(j=1,k=t=1,X=o=p=0;j<=n;j++)if(a[i][j]<=b[i][j])
    {
        while(k<=b[i][j])
        if(e[k]<=i)
        {
            for(q[p]=0;o<p&&d[q[p]]<d[k];p--)X-=g[q[p-1]],X+=g[q[p-1]]-=get(q[p-1],k,min(d[q[p-1]],d[k]))-get(q[p-1],k,min(d[q[p]],d[k]));
            X+=g[q[++p]=k]=get(k,k,m),p++,k++;
        }
        else k++;
        while(t<a[i][j])e[t]<=i?X-=g[t]:0,t++;
        while(o<p&&q[o]<a[i][j])o++;
        x+=X*c[i][j];
    }
}
void dfs(int l,int r,int L,int R)
{
    if(l==r&&L==R)return;
    else if(r-l<R-L)
    {
        for(i=0;i<=R-L;i++)for(j=0;j<=r-l;j++)c[i+1][j+1]=s[j+l][i+L];
        solve(R-L+1,r-l+1),dfs(l,r,L,L+R-1>>1),dfs(l,r,L+R+1>>1,R);
    }
    else
    {
        for(i=0;i<=r-l;i++)memcpy(c[i+1]+1,s[i+l]+L,R-L+1<<2);
        solve(r-l+1,R-L+1),dfs(l,l+r-1>>1,L,R),dfs(l+r+1>>1,r,L,R);
    }
}
int n;
int main()
{
    scanf("%d",&n);
    for(i=1;i<=n;i++)for(scanf("%s",s[i]+1),j=1;j<=n;j++)s[i][j]=s[i][j]=='#'?0:s[i][j]^48;
    dfs(1,n,1,n),printf("%lld\n",x);
    return 0;
}

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

const int N = 1000010;

int n;
int a[N][4];
int opt[N][4];

int main() {
	cin >> n;
	for (int i = 1; i <= n; ++i) {
		for (int j = 1; j <= 3; ++j) {
			cin >> a[i][j];
		}
	}

	for (int i = 1; i <= 3; ++i) {
		opt[1][i] = a[1][i];
	}

	for (int i = 2; i <= n; ++i) {
		for (int j = 1; j <= 3; ++j) {
			for (int k = 1; k <= 3; ++k) {
				if (j != k) {
					opt[i][j] = max(opt[i][j], opt[i - 1][k] + a[i][j]);
				}
			}
		}
	}
	int ans = 0;
	ans = max(ans, opt[n][1]);
	ans = max(ans, opt[n][2]);
	ans = max(ans, opt[n][3]);

	cout << ans << endl;
}

Measured memory_bytes: 5888
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <vector>
using namespace std;
typedef long long ll;

ll N;

int main()
{
    cin >> N;
    ll temp = N - 1;
    ll ans = 1;
    for (ll i = 2; i * i <= N; i++)
    {
        int cnt = 0;
        while (temp % i == 0)
        {
            temp /= i;
            cnt++;
        }
        ans *= cnt + 1;
    }
    if (temp > 1)
        ans *= 2;

    for (ll i = 2; i * i <= N; i++)
    {
        if (N % i == 0)
        {
            ll temp1 = N;
            while (temp1 % i == 0)
                temp1 /= i;
            
            if (temp1 % i == 1)
                ans++;

            temp1 = N;
            while (temp1 % (N / i) == 0)
                temp1 /= (N / i);
            
            if (temp1 % (N / i) == 1)
            {
                if (i * i != N)
                    ans++;
            }
        }
    }

    cout << ans << endl;
    // system("pause");
}

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

// loop macro
#define PER(ITER,TIMES) for(auto ITER = 0; ITER < TIMES; ++ITER)

// helper macro
#define FUCK(IT) #IT": " << IT << ": "
#define ALL(ITER) ITER.begin(), ITER.end()

void solve(void);

/* --- MAIN PART ----------------------------------------------------------- */

#define SOLVE_F
#ifdef SOLVE_E

void solve(void) {
    int n;
    cin >> n;
    vector<int> a(n);
    PER(i, n) {
        cin >> a[i];
    }
    sort(ALL(a), [](const int& a, const int& b){return a > b;});
    int result = a[0];
    PER(i, (a.size() - 2) / 2) {
        result += 2 * a[i + 1];
    }
    if ((a.size() - 2) % 2) {
        result += a[(a.size() - 2 / 2) + 1];
    }
    cout << result;
    return;
}

#endif

#ifdef SOLVE_F

void solve(void) {
    int n, m, sum;
    cin >> n >> m >> sum;
    PER(i, m) {
        cout << sum << " ";
    }
    PER(i, n - m) {
        cout << (sum == (int)1e9 ? (sum / 2 + 2) : sum + 1) << " ";
    }
    return;
}

#endif

#ifdef SOLVE_B

long long times (const vector<long long>& sorted, long long len) {
    long long result = 1;
    PER (i, len) {
        result *= sorted[i];
    }
    return result;
}

void solve(void){
    long long n, k;
    cin >> n >> k;
    vector<long long> a(n);
    PER(i, n) {
        cin >> a[i];
    }

    vector<long long> up, down;
    PER(i, n) {
        if (a[i] > 0) {
            up.push_back(a[i]);
        } else if (a[i] < 0) {
            down.push_back(a[i] = -a[i]);
        }
    }

    long long result = 0;
    if ((k % 2 == 1 && up.size() == 0) || (down.size() == 1 && up.size() == k - 1)) {
        if (up.size() + down.size() != a.size()) {
            result = 0;
        } else {
            sort(ALL(a));
            for (int i = 0; i < k; ++i) {
                result += -a[i];
            }
            while (result < 0) {
                result += (long long) 1e9 + 7;
            }
        }
    } else {
        sort(ALL(up), [](const long long& a, const long long& b){return a > b;});
        sort(ALL(down), [](const long long& a, const long long& b){return a > b;});

        for(long long i = 0; i <= down.size(); i += 2) {
            long long _ = times(up, k - i) * times(down, i);
            result = (result > _ ? result : _);
            result %= (long long)1e9 + 7;
        }
    }

    cout << result << endl;

    return;
}

#endif // for solve

/* ------------------------------------------------------------------------- */

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


Measured memory_bytes: 3620
#include <stdio.h> 
int main(void) {
  int n, fish, num, i, max = 0, maxnum = 1;

  scanf("%d",&n);
  
  for(i = 0; i < n; i++ ) {
    scanf("%d",&num);
    scanf("%d",&fish);
    if(max < fish) {
      max = fish;
      maxnum = num;
    }
    if(max == fish && maxnum > num) {
      maxnum = num;
    }
  }
  printf("%d %d\n",maxnum,max);
  return(0);
}

Measured memory_bytes: 600
#include <iostream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstdlib>
#include <cassert>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <string>
#include <algorithm>
#define llint long long
#define inf 1e18
#define rep(x, s, t) for(llint (x) = (s); (x) < (t); (x)++)
#define Rep(x, s, t) for(llint (x) = (s); (x) <= (t); (x)++)

using namespace std;

llint h, w;
char c[105][105];
llint dp[105][105][2];

int main(void)
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	cin >> h >> w;
	for(int y = 1; y <= h; y++){
		for(int x = 1; x <= w; x++){
			cin >> c[x][y];
			if(c[x][y] == '.') c[x][y] = '0';
			else c[x][y] = '1';
		}
	}
	
	for(int y = 1; y <= h; y++){
		for(int x = 1; x <= w; x++){
			for(int i = 0; i < 2; i++){
				dp[x][y][i] = inf;
			}
		}
	}
	dp[1][1][c[1][1]-'0'] = c[1][1]-'0';
	
	for(int y = 1; y <= h; y++){
		for(int x = 1; x <= w; x++){
			for(int i = 0; i < 2; i++){
				for(int j = 0; j < 2; j++){
					if(x+1 <= w && c[x+1][y] == j+'0'){
						int cost = 0;
						if(i != j) cost = 1;
						dp[x+1][y][j] = min(dp[x+1][y][j], dp[x][y][i] + cost);
					}
					if(y+1 <= h && c[x][y+1] == j+'0'){
						int cost = 0;
						if(i != j) cost = 1;
						dp[x][y+1][j] = min(dp[x][y+1][j], dp[x][y][i] + cost);
					}
				}
			}
		}
	}
	
	llint ans = min(dp[w][h][0], dp[w][h][1]);
	cout << (ans+1)/2 << endl;
	
	return 0;
}

Measured memory_bytes: 384
#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);
    int n;
    cin >> n;
    vector<int> a(n+1);
    for(int i=1;i*i<=n;i++){
        for(int j=1;j*j<=n;j++){
            for(int k=1;k*k<=n;k++){
                int m = i*i + j*j + k*k + i*j + j*k + i*k;
                if(m<=n){
                    a[m]++; 
                }
            }
        }
    }
    rep(i,n){
        cout << a[i+1] << endl;
    }

    return 0;
}

Measured memory_bytes: 3604
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <set>
#include <map>
#include <functional>
#include <cmath>
#include <cassert>
#include <string>

using namespace std;
typedef long long int ll;
typedef pair <int,int> P;

int A[4];
int B[4]={1,4,7,9};

int main()
{
	for(int i=0;i<4;i++) scanf("%d",&A[i]);
	sort(A,A+4);
	for(int i=0;i<4;i++)
	{
		if(A[i]!=B[i])
		{
			puts("NO");
			return 0;
		}
	}
	puts("YES");
	return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<cmath>
#include<string>
#include<bitset>
#include <sstream>
#include<queue>
#include<set>
#define rep(i,n) for(ll i=0;i<(n);++i)
using namespace std;
typedef long long ll;
typedef pair<int,ll>P;

const ll mod = 1e9+7;
const ll INF = 1e9;
const ll MAXN = 1e6;

int main()
{
    int n,m;
    cin>>n>>m;
    map<int,int>like;
    map<int,int> ::iterator itr;
    rep(i,n)
    {
        int k;
        cin>>k;
        rep(j,k)
        {
            int a;
            cin>>a;
            like[a]+=1;
        }
    }
    int ans=0;
    for(itr=like.begin();itr!=like.end();itr++)
    {
        if(itr->second==n)ans++;
    }

    cout<<ans;

}

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

public static partial class Program
{
    //テンプレここから
    public static int ToInt(this string str)
    {
        return int.Parse(str);
    }
    public static IEnumerable<int> ToInt(this string[] strs)
    {
        return strs.Select(x => x.ToInt());
    }
    public static IEnumerable<int> SplToInt(this string str, char opr = ' ')
    {
        return str.Split(opr).ToInt();
    }
    public static string CRL()
    {
        return Console.ReadLine();
    }
    public static void CWL(object obj)
    {
        Console.WriteLine(obj);
    }
    public static int Diff(int a, int b)
    {
        return Math.Abs(Math.Max(a, b) - Math.Min(a, b));
    }
    public static long Diff(long a, long b)
    {
        return Math.Abs(Math.Max(a, b) - Math.Min(a, b));
    }
    //テンプレここまで
}

public static partial class Program
{
    static void Main()
    {
        var nk = CRL().SplToInt().ToArray();
        var xs = CRL().SplToInt().ToArray();
        var min = int.MaxValue;
        for (int i = 0; i <= nk[0] - nk[1]; i++)
        {
            min = Math.Min(min, Time(xs[i], xs[i + nk[1] - 1]));
        }
        CWL(min);
    }

    static int Time(int min, int max)
    {
        var near = 0;
        var far = 0;
        if (Diff(min, 0) < Diff(max, 0))
        {
            near = min;
            far = max;
        }
        else
        {
            near = max;
            far = min;
        }

        if (Math.Sign(near) == Math.Sign(far))
        {
            return Math.Abs(far);
        }
        else
        {
            return Math.Abs(near) * 2 + Math.Abs(far);
        }
    }
}


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

int main(void)
{
	int a, b, c;
	int tyouhou, hisigata;

	tyouhou = hisigata = 0;

	while (scanf("%d,%d,%d", &a, &b, &c) != EOF) {
		if (a*a + b*b == c*c) {
			tyouhou++;
		}
		else if (a == b) {
			hisigata++;
		}
	}

	printf("%d\n%d\n", tyouhou, hisigata);

	return (0);
}

Measured memory_bytes: 596
import sys
def Z(): return int(input())
def ZZ(): return [int(_) for _ in input().split()]

def main():
    N = Z()
    i = 0
    print(i, flush=True)
    s = input()

    f = s
    first, last = 0, N

    while s != 'Vacant':
        i = (first + last)//2
        print(i, flush=True)
        s = input()
        if s == 'Vacant': break
        if (i%2 == 0 and f == s) or (i%2 == 1 and f != s): first = i
        else: last = i
    return

if __name__ == '__main__':
    main()
    sys.exit(0)


Measured memory_bytes: 3660
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
using namespace std;

#define rep(i,x) for(ll i=0;i<x;i++)
#define repn(i,x) for(ll i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 998244353;
const ll MAX = 1000001;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

ll gcd(ll a, ll b) {
	if (b == 0) { return a; }
	if (a < b) { return gcd(b, a); }
	return gcd(b, a%b);
}

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

struct edge {
	ll ind;
	ll fr;
	ll to;
	ll d;
};


///////////////////////////



int main() {
	ll N;
	cin >> N;

	vector<ll> p(N + 1,0);
	repn(i, N) {
		ll x;
		cin >> x;
		p[x] = i;
	}

	vector<ll> a(N + 1), b(N + 1);
	a[1] = b[1] = 1;

	for(ll i=2; i<=N; i++) {
		a[i]=a[i-1]+1;
		b[i]=b[i-1]-1;

		if (p[i-1] < p[i]) {
			a[i] += p[i] - p[i-1];
		}

		else {
			b[i] += p[i] - p[i-1];
		}
	}

	repn(i, N) cout << a[i] << " ";
	cout << endl;
	repn(i, N) cout << b[i] - b[N] + 1 << " ";

	system("PAUSE");
}


Measured memory_bytes: 1272
#include <algorithm>
#include <bitset>
#include <cmath>
#include <iostream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <utility>
#include <unordered_map>
#include <unordered_set>
using namespace std;

#define ABS(a) (((a) >= 0) ? (a) : -(a))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) > (b) ? (b) : (a))
#define FOR(i, a, b) for (int i = (a); i <= (b); ++i)
#define RFOR(i, a, b) for (int i = (a); i >= (b); --i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define NINTH_POWER_OF_TEN 1000000000
#define int long long

typedef long long ll;
typedef pair<int, int> Pair;

// const int kMaxN;

int N, K;
int ans = 0;

int Pow(int a, int b) {
  int r = 1;
  REP(i, b) { r *= a; }
  return r;
}

signed main() {
  cin >> N >> K;

  if (K%2 == 0) {
    int a = N/K;
    int b = (N+(K/2))/K;
    ans = Pow(a, 3) + Pow(b, 3);
  } else {
    ans = Pow(N/K, 3);
  }

  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second

using pi = pair<int,int>;

const int N=1000;
const int INF=INT_MAX/3;
int f[N][N];
int s[N][N];
pi pos[N*N];

int main()
{
    int h,w;
    scanf(" %d %d", &h, &w);
    rep(i,h)rep(j,w)
    {
        scanf(" %d", &f[i][j]);
        --f[i][j];
        pos[f[i][j]] = pi(i,j);
    }

    #define IN(x,y) (0<=x && x<w && 0<=y && y<h)
    int dx[4]={1,-1,0,0}, dy[4]={0,0,1,-1};

    memset(s,-1,sizeof(s));
    rep(i,h*w)
    {
        int x=pos[i].se, y=pos[i].fi;

        int low=0;
        rep(d,4)
        {
            int nx=x+dx[d], ny=y+dy[d];
            if(!IN(nx,ny)) continue;
            low += (i>f[ny][nx]);
        }
        if(low==0) s[y][x]=i;

        rep(d,4)
        {
            int nx=x+dx[d], ny=y+dy[d];
            if(!IN(nx,ny)) continue;

            if(i<f[ny][nx])
            {
                if(s[ny][nx]==-1) s[ny][nx] = s[y][x];
                else
                {
                    if(s[ny][nx] != s[y][x]) s[ny][nx] = INF;
                }
            }
        }
    }

    int ans=0;
    rep(i,h)rep(j,w) ans+=(s[i][j]==INF);
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 18844
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

n, *h = map(int, read().split())
ans = h[0]
for bf, af in zip(h, h[1:]):
    if af > bf:
        ans += af - bf
print(ans)


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const ll INF = 1LL << 60;

int main() {
    int a, b; cin >> a >> b;
    if (b % a == 0) {
        cout << a + b << endl;
    } else {
        cout << b - a << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define For(i,n) for(ll i=0;i<(n);i++)
#define For1(i,n) for(ll i=1;i<(n);i++)
int main(){
    ll a,b;cin>>a>>b;
    ll ans=0;
    while(1<b){
        b-=(a-1);
        ans++;
    }
    cout<<ans<<endl;
}


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

int main(){
    ll x, a, b;
    cin >> x >> a >> b;
    if(a >= b){
        cout << "delicious" << endl;
    } else if(b <= a + x && a < b){
        cout << "safe" << endl;
    } else {
        cout << "dangerous" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> pll;
const ll mod=1e9+7;
//const ll mod=998244353;
const ll inf=1LL<<61;

int main() {
  ll n;
  cin >> n;
  vec a(n);
  ll ans;
  for(ll i=0;i<n;i++) {
    cin >> a[i];
    if(i) {
      ans^=a[i];
    }
    else {
      ans=a[i];
    }
  }
  for(ll i=0;i<n;i++) {
    if(i) cout << " ";
    ll res=ans^a[i];
    cout << res;
  }
  cout << endl;
}

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

#define int long long
using namespace std;
#define rep(i, n) for(int i=0;i<(n);++i)
typedef pair<int, int> pii;
const int INF = 1l << 60;
#define u_b upper_bound
#define l_b lower_bound

int N;

signed main() {
    cin >> N;
    int ans = 0;

    for (int x = 1; x <= 1000000; ++x) {
        if (N % x != 0)continue;
        // N/m=N%m=x
        // N/m=x
        // N/ml=x,N/(ml-1)>x
        int ml = N + 1, mz = 0;
        while (ml - mz > 1) {
            int m = (ml + mz) / 2;
            if (N / m <= x)ml = m;
            else mz = m;
        }
        if (N / ml != x)continue;
        // N/mr=x,N/(mr+1)<x
        int mr = 0, mi = N + 1;
        while (mi - mr > 1) {
            int m = (mr + mi) / 2;
            if (N / m >= x)mr = m;
            else mi = m;
        }
        if (N / mr != x)continue;
        //for (int m = ml; m <= mr; ++m) {
        // if (N == (m + 1) * x)ans += m;
        //}
        int m = N / x - 1;
        if (ml <= m && m <= mr)ans += m;
    }

    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	int i, n ,a,a1,a2;
	char b;
	cin>>a;
	a1=a%100;
	a2=a/100;
	if(a1<=12&&a1>=1 &&a2<=12&&a2>=1){
		
		cout<<"AMBIGUOUS";
		return 0;
	}
	if(a1<=12&&a1>=1){
		cout<<"YYMM";
		return 0;
	}
	if(a2<=12&&a2>=1){
		cout<<"MMYY";
		return 0;
	}
		cout<<"NA";
		return 0;
	
	
	
	
	
}


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


int main() {
  ll n, k; cin >> n >> k;
  vector<ll> a(n);
  rep(i, n) {
    cin >> a[i];
    a[i]--;
  }

  vector<bool> seen(n, false);
  vector<int> keiro;
  int now = 0;
  int ans = 0;
  int joint = 0;

  int i = 0;
  while (true) {
    i++;
    if (i > n) break;

    keiro.push_back(now);
    seen[now] = true; 
    int next = a[now];

    if (!seen[next]) {
      now = next;
    } else {
      joint = next;
      break;
    }
  }

  rep(i, keiro.size()) {
    if (keiro[i] != joint) {
      if (k > 0) {
        k--;
      } else {
        ans = keiro[i] + 1;
        break;
      }
    } else {
      if (i == (keiro.size() - 1)) {
        ans = keiro[i] + 1;
        break;
      } else {
        ll remain = keiro.size() - i;
        k %= remain;
        ans = keiro[i + k] + 1;
        break;
      }
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 5856
#include <bits/stdc++.h>
using namespace std;
int dayToNumber(string day){
  if(day == "SUN") return 7;
  if(day == "MON") return 6;
  if(day == "TUE") return 5;
  if(day == "WED") return 4;
  if(day == "THU") return 3;
  if(day == "FRI") return 2;
  if(day == "SAT") return 1;
}
int main(){
  string s;
  cin>>s;
  cout<< dayToNumber(s);
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
typedef long long ll;
ll n, m, x[1100], y[1100], z[1100];
ll dp[8][1100][1100];
ll INF = 330000000000000000, res1, res2;
ll inf = -330000000000000000;
ll dfs0(ll a, ll b){
    if (a == n && b < m) {
        return inf;
    } else if (a == n || b == m) {
        return 0;
    } else if (dp[0][a][b] != INF) {
        return dp[0][a][b];
    } else {
        return dp[0][a][b] = max(dfs0(a + 1, b), dfs0(a + 1, b + 1) + x[a] + y[a] + z[a]);
    }
}

ll dfs1(ll a, ll b){
    if (a == n && b < m) {
        return inf;
    } else if (a == n || b == m) {
        return 0;
    } else if (dp[1][a][b] != INF) {
        return dp[1][a][b];
    } else {
        return dp[1][a][b] = max(dfs1(a + 1, b), dfs1(a + 1, b + 1) + x[a] + y[a] - z[a]);
    }
}

ll dfs2(ll a, ll b){
    if (a == n && b < m) {
        return inf;
    } else if (a == n || b == m) {
        return 0;
    } else if (dp[2][a][b] != INF) {
        return dp[2][a][b];
    } else {
        return dp[2][a][b] = max(dfs2(a + 1, b), dfs2(a + 1, b + 1) + x[a] - y[a] + z[a]);
    }
}

ll dfs3(ll a, ll b){
    if (a == n && b < m) {
        return inf;
    } else if (a == n || b == m) {
        return 0;
    } else if (dp[3][a][b] != INF) {
        return dp[3][a][b];
    } else {
        return dp[3][a][b] = max(dfs3(a + 1, b), dfs3(a + 1, b + 1) - x[a] + y[a] + z[a]);
    }
}

ll dfs4(ll a, ll b){
    if (a == n && b < m) {
        return inf;
    } else if (a == n || b == m) {
        return 0;
    } else if (dp[4][a][b] != INF) {
        return dp[4][a][b];
    } else {
        return dp[4][a][b] = max(dfs4(a + 1, b), dfs4(a + 1, b + 1) - x[a] - y[a] - z[a]);
    }
}

ll dfs5(ll a, ll b){
    if (a == n && b < m) {
        return inf;
    } else if (a == n || b == m) {
        return 0;
    } else if (dp[5][a][b] != INF) {
        return dp[5][a][b];
    } else {
        return dp[5][a][b] = max(dfs5(a + 1, b), dfs5(a + 1, b + 1) - x[a] - y[a] + z[a]);
    }
}

ll dfs6(ll a, ll b){
    if (a == n && b < m) {
        return inf;
    } else if (a == n || b == m) {
        return 0;
    } else if (dp[6][a][b] != INF) {
        return dp[6][a][b];
    } else {
        return dp[6][a][b] = max(dfs6(a + 1, b), dfs6(a + 1, b + 1) - x[a] + y[a] - z[a]);
    }
}

ll dfs7(ll a, ll b){
    if (a == n && b < m) {
        return inf;
    } else if (a == n || b == m) {
        return 0;
    } else if (dp[7][a][b] != INF) {
        return dp[7][a][b];
    } else {
        return dp[7][a][b] = max(dfs7(a + 1, b), dfs7(a + 1, b + 1) + x[a] - y[a] - z[a]);
    }
}

int main(void){
    // Your code here!
    cin >> n >> m;
    for (ll i = 0; i < n; i++) cin >> x[i] >> y[i] >> z[i];
    for (ll i = 0; i < 8; i++) {
        for (ll j = 0; j < 1100; j++) {
            for (ll k = 0; k < 1100; k++) {
                dp[i][j][k] = INF;
            }
        }
    }
    res1 = max(dfs0(0, 0), max(dfs1(0, 0), max(dfs2(0, 0), dfs3(0, 0))));
    res2 = max(dfs4(0, 0), max(dfs5(0, 0), max(dfs6(0, 0), dfs7(0, 0))));
    cout << max(res2, res1) << endl;
}


Measured memory_bytes: 76032