akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Diagnostics;
using System.Dynamic;
using System.Linq;
using System.Numerics;
using System.Security.Cryptography;
using System.Security.Cryptography.X509Certificates;

namespace atcorder
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] intArray = Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();
            int X = intArray[0];
            int Y = intArray[1];
            if(Y % 2 != 0)
            {
                Console.WriteLine("No");
            }
            else if(Y < 2 * X || 4 * X < Y)
            {
                Console.WriteLine("No");
            }
            else
            {
                Console.WriteLine("Yes");
            }
        }
    }
}


//文字配列の取得
//string[] strArray = Console.ReadLine().Split(' ').ToArray();
//string S = strArray[0];
//string T = strArray[1];

//文字列の取得
//string s = Console.ReadLine();

//数字配列の取得
//int[] intArray = Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();
//int H = intArray[0];
//int W = intArray[1];

//数字の取得
//int N = int.Parse(Console.ReadLine());

//リスト型(int)の取得
//List<int> A = new List<int>(Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray());

//出力
//Console.WriteLine(ans);
//Console.WriteLine("Yes");
//Console.WriteLine("No");
//Console.WriteLine(cnt);



Measured memory_bytes: 28144
#include <iostream>
#include <vector>
#include <cstring>
#include <algorithm>
using namespace std;
int dist1[200010], dist2[200010];
vector<int> x[200010];

void dfs1(int pos, int depth) {
  if(dist1[pos] != -1) return ;
  dist1[pos] = depth;
  for(int i = 0; i < x[pos].size(); ++i) {
    dfs1(x[pos][i], depth+1);
  }
}

void dfs2(int pos, int depth) {
  if(dist2[pos] != -1) return ;
  dist2[pos] = depth;
  for(int i = 0; i < x[pos].size(); ++i) {
    dfs2(x[pos][i], depth+1);
  }
}

int main() {
  int N; cin >> N;
  vector<int> a(N), b(N);
  for(int i = 0; i < N-1; ++i) {
    cin >> a[i] >> b[i];
    x[a[i]].push_back(b[i]);
    x[b[i]].push_back(a[i]);
  }
  for(int i = 0; i < 200010; ++i) {
    dist1[i] = -1;
    dist2[i] = -1;
  }
  dfs1(1, 0);
  dfs2(N, 0);
  int cnt1 = 0, cnt2 = 0;
  for(int i = 1; i <= N; ++i) {
    (dist1[i] <= dist2[i]) ? cnt1++ : cnt2++;
  }
  if(cnt1 > cnt2) cout << "Fennec" << endl;
  else cout << "Snuke" << endl;
  return 0;
}


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

int main() {
    int m, f, r;

    while (true) {
        cin >> m >> f >> r;

        if (m == -1 && f == -1 && r == -1) {
            break;
        }

        if (m == -1 || f == -1) {
            cout << "F" << endl;
            continue;
        }

        int p = m + f; // 中間と期末の合計点数

        if (p >= 80) {
            cout << "A" << endl;
            continue;
        }

        if (65 <= p && p < 80) {
            cout << "B" << endl;
            continue;
        }

        if (50 <= p && p < 65) {
            cout << "C" << endl;
            continue;
        }

        if (30 <= p && p < 50) {
            if (r >= 50) {
                cout << "C" << endl;
            } else {
                cout << "D" << endl;
            }
            continue;
        }

        if (p < 30) {
            cout << "F" << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 3064
import java.util.Arrays;

public class Main {


  private static void solve() {
    int n = ni();
    int[] l = na(n);
    
    int sum = Arrays.stream(l).sum();
    
    for (int i = 0; i < n; i ++) {
      if (sum - l[i] <= l[i]) {
        System.out.println("No");
        return;
      }
    }
    System.out.println("Yes");
  }

  public static void main(String[] args) {
    new Thread(null, new Runnable() {
      @Override
      public void run() {
        long start = System.currentTimeMillis();
        String debug = args.length > 0 ? args[0] : null;
        if (debug != null) {
          try {
            is = java.nio.file.Files.newInputStream(java.nio.file.Paths.get(debug));
          } catch (Exception e) {
            throw new RuntimeException(e);
          }
        }
        reader = new java.io.BufferedReader(new java.io.InputStreamReader(is), 32768);
        solve();
        out.flush();
        tr((System.currentTimeMillis() - start) + "ms");
      }
    }, "", 64000000).start();
  }

  private static java.io.InputStream is = System.in;
  private static java.io.PrintWriter out = new java.io.PrintWriter(System.out);
  private static java.util.StringTokenizer tokenizer = null;
  private static java.io.BufferedReader reader;

  public static String next() {
    while (tokenizer == null || !tokenizer.hasMoreTokens()) {
      try {
        tokenizer = new java.util.StringTokenizer(reader.readLine());
      } catch (Exception e) {
        throw new RuntimeException(e);
      }
    }
    return tokenizer.nextToken();
  }

  private static double nd() {
    return Double.parseDouble(next());
  }

  private static long nl() {
    return Long.parseLong(next());
  }

  private static int[] na(int n) {
    int[] a = new int[n];
    for (int i = 0; i < n; i++)
      a[i] = ni();
    return a;
  }

  private static char[] ns() {
    return next().toCharArray();
  }

  private static long[] nal(int n) {
    long[] a = new long[n];
    for (int i = 0; i < n; i++)
      a[i] = nl();
    return a;
  }

  private static int[][] ntable(int n, int m) {
    int[][] table = new int[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[i][j] = ni();
      }
    }
    return table;
  }

  private static int[][] nlist(int n, int m) {
    int[][] table = new int[m][n];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[j][i] = ni();
      }
    }
    return table;
  }

  private static int ni() {
    return Integer.parseInt(next());
  }

  private static void tr(Object... o) {
    if (is != System.in)
      System.out.println(java.util.Arrays.deepToString(o));
  }
}


Measured memory_bytes: 27860
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#define ll long long int

int n,m;
int abcd[50][4];
int retu[10];

int main(){
  scanf("%d%d",&n,&m);
  for(int i=1;i<=m;i++){
    if(i%2==1){
      printf("%d %d\n",(i+1)/2,(i+1)/2+m-i+1);}
    else{
      printf("%d %d\n",m+1+i/2,m+1+i/2+m-i+1);}
  }
  
  return 0;
}


Measured memory_bytes: 1704
#include "bits/stdc++.h"
using namespace std;

