akhauriyash/Code-Regression huggingface dataset:
using System;
class M{static void Main(string[] _) {
  var A = Console.ReadLine().Split(' ');
  var B = Console.ReadLine().Split(' ');
  var H = int.Parse(A[0]);
  var W = int.Parse(A[1]);
  var h = int.Parse(B[0]);
  var w = int.Parse(B[1]);
  Console.Write( ((H-h) * (W-w)) );
}}
        

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

int main(){
    int n;
    cin >> n;
    string s;
    cin >> s;
    int ans=1;
    for(int i=1;i<n;i++){
        if(s[i-1]!=s[i]) ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 512
#define	_USE_MATH_DEFINES
#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
#include <cstdio>
#include <string>
#include <cmath>
#include <cfloat>
#include <map>
#include <queue>
#include <stack>
#include <list>
using namespace std;
int main(){

	int n,r;
	
	while(cin>>n>>r,n!=0||r!=0){
	stack<int> q;
	stack<int> a;
	stack<int> b;
		for(int i=1;i<=n;i++)
		q.push(i);
		int c,p;
		for(int i=0;i<r;i++){
			cin>>p>>c;
			for(int j=1;j<p;j++){
			a.push(q.top());
				q.pop();
			}
			
			for(int j=0;j<c;j++){
			b.push(q.top());
				q.pop();
			}
			while(a.empty()!=true){
				q.push(a.top());
				a.pop();
			}
			while(b.empty()!=true){
				q.push(b.top());
				b.pop();
			}
		}
		cout<<q.top()<<endl;
	}
}

Measured memory_bytes: 1200
#include<cstdio>

struct edge {
	int from, to, len;
};
edge e[60];

int main() {
	int l;
	scanf("%d", &l);
	int n = 0;
	for(int i=l;i>0;i/=2) n++;
	int m = 0;
	int _n = n;
	for(;l>1;l/=2, _n--) {
		if(l % 2 == 1) {
			e[m++] = {
				.from = 1,
				.to = _n,
				.len = l-1
			};
		}
		e[m++] = {
			.from = _n - 1,
			.to = _n,
			.len = 0
		};
		e[m++] = {
			.from = _n - 1,
			.to = _n,
			.len = l/2
		};
	}
	printf("%d %d\n", n, m);
	for(int i=0;i<m;i++) {
		printf("%d %d %d\n", e[i].from, e[i].to, e[i].len);
	}
	return 0;
}


Measured memory_bytes: 128
c = ["S", "H", "C", "D"]
h = Hash.new { |hash,key| hash[key] = Hash.new {} }
n = gets.to_i
for i in 1..n do
	a, b = gets.split
	h["#{a}"]["#{b}"] = true
end
for k in 0..3 do
	for i in 1..13 do
		puts "#{c[k]} #{i}" if h["#{c[k]}"]["#{i}"] != true
	end
end

Measured memory_bytes: 8672
import java.util.Scanner;

public class Main {

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

		// ラベル入力・ダイスの生成
		Dice dice = new Dice(CreateIntLabel(sc.nextLine().split("[\\s]+")));

		// 回転方向入力・ラベル更新
		String[] input = sc.nextLine().split("");
		for (String str : input) {
			dice.Rotation(str);
		}
		sc.close();

		// 出力
		System.out.println(dice.label[0]);

	}

	// ラベル配列の生成
	public static int[] CreateIntLabel(String[] input) {
		int[] label = new int[input.length];
		for (int i = 0; i < input.length; i++) {
			label[i] = Integer.parseInt(input[i]);
		}
		return label;
	}

	static class Dice {
		// 回転方向と方向に対応する変更面の添え字配列
		enum DiceStructure {
			Roll	(new int[] { 0, 1, 5, 4 }),
			Pitch	(new int[] { 0, 3, 5, 2 });
			//Yaw		(new int[] { 4, 2, 1, 3 });

			private int[] rotat;

			DiceStructure(int[] nums) {
				this.rotat = nums;
			}
		}

		enum Direction {
			N,
			E,
			W,
			S;
		}

		// ラベル
		int[] label;

		// コンストラクタ
		Dice(int[] label) {
			this.label = label;
		}

		// 回転方向文字を受け取り、ラベル更新処理へ、変更面配列を渡す
		public void Rotation(String str) {
			switch(Direction.valueOf(str)) {
			case N:
				LabelUpdate(DiceStructure.Roll.rotat);
				break;
			case E:
				LabelUpdate(DiceStructure.Pitch.rotat);
				break;
			case W:
				LabelUpdate(turnOver(DiceStructure.Pitch.rotat));
				break;
			case S:
				LabelUpdate(turnOver(DiceStructure.Roll.rotat));
				break;
			}
		}

		// 配列を逆順にして返す
		static int[] turnOver(int[] rotat) {
			int[] turnNums = new int[rotat.length];
			turnNums[0]=rotat[0];
			for (int i = 1; i < turnNums.length; i++) {
				turnNums[turnNums.length  - i] = rotat[i];
			}
			return turnNums;
		}

		// 変更面配列を受け取り、ラベル更新
		void LabelUpdate(int[] rotat) {
			int work = label[rotat[0]];
			for (int i = 1; i < rotat.length; i++) {
				label[rotat[i - 1]] = label[rotat[i]];
			}
			label[rotat[rotat.length - 1]] = work;
		}

	}
}



Measured memory_bytes: 26224
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.NoSuchElementException;

public class Main {

	public static void main(String[] args) throws IOException {
		new Main().solve();
	}

	private void solve() throws IOException {
		try {
			solveA();
			//			 solveB();
			//			 solveC();
			//			 solveD();
			//			 solveE();
			//			 solveF();
		} finally {
			if (in != null) {
				in.close();
			}
			if (out != null) {
				out.flush();
				out.close();
			}
		}

	}

	private void solveA() {
		int numN = nextInt();

		out.println("ABC" + numN);
	}

	private void solveB() {
		int numN = nextInt();

		out.println("");
	}

	private void solveC() {
		int numN = nextInt();

		out.println("");
	}

	private void solveD() {
		int numN = nextInt();

		out.println("");
	}

	private void solveE() {
		int numN = nextInt();

		out.println("");
	}

	private void solveF() {
		int numN = nextInt();

		out.println("");
	}

	private final PrintWriter out = new PrintWriter(System.out);
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;

	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) {
				return false;
			}
		}
		return true;
	}

	private int readByte() {
		if (hasNextByte())
			return buffer[ptr++];
		else
			return -1;
	}

	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <= 126;
	}

	private void skipUnprintable() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr]))
			ptr++;
	}

	public boolean hasNext() {
		skipUnprintable();
		return hasNextByte();
	}

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

	public String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	public long nextLong() {
		if (!hasNext())
			throw new NoSuchElementException();
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}
}

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

