akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
const int inf = 1e9 + 7;
const ll INF = 1e18;
int mod = 1000000007;
#define abs(x) (x >= 0 ? x : -(x))
#define lb(v, x) (int)(lower_bound(all(v), x) - v.begin())
#define ub(v, x) (int)(upper_bound(all(v), x) - v.begin())
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template<typename T> T pow(T a, int b) { return b ? pow(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
ll modpow(ll a, ll b, ll _mod) { return b ? modpow(a * a % _mod, b / 2, _mod) * (b % 2 ? a : 1) % _mod : 1; }
template<class T> ostream& operator << (ostream& os, const vector<T>& vec) { for (auto &vi: vec) os << vi << " "; return os; }
template<class T, class U> ostream& operator << (ostream& os, const pair<T, U>& p) { os << p.F << " " << p.S; return os; }
template<typename T >inline istream& operator >> (istream& is, vector<T>& v) { rep(j, sz(v)) is >> v[j]; return is; }
template<class T> inline void add(T &a, int b) { a += b; if (a >= mod) a -= mod; }


void solve();

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cout << fixed << setprecision(10);

    int T;
    // cin >> T;
    T = 1;

    while (T--) {
        solve();
    }
}

void solve() {
  int n;
  cin >> n;
  vector<int> a(n);
  cin >> a;
  int now = 1, c = 0;
  rep(i, n) {
    if (a[i] == now) {
      now++;
    } else {
      c++;
    }
  }
  cout << (c == n ? -1 : c) << endl;
}


Measured memory_bytes: 1024
#include <stdio.h>
#include <cmath>
#include <bits/stdc++.h>



using namespace std;

typedef vector<int> VI;
typedef vector<string> VS;


//container util
#define SORT(c) sort((c).begin(),(c).end())

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



int main(void){

	int N, A; cin >> N >> A;
	if(N%500 <= A) cout << "Yes" << endl;
	else cout << "No" << endl;


	return 0;

}


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

signed main() {
	int n;
	cin >> n;
	vector<int> a(n), b(n), c(n);
	for (int i = 0; i < n; i++) cin >> a[i];
	for (int i = 0; i < n; i++) cin >> b[i];
	for (int i = 0; i < n; i++) cin >> c[i];
	sort(a.begin(), a.end());
	sort(b.begin(), b.end());
	sort(c.begin(), c.end());

	int cnt = 0;

	for (auto e : b) {
		int aBegin = lower_bound(a.begin(), a.end(), e) - a.begin();
		int cBegin = c.end() - upper_bound(c.begin(), c.end(), e);
		cnt += aBegin * cBegin;
	}

	cout << cnt << endl;
}


Measured memory_bytes: 2560
//******\\
**udc321**	 
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<queue>
#include<map>
#include<set>
#define ll long long
#define fr(e,r,v) for(int e=r;e<v;e++)
#define bc(e,r,v) for(int e=r;e>v;e--)
#define all(n) (n.begin(),n.end())
#define ft first
#define sd second
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define mpr make_pair
#define db  double
using namespace std;

ll mod=1000000007;
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

/*pair(sort and all) implementation and upper bound implementation*/
vector<vector<ll>> v;
vector<ll> h;
ll ps=0;
void dfs1(ll a,ll p)
{

	fr(j,0,v[a].size())
	{
		if(v[a][j]==p){continue;}
		dfs1(v[a][j],a);
		h[a]+=h[v[a][j]];
	}
}



int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	ll n;
	cin>>n;
	ll a[n];
	ll s=0;
	fr(j,0,n)
	{cin>>a[j];
		if(j>0 && a[j-1]>a[j])
		{
			s+=a[j-1]-a[j];a[j]=a[j-1];
		}
}
cout<<s<<endl;
}









Measured memory_bytes: 5148
import math
def cal0(x,y):
    return (x[0]-y[0])**2+(x[1]-y[1])**2
def cal(x,y):
    return math.sqrt(cal0(x,y))
A = list(map(float,input().split()))
B = list(map(float,input().split()))
C = list(map(float,input().split()))

a = cal(B,C)
b = cal(C,A)
c = cal(A,B)
s = (a+b+c)/2
d = math.sqrt(s*(s-a)*(s-b)*(s-c))
e = 2*d/(a+b+c)
f = max(a,max(b,c))
print(f/(2+f/e))

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

int main() {
    int n,m;cin >> n >> m;
    vector<int> one;
    vector<bool> ns(200000,false);
    for(int i = 0; i < m; i++) {
        int a,b; cin >> a >> b;
        if(a==1){
            one.push_back(b);
        }
        if(b==n){
            ns[a-1]=true;
        }
    }
    for(int i = 0; i < one.size(); i++) {
        if(ns[one[i]-1]){
            cout << "POSSIBLE" << endl;
            return 0;
        }
    }
    cout << "IMPOSSIBLE" << endl;
   
}

Measured memory_bytes: 3824
#include <cctype>
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>
#define pk putchar(' ')
#define ph puts("")
typedef long long ll;
using namespace std;
template <class T>
void rd(T &x)
{
    x = 0;
    int f = 1;
    char c = getchar();
    while (!isdigit(c)) {if (c == '-') f = -1; c = getchar();}
    while (isdigit(c)) x = (x << 3) + (x << 1) + (c ^ 48), c = getchar();
    x *= f;
}
template <class T>
void pt(T x)
{
    if (x < 0)
        putchar('-'), x = (~x) + 1;
    if (x > 9)
        pt(x / 10);
    putchar(x % 10 ^ 48);
}
const int N = 105;
int n, k, ans;
bool vis[N];
int main() 
{
	rd(n), rd(k);
	for (int i = 1, x, y; i <= k; i++)
	{
		rd(x);
		while (x--)
			rd(y), vis[y] = 1;
	}
	for (int i = 1; i <= n; i++)
		if (!vis[i])
			ans++;
	pt(ans);
    return 0;
}

