akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;
 
public class Main {
    static Scanner in;
    
    int n;
    int[] a;
    int ans = 0;
 
    void solve() {
        n = in.nextInt();
        a = new int[n];
        for(int i = 0; i < n; i++) {
            a[i] = in.nextInt();
        }
        dfs(0, 1);
        System.out.println(ans);
    }
    
    void dfs(int i, int sum) {
        if(i == n) {
            if(sum % 2 == 0) {
                ans++;
            }
            return;
        }
        for(int x = -1; x <= 1; x++) {
            dfs(i + 1, sum * (a[i] + x));
        }
    }
 
    public static void main(String[] args) {
        in = new Scanner(System.in);
        new Main().solve();
    }
}

Measured memory_bytes: 21844
///#pragma GCC optimize("Ofast,unroll-loops,no-stack-protector,fast-math")
///#pragma GCC target("sse,sse2,sse3,ssse3,sse4,abm,mmx,popcnt,avx,avx2,tune=native")

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>

/*
    zet:
        find_by_order(k): k-stat [k > 0]
        order_of_key(k) : {el < k}

    gp_hash_table<key, val, custom_hash>

    rope<T>:
        iterators: mutable_begin, ..
        methods  : erase, insert, substr, ..
*/

#define all(x) (x).begin(), (x).end()
#define size(x) (int)((x).size())
#define em_back emplace_back

using namespace std;
using namespace __gnu_cxx;
using namespace __gnu_pbds;

using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

template<typename T>
using zet = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

mt19937 eng(chrono::steady_clock::now().time_since_epoch().count());

const int N = 2e3 + 4;

ll n, x, a[N], mx[N];

void solve() {
    cin >> n >> x;
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
        mx[i] = a[i];
    }

    ll res = 8e18;
    for (int i = 0; i < n; ++i) {
        ll tmp = 0;
        for (int j = 0; j < n; ++j) {
            mx[j] = min(mx[j], a[(j - i + n) % n]);
            tmp += mx[j];
        }
        res = min(res, tmp + x * i);
    }

    cout << res << "\n";
}

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

    int z = 1;
    /// cin >> z;

    while (z--) {
        solve();
    }

    return 0;
}


Measured memory_bytes: 3600
#include<bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define REP(i,a,b) for (int i = a; i <b; i++)
typedef long long ll;
#define int ll
typedef vector<int> vi;
typedef vector<long long> vl;
typedef pair<int,int> pi;
#define trace(x) cout<<#x<<"="<<x<<"\n";
#define sz(x) (int)(x.size())
#define mod 1000000007

template < typename F, typename S >
ostream& operator << ( ostream& os, const pair< F, S > & p ) {
    return os << "(" << p.first << ", " << p.second << ")";
}

template < typename T >
ostream &operator << ( ostream & os, const vector< T > &v ) {
    os << "{";
    typename vector< T > :: const_iterator it;
    for( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << *it;
    }
    return os << "}";
}

template < typename T >
ostream &operator << ( ostream & os, const set< T > &v ) {
    os << "[";
    typename set< T > :: const_iterator it;
    for ( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << *it;
    }
    return os << "]";
}

template < typename F, typename S >
ostream &operator << ( ostream & os, const map< F, S > &v ) {
    os << "[";
    typename map< F , S >::const_iterator it;
    for( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << it -> first << " = " << it -> second ;
    }
    return os << "]";
}

#define deb(x) cerr << #x << " = " << x << endl;



int32_t main(){
    ios::sync_with_stdio(false);
    int h, w, A, b;
    cin>>h>>w>>A>>b;
    vector<vector<int> >a(h,vector<int>(w,0));
    for(int i=0;i<b;i++){
        for(int j=0;j<A;j++){
            a[i][j]=1;
        }
    }
    for(int i=b;i<h;i++){
        for(int j=A;j<w;j++){
            a[i][j]=1;
        }
    }
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            cout<<a[i][j];
        }
        cout<<"\n";
    }



    return 0;
}

Measured memory_bytes: 9088
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define For(i,n) for(ll i=0;i<(n);i++)
#define For1(i,n) for(ll i=1;i<(n);i++)
#define MOD 1000000007

ll gcd(ll a,ll b){
    return b?gcd(b,a%b):a;
}