const int MAX = 1000000;
const int MOD = 1000000007;

signed main() {
 int n;
 cin>>n;
 int p,q[n];
 for(int i=0;i<n;i++){
     cin>>p;p--;q[p]=i;
 }

 int a[n],b[n];
 a[0]=500000000ll;b[0]=a[0];
 for(int i=1;i<n;i++){
     a[i]=a[i-1]+1;b[i]=b[i-1]-1;
     if(q[i]-q[i-1]<0)b[i]+=q[i]-q[i-1];
     else a[i]+=q[i]-q[i-1];
 }
 for(int i=0;i<n;i++)cout<<a[i]<<' ';
 cout<<endl;
for(int i=0;i<n;i++)cout<<b[i]<<' ';

return 0;
}


Measured memory_bytes: 1152
a,b,c=map(int,input().split())
d=int(a*7+b)
e=int(c%d)
if c<d:
    if c%a==0:
        if c/a>=7:
            print(7)
        else:
            print(int(c/a))
    else:
        if c/a>=6:
            print(7)
        else:
            print(int(c/a)+1)
else:
    if e==0:
        print(int(c/d)*7)
    else:
        if e%a==0:
            if e/a>=7:
                print(int(c/d)*7+7)
            else:
                print(int(c/d)*7+int(e/a))
        else:
            if e/a>=6:
                print(int(c/d)*7+7)
            else:
                print(int(c/d)*7+int(e/a)+1)
            
    


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

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int K = sc.nextInt();

		ArrayList<Integer> okashiList = new ArrayList<>();
		for(int i = 0; i < N; i++) {
			okashiList.add(0);
		}

		//お菓子の種類だけ繰り返す
		for(int i = 0; i < K; i++) {
			//お菓子の個数の取得
			int d = sc.nextInt();
			for(int j = 0;j < d;j++) {
				int Ad = sc.nextInt();
				okashiList.set(Ad-1, 10);
			}
		}

		int answer = 0;
		for(int x = 0;x < okashiList.size();x++){
			if(okashiList.get(x) == 0) {
				answer ++ ;
			}
		}

		System.out.println(answer);

	}

}


Measured memory_bytes: 37324
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <numeric>
#include <string>
#include <sstream>
#include <cmath>
#include <cstring>
#include <assert.h>
#include <utility>
#include <tuple>
#include <array>
#include <bitset>
#include <cstdlib>

using int64 = long long;

using namespace std;

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

    int K;
    cin >> K;
    int A, B;
    cin >> A >> B;

    if (B / K - (A - 1) / K >= 1) {
        cout << "OK" << endl;
    } else {
        cout << "NG" << endl;
    }

    return 0;
}



Measured memory_bytes: 3064
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <tuple>
#include <utility>
#include <vector>
#define ll long long
#define itn int
#define endl '\n'
#define co(ans) cout<<ans<<endl
#define COYE cout<<"YES"<<endl
#define COYe cout<<"Yes"<<endl
#define COye cout<<"yes"<<endl
#define CONO cout<<"NO"<<endl
#define CONo cout<<"No"<<endl
#define COno cout<<"no"<<endl
#define FORE(i,a) for(auto &i:a)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n)  FFOR(i,1,n)
#define PB push_back
#define MP make_pair
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort((V).begin(),(V).end())
#define REVERSE(V) reverse((V).begin(),(V).end())
#define EACH(V,i) for(typeof((V).begin()) i=(V).begin();i!=(V).end();++i)
#define equals(a,b) (fabs((a)-(b))<EPS)
#define INF ((1LL<<62)-(1LL<<31))
#define EPS 1e-10
#define PI 3.141592653589793238
#define MOD 1000000007
#define MAX 5100000
using namespace std;
using Edge=pair<int,int>;
using Graph=vector<vector<int>>;
inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T>inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;}
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int main(){
  ll N,M,S,T;
  cin>>N>>M;
  
  Graph G(N+200010);
  REP(i,M){
    ll U,V;
    cin>>U>>V;
    G[U].PB(V+100000);
    G[U+100000].PB(V+200000);
    G[U+200000].PB(V);
  }
  cin>>S>>T;
  
  ll ans=-1,dist[N+200010];
  bool SEEN[N+200010],EXIST=false;
  RREP(i,N+200009){
    dist[i]=INF;
    SEEN[i]=false;
  }
  
  queue<ll> Q;
  Q.push(S);
  dist[S]=0;
  
  while(!Q.empty()){
    ll v=Q.front();
    Q.pop();
    
    if(v==T){
      ans=dist[T];
      EXIST=true;
      break;
    }
    
    FORE(nv,G[v]){
      if(SEEN[nv]) continue;
      SEEN[nv]=true;
      Q.push(nv);
      chmin(dist[nv],dist[v]+1);
    }
  }
  
  
  if(EXIST) co(ans/3);
  else co(-1);
  return 0;
}

Measured memory_bytes: 22164
import sys
input = sys.stdin.readline
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
# A = [ int(input()) for _ in range(N) ]
##############################

N, K = map(int, input().split())
H = [ int(input()) for _ in range(N) ]

H.sort()

ans = INF
for i in range(N-K+1):
    ans = min(ans, H[i+K-1]-H[i])

print(ans)

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

#define SZ(a) ((int)a.size())
#define ALL(a) a.begin(), a.end()
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define fst first
#define snd second

void dout() { cerr << endl; }

template <typename Head, typename... Tail>
void dout(Head H, Tail... T) {
    cerr << H << ' ';
    dout(T...);
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    string s;
    cin >> s;
    if (s == "SUN")
        cout << 7;
    else if (s == "MON")
        cout << 6;
    else if (s == "TUE")
        cout << 5;
    else if (s == "WED")
        cout << 4;
    else if (s == "THU")
        cout << 3;
    else if (s == "FRI")
        cout << 2;
    else if (s == "SAT") 
        cout << 1;
    return 0;
}

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

