akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define REPR(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 ALL(c) (c).begin(), (c).end()
#define valid(y,x,h,w) (0<=y&&y<h&&0<=x&&x<w)
#define tpl(...) make_tuple(__VA_ARGS__)
const int INF = 0x3f3f3f3f;
const double EPS = 1e-8;
const double PI = acos(-1);
const int dy[] = {-1,0,1,0};
const int dx[] = {0,1,0,-1};
typedef long long ll;
typedef pair<int,int> pii;
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; }
template<typename Ch,typename Tr,typename C,typename=decltype(begin(C()))>basic_ostream<Ch,Tr>& operator<<(basic_ostream<Ch,Tr>&os,
const C& c){os<<'[';for(auto i=begin(c);i!=end(c);++i)os<<(i==begin(c)?"":" ")<<*i;return os<<']';}
template<class S,class T>ostream&operator<<(ostream &o,const pair<S,T>&t){return o<<'('<<t.first<<','<<t.second<<')';}
template<int N,class Tp>void output(ostream&,const Tp&){}
template<int N,class Tp,class,class ...Ts>void output(ostream &o,const Tp&t){if(N)o<<',';o<<get<N>(t);output<N+1,Tp,Ts...>(o,t);}
template<class ...Ts>ostream&operator<<(ostream&o,const tuple<Ts...>&t){o<<'(';output<0,tuple<Ts...>,Ts...>(o,t);return o<<')';}
template<class T>void output(T t,char z=10){if(t<0)t=-t,putchar(45);int c[20];
int k=0;while(t)c[k++]=t%10,t/=10;for(k||(c[k++]=0);k;)putchar(c[--k]^48);putchar(z);}
template<class T>void outputs(T t){output(t);}
template<class S,class ...T>void outputs(S a,T...t){output(a,32);outputs(t...);}
template<class T>void output(T *a,int n){REP(i,n)cout<<a[i]<<(i!=n-1?',':'\n');}
template<class T>void output(T *a,int n,int m){REP(i,n)output(a[i],m);}
template<class T>bool input(T &t){int n=1,c;for(t=0;!isdigit(c=getchar())&&~c&&c-45;);
if(!~c)return 0;for(c-45&&(n=0,t=c^48);isdigit(c=getchar());)t=10*t+c-48;t=n?-t:t;return 1;}
template<class S,class ...T>bool input(S&a,T&...t){input(a);return input(t...);}
template<class T>bool inputs(T *a, int n) { REP(i,n) if(!input(a[i])) return 0; return 1;}

