akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep3(i,a,b) for(ll i=a;i>=b;i--)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define veci vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define vec2(a,b) vector<vec>(a,vec(b))
#define vec2ll(a,b) vector<vec>(a,vecll(b))
#define vec3(a,b,c) vector<vector<vec>>(a,vec2(b,c))
#define vec3ll(a,b,c) vector<vector<vecll>>(a,vec2ll(b,c))
#define fi first
#define se second
#define all(c) begin(c),end(c)
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,x) distance(c.begin(),lower_bound(all(c),x))
#define ub(c,x) distance(c.begin(),upper_bound(all(c),x))


using namespace std;
int in() {int x;cin>>x;return x;}
ll lin() {ll x;cin>>x;return x;}
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<class T> inline void print(pair<T,T> p){cout<<"("<<p.first<<","<<p.second<<") ";}
//template<class T> inline void print(vector<pair<T,T>> v){for(auto e:v)print(e); cout<<endl;}
//template<class T> inline void print(T v){for(auto e:v)cout<<e<<" ";cout<<endl;}
template<typename T>
istream& operator >> (istream& is, vector<T>& vec){
    for(T& x:vec) is >> x;
    return is;
}
const ll INF=1e9+7;

int main()
{
    ll n,m;
    cin >> n >> m ;
    if(n<=1 && m<=1){
        cout << 0 << endl;
        return 0;
    }
    if(n<=1){
        cout << m*(m-1)/2 << endl;
        return 0;
    }
    if(m<=1){
        cout << n*(n-1)/2 << endl;
        return 0;
    }
    cout << n*(n-1)/2+m*(m-1)/2 << endl;
    return 0;
} 


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

typedef long long ll;
#define pii pair<int , int>
#define _FastIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define MAXX 1005

int a[15];

int main()
{
    _FastIO;
    int ans = 0;
    int m = 10;
    for(int i = 0; i < 5; i++){
        cin >> a[i];
        ans += a[i];
        if(a[i] % 10){
            m = min(m , (a[i] % 10));
            ans += (10 - (a[i] % 10));
        }
        
    }
    if(m != 10){
      ans -= 10;
        ans += m;  
    }
    
    cout << ans << endl; 
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include <string>
#include <algorithm>
#include <functional>

using namespace std;

int main()
{
    int a;
    int mn=10000,mx=0;
    for(int i=0;i<3;i++)
    {
        cin>>a;
        if(a<mn)
            mn=a;
        if(a>mx)
            mx=a;
    }
    cout<<(mx-mn)<<endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

class Main{
  static Scanner sc = new Scanner(System.in);
  public static void main(String args[]){
    int a[]=new int[3];
    a[0]=sc.nextInt();
    a[1]=sc.nextInt();
    a[2]=sc.nextInt();
    Arrays.sort(a);
    System.out.println((a[0]+a[1]));
  }
}

Measured memory_bytes: 23764
import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.PriorityQueue;
import java.util.StringTokenizer;

public class Main {
	
	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		
		final int N = sc.nextInt();
		final long a = sc.nextLong();
		final long d = sc.nextLong();
		
		final int M = sc.nextInt();
		Map<Integer, Integer> map = new HashMap<Integer, Integer>();
		for(int i = 0; i < M; i++){
			final int x = sc.nextInt();
			final int y = sc.nextInt() - 1;
			final int z = sc.nextInt() - 1;
			
			if(!map.containsKey(y)){
				map.put(y, y);
			}
			if(!map.containsKey(z)){
				map.put(z, z);
			}
			
			final int y_value = map.get(y);
			final int z_value = map.get(z);
			
			map.put(y, z_value);
			if(x == 0){
				map.put(z, y_value);
			}
		}
		
		final int K = sc.nextInt() - 1;
		final int index = map.containsKey(K) ? map.get(K) : K;
		//System.out.println(map);
		
		System.out.println(a + index * d);
		
	}

	public static class Scanner implements Closeable {
		private BufferedReader br;
		private StringTokenizer tok;

		public Scanner(InputStream is) throws IOException {
			br = new BufferedReader(new InputStreamReader(is));
		}

		private void getLine() throws IOException {
			while (!hasNext()) {
				tok = new StringTokenizer(br.readLine());
			}
		}

		private boolean hasNext() {
			return tok != null && tok.hasMoreTokens();
		}

		public String next() throws IOException {
			getLine();
			return tok.nextToken();
		}

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

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

		public void close() throws IOException {
			br.close();
		}
	}
}

Measured memory_bytes: 24468
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> VI;
typedef pair <int,int> ii;
typedef long long LL;
#define pb push_back
const int INF = 2147483647;
const int N = 500005;

int tab[32] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
int a;

int main() {
scanf("%d", &a);
printf("%d\n", tab[a - 1]);
return 0;
}





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

#define ALL(v) v.begin(), v.end()
#define V vector
#define P pair
#define ld long double
#define ll long long
#define mod 1000000007
#define IINF INT_MAX
#define INF 1LL << 30


int main() {
    int h, w; cin >> h >> w;
    V<string> b(h);
    for(int i = 0; i < h; i++) cin >> b[i];

    V<V<int> > ans(h, V<int>(w, 0));
    for(int i = 0; i < h; i++){
        V<int> seen(w + 1);
        for(int j = 0; j < w; j++){
            if(b[i][j] == '#') continue;
            if(seen[j]) continue;
            int len = 0;
            while(j + len < w){
                if(b[i][j + len] == '#') break;
                len++;
            }
            for(int k = 0; k < len; k++){
                ans[i][j + k] += len;
                seen[j + k] = 1;
            }
        }
    }

    for(int j = 0; j < w; j++){
        V<int> seen(h + 1);
        for(int i = 0; i < h; i++){
            if(b[i][j] == '#') continue;
            if(seen[i]) continue;
            int len = 0;
            while(i + len < h){
                if(b[i + len][j] == '#') break;
                len++;
            }
            for(int k = 0; k < len; k++){
                ans[i + k][j] += len;
                seen[i + k] = 1;
            }
        }
    }

    int res = 0;
    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++){
            res = max(res, ans[i][j] - 1);
        }
    }
    cout << res << endl;

    return 0;
}


Measured memory_bytes: 26464
#include<cstdio>
#include<cmath>
#include<climits>
#include<algorithm>
#include<sstream>
#include<iostream>
#include<iomanip>
#include<utility>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<unordered_set>
#include<unordered_map>
#include<set>
#include<map>
#include<list>

using namespace std;
using ll = long long;

