akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;


#define INF 2147483647
#define LINF 9223372036854775807
#define MOD 1000000007
#define MOD2 998244353

template<class T,class U>bool chmax(T &a, const U &b){if(a<b){a=b;return 1;}return 0;}
template<class T,class U>bool chmin(T &a, const U &b){if(b<a){a=b;return 1;}return 0;}

#define rep(i,n) for(int i=0,_i=(n);i<_i;++i)
#define rep1(i,a,b) for(int a_=(a),b_=(b),i=a_;i<b_;++i)
#define repr(i,n) for(int _i=(n),i=_i;i>0;--i)

#define db(x) cerr<<#x<<" = "<<x<<" ";
#define db2(x,y) cerr<<"("<<#x<<", "<<#y<<") = ("<<x<<", "<<y<<") ";
#define db3(x,y,z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = ("<<x<<", "<<y<<", "<<z<<") ";
#define ln cout<<endl;

#define all(a)  (a).begin(),(a).end()
#define dig(n)  to_string(n).length()

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define se second
#define fi first

typedef long long ll;

typedef pair<int,int> P;
typedef pair<int,P> iP;
typedef pair<P,P> PP;

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

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

int main(){

    bool flag=false;
    ll ans=0,sum=0;

    int n,m;
    cin>>n;

    vector<int>a(n),b(n);
    vector<int>a_b(n);

    rep(i,n)cin>>a[i];
    rep(i,n)cin>>b[i];

    rep(i,n)a_b[i] = a[i]-b[i];
    sort(all(a_b),greater<int>());

    ll p=0,ng=0;
    for(int dif:a_b){
        if(dif > 0)p+=dif;
        else ng -=dif/2;
    }

    if(ng >= p)flag=true;


    //cout <<fixed<<setprecision(16)<< << endl;

    if(flag)cout << "Yes" <<endl;
    else cout << "No" <<endl;

    return 0;
}


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

int main(){

  int h, w, v[100][100], x, y;
  string str[100];

  while(cin >> h >> w){
    if(h == 0) break;
    for(int i=0; i<h; i++){
      fill(&v[i][0], &v[i][w], 0);
    }

    getline(cin, str[0]);
    for(int i=0; i<h; i++){
      getline(cin, str[i]);
    }

    x = 0;
    y = 0;
    while(1){
      if(str[x][y] == '.'){
        cout << y << " " << x << endl;
        break;
      }
      else if(v[x][y] == 1){
        cout << "LOOP" << endl;
        break;
      }

      v[x][y] = 1;      

      if(str[x][y] == '^') x--;
      else if(str[x][y] == '>') y++;
      else if(str[x][y] == 'v') x++;
      else if(str[x][y] == '<') y--;
    }
  }

  return 0;

}

Measured memory_bytes: 1268
import std;
import core.bitop;

// dfmt off
ulong MAX = 100_100, MOD = 1_000_000_007, INF = 1_000_000_000_000;
alias sread = () => readln.chomp();
alias lread(T = long) = () => readln.chomp.to!(T);
alias aryread(T = long) = () => readln.split.to!(T[]);
void aryWrite(T = long)(T[] ary){ ary.map!(x => x.text()).join(' ').writeln(); }
alias Pair = Tuple!(long, "H", long, "W");
alias PQueue(T, alias less = "a>b") = BinaryHeap!(Array!T, less);
// dfmt on

void main()
{
    long a, b, c, k;
    scan(a, b, c, k);
    writeln(k % 2 ? b - a : a - b);
}

void scan(TList...)(ref TList Args)
{
    auto line = readln.split();
    foreach (i, T; TList)
    {
        T val = line[i].to!(T);
        Args[i] = val;
    }
}


Measured memory_bytes: 3624
//#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
typedef long long ll;

using namespace std;



signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	ll a, b, c, d; cin >> a >> b >> c >> d;
	cout << max(a * b, c * d) << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <math.h>
#include <map>
#include <numeric>
using namespace std;
typedef long long int ll;

int main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	while(1){
		int n,w,h; cin >> n;
		if(n==0)break;
		cin >> w >> h;
		int a[h][w]={};
		while(n--){
			int x,y; cin >> x >> y;
			x--; y--;
			a[y][x]++;
		}
		int s,t; cin >> s >> t;
		int ma=0;
		for(int i=0;i+t-1<h;i++){
			for(int j=0;j+s-1<w;j++){
				int cnt=0;
				for(int k=0;k<t;k++){
					for(int l=0;l<s;l++){
						cnt+=a[i+k][j+l];
					}
				}
				ma=max(ma,cnt);
			}
		}
		cout << ma << endl;
	}

}


Measured memory_bytes: 3172
#include<iostream>
using namespace std;
int main(){
	int n;
	cin>>n;
	int *A=new int[n],*B=new int[n],C[10001]={0};
	for(int i=0;i<n;++i){
		cin>>A[i];
		++C[A[i]];
		B[i]=0;
	}
	for(int i=1;i<10001;++i){
		C[i]+=C[i-1];
	}
	for(int i=n-1;i>=0;--i){
		B[--C[A[i]]]=A[i];
	}
	for(int i=0;i<n-1;++i){
		cout<<B[i]<<" ";
	}
	cout<<B[n-1]<<endl;
	return 0;
}



Measured memory_bytes: 18764
/********   All Required Header Files ********/
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
using namespace std;
// ****  All Required define Pre-Processors and typedef Constants *******/
#define mem(a, b) memset(a, (b), sizeof(a))
#define FOR(i, j, k, in) for (int i=j ; i<k ; i+=in)
#define RFOR(i, j, k, in) for (int i=j ; i>=k ; i-=in)
#define fl(i, j) FOR(i, 0, j, 1)
#define RREP(i, j) RFOR(i, j, 0, 1)

#define fi(it, l) for (auto it = l.begin(); it != l.end(); it++)

#define PB push_back
#define INF (int)1e9
#define EPS 1e-9
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
const double pi=acos(-1.0);
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<PII> VII;
typedef vector<VI> VVI;
typedef map<int,int> dmap;
typedef set<int> dset;
typedef long int int32;
typedef unsigned long int uint32;
typedef long long int int64;
typedef unsigned long long int  uint64;
/********** solver function **********/
// int solve(){
	
