akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define XOX
using namespace std;

#define fast ios_base::sync_with_stdio(false),cin.tie(NULL)
#define ldb long double 
#define db double
#define int long long

#define fr first
#define se second
#define lb lower_bound 
#define ub upper_bound 
#define pb push_back
#define mpr make_pair

#define pi pair<int,int>
#define pdb pair<db,db>
#define pldb pair<ldb,ldb>

#define vi vector<int>
#define vdb vector<db>
#define vldb vector<ldb>
#define vpi vector< pi >

#define mi map<int,int>
#define mdb map<db,db>
#define mldb map<ldb,ldb>


#define forr(a,b) for (int i = (a); i < (b); ++i)
#define rrof(a,b) for (int i = (b)-1; i >= (a); --i)

#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)

const int md = 1e9+7;
const int MX = 2e5+5;
const int INF = 1e18; 
const ldb PI = 4*atan((ldb)1);

int power_md(int a,int n)
{
 int res=1;
 while(n)
{
 if(n%2)
  res=(res%md*a%md)%md;
  a=(a%md*a%md)%md;
  n/=2;
}
res%=md;
return res;
}

int power(int a,int n)
{
 int res=1;
 while(n)
{
 if(n%2)
  res*=a;
  a=a*a;
  n/=2;
}
return res;
}

int abst(int a)
{
 return ((a<0)?(-1*a):(a));
}

class cmp_set{
public:
	bool operator() (int a, int b){
		return a > b;
	}
};

vector<string> vec_splitter(string s) {
	s += ',';
	vector<string> res;
	while(!s.empty()) {
		res.push_back(s.substr(0, s.find(',')));
		s = s.substr(s.find(',') + 1);
	}
	return res;
}
void debug_out(
vector<string> __attribute__ ((unused)) args,
__attribute__ ((unused)) int idx, 
__attribute__ ((unused)) int LINE_NUM) { cerr << endl; } 
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
	if(idx > 0) cerr << ", "; else cerr << "Line(" << LINE_NUM << ") ";
	stringstream ss; ss << H;
	cerr << args[idx] << " = " << ss.str();
	debug_out(args, idx + 1, LINE_NUM, T...);
}
#ifdef XOX
#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
#else
#define debug(...) 42
#endif

int32_t main()
{
    string s;
    cin>>s;
    if(s=="ARC")
     s="ABC";
     else
      s="ARC";
      cout<<s<<"\n";
      return 0;
}

Measured memory_bytes: 3608
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

public class Main {
	static String[] Lb;
	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
        Scanner in = new Scanner(System.in);
        int N = in.nextInt(); // the number of cells on the Y axis
        in.nextLine();
        String line = in.nextLine(); // width characters, each either 0 or .

        String[] L = line.split(" ");
        Lb = L.clone();
       while(true){
    	   String[] Lc = Lb.clone();
        	recal(0);
        	if(Arrays.equals(Lb, Lc)){
        		break;
        	}
        }
       int out = 0;
       for(int i = 0 ; i <  Lb.length/2; i++){

    	   out +=  Integer.parseInt(Lb[i *2]);
       }
       System.out.println(out);
	}
	//並び替え
	List<Integer> list = new ArrayList<Integer>();
	public static void recal(int i){
		int n= 0,m = 0;
		if(Lb.length -1 > i){
		if((n = Integer.parseInt(Lb[i])) <= (m = Integer.parseInt(Lb[i +1]))){
			recal(i + 1);
		}else{
			Lb[i] = Integer.toString(m);
			Lb[i + 1] = Integer.toString(n);
		}
		}
	}

}


Measured memory_bytes: 23996
// 偶数二つ → 偶数1つ
// 奇数二つ → 偶数1つ
#include <bits/stdc++.h>
using namespace std;

