akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
#define INF 1000000010
#define EPS 1e-9
#define F first
#define S second

#define debug(x) cout<<x<<endl;
#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define lp(i,n) repi(i,0,n)
#define repn(i,n) for(int i=n;i>=0;i--)
#define int long long
#define endl "\n"

typedef pair<int,int> PII;
typedef pair<int,string> PIS;
typedef pair<string,int> PSI;


signed main(){
  cin.tie(0);	
  ios::sync_with_stdio(false);
  int n;
  cin>>n;
  rep(i,n){
    cout<<"ACL";
  }
  cout<<endl;

  return 0;
}


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

typedef long long ll;
typedef long double ld;

#define rep(i,init,n) for(int i=init;i<n;i++)
#define rev(i,n,init) for(int i=n;i>=init;i--)
#define max(a,b) (a>b ? a : b)
#define min(a,b) (a<=b ? a : b)


#define pb push_back
#define f first
#define s second
const int N = 1e5+5;
using namespace std;
int tb[3][N];
int dp[N][3];
long long solve(int i,int p,int n)
{
    if(i>=n)return 0;
    if(dp[i][p]!=-1)return dp[i][p];
    int t = max(tb[(p+1)%3][i]+solve(i+1,(p+1)%3,n),tb[(p+2)%3][i]+solve(i+1,(p+2)%3,n));
    return dp[i][p]=t;
}
int main()
{
    ios::sync_with_stdio(0);
    int t;
    int n;
    cin >> n;
    rep(i,0,n)cin >> tb[0][i] >> tb[1][i] >> tb[2][i];
    memset(dp,-1,sizeof(dp));
    cout << max(solve(0,0,n),max(solve(0,1,n),solve(0,2,n)));
    return 0;
}


Measured memory_bytes: 15252
#include <fstream>
#include <iostream>
#include <algorithm>
#include <string>

using namespace std;

ifstream in("bleach.in");
ofstream out("bleach.out");

int const NMAX = 1e6;
int v[1 + NMAX];

int main() {

  int badn, bada1 = 0, bada2 = 1000000000, cool;
  cin >> badn;
  for(int i = 1;i <= badn;i++){
    cin >> cool;
    bada1 = max(bada1, cool);
    bada2 = min(bada2, cool);
  }
  cout << bada1 - bada2;
  return 0;
}


Measured memory_bytes: 3604
def main():
    s = map(int, input()[::-1])
    mod = 2019
    counts = [0] * mod
    counts[0] = 1
    t = 0
    x = 1
    for num in s:
        t = (t + num * x) % mod
        counts[t] += 1
        x = (x * 10) % mod
    ans = 0
    for count in counts:
        if count > 1:
            ans += count * (count - 1) // 2
    print(ans)


main()


Measured memory_bytes: 9356
//#define _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"

#define rep(i,n) for(ll (i)=0;(i)<(ll)(n);(i)++)
#define all(x) (x).begin(),(x).end()

#define MOD 1000000007LL
#define INF (1LL<<60LL)
#define int long long
#define MAX_N (100001)
typedef long long ll;

using namespace std;





signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n, m; cin >> n >> m;
	int ans1 = n % m;
	int ans2 = m - ans1;
	cout << min(ans1, ans2) << endl;
}

Measured memory_bytes: 256
//#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize ("Ofast")
#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
using namespace std;


#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

#define rep(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 trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
#define fill(a)  memset(a, 0, sizeof (a))
#define fst first
#define snd second
#define mp make_pair
#define pb push_back
typedef long double ld;
typedef long long ll;
typedef pair<ll, ll> pii;
typedef vector<ll> vi;

vi v;
vi adj[100007], sec[100007];
stack<ll> st;
ll mask[100007], vis[100007];

 void dfs(ll x){
  vis[x] = 10;
  for(auto i : adj[x]) if(!vis[i]) dfs(i);
  st.push(x);
} 

void solve(){
  ll n,m;
  cin>>n>>m;
  rep(i,n+m-1){
    ll x,y;
    cin>>x>>y;
    adj[x].push_back(y);
    sec[y].push_back(x);
  }
  repA(i,1,n) if(!vis[i]) dfs(i);
  while(!st.empty()) v.push_back(st.top()), st.pop();
  //reverse(all(v));
  rep(i,(ll)v.size()) {
  //cout<<" vbefef "<<v[i]<<endl;
  mask[v[i]] = i+1;
  }
  repA(i,1,n){
    ll x = 100005;
    for(auto k:sec[i]){
    //cout<<i<<"  "<<k<<endl;
    if(mask[k] > mask[x]) x = k;
    }
    cout<<(x == 100005 ? 0:x)<<endl;
  }
} 

int main() {
  cin.sync_with_stdio(0); cin.tie(0);
  cin.exceptions(cin.failbit);
 //pre();
  solve();
  return 0;
}


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

using namespace std;

typedef long long ll;
const int N = (int) 1e5 + 100;
bool ciur[N];
vector<int> primes;
vector<ll> primes3;
map<ll, int> f;
map<ll, ll> trans;
map<ll, ll> inv;

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

  ciur[2] = 1;
  for (int i = 3; i < N; i += 2) {
    ciur[i] = 1;
  }
  for (int i = 3; i * i < N; i += 2) {
    if (ciur[i]) {
      for (int j = i * i; j < N; j += 2 * i) {
        ciur[j] = 0;
      }
    }
  }
  for (int i = 1; i < N; i++) {
    if (ciur[i]) {
      primes.push_back(i);
      primes3.push_back(1LL * i * i * i);
    }
  }
  int n;
  cin >> n;
  while (n--) {
    ll x;
    cin >> x;
    if (!trans.count(x)) {
      ll y = x;
      for (auto &p3 : primes3) {
        if (p3 > y) break;
        while (y % p3 == 0) {
          y /= p3;
        }
      }
      trans[x] = y;
      ll ii = 1;
      for (auto &p : primes) {
        if (p * p > y) break;
        int cnt = 0;
        while (y % p == 0) {
          y /= p;
          cnt++;
        }
        if (cnt == 1) {
          ii *= p * p;
        }
        if (cnt == 2) {
          ii *= p;
        }
      }
      ii *= y * y;
      inv[trans[x]] = ii;
    }
    f[trans[x]]++;
  }
  int sol = 0;
  for (auto &it : f) {
    ll x = it.first;
    if (x == 1) {
      if (f[x]) {
        sol++;
      }
    } else {
      if (f[x] > f[inv[x]]) {
        sol += f[x];
      }
      if (f[x] == f[inv[x]] && x > inv[x]) {
        sol += f[x];
      }
    }
  }
  cout << sol << "\n";
}


