akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
using ll = long long;
using vec = vector<ll>;
using vect = vector<double>;
using Graph = vector<vector<ll>>;
#define loop(i, n) for (ll i = 0; i < n; i++)
#define Loop(i, m, n) for (ll i = m; i < n; i++)
#define pool(i, n) for (ll i = n; i >= 0; i--)
#define Pool(i, m, n) for (ll i = n; i >= m; i--)
#define mod 1000000007ll
#define flagcount __builtin_popcount
#define flag(x) (1 << x)
#define flagadd(bit, x) bit |= flag(x)
#define flagpop(bit, x) bit &= ~flag(x)
#define flagon(bit, i) bit &flag(i)
#define flagoff(bit, i) !(bit & (1 << i))
#define all(v) v.begin(), v.end()
#define low2way(v, x) lower_bound(all(v), x)
#define high2way(v, x) upper_bound(all(v), x)
#define idx_lower(v, x) (distance(v.begin(), low2way(v, x)))  //配列vでx未満の要素数を返す
#define idx_upper(v, x) (distance(v.begin(), high2way(v, x))) //配列vでx以下の要素数を返す
#define idx_lower2(v, x) (v.size() - idx_lower(v, x))         //配列vでx以上の要素数を返す
#define idx_upper2(v, x) (v.size() - idx_upper(v, x))         //配列vでxより大きい要素の数を返す
#define putout(a) cout << a << endl
#define Gput(a, b) G[a].push_back(b)
#define Sum(v) accumulate(all(v), 0ll)
#define gcd(x, y) __gcd(x, y)
ll ctoi(char c)
{
    if (c >= '0' && c <= '9')
    {
        return c - '0';
    }
    return 0;
}
template <typename T>
T lcm(T x, T y)
{
    T z = gcd(x, y);
    return x * y / z;
}
template <typename T>
bool primejudge(T n)
{
    if (n < 2)
        return false;
    else if (n == 2)
        return true;
    else if (n % 2 == 0)
        return false;
    double sqrtn = sqrt(n);
    for (T i = 3; i < sqrtn + 1; i++)
    {
        if (n % i == 0)
        {
            return false;
        }
        i++;
    }
    return true;
}
//場合によって使い分ける
//const ll dx[4]={1,0,-1,0};
//const ll dy[4]={0,1,0,-1};
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};
//2次元配列の宣言
//vector<vector<ll>> field(h, vector<ll>(w));

int main()
{
    cout << fixed << setprecision(30);
    string s;
    cin >> s;
    ll now = ctoi(s[s.size() - 1]);
    if (now == 0 || now == 1 || now == 6 || now == 8)
    {
        putout("pon");
        return 0;
    }
    if (now == 3)
    {
        putout("bon");
        return 0;
    }
    putout("hon");
    return 0;
}


Measured memory_bytes: 3596
#include <stdio.h>

int main(void){
	int count = 0;
	char str[100001], c;

	scanf("%s", str);

	c = str[0];
	for(int i=1; str[i]; i++) {
		if(c != str[i]) {
            c = str[i];
            count++;
		}
	}

	printf("%d", count);

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    vector<int> h(n), tmp(n);
    for (int i = 0; i < n; i++) {
        cin >> h[i]; tmp[i] = h[i];
    }

    bool flag = true;
    for (int i = n-1; i > 0; i--) {
        if (h[i-1]-h[i] == 1) h[i-1]--;
        else if (h[i-1]-h[i] > 0) flag = false;  
    }
    cout << (flag ? "Yes" : "No") << endl;
    return 0;
}

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

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for(int i=0;i<n;i++){
      cin >> a[i];
  }
  int target = 1;
  int result = 0;
  for(int i=0;i<n;i++){
      if(a[i] != target){
          result++;
      }else{
          target++;
      }
  }
  if(target == 1){
      result = -1;
  }
  cout << result;
}

Measured memory_bytes: 1024
// luogu-judger-enable-o2
#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
inline int read()
{
	int r,s=0,c;
	for(;!isdigit(c=getchar());s=c);
	for(r=c^48;isdigit(c=getchar());(r*=10)+=c^48);
	return s^45?r:-r;
}
const int N=200010;
int m,n;
int a[N],b[N];
bool check(int mid)
{
	for(int i=1;i<=n;i++)
		b[i]=(a[i]>=mid);
//.....00.....
// ....00.....
//所以距离中间最近的相邻元素相同的那个数
//若原序列为010101010
	int l=m,r=m;
	while(l>1)
	{
		if(b[l]==b[l-1])return b[l];
		if(b[r]==b[r+1])return b[r];
		l--,r++;
	}
	return b[1];
}
int main()
{
	m=read();
	n=m*2-1;
	for(int i=1;i<=n;i++)a[i]=read();
	int l,r,mid,ans;
	l=1,r=n;
	while(l<=r)
	{
		mid=(l+r)>>1;
		if(check(mid))
		{
			l=mid+1;
			ans=mid;
		}
		else
			r=mid-1;
	}	
	printf("%d\n",ans);
	return 0;
}/*
4
7 3 2 1 5 4 6
4
3 1 5 6 4 2 7 
*/

Measured memory_bytes: 1792
N = int(input())
S = input()
out = ""
A = ord("A")
Z = ord("Z")
for s in S:
  if ord(s)+N > Z:
    out += chr(ord(s)+N-Z+A-1)
  else: #print(ord(s)+N)
    out += chr(ord(s)+N)
print(out)

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <string>
#include <utility>

using namespace std;
typedef long long lint;

int main() {
    int H, W, D;
    cin >> H >> W >> D;
    vector<vector<int> > board(H, vector<int>(W));
    vector<pair<int, int> > ps(H*W);
    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            cin >> board[i][j];
            --board[i][j];
            ps[board[i][j]] = make_pair(i, j);
        }
    }
    vector<vector<int> > accum(D);
    for (int d = 0; d < D; ++d) {
        accum[d].push_back(0);
        pair<int, int> p = ps[d];
        for (int i = 0, j = d+D; j < H*W; i++, j += D) {
            pair<int, int> next = ps[j];
            const int cost = abs(p.first - next.first) + abs(p.second - next.second);
            accum[d].push_back(accum[d][i] + cost);
            p = next;
        }
    }
    int Q;
    cin >> Q;
    for (int q = 0; q < Q; q++) {
        int L, R;
        cin >> L >> R;
        --L; --R;
        int remainder = L%D;
        cout << accum[remainder][R/D] - accum[remainder][L/D] << endl;
    }
    return 0;
}


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

