akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define it ::iterator
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double ESP=1e-10;
using namespace std;
int a[8][3]={
  {  0,  0,  0},
  {  0,  0,255},
  {  0,255,  0},
  {  0,255,255},
  {255,  0,  0},
  {255,  0,255},
  {255,255,  0},
  {255,255,255}
};
string out[8]={"black","blue","lime","aqua","red","fuchsia","yellow","white"};
int main(){
  string in;
  map<char,int>c;
  rep(i,10)c[i+'0']=i;
  loop(i,'a','f'+1)c[i]=i-'a'+10;
  while(cin>>in,in!="0"){
    int min=1e9;
    int mini=1e9;
    int b[3]={c[in[1]]*16+c[in[2]],c[in[3]]*16+c[in[4]],c[in[5]]*16+c[in[6]]};
    //cout<<b[0]<<" "<<b[1]<<" "<<b[2]<<endl;
    rep(i,8){
      double sum=0;
      rep(j,3)sum+=pow(b[j]-a[i][j],2);
      if(min>sum){min=sum;mini=i;}
    }
    cout<<out[mini]<<endl;
  }
}

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

long long d[51][51];
long long num[51];

void combi(int n){

    for(int i=0;i<=n;i++){
        for(int j=0;j<=i;j++){
            if(i==j || j==0) d[i][j]=1;
            else d[i][j] = d[i-1][j-1] + d[i-1][j];
        }
    }
}

int main(int argc, const char * argv[]) {
   
    int n,a,b;
    
    scanf("%d %d %d",&n,&a,&b);
    
    for(int i=0;i<n;i++){
        scanf("%lld",&num[i]);
    }
    combi(n);
    sort(num,num+n);
    reverse(num, num+n);
    
    double sum = 0.0;
    double sum_average;
    for(int i=0;i<a;i++){
        sum+=num[i];
    }
    sum_average = sum/a;
    int same_cnt = 0;
    int need_cnt = 0;
    for(int i=0;i<n;i++){
        if(num[i] == num[a-1]){
            
            same_cnt++;
            if(i<a){
                need_cnt++;
            }
        }
    }
    long long ans = 0;
    if(need_cnt==a){
        for(int i=a;i<=b;i++) ans += d[same_cnt][i];
    }else{
        ans += d[same_cnt][need_cnt];
    }
    //printf("%lf\n",(double)sum/a);
    cout.precision(20);
    cout << fixed << sum_average << '\n';
    printf("%lld\n",ans);
    
    return 0;
}


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

int main(){
    int n; cin >> n;
    string S; cin >> S;
    //string S = "aabbbbaaca";
    string ans;
    ans += S[0];
    for(int i = 1; i < S.size(); i++){
        //cout << S[i] << endl;
        if(S[i] != S[i-1]) ans += S[i];
    }
    cout << ans.size() << endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define fi(i,a,b) for(int i=a;i<=b;i++)
#define fid(i,a,b) for(int i=a;i>=b;i--)
#define ll long long
#define pii pair<int,int>
#define TTT "Grid1"
#define maxn 1005
#define mo 1000000007
using namespace std;
int m, n;
char a[maxn][maxn];
int f[maxn][maxn];
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);
    #ifndef ONLINE_JUDGE
    freopen(TTT".inp", "r", stdin);
    freopen(TTT".out", "w", stdout);
    #endif // ONLINE_JUDGE
    cin >> m >> n;
    fi(i, 1, m)
    fi(j, 1, n)
        cin >> a[i][j];
    f[1][1] = 1;
    fi(i, 1, m)
    fi(j, 1, n)
    if(i != 1 || j != 1)
    if(a[i][j] == '.')
        f[i][j] = (f[i - 1][j] + f[i][j - 1]) % mo;
    cout << f[m][n];
}


Measured memory_bytes: 8496
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define pll pair<ll,ll>

string s,t;

string lcs_recursive(int index1,int index2,string str){
    if(index1>=s.length() || index2>=t.length())  return str;
    if(s[index1]==t[index2]){
        str.pb(s[index1]);
        return lcs_recursive(index1+1,index2+1,str);
    }
    else{
        string a=lcs_recursive(index1+1,index2,str),b=lcs_recursive(index1,index2+1,str);
        if(a.length()>b.length())   return a;
        return b;
    }
}

string lcs_dp(){
    int dp[s.length()+1][t.length()+1];
    memset(dp,0,sizeof dp);
    int mx=0;
    string ans="";
    for(int i=0;i<s.length();i++){
        for(int j=0;j<t.length();j++){
            if(s[i]==t[j]){
                dp[i+1][j+1]=max(dp[i+1][j+1],dp[i][j]+1);
            }
            dp[i+1][j+1]=max(dp[i+1][j+1],dp[i+1][j]);
            dp[i+1][j+1]=max(dp[i+1][j+1],dp[i][j+1]);
        }
    }
    int i=s.length(),j=t.length();
    while(i>0 && j>0 && dp[i][j]>0){
        if(dp[i][j]==dp[i][j-1]){
            j--;
        }
        else if(dp[i][j]==dp[i-1][j]){
            i--;
        }
        else{

            i--;j--;ans.pb(s[i]);
        }
    }
    reverse(ans.begin(),ans.end());
    return ans;
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    cin>>s>>t;
    // cout<<lcs_recursive(0,0,"")<<endl;
    cout<<lcs_dp()<<endl;
}


Measured memory_bytes: 35456
from sys import stdin
from collections import deque
V, E = map(int, stdin.readline().split())
adj_list = [[] for _ in [0] * V]
is_visited = [False] * V
for _ in [0] * E:
    s, t = map(int, stdin.readline().split())
    adj_list[s].append(t)
out = deque()
def dfs(u):
    is_visited[u] = True
    for v in adj_list[u]:
        if not is_visited[v]:
            dfs(v)
    out.appendleft(u)
for s in range(V):
    if not is_visited[s]:
        dfs(s)
print(*out, sep='\n')

Measured memory_bytes: 11192
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
typedef long long ll;
const int INF = 1000000000;
const long INF64 = 1000000000000000ll;
const ll MOD = 1000000007ll;


