akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include<bits/stdc++.h>
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
#define pii std::pair<int,int>
#define pli std::pair<ll,int>
#define pil std::pair<int,ll>
#define psi std::pair<string,int>
#define pll std::pair<ll,ll>
#define pci std::pair<char,int>
#define sll(x) scanf("%lld",&x)
#define prll(x) printf("%lld ",x)
#define pri(x) printf("%d ",x)
#define si(x) scanf("%d",&x)
#define pb push_back
#define vll std::vector<ll>
#define vpi std::vector<std::pair<int,int>>
#define vi std::vector<int>
#define vvi std::vector<std::vector<int>>
#define vvpil std::vector<std::vector<std::pair<int,ll>>>
#define vlpii std::vector<std::list<pii>>
#define vlpil std::vector<std::list<pil>>
#define li std::list<int>
#define lpil std::list<pil>
#define Endl printf("\n")
#define vli vector<list<int>>
#define vvll vector<vector<ll>>
#define mp make_pair
#define ma 100000000
#define mod 1000000007
const ll  INF=10000000000000;
using namespace std;
ll dp[405][405] = {INF} ;

void add(ll& a , ll b){
    a += b ;
    a %= mod ;
}
void sub(ll& a , ll b){
    a -= b ;
    if(a<0) a += mod ;
}

int main()
{
    IOS ;
    int n ; cin >> n ;
    for(int i = 0 ; i < n ; i++ ) for( int j = 0 ; j < n ; j++ ) dp[i][j] = INF ;
    ll a[n] ;
    for(ll& x:a) cin >> x ;
    for(int i = n - 1 ; i >= 0 ; i-- ){
        ll sum = 0 ;
        for( int j = i ; j < n ; j++ ){
            sum += a[j] ;
           if(i == j ) dp[i][j] = 0 ;
            else if(j == i+1) dp[i][j] = a[i] + a[j] ;
            else{
                ll sum1 = sum , sum2 = 0;
                for(int k = j ; k > i  ; k--){
                    dp[i][j] = min(dp[i][j] , dp[i][k-1] + dp[k][j] + sum1 + sum2) ;
                    sum1 -= a[k] ;
                    sum2 += a[k] ;
                }
            }
        }
    }
    cout << dp[0][n-1] ;
    return 0;
}


Measured memory_bytes: 1536
#include<cstdio>
#include<algorithm>
using namespace std;
const int N=2e5+10;
typedef long long ll;
int n,k,a[N];ll sum[N],v[N];
void add(int p){
	for (p++;p<N;p+=p&-p) a[p]++;
}
int query(int p){
	int ans=0;
	for (p++;p;p-=p&-p) ans+=a[p];
	return ans;
}
int main()
{
	scanf("%d%d",&n,&k);
	for (int i=1;i<=n;i++){
		scanf("%lld",&sum[i]);
		v[i]=sum[i]=sum[i-1]+sum[i]-k;
	}
	sort(v,v+n+1);
	for (int i=0;i<=n;i++) sum[i]=lower_bound(v,v+n+1,sum[i])-v;
	add(sum[0]);
	ll ans=0;
	for (int i=1;i<=n;i++) ans+=query(sum[i]),add(sum[i]);
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 4096
#include<bits/stdc++.h>
using namespace std;
using ll =long long;
#define rep(i,N) for(int (i)=0;(i)<(N);++(i))
#define SORT(i) sort((i).begin(),(i).end())
constexpr ll INF = 2000000000;
constexpr ll mod = 1000000007;

int pow(int x) {
	if (x == 0)return 1;
	return pow(x - 1) * 100;
}

int main() {
	int D, N; cin >> D >> N;
	N = (N == 100) ? ++N : N;
	cout << pow(D) * N << "\n";

	return 0;
}

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

const int mxN = 2e5 + 2;
int n, nums[mxN], dp[mxN];

int main()
{
    cin >> n;
    for (int i = 0; i < n; i++)
        cin >> nums[i];
    dp[n - 1] = 0;
    dp[n - 2] = abs(nums[n - 1] - nums[n - 2]);
    for (int i = n - 3; i >= 0; i--)
    {
        dp[i] = min(dp[i + 1] + abs(nums[i + 1] - nums[i]), dp[i + 2] + abs(nums[i + 2] - nums[i]));
    }

    cout << dp[0] << endl;
}

Measured memory_bytes: 4324
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int k = sc.nextInt();
    sc.nextLine();
    String s = sc.nextLine();
    sc.close();
    if(s.length() <= k) {
      System.out.println(s);
    }else {
      System.out.println(s.substring(0, k) + "...");
    }
  }

}


Measured memory_bytes: 38452
#include <iostream>
#include <string>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
using namespace std;

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