int main() {
    int N;
    cin >> N;
    int Odd = 0, Even = 0;
    for (int i = 0; i < N; ++i) {
        int A;
        cin >> A;
        if (A % 2)
            ++Odd;
        else
            ++Even;
    }
    Even += Odd / 2;
    Odd %= 2;
    if (Odd == 0) {
        if (Even)
            cout << "YES" << endl;
        else
            cout << "NO" << endl;
    } else {
        if (Even == 0)
            cout << "YES" << endl;
        else
            cout << "NO" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
using namespace std;
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
using namespace std;
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define all(a) a.begin(),a.end()
#define rall(c) (c).rbegin(),(c).rend()
#define mp make_pair
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef long double ld;
const ll inf=1e9+7;
const ll mod=998244353;
int main(){
    string s,t;cin>>s>>t;
    cout<<t<<s<<endl;
}

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

using namespace std;

int main() {
	int h, w, cnt;
	string mapdata[300];

	while (cin >> h >> w, h) {
		cnt = w / 2 + 1;
		for (int i = 0; i < h; i+=2) {
			for (int j = 0; j < cnt; ++j) {
				mapdata[i] += "#.";
			}
		}
		for (int i = 1; i < h; i += 2) {
			for (int j = 0; j < cnt; ++j) {
				mapdata[i] += ".#";
			}
		}

		for (int i = 0; i < h; ++i) {
			for (int j = 0; j < w; ++j) {
				cout << mapdata[i][j];
			}
			cout << endl;
		}
		cout << endl;
	}

	return 0;
}


Measured memory_bytes: 3280
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
public class MainClass
{
	public const long Giri = 1000000007;
	public const long DpInf = 99999999999999;
	
	public static void Main(string[] args)
	{
		var q = Input().ToInt();
		
		var n = q[0];
		var k = q[1];
		var p = Input().ToInt();
		
		
		Array.Sort(p);
		
		long wa = 0;
		for(int i = 0; i < k; i++)
		{
			wa += p[i];
		}
		Console.WriteLine(wa);
	}

	
	static long GCD(long a, long b)
	{
		var v = new[] { a, b };
		while (v[1] != 0) { v = new[] { v[1], v[0] % v[1] }; }
		return v[0];
	}
	public static string[] Input() { return Console.ReadLine().Split(); }
}

public static class Smarter
{
	public static int ToInt(this string str) { return int.Parse(str); }
	public static long ToLong(this string str) { return long.Parse(str); }
	public static int[] ToInt(this string[] str, int offset = 0)
	{
		var r = new int[str.Length];
		for(int i = 0; i < str.Length; i++) r[i] = str[i].ToInt() + offset;
		return r;
	}
}

Measured memory_bytes: 27888
import java.util.*;

public class Main
{
	public static void main(String[] args)
	{
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		n=(n%1000==0)? 0:1000-(n%1000);
		System.out.println(n);
		sc.close();
	}
}


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

int main() {
    int N;
    double D;
    cin >> N >> D;

    vector<vector<double>> p(N, vector<double>(2));
    for (auto& v : p) {
        cin >> v[0] >> v[1];
    }
    int count = 0;
    for (const auto& v : p) {
        if (pow(v[0], 2.0) + pow(v[1], 2.0) <= pow(D, 2.0)) {
            ++ count;
        }
    }
    cout << count << endl;

    return 0;
}

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

int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int N; cin >> N;
  string S; cin >> S;
  for (int a = 0; a < 2; a++) {
    for (int b = 0; b < 2; b++) {
      vector<int> ans(N);
      ans[0] = a, ans[1] = b;
      for (int i = 1; i+1 < N; i++) {
        ans[i+1] = (S[i] == 'x') ^ ans[i] ^ ans[i-1];
      }
      if ((ans[0] ^ ans[1] ^ ans[N-1]) == (S[0] == 'x') && (ans[0] ^ ans[N-1] ^ ans[N-2]) == (S[N-1] == 'x')) {
        for (int i = 0; i < N; i++) {
          cout << "SW"[ans[i]];
        }
        cout << '\n';
        return 0;
      }
    }
  }
  cout << -1 << '\n';
}

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

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define pow(x) x*x
#define ll long long
static const int MAX = 10000;
static const ll INFTY = 1e12;

struct edge {
    ll to, cost;
};

using Graph = vector<vector<int>>;
using _Graph = vector<vector<edge>>;
// 入力
int H, W;
vector<vector<char>> field;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

// 深さ優先探索
vector<bool> seen;
vector<int> colors;


int main() {

    string S;
    cin >> S;

    vector<string> _s(10);
    string hi = "hi";
    REP(i, 10){
        _s[i] = hi;
        hi += "hi";
    }
    int flag = 0;
    REP(i, 10){
        if(S == _s[i]){
            flag = 1;
            break;
        }
    }
    if(flag == 1)cout << "Yes" << endl;
    else cout << "No" << endl;
    
}
/*
                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         pass System Test!
*/


Measured memory_bytes: 256
#include <stdio.h>

int main(){
    float a, b, c, d, e, f;
    float x, y;
    int ix, iy;

    while ( 6 == scanf( "%f %f %f %f %f %f", &a, &b, &c, &d, &e, &f ) ) {
        y = ( a * f - c * d ) / ( a * e - b * d );
        x = ( c - b * y ) / a;
        ix = ( int )( x * 10000.0 );
        iy = ( int )( y * 10000.0 );
        ix += ( ix > 0 ) ? 5 : -5;
        iy += ( iy > 0 ) ? 5 : -5;
        ix /= 10;
        iy /= 10;
        x = ( float )ix;
        y = ( float )iy;
        x /= 1000.0;
        y /= 1000.0;
        printf( "%.3f %.3f\n", x, y );
    }

    return 0;
}

Measured memory_bytes: 644
#include <iostream>
using namespace std;
int main(){
  int N;
  cin>>N;
  
  int x,count;
  int min = 1000;
  for(int i = 0; i < N;i++){
    cin >>x;
    count = 0;
    while(x%2==0){
      count++;
      x /= 2;
    }
    if(count < min){
      min = count;
    }
  }
  
  cout << min << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <cmath>

using namespace std;

double entropy(int N, const vector<int> &x) {
    double H = 0;
    for (int i=0; i<256; ++i) {
        if (x[i] != 0) {
            H -= (double)x[i] / N * log((double)x[i] / N);
        }
    }
    return H;
}

int main() {
    ios::sync_with_stdio(false);
    int N;
    while (cin >> N && N) {
        vector<int> I(N+1);
        for (int i=1; i<=N; ++i) cin >> I[i];
        int M = 256;
        double Hmin = 100000.0;
        vector<int> ans(3);
        for (int S=0; S<=15; ++S) {
            for (int A=0; A<=15; ++A) {
                for (int C=0; C<=15; ++C) {
                    vector<int> x(256, 0);
                    int R = S;
                    int O;
                    int cnt = 0;
                    int upper = N;
                    for (int i=1; i<=N; ++i) {
                        R = (A * R + C) % M;
                        O = (I[i] + R) % M;
                        cnt += x[O] == 0;
                        if (upper < cnt) break;
                        x[O] ++;
                    }
                    if (upper < cnt) continue;
                    upper = cnt;
                    double H = entropy(N, x);
                    if (H + 1e-8 < Hmin) {
                        Hmin = H;
                        ans[0] = S;
                        ans[1] = A;
                        ans[2] = C;
                    }
                }
            }
        }
        cout << ans[0] << " " << ans[1] << " " << ans[2] << endl;
    }
    return 0;
}

Measured memory_bytes: 1248
def main():
  S = str(input())
 
  ans = [0] * 13
  ans[0] = 1
  MOD = 10**9 + 7

  for i in S:
      dp = [0] * 13
      for j in range(13):
          dp[(j * 10) % 13] = ans[j] % MOD
      dp += dp
      if i == '?':
          for j in range(13):
              ans[j] = sum(dp[j+4:j+14])
      else:
          for j in range(13):
              ans[j] = dp[j + 13 - int(i)]

  print(ans[5] % MOD)

if __name__ == '__main__':
    main()

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

int main(int argc, char *argv[])
{
    int n, m, num;
    cin >> n >> m;

    vector<vector<int>> A(n, vector<int>(m));
    vector<int> b(m);
    vector<int> c(n, 0);

    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < m; j++)
            cin >> A[i][j];
    }
    for (int i = 0; i < m; i++)
    {
        cin >> b[i];
    }

    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < m; j++)
            c[i] += A[i][j] * b[j];
    }
    for (int i = 0; i < n; i++)
    {
        cout << c[i] << endl;
    }

    return 0;
}

