akhauriyash/Code-Regression huggingface dataset:
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "ctime"

using namespace std;

constexpr long long int MOD = 1000000007;
//constexpr int MOD = 1000000007;
//constexpr int MOD = 998244353;
//constexpr long long int MOD = 998244353;
constexpr double EPS = 1e-9;

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

vector<vector<long long int>>matrix_product(vector<vector<long long int>>v, vector<vector<long long int>>w) {
	vector<vector<long long int>>ret(v.size(), vector<long long int>(w.front().size()));
	for (int i = 0; i < ret.size(); i++) {
		for (int j = 0; j < ret[i].size(); j++) {
			for (int k = 0; k < w.size(); k++) {
				ret[i][j] += v[i][k] * w[k][j];
				ret[i][j] %= MOD;
			}
		}
	}
	return ret;
}

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

	cin >> K;
	while (K--) {
		cin >> N;
		vector<vector<long long int>>box(21, vector<long long int>(21));
		for (int i = 0; i < 10; i++) {
			box[i][i] = box[i][i + 1] = 1;
		}
		box[10][12] = 1;
		box[10][10] = 1;
		for (int i = 11; i <= 19; i += 2) {
			box[i][i + 1] = 1;
			box[i + 1][i] = 1;
			if (i + 3 <= 20)box[i + 1][i + 3] = 1;
		}
		vector<vector<long long int>>dp(21, vector<long long int>(1));
		dp[20][0] = 1;
		N += 10;
		auto by = box;
		for (int i = 0; i <= 30; i++) {
			if ((N >> i) & 1) {
				dp = matrix_product(by, dp);
			}
			by = matrix_product(by, by);
		}
		cout << dp.front().front() << endl;
	}
}

Measured memory_bytes: 3688
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[][] arr = new int[N][3];
        for (int i = 0; i < N; i++) {
        	for (int j = 0; j < 3; j++) {
                arr[i][j] = sc.nextInt();
			}
        }

		Main obj = new Main();
		System.out.println(obj.maxFallingPathSum(arr));
	}

	public int maxFallingPathSum(int[][] arr) {

		int row = arr.length;
		int column = arr[0].length;

		int dp[][] = new int[row][column];

		for (int i = 0; i < column; i++) {
			dp[0][i] = arr[0][i];
		}

		for (int i = 1; i < row; i++) {
			for (int j = 0; j < column; j++) {
				int max = Integer.MIN_VALUE;
				for (int j2 = 0; j2 < column; j2++) { // Every item in previous row.
					if(j != j2) {                     // Except items in same column. 
						max = Math.max(max, dp[i-1][j2]);
					}
				}
				dp[i][j] = max+arr[i][j];
			}
		}

		int max = Integer.MIN_VALUE;
		for (int i = 0; i < column; i++) {
			max = Math.max(max, dp[row-1][i]);
		}
		return max;
	}
}

Measured memory_bytes: 100120
# import math
# from collections import Counter

# N = int(input()) # 1行, 単数
# arg = list(map(int, input().split())) # 1行, 配列
# D = Counter(arg) # 出現数カウント

# print('Yes')
# print('No')
# print()


N,M = map(int, input().split()) # 1行, 配列
H = list(map(int, input().split())) # 1行, 配列

AB={}

while True:
  try:
    A,B = map(int, input().split())
    AB.setdefault(A, []).append(H[B-1])
    AB.setdefault(B, []).append(H[A-1])
  except:
    break;

good = 0

for i, item in enumerate(H):

  try:
    targetLoad = AB[i+1]
    if max(targetLoad) < item:
      good = good + 1
  except:
    good = good + 1

print(good)

Measured memory_bytes: 99612
//HOW YOU DOI'N........................JT
//Could this code be more bad..........CB
//I know...............................MG
//Hii..................................RG
//Noooooooo............................RG
//I wish I could but I don't want to...PB

//That's what she said.................MS


#include <bits/stdc++.h>

#define fast                          \
    ios_base::sync_with_stdio(false); \
    cin.tie(0);                       \
    cout.tie(0);

#define ll long long
#define ld long double
#define pb push_back
#define mkpr make_pair
#define fi(i,a,b) for (ll i=a;i<b;i++)
#define vll vector<ll>
#define vch vector<char>
#define vst vector<string>
#define vpll vector<pll>
#define vvl vector<vector<ll>>
#define srt(v) sort(v.begin(),v.end())
#define rsrt(v) sort(v.rbegin(), v.rend())
#define mxe(v) *max_element(v.begin(),v.end())
#define pii pair<int, int>
#define pll pair<ll, ll>
#define ff first
#define ss second
#define mll map<ll, ll>
#define gcd(a, b) __gcd(a, b)
#define lcm(a, b) ((a)*1ll * (b)) / gcd(a, b)
#define nl "\n"
#define sp " "
#define sz(x)  (int)x.size()

using namespace std;

double PI = (acos(-1));
ll md = 1000000007;
//ll md = 998244353;

ll pw(ll a, ll b){ll c=1,m=a;while (b){if (b&1)c=(c*m);m=(m*m);b/=2;}return c;}
ll pwmd(ll a, ll b){ll c = 1, m = a;while (b){if (b & 1)c = ((c * m)) % md;m = (m * m) % md;b /= 2;}return c;}
ll modinv(ll n){return pwmd(n, md - 2);}
ll min(ll a,ll b){if(a>=b)return b;return a;}
ll nc2(ll n){return (1ll * n * (n - 1)) / 2;}
ll nsum(ll n){return (1ll * n * (n + 1)) / 2;}
bool prime(ll a){for(int i=2;i*i<=a;i++){if(a%i==0)return false;}return true;}

#define MAX_SIZE 100005
void Sieve(vector<int> &primes){bool IsPrime[MAX_SIZE];memset(IsPrime, true, sizeof(IsPrime));
for (int p = 2; p * p < MAX_SIZE; p++){if (IsPrime[p] == true){
			for (int i = p * p; i < MAX_SIZE; i += p)IsPrime[i] = false;}}
	for (int p = 2; p < MAX_SIZE; p++)if (IsPrime[p])primes.push_back(p);}


