akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for(int i=a;i<b;i++)
#define repds(i,a,b) for(int i=a+1;i<=b;i++)
#define rep(i,N) repd(i,0,N)
#define reps(i,N) repds(i,0,N)
#define debug(x) cout<<#x<<"="<<x<<endl
#define debugarr(arr,N,M){rep(i,N+1){rep(j,M+1){if(arr[i][j]==INF)printf(" INF");\
	else printf(" %3d",arr[i][j]);} cout<<endl;}}
#define pb push_back
#define pob pop_back
#define cint(a) int a;cin>>a
#define cint2(a,b) int a,b;cin>>a>>b
#define cint3(a,b,c) int a,b,c;cin>>a>>b>>c
typedef long long ll;
typedef pair<int,int> P;
const int INF=100000000;
const int dx[4]={ 0, 1, 0,-1};
const int dy[4]={ 1, 0,-1, 0};
//--------------------------------------//
string s;
int a[100];
ll k;
//10^18
//10^15*5.0
int main(){
	cin>>s;
	int z=s.size();
	rep(i,z) {
		a[i]=s[i]-'0';
	}
	cin>>k;
	ll oc=0;
	rep(i,z){
		if(a[i]!=1)
			break;
		oc++;
	}
	if(k<=oc) {
		cout<<"1"<<endl;
		return 0;
	}
	for(int i=0;;i++){
		if(a[i]!=1){
			cout<<a[i]<<endl;
			break;
		}
	}
	return 0;
}


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

int main(){
    int n;
    cin >> n;
    vector<int> p(n);
    
    int count = 0;
    for(int i=0;i<n;i++){
        cin >> p.at(i);
        p.at(i)--;
        if(p.at(i) != i){
            count++;
        }
    }
    
    if(count <= 2){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }
    
}

Measured memory_bytes: 256
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
from operator import mul
from functools import reduce


sys.setrecursionlimit(2147483647)
INF = 10 ** 13
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 1000000007


n, c = LI()
D = LIR(c)
C = LIR(n)
#　mod_color[mod3][color]
mod_color = [[0] * c for _ in range(3)]
for y in range(n):
    for x in range(n):
        mod_color[(y + x + 2) % 3][C[y][x] - 1] += 1


# 30 * 29 * 28
ans = INF
for i in range(c):
    for j in range(c):
        if j == i: continue
        for k in range(c):
            if k == i or k == j: continue
# もともとmod0のところをiに、mod1のところをjに、mod2のところをkにする。
            ret = 0
            for l in range(3):
                for m in range(c):
                    if l == 0:
                        ret += mod_color[l][m] * D[m][i]
                    elif l == 1:
                        ret += mod_color[l][m] * D[m][j]
                    else:
                        ret += mod_color[l][m] * D[m][k]
            ans = min(ans, ret)


print(ans)



Measured memory_bytes: 48476
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(n);i++)
#define N 100010
#define INF 10000000000
typedef long long ll;
#define ALL(v) (v).begin(),(v).end()
#define SZ(x) int(x.size())
#define IN(a) cin>>(a)
#define OUT(a) cout<<(a)<<endl
typedef pair<int,int> P;
const int MAX = 1000000;
const int MOD = 1000000007;
ll I[N];
ll m[N];
int main(){
    string s;
    IN(s);
    I[0]=1;
    REP(i,SZ(s)){
        if(s[i]=='1'){
            I[i+1]=2*I[i];
            m[i+1]+=I[i];
        }else{
            I[i+1]=I[i];
        }
        m[i+1]+=3*m[i];
        m[i+1]%=MOD;
        I[i+1]%=MOD;
    }
    OUT((I[SZ(s)]+m[SZ(s)])%MOD);
	return 0;
}

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

int main() {
  int H,W,A,B;
  cin >> H >> W >> A >> B;
  
  if(H==1 && W==1) cout << 0 << endl;
  else if(H==1){
    for(int i=0;i<W;i++){
      if(i<A) cout << 1;
      else cout << 0;
    }
  }
  else if(W==1){
    for(int i=0;i<H;i++){
      if(i<B) cout << 1 << endl;
      else cout << 0 << endl;
    }
  }
  else{
    for(int i=0;i<H;i++){
      for(int j=0;j<W;j++){
        if(i<B && j<A) cout << 1;
        else if(i>=B && j>=A) cout << 1;
        else cout << 0;
      }
      cout << endl;
    }
  }
  
  return 0;
}


Measured memory_bytes: 1280
from fractions import gcd
n = int(input())
a = [int(i) for i in input().split()]

b = [0] * n
c = [0] * n

j = 0
for i, k in enumerate(a):
    b[i] = j
    j = gcd(j, k)

j = 0
for i, k in reversed(list(enumerate(a))):
    c[i] = j
    j = gcd(j, k)

ma = 0
for i in range(n):
    ma = max(ma, gcd(b[i], c[i]))
print(ma)


Measured memory_bytes: 94304
import java.io.BufferedReader
import java.io.InputStream
import java.io.InputStreamReader
import java.io.PrintWriter
import java.lang.IllegalArgumentException
import java.lang.StringBuilder
import java.lang.reflect.Modifier
import java.util.*

fun PrintWriter.solve(sc: FastScanner) {
    val a = sc.nextLong()
    val b = sc.nextLong()
    val x = sc.nextLong()
    println(b / x - (a + x - 1) / x + 1)
}

fun main() {
    val writer = PrintWriter(System.out, false)
    writer.solve(FastScanner(System.`in`))
    writer.flush()
}

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: 34304
import java.util.*

fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val x = readLine()!!.split(' ').map { it.toInt() }
    var min = Int.MAX_VALUE
    for (p in 1..100) {
        var sum = 0
        for (i in 0 until n) {
            sum += (x[i] - p) * (x[i] - p)
        }
        min = Math.min(min, sum)
    }
    println(min)
}

