akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
 #include <ext/pb_ds/tree_policy.hpp>
 #include <ext/pb_ds/assoc_container.hpp>
 #include<chrono>
 using namespace std;
 using namespace std::chrono;      
 using namespace __gnu_pbds; 
 #define fastio     ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
 #define fi         first
 #define se         second
#define int         long long 
 #define pb         push_back
 #define emp        emplace_back
 #define vv(x)      vector<x>
 #define mp(x,y)    map<x,y>
 #define dq(x)      deque<x>
 #define pql(x)     priority_queue<x>
 #define pqs(x)     priority_queue<x,vv(x),greater<x> >
 #define M          1000000007
 #define forf(i,a,b) for(int i=a;i<b;i++)
 #define it(x)      x::iterator
 #define ll         long long 
 #define debug(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
 #define time__(d)  for(long blockTime = 0; (blockTime == 0 ? (blockTime=clock()) != 0 : false); debug("%s time : %.4fs", d, (double)(clock() - blockTime) / CLOCKS_PER_SEC))
 #define vii        vector<int>
 #define big        1e18
 #define sm         -2e9
 #define mkr        make_pair
 #define vpi        vector<pair<int,int> >
 #define pii        pair<int,int>
 #define rng        500005
 #define sz(x)      (int)x.size()
 #define rv(x)      reverse(x.begin(),x.end())
 #define out(x)     cout<<x.fi<<" "<<x.se<<endl;

//#define ordered_set tree<pii, null_type,less<pii>, rb_tree_tag,tree_order_statistics_node_update> 
  
void pr_init()
{
   
    #ifndef ONLINE_JUDGE
    freopen("gin.txt", "r", stdin);
    freopen("gout.txt", "w", stdout);
   
    #endif
}


void solve()
{

 int a;
 cin >> a;
 cout<<a+a*a+a*a*a<<endl;

}


int32_t main()
{
  //pr_init();
  fastio;
  
  auto start = high_resolution_clock::now(); 
 
  solve();
  auto stop = high_resolution_clock::now();
  auto duration = duration_cast<microseconds>(stop - start); 
   // cout << "Time taken by function: "
   //       << duration.count() << " microseconds" << endl; 

 }
      
      

Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
const int64_t INF=9999999999999999;

int main() {
 int N;
 cin>>N;
 vector<int>A(N);
 for(int i=0;i<N;i++){
   cin>>A[i];
   if(A[i]%2==0){if(A[i]%3!=0&&A[i]%5!=0){cout<<"DENIED"<<endl;return 0;}}
 }
 cout<<"APPROVED"<<endl;

return 0;}

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

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

const long long MOD = 1000000007;

int main(){
  int n,a;
  cin >> n;
  int c =0;
  rep(i,n){
    cin >> a;
    if(a!=i+1) c++;
  }
  if(c==0 || c==2) cout << "YES" << endl;
  else cout << "NO" << endl;
}


Measured memory_bytes: 256
using System;

namespace ITP1_10_C
{
    class Program
    {
        static void Main(string[] args)
        {
            while(true)
            {
                string str1 = Console.ReadLine();
                int n = int.Parse(str1);
                if (n == 0)
                    break;

                double[] s = new double[n];
                double sum = 0;
                double m;

                string[] str2 = Console.ReadLine().Split(' ');
                for (int i = 0; i < n; ++i)
                {
                    s[i] = double.Parse(str2[i]);
                    sum += s[i];
                }
                m = sum / n;

                double variancesum = 0;
                for(int i = 0; i < n; ++i)
                {
                    variancesum += Math.Pow(s[i] - m, 2);
                }

                double StandardDeviation = Math.Sqrt(variancesum / n);
                Console.WriteLine("{0}", StandardDeviation);
            }
        }
    }
}

Measured memory_bytes: 5844
class UnionFind:
    def __init__(self,n):
        self.par = [i for i in range(n+1)]
        self.rank = [0] * (n+1)
    
    def find(self,x):
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]
    
    def same_check(self,x,y):
        return self.find(x) == self.find(y)
    
    def union(self,x,y):
        x = self.find(x)
        y = self.find(y)
        if self.rank[x] < self.rank[y]:
            self.par[x] = y
        else:
            self.par[y] = x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1

n,m = map(int,input().split())
ps = list(map(int,input().split()))
uf = UnionFind(n)
for i in range(m):
    x,y = map(int,input().split())
    uf.union(x,y)

cnt = 0
for i,j in enumerate(ps):
    if uf.same_check(i+1 , j):
        cnt += 1
print(cnt)
    

Measured memory_bytes: 14452
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author tatsumack
 */

#include <iostream>
#include <fstream>

#include <iostream>
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>

#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <queue>
#include <unordered_map>
#include <unordered_set>

#define int long long
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REPS(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i <= i##_len; ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define CLR(a, b) memset((a), (b), sizeof(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define INF 1001001001001001001ll
#define fcout cout << fixed << setprecision(12)

using namespace std;

typedef pair<int, int> P;

class CExceptionHandling {
public:
    static constexpr int kStressIterations = 0;

    static void generateTest(std::ostream& test) {
    }

    void solve(std::istream& cin, std::ostream& cout) {
        int N;
        cin >> N;
        vector<int> A(N), L(N + 1), R(N + 1);
        REP(i, N) cin >> A[i];

        REP(i, N) L[i + 1] = max(L[i], A[i]);
        REV(i, N - 1, 1) R[i - 1] = max(R[i], A[i]);

        REP(i, N) {
            cout << max(L[i], R[i]) << endl;
        }

    }
};


signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    std::istream& in(std::cin);
    std::ostream& out(std::cout);

    CExceptionHandling solver;
    solver.solve(in, out);
    return 0;
}


Measured memory_bytes: 6272
#include<iostream>
#include<queue>
#include<limits>
// #include<bits/stdc++.h>
#include<algorithm>
#include<vector>
#include<cmath>
#include<math.h>
#include<iomanip>  
#include<deque> 
#include<stack>
#include<string> 
#include<string.h>
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#define ll long long
#define tc(t)  while(t--)
#define V vector
#define Vp vector< pair<int,int> >
#define pb push_back
#define UM unordered_map
#define IT iterator
#define F first
#define S second
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define PQ priority_queue
#define _FI ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
using namespace std;

 char ar[140000];
