akhauriyash/Code-Regression huggingface dataset:
/* include */
#include <bits/stdc++.h>

/* using */
using namespace std;

/* main constructor */
struct Fast
{
    Fast()
    {
        std::cin.tie(0);
        ios::sync_with_stdio(0);
        //cout << fixed << setprecision(12);
    }
} fast;

/* template */
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;
}

/* define */
#define REP(i, x, n) for (int i = x; i < (int)(n); ++i)
#define RREP(i, x, n) for (int i = x - 1; i >= (int)(n); --i)
#define rep(i, n) REP(i, 0, n)
#define reps(i, n) REP(i, 1, n + 1)
#define rrep(i, n) RREP(i, n, 0)
#define each(i, n) for (auto &i : n)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define eunique(x) \
    sort(all(x));  \
    (x).erase(unique(all(x)), (x).end())
#define int long long

/* function */
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a * b / gcd(a, b); }

/* const */
const int inf = 1e9 + 7;

/* main */
signed main(void)
{
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    if ((c > b) || (a > d))
    {
        cout << 0 << endl;
    }
    else
    {
        cout << abs(min(b, d) - max(a, c)) << endl;
    }
    return 0;
}

Measured memory_bytes: 256
m[5]['= r'],z,d[4]={0,-2},k,i;f(i){m[k][i]=m[4][i]+47?0:m[k][i]?:1+f(d[k]-~i);}main(t){for(scanf("%*d%d",d);m[4][++i-~*d]=~getchar();d[2]=-*d-2);for(;k--?:(t=k=3,--i);z=z<-t?-t:z)t-=f(i-~*d);printf("%d",z);}

Measured memory_bytes: 78464
package main

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

var (
	BufferSize = 10
)

func readLine(sc *bufio.Scanner) string {
	sc.Scan()
	return sc.Text()
}

func scanStr(sc *bufio.Scanner) string {
	if !sc.Scan() {
		panic(nil)
	}
	return sc.Text()
}

func scanInt(sc *bufio.Scanner) int {
	if !sc.Scan() {
		panic(nil)
	}
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return i
}

func main() {
	sc := bufio.NewScanner(os.Stdin)
	buf := make([]byte, BufferSize)
	sc.Buffer(buf, BufferSize)
	sc.Split(bufio.ScanWords)

	b := scanStr(sc)

	switch b {
	case "A":
		fmt.Println("T")
	case "C":
		fmt.Println("G")
	case "G":
		fmt.Println("C")
	case "T":
		fmt.Println("A")
	}
}


Measured memory_bytes: 640
#include <cstdio>
#include <vector>
#include <queue>
#include <algorithm>
using namespace std;

typedef long long i64;

int main()
{
	int n;
	vector<int> ls;

	scanf("%d", &n);
	ls.resize(2 * n);
	for(int i = 0; i < 2 * n; ++i)
		scanf("%d", &ls[i]);

	sort(ls.begin(), ls.end());
	int ans = 0;
	for(int i = 0; i < n; ++i)
		ans += ls[i * 2];

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

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, b) for(ll i = ll(a); i < ll(b); i++)
#define rer(i, a, b) for(ll i = ll(a) - 1; i >= ll(b); i--)
#define sz(v) (int)(v).size()
#define pb push_back
#define sc second
#define fr first
#define sor(v) sort(v.begin(),v.end())
#define rev(s) reverse(s.begin(),s.end())
#define lb(vec,a) lower_bound(vec.begin(),vec.end(),a)
#define ub(vec,a) upper_bound(vec.begin(),vec.end(),a)
#define uniq(vec) vec.erase(unique(vec.begin(),vec.end()),vec.end())
using namespace std;
typedef long long int ll;
typedef pair <int, int> P;

const ll MOD=1000000007;
int n;
vector<ll> a;
const int MAX_N=100010;
ll dp[MAX_N];
const ll INF=1e15;
void solve(){
    fill(dp,dp+n,INF);
    dp[0]=a[0];
    rep(i,1,n){
        if(*(upper_bound(dp,dp+n,a[i])-1)==a[i]) *upper_bound(dp,dp+n,a[i])=a[i];
        else *lower_bound(dp,dp+n,a[i])=a[i];
    }
    cout<<lower_bound(dp,dp+n,INF)-dp<<"\n";
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin>>n;
    a.resize(n);
    rep(i,0,n) cin>>a[n-1-i];
    ll ans=1;
    ll res=a[0];
    rep(i,1,n){
        if(a[i]>=res){
            ans++;
            res=a[i];
        }
    }
    solve();
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define FOR(i,m,n) for(int i=m;i<(n);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(x) (x).begin(),(x).end()
using namespace std;

int main(void){
  int a, b;
  char c;
  cin >> a >> c >> b;
  if (c == '+')
    cout << a + b << endl;
  else
    cout << a - b << endl;
  return 0;
}


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

#define _USE_MATH_DEFINES

#include <iostream>
#include <sstream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <functional>
#include <utility>
#include <tuple>
#include <vector>
#include <string>
#include <list>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <queue>
#include <deque>
#include <stack>
#include <iterator>
#include <bitset>
#include <complex>
#include <limits>
#include <random>
#include<fstream>
#include<array>


using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector< vector<int> > mat;

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

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)1e9 + 7;

const double EPS = 1e-9;

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

	int N, X, M;
	cin >> N >> X >> M;

	if (N <= 1000000)
	{
		int ans = X;
		int A = X;
		rep(i, 1, N)
		{
			A = (A*A) % M;
			ans += A;
		}
		cout << ans << endl;
	}
	else
	{
		vector<int> C;
		vector<bool> USED(M, false);
		C.push_back(X);
		USED[X] = true;
		int A = X;
		rep(i, 0, M + 1)
		{
			A = (A*A) % M;
			if (USED[A])break;
			USED[A] = true;
			C.push_back(A);
		}

		int t = 0;
		rep(i, 0, M + 1)
		{
			if (C[i] == A)break;
			t++;
		}

		int ans = 0;
		rep(i, 0, SZ(C))
		{
			if (i < t)ans += C[i];
			else ans += C[i] * ((N - i + (SZ(C) - (t)) - 1) / (SZ(C) - (t)));
		}
		cout << ans << endl;
	}

	return 0;
}


Measured memory_bytes: 3896
#include<stdio.h>
#include<stdlib.h>

int cnt=0;
int n;
void insertionSort(int *A,int g){
  int i,j;
  int v;
  for(i=g;i<n;i++){
    v = A[i];
    j = i - g;
    while(j >= 0 && A[j] > v){
      A[j+g] = A[j];
      j -= g;
      cnt++;
    }
    A[j+g] = v;
  }
}

