akhauriyash/Code-Regression huggingface dataset:
#define _USE_MATH_DEFINES
#define INF 0x3f3f3f3f
#include <cstdio>
#include <iostream>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>
#include <cctype>
#include <utility>
 
using namespace std;
 
typedef long long ll;
typedef pair <int,int> P;
typedef pair <int,P > PP;
 
int tx[] = {0,1,0,-1};
int ty[] = {-1,0,1,0};
 
static const double EPS = 1e-8;

int main(){
  int total_carrots;
  int carrot_store_ability;
  int power_up_duration;
  int normal_speed;
  int power_up_speed;
  int goal_distance;
  while(~scanf("%d %d %d %d %d %d",
	       &total_carrots,
	       &carrot_store_ability,
	       &power_up_duration,
	       &normal_speed,
	       &power_up_speed,
	       &goal_distance)){

    bool carrots[10001];
    memset(carrots,false,sizeof(carrots));

    for(int carrot_idx=0;carrot_idx< total_carrots; carrot_idx++){
      int distance;
      scanf("%d",&distance);
      carrots[distance] = true;
    }

    int current_pos = 0;

    int current_carrots = 0;
    int life = 0;

    int high_speed_interval =0;
    for(int pos=0;pos< goal_distance; pos++,life--){
      if(carrots[pos]){
	current_carrots++;
      }

      if((life <= 0 && current_carrots > 0)
	 || (current_carrots > carrot_store_ability)){
	current_carrots--;
	life = power_up_duration * power_up_speed;
      }

      if(life > 0){
	high_speed_interval++;
      }
    }

    printf("%.9lf\n",(double)high_speed_interval/(double)power_up_speed
	   + (double)(goal_distance - high_speed_interval)/(double)normal_speed);
  }

}

Measured memory_bytes: 1236
#include <bits/stdc++.h>
#define lowbit(x) ((x)&(-(x)))
#define re register
#define ll long long
#define ull unsigned long long
#define rep(i,a,b) for(re int i=a;i<=b;++i)
#define per(i,a,b) for(re int i=a;i>=b;--i)
template<typename T>
inline void read(T&x)
{
	x=0;
	char s=(char)getchar();
	bool f=false;
	while(!(s>='0'&&s<='9'))
	{
		if(s=='-')
			f=true;
		s=(char)getchar();
	}
	while(s>='0'&&s<='9')
	{
		x=(x<<1)+(x<<3)+s-'0';
		s=(char)getchar();
	}
	if(f)
		x=(~x)+1;
}
template<typename T>
inline void clear(T*a,int l,int r,int val)
{
	memset(&a[l],val,sizeof(T)*(r-l+1));
}
const int N=1e6+5;
ll a;
long double b;
signed main()
{
	scanf("%lld%LF",&a,&b);
	printf("%lld\n",(ll)(a*b));
	return 0;
}



Measured memory_bytes: 3836
// In the name of God

#include <bits/stdc++.h>

using namespace std;

int d[10][10];

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

	int n;
	cin >> n;

	auto fs = [](int x) {
		while(x >= 10) {
			x /= 10;
		}
		return x;
	};

	long long ans = 0;

	long long c = 0;

	for(int i = 1; i <= n; i++) {
		ans += d[i % 10][fs(i)];
		if(fs(i) == i % 10) c++;
		d[fs(i)][i % 10]++;
	}

	cout << ans * 2 + c;

	return 0;
}


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

int main() {
    long long n, a, b;
    cin>>n>>a>>b;
    long long result=0;
    if(n==1) {
        if(a==b) 
          result=1;
        else 
          result=0;
    }
    else if (a > b) 
      result=0;
    else {
        result=(a + b*(n-1))-(a*(n-1) + b)+1;
    }
    cout <<result;
	return 0;
}


Measured memory_bytes: 3620
using System;
using System.IO;
using System.Linq;
using System.Collections.Generic;

public class Program
{

	public void Proc()
	{
        System.Text.StringBuilder ans = new System.Text.StringBuilder();
        while(true) {
            int[] inpt = Reader.ReadLine().Split(' ').Select(a => int.Parse(a)).ToArray();
            if(inpt.All(a=>a<0)) {
                break;
            }
            ans.AppendLine(GetAns(inpt));
        }
        Console.Write(ans.ToString());
    }

    private string GetAns(int[] inpt) {
        if(inpt.Take(2).Any(a=>a<0)) {
            return "F";
        }
        int sum = inpt.Take(2).Sum();
        if(sum >= 80) {
            return "A";
        } else if(sum >= 65) {
            return "B";
        } else if(sum >= 50) {
            return "C";
        } else if(sum >= 30) {
            if(inpt[2] >= 50) {
                return "C";
            }
            return "D";
        }
        return "F";
    }



    public class Reader
	{
		private static StringReader sr;
		public static bool IsDebug = false;
		public static string ReadLine()
		{
			if (IsDebug)
			{
				if (sr == null)
				{
					sr = new StringReader(InputText.Trim());
				}
				return sr.ReadLine();
			}
			else
			{
				return Console.ReadLine();
			}
		}
		private static string InputText = @"



40 42 -1
20 30 -1
0 2 -1
-1 -1 -1


";
	}

	public static void Main(string[] args)
	{
#if DEBUG
		Reader.IsDebug = true;
#endif
		Program prg = new Program();
		prg.Proc();
	}
}

Measured memory_bytes: 9388
#include <iostream>
#include <string>
#include <vector>
typedef unsigned int UINT;
using namespace std;
template
<typename T>
T BeLeavedOneOut(T A, T B, T C)
{
    if (A == B)
        return C;
    if (A == C)
        return B;
    return A;
}


int main(void) {
    int r, g, b;
    cin >> r >> g >> b;
    cout << BeLeavedOneOut(r, g, b) << endl;

    return 0;
}

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


int main()
{
    int a[3][3];
    rep(i, 3) rep(j, 3) cin >> a[i][j];
    int n; cin >> n;
    int b[n];
    rep(i, n) cin >> b[i];
    for (int x :b){
        rep(i, 3) rep(j, 3){
            if (a[i][j] == x){
                a[i][j] =0;
            }
        }
    }
    bool flag = false;
    //縦,横
    int s_cl = 0, s_cr = 0;
    rep(i, 3){
        int s_h = 0, s_v = 0;
        rep(j, 3) {
            s_h += a[i][j];
            s_v += a[j][i];
        }
        if (s_h ==0 or s_v == 0) flag = true;
        s_cl += a[i][i];s_cr += a[i][2-i];
    }
    if (s_cl ==0 or s_cr == 0) flag = true;
    if(flag) cout << "Yes" << endl;
    else cout << "No" << endl;

}

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