Measured memory_bytes: 3160
# frozen_string_literal: true

# n = gets.to_i
# a = gets.split.map(&:to_i)

s = gets.chomp.chars
q = gets.to_i
flagReverse = false
q.times do
  query = gets.chomp.split.map(&:to_s)

  if query[0] == '1'
    flagReverse = !flagReverse
  elsif query[0] == '2'
    if (query[1] == '1' && !flagReverse) || (query[1] == '2' && flagReverse)
      s.unshift(query[2])
    else
      s.push(query[2])
    end
  end
end
s.reverse! if flagReverse
puts s.join


Measured memory_bytes: 28028
#include<bits/stdc++.h>
#define rep(i,n) for(int i = 0;i<n;i++)
using namespace std;
typedef pair<int,int> P;
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;}

int main() {
    int x;
    cin >> x;
    if(x>=30) cout << "Yes" << endl;
    else cout << "No" << endl;
}

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

typedef long long int ll;
#define rep(i,n) for(int i = 0; i < n; i++)

int main() {
  int a,b,c;
  cin >> a >> b >> c;
  cout << min(a+b,min(b+c,c+a)) << endl;
  return 0;
}

Measured memory_bytes: 3532
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {

    private static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

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

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

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

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

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

    public static void main(final String[] args) throws IOException {
        FastReader in = new FastReader();
        PrintWriter out = new PrintWriter(System.out, true);

        String s = in.next();
        String t = in.next();
        if (t.length() == s.length() + 1 && t.startsWith(s)) {
            out.println("Yes");
        } else {
            out.println("No");
        }
    }
}


Measured memory_bytes: 32680
num1=int(input())
num2=int(input())
num3=int(input())
sum_n=int(input())
#print(num1,num2,num3,sum_n)
a=0
for i in range(num1+1):
    sum_n1=sum_n-500*i
    #print(sum_n1)
    if sum_n1<0:
        break
    for i in range(num2+1):
        sum_n2=sum_n1-100*i
        if sum_n2<0:
            break
        for i in range(num3+1):
            if i==sum_n2/50:
                a+=1
                #print(True)
print(a)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using ll = long long;
#define FOR(i, k, n) for(ll i = (k); i < (n); i++)
#define FORe(i, k, n) for(ll i = (k); i <= (n); i++)
#define FORr(i, k, n) for(ll i = (k)-1; i > (n); i--)
#define FORre(i, k, n) for(ll i = (k)-1; i >= (n); i--)
#define REP(i, n) FOR(i, 0, n)
#define REPr(i, n) FORre(i, n, 0)
#define ALL(x) (x).begin(), (x).end()
#define ALLr(x) (x).rbegin(), (x).rend()
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
using namespace std;

const int INF = 1001001001;