int main(){
    ll n;cin>>n;
    vector<ll> a(n+1),b(n+1);
    For(i,n+1){
        cin>>a.at(i);
    }
    For(i,n){
        cin>>b.at(i);
    }
    b.at(n)=0;
    if(n==1){
        cout<<min(a.at(0)+a.at(1),b.at(0))<<endl;
        return 0;
    }
    ll m,ans=0;
    m=min(a.at(0),b.at(0));
    ans+=m;
    a.at(0)-=m;
    b.at(0)-=m;
    For1(i,n+1){
        if(b.at(i-1)){
            m=min(a.at(i),b.at(i-1));
            ans+=m;
            a.at(i)-=m;
            b.at(i-1)-=m;
        }
        if(a.at(i)){
            m=min(a.at(i),b.at(i));
            ans+=m;
            a.at(i)-=m;
            b.at(i)-=m;            
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 1792
parseInt(x) = parse(Int, x)
parseBigInt(x) = parse(BigInt, x)
parseFloat(x) = parse(Float64, x)
parseBigFloat(x) = parse(BigFloat, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function main()
    n,m=parseMap(split(readline()))
    h=parseMap(split(readline()))
    ans=[true for i in 1:n]
    for i in 1:m
        a,b=parseMap(split(readline()))
        ans[a]&=h[a]>h[b]
        ans[b]&=h[a]<h[b]
    end
    println(count(ans))
end
main()

Measured memory_bytes: 202240
#include <iostream>
#include <math.h>
#include <algorithm>
#include <vector>
#include <numeric>
#include <string>
using namespace std;
const double PI = acos(-1.0);
const string alp = "abcdefghijklmnopqrstuvwxyz";
const string ALP = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define REP1(i,n) FOR(i,1,n+1)
#define SUM(c) accumulate((c).begin(),(c).end(),0)
#define UNIQ(c) (c).erase(unique((c).begin(), (c).end()), (c).end());
#define Yn(b) puts(b?"Yes":"No")
#define YN(b) puts(b?"YES":"NO")

bool isprime(int p) {
  if (p==1) return false;
  FOR(i,2,p) {
    if (p%i==0) return false;
  }
  return true;
}

int main(){
  int h,w,d,q,l,r,x[300*300+1],y[300*300+1],z[300*300+1];
  cin >> h >> w >> d;
  REP(i,h*w){
    int j;
    cin >> j;
    x[j]=i%w;
    y[j]=i/w;
  }
  cin >> q;
  REP(i,d){
    z[i]=0;
  }
  FOR(i,d+1,h*w+1){
    z[i]=z[i-d]+abs(x[i]-x[i-d])+abs(y[i]-y[i-d]);
  }
  REP(i,q){
    cin >> l >> r;
    cout << z[r]-z[l] << endl;
  }
  return 0;
}

Measured memory_bytes: 2176
#include <bits/stdc++.h>
using namespace std;
inline void read(int &x) {
  x = 0;
  bool flag = 0;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') {
      flag = 1;
    }
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = x * 10 + ch - 48;
    ch = getchar();
  }
  if (flag) {
    x = -x;
  }
}
const int N = 500005;
int n, k, p[N], ans[N];
int pos[N << 2];
bool inq[N];
inline int merge(int x, int y) {
  return p[x] > p[y] ? x : y;
}
inline void pushup(int p) {
  pos[p] = merge(pos[p << 1], pos[p << 1 | 1]);
}
void build(int p, int l, int r) {
  if (l == r) {
    pos[p] = l;
    return;
  }
  int mid = l + r >> 1;
  build(p << 1, l, mid);
  build(p << 1 | 1, mid + 1, r);
  pushup(p);
}
int query(int p, int l, int r, int L, int R) {
  if (l > R || r < L) {
    return 0;
  }
  if (l >= L && r <= R) {
    return pos[p];
  }
  int mid = l + r >> 1;
  return merge(query(p << 1, l, mid, L, R), query(p << 1 | 1, mid + 1, r, L, R));
}
void modify(int p, int l, int r, int x) {
  if (l == r) {
    pos[p] = 0;
    return;
  }
  int mid = l + r >> 1;
  if (mid >= x) {
    modify(p << 1, l, mid, x);
  } else {
    modify(p << 1 | 1, mid + 1, r, x);
  }
  pushup(p);
}
int main() {
  read(n), read(k);
  for (int i = 1; i <= n; ++i) {
    read(p[i]);
  }
  build(1, 1, n);
  priority_queue<int> q;
  auto check = [&](int pos) {
    if (pos && !inq[pos]) {
      if (pos == query(1, 1, n, pos - k + 1, pos + k - 1)) {
        q.push(pos);
        inq[pos] = 1;
      }
    }
  };
  for (int i = 1; i <= n; ++i) {
    check(i);
  }
  for (int i = n; i; --i) {
    int pos = q.top();
    q.pop();
    ans[pos] = i;
    modify(1, 1, n, pos);
    check(query(1, 1, n, pos - k + 1, pos - 1));
    check(query(1, 1, n, pos + 1, pos + k - 1));
  }
  for (int i = 1; i <= n; ++i) {
    printf("%d\n", ans[i]);
  }
  return 0;
}

Measured memory_bytes: 14432
using System;
using System.Collections.Generic;
using System.Linq;

class MainClass
{
    static void Main()
    {
        int N = int.Parse(Console.ReadLine());

        
        var min = new int[N];
        var max = new int[N];
        for (int i = 0; i < N; i++)
        {
            var r = Console.ReadLine().Split().Select(int.Parse).ToArray();
            min[i] = r[0];
            max[i] = r[1];
        }
        Array.Sort(min);
        Array.Sort(max);
        if (N % 2 == 1)
        {
            Console.WriteLine(max[N/2]-min[N/2]+1);
        }
        else
        {
            Console.WriteLine((max[N / 2] + max[N / 2 - 1]) - (min[N / 2] + min[N / 2 - 1]) + 1);
        }
    }
}

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

typedef vector<int> vi;
typedef vector<bool> vb;
typedef pair<int,int> pii;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<bool> > vvb;
typedef map<int, bool> mib;

typedef long long ll;
typedef vector<long long> vl;
typedef pair<long long,long long> pll;
typedef vector<pair<long long,long long> > vpll;

typedef vector<string> vs;

typedef long double ld;

#define _GLIBCXX_DEBUG

#define REP(i,n) for (int i = 0; i < (n); ++i)
#define REPD(i,n) for (int i = (n-1); i >= 0; --i)
#define FORE(i, s, n) for (int i = (s); i <= (int)(n); i++)
#define debug(x) cerr << #x << ": " << x << '\n'
#define debug2(x, y) cerr << #x << ": " << x << ", " << #y << ": " << y << '\n'
#define debug3(x, y, z) cerr << #x << ": " << x << ", " << #y << ": " << y << ", " << #z << ": " << z << '\n'
#define hyphen() cerr << "--\n"

#define ALL(vec) (vec).begin(), (vec).end()
#define REVALL(vec) (vec).rbegin(), (vec).rend()

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

#define fst first
#define snd second
#define pb push_back
#define mp(x,y) make_pair((x),(y))

const int MOD = (int)1e9 + 7;
const int INF = numeric_limits<int>::max();

signed main() {
    int N, X;

    cin >> X >> N;

    vector<int> Ps(N);
    map<int, bool> mp;
    REP(i, N) {
        int P;
        cin >> P;

        Ps.at(i) = P;
        mp[P] = true;
    }

    FORE(i, 0, 102) {
        // X - iがリスト内に存在するか?
        if (!mp.count(X - i)) {
            cout << X - i << endl;
            return 0;
        }

        // X + iがリスト内に存在するか?
        if (!mp.count(X + i)) {
            cout << X + i << endl;
            return 0;
        }
    }

}



Measured memory_bytes: 3628
import java.util.Scanner;

public class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    double r = sc.nextDouble();
    double pi = Math.PI;
    double area = r*r*pi;
    double length = 2*r*pi;
    System.out.printf("%f %f\n",area,length);
    sc.close();
  }
}



Measured memory_bytes: 28224
#include <stdio.h>


