akhauriyash/Code-Regression huggingface dataset:
/*
このコード、と～おれ!
Be accepted!
∧＿∧　
（｡･ω･｡)つ━☆・*。
⊂　　 ノ 　　　・゜+.
　しーＪ　　　°。+ *´¨)
 　　　　　　　　　.· ´¸.·*´¨) ¸.·*¨)
		  　　　　　　　　　　(¸.·´ (¸.·'* ☆
*/

#include <cstdio>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstring>
#include <vector>
#include <numeric>
#include <iostream>
#include <random>
#include <map>
#include <unordered_map>
#include <queue>
#include <regex>
#include <functional>
#include <complex>
#include <list>
#include <cassert>
#include <iomanip>
#include <set>
#include <stack>
/*多倍長整数/cpp_intで宣言
#include <boost/multiprecision/cpp_int.hpp>
using namespace boost::multiprecision;
*/

//#pragma gcc target ("avx2")
//#pragma gcc optimization ("o3")
//#pragma gcc optimization ("unroll-loops")
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define rep1(i, n) for(int i = 1; i <= (n); ++i)
#define rep2(i, n) for(int i = 2; i < (n); ++i)
#define repr(i, n) for(int i = n; i >= 0; --i)
#define reprm(i, n) for(int i = n - 1; i >= 0; --i)
#define printynl(a) printf(a ? "yes\n" : "no\n")
#define printyn(a) printf(a ? "Yes\n" : "No\n")
#define printYN(a) printf(a ? "YES\n" : "NO\n")
#define printim(a) printf(a ? "possible\n" : "imposible\n")
#define printdb(a) printf("%.50lf\n", a) //少数出力
#define printLdb(a) printf("%.50Lf\n", a) //少数出力
#define printdbd(a) printf("%.16lf\n", a) //少数出力(桁少なめ)
#define prints(s) printf("%s\n", s.c_str()) //string出力
#define all(x) (x).begin(), (x).end()
#define allsum(a, b, c) ((a + b) * c / 2.0) //等差数列の和、初項,末項,項数
#define pb push_back
#define priq priority_queue
#define rpriq priq<int, vector<int>, greater<int>>
#define deg_to_rad(deg) (((deg)/360.0L)*2.0L*PI)
#define rad_to_deg(rad) (((rad)/2.0L/PI)*360.0L)
#define Please return
#define AC 0
#define manhattan_dist(a, b, c, d) (abs(a - c) + abs(b - d)) /*(a, b) から (c, d) のマンハッタン距離 */


using ll = long long;

constexpr int INF = 1073741823;
constexpr int MINF = -1073741823;
constexpr ll LINF = ll(4661686018427387903);
constexpr ll MOD = 1000000007;
const long double PI = acosl(-1.0L);

using namespace std;

void scans(string& str) {
	char c;
	str = "";
	scanf("%c", &c);
	if (c == '\n')scanf("%c", &c);
	while (c != '\n' && c != -1 && c != ' ') {
		str += c;
		scanf("%c", &c);
	}
}

void scanc(char& str) {
	char c;
	scanf("%c", &c);
	if (c == -1)return;
	while (c == '\n') {
		scanf("%c", &c);
	}
	str = c;
}

double acot(double x) {
	return PI / 2 - atan(x);
}

ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}

ll lcm(ll number1, ll number2) {
	return number1 / gcd(number1, number2) * number2;
}

ll LSB(ll n) { return (n & (-n)); }

/*-----------------------------------------ここからコード-----------------------------------------*/



int main() {

	int k, n;
	scanf("%d%d", &k, &n);
	vector<ll> a(n + 1), b(n);
	rep(i, n)scanf("%lld", &a[i]);
	a[n] = k + a[0];
	rep(i, n)b[i] = a[i + 1] - a[i];
	ll sum = accumulate(all(b), 0LL), f;
	f = sum;
	rep(i, n)sum = min(sum, f - b[i]);
	printf("%lld\n", sum);

	Please AC;
}

Measured memory_bytes: 3960
#include <cstring>
#include <cstdio>

int a[500005];
char s[500005];

int main(){
	scanf("%s",s);
	int n=strlen(s),sum=0,ans;
	for (int i=0;i<n;i++) a[n-i-1]=(s[i]-'0')*9;
	for (int i=0;i<n;i++) a[i+1]+=a[i]/10,sum+=a[i]%=10;
	sum+=a[n];
	for (ans=0;sum>ans;ans+=9){
		a[0]+=9;sum+=9;
		for (int i=0;a[i]>9;a[++i]++) a[i]-=10,sum-=9;
	}
	printf("%d\n",ans/9);
}

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

// def
#define debug(x) cout << #x << ": " << x << endl
#define out(x) cout << x << endl
#define repeat(i, a, b) for (int i = (a); i < (b); i++)
#define revrepeat(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define revrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define CYES cout << "Yes" << endl
#define CNO cout << "No" << endl
#define SPC(x) cout << fixed << setprecision(x)

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vector<int>> vii;
typedef vector<ll> vl;
typedef vector<vector<ll>> vll;
typedef pair<int, int> P;
typedef complex<ld> Point;
typedef vector<vector<int>> Graph;
const int MOD = 1e9 + 7;
const int INF = 1e9;
const int MAX_V = 1e5 + 5;
const int MAX_N = 1e5 + 5;
const double PI = acos(-1L);

int main() {
    int n;
    cin >> n;
    vi operation;
    operation.push_back(1);
    for (int i = 6; i <= n; i *= 6) {
        operation.push_back(i);
    }
    for (int i = 9; i <= n; i *= 9) {
        operation.push_back(i);
    }
    vi dp(n + 1, INF);
    dp[0] = 0;

    rep(i, n + 1) {
        for (auto op : operation) {
            if (i - op >= 0) {
                // debug(op);
                dp[i] = min(dp[i], dp[i - op] + 1);
            }
        }
        // debug(dp[i]);
    }

    out(dp[n]);
}


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

const int maxN=3001;

int n;
int v[maxN];

long long dp[maxN][maxN];

int main(){
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>v[i];
    }

    for(int i=1;i<=n;i++){
        dp[i][i]=v[i];
    }

    for(int i=n;i>=1;i--){
        for(int j=i+1;j<=n;j++){
            dp[i][j]=max(v[i]-dp[i+1][j],v[j]-dp[i][j-1]);
        }
    }

    cout<<dp[1][n];

    return 0;
}