int main(void){
  ll n;
  cin >> n;
  vector<ll> a(n), b(n), c(n);
  REP(i, n) cin >> a[i];
  REP(i, n) cin >> b[i];
  REP(i, n) cin >> c[i];
  sort(ALL(a));
  sort(ALL(b));
  sort(ALL(c));
  vector<ll> sum(n+1, 0);
  REP(i, n){
    ll p = lower_bound(ALL(a), b[i]) - a.begin();
    sum[i+1] = sum[i]+p;
  }
  ll ans = 0;
  REP(i, n){
    ll p = lower_bound(ALL(b), c[i]) - b.begin();
    ans += sum[p];
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3328
#import sys

#input = sys.stdin.readline
import math
#import bisect

def sosuhante(n):
    for k in range(2, int(math.sqrt(n))+1):
        if n% k ==0:
            return False
    return True


def main():
#    h,w,a,b = map(int, input().split())
    r = int(input())
    print(r*r//1)




if __name__ == "__main__":
    main()

Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
#define rep(i,n) for (ll i=0;i<n;++i)
#define rep2(i,a,b) for (ll i=a;i<b;++i)
const ll MOD=1000000007;
string alp="abcdefghijklmnopqrstuvwxyz";

int main(){
    int N;
    cin >> N;
    map<int,int> m;
    rep(i,N){
        int p;
        cin >> p;
        p--;
        m[p]=i;
    }
    int count=1,ans=0;
    rep(i,N-1){
        if (m[i]<m[i+1]){
            count++;
        }
        else {
            count=1;
        }
        ans=max(ans,count);
    }
    if (N==1){
        ans=1;
    }
    cout << N-ans << endl;
}


Measured memory_bytes: 10240
//#pragma GCC optimize(2)
//#pragma GCC optimize(3,"Ofast","inline")


#include<stdio.h>
#include<string.h>
#include<math.h>
#include<iostream>
#include<string>
#include<sstream>
#include<algorithm>
#include<map>
//#include<unordered_map>
#include<set>
#include<queue>
#include<deque>
#include<stack>
#include<vector>
#include<bitset>
using namespace std;
typedef long long ll; 
typedef unsigned int ull; 
//typedef pair<int, int> P; 
const int mod = 1e9 + 7;
const int N = 1e5 + 5;
struct ed{
	int to, nxt, w;
}e[N << 1];
int head[N], tot = 1;
void add(int u, int v, int w){
	e[tot].to = v, e[tot].w = w, e[tot].nxt = head[u], head[u] = tot++;
}

int a[N], n, op = 1, x, y;
int  main()
{
	scanf("%d", &n);
	for (int i = 1; i <= n; i++)
		scanf("%d", &a[i]);
	sort(a + 1, a + n + 1, greater<int>());
	for (int i = 1; i <= n + 1; i++)
	{
		if (i > a[i])
		{
			x = a[i - 1] - i + 1;
			int j = 0;
			for (; a[i + j] == i - 1; j++)
				y++;
			if ((x & 1) | (y & 1))
				printf("First\n");
			else
				printf("Second\n");
			break;
		}
	}
	
}

Measured memory_bytes: 4116
#include<iostream>
using namespace std;
long long N;//输入序列长度
int const maxn = 1e9 + 7;//求模的数
int main()
{
	long long a1 = 1, a2 = 1, a3 = 1,sum;
	cin >> N;
	for (int i = 1; i <= N; i++) {
		a1 = (a1 * 10) % maxn;
		a2 = (a2 * 9) % maxn;
		a3 = (a3 * 8) % maxn;
	}
	sum = ((a1 - ((2 * a2) % maxn) + a3) % maxn + maxn)%maxn;
	cout << sum  << endl;
	return 0;
}

Measured memory_bytes: 3152
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcount
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define df(x) int x = in()
#define dame { puts("-1"); return 0;}
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,vector<T>,greater<T> >
#define bn(x) ((1<<x)-1)
#define newline puts("")
#define v(T) vector<T>
#define vv(T) vector<vector<T>>
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
inline void priv(vi a) { rep(i,sz(a)) printf("%d%c",a[i],i==sz(a)-1?'\n':' ');}
template<typename T>istream& operator>>(istream&i,vector<T>&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const vector<T>&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>ostream& operator<<(ostream&o,const vector<T>&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
const int MX = 200005, INF = 1001001001;
const ll LINF = 1e18;
const double eps = 1e-10;



int main() {
  int n;
  scanf("%d",&n);
  if (n%10 == 9 || n/10 == 9) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  return 0;
}






















Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <string>
#include <cstring>
#define pb push_back
#define mp make_pair
using namespace std;
const int N = 1e5 + 5;

int n;
long long a[N], b[N];

vector <long long> pot;
long long fix;

int ans = 0;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);

    cin >> n;
    for(int i = 1; i <= n; i++)
        cin >> a[i];
    for(int i = 1; i <= n; i++)
        cin >> b[i];

    for(int i = 1; i <= n; i++)
        if(a[i] > b[i])
            pot.pb(a[i] - b[i]);
        else
        {
            ans++;
            fix += (b[i] - a[i]);
        }

    if(fix == 0)
    {
        cout << 0 << endl;
        return 0;
    }

    sort(pot.rbegin(), pot.rend());
    int id = 0;
    while(1)
    {
        if(id == (int)pot.size())
        {
            cout << -1 << endl;
            return 0;
        }

        if(pot[id] >= fix)
        {
            cout << ans + (id + 1) << endl;
            return 0;
        }

        fix -= pot[id];
        id++;
    }

    return 0;
}


Measured memory_bytes: 2428
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#ifdef ENABLE_DEBUG
#define dump(a) cerr<<#a<<"="<<a<<endl
#define dumparr(a,n) cerr<<#a<<"["<<n<<"]="<<a[n]<<endl
#else
#define dump(a) 
#define dumparr(a,n) 
#endif
#define FOR(i, a, b) for(ll i = a;i < b;i++)
#define For(i, a) FOR(i, 0, a)
#define REV(i, a, b) for(ll i = b-1;i >= a;i--)
#define Rev(i, a) REV(i, 0, a)
#define REP(a) For(i, a)
#define SIGN(a) (a==0?0:(a>0?1:-1))

typedef long long int ll;
typedef unsigned long long ull;
typedef unsigned int uint;
typedef pair<ll, ll> pll;
typedef pair<ll,pll> ppll;
typedef vector<ll> vll;
typedef long double ld;
typedef pair<ld,ld> pdd;

const ll INF=(1LL<<50);
#if __cplusplus<201700L
ll gcd(ll a, ll b) {
  if(a < b) return gcd(b, a);
  ll r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}
#endif

template<class S,class T>
std::ostream& operator<<(std::ostream& os,pair<S,T> a){
  os << "(" << a.first << "," << a.second << ")";
  return os;
}
template<class T>
std::ostream& operator<<(std::ostream& os,vector<T> a){
  os << "[ ";
  REP(a.size()){
    os<< a[i] << " ";
  }
  os<< " ]";
  return os;
}

const string YES = "Yes";
const string NO = "No";

void solve(long long A, long long B, long long C){
  set<ll> s;
  s.insert(A);
  s.insert(B);
  s.insert(C);
  if(s.size()==2){
    cout<<YES<<endl;
  }else{
    cout<<NO<<endl;
  }
}

int main(){
  cout<<setprecision(1000);
  cin.tie(0);
  ios::sync_with_stdio(false);
    long long A;
    scanf("%lld",&A);
    long long B;
    scanf("%lld",&B);
    long long C;
    scanf("%lld",&C);
    solve(A, B, C);
    return 0;
}


Measured memory_bytes: 256
N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))
satisfy=0
b_i=0
for i in A:
    if i-b_i==1 and b_i!=0:
        satisfy=satisfy+B[i-1]+C[i-2]
    else:
        satisfy+=B[i-1]
    b_i=i
print(satisfy)


Measured memory_bytes: 3060
#include <algorithm>
#include <iostream>
#include <utility>
#include <vector>
using namespace std;

int main() {
	int64_t n, k;
	cin >> n >> k;
	vector<pair<int64_t, int64_t>> v;
	for (int i = 0; i < n; i++) {
		int64_t a, b;
		cin >> a >> b;
		v.push_back(make_pair(a, b));
	}
	sort(begin(v), end(v));
	int64_t l = 0;
	for (int i = 0; i < n; i++) {
		l += v[i].second;
		if (k <= l) {
			cout << v[i].first << endl;
			break;
		}
	}
	return 0;
}


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

typedef long long ll;
typedef unsigned long long ull;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define MAX 9223372036854775807
#define MOD 1000000007

int main(void){

    int n, k;
    cin >> n >> k;

    int ans[n]={};
    
    int d;
    while(k--){
        cin >> d;

        rep(i,d){
            int a;
            cin >> a;
            ans[a - 1]++;
        }
    }
    int cnt = 0;
    rep(i, n){
        if(ans[i]==0)
            cnt++;
    }
    cout << cnt << endl;

    return 0;
}


Measured memory_bytes: 3620
/* https://atcoder.jp/contests/abc125/tasks/abc125_b */

#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <algorithm>

using namespace std;

/* {{{ Variables */
int N;
vector<int> V, C;
/* }}} */

int main(int argc, char *argv[])
{
  /* {{{ Input */
  cin >> N;

  V = vector<int>(N);
  C = vector<int>(N);

  for (int& e: V)
    cin >> e;

  for (int& e: C)
    cin >> e;
  /* }}} */

  /* {{{ Output */
  int ans = 0;

  for (int i = 0; i < N; ++i) {
    int v = V.at(i), c = C.at(i);
    int a = v - c;

    if (a > 0) {
      ans += a;
    }
  }

  cout << ans << endl;
  /* }}} */

  return 0;
}


Measured memory_bytes: 256
package main

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

func solve() {
	x, y := getInt(), getInt()

	ans := 0
	f := func(n int) int {
		ret := 0
		switch n {
		case 3:
			ret += 100000
		case 2:
			ret += 200000
		case 1:
			ret += 300000
		}
		return ret
	}

	ans += f(x) + f(y)
	if ans == 600000 {
		ans += 400000
	}

	fmt.Fprintln(wr, ans)
}

// -----------------------------------------

const (
	inf = 1 << 60
	// mod = 1000000007
)

var (
	sc = bufio.NewScanner(os.Stdin)
	wr = bufio.NewWriter(os.Stdout)
)

func main() {
	// buf := 200001
	// sc.Buffer(make([]byte, buf), buf)
	sc.Split(bufio.ScanWords)
	solve()
	wr.Flush()
}

func getInt() int {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return i
}

func getIntSlice(n int) []int {
	is := make([]int, n)
	for i := range is {
		is[i] = getInt()
	}
	return is
}

func getString() string {
	sc.Scan()
	s := sc.Text()
	return s
}

func getRunes() []rune {
	return []rune(getString())
}


Measured memory_bytes: 640
import sys

N = int(input())
XY = list()
for i in range(N):
    XY.append(list(map(int, input().split(" "))))

eo = sum(XY[0]) % 2
for xy in XY:
    if (sum(xy) % 2 != eo):
        print(-1)
        sys.exit()

m = 40 - eo
print(m)
D = [2 ** i for i in range(38, -1, -1)]
if eo == 0:
    D.append(1)

print(" ".join(map(str, D)))
for x, y in XY:
    w = ""
    for i in range(m):
        if 0 <= x - y and 0 <= x + y:
            w += "R"
            x -= D[i]
        elif 0 > x - y and 0 <= x + y:
            w += "U"
            y -= D[i]
        elif 0 <= x - y and 0 > x + y:
            w += "D"
            y += D[i]
        else:
            w += "L"
            x += D[i]
    print(w)


Measured memory_bytes: 3316
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
constexpr int MOD = 1000000000 + 7;
constexpr int INF = 2000000000;
using namespace std;

int main() {
	int n;
	cin >> n;
	cout << "ABC" << n << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

typedef long long ll;

#define rep(i, n) for (ll i = 0; i < (ll)n; ++i)
#define INF 10e12
#define MOD 1000000000 + 7
#define MAX 51000
#define all(x) (x).begin(), (x).end()
#define MX(x) *max_element(all(x))
#define MN(x) *min_element(all(x))

using namespace std;

int main(void)
{
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    ll A, B, N;

    cin >> A >> B >> N;
    if (B <= N)
        cout << A * (B - 1) / B << endl;
    else
        cout << A * N / B << endl;
}


Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
long long gcd(long long x,long long y)
{
	if(y==0) return x;
	return gcd(y,x%y);
}
long long a[11];
int main ()
{
	int n;
    scanf("%d",&n);
    for(int i=1;i<=n;i++){
        scanf("%lld",&a[i]);
    }
    for(int i=2;i<=n;i++){
        a[i]=a[i]/gcd(a[i],a[i-1])*a[i-1];
    }
    printf("%lld\n",a[n]);
	return 0;
} 

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <queue>
#include <cstring>
#include <vector>
#include <map>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <bitset>
#include <set>
#include <deque>

using namespace std;

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define all(i,n) (i),(i+n)

int dx4[4]={1,0,-1,0};
int dy4[4]={0,-1,0,1};
int dx8[8]={1,0,-1,1,-1,1,0,-1};
int dy8[8]={1,1,1,0,0,-1,-1,-1};

typedef pair<int, int> P;
typedef pair<string, int> SP;
typedef long long ll;
typedef pair<ll, ll> PLL;

const int INF = 1e9;
const ll LLINF = 1e18;
const int MAX_V = 1e6+1;
const ll mod = 1000000007;

// --------------------------------------
int n, m;
vector<vector<ll>> dp;

struct Edge {
  int x, y, cost;
};

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

  cin >> n >> m;

  vector<int> a(m), b(m), c(m);
  dp.assign(n, vector<ll>(n, INF));
  REP(i, n) dp[i][i] = 0;

  REP(i, m) {
    cin >> a[i] >> b[i] >> c[i];
    a[i]--; b[i]--;
    dp[a[i]][b[i]] = c[i];
    dp[b[i]][a[i]] = c[i];
  }

  REP(k, n) {
    REP(i, n) {
      REP(j, n) {
        dp[i][j] = min(dp[i][j], dp[i][k] + dp[k][j]);
      }
    }
  }

  int ans = m;
  REP(i, m) {
    bool f = false;
    REP(j, n) {
      if(dp[j][a[i]] + c[i] == dp[j][b[i]]) f = true;
    }
    if(f) ans--;
  }
  cout << ans << endl;
}


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

int main()
{
	int W, H, x, y, r;
	cin >> W >> H >> 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: 3096
import sys
input = sys.stdin.readline
import numpy as np
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
x = max(max(a),max(b)).bit_length()+1
a = np.array(a,dtype=np.int32)
b = np.array(b,dtype=np.int32)
ans = 0
for i in range(1,x+1):
  c = a&(1<<i)-1
  d = b&(1<<i)-1
  d.sort()
  t = 1<<(i-1)
  anstmp = 0
  t1 = np.searchsorted(d,t-c).sum()
  t2 = np.searchsorted(d,2*t-c).sum()
  t3 = np.searchsorted(d,3*t-c).sum()
  anstmp += (t2-t1)+(n-t3)
  if anstmp%2:
    ans += t
print(ans)

Measured memory_bytes: 42600
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main
{
  public static void main(String[] args) throws IOException
  {
    BufferedReader r = new BufferedReader(new InputStreamReader(System.in), 1);
    String s;
    String sl[];

    s = r.readLine();
    //sl = s.split(" ");
    //int n = Integer.parseInt(sl[0]);

    System.out.printf("%c", s.charAt(0) + 1);
  }

}

class RemRing
{
  long module;

  public RemRing(long module)
  {
    this.module = module;
  }

  public long sum(long a, long b)
  {
    return (a + b + module) % module;
  }

  public long sub(long a, long b)
  {
    return (a - b + module) % module;
  }

  public long prod(long a, long b)
  {
    return (a * b) % module;
  }

  public long div(long a, long b)
  {
    return (a * inv(b)) % module;
  }

  public long inv(long a)
  {
    long b = this.module;
    long u = 1;
    long v = 0;
    while (b > 0)
    {
      long t = a / b;
      a -= t * b;
      u -= t * v;
      long z = a;
      a = b;
      b = z;
      z = u;
      u = v;
      v = z;
    }
    u %= this.module;
    if (u < 0)
      u += this.module;
    return u;
  }
}

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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"
#define PI 3.14159265358979
#define MOD 1000000007 // = 10^9 + 7

using namespace std;
using ll = long long;

void solve()
{
	int low_digit = 0;
	int high_digit = 0;
	int ans[200003] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, };

	for(int i = 10; i <= 99; ++i)
	{
		low_digit = i % 10;
		high_digit = i / 10;
		if (low_digit == 0)
		{
			ans[i] = 0;
		}
		else if (high_digit > low_digit)
		{
			ans[i] = 2;
		}
		else if (high_digit < low_digit)
		{
			ans[i] = 0;
		}
		else // low_digit == high_digit
		{
			ans[i] = 3;
		}
	}
	for(int i = 100; i <= 999; ++i)
	{
		low_digit = i % 10;
		high_digit = i / 100;
		if (low_digit == 0)
		{
			ans[i] = 0;
		}
		else if (high_digit > low_digit)
		{
			ans[i] = 22;
		}
		else if (high_digit < low_digit)
		{
			ans[i] = 2;
		}
		else // low_digit == high_digit
		{
			ans[i] = 5 + ((i / 10) % 10) * 2;
		}
	}
	for(int i = 1000; i <= 9999; ++i)
	{
		low_digit = i % 10;
		high_digit = i / 1000;
		if (low_digit == 0)
		{
			ans[i] = 0;
		}
		else if (high_digit > low_digit)
		{
			ans[i] = 222;
		}
		else if (high_digit < low_digit)
		{
			ans[i] = 22;
		}
		else // low_digit == high_digit
		{
			ans[i] = 25 + ((i / 10) % 100) * 2;
		}	
	}
	for(int i = 10000; i <= 99999; ++i)
	{
		low_digit = i % 10;
		high_digit = i / 10000;
		if (low_digit == 0)
		{
			ans[i] = 0;
		}
		else if (high_digit > low_digit)
		{
			ans[i] = 2222;
		}
		else if (high_digit < low_digit)
		{
			ans[i] = 222;
		}
		else // low_digit == high_digit
		{
			ans[i] = 225 + ((i / 10) % 1000) * 2;
		}	
	}
		for(int i = 100000; i <= 200000; ++i)
	{
		low_digit = i % 10;
		high_digit = i / 100000;
		if (low_digit == 0)
		{
			ans[i] = 0;
		}
		else if (high_digit > low_digit)
		{
			cout << "naihazu " << i << endl;
		}
		else if (high_digit < low_digit)
		{
			ans[i] = 2222;
		}
		else // low_digit == high_digit
		{
			ans[i] = 2225 + ((i / 10) % 10000) * 2;
		}	
	}

	int n;
	cin >> n;

	for(int i = 0; i < n; ++i)
	{
		ans[i + 1] = ans[i] + ans[i + 1];
		// cout << i + 1 << " " << ans[i + 1] << endl;
	}

	cout << ans[n];


}

int main()
{
	fastio;
	solve();

	return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>

using namespace std;

int main() {
  long long N, K;
  cin >> N >> K;
  vector<long long> A(N);
  vector<bool> visited(N, false);
  vector<long long> F(N, 0);
  
  for (long long i = 0; i < N; i++) {
    cin >> A[i];
    A[i]--;
  }
  
  long long cnt1 = N > K ? K : N;
  long long now = 0;
  long long loop_start = 0;
  long long loop_start_at = 0;
  long long loop_length = 0;
  visited[0] = true;
  for (long long i = 0; i < cnt1; i++) {
    now = A[now];
    if (visited[now]) {
      if (loop_length == 0) {
        loop_length = i-F[now];
        if (now == 0) loop_length++;
        loop_start = F[now];
        if (now != 0) loop_start++;
        loop_start_at = now;
      }
    } else {
      F[now] = i;
      visited[now] = true;
    }
  }
  if (N >= K) {
    now++;
    cout << now << endl;
    return 0;
  }
  //cout << loop_length << endl;
  //cout << loop_start << endl;
  long long cnt2 = (K - loop_start) % loop_length;
  now = loop_start_at;
  for (long long i = 0; i < cnt2; i++) {
    now = A[now];
  }
  now++;
  cout << now << endl;
  return 0;
}

Measured memory_bytes: 6404
import bisect
n = int(input())
L = sorted(list(map(int, input().split())))

counter = 0
for a_pointer in range(len(L)):
    for b_pointer in range(a_pointer+1, len(L)):
        a = L[a_pointer]
        b = L[b_pointer]
        c_left_pointer = max(bisect.bisect_left(L, b - a + 1), b_pointer + 1)
        c_right_pointer = bisect.bisect_right(L, b + a - 1)
        #print(a, b, c_left_pointer, c_right_pointer)
        counter += max(c_right_pointer - c_left_pointer, 0)
        #if c_right_pointer == len(L) and c_right_pointer == len(L):
            #break
print(counter)

Measured memory_bytes: 48092
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define lef(x) (x<<1)
#define rig(x) (lef(x)+1)
#define int long long
const ll MOD=1e9+7LL;
const int N=500;
int mat[N][N],rs[N][N];
int32_t main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    int n,m,k;
    cin>>n>>m>>k;
    char ch;
    for (int i = 0; i < n; ++i)
    {
    	for (int j = 0; j < m; ++j)
    	{
    		cin>>ch;
    		if(ch=='#')
    			mat[i][j] = 1;
    	}
    }
    for (int j = 0; j < m; ++j)
    {
    	int last=0;
    	for (int i = 0; i < n; ++i)
    	{
    		if(mat[i][j]==1)
    		{
    			for (int c = last; c <= i; ++c)
    			{
    				rs[c][j]=k;
    			}
    			k--;
    			last=i+1;
    		}
    	}
    	if(last!=0)
    	{
	    	for (int c = last; c <= n; ++c)
			{
				rs[c][j]=k+1;
			}
    	}else if(j!=0)
    	{
    		for (int i = 0; i < n; ++i)
    		{
    			rs[i][j]=rs[i][j-1];
    		}
    	}
    }
    for (int j = m-2; j >=0; --j)
    {
    	if(rs[0][j]==0)
    	{
    		for (int i = 0; i < n; ++i)
    		{
    			rs[i][j]=rs[i][j+1];
    		}
    	}
    }
    for (int i = 0; i < n; ++i)
    {
    	for (int j = 0; j < m; ++j)
    	{
    		cout<<rs[i][j]<<" ";
    	}
    	cout<<"\n";
    }
    return 0;   
}

Measured memory_bytes: 3072
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;
typedef vector<int> vi; typedef long long ll;
#define pb push_back
int N,A[502],K,sum,ans; ll psa1[502],psa2[502]; vi f,rem;
int main() {
    scanf("%d%d",&N,&K); for (int i = 1;i <= N;i++) scanf("%d",&A[i]),sum += A[i];
    for (int i = 1;i*i <= sum;i++) if (sum%i == 0) {f.pb(i); if (i*i < sum) f.pb(sum/i);} sort(f.begin(),f.end());
    for (int m = 0,i;m < f.size();m++) {
        rem.clear(); for (i = 1;i <= N;i++) if (A[i]%f[m] > 0) rem.pb(A[i]%f[m]); sort(rem.begin(),rem.end());
        psa1[0] = psa2[rem.size()+1] = 0;
        for (i = 1;i <= rem.size();i++) psa1[i] = psa1[i-1]+rem[i-1];
        for (i = rem.size();i;i--) psa2[i] = psa2[i+1]+(f[m]-rem[i-1]);
        for (i = 1;i < rem.size();i++) if (psa1[i] == psa2[i+1]) break;
        if (psa1[i] <= K) ans = max(ans,f[m]);
    }
    printf("%d\n",ans);
}


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

using namespace std;
using ll = long long;

int n, m, Q;
int d[510][510];

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

    cin >> n >> m >> Q;

    for(int i = 0; i < m; ++i){
        int l, r;
        cin >> l >> r;
        ++d[l][r];
    }
    for(int i = 0; i < n; ++i){
        for(int j = 0; j < n; ++j){
            d[i+1][j+1] += d[i][j+1]+d[i+1][j]-d[i][j];
        }
    }
    for(int i = 0; i < Q; ++i){
        int p, q;
        cin >> p >> q;
        cout << d[q][q]-d[q][p-1]-d[p-1][q]+d[p-1][p-1] << endl;
    }
    return 0;
}