Measured memory_bytes: 38308
/* template.cpp [[[ */
#include <bits/stdc++.h>
using namespace std;
#define get_macro(a, b, c, d, name, ...) name
#define rep(...) get_macro(__VA_ARGS__, rep4, rep3, rep2, rep1)(__VA_ARGS__)
#define rrep(...) get_macro(__VA_ARGS__, rrep4, rrep3, rrep2, rrep1)(__VA_ARGS__)
#define rep1(n) rep2(i_, n)
#define rep2(i, n) rep3(i, 0, n)
#define rep3(i, a, b) rep4(i, a, b, 1)
#define rep4(i, a, b, s) for (ll i = (a); i < (ll)(b); i += (ll)s)
#define rrep1(n) rrep2(i_, n)
#define rrep2(i, n) rrep3(i, 0, n)
#define rrep3(i, a, b) rrep4(i, a, b, 1)
#define rrep4(i, a, b, s) for (ll i = (ll)(b) - 1; i >= (ll)(a); i -= (ll)s)
#define each(x, c) for (auto &&x : c)
#define fs first
#define sc second
#define all(c) begin(c), end(c)
using ui = unsigned;
using ll = long long;
using ul = unsigned long long;
using ld = long double;
const int inf = 1e9 + 10;
const ll inf_ll = 1e18 + 10;
const ll mod = 1e9 + 7;
const ll mod9 = 1e9 + 9;
const int dx[]{-1, 0, 1, 0, -1, 1, 1, -1};
const int dy[]{0, -1, 0, 1, -1, -1, 1, 1};
template<class T, class U> void chmin(T &x, const U &y){ x = min<T>(x, y); }
template<class T, class U> void chmax(T &x, const U &y){ x = max<T>(x, y); }
struct prepare_ { prepare_(){ cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(12); } } prepare__;
/* ]]] */

int main(){
  ll a[3];
  bool f = true;
  each(x, a) cin >> x, f &= x & 1;
  if (f){
    sort(all(a));
    cout << a[0] * a[1] << endl;
  }
  else cout << 0 << endl;
}



Measured memory_bytes: 256
//shan61916
#include <bits/stdc++.h>
  using namespace std;
typedef   long long ll;
typedef   unsigned long long ull ;
typedef   double dll ;

#define   mp make_pair
#define   pb push_back
#define   ff first 
#define   ss second
#define   IOS ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define   endl "\n" 
#define   pll pair<ll, ll>
#define   all(x) x.begin(), x.end()
#define   vll vector<ll> 

const ll inf = (ll)(1e17 + 17);
const ll mod = (ll)(1e9 + 7);


int main(){
 IOS
#ifdef SHAN
    freopen("input.txt" , "r" , stdin);  
#endif
  ll a, b, n;
  cin >> a >> b >> n;
  if(b >= a) n--;
  vll vals = {1, 2, n/2, n/2 - 1, n/2 + 1, n-1, n, a-1, a + 1, b - 1, b + 1, a/2, b/2};
  for(ll i = 1; i*i <= n; i++) {
    if(n%i == 0) {
      vals.pb(i);
      vals.pb(n/i);
    }
  }
  for(ll i = 1; i*i <= a; i++) {
    if(a%i == 0) {
      vals.pb(a);
      vals.pb(a/i);
    }
  }
  for(ll i = 1; i*i <= b; i++) {
    if(b%i == 0) {
      vals.pb(b);
      vals.pb(b/i);
    }
  }
  ll ans = 0;
  for(auto it: vals) {
   ll x = max(it, 1LL);
   x = min(n, x);
   ll res = (a*x)/b - (a)*(x/b);
   if(res > ans) {
    ans = res;
   }
  }
  cout << ans << endl;
  return 0;
} //good night.


Measured memory_bytes: 3656
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define MOD 1000000007
#define all(ppp) ppp.begin(),ppp.end() 

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
#define pb push_back

typedef long double ld;
typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
 
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
typedef vector<vpi> vvpi;

typedef set<pi> spi;

const int INF=INT_MAX;




int main(){
    int N;
    cin>>N;
    vi vt(N,0);
    F0R(i,N){
        cin>>vt[i];
    }
    map<int,int> mp;
    F0R(i,N){
        if(mp.find(vt[i])==mp.end()){
            mp[vt[i]]=1;
        }else{
            cout<<"NO"<<endl;
            return 0;
        }
    }
    cout<<"YES"<<endl;
    return 0;
}


Measured memory_bytes: 10368
import java.util.*;
public class Main{

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

    if (a <= b) {
      for (int i = 1 ; i <= b ; i++ ) {
        System.out.print(a);
      }
    } else {
      for (int i = 1 ; i <= a ; i++ ) {
        System.out.print(b);
      }

    }


  }
}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)

using namespace std;

typedef long long ll;


int main(){

    string S, T, U;
    int A, B;

    cin >> S >> T;
    cin >> A >> B;
    cin >> U;

    if(U==S) cout << A-1 << " " << B;
    else cout << A << " " << B-1;

}

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

using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define ll long long int
#define INF 1000000007
#define llINF 1000000000000000007
#define v(i) vector<i>
#define vv(i) vector<vector<i>>
// cin.eof() 入力個数の問題
// int num = atoi(string.c_str()); 文字列の整数変換

int main() {
ll a[3];
rep(i,3){
    cin>>a[i];
}
sort(a,a+3);

ll g = a[1] * a[0];
if(a[2] % 2 == 0){
    cout<<0<<endl;
}else
{
    cout<<g<<endl;
}

   return 0;
}


Measured memory_bytes: 3648
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <vector>
#define rep(i,n) for(int i=0;i<n;i++)
#define ll long long int
#define ii pair<int,int>
#define MAX 1000000007
using namespace std;

int main(void){
	int a,b;
	cin >> a >> b;
	
	cout << (b-1+a-2)/(a-1) << endl;	
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define mod (int)(1e9+7)
#define inf (int)(3e18+7)
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define P pair<int,int>
#define all(v) v.begin(),v.end()
#define mkp make_pair
#define mkt make_tuple
#define prique(T) priority_queue<T,vector<T>,greater<T>>
#define vecunique(vec) sort(vec.begin(), vec.end());decltype(vec)::iterator result = std::unique(vec.begin(), vec.end());vec.erase(result, vec.end())
using namespace std;

bool prime(int x) {
	for (int i = 2; i * i <= x; i++) {
		if (x % i == 0)return false;
	}
	return x > 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x * y / gcd(x, y);
}
int kai(int x) {
	if (x == 0)return 1;
	return kai(x - 1) * x % mod;
}
int mod_pow(int x, int y, int mod_) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % mod_;
		}
		x = x * x % mod_;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	return kai(x)* mod_pow(kai(x - y), mod - 2, mod) % mod * mod_pow(kai(y), mod - 2, mod) % mod;
}
/*--------Library Zone!--------*/