Measured memory_bytes: 1532
import java.util.ArrayList;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int k = sc.nextInt();

        ArrayList<Long> arr = new ArrayList<>();
        for (long i = 1; i < 10; i++) {
            arr.add(i);
        }
        int index = 0;
        int end = arr.size();
        while(end < k) {
           long  tmp = arr.get(index);
            long digit = tmp % 10;
            int count = 0;
            for (int i = -1; i < 2; i++) {
                long digitnew = digit + i;
                if (digitnew  >= 0 && digitnew <=9) {
                    arr.add(tmp*10+digitnew);
                    count++;
                }
            }
            index++;
            end += count;
        }
        System.out.println(arr.get(k-1));
    }
}


Measured memory_bytes: 26068
N = int(input())
index = {}

for _ in range(N):
  S = input()
  if S not in index: index[S] = 1
  else: index[S] += 1

max_cnt = max(index.values())

ls = [key for key in index.keys() if index[key] == max_cnt]

ls.sort()
for ans in ls:
  print(ans)

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

using namespace std;

int main()
{
  int n, k;
  cin >> n >> k;

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

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

  long long attack_count = 0;
  for (int i = 0; i < n - k; i++)
  {
    attack_count += h[i];
  }

  cout << attack_count << endl;

}

Measured memory_bytes: 1792
n = int(input())
index=1
count=0
while index<n+1:
    count2=0
    index2=1
    while index2<index+1:
        if index%index2==0:
            count2+=1
        index2+=1
    if count2==8:
        count+=1
    index+=2

print(count)
    

Measured memory_bytes: 2940
import java.util.*;
import java.io.*;

public class Main{
  public static void main(String[] args)throws Exception{
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    try{
      int N = Integer.parseInt(br.readLine());
      Map<String, Integer> map = new HashMap<>();
      int max = 1;
      for(int i = 0; i < N; i++){
        String S = br.readLine();
        if(map.containsKey(S)){
          int m = map.get(S)+1;
          map.put(S, m);
          max = Math.max(max, m);
        }else{
          map.put(S, 1);
        }
      }
      
      List<String> list = new ArrayList<>();
      for(Map.Entry<String, Integer> en : map.entrySet()){
        if(en.getValue() == max){
          list.add(en.getKey());
        }
      }
      
      Collections.sort(list);
      for(String s : list){
        System.out.println(s);
      }
    }catch(Exception e){
    }
  }
}

Measured memory_bytes: 66792
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <utility>
#include <cmath>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <deque>


using namespace std;

using ll = long long;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)

int n;

ll dfs(ll x,bool a, bool b, bool c,int ans) {
	if (x > n) return ans;

	if (a && b && c) {
		ans++;
	}
	ans = dfs(x * 10 + 3, 1, b, c, ans);
	ans = dfs(x * 10 + 5, a, 1, c, ans);
	ans = dfs(x * 10 + 7, a, b, 1, ans);
	return ans;
}


int main() {

	cin >> n;

	cout << dfs(0,0,0,0,0) << endl;

	return 0;
}

Measured memory_bytes: 256
// Author: πα

#include <bits/stdc++.h>
using namespace std;
#define long int64_t

int main()
{
    int a, b;
    cin >> a >> b;
    if((a-b) % 2)
        return cout << "IMPOSSIBLE", 0;
    cout << (a+b)/2;
    return 0;
}


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

int main() {
  string Ans;
  vector<int> Num(3);
  REP(i,3) cin>> Num[i];
  Ans=Num.at(0)+Num.at(1)+Num.at(2)>=22?"bust":"win";
  cout << Ans << '\n';
  return 0;
}


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

void call( int n )
{
    for ( int i = 1; i <= n; i++ )
    {
        if ( i % 3 == 0 )
        {
            cout << " " << i;
        }
        else
        {
            int x = i;
            while ( x )
            {
                if ( x % 10 == 3 )
                {
                    cout << " " << i;
                    break;
                }
                x /= 10;
            }
        }
    }
    
  cout << endl;
}

int main( void )
{
    int n;
    cin >> n;
    call( n );
    return 0;
}

Measured memory_bytes: 3044
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
#define per(i,n) for(int i = n-1; i >= 0; i--)
typedef long long ll;
typedef pair<int, int> P;
typedef pair<long long, long long> Pll;
typedef vector<int> vi;
typedef vector<ll> vll;
const long long mod = 1000000007LL;

int main() {
  ll n;
  cin >> n;
  vll a(n);
  ll cnt = 0LL;
  ll b = 10000000000LL;
  ll ans = 0LL;
  bool check = true;
  rep(i,n) {
    cin >> a[i];
    if(a[i]==0) check = false;
    ans += abs(a[i]);
    b = min(b,abs(a[i]));
    if(a[i]<0) cnt++;
  }
  if(cnt%2==1 && check) ans -= b*2;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1024
import std.stdio, std.array, std.conv, std.algorithm, std.string, std.numeric, std.range;
void main() {
	int[string] m;
	m["O"] = 0; m["A"] = 0; m["B"] = 0; m["AB"] = 0;
	string s;
	while( (s=readln.strip).length != 0 ){
		auto as = s.split(',');
		m[as[1]] += 1;
	}
	writeln(m["A"]);
	writeln(m["B"]);
	writeln(m["AB"]);
	writeln(m["O"]);
}

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

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

#define rep(i,x,y) for(int i=(x);i<(y);++i)
#define debug(x) #x << "=" << (x)

#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define print(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define print(x)
#endif

const int inf=1e9;
const int64_t inf64=1e18;
const double eps=1e-9;

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){
    os << "[";
    for (const auto &v : vec) {
    	os << v << ",";
    }
    os << "]";
    return os;
}

using i64=int64_t;

void solve(){
    int n,m;
    cin >> n >> m;
    rep(i,0,m){
        int a;
        cin >> a;
    }
    cout << n-1-m << endl;
}

int main(){
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(10);
    solve();
    return 0;
}

Measured memory_bytes: 3092
def read_inputs
  n = gets.to_i
  (1..n).map {gets.chomp}
end