Measured memory_bytes: 30208
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define pii pair <int, int>
#define fi first
#define sc second
#define ALL(x) x.begin(), x.end()
#define RALL(X) x.begin(), x.end()
#define FOR(i, n, k) for(i=0; i<n; i+=k)
#define FO(i, n, k) for(i=1; i<=n; i+=k)
#define CLEAR(a, b) memset(a, b, sizeof(a))
#define N 100005
#define mid ((l+r)/2)
#define dbg(x) (cerr << #x << " : " << x << endl)
#define endl "\n"
#define MOD 100000009

using namespace std;

typedef long long int lli;

int main(){
	ios_base::sync_with_stdio(false);
	int n;
	cin >> n;
	double x;
	double sub = 0;
	for(int i=0; i<n; i++){
		cin >> x;
		sub += 1.0/x;
	}	

	printf("%.10f", 1.0/sub);
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
bool pri(int a)
{
	int sum = 0;
	for(int i=a;i>0;i--)
	{
		if(a%i == 0)sum++;
	}
	if(sum == 2)return true;
	return false;
} 
int main()
{
	int x;
	cin>>x;
	for(int i=x;;i++)
	{
		if(pri(i))
		{
			cout<<i<<endl;
			return 0;
		}
	}
	return 0;
}

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

namespace Tasks
{
    public class C
    {
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            Solve();
            Console.Out.Flush();
        }

        public static void Solve()
        {
            var (N, M, X) = Scanner.Scan<int, int, int>();
            const long inf = (long)1e18;
            var answer = inf;
            var C = new long[N][].Select(x => Scanner.ScanEnumerable<long>().ToArray()).ToArray();
            void Dfs(int step, long cost, long[] a)
            {
                if (a.All(x => X <= x))
                {
                    answer = Math.Min(answer, cost);
                    return;
                }
                if (step >= N) return;

                var array = a.ToArray();
                Dfs(step + 1, cost, array);

                for (var i = 0; i < array.Length; i++) array[i] += C[step][i + 1];
                Dfs(step + 1, cost + C[step][0], array);
            }

            Dfs(0, 0, new long[M]);
            Console.WriteLine(answer == inf ? -1L : answer);
        }

        public static class Scanner
        {
            private static Queue<string> queue = new Queue<string>();
            public static T Next<T>()
            {
                if (!queue.Any()) foreach (var item in Console.ReadLine().Trim().Split(" ")) queue.Enqueue(item);
                return (T)Convert.ChangeType(queue.Dequeue(), typeof(T));
            }
            public static T Scan<T>() => Next<T>();
            public static (T1, T2) Scan<T1, T2>() => (Next<T1>(), Next<T2>());
            public static (T1, T2, T3) Scan<T1, T2, T3>() => (Next<T1>(), Next<T2>(), Next<T3>());
            public static (T1, T2, T3, T4) Scan<T1, T2, T3, T4>() => (Next<T1>(), Next<T2>(), Next<T3>(), Next<T4>());
            public static (T1, T2, T3, T4, T5) Scan<T1, T2, T3, T4, T5>() => (Next<T1>(), Next<T2>(), Next<T3>(), Next<T4>(), Next<T5>());
            public static IEnumerable<T> ScanEnumerable<T>() => Console.ReadLine().Trim().Split(" ").Select(x => (T)Convert.ChangeType(x, typeof(T)));
        }
    }
}


Measured memory_bytes: 29640
#include <bits/stdc++.h>
using namespace std;
int main(){
  vector<int> dp(100001);
  dp[0]=0;dp[1]=1;
  for(int i=2;i<=100000;i++){
    dp[i]=dp[i-1]+1;
    if(i>=59049)dp[i]=min(dp[i],dp[i-59049]+1);
    if(i>=6561)dp[i]=min(dp[i],dp[i-6561]+1);
    if(i>=729)dp[i]=min(dp[i],dp[i-729]+1);
    if(i>=81)dp[i]=min(dp[i],dp[i-81]+1);
    if(i>=9)dp[i]=min(dp[i],dp[i-9]+1);
    if(i>=46656)dp[i]=min(dp[i],dp[i-46656]+1);
    if(i>=7776)dp[i]=min(dp[i],dp[i-7776]+1);
    if(i>=1296)dp[i]=min(dp[i],dp[i-1296]+1);
    if(i>=216)dp[i]=min(dp[i],dp[i-216]+1);
    if(i>=36)dp[i]=min(dp[i],dp[i-36]+1);
    if(i>=6)dp[i]=min(dp[i],dp[i-6]+1);
  }
  int N;cin >> N;
  cout << dp.at(N) << endl;
}

Measured memory_bytes: 640
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Convert;
using static System.Math;
//using Debug;
//using static System.Globalization.CultureInfo;
//using Edge = Pair<long, int>;
using System.Text;
class Program
{ 
    static void Main(string[] args)
    {
        Solve();
        //WriteLine(Solve());
    }
    static void Solve()
    {
        var nm = Input.ar;
        var imos = new int[nm[0] + 1];
        for (var i = 0; i < nm[1]; i++)
        {
            var lr = Input.ar;
            imos[lr[0] - 1]++;
            imos[lr[1]]--;

        }
        for (var i = 1; i < nm[0]; i++) imos[i] += imos[i - 1];
        WriteLine(imos.Count(v => v == nm[1]));
    }
}

public class Input
{
    public static string read => ReadLine().Trim();
    public static int[] ar => read.Split(' ').Select(int.Parse).ToArray();
    public  static int num => ToInt32(read);
    public static long[] arL => read.Split(' ').Select(long.Parse).ToArray();
    public  static long numL => ToInt64(read);
    public static char[][] gred(int h) 
        => Enumerable.Repeat(0, h).Select(_ => read.ToCharArray()).ToArray();
    public static int[] ar1D(int n)
        => Enumerable.Repeat(0, n).Select(_ => num).ToArray();
    public static long[] arL1D(int n)
        => Enumerable.Repeat(0, n).Select(_ => numL).ToArray();
    public static int[][] ar2D(int n)
        => Enumerable.Repeat(0, n).Select(_ => ar).ToArray();
    public static long[][] arL2D(int n)
        => Enumerable.Repeat(0, n).Select(_ => arL).ToArray();
    public static T getValue<T>(string g)
    {
        var t = typeof(T);
        if (t == typeof(int))
            return (T)(object)int.Parse(g);
        if (t == typeof(long))
            return (T)(object)long.Parse(g);
        if (t == typeof(string))
            return (T)(object)g;
        if (t == typeof(char))
            return (T)(object)char.Parse(g);
        if (t == typeof(double))
            return (T)(object)double.Parse(g);
        if (t == typeof(bool))
            return (T)(object)bool.Parse(g);
        return default(T);
    }
    public const long Inf = (long)1e18;
    public const double eps = 1e-6;
    public  const string Alfa = "abcdefghijklmnopqrstuvwxyz";
    public  const int MOD = 1000000007;
}


