akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using System.Globalization;
using System.Diagnostics;
using System.Threading.Tasks;



class Myon
{
    public Myon() { }
    public static int Main()
    {
        new Myon().calc();
        return 0;
    }

    Scanner cin;
    
    void calc()
    {
        cin = new Scanner();
        int X = cin.nextInt();
        int Y = cin.nextInt();
        int ans = X + Y / 2;
        Console.WriteLine(ans);

    }
    
    
}




class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }


    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}



Measured memory_bytes: 11092
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.NoSuchElementException;
import java.util.PriorityQueue;

public class Main {
	int N, M;
	ArrayList<ArrayList<E>> graph;

	private class E implements Comparable<E>{
		int v, c;
		public E(int v, int c) {
			this.v = v;
			this.c = c;
		}

		public int compareTo(E e){
			return this.c - e.c;
		}
	}
	public void solve() {
		N = nextInt();
		M = nextInt();
		graph = new ArrayList<ArrayList<E>>();
		for (int i = 0; i < N; i++) {
			graph.add(new ArrayList<E>());
		}
		for (int i = 0; i < M; i++) {
			int a = nextInt() - 1;
			int b = nextInt() - 1;
			int c = nextInt();
			graph.get(a).add(new E(b, c));
		}

		PriorityQueue<E> pq = new PriorityQueue<E>();
		boolean[] used = new boolean[N];
		int ans = -1;
		pq.add(new E(0,0));
		while(pq.size() > 0){
			E  e = pq.poll();

			if(e.v == N - 1){
				ans = Math.max(ans, e.c);
			}

			if(used[e.v])continue;
			used[e.v] = true;

			for(E ee : graph.get(e.v)){
				if(e.c <= ee.c){
					pq.add(new E(ee.v,ee.c));
				}
			}
		}
		out.println(ans);
	}

	public static void main(String[] args) {
		out.flush();
		new Main().solve();
		out.close();
	}

	/* Input */
	private static final InputStream in = System.in;
	private static final PrintWriter out = new PrintWriter(System.out);
	private final byte[] buffer = new byte[2048];
	private int p = 0;
	private int buflen = 0;

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

	public boolean hasNext() {
		while (hasNextByte() && !isPrint(buffer[p])) {
			p++;
		}
		return hasNextByte();
	}

	private boolean isPrint(int ch) {
		if (ch >= '!' && ch <= '~')
			return true;
		return false;
	}

	private int nextByte() {
		if (!hasNextByte())
			return -1;
		return buffer[p++];
	}

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

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

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

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

Measured memory_bytes: 77352
N, M = map(int, input().split())
x = list(map(int, input().split()))
x = list(sorted(x))

y = [x[i] - x[i - 1] for i in range(1, M)]
y = list(sorted(y))

ans = 0
for i in range(M - N):
    ans += y[i]
print(ans)


Measured memory_bytes: 13968
N = int(input())
count = 0
flag = False

for _ in range(N):
    d1, d2 = map(int, input().split())
    if d1 == d2:
        count += 1
        if count == 3:
            flag = True

    else:
        count = 0

if flag == True:
    print('Yes')
else:
    print('No')


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

int main() {
    int a,b,c;  //int型変数を3つ用意
    cin>>a>>b>>c;  //入力を受け取る
    if(a<=c&&c<=b)cout<<"Yes"<<endl;  //条件を満たせばYes
    else cout<<"No"<<endl;  //満たさなかったらNo
    
    return 0;
}

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

using namespace std;

int main(){
	int N,M;
	cin>>N>>M;
    vector <int>a(M);
	vector <int>b(M);
    for(int i=0 ; i<M ; i++){
        cin>>a[i];
    	cin>>b[i];
    }
	
	bool t=false;
	vector <int>c;
	vector <int>d;
	for(int i=0 ; i<M ; i++){
		if(a[i]==1){
			if(b[i]==N){
				t=true;
				break;
			}
			else c.push_back(b[i]);
		}
		if(b[i]==N){
			d.push_back(a[i]);
		}
	}
	if(!t && (c.size()!=0 &&d.size()!=0)){
	sort(c.begin(),c.end());
	sort(d.begin(),d.end());
	
	int j=0;
	for(int i=0 ; i<c.size() ; ){
		if(j==d.size())break;
		if(c[i]==d[j]){
			t=true;
			break;
		}
		if(c[i]>d[j])j++;
		else if(c[i]<d[j])i++;
		else{
			i++;
			j++;
		}
		
	}
	}
	
	if(t)cout<<"POSSIBLE\n";
	else cout<<"IMPOSSIBLE\n";
	
	return 0;
}


Measured memory_bytes: 2812
import sys
from collections import *

N,M=map(int,input().split())
adj=[[] for _ in range(N+1)]
for ln in sys.stdin:
    A,B=map(int,ln.split())
    adj[A].append(B)
    adj[B].append(A)

ans=[0]*(N+1)
ans[1]=1
que=deque([1])
while que:
    A=que.popleft()
    for B in adj[A]:
        if ans[B]==0:
            ans[B]=A
            que.append(B)

print('Yes')
for i in range(2,N+1):
    print(ans[i])


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

typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<long long> vll;
typedef pair<int,int> pii;
typedef pair<long long, int> pli;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

ll mod = 1e9+7;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a[3][3];
  cin >> a[0][0] >> a[0][1] >> a[0][2];
  cin >> a[1][0] >> a[1][1] >> a[1][2];
  cin >> a[2][0] >> a[2][1] >> a[2][2];

  int n;
  cin >> n;

  map<int,int> b;
  rep(i,n){
    int x;cin >> x;
    b[x] = 1;
  }

  string ret = "No";

  rep(i,3){
    bool check = true;
    rep(j,3){
      if(b[a[i][j]] != 1)check = false;
    }
    if(check)ret = "Yes";
  }
  rep(i,3){
    bool check = true;
    rep(j,3){
      if(b[a[j][i]] != 1)check = false;
    }
    if(check)ret = "Yes";
  }
  bool check = true;
  rep(i,3){
    if(b[a[i][i]] != 1)check = false;
  }
  if(check)ret = "Yes";

  check = true;
  rep(i,3){
    if(b[a[i][2-i]] != 1)check = false;
  }
  if(check)ret = "Yes";

  cout << ret << endl;
}

