akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cmath>
#include <functional>
#include <numeric>
#include <iomanip>
#define fi first
#define se second
#define fcout(n) cout<<fixed<<setprecision((n))
#define cinl(str) getline(cin,(str))
using namespace std;
bool value(int y,int x,int R,int C){return 0<=y&&y<R&&0<=x&&x<C;}
typedef pair<int,int> pii;
typedef long long ll;
typedef vector<int> vi;
typedef vector<long long > vll;
typedef vector< vi > vvi;
double pie=acos(-1);
int INF=10000009;
int dx[4] = { 0,-1,0,1 };
int dy[4] = { -1,0,1,0 };
double d[15];
int main() {
	double l[15],v[5];
	char c[15];
	double x=0.0,y;
	int ans;
	while(true){
		cin>>l[0]>>c[0]>>l[1]>>c[1]>>l[2]>>c[2]>>l[3];
		cin>>c[3]>>l[4]>>c[4]>>l[5]>>c[5]>>l[6]>>c[6];
		cin>>l[7]>>c[7]>>l[8]>>c[8]>>l[9]>>c[9]>>v[0];
		cin>>c[10]>>v[1];
		if (cin.eof())break;
		x=0.0;
		for(int i=0;i<=9;i++){
			x+=l[i];
		}
		for(int i=1;i<=10;i++){
			d[i]=0.0;
		}
		double t;
		t=x/(v[0]+v[1]);
		y=v[0]*t;
		for(int i=1;i<=10;i++){
			for(int j=0;j<i;j++){
				d[i]+=l[j];
			}
		}
		for(int i=1;i<=10;i++){
			if(y<=d[i]){
				ans=i;
				break;
			}
		}
		cout<<ans<<endl;
	}
}

Measured memory_bytes: 3156
#include<iostream>
#include<string>
#include<cstdlib>
#include<set>
using namespace std;

int main(){
  string data;
  multiset<int> nums1,nums2;
  while(getline(cin,data,'\n')){
    if (data=="")break;
    nums1.insert(atoi(data.substr(0,data.find(",")).c_str()));
  }
  while(getline(cin,data,'\n')){
    nums2.insert(atoi(data.substr(0,data.find(",")).c_str()));
  }
  set<int>::iterator it;
  int a;
  for(it=nums1.begin();it!=nums1.end();){
    if(nums2.find(*it)!=nums2.end()){
      cout<<*it<<" "<<nums1.count(*it)+nums2.count(*it)<<endl;
    }
    a = *it;
    it++;
    while(a==*it)it++;
  }
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b;
  cin >> a >> b;
  int c;
  int d = 0;
  int e = 0;
  c = (b/100)-(a/100)-1;
  int f;
  if((a%100) <= (a%10000/1000*10+a/10000))
    d = 1;
  if((b%100) >= (b%10000/1000*10+b/10000))
    e = 1;
  cout << c+d+e << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
int main() {
  ll n, l;
  cin >> n>> l;
  ll a[n];
  ll m=10000;
  ll s=0;
  rep(i, n) {
    a[i]=l+i;
    s+=a[i];
  }
  
  rep(i, n) {
    m=min(m, max(a[i], -a[i]));
  }
  
  if(a[n-1]*a[0]<=0) cout<<s;
  else{
    if(a[0]>0) cout<<s-m;
    else cout<<s+m;
  }
}


Measured memory_bytes: 3576
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        DoubleFactorial solver = new DoubleFactorial();
        solver.solve(1, in, out);
        out.close();
    }

    static class DoubleFactorial {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            long n = in.nextLong();

            if (n % 2 == 1) {
                out.println(0);
                return;
            }

            long result = 0;
            n /= 2;
            while (0 < n) {
                n = n / 5;
                result += n;
            }
            out.println(result);

        }

    }
}



Measured memory_bytes: 35772
#include <iostream>
#include <stdlib.h>
using namespace std;

long _change(long n);
long change(long n);


int main(void){
  long n;
  cin>>n;
  cout<<change(n)<<endl;
  return 0;
}

long _change(long n){
  long retval=0;
  retval+=n/10;
  n=n%10;
  retval+=n/5;
  n=n%5;
  retval+=n;
  return retval;
}

long change(long n){
  long retval=10000000010;
  long count=0;
  while(n>=0){
    retval=min(retval,_change(n)+count);
    n-=25;
    count++;
  }
  return retval;
}



Measured memory_bytes: 3100
#include<bits/stdc++.h>
	using namespace std;
	#define ll long long int 
	#define ii pair<int ,int >
	#define pb push_back
	#define range 
	#define vi vector <int >
	#define mod 1000000007
	#define eps 1e-9
	#define fi first
	#define se second
	#define _ <<" "<<
	#define forn(x,	n) for(long long int x = 0; x < n ;++ x) 
	#define forn2(x, n) for(long long int x = 1; x < n ;++ x) 
	#define forn1(x,n) for(int x = 1; x <= n ;++ x)
	#define IOS ios_base::sync_with_stdio();cin.tie(0);cout.tie(0);
	#define MOD 1000000007
string A[10000];
int dp[1001][1001];
int grid(int i,int j,int h,int w)
{
	if(i>=h || j>=w) { return 0;}
	if(A[i][j]=='#') return dp[i][j]=0;
	if(dp[i][j]!=-1) return dp[i][j];
	if(i==h-1 && j==w-1) return 1;
	return dp[i][j]=(grid(i+1,j,h,w)%MOD+grid(i,j+1,h,w)%MOD)%MOD;
}
int main()
{ 	int h,w;
//freopen ("test.txt","r",stdin);
cin>>h>>w;
forn(i,h){ cin>>A[i];}
forn(i,h){ forn(j,w){ dp[i][j]=-1;} }
cout<<grid(0,0,h,w)<<endl;

return 0;

}

Measured memory_bytes: 5504
#include <cstdio>

using namespace std;

typedef long long ll;

ll f[60][2];

int main(int argc,char * argv[])
{
	int n,p;
	scanf("%d%d",&n,&p);
	f[0][0] = 1;
	for (int i = 1;i <= n;++i)
	{
		int x;
		scanf("%d",&x);
		x %= 2;
		f[i][0] = f[i-1][0];
		f[i][1] = f[i-1][1];
		if (x == 0)
		{
			f[i][0] += f[i-1][0];
			f[i][1] += f[i-1][1];
		}
		else
		{
			f[i][1] += f[i-1][0];
			f[i][0] += f[i-1][1];
		}
	}
	printf("%lld\n",f[n][p]);
	return 0;
}


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