vector<char> sml={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
vector<char> cap={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};





// Lets start ...


void solve(){
    ll n;
    cin>>n;
    ll l[n],sum=0;
    mll mp;
    fi(i,0,n)cin>>l[i],mp[l[i]]++,sum+=l[i];
    ll q;
    cin>>q;
    fi(i,0,q){
        ll a,b;
        cin>>a>>b;
        sum+=(b-a)*mp[a];
        mp[b]+=mp[a];
        mp[a]=0;
        cout<<sum<<nl;
    }
    
    
    
}

int main(){
    //vector<int> primes;
    //Sieve(primes);
    
    fast
    ll tests=1,cnt=0;
    //cin>>tests;
    while(tests--){
        solve();
    }
    

    return 0;
    }

// Done:)




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

int main(){
    int N;
    vector<string>    vS(100010);
    map<string, int>  mP;
    int64_t res = 0ll;

    cin >> N;
    for (int i=0; i<N; i++){
        cin >> vS.at(i);
        sort(vS.at(i).begin(), vS.at(i).end());
        mP[vS.at(i)]++;
    }

    int count = 0;
    vector<int64_t> vC(100010);
    map<string, int>::iterator itr;
    for (itr = mP.begin(); itr != mP.end(); ++itr) {
        if (itr->second < 2) continue;
        vC.at(count) = itr->second;
        count++;
    }

    for (int i=0; i<count; i++) {
        res += vC.at(i) * (vC.at(i)-1) / 2;
    }

    cout << res << endl;
    return 0;
}


Measured memory_bytes: 19072
#include <iostream>
#include <assert.h>
#include <vector>
#include <unordered_map>
#include <queue>
#include <climits>
#include <cmath>
#include <algorithm>
using namespace std;
constexpr uint64_t INF = 1e18;

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

  int32_t N;
  cin >> N;
  uint64_t res = 1;
  bool of = false;
  for (int i = 0; i < N; i++) {
    uint64_t a;
    cin >> a;
    if (a == 0) {
      res = 0;
      break;
    }
    res *= a;
    if (res > INF || res < a) {
      of = true;
      res = 1;
    }
    
  }
  if (res == 0) {
    cout << 0 << endl;
  } else if (of == true) {
    cout << -1 << endl;
  } else {
    cout << res << endl;
  }
  return 0;
}



Measured memory_bytes: 3652
N,M=map(int,input().split())
ab=[list(map(int,input().split()))for _ in range(N)]
ab.sort()

ans=0
countM=0
for a,b in ab:
    b=min(b,M-countM)
    a*=b
    ans+=a
    countM+=b
    if countM==M:
        break

print(ans)

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

using namespace std;
typedef long long ll;

#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, m, n) for(int i = m;i < n;i++)

int main(){
// ここに処理を記述

    int N;
    cin >> N;

    string S;
    cin >> S;

    int ans = 1;

    char now = S[0];
    FOR(i,1,N){
        if(S[i] != now){
            now = S[i];
            ans++;
        }
    }

    cout << ans << "\n";

return 0;
}

Measured memory_bytes: 512
#include<iostream>
#include<string>
#include<algorithm>
#include <vector>

using namespace std;
int main(void){
    int count,flg=0;
    string str;

    cin >> str;
    for(int i=0;i<str.size();i++){
        count=0;
        for(int j=i+1;j<str.size();j++){
            if(str.at(i)==str.at(j))count++;
        }
        if(count==1)flg++;
    }

    if(flg==2)cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
/************************************************
   Start coding only after you have clear idea. 
*************************************************/

#include <bits/stdc++.h>

#define x first
#define y second
#define pii pair<int,int>
#define sz(x) (int)(x).size()
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long LL;
const int maxm = 2e3+23;
const int maxn = 2e5+35;
string s;
int main(){
    LL a ; cin >> a >> s;
    LL b = 0;
    for(int i = 0;i < sz(s); ++i){
        if(s[i] != '.') b = b*10+(s[i]-'0');
    }
    cout << a*b/100 << endl;
    return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  
  int a, b;
  cin >> a >> b;

  int c = a*b%2 ;
  
  if (c == 0){
   cout << "Even" << endl;
  }
  else{
   cout << "Odd" << endl;
  }
}

Measured memory_bytes: 384
import java.util.*;

class Main {
  public static final long MOD = 1000000007;
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    Integer a[] = new Integer[N];
    int ans = 0;
    for(int i=0; i<N; i++){
      a[i] = sc.nextInt();
      while(a[i] % 2 == 0){
        ans++;
        a[i] /= 2;
      }
    }
    
    System.out.println(ans);
    
  }

  public static int gcd(int a, int b){
    if(b == 0) return a;
    return gcd(b, a%b);
  }
}

Measured memory_bytes: 37228
/**
 *    author:  otera    
**/
#include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<deque>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

#define int long long
typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const int inf=1e9+7;
const ll INF=1LL<<60 ;
const ll mod=1e9+7 ;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
#define debug(x)  cerr << #x << " = " << (x) << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int n, m;
// vector<vector<int>> g;
int g[10][10];

void solve() {
	cin >> n >> m;
    rep(i, 10) {
        rep(j, 10) {
            g[i][j] = 0;
        }
    }
    rep(i, m) {
        int a, b; cin >> a >> b; --a, --b;
        g[a][b] = g[b][a] = 1;
    }
    int dp[(1<<9)][10];
    rep(i, (1<<9)) {
        rep(j, 10) {
            dp[i][j] = 0;
        }
    }
    dp[(1<<0)][0] = 1;
    for(int bit = 1; bit < (1<<n); ++ bit) {
        rep(j, n) {
            rep(k, n) {
                if(j == k) continue;
                if(g[j][k] and bit & (1<<j) and !(bit & (1<<k))) {
                    dp[bit ^ (1<<k)][k] += dp[bit][j];
                }
            }
        }
    }
    int ans = 0;
    rep(i, n) {
        ans += dp[(1<<n) - 1][i];
    }
    cout << ans << endl;
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//int t; cin >> t; rep(i, t)solve();
	solve();
    return 0;
}

