akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define int long long
const int MOD = 1e9 + 7;
using pii=std::pair<int,int>;
using namespace std;

const int maxdig = 1e4 + 5, maxd = 105;

int d, dp[maxdig][2][maxd];
string k;
vector<int> digits;

int solve(int pos, int anygood, int modsum)
{
    if(pos == digits.size())
        return (modsum == 0);
    assert(pos < digits.size());
    if(dp[pos][anygood][modsum] == -1)
    {
        dp[pos][anygood][modsum] = 0;
        for(int i = 0; i < 10; i++)
            if((i <= digits[pos] || anygood))
                dp[pos][anygood][modsum] += solve(pos + 1, anygood | (i < digits[pos]), (modsum + i) % d);
        dp[pos][anygood][modsum] %= MOD;
    }
    return dp[pos][anygood][modsum];
}

int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin >> k >> d;
    for(int i = 0; i < k.length(); i++)
        digits.push_back(k[i] - '0');
    for(int i = 0; i < digits.size(); i++)
        for(int j = 0; j < 2; j++)
            for(int k = 0; k < d; k++)
                dp[i][j][k] = -1;
    cout << (solve(0, 0, 0) - 1 + MOD) % MOD << "\n";
    return 0;
}

Measured memory_bytes: 21136
#include<cstdio>
#include<cstring>
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;
typedef long long LL;
const int N=100005;
const LL Mod=1e9+7;
int ABS(int x)
{
    return x>0?x:-x;
}
int main()
{
    int a,b,c;
    while(scanf("%d%d%d",&a,&b,&c)!=EOF)
    {
        int mi = 10000;
        mi=min(ABS(a-b)+ABS(b-c),mi);
        mi=min(ABS(a-c)+ABS(c-b),mi);
        mi=min(ABS(b-a)+ABS(a-c),mi);
        mi=min(ABS(b-c)+ABS(c-a),mi);
        mi=min(ABS(c-a)+ABS(a-b),mi);
        mi=min(ABS(c-b)+ABS(b-a),mi);
        printf("%d\n",mi);
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
int main(void){
    long n;
    cin >> n;
    vector<long> a(n);
    long Sum = 0;
    for(int i = 0;i < n;i++){
          cin >> a[i];
          Sum += a[i];
    }
    
    long ans = Sum;
    long t = 0;
    for(int i = 0;i < n;i++){
          t += a[i];
          ans = min(ans,abs(Sum - 2 * t));
    }
    cout << ans << endl;
    
}


Measured memory_bytes: 4820
#include<iostream>
#include<cmath>
#include<algorithm>
#include<string>
using namespace std;
typedef long long ll;
ll deg(ll n){
    ll count = 0;
    while(n!= 0){
        n/=10;
        count++;
    }
    return count;
}
int main(){
    int a,b;
    cin >> a >> b;
    int ans = 0;
    int sum = 1;
    while(sum < b){
        ans++;
        sum += a-1;
    }
    cout << ans << endl;
}

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

using namespace std;

long long hmtd(long long a, long long b){
    int ans=0;
    while(true) {
        if(a%b==0){a=a/b;++ans;}
        else break;
    }
    return ans;
}

int main() {
    int n,m;
    cin>>n>>m;
    const int ki[8]={1,-1, 1, 1,-1,-1, 1,-1};
    const int oi[8]={1, 1,-1, 1,-1, 1,-1,-1};
    const int ni[8]={1, 1, 1,-1, 1,-1,-1,-1};
    vector<vector<long long> > c(n,vector<long long>(3));
    for (int i = 0; i < n; ++i) {
        long long x,y,z;
        cin>>x>>y>>z;
        vector<long long> a={x,y,z};
        c[i]=a;
    }
    vector<long long> a(n);
    long long ans=0;
    for (int i = 0; i < 8; ++i) {
        for (int j = 0; j < n; ++j) {
            a[j]=c[j][0]*ki[i]+c[j][1]*oi[i]+c[j][2]*ni[i];
        }
        sort(a.begin(),a.end(),greater<long long>());
        long long t=0;
        for (int k = 0; k < m; ++k) {
            t+=a[k];
        }
        ans=max(ans,t);
    }
    cout<<ans<<endl;
    return 0;
}

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

#define NIL NULL

struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};

typedef struct node * Node;

Node root;

Node treeMinimum(Node x){
  while(x->left != NIL){
    x = x->left;
  }
  return x;
}

Node treeSearch(Node u, int k){
  while(u != NIL && k != u->key){
    if(k < u->key) u = u->left;
    else u = u->right;
  }
  return u;
}

Node treeSuccessor(Node x){
  Node y;

  if(x->right != NIL) return treeMinimum(x->right);
  
  y = x->parent;
  
  while(y != NIL && x == y->right){
    x = y;
    y = y->parent;
  }
  return y;
}

void treeDelete(Node z){
  Node y; // node to be deleted
  Node x; // child of y
  
  if(z->left == NIL || z->right == NIL) y = z;
  else y = treeSuccessor(z);
  
  if(y->left != NIL) x = y->left;
  else x = y->right;
  
  if(x != NIL) x->parent = y->parent;
  
  if(y->parent == NIL) root = x;
  else if(y == y->parent->left) y->parent->left = x;
  else y->parent->right = x;
  
  if(y != z){
    z->key = y->key;
    
  }  
}

void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;
  
  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;

  while(x != NIL){
    y = x;

    if(z->key < x->key) x = x->left;
    else x = x->right;
  }
  z->parent = y;
  
  if(y == NIL) root = z;
  else if(z->key < y->key) y->left = z;
  else y->right = z;  
}

void inorder(Node u){
  if(u != NIL){
    inorder(u->left);
    printf(" %d", u->key);
    inorder(u->right);
  }
}

void preorder(Node u){
  if(u != NIL){
    printf(" %d", u->key);
    preorder(u->left);
    preorder(u->right);
  }
}


