akhauriyash/Code-Regression huggingface dataset:
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int a = in.nextInt(), b = in.nextInt(), c = in.nextInt();
            int x = in.nextInt();
            long count = 0;
            for (int i = 0; i <= a; i++) {
                for (int j = 0; j <= b; j++) {
                    for (int k = 0; k <= c; k++) {
                        if (500 * i + 100 * j + 50 * k == x) {
                            count++;
                            break;
                        }
                    }
                }
            }
            out.println(count);
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1)
                throw new InputMismatchException();

            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }

                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = read();

            while (isSpaceChar(c))
                c = read();

            int sgn = 1;

            if (c == '-') {
                sgn = -1;
                c = read();
            }

            int res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));

            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null)
                return filter.isSpaceChar(c);
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}



Measured memory_bytes: 23252
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;
int main()
{
    string str;
    cin >> str;

    string ans;
    ans.reserve((str.size() + 1) / 2);

    for (int i = 0; i < str.size(); ++i)
    {
        if (i % 2 == 0)
            ans.push_back(str[i]);
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 512
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}
macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}
macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}
fn main() {
    input!{
        s: String,
    }
    if let Some(v) = ["SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"].iter().position(|&t| t == s) {
        println!("{}", 7 - v);
    }
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) (x).begin(),(x).end() 
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define INF 1000000000
using namespace std;
typedef long long ll;

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

    int ans = ceil((double)N/2);
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3620
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>
#include <iomanip>
#define vll vector<ll>
#define vvvl vector<vvl>
#define vvl vector<vector<ll>>
#define VV(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define VVV(a, b, c, d) vector<vvl>(a, vvl(b, vll (c, d)));
#define re(c, b) for(ll c=0;c<b;c++)
#define all(obj) (obj).begin(), (obj).end()
typedef long long int ll;
typedef long double ld;
using namespace std;

int main(int argc, char const *argv[]) {
  ll n, a;std::cin >> n >> a;
  ll ans = 1000000000000000000;
  for(ll i=0;i<=40;i++){
    ll l = 0, r = 1000000000000;
    while(r-l>1){
      ll mid = (l+r)/2;
      bool f = false;
      ll num = mid;

      if(num>=n) f = true;
      else{
        for(int j=0;j<i;j++){
          ll x = n/num + (n%num!=0?1:0); // 以上になるために必要な最低値
          if(x<=mid){
            f = true;
            break;
          }
          num *= mid;
        }
      }
      if(f) r = mid;
      else l = mid;
    }
    ll x = 0;
    //i+1個数、rまたはr-1を取る
    for(int j=0;j<=i;j++){ //節約できるのは0~i個   i+1-j個のrとj個のr-1
      bool f = false;
      ll num = 1;
      for(int k=0;k<i+1-j;k++){
        ll need = n/num + (n%num!=0?1:0);
        if(r>=need){
          f = true;
          break;
        }
        num *= r;
      }
      for(int k=0;k<j;k++){
        if(num==0) break;
        ll need = n/num + (n%num!=0?1:0);
        if(r-1>=need){
          f = true;
          break;
        }
        num *= r-1;
      }
      if(f) x = j;
    }
    ans = min(ans, i*a + r*(i+1-x) + (r-1)*x);
  }
  std::cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string s;
  cin >> s;
  
  int count = 0;
  if(s.at(0) == '1') count++;
  if(s.at(1) == '1') count++;
  if(s.at(2) == '1') count++;
  
  cout << count << endl;
}

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