const ll MOD = 1e9+7;
int rui[100001];

int main()
{
	int n,m;
	ll ans=0;
	cin>>n>>m;
	fill(rui,rui+100001,0);
	for(int i=0;i<m;i++)
	{
		int l,r;
		cin>>l>>r;
		rui[l]++;
		rui[r+1]--;
	}
	for(int i=1;i<n+1;i++)
		rui[i]+=rui[i-1];
	
	for(int i=1;i<n+1;i++)
	{
		if(rui[i]==m)
			ans++;
	}
	cout<<ans<<endl;
	return 0;
}

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

int main()
{
    int a,b,c;
    while(~scanf("%d%d%d",&a,&b,&c))
    {
        if(a+b>=c)
            printf("Yes\n");
        else
            printf("No\n");
    }

    return 0;
}


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

#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define fst first
#define snd second
#define pb push_back
#define ALL(x) x.begin(),x.end()
#define EPS (1e-9)
#define equals(a,b) (fabs((a)-(b))<EPS)

using namespace std;

bool LT(double a,double b) { return !equals(a,b) && a < b; }
bool LTE(double a,double b) { return equals(a,b) || a < b; }

const string YES = "";
const string NO  = "";

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

#define MAX 6000
int N,K;
ll P[MAX], C[MAX];

int par[MAX];
int find(int x) {
  if( x == par[x] ) return x;
  return par[x] = find(par[x]);
}
void unite(int x,int y) {
  x = find(x), y = find(y);
  if( x != y ) par[x] = y;
}

int used[MAX];
ll sum[MAX];
bool debug = 0;
void dfs(int cur, int rem, ll &cscore, ll &maxi) {
  if( rem <= 0 ) {
    return;
  }
  if( rem - 1 >= 0 ) {
    int nex = P[cur];
    cscore += C[nex];
    maxi = max(maxi,cscore);
    if( debug  ){
      //cout << "    ?? " << cur << " -> "  << nex << " : " << cscore << endl;
    }
    dfs(nex, rem - 1, cscore, maxi);
  }
}



void solve() {
  rep(i,N) --P[i];
  rep(i,N) par[i] = i;
  ll maxi = -LLONG_MAX;
  rep(i,N) maxi = max(maxi,C[i]);
  
  rep(i,N) {
    if( debug ) {
      cout << "* " << i << "-th:" << endl;
    }
    memset(used, -1, sizeof used);
    memset(sum, -1, sizeof sum);
    used[i] = 0;
    sum[i] = 0;
    int cur = i;
    ll score = 0;
    ll rem = K;
    //dfs(cur,rem,score,maxi);
    //cout << "?? score = " << score << endl;
    //continue;
    while( rem >= 1 ) {
      --rem;
      int nex = P[cur];
      if( debug ) {
	cout << "  cur = " << cur << " -> " << nex << endl;
      }
      score += C[nex];
      if( used[nex] != -1 ) {
	ll loop_sz = ( used[cur] - used[nex] ) + 1;
	ll loop_sum = ( score - sum[nex] );
	if( debug ) {
	  cout << "  LOOP START = " << nex << " - END " << cur << endl;
	  cout << "  LOOP SIZE  = " << loop_sz << endl;
	  cout << "  LOOP SUM   = " << loop_sum << endl;
	  cout << "  curr score = " << score << endl;
	}
	ll coef = rem / loop_sz;
	if( coef - 1 >= 0 ) {
	  --coef;
	}
	score += ( coef * loop_sum );
	rem -= ( coef * loop_sz );
	if( debug ) {
	  cout << "  coef = " << coef << endl;
	  cout << "  rem  = " << rem << endl;
	}
	maxi = max(maxi,score);
	dfs(nex, rem, score, maxi);
	//score += dfs(nex, rem);
	maxi = max(maxi,score);
	break;
      } else {
	sum[nex] = score;
	used[nex] = used[cur] + 1;
	cur = nex;
      }
      maxi = max(maxi,score);
    }

    maxi = max(maxi,score);
    if( debug ) {
      cout << "  rem == 0, score = " << score << endl;
    }
    
  }
  cout << maxi << endl;
}

int main() {
  cin >> N >> K;
  rep(i,N) cin >> P[i];
  rep(i,N) cin >> C[i];

  solve();
  return 0;
}


Measured memory_bytes: 3760
import java.util.*;


public class Main {
	
	void AOJ0053(){
		Scanner sc = new Scanner(System.in);
		int MAX = 10000000;
		boolean[] list = new boolean[MAX+1];
		Arrays.fill(list, true);
		int count=1;
		long[] sum = new long[10001];
		sum[0]=0;
		for(int i=2; i<=MAX; i++){
			if(list[i]){
				sum[count] = sum[count-1]+(long)i;
				count++;
				for(int j=i+i; j<=MAX; j+=i)	list[j]=false;
			}
			if(count>10000) break;
		}
		while(sc.hasNext()){
			int n=sc.nextInt();
			if(n==0)	System.exit(0);
			System.out.println(sum[n]);
		}
		
		
	}
	
	void AOJ0044(){
		Scanner sc = new Scanner(System.in);
		while(sc.hasNext()){
			int n=sc.nextInt();
			for(int i=n-1; i>1; i--){
				if(isPrime(i)){
					System.out.print(i+" ");
					break;
				}
			}
			for(int i=n+1; ; i++){
				if(isPrime(i)){
					System.out.println(i);
					break;
				}
			}
		}
	}
	
	void AOJ0009(){
		Scanner sc = new Scanner(System.in);
		while(sc.hasNext()){
			int n = sc.nextInt();
			int count=0;
			boolean[] prime = new boolean[n+1];
			Arrays.fill(prime, true);
			for(int i=2; i<=n; i++){
				if(prime[i]){
					count++;
					for(int j=i+i; j<=n; j+=i)	prime[j]=false;
				}
			}
			System.out.println(count);
		}
	}
	
	ArrayList<Integer> Sieve(int n){
	     ArrayList<Integer> prime = new ArrayList<Integer>();
	     if(n<2)	return prime;
	     boolean[] list = new boolean[n];
	     Arrays.fill(list, true);
	     list[1]=false;
	     for (int i=2; i<n; i++) {
	          if (list[i]) {
	               prime.add(i);
	               for (int j=i+i; j<n; j+=i)	list[j] = false;
	          }
	     }
	     return prime;
	}
	
	boolean isPrime(int n){
		for(int i=2; i*i<=n; i++){
			if(n%i==0)	return false;
		}
		return true;
	}

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

}