int n, ans, mi_ = inf;
signed main() {
	cin >> n;
	rep(i, n) {
		int a, b; cin >> a >> b;
		ans += a;
		if (a > b)mi_ = min(mi_, b);
	}
	if (mi_ == inf)cout << 0 << endl;
	else cout << ans - mi_ << endl;
}


Measured memory_bytes: 256
// 失敗するからこそ そこから立ち向かって行く強さがあってそんな強さが本当の強さだと私は思うから
// ぜったいあきらめない
#if defined(DAIJOBU)
#include "/home/ichigo/includes.hpp"
#include "/home/ichigo/debug.hpp"
#define deb(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#include <bits/stdc++.h>
#define deb(x...)
#endif
#define FIO {ios::sync_with_stdio(0);cin.tie(nullptr);cout.tie(nullptr);}

using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());


int main(){
	FIO
	
	int a, b;
	cin >> a >> b;
	cout << 2 * b - a << '\n';
 	return 0; 
}


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

print(*A)
for i in range(1, N):
    V = A[i]
    insert_index = i
    for j in reversed(range(i)):
        if A[j] > V:
            insert_index = j
    A.pop(i)
    A.insert(insert_index, V)
    print(*A)


Measured memory_bytes: 5980
#include <iostream>
using namespace std;
int main(){
  int d;cin>>d;
  if(d==25)cout<<"Christmas"<<endl;
  if(d==24)cout<<"Christmas Eve"<<endl;
  if(d==23)cout<<"Christmas Eve Eve"<<endl;
  if(d==22)cout<<"Christmas Eve Eve Eve"<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <string>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <iostream>
#include <functional>
#include <algorithm>
#include <sstream>
#include <iterator>
#include <cmath>
#include <limits>
#include <tuple>
#include <queue>
#include <stack>

using namespace std;
typedef long long ll;

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


int main()
{
	int N, Y;
	cin >> N >> Y;
	Y /= 1000;
	for (int i=0; i <= N; i++) {
		for (int j = i; j <= N; j++) {
			int k = N - j;
			int x = i * 10;
			x += (j-i) * 5;
			x += k;
			if (x == Y) {
				cout << i << " " << (j - i) << " " << k << endl;
				return 0;
			}
		}
	}
	cout << "-1 -1 -1" << endl;
	return 0;
}


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

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

typedef long long int lli;
typedef unsigned long long ull;
typedef complex<double> point;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << "," << p.second << ")"; return os; }
template<typename P, typename Q> istream& operator >> (istream& is, pair<P, Q>& p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; each (i, v) os << i << ","; os << ")"; return os; }
template<typename T> istream& operator >> (istream& is, vector<T>& v) { each (i, v) is >> i; return is; }

template<typename T> inline T setmax(T& a, T b) { return a = std::max(a, b); }
template<typename T> inline T setmin(T& a, T b) { return a = std::min(a, b); }

const int N = 1000 + 5;
const lli inf = 1LL << 62;

struct E {
  int src, dst;
  lli cost;
};

pair<lli, bool> bellman_ford(vector<E> es, int src, int dst)
{
  lli cost[N];
  fill(cost, cost + N, inf);
  cost[src] = 0;
  for (int i = 0; i < N; ++i) {
    each (e, es) {
      if (cost[e.dst] > cost[e.src] + e.cost) {
        cost[e.dst] = cost[e.src] + e.cost;
        if (i == N - 1 && e.dst == dst) return make_pair(0, false);
      }
    }
  }
  return make_pair(cost[dst], true);
}

int main(int argc, char *argv[])
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  int n, m;
  while (cin >> n >> m) {
    vector<E> v;
    for (int i = 0; i < m; ++i) {
      int a, b, c;
      cin >> a >> b >> c;
      v.push_back((E){a - 1, b - 1, -c});
    }
    auto p = bellman_ford(v, 0, n - 1);
    if (!p.second) cout << "inf" << endl;
    else cout << -1 * p.first << endl;
  }

  return 0;
}


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

int main() {
  int n;
  cin >> n;
  vector<int> a(n), b(n);
  for (int i = 0; i < n; i++)
    cin >> a[i];
  for (int i = 0; i < n; i++)
    cin >> b[i];

  int aa = 0, bb = accumulate(b.begin(), b.end(), 0);
  vector<int> ans(n);
  for (int i = 0; i < n; i++) {
    aa += a[i];
    ans[i] = aa + bb;
    bb -= b[i];
  }
  cout << *max_element(ans.begin(), ans.end()) << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <functional>
using namespace std;
const long long MOD = 1e9+7;
int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  for(int i = 0; i < n; i++){
    cin >> a[i];
  }
  sort(a.begin(), a.end());
  
  if(n % 2 == 1){
    for(int i = 0; i < n; i++){
      if(a[i] != (i+1)/2*2){
        cout << 0 << endl;
        return 0;
      }
    }
  }else{
    for(int i = 0; i < n; i++){
      if( a[i]+1 != ((i+2)/2*2)){
        cout << 0 << endl;
        return 0;
      }
    }

  }
  long long ans = 1;
  for(int i = 1; i <= n/2; i++){
    ans = (ans%MOD) * 2;
  }
  cout << ans%MOD << endl;
  return 0;
} 


Measured memory_bytes: 640
#include <iostream>