/* macro */
#define rep(i,a,b) for(int i=a;i<b;i++)
#define revrep(i,a,b) for(int i = a; i > b; i--)
#define int long long
#define exist(s,e) ((s).find(e)!=(s).end())
#define all(v) (v).begin(), (v).end()
#define each(s,itr) for(auto (itr) = s.begin(); (itr) != s.end(); (itr)++)
#define sum(v) accumulate(all(v), (0LL))
#define isin(a, b, c) (b <= a && a <= c)
#define println cout << "\n";
#define sz(v) (int)v.size()
#define bin(x) static_cast<bitset<16> >(x)


/* alias */
template<class T> using vec = vector<T>;
typedef vector<int> vi;
typedef pair<int, int> pi;
typedef tuple<int, int, int> ti;
typedef map<int, int> mi;
typedef set<int> si;


/* constant */
const int inf = 1LL << 62;
const int mod = 1e9 + 7;
const int dx[8]={1,0,-1,0,-1,1,-1,1};
const int dy[8]={0,1,0,-1,-1,-1,1,1};
const string alphabet = "abcdefghijklmnopqrstuvwxyz";

/* io_method */
int input(){int tmp;cin >> tmp;return tmp;}
string raw_input(){string tmp;cin >> tmp;return tmp;}
template<class T> void printx(T n){cout << n;}
template<class T, class U> void printx(pair<T, U> p){cout << "(" << p.first << "," << p.second << ")";}
template<class T, class U, class V> void printx(tuple<T, U, V> t){cout << "{" << get<0>(t) << "," << get<1>(t) <<"," << get<2>(t) << "}" << endl;}
template<class T> void printx(vector<T> v){cout << "{";rep(i,0,v.size()){printx(v[i]);if(i != v.size()-1)printx(",");}cout << "}";}
template<class T> void print(T n){printx(n);cout << endl;}
template<class T> void print(set<T> s){cout << "{";each(s, e){if(e != s.begin()) printx(",");printx(*e);}cout << "}" << endl;}
template<class T, class U> void print(map<T, U> mp){cout << "{";each(mp, e){cout << "(" << e -> first << "," << e -> second << ")";}cout << "}" << endl;}
template<class T> void printans(vec<T> v){rep(i,0,sz(v)){cout << v[i] << (i == sz(v) - 1 ? "" : " ");}cout << endl;}


/* general_method */
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<class T>T cut(T &a, int l, int r){return T(a.begin()+l, a.begin()+r);}


/* math_method */
int ceil(int a, int b){return a / b + (a % b > 0);}


/* main */

int n;
vec<string> arr;
void in(){
    cin >> n;
    rep(i,0,n) arr.push_back(raw_input());
}

int cntenda = 0;
int cntendb = 0;
int cnttmp = 0;


void solve(){

    int ans = 0;


    rep(i,0,n){
        if(arr[i].front() == 'B' && arr[i].back() == 'A') cnttmp++;
        else if(arr[i].back() == 'A') cntenda++;
        else if(arr[i].front() == 'B') cntendb++;
        rep(j,0,sz(arr[i]) - 1){
            if(arr[i][j] == 'A' && arr[i][j + 1] == 'B') ans++;
        }
    }


    print(ans + min(cntenda, cntendb) + max(0LL,cnttmp - 1) + (cnttmp > 0LL && max(cntenda,cntendb) > 0LL));



}

signed main(){

    cin.tie(0);
    ios::sync_with_stdio(false);
    in();
    solve();
    
}

Measured memory_bytes: 768
#include <bits/stdc++.h>
typedef long long ll;
#define pb push_back
#define mii map <int, int>
#define mll map <ll, ll>
#define pii pair <int, int>
#define pll pair <ll, ll>
#define vi vector <int>
#define vd vector <double>
#define vll vector <ll>
#define fi first
#define se second
#define si set <int>
#define sll set <ll>
#define spii set <pii>
#define vs vector <string>
#define vpii vector <pair <int,int> >
#define vpll vector <pair <long long,long long> >
#define vvi vector <vector <int> >
#define vvpii vector <vector <pii > >
#define forn(i, n) for (int i = 0; i < (n); i++)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define for1(i, n) for (int i = 1; i < (n); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(),(x).rend()


using namespace std;
const ll INFLL = 1e18;
const int MAXN = 1e6+100;
const ll INF = 1e9;
const ll mod1=1e9+7;
const ll mod2=2e9+11;
ll bin_pow(ll base,ll deg)
{
    if (deg==0)
        return 1;
    ll t=bin_pow(base,deg/2);
    if (deg&1)
        return (((t*t)%mod1)*base)%mod1;
    else
        return (t*t)%mod1;
}
int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
#ifdef LOCAL
    freopen("a.in","r",stdin);
#endif
    ll n,k;
    cin>>n>>k;
    vector <ll> a(n);
    rep(i,n)
    cin>>a[i];
    ll fact[100001];
    ll f=1;
    for (ll i=0;i<=100000;i++)
        fact[i]=f,f*=(i+1),f%=mod1;
    ll ans=0;
    sort(all(a));
    for (ll i=k-1;i<n;i++)
    {
        ll t=fact[i];
        t*=bin_pow(fact[k-1],mod1-2);
        t%=mod1;
        t*=bin_pow(fact[i-k+1],mod1-2);
        t%=mod1;
       // if (i-k+1==0||k-1==0)
      //      t=1;
        ans+=(t*a[i])%mod1;
      //  cout<<t<<" "<<a[i]<<'\n';
        ans%=mod1;
    }
   // cout<<ans<<'\n';
    for (ll i=n-k;i>=0;i--)
    {
        ll t=fact[n-1-i];
        t*=bin_pow(fact[k-1],mod1-2);
        t%=mod1;
        t*=bin_pow(fact[n-1-i-k+1],mod1-2);
        t%=mod1;
        ans-=(t*a[i])%mod1;
        ans%=mod1;
    }
    cout<<ans;


}

Measured memory_bytes: 1792
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
#define REP(i, a, n) for(int i=a; i<n; i++)

int a, b;
int main()
{
	cin >> a >> b;
	cout << max(max(a + b, a - b), a*b) << endl;
	return 0;
}