Measured memory_bytes: 256
N = int(input())
A = [int(a) for a in input().split()]
ans = abs(A[0]) + abs(A[N-1])
for i in range(N-1):
    ans+=abs(A[i+1]-A[i])
for i in range(N):
    A_1 = A[i]
    if i==0:
        A_0 = 0
        A_2 = A[i+1]
    elif i==N-1:
        A_0 = A[i-1]
        A_2 = 0
    else:
        A_0 = A[i-1]
        A_2 = A[i+1]
    tmp = ans -abs(A_1-A_0) - abs(A_1-A_2) + abs(A_2-A_0)
    print(tmp)

Measured memory_bytes: 14172
import java.util.*;

class Word{
	String name;
	int page[],size;

	public Word(String n){
		name = n;
		page = new int[100];
		size = 0;
	}

	public void addPage(int p){
		page[size++] = p;
	}

	public String getName(){
		return name;
	}

	public void printWord(){
		int i;

		Arrays.sort(page,0,size);

		System.out.println(name);
		for(i=0;i+1<size;i++){
			System.out.print(page[i]+" ");
		}
		System.out.println(page[i]);
	}
}

public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		Word w[] = new Word[100];
		int size = 0;

		while(true){
			int i;
			String s[];

			if(scan.hasNextLine()){
				s = scan.nextLine().split(" ");
			} else{
				break;
			}

			for(i=0;i<size && !s[0].equals(w[i].getName());i++);
			if(i == size){
				w[size++] = new Word(s[0]);
			}
			w[i].addPage(Integer.parseInt(s[1]));
		}

		for(int i=0;i<size-1;i++){
			for(int j=i+1;j<size;j++){
				if(w[i].getName().compareTo(w[j].getName()) > 0){
					Word tmp = w[i];
					w[i] = w[j];
					w[j] = tmp;
				}
			}
		}

		for(int i=0;i<size;i++){
			w[i].printWord();
		}
	}
}

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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
//typedef vector<vector<ll>> Graph;

const ll mod = 1e9 + 7;
//const ll mod = 998244353;

#define REP(i,n) for(ll i=0;i<(ll)n;i++)
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define spa << " " <<
#define fi first
#define se second

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

template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}

template<typename T> void debug(vector<vector<T>>&v,ll h,ll w){for(ll i=0;i<h;i++)
{cerr<<v[i][0];for(ll j=1;j<w;j++)cerr spa v[i][j];cerr<<endl;}};
template<typename T> void debug(vector<T>&v,ll n){if(n!=0)cerr<<v[0];
for(ll i=1;i<n;i++)cerr spa v[i];
cerr<<endl;};

string num2bit(ll num, ll len){
    string bit = "";
    REP(i, len){
    bit += char('0'+(num>>i & 1));
    }
    return bit;
}

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

    ll A, B;
    cin >> A >> B;
    cout << A * B << endl;

    return 0;
}

Measured memory_bytes: 3636
#include <iostream>
#include <cstring>
#include <cmath>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <set>
#include <map>
#include <iterator>
#include <stack>
#include <string.h>
#include <cstdlib>
#include <queue>
#include <list>
#include <string>

using namespace std;

bool ans[100005] = {0};