using namespace std;

#define int long long

int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    int n, m;
    cin >> n >> m;
    set<pair<int, int>> s;
    int ans = 0;
    for (int i = 0; i < n; ++i)
    {
        int x;
        cin >> x;
        s.insert({-x, i});
        ans += x;
    }
    for (int i = 0; i < m; ++i)
    {
        auto el = (*s.begin());
        ans -= (-el.first + 1) / 2;
        s.erase(s.begin());
        s.insert({-(-el.first / 2), el.second});
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 6528
#include                          <bits/stdc++.h>
#define     lli                   unsigned long long int
#define     ll                    long long int
#define     PI                    acos(-1.0)
#define     UNIQUE(V)             (V).erase(unique(ALL(V), (V).end()) //vector/string etc must need to be sorted
#define     timesave              ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define     ALL(V)                (V).begin(), (V).end()
#define     MEMSET(a, val)        memset(a, val, sizeof(a))
#define     FILE_INPUT            freopen("input.txt", "r", stdin) , freopen("output.txt", "w", stdout)
#define     DEBUG                 printf("---- ekhane asi ekhon ---- \n");
#define     SQR(x)                ((x)*(x))
using       namespace             std;


template    <class T> T GCD(T a, T b) { return (b != 0 ? GCD <T> (b, a%b) : a); }
template    <class T> T LCM(T a, T b) { return ((a*b)  / GCD <T> (a, b)); }
template    <class T> T POW(T x, T n) { if(n == 0) return 1; if(n&1) return x*POW(x, n-1);  else return SQR(POW(x, n/2));}

long long   Bigmod(long long base, long long power, long long MOD) {long long ret = 1; while(power) {if(power & 1) ret = (ret*base)%MOD; base = (base*base)%MOD; power >>= 1;} return ret;}
bool        isVowel(char ch) {ch = toupper(ch); if(ch == 'A' || ch == 'U' || ch == 'I' || ch == 'O' || ch == 'E') return true; return false;}
long long   ModInverse(long long number, long long MOD) {return Bigmod(number, MOD-2, MOD);}
bool        isConst(char ch) {if(isalpha(ch) && !isVowel(ch)) return true; return false;}
int         toInt(string s)  {int si; stringstream ss(s); ss >> si; return si;}

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


//------------------- Let`s Start ------------------------ //

bool myfunc(pair<char, char> &x, pair<char, char> &y)
{
    if(x.first == y.first || x.second == y.second) return true;
    else return false;
}


int main()
{
    timesave;

    int n;

    cin >> n;

    int a[n+5];

    map<int, int> m;

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

    ll total = 0, k = -1;

    for(int i = 1; i < n; i++){
        if(a[i] == a[i-1]) {a[i] = k; total++; i++; k--;}
    }

    cout << total << endl;



	return 0;
}


Measured memory_bytes: 256
import scala.io.StdIn.readInt

object Main extends App {
  val a = readInt
  val b = readInt
  val c = readInt
  val d = readInt
  val p = readInt
  val x = a*p
  val y = if(p<=c) b else b+d*(p-c)
  val z = if(x>y) y else x
  println(z)
}

Measured memory_bytes: 43820
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<string>
#include<cmath>
#include<vector>
using namespace std;

vector<long int> sieve(long int n){
    long int arr[n+1];
    for(long int i = 0; i <= n;++i){
        arr[i] = 1;
    }
    arr[0] = 0;
    arr[1] = 0;
    long int p= 2;
    while(p <= n){
        if(arr[p]){
            for(long int i = p*2; i <=n; i+=p){
                arr[i] = 0;
            }
        }
        p++;
    }
    vector<long int> ans;
    for(long int i = 2; i < n ; i++){
        if(arr[i]){
            ans.push_back(i);
        }
    }
    return ans;
    }
int main(){
    int k;
    string s;
    cin>>k;
    cin>>s;
    if(s.size() <= k){
        cout<<s<<endl;
    }
    else{
        s.erase(k, s.size()-k);
        cout<<s<<"..."<<endl;
    }
}


Measured memory_bytes: 3636
n,m,c=map(int,input().split())
b=list(map(int,input().split()))
a=[list(map(int,input().split())) for i in range(n)]
ans=0
for i in range(n):
  ct=c
  for j in range(m):
    ct+=a[i][j]*b[j]
  if ct>0:
    ans+=1
print(ans)

Measured memory_bytes: 3064
#include<iostream>
#include<fstream>
#include<math.h>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<chrono>
#include<math.h>

#define FIO ios_base::sync_with_stdio(0);  cin.tie(0);
#define PI 3.14159265358979323846
#define mod 998244353
#define ll long long
#define vll vector<long long>  
#define all(c) c.begin(), c.end()
// Used to traverse in any STL container with iterators
#define tr(container, it) for(typeof(container.begin()) it = container.begin(); it != container.end(); it++)
// Find whether element is present in given container or not
#define present(container, element) (container.find(element) != container.end())
// Finds whether element in present container is present in vector or not
#define cpresent(container, element) (find(all(container),element) != container.end())

using namespace std;
using namespace std::chrono; 


int main(){
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    freopen("error.txt", "w", stderr);
    #endif
    FIO

    int n;
    cin>>n;
    ll arr[n];
    for(int i=0;i<n;i++)cin>>arr[i];
    
    long dp[n][n];
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            if(i==j)dp[i][j] = arr[i];
            else dp[i][j] = 0;
        }
    }
    int j;
    for(int len=2;len<=n;len++){
        for(int i=0;i<=n-len;i++){
            j = i+len-1;
            if(len%2==0)dp[i][j] = min(dp[i+1][j] - arr[i], dp[i][j-1] - arr[j]);
            else dp[i][j] = max(dp[i+1][j] + arr[i], dp[i][j-1] + arr[j]);
        }
    }
    if(n%2 == 0)cout<<(-1)*dp[0][n-1]<<endl;
    else cout<<dp[0][n-1]<<endl;
    
    return 0;
}

Measured memory_bytes: 73460
import java.util.*; 
class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int p = Integer.parseInt(sc.next());
	int q = Integer.parseInt(sc.next());
    int r = Integer.parseInt(sc.next());
	
    System.out.print(Math.min(Math.min(p+q, p+r), q+r));
  }
}
  


