akhauriyash/Code-Regression huggingface dataset:
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys,collections,itertools,re,math,fractions,decimal,random,array,bisect,heapq

# decimal.getcontext().prec = 50
# sys.setrecursionlimit(10000)
# MOD = 10**9 + 7

def solve(f):
    n = f.read_int()
    h = f.read_int_list()

    c = 0
    ans = 0
    for i in xrange(n-1):
        if h[i] >= h[i+1]:
            c += 1
        else:
            c = 0
        ans = max(c, ans)

    return ans


class Reader(object):
    def __init__(self, filename=None):
        self.file = open(filename) if filename is not None else None
        self.case = 1

    def __readline(self):
        return self.file.next().strip() if self.file else raw_input()

    def next_case(self):
        self.file.next()
        self.case += 1

    def read_int(self): return int(self.__readline())
    def read_float(self): return float(self.__readline())
    def read_long(self): return long(self.__readline())
    def read_decimal(self): return decimal.Decimal(self.__readline())
    def read_str(self): return self.__readline()

    def read_int_list(self): return map(int, self.__readline().split())
    def read_float_list(self): return map(float, self.__readline().split())
    def read_long_list(self): return map(long, self.__readline().split())
    def read_decimal_list(self): return map(decimal.Decimal, self.__readline().split())
    def read_str_list(self): return self.__readline().split()

if __name__ == '__main__':
    filename = sys.argv[1] if len(sys.argv) > 1 else None
    f = Reader(filename)
    if f.file:
        while True:
            print "Case #%d\n"%f.case, solve(f)
            try:
                f.next_case()
            except StopIteration:
                break
    else:
        print solve(f)


Measured memory_bytes: 12868
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <cstdlib>
using namespace std;

int main() {
  int n;
  while(cin >>n, n) {
    vector<int> v;
    int x;
    for(int i=0; i<n; i++) {
      cin >> x;
      v.push_back(x);
    }
    int ans = 1<<30;
    for (int i=0; i<(1<<n); i++) {
      int a=0, b=0;
      for (int j=0; j<n; j++) {
        if ((i>>j)&1)
          a += v[j];
        else
          b += v[j];
      }
      ans = min(ans, abs(a-b));
    }

    cout << ans << endl;
  }
}

Measured memory_bytes: 904
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long K = Long.parseLong(sc.next());
        System.out.println(50);
        if (0<=K && K<=50) {
            for (int i=0;i<50;i++) {
                if (i<K) {
                    System.out.println(50-i);
                } else {
                    System.out.println(0);
                }
                if (i==49) {
                    return;
                }
            }
        }
        for (int i=0;i<50;i++) {
            long out = (i+1)+(K/50-1);
            if ((i+1)>(50-(K%50))) {
                out++;
            }
            System.out.println(out);
        }
    }
}

Measured memory_bytes: 22612
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int N;
string S[2];

int main()
{
	cin >> N;
	cin >> S[0];
	cin >> S[1];
	
	long long int ans;
	for (int i = 0; i < S[0].length(); i++){
		if (i == 0){
			ans = 3;
			if (S[0][0] == S[0][1]){
				ans *= 2;
				i++;
			}
		} else {
			if (S[0][i] == S[1][i]){
				if (S[0][i - 1] == S[1][i - 1]){
					ans *= 2;
				}
			} else {
				if (S[0][i - 1] == S[1][i - 1]){
					ans *= 2;
				} else {
					ans *= 3;
				}
				i++;
			}
		}
		
		ans %= 1000000007;
	}
	
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define GET_REP(_1, _2, _3, NAME, ...) NAME
#define rep(...) GET_REP(__VA_ARGS__, irep, _rep)(__VA_ARGS__)
#define rep1(...) GET_REP(__VA_ARGS__, irep1, _rep1)(__VA_ARGS__)
#define _rep(i, n) irep (i, 0, n)
#define _rep1(i, n) irep1(i, 1, n)
#define irep(i, a, n) for (int i = a; i < (int)(n); ++i)
#define irep1(i, a, n) for (int i = a; i <= (int)(n); ++i)
#define rrep(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define rrep1(i, n) for (int i = (int)(n); i >= 1; --i)
#define allrep(X, x) for (auto &&X : x)
#define all(x) begin(x), end(x)
#define debug(x) cout << #x " => " << (x) << endl
#ifdef LOCAL
  #include "../../Lib/cout_container.hpp"
#endif
using lint = long long;
constexpr int MOD = (int)1e9 + 7;
constexpr double EPS = 1e-9;
using namespace std;
namespace { struct INIT { INIT() { cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(15); } } INIT; }

class UnionFind {
  vector<int> parent;

  public:
  UnionFind(void) {}
  UnionFind(const int size) { init(size); }
  void init(const int size) { parent.assign(size, -1); }
  int  find(int x) {
    if (parent[x] < 0) return x;
    return parent[x] = find(parent[x]);
  }
  bool unite(int a, int b) {
    a = find(a), b = find(b);
    if (a == b) return false;
    if (parent[a] > parent[b]) swap(a, b);
    parent[a] += parent[b];
    parent[b]  = a;
    return true;
  }
  bool same(int a, int b) { return find(a) == find(b); }
  int  size(int x) { return -parent[find(x)]; }
};

using Weight = int;
struct Edge {
  int src, dst;
  Weight weight;
  Edge(void) {}
  Edge(int src, int dst) : src(src), dst(dst) {}
  Edge(int src, int dst, Weight weight) : src(src), dst(dst), weight(weight) {}
};
using Edges = vector<Edge>;
using Graph = vector<Edges>;

void edges_to_graph(Graph &graph, const Edges &edges, const int vertices, const bool directed = true) {
  graph.clear(), graph.resize(vertices);
  for (const auto &e : edges) graph[e.src].emplace_back(e);
  if (!directed) for (const auto &e : edges) graph[e.dst].emplace_back(Edge(e.dst, e.src, e.weight));
}

int main(void) {
  int n, m, k;
  cin >> n >> m >> k;
  vector<int> a(m), b(m), c(k), d(k);
  rep (i, m) cin >> a[i] >> b[i];
  rep (i, k) cin >> c[i] >> d[i];
  allrep (x, a) x--;
  allrep (x, b) x--;
  allrep (x, c) x--;
  allrep (x, d) x--;
  vector<unordered_set<int>> fri(n), blo(n);
  UnionFind uf(n);
  rep (i, m) {
    fri[a[i]].insert(b[i]);
    fri[b[i]].insert(a[i]);
    uf.unite(a[i], b[i]);
  }
  rep (i, k) {
    blo[c[i]].insert(d[i]);
    blo[d[i]].insert(c[i]);
  }
  rep (i, n) {
    int sum = uf.size(i) - fri[i].size() - 1;
    allrep(x, blo[i]) {
      if(uf.same(i, x)) --sum;
    }
    cout << sum << '\n';
  }
  return 0;
}

Measured memory_bytes: 34304
import java.util.*;

public class Main {
  public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);
    long all = 1;
    long B = 1;
    long H = sc.nextLong();   //the HP of monster
    double X = Math.log(H) / Math.log(2);
    long A = (int) X;

    for (int i = 0; i <= A-1; i++){
      B = B * 2;
      all += B;
    }
    System.out.println(all);
  }
}