int main(){
    string S;
    cin >> S;
    int N = (int)S.size();
    ll a[N+1] = {0};
    //左から、"<"の記号の成立を見る
    rep(i, N){
        if(S.at(i) == '<'){
            a[i+1] = max(a[i+1], a[i] + 1);
        }
    }
    //右から、">"の記号の成立を見る
    for(int i = N-1; i >= 0; i--){
        if(S.at(i) == '>'){
            a[i] = max(a[i], a[i+1] + 1);
        }
    }
    ll sum = 0;
    rep(i, N+1){
        sum += a[i];
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 4740
#include <cstdio>
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <algorithm>
using namespace std;

int main()
{
    char str[5];
    while(scanf("%s",str)==1)
    {
        int res=0;
        for(int i=0;str[i]!='\0';i++)
        {
            if(str[i]=='-')
                res--;
            else if(str[i]=='+')
                res++;
        }
        printf("%d\n",res);
    }
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pi 3.141592653589793238
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
ll MOD=1e9+7;

void solve()
{
	ll a,b,c,d;
	cin>>a>>b>>c>>d;
	cout<<max(a*b,c*d);
	return;
}
int main()
{
        fast;
        ll q;
        q=1;
        // cin>>q;
        while(q--)
        	solve();
        
        return 0;
}


Measured memory_bytes: 3636
log = console.log;

var stdin = require("fs").readFileSync("/dev/stdin", "UTF-8");
var lines = stdin.split("\n")
var N = Number(lines[0])
var Ws = lines[1].split(" ").map(Number)

var accumlate = []
Ws.forEach((v,i)=>{
  if(i===0){
    accumlate.push(v)
  }else {
    accumlate.push(v+accumlate[i-1])
  }
})

var sum = accumlate.slice(-1)
var diffs = []
accumlate.forEach((v)=>{
  diffs.push(Math.abs(sum - v*2));
})
log(Math.min(...diffs))

Measured memory_bytes: 21064
using System;
using System.Collections.Generic;
using static System.Console;

class Program {
    static void Main() {
        var N = NextInt();
        var L = new int[2 * N];
        for (var i = 0; i < L.Length; i++) {
            L[i] = NextInt();
        }
        Array.Sort(L);
        var ans = 0;
        for (var i = 0; i < N; i++) {
            ans += L[2 * i];
        }
        WriteLine(ans);
    }

    static int NextInt() {
        return int.Parse(NextString());
    }

    static string NextString() {
        var result = new List<char>();
        while (true) {
            int next = Read();
            if (next < 0)
                break;
            var nextChar = (char)next;
            if (!char.IsWhiteSpace(nextChar))
                result.Add(nextChar);
            else if (nextChar != '\r')
                break;
        }
        return string.Join("", result);
    }
}

Measured memory_bytes: 11220
#include <bits/stdc++.h>
using namespace std;
#define ll long long 
#define endl "\n"
#define pb push_back
#define f(i,n) for(i=0;i<n;i++)
#define F(i,a,b) for(i=a;a<=b;i++)
#define arr(a,n) for( i=0;i<n;i++)cin>>a[i];
#define fi first
#define se second
#define mp make_pair
#define mod 1000000007
#define YES cout<<"YES"<<endl;
#define Yes cout<<"Yes"<<endl;
#define NO cout<<"NO"<<endl;
#define No cout<<"No"<<endl;
#define yes cout<<"yes"<<endl;
#define no cout<<"no"<<endl;
#define vi vector<ll>
#define ed end()
#define bg begin()
#define sz size()
#define ln length()
#define s() sort(a,a+n);
#define sr() sort(a,a+n,greater<ll>());
#define v()  sort(v.begin(),v.end());
#define vr() sort(v.begin(),v.end(),greater<ll>());
#define mod 1000000007
#define fast() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
ll gcd(ll a, ll b){if(!b)return a;return gcd(b, a % b);}
ll power(ll x,ll y,ll p){ll res=1;x%=p;while(y>0){if(y&1)res=(res*x)%p;y=y>>1;x=(x*x)%p;}return res;}
int main() {
    #ifndef ONLINE_JUDGE
        // for getting input from input.txt
        freopen("input.txt", "r", stdin);
        // for writing output to output.txt
        freopen("output.txt", "w", stdout);
    #endif
        

fast();
//ll t;cin>>t;while(t--)
{
    string s;
    cin>>s;
    ll n=(ll)s.length(),ans=0;
    for(ll i=0;i<n;i++)
    {
      ans+=(s[i]-'0');
    }
    if(ans%9)
      No
    else
      Yes

}
return 0;
}

Measured memory_bytes: 3784
import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;

class Main {
    public static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    public static PrintWriter pw = new PrintWriter(System.out);
    public static String line;
    public static StringTokenizer st;
    public static ArrayList<ArrayList<Integer>> adjList;
    public static int[] dx = {-1, 0, 1, 0, -1, 1, 1, -1};
    public static int[] dy = {0, 1, 0, -1, 1, 1, -1, -1};
    public static int INF = 0x3f3f3f3f;
    public static long LINF = 0x3f3f3f3f3f3f3f3fL;
    public static int MOD = 1000000007;

    public static TreeMap<Pair, Integer> memo;
    public static int[] w, v;

    public static int solve(int item, int W){
        if(item >= w.length) return 0;
        Pair p = new Pair(item, W);
        if(memo.containsKey(p)) return memo.get(p);

        int best = solve(item+1, W);
        if(W >= w[item]){
            best = Math.max(best, solve(item+1, W-w[item]) + v[item]);
        }
        memo.put(p, best);
        return best;
    }

    public static void main(String[] args) throws Exception{
        st = new StringTokenizer(br.readLine());
        int N = Integer.parseInt(st.nextToken());
        int W = Integer.parseInt(st.nextToken());
        w = new int[N];
        v = new int[N];

        for(int i = 0; i < N; i++){
            st = new StringTokenizer(br.readLine());
            w[i] = Integer.parseInt(st.nextToken());
            v[i] = Integer.parseInt(st.nextToken());
        }

        memo = new TreeMap<Pair, Integer>();
        pw.print(solve(0, W) + "\n");

        pw.close(); 
        br.close();
    }
}

class Pair implements Comparable<Pair>{
    public int x, y;

    Pair(int x, int y){
        this.x = x;
        this.y = y;
    }

    public int compareTo(Pair p){
        if(x != p.x) return x < p.x ? -1 : 1;
        else if(y != p.y) return y < p.y ? -1 : 1;
        return 0;
    }
}

Measured memory_bytes: 37348
#include <iostream>
#include <iomanip>
#include <fstream>
#include <string>
#include <array>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <queue>
#include <bitset>
#include <tuple>
#include <cmath>
#include <complex>
#include <algorithm>
#include <utility>
#include <regex>
#include <cstdint>
#include <numeric>
#include <functional>
#include <cassert>

using namespace std;
using ll = int64_t;
using ull = uint64_t;

constexpr ll INF = 1000000000;/* 1e+9a */

void solve(istream &cin) {
    ll N, M;
    cin >> N >> M;
    if(!cin) return;
    vector<pair<ll, ll>> AB;
    for (int i = 0; i < N; ++i) {
        int a, b;
        cin >> a >> b;
        AB.push_back({a, b});
    } // end i
    sort(AB.begin(), AB.end());
    ll ans = 0;
    ll buy = 0;
    for (auto &&ab : AB) {
        if(ab.second + buy < M){
            buy += ab.second;
            ans += ab.second*ab.first;
        }
        else{
            ans += (M - buy) * ab.first;
            break;
        }
    } // end ab
    cout << ans << endl;

}

int main(int argc, char *argv[]) {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << setprecision(16) << scientific;
#ifdef DEBUG
    cerr << "DEBUG MODE" << endl;
    string test_cases = "test.txt";
    auto fs = fstream(test_cases, fstream::in);
    while(fs) {
        solve(fs);
    }
#else
    solve(cin);
#endif
    return 0;
}


Measured memory_bytes: 2420
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <functional>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <cassert>
#include <exception>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<P> vp;
#define rep(i,a,n) for(ll i = (a);i < (n);i++)
#define per(i,a,n) for(ll i = (a);i > (n);i--)
#define lep(i,a,n) for(ll i = (a);i <= (n);i++)
#define pel(i,a,n) for(ll i = (a);i >= (n);i--)
#define clr(a,b) memset((a),(b),sizeof(a))
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(),(c).end()
#define sz size()
#define print(X) cout << (X) << endl
const ll INF = 1e+9+7;
ll n,m,l;
string s,t;
ll d[200010],dp[500][500];
vll start,goal;

int main(){
  ll x,y;
  ll a[200001],b[200001];
  clr(a,0); clr(b,0);
  cin >> n >> m;
  rep(i,0,m){
    cin >> x >> y;
    if(!(x == 1 && y == n)){
      if(x == 1)a[y]++;
      else if(y == n)b[x]++;
    }
  }
  s = "IMPOSSIBLE";
  rep(i,0,200001)if(a[i] != 0 && b[i] != 0)s = "POSSIBLE";
  print(s);
  return 0;
}

Measured memory_bytes: 3328
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.*;


public class Main {
	
	public static class FastReader {
		BufferedReader br;
		StringTokenizer st;
	

		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st == null || !st.hasMoreTokens()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (Exception r) {
					r.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());//converts string to integer
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

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

		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (Exception r) {
				r.printStackTrace();
			}
			return str;
		}
	}
	
	public static PrintWriter out = new PrintWriter (new BufferedOutputStream(System.out));
    public static long mod = (long) (1e9+7);
    public final static int MAX = (int) 90000000;
  // static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
	   
	 FastReader sc = new FastReader();
	int a = sc.nextInt(),b = sc.nextInt(),c = sc.nextInt();
	if(a+b>=c)
		out.print(b+c);
	else {
		out.print(a+2*b+1);
	}
	 out.close();
		
	}

}

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


using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0; i<int(n); i++)
#define FOR(i,m,n) for(int i=int(m); i<int(n); i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define VI vector<int>
#define VLL vector<long long>
#define VVI vector<vector<int>>
#define VVLL vector<vector<long long>>
#define VC vector<char>
#define VS vector<string>
#define VVC vector<vector<char>>
#define VB vector<bool>
#define VVB vector<vector<bool>>
#define fore(i,a) for(auto &i:a)