Measured memory_bytes: 1920
import sys
H, W, M = map(int, input().split())
hn = [0]*H
wn = [0]*W
flag = set()
for i in range(M):
  h, w = map(int, input().split())
  hn[h-1] += 1
  wn[w-1] += 1
  flag.add((h,w))
  
#hrank = sorted(hn, key=lambda t:-t[1])
#wrank = sorted(wn, key=lambda t:-t[1])

hmax = max(hn)
wmax = max(wn)

hmaxlist = {i+1 for i,h in enumerate(hn) if h == hmax}
#for h in hn:
#  if h == hmax:
#    hmaxlist.append(h)
  
wmaxlist = {i+1 for i,w in enumerate(wn) if w == wmax}
#for w in wn:
#  if w == wmax:
#    wmaxlist.append(w)
  

for i in hmaxlist:
  for j in wmaxlist:
    if (i,j) not in flag:
      print(hmax+wmax)
      sys.exit()
print(hmax+wmax-1)

Measured memory_bytes: 215612
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

vector<long long> dp;
int sz;

void update(int k, long long x) {
	k += sz;
	dp[k] = x;
	while (k > 1) {
		k >>= 1;
		dp[k] = max(dp[k * 2], dp[k * 2 + 1]);
	}
}

long long getmax(int a, int b, int k, int l, int r) {
	if (r <= a || b <= l) return 0;
	if (a <= l && r <= b) return dp[k];
	long long x = getmax(a, b, k * 2, l, (l + r) / 2);
	long long y = getmax(a, b, k * 2 + 1, (l + r) / 2, r);
	return max(x, y);
}