Measured memory_bytes: 70016
/*
	Name:
	Author: xiaruize
	Date:
*/

#include<bits/stdc++.h>
using namespace std;
#define ull unsigned long long
#define MOD 1000000007
#define ALL(a) (a).begin(), (a).end()
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define ll long long
#define form(i,j,n) for(int i=int(j);i<=int(n);i++)
#define pb push_back
#define mk make_pair
#define pii pair<int,int>
#define pis pair<int,string>
#define sec second

int main()
{
 	ios::sync_with_stdio(false);
	cin.tie(0);
 	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	ll n,k;
	cin>>n>>k;
	ll a[n];
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
	}
	sort(a,a+n);
	ll ans=0;
	for(int i=0;i<n-k;i++)
	{
		ans+=a[i];
	}
	cout<<ans<<endl;
	return 0;
}


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

using namespace std;

using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using vvvll = vector<vector<vector<ll>>>;
using vvvvll = vector<vector<vector<vector<ll>>>>;
using pl4 = pair<ll,ll>;
using str = string;
using vpl4 = vector<pair<ll,ll>>;

#define sz size()
#define be begin()
#define en end()
#define fi first
#define se second
#define pb push_back
#define mp make_pair

#define llin(x) ll(x);cin >> (x);
#define stin(x) str(x);cin >> (x);
#define vllin(x,n) vll(x)(n);FOR(i,0,n-1){cin >> (x)[i];}
#define vllin2(a,b,n) vll(a)(n);vll(b)(n);FOR(i,0,n-1){cin >> (a)[i] >> (b)[i];}
#define vllin3(a,b,c,n) vll(a)(n);vll(b)(n);vll(c)(n);FOR(i,0,n-1){cin >> (a)[i] >> (b)[i] >> (c)[i];}
#define vlling(x,n) (x).assign(n,0);FOR(i,0,n-1){cin >> (x)[i];}
#define vlling2(a,b,n) (a).assign(n,0);(b).assign(n,0);FOR(i,0,n-1){cin >> (a)[i] >> (b)[i];}
#define vlling3(a,b,c,n) (a).assign(n,0);(b).assign(n,0);(c).assign(n,0);FOR(i,0,n-1){cin >> (a)[i] >> (b)[i] >> (c)[i];}
#define vpl4in(x,n) vpl4(x)((n),mp(0,0));FOR(i,0,n-1){cin >> x[i].fi >> x[i].se;}
#define FOR(i,a,b) for(ll i=a;i<=b;i++)
#define rFOR(i,b,a) for(ll i=a;i>=b;i--)
#define SORT(x) sort(x.be,x.en)
#define rSORT(x) sort(x.rbegin(),x.rend())
#define say(x) cout << (x);
#define sal(x) cout << (x) << endl;
#define says(x) cout << (x) << (' ');
#define sas cout << (' ');
#define sayR(x) cout << fixed << setprecision(10) << (x);
#define salR(x) cout << fixed << setprecision(10) << (x) << endl;
#define yn(a) cout << ((a) ? "yes" : "no") << endl;
#define Yn(a) cout << ((a) ? "Yes" : "No") << endl;
#define YN(a) cout << ((a) ? "YES" : "NO") << endl;
#define Imp(a) cout << ((a) ? "Possible" : "Impossible") << endl;
#define IMP(a) cout << ((a) ? "POSSIBLE" : "IMPOSSIBLE") << endl;

ll MOD = 1000000007;

signed main()
{
    llin(a);
    llin(b);
    sal((b-1)/(a-1)+((b-1)%(a-1)==0?0:1))
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define f(i,a,b) for(i=a;i<b;i++)
#define YES cout<<"YES\n"
#define NO cout<<"NO\n"
using namespace std;

int main() {

ll n,i,mx=99,mn=201,f=0,s=1000,j,k,p;
cin>>n;
ll a[n];
f(i,0,n)cin>>a[i];
vector<ll>v;
for(i=0;i<n-1;i++)
{
    mx=max(mx,a[i]);
    mn=min(mn,a[i]);
    
    if(a[i+1]>a[i]&&f==0)v.pb(mn),mn=201,mx=99,f=1;
    
    else if(a[i+1]<a[i]&&f)v.pb(mx),mx=99,mn=201,f=0;
}  
if(!v.empty()&&f==1)v.pb(a[i]);

for(i=0;i<v.size();i++)
{if(i%2==0)
  {
      k=v[i];
      j=s/k;
      s-=j*k;
     
  }
  else 
  { k=v[i];
      s+=j*k;
  }
}
cout<<s;
}

Measured memory_bytes: 3636
/// kAAzuki Hoshino
/*
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi;
#define inf 1000000000
#define mod 1000000007
#define dmp(x) cerr<<"line "<<__LINE__<<" "<<#x<<":"<<x<<endl
#define fs first
#define sc second
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define mt make_tuple
#define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){
	return o<<"("<<p.fs<<","<<p.sc<<")";
}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){
	o<<"{";
	for(const T& v:vc) o<<v<<",";
	o<<"}";
	return o;
}


int n,q,sum[202020],tin[502020],id[202020],tout[505050];
vi adj[202020];
int timer = 1;
/*
void dfs(int s, int p){
	tin[s]=timer;
	id[timer] = s;
	timer++;
	for(auto t:adj[s]){
		if(t!=p){
			dfs(t , s);
		}
	}
	tout[s] = timer;
}
*/

void dfs(int s, int p, int val){

	sum[s]+=val;
	for(auto t:adj[s]){
		if(t!=p){
			dfs( t, s, sum[s] );
		}
	}

}

signed main(){
IOS;
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);

	
	cin >> n >> q;
	for(int i=1;i<n;i++){
		int x,y;
		cin >> x >> y;
		adj[x].pb(y);
		adj[y].pb(x);
	}


	while(q--){
		int x,y;
		cin >> x >> y;
		sum[x]+=y;
		//sum[tin[x]]+=y;
		//sum[tout[x]]-=y;
	}
	dfs(1,-1, 0);

	for(int i=1;i<=n;i++){
		//sum[i] = sum[i-1]+sum[i];
	}

	for(int i=1;i<=n;i++){
		cout << sum[i] << " ";
	}

return 0;
}
///....


