akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;

int main()
{
  int n;
  cin >> n;
  map<int, int> m;
  ll ans = 0;
  rep(i, n)
  {
    int a;
    cin >> a;
    ans += m[a-i];
    m[-a-i]++;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 20656
#include <iostream>
#include <vector>
#include <map>
#include <cstring>
#include <string>
#include <stack>
#include <queue>
#include <cmath>
#include <cstdlib>
#include <cstdio>
#include <algorithm>
#include <sstream>
#include <set>
using namespace std;

#define rep(i,n) for(int i=0;i<(int)n;i++)
#define repp(i,k,n) for(int i=k;i<(int)n;i++)
#define rei(n) for(int i=0;i<(int)n;i++)
#define rel(n) for(int l=0;l<(int)n;l++)
#define al(s) s.begin(),s.end()
#define INT_MAX 2147483647

typedef pair<long long, int> plli;
priority_queue<plli,vector<plli> >a;
priority_queue<plli, vector<plli> >A;
long long ans[100001] = {};
long long sco[100001] = {};
int main()
{
	int n, r, l;
	cin >> n >> r >> l;
	for (int i = 1; i <= n; i++)
	{
		a.push(plli(0,(-1)*i ));
	}
	int b = 0;
	for (int i = 0; i < r; i++)
	{
		int d, t, x;
		cin >> d >> t >> x;
		while (1)
		{
			if (sco[a.top().second*(-1)] != a.top().first)a.pop();
			else break;
		}
		ans[a.top().second*-1] += t - b;
		b = t;
		sco[d] += x;
		a.push(plli(sco[d], d*(-1)));
	}
	while (1)
	{
		if (sco[a.top().second*(-1)] != a.top().first)a.pop();
		else break;
	}
	ans[a.top().second*(-1)] += l - b;
	long long ANS = -99999999999999999;
	int num=0;
	for (int i = 100000; i >0; i--)
	{
		if (ans[i] >= ANS)
		{
			ANS = ans[i];
			num = i;
		}
	}
	//for (int i = 1; i <= 3; i++)cout << ans[i] << endl;
	cout << num << endl;
}

Measured memory_bytes: 20352
#include <iostream>

using namespace std;

int main() {
    int a, b, c, N;

    while (cin >> a >> b >> c) {
        if ((a | b | c) == 0) break;

        cin >> N;

        int parts[a + b + c + 1];
        int checks[N][4];

        fill(parts, parts + a + b + c + 1, 2);

        for (int i = 0; i < N; i++) {
            for (int j = 0; j < 4; j++) {
                cin >> checks[i][j];
            }
        }

        bool update;
        while (true) {
            update = false;
            for (int ii = 0; ii < N; ii++) {
                int i, j, k, r;
                i = checks[ii][0];
                j = checks[ii][1];
                k = checks[ii][2];
                r = checks[ii][3];
                if (r == 1) {
                    parts[i] = 1;
                    parts[j] = 1;
                    parts[k] = 1;
                    checks[ii][3] = -1;
                    update = true;
                } else if (r == 0) {
                    if (parts[i] == 2 && parts[j] == 1 && parts[k] == 1) {
                        parts[i] = 0;
                        checks[ii][3] = -1;
                        update = true;
                    } else if (parts[i] == 1 && parts[j] == 2 && parts[k] == 1) {
                        parts[j] = 0;
                        checks[ii][3] = -1;
                        update = true;
                    } else if (parts[i] == 1 && parts[j] == 1 && parts[k] == 2) {
                        parts[k] = 0;
                        checks[ii][3] = -1;
                        update = true;
                    }
                }
            }
            if (!update) break;
        }

        for (int i = 1; i < a + b + c + 1; i++)
            cout << parts[i] << endl;
    }
}



Measured memory_bytes: 3088
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

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

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

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

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

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

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

fn main() {
    input!{
        n: usize,
        a: usize,
        b: usize,
    }
    let mut total = 0;
    for i in 1..n+1 {
        let mut j = i;
        let mut sum = 0;
        while j > 0 {
            sum += j % 10;
            j /= 10;
        }
        if sum >= a && sum <= b {
            total += i;
        }
    }
    println!("{}", total);
}


Measured memory_bytes: 4352
n = int(input())

dic = {}
for i in range(n):
  s = ''.join(sorted(list(input())))
  if not s in dic:
    dic[s] = 1
  else:
    dic[s] += 1

res = 0
for v in dic.values():
  if v >= 2:
    res += v*(v-1)
print(res//2)

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

typedef long long ll;
#define rep(i,n) for(int i=0;i<(int)n;++i)

int main() {
    int n,m;cin>>n>>m;
    vector<int>a;
    vector<int>b;
    vector<int>c;    
    rep(i,m){
        int tmp1,tmp2;cin>>tmp1>>tmp2;
        if(tmp1 == 1)a.push_back(tmp2);
        if(tmp2 == n)b.push_back(tmp1);        
    }
    int na = a.size();
    int nb = b.size();

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

    if(na>0)c.push_back(a[0]);
    if(nb>0)c.push_back(b[0]);    
    
    for(int i=1;i<na;++i)if(a[i]!=a[i-1])c.push_back(a[i]);
    for(int i=1;i<nb;++i)if(b[i]!=b[i-1])c.push_back(b[i]);
    
    sort(c.begin(),c.end());
    int nc = c.size();
    rep(i,nc-1)if(c[i+1]==c[i]){
      cout<<"POSSIBLE"<<endl;
      return 0;
    }

    cout<<"IMPOSSIBLE"<<endl;
	return 0;
    
}



Measured memory_bytes: 5084
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int r;
  cin >> r;
  if( r >= 2800){
    cout << "AGC";
  }
  else if (r >=1200){
    cout << "ARC";
  }
  else{
    cout << "ABC";
  }
}

Measured memory_bytes: 256
s, t = gets.chomp.split(" ")
a, b = gets.chomp.split(" ").map {|c| c.to_i}
u = gets.chomp

if u == s
  puts (a-1).to_s + " " + b.to_s
else
  puts a.to_s + " " + (b-1).to_s
end

Measured memory_bytes: 1788
#define _USE_MATH_DEFINES
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <ctype.h>
#include <limits.h>    
#define inf 100000000
#define INF 9223372036854775807
#define EPS 1e-10
#define sq(n) ((n)*(n))
#define rep(i,n) for(i=0;i<n;i++)
#define rev(i,n) for(i=n-1;i>=0;i--)
#define sort(a,n) qsort(a,n,sizeof(TYPE),cmp)
#define sort_r(a,n) qsort(a,n,sizeof(TYPE),cmp_r);
#define chsort(s,n) qsort(s,n,sizeof(char),cmp)
#define chsort_r(s,n) qsort(s,n,sizeof(char),char_cmp_r);
#define TYPE int
#define MEMSET(a) memset(a,0,sizeof(a))
const int mod=(int)1e09+7;

int in(void){
    int i;scanf("%d",&i);
    return i;
}
long long llin(void){
    long long i;scanf("%lld",&i);
    return i;
}
double din(void){
    double i;scanf("%lf",&i);
    return i;
}
void chin(char s[]){
    scanf("%s",s);
}
void print(int a){
    printf("%d\n",a);
}
void llprint(long long a){
    printf("%lld\n",a);
}
void dprint(double a){
    printf("%.10f\n",a);
}
void print2(int a,int b){
    printf("%d %d\n",a,b);
}
long long max(long long a,long long b){
    return a>b?a:b;
}
long long min(long long a,long long b){
    return a<b?a:b;
}
double dmax(double a,double b){
    return a>b?a:b;
}
int cmp(const void *a,const void *b){
    return *(TYPE *)a-*(TYPE *)b;
}
int cmp_r(const void *a,const void *b){
    return *(TYPE *)b-*(TYPE *)a;
}
int char_cmp(const void *a,const void *b){
    return strcmp((char *)a,(char *)b);
}
int char_cmp_r(const void *a,const void *b){
    return strcmp((char *)b,(char *)a);
}
void swap(int *a,int *b){
    int t=*a;
    *a=*b;
    *b=t;
}
long long gcd(long long x,long long y){
    return x%y?gcd(y,x%y):y;
}
long long lcm(long long x,long long y){
    return x/gcd(x,y)*y;
}

// write codes below this
// when you use 'sort',
// make sure TYPE macro is correct
int x[2000000],y[2000000];

int main(void){
    int n,m,i,j,h[1501],w[1501],ans;
    while(1){
        n=in(),m=in();
        if(!n)break;
        MEMSET(x);
        MEMSET(y);
        h[0]=0,w[0]=0;
        rep(i,n){
            h[i+1]=in();
            h[i+1]+=h[i];
        }
        rep(i,m){
            w[i+1]=in();
            w[i+1]+=w[i];
        }
        rep(i,n+1){
            for(j=i+1;j<n+1;j++)
                x[h[j]-h[i]]++;
        }
        rep(i,m+1){
            for(j=i+1;j<m+1;j++)
                y[w[j]-w[i]]++;
        }
        ans=0;
        rep(i,2000000)ans+=x[i]*y[i];
        print(ans);
    }
    return 0;
}


Measured memory_bytes: 17348
#include<bits/stdc++.h>
using namespace std;
void print_err() {
	cerr << "\n";
}
template <class T, class... Arg>
void print_err(T x, Arg&&... args) {
	cerr << x << " ";
	print_err(args...);
}
template<class T>
void print_container(T &cont) {
	for (auto iter : cont) {
		cerr << iter << " ";
	}
	cerr << "\n";
}
#ifdef local
#define debug(...) print_err(_VA_ARGS_)
#define debug_c(container) print_container(container)
#else
#define debug(...)
#define debug_c(container)
#endif
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define mod 1000000009
#define ll long long int
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define pll pair<ll,ll>
#define vl vector<ll>
#define vpll vector<pair<ll,ll>>
#define mll map<ll,ll>
#define mllrev map<ll,ll,greater<int>>
#define ps(x,y) fixed<<setprecision(y)<<x
#define w(t) ll t;cin>>t;while(t--)
#define fo(i,n) for(ll i=0;i<n;++i)
#define foab(i,a,b) for(ll i=a;i<b;++i)
#define inp cin>>
#define pr cout<<
#define all(A) (A).begin(),(A).end()
#define fastio ios_base::sync_with_stdio(NULL);cin.tie(NULL);cout.tie(NULL);
class Graph {
public:
	list<ll> *adj_list;
	ll v;
	Graph(ll v) {
		this->v = v;
		adj_list = new list<ll>[v];
	}
	void add_edge(ll u, ll v, bool bidirectional = true) {
		adj_list[u].push_back(v);
		if (bidirectional) {
			adj_list[v].push_back(u);
		}
	}
	void print();
	void connected_compo();
	void dfs(vector<vector<ll>> vect, ll k1, ll k2, ll n);
	void bfs(ll v, bool visited[]);
};
int dp[3001][3001];
int recursive(string &str1, string &str2, int n, int m) {
	if (n == 0 || m == 0) {
		return 0;
	}
	if (dp[n][m] != -1) {
		return dp[n][m];
	}
	if (str1[n - 1] == str2[m - 1]) {
		return dp[n][m] = 1 + recursive(str1, str2, n - 1, m - 1);
	} else {
		return dp[n][m] = max(recursive(str1, str2, n - 1, m), recursive(str1, str2, n, m - 1));
	}
	return dp[n][m];
}
void solve() {
	memset(dp, -1, sizeof(dp));
	ll n, m;
	string str1, str2;
	cin >> str1 >> str2;
	n = str1.size(); m = str2.size();
	// cout << str1 << " " << str2 << endl;
	ll temp = recursive(str1, str2, n, m);
	string ans = "";
	ll i = n, j = m;
	// cout << dp[n][m];
	while (i != 0 and j != 0) {
		if (str1[i - 1] == str2[j - 1]) {
			ans.pb(str1[i - 1]);
			i--;
			j--;
		} else {
			if (dp[i - 1][j] > dp[i][j - 1]) {
				i--;
			} else {
				j--;
			}
		}
	}
	reverse(ans.begin(), ans.end());
	cout << ans << endl;
	// return;
}
//Rod cutting problem test case
// 5
// 100
// 23 15 50
// 4000
// 3 4 5
// 7
// 5 5 2
// 4
// 2 1 1
// 5
// 5 3 2
int main() {
	fastio
#ifdef local
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	freopen("error.txt", "w", stderr);
#endif
	// w(t) {
	solve();
// }
	return 0;
}

Measured memory_bytes: 39244
#include <stdio.h>
main(){
  int a[100],i,j,tmp,len,min,count=0;

  scanf("%d",&len);
  for(i=0; i<len; i++)
    scanf("%d",&a[i]);

  for(i=0; i<len; i++){
    min=i;
    for(j=i; j<len; j++){
      if(a[j]<a[min])
	min=j;
    }
    tmp=a[i];
    a[i]=a[min];
    a[min]=tmp;
    if(min!=i) count++;
  }
  for(i=0; i<len-1; i++)
    printf("%d ",a[i]);
  printf("%d\n%d\n",a[len-1],count);
  return 0;
}

Measured memory_bytes: 600
#include <iostream>
#include <stdio.h>
#include <cstring>
#include <cstdio>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string>
#include <stdlib.h>
#include <queue>
#include <stack>
#include <utility>
#include <fstream>
#include <random>
#include <map>
#include <unordered_map>
#include <cstdlib>
#include <functional>
#include <random>
#include <time.h>
#include <chrono>
#include <sstream>
#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 FOR(i,a,b) for(int i=a;i<b;i++)
#define ll long long
#define INF 1000000001
#define mod 1000000007
#define SORT(s) sort(s.begin(), s.end());
#define reverse(s) reverse(s.begin(), s.end());
#define P pair<int,int>
#define mp make_pair
#define valid(x,y,h,w) (0<=x&&x<h&&0<=y&&y<w)
int dx[4] = { 0,1,0,-1 };
int dy[4] = { 1,0,-1,0 };
using namespace std;
int POW(int x, int y) { return int(pow(double(x), double(y))); }
double log(double a, double b) { return log(b) / log(a); }




int main() {
	int n, k;
	cin >> n >> k;
	vector<int> s(n);
	rep(i, n) {
		char z;
		cin >> z;
		if (z == '0') {
			s[i] = 0;
		}
		else {
			s[i] = 1;
		}
	}


	vector<int> x;
	int now = s[0];
	int c = 0;
	rep(i, n) {
		if (s[i] == now) {
			c++;
		}
		else {
			now = s[i];
			if(c > 0)x.push_back(c);
			c = 1;
		}
	}
	if (c > 0)x.push_back(c);
	int ans = 0;
	int current = 0;

	if (s[0] == 1) {
		rep(i, 2 * k + 1) {
			if (i == x.size()) {

				cout << n << endl;
				return 0;
			}
			current += x[i];
		}
		ans = max(ans, current);
		int top = 2 * k + 1;
		int bottom = 0;
		while (1) {
			current -= x[bottom] + x[bottom + 1];
			if (top >= x.size()) {
				break;
			}
			else if(top == x.size() - 1) {
				current += x[top];
				ans = max(ans, current);
				break;
			}
			current += x[top] + x[top+1];
			ans = max(ans, current);
			top += 2;
			bottom += 2;
		}
		cout << ans << endl;
		return 0;
	}
	else {

		rep(i, 2 * k) {
			if (i == x.size()) {

				cout << n << endl;
				return 0;
			}
			current += x[i];
		}
		ans = max(ans, current);
		int top = 2 * k;
		int bottom = 0;


		current -= x[bottom];
		if (top >= x.size()) {

			cout << ans << endl;
			return 0;
		}
		else if (top == x.size() - 1) {
			current += x[top];
			ans = max(ans, current);

			cout << ans << endl;
			return 0;
		}
		current += x[top] + x[top + 1];
		ans = max(ans, current);
		top += 2;
		bottom += 1;


		while (1) {
			current -= x[bottom] + x[bottom + 1];
			if (top == x.size()) {
				break;
			}
			else if (top == x.size() - 1) {
				current += x[top];
				ans = max(ans, current);
				break;
			}
			current += x[top] + x[top + 1];
			ans = max(ans, current);
			top += 2;
			bottom += 2;
		}
		cout << ans << endl;
		return 0;
	}

}



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


int main() {
  int n; cin >> n;
  int m =0, s=0;
  vector<int> p(n);
  for (int i = 0; i < n; i++) {
    cin >> p[i];
    s += p[i];
    m = max(p[i],m);

  }
  int ans = s - m/2;

  cout << ans << endl;
  return 0;

}
  

Measured memory_bytes: 256
use std::io::Read;

fn gcd(a:i64, b:i64) -> i64 {
    if b == 0 {
        a
    }else {
        gcd(b, a % b)
    }
}

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();
    let mut iter = buf.split_whitespace();
    let a:i64 = iter.next().unwrap().parse().unwrap();
    let b:i64 = iter.next().unwrap().parse().unwrap();
    println!("{}", a/gcd(a,b)*b);
}


Measured memory_bytes: 4352
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication4
{
    class Program
    {
        static int Main()
        {
            var read = Console.ReadLine();
            string[] split = read.Split(' ');
            string alast = split[0].Substring(split[0].Length - 1);
            if (split[0].Substring(split[0].Length-1) == split[1][0].ToString())
                if (split[1].Substring(split[1].Length-1) == split[2][0].ToString())
                {
                    Console.WriteLine("YES");
                    return 0;
               }
            Console.WriteLine("NO");
            return 0;

        }
    }
}


Measured memory_bytes: 11092
#include <iostream>
#include <iomanip> //! for setprecision(10)
#include <math.h>
#include <algorithm>
#include <functional> 
#include <string>
#include <vector>

#include <cstring>
#include <set>
#include <map>
#include <queue>
#include <utility>

using namespace std;

typedef long long LL;

#define dump(c) { for (auto it = c.begin(); it != c.end(); ++it) if (it == c.begin()) cout << *it; else cout << ' ' << *it; cout << endl; } 
#define rep(i,n) for (int i = 0; i < (n); ++i)

const int MOD = 1000000007;

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

    LL X;
    cin >> X;

    LL ans = 0;
    LL x = 100;
    while (x < X) {
        x += x/100;
        ++ans;
    }

    cout << ans << endl;

    return 0;
}


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