Measured memory_bytes: 256
#include<functional>
#include<algorithm>
#include<iostream>
#include<iomanip>
#include<cstring>
#include<cstdlib>
#include<utility>
#include<string>
#include<cstdio>
#include<vector>
#include<bitset>
#include<cmath>
#include<ctime>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
using namespace std;
const int inf=2147483647,dx[]={-1,0,1,0},dy[]={0,-1,0,1};// 上 左 下 右
const int N=100005,M=1000005,K=200005,mod=1000000007;
const long long llinf=9223372036854775807ll;
//int & long long
int n,a,p;
int main(){
	cin>>n;
	p=1;
	for(int i=1;i<=n;i++)
	{
		cin>>a;
		if(a==p)
			p++;
	}
	if(p==1)
	{
		cout<<-1;
		return 0;
	}
	cout<<n-p+1;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, M;
  cin >> N >> M;
  vector<int> high(N);
  for (int i = 0; i < N; i++) {
    cin >> high.at(i);
  }
  vector<int> A(M);
  vector<int> B(M);
  vector<int> vec(N);
  for (int i = 0; i < M; i++) {
    cin >> A.at(i);
    cin >> B.at(i);
  }
  for (int i = 0; i < M; i++) {
    if (high.at(A.at(i) - 1) < high.at(B.at(i)- 1)) {
      vec.at(A.at(i) - 1)++;
    }
    else if (high.at(A.at(i) - 1) > high.at(B.at(i)- 1)){
      vec.at(B.at(i) - 1)++;
    }
    else {
      vec.at(A.at(i) - 1)++;
      vec.at(B.at(i) - 1)++;
    }
  }
  int ans = 0;
  for (int i = 0; i < N; i++) {
    if (vec.at(i) == 0) {
      ans++;
    }
  }
  cout << ans << endl;
}

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

using namespace std;

inline int read(){
	char ch=getchar();int x=0,f=1;
    while(ch<'0' || ch>'9') {
       if(ch=='-') f=-1;
	  	  ch=getchar();
	}
    while(ch<='9' && ch>='0') {
	   x=x*10+ch-'0';
	   ch=getchar();
	}
    return x*f;
}

int main(){
	int t=read();
	while(t--){
		int a=read(),b=read(),c=read(),d=read();
		int n=a+b;
		int k=(max(a,b)-1)/(min(a,b)+1)+1;
		int l=0,r=n+1,x,y;
		while(l<r){
			int mid=l+r>>1;
			x=a-mid/(k+1)*k-mid%(k+1);
			y=b-mid/(k+1);
			if(y<=1ll*x*k) l=mid+1;
			else r=mid;
		}
		x=a-l/(k+1)*k-l%(k+1);y=b-l/(k+1);r=l+y-x*k+1;
		for(int i=c;i<=min(d,l);i++) {
			if(i%(k+1)) cout<<'A';
			else cout<<'B';
		} 
		for(int i=max(c,l+1);i<=d;i++){
			if((i-r)%(k+1)) cout<<'B';
			else cout<<'A';
		}
		cout<<endl;
	}  


	return 0;
}


Measured memory_bytes: 384
#include <iostream>
using namespace std;
int main(){
	
	int a, b;
	cin >> a >> b;
	
	int seki = a * b;
	
	if(seki % 2 == 0){
		cout << "Even" << endl;
	}
	else{
		cout << "Odd" << endl;
	}
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
//#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#define pb push_back
#define IOS                                                                    \
  ios_base::sync_with_stdio(false);                                            \
  cin.tie(0);                                                                  \
  cout.tie(0);cout<<fixed<<setprecision(16);
#define ll long long int
#define ld long double
#define el '\n'
#define El '\n'
#define PI (ld)3.141592653589793238462643383279502884197169399375105820974944
#define inf (ll)1000000000
#define mod (ll)1000000007
#define mod1 (ll)998244353
#define fo(i, n) for (long long i = 0; i < n; i++)
#define pll pair<ll, ll>
#define ml map<ll,ll>
#define vpl vector<pll>
#define vvl vector<vector<ll> >
#define vvpl vector< vector<pll> >
#define ff first
#define ss second
#define pqueue priority_queue< ll >
#define pdqueue priority_queue< ll,vl ,greater< ll > >
#define mem(a,b) memset(a,b,sizeof(a));
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define sz(a) (ll)a.size()
#define f(i,a,b) for(ll i=a;i<b;i++)
#define fd(i,a,b) for(ll i=a;i>=b;i--)
#define all(a) a.begin(),a.end()
#define vl vector<ll>
//#define x ff
//#define y ss
#define pt(a) for(auto it:a)cout<<it<<" ";cout<<endl;
unsigned seed = std::chrono::system_clock::now().time_since_epoch().count();
using namespace std;

// vector
template<class T> istream& operator >> (istream &is , vector<T> &v) { for(T &a : v) is >> a; return is; }
template<class T> ostream& operator << (ostream &os , const vector<T> &v) { for(const T &t : v) os << t<<" "; return os << endl; }
// pair
template<class T, class U> ostream& operator << (ostream &os , const pair<T, U> &v) { return os << v.first << " " << v.second ; }

double gcd(double a, double b) { return a < 0.01 ? b : gcd(fmod(b, a), a); }

long long bpow(long long a, long long b, long long m) {
  a %= m;
  long long res = 1;
  while (b > 0) {
    if (b & 1)

      res = res * a % m;
      a = a * a % m;
      b >>= 1;
  }
  return res;
}


ll kv;
ll t,n,x,y,h,k,z,p,q,w,r;
string s,s1,s2;
//vvl v;
//vl vis,d;

int main() {
    IOS;
    cin>>n;
    cin>>x>>y>>z;
    fo(i,n-1){
        cin>>h>>k>>t;
        p=h+max(y,z);
        q=k+max(x,z);
        r=t+max(x,y);
        x=p;y=q;z=r;
    }
    cout<<max({x,y,z});
    return 0;
}


Measured memory_bytes: 256
#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 cnt = 0;
    bool brk = false;
    while(1) {
        for(int i = 0; i < N && !brk; i++) {
            if(A[i] % 2 == 0)
                A[i] /= 2;
            else
                brk = true;
        }
        if(brk) break;
        cnt++;
    }

    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr long long INFL = numeric_limits<long long>::max() / 2;
constexpr int MOD = 1000000007;
using Graph = vector<vector<int>>;



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

    int r,g,b;
    cin >>r>>g>>b;
    if((g*10+b)%4==0) cout <<"YES"<<endl;
    else cout <<"NO"<<endl;



}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 1000000007;

int main() {
    ios::sync_with_stdio(false);
    int n, k, a[200005] = {}, l = 0, r = mod;
    cin >> n >> k;
    for (int i = 0; i < n; i++) cin >> a[i];
    while (l + 1 < r) {
        int m = (l + r) / 2, c = 0;
        for (int i = 0; i < n; i++) {
            if (a[i] > m) c += (a[i] - 1) / m;
            c = min(c, mod);
        }
        if (c <= k) r = m;
        else l = m;
    }
    cout << r << '\n';
}


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

