akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#define INF 1<<29;
using namespace std;

int N,M,R;
int map[201][201];
int ans = INF;
int r[300];
bool did[10];

void search(int c,int las,int n){

  if(c==R+1){
    if(ans>n) ans = n;
    return;
  }
  for(int i=0;i<R;i++){
    if(!did[i]){
      did[i] = true;
      if(las==-1) search(c+1,i,0);
      else 
        search(c+1,i,n+map[r[las]][r[i]]);
          did[i]=false;
    }
  }
}

int main(){

  cin>>N>>M>>R;
  for(int i=0;i<R;i++){
  int re;
  cin>>re;
  r[i] = re-1;
  }

  for(int i=0;i<N;i++){
    for(int j=0;j<N;j++){
      if(i==j) continue;
      map[i][j]=INF;
    }
  }

  for(int i=0;i<M;i++){
    int a,b,c;
    cin>>a>>b>>c;
    if(map[a-1][b-1]>c){
      map[a-1][b-1]=c;
      map[b-1][a-1]=c;
    }
  }

  for(int k=0;k<N;k++){
    for(int i=0;i<N;i++){
      for(int j=0;j<N;j++){
        map[i][j]=min(map[i][j],map[i][k]+map[k][j]);
      }
    }
  }

  search(1,-1,0);

  cout<<ans<<endl;

  return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <cmath>
using namespace std;
#define Inf 2000000000000
#define N 100004
long long t[N], DP[N];
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    long long n, k;
    cin >> n >> k;
    for (long long i = 1; i <= n; i++) cin >> t[i];
    for (long long i = 2; i <= k; i++) DP[i] = abs(t[i] - t[1]);
    for (long long i = k + 1; i <= n; i++)
    {
        long long temp = Inf;
        for (long long backw = k; backw >= 1; backw--)
        {
            if (abs(t[i] - t[i - backw]) + DP[i - backw] < temp) temp = abs(t[i] - t[i - backw]) + DP[i - backw];
        }
        DP[i] = temp;
    }
    cout << DP[n];
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
const ll INF = 1LL << 60;

//与えられた(x,y)から中心を通るように直線を引けば半分ずつに分割出来る
//(x,y)自体が中心の場合はそこからどのように直線を引いてもOK
int main(){
    ll w, h, x, y;
    cin >> w >> h >> x >> y;
    double ans=(double)w*h/2;
    int num=0;
    if(w==x*2 && h==y*2) num = 1;

    cout << setprecision(10) << ans << ' ' << num << endl;


}

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

using namespace std;

#define rep(i, n) for(int i = 0; i < (int)n; ++i)
#define FOR(i, a, b) for(int i = a; i < (int)b; ++i)

typedef long long ll;

const int Inf = 1e9;
const double EPS = 1e-9;

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

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

int bitCount(long bits) {
    bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555);
    bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333);
    bits = (bits & 0x0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f);
    bits = (bits & 0x00ff00ff) + (bits >> 8 & 0x00ff00ff);
    return (bits & 0x0000ffff) + (bits >>16 & 0x0000ffff);
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, m;  cin >> n >> m;
    vector<int> a(n), b(n), c(m), d(m), ans(n);
    rep (i, n) {
      cin >> a[i] >> b[i];
    }
    rep (i, m) {
      cin >> c[i] >> d[i];
    }

    rep (i, n) {
      int index = -1;
      int dist = Inf;
      rep (j, m) {
        if (dist > abs(a[i] - c[j]) + abs(b[i] - d[j])) {
          dist = abs(a[i] - c[j]) + abs(b[i] - d[j]);
          index = j + 1;
        }
        ans[i] = index;
      }
    }

    rep (i, n) {
      cout << ans[i] << '\n';
    }

    return 0;
}


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

using namespace std;

#define FAST_IO ios_base::sync_with_stdio(0); cin.tie(nullptr)
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define REP(n) FOR(z, 1, (n))
#define pb push_back
#define INF 1000000000000000000
#define f first
#define s second
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vii;

const int MAXN = 100100;

int main()
{
    FAST_IO;

    ll d = 0;
    int cnt = 1;
    int n; ll x;
    cin >> n >> x;
    FOR(i, 1, n) {
        ll l; cin >> l;
        d+= l;
        if (d <= x) cnt++;
    }

    cout << cnt << endl;

    return 0;
}


Measured memory_bytes: 256
s = int(input())


def func(n):
    if n % 2 == 0:
        return n // 2
    else:
        return 3 * n + 1


a = [0, s]
cnt = 1
while True:
    res = func(a[cnt])
    cnt += 1

    if res in a:
        break

    a.append(res)

print(cnt)


Measured memory_bytes: 3060
//#define _GLIBCXX_DEBUG
#include <iostream>
#include <bits/stdc++.h>


using namespace std;
#define ll long long
#define ld long double
#define  P pair<ll,ll>
#define FOR(i,n,m) for(ll i=n; i<(ll)m;i++)
#define FORr(i,m,n) for(ll i=n; i>=(ll)m; i--)
#define FORm(i,m) for(auto i=m.begin();i!=m.end();i++)
#define sortAl(v) sort(v.begin(),v.end())
#define sortAlr(v) sort(v.begin(),v.end()); reverse(v.begin(),v.end())
#define cout(n) cout<<fixed<<setprecision(n)

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin>>n;
    vector<ll> a(n);
    vector<ll> b(n-1);
    FOR(i,0,n)cin>>a[i];
    ll res = 0;
    FOR(i,0,n){
      ll in;
      cin>>in;
      res += in;
    }
    FOR(i,0,n-1)cin>>b[i];
    FOR(i,1,n){
      if(a[i] - a[i-1] == 1) res += b[a[i-1]-1];
    }
    cout<<res<<endl;

}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	@SuppressWarnings("resource")
	public static void main(String args[]) {
		Scanner scanner = new Scanner(System.in);
		int a = scanner.nextInt();
		int b = scanner.nextInt();
		int c = scanner.nextInt();
		int d = scanner.nextInt();
		int e = scanner.nextInt();
		int f = scanner.nextInt();

		double max = 0;
		int ansSuw = 0;
		int ansSu = 0;
		for (int i = 0; c * i <= f; i++) {
			for (int j = 0; d * j <= f; j++) {
				for (int s = 0; 100 * a * s <= f; s++) {
					for (int k = 0; 100 * b * k <= f; k++) {
						double su = (double) (c * i + d * j);
						double wa = (double) (100 * a * s + 100 * b * k);
						double suw = wa + su;
						if (e * suw >= su * (100 + e) && f >= suw) {
							if (suw != 0 && su >= max * suw) {
								max = su / suw;
								ansSuw = (int) suw;
								ansSu = (int) su;
							}
						}
					}
				}
			}
		}

		System.out.println(ansSuw + " " + ansSu);
	}
}