using namespace std;
typedef long long ll;
int main()
{
    ll n,d;
    cin>>n>>d;
    d*=d;
    int ans=0;
    ll x,y;
    for(ll i=1; i<=n; i++){
        cin>>x>>y;
        if(x*x+y*y<=d)ans++;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3188
from collections import OrderedDict
d = list(map(int, input().split()))
command = input()
p = OrderedDict()
for k, v in zip(["T", "N", "S", "E", "W", "B"], [d[0], d[4], d[1], d[2], d[3], d[5]]):
    p[k] = v

for c in command:
    t, n, s, e, w, b = p["T"], p["N"], p["S"], p["E"], p["W"], p["B"]
    if c == "N":
        p["N"], p["T"], p["S"], p["B"]= t, s, b, n
    if c == "S":
        p["N"], p["T"], p["S"], p["B"]= b, n, t, s
    if c == "E":
        p["E"], p["T"], p["W"], p["B"]= t, w, b, e
    if c == "W":
        p["E"], p["T"], p["W"], p["B"]= b, e, t, w
    
print(p["T"])


Measured memory_bytes: 6008
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1000000007;
const ll LINF=1LL<<60;
const int INF=1<<30;

int main(){
	double n;cin>>n;
	vector<pair<double,double>> a(n);
	for(int i = 0; i < n; i++) {
		cin>>a[i].fs >>a[i].sc;
	}
	vector<int> p(n);
	for(int i = 0; i < n; i++) {
		p[i] = i;
	}	
	double ans = 0.0;
	double counter = 0.0;
	do{
		for(int i = 0; i < n - 1; i++) {
			ans += sqrt((a[p[i]].fs  - a[p[i + 1]].fs) * (a[p[i]].fs  - a[p[i + 1]].fs)
			+(a[p[i]].sc - a[p[i + 1]].sc) * (a[p[i]].sc - a[p[i + 1]].sc));
		}
		counter+= 1.0;
	}while(next_permutation(ALL(p)));
	ans /= counter;
	cout << fixed << setprecision(10)<< ans << endl;
	return 0;
}

Measured memory_bytes: 256
import math
import fractions


import sys
import itertools
input = sys.stdin.readline
 
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

n = I()
def main():
    for i in range(n):
        temp = I()
        try:
            past = temp * past // fractions.gcd(temp, past)
        except:
            past = temp
    print(past)
    
main()

Measured memory_bytes: 65644
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <vector>
#include <utility>
#include <climits>
#include <iomanip>
using namespace std;
#define MAXSIZE 100005
#define MAXL 100
typedef long long int lli;

int pow_int(int a, int x){
    int res = 1;
    for(int i = 0; i < x; ++i){
        res *= a;
    }
    return res;
}

int main(){
    int n, m;
    cin >> n >> m;

    vector<vector<int>> switch_nums;
    for(int i = 0; i < m; ++i){
        int k;
        cin >> k;
        vector<int> switch_num(k);
        for(int j = 0; j < k; ++j){
            cin >> switch_num[j];
        }
        //sort(switch_num.begin(), switch_num.end());
        switch_nums.push_back(switch_num);
    }

    vector<int> p_vec(m);
    for(int i = 0; i < m; ++i){
        cin >> p_vec[i];
    }

    /*for(int i = 0; i < m; ++i){
        cout << "switch_nums[" << i << "] = [";
        for(int j = 0; j < switch_nums[i].size(); ++j){
            cout << " " << switch_nums[i][j];
        }
        cout << " ]\n";
    }*/

    int ans = 0;
    int cnt_final = pow_int(2, n);
    int array_bit[n] = {}; // bitが0ならOFF, 1ならON
    for(int cnt = 0; cnt < cnt_final; ++cnt){
        int cnt_divide = n;
        int cnt_copy = cnt;
        while(cnt_divide > 0){
            cnt_divide--;
            array_bit[cnt_divide] = cnt_copy % 2;
            cnt_copy /= 2;
        }

        /*cout << "cnt = " << cnt << ", array_bit = [";
        for(int i = 0; i < n; ++i){
            cout << " " << array_bit[i];
        }
        cout << " ]\n";*/

        int ans_add = 1;
        for(int i = 0; i < m; ++i){
            int num_on = 0;
            for(int j = 0; j < switch_nums[i].size(); ++j){
                num_on += array_bit[switch_nums[i][j] - 1];
                num_on %= 2;
            }

            if(num_on != p_vec[i]){
                ans_add = 0;
                break;
            }
        }
        ans += ans_add;
    }

    cout << ans;
    return 0;
}

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

int main()
{
    long long a, b, n;
    cin >> n >> a >> b;
    long long cnt_b;
    long long set = n / (a + b);
    long long set_ext = n % (a + b);
    cnt_b = set * a;
    if (set_ext > a)
    {
        cnt_b += a;
    }
    else
    {
        cnt_b += set_ext;
    }
    cout << cnt_b << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
int main() {
	int a;
	cin>>a;
	for(int i=3; i<=a; i++) {
		if(i%3==0) {
			cout<<" "<<i;
			continue;
		}
		int x=i;
		while(x) {
			if(x%10==3) {
		
				cout<<" "<<i;
				break;
			}
			x/=10;
		}
	}
	cout<<endl;
	return 0;
}


Measured memory_bytes: 3120
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    int N;
    cin >> N;

    vector<int> A(N);
    for (int i = 0; i < N; i++){
        cin >> A.at(i);
    }

    int answer = 100;

    for (int i = 0; i < N; i++){
        int count = 0;
        while (A.at(i) % 2 == 0){
            count++;
            A.at(i) = A.at(i) / 2;
        }
        answer = min(answer, count);
    }
    cout << answer << endl;
}

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

using namespace std;

int main(){
	int t;
	cin>>t;
	for(int l = 0; l < t; l++){
		int n,k;
		cin>>n>>k;
		vector<int> homes;
		for(int i = 0; i < n; i++){
			int p;
			cin>>p;
			homes.push_back(p);
		}
		if(homes.size()<=k){
			cout<<0<<endl;
			continue;
		}
		vector<int> roads;
		int sumL=0;
		for(int i = 1; i < homes.size(); i++){
			int length=homes[i]-homes[i-1];
			roads.push_back(length);
			sumL+=length;
		}
		sort(roads.begin(),roads.end(),greater<int>());
		int rid=0;
		for(int i = 0; i < k-1; i++){
			rid+=roads[i];
		}
		cout<<sumL-rid<<endl;
	}

	return 0;
}

Measured memory_bytes: 1824
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <cmath>
#include <ctime>
#include <vector>
#include <stack>

using namespace std;
////////////////*My library*////////////////////////
#define rep_to(a,i,n) for(int i=a;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define rep_r(i,n) for(int i=n-1;i>=0;i--)
#define debug(x) cout<<x<<endl
#define s_1(x) cin>>x
#define s_2(x,y) cin>>x>>y
////////////////////////////////////////////////////

////////////////////////
/*prime()*/
/*primecount()*/
/*sort()*/
/*imos???*/
/*????????¢?´¢*/
/*??±???????????¢?´¢*/
/*???????¨???????*/
///////////////////////

int main()
{
	int N,len;
	char str[10000][10]={};
	char s[100000]={};

	while(1)
	{
		s_1(N);
		if(N==0)break;
		rep(i,N)cin>>str[i][0]>>str[i][1];
		s_1(len);

		rep(i,len)
		{
			s_1(s[i]);
			rep(j,N)
			{
				if(str[j][0]==s[i])
					{
						s[i]=str[j][1];
						break;
					}
			}
		}
		rep(i,len)cout<<s[i];
		cout<<endl;
	}
	return 0;
}

Measured memory_bytes: 1352
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
             int result;
		// 整数の入力
		int a = sc.nextInt();
		int p = sc.nextInt();
result = (a*3+p)/2;
		// 出力
		System.out.println(result);
	}
}