int main() {
    string s;
    cin>>s;
    int a,b;
    a=10*(s[0]-'0')+(s[1]-'0');
    b=10*(s[2]-'0')+(s[3]-'0');
    if(a>=1&&a<=12&&b>=1&&b<=12)
        cout<<"AMBIGUOUS"<<endl;
    else if(a>=1&&a<=12)
        cout<<"MMYY"<<endl;
    else if(b>=1&&b<=12)
        cout<<"YYMM"<<endl;
    else
        cout<<"NA"<<endl;
	return 0;
}


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

using namespace std;


void solve() {
    string s; cin >> s;
    int n = s.size();
    bool ok = true;
    ok &= s[n-1] == '0';
    ok &= s[0] == '1';
    for (int i = 0; i < n-1; i++) {
        ok &= s[i] == s[n-i-2];
    }
    if (!ok) {
        cout << -1; return;
    }
    vector<pair<int, int>> res;
    int crt = 0;
    for (int i = 0; i < n; i++) {
        if (i < n-1 && s[i]=='0') continue;
        for (int j = crt; j < i; j++) {
            res.emplace_back(j, i);
        }
        crt = i;
    }
    for (auto& p: res) {
        int x,y;
        tie(x,y) = p;
        x++; y++;
        cout << x << ' ' << y << "\n";
    }
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
    cout << endl;
}


Measured memory_bytes: 2500
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Linq;
using static MyIO;


public class C
{
	public static void Main() => (new Solver()).Solve();
}


public class Solver
{
	public void Solve()
	{
		int N = GetInt();
		int[] H = GetInts(N);

		int[] cnt = new int[N];
		for(int i = N - 2; i >= 0; i--)
		{
			if(H[i] >= H[i + 1])
				cnt[i] = cnt[i + 1] + 1;
		}

		Console.WriteLine(cnt.Max());
	}
}


public static class MyIO
{
	private static string[] args = null;
	private static int num = -1;
	private static int used = -1;

	private static string getArg()
	{
		if(used == num)
		{
			args = Console.ReadLine().Split(' ');
			num = args.Length;
			used = 0;
		}
		return args[used++];
	}

	public static int GetInt() => int.Parse(getArg());
	public static long GetLong() => long.Parse(getArg());
	public static double GetDouble() => double.Parse(getArg());
	public static string GetString() => getArg();
	public static char GetChar() => getArg()[0];
	public static int[] GetInts(int N) => Enumerable.Range(0, N).Select(_ => GetInt()).ToArray();
	public static long[] GetLongs(int N) => Enumerable.Range(0, N).Select(_ => GetLong()).ToArray();
	public static double[] GetDoubles(int N) => Enumerable.Range(0, N).Select(_ => GetDouble()).ToArray();
	public static string[] GetStrings(int N) => Enumerable.Range(0, N).Select(_ => GetString()).ToArray();
}


Measured memory_bytes: 31324
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define pb push_back
#define eb emplace_back
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define cinarr(A,len) for(int i=0;i<len;i++){cin>>A[i];}
#define coutarr(A,len) for(int i=0;i<len;i++){cout<<A[i]<<' ';}cout<<endl
#define coutin(V) for(auto& i : V){cout << i << ' ';}cout<<endl // for vect and set
#define coutmap(U) for(auto& i : U){cout << i.first << "->" << i.second << ", ";}cout<<endl // for map
#define deb(x) cerr << #x << '\t' << x << endl
const int imax = numeric_limits<int>::max(), imin = numeric_limits<int>::min();
const long long	lmax = numeric_limits<long long>::max(), lmin = numeric_limits<long long>::min();
/*========================================================================*/
/* strategi/note:



/================================*/




bool Svd=0;
void solve(){Svd=1;
	int a,b;
	cin >> a >> b;
	cout << (a<=8 and b<=8 ? "Yay!" : ":(") << endl;

}


/*========================================================================*/

int main(){ios_base::sync_with_stdio(0);cin.tie(0);
//cout<<fixed<<setprecision( ); // iomanip **

 solve();
 //int t;cin>>t;while(t--){solve();}

if(!Svd)cout<<"solve() function blm dipanggil!"<<endl;
//cout.flush(); cin.get();
return 0;
}


Measured memory_bytes: 3616
difficulties, goal = map(int, input().split())

pcs = [list(map(int, input().split())) for _ in range(difficulties)]

total_problem = 0
new_dp = [0] * 1001

for d, pc in enumerate(pcs, 1):
    dp = new_dp[:]

    problem, complete = pc
    total_problem += problem

    score = {x: x*100*d for x in range(problem)}
    score[problem] = problem * 100 * d +complete

    for i in range(1, total_problem + 1):
        for j in range(0, i + 1):
            if i - j > problem:
                continue
            else:
                new_dp[i] = max(new_dp[i], dp[j] + score[i-j])

for i, a in enumerate(new_dp):
    if a >= goal:
        print(i)
        exit()


Measured memory_bytes: 3064
import decimal
import heapq


n = int(input())
vs = list(map(int, input().split()))

heapq.heapify(vs)

# print(vs)
while len(vs) != 1:
    v1 = heapq.heappop(vs)
    v2 = heapq.heappop(vs)
    v = decimal.Decimal(v1) + decimal.Decimal(v2)
    v = v / decimal.Decimal(2)
    
    heapq.heappush(vs, v)

print(vs[0])


Measured memory_bytes: 5076
#include <cstdio>
#include <iostream>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (n); i++)

int x[55];
ll dp[55][55][2550];

int main(void) {
  int n, a;
  cin >> n >> a;
  rep(i, n) { cin >> x[i]; }

  rep(i, 55) rep(j, 55) rep(k, 2550) dp[i][j][k] = 0;
  dp[0][1][x[0]] = 1;
  dp[0][0][0] = 1;
  for (int i = 0; i < n - 1; ++i) {
    for (int j = 0; j <= n; ++j) {
      for (int k = 0; k <= 2500; ++k) {
        if (dp[i][j][k] == 0) continue;
        // i + 1番目を選ぶ
        dp[i + 1][j + 1][k + x[i + 1]] += dp[i][j][k];
        // i + 1選ばない
        dp[i + 1][j][k] += dp[i][j][k];
      }
    }
  }

  ll ans = 0;
  for (int j = 1; j <= n; ++j) {
    int aim = j * a;
    if (aim <= 2500 && dp[n - 1][j][aim] != 0) {
      ans += dp[n - 1][j][aim];
    }
  }
  printf("%lld\n", ans);
  return 0;
}

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

