akhauriyash/Code-Regression huggingface dataset:
#define ll long long
#define ffor(i, a, b) for (int i = (a); i < (b); i++)
#define rfor(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define SIZE 100001
#define MOD 1000000007
#define INF 100000000
using namespace std;

int main() {
  int n;
  scanf("%d", &n);

  // vector<int> a(250001);
  deque<int> deq;
  // rep(i, n) scanf("%d", &a[i]);

  rep(i, n) {
    int a;
    scanf("%d", &a);
    if (i % 2 == (n - 1) % 2)
      deq.push_front(a);
    else
      deq.push_back(a);
  }

  for (auto x : deq) printf("%d ", x);
  printf("\n");
}

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

int main(){
    int h, w;
    cin >> h >> w;
    int a, b;
    cin >> a >> b;

    for (int i = 0; i < b; i++){
        for (int j = 0; j < a; j++)
            cout << 1;
        for (int j = a; j < w; j++)
            cout << 0;
        cout << endl;
    }

    for (int i = b; i < h; i++){
        for (int j = 0; j < a; j++)
            cout << 0;
        for (int j = a; j < w; j++)
            cout << 1;
        cout << endl;
    }
}


Measured memory_bytes: 1280
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  int x=ceil(n/1.08);
  if(n==floor(x*1.08)){
    cout<<x<<endl;
    return 0;
  }
  cout<<":("<<endl;
  return 0;
}

Measured memory_bytes: 256
#ifdef Rahul
# include "RAHUL.h"
#else
# include <bits/stdc++.h>
  using namespace std;
# define error(...) 42;
#endif
#define SZ(v) int((v).size())
#define ALL(vec) begin(vec), end(vec)
typedef long long i64;
template<typename T> inline bool uax(T &x, T y) {return (y > x) ? x = y, true : false;}
template<typename T> inline bool uin(T &x, T y) {return (y < x) ? x = y, true : false;}
template<typename T> void kek(T ans) {cout << ans << endl; exit(0);}
#define Lu(...) [&] (auto &&u) { return __VA_ARGS__; }
#define Luv(...) [&] (auto &&u, auto &&v) { return __VA_ARGS__; }
const int MOD = (int) 1e9 + 7;
const i64 INF = (i64) 1e18 + 42;

const int N = 2e6 + 42;
int cnt[N][26];
int sz[N];
i64 ans = 0;

struct Trie {
  struct Node {
    static const int ALPHA = 26;
    int is;
    array<int,ALPHA> nxt;
    int depth;
    Node(): is(), nxt(), depth() {}
    int& operator [] (size_t idx) {
      return nxt[idx];
    }
  };
  vector<Node> nodes;
  int ptr;
  Trie(): nodes(1), ptr(1) {}
  void add(const string &s) {
    int cur = 0;
    for (const char &c: s) {
      int u = c - 'a';
      if (!nodes[cur][u]) {
        nodes.emplace_back();
        nodes[ptr].depth = 1 + nodes[cur].depth;
        nodes[cur][u] = ptr++;
      }
      cur = nodes[cur][u];
    }
    nodes[cur].is = 1;
  }
  string tmp;
  void dfs(int u = 0, int w = 0) {
    error(u, char(w+'a'), tmp);
    sz[u] = 0;
    for (int i = 0; i < 26; ++i) if (nodes[u][i]) {
      int v = nodes[u][i];
      tmp += 'a' + i;
      dfs(v, i);
      tmp.pop_back();
      sz[u] += sz[v];
      for (int j = 0; j < 26; ++j) {
        cnt[u][j] += cnt[v][j];
      }
    }
    error(u, sz[u]);
    for (int i = 0; i < 26; ++i) if (nodes[u][i]) {
      int v = nodes[u][i];
      if (nodes[v].is) {
        error(u, char(i+'a'), cnt[u][i]);
        ans += cnt[u][i] - 1;
      }
    }
    sz[u] += nodes[u].is;
    if (u) {
      cnt[u][w] = sz[u];
    }
  }
};

int main() {
  cin.tie(nullptr) -> sync_with_stdio(false);
  
  int n; cin >> n;
  Trie t{};
  for (int i = 0; i < n; ++i) {
    string s; cin >> s;
    reverse(ALL(s));
    t.add(s);
  }
  t.dfs();
  kek(ans);
}


Measured memory_bytes: 339080
#include <iomanip>
#include <iostream>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;

int main(void) {
  ios::sync_with_stdio(false);
  int64_t N, K;
  cin >> N >> K;

  int64_t M = N % K;
  int64_t X = abs(M - K);
  int64_t answer = min(M, X);
  cout << answer << endl;
  return 0;
}


Measured memory_bytes: 256
n,m = map(int,input().split())


def comb(x,y):
    r = 1
    for i in range(x,x-y,-1):
        r *= i
    for i in range(y,0,-1):
        r //= i
    return r
def find(ID,a):
    tmp = a
    while tmp !=ID[tmp]:
        tmp = ID[tmp]
    return tmp
def union(ID,a,b):
    ida = find(ID,a)
    idb = find(ID,b)
    if ida!=idb:
        ID[a] = idb
        ID[b] = idb
        ID[ida] = idb
        tmp = SIZE[idb]*SIZE[ida]
        SIZE[idb] += SIZE[ida]
        return tmp 
    return 0
bridges = []
res = []
ID = []
SIZE = []
cnt = comb(n,2)
for i in range(n+1):
    ID.append(i)
    SIZE.append(1)
for i in range(m):
    a,b = map(int,input().split())
    bridges.append((a,b))

for i in range(m-1,-1,-1):
    res.append(cnt)
    cnt -= union(ID,bridges[i][0],bridges[i][1])
    

for i in range(m-1,-1,-1):
    print(res[i])            


Measured memory_bytes: 24804
s = input()
a = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
b = a.index(s)
b += 1
print(a[int(b)])

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