int main()
{
    long long a,b,n;
    cin >> a >> b >> n;
    
    
    if (b-1 <= n){
        long long ans = max((a*n)/b-a*(n/b),(a*(b-1))/b-a*((b-1)/b));
        cout << ans << endl;
    }
    else {
        cout << (a*n)/b-a*(n/b) << endl;
    }
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1000000007;
//cout << setprecision(20) << 

int main() {
    string S; cin >> S;
    int ans = 0;
    for (int i = 0; i < S.size(); ++i) {
        int count = i;
        while (S[count] == 'A' || S[count] == 'G' || S[count] == 'C' || S[count] == 'T') {
            count++;
        }
        ans = max(ans, count - i);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <complex>
#include <utility>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <tuple>
#include <cmath>
#include <bitset>
#include <cctype>
#include <set>
#include <map>
#include <unordered_map>
#include <numeric>
#include <functional>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
using namespace std;
using ll = long long;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
inline void Yes(bool condition){ if(condition) PRINT("Yes"); else PRINT("No"); }
template<class itr> void cins(itr first,itr last){
    for (auto i = first;i != last;i++){
        cin >> (*i);
    }
}
template<class itr> void array_output(itr start,itr goal){
    string ans = "",k = " ";
    for (auto i = start;i != goal;i++) ans += to_string(*i)+k;
    if (!ans.empty()) ans.pop_back();
    PRINT(ans);
}
ll gcd(ll a, ll b) {
    return a ? gcd(b%a,a) : b;
}
const ll INF = 1e18;
const ll MOD = 1000000007;
const ll MOD2 = 998244353;
typedef pair<ll,ll> P;
typedef pair<double,double> point;
const ll MAX = 200000;
constexpr ll nx[8] = {1,0,-1,0,1,-1,1,-1};
constexpr ll ny[8] = {0,1,0,-1,1,1,-1,-1};
vector<vector<ll>> g(501,vector<ll>(501));
void color(ll l,ll r,ll c){
    if (r-l == 1) return;
    ll n = (r-l)/2;
    rep(i,l,l+n){
        rep(j,l+n,r){
            g[i][j] = c;
        }
    }
    color(l,l+n,c+1);
    color(l+n,r,c+1);
}
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin >> n;
    color(0,n,1);
    rep(i,n-1){
        rep(j,i+1,n){
            printf("%lld ",g[i][j]);
        }
        printf("\n");
    }
}


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

int main(){
  int N;
  cin >> N;
  if (N<=5){
    vector<int> ans = {2,5,63,20,30};
    for (int i=0; i<N-1; i++) cout << ans[i] << ' ';
    cout << ans[N-1] << endl;
    return 0;
  }
  int S=0;
  set<int> ans;
  for (int i=1; i<=N; i++){
    if (i%4==1){
      ans.insert((i/4)*6+2);
      S += (i/4)*6+2;
    }
    else if (i%4==2){
      ans.insert((i/4)*6+3);
      S += (i/4)*6+3;
    }
    else if (i%4==3){
      ans.insert((i/4)*6+4);
      S += (i/4)*6+4;
    }
    else{
      ans.insert((i/4)*6);
      S += (i/4)*6;
    }
  }
  if (S%6==2){
    ans.erase(8);
    if (ans.find((N/4)*6) == ans.end()) ans.insert((N/4)*6);
    else ans.insert((N/4+1)*6);
  }
  else if (S%6==5){
    ans.erase(9);
    if (ans.find((N/4)*6+4) == ans.end()) ans.insert((N/4)*6+4);
    else ans.insert((N/4+1)*6);
  }
  else if (S%6==3){
    ans.erase(9);
    ans.insert((N/4)*6);
    if (ans.find((N/4)*6) == ans.end()) ans.insert((N/4)*6);
    else ans.insert((N/4+1)*6);
  }
  for (int i: ans){
    if (i!=2) cout << ' ';
    cout << i;
  }
  cout << endl;
}


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

signed main() {
  int N;
  cin >> N;
  set<int> D;
  int d;
  for( int i = 0; i < N; i++ ){
    cin >> d;
    D.insert(d);
  }
  cout << D.size() << endl;
}



Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
using namespace std;
#define x first
#define y second
#define dbg(x) cout << #x << '=' << x << '\n';
#define ll long long
#define pi pair<int,int>
#define pl pair<ll,ll>
#define pd pair<double,double>
#define ld long double
#define pld pair<ld,ld>
#define lg length()
#define sz size()
#define pb push_back
#define MAXN 100005
#define INF 1000000005
#define LINF 1000000000000000005
#define x1 xdddddddddddddddddd
#define y1 ydddddddddddddddddd

int n,t,a,h[1005],s=INF,p;

int32_t main(){
    ios_base :: sync_with_stdio(0); cin.tie(); cout.tie();
    cin >> n >> t >> a; t*=1000; a*=1000;
    for(int i=1;i<=n;i++){
        cin >> h[i]; h[i]*=6;
        if(abs(t-h[i]-a)<s) s=abs(t-h[i]-a),p=i;
    }
    cout << p;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
typedef long long ll;
const int INF (1<<30);

int main() {
  int N, M;
  cin >> N >> M;
  vector<int> H(N);
  rep(i, N) {
    cin >> H[i];
  }

  vector<vector<int>> x(N);
  rep(i, M) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    x[a].emplace_back(b);
    x[b].emplace_back(a);
  }

  int ans = 0;
  rep(i, N) {
    ans++;
    rep(j, x[i].size()) {
      if (H[i] <= H[x[i][j]])  {
        ans--;
        break;
      }
    }
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 8804
import sys


inint = lambda: int(sys.stdin.readline())
inintm = lambda: map(int, sys.stdin.readline().split())
inintl = lambda: list(inintm())
instrm = lambda: map(str, sys.stdin.readline().split())
instrl = lambda: list(instrm())

r, g, b, n = inintm()

ans = 0

for i in range(3001):
    for j in range(3001):
        if (n - (i*r + j*g)) >= 0 and (n - (i*r + j*g)) % b == 0:
            ans += 1

print(ans)


Measured memory_bytes: 68208
A,B,C,D = map(int,input().split(" "))

if A >= C:
    temp_max = A
else:
    temp_max = C
if B <= D:
    temp_min = B
else:
    temp_min = D


ans = temp_min-temp_max
if ans >=0:
    print(ans)
else:
    print("0")

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
typedef long long llong;
const int inf = 1 << 20;
const int mod = 1e9 + 7;
int main() {
   int S;
   cin >> S;
   int h = S / 60 / 60;
   int m = (S - h * 60 * 60) / 60;
   int s = S % 60;
   printf("%d:%d:%d\n", h, m, s);
   return 0;
}


Measured memory_bytes: 3220
from collections import deque

X, Y, A, B, C = map(int, input().split())
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))

p.sort(reverse = True)
q.sort(reverse = True)
r.sort(reverse = True)

r = deque(r)
deque_p = deque(p[:X])
deque_q = deque(q[:Y])
deque_r = deque([])

if r:
    while min(deque_p[-1], deque_q[-1]) < r[0]:
        if deque_p[-1] <= deque_q[-1]:
            deque_p.pop()
            deque_r.append(r.popleft())
        else:
            deque_q.pop()
            deque_r.append(r.popleft())

        if (not r) or (not deque_p) or (not deque_q):
            break

if r and deque_p:
    while deque_p[-1] < r[0]:
        deque_p.pop()
        deque_r.append(r.popleft())

        if (not r) or (not deque_p):
            break

if r and deque_q:
    while deque_q[-1] < r[0]:
        deque_q.pop()
        deque_r.append(r.popleft())

        if (not r) or (not deque_q):
            break
    

ans = sum(deque_p) + sum(deque_q) + sum(deque_r)

print(ans)


Measured memory_bytes: 23616
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <map>
#include <set>
#include <string>
#include <cstring>
#include <sstream>
#include <cmath>
#include <functional>
#include <fstream>
#include <cstdlib>
typedef long long ll;
const int MOD = 1e9+7;


#define REP(i, N) for (int i = 0; i < (N); i++)
#define REPP(i, a, b) for (int i = (a); i < (b); i++)
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define VSORT(c) sort((c).begin(),(c).end())
#define SZ(x) ((int)(x).size())
//vvintを作る　マクロで　 #define vvint(N,M) vector<vector<int>>

using namespace std;

bool find(char c){
    char str[4] = {'A','C','G','T'};
    for(int i = 0; i < 4;i++){
        if(c == str[i]) return true;
    }
    return false;
}


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

    string S;
    cin >> S;
    int _max = 0;
    
    int count = 0;
    for(int i = 0; i < S.length();i++){
        if(find(S[i])){
            count++;
            _max = max(_max,count);   
        }else{
            count = 0;
        }
    }
    cout << _max << endl;

    return 0;
}

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

int main(){
    int x,y;
    cin >>x>>y;
    int ret=0;
    y-=x;
    if(x<0);
    else if(x==0){
        ret=1;
    }
    else{
        ret++;
        int z;
        z=y/(x-1);
        ret+=z;
        if(y-z*(x-1)>0)
        ret+=1;
    }
    cout << ret;
    return 0;
    }
    


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <math.h>
#include <string>
#include <string.h>
#include <stack>
#include <queue>
#include <vector>
#include <utility>
#include <set>
#include <map>
#include <stdlib.h>
#include <iomanip>

using namespace std;

#define ll long long
#define vvi vector< vector<int> >
#define vi vector<int>
#define All(X) X.begin(),X.end()
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back
#define pii pair<int,int>
#define mp make_pair
#define pi 3.14159265359
#define shosu(X) fixed << setprecision(X)
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b)*b; }