#define ll long long

int main() {
    using namespace std;
    ll n, best;
    cin >> n;
    best = n;
    for(ll i = 1; i * i <= n; i++)
        if(n % i == 0)
            best = min(best, i + n / i - 2);
    cout << best << "\n";
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define mp make_pair
#define f first
#define se second
#define pb push_back
#define ms memset
#define MOD 1000000007
#define MOD2 1000000009
#define sp fixed<<setprecision
#define sz(x) (int)(x).size()
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
ll fpow(ll x,ll y,ll p=MOD){x=x%p;ll sum=1;while(y){if(y&1)sum=sum*x;sum%=p;y=y>>1;x=x*x;x%=p;}return sum;}
ll inv(ll a,ll m=MOD){ll c=m;ll y=0,x=1;if(m==1)return 0;while(a>1){ll q=a/m;ll t=m;m=a%m,a=t;t=y;y=x-q*y;x=t;}if(x<0)x+=c;return x;}
ll add(ll a, ll b) {if(a<0)a+=MOD; if(b<0)b+=MOD; return (a%MOD + b%MOD + MOD)%MOD;}
ll sub(ll a, ll b) {if(a<0)a+=MOD; if(b<0)b+=MOD; return (a%MOD - b%MOD + MOD)%MOD;}
ll mul(ll a, ll b) {if(a<0)a+=MOD; if(b<0)b+=MOD; return ((a%MOD)*(b%MOD) + MOD)%MOD;}
void setIO(string name = "") {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    if (sz(name)) {
        freopen((name+".in").c_str(), "r", stdin);
        freopen((name+".out").c_str(), "w", stdout);
    }
}
int main(){
    setIO();
    ll n;
    cin>>n;
    vector<pair<ll,ll> >v(n);
    vector<pair<ll,ll> >sum,dif;
    for(int i=0;i<n;i++){
      cin>>v[i].f>>v[i].se;
      sum.pb({v[i].f+v[i].se,i});
      dif.pb({v[i].f-v[i].se,i});
    }
    sort(all(sum));
    sort(all(dif));
    ll res=LLONG_MIN;
    ll x=sum[0].se;
    ll y=sum[sum.size()-1].se;
    res=max(res,abs(v[x].f-v[y].f)+abs(v[x].se-v[y].se));
    x=dif[0].se;
    y=dif[dif.size()-1].se;
    res=max(res,abs(v[x].f-v[y].f)+abs(v[x].se-v[y].se));
    cout<<res;
}


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

// 座標に関する問題は位置関係の制約をよく確認する

int sx, sy, tx, ty;

void xmove(int start, int goal) {
	for (int x = start; x != goal; ) {
		if (goal - x < 0) {
			cout << 'L';
			x--;
		}
		else {
			cout << 'R';
			x++;
		}
	}
}

void ymove(int start, int goal) {
	for (int y = start; y != goal; ) {
		if (goal - y < 0) {
			cout << 'D';
			y--;
		}
		else {
			cout << 'U';
			y++;
		}
	}
}


signed main() {
	cin >> sx >> sy >> tx >> ty;

	xmove(sx, tx);
	ymove(sy, ty);
	xmove(tx, sx);
	ymove(ty, sy);

	cout << 'D';
	xmove(sx, tx + 1);
	ymove(sy - 1, ty);
	cout << 'L';
	cout << 'U';
	xmove(tx, sx - 1);
	ymove(ty + 1, sy);
	cout << 'R';

	cout << endl;
}



Measured memory_bytes: 256
#include <stdio.h>
  
int main(){
  int a,b;
  //1=<a,b=<10000なる整数から良い
  scanf("%d %d", &a,&b);
  if(a*b % 2 == 1){
    printf("Odd");
  }else{
    printf("Even");
  }
  return 0;
}

Measured memory_bytes: 128
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;

int main(int argc, char* argv[]){
    map<string, int> B, R;
    int N, M, tmp, mx = 0;
    string s;
    vector<string> keys;
    cin >> N;
    for(int i = 0; i < N; i++){
        cin >> s;
        if(!(find(keys.begin(), keys.end(), s) != keys.end())){
            B[s] = 1;
            R[s] = 0;
            keys.push_back(s);
        }
        else B[s] += 1;
    }
    cin >> M;
    for(int i = 0; i < M; i++){
        cin >> s;
        if(find(keys.begin(), keys.end(), s) != keys.end()) R[s] += 1;
    }
    for(int i = 0; i < keys.size(); i++){
        tmp = B[keys[i]] - R[keys[i]];
        if(mx < B[keys[i]] - R[keys[i]]) mx = B[keys[i]] - R[keys[i]];
    }
    cout << mx << endl;
}

Measured memory_bytes: 256
n=gets.to_i
dparray=[]
alarray="abcdefghijk".split("")

10.times{
    dparray.push([])
}

dparray[0]=["a"]

9.times{|i|
    dparray[i].map.with_index{|value,index|
        uniqcount=value.split("").uniq.count
        
        (uniqcount+1).times{|k|
            dparray[i+1].push(value+alarray[k])
        }
    }
}


dparray[n-1].map{|value|
    puts value
}

Measured memory_bytes: 21884
#include <inttypes.h>
#include <math.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(void)
{
    char S[4];

    gets(S);

    if (strcmp("ABC", S) == 0) {
        puts("ARC");
    } else {
        puts("ABC");
    }

    return 0;
}


Measured memory_bytes: 1976
import sys
input = sys.stdin.readline

def main():
    a, b, c, x = [int(input()) for i in range(4)]
    ans = 0
    for i in range(a + 1):
        for j in range(b + 1):
            for k in range(c + 1):
                if i * 500 + j * 100 + k * 50 == x:
                    ans += 1
    print(ans)
            


if __name__ == "__main__":
    main()

Measured memory_bytes: 3060
#include <string.h>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <iterator>
#include <functional>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <cstdlib>
#include <cstdio>
using namespace std;
#define sz(a)  int((a).size())
#define all(a) a.begin(), a.end()
#define pb push_back
#define mp make_pair
#define CLR(a) memset((a), 0, sizeof(a))
#define INF (1 << 31) - 1
const int dh[8] = {-1, 1, 0, 0,1,1,-1,-1};
const int dw[8] = {0, 0, 1, -1,1,-1,1,-1};
typedef long long ll;
typedef pair<int, int> p;
typedef vector <int> VI;
typedef vector <string> VS;


int main(){

	int n;
	cin >> n;

	VI count(26,100);
	for(int i = 0; i < n; i++){
		string tmp;
    cin >> tmp;

    VI c(26, 0);
    for(int j = 0; j < tmp.size(); j++){
      c[tmp[j] - 'a']++;  
    }

    for(int j = 0; j < 26; j++){
      count[j] = min(count[j], c[j]);
    }
	}
	
  string ans;
	for(int i = 0; i < 26; i++){
    while(count[i] != 0){
      ans += (i + 'a');
      count[i]--;
    }
  }

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


Measured memory_bytes: 256
/*"Success isn't permanent, failure isn't fatal,
                                      it's the courage to continue that counts"*/
#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;
//typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
#define ll long long 
#define scn(n) scanf("%d",&n)
#define lscn(n) scanf("%lld",&n)
#define lpri(n) printf("%lld",n)
#define pri(n) printf("%d",n)
#define pln() printf("\n")
#define priln(n) printf("%d\n",n)
#define lpriln(n) printf("%lld\n",n)
#define rep(i,init,n) for(int i=init;i<n;i++)
#define pb push_back     
#define mp make_pair
#define F first
#define S second
#define gcd __gcd
#define inf INT_MAX
#define ninf INT_MIN
const int mod=998244353;         
const int N=2e5+4;

int main()
{
	int n;

	scn(n);

	pri((n+1)/2);
	
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define vi vector<int>
#define vll vector<ll>
using namespace std;
void solve()
{
	int n;cin>>n;
	vi dp(n),a(n);
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	dp[0]=0;
	dp[1]=abs(a[0]-a[1]);
	for(int i=2;i<n;i++){
	dp[i]=min(dp[i-1]+abs(a[i]-a[i-1]),dp[i-2]+abs(a[i]-a[i-2]));
	}
	cout<<dp[n-1];
}
int main()
{
	//int t;cin>>t;
	//while(t--)
	solve();
}

Measured memory_bytes: 1024
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <tuple>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <numeric>
#include <string.h>
#define rep(i, x) for (int i = 0; i < (int)(x); i++)
#define repn(i, x) for (int i = 1; i <= (int)(x); i++)
#define repr(i, x) for (int i = ((int)(x) - 1); i >= 0; i--)
#define reprn(i, x) for (int i = ((int)(x)); i > 0; i--)
#define all(x) (x).begin(),(x).end()
typedef long long int64;
using namespace std;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<29;
const long long INFL = 1e18;
const int MOD = 1000000007;
const int MAX = 210000;

int gcd(int a, int b) {
    return b != 0 ? gcd(b, a % b) : a;
}

//逆元を求める関数
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++) {
      fac[i] = fac[i-1] * i % MOD;
      inv[i] = MOD - inv[MOD%i] * (MOD/i) % MOD;
      finv[i] = finv[i-1] * inv[i] % MOD;
    }
}
//組み合わせ
long long COM (int n, int k) {
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n-k] % MOD) % MOD;
}