Measured memory_bytes: 17632
#include <iostream>
#include <iomanip>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <stack>
#include <queue>

#define FOR(i, b, e) for(int i = (int)(b); i < (int)(e); ++i)
#define RFOR(i, b, e) for(int i = (int)(e-1); i >= 0; --i)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, 0, n)
#define REPC(x,c) for(const auto& x:(c))
#define VS vector<string>
#define VL vector<long long>
#define VI vector<int>
#define VVI vector<vector<int>>
#define ALL(x) (x).begin(),(x).end()
#define SORT(x) sort(ALL(x))
#define RSORT(x) sort((x).rbegin(),(x).rend())
#define PAIR pair<int,int>
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

using  ll = long long;

using namespace std;

ll conb(ll n, ll r) {
	if (n - r < r) { return conb(n, n - r); }
	ll tmp = 1;
	FOR(i, n - r + 1, n + 1) {
		tmp *= i;
	}
	FOR(i, 1, r + 1) {
		tmp /= i;
	}
	return tmp;
}

ll mod(ll n, ll r) {
	ll q = n % r;
	return (q < 0) ? q + r : q;
}

int main() {
	ll x, y;
	cin >> x >> y;
	int c = 0;
	for (; x <= y; x *= 2,++c);
	cout << c << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <cstdlib>
#include <cstring>
#include <string>
#include <stack>
#include <set>
#define INT long long int
#define MOD 1000000007
#define oo 987654321
using namespace std;
int n, c[100010];
bool cmp(int x, int y) { return x>y; }
int main()
{
    ios::sync_with_stdio(0);
    cin>>n;
    for(int i = 0 ; i < n ; i++ ) cin>>c[i];
    sort(c, c+n);
    if( c[0] == c[n-1] )
    {
        if( c[0] == n-1 ) return cout<<"Yes"<<endl, 0;
        else if( n/c[0] >= 2 ) return cout<<"Yes"<<endl, 0;
        else return cout<<"No"<<endl, 0;
    }
    if( c[0]+1 < c[n-1] ) return cout<<"No"<<endl, 0;
    int cnt = 1, cnt2;
    for(int i = 1 ; c[i] == c[0] ; i++, cnt++ );
    cnt2 = c[n-1] - cnt;
    if( cnt2 <= 0 ) return cout<<"No"<<endl, 0;
    if( (n-cnt) / cnt2 >= 2 ) return cout<<"Yes"<<endl, 0;
    cout<<"No"<<endl;
    return 0;
}





Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
const int N = 20000;
const int INF = 1<<30;

int n, s, t;
int tot = 1, front[N], cur[N], layer[N];

struct tPoint {
    int x, y;
} a[N], b[N];

struct tEdge {
    int v, next, c, f;
    inline void init( int _u, int _v, int _c )
    {
        v = _v; c = _c; f = 0;
        next = front[_u]; 
        front[_u] = tot;
    }
} e[N<<2];

inline void add_edge( int u, int v, int c )
{
    e[++tot].init( u, v, c );
    e[++tot].init( v, u, 0 );
//    printf( "u:%d, v:%d, c:%d\n", u, v, c ); 
}

bool bfs()
{
    queue <int> q;
    memset( layer, 0, sizeof( layer ) );
    q.push( s ); layer[s] = 1;
    
    while( !q.empty() )
    {
        int u = q.front(); q.pop();

        for( int i = front[u]; i; i = e[i].next ) 
        {
            int v = e[i].v;
            if( e[i].c - e[i].f <= 0 || layer[v] ) 
                continue;

            layer[v] = layer[u] + 1;
            q.push( v );
            if( v == t ) return true;
        }
    }
    return false;
}

inline int dfs( int u, int curflow )
{
    if( u == t || !curflow ) return curflow;
    int flow = 0;

    for( int &i = cur[u]; i; i = e[i].next ) 
    {
        int v = e[i].v, maxflow = e[i].c - e[i].f;
        if( maxflow <= 0 || layer[v] != layer[u] + 1 ) 
            continue;
        
        int nowflow = dfs( v, min( maxflow, curflow ) );
        curflow -= nowflow;
        flow += nowflow;
        e[i^1].f -= nowflow;
        e[i].f += nowflow;

        if( !curflow ) break; 
    }
    return flow;
}

inline int dinic()
{
    int flow = 0;
    while( bfs() )
    {
//    	printf( "flow:%d\n", flow );
        for( int i = 1; i <= t; i ++ )
            cur[i] = front[i];
        flow += dfs( s, INF );
    }
    return flow;
}

int main()
{
    scanf( "%d", &n ); s = n<<1|1; t = s+1;
    for( int i = 1; i <= n; i ++ )
        scanf( "%d%d", &a[i].x, &a[i].y );
    for( int i = 1; i <= n; i ++ )
        scanf( "%d%d", &b[i].x, &b[i].y );

    for( int i = 1; i <= n; i ++ )
        for( int j = 1; j <= n; j ++ )
            if( a[i].x < b[j].x && a[i].y < b[j].y )
                add_edge( i, j + n, 1 );
    
    for( int i = 1; i <= n; i ++ )
        add_edge( s, i, 1 ), 
        add_edge( i + n, t, 1 );

    int ans = dinic();

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

    return 0;
}

Measured memory_bytes: 384
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
mozi = [a, b, c, d, e]
rup = [round(mozi[i], -1) if mozi[i] % 10 == 0 else
       round(mozi[i] + 5, -1)
       for i in range(len(mozi))]

amari = [mozi[i] % 10 if mozi[i] % 10 != 0 else
         10 for i in range(len(mozi))]

m_r_a = list(zip(mozi, rup, amari))
sorta_m_r_a =(sorted(m_r_a, key=lambda x:x[2], reverse=True))

dishes_4sum = 0
for i in range(4):
    dishes_4sum += sorta_m_r_a[i][1]
dishes_5sum = dishes_4sum + sorta_m_r_a[4][0]

print(dishes_5sum)

Measured memory_bytes: 3064
import java.io.BufferedReader;
import java.io.InputStreamReader;
 
 
public class Main {
    public static void main(String[] args) {
        try {
            BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
            int n = Integer.parseInt(br.readLine());
            String[] inputString = br.readLine().split(" ");
            long[] input = new long[n];
            for(int i = 0 ; i < n ; i++) {
                input[i] = Integer.parseInt(inputString[i]);
            }
            long result = -1, keyValue = result;
            while(keyValue == -1){
            	keyValue = result;
            	result = 0;
            	long count = 0;
            	for(int i = 0 ; i < n ; i++){
            		if(i % 2 == 0 && (count + input[i]) * Math.signum(keyValue) >= 0){
            			result += Math.abs(count + input[i]) + 1;
            			count = (int)Math.signum(keyValue) * -1;
            		}else if(i % 2 != 0 && (count + input[i]) * Math.signum(keyValue) <= 0){
            			result += Math.abs(count + input[i]) + 1;
            			count = (int)Math.signum(keyValue);
            		}else{
            			count += input[i];
            		}
            	}
            	result = (keyValue != -1)? Math.min(result, keyValue): result;
            }
            System.out.println(result);
        } catch (Exception e) {
        	e.printStackTrace();
        }
    }
    
}

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

#include <fstream>
using namespace std;

#define MAX 1001

long long H, W;
long long Sx, Sy;
long long Gx, Gy;
vector<vector<char>> maze(MAX, vector<char>(MAX));
vector<vector<int>> saitan(MAX, vector<int>(MAX, -1));
queue<int> qya, qyb, qxa, qxb;
int cnt = 0;

void warp(int ny, int nx) {
  //cout << ny << " " << nx << endl;
  for (int i = -2; i <= 2;  i++) {
    for (int j = -2; j <= 2 ; j++) {
      if(i + ny >= H || i + ny < 0 || j + nx >= W || j+nx < 0){
        continue;
      }
      int toY = i + ny;
      int toX = j + nx;
      //cout << toY << " " << toX << endl;
      if (maze[toY][toX] == '.' && saitan[toY][toX] == -1) {
        qyb.push(toY);
        qxb.push(toX);
      }
    }
  }
}

void DFS(int ny, int nx) {
  saitan[ny][nx] = cnt;
  qyb.push(ny);
  qxb.push(nx);
  //上
  if (ny > 0 && maze[ny - 1][nx] == '.' && saitan[ny - 1][nx] == -1) {
    DFS(ny - 1, nx);
  }
  //上
  if (ny < H - 1 && maze[ny + 1][nx] == '.' && saitan[ny + 1][nx] == -1) {
    DFS(ny + 1, nx);
  }
  //上
  if (nx > 0 && maze[ny][nx - 1] == '.' && saitan[ny][nx - 1] == -1) {
    DFS(ny, nx - 1);
  }
  //上
  if (nx < W - 1 && maze[ny][nx + 1] == '.' && saitan[ny][nx + 1] == -1) {
    DFS(ny, nx + 1);
  }
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << setprecision(20) << fixed;
  /*
  ifstream in("input.txt");
  cin.rdbuf(in.rdbuf());
  //*/
  cin >> H >> W >> Sy >> Sx >> Gy >> Gx;
  Sy--;
  Sx--;
  Gy--;
  Gx--;
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      cin >> maze[i][j];
    }
  }
  qyb.push(Sy);
  qxb.push(Sx);
  saitan[Sy][Sx] = 0;
  while (!qxb.empty()) {
    qya.swap(qyb);
    qxa.swap(qxb);
    while (!qya.empty()) {
      DFS(qya.front(), qxa.front());
      qya.pop();
      qxa.pop();
    }
    /* test
    while(!qyb.empty()){
      cout << qyb.front() <<endl;
      qyb.pop();
    }
    //*/
    qya.swap(qyb);
    qxa.swap(qxb);
    while (!qya.empty()) {
      // cout << "aaa" <<endl;
      warp(qya.front(), qxa.front());
      qya.pop();
      qxa.pop();
    }
    cnt++;
  }

  // test
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      //cout << saitan[i][j] << " ";
    }
    //cout << endl;
  }

  cout << saitan[Gy][Gx];
}