int main(){
  int i;
  int m=0;
  int *A;
  int *G;
  int nn=1;
  scanf("%d",&n);
  while(nn<=n){
      m++;
      nn*=2;
  }
  A = (int *)calloc(n,sizeof(int));
  G = (int *)calloc(m,sizeof(int));
  G[m-1]=1;
  for(i=m-2;i>=0;i--){
    G[i]=2*G[i+1];
  }
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }
  for(i=0;i<m;i++){
    insertionSort(A,G[i]);
  }
  printf("%d\n",m);
  for(i=0;i<m-1;i++){
    printf("%d ",G[i]);
  }
  printf("%d\n%d\n",G[m-1],cnt);
  for(i=0;i<n;i++){
    printf("%d\n",A[i]);
  }
}

Measured memory_bytes: 4948
# coding:utf-8

import sys

INF = float('inf')
MOD = 10 ** 9 + 7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return input()


a, b = LI()

ha = 0
for i in range(1, b - a):
    ha += i

print(ha - a)


Measured memory_bytes: 3060
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <algorithm>
#include <random>
#include <chrono>
#include <iomanip>
#define lint unsigned long long int
#define FOR(x, to) for(int x=0; x<(int)(to); x++)
#define DUMP(ar) for(auto itd=begin(ar); itd != end(ar); itd++) cout << "["s << itd - begin(ar) << "]:"s << *itd << endl
#define DUMPL(ar) for(auto itd=begin(ar); itd != end(ar); itd++) { cout << *itd; if(end(ar)-itd > 1) cout << ' '; } cout << endl
#define COUT(x) cout << (x) << endl
#define ALL(ar) ar.begin(), ar.end()
#define LOOPD(i) cout << "ループ["s << i << "]回目---------------"s << endl
using namespace std;

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

    int n;
    cin >> n;
    vector<int> a(n);
    vector<int> b(n);
    for(int i=0; i<n; i++){
        cin >> a[i];
    }
    for(int i=0; i<n; i++){
        cin >> b[i];
    }
    
    vector<int> tmp(n);
    for(int i=0; i<n; i++) tmp[i] = i+1;

    int a_cnt = 0;
    int b_cnt = 0;
    int loop = 1;
    do{
        if(tmp == a) a_cnt = loop;
        if(tmp == b) b_cnt = loop;
        loop++;
    }while(next_permutation(ALL(tmp)));

    COUT(abs(a_cnt-b_cnt));

    return 0;
}

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

#define CEIL(a,b) ((a) / (b) + ((a) % (b) == 0 ? 0 : 1))

using namespace std;
using ll = long long;
using pii = pair<int, int>;
using a5 = array<pii, 5>;
using a8 = array<int, 8>;
using a15 = array<int, 15>;

constexpr int MOD = 1'000'000'007;
constexpr int INF = 1'000'000'001;
constexpr ll LLINF = 4'000'000'000'000'000'001;
// constexpr int INF = 2147483647; // 2 * 1e9
// constexpr ll LLINF = 9223372036854775807; // 9 * 1e18

const int dx[] = {1, 0, -1, 0, 1, -1, -1, 1, 0};
const int dy[] = {0, 1, 0, -1, 1, 1, -1, -1, 0};