vector<ll> SieveOfEratosthenes(ll n) 
{ 
  vector<ll> result;
    bool prime[n+1]; 
    memset(prime, true, sizeof(prime)); 
    int count=1;
    for (ll p=2; p*p<=n; p++) 
    { 
        if (prime[p] == true) 
        {  
            for (ll i=p*p; i<=n; i += p) 
                {
                  prime[i] = false; 
                }
            count++;
        } 
    } 
  
    for (ll p=2; p<=n; p++) 
       if (prime[p]) 
          {
            result.push_back(p);
          }
    return result;
}



vector<ll> Divisors (ll n)
{
  vector<ll> res;
  for(ll i=1;i<=sqrt(n);i++)
  {
    if(n%i==0)
    {
      if(n/i==i)
      {
        res.pb(i);
      }
      else
      {
        res.pb(i);
        res.pb(n/i);
      }
    }
  }

  return res;
}

int a[4][2]={ {1,0}, {1,-1}, {1,1}, {2,0} } ;
bool validPoint(int x,int y, int N)
{
    return (x>=0 && x<N && y>=0 && y<N);
}


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

  V<ll> v(n);
  forn(i,n)
  {
      cin>>v[i];
  }

  ll count=0;
  sort(v.begin(),v.end(),greater<ll>());

  for(int i=k;i<n;i++)
  {
    count=count+v[i];
  }
  cout<<count<<endl;
  return 0;
}












 // V<double> arr(2*n);
 //  V<double> proper;
 //  V<double> improper;
 //  double sum=0;
 //  for(int i=0;i<2*n;i++)
 //  {
 //      cin>>arr[i];
 //      sum+=arr[i];
 //      if(arr[i]-floor(arr[i])==0)
 //        proper.pb(arr[i]);
 //      else
 //        improper.pb(arr[i]);
 //  }


Measured memory_bytes: 4424
#include <iostream>
#include <vector>
#include <array>
#include <limits>

using namespace std;
typedef long long ll;

int main(){
    ll n, m;
    cin >> n >> m;
    vector<array<ll, 3>> edge(m);
    for(int i = 0; i < m; ++i){
        ll a, b, c;
        cin >> a >> b >> c;
        a--; b--;
        edge.at(i).at(0) = a;
        edge.at(i).at(1) = b;
        edge.at(i).at(2) = c;
    }

    vector<ll> dist(n, numeric_limits<ll>::min());
    vector<ll> prev(n, -1);
    dist.at(0) = 0;
    for(int i = 0; i < n - 1; ++i){
        for(int j = 0; j < m; ++j){
            const ll a = edge.at(j).at(0);
            const ll b = edge.at(j).at(1);
            const ll c = edge.at(j).at(2);
            if(dist.at(a) != numeric_limits<ll>::min() &
               dist.at(b) < dist.at(a) + c){
                dist.at(b) = dist.at(a) + c;
                prev.at(b) = a;
            }
        }
    }

    vector<bool> cycle(n, false);
    for(int j = 0; j < m; ++j){
        const ll a = edge.at(j).at(0);
        const ll b = edge.at(j).at(1);
        const ll c = edge.at(j).at(2);
        if(dist.at(a) != numeric_limits<ll>::min() &
            dist.at(b) < dist.at(a) + c){
            cycle.at(b) = true;
        }
    }

    for(int i = 0; i < n; ++i){
        for(int j = 0; j < m; ++j){
            const ll a = edge.at(j).at(0);
            const ll b = edge.at(j).at(1);
            if(cycle.at(a)){
                cycle.at(b) = true;
            }
        }
    }

    if(cycle.at(n - 1)){
        cout << "inf" << endl;
    }else{
        cout << dist.at(n - 1) << endl;
    }
    return 0;
}


Measured memory_bytes: 888
fun main(args:Array<String>) {
    maxNum = readLine()!!.toLong()
    val ans = getAns(0,0)
    println(ans)
}


var maxNum:Long = 0
var set = mutableSetOf<Long>()

fun getAns(flag:Int, subtotal:Long):Long {
    if(subtotal > maxNum) {
        return 0
    }


    var ans:Long = 0
    if(flag == 7) {
        ans = 1
    }
    for(i in listOf(3,5,7)) {
        var newFlag = flag
        if(i == 3) {
            newFlag = (flag or 1)
        }
        if(i == 5) {
            newFlag = (flag or 2)
        }
        if (i == 7) {
            newFlag = (flag or 4)
        }
        val ret = getAns(newFlag, subtotal * 10 + i)
        ans += ret
    }
    return ans
}

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

bool V[100];
int S[100];
int E[100];
vector<int> G[100];

void calc(int n, vector<int>* G, int& cnt) {
  V[n] = true;
  S[n] = cnt++;
  for (auto it = G[n].begin(); it != G[n].end(); ++it) {
    if (!V[(*it)]) {
      calc((*it), G, cnt);
    }
  }
  E[n] = cnt++; 
}

int main() {
  int n, u, k, v;
  cin >> n;

  for (int i = 0; i < n; ++i) {
    cin >> u >> k;
    --u;
    for (int j = 0; j < k; ++j) {
      cin >> v;
      G[u].push_back(v - 1);
    }
  }

  int cnt = 0;
  for (int i = 0; i < n; ++i) {
    if (V[i]) continue;
    calc(i, G, cnt);
  }

  for (int i = 0; i < n; ++i) {
    printf("%d %d %d\n", i + 1, S[i] + 1, E[i] + 1);
  }

  return 0;
}