int main() {
	ll N, M;
	char A[50][50], B[50][50];
	cin >> N >> M;
	REP(x, N) {
		REP(y, N) {
			cin >> A[x][y];
		}
	}
	REP(x, M) {
		REP(y, M) {
			cin >> B[x][y];
		}
	}

	bool exist = false;

	REP(lx, N) {
		REP(ly, N) {

			bool match = true;
			REP(x, M) {
				REP(y, M) {
					if (A[x + lx][y + ly] != B[x][y]) match = false;
				}
			}
			if (match) exist = true;
		}
	}

	if (exist) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}


	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <string>
#include <functional>
#include <utility>
#include <queue>
#include <vector>
#include <string>
#include <cmath>
using namespace std;
typedef long long int ll;
const ll  MOD = 1000000007;
typedef pair<int,int> P;

int N,M;
vector<int> input[100100];
vector<int> num[100100];
bool reached[100100];
bool looked[100100];
queue<int> q;
int main(){
  cin >> N >> M;
  for(int i=1;i<=N;i++){
    int K;
    cin >> K;
    for(int j=0;j<K;j++){
      int t;
      cin >> t;
      input[i].push_back(t);
      num[t].push_back(i);
    }
  }
  q.push(1);
  while(!q.empty()){
    int tmp=q.front();
    q.pop();
    reached[tmp] = true;
    int l=input[tmp].size();
    for(int i=0;i<l;i++){
      int t2 = input[tmp][i];
      if(!looked[t2]){
        looked[t2] = true;
        int l2=num[t2].size();
        for(int j=0;j<l2;j++){
          int t3 = num[t2][j];
          if(!reached[t3]){
            q.push(t3);
            reached[t3] = true;
          }
        }
      }
    }
  }
  for(int i=1;i<=N;i++){
    if(!reached[i]){
      cout << "NO" << endl;
      return 0;
    }
  }
  cout << "YES" << endl;
}


Measured memory_bytes: 9080
import java.util.*;

// ABC 43-C
// http://abc043.contest.atcoder.jp/tasks/arc059_a

public class Main {
	
	public static void main (String[] args) throws java.lang.Exception {
	    Scanner in = new Scanner(System.in);
	    
	    int n = in.nextInt();
	    int[] nums = new int[n];
	    int sum = 0;
	    
	    for (int i = 0; i < n; i++) {
	    	nums[i] = in.nextInt();
	    	sum += nums[i];
	    }
	    
	    int avg = sum / n; // Probably need to investigate avg + 1 too
	    
	    System.out.println(Math.min(cost(nums, avg), cost(nums, avg + 1)));
	}
	
	public static int cost(int[] nums, int avg) {
		int cost = 0;
		for (int i = 0; i < nums.length; i++) {
			cost += (nums[i] - avg) * (nums[i] - avg);
		}
		return cost;
	}
}


Measured memory_bytes: 21076
#include <iostream>
#include <vector>
#include <limits>
#include <algorithm>
#include <cmath>

using namespace std;

int count = 0; // ?¨???¬??¨ global ?????°
int solve(int E) {
	::count = 0;
	int ans = numeric_limits<int>::max(); // ?????§???
	for (int y=0; y*y<=E; ++y){
		for (int z=0; z*z*z<=E; ++z){
			++::count;
			int x = (int)round(E-y*y-z*z*z);
			if (x+y*y+z*z*z == E && x >= 0)
				ans = min(ans, x+y+z);
		}
	}
	return ans;
}
int main() {
	int E;
	while (cin >> E && E>0) {
		cout << solve(E) << endl;
		// cout << "case: m = " << E << " count: " << ::count << endl;
	}
}

Measured memory_bytes: 3200
import sys
input = sys.stdin.readline
n,m = map(int,input().split())
A = [list(input().split()) for i in range(m)]

for i in range(m):
    A[i][0] = int(A[i][0])-1

P = [0] * n
AC = [0] * n

for i in range(m):
    if A[i][1] == "WA":
        if AC[A[i][0]] == 0:
            P[A[i][0]] += 1
    else:
        AC[A[i][0]] = 1
    
p=0
ac=sum(AC)
for i in range(len(P)):
    if AC[i] == 1:
        p += P[i]
print(ac,p)