int main(){
  int N;
  cin >> N;
  string str;
  cin >>str;
  
  int ans=1;
  for(int i=1; i<str.size(); i++){
    if(str[i-1]!=str[i]) ans++;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,l;
  cin>>n>>l;
  if(l<=0&&l+n-1>=0)
    cout<<n*(2*l+n-1)/2<<endl;
  else if(l>0)
    cout<<(n-1)*(2*l+n)/2<<endl;
  else
    cout<<(n-1)*(2*l+n-2)/2<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
#include<list>
using namespace std;
#define i64  long long
#define int  long long
 
#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807
#define MOD 1000000007


void solve()
{
  int N;
  cin>>N;
  vector<int> vec(N,0);
  for (int i = 0; i < N; i++)
  {
    cin>>vec[i];
  }

  std::vector<int>::iterator iter = std::max_element(vec.begin(), vec.end());
  size_t index = std::distance(vec.begin(), iter);
  int MAX = vec[index];
  int max_num;
  vector<int> max_index;
  int second_max = 0;
  for (int i = 0; i < N; i++)
  {
    if(MAX == vec[i])
    {
      max_index.push_back(i);
    }
    else
    {
      second_max = max(second_max,vec[i]);
    }
    
  }

  if(max_index.size() > 1)
  {
    for (int i = 0; i < N; i++)
    {
      cout<<MAX<<endl;
    }
    return;
  }

  for (int i = 0; i < N; i++)
  {
    if(index == i)
    {
      cout<<second_max<<endl;
    }
    else
    {
      cout<<MAX<<endl;
    }
    
  }
  
  
  
  
  return;  
}

int32_t main(int32_t argc, const char *argv[])
{
  // std::ios::sync_with_stdio(false);
  // std::cin.tie(0);

  // std::cout << std::fixed;
  // std::cout << std::setprecision(8);

  solve();

 
  return 0;
}

Measured memory_bytes: 4848
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <utility>
#include <vector>
#define MOD 1000000007
using namespace std;
typedef long long ll;
#include <cstring>
int n, m;

struct unionfind {
  int parent;
  int node;
  int edge;
};
unionfind g[200001];

void init() {
  for (int i = 0; i <= n; i++) {
    g[i].parent = i;
    g[i].node = 1;
    g[i].edge = 0;
  }
}

int ufind(int x) {
  if (x == g[x].parent) {
    return x;
  }
  int res = ufind(g[x].parent);
  g[x].node = g[res].node;
  g[x].edge = g[res].edge;
  g[x].parent = res;
  return res;
}

void umerge(int x, int y) {
  g[x].node += g[y].node;
  g[x].edge += g[y].edge + 1;
  g[y].parent = x;
}

int main() {
  int x, y, flag;
  cin >> n;
  vector<int> ans(n + 1), dp(n + 5);
  set<pair<int, int>> s;
  vector<pair<pair<int, int>, int>> v;
  for (int i = 0; i < n; i++) {
    cin >> x >> y;
    v.push_back({{x, y}, i});
  }
  sort(v.begin(), v.end());
  init();
  s.insert({v[0].first.second, v[0].second});
  for (int i = 1; i < n; i++) {
    y = min(v[i].first.second, s.begin()->first);
    while (!s.empty() && s.begin()->first < v[i].first.second) {
      umerge(v[i].second, s.begin()->second);
      s.erase(s.begin());
    }
    s.insert({y, v[i].second});
  }
  for (int i = 0; i < n; i++) {
    x = ufind(i);
    cout << g[x].node << endl;
  }
}

Measured memory_bytes: 14112
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back 
#define eb emplace_back
#define fn for(int i =0 ;i <n;i++)
#define fn1 for( int i =1;i<=n;i++)
#define fm for(int j =0 ;j <m;j++)
#define fm1 for(int j =1;j<=m;j++)
#define fi first
#define se second
#define endl '\n'
#define MOD 1000000007
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
const int N = 2e6+5;
const int INF = 1e18L;
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << 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...);
}
int ar[N];
int dp[N];
signed main(){
	// #ifndef ONLINE_JUDGE
	// freopen("input.txt","r",stdin);
	// freopen("output.txt","w",stdout);
	// #endif
	IOS;
	int T=1;
	// cin >> T;
	while(T--){
		int n;
		cin >> n;
		map<string,int>mp;
		int mx = 0;
		fn
		{
			string s;
			cin>>s;
			mp[s]++;
			mx = max(mx,mp[s]);
		}
		vector<string>v;
		for(auto i : mp){
			if(i.se==mx)v.pb(i.fi);
		}
		sort(all(v));
		for(auto i : v)cout<<i<<endl;
	}
	cerr << "Time Taken : " << 1.0 * clock() / CLOCKS_PER_SEC << " sec \n";
	return 0;
}

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

class Book {
private:
  string title;
  string author;
  string date;

  int date2day(string date){
    vector<string> elements;
    string tmp = "";
    for(int i = 0; i < date.size(); i++){
      if(date[i] == '/'){
        elements.push_back(tmp);
        tmp = "";
        continue;
      }
      tmp += date[i];
    }
    elements.push_back(tmp);
    
    return 365 * (atoi(elements[0].c_str()) - 1970)
      + (atoi(elements[1].c_str()) - 1) * 31
      + (atoi(elements[2].c_str()) - 1);
  }

public:
  Book(string title, string author, string date) {
    this->title = title;
    this->author = author;
    this->date = date;
  }

  bool match_title(string query){
    if(query == "*") return true;
    for(int i = 0; i + query.size() <= title.size(); i++){
      if(title.substr(i,query.size()) == query) return true;
    }
    return false;
  }

  bool match_author(string query){
    if(query == "*") return true;
    for(int i = 0; i + query.size() <= author.size(); i++){
      if(author.substr(i,query.size()) == query) return true;
    }
    return false;
  }

  bool match_date(string from,string to) {
    int my_sec = date2day(date);
    if(from != "*" && my_sec < date2day(from)) return false;
    if(to != "*" && my_sec > date2day(to)) return false;
    return true;
  }

  string get_title() const {
    return title;
  }
};

int main(){
  int num_of_books;
  int num_of_queries;
  while(~scanf("%d",&num_of_books)){
    vector<Book> books;
    for(int book_i = 0; book_i < num_of_books; book_i++){
      string title,author,date;
      cin >> title >> author >> date;
      books.push_back(Book(title,author,date));
    }
    scanf("%d",&num_of_queries);
    for(int query_i = 0; query_i < num_of_queries; query_i++){
      string title,author,from,to;
      cin >> title >> author >> from >> to;
      for(int book_i = 0; book_i < num_of_books; book_i++){
        if(books[book_i].match_title(title)
           && books[book_i].match_author(author)
           && books[book_i].match_date(from,to)){
          cout << books[book_i].get_title() << endl;
        }
      }
      if(query_i != num_of_queries - 1){
        cout << endl;
      }
    }
  }
}

Measured memory_bytes: 1276
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i=0; i < n; i++)
#define repd(i, n) for (int i = n-1; i > -1; i--)
#define repran(i, a,b) for (int i = a; i<b;i++)
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef pair<int, int> P;
int main()
{
    int n, x, t;
    cin >> n>> x>>t;
    int ans = (n+x-1)/x*t;
    cout << ans << endl;
}