Measured memory_bytes: 21972
from enum import Enum
import sys
import math
 
BIG_NUM = 2000000000
MOD = 1000000007
EPS = 0.000000001
 
#0:中央 1:南 2:東 3:西 4:北 5:裏側
class Dice():
 
    def __init__(self):
        self.number = [i for i in range(6)]
        self.work = [i for i in range(6)]
 
 
    def setNumber(self,n0,n1,n2,n3,n4,n5):
        self.number[0] = n0
        self.number[1] = n1
        self.number[2] = n2
        self.number[3] = n3
        self.number[4] = n4
        self.number[5] = n5
 
 
    def roll(self,loc):
        for i in range(6):
            self.work[i] = self.number[i]
 
        if loc == 'E':
            self.setNumber(self.work[3],self.work[1],self.work[0],self.work[5],self.work[4],self.work[2])
        elif loc == 'N':
            self.setNumber(self.work[1],self.work[5],self.work[2],self.work[3],self.work[0],self.work[4])
        elif loc == 'S':
            self.setNumber(self.work[4],self.work[0],self.work[2],self.work[3],self.work[5],self.work[1])
        elif loc == 'W':
            self.setNumber(self.work[2],self.work[1],self.work[5],self.work[0],self.work[4],self.work[3])
 
 
    def get_Top(self):
        return self.number[0]
 
 
dice = Dice()
table = list(map(int,input().split()))
dice.setNumber(table[0], table[1], table[2], table[3], table[4], table[5])
 
loc_array = str(input())
for tmp_loc in loc_array:
    dice.roll(tmp_loc)
 
print("%d"%(dice.get_Top()))


Measured memory_bytes: 6396
#include <bits/stdc++.h>
using namespace std;
#define idfc ios_base::sync_with_stdio(false),cin.tie(nullptr),cout.tie(nullptr)
#define ll long long
#define pb push_back
#define mp make_pair
#define nt _int128
#define ld long double
long double PI =3.14159265358979323846;


const ll modo=1e9+7;
const ll inf=2e14;
const ll ms=(2e5) +5;



int main()
{
    idfc;
    int n,m;
    cin>>n>>m;
    if(n==m)cout<<"Yes";
    else cout<<"No";
}

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

//#define int long long
#define all(v) (v).begin(), (v).end()
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<n;++i)
#define exrep(i, a, b) for(ll i = a; i < b; i++)
#define out(x) cout << x << endl
#define EPS (1e-7)
#define gearup ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<ll> vl;
typedef vector<vector<ll> > vvl;
typedef vector<vector<vector<ll> > > vvvl;
ll MOD = 1000000007;
const long long L_INF = 1LL << 60;
const int INF = 2147483647; // 2^31-1
const double PI = acos(-1);
//cout<<fixed<<setprecision(10);

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
template<class T> void debug(T v){rep(i,v.size()) cout<<v[i]<<" ";cout<<endl;}
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};

signed main()
{   
    gearup;
    int n; cin >> n;
    vvl a(n+100,vl(3));
    rep(i,n)cin>>a[i][0]>>a[i][1]>>a[i][2];
    vvl dp(100010,vl(3,-L_INF));
    rep(i,3)dp[0][i] = 0;
    rep(i,n){
        rep(j,3){
            rep(k,3){
                if(j!=k)chmax(dp[i+1][k],dp[i][j]+a[i][k]);
            }
        }
    }
    ll res = 0;
    rep(i,3)chmax(res,dp[n][i]);
    out(res);
}


Measured memory_bytes: 11264
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <sstream>
#include <functional>
#include <map>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <set>
#include <list>
#include <numeric>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const ll INF = 1LL<<29;
const ll mod = 1e9+7;
#define rep(i,n) for(int (i)=0;(i)<(ll)(n);++(i))
#define repd(i,n,d) for(ll (i)=0;(i)<(ll)(n);(i)+=(d))
#define all(v) (v).begin(), (v).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset((m),(v),sizeof(m))
#define chmin(x,y) (x=min(x,y))
#define chmax(x,y) (x=max(x,y))
#define fst first
#define snd second
#define UNIQUE(x) (x).erase(unique(all(x)),(x).end())
template<class T> ostream &operator<<(ostream &os, const vector<T> &v){int n=v.size();rep(i,n)os<<v[i]<<(i==n-1?"":" ");return os;}

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


Measured memory_bytes: 256
import java.util.*;

public class Main {
  public static void main(String[] args) {
          Scanner sc = new Scanner(System.in);
          int num1 = sc.nextInt();
          if(num1 == 3 || num1 == 5 || num1 == 7){
            System.out.println("YES");
          } else {
            System.out.println("NO");
          }
          }
    }

Measured memory_bytes: 22100
#include <iostream>

using namespace std;