char x[200010];
int power1[200010],power2[200010];
int func(int k)
{
	int C = k;
	int count = 0;
	while(C)
	{
		count += (C%2);
		C/=2;
	}
	if(count==0) return 0;
	else return func(k%count)+1;
}
int main()
{
	int a;
	scanf("%d",&a);
	scanf("%s",x+1);
	
	int count = 0;
	for(int i=1;i<=a;i++) count += (x[i]-'0');
	int count1 = count+1, count2 = count-1;
	
	
	int s1 = 0, s2 = 0;
	for(int i=1;i<=a;i++)
	{
		s1*=2;
		s1+=(x[i]-'0');
		s1%=count1;
	}
	
	if(count2>0)
	{
		for(int i=1;i<=a;i++)
		{
			s2*=2;
			s2+=(x[i]-'0');
			s2%=count2;
		}
	}
	power1[0] = power2[0] = 1;
	for(int i=1;i<=a;i++) power1[i] = 2*power1[i-1],power1[i]%=count1;
	if(count2>0) for(int i=1;i<=a;i++) power2[i] = 2*power2[i-1],power2[i]%=count2;
	
	for(int i=1;i<=a;i++)
	{
		if(x[i]=='0') printf("%d\n",func((s1+power1[a-i])%count1)+1);
		else
		{
			if(count2==0) printf("0\n");
			else printf("%d\n",func((s2-power2[a-i]+count2)%count2)+1);
		}
	}
}

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

using namespace std;

void solve() {
    string S;
    cin >> S;
    
    if (S.size() < 0)
    {
        cout << "NO" << endl;
        return;
    }
    if (S[0] != 'A')
    {
        S.insert(0, "A");
    }
    if (S.size() < 4)
    {
        cout << "NO" << endl;
        return;
    }
    if (S[4] != 'A')
    {
        S.insert(4, "A");
    }
    if (S.size() < 6)
    {
        cout << "NO" << endl;
        return;
    }
    if (S[6] != 'A')
    {
        S.insert(6, "A");
    }
    if (S.size() < 8)
    {
        cout << "NO" << endl;
        return;
    }
    if (S[8] != 'A')
    {
        S.insert(8, "A");
    }
    
    
    
    if (S == "AKIHABARA")
    {
        cout << "YES" << endl;
    }
    else
    {
        cout << "NO" << endl;
    }
    
}

int main() {
    solve();
    return 0;
}

Measured memory_bytes: 3584
#include <iostream>
using namespace std;
int main(){  
  int a,b,n,s,m;
  while(cin>>a>>b>>n){
    s=0;
    m=a%b*10;
    for(int i=0;i<n;i++){
      s+=m/b;
      m=m%b*10;
    }
    cout<<s<<endl;
  }
  return 0;
}

Measured memory_bytes: 0
#include<iostream>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;
typedef long long ll;
#define rep(i,s,n) for(int i = s;i<n;i++)
#define repe(i,s,n) for(int i = s;i<=n;i++)
static const ll maxLL = (ll)1 << 62;
 
int main() {
   int n;
   cin >> n;
   int a[100];
   rep(i,0,n) cin>>a[i];
   
   sort(a,a+n);
   int cnt=0;
   rep(i,0,n){
       cnt++;
       if (a[i]==a[i+1]) cnt--;
   }
   cout << cnt << endl;
   return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <numeric>
#include <string>
#include <map>
#include <stack>
//#include <bits/stdc++.h>
using namespace std;
typedef long long int lli;
#define urept(soeji, start, n) for (int soeji = start; soeji < n; soeji++)
#define drept(soeji, start, n) for (int soeji = start; soeji > n; soeji--)
int main(void)
{
    map<string, int> a;
    int N;
    cin >> N;
    string s;
    for (int i = 0; i < N; i++)
    {
        cin >> s;
        a[s]++;
    }
    if (a.size() == 3)
    {
        cout << "Three" << endl;
    }
    else
    {
        cout << "Four" << endl;
    }
    return 0;
}


Measured memory_bytes: 3616
#include <stdlib.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>

using namespace std;


int main(void){
    int a, b, c, x, y, ans;

    cin >> a >> b >> c >> x >> y;

    int k;
    if(2*c < a + b){
        k = min(x, y);
        ans = 2* c * k;
        x = x - k;
        y = y - k;
    }
    if(2*c < a){
        a = 2*c;
    }
    ans = ans + a * x; 
    if(2*c < b){
        b = 2*c;
    }
    ans = ans + b * y;

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

Measured memory_bytes: 256
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
  int a,b;
  cin>>a>>b;
  int s=0;
  for(int i=0;i<b;i++){
    int n;
    cin>>n;
    s+=n;
  }
  if(s>a){
    cout<<"-1";
  }
  else{
    cout<<a-s;
  }
}

Measured memory_bytes: 3196
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 X = sc.nextInt();
		
		if(X >= A && X <= A+B) {
			System.out.println("YES");
		}else {
			System.out.println("NO");
		}
	}

}


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

struct UF{
 UL N; vector<UL> V;
 void init(UL n){
  N=n; V.resize(N);
  rep(i,N) V[i]=i;
 }
 UL root(UL a){
  if(V[a]==a) return a;
  return V[a]=root(V[a]);
 }
 void unite(UL r,UL s){
  V[root(s)] = root(r);
 }
};

struct Edge{ UL u,v; UL w; };
bool wcmp(const Edge& l, const Edge& r){ return l.w<r.w; }

UL N,M;
Edge J[100000];
UF G;
ULL ans = 0;

int main(){
 scanf("%u%u",&N,&M);
 G.init(N);
 rep(i,M){
  UL u,v,w; scanf("%u%u%u",&u,&v,&w);
  J[i]=Edge{u,v,w};
 }
 sort(J,J+M,wcmp);
 rep(i,M){
  if(G.root(J[i].u)==G.root(J[i].v)) continue;
  G.unite(J[i].u,J[i].v);
  ans+=J[i].w;
 }
 printf("%u\n",ans);
 return 0;
}



Measured memory_bytes: 4404
import java.util.*;

public class Main {

    private int N;

    public void inputData() {
        Scanner sc = new Scanner(System.in);
        N = sc.nextInt();
    }

    public void run() {
        inputData();
        System.out.println(N / 3);
    }

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

}


Measured memory_bytes: 23892
#include <iostream>
using namespace std;
            
int main() {
  int n;
  cin >> n;

  int i, tmp, min, max;
  long long total;
  for (i = 0; i < n; i++) {
    cin >> tmp;
    if (i == 0) {
      min = tmp;
      max = tmp;
      total = tmp;
    } else {
      if (tmp < min) {
        min = tmp;
      } else if (tmp > max) {
        max = tmp;
      }
      total += tmp;
    }
  }
  cout << min << " " << max << " " << total << endl;
  return 0;
}

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