Measured memory_bytes: 3248
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <ctype.h>
int main()
{
    int D;
    std::cin >> D;
    if(D==22){
      std::cout << "Christmas Eve Eve Eve" << std::endl;
    }
    if(D==23){
       std::cout << "Christmas Eve Eve" << std::endl;
    }
    if(D==24){
       std::cout << "Christmas Eve" << std::endl;
    }
    if(D==25){
       std::cout << "Christmas" << std::endl;
    }
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;

namespace ABC
{
    class ProgramA
    {
        static void Main(string[] args)
        {
            var n = long.Parse(Console.ReadLine());
            var list = Console.ReadLine().Split(" ").Select(x => int.Parse(x)).ToList();
            var dp = new int[n];
            dp[0] = 0;
            dp[1] = Math.Abs(list[1] - list[0]);

            for (var i = 2; i < n; i++)
            {
                dp[i] = Math.Min(Math.Abs(list[i] - list[i - 2]) + dp[i - 2], Math.Abs(list[i] - list[i - 1]) + dp[i - 1]);
            }

            Console.WriteLine(dp[n - 1]);
        }
    }
}


Measured memory_bytes: 35780
#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <string>
#include <numeric>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <tuple>

#define rep(i,n) for(ll i=0;i<n;i++)
#define dup(x,y) (((x)+(y)-1)/(y)) // dup * y >= x なる最小のdup.
using namespace std;
typedef long long ll;
using Graph = vector<vector<ll>>;
//	std::cout<<std::fixed<<std::setprecision(10);

int main() {
	string S;
	cin >> S;
	string w[7] = {"SUN","MON","TUE","WED","THU","FRI","SAT"};
	int ans = 0;
	rep(i, 7) {
		if(S==w[i]) {
			ans = i;
			break;
		}
	}
	
	cout << 7 - ans << endl; 

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
	int N,a,min;
	min=100000;
	cin>>N;
	for(int i = 0;i<N;i++){
	int counter =0;
	cin>>a;
		while(a%2==0){
			a /=2;
			counter++;
			}
		if(counter<min){
		min=counter;
		}
	}
	cout<<min<<endl;
}

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

#define SIZE_OF_ARRAY(array) sizeof(array)/sizeof(array[0])

int main() {
    int N, K;
    cin >> N >> K;
    int ans = 0;
    while(N > 0){
        N /= K;
        ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
N = int(input())
polls = {}
for i in range(N):
  poll = input()
  if poll in polls:
    polls[poll] += 1
  else:
    polls[poll] =1

max_vote_count = max(polls.values())

results = []

for poll in polls:
  if polls[poll] == max_vote_count:
    results.append(poll)

results.sort()
for res in results:
  print(res)

Measured memory_bytes: 92016
import java.util.*;

public class Main{
  public static void main(String[]args){
    Scanner sc = new Scanner(System.in);
    int N = Integer.parseInt(sc.nextLine());
    int[] val = new int[N*3];
    for(int i = 0; i < N*3; i++){
      val[i] = Integer.parseInt(sc.next());
    }
    Arrays.sort(val);
    
    long ans = 0;
    for(int i = N*3-2, j = 0; j < N; i-=2, j++){
      ans += val[i];
    }
    System.out.println(ans);
  }
}

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

#define ll long long
#define mod 1000000007
#define pii pair<ll,ll>

#define debug(a) { cout << #a << " = " << a << endl;}

void sep() {
    cout << "-------------BLOCK-----------------\n";
}

template<typename T>
void debugv(vector<T> arr) {
    for (auto t: arr)
        cout << t << " ";
    cout << "\n";
}

template<typename T>
void debugarr(T arr, int n) {
    for (int i=0;i<n;i++) cout << arr[i] << " ";
    cout << "\n";
}

const int maxn = 1e5+1;
ll arr[maxn], n, m, t, k;
unordered_map<ll,ll> u;

ll __min(ll a, ll b) {
    return a < b ? a : b;
}

ll __max(ll a, ll b) {
    return a > b ? a : b;
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    
    string s;
    cin>>s;
    if (s.back() == 's') cout << s << "es\n";
    else cout << s<< "s" << endl;
}


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

int main() {
  int N;
  cin >> N;
  vector<int> P(N);
  for (int i = 0; i < N; i++) {
    cin >> P.at(i);
    P.at(i)--;
  }
  int ans = 0;
  for (int i = 0; i < N; i++) {
    if (i == N - 1) {
      if (P.at(i) == i) ans++;
      continue;
    }
    if (P.at(i) == i && P.at(i + 1) == i + 1) {
      ans++, i++;
      continue;
    }
    if (P.at(i) == i) ans++;
  }
  cout << ans << "\n";
}

Measured memory_bytes: 3784
s = int(input())
mod = 10**9+7
ans = 0
def cmb(n, r, mod):
  if ( r<0 or r>n ):
    return 0
  r = min(r, n-r)
  return g1[n] * g2[r] * g2[n-r] % mod
mod = 10**9+7 #出力の制限
N = 3000
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル
for i in range( 2, N + 1 ):
  g1.append( ( g1[-1] * i ) % mod )
  inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
  g2.append( (g2[-1] * inverse[-1]) % mod )
for i in range(1,s//3 + 1):
  ans = ( ans+cmb(s-2*i-1,i-1,mod))%mod
print(ans)

Measured memory_bytes: 65536
import java.util.Scanner;

public class Main {

	void run(){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		while(n--!=0){
			int Y = sc.nextInt();
			int M = sc.nextInt();
			int D = sc.nextInt();
			System.out.println(huga(Y, M, D));
		}
	}

	int huga(int y, int m, int d){
		int ret = 0;
		//System.out.println("here");
		while(y != 1000){
			//System.out.println(y + ": " + m + ": " + d);
			if(m == 11){
				++y;
				m = 1;
			}
			if(d == 20 && m % 2 == 0 && y % 3 != 0){
				d = 1;
				++m;
			}
			if(d == 21){
				d = 1;
				++m;
			}
			++ret;
			++d;
		}
		return ret-2;
	}

	int foge(int y, int m, int d){
		if(y == 1000){
			return 0;
		}
		if(m == 10 && d == 19){
			return foge(y+1, 1, 1) + 1;
		}
		if(m % 2 == 1 && d == 19){
			return foge(y, m+1, 1) + 1;
		}
		if(m % 2 == 0 && d == 20){
			return foge(y, m+1, 1) + 1;
		}
		return foge(y, m, d+1) + 1;
	}
	public static void main(String[] args){
		new Main().run();
	}

}

Measured memory_bytes: 20392
#include<bits/stdc++.h>
#define ALL(c) (c).begin(),(c).end()
#define EACH(i,c) for(auto i=(c).begin();i!=(c).end();++i)
typedef long long ll;
using namespace std;

int main(){
	int H, W;
	cin >> H >> W;
	for(int i = 0; i < H; ++i){
		for(int j = 0; j < W; ++j){
			string s;
			cin >> s;
			if(s == "snuke"){
				cout <<  string(1,'A'+j) << i+1 << endl;
				return 0;
			}
		}
	}
}


Measured memory_bytes: 384
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <cstring>
#include <set>
 
using namespace std;
 
int main() {
	int n,x,t;
	cin >> n >> x >> t;
    int shou = n /x;
    int amari = n%x;
    int kaisu = amari==0 ? shou:shou+1;
    cout << kaisu * t << endl;
	return 0;
}

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

typedef long long int ll;

using namespace std;

ll dp[102][100002];

int main(){
    ll N, W, w, v;
    cin >> N >> W;
    dp[0][0] = 0;
    for(ll i=0; i<=101; i++){
        for(ll j=0; j<=1e5 + 1; j++){
            dp[i][j] = INT_MAX;
        }
    }
    for(ll i=1; i<=N; i++){
        cin >> w >> v;
        dp[i][0] = 0;
        if (i==1){
            for(ll j=1; j<=v; j++){
                if (w <= W){
                    dp[i][j] = w;
                }
            }
        }else{
            for(ll j=1; j<=1e5; j++){
                if (j < v){
                    dp[i][j] = min(dp[i-1][j], w);
                }
                if (j >= v && v <= 1e5){
                    if (dp[i-1][j-v]==INT_MAX){
                        continue;
                    }else{
                        dp[i][j] = min(dp[i-1][j-v] + w, dp[i-1][j]);
                    }
                }
            }
        }
    }

    ll max_value = -1;
    for(ll j=0; j<=1e5; j++){
        if (dp[N][j] <= W){
            max_value = j;
        }
    }
    cout << max_value << endl;
    return 0;
}

Measured memory_bytes: 79872
#include<iostream>
#include<algorithm>
#include<string>
#include<iomanip>
#include<vector>
#include<cstring>
#include<stack>
#include<cstdlib>
#include<cmath>

using namespace std;

int main()
{
	long long x;
	cin >> x;
	for (long long a =-100; a <= 1000; a++) {
		for (long long b = a-500; b <= a+500; b++) {
			if ((a * a * a * a * a - b * b * b * b * b) == x) {
				cout << a << " " << b << endl;
				return 0;
			}
		}
	}
}



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

using namespace std;

const int N_MAX = 100002;

int n, l;

int v[N_MAX];

int main()
{
    cin >> n >> l;
    for(int i = 1; i <= n; i++)
        cin >> v[i];
    int pos = -1;
    for(int i = 1; i < n; i++)
        if(v[i] + v[i + 1] >= l)
        {
            pos = i;
            break;
        }
    if(pos == -1)
    {
        cout << "Impossible\n";
        return 0;
    }
    cout << "Possible\n";
    for(int i = n - 1; i > pos; i--)
        cout << i << "\n";
    for(int i = 1; i <= pos; i++)
        cout << i << "\n";
    return 0;
}


Measured memory_bytes: 1152
#include<bits/stdc++.h>
#define M 200007
using namespace std;
int n,a[M],b[M],t,flag;
struct q{
	int a,b;
	bool operator<(q q)const{
		return q.b>b;
	}
}A[M];
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		scanf("%d%d",&A[i].a,&A[i].b);
	sort(A+1,A+n+1);
	for(int i=1;i<=n;i++){
		t+=A[i].a;
		if(t>A[i].b){
			flag=1;
			break;
		}
	}
	puts(flag?"No":"Yes");
	return 0;
}

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

int main(){
    int i,N,length;
    int bool=0;
    int count=0;
    int temp;
    char s[10];

    scanf("%s", s);
    length = strlen(s);

    if(length < 4 | length > 10){
        printf("WA\n");
        return 0;
    }

    bool = strncmp(&s[0], "A", 1);
    if(bool != 0){
        printf("WA\n");
        return 0;
    }

    for(i=2;i<length-1;i++){
        if(strncmp(&s[i], "C", 1) == 0){
            count++;
            temp = i;
        }
    }
    if(count != 1 ){
        printf("WA\n");
        return 0;
    }

    for(i=1;i<length;i++){
        if(i != temp){
            if(0 <= strncmp(&s[i],"a",1) && strncmp(&s[i],"z",1) <= 0 ){
            }
            else{
                printf("WA\n");
                return 0;
            }
        }
    }

    printf("AC\n");
    return 0;
}


Measured memory_bytes: 128
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<map>
#define SF scanf
#define PF printf
#define MAXN 100010
using namespace std;
typedef long long ll;
ll ans;
int n;
struct node{
    int a1,a2,a3,a4;
    node() {}
    node(int aa1,int aa2,int aa3,int aa4):a1(aa1),a2(aa2),a3(aa3),a4(aa4) {}
    bool operator <(const node &a) const {
        if(a1!=a.a1)
            return a1<a.a1;
        if(a2!=a.a2)
            return a2<a.a2;
        if(a3!=a.a3)
            return a3<a.a3;
        return a4<a.a4;
    }
    bool operator ==(const node &a) const{
        if(a1==a.a1&&a2==a.a2&&a3==a.a3&&a4==a.a4)
            return 1;
        return 0;
    }
}t[MAXN];
map<node,ll> used;
void solve(int b1,int b2,int b3,int b4){
    used[node(b1,b2,b3,b4)]++;
}
ll check(node x,node y){
    ll res=0;
    if(x==y)
        res++;
    int tx=y.a1;
    y.a1=y.a2;y.a2=y.a3;y.a3=y.a4;y.a4=tx;
    if(x==y)
        res++;
    tx=y.a1;
    y.a1=y.a2;y.a2=y.a3;y.a3=y.a4;y.a4=tx;
    if(x==y)
        res++;
    tx=y.a1;
    y.a1=y.a2;y.a2=y.a3;y.a3=y.a4;y.a4=tx;
    if(x==y)
        res++;
    return res;
}   
void count(int b1,int b2,int b3,int b4,int b5,int b6,int b7,int b8){
    //PF("{%d %d %d %d %d %d %d %d}\n",b1,b2,b3,b4,b5,b6,b7,b8);
    node x1=node(b1,b2,b6,b5);
    node x2=node(b2,b3,b7,b6);
    node x3=node(b3,b4,b8,b7);
    node x4=node(b4,b1,b5,b8);
    node sp1=node(b4,b3,b2,b1);
    node sp2=node(b5,b6,b7,b8);
    ll res1=used[x1];
    ll res2=used[x2];
    ll res3=used[x3];
    ll res4=used[x4];
    res1=res1-check(sp1,x1)-check(sp2,x1);
    res2=res2-check(sp1,x2)-check(sp2,x2)-check(x1,x2);
    res3=res3-check(sp1,x3)-check(sp2,x3)-check(x1,x3)-check(x2,x3);
    res4=res4-check(sp1,x4)-check(sp2,x4)-check(x1,x4)-check(x2,x4)-check(x3,x4);
    ans+=res1*res2*res3*res4;
    //PF("{%lld %lld %lld %lld %lld}\n",used[x1],res1,check(sp1,x1),check(sp2,x1),res4);
}
int main(){
    SF("%d",&n);
    for(int i=1;i<=n;i++){
        SF("%d%d%d%d",&t[i].a1,&t[i].a2,&t[i].a3,&t[i].a4);
        solve(t[i].a4,t[i].a3,t[i].a2,t[i].a1);
        solve(t[i].a3,t[i].a2,t[i].a1,t[i].a4);
        solve(t[i].a2,t[i].a1,t[i].a4,t[i].a3);
        solve(t[i].a1,t[i].a4,t[i].a3,t[i].a2);
    }
    for(int i=1;i<=n;i++)
        for(int j=i+1;j<=n;j++){
            count(t[i].a1,t[i].a2,t[i].a3,t[i].a4,t[j].a4,t[j].a3,t[j].a2,t[j].a1); 
            count(t[i].a1,t[i].a2,t[i].a3,t[i].a4,t[j].a3,t[j].a2,t[j].a1,t[j].a4); 
            count(t[i].a1,t[i].a2,t[i].a3,t[i].a4,t[j].a2,t[j].a1,t[j].a4,t[j].a3); 
            count(t[i].a1,t[i].a2,t[i].a3,t[i].a4,t[j].a1,t[j].a4,t[j].a3,t[j].a2); 
        }
    PF("%lld",ans/3ll);
}

Measured memory_bytes: 80128
#include <iostream>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <cstring>

using namespace std;

int main()
{
    string s;   cin >> s;
    string ans;
    
    ans += s.front();
    ans += to_string(s.size() - 2);
    ans += s.back();

    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
    int a;
    cin>> a;
    char c[a];
    for(int n=0; n<a; n++)
    {
        cin>>c[n];
        if(c[n]=='Y')
        {
            cout<<"Four"<<"\n";
            return 0;
		}
    }
    cout<< "Three" <<"\n";
    return 0;
}

Measured memory_bytes: 256
//
// Created by Tetsuya Shiota on 2019-04-13.
//

#include <algorithm>
#include <bitset>
#include <cstdio>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#define REP(i, b, n) for (Int i = b; i < Int(n); i++)
#define rep(i, n) REP(i, 0, n)
#define FOR(e, o) for (auto &&e : o)
#ifdef LOCAL
#define pp(x) cerr << __LINE__ << ' ' << #x << " = " << (x) << endl
#define dump(x)                                                                \
  cerr << __LINE__ << ' ' << #x << " : ";                                      \
  FOR(e, x) cerr << e << ' ';                                                  \
  cerr << endl;
#else
#define pp(x)
#define dump(x)
#endif

using namespace std;

using Int = long long;
using vi = vector<Int>;
using vvi = vector<vi>;
using pii = pair<Int, Int>;

template <typename T> void reverse(vector<T> &v) {
  reverse(v.begin(), v.end());
}

template <typename T> void sort(vector<T> &v) { sort(v.begin(), v.end()); }
template <typename T> void rsort(vector<T> &v) { sort(v.rbegin(), v.rend()); }

template <typename T> T sum(const vector<T> &v) {
  return accumulate(v.begin(), v.end(), T(0));
}

template <class T> void update_max(T &a, const T &b) { a = max(a, b); }
template <class T> bool update_min(T &a, const T &b) { a = min(a, b); }

struct BoolName : numpunct<char> {
  string t, f;
  BoolName(string t = "Yes", string f = "No") : t(t), f(f) {}
  string do_truename() const { return t; }
  string do_falsename() const { return f; }
};

class Solver {
public:
  Solver() {}
  int N;
  vi H;
  int cnt =0;
  void input() {
    cin >> N;
    H = vi(N);
    FOR(e, H)cin >> e;
  }
  void solve() {
    Int maxi = 0;
    FOR(e, H){
      if(maxi <= e)cnt++;
      update_max(maxi, e);
    }

  }
  void output(){
    cout << cnt <<endl;

  };
};

int main() {
  cin.tie(0);
  ios::sync_with_stdio(0);
  cout << fixed << setprecision(15) << boolalpha;
  cout.imbue(locale(cout.getloc(), new BoolName));
#ifdef LOCAL
  while (1) {
    Solver s;
    s.input();
    if (cin.eof())
      break;
    s.solve();
    s.output();
  }
#else
  Solver s;
  s.input();
  s.solve();
  s.output();
#endif
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
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; }
const ll INF=1LL<<60;
int main(){
    ll n,p;cin >> n >> p;
    string s;cin >> s;
    ll ans=0;
    if(p==2){
        for(int i=0;i<n;i++){
            int k=s[i]-'0';
            if(k%2==0){
                ans+=i+1;
            }
        }
        cout << ans << endl;
        return 0;
    }
    if(p==5){
        for(int i=0;i<n;i++){
            int k=s[i]-'0';
            if(k%5==0){
                ans+=i+1;
            }
        }
        cout << ans << endl;
        return 0;
    }
    vector<ll> a(n+1);
    a[0]=1;
    for(int i=1;i<=n;i++){
        a[i]=a[i-1]*10;
        a[i]%=p;
    }
    vector<ll> c(n+1);
    for(int i=0;i<n;i++){
        int k=s[i]-'0';
        c[i+1]=(c[i]*10%p+k)%p;
    }
    for(int i=0;i<=n;i++){
        c[i]*=a[n-i];
        c[i]%=p;
    }
    vector<ll> b(p);
    for(int i=0;i<=n;i++){
        b[c[i]]++;
    }
    for(int i=0;i<p;i++){
        ans+=b[i]*(b[i]-1)/2;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3716
from collections import deque
n,m=map(int,input().split())
e=[[] for _ in range(n+1)]
lndmrk=[-1]*(n+1)
for i in range(m):
    a,b=map(int,input().split())
    e[a].append(b)
    e[b].append(a)
q=deque()
lndmrk[1]=0
q.append(1)
while(len(q) !=0):
    v=q.popleft()
    for i in e[v]:
        if lndmrk[i]==-1:
            lndmrk[i]=v
            q.append(i)
f=True
for i in range(2,n+1):
    if lndmrk[i]==-1:
        f=False
        break
if f:
    print('Yes')
    for i in range(2,n+1):
        print(lndmrk[i])
else:
    print('No')


Measured memory_bytes: 34244
n,k=gets.split.map(&:to_i)
a=[]
min=10**9+1
n.times{a.push(gets.to_i)}
a.sort!
0.upto(n-k) {|i| min=a[i+k-1]-a[i] if min>a[i+k-1]-a[i]}
p min


Measured memory_bytes: 4016
import java.awt.*;
import java.awt.geom.*;
import java.io.*;

import java.util.*;
class Main {


	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while(true) {
			int h = sc.nextInt();
			int w = sc.nextInt();
			if(h == 0 && w == 0) break;
			for(int i = 0; i < h; i++) {
				for(int j = 0; j < w; j++) {
					System.out.print("#");
				}
				System.out.println();
			}
			System.out.println();
		}
	}
}

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

int main(){
    int x[6];
    rep(i,5)
    cin>>x[i];
    rep(i,5){
        if(x[i]==0){
            cout<<i+1<<endl;
        }
    }
}

Measured memory_bytes: 3632
Scanf.scanf "%d" (fun n ->
    let a = Array.init n (fun _ -> Scanf.scanf " %d" (fun a -> a)) in
    let rec gcd a b = if b = 0 then a else gcd b (a mod b) in

    let rec loop i acc =
        if i = n then acc else loop (i + 1) (gcd acc a.(i))
    in
    loop 1 a.(0) |> Printf.printf "%d\n"
)

Measured memory_bytes: 5120
import java.util.*;
import java.io.*;

class Main {

	void solve () {

		int a = in.nextInt();
		System.out.println(a*a);
		
	}

	public static PrintWriter out = new PrintWriter(System.out);
	public static Scanner in = new Scanner(System.in);
	public static void main(String[] args) {
		new Main().solve();
		out.flush();
	}

}

Measured memory_bytes: 23764
from collections import defaultdict

n = int(input())
s = input()
d = defaultdict(int)
for i in range(n):
    d[s[i]] += 1
dd = defaultdict(int)
ret = - float('inf')
for i in range(n):
    dd[s[i]] += 1
    cnt = 0
    for key in dd.keys():
        if d[key] - dd[key] > 0:
            cnt += 1
    ret = max(ret, cnt)
print(ret)


Measured memory_bytes: 3316
#include <iostream>
#include <climits>
const int VMAX = 100001;

int main() {
  int n,w;
  std::cin >> n >> w;
  long long dp[VMAX];
  long long dpn[VMAX];
  for (int i=0; i<VMAX; i++){
    dp[i] = LLONG_MAX / 2;
    dpn[i] = LLONG_MAX / 2;
  }
  
  long long nw;
  long long nv;

  dp[0] = 0;
  for(int i=0; i<n; i++){
    std::cin >> nw >> nv;
    for(int j=0; j<VMAX; j++){
      dpn[j] = dp[j];
      if (j >= nv)
        dpn[j] = std::min(dpn[j], dp[j-nv]+nw);
    }
    for(int j=0;j<VMAX;j++)
      dp[j] = dpn[j];
  }
  long long ans = 0;
  for(int i=0; i<VMAX; i++){
    if (dp[i] <= w)
      ans = i;
  }
  
  std::cout << ans << std::endl;
}

Measured memory_bytes: 1792
#include<iostream>
#include<string>
#include<cmath>
using namespace std;

int main(){
	string S,T;
	cin >> S;
	cin >> T;
	int cmp[S.length()];
	for(int i=0;i<S.length();i++){
		cmp[i]=0;
		for(int k=0;k<S.length();k++){
			cmp[i]+=abs(S[(k+i)%S.length()]-T[k]);
		}
	}
	for(const int& c : cmp){
		if(c==0){
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
	return 0;
}


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

int main()
{
    int N; cin >> N;
    if ( N / 100 == 7 | N % 100 / 10 == 7 | N % 10 == 7 ) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 3628
#define _USE_MATH_DEFINES
#include <iostream>
#include <algorithm>
#include <queue>
#include <stack>
#include <deque>
#include <climits>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
//#include <tuple>

#define INF INT_MAX>>1 
#define SIZE 100010
#define MOD 1000000007
#define rep(i, n) for(int i=0; i<(int)(n); i++)
#define rep2(i, from, to) for(int i=(from); i<(int)(to); i++)
#define all(obj) (obj).begin(), (obj).end()
#define lpair pair<ll, ll>
#define vint vector<ll>
#define vinput(name) for(int i=0; i<(int)(name.size()); i++) cin >> name[i];
#define voutput(name) for(int i=0; i<(int)(name.size()); i++) cout << name[i] << endl;
typedef long long ll;

using namespace std;

ll ans = INF;
ll h, w, k;
vector<vint> s;

void check(int area, vector<vint>& count, int revc){
	vector<ll> white(area+1);
	ll revcount = 0;
	rep(j, w){
		rep(i, area+1){
			white[i] += count[i][j];
			if(white[i] > k){
				fill(white.begin(), white.end(), 0);
				revcount++;
				if(ans <= revcount+revc) return;
				j--;
				break;
			}
		}
	}
	ans = min(ans, revcount + revc);
	//cout << ans << endl;
}

void bfs(int depth, int area, vector<vint>& count, bool flag=false, int revc=0){//
	if(ans <= revc) return;
	if(depth == h){
		if(flag == true){
			area--;
			revc--;
		}
		check(area, count, revc);
		return;
	}
	rep(i, w){
		count[area][i] += s[depth][i];
	}
	bfs(depth+1, area+1, count, true, revc+1); //分割
	bfs(depth+1, area, count, false, revc); //分割しない
	rep(i, w){
		count[area][i] -= s[depth][i];
	}
	return;
}

int main(void){
	cin >> h >> w >> k;
	s.resize(h);
	rep(i, h){
		string str; cin >> str;
		s[i].resize(w);
		rep(j, w){
			s[i][j] = str[j]-'0';
		}
	}
	vector<vint> tmp(h);
	rep(i, h) tmp[i].resize(w);
	bfs(0, 0, tmp);
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 384
local n=io.read("n")
local a,a_map={},{}
for i=1,n do
    local x=io.read("n")
    a[i]=x
    a_map[x]=(a_map[x] or 0)+1
end
table.sort(a)

local counter=0
for i=n,2,-1 do
    local p=1
    while a[i]>=p do
        p=p*2
    end
    if a_map[a[i]] and a_map[a[i]]>0 then
        a_map[a[i]]=a_map[a[i]]-1
        if a_map[p-a[i]] and a_map[p-a[i]]>0 then
            a_map[p-a[i]]=a_map[p-a[i]]-1
            counter=counter+1
        end
    end
end
print(counter)

Measured memory_bytes: 17500
#include <bits/stdc++.h>
using namespace std;
#ifdef DEBUG
#define FPEN freopen("in.txt", "r", stdin);
#define TEST(...)                                                              \
    { printf("! "), printf(__VA_ARGS__); }
#else
#define TEST(...)
#define FPEN
#endif
const int maxn = 200009;
typedef long long i64;
typedef pair<i64, i64> pi64;
typedef pair<int, int> pi;
const i64 MOD = 119 << 23 | 1;
class {
  public:
    void solve() {
        i64 n, m;
        cin >> n >> m;
        i64 sum = 0;
        for (int i = 0; i < m; ++i) {
            int t;
            cin >> t;
            sum += t;
        }
        n -= sum;
        if (n >= 0) {
            cout << n << '\n';
        } else {
            cout << -1 << "\n";
        }
    }
} NSPACE;
int main() {
    // FPEN;
    ios_base::sync_with_stdio(false);
    cout.tie(0);
    cin.tie(0);
    NSPACE.solve();
}

Measured memory_bytes: 3632
from collections import defaultdict
import sys
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9 + 7
eps = 10**-7
input = sys.stdin.readline


def inp():
    return int(input())


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


X = inp()
MAX = 5000
for a in range(-MAX, MAX + 1):
    for b in range(-MAX, MAX + 1):
        tmp = pow(a, 5) - pow(b, 5)
        if X == tmp:
            print(a, b)
            exit()


assert False


Measured memory_bytes: 68700
import java.util.Scanner;
public class Main {
	public static void main(String args[]) {
	Scanner sc=new Scanner(System.in);
	String S=sc.next();
	String T=sc.next();
	String t=T.substring(0,S.length());
	if(S.equals(t)&&T.length()==(S.length()+1)) {
		System.out.println("Yes");
	}
	else {
		System.out.println("No");
	}
	}
}

Measured memory_bytes: 35616
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using ll = long long;

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

  for (int i = 0; i < m; i++)
  {
    int a, b;
    cin >> a >> b;
    --a;
    --b;
    d.merge(a, b);
  }

  int cnt = d.groups().size();
  int ans = cnt - 1;
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 8904
#include <stdio.h>
#include <string.h>
#include <math.h>
int main()
{
    unsigned long long int max;
    int i,j,k;
    int tmp;
    int n;
    int m;
    int cnt = 0;
    unsigned long long int a[20000];
    scanf("%d",&n);
    for (i = 0; i < n; i++) {
        scanf("%lld",&a[i]);
    }
    for (i = 0; i < n-1; i++) {
        for (j = n-1; j > i; j--) {
            if(a[j-1] > a[j]) {
                tmp = a[j-1] ; a[j-1] = a[j]; a[j] = tmp;
                cnt++;
            }
        }
    }
    for(i = 0; i < n-1; i++) 
        printf("%d ",a[i]);
    printf("%d\n",a[n-1]);
    printf("%d\n",cnt);
    return 0;
}

Measured memory_bytes: 608
// clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define forever for (;;)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
template<typename A> using V = std::vector<A>;
template<typename A> using F = std::function<A>;
template<typename A, typename B> using P = std::pair<A, B>;
using pii = P<int, int>;
using vi = V<int>;
using vd = V<double>;
using vs = V<std::string>;
using vpii = V<pii>;
using vvi = V<vi>;
using vvpii = V<vpii>;
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = acos(-1);
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
template<typename T> std::istream &operator>>(std::istream &is, std::vector<T> &v) { for (T &x : v) is >> x; return is; }
template<typename A, typename B> std::istream &operator>>(std::istream &is, std::pair<A, B> &p) { is >> p.first; is >> p.second; return is; }
using namespace std;
// clang-format on

main {
  int n;
  while (cin >> n, n) {
    vpii v(n);
    cin >> v;
    sort(all(v), [](auto &a, auto &b) {
      if (a.second != b.second) return a.second < b.second;
      return a.first < b.first;
    });
    int got = 0;
    rep(i, n) {
      got += v[i].first;
      if (v[i].second < got) {
        cout << "No" << endl;
        goto next;
      }
    }
    cout << "Yes" << endl;
  next:;
  }
}

Measured memory_bytes: 2996
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <queue>
#include <string>
#include <set>
#include <bitset>
#include <unordered_map>

using namespace std;
using ll = long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;
template <class T>
using Vvec = vector<vector<T> >;

int main()
{
    int M, K;
    cin >> M >> K;

    if(K == 0){
        for(int i=0; i<(1<<M); i++) cout << i << " " << i << " ";
        cout << endl;
        return 0;
    }
    else if(K >= (1<<M) || M <= 1){
        cout << -1 << endl; return 0;
    }

    set<int> st;
    for(int i=0; i<(1<<M); i++) st.insert(i);

    for(int i=0; i<(1<<(M-2)); i++){
        int a = *st.begin();
        int b = K^a;
        st.erase(a); st.erase(b);
        int c = *st.begin();
        int d = K^c;
        st.erase(c); st.erase(d);
        printf("%d %d %d %d %d %d %d %d ", a, b, c, d, b, a, d, c);
    }
    cout << endl;
}

Measured memory_bytes: 7936
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cassert>
#include <complex>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <sstream>
#include <ctime>
#include <cctype>
#include <set>
#include <map>
#include <queue>
#include <bitset>
#include <deque>
#include <stack>
#include <memory.h>
using namespace std;
#define ll long long
vector<string> sth;
map<string,int> mp;
map<string,bool> hav;
int n,m,mx;
int main()
{
	cin>>n;
	for(int i=0;i<n;i++){
		string s;
		cin>>s;
		if(hav[s]==0){
			hav[s]=1;
			sth.push_back(s);
			mp[s]++;
		}
		else{
			mp[s]++;
		}
	}
	cin>>m;
	for(int j=0;j<m;j++){
		string s;
		cin>>s;
		if(hav[s]==0){
			hav[s]=1;
			sth.push_back(s);
			mp[s]--;
		}
		else{
			mp[s]--;
		}
	}
	for(int i=0;i<sth.size();i++){
		string s=sth[i];
		if(mp[s]>mx){
			mx=mp[s];
		}
	}
	cout<<mx;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>

using namespace std;

int n,m,num[4]= {0};
bool ans=1,used[4]= {0};

int main() {
	scanf("%d %d",&n,&m);
	for(int i=1,s,c; i<=m; ++i) {
		scanf("%d %d",&s,&c);
		if(used[s-1] && c!=num[s-1]) ans=0;
		else num[s-1]=c,used[s-1]=1;
	}
	if(ans && !(!num[0] && used[0] && n!=1)) {
		if(!num[0]) {
			if(n==1) puts("0");
			else {
				num[0]=1;
				for(int i=0; i<n; ++i) putchar(num[i]+48);
				putchar('\n');
			}
		} else {
			for(int i=0; i<n; ++i) putchar(num[i]+48);
			putchar('\n');
		}
	} else puts("-1");
	return 0;
}

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


struct List{
    int prev = -1, val, next = -1;
};

int main(){
    int n, x, a = 0, b = 0, head = -1, tail = -1;
    string command;
    cin >> n;
    List L[n];
    for (int i = 0; i < n; i++) {
        cin >> command;
        if (command == "insert") {
            cin >> x;
            L[b].val = x;
            if (a == 0) { tail = b; }
            else { L[b].next = head; L[L[b].next].prev = b;}
            head = b; a++; b++;
        }
        else if (command == "delete") {
            cin >> x; int c = head;
            for (int j = 0; j < a; j++) {
                if (L[c].val == x) {
                    if (a == 1) { head = -1; tail = -1; }
                    else if (c == head) { L[L[head].next].prev = -1; head = L[head].next; }
                    else if (c == tail) { L[L[tail].prev].next = -1; tail = L[tail].prev; }
                    else { L[L[c].next].prev = L[c].prev; L[L[c].prev].next = L[c].next; }
                    a--; break;
                }
                c = L[c].next;
            }
        }
        else if (command == "deleteFirst") {
            L[L[head].next].prev = -1;
            head = L[head].next;
            a--;
        }
        else if (command == "deleteLast") {
            L[L[tail].prev].next = -1;
            tail = L[tail].prev;
            a--;
        }
    }
    int d = head;
    for (int k = 0; k < a; k++) {
        cout << L[d].val;
        if (k == a-1) cout << endl;
        else cout << " ";
        d = L[d].next;
    }
    return 0;
}


Measured memory_bytes: 26540
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines

def main():
    N = int(readline())
    A = [[int(i) for i in readline().split()] for _ in range(N)]

    via_min = [[10**15] * N for _ in range(N)]

    ans = 0
    for i in range(N-1):
        for j in range(i+1,N):
            d = A[i][j]
            flag = True
            for k in range(N):
                if k == i or k == j:
                    continue
                
                tmp = A[i][k] + A[k][j]
                if tmp < d:
                    print(-1)
                    exit()
                
                elif tmp == d:
                    flag = False
                    break
            if flag:
                ans += d
    
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 43228
/* tempate
 *
 *
 */

#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <queue>
#include <deque>
#include <list>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>

using namespace std;


#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repr(i,n) for(int (i)=(n); (i)>=(0); (i)--)
#define SIZE(x) ((int)(x).size())
#define GCD(a, b) int gcd(int a,int b){return b?gcd(b,a%b):a;}
#define QP(a, b) int qp(int a,ll b){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)
#define all(v) (v).begin(),(v).end()


template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
template<typename A, size_t N, typename T>
void FILL(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

typedef vector<int, int> vint;
typedef pair<int,int> pint;
typedef vector<pint>vpint;
typedef long long ll;

int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1LL << 60;
const ll MOD = 1000000007LL;


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll a; cin >> a;
    string s; cin >> s;
    if(a >= 3200) cout << s;
    else cout << "red";
    cout << endl;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#define N 101
#define INF 10000000
#define NIL -1
#define WHITE 1
#define BLACK 2

int main()
{
  int n, i, j, u, v, k, c, mincost=0;
  int G[N][N], d[N], pi[N], color[N];

  scanf("%d", &n);

  for(i = 0; i < n; i++){
    for(j = 0; j < n; j++){
      G[i][j] = INF;
    }
  }
  
  for(i = 0; i < n; i++){
    scanf("%d%d", &u, &k);
    for(j = 0; j < k; j++){
      scanf("%d %d", &v, &c);
      G[u][v] = c;
    }
  }

  /* ????????? */
  for(i = 0; i < n; i++){
    d[i] = INF;
    pi[i] = NIL;
    color[i] = WHITE;
  }
  
  d[0] = 0;
  
  /* ????????????????????? */
  while(1){
    mincost = INF;
    for(i = 0; i < n; i++){
      if(color[i] != BLACK && d[i] < mincost){
	mincost = d[i];
	u = i;
      }
    }
    
    if(mincost == INF) break;
    
    color[u] = BLACK;
    for(i = 0; i < n; i++){
      if(d[i] > d[u] + G[u][i]){
      	d[i] = d[u] + G[u][i];
      	pi[i] = u;
      }
    }
  }

  for(i = 0; i < n; i++){
    printf("%d %d\n", i, d[i]);
  }

  return 0;
}

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

int main(){
  int a, b; cin >> a >> b;
  
  int count = 0;
  for(int i = a; i <= b; i++){
    if(i % 10 == i / 10000 && (i / 10) % 10 == (i / 1000) % 10) count++;
  }
  cout << count << endl;
}


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

using namespace std;

using ll = long long;

int main() {
    int n;
    ll x, a;
    cin >> n >> x;
    vector<ll> input;
    for (int i = 0; i < n; ++i) {
        cin >> a;
        input.push_back(a);
    }
    ll count = 0;
    for (int i=0; i<input.size()-1; ++i) {
        ll tempSum = input[i]+input[i+1];
        if (tempSum > x) {
            ll eat = tempSum-x;
            if (eat > input[i+1]) {
                input[i] -= eat-input[i+1];
                input[i+1] = 0;
            } else {
                input[i+1] -= eat;
            }
            count += eat;
        }
    }
    cout << count << endl;
}


Measured memory_bytes: 1400
a,b,c,d = map(int,input().split())
ac = a*c
ad = a*d
bc = b*c
bd = b*d

if ac>ad and ac>bc and ac>bd:
  print(ac)
elif ad >bc and ad>bd and ad>ac:
  print(ad)
elif bc>ac and bc>ad and bc>bd:
  print(bc)
else:
  print(bd)

Measured memory_bytes: 61648
#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long ll;

int main() {
    ll x;
    cin >> x;
    ll ans= ((x+10)/11)*2;
    if((x-1)%11 < 6) cout << ans-1 << endl;
    else cout << ans << endl;
}

Measured memory_bytes: 256