akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
#include <sys/timeb.h>
#include <fstream>

using namespace std;

#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define replrev(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define reprev(i,n) replrev(i,0,n)
#define repi(itr,ds) for(auto itr=ds.begin();itr!=ds.end();itr++)
#define all(a) a.begin(),a.end()
#define mp make_pair
#define mt make_tuple
#define INF 2000000000
#define INFL 1000000000000000000LL
#define EPS (1e-8)
#define MOD 1000000007
#define PI 3.141592653589793
#define RMAX 4294967295
#define equals(a,b)(fabs((a)-(b))<EPS)

typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<P> vP;
typedef vector<vector<int> > vvi;
typedef vector<vector<bool> > vvb;
typedef vector<vector<ll> > vvll;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<double> > vvd;
typedef vector<vector<P> > vvP;
typedef complex<double> comp;
typedef vector<complex<double>> vcomp;
typedef priority_queue<int, vector<int>, greater<int> > pqli;
typedef priority_queue<ll, vector<ll>, greater<ll> > pqlll;
typedef priority_queue<P, vector<P>, greater<P> > pqlP;
typedef string::const_iterator State;
class ParseError {};
struct Edge {
	int from, to, cost;
	bool operator<(Edge e) {
		return cost < e.cost;
	}
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;



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

	int N;
	cin >> N;
	map<int, int> m;
	int ans = 0;
	rep(i, N) {
		int a;
		cin >> a;
		if (m.find(a) == m.end()) {
			m[a] = 1;
			ans++;
		}
		else {
			if (m[a] == 1) {
				m[a] = 0;
				ans--;
			}
			else {
				m[a] = 1;
				ans++;
			}
		}
	}

	cout << ans << endl;


	return 0;
}

Measured memory_bytes: 4992
import java.util.HashMap;
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int A = sc.nextInt();
    HashMap<Integer, Long> tmpSum = new HashMap<>();
    for (int i = 0; i < N; i++) {
      int diff = sc.nextInt() - A;
      HashMap<Integer, Long> prevMap = new HashMap<>(tmpSum);
      for (int key : prevMap.keySet()) {
        addCountMap(tmpSum, key + diff, prevMap.get(key));
      }
      addCountMap(tmpSum, diff, 1);
    }
    sc.close();

    long result;
    if (tmpSum.get(0) != null) {
      result = tmpSum.get(0);
    } else {
      result = 0;
    }
    System.out.println(result);
  }

  private static void addCountMap(HashMap<Integer, Long> map, int key, long count) {
    if (map.get(key) == null) {
      map.put(key, count);
    } else {
      map.put(key, map.get(key) + count);
    }
  }
}


Measured memory_bytes: 25940
#define _GLIBCXX_DEBUG
//10:13-
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define REP(i,a) FOR(i,0,a)
ll A,B;
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin>>A>>B;
	cout<<max(A-2*B,0ll)<<endl;
}


Measured memory_bytes: 256
x = input()
if x[len(x)-1] == "3":
  print("bon")
elif x[len(x)-1] =="0"or x[len(x)-1] =="1"or x[len(x)-1] =="6"or x[len(x)-1]=="8":
  print("pon")
else:
  print("hon")

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

int main(){
    int t,M=0,m=1000000000,n; cin>>n;
    for(int i=0;i<n;i++){
        cin>>t;
        M=max(M,t);
        m=min(m,t);
        }
    cout<<M-m<<endl;
    }


Measured memory_bytes: 256
def main():
  nagasa, num_house = map(int, input().split())
  house_list = [int(t) for t in input().split()]
  
  max_length = 0
  for i in range(num_house):
    if i != num_house-1:
      dif = house_list[i+1] - house_list[i]
    if i == num_house-1:
      dif = nagasa - house_list[i] + house_list[0]
    if max_length < dif:
      max_length = dif
  print(nagasa - max_length)

main()

Measured memory_bytes: 26092
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

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

const long double EPS = 1e-10;
const long long INF = 1e18;
const long double PI = acos(-1.0L);
//const ll mod = 1000000007;
ll X, Y, A, B, C;
ll p[200000], q[200000], r[200000];

int main() {
    //cout.precision(10);
    cin >> X >> Y >> A >> B >> C;
    for(int i = 0; i < A; i++) cin >> p[i];
    for(int i = 0; i < B; i++) cin >> q[i];
    for(int i = 0; i < C; i++) cin >> r[i];
    sort(p, p + A, greater<ll>());
    sort(q, q + B, greater<ll>());
    sort(r, r + C, greater<ll>());
    ll ans = 0;
    ll now = 0;
    ll bidx = 0;
    ll cidx = 0;
    for(int i = 0; i < X; i++) now += p[i];
    for(int i = 0; i < Y; i++) {
        if(bidx < B) {
            if(cidx == C or q[bidx] > r[cidx]) {
                now += q[bidx];
                bidx++;
            } else {
                now += r[cidx];
                cidx++;
            }
        } else {
            now += r[cidx];
            cidx++;
        }
    }
    ans = now;
    cerr << now << endl;
    for(int i = 0; i < min(X, C); i++) {
        //cerr << bidx << " " << cidx << endl;
        now -= p[X-1-i];
        if(i + 1 > cidx) {
            now += r[cidx];
            cidx++;
            chmax(ans, now);
            continue;
        }
        if(bidx < B) {
            if(cidx == C or q[bidx] > r[cidx]) {
                now += q[bidx];
                bidx++;
            } else {
                now += r[cidx];
                cidx++;
            }
        } else {
            now += r[cidx];
            cidx++;
        }
        chmax(ans, now);
    }
    cout << ans << endl;
    return 0;
}

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