typedef pair <int, int> P;
template<class T> bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
const int  INF = 1 << 30;
const ll INFL = 1LL << 60;
const ll mod = 1000000007;




int main() {
	

	string s;
	cin >> s;
	if (s == "Sunny")cout << "Cloudy" << endl;
	else if (s == "Cloudy")cout << "Rainy" << endl;
	else cout << "Sunny" << endl;
}

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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, r;
  cin >> n >> r;
  if (n < 10) {
    cout << r + 100 * (10 - n) << '\n';
  } else {
    cout << r << '\n';
  }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define MD 1000000007
typedef long long int ll;
typedef pair<ll, ll> P;
template <typename T>
std::string tostr(const T &t){std::ostringstream os;os << t;return os.str();}
int dx[4]={1, 0, -1, 0}, dy[4]={0, 1, 0, -1};

int main()
{
    int n,k;
    cin>>n>>k;
    cout<<n-k+1<<endl;
    return 0;
}

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

t = 0
0.upto(n-2) do |i|
    t += (x[i+1] - x[i]) * a < b ? (x[i+1] - x[i]) * a : b
end

puts t

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

int main() {
    int n;
    cin >> n;
    vector<int> R(n);
    for(int i=0;i<n;i++){
        cin >> R.at(i);
    }
    int Max=R.at(1)-R.at(0);
    int Min=R.at(0);
    for(int j=1;j<n;j++){
        Max = max(Max,R.at(j)-Min);
        Min = min(Min,R.at(j));
    }
    cout << Max << endl;
}



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

using namespace std;

int main()
{
    int odp = 700;
    int ad = 100;
    string a;
    cin>>a;

    for(int i = 0; i < 3; i++)
    {

        if(a[i] == 'o')
        {
            odp+=ad;
        }

    }
    cout<<odp;
    return 0;
}


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

