akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
ll GetDigit(ll num){ return log10(num)+1; } //numの桁数を求める

int main()
{
    int W,H,x,y,r;
    cin >> W >> H >> x >> y >> r;
    if(x+r <= W && x-r >= 0 && y+r <= H && y-r >= 0){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}


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

typedef pair<int,int> P;
#define ll long long
#define ld long double
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
#define sz(x) ((int)(x).size())
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)

const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;
int main()
{
    int n;
    cin >> n;
    vector<int> a(n);
    vector<int> b(n);
    vector<int> c(n);
    
    rep(i, n) cin >> a[i];
    rep(i,n) cin >> b[i];
    rep(i, n) cin >> c[i];
    sort(a.begin(), a.end());
    sort(b.begin(), b.end());
    sort(c.begin(), c.end());
    int b_index = 0;
    int c_index = 0;

    vector<int> c_counter(n);
    rep(i,n)
    {
        c_counter[i] = 0;
    }
    rep(i,n)
    {
        
        for (; c[c_index]<=b[i] && c_index < n; c_index++)
        {
            continue;
        }
        c_counter[i] = n-c_index;
    }

    vector<ll> b_counter(n);
    ll temp = 0;
    for (int i = n-1; i >=0; i--)
    {
        temp += (ll)c_counter[i];
        b_counter[i] = temp;
    }
    ll ans = 0;

    rep(i, n)
    {
        for (; b[b_index] <= a[i] && b_index < n; b_index++)
        {
            continue;
        }
        if(b_index == n)continue;
        ans += b_counter[b_index];
    }
    
    

    cout << ans << endl;

}

Measured memory_bytes: 2560
#include <iostream>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <string>
#include <bitset>
#include <map>
#include <vector>
#include <chrono>
#include <random>
#include <stack>
#include <ctime>
#include <queue>
#include <list>
#include <set>
#include <cstring>
#include <cstdlib>
#include <cctype>

#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 FORR(i, m, n) for(int i = m; i >= n; --i)
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define INF 999999999

using namespace std;

typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;

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

void swap(int *X, int *Y){
    int t = *X; *X = *Y; *Y = t;
}