int main(){
  int n, i, x;
  char com[20];

  scanf("%d", &n);

  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
    if ( com[0] == 'f' ){
      scanf("%d", &x);
      
      Node t = treeSearch(root, x);
      
      if ( t != NIL ) printf("yes\n");
      else printf("no\n");
    } 
    else if ( com[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
    } 
    else if ( com[0] == 'p' ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
    else if ( com[0] == 'd' ){
      scanf("%d", &x);
      treeDelete(treeSearch(root, x));
    }
  }
  
  return 0;
}

Measured memory_bytes: 19364
#include<iostream>
#include<algorithm>
#define ll long long 
using namespace std;

int main()
{
	ll r; ll d; ll x;
	cin >> r >> d >> x;
	ll ans = r * x - d;
	cout << ans << endl;
	for (int i = 2; i <= 10; i++)
	{
		ans = ans * r - d;
		cout << ans << endl;
	}
	return 0;
}

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

int main(){
	int N,R=1<<29;
	scanf("%d",&N);
	vector<int>v(N);
	for(int i=0;i<N;i++)scanf("%d",&v[i]);
	for(int p=0;p<=v[0];p++){
		int cur=v[0]-p,r=p;
		for(int i=0;i<N-1;i++){
			r+=cur*2;
			cur=max(v[i+1]-cur,0);
		}
		R=min(R,r+cur);
	}
	printf("%d\n",R);
}

Measured memory_bytes: 2760
package main

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

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 500001), 500000)
	return scanner
}

func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}

func main() {
	fp := os.Stdin
	if len(os.Args) > 1 {
		fp, _ = os.Open(os.Args[1])
	}

	scanner := getScanner(fp)
	writer := bufio.NewWriter(os.Stdout)

	s := getNextString(scanner)
	n := len(s)
	var dp [100001][13]int

	dp[0][0] = 1

	mod := int(1e9 + 7)
	mm := [6]int{
		1, 10, 9, 12, 3, 4,
	}

	di := n - 1

	var md [6][10]int
	for i := 0; i < 6; i++ {
		for ii := 0; ii < 10; ii++ {
			md[i][ii] = (mm[i] * ii) % 13
		}
	}

	for i := 0; i < n; i++ {
		for iii := 0; iii < 13; iii++ {
			if s[i] == '?' {
				for iiii := 0; iiii <= 9; iiii++ {
					m := (md[di%6][iiii] + iii) % 13
					dp[i+1][m] = (dp[i+1][m] + dp[i][iii]) % mod
				}

				continue
			}
			m := (md[di%6][int(s[i]-'0')] + iii) % 13
			dp[i+1][m] = (dp[i+1][m] + dp[i][iii]) % mod
		}
		di--
	}
	fmt.Fprintln(writer, dp[n][5])
	writer.Flush()
}


Measured memory_bytes: 11648
#include <bits/stdc++.h>
#define rep(i,n) for (ll i = 0; i < n; ++i)
#define sz(x) int(x.size())
#define ALL(c) (c).begin(), (c).end()
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v, x) (std::find(v.begin(), v.end(), x) != v.end())
#define FORV(i, v) for (auto i = v.begin(); i != v.end(); i++)
using namespace std;

using ll = int64_t;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
const int INF = 1'001'001'001;
const ll INFL = (1LL<<60);
const double eps = (1e-9);

const ll mod = 1e9 + 7;

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

  int N, D, X; cin >> N >> D >> X;

  int ans = X;
  rep(i, N) {
    int a; cin >> a;
    ans += 1;
    ans += (D - 1) / a;
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <vector>
using namespace std;

int main(int argc, const char * argv[]) {
    int a,b;

    while(1){
        cin >> a;
        cin >> b;
        if(a == 0 && b == 0) break;
        for(int i = 0; i < a; i++){
            for(int j = 0; j < b; j++){
                cout << "#";
            }
            cout << endl;
        }
        cout << endl;
    }
    
    return 0;
}


Measured memory_bytes: 3060
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long int ll;
int main(){
	int Q;
	bool isPrime[100001], isPrime2[100001];
	int num[100001];
	fill(isPrime, isPrime + 100001, true);
	fill(isPrime2, isPrime2 + 100001, false);
	fill(num, num + 100001, 0);
	isPrime[1] = false; isPrime[2] = true;
	for(int i = 2; i * i <= 100000; i++){
		if(isPrime[i] == true){
			for(int j = 2; j * i <= 100000; j++){
				isPrime[j * i] = false;
			}
		}
	}
	for(int i = 3; i <= 100000; i += 2){
		if(isPrime[(i + 1) / 2]) isPrime2[i] = true;
	}
	for(int i = 1; i <= 100000; i++){
		num[i] = num[i - 1];
		if(isPrime[i] && isPrime2[i]) num[i]++;
	}
	cin >> Q;
	for(int i = 1; i <= Q; i++){
		int l, r;
		cin >> l >> r;
		cout << num[r] - num[l - 1] << endl;
	}
	return 0;
}


Measured memory_bytes: 1280
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <climits>
#include <random>
#include <iomanip>

using namespace std;
using P = pair<long, long>;

typedef long long int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

#define fillInt(xs, x)        \
  for (int i = 0; i < (x); i++) \
    scanf("%d", &xs[i]);
#define fillLong(xs, x)       \
  for (int i = 0; i < (x); i++) \
    scanf("%ld", &xs[i]);
#define fillString(xs, x)       \
  for (int i = 0; i < (x); i++) \
    cin >> xs[i];
#define sortv(xs) sort(xs.begin(), xs.end())
#define sortvinv(xs) sort(xs.begin(), xs.end(), std::greater<long>())
#define lbv(xs, x) lower_bound(xs.begin(), xs.end(), x) - xs.begin()
#define ubv(xs, x) upper_bound(xs.begin(), xs.end(), x) - xs.begin()
#define bs(xs, x) binary_search(xs.begin(), xs.end(), x)

#define rep(i,n) for(auto i=0; i<(n); i++)

const int mod = 1000000007;

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

  int a,b,c,d,e,f;
  cin>>a>>b>>c>>d>>e>>f;

  double res = 0;
  int sm = 0;
  int sugar = 0;

  for(int i = 0; i * 100 * a <= f; i++) {
    for(int j = 0; i * 100 * a + j * 100 * b <= f; j++) {
      int water = (i * 100 * a + j * 100 * b);
      int rem = f - water;
      for(int x = 0; x * c <= rem; x++) {
        if ((x * c * 100) > e * water) break;
        for(int y = 0; x * c + y * d <= rem; y++) {
          if (((x * c + y * d) * 100) > e * water) break;
          if ((double)(x * c + y * d) / (water + x * c + y * d) > res) {
            res = (double)(x * c + y * d) / (water + x * c + y * d);
            sm = water + x * c + y * d;
            sugar = x * c + y * d;
          } 
        }
      }
    }
  }

  if (sugar == 0) {
    sm = a*100;
  }

  cout << sm << " " << sugar << endl;
}