using namespace std;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;	cin >> n;
	int mn = 1e9;
	for (int i = 1; i <= n; i++)
		if (1ll * i * (i-1)/2 >= n-i){
			mn = i;
			break;
		}

	cout << mn << "\n";
	n -= mn;
	for (int i = mn - 1; i; i--)
		if (n >= i){
			cout << i << "\n";
			n -= i;
		}
	assert(n == 0);
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int ara[1000];
    int n;
    while(cin>>n)
    {
        int sum=0;
        int i,j,x;
        for(i=0; i<n; i++)
        {
            cin>>ara[i];
        }
        for(i=0; i<n; i++)
        {
            for(j=0; j<n; j++)
            {
                if(i==j&&ara[i]==ara[j])
                    continue;
                else
                    sum=sum+(ara[i]*ara[j]);

            }
        }
        cout<<sum/2<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define vi vector<int>
#define mod 1000000007
using namespace std;

const int N=234567;

int A[N],sm[N];

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

int n,k;
cin>>n>>k;

priority_queue<int>q;

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

cin>>A[i];
q.push(A[i]);


}

int ans=0;
while(k--)
{
    ans+= q.top();
    q.pop();;

}
cout<<ans;


return 0;
}


Measured memory_bytes: 256
N = gets.to_i

A = []
B = []

N.times do
  A << gets.chomp.split.map(&:to_i)
end

N.times do
  B << gets.chomp.split.map(&:to_i)
end

B.sort_by! { |a, b| a }

ans = 0

B.each do |c, n|
  max_y = -1
  point = []

  A.each do |a, b|
    if a < c && b < n && max_y < b
      max_y = b
      point = [a, b]
    end
  end

  if max_y != -1
    index = A.index { |l| l == point }
    A.delete_at(index)
    ans += 1
  end
end

puts ans


Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second

const int N=3630000;
const int INF=123456789;

int f[11];
int dp[2][N];

inline int get_idx(const vector<int> &a)
{
    int n = a.size();
    int ret=0;
    vector<bool> use(n,false);
    rep(i,n)
    {
        int ct=0;
        rep(j,a[i])if(!use[j]) ++ct;

        ret += ct*f[n-1-i];

        use[a[i]]=true;
    }
    return ret;
}

inline vector<int> get_vec(int n, int idx)
{
    vector<int> ret(n);
    vector<bool> use(n,false);
    rep(i,n)
    {
        int s = idx/f[n-1-i];
        int j=0,ct=0;
        while(1)
        {
            if(!use[j])
            {
                ++ct;
                if(ct==s+1) break;
            }
            ++j;
        }

        use[j]=true;
        ret[i]=j;
        idx -= s*f[n-1-i];
    }
    return ret;
}

int main()
{
    f[0]=1;
    for(int i=1; i<=10; ++i) f[i] = f[i-1]*i;

    int n;
    cin >>n;
    vector<int> a(n);
    rep(i,n)
    {
        cin >>a[i];
        --a[i];
    }

    rep(d,2)
    {
        int start = d?get_idx(a):0;
        fill(dp[d],dp[d]+N,INF);
        dp[d][start]=0;
        queue<int> que;
        que.push(start);
        while(!que.empty())
        {
            int now = que.front();
            que.pop();

            vector<int> x = get_vec(n,now);
            rep(i,n)for(int j=i+1; j<=n; ++j)
            {
                reverse(x.begin()+i, x.begin()+j);

                int nx = get_idx(x);
                if(dp[d][nx]>dp[d][now]+1)
                {
                    dp[d][nx] = dp[d][now]+1;
                    if(dp[d][nx]<4) que.push(nx);
                }

                reverse(x.begin()+i, x.begin()+j);
            }
        }
    }

    int ans=9;
    rep(i,N)if(dp[0][i]<INF && dp[1][i]<INF) ans=min(ans,dp[0][i]+dp[1][i]);

    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 31752
H,W,K=map(int,input().split())
S=[list(input()) for _ in range(H)]
ans=0

for H_mask in range(2**H):
  for W_mask in range(2**W):
    cnt=0
    for i in range(H):
      for j in range(W):
        if (H_mask>>i)&1==0 and (W_mask>>j)&1==0\
        and S[i][j]=='#':
          cnt+=1
    if cnt==K:
      ans+=1

print(ans)


Measured memory_bytes: 9052
#include <cstdio>

//#define MAX 200000

int main()
{
	int N, K, h, count=0;
	scanf("%d %d", &N, &K);
	for(int i=0; i<N; i++){
		scanf("%d", &h);
		if(h >= K){
			count ++;
		}
	}
	printf("%d\n", count);
	return 0;
}

Measured memory_bytes: 128
H, W = map(int, input().split())
N = int(input())
a = [int(i) for i in input().split()]

HW = [[0 for j in range(W)] for i in range(H)]


n = 1
c = a[0]
for i in range(H):
    for j in range(W):
        HW[i][j] = n
        c -= 1
        if c == 0 and (i != H-1 or j != W-1):
            n += 1
            c = a[n-1]

for i in range(H):
    if i % 2 == 0:
        print(*HW[i])
    else:
        print(*HW[i][::-1])


Measured memory_bytes: 41712
#include <iostream>
#include <string>

using namespace std;

int r,g,b;
int X;


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

Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var n, in int

	fmt.Scan(&n)
	a := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&in)
		a[in-1] = i + 1
	}

	for _, out := range a {
		fmt.Println(out)
	}
}


Measured memory_bytes: 6144
n,m,q=map(int,input().split())
abcd=[list(map(int,input().split()))for _ in range(q)]
ans=0
import itertools
for i in itertools.combinations_with_replacement(list(range(m)),n):
  anss=0
  for a,b,c,d in abcd:
    if i[b-1]-i[a-1]==c:anss+=d
  ans=max(ans,anss)
print(ans)

Measured memory_bytes: 9184
#include <iostream>
#include <fstream>
#include <algorithm>
#include <cassert>
#include <cctype>
#include <cmath>
#include <complex>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;