Measured memory_bytes: 27648
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i,n) for(int i=0, i##_len=(int)(n); i<i##_len; i++)
#define reps(i,n) for(int i=1 , i##_len=(int)(n);i<=i##_len;i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;i--)
#define rreps(i,n) for(int i=((int)(n));i>0;i--)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define solve(a) ((a)?"Yes":"No")
typedef vector<long long> V;
typedef vector<V> VV;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1;} return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1;} return 0;}
const long long INFLL = 1LL<<62;
const int INF = 1<<30;
const double PI=acos(-1);
int main(){
    int n;
    int bef1,bef2;
    vector<pair<int,int>>a(100010);
    vector<pair<int, int>> b(100010);
    rep(i,100010){
        a[i].F=0;
        a[i].S=i;
        b[i].F = 0;
        b[i].S = i;
    }
    pair<int,int>mode[2][2];
    int ans=n*2;
    cin >>n;
    rep(i,n/2){
        cin>>bef1>>bef2;
    
        a[bef1].F += 1;
        b[bef2].F += 1;
    }
    sort(all(a),greater<pair<int,int>>());
    sort(all(b), greater<pair<int,int>>());
    rep(i,2){
        mode[0][i]=a[i];
        mode[1][i]=b[i];
    }
        if(mode[0][0].S== mode[1][0].S){
            ans=n-max(mode[0][0].F+mode[1][1].F,mode[1][0].F+mode[0][1].F);
        }else{
            ans=n-mode[0][0].F-mode[1][0].F;
        }
    cout<<ans<<endl;
}

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

int main()
{
	int n;

	cin >> n;

	while (n > 0) {
		int m = 0;

		while (n > 0) {
			m += n / 5;
			n /= 5;
		}

		cout << m << endl;

		cin >> n;
	}

	return 0;
}


Measured memory_bytes: 3088
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size)
#define MOD 1000000007
const long long mod = 1e9+7;
typedef vector<long long> Vl;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<Vl> VVl;
typedef pair<int, int> PII;
typedef long long ll;

int main(){
    int a,b;
    cin >> a >> b;
    if(a==2){
        if(b==2){
            cout << "Yes"<< endl;
        }
        else cout << "No"<< endl;
        return 0;
    }
    if(a==4 || a==6 || a==9 || a==11){
        if(b==4 || b==6 || b==9 || b==11){
            cout << "Yes"<< endl;
        }
        else cout << "No"<< endl;
        return 0;
    }
    else{
        if(b==2){
            cout << "No"<< endl;
        }
        else if(b==4 || b==6 || b==9 || b==11) {
            cout << "No"<< endl;
        }
        else cout << "Yes"<< endl;
        return 0;
    }
}

Measured memory_bytes: 256
n, m, x = gets.split.map(&:to_i)
a = gets.split.map(&:to_i)

mass = Array.new(n+1){0}

a.each do |i|
  mass[i] = 1
end

left  = mass[0..x].inject(:+)
right = mass[x..-1].inject(:+)

p [left,right].min



Measured memory_bytes: 1788
package main

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

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func getInts(N int) []int {
	ret := make([]int, N)
	for i := 0; i < N; i++ {
		ret[i] = getInt()
	}
	return ret
}

func getString() string {
	sc.Scan()
	return sc.Text()
}

// min, max, asub, absなど基本関数
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

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

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

func abs(a int) int {
	if a >= 0 {
		return a
	}
	return -a
}

func lowerBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] >= x
	})
	return idx
}

func upperBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] > x
	})
	return idx
}

var R, C, K int
var v [][]int
var dp [][][4]int

func main() {
	sc.Split(bufio.ScanWords)
	R, C, K = getInt(), getInt(), getInt()
	v = make([][]int, R)
	dp = make([][][4]int, R)
	for i := 0; i < R; i++ {
		v[i] = make([]int, C)
		dp[i] = make([][4]int, C)
	}
	for i := 0; i < K; i++ {
		r, c, p := getInt()-1, getInt()-1, getInt()
		v[r][c] = p
	}
	// for i := 0; i < R; i++ {
	// 	out(v[i])
	// }
	// out("-------")
	dp[0][0][1] = v[0][0]
	for i := 0; i < R; i++ {
		for j := 0; j < C; j++ {
			for k := 0; k < 4; k++ {
				if i > 0 {
					dp[i][j][0] = max(dp[i][j][0], dp[i-1][j][k])
					dp[i][j][1] = max(dp[i][j][1], dp[i-1][j][k]+v[i][j])
				}
				if j > 0 {
					dp[i][j][k] = max(dp[i][j][k], dp[i][j-1][k])
					if k > 0 {
						// dp[i][j][k] = max(dp[i][j][k], dp[i][j][k-1])
						dp[i][j][k] = max(dp[i][j][k], dp[i][j-1][k-1]+v[i][j])
					}
				}
			}
			// out(i, j, dp[i][j])
		}
	}

	ma := 0
	for i := 0; i < 4; i++ {
		ma = max(ma, dp[R-1][C-1][i])
	}
	out(ma)
}


Measured memory_bytes: 378112
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll mod=1e9+7;

//TEMPLATE
/*
    for(int i=0; i<N; i++){
    }
*/

int main(){
    int sx, sy, tx, ty;
    cin >> sx >> sy >> tx >> ty;
    int dx=tx-sx, dy=ty-sy;
    cout << string(dy, 'U') << string(dx, 'R');
    cout << string(dy, 'D') << string(dx, 'L');
    cout << 'L' << string(dy+1, 'U') << string(dx+1, 'R')<<'D';
    cout << 'R' << string(dy+1, 'D') << string(dx+1, 'L') << 'U';
}