Measured memory_bytes: 21972
# coding: utf-8


def solve(*args: str) -> str:
    h, w = map(int, args[0].split())
    if h == 1 or w == 1:
        ret = 1
    elif h % 2 == 0:
        ret = (h//2)*w
    elif w % 2 == 0:
        ret = h*(w//2)
    else:
        ret = h*(w//2) + (h//2) + 1
    return str(ret)


if __name__ == "__main__":
    print(solve(*(open(0).read().splitlines())))


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

#define rep(i,s,n) for (int i = (int)s; i < (int)n; i++)
#define ll long long
#define pb push_back
#define All(x) x.begin(), x.end()
#define Range(x, i, j) x.begin() + i, x.begin() + j
#define lbidx(x, y) lower_bound(x.begin(), x.end(), y) - x.begin()
#define ubidx(x, y) upper_bound(x.begin(), x.end(), y) - x.begin()
#define BiSearchRangeNum(x, y, z) lower_bound(x.begin(), x.end(), z) - lower_bound(x.begin(), x.end(), y)turn idx;
#define deg_to_rad(deg) ((((double)deg)/((double)360)*2*M_PI))
#define rad_to_deg(rad) ((((double)rad)/(double)2/M_PI)*(double)360)

template<class T>
inline bool chmax(T &a, T b) {
  if(a < b) {
    a = b;
    return true;
  }
  return false;
};

template<class T>
inline bool chmin(T &a, T b) {
  if(a > b) {
    a = b;
    return true;
  }
  return false;
};

int main() {
  ll t1, t2;
  cin >> t1 >> t2;
  ll a1, a2, b1, b2;
  cin >> a1 >> a2 >> b1 >> b2;
  if ((t1 * a1 + t2 * a2) == (b1 * t1 + b2 * t2)) {
    cout << "infinity" << endl;
    return 0;
  }

  // 高橋くんがt1, t2で進む距離
  ll dis_t1 = a1 * t1;
  ll dis_t2 = a2 * t2;
  // 青木くんがt1, t2で進む距離
  ll dis_a1 = b1 * t1;
  ll dis_a2 = b2 * t2;

  if (dis_t1 > dis_a1) {
    if (dis_t1 + dis_t2 > dis_a1 + dis_a2) {
      cout << 0 << endl;
      return 0;
    }

    // t1区間での差
    ll dif1 = dis_t1 - dis_a1;

    // t1, t2合計での差
    ll dif_all = (dis_a1 + dis_a2) - (dis_t1 + dis_t2);

    // あまり
    ll re = dif1 % dif_all;

    ll ans;

    if (re == (ll)0) {
      ans = dif1 / dif_all * (ll) 2;
    } else {
      ans = dif1 / dif_all * (ll) 2 + (ll) 1;
    }

    cout << ans << endl;
  }

  if (dis_a1 > dis_t1) {
    if (dis_a1 + dis_a2 > dis_t1 + dis_t2) {
      cout << 0 << endl;
      return 0;
    }

    // t1区間での差
    ll dif1 = dis_a1 - dis_t1;

    // t1, t2合計での差
    ll dif_all = (dis_t1 + dis_t2) - (dis_a1 + dis_a2);

    // あまり
    ll re = dif1 % dif_all;

    ll ans;

    if (re == (ll)0) {
      ans = dif1 / dif_all * (ll) 2;
    } else {
      ans = dif1 / dif_all * (ll) 2 + (ll) 1;
    }

    cout << ans << endl;
  }

};


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

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

    if (a > b) {
        cout << (2*a - 1) << endl;
    } else if (a == b) {
        cout << 2*a << endl;
    } else {
        cout << (2*b - 1) << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int read(int *d)
{
    int a, b;
    int ans;
    char op;

    scanf("%d %c %d", &a, &op, &b);

    switch (op) {
        case '?': return 0;
        case '+': ans = a + b;  break;
        case '-': ans = a - b;  break;
        case '*': ans = a * b;  break;
        case '/': ans = a / b;  break;
        default : break;
    }
    *d = ans;

    return 1;
}

int main(void)
{
    int i, idx = 0;
    int ans[10000];

    while(read(&ans[idx++]) != 0);

    for(i=0;i<idx-1;i++) {
        printf("%d\n", ans[i]);
    }

    return 0;
}

Measured memory_bytes: 608
cnt=0
a,b,c,d=map(int,raw_input().split())
t=[0 for i in range(101)]
for i in range(a,b+1):
    t[i]=1
for j in range(c,d+1):
    t[j]=t[j]+1
for i in range(101):
    if t[i]==2: cnt=cnt+1
if cnt==0:
    print 0
else:
    print cnt-1

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

int main()
{
	int a,b,c;

	int d=0;

	cin>>a>>b>>c;

	for(int i=a; i<=b; i++){
		if(c%i==0)
			d+=1;
	}

	cout<<d<<endl;

	return 0;
}
		

Measured memory_bytes: 1164
#include <iostream>
#include <vector>
#include <string>
#include <list>
#include <queue>
#include <algorithm>
#define rep(i, n) for(i = 0; i < (n); i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define MOD 1000000007
#define PI 3.14159265358979323846
#define INF 1 << 30

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

int main(void) {
	int n, m, i, j;
	cin >> n >> m;
	vector<int> a(n), b(m);
	vector<vector<ll>> dp(n + 1, vector<ll>(m + 1, 1)), sum(n + 1, vector<ll>(m + 1, 0));
	rep(i, n)
		cin >> a[i];
	rep(i, m)
		cin >> b[i];
	rep(i, n) {
		rep(j, m) {
			dp[i + 1][j + 1] = dp[i + 1][j] + dp[i][j + 1] - dp[i][j];
			if (a[i] == b[j])
				dp[i + 1][j + 1] += dp[i][j];
			dp[i + 1][j + 1] += MOD;
			dp[i + 1][j + 1] %= MOD;
		}
	}
	cout << dp[n][m] << "\n";
	return 0;
}

Measured memory_bytes: 62976
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair< ll, ll > Pi;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep2(i,n) for(int i=1;i<=(n);i++)
#define rep3(i,i0,n) for(int i=i0;i<(n);i++)
#define pb push_back
#define mod 1000000007
const ll INF = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
ll gcd(ll a, ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}
#define all(x) x.begin(), x.end()
#define mp make_pair
bool compare(Pi a, Pi b) {
    if(a.first != b.first){
        return a.first < b.first;
        
    }else{
        return a.second < b.second;
    }
}


bool In_map(ll y,ll x,ll h,ll w){
    if(y<0 || x<0 || y>=h || x>=w){
        return 0;
    }else{
        return 1;
    }
}
const vector<ll> dx{1,0,-1,0};
const vector<ll> dy{0,1,0,-1};


int main() {
    ll H,W,N;
    cin >>W>>H>>N;

    vector<vector<bool>>B(H,vector<bool>(W));

    rep(i,N){
        ll x,y,a;
        cin>>x>>y>>a;
        if(a==1){
            rep(j,H){
                rep3(k,0,x){
                    B[j][k]=1;
                }
            }
        }else if(a==2){
            rep(j,H){
                rep3(k,x,W){
                    B[j][k]=1;
                }
            }
        }else if(a==3){
            rep(k,W){
                rep3(j,0,y){
                    B[j][k]=1;
                }
            }
        }else if(a==4){
            rep(k,W){
                rep3(j,y,H){
                    B[j][k]=1;
                }
            }
        }
    }
    ll ans=0;

    rep(i,H){
        rep(j,W){
            //cout<<B[H-i-1][j];
            if(B[i][j]==0){
                ans++;
            }
        }
        //cout<<endl;
    }
    cout << ans << endl;


    return 0;
    

}

Measured memory_bytes: 3560
#include <bits/stdc++.h>
using namespace std;
int main(){
string S;
  cin>>S;
  string ans="No";
  if(S.at(0)==S.at(1) && S.at(2)==S.at(3) && S.at(0)!=S.at(2))
    ans="Yes";
  if(S.at(0)==S.at(2) && S.at(1)==S.at(3) && S.at(0)!=S.at(1))
    ans="Yes";
  if(S.at(0)==S.at(3) && S.at(2)==S.at(1) && S.at(0)!=S.at(2))
    ans="Yes";
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <set>
#include <map>
#include <cmath>
using namespace std;
typedef long long i64;
typedef long double ld;
typedef pair<i64,i64> P;
#define rep(i,s,e) for(int i = (s);i <= (e);i++)

int main()
{
    int n;
    cin >> n;
    cout << n / 3 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define MOD 1000000007
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
using P = pair<int,int>;

int main()
{
  ll N;
  cin >> N;
  vector<ll> A(N);
  REP(i, N) cin >> A[i];
  sort(ALL(A));
  ll ans = 0;
  ll cnt = A[0]*2;
  ll x=A[0],y=A[0];
  REP(i,(N-1)/2){
    if(i%2==0){
      ans+=abs(cnt-A[N-1-i]-A[N-2-i]);
      cnt=A[N-1-i]+A[N-2-i];
      if(i==(N-1)/2-1){
        x=A[N-1-i];
        y=A[N-2-i];
      }
    }else{
      ans+=abs(cnt-A[i]-A[i+1]);
      cnt=A[i]+A[i+1];
      if(i==(N-1)/2-1){
        x=A[i];
        y=A[i+1];
      }
    }
  }

  if(N%2==0){
    if(N%4==0){
      ans+=max(abs(x-A[N/2-1]),abs(y-A[N/2-1]));
    }else{
      ans+=max(abs(x-A[N/2]),abs(y-A[N/2]));
    }
  }
  ll ans2 = 0;
  ll cnt2 = A[N-1]*2;
  ll x2=A[N-1],y2=A[N-1];
  REP(i,(N-1)/2){
    if(i%2==0){
      ans2+=abs(cnt2-A[i]-A[i+1]);
      cnt2=A[i]+A[i+1];
      if(i==(N-1)/2-1){
        x2=A[i];
        y2=A[i+1];
      }
    }else{
      ans2+=abs(cnt2-A[N-1-i]-A[N-2-i]);
      cnt2=A[N-1-i]+A[N-2-i];
      if(i==(N-1)/2-1){
        x2=A[N-1-i];
        y2=A[N-2-i];
      }
    }
  }

  if(N%2==0){
    if(N%4==0){
      ans2+=max(abs(x2-A[N/2]),abs(y2-A[N/2]));
    }else{
      ans2+=max(abs(x2-A[N/2-1]),abs(y2-A[N/2-1]));
    }
  }

  cout << max(ans,ans2) << endl;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

#define INF 1<<30
#define LINF 1ll<<60ll
#define MOD 1000000007
#define pb(a) push_back(a)

#define _overload3(_1,_2,_3,_4,name,...) name
#define _rep(i,n) _repi(i,0,n)
#define _repi(i,a,b) for(int i=a, i##_len=(b); i<i##_len; ++i)
#define _repis(i,a,b,s) for(int i=a, i##_len(b); i<i##_len; i+=s)
#define REP(...) _overload3(__VA_ARGS__,_repis,_repi,_rep,)(__VA_ARGS__)

#define REPR(i, n) for(int i = n;i >= 0;--i)
#define REPARR(i, v) for(int i = 0;i < sz(v);++i)

#define all(vec) (vec.begin()),(vec.end())
#define sz(x) ((int)(x).size())
#define bit(n) (1ll<<(n))

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;}

#define YES(n) cout<<((n)?"YES":"NO")<<endl
#define Yes(n) cout<<((n)?"Yes":"No")<<endl
#define yes(n) cout<<((n)?"yes":"no")<<endl
#define poss(n) cout<<((n)?"possible":"impossible")<<endl
#define Poss(n) cout<<((n)?"Possible":"Impossible")<<endl
#define POSS(n) cout<<((n)?"POSSIBLE":"IMPOSSIBLE")<<endl



int main(){
    string s;
    cin>>s;
    vector<bool> x(26);
    REPARR(i,s){
        x[s[i]-'a']=!x[s[i]-'a'];
    }
    bool flag=true;
    REP(i,26){
        if(x[i])flag=false;
    }
    Yes(flag);
    return 0;
}


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

int main(){
    int64_t e;
    while(cin >> e && e > 0){
        int64_t x = 0, y = 0, z = 0, m = 1000;
		for (z = 0; z * z * z <= e; z++){
			for (y = 0; y * y + z * z * z <= e; y++){
			    x = e - y * y - z * z * z;
				m = min (m, x + y + z);
			}
		}
        cout << m << endl;
    }
    return 0;
}




Measured memory_bytes: 2988
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A,B,C,ans;
  cin >> A >> B >> C;
  int a = B / A;
  if(a < C){
    ans = a;
  }
  else{
    ans = C;
  }
  cout << ans << endl;
}

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

using namespace std;

#define ll long long

const int N = 102, K = 100005, M = 1000000007;
int dp[N][K], a[N];

int main() {
	int n, k;
	scanf("%d %d", &n, &k);
	for (int i = 1; i <= n; i++) {
		scanf("%d", &a[i]);
	}
	dp[0][0] = 1;
	for (int i = 1; i <= k; i++) {
		dp[0][i] += dp[0][i-1];
		dp[0][i] %= M;
	}
	for (int i = 1; i <= n; i++) {
		for (int j = 0; j <= k; j++) {
			dp[i][j] = (dp[i-1][j] - (j - a[i] - 1 < 0 ? 0 : dp[i-1][j-a[i]-1]) + M) % M;
			if (i < n) {
				dp[i][j] += dp[i][j-1];
				dp[i][j] %= M;
			}
		}
	}
	printf("%d", dp[n][k]);
	return 0;
}


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

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

    int max=0, num=0;
    for(int i = 0; i < 3; i++){
        if(S.at(i) == 'S') num = 0;
        else {  
            num ++;
            if(max < num) max = num;
        }
    }

    cout << max << endl;
}


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

int main(){
    int n, m, k;
    cin >> n >> m >> k;
    vector<ll> a(n+1), b(m+1);
    a[0] = b[0] = 0;
    int temp;
    for(int i = 0; i < n; i++){
        cin >> temp;
        a[i+1] = temp + a[i];
    }
    for(int i = 0; i < m; i++){
        cin >> temp;
        b[i+1] = temp + b[i];
    }
    int ans = 0;
    int j = m;
    for(int i = 0; i <= n; i++){
        if(a[i] > k) break;
        while(a[i] + b[j] > k && j > 0){
            j--;
        }
        ans = max(ans, i + j);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 6428
#ifndef DEBUG
#    pragma GCC optimize("O3,no-stack-protector")
#    pragma GCC optimize("unroll-loops")

#    if __cplusplus < 201703L
#        pragma GCC target("avx")
#    else
#        pragma GCC target("avx2")
#    endif

#endif

#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define dump(x) cout << x << endl
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REP(i, n) for (int i = 0, i##_len = (n); i <= i##_len; ++i)
#define rep3(i, l, r) for (int i = l, i##_len = (r); i < i##_len; ++i)
#define REP3(i, l, r) for (int i = l, i##_len = (r); i <= i##_len; ++i)
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
typedef int64_t Int;
typedef long double Ld;

using namespace std;
template <class T>
using Graph = vector<vector<T>>;

const Ld pi = M_PI;
const Int MOD = 1000000007;
const Int INF = 1LL << 62;

Int Floor(Int a, Int b) {
    return (a - (a % b)) / b;
}

template <class T>
inline bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

template <class T>
inline bool chmin(T &a, const T &b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}

template <typename T>
inline T Gcd(T a, T b) {
    T c;
    while (b) {
        c = b;
        b = a % b;
        a = c;
    }
    return a;
}

Int Lcm(Int a, Int b) {
    if (a < b) {
        swap(a, b);
    }

    return a / Gcd(a, b) * b;
}

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

    Int a, b;
    cin >> a >> b;

    if (a <= 0 && 0 <= b) {
        cout << "Zero" << endl;
    } else if (1 <= a) {
        cout << "Positive" << endl;
    } else if (b < 0) {
        if ((b - a + 1) % 2 == 0) {
            cout << "Positive" << endl;
        } else {
            cout << "Negative" << endl;
        }
    }

    return 0;
}


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

int main(){
  int h,w;
  cin>>h>>w;

  for(int i=0; i<h; i++){
    for(char c='A'; c<'A'+w; c++){
      string s;
      cin>>s;
      if(s=="snuke"){
        cout<<c<<i+1<<endl;
        goto end;
      }
    }
  }

  end:;
  
}

Measured memory_bytes: 256
#include<iostream>
#include<bits/stdc++.h>
#include<algorithm>
#include<math.h>
#include<vector> 
#include<map>
using namespace std ;
typedef  long long  ll ;
#define el "\n" 

int main(){
    ll a , b , c ,d , e= 0 , k   ; 
    cin >>a >> b >> c >>d ;
    e = max(a*c , a*d) ;
    k = max(b*c , b*d ) ;
    cout << max( k , e) << el ;
    return 0 ;
}

Measured memory_bytes: 3656
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#include <functional>
#include <map>
#include <iomanip>
#include <math.h> 
#include <stack>
#include <queue>
#include <bitset>
#include <cstdlib>
#include <tuple>
#include <cctype>
#include <ctype.h>
#include <set>
#include <sstream>
#include <time.h>
using namespace std;
#define int long long
#define rep(i,s,n) for(int i = s;i<n;i++)
#define repe(i,s,n) for(int i = s;i<=n;i++)
#define rrep(i,s,n) for(int i = (n)-1;i>=(s);i--)
#define all(v) (v).begin(),(v).end()
#define pb push_back
#define fi first
#define se second
#define chmin(a,b) a=min((a),(b))
#define chmax(a,b) a=max((a),(b))
#define l1 list[index]
#define l2 list[index - 1]
#define l3 list[index + 1]
#define iif(i,j) ((i<0 && j<0) || (i>0 && j>0)) ? true : false 
typedef long long ll;
typedef pair<int, int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
typedef pair<pint, int> P1;
typedef pair<int, pint> P2;
typedef pair<pint, pint> PP;
static const ll maxLL = (ll)1 << 62;
const ll MOD = 1000000007;
const ll INF = 1e18;
int ca[12] = { 31,28,31,30,31,30,31,31,30,31,30,31 };




signed main() {
	int n, cnt = 0, maxn = -999999999, minn = 9999999999;
	string s;

	cin >> s;



	if (s == "A") {
		cout << "T" << endl;
	}
	if (s == "C") {
		cout << "G" << endl;
	}
	if (s == "G") {
		cout << "C" << endl;
	}
	if (s == "T") {
		cout << "A" << endl;
	}








	



	return 0;
}

Measured memory_bytes: 256
import itertools
from collections import deque,defaultdict,Counter
from itertools import accumulate
import bisect
from heapq import heappop,heappush,heapify
import math
from copy import deepcopy
import queue
#import sympy as syp(素因数分解とか)
Mod = 1000000007
  
def sieve_of_eratosthenes(n):
    if not isinstance(n,int):
        raise TypeError("n is not int")
    if n<2:
        raise ValueError("n is not effective")
    prime = [1]*(n+1)
    for i in range(2,int(math.sqrt(n))+1):
        if prime[i] == 1:
            for j in range(2*i,n+1):
                if j%i == 0:
                    prime[j] = 0
    res = []
    for i in range(2,n+1):
        if prime[i] == 1:
            res.append(i)
    return res

 
class UnionFind:
    def __init__(self,n):
        self.parent = [i for i in range(n+1)]
        self.rank = [0 for i in range(n+1)]
    
    def findroot(self,x):
        if x == self.parent[x]:
            return x
        else:
            y = self.parent[x]
            y = self.findroot(self.parent[x])
            return y
    
    def union(self,x,y):
        px = self.findroot(x)
        py = self.findroot(y)
        if px < py:
            self.parent[y] = px
        else:
            self.parent[px] = py
 
    def same_group_or_no(self,x,y):
        return self.findroot(x) == self.findroot(y)

def main():  #startline-------------------------------------------
    h1, m1, h2, m2, k = map(int, input().split())
    if h1 > h2:
        h2 += 24
    h = h2 - h1
    if m1 > m2:
        m2 += 60
        h-=1
    m = m2 - m1
    print(h*60 + m - k)
if __name__ == "__main__":
    main() #endline===============================================

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

namespace ABC073A
{
    class Program
    {
        static void Main(string[] args)
        {
            string n;
            n = Console.ReadLine();
            if ((n[0] == '9') || (n[1] == '9'))
                Console.Write("Yes");
            else
                Console.WriteLine("No");
            Console.ReadKey();
        }
    }
}


Measured memory_bytes: 11092
#include <iostream>
#include <vector>
#include <limits>
#include <boost/range/irange.hpp>
#include <boost/range/adaptors.hpp>

using namespace std;
using namespace boost;
using uint = unsigned int;
using ll = long long int;
using ull = unsigned long long int;

int main() {
    uint N, K;
    cin >> N >> K;
    vector<ll> xs(N, 0);
    for (auto &&i: irange(0U, N)){
        cin >> xs.at(i);
    }
    ll sum{0};
    for (auto &&i: irange(0U, N)){
        ll x{xs.at(i)};
        sum += min(x, K-x);
    }
    cout << sum*2;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    char d;
    int dd=0;
    int ii=0;
    string owo;
    cin>>owo;

    for(int i=0;i<owo.size();i++)
    {
        d=owo[i];
        for(int j=i+1;j<=owo.size()-1;j++)
        {

            if(owo[j]!=d)
                 dd++;
            else
                 ii++;            
        }

                
    }
    if(dd==4&&ii==2)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;

    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		
		Scanner scan = new Scanner(System.in);
		int w = scan.nextInt();
		int h = scan.nextInt();
		int x = scan.nextInt();
		int y = scan.nextInt();
		int r = scan.nextInt();
		
		if((x - r) < 0 || (x + r) > w){
			System.out.println("No");
		}else if((y - r) < 0 || (y + r) > h){
			System.out.println("No");
		}else{
			System.out.println("Yes");
		}
	}

}

Measured memory_bytes: 26348
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(ll)n;i++)
#define rep1(i,n) for(int i=1;i<=(int)n;i++)
#define rep2(i,j,n) for(int j=i;j<n;j++)
#define rep3(i,j,n) for(int j=i;j<=n;j++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define sp(n) cout << fixed << setprecision(n)
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; }
typedef long long ll;
using namespace std;
int main(void){
    ll n,k;cin>>n>>k;
    vector<ll>x(n);
    rep(i,n) cin>>x[i];
    ll res=1e+18;
    for(ll i=0;i+k<=n;i++){
        ll now1=abs(x[i])+abs(x[i]-x[k+i-1]);
        ll now2=abs(x[k+i-1])+abs(x[i]-x[k+i-1]);
        res=min(res,min(now1,now2));
    }
    cout<<res<<endl;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define fi first
#define se second
typedef pair<ll,ll> P;
using VP = vector<P>; using VVP = vector<VP>;
using VI = vector<int>; using VVI = vector<VI>; using VVVI = vector<VVI>;
const int inf=1e9+7;
const ll INF=1LL<<61;
const ll mod=1e9+7;

int h,w;
VVI s(25,VI(25,0));
VVI v;
int dx[4]={-1,0,1,0};
int dy[4]={0,-1,0,1};

bool val(int i,int j){
  if(i>=0&&i<h&&j>=0&&j<w&&s[i][j]==0) return 1;
  return 0;
}


int main(){
  int i,j;
  cin>>h>>w;
  int ans=0;
  for(i=0;i<h;i++){
    for(j=0;j<w;j++){
      char c;
      cin>>c;
      if(c=='#') s[i][j]=1;
    }
  }
  for(i=0;i<h;i++){
    for(j=0;j<w;j++){
      if(s[i][j]==1) continue;
      v=VVI(25,VI(25,-1));
      v[i][j]=0;
      queue<P> q;
      q.push(P(i,j));
      while(!q.empty()){
        int x=q.front().fi;
        int y=q.front().se;
        q.pop();
        for(int k=0;k<4;k++){
          if(val(x+dx[k],y+dy[k])&&v[x+dx[k]][y+dy[k]]==-1){
            q.push(P(x+dx[k],y+dy[k]));
            v[x+dx[k]][y+dy[k]]=v[x][y]+1;
            ans=max(ans,v[x][y]+1);
          }
        }
      }
    }  
  }
  cout<<ans<<endl;


  return 0;
}


Measured memory_bytes: 256
using System;
class Program{
	static void Main(){
		const int mod=1000000007;
		int n=int.Parse(Console.ReadLine());
		long[] t=Array.ConvertAll(Console.ReadLine().Split(),long.Parse);
		long[] a=Array.ConvertAll(Console.ReadLine().Split(),long.Parse);
		long m=Array.FindIndex(a,q=>q<a[0]),ans=0;
		if(t[n-1]==a[0]&&(m==-1||t[m-1]==a[0])){
			ans=1;
			for(int i=1;i<n-1;i++){
				if(t[i]==t[i-1]&&a[i]==a[i+1]){ans=(ans*Math.Min(t[i],a[i]))%mod;}
			}
		}
		Console.WriteLine(ans);
	}

}

Measured memory_bytes: 35788
#include <bits/stdc++.h>
 
#define rep(i, x, n) for(int i = (x);i < (n);i ++)
#define reps(i, x, n) for(int i = (x);i <= (n);i ++)
#define lol long long
#define SUM(n) (((n)+1)*(n)/2) //1〜nまでの総和を求める式
#define mp make_pair
#define fi first
#define se second
#define pu push_back
#define SYOU(x) fixed<<setprecision(x+1) //小数点桁数を指定する
#define abs(x,y) (max(x,y)-min(x,y))
#define all(v) v.begin(),v.end()
#define UPDigit(a,b) ((a+b-1)/b) //小数点切り上げ
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const int MOD = int(1e9)+7; 
using namespace std;
using pii = pair<lol, lol>;
typedef vector<int> vit;
//八方向を見るのに使うと便利(楽)
const int dy[] = {0, 1, 0, -1, -1, 1, 1, -1};
const int dx[] = {1, 0, -1, 0, 1, 1, -1, -1};

//最大公約数
lol gcd(lol x, lol y){ return (y != 0 ? gcd(y, x % y) : x); }
//最小公倍数
lol lcm(lol x, lol y){ return ((x * y) / gcd(max(x, y), min(x, y))); }

signed main(void){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  int n, m;
  cin >> n >> m;
  n = min(n, m);
  int x[m + 5];
  rep(i, 0, m){
    cin >> x[i];
  }
  sort(x, x + m);
  if(m == 1){
    cout << "0\n";
    return 0;
  }
  priority_queue<int> que;
  rep(i, 1, m){
    que.push(abs(x[i - 1], x[i]));
  }
  rep(i, 1, n){
    que.pop();
  }
  lol ans = 0;
  while(!que.empty()){
    ans += que.top();
    que.pop();
  }
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 4212
n=gets.to_i
s=gets.split.map &:to_i
h1=Hash.new(0);h2=Hash.new(0)
for i in 0...n
 i.even? ? h1[s[i]]+=1:h2[s[i]]+=1
end
ans1=h1.sort_by{|k,v|-v}.shift(2)
ans2=h2.sort_by{|k,v|-v}.shift(2)
kai1=ans1[0][1]-n/2==0? 0:ans1[1][1]
kai2=ans2[0][1]-n/2==0? 0:ans2[1][1]
if ans1[0][0]==ans2[0][0]
  puts n-([ans1[0][1]+kai1,ans2[0][1]+kai2].max)
else
  puts n-ans1[0][1]-ans2[0][1]
end


Measured memory_bytes: 27052
#include <iostream>
#include <cmath>

using namespace std;

int main(void) {
  long long int N, i, ans, min;
  cin >> N;

  min = N;

  for(i=1;i<=sqrt(N);i++) {
    if (N % i == 0) {
      ans = i + (N / i) - 2;
      if (ans < min) {
        min = ans;
      }
    }
  }
  cout << min << endl;
}


Measured memory_bytes: 256
// ------------------------------------
// Date:2018/ 3/ 2
// Problem:AOJ DPL 0-1 Knapsack Problem 1_b.cpp
//
// ------------------------------------

#include <bits/stdc++.h>

using namespace std;

#define EACH(i,a) for (auto&& i : a)
#define FOR(i,a,b) for(int i=(int)a;i<(int)b;++i)
#define RFOR(i,a,b) for(int i=(int)b-1;i>=(int)a;--i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()
#define debug(x) cerr << #x << ":" << x << endl

typedef long long ll;

//static const int MOD = 1000000007;

// dp[num][weight]
int dp[101][10101];

// v:value / w:weight
int v[1010];
int w[1010];

// N:品物の個数 / W:ナップサックの容量
int N, W;

int solve(int num, int weight)
{
  if (dp[num][weight] != 0) {
    // チェックしたことのあるやつ
    return dp[num][weight];
  }
  int ret;
  if (num == N) {
    // 全てチェック済み
    ret = 0;
  } else if (weight < w[num]) {
    // これ以上はいらん
    ret = solve(num + 1, weight);
  } else {
    // max(入れない or 入れる)
    ret = max(solve(num + 1, weight),
              solve(num + 1, weight - w[num]) + v[num]);
  }
  return dp[num][weight] = ret;
}

int main()
{
  // 初期化
  memset(dp, 0, sizeof(dp));
  memset(v, 0, sizeof(v));
  memset(w, 0, sizeof(w));
  scanf("%d %d", &N, &W);
  REP(i, N) {
    scanf("%d %d", &v[i], &w[i]);
  }
  
  int ans = solve(0, W);
  printf("%d\n", ans);
  
  return 0;
}



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

int main(){
 string s;
  cin >> s;
  int q = 0;
  if(s == "MON"){q =6;}else 
  if(s == "TUE"){q =5;}else 
  if(s == "WED"){q =4;}else 
  if(s == "THU"){q =3;}else
  if(s == "FRI"){q =2;}else 
  if(s == "SAT"){q =1;}else
  if(s == "SUN"){q =7;} 
  cout << q << endl;
}

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

string s;

vector<pair<int,int> > event;
vector<int> v[26];

int bit[300001];

void add(int pos,int val){
	for(int i=pos;i<=300000;i+=i&-i)
		bit[i]+=val;
}

int sum(int pos){
	int res=0;
	for(int i=pos;i>0;i-=i&-i)
		res+=bit[i];
	return res;
}


int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cin>>s;
	int n=s.size();
	s.insert(0," ");
	for(int i=1;i<=n;i++)
		v[s[i]-'a'].push_back(i);
	int cnt=0;
	for(int i=0;i<26;i++){
		if(v[i].size()&1)
			cnt++;
		for(int j=0;(int) v[i].size()-j-1>j;j++)
			event.emplace_back(make_pair(v[i][j],v[i][v[i].size()-j-1]));
	}
	sort(event.begin(),event.end());
	if(cnt>1){
		cout<<-1<<endl;
		return 0;
	}
	long long int ans=0;
	for(int i=1;i<=n/2;i++){
		ans+=n-i+1-(event[i-1].second-sum(event[i-1].second-1));
		add(event[i-1].second,1);
	}
	if(cnt==1){
		for(int i=0;i<26;i++)
			if(v[i].size()&1)
				ans+=(n+1)/2-(v[i][v[i].size()/2]-sum(v[i][v[i].size()/2]));
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 3468
using System;
using System.Collections.Generic;

namespace ConsoleApplication2
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] strList = null; 
            var fullCard = new List<int> { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 };
            var spadeCard = new List<int>();
            var heartCard = new List<int>();
            var cloverCard = new List<int>();
            var diaCard = new List<int>();

            int someCard = int.Parse(Console.ReadLine());

            int count = 0;
            while (true)
            {
                String s = Console.ReadLine();
                count++;
                strList = s.Split();
                string simbol = strList[0];
                int cardNum = int.Parse(strList[1]);

                switch (simbol)
                {
                    case "S":
                        spadeCard.Add(cardNum);
                        break;
                    case "H":
                        heartCard.Add(cardNum);
                        break;
                    case "C":
                        cloverCard.Add(cardNum);
                        break;
                    case "D":
                        diaCard.Add(cardNum);
                        break;
                }
                if (count == someCard)
                {
                    break;
                }
            }

            foreach (int value in fullCard)
            {
                if (!spadeCard.Contains(value))
                {
                    Console.WriteLine("S " + value);
                }
            }

            foreach (int value in fullCard)
            {
                if (!heartCard.Contains(value))
                {
                    Console.WriteLine("H " + value);
                }
            }

            foreach (int value in fullCard)
            {
                if (!cloverCard.Contains(value))
                {
                    Console.WriteLine("C " + value);
                }
            }

            foreach (int value in fullCard)
            {
                if (!diaCard.Contains(value))
                {
                    Console.WriteLine("D " + value);
                }
            }
        }
    }
}


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

using namespace std;

#define all(c) (c).begin(), (c).end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

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

int N;
int f(int n) { return n * (n - 1) / 2; }
int calc(int s, int t) { return f(t + 1) - f(s); }
int main() {
    while (cin >> N, N) {
        int ans = 0;
        rep(i, N + 1) rep(j, N + 1) if (i && i < j) {
            if (N == calc(i, j)) ans++;
        }
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 3080
#include<cstdio>
#include<algorithm>
using namespace std;
int main(void)
{
	 int h,w,a[26][26],MIN,sum,i,j,k,l,b,c;
	 scanf("%d %d",&h,&w);
	 for(i=1;i<=h;i++){
		 for(j=1;j<=w;j++){
			 scanf("%d",&a[i][j]);
		 }
	 }
	 MIN=1562501;
	 for(i=1;i<=h;i++){
		 for(j=1;j<=w;j++){
			 sum=0;
			 for(k=1;k<=h;k++){
				 for(l=1;l<=w;l++){
					b=k-i;
					c=l-j;
					if(b<0){
						b=-b;
					}
					if(c<0){
						c=-c;
					}
					sum+=min(a[k][l]*b,a[k][l]*c);
				 }
			 }
			 MIN=min(MIN,sum);
		 }
	 }
	 printf("%d\n",MIN);
	 return 0;
}


Measured memory_bytes: 2732
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define fi first
#define se second

#define PI acos(-1.0)
#define INF 1000000007

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<double, double> PD;
typedef pair<string, ll> PS;
typedef vector<ll> V;

ll a;
double v, h;

int main(){
	while (cin >> v){
		h = 4.9*(v / 9.8)*(v / 9.8);
		a = (h + 5) / 5;
		if (h + 5 % 5 != 0)a++;
		cout << a << endl;
	}
}

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

typedef long long llint;
typedef long double ld;

#define inf 1e18
#define mod 1000000007
priority_queue<llint,vector<llint>,greater<llint> > que;
priority_queue<llint> Que;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int ans=0;
llint n;
void dfs(llint x,int a,int b,int c){
  if(x>n)return;
  if(a&&b&&c)ans++;
  dfs(x*10+3,1,b,c);
  dfs(x*10+5,a,1,c);
  dfs(x*10+7,a,b,1);
}

void solve(){
  cin >> n;
  dfs(0,0,0,0);
  cout << ans << endl;
}

int main(){
  solve();
  return 0;
}


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

int main(){
    int N;
    cin >> N;
    vector<int> H;
    for (int i = 0; i < N; i++){
        int hi;
        cin >> hi;
        H.push_back(hi);
    }
    // for (auto v: H) cout << v << endl;
    int k = 0;
    int c_max = 0;
    while (k < N - 1) {
        int c_loc = 0;
        while (k < N - 1) {
            // cout << c_loc << endl;
            if (H[k] >= H[k + 1]) {
                c_loc++;
                k++;
            } else {
                
                k++;
                break;
            }
        }
        if (c_loc > c_max) {
                    c_max = c_loc;
        }
        // cout << c_loc << endl;
    }
    cout << c_max << endl;
}

Measured memory_bytes: 892
#include<iostream>
#include<string>
#include<map>
#include<algorithm>
#include<vector>
#include<iomanip>
using namespace std;

int main() {
	int N; cin >> N;
	string w[110];
	for (int i = 0; i < N; i++) {
		cin >> w[i];
	}
	bool ans = true;
	for (int i = 0; i < N - 1; i++) {
		if (w[i][w[i].length() - 1] != w[i + 1][0]) {
			ans = false;
		}
	}
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < i; j++) {
			if (w[i] == w[j]) {
				ans = false;
			}
		}
	}
	if (ans) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
/*
      HET PAGHADAR
      DA-IICT
      @HET262
*/
 
#include<bits/stdc++.h>
using namespace std;
typedef long double ld;
typedef long long ll;
typedef vector<ll> vec; 
#define inf LLONG_MAX
#define bp __builtin_popcountll
#define pb push_back
#define ff first
#define ss second
#define P pair<ll,ll>
#define N 100005
#define LG 20
#define mod 1000000007
#define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

int32_t main()
{
      FAST;
      
      ll a,b,c;
      cin>>a>>b>>c;
      
      set<ll> s;
      
      s.insert(a);
      s.insert(b);
      s.insert(c);
      
      if(s.size()==2)
            cout<<"Yes";
      else
            cout<<"No";
      
      
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <utility>
using namespace std;

typedef long long ll;
ll MOD = 1e9+7;

int a[100];

int main()
{
	int n,x;
	int ans=0;
	cin>>n>>x;
	for(int i=0;i<n;i++)
		cin>>a[i];
	sort(a,a+n);
	for(int i=0;i<n-1;i++)
	{
		if(x>=a[i])
		{
			ans++;
			x-=a[i];
		}
	}
	if(x==a[n-1])
		ans++;
	
	cout<<ans<<endl;
	return 0;
}

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

#define IS_DEBUG true

#define DEBUG_OUTPUT(X) if (IS_DEBUG) cout << X << endl
#define RESULT_OUTPUT(X) cout << X << endl

int main()
{
	int N;
	cin >> N;
	int max = 0;
  	int sum = 0;
	for (int i = 0; i < N; i++)
	{
		int l;
		cin >> l;
		if (max < l)
          max = l;
      sum+= l;
      
	}
	
	sum -= max;
  if(max >= sum)
    RESULT_OUTPUT("No");
  else
    RESULT_OUTPUT("Yes");


	return 0;
}

Measured memory_bytes: 256
from math import sqrt,cos,atan2

class Ufo:
	def __init__(self,px,py,d,vd,ui):
		self.pd=sqrt(px**2+py**2)
		self.px=float(px)
		self.py=float(py)
		self.fpd=self.pd
		self.fpx=self.px
		self.fpy=self.py
		self.ex=self.fpx/self.fpd
		self.ey=self.fpy/self.fpd
		self.d=float(d)
		self.vd=float(vd)
		self.vx=-self.vd*self.ex
		self.vy=-self.vd*self.ey
		self.i=ui
	def move(self):
		self.pd -= self.vd
		self.px += self.vx
		self.py += self.vy



while True:
	R,ul=tuple(map(int,raw_input().split()))
	if(R==0 and ul==0): break
	us=[]
	for ui in xrange(ul):
		px,py,d,vd = tuple(map(int,raw_input().split()))
		u = Ufo(px,py,d,vd,ui)
		us.append(u)

	re=0
	while True:
		for u in us: u.move()
		us.sort(key=lambda u: u.pd)

		for u in us[:]:
			if u.pd<=R:
				re+=1
				us.remove(u)
				#print u.i, "due to invade"
				continue
			else:
				break
		if len(us)==0: break

		neu=us.pop(0)
		#print "focus",neu.i
		#print neu.i,"due to hit"

		for u in us[:]:
			d = u.pd*abs(neu.ex*u.ey-neu.ey*u.ex)	#u kara laser ni orosita suisen no nagasa
			if d<u.d:
				if u.pd*cos(atan2(u.ey,u.ex)-atan2(neu.ey,neu.ex)) + sqrt(u.d**2-d**2) > R:
					us.remove(u)
					#print u.i, "due to hit"
		if len(us)==0: break

	print re

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

int main() {
  int n, m;
  cin >> n;
  vector<int> v(n);
  rep(i, n) cin >> v[i];
  m = v[0];
  rep(i, n-1) m = __gcd(m, v[i+1]);
  cout << m << endl;
  return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <queue>
#include <deque>

using namespace std;

int main(){
    int a, b; cin >> a >> b;
    if(1 <= a && a <= 9 && 1 <= b && b <= 9){
        cout << a*b << endl;
    } else{
        cout << -1 << endl;
    }
    return 0;
}


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

// #define int long long
#define rep(i, n) for (long long i = (long long)(0); i < (long long)(n); ++i)
#define reps(i, n) for (long long i = (long long)(1); i <= (long long)(n); ++i)
#define rrep(i, n) for (long long i = ((long long)(n)-1); i >= 0; i--)
#define rreps(i, n) for (long long i = ((long long)(n)); i > 0; i--)
#define irep(i, m, n) for (long long i = (long long)(m); i < (long long)(n); ++i)
#define ireps(i, m, n) for (long long i = (long long)(m); i <= (long long)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) long long(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;
using vtp = vector<tuple<ll,ll,ll>>;
using vb = vector<bool>;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const ll INF = 1e9;
const ll MOD = 1e9+7;
const ll LINF = 1e18;


signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  ll n; cin>>n;
  ll min=LINF;
  rep(i,5){
    ll a; cin>>a;
    chmin(min,a);
  }
  
  cout<<4+(n+min-1)/min<<endl;
  
  
}

Measured memory_bytes: 256
N, M = map(int, input().split())
a = [int(input()) for i in range(M)]
step = [True]*(N+1)
dp = [0]*(N+1)
dp[0] = 1
dp[1] = 1 if step[1] else 0


for i in range(M):
    step[a[i]] = False

for i in range(2, N+1):
    if step[i]:
        if step[i-1]:
            dp[i] += dp[i-1]
        if step[i-2]:
            dp[i] += dp[i-2]
        dp[i] %= 1000000007

print(dp[-1])

Measured memory_bytes: 50904
#include <stdio.h>
#include <algorithm>
#include <iostream>
using namespace std;

int main () {
	int n;
	cin >> n;
	if (n == 3 || n == 5 || n == 7) {
		cout << "YES" << endl;
	} else {
		cout << "NO" << endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
#define int long long
#define hell 998244353 
#define endl "\n"

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


int32_t main()
{
    int n;

    cin>>n;

    int maxi=INT_MIN;
    int x;
    for(int i=0;i<n;i++)
    {
        cin>>x;
        if(x>maxi)
            maxi = x;

        if(maxi-x>1){
            cout<<"No";
            return 0;
        }
    }

    cout<<"Yes";

    return 0;
}   

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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
#define CLR(t,v) memset(t,(v),sizeof(t))
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}


int nextInt() { int x; scanf("%d", &x); return x;}

const int MAX_N = 110;
int N;
int a[MAX_N];

int solve(int m) {
  int res = 0;
  REP(i, N) res += (a[i] - m) * (a[i] - m);
  return res;
}

int main2() {
  N = nextInt();
  REP(i, N) a[i] = nextInt();
  int ans = solve(0);
  for (int i = -200; i <= 200; i++) chmin(ans, solve(i));
  cout << ans << endl;
  return 0;
}

int main() {
  for (;!cin.eof();cin>>ws)
    main2();
  return 0;
}


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

int main()
{
    int n,m;
    while(cin >> n >> m && n || m)
    {
        vector<int> data(n);
        int i=1;

        for(int i=0; i<n; i++){
            data[i] = i+1;
        }
        for(vector<int>::iterator it = data.begin(); data.size() != 1;){
            if(it == data.end()){
                it = data.begin();
            }
            if(i%m == 0){
                it = data.erase(it);
            }else{
                it++;
            }
            i++;
        }
        cout << data[0] << endl;
    }

    return 0;
}

Measured memory_bytes: 1216