#define INF 1e8
#define EPS 1e-9

#define rep2(i,m,n) for(int i=m;i<n;i++)
#define rep(i,n) rep2(i,0,n)
#define ll long long
#define pb push_back

ll N,a[100],dp[99][21];

int main(){
	while(cin>>N&&N){
		rep(i,21)fill(dp[i],dp[i]+N,0);
		rep(i,N)cin>>a[i];
		dp[0][a[0]]=1;
		rep2(i,1,N-1)rep(j,21){
			if(j+a[i]<21)dp[i][j+a[i]]+=dp[i-1][j];
			if(j-a[i]>=0)dp[i][j-a[i]]+=dp[i-1][j];
		}
		cout<<dp[N-2][a[N-1]]<<endl;
	}
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD=1e9+7;
const int INF=1e9;

int main(){
    int n,z,w;
    cin>>n>>z>>w;
    int a[n];
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    int dp[n][2];
    for(int i=n-1;i>=0;i--){
        dp[i][0]=abs(a[n-1]-(i==0?w:a[i-1]));
        for(int j=i;j<n-1;j++){
            dp[i][0]=max(dp[i][0],dp[j+1][1]);
        }
        if(i==0)continue;
        dp[i][1]=abs(a[n-1]-a[i-1]);
        for(int j=i;j<n-1;j++){
            dp[i][1]=min(dp[i][1],dp[j+1][0]);
        }
    }
    cout<<dp[0][0]<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
#define rep(i,j,k) for(int i=j;i<k;i++)
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
vector<string> hako;
int main(){
  int n;
  cin >> n;
  rep(i,0,n){
    string s;
    cin >> s;
    sort(s.begin(),s.end());
    hako.push_back(s);
  }
  sort(hako.begin(),hako.end());
  LL res = 0;
  LL sum = 1;
  string s = "";
  rep(i,0,n){
    if(s != hako[i]){
      s = hako[i];
      sum = 1;
    }else{
      res += sum;
      sum++;
    }
  }
  cout << res << endl;
	return 0;
}


Measured memory_bytes: 5748
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;

int main() {
	int A, B, C, K;
	cin >> A >> B >> C >> K;
	int m = max(A, max(B, C));
	cout << A + B + C + m * ((1 << K) - 1) << endl;
}

Measured memory_bytes: 384
S = str(input())
alp = "ABDEFGHIJKLMNOPQRSTUVWXYZ"
if S[0] == 'A' and S.count('C') == 1 and S[2:-1].count('C') == 1:
  for i in range(1,len(S)):
    if S[i] in alp:
      print("WA")
      exit()
  print("AC")
else:
  print("WA")

Measured memory_bytes: 3060
import java.io.IOException;
import java.util.Scanner;

/**
 * @author aneeshashutosh
 */
public class Main {
	public static void main(String[] args) throws IOException {
		Scanner scanner = new Scanner(System.in);

		int a = scanner.nextInt();
		int b = scanner.nextInt();

		System.out.println((((a * b) % 2 == 0) ? "Even" : "Odd"));
	}
}


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

int main() {
    int K, X, S;
    cin >> K >> X >> S;
    S = 500 * K;

    if (S >= X) {
        cout << "Yes" << endl;
    }
    else {
     cout << "No" << endl;
    }
}

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

#define ll long long
#define ld long double
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
#define sz(x) ((int)(x).size())

const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;
int main()
{
    string s,t;
    cin >> s >> t;
    map<char,char> stot;
    int len = sz(s);
    for (int i = 0; i < len; i++)
    {
        if(stot.count(s[i]))
        {
            if (stot[s[i]]!=t[i])
            {
                cout << "No" << endl;
                return 0;
            }
            continue;
        }

        stot[s[i]] = t[i];
    }
    map<char, char> ttos;
    for (int i = 0; i < len; i++)
    {
        if (ttos.count(t[i]))
        {
            if (ttos[t[i]] != s[i])
            {
                cout << "No" << endl;
                return 0;
            }
            continue;
        }

        ttos[t[i]] = s[i];
    }

    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 776
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define y1 zzz
#define fi first
#define se second
#define PII pair<int2,int>
#define PII2 pair<int,PII >
#define PII3 pair<PII,int >
#define PII4 pair<PII,PII >
#define all(x) (x).begin(),(x).end()
#define pb push_back
int n,f[1000010],t[4000010],lazy[4000010],cur,L,R;
string s;
void push(int l,int r,int node)
{
    t[node]+=lazy[node];
    if(l!=r)
    {
        lazy[node<<1]+=lazy[node];
        lazy[node<<1|1]+=lazy[node];
    }
    lazy[node]=0;
    return;
}
void upd(int l,int r,int node,int val)
{
    push(l,r,node);
    if(l>R||r<L)return ;
    if(L<=l&&r<=R)
    {
        lazy[node]+=val;
        push(l,r,node);
        return;
    }
    int mid=(l+r)/2;
    upd(l,mid,node<<1,val);
    upd(mid+1,r,node<<1|1,val);
    t[node]=min(t[node<<1],t[node<<1|1]);
}
int query(int l,int r,int node)
{
    push(l,r,node);
    if(l>R||r<L)return 1e18;
    if(L<=l&&r<=R)
    {
        return t[node];
    }
    int mid=(l+r)/2;
    return min(query(l,mid,node<<1),query(mid+1,r,node<<1|1));
}
void solve()
{
    cin>>s;
    n=s.size()+1;
    s+='.';
    reverse(all(s));
    for(int i=1;i<n;i++)
    {
        f[i]=f[i-1]+s[i]-'0';
        L=0,R=i-1;
        upd(0,n-1,1,'9'-s[i]);
        f[i]=min(f[i],query(0,n-1,1)+2);
        L=i;R=i;
        upd(0,n-1,1,f[i]);
    }
    cout<<f[n-1];
}
int32_t main()
{
    //ios_base::sync_with_stdio(0);
    //cin.tie(0);cout.tie(0);
    //freopen("XORQUERY.inp","r",stdin);
    //freopen("XORQUERY.out","w",stdout);
    //int t;cin>>t;while(t--)
    solve();
    return 0;
}


Measured memory_bytes: 47108
#include <cstdio>
#include <iostream>
#include <cmath>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <memory.h>
#include <iomanip>
#include <bitset>
#include <list>
#include <stack>
#include <deque>

using namespace std;

#define mod 1000000007

int main()
{
	string s;
	cin >> s;
	int ans = mod;
	for(int i = s.length() - 1; i >= 0; i--){
		// 全部s[i]にするときの回数を計算
		string now = s;
		bool allsame = true;
		for(int j = 0; j < s.length(); j++){
			if(s[i] != s[j]) allsame = false;
		}
		while(!allsame){
			string next = "";
			for(int j = 0; j < now.length() - 1; j++){
				if(now[j] == s[i] || now[j + 1] == s[i]) next += s[i];
				else next += now[j];
			}
			now = next;
			// cout << next << endl;
			allsame = true;
			for(int j = 0; j < now.length(); j++){
			if(s[i] != now[j]) allsame = false;
			}
		}
		ans = min(ans, (int)s.length() - (int)now.length());
	}
	cout << ans << endl;
	return 0;
}

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

int main(void){
    int n,d,x;
    cin >> n >> d >> x;
    vector<int> v(n);
    for(int i=0; i<n; i++){
        cin >> v.at(i);
    }
    for(int i=0; i<n; i++){
        int j=1;
        while(j<=d){
            x++;
            j += v.at(i);
        }
    }
    cout << x <<endl;
    return 0;
}

Measured memory_bytes: 256
//
//  main.cpp
//  tarea
//
//  Created by AdÃ¡n LÃ³pez Alatorre on 3/31/17.
//  Copyright Â© 2017 AdÃ¡n LÃ³pez Alatorre. All rights reserved.
//

#include <iostream>
#include <algorithm>
#include <string.h>
#include <bitset>
#include <set>
#include <cstdio>
#include <cmath>
#include <vector>
#include <iomanip>
#include <stack>
#include <queue>
#include <climits>

using namespace std;
typedef long long ll;
typedef pair<ll, ll> ii;

const ll MOD = 1e9 + 7, maxN = 1e5 + 6, maxV = 1e17;

vector<int> adj[maxN];
int n, m, arr[maxN];

bool v[maxN];
bool cool[maxN];

stack<int> one, two;

void dfs(int nd){
    v[nd] = 1;
    one.push(nd), two.push(arr[nd]), cool[arr[nd]] = 1;
    for(int sn: adj[nd]){
        if(!v[sn]){
            dfs(sn);
        }
    }
}

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

    cin >> n >> m;
    
    for(int i = 0; i < n; i++){
        cin >> arr[i], arr[i]--;
    }
    
    for(int i = 0, u, v; i < m; i++){
        cin >> u >> v;
        u--, v--;
        
        adj[u].push_back(v);
        adj[v].push_back(u);
        
    }
    
    int res = 0;
    for(int i = 0; i < n; i++){
        if(!v[i]){
            dfs(i);
            //cout << one.size() << '\n';
            while(one.size()){
                int tp = one.top(); one.pop();
                
                if(cool[tp]){
                    res++;
                }
                
            }
            while(two.size()){
                cool[two.top()] = 0;
                two.pop();
            }
            
        }
    }
    cout << res << '\n';
    
}


Measured memory_bytes: 10112
from math import log2

A,B=map(int,input().split())

def bitpos(x,digit=1):
  bit = x % (2**digit) // (2**(digit-1))
  pos = x % (2**digit)
  return int(bit),pos

if B == 0:
  print(0)
  exit()
else:
  max_digit=int(log2(B))+1

xor=[]
for i in range(max_digit):
  abit,apos = bitpos(A,i+1)
  bbit,bpos = bitpos(B,i+1)
  if i == 0:
    ar,br = A%4,B%4
    if (ar,br) in {(0,1),(0,2),(1,1),(1,2),(2,3),(2,0),(3,3),(3,0)}:
      xor.append('1')
      continue
    else:
      xor.append('0')
      continue
  
  if abit == 0 and bbit==0:
    xor.append('0')
    continue
  elif abit == 1 and bbit==0:
    if apos % 2 == 1:
      xor.append('1')
      continue
    else:
      xor.append('0')
      continue
  elif abit == 0 and bbit == 1:
    if bpos % 2 == 0:
      xor.append('1')
      continue
    else:
      xor.append('0')
      continue
  else:
    if abs(apos-bpos) % 2 == 1:
      xor.append('0')
      continue
    else:
      xor.append('1')
      continue
xor = xor[::-1]
print(int(''.join(xor),2))

Measured memory_bytes: 9428
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<sstream>
#include<iterator>
#include<list>

using namespace std;

typedef  long long int lint;

#define rep(i, n) for (lint i = 0; i < n; i++)
#define sort(v) sort((v).begin(), (v).end())
#define reverse(v) reverse((v).begin(), (v).end())
#define upper(v,hoge) upper_bound(v.begin(),v.end(),hoge)
#define lower(v,hoge) lower_bound(v.begin(),v.end(),hoge)
#define mp make_pair
#define enld endl
#define P pair<lint,lint>

int main() {
	lint H, N;
	cin >> H >> N;
	vector<lint>A(N);
	rep(i, N) {
		cin >> A[i];
		H -= A[i];
	}
	if (H > 0) {
		cout << "No" << enld;
	}
	else {
		cout << "Yes" << enld;
	}
}

Measured memory_bytes: 3984
#include <bits/stdc++.h>
using namespace std;
int End[10];
int start[10];
int ans=0;
bool flag=0;
void check(int a[], int n)
{
    int x=0;
    for (int i = 0; i < n; i++) {
         if(a[i]==End[i]){
            x++;
            if(x==n-1){
                flag=1;
            }continue;
         }else{
         ans++;
         break;
         }
    }
}
int findPermutations(int start[], int n)
{

    do {
        check(start, n);
        if(flag)
            break;

    } while (next_permutation(start, start + n));
    return ans;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int N;
    cin>>N;
    for(int i=0;i<N;i++){
        cin>>start[i];
    }
    for(int i=0;i<N;i++){
        cin>>End[i];
    }
    if(start[0]>End[0]){
      for(int i=0;i<N;i++)
      {
          swap(start[i],End[i]);
      }
    }
   int x=findPermutations(start,N);
   cout<<x;

    return 0;

}


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

using namespace std;

int main()
{
    int n;
    int a[100010];
    int cnt[100010] = {};
    int ans = 0;

    cin >> n;

    for (int i = 0; i < n; i++) {
        cin >> a[i];
        cnt[a[i]]++;
    }

    for (int i = 0; i < 100010; i++) {
        if (cnt[i] > 0) {
            ans++;
        }
    }

    if (ans % 2) {
        cout << ans << endl;
    }
    else {
        cout << ans-1 << endl;
    }
}


Measured memory_bytes: 1024
import java.util.*;

public class Main {

//    public static void main(String[] args) {
//        Scanner sc = new Scanner(System.in);
//        int N = sc.nextInt();
//        int[] arr = new int[N];
//
//        for (int i = 0; i <N ; i++) {
//            arr[i] = sc.nextInt();
//        }
//
//        if(N%2==0){
//            long ans1 =0;
//            for (int i = 0; i < N ; i=i+2) {
//                ans1+=arr[i];
//            }
//            long ans2 =0;
//            for (int i = 1; i < N ; i=i+2) {
//                ans2+=arr[i];
//            }
//            System.out.println(Math.max(ans1,ans2));
//
//        }else{
//
//            long ans = Integer.MIN_VALUE;
//            for (int j = 0; j < N; j++) {
//
//                long ans1 =0;
//                for (int i = 0; i < N ; i=i+2) {
//                    if(i==j){
//                        i++;
//                        if(i>=N) break;
//                    }
//                    ans1+=arr[i];
//                }
//                long ans2 =0;
//                for (int i = 1; i < N ; i=i+2) {
//                    if(i==j){
//                        i++;
//                        if(i>=N) break;
//                    }
//                    ans2+=arr[i];
//                }
//
//                ans = Math.max(ans,Math.max(ans1,ans2));
//
//            }
//            System.out.println(ans);
//
//        }
//    }


    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        String S = sc.next();

        long r =0,g =0,b =0;
        for (int i = 0; i < S.length(); i++) {
            char  c = S.charAt(i);
            if(c=='R'){
                r++;
            }else if (c=='G'){
                g++;
            }else{
                b++;
            }
        }
        long ans = r*g*b;
        long minus =0;
        for (int i=0; i<S.length(); ++i) {
            for (int j = i+1; j < S.length(); ++j) {

                if(S.charAt(i)==S.charAt(j)) continue ;

                int k = j+j-i;

                if(k>=N || S.charAt(k)==S.charAt(i) || S.charAt(k)==S.charAt(j) ) continue;

                minus++;

            }
        }
        System.out.println(ans-minus);
    }
//
//    static int gcd(int a, int b ){
//        if (a == 0)
//            return b;
//
//        return gcd(b%a, a);
//    }

}


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

#define ll long long
#define N 100010
#define pii pair <int, int> 
#define fi first
#define se second
int n, m;
ll a[N];

int main() {
	while (scanf("%d%d", &n, &m) != EOF) {
		for (int i = 1; i <= n; ++i) {
			scanf("%lld", a + i);
		}
		sort(a + 1, a + 1 + n);
		priority_queue <pii, vector <pii>> pq;
		for (int i = 1, x, y; i <= m; ++i) {
			scanf("%d%d", &x, &y);
			pq.push(pii(y, x));
		}
		for (int i = 1; i <= n; ++i) {
			if (!pq.empty() && pq.top().fi > a[i]) {
				pii it = pq.top(); pq.pop();
				a[i] = it.fi;
				--it.se;
				if (it.se > 0)
					pq.push(it);
			}
		}
		ll res = 0;
		for (int i = 1; i <= n; ++i) {
			res += a[i];
		}
		printf("%lld\n", res);
	}
	return 0;
}


Measured memory_bytes: 2168
#include <iostream>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <cstdio>
#include <stack>
#include <map>
#define rep(i,n) for(long long i = 0; i < n; i++)
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
ll MOD = 1000000007;

string str;
map<ll,ll> ma;

ll f1(ll x, ll y){
	rep(i,y){
		x /= 2;
		if(x == 0) break;
	}
	return x;
}

ll f2(ll x){	
	return (x*x)%MOD;
} 

P dfs(ll st, ll en, bool start){
	ll ret = 0;
	if('0' <= str[st] && str[st] <= '9'){
		ret = str[st]-'0';
		while(st+1 <= en && '0' <= str[st+1] && str[st+1] <= '9'){
			st++;
			ret = ret*10+str[st]-'0';
		}
	} else{
		ret = f2(dfs(st+2,ma[st+1]-1,0).first);
		st = ma[st+1];
	}
	if(start) return P(ret,st);
	while(st+3 <= en){
		P acc = dfs(st+3,en,1);
		ret = f1(ret,acc.first);
		st = acc.second;
	}
	return P(ret,st);
}

void solve(){
	ma.clear();
	string s;
	rep(i,str.size()) if(str[i] != ' ') s.push_back(str[i]);
	str  = s;
	str += ">>";
	stack<ll> sta;
	rep(i,str.size()){
		if(str[i] == '<'){
			sta.push(i);
		}
		if(i+2 <= str.size()-1 && str[i] == '>' && str[i+1] == '>' && str[i+2] == '>'){
			ma[sta.top()] = i;
			sta.pop();
		}
	}
	cout << dfs(0,str.size()-3,0).first << endl;
}

int main(){
	while(true){
		getline(cin,str);
		if(str == "#") break;
		solve();
	}
}

Measured memory_bytes: 8136
#include <algorithm>
#include <climits>
#include <iostream>
#include <queue>
#include <stack>
#include <utility>
#include <vector>

#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(a) (a).begin(), (a).end()

#define INF 1000000000

using namespace std;

vector<vector<pair<int, long long>>> g;
vector<bool> visited;
vector<long long> dist;
queue<pair<int, long long>> q;

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

    g = vector<vector<pair<int, long long>>>(N);
    visited = vector<bool>(N, false);
    dist = vector<long long>(N, INF);

    REP(i, M) {
        int s, t;
        cin >> s >> t;

        s--;
        t--;

        int w;
        cin >> w;

        g[s].emplace_back(t, w);
        g[t].emplace_back(s, -w);
    }

    REP(i, N) {
        if (visited[i] == false) {
            q.emplace(i, 0);

            while (!q.empty()) {
                auto p = q.front();
                q.pop();

                for (auto& e : g[p.first]) {
                    long long next_dist = p.second + e.second;
                    if (visited[e.first]) {
                        if (dist[e.first] != next_dist) {
                            cout << "No" << endl;
                            return 0;
                        }
                    } else {
                        dist[e.first] = next_dist;
                        visited[e.first] = true;
                        q.emplace(e.first, next_dist);
                    }
                }
            }
        }
    }

    cout << "Yes" << endl;

    return 0;
}