def full_cards
  full_cards = []
  ["S", "H", "C", "D"].each {|mark|
    (1..13).each {|number|
      full_cards << "#{mark} #{number}"
    }
  }
  full_cards
end

cards = read_inputs
puts (full_cards - cards).join("\n") if cards.length < 52

Measured memory_bytes: 8548
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	int A,B,C,K;cin >> A >> B >> C >> K;
	int ans = 0;
	ans += min(A,K);
	K -= min(A,K);
	K -= min(B,K);
	ans -= min(C,K);
	cout << ans << '\n';
}


Measured memory_bytes: 3640
n=int(input());l=[list(map(int,input().split()))for i in[0]*n];a=[0]*n;d=1;k=n*~-n
while sum(a)<k and d<9999:
 L=[0]*n;y=0;d+=1
 for i in range(n):
  if a[i]<n-1:
   x=l[i][a[i]]-1
   if l[x][a[x]]-1==i and L[x]+L[i]<1:
    a[i]+=1;a[x]+=1;L[i]=L[x]=y=1
print([k//2,d*y-1][d*y<9999])

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

int main() {
    int N;
    cin >> N;
    vector<int> X(N), Y(N), per(N);
    rep(i, N) cin >> X[i] >> Y[i];
    rep(i, N) per[i] = i;

    double sum = 0;
    int cnt = 0;
    do {
        rep(i, N - 1) {
            sum += sqrt((X[per[i]] - X[per[i + 1]]) * (X[per[i]] - X[per[i + 1]]) + (Y[per[i]] - Y[per[i + 1]]) * (Y[per[i]] - Y[per[i + 1]]));
        }
        ++cnt;
    } while (next_permutation(per.begin(), per.end()));

    printf("%.10f\n", sum / cnt);

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
        //#include <ttmath.h>
        #define endl '\n'
        #define modulo 1000000007
        #define int long long
        #pragma GCC optimize("-Ofast")
        #define float double
        #define PI 3.141592653589793238462643
        #define sinDegrees(x) sin((x) * PI / 180.0)
        #define tanDegrees(x) tan((x) * PI / 180.0)
        #define atanDegrees(x) atan(x)* 180.0 / PI
        using namespace std;
        int power(int x, unsigned int y)
        {
        int temp;
        if(y == 0)
        return 1;
        temp = power(x, y/2)%modulo;
        if (y%2 == 0)
        return (temp*temp)%modulo;
        else
        return (x*temp*temp)%modulo;
        }
        int inv(int a) {
        int u = 0, v = 1;
        int m = modulo;
        while (a != 0) {
        int t = m / a;
        m -= t * a; swap(a, m);
        u -= t * v; swap(u, v);
        }
        assert(m == 1);
        return (u + modulo) % modulo;
        }
        /*#include "testlib.h"
        int main(int argc, char* argv[])
        {
        iostream::sync_with_stdio(0);
        cin.tie(0);
        cout.tie(0);
        registerGen(argc, argv, 1);
        int n,k;
        n=rnd.next(1,50);
        k=rnd.next(1,n);
        cout<<n<<' '<<k;
        }*/
        bool comp(int a,int b)
        {
            return a>b;
        }
        int factorial(int n,int r){
        int result=1;
        for(int i=0;i<r;i++){
        result=result*(n-i)%modulo;
        result=(result*inv(i+1)+modulo*2)%modulo;
        }
        return (result+modulo*2)%modulo;
        }
        int32_t main()
        {
            //freopen("output.txt","w", stdout);
            //freopen("input4.txt","r", stdin);
            iostream::sync_with_stdio(0);
            cin.tie(0);
            cout.tie(0);
            int n,a,b;
            cin>>n>>a>>b;
            //cout<<factorial(n,a)%modulo<<endl;
            int result=0,result2=0;
            result=factorial(n,a);
            if(a!=b)
            result2=factorial(n,b);
            else
            result2=0;
            cout<<(((power(2,n)-1)+modulo-result-result2)+modulo)%modulo;
            return 0;
        }


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		//prime numbers
		Scanner in = new Scanner(System.in);
	      int prime =0;
	      int n = in.nextInt();
	      int[] array = new int[n];
	      for(int i =0;i<n;i++){
	         array[i]= in.nextInt();
	      }
	      for(int j = 0; j<n;j++){
	    	  Boolean primeN = true;
	         for(int x = 2;x<Math.sqrt(array[j]+1);x++) {
	        	 if(array[j]%x==0) {
	        		 primeN = false;
	        	 }
	         }
	         if(primeN==true) {
	        	 prime+=1;
	         }
	         
	      }
	      System.out.println(prime);
}}


Measured memory_bytes: 41784
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <string.h>

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int t[5];
    int m[5] = {0};
    for (int i=0; i<5; i++) {
        cin >> t[i];
        if (t[i]%10 == 0) m[i] = 0;
        else m[i] = 10-t[i]%10;
    }
    int ans = 0; int last = -1; int idx;
    for (int i=0; i<5; i++) {
        if (last < m[i]) {
            last = m[i];
            idx = i;
        }
    }
    for (int i=0; i<5; i++) {
        if (i == idx) continue;
        ans += t[i] + m[i];
    }
    cout << ans + t[idx] << '\n';
    
    return 0;
}

Measured memory_bytes: 3660
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <cmath>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <iostream>
#include <random>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include <fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <bitset>
using namespace std;

using ll = long long;
using vll = vector<ll>;
using pll = pair<ll, ll>;
using qll = queue<ll>;
using vb = vector<bool>;
using mll = map<ll, ll>;
using sll = stack<ll>;
#define REP(i,n) for(ll i(0);(i)<(n);(i)++)
#define rep(i,n) for(ll i(0);(i)<(n);(i)++)
#define ALL(a) a.begin(), a.end()
#define enld endl //* missspell check
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; }

void solve(long long N){
    if(N % 1000){
        cout << 1000-(N%1000)<<endl;
    }
    else cout<<0<< endl;
}
int main(){
    long long N;
    scanf("%lld",&N);
    solve(N);
    return 0;
}


