akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"

using namespace std;

#define sp(x) cout<<setprecision(x);
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define all(a) (a).begin(), (a).end()
#define inf 10000000
#define linf INT64_MAX*0.99
#define print(s) cout<<(s)<<endl
#define lint long long
#define yes "Yes"
#define no "No"

typedef pair<int, int> P;
 
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int h, w; cin>>h>>w;
    vector<string> s(h);
    REP(i,h) cin>>s[i];
    bool flag = true;
    REP(i,h){
        REP(j,w){
            if(s[i][j]=='#'){
                if(i==0&&j==0){
                    if(s[i][j+1]!='#'&&s[i+1][j]!='#') {
                        flag = false;
                    }
                } else if(i==h-1&&j==w-1){
                    if(s[i][j-1]!='#'&&s[i-1][j]!='#'){
                        flag = false;
                    } 
                } else if(i==0){
                    if(s[i][j+1]!='#'&&s[i+1][j]!='#'&&s[i][j-1]!='#'){
                        flag = false;
                    }
                }else if(i==h-1){
                    if(s[i][j-1]!='#'&&s[i][j+1]!='#'&&s[i-1][j]!='#'){
                    flag = false;
                    }
                }else if(j==w-1){
                    if(s[i][j-1]!='#'&&s[i+1][j]!='#'&&s[i-1][j]!='#'){
                    flag = false;
                    }
                } else if(j==0){
                    if(s[i][j+1]!='#'&&s[i+1][j]!='#'&&s[i-1][j]!='#'){
                        flag = false;
                    }
                }  else {
                    if(s[i][j+1]!='#'&&s[i+1][j]!='#'&&s[i][j-1]!='#'&&s[i-1][j]!='#'){
                        flag = false;
                    }
                }
                if(flag==false) break;
            } else continue;
        }
    }
    if(flag) print("Yes");
    else print("No");
    return 0;
}

Measured memory_bytes: 256
#!/usr/bin/python3

from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W

def ok(a1, c):
    b1 = c[0][0] - a1
    b2 = c[0][1] - a1
    b3 = c[0][2] - a1

    if len(set([c[1][0] - b1,  c[1][1] - b2,  c[1][2] - b3])) != 1:
        return False
    if len(set([c[2][0] - b1, c[2][1] - b2, c[2][2] - b3])) != 1:
        return False

    return True

def main():
    c = []
    for _ in range(3):
        c.append(list(map(int, input().split())))

    for a1 in range(101):
        if ok(a1, c):
            print(Yes)
            return
    print(No)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3956
/* Karen {{{
  ___  ____
 |_  ||_  _|
   | |_/ /    ,--.   _ .--.  .---.  _ .--.
   |  __'.   `'_\ : [ `/'`\]/ /__\\[ `.-. |
  _| |  \ \_ // | |, | |    | \__., | | | |
 |____||____|\'-;__/[___]    '.__.'[___||__]
}}} */
// include {{{
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <cmath>
#include <math.h>
#include <string>
#include <vector>
#include <complex>
#include <iostream>
#include <algorithm>

using namespace std;

// }}}
/* cpp template {{{*/


#define endl '\n'

#define REP(i, n) for (int i = 0; i < (n); i++)
#define REPS(i, a, n) for (int i = (a); i < (n); i++)
#define RREP(i, n) for (int i = 1; i <= (n); i++)

typedef double D;      // 座標値の型。doubleかlong doubleを想定
typedef long long ll;
typedef long double lb;
typedef complex<D> P;  // Point
typedef pair<P, P> L;  // Line
typedef vector<P> VP;
typedef vector<int> vi;
typedef vector<vector<int> > vii;
typedef pair<int, int> pii;
typedef pair<int, string> pis;
typedef pair<string, int> psi;

inline bool inside(int y, int x, int H, int W){return (y >= 0 && x >= 0 && y < H && x < W);}
inline int in() {int x; std::cin >> x; return x;}

template <typename T>
void print(std::vector<T>& v, char c = ' ') {
  REP(i, v.size()) {
    if (i != 0) std::cout << c;
    std::cout << v[i];
  }
  std::cout << endl;
}
template <typename T>
void print(T x) {
  std::cout << x << '\n';
}

/* 定数 */
const ll MOD = 1e9 + 7;
const ll INF = 1e9 + 9;
const D EPS  = 1e-9;
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1};
const int dy[] = {1, 0, -1, 0, 1, -1, -1, 1};


/* }}} */

bool b[100000] = {true};
int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);

  int N = in(), M = in();
  int x, y;
  int No[100000];
  int cnt = 0;
  REP(i, N) No[i] = 1;

  REP(i, M){
    x = in();
    y = in();

    x--;
    y--;
    if (b[x]){
      b[y] = true;
      No[x]--;
      No[y]++;
      if (No[x] == 0){
        b[x] = false;
      }
    }
    else {
      No[x]--;
      No[y]++;
    }
  }
  REP(i, N) if (b[i]) cnt++;
  
  cout << cnt << endl;
  return (0);
}



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

int main() {
 int N,K;
 cin >> N;
 string S;
 cin >> S;
 cin >> K;
 char s=S[K-1];
 int i;
 for (i=0;i<N;++i) {
  if (S[i] != s) {
   S[i] = '*';
  }
 }
 cout << S <<endl;
 
}

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()))
ans = 0
bf = 0
for i in range(n):
  eat = a[i]
  ans += b[eat - 1]
  if bf > 0:
    if bf + 1 == eat:
      ans += c[bf - 1]
  bf = eat
print(ans)

Measured memory_bytes: 3064
#include <iostream>

using namespace std;

int main()
{
    int maxIndex, no1 = 0, no2 = 0;
	int n, a;
    cin >> n;

    for(int i = 0; i < n; ++i) {
        cin >> a;

        if(no1 < a) {
            no1 = a;
            maxIndex = i;
        }
        else if(no2 < a)
            no2 = a;
    }

    for(int i = 0; i < n; ++i) {
        if(maxIndex == i) 
            cout << no2 << '\n';
        else
            cout << no1 << '\n';
    }
}


Measured memory_bytes: 1664
while 1:
    a,b,c=map(int,input().split())
    if a==0:break
    d=[int(input()) for i in range(a)]
    e=0
    for i in range(b,c+1):
        if d[i-1]-d[i]>=e:
            e=d[i-1]-d[i]
            f=i
    print(f)

Measured memory_bytes: 7616
package main

import (
	"fmt"
)