Measured memory_bytes: 10688
package main

import(
    "fmt"
)



func main() {
    var n,a int
    fmt.Scan(&n,&a)
    ans := "No"
    if n%500 <= a{
        ans = "Yes"
    }
    fmt.Println(ans)
}





func abs32(a int) int {
    if a<0{
        return -a
    }
    return a
}

func abs64(a int64) int64 {
    if a<0{
        return -a
    }
    return a
}

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

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

func min64(a, b int64) int64 {
    if a >= b {
        return b
    }
    return a
}

func max64(a, b int64) int64 {
    if a >= b {
        return a
    }
    return b
}

func gcd(a, b int64) int64 {
    if a % b == 0 {
        return b
    } else {
        return gcd(b, a%b)
    }
}

func lcm(a, b int64) int64 {
    return a / gcd(a, b) * b
}

func scanNums(len int) (nums []int){
    var num int
    for i:=0; i<len; i++{
        fmt.Scan(&num)
        nums = append(nums,num)
    }
    return
}

func scanNums64(len int) (nums []int64){
    var num int64
    for i:=0; i<len; i++{
        fmt.Scan(&num)
        nums = append(nums,num)
    }
    return
}

func scanString(len int) (str []string){
    var s string
    for i:=0; i<len; i++{
        fmt.Scan(&s)
        str = append(str,s)
    }
    return
}

func scanTwoNums(n,m int) ([][]int){
    Nums := make([][]int, n)
    for i:=0; i<n; i++{
        Nums[i] = make([]int, m)
    }
    return Nums
}


Measured memory_bytes: 512
/* ************************************************************************** */
/*                                                                            */
/*                                                        :::      ::::::::   */
/*   main.cpp                                           :+:      :+:    :+:   */
/*                                                    +:+ +:+         +:+     */
/*   By: monoue <marvin@student.42.fr>              +#+  +:+       +#+        */
/*                                                +#+#+#+#+#+   +#+           */
/*   Created: 2020/04/22 12:30:15 by monoue            #+#    #+#             */
/*   Updated: 2020/05/01 16:37:48 by monoue           ###   ########.fr       */
/*                                                                            */
/* ************************************************************************** */