int main() {
	int n;
	cin >> n;
	for (int i = 1; i <= n; i++) {
		int x = i;
		if (i % 3 == 0) {
			cout << " " << i;
			continue;
		}
		while (true) {
			if (x % 10 == 3) {
				cout << " " << i;
				break;
			}
			else if (x / 10 == 0) {
				break;
			}
			x /= 10;
		}
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 3096
#include<iostream>
#include<algorithm>
#include<map>
using namespace std;
typedef long long ll;
ll a[114514], b[114514];
int main() {
	int n; cin >> n;
	for (int i = 0; i < n; i++) { cin >> a[i]; b[i] = a[i]; }
	sort(b, b + n);
	map<ll, int> m;
	for (int i = 0; i < n; i++)m[b[i]] = i;
	int ans = 0;
	for (int i = 0; i < n; i++) 
		if (i % 2 != m[a[i]] % 2)ans++;
	cout << ans/2 << endl;
	return 0;
}

Measured memory_bytes: 8696
#include <cstdio>
#include <cstring>
#include <cstring>
#include <cmath>
#include <algorithm>
using namespace std;
const int MaxN = 1e6;
const int INF = 1 << 30;

int h, w;
char s[105][105];
int main()
{
	while(scanf("%d %d", &h, &w) != EOF)
	{
		for(int i = 1; i <= h; i++)
			for(int j = 1; j <= w; j++)
				scanf(" %1c", &s[i][j]);
		for(int i = 0; i <= h + 1; i++)
		{
			for(int j = 0; j <= w + 1; j++)
			{
				if(i == 0 || j == 0 || i == h + 1 || j == w + 1)
					printf("#");
				else
					printf("%c", s[i][j]);
			}
			printf("\n");
		}
		memset(s, 0, sizeof(s));
	}
}

Measured memory_bytes: 128
import java.util.*;
public class Main { 
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        Map<String, Integer> score = new HashMap<>();
        for(int i = 0; i < n; i++) {
            String word = sc.next();
            score.put(word, score.getOrDefault(word, 0) + 1);
        }
        int m = sc.nextInt();
        for(int i = 0; i < m; i++) {
            String word = sc.next();
            score.put(word, score.getOrDefault(word, 0) - 1);
        }
        int max = 0;
        for(int s : score.values())
            max = Math.max(max, s);
        System.out.println(max);
    }
}


Measured memory_bytes: 23124
// {{{
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
// }}}

using namespace std;

using ll = long long;
using ull = unsigned long long;
using ld = long double;

static constexpr int mod = (int)1e9 + 7;
static constexpr int inf = 100100100;
static constexpr ll linf = 1e18;
static constexpr double eps = 1e-9;
static constexpr double pi = 3.14159265359;

#define rep(i, n) for (ll i = 0; i < n; ++i)
#define rrep(i, n) for (ll i = n; i >= 0; --i)
#define all(c) begin(c), end(c)
#define rall(c) rbegin(c), rend(c)
#define pb push_back
#define ist insert
#define fst first
#define snd second


int main() {
    // cin.tie(0);
    // ios_base::sync_with_stdio(false);
    ll N;
    cin >> N;
    vector<pair<ll, ll>> V;
    rep (i, N) {
        ll t, a;
        cin >> t >> a;
        V.pb({t, a});
    }
    ll x = V[0].fst, y = V[0].snd;
    ll ans = x + y;
    for (ll i = 1; i < N; ++i) {
        ll j = 1;
        ll x_ = V[i].fst, y_ = V[i].snd;
        while (true) {
            if (x_ * j >= x && y_ * j >= y) break;
            j *= 2;
        }
        ll lj = j / 2, rj = j;
        while (abs(lj - rj) > 1) {
            ll mj = (lj + rj) / 2;
            if (x_ * mj >= x && y_ * mj >= y) {
                rj = mj;
            } else {
                lj = mj;
            }
        }
        ans += x_ * rj - x;
        ans += y_ * rj - y;
        x = x_ * rj;
        y = y_ * rj;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define rep(i,m,n) for(int i=(int)(m);i<(int)(n);++i)
#define rREP(i,m,n) for(int (i)=(n)-1; (i)>=(m);--(i))
#define all(x) (x).begin(),(x).end()
#define out(y,x,h,w) (y)<0||(x)<0||(y)>=(h)||(x)>=(w)
constexpr int INF = 1000000001;
constexpr ll mod = 1000000007;
constexpr double PI = 3.1415926535897932;

template<class T>inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
template<class T>inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}
inline void init() {
	cin.tie(nullptr); cout.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}

int main() {
	init();
	
	int N; cin >> N;
	vector<int>T(N);
	int cnt = 0;
	rep(i, 0, N) {
		cin >> T[i];
		cnt += T[i];
	}
	int M; cin >> M;
	vector<pair<int, int>>P(M);
	rep(i, 0, M) {
		int a, b; cin >> a >> b;
		--a;
		P[i] = make_pair(a, b);
	}
	rep(i, 0, M) {
		cout << cnt - T[P[i].first] + P[i].second << "\n";
	}

	return 0;
}

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

namespace ConsoleApplication
{
    class Program
    {
        static void Main()
        {
            new Solution().answer();
        }
    }

    class Solution
    {
        string[] input;

        public Solution()
        {
            input = Console.ReadLine().Split(' ');
        }
        
        public void answer()
        {
            int A = Convert.ToInt32(input[0]);
            int B = Convert.ToInt32(input[1]);
            int C = A + B;

            if (C < 10) { Console.WriteLine(C.ToString()); }
            else { Console.WriteLine("error"); }
        }
    }
}

Measured memory_bytes: 11220
def yakusu(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]
N,K=map(int,input().split())
L=list(map(int,input().split()))
a=sum(L)
R=yakusu(a)[::-1]
for i in range(len(R)):
  add=0
  minus=0
  s=R[i]
  A=list()
  B=list()
  for j in range(N):
    k=L[j]
    a=k%s
    b=s-a
    if a>b:
      add+=b
      B.append(b)
    elif a<b:
      minus+=a
      A.append(a)
    else:
      add+=a
      B.append(a)
  #足した分=add else:minus どっちでも:even
  A=sorted(A)
  B=sorted(B)
  if minus==add:
    d=minus
    if d<=K:
      print(s)
      exit()
  elif minus>add:
    q=(minus-add)//s
    d=sum(A[:len(A)-q])
    if d<=K:
      print(s)
      exit()
  else:
    q=(add-minus)//s
    d=sum(B[:len(B)-q])
    if d<=K:
      print(s)
      exit()

Measured memory_bytes: 9300
#include<bits/stdc++.h>
#include<iomanip>
using namespace std;
typedef long long ll;
typedef long  l;
typedef pair<int,int> P;
#define rep(i,n) for(int i=0;i<n;i++)
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
const int INF=1000000001;
const double PI=3.141592653589;


int main(){
  string s,t; cin>>s>>t;
  sort(ALL(s));
  sort(ALL(t));
  reverse(ALL(t));
  // cout<<s<<endl;
  // cout<<t<<endl;
  if(s<t)
  cout<<"Yes"<<endl;
  else
  cout<<"No"<<endl;


  return 0;
}


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

int main() {
    string s, t;
    cin >> s;
    cin >> t;
    int max = 0;
    for(int i=0; i<s.length() - t.length() + 1; i++) {
        int c = 0;
        for(int j=0; j<t.length(); j++) {
            if(s[i+j] == t[j]) {
                c++;
            }
        }
        if(max < c) max = c;
    }
    cout << t.length() - max << '\n';
    return 0;
}

Measured memory_bytes: 3192
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

const long MOD = 1000000007;
typedef pair<int, int> P;
typedef long long ll;

int main(){
    ll A, B, N;
    cin >> A >> B >> N;

    ll ans = 0;
    if(N >= B){
        ll x1 = (N/B)*B - 1;
        ll ta1 = (A*x1)/B - A *(x1/B);
        ans = max(ta1, ans);
    }
    ll x2 = N;
    ll ta2 = (A*x2)/B - A *(x2/B);
    ans = max(ans, ta2);

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3592
import java.util.Scanner;

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

		long n = scan.nextLong();
		long k = scan.nextLong();

		n %= k;

		if(n <= Math.abs(n - k)) {
		}else {
			n = Math.abs(n - k);
		}

		System.out.println(n);
	}
}


Measured memory_bytes: 35636
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define MOD 1000000007

const int INF=INT_MAX/2;

int main(){
  string s;
  cin>>s;
  int n=s.length(), ans=n;
  for(int i=1;i<n;i++){
    if(s[i-1]==s[i]) continue;
    int tmp=max(i,n-i);
    ans=min(ans,tmp);
  }
  cout<<ans<<endl;
  return 0;
}


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

#define fi first
#define se second
#define be begin
#define en end
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define ALL(a) (a).be() , (a).en()
#define REP(i,n) for(int i=0;i<(n);i++)        //repeat n times
#define REP2(i,s,n) for(int i=(s);i<(n);i++)   //repeat from s to n 
#define REPD(i,n) for(int i=(n);i>=0;i--)      //repeat from n to 0
#define REPD2(i,s,e) for(int i=(s);i>=(e);i--) //repeat from s to e
#define RANGE(i,v) for(auto &i:v)                  //repeat range
#define ASIZE(a) (sizeof(a) / sizeof(a[0]))          //array size

using LL = long long;

template<typename T1,typename T2> using P = pair< T1, T2 >;
using Pii = P<int,int>;
using Pll = P<LL,LL>;
using Pdd = P<double,double>;
using Psi = P<string,double>;

template<typename T> using V = vector< T >;
using Vi = V<int>;
using Vll = V<LL>;
using Vs = V<string>;

int main(){
    LL N;
    cin>>N;
    Vll a(N);
    REP(i,N) cin>>a[i];
    
    LL S = 0;
    REP(i,N){
        S = S^a[i];
    }

    REP(i,N){
        cout<<(S^a[i])<<" ";
    }
    cout<<endl;

    return 0;
}

Measured memory_bytes: 4740
import java.util.ArrayDeque;
import java.util.Deque;
import java.util.Scanner;
public class Main {
	public static void main(String[] args)throws Exception{
		Scanner stdIn=new Scanner(System.in);
		int H=stdIn.nextInt();
		int W=stdIn.nextInt();
		char map[][]=new char[H][W];
		boolean visit[][]=new boolean[H][W];
		Deque<Integer> start=new ArrayDeque<Integer>();
		Deque<Integer> aoki=new ArrayDeque<Integer>();
		int max=0,cout=0;
		for(int i=0;i<H;i++){
			String a=stdIn.next();
			for(int j=0;j<W;j++){
				map[i][j]=a.charAt(j);
				if(map[i][j]=='.'){
					start.add(i);
					start.add(j);
				}
			}
		}
		while(start.size()>0){
			int h=start.poll();
			int w=start.poll();
			aoki.add(h);aoki.add(w);
			visit[h][w]=true;
			while(aoki.size()>0){
				int key=aoki.size();
				for(int i=0;i<key/2;i++){
					h=aoki.poll();w=aoki.poll();
					if(h!=0&&map[h-1][w]=='.'&&visit[h-1][w]==false){
						aoki.add(h-1);aoki.add(w);
						visit[h-1][w]=true;
					}
					if(w!=0&&map[h][w-1]=='.'&&visit[h][w-1]==false){
						aoki.add(h);aoki.add(w-1);
						visit[h][w-1]=true;
					}
					if(h!=H-1&&map[h+1][w]=='.'&&visit[h+1][w]==false){
						aoki.add(h+1);aoki.add(w);
						visit[h+1][w]=true;
					}
					if(w!=W-1&&map[h][w+1]=='.'&&visit[h][w+1]==false){
						aoki.add(h);aoki.add(w+1);
						visit[h][w+1]=true;
					}
				}
				cout++;
			}cout--;
			if(cout>max)
				max=cout;
			cout=0;
			visit=new boolean[H][W];
		}
		System.out.println(max);
	}
}


Measured memory_bytes: 21844
#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<string>
#include<vector>
#include<map>
#include<stack>
#include<queue>

using namespace std;

void print(int p){
	if(p<10) printf("0");
	printf("%d",p);
}
void print_col(){
	printf(":");
}

int main(){
	int t,h,s;
	while(scanf("%d %d %d",&t,&h,&s)){
		if(t==-1&&h==-1&&s==-1)
		break;
		int res=120*60;
		int t3,h3,s3;
		s+=h*60+t*3600;
		s=res-s;
		s3=s*3;
		t=s/3600;
		s=s%3600;
		h=s/60;
		s=s%60;
		//
		t3=s3/3600;
		s3=s3%3600;
		h3=s3/60;
		s3=s3%60;
		print(t);
		print_col();
		print(h);
		print_col();
		print(s);
		printf("\n");
		print(t3);
		print_col();
		print(h3);
		print_col();
		print(s3);
		printf("\n");
	}
}


Measured memory_bytes: 3136
#include <string>
#include <iostream>
#include <stack>
#include <queue> // priority_queue も入ってる
#include <set>   // 要素数は size() で取得 multisetもある
#include <map>
#include <array> // sizeはコンパイル時定数で固定
#include <vector>
#include <numeric>   // accumulate, gcd
#include <algorithm> // count_ifに必要
#include <iomanip>   // cout << setprecision(15) << x で小数の出力精度を指定
#include <tuple>
#include <utility> //pair

using namespace std;
// 問題が起こるまでintは使用禁止2020-04-13
using ll = long long;

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

template <class InputIterator, class T>
bool contains_itr(InputIterator iterator, const T &value)
{
    if (find(iterator.begin(), iterator.end(), value) == iterator.end())
        return false;
    else
        return true;
}

template <class T>
bool contains_set(set<T> st, const T &value)
{
    if (st.find(value) == st.end())
    {
        return false;
    }
    else
    {
        return true;
    }
}

template <class InputIterator>
auto sum(InputIterator iterator)
{
    return accumulate(iterator.begin(), iterator.end(), 0);
}

// endは排他的(exclusive)なので注意
vector<ll> range(ll begin, ll end)
{
    vector<ll> result;
    for (ll i = begin; i < end; ++i)
    {
        result.push_back(i);
    }
    return result;
}

// =========ここまでテンプレ============

int main()
{
    ll n, m;
    cin >> n >> m;
    vector<set<ll>> dests(n, set<ll>{});
    rep(i, m)
    {
        ll a, b;
        cin >> a >> b;
        --a;
        --b;
        dests[a].insert(b);
        dests[b].insert(a);
    }

    // vector<ll> shortests(n, LLONG_MAX);
    // shortests[0] = 0;
    vector<ll> befores(n, -1);

    queue<ll> que;
    que.push(0);
    while (!que.empty())
    {
        ll now = que.front();
        que.pop();
        for (auto itr = dests[now].begin(); itr != dests[now].end(); ++itr)
        {
            ll next = (*itr);
            if (befores[next] == -1)
            {
                befores[next] = now;
                que.push(next);
            }
        }
    }
    cout << "Yes" << endl;
    rep(i, befores.size() - 1) cout << befores[i + 1] + 1 << endl;
}


Measured memory_bytes: 25540
#include <string>
#include <bits/stdc++.h>
#include <stdio.h>
#include<math.h>
#include <ctype.h>
using namespace std;

int main() {
  int n;
  cin >> n;
  vector<int> vec(n);
  for(int i=0;i<n;i++){
    cin >> vec.at(i);
  }
  sort(vec.begin(), vec.end());
  int ans=0;
  for(int i=0;i<n-1;i++){
    ans=ans+vec.at(i);
  }
  if(vec.at(n-1)>=ans){
    cout << "No" << endl;
  }
  else{
    cout << "Yes" << endl;
   
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  for (int i = 0; i < s.length(); i++) {
    if (s[i] == 'L' && !(i & 1)) {
      cout << "No" << endl;
      return 0;
    }
    if (s[i] == 'R' && (i & 1)) {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<queue>
#include<map>
#include<tuple>
#define rep(index,num) for(int index=0;index<num;index++)
#define rep1(index,num) for(int index=1;index<=num;index++)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-15
#define mp(a1,a2) make_pair(a1,a2)
typedef long long ll;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=1e+18+1;
int INF=1e+9+1;
int main(){
	ll X,Y;
	scan(X);scan(Y);
	if(abs(X-Y)<2) prin("Brown");
	else prin("Alice");
	return 0;
}


Measured memory_bytes: 256
//コンパイラ最適化用
#pragma GCC optimize("Ofast")

//インクルード(アルファベット順)
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<climits>//INT_MAXなど
#include<chrono>//実行時間計測
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm,accumulate
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//順序保持しないmap
#include<unordered_set>//順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

using namespace std;
typedef long long ll;

// clang++ main.cc -std=c++11 -stdlib=libc++

/*
  cin >> N;
  vector<int> a(N);
  for (int i = 0; i < N; i++)
    cin >> a[i];
*/

signed main(){
  ll N;
  cin >> N;

  vector<int> v(N);
  for (int i = 0; i < N; i++)
    cin >> v[i];

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

  double res = v[0];
  for (int i = 1; i < N; i++)
    res = (res + v[i]) / 2.0;

  cout << res << endl;

  return 0;
}

Measured memory_bytes: 3724
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using namespace std;
typedef long long ll;
const int INF = (1<<30);
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

int main() {
    int N,K;
    scanf("%d%d", &N, &K);
    int h[N];
    rep(i, N) scanf("%d", h+i);
    int dp[N+200];
    rep(i, N+200) dp[i] = INF;
    dp[0] = 0;
    rep(i, N+1){
        for(int j=1; j <= K; j++){
            chmin(dp[i+j], dp[i] + abs(h[i]-h[i+j]));
        }
    }
    printf("%d\n", dp[N-1]);
    return 0;
}

Measured memory_bytes: 1024
#define _CRT_SECURE_NO_WARNINGS 1
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <queue>
#include <sstream>
#include <climits>
#include <cmath>
#include <map>
#include <stack>
using namespace std;
#define M_PI 3.141592
#define toRad 2.0*M_PI/360.0
#define inin(x) int x;cin>>x;
#define all(x) x.begin(),x.end()
#define debug(x) cout<<#x<<" "<<x<<endl;
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define EPS 1e-12
#define pri_max 60000
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
/*
bool memo[pri_max] = {};
vector<int> pri;
void calc()
{
	for (int i = 2; i < pri_max; i++)
	{
		if (memo[i] == false)
		{
			pri.push_back(i);
			for (int l = i; l < pri_max; l += i)
			{
				memo[l] = true;
			}
		}
	}
}*/
int main()
{
	string s;
	while (cin >> s)
	{
		vector<int> a, b;
		for (int i = 0; i < s.size(); i++)a.push_back(s[i] - '0');

		for (int i = 0; i < 10 - 1; i++)
		{
			for (int l = 0; l < a.size() - 1; l++)
			{
				b.push_back((a[l] + a[l + 1]) % 10);
			}
			a.clear();
			swap(a, b);
		}
		cout << a[0] << endl;
	}

}

Measured memory_bytes: 1204
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
using P = pair<int,int>;
using pq = priority_queue<int>;
typedef long long ll;

int  main()
{
	int n,a; cin >>n >> a;
	if (n % 500 <= a)
		cout << "Yes\n";
	else 
		cout << "No\n"; 
	return (0);
}

Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))

A_sorted = sorted(A, key=lambda x:abs(x), reverse=True)
abs_min = A_sorted[N - 1]

b_sum = 0
for i in range(N):
    b_sum += abs(A_sorted[i])
    
for j in range(N - 1):
    if A[j] < 0:
        A[j] = -A[j]
        A[j + 1] = -A[j + 1]
        
c_sum = sum(A)

if b_sum == c_sum:
    ans = b_sum
else:
    ans = b_sum - 2 * abs(abs_min)
    
print(ans)

Measured memory_bytes: 14412
class Dice:
    def __init__(self,numbers):
        self.surface=numbers

    def inspection(self,other):
        string=''
        a=self.surface[0]
        b=self.surface[1]
        c=self.surface[2]
        d=self.surface[3]
        e=self.surface[4]
        f=self.surface[5]
        match1=a+b+c+d+e+f
        match2=b+f+c+d+a+e
        match3=c+b+f+a+e+d
        match4=d+b+a+f+e+c
        match5=e+a+c+d+f+b
        match6=f+e+c+d+b+a
        match7=f+b+d+c+e+a
        match8=a+d+b+e+c+f
        match9=d+f+b+e+a+c
        match10=b+d+f+a+c+e
        match11=e+d+a+f+c+b
        match12=c+a+b+e+f+d
        match13=f+c+b+e+d+a
        match14=f+d+e+b+c+a
        match15=a+e+d+c+b+f
        match16=e+f+d+c+a+b
        match17=d+e+f+a+b+c
        match18=c+e+a+f+b+d
        match19=b+a+d+c+f+e
        match20=a+c+e+b+d+f
        match21=c+f+e+b+a+d
        match22=e+c+f+a+d+b
        match23=b+c+a+f+d+e
        match24=d+a+e+b+f+c
        for i in other.surface:
            string+=i
        if string==match1 or string==match2 or string==match3 or string==match4 or string==match5 or string==match6 or string==match7 or string==match8 or string==match9 or string==match10 or string==match11 or string==match12 or string==match13 or string==match14 or string==match15 or string==match16 or string==match17 or string==match18 or string==match19 or string==match20 or string==match21 or string==match22 or string==match23 or string==match24:
            return 'match'
        return 'not_match'

n=int(input())
lst=[]
for i in range(n):
    dice=Dice(input().split())
    if i==0:
        example_dice=Dice(dice.surface)
    else:
        lst.append(dice.surface)
for inspection_target in lst:
    inspection_target_dice=Dice(inspection_target)
    result=example_dice.inspection(inspection_target_dice)
    if result=='match':
        print("No")
        break
if result=='not_match':
    print("Yes")



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

int main(){
  string S; cin >> S;
  vector<int> A;
  vector<int> Z;
  for(int i = 0;i < S.size();i++){
    if(S[i] == 'A')A.push_back(i);
    if(S[i] == 'Z')Z.push_back(i);
  }

  cout << *max_element(Z.begin(),Z.end()) - *min_element(A.begin(),A.end()) + 1 << endl;
}


Measured memory_bytes: 1364
#include <cstdio>

#define INF (1<<28)
#define MAX_N 12
#define MAX_M 12

int N, M, X;
int C[MAX_N];
int A[MAX_N][MAX_M];

int pow(int a, int b) {
  int r = 1;
  while (b--) r*= a;
  return r;
}

bool check(int bit) {
  int R[MAX_M];
  for (int i = 0; i < M; i++) R[i] = 0;

  for (int i = 0; i < N; i++) {
    if (bit & (1<<i)) {
      for (int j = 0; j < M; j++) {
        R[j] += A[i][j];
      }
    }
  }

  for (int i = 0; i < M; i++) {
    if (R[i] < X) return false;
  }
  return true;
}

void solve() {
  int ans = INF;
  int p = pow(2, N);

  for (int bit = 0; bit < p; bit++) {
    if (check(bit)) {
      int cost = 0;
      for (int i = 0; i < N; i++) {
        if (bit & (1<<i)) { cost += C[i]; }
      }
      if (cost < ans) ans = cost;
    }
  }
  printf("%d\n", ans == INF ? -1 : ans);
}

int main() {
  scanf("%d %d %d", &N, &M, &X);
  for (int i = 0; i < N; i++) {
    scanf("%d", C+i);
    for (int j = 0; j < M; j++) {
      scanf("%d", &A[i][j]);
    }
  }
  solve();
}


Measured memory_bytes: 1728
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author toshibablack
 */

#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstring>
#include <fstream>
#include <functional>
#include <iostream>
#include <iomanip>
#include <iterator>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <vector>

#define ll long long int
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define REP(i, n) for(int i=0;i<n;++i)
#define FOREACH(x, a) for(auto& (x) : (a))
#define ALL(a) (a).begin(),(a).end()
#define OUT(x) out << (x) << endl;
#define M0(x) memset(x,0,sizeof(x))
#define MINF(x) memset(x,0x3f,sizeof(x))
#define MMINUS(a) memset(a,0xff,sizeof(a))

const int INF = 0x3f3f3f3f;
const int MOD = 1e9+7;
const ll LINF = 1e18;
const double EPS = 1.0/LINF;

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

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

int gcd(int a,int b){return b?gcd(b,a%b):a;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}

using namespace std;

class BBalance {
public:
    int N;
    int W[200];

    void solve(std::istream& in, std::ostream& out) {
        in >> N;
        REP(i, N) in >> W[i];
        int sum = accumulate(W, W + N, 0);

        int psum = 0;
        int i = 0;
        while ((psum += W[i]) <= sum / 2.0) {
            i++;
        }
        OUT(min(2 * psum - sum, sum - 2 * psum + 2* W[i]));
    }
};


int main() {
    BBalance solver;
    std::istream& in(std::cin);
    std::ostream& out(std::cout);
    solver.solve(in, out);
    return 0;
}


Measured memory_bytes: 256
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <set>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cstring>
#include <iterator>
#include <bitset>
#include <unordered_set>
#include <unordered_map>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <utility>
#include <memory>
#include <functional>
#include <deque>
#include <cctype>
#include <ctime>
#include <numeric>
#include <list>
#include <iomanip>

#if __cplusplus >= 201103L
#include <array>
#include <tuple>
#include <initializer_list>
#include <forward_list>

#define cauto const auto&
#else

#endif

using namespace std;


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

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll;
typedef vector<vector<long long> > vvll;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
    v.assign(a, vector<T>(b, t));
}

template <class F, class T>
void convert(const F &f, T &t){
    stringstream ss;
    ss << f;
    ss >> t;
}

#define GET_MACRO(_1, _2, _3, NAME, ...) NAME
#define _rep(i,n) _rep2((i),0,(n))
#define _rep2(i,a,b) for(int i=(a);i<(b);++i)
#define rep(...) GET_MACRO(__VA_ARGS__, _rep2, _rep)(__VA_ARGS__)
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define fi first
#define se second
#define mkp make_pair
#define DEBUG
#ifdef DEBUG
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#else
#define dump(x) 
#define debug(x) 
#endif

#define MOD 1000000007LL
#define EPS 1e-8
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
#define maxs(x,y) x=max(x,y)
#define mins(x,y) x=min(x,y)

map<int,int> func(vint v){
	map<int,int> ret;
	rep(i,v.size()){
		int sum = 0;
		rep(j,i,v.size()){
			sum += v[j];
			ret[sum]++;
		}
	}
	return ret;
}


void mainmain(){
	int n,m;
	while(cin>>n>>m,n||m){
		vint v(n);
		vint w(m);
		rep(i,n) cin>>v[i];
		rep(i,m) cin>>w[i];
		map<int,int> ma1;
		map<int,int> ma2;
		ma1 = func(v);
		ma2 = func(w);
		ll ans = 0;
		for(cauto x: ma1){
			ans += x.se * ma2[x.fi];
		}
		cout<<ans<<endl;
	}
}


signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(20);
    mainmain();
}

Measured memory_bytes: 34296
#include <iostream>
#include <cmath>
#include <algorithm>
#include <string> //文字列
#include <iomanip> //doubleの桁数指定 setprecision()
#include <list> //前後に数値を入れれる配列
#include <map> //map
#include <vector> //vecror

#define REP(i,m,n) for(ll i = (ll) (m);i < (ll) (n);i++) //forの短縮
#define rep(i,n) REP(i,0,n) //REPが0の時
#define ll long long int

using namespace std;

double PI = acos(-1); //円周率
ll mod = 1e9 + 7;


//提出コード↓

ll n,cou, a[200010],b[200010];

int main() {
	cin >> n;
	REP(i,1, n + 1) cin >> a[i];

	for(int i = n;i > 0;i--){
		ll j = i;
		ll c = 0;
		while (j <= n) {
			c += b[j];
			j += i;
		}
		if (c % 2 != a[i]){
			b[i] = 1;
			cou++;
		}
	}
	cout << cou << endl;
	REP(i, 1, n + 1) {
		if (b[i]) {
			cout << i << endl;
		}
	}
	cout << endl;

	return 0;
}



Measured memory_bytes: 3968
#include<bits/stdc++.h>
#define re          return
#define pb          push_back
#define mp          make_pair
#define pii         pair<int,int>
#define vi          vector<int>
#define all(a)      (a).begin(),(a).end()
#define ff           first
#define ss           second
#define hell        1000000007
#define endl        '\n'
#define rep(i,a,b)  for (__typeof(b) i=(a)-((a)>(b));i!=(b)-((a)>(b));i+=1-2*((a)>(b)))
#define PI            3.141592653589793l
#define fill(c,val) memset(c,val,sizeof(c))
#define sz(x)       (int)x.size()
#define LB lower_bound
#define UB upper_bound
#define inf 1e9
#define bsa(v,n,a) binary_search(v,v+n,a)
#define bsv(v,a) binary_search(v.begin(),v.end(),a)
using namespace std;
typedef long long ll;
const ll INF=(1LL<<60)-1;
ll const nax=1e5+20;
int main(){
	    int t=1;
	//	cin>>t;
	while(t--){
		  string s; cin>>s;
		  int k; cin>>k;
		  vector<char> v;
		  for(int i=0;i<sz(s);i+=k){
		  	v.pb(s[i]);
		  }
		  rep(i,0,sz(v)) cout<<v[i];
		 cout<<endl;
  }
    return 0;
}

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

using namespace std;

int main()
{
	vector <pair<int, int> > yabashi;
	int n, m, a, b, weight;
	bool bl;

	while(1){
		bl = true;
		weight = 0;
		yabashi.clear();
		cin >> n;

		if(n == 0)    break;

		for(int i = 0; i < n; i++){
			cin >> m >> a >> b;

			yabashi.push_back(make_pair(a, m));
			yabashi.push_back(make_pair(b, (-m)));
		}

		stable_sort(yabashi.begin(), yabashi.end());
		
		for(int i = 0; i < n*2; i++)
		{
			weight += yabashi[i].second;
			if(weight > 150){
				bl = false;
				break;
			}
		}

		if(bl == true)    cout << "OK" << endl;
		else      cout << "NG" << endl;
	}

	return 0;
}

Measured memory_bytes: 1204
#include<bits/stdc++.h>
using namespace std;
 
int main()
{
	int a,b,n,x;
	
	cin>>n>>a>>b;
	
	x=a*n;
	if(x>b)
	{
		cout<<b<<endl;
		return 0; 
	}
	else
	{
		cout<<x<<endl;
		return 0;
	}
}

Measured memory_bytes: 384
import math
a,b,x =map(int,input().split())
if x <= a*a*b/2:
    
    ans = math.atan(a*b*b/2/x)
    print(ans*180/math.pi)
else:
    ans = math.atan((a*a*b-x)*2/a/a/a)
    print(ans*180/math.pi)

Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
const int maxn=2011;
char s[maxn]; long long k; int n;
void init(){
    scanf("%s",s+1); cin>>k; n=strlen(s+1);
}
int f[maxn][maxn]; long long g[maxn][maxn];
void print(int a,int b){
//	cout<<endl<<"PRINT "<<a<<' '<<b<<endl;
	if (a>b) return;
    if (a==b){printf("%c",s[a]); return;}
    if (s[a]==s[b]){putchar(s[a]); print(a+1,b-1); putchar(s[b]); return;}
    if (f[a+1][b]+1==f[a][b] && f[a][b-1]+1!=f[a][b]){
        putchar(s[a]); print(a+1,b); putchar(s[a]); return;
    }
    if (f[a+1][b]+1!=f[a][b] && f[a][b-1]+1==f[a][b]){
        putchar(s[b]); print(a,b-1); putchar(s[b]); return;
    }
    if (s[a]<s[b]){
        if (g[a+1][b]<k){k-=g[a+1][b]; putchar(s[b]); print(a,b-1); putchar(s[b]);}
        else {putchar(s[a]); print(a+1,b); putchar(s[a]);}
        return;
    }
    if (g[a][b-1]<k){k-=g[a][b-1]; putchar(s[a]); print(a+1,b); putchar(s[a]);}
    else {putchar(s[b]); print(a,b-1); putchar(s[b]);}
}
void work(){
	memset(f,63,sizeof(f));
	memset(g,0,sizeof(g));
	for (int i=1;i<=n;++i) f[i][i-1]=0,g[i][i-1]=1;
	for (int i=1;i<=n;++i) f[i][i]=0,g[i][i]=1;
    for (int len=2;len<=n;++len) for (int i=1;i<=n;++i){
        int j=i+len-1; if (j>n) break;
        if (s[i]==s[j]) f[i][j]=f[i+1][j-1],g[i][j]=g[i+1][j-1];
        else{
            int tmp=min(f[i+1][j],f[i][j-1]);
            if (f[i+1][j]==tmp) g[i][j]+=g[i+1][j];
            if (f[i][j-1]==tmp) g[i][j]+=g[i][j-1];
            f[i][j]=tmp+1; if (g[i][j]>k) g[i][j]=k+1;
		}
//        cout<<i<<' '<<j<<' '<<f[i][j]<<' '<<g[i][j]<<endl;
    }
	if (g[1][n]<k) puts("NONE"); else print(1,n),putchar('\n');
}
int main(){
//	freopen("G.in","r",stdin); freopen("G.out","w",stdout);
    init();
    work();
    return 0;
}

Measured memory_bytes: 48652
#include<bits/stdc++.h>
using namespace std;
int k,i= -1;
vector<long long> vec = {};
void dfs(long long x,int a){
    vec.push_back(x);
    if(x > 10000000000) return;
    if(x == 0){
        for (int j = 1; j < 10; j++)
        {
            dfs(j,j);
        }
    }
    else{
        if(a != 0 && a!= 9){
            dfs(10*x + a-1,a-1);
            dfs(10*x + a,a);
            dfs(10*x + a+1,a+1);
        }
        if(a == 0) {
            dfs(10*x + 0,0);
            dfs(10*x + 1,1);
        }
        if(a == 9) {
            dfs(10*x + 8,8);
            dfs(10*x + 9,9);
        }
    }
}

int main(){
    cin >> k;
    dfs(0,0);
    sort(vec.begin(),vec.end());
    cout << vec[k] << endl;
}


Measured memory_bytes: 11600
//abc128_b.cpp
//Sun May 26 20:47:19 2019

#include <iostream>
#include <string>
#include <queue>
#include <map>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <math.h>
#include <set>
#define INTINF 2147483647
#define LLINF 9223372036854775807
using namespace std;
using ll=long long;
typedef pair<string,int> P;

bool compare_by_b(P a, P b) {
    if(a.first != b.first){
        return a.first < b.first;
    }else{
        return a.second > b.second;
    }
}
int main(){
	int n;
	cin >> n;

	vector<P> p;
	vector<P> p2;
	for (int i=0;i<n;i++){
		string a;
		int b;
		cin >> a >> b;
		P temp = make_pair(a,b);
		p.push_back(temp);
		P temp2 = make_pair(a,b);
		p2.push_back(temp2);
	}

	sort(p.begin(),p.end(),compare_by_b);
//	sort(p.begin(),p.end());
//	vector<P> thep;
//	for (int i=0;i<n;i++){
//		string x = p[i].second;
//		int y = p[i].first;
//		P temp = make_pair(x,y);
//		thep.push_back(temp);
//	}

//	sort(thep.begin(),thep.end());
//	for (int i=0;i<n;i++){
//		cout << p[i].first << p[i].second << endl;
//	}	

	for (int i=0;i<n;i++){
		for (int j=0;j<n;j++){
			if (p2[j].first==p[i].first && p2[j].second==p[i].second){
				cout << j+1 << endl;
			}
		}
	}

//	printf("%.4f\n",ans);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const unsigned int MOD = 1000000007;
#define ll long long
#define PI 3.1416
string day[]={"SUN","MON","TUE","WED","THU","FRI","SAT"};
int main() {
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    int a,b,c;
    while(cin>>a>>b>>c){
        int rs=a*100+b*10+c;
        if(rs%4==0)cout<<"YES"<<endl;
        else cout<<"NO"<<endl;
    }
    return 0;
}


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

using namespace std;


//repetition
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define euc_dis(x, y) sqrt(x*x + y*y)

#define pb push_back
#define mp make_pair
#define INF 999999999
#define sp ' '
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()

int gcd(int a,int b){return b?gcd(b,a%b):a;}
void Yes(){cout << "Yes" << endl;}
void No(){cout << "No" << endl;}

template<typename T>
void ppp(T n){cout << n << endl;}

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


//typedef
typedef long long ll;
typedef pair<int, int> pint;
typedef vector<int> vint;
typedef vector<string> vstr;



vector<string> split(const string &str, char sep)
{
    vector<string> v;
    stringstream ss(str);
    string buffer;
    while( getline(ss, buffer, sep) ) {
        v.pb(buffer);
    }
    return v;
}




int main(){

    cin.tie(0);
    ios::sync_with_stdio(false);

    int n, k;
    cin >> n >> k;
    if(n%k  == 0){
        cout << 0 << endl;
        
    }
    else{
        cout << 1 << endl;
    }







    return 0;
}


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

int main() {
	int n; cin >> n;
	int ans = 0;
	vector<int> p(n);
	for (int i = 0; i < n; i++) {
		cin >> p[i];
	}

	for (int i = 0; i < n - 2; i++) {
		if (p[i + 1] != min({ p[i],p[i + 1],p[i + 2] }) && p[i + 1] != max({ p[i],p[i + 1],p[i + 2] })) {
			ans++;
		}
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
using namespace std;
typedef unsigned int uint;
uint maxv;
void solve(uint now,uint m,uint *a,int n){
  int r=n-1,l=0,mid;
  while(l <=r){
    mid = (l+r)/2;
    if ( a[mid]+now>m)r=mid-1;
    else if ( a[mid]+now <=m){
      if ( a[mid]+now >maxv)maxv=a[mid]+now;
      l=mid+1;
    }
    //else break;
  }
  //if ( now+a[mid]>maxv&& now+a[mid]<=m)maxv=now+a[mid];
}


main(){
  int n;
  uint m;
  while(scanf("%d%u",&n,&m) && n){
    uint one[n];
    uint two[n*n];
    int p=0;
    maxv=0;
    for(int i=0;i<n;i++)scanf("%u",&one[i]);
    for(int i=0;i<n;i++){
      if ( one[i]>maxv &&one[i] <=m)maxv=one[i];
      for(int j=i;j<n;j++){
	if ( one[i]+one[j]>m)continue;
	two[p++]=one[i]+one[j];
	if (two[p-1]>maxv)maxv=two[p-1];
      }
    }
    sort(one,one+n);
    sort(two,two+p);
    for(int i=0;i<p;i++){
      if ( two[i]+one[0]>m)break;
            if ( two[i]+two[0]<=m)solve(two[i],m,two,p);
	    if ( two[i]+one[0]<=m)solve(two[i],m,one,n);
    }
    printf("%u\n",maxv);
  }
  return false;
}

Measured memory_bytes: 3052
# -*- coding: utf-8 -*-
n = int(input())
numlist = list(map(int, input().split()))
dic = {}
for num in numlist:
  if num not in dic:
    dic[num] = 1
  else:
    dic[num] += 1
    
tmpsum = 0
for value in dic.values():
  tmpsum += int(value*(value-1)/2)
ansdic = {}
for key in dic.keys():
  n = dic[key]
  ansdic[key] = tmpsum - n + 1      
    
for num in numlist:
  print(ansdic[num])

Measured memory_bytes: 34720
#include<bits/stdc++.h>
#define ll long long
using namespace std;
signed main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	long double l;
	cin>>l;
	cout<<fixed<<setprecision(12);
	cout<<(l/3.0)*(l/3.0)*(l/3.0)<<"\n";
	return 0;
}

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

struct node {
  int id;
  struct node *next;
};

struct node **list;
int *indeg, *visit, *stack, sp;
void Insert(int, int);
void bfs(int, int);
int main(void)
{
  int i, v, e, s, t;
  scanf("%d %d", &v, &e);
  list = (struct node**)malloc(sizeof(struct node*) * v);
  indeg = (int*)calloc(v, sizeof(int));
  visit = (int*)calloc(v, sizeof(int));
  stack = (int*)malloc(sizeof(int) * v);
  for (i = 0; i < v; i++) list[i] = NULL;
  for (i = 0; i < e; i++) {
    scanf("%d %d", &s, &t);
    Insert(s, t);
  }
  for (i = 0; i < v; i++) {
    struct node *n;
    for (n = list[i]; n != NULL; n = n->next) indeg[n->id]++;
  }
  for (i = 0; i < v; i++) {
    if (!(indeg[i] || visit[i])) bfs(i, v);
  }
  for (i = 0; i < sp; i++) printf("%d\n", stack[i]);
  for (i = 0; i < v; i++) free(list[i]);
  free(list);
  free(indeg);
  free(visit);
  free(stack);
}
void Insert(int a, int b)
{
  struct node *p = (struct node*)malloc(sizeof(struct node));
  p->id = b;
  p->next=list[a];
  list[a] = p;
}
void bfs(int point, int size)
{
  int ptr_front = 0, ptr_back = 0, *queue = (int*)malloc(sizeof(int) * size);
  queue[ptr_back++] = point;
  visit[point] = 1;
  while (ptr_front != ptr_back) {
    int u = queue[ptr_front++];
    struct node *n;
    stack[sp++] = u;
    for (n = list[u]; n != NULL; n = n->next) {
      indeg[n->id]--;
      if (!(indeg[n->id] || visit[n->id])) {
        visit[n->id] = 1;
        queue[ptr_back++] = n->id;
      }
    }
  }
  free(queue);
}


Measured memory_bytes: 3296
#include <cstdio>
#include <iostream>
#include <vector>
#include <map>
#include<cmath>
#include<climits>
// #include<bits/stdc++.h>

using namespace std;
#define lli long long int
lli find_min(lli a , lli b) {if (a > b ) return b; return a;}

int main()
{
// #ifndef ONLINE_JUDGE
// 	freopen("input.txt" , "r" , stdin);
// 	freopen("output.txt" , "w" , stdout);
// #endif
	lli n, k; cin >> n >> k;
	n %= k;
	cout << find_min(n, k - n) << endl;
	return 0;
}

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

def solve(N: int, L: "List[int]"):
    L.sort()
    sum = 0

    for i in range(N-2):
        k = 0
        for j in range(i+1,N-1):
            tansum = L[i] + L[j]
            while k < len(L) and L[k] < tansum: k += 1
            if tansum <= L[j+1]:
                continue
#            sum=sum+bi.bisect_left(L[j+1:N+1],tansum)
            sum = sum + k - j - 1
    print(sum)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    L = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, L)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3188
#include<stdio.h>
int main()
{
	long long a,b,c,d,e;
	scanf("%lld %lld %lld",&a,&b,&c);
	if(c<=a+b)
		printf("No");
	else 
		{
	if(4*a*b<(c-a-b)*(c-a-b))
		printf("Yes");	
	else
		printf("No");	
		}
return 0;
 } 

Measured memory_bytes: 128