Measured memory_bytes: 256
import java.io.*;
import java.math.BigInteger;
import java.util.*;
public class Main {
	static BufferedReader br;
	static int cin() throws Exception
	{
		return Integer.valueOf(br.readLine());
	}
	static int[] split() throws Exception
	{
		String[] cmd=br.readLine().split(" ");
		int[] ans=new int[cmd.length];
		for(int i=0;i<cmd.length;i++)
		{
			ans[i]=Integer.valueOf(cmd[i]);
		}
		return ans;
	}
	static long[] splitL() throws IOException
	{
		String[] cmd=br.readLine().split(" ");
		long[] ans=new long[cmd.length];
		for(int i=0;i<cmd.length;i++)
		{
			ans[i]=Long.valueOf(cmd[i]);
		}
		return ans;
	}
	static long power(long x,long y,long p)
	{
		long res=1;
		x=x%p;
		while(y>0)
		{
			if((y&1)==1)
				res=(res*x)%p;
			y=(y>>1);
			x=(x*x)%p;
		}
		return res;
	}
	static long inv(long x,long p)
	{
		return power(x,p-2,p);
	}
	public static void main(String[] args) throws Exception{
		// TODO Auto-generated method stub
		br=new BufferedReader(new InputStreamReader(System.in));
		int[]ar=split();
		int n=ar[0];
		int k=ar[1];
		int[][]arr=new int[k][2];
		for(int i=0;i<k;i++)
		{
			ar=split();
			arr[i][0]=ar[0];
			arr[i][1]=ar[1];
		}
		int mod=998244353;
		int[]dp=new int[n];
		dp[0]=1;
		dp[1]=-1;
		for(int i=0;i<n;i++)
		{
			if(i>0)
				dp[i]=(dp[i]+dp[i-1])%mod;
			for(int j=0;j<k;j++)
			{
				int l=arr[j][0];
				int r=arr[j][1];
				if(i+l<n)
					dp[i+l]=(dp[i+l]+dp[i])%mod;
				if(i+r+1<n)
					dp[i+r+1]=((dp[i+r+1]-dp[i])%mod+mod)%mod;
			}
		}
//		int ans=0;
//		for(int i=0;i<n;i++)
//		{
//			ans=(ans+dp[i])%mod;
//		}
		System.out.println(dp[n-1]);
	}
}


Measured memory_bytes: 34616
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please


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


	int N;
	cin >> N;
	pair<int, int> XL[100000];
	rep(i, N) {
		int x, l;
		cin >> x >> l;
		XL[i] = mp(x + l, x - l);
	}
	sort(XL, XL + N);

	int mae = -2e9;
	int kotae = 0;
	rep(i, N) {
		if (mae <= XL[i].second) {
			kotae++;
			mae = XL[i].first;
		}
	}
	co(kotae);


	Would you please return 0;
}

Measured memory_bytes: 1024
import bisect
n = int(input())
L = list(map(int,input().split()))

L.sort()
c=0
for i in range(n-2):
    ci=L[i]
    for j in range(i+1,n-1):
        cij = ci+L[j]
        c += bisect.bisect_left(L,cij,j+1,n)-j-1

print(c)


Measured memory_bytes: 9300
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define perl(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define pb push_back
#define ins insert
#define pqueue(x) priority_queue<x,vector<x>,greater<x>>
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
#define vtpl(x,y,z) vector<tuple<x,y,z>>
#define rev(x) reverse(x);
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
using vpl=vector<pl>;
using vvpl=vector<vpl>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[8]={1,0,-1,0,1,1,-1,-1};
const ll dx[8]={0,-1,0,1,1,-1,1,-1};
ll powmod(ll n, ll k, ll m) {
ll r=1;
 for(; k>0; k >>=1) {
   if(k&1) r=(r*n)%m;
   n=(n*n)%m;
 }
  return r;
}

ll fact(ll n) {
ll a=1;
rep(i,n) {
a=a*(n-i);
}
return a;
}

ll pow(ll a, ll b) {
ll x=1;
rep(i,b) {
x=x*a;
}
return x;
}



int main() {
ll K;
  ll A;
  ll B;
  cin >>K>>A>>B;
  
 ll c=0;
  repl(i,A,B+1) {
    if(i%K==0) {
c=1;
      break;
    }
  }

  
  if(c) {
cout<<"OK"<<endl;
  }

  else {
cout<<"NG"<<endl;
  }

  
}
  
  
  

Measured memory_bytes: 3560
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <cmath>

using namespace std;

const int MAXN = 200000 + 1000;

int n, X, Y;
vector<int> bedg[MAXN], redg[MAXN];
int ru[MAXN], rv[MAXN];

int dep[MAXN], fa[MAXN];
bool sp[MAXN];

bool check_long(int x, int y)
{
	if(fa[x] == y || x == fa[y])
		return false;
	if(fa[fa[x]] == y || x == fa[fa[y]])
		return false;
	if(fa[x] == fa[y])
		return false;
	return true;
}

void dfs1(int x, int father, int depth)
{
	fa[x] = father;
	dep[x] = depth;
	for(int i = 0; i < bedg[x].size(); i++)
		if(bedg[x][i] != father)
			dfs1(bedg[x][i], x, depth + 1);
}

int ans = 0;
bool dfs2(int x, int father, int depth)
{
	if(dep[x] <= depth)
		return false;
	// cerr << x << endl;
	ans = max(ans, dep[x]);
	if(sp[x])
		return true;
	for(int i = 0; i < redg[x].size(); i++)
		if(redg[x][i] != father)
			if(dfs2(redg[x][i], x, depth + 1))
				return true;
	return false;
}

int main()
{
	ios::sync_with_stdio(false);
	// freopen("1.in", "r", stdin);
	// freopen("1.out", "w", stdout);

	cin >> n >> X >> Y;
	for(int i = 1; i <= n - 1; i++)
		cin >> ru[i] >> rv[i];
	for(int i = 1; i <= n - 1; i++)
	{
		int x, y;
		cin >> x >> y;
		bedg[x].push_back(y), bedg[y].push_back(x);
	}
	dfs1(Y, 0, 0);
	for(int i = 1; i <= n - 1; i++)
		if(check_long(ru[i], rv[i]))
			sp[ru[i]] = sp[rv[i]] = true;
		else
			redg[ru[i]].push_back(rv[i]), redg[rv[i]].push_back(ru[i]);
	if(dfs2(X, 0, 0))
		cout << -1 << endl;
	else
		cout << 2 * ans << endl;

	return 0;
}


Measured memory_bytes: 36096
#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <deque>
#include <algorithm>
#include <iomanip>
#include <functional>

#define REP(i, n) for(int i = 0;i < (n); i++)
#define REP2(i, x, n) for(int i = (x); i < (n); i++)
#define REPR(i, n) for(int i = (n); i >= 0; i--)

#define ALL(a) (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
#define DESCSORT(c) sort(c.begin(), c.end(), greater<int>())

#define LL long long int
#define LD long double

#define PI 3.14159265358979

using namespace std;

//================================================
int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	vector<int>ans(10);
	int N;

	REP(i, 10) cin >> ans[i];
	DESCSORT(ans);
	REP(i, 3) cout << ans[i] << "\n";
	return 0;
}

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