#define in(s) cin >> s
#define out(s) cout << s << endl
#define rep(i,n) for(int i=0; i<n; i++)
#define rept(i,a,b) for(int i=a; i<b; i++)
#define pcnt __builtin_popcount
#define pcntll(x) __builtin_popcountll(x)
#define DMAX DBL_MAX;
#define IMIN INT_MIN;
#define IMAX INT_MAX;

const long long MOD = 1e9+7;
const long long MAX = 3e5+1;

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);

    int N, M;
    in(N); in(M);
    int a, b;
    unordered_map<int, vector<int>> adj;

    rep(i, M) {
        cin >> a >> b;
        a--;
        b--;
        if (adj.find(a) != adj.end()) {
            adj[a].push_back(b);
        }
        else adj[a] = vector<int>(1, b);
        if (adj.find(b) != adj.end()) {
            adj[b].push_back(a);
        }
        else adj[b] = vector<int>(1, a);
    }

    queue<int> Q;
    Q.push(0);

    vector<int> ans(N, MOD);
    vector<bool> visited(N, false);
    visited[0] = true;
    while (!Q.empty()) {
        int curr = Q.front();
        Q.pop();
        for (int next: adj[curr]) {
            if (!visited[next]) {
                ans[next] = curr;
                Q.push(next);
            }
            visited[next] = true;
        }
    }
    rept(i, 1, N) {
        if (ans[i] == MOD) {
            out("No");
            exit(0);
        }
    }
    out("Yes");
    rept(i, 1, N) {
        out(ans[i]+1);
    }


    return 0;
}


Measured memory_bytes: 13664
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <map>
#define debug(...) fprintf(stderr,__VA_ARGS__)
#define inver(a,mod) power(a,mod-2,mod)
#define idx(a,b) ((ll)(a)*mod[1]+(b))
using namespace std;
template<class T> void rd(T &x) {
	x=0; int f=1,ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10-'0'+ch;ch=getchar();}
	x*=f;
}
typedef long long ll;
const int mod[2]={998244353,1004535809};
const int maxn=250000+50;
int bs[2],rb[2];
int n; char s[maxn];
int c[2];
map<ll,int> cnt;
struct func {
	int k,b;
	func(int k=1,int b=0):k(k),b(b){}
	inline int f(int x,int mod) {
		return ((ll)k*x+b)%mod;
	}
} a[maxn][2];
inline func mer(func a,func b,int mod) {
	return func((ll)a.k*b.k%mod,((ll)a.b*b.k+b.b)%mod);
}
inline int add(int x,int mod) {return x>=mod?x-mod:x;}
inline int sub(int x,int mod) {return x<0?x+mod:x;}
ll power(ll x,ll y,int mod) {
	ll re=1;
	while(y) {
		if(y&1) re=re*x%mod;
		x=x*x%mod;
		y>>=1;
	}
	return re;
}
void init() {
	srand((unsigned long long)(new char));
	bs[0]=rand(),rb[0]=inver(bs[0],mod[0]);
	bs[1]=rand(),rb[1]=inver(bs[1],mod[1]);
}
int main() {
	init();
	rd(n);
	scanf("%s",s+1);
	for(int i=n;i>=1;--i) for(int k=0;k<2;++k) {
		func f; switch(s[i]) {
			case '+': f=func(1,mod[k]-1),c[k]=add(c[k]+1,mod[k]); break;
			case '-': f=func(1,1),c[k]=sub(c[k]-1,mod[k]); break;
			case '>': f=func(rb[k],0),c[k]=(ll)c[k]*bs[k]%mod[k]; break;
			case '<': f=func(bs[k],0),c[k]=(ll)c[k]*rb[k]%mod[k]; break;
		}
		a[i][k]=mer(f,a[i+1][k],mod[k]);
	}
	ll an=0;
	++cnt[0];
	for(int i=n;i>=1;--i) {
		an+=cnt[idx(a[i][0].f(c[0],mod[0]),a[i][1].f(c[1],mod[1]))];
		++cnt[idx(a[i][0].f(0,mod[0]),a[i][1].f(0,mod[1]))];
	}
	printf("%lld\n",an);
	return 0;
}

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

using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
	REP(i, v.size()) { if (i)os << " "; os << v[i]; }return os;
}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
	REP(i, v.size()) { if (i)os << endl; os << v[i]; }return os;
}

int main() {
	ll n;
	ll ans = 0;

	cin >> n;

	REP(i, n) {
		ll l, r;
		cin >> l >> r;
		ans += r - l + 1;
	}

	cout << ans << endl;
}

Measured memory_bytes: 256
H, N = map(int, input().split())
AB = [[int(x) for x in input().split()] for _ in range(N)]
dp = [float('inf')] * (H + 1)
dp[0] = 0
for h in range(H + 1):
    for a, b in AB:
        h_new = min(h + a, H)
        dp[h_new] = min(dp[h] + b, dp[h_new])
print(dp[-1])

Measured memory_bytes: 43484
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;

#define N               100005
#define ff              first
#define ss              second
#define ll              long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<ll,ll>
#define vi              vector<ll>
#define mii             map<ll,ll>
#define pq_max          priority_queue<ll>
#define pq_min          priority_queue<ll,vi,greater<ll> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            ll x; cin>>x; while(x--)
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());

typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> pbds;


void fio(){
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
}

vi gr[N];
ll dp[N];

ll f(ll n){

    if(dp[n] != -1) return dp[n];

    ll mx = 0, leaf = 1;
    for(auto &j : gr[n]) leaf = 0, mx = max(mx, f(j));

    return dp[n] = leaf ? 0 : 1 + mx;
}

int main(){
    fio();

    memset(dp, -1, sizeof dp);

    ll n,m;
    cin>>n>>m;

    for(ll z=0;z<m;z++){
        ll u,v;
        cin>>u>>v;

        gr[u].pb(v);
    }

    ll res = 0;
    for(ll z=1;z<=n;z++) res = max(res, f(z));

    cout<<res;

    return 0;
}

Measured memory_bytes: 11876
#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = double;
const ld eps = 1e-9;

//// < "d:\d_download\visual studio 2015\projects\programing_contest_c++\debug\a.txt" > "d:\d_download\visual studio 2015\projects\programing_contest_c++\debug\b.txt"