int main() {
  int N;
  cin >> N;
  int H[N];
  for (auto &h : H) {
    cin >> h;
  }

  int hr = 1000000000+1;
  for (int i=N-1; 0<=i; --i) {
    if(H[i] <= hr) {
      hr = H[i];
      continue;
    }
    if(H[i] - 1 == hr) {
      hr = H[i]-1;
      continue;
    } else {
      cout << "No\n";
      return 0;
    }
  }
  cout << "Yes\n";
}


Measured memory_bytes: 640
//ABC068A
#include <bits/stdc++.h>
#include <iostream>
#include <iomanip>
#include <numeric>
#include <math.h>
#include <stdio.h>
#include <climits>
#include <cfloat>
#include <string>
#include <numeric>
using namespace std;

int main(){
	int n;
	cin >> n;
	cout << "ABC" << n << endl;
	return 0;
}

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

int main(){
    string a,b,s;
    int n;
    cin>>n;
    for(int i=0;i<n;i++){
        int x;
        cin>>x;
        a +=to_string(x);
        s +=to_string(i+1);
    }
    for(int i=0;i<n;i++){
        int x;
        cin>>x;
        b +=to_string(x);
    }
    int t1 =0,t2 =0,cnt =0;
    while(next_permutation(s.begin(),s.end())){
        cnt++;
        if(s==a) t1 =cnt;
        if(s==b) t2 =cnt;
    }
    cout<<abs(t1-t2)<<endl;
    return 0;
}


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

int main() {
    int a, b;
    cin >> a >> b;
    if (a > b) {
        cout << "a > b" << endl;
    }
    else if (a < b) {
        cout << "a < b" << endl;
    } else {
        cout << "a == b" << endl;
    }
}



Measured memory_bytes: 3080
chomp(my $n = <>);

my $count = $n =~ tr/0-9/0-9/;
my $result;

foreach my $num (1 .. $count) {
    if (($num % 2) == 0) {
        next;
    }

    if ($num == $count) {
        $result += $n - (10 ** ($num - 1)) + 1;
    } else {
        $result += 10 ** ($num) - 10 ** ($num - 1);
    }
}

print $result;

Measured memory_bytes: 512
using System;
using System.Linq;

namespace AGC018
{
    class A
    {
        static void Main(string[] args)
        {
            int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int N = input[0];
            int K = input[1];

            int[] A = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int res = A[0];
            for (int i = 1; i < N; i++)
            {
                res = CalcGCD(res, A[i]);
            }
            if (K % res == 0 && K <= A.Max()) Console.WriteLine("POSSIBLE");
            else Console.WriteLine("IMPOSSIBLE");
        }

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

    }
}


Measured memory_bytes: 19808
#include "bits/stdc++.h"

using namespace std;

using ll = long long;
using ld = long double;
using P = pair<int, int>;
constexpr ld EPS = 1e-12;
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr int MOD = 1e9 + 7;

template <typename T>
void printv(const vector<T> &v)
{
    int sz = v.size();
    for (int i = 0; i < sz; i++)
    {
        cout << v[i] << " \n"[i == sz - 1];
    }
}

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

    int x, y, z, k;
    cin >> x >> y >> z >> k;
    vector<ll> a(x), b(y), c(z);
    for (int i = 0; i < x; i++)
        cin >> a[i];
    for (int i = 0; i < y; i++)
        cin >> b[i];
    for (int i = 0; i < z; i++)
        cin >> c[i];
    vector<ll> cand;
    for (int i = 0; i < x; i++)
    {
        for (int j = 0; j < y; j++)
        {
            cand.emplace_back(a[i] + b[j]);
        }
    }
    sort(cand.rbegin(), cand.rend());
    vector<ll> ret;
    for (int i = 0; i < min((int)cand.size(), k); i++)
    {
        for (int j = 0; j < z; j++)
        {
            ret.emplace_back(cand[i] + c[j]);
        }
    }
    sort(ret.rbegin(), ret.rend());
    for (int i = 0; i < k; i++)
        cout << ret[i] << endl;
}


Measured memory_bytes: 43112
#include <iostream>

#define ok printf("ok\n");




long min(long a, long b){
    if(a>b)
        return b;
    else
        return a;
}

long abs(long a){
    if(a>=0)
        return a;
    else
        return 0-a;
}
long h[110000];
long dp[110000];

int main(){
    long a , b;
    scanf("%ld%ld", &a, &b);

    for(int i=0; i<a; i++){
        scanf("%ld", h+i);
    }

    for(int i=0; i<=a; i++){
        dp[i]=2147483647;
    }
    dp[0]=0;

    for(int i=0; i<a; i++){
        for(int j=1; j<=b; j++){
            if(i+j<a)
                dp[i+j]=min(dp[i+j], dp[i] + abs((h[i]-h[i+j])));
        }
    }

    printf("%ld\n", dp[a-1]);

    return 0;


}


Measured memory_bytes: 1792
import numpy as np

n = int(input())
a = np.zeros((n, 3))
for i in range(n):
    a[i][0], a[i][1], a[i][2] = map(int, input().split())
ans = 0
memo = np.zeros((n + 1, 3))
for i in range(1, n + 1):
    for j in range(3):
        for k in range(3):
            if (j == k):
                continue
            memo[i][j] = max(memo[i][j], memo[i - 1][k] + a[i-1][j])

print(int(max(memo[n])))

Measured memory_bytes: 31468
#include <iostream>
using namespace std;
 
int main(){
  int n,ans;
  double ave,sum;
 
  while(1){
    cin >> n;
    if(n==0){
      break;
    }
 
    int a[n];
 
    for(int i=0;i<n;i++){
      cin >> a[i];
      sum += a[i];
    }
    ave = sum / n;
 
    for(int i=0;i<n;i++){
      if(ave >= a[i]){
        ans++;
      }
    }
 
    cout << ans << endl;
    sum = 0;
    ans = 0;
  }
 
  return 0;
}


Measured memory_bytes: 3140
#include <iostream>
using namespace std;
int main(){
  string a,b,c;
  cin>>a>>b>>c;
  int x=a.size();
  int y=b.size();
  int z=c.size();
  bool w=true;
  char q='a';
  while(w){
    if(q=='a'){
      if(x==0) {
        cout<<'A';
        w=false;
        break;
      }
      q=a.at(a.size()-x);
      x-=1;
    }
    if(q=='b'){
      if(y==0) {
        cout<<'B';
        w=false;
        break;
      }
      q=b.at(b.size()-y);
      y-=1;
    }
    
    
    if(q=='c'){
      if(z==0) {
        cout<<'C';
        w=false;
        break;
      }
      q=c.at(c.size()-z);
      z-=1;
    }
  }
}

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