int main(void){
    int N;
    cin >> N;
    ll buf, res = 0;
    // x_i = x_{i+3}が常に成立
    REP(i,N){
        cin >> buf;
        res ^= buf;
    }
    if(res==0){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <string>
#include <cstring>
#include <cmath>
#include <complex>
#include <map>
#include <climits>
using namespace std;

#define reep(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) reep((i),0,(n))
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define EPS 1e-8
#define F first
#define S second
#define mkp make_pair

static const double PI=6*asin(0.5);
typedef long long ll;
typedef complex<double> CP;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vint;
static const int INF=1<<24;

struct T{
	int a,b,c;
};

int main(){
	int N,M;
	while(cin>>N>>M,N||M){
		int r;
		vector<vector<T> > v(M);
		cin>>r;
		rep(i,r){
			int t,n,m,s;
			cin>>t>>n>>m>>s;
			t-=540;
			m--;
			T tmp;
			tmp.a=t;
			tmp.b=n;
			tmp.c=s;
			v[m].PB(tmp);
		}
		int q;
		cin>>q;
		rep(i,q){
			int ts,te,m;
			cin>>ts>>te>>m;
			//cout<<ts<<" "<<te<<" "<<m<<endl;
			ts-=540;
			te-=540;
			m--;
			int ans=0;
			int tt1=0,tt2=0;
			rep(j,v[m].size()){
				if(v[m][j].a>te){
					if(tt1) ans+=te-tt2;
					break;
				}
				if(v[m][j].c==1){
					if(tt1==0){
						if(v[m][j].a<ts){
							tt2=ts;
						}
						else tt2=v[m][j].a;
						tt1++;
					}
					else{
						tt1++;
					}
				}
				else{
					tt1--;
					if(tt1==0){
						if(v[m][j].a>=ts) ans+=v[m][j].a-tt2;
						//cout<<" ans "<<ans<<endl;
					}
				}
			}
			cout<<ans<<endl;
		}
	}
	return 0;
}

/* 
775 1
790 2
800 2
810 3
820 1
825 3
860 1
880 1
+50

*/

Measured memory_bytes: 1460
#include <iostream>
#include <algorithm>

using namespace std;

int selectionSort(int a[], int n)
{
	int count = 0;
	for (int i = 0; i < n; i++) {
		int index = i;
		for (int j = i + 1; j < n; j++) {
			if (a[index] > a[j]) {
				index = j;
			}
		}
		if (i != index) {
			count++;
			swap(a[i], a[index]);
		}
	}
	return count;
}

int main(void)
{
	int N;
	int A[100];

	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> A[i];
	}
	int count = selectionSort(A, N);
	cout << A[0];
	for (int i = 1; i < N; i++) {
		cout << ' ' << A[i];
	}
	cout << endl << count << endl;

	return 0;
}


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

int main() {
    string S, T, U;
    int A, B;
    cin >> S >> T >> A >> B >> U;

    if (S == U) cout << A - 1 << " " << B << endl;
    else cout << A << " " << B - 1 << endl;
}

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

using namespace std;
typedef long long ll;

#define INF (long long)(10e9+7)
#define REP(i,n) for(ll i = 0; i < n; i++)
#define REP1(i,n) for(ll i = 1; i <= n; i++)

unordered_map<string, int> mp;

int main(void)
{
    int n;
    cin >> n;
    string s, os;
    bool f = true;
    cin >> os;
    mp[os] = 1;
    for(int i = 1; i < n; i++) {
        cin >> s;
        if(s[0] != os[os.size()-1]) {
            f = false;
        }
        if(mp.find(s) != mp.end()) {
            f = false;
        }
        mp[s] = 1;
        os = s;
    }
    if(f) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}


Measured memory_bytes: 256
from bisect import bisect_left
n,m, v, p = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
if v >= p:
    l, r = -1, n - p
    while r - l > 1:
        flg = 0
        med = (l + r) // 2
        t = (v - p) * m
        for i in range(n - p + 1):
            if a[med] + m < a[i]:
                flg = 1
                break
        for i in range(n - p + 1):
            if i == med:
                continue
            t -= min(m, a[med] + m - a[i])
        if t > 0:
            flg = 1
        if flg:
            l = med
        else:
            r = med
    print(n - r)
else:
    print(n - bisect_left(a,a[n - p] - m))


Measured memory_bytes: 14260
#include<iostream>
#include<string>
#include<vector>
#include<iomanip>
#include<algorithm>
#include<queue>
#include<stack>
#include<map>
using namespace std;
#define ll long long
int main(){
    ll n,h,a;
    cin >> n >> h>> a;
    cout << (n-h+1)*(n-a+1);
    return 0;
}


Measured memory_bytes: 256
/// Swift5 -> Swift2.2

extension String {
    // split(separator:maxSplits:omittingEmptySubsequences:)
    func split(separator separator: Character) -> [String] {
        return self.characters.split(separator).map(String.init)
    }
}
extension Array {
    // init(repeating:count:)
    init(repeating: Element, count: Int) {
        self.init(count: count, repeatedValue: repeating)
    }
    // lastIndex(where:)
    func lastIndex(where predicate: (Element) -> Bool) -> Int? {
      	for i in stride(from: count - 1, through: 0, by: -1) {
          	if predicate(self[i]) {
              	return i
            }
        }
      	return nil
    }
}
extension Array where Element: Comparable {
    // sorted()
    func sorted() -> [Element] {
        return self.sort( { $0 < $1 } )
    }
    // max()
    func max() -> Element? {
        guard self.count > 0 else { return nil }
        return self.reduce(self.first!) { return Swift.max($0, $1) }
    }
}
extension String {
    // Sequence#enumerated()
  	// public func enumerate<Seq : SequenceType>(base: Seq) -> EnumerateSequence<Seq>
    func enumerated() -> EnumerateSequence<[Character]> {
        return Array(self.characters).enumerate()
    }
}
// stride(from:through:by:)
func stride(from start: Int, through end: Int, by stride: Int) -> StrideThrough<Int> {
    return start.stride(through: end, by: stride)
}
// stride(from:to:by)
func stride(from start: Int, to end: Int, by stride: Int) -> StrideTo<Int> {
    return start.stride(to: end, by: stride)
}

/// end

let input = readLine()!.split(separator: " ").map { Int($0)! }
let H = input[0]
let W = input[1]

var dp = Array(repeating: 0, count: W)
dp[0] = 1

enum Grid: Character {
    case empty = "."
    case wall = "#"
}

for i in stride(from: 0, to: H, by: 1) {
    for (j, character) in readLine()!.enumerated() {
        guard i > 0 || j > 0 else { continue }
        switch Grid(rawValue: character)! {
        case .empty:
            if j > 0 {
                dp[j] = (dp[j - 1] + dp[j]) % 1_000_000_007
            }
        default:
            dp[j] = 0
        }
    }
}

print(dp.last!)


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

#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define REP(i, n)  FOR(i, 0, n)
#define ASC(c) sort((c).begin(), (c).end())
#define DESC(c) sort((c).begin(), (c).end(), greater<int>())

#define DUMP(x)  cerr << #x << " = " << (x) << endl;
#define DEBUG(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

typedef long long ll;
typedef unsigned long long ull;
struct edge { int u, v; ll w; };
 
ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

int main() {
    int n, m; cin >> n >> m;
    ll s = 0;
    REP(_, m) {
        int a; cin >> a;
        s += a;
    }
    if (s > n) {
        cout << -1 << endl;
        return 0;
    }
    cout << n - s << endl;
}


Measured memory_bytes: 3160
puts 9394,a=?+,0,1,m=9,?<,2,9,u=3,
[a,5-u+=1,3,9]+(0..59).map{[a,u,u,u,a,u,3,6,[a,6,6,6]*(59-_1),?<,6,9,m+=1,a,u,m,u]},
[a,5-u+=1,3,9]+(0..59).map{[a,u,u,u,a,u,3,6,[a,6,6,6]*(59-_1),?<,6,9,m+=1,a,u,m,u]},
(0..59).map{|_|[a,2,2,2]+(1.._).map{[a,40+_-_1,99+_1,u,?<,3,u,u,a,u,2,2]}}

Measured memory_bytes: 14916
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
using ll=long long;
typedef pair<int,int> P;
const int INF=1e9;
int main(){
    string s;
    cin>>s;
    ll ans=0;
    int n=s.size();
    rep(i,1<<(n-1)){
        ll allsum=0,sum=s[0]-'0';
        for(int j=1;j<n;j++){
            if(i>>(j-1)&1){
                sum=sum*10+s[j]-'0';
            }
            else{
                allsum+=sum;
                sum=0;
                sum=s[j]-'0';
            }
        }
        ans+=allsum+sum;
    }
    cout<<ans;
}

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

int main(){
	////freopen("input.txt","r",stdin);
	///freopen("output.txt","w", stdout);
	ios::sync_with_stdio(false);
	cin.tie(0);  
	int a,b,t;
	cin >> a;
	if (a==1){
		cout << "Hello World" << endl;
		return 0;
	}
	else if (a==2){
		cin >> b >> t;
		cout << b+t << endl;
	}
	}
	

Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author aryssoncf
 */



// Taken from: https://github.com/bqi343/USACO/blob/master/Implementations/content/contest/templateShort.cpp

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ull> vul;
typedef vector<ll> vl;
typedef vector<pii> vpii;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define F0R(i, a) FOR(i,0,a)
#define ROF(i, a, b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i, a) ROF(i,0,a)
#define trav(a, x) for (auto& a: x)

#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define rsz resize

#define mp make_pair
#define pb push_back
#define f first
#define s second

const int MOD = 1e9 + 7; // 998244353; // = (119<<23)+1
const int MX = 2e5 + 5;

template<class T>
bool ckmin(T &a, const T &b) {
    return a > b ? a = b, 1 : 0;
}

template<class T>
bool ckmax(T &a, const T &b) {
    return a < b ? a = b, 1 : 0;
}

mt19937 rng((uint32_t) chrono::steady_clock::now().time_since_epoch().count());


//
// Created by aryssoncf on 28/10/2019.
//

#include <type_traits>


#include <iterator>
#include <utility>

template<typename T>
constexpr auto hasBegin(int) -> decltype(std::begin(std::declval<T>()), true) {
    return true;
}

constexpr bool hasBegin(...) {
    return false;
}

template<typename T>
using IsContainer = std::integral_constant<bool, hasBegin<T>(0)>;


#ifndef JHELPER_EXAMPLE_PROJECT_IO_HPP
#define JHELPER_EXAMPLE_PROJECT_IO_HPP

#endif //JHELPER_EXAMPLE_PROJECT_IO_HPP

template<typename T>
std::istream &operator>>(std::istream &is, std::vector<T> &vec) {
    for (T &element: vec) {
        is >> element;
    }
    return is;
}

template<typename T, typename U>
std::istream &operator>>(std::istream &is, std::pair<T, U> &p) {
    is >> p.first;
    is >> p.second;
    return is;
}

template<class X, class Y>
std::ostream &operator<<(std::ostream &os, std::pair<X, Y> const &p) {
    return os << p.first << " " << p.second;
}

template<class Ch, class Tr, class Container>
std::basic_ostream<Ch, Tr> &operator<<(std::basic_ostream<Ch, Tr> &os, Container const &x) {
    bool first = true;
    for (auto &y : x) {
        if (first) {
            first = false;
        } else {
            os << " ";
        }
        os << y;
    }
    return os;
}

using namespace std;

class CAttackSurvival {
public:
    void solve(std::istream &in, std::ostream &out) {
        int n, k, q;
        in >> n >> k >> q;
        vi scores(n, k - q);
        vi A(q);
        in >> A;
        trav(x, A) {
            scores[x - 1]++;
        }
        trav(x, scores) {
            out << (x > 0 ? "Yes" : "No") << '\n';
        }
    }

    void setup() {}
};


int main() {
    std::ios_base::sync_with_stdio(false);
    CAttackSurvival solver;
    solver.setup();
    std::istream &in(std::cin);
    std::ostream &out(std::cout);
    in.tie(nullptr);
    out << std::fixed;
    out.precision(20);
    solver.solve(in, out);
    return 0;
}


Measured memory_bytes: 3980
//https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8 より
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

// ここまで

fn run() {
    input! {
        n: usize,
        k: usize,
        h: [i32; n],
    }
    let mut dp = vec![1000000000; n];
    dp[0] = 0;
    for i in 1..n {
        let sup = std::cmp::min (k + 1, i + 1);
        for j in 1..sup {
            let v = dp[i - j] + (h[i] - h[i - j]).abs();
            dp[i] = std::cmp::min (dp[i], v);
        }
    }
    println! ("{}", dp[n - 1]);
}

fn main() {
    run();
}


Measured memory_bytes: 6396
package main

import "fmt"

func main() {
	var a, b, c, x int
	fmt.Scan(&a, &b, &c, &x)

	count := 0

	for y500 := 0; y500 <= a; y500++ {
		for y100 := 0; y100 <= b; y100++ {
			for y50 := 0; y50 <= c; y50++ {
				if ((y500 * 500) + (y100 * 100) + (y50 * 50)) == x {
					count++
				}
			}
		}
	}

	fmt.Println(count)
}


Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <stack>
#include <queue>
#include <utility>
#include <map>
#include <functional>
typedef long long ll;
using namespace std;
const int MOD = 1000000007;

int main(){
    int n;
    cin >> n;
    
    map<int,ll> mp;

    if(n == 1){
        cout << 1 << endl;
        return 0;
    }

    for(int i = 2;i <= n;i++){
        int k = i;
        for(int j = 2;j * j <= k;j++){
            while(k % j == 0){
                mp[j]++;
                k /= j;
            }
        }
        if(k != 1)mp[k]++;
    }

    ll ans = 1;
    for(auto p:mp){
        ans *= (p.second + 1);
        ans %= MOD;
    }

    cout << ans << endl;
}


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

#define st first
#define nd second
#define mp make_pair
#define pb push_back
#define cl(x, v) memset((x), (v), sizeof(x))

#define db(x) cerr << #x << " == " << x << endl
#define dbs(x) cerr << x << endl
#define _ << ", " <<

typedef long long ll;
typedef long double ld;

typedef pair<int, int> pii;
typedef pair<int, pii> piii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;

const ld EPS = 1e-9, PI = acos(-1.);
const int INF = 0x3f3f3f3f, MOD = 1e9+7;
const int N = 5e5+5;

int n;
ll v[N];

ll ans;

map<ll, int> m;

int main() {

  scanf("%d", &n);

  m[0] = 1;
  for(int i=0; i<n; i++) {
    scanf("%lld", &v[i]);
    v[i] += v[i-1];

    ans += m[v[i]];
    m[v[i]]++;
  }


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

  return 0;
}


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

using namespace std;
using ll = long long;

int main() {
    ll N = 0;
    cin >> N;
    vector<ll> A(N,0);
    for(ll i = 0; i < N; i++) {
        cin >> A.at(i);
    }
    map<int, int> m;
    int ans = 0;
    for(int i = 0; i < N; i++) {
        for(int j = -1; j < 2; j++) {
            if(!m.count(A.at(i) + j)) {
                m[A.at(i) + j] = 0;
            }
            m.at(A.at(i) + j)++;
            ans = max(ans, m.at(A.at(i) + j));
        }
    }

    cout << ans << endl;



    return 0;
}

Measured memory_bytes: 8428
//int a = stoi(c); 文字列をintへ
//小文字から大文字
//transform(a.begin(), a.end(), a.begin(), ::toupper);
//途中の出力をそのまま残さない
//数値計算 個数以外はdouble
//map<キー,値> p は辞書。p[キー] = 値
//map 全探索
//auto begin = p.begin(), end = p.end();
//for (auto it = begin; it != end; it++) {}
//mapのキー：it->first mapのバリュー：it->second
//絶対値 abs()
//入力は空白で切れる
//大文字判定 isupper(文字) 小文字判定 islower(文字)
//do{}while(next_permutation(ALL(配列)))
//while(N)で回すとき、Nはコピーを作っておく
//小文字に対応する文字コード：S[i] - 'a'
//文字コード→小文字：(char)(数字+'a')
//グラフの距離:隣接行列で扱う
//等価なものに変換する思考
//bool型　初期値はTrue
//島渡りの問題：中間ノードに着目
//配列はvector<>を使う：意味わからないエラーがなくなる。
//背反な事象にちゃんとわける
//チェックリストはマップを使う
//数が大きい時の比較はstring型で行う
//全て0になったか調べたい->0になるたびにcntする
//またはかかつか
//例外処理は最初にする
#include <bits/stdc++.h>
#define rep(i,N) for(int i = 0; i < N;i++)
#define ALL(a) (a).begin(),(a).end()
#define ll long long int
using namespace std;

//円周率
const double PI = 3.14159265358979323846;
//割るやつ
const ll M = (pow(10, 9) + 7);

// K進数でのNの桁数
ll dig(ll N, ll K) {
	ll dig = 0;
	while (N) {
		dig++;
		N /= K;
	}
	return dig;
}
// a,bの最大公約数
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a%b);
}

ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}