Measured memory_bytes: 256
import java.util.*;

class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        //arrays.sortで降順にするときはプリミティブ型だと使用不可
        Integer[]p = new Integer[N];
        int sum = 0;
        for(int i = 0; i < N; i++){
            p[i] = sc.nextInt();
        }
        //降順に並べる
        Arrays.sort(p, Comparator.reverseOrder());
        p[0] = p[0] / 2;
        for(int i = 0; i < N; i++){
            sum = sum + p[i];
        }
        System.out.println(sum);
    }
}

Measured memory_bytes: 21844
object Main {
  def main(args:Array[String]) = {
    val sc = new java.util.Scanner(System.in)
    val n, a = sc.nextInt
    val x = List.fill(n)(sc.nextInt)

    val nx = (a :: x).max * n

    val dp = collection.mutable.ArrayBuffer.fill(n + 1, n + 1, nx + 1)(-1L)
    def dpFunc(j: Int, k: Int, s: Int): Long = {
    	if (dp(j)(k)(s) >= 0) return dp(j)(k)(s)

    	val ret = if (j == 0 && k == 0 && s == 0) 1L
    		else if (j > 0 && s < x(j - 1)) dpFunc(j - 1, k, s)
    		else if (j > 0 && k > 0 && s >= x(j - 1)) dpFunc(j - 1, k, s) + dpFunc(j - 1, k - 1, s - x(j - 1))
    		else 0L
    	dp(j)(k)(s) = ret
    	ret
    }

    val ans = (1 to n).map(k => dpFunc(n, k, k * a)).sum

    println(ans)

  }
}

Measured memory_bytes: 64048
/*
 * Author:  heyuhhh
 * Created Time:  2019/11/16 20:00:15
 */
#include <bits/stdc++.h>
#define MP make_pair
#define fi first
#define se second
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
#define INF 0x3f3f3f3f
#define Local
#ifdef Local
  #define dbg(args...) do { cout << #args << " -> "; err(args); } while (0)
  void err() { std::cout << '\n'; }
  template<typename T, typename...Args>
  void err(T a, Args...args) { std::cout << a << ' '; err(args...); }
#else
  #define dbg(...)
#endif
void pt() {std::cout << '\n'; }
template<typename T, typename...Args>
void pt(T a, Args...args) {std::cout << a << ' '; pt(args...); }
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
//head
const int N = 1e5 + 5;

void run(){
    int r; cin >> r;
    cout << (r * r);
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    cout << fixed << setprecision(20);
    run();
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a) for(int i = 0; i < (a); i++)
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9;
const int MOD = 1e9 + 7;

int main(){
	int a,b;
	cin >> a >> b;
	if(a * b % 2 == 1) cout << "Odd" << endl;
	else cout << "Even" << endl;
}

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

signed main() {
  cin.tie(0); ios::sync_with_stdio(false);
  int n; cin >> n;
  vector<int> a(n); for (int i = 0; i < n; i++) cin >> a[i];
  vector<int> b(n); for (int i = 0; i < n; i++) cin >> b[i];
  long long t = 0, s = 0;
  for (int i = 0; i < n; i++) {
    t += max(0, a[i] - b[i]);
    s += max(0, (b[i] - a[i]) / 2);
  }
  cout << (t > s ? "No" : "Yes") << '\n';
  return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <utility>
#include <iomanip>
#include <cmath>
using namespace std;
#define REP(i,n) for (int i=0;i<(n);++i)
#define rep(i,a,b) for(int i=a;i<(b);++i)
template<class T> inline bool chmin(T &a, T b){ if(a > b) { a = b; return true;} return false;}
template<class T> inline bool chmax(T &a, T b){ if(a < b) { a = b; return true;} return false;}
using ll = long long;
constexpr ll INF = 1LL << 60;
constexpr ll MOD = 1e9 + 7;


int main() {
    cin.tie(0); ios_base::sync_with_stdio(false);
    ll a,b,x;cin>>a>>b>>x;
    ll a1 = b / x;
    ll a2 = a / x;
    cout << a1-a2 + (a%x==0) << endl; 
    return 0;
}

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

#define abs(N) ((N>0)?N:-1*N)
#define min(A,B) ((A>B)?B:A)
#define max(A,B) ((A<B)?B:A)
#define print(S) (cout << S)
#define println(S) (cout << S << endl)

int main() {
	int H,W;
	while(true){
		cin >> H >> W;
		if(H==0 && W == 0){
			break;
		}
		for (int i = 0; i < H; ++i) {
			for (int j = 0; j < W; ++j) {
				print("#");
			}
			println("");
		}
		println("");
	}

	return 0;
}



Measured memory_bytes: 3056
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const int mod = 1000000007;
int main(){
    int n;
     cin >> n;
     vector<ll> a(n), b(n);
     rep(i,n){
        cin >> a[i];
        b[0] += a[i]*pow(-1,i%2);
    }
    rep(i,n-1){
        b[i+1] = 2*a[i]-b[i];
    }
    rep(i,n-1)printf("%d ",b[i]);
    printf("%d\n",b[n-1]);
    return 0;
}

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

public class Main{

	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int N;
		N = sc.nextInt();
int A=N/100;
int B=N-A*100;

	if(A<=12&&0<A) {
		if(B<=12&&0<B) {
			System.out.print("AMBIGUOUS"); 	
			
		}else {
			
			System.out.print("MMYY"); 	
			
		}
	}else {
		if(B<=12&&0<B) {
			System.out.print("YYMM"); 	
			
		
	}else {
System.out.print("NA"); 	
			
	}

	}
}
}



Measured memory_bytes: 23252
import sys

sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def solve(inputs):
    N = int(inputs[0])
    if N == 1:
        return "Yes"
    if N > 81:
        return "No"
    for i in range(2, 10):
        if N % i == 0:
            for j in range(1, 10):
                if i * j == N:
                    return "Yes"
    return "No"


def string_to_int(string):
    return list(map(lambda x: int(x), string.split()))


if __name__ == "__main__":
    ret = solve(inputs(1))
    print(ret)


Measured memory_bytes: 3060
N, T = map(int,input().split())
c = list()
t = list()
for _ in range(N):
    ci, ti = map(int, input().split())
    if ti <= T:
        c.append(ci)
        t.append(ti)

if c == []:
    print('TLE')
else:
    print(min(c))

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