int main() {
	cout << setprecision(7) << fixed;
	vector<vector<ld>>dp(100005, vector<ld>(50));
	dp[0][0] = 1;
	for (int n = 0; n < 100004; ++n) {
		for (int i = 0; i < 48; ++i) {
			dp[n + 1][i + 1] += dp[n][i] / pow(2, i);
			dp[n+1][0] += dp[n][i]* (1 - 1/pow(2, i));
		}
	}
	vector<ld>anss(100001);
	for (int i = 0; i < 100001; ++i) {
		anss[i + 1] = anss[i];
		for (int j = 1; j < 50; ++j) {
			anss[i + 1] += dp[i+1][j];
		}
	}
	while (1) {
		int N; cin >> N;
		if (!N)break;
		cout << anss[N] << endl;
	}
	
	return 0;
}

Measured memory_bytes: 46640
from collections import Counter

s = input()
possible = 0
for i in range(len(s) - 2):
    if len(Counter(s[i:i+3])) < 3:
        print(i+1, i+3)
        possible = 1
        break
if len(s) == 2:
    if s[0] == s[1]:
        print(1, 2)
        possible = 1
if not possible:
    print(-1, -1)


Measured memory_bytes: 42856
H, W = gets.chomp.split.map(&:to_i)
a = H.times.map{gets.chomp}

puts (0..H+1).inject(a){|_, i|
    case i
    when 0, H+1 then
        a.insert(i, "#" * (W + 2))
    else
        a[i] = "#" + a[i] + "#"
    end
}

Measured memory_bytes: 1788
<?php
while($lines = fgets(STDIN)) {
    $tmp[] = trim($lines);
}

$count = 0;
$str = '';
foreach($tmp as $a){
    $bs = str_split($a);
    foreach($bs as $b)
    {
        if($b) $count++;
    }
}

echo $count. "\n";

Measured memory_bytes: 3576
fun main(args: Array<String>){
    val N = readLine()!!.toInt()
    val A = readLine()!!.split(" ").map(String::toInt)

    var ans = A[0]
    for(i in 1 until N){
        ans = gcd(ans, A[i])
    }
    println(ans)
}

fun gcd(a: Int, b: Int): Int {
    if (a < b) return gcd(b, a)
    if (b == 0) return a
    return gcd(b, a % b)
}