Measured memory_bytes: 71644
#!/usr/bin/env python3
class Factorial:
    def __init__(self, n, mod):
        self.f = f =[0] * (n + 1)
        f[0] = b = 1
        for i in range(1, n + 1):f[i] = b = b * i % mod
        self.inv = inv = [0] * (n + 1)
        inv[n] = b = pow(self.f[n], -1, mod)
        for i in range(n,0,-1):inv[i-1] = b = b * i % mod
        self.mod = mod
    def factorial(self, i):
        return self.f[i]
    def ifactorial(self, i):
        return self.inv[i]
    def comb(self, n, k):
        if n >= k:return self.f[n] * self.inv[n - k] * self.inv[k] % self.mod
        else:return 0

MOD = 998244353
nCr = Factorial(5*10**5, MOD).comb
N, M, k = map(int, input().split())
print(sum(nCr(N - 1, x) * M * pow(M - 1, N - x - 1, MOD) % MOD for x in range(-~k)) % MOD)

Measured memory_bytes: 48404
//Practice more and more
//learn for better
#define bn begin()
#define en end()
#define mx 5000010
#define pb push_back
#define PI (2.0*acos(0.0))
#define al(a) a.begin(),a.end()
#define rb(a,b,c) for(int a=b;a<=c;++a)
#define rep(a,b) for(int a=0;a<b;++a)
#define fastio ios::sync_with_stdio(false)
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef vector<int>  vi;
typedef vector<ll>   vll;
int main()
{
ios::sync_with_stdio(false);
cin.tie(NULL);
	int a,b,c,n,i,t,tmp,d,e,f;
	ll sum=0;
	string str;
	cin>>str;
	for(i=0;i<str.length();i++)
	{
		sum+=str[i]-'0';
	}
if(sum%9==0)
cout<<"Yes\n";
else
cout<<"No\n";

	return 0;
}

Measured memory_bytes: 3716
#include<bits/stdc++.h>
using namespace std;
int main(){
        const long long c = 2019;
        long long l, r;
        cin >> l >> r;
        if(r-l>2019) r = l+2020;
        long long ans = 2000000001;
        for(long long i=l; i<r; i++){
                for(long long j=i+1; j<=r; j++){
                        ans = min(ans, i*j%c);
                }
        }
        cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)  //  repマクロ
#define leng(n) (int)(log10(n)+1)  //  桁数
using namespace std;