Measured memory_bytes: 23124
N = int(input())
a = [0]*N
b = [0]*N
c = [0]*N

for i in range(N):
  a[i], b[i], c[i] = [int(_) for _ in input().split()]
  
dp = [[0] * 3 for _ in range(N)]

dp[0][0] = a[0]
dp[0][1] = b[0]
dp[0][2] = c[0]

for i in range(N-1):
  dp[i+1][0] = max(dp[i+1][0], dp[i][1] + a[i+1], dp[i][2] + a[i+1] ) 
  dp[i+1][1] = max(dp[i+1][1], dp[i][2] + b[i+1], dp[i][0] + b[i+1] ) 
  dp[i+1][2] = max(dp[i+1][2], dp[i][0] + c[i+1], dp[i][1] + c[i+1] ) 
    
print(max(dp[N-1]))


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

int main() {    
    string s;
    int k;
    cin >> s >> k;
    vector<string> strs;
    for (int i = 0; i < s.size(); i++) {
        string tmp = "";
        for (int j = 0; j <= k; j++) {
            strs.push_back(tmp);
            if (i + j < s.size()) {
                tmp += s[i+j];
            }
        }
    }
    sort(strs.begin(), strs.end());
    string bef = "";
    for (auto x : strs) {
        if (bef != x) {
            bef = x;
            k--;
        }
        if (k == 0) {
            cout << x << endl;
            break;
        }
    }
}

Measured memory_bytes: 1160
import java.util.*;

 public class Main {
     public static void main(String[] args) {
         new Main().execute();
     }

     public void execute() {
         Scanner sc = new Scanner(System.in);
         int s = sc.nextInt();
         List<Integer> a = new ArrayList<>();
         for (int i = 2; i <= 1000000; i++) {
             a.add(s);
             s = f(s);
             for (int m : a) {
                 if (s == m) {
                     System.out.println(i);
                     return;
                 }
             }
         }
     }

     private int f(int n) {
         if (n % 2 == 0) {
             return n / 2;
         } else {
             return 3 * n + 1;
         }
     }
 }

Measured memory_bytes: 23252
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using vll = vector<ll> ;
#define all(v) v.begin(),v.end()
const ll mod = 1e9+7;
 
ll modpow(ll a,ll b){
  ll ans=1%mod;
  while(b){	
    if(b&1) ans=(ans*a)%mod;
    a=(a*a)%mod;
    b=b>>1; 
  }
  return ans;
  }
 
ll modinv(ll a, ll m) {
  ll b=m,u=1,v=0;
  while(b){
    ll t = a/b;
    a -= t*b;
    swap(a,b);
    u -= t*v;
    swap(u,v);
  }
  u %= m;
  if(u<0) u += m;
  return u;
}
 
ll fact(ll k){
  ll tmp=k;
  if(k == 0) tmp=1;
  while(k>1){
    k--;
    tmp = tmp * k % mod;
  }
  return tmp;
}

int main(){
  ll X,Y;cin>>X>>Y;
  ll ans = 0;
  ll n=2*X-Y,m=2*Y-X;
  if((X+Y)%3==0 && n>=0 && m>=0 && n%3==0 && m%3==0){
    n /= 3;
    m /= 3;
    ans += fact(n+m)*modinv(fact(n),mod)%mod*modinv(fact(m),mod)%mod;
    ans %= mod;
  }
  cout << ans << endl;
}

Measured memory_bytes: 3632
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
const int INF=0x3f3f3f;
const int N=100+10;
int d[N][N];
int main()
{
    int t,i,j,k,a,b,c,n;
    while(~scanf("%d",&t)&&t)
    {
    n=0;
    memset(d,INF,sizeof(d));
    for(i=0;i<t;i++)
    {
        scanf("%d%d%d",&a,&b,&c);
        d[a][b]=c;
        d[b][a]=c;
        d[a][a]=0;
        d[b][b]=0;
        n=max(n,max(a,b));
    }
for(k=0;k<=n;k++)
for(i=0;i<=n;i++)
for(j=0;j<=n;j++)
d[i][j]=min(d[i][j],d[i][k]+d[k][j]);
int maxx=INF,flagI;
for(i=0;i<=n;i++)
{
    int sum=0;
    for(j=0;j<=n;j++)
    {
        sum+=d[i][j];
    }
    if(sum<maxx)
    {
        maxx=sum;
        flagI=i;
    }
}
printf("%d %d\n",flagI,maxx);
    }
    return 0;
}

Measured memory_bytes: 1240
#pragma region
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <map>
#include <queue> 
#include <stack>
#include <set>
#include <list>

using namespace std;
typedef long long ll;
//#define rep(i, s, e) for (int(i) = (s); (i) < (e); ++(i))
#define rep(i, e) for (int(i) = 0; (i) < (e); ++(i))
#define all(x) x.begin(),x.end()
#pragma endregion


int main()
{
	string s; cin >> s;
	reverse(all(s));
	int now = 0;
	while (now < s.size())
	{
		if (s.substr(now, 5) == "maerd" || s.substr(now, 5) == "esare")now += 5;
		else if (s.substr(now, 6) == "resare")now += 6;
		else if (s.substr(now, 7) == "remaerd")now += 7;
		else break;
	}
	if (now==s.size())cout << "YES" << endl;
	else cout << "NO" << endl;
}

Measured memory_bytes: 512
import numpy as np
import itertools

x,n = map(int,input().split())
li = list(map(int,input().split()))
li.sort()
if x in li:
    idx = li.index(x)
    i = 0
    while(1):
        i = i+1
        if(idx-i<0):
            print(x-i)
            break
        if(li[idx-i]!=x-i):
            print(x-i)
            break
        if(idx+i>=len(li)):
            print(x+i)
            break
        if(li[idx+i]!=x+i):
            print(x+i)
            break
else:
    print(x)


Measured memory_bytes: 27168
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

#define F first
#define S second
#define pb push_back
#define eb emplace_back
#define INF LLONG_MAX
#define PI 3.14159265359
#define sz(c) (int)c.size()
#define len(c) (int)c.length()
#define hcf(a, b) __gcd(a, b)
#define all(c) c.begin(), c.end()
#define vint vector<int>
#define vll vector<ll>
#define vpint vector<pair<int, int>>
#define vpll vector<pair<ll, ll>>
#define tr(con, it) \
    for (auto it = con.begin(); it != con.end(); it++)