Measured memory_bytes: 51808
#include<bits/stdc++.h>
using namespace std;
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int h, w;
  cin >> h >> w;
  for(int i = 0; i < h; i++){
    string s;
    cin >> s;
    cout << s << endl << s << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <string>

int main() {
    std::string s;
    std::cin >> s;
    for (int i = 0; i < s.length(); i++) {
        for (int j = i + 1; j < s.length(); j++) {
            if (s[i] == s[j]) {
                puts("no");
                return 0;
            }
        }
    }
    puts("yes");
}

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


int main(){
    int n;
    cin>>n;
    vector<int> dp (n+1,0);
    dp[0]=1;
    dp[1]=1;
    for(int i=2;i<n+1;i++){
        dp[i] = dp[i-2] + dp[i-1];
    }
    cout << dp[n] << endl;
}


Measured memory_bytes: 3092
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
using namespace std;

int h, w;
vector<string> flag, pattern;

bool check(int y, int x)
{
    if(y < 0 || y + 1 >= h || x < 0 || x + 1 >= w)
        return false;

    for(int i=0; i<4; ++i){
        if(flag[y+i/2][x+i%2] != pattern[i/2][i%2])
            return false;
    }
    return true;
}

int main()
{
    cin >> h >> w;
    flag.resize(h);
    pattern.resize(2);
    for(int y=0; y<h; ++y)
        cin >> flag[y];
    for(int i=0; i<2; ++i)
        cin >> pattern[i];

    int cnt = 0;
    for(int y=0; y<h; ++y){
        for(int x=0; x<w; ++x){
            if(check(y, x))
                ++ cnt;
        }
    }

    const string s = "JOI";
    int ret = cnt;
    for(int y=0; y<h; ++y){
        for(int x=0; x<w; ++x){
            int sub = 0;
            for(int i=0; i<4; ++i){
                if(check(y - i/2, x - i%2))
                    ++ sub;
            }

            char c = flag[y][x];
            for(int i=0; i<3; ++i){
                flag[y][x] = s[i];
                int add = 0;
                for(int j=0; j<4; ++j){
                    if(check(y - j/2, x - j%2))
                        ++ add;
                }
                ret = max(ret, cnt - sub + add);
            }
            flag[y][x] = c;
        }
    }
    cout << ret << endl;

    return 0;
}

Measured memory_bytes: 2064
# -*- coding utf-8 -*-

MOD = 10 ** 9 + 7

s = input()

if s == 'SUN':
    ans = 7
elif s == 'MON':
    ans = 6
elif s == 'TUE':
    ans = 5
elif s == 'WED':
    ans = 4
elif s == 'THU':
    ans = 3
elif s == 'FRI':
    ans = 2
elif s == 'SAT':
    ans = 1

print(ans)


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
int main(){
  string a;
  cin >> a;
  sort(a.begin(), a.end());
  if (a[0] != a[3] && a[0] == a[1] && a[2] == a[3])  {
    cout << "Yes";
  } else {
    cout << "No";
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define endl "\n"
#define speed() ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define sz(x) (int)(x).size()
#define _USE_MATH_DEFINES
using namespace std;
typedef long long int lli;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;


int maxTime(int n) {
    return ((n + 9) / 10) * 10;
}

int remTime(int n) {
    return maxTime(n) - n;
}

int main() {
    speed();
    int d[5];
    rep(i, 0, 5) cin >> d[i];
    int sum1 = maxTime(d[0]) + maxTime(d[1]) + maxTime(d[2]) + maxTime(d[3]) + maxTime(d[4]);
    int sum2 = max({remTime(d[0]), remTime(d[1]), remTime(d[2]), remTime(d[3]), remTime(d[4])});
    cout << sum1 - sum2 << endl;
    return 0;
}

Measured memory_bytes: 256
card = list()
suit = ['S', 'H', 'C', 'D']
n = int(input())
for i in range(n):
    s, c = input().split()
    c = int(c)
    if s == "S":
        card.append(0+c)
    elif s == "H":
        card.append(13+c)
    elif s == "C":
        card.append(26+c)
    else:
        card.append(39+c)
for i in range(1,53):
    if not (i in card):
        print(suit[(i-1)//13],(i-1)%13+1)


Measured memory_bytes: 5600
def sieve(n)
  ps = Array.new(n + 1, true)
  ps[0] = false
  ps[1] = false

  2.upto(n-1) do |i|
    next unless ps[i]

    k = 2
    while k * i <= n
      ps[k * i] = false
      k += 1
    end
  end

  ps
end

def solve(n, ps)
  a = 0
  2.upto(n) {|i| a += 1 if ps[i]}
  a
end

ns = gets(nil).chomp.split("\n").map(&:to_i)
ps = sieve(ns.max)
ns.each {|n| puts solve(n, ps)}

Measured memory_bytes: 13916
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int sum = 0;
		int N = scan.nextInt();
		int[] s = new int[N];
		for(int i = 0; i < N; i++) {
			s[i] = scan.nextInt();
			sum += s[i];
		}
		Arrays.sort(s);
		if(sum % 10 == 0) {
			for(int i = 0; i < N; i++) {
				if(s[i] % 10 != 0) {
					sum -= s[i];
					break;
				}
				if(i == N - 1) {
					sum = 0;
					break;
				}
			}
		}
		System.out.println(sum);
		scan.close();

	}

}


Measured memory_bytes: 23252
length = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

K = int(input())


print(length[K-1])


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
int main() {
  int a,b,c;
  cin >> a >> b >> c;
  int ans = 0;
  
  if(a == 5 && b == 5 && c == 7){
      cout << "YES" << endl;
  }
  else if(a == 5 && b == 7 && c == 5){
      cout << "YES" << endl;
  }
  else if(a == 7 && b == 5 && c == 5){
      cout << "YES" << endl;
  }
  else{
      cout << "NO" << endl;
  }
}

Measured memory_bytes: 3548
/******************************************************************************

Welcome to GDB Online.
GDB online is an online compiler and debugger tool for C, C++, Python, PHP, Ruby, 
C#, VB, Perl, Swift, Prolog, Javascript, Pascal, HTML, CSS, JS
Code, Compile, Run and Debug online from anywhere in world.

*******************************************************************************/
#include <bits/stdc++.h>
using namespace std;
bool csort(const pair<int,int>&a,const pair<int,int>& b)
{
    return a.second>b.second;
}

int main()
{
    cin.tie(0);
    
    
        int n;
        cin>>n;
        vector<int> v(n);
        for(int i=0;i<n;i++)
        cin>>v[i];
        
        map<int,int> m;
        map<int,int> m1;
        for(int i=0;i<n;i++)
        {
            //if(i>0 && v[i]==v[i-1])
            //same=v[i];
            if(i%2==0)
            m[v[i]]++;
            else
            m1[v[i]]++;
        }
        vector<pair<int,int>> v1,v2;
        for(auto i:m)
        {
            v1.push_back({i.first,i.second});
        }
        sort(v1.begin(),v1.end(),csort);
        //reverse(v1.begin(),v1.end());
        for(auto i:m1)
        {
            v2.push_back({i.first,i.second});
        }
        sort(v2.begin(),v2.end(),csort);
        //reverse(v2.begin(),v2.end());
        int s=0;
        if(v2[0].first==v1[0].first)
        {
            s=min(n-v1[0].second-v2[1].second,n-v1[1].second-v2[0].second);
        
        }
        else
        {
            s=n-v1[0].second-v2[0].second;
        }
        cout<<s<<"\n";
    

    return 0;
}


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

#define _GLIBCXX_DEBUG
#define _LIBCPP_DEBUG 0

int main() {
  string s;

  cin >> s;
  bool a = false;
  bool b = false;
  bool c = false;
  for (long long i = 0; i < 3; i++) {
    if (s.at(i) == 'a') {
      a = true;
    }
    if (s.at(i) == 'b') {
      b = true;
    }
    if (s.at(i) == 'c') {
      c = true;
    }
  }

  if (a && b && c) {
    cout << "Yes" << endl;

  } else {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 3624
#include <stdio.h>
#include <stdlib.h>

int main()
{
   int a,b,c,k,i,max,j;
   scanf("%d %d %d",&a,&b,&c);
   scanf("%d",&k);
   max=a>b?a:b;
   max=max>c?max:c;
   j=max;
   for(i=0;i<k;i++)
   {
       max=max*2;
   }
   max=max+(a+b+c)-j;
   printf("%d\n",max);
    return 0;
}


Measured memory_bytes: 128
import math
A,B = map(int,input().split())
ans = 0
for i in range(1001):
  pay = i * 0.08
  pby = i * 0.1
  if math.floor(pay) == A and math.floor(pby) == B:
    ans = i
    break
  else:
    ans = -1
print(ans)

Measured memory_bytes: 3064
#include <iostream>
#include <map>
#include <algorithm>
#include <string>
#include <vector> 
#include <numeric>
#include <cmath>
#include <queue>
#include <iomanip>
#include <functional>

#define CHMAX(a,b) a = std::max(a,b)
#define CHMIN(a,b) a = std::min(a,b)
#define CHABS(a) a = std::abs(a) 
#define COUT(a) std::cout << a << std::endl
#define CERR(a) std::cerr << a << std::endl
#define FOR(n) for(lli i = 0; i < n; i++)

using namespace std;
using lli = long long int;
using pll = pair<lli, lli>;
using tlll = tuple<lli, lli, lli>;
using vll = vector<lli>;

lli mod197 = 1000000007LL;
lli INF = 10000000000000;

// ax + by = gcd(a,b) 最大公約数
template< typename T >
T extgcd(T a, T b, T& x, T& y) {
	T d = a;
	if (b != 0) {
		d = extgcd(b, a % b, y, x);
		y -= (a / b) * x;
	}
	else {
		x = 1;
		y = 0;
	}
	return d;
}


int main(void) {

	int a, b, c;
	cin >> a >> b >> c;

	COUT((a == b && b == c ? "Yes" : "No"));

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll                      long long
#define pb                      push_back
#define rep(i,a,b,c)            for(ll i=(a);i<=(b);i+=(c))
#define repb(i,a,b,c)           for(ll i=(a);i>=(b);i-=(c))
#define MOD                     1000000007
#define inf                     3e18
#define ld                      long double
#define mp                      make_pair
#define vpll                    vector<pair<ll,ll> >
#define vll                     vector<ll>
#define vld                     vector<ld>
#define vvll                    vector<vector<ll>>
#define vvld                    vector<vector<ld>>
#define pll                     pair<ll,ll>
#define vvpll                   vector<vector<pair<ll,ll>>>
#define pqll                    priority_queue<ll>
#define mll                     map<ll,ll>
#define mlc                     map<ll,char>
#define um                      unordered_map
#define umll                    um<ll,ll>
#define umlc                    um<ll,char>
#define all(x)                  x.begin(),x.end()
#define fi                      first
#define se                      second
#define ln                      cout<<"\n";
#define endl                    "\n"
#define test                    ll T;cin>>T;while(T--)
#define isvowel(a)              (a == 'a' || a == 'e' || a == 'i' || a == 'o' || a == 'u')
#define fastIO                  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define show(w,size)            for(ll i=0;i<size;i++) cout<<w[i]<<" ";
#define prll(a)                 cout<<a<<"\n";
#define mset(dp,no)             memset(dp,no,sizeof(dp))
#define input(a,n)              rep(i,0,n-1,1) cin>>a[i];
#define countbit                __builtin_popcount                                           //Number of setbits in decimal notation
#define lb(v,cur)               lower_bound(all(v),cur)-v.begin()
#define ub(v,cur)               upper_bound(all(v),cur)-v.begin()
#define db(...)                 __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) { cerr << name << " : " << arg1 <<'\n'; }
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
    const char* comma = strchr(names + 1, ',');
    cout.write(names, comma - names) << " : " << arg1 << " | "; __f(comma + 1, args...);
}
long long pows(long long a, long long b) {
  long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}
ll powm(ll x,ll y,ll m=MOD){x=x%m;ll res=1;while(y){if(y&1)res=res*x;res%=m;y=y>>1;x=x*x;x%=m;}return res;}
ll modInverse(ll a, ll m=MOD){if(m == 1)return 0;ll m0=m,y=0,x=1;while(a>1){ll q=a/m,t=m;m=a%m,a=t;t=y;y=x-q*y;x=t;}if(x<0) x+=m0;return x;}
int main()
{
fastIO
ll n,m,i,j,k,x,y,v,z,t,e,f,p,q,g,l,r,w,h,count1=0,prod=1,a,b,c,d,index,diff,ans=0,sum=0,sum1=0,sum2=0,flag=0,flag1=0,flag2=0;
string s,s1,s2;
cin>>s;
cin>>s1;
for(i=0;i<s.size();i++)
{
  if(s[i]!=s1[i])
  {
    count1++;
  }
}
cout<<count1<<"\n";
}


Measured memory_bytes: 3776
total_stack = []
single_stack = []

def main():
    input_line = input()
    total = 0

    for i,s in enumerate(input_line):
        if s == "\\":
            total_stack.append(i)
        elif s == "/" and len(total_stack) != 0:
            a = total_stack.pop()
            total += i - a
            area = 0
            while len(single_stack) != 0 and a < single_stack[-1][0]:
                area += single_stack.pop()[1]
            single_stack.append([a, area + i - a])

    print(total)
    print(' '.join([str(len(single_stack))] + [str(i[1]) for i in single_stack]))

if __name__ == '__main__':
    main()


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

//?????????
#pragma region MACRO 
#define putans(x)  std::cerr << "[ answer ]: " ; cout << (x) << endl
#define dputans(x) std::cerr << "[ answer ]: "; cout << setprecision(40) << (double)(x) << endl
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define RREP(i,n,a) for(int i=(int)(n-1); i>= a; i--)
#define rep(i,n) REP(i,0,n)
#define rrep(i,n) RREP(i,n,0)
#define all(a) begin((a)),end((a))
#define mp make_pair
#define exist(container, n) ((container).find((n)) != (container).end())
#define equals(a,b) (fabs((a)-(b)) < EPS)
#ifdef _DEBUG //???????????????????????????????????????????????????
std::ifstream ifs("data.txt");
#define put ifs >>
#else //?????£????????????????????§?????????????????????
#define put cin >>
#endif
#pragma endregion
//???????????°??????????????´
#pragma region CODING_SUPPORT
#ifdef _DEBUG
#define dbg(var0) { std::cerr << ( #var0 ) << "=" << ( var0 ) << endl; }
#define dbg2(var0, var1) { std::cerr << ( #var0 ) << "=" << ( var0 ) << ", "; dbg(var1); }
#define dbg3(var0, var1, var2) { std::cerr << ( #var0 ) << "=" << ( var0 ) << ", "; dbg2(var1, var2); }
#define dbgArray(a,n) {std::cerr << (#a) << "=";  rep(i,n){std::cerr <<(a[i])<<",";} cerr<<endl;} 
#else
#define dbg(var0) {}
#define dbg2(var0, var1) {}
#define dbg3(var0, var1, var2) {}
#define dbgArray(a,n) {}
#endif 
#pragma endregion 
//typedef????????????????????????????¶????????????§?????????
#pragma region TYPE_DEF
typedef long long ll;
typedef pair<int, int> pii; typedef pair<string, string> pss; typedef pair<int, string>pis;
typedef pair<long long, long long> pll;
typedef vector<int> vi;
#pragma endregion
//??????????????°(???????????????????????§??????)
#pragma region CONST_VAL
#define PI (2*acos(0.0))
#define EPS (1e-10)
#define MOD (ll)(1e9 + 7)
#define INF (ll)(2*1e9)
#pragma endregion

const static int MAX_V = 10000;
const static int MAX_E = 30000;
int V;
vector<int> G[MAX_V];
vector<int> rG[MAX_V];
vector<int> vs;
bool used[MAX_V];
int cmp[MAX_V];

void add_edge(int from, int to) {
	G[from].push_back(to);
	rG[to].push_back(from);
}

void dfs(int v) {
	used[v] = true;
	rep(i, G[v].size()) {
		if (!used[G[v][i]]) dfs(G[v][i]);
	}
	vs.push_back(v);
}

void rdfs(int v, int k) {
	used[v] = true;
	cmp[v] = k;
	rep(i, rG[v].size()) {
		if (!used[rG[v][i]]) rdfs(rG[v][i],k);
	}
}

int scc() {
	fill(used, used + MAX_V, 0);
	vs.clear();
	rep(v, V) {
		if (!used[v])dfs(v);
	}
	fill(used, used + MAX_V, 0);
	int k = 0;
	rrep(i, vs.size()) {
		if (!used[vs[i]]) rdfs(vs[i],k++);
	}
	return k;
}

//AOJ 
int main() {
	int v, e; put v >> e;
	V = v;
	rep(i, e) {
		int s, t; put s >> t;
		add_edge(s,t);
	}
	scc();
	rep(i, v) {
		rep(j, v) {
			if (i == j) continue;
			if (cmp[i] == cmp[j]) { // ???????????£?????????????????£??????????????????????????£?????????
				cout << 1 << endl;
				goto END;
			}
		}
	}
	cout << 0 << endl;//??????????????£?????????????????????????????????????????£???
END:

	return 0;
}

////cout << scc() << endl;
//int q; put q;
//rep(i, q) {
//	int u, v; put u >> v;
//	if (cmp[u] == cmp[v])cout << 1 << endl;
//	else cout << 0 << endl;
//}

Measured memory_bytes: 3660
#include <iostream>
#include <iomanip>
#include <stdio.h>
#include <set>
#include <vector>
#include <map>
#include <cmath>
#include <algorithm>
#include <memory.h>
#include <string>
#include <sstream>
#include <cstdlib>
#include <ctime>
#include <cassert>

using namespace std;

typedef long long LL;
typedef pair<int,int> PII;

#define MP make_pair
#define PB push_back
#define FF first
#define SS second

#define FORN(i, n) for (int i = 0; i <  (int)(n); i++)
#define FOR1(i, n) for (int i = 1; i <= (int)(n); i++)
#define FORD(i, n) for (int i = (int)(n) - 1; i >= 0; i--)

#define DEBUG(X) { cout << #X << " = " << (X) << endl; }
#define PR0(A,n) { cout << #A << " = "; FORN(_,n) cout << A[_] << ' '; cout << endl; }

#define MOD 1000000007
#define INF 2000000000

int GLL(LL& x) {
    return scanf("%lld", &x);
}

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

const int MAXN = 100005;
int deg[MAXN], visited[MAXN];

LL a[MAXN];

int n; bool ok;

vector< vector<int> > adj;

LL dfs(int u) {
//    DEBUG(u);
    visited[u] = 1;

    if (deg[u] == 1) {  // leaf
        return a[u];
    }
    else {
        LL chains = 0, maxChain = 0;

        for (auto& v : adj[u]) {
            if (!visited[v]) {
                LL c = dfs(v);
                chains += c;
                maxChain = max(c, maxChain);
            }
        }

        LL combine = 2 * (chains - a[u]);
        LL up = chains - combine;

        if (combine < 0 || up < 0 || combine > 2 * (chains - maxChain)) ok = false;
        return up;
    }
}

int main() {
    GI(n);
    FOR1(i, n) GLL(a[i]);

    if (n == 2) {
        cout << (a[1] == a[2] ? "YES" : "NO") << "\n";
        return 0;
    }

    memset(deg, 0, sizeof deg);
    adj.resize(n+1);

    int u, v;
    FOR1(i, n-1) {
        GI(u); GI(v);
        adj[u].PB(v);
        adj[v].PB(u);
        deg[u]++;
        deg[v]++;
    }

    int nonleaf = 0;
    FOR1(i, n) if (deg[i] != 1) nonleaf = i;

    memset(visited, 0, sizeof visited);
    ok = true;

    if (dfs(nonleaf) == 0 && ok) {
        cout << "YES\n";
    }
    else {
        cout << "NO\n";
    }

    return 0;
}

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

#define ll long long

#define fr(i,a,b) for (ll i = (a), _b = (b); i <= _b; i++)
#define frr(i,a,b) for (ll i = (a), _b = (b); i >= _b; i--)
#define rep(i,n) for (ll i = 0, _n = (n); i < _n; i++)
#define repr(i,n) for (ll i = n - 1; i >= 0; i--)
#define fill(ar,val) memset(ar, val, sizeof(ar))
#define fill0(ar) fill((ar), 0)
#define debug(x) cout<<#x<<": "<<x<<endl

#define ld long double
#define pb push_back
#define mp make_pair
#define ff first
#define ss second

typedef pair<int, int> ii;
typedef pair<ii, int> iii;
typedef vector<ii> vii;
typedef vector<int> vi;

#define INF 1000000000000000000
#define PI 3.14159265358979323846L

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

    ll n,k;
    cin >> n >> k;

    string s;
    cin >> s;

    ll p1 = 0;
    ll p2 = 0;

    ll num = 0;

    ll ans = 0;

    ll fir = 0;

    ll prev = 1;
    rep(i,n)
    {
    	ll x = s[i]-'0';

    	if(prev==1 && x==0)
    	{
    		ans = max(ans,p2-p1);
    		p2++;
    		if(num==k)
    		{
    			num--;
    			ll prev2 = 1;
    			while(prev2!=0 || s[p1]-'0'!=1)
    			{
    				prev2 = s[p1]-'0';
    				p1++;
    				// cout << prev2 << " " << p1 << endl;
    			}
    		}
    		ans = max(ans,p2-p1);
    		num++;
    	}
    	if(prev==0 && x==0)
    	{
    		p2++;
    		ans = max(ans,p2-p1);
    	}
    	if(prev==1 && x==1)
    	{
    		p2++;
    		ans = max(ans,p2-p1);
    	}
    	if(prev==0 && x==1)
    	{
    		p2++;
    		ans = max(ans,p2-p1);
    	}
    	prev = x;
    }

    cout << ans << endl;
}


Measured memory_bytes: 512
/* Bismillahir Rahmanir Rahim */

#include <bits/stdc++.h>

#define rep(i, n)	for(int i=0;i<n;i++)
#define repn(i, n)	for(int i=1;i<=n;i++)
#define set(i, n)	memset(i, n, sizeof(i))

#define pb	push_back

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;

int n;
vector<int>vec;

int main(){
    int x;
    scanf("%d", &n);
    repn(i, 3*n){
        scanf("%d", &x);
        vec.pb(x);
    }
    sort(vec.begin(), vec.end());
    long long ret = 0;
    int cur = 3 * n - 2;
    while(n--){
        ret += vec[cur];
        cur -= 2;
    }
    cout << ret << endl;
	return 0;
}


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

int main()
{
    int n, i, min, rmin=2;
    int flag=0;
    int wflag=0;
    cin >> n;
    min = n;

    while(wflag == 0){
        for(i=2;i<min/2;i++){
            if(min % i == 0){
                flag = 1;
            }
        }
        if(flag == 0){
            rmin = min;
        }
        if(n <= rmin){
            wflag = 1;
            }
        min++;
        flag = 0;
    }
    
    cout << rmin << endl;
    return 0;
}

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

namespace Atcoder
{
    class ABC128_A
    {
        static void Main(string[] args)
        {
            string[] str = Console.ReadLine().Split(' ');
            int a = int.Parse(str[0]);
            int p = int.Parse(str[1]);
            Console.Write((3 * a + p) / 2);
        }
    }
}

Measured memory_bytes: 11092
#include<iostream>
#include<cmath>
#include<algorithm>
#include<vector>
#include<queue>

using namespace std;

int main(){

  int w,h;
  cin >> w >> h;

  while(true){
    if(w==0 && h==0)break;
    //eが縦棒、fが横棒
    int e[h][w+1];
    int f[h+1][w];
    //周りを囲む
    for(int i=0;i<h;i++){
      e[i][0]=1;
      e[i][w]=1;
    }
    for(int i=0;i<w;i++){
      f[0][i]=1;
      f[h][i]=1;
    }
    //入力
    for(int i=0;i<h-1;i++){
      for(int j=1;j<w;j++){
        cin >> e[i][j];
      }
      for(int j=0;j<w;j++){
        cin >> f[i+1][j];
      }
    }
    for(int i=1;i<w;i++){
      cin >> e[h-1][i];
    } 

    int dist[h][w];
    for(int i=0;i<h;i++){
      for(int j=0;j<w;j++){
        dist[i][j]=-1;
      }
    }

    queue<vector<int>> que;

    dist[0][0]=1;
    que.push({0,0});

    while(!que.empty()){
      vector<int> v=que.front();
      que.pop();

      if(v[0]+1<h && f[v[0]+1][v[1]]==0 && dist[v[0]+1][v[1]]==-1){
        dist[v[0]+1][v[1]]=dist[v[0]][v[1]]+1;
        que.push({v[0]+1,v[1]});
      }

      if(v[0]-1>-1 && f[v[0]][v[1]]==0 && dist[v[0]-1][v[1]]==-1){
        dist[v[0]-1][v[1]]=dist[v[0]][v[1]]+1;
        que.push({v[0]-1,v[1]});
      }

      if(v[1]-1>-1 && e[v[0]][v[1]]==0 && dist[v[0]][v[1]-1]==-1){
        dist[v[0]][v[1]-1]=dist[v[0]][v[1]]+1;
        que.push({v[0],v[1]-1});
      }

      if(v[1]+1<w && e[v[0]][v[1]+1]==0 && dist[v[0]][v[1]+1]==-1){
        dist[v[0]][v[1]+1]=dist[v[0]][v[1]]+1;
        que.push({v[0],v[1]+1});
      }     

    }

    if(dist[h-1][w-1]!=-1)cout << dist[h-1][w-1] << endl;
    else cout << 0 << endl;


    cin >> w >> h;

  }

}


Measured memory_bytes: 3168
h,w,k=map(int,input().split())



dp=[[0]*(w+2) for i in range(h+1)]
dp[0][1]=1
baai=[1,1,2,3,5,8,13,21]
baai=baai+[1]*(h+5)

for i in range(1,h+1):
    for j in range(1,w+1):
        dp[i][j]=(baai[j-2]*baai[w-j]*dp[i-1][j-1]+ baai[j-1]*baai[w-j]*dp[i-1][j] + baai[w-j-1]*baai[j-1]*dp[i-1][j+1])%(10**9+7)


print(dp[-1][k])

Measured memory_bytes: 3064
//============================================================================
// Name        : AOJ.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <cctype>
using namespace std;

int N, M, p;
vector<int> D;
	int pdist(int s, int t){ return ( t >= s )?(t -s):((t+N) -s); }
	int ndist(int s, int t){ return pdist(t, s);}
	int solve(){
	if ( D.size() == 1 )
	return min(pdist(D[0], p), ndist(D[0], p));
	int ans= 2*N;
    for ( int i= 0; i< M; i++ ){
	int b = D[i];
	int e = D[(i+1)%M];
	int d = min(pdist(b, p), min(pdist(e, p), min(ndist(b, p), ndist(e,p))));
	ans= min(d + (N-pdist(b, e)), ans);
	}
	return ans;
	}
int main() {
	int k;
	cin>> N >> M >> p;
	for ( int i= 0; i< M; i++ ){
		cin>> k;
		D.push_back(k);
	}
	sort(D.begin(), D.end());
	cout<< 100*solve() << endl;

	return 0;
}

Measured memory_bytes: 3224
#include<iostream>
#include<set>
#define REP(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
typedef long long int lli;

using namespace std;

int main(){
  set<int> s;
  REP(i, 0, 3) {
    int num;
    cin >> num;
    s.insert(num);
  }
  cout << s.size() << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>

using namespace std;

int l, a[100005], b[100005], cnt1, cnt2;
string s;

int main()
{
	cin >> s;
	l = s.length();
	a[1] = 1;
	b[1] = 0;
	for (int i = 2; i <= l; i++)
	{
		a[i] = ((a[i - 1] + 1) & 1);
		b[i] = ((b[i - 1] + 1) & 1);
	}
	for (int i = 1; i <= l; i++)
	{
		if (a[i] != s[i - 1] - '0') cnt1++;
		if (b[i] != s[i - 1] - '0') cnt2++;
	}
	cout << min(cnt1, cnt2) << endl;
	return 0;
}

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

int main() {
  int h,w;
  char c;
  int a[2019][2019];
  int b[2019][2019];
  cin >> h >> w;
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      cin >> c;
      if(c=='.'&&j>0)a[i][j]=a[i][j-1]+1;
      else if(c=='.'&&j==0)a[i][j]=1;
      if(c=='#')a[i][j]=0;
      if(c=='#' && j>0 && a[i][j-1]>0){
        for(int k=1;k<a[i][j-1];k++)a[i][j-1-k]=a[i][j-1];
      }
      if(j==w-1){
        for(int k=1;k<a[i][j];k++)a[i][j-k]=a[i][j];
      }
    }
  }
  for(int i=0;i<w;i++){
    for(int j=0;j<h;j++){
      if(a[j][i]>0&&j>0)b[j][i]=b[j-1][i]+1;
      else if(a[j][i]>0&&j==0)b[j][i]=1;
      if(a[j][i]==0)b[j][i]=0;
      if(a[j][i]==0 && j>0 && a[j-1][i]>0){
        for(int k=1;k<b[j-1][i];k++)b[j-1-k][i]=b[j-1][i];
      }
      if(j==h-1){
        for(int k=1;k<b[j][i];k++)b[j-k][i]=b[j][i];
      }
    }
  }
  int res=0;
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      if(res<a[i][j]+b[i][j]-1)res=a[i][j]+b[i][j]-1;
    }
  }
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 32000
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using V = vector<ll>;
#define _GLIBCXX_DEBUG
#define rep(i, a) for(int i = 0; i < a; i++)
#define ALL(v) v.begin(), v.end()

int main(){
    int a,b; cin>>a>>b;
    if(a<9&&b<9) cout<<"Yay!"<<endl;
    else cout<<":("<<endl;
}

Measured memory_bytes: 256
def main():
#1. input
    A, B, C = map(int, input().split())

#2. if min<mid => min+2
#    if min==mid => min+1, mid+1
#    else break
    cnt = 0
    nums = sorted([A,B,C])
    min_num = nums[0]
    mid_num = nums[1]
    max_num = nums[2]
    
    while 1:
        nums = sorted([min_num, mid_num, max_num])
        min_num = nums[0]
        mid_num = nums[1]
        max_num = nums[2]

        if (min_num == mid_num) and (mid_num == max_num):
            break
        elif min_num == mid_num:
            min_num += 1
            mid_num += 1
        else:
            min_num += 2
        
        cnt += 1     

#3. output
    print(cnt)


if __name__ == "__main__":
    main()

Measured memory_bytes: 3064
#define _GLIBCXX_DEBUG
#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()
typedef long long ll;


int main(){
    int n, a;
    double t;
    cin >> n >> t >> a;
    int ans = 10000;
    double sa_min = 1000000;
    REP(i, n){
        int h;
        cin >> h;
        double tmpr = t - h * 0.006;
        sa_min = min(sa_min, abs(a - tmpr));
        if (sa_min == abs(a - tmpr)){
            ans = i + 1;
        }
    }
    cout << ans << "\n";
}


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


using namespace std;

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

    vector<vector<int>> result(a + 1,vector<int>(b + 1,0));
    int temp=0;

    for (int c = 0; c < a; ++c) {
        temp = 0;
        for (int d = 0; d < b; ++d) {
            cin >> result.at(c).at(d);
            temp += result.at(c).at(d);
        }
        result.at(c).at(b) = temp;
    }

    for (int e = 0; e < b + 1; ++e) {
        temp = 0;
        for (int f = 0; f < a; ++f) {
            temp += result.at(f).at(e);
        }
        result.at(a).at(e) = temp;
    }

    for(auto re : result){
        for (int g = 0; g < re.size(); ++g) {
            cout << re.at(g);
            if(g != re.size() - 1){
                cout << " ";
            }
        }

        cout << endl;
    }

    return 0;
}

Measured memory_bytes: 3188
def main():
    n = int(input())
    a = list(map(int, input().split()))

    sum_a = sum(a)
    min_diff = 1000000000000000000000

    sum_x = 0
    for i in range(0, n-1):
        sum_x += a[i]
        diff = abs(sum_a - 2*sum_x)
        if min_diff > diff:
            min_diff = diff

    print(min_diff)

    '''
    half = sum_a // 2

    diff = []
    for i in range(n-1):
        diff.append(a[i+1] - a[i])
    min_diff = abs(min(diff))

    print(min_diff)
    '''

# 真ん中を分けるカードの差がわかればよい


if __name__ == '__main__':
    main()


Measured memory_bytes: 100268
#include<stdio.h>
#define INF 1000000000
void MST(int);

int edge[101][101],v[101],d[101],sum=0,n;

int main(void){

  int m,a,b,i,j, cost;

  while(1){
      scanf("%d",&n);
      if(n==0)break;

      scanf("%d",&m);

      for(i=0;i<101;i++){
	  for(j=0;j<101;j++){
	      edge[i][j]=INF;
	    }
	}

      for(i=0;i<m;i++){
	scanf("%d,%d,%d",&a,&b,&cost);
	edge[a][b]=cost;
	edge[b][a]=cost;
	 }

      for(i=0;i<101;i++){
	d[i]=INF;
	v[i]=0;
      }

      d[0]=0;
      sum = 0;
      MST(0);

      printf("%d\n",sum);
    }

  return 0;
}

void MST(int u)
{
  int x=0,i;

  while(1){
    int minv=INF;

    for(i=0;i<n;i++){
      if(v[i]==0 &&  d[i]<minv){
	//d[i]=edge[x][i];
	x=i;
	minv=d[i];
      }
    }
    if(minv==INF)break;  

    v[x]=1;
    if ( x != u ) sum+=(d[x]/100-1);
    
    for(i=0;i<n;i++){
      if ( v[i] ) continue;
      d[i]=min(d[i],edge[x][i]);
    }
  }
}

int min(int x,int y)
{
  return x < y ? x : y;
 }

Measured memory_bytes: 0
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		try (Scanner sc = new Scanner(System.in)) {
			double r = sc.nextDouble();
			System.out.println(String.format("%f %f", r * r * Math.PI, 2 * r * Math.PI));
		}
	}
}