void solve() {
		int h, n; cin >> h >> n;
		vector<int> dp(h + 1, INF);
		dp[0] = 0;
		rep (i, n) {
			int a, b; cin >> a >> b;
			rep (j, h) {
				//モンスターのhpがjの時にaの魔法を使った場合で遷移する
				//オーバーキルする時はhに遷移
				int nj = min(j + a, h);
				//モンスターのhpがnjに遷移する時、a番目の魔法を使った場合
				//a番目の魔法を使わなかった場合のコストの最小値を取得する
				dp[nj] = min(dp[nj], dp[j] + b);
			}
		}
		cout << dp[h] << endl;
    return;
}

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



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

using namespace std;
using ll = long long;

const long long inf = 1e9;
#define fr(i,a,n) for (int i=a;i<n;i++)
#define rfr(i,n,a) for (int i=n;i>=a;i--)
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define pll pair<ll,ll> 
#define endl "\n"
typedef vector<int> VI;
typedef vector<ll> VL;
typedef priority_queue<int> Pqi;
typedef priority_queue<ll> Pql;

ll n, m, k;
int dp[3001][3001];
int main () {
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	string s,t;
	cin >> s >> t;
	n = s.length(),m = t.length();
	//memset(dp,-1,sizeof dp);
	fr(i,1,n+1) {
		fr(j,1,m+1) {
			if (s[i-1] == t[j-1]) {
				dp[i][j] = dp[i-1][j-1] + 1;
			}
			else {
				dp[i][j] = max(dp[i][j-1],dp[i-1][j]);
			}
		}
	}
	// cout << "    ";
	// fr(i,0,m) {
	// 	cout << t[i] <<"   ";
	// }
	// cout << endl;
	// fr(i,0,n) {
	// 	cout << s[i] << "   ";
	// 	fr(j,0,m) {
	// 		cout << dp[i+1][j+1] << "   ";
	// 	}
	// 	cout << endl;
	// }
	string ans = "";
	int i = n,j = m;
	// cout << dp[n][m] << endl;
	// cout << dp[n][m-1] << endl;
	// cout << dp[n-1][m] << endl;
	while(i && j) {
		//cout << ans << endl << i << " " << j << endl;
		if (dp[i][j] > dp[i-1][j] && dp[i][j] > dp[i][j-1]) {
		//	cout << 1 << endl;
			ans += s[i-1];
			i--;
			j--;
			continue;
		}
		if (dp[i][j-1] > dp[i-1][j]) {
		//	cout << 2 << endl;
			j--;
		}
		else {
		//	cout << 3 << endl;
			i--;
		}
	}	
	reverse(ans.begin(),ans.end());
	cout << ans << endl;
 	return 0;
}