#include <bits/stdc++.h>

/* #include <boost/multi_array.hpp> */
/* #include <boost/optional.hpp> */
/* #include <boost/range/irange.hpp> */
/* #include <boost/range/algorithm.hpp> */
/* #include <boost/range/adaptors.hpp> */
/* #include <boost/multiprecision/cpp_int.hpp> */
/* #include <boost/algorithm/string/classification.hpp> // is_any_of */
/* #include <boost/algorithm/string/split.hpp> */
/* #include <boost/algorithm/string/join.hpp> */
/* #include <boost/algorithm/string/replace.hpp> */
/* #include <boost/math/tools/minima.hpp> */
/* namespace adaptor = boost::adaptors; */
/* using boost::math::tools::brent_find_minima; */
/* using boost::irange; */
/* using boost::algorithm::join; */
/* using boost::algorithm::split; */
/* using boost::algorithm::replace_all; */
/* using boost::multiprecision::cpp_int; */

using namespace std;

#define	int	long long
#define MOD 1000000007
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define rrep(i, n) for (int i = (n); i >= 0; --i)

typedef long long 			ll;
typedef vector<int>			VI;
typedef vector<vector<int>>	VVI;
typedef pair<int, int>		PII;

// TOP
void	Main()
{
 string S, T;
  cin >> S >> T;

  int fit_index = -1;

  for(int i = S.length() - T.length(); 0 <= i; --i){
    if(0 <= fit_index) break;
    for(int j = 0; j < T.length(); ++j){
      if(S[i+j] != '?' && S[i+j] != T[j]) break;
      if(j == T.length()-1) fit_index = i;
    }
  }

  if(fit_index < 0){
    cout << "UNRESTORABLE" << endl;
    return ;
  }

  for(int i = 0; i < S.length(); ++i){
    if(fit_index <= i && i <= fit_index+T.length()-1){
      S[i] = T[i-fit_index];
      continue;
    }
    if(S[i] == '?') S[i] = 'a';
  }

  cout << S << endl;

  return ;
}
// END

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


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

using namespace std;
typedef long long ll;
const int maxn=2e5+7;
ll a[maxn];
int main() {
    ll n,k,t,s=0;
	scanf("%lld%lld", &n,&k);
	for(int i=0;i<n;i++){
        scanf("%lld",&a[i]);
	}
	sort(a,a+n);
	for(int i=0;i<n-k;i++)
        s+=a[i];
	printf("%lld\n",s);
	return 0;
}


Measured memory_bytes: 1792
import java.util.*;
import java.lang.*;
import java.io.*;

public class Main
{
	static long gcd(long a, long b)
	{
		return b != 0 ? gcd(b, a % b) : a;
	}
	
	static long lcm(long a, long b)
	{
		return a / gcd(a, b) * b;
	}
	
	public static void main (String[] args) throws java.lang.Exception
	{
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		
		long a = in.nextLong();
		long b = in.nextLong();
		long c = in.nextLong();
		long d = in.nextLong();
		
		long cc = b / c - (a - 1) / c;
		long dd = b / d - (a - 1) / d;
		long k = lcm(c, d);
		long cd = b / k - (a - 1) / k;
		
		out.println(b - a + 1 - cc - dd + cd);
		
		out.close();
	}
	
	static class InputReader
	{
		BufferedReader reader;
		StringTokenizer tokenizer;
		
		public InputReader(InputStream stream)
		{
			reader = new BufferedReader(new InputStreamReader(stream), 32768);
			tokenizer = null;
		}
		
		public String next()
		{
			while(tokenizer == null || !tokenizer.hasMoreTokens())
			{
				try
				{
					tokenizer = new StringTokenizer(reader.readLine());
				}
				catch(IOException e)
				{
					throw new RuntimeException(e);
				}
			}
			
			return tokenizer.nextToken();
		}
		
		public int nextInt()
		{
			return Integer.parseInt(next());
		}
		
		public long nextLong()
		{
			return Long.parseLong(next());
		}
	}
}

Measured memory_bytes: 21076
/*
 * Author: .-O_O-.
 */
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include<bits/stdc++.h>
using namespace __gnu_pbds;
using namespace std;
#define ll long long
#define pb push_back
#define vi vector<int>
#define rep0(a,b) for(int a=0;a<b;a++)
#define rep1(a,b) for(int a=1;a<=b;a++)
#define repp(a,b,c) for(int a=b;a<c;a++)
#define in insert
#define len length()
#define si size()
#define lb lower_bound
#define ub upper_bound
#define beg begin()
#define en end()
#define f first
#define s second
#define pr(a) cout<<a
#define pr2(a,b) cout<<a<<" "<<b<<"\n"
#define nx cout<<"\n"
#define int long long
// void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
                                                     
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]"<<endl;}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define deb(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define deb(x...)
#endif
const ll mod = 1000000007;
const ll maxn = 300005;
const ll mm = 1e+18;
void solve()
{
    int k;
    cin>>k;
    string s;
    cin>>s;
    int n=s.len;
    if(n<=k) cout<<s;
    else cout<<s.substr(0,k)<<"...";
}
signed main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int t=1;
    // srand(time(0));
    //freopen("sp.txt","r",stdin);
    //cin>>t;
    rep1(_i,t){
        //cout<<"Case #"<<_i<<": ";
        solve();
        //nx;
    }
    return 0;
}


Measured memory_bytes: 3624
import java.util.Scanner;
 
public class Main {
 
	public static void main(String[] args) {
 
 
		Scanner sc = new Scanner(System.in);
 
		int N = sc.nextInt();
		int K = sc.nextInt();
		int X = sc.nextInt();
		int Y = sc.nextInt();
 
		int ret = 0;
		for(int i=0; i<N; i++){
			if (i<K){
				ret = ret+X;
			}
			else {
				ret = ret+Y;
			}
		}
 
 
 
 
 
		System.out.println(ret);
 
 
	}
}

Measured memory_bytes: 9940
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int res = 0;
		for (int i=A; i<=B; i++){
			if ( i/10000%10 == i%10 && i/1000%10 == i/10%10) {
				res++;
			}
		}
		System.out.println(res);
	}
}


Measured memory_bytes: 22100
N,M,X=map(int,input().split())
arr = []
for i in range(N):
  a = list(map(int,input().split()))
  arr.append(a)