using ll = long long;
using pii = pair<int, int>;
template <class T>
using v = vector<T>;
template <class T>
using vv = v<v<T>>;
#define ALL(c) (c).begin(), (c).end()


int main()
{
    ll N, K;
    cin >> N >> K;
    v<pair<int,int>> array(N);
    for (int i = 0; i < N; i++)
    {
        cin >> array[i].first >> array[i].second;
    }

    sort(ALL(array));

    for (int i = 0; i < N; i++)
    {
        K-=array[i].second;
        if(K<=0){
            cout << array[i].first << endl;
            return 0;
        }
    }   
    return 0;
}

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

int main() {
    ios_base::sync_with_stdio(false);	
    cin.tie(0);
	int s, w;
	cin >> s >> w;
	if (w >= s) cout << "unsafe" << "\n";
	else cout << "safe" << "\n";
	return 0;
}


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

using namespace std;

int main() {

	string find;
	string str;
	int count = 0;
	
	cin >> find >> str;

	while (str != "END_OF_TEXT") {

		for (int i = 0; i < str.size(); i++) {

			if (str[i] >= 65 && str[i] <= 90) {

				str[i] += 32;

			}

		}

		if (find == str) {

			count++;

		}

		cin >> str;

	}

	cout << count << endl;

	return 0;

}


Measured memory_bytes: 3208
#include<stdio.h>
int main(){
  int a,b;
  scanf("%d %d",&a,&b);
  int aa,ab,bb;
  aa=a+a-1;
  ab=a+b;
  bb=b+b-1;
  if(aa>=ab && aa>=bb){
    printf("%d\n",aa);
  }
  else if(ab>=aa && ab>=bb){
    printf("%d\n",ab);
  }
  else if(bb>=ab && bb>=aa){
    printf("%d\n",bb);
  }
  return 0;
}

Measured memory_bytes: 128
#include<algorithm>
#include<bitset>
#include <cassert>
#include<iostream>
#include<vector>
using namespace std;
typedef long long lint;
typedef vector<int>vi;
typedef pair<int,int>pii;
#define rep(i,n)for(int i=0;i<(int)(n);++i)

const int DEBUG = 0;


const int N=DEBUG?20:4000;
typedef bitset<N> bs;
const lint MOD=998244353;

bs read(){
  string s;
  cin>>s;
  int l=s.length();
  bs ret;
  rep(i,l)ret[i]=s[l-i-1]=='1';
  return ret;
}

bs div(bs a, bs b){
  int hi=-1;
  rep(i,N){
    if(b[i]){
      hi=i;
    }
  }
  assert(hi>=0);
  for(int i=N-hi-1;i>=0;--i){
    if(a[i+hi]){
      a^=b<<i;
    }
  }
  return a;
}

bs gcd(bs a,bs b){
  while(b.count()!=0){
    a=div(a,b);
    swap(a,b);
  }
  return a;
}