int main() {
	int n; cin >> n;
	sz = 1;
	while (sz <= n) sz *= 2;
	dp.assign(sz * 2, 0);
	vector<int> h(n), a(n);
	for (int i = 0; i < n; ++i) cin >> h[i];
	for (int i = 0; i < n; ++i) cin >> a[i];
	for (int i = 0; i < n; ++i)
		update(h[i], getmax(0, h[i], 1, 0, sz) + a[i]);
	cout << getmax(0, sz, 1, 0, sz) << endl;

	return 0;
}

Measured memory_bytes: 5888
main :: IO ()
main = do
  l1 <- getLine
  l2 <- getLine
  let n = read l1 :: Int
      a = map read $ words l2 :: [Int]
      ans = length $ f 1 a
  print $ if ans == 0 then -1 else n - ans

f _ [] = []
f i l@(x:xs)
  | x == i = x:f (i + 1) xs
  | otherwise = f i xs

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

int h, w;
string s[55];
int d[4] = {1, 0, -1, 0};

long long solve();
bool ch(int x, int y);

int main() {
  cin >> h >> w;
  for(int i = 0; i < h; ++i) cin >> s[i];
  if(solve())
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}

long long solve() {
  for(int i = 0; i < h; ++i)
    for(int j = 0; j < w; ++j)
      if(s[i][j] == '#') {
        bool now = 0;
        for(int k = 0; k < 4; ++k) {
          int x = i + d[k], y = j + d[1 ^ k];
          if(ch(x, y) && s[x][y] == '#') now = 1;
        }
        if(!now) return 0;
      }
  return 1;
}

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

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
long t[100000];