Measured memory_bytes: 3616
using System;
using System.Collections.Generic;
class Program
{
	static void Main(string[] args)
	{
		int N = int.Parse(Console.ReadLine());
		string[] str = Console.ReadLine().Split();
		int[]A = new int[N];
		int sum = 0;
		for(var i=0;i<N;i++){
			A[i] = int.Parse(str[i]);
			sum += A[i];
		}
		int ans = sum;
		int sum2 = 0;
		for(var i=0;i<N-1;i++){
			sum-=A[i];
			sum2+=A[i];
			ans = Math.Min(ans,Math.Abs(sum-sum2));
		}
		Console.WriteLine(ans);
	}
}

Measured memory_bytes: 13140
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <math.h>
#include <vector>
#include <map>
#include <queue>
#include <utility>
#include <algorithm>
#include <string>
using namespace std;
int main() {
  string S;
  cin >> S;
  int l    = S.length();
  bool ans = true;
  for (int i = 0; i < l; i++) {
	  if ((i % 2 == 0 && S[i] == 'L') || (i % 2 == 1 && S[i] == 'R')) {
		  ans = false;
		  break;
		}
	}
  if (ans) {
	  cout << "Yes" << endl;
	}
  else {
	  cout << "No" << endl;
	}
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;
typedef pair<ll, ll> Pll;
using Graph = vector<vector<int>>;
using Graphl = vector<vector<ll>>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define Rep(i, k, n) for (int i = k; i < (int)(n); i++)
#define RRep(i, k, n) for (int i = k; i > (int)(n); i--)
#define FOR(itr, v) for (auto itr = (v).begin(); itr != (v).end(); ++itr)
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define ALL(a)  (a).begin(),(a).end()
#define rALL(a)  (a).rbegin(),(a).rend()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T> void PrintVector(const vector<T> &vec) {for (auto val : vec) cout << val << " "; cout << endl;}
const long long INF = 1LL << 60;
const long long minusINF = -(1LL << 40);
const int MOD = 1000000007;
const double PI = acos(-1); //3.14~
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

int main()
{
    ll n; cin >> n;
    char chr[27];
    int j = 1;
    for (char i = 'a'; i <= 'z'; i++)
    {
        chr[j] = i;
        j++;
    }

    string ans = "";
    if (n > 0 && n < 27)
    {
        cout << chr[n] << endl;
        return 0;
    }
    while(n != 0)
    {
        if (n % 26 == 0)
        {
            ans += 'z';
            n -= 26;
        }
        else ans += chr[n % 26];
        n /= 26;
    }
    reverse(ALL(ans));
    cout << ans << endl;
}

Measured memory_bytes: 3628
k,t = map(int,input().split())
a = sorted(list(map(int,input().split())),reverse=True)
for i in range(t):
    a[i] = -a[i]
import heapq
heapq.heapify(a)
buf = heapq.heappop(a)+1
while len(a)>0:
    x = heapq.heappop(a)
    if buf!=0:
        heapq.heappush(a,buf)
    buf = x+1
print(-buf)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
const int P=1000000007;


int main(){
  int n;cin>>n;
  long long t=1;
  for(int i=1;i<=n;++i)t=t*8%P;
  long long t2=1;
  for(int i=1;i<=n;++i)t2=t2*9%P;
  long long ret=1;
  for(int i=1;i<=n;++i)ret=ret*10%P;
  cout<<(ret-t2*2%P+t+P)%P<<endl;
  return 0;
}


Measured memory_bytes: 3548
import itertools

n, m = map(int, input().split())
x = [None] * n
y = [None] * n
z = [None] * n
for i in range(n):
    x[i], y[i], z[i] = map(int, input().split())

ans = -float('inf')
for bit in range(2 ** 3):
    p = 1 if bit & (1 << 0) == 0 else -1
    q = 1 if bit & (1 << 1) == 0 else -1
    r = 1 if bit & (1 << 2) == 0 else -1

    idxs = list(sorted(range(n), key=lambda i: x[i] * p + y[i] * q + z[i] * r, reverse=True))
    s = t = u = 0
    for i in idxs[:m]:
        s += x[i]
        t += y[i]
        u += z[i]
    ans = max(ans, abs(s) + abs(t) + abs(u))

print(ans)


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

n = 10 ** 5
memo = [1] * (n+1)

for i in range(2, n):
  for j in range(2, n):
    if i * j > n:
      break
    memo[i*j] = 0
memo2 = memo[:]
memo2[1] = 0
for x in range(n+1):
  if x % 2 == 0 or memo[(x+1) // 2] == 0:
    memo2[x] = 0
  
c = [0]

for x in memo2[1:]:
  c.append(c[-1]+x)

q = int(input())
for i in range(q):
  l, r = map(int, input().split())
  print(c[r] - c[l-1])



Measured memory_bytes: 13984
#include <stdio.h>

int main()
{
	int count;
	char tmp;

	scanf("%d", &count);
	
	while(count--){
		scanf("%c", &tmp);
		if(tmp == 'Y')
			break;
	}

	puts((tmp == 'Y') ? "Four" : "Three");

	return 0;
}


Measured memory_bytes: 128
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {
    // TODO 自動生成されたメソッド・スタブ

    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();

    int sum = 0;
    for (int i = 1; i <= n; i++) {
      sum = sum + i;
    }

    System.out.println(sum);
  }
}


Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
#define ll long long int 
#define pb push_back
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    char ch;
    cin>>ch;
    if(ch>='a'&&ch<='z')
    cout<<"a";
    else
    cout<<"A";
    return 0;
     
}

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

int N, M;
vector<int> G[100009];
long long dp[100009];

void dfs1(int v, int p) {
    dp[v] = 1;
    for(int u : G[v]) {
        if(u != p) {
            dfs1(u, v);
            dp[v] *= dp[u] + 1;
            dp[v] %= M;
        }
    }
}

void dfs2(int v, int p, long long dp_p = 0) {
    int n = G[v].size();
    // 積を累積しておく配列
    vector<long long> mul1(n), mul2(n);
    for(int i = 0; i < n; i++) {
        int u = G[v][i];
        if(u == p) {
            mul1[i] = mul2[i] = (dp_p + 1) % M;
            dp[v] *= dp_p + 1;
            dp[v] %= M;
        } else
            mul1[i] = mul2[i] = (dp[u] + 1) % M;
    }
    for(int i = 0; i + 1 < n; i++) {
        mul1[i + 1] *= mul1[i];
        mul1[i + 1] %= M;
    }
    for(int i = n - 1; i - 1 >= 0; i--) {
        mul2[i - 1] *= mul2[i];
        mul2[i - 1] %= M;
    }

    for(int i = 0; i < n; i++) {
        int u = G[v][i];
        if(u != p) {
            long long a = (i ? mul1[i - 1] : 1);
            long long b = (i + 1 < n ? mul2[i + 1] : 1);
            dfs2(u, v, a * b % M);
        }
    }
}