int main(){
	std::vector<int> a={1,3,5,7,8,10,12},b={4,6,9,11},c={2};
	int x,y;
	std::cin >> x>>y;
	auto res=find(all(a),x);
	if(res!=a.end()){x=1;goto hoge;}
    res=find(all(b),x);
	if(res!=b.end()){x=2;goto hoge;}
    res=find(all(c),x);
	if(res!=c.end())x=3;
hoge:
	res=find(all(a),y);
	if(res!=a.end()){y=1;goto hogee;}
    res=find(all(b),y);
	if(res!=b.end()){y=2;goto hogee;}
    res=find(all(c),y);
	if(res!=c.end())y=3;
hogee:
	if(x==y)std::cout << "Yes" << std::endl;
	else std::cout << "No" << std::endl;
}


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

int main() {
  long long n, k;
  cin >> n >> k;
  map<int, long long> num;
  for (int i = 0; i < n; i++) {
    int i1, i2;
    cin >> i1 >> i2;
    num[i1] += i2;
  }
  long long total = 0;
  for (auto x : num) {
    total += x.second;
    if (total >= k) {
      cout << x.first << endl;
      break;
    }
  }
}

Measured memory_bytes: 4224
#include "bits/stdc++.h"
using namespace std;

int main() {
	int n, ans = INT_MIN, tmp = 0;
	bool alp[2][26] = { {0} };
	string s;
	cin >> n >> s;
	for (int i = 1; i < n; i++) {
		for (int j = 0; j < 26; j++) {
			if ((s.find('a' + j) < i) && (i <= s.rfind('a' + j)))tmp++;
		}
		ans = max(tmp, ans);
		tmp = 0;
	}
	cout << ans << "\n";
	return 0;
}

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

Measured memory_bytes: 580
#include <iostream>
#include <vector>

int main(){
  int K, N, Q;
  std::cin >> N;
  std::cin >> K;
  std::cin >> Q;
//  std::vector<int> point(N, K);
  std::vector<int> point_temp(N, K-Q);
  std::vector<int> A(Q, 0);
  for(int i=0; i<Q; i++){
    std::cin >> A[i];
  }
  for(int i=0; i<Q; i++){
    point_temp[A[i] - 1] += 1;
  }
  
  for(int i=0; i<N; i++){
    if(point_temp[i] > 0)
   	 std::cout << "Yes" << std::endl;
    else
   	 std::cout << "No" << std::endl;
  }

  return 0;
}

Measured memory_bytes: 1408
#include <iostream>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <set>
using namespace std;

int main(){
    int N;
    cin >> N;
    vector<tuple<string, int, int>> SP(N);
    for(int i=0; i<N; i++){
        string S;
        int P;
        cin >> S >> P;
        SP[i] = make_tuple(S, -P, i+1);
    }
    sort(SP.begin(), SP.end());
    for(int i=0; i<N; i++)
        cout << get<2>(SP[i]) << endl;

    return 0;
}

Measured memory_bytes: 256
def jud_sq(n)
  root = n ** 0.5
  i = 1
  while (i+1) <= root
    i += 1
  end
  if i == root
    return 1
  else
    return 0
  end
end

n, d = gets.split.map(&:to_i)
x = Array.new(n).map{Array.new(d)}
for i in 0..(n-1)
  x[i] = gets.split.map(&:to_i)
end
cnt = 0
for i in 0..(n-1)
  for j in (i+1)..(n-1)
    sum = 0
    for k in 0..(d-1)
      sum += (x[i][k] - x[j][k]) ** 2
    end
    cnt += 1 if jud_sq(sum) == 1
  end
end
puts cnt

Measured memory_bytes: 1788
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin >> n;
    int y;
    cin >> y;
    int a,b,c;
    c=y/1000;
    if(c<n){
        cout << -1 << " " << -1 << " " << -1;
        return 0;
    }
    if(c==n){
        cout << 0 << " " << 0 << " " << c;
        return 0;
    }
    b=min((c-n)/4,c/5);
    c-=5*b;
    a=b+c-n;
    b-=2*a;
    if(b<0){
        cout << -1 << " " << -1 << " " << -1;
        return 0;
    }
    cout << a << " " << b << " " << c;
}

Measured memory_bytes: 3628
#include <iostream>

using namespace std;

const int N = 20005;
int a[N],b[N],n;

int main() {
    ios::sync_with_stdio(0);
    cin >> n;
    for(int i = 1; i <= n; ++i) {
        a[i] = i*n;
        b[i] = (n-i+1)*n;
    }
    for(int i = 1; i <= n; ++i) {
        int p;
        cin >> p;
        a[p] += i-1;
    }
    for(int i = 1; i <= n; ++i)
        cout << a[i] << " ";
    cout << "\n";

    for(int i = 1; i <= n; ++i)
        cout << b[i] << " ";
    cout << "\n";

    return 0;
}

Measured memory_bytes: 768
#include <stdio.h>
#include <stdbool.h>
#include <string.h>

//??¢??°????????????????????£?¨?.
void setHeight();		//???????????\???.
int cal_s();			//?°´??????????????¢???????¨????.
void setEnd();			//??????????±???????.

						//??°?????????????????°.
int n = 0;				//??\????????°.
char c[20001] = {};		//??°??¢?????\???.
int h[20001] = {};		//??°??¢?????????.
int l[10001] = {};		//?°´??????????????¢???.
int k = 0;				//?°´??????????????°.
int a = 0;				//?°´?????????????????¢???.
int l_end = 0;			//?°´??????????????????c[].
int r_end = 0;			//?°´??????????????????c[].
bool fin = false;		//??¢?´¢??????????????°true.

int main(void) {
	int i = 0;

	//??\???.
	scanf("%s", c);
	n = strlen(c);

	//???????????\???.
	setHeight();

	//??¢???????¨????.
	i = 0;
	while (1) {
		//???????±???????.
		setEnd();

		//????????£???????????°?????????????????????.
		if (fin)
			break;

		//??¢??????????´?.
		l[i] = cal_s();

		//??????????????????.
		l_end = r_end;

		//???????????§??\???????????????????????????.
		if (l_end == n)
			fin = true;

		i++;
	}

	//????????°??¨?????¢???????¨????.
	k = i;
	for (i = 0; i < k; i++)
		a += l[i];

	//??????.
	printf("%d\n", a);
	printf("%d", k);
	for (i = 0; i < k; i++) {
		printf(" %d", l[i]);

		if (i == k - 1)
			printf("\n");
	}
	if (k == 0)
		printf("\n");

	return 0;
}