int main() {
	// your code goes here
	long long int n = 0, m = 0, a = 0, b = 0, c = 0, k = 0;
	string s;
	cin >> n >> k;
	double ans = 0;
	for(int i = 1; i <= n; i++){
		int sum = 0, ii = i;
		double hoge = 1;
		while(ii < k){
			ii *= 2;
			hoge *= 0.5;
		}
		ans += (1.0 / double(n)) * hoge;
	}

	cout << std::setprecision(15) << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
#define _for(i,j,N) for(int i = (j); i < (N);i++)
 
int get_int(){int x;scanf("%d",&x);return x;}
 
int main()
{
    vector<int> vi1;
    vector<int> vi2;
    int n;
    cin >> n;
    _for(i,0,n){
        int h = get_int();
        vi1.push_back(h);
    }
    _for(i,0,n){
        int h = get_int();
        vi2.push_back(h);
    }
    for(int i = n-2;i>=0;i--){
        vi2[i]+=vi2[i+1];
    }
 
    int s = 0;
    int max_a = 0;
    _for(i,0,n){
        s+=vi1[i];
        max_a = max(max_a,s+vi2[i]);
    }
    cout << max_a << endl;
}

Measured memory_bytes: 256
N = int(input())
A = [int(i) for i in input().split()]

ans = 0
for i, a in enumerate(A):
    ans += a if i % 2 == 0 else -a

B = [ans]
for i in range(1, N):
    B.append(2 * A[i - 1] - B[i - 1])

print(*B)

Measured memory_bytes: 14024
#include <iostream>
#include <math.h>
#include <algorithm>
#include <vector>
using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;

int main(){
	int w,h;
	vector<string> f(30);
	vector< vector<int> > g(30,vector<int>(30,0));
	int count = 0;
	int count2 = 0;

	while(1){
		cin >> w >> h;
		if(w == 0 && h == 0){
			break;
		}

		for(int i = 0;i < h; i++){
			cin >> f[i];
		}



		for(int i = 0;i < h; i++){
			for(int j = 0;j < w;j++){
				g[i][j] = 0;
			}
		}
		count = 0;
		count2 = 0;
		while(1){
			for(int i = 0; i < h; i++){
				for(int j = 0; j < w;j++){
					if(f[i][j] == '@' && count== 0){
						g[i][j] = 1;
						count2++;
					}else if(g[i][j] == 1){
						if(i != 0){
							if(f[i-1][j] == '.'){
								if(g[i-1][j] == 0){
									count2++;
								}
								g[i-1][j] = 1;

							}
						}
						if(i != h-1){
							if(f[i+1][j] == '.'){
								if(g[i+1][j] == 0){
									count2++;
								}
								g[i+1][j] = 1;
							}
						}
						if(j != 0){
							if(f[i][j-1] == '.'){
								if(g[i][j-1] == 0){
									count2++;
								}
								g[i][j-1] = 1;
							}
						}
						if(j != w-1){
							if(f[i][j+1] == '.'){
								if(g[i][j+1] == 0){
									count2++;
								}
								g[i][j+1] = 1;
							}
						}
					}else{}
				}
			}

			if(count == count2){
				cout << count << endl;
				break;
			}
			count = count2;
		}

	}
}

Measured memory_bytes: 3024
#include <cstdio>
#include <iostream>
#include <cmath>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <memory.h>
#include <iomanip>
#include <bitset>
#include <list>
#include <stack>
#include <deque>

using namespace std;

#define mod 1000000007

map<pair<long long int, long long int>, long long int> m;

long long int solve(long long int s, long long int x)
{
	if(m.find(make_pair(s, x)) != m.end()) return m[make_pair(s, x)];
	if(s == 0) return 1;
	long long int result = solve(s / 2, x / 2);
	if(s >= 1 && x >= 1) result += solve((s - 1) / 2, (x - 1) / 2);
	if(s >= 2) result += solve((s - 2) / 2, x / 2);
	result %= mod;
	return m[make_pair(s, x)] = result;
}

int main()
{
	long long int n;
	cin >> n;
	cout << solve(n, n) << endl;
	return 0;
}

Measured memory_bytes: 256
n = int(input())
s = input()

flag = True

if (n%2 != 0):
    flag = False
else:
    s1 = s[:int(n/2)]
    s2 = s[int(n/2):]
    if (s1 != s2):
        flag = False

if flag:
    print("Yes")
else:
    print("No")


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

a = [0 for _ in range(n-1)]
a = [int(s) for s in input().split()]

d = {}

for i in range(n-1):
    boss = a[i]
    d[boss] = d.setdefault(boss,0) + 1

for i in range(n):
    ans = d.setdefault(i+1,0)
    print(ans)




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

w = list(input() for i in range(n))

rule = "No"

if len(w) == len(set(w)):
  rule = "Yes"
else:
  print("No")
  exit()

c = 0
for i in range(1,n):
  if w[i-1][-1] == w[i][0]:
    c += 1
    continue
  
if c == n-1:
  rule = "Yes"
else:
  print("No")
  exit()
    
    



print(rule)

Measured memory_bytes: 3064
//hinagata.cpp
/*includes*/
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <stdio.h>
#include <numeric>
/*namespace*/
using namespace std;
/*define macro*/
#define REP(i,n) for(int i=0;i<(n);i++)
#define REPi(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(x) (x).begin(),(x).end()

int main(){
    int N;
    cin>>N;
    vector<int> d(N);
    REP(i,N){
        cin>>d[i];
    }
    //条件
    sort(ALL(d));
    if(d[N/2]!=d[(N/2)-1]){
        cout<<d[(N/2)]-d[(N/2)-1]<<endl;
    }else{
        cout<<0<<endl;
    }
}

Measured memory_bytes: 640
import java.util.*;
public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int N = scan.nextInt();
        int ans = 0;
        int mem=1;
        for(int i=0;i<N;i++){
            int b = scan.nextInt();
            if(mem==b){
                mem++;
            }else{
                ans++;
            }
        }
        ans  = (ans==N)?-1:ans;
        System.out.println(ans);
    }
}


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

typedef long long   ll;
typedef long double ld;
using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin >> n;
    map<string,int> mpa;
    for(int i = 0; i < n; i++) {
        string tmp;
        cin >> tmp;
        mpa[tmp]++;
    }
    int ans=mpa.size();
    cout << ans << "\n";

    return 0;
}