int main() {
  int N,M;
  cin >> N >> M;

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

  vector <int> A(M),B(M);
  vector <bool> C(N,true);
  for(int i=0; i<M;i++){
    cin >> A.at(i) >> B.at(i);
    if(H.at(A.at(i)-1)<H.at(B.at(i)-1)){
      C.at(A.at(i)-1)=false;
    }else if(H.at(A.at(i)-1)==H.at(B.at(i)-1)){
      C.at(A.at(i)-1)=false;
      C.at(B.at(i)-1)=false;
    }else if(H.at(A.at(i)-1)>H.at(B.at(i)-1)){
      C.at(B.at(i)-1)=false;
    }
  }

  int sum=0;

  //cout << "KA" << endl;

  for(int i=0; i<N;i++){
    //cout << C.at(i) <<endl;
    if(C.at(i)==true){
      sum++;
    }
  }



  cout << sum << endl;

}


Measured memory_bytes: 4844
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<vector>
#include<deque>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<utility>
#include<functional>
#include<algorithm>
#include<bitset>
#include<ctime>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<bits/stdc++.h>
using namespace std;
int cost[5][40];
int d[40][40],c[600][600];
vector <pair<int,int> >v[3];
int n,m;
int main()
{
	cin>>n>>m;
	for(int i=1;i<=m;i++) for(int j=1;j<=m;j++) cin>>d[i][j];
	for(int i=1;i<=n;i++) for(int j=1;j<=n;j++) cin>>c[i][j];
	for(int i=1;i<=n;i++)
		for(int j=1;j<=n;j++)
			v[(i+j)%3].push_back(make_pair(i,j));
	for(int i=0;i<3;i++)
		for(int j=1;j<=m;j++)
			for(int k=0;k<v[i].size();k++)
			{
				int x=v[i][k].first;
				int y=v[i][k].second;
				cost[i][j]+=d[c[x][y]][j];
			}
	long long ans=1e11;
	for(int i=1;i<=m;i++)
		for(int j=1;j<=m;j++)
			for(int k=1;k<=m;k++)
			{
				long long sum=0;
				if(i!=j&&j!=k&&i!=k)
				{
					sum=cost[0][i]+cost[1][j]+cost[2][k];
					ans=min(ans,sum);
				}
			}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 3760
import java.util.Scanner;
public class Main {

	//??????????????????????????°
	public static void main(String[] args) {

		int debt = 100000;
		int temp = 0;
		Scanner stdin = new Scanner(System.in);
		int week = stdin.nextInt();

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

			debt *= 1.05;

			if(debt % 1000 != 0) {

				temp = ((debt / 1000) * 1000 + 1000);
				debt = temp;

			}

		}

		System.out.println(debt);

	}

}

Measured memory_bytes: 25540
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <numeric>
#include <functional>
using namespace std;

#define Rep(b, e, i) for(int i = b; i <= e; i++)
#define Repr(e, b, i) for(int i = e; i >= b; i--)
#define rep(n, i) Rep(0, n-1, i)
#define repr(n, i) Repr(n-1, 0, i)
#define all(v) (v).begin(), (v).end()
#define pb(v) push_back(v)
#define uniq(v) (v).erase(unique(all(v)),(v).end())
#define bitcnt(x) __builtin_popcount(x)

typedef long long ll;
typedef pair<ll, ll> llP;
typedef pair<int, int> intP;
typedef std::priority_queue<int> IntPrioQueue; //Z->A
typedef std::priority_queue<int, std::vector<int>, std::greater<int> > IntReversePrioQueue; //A->Z

const int MAX = 100010;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<31-1;
const int MOD = 1000000007;

struct UnionFind {
    //number of parents(par[i] = i => root)
    vector <int> par;
    //rank of tree
    vector <int> rank;

    UnionFind(int n) : par(n), rank(n, 1) {
        //initialize
        rep(n, i) par[i] = i;
    }

    //find root (keiroasshuku at the same time)
    int root(int x){
        if (par[x] == x) return x;
        else return par[x] = root(par[x]);
    }

    //unite
    void unite(int x, int y){
        x = root(x);
        y = root(y);
        if (x == y) return;
        if (rank[x] > rank[y]) swap(x, y);
        par[x] = y;
        rank[y] += rank[x];
    }

    //same tree?
    bool same(int x, int y){
        return root(x) == root(y);
    }
};

set <int> adj[MAX], adjn[MAX];

void solve(void){
    int N, M;
    cin >> N >> M;
    vector <int> p(N);
    UnionFind uf(N);
    rep(N, i) {
        scanf("%d\n", &p[i]);
        p[i]--;
    }
    rep(M, i) {
        int x, y;
        scanf("%d %d\n", &x, &y);
        x--; y--;
        if (x > y) swap(x, y);
        uf.unite(x, y);
    }
    bool used[N];
    memset(used, false, sizeof(used));
    int ans = 0;
    rep(N, x) {
        adj[uf.root(x)].emplace(p[x]);
        adjn[uf.root(x)].emplace(x);
    }
    rep(N, i) {
        int r = uf.root(i);
        if (used[r]) continue;

        if (uf.rank[r] == 1) {
            ans += i == p[i];
            continue;
        }
        bool f[N];
        memset(f, false, sizeof(f));
        for (auto v : adj[r]) {
            f[v] = true;
        }
        printf("\n");
        for (auto v : adjn[r]) {
            if (f[v]) ans++;
        }
        used[r] = true;
    }
    cout << ans << endl;
}

int main(void){
  solve();
  //cout << "yui(*-v・)yui" << endl;
  return 0;
}


Measured memory_bytes: 20352
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>//sort,reverse
#include<utility>//pair
#include<queue>//queue,priority_queue
#include<deque>//double_ended queue
#include<map>//map
using namespace std;
typedef long long LL; 
typedef pair<LL,LL> P;//Pでpair<-,->を表す。
const LL MAX=2000010;
const LL MOD=1000000007;
typedef map<LL,LL>::iterator Itr;