//???????????\???.
void setHeight() {
	int i = 0;

	h[0] = 0;			//?????????.

	for (i = 0; i < n; i++) {
		if (c[i] == '/')
			h[i + 1] = h[i] + 1;
		else if (c[i] == '_')
			h[i + 1] = h[i];
		else if (c[i] == '\\')
			h[i + 1] = h[i] - 1;
	}
}

//?°´??????????????¢???????¨????.
int cal_s() {
	int i = 0;
	int sum = 0;		//??¢???.

	for (i = l_end; i < r_end; i++) {
		if (c[i] == '/') {
			sum += (h[l_end] - h[i + 1]) * 2 - 1;
		}
		else if (c[i] == '_') {
			sum += (h[l_end] - h[i + 1]) * 2;
		}
		else if (c[i] == '\\') {
			sum += (h[l_end] - h[i + 1]) * 2 + 1;
		}
	}

	return sum / 2;
}

//???????±???????.
void setEnd() {
	bool isFind = false;		//?????????????????????????????????.

	while (isFind == false && l_end != n) {
		//????????¨?????°?????????.
		if (c[l_end] == '/' || c[l_end] == '_') {
			l_end++;
			r_end++;
		}
		//???????????¢?´¢.
		else if (c[l_end] == '\\') {
			do{
				r_end++;

				if (h[l_end] == h[r_end])
					isFind = true;
				else if (r_end == n) {
					l_end++;
					r_end = l_end;
				}
			} while (l_end != r_end && isFind == false);
		}
	}

	//???????????§????????????????????£?????´???.
	if (!isFind)
		fin = true;
}

Measured memory_bytes: 656
import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        String str;
        int a,i;
        double ans,m;
        while(true) {
            m = 0;
            ans = 0;
            str = scan.nextLine();
            a = Integer.valueOf(str);
            if(a==0){
                break;
            }
            str = scan.nextLine();
            String[] num = str.split(" ", 0);
            int[] res = new int[a];
            for(i=0;i<a;i++){
                res[i] = Integer.valueOf(num[i]);
                m = (m*i + res[i])/(i+1);
            }
            for(i=0;i<a;i++){
                ans += Math.pow((res[i]-m),2)/a;
            }
            System.out.println(Math.sqrt(ans));
        }
        scan.close();
    }
}



Measured memory_bytes: 28372
#Coding by Rute
#ABC086 C - Travelingの解説を始めます。この問題ですが条件分岐によりO(N)で解くことが出来ました。
N = int(input())
now_t = 0 #現在のtとします。
now_x = 0 #現在のxとします。
now_y = 0 #現在のyとします。
flag = 0 #フラグ関数です。flag = 1のときNo, 0のときYesを出力します。
for i in range(N):
    t,x,y = map(int,input().split())
    #条件判定としては、|x-now_x|+|y-now_y| ≦ |t-now_t| かつ |x-now_x|+|y-now_y|の偶奇が|t-now-t|と一致するかどうかを判断すれば良いです。
    #なお、after contestがないケースは、|x-now_x|+|y-now_y| ≦ t で全て通っていました。
    if abs(x-now_x)+abs(y-now_y)<= abs(t-now_t) and (abs(x-now_x)+abs(y-now_y))%2 == abs(t-now_t)%2:
        now_t = t
        now_x = x
        now_y = y
    else:
        flag += 1
        break
if flag == 0:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 9132
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
const int mod = 1000000007;
int binpow(int a, int b) {
	int ret = 1;
	while (b) {
		if (b & 1) ret = 1LL * ret * a % mod;
		a = 1LL * a * a % mod;
		b >>= 1;
	}
	return ret;
}
int N, K;
int main() {
	cin >> N >> K;
	vector<int> d;
	for (int i = 1; i * i <= N; i++) {
		if (N % i == 0) {
			d.push_back(i);
			if (i * i != N) d.push_back(N / i);
		}
	}
	sort(d.begin(), d.end());
	vector<int> dp(d.size());
	int ret = 0;
	for (int i = 0; i < d.size(); i++) {
		dp[i] = binpow(K, (N % 2 == 0 && (N / 2) % d[i] == 0 ? d[i] : (d[i] + 1) / 2));
		for (int j = 0; j < i; j++) {
			if (d[i] % d[j] == 0) {
				dp[i] -= dp[j];
				if (dp[i] < 0) dp[i] += mod;
			}
		}
		ret = (ret + 1LL * dp[i] * d[i]) % mod;
	}
	cout << ret << endl;
	return 0;
}

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

string func(int num){
    string str = "";
    while(num >= 0) {
        int mod = num % 26;
        str += char(mod + 'a');
        num -= mod;
        num = num / 26 - 1;
    }
    reverse(str.begin(), str.end());
    return str;
}

int main(){

    set<string>st;
    int n;
    cin>>n;
    for(int i=0;i<n;i++){
        string s;
        cin>>s;
        for(int j = 0; j < s.size(); j++){
            for(int k=0;k<4 && j+k<s.size(); k++){
                st.insert(s.substr(j, k+1));
            }
        }
    }
    for(int i=0;;i++){
        string str = func(i);
        if(st.find(str)==st.end()){
            cout<<str<<endl;
            break;
        }
    }
    return 0;
}


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

int main() {

  long a, b, x;
  cin >> a >> b >> x;

  long a_ = a / x;

  if (a % x == 0) {
    a_--;
  }

  long b_ = b / x;

  cout << b_ - a_ << endl;

}

Measured memory_bytes: 256
// #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;
using ll = long long int;
using int64 = long long int;
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const int INF = 1LL << 29;
const ll LONGINF = 1LL << 60;
const ll MOD = 1000000007LL;
 