Measured memory_bytes: 19280
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<stdio.h>
#include<cmath>
#include<string.h>

using namespace std;

int main(void)
{
	char a[3], b[3];
	int i;
	int lot = 1;
	for (i = 0; i < 3; i++)
	{
		cin >> a[i];
	}
	for (i = 0; i < 3; i++)
	{
		cin >> b[i];
	}
	for (i = 0; i < 3; i++)
	{
		if (a[i] != b[2 - i])
		{
		 lot = 0;
			break;
		}
	}
	if (lot == 0)
	{
		cout << "NO" << endl;
	}
	else
	{
		cout << "YES" << endl;
	}
	return 0;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> pll;
const ll mod=1e9+7;
//const ll mod=998244353;
const ll inf=5e18;

int main() {
  ll a,b;
  cin >> a >> b;
  if(a%2&&b%2) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**8)
input = sys.stdin.readline

N, K = map(int,input().split())
P = list(map(int,input().split()))

# 点更新，区間クエリ
class SegTree:
    # n : 元の配列の長さ
    # init_list: 元の配列
    # segfunc : 載せる関数（演算）
    # ide_ele : segfuncの単位元
        
    def __init__(self, n, init_list ,segfunc, ide_ele):
        #　num : 2**num >= n となる最小の整数 （葉の数）
        # seg : segtreeのリスト
        self.num = 2**((n-1).bit_length())
        self.seg = [ide_ele]*(2*self.num)
        self.segfunc = segfunc
        self.ide_ele = ide_ele
        # 葉の要素をセット
        for i in range(n):
            self.seg[i+self.num-1] = init_list[i]        
        # segtreeの構築
        for i in range(self.num-2, -1, -1):
            self.seg[i] = segfunc(self.seg[2*i+1],self.seg[2*i+2])
        
        #memo: 要素iの子ノードは要素2*i+1, 2*i+2
        #    : 要素iの親ノードは要素(i-1)//2
        
    # 要素の更新 (init_list[k]=x)
    def update(self,k,x):
        k += self.num-1 #葉のノードのインデックス
        self.seg[k] = x
        #末端から頂点まで更新
        while k:
            k = (k-1)//2
            self.seg[k] = self.segfunc(self.seg[2*k+1], self.seg[2*k+2])
     
    # 区間クエリ （区間[l,r)に対する演算結果）
    def query(self, l,r):
        if r<=l:
            return self.ide_ele
        
        l += self.num-1 #葉のノードのインデックス
        r += self.num-2 #半開区間から閉区間へ
        ret = self.ide_ele
        
        while r-l>1:
            if l&1 == 0:
                ret = self.segfunc(ret,self.seg[l])
            
            if r&1 == 1:
                ret = self.segfunc(ret,self.seg[r])
                r -= 1
            # 親ノードへ遷移
            l = l//2
            r = (r-1)//2
        if r==l:
            ret = self.segfunc(ret, self.seg[r])
        else:
            ret = self.segfunc(ret, self.seg[l])
            ret = self.segfunc(ret, self.seg[r])
        
        return ret
            
def segfunc(x,y):
    return min(x,y)
def segfunc2(x,y):
    return max(x,y)

INF = 10**9
segtree = SegTree(N, P, segfunc, INF)
segtree_max = SegTree(N, P, segfunc2, 0)
from queue import Queue 

zouka = [1]
num = 1
for i in range(N-1):
    if P[i+1]>P[i]:
        num += 1
    else:
        num = 1
    zouka.append(num)


mini = INF
maxi = 0
q = Queue()
for p in P[:K]:
    mini = min(mini, p)
    maxi = max(maxi, p)
    q.put(p)

ans = 1
m = 0

if zouka[K-1]-zouka[0] == K-1:
    m += 1
    ans = 0

for i in range(1, N-K+1):
    remove = q.get()
    q.put(P[i+K-1])

    if zouka[i+K-1]-zouka[i] == K-1:
        m += 1
    elif P[i+K-1]>maxi and remove==mini:
        None
    else:
        ans += 1
    maxi = segtree_max.query(i, i+K)
    mini = segtree.query(i, i+K)


if m>=1:
    ans += 1

print(max(1,ans))

    


Measured memory_bytes: 122156
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    char n;
    cin >> n;
    if(n=='A'){
      cout<<'T'<<endl;
    }
    else if(n=='T'){
      cout<<'A'<<endl;
    }
    else if(n=='C'){
      cout<<'G'<<endl;
    }
    else if(n=='G'){
      cout<<'C'<<endl;
    }
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS

#include<iostream>
#include<string>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<map>
#include<tuple>
#include<algorithm>
#include<numeric>
#include<math.h>

#define REPS(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) for (int i = 0; i < (n); i++)

using namespace std;

using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;

const int mod = 1e9 + 7;
const long double pi = 3.141592653589793238462643383279502884197;
const long double eps = 1e-7;

int main() {
	int N, A;
	cin >> N;
	cin >> A;

	if (N % 500 <= A) {
		cout << "Yes";
	}
	else {
		cout << "No";
	}

	system("pause");
	return 0;
}

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

// Driver Code 
int main() 
{ 
   int a,b,c,d,e;
   std::cin >> a>>b>>c>>d>>e;
   if(a==0)
   {
       std::cout <<1<<"\n";
   }
   else if(b==0)
   {
       std::cout <<2<<"\n";
   }
   else if(c==0)
   {
       std::cout <<3<<"\n";
   }
   else if(d==0)
   {
       std::cout <<4<<"\n";
   }
   else if(e==0)
   {
       std::cout <<5<<"\n";
   }
    return 0; 
} 

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define INF 1e18
#define int long long
#define Rep(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) Rep(i, 0, n)
#define all(a) (a).begin(), (a).end()
using namespace std;
typedef pair<int, int> P;
typedef pair<int, P> PP;
const int mod = 1000000007;

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

    int n, m, l;
    cin >> n >> m >> l;
    int d[310][310];
    rep(i, n) rep(j, n) d[i][j] = INF;
    rep(i, n) d[i][i] = 0;
    rep(i, m)
    {
        int a, b, c;
        cin >> a >> b >> c;
        a--, b--;
        d[a][b] = d[b][a] = c;
    }
    rep(k, n) rep(i, n) rep(j, n) d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
    int dd[310][310];
    rep(i, n) rep(j, n) dd[i][j] = INF;
    rep(i, n) rep(j, n) if (d[i][j] <= l) dd[i][j] = 1;
    rep(k, n) rep(i, n) rep(j, n) dd[i][j] = min(dd[i][j], dd[i][k] + dd[k][j]);
    int q;
    cin >> q;
    while (q--)
    {
        int s, t;
        cin >> s >> t;
        s--, t--;
        int res = dd[s][t] - 1;
        if (res == INF)
            res = -1;
        cout << res << endl;
    }
}