int main() {
    string S;
    cin >> S;
    int cnt = 0;
    for (int i = 0; i < 3; ++i) {
        if (S[i] == 'o') cnt += 1;
    }

    cout << 700 + cnt * 100 << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(ll i = 0; i < n; i++)
#define repr(i, n) for(ll i = n; i >= 0; i--)
#define reprr(i, m, n) for (ll i = m; i < n; i++)
#define inf 2e9
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;


int main()
{
    ll N; cin >> N;
    vll A(N); rep(i, N) cin >> A[i];
    ll x = 0;
    rep(i, N) {
        x += A[i] * (i % 2 ? -1 : 1);
    }
    cout << x << " ";
    rep(i, N - 1) {
        x = 2 * A[i] - x;
        cout << x << " ";
    }
    cout << endl;

    return 0;
}

Measured memory_bytes: 2048
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <chrono>
#include <random>
#include <cmath>
using namespace std;
using namespace __gnu_pbds;
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define uid uniform_int_distribution<lli>
#define lli long long int
#define ff first
#define ss second
#define pb push_back
#define popf pop_front()
#define popb pop_back()
#define all(vec) vec.begin(), vec.end()
#define fol(i,a,b) for(int i=a;i<b;i++)
#define forr(x,arr) for(auto& x:arr)
#define sz(x) (x.size())
#define mod 1000000007
#define INF 1000000000000000010
#define vi vector<int>
#define vlli vector<lli>
#define endl "\n"
#define ofk order_of_key
#define fbo find_by_order
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

template<class my>
using indexed_set = tree<my,null_type,less<my>,rb_tree_tag,tree_order_statistics_node_update>;

template <class my>
inline my aabs (const my &a)   { return (a > 0)  ? a : -a;         }
inline lli gcd(lli a, lli b)   { return (b == 0) ? a : gcd(b,a%b); }
inline lli LSOne(lli k)        { return (k&(-k));                  }

inline int inv(lli o, int m = mod) {
  int b = m, u = 0, v = 1, t, a=o%m;
  while (a) {
    t = b / a;
    b -= t * a; swap(a, b);
    u -= t * v; swap(u, v);
  }
  if (u < 0) u += m;
  return u;
}
inline int add(const int &a, const int &b, int m=mod) { return ( a + b ) % m;           }
inline int sub(const int &a, const int &b, int m=mod) { return ( a - b + m ) % m;       }
inline int mul(const int &a, const int &b, int m=mod) { return int ( 1LL * a * b % m ); }
inline int mpow(int a, int b, int m=mod) {
    int ans = 1;
    a=((a%m)+m)%m;
    while (b) {
        if (b & 1) ans = mul(ans, a, m);
        a = mul(a, a, m);
        b >>= 1;
    }
    return ans;
}

void tejas_919()
{
    lli n, k, m, q, u=0, v=0, temp=1, a, b, val=0;
    cin>>n>>m;
    if(m>n) swap(n,m);
    if((n-m)%2) {cout<<"IMPOSSIBLE"<<endl; return;}
    cout<<(n+m)/2<<endl;
}

int main()
{
    fastio
    cout << fixed << setprecision(10);
    int t=1;
    //cin>>t;
    while(t--)
        tejas_919();
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <vector>
#include <algorithm>
using namespace std;
long long n,i,x;
string s;
int main() {
    cin >> n;
    s = "";
    while(n > 0) {
        if(n%26 == 0) {
            s += 'z';
            n /= 26;
            n--;
        } else {
            s += (char)('a'+n%26-1);
            n /= 26;
        }
    }
    reverse(s.begin(),s.end());
    cout << s;
    return 0;
}

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

const char wall = '#';
vector<vector<char>> fields;
vector<vector<bool>> used;
vector<vector<ll>> dist;
const int dx[4] = {0, -1, 0, 1};
const int dy[4] = {1, 0, -1, 0};

vector<ll> A;
// vectorのリサイズ
// A.resize(N);

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

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

  string s;
  cin >> s;
  if (s == "Sunny") {
    cout << "Cloudy" << endl;
  }else if(s == "Cloudy") {
    cout << "Rainy" << endl;
  }else {
    cout << "Sunny" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <stack>
#include <cmath>
using namespace std;

int main() {
    string a,b,c;
    int d,e;
    cin >> a >> b;
    cin >> d >> e;
    cin >> c;
    if(a == c){
    	cout << d-1 << ' ' << e << endl;
    }else{
    	cout << d << ' ' << e-1 << endl;
    }
} 

Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <numeric>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <queue>
#include <queue>
#include <sstream>
#include <set>
typedef  long long ll;
const int dx[8]={1,0,-1,0,1,-1,-1,1};
const int dy[8]={0,1,0,-1,1,1,-1,-1};
const int dr[4] = {-1, 0, 1, 0};
const int dc[4] = { 0, 1, 0,-1};
const int INF = 1e9;
#define FOR(i, a, n) for(int i = (int)(a); i < (int)(n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define SORT(a) sort(a.begin(),a.end())
#define REVERSE(a) reverse(a.begin(),a.end())
int guki (int a){
    if(a%2==0) return 0;
    else return 1;
}
int gcd(int a, int b){
    if(a%b==0){
        return b;
    }else{
        return (gcd(b,a%b));
    }
}
int lcm(int a, int b){
    int x = gcd(a,b);
    return (a*b/x);
}
using namespace std;
int main(){
    int cnt =0;
    string s;
    cin >> s;

    REP(i,s.size()){
        if(s[i] == 'x') cnt ++;
    }

    if(8 <= cnt ){
        cout << "NO" <<endl;
    }else cout << "YES" <<endl;
}

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

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		while (true) {
			String sentence = scanner.nextLine();
			if (sentence.equals(".")) {
				break;
			}
			sentence = sentence.replaceAll("[a-zA-Z .]", "");

			int length = sentence.length();
			while (length > 0) {
				sentence = sentence.replaceAll("\\(\\)", "");
				sentence = sentence.replaceAll("\\[\\]", "");
				if (sentence.length() == length) {
					break;
				} else {
					length = sentence.length();
				}
			}
			if (sentence.length() == 0) {
				System.out.println("yes");
			} else {
				System.out.println("no");
			}
		}

	}

	static int nextInt() {
		int c;
		try {
			c = System.in.read();
			while (c != '-' && (c < '0' || c > '9'))
				c = System.in.read();
			if (c == '-')
				return -nextInt();
			int res = 0;
			while (c >= '0' && c <= '9') {
				res = res * 10 + c - '0';
				c = System.in.read();
			}
			return res;
		} catch (IOException e) {
			e.printStackTrace();
		}
		return -1;
	}

}

Measured memory_bytes: 65280
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

int top, S[1000];

void push(int x) {
    S[++top] = x;
}

int pop() {
    top--;
    return S[top+1];
}

int main() {
    int a, b;
    top = 0;
    char s[100];

    while( scanf("%s", s) != EOF ) {
        if(s[0] == '+') {
            a = pop();
            b = pop();
            push(a + b);
        } else if(s[0] == '-') {
            a = pop();
            b = pop();
            push(b - a);
        } else if(s[0] == '*') {
            a = pop();
            b = pop();
            push(a * b);
        } else {
            push(atoi(s));
        }
    }
    printf("%d\n", pop());
    return 0;
}


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

int main(){
    int a,b;
    cin>>a>>b;
    int an1,an2;
    an1=a*100/8;
    if(an1*8/100!=a)an1++;
    //cout<<an1<<endl;
    //an2=b*100/10;
    bool judge=false;
    while((an1*8/100)<a+1){
            if(an1/10==b){
                cout<<an1<<endl;
                judge=true;
                break;
            }
        an1++;   
    }
    if(judge==false)cout<<"-1"<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
typedef unsigned long long int ulli;
typedef long double ld;

void vprint(vector<int>&v)
{  for(int i=0;i<v.size();i++)cout<<v[i]<<' ';cout<<endl;}

void aprint(int *arr,int n)
{  for(int i=0;i<n;i++)cout<<arr[i]<<' ';cout<<endl;}


int main()
{
   multimap<double,double>m;
   int n;
   cin>>n;
   for(int i=0;i<n;i++)
   {
       double x;
       cin>>x;
       m.insert({x,0});
   }

   while(m.size()>1)
   {
      int count=0;
      double sum=0;
      for(auto i=m.begin();i!=m.end();i++)
      {
         if(count==2)
         break;
         sum+=i->first;
         count++;
      }

      m.erase(m.begin());
      m.erase(m.begin());

      m.insert({sum/2,0});
   }

   cout<<m.begin()->first<<endl;
}

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

int main(){
	int x;
	int y;
	int a;
	for(int i = 1; ;i++){
		cin >>x>>y;
		if(x == 0 && y == 0) break;
		if(x>y){
		    cout <<y<<" "<<x<<endl;
		}else{
		    cout <<x<<" "<<y<<endl;
		}
		
		
	}
	return 0;
}


Measured memory_bytes: 3092
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
 
int main() {
  int N, K;
  cin >> N >> K;
  
  // 計算をしていく
  int sumKeisan = 1;
  rep(i, N) {
    if (sumKeisan * 2 < sumKeisan + K) {
      sumKeisan *= 2;
    }
    else sumKeisan += K;
  }
 
  // 計算結果を出力
  cout << sumKeisan << endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
  public static void main(String args[]) {
    Scanner scan = new Scanner(System.in);
    int n = scan.nextInt();
    int k = scan.nextInt();
    
    int[] heights = new int[n];
    
    for (int i = 0; i < n; i++) {
      	heights[i] = scan.nextInt();
    }
    scan.close();

    int result = solve(n,k,heights);
    System.out.println(result);
  }
  
  private static int solve(int N, int K, int[] heights){
    int[] dp = new int[N+1];
    Arrays.fill(dp, Integer.MAX_VALUE);
    dp[0] = 0;
      
    for(int i = 0; i < N; i++){
      for (int j = 1; j <= K && (i+j) < N; j++) {
        dp[i+j] = Math.min(dp[i+j], dp[i] + Math.abs(heights[i+j] - heights[i]));
      }
    }
    return dp[N-1];
  }
}

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

int main() {
  int N;
  string S;
  cin >> N >> S;

  if (N % 2 == 0 && S.substr(0, N / 2) == S.substr(N / 2, N / 2)) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<vector>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<string>
#include<set>
#include<map>
using namespace std;
typedef long long ll;
#define N 202500
int n, m, k, cnt;
ll c[N];
int a[N];
ll sum[N];
int lowbit(int x) {  return x & -x; }
ll bitsum(int x)
{
    ll ret = 0;
    while(x > 0){
        ret += c[x];
        x -= lowbit(x);
    }
    return ret;
}
void add(int x)
{
    while(x <= cnt){
        c[x] ++;
        x += lowbit(x);
    }
}

int main()
{
  //  freopen("b.in", "r", stdin);
    scanf("%d%d", &n, &k);
    for(int i = 1; i <= n; i++)  scanf("%d", a + i);
    sum[0] = 0LL;
    set<ll> dict;
    dict.insert(0);
    for(int i = 1; i <= n; i++) {
        a[i] = a[i] - k;
        sum[i] = sum[i - 1] + a[i];
        if (!dict.count(sum[i])) dict.insert(sum[i]);
    }
    map<ll , int > id;
    cnt = 0;
    ll ans = 0LL;
    for(set<ll>::iterator it= dict.begin(); it != dict.end(); ++it)   id[*it] = ++cnt;
    add(id[0]);
    for(int i = 1; i <= n; i++){
        int x = id[sum[i]];
        ans += bitsum(x);
        add(x);
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 25984
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map.Entry;
import java.util.PriorityQueue;
import java.util.Scanner;

class Main {
    static final int MOD = 1000000007;
    static final int INF = 1 << 30;

    Main() {
        Scanner sc = new Scanner(System.in);
        long ans = 0;
        int N = sc.nextInt();
        System.out.println(N/2+N%2);
    }

    public static void main(String[] args) {
        new Main();
    }
}


Measured memory_bytes: 23508
import java.util.*;

public class Main {
	public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    long a = sc.nextLong();
    long b = sc.nextLong();
    long ans=0;
    if (a * b % 2==0){
    	ans = a * b/2;
    } else {
    	ans = a* b/2 +1;
    }
      if (a == 1 || b == 1) {
    System.out.println(1);

      }else{
    System.out.println(ans);
      }
    }


}




Measured memory_bytes: 22868
from itertools import permutations as per
z=int(input())
chk=[]
for i in range(z):
    chk.append([int(i) for i in input().split()])
a=list(range(8))
pera=list(per(a))
k=0
for i in pera:
    st1=set() ; st2=set() ; flag=0
    for j in range(z):
        if i[chk[j][0]]!=chk[j][1]:
            flag=1
            break
    if flag==1: continue
    for j in range(8):
        if i[j]-j not in st1:
            st1.add(i[j]-j)
        else: break
        if i[j]+j not in st2:
            st2.add(i[j]+j)
        else: 
            break
    if len(st1)==8 and len(st2)==8:
        ans=[['.']*8 for i in range(8)]
        for j in range(8):
            ans[j][i[j]]='Q'
        for le in range(8):
            print(''.join(ans[le]))
        break
                
        


Measured memory_bytes: 10548
#include <bits/stdc++.h>
#define int long long
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e18;

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    int ans = n / 100 * 111;
    if(ans < n) ans = (n / 100 + 1) * 111;
    cout << ans << endl;
}

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

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

    int m, d;
    cin >> m >> d;
    int res = 0;
    rep1(i, m+1){
        for(int j = 11; j <= d; ++j){
            int a = j/10;
            int b = j%10;

            if(a==1 || b==1) continue;

            if(a*b==i) ++res;
        }
    }
    cout << res << endl;

    return 0;
}

Measured memory_bytes: 256
N = int(input())
a = [int(_) for _ in input().split()]
ans = [0]*(10**5+1)

for i in a:
    if i != 0:
        ans[i-1] += 1
        ans[i] += 1
        ans[i+1] += 1
    else:
        ans[i] += 1
        ans[i+1] += 1

print(max(ans))

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

using namespace std;

const int N = 1e5 + 5;
int L, n, m;
struct edge {
  int u, v, c;
};
vector <edge> ans;

main() {
  ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
  cin >> L;
  n = log2(L) + 1;
  for(int i = 1; i < n; ++i) {
    ans.push_back({i, i + 1, 0});
    ans.push_back({i, i + 1, 1 << i - 1});
  }
  if((1 << n - 1) != L) {
    for(int i = 1; i < n; ++i) {
      if(L >> (i - 1) & 1) {
        L -= 1 << (i - 1);
        ans.push_back({i, n, L});
      }
    }
  }
  cout << n << ' ' << ans.size() << '\n';
  for(auto &v : ans) cout << v.u << ' ' << v.v << ' ' << v.c << '\n';
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        String str = scan.nextLine();
        String[] num = str.split(" ",0);
        int a,b,c;

        a = Integer.valueOf(num[0]);
        b = Integer.valueOf(num[1]);
        c = Integer.valueOf(num[2]);

        if(c>b) {
            if (b>a) {
                System.out.println("Yes");
            }else{
                System.out.println("No");
            }
        }else{
            System.out.println("No");
        }
        scan.close();
    }
}



Measured memory_bytes: 26112
import java.util.Scanner;
 
public class Main {
	public static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		new Main();
	}
	public Main() {
		new DPC().doIt();
	}
	class DPC{
		int DP(int v[],int w[],int N,int W,int all[]){
			int result = 0;
			for(int i = 0;i < W;i++){
				for(int j = 0;j < N;j++){
					if(i + w[j] <= W){
						all[i+w[j]]=Math.max(all[i+w[j]], all[i] + v[j]);
						if(result < all[i+w[j]])result = all[i+w[j]];
					}
				}
			}
			return result;
		}
		void doIt() {
			int N = sc.nextInt();
			int W = sc.nextInt();
			int v[] = new int [N];
			int w[] = new int [N];
			int all[] = new int [W+1];
			for(int i = 0;i < N;i++){
				v[i] = sc.nextInt();
				w[i] = sc.nextInt();
			}
			System.out.println(DP(v,w,N,W,all));
		}
	}
}

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