int cmp(const void *a,const void *b){
	return *(long*)a- *(long*)b;
}

int main(int argc, char const *argv[]){
	long n,c,k,i,ans=0,now=-1,mem=0;
	scanf("%ld %ld %ld",&n,&c,&k);
	for(i=0;i<n;i++){
		scanf("%ld",&t[i]);
	}
	qsort(t,n,sizeof(long),cmp);
	for(i=0;i<n;i++){
		mem++;
		if(now<t[i] || mem>c){
			ans++;
			now=t[i]+k;
			mem=1;
		}
	}
	printf("%ld\n",ans);
	return 0;
}

Measured memory_bytes: 1788
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		
		for(;;) {
			
			int ans = 0;
			String s = sc.nextLine();

			if(s.equals("0"))break;

			for(int i=0; i < s.length(); i++) {
				ans += Character.digit(s.charAt(i), 10);
				
			}
			System.out.println(ans);
		}
		

	}

}



Measured memory_bytes: 26640
import math
def lazy_update(s, e, value):
    a = [(1, l+s, l+e, 1)]
    while a:
        k, s, e, depth = a.pop()
        l_end, r_end = k << (rank-depth), (k+1) << (rank-depth)
        mid = (l_end + r_end) // 2
        if s == l_end and e == r_end:
            lazy[k] = value
        else:
            if lazy[k] is not None:
                lazy[k<<1] = lazy[k]
                lazy[(k<<1)+1] = lazy[k]
                lazy[k] = None
            if s < mid:
                a.append((k<<1, s, min(mid, e), depth+1))
            if e > mid:
                a.append(((k<<1)+1, max(mid, s), e, depth+1))