using namespace std;

#define rep(i,a,n) for(int (i)=a;(i)<(int)(n);(i)++)
#define rrep(i,a,n) for(int (i)=(n)-1;(i)>=a;(i)--)
#define all(x) (x).begin(),(x).end()

typedef long long ll;

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

	if (a > b) {
			cout << "a > b" << endl;
	} else if (a == b) {
			cout << "a == b" << endl;
	} else {
			cout << "a < b" << endl;
	}
}

Measured memory_bytes: 3080
#include <iostream>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <string>
#include <sstream>
#include <algorithm>
#include <random>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>
#include <cassert>
#include <climits>
#include <bitset>
#include <functional>

#define FOR_LT(i, beg, end) for (int i = beg; i < end; i++)
#define FOR_LE(i, beg, end) for (int i = beg; i <= end; i++)
#define FOR_DW(i, beg, end) for (int i = beg; end <= i; i--)

using namespace std;

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

	int n; cin >> n;
	vector<int> vs(n);
	for (auto& v : vs) {
		cin >> v;
	}
	sort(vs.begin(), vs.end());

	double ans = vs[0];
	FOR_LT(i, 1, n) {
		ans = (ans + vs[i]) / 2.0;
	}
	cout << ans << endl;

	return 0;
}

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

using ll = unsigned long long;
using namespace std;

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

    vector<int> b = a;

    sort(b.begin(), b.end(), greater<int>());

    for(int i = 0; i < n; ++i) {
        if (a[i] != b[0]) {
            cout << b[0] << endl;
        } else {
            cout << b[1] << endl;
        }
    }

    return 0;
}

Measured memory_bytes: 3200
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
int main() {
	ll t;
	//cin>>t;
	t=1;
	while(t--)
	{
	  string s;
	  cin>>s;
	  if(s[1]=='R')
	  cout<<"ABC";
	  else
	  cout<<"ARC";
		
	}
	return 0;
}

Measured memory_bytes: 3596
a,b = map(int, input().split())
for i in range(1,1011):
    
    if int(i*0.08) == a and int(i*0.1) == b:
        print(i)
        break
    elif a < int(i*0.08) and b < int(i*0.1):
        print(-1)
        break

Measured memory_bytes: 9104
#include <bits/stdc++.h>
using namespace std;
typedef long double ld;
typedef long long ll;
typedef pair<double, double> pdd;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef vector<pii> vii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
//const int mod = ;

const int N = 1 << 18;
int v[2 * N];

void put(int l, int r, int val) {
  l += N;
  r += N;
  while (l <= r) {
    if (l & 1) {
      v[l] = val;
      ++l;
    }
    if (!(r & 1)) {
      v[r] = val;
      --r;
    }
    l /= 2;
    r /= 2;
  }
}

int getmi(int i) {
  i += N;
  int mi = 1e9;
  while (i) {
    mi = min(mi, v[i]);
    i /= 2;
  }
  return mi;
}

int main() {
  std::ios::sync_with_stdio(false); std::cin.tie(0);
  int n;
  cin >> n;
  vi a(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    if (a[i] > i) {
      cout << -1 << endl;
      return 0;
    }
  }
  for (int i = 0; i < 2 * N; ++i) v[i] = n;
  ll res = 0;
  for (int i = n-1; i >= 0; --i) {
    int ind = getmi(i);
    if (ind < n && a[ind] - a[i] == ind - i) continue;
    if (ind < n && a[ind] - a[i] > ind - i) {
      cout << -1 << endl;
      return 0;
    }
    res += a[i];
    put(i - a[i] + 1, i, i);
  }
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 3072
#3158554 By JAKENU0X5E　参照
n,q = map(int,input().split( ))
s = 1
while s < n:
    s*=2

A = [(-1,2**31-1)]*(2*s-1)
#print(A)
def update(l,r,i,v):#A[l,r)および対応する親ノードをiターン目にvに書き換える
    while l<r:
        if r&1:
            r -= 1###-1
            A[r-1] = (i,v)###-1
        if l&1:
            A[l-1]=(i,v)###-1
            l+=1###+1
        l//=2
        r//=2


for i in range(q):
    c = list(map(int, input().split( )))
    if not c[0]:
        x = c[1]
        y = c[2]
        u = c[3]
        x += s ###
        y += s
        #x -=1###
        update(x,y+1,i,u)
        #print(A)
            
    else:
        res = (-1,0)
        x = c[1] + s-1
        while x>=0:
            #print(res,A[x])
            if A[x] > res:
                res = A[x]
            x -=1
            x//=2
        print(res[1])



Measured memory_bytes: 17136
#include<stdio.h>
#define N 10000
int A[2000001],C[N],B[2000001];
int main()
{
  int i,n;

  scanf("%d",&n);
  for(i=1;i<n+1;i++){
    scanf("%d",&A[i]);
  }

  for(i=0;i<N;i++){
    C[i]=0;
  }
  for(i=1;i<n+1;i++){
    C[A[i]]+=1;
  }
  for(i=0;i<N;i++){
    C[i]+=C[i-1];
  }
  for(i=n+1;i>0;i--){
    B[C[A[i]]]=A[i];
    C[A[i]]-=1;
  }

  for(i=1;i<n;i++){
    printf("%d ",B[i]);
  }
  printf("%d",B[i]);
  printf("\n");
  return 0;
}

Measured memory_bytes: 18268
# ABC 056: B – NarrowRectanglesEasy
w, a, b = [int(s) for s in input().split()]

if a <= b:
    if b <= a + w:
        print(0)
    else:
        print(abs(b - a - w))
else:
    if b <= a <= b + w:
        print(0)
    else:
        print(abs(a - b - w))

Measured memory_bytes: 2940
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#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 <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 <regex>
#define rep(i,n) for(int i = 0; i < n; i++)
#define reps(i,j,n) for(int i = j; i < n; i++)
#define rrep(i,j,n) for(int i = j-1; i >= n; i--)
#define prec(n) fixed << setprecision(n)
#define print_array(v) rep(__k, v.size()) { cout << v[__k]; if(__k != v.size()-1) cout << " "; else cout << endl; }
#define YesorNo(a) printf(a?"Yes\n":"No\n")
#define fi first
#define se second
#define endl "\n"
using namespace std;

//constexpr int inf = 2147483647;
//constexpr int64_t inf64 = 9223372036854775807;
//constexpr int mod = 1e9+7;

int64_t f(int64_t n) {
  return n*(n-1)/2;
}

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

  int n;
  cin >> n;

  vector<int64_t> a(n);
  rep(i,n) cin >> a[i], a[i]--;

  vector<int64_t> cnt(n, 0);
  rep(i,n) cnt[a[i]]++;

  int64_t all = 0;
  rep(i,n) all += f(cnt[i]);

  rep(i,n) {
    cout << all - f(cnt[a[i]]) + f(cnt[a[i]]-1) << endl;
  }

  return 0;
}