int main(){
  int n;
  cin>>n;
  bs x=read();
  vector<bs> s(n);
  rep(i,n)s[i]=read();
  bs t=s[n-1];
  rep(i,n-1)
    t=gcd(s[i],t);
  lint ans=0;
  lint cur=1;
  int hi=-1;
  rep(i,N){
    if(t[i]){
      hi=i;
    }
  }
  bs y;
  for(int i=N-hi-1;i>=0;--i){
    if(x[i+hi]!=y[i+hi]){
      y^=t<<i;
    }
  }
  rep(i,N-hi){
    if(x[i+hi])ans=(ans+cur)%MOD;
    cur=cur*2%MOD;
  }
  bool lt=false;
  for(int i=N-1;i>=0;--i){
    if(x[i]!=y[i]){
      lt=x[i]<y[i];
      break;
    }
  }
  if(lt)ans=(ans+MOD-1)%MOD;
  ans=(ans+1)%MOD;
  if(DEBUG){
    cerr<<"x="<<x<<endl;
    cerr<<"y="<<y<<endl;
    cerr<<"t="<<t<<endl;
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 384
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <string>
#include <map>

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (a); i > (b); i--)
#define ALL(a) (a).begin(), (a).end()
#define MOD 1000000007

ll N, X, S[200], dp[100001];

ll power(int x, int y) {
    if (y == 1) return x;
    ll p = power(x, y >> 1);
    if (y & 1) return p * p % MOD * x % MOD;
    else return p * p % MOD;
}

ll inv(ll n) {
    return power(n, MOD - 2);
}

int main() {
    cin >> N >> X;
    REP(i, N) cin >> S[i];
    sort(S, S + N);
    
    dp[X] = 1;
    REP(_, N) REP(i, 100001) {
        if (dp[i] > 0) {
            int cnt = upper_bound(S, S + N, i) - S;
            REP(j, cnt) {
                dp[i % S[j]] += dp[i] * inv(cnt);
                dp[i % S[j]] %= MOD;
            }
            if (cnt > 0) dp[i] = 0;
        }
    }

    ll ans = 0;
    REP(i, 100001) {
        ans += dp[i] * i;
        ans %= MOD;
    }
    FOR(i, 2, N + 1) ans = ans * i % MOD;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <algorithm>

using namespace std;

int main() {
    int R_0, W_0, C, R;
    while (cin >> R_0 >> W_0 >> C >> R) {
        if (R_0 == 0 && W_0 == 0 && C == 0 && R == 0) { break; }

        int t = max(0, C * W_0 - R_0);

        cout << ((t % R == 0) ? t / R : t / R + 1) << endl;
    }
    return 0;
}


Measured memory_bytes: 3096
#include <iostream>
#include <bits/stdc++.h>
#include <algorithm>
#include <vector>
#include <string>
using namespace std;
int main()
{
    ios::sync_with_stdio(0);
   int k,x;
   cin>>k>>x;
   if(k*500>=x)cout<<"Yes";
   else cout<<"No";
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
using namespace std;
int TopIndex = 1;
int DummyKey = 0;

void Insert(vector<int>& Heap, int k)
{
	Heap.push_back(k);
	int InsertIndex = Heap.size() - 1;
	int ParentIndex = (Heap.size() - 1) / 2;
	while(Heap[InsertIndex] > Heap[ParentIndex] && InsertIndex > TopIndex){
		swap(Heap[InsertIndex], Heap[ParentIndex]);
		InsertIndex = ParentIndex;
		ParentIndex = InsertIndex / 2;
	}
}

void maxHeapify(vector<int>& A, int i)
{
	int H = A.size() - 1;
	int l = 2 * i;
	int r = 2 * i + 1;
	//????????????????????????????????§???????????§????????????????????¶
	int largest;
	if(l <= H && A[l] > A[i]){
		largest = l;
	}else{
		largest = i;
	}
	if(r <= H && A[r] > A[largest]){
		largest = r;
	}
	//i???????????????????????§????????´???
	if(largest != i){
		swap(A[i], A[largest]);
		//?????°??????????????????
		maxHeapify(A, largest);
	}
}

void ExtractMax(vector<int>& Heap)
{
	int TailIndex = Heap.size() - 1;
	swap(Heap[TailIndex], Heap[TopIndex]);
	cout << Heap[TailIndex] << endl;
	Heap.pop_back();
	maxHeapify(Heap, TopIndex);
}

int main()
{
	vector<int> Heap(1, DummyKey);
	while(true){
		string Command;
		cin >> Command;
		if(Command == "insert"){
			int k;
			cin >> k;
			Insert(Heap, k);
		}else if(Command == "extract"){
			ExtractMax(Heap);
		}else{
			break;
		}
	}
	return 0;
}

Measured memory_bytes: 6968
object Main extends App {
  import scala.io.StdIn._
  sealed class Person(val toIndex: Int)

  object J extends Person(1)
  object O extends Person(2)
  object I extends Person(4)
  object Person{
    val persons: List[Person] = List(J, O, I)
  }
  val mod = 10007
  val n = readLine.trim.toInt
  val res = readLine.trim.map{
    case 'J' ⇒ J
    case 'O' ⇒ O
    case _ ⇒ I
  }.toList
  println(
    solve(res, J.toIndex)
  )
  def solve(responsibility: List[Person], prePerson: Int, length: Int = 0)(implicit memo: Array[Array[Option[Int]]] = Array.tabulate(responsibility.length){_ ⇒ Array.tabulate(8){_ ⇒ None: Option[Int]}}): Int = {
    if (memo.length > length){
      memo(length)(prePerson) match {
        case Some(r) ⇒ r
        case None ⇒
          (responsibility match {
            case Nil ⇒ 1
            case h::t if (h.toIndex & prePerson) != 0 ⇒ Person.persons.filter(p ⇒ p != h).subset.map(l ⇒ solve(t, l.map(_.toIndex).foldLeft(h.toIndex){case (a, b) ⇒ a | b}, length + 1)).sum
            case h::t ⇒ Person.persons.filter(p ⇒ p != h).subset.map(l ⇒ l.map(_.toIndex).foldLeft(h.toIndex){case (a, b) ⇒ a | b}).filter(p ⇒ (p & prePerson) != 0).map(p ⇒ solve(t, p, length + 1)).sum
          }).let(_ % mod).also(i ⇒ memo(length)(prePerson) = Some(i))
      }
    }else 1
  }
  implicit class RichList[T](val list: List[T]) {
    def subset: List[List[T]] = subset(list)
    private def subset(li:List[T]): List[List[T]] = {
      li match {
        case Nil ⇒ Nil
        case h::Nil ⇒ List(h::Nil, Nil)
        case h::t ⇒ subset(t).flatMap(l ⇒ List(h::l, l))
      }
    }
  }
  implicit class ScopeFunc[T](value: T){
    def let[A](func: T ⇒ A): A = func(value)
    def also(func: T ⇒ Unit): T = {
      func(value)
      value
    }
  }
}


Measured memory_bytes: 55352
#include <bits/stdc++.h>
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define ll long long
using namespace std;

const ll P = 1000000007;
int gcd(int a, int b) { return b != 0 ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }

int main()
{
  cout << fixed << setprecision(10);
  int sx,sy,tx,ty;
  cin >> sx >> sy >> tx >> ty;
  rep(i,ty-sy)
  {
    cout << "U";
  }
  rep(i,tx-sx)
  {
    cout << "R";
  }
  rep(i,ty-sy)
  {
    cout << "D";
  }
  rep(i,tx-sx)
  {
    cout << "L";
  }
  cout << "L";
  rep(i,ty-sy+1)
  {
    cout << "U";
  }
  rep(i,tx-sx+1)
  {
    cout << "R";
  }
  cout << "D";
  cout << "R";
  rep(i,ty-sy+1)
  {
    cout << "D";
  }
  rep(i,tx-sx+1)
  {
    cout << "L";
  }
  cout << "U" << endl;
  return 0;
}


Measured memory_bytes: 3644
n = int(input())
A = list(map(int, input().split()))
C = {}
for a in A:
    if a in C:
        C[a] += 1
    else:
        C[a] = 1

s = int(sum(c * (c - 1) / 2 for c in C.values()))
for a in A:
    print(int(s - C[a] + 1))


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

using namespace std;

int main(void){
//string S;
int K;
int X;
cin >> K >> X;
/*vector<int> P(N);

for(int i = 0; i < N; i++){
  cin >> P[i];
}

vector<int> PP;

PP.push_back(P[0]);
for(int i = 1; i < P.size(); i++){
  if(P[i] <= PP.back()){
    PP.push_back(P[i]);
  }
}*/
if(500*K >= X) cout << "Yes" << endl;
if(500*K < X) cout << "No" << endl;
return 0;
}


Measured memory_bytes: 256
MOD=10**9+7
N,M = [int(s) for s in input().split()]
ans=[1 for s in range(N+2)]
ans[N+1]=0
for i in range(M):
  ans[int(input())]=0
for i in range(1,N+1):
  if(ans[i]!=0):
    ans[i]=(ans[i-1]+ans[i-2])%MOD
print(ans[N])

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

const ll inf = 1e10;

int main() {
	ll h, n;
	cin >> h >> n;
	vector<ll> a(n), b(n);
	for (ll i = 0; i < n; ++i)cin >> a[i] >> b[i];
	vector<vector<ll>> dp(n, vector<ll>(2e4 + 10, inf));//i番目までの魔法で体力j削る最小の魔力の消費
	for (ll i = 0; i < n; ++i)dp[i][0] = 0;
	ll i;
	for (i = 0; i * a[0] < h; ++i)dp[0][i * a[0]] = i * b[0];
	dp[0][i * a[0]] = i * b[0];
	for (ll i = 1; i < n; ++i) {
		dp[i] = dp[i - 1];
		for (ll j = a[i]; j < h + a[i]; ++j) {
			dp[i][j] = min(dp[i][j], dp[i][j - a[i]] + b[i]);
		}
	}
	cout << *min_element(dp.back().begin() + h, dp.back().end()) << endl;
}


Measured memory_bytes: 160384
#define _USE_MATH_DEFINES
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>
#include <random>
#include <ctime>

using namespace std;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;

int main() {
  int64 n;
  cin >> n;
  cout << n * (n - 1) / 2 << endl;
  return 0;
}


Measured memory_bytes: 256
using System;

class Problem
{
  public static void Main()
  {
    var inputs = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
    int H = inputs[0], W = inputs[1];

    for (var i = 0; i < W+2; i++) Console.Write("#");
    Console.Write("\n");
    for (var j = 0; j < H; j++)
    {
      Console.Write("#");
      Console.Write(Console.ReadLine());
      Console.Write("#\n");
    }
    for (var k = 0; k < W+2; k++) Console.Write("#");
  }
}

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

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

  if(a==b){
    cout << a << endl;
    return 0;
  }
  long long ans = 0;
  if(a%2==1){
    ans+=a;
    a++;
  }
  if(a!=b){
    long long dis = b-a+1;
    long long cnt = dis/2;
    ans = ans ^ (cnt%2);
  }
  if(b%2==0) ans = ans^b;
  cout << ans << endl;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
	"sync"
)

func main() {
	var n, a, b int
	fmt.Scan(&n, &a, &b)

	var mu = &sync.Mutex{}
	var wg sync.WaitGroup
	var inRanges []int

	for i := n; i > 0; i-- {
		wg.Add(1)
		go func(i int) {
			defer wg.Done()

			digitTotal := 0
			tempValue := i
			for tempValue > 0 {
				digitTotal += tempValue%10
				tempValue /= 10
			}

			if a <= digitTotal && digitTotal <= b {
				mu.Lock()
				inRanges = append(inRanges, i)
				mu.Unlock()
			}
		}(i)
	}

	wg.Wait()

	sum := 0
	for _, v := range inRanges {
		sum += v
	}

	fmt.Println(sum)
}


Measured memory_bytes: 4216
n = int(input()) 
from collections import deque
from copy import deepcopy
d = deque()
a = list(map(int,input().split()))
c = 0
for i in range(len(a)):
    d.append(a[i])
def wat(a):
    global c
    if len(a) != 0:
        while a[0] != 0:
            c += 1
            for i in range(len(a)):
                if a[i] >0 :
                    a[i] = a[i] - 1
                else:
                    break
        b = deepcopy(a)
        for i in range(len(b)):
            if a[i] == 0:
                b.popleft()
            else:
                break
        wat(b)
wat(d)
print(c)

Measured memory_bytes: 3564
#include<stdio.h>
int main()
{
    int a,b,c;
    scanf("%d %d %d",&a,&b,&c);
    
    if(a<b&&b<c)
    { 
        printf("Yes\n");
    }
    else
    {
    printf("No\n");
    }
return 0;
}


Measured memory_bytes: 2564
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define INF 1000000010
#define EPS 1e-9
#define fst first
#define scd second

#define debug(x) cout<<x<<endl;
#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define lp(i,n) repi(i,0,n)
#define repn(i,n) for(int i=n;i>=0;i--)
#define int long long
#define endl "\n"


signed main(){
  cin.tie(0);	
  ios::sync_with_stdio(false);
  string s;
  cin>>s;
  map<char,int> mp;
  rep(i,s.size() ){
    mp[s[i]]++;
  }
  if(mp['S']>0 && mp['N']>0){
    if(mp['E']>0 && mp['W']>0){cout<<"Yes"<<endl;return 0;}
    if(mp['E']==0 && mp['W']==0){cout<<"Yes"<<endl;return 0;}
  }
  if(mp['S']==0 && mp['N']==0){
    if(mp['E']>0 && mp['W']>0){cout<<"Yes"<<endl;return 0;}
    if(mp['E']==0 && mp['W']==0){cout<<"Yes"<<endl;return 0;}
  }
  cout<<"No"<<endl;
  return 0;
}


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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;

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

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG2(x,y) cout<<#x<<": "<<x<<" "<<#y<<": "<<y<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define DEBUG_ARR(v,n) cout<<#v<<":";REP(i,n)cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD
ll x;
ll a,b;
template <typename T>
bool isOK(T mid){
    //DEBUG(pow(a,5) - pow(mid,5LL));
    return (pow(a,5) - pow(mid,5LL)) < x;
}
template <typename T>
T binary_search() {
    T ok = numeric_limits<T>::max(), ng = 0;
    while (abs(ok-ng) > 1) {
        
        T mid = (ok + ng) / 2;
        //DEBUG(mid);
        if (isOK<T>(mid)) ok = mid;
        else ng = mid;
    }

    return ok;
}
int main() {
    ios::sync_with_stdio(false); cin.tie(0);
    cin>>x;
    //ll ans;

    ll st = -1000;
    //int st = -20;
    //DEBUG(pow(st,5LL));
    vl v(abs(st)*2+1);
    FOR(i,st,-st+1){
        v[i - st] = pow(i,5LL);
    }

    //DEBUG_ARR(v,100);
    //a-b=x
    //b=a-x
    for(int i=0; i<v.size(); i++){
        double tmp = v[i] - x;
        //DEBUG2(v[i], tmp);

        // if(tmp==-1.0){
        //     cout<<i+st<<" "<<"-1"<<endl;
        //     return 0;
        // }
        // else if(tmp==0.0){
        //     cout<<i+st<<" "<<"0"<<endl;
        //     return 0;
        // }

        //tmp = b^5
        //
        //tmp = log(tmp) / log(5.0);
        //tmp = log(tmp) / log(5.0);
        auto pos = lower_bound(ALL(v),(ll)tmp) - v.begin();
        
        //DEBUG(tmp);
        //DEBUG((int)pos);
        //if(!isinf(tmp) &&  tmp==floor(tmp+0.0001f)){
        if(tmp==v[pos] && pos!=0){
            cout<<i+st<<" "<<pos+st<<endl;
            //cout<<pos+st<<" "<<i+st<<endl;
            //DEBUG(tmp);
            return 0;
        }
    }
    //cout << ans << endl;
    return 0;
}

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



int main(){
    int r,D,x2000;
    cin>>r>>D>>x2000;

    long long before_ans=x2000;
    long long ans_after=0;
    for(int i=0;i<10;i++){
        ans_after=before_ans*r-D;


        cout<<ans_after<<endl;

        before_ans=ans_after;



    }


    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;

long long max(long long a,long long b){
	return (a>=b)?a:b;
}

int main(){
	long long n,k;
	cin>>n>>k;
	long long sum=(k==0)?(n-1)*n/2:(n-k+1)*(n-k)/2;
	for(long long b=1;b<=n;b++){
		long long cnt=(n-b+1)/b,amari=(n-b+1)%b;
		if((amari-1)>=k)sum+=(amari-k);
		sum+=max(0,b-k)*cnt;
	}
	cout<<sum<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll,string>;
using M = map<string,ll>;




int main(){
ll N;
cin >> N;
ll M;
cin >> M;
vector<ll> P(M,0);
vector<string> S(M,"");
vector<ll> Q(N+1,0);
for(ll i=0;i<M;i++){
    cin>>P[i]>>S[i]
;}
vector<bool> AC(N+1,0);
ll ACnum=0,PEnum=0;
for(ll i=0;i<M;i++){
    if(S[i]=="AC"&&AC[P[i]]==0){AC[P[i]]=1;ACnum++;}
    if(S[i]=="WA"&&AC[P[i]]==0){PEnum++;Q[P[i]]++;}
}
for(ll i=1;i<N+1;i++){
    if(AC[i]==0){PEnum-=Q[i];}
;}

cout<<ACnum<<" "<<PEnum<<endl;



return 0;
}  



Measured memory_bytes: 7296
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cwchar>
#include <cwctype>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <codecvt>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rrep(i, n) for(ll i = n-1; i > 0; i--)
#define all(x) (x).begin(),(x).end()
#pragma GCC optimize("Ofast")
using namespace std;
typedef int64_t ll;
typedef long double ld;
const ll INF=(1LL<<60);
const ld pi=acosl((ld)1);
const ll mod = 1000000007;
const int dx[4]={0,1,0,-1};
const int dy[4]={1,0,-1,0};
const int ddx[8]={1,0,-1,-1,-1,0,1,1};
const int ddy[8]={1,1,1,0,-1,-1,-1,0};

bool solve(){
  string s,t;cin>>s>>t;
  ll n=s.size();
  rep(i,n+10){
    if(s==t){
      cout<<"Yes"<<endl;
      return false;
    }
    char c=s[0];
    s.erase(s.begin());
    s.push_back(c);
  }
  cout<<"No"<<endl;
  return false;
}


signed main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout<<fixed;
	cout<<setprecision(30);
	return solve();
}


Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
using namespace std;
#define mx 300005
void rev(char *ch,int n){
    n--;
    for(int i=0;i<n;i++,n--)swap(ch[i],ch[n]);
}
int main(){
    int i,j,k,n,m,val,t=0,cnt,test;
    //freopen("000input.txt","r",stdin);
    char s[mx],s1[mx],s2[mx];
    char ch;
    int t1=0,t2=0;
    cin>>s>>n;
    s1[0]='\0',s2[0]='\0';
    for(i=0,cnt=0;i<n;i++){
        scanf("%d",&val);
        if(val==1)cnt=(cnt+1)&1;
        else{
            scanf("%d %c",&val,&ch);
            if(cnt){
                val=(val+1)%3+1;
            }
            if(val==1){
                s1[t1++]=ch;
                s1[t1]='\0';
            }
            else{
                s2[t2++]=ch;
                s2[t2]='\0';
            }
        }
    }
    if(cnt){
        rev(s2,t2);
        int i=0;
        while(s[i]!='\0')i++;
        rev(s,i);
        cout<<s2<<s<<s1<<endl;
    }
    else{
        rev(s1,t1);
        cout<<s1<<s<<s2<<endl;
    }
    //free();   //if pointer array
    return 0;
}


Measured memory_bytes: 896
n = int(input())-2
a = list(map(int, input().split()))

a.sort(reverse=True)
ans = a[0]
now = 1
cnt = 0
while n > 0:
    if cnt == 0:
        ans += a[now]
        cnt += 1
        n -= 1
    else:
        ans += a[now]
        cnt = 0
        n -= 1
        now += 1
print(ans)

Measured memory_bytes: 105388
def gcd(a, b):
    return a if b == 0 else gcd(b, a % b)


def lcm(a, b):
    return a * b // gcd(a, b)


N = int(input())
T = int(input())
for _ in range(N - 1):
    # print(T)
    T = lcm(T, int(input()))
print(T)


Measured memory_bytes: 2940
#include<stdio.h>
int main(void){
  int i,j;
  int len,key;
  int array[100];
  scanf("%d",&len);
  for(i=0;i<len;i++){
    scanf("%d",&array[i]);
  }
  for(i=0;i<len;i++){
    key=array[i];
    for(j=i-1;j>0,array[j]>key;j--){
      array[j+1]=array[j];
	}
    array[j+1]=key;
    for(j=0;j<len;j++){
      if(j>0)printf(" ");
      printf("%d",array[j]);
    }
      printf("\n");
  }
  return 0;
}

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

// 文字列 s から始まる N 以下の753数の個数
int dfs(string s, int N) {
    if (!s.empty() && stoll(s) > N) return 0;
    int res = 0;
    if (count(s.begin(), s.end(), '7') && count(s.begin(), s.end(), '5') && count(s.begin(), s.end(), '3')) ++res;
    res += dfs(s + "7", N);
    res += dfs(s + "5", N);
    res += dfs(s + "3", N);
    return res;
}

int main() {
    int N;  cin >> N;
    cout << dfs(""s, N) << endl;
}


Measured memory_bytes: 3580
#include<bits/stdc++.h>
#include<boost/dynamic_bitset.hpp>
using namespace std;
using u64 = uint64_t;
using s64 = int64_t;

int main() {
	u64 N, K;
	cin >> N >> K;

	vector<u64> A(N);
	for(u64 i=0; i<N; i++) {
		cin >> A[i];
	}

	sort(A.begin(), A.end(), greater<u64>());

	u64 h = A[0];
	u64 l = 0;
	
	while(l + 1 < h) {
		u64 cnt = 0;
		u64 m = l + (h - l) / 2;

		for(u64 i=0; i<N && cnt<=K; i++) {
			cnt += (A[i] + m - 1) / m - 1;
		}

		if(K >= cnt) {
			h = m;
		} else {
			l = m;
		}
	}

	cout << h << endl;
	return 0;
}

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

int main(){
    long long a,b,c,k;
    cin >> a >> b >> c >>k;
    long long ans = 0;
    if(k<=a){
        ans = k;
        cout << ans << endl;
        return 0;
    }else if(k > a && k <= a + b){
        ans = a;
        cout << a << endl;
        return 0;
    }else if(k > a + b && k<=a + b + c){
        ans = a - (k - a - b);
        cout << ans << endl;
        return 0;
    }
    return 0;
}

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

using ll = long long;
using pii = pair<ll, ll>;
using vi = vector<ll>;
using vvi = vector<vi>;

template <class T>
using max_heap = priority_queue<T>;
template <class T>
using min_heap = priority_queue<T, vector<T>, greater<T>>;

template <class T, class U>
void chmax(T &a, U b) {
    if (a < b) a = b;
}
template <class T, class U>
void chmin(T &a, U b) {
    if (b < a) a = b;
}

#define rep(i, j, k) for (int i = j; i < k; i++)
#define all(obj) (obj).begin(), (obj).end()
#define rall(obj) (obj).rbegin(), (obj).rend()
#define debug(x) cerr << #x << ": " << x << endl;
#define debug2(x, y) cerr << #x << ": " << x << ", " << #y << ": " << y << endl;
#define int ll

const ll mod = 1e9 + 7;
const ll inf = (1LL << 60);

const string YES = "Yes";
const string NO = "No";

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(10);
    cout << fixed;

    string s;
    cin >> s;

    rep(i, 0, s.size()) {
        if (s[i] == '7') {
            cout << YES << endl;
            return 0;
        }
    }

    cout << NO << endl;
    return 0;
}


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

int main() {
  string S;
  long long K;
  cin>>S>>K;
  int i=0;
  while((S.at(i)-'0')==1 && i+1<K){
    i++;
  }
  cout<<S.at(i)<<endl;
}


Measured memory_bytes: 3636
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node Node;

void insert(int);
void inorder(Node*);
void preorder(Node*);
Node * check(Node*,int);   


Node *NIL,*root;
int main(){
  int N,i,v,n;
  char o[7];
  Node *r;
  scanf("%d",&N);

  for(i=0;i<N;i++){
 
    scanf("%s",o);
    if(o[0]=='i'){
      scanf("%d",&v);
      insert(v);
    }
    else if(o[0]=='f'){
      scanf("%d",&n);
      r=check(root,n);
      if(r!=NIL) printf("yes\n");
      else printf("no\n");
    }
    else {
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }

  }
  return 0;
}

void insert(int k){

  Node *z;
  Node *x;
  Node *y;
  z=(Node *)malloc(sizeof(Node));

  z->key=k;
  z->left=NIL;
  z->right=NIL;
  y=NIL;
  x=root;
 
  while(x!=NIL){
    y=x;
    if( z->key < x->key )x=x->left;
    else x=x->right;
     
  }
  z->parent=y;


  if(y==NIL)root=z;
  else if(z->key < y->key) y->left=z;
  else y->right=z;

}

void inorder(Node *u){

  if(u==NIL)return;
  inorder(u->left);
  printf(" %d",u->key);
  inorder(u->right);
}

void preorder(Node *u){

  if(u==NIL) return;
  printf(" %d",u->key);
  preorder(u->left);
  preorder(u->right);
}

Node * check(Node *u,int n){
  while(1){
 if(u==NIL||n==u->key) break;
    if(n<u->key)u=u->left;
      else u=u->right;

	  	     
	     }
  return u;
}

Measured memory_bytes: 19364
f = True
while True:
    for k in range(3):
        p = list(input())
        if p[0] == '0':
            f = False
            break
        
        a, b = 0, 0
        del p[0]
        for x in p:
            if x == 'A': a += 1
            else: b += 1
        if a > b: a += 1
        else: b += 1
        print(a, b)
    if not f: break


Measured memory_bytes: 5556
n=int(input())
c=list(map(int, input().split()))


# score
anc = float('inf')
tmp = 0
for p in range(min(c),max(c)+1):
    for i in c:
        tmp += (i-p)**2
    if tmp < anc:
        anc = tmp
    tmp = 0
print(anc)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = (int)(a); i <= (int)(n); ++i)
#define rrep(i, a, n) for (int i = (int)(a); i >= (int)(n); --i)
#define debug(x) cerr << #x << " = " << x << "\n"
#define debugv(x) \
  rep(f, 0, (x.size() - 1)) cerr << x[f] << (f == (x.size() - 1) ? "\n" : " ")
#define all(x) x.begin(), x.end()
using namespace std;
typedef pair<int, int> pii;
typedef vector<int> vi;
const int MX = 1e5 + 5, INF = 5 << 28, MOD = 1e9 + 7;

int N, M;
string S;
vi va, vb;

template <class T>
inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
int cost[MX], var[MX];
bool ed[MX][13];
void input() {
  cin >> N >> M;
  rep(i, 0, M - 1) {
    int k, j;
    cin >> k >> j;
    cost[i] = k;
    var[i] = j;
    rep(b, 0, j - 1) {
      int h;
      cin >> h;
      ed[i][h - 1] = true;
      ;
    }
  }
}
// int dp[1001][5000];  // dp[i][set]: iまでの鍵でsetを実現するときのコスト
int dp[1 << 13];  // dp[s] : sの宝箱を開ける最小コスト

void solve() {
  rep(i, 0, 1 << 13 - 1) { dp[i] = INF; }
  dp[0] = 0;

  rep(now, 0, M - 1) {  // now : 鍵now
    int bt = 0;         //鍵nowで開けられるやつ
    rep(j, 0, N - 1) {
      if (ed[now][j]) {
        bt |= 1 << j;
      }
    }
    rep(st, 0, (1 << N) - 1) {
      dp[st | bt] = min(dp[st | bt], dp[st] + cost[now]);
    }
  }
  int ans = dp[(1 << N) - 1];

  if (ans == INF) {
    cout << -1 << endl;
  } else {
    cout << dp[(1 << N) - 1] << endl;
  }
}
signed main() {
  input();
  solve();
  return 0;
}

Measured memory_bytes: 256
s = gets.chomp
screenOutput = "AC"
screenOutput = "WA" if s[0] != "A"
cCount = 0
cIndexNumber = 0
s.slice(2..(s.length-2)).split("").each_with_index do |str, index|
  if str == "C"
    cCount += 1 
    cIndexNumber = index + 2
  end
end
screenOutput = "WA" if cCount != 1
if screenOutput == "AC"
  smallAlphabets = {}
  ("a".."z").each do |smallAlphabet|
    smallAlphabets.store(smallAlphabet,0)
  end
  s.slice!(cIndexNumber)
  s.slice!(0)
  tempS = s
  tempSCount=0
  tempS.split("").each do |tempStr|
    tempSCount += 1 if smallAlphabets.has_key?(tempStr)
  end
  screenOutput = "WA"  if tempSCount != tempS.length
end
puts screenOutput

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

int main()
{
	int a[3][3];
	
	for (int i = 0; i < 3; i++) {
		for (int j = 0; j < 3; j++) {
			cin >> a[i][j];
		}
	}
	
	int n;
	
	cin >> n;
	
	vector<int> b(n);
	
	for (int i = 0; i < n; i++) {
		cin >> b[i];
	}
	
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < 3; j++) {
			for (int k = 0; k < 3; k++) {
				if (b[i] == a[j][k]) {
					a[j][k] = 0;
				}
			}
		}
	}
	
	if (a[0][0] == a[0][1] && a[0][1] == a[0][2] ||
		a[1][0] == a[1][1] && a[1][1] == a[1][2] ||
		a[2][0] == a[2][1] && a[2][1] == a[2][2] ||
		a[0][0] == a[1][0] && a[1][0] == a[2][0] ||
		a[0][1] == a[1][1] && a[1][1] == a[2][1] ||
		a[0][2] == a[1][2] && a[1][2] == a[2][2] ||
		a[0][0] == a[1][1] && a[1][1] == a[2][2] ||
		a[0][2] == a[1][1] && a[1][1] == a[0][2])
	{
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#define N 55
#define X first
#define Y second
using namespace std;

typedef long long ll;
ll n, m, mn = 5e18;
pair<ll, ll> a[N];
vector<ll> v;
int main()
{
	ll i, j, k;
	cin >> n >> m;
	for (i = 0; i < n; i++) scanf("%lld %lld", &a[i].X, &a[i].Y);
	sort(a, a + n);
	for (i = 0; i < n; i++) {
		for (j = i; j < n; j++) {
			v.push_back(a[j].Y);
			sort(v.begin(), v.end());
			if (v.size() < m) continue;
			for (k = m - 1; k < v.size(); k++)
				mn = min(mn, (a[j].X - a[i].X) * (v[k] - v[k - m + 1]));
		}
		v.clear();
	}
    cout << mn << endl;
    return 0;
}

Measured memory_bytes: 256
# coding:UTF-8

# ２つのボタンのコイン獲得枚数を取得
buttons = list(map(int, input().split()))

# 最大獲得コイン取得用領域
max_coin = 0

for _ in range(2):
    if buttons[0] > buttons[1]:
        max_coin += buttons[0]
        buttons[0] -= 1
    else:
        max_coin += buttons[1]
        buttons[1] -= 1

# 結果出力
print(max_coin)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
    using namespace std;
    int main()
    {
      int n;
      cin>>n;
      map<int,int> m;
      for(int i=0;i<n;i++)
      {
        int a;
        cin>>a;
        m[a]+=1;
        if(m[a]>1)
        {
          cout<<"NO";
          return 0;
        }
      }
      cout<<"YES";
      return 0;
    }

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

namespace panasonic2020_a
{
  class Program
  {
    static void Main(string[] args)
    {
      var a = new[] { 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51 };
      var k = CIn.ReadInt();
      Console.WriteLine(a[k - 1]);
    }
  }

  static class CIn
  {
    private static readonly Queue<string> fieldBuffer = new Queue<string>();

    public static string Read()
    {
      if (fieldBuffer.Count == 0)
      {
        foreach (var field in Console.ReadLine().Split())
        {
          fieldBuffer.Enqueue(field);
        }
      }
      return fieldBuffer.Dequeue();
    }

    public static int ReadInt() => int.Parse(Read());
    public static long ReadLong() => long.Parse(Read());
    public static double ReadDouble() => double.Parse(Read());

    public static string[] ReadStringArray(int n)
    {
      var array = new string[n];
      for (var i = 0; i < n; i++)
      {
        array[i] = Read();
      }
      return array;
    }

    public static int[] ReadIntArray(int n)
    {
      var array = new int[n];
      for (var i = 0; i < n; i++)
      {
        array[i] = ReadInt();
      }
      return array;
    }

    public static long[] ReadLongArray(int n)
    {
      var array = new long[n];
      for (var i = 0; i < n; i++)
      {
        array[i] = ReadLong();
      }
      return array;
    }

    public static double[] ReadDoubleArray(int n)
    {
      var array = new double[n];
      for (var i = 0; i < n; i++)
      {
        array[i] = ReadDouble();
      }
      return array;
    }

    public static char[,] ReadCharMatrix(int h, int w)
    {
      var array = new char[h, w];
      for (var i = 0; i < h; i++)
      {
        var l = Console.ReadLine().ToCharArray();
        for (var j = 0; j < w; j++)
        {
          array[i, j] = l[j];
        }
      }
      return array;
    }
  }
}


Measured memory_bytes: 13268
#include <iostream>
#include <istream>
#include <string>
#include <vector>
using namespace std;
int main() {
  vector<bool> w(11 * 11, false);
  for (int i = 1; i < 10; i++) {
    for (int j = 1 + i % 2; j < 10; j += 2) {
      char c;
      cin >> c;
      if (c - '0') w[i * 11 + j] = true;
    }
  }
  int x = 2, y = 0, d = 1, dy[] = {-1, 0, 1, 0}, dx[] = {0, 1, 0, -1};
  do {
    const string s = "URDL";
    d = (d + 1) % 4;
    while (w[(y + dy[d]) * 11 + x + dx[d]]) {
      cout << s[(d + 3) % 4];
      d = (d + 3) % 4;
    }
    y += dy[d] * 2;
    x += dx[d] * 2;
  }
  while (x || y);
  cout << endl;
}

Measured memory_bytes: 1180