ck = 0
ARR = []
for i in range(2 ** N):
  ans= 0
  bag = [0 for j in range(M)]
  for j in range(N):  # このループが一番のポイント
    if ((i >> j) & 1):  # 順に右にシフトさせ最下位bitのチェックを行う
      a = arr[j]
      ans += a[0]
      for k in range(M):
        bag[k] += a[k+1]
  if min(bag) >= X:
    ck = 1
    ARR.append(ans)

if ck == 0:
  print(-1)
else:
  print(min(ARR))

Measured memory_bytes: 68496
import java.util.Arrays;
import java.util.Scanner;

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

	long p[];
	long b[];
	long a[];
	public void run() {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long x = sc.nextLong();

		p = new long[51];
		b = new long[51];
		a = new long[51];
		p[0]=1;
		b[0]=0;
		a[0]=1;
		for(int i=0; i<50; i++) {
			p[i+1] = 2 * p[i] + 1;
			b[i+1] = 2 * b[i] + 2;
			a[i+1] = p[i+1]+b[i+1];
		}

		long ans = f(n, x);
		System.out.println(ans);
		sc.close();
	}

	long f(int n, long x) {
		if(n==0) {
			if(x<=0) return 0;
			else return 1;
		}
		if(a[n-1] +1 >= x) {
			return f(n-1, x-1);
		}
		else if(a[n-1] +2 == x) {
			return p[n-1] + 1;
		}
		else if( a[n-1] + 2 < x && x < a[n]) {
			return p[n-1] + 1 + f(n-1, x-a[n-1]-2);
		}
		else {
			return p[n];
		}
	}
}


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


int main()
{
    int n=0;
    cin >> n;
    string s;
    cin >> s;
    int k = 0;

    for(int i=0; i<n-2; i++)
    {
        if(s.substr(i,3)=="ABC")
        {
            k++;
            i+=2;
        }
    }
    cout << k << endl;
}


Measured memory_bytes: 256
#define DEBUG 0
#include <bits/stdc++.h>
#define all(v) (v).begin(), (v).end()
#define pb push_back
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
using namespace std;
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template<class T>using numr=std::numeric_limits<T>;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const int INF = 1e9;
const ll LLINF = 1e16;
const int MOD = 1000000007;
const int MOD2 = 998244353;
void debug_impl() { std::cerr << std::endl; }
template <typename Head, typename... Tail>
void debug_impl(Head head, Tail... tail) { std::cerr << " " << head; debug_impl(tail...); }
#if DEBUG
#define debug(...)\
    do {\
        std::cerr << std::boolalpha << "[" << #__VA_ARGS__ << "]:";\
        debug_impl(__VA_ARGS__);\
        std::cerr << std::noboolalpha;\
    } while (false)
#else
#define debug(...) {}
#endif

template < typename Container, typename Value = typename Container::value_type, std::enable_if_t<!std::is_same< Container, std::string >::value, std::nullptr_t> = nullptr>
std::istream& operator>> (std::istream& is, Container& v)
    { for (auto & x : v) { is >> x; } return is; }

template < typename Container, typename Value = typename Container::value_type, std::enable_if_t<!std::is_same< Container, std::string >::value, std::nullptr_t> = nullptr >
std::ostream& operator<< (std::ostream& os, Container const& v) {
os << "{";
    for (auto it = v.begin(); it != v.end(); it++)
        {os << (it != v.begin() ? "," : "") << *it;}
    return os << "}";
}