Measured memory_bytes: 23636
#include<cstdio>
#include<algorithm>
using namespace std;
int n,m,k,a[200001],b[200001];
int main()
{
	scanf("%d",&n);
	for (int i=1;i<=n;i++)scanf("%d",&a[i]);
	sort(a+1,a+n+1);
	scanf("%d",&m);
	for (int i=1;i<=m;i++)scanf("%d",&b[i]);
	sort(b+1,b+m+1);
	k=1;
	for (int i=1;i<=m;i++,k++)
	{
		while ((k<=n)&&(a[k]!=b[i]))k++;
		if (a[k]!=b[i])
		{
			printf("NO");
			return 0;
		}
	}
	printf("YES");
}

Measured memory_bytes: 1664
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const ll INF = 1ll<<30;
const ll longINF = 1ll<<60;
const ll MOD = 1000000007;
const double EPS = 1e-9;
const bool debug = 0;
//---------------------------------//

int N, Q;
int S[212345], T[212345], X[212345];
int D[212345], sum[212345], ans[212345];

int main() {
	cin >> N >> Q;
	REP(i, N) scanf("%d %d %d", S + i, T + i, X + i);
	REP(i, Q) scanf("%d", D + i);
	
	vector<pii> v;
	REP(i, N) v.push_back(pii(X[i], i));
	sort(ALL(v));
	
	set<pii> ss;
	REP(i, Q) ss.insert(pii(D[i], i));
	
	memset(ans, -1, sizeof(ans));
	REP(i, N) {
		int idx = v[i].se;
		while (!ss.empty()) {
			auto it = ss.lower_bound(pii(S[idx] - X[idx], 0));
			if (it == ss.end()) break;
			int cidx = it->se;
			if (D[cidx] >= T[idx] - X[idx]) break;
			ss.erase(it);
			ans[cidx] = X[idx];
		}
	}
	
	REP(i, Q) printf("%d\n", ans[i]);
	return 0;
}

Measured memory_bytes: 16880
#include<iostream>
#define rep(i,n) for(ll i = 0; i < (n); i++)
using ll = long long;
using namespace std;

int main()
{
    int n, x, t;
    cin >> n >> x >> t;
    if(n < x){
        cout << t << endl;
        return 0;
    }else if(n % x == 0){
        cout << n / x * t << endl;
        return 0;
    }
    cout << (n / x + 1) * t << endl;
    return 0; 
}

Measured memory_bytes: 3632
#include <stdio.h>
int main()
{
	int a, b, d, r;
	double f;
	scanf("%d %d", &a, &b);
	d = a / b;
	r = a % b;
	f = 1.0000*a / b;
	printf("%d %d %f\n", d, r, f);
	return 0;
}

Measured memory_bytes: 2680
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>
#define int long long
#define rep(i, n) for (int i = 0; i < (n); i++)
#define P pair<int, int>
#define sz(x) x.size()
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define V vector<int>
template<class T> inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
template<class T> inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}

using namespace std;
typedef long long ll;
using Graph = vector<vector<int>>;
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}


const long long MOD = 1000000007;
const long long INF = 1LL << 50;

// pair -> vector<pair<int,int>> 
//		   AandB.push_back(make_pair(a[i],b[i]))

V to[200005];
V ans;

void dfs(int v, int p = -1) {
	for (int u : to[v]) {
		if (u == p)continue;
		ans[u] += ans[v]; dfs(u, v);
	}
}

signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n, q; cin >> n >> q;
	rep(i, n - 1) {
		int a, b; cin >> a >> b;
		a--; b--;
		to[a].push_back(b); to[b].push_back(a);
	}
	ans.resize(n);
	rep(i, q) {
		int p, x; cin >> p >> x; p--;
		ans[p] += x;
	}
	dfs(0);
	rep(i, n) {
		cout << ans[i] << endl;
	}
	return 0;
}

Measured memory_bytes: 24320
m, d = map(int, input().split(' '))
res = 0
if d <= 21:
    pass
else:
    for i in range(1, m+1):
        for j in range(22, d+1):
            ten, one = divmod(j, 10)
            if one >= 2 and i == ten*one:
                res = res + 1
                
print(res)  

Measured memory_bytes: 3060
#include <cstdio>
#include <algorithm>
#include <cstring>
using namespace std;

char s[10005];
int state,i,cnt;
bool tmpx[20005],tmpy[20005],*x=tmpx+10000,*y=tmpy+10000;
int v[20005],siz;
int main(){
	int ex,ey; scanf("%s %d %d",s,&ex,&ey);
	int N=strlen(s);
	s[N]='T';
	while(s[i]=='F') i++;
	x[i]=y[0]=1; 
	for(;s[i];i++){
		if(s[i]=='T') {
			siz=0;
			for(int j=-i;j<=i;j++){
				if(!state && x[j]){
					v[siz++]=j-cnt;
					v[siz++]=j+cnt;
					x[j]=0;
				} 
				else if(state && y[j]){
					v[siz++]=j-cnt;
					v[siz++]=j+cnt;
					y[j]=0;
				}
			}
			for(int j=0;j<siz;j++)
				if(!state) x[v[j]]=1;
				else y[v[j]]=1;
			cnt=0;
			state^=1;
		}
		else{
			cnt++;
		}
	}
	if(x[ex] && y[ey]) puts("Yes");
	else puts("No");
}

Measured memory_bytes: 256
import sys
n = int(input())
w = []
for i in range(n):
  word = input()
  if word in w:
    print('No')
    sys.exit()
  w.append(word)
cur = w[0][-1]
for x in w[1:]:
  if cur != x[0]:
    print('No')
    sys.exit()
  cur = x[-1]
print('Yes')

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define _ ios_base::sync_with_stdio(0);cin.tie(0);
#define REP(i,n) for(int i=0;i<(int)(n);i++)

using namespace std;

const int MAX_N=100;
set<int> v[MAX_N];
vector<int> l;
int n;

void solve(){
  int result=-1;
  REP(i,n){
    for(int a:l){
      if(v[i].count(a)==0){goto E;}
    }
    if(result==-1)
      result=i+1;
    else{
      cout<<-1<<endl;
      return;
    }
  E:;
  }
  cout<<result<<endl;
}