Measured memory_bytes: 0
#include <iostream>
#define N 20
using namespace std;
int n,k,s,C;
void Ess(int,int,int);
int main(){
  bool r;
  while(1){
    cin >> n >> k >> s;
    if(n==0&&k==0&&s==0) break;
    C=0;
    Ess(0,0,0);
    cout << C << endl;
  }
  return 0;
}
void Ess(int x,int sum,int cnt){
  if(n==x){
    if(cnt==k&&sum==s) C++;
    return ;
  }
  Ess(x+1,sum,cnt);
  Ess(x+1,sum+x+1,cnt+1);
  return ;
}

Measured memory_bytes: 1160
#include<stdio.h>
int main(void){
    long long x,k,ab;
    scanf("%lld %lld",&x,&k);
    x-=x/k*k;
    ab=x-k;
    if(ab<0){
        ab*=-1;
    }
    if(x<ab){
        printf("%lld\n",x);
    }else{
        printf("%lld\n",ab);
    }
    return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#include<stdio.h>
#include<string.h>
#include<algorithm>
using namespace std;
#define ll long long
#define INF  0x7fffffff//ffffffff
#define M 400100
ll a[M],n,k,ans,minx = INF;
int main(void){
	cin>>n>>k;;
	for(ll i = 1;i <= n;i++)
	cin>>a[i];
	sort(a+1,a+n+1);
	ll l = 1,r = k;
	while(r !=n+1){
		ans = a[r] - a[l];
		minx = min(ans,minx);
		l++;
		r++; 
	}
	cout<<minx<<endl;
}

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

struct LinkCutTree {
  struct Node {
    Node *l, *r, *p;
    int val;
    int sum;
    int size = 1;
    Node(int val) : val(val), sum(val), l(nullptr), r(nullptr), p(nullptr) {}
    bool is_root() {
      return !p || (p->l != this && p->r != this);
    }
  };
  Node *make_node(int val) {
    return new Node(val);
  }
  void update(Node *t) {
    t->size = 1;
    t->sum = t->val;
    if (t->l) t->size += t->l->size, t->sum += t->l->sum;
    if (t->r) t->size += t->r->size, t->sum += t->r->sum;
  }
  void rotr(Node *t) {
    auto *x = t->p, *y = x->p;
    if ((x->l = t->r)) t->r->p = x;
    t->r = x, x->p = t;
    update(x), update(t);
    if ((t->p = y)) {
      if (y->l == x) y->l = t;
      if (y->r == x) y->r = t;
      update(y);
    }
  }
  void rotl(Node *t) {
    auto *x = t->p, *y = x->p;
    if ((x->r = t->l)) t->l->p = x;
    t->l = x, x->p = t;
    update(x), update(t);
    if ((t->p = y)) {
      if (y->l == x) y->l = t;
      if (y->r == x) y->r = t;
      update(y);
    }
  }
  void splay(Node *t) {
    while (!t->is_root()) {
      auto *p = t->p;
      if (p->is_root()) {
        if (p->l == t) rotr(t);
        else rotl(t);
        continue;
      }
      auto *q = p->p;
      if (q->l == p) {
        if (p->l == t) rotr(p), rotr(t);
        else rotl(t), rotr(t);
      } else {
        if (p->r == t) rotl(p), rotl(t);
        else rotr(t), rotl(t);
      }
    }
  }
  void expose(Node *t) {
    Node *rp = nullptr;
    for (auto *cur = t; cur; cur = cur->p) {
      splay(cur);
      cur->r = rp;
      update(cur);
      rp = cur;
    }
    splay(t);
  }
  void link(Node *child, Node *parent) {
    expose(child);
    expose(parent);
    child->p = parent;
    parent->r = child;
  }
  void cut(Node *child) {
    expose(child);
    auto *parent = child->l;
    child->l = nullptr;
    parent->p = nullptr;
  }
};

using i64 = long long;

int main() {
  int N; cin >> N;
  LinkCutTree lct;
  vector<LinkCutTree::Node *> nodes(N);
  for (int i = 0; i < N; i++) {
    nodes[i] = lct.make_node(0);
  }
  for (int i = 0; i < N; i++) {
    int k; cin >> k;
    for (int j = 0; j < k; j++) {
      int u; cin >> u;
      lct.link(nodes[u], nodes[i]);
    }
  }
  int Q; cin >> Q;
  for (int i = 0; i < Q; i++) {
    int q; cin >> q;
    if (q == 0) {
      int v, w; cin >> v >> w;
      lct.expose(nodes[v]);
      nodes[v]->val += w;
      lct.update(nodes[v]);
    } else {
      int u; cin >> u;
      lct.expose(nodes[u]);
      cout << nodes[u]->sum << '\n';
    }
  }
  return 0;
}



Measured memory_bytes: 8376
inpl = lambda: list(map(int,input().split()))
N, T = inpl()
ct = []
for _ in range(N):
  ct.append(inpl())

ct = sorted(list(filter(lambda x: x[1] <= T,ct)))
if len(ct) == 0:
  print('TLE')
else:
  print(ct[0][0])

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

int main() {
    string s;
    cin >> s;
    if (s[2] == s[3] && s[4] == s[5]) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
//raja1999

//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,avx,avx2")

#include <bits/stdc++.h>
#include <vector>
#include <set>
#include <map>
#include <string> 
#include <cstdio>
#include <cstdlib>
#include <climits>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <iomanip> 
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
//setbase - cout << setbase (16)a; cout << 100 << endl; Prints 64
//setfill -   cout << setfill ('x') << setw (5); cout << 77 <<endl;prints xxx77
//setprecision - cout << setprecision (14) << f << endl; Prints x.xxxx
//cout.precision(x)  cout<<fixed<<val;  // prints x digits after decimal in val

using namespace std;
using namespace __gnu_pbds;
#define f(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) f(i,0,n)
#define fd(i,a,b) for(i=a;i>=b;i--)
#define pb push_back
#define mp make_pair
#define vi vector< int >
#define vl vector< ll >
#define ss second
#define ff first
#define ll long long
#define pii pair< int,int >
#define pll pair< ll,ll >
#define sz(a) a.size()
#define inf (1000*1000*1000+5)
#define all(a) a.begin(),a.end()
#define tri pair<int,pii>
#define vii vector<pii>
#define vll vector<pll>
#define viii vector<tri>
#define mod (1000*1000*1000+7)
#define pqueue priority_queue< int >
#define pdqueue priority_queue< int,vi ,greater< int > >
//#define int ll

typedef tree<
int,
null_type,
less<int>,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;


//std::ios::sync_with_stdio(false);
int arr[15],a[15][15],c[15];
int main(){
	std::ios::sync_with_stdio(false); cin.tie(NULL);
	int n,m,x,s=0,ans=inf,i,j,k,val;
	cin>>n>>m>>x;
	rep(i,n){
		cin>>c[i];
		rep(j,m){
			cin>>a[i][j];
		}
	}
	val=(1<<n);
	rep(i,val){
		s=0;
		rep(j,m){
			arr[j]=0;
		}
		rep(j,n){
			if(i&(1<<j)){
				s+=c[j];
				rep(k,m){
					arr[k]+=a[j][k];
				}
			}
		}
		rep(j,m){
			if(arr[j]<x){
				break;
			}
		}
		if(j==m){
			ans=min(ans,s);
		}
	}
	if(ans==inf){
		ans=-1;
	}
	cout<<ans<<endl;
	return 0;
} 


Measured memory_bytes: 3640
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
#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())
using namespace std;

using ll = long long;

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 = 1e9;
const long long INFL = 1LL<<60;

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

  int n; cin >> n;
  vector<vector<int>> a(n, vector<int>(n));
  rep(i, n) rep(j, n) cin >> a[i][j];

  vector<vector<int>> b(n, vector<int>(n, 0));
  rep(i, n) {
    auto v = a[i];
    int mi = MIN(v);
    for (int j = 0; j < n; j++) {
      if (v[j] == mi) {
        b[i][j] = a[i][j];
        b[j][i] = a[j][i];
      }
    }
  }

  rep(s, n) {
    rep(t, n) {
      bool con = true;
      rep(k, n) {
        if (k == s || k == t) continue;
        if (a[s][k] + a[k][t] < a[s][t]) {
          cout << "-1" << endl;
          return 0;
        } else if (a[s][k] + a[k][t] == a[s][t]) {
          con = false;
        }
      }
      if (con) {
        b[s][t] = a[s][t];
        b[t][s] = a[t][s];
      }
    }
  }

  ll ans = 0;
  for (int i = 0; i < n; i++) {
    for (int j = i; j < n; j++) {
      ans += b[i][j];
    }
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 1024
package main

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

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
	
	N := ScanInt(scanner)
	X := make([]int, N)
	Y := make([]int, N)
	for i := 0; i < N; i++ {
	    X[i] = ScanInt(scanner)
	    Y[i] = X[i]
	}
	
	sort.Sort(sort.IntSlice(Y))
	m1 := Y[N / 2 - 1]
	m2 := Y[N / 2]
	for i := 0; i < N; i++ {
	    if X[i] <= m1 {
	        fmt.Println(m2)
	    } else {
	        fmt.Println(m1)
	    }
	}
	
}

func ScanInt(scanner *bufio.Scanner) int {
	scanner.Scan()
	i, e := strconv.Atoi(scanner.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func ScanFloat64(scanner *bufio.Scanner) float64 {
	scanner.Scan()
	f, e := strconv.ParseFloat(scanner.Text(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

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

func Max(a, b int) int {
	if a < b {
		return b
	}
	return a
}

func Min(a, b int) int {
	if a > b {
		return b
	}
	return a
}

func Abs(a int) int {
	if a < 0 {
		a *= -1
	}
	return a
}

Measured memory_bytes: 8832
h, w = gets.split.map(&:to_i)
hs = []
h.times{ hs << gets.chomp.split("") }
def del_same_line(target_ary)
  target_ary.reject{|e| !e.include?('#') }.transpose
end
del_same_line(del_same_line(hs)).each{|e| puts e.inject(:+)}

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

int main(){
  int N;
  cin>>N;
  long long A[N];
  for (int i=0;i<N;i++){
    cin>>A[i];
  }
  sort(A,A+N);
  for (int i=0;i<N-1;i++){
    if(A[i]==A[i+1]){
        cout<<"NO"<<endl;
        return 0;
      }
  }
  cout<<"YES"<<endl;
  return 0;
}



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


int main()
{

  int sx,sy,tx,ty;
  cin>>sx>>sy>>tx>>ty;
  int dx=abs(sx-tx);
  int dy=abs(sy-ty);
  cout<<string(dx,'R')<<string(dy,'U');
  cout<<string(dx,'L')<<string(dy,'D');
  cout<<'L'<<string(dy+1,'U')<<string(dx+1,'R')<<'D';
  cout<<'R'<<string(dy+1,'D')<<string(dx+1,'L')<<'U';
  cout<<endl;
  return 0;

}


Measured memory_bytes: 3552
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) FOR(i,0,n)
#define repr(i,n) for(int i=(n)-1;0<=i;--i)
#define each(e,v) for(auto&& e:(v))
#define all(v) begin(v),end(v)
#define dump(x) cerr<<#x<<": "<<(x)<<endl
using namespace std;
using vint = vector<int>;
using ll = long long;
using vll = vector<ll>;
template <class T> void chmin(T& a, const T& b) { a = min(a, b); }
template <class T> void chmax(T& a, const T& b) { a = max(a, b); }

constexpr int N = 100005;
constexpr int sqN = sqrt(N) + 1;
bool table[N];
int cum[N];

void sieve() {
    fill_n(table, N, true);
    fill_n(cum, N, 0);
    table[1] = false;
    rep(i, N/2) table[2*i] = false;
    table[2] = true;
    for(int d = 3; d < sqN; d += 2) {
        if(!table[d]) continue;
        for(int i = d + d; i < N; i += d) {
            table[i] = false;
        }
    }
    rep(i, N) if(table[i] && table[(i+1)/2]) cum[i] = 1;
    FOR(i, 1, N) cum[i] += cum[i-1];
}

int main() {
    sieve();
    int q; cin >> q;
    rep(i, q) {
        int l, r; cin >> l >> r;
        cout << (cum[r] - cum[l-1]) << endl;
    }
    return 0;
}


Measured memory_bytes: 1152
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <climits>
#include <ctime>
#include <cassert>
using namespace std;

#define rep(i,a,n) for(int i=a; i<n; i++)
#define repr(i,a,n) for(int i=a; i>=n; i--)
#define pb(a) push_back(a)
#define fr first
#define sc second
#define INF 999999999

#define X real()
#define Y imag()
#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) ( EQ((a).X, (b).X) && EQ((a).Y, (b).Y) )
#define LE(n, m) ((n) < (m) + EPS)
#define GE(n, m) ((n) + EPS > (m))

typedef vector<int> VI;
typedef vector<VI> MAT;
typedef pair<int, int> pii;
typedef long long int ll;

typedef complex<double> P;
typedef pair<P, P> L;
typedef pair<P, double> C;

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

namespace std {
    bool operator<(const P a, const P b) {
        return a.X != b.X ? a.X < b.X : a.Y < b.Y;
    }
}

// 2???????????????????????????????±???????
double dot(P a, P b) {
    return (a.X * b.X + a.Y * b.Y);
}

// 2???????????????????????????????±???????
double cross(P a, P b) {
    return (a.X * b.Y - a.Y * b.X);
}

double area(const vector<P> &ps) {
    double a = 0;
    rep(i,0,ps.size()) a += cross(ps[i], ps[(i+1) % ps.size()]);
    return a / 2;
}

int main() {
    int n; P p; vector<P> array;
    cin >> n;
    rep(i,0,n) {
        cin >> p.X >> p.Y;
        array.pb(p);
    }
    printf("%.1f\n", area(array));
    return 0;
}

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

int main(){
    int n ;
    int arr[101] ;
cin >> n ;
for(int i =0; i<n ; i++){
   cin >> arr[i] ;

}
sort(arr,arr+n) ;
printf("%d",arr[n-1]-arr[0]);
return 0 ;
}


Measured memory_bytes: 256
let split str delim =
  let open String in
  let rec doit s acc =
    match
      try Some (rindex s delim) with _ -> None
    with
    | None -> s :: acc
    | Some i -> doit (sub s 0 i) (sub s (i + 1) (length s - i - 1) :: acc)
  in doit str []

let () =
  match List.map int_of_string (split (read_line ()) ' ') with
  | [n; k] -> begin
      let a = Array.init n (fun _ -> read_int ()) in
      let rec check p =
        let rec doit i j s =
          if i = n then n
          else if j >= k then i
          else
            let x = s + a.(i) in
            if x > p then doit i (j + 1) 0
            else doit (i + 1) j x
        in doit 0 0 0
      and bin_search l r =
        if r < l then l
        else
          let m = (l + r) / 2 in
          if check m >= n then bin_search l (m - 1)
          else bin_search (m + 1) r
      in Printf.printf "%d\n" (bin_search 0 (100000 * 10000))
    end
  | _ -> exit 1

Measured memory_bytes: 5236
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<map>
#include<set>
#include<bitset>
using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;
int dx[4]={1,0,-1,0} , dy[4]={0,1,0,-1} ;

int main(){
    int n,k;
    cin>>n>>k;
    cout<<((n%k)>0)<<endl;
    return 0;
}

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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void Main() {
    string s; cin >> s;
    ll cnt = 0;
    rep(i, s.size()){if (s[i] == 'p'){cnt++;}}
    cout << s.size() / 2 - cnt << endl;
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}


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

#define en "\n"
#define INF (int) 9e18
#define HELL (int) (1e9 + 7)
#define int long long
#define double long double
#define uint unsigned long long
#define pii pair<int, int>
#define pb push_back
#define fs first
#define sc second
#define size(a) (int) a.size()
#define deb(x) cerr << #x << " => " << x << en
#define deba(x) cerr << #x << en; for (auto a : x) cerr << a << " "; cerr << en;
#define debp(x) cerr << #x << en; for (auto a : x)cerr<<"("<<a.fs<<", "<<a.sc<<") "; cerr << en;
#define debm(x) cerr << #x << en; for (auto a : x){for(auto b : a) cerr << b << " "; cerr << en;}
#define getMat(x, n, m, val) vector<vector<int>> x(n, vector<int> (m, val))
#define fastio ios_base :: sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
#define pout cout << fixed << setprecision(10)
int fastpow(int a, int b, int m = HELL) { int res = 1; a %= m;
while (b > 0) { if (b & 1) res = (res * a) % m; a = (a * a) % m; b >>= 1; } return res;}
#define inv(a) fastpow(a, HELL - 2)
#define mul(a, b) ((a % HELL) * (b % HELL)) % HELL

int32_t main() { fastio;
	int n; cin >> n;
	vector<int> arr(n);
	map<int, int> m;
	int count = 0;
	for (int i = 0; i < n; i++) {
		cin >> arr[i];
		count += m[i - arr[i]];
		m[i + arr[i]]++;
	}
	cout << count << endl;
	return 0;
}


Measured memory_bytes: 27464
#include<bits/stdc++.h>
#include<iomanip>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define yesno(flg) if(flg){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define MAX_N 1002
#define i197 1000000007

using namespace std;

typedef long long ll;
typedef pair<ll,ll> P1;
typedef pair<string,int> Pi;
typedef pair<double,Pi> Pdi;
typedef pair<ll,int>Pli;
typedef pair<Pi,int> P2;
const ll INF=1000000000000000001;
struct edge{int to,cost;};
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
struct Road{double cost;int a,b;};


int main() {

	char c1,c2,c3,c4;

	cin>>c1>>c2>>c3>>c4;

	if(c1==c2||c2==c3){
		cout<<"Bad"<<endl;
	}else if(c3==c4){
		cout<<"Bad"<<endl;
	}else{
		cout<<"Good"<<endl;
	}

	return 0;

}


Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <algorithm>
#include <string>
#include <vector> 
#include <numeric>
#include <cmath>
#include <queue>
#include <iomanip>
#include <functional>


#define CHMAX(a,b) a = std::max(a,b)
#define CHMIN(a,b) a = std::min(a,b)
#define MAXMIN(a,b,c) std::max(a,min(b,c))
#define CHABS(a) a = std::abs(a) 
#define COUT(a) std::cout << a << std::endl
#define CERR(a) std::cerr << a << std::endl
#define FOR(n) for(lli i = 0; i < n; i++)

using namespace std;
using lli = long long int;
using pll = pair<lli, lli>;
using tlll = tuple<lli, lli, lli>;
using vll = vector<lli>;

lli mod197 = 1000000007LL;
lli INF = 10000000000000;

// ax + by = gcd(a,b) 最大公約数
template< typename T >
T extgcd(T a, T b, T& x, T& y) {
	T d = a;
	if (b != 0) {
		d = extgcd(b, a % b, y, x);
		y -= (a / b) * x;
	}
	else {
		x = 1;
		y = 0;
	}

	return d;
}

lli ca[12][100001] = {};
lli check[100000] = {};

int main(void) {

	lli n, m, x;
	cin >> n >> m >> x;

	for (int i = 0; i < n; i++) {
		for (int j = 0; j < m + 1; j++) {
			cin >> ca[i][j];
		}
	}

	lli ans = INF;
	for (int k = 0; k < (1 << n); k++) {

		lli sum = 0;

		for (int j = 0; j < m; j++) {
			check[j] = 0;
		}

		for (int i = 0; i < n; i++) {
			if ((k >> i) & 1) {
				sum += ca[i][0];
				for (int j = 1; j < m + 1; j++) {
					check[j - 1] += ca[i][j];
				}
			}
		}

		bool f = true;

		for (int j = 0; j < m; j++) {
			if (check[j] < x) {
				f = false;
			}
		}

		if (f) {
			ans = min(ans, sum);
		}
	}

	if (ans == INF) {
		cout << -1 << endl;
	}
	else {
		cout << ans << endl;
	}


	return 0;
}

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

using namespace std;

int const maxsize = 100005;

int weight[maxsize], cost[maxsize];
long long int dp[103][maxsize];

long long int getans(int n, int ind, int cw, int w){
	if(cw < 0) return INT_MIN;
	if(cw == 0) return 0;
	if(ind == n) return 0;
	if(dp[ind][cw] != -1) return dp[ind][cw];
	long long int ans = max(getans(n, ind+1, cw, w), getans(n, ind+1, cw - weight[ind], w) + cost[ind]);
	dp[ind][cw] = ans;
	return ans;
}

int main(){
	int n, w;
	cin>>n>>w;
	for(int x=0;x<n;x++) cin>>weight[x]>>cost[x];
	for(int x=0;x<=100;x++){
		for(int i=0;i<maxsize;i++){
			dp[x][i] = -1;
		}
	}
	cout<<getans(n, 0, w, w);
	return 0;
}

Measured memory_bytes: 80128
#include <iostream>
#include <cstring>
#include <queue>
#include <algorithm>
#include <cstdlib>
using namespace std;

int top[230][230];
int h[230][230];
int Rotation[4][6]={
	{3,0,2,5,4,1},
	{4,1,0,3,5,2},
	{1,5,2,0,4,3},
	{2,1,5,3,0,4}
};
struct P{int x,y;} d[4]={
{1,0},
{0,1},
{-1,0},
{0,-1}
};
main(){
	int i,j,n,t,f,x,y;
	while(cin>>n,n){
		memset(top, 0, sizeof(top));
		memset(h, 0, sizeof(h));
		while(n--){
			cin >> t >> f;
			int tD[6], D[6]={1,5,4,2,3,6};
			while(D[0] != t || D[4] != f){
			//	printf("%d, %d, %d, %d\n", t, f, D[0], D[4]);
				memcpy(tD, D, sizeof(D));
				int r = rand();
				for(i=0;i<6;i++){
					D[Rotation[r%4][i]] = tD[i];
				}
			}
			x = 100;
			y = 100;
			while(h[x][y] != 0){
				int dt = -1;
				for(j=6;j>3;j--){
					for(i=1;i<5;i++) if(D[i] == j) break;
					if(i == 5) continue;
//					printf("%d (%d,%d)=%d (%d,%d)=%d\n", i, x+d[i-1].x, y+d[i-1].y, h[x+d[i-1].x][y+d[i-1].y], x, y, h[x][y]);
					if(h[x+d[i-1].x][y+d[i-1].y] >= h[x][y]) continue;
					dt = i-1;
					break;
				}
				if(dt < 0) break;
				x += d[dt].x;
				y += d[dt].y;
				memcpy(tD, D, sizeof(D));
				for(i=0;i<6;i++){
					D[i] = tD[Rotation[dt][i]];
				}
			}
//			printf("x%d y%d %d %d %d %d %d %d\n", x, y, D[0], D[1], D[2], D[3], D[4], D[5]);
			h[x][y] ++;
			top[x][y] = D[0];
		}
		int sum[7]={0};
		for(i=0;i<=200;i++)
		for(j=0;j<=200;j++)
			sum[top[i][j]] ++;
		cout << sum[1] << ' ' << sum[2] << ' ' << sum[3] << ' ' << sum[4] << ' ' << sum[5] << ' ' << sum[6] << endl;	
	}
	
	return 0;
}

Measured memory_bytes: 1284
#pragma once
#include <stdio.h>
#include <string>
#include <iostream>
#include <queue>
#include <algorithm>
#include <sstream>
#include <vector>
#include <math.h>
#include <set>

using namespace std;

long long N,M,K,re,C,CC;
long long A[200001];
bool f;
string S;
set <long long>sll;
vector <long long>vl;
vector <long long>vll;


int main() {
	cin >>N;
	re = 0;
	f = false;
	M = 10;
	for (int i = 0; i < 6; i++) {
		if (N == M) {
			f = true;
		}
		M *= 10;
	}

	if (f == false) {
		while (N > 0) {
			re += N % 10;
			N /= 10;
		}
	}
	else {
		re = 10;
	}

	
	cout << re << endl;

	return 0;
}


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

int main(){
    string s;
    cin>>s;

    int cnt=0;
    if(s[0]=='1'){
        cnt++;
    }
    if(s[1]=='1'){
        cnt++;
    }
    if(s[2]=='1'){
        cnt++;
    }
    cout<<cnt;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
#define show(x) {for(auto i: x){cout << i << " ";} cout << endl;}
using namespace std;
using ll = long long;
using P = pair<int, int>;

const int MOD = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%MOD+MOD)%MOD){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= MOD) x -= MOD;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += MOD-a.x) >= MOD) x -= MOD;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= MOD; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime MOD
  mint inv() const { return pow(MOD-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}
// combination MOD prime
struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < MOD);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
  mint p(int n, int k) {
    return fact[n]*ifact[n-k];
  }
} c(10000007);
// c(5, 2) → 10, c.p(5, 2) → 20, c.fac[4] → 24

int main() {
  // 非負と負でカテゴリー分け、積が0以上になるかどうか
  // 積が正になる時負の数は2つずつとる
  int N, K;
  cin >> N >> K;
  vector<int> A(N);
  rep(i, N) cin >> A[i];
  sort(A.rbegin(), A.rend());
  vector<ll> pos; // 0を含む
  vector<ll> neg;
  rep(i, N) {
    if (A[i] < 0) neg.push_back(A[i]);
    else pos.push_back(A[i]);
  }
  int lenP = sz(pos);
  int lenN = sz(neg);
  bool bl = false; // 積を正に出来るならtrue
  if (lenP > 0) {
    if (N==K) bl = (lenN%2 == 0);
    else bl = true;
  } else {
    // 負の数のみ
    bl = (K%2 == 0);
  }
  mint ans = 1;
  //cout << "bl " << bl << '\n';
  if (bl) {
    vector<ll> cand;
    int cur = 0;
    if (K&1) {
      ans = pos[0];
      cur = 1;
      K--;
    }
    for (int i = cur; i < min(K+1
                              , lenP); i++) {
      if ((i-cur)&1 || i+1 == lenP) continue;
      cand.push_back(pos[i] * pos[i+1]);
    }
    sort(neg.begin(), neg.end());
    for (int i = 0; i < min(K, lenN); i++) {
      if (i&1 || i+1 == lenN) continue;
      cand.push_back(neg[i] * neg[i+1]);
    }
    sort(cand.rbegin(), cand.rend());
    K /= 2;
    rep(i, K) ans *= cand[i] % MOD;
  } else {
    rep(i, K) ans *= A[i];
  }
  cout << ans << '\n';
  return 0;
}


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

vector<int> sim(vector<int> vec,int n){
    vector<int> new_vec(n,0);
    rep(i,n){
        int l = max(0,i-vec[i]);
        int r = min(n-1,i+vec[i]);
        new_vec[l]++;
        if(r+1<n) new_vec[r+1]--;
    }
    REP(i,n-1) new_vec[i]+=new_vec[i-1];
    return new_vec;
}


int main(){
    int n,k;
    cin>>n>>k;
    vector<int> vec(n);
    rep(i,n) cin>>vec[i];

    int lim = min(k,50);

    rep(i,lim){
       vec =  sim(vec,n);
    }

    rep(i,n){
        cout<<vec[i]<<" ";
    }
    cout<<endl;

    return 0;
}

Measured memory_bytes: 5552
package main

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

func main() {
    N := nextInt()
    dp := make([][3]int, N)

    a := nextInt()
    b := nextInt()
    c := nextInt()
    dp[0] = [3]int{a, b, c}

    for i := 1; i < N; i++ {
        a = nextInt()
        b = nextInt()
        c = nextInt()
        dp[i] = [3]int{max(dp[i-1][1], dp[i-1][2])+a, max(dp[i-1][0], dp[i-1][2])+b, max(dp[i-1][0], dp[i-1][1])+c}
    }

    fmt.Println(max(dp[N-1][0], dp[N-1][1], dp[N-1][2]))
}

func max(a int, b ...int) int {
    l := len(b)
    for i := 0; i < l; i++ {
        if a < b[i] {
            a = b[i]
        }
    }

    return a
}

var stdin = initStdin()

func initStdin() *bufio.Scanner {
    bufsize := 1 * 1024 * 1024 // 1 MB
    var stdin = bufio.NewScanner(os.Stdin)
    stdin.Buffer(make([]byte, bufsize), bufsize)
    stdin.Split(bufio.ScanWords)
    return stdin
}

func nextString() string {
    stdin.Scan()
    return stdin.Text()
}

func nextBytes() []byte {
    stdin.Scan()
    return stdin.Bytes()
}

func nextInt() int {
    i, _ := strconv.Atoi(nextString())
    return i
}

func nextInt64() int64 {
    i, _ := strconv.ParseInt(nextString(), 10, 64)
    return i
}


Measured memory_bytes: 5120
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt(), a = sc.nextInt(), b = sc.nextInt();
		sc.close();
		int ans = x - a;
		int tmp = ans / b;
		ans -= b * tmp;
		System.out.println(ans);
	}

}