Measured memory_bytes: 14448
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <utility>

const int INF = 1000;

using namespace std;

using P = pair<int, pair<int, int> >;


bool wall[20][20];
int H, W;

int distMaze(int sx, int sy) {
	if (wall[sy][sx] == true) {
		return -1;
	}
	priority_queue<P, vector<P>, greater<P> > que;

	int d[H][W];
	for(int y = 0; y < H; y++) {
		for (int x = 0; x < W; x++) {
			d[y][x] = INF;
		}
	} 

	d[sy][sx] = 0;
	que.push(make_pair(0 ,make_pair(sx,sy)));
	while (!que.empty()) {
		P p = que.top();
        que.pop();
        auto pos = p.second;
        int cur_x = pos.first;
        int cur_y = pos.second;

        if (d[cur_y][cur_x] < p.first) continue;
		int dx[] = {0,0,-1,1};
		int dy[] = {1,-1,0,0};
		for (int i = 0; i < 4; i++) {
			int next_x = dx[i] + cur_x;			
			int next_y = dy[i] + cur_y;			
			if (wall[next_y][next_x] == true) continue;
			if (next_y < 0 || next_y >= H || next_x < 0 || next_x >=W) continue;
			if (d[next_y][next_x]  > d[cur_y][cur_x] + 1) {
				d[next_y][next_x] = d[cur_y][cur_x] + 1;
				que.push(make_pair(d[next_y][next_x], make_pair(next_x,next_y)));
			}		
		}
	}
	int ans = 0;

	for(int y = 0; y < H; y++) {
		for (int x = 0; x < W; x++) {
			int cur = d[y][x];
			if (cur < INF) {
				if (ans < cur) {
					ans = cur;
				}
			}	
		}
	} 
	return ans;
}