Measured memory_bytes: 380
//minamoto
#include<bits/stdc++.h>
#define R register
#define fp(i,a,b) for(R int i=(a),I=(b)+1;i<I;++i)
#define fd(i,a,b) for(R int i=(a),I=(b)-1;i>I;--i)
#define go(u) for(int i=head[u],v=e[i].v;i;i=e[i].nx,v=e[i].v)
template<class T>inline bool cmax(T&a,const T&b){return a<b?a=b,1:0;}
template<class T>inline bool cmin(T&a,const T&b){return a>b?a=b,1:0;}
using namespace std;
const int P=1e9+7;
inline void upd(R int &x,R int y){(x+=y)>=P?x-=P:0;}
inline int inc(R int x,R int y){return x+y>=P?x+y-P:x+y;}
inline int dec(R int x,R int y){return x-y<0?x-y+P:x-y;}
inline int mul(R int x,R int y){return 1ll*x*y-1ll*x*y/P*P;}
int ksm(R int x,R int y){
	R int res=1;
	for(;y;y>>=1,x=mul(x,x))(y&1)?res=mul(res,x):0;
	return res;
}
const int N=25005,M=405;
int f[N][M],g[N][M],a[N],vis[N],n,m,k,l,r,res;
inline void clr(){memset(vis,0,(k+1)<<2);}
bool calc(int l,int r){
	clr();
	fp(i,l,r){
		if(vis[a[i]])return false;
		vis[a[i]]=1;
	}
	return true;
}
bool ck(){
	fp(i,1,m-k+1)if(calc(i,i+k-1))return true;
	return false;
}
int main(){
//	freopen("testdata.in","r",stdin);
	scanf("%d%d%d",&n,&k,&m);
	fp(i,1,m)scanf("%d",&a[i]);
	if(ck())return printf("%d\n",mul(n-m+1,ksm(k,n-m))),0;
	clr();
	for(R int i=1;i<=m&&!vis[a[i]];++i)vis[a[i]]=1,++l;
	clr();
	for(R int i=m;i&&!vis[a[i]];--i)vis[a[i]]=1,++r;
	if(l==m){
		f[0][0]=1;
		fp(i,1,n){
			fp(j,1,k-1){
				f[i][j]=inc(mul(inc(f[i-1][j-1],P-f[i-1][j]),k-j+1),f[i-1][j]);
				g[i][j]=inc(mul(inc(g[i-1][j-1],P-g[i-1][j]),k-j+1),g[i-1][j]);
				if(j>=m)upd(g[i][j],f[i][j]);
			}
			fd(j,k-1,0)upd(f[i][j],f[i][j+1]),upd(g[i][j],g[i][j+1]);
		}
		res=g[n][0];
		fp(i,k-m+1,k)res=mul(res,ksm(i,P-2));
	}else{
		fp(i,0,l)f[0][i]=1;
		fp(i,0,r)g[0][i]=1;
		fp(i,1,n){
			fp(j,1,k-1){
				f[i][j]=inc(mul(inc(f[i-1][j-1],P-f[i-1][j]),k-j+1),f[i-1][j]);
				g[i][j]=inc(mul(inc(g[i-1][j-1],P-g[i-1][j]),k-j+1),g[i-1][j]);
			}
			fd(j,k-1,0)upd(f[i][j],f[i][j+1]),upd(g[i][j],g[i][j+1]);
		}
		for(R int i=1,j=m;j<=n;++i,++j)upd(res,mul(f[i-1][0],g[n-j][0]));
	}
	printf("%d\n",inc(mul(n-m+1,ksm(k,n-m)),P-res));
	return 0;
}

Measured memory_bytes: 79488
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <unordered_map>
#include <cstdlib>
using namespace std;
#define Ma_PI 3.141592653589793
#define eps 0.00000001
#define LONG_INF 3000000000000000000
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define MOD 998244353
#define REP(i,n) for(long long i = 0;i < n;++i)    
#define seg_size 524288
#include <complex>
typedef complex<double> P;
double dot(P a, P b) {
	return (a.real() * b.real() + a.imag() * b.imag());
}
double cross(P a, P b) {
	return (a.real() * b.imag() - a.imag() * b.real());
}
int ccw(P a, P b,P c) {
	P e = b - a;
	P f = c - a;
	if (cross(e, f) > eps) {
		return 1;
	}
	if (cross(e, f) < -eps) {
		return -1;
	}
	if (dot(e, f) < -eps) return 2;
	if (abs(e) < abs(f)) return -2;
	return 0;
}
bool intersect(P a, P b, P c, P d) {
	if (ccw(a, b, c) * ccw(a, b, d) <= 0) {
		if (ccw(c, d, a) * ccw(c, d, b) <= 0){
			return 1;
		}
	}
	return 0;
}
double getDistanceLP(P a, P b, P c) {
	return abs(cross(b - a, c - a) / abs(b - a));
}
double getDistanceSP(P a, P b, P c) {
	if (dot(b - a, c - a) < 0.0) return abs(c - a);
	if (dot(a - b, c - b) < 0.0) return abs(c - b);
	return getDistanceLP(a, b, c);
}
double getDistance(P a, P b, P c, P d) {
	if (intersect(a, b, c, d)) return 0.0;
	return min({ getDistanceSP(a, b, c), getDistanceSP(a, b, d), getDistanceSP(c, d, a), getDistanceSP(c, d, b) });
}
int main() {
	int query;
	cin >> query;
	REP(i, query) {
		double a, b, c, d, e, f, g, h;
		cin >> a >> b >> c >> d >> e >> f >> g >> h;
		cout << fixed << setprecision(10) << getDistance(P(a, b), P(c, d), P(e, f), P(g, h)) << endl;
	}
	return 0;
}


Measured memory_bytes: 3336
fn main() {
    let nmx = read_vec::<usize>();
    let n = nmx[0];
    let m = nmx[1];
    let x = nmx[2];
    let mut books: Vec<Vec<usize>> = Vec::new();
    for _ in 0..n {
        let tmp = read_vec::<usize>();
        books.push(tmp);
    }

    let mut mi = usize::max_value();
    for bit in 0..1 << n {
        let mut total = 0;
        let mut rikaido = vec![0; m];
        for i in 0..n {
            if bit & 1 << i != 0 {
                let book = &books[i];
                total += book[0];
                for j in 0..m {
                    rikaido[j] += book[j + 1];
                }
            }
        }

        if rikaido.iter().all(|&v| v >= x) {
            if mi > total {
                mi = total;
            }
        }
    }

    if mi == usize::max_value() {
        println!("-1");
    } else {
        println!("{}", mi);
    }
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}


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