Measured memory_bytes: 22868
#include <iostream>
#include <cmath>
#include <vector>
#include <bitset>
#include <algorithm>
#include <stack>
#include <queue>
#include <map>
#include <climits>
#include <set>
#include <map>
#include <iomanip>
#include <cassert>
#include <functional>
#include <cstring>

using namespace std;

#define mp make_pair
#define FOR(i, a, b) for(int (i)=a;(i)<=(b);++(i))
#define rep(i, n)  FOR(i,0,n-1)
#define FFOR(i, a, b) for(int (i)=a;(i)>(b);--(i))
#define rrep(i,n) FFOR(i,0,n)
#define vsort(v) sort((v).begin(), (v).end());					//小さい順
#define rvsort(v) sort(v.begin(), v.end(),greater<>());		//大きい順
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define all(c) (c).begin(),(c).end()
#define ll long long
#define lb long double
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define vs vector<string>
#define vc vector<char>
#define vvc vector<vector<char>>
#define Print(p) cout<<(p)<<endl
#define F first
#define S second
#define pb push_back
#define ll long long
#define mod 1000000007LL
#define INF 123456789012345
typedef pair<ll, ll> P;
typedef pair<int, P> PP;

const int maxn =1e5 + 10;

vector<P> red,blue;

int main(){
	int n;cin>>n;

	rep(i,n)
	{
		int a,b;cin>>a>>b;
		red.pb(mp(a,b));
	}

	rep(i,n)
	{
		int c,d;cin>>c>>d;
		blue.pb(mp(c,d));
	}

	vsort(red);
	vsort(blue);

	int ans = 0;
	bool check[105];
	rep(i,n) check[i] = false;
	cout << endl;
	rep(i,n)
	{
		int bx=blue[i].first;
		int by=blue[i].second;
		int my = -5;
		int label=-1;
		rep(j,n) 
		{
			int rx=red[j].first;
			int ry=red[j].second;
			if(rx >= bx || ry>=by)continue;
			if(my<=ry && check[j]==false)
			{
				my = ry;
				label=j;
			}
		}
		if(label==-1)continue;
		check[label]=true;
		ans++;
	}

	cout << ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
//----***やべーやつら***----
using namespace std;
#define int long long

//----***型定義***----
using ll = long long;
using pll = pair<ll, ll>;
using pdd = pair<double, double>;
typedef long double lb;
typedef long double ld;
typedef pair<int,int> P;

//----***Like a Pythonista***----
#define REP(ii,jj,nn) for (ll ii=jj;ii<(nn);ii++)
#define RREP(ii,nn,jj) for (ll ii = nn; jj<ii;ii--)
#define each(i,...) for (auto&& i:__VA_ARGS__)
#define ALL(vec) (vec).begin(),(vec).end()
#define sum(...) accumulate(ALL(__VA_ARGS__),0LL)
#define dsum(...) accumulate(ALL(__VA_ARGS__),0.0L)
#define vec(type,name,...) vector<type> name(__VA_ARGS__)
template<class T> inline auto max(const T& a){ return *max_element(ALL(a)); }
template<class T> inline auto min(const T& a){ return *min_element(ALL(a)); }
inline ll gcd(ll a,ll b){if(b == 0) return a;return  gcd(b,a%b);}
inline ll lcm(ll a,ll b){ll g = gcd(a,b);return a / g * b;}

//----***定数***----
#define MOD 1e9+7;
#define INF 1e9;
#define EPS 1e-9;

//----***入出力***---
#define print(out) cout<< out  << "\n";
#define debug(var)  do{std::cerr << #var << " ↓ "<<"\n";view(var);}while(0);
#define dbg cerr<<"🥺🥺🥺🥺🥺🥺"<<endl;
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }

//----***初期時読み込み***----
struct initial{initial(){cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);};}initial_;


signed main(){
  int H,W;cin>>H>>W;
  if(H%3==0||W%3==0){
    print(0)
    return 0;
  }
  int ans=100000000000;
  int S1,S2,S3;
  REP(h,1,H){
    S1=h*W;
    S2=((H-h)/2)*W;
    // debug(S1)
    // debug(S2)
    ans=min(ans,max(abs(S1-S2),abs(2*S1-W*H+S2)));
    S2=(W/2)*(H-h);
    // debug(S2)
    ans=min(ans,max(abs(S1-S2),abs(2*S1-W*H+S2)));
  }
  REP(w,1,W){
    S1=w*H;
    S2=((W-w)/2)*H;
    ans=min(ans,max(abs(S1-S2),abs(2*S1-W*H+S2)));
    S2=(H/2)*(W-w);
    ans=min(ans,max(abs(S1-S2),abs(2*S1-W*H+S2)));
  }
  print(ans)


}


Measured memory_bytes: 384
#include <iostream>
#include <iomanip>
#define _USE_MATH_DEFINES
#include <math.h>

using namespace std;
void swap(int &a, int &b);

int main()
{
	int in_r, in_c;
	cin >> in_r >> in_c;
	int out_r = in_r + 1;
	int out_c = in_c + 1;

	int **InSeet, **OutSeet;
	//! Input Definition
	InSeet = new int*[in_r];
	for (int i = 0; i < in_r; ++i)
		InSeet[i] = new int[in_c];
	//! Output Definition
	OutSeet = new int*[in_r]();
	for (int i = 0; i < out_r; ++i)
		OutSeet[i] = new int[out_c]();

	//! Data Loading..
	for (int i = 0; i < in_r; ++i)
	{
		for (int j = 0; j < in_c; ++j)
		{
			cin >> InSeet[i][j];
			OutSeet[i][j] = InSeet[i][j];
		}
	}
	
	for (int i = 0; i < in_r; ++i)
	{
		for (int j = 0; j < in_c; ++j)
		{
			OutSeet[i][in_c] += InSeet[i][j];
			OutSeet[in_r][j] += InSeet[i][j];
		}
		OutSeet[in_r][in_c] += OutSeet[i][in_c];
	}

	for (int i = 0; i < out_r; ++i)
	{
		for (int j = 0; j < out_c; ++j)
		{
			cout << OutSeet[i][j];
			if (j != out_c - 1)
				cout << " ";
		}
		cout << endl;
	}


	return 0;
}