Measured memory_bytes: 3264
#!/usr/bin/env python3
import sys

YES = "YES"  # type: str
NO = "NO"  # type: str


def solve(A: int, V: int, B: int, W: int, T: int):
    distance = abs(A - B)
    velocity_diff = V - W
    if velocity_diff * T >= distance:
        print(YES)
    else:
        print(NO)
    return


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    V = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    W = int(next(tokens))  # type: int
    T = int(next(tokens))  # type: int
    solve(A, V, B, W, T)

if __name__ == '__main__':
    main()


Measured memory_bytes: 9208
import java.util.*;
import java.io.*;
 
import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
 
public class Main{
    static final long mod=1000000007;
    
    public  static void main(String[] args)   throws Exception, IOException{
        Reader sc = new Reader(System.in);
        PrintWriter out=new PrintWriter(System.out);
        // int n=sc.nextInt();
        // char c[][] = new char[h][w];
        // char c[]=sc.nextString().toCharArray();
        // for(int i=0; i<n; i++) {d[i]=sc.nextInt();}

        int n=sc.nextInt();
        int m=sc.nextInt();

        out.println(n%m==0? 0:1);
        out.flush();
    }


    static void db(Object... os){
        System.err.println(Arrays.deepToString(os));
    }  
}

class P implements Comparable<P>{
    int id, d;
    P(int  id, int d) {
        this.id=id;
        this.d=d;
    }
    public int compareTo(P p){
        return d-p.d; //des
    }
}

class Reader
{ 
    private BufferedReader x;
    private StringTokenizer st;
    
    public Reader(InputStream in)
    {
        x = new BufferedReader(new InputStreamReader(in));
        st = null;
    }
    public String nextString() throws IOException
    {
        while( st==null || !st.hasMoreTokens() )
            st = new StringTokenizer(x.readLine());
        return st.nextToken();
    }
    public int nextInt() throws IOException
    {
        return Integer.parseInt(nextString());
    }
    public long nextLong() throws IOException
    {
        return Long.parseLong(nextString());
    }
    public double nextDouble() throws IOException
    {
        return Double.parseDouble(nextString());
    }
}

Measured memory_bytes: 21204
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
typedef long double ld;
const ll INF = 1e+14;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back

void Yes(){
	cout<<"Yes"<<endl;
	exit(0);
}
 
void No(){
	cout<<"No"<<endl;
	exit(0);
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
    string S; cin >> S;
    int N = S.size();
    int ans = 0;
    for(int i = 0 ; i < N ; i++) {
        for(int j = i ; j < N ; j++) {
            string T;
            bool flag = true;
            Rep(k, i, j + 1) {
                T += S[k];
                if(S[k] != 'A' && S[k] != 'T' && S[k] != 'G' && S[k] != 'C') {
                    flag = false;
                }
            }
            int M = T.size();
            if(flag) ans = max(ans, M);
        }
    }
    cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <string>
#include <stdio.h>
#include <sstream>

using namespace std;
void swap(int &a, int &b);

int main()
{
	string sRing;
	getline(cin, sRing);
	string sVeri;
	getline(cin, sVeri);

	int len_sR = sRing.size();
	int len_sV = sVeri.size();


	int plus_ch = len_sV - 1;

	for (int i = 0; i < plus_ch; ++i)
	{
		sRing += sRing[i];
	}

	len_sR = sRing.size();


	bool hasRing = false;
	for (int i = 0; i < len_sR; ++i)
	{
		int count = 0;
		for (int j = 0; j < len_sV; ++j)
		{
			
			if (sRing[i + j] == sVeri[j])
				count++;
			else
				break;
		}
		if (count == len_sV)
			hasRing = true;
	}

	if (hasRing == true)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;

	return 0;
}




Measured memory_bytes: 3192
a = int(input())
b = int(input())
c = int(input())
x = int(input())

ans = 0

for num_a in range(0, a + 1):
  for num_b in range(0, b + 1):
    for num_c in range(0, c + 1):
      if 500 * num_a + 100 * num_b + 50 * num_c == x:
        ans += 1

print(ans)

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

const int MAX_N = 110;

int which [MAX_N];

void go (int m) {
    for (int i = 1; m - i + 1 > i; ++i)
        which [i] = which [m - i + 1] = i;
}

int main () {
    ios::sync_with_stdio (false);
    cin.tie (0);
    int n;
    cin >> n;
    go (n - n % 2);
    if (n & 1)
        which [n] = n;
    vector <pair <int, int>> out;
    for (int i = 1; i <= n; ++i)
        for (int j = i + 1; j <= n; ++j)
            if (which [i] != which [j])
                out.emplace_back (i, j);
    cout << out.size () << '\n';
    for (auto [u, v] : out)
        cout << u << " " << v << '\n';
    return 0;
}


Measured memory_bytes: 3680
#include<stdio.h>
int main(void){
   int a[20000],i,k;

   for(i=1;i<=20000;i++){
      scanf("%d",&a[i]);
      if(a[i]==0){
         k=i;
         break;
      }
   }
   for(i=1;i<=k-1;i++){
      printf("Case %d: %d\n",i,a[i]);
   }

   return 0;
}


Measured memory_bytes: 2036
// D.

#include <iostream>
#include <sstream>
#include <algorithm>
#include <vector>

using namespace std;

typedef long long LL;
const LL MOD = 1000000007;
static const size_t MAX_N = 200050;

struct modll {
	long long x;
	modll() { }
	modll(long long _x) : x(_x) { }
	operator int() const { return (int)x; }
	modll operator+(const modll& r) { return (x + r.x) % MOD; }
	modll operator+=(const modll& r) { return x = (x + r.x) % MOD; }
	modll operator-(const modll& r) { return (x + MOD - r.x) % MOD; }
	modll operator-=(const modll& r) { return x = (x + MOD - r.x) % MOD; }
	modll operator*(const modll& r) { return (x * r.x) % MOD; }
	modll operator*(int r) { return (x * r) % MOD; }
	modll operator*=(const modll& r) { return x = (x * r.x) % MOD; }
	static modll modinv(int a) { return modpow(a, MOD - 2); }
	static modll modpow(int a, int b) {
		modll x = a, r = 1;
		for (; b; b >>= 1, x *= x) if (b & 1) r *= x;
		return r;
	}
};

modll combination(LL n, LL r) {
	static modll fact[MAX_N + 1], inv[MAX_N + 1];
	if (!fact[0]) {
		fact[0] = 1;
		for (int i = 1; i <= MAX_N; ++i) {
			fact[i] = fact[i - 1] * i;
		}
		inv[MAX_N] = modll::modinv(fact[MAX_N]);
		for (int i = MAX_N; i >= 1; --i) {
			inv[i - 1] = inv[i] * i;
		}
	}
	if (r > n) {
		return 0;
	}
	return (fact[n] * inv[r]) * inv[n - r];
}

int main(int argc, char *argv[]) {
	int h, w, a, b;
	cin >> h >> w >> a >> b;
	vector<modll> x(w, 0);
	modll ans = 0;
	for (int i = b; i < w; ++i) {
		x[i] = combination(h - a - 1 + i, i);
		ans += (x[i] - x[i - 1]) * combination(a + w - 1 - i, a);
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 4096
#pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
using namespace std;
inline void rd(int &x){
  int k;
  int m=0;
  x=0;
  for(;;){
    k = getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
inline void rd(char &c){
  int i;
  for(;;){
    i = getchar_unlocked();
    if(i!=' '&&i!='\n'&&i!='\r'&&i!='\t'&&i!=EOF){
      break;
    }
  }
  c = i;
}
inline int rd(char c[]){
  int i;
  int sz = 0;
  for(;;){
    i = getchar_unlocked();
    if(i!=' '&&i!='\n'&&i!='\r'&&i!='\t'&&i!=EOF){
      break;
    }
  }
  c[sz++] = i;
  for(;;){
    i = getchar_unlocked();
    if(i==' '||i=='\n'||i=='\r'||i=='\t'||i==EOF){
      break;
    }
    c[sz++] = i;
  }
  c[sz]='\0';
  return sz;
}
inline void wt_L(char a){
  putchar_unlocked(a);
}
inline void wt_L(const char c[]){
  int i=0;
  for(i=0;c[i]!='\0';i++){
    putchar_unlocked(c[i]);
  }
}
int N;
int L;
char S[10002];
int main(){
  int i;
  rd(N);
  L = rd(S);
  for(i=(0);i<(L);i++){
    S[i] = (S[i]-'A'+N)%26 + 'A';
  }
  wt_L(S);
  wt_L('\n');
  return 0;
}
// cLay varsion 20191123-1

// --- original code ---
// int N, L;
// char S[10002];
// {
//   rd(N,S@L);
//   rep(i,L) S[i] = (S[i]-'A'+N)%26 + 'A';
//   wt(S);
// }


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int A = sc.nextInt();
        int B = sc.nextInt();
        int C = sc.nextInt();
        int D = sc.nextInt();

        System.out.println(solve(A, B, C, D));

        sc.close();
    }

    static int solve(int A, int B, int C, int D) {
        return Math.min(A, B) + Math.min(C, D);
    }
}

Measured memory_bytes: 21972
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);

        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();

        sc.close();

        if (a * c < b) {
            System.out.println(c);
        } else {
            System.out.println(b / a);
        }
    }
}


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