def get_value(i):
    i += l
    for j in range(rank, -1, -1):
        n = lazy[i>>j]
        if n is not None:
            return n
    return tree[i]

n, q = map(int,input().split())
l = 1 << math.ceil(math.log2(n))
tree = [2**31-1]*(2*l)
lazy = [None]*(2*l)
rank = int(math.log2(len(tree)))
ans = []
ap = ans.append

for _ in [None]*q:
    query = list(map(int, input().split()))
    if query[0] == 0:
        lazy_update(query[1], query[2]+1, query[3])
    else:
        ap(get_value(query[1]))

print("\n".join((str(n) for n in ans)))

Measured memory_bytes: 19784
import math
import copy
from copy import deepcopy
import sys
import fractions
# import numpy as np
from functools import reduce
# import statistics
import decimal
import heapq
import collections
import itertools
from operator import mul

sys.setrecursionlimit(100001)


# input = sys.stdin.readline
# sys.setrecursionlimit(10**6)

# ===FUNCTION===

def getInputInt():
    inputNum = int(input())
    return inputNum


def getInputListInt():
    outputData = []
    inputData = input().split()
    outputData = [int(n) for n in inputData]

    return outputData


def getSomeInputInt(n):
    outputDataList = []
    for i in range(n):
        inputData = int(input())
        outputDataList.append(inputData)

    return outputDataList


def getSomeInputListInt(n):
    inputDataList = []
    outputDataList = []
    for i in range(n):
        inputData = input().split()
        inputDataList = [int(n) for n in inputData]
        outputDataList.append(inputDataList)

    return outputDataList


# ===CODE===

n = int(input())

ans = 0
for i in range(1, n + 1, 1):
    s = str(i)
    if len(s) % 2 == 1:
        ans += 1

print(ans)


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

int main() {
	string s;
	cin >> s;
	cout << s.substr(0,3) << endl;
	return 0;
}


Measured memory_bytes: 3620