Measured memory_bytes: 35456
#include<bits/stdc++.h>
#include<iostream>
#include<string>
#include<cmath>
#include<cstdio>
#include<cctype>
#include<cstring>
#include<iomanip>
#include<cstdlib>
#include<ctime>
#include<set>
#include<map>
#include<utility>
#include<queue>
#include<vector>
#include<stack>
#include<sstream>
#include<algorithm>
#define forn(i,a,b)for(int i=(a),_b=(b);i<=_b;i++)
#define fore(i,b,a)for(int i=(b),_a=(a);i>=_a;i--)
#define rep(i,n)for(int i=0,_n=n;i<n;i++)
#define ll long long
#define pii pair<int,int>
#define vi vector<int>
#define vpii vector<pii>
#define m_p make_pair
#define re return
#define pb push_back
#define si set<int>
#define ld long double
#define X first
#define Y second
#define st string
#define ull unsigned long long
#define mod 1000000007
#define INF 1000000007
#define x1 XZVJDFADSPFOE
#define y1 GASDIJSLDAEJF
#define x2 DFDAJKVOHKWIW
#define y2 PSFSAODSXVNMQ
#define LLINF 0x3f3f3f3f3f3f3f3fLL
using namespace std;
inline void read(int &x)
{
	short negative=1;
    x=0;
    char c=getchar();
    while(c<'0' || c>'9')
    {
		if(c=='-')
			negative=-1;
		c=getchar();
	}
    while(c>='0' && c<='9')
        x=(x<<3)+(x<<1)+(c^48),c=getchar();
    x*=negative;
}
ll quickpower(ll n,ll k){
	ll ans=1;
	while(k){
		if(k%2){
			ans*=n;
			ans%=mod;
		}
		n*=n;
		n%=mod;
		k/=2;
	}
	return ans;
}
string int_to_string(int n)
{
	string s="";
	while(n)
	{
		int now=n%10;
		s+=now+'0';
		n/=10;
	}
	reverse(s.begin(),s.end());
	return s;
}
int string_to_int(string s)
{
	int n=0;
	rep(i,s.size())
	{
		n*=10;
		n+=s[i]-'0';
	}
	return n;
}
int n;
ll k;
int a[200100]; 
int D[200100][111];
int main()
{
	ios::sync_with_stdio(0);
	//think twice,code once
	cin>>n>>k;
	rep(i,n)
	{
		int b;
		cin>>b;
		b--;
		D[i][0]=b;
	}
	forn(i,1,65)
	{
		rep(j,n)
		{
			D[j][i]=D[D[j][i-1]][i-1];
		}
	}
	int now=0;
	int  cnt=-1;
	while(k>0)
	{
		cnt++;
		if(k%2)
		{
			now=D[now][cnt];
			k--;
		}
		k/=2;
	}
	cout<<now+1<<endl;
	return 0;
}