using namespace std;

#define int long long
#define MP make_pair
#define PB push_back
#define FI first
#define SE second
#define MAX_K 200000
typedef pair< int,pair<int,pair<int, int> > > P3;
typedef pair<int, pair<int, int> > P2;
typedef pair<int, int> P1;
static const int INF = 1ll<<60;
static const int dx[] = { 1, -1, 0, 0, };
static const int dy[] = { 0, 0, 1, -1 };

int W1,H1,W2,H2,R;
int sx1,sy1,sx2,sy2;
int fe1[550][550],fe2[550][550];
vector<int> V;
vector<int> S;
map<int,int> level[2];
int ans=INF;
int visit[550][550];

void input(int* W,int* H,int* sx,int* sy,int fe[550][550]){
    scanf("%d%d%d%d",W,H,sx,sy);
    for(int y=0;y<*H;++y)
        for(int x=0;x<*W;++x)scanf("%d",&fe[y][x]);
}

void bfs(int num,int W,int H,int sx,int sy,int fe[550][550]){
    memset(visit,0,sizeof(visit));
    priority_queue<P2,vector<P2>,greater<P2> > que;
    que.push(P2(fe[sy-1][sx-1],P1(sx-1,sy-1)));
    while(!que.empty()){
        P2 p = que.top();
        que.pop();
        int cost=p.first;
        int x=p.second.first;
        int y=p.second.second;
        if(visit[y][x]==1)continue;
        visit[y][x]=1;
        level[num][cost]++;
        for(int i=0;i<4;++i){
            int nx=x+dx[i],ny=y+dy[i];
            if(nx<0||nx>=W||ny<0||ny>=H||visit[ny][nx])continue;

            int maxcost=max(cost,fe[ny][nx]);
            que.push(P2(maxcost,P1(nx,ny)));
        }
    }
}

signed main(){
    while(1){
        cin>>R;
        if(R==0)break;
        input(&W1,&H1,&sx1,&sy1,fe1);
        input(&W2,&H2,&sx2,&sy2,fe2);
        bfs(0,W1,H1,sx1,sy1,fe1);
        bfs(1,W2,H2,sx2,sy2,fe2);

        int sum1=0;

        for(map<int,int>::iterator i=level[0].begin();i!=level[0].end();++i){
            S.PB(i->first);
            V.PB(i->second+sum1);
            sum1+=i->second;
        }

        int sum2=0;
        level[0][0]=0;
        level[1][0]=0;
        for(map<int,int>::iterator i=level[1].begin();i!=level[1].end();++i){
            int cost = i->first;
            int cnt2 = i->second+sum2;
            int cnt1 = *lower_bound(V.begin(),V.end(),R-cnt2);
            ans=min(ans,cost+S[lower_bound(V.begin(),V.end(),R-cnt2)-V.begin()]);
            sum2+=i->second;
        }

        cout<<ans<<endl;
        ans=INF;
        V.clear();
        S.clear();
        level[0].clear();
        level[1].clear();
    }
}

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