Measured memory_bytes: 3136
//#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<ll,ll> pll;
#define mp make_pair
#define f first
#define s second
#define pb push_back

const int N = 1000 + 5;
const ll OO = 1e18;

int x,y,z,k;
ll a[N],b[N],c[N],sum;
map<tuple<int,int,int>, int> vis;
priority_queue<tuple<ll,int,int,int> > pq;

void init() {



}

int main() {

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

cin >> x >> y >> z >> k;

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

    cin >> a[i];

}

sort(a,a+x);

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

    cin >> b[i];

}

sort(b,b+y);

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

    cin >> c[i];

}

sort(c,c+z);

int curX = x-1, curY = y-1, curZ = z-1;
sum = a[curX]+b[curY]+c[curZ];
pq.emplace(sum,curX,curY,curZ);

while(k--) {

    tuple<ll,int,int,int> cur = pq.top();
    pq.pop();

    curX = get<1>(cur);
    curY = get<2>(cur);
    curZ = get<3>(cur);

    if(vis[make_tuple(curX,curY,curZ)]) {
        ++k;
        continue;
    }

    vis[make_tuple(get<1>(cur),get<2>(cur),get<3>(cur))] = 1;

    cout << get<0>(cur) << '\n';

    if(curX>0 && !vis[make_tuple(curX-1,curY,curZ)]) {

        pq.emplace(a[curX-1]+b[curY]+c[curZ],curX-1,curY,curZ);

    }

    if(curY>0 && !vis[make_tuple(curX,curY-1,curZ)]) {

        pq.emplace(a[curX]+b[curY-1]+c[curZ],curX,curY-1,curZ);

    }

    if(curZ>0 && !vis[make_tuple(curX,curY,curZ-1)]) {

        pq.emplace(a[curX]+b[curY]+c[curZ-1],curX,curY,curZ-1);

    }

}