int main() {
  int a,b;
  while(cin>>a>>b) {
    cout << (max({a+b,a-b,a*b})) << endl;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = s; i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << '\n';
#define CFYN(n) cout << ( (n) ? "YES":"NO") << '\n';
#define OUT(n) cout << (n) << '\n';
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;

int main(void)
{
    IOS
    int n; cin >> n;
    vector<int> v(n);
    bool ans = true;
    bool down = false;
    REP(i,n) {
        cin >> v[i];
        if (i != 0) {
            if (v[i-1] -2 >= v[i]) ans = false;
            if (i > 0) {
                if (down) {
                    if (v[i-1] > v[i]) ans = false;
                    if (v[i-1] < v[i]) down = false;
                } else {
                    if (v[i-1] -1 == v[i]) down = true;
                }

            }
        }
    }

    ATYN(ans)

    return 0;
}

Measured memory_bytes: 640
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using static System.Console;
using static System.Math;
using static MyIO;
using static MyUtil;

public class A
{
	public static void Main() => (new Solver()).Solve();
}

public class Solver
{
	public void Solve()
	{
		int K = GetInt();
		int X = GetInt();
		WriteLine(500 * K >= X ? "Yes" : "No");
	}
}

public static class MyIO
{
	private static string[] args = null;
	private static int num = -1;
	private static int used = -1;

	private static string getArg()
	{
		if(used == num)
		{
			args = Console.ReadLine().Split(' ');
			num = args.Length;
			used = 0;
		}
		return args[used++];
	}

	public static int GetInt() => int.Parse(getArg());
	public static long GetLong() => long.Parse(getArg());
	public static double GetDouble() => double.Parse(getArg());
	public static decimal GetDecimal() => decimal.Parse(getArg());
	public static string GetString() => getArg();
	public static char GetChar() => getArg()[0];
	public static int[] GetInts(long N) => Enumerable.Range(0, (int)N).Select(_ => GetInt()).ToArray();
	public static long[] GetLongs(long N) => Enumerable.Range(0, (int)N).Select(_ => GetLong()).ToArray();
	public static double[] GetDoubles(long N) => Enumerable.Range(0, (int)N).Select(_ => GetDouble()).ToArray();
	public static decimal[] GetDecimals(long N) => Enumerable.Range(0, (int)N).Select(_ => GetDecimal()).ToArray();
	public static string[] GetStrings(long N) => Enumerable.Range(0, (int)N).Select(_ => GetString()).ToArray();
}

public static class MyUtil
{
	public static void chmax<T>(ref T x, T y) where T : IComparable<T>
	{
		if(x.CompareTo(y) < 0)
			x = y;
	}

	public static void chmin<T>(ref T x, T y) where T : IComparable<T>
	{
		if(x.CompareTo(y) > 0)
			x = y;
	}

	public static void swap<T>(ref T x, ref T y)
	{
		T tmp = x;
		x = y;
		y = tmp;
	}
}

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

const int V[5] = {5, 4, 3, 2, 1};

int main()
{
  int X;
  cin >> X;
  int num = X / 100;
  int rem = X % 100;
  for (int i = 0; i < 6; i++)
  {
    int t = rem / V[i];
    num -= t;
    rem -= V[i] * t;
  }
  if (num >= 0)
    cout << 1 << endl;
  else
    cout << 0 << endl;
}


Measured memory_bytes: 256
using System;
using System.IO;
using System.Linq;

namespace ABC118D_2
{
    // ABC118Dを漸化式で解く
    class Program
    {
        private static readonly int[] requiredMatches = { 2, 5, 5, 4, 5, 6, 3, 7, 6 };

        static void Main(string[] args)
        {
            if (args.Length > 0)
            {
                Console.SetIn(new StreamReader(args[0]));
            }

            new Program().Solve();
        }

        void Solve()
        {
            // 入力
            var temp = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            var numMatches = temp[0];
            var numNumbers = temp[1];
            var availableNumbers = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            var maxNumber = new string[numMatches + 1];

            for (int i = 0; i <= numMatches; i++)
            {
                maxNumber[i] = "";

                for (int j = 0; j < availableNumbers.Length; j++)
                {
                    var candidate = availableNumbers[j];

                    if (i - requiredMatches[candidate - 1] < 0)
                    {
                        continue;
                    }

                    if (maxNumber[i - requiredMatches[candidate - 1]] == "")
                    {
                        if (i != requiredMatches[candidate - 1])
                        {
                            continue;
                        }
                    }

                    var number = candidate + maxNumber[i - requiredMatches[candidate - 1]];
                    maxNumber[i] = GetMax(number, maxNumber[i]);
                }

                Console.Error.WriteLine(i + " : " + maxNumber[i]);
            }

            Console.WriteLine(maxNumber[numMatches]);
        }
        string GetMax(string a, string b)
        {
            if (a.Length > b.Length)
            {
                return a;
            }
            else if (a.Length < b.Length)
            {
                return b;
            }
            else
            {
                return a.CompareTo(b) > 0 ? a : b;
            }
        }
    }
}


Measured memory_bytes: 98344
#include <iostream>
// #include <algorithm>

using namespace std;

void dfs(int i, int j, int row, int col, char fruit, char orchard[][100]) {
    orchard[i][j] = '.';
    if(i > 0 && orchard[i-1][j] == fruit)
        dfs(i-1, j, row, col, fruit, orchard);
    if(i < row-1 && orchard[i+1][j] == fruit)
        dfs(i+1, j, row, col, fruit, orchard);
    if(j > 0 && orchard[i][j-1] == fruit)
        dfs(i, j-1, row, col, fruit, orchard);
    if(j < col-1 && orchard[i][j+1] == fruit)
        dfs(i, j+1, row, col, fruit, orchard);
}

int main() {
    char orchard[100][100];
    while(1) {
        int col, row, num = 0;
        cin >> row >> col;
        if(col*row == 0)
            break;
        for(int i = 0; i < row; i++) {
            for(int j = 0; j < col; j++) {
                cin >> orchard[i][j];
            }
        }

        for(int i = 0; i < row; i++) {
            for(int j = 0; j < col; j++) {
                if(orchard[i][j] != '.') {
                    num++;
                    dfs(i, j, row, col, orchard[i][j], orchard);
                }
            }
        }
        cout << num << endl;
    }
    return 0;
}


Measured memory_bytes: 3876
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cstring>
#include <map>
#include <queue>
#include <cmath>
#include <complex> // complex<double> a(1.2 , 2.3);// real(): 1.2, imag()2.3
using namespace std;

#define MOD 1000000007
#define ll long long
#define ld long double
#define FOR(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rmsame(a) sort(all(a)),a.erase(unique(all(a)), a.end())
#define rmvector(a,b) rep(i,a.size())rep(j,b.size())if(a[i]==b[j]){a.erase(a.begin()+i);i--;break;}
template<typename X> bool exist(vector<X> vec, X item){return find(all(vec), item)!=vec.end();}

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

  ll N, Z, W;
  cin >> N >> Z >> W;
  vector<ll> a;
  rep(i,N){
    ll inp; cin >> inp;
    a.pb(inp);
  }
  if(N==1) cout << abs(a[0]-W) << endl;
  else
    cout << max(abs(a[a.size()-2]-a[a.size()-1]), abs(a[a.size()-1]-W)) << endl;

  //cout << fixed << setprecision(16) << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <algorithm>

using namespace std;
typedef long long LL;

// import here

int main(){
    LL n;
    cin >> n;
    LL left = 1;
    LL right = n;
    cout << 0 << endl;
    string last;
    cin >> last;
    if(last == "Vacant"){
        return 0;
    }
    string left_s = last;
    for(int i = 0; i < 19; ++i){
        LL middle = (left + right) / 2;
        cout << middle << endl;
        string rep;
        cin >> rep;
        if(rep == "Vacant") break;
        LL flag = 0;
        if(left_s != rep) flag = 1;
        if((middle - left + flag) % 2 == 0){
            right = middle;
        }else{
            left = middle+1;
            left_s = rep;
        }
    }
    return 0;
}


Measured memory_bytes: 852
#include<iostream>
using namespace std;
 
int main(){
    int a, b;
     
    cin>> a >> b;
     
    if ( a < b ) cout << "a < b" << endl;
    else if ( a > b ) cout << "a > b" << endl;
    else cout << "a == b" << endl;
 
    return 0;
}

Measured memory_bytes: 3080
#include <cstdint>
#include <iostream>

using namespace std;

int main()
{
    int64_t n, duration;
    cin >> n >> duration;

    int64_t total = 0;
    int64_t last_end = -1;

    for (int64_t i = 0; i < n; i += 1) {
        int64_t time;
        cin >> time;

        total += min(duration, time + duration - last_end);
        last_end = time + duration;
    }

    cout << total << "\n";
    return 0;
}


Measured memory_bytes: 256
// In The Name Of The Queen
#include<bits/stdc++.h>
using namespace std;
const int N = 2000005;
int n, C[10][10];
int main()
{
    int a, b;
    scanf("%d%d", &a, &b);
    if (b == a)
        puts("Yes");
    else
        puts("No");
    return 0;
}

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

using namespace std;

vector<int> init_L () {
  int N;
  cin >> N;

  vector<int> L;

  for (int i = 0; i < N; i++) {
    int x;
    cin >> x;
    L.push_back(x);
  }

  sort(L.begin(), L.end());

  return L;
}

int main () {
  int cnt = 0;
  vector<int> L = init_L();

  for (auto ia = L.begin(); ia <= L.end() - 3; ia++) {
    for (auto ib = ia + 1; ib <= L.end() - 2; ib++) {
      auto il = (L.back() < *ia + *ib)
        ? L.end()
        : lower_bound(ib, L.end(), *ia + *ib);
      cnt += max((int)distance(ib + 1, il - 1) + 1, 0);
    }
  }

  cout << cnt << "\n";
}


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

int main() {
    unsigned long n, m;

    cin >> n >> m;
    if(n == 1 && m == 1) cout << 1 << endl;
    else if(n == 1) cout << m-2 << endl;
    else if(m == 1) cout << n-2 << endl;
    else cout << (n-2)*(m-2) << endl;
}

Measured memory_bytes: 384
#include <iostream>
#include <vector>
using namespace std;
#define int long long

signed main() {
    int N, K;
    cin >> N >> K;
    long long ans = 0;
    for (int b = 1; b <= N; ++b) {
        int p = N/b, r = N%b;
        int res = max(b-K, 0LL)*p;
        int last = max(r-K+1, 0LL);
        ans += res+last;
        if (K == 0) ans--;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
def main():
    import sys
    from collections import deque
    from operator import itemgetter
    g=itemgetter(0)
    b=sys.stdin.buffer
    n,d,a=map(int,b.readline().split())
    m=map(int,b.read().split())
    q=deque()
    popleft,append=q.popleft,q.append
    s=b=0
    for x,h in sorted(zip(m,m),key=g):
        while q and g(g(q))<x:b-=popleft()[1]
        if h>b:
            t=(b-h)//a
            s-=t
            t*=a
            b-=t
            append((x+d+d,-t))
    print(s)
main()

Measured memory_bytes: 56136
#include "bits/stdc++.h"

using namespace std;

#define ll           long long

static const int maxn = 1000 + 5;
static const ll mod = 1e9 + 7;

int dr[] = {+0, -1, +0, +1};
int dc[] = {-1, +0, +1, +0};

char grid[maxn][maxn];
ll dp[maxn][maxn];
bool memoize[maxn][maxn];

int row, column;

inline bool inside(int r, int c)
{
      return (r >= 1 && r <= row && c >= 1 && c <= column);
}

inline ll solve(int r, int c)
{
      if (r == row && c == column) return 1;
      ll &ret = dp[r][c];
      bool &mem = memoize[r][c];
      if (mem) return ret;
      mem = 1;
      ret = 0;
      for (int i = 2; i < 4; i++)
      {
            int rr = r + dr[i];
            int cc = c + dc[i];
            if (inside(rr, cc) && grid[rr][cc] == '.')  ret = (ret + solve(rr, cc)) % mod;
      }
      return ret;
}

int main()
{
      cin >> row >> column;
      for (int i = 1; i <= row; i++) for (int j = 1; j <= column; j++) cin >> grid[i][j];
      cout << solve(1, 1);
}


Measured memory_bytes: 10112
#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define ull unsigned long long
#define vi vector<ll>
#define vvi vector<vi>
#define BITLE(n) (1LL<<((ll)n))
#define BITCNT(n) (__builtin_popcountll(n))
#define SUBS(s,f,t) ((s).substr((f)-1,(t)-(f)+1))
#define ALL(a) (a).begin(),(a).end()
using namespace std;
struct MinCostFlow{
  struct edge{
    ll to,cap,cost,rev;
  };
  const ll MAX_V=200100;
  const ll Inf=1e18;
  ll V;
  vector<vector<edge>>E;
  vi dist,h,prevv,preve;
  MinCostFlow(ll V):V(V),E(V),dist(V),h(V),prevv(V),preve(V){}

  void addEdge(ll from, ll to, ll cap, ll cost){
    E[from].pb({to,cap,cost,(ll)E[to].size()});
    E[to].pb({from,0,-cost,(ll)E[from].size()-1});
  }

  void dijkstra(ll s){
    priority_queue<pair<ll,ll>,vector<pair<ll,ll>>,greater<pair<ll,ll>>>que;
    fill(ALL(dist),Inf);
    dist[s] = 0;
    que.push(pair<ll,ll>(0,s));
    while(!que.empty()){
      pair<ll,ll> p = que.top();
      que.pop();
      ll v = p.second;
      if(dist[v] < p.first)continue;
      for(int j = 0;j < E[v].size();j++){
	edge t = E[v][j];
	if(t.cap > 0&&dist[t.to] > dist[v] + t.cost + h[v] - h[t.to]){
	  dist[t.to] = dist[v] + t.cost + h[v] - h[t.to];
	  prevv[t.to] = v;preve[t.to] = j;
	  que.push(pair<ll,ll>(dist[t.to],t.to));
	}
      }
    }
  }

  ll execution(ll s,ll t,ll f){
    ll ret = 0;
    fill(ALL(h),0);
    while(f>0){
      dijkstra(s);
      if(dist[t] == Inf)return -1;
      for(ll v = 0;v < V;v++)h[v] += dist[v];

      ll d = f;
      for(ll v = t; v != s; v = prevv[v]){
	d = min(d, E[prevv[v]][preve[v]].cap);
      }
      f -= d;
      ret += d * h[t];
      for(int v = t; v != s; v = prevv[v]){
	edge &e = E[prevv[v]][preve[v]];
	e.cap -= d;
	E[v][e.rev].cap += d;
      }
    }
    return ret;
  }
};

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll v,e,f;cin>>v>>e>>f;
  MinCostFlow mcf(v);
  for(int i=0;i<e;i++){
    ll f,t,c,d;cin>>f>>t>>c>>d;
    mcf.addEdge(f,t,c,d);
  }
  cout<<mcf.execution(0,v-1,f)<<endl;
  return 0;
}



Measured memory_bytes: 3336
def func():
    pass


def main():
    n, m = map(int, input().split())
    r = []
    for i in range(m):
        a, b = map(int, input().split())
        r.append((a, b))

    ans = [0] * n
    for ri in r:
        a, b = ri[0], ri[1]
        ans[a - 1] += 1
        ans[b - 1] += 1

    for i in ans:
        print(i)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include<stdio.h>
int main()
{
int a,max,j,c;
  max=0;
  c=0;
  scanf("%d",&a);
int b[a];
  for(j=0;j<a;++j)
  {
  scanf("%d",&b[j]);
  if(b[j]>max) max=b[j];
    c=c+b[j];
  }
  max=max/2;
  printf("%d",c-max);
  
return 0;
}

Measured memory_bytes: 128
#include <cstdio>
#include <cstring>
#include <cmath>
#include <vector>
#include <iostream>
#include <iomanip> 
#include <algorithm>
#include <queue>
#include <list>
#include <numeric>
#include <stack>
#include <unordered_map>
#include <map>
#include <set>
 
using namespace std;
 
#define sz(a) int((a).size())
#define all(x) x.begin(), x.end()
#define pb push_back
#define endl '\n'
#define watch(x) cout << #x << " : " << x << endl;
 
#define FastIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
 
typedef long long ll;
typedef vector< int > vi;
typedef vector< vi > vvi;
typedef pair< int,int > ii;
typedef vector<ii> vii;
 
const int N = int(2e5)+10;
const int K = 10005;
// const int MOD = int(1e9)+7;
const int INF = int(1e9)+5;
const ll INF64 = 1e18;

const ll MOD = 1e9+7;
inline ll add(ll a, ll b, ll m) { return (((a % m + b % m) % m + m) % m); }
inline ll mul(ll a, ll b, ll m) { return (((a % m * b % m) % m + m) % m); }

vector<pair<int,ii>> e;
int l[N],r[N];
// End Times of Movies People Are Watching Means When They Are Free.
multiset<int> pq;

void solve () {
    ll a,b,c,k;cin>>a>>b>>c>>k;
    if (k < a) {
        cout<<k<<endl;
    } else if (k <= a + b) {
        cout<<a<<endl;
    } else {
        cout<<a-(k-a-b)<<endl;
    }
}

int main () {
    FastIO
// #ifndef ONLINE_JUDGE
//     freopen("input.txt", "r", stdin);
//     freopen("output.txt", "w", stdout);
// #endif
    int t;
    // cin>>t;
    t = 1;
    while (t--) {
        solve();
    }
    return 0;
}

Measured memory_bytes: 3648
#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 FORR(i, m, n) for (int i = m; i >= n; i--)
#define INF 1e9;
using namespace std;
typedef long long ll;
int main() {
  ll N, x;
  cin >> N >> x;
  ll a[N];
  REP(i, N) { cin >> a[i]; }
  ll ans = 0;
  REP(i, N - 1) {
    ll delta = a[i] + a[i + 1] - x;

    if (delta <= 0) {
      continue;
    }

    ans += delta;

    a[i + 1] = (a[i + 1] - delta < 0) ? 0 : a[i + 1] - delta;
  }
  cout << ans;
  return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = (s); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) for(int i = (n); i >= 0; i--)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << '\n';
#define CFYN(n) cout << ( (n) ? "YES":"NO") << '\n';
#define OUT(n) cout << (n) << '\n';
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;

vector<vector<int>> g;

void dfs(vector<int> &v,const int par,const int cnt) {
    for(auto x:g[cnt]) {
        if (x == par) continue;
        v[x] = v[cnt] + 1;
        dfs(v,cnt,x);
    }
}

int main(void)
{
    IOS
    int N, T, A;
    cin >> N >> T >> A;
    T--; A--;
    g.resize(N);
    REP(i,N-1) {
        int a, b;
        cin >> a >> b;
        a--;b--;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    vector<int> vt(N), va(N);
    dfs(vt,-1,T);
    dfs(va,-1,A);
    int ans = 0;
    REP(i,N) {
        if (vt[i] <= va[i]) ans = max(ans,va[i]-1);
        //cerr << vt[i] << " " << va[i] << endl;
    }
    if (N == 2) ans = 0;

    cout << ans << '\n';

    return 0;
}

Measured memory_bytes: 11648
using System;

class MyClass
{
    static void Main(string[] args)
    {
        string str = "";
        while ((str = Console.ReadLine()) != null)
        {
            string[] str2 = str.Split(' ');
            int a = int.Parse(str2[0]);
            int b = int.Parse(str2[1]);
            int c = int.Parse(str2[2]);
            int d = int.Parse(str2[3]);
            int e = int.Parse(str2[4]);
            int f = int.Parse(str2[5]);
            Console.WriteLine("{0:0.000} {1:0.000}", Math.Round((double)(c * e - f * b) / (a * e - d * b), 3, MidpointRounding.AwayFromZero), Math.Round((double)(c * d - f * a) / (b * d - e * a), 3, MidpointRounding.AwayFromZero));
        }
    }
}


Measured memory_bytes: 5844
s=input()
temp=0
tem=0
tot=0
flag=0
if s[-2]==s[-1]:
    print(len(s)-1,len(s))
else:
        
    if 1:
        for i in range(len(s)-2):
            if s[i]==s[i+1]:
                print(i+1,i+2)
                flag=1
                break
            elif s[i]==s[i+2]:
                print(i+1,i+3)
                flag=1
                break
        if flag==0:
            print("-1 -1")        

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

#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 reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit(b) (1ll << (b))
#define uniq(v) (v).erase(unique(all(v)), (v).end())

using namespace std;

using i32 = int;
using i64 = long long;
using f80 = long double;
using vi32 = vector<i32>;
using vi64 = vector<i64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << '\n'; exit(0); }
inline void no() { cout << "No" << '\n'; exit(0); }
inline i64 gcd(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); if (a % b == 0) return b; return gcd(b, a % b); }
inline i64 lcm(i64 a, i64 b) { return a / gcd(a, b) * b; }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> inline void amax(T &x, T y) { if (x < y) x = y; }
template <typename T> inline void amin(T &x, T y) { if (x > y) x = y; }
template <typename T> inline T power(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { each(x, v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
template <typename T, typename S> istream& operator>>(istream &is, pair<T, S> &p) { is >> p.first >> p.second; return is; }
template <typename T, typename S> ostream& operator<<(ostream &os, pair<T, S> &p) { cout << p.first << ' ' << p.second; return os; }

void solve() {
  int N; cin >> N;
  vi32 a(N); cin >> a;

  int mi = 1e9, ma = -1e9, mii, mai;
  rep(i, N) {
    if (mi > a[i]) amin(mi, a[i]), mii = i;
    if (ma < a[i]) amax(ma, a[i]), mai = i;
  }
  vector<pair<int, int>> ans;
  if (abs(mi) > abs(ma)) {
    if (mii != N - 1) {
      ans.emplace_back(mii, N - 1);
      ans.emplace_back(mii, N - 1);
    }
    rrep(i, N - 1) {
      ans.emplace_back(i + 1, i);
      ans.emplace_back(i + 1, i);
    }
  } else {
    if (mai != 0) {
      ans.emplace_back(mai, 0);
      ans.emplace_back(mai, 0);
    }
    rep(i, N - 1) {
      ans.emplace_back(i, i + 1);
      ans.emplace_back(i, i + 1);
    }
  }
  cout << ans.size() << '\n';
  rep(i, ans.size()) cout << ans[i].first + 1 << " " << ans[i].second + 1 << '\n';
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
using ll = long long;
using P = pair<int,int>;
template <class T> void chmin(T &a, const T &b) noexcept { if (b < a) a = b; }
template <class T> void chmax(T &a, const T &b) noexcept { if (a < b) a = b; }
void print() { cout << "\n"; }
template <class T, class... Args>
void print(const T &x, const Args &... args) { cout << x << " "; print(args...);}
void debug_out() { cout << "\n"; }
template <class T, class... Args>
void debug_out(const T &x, const Args &... args) { cout << x << " "; debug_out(args...);}
#ifdef _DEBUG
  #define debug(...) debug_out(__VA_ARGS__)
#else
  #define debug(...) 
#endif

ll f(ll a, ll b, ll x) {
  ll res = (a*x)/b;
  res -= a*(x/b);
  return res;
}

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  ll a, b, n;
  cin >> a >> b >> n;
  ll ans = 0;
  if (n < b) {
    ans = f(a,b,n);
  }
  else {
    chmax(ans, f(a,b,b));
    if (b > 1) chmax(ans, f(a,b,b-1));
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h> 
#define ll long long int
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);
#define fr(i,a,b) for(long long int i=a; i<b; i++)
#define pb push_back
#define mp make_pair
using namespace std;
signed main() 
{
    fast
    int k;
    cin>>k;
    int s=0;
    for(int a=1;a<=k;a++)
    {
        for(int b=1;b<=k;b++)
        {
            for(int c=1;c<=k;c++)
            {
                //int f=gcd(a,b);
                s=s+__gcd(__gcd(a,b),c);
            }
        }
    }
    cout<<s;
}

Measured memory_bytes: 3648
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
using namespace std;
#define P pair<int,int>
#define rep(i,n) for(int i = 0;i<n;i++)
#define pb(n) push_back(n)

int n;
int main() {
	while(true){
		cin >> n;
		if(n == 0) break;
		vector<P> V;
		rep(i,n){
			int d,w;
			cin >> w >> d;
			V.push_back(P(d,w));
		}
		sort(V.begin(),V.end());
		int sw = 0;
		bool ans = true;
		rep(i,n){
			sw += V[i].second;
			if(sw > V[i].first){
				ans = false;
				break;
			}
		}
		cout << (ans ? "Yes" : "No") << endl;
	}
	return 0;
}

Measured memory_bytes: 0
a, b, n = gets.split.map(&:to_i)

pat = []
pat.push( ((a * n) / b) -  (a * (n / b)) )
if b < n
  pat.push( ((a * b) / b) - a )
end
if b <= n
  pat.push( ((a * (b-1)) / b) )
end
puts pat.max 

Measured memory_bytes: 14276
package main

import "fmt"

func main() {
	var a, b int
	fmt.Scan(&a, &b)

	var ab, ba int
	for i := 0; i < b; i++ {
		ab = ab * 10 + a
	}
	for i := 0; i < a; i++ {
		ba = ba * 10 + b
	}

	if ab > ba {
		fmt.Println(ab)
	} else {
		fmt.Println(ba)
	}
}


Measured memory_bytes: 512
import java.util.Scanner;
public class Main {
	static Scanner stdIn = new Scanner(System.in);
	
	public static int parimitual(int n, int m, double p) {
		int sum = 0, winner = 0;
		int[] vote = new int[n];
		for(int r = 0; r < n; r++) {
			vote[r] = stdIn.nextInt();
			sum += vote[r];
			if(m == r + 1) winner = vote[r];
		}
		int money = 100 * sum;
		money -= money * p;
		if(winner == 0) return(0);
		return(money / winner);
	}
	
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		int n = -1, m = -1;
		double p = -1;
		
		while(true) {
			n = stdIn.nextInt();
			m = stdIn.nextInt();
			p = stdIn.nextInt();
			if(n + m + p == 0) break;
			p /= 100;
			System.out.println(parimitual(n, m, p));
		}
	}
}

Measured memory_bytes: 27732
from heapq import heappush, heappop
class MinCostFlow:
    INF = 10**18

    def __init__(self, N):
        self.N = N
        self.G = [[] for i in range(N)]

    def add_edge(self, fr, to, cap, cost):
        forward = [to, cap, cost, None]
        backward = forward[3] = [fr, 0, -cost, forward]
        self.G[fr].append(forward)
        self.G[to].append(backward)

    def flow(self, s, t, f):
        N = self.N; G = self.G
        INF = MinCostFlow.INF

        res = 0
        H = [0]*N
        prv_v = [0]*N
        prv_e = [None]*N

        d0 = [INF]*N
        dist = [INF]*N

        while f:
            dist[:] = d0
            dist[s] = 0
            que = [(0, s)]

            while que:
                c, v = heappop(que)
                if dist[v] < c:
                    continue
                r0 = dist[v] + H[v]
                for e in G[v]:
                    w, cap, cost, _ = e
                    if cap > 0 and r0 + cost - H[w] < dist[w]:
                        dist[w] = r = r0 + cost - H[w]
                        prv_v[w] = v; prv_e[w] = e
                        heappush(que, (r, w))
            if dist[t] == INF:
                return None

            for i in range(N):
                H[i] += dist[i]

            d = f; v = t
            while v != s:
                d = min(d, prv_e[v][1])
                v = prv_v[v]
            f -= d
            res += d * H[t]
            v = t
            while v != s:
                e = prv_e[v]
                e[1] -= d
                e[3][1] += d
                v = prv_v[v]
        return res

N,K = map(int,input().split())
A = [list(map(int,input().split())) for i in range(N)]

G = MinCostFlow(N**2+2*N+3)
G.add_edge(0,N**2+2*N+2,10**18,0)
G.add_edge(N**2+2*N+2,N**2+2*N+1,10**18,0)

for i in range(N):
    G.add_edge(0,i+1,K,0)
    for j in range(N):
        node = N * i + j + 2*N + 1
        G.add_edge(i+1,node,1,-A[i][j])
        G.add_edge(node,N+1+j,1,0)

for j in range(N):
    G.add_edge(N+1+j,N**2+2*N+1,K,0)

f = G.flow(0,N**2+2*N+1,N**2)
print(-f)

res = [["." for j in range(N)] for i in range(N)]
for i in range(N):
    for Node,cap,_,_ in G.G[i+1]:
        if Node == 0:
            continue
        node = Node - (2*N+1)
        px,py = node//N,node%N
        if cap==0:
            res[px][py] = "X"

for i in range(N):
    print("".join(res[i]))

Measured memory_bytes: 103736
"""
AtCoder :: Beginner Contest 174 :: Air Conditioner
https://atcoder.jp/contests/abc174/tasks/abc174_a
"""
import sys


def main():
    """Main program."""
    temp = int(sys.stdin.readline())
    if temp >= 30:
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main()


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

int main () {
  ios_base::sync_with_stdio(0);
  long long a, b;
  cin >> a >> b;

  if ((a + b) & 1) {
    cout << "IMPOSSIBLE\n";
  } else {
    cout << ((a + b) >> 1) << "\n";
  }

  return 0;
}

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

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringBuilder sb = new StringBuilder();
        while(true){
            String str[] = br.readLine().split(" ");
            int H = Integer.parseInt(str[0]);
            int W = Integer.parseInt(str[1]);
            if(H==0 && W==0) break;
            for(int i=0;i<H;i++){
                for(int j=0,k=i;j<W;j++,k++){
                    if(k%2==0){
                        sb.append("#");
                    }else{
                        sb.append(".");
                    }
                }
                sb.append("\n");
            }
            sb.append("\n");
        }
        System.out.print(sb);
    }
}

Measured memory_bytes: 25392
# Shuffle

end = 0
shuffled = []

while end == 0:
    phrase = input()
    if phrase == '-':
        end += 1
    else:
        shuffleTimes = int(input())
        for i in range(shuffleTimes):
            shufflePosition = int(input())
            phrase = phrase[shufflePosition:] + phrase[:shufflePosition]
        shuffled.append(phrase)

for array in shuffled:
    print(array)



Measured memory_bytes: 5596
#include <iostream>
using namespace std;
 
int main(){
  int A,B,K,i,count = 0;
  cin >> A >> B >> K;
  for((A > B) ? (i = B) : (i = A);i > 0;i--){
    if(((A % i) | (B % i)) == 0){
      count++;
      if(count == K){
        cout << i << endl;
        return 0;
      }
    }
  }
}

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

int main(){
    int N,K;
    cin>>N>>K;
    int ans=0;
    for(int i=1;i<=N;i++){
        int temp;
        cin>>temp;
        if(temp==1){
            if((i-1)%(K-1)==0) ans+=(i-1)/(K-1);
            else ans+=(i-1)/(K-1)+1;

            if((N-i)%(K-1)==0) ans+=(N-i)/(K-1);
            else ans+=(N-i)/(K-1)+1;
            
            if((i-1)%(K-1)!=0 && (N-i)%(K-1)!=0 &&
                (i-1)%(K-1)+(N-i)%(K-1)<=(K-1)) ans--;
        }
            
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
# coding: utf-8
L = [0 for _ in range(8)]
N = int(input())
A = list(map(int, input().split()))
v = 0
for i in range(N):
    idx = A[i] // 400
    if idx >= 8:
        v += 1
    else:
        L[idx] += 1
amin, amax = 0, 0
for i in range(len(L)):
    if L[i] > 0:
        amin += 1
    # if L[i] == 0 and v > 0:
    #     L[i] += 1
    #     v -= 1
# amin = max(1, amin)
# for i in range(len(L)):
#     if L[i] > 0:
#         amax += 1
print(max(1, amin), amin + v)

Measured memory_bytes: 3064
N = int(input())
dic = {}

for i in range(N):
  S = input()
  if S in dic:
    dic[S] += 1
  else:
    dic[S] = 1
    
max_N = max(list(dic.values()))
keys = sorted([k for k, v in dic.items() if v == max_N])

for i in range(len(keys)):
  print(keys[i])

Measured memory_bytes: 32988
#include<iostream>
using namespace std;
const int MAX = 44;
int dp[MAX];
int fib(int n)
{
	if (n == 0 || n == 1)
		return dp[n] = 1;
	if (dp[n] != -1)
		return dp[n];
	return dp[n] = fib(n - 1) + fib(n - 2);
}
int main()
{
	int n;
	cin >> n;
	for (int i = 0; i <= MAX; i++)
		dp[i] = -1;
	cout << fib(n) << endl;}


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

const int INF = 1e9;

long long g(long long x) {
  if (x % 2 == 0) {
    if ((x / 2) % 2 == 0) {
      return x;
    } else {
      return x^1;
    }
  } else {
    if (((x + 1)/ 2) % 2 == 0) {
      return 0;
    } else {
      return 1;
    }
  }
}

int main() {
  long long a,b;
  cin>>a>>b;
  long long y1 = g(a-1);
  long long y2 = g(b);

  cout<<(y1^y2)<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef  long long int ll;
typedef  long double ld;
#define sync ios_base::sync_with_stdio(false); cin.tie(NULL) 
#define input(arr,n) for(ll i1=0;i1<n;i1++ )cin>>arr[i1]
#define mod 1000000007
#define F first
#define S second 
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("O3")
//recursions\
#pragma comment(linker, "/stack:200000000")
//loops\
#pragma GCC optimize("unroll-loops")
using namespace __gnu_pbds;
#define ordered_set tree<ll, null_type,less_equal<ll>, rb_tree_tag,tree_order_statistics_node_update>//s.order_of_key(val) *s.find_by_order(ind)
using namespace std;
ll fact[100005],invf[100005];

ll modexp(ll a,ll b)
{
	a%=mod;
	if(a==0||a==1)
	return a;
	if(b==0)
	return 1;
	if(b%2==0)
	{
		ll res=modexp(a,b/2);
		return (res*res)%mod;
	}
	return (a*modexp(a,b-1))%mod;
}
ll ncr(ll n,ll r)
{
	if(n<r)
	return 0;
	
	ll val=(fact[n]*invf[r])%mod;
	val=(val*invf[n-r])%mod;
	return val;
}	
int main()
{
	sync;
	//to be the king

	fact[0]=invf[0]=1;
	for(ll i=1;i<=1e5;i++)
		fact[i]=(fact[i-1]*i)%mod,
		invf[i]=(invf[i-1]*modexp(i,mod-2))%mod;
	
	ll n,k;
	cin>>n>>k;
	ll arr[n+1];
	for(ll i=1;i<=n;i++)
	cin>>arr[i];
	sort(arr+1,arr+n+1);
	ll ans=0;
	
	for(ll i=n;i>=1;i--)
	{
		ll val=(ncr(i-1,k-1)*arr[i])%mod;
		ans=(ans+val)%mod;
	
		val=(ncr(n-i,k-1)*arr[i])%mod;
	
		ans=(ans-val+mod)%mod;		
		
	}
	cout<<ans;
}

Measured memory_bytes: 2560
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
const int N = 2e5 + 5, MOD = 1e9 + 7;
int n, m, p;
vector<pair<int,int>> adj[2505];
ll dist[2505];
int u[5005], v[5005], w[5005];
int main(){

  cin >> n >> m >> p;


  for(int i = 0; i < m; i++){
    cin >> u[i] >> v[i] >> w[i];
    w[i] -= p;
  }

  memset(dist, -63, sizeof dist);
  dist[1] = 0;
  for(int i = 0; i < 4 * n; i++){
    for(int j = 0; j < m; j++){
      dist[v[j]] = max(dist[v[j]], dist[u[j]] + w[j]);
    }
  }

  ll ans = dist[n];

  for(int i = 0; i < 4 * n; i++){
    for(int j = 0; j < m; j++){
      dist[v[j]] = max(dist[v[j]], dist[u[j]] + w[j]);
    }
  }

  if(dist[n] > ans)
    ans = -1;
  if(ans<-1)ans=0;
  cout << ans << '\n';

  return 0;
}


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

int main() {
  int N;
  cin >> N;
  int sum = 0;
  
  vector<int>a(N);
  for (int i = 0; i < N; i++) {
    cin >> a.at(i);
    sum += a.at(i)-1;
  }
  cout << sum << endl;
}
  

Measured memory_bytes: 3572
from collections import deque

toTail = True

n = int(input())
xs = map(int, input().split())

b = deque()
for x in xs:
    if toTail:
        b.append(x)
    else:
        b.appendleft(x)
    toTail = not toTail
if toTail:
    b = list(b)
else:
    b = reversed(list(b))
print(" ".join(map(str, b)))


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

int main() {
  char c[4]={'A','T','G','C'};
  string s;
  cin>>s;

  int cnt=0,ans=0;
  for (int i=0; i<s.size(); i++) {
    bool flag=false;
    for (int j=0; j<4; j++) {
      if (s[i]==c[j]) flag=true;
    }
    if (flag) cnt++;
    else if (!flag&&cnt) {
      ans=max(cnt,ans);
      cnt=0;
    }
  }
  ans=max(cnt,ans);
  cout<<ans<<endl;
  return 0;
}

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

int main(){
  int n; cin >> n;
  int f[n][10];
  int p[n][11];
  for(int i=0; i<n; i++){
    for(int j=0; j<10; j++) cin >> f[i][j];
  }
  for(int i=0; i<n; i++){
    for(int j=0; j<11; j++) cin >> p[i][j];
  }

  int res=-(1 <<30);;
  for(int b=1; b<(1<<10); b++){
    int cc=0;
    for(int i=0; i<n; i++){
      int cnt=0;
      for(int j=0; j<10; j++){
        if((b>>j&1)&&f[i][j])cnt++;
      }
      cc += p[i][cnt];
    }
    res=max(cc, res);
  }

  cout << res << endl;
  return 0;
}


Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var forecast, actual string
	fmt.Scanf("%s", &forecast)
	fmt.Scanf("%s", &actual)

	var ans int
	for i := 0; i < 3; i ++ {
		if []rune(forecast)[i] == []rune(actual)[i] {
			ans++
		}
	}
	fmt.Println(ans)
}

Measured memory_bytes: 512
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <bitset>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <time.h>
#include <random>
#include <string>
#include <cassert>
#include <vector>
#include <ostream>
#include <istream>
#include <stack>
#include <deque>
#include <queue>
#include <functional>
#include <chrono>

using namespace std;

#define int long long
#define pb push_back
#define all(a) (a).begin(), (a).end()
#define pii pair<int, int>
#define ld long double

ostream& operator << (ostream &a, const vector<int> &b) {
    for (auto k : b) cout << k << " ";
    return a;
}

#ifdef LOCAL
    #define dbg(x) cout << #x << " : " << (x) << "\n";
    const int INF = 1e18;
    // const int mod = 2600000069;
    // const int p = 10;
    // const ld PI = 3.1415926535;
#else
    #define dbg(x)
    const int INF = 1e18;
    // const int mod = 2600000069;
    // const int p = 179;
    // const ld PI = 3.1415926535;
#endif

// #pragma GCC optimize("Ofast,no-stack-protector")
//#pragma GCC target("sse,sse2,sse3,sse3,sse4")
// #pragma GCC optimize("unroll-loops")
// #pragma GCC optimize("fast-math")
// #pragma GCC target("avx2")
//#pragma GCC optimize("section-anchors")
//#pragma GCC optimize("profile-values,profile-reorder-functions,tracer")
//#pragma GCC optimize("vpt")
//#pragma GCC optimize("rename-registers")
//#pragma GCC optimize("move-loop-invariants")
//#pragma GCC optimize("unswitch-loops")
//#pragma GCC optimize("function-sections")
//#pragma GCC optimize("data-sections")`  

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    vector<int> a(n);
    map<int, int> cnt;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    int ans = 0;
    for (int i = 0; i < n; i++) {
        ans += cnt[i - a[i]];
        cnt[a[i] + i]++;
    }
    cout << ans;
}
/*

*/  


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

int main() {
  int N;
  cin >> N;
  vector<char> S(N);
  for (int i=0; i<N; i++) cin >> S.at(i);
  bool is_y = false;
  for (int i=0; i<N; i++) {
    if (S.at(i) == 'Y') {
      is_y = true;
      break;
    }
  }
  if (is_y) cout << "Four" << endl;
  else cout << "Three" << endl;
}

Measured memory_bytes: 764
#include "bits/stdc++.h"


using namespace std;







int main(){
	long long h,w;

	cin >> h >> w;
	if (h == 1 || w == 1) cout << 1 << endl;
	else if (h%2 == 1 && w%2 == 1) 	cout << ((h*w)/2)+1 << endl;
	else cout << h*w/2 << endl;
	cin >> h;
	return 0;

	
}



Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
    int a, b;
    cin >> a >> b;
    int m = 1;
    int ans = 0;
    while (m < b) {
        m = (m - 1) + a;
        ++ans;
    }

    cout << ans << endl;

    return 0;
}


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

using namespace std;

typedef long long ll;

const ll MOD = 1000000007;

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    int n, a, b; cin >> n >> a >> b;
    int low = 0, mid = 0, high = 0;
    for(int i=0;i<n;i++){
        int p; cin >> p;
        if(p <= a){
            low++;
        }else if(p <= b){
            mid++;
        }else{
            high++;
        }
    }
    cout << min(low, min(mid, high)) << endl;
}

Measured memory_bytes: 256
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees#, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10**9 + 7
#from decimal import *

A, B, C = MAP()

if any(x%2 for x in [A, B, C]):
	print(0)
	exit()
elif A == B == C:
	print(-1)
	exit()

ans = 0
while all(x%2 == 0 for x in [A, B, C]):
	A, B, C = (B+C)//2, (A+C)//2, (A+B)//2
	ans += 1

print(ans)



Measured memory_bytes: 5328
#define tasknames ""
#include <iostream>
#include <stdio.h>
using namespace std;


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr); if(fopen(tasknames".INP", "r"))
    freopen(tasknames".INP","r",stdin),
    freopen(tasknames".OUT","w",stdout);
    string s;
    cin >> s;
    cout << (s == "ABC" ? "ARC" : "ABC");
}