int main(){
  
  int R;
  cin >> R;
  
  if(1200 > R){
    cout << "ABC" << endl;
    return 0;
  }else if(2800 > R){
    cout << "ARC" << endl;
    return 0;
  }else{
    cout << "AGC" << endl;
    return 0;
  }
  return -1;
}

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

#define N 1001
#define M (long long)(1e9+7)

bool isPrime[N];
void eratos(){
    memset(isPrime, true, sizeof(isPrime));
    isPrime[0] = 0;
    isPrime[1] = 0;
    for(size_t i = 2; i < N; i++) 
            if(isPrime[i]) 
                for (size_t j = 2; i*j < N; j++) 
                    isPrime[i*j] = 0;
    return;
}

long long dp[N];

int main() {
    eratos();
    int pqr[N] = {0};
    int n;
    long ans = 1;
    cin >> n;

    for (int i = 1; i <= n; i++) {
        /* 素因数分解 */
        int num = i;
        for (int j = 0; num != 1; j++) {
            if(isPrime[j]) {
                while(num % j == 0) {
                    num /= j;
                    pqr[j]++;
                }
            }
        }
    }
    
    for (int i = 0; i < N; i++) {
        if (pqr[i] != 0) {
            ans = ans * (pqr[i] + 1) % M;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
constexpr ll mod=1e9+7;
//cout<<fixed<<setprecision(20);

int main()
{
  int n;
  cin>>n;
  std::vector<int> vec(n);
  for(auto&& e: vec) 
  {
    cin>>e;
    if(e%2!=0) 
    {
      cout<<"first"<<endl;
      return 0;
    }
  }
  cout<<"second"<<endl;
}

Measured memory_bytes: 640
/**
*   @author: Kshitiz Srivastava (Pirate_ksh) @ MNNIT Allahabad
*/
#include<bits/stdc++.h>
using namespace std;
 
// General
#define ll long long
#define ld long double
#define io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define mod 1000000007 // 998244353
#define PI 3.1415926535897932384
#define endl "\n"
#define debug(x) cout<<x<<endl
#define REP(i,n) for(i=0;i<n;++i)
#define FOR(i,x,n) for(i=x;i<n;++i)
#define RREP(i,n) for(i=n-1;i>=0;--i)
#define RFOR(i,x,n) for(i=n-1;i>=x;--i)
#define TR(i,c) for(auto i=c.begin();i!=c.end();++i)
#define RTR(i,c) for(auto i=c.rbegin();i!=c.rend();++i)
#define sz(a) a.size()
 
// Bounds
#define lb(a,x) a.lower_bound(x)
#define ub(a,x) a.upper_bound(x)
#define all(a) a.begin(),a.end()
 
// Vector
#define vi vector <int>
#define pb(v,x) v.push_back(x)
#define vll vector <ll>
 
// Map
#define mii map <int, int>
#define umii unordered_map <int, int>
 
// Set
#define si set <int>
#define msi multiset<int>
 
// Pair
#define vpii vector<pair < int, int > >
#define vpll vector<pair < ll, ll > >
#define pii pair < int, int >
#define mp(a,b) make_pair(a,b)
#define F first
#define S second
#define vppi vector<pair<pair<int,int>,int>>
#define ppi pair<pair<int,int>,int>

void solve();

int main(){
    io
    ll t;
    t=1;
    // cin >> t;
    for(int i=0;i<t;++i) solve();
    return 0;
}

vector<bool> vis;
ll cnt;
void dfs(vi graph[], ll u) {
    vis[u] = 1;
    cnt++;
    for(auto v: graph[u]) {
        if(!vis[v]) dfs(graph,v);
    }
}

void solve() {
    ll i, j, n, m;
    cin >> n >> m;
    vi graph[n+1];
    map<pii,bool> done;
    while(m--) {
        ll a, b;
        cin >> a >> b;
        if(a>b) swap(a,b);
        if(!done[mp(a,b)]) {
            pb(graph[a],b);
            pb(graph[b],a);
            done[mp(a,b)] = true;
        }
    }
    ll ans = 0;
    vis.assign(n+1,false);
    FOR(i,1,n+1) {
        if(!vis[i]) {
            cnt = 0;
            dfs(graph, i);
            ans = max(ans, cnt);
            cnt = 0;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 36416
#pragma comment(linker, "/stack:200000000")
        #pragma GCC optimize ("Ofast")
        #pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
         
         
        #include <iostream>
        #include <iomanip>
        #include <sstream>
        #include <cstring>
        #include <vector>
        #include <deque>
        #include <queue>
        #include <set>
        #include <map>
        #include <valarray>
        #include <iterator>
        #include <functional>
        #include <limits>
        #include <algorithm>
        #include <numeric>
        #include <cmath>
        #include <cassert>
        #include <unordered_map>
        #include <unordered_set>
        #include <stack>
        using namespace std;
        #define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
         #define trace(x) cerr << #x << ": " << x << " " << endl;
     
        typedef int64_t ll;
     
        #define endl '\n'
        #define int ll
        ll mod=1e9+7;
        ll mod1=1e9+5;
        ll power(ll a,ll b)
        {
            if(b==0) return 1;
            else if(b%2==0)
                return power((((a%mod)*(a%mod))%mod),b/2)%mod;
            else return ((a%mod)*(power((((a%mod)*(a%mod))%mod),b/2)%mod))%mod;
        }
       
       
        
        int32_t main()
        {
            IOS
           
             
        
        int a,b;
        cin>>a>>b;
        cout<<(max(a-2*b,(ll)0));

        }


Measured memory_bytes: 256
A = int(input())
B = int(input())
C = int(input())
X = int(input())
cnt = 0
for i in range(A+1):
    for j in range(B+1):
        for k in range(C+1):
            if i*500+j*100+k*50==X:
                cnt += 1
print(cnt)

Measured memory_bytes: 67420
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


n = int(input())
ans = float("inf")
for i in range(1,n+1):
    if i**2>n:
        break
    if n%i==0:
        ans = min(ans, max(len(str(i)),len(str(n//i))))
print(ans)

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

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

class Prime{
public:
	vector<int> prime;
	vector<bool> is_prime;
	Prime(int n){
		prime = vector<int>(n);
		is_prime = vector<bool>(n+1,true);
		is_prime[0] = is_prime[1] = false;
		int p = 0;
		for (int i = 2;i <= n;i++){
			if(is_prime[i]){
				prime[p++] = i;
				for (int j = 2*i;j <= n;j += i)is_prime[j] = false;
			}
		}
	}
};

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

	ll n; cin >> n;

	Prime p(100);

	map<int,int> mp;

	for (int i = 2;i <= n;i++){
		int j = 0;
		int tmp = i;
		while(true){
			if(tmp%p.prime[j] == 0){
				mp[p.prime[j]]++;
				tmp /= p.prime[j];
			}else j++;
			if(p.prime[j] > tmp) break;
		}
	}

	vector<int> l;
	for(auto&& i:mp){
		l.push_back(i.second);
	}

	int dp[100][100];
	memset(dp,0,sizeof(dp));
	dp[0][1] = 1;

	for (int i = 0;i < l.size();i++){
		for (int j = 1;j <= 75;j++){
			if(dp[i][j] == 0) continue;
			for (int k = 0;k <= l[i];k++){
				if(j*(k+1) > 75) break;
				dp[i+1][j*(k+1)] += dp[i][j];
			}
		}
	}

	cout << dp[l.size()-1][75] << endl;

	return 0;

}


Measured memory_bytes: 256
// #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;
using ll = long long int;
using int64 = long long int;
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1001001001001001LL;
const ll MOD = 1000000007LL;
 
int main() {
    string s; cin >> s;
    bool bad = false;
    for(int i=0; i<3; i++) {
        bad |= (s[i] == s[i+1]);
    }
    cout << (bad ? "Bad" : "Good") << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
	using namespace std;

	int main() {
		int K;
		string S;

		cin >> K >> S;
		int A = S.size();
		string B = S.substr(0,K);
		if (A <= K) {
			cout << S << endl;
		}

		else {
			cout << B << "..." << endl;
		}




	}

Measured memory_bytes: 3644
import java.util.*;

public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int[] num = new int[N];
    int count = 0;

    for(int i=0; i < N-1; i++){
        num[i] = sc.nextInt();
        if(i > 0){
            if(num[i-1] >= num[i]){
                count += num[i];
                //System.out.println(count);
            }else if(num[i-1] < num[i]){
                count += num[i-1];
                //System.out.println(count);
            }
        }else{
            
        }
    }
        System.out.println(count+num[0]+num[N-2]);
  }
}

Measured memory_bytes: 22736
n, k = list(map(int, input().split()))
p = list(map(int, input().split()))
r = [0]*(n + 1)
for i in range(1,n + 1):
    r[i] += r[i - 1] + (p[i - 1] + 1) / 2
ans = 0
for j in range(n - k + 1):
    ans = max(ans, r[j+k] - r[j])
print(ans)


Measured memory_bytes: 32152
use std::io::{stdout, Write, BufWriter};

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

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

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

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

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

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

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

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

fn main() {
    input!{
        a: [[i32; 3]; 3],
        n: usize,
        b: [i32; n],
    }
    let mut table = [[false; 3]; 3];

    for i in 0..3 {
        for j in 0..3{
            if b.iter().any(|b| *b == a[i][j]) { table[i][j] = true }
        }
    }

    for j in 0..3 {
        if table[0][j] && table[1][j] && table[2][j] {
            println!("Yes");
            return;
        }
    }

    if table.iter().any(|raw| (raw).iter().all(|a| *a)) || ((table[0][0] && table[1][1] && table[2][2]) || (table[2][0] && table[1][1] && table[0][2])) {
        println!("Yes");
        return;
    } else {
        println!("No");
    }

    for j in 0..3 {
        if table[0][j] && table[1][j] && table[2][j] {
            println!("Yes");
            return;
        }
    }
}


Measured memory_bytes: 4352
import java.io.*;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.*;
import java.io.*;

class Main
{
 public static void main(String[] args) throws IOException
 {
	 Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
 
 int h = n/3600;
 int m = n%3600/60;
 int s = n%60;
 
 System.out.println(h+":"+m+":"+s);
 }
}

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

int main(void){
  
  string s;
  cin >> s;
  int aPos = s.find_first_of('A');
  int last_z_pos = s.find_last_of('Z');
  cout << last_z_pos - aPos + 1 << endl;
}


Measured memory_bytes: 3760
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
#define ll long long
#define ld long double
#define MOD 1000000007
#define nl cout << bl
#define rt ll Q[100005] = {0}
#define mp make_pair
#define test() \
    ull t;     \
    cin >> t;  \
    while (t--)
#define pb push_back
#define ff first
#define ss second
#define all(v) v.begin(), v.end()
#define s(ar, n) sort(ar, ar + n)
#define rs(ar, n) sort(ar, ar + n, greater<ll>())
#define oa(a, n)               \
    for (ll i = 0; i < n; i++) \
        cout << a[i] << " ";
#define cn(a, n)               \
    for (ll i = 0; i < n; i++) \
        cin >> a[i];
#define ov(a, n)                    \
    for (ll i = n - 1; i >= 0; i--) \
        cout << a[i] << " ";        \
    nl
#define ovp(a, n)              \
    for (ll i = 0; i < n; i++) \
        cout << a[i].ff << " " << a[i].ss << bl;
#define maxa(ar, N) *max_element(ar, ar + N)
#define mina(ar, N) *min_element(ar, ar + N)
#define present(c, x) ((c).find(x) != (c).end())
#define fastio()                  \
    ios_base::sync_with_stdio(0); \
    cin.tie(0);                   \
    cout.tie(0)
typedef pair<int, int> pii;
ll fast_exp(ll base, ll exp)
{
    ll res = 1;
    while (exp > 0)
    {
        if (exp % 2 == 1)
            res = (res * base) % MOD;
        base = (base * base) % MOD;
        exp /= 2;
    }
    return res % MOD;
}
ll fib(ll n)
{
    if (n < 2)
        return n;
    ll a = 0, b = 1, pre;
    int i = 1;
    while (i < n)
    {
        pre = (a + b) % MOD;
        a = b;
        b = pre;
        i++;
    }
    return pre;
}
ll fac(ll n)
{
    if (n % 2 == 0)
        return 2;

    for (ll i = 3; i * i <= n; i += 2)
    {
        if (n % i == 0)
            return i;
    }

    return n;
}
ll fact(ll n)
{
    if (n > 1)
        return n * fact(n - 1);
    else
        return 1;
}
bool sortbysec(const tuple<int, int, int> &a,
               const tuple<int, int, int> &b)
{
    return (get<1>(a) < get<1>(b));
}

int main()
{
    int n;
    cin >> n;
    map<ll, ll> mp;
    for (int x = 1; x <= 100; x++)
    {
        for (int y = 1; y <= 100; y++)
        {
            for (int z = 1; z <= 100; z++)
            {
                ll val = x * x + y * y + z * z + x * y + y * z + z * x;
                mp[val]++;
            }
        }
    }
    for (int i = 1; i <= n; i++)
    {
        cout << mp[i] << "\n";
    }
}

Measured memory_bytes: 5924
N = int(input())
A = list(map(int, input().split()))
s = 0
ma = max(A)
mi = min(A)

A2 = [0] + A + [0]
for i in range(N+1):
    s += abs(A2[i] - A2[i+1])

for i in range(1, N+1):
    print(s - abs(A2[i-1] - A2[i]) - abs(A2[i] - A2[i+1]) +  abs(A2[i-1] - A2[i+1]))

Measured memory_bytes: 14040
//itp1_topic2_d

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

int main(){
    int W,H;
    cin>>W>>H;
    
    int x,y,r;
    cin>>x>>y>>r;
    
    if( x - r >= 0 && x + r <= W && y - r >= 0 && y + r <= H) cout<<"Yes"<<endl;
    else cout<< "No"<<endl;
    
return 0;
}


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

const int Maxn = 100005;
int n, m, cnt, top, s, maxi, now, fa[Maxn], node[Maxn], sta[Maxn], a[Maxn], b[Maxn], w[Maxn], head[Maxn];
long long sum[Maxn], mini[Maxn];
vector <int> Ve[Maxn];
bool vis[Maxn];
struct edg
{
	int nxt, to;
}edge[2 * Maxn];
void add(int x, int y)
{
	edge[++cnt] = (edg){head[x], y};
	head[x] = cnt;
}
void dfs(int u)
{
	mini[u] = 0x3f3f3f3f3f3f3f3f;
	sum[u] = b[u];
	for (vector <int> :: iterator it = Ve[u].begin(); it != Ve[u].end(); it++)
	{
		int to = *it;
		dfs(to);
		sum[u] += sum[to];
		mini[u] = min(mini[u], max((long long) w[u], mini[to]) - sum[to]);
	}
	if (!Ve[u].size()) mini[u] = w[u] + b[u];
	else mini[u] += sum[u];
}
int get_fa(int x)
{
	return x == fa[x] ? x : fa[x] = get_fa(fa[x]);
}
int main()
{
	scanf("%d%d", &n, &m);
	for (int i = 1; i <= n; i++)
		scanf("%d%d", &a[i], &b[i]), w[i] = max(0, a[i] - b[i]), node[i] = fa[i] = i;
	for (int i = 1; i <= m; i++)
	{
		int x, y;
		scanf("%d%d", &x, &y);
		add(x, y);
		add(y, x);
	}
	sort(node + 1, node + 1 + n, [](int x, int y){return w[x] < w[y];});
	for (int j = 1; j <= n; j++)
	{
		int u = node[j];
		vis[u] = true;
		for (int i = head[u]; i; i = edge[i].nxt)
		{
			int to = edge[i].to;
			if (vis[to] && get_fa(to) != u)
				Ve[u].push_back(get_fa(to)), fa[get_fa(to)] = u;
		}
	}
	dfs(node[n]);
	printf("%lld", mini[node[n]]);
	return 0;
}


Measured memory_bytes: 14208
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr int mod = 1e9 + 7;

int main() {
  int n;
  cin >> n;
  vector<vector<vector<vector<ll>>>> dp(n + 1, vector<vector<vector<ll>>>(4, vector<vector<ll>>(4, vector<ll>(4))));
  dp[0][3][3][3] = 1;
  for (int i = 0; i < n; i++) {
    for (int c1 = 0; c1 < 4; c1++) {
      for (int c2 = 0; c2 < 4; c2++) {
        for (int c3 = 0; c3 < 4; c3++) {
          vector<bool> b(4, true);
          if (c1 == 0 && c2 == 2) b[1] = false;
          if (c1 == 0 && c3 == 2) b[1] = false;
          if (c2 == 0 && c3 == 2) b[1] = false;
          if (c2 == 2 && c3 == 0) b[1] = false;
          if (c2 == 0 && c3 == 1) b[2] = false;
          for (int j = 0; j < 4; j++) {
            if (!b[j]) continue;
            dp[i + 1][c2][c3][j] += dp[i][c1][c2][c3];
            dp[i + 1][c2][c3][j] %= mod;
          }
        }
      }
    }
  }
  ll r = 0;
  for (int c1 = 0; c1 < 4; c1++) {
    for (int c2 = 0; c2 < 4; c2++) {
      for (int c3 = 0; c3 < 4; c3++) {
        r += dp[n][c1][c2][c3];
        r %= mod;
      }
    }
  }
  cout << r << endl;
}


Measured memory_bytes: 384
import java.util.Scanner;

public class Main{
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    int a=sc.nextInt();
    int b=sc.nextInt();
    int c=sc.nextInt();
    if(a<b&&b<c){
      System.out.println("Yes");
    }else{
      System.out.println("No");
    }
  }
}



Measured memory_bytes: 26412
#include <bits/stdc++.h>
using namespace std;
#define forn(i, n) for(int i = 0; i < int(n); i++)
#define fore(i, l, r) for(int i = int(l); i < int(r); i++)
#define pb push_back
#define deb(x) cout<<#x<<" "<<x<<endl;
#define deb2(x, y) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<endl;
#define deb3(x, y, z) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<" "<<#z<<" "<<z<<endl;
#define all(x) x.begin(), x.end()
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef pair<int, int> pii;
const int mod = 1e9 + 7;
template<class T, class U> inline void add_self(T &a, U b){a += b;if (a >= mod) a -= mod;if (a < 0) a += mod;}
template<class T, class U> inline void min_self(T &x, U y) { if (y < x) x = y; }
template<class T, class U> inline void max_self(T &x, U y) { if (y > x) x = y; }

template <typename T>void print(T v, bool show_index = false){int w = 2;if(show_index){for(int i=0; i<v.size(); i++)cout<<setw(w)<<i<<" ";cout<<endl;}for(auto i= v.begin(); i!=v.end(); i++)cout<<setw(w)<<*i<<" ";cout<<endl;}
template <typename T>void print_vv(T v){if(v.size()==0) {cout<<"Empty"<<endl; return;} int w = 3;cout<<setw(w)<<" ";for(int j=0; j<v[0].size(); j++)cout<<setw(w)<<j<<" ";cout<<endl;for(auto i= 0; i<v.size(); i++){cout<<i<<" {";for(auto j = 0; j!=v[i].size(); j++){cout<<setw(w)<<v[i][j]<<",";}cout<<"},"<<endl;}cout<<endl;}
template <class T, class U> void print_m(map<T,U> m, int w=3){if(m.empty()){cout<<"Empty"<<endl; return;}for(auto x: m)cout<<"("<<x.first<<": "<<x.second<<"),"<<endl;cout<<endl;}

int main(){
    int n,m;
    while(cin>>n>>m){
        int ways = abs((n*(n-1))/2 ) + abs((m*(m-1))/2);
        cout<<ways<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    while(true){
        int x, y, s;
        cin >> x >> y >> s;
        if(x == 0){
            break;
        }
        
        int min = float(s) / (100.0f + float(x)) * 100.0f;
        int max = 0;
        for(int i = min; i <= s; i++){
            for(int j = 1; j <= i / 2; j++){
                int p1 = float(j) * (100.0f + float(x)) / 100.0f;
                int p2 = float(i - j) * (100.0f + float(x)) / 100.0f;
                int p = int(float(j) * (100.0f + float(y)) / 100.0f) + int(float(i - j) * (100.0f + float(y)) / 100.0f);
                if(p1 + p2 == s && p > max){
                    max = p;
                }
            }
        }
        cout << max << endl;
    }
    return 0;
}



Measured memory_bytes: 3072
#include <stdio.h>

int main(void) {
    int N, a[200005], x, i;
    scanf("%d", &N);
    x=0;
    for (i=0; i<N; i++) {
        scanf("%d", &a[i]);
        if (a[i]==x+1) x++;
    }
    if (x==0) printf("-1");
    else printf("%d", N-x);
    return 0;
}

Measured memory_bytes: 896
s = raw_input()
if s[0] == s[1]:
    print("1 2")
    exit()
    
for i in xrange(2,len(s)):
    if s[i] == s[i-1] or s[i] == s[i-2]:
        print(str(i-1) + " " + str(i+1)) 
        exit()
print ("-1 -1")



Measured memory_bytes: 2692
package main

import (
	"fmt"
)

func main() {
	var n int

	fmt.Scan(&n)

	a := make([]int, n)

	for i := 0; i < n; i++ {
		fmt.Scan(&a[i])
	}

	var min int
	first := true

	for i := -100; i <= 100; i++ {
		var tmp int
		for j := 0; j < n; j++ {
			tmp += (i - a[j]) * (i - a[j])
		}
		if first || tmp < min {
			min = tmp
			first = false
		}
	}

	fmt.Println(min)

}


Measured memory_bytes: 512
H, W = map(int, input().split())
S = [[c for c in input()] for _ in range(H)]

dp = [[0] * W for _ in range(H)]
for y in range(H):
    for x in range(W):
        if y-1 < 0 and x-1 < 0:
            dp[y][x] = int(S[y][x] != '.')
        elif y-1 < 0:
            dp[y][x] = dp[y][x-1] + (S[y][x] != S[y][x-1])
        elif x-1 < 0:
            dp[y][x] = dp[y-1][x] + (S[y][x] != S[y-1][x])
        else:
            dp[y][x] = min(dp[y-1][x] + (S[y][x] != S[y-1][x]),
                           dp[y][x-1] + (S[y][x] != S[y][x-1]))


#print('\n', *dp, sep='\n')

print((dp[H-1][W-1]+1)//2)


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

using namespace std;

#define ll long long
#define ini(arr, val) memset(arr, (val), sizeof(arr))
#define loop(i,n)  for(ll i=0; i<n; i++)

#define all(a)      (a).begin(),(a).end()
#define exist(s,e)  (s.find(e)!=s.end())
#define dbg(x)  cout << #x << " is " << x << endl;
#define pt(x) cout<<x<<"\n";

#define mp make_pair
#define pb push_back
#define f first
#define s second


#define inf (int)1e9
#define eps 1e-9
#define PI 3.1415926535897932384626433832795
#define mod 1000000007


#define fast    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define test   int t; cin>>t; while(t--)

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<pii> vpii;
typedef vector<vi> vvi;
typedef map<int,int> mii;
typedef set<int> si;

typedef pair<ll, ll> pll;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef vector<pll> vpll;
typedef vector<vl> vvl;
typedef map<ll,ll> mll;
typedef set<ll> sl;


//////////////////////////////////////////////////////////////////////////////////////////
//                      main starts
//////////////////////////////////////////////////////////////////////////////////////////
int const lmt=1e5+5;



int main(){
   

    ll a,b,c; cin>>a>>b>>c;
    // long double rt = sqrt(a*b);
    // cin>>c;
    c = c-a-b;
    if(c>0 && 4*a*b < c*c ){
        cout<<"Yes\n";
    }else {
        cout<<"No\n";
    }

    
}


/*

// 

*/

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

int main( )
{
    int n, k, s = 0, x, y;
    cin >> n >> k >> x >> y;
    s += min(n, k) * x;
    s += max(n - k, 0) * y;
    cout << s << '\n';
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long int
#define endl "\n"
#define arrinp(v) for(auto &i:v) cin>>i;
#define arrout(v) for(auto &i:v) cout<<i<<" ";
#define newline cout<<endl;
using namespace std;
const int MOD=1e9+7;
signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    int t=1;
    // cin >> t;
    while (t--) {
        int n;
        cin>>n;
        int a[n];
        for(int i=0;i<n;i++){
            cin>>a[i];
        }
        int p[n];
        p[0]=a[0];
        for(int i=1;i<n;i++){
            p[i]=a[i]+p[i-1];
            // cout<<p[i]<<" ";
        }
        // newline;
        int ans=0;
        for(int i=0;i<n;i++){
            ans+=((((p[i]%MOD)-(a[i]%MOD))%MOD*a[i]%MOD)%MOD);
            ans=(ans+MOD)%MOD;
        }
        cout<<ans%MOD<<endl;
    }
    return 0;
}

Measured memory_bytes: 6732
#include <cstdio>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <climits>
#include <cmath>
#include <functional>
#include <map>
#include <queue>
#include <set>

#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define INF 999999999
#define size_t unsigned long long
#define ll long long
#define rep(i,a) for(int i=0;i<(a);i++)
#define repr(i,a) for(int i=(int)(a)-1;i>=0;i--)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define FORR(i,a,b) for(int i=(int)(b)-1;i>=a;i--)
#define ALL(a) a.begin(), a.end()
using namespace std;
int si() { int x; scanf("%d", &x); return x; }
long long sl() { long long x; scanf("%lld", &x); return x; }
string ss() { string x; cin >> x; return x; }
void pi(int x) { printf("%d ", x); }
void pl(long long x) { printf("%lld ", x); }
void pd(double x) { printf("%.15f ", x); }
void ps(const string &s) { printf("%s ", s.c_str()); }
void br() { putchar('\n'); }

const int MOD = 1e9 + 7;

struct mint {
    int n;
    mint(int n_ = 0) : n(n_) {}
};

mint operator+(mint a, mint b) { a.n += b.n; if (a.n >= MOD) a.n -= MOD; return a; }
mint operator-(mint a, mint b) { a.n -= b.n; if (a.n < 0) a.n += MOD; return a; }
mint operator*(mint a, mint b) { return (long long)a.n * b.n % MOD; }
mint &operator+=(mint &a, mint b) { return a = a + b; }
mint &operator-=(mint &a, mint b) { return a = a - b; }
mint &operator*=(mint &a, mint b) { return a = a * b; }

long long mod(long long a, long long m) {
    return (a % m + m) % m;
}
long long mul(long long a, long long b, long long m) {
    a = mod(a, m); b = mod(b, m);
    if (b == 0) return 0;
    long long res = mul(mod(a + a, m), b>>1, m);
    if (b & 1) res = mod(res + a, m);
    return res;
}
long long inv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a/b;
        a = mod(a - mul(t, b, m), m); swap(a, b);
        u = mod(u - mul(t, v, m), m); swap(u, v);
    }
    return mod(u, m);
}


int main () {
  ll l,r;
  cin >> l >> r;
  ll result = 2020;
  int a = l / 2019;
  int b = r /  2019;
  if(b - a < 3) {
    for(int i = l; i < r; i++) {
      for(int j = i+1; j <= r; j++) {
        result = result < mul(i, j, 2019) ? result: mul(i, j, 2019);
      }
    }
  } else {
    result = 0;
  }
  cout << result << endl;
}


Measured memory_bytes: 256
#abc156d
m=10**9+7
def com(x,y):
 c=1
 for i in range(1,y+1):
  c=(c*(x-i+1)*pow(i,m-2,m))%m
 return c
n,a,b=map(int,raw_input().split())
print (pow(2,n,m)-1-com(n,a)-com(n,b))%m


Measured memory_bytes: 32668
#include <iostream>
using namespace std;
typedef long long ll;

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

ll lci(ll a, ll b){
    ll g = gcd(a, b);
    return a / g * b;
}

int main()
{
    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    ll cbans = 0;
    ll bans;
    cbans += b / c + b / d;
    cbans -= b / lci(c, d);
    bans = b - cbans;
    ll caans = 0;
    ll aans;
    caans += (a - 1) / c + (a - 1) / d;
    caans -= (a - 1) / lci(c, d);
    aans = (a - 1) - caans;
    cout << bans - aans << endl;
}

Measured memory_bytes: 256