int main() {
  ll k, a, b;
  cin >> k >> a >> b;
  if (b - a <= 2) {
    cout << k + 1 << endl;
    return 0;
  }
  k -= a - 1;
  ll ans = a + (b - a) * (k / 2) + (k % 2 == 1 ? 1 : 0);
  cout << ans << endl;
  return 0;
}


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

typedef long long ll;
const ll INF = (ll)1e18;
//const int N = 12;
const int N = 100100;
int n, m, k;
ll a[N];
ll b[N];
ll c[N];

struct Queue
{
	int sz1, sz2;
	ll a[N][2], b[N][2];

	Queue() : sz1(0), sz2(0), a(), b() {}

	void push(ll x)
	{
		a[sz1][0] = x;
		if (sz1 > 0)
			a[sz1][1] = max(a[sz1 - 1][1], x);
		else
			a[sz1][1] = x;
		sz1++;
	}
	void pop()
	{
		if (sz2 == 0)
		{
			if (sz1 == 0) throw;
			while(sz1 > 0)
			{
				sz1--;
				b[sz2][0] = a[sz1][0];
				if (sz2 > 0)
					b[sz2][1] = max(b[sz2 - 1][1], a[sz1][0]);
				else
					b[sz2][1] = b[sz2][0];
				sz2++;
			}
		}
		sz2--;
	}
	ll getMax()
	{
		if (sz1 == 0 && sz2 == 0) return -INF;
		if (sz2 == 0) return a[sz1 - 1][1];
		if (sz1 == 0) return b[sz2 - 1][1];
		return max(a[sz1 - 1][1], b[sz2 - 1][1]);
	}
};

int main()
{
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);

	scanf("%d%d%d", &n, &m, &k);
	for (int i = 0; i < n; i++)
		scanf("%lld", &a[i]);
	for (int i = 0; i < n; i++)
		b[i] = a[i];
	for (int it = 1; it < k; it++)
	{
//		cerr << "it = " << it << endl;
		Queue q;
		for (int i = 0; i < m; i++)
		{
//			cerr << i << endl;
			c[i] = (it + 1) * a[i] + q.getMax();
			q.push(b[i]);
		}
		for (int i = m; i < n; i++)
		{
//			cerr << i << endl;
			c[i] = (it + 1) * a[i] + q.getMax();
			q.push(b[i]);
			q.pop();
		}
		for (int i = 0; i < n; i++)
			b[i] = c[i];
	}
	ll ans = 0;
	for (int i = 0; i < n; i++)
		ans = max(ans, b[i]);
	printf("%lld\n", ans);

	return 0;
}

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

int o(int a) {
	if (a < 0) {
		return a * -1;
	}
	return a;
}

int main() {
	int a, b, c;
	cin >> a >> b >> c;
	if (o(a-b)<o(a-c)) {
		cout << "A" << endl;
	}
	else {
		cout << "B" << endl;
	}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define lli long long int
#define rep(i,n) for(lli i=0;i<n;i++)
#define repb(i,n) for(lli i=n-1;i>=0;i--)
#define pb push_back
#define mp make_pair
#define bg() begin()
#define en() end()
#define ft first
#define sc second
#define vect_lli_it vector<lli>::iterator
#define set_lli_it set<lli>::iterator
#define inf 1e18
#define all(X) X.begin(),X.end()
#define iterate(X) for(it=X.begin();it!=X.end();it++)
lli combi(lli n,lli k)
{
    lli ans=1;
    k=k>n-k?n-k:k;
    lli j=1;
    for(;j<=k;j++,n--)
    {
        if(n%j==0)
        {
            ans*=n/j;
        }else
        if(ans%j==0)
        {
            ans=ans/j*n;
        }else
        {
            ans=(ans*n)/j;
        }
    }
    return ans;
}
lli gcd(lli a, lli b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}
lli findlcm(vector <lli> arr, lli n)
{
    lli ans = arr[0];
    for (lli i = 1; i < n; i++)
        ans = (((arr[i] * ans)) /
                (gcd(arr[i], ans)));

    return ans;
}
int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    lli n,m;
    vector <lli> arr;
    cin>>n>>m;
    lli x;
    rep(i,m){
    	cin>>x;
    	arr.pb(x);
	}
	lli sum_val=0;
	rep(i,m){
		sum_val+=arr[i];
	}
	if(n-sum_val>=0)
	cout<<n-sum_val;
	else
	cout<<"-1";
    return 0;
}


Measured memory_bytes: 3748
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

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

		int n = sc.nextInt();
		ArrayList<List<Integer>> A = new ArrayList<>();
		for (int i = 0; i < n; i++) {
			ArrayList<Integer> B = new ArrayList<>();
			A.add(B);
		}
		int q = sc.nextInt();

		for (int i = 0; i < q; i++) {
			int x = sc.nextInt();
			if (x == 0) {
				int y = sc.nextInt();
				int z = sc.nextInt();
				A.get(y).add(z);

			} else if (x == 1) {
				int y = sc.nextInt();
				if (A.get(y).size() != 0) {
					System.out.println(A.get(y).get(A.get(y).size() - 1));
				}

			} else if (x == 2) {
				int y = sc.nextInt();
				if (A.get(y).size() != 0) {
					A.get(y).remove(A.get(y).size() - 1);
				}
			}
		}
		sc.close();

	}

}