int solve(int n){
    int cnt = 0;
    while(n>0){
        n = n/10;
        cnt++;
    }
    return cnt;
}
int main() {
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);
    int n, ans = 0;
    cin >> n;
    for(int i=1;i<=n;i++){
        int num = solve(i);
        if(num % 2 == 1) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3632
// Author : Mohamed Sameh
#include <bits/stdc++.h>
#define pb push_back
#define f first
#define s second
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define SZ(a) (int)a.size()
#define Flush fflush(stdout);
typedef long long ll ;
using namespace std ;
const int M = 100 ;
const int MAXW = 1e5+1; 
ll dp[M][MAXW];
int w[M],v[M];
int N , W ;
int main ()
{   
    scanf ("%d%d" , &N ,&W); 
    for (int i =0 ; i < N ;i++)
    {
        scanf ("%d%d" ,w+i , v+i); 
    }
    for (int j = 1;  j <= W ;j++)
        if (j >= w[0])
            dp[0][j] = v[0];
    for (int i = 1; i < N ;i++)
    {
        for (int j =1 ; j <= W ;j++)
        {
            // what can I take if I Have capacity = j 
            dp[i][j] = dp[i-1][j];
            if (j >= w[i])
            {
                dp[i][j] = max (dp[i][j] , v[i] + dp[i-1][j - w[i]]);
            }
        }
    }
    printf ("%lld\n" , dp[N-1][W]); 

}

Measured memory_bytes: 78336
#include <stdio.h>
int main(int argc, const char * argv[]){
int s,h,m;
scanf("%d",&s);
h=s/3600;
s=s-(3600*h);
m=s/60;
s=s-(60*m);
printf("%d:%d:%d\n",h,m,s);
return 0;
}

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

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

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

const int MAX = 1e5;
const int INF = 1e9;
const int MOD = 1e9 + 7;

int N, B[MAX];

int main(){
    cin >> N;
    rep(i, N - 1) cin >> B[i];

    vector<int> A(N, INF);
    rep(i, N - 1){
        A[i] = min(A[i], B[i]);
        A[i + 1] = min(A[i + 1], B[i]);
    }

    int ans = 0;
    ans = accumulate(A.begin(), A.end(), 0);

    cout << ans << endl;
}

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

int N,M;
char F[1111][1111];
char E[11][11];
int D[1111][1111];

bool check(int x,int y,int bx,int by,char c){
  char tmp = F[bx][by];
  F[bx][by] = c;
  for(int i=0;i<2;i++){
    for(int j=0;j<2;j++){
      int nx = j+x, ny = i+y;
      if( ny >= M || nx >= N ){
        F[bx][by] = tmp; return false;
      }
      if( F[nx][ny] != E[j][i] ){
        F[bx][by] = tmp; return false;
      }
    }
  }
  F[bx][by] = tmp;
  return true;
}

int dx[]={0,-1,-1,0};
int dy[]={0,-1,0,-1};
char dc[]="JOI";
int main(){
  cin >> M >> N;
  for(int i=0;i<M;i++){
    for(int j=0;j<N;j++){
      cin >> F[j][i];
    }
  }

  for(int i=0;i<2;i++)
    for(int j=0;j<2;j++) cin >> E[j][i];

  int sum = 0;
  for(int i=0;i<M;i++){
    for(int j=0;j<N;j++){
      D[j][i] = check(j,i,j,i,F[j][i]);
      if( D[j][i] == 1 ) sum++;
    }
  }
  int res = sum;
  for(int i=0;i<M;i++){
    for(int j=0;j<N;j++){

      for(int k=0;k<3;k++){
        int pr = 0;

        for(int t =0;t<4;t++){
          int nx = j+dx[t], ny = i+dy[t];
          if( nx < 0 || ny < 0 ) continue;
          int fl = check(nx,ny,j,i,dc[k]);
          pr += (fl - D[nx][ny]); 
        }
        res = max(res,sum+pr);

      }

    }
  }
  cout << res << endl;
}

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

int main(void){
  char s[4];
  cin >> s;
  char a,b;
  int n,m;
  int j=0;
  a = s[0];
  n++;
  for(int i=0; i < 4; ++i){
    if(s[i] != a){
      b = s[i];
      break;
    }
    else if(i==3) j++;
  }
  for(int i = 1; i < 4; ++i){
    if(j != 0) break;
    else if(s[i] == a){
      n++;
    }
    else if(s[i] == b){
      m++;
    }
    else j++;
  }  
  if(j != 0){
    cout << "No" << endl;
  }
  else if(m == n){
    printf("Yes");
  }
  else cout << "No" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,k;
	cin>>n>>k;
	int h[n];
	for(int i=0;i<n;i++)cin>>h[i];
	int dp[n];
	dp[0]=0;
	for(int i=1;i<n;i++)
	{
		dp[i]=dp[i-1]+abs(h[i]-h[i-1]);
		for(int j=2;j<=min(i,k);j++)
		{
			dp[i]=min(dp[i],dp[i-j]+abs(h[i]-h[i-j]));
		}
	}
	cout<<dp[n-1];
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//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; }
 
/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
*/

const int N = 3;
const int N2 = 9;

struct Puzzle{
    int f[N2];
    int space;
    string path;

    bool operator < (const Puzzle &p) const {
        for(int i=0; i<N2; i++){
            if(f[i] == p.f[i]) continue;
            return f[i] > p.f[i];
        }
        return false;
    }
};

static const int dx[4] = {-1, 0, 1, 0};
static const int dy[4] = {0, -1, 0, 1};
static const char dir[4] = {'u', 'l', 'd', 'r'};

bool isTarget(Puzzle p){
    for(int i=0; i<N2; i++){
        if(p.f[i] != (i+1)) return false;
    }
    return true;
}

string bfs(Puzzle s){
    queue<Puzzle> Q;
    map<Puzzle, bool> V;
    Puzzle u, v;
    s.path = "";
    Q.push(s);
    V[s] = true;

    while(!Q.empty()){
        u = Q.front(); Q.pop();
        if(isTarget(u)) return u.path;
        int sx = u.space/N;
        int sy = u.space%N;
        for(int r=0; r<4; r++){
            int tx = sx+dx[r];
            int ty = sy+dy[r];
            if(tx < 0 || ty < 0 || tx >= N || ty >= N) continue;
            v = u;
            swap(v.f[u.space], v.f[tx*N + ty]);
            v.space = tx*N + ty;
            if(!V[v]){
                V[v] = true;
                v.path += dir[r];
                Q.push(v);
            }
        }
    }

    return "unsolvable";
}

int main(){
    Puzzle in;
    for(int i=0; i<N2; i++){
        cin >> in.f[i];
        if(in.f[i] == 0){
            in.f[i] = N2;
            in.space = i;
        }
    }

    string ans = bfs(in);
    cout << ans.size() << endl;
}




Measured memory_bytes: 30600
import math
n,k=map(int,input().split())
  
a=[0]*n
ans=[0]*n
a=list(map(int,input().split()))
check=math.ceil(math.log2(n))+1
if (k>=42):
  a=[n]*n
  print(" ".join(map(str,a)))
else:
  for _ in range(k):
    ans=[0]*n
    table=[0]*n
    for i in range(n):
      left=max(0,i-a[i])
      right=min(n-1,i+a[i])
      table[left]+=1
      if (right+1<n):
        table[right+1]-=1
      #print(left,right)
      #for j in range(left,right+1):
      #  ans[j]+=1
    #print(table)
    for i in range(1,n):
      table[i]+=table[i-1]
    a=table
 
  print(" ".join(map(str,a)))

Measured memory_bytes: 170468
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#define rep(i, n) for(i = 0; i < n; i++)
using namespace std;

signed main() {
	int x, a;
	cin >> x >> a;
	if (x < a) cout << 0 << endl;
	else cout << 10 << endl;
	return 0;
}

Measured memory_bytes: 256
a = (0..9).map{ [0] * 10 }
while gets
    x, y, s = $_.split(",").map(&:to_i)
    case s
    when 1
        a[y][x] += 1
        a[y-1][x] += 1 if y > 0
        a[y+1][x] += 1 if y < 9
        a[y][x-1] += 1 if x > 0
        a[y][x+1] += 1 if x < 9
    when 2
        ([y-1, y, y+1] & (0..9).to_a).each{|i|
            ([x-1, x, x+1] & (0..9).to_a).each{|j|
                a[i][j] += 1
            }
        }
    when 3
        ((y-2..y+2).to_a & (0..9).to_a).each{|i|
            d = 2 - (i - y).abs
            ((x-d..x+d).to_a & (0..9).to_a).each{|j|
                a[i][j] += 1
            }
        }
    end
end

a.flatten!
p a.count{|x| x == 0}
p a.max

Measured memory_bytes: 6136
#include <stdio.h>

//用意する配列の最大個数
#define MAXMATRIX 100

//シグマの計算((Σ[k = 0 → m] array_a[i][k] * array_b[k][j])
long int sigma(int i, int j, int m, long int matrix_a[MAXMATRIX][MAXMATRIX], long int matrix_b[MAXMATRIX][MAXMATRIX]);

int main(void)
{
    //行列aと行列b
    long int matrix_a[MAXMATRIX][MAXMATRIX], matrix_b[MAXMATRIX][MAXMATRIX];
    //iとjはループ変数、nとmとlは(n * m)の行列と(m * l)の行列の要素数
    int i, j, n, m, l;

    scanf("%d %d %d", &n, &m, &l);

    //行列aの要素を入力
    for(i = 0; i < n; i++){
        for(j = 0; j < m; j++){
            scanf("%ld", &(matrix_a[i][j]));
        }

    }

    //行列bの要素を入力
    for(i = 0; i < m; i++){
		for(j = 0; j < l; j++){
			scanf("%ld", &(matrix_b[i][j]));
		}
    }

    //n*lの行列の結果を出力
    for(i = 0; i < n; i++){
		for(j = 0; j < l; j++){
			printf("%ld", sigma(i, j, m, matrix_a, matrix_b));
			//各行において、最後の要素でないならスペースを入れる
			if((l - j) != 1){
				printf(" ");
			}
		}
		printf("\n");
    }

    return 0;
}

long int sigma(int i, int j, int m, long int matrix_a[MAXMATRIX][MAXMATRIX], long int matrix_b[MAXMATRIX][MAXMATRIX])
{
	//kはループ変数
    int k;
	long int ans;

    //初期値は0
    ans = 0;

    //((Σ[k = 0 → m] array_a[i][k] * array_b[k][j])の計算
    for(k = 0; k < m; k++){
        ans += matrix_a[i][k] * matrix_b[k][j];
    }

    return ans;
}


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

long MOD=1e9+7;
long MAX=200000;


long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

int main() {
  long M,N;
  cin>>M>>N;
  long ans=modpow(M,N,MOD);
  cout<<ans<<endl;
}



Measured memory_bytes: 3132
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 k = sc.nextInt();
        int[] locations = new int[n];
        for(int i = 0; i < n; i++)
            locations[i] = sc.nextInt();

        long minDist = Long.MAX_VALUE;
        if(k == 1) {
            for(int i = 0; i < n; i++)
                minDist = Math.min(minDist, Math.abs(locations[i]));
        } else {
            long curDist = 0L;
            for(int i = 1; i < n; i++) {
                long diff = locations[i] - locations[i-1];
                curDist += diff;
                if(i >= k - 1) {
                      long left = Math.abs(0 - locations[i-k+1]);
                      long right = Math.abs(0 - locations[i]);
                      minDist = Math.min(Math.min(left, right) + curDist, minDist);
                      diff = locations[i-k+2] - locations[i-k+1];
                      curDist -= diff;
                }
            }
        }
        System.out.println(minDist);
    }
}


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