int fact[200'001] = {1};
int inv[200'001] = {1};

int nCr(int n, int r) {
    return (ll)fact[n] * inv[r] % MOD * inv[n-r] % MOD;
}

int mod_pow(int x, int y){
    ll tmp = x, ret = 1;
    while(y){
        if(y & 1){
            ret *= tmp;
            ret %= MOD;
        }
        tmp = tmp * tmp % MOD;
        y >>= 1;
    }
    return ret;
}

int main(){
    for(int i = 1; i <= 200'000; ++i){
        fact[i] = (ll)i * fact[i-1] % MOD;
        inv[i] = mod_pow(fact[i], MOD - 2);
    }
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(10);
    int h, w, a, b;
    cin >> h >> w >> a >> b;
    ll ans = nCr(h + w - 2, h - 1);
    ll sub = 0;
    for(int i = h - a + 1; i <= h; ++i) {
        sub += (ll)nCr(i + b - 2, i - 1) * nCr(w - b - 1 + h - i, h - i) % MOD;
        sub %= MOD;
    }
    ans = (ans + MOD - sub) % MOD;
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 1792
#include <iostream>

int main() {
    int n, k;
    std::string s;
    std::cin >> n >> s >> k;
    char nonreplace_char = s[k-1];
    for (int i = 0; i < n; ++i) {
        if (s[i] != nonreplace_char) {
            s[i] = '*';
        }
    }
    std::cout << s << std::endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
#define rep(i,n)  for(int i=0;i<n;++i)
#define per(i,n)  for(int i=n-1;i>=0;--i)
#define sc1(a)  scanf("%d",&a)
#define sc2(a,b)  scanf("%d %d",&a,&b)
#define sc3(a,b,c)  scanf("%d %d %d",&a,&b,&c)
#define sl1(a)  scanf("%lld",&a)
#define sl2(a,b)  scanf("%lld %lld",&a,&b)
#define sl3(a,b,c)  scanf("%lld %lld %lld",&a,&b,&c)
#define PI 3.1415926535897932
 
const int MAX=710000;
const int MOD=1000000007;
 
long long fac[MAX], finv[MAX], inv[MAX];
 
void COMinit() {
    fac[0]=fac[1]=1;
    finv[0]=finv[1]=1;
    inv[1]=1;
    for (int i=2;i<MAX;i++) {
        fac[i]=fac[i-1]*i%MOD;
        inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;
        finv[i]=finv[i-1]*inv[i]%MOD;
    }
}
long long COM(int n,int k) {
    if (n<k) return 0;
    if (n<0 || k<0) return 0;
    return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD;
}
int main(){
    COMinit();
    int x,y,ans=0;
    sc2(x,y);
    if ((x+y)%3!=0 || x>(x+y)/3*2 || y>(x+y)/3*2){
        printf("0\n");
        return 0;
    }
    ans=COM((x+y)/3,min(x,y)-(x+y)/3);
    printf("%d\n",ans%MOD);
    return 0;
}

Measured memory_bytes: 16896
void call(int n){
  int i = 1, x;
 CHECK_NUM:
  x = i;
  if ( x % 3 == 0 ){
    printf(" %d", i);
    goto END_CHECK_NUM;
  }
 INCLUDE3:
  if ( x % 10 == 3 ){
    printf(" %d", i);
    goto END_CHECK_NUM;
  }
  x /= 10;
  if ( x ) goto INCLUDE3;
 END_CHECK_NUM:
  if ( ++i <= n ) goto CHECK_NUM;

  puts("");
}

main () {
  int n;
  scanf("%d", &n);
  call(n);
}


Measured memory_bytes: 2136
#include<iostream>
using namespace std;
int main() {
	int x,y,z,n=0,v,m;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>x>>y>>z;
		for(int e=0;e<3;e++){
			if(z<y){
				v=y;
				m=z;
				z=v;
				y=m;
			}else if(z<x){
				v=x;
				m=z;
				z=v;
				x=m;
			}
		}
	 if(z*z==y*y+x*x){
			cout<<"YES"<<endl;
		}else{
			cout<<"NO"<<endl;
		}
	}
return 0;
}


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;

//#define int long long
using bll = boost::multiprecision::cpp_int;
using ll = long long;
//constexpr int INF = 1e9;//INT_MAX=(1<<31)-1=2147483647
constexpr ll INF = (ll)1e18;//(1LL<<63)-1=9223372036854775807
constexpr ll MOD = (ll)1e9 + 7;
constexpr double EPS = 1e-9;
constexpr int dx[4]={1,0,-1,0};
constexpr int dy[4]={0,1,0,-1};
#ifdef LOCAL_ENV
	#define debug(var) std::cout<<#var" = "<<var<<std::endl
#else
	#define debug(var)
#endif
#define p(var) std::cout<<var<<std::endl
#define rep(i, n)   for(ll i=0, i##_length=(n); i< i##_length; ++i)
#define repeq(i, n) for(ll i=1, i##_length=(n); i<=i##_length; ++i)
#define all(a) (a).begin(), (a).end()
#define PI (acos(-1))
template<typename T> inline T power(T x, T n){ return n ? power(x*x%MOD,n/2)*(n%2?x:1)%MOD : 1; }
template<typename T> inline T gcd(T a, T b) { return b ? gcd(b,a%b) : a; }
template<typename T> inline T lcm(T a, T b) { return a / gcd(a,  b) * b; }
template<typename T1, typename T2>inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template<typename T1, typename T2>inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
template<typename T1, typename T2> ostream& operator<<(ostream& s, const pair<T1, T2>& p) {return s << "(" << p.first << ", " << p.second << ")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
	for (int i = 0, len = v.size(); i < len; ++i){
		s << v[i]; if (i < len - 1) s << "\t";
	}
	return s;
}
template<typename T> ostream& operator<<(ostream& s, const vector< vector<T> >& vv) {
	for (int i = 0, len = vv.size(); i < len; ++i){
		s << vv[i] << endl;
	}
	return s;
}
template<typename T1, typename T2> ostream& operator<<(ostream& s, const map<T1, T2>& m) {
	s << "{" << endl;
	for (typeof(m.begin()) itr = m.begin(); itr != m.end(); ++itr){
		s << "\t" << (*itr).first << " : " << (*itr).second << endl;
	}
	s << "}" << endl;
	return s;
}

/*-----8<-----8<-----*/

constexpr ll N_MAX = 100;

ll N;
ll a[N_MAX];

void input() {
	scanf("%lld", &N);
	rep(i, N) scanf("%lld", a + i);
}

void solve() {
	ll ans = 0;
	ll t=-1;
	ll c=0;
	vector<ll> b;
	rep(i,N){
		if(t==a[i]){
			c++;
		}else{
			if(c>0)b.push_back(c);
			c=1;
			t=a[i];
		}
	}
	b.push_back(c);

	rep(i,b.size()){
		if(b[i]%2){
			ans+=(b[i]-1)/2;
		}else{
			ans+=(b[i])/2;
		}
	}

	printf("%lld\n", ans);
}

signed main() {
	input();
	solve();
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define r(i,n) for(int i = 0; i<n; i++)
using namespace std;
int main() {
  int n, k;
  string s;
  cin >> n >> k >> s;
  s.at(k-1)=s.at(k-1)-'A'+'a';
  cout << s << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin>>N;
int count=0;
vector<string>vec(N);
for(int i=0; i<N; i++){
cin>>vec.at(i);
}
sort(vec.begin(), vec.end());
  vec.erase(unique(vec.begin(), vec.end()), vec.end());
cout<<vec.size();
}

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

/**
 * Created 2017/06/08.
 */

public class Main {
  public static void main(String[] args) {

    //??\?????¨?????????
    Scanner sc = new Scanner(System.in);
    ArrayList<ArrayList<Integer>> ary_input = new ArrayList<>();
    while (true) {
      ArrayList<Integer> ary = new ArrayList<>();
      int input1 = Integer.parseInt(sc.next());
      int input2 = Integer.parseInt(sc.next());
      if (input1 == 0 && input2 == 0) break;
      ary.add(input1);
      ary.add(input2);
      ary_input.add(ary);
    }
    //System.out.println(ary_input);

    //??????????????????????´?????????????????????????
    ArrayList<ArrayList<StringBuilder>> ary_sb = new ArrayList<>();

    for (ArrayList<Integer> index : ary_input) {
      ary_sb.add(sisakuc(index.get(0), index.get(1)));
    }
    //System.out.println(ary_sb);

    //??¨?????¢???????????????
    for (int i = 0; i < ary_sb.size(); i++) {
      for (int j = 0; j < ary_sb.get(i).size(); j++) {
        System.out.println(ary_sb.get(i).get(j));
      }
      System.out.println("");
    }
  }

  //???????????????????????????(????????\??????????????§?????????

  public static ArrayList<StringBuilder> sisakuc(int a, int b) {
    ArrayList<StringBuilder> ary = new ArrayList<>();
    for (int i = 0; i < a; i++) {
      StringBuilder str1 = new StringBuilder("");
      for (int j = 0; j < b; j++) {
        int ci = i % 2;     //??????????????¨
        int cj = j % 2;     //??????????????¨
        if (ci == 0) {
          switch (cj) {
            case 0:
              str1 = str1.append("#");
              break;
            default:
              str1 = str1.append(".");
              break;
          }
        } else {
          switch (cj) {
            case 0:
              str1 = str1.append(".");
              break;
            default:
              str1 = str1.append("#");
              break;
          }
        }
      }
      ary.add(str1);
    }
    return ary;
  }
}

Measured memory_bytes: 27912
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define FOR(i,start,end) for(int i=start;i<=end;i++)
const int INF = 1e9;
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
typedef long long ll;
const ll MOD=1000000007;
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T>auto MAX(const T& a) { return *max_element(a.begin(),a.end()); }
template<class T>auto MIN(const T& a) { return *min_element(a.begin(),a.end()); }
template<class T, class U>U SUM(const T& a, const U& v) { return accumulate(a.begin(),a.end(), v); }
template<class T, class U>U COUNT(const T& a, const U& v) { return count(a.begin(),a.end(), v); }
template<class T, class U>int LOWER(const T& a, const U& v) { return lower_bound(a.begin(),a.end(), v) - a.begin(); }
template<class T, class U>int UPPER(const T& a, const U& v) { return upper_bound(a.begin(),a.end(), v) - a.begin(); }
int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
int LCM(int a, int b) { int g = GCD(a, b); return a / g * b; }
//---------------------------------------------------------------------------------------------------
typedef pair<int,int> P;

int main(void){
    // Your code here!
    ll n,k,s; cin >> n >> k >> s;
    if (s == 1e9) {
        rep(i,n) {
        if (i < k) cout << s << ' ';
        else cout << 1 << ' ';
     }
     return 0;
    }
    rep(i,n) {
        if (i < k) cout << s << ' ';
        else cout << INF << ' ';
    }

}


Measured memory_bytes: 3588
#include <bits/stdc++.h>
using namespace std;
const long long INF = 1LL << 60;
const int mod = 1e9 + 7;

const int m = 2019;

int main()
{
    long long a, b, d, r;
    double f;
    cin >> a >> b;
    d = a / b;
    r = a % b;
    f = (double)a / (double)b;

    cout << fixed << setprecision(15);
    cout << d << " " << r << " " << f << endl;

    return 0;
}


Measured memory_bytes: 3276
//by kcz 1552920354@qq.com
//if you find any bug in my code
//please tell me
#include<bits/stdc++.h>
using namespace std;

template <typename T> void chmin(T &x,const T &y)
{
	if(x>y)x=y;
}
template <typename T> void chmax(T &x,const T &y)
{
	if(x<y)x=y;
}
typedef long long ll;
typedef pair<int,int> pii;
#define rep(i,l,r) for(int i=l;i<=r;++i)
#define per(i,r,l) for(int i=r;i>=l;--i)
#define pb push_back
#define mp make_pair
#define gc (c=getchar())
char readc()
{
	char c;
	while(gc<'-');
	return c;
}
int read()
{
    char c;
    while(gc<'-');
    if(c=='-')
    {
        int x=gc-'0';
        while(gc>='0')x=x*10+c-'0';
        return -x;
    }
    int x=c-'0';
    while(gc>='0')x=x*10+c-'0';
    return x;
}
#undef gc

const int N=100+5;
int a[N],cnt[N];
int n,L,L2;

ll ans;
void dfs(int x,ll s)
{
	if(x>L)
	{
		rep(i,L+1,L2)
		if(!cnt[i])
		{
			if(!cnt[i*2])
			{
				if(a[i]+a[i*2]<0)s-=a[i]+a[i*2];
			}
			else
			{
				if(a[i]<0)s-=a[i];
			}
		}
		chmax(ans,s);
		return ;
	}
	dfs(x+1,s);
	if(cnt[x]||a[x]>=0)return ;
	for(int y=x;y<=n;y+=x)
	if(++cnt[y]==1)s-=a[y];
	dfs(x+1,s);
	for(int y=x;y<=n;y+=x)--cnt[y];
}

int main()
{
	//freopen("1.in","r",stdin);//freopen("1.out","w",stdout);
	cin>>n;
	rep(i,1,n)cin>>a[i];
	L=n/3;L2=n/2;
	rep(i,L2+1,n)
	if(a[i]<0)a[i]=0;
	
	ll s=0;
	rep(i,1,n)s+=a[i];
	ans=s;
	dfs(1,s);
	cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <algorithm>     //sort,二分探索,など
#include <bitset>        //固定長bit集合
#include <cmath>         //pow,logなど
#include <complex>       //複素数
#include <deque>         //両端アクセスのキュー
#include <functional>    //sortのgreater
#include <iomanip>       //setprecision(浮動小数点の出力の誤差)
#include <iostream>      //入出力
#include <iterator>      //集合演算(積集合,和集合,差集合など)
#include <map>           //map(辞書)
#include <numeric>       //iota(整数列の生成),gcdとlcm(c++17)
#include <queue>         //キュー
#include <set>           //集合
#include <stack>         //スタック
#include <string>        //文字列
#include <unordered_map> //イテレータあるけど順序保持しないmap
#include <unordered_set> //イテレータあるけど順序保持しないset
#include <utility>       //pair
#include <vector>        //可変長配列

using namespace std;
typedef long long ll;

//マクロ
#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPD(i, n) for (ll i = (ll)(n)-1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define FORD(i, a, b) for (ll i = (a); i >= (b); i--)
#define ALL(x) (x).begin(), (x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size())      //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))
#define INF 1000000000000 //10^12
#define MOD 1000000007    //10^9+7
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define MAXR 100000 //10^5:最大のrange(素数列挙などで使用)

// debug
#define DEBUG(x) cout << #x << ": " << x << endl
#define DEBUG2(x, y) cout << #x << ": " << x << " " << #y << ": " << y << endl
#define DEBUG_VEC(v)   \
  cout << #v << ":";   \
  REP(i, v.size())     \
  cout << " " << v[i]; \
  cout << endl
#define DEBUG_ARR(v, n) \
  cout << #v << ":";    \
  REP(i, n)             \
  cout << " " << v[i];  \
  cout << endl

ll N, K;
vector< ll > A;

// x未満の個数がk個未満かどうか
bool count(ll x)
{
  ll cnt = 0;
  REP(i, N)
  {
    // A[i]を固定してx未満になる数を二部探索で求める
    if (A[i] >= 0)
    {
      // A[i] が正の場合
      ll l = -1;
      ll r = N;
      while (r - l > 1)
      {
        ll m = (l + r) / 2;
        if (A[m] * A[i] < x)
        {
          l = m;
        }
        else
        {
          r = m;
        }
      }
      cnt += r;
    }
    else
    {
      // A[i] が負の場合
      ll l = -1;
      ll r = N;
      while (r - l > 1)
      {
        ll m = (l + r) / 2;
        if (A[m] * A[i] < x)
        {
          // 負の場合は逆転する
          r = m;
        }
        else
        {
          l = m;
        }
      }
      cnt += N - r;
    }

    // 重複を除く
    if (A[i] * A[i] < x)
    {
      cnt--;
    }
  }

  // 半分は重複しているので/2
  cnt /= 2;
  return cnt < K;
}

void solve()
{
  // x: -INF ~ INF で x未満がK個未満であるxの値を二部探索で求める
  ll inf = (1e18) + 1;
  ll l = -inf;
  ll r = inf;

  while (r - l > 1)
  {
    ll m = (l + r) / 2;
    if (count(m))
    {
      l = m;
    }
    else
    {
      r = m;
    }
  }

  cout << l << endl;
}

signed main()
{
  cin >> N >> K;
  REP(i, N)
  {
    ll a;
    cin >> a;
    A.push_back(a);
  }
  sort(ALL(A));

  solve();
}


Measured memory_bytes: 2548
n = int(input())
if n == 3:
  print(2,5,63)
elif n == 4:
  print(2,5,20,63)
elif n == 6:
  print(2,4,6,12,3,9)
elif n == 19999:
  ans = []
  for i in range(5000):
    ans.append(3+6*i)
  for j in range(15000):
    m = 2+2*j
    if m != 30:
      ans.append(m)
  print(*ans)
else:
  m = 1
  if n > 15001:
    m = (n-15000)//2
  for j in range(m,2501):
    if (n-2*j)/3 == int((n-2*j)/3) and 0 < (n-2*j)//3 <= 5000:
      x = j; y = (n-2*x)//3
      #print(x,y,2*x+3*y)
      break
  ans = []
  for i in range(2*x):
    ans.append(3+6*i)
  for j in range(3*y):
    ans.append(2+2*j)
    
  print(*ans)

Measured memory_bytes: 41712
#include <bits/stdc++.h>
using namespace std;
int main(void){
  int N;
  cin >> N;
  int h[N];
  for(int i=0; i<N; i++) cin >> h[i];
  int dp[N];
  dp[0] = 0;
  for(int i=0; i<N-1; i++){
    if(i!=0) dp[i+1] = min(dp[i] + abs(h[i+1]-h[i]), dp[i-1] + abs(h[i+1]-h[i-1]) );
    else dp[i+1] = dp[i] + abs(h[i+1]-h[i]);
  }
  cout << dp[N-1] << endl;
}

Measured memory_bytes: 1024
#include<stdio.h>
#include<string.h>
#include<algorithm>
using namespace std;
int arr[205];

int main()
{
	int n;
	int res=0;
scanf("%d",&n);

		int m=2*n;
	for(int i=1;i<=m;i++)
	{
		scanf("%d",&arr[i]);
	}
	sort(arr+1,arr+m+1);
	int k;
	for(int j=1;j<=m;j=j+2)
	{
		k=arr[j];
		
		res=res+k;
		
	}
	
	printf("%d\n",res);
	

}
 

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

int main(){
    int n;
    cin>>n;
    int a[100001];
    for(int i=1;i<=n;i++){
        cin>>a[i];
    }
    
    int x=1,cnt =0;
    while(1){
       if(x==2){
           cout<<cnt<<endl;
           break;
       }
       if(cnt>=n){
           cout << "-1" << endl;
           break;
       }
       cnt++;
       x=a[x];
    }
    return 0;
}

Measured memory_bytes: 640
H=int(input())
h=H//2
a=1
b=1
c=1
for i in range(H):
    if h==1:
        break
    if h==0:
        break
    h=h//2
    a+=1
for i in range(a):
    c=2*c
    b=b+c
if H>1:
    print(b)
else:
    print(1)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define re return
#define ull unsigned long long
#define ll long long
#define ld long double
#define mid (l+r)/2
#define f first
#define s second
#define oo 1e9
#define pi acos(-1)
#define OO 1e18
#define EPS 1e-12
#define FX(n) fixed<<setprecision(n)
#define mm(o,k) memset(o,k,sizeof o)
#define Hossam_Yehia ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
using namespace std;
int n,x,arr[100005],Max;
int main(){
    Hossam_Yehia;
    cin >> n;
    for(int i=0;i<n;++i){cin >> x;arr[x+1]++;}
    for(int i=1;i<=1e5+1;++i)Max=max(Max,arr[i-1]+arr[i]+arr[i+1]);
    cout<<Max<<endl;
    re 0;
}

Measured memory_bytes: 640
from itertools import accumulate
n,k = map(int, input().split())
p = list(map(int,input().split()))
p = [((i*i+i)//2)/i for i in p]
b = list(accumulate([0] + p))
ans = []
for j in range(len(p)-(k - 1)):
    ans.append (b[j + k] - b[j])
print(max(ans))


Measured memory_bytes: 25152
#include <iostream>
#include <queue>
#include <tuple>

int main() {
    int H, W;
    std::cin >> H >> W;
    char A[1002][1002];
    bool memo[1002][1002];
    std::queue<std::tuple<int, int, int>> q;
    for (int i = 0; i <= H + 1; ++i) {
        for (int j = 0; j <= W + 1; ++j) {
            if (i == 0 || i == H + 1 || j == 0 || j == W + 1) {
                A[i][j] = ' ';
                memo[i][j] = false;
            } else {
                std::cin >> A[i][j];
                if (A[i][j] == '#') {
                    q.push(std::make_tuple(i, j, 0));
                    memo[i][j] = true;
                } else {
                    memo[i][j] = false;
                }
            }
        }
    }
    int ans = 0;
    while (!q.empty()) {
        std::tuple<int, int, int> t = q.front();
        int& i = std::get<0>(t);
        int& j = std::get<1>(t);
        int& n = std::get<2>(t);
        if (memo[i - 1][j] == false && A[i - 1][j] == '.') {
            memo[i - 1][j] = true;
            q.push(std::make_tuple(i - 1, j, n + 1));
        }
        if (memo[i + 1][j] == false && A[i + 1][j] == '.') {
            memo[i + 1][j] = true;
            q.push(std::make_tuple(i + 1, j, n + 1));
        }
        if (memo[i][j - 1] == false && A[i][j - 1] == '.') {
            memo[i][j - 1] = true;
            q.push(std::make_tuple(i, j - 1, n + 1));
        }
        if (memo[i][j + 1] == false && A[i][j + 1] == '.') {
            memo[i][j + 1] = true;
            q.push(std::make_tuple(i, j + 1, n + 1));
        }
        q.pop();
        ans = n;
    }
    std::cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 14352
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <set>
#include <queue>
#include <map>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<ld> vld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

#define INF ((int)1e9)
#define INFLL ((ll)1e18)
#define MOD (1000000007LL)


int main(int argc, const char * argv[]) {
    ios_base::sync_with_stdio(false);
    int N;
    ll A, B;
    cin >> N >> A >> B;
    vi p(N+1);
    for (int n = 1; n <= N; ++n) {
        cin >> p[n];
    }
    vi q(N+1);
    for (int n = 1; n <= N; ++n) {
        q[p[n]] = n;
    }
    
    vvll dp(N+1, vll(N+1));
    for (int n = 0; n <= N; ++n) {
        dp[0][n] = 0;
    }
    for (int m = 1; m <= N; ++m) {
        dp[m][0] = dp[m-1][0];
        for (int n = 1; n <= N; ++n) {
            dp[m][n] = min(dp[m-1][n], dp[m][n-1]);
        }
        
        for (int n = 0; n < q[m]; ++n) {
            dp[m][n] += B;
        }
        for (int n = q[m]+1; n <= N; ++n) {
            dp[m][n] += A;
        }
        
    }
    
    ll ans = INFLL;
    for (int n = 0; n <= N; ++n) {
        if (ans > dp[N][n]) {
            ans = dp[N][n];
        }
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 195968
#include <iostream>
#include <vector>

using namespace std;

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

		int mini = sum;
		int prefix_sum = 0;
		for (int i = 0; i < N; ++i) {
				prefix_sum += a[i];
				mini = min(mini, abs(prefix_sum - (sum - prefix_sum)));
		}
		cout << mini << endl;
		return 0;
}


Measured memory_bytes: 256
houses = [[[0 for r in range(10)] for f in range(3)] for b in range(4)]

n = int(input())

for i in range(n):
    b, f, r, v = map(int, input().split())
    houses[b - 1][f - 1][r - 1] += v

for b in range(4):
    for f in houses[b]:
        print('', *f)
    if b != 3:
        print('#' * 20)


Measured memory_bytes: 5624
#include<bits/stdc++.h>
using namespace std;
 
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define int long long
#define rep(i,a,b)    for(int i=a;i<b;i++)
#define repn(i,a,b)   for(int i=a;i>=b;i--)
#define ff first
#define ss second
#define lb lower_bound
#define ub upper_bound
#define pii pair<int,int>
#define vi vector<int>
#define vii vector<pii>
#define vvi vector<vector<int>>;
#define mi  map<int,int>
#define mii map<pii,int>
#define pb push_back
#define ppb pop_back
#define pf push_front
#define ppf pop_front
#define sz(x) (int)x.size()
#define all(v) (v).begin(), (v).end()
#define ret(x) return cout<<x,0;
#define rety return cout<<"YES",0;
#define retn return cout<<"NO",0;
#define fl fflush(stdout)   
#define hell 1000000007  
#define hell2 998244353 
#define pi 3.14159265358979323846

int solve(){
    int h,w;
    cin>>h>>w;
    char c[h][w];
    rep(i,0,h)rep(j,0,w)cin>>c[i][j];
    int dp[h][w];
    memset(dp,0,sizeof dp);dp[0][0]=1;
    rep(i,0,h){
        rep(j,0,w){
            if(c[i][j]=='#')dp[i][j]=0;
            else{
                if(i>0)dp[i][j]+=dp[i-1][j];
                if(j>0)dp[i][j]+=dp[i][j-1];
                dp[i][j]=dp[i][j]%hell;
            }
         //   cout<<dp[i][j]<<" ";
        }
        //cout<<"\n";
    }
    cout<<dp[h-1][w-1];
    return 0;
}

signed main(){
    IOS;
    int t=1;

    //cin>>t;
    while(t--){
        solve();
        cout<<"\n";
    }
    return 0;
} 

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

int main(){
  int n;
  cin >> n;
  vector<int> p(n);
  rep(i,n){cin >> p[i];}
  
  int count  =0;
  rep(i,n){
    if((i+1) != p[i]) count++;
  }
  if(count <= 2){
    cout << "YES" << endl;
  }else{
    cout << "NO" << endl;
  }
}

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

#define CIN_ONLY if(1)
struct cww{cww(){
    CIN_ONLY{
        ios::sync_with_stdio(false);cin.tie(0);
    }
}}star;
#define fin "\n"
#define FOR(i,bg,ed) for(int i=(bg);i<(ed);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
#define pb push_back
#define DEBUG if(0)
#define REC(ret, ...) std::function<ret (__VA_ARGS__)>
template <typename T>inline bool chmin(T &l,T r)
{bool a=l>r;if(a)l=r;return a;}
template <typename T>inline bool chmax(T &l,T r)
{bool a=l<r;if(a)l=r;return a;}
template <typename T>
istream& operator>>(istream &is,vector<T> &v){
    for(auto &it:v)is>>it;
    return is;
}
typedef vector<int> V;
typedef vector<V> VV;
typedef VV Graph;
typedef __int128 INT;
LL loop=10000;

int main(){
    int N,M;
    cin>>N>>M;
    vector<LL> a(M),b(M),c(M);
    REP(i,M){
        cin>>a[i]>>b[i]>>c[i];
        a[i]--;
        b[i]--;
    }
    vector<INT> dist(N,-1e18);
    dist[0]=0;
    int cnt=0;
    vector<int> v(N,0),u(N,0);
    v[N-1]=1;
    u[0]=1;
    for(bool update=true;update&&loop>0;loop--){
        update=false;
        REP(i,M)if(v[b[i]]==1){
            v[a[i]]=1;
            update=true;
        }
    }
    loop=10000;
    for(bool update=true;update&&loop>0;loop--){
        update=false;
        REP(i,M)if(u[a[i]]==1&&v[b[i]]==1){
            u[b[i]]=1;
            update|=chmax(dist[b[i]],dist[a[i]]+c[i]);
        }
    }
    
    if(loop==0)cout<<"inf"<<endl;
    else cout<<(LL)dist[N-1]<<endl;
    return 0;
}


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

inline int readInt(){
  int ret = 0;
  char c;
  while((c=getchar()) && isdigit(c)){
    ret = ret * 10 + (c-'0');
  }
  return ret;
}

void outint(int a){
  if (a == 0)return;
  outint(a/10);
  putchar('0' + a%10);
}

inline void write(int &p,char *buf,int ans){
  if (ans == 0)return;
  write(p,buf,ans/10);
  buf[p++] = '0'+ans%10;
}

main(){
  int n,s;
  int p = 0;
  char buf[10000000];
  while(true){
    n = readInt();
    if (n==0)break;
    s = readInt();
    int r[101]={0};
    int sum[101];
    for(int i=0;i<n;i++){
      int tmp;tmp=readInt();r[tmp]++;
    }
    sum[0] = 0;
    for(int i=1;i<101;i++){
      sum[i] = sum[i-1] + r[i];
    }
    int ans = 0;
    for(int i=1;i != 101;i++){
      if (r[i] && i+i > s)ans += r[i]*(r[i]-1)/2;
      for(int j=i+1;j<101;j++){
	//if (i+j>s)ans += r[i]*r[j];
	if (i+j > s){
	  ans += r[i] * (sum[100] - sum[j-1]);
	  break;
	}
      }
    }
    //printf("%d\n",ans);
    if (ans == 0){
      buf[p++] = '0';
    }else     write(p,buf,ans);
    buf[p++] = '\n';
  }
  buf[p-1] = '\0';
  puts(buf);
}

Measured memory_bytes: 0
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
class Simple {
    int A, B, C;
    void Solve() {
        //input
        A = io.Int;
        B = io.Int;
        C = io.Int;
        //cal
        var ans = A ^ B ^ C;
        //ret
        Console.WriteLine(ans);
    }

    SimpleIO io = new SimpleIO();
    public static void Main(string[] args) { new Simple().Stream(); }
    void Stream() {
        Solve();
        io.writeFlush();
    }
}
class SimpleIO {
    string[] nextBuffer;
    int BufferCnt;
    char[] cs = new char[] { ' ' };
    StreamWriter sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
    public SimpleIO() {
        nextBuffer = new string[0];
        BufferCnt = 0;
        Console.SetOut(sw);
    }
    public string Next() {
        if (BufferCnt < nextBuffer.Length)
            return nextBuffer[BufferCnt++];
        string st = Console.ReadLine();
        while (st == "")
            st = Console.ReadLine();
        nextBuffer = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        BufferCnt = 0;
        return nextBuffer[BufferCnt++];
    }
    public string String => Next();
    public char Char => char.Parse(String);
    public int Int => int.Parse(String);
    public long Long => long.Parse(String);
    public double Double => double.Parse(String);
    public void writeFlush() { Console.Out.Flush(); }
}

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

// ----------- define --------------
#define int long long
#define vi vector<int>
#define vc vector<char>
#define ii pair<int,int>
#define fi first
#define sc second
#define stoi stoll
#define all(x) (x).begin(),(x).end()
#define get_bit(x, k) ((x >> k) & 1)
// ---------------------------------

void MAIN() {
  const int V = 1000000;
  vector<int> f(V + 1, 0);
  int n; cin >> n;
  for (int i = 0; i < n; i++) {
    int t; cin >> t;
    f[t]++;
  }
  int ans = 0;
  for (int i = 1; i <= V; i++) {
    if (f[i] == 1) ans++;
    if (f[i]) {
      for (int j = i; j <= V; j += i) f[j] = 0;
    }
  }
  cout << ans << '\n';
}

signed main() {
  // ios::sync_with_stdio(0); cin.tie(0);
  int T = 1;
  // cin >> T;
  while (T--) MAIN();
}


Measured memory_bytes: 10992
object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val n, s = sc.nextLong()

  def f(b: Long, n: Long, res: Long = 0): Long = {
    if (n == 0) res else f(b, n/b, res + (n % b))
  }

  if (n < s) {
    println(-1)
  } else if (n == s) {
    println(n+1)
  } else {
    var b = 2L
    var continue = true
    while (continue && b * b <= n) {
      if (f(b, n) == s) {
        println(b)
        continue = false
      }
      b += 1
    }

    if (continue) {
      var p = 1L
      var ans = -1L
      while (p * p <= n) {
        if ((n-s) % p == 0) {
          val b = (n-s)/p + 1
          if (f(b, n) == s) {
            ans = b
          }
        }
        p += 1
      }

      if (ans != -1) {
        println(ans)
      } else {
        println(-1)
      }
    }
  }
}


Measured memory_bytes: 55424
#include <bits/stdc++.h>
#define lli long long int
#define MODV 1000000007
#define INF INT_MAX // 2147483647
#define INFLL LLONG_MAX // 9223372036854775807
#define rep(i, n) for(lli i=0, i##_len=(lli)(n); i<i##_len; i++)
#define repf(i, n) for(lli i=1, i##_len=(lli)(n+1); i<i##_len; i++)
#define per(i, n) for(lli i=((lli)(n))-1; i>=0; i--)
#define perf(i, n) for(lli i=((lli)(n)); i>0; i--)
#define all(v) v.begin(), v.end()
#define endl "\n"
#define vi vector<lli>
#define vvi vector<vector<lli>>
#define Yes() cout << "Yes" << endl
#define YES() cout << "YES" << endl
#define No() cout << "No" << endl
#define NO() cout << "NO" << endl
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; }
using namespace std;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(10);
    int x;
    cin >> x;
    repf(i, 9){
        repf(j, 9){
            if(i*j == x){
                Yes();
                return 0;
            }
        }
    }
    No();
    return 0;
}

Measured memory_bytes: 256
local k_enshu, n_ken = io.read("*n", "*n")

local a_ie = {}
for i = 1, n_ken do
    a_ie[i] = io.read("*n")
end

local max_aida = 0
for i = 1, n_ken - 1 do
    local ie_aida = a_ie[i + 1] - a_ie[i] --math.maxを使った方が良かったかも。
    if ie_aida > max_aida then
        max_aida = ie_aida
    end
end
local ie_aida = k_enshu + a_ie[1] - a_ie[n_ken] --math.maxを使った方が良かったかも。
if ie_aida > max_aida then
    max_aida = ie_aida
end

print(k_enshu - max_aida)

Measured memory_bytes: 2432
#include<bits/stdc++.h>
#define N 2010
using namespace std;
char a[N][N];
int s[N][N],sh[N][N],sv[N][N];
int main(){
	int n,m,x1,y1,x2,y2,q;
	scanf("%d%d%d",&n,&m,&q);
	for(int i=1;i<=n;i++){
		scanf("%s",a[i]+1);
		for(int j=1;j<=m;j++){
			s[i][j]=s[i-1][j]+s[i][j-1]+(a[i][j]-'0')-s[i-1][j-1];
		}
	}
	for(int i=1;i<=n;i++){
		for(int j=1;j<m;j++){
			sh[i][j]=sh[i-1][j]+sh[i][j-1]-sh[i-1][j-1];
			if(a[i][j]=='1'&&a[i][j+1]=='1'){
				sh[i][j]++;
			}
		}
	}
	for(int i=1;i<n;i++){
		for(int j=1;j<=m;j++){
			sv[i][j]=sv[i-1][j]+sv[i][j-1]-sv[i-1][j-1];
			if(a[i][j]=='1'&&a[i+1][j]=='1'){
				sv[i][j]++;
			}
		}
	}
	while(q--){
		scanf("%d%d%d%d",&x1,&y1,&x2,&y2);
		x1--,y1--;
		int ans=s[x2][y2]-s[x1][y2]-s[x2][y1]+s[x1][y1];
		ans-=sh[x2][y2-1]-sh[x2][y1]-sh[x1][y2-1]+sh[x1][y1];
		ans-=sv[x2-1][y2]-sv[x2-1][y1]-sv[x1][y2]+sv[x1][y1];
		printf("%d\n",ans);
	}
	return 0;
}

Measured memory_bytes: 53120
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int d = sc.nextInt();

		int sum = Math.min(a, b) + Math.min(c, d);
		System.out.println(sum);
	}
}


Measured memory_bytes: 21844
import time

t0 = time.time()

h,w,m = map(int,input().split())
H = [0]*(h+1)
W = [0]*(w+1)
s = set([])
for i in range(m):
    a,b = map(int,input().split())
    s.add((a,b))

    H[a] += 1
    W[b] += 1

x = [0]*(h+1)
y = [0]*(w+1)
    
for i in range(h+1):
    x[i] = [i,H[i]]
for i in range(w+1):
    y[i] = [i,W[i]]

x.sort(key= lambda val : val[1],reverse=True)
y.sort(key= lambda val : val[1],reverse=True)

ma = x[0][1]
mb = y[0][1]

i,j = 0,0
sw = 0
while 1:
    if j > w:
        break
    if  x[i][1] == ma:
        if (x[i][0],y[j][0]) in s:
            pass
        else:
            if x[i][1]+y[j][1] == ma+mb:
                sw = 1
                break
        i += 1
    else:
        i = 0
        j += 1
    if time.time() - t0 > 2.5:
        break

    
print(ma+mb+sw-1)


Measured memory_bytes: 197076
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <stack> // s.top()
#include <bitset>
#include <queue> // s.front()
using namespace std;

typedef long long Int;
typedef pair<Int,Int> P;
#define print(x) cout<<(x)<<endl

#define INF10 10000000000
#define INF5 100000
#define EPS 1e-10
#define MOD 1000000007



int main() {
	int x, a, b;
	cin >> x >> a >> b; if (b - a <= 0)print("delicious"); else if (x + a >= b)print("safe"); else print("dangerous");






	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>//"Compiler options:"???"-lm"??¨??\???

int main(void){
    while(1){
        int n;
        double m = 0.0,a = 0.0;
        scanf("%d",&n);
        if(n==0)break;
        else{
            int s[n];
            int i;
            for(i=0;i<n;i++){
                scanf("%d",&s[i]);
            }
            for(i=0;i<n;i++){
                m += s[i];
            }
            m /= n;
            for(i=0;i<n;i++){
                a += (s[i]-m)*(s[i]-m);
            }
            a /= n;
            printf("%lf\n",sqrt(a));
        }
    }
    return 0; /*0?????????*/
}

Measured memory_bytes: 636
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int k = sc.nextInt();
    int res = 0;
    ArrayList<Integer> list = new ArrayList<>();
    for (int i = 0; i < n; i++) {
      list.add(sc.nextInt());
    }
    list.sort(Comparator.naturalOrder());
    for (int i = 0; i < k; i++) {
      res += list.get(i);
    }
    System.out.println(res);
    sc.close();
  }
}

Measured memory_bytes: 39276
#include<bits/stdc++.h>
using namespace std;
int a[100005];
int main(){
  int n;cin>>n;
  for(int i=0;i<n;++i){
    int A;cin>>A;
    a[A]++;  
  }
  int ans=0;
  for(int i=1;i<=100005;++i){
    ans=max(a[i-1]+a[i]+a[i+1],ans);
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 640
#include <iostream>
#include <sstream>
#include <stack>
#include <iomanip>
#include <numeric>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cstdlib>
#include <cassert>
#include <map>
#include <set>
#include <vector>
#include <utility>
#include <queue>
#include <cmath>

#define BEGIN(x) x.begin()
#define END(x) x.end()
#define ALL(x) BEGIN(x), END(x)
#define PAIR make_pair
#define VEC(type) vector<type >
#define endl '\n'
#define FIR first
#define SEC second
#define PB push_back
#define SZ(x) ((int)x.size())

#define FOR(i, A, B) for(auto i = (A);i != (B); i++)
#define FORD(i, A, B) for(auto i = (A);i != (B); i--)

#define READRANGE(begin, end) FOR(it, begin, end) cin >> *it
#define READVEC(V) READRANGE(BEGIN(V), END(V))

using namespace std;

typedef long long lint;
typedef pair<int, int> Pii;
typedef pair<int, lint> Pil;
typedef pair<lint, lint> Pll;
typedef pair<lint, int> Pli;

template<class U, class V>
istream& operator >>(istream& in, pair<U, V>& pr) {
    return in >> pr.first >> pr.second;
}

template<class U, class V>
ostream& operator <<(ostream& out, pair<U, V>& p) {
    return out << p.first << " " << p.second;
}

template<class T>
ostream& operator <<(ostream& out, vector<T> vec) {
    for (T& e : vec)
        out << e << " ";
    return out << endl;
}

// ---- BEGIN LIBRARY CODE ----
// ---- END LIBRARY CODE ----
void io_init()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
};

const int MAXK = 100010, _INFINITY = 1 << 29;
int dist[MAXK];

void solveSingleCase(int caseNo)
{
    int K;
    cin >> K;

    FOR(r, 0, K)
        dist[r] = _INFINITY;

    priority_queue<Pii> pq;
    auto add = [&](int r, int s) {
        if (dist[r] > s) {
            dist[r] = s;
            pq.push(Pii(-s, r));
        }
    };

    FOR(d, 1, 10)
        add(d % K, d);

    while (!pq.empty()) {
        Pii pr = pq.top();
        pq.pop();
        int s = -pr.FIR, r = pr.SEC;
        FOR(d, 0, 10)
            add((r * 10 + d) % K, s + d);
    }

    cout << dist[0] << endl;
};

int main(int argc, char **argv)
{
    io_init();

    // Actual program code starts here.
    int T = 1;
    // cin >> T;
    FOR(tcase, 1, T + 1) {
        solveSingleCase(tcase);
    }
    return 0;
};


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

namespace ConsoleApp15
{
    class Class72
    {
        static void Main()
        {
            var A = new int[3][];
            for(int i = 0; i < 3; i++)
            {
                A[i] = Console.ReadLine().Split().Select(int.Parse).ToArray();
                
            }
            int N = int.Parse(Console.ReadLine());
            
            for(int i = 0;i<N;i++)
            {
                int b = int.Parse(Console.ReadLine());
                for(int j = 0; j < 3; j++)
                {
                    for(int k = 0; k < 3; k++)
                    {
                        if (A[j][k] == b) A[j][k] = -1;
                    }
                }
            }
            bool ans = false;
            for(int i = 0; i < 3; i++)
            {
                bool check1 = true;
                bool check2 = true;
                
                for(int j = 0; j < 3; j++)
                {
                    if (A[i][j] != -1) check1 = false;
                    if (A[j][i] != -1) check2 = false;
                }
                if (check1|check2) ans = true;
            }
            if (A[0][0] == A[1][1] && A[0][0] == A[2][2] && A[0][0] == -1)
                ans = true;
            if (A[2][0] == A[1][1] && A[2][0] == A[0][2] && A[2][0] == -1)
                ans = true;
            Console.WriteLine(ans ? "Yes" : "No");
        }
    }
}


Measured memory_bytes: 13396
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations,permutations,accumulate # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict,Counter
import decimal
import re
#import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#

import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7
#mod = 9982443453
def readInts():
  return list(map(int,input().split()))
def I():
  return int(input())
n = I()
A = readInts()
whole = 3**n
ex = 1
for x in A:
    if x % 2 == 0:
        ex *= 2
print(whole - ex)


Measured memory_bytes: 10328