Measured memory_bytes: 168132
#include<bits/stdc++.h>
using namespace std;
const int N=200005;
typedef long long ll;
int a[N],b[25];
int read(){
	int x=0,f=1; char ch=getchar();
	while (ch<'0'||ch>'9'){if (ch=='-') f=-1; ch=getchar();}
	while (ch>='0'&&ch<='9'){x=x*10+ch-'0'; ch=getchar();}
	return x*f;
}
void add(int x){
	for (int i=0;i<=20;i++){
		if (x&(1<<i)) b[i]++;
	}
}
void del(int x){
	for (int i=0;i<=20;i++){
		if (x&(1<<i)) b[i]--;
	}
}
bool ck(){
	for (int i=0;i<=20;i++){
		if (b[i]>=2) return 0; 
	}
	return 1;
}
int main(){
	int n=read();
	for (int i=1;i<=n;i++) a[i]=read();
	int l=1,r=1; add(a[1]);
	ll ans=1;
	for (r=2;r<=n;r++){
		add(a[r]);
		while (l<r&&!ck()){del(a[l++]);}
		ans+=(r-l+1);
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 1024
import java.util.*;

class Main {
  public static final int MOD = 1000000007;
  public static final int INF = 1000000000;
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    Integer A[] = new Integer[3];
    for(int i=0; i<A.length; i++){
      A[i] = sc.nextInt();
    }
    Arrays.sort(A);
    int ans;
    ans = A[2] - A[1];
    A[0] += ans;
    int a = A[2] - A[0];
    if(a % 2 == 0) ans += a/2;
    else ans += a/2 + 2;
    System.out.println(ans);
  }

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

Measured memory_bytes: 21844
#include<stdio.h>
#include<math.h>
int main(void){
    int N, T, A;
    scanf("%d",&N);
    scanf("%d %d",&T, &A);
    int H[N];
    for(int i = 0; i < N; i++){
        scanf("%d",&H[i]);
    }

    double temp[N];
    for(int i = 0; i < N; i++){
        temp[i] = (double)T - H[i]*0.006;
        // printf("%0.3f\n",temp[i]);
        temp[i] = fabs(temp[i] - A);
        // printf("差 %0.3f\n",temp[i]);
    }//temp[i]にはAとの差が入っている

    double min = temp[0];
    int index = 1;
    for(int i = 1; i < N; i++){
        if(min > temp[i]){
            min  = temp[i];
            index = i + 1;
        } 
    }

    printf("%d\n",index);

    return 0;
}


Measured memory_bytes: 128
import java.util.*;
public class Main {
    
    public static void main(String args[]){
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        HashMap<String,Integer> num = new HashMap<>();
        for (int i = 0; i < N; i++) {
            String s = scanner.next();
            int[] count = new int[26];
            for (int j = 0; j < 10; j++) {
                char sj = s.charAt(j);
                count[sj-'a']++;
            }
            String val = "";
            for(int j=0; j<26; j++){
                val += String.valueOf('a'+count[j]);
            }
            num.putIfAbsent(val, 0);
            num.put(val,num.get(val) + 1);
        }
        long ans = 0;
        for(Integer n:num.values()){
            ans += (long)n*(long)(n-1)/2;
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 290860
#include <bits/stdc++.h>
#define dum(x) cout<<#x<<'='<<x<<endl
#define ll long long
using namespace std;

int main() {
  int n;
  cin >> n;
  if (n < 1000) {
    cout << "ABC" << endl;
  } else {
    cout << "ABD" << endl;
  }
}


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

int main(){
  int X,A,B;
  cin>>X>>A>>B;
  
  if((X+A>=B)&&(A>=B)){
    cout<<"delicious"<<endl;
  }
  else if((X+A>=B)&&(A<B)){
    cout<<"safe"<<endl;
  }
  else {cout<<"dangerous"<<endl;
      }
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES

#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <iterator>
#include <cmath>
#include <complex>

#include <string>
#include <cstring>
#include <vector>
#include <bitset>

#include <queue>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <ctime>
////
//#include <random>//
/////////

typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;

////定数
const int INF = (int)1e9 + 10;
const LL MOD = (LL)1e9 + 7;
const LL LINF = (LL)4e18 + 20;
const LD PI = acos(-1.0);
const double EPS = 1e-9; 
/////////
using namespace::std;
template<typename T>
void chmax(T& a, T b) {
	a = max(a, b);
}

template<typename T>
void chmin(T& a, T b) {
	a = min(a, b);
}

template<typename T>
void IN(vector<T> &A,int N=-1) {
	if (N == -1) {
		N = A.size();
	}
	for (int i = 0; i < N; ++i) {
		cin >> A[i];
	}
}

template<typename T>
void SO(vector<T> &A,bool F=false) {
	sort(A.begin(), A.end());
	if (F) {
		reverse(A.begin(), A.end());
	}
}
//////////////
//最大公約数
LL gcd(LL a, LL b) {
	if (b == 0) {
		return a;
	}
	else {
		return gcd(b, a % b);
	}
}

//最小公倍数
LL lcm(LL a, LL b) {
	return a / gcd(a, b) * b;
}

int f(LL a) {
	int cnt = 0;
	while (a % 2 == 0) {
		a /= 2;
		++cnt;
	}
	return cnt;
}

void solve() {
	int N, M;
	cin >> N >> M;
	vector<LL> A(N);
	
	for (int i = 0; i < N; ++i) {
		cin >> A[i];
	}
	int ter = f(A[0]);
	
	for (int i = 1; i < N; ++i) {
		if (ter != f(A[i])) {
			cout << 0 << endl;
			return;
		}
	}
	for (int i = 0; i < N; ++i) {
		while (A[i] % 2 == 0) {
			A[i] /= 2;
		}
	}
	LL AA = A[0];
	for (int i = 1; i < N; ++i) {
		AA = lcm(AA, A[i]);
	}
	while (ter > 1) {
		AA *= 2;
		--ter;
	}
	cout << M / AA  - M/(AA*2)<< endl;
}

signed main(void) {
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cout << std::fixed;//小数を10進数表示
	cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別	

	solve();
}


Measured memory_bytes: 1024
#include<cstdio>
#include<iostream>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<vector>
#define ll long long
#define INF 0x3f3f3f3f
using namespace std;
const int N=1e5+5;
template<class T>inline void read(T &res)
{
char c;T flag=1;
while((c=getchar())<'0'||c>'9')if(c=='-')flag=-1;res=c-'0';
while((c=getchar())>='0'&&c<='9')res=res*10+c-'0';res*=flag;
}
int n;
map<string,int>m;
int main(){
	cin>>n;
	string s;
	int mx=0;
	for(int i=1;i<=n;i++){
		cin>>s;
		m[s]++;
		mx=max(mx,m[s]);
	}
	map<string,int>::iterator it;
	for(it=m.begin();it!=m.end();it++){
		if(it->second==mx)cout<<it->first<<endl;
	}
	return 0;
}


Measured memory_bytes: 25216
#include <algorithm>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <queue>
#include <stack>
#include <utility>
#include <vector>
using std::cin;
using std::cout;
using std::endl;

int main(void) {
    cout << std::fixed << std::setprecision(10);
    cin.tie(0);
    std::ios::sync_with_stdio(false);
    int n, p[20000];
    cin >> n;
    int t1;
    for (int i = 0; i < n; i++) {
        cin >> p[i];
    }

    int64_t a[20001], b[20001];
    for (int i = 1; i <= n; i++) {
        a[i] = 20000 * (i - 1) + 1;
    }
    int64_t target = 20000 * (n - 1) + 2;
    for (int i = 0; i < n; i++) {
        int pos = p[i];
        b[pos]  = target - a[pos];
        target++;
    }
    for (int i = 1; i < n; i++) {
        cout << a[i] << " ";
    }
    cout << a[n] << endl;
    for (int i = 1; i < n; i++) {
        cout << b[i] << " ";
    }
    cout << b[n] << endl;

    return 0;
}


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

int main()
{
    long long n, m, price, quantity;
    cin >> n >> m;
    vector<pair<long long , long long>> inp(n);

    for(int i = 0; i < n; ++i)
    {
        cin >> price >> quantity;
        inp[i].first = price;
        inp[i].second = quantity;
    }
    sort(inp.begin(), inp.end());
    long long can = 0;
    long long yen = 0;
    for(int i = 0; i < n; ++i)
    {
        if(inp[i].second < m)
        {
            can += inp[i].second;
            yen += inp[i].second*inp[i].first;
            m -= inp[i].second;
        }
        else
        {
            can += m;
            yen += m*inp[i].first;
            m = 0;
        }
        if( m == 0)
            break;
    }
    cout << yen << "\n";
}


Measured memory_bytes: 1792
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 500001), 500000)
	return scanner
}

func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}

func main() {
	fp := os.Stdin
	if len(os.Args) > 1 {
		fp, _ = os.Open(os.Args[1])
	}

	scanner := getScanner(fp)

	writer := bufio.NewWriter(os.Stdout)

	n := getNextInt(scanner)

	im := IntMap{}
	for i := 0; i < n; i++ {
		a := getNextInt(scanner)
		im.increment(a)
	}

	ans := 0
	for _, c := range im {
		if c%2 != 0 {
			ans++
		}
	}

	fmt.Fprintln(writer, ans)

	writer.Flush()
}

// IntMap ...
type IntMap map[int]int

func (m IntMap) get(key int) int {
	if _, ok := m[key]; ok {
		return m[key]
	}
	return 0
}
func (m IntMap) increment(key int) {
	if _, ok := m[key]; ok == false {
		m[key] = 0
	}
	m[key]++
}


Measured memory_bytes: 7808
#include<cstdio>
#include<algorithm>
#define N 100000
#define MAX (1<<31)-1
using namespace std;
long long A[N+1], T[4*N+1], lazy[4*N+1];

void build(int l, int r, int k) {
    if (l == r) {
        T[k] = A[l];
        return;
    }
    int mid = (l + r) / 2;
    build(l, mid, k * 2);
    build(mid + 1, r, k * 2 + 1);
    T[k] = T[2 * k] + T[2 * k + 1];
}
void pushdown(int k, int l, int r, int mid) {
    if (lazy[k]) {
        lazy[2*k] += lazy[k];
        lazy[2*k+1] += lazy[k];
        T[2*k] += lazy[k]*(mid-l+1);
        T[2*k+1] += lazy[k]*(r-mid);
        lazy[k] = 0;
    }
}
void updata(int L, int R, int data ,int l, int r ,int k) {
    if (L <= l && r <= R) {
        T[k] += data*(r-l+1);
        lazy[k] += data;
        return;
    }
    int mid = (l + r) / 2;
    pushdown(k, l, r, mid);
    if (mid >= L) updata(L, R, data, l, mid, 2*k);
    if (mid < R) updata(L, R, data, mid+1, r, 2*k+1);
    T[k] = T[2 * k] + T[2 * k + 1];
}
long long find(int L, int R, int l, int r, int k) {
    if (L <= l && r <= R) return T[k];
    int mid = (l + r) / 2;
    pushdown(k, l, r, mid);
    long long ans = 0;
    if (mid >= L) ans = ans + find(L, R, l, mid, k * 2);
    if (mid < R) ans = ans + find(L, R, mid + 1, r, k * 2 + 1);
    return ans;
}
int main() {
    int n, q;
    scanf("%d%d", &n, &q);
    for (int i = 0; i <= n; i++)
        A[i] = 0;
    for (int i = 0; i <= 4*n; i++)
        lazy[i] = 0;
    build(1, n, 1);
    int com, s, t, x, y;
    while (q--) {
        scanf("%d", &com);
        if (com == 0) {
            scanf("%d%d%d", &s, &t, &x);
            updata(s, t, x, 1, n, 1);
        }
        else {
            scanf("%d%d", &s, &t);
            printf("%ld\n", find(s, t, 1, n, 1));
        }
    }
    return 0;
}


Measured memory_bytes: 8648
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
	string s; cin >> s;
	for(int i=0;i<s.size()-1;i++){
		if(s[i]=='A' && s[i+1]=='C'){
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
import sys

N = int(input())
list = [[0] * 2 for i in range(N)]
for i in range(N):
    list[i][0],list[i][1] = map(int, input().split())

list = sorted(list, key=lambda x:x[1])
Sum = 0

for i in range(N):

    Sum += list[i][0]

    if Sum > list[i][1]:
        print("No")
        sys.exit()

print("Yes")

Measured memory_bytes: 75372
X=int(input())

factors=[]
for i in range(1,int(X**0.5)+1):
    if X%i==0:
        factors.append(i)
        if i!= X//i:
            factors.append(X//i)

for C in factors:
    for A in range(1000):
        B=A-C
        if A**5-B**5==X:
            print(A,B)
            exit()

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

typedef struct {
  int par, lch, rch;
} node;

#define MAX_N 25

int n;
node T[MAX_N];

void preOrder(int u) {
  printf(" %d", u);
  if(T[u].lch != -1) preOrder(T[u].lch);
  if(T[u].rch != -1) preOrder(T[u].rch);
}

void inOrder(int u) {
  if(T[u].lch != -1) inOrder(T[u].lch);
  printf(" %d", u);
  if(T[u].rch != -1) inOrder(T[u].rch);
}

void postOrder(int u) {
  if(T[u].lch != -1) postOrder(T[u].lch);
  if(T[u].rch != -1) postOrder(T[u].rch);
  printf(" %d", u);
}

int main() {
  int root = -1;
  int i;

  for(i = 0; i < MAX_N; i++) {
    T[i] = (node){-1, -1, -1};
  }

  scanf("%d", &n);
  for(i = 0; i < n; i++) {
    int id, lch, rch;
    scanf("%d %d %d", &id, &lch, &rch);
    T[id].lch = lch;
    T[id].rch = rch;
    if(lch != -1) T[lch].par = id;
    if(rch != -1) T[rch].par = id;
  }

  for(i = 0; i < n; i++) {
    if(T[i].par == -1) root = i;
  }

  puts("Preorder");
  preOrder(root);
  puts("");
  puts("Inorder");
  inOrder(root);
  puts("");
  puts("Postorder");
  postOrder(root);
  puts("");

  return 0;
}

Measured memory_bytes: 612
#define _USE_MATH_DEFINES
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <clocale>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;

#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i, s, n) for(int i = (s), i##_len=(n); i < i##_len; ++i)
#define FORS(i, s, n) for(int i = (s), i##_len=(n); i <= i##_len; ++i)
#define VFOR(i, s, n) for(int i = (s); i < (n); ++i)
#define VFORS(i, s, n) for(int i = (s); i <= (n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define REPS(i, n) FORS(i, 0, n)
#define VREP(i, n) VFOR(i, 0, n)
#define VREPS(i, n) VFORS(i, 0, n)
#define RFOR(i, s, n) for(int i = (s), i##_len=(n); i >= i##_len; --i)
#define RFORS(i, s, n) for(int i = (s), i##_len=(n); i > i##_len; --i)
#define RREP(i, n) RFOR(i, n, 0)
#define RREPS(i, n) RFORS(i, n, 0)
#define ALL(v) (v).begin(), (v).end()
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort(ALL(v), greater<decltype(v[0])>())
#define SZ(x) ((int)(x).size())
#define REV(x) reverse(ALL(x))
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define MT make_tuple
#define BIT(n) (1LL<<(n))
#define UNIQUE(v) v.erase(unique(ALL(v)), v.end())

using ld = long double;
using ll = long long;
using ui = unsigned int;
using ull = unsigned long long;
using Pi_i = pair<int, int>;
using Pll_ll = pair<ll, ll>;
using VB = vector<bool>;
using VC = vector<char>;
using VD = vector<double>;
using VI = vector<int>;
using VLL = vector<ll>;
using VS = vector<string>;
using VSH = vector<short>;
using VULL = vector<ull>;

const int MOD = 1000000007;
const int INF = 1000000000;
const int NIL = -1;
const double EPS = 1E-10;

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


int main(){
    int N; cin >> N;
    ll prv = 0;
    map<ll, ll> mp;
    mp[0] = 1;
    REP(i, N){
        int A; cin >> A;
        prv += A;
        ++mp[prv];
    }
    ll ans(0);
    for(auto itr = mp.begin(); itr != mp.end(); ++itr){
        ll num = itr->second;
        ans += num * (num-1) / 2;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 12800
#include <stdio.h>
#include <string.h>
//subgoals
//1. scan semua input
//2. cari jumlah AC,WA,TLE,RE

int main (){
	int N, AC=0, WA=0,TLE=0, RE=0;
	scanf ("%d",&N);
	
	for (int i=0; i<N;i++){
	
	char str [255];
	scanf ("%s",str);
	
	if (strcmp(str,"AC")==0){//"AC" - "AC"=0
		AC++;
	}else if (strcmp(str,"WA")==0){ //if str is WA
		WA++;
	}else if (strcmp(str,"TLE")==0){//if str is TLE
		TLE++;
	}else if (strcmp(str,"RE")==0){//if str i RE
 		RE++;
	}
}
	printf ("AC x %d\n ",AC);
	printf ("WA x %d\n ",WA);
	printf ("TLE x %d\n ",TLE);
	printf ("RE x %d\n ",RE);
	return 0;
}

Measured memory_bytes: 1692
/*
    AUTHOR:shivam51
    IIESTS
*/
  #include<bits/stdc++.h>
  using namespace std;
  //
  #define add accumulate
  #define ll long long int
  #define ff first
  #define ss second
  #define pb push_back
  #define mp make_pair
  #define vll vector<ll>
  #define lb lower_bound
  #define ub upper_bound
  #define pll pair<ll,ll>
  #define vpll vector<pll>
  #define all(v) v.begin(), v.end()
  #define rep(i,k,n) for(int i=k;i<n;i++)
  #define hs ios_base::sync_with_stdio(false);cin.tie(NULL);
  const int md=1e8;
  const int MAX=1e5+1;
  //
  //
  int main(){
  	ll n,m;
  	cin>>n>>m;
  	ll ans=0;
  	vector<vll> vec(m);
  	rep(i,0,m){
  		ll k,p;
  		cin>>k;
  		rep(j,0,k){
  			cin>>p;
  			vec[i].pb(--p);
  		}
  	}
  	int arr[m];
  	rep(i,0,m)
  		cin>>arr[i];
  	rep(i,0,1<<n){
  		string str;
  		rep(j,0,10){
  			if((i&(1<<j))>0)
  				str+='1';
  			else
  				str+='0';
  		}
  		int flag=1;
  		rep(j,0,m){
  			ll pre=0;
  			rep(t,0,vec[j].size())
  				pre=pre+str[vec[j][t]]=='1';
  			if(pre%2!=arr[j]){
  				flag=0;
  				break;
  			}
  		}
  		if(flag)
  			++ans;
  	}
  	cout<<ans;
  	return 0;
  }

Measured memory_bytes: 256
def f(N,K):
    n=len(str(N))
    if n==1:
        if K==1:
            return N
        else:
            return 0
    elif n==2:
        if K==1:
            return 9+N//10
        elif K==2:
            return N-9-N//10
        else:
            return 0
    elif n==3:
        if K==1:
            return 18+N//100
        elif K==2:
            return 81+18*((N//100)-1)+f(N%100,1)
        else:
            return 81*((N//100)-1)+f(N%100,2)
    else:
        if K==1:
            return 9*(n-1)+N//(10**(n-1))
        elif K==2:
            return 81*(n-1)*(n-2)/2+9*(n-1)*((N//((10**(n-1))))-1)+f(N%(10**(n-1)),1)
        else:
            return 243*(n**3-6*(n**2)+11*n-6)/2+81*(n-1)*(n-2)*((N//(10**(n-1)))-1)/2+f(N%(10**(n-1)),2)
N=int(input())
K=int(input())
print(int(f(N,K)))

Measured memory_bytes: 9252
n = int(input())

f = [0] * (n+1)

for x in range(1, 101):
    for y in range(1, 101):
        for z in range(1, 101):
            s = x**2 + y**2 + z**2 + x*y + y*z + z*x
            if s < n + 1:
                f[s] += 1

for i in range(n):
    print(f[i+1])

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

int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	int n; cin>>n;
	vector<int>a(n); for(auto&&i:a)cin>>i;
	sort(a.rbegin(),a.rend());
	vector<int>v(1,a.front());
	int i=1;
	while(v.size()<n){
		v.emplace_back(a.at(i));
		v.emplace_back(a.at(i));
		++i;
	}
	cout<<accumulate(v.begin(),v.begin()+n-1,0L)<<"\n"s;
}

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

using namespace std;

typedef long long LL;
LL v[111];

//LL gcd(LL a, LL b) {
//
//}

int main() {
    int n;
    while(cin >> n) {
        LL ans = 0;
        for(int i = 1; i <= n; i++) {
            scanf("%lld", &v[i]);
        }
        ans = v[1];
        for(int i = 2; i <= n; i++) {
            ans = v[i]/__gcd(v[i], ans)*ans;

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

/*
4
4
abcd
*/


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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define RFOR(i,n,m) for(int i=(int)(n); i>=(int)(m); i--)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

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 (a>b) { a=b; return 1; } return 0; }

#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

/* Some Libraries */

//-------------------------------------------------

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin>>n;
    set<char> s;
    rep(i,n){
        char c; cin>>c;
        s.ins(c);
    }
    if (s.size()==3){
        cout<<"Three\n";
    }else{
        cout<<"Four\n";
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fi first
#define se second
#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define rrep(i, n) for (int (i) = 1; (i) <= (n); (i++))
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define pb push_back
#define eb emplace_back
#define yn {puts("Yes");}else {puts("No");}
#define printd(x) printf("%.12f\n", x);
template<class T> bool chmin(T& a, const T& b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> bool chmax(T& a, const T& b) {if (a < b) {a = b; return 1;} return 0;}
using namespace std;
using ll = long long;
using P = pair<int, int>;

set<ll> st;

void dfs(ll n, bool ok3, bool ok5, bool ok7) {
	if (to_string(n).size() >= 12) return;
	if (ok3 && ok5 && ok7) st.insert(n);
	dfs(n * 10 + 3, true, ok5, ok7);
	dfs(n * 10 + 5, ok3, true, ok7);
	dfs(n * 10 + 7, ok3, ok5, true);
}

int main(void) {
	int n;
	cin >> n;
	
	dfs(0, false, false, false);

	int ans = 0;
	for (auto idx = st.begin(); idx != st.end(); idx++) {
		if (*idx > n) break;
		ans++;
	}

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

Measured memory_bytes: 12160
<?php

while ($stdin = fgets(STDIN)) {
    $line[] = trim($stdin);
}
foreach ($line as $key => $value) {
    $data[] = explode(' ', $value);
}

//foreach ($data as &$line) {
//    $line = array_map(function($val) { return (int)$val; }, $line);
//}


$s = $data[0][0];
$ans = '';

for ($i = 0; $i < strlen($s); $i++) {
    $code = substr($s, $i, 1);
    if ($code === '0') {
        $ans .= '0';
    } else if ($code === '1') {
        $ans .= '1';
    } else if ($code === 'B') {
        $ans = substr($ans, 0, -1);
    }
}

printf('%s', $ans);


Measured memory_bytes: 4728
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;


public class C
{
	public static void Main()
	{
		int N = Int32.Parse(Console.ReadLine());
		
		string[] args;
		int[] F = new int[N];
		for(int i = 0; i < N; i++)
		{
			args = Console.ReadLine().Split(' ');
			for(int j = 0; j < 5; j++)
			{
				for(int k = 0; k < 2; k++)
				{
					int term = 2 * j + k;
					F[i] |= (Int32.Parse(args[term]) << term);
				}
			}
		}

		int[,] P = new int[N,11];
		for(int i = 0; i < N; i++)
		{
			args = Console.ReadLine().Split(' ');
			for(int j = 0; j <= 10; j++)
			{
				P[i,j] = Int32.Parse(args[j]);
			}
		}

		int ans = Int32.MinValue;
		for(int mask = 1; mask < (1 << 10); mask++)
		{
			int tmp = 0;
			for(int i = 0; i < N; i++)
			{
				int num = (int)popcount((ulong)(mask & F[i]));
				tmp += P[i,num];
			}
			ans = Math.Max(ans, tmp);
		}

		Console.WriteLine(ans);		
	}

	private static ulong popcount(ulong x)
	{
		ulong c = 0;
    	c = (x & 0x5555555555555555) + ((x>>1) & 0x5555555555555555);
    	c = (c & 0x3333333333333333) + ((c>>2) & 0x3333333333333333);
    	c = (c & 0x0f0f0f0f0f0f0f0f) + ((c>>4) & 0x0f0f0f0f0f0f0f0f);
    	c = (c & 0x00ff00ff00ff00ff) + ((c>>8) & 0x00ff00ff00ff00ff);
    	c = (c & 0x0000ffff0000ffff) + ((c>>16) & 0x0000ffff0000ffff);
    	c = (c & 0x00000000ffffffff) + ((c>>32) & 0x00000000ffffffff);
    	return(c);
	}
}





Measured memory_bytes: 13140
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <math.h>
#include <cassert>
#define rep(i,n) for(int i = 0; i < n; ++i )
using namespace std;
using ll = long long;
using P = pair<int,int>;

map<string,int> ans = {
  {"SUN",7},
  {"MON",6},
  {"TUE",5},
  {"WED",4},
  {"THU",3},
  {"FRI",2},
  {"SAT",1},
};

int main() {
  string s;
  cin >> s;
  cout << ans[s] << endl;
}


Measured memory_bytes: 256
import java.io.BufferedReader
import java.io.InputStream
import java.io.InputStreamReader
import java.util.*

fun main(args : Array<String>) {
    val scan = FastScanner(System.`in`)

    var s = scan.next()
    val q = Integer.parseInt(scan.next())

    var rvFlag = false

    val front = mutableListOf<String>()
    val end = mutableListOf<String>()

    repeat(q) {
        val q1 = Integer.parseInt(scan.next())

        if (q1 == 1) {
            rvFlag = !rvFlag
        } else {
            val q2 = Integer.parseInt(scan.next())
            val c = scan.next()

            if (rvFlag) {
                if (q2 == 1) {
                    end.add(c)
                } else {
                    front.add(c)
                }
            } else {
                if (q2 == 1) {
                    front.add(c)
                } else {
                    end.add(c)
                }
            }
        }
    }

    s = front.reversed().joinToString(separator = "") + s + end.joinToString(separator = "")

    if (rvFlag) {
        println(s.reversed())
    } else {
        println(s)
    }
}

class FastScanner(s: InputStream) {
    private var st = StringTokenizer("")
    private val br = BufferedReader(InputStreamReader(s))

    fun next(): String {
        while (!st.hasMoreTokens()) st = StringTokenizer(br.readLine())

        return st.nextToken()
    }

    fun nextInt() = next().toInt()
    fun nextLong() = next().toLong()
    fun nextLine() = br.readLine()
    fun nextDouble() = next().toDouble()
    fun ready() = br.ready()
}

Measured memory_bytes: 65708
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1001001001;

int h, w, ch, cw, dh, dw;
char mp[1005][1005];
int minwarp[1005][1005];

queue<P> que;

void seeing(int x, int y, int d) {
  for (int dx = -1; dx <= 1; dx++) {
    for (int dy = -1; dy <= 1; dy++) {
      if (0 <= x + dx && x + dx < w && 0 <= y + dy && y + dy < h) {
        if (dx * dy == 0 &&
            (mp[x + dx][y + dy] == '.' || mp[x + dx][y + dy] == 'w')) {
          mp[x + dx][y + dy] = 'v';
          minwarp[x + dx][y + dy] = d;
          seeing(x + dx, y + dy, d);
        }
      }
    }
  }
}

void seeing2(int x, int y, int d) {
  for (int dx = -2; dx <= 2; dx++) {
    for (int dy = -2; dy <= 2; dy++) {
      if (0 <= x + dx && x + dx < w && 0 <= y + dy && y + dy < h) {
        if (mp[x + dx][y + dy] == '.') {
          mp[x + dx][y + dy] = 'w';
          minwarp[x + dx][y + dy] = d + 1;
          que.push(make_pair(x + dx, y + dy));
          // cout << "push: " << x + dx << " " << y + dy << endl;
        }
      }
    }
  }
  for (int dx = -1; dx <= 1; dx++) {
    for (int dy = -1; dy <= 1; dy++) {
      if (0 <= x + dx && x + dx < w && 0 <= y + dy && y + dy < h) {
        if (dx * dy == 0 && mp[x + dx][y + dy] == 'v') {
          mp[x + dx][y + dy] = 'f';
          seeing2(x + dx, y + dy, d);
        }
      }
    }
  }
}

void search(int x, int y, int d) {
  // cout << d << endl;
  seeing(x, y, d);
  seeing2(x, y, d);
}

int main() {
  cin >> h >> w >> ch >> cw >> dh >> dw;
  ch--;
  cw--;
  dh--;
  dw--;
  rep(y, h) rep(x, w) {
    cin >> mp[x][y];
    minwarp[x][y] = INF;
  }
  que.push(make_pair(cw, ch));
  minwarp[cw][ch] = 0;
  while (que.size()) {
    P now = que.front();
    que.pop();
    search(now.first, now.second, minwarp[now.first][now.second]);
  }
  int ans = minwarp[dw][dh] == INF ? -1 : minwarp[dw][dh];
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 8540
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <array>
#include <queue>
#include <map>
#include <set>
#include <sstream>
#include <stdio.h>
#include <cstdio>
#include <cstring>
#include <math.h>
#include <list>

using namespace std;

#define Rep(i,a,b) for(int i = a; i < b; i++)
#define rep(i,b) Rep(i,0,b)
#define rrep(i,a) for(int i = a; i >= 0; i--)
#define allof(a) (a).begin(), (a).end()

typedef long long ll;
const int inf = 1e9 + 7;
const ll infll = 1ll << 60ll;
const ll mod = 1e9 + 7;
// 0~3までは右左下上 4~7までは斜め
constexpr int dx[] = { 1, 0, -1, 0, 1, 1, -1, -1 };
constexpr int dy[] = { 0, -1, 0, 1, 1, -1, -1, 1 };

/*
// 最大公約数
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}

// 最小公倍数
ll lcm(ll a, ll b) {
	return a * b / gcd(a, b);
}
*/

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

	ll n;
	cin >> n;

	ll ans = 0;

	for (ll m = 1; m * m < n; m++){
		// 商がmのとき
		//if((n - m) % m == 0)
			//ans += (n - m) / m;
		if ((n - m) % m != 0) continue;
		ll tmp = (n - m) / m;
		if (n / tmp == m && n % tmp == m) {
			ans += tmp;
		}

	}

	cout << ans << endl;

	return 0;
}


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

#define int long long
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define all(v) (v).begin(),(v).end()
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#define pb push_back
#define fi first
#define se second
template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

signed main(){
    int H,W;
    char fld[10][10];
    cin>>H>>W;
    rep(i,H)cin>>fld[i];

    bool vis[10][10]={};
    int y=-1,x;
    rep(i,H){
        rep(j,W){
            if(fld[i][j]=='#'){
               y=i,x=j;
               break;
            }
        }
        if(y!=-1)break;
    }

    vis[y][x]=true;
    while(true){
        bool f1=false,f2=false;
        if(y+1<H&&fld[y+1][x]=='#')f1=true;
        if(x+1<W&&fld[y][x+1]=='#')f2=true;
        if(f1){
            vis[y+1][x]=true;
            y++;
        }
        else if(f2){
            vis[y][x+1]=true;
            x++;
        }
        else{
            break;
        }
    }

    rep(i,H){
        rep(j,W){
            if(fld[i][j]=='.')continue;
            if(!vis[i][j]){
                cout<<"Impossible"<<endl;
                return 0;
            }
        }
    }
    cout<<"Possible"<<endl;
    return 0;
}


Measured memory_bytes: 256