Measured memory_bytes: 90344
n = int(input())
l = [list(map(int, input().split())) for _ in range(n)]

l = [[l[i][2], l[i][0], l[i][1]] for i in range(n)]
l.sort(reverse=True)

for x in range(101):
    for y in range(101):
        h = l[0][0] + abs(x-l[0][1]) + abs(y-l[0][2])
        for i in range(1, n):
            if l[i][0] != max(h-abs(x-l[i][1])-abs(y-l[i][2]), 0):
                break
        else:
            print(str(x) + " " + str(y) + " " + str(h))
            exit()

Measured memory_bytes: 3064
ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

class UnionFind:
    def __init__(self,n):
        self.n = n
        self.d = [-1] * n

    def find(self, x):
        if(self.d[x] < 0):
            return x
        self.d[x] = self.find(self.d[x])
        return self.d[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if(x == y):
            return False
        if(self.d[x] > self.d[y]):
            x, y = y, x
        self.d[x] += self.d[y]
        self.d[y] = x
        return True

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def size(self,x):
        return -self.d[self.find(x)]

n = ii()

uf = UnionFind(n)
path = [] # d,s,t

xaxis = []
yaxis = []

ans = 0
cnt = 0

for i in range(n):
    x,y = mi()
    xaxis.append([x, i])
    yaxis.append([y, i])

xaxis.sort()
yaxis.sort()

for k,i in enumerate(xaxis[1:]):
    d = i[0] - xaxis[k][0] 
    s = xaxis[k][1]
    t = i[1]
    if d != 0:
        path.append([d,s,t])
    else:
        if uf.same(s, t) == False:
            uf.union(s,t)
            cnt += 1

for k,i in enumerate(yaxis[1:]):
    d = i[0] - yaxis[k][0] 
    s = yaxis[k][1]
    t = i[1]
    if d != 0:
        path.append([d,s,t])
    else:
        if uf.same(s, t) == False:
            uf.union(s,t)
            cnt += 1

path.sort()

for i in path:
    if cnt == n-1:
        break
    d = i[0]
    s = i[1]
    t = i[2]
    if uf.same(s,t) == False:
        uf.union(s,t)
        cnt += 1
        ans += d

print(ans)







Measured memory_bytes: 131868
#include<bits/stdc++.h>
#define fi first
#define se second
#define show(x) cerr<<#x<<"="<<x<<"\n"
typedef long long ll;
template<typename T>
void print_to(std::ostream &os,const char *,const char *tail,const T &fst){
  os<<fst<<tail;
}
template<typename Fst,typename... Rst>
void print_to(std::ostream &os,const char *del,const char *tail,const Fst &fst,const Rst &... rst){
  os<<fst<<del;
  print_to(os,del,tail,rst...);
}
template<typename Iter>
void print_to_(std::ostream &os,const char *del,const char *tail,Iter bgn,Iter end){
  for(Iter it=bgn;it!=end;){
    os<<*it;
    if(++it!=end)os<<del;
    else os<<tail;
  }
}
template<typename Fst,typename... Rst>
void println(const Fst &fst,const Rst &... rst){
  print_to(std::cout,"\n","\n",fst,rst...);
}
template<typename Fst,typename... Rst>
void print(const Fst &fst,const Rst &... rst){
  print_to(std::cout," ","\n",fst,rst...);
}
template<typename Iter>
void println_(Iter bgn,Iter end){
  print_to_(std::cout," ","\n",bgn,end);
}
using namespace std;
//const ll MOD=(ll)1e9+7;
const ll inf=(ll)1e14;
const int dy[]={1,0,-1};
const int dx[]={1,0,-1};
int n,m,h,w;
string s;
int a[100001];
ll nowmin[100001];
map<ll,int> mp;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.precision(10);
  cout<<fixed;
#ifdef LOCAL_DEFINE
  FILE *stream1;
  //FILE *stream2;
  stream1=freopen("in","r",stdin);
  //stream2=freopen("out","w",stdout);
  if(stream1==NULL)return 0;
  //if(stream2==NULL)return 0;
#endif
  cin>>n>>m;
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  ll now=inf;
  for(int i=0;i<n;i++){
    nowmin[i]=min(now,(ll)a[i]);
    now=nowmin[i];
  }
  for(int i=0;i<n;i++){
    mp[(ll)a[i]-nowmin[i]]++;
  }
  int ans=0;
  ll nowmax=-inf;
  for(auto ite=mp.begin();ite!=mp.end();ite++){
    if(nowmax<ite->fi){
      nowmax=ite->fi;
      ans=ite->se;
    }
  }
  print(ans);
#ifdef LOCAL_DEFINE
  cerr<<"Time elapsed: "<<1.0*clock()/CLOCKS_PER_SEC<<"s.\n";
  fclose(stream1);
  //fclose(stream2);
#endif
  return 0;
}






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