const int INF = 1000000007;

int main()
{
    int n, k, a[5003];
    cin >> n >> k;
    int least = INF;
    for(int i = 0; i < n; i++){
        cin >> a[i];
        if(a[i] >= k) least = min(least, a[i]);
    }
    sort(a, a + n, greater<int>());
    int dp[10005];
    fill(dp, dp + 10005, -1);
    dp[0] = 0;
    for(int i = 0; i < n; i++){
        for(int j = k * 2; j >= a[i]; j--){
            if(dp[j - a[i]] != -1) dp[j] = a[i];
        }
    }
    for(int i = k; i <= k * 2; i++){
        if(i - k < dp[i]){
            least = dp[i];
            break;
        }
    }
    if(least == INF) cout << n << endl;
    else{
        reverse(a, a + n);
        cout << lower_bound(a, a + n, least) - a << endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
#define cerr cout
#define F first
#define S second
#define fori(i,a,b) for (i = a; i < b; ++i)
#define ford(i,a,b) for(i = a; i>=b;--i)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) int(x.size())
typedef long long ll;
typedef pair <int, int> pii;
typedef vector <int> vi;
typedef vector <ll> vl;
typedef vector <bool> vb;
typedef vector < char> vc;
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fill(a, x) memset(a, x, sizeof(a))
#define INF 1000000000
#define MOD 1000000007
#define SMOD 998244353
#define endl "\n"
string to_string(string s) { return '"' + s + '"';}
string to_string(char s) { return string(1, s);}
string to_string(const char* s) { return to_string((string) s);}
string to_string(bool b) { return (b ? "true" : "false");}
template <typename A> string to_string(A);
template <typename A, typename B>string to_string(pair<A, B> p) {return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";}
template <typename A> string to_string(A v) {bool f = 1; string r = "{"; for (const auto &x : v) {if (!f)r += ", "; f = 0; r += to_string(x);} return r + "}";}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) {cerr << " " << to_string(H); debug_out(T...);}
#define pr(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
const ll N = 100043;
ll fact[N];
ll add(ll x, ll y)
{
	x += y;
	while(x >= MOD) x -= MOD;
	while(x < 0) x += MOD;
	return x;
}
ll mul(ll x, ll y)
{
	return (x * 1ll * y) % MOD;
}
ll mulmod(ll a, ll b)
{
    ll res = 0;
    a = a % MOD;
    while (b>0)
    {
        if (b % 2 == 1)
            res = (res + a) % MOD;
        a = (a * 2) % MOD;
        b /= 2;
    }
    return res % MOD; 
}
ll binpow(ll x, ll y)
{
	ll z = 1;
	while(y > 0)
	{
		if(y % 2 == 1)
			z = mul(z, x);
		x = mul(x, x);
		y /= 2;
	}
	return z;
}
ll inv(ll x)
{
	return binpow(x, MOD - 2);
}
ll divide(ll x, ll y)
{
	return mul(x, inv(y));
}
void precalc()
{
	fact[0] = 1;
	ll i;
	fori(i, 1, N)
		fact[i] = mul(i, fact[i - 1]);
}
ll C(ll n, ll k)
{
	if(k > n)
	    return 0;
	return divide(fact[n], mul(fact[n - k], fact[k]));
}

void solve()
{
    ll n;
    cin >> n;
    ll a[n], i, ans = 0;
    fori(i, 0, n)
        cin >> a[i];
    fori(i, 0, n-1)
    {
        ans += max(0LL, a[i]-a[i+1]);
        a[i+1] = max(a[i+1], a[i]);
    }
    cout << ans << endl;
}

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int t;
    t=1;
    // cin >> t;
    for(int i=1; i<=t; i++)
    {
        // cout << "Case #" << i << ": ";
        solve();
    }
    return 0;
}

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

int main() {
  int n;
  cin >> n;
  vector<float> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a.at(i);
  }

  float sum;
  for (int i = 0; i < n; i++) {
    sum += 1/a.at(i);
  }
  cout << 1/sum << endl;
}

Measured memory_bytes: 256