func main() {
	var a string
	fmt.Scan(&a)
	if a == "Sunny" {
		fmt.Println("Cloudy")
	} else if a == "Cloudy" {
		fmt.Println("Rainy")
	} else {
		fmt.Println("Sunny")
	}
}


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

using namespace std;

typedef long long ll;

const ll INF=100000000000;
const ll MOD=1e9+7;

int main(){
        int n, m;
        cin>>n>>m;
        vector <ll> x, y;
        for(int i=0;i<n;i++){
                ll xx;
                cin>>xx;
                x.push_back(xx);
        }
        for(int i=0;i<m;i++){
                ll yy;
                cin>>yy;
                y.push_back(yy);
        }
        ll xsum=0, ysum=0;
        for(int i=1;i<n;i++){
                xsum+=(x[i]-x[i-1])*(i)*(n-i);
                xsum%=MOD;
        }
        for(int i=1;i<m;i++){
                ysum+=(y[i]-y[i-1])*(i)*(m-i);
                ysum%=MOD;
        }
        cout<<xsum*ysum%MOD<<endl;
        return 0;
}


Measured memory_bytes: 2548
#include <bits/stdc++.h>
using namespace std;
#define  rep(i, n) for(int i = 0; i < n; i++) 
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  INF 1LL << 60
typedef long long int LL;
typedef long long int ll;
#define pll pair<ll, ll>
#define F first
#define S second
const int MOD = 1000000007;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; }
//sort(all(x))とするとソートできるよ
// 10^x は pow(10,(x)) 
// 任意のlogは　対数の底の変換を使う    log(N) / log(任意の底)

int main(){
    LL N;cin >> N;
    if(N == 1)cout << 0 << endl;
    else if(N % 2==0)cout << (N-1)*N/2;
    else cout << N*(N-1)/2;
}



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