//nC2の計算
ll C(ll N) {
	return N * (N - 1) / 2;
}

//階乗計算
ll f(ll n) {
	if (n == 0 || n == 1) return 1;
	else return (n * f(n - 1)) % M;
}

int main() {
	ll K; cin >> K;
	int a[32] = {
		1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51
	};

	cout << a[K-1] << endl;
}

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

public class Main {

	static final int END_SIGN = 0;

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		// 標準偏差値のリスト
		ArrayList<Double> standardDeviationList = new ArrayList<Double>();

		int inputCount;
		// 得点の件数を入力、0で終了
		while (EndDecision(inputCount = sc.nextInt())) {
			// 得点リスト
			ArrayList<Double> scoreList = new ArrayList<Double>();
			for (int i = 0; i < inputCount; i++) {
				scoreList.add(sc.nextDouble());
			}
			// 標準偏差値を計算し、標準偏差値リストに追加
			standardDeviationList.add(StandardDeviationCalculation(scoreList));
		}

		// 出力
		for (double value : standardDeviationList) {
			System.out.println(value);
		}

	}

	// リストから標準偏差値を返す
	private static double StandardDeviationCalculation(ArrayList<Double> List) {
		double standardDeviation = 0;
		ArrayList<Double> differenceFromAverageList = new ArrayList<Double>();
		for (double i : List)
			differenceFromAverageList.add(Math.pow((Average(List)) - i, 2));
		// 平均との差の２乗の合計から平均を平方根計算し標準偏差値を求める
		standardDeviation = Math.sqrt(Average(differenceFromAverageList));

		return standardDeviation;
	}

	// リストから平均を返す
	private static double Average(ArrayList<Double> List) {
		double sum = 0;
		for (double d : List) {
			sum += d;
		}
		return sum / List.size();
	}

	// 終了判定
	private static boolean EndDecision(int i) {
		if (i == END_SIGN) {
			return false;
		} else {
			return true;
		}
	}

}