int main() {

	
	cin >> H >> W;
	for (int y = 0; y < H; y++) {
		string s;
		cin >> s; 
		for (int x = 0; x < W; x++) {
			if (s.at(x) == '.') {
				wall[y][x] = false;
			} else {
				wall[y][x] = true;				
			}
		}
	}
	int max = 0;
	for (int y = 0; y < H; y++) {
		for (int x = 0; x < W; x++) {
			int cur = distMaze(x,y);
			//cout << "x:" << x << " y:" << y << "cur:" << cur <<  endl;
			if (cur > max) {
				max = cur;
			} 
		}
	}
	cout << max << endl;

	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#define N 2000

void rec(int,int,int *);
int solve(int,int,int *,int);

int main(){
  int n,q,A[N],m[N],i,j,k,x,L[N];

  scanf("%d",&n);
  for(i=0;i<n;i++)scanf("%d",&A[i]);
  scanf("%d",&q);
  for(j=0;j<q;j++)scanf("%d",&m[j]);

  for(i=0;i<q;i++){
    x=solve(0,m[i],A,n);
    if(x==1)printf("yes\n");
    if(x==0)printf("no\n");
  }
  return 0;
}

int solve(int i,int m,int *A,int n){
  int res1,res2;
  if(m==0){
    return 1;
  }
  if(i>=n){
    return 0;
  }
  res1=solve(i+1,m,A,n);
  if(res1==1) return 1;
  res2=solve(i+1,m-A[i],A,n);
  if(res2==1) return 1;
  if(res1==0 && res2==0)return 0;
}



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



void print(vector<int> v){
	
	for(int i=0;i<v.size();i++){
		cout<<v[i];
	}
	//cout<<endl;
}
int N,L;
int max_L=0;
int sum_L=0;
void solve(){
	cin>>N;
	
	for(int i=0;i<N;i++){
		
		cin>>L;
		sum_L+=L;
		max_L=max(max_L,L);
	}
	sum_L-=max_L;
	//cout<<sum_L<<max_L<<endl;
	if(max_L<sum_L)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
}


int main(){

    solve();
    return 0;
}




Measured memory_bytes: 256
import math
n = int(input())
l = 0

x_list = []
y_list = []

for i in range(n):
    x, y = map(int, input().split())
    x_list.append(x)
    y_list.append(y)

for j in range(n):
    for k in range(n):
        if j >= k:
            continue
        l += math.sqrt((x_list[j] - x_list[k]) ** 2 + (y_list[j] - y_list[k]) ** 2)

print(l * 2/n)

Measured memory_bytes: 3064
import java.util.Scanner;
class Main
{
    public static void main(String args[])
    {
	Scanner scan=new Scanner(System.in);
	int s[][]=new int[4][2];
	for(int i=0;i<40;i++)
	    {
	float l,r;
	l=scan.nextFloat();
	r=scan.nextFloat();
	if(l>=1.1)s[0][0]++;
	if(r>=1.1)s[0][1]++;
	if(0.6<=l && l<1.1)s[1][0]++;
	if(0.6<=r && r<1.1)s[1][1]++;
	if(0.2<=l && l<0.6)s[2][0]++;
	if(0.2<=r && r<0.6)s[2][1]++;
	if(l<0.2)s[3][0]++;
	if(r<0.2)s[3][1]++;
	    }
	for(int i=0;i<4;i++)
	    {
		
			System.out.println(s[i][0]+" "+s[i][1]);
		    
	    }
    }
}

Measured memory_bytes: 20420
#include <iostream>
#include <vector>
#include <algorithm>
typedef long long ll;
using namespace std;

int main() {
	ll n;
	cin >> n;
	vector<ll> t(n), a(n);
	for (int i = 0; i < n; i++)
		cin >> t[i] >> a[i];
	
	for (int i = 1; i < n; i++) {
		ll fir = t[i - 1] / t[i] + 1;
		ll sec = a[i - 1] / a[i] + 1;
		if (t[i - 1] % t[i] == 0)
			fir--;
		if (a[i - 1] % a[i] == 0)
			sec--;
		ll fact = max(fir, sec);
		t[i] *= fact;
		a[i] *= fact;
	}
	cout << t[n - 1] + a[n - 1] << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <sstream>
#define kMaxIndex 10000

int main(void){
    /* input */
    std::string datasetArr[kMaxIndex];
    for(int index = 0; index < kMaxIndex; ++index)
    {
        getline(std::cin, datasetArr[index]);
    }
    
    /* output */
    int intData = 0;
    for(int index = 0; index < kMaxIndex; ++index)
    {
        std::istringstream iss(datasetArr[index]);
        iss >> intData;
        if(intData == 0)
        {
            break;
        }
        else
        {
            std::cout << "Case "<< index+1 << ": " << datasetArr[index] << std::endl;
        }
    }
    return 0;
}

Measured memory_bytes: 3716
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b


def main():
    A, B = map(int, input().split())
    for c in range(1, 4):
        if A * B * c % 2 == 1:
            print(Yes)
            return
    print(No)



if __name__ == '__main__':
    main()


Measured memory_bytes: 3948
#include<stdio.h>

int main(){
	int b,c,d,e,newx=-100,newy=100,x,y;
	bool a=true;
	scanf("%d %d %d %d",&b,&c,&x,&y);
	newy=y;
	newx=x;
	for(int i=0;b>i;i++){
		scanf("%d",&d);
		if(newx<=d)
			newx=d;
	}
	for(int i=0;c>i;i++){
		scanf("%d",&e);
		if(newy>=e)
			newy=e;
	}
	if(newx<newy) {
		printf("No War\n");
	} else {
		printf("War\n");
	}
return 0;
}

Measured memory_bytes: 128
import bisect
import numpy as np

import fractions
from functools import reduce

def gcd(*numbers):
    return reduce(fractions.gcd, numbers)

def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)
  
N,X = list(map(int, input().split()))
x = (list(map(int, input().split())))
x.sort()
bisect.insort_left(x, X)
x_diff = np.diff(x)

print(gcd_list(x_diff))

Measured memory_bytes: 24924
#include<bits/stdc++.h>
using namespace std;
using ll  = long long;
using vl  = vector<ll>;
using vi  = vector<int>;
#define _GLIBCXX_DEBUG
#define IO_STREAM cin.tie(0);ios::sync_with_stdio(false)
#define all(x) x.begin(),x.end()
#define rep(i,sta,end) for(ll i=sta;i<end;++i)
#define lcm(a,b) (a)/__gcd((a),(b))*(b)
#define pb push_back
#define INF 1000000000000000LL
const ll MOD = 1000000007;
const double PI = acos(-1);
//||
#define DBG(a,b,c,d) //cout<<a<<" "<<b<<" "<<c<<" "<<d<<" "<<endl
//DBG("","","","");

signed main(){
	IO_STREAM;
	int N;
	cin>>N;
	vi X(N);
	ll total=0;
	rep(i,0,N){
		cin>>X[i];
	}
	ll ans=INF;
	rep(p,1,101){
		total=0;
		rep(i,0,N){
			total+=(p-X[i])*(p-X[i]);
		}
		ans=min(ans,total);
	}
	cout<<ans<<endl;
	return 0;
}


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

using namespace std;

int main()
{
	std::vector<int> v(3);
	cin >> v[0] >> v[1] >> v[2];
	sort(v.begin(), v.end());
	cout << v[2] * 10 + v[1] + v[0] << endl;
}

Measured memory_bytes: 256
while True:
    m,f,r = map(int, input().split())
    if (m,f,r) == (-1,-1,-1): 
        break
    elif m == -1 or f == -1: print('F')
    elif (m + f) >= 80: print('A')
    elif 65 <= (m + f) < 80: print('B')
    elif 50 <= (m + f) < 65: print('C')
    elif 30 <= (m + f) < 50:
        if r >= 50: print('C')
        else: print('D')
    elif (m + f) < 30: print('F') 



Measured memory_bytes: 5596
#include <iostream>
#include <set>

using namespace std;

int main()
{
    int x, n, p;
    int ans = 100;
    int m = 101;
    set<int> s;
    cin >> x >> n;
    for (int i = 0; i < n; i++)
    {
        cin >> p;
        s.insert(p);
    }

    for (int i = 0; i <= 101; i++)
    {
        if(s.count(i)) continue;
        if (abs(x - i) < m)
        {
            m = abs(x - i);
            ans = i;
        }
    }

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3648
<?php
  
  fscanf(STDIN, "%d", $integer);
  
  //$digits = $integer % 10;
  //$hundredsInteger = floor( $integer / 100);
  //$bool = ($hundredsInteger - $digits === 0);


  $digits = substr($integer, 0, 1);
  $hundredsInteger = substr($integer, 2, 3);
  $bool = $digits === $hundredsInteger;
  echo $bool ? 'Yes' : 'No' ;
?>

Measured memory_bytes: 4604
// Template from https://techracho.bpsinc.jp/jhonda/2019_08_05/78537

// input macro for competive-programming from https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

#[allow(unused_macros)]
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)*}
    };

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

#[allow(unused_macros)]
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<_>>()
    };

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

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

    ($iter:expr, bytes) => {
        read_value!($iter, String).into_bytes()
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    use std::io::Read;
    let mut s = String::new();
    std::io::stdin().read_to_string(&mut s).unwrap();

    println!("{}", solve(&s));
}

macro_rules! test {
    ($($input:expr => $output:expr),* $(,)*) => {
        #[test]
        fn solve_test() {
            $(
                assert_eq!(solve($input), $output);
            )*
        }
    };
}

test! {
r#"A B"# => "<",
// r#"24"# => "No",
}

fn solve(src: &str) -> String {
    input! {
        source = src,
        xs: String,
        ys: String,
    }
    let x = xs.as_bytes()[0];
    let y = ys.as_bytes()[0];

    if x < y { "<" } else if x > y { ">" } else { "=" }.to_string()
}

Measured memory_bytes: 4352