int main() {
    cin >> N >> M;
    for(int i = 0; i < N - 1; i++) {
        int x, y;
        cin >> x >> y;
        x--;
        y--;
        G[x].push_back(y);
        G[y].push_back(x);
    }

    dfs1(0, -1);
    dfs2(0, -1);

    for(int i = 0; i < N; i++)
        cout << dp[i] << endl;

    return 0;
}

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

#define ran 202202

int n;
int a[ran];

int main() {
	scanf("%d", &n);
	for(int i=0;i<n;i++) scanf("%d", &a[i]);
	sort(a, a+n);
	
	bool chk = true;
	for(int i=1;i<n&&chk;i++)
		if(a[i-1]==a[i]) chk = false;
	puts(chk?"YES":"NO");
	
	return 0;
}

Measured memory_bytes: 1024
x1, y1, x2, y2 = map(int, input().split())
a = x2 - x1
b = y2 - y1
x3 = x2 - b
y3 = y2 + a
x4 = x3 - a
y4 = y3 - b
print('{} {} {} {}'.format(x3, y3, x4, y4))


Measured memory_bytes: 2940
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; ++i)
#define REPR(i, n) for (int i = n - 1; i >= 0; --i)
#define FOR(i, a, b) for (int i = a; i < b; ++i)
#define FORR(i, a, b) for (int i = b - 1; i >= a; --i)
#define SORT(v) sort(v.begin(), v.end())
#define SORTR(v) sort(v.rbegin(), v.rend())
#define REV(v) reverse(v.begin(), v.end())
#define ITER(itr, v) for (auto itr = v.begin(); itr != v.end(); ++itr)
#define LB(v, x) (lower_bound(v.begin(), v.end(), x) - v.begin())
#define UB(v, x) (upper_bound(v.begin(), v.end(), x) - v.begin())
#define SZ(v) (int)v.size()
using namespace std;
using ll = long long;
using P = pair<int, int>;

ll dp[3001][3001][5];

ll cmax(ll &x, ll y) {
    return x = max(x, y);
}

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

    int R, C, K;
    cin >> R >> C >> K;
    vector<int> r(K), c(K);
    vector<ll> v(K);
    vector<vector<ll>> g(R, vector<ll>(C));
    REP(i, K) {
        cin >> r[i] >> c[i] >> v[i];
        g[--r[i]][--c[i]] = v[i];
    }
    REP(i, R) {
        REP(j, C) {
            REP(k, 4) {
                cmax(dp[i + 1][j + 1][0], dp[i][j + 1][k]);
                cmax(dp[i + 1][j + 1][k], dp[i + 1][j][k]);
                if (g[i][j] > 0) {
                    cmax(dp[i + 1][j + 1][k + 1], dp[i + 1][j][k] + g[i][j]);
                    cmax(dp[i + 1][j + 1][1], dp[i][j + 1][k] + g[i][j]);
                }
            }
        }
    }
    ll res = 0;
    REP(k, 4) {
        cmax(res, dp[R][C][k]);
    }
    cout << res << endl;

    return 0;
}


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

int main() {
	int h, w;
	cin >> h >> w;
	vector<vector<char>>board(h, vector<char>(w));
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++)cin >> board.at(i).at(j);
	}
	vector<vector<int>>dp(h, vector<int>(w,-1));
	if (board.at(0).at(0) == '.')dp.at(0).at(0) = 0;
	else dp.at(0).at(0) = 1;
	for (int i = 1; i < w; i++) {
		int x = 0;
		if (board.at(0).at(i - 1) == '.' && board.at(0).at(i) == '#')x++;
		dp.at(0).at(i) = dp.at(0).at(i-1) + x;
	}
	for (int i = 1; i < h; i++) {
		int x = 0;
		if (board.at(i - 1).at(0) == '.' && board.at(i).at(0) == '#')x++;
		dp.at(i).at(0) = dp.at(i - 1).at(0) + x;
	}
	for (int i = 1; i < h; i++) {
		for (int j = 1; j < w; j++) {
			int x = 0;
			if (board.at(i).at(j - 1) == '.' && board.at(i).at(j) == '#')x++;
			x += dp.at(i).at(j - 1);
			int y = 0;
			if (board.at(i - 1).at(j) == '.' && board.at(i).at(j) == '#')y++;
			y += dp.at(i - 1).at(j);
			dp.at(i).at(j) = min(x, y);
		}
	}
	cout << dp.at(h - 1).at(w - 1) << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
		Scanner scan = null;
		try{
			scan = new Scanner(System.in);
			int hanako = 0;
			int tarou = 0;
			int n = scan.nextInt();
			for(int i = 0; i < n;i++){
				String a = scan.next();
				String b = scan.next();
				int check = a.compareTo(b);
				if(check <0){
					hanako += 3;
				}else if(check > 0){
					tarou += 3;
				}else{
					hanako++;
					tarou++;
				}
			}
			System.out.println(tarou +" "+hanako);
		}finally{
			if(scan!=null)scan.close();
		}
	}
}

Measured memory_bytes: 20816
#include <iostream>

using namespace std;