Measured memory_bytes: 40388
#include<stdio.h>
int main(void){
  int i;
  double a,count=0;
  scanf("%lf",&a);
  for (i=1;i<=a;i++){
    if(i%2!=0){
      count = count +1;
    }
  }
  printf("%f",count/a);
  return 0;
}

Measured memory_bytes: 128
main = getContents >>= putStr.unlines.map g.f.takeWhile (/="-").lines
    where f []       = []
          f (s:n:xs) = [s: (take (read n) xs)] ++ (f $drop (read n) xs)
          g (x:xs) = foldl h x $map read xs
          h y n = drop n y ++ take n y

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

int a[52][52], d[5] = {0, 1, 0, -1, 0}, n, m;
int f(int i, int j) { return i * (m + 2) + j; }
vector<int> used;
void dfs(int i, int j) {
    if(!a[i][j]) return;
    if(used[f(i, j)]) return;
    used[f(i, j)] = true;
    rep(t, 4) { dfs(i + d[t], j + d[t + 1]); }
}
bool check() {
    used = vector<int>((n + 2) * (m + 2));
    dfs(1, 1);
    return used[f(1, m)] and used[f(n, 1)] and used[f(n, m)];
}
main() {
    while(1) {
        cin >> n >> m;
        if(!n) return 0;
        rep(i, n + 2) rep(j, m + 2) a[i][j] = 0;
        used = vector<int>((n + 2) * (m + 2));
        rep2(i, 1, n) rep2(j, 1, m) {
            char c;
            cin >> c;
            a[i][j] = c == '.';
        }
        if(check()) {
            bool flag = true;
            rep2(i, 1, n) rep2(j, 1, m) {
                if((i != 1 and i != n) or (j != 1 and j != m)) {
                    if(a[i][j]) {
                        a[i][j] = 0;
                        flag &= check();
                        a[i][j] = 1;
                    }
                }
            }
            cout << (flag ? "YES\n" : "NO\n");
        } else
            cout << "NO\n";
    }
}