return 0;

}

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

namespace Practice
{
    class Program
    {
        static void Main(string[] args)
        {
            Solve();
        }
        private const long MOD = 1000000007;
        
        static void Solve()
        {
            int n = ReadAndParseInt();

            var primeTable = new long[n + 1];

            for(int i=1;i<=n;++i)
            {
                CalcPrimes(i, primeTable);
            }

            long ans = 1;
            for(int i=2;i<primeTable.Length;++i)
            {
                long total = primeTable[i];
                if( total == 0) { continue; }
                ans = ans * (total + 1) % MOD;
            }
            Console.WriteLine(ans);
        }
        private static void CalcPrimes(int n, long[] primeTable)
        {
            int m = n;
            for(int i=2;i*i<=n;++i)
            {
                while (m % i == 0)
                {
                    m /= i;
                    primeTable[i]++;
                }
            }
            primeTable[m]++;
        }

        #region よく使う便利関数
        private static bool isPrime(long x)
        {
            if (x == 2) { return true; }
            if (x < 2 || x % 2 == 0) { return false; }
            long i = 3;
            while (i * i <= x)
            {
                if (x % i == 0) { return false; }
                i = i + 2;
            }
            return true;
        }
        private static long lcm(long x, long y)
        {
            return x / gcd(x, y) * y;
        }
        private static long gcd(long x, long y)
        {
            return y > 0 ? gcd(y, x % y) : x;
        }
        private static long pow(long x, long n)
        {
            if (n == 0) { return 1; }
            long res = pow(x * x % MOD, n / 2);
            if (n % 2 == 1)
            {
                res = res * x % MOD;
            }
            return res;
        }
        private static int ReadAndParseInt()
        {
            return int.Parse(Console.ReadLine());
        }
        private static int[] ReadAndParseIntArr()
        {
            return Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
        }
        private static long ReadAndParseLong()
        {
            return long.Parse(Console.ReadLine());
        }
        private static long[] ReadAndParseLongArr()
        {
            return Array.ConvertAll(Console.ReadLine().Split(' '), long.Parse);
        }
        #endregion
    }
}

Measured memory_bytes: 11092