Measured memory_bytes: 5760
/**
     **author : _KMS_
     **created : 05-03-2020
**/
#include<bits/stdc++.h>
using namespace std;
const long long M =6e5,MOD=1e9+7;
typedef long long ll;
string s,p="",q;
int main() {
      
   ios::sync_with_stdio(false);
   cin.tie(0);
   int n;
   cin>>n>>s;
   int l=0;
   for(int i=0;i<s.size();i++)
   {
         if(s[i]==')')l--;
         else
         {
               if(l<0)
               {
                    // cout<<l<<endl;
                    l=abs(l);
                     while(l--)p+='(';
                     l=0;
               }
               l++;
         }
   }
            if(l<0)
               {
                     l=abs(l);
                     while(l--)p+='(';
               }
   l=0;
   for(int i=s.size()-1;i>=0;i--)
   {
         if(s[i]=='(')l--;
         else
         {
               //cout<<l<<endl;
               if(l<0)
               {
                     l=abs(l);
                     while(l--)q+=')';
                     l=0;
               }
              
               l++;
         }
       //  cout<<l<<endl;
   }
  // cout<<l<<endl;
             if(l<0)
               {
                     l=abs(l);
                     while(l--)q+=')';
               }
              
   p=p+s+q;
   cout<<p<<endl;
   
   
   return 0;
}

Measured memory_bytes: 256
#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);
  int n,m;
  cin>>n>>m;
  cout<<max((int)0,n-(m*2))<<endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;
constexpr ll INF = 9e18;
constexpr int inf = 1e9;
const double INFD = 1e100;
const ll mod = 1000000007;
const double PI = 3.1415926535897932384626433832795028841971;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
};
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
};

// intやllをstringに変換
template<typename T> inline string toString(const T &a){
  ostringstream oss;
  oss << a;
  return oss.str();
};
// ----------------------------------------------------------------------------

int main(){
  ll N;
  cin >> N;
  ll k;
  bool can = false;
  for(ll i=1; i*(i+1)/2<=N; i++){
    if(i*(i+1)/2 == N){
      can = true;
      k = i;
      break;
    }
  }
  if(!can){
    cout << "No" << endl;
    return 0;
  }
  vector<vector<int>> vec(k+1);
  ll cnt = 1;
  for(int i=0; i<k+1; i++){
    for(int j=i+1; j<k+1; j++){
      vec[i].push_back(cnt);
      vec[j].push_back(cnt);
      cnt++;
    }
  }
  cout << "Yes" << endl;
  cout << k+1 << endl;
  for(int i=0; i<k+1; i++){
    cout << vec[i].size() << " ";
    for(int j=0; j<vec[i].size(); j++){
      cout << vec[i][j];
      if(j != vec[i].size()-1){
        cout << " ";
      }else{
        cout << endl;
      }
    }
  }
  return 0;
}


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