int main(int argc, char* argv[]) {
  int H, W;
  cin >> H >> W;

  char pixels[H][W];
  for (int i = 0; i < H; ++i) {
    for (int j = 0; j < W; ++j) {
      cin >> pixels[i][j];
    }
  }

  for (int i = 0; i < H + 2; ++i) {
    for (int j = 0; j < W + 2; ++j) {
      if ((i == 0 || i == H + 1) || (j == 0 || j == W + 1)) {
        cout << '#';
      } else {
        cout << pixels[i - 1][j - 1];
      }
    }
    cout << endl;
  }

  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
using namespace std;
typedef long long ll;
const int M=2e5+5;
const ll INF=1e12;
ll a[M],f[M];
ll n;ll k;
int check(ll x)
{
    ll cost=0;
    for(int i=1;i<=n;i++)cost+=max(a[i]-x/f[i],0LL);
    if(cost<=k)return 1;return 0;
}
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 main()
{
    n=read(),k=read();
    for(int i=1;i<=n;i++) a[i]=read();
    for(int i=1;i<=n;i++) f[i]=read();
    sort(a+1,a+n+1); sort(f+1,f+n+1);
    reverse(f+1,f+n+1);
    ll l=0,r=INF,ans=0;
    while(l<=r)
    {
        ll mid=(l+r)/2;
        if(check(mid)) r=mid-1,ans=mid;
        else l=mid+1;
    }
    printf("%lld\n",ans);
    return 0;
}
//？？？

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

using namespace std;

using ll = long long;

int main(){
   ll n; cin >> n;
   n = n % 10;
   if(n == 3)cout << "bon";
   else if(n == 0 || n == 1 || n == 6 || n == 8)cout << "pon";
   else cout << "hon";
}


Measured memory_bytes: 3612
n = input()
find = []
c = []
for i in ['S ','H ','C ','D ']:
    for j in map( str , xrange(1,14) ):
        find.append( i+j )   
for i in xrange(n):
    find.remove( raw_input() )
for i in xrange( len( find ) ):
    print find[i]

Measured memory_bytes: 6440
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<bitset>
#include<vector>
#include<deque>
#include<queue>
#include<map>
#include<set>
#include<stack>
#include<cmath>
#include<iomanip>
#include <functional>
using namespace std;
typedef long long ll;
const int mod = 1000000007;
const double EPS = 1e-10;
//cout << fixed << std::setprecision(9)
//memset(a, 0, sizeof(a));
//--------------------------


vector<int> a;
int n, k;

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

int main()
{
	cin >> n >> k;

	for (int i = 0;i < n;i++) {
		int t;
		cin >> t;
		a.push_back(t);
	}

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

	if (a[n - 1] < k) {
		cout << "IMPOSSIBLE" << endl;
		return 0;
	}

	for (int i = 0;i < n;i++) {
		if (a[i] == k) {
			cout << "POSSIBLE" << endl;
			return 0;
		}
	}

	for (int i = 0;i < n - 1;i++) {
		if (a[i + 1] - a[i] == k) {
			cout << "POSSIBLE" << endl;
			return 0;
		}

		if (a[i + 1] - a[i] == 1) {
			cout << "POSSIBLE" << endl;
			return 0;
		}
	}

	int d = a[0];
	for (int i = 1;i < n;i++) {
		d = gcd(d, a[i]);
	}

	if (d == 1) {
		cout << "POSSIBLE" << endl;
		return 0;
	}

	if (k % d == 0) {
		cout << "POSSIBLE" << endl;
		return 0;
	}

	cout << "IMPOSSIBLE" << endl;

	return 0;
}


Measured memory_bytes: 892
n,k,q = map(int, list(input().split()))
point=[k]*n
a=[]
	
for i in range(q):
	a.append(int(input()))
	point[a[i]-1]+=1
for i in range(n):
    if point[i]-q>0:
        print("Yes")
    else:
        print("No")


Measured memory_bytes: 10508
#!/usr/bin/env python
from __future__ import division, print_function

import os
import sys
from io import BytesIO, IOBase

if sys.version_info[0] < 3:
    from __builtin__ import xrange as range
    from future_builtins import ascii, filter, hex, map, oct, zip


def main():
    n, x = map(int, input().split())
    l = [int(li) for li in input().split()]
    d = s = 0

    for i in l:
        if d <= x:
            s += 1
        d += i

    if d <= x:
        s += 1

    print(s)


# region fastio

BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


def print(*args, **kwargs):
    """Prints the values to a stream, or to sys.stdout by default."""
    sep, file = kwargs.pop("sep", " "), kwargs.pop("file", sys.stdout)
    at_start = True
    for x in args:
        if not at_start:
            file.write(sep)
        file.write(str(x))
        at_start = False
    file.write(kwargs.pop("end", "\n"))
    if kwargs.pop("flush", False):
        file.flush()


if sys.version_info[0] < 3:
    sys.stdin, sys.stdout = FastIO(sys.stdin), FastIO(sys.stdout)
else:
    sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)

input = lambda: sys.stdin.readline().rstrip("\r\n")

# endregion

if __name__ == "__main__":
    main()


Measured memory_bytes: 29164
#!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1
sys.setrecursionlimit(10**7)

n = int(input())
G = [[] for i in range(n)]
for _ in range(n-1):
  a,b = map(int,input().split())
  a -= 1; b-=1
  G[a].append(b)
  G[b].append(a)
ans = [0] * n
color = [[],[]]
def coloring(node,pre,oddeven):
  color[oddeven%2].append(node)
  for vi in G[node]:
    if vi != pre:
      coloring(vi,node,oddeven+1)
  return

coloring(0,-1,0)
A = n//3 + int(bool(n%3))
B = n//3 + int(n%3 == 2)
C = n//3
# この時点ではA>=Bである
# if len(color[0]) < len(color[1]):
#   A,B = B,A
a=b=0; c=1
if len(color[0]) > C and len(color[1]) > C:
  for i,ci in enumerate(color[0]):
    if i < A:
      ans[ci] = 3 * i + 1
    else:
      ans[ci] = 3 * c
      c += 1

  for i,ci in enumerate(color[1]):
    if i < B:
      ans[ci] = 3 * i + 2
    else:
      ans[ci] = 3 * c
      c += 1

elif len(color[0]) <= C:
  # elseが読まれるとき必ずlen(color[0]) < A
  # Bは条件を満たすはず
  for i ,ci in enumerate(color[0]):
    ans[ci] = 3 * c
    c += 1
  for i ,ci in enumerate(color[1]):
    if a < A:
      ans[ci] = 3 * a + 1
      a += 1
    elif b < B:
      ans[ci] = 3 * b + 2
      b += 1
    else:
      ans[ci] = 3 * c
      c += 1