using namespace std;

using VI = vector<int>;
using VVI = vector<VI>;
using VB = vector<bool>;
using VVB = vector<VB>;
using VD = vector<double>;
using VVD = vector<VD>;
using VS = vector<string>;
using PII = pair<int, int>;
using VPII = vector<PII>;
using VL = vector<long long>;
using VVL = vector<VL>;

#define sz(var) (int)var.size()
#define REP(var, start, end) for(int var = start; var < (int)end; ++var)
#define CLEAR(var, with) memset(var, with, sizeof(var))
#define ALL(x) x.begin(), x.end()
#define LL long long
#define ULL unsigned long long

bool allsame(const string& str) {
    char c = str[0];
    for(int i = 1; i < sz(str); ++i)
        if(c != str[i]) return false;
    return true;
}

string s;
int minChanges()
{
    int ret = 987654321;
    for(char c : s)
    {
        string tmp = s; int cnt = 0;
        while(allsame(tmp) == false)
        {
            for(int i = 0; i < sz(tmp) - 1; ++i)
                if(tmp[i + 1] == c) tmp[i] = c;
            tmp.pop_back();
            ++cnt;
        }
        ret = min(ret, cnt);
    }
    return ret;
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
#ifndef ONLINE_JUDGE
//	freopen("tmp.in", "r", stdin);
//	freopen("tmp.out", "w", stderr);
#endif
    cin >> s;

    cout << minChanges() << endl;

	return 0;
}

Measured memory_bytes: 256
// Addition and Subtraction Hard
// * frank_c1
// * 2017 / 10 / 04

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

const int maxn = (int)(1e5) + 5;
LL f[3];
char opt[3];

int main() {
	int n, x;
	scanf("%d%d", &n, &x);
	f[0] = x; f[1] = f[2] = -(LL)(1e18);
	for (int i = 1; i < n; ++i) {
		scanf("%s%d", opt, &x);
		for (int j = 0; j < 2; ++j) f[j] = max(f[j], f[j + 1]);
		if (opt[0] == '+') for (int j = 0; j < 3; ++j) f[j] += (j & 1) ? -x : x;
		else {
			for (int j = 0; j < 3; ++j) f[j] += (j & 1) ? x : -x;
			for (int j = 2; j > 0; --j) f[j] = max(f[j], f[j - 1]);
		}
	}
	return printf("%lld\n", max(f[0], f[1])), 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#include <iostream>
#include<map>
#include <algorithm>
#include <vector>
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
  int n;
  cin >> n;
  vector<int> x(n);
  rep(i, n) cin >> x[i];
  int ans = 100100100;
  for (int p = 1; p <= 100; p++) {
    int now = 0;
     rep(i, n) now += (x[i] - p)* (x[i] - p);
    ans = min(ans, now);
  }
  cout << ans << endl;
}




Measured memory_bytes: 256
using namespace std;
#define ll long long
#include<bits/stdc++.h>
int main()
{
	ll n;
	cin>>n;
	vector<ll> v;
	for(ll i=0;i<n;i++)
	{
		ll x;cin>>x;v.push_back(x);
	}
	sort(v.begin(),v.end());ll j=n-2;ll c=0;ll sum=0;
	for(ll i=0;i<n-1;i++)
	{
		if(i==0)
		{
			sum+=v[n-1];
		}
		else
		{
			sum+=v[j];
			c++;
		}
		if(c==2){c=0;
		j--;}
		
	}
	cout<<sum<<endl;
	return 0;
}

Measured memory_bytes: 5296
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace _0336
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] hr = RArInt();
            Console.WriteLine(hr[0] + hr[1] == 0 ? 0 : (hr[0] + hr[1]) / Math.Abs(hr[0] + hr[1]));

        }
        static string RSt() { return Console.ReadLine(); }
        static int RInt() { return int.Parse(Console.ReadLine().Trim()); }
        static long RLong() { return long.Parse(Console.ReadLine().Trim()); }
        static double RDouble() { return double.Parse(Console.ReadLine()); }
        static string[] RArSt(char sep = ' ') { return Console.ReadLine().Trim().Split(sep); }
        static int[] RArInt(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => int.Parse(e)); }
        static long[] RArLong(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => long.Parse(e)); }
        static double[] RArDouble(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => double.Parse(e)); }
        static string WAr<T>(IEnumerable<T> array, string sep = " ") { return string.Join(sep, array.Select(x => x.ToString()).ToArray()); }
    }
}



Measured memory_bytes: 17924
#include <stdio.h>

int main(void)
{
	
	int w;
	int h;
	int x;
	int y;
	int r;

	scanf("%d %d %d %d %d", &w, &h, &x, &y, &r);

	if (x+r <= w)
	{
		if (y+r <= h)
		{
			if (x-r >= 0)
			{
				if (y-r>= 0)
				{
					printf("Yes\n");

					return 0;
				}
			}
		}
	}

	printf("No\n");

	return 0;

}

Measured memory_bytes: 580
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author dyominov
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ACatsAndDogs solver = new ACatsAndDogs();
        solver.solve(1, in, out);
        out.close();
    }

    static class ACatsAndDogs {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int a = in.nextInt();
            int b = in.nextInt();
            int c = in.nextInt();
            out.print(a <= c && a + b >= c ? "YES" : "NO");

        }

    }

    static class InputReader implements AutoCloseable {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

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

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public void close() {
        }

    }
}



Measured memory_bytes: 22484
#include<iostream>
#include<fstream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<math.h>
#include<algorithm>
#include<iomanip>
#include<set>

#define P 1000000007

using namespace std;