int main() {
    int X, N; cin >> X >> N;
    vector<int> P(N);
    for(int i=0; i<N; i++) cin >> P[i];

    vector<int> cnt(105);
    for(auto x : P) cnt[x]++;
    int min_diff = INF, ans = 0;
    for(int i=-200; i<=200; i++) {
        if(i >= 0 and cnt[i]) continue;
        int diff = abs(i - X);
        if(min_diff > diff) min_diff = diff, ans = i;
    }
    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 3716
import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		Ryouri[] array = new Ryouri[n];
		for (int i = 0; i < n; i++) {
			Ryouri r = new Ryouri(sc.nextInt(), sc.nextInt());
			array[i] = r;
		}
		sc.close();

		// vの降順
		Arrays.sort(array, new Comparator<Ryouri>() {
			public int compare(Ryouri r1, Ryouri r2) {
				return r2.v - r1.v;
			}
		});

		long sumA = 0L;
		long sumB = 0L;
		boolean oddFlg = true;
		for (int i = 0; i < n; i++) {
			if (oddFlg) {
				sumA += array[i].a;
			} else {
				sumB += array[i].b;
			}
			oddFlg = !oddFlg;
		}
		System.out.println(sumA - sumB);
	}

	static class Ryouri {
		int a;
		int b;
		int v;
		public Ryouri(int a, int b) {
			this.a = a;
			this.b = b;
			this.v = a + b;
		}
	}
}


Measured memory_bytes: 86408
#include<bits/stdc++.h>
using namespace std;
const long long mod=1000000007;
int main(){
    char s[100000];scanf("%s",s);
    int n=strlen(s);
    long long dp[n][4];
    fill(dp[0],dp[0]+n*4,0LL);
    if(s[0]=='?')dp[0][0]=3,dp[0][1]=1;
    else if(s[0]=='A')dp[0][0]=dp[0][1]=1;
    else dp[0][0]=1;
    for(int i=1;i<n;i++){
        for(int j=0;j<4;j++){
            if(!j){
                if(s[i]=='?')dp[i][j]=dp[i-1][j]*3;
                else dp[i][j]=dp[i-1][j];
            }
            else{
                if(s[i]=='?')dp[i][j]=dp[i-1][j]*3+dp[i-1][j-1];
                else if(s[i]=='A'+j-1)dp[i][j]=dp[i-1][j]+dp[i-1][j-1];
                else dp[i][j]=dp[i-1][j];
            }
            dp[i][j]%=mod;
        }
    }
    printf("%lld\n",dp[n-1][3]);
    return 0;
}

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

int main(){
  int N, H;
  cin >> N >> H;
  vector<int> a(N);
  vector<int> b(N);
  int ans=0;
  if(N==1){
    cin >> a.at(0) >> b.at(0);
    ans=((H-b.at(0))+(a.at(0)-1))/a.at(0)+1;
  }
  else{
  for(int i=0; i<N; i++){
    cin >> a.at(i) >> b.at(i);
  }
  sort(a.begin(), a.end());
  int maxa=a.at(N-1);
  sort(b.begin(), b.end());
  reverse(b.begin(), b.end());
  long long dam=0;
  int j=0;
  for(int i=0; i<N; i++){
    if(b.at(i)>maxa){
      dam+=b.at(i);
      if(dam>=H){
        ans=i+1;
        break;
      }
    }
    else break;
    j++;
  }
  if(dam<H){
    ans=((H-dam)+(a.at(N-1)-1))/a.at(N-1)+j;
  }
  }
  cout << ans << endl;
}

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

int main() {
	int n;cin>>n;
	vector<int> l(n);
	int sum=0;
	int max=0;
	for(auto& x:l){
		cin>>x;
		sum+=x;
		if(max<x)max=x;
	}
	if(sum-max>max){
		cout<<"Yes"<<endl;
	}else{
		cout<<"No"<<endl;
	}

	return 0;
}


Measured memory_bytes: 256
s=input()
s01 = ["0", "1"]
s10 = ["1", "0"]
a = 0
b = 0
for i in range(len(s)):
  if s[i] != s01[i%2]:
    a+=1
  if s[i] != s10[i%2]:
    b+=1
print(min(a,b))

Measured memory_bytes: 3188
#include<iostream>
#include<iomanip>
#include<vector>
#include<string>
#include<cstring>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<climits>
#include<fstream>

#define MOD (1000000007)

using namespace std;

typedef long long int Int;

constexpr Int TEN(int n) { return n == 0 ? 1 : 10 * TEN(n-1); }

int N,M;
vector<int> p;
int light[20];

int main(void) {
    cin>>N>>M;

    for(int i = 0;i < M;i++) {
        int k;
        cin>>k;
        int sum = 0;
        for(int j = 0;j < k;j++) {
            int s;
            cin>>s;
            sum += (1<<(s-1));
        }
        light[i] = sum;
    }

    for(int i = 0;i < M;i++) {
        int s;
        cin>>s;
        p.push_back(s);
    }

    int ans = 0;
    for(int bit = 0;bit < pow(2,N);bit++) {
        bool flag = true;
        for(int j = 0;j < M;j++) {
            int P = light[j]&bit;
            int count = 0;
            for(int i = 0;i < N;i++) {
                if(P&(1<<i))
                    count++;
            }
            if(count%2 != p[j]) {
                flag = false;
                break;
            }
        }
        if(flag)
            ans++;
    }

    cout<<ans<<endl;

    return 0;
}




Measured memory_bytes: 384
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();

		if (0 < A - 2 * B) {
			System.out.println(A - 2 * B);
		} else {
			System.out.println(0);
		}
	}
}


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

using namespace std;
typedef long long ll;
#define rep(i,j,n) for (ll i = j; i < (n); i++)
#define CLR(mat,f) memset(mat, f, sizeof(mat))
#define IN(a, b, x) (a<=x&&x<b)
#define out(ans) cout << ans << endl
typedef pair<ll,ll>P;
const ll mod=1e9+7;
const int INF = 1000000;
const double PI=3.14159265359;
int main(){

  int n,m;cin>>n>>m;
  int p[m+10];
  string s[m+10];
  rep(i,0,m)cin>>p[i]>>s[i];

  ll count=0;
  ll wa=0,ac=0;
  int ans=0;
  map<int,int>mp;
  rep(i,0,m){
    if(mp[p[i]]==-1)continue;
    // if(count==m)break;

    // cout<<p[i]<<":"<<mp[p[i]]<<endl;

    if(s[i]=="AC"){
      wa+=mp[p[i]];
      mp[p[i]]=-1;
      ac++;
    }else{
      mp[p[i]]++;
    }
  }

  cout<<ac<<" "<<wa<<endl;

  return 0;
}