else:
  # elseが読まれるとき必ずlen(color[0]) < A
  # そんなことなかったwwww
  for i ,ci in enumerate(color[1]):
    ans[ci] = 3 * c
    c += 1
  for i ,ci in enumerate(color[0]):
    if a < A:
      ans[ci] = 3 * a + 1
      a += 1
    elif b < B:
      ans[ci] = 3 * b + 2
      b += 1
    else:
      ans[ci] = 3 * c
      c += 1

print(*ans)

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1e9+7,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<ll,ll> P;

void Main() {
  char c;
  R c;
  if(c=='A') c='T';
  else if(c=='T') c='A';
  else if(c=='G') c='C';
  else c='G';
  pr(c);
}

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


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

#define rep(a,b) for(int ii=a;ii<=b;ii++)
#define ll long long int
#define test() int tt; cin>>tt; while(tt--) 
#define fst_io ios_base::sync_with_stdio(false);cin.tie(NULL);
#define endl '\n'

int main()
{
  fst_io;
  int l,r,d,c=0;
  cin>>l>>r>>d;
  rep(l,r) 
  {
  	if(ii%d==0) c++;
  }
  cout<<c<<endl;
  return 0;
}

Measured memory_bytes: 3644
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<functional>
#include<vector>
#include<map>
#include<string>
#include<math.h>
#include<set>
#include<string.h>
#include<unordered_set>
#include<unordered_map>
#define int long long
#define P pair<int,int>
using namespace std;

P S, G;
P k[200000];
vector<int>V;
int dp[200001];
signed main() {
	bool T = false;
	cin >> S.first >> S.second;
	cin >> G.first >> G.second;
	if (abs(S.first - G.first) <= 1) {
		T = true;
		swap(S.first, S.second);
		swap(G.first, G.second);
	}
	int n; cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> k[i].first >> k[i].second;
		if (T)swap(k[i].first, k[i].second);
	}
	if (S.first > G.first)swap(S, G);
	sort(k, k + n);
	double M = 0;
	if (S.second == G.second) {
		for (int i = 0; i < n; i++) {
			if (k[i].second == S.second&&k[i].first >= S.first&&k[i].first <= G.first) {
				M += 20 * M_PI*0.5 - 20;
			}
		}
	}
	for (int i = 0; i < n; i++) {
		if (G.first >= k[i].first&&S.first <= k[i].first&&max(S.second, G.second) >= k[i].second&&min(S.second, G.second) <= k[i].second) {
			if (S.second < G.second)V.push_back(k[i].second);
			if (S.second > G.second)V.push_back(10000000000-k[i].second);
		}
	}
	memset(dp, 0x3f, sizeof(dp));
	dp[0] = 0;
	for (int i = 0; i < V.size(); i++) {
		*lower_bound(dp, dp + n, V[i]) = V[i];
	}
	int i = 0;
	for (i = V.size(); i >= 0; i--) {
		if (dp[i] <= 1000000000000ll)break;
	}	
	if (i == min(G.first - S.first, abs(G.second - S.second))+1) {
		printf("%.50lf\n", (G.first - S.first + abs(G.second - S.second)) * 100 - (20 - 5 * M_PI)*(i-1) + 20 * M_PI*0.5 - 20+M);
	}
	else { printf("%.50lf\n", (G.first - S.first + abs(G.second - S.second)) * 100 - (20 - 5 * M_PI)*i + M); }
}


Measured memory_bytes: 6640
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m; cin >> n >> m;
  vector<pair<int, int> > c[n];
  pair<int, int> ans[m];
  for (int i = 0; i < m; i++) {
    int p, y; cin >> p >> y;
    c[p-1].push_back({y, i});
  }
  for (int i = 0; i < n; i++) {
    sort(c[i].begin(), c[i].end());
    for (int j = 0; j < (int) c[i].size(); j++) {
      ans[c[i][j].second] = {i+1, j+1};
    }
  }
  for (int i = 0; i < m; i++) {
    printf("%06d%06d\n", ans[i].first, ans[i].second);
  }
  return 0;
}


Measured memory_bytes: 7808
/*
 *      ┌─┐       ┌─┐ + +
 *   ┌──┘ ┴───────┘ ┴──┐++
 *   │                 │
 *   │       ───       │++ + + +
 *   ███████───███████ │+
 *   │                 │+
 *   │       ─┴─       │
 *   │                 │
 *   └───┐         ┌───┘
 *       │         │
 *       │         │   + +
 *       │         │       Code is far away from bug with the animal protecting
 *       │         └──────────────┐
 *       │                        │
 *       │                        ├─┐
 *       │                        ┌─┘
 *       │                        │
 *       └─┐  ┐  ┌───────┬──┐  ┌──┘  + + + +
 *         │ ─┤ ─┤       │ ─┤ ─┤
 *         └──┴──┘       └──┴──┘  + + + +
 *                神兽保佑
 *               代码无BUG!
 */

#include<bits/stdc++.h>
using namespace std;
class IN{
public:
    template<typename T>
    IN& operator >>(T &x){read(x);return *this;}
    IN& operator >>(double &x){scanf("%lf",&x);return *this;}
    IN& operator >>(char *s){scanf("%s",s);return *this;}
    IN& operator >>(char &c){c=getchar();return *this;}
private:
    template<typename T>
    void read(T &x){
        T f=1;int c=getchar();x=0;
        while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}
        while(c>='0'&&c<='9')x=(x<<3)+(x<<1)+(c^48),c=getchar();
        x*=f;
    }
}in;
class NL{}nl;
class BK{}bk;
class OUT{
public:
    template<typename T>
    OUT& operator <<(T x){write(x);return *this;}
    OUT& operator <<(const char *s){printf("%s",s);return *this;}
    OUT& operator <<(char c){putchar(c);return *this;}
    OUT& operator <<(BK x){putchar(' ');return *this;}
    OUT& operator <<(NL x){putchar('\n');return *this;}
private:
    template<typename T>
    void write(T x){
        if(x<0)putchar('-'),x=-x;
        if(x>=10)write(x/10);
        putchar(x%10+48);
    }
}out;