class Counting {
	unsigned long long p, n;
	vector<long long> invMemo, facMemo, facInvMemo;
public:
	Counting(unsigned long long nn, unsigned long long np) {
		p = np;
		n = nn;
		invMemo.resize(n + 1);
		facMemo.resize(n + 1);
		facInvMemo.resize(n + 1);
		facMemo[0] = 1;
		facMemo[1] = 1;
		facInvMemo[0] = 1;
		facInvMemo[1] = 1;
		invMemo[0] = 0;
		invMemo[1] = 1;
		for (unsigned long long i = 2; i <= n; i++) {
			invMemo[i] = p - (p / i)*invMemo[p%i] % p;
			facMemo[i] = (facMemo[i - 1] * i) % p;
			facInvMemo[i] = (facInvMemo[i - 1] * invMemo[i]) % p;
		}
	}
	unsigned long long fac(unsigned long long k) {
		return facMemo[k];
	}
	unsigned long long facInv(unsigned long long k) {
		return facInvMemo[k];
	}
	unsigned long long choose(unsigned long long n, unsigned long long k) {
		if (!(0 <= k && k <= n))
			return 0;
		return (((facMemo[n] * facInvMemo[k]) % p)*facMemo[n - k]) % p;
	}
	unsigned long long divide(unsigned long long a, unsigned long long b) {
		return (a * invMemo[b]) % p;
	}
	unsigned long long mod(unsigned long long a) {
		a %= p;
		if (a < 0) a += p;
		return a;
	}
	unsigned long long power(unsigned long long a, unsigned long long e) {
		unsigned long long ans = 1;
		for (; e > 0; e /= 2) {
			if (e % 2 != 0)
				ans = ans * a % p;
			a = a*a%p;
		}
		return ans;
	}
};