int main()
{ 

    LL n;
    cin>>n;
    LL a[n];
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    LL b[n+1];
    LL c[n+1];
    b[n]=10000000001;
    c[n]=10000000002;
    for(int i=0;i<n;i++){
        b[i]=i+1+a[i];
        c[i]=i+1-a[i];
    }
    sort(b,b+n);
    sort(c,c+n);
    /*for(int i=0;i<n;i++){
        cout<<b[i]<<endl;
    }
    cout<<endl;
    for(int i=0;i<n;i++){
        cout<<c[i]<<endl;
    }*/
    LL cnt=0;
    LL mem=0;
    LL ans=0;
    LL b0=0;
    LL c0=0;
    while(b0<=n&&c0<=n){
        if(b[b0]>c[c0]){c0++;cnt=0;}
        if(b[b0]==c[c0]){
            if(mem!=b[b0]){cnt=0;}
            mem=b[b0];
            cnt++;
            c0++;
        }
        if(b[b0]<c[c0]){
            if(mem==b[b0]){ans=ans+cnt;}
            b0++;
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 8324
#include <stdio.h>

int main(int argc, char *argv[]){
  
  for(;;){
    int num;
    int array[25];
    int i;
    int turn = 0;
    int count = 32;
    
    scanf("%d",&num);

    if(num == 0){
      break;
    }

    for(i = 0; i < num; i++){
      scanf("%d", &array[i]);
    }

    while(count > 0){
      if(turn % 2 == 0){
	count -= (count - 1) % 5;
      }else{
	count -= array[((turn - 1) / 2) % num];
      }
      turn++;
      
      printf("%d\n", count > 0 ? count : 0);
    }
  }
  
  return 0;    
}

Measured memory_bytes: 600
from  itertools import permutations
wait_time = [int(input()) for i in range(5)]
wait_time_p = list(permutations(wait_time))
min_total=643
for time_list in wait_time_p:
    total = 0
    for i in range(len(time_list)):
        total += time_list[i]
        if i == 4:
          break
        mod10 = total % 10
        if mod10 != 0:
            total += (10 - mod10)
    if total <= min_total:
        min_total = total
print(min_total) 

Measured memory_bytes: 3060
#include<bits/stdc++.h>
clock_t t=clock();
namespace IO
{
	using namespace std;
	char buf[1<<22],Out[1<<22],*p1=buf,*p2=buf;
	int p3=-1,f=0;
	inline void file()
	{
		#ifdef NTFOrz
		freopen("file.in","r",stdin);
		#endif
	}
	inline char getchar()
	{
		return (p1==p2)&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++;
	}
	inline void flush(){fwrite(Out,1,p3+1,stdout),p3=-1;}
	inline void check(){if (p3>(1<<21)) flush();}
	inline void putchar(char a){Out[++p3]=a;check();}
	inline void putline(string s)
	{
		int tmp=p3;
		while (p3-tmp<s.size()) putchar(s[p3-tmp]);
		putchar('\n');
	}
	inline char gc()
	{
		char c=getchar();
		while (!c||c=='\n'||c==' ') c=getchar();
		return c;
	}
	inline void chktime()
	{
		#ifdef NTFOrz
		printf("%dms\n",clock()-t);
		#endif
	}
}
namespace my_std
{
	using namespace std;
//	#define getchar IO::getchar
//	#define putchar IO::putchar
    #define Re register
    #define rep(i,a,b) for (Re int i=(a);i<=(b);i++)
    #define drep(i,a,b) for (Re int i=(a);i>=(b);i--)
    #define repv(i,v) for (Re int i=0;i<v.size();i++)
    #define go(u) for (Re int i=head[(u)];i;i=e[i].nxt)
    #define writesp(x) write(x),putchar(' '),IO::check()
    #define writeln(x) write(x),putchar('\n'),IO::check()
    #define mem(x,v) memset(x,v,sizeof(x))
    #define pb push_back
    #define fir first
    #define sec second
    #define MP make_pair
    typedef long long ll;
    typedef unsigned long long ull;
    typedef pair<int,int> pii;
    const int INF=0x7fffffff;
    inline int read()
    {
        ll sum=0,f=0;char c=getchar();
        while (!isdigit(c)) f|=(c=='-'),c=getchar();
        while (isdigit(c)) sum=(sum<<1)+(sum<<3)+(c^48),c=getchar();
        return f?-sum:sum;
    }
    void write(int k)
    {
        if (k<0) putchar('-'),k=-k;
        if (k>=10) write(k/10);
        putchar(k%10+48);
    }
	#define templ template<typename T>
    templ inline void chkmax(T &x,T y){if (x<y) x=y;}
    templ inline void chkmin(T &x,T y){if (x>y) x=y;}
}
using namespace my_std;
char c[114514];
int ___[114514];
stack<int>s;
#define ask(x,y) printf("?%d %d\n",x,y),fflush(stdout)
#define query() (scanf("%s",c+1)&&(c[1]=='Y')) 
int main()
{
	IO::file();
	int a=read(),b=read(),n=a+b;
	if (a<=b) return printf("Impossible\n"),0;
	rep(i,0,n-1)
	{
		if (!s.size()) s.push(i);
		else
		{
			ask(s.top(),i);
			if (query()) s.push(i);
			else s.pop();
		}
	}
	rep(i,0,n-1) ask(s.top(),i),___[i]=query();
	printf("! ");
	rep(i,0,n-1) printf("%d",___[i]);
	IO::flush();
	IO::chktime();
	return 0;
}

Measured memory_bytes: 3888
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String P = sc.next();
		int count =0;
		for (int i=0;i<S.length();i++) {
			if (S.charAt(i)!=P.charAt(i)) {
				count++;
			}
		}
		System.out.println(count);
	}
}


Measured memory_bytes: 41040
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long n, k;
  cin >> n >> k;
  vector<pair<int, int> > vec(n);
  for (int i = 0; i < n; i++) {
    cin >> vec[i].first >> vec[i].second;
  }
  sort(vec.begin(), vec.end());
  for (int i = 0; i < n; i++) {
    k -= vec[i].second;
    if (k <= 0) {
      cout << vec[i].first << '\n';
      return 0;
    }
  }
  return 0;
}


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

typedef long long int ll;
ll MOD = 1000000007;
ll INFL = 1ll << 60;
ll INF = 1 << 28;

// =================グラフテンプレート==================

// costの部分の型は指定できます
template <typename T>
struct edge {
  int from, to;
  T cost;

  edge(int to, T cost) : from(-1), to(to), cost(cost) {}
  edge(int from, int to, T cost) : from(from), to(to), cost(cost) {}

  // 行き先を代入できる
  edge &operator=(const int &x) {
    to = x;
    return *this;
  }