int main(){
    ll N;
    ll x;
    cin >> N >> x;
    vector<ll> a(N), b(N);
    ll ans = 0;
    for (ll i = 0; i < N; i++) {
        cin >> a[i];
        b[i] = a[i];
        ans += a[i];
    }
    
    for (ll i = 1; i < N; i++) {
        ll sum = 0;
        for (int j = 0; j < N; j++) b[j] = min(b[j], a[(j-i+N)%N]);
        for (int j = 0; j < N; j++) sum += b[j];
        ans = min(ans, sum+x*i);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 384
#include <stdio.h>

int main(void)
{
    int a, b, c, tmp;

    scanf(" %d %d %d", &a, &b, &c);

    if (a > b){
        tmp = a;
        a = b;
        b = tmp;
    }
    if (b > c){
        tmp = b;
        b = c;
        c = tmp;
    }
    if (a > b){
        tmp = a;
        a = b;
        b = tmp;
    }

    printf("%d %d %d\n", a, b, c);

    return 0;
}

Measured memory_bytes: 596
#!/usr/bin/env python3
N, K = map(int, input().split())
a = list(map(int, input().split()))

pl = [(x if (x > 0) else 0) for x in a]
s = sum(pl)
sk_a = [sum(a[:K])]
sk_pl = [sum(pl[:K])]
for i in range(1, N - K + 1):
    sk_a.append(sk_a[-1] - a[i - 1] + a[K + i - 1])
    sk_pl.append(sk_pl[-1] - pl[i - 1] + pl[K + i - 1])

ans = 0
if lambda x: x > 0 in a:
    for i in range(N - K + 1):
        ans = max(ans, s - sk_pl[i] + max(0, sk_a[i]))

print(ans)


Measured memory_bytes: 16744
s=input()
cnt=0
if s.count("A")==2:
    cnt+=1
if s.count("B") == 2:
    cnt += 1
if s.count("C")==2:
    cnt+=1
if s.count("D") == 2:
    cnt += 1
if s.count("E")==2:
    cnt+=1
if s.count("F") == 2:
    cnt += 1
if s.count("G")==2:
    cnt+=1
if s.count("H") == 2:
    cnt += 1
if s.count("I")==2:
    cnt+=1
if s.count("J") == 2:
    cnt += 1
if s.count("K")==2:
    cnt+=1
if s.count("L") == 2:
    cnt += 1
if s.count("M")==2:
    cnt+=1
if s.count("N") == 2:
    cnt += 1
if s.count("O")==2:
    cnt+=1
if s.count("P") == 2:
    cnt += 1
if s.count("Q")==2:
    cnt+=1
if s.count("R") == 2:
    cnt += 1
if s.count("S") == 2:
    cnt += 1
if s.count("T") == 2:
    cnt += 1
if s.count("U")==2:
    cnt+=1
if s.count("V") == 2:
    cnt += 1
if s.count("W") == 2:
    cnt += 1
if s.count("X") == 2:
    cnt += 1
if s.count("Y") == 2:
    cnt += 1
if s.count("Z") == 2:
    cnt += 1

if cnt==2:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3064
#pragma GCC optimize(2)
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int MAXN=1e5+10;
const int N=4000;
struct node{
	ll x,y;
};
node a[MAXN];
ll prime[MAXN],s[MAXN],s1[MAXN];
bool p[MAXN];
int n,len;
map<ll,int>mp;
void init()
{
	for (int i=2;i<=N;i++) {
		if (!p[i]) {
			p[i]=1; prime[++len]=i;
		}
		for (int j=1;j<=len&&prime[j]*i<=N;j++) {
			p[prime[j]*i]=1;
			if (i%prime[j]==0) break;
		}
	}
}
ll sqr(ll x){
	return x*x;
}
void pan(ll x,int now){
	ll ans1=1;
	ll ans2=1;
	for (register int i=1;i<=len&&prime[i]*prime[i]<=x;i++) 
	if (x%prime[i]==0)
	{
        int sum=0;
        while (x%prime[i]==0) {
        	x/=prime[i]; sum++;
        }
        sum=(sum%3);
        for (int j=1;j<=sum;j++) ans1*=(ll)prime[i];
        for (int j=1;j<=(3-sum)%3;j++) ans2*=(ll)prime[i];
	}
    if (x>1) {
    	ans1*=x;
    	if (sqr(floor(sqrt(x)))==x) {
    		ans2*=floor(sqrt(x));
    	} 
    	else if (sqr(ceil(sqrt(x)))==x) {
    		ans2*=ceil(sqrt(x));
    	}
    	else {
    		if (x>MAXN) ans2=0; else ans2*=(x*x);
     	}
    }
    a[now].x=ans1; a[now].y=ans2;
}
bool cmp(node x,node y)
{
	return x.x<y.x;
}
int main()
{
	scanf("%d",&n);
	init();
	for (int i=1;i<=n;i++) {
		scanf("%lld",&s[i]);
		pan(s[i],i);
		mp[a[i].x]++;
	}
	sort(a+1,a+n+1,cmp);
	int ans=0;
	for (int i=1;i<=n;i++) 
		if (a[i].x!=1) 
			if (a[i].x!=a[i-1].x) {
				ans+=max(mp[a[i].x],mp[a[i].y]);
				mp[a[i].x]=0; mp[a[i].y]=0;
			}
	if (a[1].x==1) ans++;	
	cout << ans << endl;
}

Measured memory_bytes: 12928
n,m,k=map(int,input().split())
arr1=list(map(int,input().split()))
arr2=list(map(int,input().split()))

acum1=[0]
for i in range(n):
  acum1.append(acum1[-1]+arr1[i])
acum2=[0]
for i in range(m):
  acum2.append(acum2[-1]+arr2[i])
ans=0
j=m
for i in range(n+1):
  if acum1[i]>k:
    break
  while acum2[j]>k-acum1[i] and j>0:
    j-=1
  ans=max(ans,i+j)
print(ans)

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

using namespace std;

#define INF 1001000100010001000
#define MOD 1000000007
#define EPS 1e-10
#define int long long
#define rep(i, N) for (int i = 0; i < N; i++)
#define Rep(i, N) for (int i = 1; i < N; i++)
#define For(i, a, b) for (int i = (a); i < (b); i++)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define i_i pair<int, int>
#define vi vector<int>
#define vvi vector<vi >
#define vb vector<bool>
#define vvb vector<vb >
#define vp vector< i_i >
#define all(a) (a).begin(), (a).end()
#define Int(x) int x; cin >> x;
#define int2(x, y) Int(x); Int(y);
#define int3(x, y, z) Int(x); int2(y, z);
#define fir first
#define sec second
#define ffir first.first
#define fsec first.second
#define sfir second.first
#define ssec second.second
#define Decimal fixed << setprecision(10)

//int dxy[5] = {0, 1, 0, -1, 0};
// cmd

int n;
int data[3001];
int dp[3001][3001];

int mmnmm(int st, int en, bool turn)
{
    if (dp[st][en] != INF) return dp[st][en];
    if (st == en) {
      int tmp = 1; 
      if (!turn) tmp = -1;
      return dp[st][en] = data[st] * tmp;
    }
    if (turn) {
        return dp[st][en] = max(data[st] + mmnmm(st+1, en, !turn), 
            data[en] + mmnmm(st, en-1, !turn));
    } else {
        return dp[st][en] = min(-data[st] + mmnmm(st+1, en, !turn), 
            -data[en] + mmnmm(st, en-1, !turn));
    }
}

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

    cin >> n;
    rep(i, n) {
        cin >> data[i];
    }

    rep(i, n) {
        rep(j, n) {
            dp[i][j] = INF;
        }
    }

    cout << mmnmm(0, n-1, true) << endl;

    return 0;
}


Measured memory_bytes: 70784
#import <stdio.h>
#define rep(i, n) for (int i = 0, i##_len = (int)(n); i < i##_len; i++)
int main() {
    int n, k;
    char s[11];
    scanf("%d %s %d", &n, s, &k);
    char t = s[k - 1];
    rep(i, n) printf("%c", s[i] == t ? t : '*');
    puts("");
}


Measured memory_bytes: 2164
#-*-coding:utf-8-*-
import math

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def main():
    n, p = map(int, input().split())
    a_list = list(map(int, input().split()))
    odd = 0
    even = 0
    ans = 1
    for a in a_list:
        if a % 2 == 0:
            even += 1
        else:
            odd += 1
    all_cnt = 0
    for i in range(n+1):
        all_cnt += combinations_count(n, i)
    odd_cnt = 0
    for i in range(0, odd+1, 2):
        odd_cnt += combinations_count(odd, i)
    even_cnt =0
    for i in range(even+1):
        even_cnt += combinations_count(even, i)
    if p == 0:
        ans = odd_cnt * even_cnt
    else:
        ans = all_cnt - odd_cnt * even_cnt
    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 3064
#include<stdio.h>
#include<string.h>

int H,W,N,i,j,c,M[1005][1005],dp[1005][1005],y,x,f;

int main()
{
	for(;scanf("%d%d%d",&H,&W,&N),H+W+N;)
	{
		memset(dp,0,sizeof(M));
		for(i=0;i<H;i++)
			for(j=0;j<W;j++)
				scanf("%d",&M[i][j]);
		dp[0][0]=N;
		for(i=0;i<H;i++)
			for(j=0;j<W;j++)
			{
				if(dp[i][j]%2)
				{
					dp[i][j+1]+=dp[i][j]/2+(M[i][j]==1?1:0);
					dp[i+1][j]+=dp[i][j]/2+(M[i][j]==0?1:0);
				}
				else
				{
					dp[i+1][j]+=dp[i][j]/2;
					dp[i][j+1]+=dp[i][j]/2;
				}
			}
			for(y=0,x=0;y!=H&&x!=W;)
			{
				if(dp[y][x]%2==0)M[y][x]^=1;
				M[y][x]?x++:y++;
			}
		printf("%d %d\n",y+1,x+1);
	}
	return 0;
}

Measured memory_bytes: 8496
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
using namespace std;
#define REP(i,b,n) for(int i=b;i<n;i++)
#define rep(i,n)   REP(i,0,n)
#define ALL(C)     (C).begin(),(C).end()

typedef long long ll;

bool bt(int n,int now,int *inp,int *vol);

set<ll> D[100];
bool distribute(int n,int now,int *inp,int *vol){
  if (vol[now] == 0)return bt(n,now+1,inp,vol);

  ll state = 0;
  REP(i,now,n){
    state=(state<<1);
    if (vol[i] == inp[i])state++;
  }
  
  if (D[now].find(state) != D[now].end())return false;
  D[now].insert(state);
  if (vol[now] == 0)return false;



  REP(i,now+1,n){
    if (vol[i] != 0)continue;
    if (vol[now]-inp[i] < 0)continue;
    if (i-1 >= now+1 && inp[i-1] == inp[i] && vol[i-1] == 0)continue;
    vol[now]-=inp[i];
    vol[i]=inp[i];
    if (distribute(n,now,inp,vol))return true;
    vol[i]=0;
    vol[now]+=inp[i];
  }
  return false;
}


bool bt(int n,int now,int *inp,int *vol){
  if (now == n){
    return true;
  }
  if (vol[now] == 0)return false;
 

  //through
  if (bt(n,now+1,inp,vol))return true;

  //distribute
  if (distribute(n,now,inp,vol))return true;
  return false;
}

main(){
  int n;
  while(cin>>n && n){
    int in[n];
    int vol[n];
    vector<int> a;
    rep(i,n){
      cin>>in[i];vol[i]=0;a.push_back(in[i]);
      D[i].clear();
    }
    sort(in,in+n,greater<int>());
    sort(ALL(a));
    vol[0]=in[0];
    if (bt(n,0,in,vol) == true)puts("YES");
    else puts("NO");
  }
  return false;
}

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

long long n, k, a, b, ans;

int main() {
	scanf("%lld%lld", &n, &k);
	k *= k;
	for (int i = 1; i <= n; i++) {
		scanf("%lld%lld", &a, &b);
		if (a * a + b * b <= k) {
			ans++;
		}
	}
	cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3656
#include <iostream>

int main(){
    std::string s;
    std::cin >> s;
    int max = 0;
    int current = 0;
    for(char c : s){
        switch (c) {
        case 'A':
        case 'T':
        case 'G':
        case 'C':
            current++;
            max = std::max(max, current);
            break;
        default:
            current = 0;
            break;
        }
    }
    std::cout << max << std::endl;
}


Measured memory_bytes: 384
n=int(input())
w=list(map(int,input().split()))
ls=[]
for i in range(n):
  ls.append(sum(w[:i]))
  if ls[i]>sum(w)/2:
    break
ans=min(abs(sum(w)-2*ls[-1]),abs(sum(w)-2*ls[-2]))
print(ans)

Measured memory_bytes: 3060
#include<iostream>
#include<cmath>
#include<string>
#include<map>
#include<queue>
using namespace std;
#define N 3
#define N2 9

struct Puzzle{
int f[N2];
int space;
string path;

bool operator < (const Puzzle &p)const{
for(int i=0;i<N2;i++){
if(f[i]==p.f[i])continue;
return f[i]>p.f[i];
}
return false;
}
};

static const int dx[4]={-1,0,1,0};
static const int dy[4]={0,-1,0,1};
static const char dir[4]={'u','l','d','r'};

bool isTarget(Puzzle p){
for(int i=0;i<N2;i++)
if(p.f[i]!=(i+1))return false;
return true;
}
string bfs(Puzzle s){
queue<Puzzle>Q;
map<Puzzle,bool>V;
Puzzle u,v;
s.path="";
Q.push(s);
V[s]=true;
while(!Q.empty()){
  u=Q.front();
  Q.pop();
  if(isTarget(u))return u.path;
  int sx=u.space/N;
  int sy=u.space%N;
  for(int r=0 ; r<4 ; r++){
    int tx=sx+dx[r];
    int ty=sy+dy[r];
    if(tx<0 || ty<0 || tx>=N || ty>=N)continue;
    v=u;
    swap(v.f[u.space], v.f[tx*N+ty]);
    v.space=tx*N+ty;
    if(!V[v]){
      V[v]=true;
      v.path+=dir[r];
      Q.push(v);
    }
  }
}
return "unsolvable";
}

int main(){
  Puzzle in;
  for(int i=0 ; i<N2 ; i++){
    cin >> in.f[i];
    if(in.f[i]==0){
    in.f[i]=N2;
    in.space=i;
    }
  }
  string ans=bfs(in);
  cout << ans.size() << endl;
  return 0;
}



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

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>

using namespace std;

long long dp[100010][4];
int get(string S) {
	int n = S.size(), MOD = 1000000007;
	memset(dp, 0, sizeof(dp));
	for(int i = n; i >= 0; --i){
		for(int j = 3; j >= 0; --j){
			if(i == n){
				dp[i][j] = (j == 3 ? 1 : 0);
			}else{
				dp[i][j] = dp[i+1][j] * (S[i] == '?' ? 3LL : 1LL);
				if(j < 3 && (S[i] == '?' || S[i] == "ABC"[j])){
					dp[i][j] += dp[i+1][j+1];
				}
				dp[i][j] %= MOD;
			}
		}
	}
	return dp[0][0];
}

class DWeLoveABC {
public:
	void solve(std::istream& in, std::ostream& out) {
		string s;
		in >> s;
		out << get(s) << '\n';
	}
};


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

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

int main(){
    long long n;cin>>n;
    vector<long long> lengths(n);for(int i=0;i<n;i++){cin>>lengths[i];}
    vector<long long> reducted;
    long long acc=0;
    for (auto l : lengths){
        acc+=l;
        reducted.push_back(acc);
    }
    long long half = acc / 2;

    long long range_1;
    long long range_2;
    long long target;
    bool flag = true;
    acc = 0;
    for (auto l : lengths){
        acc += l;
        if (flag){
            if (acc > half){
                target = l;
                range_1 = acc - l;
                flag = false;
                acc = 0;
            }
        }
    }
    range_2 = acc;

    long long smaller = min(range_1, range_2);
    long long bigger = max(range_1, range_2);
    cout << smaller + target - bigger << endl;

    return 0;

}

Measured memory_bytes: 3956
require 'prime'

class InputLine
  def self.to_s
    gets.chomp
  end

  def self.to_i
    InputLine.to_s.to_i
  end
  
  def self.to_f
    InputLine.to_s.to_f
  end

  def self.to_sa
    InputLine.to_s.split(' ')
  end

  def self.to_ia
    InputLine.to_sa.map(&:to_i)
  end
  
  def self.to_fa
    InputLine.to_sa.map(&:to_f)
  end
end

def main(argv)
  (n, p) = InputLine.to_ia

  q = 1
  p.prime_division.each do |b, e|
    q *= (b ** (e / n))
  end
  puts q.to_s
end

if self.to_s == 'main' then
  main(ARGV)
end

Measured memory_bytes: 4092
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file 
#include <ext/pb_ds/tree_policy.hpp> 
#include <functional> // for less 
#define pb push_back
#define For(i,s,e) for (ll i=(s); i<(e); i++)
#define Debug_array(a,n) for (ll i=(0); i<(n); i++) cout<<a[i]<<" "
#define Foe(i,s,e) for (ll i=(s); i<=(e); i++)
#define Fod(i,s,e) for (ll i=(s)-1; i>=(e); i--)
#define pii pair<ll,ll>
#define fi first
#define se second
#define endl "\n"
#define mp make_pair
#define big_prime 15486277
#define bigger_prime 179424697
#define biggest_prime 32416188691
//#define random_shuffle(indices.begin(), indices.end());
//std::random_device rd;
//std::mt19937 g(rd());
//std::shuffle(v.begin(), v.end(), g);
using namespace __gnu_pbds; 
using namespace std;
template <class T> ostream& operator << (ostream &os, const vector<T> &v) { for (T i : v) os << i << ' '; return os; }
template <class T> ostream& operator << (ostream &os, const set<T> &v) { for (T i : v) os << i << ' '; return os; }
template <class T, class S> ostream& operator << (ostream &os, const pair<T, S> &v) { os << v.first << ' ' << v.second; return os; }
// template <class T, class S> ostream& operator << (ostream &os, const unordered_map<T, S> &v) { for (auto i : v) os << '(' << i.first << "=>" << i.second << ')' << ' '; return os; }
 
#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <class Arg1> void __f(const char* name, Arg1&& arg1) { cerr << name << " : " << arg1 << endl; }
    template <class Arg1, class... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args) {
        const char* sep = strchr(names + 1, ',');
        cerr.write(names, sep - names) << " : " << arg1 << "  ";
        __f(sep + 1, args...);
    }
#else
#define trace(...) 0
#define _CRT_SECURE_NO_WARNINGS
#endif // ifndef ONLINE_JUDGE


typedef long long ll;
typedef tree<ll, null_type, less<ll>, rb_tree_tag,tree_order_statistics_node_update> ordered_set; 

#define Mod 1000000007
#define MAX 5002

int main(){
	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	cout<<setprecision(12)<<fixed;
	double a,b,x;cin>>a>>b>>x;
	double h = ((a*a*b-x)*2.0)/(a*a);

	double filled_height = x/(a*a);
	double ans;
	if(2.0*filled_height>=b){
		ans = atan(h/a);
	}else{
		double h = (2.0*x)/(a*b);
		ans = atan(b/h);
	}

	double pi = 2*acos(0);
	ans = (ans*180.0)/(pi);

	cout<<ans<<endl;































	
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;

int height[10];

int main(void)
{
	for(int i=0;i<10;i++){
		cin>>height[i];
	}
	for(int i=0;i<10;i++){
		int max=i;
		for(int j=i+1;j<10;j++){
			if(height[max]<height[j]){
				max=j;
			}
		}
		int tmp=height[i];
		height[i]=height[max];
		height[max]=tmp;
	}
	for(int i=0;i<3;i++){
		cout<<height[i]<<endl;
	}
}

Measured memory_bytes: 1160
#include<iostream>
#include<vector>
#include<map>
#include<string>
#include<stack>
#define INF 1000000
using namespace std;

string str;
int table[3];
stack<int> Stack;
int pos;

int opnot(int a){
  return 2 - a;
}

int opand(int a,int b){
  if(a>b)return b;
  else return a;
}

int opor(int a,int b){
  if(a>b)return a;
  else return b;
}

int formula(){
  if(str[pos]=='0' || str[pos]=='1' || str[pos]=='2'){
    return str[pos++]-'0';
  }else if(str[pos]=='P' || str[pos]=='Q' || str[pos]=='R'){
    return table[str[pos++]-'P'];
  }else if(str[pos]=='-'){
    pos++;
    return opnot(formula());
  }else if(str[pos]=='('){
    pos++;
    int ans=formula();
    if(str[pos] == '*'){
      pos++;
      int res = opand(ans,formula());
      pos++;
      return res;
    }else{
      pos++;
      int res = opor(ans,formula());
      pos++;
      return res;
    }
  }
}
int main(){
  int count;
  Stack.push(INF);
  while(cin>>str){
    if(str==".")break;
    count=0;
    for(int i=0;i<3;i++){
      for(int j=0;j<3;j++){
	for(int k=0;k<3;k++){
	  pos=0;
	  table[0]=i;
	  table[1]=j;
	  table[2]=k;
	  if(formula()==2) count++;
	}
      }
    }
    cout<<count<<endl;
  }
  return 0;
}

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

const char d[4]={'U','D','L','R'};

int main() {
  int sx,sy,tx,ty;
  cin>>sx>>sy>>tx>>ty;
  int dx=tx-sx,dy=ty-sy;
  vector<string> ans(4,"");
  rep(i,dy) ans[0]+='U';
  rep(i,dx) ans[0]+='R';
  ans[1]+='U';
  rep(i,dx+1) ans[1]+='L';
  rep(i,dy+1) ans[1]+='D';
  ans[1]+='R';
  rep(i,dx) ans[2]+='R';
  rep(i,dy) ans[2]+='U';
  ans[3]+='R';
  rep(i,dy+1) ans[3]+='D';
  rep(i,dx+1) ans[3]+='L';
  ans[3]+='U';
  rep(i,4) cout<<ans[i];
  cout<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
    string s;
    cin >> s;
    int a = 0, b= 0;
    for(int i = 0; i < 3; i++)
    {if(s[i] == 'A')
        a++;
    else
        b++;}
    if(a > 0 && b > 0)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}

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

using namespace std;

#define FOR(i,k,n) for(int i = (k); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define INF 114514810
#define ELEM(array) (sizeof (array)/sizeof *(array))
#define MAX_N 100
#define SAFE_FREE(ptr) if( ptr != NULL ){ free(ptr); ptr = NULL; }
typedef unsigned int UINT;
typedef long long ll;

int main()
{
	int n, a[1005];
	while (1)
	{
		cin >> n; if (n == 0){ break; }
		REP(i, n)cin >> a[i];
		int cnt = 0;
		REP(i, n - 1)REP(j, n - 1)
		{
			if (a[j]>a[j+1])
			{
				swap(a[j], a[j + 1]);
				cnt++;
			}
		}
		cout << cnt << endl;
	}
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep1(i, n) for(int i = 1; i < n+1; i++)
#define sort(A) sort(A.begin(),A.end())
#define reverse(A) reverse(A.begin(),A.end());
typedef long long ll;

int main(){
  int n;
  cin >> n;
  vector<vector<bool>> f(n,vector<bool>(10));
  rep(i,n) rep(j,10){
    bool tmp;
    cin >> tmp;
    f[i][j] = tmp;
  }
  vector<vector<int>> p(n,vector<int>(11));
  rep(i,n) rep(j,11) cin >> p[i][j];
  int ans = -1000000000;
  rep(i,pow(2,10)){//i...場合分け
    if(i == 0)continue;
    int ksum = 0;
    rep(k,n){//k...どの店との比較？
      int jsum = 0;
      rep(j,10){//j...それぞれの桁
        bool bit = (i>>j)&1;
        if(bit && f[k][j]) jsum ++;
      }//j
      ksum += p[k][jsum];
    }//k
    ans = max(ans,ksum);
  }//i
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <bitset>
#include <cmath>
#include <map>
#include <algorithm>
#include <queue>
#include <chrono>
#include <array>
#include <random>
#include <fstream>
#include <list>
typedef int long long ll;

using int64 = long long;
using namespace std;

int W, H;
char mas[500][500];
int min_cost[500][500];

int main(){
    
    ll n;
    cin>>n;
    ll pret=0;
    ll prex=0,prey=0;
    while(n>0){
        ll t,a,b;
        cin>>t>>a>>b;
        ll kyori=abs(a-prex+b-prey);
        t=t-pret;
        if(kyori>t){
            cout<<"No"<<endl;
            return 0;
        }
        if(kyori%t==0&&kyori/t==1){
            
        }else if(kyori%t==0&&kyori/t>1){
            cout<<"No"<<endl;
            return 0;
        }else{
            kyori-=t;
            if(kyori%2!=0){
                cout<<"No"<<endl;
                return 0;
            }
        }
        
        n--;
    }
    cout<<"Yes"<<endl;
    
    
    
    
    
    
    return 0;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import sys

class YearNumberJudger:

    def __init__(self):
        self.input_num_list = []

    def input(self, num):
        self.input_num_list.append(num)

    def result(self):
        if len(self.input_num_list) != 4:
            return 'NO'
        input_map = {}
        for num in self.input_num_list:
            input_map[num] = True
        if 1 not in input_map:
            return 'NO'
        if 9 not in input_map:
            return 'NO'
        if 7 not in input_map:
            return 'NO'
        if 4 not in input_map:
            return 'NO'
        return 'YES'

year_number_judger = YearNumberJudger()
num_list = list(map(int,input().split()))

for num in num_list:
    year_number_judger.input(num)

print(year_number_judger.result())


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

#define rep(i,a,b) for (int64_t i = (a); i < (b); i++)
#define REP(i,n) rep(i,0,n)

void solve() 
{
    int n;cin>>n;
    vector<string>s(n);
    REP(i,n)cin>>s[i];
    sort(s.begin(),s.end());
    
    int tmp=1;
    vector<int>ans;
    rep(i,1,n){
        if(s[i-1]!=s[i]){ans.push_back(tmp);tmp=1;}
        else tmp++;
    }ans.push_back(tmp);
    
    auto res=unique(s.begin(),s.end());
    s.erase(res,s.end());

    int mx=0;
    REP(i,ans.size())mx=max(ans[i],mx);

    REP(i,s.size())if(ans[i]==mx)cout<<s[i]<<endl;
}

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

Measured memory_bytes: 13812
// G++ MACRO.CPP -STD=C++17
#include <bits/stdc++.h>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
using namespace std;

#define dump(x)  cout << #x << " = " << (x) << endl;
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) << endl
#define possible(n) cout << ((n) ? "possible" : "impossible"  ) << endl

#define SANKOU(n,a,b) cout << ((n) ? (#a) : (#b) ) << endl

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)

#define FOREACH(x,a) for(auto& (x) : (a) )

#define WFA(d,v) REP(k,v)REP(i,v)REP(j,v)d[i][j]=min(d[i][j],d[i][k]+d[k][j])

#define SCOUT(x) cout<<(x)<<" "
#define ENDL cout<<endl

#define VECCIN(x) for(auto&youso_: (x) )cin>>youso_
#define VECIN2(x,y) REP(i,x.size())cin>>x[i]>>y[i]
#define VECCOUT(x) if(1){for(auto tt=x.begin();tt!=x.end();tt++){if(tt!=x.begin())cout<<" ";cout<<(*tt);}cout<<endl;}

#define ALL(obj) (obj).begin(),(obj).end()

#define EXIST(n,x) (find(ALL(n),x)!=n.end())
#define UNIQUE(obj) sort(ALL( obj )); obj.erase(unique(ALL(obj)),obj.end())
#define EN(x) if(1){cout<<#x<<endl;return 0;}
#define COUT(x) cout<<(x)<<endl
void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail){
    cin>>head;
    CINT(move(tail)...);
}
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)

template <class T = ll>
T IN(){T x;cin>>x;return (x);}

template <class Head>
void VT(Head head){}
template <class Head,class Seco,class... Tail>
void VT(Head&& head,Seco&& seco,Tail&&... tail){
    seco.resize(head);
    VT(head,move(tail)...);
}
void VT2(){}
template <class Head,class... Tail>
void VT2(Head&& head,Tail&&... tail){
  VECCIN(head);
  VT2(move(tail)...);
}

template <class Head>
void VT3(Head&& head){}
template <class Head,class Seco,class... Tail>
void VT3(Head&& head,Seco&& seco,Tail&&... tail){
  seco[head]=IN();
  VT3(head,move(tail)...);
}

#define VC1(n,...) V __VA_ARGS__;VT(n,__VA_ARGS__);VT2(__VA_ARGS__); //aaabbbccc
#define VC2(n,...) V __VA_ARGS__;VT(n,__VA_ARGS__);REP(i,n)VT3(i,__VA_ARGS__); //abcabcabc

// #include <boost/multiprecision/cpp_int.hpp>
// using namespace boost::multiprecision; // cpp_int

#define P pair<int,int>
#define V vector<ll>
#define M map<int,int>
#define S set<int>

#define pb(a) push_back(a)
#define mp make_pair


int main(){

  SCIN(t);
  if(t == "zyxwvutsrqponmlkjihgfedcba")
    EN(-1);
  if(t.size()==26){

  REPR(i,25){
    string ss = t.substr(0,i);
    FOR(j,t[i] - 'a'+1,26){
      if(!count(ALL(ss),(char)j+'a')){
        cout<<ss << (char)(j+'a')<<endl;
        return 0;
      }
    }
  }
  }
 

  REP(i,26)
    if(!count(ALL(t),'a' + i)){
      cout<<t<<(char)('a' + i)<<endl;
      return 0;
    }
  EN(-1);



  return 0;
}


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

using namespace std;

typedef long long ll;

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

	int n;
	while(cin >> n)
	{
		int N = 3*n;
		vector<ll> v(N);
		for(int i=0; i<N; i++)
			cin >> v[i];
		sort(v.begin(),v.end());
		int big = N-2;
		ll sum = 0;
		for(int i=0; i<n; i++, big -= 2)
		{
			sum += v[big];
		}
		cout << sum << endl;
	}

	return 0;
}