signed main() {
  string s, t;
  cin >> s >> t;
  vector<char> a(s.size());
  vector<char> b(t.size());
  for (int i = 0; i < s.size(); i++) {
    a[i] = s[i];
  }
  for (int i = 0; i < t.size(); i++) {
    b[i] = t[i];
  }
  sort(s.begin(), s.end());
  sort(t.begin(), t.end());
  reverse(t.begin(), t.end());
  string sd = "";
  string td = "";
  for (int i = 0; i < s.size(); i++) {
    sd += s[i];
  }
  for (int i = 0; i < t.size(); i++) {
    td += t[i];
  }
  if (sd < td) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
int main(void){
    
    int a[3];
    for(int i=0;i<3;i++) cin>>a[i];
   
   if(a[0]<a[1] && a[1]<a[2]) cout<<"Yes"<<endl;
   else cout<<"No"<<endl;
   
}



Measured memory_bytes: 3108
from collections import Counter
n=int(input())
a=list(map(int,input().split()))
c=Counter(a)

mod=10**9+7

def isExist():
    if n%2==0:
        for i in range(1, n, 2):
            if c[i]==2:
                continue
            else:
                return False
    elif n%2==1:
        for i in range(0, n, 2):
            if i==0 and c[i]==1:
                continue
            elif c[i]==2:
                continue
            else:
                return False
    return True

if isExist():
    ans=1
    for _ in range(int(n*0.5)):
        ans*=2
        ans%=mod
    print(ans)
else:
    print(0)

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

typedef long long ll;
const int N = 100;
int n, m, k;
char s[N][N];
int h[N], w[N];

void solve() {
	scanf("%d%d%d", &n, &m, &k);
	for(int i = 0; i < n; i++) scanf("%s", s[i]);
	
	int sum = 0;
	for(int i = 0; i < n; i++)
		for(int j = 0; j < m; j++)
			h[i] += (s[i][j] == '#');
	for(int j = 0; j < m; j++)
		for(int i = 0; i < n; i++)
			w[j] += (s[i][j] == '#');
			
	for(int i = 0; i < n; i++) sum += h[i];
	
	int res = 0;
	for(int i = 0; i < (1 << n); i++) {
		for(int j = 0; j < (1 << m); j++) {
			int tsum = 0;
			for(int a = 0; a < n; a++) if(i >> a & 1) tsum += h[a];
			for(int b = 0; b < m; b++) if(j >> b & 1) tsum += w[b];
			
			for(int a = 0; a < n; a++) { 
				for(int b = 0; b < m; b++) {
					if((i >> a & 1) && (j >> b & 1)) {
						tsum -= (s[a][b] == '#');
					}
				}
			}
				
			if(sum - tsum == k) res++;
		}
	}
	
	printf("%d\n", res);
}

int main()
{
	int T = 1;
	//scanf("%d", &T);
	while(T--) {
		solve();
	}
}

Measured memory_bytes: 3816
#include <cstdio>

int main(void){
    int sx,sy,tx,ty;
    scanf("%d %d %d %d",&sx,&sy,&tx,&ty);
    int dx = tx-sx;
    int dy = ty-sy;
    int i;
    for(i=0;i<dy;i++)printf("U");
    for(i=0;i<dx;i++)printf("R");
    for(i=0;i<dy;i++)printf("D");
    for(i=0;i<dx;i++)printf("L");

    printf("L");
    for(i=0;i<dy+1;i++)printf("U");
    for(i=0;i<dx+1;i++)printf("R");
    printf("D");
    printf("R");
    for(i=0;i<dy+1;i++)printf("D");
    for(i=0;i<dx+1;i++)printf("L");
    printf("U");

    printf("\n");

    return 0;
}


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

#define max(x,y) (x>y?x:y)
#define min(x,y) (x<y?x:y)
#define abs(x) (x>0?x:-x)

int main()
{
	int P, Q, R;

	scanf("%d%d%d", &P, &Q, &R);

	int max = P;
	if (Q > P)
		max = Q;
	if (R > max)
		max = R;

	printf("%d\n", P + Q + R - max);

}

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

int main() {
  int A, B, C;
  cin >> A >> B >> C;
  
  if(A == B && B == C) {
    cout << "No" << endl;
  }
  else if(A == B || B == C || C == A) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,k,n) for(int i = (k); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) a.begin(), a.end()
#define MS(m,v) memset(m,v,sizeof(m))
#define D10 fixed<<setprecision(10)
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
typedef long double ld;
const int MOD = 1000000007;
const int INF = MOD + 1;
const ld eps = 1e-11;
template<class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<class T> T &chmax(T &a, const T &b) { return a = max(a, b); }

/*--------------------template--------------------*/
typedef valarray<ld> Point;
Point make_point(ld x, ld y, ld z) {
	Point p(3);
	p[0] = x; p[1] = y; p[2] = z;
	return p;
}

ld dot(const Point &a, const Point &b) {
	return (a * b).sum();
}

Point cross(const Point &a, const Point &b) {
	return a.cshift(+1) * b.cshift(-1) - a.cshift(-1) * b.cshift(+1);
}

ld norm(const Point &a) { return dot(a, a); }
ld dist(const Point &a) { return sqrt(norm(a)); }

// Line

struct Line { Point a, b; };

bool is_in_segment(Line l, Point p) {
	return abs(dist(l.a - p) + dist(l.b - p) - dist(l.a - l.b)) < eps;
}

Point project_lp(Line l, Point p) {
	Point point = l.a, vec = l.b - l.a;
	return point + dot(p - point, vec) / norm(vec) * vec;
}

ld distance_lp(Line l, Point p) {
	return dist(p - project_lp(l, p));
}

ld distance_sp(Line l, Point p) {
	Point proj = project_lp(l, p);
	if (dist(l.a - proj) + dist(l.b - proj) < dist(l.b - l.a) + eps)
		return dist(p - proj);
	else
		return min(dist(p - l.a), dist(p - l.b));
}

struct Sphere { Point p; ld r; ll l; };

int main()
{
	int n, q; cin >> n >> q;
	vector<Sphere> v;
	REP(i, n)
	{
		ld x, y, z, r;
		ll l; cin >> x >> y >> z >> r >> l;
		v.emplace_back(Sphere{ make_point(x,y,z),r,l });
	}
	REP(i, q)
	{
		ll ans = 0;
		ld x[2], y[2], z[2];
		REP(j, 2) cin >> x[j] >> y[j] >> z[j];
		Line l{ make_point(x[0], y[0], z[0]), make_point(x[1], y[1], z[1]) };
		REP(j, n)
		{
			ld d = distance_sp(l, v[j].p);
			if (v[j].r - d > -eps) ans += v[j].l;
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 3272
Num_factor = int(input())
N = list(map(int, input().split()))


for i in range(int(Num_factor)):
    v = N[i]
    j = i - 1
    while(j >= 0 and N[j] > v):
        N[j+1] = N[j]
        j -= 1
    N[j+1] = v
    print(" ".join(map(str,N)))


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

// #include <ext/pb_ds/assoc_container.hpp>
// using namespace __gnu_pbds;
using namespace std;


typedef long long int ll;
typedef vector<int> vi;
typedef pair<int, int> pii;

typedef vector<ll> vl;
typedef pair<ll, ll> pll;

#define St first
#define Nd second
#define Pb push_back
#define print_pair(p) cout<<p.St<<" "<<p.Nd
#define list_format(i, n) (i<n? " ":"\n")
#define endl "\n"
#define sz(a) (int)a.size()

#define REP(i,a,b) for(int i = a; i <= b; i++)
#define REV(i,a,b) for(int i = a; i >= b; i--)

#define AritSum(a,d,n) ((n)*(2*(a)+((n)-1)*(d)))/2
#define Log(base, num) log2(num)/log2(base)

#define MOD 1000000007

// ************* MAIN *******************

void solve() {
    int n; cin >> n;
    n%=1000;
    cout << (1000-n)%1000 << endl;
}

/*
g++ -std=c++14 -Wall -Wextra -O2 Test.cpp -o Test

./Test < in
*/
int main() {
    int _=1;
    // cin>>_;
    REP(t,1,_) {
        // cout << "Case #" << t << ": ";
        solve();
        // cout << ((solve())? "YES" : "NO") << endl;
        // cout << solve() << endl;
    }
    return 0;
}

// 2 0 1 3 4 5 6 2 0

Measured memory_bytes: 3676
#include <iostream>
#include <vector>

using namespace std;

int main(){
    int n,m;
    cin >> n >> m;

    char a[50][50], b[50][50];

    for(int i = 0; i < n; i++){
        for(int j = 0; j < n; j++){
            cin >> a[i][j];
        }
    }

    for(int i = 0; i < m; i++){
        for(int j = 0; j < m; j++){
            cin >> b[i][j];
        }
    }


    for(int y = 0; y < n; y++){
        for(int x = 0; x < n; x++){
            if(y + m - 1 >= n || x + m - 1 >= n) continue;

            bool flag = true;

            for(int yy = 0; yy < m; yy++){
                for(int xx = 0; xx < m; xx++){
                    if(a[y+yy][x+xx] != b[yy][xx]) flag = false;
                }
            }

            if(flag){
                cout << "Yes" << endl;
                return 0;
            }
        }
    }

    cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
/*
    Take me to church
    I'll worship like a dog at the shrine of your lies
    I'll tell you my sins and you can sharpen your knife
    Offer me that deathless death
    Good God, let me give you my life
*/
#include<bits/stdc++.h>
using namespace std;
const int N = 100005;
int n, m, Mn, A[N], M[N];
vector < pair < int , int > > Adj[N];
void DFS(int v, int tp)
{
    M[v] = tp;
    Mn = min(Mn, A[v]);
    for (auto u : Adj[v])
        if (M[u.first] != tp)
            A[u.first] = A[v] + u.second, DFS(u.first, tp);
}
int main()
{
    scanf("%d%d", &n, &m);
    for (int i = 1; i <= m; i ++)
    {
        int v, u, d;
        scanf("%d%d%d", &v, &u, &d);
        Adj[v].push_back({u, d});
        Adj[u].push_back({v, - d});
    }
    for (int i = 1; i <= n; i ++)
        if (!M[i])
        {
            A[i] = Mn = 0;
            DFS(i, 1);
            if (Mn < 0)
                A[i] = - Mn, DFS(i, 2);
        }
    for (int i = 1; i <= n; i ++)
        if (A[i] < 0 || A[i] > (int)(1e9))
            return !printf("No\n");
    for (int i = 1; i <= n; i ++)
        for (auto u : Adj[i])
            if (A[i] + u.second != A[u.first])
                return !printf("No\n");
    return !printf("Yes\n");
}

Measured memory_bytes: 12416
use proconio::*;


fn which_coprime(b: &[usize], n: usize) -> i32 {
    let mut is_prime = vec![true; 1000001];
    is_prime[0] = false;
    is_prime[1] = false;

    let mut ret = 0;
    for i in 0..1000001 {
        if !is_prime[i] {
            continue;
        }

        let mut j = i*2;
        let mut cnt = b[i];
        while j < 1000001 {
            is_prime[j] = false;
            cnt += b[j];
            j += i;
        }

        if cnt == n {
            return 2;
        }
        if cnt > 1 {
            ret = 1;
        }
    }

    ret
}

fn main() {
    input!{
        n: usize,
        a: [usize; n],
    }

    let mut b = vec![0; 1000001];
    for &i in a.iter() {
        b[i] += 1;
    }

    println!("{}", match which_coprime(&b, n) {
        0 => "pairwise coprime",
        1 => "setwise coprime",
        _ => "not coprime",
    });
}


Measured memory_bytes: 25212
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String[] a_b = sc.nextLine().split(" ");
        int a = Integer.parseInt(a_b[0]);
        int b = Integer.parseInt(a_b[1]);
        int area = a * b;
        int perimeter = (a + b) * 2;
        System.out.println(area + " "  + perimeter);
    }
}


Measured memory_bytes: 26072
#include <iostream>

using namespace std;

int main()
{
	int n;
	cin >> n;
	int s;
	int t = 0;
	int ans = 1000000000;
	for (int i = 0; i < n; i++) {
		cin >> s;
		t = 0;
		while (s % 2 == 0) {
			s /= 2;
			t++;
		}
		if (ans > t) {
			ans = t;
		}
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
import collections
N = int(input())
lsA = list(map(int,input().split()))
counterA = collections.Counter(lsA)
ans = 0
for i in counterA.keys():
    if i == counterA[i]:
        continue
    if i < counterA[i]:
        ans += counterA[i]-i
    elif i > counterA[i]:
        ans += counterA[i]

print(ans)

Measured memory_bytes: 22492
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
REP(i,v.size()){if(i)os<<" ";os<<v[i];}return os;}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
REP(i,v.size()){if(i)os<<endl;os<<v[i];}return os;}

int main() {
    string s;cin>>s;
    ll L,a;
    L=s.size();
    a=0;
    if(L%2==0){
               rep(i,L/2){
                          if(s[i]!=s[L-1-i]){
                                             a++;
                                             }
                           }
               }
    else{
         rep(i,(L-1)/2){
                        if(s[i]!=s[L-1-i]){
                                           a++;
                                           }
                        }                   
         }                                       
         cout<<a<<endl;
                            

}



Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
#include<string.h>
#include<stdlib.h>
int main()
{
    int count,i;
    char play[1000];
    while(gets(play))
    {
        count=0;
        int len=strlen(play);
        for(i=0;i<len;i++)
        {
            if(play[i]=='x')
            {
                count++;
            }
        }
        if(count>7)
        {
            printf("NO\n");
        }
        else if(count<=7)
        {
            printf("YES\n");
        }
    }
    return 0;
}

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

int main() {
	ll n;
	ll a[n+1],b[n];
	cin>>n;
	
	ll sum1=0;
	for(int i=0;i<n+1;i++)
	{
	    cin>>a[i];
	    sum1+=a[i];
	}
	for(int i=0;i<n;i++)
	cin>>b[i];
	ll sum=0;
	for(int i=0;i<n;i++)
	{
	    ll p=min(a[i],b[i]);
	    a[i]-=p;
        p=min(a[i+1],b[i]-p);
	    a[i+1]-=p;
	    
	}
	for(int i=0;i<n+1;i++)
	{
	    sum+=a[i];
	}
	cout<<sum1-sum;
	return 0;
}


Measured memory_bytes: 6912
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 n = IO.RInt;
            var a = IO.RSInt;

            const int M = 1001001;
            var cnt = new int[M];
            foreach (var x in a)
            {
                if (cnt[x] != 0)
                {
                    cnt[x] = 2;
                    continue;
                }
                for (int i = x; i < M; i += x)
                {
                    cnt[i]++;
                }
            }
            int ans = 0;
            foreach (var x in a)
            {
                if (cnt[x] == 1) ans++;
            }
            WriteLine(ans);
        }
    }

    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: 47492
#include<bits/stdc++.h>
using namespace std;

string S;

int main() {
  // stringはscanfで読み取れない？（scanfがC由来だから？）
  cin >> S;
  string ans = "Yes";
  for (int i = 0; i < S.size(); i++) {
    if (i % 2 == 0 && S.at(i) == 'L') {
      ans = "No";
      break;
    } else if (i % 2 == 1 && S.at(i) == 'R') {
      ans = "No";
      break;
    }
  }

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

Measured memory_bytes: 256