  // その他便利機能、って感じ
  operator int() const { return to; }
  bool operator<(edge x) { return this->cost < x.cost; }
};

template <typename T>
using Edges = vector<edge<T>>;

template <typename T>
using WeightedGraph = vector<Edges<T>>;

template <typename T>
using Matrix = vector<vector<T>>;

using UnWeightedGraph = vector<vector<int>>;

// =============ベルマン・フォード法=============
// 負の閉路を検出できます(空のvectorを返します)
// bellman<距離の型>(重み付き辺の集合,頂点数,始点)

template <typename T>
vector<T> bellman_ford(Edges<T> &edges, int V, int s) {
  const auto INF = INFL;
  vector<T> dist(V, INF);

  dist[s] = 0;
  for (int i = 0; i < V - 1; i++) {
    for (auto &e : edges) {
      if (dist[e.from] != INF)  // 遷移できるなら
        dist[e.to] = min(dist[e.to], dist[e.from] + e.cost);
    }
  }
  for (auto &e : edges) {  // 離島、負の閉路について
    if (dist[e.from] == INF) continue;
    if (dist[e.from] + e.cost < dist[e.to]) return vector<T>();
  }
  return dist;
}

WeightedGraph<ll> g(3000), rg(3000);
bool cango[3000];
bool rcango[3000];
bool tyo[3000];  // 結果使う頂点

void dfs1(int now) {  // 順方向で、行ける辺
  cango[now] = true;
  for (auto x : g[now])
    if (!cango[x.to]) dfs1(x);
}

void dfs2(int now) {  // 逆辺で、行ける辺
  rcango[now] = true;
  for (auto x : rg[now])
    if (!rcango[x.to]) dfs2(x);
}

template <typename T>
ostream &operator<<(ostream &os, vector<T> &vec) {
  cout << "{";
  for (int i = 0; i < vec.size(); i++)
    os << vec[i] << (i + 1 == vec.size() ? "" : " ");
  cout << "}";
  return os;
}

// ====================================================================

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

  for (int i = 0; i < m; i++) {
    int s, t, c;
    cin >> s >> t >> c;
    s--, t--;
    g[s].push_back(edge<ll>{t, c});
    rg[t].push_back(edge<ll>{s, c});  // 無向グラフなら
  }

  dfs1(0);
  dfs2(n - 1);
  for (int i = 0; i < n; i++) tyo[i] = cango[i] & rcango[i];

  Edges<ll> newg;
  for (int i = 0; i < n; i++) {
    if (tyo[i] == 0) continue;
    for (auto x : g[i]) {
      // cout << x.to << endl;
      if (tyo[x.to] == false) continue;
      newg.push_back(edge<ll>{i, x.to, p - x.cost});
    }
  }

  vector<ll> result = bellman_ford(newg, n, 0);
  // cout << result << endl;

  if (result.empty()) {
    cout << -1 << endl;
    return 0;
  } else {
    cout << max(0ll, -result[n - 1]) << endl;
  }
}


Measured memory_bytes: 896
import numpy as np

def distance(p1, p2):
    sum = 0
    for y, z in zip(p1, p2):
        sum += (z - y) ** 2
    return np.sqrt(sum)

N, D = [int(x) for x in input().split(" ")]
X = []
for i in range(N):
    X.append([int(x) for x in input().split(" ")])
X = np.array(X)
eps = 1e-6

count = 0
for i in range(N):
    p1 = X[i, :]
    for j in range(i + 1, N):
        p2 = X[j, :]
        if (distance(p1, p2) - round(distance(p1, p2))) ** 2 < eps:
            count += 1

print(count)


Measured memory_bytes: 12516
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <sstream>
#include <string>
#include <iterator>
#define _repargs(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _repargs(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define inf 2000000007
#define mp make_pair
#define pb push_back
typedef long long ll;
using namespace std;
template <typename T>
inline void output(T a, int p = 0) {
    if(p) cout << fixed << setprecision(p)  << a << "\n";
    else cout << a << "\n";
}
// end of template

template <typename T> inline void voutput(T &v){
    rep(i, v.size()){
        if (i) cout << " " << v[i];
        else cout << v[i];
    }
    cout << endl;
}

vector<vector<int>> shift(vector<vector<int>> C, int s){
    int n = (int)C.size();
    vector<vector<int>>  ret(n, vector<int>(n));
    rep(i, n){
        rep(j, n){
            ret[i][j] = C[j][(i + s * j) % n];
        }
    }
    return ret;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    // source code
    
    int N = 42;
    vector<vector<int>>  A(N * N - N + 1, vector<int>(N));
    vector<vector<int>>  B(N - 1, vector<int> (N - 1));
    int cur = 1;
    rep(i, N){
        A[i][0] = 1;
        rep(j, 1, N){
            A[i][j] = cur + 1;
            cur++;
        }
    }
    rep(i, 1, N){
        rep(j, 1, N){
            B[i - 1][j - 1] = A[i][j];
        }
    }
    
    int ind = N;
    rep(i, N - 1){
        int t = i + 2;
        auto tmp = shift(B, i);
        rep(j, N - 1){
            A[ind][0] = t;
            rep(k, N - 1){
                A[ind][k + 1] = tmp[j][k];
            }
            ind++;
        }
    }
    
    cout << cur << " " << N << endl;
    rep(i, N * N - N + 1){
        voutput(A[i]);
    }
    
    return 0;
}


Measured memory_bytes: 896
def _gcd(a, b)
  if a > b
    return a if b == 0

    _gcd(b, a % b)
  else
    return b if a == 0

    _gcd(a, b % a)
  end
end

def gcd(numbers)
  ans = numbers.first

  numbers[1..-1].each do |n|
    ans = _gcd(ans, n)
  end

  return ans
end

def _lcm(a, b)
  return a * b / _gcd(a, b)
end

def lcm(numbers)
  ans = numbers.first

  numbers[1..-1].each do |n|
    ans = _lcm(ans, n)
  end

  return ans
end

n = gets.to_i
T = []
n.times do
  T << gets.to_i
end

p lcm(T)


Measured memory_bytes: 1788
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9;
const ll mod = 1e9 + 7;
const int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};

using Edge = pair<int, ll>;
using Graphy = vector<vector<Edge> >;

int n;
Graphy g;
vector<int> ans(n);