#define fr(it, a, b) \
    for (int it = (a); it < (b); it++)
#define present(con, ele) (con.find(ele) != con.end())
#define cpresent(con, ele) (find(all(con), ele) != con.end())
#define maximum(a, b, c) (a > b ? (a > c ? a : c) : (b > c ? b : c))
#define minimum(a, b, c) (a < b ? (a < c ? a : c) : (b < c ? b : c))
typedef long long ll;
typedef long double lf;
typedef unsigned long long lu;
const ll mod = 1e9 + 7;
ll power(ll a, ll b)
{
    ll ans = 1;
    while (b > 0)
    {
        if (b % 2 == 1)
        {
            ans = (ans * a) % mod;
        }
        a = (a * a) % mod;
        b = b / 2;
    }
    return ans;
}
vll fac(500005, -1);
ll fact(ll n)
{
    if (fac[n] != -1)
    {
        return fac[n];
    }
    else if (n == 0)
    {
        return 1;
    }
    return fac[n] = (n * fact(n - 1)) % mod;
}
int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n, m, ans;
    cin >> n >> m;
    ans = (fact(m) * power(fact(m - n), mod - 2)) % mod;
    ans = (ans * ans) % mod;
    for (int i = 1; i <= n; i++)
    {
        ll tp = (fact(n) * power((fact(n - i) * fact(i)) % mod, mod - 2)) % mod;
        ll tmp = (fact(m) * power(fact(m - n), mod - 2)) % mod;
        ll tpc = (fact(m - i) * power(fact(m - n), mod - 2)) % mod;
        ll ch = ((tp * tmp) % mod * tpc) % mod;
        if (i % 2)
        {
            ans = ((ans - ch) % mod + mod) % mod;
        }
        else
        {
            ans = (ans + ch) % mod;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 14804
def examA():
    N = I()
    if N%10==9:
        ans = "Yes"
    elif N//10==9:
        ans = "Yes"
    else:
        ans = "No"
    print(ans)


import sys
import copy
import bisect
import heapq
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

examA()


Measured memory_bytes: 38256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 2e3 + 10;
string s[N];
ll a[N][N];
int main() {
    int n, m;
    ll ans = 0;
    cin >> n >> m;
    for(int i = 0; i < n; i++) {
        cin >> s[i];
    }
    for(int i = 0; i < n; i++) {
        int pos = -1;
        for(int j = 0; j < m; j++) {
            if(s[i][j] == '#') pos = j;
            a[i][j] += j - pos - 1;
        }
        pos = m;
        for(int j = m - 1; j >= 0; j--) {
            if(s[i][j] == '#') pos = j;
            a[i][j] += pos - j - 1;
        }
    }
    for(int j = 0; j <= m; j++) {
        int pos = -1;
        for(int i = 0; i < n; i++) {
            if(s[i][j] == '#') pos = i;
            a[i][j] += i - pos - 1;
        }
        pos = n;
        for(int i = n - 1; i >= 0; i--) {
            if(s[i][j] == '#') pos = i;
            a[i][j] += pos - i - 1;
            if(s[i][j] == '.') ans = max(ans, a[i][j]);
        }
    }
    cout << ans+1 << endl;
    return 0;
}

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

typedef long long ll;
#define ar array
#define vi vector<int>
#define vvi vector<vector<int>>
#define vll vector<long long>
#define all(x) (x).begin(), (x).end()
#define en '\n'
#define FILL(x, v) memset(x, v, sizeof(x))
#define pb push_back
#define fast                     \
	ios::sync_with_stdio(false); \
	cin.tie(NULL);               \
	cout.tie(NULL);
#define F_OR(i, a, b, s) for (int i = (a); ((s) > 0 ? i < (b) : i > (b)); i += (s))
#define F_OR1(e) F_OR(i, 0, e, 1)
#define F_OR2(i, e) F_OR(i, 0, e, 1)
#define F_OR3(i, b, e) F_OR(i, b, e, 1)
#define F_OR4(i, b, e, s) F_OR(i, b, e, s)
#define GET5(a, b, c, d, e, ...) e
#define F_ORC(...) GET5(__VA_ARGS__, F_OR4, F_OR3, F_OR2, F_OR1)
#define FOR(...)       \
	F_ORC(__VA_ARGS__) \
	(__VA_ARGS__)

#define E_ACH2(x, a) for (auto &x : a)
#define E_ACH3(x, y, a) for (auto &[x, y] : a)
#define E_ACH4(x, y, z, a) for (auto &[x, y, z] : a)
#define E_ACHC(...) GET5(__VA_ARGS__, E_ACH4, E_ACH3, E_ACH2)
#define EACH(...)       \
	E_ACHC(__VA_ARGS__) \
	(__VA_ARGS__)

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;
}

const int mxn = 5e5;
const int M = 1e9 + 7;

ll pw(ll b, ll e)
{
	ll res = 1;
	while (e)
	{
		if (e % 2)
			res = (res * b) % M;
		b = (b * b) % M;
		e >>= 1; // e/=2;
	}
	return res;
}

ll iv[mxn + 1], f1[mxn + 1], f2[mxn + 1];
ll nck(int n, int k)
{
	return f1[n] * f2[k] % M * f2[n - k] % M;
}

int main()
{
	fast;
	int n;
	cin >> n;
	cout << (n == 0 ? 1 : 0);
}

Measured memory_bytes: 3604
#include <stdio.h>

int main()
{
    int n;
    scanf("%d", &n);
    int a[n];
    for (int i = 0; i < n; i++){
        scanf(" %d", &a[i]);
    }
    for (int i = n - 1; i >= 0; i--){
        if(i != 0){
            printf("%d ", a[i]);
        }
        else {
            printf("%d\n", a[i]);
        }
    }
    return 0;
}


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

int max(int x, int y){
    if(x > y) return x;
    else return y;
}

int min(int x, int y){
    if(x > y) return y;
    else return x;
}

int main(void){
    int a, b, c, x;
    cin >> a >> b >> c;
    x = a;
    a = min(a, b);
    b = max(x, b);
    x = b;
    b = min(b, c);
    c = max(x, c);
    x = a;
    a = min(a, b);
    b = max(x, b);
    cout << a << " " << b << " " << c << endl;
    return 0;
}



Measured memory_bytes: 3084
import math
def f(n):
    if n==1:
        return [[1,0]]
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr
n=f(int(input()))
s=0
for i in n:
    p=i[1]
    s+=int((-1+math.sqrt(1+8*p))/2)
print(s)

Measured memory_bytes: 9476
#pragma region Macros
#include <bits/stdc++.h>
using namespace std;
//#include <boost/multiprecision/cpp_int.hpp>
//using multiInt = boost::multiprecision::cpp_int;

using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pld = pair<ld, ld>;
template <typename Q_type>
using smaller_queue = priority_queue<Q_type, vector<Q_type>, greater<Q_type>>;

constexpr int MOD_TYPE = 1;
constexpr ll MOD = (MOD_TYPE == 1 ? (ll)(1e9 + 7) : 998244353);
constexpr int INF = (int)1e9;
constexpr ll LINF = (ll)4e18;
constexpr ld PI = acos(-1.0);
constexpr ld EPS = 1e-11;
constexpr int Dx[] = {0, 0, -1, 1, -1, 1, -1, 1, 0};
constexpr int Dy[] = {1, -1, 0, 0, -1, -1, 1, 1, 0};

#define REP(i, m, n) for (ll i = m; i < (ll)(n); ++i)
#define rep(i, n) REP(i, 0, n)
#define MP make_pair
#define MT make_tuple
#define YES(n) cout << ((n) ? "YES" : "NO") << "\n"
#define Yes(n) cout << ((n) ? "Yes" : "No") << "\n"
#define possible(n) cout << ((n) ? "possible" : "impossible") << "\n"
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << "\n"
#define Yay(n) cout << ((n) ? "Yay!" : ":(") << "\n"
#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define dbg(x) cerr << #x << ":" << x << "\n";

#pragma endregion

inline ll gcd(ll a, ll b)
{
  if (a < b)
    swap(a, b);
  return b == 0 ? a : gcd(b, a % b);
}

inline ll lcm(ll a, ll b)
{
  return a / gcd(a, b) * b;
}

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(30) << setiosflags(ios::fixed);
  int n;
  cin >> n;
  ll ans = 1;
  rep(i, n)
  {
    ll a;
    cin >> a;
    ans = lcm(ans, a);
  }
  cout << ans << endl;
  return 0;
}


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