using namespace std;

typedef long long ll;

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

    int n;
    cin >> n;

    vector<int> v(n);
    bool aproved = true;
    for(int i=0; i<n; i++){
        cin >> v[i];
        if(v[i]%2==0){
            if(v[i]%3 and v[i]%5) aproved = false;
        }
    } 

    if(aproved) cout << "APPROVED\n";
    else cout << "DENIED\n";

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> mp;
typedef pair<ll,mp> mypair;
#define MAXN 1001024
#define INF 1000000007
int gcd(int a,int b){
	if(b==0)return a;
	else return gcd(b,a%b);
}
ll extgcd(ll a,ll b,ll &x,ll &y){
	if(b==0){
		x=1;
		y=0;
		return a;
	}
	ll d = extgcd(b,a%b,y,x);
	y -= a/b * x;
	return d;
}
//ax+by = c
mypair extgcd(ll a,ll b){
  ll x,y;
  ll d = extgcd(a,b,x,y);
  mp tmp = mp(x,y);
  return mypair(d,tmp);
}

//素数列挙
ll prime[MAXN] ;//segment_sieve [a,b)
bool is_prime[MAXN];
int sieve(int n){
	int res = 0;
	fill(is_prime,is_prime+MAXN,true);
	is_prime[0] = is_prime[1] = false;
	for(int i = 2;i<=n;i++){
		if(!is_prime[i])continue;
		prime[res++] = i;
		for(int j = 2*i;j<=n;j+=i)is_prime[j] = false;
	}
	return res;	
}
bool is_prime_ab[MAXN];
ll segment_sieve(ll a,ll b){
	fill(is_prime,is_prime+MAXN,true);
	fill(is_prime_ab,is_prime_ab+MAXN,true);
	for(int i=2;i*i <= b-1 ;i++){
		if(!is_prime[i]) continue;
		for(ll j = 2*i;j*j<=b-1;j+=i)is_prime[j] = false;
		for(ll j = a-a%i;j<b;j += i){
			if(j< a) continue;
			if(is_prime_ab[j-a]) is_prime_ab[j-a] = false;
		}
	}
	ll res = 0;
	for(ll i = a;i< b ;i++ )if(is_prime_ab[i-a] ) prime[res++] = i;
	return res;
}

bool is_primef(ll n){
	if(n==1) return false;
	for(ll i=2;i*i<=n;i++)
		if(n%i==0)return false;
	return true;
}

vector<ll> divisors(ll n){
	vector<ll> res;
	for(ll i=1;i*i<=n;i++){
		if(n%i != 0) continue;
		res.push_back(i);
		if(n/i== i)continue;
		res.push_back(n/i);
	}
	return res;
}
map<ll,ll> prime_factors(ll n){
	map<ll,ll> res;
	if(n<=1){
		res[n] = 1;
		return res;
	}
	
	//for(int i=2,_n = n;i*i<=_n;i++){
	for(ll i=2;i*i<=n;i++){
		while(n%i==0){
			res[i]++;
			n /= i;
		}
	}
	if(n!=1)res[n] = 1;
	return res;
}

//1からnまででnと互いにそなものの数
ll euler_phi(ll n){
	ll cnt = n;
	map<ll,ll> res = prime_factors(n);
	for(auto it = res.begin(),end = res.end();it!=end;it++){
		cnt = cnt/it->first*(it->first-1);
	}
	return cnt;
}
ll pow(ll n,ll m){
	vector<ll> a(33);
	a[0] = n;
	for(int i=1;i<32;i++){
	a[i] = (a[i-1]*a[i-1])%INF;
	}
	ll res = 1;
	for(int i=0;i<32;i++){
	if( ( m&(1<<i) ) ){
		res = (res*a[i])%INF;
		}
	}
	return res;
}


int main(){
	ll a,b;
	cin>>a>>b;
	mypair ans = extgcd(a,b);
	mp xy  = ans.second;
	cout<<xy.first<<' '<<xy.second<<endl;
	return 0;
}



Measured memory_bytes: 3108
N = int(input())
*H, = map(int, input().split())
st = [(0, -1)]
ans = 0
for i in range(N):
    h = H[i]
    base = i
    while st and h <= st[-1][0]:
        h0, j = st.pop()
        ans = max(ans, (i-j)*h0)
        base = j
    st.append((h, base))
while st:
    h0, j = st.pop()
    ans = max(ans, (N-j)*h0)
print(ans)

Measured memory_bytes: 22348
#!/usr/bin/env python3
import sys, math, fractions, itertools


def solve(x: int):
    if x <= 6:
        print(1)
    else:
        m = (x-6) // 11
        if (x - 6) % 11 == 0:
            print(2 * m + 1)
        elif x - 6 <= 11 * m + 5:
            print(1 + (2 * m + 1))
        else:
            print(1 + (2 * m + 2))
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    x = int(next(tokens))  # type: int
    solve(x)

if __name__ == '__main__':
    main()


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

int main(){
  int r, g, b;
  cin >> r >> g >> b;
  if((r * 100 + g * 10 + b) % 4 == 0){
    cout << "YES" << endl;
  } else{
    cout << "NO" << endl;
  }
  return 0;
}

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

class Program{
  static void Main(){
    int N = int.Parse(Console.ReadLine());
    string[] A = Console.ReadLine().Split(' ');
    var slist = new List<Student>();
    
    for (int i = 0; i < N; i++){
      slist.Add(new Student(i, int.Parse(A[i])));
    }
    slist.Sort();
    
    int[] ans = new int[N];
    for (int i = 0; i < N; i++){
      ans[i] = slist[i].number + 1;
    }
    
    Console.WriteLine(string.Join(" ", ans));
  }
}