void dfs(int v, int p, int c) {
  ans[v] = c;
  for (auto e : g[v]) {
    if (e.first == p) continue;
    if (e.second & 1) dfs(e.first, v, 1-c);
    else dfs(e.first, v, c);
  }
}

int main() {
  cin >> n;
  g.assign(n, vector<Edge>());
  rep(i,n-1) {
    int u, v;
    ll w;
    cin >> u >> v >> w;
    u--; v--;
    g[u].push_back(Edge(v,w));
    g[v].push_back(Edge(u,w));
  }
  ans.assign(n,0);
  dfs(0, -1, 0);

  for (auto d : ans) cout << d << endl;

  return 0;
}


Measured memory_bytes: 10496
#include<stdio.h>
#include<string>
#include<utility>
#include<iostream>
#include<queue>
#include<math.h>
#include<algorithm>
#include<vector>
#include<map>
#include<stack>
#include<bitset>

using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0;i<(int)(n);i++)

int mat[505][505];

void nuri(int a,int b,int depth){
    int c=(a+b)/2;
    if(b-a<=0)return;
    if(b-a==1){
        mat[a][b]=depth;
        return;
    }
    for(int i=a;i<=c;i++)for(int j=c+1;j<=b;j++){
        mat[i][j]=depth;
    }
    nuri(a,c,depth+1);
    nuri(c+1,b,depth+1);
}

int main(){
    int n;
    scanf("%d",&n);
    REP(i,505)REP(j,505)mat[i][j]=0;
    nuri(0,n-1,1);
    for(int i=0;i<n;i++){
        for(int j=i+1;j<n;j++){
            printf("%d ",mat[i][j]);
        }
        printf("\n");
    }
    return 0;
}

Measured memory_bytes: 1536
#include<iostream>
#include<vector>
#include<algorithm>
#define INF 1000000000
using namespace std;
int main(){
  int n,m;
  int ma[1000][1000];
  //skk
  for(int i=0;i<1000;i++){
    for(int j=0;j<1000;j++){
      ma[i][j]=INF;
    }
  }
  //in
  cin >> n >> m;
  vector<int> le(n,0);
  vector<int> we(m,0);
  
  for(int i=0;i<n;i++){
    cin >> le[i];
  }
  for(int i=0;i<m;i++){
    cin >> we[i];
  }
  for(int i=0;i<n;i++){
    int mi=INF;
    for(int j=i;j<m-n+1+i;j++){
      if(i==0){
	ma[i][j]=le[i]*we[j];
      }
      else{
	mi=min(mi,ma[i-1][j-1]);
	ma[i][j]=mi+(le[i]*we[j]);
      }
    }
  }
  int ans=INF;
  for(int j=0;j<m;j++){
    ans=min(ans,ma[n-1][j]);
  }
  /* for(int i=0;i<n;i++){
    for(int j=0;j<m;j++){
      cout << ma[i][j]<<" ";
    }
    cout << endl;
    }*/
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 7004
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Scanner;

class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int max = 0;
		int temp[] = new int[21];
		for(int i = 0; i < n; i++){
			int num = sc.nextInt();
			temp[num] = Math.max(sc.nextInt(),temp[num]);
			max = Math.max(max, temp[num]);
		}
		for(int i = 1; i < temp.length; i++){
			if(max == temp[i]){
				System.out.println(i + " " +  temp[i]);
				break;
			}
		}
		
	}
}

Measured memory_bytes: 26404
#include <iostream>
#include <string>
#include <algorithm>

int main() {
	std::string str;
	int ans[4];

	std::cin >> str;

	ans[0] = std::count(str.begin(), str.end(), 'K');
	ans[1] = std::count(str.begin(), str.end(), 'U');
	ans[2] = std::count(str.begin(), str.end(), 'P');
	ans[3] = std::count(str.begin(), str.end(), 'C');

	std::cout << *(std::min_element(ans, std::end(ans))) << std::endl;
}

Measured memory_bytes: 3224
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<utility>
#include<numeric>
#include<vector>
#include<map>
#include<unordered_map>
#include<set>
#include<tuple>
#include<stack>
#include<queue>
#include<tuple>
#include<functional>
#include<iterator>
#include<cmath>
#include<cctype>

using namespace std;

typedef long long ll;
typedef pair<int,int> P;

const int INF = 1e9;
const ll LINF = 1e18;
const int MOD = INF+7;

struct edge{int to,cost;};

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

	string tmp;
	cin >> tmp;
	string cs(tmp);
	sort(cs.begin(),cs.end());
	auto e = unique(cs.begin(),cs.end());

	string s;
	int ans=INF;
	for(auto c=cs.begin();c!=e;c++){
		bool yet=true;
		int cnt=0;
		s = tmp;
		int len=s.size();

		while(yet){
			string ss(100,'A');
			yet=false;
			for(int i=0;i<len-1;i++){
				if(s[i] == *c || s[i+1] == *c) ss[i]=*c;
				else{
					ss[i] = s[i];
					yet=true;
				}
			}
			if(cnt==0 && !yet){
				cout << "0\n";
				return 0;
			}
			cnt++;
			s = ss;
			len--;
		}
		ans = min(ans,cnt);
	}
	cout << ans << "\n";

	return 0;
}

Measured memory_bytes: 256
// abc056_a
#include <bits/stdc++.h>
#ifdef LOCAL
#include "../cxx-prettyprint/prettyprint.hpp"
#endif
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;

#define REP(i, n) for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n) for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define REP_REV(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (int (i) = (int)(n) - 1 ; (i) >= m ; --(i))
#define ALL(x) x.begin(), x.end()

#define INF ((1 << 29)-1)
#define MOD (1000000007)

#define print2D(h, w, arr) REP(i, h) { REP(j, w) cout << arr[i][j] << " "; cout << endl; }
#define print_line(vec, n) {for(int i=0;i<(n-1);i++) cout << (vec)[i] << " "; cout << (vec)[(n)-1] << endl;}
template<class T> void print(const T& x){cout << x << endl;}
template<class T, class... A> void print(const T& first, const A&... rest) { cout << first << " "; print(rest...); }
struct PreMain {PreMain(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(20);}} premain;

int main() {
#ifdef LOCAL
    ifstream in("../arg.txt"); cin.rdbuf(in.rdbuf());
#endif

    char a, b;
    cin >> a >> b;

    if ((a == 'H' && b == 'H') || (a == 'D' && b == 'D')){
        print("H");
    } else {
        print("D");
    }

    return 0;
}