int main() {
	int n;
	long long sum = 0;
	cin >> n;
	vector<long long> v;
	v.resize(n);
	for (int i = 0; i < n; i++) {
		cin >> v[i];
		sum += v[i];
	}
	sum -= v[0];
	long long ssum = v[0], ans = abs(sum - ssum);
	for (int i = 1; i < n - 1; i++) {
		sum -= v[i];
		ssum += v[i];
		ans = min(ans, abs(sum - ssum));
	}
	cout << ans << endl;
	//cin >> n;
	return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define RFOR(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define REP(i,n) FOR(i,0,(n))
#define REPS(i,n) FOR(i,1,(n)+1)
#define RREP(i,n) RFOR(i,0,(n))
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define DEBUG(x)  cout << #x << " = " << (x) << endl;
#define SORT(x) sort(ALL(x));
#define RSORT(x) sort(RALL(x));
#define SUM(x) accumulate(ALL(x),0);
#define FI first
#define SE second
#define PB push_back
#define EB emplace_back
#define SZ(x) (int)(x).size()
#define BN(x) ((1<<x)-1)
#define DUP(x,y) (((x)+(y)-1)/(y))
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
const ll mod = 1e9+7;
const int INF = (1<<30)-1;
const ll INFLL = (1LL<<62)-1;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
//cout << fixed << setprecision(10);

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

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

int main () {
  int N; cin >> N;
  vll T(N); REP(i,N) cin >> T[i];

  ll ans = T[0];
  REP(i,N) {
    ans = lcm(ans,T[i]);
  }

  cout << ans << endl;
}

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

#define REP(i,s,n) for(int i=s;i<n;i++)
#define rep(i,n) REP(i,0,n)

using namespace std;

short dp[1<<12][1025],L[1000],bc[1<<12];
int N,M;

int main(){
  rep(i,(1<<12)) bc[i] = __builtin_popcount(i);
  while( cin >> N >> M, N|M ){
    rep(i,N) cin >> L[i];
    reverse(L,L+N);
    int limit = (1<<M);
    rep(i,limit) rep(j,N+M+5) dp[i][j] = -1;        // invalid
    rep(i,limit) if( bc[i] == L[0] ) dp[i][0] = -2; // terminator

    rep(i,N-1){
      rep(j,limit){
        if( dp[j][i] == -1 ) continue;
        int bitmask = (j<<1) & ((1<<M)-1);
        int target = ( (j>>(M-1)) & 1 );
        rep(k,2){
          int nbitmask = bitmask | k;
          if( bc[nbitmask] == L[i+1] ) dp[nbitmask][i+1] = target;
        }
      }
    }

    string ans = "";
    int bitmask = -1;
    rep(i,limit) if( dp[i][N-1] != -1 ){
      bitmask = i;
      rep(j,M) {
        if( (i>>j) & 1 ) ans += "1";
        else             ans += "0";
      }
      break;
    }
    if( bitmask == -1 ) {
      puts("Goofy");
      continue;
    }
    for(int i=N-1;i>=1;i--){
      int v = dp[bitmask][i];
      ans += string(1,(char)('0'+v));
      assert( v == 0 || v == 1);
      int tmp = bitmask;
      bitmask  >>= 1;
      bitmask |= (v<<(M-1));
      bitmask &= ((1<<M)-1);
      assert( bc[bitmask] == L[i-1] );
    }
    cout << ans << endl;
  }
  return 0;
}

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


int main() {
	size_t n;
	cin >> n;
	vector<double> vs;
	for (size_t i = 0; i < n; ++i) {
		double v;
		cin >> v;
		vs.push_back(v);
	}

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

	double s = vs[0];
	for (size_t i = 1; i < vs.size(); ++i) {
		s = (s + vs[i]) / 2.0;
	}

	cout << s << endl;
}

Measured memory_bytes: 256
fun main(args: Array<String>) {
    val (H, N) = listOfInt()
    val dp = Array<Int>(H + 1) { 1001001001 }
    dp[0] = 0
    repeat(N) {
        val (A, B) = listOfInt()
        repeat (H) {
            val nh = Math.min(it + A, H)
            dp[nh] = Math.min(dp[nh], dp[it] + B)
        }
    }
    println(dp[H])
}
fun next() = readLine()!!
fun nextLong() = next().toLong()
fun listOfString() = next().split(" ")
fun listOfInt() = listOfString().map(String::toInt)

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

int R;

int main() {
	cin >> R;
    if (R < 1200 ) {
		cout << "ABC" << endl;
	} else if (R <= 2799) {
		cout << "ARC" << endl;
	} else {
		cout << "AGC" << endl;
	}	
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;
public class Main
{
	static int cnt[][];
	static int obs[][];
	static int a,b;
	public static void main(String arg[])
	{
		Scanner in=new Scanner(System.in);
		for(;;)
		{
			a=in.nextInt();
			b=in.nextInt();
			if((a|b)==0)
				return;
			int o=in.nextInt();
			obs=new int[a][b];
			cnt=new int[a][b];
			for(int i=0;i<a;i++)
				Arrays.fill(cnt[i], -1);
			for(int i=0;i<o;i++)
				obs[in.nextInt()-1][in.nextInt()-1]=1;
			System.out.println(count(0,0));
		}
	}
	static int count(int x,int y)
	{
		if (cnt[x][y] >= 0)  //すでに数えている場合
			return cnt[x][y];
		if (x==a-1&&y==b-1)
			return 1;
		int res=0;
		if (x+1<a&&obs[x+1][y]!=1)
			res+=count(x+1,y);
		if(y+1<b&&obs[x][y+1]!=1)
			res+=count(x,y+1);
		return cnt[x][y] = res;	
	}
}

Measured memory_bytes: 12000
#include <bits/stdc++.h>
#define MOD 100000007
#define PI 3.141592653589793238
#define pb push_back
#define ALL(V) (V).begin(), (V).end()
#define rep(i, a, b) for(int i = (a); i < (b); ++i)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long long int lint;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef vector<int> VI;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
inline ll gcd(ll a, ll b) { return (a % b == 0 ? b : gcd(b, a % b)); }
inline ll lcm(ll a, ll b) { return a * b / gcd(a, b); }
inline ll char_to_ll(char c) { return (int)(c - '0'); }
inline ll string_to_ll(string s) { return atoi(s.c_str()); }
inline bool is_prime(ll x){ if(x <= 1) return false; for(ll i = 2; sqrt(i) <= x; i++) if(x % i == 0) return false; return true; }

int main(){
    ll R;
    cin >> R;

    cout << (2 * R * PI) << endl;

    return 0;
}


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

long long n, m;
vector<pair<long long, long long> > v;

struct dsu {
  vector<long long> pset;
  vector<long long> size;
  long long numsets;
  dsu(long long n) {
    numsets = n;
    pset.resize(n);
    size.resize(n);
   	for (long long i = 0; i < n; i++) pset[i] = i;
    for (long long i = 0; i < n; i++) size[i] = 1;
  }
  long long find_set(long long i) {
    return pset[i] == i ? i : pset[i] = find_set(pset[i]);
  }
  void unify(long long i, long long j) {
    long long a = find_set(i), b = find_set(j);
    if (a == b) return;
    numsets--;
    if (size[a] < size[b]) {
      pset[a] = b;
      size[b] += size[a];
    } else {
      pset[b] = a;
      size[a] += size[b];
    }
  }
  bool same_set(long long i, long long j) {
    return find_set(i) == find_set(j);
  }
  long long size_set(long long i) {
    return size[find_set(i)];
  }
};

int main() {
	cin >> n >> m;
  	for (long long i = 0; i < m; i++) {
      	long long a, b;
      	cin >> a >> b;
      	a--; b--;
    	v.push_back(make_pair(a, b)); 
    }
  	long long ans[m];
  	dsu d(n);
  	long long cur = n * (n - 1) / 2;
  	for (long long i = m - 1; i >= 0; i--) {
      	bool b = d.same_set(v[i].first, v[i].second);
      	long long pr = 0;
      	if (!b) {
         	long long a = d.size_set(v[i].first);
          	long long b = d.size_set(v[i].second);
          	if (b < a) swap(a, b);
            pr = a * b;
        }
     	d.unify(v[i].first, v[i].second);
      	ans[i] = cur;
      	cur -= pr;
    }
  	for (long long i = 0; i < m; i++) {
     	cout << ans[i] << endl; 
    }
}


Measured memory_bytes: 5232
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<string>
#include<cstring>
#include<algorithm>
#include<queue>
#include<map>
#include<set>
typedef long long ll;
const ll longinf=1LL<<60;
using namespace std;

int a,b,c,d;
int main()
{
    cin>>a>>b>>c>>d;
    while (a>0 && c>0)
    {
        if (a>0)
        {
            c-=b;
        }
        if (c>0)
        {
            a-=d;
        }
    }
    if (a>0) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}



Measured memory_bytes: 3616
<?php

class Scanner
{
    private $arr = [];
    private $count = 0;
    private $pointer = 0;

    public function next()
    {
        if ($this->pointer >= $this->count) {
            $str = trim(fgets(STDIN));
            $this->arr = explode(" ", $str);
            $this->count = count($this->arr);
            $this->pointer = 0;
        }
        $result = $this->arr[$this->pointer];
        $this->pointer++;
        return $result;
    }

    public function hasNext()
    {
        return $this->pointer < $this->count;
    }

    public function nextInt()
    {
        return (int)$this->next();
    }

    public function nextDouble()
    {
        return (double)$this->next();
    }
}

class out
{
    public static function printIn($str = "")
    {
        echo $str . PHP_EOL;
    }
}

$sc = new Scanner;

$s = $sc->next();
$s_arr = str_split($s);

//for ($i = 0; $i < count($s_arr); $i++) {
//  if ($i === 0 || $i % 2 === 0){
//      echo $s_arr[$i];
//  }
//}

for ($i = 0; $i < count($s_arr); $i += 2) {
    echo $s_arr[$i];
}

Measured memory_bytes: 10872
from collections import Counter

N, K = map(int, input().split())
a = list(map(int, input().split()))

counter = Counter(a)

lis = counter.most_common()[::-1]
individual = len(lis)

cnt = 0
ind = 0
while individual > K:
    cnt += lis[ind][1]
    ind += 1
    individual -= 1

print(cnt)

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

int main() {
	ios_base::sync_with_stdio(false);
	/* A B.CD */
	int64_t A, B, C, D; cin >> A >> B;
	char dot, c, d; cin >> dot >> c >> d;
	C = c - '0', D = d - '0';

	cout << A*B + (10*A*C + A*D)/100 << endl;
}


Measured memory_bytes: 3636
#define _USE_MATH_DEFINES
#include <sstream> //string stream its useful!
#include<string>
#include<iostream>
#include<utility> //pair
#include <vector> // vector
#include <algorithm>    // swap,sort,binary_search
#include <functional>   // std::greater
#include <map> //map
#include<set> //set
#include<queue> //queue
#include<list> //list
#include<cmath>
#include<numeric>
#include<cassert>
#include <iomanip> //cout<<setprecision
#include <regex>

typedef long long ll;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
ll W = 1000000007;
// tuple にすれば回るんじゃないかな。


using namespace std;
void omajinai() {
    
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<setprecision(15);
    //freopen("txt.csv","r",stdin);
}



static function<ll(ll,ll)> sumfunc = [](ll l1,ll l2)->ll{return l1 + l2;};
class UF{
public:
    vector<ll> v;
    vector<ll> v2;
    function<ll(ll,ll)> func;
    UF(long t,function<ll(ll,ll)> func){
        v = vector<ll>(t);
        v2 = vector<ll>(t);
        for(int i = 0; i<v.size();i++) v[i] = i;
        this->func = func;
    }
    long getunion(long t){
        if(v[t] == t) return t;
        v[t] = getunion(v[t]);
        return v[t];
    }
    void unite(pair<long,long> p){
        long a = getunion(p.first), b = getunion(p.second);
        if(a>b) swap(a,b);
        v[b] = a;
        v2[a] = func(v2[b],v2[a]);
    }
    long sizeofunion(){
        long sum = 0;
        for(int i = 0 ; i<v.size();i++) if(v[i] == i ) sum++;
        return sum;
    }
};

class Main{
public:
    
    ll N,M;
    Main(){
        cin>>N>>M;
    }
    
    void run(){
        ll ansmin = 0, ansmax = M;
        
        while(ansmax - ansmin >1){
            ll k = (ansmin + ansmax)/2;
            bool isOK = max((k-N),0LL) * 2 + 2*k <=M;
            if(isOK)ansmin = k; else ansmax = k;
        }
        cout<<ansmin<<endl;
    }
};

int main(){
    omajinai();
    Main().run();
}


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

typedef long long ll;
typedef pair<int, int> pii;
#define FOR(i, n) for(int i=0; i<n; i++)
#define FOR1(i, n) for(int i=1; i<=n; i++)
#define FORI(i, n) for(int i=n-1; i>=0; i--)
template<class T, class U> void umin(T& x, const U& y){ x = min(x, (T)y);}
template<class T, class U> void umax(T& x, const U& y){ x = max(x, (T)y);}
template<class T, class U> void init(vector<T> &v, U x, size_t n) { v=vector<T>(n, (T)x); }
template<class T, class U, typename... W> void init(vector<T> &v, U x, size_t n, W... m) { v=vector<T>(n);  for(auto& a : v) init(a, x, m...); }

int main(int argc, char** argv) {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cout << setprecision(15);
    if (argc == 2 && atoi(argv[1]) == 123456789) freopen("d:\\code\\cpp\\contests\\stdin", "r", stdin);

    int T = 1;
//    cin >> T;
    FOR1(tt, T){
        string s;
        cin >> s;
        int len = 0;
        if (s == "RRR")
            len = 3;
        else if (s == "RRS" || s == "SRR")
            len = 2;
        else if (s == "RSS" || s == "SRS" || s == "SSR" || s == "RSR")
            len = 1;
        cout << len << endl;
    }

    if (argc == 2 && atoi(argv[1]) == 123456789) cout << clock()*1.0/CLOCKS_PER_SEC << " sec\n";
    return 0;
}



Measured memory_bytes: 3640
#include <iostream>
#include <algorithm>
#include <math.h>
#include <vector>
#include <queue>

using namespace std;
typedef long long ll;
#define MOD 1000000007

ll dfs(int K, const vector<vector<int>>&G, int now, int from) {
    int available_color_num;
    if(from == -1) available_color_num = K - 1;
    else available_color_num = K - 2;

    if(K < G[now].size()) return 0;
    else {
        ll case_num = 1;
        for(auto e: G[now]) {
            if(e == from) continue;

            case_num *= available_color_num;
            available_color_num--;
            case_num %= MOD;
        }
        for(auto e: G[now]) {
            if(e == from) continue;

            case_num *= dfs(K, G, e, now);
            case_num %= MOD;
        }
        return case_num;
    }
}

int main() {
    ll N, K;
    cin >> N >> K;

    vector<vector<int>> G(N);
    for(int i = 0; i < N - 1; i++) {
        int a, b;
        cin >> a >> b;
        a--; b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }

    ll ans = K * dfs(K, G, 0, -1);
    ans %= MOD;
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 11520
fn read_line() -> String {
  let mut tmp = String::new();
  std::io::stdin().read_line(&mut tmp).unwrap();
  tmp.trim().to_string()
}


fn main() {
  let chars: Vec<_>
    = read_line().split(" ").map(|n| n.chars().nth(0).unwrap()).collect();
  let (x, y)
    = (chars[0].to_digit(16).unwrap(), chars[1].to_digit(16).unwrap());
  let ans = if x < y {
    '<'
  } else if x > y {
    '>'
  } else {
    '='
  };
  println!("{}", ans);
}


Measured memory_bytes: 4352
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <cmath>
#include <complex>
#include <map>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cassert>
#include <iomanip>
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)
#define fst first
#define snd second
#define Pqaz(T) priority_queue<T,vector<T>,greater<T>>
#define Pqza(T) priority_queue<T>
#define put(x) cout << x;
#define putsp(x) cout << x << ' ';
#define putbd cout << "---------------------------------------------" << endl;
#define putln(x) cout << x << endl;
#define debug(x) cerr << #x << "=" << x << endl;
#define ENJYU std::ios::sync_with_stdio(false);std::cin.tie(0);

typedef long long ll;
typedef pair<ll, ll> llP;
typedef pair<int, int> intP;
typedef complex<double> comp;
typedef vector <int> vec;
typedef vector <ll> vecll;
typedef vector <double> vecd;
typedef vector <vec> mat;
typedef vector <vecll> matll;
typedef vector <vecd> matd;

//vector の中身を出力
template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}

const int MAX = 200020;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<29;
const ll INFL = 1e18;
const int MOD = 1e9+7;

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

//********************************template END****************************************//

void solve(void){

	int N, K;
	cin >> N >> K;
	cout << (N%K!=0) << endl;

}

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


Measured memory_bytes: 256
#include<iostream>
#include<string.h>
#include<string>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<math.h>
#include<queue>
#include<set>
#include<map>
using namespace std;
typedef long long ll;
typedef long double db;
typedef pair<int,int> pii;
const int N=100000;
const db pi=acos(-1.0);
#define lowbit(x) (x)&(-x)
#define sqr(x) (x)*(x)
#define rep(i,a,b) for (register int i=a;i<=b;i++)
#define per(i,a,b) for (register int i=a;i>=b;i--)
#define go(u,i) for (register int i=head[u];i;i=sq[i].nxt)
#define fir first
#define sec second
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define maxd 998244353
#define eps 1e-8
char s[100100];

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 main()
{
	scanf("%s",s+1);
	int n=strlen(s+1);
	if (s[1]==s[n])
	{
		if (n&1) puts("Second");else puts("First");
	}
	else
		if (n&1) puts("First");else puts("Second");
	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
typedef long long int ll;
typedef pair<ll,ll> P;
typedef vector<ll> VI;
typedef vector<VI> VVI;
const ll MOD = 1000000007;
const ll INF = 1e18;
#define REP(i,n) for(int i=0;i<n;i++)
#define ALL(v) v.begin(),v.end()

int main(){
	int n, q; cin >> n >> q;
	dsu d(n);
	while(q--){
		int t, u, v;
		cin >> t >> u >> v;
		if(t==0)
			d.merge(u,v);
		else
			cout << d.same(u,v) << endl;
	}
	return 0;
}


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

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

    cin >> n;
    for (int i = 0; i < n; i++) {
        int in;
        cin >> in;
        l.push_back(in);
    }

    int count = 0;
    for (int i = 0; i < n - 2; i++) {
        for (int j = i + 1; j < n - 1; j++) {
            for (int k = j + 1; k < n; k++) {
                if (l[i] != l[j] && l[j] != l[k] && l[k] != l[i] && l[i]+l[j]>l[k] && l[j] + l[k] > l[i] && l[k] + l[i] > l[j]) {
                    count++;
                }
            }
        }
    }

    cout << count;
}

Measured memory_bytes: 3192
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define sint(a) scanf("%d", &a)
#define sint2(a, b) scanf("%d %d", &a, &b)
#define sll(a) scanf("%lld", &a)
#define sll2(a, b) scanf("%lld %lld", &a, &b)
#define mem(a, i) memset(a, i, sizeof(a))
const double pi = acos(-1);
const int maxn = 1e6 + 10;
const int mod = 1e4;


int main()
{
    string s;
    cin>>s;
    int sum=0;
    int l=0,r=s.length()-1;
    while(r-l>=1)
    {
        if(s[r]!=s[l])
            sum++;
        r--;
        l++;
    }
    cout<<sum<<endl;
   return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String kekka = "";
        int n=sc.nextInt();
        String s=sc.next();
		char[] c = s.toCharArray();
      	
      	int len = s.length();
      	for(int i=0;i<len;i++){
        	if((int)c[i]+n>90){
            	kekka = kekka + Character.toString((char)((int)c[i]+n-26));
            }else{
            	kekka = kekka + Character.toString((char)((int)c[i]+n));
            }
        }
		System.out.println(kekka);      	
	}
}

Measured memory_bytes: 147540
# include <bits/stdc++.h>
# define pb push_back
# define ll long long
# define fi first
# define se second
# define speed ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
# define mkp make_pair
//# define time cerr << "\nTime elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n"

using namespace std;

ll q , w , e , z ;


int main()
{
	speed;

    int n ;
    cin >> n ;
    int a[n];
    for(int i = 0 ; i < n ; i ++ ){
        cin >> a[i] ;
    }
    sort(a,a+n);
    int k = n / 2 ;
    if(n % 2 != 0 ){
        cout<<0<<endl;
        return 0;
    }
    if(a[k-1] == a[k]){
        cout<<0<<endl;
        return 0 ;
    }
    int j = a[k]-a[k-1];
    if ( a[k-1] != a[k]){
        cout<<j<<endl;
        return 0 ;
    }

	time;
}


Measured memory_bytes: 640
#include<cstdio>
int main()
{
    int n,k,ans=0,x;
    scanf("%d%d",&n,&k);
    for(int i=1;i<=n;i++)
    {
        scanf("%d",&x);
        if(x<=k/2)
            ans+=x*2;
        else
            ans+=(k-x)*2;
    }
    printf("%d\n",ans);
} 

Measured memory_bytes: 128
#include <cmath>
#include <cstdio>
#include <algorithm>
#define rg register
#define llint long long
using namespace std;
const int N=1008611;

struct ios
{
	template <typename _tp>
	inline ios operator >> (_tp &x)
	{
		x = 0;int f = 1;char c = getchar();
		for(;c<'0'||c>'9';c=getchar()) if(c=='-') f = -1;
		for(;c<='9'&&c>='0';c=getchar()) x = (x<<1)+(x<<3)+(c^48);
		x *= f;
		return *this;
	}
	template <typename _tp>
	inline ios operator << (_tp x)
	{
		char s[66];int dgt = 0;
		if(x==0) putchar('0');
		if(x<0) putchar('-'),x = -x;
		while(x) ++dgt,s[dgt] = x%10+'0',x/=10;
		while(dgt) putchar(s[dgt]),--dgt;
		return *this;
	}
	inline ios operator << (char x)
	{
		putchar(x);
		return *this;
	}
}io;

int n;
int num[N],mxn[N];

int main()
{
	io >> n;int mmm = 0;
	for(rg int i=1;i<=n;++i)
		io >> num[i],mxn[i] = mmm,mmm = max(mmm,num[i]);
	mmm = 0;
	for(rg int i=n;i>=1;--i)
		mxn[i] = max(mxn[i],mmm),mmm = max(mmm,num[i]);
	for(rg int i=1;i<=n;++i)
		io << mxn[i] << '\n';
	return 0;
}

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

int main() {
  int n;
  cin >> n;
  
  // a1の操作可能数を調べる
  int a1;
  cin >> a1;
  
  int a1_divcounter = 0;	//a1が割れる回数
  int a1_dividing = 1;		//a1を割れる数
  
  int divided = a1;	//割られる数(計算用)
  while(1){
    if(divided % 2 == 0){
      a1_divcounter++;
      a1_dividing*=2;
      divided/=2;
    }
    else{
      break;
    }
  }
  
  //a2以降を調べて割れる数の最小値を更新
  int divcounter = a1_divcounter;
  int dividing = a1_dividing;
  for (int i = 0; i < n-1; i++) {
    cin >> divided;
    while(1){
      if (divided % dividing == 0) break;
      else {
        dividing /= 2;
        divcounter--;
      }
    }
    if (divcounter == 0) break;
  }
  
  cout << divcounter << endl;
}


Measured memory_bytes: 3640