int main(){ _;
  int m,k,tmp;
  while(cin>>n,n!=0){
    REP(i,n){
      v[i].clear();
      cin>>m;
      REP(j,m){
	cin>>tmp;
	v[i].insert(tmp);
      }
    }
    l.clear();
    cin>>k;
    REP(i,k){
      cin>>tmp;
      l.push_back(tmp);
    }
    solve();
  }
}

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

vector<pair<long long, long long> > prime_factorize(long long N) {
    vector<pair<long long, long long> > res;
    for (long long a = 2; a * a <= N; ++a) {
        if (N % a != 0) continue;
        long long ex = 0;
        while (N % a == 0) {
            ++ex;
            N /= a;
        }
        res.push_back({a, ex});
    }
    if (N != 1) res.push_back({N, 1});
    return res;
}

int main() {
    long long N;
    cin >> N;
    const auto &pf = prime_factorize(N);
    long long res = N;
    for (auto p : pf) {
        res *= (p.first - 1);
        res /= p.first;
    }
    cout << res << endl;
}


Measured memory_bytes: 3136
#include <iostream>
using namespace std;
int main(void){
    string a;
    cin>>a;
    if(a[6]=='4' or a[6]=='3' or a[6]=='2' or a[6]=='1'){
        if(a[5]=='1'){
            cout<<"TBD"<<endl;
        }
        else{
        cout<<"Heisei"<<endl;}
    }
    else {
        cout<<"TBD"<<endl;
    }
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
string s;
  cin>>s;
  int ans=0;
  int n=(int)s.size();
  for(int i=0;i<n/2;i++){
  if(s[i]==s[n-1-i])continue;
    else ans++;
  
  } cout<<ans;







return 0;}

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

using namespace std;

void saiki(int x,int y,vector<vector<char> > &field,vector<vector<char> > &k){
    if(field[y][x] == '#' || k[y][x] == 'x'){
        return;
    }

    field[y][x] = '#';
    k[y][x] = 'x';
    saiki(x-1,y,field,k);
    saiki(x+1,y,field,k);
    saiki(x,y-1,field,k);
    saiki(x,y+1,field,k);
    field[y][x] = '.';
    return;
}

int solve(int w,int h){
    //char field[w+2][h+2];
    vector<vector<char> > field(h+2,vector<char>(w+2));
    vector<vector<char> > k(h+2,vector<char>(w+2));

    int x,y;
    for(int i=0;i<h+2;i++){
        for(int j=0;j<w+2;j++){
            field[i][j] = '#';
        }
    }

    for(int i=1;i<=h;i++){
        for(int j=1;j<=w;j++){
            cin >> field[i][j];
            if(field[i][j] == '@'){
                y = i;
                x = j;
            }
            k[i][j] = field[i][j];
        }
    }

#ifdef DEB
    cout << "X:" << x << " Y:" << y << endl;
    for(int i=0;i<h+2;i++){
        for(int j=0;j<w+2;j++){
            cout << field[i][j];
        }
        cout << endl;
    }
#endif
    saiki(x,y,field,k);

    int m = 0;
    for(int i=0;i<h+2;i++){
        for(int j=0;j<w+2;j++){
            if(k[i][j] == 'x'){
                m++;
            }
        }
    }
    cout << m << endl;
}

int main(){
    int x,y;
    while(cin >> x >> y){
        if(x==0 && y == 0){
            break;
        }
        solve(x,y);
    }
}

Measured memory_bytes: 1236
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>
#include<cassert>
#include<numeric>
#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)
using namespace std;
const int INF = 1001001001;
const long long LINF = 1001002003004005006ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
typedef long long ll;
typedef pair<int,int> P;