public class Student : IComparable{
  public int number {get; set;}
  public int order {get; set;}
  
  public Student(int n, int o){
    this.number = n;
    this.order = o;
  }
  
  public int CompareTo(object obj){
    Student s = (Student)obj;
    return this.order - s.order;
  }
}

Measured memory_bytes: 34136
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define rep(i,m,n) for(int (i)=(m);(i)<(n);++(i))
#define rREP(i,m,n) for(int (i)=(n)-1;(i)>=(m);--(i))
#define all(x) (x).begin(),(x).end()
#define out(y,x,h,w) (y)<0||(x)<0||(y)>=(h)||(x)>=(w)
constexpr int INF = 1000000001;
constexpr ll mod = 1000000007;
constexpr double PI = 3.1415926535897932;
template<class T>inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
template<class T>inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}
inline void init() {
	cin.tie(nullptr); cout.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}

template<class T>T Pow(T a, int n) {
	T ret = 1;
	while (n > 0) {
		if (n & 1)ret *= a;
		a *= a;
		n >>= 1;
	}
	return ret;
}

int main() {
	init();
	
	int N, M; cin >> N >> M;
	int ans = (1900 * M + (N - M) * 100) * Pow(2, M);
	cout << ans << "\n";

	return 0;
}

Measured memory_bytes: 3608
using System;
using System.Linq;

namespace ABC129
{
	class Program
	{
		static void Main(string[] args)
		{
			var L = Console.ReadLine();
			long mod = 1000000007;
			var ans = L.Skip(1).Aggregate(new long[] { 1, 2 }, (p, c) => c == '1' ? new[] { (p[0] * 3 + p[1]) % mod, (p[1] * 2) % mod } : new[] { (p[0] * 3) % mod, p[1] });
			Console.WriteLine(ans.Sum() % mod);
		}
	}
}


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

using namespace std;


int main()
{
	int n, W;
	cin >> n >> W;

	vector<int> w(n + 1), v(n + 1);

	for(int i = 1; i <= n; i++)
		cin >> w[i] >> v[i];

	int V = *max_element(v.begin(), v.end()) * n;
	vector<vector<int>> dp(n + 1, vector<int>(V + 1, W + 1));


	dp[0][0] = 0;

	for(int i = 1; i <= n; i++)
	{
		for(int j = 0; j <= V; j++)
		{
			dp[i][j] = dp[i - 1][j];

			if(j >= v[i])
				dp[i][j] = min(dp[i][j], dp[i - 1][j - v[i]] + w[i]);
		}
	}

	for(int i = V; i > -1; i--)
	{
		if(dp[n][i] <= W)
		{
			cout << i << endl;
			return 0;
		}
	}
}

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

#define rep( i, n, m ) for(int i = ( n ); i < ( m ); i++)
#define rep_d( i, n, m ) for(int i = ( n ) - 1; i >= ( m ); i--)
#define sort_asc( X ) sort(( X ).begin(), ( X ).end())
#define sort_desc( X ) sort(( X ).begin(), ( X ).end(), greater <>())
#define endl "\n"

template <class T> bool chmax( T& a, T b );
template <class T> bool chmin( T& a, T b );
int* eratosthenes( int N );
bool bit_search( int pattern, int N );
void initialize( void );

const ll INF = 1LL << 60;
const int k_mod = 1e9 + 7;
template <typename T, typename K> struct P {
	T a; K b;
};
typedef struct {
	vector <int> to;
	int cost;
} edge;

int main( void ){
	// initialize();
	int N;
	cin >> N;
	int ans = N%1000;
	if (ans == 0)
		cout << ans << endl;
	else
		cout << 1000-ans << endl;
}

template <class T> bool chmax( T& a, T b ) {
	if (a < b){
		a = b; return true;
	}
	return false;
}
template <class T> bool chmin( T& a, T b ) {
	if (a > b){
		a = b; return true;
	}
	return false;
}
int* eratosthenes( int N ){
	int* prime_array = new int[ N + 1 ];
	int lim = N;
	prime_array[ 0 ] = 0;
	prime_array[ 1 ] = 0;
	rep( i, 2, N + 1 ){
		prime_array[ i ] = 1;
	}
	rep( i, 2, lim ){
		if (prime_array[ i ] == 0)
			continue;
		lim = N / i;
		for(int j = i * 2; j < N + 1; j += i){
			prime_array[ j ] = 0;
		}
	}
	return prime_array;
}
bool bit_search( int pattern, int N ){
	int cnt = 0;
	rep( bit, 0, N ){
		if (pattern & ( 1 << bit )){
			cnt++;
		}
	}
	return true;
}
void initialize( void ){
	cout << fixed << setprecision( 10 );
}


Measured memory_bytes: 3604
using System;

namespace ABC052_A_Two_Rectangles
{
	internal class Program
	{
		public static void Main(string[] args)
		{
			string[] input = Console.ReadLine().Split(' ');
			int a = int.Parse(input[0]);
			int b = int.Parse(input[1]);
			int c = int.Parse(input[2]);
			int d = int.Parse(input[3]);
			
			if(a * b > c * d) Console.WriteLine(a * b);
			else if(a * b < c * d) Console.WriteLine(c * d);
			else Console.WriteLine(a * b);
		}
	}
}