#define db(x) cout<<x<<'\n'
#define db1(x) cout<<#x<<"="<<x<<'\n'
#define db2(x,y) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<'\n'
#define db3(x,y,z) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<","<<#z<<"="<<z<<'\n'
#define repi(i,n) for(int i=0;i<(n);++i)
//#define repA(i,a,n) for(int i=a;i<=(n);++i)
//#define repD(i,a,n) for(int i=a;i>=(n);--i)
#define ll long long int
#define endl '\n'
#define lld long long double
#define vi vector<int> 
#define vl vector<ll> 
#define vb vector<bool> 
#define vvi vector<vector<int>  >
#define err(t) cout<<"Error : "<<t<<endl;
#define all(v) v.begin(),v.end()
#define mp make_pair
#define M 100000
#define MD 1000000007
#define pb push_back
#define rep(i,a,b) for(ll i = a; i <= (b); i++)
#define pii pair<int,int>
#define pll pair<ll,ll> 
#define vec(a) vector<a >
#define se second
#define fi first
#define inf 0xffffffff
#define inchar getchar_unlocked
#define outchar(x) putchar_unlocked(x)

int32_t main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);cout.tie(NULL);
	// int n;cin>>n;
	// string s;cin>>s;
	
	//ll n;cin>>n; vl a(n); repi(i,n) cin>>a[i];
	int n,s;cin>>n>>s;
	if(n<=s) cout<<"unsafe\n"; else cout<<"safe\n";
	
	/*
	int q;cin>>q;while(q--){ 
		
	 }
	 //*/
return 0;
}



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