#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define PI acos(-1.0)
#define sq(n) (n)*(n)

using namespace std;
typedef long long ll;

int main() {
    FAST;

    int n, m, a, s = 0;
    cin >> n >> m;

    while (m--) {
        cin >> a;
        s += a;
    }
    n -= s;

    cout << ((n < 0) ? -1 : n);

    return 0;
}


Measured memory_bytes: 3656
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<climits>
#include<algorithm>
#include<utility>
#define int long long
using namespace std;
int a, b, c, k, cnt;
signed main(){
	scanf("%lld%lld%lld%lld", &a, &b, &c, &k);
	while(b <= a){
		b *= 2;
		cnt++;
	}
	while(c <= b){
		c *= 2;
		cnt++;
	}
	if(cnt <= k) printf("Yes");
	else printf("No");
}

Measured memory_bytes: 3228
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {

		//
		int matches = 0;
		// 対戦者達
		String[] players = { "太郎", "花子" };
		//
		ArrayList<player2> players_beans = new ArrayList<player2>();
		;
		// プレイヤーのインスタンスを作る
		for (String val : players) {
			player2 obj = new player2();
			obj.setName(val);
			players_beans.add(obj);
		}

		// 標準入力
		Scanner sc = new Scanner(System.in);

		// 対戦回数
		while (sc.hasNext()) {

			matches = sc.nextInt();
			break;
		}

		// 対戦回数分まわす
		for (int m = 0; m < matches; m++) {

			// カードを入れるリスト
			ArrayList<String> battle = new ArrayList<String>();

			while (sc.hasNext()) {
				// 入力文字列をリストに追加
				String taro_card = sc.next();
				String hanako_card = sc.next();

				battle.add(taro_card);
				battle.add(hanako_card);

				// アルファベット順にソート
				Collections.sort(battle);

				// 引き分けの場合
				if (taro_card.equals(hanako_card)) {
					players_beans.get(0).setPoints(1);
					players_beans.get(1).setPoints(1);
				}

				// 太郎が勝つ場合
				else if (battle.get(0).equals(hanako_card)) {
					players_beans.get(0).setPoints(3);
				}

				// 花子が勝つ場合
				else if (battle.get(0).equals(taro_card)) {
					players_beans.get(1).setPoints(3);
				}

				break;
			}
		}

		// 出力
		System.out.println(players_beans.get(0).getPoints() + " "
				+ players_beans.get(1).getPoints());
	}
}

// 各プレイヤーのプロパティ
class player2 {

	//
	private String name = "";
	private String card = "";
	private int points = 0;

	// セッター
	public void setName(String n) {
		name = n;
	}

	public void setCard(String c) {
		card = c;
	}

	// 合計値を持つようにする
	public void setPoints(int p) {
		points += p;
	}

	// ゲッター
	public String getName() {
		return name;
	}

	public String getCard() {
		return card;
	}

	public int getPoints() {
		return points;
	}

}

Measured memory_bytes: 23120
#include <stdio.h>

int main(){
  int n;
  int b[101];
  
  scanf("%d",&n);
  for(int i=1;i<=n;i++){
    scanf("%d",&b[i]);
  }
  int j;
  int loop = 0;
  int buf[101] = {};
  int id = 1;
  int max = n;
  int fail = 0;
  while(loop < n){
    loop++;
    for(j=max;j>=1;j--){
      if(b[j] == j){
        buf[id] = j;
        id++;
        for(int k=j;k<=max-1;k++){
          b[k] = b[k+1];
        }
        max--;
        break;
      }
    }
    if(loop + max != n){
      fail = 1;
      break;
    }
  }
  if(fail == 1){
    printf("-1\n");
  }else{
    for(int a=n;a>=1;a--){
      printf("%d\n",buf[a]);
    }
  }
  return 0;
}

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

#define d(x) cerr << #x ":" << x << endl;
#define dd(x, y) cerr << "(" #x "," #y "):(" << x << "," << y << ")" << endl
#define rep(i, n) for (int i = (int)(0); i < (int)(n); i++)
#define repp(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define all(v) v.begin(), v.end()
#define dump(v)                  \
    cerr << #v ":[ ";            \
    for (auto macro_vi : v) {    \
        cerr << macro_vi << " "; \
    }                            \
    cerr << "]" << endl;
