akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
#include <complex>
#include <cstring>
using namespace std;

using ll = long long;
using P = pair<int, int>;
constexpr int INF = 1001001001;
// constexpr int mod = 1000000007;
constexpr int mod = 998244353;

template<class T>
inline bool chmax(T& x, T y){
    if(x < y){
        x = y;
        return true;
    }
    return false;
}
template<class T>
inline bool chmin(T& x, T y){
    if(x > y){
        x = y;
        return true;
    }
    return false;
}

template<int mod>
struct ModInt{
    int x;

    ModInt() : x(0) {}
    
    ModInt(int64_t y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {}
    
    ModInt &operator+=(const ModInt &p){
        if((x += p.x) >= mod)   x -= mod;
        return *this;
    }
    
    ModInt &operator-=(const ModInt &p){
        if((x += mod - p.x) >= mod) x -= mod;
        return *this;
    }

    ModInt &operator*=(const ModInt &p){
        x = (int)(1LL * x * p.x % mod);
        return *this;
    }

    ModInt &operator/=(const ModInt &p){
        *this *= p.inverse();
        return *this;
    }
    
    ModInt operator-() const {return ModInt(-x);}

    ModInt operator+(const ModInt &p) const {return ModInt(*this) += p;}

    ModInt operator-(const ModInt &p) const {return ModInt(*this) -= p;}

    ModInt operator*(const ModInt &p) const {return ModInt(*this) *= p;}

    ModInt operator/(const ModInt &p) const {return ModInt(*this) /= p;}

    bool operator==(const ModInt &p) const {return x == p.x;}

    bool operator!=(const ModInt &p) const {return x != p.x;}

    ModInt inverse() const{
        int a = x, b = mod, u = 1, v = 0, t;
        while(b > 0){
            t = a / b;
            swap(a -= t * b, b);
            swap(u -= t * v, v);
        }
        return ModInt(u);
    }

    ModInt pow(int64_t n) const{
        ModInt ret(1), mul(x);
        while(n > 0){
            if(n & 1)   ret *= mul;
            mul *= mul;
            n >>= 1;
        }
        return ret;
    }

    friend ostream &operator<<(ostream &os, const ModInt &p){
        return os << p.x;
    }

    friend istream &operator>>(istream &is, ModInt &a){
        int64_t t;
        is >> t;
        a = ModInt<mod>(t);
        return (is);
    }

    static int get_mod() {return mod;}
};

using modint = ModInt<mod>;

modint dp[500000];

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

    int N, K;
    cin >> N >> K;
    vector<int> L(K), R(K);
    for(int i = 0; i < K; ++i)  cin >> L[i] >> R[i];
    dp[1] = 1, dp[2] -= 1;
    for(int i = 1; i <= N; ++i){
        dp[i] += dp[i - 1];
        if(dp[i] == 0)  continue;
        for(int j = 0; j < K; ++j){
            dp[i + L[j]] += dp[i];
            dp[i + R[j] + 1] -= dp[i];
        }
    }
    cout << dp[N] << endl;
}

Measured memory_bytes: 5600
#include <stdio.h>
int q_sort(int d[],int left,int right,int e[])
{
	if(left >= right) return 0;
	int pipot = d[(left+right)/2],l = left, r = right,tmp,tmpw;
	while(l < r){
		while(d[l] < pipot) l++;
		while(d[r] > pipot) r--;
		if(l <= r){
			tmp = d[l]; d[l] = d[r]; d[r] = tmp;
			tmpw = e[l];e[l] = e[r]; e[r] = tmpw;
			l++; r--;
		}
	}
	q_sort(d,left,r,e);
	q_sort(d,l,right,e);
}
int main(void){
	int N;
	scanf("%d",&N);
	int i,A[2][N];
	for(i=0;i<N;i++){
		scanf("%d",&A[1][i]);
		A[0][i] = i+1;
	}
	q_sort(A[1],0,N-1,A[0]);
	
	for(i=0;i<N;i++){
		printf("%d ",A[0][i]);
	}
	return 0;
}




Measured memory_bytes: 1536
#include <iostream>
using namespace std;
int main(void){
    char x[1001];
    
    while(1){
        int sum = 0;
        cin >> x;
        if(x[0] == '0') break;   // 条件文で比較するときは''をつけること‼‼
        
        for(int i = 0; x[i] != '\0';i++){
            sum += x[i] - '0';
        }
        cout << sum << endl;
    }
}



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

template
<
    typename TYPE,
    std::size_t SIZE
>
std::size_t a_len(const TYPE (&array)[SIZE])
{
    return SIZE;
}

using namespace std;
using ll = long long int;

#define REP(i,n) for(ll (i) = 0 ; (i) < (n) ; ++(i))
const int INF = 100001;

int n;