int	main(){
	int N, A, B;
	cin >> N >> A >> B;
    if( N * A > B){
    	cout << B;
	} 
	else if(N * A == B){
		cout << B;
	}
	else{
		cout << N * A;
	}
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 1e9;
const double PI = acos(-1);
int dx[4] = {0,1,0,-1};
int dy[4] = {1,0,-1,0};

const int mod = 1000000007;

void solve() {
	ll n, k;
	cin >> n >> k;
	vector<int> v(n);
	rep(i,n) cin >> v[i];
	ll ans = 0;
	for (int i = 0; i < n; i++) {
		ll a = v[i];
		ll l = 0;
		ll r = 0;
		for (int j = 0; j < n; j++) {
			if (j < i && v[j] > a) l++;
		 	if (v[j] > a) r++;
		}
		ans += l * k % mod;
		ans %= mod;
		ans += k * (k - 1) / 2 % mod * r % mod;
		ans %= mod;
	}
	cout << ans << endl;
}

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

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

#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)

#define INF INT_MAX/3
#define ALL(a) (a).begin(),(a).end()
#define SET(a,c) memset(a,c,sizeof a)
#define CLR(a) memset(a,0,sizeof a)
#define ll long long
#define ull unsigned long long

#define PI (3.141592653589794)
#define eps 1e-8
int main() {
	string s1, s2, s3;
	cin >> s1 >> s2 >> s3;
	cout << (char) (s1[0] + ('A' - 'a'));
	cout << (char)(s2[0] + ('A' - 'a'));
	cout << (char)(s3[0] + ('A' - 'a'));
	cout << endl;
}

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

typedef long long ll;

int main(){

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);

	const int mod=1e9 + 7;
	int n,k;
	cin>>n>>k;

	vector<int> v(n,0);
	for(int i=0;i<n;i++)
		cin>>v[i];

	vector<ll> dp(k+1,0);
	for(int i=0;i<=min(k,v[0]);i++)
		dp[i]=1;

	for(int i=1;i<n;i++){
		vector<ll> pre=dp;
		for(int j=1;j<=k;j++){
			pre[j]+=pre[j-1];
			pre[j]%=mod;
		}

		for(int j=1;j<=k;j++){
			int lo=max(0,j-v[i]),hi=j;
			ll tmp=0;
			if(lo>0)
				tmp=pre[lo-1];
			//cout<<pre[hi]<<endl;
			dp[j]=(pre[hi]-tmp+mod)%mod;
			//cout<<dp[j]<<endl;
		}
	}

	cout<<dp[k]<<endl;

	return 0;
}

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