#define ddump(v)                           \
    cerr << #v ":" << endl;                \
    for (auto macro_row : v) {             \
        cerr << "[";                       \
        for (auto macro__vi : macro_row) { \
            cerr << macro__vi << " ";      \
        }                                  \
        cerr << "]" << endl;               \
    }
using lint       = long long;
const int INF    = 1e9;
const lint LINF  = 1e18;
const lint MOD   = 1e9 + 7;
const double EPS = 1e-10;

bool is_prime(const unsigned n) {
    switch (n) {
        case 0: // fall-through
        case 1:
            return false;
        case 2: // fall-through
        case 3:
            return true;
    }
    if (n % 2 == 0) return false;
    if (n % 3 == 0) return false;

    if (n % 6 != 1 && n % 6 != 5) return false;

    for (unsigned i = 5; i * i <= n; i += 6) {
        if (n % i == 0) return false;       // 6n-1
        if (n % (i + 2) == 0) return false; // 6n+1
    }
    return true;
}

int main() {
    vector<int> is2017LikeNum(1e5 + 1, 0);
    for (int x = 1; x < 1e5; x++) {
        if (x % 2 == 0) continue;
        int p = x, q = (x + 1) / 2;
        if (not(is_prime(p) and is_prime(q))) { continue; }
        if (p == 2 * q - 1) { is2017LikeNum[x] = 1; }
    }
    vector<int> L(1e5 + 2, 0);
    rep(i, 1e5 + 2) { L[i + 1] = L[i] + is2017LikeNum[i]; }

    int Q;
    cin >> Q;
    rep(i, Q) {
        int l, r;
        cin >> l >> r;
        cout << L[r + 1] - L[l] << endl;
    }
    return 0;
}

Measured memory_bytes: 1408
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#define int __int128
#define N 6000002
using namespace std;
struct object{
	int c,w,id;
}a[N];
int head[N],ver[N*2],nxt[N*2],l;
int n,maxx,x,d,s,i,j,m[N],p[N],c[N],w[N],ncnt,nc[N],nw[N],f[N],ans;
int read()
{
	char c=getchar();
	int w=0;
	while(c<'0'||c>'9') c=getchar();
	while(c<='9'&&c>='0'){
		w=w*10+c-'0';
		c=getchar();
	}
	return w;
}
void insert(int x,int y)
{
	l++;
	ver[l]=y;
	nxt[l]=head[x];
	head[x]=l;
}
void dfs(int x)
{
	c[x]=m[x];w[x]=1;
	for(int i=head[x];i;i=nxt[i]){
		int y=ver[i];
		dfs(y);
		c[x]+=c[y];w[x]+=w[y];
	}
}
int my_comp(const object &a,const object &b)
{
	return a.w*b.c>b.w*a.c;
}
void print(int x)
{
	if(!x) return;
	print(x/10);
	putchar((char)(x%10+'0'));
}
signed main()
{
	n=read();x=read();d=read();
	m[1]=read();
	for(i=2;i<=n;i++){
		m[i]=read();p[i]=read();
		insert(p[i],i);
	}
	dfs(1);
	s=min(n,d);
	for(i=1;i<=n&&s;i++){
		int k;
		for(k=1;s-(1<<k)+1>0;k++){
			ncnt++;
			nc[ncnt]=(1<<(k-1))*c[i];
			nw[ncnt]=(1<<(k-1))*w[i];
			maxx+=nw[ncnt];
		}
		k--;ncnt++;
		nc[ncnt]=(s-(1<<k)+1)*c[i];
		nw[ncnt]=(s-(1<<k)+1)*w[i];
		maxx+=nw[ncnt];
	}
	memset(f,0x3f,sizeof(f));
	f[0]=0;
	for(i=1;i<=ncnt;i++){
		for(j=maxx;j>=nw[i];j--) f[j]=min(f[j],f[j-nw[i]]+nc[i]);
	}
	for(i=1;i<=n;i++) a[i].c=c[i],a[i].w=w[i],a[i].id=i;
	sort(a+1,a+n+1,my_comp);
	if(ncnt==0){
		int v=x,sum=0;
		for(j=1;j<=n;j++){
			int cnt=(a[j].id==1)?x/c[1]:d;
			if(cnt-s>0){
				if(v>=a[j].c*(cnt-s)) sum+=(cnt-s)*a[j].w,v-=(cnt-s)*a[j].c;
				else{
					sum+=(v/a[j].c)*a[j].w;
					break;
				}
			}
		}
		ans=sum;
	}
	else{
		for(i=0;i<=maxx;i++){
			int v=x-f[i],sum=i;
			if(v<0) continue;
			for(j=1;j<=n;j++){
				int cnt=(a[j].id==1)?(x/c[1]):d;
				if(cnt-s>0){
					if(v>=a[j].c*(cnt-s)) sum+=(cnt-s)*a[j].w,v-=(cnt-s)*a[j].c;
					else{
						sum+=(v/a[j].c)*a[j].w;
						v-=(v/a[j].c)*a[j].c;
						if(v<=0) break;
					}
				}
			}
			ans=max(ans,sum);
		}
	}
	if(!ans) puts("0");
	else print(ans),puts("");
	return 0;
}


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

int main() {
  int N,S=0;
  std::cin >> N;
  int a = N;
  while(N>0){
    S+=N%10;
    N /=10;
  }
  if (a%S==0) {
    std::cout << "Yes" << '\n';
  }
  else{
    std::cout << "No" << '\n';
  }
  return 0;
}


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

int main(){
    int n,m;
    cin >> n >> m;
    int k;
    int a;
    vector<int> food(m,0);
    for(int i=0; i<n; i++){
        cin >> k;
        for(int j=0; j<k; j++){
            cin >> a;
            food.at(a-1)++;
        }
    }
    int count=0;
    for(int i=0; i<m; i++){
        if(food.at(i)==n) count++;
//        cout << food.at(i) << endl;
    }
    cout << count << endl;
}

Measured memory_bytes: 3608
#include<bits/stdc++.h>
using namespace std;
int main(){

     int a,b,c,d,i,j,k;
     string x,y,z;
     vector<int> v;
     set<int> s;
     cin>>a>>b>>c;
     s.insert(a);
     s.insert(b);
     s.insert(c);
     if(s.size()==2){
        cout<<"Yes"<<endl;
     }
 else cout<<"No"<<endl;



    return 0;
}


Measured memory_bytes: 256