#define pb(x) push_back(x)
#define fi first
#define se second
#define rep(i,a,n) for(int i=a;i<=n;++i)
#define per(i,n,a) for(int i=n;i>=a;--i)
#define mem(a,x) memset(a,x,sizeof(a))
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> PI;
typedef pair<ll,ll> PL;
typedef vector<int> VI;
typedef vector<ll> VL;
/*****************************************************************************************************/
ll Pow(ll a,ll b,ll mod){ll res=1;a%=mod;while(b){if(b&1)(res*=a)%=mod;(a*=a)%=mod;b>>=1;}return res%mod;}
ll inv(ll a,ll p){if(a==1)return 1;return (p-p/a)*inv(p%a,p)%p;}//p为素数,a<p
ll C(ll n,ll m,ll p){ll res=1;for(ll i=1,j=n-m+1;i<=m;++i,++j){res=res*inv(i,p)%p*j%p;}return res;}
/*****************************************************************************************************/
/*ll ask(int x){ll res=0;while(x)res+=c[x],x-=x&-x;return res;}
void add(ll v,int x){while(x<=n)c[x]+=v,x+=x&-x;}*/
const int p=1e9+7;
const int N=2e5+10;
char s[N];

int main(){
    ll a,b,v,w,t;
    in>>a>>v>>b>>w>>t;
    if(abs(a-b)<=(v-w)*t)
        puts("YES");
    else puts("NO");
    return 0;
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
 
//#pragma GCC optimize("O3")
//#pragma GCC target("sse4")
 
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define RFOR(i, b, a) for(int i = (b) - 1; i >= (a); --i)
#define FILL(a, value) memset(a, value, sizeof(a))
 
#define SZ(a) (int)((a).size())
#define ALL(a) a.begin(), a.end()
 
typedef long long LL;
typedef pair<int, int> PII;

const int MAX = 1 << 17;

const int dx[9] = {1, 1, 0, -1, -1, -1, 0, 1, 0};
const int dy[9] = {0, 1, 1, 1, 0, -1, -1, -1, 0};
int ans[10];


int main()
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int h, w, n;
	cin >> h >> w >> n;
	map<PII, int> cnt;
	FOR(i, 0, n)
	{
		int r, c;
		cin >> r >> c;
		FOR(j, 0, 9)
		{
			int x = r + dx[j], y = c + dy[j];
			if(x > 1 && x < h && y > 1 && y < w)
				cnt[{x, y}]++;
		}
	}
	for(auto x: cnt)
		ans[x.second]++;
	cout << (h - 2LL) * (w - 2LL) - SZ(cnt) << "\n";
	FOR(j, 1, 10)
		cout << ans[j] << "\n";
	return 0;
}

Measured memory_bytes: 56576
#■標準入力ショートカット


def get_next_int():
    return int(float(input()))


def get_next_ints(delim=" "):
    return tuple([int(float(x)) for x in input().split(delim)])


def get_next_str():
    return input()


def get_next_strs(delim=" "):
    return tuple(input().split(delim))


def get_next_by_types(*value_types, delim=" "):
    return tuple([t(x) for t, x in zip(value_types, input().split(delim))])


def solve():
    A, B = get_next_ints()
    K = 2
    while K * 2 * K / 4 < max(A, B):
        K *= 2
    grid = [["#"] * 2 * K for i in range(K)]
    grid.extend([["."] * 2 * K for i in range(K)])
    # print(grid)

    x, y = 0, 0
    while A > 1:
        grid[y][x] = "."
        if x + 2 >= 2 * K:
            y += 2
            x = 0
        else:
            x += 2
        A -= 1
    x, y = 2 * K - 1, 2 * K - 1
    while B > 1:
        grid[y][x] = "#"
        if x - 2 < 0:
            y -= 2
            x = 2 * K - 1
        else:
            x -= 2
        B -= 1
    print(2 * K, 2 * K)
    for row in grid:
        print(''.join(row))
solve()

Measured memory_bytes: 3188
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<set>
#include<map>
using namespace std;
typedef long long ll;

int main(){
    int a,b,c;
    cin>>a>>b>>c;
    int M=max({a,b,c});
    int m=min({a,b,c});
    cout<<M-m<<endl;
}


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

int main(){
    int n,k;
    cin >> n >> k;
    vector<int> x(n);
    for(int i = 0; i < n; i++)
        cin >> x[i];
    unsigned long mi = -1;
    for(int i = 0; i <= n-k; i++){
        int l = x[i],r=x[i+k-1];
        int num1 = abs(l)+abs(r-l);
        int num2 = abs(r)+abs(l-r);
        int a = min(num1,num2);
        if(a < mi)
            mi = a;
    }
    cout << mi;
}

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

#define EQ(a,b) (abs((a)-(b)) < EPS)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define fs first
#define sc second
#define pb push_back
#define sz size()
#define all(a) (a).begin(),(a).end()

using namespace std;
typedef long double D;
typedef complex<D> P;
typedef pair<P,P> L;
typedef vector<D> P3;

const D EPS = 1e-8;
const D PI = acos(-1);

inline D dot(P x, P y){return real(conj(x)*y);}

inline D cross(P x, P y){return imag(conj(x)*y);}

inline D line_dis(L a,P x){return abs(cross(a.sc-a.fs,x-a.fs))/abs(a.sc-a.fs);}

inline P line_cp(L a,L b){
  return a.fs+(a.sc-a.fs)*cross(b.sc-b.fs,b.fs-a.fs)/cross(b.sc-b.fs,a.sc-a.fs);
}

inline D len3D(P3 a){
  return sqrt(a[0]*a[0] + a[1]*a[1] + a[2]*a[2]);
}

inline D cross3D(P3 a, P3 b){
  P3 res(3);
  res[0] = a[1]*b[2] - a[2]*b[1];
  res[1] = a[2]*b[0] - a[0]*b[2];
  res[2] = a[0]*b[1] - a[1]*b[0];
  return len3D(res);
}