Measured memory_bytes: 10752
#include <iostream>
#include <vector>
#include <utility>
#include <queue>
#include <stack>
#include <cstring>
#include <climits>
#include <set>
#include <map>
#include <algorithm>  
#include <cmath>
#include <iomanip>
#define ll long long
using namespace std;
ll n;
ll mod=pow(10,9)+7;
ll arr[405];
ll dpcost[405][405];
ll dpvalu[405][405];
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    cin>>n;
    for(ll i=0;i<n;++i)
    {
        cin>>arr[i];
    }
    for(ll i=0;i<n;++i)
    {
        dpcost[i][i]=0;
        dpvalu[i][i]=arr[i];
    }
    for(ll i=1;i<n;++i)
    {
        dpvalu[i-1][i]=arr[i-1]+arr[i];
        dpcost[i-1][i]=arr[i-1]+arr[i];
    }
    for(ll i=3;i<=n;++i)
    {
        for(ll j=0;j<=n-i;++j)
        {
            ll end=j+i-1;
            dpcost[j][end]=pow(10,13);
            for(ll part=j;part<end;++part)
            {
                ll add=dpcost[j][part]+dpcost[part+1][end]+dpvalu[j][part]+dpvalu[part+1][end];
                dpcost[j][end]=min(dpcost[j][end],add);
                dpvalu[j][end]=dpvalu[j][part]+dpvalu[part+1][end];
            }

        }
    }
    cout<<dpcost[0][n-1]<<endl;
}






































Measured memory_bytes: 6148
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
 
		int n = sc.nextInt();
      	long res = 0;
      for(int i = 1;i<=n; i++){
        if(i % 3 != 0 && i % 5 != 0){
          res+= i;
        }
      }
      
      System.out.println(res);
	}
}

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