Measured memory_bytes: 28296
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define int ll
#define pii pair<int,int>
#define fi first
#define se second
#define mp(x,y) make_pair(x,y)
#define pb(x) pupsh_back(x)
int32_t main() {
    int n,m;
    cin>>n>>m;
    int v[n];
    int sum=0;
    for(int i=0;i<n;i++){cin>>v[i];sum+=v[i];}
    
    int k=sum/(4*m);
    
    if(k*(4*m)==sum)
    {
        k--;
    }
    sort(v,v+n);
    int cnt=0;
    for(int i=n-1;i>=0;i--)
    {
        if(v[i]>k)
        {
            cnt++;
        }
        else
        break;
    }
    if(cnt>=m) cout<<"Yes";
    else cout<<"No";
    
//    cout<<"Sum of x+y = " << z;
}

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

typedef long long ll;

int main(){
    int N;
    cin>>N;
    vector<ll> 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(C.begin(),C.end());

    ll ans = 0;

    for(int i=0; i<N; i++){
        ll a = lower_bound(A.begin(),A.end(),B[i]) - A.begin();
        ll c = C.end() - upper_bound(C.begin(),C.end(),B[i]);
        ans += a*c;
    }

    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 2560
import math
A, B, H, M = map(int, input().split())
H_an = H * 360 /12 + M / 2
M_an = M * 360 /60 
an = abs(H_an - M_an)
if an >= 180:
    an = 360 - an
an = an * math.pi/180

a = (A**2) + (B**2) - (2*A*B*math.cos(an))
print(math.sqrt(a))

Measured memory_bytes: 9580
#include <bits/stdc++.h>
#define rep(i,l,n) for(int i=l;i<n;i++)
#define rer(i,l,n) for(int i=l;i<=n;i++)
#define all(a) a.begin(),a.end()
#define o(a) cout<<a<<endl
#define pb(a) push_back(a)
#define mk(a,b) make_pair(a,b)
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;

int main(){
	int n;
	while(1){
		cin>>n;
		if(n==0) break;
		vi d(10);
		int a;
		rep(i,0,n){
			cin>>a; d[a]++;
		}
		rep(i,0,10){
			if(d[i]==0) o('-');
			else{
				rep(j,0,d[i]) cout<<'*';
				cout<<endl;
			}
		}
	}
}

Measured memory_bytes: 1180