int main(){
  P3 t(3),o(3),p(3);
  D R;

  rep(i,3)cin >> t[i];
  rep(i,3)cin >> o[i]; cin >> R;
  rep(i,3)cin >> p[i];

  rep(i,3)t[i] -= o[i], p[i] -= o[i], o[i] = 0;
  
  D H = len3D(t), disp = len3D(p);
  D cone_vol = PI/3*R*R*H;

  D px = cross3D(t,p)/H, py = sqrt(disp*disp - px*px);
  P pp(px,py), a(-R,0), b(R,0), h(0,H);
  P A = line_cp(L(a,h),L(b,pp)), B = line_cp(L(b,h),L(a,pp));
  P O = 0.5L*(A+B);
  D oR = R*(H-O.imag())/H;
  D oa = abs(A-B)/2, ob = sqrt(oR*oR - O.real()*O.real());
  D oh = line_dis(L(A,B),h);

  D up_cone = PI/3*oa*ob*oh, low_cone = cone_vol - up_cone;
  
  cout << fixed << setprecision(6) << up_cone << " " << low_cone << endl;
}

Measured memory_bytes: 1328
#undef NDEBUG
#include <bits/stdc++.h>

using namespace std;

#define all(v) (v).begin(), (v).end()

using li = long long;
using ld = long double;

void solve(bool);

int main() {
#ifdef YA
    auto s = clock();
    assert(freopen("input.txt", "r", stdin));
    // assert(freopen("output.txt", "w", stdout));
#else
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
#endif

    cout << fixed << setprecision(20);

    solve(true);
    
#ifdef YA1
    while (true) solve(false);
#endif

#ifdef YA
    cout << endl << endl << "time = " << (clock() - s) / (double)CLOCKS_PER_SEC << endl;
#endif

    return 0;
}

const int mod = 998244353;
const int maxn = 3e6 + 555;


li pw(li x, li y) {
    if (y == 0)
        return 1;
    if (y & 1)
        return pw(x, y - 1) * x % mod;
    return pw(x * x % mod, y / 2);
}

li n, m;
li f[maxn], invf[maxn];

li cnk(int n, int k) {
    return f[n] * (li)invf[k] % mod * invf[n - k] % mod;
}

void solve(bool __attribute__((unused)) read) {
    cin >> n >> m;
    if (m == 1) {
        cout << (li)n * (n - 1) % mod << "\n";
        return;
    }
    f[0] = invf[0] = 1;
    for (int i = 1; i < maxn; ++i) {
        f[i] = f[i - 1] * (li)i % mod;
        invf[i] = pw(f[i], mod - 2);
    }
    li ans = n * cnk(m + n - 2, n - 2) % mod;
    // cout << ans << endl;


    int st = 0;
    if (m & 1)
        st = 1;
    for (int i = st; i <= min(n, m); i += 2) {
        int cnt2 = m + (m - i) / 2;
        // cout << i << " " << cnt2 << " " << cnk(n, i) << endl;
        li mult = cnk(cnt2 + n - 1, n - 1) - n * cnk(cnt2 - m + n - 1, n - 1) % mod;
        mult = (mult % mod + mod) % mod;

        ans = (ans + cnk(n, i) * mult) % mod;
    }
    cout << ans << "\n";
}