Measured memory_bytes: 3660
#include <iostream>
using namespace std;
int main(void){
   int a, b, c, x, min, max;
   cin >> a >> b >> c;
   if(b < a){
       x = a;
       a = b;
       b = x;
   }
   if(c < b){
       x = b;
       b = c;
       c = x;
   }
   if(b < a){
       x = a;
       a = b;
       b = x;
   }
   cout << a << " " << b << " " << c;
   cout << endl;
}


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

using namespace std;

int main()
{
    long long n;
    cin >> n;
    long long tem = n, s = 0, t = 1;
    while(n / 10)
    {
        n /= 10;
        t *= 10;
        s += 9;
    }
    if((n + 1)*t - 1 <= tem)
        s += n;
    else
        s += n - 1;
    cout << s;
    return 0;

}


Measured memory_bytes: 384
#include <stdio.h>

int main(){
  int h, w;
  int i, j, k;
  for(i=0;;i++){
    scanf("%d %d ", &h, &w);
    if(h==0&&w==0)break;
    for(j=0;j<h;j++){
      for(k=0;k<w;k++){
	printf("#");
      }
      printf("\n");
    }
    printf("\n");
  }
  
  return 0;
}

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

using namespace std;

int p[100001];

int main(){

	int n, m;
	cin >> n >> m;
	int j;
	string sm;

	int AC_N=0;
	int WA_N=0;

	for (int i = 1; i <= m; i++) {
		cin >> j >> sm;
		if(p[j] >= 0 && sm == "WA"){
			p[j]++;
		} else if (p[j] >= 0 && sm == "AC") {
			AC_N++;
			WA_N += p[j];
			p[j] = -1;
		} else {
			continue;
		}
	}

	cout << AC_N << " " << WA_N << endl;

	return 0;
}



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