int main()
{
	stringstream ss;
    // 入力
    int H,W;
    cin>>H>>W;
    string S[H];
    for(int i=0;i<H;i++){
    	cin>>S[i];
    }
    int bomb_num[H][W];
    for(int i=0;i<H;i++){
    	for(int j=0;j<W;j++){
    		bomb_num[i][j]=0;
    		if(S[i][j]=='.'){
    			for(int k=0;k<3;k++){
    				for(int l=0;l<3;l++){
    					if(i+k-1>=0 && j+l-1>=0 && i+k-1<H && j+l-1<W){
    						if(S[i+k-1][j+l-1]=='#') bomb_num[i][j]++;
    					}
    				}
    			}
    			//cout<<bomb_num[i][j]<<endl;
	    		//S[i].replace(j,1,ssstr);
    		}
    	}
    }
    for(int i=0;i<H;i++){
    	for(int j=0;j<W;j++){
    		if(S[i][j]=='.'){
    		ss<<bomb_num[i][j];
    		S[i].replace(j,1,ss.str());
    		ss.str("");
    	}
    	}
    }
    for(int i=0;i<H;i++){
    	cout<<S[i]<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
// Original: https://github.com/tanakh/competitive-rs
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

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

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

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

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

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

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

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

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

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

mod util {
    #[allow(dead_code)]
    pub fn chmin<T>(x: &mut T, y: T) -> bool
    where
        T: PartialOrd + Copy,
    {
        *x > y && {
            *x = y;
            true
        }
    }

    #[allow(dead_code)]
    pub fn chmax<T>(x: &mut T, y: T) -> bool
    where
        T: PartialOrd + Copy,
    {
        *x < y && {
            *x = y;
            true
        }
    }

    /// 整数除算切り上げ
    #[allow(dead_code)]
    pub fn roundup(a: i64, b: i64) -> i64 {
        (a + b - 1) / b
    }

    #[allow(dead_code)]
    pub fn ctoi(c: char) -> i64 {
        c as i64 - 48
    }
}

#[allow(unused_imports)]
use util::*;

#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, VecDeque};

fn main() {
    input! {
        n:usize,
        ass:[i64;n]
    }

    if ass.iter().min() != Some(&1) {
        println!("-1");
        std::process::exit(0);
    }

    let mut l = 0;
    let mut cur = 0;
    let mut ans = 0;
    while l < n {
        let mut r = l;
        while r < n && ass[r] != cur + 1 {
            r += 1;
        }
        cur += 1;
        ans += r - l;
        l = r + 1;
    }

    println!("{}", ans);
}


Measured memory_bytes: 6396
#include <iostream>
#include <math.h>
#include <numeric>
#include <vector>
#include <map>
#include <algorithm>
#include <queue>
#include <tuple>
#include <functional>
#include <cstring>

#define PI 3.14159265359
#define INF 1e9
#define LINF 1e18
#define irep(i,n) for(int  i = 0; i < n; i++)
#define irep2(i,a,n) for(int i = a; i < n; i++)
#define lrep(i,n) for(long long  i = 0; i < n; i++)
#define lrep2(i,a,n) for(long long i = a; i < n; i++)
#define in(a) cin >> a
#define out(a) cout << a << endl
typedef long long ll;

typedef std::vector<int> v_int;
typedef std::vector<std::vector<int> > v2_int;
typedef std::vector<ll> v_ll;
typedef std::vector<std::vector<ll> > v2_ll;
typedef std::vector<std::string> v_string;

using namespace std;

int main() 
{   
    int ans = 0;
    int x,y,z;
    cin >> x >> y >> z;

    int person = 0;
    for(int i = y; i <= x; i+=y) {
        person++;
        int d = i + ((person+1) * z);
        if(d <= x) { ans++; }
        else           { break;}
    }
    cout << ans << endl;
    return 0;
}
    



Measured memory_bytes: 256
#include <iostream> 
#include <string> 
#include <vector> 
#include <algorithm> 
#include <utility> 
#include <tuple> 
#include <cstdint> 
#include <cstdio> 
#include <map> 
#include <queue> 
#include <set> 
#include <stack> 
#include <deque> 
#include <unordered_map> 
#include <unordered_set> 
#include <bitset> 
#include <cctype> 
#include<math.h>
//#define int long long
#define m_p make_pair
#define mod 1000000007
#define rep(i,n)  for(int i=0; i<n; i++)
#define all(v)  v.begin(),v.end()
#define vecin(v) for(int i=0; i<v.size(); i++) cin>>v[i];
using namespace std;

int jousu(int, int);
int jousu(int x00, int y00) {
	int z00 = 1;
	for (int i = 0; i < y00; i++) {
		z00 *= x00;
	}
	return z00;
}
int kurai(int x00, int y00) {
	int z00 = (x00 % jousu(10, y00)) / jousu(10, y00 - 1);
	return z00;
}
int keta(int x00) {
	int z00 = x00;
	int w00 = 0;
	while (z00 != 0) {
		z00 /= 10;
		w00++;
	}
	return w00;
}



int main() {
	int  n, t=0;
	cin >> n;
	vector<int>vec1(n);
	vector<int>vec2(n);
	vector<int>vec3(n - 1);
	vecin(vec1);
	for (int i = 0; i < n; i++) {
		cin >> vec2[i];
		t += vec2[i];
	}
	vecin(vec3);
	for (int i = 0; i < n-1; i++) {
		if (vec1[i] + 1 == vec1[i+1]) {
			t += vec3[vec1[i]-1];
		}
	}
	cout << t << endl;
}


Measured memory_bytes: 256
n = int(input())
p = list(map(int, input().split()))
cnt = 0
for i in range(n-2):
    if p[i+1] > p[i] and p[i+1] < p[i+2]:
        cnt = cnt + 1
    if p[i+1] < p[i] and p[i+1] > p[i+2]:
        cnt = cnt + 1
print(cnt)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
#define repp(i, m, n) for(int i = m; i < n; i++)
#define reps(i, n) for(int i = 1; i <= n; i++)
const int    INF = 100000000;
const double EPS = 1e-10;
const int    MOD = 1000000007;
using namespace std;
typedef long long ll;
typedef pair<int, int> pai;
typedef pair<ll,ll> pal;



int main()
{
	ll q, h, s, d;
	cin >> q >> h >> s >> d;
	s=min(4*q, s);
	s=min(2*h, s);

	ll n;
	cin >> n;

	if(n%2==0) cout << min(n*s, (n/2)*d) << endl;
	else
	{
		cout << min(n*s, (n/2)*d+s) << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    vector<int>vec(n);
    for(int i=0;i<n;i++){
        cin>>vec.at(i);
    }
    reverse(vec.begin(),vec.end());
    for(int i=0;i<n-1;i++){
        cout<<vec.at(i)<<" ";
    }
    cout<<vec.at(n-1)<<endl;
}


Measured memory_bytes: 3096
import math

A,B,H,M =map(int, input().split())
if 1<=A<=1000 and 1<=B<=1000 and 0<=H<=11 and 0<=M<=59:
    hw=(2*math.pi)/(12*60*60) #時針の角速度[rad/s]
    mw=(2*math.pi)/(60*60) #分針の角速度[rad/s]
    time_h=H*60*60 #Hour時間[s] 
    time_m=M*60 #Min時間[s]
    aw=hw*(time_h+time_m) #Arad[rad] #最後の鬼門だった！！なるほどね！40min経ってる間に時針も進んでるから。。
    bw=mw*time_m #Brad[rad]
    rad=abs(bw-aw)
    # 正弦定理で出力結果を得る(a^2=b^2+c^2-2bccosθ)
    print(math.sqrt(A**2+B**2-2*A*B*math.cos(rad)))
    #確認用
    #print(time_h,time_m,aw,bw,rad) 
else: 
    print("各値の条件は次の通り:1<=A,B<=1000,0<=H<=11,0<=M<=59")
    print("あなたの入力:A={},B={},H={},M={}".format(A,B,H,M))

Measured memory_bytes: 9464
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;
int pos,n;
vector<int> pre,in,post;

void rec(int lo,int hi) //??????????????????
{
    if(lo>=hi)  //?????????
    return;
    int root=pre[pos++];
    int m=distance(in.begin(),find(in.begin(),in.end(),root));

    rec(lo,m);
    rec(m+1,hi);

    post.push_back(root);
}

void solve()
{
    pos=0;
    rec(0,pre.size());
    for(int i=0;i<n;i++)
    {
        if(i) cout<<" ";
        cout<<post[i];
    }
    cout<<endl;
}
int main()
{
    while(cin>>n)
    {
        for(int i=0;i<n;i++)
        {
            int j;cin>>j;
            pre.push_back(j);
        }
        for(int i=0;i<n;i++)
        {
            int j;cin>>j;
            in.push_back(j);
        }
        solve();
    }
}

Measured memory_bytes: 3168
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <iostream>

using namespace std;

const int IMAX = pow(2.0,31.0)-1;
const long long INF = 1LL<<60;

#define max(a,b) a>b?a:b
#define min(a,b) a<b?a:b

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; }


void strInit(char str[]);//str[]を0で初期化
void extIntStr(char str[],int data[]);//str[]から数値(int)を抽出しdata[]に順次格納
void incsort(int data[],int len);//data[]を昇順ソート
void decsort(int data[],int len);//data[]を降順ソート
void printIntArray(int data[],int len);//data[]をprint
int* inputArray(int n);//文字列を受け取り数値を抽出、n個の数値(int)を格納した配列のポインタをreturn
int* cpyArray(int data[],int len);//配列(int)を複製した配列のポインタをreturn

//don't forget free(data);

int N;
long long W, weight[110], value[110];

long long dp[110][100100] = {0};

int main() {
    cin >> N >> W;
    for(int i=0;i<N;i++)cin >> weight[i] >> value[i];

    for(int i=0;i<N;i++){
        for(int sw=0;sw<=W;sw++){
            if(sw-weight[i]>=0)chmax(dp[i+1][sw],dp[i][sw-weight[i]]+value[i]);
            chmax(dp[i+1][sw],dp[i][sw]);
        }
    }
    cout << dp[N][W];
}


void strInit(char str[]){
    int len=strlen(str);
    for(int i=0;i<len;i++){
        str[i]=0;
    }
}

void extIntStr(char str[],int data[]){
    int length=strlen(str);
    str[length-1]=' ';
    char buff[12];
    int j,index;
    index=j=0;
    for(int i=0;i<length;i++){
        if(str[i]!=' '){
            buff[j++]=str[i];
        }else{
            data[index++]=atoi(buff);
            strInit(buff);
            j=0;
        }
    }
}

void incsort(int data[],int len){
    for(int i=0;i<len-1;i++){
        for(int j=i+1;j<len;j++){
            if(data[i]>data[j]){
                int tmp=data[i];
                data[i]=data[j];
                data[j]=tmp;
            }
        }
    }
}

void decsort(int data[],int len){
    for(int i=0;i<len-1;i++){
        for(int j=i+1;j<len;j++){
            if(data[i]<data[j]){
                int tmp=data[i];
                data[i]=data[j];
                data[j]=tmp;
            }
        }
    }
}

void printIntArray(int data[],int len){
    for(int i=0;i<len;i++){
        printf("%d\n",data[i]);
    }
}

int* inputArray(int n){
    int *data;
    data=(int*)malloc(sizeof(int)*n);
    char *get;
    get=(char*)malloc(sizeof(char)*11*n+1);
    fgets(get,11*n+1,stdin);
    extIntStr(get,data);
    free(get);
    return data;
}

int* cpyArray(int data[],int len){
    int *cp;
    cp=(int*)malloc(sizeof(int)*len);
    for(int i=0;i<len;i++){
        cp[i]=data[i];
    }
    return cp;
}

//temp##############################################


Measured memory_bytes: 79360
<?php 
  fscanf(STDIN, "%d %d", $n, $m);
  $ac = array();
  $pena = array();
  
 for($i=0;$i<$m;$i++){
   $p = 0;
   $s = "";
   fscanf(STDIN, "%d %s", $p, $s);
   $p--;
   if($ac[$p]) continue;
   else if($s == "AC"){
     $ac[$p]++;
   }
   else{
     $pena[$p]++;
   }   
 }

$AC = 0; $PENA = 0;

for($i = 0;$i<$n;$i++){
 $AC += $ac[$i]; 
 if($ac[$i]){
   $PENA += $pena[$i];
 }
}

 echo $AC . " " . $PENA;  
  ?>

Measured memory_bytes: 13048
INF = 1e12

v, e = map(int, input().split())
cost = [[INF] * v for i in range(v)]
for i in range(v):
    cost[i][i] = 0

for i in range(e):
    si, ti, di = map(int, input().split())
    cost[si][ti] = di

for k in range(v):
    for i in range(v):
        for j in range(v):
            if cost[i][k] != INF and cost[k][j] != INF:
                cost[i][j] = min(cost[i][j], cost[i][k] + cost[k][j])

if any(cost[i][i] for i in range(v)):
    print('NEGATIVE CYCLE')
else:
    for di in cost:
        ldi = []
        for dij in di:
            if dij == INF:
                ldi.append('INF')
            else:
                ldi.append(str(dij))
        print(' '.join(ldi))

Measured memory_bytes: 7052