Measured memory_bytes: 13140
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define FOR(i,l,r) for(ll i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define REPS(i,n) FOR(i,1,n+1)
#define RFOR(i,l,r) for(ll i=(l);i>=(r);--i)
#define RREP(i,n) RFOR(i,n-1,0)
#define RREPS(i,n) RFOR(i,n,1)
#define pb push_back
#define eb emplace_back
#define SZ(x) ((ll)(x).size())
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
template<class T = ll> using V = vector<T>;
template<class T = ll> using VV = V<V<T>>;
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true; }return false; }
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true; }return false; }
inline void Yes(bool b = true) {cout << (b ? "Yes" : "No") << '\n';}
inline void YES(bool b = true) {cout << (b ? "YES" : "NO") << '\n';}
inline void err(bool b = true) {if(b) {cout << -1 << '\n'; exit(0);}}
template<class T> inline void fin(bool b = true, T e = 0) {if(b) {cout << e << '\n'; exit(0);}}
template<class T> T Roundup_div(T x, T y) {return (x+(y-1))/y;}
const ll INF = 1e18;
const ld eps = 1e-4;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int d; cin >> d;
    int c[26];
    REP(i,26) cin >> c[i];
    int lsum = 0;
    REP(i,26) lsum += c[i];
    int v[d][26];
    REP(i,d)REP(j,26) cin >> v[i][j];
    V<> sol;
    V<> loss(26,0);
    V<set<int>> pla(26);
    REP(i,26) pla[i].insert(-1);
	REP(i,26) pla[i].insert(366);
    REP(i,d){
        V<pair<ld,ll>> score(26,{0.0,0});
        REP(j,26) score[j] = {v[i][j] + loss[j] + c[j] * eps, j};
        sort(rall(score));
        int r = score[0].second;
        sol.pb(r);
        pla[r].insert(i);
        REP(j,26){
            if(j == r) loss[j] = 0;
            else loss[j] += c[j];
        }
    }
    REP(i,26) loss[i] = 0;
    ll nowres = 0;
    REP(i,d){
        nowres += v[i][sol[i]];
        REP(j,26){
            if(j == sol[i]) loss[j] = 0;
            else loss[j] += c[j];
            nowres += loss[j];
        }
    }
    int Q = 150000;
    random_device rnd;
    while(Q--){
        int newi = rnd() % 365;
        int newsol = rnd() % 26;
        if(sol[newi] == newsol) continue;
        int old = sol[newi];
        sol[newi] = newsol;
        REP(i,26) loss[i] = 0;
        ll newres = 0;
        REP(i,d){
            newres += v[i][sol[i]];
            REP(j,26){
                if(j == sol[i]) loss[j] = 0;
                else loss[j] += c[j];
                newres += loss[j];
            }
        }
        if(newres < nowres) sol[newi] = old;
    }
    REP(i,d) cout << sol[i] + 1 << endl;
}

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

namespace AizuOnLine_Lesson
{
    class Program
    {
        static void Main(string[] args)
        {
            List<int> data = Program.GetData();

            int minNum = data[0];
            int maxNum = data[0];
            int diff = -1000000000;

            for (int i = 1; i < data.Count; i++)
            {
                if (data[i] < minNum)
                {
                    minNum = data[i];
                    maxNum = data[i];
                    diff = Math.Max(diff, data[i] - data[i - 1]);
                }
                else if (maxNum < data[i])
                {
                    maxNum = data[i];
                    diff = Math.Max(diff, maxNum - minNum);
                }
                else
                {
                    diff = Math.Max(diff, 0);
                }
            }

            Console.WriteLine(diff);
        }


        private static List<int> GetData()
        {
            List<int> data = new List<int>();

            int count = Convert.ToInt32(Console.ReadLine());

            for (int i = 0; i < count; i++)
            {
                data.Add(Convert.ToInt32(Console.ReadLine()));
            }

            return data;
        }
    }
}

Measured memory_bytes: 15952
#include <bits/stdc++.h>
#define ll         long long int 
#define pb         push_back
#define umap       unordered_map
#define mod        1000000007
#define all(x)     (x).begin(), (x).end()
#define rall(x)    (x).rbegin(), (x).rend()
#define MN(a,b,c)  min(a,min(b,c))
#define MX(a,b,c)  max(a,max(b,c))
#define pr1         pair<ll,ll>
#define F          first
#define S          second
#define mP         make_pair
#define f(i,n)     for(int i=0;i<n;i++)
#define f1(i,x,y)  for(int i=x;i<=y;i++)
#define f2(i,x,y)  for(int i=x;i>=y;i--)
#define yes        cout<<"YES"<<"\n"
#define no         cout<<"NO"<<"\n"
#define modsum(a,b)  ((a%mod)+(b%mod))%mod
#define modpro(a,b)  ((a%mod)*(b%mod))%mod
//__builtin_popcount(x)
//__builtin_parity(x)   =(number of set bits)%2
//__builtin_clz(x)      to count the number of leading  zeroes 
//__builtin_ctz(x)      to count the number of trailing zeroes 
//__gcd(a,b)
using namespace std;
int main()
{
 ios_base::sync_with_stdio(false);
 cin.tie(NULL);
 int  R,C,M;cin>>R>>C>>M;
 int  mx=0;
 int  x,y;
 map<pair<int, int>, int> vis; 
 umap <int,int> fr,fc;
 int fmxr=0,fmxc=0;
 int mxr=0,mxc=0;
 f1(i,1,M)
 {
     cin>>x>>y;fr[x]++;fc[y]++;
     vis[{x,y}]=1;
     mxr=max(mxr,fr[x]);mxc=max(mxc,fc[y]);
 }
 vector <int> MX,MY;
 for(auto it=fr.begin();it!=fr.end();++it)
 {if((it->S)==mxr){MX.pb(it->F);}}
 for(auto it=fc.begin();it!=fc.end();++it)
 {if((it->S)==mxc){MY.pb(it->F);}}
  y=0;
 for(int i=0;i<MX.size();i++)
 {
     for(int j=0;j<MY.size();j++)
     {
         if(vis[{MX[i],MY[j]}]==0)
         {y=1;break;}
     }
 }
 if(y)cout<<mxc+mxr;
 else cout<<mxc+mxr-1;
}
  

Measured memory_bytes: 69868
#include<iostream>
#include<cstring>
using namespace std;
string a;
int len;
int main()
{
    cin>>a;
	len=a.size();
    for(int i=0;i<len;i++)
    {
        if(a[i]=='C')
        {
            for(int j=i+1;j<len;j++)
            {
                if(a[j]=='F')
                {
                    cout<<"Yes";
                    return 0;
                }
            }
        }
    }
    cout<<"No";
    return 0;
}

Measured memory_bytes: 256