Measured memory_bytes: 47104
#include<bits/stdc++.h>
#define ll long long
#define ms(a, b) memset(a, b, sizeof a)
using namespace std;
const int  K = 3e3 + 5;
int g[K][K][3];
int n, k;
int get(int x, int y,int i, int j, int cc) {
    if(x <i || y < j) return 0;
    return g[x][y][cc] - g[x][j-1][cc] - g[i-1][y][cc] + g[i-1][j-1][cc];
}
int main() {
    scanf("%d%d", &n, &k);
    for(int i = 1; i <= n; ++i) {
        int x, y;
        char c[5];
        scanf("%d%d%s",&x, &y, c);
        if(c[0]=='W')
            g[x%(2*k)+1][y%(2*k)+1][0]++;
        else
            g[x%(2*k)+1][y%(2*k)+1][1]++;
    }
    for ( int i = 1 ; i <= 2*k ; i++ ) {
        for ( int j = 1 ; j <= 2*k ; j++ ) {
            for ( int k = 0 ; k < 2 ; k++ ) {
                g[i][j][k] += g[i-1][j][k]+g[i][j-1][k]-g[i-1][j-1][k] ;
            }
        }
    }

    int ans = 0;

    for(int i = 1; i <= k; ++i)
    for(int j = 1; j <= k; ++j) {
        int ei = i + k -1;
        int ej = j + k -1;
        int w = get(ei, ej, i, j, 0) + get(i-1, j-1, 1 , 1, 0) + get(i-1,2*k,1, ej+1, 0) + get(2*k,2*k,ei+1,ej+1, 0) + get(2*k, j-1,ei+1,1,0);
        int b = get(ei, ej, i, j, 1) + get(i-1, j-1, 1 , 1, 1) + get(i-1,2*k,1, ej+1, 1) + get(2*k,2*k,ei+1,ej+1, 1) + get(2*k, j-1,ei+1,1,1);
        b = g[2*k][2*k][1] - b;

        int w1 = get(ei, ej, i, j, 1) + get(i-1, j-1, 1 , 1, 1) + get(i-1,2*k,1, ej+1, 1) + get(2*k,2*k,ei+1,ej+1, 1) + get(2*k, j-1,ei+1,1,1);
        int b1 = get(ei, ej, i, j, 0) + get(i-1, j-1, 1 , 1, 0) + get(i-1,2*k,1, ej+1, 0) + get(2*k,2*k,ei+1,ej+1, 0) + get(2*k, j-1,ei+1,1,0);
        b1 = g[2*k][2*k][0] - b1;

        ans = max(ans, max(b+w,w1+b1));
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 71424
#include<iostream>
#include<vector>
#include<algorithm>
#include<math.h>
#include<queue>
#define all(x) (x).begin(),(x).end()
typedef long long ll;
 
using namespace std;

int main(){
    int N, tmp, cnt;  cin >> N;
    vector<int> v(N), b(N,0);
    queue<int> que;
    for(int i=0; i<N; i++)  cin >> v[i];
    for(int i=N-1; i>=0; i--){
        tmp = i;
        cnt = 0;
        while(tmp <= N-1){
            cnt += b[tmp];
            tmp += (i+1);
        }
        if(cnt%2 != v[i])  b[i] = 1;
    }
    cnt = 0;
    for(int i=0; i<N; i++){
        if(b[i] == 1){
            cnt++;
            que.push(i+1);
        }
    }
    cout << cnt << endl;
    tmp = que.size();
    for(int i=0; i<tmp; i++){
        cout << que.front() << " ";
        que.pop();
    }
}

Measured memory_bytes: 5232
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
	int N,L;
	cin >> N >> L;
	int sum=0;
	vector<int> vec(N);
	for(int i=1; i<=N; i++){
		vec[i-1]=L+i-1;
		sum+=vec[i-1];
	}
	int min=vec[0];
	for(int i=0; i<N-1; i++){
		if(abs(vec[i]) > abs(vec[i+1])){
			min=vec[i+1];
		}
	}
	sum-=min;
	cout << sum <<endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){

int a,b,c,i;

scanf("%d %d",&a,&b);
 
if(b<100){
if(a==0)
c=b;

if(a==1)
c=100*b;
if(a==2)
c=10000*b;


}

if(b==100){
if(a==0)
c=101;

if(a==1)
c=100*101;
if(a==2)
c=10000*101;

}

printf("%d",c);

return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <iterator>
#include <climits>
#include <unordered_map>
#include <functional>
#include <queue>

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

using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;

inline int ctoi(char c) {
    return (int)(c -'0');
}

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

int main() {
    ll n;
    cin >> n;
    vector<ll> aa(n+2);
    aa[0] = 0;
    ll sum = 0;
    ll before = 0;
    for(auto i=1; i <= n; ++i) {
        ll temp;
        cin >> temp;
        aa[i] = temp;
        sum += abs(temp - before);
        before = temp;
    }
    sum += abs(aa[n]);
    aa[n+1] = 0;

    for(auto i = 1; i <= n; ++i) {
        const ll before = abs(aa[i-1] - aa[i]) + abs(aa[i] - aa[i+1]);
        const ll after = abs(aa[i-1] - aa[i+1]);
        cout << sum + after - before << endl;
    }

    return 0;
}


Measured memory_bytes: 2048
from heapq import heappop,heappush
l = []
r = []
Q = int(input())
ans = 0
l_s = 0
r_s = 0
_,m,b = map(int,input().split())
ans += b
n = 0
for i in range(1,Q):
    s = input()
    if s != '2':
        _,a,b = map(int,s.split())
        ans += b
        if n == 0:
            c,d = sorted([m,a])
            heappush(l,-c)
            heappush(r,d)
            l_s += c
            r_s += d
            m1 = c
        else:
            c,d = heappop(l),heappop(r)
            l_s += c
            r_s -= d
            c = -c
            if n%2 == 1:
                c,m,d = sorted([a,c,d])
                heappush(l,-c)
                heappush(r,d)
                l_s += c
                r_s += d
            else:
                c,m1,m2,d = sorted([m,a,c,d])
                heappush(l,-c)
                heappush(l,-m1)
                heappush(r,d)
                heappush(r,m2)
                l_s += c
                r_s += d
                l_s += m1
                r_s += m2
        n += 1
    else:
        if n == 0:
            print('{} {}'.format(m,ans))
        elif n == 1:
            print('{} {}'.format(m1,r_s-l_s+ans))
        elif n%2 == 0:
            print('{} {}'.format(m,r_s-l_s+ans))
        else:
            print('{} {}'.format(m1,r_s-l_s+ans))

Measured memory_bytes: 11096
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define FOR(i, a, b) for (int i=(a); i<(b); i++)
using Graph = vector<vector<int>>;

int main() {
  int N;
  cin >> N;
  double X[N];
  double Y[N];
  double sum = 0;
  int num = 0;
  FOR(i,0,N) cin >> X[i] >> Y[i];
  FOR(i,0,N-1) {
    FOR(j,i+1,N) {
      sum += sqrt((X[i]-X[j])*(X[i]-X[j])+(Y[i]-Y[j])*(Y[i]-Y[j]));
      num++;
    }
  }
  double ans = sum/num*(N-1);
  cout << fixed << setprecision(7) << ans << endl;
  return 0;
}

Measured memory_bytes: 3804
#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
using namespace std;

#define rep(i,n) for(int i = 0; i<n; ++i)
#define REP(i,n) for(int i = 1; i<=n; ++i)
#define all(x) begin(x),end(x)
typedef long long ll;
typedef pair<int,int> ip;
typedef pair<ll,ll> lp;
const int inf = 1001001000;
const ll INF = 1LL<<60;
const int MOD = (int)1e9 + 7;

ll lcm(vector<ll> a, int p, ll ans = 1){
	if(p>=a.size())return ans;
	ans = ans*a[p]/__gcd(ans, a[p]);
	ans = lcm(a, p+1, ans);
	return ans;
}

int main(){
	int N;
	cin>>N;
	ll ans = 0;
	rep(i,N){
		int p;
		cin>>p;
		ans += p-1;
	}
	cout<<ans<<endl;
	return 0;
}

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

using namespace std;

#define int long long
#define all(v) (v).begin(), (v).end()
#define resz(v, ...) (v).clear(), (v).resize(__VA_ARGS__)
#define reps(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep(i, n) reps(i, 0, n)

template<class T1, class T2> void chmin(T1 &a, T2 b){if(a>b)a=b;}
template<class T1, class T2> void chmax(T1 &a, T2 b){if(a<b)a=b;}

typedef pair<int, int> Pi;
typedef tuple<int, int, int> Ti;
typedef vector<int> vint;

const int inf = 1LL << 55;
const int mod = 1e9 + 7;

signed main()
{
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  int N, M;
  cin >> N >> M;
  bool cl[N] = {};
  rep(i, M) {
    int a, b;
    cin >> a >> b;
    --a, --b;
    cl[a] = !cl[a];
    cl[b] = !cl[b];
  }
  rep(i, N) if(cl[i]) {
    cout << "NO" << endl;
    return 0;
  }
  cout << "YES" << endl;

  return 0;
}


Measured memory_bytes: 512
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <iterator>
#pragma warning(disable:4996)
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
#define MOD 1000000007
using namespace std;



int main(int argc, char* argv[])
{
    char str[15]={0};
    scanf("%s", str);
    str[4]=str[5];
    str[5]=str[6];
    str[6]=str[8];
    str[7]=str[9];
    str[8]='\0';

    long a = atoi(str);
    if(a<=20190430) {
        printf("Heisei\n");
    }
    else {
        printf("TBD\n");
    }

 

    return 0;
}



Measured memory_bytes: 128
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<cmath>
using namespace std;

#define Whats(x) cout<<#x<<" is "<<(x)<<endl
#define Divhim() cout<<">>>>>>>>>"<<endl
#define Divher() cout<<"<<<<<<<<<"<<endl
#define Oops() cout<<"!!!!!!!!!!"<<endl

template<typename T> bool Getmax(T &a,T b){return (a<b)?(a=b,true):false;}
template<typename T> bool Getmin(T &a,T b){return (a>b)?(a=b,true):false;}

const int N=1010;
const int INF=0x3f3f3f3f;

int n,m,dp[N][N];
char s[N];

int main()
{
	scanf("%d%d",&n,&m);
	memset(dp,0x3f,sizeof dp);
	for(int i=1;i<=n;++i)
	{
		scanf("%s",s+1);
		for(int j=1;j<=m;++j)if(s[j]=='#')
			dp[i][j]=0;
	}
	//for(int i=1;i<=n;++i)
	//{
	//	for(int j=1;j<=m;++j)
	//		cout<<dp[i][j]<<" ";
	//	cout<<endl;
	//}
	for(int i=1;i<=n;++i)
		for(int j=1;j<=m;++j)
			Getmin(dp[i][j],min(dp[i-1][j],dp[i][j-1])+1);
	for(int i=n;i>=1;--i)
		for(int j=m;j>=1;--j)
			Getmin(dp[i][j],min(dp[i+1][j],dp[i][j+1])+1);
	for(int i=1;i<=n;++i)
		for(int j=m;j>=1;--j)
			Getmin(dp[i][j],min(dp[i-1][j],dp[i][j+1])+1);
	for(int i=1;i<=n;++i)
		for(int j=m;j>=1;--j)
			Getmin(dp[i][j],min(dp[i-1][j],dp[i][j+1])+1);
	int mx=0;
	for(int i=1;i<=n;++i)for(int j=1;j<=m;++j)Getmax(mx,dp[i][j]);
	printf("%d",mx);
	return 0;
}

Measured memory_bytes: 4224
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define LOOP(i,x,n) for(int i=x;i<n;i++)
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define MP make_pair
#define FIR first
#define SEC second
#define int long long
using namespace std;
const int MOD=1000000007;
const int INF=1000000009;

signed main(){
  int n;
  while(cin>>n,n){
    map<char,char> M;
    REP(i,n){
      char a,b;
      cin>>a>>b;
      M[a]=b;
    }
    int m;
    cin>>m;
    
    REP(i,m){
      char c;
      cin>>c;
      if(M.find(c)!=M.end()){
        cout<<M[c];
      }else cout<<c;
    }
    cout<<endl;
  }
  return 0;
}

Measured memory_bytes: 3048
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;
const ll MOD = 1000000007LL;

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

    char c;
    cin >> c;

    if (c == 'A') {
        cout << "T\n";
    } else if (c == 'C') {
        cout << "G\n";
    } else if (c == 'G') {
        cout << "C\n";
    } else {
        cout << "A\n";
    }

    return 0;
}

Measured memory_bytes: 888
#include <bits/stdc++.h>
#include <iostream>
#include <math.h>
using namespace std;
int main() {
    int N;
    cin >> N;
    vector<int>vec(N);
    for (int i=0; i<N; i++) {
        vec[i] = i + 1;
    }

    vector<int>kizyun(N);
    for (int i=0; i<N; i++) {
        cin >> kizyun.at(i);
    }

    vector<int>kuraberu(N);
    for (int i=0; i<N; i++) {
        cin >> kuraberu.at(i);
    }

    int zyunban = 1;
    int kizyun_num = 0;
    int kuraberu_num = 0;
    while(next_permutation(vec.begin(), vec.end())) {
        bool kizyun_onaji = true;
        bool kuraberu_onaji = true;
        for (int i=0; i<N; i++) {
            if (vec[i] != kizyun[i]) {
                kizyun_onaji = false;
            }

            if (vec[i] != kuraberu[i]) {
                kuraberu_onaji = false;
            }
        }

        if (kizyun_onaji) {
            kizyun_num = zyunban;
        }

        if (kuraberu_onaji) {
            kuraberu_num = zyunban;
        }

        zyunban++;
    }

    cout << abs(kizyun_num - kuraberu_num) << endl;
    return 0;
}

Measured memory_bytes: 3600
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin, log, log10
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def FLOAT(): return float(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7
dx = [0, 0, 1, -1, 1, -1, -1, 1]
dy = [1, -1, 0, 0, 1, -1, 1, -1]

def func(num, goto, ignore):
    if num == goto:
        return 0
    res = []
    for i in range(10):
        if i in ignore:
            continue
        nignore  = deepcopy(ignore)
        nignore.append(i)
        #print(num, i, goto, nignore)
        plus = func(i, goto, nignore) if d[i][goto] == -1 else d[i][goto]
        #d[i][goto] = plus
        tmp = c[num][i] + plus
        res.append(tmp)
    return min(res)

h, w = MAP()
c = [LIST() for _ in range(10)]
a = [LIST() for _ in range(h)]
d = [[-1 for _ in range(10)] for _ in range(10)]
for i in range(10): #iから1に変更する最小コスト
    if i == 1:
        continue
    res = func(i, 1, [i])
    d[i][1] = min(c[i][1], res)
ans = 0
for i in range(h):
    for j in range(w):
        if a[i][j] == -1 or a[i][j] == 1:
            continue
        ans += d[a[i][j]][1]
print(ans)

Measured memory_bytes: 102484
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define is(a, b) a == b
#define len(v) ll(v.size())

const ll mod=1e9+7;

//vector書き出し
template <class T>
void cout_vec(const vector<T> &vec1){
  rep(i,len(vec1)){
    cout<<vec1[i]<<' ';
  }
  cout<<'\n';
}

typedef pair<ll,ll> P;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    vector<ll> a(5);
    cin>>n;
    cin>>a[0];
    ll min=a[0];
    ll ind=0;
    FOR(i,1,5){
      cin>>a[i];
      if(a[i]<min){
        min=a[i];
        ind=i;
      }
    }
    if(n%min==0){
      cout<<n/min+4<<endl;
    }else{
      cout<<n/min+5<<endl;
    }
}

Measured memory_bytes: 256