int main() {
	
	int n; cin >> n;
	const int p = 5;
	vector<ll> num(p, 0);
	for (int i = 0; i < n; i++) {
		string s; cin >> s;
		if (s[0] == 'M') num[0]++;
		if (s[0] == 'A') num[1]++;
		if (s[0] == 'R') num[2]++;
		if (s[0] == 'C') num[3]++;
		if (s[0] == 'H') num[4]++;
	}
	ll ans = 0;
	ans += num[0] * num[1] * num[2];
	ans += num[0] * num[1] * num[3];
	ans += num[0] * num[1] * num[4];

	ans += num[0] * num[2] * num[3];
	ans += num[0] * num[2] * num[4];

	ans += num[0] * num[3] * num[4];

	ans += num[1] * num[2] * num[3];
	ans += num[1] * num[2] * num[4];
	ans += num[1] * num[3] * num[4];

	ans += num[2] * num[3] * num[4];
	cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3600
#include <algorithm>
#include <climits>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <vector>

using namespace std;
constexpr long long int INF = std::numeric_limits<long long int>::max();
#define int long long int

void solve() {
  // int x;
  // cout << endl;
  int N;
  cin >> N;

  int ans = 0;
  for (int i = 1; 1 < N / i; i++) {
    if (N / i <= i) {
      break;
    }
    int a = (N / i) - 1;
    // cout << a << endl;
    if (N % a == N / a) {
      ans += a;
    }
  }

  cout << ans << endl;
}

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


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int n,k;
ll sum;
int main()
{
    scanf("%d%d",&n,&k);
    if(k==0)
    {
        printf("%lld\n",(ll)n*n);
        return 0;
    }
    int x=1;
    for(int i=k+1;i<=n;i++)
    {
        sum+=(ll)n/i*x;
        if(n%i>=k)
            sum+=n%i-k+1;
        x++;
    }
    printf("%lld\n",sum);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll =long long;
#define all(v) v.begin(),v.end()
 
int main() {
  ll N,M;
  cin>>N>>M;
  vector<ll> vec(N,0);
  for(ll i=0;i<M;i++) {
ll a,b;
    cin>>a>>b;
    vec[a-1]++;
    vec[b-1]++;
  }
  for(ll x:vec) {
cout<<x<<endl;
  }
}


Measured memory_bytes: 3640
N = int(input())
A = list(map(int, input().split()))

A.sort(reverse=True)

denominator = 0
numerator = 1
while A[numerator] != 0:
    A[denominator] = A[denominator] % A[numerator]
    if A[denominator] == 0:
        denominator += 1
        numerator += 1
        if denominator >= N or numerator >= N:
            break
    else:
        denominator, numerator = numerator, denominator
print(min([a for a in A if a > 0]))

Measured memory_bytes: 14228
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cassert>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
#include <cassert>
#include <string.h>
#include <iomanip>

using namespace std;

int main()
{
	map<char, int> mp;
	string s;
	cin >> s;
	
	if (s.size()!=4) {
		cout <<"No" <<endl;
		return 0;
	}	
	
	else{
		
		for (int i =0; i<s.size(); i++)
		{
			//int n = map[s[i]] + 1;
			mp.insert(make_pair(s[i],mp[s[i]]++));
		}
		
		
		//cout<<map['A']+1;
		
		for (std::map<char, int>::iterator it = mp.begin(); it!=mp.end(); it++)
		{
			if (it->second == 2) continue;
			else {
				cout<<"No"<<endl;
				return 0;
			}
		
		}
		
		
		
		
		
		
		
	}
	
	cout <<"Yes" <<endl;
	
	
	
	
	
	return 0;
}



Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
  int n;
  cin >> n;
  int i;
  int b[n];
  for(i=0;i<n-1;++i){
    cin >> b[i];
  }
  b[n-1]=100000;
  
  int ans=b[0];
  for(i=1;i<n;++i){
    if(b[i]<b[i-1]){
      ans+=b[i];
    }else{
      ans+=b[i-1];
    }
  }
  
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
#define LL long long
#define ULL unsigned long long
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define pll pair<LL,LL>
#define x first
#define y second
#define pi acos(-1)
#define sqr(x) ((x)*(x))
#define pdd pair<double,double>
#define MEMS(x) memset(x,-1,sizeof(x))
#define MEM(x) memset(x,0,sizeof(x))
#define EPS 1e-4
#define arg ARG
#define cpdd const pdd
#define rank Rank
//#define MXN 300000
#define N 100005
vector<int> v[500005];
int p[500005];
int a[500005];
int ans[500005];
struct node{
    node *l,*r;
    int a,b;
    pii Min;
    node(int _a,int _b):a(_a),b(_b),l(NULL),r(NULL){
        Min.x=1e9;
        Min.y=1e9;
    }
}*root;
void pull(node *n){
    n->Min=min(n->l->Min,n->r->Min);
}
void build(node *n){
    if(n->a==n->b)return ;
    int mid=(n->a+n->b)/2;
    n->l=new node(n->a,mid);
    n->r=new node(mid+1,n->b);
    build(n->l);
    build(n->r);
}
void revise(node *n,int x,int k){
    if(n->a==n->b){
        n->Min=mp(k,n->a);
        return ;
    }
    int mid=(n->a+n->b)/2;
    if(x<=mid)revise(n->l,x,k);
    else revise(n->r,x,k);
    pull(n);
}
pii query(node *n,int l,int r){
    if(n->a>=l&&n->b<=r)return n->Min;
    if(n->b<l||n->a>r)return mp(1e9,1e9);
    return min(query(n->l,l,r),query(n->r,l,r));
}
int main(){
    int n,k;
    scanf("%d %d",&n,&k);
    //int p[500005];
    for(int i = 1;i<=n;i++)
        scanf("%d",&p[i]);
    //int a[500005];
    for(int i = 1;i<=n;i++){
        a[p[i]]=i;
    }
    root = new node(1,n);
    build(root);
    priority_queue<int> pq;
    for(int i=n;i>=1;i--){
       // printf("%d ",a[i]);
        pii p=query(root,a[i]-k+1,a[i]);
        if(p.x==1e9){
            pq.push(a[i]);
        }
        else{
            v[p.y].pb(a[i]);
        }
        revise(root,a[i],i);
    }
   // printf("\n");
    for(int i = n;i>=1;i--){
        int x=pq.top();
        pq.pop();
        for(auto it:v[x]){
            pq.push(it);
        }
        ans[x]=i;
       // printf("%d ",x);
    }
 //   printf("\n");
    for(int i = 1;i<=n;i++)
    printf("%d\n",ans[i]);
}


Measured memory_bytes: 83584
///In the name of GOD
#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
const ll MXN = 1e5 + 10;
ll n, m, H, W, cnt0;
ll X[MXN], Y[MXN], cnt[15];
vector<pair<ll, ll>> Pnt;
map<pair<ll, ll>, bool> mp;
inline int GetId(pair<ll, ll> x){
    return lower_bound(Pnt.begin(), Pnt.end(), x) - Pnt.begin() + 1;
}
bool check(ll x, ll y){
    return (1 <= x && x <= H && 1 <= y && y <= W);
}
void Add(ll x, ll y){
    for(int j = 0 ; j < 3; j ++){
        for(int k = 0 ; k < 3; k ++){
            if(!check(x + j - 1, y + k - 1)) continue;
            Pnt.push_back({x + j - 1, y + k - 1});
        }
    }
}
ll Cal(ll x, ll y){
    ll t = 0;
    for(int j = 0 ; j < 3; j ++){
        for(int k = 0 ; k < 3; k ++){
            if(!check(x + j - 1, y + k - 1)) return 0;
            t += mp[{x + j - 1, y + k - 1}];
        }
    }
    return t;
}
int main(){
    ios::sync_with_stdio(0);cin.tie(0); cout.tie(0);
    cin >> H >> W >> n;
    for(int i = 1; i <= n; i ++){
        ll x, y; cin >> x >> y;
        Add(x, y), mp[{x, y}] = 1;
    }
    sort(Pnt.begin(), Pnt.end());
    Pnt.resize(unique(Pnt.begin() , Pnt.end()) - Pnt.begin());
    for(auto Pr : Pnt){
        ll now = Cal(Pr.first, Pr.second);
        cnt[now] ++;
    }
    for(int i = 1; i <= 9; i ++) cnt0 += cnt[i];
    cnt0 = (H - 2) * (W - 2) - cnt0;
    cout << cnt0 << '\n';
    for(int i = 1; i <= 9; i ++) cout << cnt[i] << '\n';
    return 0;
}
/*!
    I CHOOSE TO HAVE FAITH,
    BECAUSE WITHOUT THAT,
    I HAVE NOTHING....
    ITS THE ONLY THING THAT'S KEEPING ME GOING.
*/
//! N.N


Measured memory_bytes: 172260
from itertools import permutations

N, M, R = map(int, input().split())
r = list(map(int, input().split()))
for i in range(R):
  r[i] -= 1

d = [[10000000000]*N for _ in range(N)]
for i in range(N):
  d[i][i] = 0

for i in range(M):
  A, B, C = map(int, input().split())
  d[A-1][B-1] = C
  d[B-1][A-1] = C
  
for k in range(N):
  for i in range(N):
    for j in range(N):
      d[i][j] = min(d[i][j], d[i][k]+d[k][j])
      
perms = permutations(r, R)
ans = 10000000000
for perm in perms:
  now = 0
  for i in range(R-1):
    now += d[perm[i]][perm[i+1]]
  ans = min(ans, now)
  
print(ans)


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


using namespace std;
#define fast ios::sync_with_stdio(0);cin.tie(0);
#define endl        '\n'
#define ll          long long int
#define pb          push_back
#define sz(x)       (int)(x).size()
const ll mod = 1e9 + 7;

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

ll powm(ll a, ll b) {
ll res = 1;
while (b) {
if (b & 1)
res = (res * 1LL * a) % mod;
b >>= 1LL;
a = (a * 1LL * a) % mod;
}
return res;
}

//--------------------------------------------------------------------------------------------------------------------------//



int main() {
	fast
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
 
int n;cin>>n;
ll a[n],b[n],c[n];
for(int i=0;i<n;i++)cin>>a[i]>>b[i]>>c[i];
ll dp[3][n];

dp[0][0]=a[0];
dp[1][0]=b[0];
dp[2][0]=c[0];

for(int i=1;i<n;i++)
{
	dp[0][i]=a[i]+max(dp[1][i-1],dp[2][i-1]);
	dp[1][i]=b[i]+max(dp[0][i-1],dp[2][i-1]);
	dp[2][i]=c[i]+max(dp[1][i-1],dp[0][i-1]);

}	

cout<<max({dp[0][n-1],dp[1][n-1],dp[2][n-1]});

	return 0;
}



Measured memory_bytes: 8292
#include<iostream>
#include<vector>
#include<stack>
using namespace std;
static const int MAX = 100000;
static const int NIL = -1;

int n;
vector<int> G[MAX];
int color[MAX];

void dfs(int r, int c){
    stack<int> S;
    S.push(r);
    color[r] = c;
    while(!S.empty()){
        int u = S.top(); S.pop();
        for(int i = 0; i < G[u].size(); i++){
            int v = G[u][i];
            if(color[v] == NIL){
                color[v] = c;
                S.push(v);
            }
        }
    }
}

void assignColor(){
    int id = 1;
    for(int i = 0; i < n; i++) color[i] = NIL;
    for(int u = 0; u < n; u++){
        if(color[u] == NIL) dfs(u, id++);
    }
}

int main(){
    int s, t, m, q;

    cin >> n >> m;

    for(int i = 0; i < m; i++){
        cin >> s >> t;
        G[s].push_back(t);
        G[t].push_back(s);
    }
    assignColor();

    cin >> q;

    for(int i = 0; i < q; i++){
        cin >> s >> t;
        if( color[s] == color[t]){
            cout << "yes" << endl; 
        }else{
            cout << "no" << endl;
        }
    }

    return 0;
}


Measured memory_bytes: 8972
#include <bits/stdc++.h>
#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPD(i, n) for (ll i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = a; i <= (ll)(b); i++)
#define FORD(i, a, b) for (ll i = a; i >= (ll)(b); i--)
#define STEP(i, a, b, c) for (ll i = a; i <= ll(b); i += c)
#define ALL(x) (x).begin(), (x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define PI 3.14159265358979323846264338327950L
using namespace std;
typedef long long ll;
typedef long double ld;

const ll INF = 1LL << 60;

int main()
{
  ll N;
  cin >> N;

  vector<ll> As(N);
  REP(i, N)
  {
    ll a;
    cin >> a;
    As[i] = a;
  }
  sort(ALL(As));

  ll M = As[N - 1];
  vector<bool> Fs(M + 1, false);
  REP(i, N)
  {
    Fs[As[i]] = true;
  }

  REP(i, N)
  {
    ll a = As[i];
    if (!Fs[a])
      continue;

    if (As[i + 1] == a)
    {
      Fs[a] = false;
    }

    STEP(m, 2 * a, M, a)
    {
      Fs[m] = false;
    }
  }

  ll ans = 0;
  REP(i, M + 1)
  {

    if (Fs[i])
      ans++;
  }

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

Measured memory_bytes: 4764
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1000000007;
const ll LINF=1LL<<60;
const int INF=1<<30;

int main(){
	string s,t;cin>>s>>t;
	set<char> u;
	for(int i = 0; i < s.size(); i++) {
		u.insert(s[i]);
	}
	for(int i = 0; i < t.size(); i++) {
		if (u.find(t[i]) == u.end()){
			cout << -1 << endl;
			return 0;
		}
	}
	string s2 = s + s;
	vector<vector<ll>> a(26);
	vector<ll> count(26,1);

	for(int i = 0; i < s2.size(); i++) {
		a[s2[i] - 'a'].pb(i);
		// cout << s2[i] << endl;
	}
	// for(int i = 0; i < 26; i++) {
	// 	for(int j = 0; j < a[i].size(); j++) {
	// 		cout << char('a' + i) <<a[i][j];
	// 	}
	// 	cout << endl;
	// }
	ll tmp = a[t[0] - 'a'][0];
	ll ans = tmp + 1;//0オリを考慮しますた
	for(int i = 1; i < t.size(); i++) {
		auto ite = upper_bound(ALL(a[t[i] - 'a']),tmp);
		if (*(ite) < s.size()){
			ans += (*(ite) - tmp);
			tmp = *(ite);
		}
		else{
			ans += (*(ite) - tmp);
			tmp = a[t[i] - 'a'][0];
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3000
import sys
## io
IS = lambda: sys.stdin.readline().rstrip()
II = lambda: int(IS())
MII = lambda: list(map(int, IS().split()))
MIIZ = lambda: list(map(lambda x: x-1, MII()))
## dp
INIT_VAL = 0
DP2 = lambda d1, d2: [[INIT_VAL]*d2 for _ in range(d1)]
DP3 = lambda d1, d2, d3: [[[INIT_VAL]*d3 for _ in range(d2)] for _ in range(d1)]
## math
DIVC = lambda x, y: -(-x//y)
DIVF = lambda x, y: x//y

def main():
    n = II()
    aa = MII()
    aa.sort()
    print(aa[-1]-aa[0])

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include <stdio.h>
int main(void)
{

    
	int n,m,A=0,k[30]={0},x,y;


	scanf("%d%d",&n,&m);
	    for(int i=0;i<n;i++){
        scanf("%d",&x);
       	    for(int j=0;j<x;j++){
              scanf("%d",&y);
                 k[y-1]++;
        }

 }
    for(int i=0;i<m;i++){
        if(k[i]==n) A++;}

    printf("%d",A);

}



Measured memory_bytes: 128
#include <bits/stdc++.h>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)a, i##_len=(b); i<i##_len; i++)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define int long long
using namespace std;
using P = pair<int, int>;
using ll = long long;
using prique = priority_queue<int>;
const ll INF = LLONG_MAX/3;

/*-----Library-----*/

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

struct UnionFind {
    vector<int> par; // 親ノード
    vector<int> rank; // ランク
    vector<int> sizeuf; //要素数
    UnionFind(int n = 1) {
        init(n);
    }

    void init(int n = 1) {
        par.resize(n); rank.resize(n); sizeuf.resize(n);
        for (int i = 0; i < n; ++i) {
            par[i] = i;
            rank[i] = 0;
            sizeuf[i]=1;
        }
    }

    int root(int x) {
        if (par[x] == x) {
            return x;
        }
        else {
            int r = root(par[x]);
            return par[x] = r;
        }
    }

    bool issame(int x, int y) {
        return root(x) == root(y);
    }

    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (rank[x] < rank[y]) swap(x, y);
        if (rank[x] == rank[y]) ++rank[x];
        par[y] = x;
        sizeuf[x]+=sizeuf[y];
        return true;
    }

    int size(int x){
        return sizeuf[root(x)];
    }
};

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

long long lcm(long long i,long long j){
    return i*(j/gcd(i,j));
}
//コンビネーション
/*
long long fac[MAX], finv[MAX], inv[MAX];
// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
 */
/*-----Library-----*/
const int MOD=1234567;
signed main(){
	int n,m;
	cin>>n>>m;
	cout<<n*m<<endl;
}



Measured memory_bytes: 3120
N,M = map(int,input().split())
if N > M:
	N, M = M, N
def ura(N,M):
	if N == 1:
		return 1 if M == 1 else M-2
	elif N == 2:
		return 0
	else:
		return N*M-(2*M+2*N-4)
print(ura(N,M))


Measured memory_bytes: 3060
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
using namespace std;
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();}
typedef vector<int> vi;
typedef vector<vi>  vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EACH(t,i,c) for(t::iretator i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n) FOR(i,0,(n)-1)
const double EPS = 1e-10;
const double PI = acos(-1.0);

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

const int INF = INT_MAX/10;

struct state {
	int x, y, d, c;
	state(int x, int y, int d, int c) : x(x), y(y), d(d), c(c) {};
	bool operator<(const state other)const {
		return c>other.c;
	}
};

int dd(int s, int d) {
	switch(s) {
	case 0:
		return d;
	case 1:
		return (d+1)%4;
	case 2:
		return (d+2)%4;
	case 3:
		return (d+3)%4;
	}
}

int main() {
	int w, h;
	while(cin >> w >> h, w) {
		vvi field(h, vi(w));
		vi  pay(4);
		REP(i, h) {
			REP(j, w) {
				cin >> field[i][j];
			}
		}
		REP(i, 4) {
			cin >> pay[i];
		}

		priority_queue<state> Q;
		Q.push(state(0, 0, 0, 0));
		vector<vvi> cost(h, vvi(w, vi(4, INF)));
		cost[0][0][0] = 0;
		int ans = INF;
		while(!Q.empty()) {
			state st = Q.top();
			Q.pop();

			if(st.x == w-1 && st.y == h-1) {
				ans = min(ans, st.c);
				continue;
			}

			REP(s, 4) {
				int nd = dd(s, st.d);
				int nx = st.x + dx[nd];
				int ny = st.y + dy[nd];
				int nc = st.c;
				if(field[st.y][st.x] != s) {
					nc += pay[s];
				}
				if(0 <= nx && nx < w && 0 <= ny && ny < h) {
					if(cost[ny][nx][nd] > nc) {
						cost[ny][nx][nd] = nc;
						Q.push(state(nx, ny, nd, nc));
					}
				}
			}
		}

		cout << ans << endl;
	}

	return 0;
}

Measured memory_bytes: 1352
#include <stdio.h>
 
int main(void)
{
 
  int a, b, r, tmp;


  scanf("%d", &a);
 
  scanf("%d", &b);
 
  /* 自然数 a > b を確認・入替 */
  if(a<b){
    tmp = a;
    a = b;
    b = tmp;
  }
	r = a % b; 
	
	while(r!=0){
    a = b;
    b = r;
    r = a % b;
  }

	
	
	
	
	printf("%d\n", b);
	return 0;

}


Measured memory_bytes: 2048
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
using namespace std;
int n,k;
string s;
int main()
{
  cin >> n >> k;
  cin >> s;
  bool lr = false,rl = false;
  int cnt = 0,xx = 0;  
  rep(i,n-1){
    if(s[i]=='L'&&s[i+1]=='R'){
      if(rl){
	cnt++;
	rl = false;
      }
      else lr = true;
    }
    if(s[i]=='R'&&s[i+1]=='L'){    
      if(lr){
	cnt++;
	lr = false;
      }
      else rl = true;
    }
    if(s[i]=='R'&&s[i+1]=='R'){
      xx++;
    }
    if(s[i]=='L'&&s[i+1]=='L'){
      xx++;
    }
  }
  int c=0;
  if(lr||rl) c=1;
  int a;
  if(k>cnt) a=cnt*2+xx+1;
  else a=k*2+xx;
  int res = min(n-1,a);
  cout << res << "\n";
  
  return 0;
}


Measured memory_bytes: 512
from collections import Counter
 
N = int(input())
V = [int(i) for i in input().split()]
V1 = V[1::2]
V2 = V[0::2]
 
v1 = Counter(V1).most_common(2)
v2 = Counter(V2).most_common(2)
 
v1.append((0,0))
v2.append((0,0))
 
 
if v1[0][0] != v2[0][0]:
  print(N - v1[0][1] - v2[0][1])
  
else:
  print(min(N - v1[1][1] - v2[0][1], N - v1[0][1] - v2[1][1]))

Measured memory_bytes: 63212
import bisect

n,q = map(int,input().split())
s = input()
l=[]
r=[]
a = []
c = []
for i in range(q):
    l1,r1 = map(int,input().split())
    l.append(l1)
    r.append(r1)
for i in range(n-1):
    if s[i] + s[i+1] == 'AC':
        a.append(i+1)
        c.append(i+2)
for i in range(q):
    ans = 0
    ans = bisect.bisect_right(c,r[i]) - bisect.bisect_left(a,l[i])
    print(ans)

Measured memory_bytes: 15836
N = int(input())

size = 1
while True:
    n = size * (size-1) // 2
    if n == N:
        break
    elif n > N:
        print('No')
        exit()
    size += 1

sets = [[] for _ in range(size)]

n = 1
for i in range(size):
    for j in range(i+1, size):
        sets[i].append(n)
        sets[j].append(n)
        n += 1

print('Yes')
print(size)
for i in range(size):
    print(' '.join(map(str, [len(sets[i])] + sets[i])))

Measured memory_bytes: 14012
A = int(input())
B = int(input())
C = int(input())
X = int(input())

ans = 0
for i in range(A+1):
	for j in range(B+1):
		for k in range(C+1):
			if i*500 + j*100 + k*50 == X:
				ans +=1

print(ans)

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

using namespace std;

#define YES cout << "YES" << endl;
#define NO  cout << "NO"  << endl;
#define Yes cout << "Yes" << endl;
#define No  cout << "No"  << endl;
 
#define INF INT_MAX
#define MOD 1000000007
#define PI  acos(-1)

using ll  = long long;
using ull = unsigned long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define rrep(i, n) for (ll i = (n)-1; i >= 0; i--)

int main(int argc, char *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    ll N;
    cin >> N;

    vector<ll> A(N), B(N), C(N-1);
    rep (i, N) {
        cin >> A[i];
        A[i]--;
    }

    rep (i, N) {
        cin >> B[i];
    }

    rep (i, N-1) {
        cin >> C[i];
    }

    ll ans = 0;
    rep (i, N) {
        ans += B[i];
    }

    rep (i, N-1) {
        if (A[i]+1 == A[i+1]) {
            ans += C[A[i]];
        }
    }

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

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

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  if ( a != b && b == c) cout << a << endl;
  else if (b != a && a == c) cout << b << endl;
  else cout << c << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
    string a,s;int n;
    cin>>n>>s;
    char cur = s[0];
    a+=cur;
    for(int i=0;i<n;++i){
        if(s[i]!=cur){
            cur=s[i];
            a+=cur;
        }
    }
    cout<<a.size()<<endl;
    return 0;
}


Measured memory_bytes: 640