// }
/********** Main()  function **********/
int main()
{
	string s;
    cin>>s;
    int sum=0;
    for ( int i=0;i<s.size();i++){
        sum=(sum+(s[i]-48))%9;
    }
    if( sum==0) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 3708
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
from bisect import bisect_left, bisect_right
import random
from itertools import permutations, accumulate, combinations
import sys
import string
from copy import deepcopy

INF = float('inf')


def LI(): return list(map(int, sys.stdin.readline().split()))


def I(): return int(sys.stdin.readline())


def LS(): return sys.stdin.readline().split()


def S(): return sys.stdin.readline().strip()


def IR(n): return [I() for i in range(n)]


def LIR(n): return [LI() for i in range(n)]


def SR(n): return [S() for i in range(n)]


def LSR(n): return [LS() for i in range(n)]


def SRL(n): return [list(S()) for i in range(n)]


def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]


mod = 10 ** 9 + 7

n, x, t = LI()
print(t * ((n - 1) // x + 1))

Measured memory_bytes: 76704
from heapq import heappop, heappush

def dijkstra(s):
    dp[s] = 0
    hq = []
    used[s] = 0
    for i in cost[s]:
        heappush(hq, i)

    while hq:
        minv = heappop(hq)
        if used[minv[1]] == 0:
            continue
        v = minv[1]
        dp[v] = minv[0]
        used[v] = 0
        for i in cost[v]:
            if used[i[1]]:
                heappush(hq, [i[0] + dp[v], i[1]])
    return

INF = 10 ** 18
n = int(input())
cost = [[] for _ in range(n)]
used = [1] * n
dp = [INF] * n

for i in range(n):
    lst = list(map(int, input().split()))
    for j in range(lst[1]):
        v, c = lst[2 + (2 * j)], lst[3 + (2 * j)]
        cost[lst[0]].append([c, v])

dijkstra(0)
for i in range(n):
    print(i, dp[i])


Measured memory_bytes: 104664
#include<stdio.h>

char temp[20];

int bfs(int a) {
	printf("%d\n",a);
	fflush(stdout);
	scanf("%s",temp);
	if(temp[0]=='V') return 0;
	if(temp[0]=='M') return 1;
	if(temp[0]=='W') return 2;
}

int main() {
	int flag, n, a, b, c, ansa, ansb, ansc;
	while(scanf("%d",&n)!=EOF) {
		a = 0, b = n-1;
		ansa = bfs(a);
		if(ansa == 0) continue;
		ansb = bfs(b);
		if(ansb == 0) continue;
		while(1) {
			flag = 0;
			c = (a+b)/2;
			ansc = bfs(c);
			if(ansc==0) break;
			if((c-a)%2==0) flag++;
			if(ansc==ansa) flag++;
			if(flag==1) {
				b = c;
				ansb = ansc;
			}
			else {
				ansa = ansc;
				a = c;
			}
		}
	}
}


//0 1 2 3 4 5 6 7 8 9 10
//1 2 1 2 1 2 1 0 2 1 2

//0 1 2 3 4
//

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

int main()
{
	int p, q, r; cin >> p >> q >> r;	
			
	int ans;
	
	ans = p + q;
	ans = min(ans, p + r);
	ans = min(ans, q + r);

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
n, m, x, y = map(int, input().split())
s = list(map(int, input().split()))
t = list(map(int, input().split()))
c = 0
for i in range(-100, 101, 1):
    if x < i <= y:
        d = 0
        for j in s:
            if j >= i:
                d = 1
        for j in t:
            if j < i:
                d = 1
        if d == 0:
            c = 1
print("No War" if c == 1 else "War")

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

public class ABC
{
    //          long[] sp = Console.ReadLine().Split().Select(long .Parse).ToArray();
    //          int[] sp = Console.ReadLine().Split().Select(int.Parse).ToArray();
    //          int N =  int.Parse(Console.ReadLine());
    //CompLib.Collections.PriorityQueue<?>
    public static void Main()
    {
        int N = int.Parse(Console.ReadLine());
        int[] d = Console.ReadLine().Split().Select(int.Parse).ToArray();
        long output = 0;
        for (int i = 0; i < N; i++)
        {
            for (int j = i + 1; j< N; j++)
            {
                output += d[i] * d[j];
            }

        }

        Console.WriteLine(output);
    }

}



Measured memory_bytes: 13396
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define pb push_back
#define INF 0x3f3f3f3f
#define endl '\n'
#define ll long long
#define f first
#define s second
#define FAST cin.tie(0), cout.tie(0), ios::sync_with_stdio(0)
#define debug(x) cout << "DEBUG " << x << endl
#define debug2(x, y) cout << "DEBUG " << x << " " << y << endl
#define debug3(x, y, z) cout << "DEBUG " << x << " " << y << " " << z<< endl
#define debug4(x, y, z, o) cout << "DEBUG " << x << " " << y << " " << z<< " " << o << endl
using namespace std;
typedef pair<int, int> pii;
typedef pair<int, pair<int, int>> ppi;
typedef vector<vector<int>> mat;


int main() {
	string s;
	cin >> s;
	for(int i = 0; i < s.size(); i++) {
		if(i%2 == 0 && s[i] == 'R' or s[i] == 'U' or s[i] == 'D') continue;
		else if(i%2 && s[i] == 'L' or s[i] == 'U' or s[i] == 'D') continue;
		cout << "No" << endl;
		return 0;
	}
	cout << "Yes" << endl;
}


Measured memory_bytes: 256
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"

using namespace std;

const long long int MOD = 1000000007;

long long int N, M, K, H, W, L, R;



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


	cin >> N >> K;
	vector<int>p;
	vector<int>m;
	p.push_back(0);
	for (int i = 0; i < N; i++) {
		cin >> M;
		if (M > 0) {
			p.push_back(M);
		}
		else if (!M)K--;
		else m.push_back(M*(-1));
	}
	m.push_back(0);
	reverse(m.begin(), m.end());
	int ans = MOD;
	for (int i = 0; i <= K; i++) {
		int box = i;
		int bag = K - box;
		if (p.size() <= box)continue;
		if (m.size() <= bag)continue;
		ans = min(ans, p[box] + m[bag] + min(p[box], m[bag]));
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1020
#pragma GCC target("avx2")
#pragma GCC optimization("O3")
#pragma GCC optimization("unroll-loops")
#include <bits/stdc++.h>
#define rc(x) return cout<<x<<endl,0
#define pb push_back
#define mkp make_pair
#define in insert
#define er erase
#define fd find
#define fr first
#define sc second
typedef long long ll;
typedef long double ld;
const ll INF=0x3f3f3f3f3f3f3f3f;
const ll llinf=(1LL<<62);
const int inf=(1<<30);
const int nmax=1e5+50;
const int mod=1e9+7;
using namespace std;
int n;
int main()
{
	//freopen("sol.in","r",stdin);
	//freopen("sol.out","w",stdout);
	//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
	ios_base::sync_with_stdio(false);cin.tie(0);cerr.tie(0);cout.tie(0);
	cin>>n;
	if(n&1)cout<<n/2<<endl;
	else cout<<n/2-1<<endl;
	return 0;
}


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

using namespace std;

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

  string s; cin>>s;
  int ans = 0;
  for (int i = 0; i < s.size()/2; i++) {
    if (s[i] != s[s.size()-1-i])
      ans++;
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
import java.util.Arrays;
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[] monsters =new int[n];
		for (int i=0;i<n;i++){
			monsters[i]=sc.nextInt();
		}
		Arrays.sort(monsters);

		long hp =0;
		if (k>=n) {
			System.out.println(hp);
		} else{
			for (int j=0;j<n-k;j++) {
				hp += monsters[j];
			}
			System.out.println(hp);

		}



		//------------------------------------------------------------
	}
}

Measured memory_bytes: 65644
#include <stdio.h>
#include <limits.h>
int n;
int num[100001];
int main(int argc, char const *argv[])
{
	int i,j;
	int gusu = 0;
	int kisu = 0;
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		scanf("%d",&num[i]);
		if(num[i]%2 == 0){
			gusu++;
		}
		else if(num[i]%2 == 1){
			kisu++;
		}
	}
	if(kisu%2 == 0 && gusu%2 == 0){
		printf("YES\n");
	}else if(kisu%2 == 0 && gusu%2 == 1){
		printf("YES\n");
	}else{
		printf("NO\n");
	}
	return 0;
}

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

int main(){
  int n,m; cin>>n>>m;
  int sum=0;
  for(int i=0; i<m; ++i){
    int a; cin>>a;
    sum+=a;
  }

  if(sum>n)cout<<-1<<endl;
  else cout<<n-sum<<endl;

}

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

using namespace std;

const int MX = 1000005;

vector<int> pos[26];
int n;
char sr[MX], tr[MX];

void input()
{
	scanf("%d", &n);
	scanf("%s", sr+1);
	scanf("%s", tr+1);
}

void fucked()
{
	puts("-1");
	exit(0);
}

int que[MX];

void work()
{
	int h, t, ans = 0, pos = n;
	if(strcmp(sr+1, tr+1) == 0) puts("0"), exit(0);
	t = 1, h = 0;
	for(int i=n; i>=1; i--)
	{
		if(tr[i] == tr[i-1]) continue;
		if(i < pos) pos = i;
		while(pos && tr[i]!=sr[pos]) pos--;
		if(!pos) {puts("-1"); return;}
		while(h>=t && que[t]-(h-t)>i) t++;
		que[++h] = pos;
		if(i != pos) ans = max(ans, h-t+1);
	}
	printf("%d\n", ans+1);
}

int main()
{
	input();
	work();
	return 0;
}

Measured memory_bytes: 6144
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

typedef struct _Node {
  int key;
  struct _Node *next, *prev;
} Node;

Node *nil;

Node* listSearch(int key) {
  Node *cur = nil->next;
  while(cur != nil && cur->key != key) {
    cur = cur->next;
  }
  return cur;
}

void init(void) {
  nil = (Node *)malloc(sizeof(Node));
  nil->next = nil;
  nil->prev = nil;
}

void printList(void) {
  Node *cur = nil->next;
  int isf = 0;
  while(1) {
    if(cur == nil) break;
    if(isf++>0) printf(" ");
    printf("%d",cur->key);
    cur = cur->next;
  }
  printf("\n");
}

void deleteNode(Node *t) {
  if(t==nil) return;
  t->prev->next = t->next;
  t->next->prev = t->prev;
  free(t);
}

void deleteFirst(void) {
  deleteNode(nil->next);
}

void deleteLast(void) {
  deleteNode(nil->prev);
}

void deleteKey(int key) {
  deleteNode(listSearch(key));
}

void insert(int key) {
  Node *x = (Node *)malloc(sizeof(Node));
  x->key = key;
  x->next = nil->next;
  nil->next->prev = x;
  nil->next = x;
  x->prev = nil;
}

int main(void) {
  int key, n, i;
  char com[20];
  scanf("%d", &n);
  init();
  for(i=0;i<n;i++) {
    scanf("%s%d",com, &key);
    if (com[0] == 'i') insert(key);
    else if(com[0] == 'd') {
      if(strlen(com) > 6) {
        if(com[6] == 'F')
          deleteFirst();
        else if(com[6] == 'L') deleteLast();
      } else deleteKey(key);
    }
  }
  printList();
  return 0;
}


Measured memory_bytes: 33036
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
	int h,n;
	int a[100005] ;
	cin >> h >> n;
	for(int i=0;i<n;i++){
		cin >> a[i] ;
		if(h>0) h-=a[i] ;
	}
	if(h<=0) cout <<"Yes" ;
	else cout <<"No" ;
	return 0;
}


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

int main() {
  int n, m, k; cin >> n >> m >> k;
  vector<vector<int>> adj(n + 1);
  vector<int> bad(n + 1);
  for (int i = 0; i < m; i++) {
    int u, v; cin >> u >> v;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  
  vector<int> color(n + 1);
  vector<int> sz;
  vector<bool> vis(n + 1, false);
  function<int(int, int)> dfs = [&] (int u, int c) -> int {
    color[u] = c;
    vis[u] = true;
    int ans = 1;
    for (int x : adj[u]) if (!vis[x]) {
      ans += dfs(x, c);
    }
    return ans;
  };
  int current_color = 0;
  for (int i = 1; i <= n; i++) {
    if (!vis[i]) {
      int num = dfs(i, current_color++);
      sz.push_back(num);
    }
  }
  
  for (int i = 0; i < k; i++) {
    int u, v; cin >> u >> v;
    if (color[u] == color[v]) {
      bad[u]++; bad[v]++;
    }
  }
  
  for (int i = 1; i <= n; i++) {
    int ans = sz[color[i]] - 1 - adj[i].size() - bad[i];
    cout << ans << " ";
  }
  cout << endl;
  return 0;
}

Measured memory_bytes: 8832
#include <iostream>
#include <cstring>
#include <cstdio>
#include <algorithm>
#define maxn 200005

using namespace std;

int n,m,ans[maxn][3];
struct node
{
    int x,y;
    bool operator <(const node &a)const
    {
        return x<a.x;
    }
}d[maxn/2];

int main()
{

    scanf("%d%d",&n,&m);
    for (int i=0;i<m;i++) scanf("%d%d",&d[i].x,&d[i].y);
    sort(d,d+m);
    for (int i=1;i<=n;i++) ans[i][1]=1;
    for (int i=0;i<m;i++)
    {
        if (d[i].x==0) continue;
        int p=d[i].y,t1=ans[p][1],t2=ans[p+1][1];
        ans[p][1]+=t2-ans[p][2];
        ans[p+1][1]+=t1-ans[p+1][0];

        ans[p][2]=ans[p+1][1];
        ans[p+1][0]=ans[p][1];
    }
    for (int i=1;i<n;i++) printf("%d ",ans[i][1]);
    printf("%d\n",ans[n][1]);
    return 0;
}

Measured memory_bytes: 6380
#include <bits/stdc++.h>
#define fast ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define ii pair<int,int>
#define F first
#define S second
#define pb push_back
#define pf push_front
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define fore(i,a,b) for(int i = a;i < b; i+= 1)
#define forr(i,a) for(int i = a; i >= 0; i--)
#define fori(i,m) for(auto i = m.begin(); i != m.end(); i++) 
#define sz(s) int(s.size())
#define cls(a,car) memset(a,car,sizeof (a))
using namespace std;
typedef long long ll;
const int N = 1 * 1e5 + 5;
const ll mod = 1e9 + 7;
const int INF = INT_MAX;
const ll INFCAD  = ll(INT_MAX) * 2 + 1;
int n, k;
int v[N];
int dp[N];
int main(){/*
    freopen("in","r",stdin);
    freopen("out","w",stdout);*/
    fast;
    cls(dp, -1);
    cin >> n >> k;
    fore(i, 0, n)cin >> v[i];
    fore(i,0,N)
        dp[i] = 1e9;
    dp[n - 1] = 0;
    for(int i = n - 2; i >= 0; i--){
        for(int j = 1; j <= k; j++){
            if(i + j <= n - 1)
                dp[i] = min(dp[i],dp[i + j] + abs(v[i] - v[i + j]));
        }
    }
    cout << dp[0] << '\n';
    return 0;   
}

Measured memory_bytes: 1024
#[macro_use]
mod input {

use std;
use std::io;

const SPLIT_DELIMITER: char = ' ';

#[macro_export]
#[allow(unused_macros)]
macro_rules! input {
    ( $($x:expr ),*) => {
        {
            let temp_str = input_line_str();
            let mut split_result_iter = temp_str.split_whitespace();
                $(
                let buf_split_result = split_result_iter.next();
                let buf_split_result = buf_split_result.unwrap();
                    ($x) = buf_split_result.parse().unwrap();
                )*
        }
    };
}

#[allow(dead_code)]
pub fn input_line_str() -> String {
    let mut s = String::new();
    io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

#[allow(dead_code)]
pub fn p<T>(t: T)
where
    T: std::fmt::Display,
{
    println!("{}", t);
}

#[allow(dead_code)]
pub fn input_vector2d<T>(line: usize) -> Vec<Vec<T>>
where
    T: std::str::FromStr,
{
    let mut v: Vec<Vec<T>> = Vec::new();

    for _ in 0..line {
        let vec_line = input_vector();
        v.push(vec_line);
    }
    v
}

#[allow(dead_code)]
pub fn input_vector<T>() -> Vec<T>
where
    T: std::str::FromStr,
{
    let mut v: Vec<T> = Vec::new();

    let s = input_line_str();
    let split_result = s.split(SPLIT_DELIMITER);
    for z in split_result {
        let buf = match z.parse() {
            Ok(r) => r,
            Err(_) => panic!("Parse Error"),
        };
        v.push(buf);
    }
    v
}

#[allow(dead_code)]
pub fn str2vec(s: &str) -> Vec<char> {
    let mut v: Vec<char> = Vec::new();
    for c in s.chars() {
        v.push(c);
    }
    v
}

}

use input::*;

use std::collections::VecDeque;

fn main() {
    let n: usize;
    input!(n);
    let s = str2vec(&input_line_str());

    let mut i: isize = 0;
    let mut v: VecDeque<char> = VecDeque::new();

    for z in s {
        if z == '(' {
            v.push_back(z);
            i += 1;
        } else {
            v.push_back(z);
            if i <= 0 {
                v.push_front('(');
            } else {
                i -= 1;
            }
        }
    }
    while i > 0 {
        v.push_back(')');
        i -= 1;
    }
    for z in v {
        print!("{}", z);
    }
    println!("");
}

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

int main(){
  char alpha[10000];
  int count[26] = {0};
  int num = 0;
  
  cin.getline(alpha,sizeof(alpha));
  while(1){
  for(int i = 0; alpha[i] != NULL; i++){
    if(alpha[i] >= 97){
      num = alpha[i] - 'a';
    }else{ 
      num = alpha[i] - 'A';
    }
    count[num]++;
  }
  
   cin.getline(alpha,sizeof(alpha));
   if(alpha[0] == NULL)break;
  }
  for(int i = 97; i < 123; i++){
    cout << (char)i << " : " << count[i-97] << endl;
  }

}


Measured memory_bytes: 3104
#include <iostream>
#include <algorithm>
#include <numeric>
#include <vector>
using namespace std;
int main()
{
	int n, k;
	cin >> n;
	cin >> k;
	string s;
	cin >> s;
	s[k - 1] = s[k - 1] - 'A' + 'a';
	cout << s;


	return 0;
}

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

int main()
{
  int a, b;
  char op;
  cin >> a >> op >> b;
  if (op == '+')
    cout << a + b << endl;
  else
    cout << a - b << endl;
}


Measured memory_bytes: 256
read a;read b;read c;read x;
s=0;
for i in `seq 0 $a`;do
	for j in `seq 0 $b`;do
		r=$[x-i*500-j*100];
		if [ $r -ge 0 -a $[r%50] -eq 0 -a $[r/50] -le $c ];then
			s=$[s+1];
		fi
	done
done
echo $s


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

int abs(int n){
  if(n < 0) n *= -1;
  return n;
}

int main() {
  int n, m;
  cin >> n >> m;
  vector<int> a(n), b(n), c(m), d(m), v(n, 1000000000), r(n);
  rep(i, n) cin >> a[i] >> b[i];
  rep(i, m) cin >> c[i] >> d[i];
  rep(i, n){
    rep(j, m){
      if(v[i] > abs(a[i]-c[j]) + abs(b[i]-d[j])){
        v[i] = abs(a[i]-c[j]) + abs(b[i]-d[j]);
        r[i] = j+1;
      }
    }
  }
  rep(i, n) cout << r[i] << endl;
  return 0;
}

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

using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int N, M;
    cin >> N >> M;
    
    vector<int> cnt(M, 0);
    
    for (int i = 0; i < N; ++i) {
        int K_i;
        cin >> K_i;
        for (int j = 0; j < K_i; ++j) {
            int A_ij;
            cin >> A_ij;
            ++cnt[A_ij - 1];
        }
    }
    
    int res = 0;
    for (int i = 0; i < M; ++i) {
        if (cnt[i] == N) {
            ++res;
        }
    }
    
    cout << res << endl;
    
    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
 
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
 
#define start_routine() int begtime = clock();
#define end_routine() int endtime = clock(); cerr << endl << "Time elapsed: " << (endtime - begtime)*1000/CLOCKS_PER_SEC << " ms"; return 0
#define speed() cin.tie(0), cout.tie(0), ios_base::sync_with_stdio(false)
// #define exit(a, b) return cout << a, b;
 
// debugger
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cout << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#define debug(stuff) cout << #stuff << ": " << stuff <<endl
#define debugc(stuff) cout << #stuff << ": "; for(auto x: stuff) cout << x << " "; cout << endl;
// 
 
#define loop(i,a,b) for(ll i=a;i<b;i++)
#define all(v) v.begin(), v.end() 
 
#define print(stuff) cout << stuff << endl
#define printc(stuff) for(auto x: stuff) cout << x << " "; cout << endl;
#define printPrec(stuff) cout << fixed << setprecision(15) << stuff << endl;
#define len length
#define ret0 return 0
#define ret return 
 
 
#define ll long long
#define ld long double
#define fi first
#define endl '\n'
#define se second
#define pb push_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define fill(ar, x) memset(ar, x, sizeof ar)
 
#define vl vector<ll> 
#define sl set<ll>
#define pll pair<ll, ll>
#define mll map<ll, ll> 
#define pq priority_queue<ll>
 
// typedef tree<ll,null_type,less<ll>,rb_tree_tag,
// tree_order_statistics_node_update> indexed_set;
 
#define inf (long long int) 1e18
#define eps 0.000001
#define mod 1000000007
#define mod1 998244353
#define MAXN (ll)2e5+5
#define N (1ll<<10)

void solve(){
    ll k;
    cin>>k;
    ll sum = 0;
    loop(i,1,k+1){
        loop(j,1,k+1){
            loop(l, 1, k+1){
                ll val = __gcd(i,j);
                val = __gcd(val, l);
                sum += val;
            }
        }
    }
    print(sum);
}
 
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
   
 
    ll t = 1;
    // cin>>t;
    while(t--){
        solve();
    }
    
}


Measured memory_bytes: 3660
"use strict";
function Main(input) {
    let lines = input.split("\n");
    let S = lines.shift().split(/\s/)[0].split("").map((v) => v - 0);
    let N = S.length;
    let ans0 = 0, ans1 = 0;
    for (let n = 0; n < N; n++) {
        if (n % 2 == 0) {
            if (S[n] == 1) ans0++; else ans1++;
        } else {
            if (S[n] == 0) ans0++; else ans1++;
        }
    }
    console.log(Math.min(ans0, ans1));
}
if (typeof window == "undefined") Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 9676
#include<stdio.h>
int main()
{
    int W, H, x, y, r;

    scanf("%d %d %d %d %d", &W, &H, &x, &y, &r);

    if ((x >= r) && (y >= r) && (W - r >= x) && (H - r >= y))
    {
        printf("Yes\n");
    }
    else
    {
        printf("No\n");
    }
    return 0;
}


Measured memory_bytes: 2108
#include <iostream>


using namespace std;


int main(){


    int a,b,c,i,j,k;


    cin >> a >> b;


    c=0;


    for (i=0;i<=a;i++)


    {


        for (j=0;j<=a;j++)


        {


            if ((b-i-j>=0) && (b-i-j<=a))


            {


                c++;


            }


        }


    }


    cout << c << endl;


}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define MOD 1000000007
#define INF 1001001001
#define LINF 1001001001001001001
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define bit(n) (1LL<<(n))
using namespace std;

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

bool check(ll N, ll K, vector<ll> A, ll X) {
  ll count = 0;
  rep(i,N) {
    count += (A[i] + X - 1) / X - 1;
  }
  return count <= K;
}

int main() {

  ll N, K;
  cin >> N >> K;

  vector<ll> A(N);
  rep(i,N) cin >> A[i];
  sort(A.rbegin(), A.rend());

  ll bottom = 1;
  ll top = A[0];
  
  while (bottom < top) {
    ll X = bottom + (top - bottom) / 2;
    if (check(N, K, A, X)) top = X;
    else bottom = X + 1;
  }

  cout << bottom << endl;

  return 0;
}

Measured memory_bytes: 6244
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<string>
#include<utility>
#include<queue>
#include<tuple>
#include<stdio.h>
#define rep(i, n) for(int i=0;i<n;i++)
using namespace std;

int main(){
	int n;
	cin>>n;
	vector<string> s;
	string a;
	rep(i, n){
		cin>>a;
		s.push_back(a);
	}
	sort(s.begin(), s.end());
	int b=1;
	for(int i=1;i<n;i++){
		if(s[i]!=s[i-1]){
			b++;
		}
	}
	cout<<b<<endl;
	return 0;
}

Measured memory_bytes: 11660
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ul  unsigned long long int
#define speed ios_base::sync_with_stdio(false); cin.tie(NULL)
#define mod
//ll divide(ll a, ll b)  //euler's theorem(a/b)%mod
//{
//   return a*power(b,mod-2)%mod;  //only when mod is prime
//}

ll power(ll x, ll y)
{
    ll res = 1;
   while (y > 0) {
        if (y & 1)
            res = res * x;
        y = y >> 1;
        x = x * x;
    }
    return res;
}
ll dp[3003][3003]={};
int main()
{
    speed;
    string s,t;
    cin>>s>>t;
    for(int i=1;i<int (s.length())+1;i++)
    {
    	for(int j=1;j<int (t.length())+1;j++)
    	{
    		if(s[i-1]==t[j-1])
    		dp[i][j]=1+dp[i-1][j-1];
			else
			dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
		}
	}
	ll i=s.length(),j=t.length();
	string ans;
	while(i>0&&j>0)
	{
		if(s[i-1]==t[j-1])
		ans+=s[i-1], i--,j--;
		else if(dp[i][j-1]>dp[i-1][j])
		j--;
		else
		i--;
	}
	reverse(ans.begin(),ans.end());
	cout<<ans<<'\n';
	return 0;
}


Measured memory_bytes: 74044
import java.io.InputStream;
import java.io.PrintStream;
import java.util.Scanner;

public class Main {
	InputStream in = System.in;
	PrintStream out = System.out;

	public void _main(String[] args) {
		Scanner sc = new Scanner(in);

		int A = sc.nextInt();
		int B = sc.nextInt();

		sc.close();

		int add = A + B;
		int sub = A - B;
		int mul = A * B;

		out.println(Math.max(Math.max(add, sub), mul));

	}

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


Measured memory_bytes: 23124
import java.io.*;
import java.io.ObjectInputStream.*;
import java.util.*;
import java.util.regex.*;


public class Main {

	final static long MOD = (long)1e9+7;
	//final static long MOD = 998244353;

	public static String[] Ws = null;
	public static int wsIndx = 0;
	public static BufferedReader in = null;
	public static long cnt=0;
	public static PrintWriter pw = new PrintWriter(System.out);
	public static void main(String[] args) throws Exception {
		slove(args);
		if(in!=null){
			in.close();
		}
		pw.flush();
		pw.close();
	}

	public static void slove(String[] args) throws Exception{
		int N = nextInt();
		int M = nextInt();
		int[][] g = new int[N+1][N+1];
		for(int i=0;i<M;i++) {
			int a = nextInt();
			int b = nextInt();
			g[a][b]=1;
			g[b][a]=1;
		}

		int ans = 0;
		for(int i=1;i<N+1;i++) {
			for(int k=i+1;k<N+1;k++) {
				if(g[i][k]==1) {
					g[i][k]=0;
					g[k][i]=0;
					boolean[] visit = new boolean[g.length];
					Arrays.fill(visit,true);
					dfs(g,visit,1);
					for(int z=1;z<g.length;z++) {
						if(visit[z]==true) {
							ans++;
							break;
						}
					}
					g[i][k]=1;
					g[k][i]=1;
				}
			}
		}
		pw.println(ans);
	}

	public static void dfs(int[][] g ,boolean[] visit,int idx) {
		visit[idx]=false;
		for(int i=1;i<g.length;i++) {
			if(g[idx][i]==1 && visit[i]) {
				dfs(g,visit,i);
			}
		}
	}


	public static void check() throws Exception{
		if(in == null){
			in = new BufferedReader(new InputStreamReader(System.in));
		}
		if(Ws==null || Ws.length<=wsIndx){
			Ws = in.readLine().split(" ");
			wsIndx=0;
		}
	}
	public static int nextInt()throws Exception{
		check();
		return Integer.parseInt(Ws[wsIndx++]);
	}

	public static long nextLong()throws Exception{
		check();
		return Long.parseLong(Ws[wsIndx++]);
	}

	public static String nextString()throws Exception{
		check();
		return Ws[wsIndx++];
	}

	public static int[] nextInts()throws Exception{
		check();
		int[] tmp = new int[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Integer.parseInt(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static long[] nextLongs()throws Exception{
		check();
		long[] tmp = new long[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Long.parseLong(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static String[] nextStrings()throws Exception{
		check();
		wsIndx=Ws.length;
		return Ws;
	}


}



Measured memory_bytes: 25872
/*Lucky_Glass*/
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;

const int N=5e5;

int len;
char str[N+3];
int lef[N+3],rig[N+3];

void RunPI(int *pi){
    pi[0]=0;
    for(int i=1;i<len;i++){
        int x=pi[i-1];
        while(x && str[x]!=str[i])
            x=pi[x-1];
        if(str[x]==str[i]) pi[i]=x+1;
        else pi[i]=0;
    }
}
int main(){
    scanf("%s",str);
    len=strlen(str);
    RunPI(lef);
    reverse(str,str+len);
    RunPI(rig);
    reverse(rig,rig+len);
    if(len-lef[len-1]==1){
        printf("%d\n1\n",len);
        return 0;
    }
    if(len%(len-lef[len-1]) || lef[len-1]==0){
        printf("1\n1\n");
        return 0;
    }
    int ans=0;
    for(int i=1;i<len;i++){
        int lenl=i,lenr=len-i;
        bool acl=lenl%(lenl-lef[i-1])||lef[i-1]==0,
			 acr=lenr%(lenr-rig[i])||rig[i]==0;
        if(acl && acr) ans++;
    }
    printf("2\n%d\n",ans);
    return 0;
}


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

#define Q int t; scanf("%d", &t); for(int q=1; q<=t; q++)
typedef long long int lli;
typedef pair<int, int> pi;
typedef pair<lli, lli> pii;

#define N 100010
vector<int> adj[N];
int vis[N];
vector<int> ans(N);
vector<pi> ed;
int st;
int t = 5;

void bfs(int x)
{
    queue<int> qu;
    qu.push(x);
    vis[x] = 1;
    int cnt = 0;
    while(!qu.empty()){
        int u = qu.front();
        qu.pop();
        cnt++;
        for(auto v: adj[u]){
            if(vis[v] == 0){
                vis[v] = 1;
                qu.push(v);
            }
        }
    }
    cnt--;
    qu.push(x);
    vis[x] = t;
    while(!qu.empty()){
        int u = qu.front();
        qu.pop();
        ans[u] = cnt;
        for(auto v: adj[u]){
            if(vis[v] == 1){
                vis[v] = t;
                qu.push(v);
            }
        }
    }
    t++;
}

int main()
{
    int n, m , k;
    cin >> n >> m >> k;
    for(int i=0; i<m; i++){
        int u, v;
        cin >> u >> v;
        adj[u].push_back(v);
        adj[v].push_back(u);
        ed.push_back({u, v});
    }
    for(int i=0; i<k; i++){
        int u, v;
        cin >> u >> v;
        ed.push_back({u, v});
    }
    for(int i=1; i<=n; i++){
        if(vis[i] == false){
            st = i;
            bfs(i);
        }
    }
    for(auto x: ed){
        if(vis[x.first] == vis[x.second]){
            ans[x.first]--;
            ans[x.second]--;
        }
    }
    for(int i=1; i<=n; i++){
        cout << ans[i] << " ";
    }
    cout << endl;

    return 0;
}


Measured memory_bytes: 11896
#include <iostream>
#include <functional>
#include <algorithm>
#include <math.h>
#include <iomanip>
#include <vector>
#define ll long long
#define ALLv(a)  (a).begin(),(a).end()
#define ALL(a,n)  (a),(a)+n

#define INF 1010000000000000017LL
#define MOD 1000000007LL
#define EPS 1e-12
#define PI 3.14159265358979323846
//REPEAT
//------------------------------------------
#define FOR(i,m,n) for(int (i)=(m);(i)<(n); i++)
#define REP(i,n) for(int (i)=0;(i)<(n);(i)++)
#define REPS(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)
#define WREP(i,in,j,jn) REP(i,in)REP(j,jn)
using namespace std;
//-------------------------------------------

int main(void){
  ll N;cin>>N;
  ll X[N];REP(i,N)cin>>X[i];
  ll sum=0;
  REP(i,N){
    sum+=X[i];
  }
  ll ave=sum*1.0/N+0.5;
  ll d=0;
  ll ret=0;
  REP(i,N){
    d=X[i]-ave;
    ret+=d*d;
  }
  cout<<ret;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int x,y;
    cin>>x>>y;
    if(x == 2||y == 2)
        cout<<"No";
    else if(x == 1||x == 3||x == 5||x == 7||x == 8||x == 10||x == 12)
    {
        if(y == 1||y == 3||y == 5||y == 7||y == 8||y == 10||y == 12)
            cout<<"Yes";
        else
            cout<<"No";
    }
    else
    {
        if(y == 4||y == 6||y == 9||y == 11)
            cout<<"Yes";
        else
            cout<<"No";
    }
    return 0;
}

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


int main(){
    int n,u,v,m;
    cin>>n>>u>>v>>m;
    map<int,pair<int,int>> usagi;
    map<int,pair<int,int>> neko;
    
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            int val;
            cin>>val;
            usagi[val]=make_pair(i,j);
        }
    }

    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            int val;
            cin>>val;
            neko[val]=make_pair(i,j);
        }
    }

    vector<int> usagirow(n,0);
    vector<int> usagicol(n,0);
    int usagidig0=0,usagidig1=0;
    int usagingo=0;
    vector<int> nekorow(n,0);
    vector<int> nekocol(n,0);
    int nekodig0=0,nekodig1=0;
    int nekongo=0;
    const int DRAW=-1;
    const int USAGI=0;
    const int NEKO=1;
    int winner=DRAW;
    for(int i=0;i<m;i++){
        int val;
        cin>>val;
        if(n==1){
            if(neko.count(val)) nekongo++;
            if(usagi.count(val)) usagingo++;
        }
        else{
        if(neko.count(val)){
            int r=neko[val].first,w=neko[val].second;
            if(++nekorow[r]==n) nekongo++;
            if(++nekocol[w]==n) nekongo++;
            
            if(r==w){
                if(++nekodig0==n) nekongo++;
            }
            if(r+w==n-1){
                if(++nekodig1==n) nekongo++;
            }
            
        }
        if(usagi.count(val)){
            int r=usagi[val].first,w=usagi[val].second;
            if(++usagirow[r]==n) usagingo++;
            if(++usagicol[w]==n) usagingo++;

            if(r==w){
                if(++usagidig0==n) usagingo++;
            }
            if(r+w==n-1){
                if(++usagidig1==n) usagingo++;
            }

        }
        }

        bool uw=(usagingo>=u);
        bool nw=(nekongo>=v);
        if(uw ^ nw){
            if(uw) winner=USAGI;
            if(nw) winner=NEKO;
        }
    }
    if(winner==USAGI) cout<<"USAGI"<<endl;
    if(winner==NEKO) cout<<"NEKO"<<endl;
    if(winner==DRAW) cout<<"DRAW"<<endl;
    return 0;
}


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

int main() {
    int N,ans;
    cin >> N;
    ans=N*100/108;
    if (N*100%108!=0)
    ans++;
    if (ans*108/100!=N)
    cout << ":(" << endl;
    else
    cout << ans << endl; 
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void)
{
  int A,B,C,ans;

 scanf("%d %d",&A,&B);

 for(C=1;C<=3;C++){
   ans=A*B*C;
   if(ans%2!=0){
     printf("Yes\n");
     break;
   }
   printf("No\n");
   break;
 }
   return 0;
}


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

using namespace std;

int main() {
  while(1) {
    int n;
    cin >> n;
    if(n == 0) break;
    int a[n];
    for(int i = 0; i < n; i++) {
      cin >> a[i];
    }
    int Min = abs(a[1] - a[0]);
    for(int i = 0; i < n; i++) {
      for(int j = i+1; j < n; j++) {
        Min = min(Min,abs(a[i] - a[j]));
      }
    }
    cout << Min << endl;
  }

}

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

typedef long long LL;
const int N = 100005, mod = 1000000007;
const LL inf = 0x3f3f3f3f3f3f3f3f;

void reduce(int &x) { x += x >> 31 & mod; }
int n, dp[N], L[N], sum[N], ans = 0;
LL A, B, x[N];

int main() {
	std::ios::sync_with_stdio(0), std::cin.tie(0);
	std::cin >> n >> A >> B;
	if (A > B) std::swap(A, B);
	x[0] = -inf; for (int i = 1; i <= n; ++i) std::cin >> x[i];
	for (int i = 1; i + 2 <= n; ++i) if (x[i + 2] - x[i] < A)
		return std::cout << "0\n", 0;
	L[1] = 1;
	for (int i = 2; i <= n; ++i)
		L[i] = x[i] - x[i - 1] >= A ? L[i - 1] : i;
	sum[0] = dp[0] = dp[1] = 1, sum[1] = 2; int k = 0;
	for (int i = 2; i <= n; ++i) {
		while (x[i] - x[k + 1] >= B) ++k;
		int l = L[i - 1] - 1, r = k;
		if (l <= r) {
			dp[i] = sum[r]; if (l) reduce(dp[i] -= sum[l - 1]);
		}
		reduce(sum[i] = sum[i - 1] + dp[i] - mod);
	}
	for (int i = L[n] - 1; i <= n; ++i)
		reduce(ans += dp[i] - mod);
	std::cout << ans << '\n';
	return 0;
}

Measured memory_bytes: 2176
n = int(input())
s = [input() for i in range(n)]
m = int(input())
t = [input() for i in range(m)]
from collections import Counter
sc = Counter(s)
tc = Counter(t)
expected_gain = []
for key in sc.keys():
    if key in t:
        expected_gain.append(sc[key] - tc[key])
    else:
        expected_gain.append(sc[key])

if max(expected_gain) >= 0:
    print(max(expected_gain))
else:
    print(0)

Measured memory_bytes: 3316
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int inf=0x3f3f3f3f;
const ll INF=0x3f3f3f3f3f3f3f;
const double pi=3.1415926535897932384626;
inline ll read(){
	ll x=0,f=1;
	char ch=getchar();
	while(ch<'0'||ch>'9'){
		if(ch=='-') f=-1;
		ch=getchar();
	}
	while(ch>='0'&&ch<='9'){
		x=(x<<1)+(x<<3)+(ch^48);
		ch=getchar();
	}
	return x*f;
}
int ans;
string a,b;
int main(){
	cin>>a;
	cin>>b;
	int len=a.length();
	for(int i=0;i<len;i++){
		if(a[i]!=b[i]) ++ans;
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 3880
N = map(int, input())
d_list = list(map(int, input().split()))
#3
#3 1 2ときたらsum = 3*1,3*2,1*2 で、 1*3と2*1は不要
#i * i+1, i * i+2, ..., i+1 * i+2, i+1 * i+2, ..., i*3 * i*4,...と行った形で計算してsumを求める。

i_max = len(d_list) #d_list = [0, 1, 2]なら3
sum = 0

for i in range(i_max):
    j = i
    while j + 1 <  i_max:
        mul = d_list[i] * d_list[j + 1]
        sum += mul
        j += 1

print(sum)

Measured memory_bytes: 3060
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <tuple>
#include <utility>
#include <vector>
#define ll long long
#define itn int
#define endl '\n'
#define co(ans) cout<<ans<<endl
#define COYE cout<<"YES"<<endl
#define COYe cout<<"Yes"<<endl
#define COye cout<<"yes"<<endl
#define CONO cout<<"NO"<<endl
#define CONo cout<<"No"<<endl
#define COno cout<<"no"<<endl
#define FORE(i,a) for(auto &i:a)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n)  FFOR(i,1,n)
#define PB push_back
#define MP make_pair
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort((V).begin(),(V).end())
#define REVERSE(V) reverse((V).begin(),(V).end())
#define EACH(V,i) for(typeof((V).begin()) i=(V).begin();i!=(V).end();++i)
#define equals(a,b) (fabs((a)-(b))<EPS)
#define INF ((1LL<<62)-(1LL<<31))
#define EPS 1e-10
#define PI 3.141592653589793238
#define MOD 1000000007
#define MMOD 998244353
#define MAX 2010101
using namespace std;
using Edge=pair<ll,ll>;
using Graph=vector<vector<int>>;
inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T>inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}
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;}
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int,int> PII;
typedef pair<ll,ll> PLL;
typedef long long LL;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int main(){
  ll N;
  cin>>N;
  ll A[N+1],mx=0,it=0;
  RREP(i,N){
    cin>>A[i];
    if(abs(mx)<=abs(A[i])){
      mx=A[i];
      it=i;
    }
  }
  
  cout<<2*N-1<<endl;
  RREP(i,N){
    cout<<it<<" "<<i<<endl;
    A[i]+=A[it];
  }
  
  if(mx>=0){
    for(int i=1; i<N; ++i){
      cout<<i<<" "<<i+1<<endl;
      A[i+1]+=A[i];
    }
  }
  else{
    for(int i=N; i>1; --i){
      cout<<i<<" "<<i-1<<endl;
      A[i-1]+=A[i];
    }
  }
  
  return 0;
}

Measured memory_bytes: 3648
#include <iostream>
#include<sstream>
#include<vector>
#include<iterator>
using namespace std;

int main(void)
{
	int A, B, C;
	cin >> A >> B >> C;

	if(A > B)
		swap(A, B);

	if(B > C)
		swap(B, C);

	string ret;
	if(A==5 && B==5 && C==7)
		ret = "YES";
	else
		ret = "NO";

	cout << ret << endl;

	return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
  int n,c=0;string s;
  cin>>n>>s;
  if(n%2==1)
    cout<<"No";
  else
  {
    for(int i=0;i<=(n/2-1);i++)
    {
      if(s[i]!=s[i+n/2])
        c++;
    }
    if(c==0)
    cout<<"Yes";
  else
    cout<<"No";
  }
  
  
  return 0;
}
      

Measured memory_bytes: 256
import os, sys, re, math, queue

N = int(input())
jobs = []
for _ in range(N):
	A,B = list(map(int,input().split(' ')))
	jobs.append((A,B))

jobs = sorted(jobs, key = lambda x: [x[1],-x[0]])
t = 0
ret = 'Yes'
for j in jobs:
	t += j[0]
	if t > j[1]:
		ret = 'No'
		break

print(ret)


Measured memory_bytes: 59460
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define INF 1<<30
#define LINF 1LL<<60

int main(void) {
	cin.tie(0); ios::sync_with_stdio(false);
	string S; cin >> S;
	for (int i = 0; i < S.length() - 1;i++) {
		if (S[i] == 'A' && S[i + 1] == 'C') {
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
#include<map>
#include<bitset>
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<string>
#include<stack>
#define REP(i,x,y) for(ll i=x;i<y;i++)
#define SIZE(a) ll(a.size())
#define vll vector<ll>
#define MEMSET(a, n, m) for(ll i=0;i<=n;i++) a[i] = m
#define BIT(n) (ll(1)<<n)
#define UNIQUE(v) v.erase(unique(v.begin(),v.end()),v.end())
#define UNIQUE_ARRAY(a,n) n = unique(a + 1, a + x + 1) - a - 1
#define SORT(a,n) sort(a+1,a+n+1)
#define SORT_O(a,n,order) sort(a+1,a+n+1,order)
#define PER(i,y,x) for(ll i=y;i>x;i--)
typedef long long ll;
using namespace std;

int main(){
    ll N;
    cin>>N;
    if (N==1){
        cout<<"Hello World"<<endl;
    }
    else{
        ll A,B;
        cin >>A>>B;
        cout<<A+B<<endl;
    }
    
}



Measured memory_bytes: 256
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int[] a = new int[5];
        for (int i = 0; i < 5; i++) {
            a[i] = sc.nextInt();
        }
        int min = 10;
        int ans = 0;
        for (int i = 0; i < 5; i++) {
            if(a[i] % 10 != 0){
                min = Math.min(min, a[i] % 10);
            }
            ans += (a[i] + 9) / 10 * 10;
        }
        if(min != 10) ans -= (10 - min);
        System.out.println(ans);
        sc.close();
    }

}


Measured memory_bytes: 21716