Measured memory_bytes: 2048
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
#include <complex>
using namespace std;

using ll = long long;
using ull = uint64_t;
using P = pair<int, int>;
constexpr double EPS = 1e-9;
constexpr int INF = 1001001001;
constexpr int mod = 1000000007;
// constexpr int mod = 998244353;

template<class T>
inline bool chmax(T& x, T y){
    if(x < y){
        x = y;
        return true;
    }
    return false;
}
template<class T>
inline bool chmin(T& x, T y){
    if(x > y){
        x = y;
        return true;
    }
    return false;
}

template<int mod>
struct ModInt{
    int x;

    ModInt() : x(0) {}
    
    ModInt(int64_t y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {}
    
    ModInt &operator+=(const ModInt &p){
        if((x += p.x) >= mod)   x -= mod;
        return *this;
    }
    
    ModInt &operator-=(const ModInt &p){
        if((x += mod - p.x) >= mod) x -= mod;
        return *this;
    }

    ModInt &operator*=(const ModInt &p){
        x = (int)(1LL * x * p.x % mod);
        return *this;
    }

    ModInt &operator/=(const ModInt &p){
        *this *= p.inverse();
        return *this;
    }
    
    ModInt operator-() const {return ModInt(-x);}

    ModInt operator+(const ModInt &p) const {return ModInt(*this) += p;}

    ModInt operator-(const ModInt &p) const {return ModInt(*this) -= p;}

    ModInt operator*(const ModInt &p) const {return ModInt(*this) *= p;}

    ModInt operator/(const ModInt &p) const {return ModInt(*this) /= p;}

    bool operator==(const ModInt &p) const {return x == p.x;}

    bool operator!=(const ModInt &p) const {return x != p.x;}

    ModInt inverse() const{
        int a = x, b = mod, u = 1, v = 0, t;
        while(b > 0){
            t = a / b;
            swap(a -= t * b, b);
            swap(u -= t * v, v);
        }
        return ModInt(u);
    }

    ModInt pow(int64_t n) const{
        ModInt ret(1), mul(x);
        while(n > 0){
            if(n & 1)   ret *= mul;
            mul *= mul;
            n >>= 1;
        }
        return ret;
    }

    friend ostream &operator<<(ostream &os, const ModInt &p){
        return os << p.x;
    }

    friend istream &operator>>(istream &is, ModInt &a){
        int64_t t;
        is >> t;
        a = ModInt<mod>(t);
        return (is);
    }

    static int get_mod() {return mod;}
};

using modint = ModInt<mod>;

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

    int n, m;
    cin >> n >> m;
    vector<modint> x(n), y(m);
    for(int i = 0; i < n; ++i)  cin >> x[i];
    for(int i = 0; i < m; ++i)  cin >> y[i];
    modint X, Y;
    for(int i = 0; i < n; ++i){
        int c = n - i * 2 - 1;
        X += x[i] * c;
    }
    for(int i = 0; i < m; ++i){
        int c = m - i * 2 - 1;
        Y += y[i] * c;
    }
    modint ans = X * Y;
    cout << ans << endl;
}

Measured memory_bytes: 3956
N = int(input())
X = list(map(int, input().split()))
X.sort()
L = X[0]
R = X[len(X) - 1]
# print(max)
sum = 0
s = []
for i in range(L, R + 1):
    for x in X:
        sum += (x - i) ** 2

    s.append(sum)
    sum = 0

print(min(s))

Measured memory_bytes: 9096
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define fi first
#define se second

#define PI acos(-1.0)
#define INF 1000000007
#define EPS 1e-10
#define MAX_M 100100

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<double, double> PD;
typedef pair<string, ll> PS;
typedef vector<ll> V;
typedef pair<P, char> PC;

int n, M, h, m;
vector<P> vp;

int main(){
	cin >> n;
	REP(i, n){
		cin >> h >> m;
		if (find(ALL(vp), P(h, m)) == vp.end())vp.push_back(P(h, m));
	}
	cin >> M;
	REP(i, M){
		cin >> h >> m;
		if (find(ALL(vp), P(h, m)) == vp.end())vp.push_back(P(h, m));
	}
	sort(ALL(vp));
	REP(i, vp.size()){
		if (i == 0)printf("%lld:%02lld", vp[i].first, vp[i].second);
		else printf(" %lld:%02lld", vp[i].first, vp[i].second);
	}
	cout << endl;
}

Measured memory_bytes: 1240
#include <bits/stdc++.h>
#define FOR(i, a, b) for(ll i = (a); i < (b); ++i)
#define FORR(i, a, b) for(ll i = (a); i > (b); --i)
#define REP(i, n) for(ll i = 0; i < (n); ++i)
#define REPR(i, n) for(ll i = n; i >= 0; i--)
#define FOREACH(x, a) for(auto &(x) : (a))
#define dump(x) cout << #x << " = " << (x) << endl;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
using namespace std;
using ll = long long;
using P = pair<ll, ll>;

int N, M;
vector<vector<int>> g;
vector<bool> used;
vector<int> v;

void dfs(int u) {
  if(used[u]) return;
  used[u] = true;
  for(int i : g[u])
    dfs(i);
  //帰りがけ順で追加
  v.push_back(u);
}