using namespace std;
int main() {
  int a, b;
  cin >> a >> b;
  if ((a - b) % 2 == 0) {
    int diff = (a - b) / 2;
    if (diff < 0) diff *= -1;
    cout << (a > b ? b + diff : a + diff) << endl;
  } else {
    cout << "IMPOSSIBLE" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <numeric>
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REPS(i, n) for (int i = 1, i##_len = (n); i < i##_len; ++i)
#define ALL(x) (x).begin(), (x).end()

typedef long long int ll;
const int MOD = 1e9 + 7;
const int INF = 1e9;

using namespace std;

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

int main() {
  int N;
  cin >> N;
  int A[N];
  REP(i, N)
  cin >> A[i];

  ll result = A[0];
  REPS(i, N) result = gcd(result, A[i]);
  cout << result << endl;
}


Measured memory_bytes: 640
import java.util.Scanner;

public class Main {

	public static void solve (String n) {

		double sum = 0;
		for (int i = 0; i < n.length(); i++) {
			String str = n.substring( i, i + 1);
			int num = Integer.parseInt(str);
			sum += num;
		}

		if (sum % 9 == 0) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}

	public static void main(String[] args) {

		long start = System.currentTimeMillis();
	    // 引数で標準入力System.inを指定する
	    Scanner scanner = new Scanner(System.in);
		try {

		    // 1行目を取得(a)
	    	String input_text = scanner.nextLine();

			solve(input_text);

		} finally {
		    // Scannerクラスのインスタンスをクローズ
		    scanner.close();
		}
		long end = System.currentTimeMillis();
		// System.out.println((end - start) );
	}


	// ************************************
	// Common
	// ************************************

	private static final int[] changeArrayStringToInt(String line) {

		String[] strArray = line.split(" ");

		int[] intArray = new int[strArray.length];

		for (int i = 0; i < intArray.length; i++) {
			intArray[i] = Integer.parseInt(strArray[i]);
		}
		return intArray;
	}

}


Measured memory_bytes: 50396
n = int(input())
data = list(map(int,input().split()))
init = sum(data)
datb = list(map(int,input().split()))
res = 0
#print(data)
for i in range(len(datb)):
    #print("---------------")
    #pprint(datb)
    dmg = min(datb[i], data[i])
    data[i] = data[i] - min(datb[i], data[i])
    res += dmg

    datb[i] -= dmg
    datb[i] = 0 if datb[i] < 0 else datb[i]
    #print(datb)

    res += min(datb[i], data[i+1])
    data[i+1] = data[i+1] - min(datb[i], data[i+1])
    #print(data)

print(init - sum(data))


Measured memory_bytes: 83172
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <cmath>
#include <complex>
#include <map>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cassert>
#include <iomanip>
using namespace std;

#define Rep(b, e, i) for(int i = b; i <= e; i++)
#define Repr(e, b, i) for(int i = e; i >= b; i--)
#define rep(n, i) Rep(0, n-1, i)
#define repr(n, i) Repr(n-1, 0, i)
#define all(v) (v).begin(), (v).end()
#define pb(v) push_back(v)
#define uniq(v) (v).erase(unique(all(v)),(v).end())
#define bitcnt(x) __builtin_popcount(x)
#define fst first
#define snd second
#define Pqaz(T) priority_queue<T,vector<T>,greater<T>>
#define Pqza(T) priority_queue<T>
#define put(x) cout << x;
#define putsp(x) cout << x << ' ';
#define putbd cout << "---------------------------------------------" << endl;
#define putln(x) cout << x << endl;
#define debug(x) cerr << #x << "=" << x << endl;
#define ENJYU std::ios::sync_with_stdio(false);std::cin.tie(0);

typedef long long ll;
typedef pair<ll, ll> llP;
typedef pair<int, int> intP;
typedef complex<double> comp;
typedef vector <int> vec;
typedef vector <ll> vecll;
typedef vector <double> vecd;
typedef vector <vec> mat;
typedef vector <vecll> matll;
typedef vector <vecd> matd;

//vector の中身を出力
template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}

const int MAX = 200020;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<29;
const ll INFL = 1e18;
const int MOD = 1e9+7;

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

//********************************template END****************************************//

void solve(void){

	int N;
	cin >> N;
	rep(100, i) rep(100, j)
	{
		if (i * 4 + j * 7 == N)
		{
			cout << "Yes" << endl;
			return;
		}
	}
	cout << "No" << endl;

}

int main(void){
	solve();
	//cout << "yui(*-v・)yui" << endl;
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<string.h>
#include<algorithm>
#include<queue>
#include<stack>
#include<math.h>
#include<map>
typedef long long int ll;
using namespace std;
#define maxn 0x3f3f3f3f

int main()
{
    double l;
    scanf("%lf",&l);
    printf("%lf\n",pow(l/3,3));
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <queue>
#include <map>
using namespace std;
typedef long long ll;
const int INF = 1<<30; 
const int MOD = 1e9 + 7;
const int dy[] = {1, 0, -1, 0};
const int dx[] = {0, 1, 0, -1};
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int l, k;
    cin >> l >> k;
    ll dp[110] = {};
    dp[1] = 1;
    for(int i = 1; i <= l ; i++)
    {
        if(i == k) dp[i] += 1;
        if(i - 2 >= 0) dp[i] += dp[i - 2];
        if(i - k - 1 >= 0) dp[i] += dp[i - k - 1];
    }
    ll ans = 0;
    for(int i = 0; i <= l; i++) ans += dp[i];
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 3212
import sys

input = sys.stdin.readline


def main():
    N = int(input())

    if N % 2 == 1:
        print(0)
        exit()

    count = []
    i = 0
    while True:
        q = N // (10 * 5 ** i)
        if q == 0:
            break
        else:
            count.append((q, i + 1))
            i += 1

    ans = 0
    prev_c = 0
    for c, n_zero in count[::-1]:
        ans += n_zero * (c - prev_c)
        prev_c = c

    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 9140
#include<bits/stdc++.h>
using namespace std;
double D(double a,double b,double c,double d){
   double res=sqrt((a-b)*(a-b)+(c-d)*(c-d));
   return res;
}
int main(void){
   int N;
   cin>>N;
   vector<int> p(N),q(N);
   for(int i=0;i<N;i++){
      cin>>p[i];
   }
   for(int i=0;i<N;i++){
      cin>>q[i];
   }
   vector<int> num(N);
   for(int i=0;i<N;i++){
      num[i]=i+1;
   }
   int a,b;
   int temp1=0;
   int temp2=0;
   do{
      temp1++;
      temp2++;
      bool flag1=true;
      bool flag2=true;
      for(int i=0;i<N;i++){
         if(num[i]!=p[i]){
            flag1=false;
         }
         if(num[i]!=q[i]){
            flag2=false;
         }
      }
      if(flag1) a=temp1;
      if(flag2) b=temp2;
   }while(next_permutation(num.begin(),num.end()));
   cout<<abs(a-b)<<endl;
   return 0;
}


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

#define llong long long
#define inf 999999999
#define mp make_pair
#define pb push_back
#define fn fill_n
typedef pair<int, int> P;
typedef pair<P, int> PP;
typedef pair<PP, int> PPP;
typedef struct data{
	int now;
	int cost;
}data;
int nh[4] = {1, 0, -1, 0};
int nw[4] = {0, 1, 0, -1};





int main(){
	int a = 0, b = 0, c = 0, d, e;
	int A[100], B[100], C[100];
	string D, E;

	cin >> D;
	for(int i = 0; i < 3; i++){
		if(D[i] == 'a') a++;
		if(D[i] == 'b') b++;
		if(D[i] == 'c') c++;
	}
	if(a == c && c == b && b == 1){
		cout << "Yes" << endl;
		return 0;
	}
	cout << "No" << endl;

	return 0;	
}

Measured memory_bytes: 256
c=[0,2,5,5,4,5,6,3,7,6];N=gets.split[0].to_i;A=B=gets.split.map &:to_i;d=[0]+B.map{p};0.upto(N){|i|q=A.map{|x|c[x]<=i&&d[t=i-c[x]]?d[t]*10+x:p}.compact;q.any?&&d[i]=q.max};p d[N]

Measured memory_bytes: 36092
/* Selection Sort */

#include <iostream>
using namespace std;

inline void swap(int *a, int *b) {
  int c = *a;
  *a = *b;
  *b = c;
}

int main() {
  int array[100];
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> array[i];

  int cnt = 0;
  for(int i = 0; i < n - 1; i++) {
    int mini = i;
    for (int j = i; j < n; j++) if(array[j] < array[mini]) mini = j;
    if (mini != i) { cnt++; swap(&array[mini], &array[i]); }
  }

  for (int i = 0; i < n; i++) { cout << array[i]; if (i < n - 1) cout << " "; }
  cout << endl << cnt << endl; 

  return 0;
}


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

typedef long long int   ll;
typedef long double     ld;
typedef pair<ll, ll>    pll;

#define all(x)          x.begin(), x.end()
#define kill(x)         return cout << x << endl, 0;
#define X               first
#define Y               second
#define sep             ' '
#define endl            '\n'
#define fastio          ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define file_io         freopen("in.txt", "r", stdin); freopen("out.txt", "w", stdout);
#define ld_io           cout << setprecision(10) << fixed;

ll pw(ll a, ll b, ll mod) {
    if (!b)    return 1;
    if (b & 1) return a * pw(a * a % mod, b / 2, mod) % mod;
    return pw(a * a % mod, b / 2, mod) % mod;
}

const ll MAXN  = 1e5 + 10;
const ll INF   = 8e18;
const ll MOD   = 1e9 + 7; // 998244353;
const ll LOG   = 32;      // log2(1e9)
const ll BLOCK = 320;     // sqrt(1e5)

ll n;
string s;

int main() {
    fastio
    cin >> n >> s;
    for (char c : s) {
        ll x = (c - 'A');
        x += n;
        x %= 26;
        cout << char(x + 'A');
    }
    return 0;
}




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

using namespace std;

#define IOS ios_base::sync_with_stdio(false);   cin.tie(NULL); cout.tie(NULL);

#define endl "\n";

#define loop(i,s,n)  for(ll i=s;i<n;i++)
#define test  ll t; cin>>t; while(t--)
#define p push_back
typedef long long ll;
int main()
{IOS
ll n,i,j,k=0,l,r,d;
cin>>n;
ll a[n+1]={0};
for(i=1;i<n+1;i++)
{cin>>a[i];}
for(i=1;i<n+1;i++)
{if(i%2!=0&&a[i]%2!=0)
	{k++;}
}cout<<k;


return 0;}




Measured memory_bytes: 3636
#include <iostream>
#include <fstream>
#include <typeinfo>
#include <vector>
#include <stack>
#include <cmath>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <iomanip>
#include <cctype>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<55;
const double pi=acos(-1);
const double eps=1e-8;
const ll mod=1e9+7;
const vi emp;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,-0};
const int DX[8]={-1,-1,-1,0,0,1,1,1},DY[8]={1,0,-1,1,-1,1,0,-1};

string s;

int main(){
	cin>>s;
	s[5]=' ';
	s[13]=' ';
	cout<<s<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<iomanip>
using namespace std;
#define pii pair<int,int>
#define vi vector<int>
#define fi first
#define sec second
#define pb push_back
#define ll long long int
#define mp make_pair
#define endl '\n'
#define rep(i,a,b)      for(int i=a;i<=b;i++)
#define revp(i,a,b)     for(int i=b;i>=a;i--)
void fast(){ ios::sync_with_stdio(false); cin.tie(NULL);}
void file(){ freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);}

double l,a,b,c;
int main()
{
    fast();
    
    
    cin>>l; 
    a = l/3;l-=a;b=l/2;c=l-b;
    cout<<setprecision(20)<<a*b*c;
}


Measured memory_bytes: 3760
#include <stdio.h>
#include <string.h>
int main(void){
    char s[200000][10];
    int n, i, a, w, t, r;
    
    scanf("%d",&n);
    for(i=0;i<n;i++) scanf("%s",s[i]);
    
    a=w=t=r=0;
    for(i=0;i<n;i++){
        if(strcmp(s[i],"AC")==0){
            a++;
        }
        else if(strcmp(s[i],"WA")==0){
            w++;
        }
        else if(strcmp(s[i],"TLE")==0){
            t++;
        }
        else if(strcmp(s[i],"RE")==0){
            r++;
        }
    }
    printf("AC x %d\n",a);
    printf("WA x %d\n",w);
    printf("TLE x %d\n",t);
    printf("RE x %d\n",r);
    return 0;
}

Measured memory_bytes: 2716
#include<iostream>
#include<iomanip>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
 
using namespace std;
 
#define P(p) cout<<(p)<<endl
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define vsort(v) sort(v.begin(), v.end());
#define rvsort(v) sort(v.begin(), v.end(),greater<int>());
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return
#define C(i) cin>>i
#define C2(i,j) cin>>i>>j
#define C3(i,j,k) cin>>i>>j>>k
#define C4(i,j,k,m) cin>>i>>j>>k>>m
////////////////////////////////////////////////////////////


int main(){
  int N;
  C(N);

  if(N >= 64)
    P("64");
  else if(N >= 32)
    P("32");
  else if(N >= 16)
    P("16");
  else if(N >= 8)
    P("8");
  else if(N >= 4)
    P("4");
  else if(N >= 2)
    P("2");
  else
    P("1");


  ret 0;
}

Measured memory_bytes: 384
X=int(input())
flag=0
for i in range(10**9):
    A=i**5
    B=A-X
    if B<0:
        for j in range(10**9):
            b=j**5
            if B+b==0:
                ans1=i
                ans2=-j
                flag=1
                break
            elif B+b>0:
                break
    else:
        for j in range(10**9):
            b=j**5
            if B-b==0:
                ans1=i
                ans2=j
                flag=1
                break
            elif B-b<0:
                break
    if flag==1:
        break
print(ans1,ans2)

Measured memory_bytes: 9208
#include <bits/stdc++.h>
using namespace std;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long

const int N=1e5+5;

int32_t main()
{
	IOS;
	int n, k;
	cin>>n>>k;
	int mx=(n+1)/2;
	if(k>mx)
		cout<<"NO";
	else
		cout<<"YES";
	return 0;
}


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

#define INF_LL (int64)1e18
#define INF (int32)1e9
#define REP(i, n) for(int i = 0;i < (n);i++)
#define FOR(i, a, b) for(int i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-10;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

int main(void){
	int32 N;
	string s;
	cin >> N >> s;
	vector<int32> cnt(N+1, 0);
	REP(i, s.size()) cnt[i+1] = cnt[i]+(s[i] == 'W');
	int64 res = INF;
	int64 ce = 0;
	for(int32 i = N-1;i >= 0;i--){
		res = min(res, ce+cnt[i]);
		ce += s[i] == 'E';
	}
	cout << res << endl;
}

Measured memory_bytes: 3076
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import itertools as ite
import math
import random
import sys
import codecs
from collections import defaultdict

INF = 10 ** 18
MOD = 10 ** 9 + 7

sys.setrecursionlimit(1000000)

N = input()
A = [input() for i in range(N)]
maxA = max(A)
if A.count(maxA) > 1:
    for i in range(N):
        print maxA
else:
    for i in range(N):
        if A[i] == maxA:
            print max(A[:i] + A[i + 1:])
        else:
            print maxA


Measured memory_bytes: 20300
#include <bits/stdc++.h>
using namespace std;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define all(v) v.begin(),v.end()
#define SZ(v) ((int)v.size())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)
#define bit(n) (1LL<<(n))
#define bit_exist(x, n) ((x >> n) & 1)
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) cout << #v << "=" << endl; REP(i_debug, v.size()){ cout << v[i_debug] << ","; } cout << endl;
#define mdebug(m) cout << #m << "=" << endl; REP(i_debug, m.size()){ REP(j_debug, m[i_debug].size()){ cout << m[i_debug][j_debug] << ","; } cout << endl;}
#define pb push_back
#define f first
#define s second
#define int long long
#define INF 1000000000000000000
template<typename T> istream &operator>>(istream &is, vector<T> &v){ for (auto &x : v) is >> x; return is; }
template<typename T> ostream &operator<<(ostream &os, vector<T> &v){ for(int i = 0; i < v.size(); i++) { cout << v[i]; if(i != v.size() - 1) cout << endl; }; return os; }
template<typename T> void Out(T x) { cout << x << endl; }
template<typename T1, typename T2> void Ans(bool f, T1 y, T2 n) { if(f) Out(y); else Out(n); }

using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using PiP = pair<int, Pii>;
using PPi = pair<Pii, int>;
using bools = vector<bool>;
using pairs = vector<Pii>;

//int dx[4] = {1,0,-1,0};
//int dy[4] = {0,1,0,-1};
//char d[4] = {'D','R','U','L'};

const int mod = 1000000007;
//const int mod = 998244353;
#define Add(x, y) x = (x + (y)) % mod
#define Mult(x, y) x = (x * (y)) % mod

signed main(){
    int X; cin>>X;
    vector<bool> price(100001,false);
    price[100]=true;
    price[101]=true;
    price[102]=true;
    price[103]=true;
    price[104]=true;
    price[105]=true;
    FOR(i,106,100001){
        if(price[i-100]==true||price[i-101]==true||price[i-102]==true||price[i-103]==true||price[i-104]==true||price[i-105]==true) price[i]=true;
    }
    if(price[X]) Out("1");
    else Out("0");
}





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

using namespace std;

typedef long long int li;
typedef long double ld;
typedef vector<li> vi;
typedef pair<li,li> pi;
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define B begin()
#define E end()
#define f(i,l,r) for(li i=l;i<=r;++i)
#define fr(i,l,r) for(li i=l;i>=r;--i)
#define u_map unordered_map
#define endl "\n"

li fastpow(li base,li exp,li M) 
{
    li res=1;
    while(exp>0) {
        if(exp&1)
            res=(res*base)%M;

        base=(base*base)%M;
        exp>>=1;
    }
    return res;
}

vi par,sz,vis,dis;
vector<vi> graph;
vector<vector<pair<li,li>>> wgraph;

void init(li n)
{
    par.resize(n);
    sz.resize(n);
    wgraph.resize(n);
    dis.resize(n);
    vis.resize(n);
    graph.resize(n);

    f(i,0,n-1)
    {
        par[i]=i;
        sz[i]=1;
        dis[i]=1e18;
    }
}

li root(li a)
{
    while(a!=par[a])
    {
        par[a]=par[par[a]];
        a=par[a];
    }

    return a;
}

void unio(li a,li b)
{
    li r_a=root(a);
    li r_b=root(b);

    if(par[r_a]!=r_b)
    { 
        if(sz[r_a]<sz[r_b])
        {
            par[r_a]=par[r_b];
            sz[r_b]+=sz[r_a];
            sz[r_a]=0;
        }
        else
        {
            par[r_b]=par[r_a];
            sz[r_a]+=sz[r_b];
            sz[r_b]=0;
        }
    }
}

int main()
{    
    

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    li N=3;

    vector<vi> A(N,vi(N,0));

    f(i,0,N-1)
    {
        f(j,0,N-1)
        {
            cin>>A[i][j];
        }
    }

    li n;

    cin>>n;

    li b[n];

    map<li,li> m;

    for(li i=0;i<n;i++)
    {
        cin>>b[i];
        m[b[i]]++;
    }

    f(i,0,N-1)
    {
        li cnt=0;

        f(j,0,N-1)
        {
            if(m[A[i][j]])
                cnt++;
        }

        if(cnt==3)
        {
            cout<<"Yes";
            return 0;
        }
    }

    f(i,0,N-1)
    {
        li cnt=0;

        f(j,0,N-1)
        {
            if(m[A[j][i]])
                cnt++;
        }

        if(cnt==3)
        {
            cout<<"Yes";
            return 0;
        }
    }

    li cnt1=0,cnt2=0;

    f(i,0,N-1)
    {
        f(j,0,N-1)
        {
            if(i==j && m[A[i][j]])
                cnt1++;

            if(i+j==2 && m[A[i][j]])
            {   
                cnt2++;
            }
        }
    }

    if(cnt1==3 ||cnt2==3)
    {
        cout<<"Yes";
        return 0;
    }

    cout<<"No";

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n; int arr[n];
    for(int i=0; i<n; i++)
        cin>>arr[i];
    int dp[n] = {0};
    dp[0] = 0; dp[1] = abs(arr[1]-arr[0]);
    for(int i=2; i<n; i++){
        dp[i] = min(abs(arr[i]-arr[i-1])+dp[i-1], abs(arr[i]-arr[i-2])+dp[i-2]);
    }
    cout<<dp[n-1];
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define debug(x) cerr << "[(" << __LINE__ << ") " << (#x) << "]: " << x << endl;

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

    int x;
    for (int i=0; i<5; i++) {
        cin >> x;
        if (!x) {
            cout << i+1 << "\n";
            return 0;
        }
    }
}


Measured memory_bytes: 3612
x = int( input() )

if 400 <= x <= 599:
  print("8")
elif 600 <= x <= 799:
  print("7")
elif 800 <= x <= 999:
  print("6")
elif 1000 <= x <= 1199:
  print("5")
elif 1200 <= x <= 1399:
  print("4")
elif 1400 <= x <= 1599:
  print("3")
elif 1600 <= x <= 1799:
  print("2")
elif 1800 <= x <= 1999:
  print("1")

Measured memory_bytes: 9184
#include <bits/stdc++.h>
using namespace std;
#
#define f1(n) for(int i=0;i<n;i++)
int min1(int *arr,int n,int k)
{
            if(n<=1)return 0;
            if(n==2) return abs(arr[n-1]-arr[n-2]);
            
int arr1[n];
arr1[0]=0;
arr1[1]=abs(arr[1]-arr[0]);
for(int i=2;i<n;i++)
{ int mm1=INT_MAX;
for(int j=i-1;j>=0 && j>=(i-k);j--)
 {
  int a1=abs(arr[i]-arr[j]);
  
  if((a1+arr1[j])<mm1)
  {
              arr1[i]=a1+arr1[j];
              mm1=arr1[i];
  }
 }

}
return arr1[n-1];
}
int main()
{
            ios_base::sync_with_stdio(false);
            cin.tie(0);
            cout.tie(0);
 int n,k;
 cin>>n>>k;
 int arr[n];
 f1(n)
 {
             cin>>arr[i];
 
}cout<<min1(arr,n,k);
}


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

namespace ABC141A
{
    class Program
    {
        static void Main(string[] args)
        {
            string str = Console.ReadLine();

            if (str == "Sunny")
                Console.WriteLine("Cloudy");

            else if (str == "Cloudy")
                Console.WriteLine("Rainy");

            else if (str == "Rainy")
                Console.WriteLine("Sunny");

            Console.ReadKey();
        }
    }
}

Measured memory_bytes: 11092
#include <iostream>
using namespace std;
int main(){
  int N, M, K;
  cin >> N >> M >> K;
  for(int i = 0; i <= M; ++i){
    for(int j = 0; j <= N; ++j){
      if(i*N + j*M - 2*i*j == K){
	cout << "Yes" << endl;
	return 0;
      }
    }
  }
  cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 256