int main()
{
    int a, b, c;
    cin >> a >> b >> c;
    cout << (a+b>=c?"Yes":"No") << "\n";
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

//INSERT ABOVE HERE
signed main(){
  Int n;
  cin>>n;
  vector<Int> rs(n),as(n),ws(n),ts(n);
  for(Int i=0;i<n;i++) cin>>rs[i]>>as[i]>>ws[i]>>ts[i];

  Int ans=0;
  for(Int uku=0;uku<8;uku++){
    using T = tuple<Int, Int, Int, Int>;
    using P = pair<Int, T>;
    vector<P> vp;
    for(Int i=0;i<n;i++){
      Int val=0;
      if(uku%4==0) val=rs[i]+ts[i];
      if(uku%4==1) val=rs[i]-ts[i];
      if(uku%4==2) val=rs[i];
      if(uku%4==3) val=ts[i];
      if(uku>=4) val*=-1;
      vp.emplace_back(val,T(rs[i],as[i],ws[i],ts[i]));
    }

    sort(vp.begin(),vp.end());
    for(Int i=0;i<n;i++)
      tie(rs[i],as[i],ws[i],ts[i])=vp[i].second;

    const Int MAX = 2020;
    const Int INF = 1e9;
    vector<Int> dp(MAX,-INF);
    for(Int i=0;i<n;i++){
      vector<Int> nx0(MAX,-INF),nx1(MAX,-INF);
      chmax(nx1[ts[i]],as[i]);
      for(Int j=MAX-1;j>=0;j--){
        chmax(nx0[j],dp[j]);
        if(j<rs[i]) continue;
        chmax(nx1[min(j-rs[i],ts[i])],dp[j]+as[i]);
        chmax(nx1[j-rs[i]],nx1[j]+ws[i]);
      }
      for(Int j=0;j<MAX;j++) chmax(dp[j],nx0[j]);
      for(Int j=0;j<MAX;j++) chmax(dp[j],nx1[j]);
    }
    for(Int j=1;j<MAX;j++) chmax(ans,dp[j]);
  }
  cout<<ans<<endl;
  return 0;
}



Measured memory_bytes: 3256