int main() {
  int a;
  cin >> a;
  int amari10 = a % 10;
  int amari100 = a % 100;
  int amari1000 = a % 1000;
  int ichi = amari10;
  int juu = ( amari100 - amari10 ) / 10 ;
  int hyaku = ( amari1000 - amari100 ) / 100 ;
  cout << ichi % 2 + juu % 2 + hyaku % 2 << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <stdlib.h>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <math.h>
#include <string>
using namespace std;

int main()
{
    int x;
    cin >> x;
    cout << x/3;
    
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#define MOD 1000000007
using namespace std;

int n, m, k;

int quickPow(int n, int m) {
	int res = 1;
	while (m) {
		if (m & 1) res = 1LL * res * n % MOD;
		m >>= 1;
		n = 1LL * n * n % MOD;
	}
	return res;
}

int main() {
	scanf("%d%d%d", &n, &m, &k);
	if (m > k) swap(m, k);
	int ans = quickPow(3, m + k), tmp1 = 1, tmp2 = 1;
	for (int p = n + 1, e, u = 1, v = 1; p <= n + m + k; ++p) {
		e = quickPow(3, n + m + k - p);
		v = 1LL * v * (p - 1) % MOD * quickPow(p - n, MOD - 2) % MOD;
		if (p <= n + m) u = u * 2 % MOD;
		else if (p <= n + k) {
			tmp1 = p - n - 1 == m ? 1 : 1LL * tmp1 * (p - n - 1) % MOD * quickPow(p - n - m - 1, MOD - 2) % MOD;
			u = (2LL * u - tmp1 + MOD) % MOD;
		}
		else {		
			tmp1 = p - n - 1 == m ? 1 : 1LL * tmp1 * (p - n - 1) % MOD * quickPow(p - n - m - 1, MOD - 2) % MOD;
			tmp2 = p == (1 + n + k) ? 1 : 1LL * tmp2 * (p - 1 - n) % MOD * quickPow(p - n - 1 - k, MOD - 2) % MOD;
			u = (2LL * u - tmp1 - tmp2 + MOD + MOD) % MOD;
		}
		ans = (ans + 1LL * e * v % MOD * u % MOD) % MOD;
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FIN         ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ii          pair<int,int>
#define F           first
#define S           second
#define pb          push_back
#define all(x)      (x).begin(),(x).end()
#define rall(x)     (x).rbegin(),(x).rend()
#define fore(i,a,b) for(int i = a;i < b; i+= 1)
#define forr(i,a)   for(int i = a; i >= 0; i--)
#define fori(i,m)   for(auto i = m.begin(); i != m.end(); i++) 
#define w(t)        while(t--)
#define sz(s)       int(s.size())
#define cls(a,car)  memset(a,car,sizeof (a))
#define db(x)       cerr << #x << " is " << x << '\n'
#define FI          freopen("input.txt", "r", stdin)
#define FO          freopen("output.txt", "w", stdout)
#define EjecuteTime cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n"
#define angle(x)    double(x * acos(-1) / 180.0)
using namespace std;
typedef long long   ll;
typedef vector<int> vi;
typedef vector<ii>  vii;
const int N = 1e2 + 5;
const ll mod = 1e8 + 7;
const double E = 1e-9;
//int dx[] = {0, -1}, dy[] = {-1, 0};
//int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};
//int dx[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy[] = {0, 1, 1, 1, 0, -1, -1, -1};
//int dx[] = {2, 1, -1, -2, -2, -1, 1, 2}, dy[] = {1, 2, 2, 1, -1, -2, -2, -1};
// fflush(stdout)
// cout << flush
// a + b = a ^ b + 2 * (a & b)
int n;
int w[N], g[N];
ll dp[N][100005];
ll f(int i, int cost){
    if(cost < 0)return -1e9;
    if(i == n)return 0;
    ll &ans = dp[i][cost];
    if(ans == -1){
        ans = 0;
        ans = max(f(i + 1, cost), f(i + 1, cost - w[i]) + g[i]);
    }
    return ans;
}

void solve(){
    int W;
    cin >> n >> W;
    for(int i = 0; i < n; i++)
        cin >> w[i] >> g[i];
    cls(dp, -1);
    cout << f(0, W) << '\n';
}  
int main(){
    FIN;
    int t = 1;
    //cin >> t;
    for(int i = 1; i <= t; i++){
        solve(); 
    }
    EjecuteTime;
    return 0;
}       

Measured memory_bytes: 85824
#include <bits/stdc++.h>
using namespace std;
typedef long long i64;
const int MAXN = 2000000 + 10;
const int MOD = 1e9 + 7;

template<class T>
T modularExp(T base, T exp)
{
	T ret = 1;
	while (exp)
	{
		if (exp & 1)
			ret = ret * base % MOD;
		base = base * base % MOD;
		exp >>= 1;
	}
	return ret;
}
int fact[MAXN + 1], inv[MAXN + 1];

void prepare()
{
	fact[0] = 1;
	for (int i = 1; i <= MAXN; i++)
		fact[i] = 1LL * fact[i - 1] * i % MOD;
	inv[MAXN] = modularExp<i64>(fact[MAXN], MOD - 2) % MOD;
	for (int i = MAXN - 1; i >= 0; i--)
		inv[i] = 1LL * inv[i + 1] * (i + 1) % MOD;
	assert(inv[1] == 1);
}

i64 getBino(int n, int m)
{
	return 1LL * fact[n] * inv[m] % MOD * inv[n - m] % MOD;
}

i64 calcRect(int n, int m, int a, int b)
{
	return ((getBino(n + m + a + b, n + a) - getBino(m + a + b, a)
			- getBino(n + a + b, n + a) + getBino(a + b, a)) % MOD + MOD) % MOD;
}

int main()
{
	int x1, x2, x3, x4, x5, x6;
	int y1, y2, y3, y4, y5, y6;
	prepare();

	cin >> x1 >> x2 >> x3 >> x4 >> x5 >> x6 ;
	cin >> y1 >> y2 >> y3 >> y4 >> y5 >> y6 ;

	int n1 = x2 - x1 + 1, n2 = x6 - x5 + 1;
	int m1 = y2 - y1 + 1, m2 = y6 - y5 + 1;
	int answer = 0;

	for(int x = x3; x <= x4; x++)
		answer = (answer + calcRect(n1, m1, x-x2, y3-y2-1) * calcRect(n2, m2, x5-x, y5-y3) % MOD * (MOD - x - y3)) % MOD ,
		answer = (answer + calcRect(n1, m1, x-x2, y4-y2) * calcRect(n2, m2, x5-x, y5-y4-1) % MOD * (x + y4 + 1)) % MOD;
	for(int y = y3; y <= y4; y++)
		answer = (answer + calcRect(n1, m1, x3-x2-1, y-y2) * calcRect(n2, m2, x5-x3, y5-y) % MOD * (MOD - y - x3)) % MOD,
		answer = (answer + calcRect(n1, m1, x4-x2, y-y2) * calcRect(n2, m2, x5-x4-1, y5-y) % MOD * (y + x4 + 1)) % MOD;
	cout << answer << endl ;

}


Measured memory_bytes: 15872
import java.util.Scanner;

public class Main {
	private static int cnt;

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		int t[][] = new int[n][n];
		int memo[] = new int[n];
		for (int i = 0; i < m; i++) {
			int a = sc.nextInt() - 1;
			int b = sc.nextInt() - 1;
			t[a][b] = 1;
			t[b][a] = 1;
		}
		cnt = 0;
		memo[0] = 1;
		dfs(t, memo, 0, n - 1);
		System.out.println(cnt);
	}

	private static void dfs(int[][] t, int[] memo, int now, int rest) {
		if (rest == 0) {
			cnt++;
			return;
		}
		for (int i = 0; i < t.length; i++) {
			if (t[now][i] == 1 && memo[i] != 1) {
				memo[i] = 1;
				dfs(t, memo, i, rest - 1);
				memo[i] = 0;
			}
		}
	}
}

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

int main(){
int H , W;
while (1){
cin >> H >> W ;
if ( H == 0 && W == 0 ) break;

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

for ( int j = 0 ; j < W ; j++ ) {
cout << "#" ;
}
cout << "\n";
}
cout << endl;

}
return 0;
}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  vector <vector <int> > s(n);
  for (int i = 0; i < m; i++) {
	  int k;
	  cin >> k;
	  for (int j = 0; j < k; j++) {
		  int s_in;
		  cin >> s_in;
		  s[s_in - 1].push_back(i);
		}
	}
  vector <int> p(m);
  for (int i = 0; i < m; i++) {
	  cin >> p[i];
	}
  int ans = 0;
  for (int k = 0; k < (1 << n); k++) {
	  vector <int> o(m, 0);
	  for (int i = 0; i < n; i++) {
		  if (k & (1 << i)) {
			  for (auto itr = s[i].begin(); itr != s[i].end(); itr++) {
				  o[*itr]++;
				}
			}
		}
	  bool flg = true;
	  for (int i = 0; i < m; i++) {
		  if (o[i] % 2 != p[i] % 2) {
			  flg = false;
			  break;
			}
		}
	  if (flg) {
		  ans++;
		}
	}
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.*;

// abc124b
public class Main {

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

		int n = sc.nextInt();

		int ts = sc.nextInt();

		int ans = 1;

		for (int i = 1; i < n; i++) {
			int tmp = sc.nextInt();
			if (tmp >= ts){
				ans++;
			}
			if (tmp > ts) {
				ts = tmp;
			}
		}
		System.out.println(ans);
	}
}


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

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


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

unsigned long long N;
cin >> N;

unsigned long long ans = N;

if(N % 2 == 0){
     cout << ans << endl;
}
else{
     cout << ans * 2 << endl;
}

return 0;
}