int main()
{
    cin >> n;
    int ans = 0;
    REP(i,n){
        int a = 0;
        cin >> a;
        while(!(a%2)){
            a/=2;
            ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
void out(int a, int b, int c, int d) {
	if (a + b + c + d == 7) {
		printf("%d+%d+%d+%d=7", a, b, c, d);
		return;
	}
	if(a+b+c-d==7) {
		printf("%d+%d+%d-%d=7", a, b, c, d);
		return;
	}
	if(a+b-c+d==7) {
		printf("%d+%d-%d+%d=7", a, b, c, d);
		return;
	}
	if(a+b-c-d==7) {
		printf("%d+%d-%d-%d=7", a, b, c, d);
		return;
	}
	if (a - b + c + d == 7) {
		printf("%d-%d+%d+%d=7", a, b, c, d);
		return;
	}
	if (a - b + c - d == 7) {
		printf("%d-%d+%d-%d=7", a, b, c, d);
		return;
	}
	if (a - b - c + d == 7) {
		printf("%d-%d-%d+%d=7", a, b, c, d);
		return;
	}
	if (a - b - c - d == 7) {
		printf("%d-%d-%d-%d=7", a, b, c, d);
		return;
	}
}
int main()
{
	int a, b, c, d,n;
	scanf("%d", &n);
	a = n / 1000;
	b = n / 100 % 10;
	c = n / 10 % 10;
	d = n % 10;
	out(a, b, c, d);
	return 0;
}

Measured memory_bytes: 256
import java.io.{BufferedReader, InputStreamReader}

object Main {
  def main(args: Array[String]): Unit = {
    val in = new BufferedReader(new InputStreamReader(System.in))
    val _ = in.readLine().toInt
    val as = in.readLine().split("\\s+").map(_.toInt)
    val bs = in.readLine().split("\\s+").map(_.toInt)
    val cs = in.readLine().split("\\s+").map(_.toInt)

    System.out.println(
      bs.sum + as.zip(as.tail).filter {
        case (a1, a2) => a1 + 1 == a2
      }.map {
        case (a1, _) => cs.apply(a1 - 1)
      }.sum
    )
  }
}


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

int main(){
  int N;cin >> N;
  vector<int> A(N);
  for(int i=0;i<N;i++){
    cin >> A[i];
  }
  sort(A.begin(),A.end());
  int cnt = 1;
  for(int i=1;i<N;i++){
    if(A[i-1]!=A[i]){
      cnt ++;
    }
  }
  if((N-cnt)%2==0){
    cout << cnt << endl;
  }else{
    cout << cnt-1 << endl;
  }
}

Measured memory_bytes: 3728
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int N=1e5+7;
int n,m,s,t;
int f[N],dep[N],sum[N];
vector<int> ve[N];
void dfs(int x){
	dep[x]=dep[f[x]]+1; sum[x]=dep[x]&1?1:-1;
	for(auto to:ve[x]) if(to!=f[x]) f[to]=x,dfs(to),sum[x]+=sum[to];
}
inline int find(int x){
	return f[x]==x?x:f[x]=find(f[x]);
}
int main(){
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;++i) f[i]=i;
	for(int i=1,a,b;i<=m;++i){
		scanf("%d%d",&a,&b);
		if(find(a)==find(b)) s=a,t=b;
		else f[find(a)]=find(b),ve[a].push_back(b),ve[b].push_back(a);
	}
	memset(f,0,sizeof(f)); dfs(1);
	if(!s){
		if(sum[1]) return puts("-1"),0;
		ll ans=0;
		for(int i=1;i<=n;++i) ans+=abs(sum[i]);
		printf("%lld\n",ans);
	}
	else{
		if(dep[s]+dep[t]&1){
			if(sum[1]) return puts("-1"),0;
			vector<int> vec(1,0); ll ans=0; int x=s,y=t;
			while(x^y){
				if(dep[x]>dep[y]) vec.emplace_back(sum[x]),x=f[x];
				else vec.emplace_back(-sum[y]),y=f[y];
			}
			int mid=vec.size()>>1;
			nth_element(vec.begin(),vec.begin()+mid,vec.end());
			for(x=s;x;x=f[x]) sum[x]-=vec[mid];
			for(y=t;y;y=f[y]) sum[y]+=vec[mid];
			for(int i=1;i<=n;++i) ans+=abs(sum[i]);
			printf("%lld\n",ans+abs(vec[mid]));
		}
		else{
			if(sum[1]&1) return puts("-1"),0;
			int det=-sum[1]/2; ll ans=0;
			for(int x=s;x;x=f[x]) sum[x]+=det;
			for(int x=t;x;x=f[x]) sum[x]+=det;
			for(int i=1;i<=n;++i) ans+=abs(sum[i]);
			printf("%lld\n",ans+abs(det));
		}
	}
	return 0;
}

Measured memory_bytes: 17828
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define call(var) cout<<#var<<"="<<var<<endl;
#define dup(x,y) (((x)+(y)-1)/(y))
using ll=long long;
using vi = vector<int>;
using vl = vector<ll>;
using vb = vector<bool>;
using Graph = vector<vi>;
using P = pair<int,int>;
const int MOD=(int)1e9+7;
const int INF=(int)1e9;
const ll LINF=(ll)1e18;
const int INTMAX = 2147483647;
template<class t,class u> void chmax(t&a,u b){if(a<b)a=b;}
template<class t,class u> void chmin(t&a,u b){if(b<a)a=b;}
Graph G;
vl p;
vb used;

void f(int v, int pre){
    if(pre>=0) p[v] += p[pre];

    for(auto& nx : G[v]){
        if(nx==pre) continue;
        used[nx] = true;
        f(nx,v);
    }
}

int main(){
    int n,q;cin >> n >> q;
    G.resize(n);
    used.assign(n,0);
    rep(i,n-1){
        int a,b;cin >> a >> b;
        --a;--b;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    p.resize(n);
    rep(i,q){
        int a,b;cin >> a >> b;
        --a;
        p[a] += b;
    }
    used[0] = true;
    f(0,-1);
    rep(i,n){
        cout << p[i] << " ";
    }
}

Measured memory_bytes: 24320
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
long n,i,a[5000],t,x;
while(cin>>n,n){
for(i=0;i<n;i++)cin>>a[i];
x=-100000;
for(t=i=0;i<n;i++){
if(t<0)t=a[i];else t+=a[i];
if(x<t)x=t;
}
cout<<x<<endl;
}
return 0;
}

Measured memory_bytes: 1192
import java.util.*;
public class Main{
	public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String t = sc.next();
        String new_s = s + s;
        if(new_s.contains(t)){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
}

Measured memory_bytes: 22996
#include<iostream>
#include<stdio.h>
#include<math.h>
#include<algorithm>
using namespace std;

int main(){

  int n,i,j,tmp;
  int a[256];

  cin >>n;

  for(i=0;i<n;i++){
    cin >>a[i];
  }
  for(i=0,j=n-1;i<j;i++,j--){
    tmp=a[i];
    a[i]=a[j];
    a[j]=tmp;
  }
  for(i=0;i<n-1;i++){
    printf("%d ",a[i]);
  }printf("%d",a[n-1]);
  cout <<endl;
  return 0;
}

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

int n, m, k, a[200005], b[200005], ans, maxans, lo, hi, mid, target;
long long sum_a[200005], sum_b[200005];

int main(){
    scanf("%d%d%d", &n, &m, &k);
    for (int i=1; i<=n; ++i){
        scanf("%d", &a[i]);
        sum_a[i] = sum_a[i-1] + a[i];
    }
    for (int i=1; i<=m; ++i){
        scanf("%d", &b[i]);
        sum_b[i] = sum_b[i-1] + b[i];
    }
    for (int i=0; i<=n; ++i){
        if (sum_a[i] > k) break;
        if (sum_a[i] + sum_b[m] <= k){
            maxans = max(maxans, i + m);
            continue;
        }
        target = k - sum_a[i];
        ans = 0;
        lo = 0; hi = m;
        while (lo <= hi){
            mid = (lo + hi) / 2;
            if (sum_b[mid] <= target){
                ans = mid;
                lo = mid + 1;
            }
            else{
                hi = mid - 1;
            }
        }
        maxans = max(maxans, ans + i);
    }
    cout<<maxans;
}


Measured memory_bytes: 8344
#include<iostream>

using namespace std;

int main(){
        string s;
        string t;

        cin >> s;
        cin >> t;

        int leng = s.length();
        int cnt_change=0;

        for(int i=0; i < leng; i++){
                if(s[i] - t[i] != 0) cnt_change++;
        }

        cout << cnt_change;

        return 0;
}

Measured memory_bytes: 3920
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-8;
const ll mod=1e9+7;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

int n,m,x;
vi a;
vvi b;

int main(){
	cin>>n>>m>>x;
	a=vi(n);
	b=vvi(n,vi(m));
	for(int i=0;i<n;i++){
		cin>>a[i];
		for(int j=0;j<m;j++) cin>>b[i][j];
	}
	int res=inf;
	for(int i=0;i<1<<n;i++){
		bool B=1;
		int tmp=0;
		vi c(m);
		for(int j=0;j<n;j++) if(i&1<<j){
			tmp+=a[j];
			for(int k=0;k<m;k++) c[k]+=b[j][k];
		}
		for(int j=0;j<m;j++) if(c[j]<x) B=0;
		if(B) res=min(res,tmp);
	}
	cout<<(res==inf?-1:res)<<endl;
}

Measured memory_bytes: 3632
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
using namespace std;
typedef long long ll;

ll comb2(int);

int main()
{
	char c;
	cin >> c;
	if (c=='a'|| c == 'e' || c == 'i' || c == 'o' || c == 'u')
	{
		cout << "vowel";
	}
	else
	{
		cout << "consonant";
	}
	return 0;
}

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

using namespace std;

#define sp(x) cout<<setprecision(x);
#define all(a) (a).begin(), (a).end()
#define inf 10000000
#define linf INT64_MAX*0.99
#define lint long long
#define FOR(i,a,b) for(lint i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define yes "Yes"
#define no "No"
#define divs 1000000007
#define dive 1000000009

typedef pair<int, int> P;

lint ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}
 
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
	lint n, a, b; cin>>n>>a>>b;
	lint q = n/(a+b);
	lint r = n%(a+b);
	if(r>a) r = a;
	cout<<q*a+ r<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<cstdlib>
#include<cstring>
using namespace std;
inline int read()
{
	int x=0,f=1;char ch=getchar();
	while(ch<'0' || ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0' && ch<='9')x=x*10+ch-'0',ch=getchar();
	return x*f;
}
int stack[20];
inline void write(int x)
{
	if(x<0){putchar('-');x=-x;}
	if(!x){putchar('0');return;}
	int top=0;
	while(x)stack[++top]=x%10,x/=10;
	while(top)putchar(stack[top--]+'0');
}
inline void pr1(int x){write(x),putchar(' ');}
inline void pr2(int x){write(x),puts("");}
int a[200010],cnt[200010];
int main()
{
    //freopen("a.in","r",stdin);
    //freopen("a.out","w",stdout);
   	int n=read();
   	for(int i=1;i<=n;i++)a[i]=read(),cnt[a[i]]++;
   	long long ans=0,sum;
   	for(int i=1;i<=n;i++)ans+=1LL*cnt[i]*(cnt[i]-1)/2;
   	sum=ans;
   	for(int i=1;i<=n;i++)
   	{
   		ans=sum;
   		ans-=1LL*cnt[a[i]]*(cnt[a[i]]-1)/2;
   		ans+=1LL*(cnt[a[i]]-1)*(cnt[a[i]]-2)/2;
   		printf("%lld\n",ans);
   	}
    return 0;
}

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

using namespace std;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define itn long long

typedef long long ll;
typedef pair<ll,ll> p;


int main()
{
  #define int long long
  int n;
  cin >> n;
  vector<int> v(n, 0);
  vector<int> sum(n, 0);
  int tmp = 0;
  for (int i = 0; i < n; i++)
  {
    cin >> v[i];
    tmp += v[i];
    sum[i] = tmp;
  }
  int res = INT_MAX;
  for (int i = 0; i < n-1; i++)
  {
    int hoge = sum[i];
    int huga = sum[n-1] - hoge;
    res = min(res, abs(hoge - huga));
  }

  cout << res << endl;
}

Measured memory_bytes: 3328
#include<bits/stdc++.h>
#define ll long long
#define maxn 200005
#define pii pair < int, int >
using namespace std;

int main()
{
    int k, n;

    cin >> k >> n;

    int a[n + 5];
    vector < int > b;

    for(int i = 0; i < n; i++) cin >> a[i];

    for(int i = 0; i < n - 1; i++) b.push_back(a[i + 1] - a[i]);

    b.push_back(k - a[n - 1] + a[0]);

    int sum = 0;

    sort(b.begin(), b.end());

    for(int i = 0; i < b.size() - 1; i++) sum += b[i];

    cout << sum << endl;

    return 0;
}


Measured memory_bytes: 2168
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n, k, c = na()
s = ns()

wp = []
for i in range(n):
    if s[i] == 'o':
        last = -99999 if len(wp) == 0 else wp[-1] + c
        if last < i:
            wp.append(i)

wf = []
for i in range(n-1, -1, -1):
    if s[i] == 'o':
        last = 99999999 if len(wf) == 0 else wf[-1] - c
        if last > i:
            wf.append(i)
wf = wf[::-1]

if len(wp) != k:
    sys.exit(0)

swp = set(wp)
for d in wf:
    if d in swp:
        print(d+1)


Measured memory_bytes: 71900
#include<bits/stdc++.h>
#define X first
#define Y second
#define S (1<<10)
#define INF (1e9)
#define N 50
#define M 10
using namespace std;
typedef pair<int,int> P;
typedef pair<P,P> P1;
typedef pair<int,P1> P2;
int d[S][2][N][N],h,w,m,sy,sx,gy,gx;
string s[N],t[M][N];
int dy[4]={-1,0,1,0};
int dx[4]={0,1,0,-1};

int getFloor(int y,int x,int A){
  if(s[y][x]=='|')return 3;
  int cnt=0;
  for(int i=0;i<m;i++){
    if(!(A&(1<<i)))continue;
    if(t[i][y][x]=='*')cnt++;
  }
  if('A'<=s[y][x]&&s[y][x]<='Z')return (cnt%2)?0:1;
  if(s[y][x]=='^')return (cnt%2)?0:1;
  return (cnt%2)?1:0;
}

int bfs(){
  for(int i=0;i<S;i++)
    for(int j=0;j<2;j++)
      for(int k=0;k<N;k++)
	for(int l=0;l<N;l++)
	      d[i][j][k][l]=INF;
  queue<P2> q;
  q.push(P2(0,P1(P(0,0),P(sy,sx))));
  d[0][0][sy][sx]=0;
  while(!q.empty()){
    P2 t=q.front(); q.pop();
    int cost=t.X,Sw=t.Y.X.X;
    int F=t.Y.X.Y,y=t.Y.Y.X,x=t.Y.Y.Y;
    if(d[Sw][F][y][x]<cost)continue;
    if(y==gy&&x==gx)return cost;
    for(int i=0;i<4;i++){
      int ny=y+dy[i],nx=x+dx[i];
      if(s[ny][nx]=='#')continue;
      int nSw=Sw,f=0;
      if('a'<=s[y][x]&&s[y][x]<='z')
	nSw^=(1<<(s[y][x]-'a')),f=1;
      if('A'<=s[y][x]&&s[y][x]<='Z')
	nSw^=(1<<(s[y][x]-'A')),f=1;
      int nF=getFloor(y,x,nSw);
      if(s[y][x]=='|'){
	if(d[Sw][!F][y][x]>cost+1){
	  d[Sw][!F][y][x]=cost+1;
	  q.push(P2(cost+1,P1(P(Sw,!F),P(y,x))));
	}
      }
      if(f&&d[nSw][nF][y][x]>cost+1){
	d[nSw][nF][y][x]=cost+1;
	q.push(P2(cost+1,P1(P(nSw,nF),P(y,x))));
      }
      int r=getFloor(ny,nx,Sw);
      if(r==3)r=F;
      if(F!=r)continue;
      if(d[Sw][F][ny][nx]>cost+1){
	d[Sw][F][ny][nx]=cost+1;
	q.push(P2(cost+1,P1(P(Sw,F),P(ny,nx))));
      }
    }
  }
  return -1;
}

int main(){
  cin>>w>>h;
  for(int i=0;i<h;i++){
    cin>>s[i];
    for(int j=0;j<w;j++){
      if(s[i][j]=='%')sy=i,sx=j;
      if(s[i][j]=='&')gy=i,gx=j;
    }
  }
  cin>>m;
  for(int i=0;i<m;i++)
    for(int j=0;j<h;j++)
      cin>>t[i][j];
  cout<<bfs()<<endl;
  return 0;
}

Measured memory_bytes: 23824
#include <iostream>
#include <cmath>
#include<iomanip>
using namespace std;

int main(){
    int a, b, C;
    double S, L, h, rad;
    double PI = acos(-1);

    cin >> a >> b >> C;
    rad = C * PI / 180.0;
    S = (a * b * sin(rad)) / 2;
    L = a + b + (sqrt(a * a+ b * b-2 * a * b * cos(rad)));
    h = 2 * S / a;
    
    cout << setprecision(10) << S << " " << L << " " << h << endl;

    return 0;
}


Measured memory_bytes: 3564
import Control.Monad
import Control.Monad.Primitive (PrimState)
import qualified Data.Vector.Unboxed as V
import qualified Data.Vector.Unboxed.Mutable as MV
import qualified Data.ByteString.Char8 as B
import Data.Maybe (fromJust)

main :: IO ()
main = do
    [n, m] <- map (fst . fromJust . B.readInt) . B.words <$> B.getLine
    mv <- MV.replicate n 0 :: IO (MV.MVector (PrimState IO) Int)
    replicateM_ m $ do
        [a, b] <- map (fst . fromJust . B.readInt) . B.words <$> B.getLine
        MV.unsafeModify mv (+1) (a - 1)
        MV.unsafeModify mv (+1) (b - 1)
    v <- V.freeze mv
    putStr $ unlines $ map show $ V.toList v


Measured memory_bytes: 508
#include <iostream>
#include <complex>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
#include <random>
#include <iomanip>
typedef long long int ll;
typedef long double ld;
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
const ll MOD=998244353;
const ll MAX_N=500010;
const ll INF=999999999999;

bool comp(pair<ll,ll> p1, pair<ll,ll> p2){
    return p1.first>p2.first;
}

bool check(vector<pair<ll,ll> > vp){
    ll h=0;
    for(pair<ll,ll> p:vp){
        if(h+p.first<0){
            return false;
        }
        h+=p.second;
    }
    return true;
}

int main(){
    int n;
    cin>>n;
    vector<pair<ll, ll> > pos, neg;
    ll total=0;
    for(int i=0;i<n;i++){
        string s;
        cin>>s;
        int h=0; int b=0;
        for(char c:s){
            if(c=='('){
                h++;
            }else{
                h--;
            }
            b=min(b,h);
        }
        if(h>=0){
            pos.push_back(make_pair(b,h));
        }else{
            neg.push_back(make_pair(b-h,-h));
        }
        total+=h;
    }
    sort(pos.begin(),pos.end(),comp);
    sort(neg.begin(),neg.end(),comp);
    //for(pair<ll,ll> p:pos){
    //    cout<<p.first<<" "<<p.second<<endl;
    //}
    if(check(pos) && check(neg) && total==0){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
}

Measured memory_bytes: 34468
d,g=map(int,input().split())
l=[list(map(int,input().split()))for _ in range(d)]
for i in range(d):
    s=l[i][0]*100*-~i
    l[i].append(s+l[i][1])
    l[i].append(s)
a=10**18
for i in range(1<<d):
    s=t=k=0
    for j in range(d):
        if (i>>j)&1:
            s+=l[j][2]
            t+=l[j][0]
        else:
            k=j
    if s+l[k][3]<g:continue
    if s<g:
        t+=-(-(g-s)//(100*-~k))
    a=min(a,t)
print(a)

Measured memory_bytes: 3064
fun main(args: Array<String>) {
    val (L, R) = readLine()!!.split(' ').map { it.toLong() }
    var modMin = 2019L
    for (i in L until Math.min(R, L + 2019)) {
        for (j in L until Math.min(R, L + 2019) + 1) {
            if (i < j) {
                modMin = Math.min(i.times(j) % 2019, modMin)
            }
        }
    }
    println(modMin)
}


Measured memory_bytes: 38300
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
//---------------------------------------------------------------------------------------------------
template<int MOD> struct ModInt {
    static const int Mod = MOD; unsigned x; ModInt() : x(0) { }
    ModInt(signed sig) { x = sig < 0 ? sig % MOD + MOD : sig % MOD; }
    ModInt(signed long long sig) { x = sig < 0 ? sig % MOD + MOD : sig % MOD; }
    int get() const { return (int)x; }
    ModInt &operator+=(ModInt that) { if ((x += that.x) >= MOD) x -= MOD; return *this; }
    ModInt &operator-=(ModInt that) { if ((x += MOD - that.x) >= MOD) x -= MOD; return *this; }
    ModInt &operator*=(ModInt that) { x = (unsigned long long)x * that.x % MOD; return *this; }
    ModInt &operator/=(ModInt that) { return *this *= that.inverse(); }
    ModInt operator+(ModInt that) const { return ModInt(*this) += that; }
    ModInt operator-(ModInt that) const { return ModInt(*this) -= that; }
    ModInt operator*(ModInt that) const { return ModInt(*this) *= that; }
    ModInt operator/(ModInt that) const { return ModInt(*this) /= that; }
    ModInt inverse() const {
        long long a = x, b = MOD, u = 1, v = 0;
        while (b) { long long t = a / b; a -= t * b; std::swap(a, b); u -= t * v; std::swap(u, v); }
        return ModInt(u);
    }
    bool operator==(ModInt that) const { return x == that.x; }
    bool operator!=(ModInt that) const { return x != that.x; }
    ModInt operator-() const { ModInt t; t.x = x == 0 ? 0 : Mod - x; return t; }
};
template<int MOD> ostream& operator<<(ostream& st, const ModInt<MOD> a) { st << a.get(); return st; };
template<int MOD> ModInt<MOD> operator^(ModInt<MOD> a, unsigned long long k) {
    ModInt<MOD> r = 1; while (k) { if (k & 1) r *= a; a *= a; k >>= 1; } return r;
}
typedef ModInt<1000000007> mint;
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧  
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     
　　　　／　　　＼　 　 |　|     
　　　 /　　 /￣￣￣￣/　　|  
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿  
　 　　　＼/＿＿＿＿/　（u　⊃  
---------------------------------------------------------------------------------------------------*/







int N;
string S, T;
mint dp[101010];
mint sm[26];
//---------------------------------------------------------------------------------------------------
void _main() {
    cin >> N >> S >> T;

    dp[0] = 1;
    sm[S[0] - 'a'] = 1;

    rep(i, 1, N) {
        dp[i] = sm[T[i] - 'a'];
        sm[S[i] - 'a'] += dp[i];
    }

    cout << dp[N - 1] << endl;
}


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

using i64 = long long;

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

const int MOD = 1000000007;

i64 pow64(i64 a, i64 b) {
    a %= MOD;
    i64 result = 1;
    while(b) {
        if(b & 1) result = result * a % MOD;
        a = a * a % MOD;
        b >>= 1;
    }
    return result;
}
i64 inv64(i64 x) { return pow64(x, MOD - 2); }

const int MAXN = 101000;

int n;
i64 m;
int arr[MAXN];
i64 sum[MAXN];

i64 calc1(int x) {
    i64 result = 0;
    for(int i = 0; i < n; ++i) {
        int y = x - arr[i];
        int z = std::lower_bound(arr, arr + n, y) - arr;
        result += n - z;
    }
    return result;
}
i64 calc2(int x) {
    i64 result = 0;
    for(int i = 0; i < n; ++i) {
        int y = x - arr[i];
        int z = std::lower_bound(arr, arr + n, y) - arr;
        result += sum[n] - sum[z] + i64(arr[i]) * (n - z);
    }
    return result;
}

int main() {
    std::scanf("%d%lld", &n, &m);
    for(int i = 0; i < n; ++i)
        std::scanf("%d", &arr[i]);
    std::sort(arr, arr + n);
    sum[0] = 0;
    for(int i = 0; i < n; ++i)
        sum[i + 1] = sum[i] + arr[i];
    int l = arr[0] * 2, r = arr[n - 1] * 2 + 1;
    while(l < r) {
        int mid = (l + r) / 2;
        i64 value = calc1(mid);
        if(value >= m) l = mid + 1;
        else r = mid;
    }
    --l;
    i64 v = calc1(l);
    i64 result = calc2(l) - (v - m) * l;
    std::printf("%lld\n", result);
}

Measured memory_bytes: 1408
#include <algorithm>
#include <climits>
#include <cstring>
#include <cctype>
#include <inttypes.h>
#include <iostream>
#include <iterator>
#include <map>
#include <numeric>
#include <queue>
#include <tuple>
#include <utility>
#include <vector>

using namespace std;

int N;
int A[16][16];
int64_t dp[1 << 16];

int main() {
    scanf("%d", &N);
    for (int i = 0; i < N; ++i)
        for (int j = 0; j < N; ++j)
            scanf(" %d", &A[i][j]);
    int cap = 1 << N;
    fill(dp, dp + cap, 0);
    for (int i = 0; i < N; ++i)
        for (int j = 0; j < i; ++j) 
            for (int k = 3; k < cap; ++k)
                if (((1 << i) & k) && ((1 << j) & k))
                    dp[k] += A[i][j];

    for (int i = 1; i < cap; ++i) {
        for (int j = i; j; j = (j - 1) & i)
            dp[i] = max(dp[i], dp[j] + dp[i ^ j]);
    }

    printf("%" PRId64 "\n", dp[cap - 1]);
}





Measured memory_bytes: 768
a, b, c, x, y = map(int, input().split())
l = []
l.append(a*x + b*y)
l.append(2*c * max(x, y))

if x < y:
    l.append(2*c*x + b*(y-x))
elif x > y:
    l.append(2*c*y + a*(x-y))

print(min(l))

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

int main() {
  string S;
  int ans = 700;
  cin >> S;

  for (int k = 0; k < 3; k++) {
    if (S[k] == 'o') ans += 100;
  }

  printf("%d", ans);
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define     ll                      long long
#define     boost                   ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define     all(v)                  v.begin(),v.end()
#define     revall(v)               v.rbegin(),v.rend()
#define     pb                      push_back
#define     eb                      emplace_back
#define     sl(x)                   scanf("%lld", &x)
#define     sll(x, y)               scanf("%lld %lld", &x, &y)
#define     slll(x, y, z)           scanf("%lld %lld %lld", &x, &y, &z)
#define     read                    freopen("input.txt","r",stdin)
#define     write                   freopen("output.txt","w",stdout)
#define     println()               cout << endl
#define     gcd(a,b)                __gcd(a,b)
#define     lcm(a,b)                (a)*(b)/gcd(a,b)
#define     printl(x)               printf("%lld\n")
#define     printll(x,y)            printf("%lld %lld\n")
#define     printlll(x,y,z)         printf("%lld %lld %lld\n")
#define     vll                     vector<ll>
using namespace std;
int main(){

ll a,b,i,c,d,n,e,g,r,j,k,l,f=1,h=0,m=4,m1,sx,obf=0,t,ttt=0,ans=0;
           vll v;
            obf=0;
            cin>>a;
            for(i=0;i<a;i++)
            {
                cin>>b;
                v.eb(b);
            }
            c=a;
            for(ll i=0;i<c-2;i++)
            {
                for(ll j=i+1;j<c-1;j++)

            {
                if(v[i]==v[j]) continue;
                for(ll p=j+1;p<c;p++)
            {
                if(v[p]==v[j] || v[i]==v[p]) continue;
                if(v[i]+ v[j] > v[p] && v[p] + v[j] > v[i] && v[i] + v[p] > v[j])
                    {obf++;}
            }

            }
            }

            cout<<obf<<endl;
}


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

using namespace std;

int lr[2010][2010];
int rl[2010][2010];
int ud[2010][2010];
int du[2010][2010];


int main(){
	ios::sync_with_stdio(0);

	int n,m;
	cin>>n>>m;
	char g[2010][2010];
	for(int i=1;i<=n;++i)
		for(int j=1;j<=m;++j)
			cin>>g[i][j];
	int cnt=0;
	for(int i=1;i<=n;++i){
		cnt=0;
		for(int j=1;j<=m;++j)
			if(g[i][j]!='#') lr[i][j]=++cnt;
			else cnt=0;
	}
	for(int i=1;i<=n;++i){
		cnt=0;
		for(int j=m;j>=1;--j)
			if(g[i][j]!='#') rl[i][j]=++cnt;
			else cnt=0;
	}
	for(int i=1;i<=m;++i){
		cnt=0;
		for(int j=1;j<=n;++j)
			if(g[j][i]!='#') ud[j][i]=++cnt;
			else cnt=0;
	}
	for(int i=1;i<=m;++i){
		cnt=0;
		for(int j=n;j>=1;--j)
			if(g[j][i]!='#') du[j][i]=++cnt;
			else cnt=0;
	}
	int ans=0;
	for(int i=1;i<=n;++i)
		for(int j=1;j<=m;++j){
		//	cout<<i<<" "<<j<<" "<<rl[i][j]<<" "<<lr[i][j]<<" "<<+ud[i][j]<<" "<<du[i][j]<<endl;
			ans=max(ans,rl[i][j]+lr[i][j]+ud[i][j]+du[i][j]-3);
		}
	cout<<ans<<endl;
	return 0;
}


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

double px[3],py[3],pz[3];

int hantei(double x,double y,double z) {
	int i,j;
	double vx[3],vy[3],vz[3];
	for (i=0;i<3;i++) {
		j=(i+1) % 3;
		vx[i]=(py[j]-py[i])*(pz[j]-z)-(pz[j]-pz[i])*(py[j]-y);
		vy[i]=(pz[j]-pz[i])*(px[j]-x)-(px[j]-px[i])*(pz[j]-z);
		vz[i]=(px[j]-px[i])*(py[j]-y)-(py[j]-py[i])*(px[j]-x);
	}
	for (i=0;i<3;i++) {
		j=(i+1) % 3;
		if (vx[i]*vx[j]+vy[i]*vy[j]+vz[i]*vz[j]<0) break;
	}
	if (i==3) return 1; else return 0;
}

int main() {
	int i;
	double ax,ay,az,bx,by,bz,vx,vy,vz,a,b,c,d,s,wx[3],wy[3],wz[3];
	cin >> ax >> ay >> az;
	cin >> bx >> by >> bz;
	vx=bx-ax; vy=by-ay; vz=bz-az;
	for (i=0;i<3;i++) { cin >> px[i] >> py[i] >> pz[i];
	if (i!=0) { wx[i-1]=px[i]-px[0]; wy[i-1]=py[i]-py[0]; wz[i-1]=pz[i]-pz[0];}
    }
	a=wy[0]*wz[1]-wz[0]*wy[1]; b=wz[0]*wx[1]-wx[0]*wz[1];c=wx[0]*wy[1]-wy[0]*wx[1];
	d=-(a*px[0]+b*py[0]+c*pz[0]);
	if (vx*a+vy*b+vz*c==0) {
		if (hantei(bx,by,bz)==1) cout << "MISS"; else cout << "HIT" << endl;
		 return 0;} 
	s=-(d+a*ax+b*ay+c*az)/(a*vx+b*vy+c*vz);
	if (hantei(ax+s*vx,ay+s*vy,az+s*vz)==0 || s<0 || s>1) cout << "HIT"; else cout << "MISS";
	cout << endl;    
	return 0;
}

Measured memory_bytes: 1220
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;
using LLONG = long long;
const LLONG MOD = 1000000007;
const double PI = 3.14159265359;

int main()
{
    int N; cin >> N;
    vector<LLONG> as(N); for (auto &ai : as) cin >> ai;
    LLONG all = 0;
    for (const LLONG ai : as) all ^= ai;
    for (int i = 0; i < N - 1; ++i)
    {
        cout << (as[i] ^ all) << ' ';
    }
    cout << (as.back() ^ all) << endl;
}


Measured memory_bytes: 4840
def main():
    n = int(input())
    a = [int(i) for i in input().split()]

    cnt = 0
    for i in range(n):
        if a[i] < 0:
            a[i] = -a[i]
            cnt+= 1
    if cnt %2 == 0:
        print(sum(a))
    else:
        a.sort()
        print(sum(a)- 2*a[0])


main()

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

#define ll long long

#define ff first
#define ss second
bool comp(ll a,ll b){
    return a > b;
}

bool check(vector<ll> &a,ll k){
    ll n = a.size();
    
    for(ll i=0;i<n-1;i+=2){
        ll x = max(a[i],a[i+1]);
        k-=x;
        if(k<0) return false;
    }
    
    if(n&1){
        k-= a[n-1];
    }
    if(k<0) return false;
    return true;
    
}

void solve()
{
   ll a,b;cin>>a>>b;
   ll x=-1;
   ll y=-1;
   ll i=1;
   while(x<=a and y<=b){
        
        x = floor(i*0.08);
        y = floor(i*0.1);
        
        // cout<<x<<" "<<y<<endl;
        
        if(x==a and y==b){
            cout<<i;
            return;
        }
       
        i++;
   }
   cout<<-1;
   
}

int main(){
    
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    // ll t;cin>>t;while(t--)
        solve();
    
}

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

int main() {
  int n;  cin >> n;
  
  set<int> st;
  for (int i = 0; i < n; i++) {
    int x;  cin >> x;
    st.insert(x);
  }
  
  cout << st.size() << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		String s = String.valueOf(n);
		char[] ch = s.toCharArray();
		if (ch[0] == '9' || ch[1] == '9') {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
#define rep(i,ini,n) for(int i=ini;i<n;i++)
#define _rep(i,ini,n) for(int i=ini;i>=n;i--)
#define ToEnd(a) a.begin(),a.end()
uint64_t MOD=1000000007;

int main(){
    char a; cin>>a;
    if(a>='a' && a<='z') a='a';
    else a='A';
    cout<<a<<endl;
}

Measured memory_bytes: 3616
/**
*    created: 30.06.2020 16:31:50
**/
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define pcnt(bit) __builtin_popcountll(bit)
using namespace std;
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;}
const int mod = 1000000007;
const long double pi = acos(-1.0);
const int inf = 1LL << 60;

signed main() {

    cin.tie(0);
    ios_base::sync_with_stdio(false);

    string s;
    cin >> s;
    int k;
    cin >> k;
    set<string> st;
    rep(i,s.size()) rep(j,i+1) {
        if (i-j+1 > 5) continue;
        st.insert(s.substr(j,i-j+1));
    }
    auto itr = st.begin();
    advance(itr,k-1);
    cout << *itr << endl;
    return 0;
}


Measured memory_bytes: 4688
N, X, Y= map(int, input().split()) 
Count = [0]*(N-1)
  

for i in range(1, N):
  for j in range(i+1, N+1):
    Count[min(j-i, (abs(i-X) +abs(j-Y) +1),  (abs(i-Y) +abs(j-X) +1))-1] += 1

for i in range(N-1):
  print(Count[i])

Measured memory_bytes: 47580
#include <bits/stdc++.h>
using namespace std;
typedef long long   signed int LL;
typedef long long unsigned int LU;
#define incID(i, l, r) for(LL i = (l)    ; i <  (r); ++i)
#define incII(i, l, r) for(LL i = (l)    ; i <= (r); ++i)
#define decID(i, l, r) for(LL i = (r) - 1; i >= (l); --i)
#define decII(i, l, r) for(LL i = (r)    ; i >= (l); --i)
#define inc(i, n)  incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define dec(i, n)  decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))
#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
template<typename T> bool setmin  (T & a, T b) { if(b <  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmax  (T & a, T b) { if(b >  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } }
template<typename T> bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } }
LL mo(LL a, LL b) { assert(b > 0); a %= b; if(a < 0) { a += b; } return a; }
LL fl(LL a, LL b) { assert(b > 0); return (a > 0 ? a / b : (a - b + 1) / b); }
LL ce(LL a, LL b) { assert(b > 0); return (a < 0 ? a / b : (a + b - 1) / b); }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
#define bit(b, i) (((b) >> (i)) & 1)
#define BC __builtin_popcountll
#define SC static_cast
#define SI(v) SC<int>(v.size())
#define SL(v) SC<LL >(v.size())
#define RF(e, v) for(auto & e: v)
#define ef else if
#define UR assert(false)

// ---- ----

int n;
vector<int> v, w;

int main() {
	cin >> n;
	inc(i, n) { int a; cin >> a; v.PB(a); }
	
	if(is_sorted(ALL(v))) { cout << "YES" << endl; return 0; }
	inc(i, n) {
	inc(j, i) {
		w = v;
		swap(w[i], w[j]);
		if(is_sorted(ALL(w))) { cout << "YES" << endl; return 0; }
	}
	}
	
	cout << "NO" << endl;
	
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
/*#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
/*template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
*/typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll,ll> pl;
typedef pair<int,int> pii;

#define int ll
#define LOCAL 0
#define dbg(x) cout << #x << " is " << x << "\n"
#define gll(x) scanf("%d",&x)
#define gll2(x,y) scanf("%d%d",&x,&y)
#define gll3(x,y,z) scanf("%d%d%d",&x,&y,&z)
#define gllarr(arr,n) f(i,n) gll(arr[i]);
#define sz(x) ((int)x.size())
#define s(x) sort(x.begin(),x.end())
#define all(v) v.begin(),v.end()
#define rs(v) { s(v) ; r(v) ; }
#define r(v) {reverse(all(v));}
#define pb push_back
#define f(i,n) for(int i=0;i<n;i++)
#define fr(i,n) for(int i=n-1;i>=0;i--)
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define repr(i,a,b) for(int i=a;i>=b;i--)

const ll mod = (ll)1e9 + 7;
const ll inf = (ll)1e16;
const ld eps = 1e-12;
const ll N = (int)1e5 + 5;
const ll LOGN = 19;
const ld PI = 3.14159265358979323846;
inline ll mul(ll a, ll b, ll m = mod) { return (ll)(a * b) % m;}
inline ll add(ll a, ll b, ll m = mod) { a += b; if(a >= m) a -= m; if(a < 0) a += m; return a;}
inline ll power(ll a, ll b, ll m = mod) { if(b == 0) return 1; if(b == 1) return (a % m); ll x = power(a, b / 2, m); x = mul(x, x, m); if(b % 2) x = mul(x, a, m); return x;}

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    if (LOCAL) {
        freopen("C:\\Users\\Dishant\\Desktop\\Collection-DEV c++\\input.txt", "r", stdin);
        freopen("C:\\Users\\Dishant\\Desktop\\Collection-DEV c++\\output.txt", "w", stdout);
    }
    int n, k;
    cin>>n>>k;
    int a[n];
    f(i, n) cin>>a[i];
    sort(a, a + n);
    reverse(a, a + n);
    int ans = 0;
    f(i, n) {
        if(k) k--;
        else {
            ans += a[i];
        }
    }
    cout<<ans;
    return 0;
}


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

int main() {
	ios_base::sync_with_stdio(false); cin.tie(0);
	set<int> S;
	int N, A, B; cin >> N >> A >> B;
	for (int i = 0; i < N; ++i) {
		int a; cin >> a;
		if (A <= a and a < B);
		else S.insert(a);
	}
	cout << S.size() << '\n';

  
}


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

#define fi first
#define se second
#define pb push_back
#define int long long
#define all(x) (x).begin(), (x).end()

using LL = long long;
using LD = long double;
using pii = pair<int, int>;
using vii = vector<pii>;

const int INF = 1e18;
const int MOD = 1e9 + 7;
const int N = 1e5 + 5;

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

    double l;
    cin >> l;
    double a = l / 3;
    cout << fixed << setprecision(15);
    cout << a*a*a << "\n";    
}

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

int main() {
	/*
cout<<"Hello World"<<endl;

	int x;
	cin>> x;
	cout<< x*x*x <<endl;

int a;
int b;
cin>>a>>b;
cout<<a*b<<" "<<2*a+2*b<<endl;

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

	}
	int a;
	int b;
	int c;
	cin>>a>>b>>c;
	if (a<b&&b<c){
		cout<<"Yes"<<endl;
	}else {
		cout<<"No"<<endl;
	}
*/
	int a;
	int b;
	int c;
	int d;
	cin>>a>>b>>c;
	if(a>b){
	d=b;
	b=a;
	a=d;
	}
	if(b>c){
	d=c;
	c=b;
	b=d;
	}
	if(a>b){
	d=b;
	b=a;
	a=d;
	}
	cout<<a<<" "<<b<<" "<<c<<endl;











	return 0;
}

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

int main()
{
  int a, b;
  cin >> a >> b;
  
  if(a%3==0 || b%3==0 || (a+b)%3==0) {
    cout << "Possible" << endl;
  } else {
    cout << "Impossible" << endl;
  }

  return 0;
}

Measured memory_bytes: 256
#coding:utf-8
n, x = map(int, input().split())
a = list(map(int, input().split()))
child = sorted(a)

for i in range(n):
    x -= child[i]
    if x < 0:
        break
    elif x == 0:
        print(i+1)
        exit()

print(i)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, s, e) for (int i = (int)(s); i <= (int)(e); i++)
#define printYesNo(is_ok) puts(is_ok ? "Yes" : "No");
#define printVector(v) rep(i, v.size()) cout << v[i] << endl;

int main()
{
  string s;
  int K;
  cin >> s >> K;
  map<string, int> count;
  rep(num, 5)
  {
    rep(i, s.size() - num)
    {
      count[s.substr(i, num + 1)];
    }
  }

  int cnt = 1;
  for (pair<string, int> P : count)
  {
    if (cnt++ == K)
    {
      cout << P.first << endl;
      return 0;
    }
  }
  return 0;
}

Measured memory_bytes: 1920
#include <bits/stdc++.h>
#define pb push_back
#define ll long long
#define md 1000000007
#define ld long double
using namespace std;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    long long n, i = 0, j= 0, k = 0, l = 0, m = 0, a = 0, b = 0, sum = 0, x = 0, y = 0, z = 0, c, p, d, t;
    cin >> n;
    vector <pair<ll,ll>> v;
    t = n;
    while(t--){
       cin >> x >> l;
       a = x - l;
       b = x + l;
       v.pb(make_pair(b,a));
    }
    sort(v.begin(),v.end());
    sum++;
    k = v[0].first;
    for(i = 1; i < n; i++){
        if(v[i].second >= k){
            sum++;
            k = v[i].first;
        }
    }
    cout << sum;

    return 0;
}


Measured memory_bytes: 2420
import java.util.*;
import java.io.*;

public class Main
{
	public static void main(String [] Args)
	{
		Scanner in=new Scanner(System.in);
		int n=in.nextInt();
		String s=in.next();
		String t=in.next();
		for(int i=0;i<n;i++)
		{
			System.out.print(s.charAt(i)+""+t.charAt(i));
		}
	}
}
	

Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
int main()
{
  string s;
  int m,n,l,i,r=0;
  cin>>s;
  l=s.size();
  if(l%2==0)
  {

    m=(l/2)-1;
    n=l-1;
    for(i=0;i<=m;i++)
    {
      if(s[i]!=s[n]) r++;
      n--;
    }
   }
else
{
  m=(l/2)-1;
  n=l-1;
  for(i=0;i<=m;i++)
  {
    if(s[i]!=s[n]) r++;
    n--;
  }
}
cout<<r<<endl;

}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <climits>
#include <map>
#include <set>
const int mod = 1e9 + 7;
const int inf = 1 << 20;
const long long INF = 1LL << 60;
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
using namespace std;


int main()
{
    int a,b,c,d;
    cin >> a >> b >> c >> d;
    if(d == 1){
        cout << 1 << endl;
    }else{
        cout << 0 << endl;
    }
}


Measured memory_bytes: 256
### subroutines

def gcd(m, n)
  while n > 0
    m, n = n, m % n
  end
  m
end

### main

while line = gets
  a, b = line.strip.split(' ').map(&:to_i)
  puts (a >= b ? gcd(a, b) : gcd(b, a))
end

Measured memory_bytes: 6096
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<string>
#include<cstring>
#include<algorithm>
using namespace std;
#define ll long long
ll n,m,LCM;
char s[120000],t[120000];
char c;
ll gcd(ll a, ll b)
{
    return (!b)?a:gcd(b,a%b);
}
int main()
{
    bool flag=1;
    ll loc=0,step1=0,step2=0;
    int j=0;
    cin>>n>>m;
    for (int i=0; i<n; ++i)
        cin>>s[i];
    for (int i=0; i<m; ++i)
        cin>>t[i];
    LCM = (n*m)/gcd(n,m);
    step1=(LCM/n);
    step2=(LCM/m);
    for (int i=0; i<n; ++i)
    {
        loc = i*step1;
        if ((loc%step2)==0)
        {
            j = loc/step2;
            if (t[j]!=s[i])
                flag=0;
        }
    }
    if (!flag) cout<<-1<<endl;
    else cout<<LCM<<endl;

    return 0;
}


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

using namespace std;

const int inf = 0x3f3f3f3f;

int vetor[100010], pd[100010];
int n;

int solve(int x){
  if(pd[x] != inf) return pd[x];
  if(x >= n) return inf;
  if(x == n-1) return 0;

  pd[x] = min(solve(x+1) + abs(vetor[x]-vetor[x+1]), solve(x+2) + abs(vetor[x]-vetor[x+2]));

  return pd[x];
}

int main(){
  cin>>n;

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

  memset(pd, inf, sizeof pd);

  cout<<solve(0)<<endl;
}

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

using namespace std;

int main() {
  set<int> s;
  for (int i = 0; i < 2; ++i) {
    int tmp; cin >> tmp;
    s.insert(tmp);
  }
  for (int i = 1; i <= 3; ++i) {
    if (s.count(i) == 0) {
      cout << i << '\n';
      return 0;
    }
   
  }
}

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

#define rep(i,l,r) for(register int i = l ; i <= r ; i++)
#define repd(i,r,l) for(register int i = r ; i >= l ; i--)
#define rvc(i,S) for(register int i = 0 ; i < (int)S.size() ; i++)
#define rvcd(i,S) for(register int i = ((int)S.size()) - 1 ; i >= 0 ; i--)
#define fore(i,x)for (register int i = head[x] ; i ; i = e[i].next)
#define forup(i,l,r) for (register int i = l ; i <= r ; i += lowbit(i))
#define fordown(i,id) for (register int i = id ; i ; i -= lowbit(i))
#define pb push_back
#define prev prev_
#define stack stack_
#define mp make_pair
#define fi first
#define se second
#define lowbit(x) ((x)&(-(x)))

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int,int> pr;

const ld inf = 2e18;
const int N = 3e6 + 10;
const int maxn = 200020;
const ll mod = 998244353;

ll f[maxn][3][2][3],ans;
char ch[maxn];
int n,t;

inline ll power(ll x,ll y){
	y = ((y % (mod - 1)) + (mod - 1)) % (mod - 1);
//	if ( y < 0 ) return power(power(x,-y),mod - 2);
	ll res = 1;
	while ( y ){
		if ( y & 1 ) res = res * x % mod;
		x = x * x % mod;
		y >>= 1;
	}
	return res;
}
bool allsame(){
	rep(i,1,n - 1) if ( ch[i] != ch[i + 1] ) return 0;
	return 1;
}
bool alldiff(){
	rep(i,1,n - 1) if ( ch[i] == ch[i + 1] ) return 0;
	return 1;
}
inline void up(ll &x,ll y){ x = (x + y) % mod; }
int main(){
	scanf("%s",ch + 1);
	n = strlen(ch + 1);
	if ( allsame() ) return puts("1"),0;
	if ( n == 2 ){
		puts("2");
		return 0;
	}
	if ( n == 3 ){
		if ( alldiff() ){
		   	if ( ch[1] != ch[3] ) puts("3");
			else puts("7");
		}
		else puts("6");
		return 0;
	}
	rep(i,1,n) t += ch[i] - 'a';
	//f[0][0][0] = 1;
	rep(k,0,2) f[1][k][0][k] = 1;
	rep(i,2,n){
		rep(t,0,2){
			rep(x,0,2){
				rep(y,0,2){	
					if ( x != y ) up(f[i][(t + x) % 3][0][x],f[i - 1][t][0][y]);
					else up(f[i][(t + x) % 3][1][y],f[i - 1][t][0][y]);
					up(f[i][(t + x) % 3][1][x],f[i - 1][t][1][y]);
		//			if ( i > 1 ) up(f[i][(t + 2 * x) % 3][1],f[i - 2][t][0]);
				}
			}
		}
	}
	t %= 3;
	rep(k,0,2){
		up(ans,f[n][t][1][k]);
	}
	//ans = power(3,n - 1) - power(2,n - 1) + mod;
	if ( alldiff() ) ans++;
	cout<<ans % mod<<endl;
}


Measured memory_bytes: 28544