Measured memory_bytes: 256
N = int(input())
C0 = C1 = C2 = C3 = 0
for _ in range(N):
    S = input()
    if S == "AC":
        C0 += 1
    elif S == "WA":
        C1 += 1
    elif S == "TLE":
        C2 += 1
    elif S == "RE":
        C3 += 1

print("AC x %d"%C0)
print("WA x %d"%C1)
print("TLE x %d"%C2)
print("RE x %d"%C3)


Measured memory_bytes: 9140
/*
lakshaygpt28
Lakshay Gupta
*/

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

using ll = long long;
using db = double;
using pii = pair < int, int >;
using pll = pair < ll, ll >;
using vll = vector < ll >;

template < typename T > using OrderedSet = tree < T, null_type, less < T >, rb_tree_tag, tree_order_statistics_node_update >;
template < typename T > using MinPriorityQueue = priority_queue < T, vector < T >, greater < T > >;


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

#define fast_io() ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define eb emplace_back
#define mp make_pair
#define pb push_back
#define mt make_tuple
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

const db PI = acos(-1);
const ll LINF = LLONG_MAX;
const int INF = INT_MAX, MOD = 1e9 + 7, N = 1e5 + 10;

int main() {
    fast_io();
    ll a;
    cin >> a;
    cout << 3 * a * a << "\n";
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define PI 3.1415926535897
using namespace std;
typedef long long ll;
const int INF = 1000000000;
const ll LINF = 1000000000000000000; //1e18
const double EPS = 1e-10;            //

int main(void)
{
    int N;
    cin >> N;

    int sum = 0;
    int a, b;
    for (int i = 0; i < N; i++)
    {
        cin >> a >> b;
        sum += b - a + 1;
    }
    cout << sum << endl;
    return (0);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int n , k , b , a[100001] ;
int main() {
  cin >> n >> k ;
  for ( int i = 1; i <= n ; i++ ) {
    cin >> a[i] ;
    if ( a[i] >= k )
      b++ ;
  }
  cout << b;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
 
using namespace std;
 
using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG
 
/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"
 
#endif
 
void Main() {
    ll N, M;
    cin >> N >> M;
    vector<ll> A(N);
    rep(i, N) cin >> A[i];
    ll cnt = 0;
    ll s = accumulate(A.begin(), A.end(), 0LL);
    rep(i, N) {
        if (A[i] * 4 * M >= s) cnt++;
    }
    if (cnt >= M) {
        cout << "Yes" << '\n';
    } else {
        cout << "No" << '\n';
    }
}
 
int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}

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

int main(){
    int x,y;
    cin >> x >> y;
    if(500*x>=y) puts("Yes");
    else puts("No");

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#pragma GCC optimize ("Ofast")
#define ll long long int
#define FOR(i,a,b) for(ll (i)=(a);i<(ll)(b);i++)
#define rep(i,n) FOR(i,0,n)
#define rep1(i,n) FOR(i,1,n)
#define outi(a) printf("%lld\n",(a))
#define prial(a) cout << a << endl;
#define line cout << endl;
#define pb push_back
using namespace std;
inline ll read()
{
    ll x=0; static int p; p=1; static char c; c=getchar();
    while (!isdigit(c)) { if (c=='-') p=-1; c=getchar(); }
    while ( isdigit(c)) { x=(x<<1)+(x<<3)+(c-48); c=getchar(); }
    x*=p;
    return x;
}
//****************************
ll LCM(ll a, ll b)
{
  return (a*b)/__gcd(a,b);
}
//****************************
int solve(int i);
int main()
{
  solve(0);
}
int solve(int qa) 
{
  ll a = read(), b = read(),
  c = read(), d = read();
  ll q = LCM(c,d); 
  ll ans = b -a + a/c + a/d - a/q - 
  b/c - b/d + b/q + 1;
  if(a%c == 0 || a %d == 0) ans--;
  prial(ans);
}



Measured memory_bytes: 256
import math

x1,y1,x2,y2 = map(int,input().split())
x12 = x2 - x1
y12 = y2 - y1

r = (x12**2+y12**2)**(1/2)
θ = math.asin(abs(y12)/r)
if 0 >= x12 and 0 <= y12:
    θ = math.pi - θ
elif 0 >= x12 and 0 > y12:
    θ += math.pi
elif 0 < x12 and y12 < 0:
    θ = 2*math.pi - θ
x3 = round((2**(1/2)*r)*math.cos(θ + (math.pi/4)) + x1)
y3 = round((2**(1/2)*r)*math.sin(θ + (math.pi/4)) + y1)
x4 = round(r*math.cos(θ + (math.pi/2)) + x1)
y4 = round(r*math.sin(θ + (math.pi/2)) + y1)
print(x3,y3,x4,y4)


Measured memory_bytes: 3316
while 1:
    try:
        count = 0
        rom = []
        while count != 2:
            N = list(map(int, input().split(",")))
            if len(N) == 1:
                count += 1
            rom.append(N)
        half = len(rom) // 2

        for i in range(1, len(rom)):
            for j in range(len(rom[i])):
                if i <= half:
                    if j != 0 and j != len(rom[i]) - 1:
                        rom[i][j] = max(rom[i - 1][j], rom[i - 1][j - 1]) + rom[i][j]
                    elif j == 0:
                        rom[i][j] = rom[i - 1][j] + rom[i][j]
                    else:
                        rom[i][j] = rom[i - 1][j - 1] + rom[i][j]
                else:
                    rom[i][j] = max(rom[i - 1][j], rom[i - 1][j + 1]) + rom[i][j]

        print(rom[-1][0])
    except:
        break



Measured memory_bytes: 5620
a, b, n = map(int, input().split(" "))

max_score = 0
y = min(b, n)

for x in range(max(y - 100000, 1) , min(y + 200000, n+1)):
    score = a * x // b - a * ( x // b )
    if score > max_score:
        max_score = score
print(max_score)


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


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

#define rep(i,s,n)for(ll i=s;i<n;i++)
#define repe(i,s,n)for(ll i=s;i<=n;i++)

int main()
{
	char s[100001]; cin >> s;

	ll i = 0;
	char c = s[0];
	ll cnt = 0;
	while (s[i]) {
		if (c != s[i]) {
			cnt++;
			c = s[i];
		}
		i++;
	}

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

Measured memory_bytes: 384