Measured memory_bytes: 2560
import java.io.*;
public class Main{
	public static void main(String [] args) throws NumberFormatException, IOException{
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		String[] st=br.readLine().split(" ");
		int W=Integer.parseInt(st[0]);
		int H=Integer.parseInt(st[1]);
		int x=Integer.parseInt(st[2]);
		int y=Integer.parseInt(st[3]);
		int r=Integer.parseInt(st[4]);
		int con1=x+r;
		int con2=x-r;
		if(con1<=W&&con2>=0){
			con1=y+r;
			con2=y-r;
			if(con1<=H&&con2>=0)System.out.println("Yes");
			else System.out.println("No");
		}else System.out.println("No");
	}}

Measured memory_bytes: 17036
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main{ // 

	public static void main(String args[]) {
		ConsoleScanner cin = new ConsoleScanner();
		PrintWriter cout = new PrintWriter(System.out);
		solve(cin, cout);
		cout.flush();
	}

	static long now() {
		return System.currentTimeMillis();
	}

	static void trace(Object... objects) {
		assert null != System.out.format("trace:%s\n", Arrays.deepToString(objects));
	}

	private static void solve(ConsoleScanner cin, PrintWriter cout) {
		// assert solve(1) == 1;

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

		long start = now();

		long ans = solve(n, m);
		cout.println(ans);

		trace("elapsed", now() - start);
	}

	private static long solve(int n, int m) {
		return (n - 1) * (m - 1);
	}

	static class ConsoleScanner {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer("");

		String next() {
			try {
				while (!st.hasMoreElements())
					st = new StringTokenizer(br.readLine());
				return st.nextToken();
			} catch (IOException e) {
				throw new AssertionError(e);
			}
		}

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

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

}


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

#ifndef ONLINE_JUDGE
    #define gc getchar
    #define pc putchar
#else
    #define gc getchar_unlocked
    #define pc putchar_unlocked
#endif

using namespace std;

#define vi vector<int>
#define si set<int>
#define vs vector<string>
#define pii pair<int,int>
#define vpi vector<pii>
#define pri priority_queue<int>
#define rev_pri priority_queue<int,vector<int>,greater<int> >
#define mpi map<int,int>
#define i64 long long int
#define endl '\n'
#define pi acos(-1)
#define all(v) v.begin(),v.end()
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define inf INT_MAX/2
#define infll LLONG_MAX/3
#define For(i,n) for(int i=0;i<n;i++)
#define Fre(i,a,b) for(int i = a; i < b; i++)
#define sf(n) scanf("%d", &n)
#define sff(a,b) scanf("%d %d", &a, &b)
#define sfff(a,b,c) scanf("%d %d %d", &a, &b, &c)
#define pfn(n) printf("%d\n", n)
#define pfs(n) printf("%d ", n)
#define eps 1e-8
#define ff first
#define ss second
#define mem(a,b) memset(a,b,sizeof(a))
#define READ freopen("in.txt", "r", stdin)
#define WRITE freopen("out.txt", "w", stdout)
#define sz size()
#define dbg(i) printf("yo %d\n", i)
#define foreach(i,c) for(__typeof((c).begin()) i = (c).begin(); i != (c).end(); i++)
#define sqr(a) (a) * (a)
#define clr clear()
#define CASE(a) printf("Case %d: ",a)

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


//i64 gcd(i64 a,i64 b){if(!b)return a;return gcd(b,a%b);}

//inline void fastRead(int *a){register char c=0;while(c<33)c=gc();*a=0;while(c>33){*a=*a*10+c-'0';c=gc();}}

//inline void fastWrite(int a){char snum[20];int i=0;do{snum[i++]=a%10+48;a=a/10;}while(a!=0);i=i-1;while(i>=0)pc(snum[i--]);pc('\n');}

//i64 bigmod(i64 num,i64 n){if(n==0)return 1;i64 x=bigmod(num,n/2);x=x*x%mod;if(n%2==1)x=x*num%mod;return x;}

//i64 modinverse(i64 num){return bigmod(num,mod-2)%mod;}

//i64 po(i64 a,i64 b){i64 ans=1;while(b--)ans *= a;return ans;}

//i64 ncr(i64 n,i64 r){if(n==r)return 1;if(r==1)return n;if(dp[n][r]!=-1)return dp[n][r];return dp[n][r]=ncr(n-1,r)+ncr(n-1,r-1);}


// bit manipulations

//bool checkbit(int mask,int bit){return mask & (1<<bit);}

//int setbit(int mask,int bit){ return mask  (1<<bit) ; }

//int clearbit(int mask,int bit){return mask & ~(1<<bit);}

//int togglebit(int mask,int bit){return mask ^ (1<<bit);}

vector<i64> v;
mpi freq;
int main()
{


        int n,inp;
        sf(n);
        while(n--)
        {
                sf(inp);
                freq[inp]++;
                if(freq[inp]%2==0)
                        v.pb(inp);
        }

        sort(all(v));
        reverse(all(v));
        if(v.sz<2)
                cout << 0 << endl;
        else
                cout << v[0]*v[1] << endl;











        return 0;
}



Measured memory_bytes: 4992