void tsort() {
  for(int i = 0; i < N; i++)
    dfs(i);
  reverse(v.begin(), v.end());
}

int signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> N >> M;
  g.resize(N);
  used.resize(N);
  REP(i, M) {
    int x, y;
    cin >> x >> y;
    x--, y--;
    g[x].push_back(y);
  }
  tsort();
  //逆順でみたいので、今回はひっくり返す
  reverse(v.begin(), v.end());

  vector<int> dp(N, 0);
  int ans = 0;
  for(int i : v) {
    for(int u : g[i]) {
      dp[i] = max(dp[i], dp[u] + 1);
    }
    ans = max(ans, dp[i]);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 8696
using System;

namespace AGC020A
{
    class Program
    {
        static void Main(string[] args)
        {
            var target = Console.ReadLine().Split(' ');
            int N = int.Parse(target[0]);
            int A = int.Parse(target[1]);
            int B = int.Parse(target[2]);
            if( (Math.Abs(A-B)-1) % 2 == 1) Console.WriteLine("Alice"); 
            else Console.WriteLine("Borys");
        }
    }
}


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

using namespace std;

//#define int long long
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
/*
typedef pair<int, int> pii;
typedef vector<int> vi;
//typedef vector<vector<int> > vvi;
typedef vector<bool> vb;
*/
inline void setMax(int &a, int b){ a = max(a, b); }
inline void setMin(int &a, int b){ a = min(a, b); }

signed main(){
    cin.tie(0); cout.tie(0); cin.sync_with_stdio(0); cout.sync_with_stdio(0);

    int N;
    string s;
    cin >> N >> s;
    if(N >= 3200) cout << s;
    else cout << "red";
}

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

int main(void)
{
    string s, p, str1, str2, str3;
    string::size_type index;
    cin >>s>>p;

    str1 = s+s;

    index = str1.find(p);
    if(index == string::npos) cout<<"No"<<endl;
    else cout<<"Yes"<<endl;
}


Measured memory_bytes: 3188
#include<iostream>
#include<string>
#include<algorithm>    
#include<cmath>
#include<map>
#include<vector>
#include<math.h>
#include<stdio.h>
#include<stack>
#include<queue>
#include<tuple>
#include<cassert>
#include<set>
//#include<bits/stdc++.h>
using ll = long long;
using namespace std;
const ll INF = 1000000000000000000;
const ll mod = 1000000007;
ll test[12345678];
signed main() {
	ll n, m, q, k, a = 0, b = 0, c = 0, ans = 0; string s, t; char z;
	cin >> n >> k;
	for (int h = 0; h < n; h++) {
		cin >> test[h];
	}
	sort(test, test + n);
	for (int h = 0; h < k; h++) {
		ans += test[h];
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define ll long long
using namespace std;
typedef long double ld;
ll dp[200050];
int n,m;
struct edge{
	int v,nxt;
}e[200050<<1];
int head[200050],ecnt;
inline void ad(int u,int v){
	e[++ecnt].v=v;e[ecnt].nxt=head[u];head[u]=ecnt;
}

void dfs(int u,int fa,ll val){
	for(int i=head[u];i;i=e[i].nxt){
		int v=e[i].v;
		if(v==fa)continue;
		dfs(v,u,val+dp[u]);
	}
	dp[u]+=val;
}

int main(){
	cin>>n>>m;
	for(int i=1;i<n;++i){
		int x,y;cin>>x>>y;ad(x,y),ad(y,x);
	}
	for(int i=1;i<=m;++i){
		int u;ll val;cin>>u>>val;
		dp[u]+=val;
	}
	dfs(1,0,0);
	for(int i=1;i<=n;++i){
		printf("%lld ",dp[i]);
	}
	return 0;
}

Measured memory_bytes: 17280
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<bitset>
#include<cctype>
#include<climits>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<deque>
#include<list>
#include<map>
#include<set>
#include<stack>
#include<string>
#include<sstream>
#include<queue>
#include<vector>
using namespace std;

typedef string::const_iterator state;
class parse_error {};

void cmpinc(state &it, char expected) {
	if (*it == expected) {
		it++;
	}
	else {
		cerr << "Expected '" << expected << "',";
		cerr << "got '" << *it << "'";

		cout << endl;
		throw parse_error();
	}
}

/*

EBNF

k = '[' k ']' { '[' k '][' k ']' }|
	'[' i ']' { '[' i '][' i ']' }


*/

int k(state &it);
int i(state &it);

int k(state &it) {
	//cout << "k " << *it << endl;
	int ret = 0;
	if (*it >= '0'&&*it <= '9') {
		ret = i(it) / 2 + 1;
	}
	else {
		vector<int> a;
		while (true) {
			if (*it == '[') {
				it++; //[
				a.push_back(ret = k(it));
				//cout << a[a.size() - 1] << endl;
				it++; //]
			}
			else {
				sort(a.begin(), a.end());
				ret = 0;
				for (int i = 0; i < a.size() / 2 + 1; i++) {
					ret += a[i];
					//cout << "ret " << ret << endl;
				}
				break;
			}
		}
		//for (int i = 0; i < a.size(); i++) {
		//	cout << "a " << a[i] << endl;
		//}
	}
	return ret;
}

int i(state &it) {
	int ret = 0;
	while (isdigit(*it)) {
		ret *= 10;
		ret += *it - '0';
		it++;
	}
	return ret;
}

int main() {
	int n; cin >> n; cin.ignore();
	for (int i = 0; i < n; i++) {
		string s; getline(cin, s);
		s += "$";
		state it = s.begin();

		cout << k(it) << endl;

	}
	return 0;
}

Measured memory_bytes: 1280
#include <bits/stdc++.h>
#define int int64_t
using namespace std;

int32_t main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	int h,w,n,cnt=1;
	cin >> h >> w >> n;
	vector<vector<int>> v(h,vector<int>(w));
	vector<vector<bool>> vu(h,vector<bool>(w));
	for (int i=0; i<h; ++i){
		for (int j=0; j<w; ++j){
			char c;
			cin >> c;
			if (c == '#'){
				v[i][j] = cnt;
				cnt++;
			}
		}
	}
	for (int i=0; i<h; ++i){
		for (int j=0; j<w; ++j){
			if (v[i][j] != 0 and !vu[i][j]){
				int mark = v[i][j];
				int x = i+1;
				while (x < h and !vu[x][j] and v[x][j] == 0){
					vu[x][j] = true;
					v[x][j] = mark;
					x++;
				}
				vu[i][j] = true;
				x = i-1;
				while (x >= 0 and !vu[x][j] and v[x][j] == 0){
					vu[x][j] = true;
					v[x][j] = mark;
					x--;
				}
			}
		}
	}
	for (int k=0; k<300; ++k){
		for (int j=1; j<w; ++j){
			if (v[0][j] == 0){
				for (int i=0; i<h; ++i){
					v[i][j] = v[i][j-1];
				}
			}
		}
		for (int j=w-2; j>=0; --j){
			if (v[0][j] == 0){
				for (int i=0; i<h; ++i){
					v[i][j] = v[i][j+1];
				}
			}
		}
	}
	for (int i=0; i<h; ++i){
		for (int j=0; j<w; ++j) cout << v[i][j] << ' ';
		cout << '\n';
	}
	return 0;
}


Measured memory_bytes: 1536
#include "bits/stdc++.h"
#define ff first
#define ss second
#define szof(_x) ((int) (_x).size())
#define TASK_NAME ""

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 1e9 + 7;
const ll INFL = 1e18 + 123;
const double PI = atan2(0, -1);
mt19937 tw(960172);
ll rnd(ll x, ll y) { static uniform_int_distribution<ll> d; return d(tw) % (y - x + 1) + x; }


void solve() {
	int a, b, c, x, y;
	cin >> a >> b >> c >> x >> y;
	int ans = min(x, y) * min(a + b, c + c);
	if (x < y) {
		ans += (y - x) * min(b, c + c);
	} else {
		ans += (x - y) * min(a, c + c);
	}

	cout << ans << "\n";
}


int main() {
	//freopen(TASK_NAME ".in", "r", stdin);
	//freopen(TASK_NAME ".out", "w", stdout);
	cerr << fixed << setprecision(15);
	cout << fixed << setprecision(15);
	ios::sync_with_stdio(false);

	int tests = 1;
	// cin >> tests;
	for (int it = 1; it <= tests; ++it) {
		solve();
	}
	
	#ifdef LOCAL
		cerr << "time: " << clock() << " ms\n";
	#endif
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>

int main(void) {

  int count;
  char str[120];

  char* p;
  int flag;

  int i;


  count=0;

  while(fgets(str,sizeof(str),stdin)!=NULL) {

    
    p=strrchr(str,'\n');

    strcpy(p,"");
    

    //str[strlen(str)-1]='\0';

    flag=1;

    for(i=0;i<strlen(str)/2;i++) {

      if(str[i]!=str[strlen(str)-i-1]) flag=0;

    }

    if(flag==1) {
      count++;
      //printf("OK\n");
    }

  }

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

  return 0;

}

    

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

#if DEBUG && !ONLINE_JUDGE
    #include "header.h"
#else
    #define debug(args...)
#endif

typedef vector<int> vi;
typedef pair<int,int> ii;
typedef long long lli;
typedef long double ld;

#define pb push_back
#define all(x) x.begin(),x.end()
#define SZ(x) (int)(x).size()
#define fi first
#define se second
#define lb lower_bound
#define ub upper_bound
#define rep(i,a,b) for(auto i=(a);i<b;i++)

#define INF (int)1e9
#define EPS 1e-9
#define MOD 1000000007
void preprocess(void) {
    return;
}
long double dp[3001][3001];
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.precision(20);
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    preprocess();
    int n; cin>>n;
    vector<long double> p(n+1);
    rep(i,1,n+1) cin>>p[i];
    dp[0][0] = 1.0;
    rep(i,1,n+1) {
        rep(j,0,n+1) {
            if(j==0) {
                dp[i][j] = dp[i-1][j]*(1-p[i]);
                continue;
            }
            dp[i][j] = (1-p[i])*dp[i-1][j] + p[i]*dp[i-1][j-1];
        }
    }
    long double ans = 0.0;
    rep(i,n/2,n+1) {
        if(i>n-i) ans += dp[n][i];
    }
    cout<<ans<<endl;
}



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

int main() {
  int k;
  cin >> k;
  rep(i,360){
    int x=(i+1)*k;
    if (x%360==0){
      cout << i+1 << endl;
      break;
    }
  }
}

Measured memory_bytes: 3620
n = int(input())
h = list(map(int, input().split()))

dp = [10 ** 9] * n
dp[0] = 0
dp[1] = abs(h[1] - h[0])

for i in range(2, n):

    h1 = dp[i - 1] + abs(h[i] - h[i - 1])
    dp[i] = h1 if h1 < dp[i] else dp[i]

    h2 = dp[i - 2] + abs(h[i] - h[i - 2])
    dp[i] = h2 if h2 < dp[i] else dp[i]

print(dp[-1])

Measured memory_bytes: 52592
import math

ABC = input().split()
A = int(ABC[0])
B = int(ABC[1]) 
C = int(ABC[2])

count = 0

if A == B:
  count += 1
if A == C:
  count += 1
if B == C:
  count += 1
  
if count == 1:
  print('Yes')
else:
  print('No')

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

// def
#define debug(x) cout << #x << ": " << x << endl
#define out(x) cout << x << endl
#define repeat(i, a, b) for (int i = (a); i < (b); i++)
#define revrepeat(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define revrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define foreach(e, v) for (auto &e : v)
#define all(x) (x).begin(), (x).end()
#define CYES cout << "Yes" << endl
#define CNO cout << "No" << endl
#define SPC(x) cout << fixed << setprecision(x)
#define ZERO(a) memset(a, 0, sizeof(a))
#define MINUS(a) memset(a, 0xff, sizeof(a))

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vector<int>> vii;
typedef vector<ll> vl;
typedef vector<vector<ll>> vll;
typedef pair<int, int> P;
typedef complex<ld> Point;
const int MOD = 1e9 + 7;
const int INF = 1e9;
const int MAX_V = 1e5 + 5;
const int MAX_N = 1e5 + 5;
const double PI = acos(-1);

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

// make vector of divisor O(sqrt(n))
vector<long long> divisor(long long n) {
    vector<long long> res;
    for (long long i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            res.push_back(i);
            if (i != n / i) res.push_back(n / i);
        }
    }
    return res;
}

int main() {
    int n, k;
    cin >> n >> k;
    map<int, int> dict;
    rep(i, k) {
        int d;
        cin >> d;
        rep(j, d) {
            int x;
            cin >> x;
            x--;
            dict[x]++;
        }
    }

    int ans = 0;
    rep(i, n) if (dict[i] == 0) ans++;
    out(ans);
}


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

namespace AtCoder
{
    public class Code20171210A
    {
        static void Main(string[] args)
        {
            string s1 = Console.ReadLine();

            Console.WriteLine(funcMain(s1));
        }

        static public string funcMain(string arg1)
        {
            return arg1.ToCharArray().Count(s => s == '1').ToString(); ;
        }
    }
}

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

template< typename T >
ostream &operator<<(ostream &os, const vector< T > &v) {
    for(const auto& itr : v){
        os << itr;
    }
  return os;
}

struct ProconInit {
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;

    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if(AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;

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

void solve() {
    int N, L; cin >> N >> L;
    vector<string> S(N); rep(i, N) cin >> S[i];
    sort(S.begin(), S.end());

    cout << S;
    cout << "\n";
}

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

Measured memory_bytes: 256
#![allow(non_snake_case, unused)]
use std::cmp::*;
use std::collections::*;
use std::f64::consts::*;

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

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

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

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

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

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

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

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

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

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

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

fn main() {
    input!{
        mut n: String,
    }
    n = n.replace("/", "");
    println!(
        "{}",
        if n.parse::<u64>().unwrap() <= 20190430 {
            "Heisei"
        } else {
            "TBD"
        }
    );
}


Measured memory_bytes: 4352
def two_int():
    N, K = map(int, input().split())
    return N,K

def one_int():
    return int(input())

def one_str():
    return input()

def many_int():
    return list(map(int, input().split()))

N,M=two_int()

boxes = [1 for i in range(N)]

dicts={0:1}
for i in range(M):
    A,B=two_int()
    boxes[A-1] -= 1
    boxes[B-1] += 1
    
    if A-1 in dicts:
        dicts[B-1]=1
        
        if boxes[A-1]==0:
            del dicts[A-1]

print(len(dicts))

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

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cout<<setprecision(32);

	int n; cin>>n;
	set<int> st;
	for(int i = 0; i < n; i++){
		int x; cin>>x;
		if(st.find(x) != st.end()){
			cout<<"NO"<<endl;
			exit(0);
		}
		st.insert(x);
	}
	cout<<"YES"<<endl;

	return 0;
}

Measured memory_bytes: 9600
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(long long int i=0;i<n;i++)
#define foi(i,a,n) for(long long int i=a;i<n;i++)
#define el "\n"

const int INF = 2e9+5;
using ll = long long int;

void solve(){
	ll n,W;cin>>n>>W;
  	vector<ll> w(n), v(n);
  	rep(i,n) cin>>w[i]>>v[i];
  	ll tot=0;
  	for(auto i:v)tot+=i;
  	vector<ll> dp(tot+1,INF);
  	dp[0]=0;
  	rep(i,n){
    	for(ll j=tot-v[i];j>=0;j--){
        	dp[j+v[i]]=min(dp[j+v[i]], dp[j]+w[i]);
        }
    }
  	for(ll i=tot;i>=0;i--) if(dp[i]<=W){
    	cout<<i<<el;
      return;
    }
}

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

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

#define endl '\n'

using namespace std;

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

	int a, b;
	cin >> a >> b;
	cout << "a " << (a == b ? "==" : (a > b ? ">" : "<")) << " b" << endl;
	return 0;
}


Measured memory_bytes: 3140
N=int(input())
L=[list(map(int,input().split())) for i in range(N)]
zmax=zmin=L[0][0]+L[0][1]
wmax=wmin=L[0][0]-L[0][1]
for a,b in L:
    z,w=a+b,a-b
    zmax=max(zmax,z)
    zmin=min(zmin,z)
    wmax=max(wmax,w)
    wmin=min(wmin,w)
print(max(zmax-zmin,wmax-wmin))

Measured memory_bytes: 45340
#include <stdio.h>

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

    if(a<=111){
        printf("111\n");
    }
    else if(a<=222){
        printf("222\n");
    }
    else if(a<=333){
        printf("333\n");
    }
    else if(a<=444){
        printf("444\n");
    }
    else if(a<=555){
        printf("555\n");
    }
    else if(a<=666){
        printf("666\n");
    }
    else if(a<=777){
        printf("777\n");
    }
    else if(a<=888){
        printf("888\n");
    }
    else {
        printf("999\n");
    }

    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define F first
#define S second

const int mx=100010;
const ll mod=1e9+7;


int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i,n){ cin >> a[i]; a[i]--;}
  vector<int> idx(n);
  rep(i,n){ idx[a[i]] = i; }

  set<int> st;
  ll ans = 0;
  for(int x=0; x<n; x++){
    int i = idx[x];
    ll c = 0;
    st.insert(i);
    int l = 0;
    int r = n-1;
    auto it = st.find(i);
    if(it!=st.begin()){
      it--;
      l = *it;
      l++;
    }
    it = st.find(i);
    it++;
    if(it!=st.end()){
      r = *it;
      r--;
    }
    c = (ll)(i-l+1)*(r-i+1);
    ans += c*(x+1);
  }

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