Measured memory_bytes: 256
//----------BHAVIK DIWANI(PICT_COMP)---------------
#include<bits/stdc++.h>
#define test ll t; cin>>t; while(t--)
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define mod 1000000007
#define ll long long
#define int long long
#define ull unsigned long long
#define MAX 1000005
#define pb push_back
#define mkp make_pair
#define vi vector<int>
#define pii pair<int,int>
#define endl '\n'
#define vs vector<string>
#define mii map<int,int>
#define msi map<string,int>
#define vpii vector< pair<int, int > >
#define vpsi vector< pair< string ,int > >
#define forci(p,q) for(int i=p;i<q;i++)
ll gcd(ll a,ll b){ if(b==0) return a;    return gcd(b,a%b);}
ll lcm(ll a,ll b) { return (a/gcd(a,b)*b);}
ull power(ull a, ull b) {a %= mod;  ull res = 1;  while (b > 0) { if (b & 1) res = res * a % mod;  a = a * a % mod;  b >>= 1; }  return res%mod; }
ll modmul(ll x, ll y){return (x*y)%mod;}
ll modadd(ll x, ll y){return (x+y)%mod;}
ll modsub(ll x, ll y){return (x-y+mod)%mod;}
ll fact[1000007]={0};
void facto() {fact[0]=1;fact[1]=1;for(int i=2;i<1000007;i++)fact[i]=(fact[i-1]*i)%mod;}
ll ncr(ll n,ll r) {ll res=1; res=fact[n]; res=(res*(power(fact[r],mod-2)))%mod; res=(res*(power(fact[n-r],mod-2)))%mod; return res;}
ll npr(ll n,ll r) {ll res=1; res=fact[n]; res=(res*(power(fact[n-r],mod-2)))%mod; return res;}
inline long long toint(const std::string &s) {std::stringstream ss; ss << s; long long x; ss >> x; return x;}
inline std::string tostring(long long number) {std::stringstream ss; ss << number; return ss.str();}
inline std::string tobin(long long x) {return std::bitset<63>(x).to_string();}
/*bool prime[MAX];
ull sieve(){memset(prime,true,sizeof(prime));for(ull p=2;p*p<MAX;p++){if(prime[p]==true){for(ull i=2*p;i<MAX;i+=p){prime[i]=false;}}}prime[0]=0;prime[1]=0;
}*/
/*int inv[1000001]={0};
void findinverse(){inv[1] = 1;for(int i = 2; i <=1e6 ; ++i)	inv[i] = (mod - (mod/i) * inv[mod%i] % mod) % mod;}
*/
using namespace std;
int solve()
{
	int n;
	cin>>n;
	double a[n];
	double sum=0.0;
	forci(0,n){
		cin>>a[i];
		a[i]=1.0/a[i];
		sum+=a[i];
	}
	double ans=1.0/sum;
	cout<<fixed<<setprecision(6)<<ans;
	return 0;
}
signed main()
{
	fastio;
//	test
		solve();
}







Measured memory_bytes: 3796
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG //GCC5.4.1で配列の範囲外アクセスをエラーにする

//cmdで g++ test.cpp とするとコンパイルできる
//制限1秒なら10^6は余裕 10^7は多分間に合う 10^8はよほど単純でないと厳しい
// https://github.com/atcoder/live_library
// cppdbg: test.exeのterminalに標準入力を打てる

#define ALL(x) x.begin(),x.end()
#define get_tp(t,i) get<i>(t)
#define len(x) (ll)(x.size())
#define ub(a,x) (upper_bound(ALL(a),x)-a.begin())
#define lb(a,x) (lower_bound(ALL(a),x)-a.begin())
typedef long long ll; //long long
typedef pair<int,int> pii; //pair<int,int>
typedef pair<long long,long long> pllll; //pair<ll,ll>
typedef vector<int> vi; //vector<int>
typedef vector<vector<int>> vvi; //vector<vector<int>>
typedef vector<ll> vll; //vector<long long>
typedef vector<vector<ll>> vvll; //vector<vector<long long>>
typedef priority_queue<ll, vector<ll>, greater<ll> > gpq; //逆順priority_queue
typedef priority_queue<ll> pq;

//const int MOD=998244353;
const int MOD=1000000007; //10^9+7
const long double PI=3.1415926535897932;

int main(){
    string S;cin>>S;
    int ans=700;
    for(int i=0;i<3;i++){
        if(S[i]=='o')ans+=100;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3624
#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <numeric>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <time.h>
#include <list>

using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(n);++i)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define reps(x,c) for(auto x:c)
#define all(x) begin(x), end(x)
#define pb(a) emplace_back(a) 
#define mp(a,b) make_pair((a),(b))
#define pl pair<ll,ll>
#define INF 2147483600
#define MOD 1000000007
#define fi first
#define se second
#define dbg(x) cout << #x"="<< (x) << endl
#define dbgv(x) cout<<#x<<endl;reps(y,x){cout<<y<<" ";}cout<<endl

int main(){
  int n,a,b;
  cin>>n>>a>>b;
  
  if(a<b){
    swap(a,b);
  }

  cout<<b<<" "<<max(a+b-n,0)<<endl;
  return 0;
}








Measured memory_bytes: 256
n,m = map(int,input().split())
L = []
ans = 0
for i in range(m):
  L.append(list(map(int,input().split())))
imos = [0]*(n+1)
for i in range(m):
  k = L[i][0]
  l = L[i][1]
  imos[k-1] += 1
  imos[l] -= 1
for i in range(1,n+1):
  imos[i] += imos[i-1]
for i in range(n+1):
  if imos[i] == m:
    ans += 1
print(ans)

Measured memory_bytes: 31288
function Main(input) {
	var output = 0;
  if(input.length <= 2){
     console.log(output);
    return;
     }
  input = input.replace(/BC/g,"D");//BCは塊なので1文字へ 
  var renzoku = 0;
  for(var i = 0; i < input.length; i++){
    var tmp = input.slice(i , i + 1);
    if(tmp == "A"){
       renzoku++;
    }else if(tmp == "D"){
       output += renzoku;
    }else{
       renzoku = 0;
    }
  }
  
  console.log(output);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 7992