int main(){
  ll n;
  ll x,m;
  cin >> n >> x >> m;
  ll ans = 0;
  map<int,int> mp;
  vector<int> v;
  rep(i,n){
    if(mp.count(x)==0){
      mp[x]=i;
      ans += x;
      v.push_back(x);
      x = (x*x)%m;
    }else{
      ll sum = 0;
      ll cl = i-mp[x];
      rep(j,cl){
        sum+=v[mp[x]+j];
      }
      ll left = n-i;
      //cout << sum << " " << cl << " " << left << endl;
      ans += (left/cl)*sum;
      left %= cl;
      rep(j,left){
        ans+=v[mp[x]+j];
      }
      cout << ans << endl;
      return 0;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 5844
#include <stdio.h>
//#include <string.h>

int main(void){

  int n,a,b= 0;
  scanf("%d %d %d", &n, &a, &b);
  
  if(n*a>=b) printf("%d", b);
  else printf("%d", n*a);

  return 0;
}

  

Measured memory_bytes: 1692
#include <iostream>
using namespace std;
int main(void){
    int x, y;
    while (1){
        cin >> x >> y;
        if (x == 0 && y == 0) break;
        if (x < y) {
            cout << x << " " << y << endl;
        } else {
            cout << y << " " << x << endl;
        }
    }
}

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

int main() {
  int N, a, b, c, d;
  cin >> N;
  a = N % 10;
  b = N / 10 % 10;
  c = N / 100 % 10;
  d = N / 1000 % 10;
  if (a == b && b == c || b == c && c == d) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}
  

Measured memory_bytes: 256
import java.util.*;
public class Main{
	static Scanner s = new Scanner(System.in);
	public static void main(String[] args) {
		long N=s.nextInt(),A=s.nextInt(),B=s.nextInt();
		int curx=s.nextInt(),x;
		long sum=0;
		for(int i=0;i<N-1;i++) {
			x=s.nextInt();
			sum+=Math.min((x-curx)*A,B);
			curx=x;
		}
		System.out.println(sum);
	}
}


Measured memory_bytes: 31404
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vvll> vvvll;
typedef vector<string> vstr;
typedef pair<ll, ll> pll;
typedef vector<pll> vp;
typedef map<string, ll> mstrll;
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fir first
#define sec second
#define maxs(x, y) (x = max(x, y))
#define mins(x, y) (x = min(x, y))
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(ll i = ll(a); i < ll(b); i++)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep,)(__VA_ARGS__)
#define each(i, n) for(auto&& i: n)
#define out(x) cout << x
#define print(x) cout << x << '\n'
#define debug(x) cerr << #x << ": " << x << '\n'
const ll INF = 1e16;
const ll MOD = 1e9 + 7;
ll a, b, c, n, m, x, y, z, w, h, ans = 0, cnt = 0, mx = 0, mn = INF;
string s, t;
vll dx = {-1, 0, 1, 0}, dy = {0, -1, 0, 1};
//vll dx = {-1, 0, 1, -1, 1, -1, 0, 1}, dy = {-1, -1, -1, 0, 0, 1, 1, 1};

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

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    while(cin >> n >> m){
        vll list;
        rep(i, n){
            cin >> a;
            b = abs(m - a);
            if(i == 0){
                ans = b;
            }else{
                ans = gcd(ans, b);
            }
        }
        print(ans);
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;
using namespace std;
#define ll long long
#define ff first
#define ss second
#define pb push_back
#define deb(x) cout<<x<<"\n";
#define deB(x,y) cout<<x<<" "<<y<<"\n";
#define Deb(x,y,z) cout<<x<<" "<<y<<" "<<z<<"\n";
#define YES cout<<"YES\n";
#define Yes cout<<"Yes\n";
#define NO cout<<"NO\n";
#define No cout<<"No\n";
#define clt(x) 63-__builtin_clzll(x)
#define bct(x) __builtin_popcountll(x)
#define all(v) (v).begin(),(v).end()
#define pi pair<ll,ll>
#define vi vector<ll>
#define vpi vector<pair<ll,ll>>
#define maxq priority_queue<ll>
#define minq priority_queue<ll,vector<ll>, greater<ll>>
#define cont continue;
#define reto return 0;
#define sz size()
#define spmod 1116295198451
#define mod 1000000007
#define md 998244353 
#define N 2e5+10
//typedef tree<int,null_type, less<int>, rb_tree_tag,tree_order_statistics_node_update> //pbds;


int main()
{
  ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
  //freopen("input.txt", "r", stdin);
  //freopen("output.txt", "w", stdout);
  ll n,k,d;
  cin>>n>>k>>d;
  n=abs(n);
  ll x=n/d;
  if(k>=x)
  {
    k-=x;
    n%=d;
    if(k%2)
    {
      deb(abs(n-d))
    }
    else
      deb(n)
  }
  else
  {
    deb(n-k*d)
  }
}

Measured memory_bytes: 3656
//2013-5

#include <iostream>
#include <fstream>
#include <cstdio>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <time.h>
#define mp make_pair
#define INF 1e8
#define fs first
#define sc second
#define rep(x,n) for(int x = 0;x < n;x ++)
#define Rep(x,n) for(int x = 1;x <= n;x ++)
using namespace std;

int d[2][105][105]; //行き先、cost...0 time...1

int main(){
    int n,m;
    while(scanf("%d %d",&n,&m),(n!=0||m!=0)){

    rep(i,m){
        rep(j,m){
            d[0][i][j]=INF;
            d[1][i][j]=INF;
        }
    }
    rep(i,m){
        d[0][i][i]=0;
        d[1][i][i]=0;
    }

    rep(i,n){
        int a,b,cost,time;
        scanf("%d %d %d %d",&a,&b,&cost,&time);
        a--;b--;
        d[0][a][b]=cost;
        d[0][b][a]=cost;
        d[1][a][b]=time;
        d[1][b][a]=time;
    }
    
    
    rep(i,2){
        rep(j,m){
            rep(k,m){
                rep(l,m){
                    d[i][k][l]=min(d[i][k][l],d[i][k][j]+d[i][j][l]);
                    if(d[i][k][l]>INF)
                        d[i][k][l]=INF;
                }
            }
        }
    }
    
    int k;
    scanf("%d",&k);
    rep(i,k){
        int p,q,r;
        scanf("%d %d %d",&p,&q,&r);
        p--;q--;
        printf("%d\n",d[r][p][q]);
    }
    }
}

Measured memory_bytes: 1272
// ALDS1_4D.cpp
// Search - Allocation

#include <iostream>
#include <vector>
using namespace std;

int main()
{
    int n; // packages
    int k; // trucks
    cin >> n >> k;
    vector<int> w(n);
    int w_sum = 0;
    for (int i = 0; i < n; i++) {
        cin >> w[i];
        w_sum += w[i];
    }
    int w_min = w_sum / k;

    while (true) {
        int cnt = k;
        int i = 0;
        while (cnt--) {
            int curr_sum = 0;
            while (i < n && curr_sum + w[i] <= w_min) {
                curr_sum += w[i];
                i++;
            }
        }
        if (i == n) {
            break;
        }
        else w_min++;
    }
    cout << w_min << endl;

    return 0;
}

Measured memory_bytes: 3108
# include<bits/stdc++.h>
 
using namespace std;
 
# define int long long
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<double, int> pdi;
typedef pair<ll, ll> pll;
 
# define S second
# define F first
# define kill(x) return(cout << x << endl, 0)
# define debug(x) cerr<< #x << " : " << x << endl
# define ddebug(x, y) cerr<< #x << " : " << x  << ", " << #y << " : " << y << endl
# define sz(s) (int)s.size()
# define sq(x) (x) * (x)
# define PB(x) push_back(x)
# define smax(x, y) (x) = max((x), (y))
# define smin(x, y) (x) = min((x), (y))
# define all(x) x.begin(), x.end()
# define SP fixed << setprecision(10)
# define UB upper_bound 

const int MAXN = 100 * 1000 + 10;
int a[MAXN];

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

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

	int x = 2, ans = a[0] - 1;
	for (int i = 1; i < n; i ++)
	{
		if (a[i] == x)
			x ++;
		else
			ans += (a[i] + x - 1) / x - 1;

		ddebug(a[i], x);
		debug(ans);
		cerr << endl;
	}
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 1152
N = int(input())
A = list(map(int, input().split()))
X = []

x0 = sum(A)
for i in range(1,N-1,2):
    x0 = x0-2*A[i]
X.append(x0)

for i in range(N-1):
    X.append(2*A[i]-X[i])
    
print(" ".join(map(str,X)))

Measured memory_bytes: 19144
#include <stdio.h>

int main(void)
{
        int A;
        int B;

        scanf("%d %d",&A,&B);

        if(A>=13){
                printf("%d\n",B);
        }else if(A<=12&&A>=6){
               printf("%d\n",B/2);
        }else{
                printf("0\n");
        }

        return 0;
}


Measured memory_bytes: 128
use std::io::*;

fn read(s: &mut StdinLock) -> usize {
    s.by_ref().bytes().map(|c| c.unwrap() as char)
        .take_while(|c| !c.is_whitespace())
        .skip_while(|c| c.is_whitespace())
        .fold(0, |a, x| (x as u8 - b'0') as usize + a * 10)
}
fn read_tuple(s: &mut StdinLock) -> (usize, usize) {
    (read(s), read(s))
}
fn read_line_char(s: &mut StdinLock) -> Vec<char> {
    s.by_ref().bytes().map(|c| c.unwrap() as char)
        .take_while(|c| !c.is_whitespace())
        .skip_while(|c| c.is_whitespace())
        .collect()
}
fn read_mat_char(s: &mut StdinLock, n: usize) -> Vec<Vec<char>> {
    (0..n).map(|_| read_line_char(s)).collect()
}

fn main() {
    let s = stdin();
    let mut s = s.lock();
    let (n, m) = read_tuple(&mut s);
    let old_flag: Vec<Vec<char>> = read_mat_char(&mut s, n);
    let mut distance: Vec<(usize, usize, usize)> = Vec::new();

    // make distance list
    for i in 0..n {
        let mut line_distance: (usize, usize, usize) = (0, 0, 0);
        for j in 0..m {
            if old_flag[i][j] == 'W' {
                line_distance.1 += 1;
                line_distance.2 += 1;
            } else if old_flag[i][j] == 'B' {
                line_distance.0 += 1;
                line_distance.2 += 1;
            } else {
                line_distance.0 += 1;
                line_distance.1 += 1;
            }
        }
        distance.push(line_distance);
    }
    let mut ans = usize::max_value();
    for w in 1..n-1 {
        let mut wbr: (usize, usize, usize) = (0, 0, 0);
        wbr.0 = (0..w).fold(0, |acc, x| acc+distance[x].0);
        for b in 1..n-w {
            wbr.1 = (w..w+b).fold(0, |acc, x| acc+distance[x].1);
            wbr.2 = (w+b..n).fold(0, |acc, x| acc+distance[x].2);
            let sum = wbr.0+wbr.1+wbr.2;
            if sum < ans {
                ans = sum;
            }
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 5044
n = int(input())
h = list(map(int, input().split()))

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

for i in range(2, n):
    dp.append(min(abs(h[i]-h[i-1])+dp[-1], abs(h[i]-h[i-2])+dp[-2]))
print(dp[-1])

Measured memory_bytes: 20476
import math

def main():
    N = int(input())
    a = []
    c = 0
    f = 0
    for i in range(5):
        tr = int(input())
        a.append(tr)
        if i == 0:
            c = tr
        
        if c > tr:
            f = i
            c = tr
    
    print(4 + math.ceil(N / c))


if __name__ == "__main__":
    main()

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
#define rep2(i,n) for (int i = 1; i <= (n); i++)
using namespace std;
using ll = long long;
using p = pair<int, int>;
 
int main() {
  ll n, k;
  cin >> n >> k;

  ll r = n % k;

  cout << min(r, k - r) << endl;
 
  return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
///////////////////////////////////////////
const long long int INF = 1LL<<60;
const long long int Mod = 1000000007;
using ll = long long int; using ci = const int;
using vi = vector<int>;  using Vi = vector<long long int>;
using P = pair<int, int>;  using PLL = pair<ll, ll>;
using matrix = vector<vector<ll>>;
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define rp(i,N) for(ll i = 0; i < (ll)N; i++)
#define repi(i,a,b) for(ll i = ll(a); i < ll(b); ++i)
template<class T>bool chmax(T &former, const T &b) { if (former<b) { former=b; return true; } return false; }
template<class T>bool chmin(T &former, const T &b) { if (b<former) { former=b; return true; } return false; }
template<class T>T sqar(T x){ return x*x; }//sqrt(x)は平方根;
#define Sort(v) std::sort(v.begin(), v.end(), std::greater<decltype(v[0])>()) //降順でVをソート
#define p_queue(v) priority_queue<v, vector<v>, greater<v> >
template<class T> inline void princ(T x){cout<<x<<" ";}; 
template<class T> inline void print(T x){cout<<x<<"\n";};
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
///////////////////////////////////////////////////////////////////////////////////

int main(){
    vi a(3);
    cin >> a[0] >> a[1] >> a[2];
    sort(all(a));
    cout << a[0]+a[1]+a[2]*10 << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main() {

    ios:: sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int x, n;
    cin >> x >> n;
    set <int> s;
    for (int i = 0; i < n; ++i) {
        int k;
        cin >> k;
        s.insert(k);
    }
    int index;
    int minsf = INT_MAX;
    for (int i = x; i >= -1000; --i) {
        if (s.count(i) == 0) {
            if (minsf > abs(x - i)) {
                minsf = abs(x - i);
                index = i;
                break;
            }
        }
    }
    for (int i = x; i <= 1000; ++i) {
        if (s.count(i) == 0) {
            if (minsf > abs(x - i)) {
                minsf = abs(x - i);
                index = i;
                break;
            }
        }
    }
    cout << index << endl;
}

Measured memory_bytes: 3660
#include <stdio.h>
#include <math.h>
#include <string.h>
#define PI 3.14159265358979
long long a[100005];

int find(int h, int mn, int mx)
{
    int o1 = (mn - 1) / h, o2 = mx / h;
    if(o1 < o2) return 1;
    else return 0;
}

int main()
{
    long long k, i, l, r, o1, o2;
    scanf("%lld", &k);
    for(i = 1; i <= k; ++i)
        scanf("%lld", a + i);
    if(a[k] != 2)
    {
        puts("-1");
        return 0;
    }
    l = r = 2;
    for(i = k; i; --i)
    {
        o1 = (l - 1) / a[i], o2 = r / a[i];
        if(o1 >= o2)
        {
            puts("-1");
            return 0;
        }
        l = (o1 + 1) * a[i], r = (o2 + 1) * a[i] - 1;
    }
    printf("%lld %lld\n", l, r);
    return 0;
}

Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
#define sp(x) fixed << setprecision(x)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const int inf = (1<<30)-1;
const ll INF = (1LL<<60)-1;
const ld EPS = 1e-10;
template<typename T> bool chmax(T &x, const T &y) {return (x < y)? (x = y, true) : false;};
template<typename T> bool chmin(T &x, const T &y) {return (x > y)? (x = y, true) : false;};

template<typename Monoid> struct Segment_Tree{
    Monoid ope(Monoid a, Monoid b){
        return a+b;
    }
    Monoid unit;
    int n;
    vector<Monoid> seg;
    
    Segment_Tree(int N, Monoid x){
        unit = x;
        n = 1;
        while(n < N) n <<= 1;
        seg.assign(2*n, unit);
    }
    
    void change(int i, Monoid x){
        i += n;
        seg[i] = x;
        while(i > 0){
            i /= 2;
            seg[i] = ope(seg[2*i], seg[2*i+1]);
        }
    }
    
    Monoid query(int a, int b, int i = 1, int l = 0, int r = -1){
        if(r < 0) r = n;
        if(a >= r || b <= l) return unit;
        if(a <= l && r <= b) return seg[i];
        Monoid vl = query(a, b, 2*i, l, (l+r)/2);
        Monoid vr = query(a, b, 2*i+1, (l+r)/2, r);
        return ope(vl, vr);
    }
    
    Monoid at(int i){
        return seg[n+i]; 
    }
    
    void clear(){
        fill(seg.begin(), seg.end(), unit);
    }
};

int main(){
    int N;
    cin >> N;
    int a[N][3];
    rep(j, 3) rep(i, N) cin >> a[i][j];
    string yes = "Yes", no = "No";
    int p[N], rev[N];
    rep(i, N){
        if(a[i][1]%3 != 2) {cout << no << endl; return 0;}
        p[i] = a[i][1]/3;
        if((i&1) != (p[i]&1)) {cout << no << endl; return 0;}
        if(a[i][0] == a[i][1]-1){
            if(a[i][2] != a[i][1]+1) {cout << no << endl; return 0;}
            rev[i] = 0;
        }
        elif(a[i][0] == a[i][1]+1){
            if(a[i][2] != a[i][1]-1) {cout << no << endl; return 0;}
            rev[i] = 2;
        }
        else {cout << no << endl; return 0;}
    }
    int A[2], B[2];
    rep(i, 2) A[i] = B[i] = 0;
    vector<Segment_Tree<int>> seg;
    Segment_Tree<int> s(N, 0);
    rep(i, 2) seg.pb(s);
    rep(i, N){
        int j = p[i], k = i&1;
        if((i&2)^(j&2)^(rev[j])) A[k]++;
        B[k] += seg[k].query(j+1, N);
        seg[k].change(j, 1);
    }
    rep(i, 2) A[i] &= 1, B[i] &= 1;
    if(A[0] == B[1] && B[0] == A[1]) cout << yes << endl;
    else cout << no << endl;
}

Measured memory_bytes: 8240
N,M = map(int,input().split())
A = list(map(lambda x: int(x)*(-1),input().split()))
import heapq
heapq.heapify(A)
for i in range(M):
  B = heapq.heappop(A)
  heapq.heappush(A,-1*((-B)//2))
print(-sum(A))
  

Measured memory_bytes: 14224
/**
 *
 */

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

/**
 * @author b
 *
 */
public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner();
		PrintWriter writer = new PrintWriter(System.out);
		solve(scanner, writer);
		writer.close();
	}

	private static void solve(Scanner scanner, PrintWriter writer) {

		int n = scanner.nextInt();
		int x = scanner.nextInt();
		int t = scanner.nextInt();

		writer.println((int) Math.ceil(n * 1.0 / x) * t);

	}

	// Props to SecondThread
	static class Scanner {
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer tokenizer = new StringTokenizer("");

		String next() {
			while (!tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return tokenizer.nextToken();
		}

		long[] nextLongArr(int num) {
			long[] vals = new long[num];
			for (int i = 0; i < num; i++)
				vals[i] = nextLong();
			return vals;
		}

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

		int[] nextIntArr(int numberOfElements) {
			int[] values = new int[numberOfElements];
			for (int i = 0; i < numberOfElements; i++)
				values[i] = nextInt();
			return values;
		}

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

}


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

#define io ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define int long long
#define endl '\n'
#define eps  1e-9
const double pi=acos(-1);
const int mod=1e9+7;
//_______________________



int32_t main()
{ 
  io;

 
  int a,b,c;
  cin>>a>>b>>c;
  if(a>b) swap(a,b);

  if(c> a and c < b)
    cout<<"Yes";
  else
    cout<<"No";

 return 0;
}

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

#define st first
#define nd second
#define pb push_back

typedef long long   ll;
typedef double      db;
typedef long double ldb;

typedef pair <int, int> pii;
typedef pair <ll,  ll>  pll;
typedef pair <ll,  db>  pdb;
typedef pair <ldb, ldb> pldb;

template <typename T>
void   Debug (T begin, T end);
int    si    ();
ll     sl    ();
string ss    (int); 
db     sf    ();
ldb    slf   ();
void   pi    (int, char = '\n');
void   pl    (ll, char = '\n');
void   pf    (db, char = '\n');
void   plf   (ldb, char = '\n');
void   ps    (string, char = '\n');

ll russian(ll, ll, ll);
ll fast_power(ll, ll, ll);
ll slow_power(ll, ll, ll);
ll gcd(ll, ll);
ll lcm(ll, ll);

const int INF  = 1e9;
const ll  LINF = 1e18;

int main()
{
    int n = si();
    string s = ss(n);
    if (!(n & 1) && s.substr(0, n / 2) == s.substr(n / 2, n / 2))
        printf("Yes");
    else
        printf("No");

    return 0;
}

template <typename T>
void Debug(T begin, T end)
{
    printf("\nDEBUG:\n");
    while (begin != end)
        printf("%d ", *begin),
        begin++;
    printf("\n\n");
}

template <typename T>
T scanf_t(string s)
{
    T a;
    scanf(s.c_str(), &a);
    return a;
}

template <typename T>
void printf_t(T a, string s, char end_l)
{
    s.push_back(end_l);
    printf(s.c_str(), a);
}

int si() { return scanf_t<int>("%d"); }
ll sl() { return scanf_t<ll>("%lld"); }
db sf() { return scanf_t<db>("%f"); }
ldb slf() { return scanf_t<ldb>("%Lf"); }

void pi(int a, char end_l) { printf_t<int>(a, "%d", end_l); }
void pl(ll a, char end_l) { printf_t<ll>(a, "%lld", end_l); }
void pf(db a, char end_l) { printf_t<db>(a, "%lf", end_l); }
void plf(ldb a, char end_l) { printf_t<ldb>(a, "%Lf", end_l); }

void ps(string a, char end_l)
{
    string s = "%s";
    s.push_back(end_l);
    printf(s.c_str(), a.c_str());
}

string ss(int NN)
{
    char T[NN];
    scanf("%s", T);
    return (string)T;
}

ll fast_power(ll a, ll k, ll m)
{
    ll r = 1LL;
    while (k)
    {
        if (k & 1LL)
            r = (r * a) % m;
        a = (a * a) % m;
        k >>= 1LL;
    }
    return r;
}

ll slow_power(ll a, ll k, ll m)
{
    ll r = 1LL;
    while (k)
    {
        if (k & 1LL)
            r = russian(r, a, m);
        a = russian(a, a, m);
        k >>= 1LL;
    }
    return r;
}

ll russian(ll a, ll k, ll m)
{
    ll r = 0LL;
    while (k)
    {
        if (k & 1LL)
            r = (r + a) % m;
        a = (a + a) % m;
        k >>= 1LL;
    }
    return r;
}

ll gcd(ll a, ll b)
{
    while (b)
        swap(a %= b, b);
    return a;
}

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


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
int knapsack( int wt[], int val[], int n,int W) 
{ 
   int i, w; 
   int K[n+1][W+1]; 

   for (i = 0; i <= n; i++) 
   { 
       for (w = 0; w <= W; w++) 
       { 
           if (i==0 || w==0) 
               K[i][w] = 0; 
           else if (wt[i-1] <= w) 
                 K[i][w] = max(val[i-1] + K[i-1][w-wt[i-1]],  K[i-1][w]); 
           else
                 K[i][w] = K[i-1][w]; 
       } 
   } 
  
   return K[n][W]; 
} 
signed main(){
	int n;
	cin>>n;
		int W;
	cin>>W;
	int wt[n];
	int v[n];
	for(int i=0;i<n;i++){
		cin>>wt[i];
		cin>>v[i];
	}

	cout<<knapsack(wt,v,n,W)<<endl;
	return 0;
}

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

using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int,int>;
#define rep(i,n) for(ll i = 0;i < (ll)n;i++)
#define ALL(x) (x).begin(),(x).end()
#define MOD 1000000007


int main(){
  
  int n,t;
  cin >> n >> t;
  priority_queue<P> que;
  rep(i,t){
    int x;cin >> x;
    que.push(make_pair(x,i));
  }
  P k,l;
  int fi = que.top().second;
  while(1){
    if(que.empty())break;
    k = que.top();que.pop();
    if(que.empty()){
      que.push(k);
      break;
    }
    l = que.top();que.pop();
    if(k.first-l.first > 0)que.push(make_pair(k.first-l.first,k.second));
  }
  if(que.empty()){
    cout << 0 << endl;
  }else{
    if(que.top().second == fi){
      cout << max(0,que.top().first-1) << endl;
    }else{
      cout << max(0,que.top().first-2) << endl;
    }
  }








  return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
  int a,b,c,x;int cnt=0;
  cin >> a>> b>>c >>x;
  for(int i=0;i<=a;i++){
    for(int j=0;j<=b;j++){
      for(int k=0;k<=c;k++){
        int sum=(i*500)+(j*100)+(k*50);
        if(sum==x) cnt++;
      }
    }
  }
  cout << cnt<<endl;
}


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

using ll = long long;
#define REP(i,n) for(int i=0; i < (n); ++i)
#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)
// #define INF 1e9
const ll INF = 1LL << 60;

bool warshallFloyd(vector<vector<ll>>& g){
  int n = g.size();
  bool flag = false;
  REP(k, n){
    REP(i, n){
      REP(j, n){
        if(g[i][k] == INF || g[k][j]==INF) continue;
        if(g[i][k] + g[k][j] < g[i][j]){
          flag = true;
          g[i][j] = g[i][k] + g[k][j];
        }
      }
    }
  }
  return flag;
}
void reWarshallFloyd(vector<vector<ll>>& g){
  int n = g.size();
  REP(k, n){
    REP(i, n){
      REP(j, n){
        if(i==k || k == j) continue;
        if(g[i][k]+g[k][j] == g[i][j]){
          g[i][j] = INF;
        }
      }
    }
  }
}

int main(){
  int N;
  cin >> N;
  vector<vector<ll>> A(N, vector<ll>(N));
  REP(i, N){
    REP(j, N){
      cin >> A[i][j];
    }
  }
  if(warshallFloyd(A)){
    cout << -1 << endl;
    return 0;
  }
  reWarshallFloyd(A);
  ll ans = 0;
  REP(i, N){
    REP(j, N){
      if(A[i][j] == INF) continue;
      ans += A[i][j];
    }
  }
  cout << ans/2 <<endl;
  return 0;
}



Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <vector>
#include <algorithm>
#include <set>
#include <queue>
#include <map>
#include <climits>
using namespace std;

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define RREP(i,n) for(int i=(int)n-1; i>=0; i--)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define RFOR(i,c) for(__typeof((c).rbegin())i=(c).rbegin();i!=(c).rend();++i)
#define ALL(c) (c).begin(), (c).end()

typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<int, pair<int, int> > pipii;
typedef vector<int> vi;

class data{
public:
	int team;
	int solve;
	int miss_pro[11];
	int time;
	
	data(){
		solve = 0;
		REP(i, 11) miss_pro[i] = 0;
		time = 0;
	}

	void c(int t, int pro){
		solve++;
		time += t + miss_pro[pro] * 20;
	}
	
	void w(int p){
		miss_pro[p]++;
	}
	
	void print(data d){
		if(solve == d.solve && time == d.time) cout << "=";
		else cout << ",";
		cout << team;
	}
	
	bool operator < (const data& rdata)const{
		if(solve != rdata.solve) return solve > rdata.solve;
		else if(time != rdata.time) return time < rdata.time;
		else return team > rdata.team;
	}
};


int main(void){
	int M, T, P, R;
	while(cin >> M >> T >> P >> R, M){
		vector<data> teams(T);
		REP(i,teams.size()) teams[i].team = i+1;
		REP(i,R){
			int m, t, p, j;
			cin >> m >> t >> p >> j;
			t--;
			if(!j) teams[t].c(m, p);
			else teams[t].w(p);
		}
		sort(ALL(teams));
		cout << teams[0].team;
		REP(i,teams.size()){
			if(!i) continue;
			teams[i].print(teams[i-1]);
		}
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 1200