Measured memory_bytes: 11136
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a[3];
    for(int i=0;i<3;i++){
        scanf("%d",&a[i]);
    }
    sort(a,a+3);
    if(a[0]+a[1]==a[2])
        printf("Yes\n");
    else
        printf("No\n");
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007
 
ll a[100010];
int main() {
	ll n;
	cin>>n;
	for(ll i=0;i<n;i++){
		ll now;
		cin>>now;
		a[i]=now;
	}
	ll ans=0;
	for(ll i=0;i<n;i++){
		ans+=a[i]/2;
		if(a[i]%2!=0){
			if(a[i+1]!=0){
				ans++;
				a[i+1]--;
			}
		}
	}
	cout <<ans;
	// your code goes here
	return 0;
}

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

int h, w;
string s;
int main() {
	int i, j;
	cin >> h >> w;
	for(i=1; i<=h; i++) for(j=0; j<w; j++) {
		cin >> s;
		if(s=="snuke") {
			printf("%c%d", j+'A', i);
			return 0;
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define it ::iterator
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double ESP=1e-10;
using namespace std;
int main(){
  int a,b,c;
  cin>>a>>b>>c;
  if((a&&b&&!c)||(!a&&!b&&c))cout<<"Open"<<endl;
  else cout<<"Close"<<endl;


}

Measured memory_bytes: 1156
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
#define MP make_pair
#define PB push_back
#define REP(i, a, b) for(int i = a; i < b; i++)
#define PER(i, a, b) for(int i = b - 1; i >= a; i--)

int main() {
	int n, k; scanf("%d%d", &n, &k);
	int all = 1 << n;
	int ans = 1 << n;
	REP(S, 0, all) {
		int t = 1;
		REP(i, 0, n) {
			if((S >> i) & 1) t += k;
			else t <<= 1;
		}
		if(t < ans) ans = t;
	}
	printf("%d\n", ans);

	return 0;
}


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

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

  int ans = -5 * 1e8;
  for (int a = 0; a <= min(n, k); a ++) {
    for (int b = 0; a + b <= min(n, k); b ++) {
      vector<int> d;
      int tmp = 0;
      for (int c = 0; c < n; c ++) {
        if (c < a || c > n - b - 1) {
          tmp += v[c];
          if (v[c] < 0) d.push_back(v[c]);
        }
      }
      sort(d.begin(), d.end());
      for (int x = 0; x < min(k - (a + b), (int)d.size()); x ++) tmp -= d[x];
      ans = max(ans, tmp);
    }
  }

  cout << ans << endl;
}


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

long inf = 1000000007;


int main() {
	int n; cin >> n;
	vector<int> a(n);
	int amax = 0, amin = inf;

	for (int i = 0; i < n; i++) {
		cin >> a[i];
		amax = max(a[i], amax);
		amin = min(a[i], amin);
	}


	int totalmin = inf;

	for (int i = amin ; i < amax+1; i++) {
		int  total = 0;
		for (int j = 0; j < n; j++) {
			total += (i - a[j]) * (i - a[j]);
		}
		totalmin = min(totalmin, total);
	}



	cout << totalmin << endl;
}




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

int main(){
    int H , Num , N , i;
    scanf( "%d%d" , &H , &N );

    for( i = 1 ; i <= N ; ++i ){
        scanf( "%d" , &Num );
        H -= Num;
    }   

    if( H <= 0 ) puts( "Yes" );
    else puts( "No" );
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using static System.Console;
using static System.Math;

namespace Atcoder
{
    class Program
    {
        static StreamWriter sw = new StreamWriter(OpenStandardOutput()) { AutoFlush = false };
        static void Main(string[] args)
        {
            try
            {
                SetOut(sw);
                Solve.Answer();
                Out.Flush();
            }
            catch (Exception ex)
            {
                WriteLine(ex.ToString());
            }
        }
    }

    public class Solve
    {
        public static void Answer()
        {
            var abx = IO.RSDouble;
            double a = abx[0];
            double b = abx[1];
            double x = abx[2];

            double ok = PI / 2.0;
            double ng = 0.0;
            for (int i = 1; i < 100000; i++)
            {
                double mid = (ok + ng) / 2;
                if (f(a, b, mid) < x) ok = mid;
                else ng = mid;
            }
            WriteLine(ok / PI * 180);
        }

        const double EPS = 0.0000000001;
        public static double f(double a, double b, double theta)
        {
            if (theta > PI / 2.0 - EPS)
                return 0.0;
            double ret;
            if (a * Tan(theta) <= b)
            {
                ret = a * a * b - a * a * a * Tan(theta) / 2.0;
            }
            else
            {
                ret = b * b / Tan(theta) * a / 2.0;
            }
            return ret;
        }
    }

    public class IO
    {
        #region Input
        public static int RInt => int.Parse(ReadLine());
        public static long RLong => long.Parse(ReadLine());
        public static double RDouble => double.Parse(ReadLine());

        public static string[] RSString => ReadLine().Split();
        public static int[] RSInt => ReadLine().Split().Select(s => int.Parse(s)).ToArray();
        public static long[] RSLong => ReadLine().Split().Select(s => long.Parse(s)).ToArray();
        public static double[] RSDouble => ReadLine().Split().Select(s => double.Parse(s)).ToArray();
        #endregion

        #region Output
        public static void OutJoinSpace<T>(IEnumerable<T> list) => WriteLine(string.Join(" ", list));
        public static void WriteLineYes_or_No(bool flag) => WriteLine(flag ? "Yes" : "No");
        public static void WriteLineYES_or_NO(bool flag) => WriteLine(flag ? "YES" : "NO");
        #endregion
    }

    public class Mod
    {
        #region
        private readonly static long M = 1000000007;

        public static long Add(long a, long b) => (a * b) % M;
        public static long Sub(long a, long b) => (a - b) % M >= 0 ? (a - b) % M : (a - b) % M + M;
        public static long Multi(long a, long b) => (a * b) % M;
        #endregion
    }
}

Measured memory_bytes: 20308