int main() {
    string c;
    
    cin >> c;
    
    if (c=="a" || c=="i" || c=="u" || c=="e" || c=="o"){
        cout << "vowel" << endl;
    }
    else{
        cout << "consonant" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<iostream>

int main(){
  int a, b;
  std::cin >> a;
  std::cin >> b;

  std::string op;
  if(a < b){
    op = "a < b";
  }else if(a > b){
    op = "a > b";
  }else{
    op = "a == b";
  }
  std::cout << op << std::endl;
    
  return 0;
}



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

int main() {
  int A, B, ans;
  char op;
  cin >> A >> op >> B;

  if(op == '+') ans=A+B;
  if(op == '-') ans=A-B;

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#include <cstring>

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

using namespace std;

int inputValue(){
    int a;
    cin >> a;
    return a;
};

void inputArray(int * p, int a){
    rep(i, a){
        cin >> p[i];
    }
};

void inputVector(vector<int> * p, int a){
    rep(i, a){
        int input;
        cin >> input;
        p -> push_back(input);
    }
}

template <typename T>
void output(T a, int precision) {
    if(precision > 0){
        cout << setprecision(precision)  << a << "\n";
    }
    else{
        cout << a << "\n";
    }
}

int main(int argc, const char * argv[]) {
    int N = inputValue();
    int A = inputValue();
    int B = inputValue();
    int train = N*A;
    int cost = min(train, B);
    
    cout << cost << endl;
    
    return 0;
}


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

/* 大文字を小文字に変換 */
char tolower(char c) {return (c + 0x20);}
/* 小文字を大文字に変換 */
char toupr(char c) {return (c - 0x20);}

// if('A'<=s[i] && s[i]<='Z') s[i] += 'a'-'A';

/*
string s = "abcdefg"
s.substr(4) "efg"
s.substr(0,3) "abc"
s.substr(2,4) "cdef"
*/

int count_n(vector<ll> A, int b, int e, int k){
    int cnt = 0;
    for(int i=b; i<e; i++){
        if(A[i] == k) cnt++;
    }
    return cnt;
}

int main()
{
    int n; cin >> n;
    vector<ll> A(n);
    rep(i,n){
        ll Ai; cin >> Ai;
        A[i] = Ai;
    }
    int q; cin >> q;
    rep(i,q){
        int b, e, k; cin >> b >> e >> k;
        cout << count_n(A, b, e, k) << endl;
    }
}


Measured memory_bytes: 3168
#include <bits/stdc++.h>
#include <cstdio>
#include <vector>
#include <iostream>
#include <utility>
#define chmin(x, y) x = min(x , y);
#define rep(i, j) for (int (i)=0;(i)<(j);(i)++)
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
using namespace std;
typedef long long int ll;

int main (){
    int N;cin >> N;
    vector<int> b(N + 1);
    for(int i=1;i<=N;i++){
        int a;cin >> a;
        b[a] = i;
    }
    for (int i=1;i<=N;i++) cout << b[i] << endl;

    return 0;
}



Measured memory_bytes: 1152
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;

int main(){
    int N,Q;
    cin>>N>>Q;
    cin.ignore();
    string S;
    getline(cin,S);
    vector<vector <int>> M(Q,vector<int>(2));
    for(int i=0;i<Q;i++){
        cin>>M[i][0];
        cin>>M[i][1];
    }
    vector<int> D(N);
    int counter=0;
    D[0]=0;
    for(int i=1;i<N;i++){
        if(S[i-1]=='A'&&S[i]=='C'){
            counter+=1;
        }
        D[i]=counter;
    }
    for(int i=0;i<Q;i++){
        cout<<D[M[i][1]-1]-D[M[i][0]-1]<<endl;
    }
}

Measured memory_bytes: 6784
import java.util.Scanner;

public class Main{

	public static void main(String[] args){
		Scanner scan=new Scanner(System.in);
		int i,n,num,count=0;
		n=scan.nextInt();
		for(i=0;i<n;i++) {
			num=scan.nextInt();
			count+=checkpm(num);
		}
		System.out.println(count);
		scan.close();
	}
	public static int checkem(int num) {
		return num%2;
	}
	public static int checkpm(int num) {
		int i,ans;
		double root;
		if(num==2) {
			return 1;
		}
		ans=checkem(num);
		if(ans==0) {
			return 0;
		}
		else {
			root=Math.sqrt(num);
			for(i=3;i<=root;i+=2) {
				if(num%i==0) {
					return 0;
				}
			}
		}
		return 1;
	}
}


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

int main(){
  int A,B;
  cin >> A >> B;
  int ans;
  if(A != 1 && B != 1) ans = 1;
  if(A != 2 && B != 2) ans = 2;
  if(A != 3 && B != 3) ans = 3;
  
  cout << ans << endl;
  
  return 0;
}

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

int main()
{
    char n[5];
    scanf("%s",n);

    if(((n[0] == n[1]) && (n[1] == n[2])) || ((n[1] == n[2]) && (n[2] == n[3])))
    {
        printf("Yes");
    }
    else
    {
        printf("No");
    }
    
}

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

using namespace std;
using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;
using pll = pair<ll,ll>;

#define INF (1LL << 60)
#define MOD 1000000007
#define PI 3.14159265358979323846

#define REP(i,m,n) for(ll (i)=(m),(i_len)=(n);(i)<(i_len);++(i))
#define FORR(i,v) for(auto (i):v)
#define ALL(x) (x).begin(), (x).end()
#define PR(x) cout << (x) << endl
#define PS(x) cout << (x) << " "
#define SZ(x) ((ll)(x).size())
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define REV(x) reverse(ALL((x)))
#define ASC(x) sort(ALL((x)))
#define DESC(x) ASC((x)); REV((x))
#define pb push_back
#define eb emplace_back

int main()
{
    ll N;
    cin >> N;
    vec _A(N), A;
    REP(i,0,N) cin >> _A[i];
    bool f = false;
    ll k = 0;
    while(k < N-1) {
        if(_A[k] < _A[k+1]) {
            A.pb(_A[k]);
            while(_A[k] < _A[k+1] && k < N-1) ++k;
        }
        else {
            A.pb(_A[k]);
            while(_A[k] >= _A[k+1] && k < N-1) ++k;
        }
    }
    A.pb(_A[k]);

    ll kane = 1000, kabu = 0; 
    REP(i,0,SZ(A)-1) {
        if(A[i] < A[i+1]) {
            kabu = kane / A[i];
            kane -= kabu * A[i]; 
        }
        else {
            kane += kabu * A[i];
            kabu = 0;
        }
    }
    kane += kabu * A[SZ(A)-1];
    PR(kane);



    return 0;
}

/*



*/

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

int AddAllDigits(int a) {
    int s = 0;
    while (a > 0) {
        s += (a % 10);
        a /= 10;
    }
    return s;
}

int main() {
    int n, a, b;
    cin >> n >> a >> b;
    int sum = 0;
    for (int i = 1; i <= n; ++i) {
        int t = AddAllDigits(i);
        if (a <= t && t <= b) {
            sum += i;
        }
    }
    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 256
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

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

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

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

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

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

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

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

fn main() {
    input! {
    	h: usize,
        a: usize,
    }
    println!("{}", if h==a { "Yes" } else { "No" });
}

fn calc(h:usize, a:usize) -> usize {
	if h%a>0 { h/a+1 } else { h/a}
}

Measured memory_bytes: 4352
#include <algorithm>
#include <cmath>
#include <vector>
#include <functional>
#include <cstdlib>
#include <map>
#include <set>
#include <iostream>
#include <string>
#include <ctype.h>
#include <climits>
#include <queue>
#include <cassert>
using namespace std;
typedef long long ll;
#define REP(i, n) for(ll i = 0; i < (ll)(n); ++i)
#define FOR(i, a, b) for(ll i=(a); i < (ll)(b); ++i)
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(){
	ll n;
	cin >> n;
	
	ll ans = 0;
	if(n>2) ans = n-1;
	for(ll i=2; i*i<n; i++){
		if(n%i==0){
			if(n/i-1==i) continue;
			
			if(n/i>2){
				ans += n/i-1;
			}
		}
	}
	
	
	
	cout << ans << endl;
	
	
	return 0;
}

Measured memory_bytes: 3620
/*
 
*/
#include <iostream>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <iomanip>
#include <set>
#include <map>
#include <stack>
#include <deque>
 
#define ll long long
#define cint const int
#define ld long double
#define sz(a) (int)a.size()
#define all(a) a.begin(), a.end()
#define pb push_back
#define ppb pop_back
#define fi first
#define se second
 
using namespace std;
 
typedef vector <long long> vll;
typedef vector <string> vs;
typedef vector <char> vc;
typedef set <int> si;
typedef set <string> ss;
typedef pair <int, int> pi;
typedef pair <long long, long long> pll;
typedef pair <int, long long> pil;
typedef pair <int, string> pis;
typedef pair <int, char> pic;
typedef pair <long long, int> pli;
typedef pair <long long, string> pls;
typedef pair <long long, char> plc;
typedef pair <string, int> psi;
typedef pair <string, long long> psl;
typedef pair <string, char> psc;
typedef pair <char, int> pci;
typedef pair <char, long long> pcl;
typedef pair <char, string> pcs;
 
int n;
 
int main () {
	cin >> n;
	string s1, s2;
	cin >> s1 >> s2;
	for (int i = 0; i < n; ++i) {
	    cout << s1[i] << s2[i];
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,a,b) for(ll i=a;i<b;i++)
int main(){
  ll n,tt;
  cin>>n>>tt;
  ll ans=tt;;
  vector<ll> t(n);
  rep(i,0,n) cin>>t[i];
  rep(i,0,n-1){
    ans+=min(t[i+1]-t[i],tt);
  }
  cout<<ans;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main(){
    ll a,b; cin>>a>>b;
    if (a==b) return puts("1"),0;
    int t,d;
    for (t=59; ~t; --t){
	if (!(a>>t&1)&&(b>>t&1))
	    break;
	if (a>>t&1)
	    a^=1ll<<t,b^=1ll<<t;
    }
    for (d=t-1; ~d; --d)
	if (b>>d&1) break;
    ll l,r,x,y,ans;
    x=a,y=(1ll<<t)+(1ll<<(d+1))-1;
    l=(1ll<<t)+a,r=(1ll<<(t+1))-1;
    ans=y-x+1;
    if (l>y) ans+=r-l+1;
    else if (r>y) ans+=r-y;
    cout<<ans;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
int main()
{
    double a,b,c,d,e,f,x,y,z;
    while(scanf("%lf%lf%lf%lf%lf%lf",&a,&b,&c,&d,&e,&f)!=EOF){


        y=(a*f-d*c)/(a*e-b*d);
        x=(c-b*y)/a;

        printf("%.3lf %.3lf\n",x,y);
    }
    return 0;
}

Measured memory_bytes: 652
#include <iostream>

main(){
        int w, h, x, y, r;

        std::cin >> w >> h >> x >> y >> r;

        if( ( x >= r && w - x >= r ) && ( y >= r && h - y >= r ) ){
                std::cout << "Yes" << std::endl;
        } else {
                std::cout << "No" << std::endl;
        }

}

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

const int maxN = 2e5+5;

void solve(){
    int n; cin >> n;
    string s;
    int a0 = 0, a1 = 0, a2 = 0, a3 = 0;
    while(n--){
        cin >> s;
        if(s == "AC") a0++;
        else if(s == "WA") a1++;
        else if(s == "TLE") a2++;
        else a3++;
    }
    cout << "AC x " << a0 << "\nWA x " << a1 << "\nTLE x " << a2 << "\nRE x " << a3 << "\n";
}


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

    bool multitest = false;
    //multitest = true;
    if(multitest){
        int t; cin >> t;
        while(t--)
            solve();
    }
    else
        solve();
}






Measured memory_bytes: 3664
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for (int i=0;i<(n);i++)
#define MOD 1000000007
//#define int long long  
signed main(){
    int n;
    int am=0;
    int sum=114513;
    int a[114514]={};
    cin >> n;
    REP(i,n){
        cin >> a[i];
        if(a[am]<=a[i]){
            am=i;
        }
    }
    REP(i,n){
        if(i==am)continue;
        if(abs(a[am]/2-a[sum])>abs(a[am]/2-a[i])){
            sum=i;
        }
    }
    cout << a[am] << " " << a[sum] << endl;
	return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;
#define rep(i,n) for(ll i=0;i<n;i++)
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define fi first
#define se second

template<typename T> inline bool chmax(T &a, T b){if(a<b){a=b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if(a>b){a=b;return true;}return false;}
template<typename T> ostream& operator<<(ostream& s,const complex<T>& d) {return s<<"("<<d.real()<<", "<<d.imag()<< ")";}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const pair<T1,T2>& d) {return s<<"("<<d.first<<", "<<d.second<<")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& d){int len=d.size();rep(i,len){s<<d[i];if(i<len-1) s<<" ";}return s;}
template<typename T> ostream& operator<<(ostream& s,const vector<vector<T>>& d){int len=d.size();rep(i,len){s<<d[i]<<endl;}return s;}
template<typename T> ostream& operator<<(ostream& s,const set<T>& v){s<<"{ ";for(auto itr=v.begin();itr!=v.end();++itr) {if (itr!=v.begin()) {s<< ", ";}s<<(*itr);}s<<" }";return s;}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const map<T1,T2>& m){s<<"{"<<endl;for(auto itr=m.begin();itr!=m.end();++itr){s<<" "<<(*itr).first<<" : "<<(*itr).second<<endl;}s<<"}"<<endl;return s;}

const ll mod=1e9+7;
const ll inf=1e17;
const int INF=1e9;
const double PI=acos(-1);
const double EPS=1e-10;

//約数列挙
template <class T>
vector<T> divisor(T x){
	vector<T> res;
	for(T i=1;i*i<=x;i++){
		if(x%i==0){
			res.push_back(i);
			if(i!=x/i){
				res.push_back(x/i);
			}
		}
	}
	return res;
}

int main(){
	cin.tie(0);ios::sync_with_stdio(false);
	ll n;
	cin>>n;
	vector<ll> ret2=divisor(n);
	ll ans=0;
	//cout<<ret2<<endl;
	for(auto itr:ret2){
		ll k=itr;
		if(k<2) continue;
		//cout<<k<<endl;
		ll now=1;
		ll cnt=0;
		ll nn=n;
		while(nn){
			nn/=k;
			cnt++;
		}
		ll flag=0;
		while(now<=n){
			//cout<<now<<endl;
			flag++;
			if(n%now!=0) break;
			ll y=n/now;
			y--;
			if(y>=0 && y%k==0){
				ll l=y/k;
				if(l>=0){
					//cout<<k<<' '<<now<<endl;
					ans++;
				}
			}
			if(flag<cnt) now*=k;
			else break;
		}
		//cout<<endl;
	}
	vector<ll> ret3=divisor(n-1);
	ans+=(ll)ret3.size()-1;
	cout<<ans<<endl;
}

Measured memory_bytes: 384
a,b,c = map(int,input().split())
# print(a,b,c);
res1 = c-a-b
if res1 < 0 :
    print("No")
else:
    res2 = 4*a*b
    res1 = res1*res1
    if res2 < res1:
        print("Yes")
    else :
        print("No")


Measured memory_bytes: 2940
#include "bits/stdc++.h"
using namespace std;
#define Rep(i,n) for(int i=0;i<n;i++)
#define For(i,n1,n2) for(int i=n1;i<n2;i++)
#define REP(i,n) for(ll i=0;i<n;i++)
#define RREP(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,n1,n2) for(ll i=n1;i<n2;i++)
#define put(a) cout<<a<<"\n"
#define all(a)  (a).begin(),(a).end()
#define SORT(a) sort((a).begin(),(a).end())
#define oorret 0
#define oor(x) [&](){try{x;} catch(const out_of_range& oor){return oorret;} return x;}()
typedef long long ll;
typedef pair<int, int> P;
template<typename T1,typename T2> inline bool chmin(T1 &a,T2 b){if(a>b){a=b;return 1;}return 0;}
template<typename T1,typename T2> inline bool chmax(T1 &a,T2 b){if(a<b){a=b;return 1;}return 0;}

int main(){
    int a,b,c;
    cin >> a >> b >> c;
    put(a+b+c-max({a,b,c}));
    return 0;
}


Measured memory_bytes: 256
/*
AizuOnline A0521
change
*/
#include <stdio.h>
int change_maisuu(int price)
{
  int ret;

  /*  printf("p=%d\n",price); */

  ret = ((price>=500)?1:0);
  ret  += (price % 500)/100;
  ret  += ((price % 100)>=50)?1:0;
  ret  += (price % 50)/10;
  ret  += ((price % 10)>=5)?1:0;
  ret  += (price % 5);


  /*printf("r=%d\n",ret);*/

  return(ret);
}

main()
{
  int c;

  c=2;

  while(EOF != scanf("%d",&c) && c )
    {
      printf("%d\n",change_maisuu(1000-c));
    }
return(0);
}

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

namespace ABC087A
{
    class Program
    {
        static void Main(string[] args)
        {
            int x, a, b, c;

            x = int.Parse(Console.ReadLine());
            a = int.Parse(Console.ReadLine());
            b = int.Parse(Console.ReadLine());

            c = (x - a) % b;

            Console.WriteLine(c);

            Console.ReadKey();
        }
    }
}


Measured memory_bytes: 13140
function main(input){
    const args = input.split(" ");
    const a = parseInt(args[0], 10);
    const b = parseInt(args[1], 10);
    if(a * b % 2) console.log("Odd");
    else console.log("Even");
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'))

Measured memory_bytes: 21064
import itertools

N=int(input())
P=(input().split())
Q=(input().split())
p=tuple(P)
q=tuple(Q)

seq=[]
for j in range(1,N+1):
  seq.append(str(j))
l=[]
for k in itertools.permutations(seq, N):
  l.append(k)

c1=0
c2=0
a=0
b=0
for m in range(len(l)):
  c1+=1
  c2+=1
  if p == l[m]:
    a=c1
  if q == l[m]:
    b=c2

print(abs(a-b))

Measured memory_bytes: 7924
#coding:utf-8
import sys
sys.setrecursionlimit(10**6)
write = sys.stdout.write
dbg = lambda *something : print(*something) if DEBUG else 0
DEBUG = False
def main(given = sys.stdin.readline):
    input = lambda : given().rstrip()
    LMIIS = lambda : list(map(int,input().split()))
    II = lambda : int(input())
    XLMIIS = lambda x : [LMIIS() for _ in range(x)]

    A,B,K = LMIIS()
    if A >= K :
        A -= K
        K = 0
    else:
        K -= A
        A = 0
        
    B = B-K if B >= K else 0
    print(A,B)



if __name__ == '__main__':
    main()

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

int main(){
    int N;
    int ans =0;
    cin >> N;
    vector<vector<int>>vec(100010,vector<int>(3));
    for(int i=0; i<N;i++){
        for(int j=0; j<3; j++){
            cin >> vec.at(i).at(j);
        }
     }
    

    vector<vector<int>>newvec(100010,vector<int>(3,0));
    for(int i=0;i<N;i++){
        for(int j=0;j<3;j++){
            for(int z=0; z<3; z++){
                if(j== z)continue;
                newvec.at(i+1).at(z) = max(newvec.at(i+1).at(z),newvec.at(i).at(j) + vec.at(i).at(z));
            }
        }
    }
    
   
    for(int z=0; z<3;z++){
        ans = max(ans,newvec.at(N).at(z));
    }
    cout << ans << endl;
}   
    

Measured memory_bytes: 14352
import sys
sys.setrecursionlimit(10 ** 9)
# input = sys.stdin.readline    ####
def int1(x): return int(x) - 1
def II(): return int(input())
def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())
def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def MS(): return input().split()
def LS(): return list(input())
def LLS(rows_number): return [LS() for _ in range(rows_number)]
def printlist(lst, k=' '): print(k.join(list(map(str, lst))))
INF = float('inf')
from math import ceil, floor, log2
# from collections import deque
# from itertools import combinations as comb, combinations_with_replacement as comb_w, accumulate, product, permutations
# from heapq import heapify, heappop, heappush
# import numpy as np
# from numpy import cumsum  # accumulate

def solve():
    A, V = MI()
    B, W = MI()
    T = II()

    if A == B:
        print('YES')
        return

    sa = abs(A - B)
    o = V - W

    if o <= 0:
        print('NO')
        return

    r = ceil(sa / o)
    if r <= T:
        print('YES')
    else:
        print('NO')


if __name__ == '__main__':
    solve()


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

int main(){
    using namespace std;
    unsigned long N;
    cin >> N;
    unsigned long max{0}, ans{0};
    for(unsigned long i = 0, h; i < N; ++i){
        cin >> h;
        if(max <= h){
            ++ans;
            max = h;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
<?php

   $N = fgets(STDIN);

    $KU = [1, 2, 3, 4, 5, 6, 7, 8, 9];

     $KU2 = [1, 2, 3, 4, 5, 6, 7, 8, 9];

    $jud = "No";

   for ($i = 0; $i < 9; $i++) {

             for ($j = 0; $j < 9; $j++) {

                       $res = $KU[$i] * $KU2[$j];

                              if ($N == $res) {
                                   $jud = "Yes";
                                  break;
                        }
               }
              

      }

echo $jud;

?>

Measured memory_bytes: 4856
function main(input){
  var int = Number.parseInt(input);
  var times = Math.ceil(int/4);
  var sum = 0;
  var result = 'No';
  
  CakeDonut:
  for(let i=0;i<=times;i++){
    for(let j=0;j<=times;j++){
      sum = 4*i+7*j;
      if(sum > int){break;}
      else if(sum === int){
        result = 'Yes';
        break CakeDonut;
      }
    }
  }
  console.log(result);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 29520
#include<bits/stdc++.h>
using namespace std;
    static const double pi = 3.141592653589793;
 typedef pair<int64_t,int64_t> P;
#define rep(i, n) for (int i = 0; i < (n); i++)

int main() {
int64_t a;
  cin>>a;
  vector<string>music(a);
  vector<int64_t>time(a);
  rep(i,a) cin>>music.at(i)>>time.at(i);
  string b;
  cin>>b;
  int x=0;
  int64_t y=0;
  rep(i,a){
  if(x==1) y+=time.at(i);
    if(music.at(i)==b) x=1;
  
  }
  
  cout<<y;
  
  
  
}

Measured memory_bytes: 256
from itertools import combinations_with_replacement
n=int(input())
L=list(map(int,input().split()))
A=[i for i in range(n)]

cnt=0
for a,b,c in combinations_with_replacement(A,3):
    i,j,k=sorted([L[a],L[b],L[c]])
    if i+j>k and i!=j and j!=k and k!=i:
        cnt +=1
print(cnt)

Measured memory_bytes: 69040
N,M = map(int,input().split())
L,R = 1,N
for i in range(M):
  Lx,Rx = map(int,input().split())
  if Lx>L:L=Lx
  if Rx<R:R=Rx
S = R-L+1
print(0 if S<0 else N if S>N else S)

Measured memory_bytes: 3060
#include <stdio.h>
int main()
{
	int a, b;
	scanf("%d %d", &a, &b);
	if(b%a == 0)
	{
		printf("%d", a+b);
	} else
	{
		printf("%d", b-a);
	}
	
	
	return 0;
	
}

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

int main() {
  ll n,a,b;
  cin>>n>>a>>b;
  if(n==1&&a!=b){
    cout<<0<<endl;
    return 0;
  }
  if(a>b){
    cout<<0<<endl;
    return 0;
  }
  if(n==2){
    cout<<a+b<<endl;
    return 0;
  }
  ll min_s,max_s;
  min_s=a*(n-1)+b;
  max_s=b*(n-1)+a;
  ll ans=max_s-min_s+1;
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
 
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define ll long long
#define int ll
#define forn(i, a, b) for(int i = (a); i <= (b); ++i)
#define forev(i, b, a) for(int i = (b); i >= (a); --i)
#define VAR(v, i) __typeof( i) v=(i)
#define forit(i, c) for(VAR(i, (c).begin()); i != (c).end(); ++i)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define file(s) freopen(s".in","r",stdin); freopen(s".out","w",stdout);
 
using namespace std;
 
const int maxn = (int)1e6 + 100;
const int mod = (int)1e9 + 7;
 
#define inf mod
 
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;   
typedef vector<ll> Vll;               
typedef vector<pair<int, int> > vpii;
typedef vector<pair<ll, ll> > vpll;

int n, a[maxn];
bool found;
char s[maxn];
int C(int n, int k){
	return ((n & k) == k);
}
bool get(){
	bool ans = 0;
	forn(i, 1, n)	
		if(C(n - 1, i - 1))
			ans ^= (a[i] & 1);
	return ans;
}
main () {
	scanf("%d\n%s", &n, s + 1);
	forn(i, 1, n){
		a[i] = s[i] - '0' - 1;
		found |= (a[i] == 1);
	}
	if(!found){
		forn(i, 1, n)
			a[i] >>= 1;
		printf("%d\n", 2 * get());
	}else{
		printf("%d\n", get());
	}
}

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

int main(){
  int N;
  cin>>N;
  int a[N][3];
  for(int i=0;i<N;i++)for(int j=0;j<3;j++)cin>>a[i][j];

  int h[3][N+1];
  h[0][0] = h[1][0]=h[2][0]=0;
  for (int i=1; i<=N; i++){
      h[0][i]=max(h[1][i-1], h[2][i-1])+a[i-1][0];
      h[1][i]=max(h[0][i-1], h[2][i-1])+a[i-1][1];
      h[2][i]=max(h[0][i-1], h[1][i-1])+a[i-1][2];
  }  


  cout << max(max(h[0][N], h[1][N]), h[2][N]);
  return 0;
}

Measured memory_bytes: 2560
#include <iostream>
#include <string>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <cmath>
#define rep(i,n) for(int i=0; i<n; i++)
using namespace std;
int main()
{
	int d, n, ans;
	cin >> d >> n;
	if(n == 100) ans = (n+1) * pow(100, d);
	else ans = n*pow(100, d);
	cout << ans;
	return 0;
}

Measured memory_bytes: 256
#pragma comment(linker, "/STACK:1024000000")
#define _CRT_SECURE_NO_WARNINGS
#undef NDEBUG
//#include "testlib.h"
#include <cstdio>
#include <cassert>
#include <algorithm>
#include <iostream>
#include <memory.h>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <bitset>
#include <deque>
#include <ctime>
#include <stack>
#include <queue>
#include <fstream>
#include <sstream>
#include <functional>
/*#ifndef room111
#include <sys/resource.h>
#endif*/
#include <unordered_set>
#include <unordered_map>
#include <array>
using namespace std;
#define FILENAME ""
#define mp make_pair
#define all(a) a.begin(), a.end()
typedef long long li;
typedef long double ld;
void solve(bool);
void precalc();
clock_t start;
//int timer = 1;

int testNumber = 1;

bool todo = true;

bool stress = false;

int main() {
#ifdef room111
	freopen("in.txt", "r", stdin);
	//freopen("out.txt", "w", stdout);
#else
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	//freopen(FILENAME".in", "r", stdin);
	//freopen(FILENAME ".out", "w", stdout);
#endif
	start = clock();
	int t = 1;
	cout.sync_with_stdio(0);
	cin.tie(0);
	precalc();
	cout.precision(10);
	cout << fixed;
	/*#ifndef room111
	const rlim_t kStackSize = 1024L * 1024L * 1024L;   // min stack size = 64 Mb
	struct rlimit rl;
	int result;

	result = getrlimit(RLIMIT_STACK, &rl);
	if (result == 0)
	{
	if (rl.rlim_cur < kStackSize)
	{
	rl.rlim_cur = kStackSize;
	result = setrlimit(RLIMIT_STACK, &rl);
	if (result != 0)
	{
	fprintf(stderr, "setrlimit returned result = %d\n", result);
	}
	}
	}
	#endif*/

	//cin >> t;
	int testNum = 1;
	while (t--) {
		//cerr << testNum << endl;
		//cout << "Case #" << testNum++ << ": ";
		solve(true);
		++testNumber;
		//++timer;
	}
#ifdef room1111
	while (true)
		solve(false);
#endif

#ifdef room111
	cerr << "\n\n" << (clock() - start) / 1.0 / CLOCKS_PER_SEC << "\n\n";
#endif

	return 0;
}

//BE CAREFUL: IS INT REALLY INT?

//#define int li

template<typename T>
T binpow(T q, T w, T mod) {
	if (!w)
		return 1 % mod;
	if (w & 1)
		return q * 1LL * binpow(q, w - 1, mod) % mod;
	return binpow(q * 1LL * q % mod, w / 2, mod);
}

template<typename T>
T gcd(T q, T w) {
	while (w) {
		q %= w;
		swap(q, w);
	}
	return q;
}
template<typename T>
T lcm(T q, T w) {
	return q / gcd(q, w) * w;
}
void precalc() {}

template<typename T>
void relax(T& cur, T val) {
	cur = min(cur, val);
}

//#define int li

//const int mod = 1000000007;

void solve(bool read) {
	int n;
	cin >> n;
	int sign = 0;
	int last;
	cin >> last;
	int ans = 1;
	for (int i = 1; i < n; ++i) {
		int cur;
		cin >> cur;
		int new_sign = (cur > last) ? 1 : ((cur == last) ? 0 : -1);
		if (sign != 0) {
			if (new_sign != 0 && new_sign != sign) {
				sign = 0;
				last = cur;
				++ans;
				continue;
			}
		}
		else {
			sign = new_sign;
		}
		last = cur;
	}

	cout << ans << "\n";

}

Measured memory_bytes: 896
#include<bits/stdc++.h>
using namespace std;
string s;
int main()
{
	cin>>s;
	int i,countnum=0;
	for(i=0;i<s.size();i++)
	{
		if(s[i]=='C')
		{
			countnum=1;
		}
		if(s[i]=='F' && countnum==1)
		{
			cout<<"Yes"<<endl;
			return 0;
		}
	}
	cout<<"No"<<endl;
	return 0;
 } 

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <string>
#define ll long long
#define vl vector<ll>
#define vvl vector<vector<ll> >
#define vvvl vector<vector<vector<ll> > >
#define vd vector<double>
#define vvd vector<vector<double> >
#define vvvd vector<vector<vector<double> > >
#define mod 1000000007
using namespace std;


int main(void){
    ll n,m; cin>>n>>m;
    vector<bool> isBad(n+1,0);
    for(int i=0;i<m;++i){
        ll a; cin>>a;
        isBad[a] = 1;
    }
    vl d(n+2,0);
    d[1] = 1;
    for(int i=2;i<n+2;++i){
        if(isBad[i-1]) continue;
        d[i] = d[i-1]+d[i-2];
        d[i] %= mod;
    }
    cout<<d[n+1]<<endl;
}


Measured memory_bytes: 1024
n,m,x,y = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
a.append(x)
b.append(y)
a =sorted(a)
b =sorted(b)
if a[-1]<b[0]:
    print('No War')
else:
    print('War')

Measured memory_bytes: 61896
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define rep(i,b) FOR(i,0,b)
#define INF 1e9+10
#define dump(x) cerr<<#x<<"="<<x<<endl
#define all(a) (a).begin(),(a).end()
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<vii> viii;
typedef pair<int,int> P;
template <class T> void chmin(T & a, T const & b) { if (b < a) a = b; }
template <typename T>
string to_string(const T &n){ostringstream stm;stm << n;return stm.str();}
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
using ll = long long;
const ll mod = LLONG_MAX;

int N,k;
ll h[112345];
ll dp[112345];
signed main(){  
    cin>>N>>k;

    rep(i,N)cin>>h[i];

    rep(i,N)dp[i]=INF;

    dp[1]=abs(h[1]-h[0]);
    dp[0]=0;


    for(int i=0;i<N;i++){
        for(int step=k;step>=0;step--){
            dp[i+step]=min(dp[i]+abs(h[i+step]-h[i]),dp[i+step]);
        }
    }
    






    cout<<dp[N-1]<<endl;

    

 
}

Measured memory_bytes: 1792
#include<stdio.h>
int main()
{
int N,count=0;
scanf("%d",&N);
while(N>0)
  {
   if(N%10==7)
   {
   count=count+1;  
   break;
   }
   N=N/10;
  }
if(count!=0)
printf("Yes\n");
else
printf("No\n");
return 0;
}

Measured memory_bytes: 1644
#include<bits/stdc++.h>
#define endl "\n"
#ifdef ONLINE_JUDGE
#define DEBUG(x)
#else
#define DEBUG(x) cout<<#x<<" : {"<<x<<"}"<<endl;
#endif
using namespace std;
typedef long long int lli;
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n;
	cin>>n;
	vector<lli> arr(n);
	vector<lli> xors;
	for(int i=0; i<n; ++i)
		cin>>arr[i];
	for(int i=0; i<n; i+=2){
		xors.push_back(arr[i] ^ arr[i+1]);
	}
	lli total_xor = 0;
	for(auto&x : xors)
		total_xor ^= x;
	for(int i=0; i<n; ++i){
		cout<<(total_xor ^ arr[i])<<" ";
	}
	cout<<endl;
    return 0;
}


Measured memory_bytes: 5816
#include <bits/stdc++.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define RS(X) scanf("%s", (X))
#define CASET int ___T, case_n = 1; scanf("%d ", &___T); while (___T-- > 0)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second
#define RF(x) freopen(x,"r",stdin)
#define WF(x) freopen(x,"w",stdout)
typedef long long LL;
using namespace std;
typedef pair<LL,LL> PLL;
typedef pair<int,int> PII;
const LL MOD = (LL)1e9+7;
const int MAXN = 1e5+5;
const LL INF = 1LL<<30;
const long double eps = 1e-10;
const double PI=3.1415926535897932;

char s[800][800];
int dist1[801][801];
int dist2[801][801];
queue<PII> q1;
int dx[4]={1,-1,0,0},dy[4]={0,0,-1,1};

int main(){
	DRIII(h,w,k);
	MS1(dist1);
	REP(i,h){
		RS(s[i]);
		REP(j,w){
			if(s[i][j]=='S'){
				dist1[i][j]=0;
				q1.push(MP(i,j));
			}
		}
	}
	int minz=650000;
	while(SZ(q1)){
		PII cur=q1.front();q1.pop();
		int x=cur.F,y=cur.S;
		if(x==0||y==0||x==h-1||y==w-1){
			minz=min(minz,dist1[x][y]);
		}
		REP(i,4){
			int nx=cur.F+dx[i],ny=cur.S+dy[i];
			if(nx<0||ny<0||nx>=h||ny>=w)continue;
			if(s[nx][ny]=='#')continue;
			if(dist1[nx][ny]!=-1)continue;
			dist1[nx][ny]=dist1[x][y]+1;
			q1.push(MP(nx,ny));
		}
	}
	if(minz<=k){
		printf("1");return 0;
	}
	MS1(dist2);
	REP(i,h){
		REP(j,w){
			if(dist1[i][j]!=-1&&dist1[i][j]<=k){
				dist2[i][j]=0;
				q1.push(MP(i,j));
			}
		}
	}
	minz=650000;
	while(SZ(q1)){
		PII cur=q1.front();q1.pop();
		int x=cur.F,y=cur.S;
		if(x==0||y==0||x==h-1||y==w-1){
			minz=min(minz,dist2[x][y]);break;
		}
		REP(i,4){
			int nx=cur.F+dx[i],ny=cur.S+dy[i];
			if(nx<0||ny<0||nx>=h||ny>=w)continue;
			if(dist2[nx][ny]!=-1)continue;
			dist2[nx][ny]=dist2[x][y]+1;
			q1.push(MP(nx,ny));
		}
	}
	printf("%d",(minz+k-1)/k+1);
}


Measured memory_bytes: 6144
mod io{
    use std::io::*;
    pub fn read<T: ::std::str::FromStr>()->T{
        let stdin=stdin();
        let ret=stdin.lock().bytes().map(|c|c.unwrap()as char)
        .skip_while(|c|c.is_whitespace())
        .take_while(|c|!c.is_whitespace())
        .collect::<String>().parse().ok().unwrap();
        ret
    }
}
use io::read;
use std::cmp::max;
fn main(){
    let a=read::<usize>();
    let b=read::<usize>();
    let c=read::<usize>();
    println!("{}",a+b+c+9*max(a,max(b,c)))
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0;i<n;i++)
#define all(cont) cont.begin(), cont.end()
#define unique(a)  sort(all(a)) , (a).erase(unique((a).begin(), (a).end()),(a).end())
#define rall(cont) cont.rbegin(), cont.rend()
#define sz(x) (int)(x).size()
#define fastio          ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define PB push_back
#define endl "\n"
#define f first
#define s second
#define mset(m,v) memset(m,v,sizeof(m))
#define mod 1000000007
const int N = 2e5 + 5, INF = 1E9 + 7;
#define PI acos(-1.0)
long double EPS = 1e-9;
typedef long long ll;
#define int long long
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<pair<int, int>> vpii;
#define pqll_max priority_queue<ll> // max heap. push(),pop(),top(),size(),empty()
#define pqll_min priority_queue<ll,vector<ll>,greater<ll> >
#define lb(v,val)   lower_bound(v.begin(),v.end(),val) //first equal to or lower than [------------
#define ub(v,val)   upper_bound(v.begin(),v.end(),val) //first greater than ------------)
#define bs(v,x) binary_search(v.begin(),v.end(),x)
inline ll add(ll x, ll y) { x += y; if (x >= mod) x -= mod; return x; }
inline ll sub(int x, int y) { x -= y; if (x < 0) x += mod; return x; }
inline ll mul(ll x, ll y) { return (x%mod * 1ll * y%mod) % mod; }
inline ll pwr(ll a, ll b) { ll x = 1 % mod; while (b) { if (b & 1) x = mul(x, a); a = mul(a, a); b >>= 1; }return x % mod; }
inline ll inv(ll a) { return pwr(a, mod - 2) % mod; }
ll gcd(ll a, ll b) { if (!a)return b % mod; return gcd(b%a, a) % mod; }
#define debug(x) cout << #x << " = " << x << endl;
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
	cout << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
	const char* comma = strchr(names + 1, ','); cout.write(names, comma - names) << " : " << arg1 << " | "; __f(comma + 1, args...);
}
#define in(container) for (auto &it : container) cin>>it;
#define out(container) for (auto it : container) cout << it << " "; cout << endl;
void solve() {
	char a;
	cin >> a;
	if (a >= 'A' && a <= 'Z') {
		cout << 'A' << endl;
	}
	else cout << 'a' << endl;
}
signed main()
{
	fastio;
	//cout<<fixed<<setprecision(15);
	//clock_t begin = clock();
	int tc;
	tc = 1;
	//cin >> tc;
	while (tc--) {
		solve();
	}
	//clock_t end = clock();double elapsed_secs = double(end - begin) / CLOCKS_PER_SEC;cerr << elapsed_secs;
}


//Error?
// clear lists for every test case
// print new line for each tc
// check for int or ll
// check if problem can be solved without any heavy DS like priority_queue or map



Measured memory_bytes: 3600
import java.util.*;
import java.lang.*;
import java.math.*;
import java.io.*;
import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;

// Prime Caves
// 2013/08/14
public class Main{
	Scanner sc=new Scanner(System.in);

	int m, start;

	void run(){
		for(;;){
			m=sc.nextInt();
			start=sc.nextInt();
			if((m|start)==0){
				break;
			}
			solve();
		}
	}

	int[] isPrime;

	void solve(){
		int M=(int)1e6+100;
		if(isPrime==null){
			isPrime=new int[M];
			fill(isPrime, 1);
			isPrime[0]=isPrime[1]=0;
			for(int j=0; j<M; j++){
				if(isPrime[j]==0){
					continue;
				}
				for(int i=j*2; i<M; i+=j){
					isPrime[i]=0;
				}
			}
		}
		int n=1900;
		int[][] dp=new int[n][n], index=new int[n][n];
		for(int i=0; i<n; i++){
			fill(dp[i], -1);
		}
		int[] _=spiralN2XY(start);
		int x0=_[0]-n/2, y0=_[1];
		dp[0][n/2]=isPrime[start];
		index[0][n/2]=start*isPrime[start];
		for(int j=0; j<n; j++){
			for(int i=0; i<n; i++){
				if(dp[j][i]<0){
					continue;
				}
				for(int k=-1; k<=1; k++){
					if(j+1>=n||i+k<0||i+k>=n){
						continue;
					}
					int val=spiralXY2N(x0+i+k, y0+j+1);
					if(val>m){
						continue;
					}
					if(dp[j][i]+isPrime[val]>dp[j+1][i+k]){
						dp[j+1][i+k]=dp[j][i]+isPrime[val];
						index[j+1][i+k]=isPrime[val]==1?val:index[j][i];
					}
				}
			}
		}
		int maxVal=0, maxIndex=0;
		for(int j=0; j<n; j++){
			for(int i=0; i<n; i++){
				if(dp[j][i]>maxVal||(dp[j][i]==maxVal&&index[j][i]>maxIndex)){
					maxVal=dp[j][i];
					maxIndex=index[j][i];
				}
			}
		}
		println(maxVal+" "+maxIndex);
	}

	int[] spiralN2XY(int n){
		int m=(int)sqrt(n-1)+1;
		int x=m/2-min(m*m-n, m-1), y=m/2-max(m*m-m+1-n, 0);
		if(m%2==0){
			x=-x+1;
			y=-y;
		}
		return new int[]{x, y};
	}

	int spiralXY2N(int x, int y){
		int d=max(abs(x), abs(y));
		if(y>=x)
			return (2*d+1)*(2*d+1)-abs(d-x)-abs(d-y);
		else
			return (2*d)*(2*d)-abs(-d+1-x)-abs(-d-y);
	}

	void println(String s){
		System.out.println(s);
	}

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

Measured memory_bytes: 512944
#include<iostream>
#include<cstring>
#include<string>
using namespace std;
int main(){
    int n;
    string s;
    cin>>n;cin.ignore();

    while(n--){
        getline(cin,s);
        char a[1000];
        strcpy(a,s.c_str());
        int len=strlen(a);
        for(int i=0;i<len-6;i++){
            if(!strncmp(a+i,"Hoshino",7))strncpy(a+i,"Hoshina",7);
        }
        cout<<a<<endl;
    }
    return 0;
}

Measured memory_bytes: 1208
#include <iostream>
using namespace std;
bool ans;
int b[10];
void ins(int i,int l,int r)
{
    if(i==10)ans=true;
    if(b[i]>l){
        l=b[i];
        ins(i+1,l,r);
    }
    if(b[i]>r){
        r=b[i];
        ins(i+1,l,r);
    }
}
int main()
{
    int n;
    cin>>n;
    for(int i=0;i<n;++i){
        for(int j=0;j<10;++j)cin>>b[j];
        ans=false;
        ins(0,0,0);
        if(ans)
            cout<<"YES"<<endl;
        else
            cout<<"NO"<<endl;
    }
    return 0;
}

Measured memory_bytes: 1152