Measured memory_bytes: 3220
#define $ scanf("%d",
a[100],l,r,p,n;main(c){for(;$&r),c*=l=r;printf("%d\n",c)){for(;c=l;)$--l+a);for($&n);l<r&&!++c|a[p=l+r>>1]-n;)a[p]<n?r=p:(l=p+1);}}

Measured memory_bytes: 0
import math
a,b,x=map(int,input().split())
S = a*a
V = S*b
if x*2 > V:
    h = (V-x)*2 /S
    ans = math.atan(h/a)
else:
    w = x*2 / (a*b)
    ans = math.atan(b/w)
print(ans/math.pi *180)

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

using namespace std;

vector<vector<int>> adjlist,  rev;
vector<int> inDegree;
vector<set<int>> taken, taken2;
vector<int> grundies, grundies2;

int grundy(int v, vector<set<int>> &taken) {
  int res = 0;
  while (taken[v].count(res)) res++;
  return res;
}

int grundy2(int v) {
  int res = 0;
  while (taken[v].count(res)) res++;
  res++;
  while (taken[v].count(res)) res++;
  return res;
}

bool check(vector<int> &grundies) {
  for (int v = 0; v < (int)adjlist.size(); v++) {
    set<int> taken;
    for (int w : rev[v]) {
      taken.insert(grundies[w]);
    }
    int first = 0;
    while (taken.count(first)) first++;
    if (first != grundies[v]) return false;
  }
  return true;
}

bool possible(int v, vector<int> &grundies, vector<set<int>> &taken) {
  while (grundies[v] == -1) {
    grundies[v] = grundy(v, taken);
    taken[adjlist[v][0]].insert(grundies[v]);
    v = adjlist[v][0];
  }
  return check(grundies);
}

int main() {
  int n;
  scanf("%d", &n);
  adjlist.resize(n);
  rev.resize(n);
  inDegree.resize(n);
  taken.resize(n);
  grundies.assign(n,  -1);
  for (int i = 0; i < n; i++) {
    int p;
    scanf("%d", &p);
    p--;
    adjlist[i].push_back(p);
    rev[p].push_back(i);
    inDegree[p]++;
  }
  queue<int> q;
  for (int i = 0; i < n; i++) {
    if (inDegree[i] == 0) {
      q.push(i);
    }
  }
  while (!q.empty()) {
    int v = q.front();
    q.pop();
    grundies[v] = grundy(v, taken);
    int w = adjlist[v][0];
    taken[w].insert(grundies[v]);
    inDegree[w]--;
    if (inDegree[w] == 0) {
      q.push(w);
    }
  }
  int cycleVert = 0;
  while (!inDegree[cycleVert]) cycleVert++;
  int cand1 = grundy(cycleVert, taken);
  int cand2 = grundy2(cycleVert);

  taken2 = taken;
  grundies2 = grundies;

  grundies[cycleVert] = cand1;
  taken[adjlist[cycleVert][0]].insert(cand1);

  grundies2[cycleVert] = cand2;
  taken2[adjlist[cycleVert][0]].insert(cand2);

  if (possible(adjlist[cycleVert][0], grundies, taken) ||
      possible(adjlist[cycleVert][0], grundies2, taken2)) printf("POSSIBLE\n");
  else printf("IMPOSSIBLE\n");
  return 0;
}


Measured memory_bytes: 54912
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        int M = sc.nextInt();
        int[] L = new int[M];
        int[] R = new int[M];
        int Lmax = 0;
        int Rmin = N;
        for(int i = 0; i < M; i++){
            L[i] = sc.nextInt();
            R[i] = sc.nextInt(); 
            Lmax = Math.max(Lmax, L[i]);
            Rmin = Math.min(Rmin, R[i]);
        }
        System.out.println(Lmax <= Rmin ? Rmin - Lmax + 1 : 0);
    }
}

Measured memory_bytes: 64968