akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repi(i, s, n) for (int i = (s); i < (n); i++)
#ifdef LOCAL
#define INPUT_FILE                              \
  ifstream in("atcoder-problems/abc098_b.txt"); \
  cin.rdbuf(in.rdbuf());
#else
#define INPUT_FILE
#endif
#define CIN_OPTIMIZE \
  cin.tie(0);        \
  ios::sync_with_stdio(false);
typedef pair<int, int> P;
typedef long long ll;
const int INF = 100100100;
const ll LINF = 1e18 + 100;
const int MOD = 1e9 + 7;

int main() {
  INPUT_FILE CIN_OPTIMIZE;

  int N;
  cin >> N;
  string S;
  cin >> S;

  int ans = 0;
  repi(i, 1, N) {
    int tmp = 0;
    map<char, int> l;
    map<char, int> r;
    string ls = S.substr(0, i);
    string rs = S.substr(i, N);
    rep(j, N) {
      if (ls.size() > j) l[ls[j]]++;
      if (rs.size() > j) r[rs[j]]++;
    }
    for (auto kv : l) {
      if (r.find(kv.first) != r.end()) tmp++;
    }
    ans = max(tmp, ans);
  }

  cout << ans<< endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#define NIL NULL
 
struct node{
 
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
 
typedef struct node * Node;
  
Node root;
 
void insert(int k){
 
  Node y = NIL;
  Node x = root;
  Node z;
 
  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;
   
  while(x != NIL){
     
    y = x;
     
    if(z->key < x->key) x = x->left;
    else  x = x->right;
  }
   
  z->parent = y;
   
  if( y ==  NIL ) root = z;
  else if( z->key < y->key ) y->left = z;
  else  y->right = z;
   
   
}
 
void inorder(Node u){
 
  if(u->left != NIL) inorder(u->left);
 
  printf(" %d",u->key);
 
  if(u->right != NIL) inorder(u->right);
}
void preorder(Node u){
 
  printf(" %d",u->key);
   
  if(u->left != NIL) preorder(u->left);
  if(u->right != NIL) preorder(u->right);
   
}
 
 
int main(){
  int n, i, x;
  char com[20];
  scanf("%d", &n);
 
  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
    
    if ( com[0] == 'i' ){
      scanf("%d", &x);
       insert(x);
    } else if ( com[0] == 'p' ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
  }
 
  return 0;
}



Measured memory_bytes: 25164
#include <iostream>
using namespace std;
#include <string>
#include <vector>
#include <algorithm>
#include <map>

int main(int argc, char *argv[])
{
	int a;
	string s;

	cin >> a >> s;

	cout << ((a<3200) ? "red" : s) << endl;
	return 0;
}



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

int main(){
    int n;
    cin >> n;
    int a[n+1];
    int b[n+1];
    int c[n+1];
    for(int i = 1; i <= n; i++){
        cin >> a[i];
    }
    b[1] = a[1];
    for(int i = 2; i <= n; i++){
        b[i] = max(b[i-1], a[i]);
    }
    c[n] = a[n];
    for(int i = n-1; i >= 1; i--){
        c[i] = max(c[i+1], a[i]);
    }
    cout << c[2] << endl;
    for(int i = 2; i <= n-1; i++){
        cout << max(b[i-1], c[i+1]) << endl;
    }
    cout << b[n-1] << endl;
    return 0;
}

Measured memory_bytes: 3968
//g++  7.4.0

#include <iostream>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    ll T; cin>>T;
    while(T--)
    {
        ll N; cin>>N;
        ll ans = 0;
        ll l[N];
        ll r[N];
        ll done[N] = {0};
        vector<vector<pair<ll,ll>>> t1(N + 5);
        vector<vector<pair<ll,ll>>> t2(N + 5);
        
        for(ll i=0;i<N;++i)
        {
            ll K,L,R; cin>>K>>L>>R;
            if(L > R)
                t1[K].push_back({L - R,i});
            else if(R > L)
                t2[K + 1].push_back({R - L,i});
                
            l[i] = L;
            r[i] = R;
        }
        
        set<pair<ll,ll>> s;
        for(ll i=N;i>0;--i)
        {
            for(ll j=0;j<t1[i].size();++j)
                s.insert({t1[i][j].first,t1[i][j].second});
            
            if(!s.empty())
            {
                auto it = s.end();
                it--;
                s.erase({it->first,it->second});
                done[it->second] = 1;
            }
        }
        
        s.clear();
        
        for(ll i=1;i<=N;++i)
        {
            for(ll j=0;j<t2[i].size();++j)
                s.insert({t2[i][j].first,t2[i][j].second});
            
            if(!s.empty())
            {
                auto it = s.end();
                it--;
                s.erase({it->first,it->second});
                done[it->second] = 1;
            }
        }
        
        /*for(ll i=1;i<=N;++i)
        {
            cout<<i<<" "<<t1[i].size()<<endl;
        }
        
        for(ll i=0;i<N;++i)
            cout<<done[i]<<" ";
        cout<<endl;*/
        
        for(ll i=0;i<N;++i)
        {
            if(done[i])
                ans += max(l[i],r[i]);
            else
                ans += min(l[i],r[i]);
        }
        
        
        cout<<ans<<endl;
    }
}

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

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

Measured memory_bytes: 764
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
    public static void main(String args[]) throws Exception {
	// 2020/2/24 T or T
	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	String strArray[] = br.readLine().split(" ");
	int N, A, B;
	N = Integer.parseInt(strArray[0]);
	A = Integer.parseInt(strArray[1]);
	B = Integer.parseInt(strArray[2]);
	if (N * A < B)
	    System.out.println(N * A);
	else
	    System.out.println(B);
    }
}

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

namespace ConsoleApplication2
{
    class Program
    {
        static void Main(string[] args)
        {

            //それぞれの行列の長さを読取。
            string strNML = Console.ReadLine();
            string[] strNMLArray = strNML.Split(' ');
            int intN = int.Parse(strNMLArray[0]);
            int intM = int.Parse(strNMLArray[1]);
            int intL = int.Parse(strNMLArray[2]);

            //行列Aを読取。
            int[,] matrixA = new int[intN, intM];
            for (int nIndex = 0; nIndex < intN; nIndex++)
            {
                string strNM = Console.ReadLine();
                string[] strNMArray = strNM.Split(' ');
                for (int mIndex = 0; mIndex < intM; mIndex++)
                {
                    matrixA[nIndex, mIndex] = int.Parse(strNMArray[mIndex]);
                }
            }

            //行列Bを読取。
            int[,] matrixB = new int[intM, intL];
            for (int mIndex = 0; mIndex < intM; mIndex++)
            {
                string strML = Console.ReadLine();
                string[] strMLArray = strML.Split(' ');
                for (int lIndex = 0; lIndex < intL; lIndex++)
                {
                    matrixB[mIndex, lIndex] = int.Parse(strMLArray[lIndex]);
                }
            }

            //行列Cを生成。
            long[,] matrixC = new long[intN, intL];
            long ingSum = 0;
            for (int rowC = 0; rowC < intN; rowC++)
            {
                for (int colC = 0; colC < intL; colC++)
                {
                    for (int mIndex = 0; mIndex < intM; mIndex++)
                    {
                        ingSum += matrixA[rowC, mIndex] * matrixB[mIndex, colC];
                    }
                    matrixC[rowC, colC] = ingSum;
                    ingSum = 0;
                }
            }

            //出力
            for (int row = 0; row < intN; row++)
            {
                for (int col = 0; col < intL; col++)
                {
                    if (col < intL - 1)
                    {
                        Console.Write("{0} ", matrixC[row, col]);
                    }
                    else
                    {
                        Console.Write(matrixC[row, col]);
                    }
                }
                Console.WriteLine();
            }
        }
    }

}



Measured memory_bytes: 18036
#include <stdio.h>
#include <stdlib.h>

int desc(const void *a, const void *b){
    return *(int *)b - *(int *)a;
}

int main(void){

    int N, ans=0;
    scanf("%d", &N);
    int card[N];
    for( int i=0; i<N; i++ ){
        scanf("%d", &card[i]);
    }

    qsort( card, N, sizeof(int), desc );
//    for( int i=0; i<N; i++ ){
//        printf("%d\n", card[i]);
//    }    
    
    for( int i=0; i<N; i++ ){
        if( i==0 || i%2==0 ){
            ans += card[i];
        }else{
            ans -= card[i];
        }
    }

    printf("%d", ans);

    return 0;
}

Measured memory_bytes: 128
#include <iostream>

using namespace std;

int main()
{  
    int a, b, c, d;
    cin >> a >> b >> c >> d;

    int step = 0;

    while(1)
    {
        if(a <= 0 || c <= 0)
        {
            break;
        }

        if(step % 2 == 0)
        {
            c -= b;
        }
        else
        {
            a -= d;
        }
        step++;
    }

    if(a > c)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
    return 0;   
}

Measured memory_bytes: 3576
#include <bits/stdc++.h>
const int Maxn = 1e5 + 1;
char c[ Maxn ];
int b;
int main( )
{
	std::cin >> c + 1;
	int len = strlen( c + 1 );
	int s = 0;
	for( int i = 1; i <= len; ++i )
	{
		if( c[ i ] == 'p' )
		{
			if( b > 0 )
				--b;
			else
				++b,
				s--;
		}
		else
		{
			if( b > 0 )
				s++,
				--b;
			else
				++b;
		}
	}
	std::cout << s;
	return 0;
}

Measured memory_bytes: 3716
use std::io::prelude::*;
use std::io;
use std::str::FromStr;
#[cfg(local)]
use std::fs::File;
#[cfg(local)]
use std::io::BufReader;

#[cfg(local)]
fn buf_read() -> io::Result<(Vec<String>)> {
    let f = try!(File::open("input.txt"));
    let input_lines: Vec<_> = BufReader::new(f).lines().collect();
    let lines: Vec<String> = input_lines.into_iter().map(|e| e.unwrap()).collect();
    Ok((lines))
}

#[cfg(not(local))]
fn buf_read() -> io::Result<(Vec<String>)> {
    let stdin = io::stdin();
    let input_lines: Vec<_> = stdin.lock().lines().collect();
    let lines: Vec<String> = input_lines.into_iter().map(|e| e.unwrap()).collect();
    Ok((lines))
}

fn main() {
    type Element = i32;
    let input = buf_read().unwrap();
    let mut input_vectors: Vec<Vec<Element>> = vec![];
    for input_line in input {
        let input_str: Vec<String> = input_line.split(' ').map(String::from).collect();
        let mut input_vector: Vec<Element> = vec![];
        for input_elem_str in input_str {
            let elem: Element = Element::from_str(input_elem_str.as_str()).unwrap();
            input_vector.push(elem);
        }
        input_vectors.push(input_vector);
    }

    let towns_slice = &input_vectors[1];
    let towns = input_vectors[1].iter().enumerate();
    let mut max_diff = 0;
    let mut min_cost = input_vectors[1][0].clone();
    let mut count = 0;
    for town in towns {
        // let cur_cost = town.1.clone();
        let cur_cost = town.1;
        match (cur_cost - min_cost) - max_diff {
            // match (town.1 - min_cost) - max_diff {
            0 => count += 1,
            n => {
                if n > 0 {
                    count = 1;
                    max_diff = cur_cost - min_cost;
                }
            }
        };
        if min_cost > *cur_cost {
            min_cost = *cur_cost;
        }
    }
    println!("{:?}", count);
}


Measured memory_bytes: 6524
#include<bits/stdc++.h>
#define int long long
#define pb emplace_back
#define mp make_pair
#define tci(v,i) for(auto i=v.begin();i!=v.end();i++)
#define all(v) v.begin(),v.end()
#define rep(i,start,lim) for(long long (i)=(start);i<(lim);i++)
#define revrep(i,n) for(long long i=n-1;i>=0;i--)
#define boost ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define osit ostream_iterator<int> output (cout," ")
#define pv(x) copy(all(x),output)
#define pa(a) rep(i,0,sizeof(a)/sizeof(a[0]))cout<<a[i]<<" "
#define endl '\n'
#define f first
#define s second
#define PI 3.141592653589793
#define test int t;cin>>t; while(t--)
#define set0(x) memset(x,0,sizeof(x))
#define set1(x) memset(x,1,sizeof(x))
#define getarr(arr,n) int arr[n];rep(i,0,n)cin>>a[i]
#define getvec(vec,n) vi vec;int x;rep(i,0,n){cin>>x;vec.pb(x);}
#define dg(x) cout<<#x<<':'<<x<<endl;
#define dg2(x,y) cout<<#x<<':'<<x<<' '<<#y<<':'<<y<<endl;
#define dg3(x,y,z) cout<<#x<<':'<<x<<' '<<#y<<':'<<y<<' '<<#z<<':'<<z<<endl;
#define dg4(x,y,z,zz) cout<<#x<<':'<<x<<' '<<#y<<':'<<y<<' '<<#z<<':'<<z<<' '<<#zz<<':'<<zz<<endl;
using namespace std;
typedef vector<int> vi;
typedef pair<int,int> ii;
typedef vector<ii> vii;
template<typename T> T gcd(T a,T b){if(a==0) return b; return gcd(b%a,a);}
vi b_v;void bin(unsigned int n) { if (n > 1) bin(n>>1); b_v.pb(n & 1); }
int isPowerof2(int x) { return (x && !(x & x-1)); }

int32_t main(){
    boost;osit;
    int n,k;
    cin>>n>>k;
    int a[n],dp[n];set0(dp);
    rep(i,0,n)cin>>a[i];
    dp[0]=0;
    rep(i,1,n){
        int &dum=dp[i];
        dum=1e18;
        for(int j=1;j<=k && i-j>=0;j++){
            dum=min(dum,dp[i-j]+abs(a[i]-a[i-j]));
        }
    }
    //pa(dp);cout<<endl;
    cout<<dp[n-1];
    return 0;
}

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

int main() {
  string s;
  cin >> s;
  int k = s.length();
  for (int i = 0; i + 1 < s.length(); i++) {
    if (s[i] != s[i+1]) {
      int ii = s.length() - i - 1;
      k = min(k, max(i + 1, ii));
    }
  }
  cout << k << endl;
  return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
typedef int64_t llong;
char moji[26]={'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'};
char moji2[26]={'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'};
char moji3[10]={'0','1','2','3','4','5','6','7','8','9'};
#define Sort(a) sort(a.begin(),a.end());
#define Reverse(a) reverse(a.begin(),a.end());
#define ld PRId64


int main(){
    int x,a,b;
    cin >> x >> a >> b;
    if( abs(x-a) < abs(x-b)) cout << 'A' << endl;
    else cout <<'B' << endl;
}


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

namespace abc0211
{
    class Program
    {
        static void Main(string[] args)
        {
            bool judge = false;
            string[] tmp = Console.ReadLine().Split(' ');
            int A_square = int.Parse(tmp[0]);
            int B_square = int.Parse(tmp[1]);

            string[] Astr = new string[A_square];
            string[] Bstr = new string[B_square];

            for(int i = 0;i<A_square;i++)
            {
                Astr[i] = Console.ReadLine();
            }
            for (int i = 0; i < B_square; i++)
            {
                Bstr[i] = Console.ReadLine();
            }

            // Bの1行目をBが入りきる範囲で探す
            for (int i = 0; i < A_square - B_square + 1; i++)
            {
                if (Astr[i].Contains(Bstr[0]) == true)
                {
                    if(B_square == 1)
                    {
                        Console.WriteLine("Yes");
                        return;
                    }
                    int start = Astr[i].IndexOf(Bstr[0]);
                    for(int j = 1;j<B_square;j++)
                    {
                        if (Astr[i+j].Substring(start,B_square) != Bstr[j])
                        {
                            judge = false;
                            break;
                        }
                        else
                        {
                            if(j == B_square -1)
                            {
                                judge = true;
                                Console.WriteLine("Yes");
                                return;
                            }
                        }
                    }

                }
            }
            if (judge) Console.WriteLine("Yes");
            else Console.WriteLine("No");
        }
    }
}


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

int factorial(int i){
	int ans=1;
	rep(j,i)ans*=j+1;
	return ans;
}
	int n;
int ans[40320][8];

int count(int* p){
  rep(i,factorial(n)){
    bool a=true;
    rep(j,n){
      const int value = ans[i][j];
      a=a&&p[j]==value;
        if(!a)break;
    }
    if(a)return i;
  }
}
int main(){
	cin>>n;
	int p[n],q[n];
	rep(i,n)cin>>p[i];
	rep(i,n)cin>>q[i];
	
	int index=1;
	rep(i,n)ans[0][i]=i+1;
	for(int i=1;i<factorial(n);i++){
      	rep(j,n){
          ans[i][j]=ans[i-1][j];
        }
      	bool is = false;
      	while(!is){
			ans[i][n-1]++;
			for(int j=n-1;j>-1;j--){
				if(ans[i][j]>n){
				ans[i][j]-=n;
					ans[i][j-1]+=1;
				}
			}
          	int count[n]={};
          	rep(j,n)count[ans[i][j]-1]++;
          	is =true;
          	rep(j,n)is = is&&count[j]==1;
        }
	}
  	int a=count(p),b=count(q);
  	cout << abs(a-b) << endl;
  	
}

Measured memory_bytes: 1536
using System;
using System.Collections.Generic;
using System.Linq;
using static Input;

public class Prog
{
    private const int INF = 1000000007;
    private const long INFINITY = 9223372036854775807;
    private struct Pair { public int x, y; public Pair(int xx, int yy) { x = xx; y = yy; } }
    private static int[] dx = { 1, 0, -1, 0 };
    private static int[] dy = { 0, -1, 0, 1 };
    public static void Main()
    {
        int N = NextInt();
        long[] A = LineLong();
        if (A.Contains(0))
        {
            long ans = 0;
            for (int i = 0; i < N; i++) ans += Math.Abs(A[i]);
            Console.WriteLine(ans);
            return;
        }
        long min = INF;
        for (int i = 0; i < N; i++) min = Math.Min(Math.Abs(A[i]), min);
        for (int i = 0; i < N - 1; i++)
        {
            if (A[i] < 0)
            {
                A[i] *= -1;
                A[i + 1] *= -1;
            }
        }
        long pt0 = A.Sum();
        long pt1 = A.Sum();
        if (A[N - 1] < 0 && min < Math.Abs(A[N - 1]))
        {
            //この場合はだめなので
            pt1 += Math.Abs(A[N - 1]) * 2;
            //これで元に戻す
            pt1 -= min * 2;
        }

        Console.WriteLine(Math.Max(pt0, pt1));
    }
}

public class Input
{
    private static Queue<string> q = new Queue<string>();
    private static void Confirm() { if (q.Count == 0) foreach (var s in Console.ReadLine().Split(' ')) q.Enqueue(s); }
    public static int NextInt() { Confirm(); return int.Parse(q.Dequeue()); }
    public static long NextLong() { Confirm(); return long.Parse(q.Dequeue()); }
    public static char NextChar() { Confirm(); return char.Parse(q.Dequeue()); }
    public static string NextString() { Confirm(); return q.Dequeue(); }
    public static double NextDouble() { Confirm(); return double.Parse(q.Dequeue()); }
    public static int[] LineInt() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); }
    public static long[] LineLong() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
    public static string[] LineString() { return Console.ReadLine().Split(' ').ToArray(); }
    public static double[] LineDouble() { return Console.ReadLine().Split(' ').Select(double.Parse).ToArray(); }
}


Measured memory_bytes: 31068
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define FORR(i, m, n) for(int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)

ll mod = 1e09;

ll lcm(ll a, ll b){
  ll tmp;
  if(a < b){
    tmp = a;
    a = b;
    b = tmp;
  }
  ll r = a % b, ta = a, tb = b;
  while(r != 0){
    a = b;
    b = r;
    r = a % b;
  }
  ll ans = (ta % b == 0) ? (ta / b) * tb : (tb / b) * ta;
  return ans;
}

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

  ll n;
  cin >> n;
  ll a[n], ans = 1;
  REP(i, n){
    cin >> a[i];
    if(a[i] > 5e17){
      cout << a[i];
      return 0;
    }
    ans = lcm(ans, a[i]);
  }
  cout << ans << endl;
  return 0;
}


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

using namespace std;
typedef long long ll;

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, a, b) for (int i = (a); i < (b); ++i)
#define all(a) (a).begin(), (a).end()
#define all2(a, b) (a).begin(), (a).begin() + (b)
#define debug(vari) cerr << #vari << " = " << (vari) << endl;

char *demangle(const char *demangle)
{
    int status;
    return abi::__cxa_demangle(demangle, 0, 0, &status);
}

int main()
{
    char a, b;
    cin >> a >> b;
    string A = "", B = "";
    rep(i, (b - '0'))
    {
        A += a;
    }
    rep(i, (a - '0'))
    {
        B += b;
    }

    if (A < B)
    {
        cout << A << endl;
    }
    else
    {
        cout << B << endl;
    }
    return 0;
}


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

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define bit(n) (1LL << (n))
#define sz(x) ((int)(x).size())
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define en '\n'
#define pb push_back
#define mp make_pair

typedef long long ll;
using namespace std;

ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { ll g = gcd(a, b); return a / g * b; }
const int dx[4] = { 1, 0, -1,  0 };
const int dy[4] = { 0, 1,  0, -1 };
const int INF = (int)1e9;
const ll  inf = (ll)1e18;
const int mod = 1000000007;

struct aaa {
	aaa() {
		cin.tie(0);
		ios::sync_with_stdio(0);
		cout << fixed << setprecision(20);
	};
}aaaaa;


int main() {
	int n;
	ll h, w;
	cin >> n >> h >> w;
	vector<ll> a(n), b(n);
	rep(i, n) cin >> a[i] >> b[i];

	ll sum = 0LL;

	rep(i, n) {
		ll s = a[i] / h;
		ll t = b[i] / w;
		sum += min(s, t);
	}

	cout << sum << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<math.h>
using namespace std;

int main( )
{
        double r,area,circum;

        cin>>r;
        area=M_PI*pow(r,2);
        circum=2*M_PI*r;

         printf("%.7lf %.7lf",area,circum);

        return 0;
}



Measured memory_bytes: 3200
#include "bits/stdc++.h"
#define ALL(x) x.begin(), x.end()
#define LEN(x) (int)x.size()
#define iostreamBooster() do{ cin.tie(nullptr); ios_base::sync_with_stdio(false); }while(0)
using namespace std;
typedef int64_t i64;
typedef pair<int,int> pii;
template<class A, class B>inline bool chmax(A &a, const B &b){return b>a ? a=b,1 : 0;}
template<class A, class B>inline bool chmin(A &a, const B &b){return b<a ? a=b,1 : 0;}
constexpr int INF = 0x3f3f3f3f;

signed main()
{
  char s[105];
  cin >> s;
  int len = strlen(s);
  printf("%c%d%c\n", *s, len-2, s[len-1]);

  return 0;
}



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

SP = []

for i in range(N) :
    S, P = input().split()
    SP.append([i, S, int(P)])

SP.sort(key=lambda x: x[2], reverse=True)
SP.sort(key=lambda x: x[1])

for i in SP :
    print(i[0] + 1)

Measured memory_bytes: 38384
#include<stdio.h>
int main(void){
	int a,b,c,i,count=0;
	
	scanf("%d %d %d",&a,&b,&c);
	for(i=a;i<=b;i++){
		if(c%i==0){
			count++;
		}
	}
	printf("%d\n",count);
	return 0;
}

Measured memory_bytes: 596
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0; i<(int)(n); i++)
#define all(vec) vec.begin(),vec.end()
#define MOD 1000000007
#define int long long

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


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

int abs(int x, int y) {
  if (x < y) {
    return y-x;
  }
  else{
    return x-y;
  }
}
int main(){
  int N;
  cin >>N;
  vector<int> wei(N);
  for(int i =0;i<N; i++){
    cin >> wei.at(i);
  }
  int res =100000;
  for(int T =0; T<N-1;T++){
    int S_1 =0;
    int S_2 =0;
    for(int j=0;j<N;j++){
      if( j <= T){
        S_1 += wei.at(j);        
      }
      else{
        S_2 += wei.at(j);
      }
    }
    if(abs(S_1,S_2)<=res){
      res =abs(S_1,S_2);
    }
  }
  cout << res <<endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define REP(i,n) for(int (i)=0;(i)<=(int)(n);(i)++)
#define rep1(i,x,n) for(int (i)=(x);(i)<(int)(n);(i)++)
#define REP1(i,x,n) for(int (i)=(x);(i)<=(int)(n);(i)++)
#define rrep(i,x) for(int i=((int)(x)-1);i>=0;i--)
using namespace std;
using ll = long long;
using ull = unsigned long long;
using Int = long long;
 
//INT_MAX = 2147483647;
//LLONG_MAX = 9223372036854775807;
//ULLONG_MAX = 18446744073709551615;
const int MOD = 1000000007;
const ll INF = numeric_limits<ll>::max();
const int inf = 1e8;
typedef pair<int,int> P;
typedef std::priority_queue<int> IntPrioQueue;
typedef std::priority_queue<int, std::vector<int>, std::greater<int> > IntReversePrioQueue;
 
//少数点表示
//cout << std::fixed << std::setprecision(14) << 値
 
int main(){
    cin.tie( 0 ); ios::sync_with_stdio( false );

        int n;
        cin >> n;
        vector<ll> a(n);
        rep(i,n) cin >> a[i];
        ll ans = 0;
        rep1(i,1,n){
            if(a[i]<a[i-1]){
                ans += a[i-1]-a[i];
                a[i]=a[i-1];
            }
        }
        cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 4760
#include<bits/stdc++.h>
using namespace std;
const int MAXN = 1e5+69;
int a[MAXN];
int n,m;
signed main(){
    cin>>n>>m;
    for(int i=1;i<=n;i++)cin>>a[i];
    sort(a+1,a+n+1);
    int ans = 0;
    for(int i=1;i<=m;i++)ans+=a[i];
    cout<<ans;
}


Measured memory_bytes: 3644
#include<iostream>

using namespace std;

void print(int num[],int size){
  for(int i=0;i<size;i++){
    if(i)cout<<" ";
    cout<<num[i];
  }
  return;
}

int main(){
  int num[10000]={};
  int count=0;
  int ncnt=0;
  cin>>ncnt;
  for(int i=0;i<ncnt;i++){
    cin>>num[i];
  }

  int pnum[10000]={2};
  int pcnt=1;
  for(int i=3;i<10000;i+=2){
    bool flag=true;
    for(int j=0;j<pcnt;j++){
      if(!(i%pnum[j]))flag=false;
    }
    if(flag){
      pnum[pcnt]=i;
      pcnt++;
    }
  }

  for(int i=0;i<ncnt;i++){
    bool flag=true;
    for(int j=0;j<pcnt&&(num[i]>pnum[j]);j++){
      if(!(num[i]%pnum[j])){
        flag=false;
        break;
      }
    }
    if(flag) count++;
  }
  cout<<count<<endl;
  return 0;
}



Measured memory_bytes: 3176
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <vector>
using namespace std;
typedef long long ll;
ll const INF = 1LL << 60;

int main() {
  ll N, K;
  cin >> N >> K;
  ll ans = 0;
  for (int b = 1; b <= N; b++) {
    ans += max(0LL, b - K) * (N / b) + max(0LL, N % b - K + 1);
  }
  if (K == 0) ans = N * N;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3636
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        String T = sc.next();
        int A = sc.nextInt();
        int B = sc.nextInt();
        String U = sc.next();
        
        if(U.equals(S)){
            System.out.println(A-1 + " " + B);
        } else {
            System.out.println(A + " " + (B-1));
        }
    }
}


Measured memory_bytes: 38736
// https://abc102.contest.atcoder.jp/tasks/abc102_b

// 配列を降順でソートする
function descSort(arr) {
  return arr.sort((a, b) => b - a)
}

function f(arr) {
  const sortedArr = descSort(arr)
  return sortedArr[0] - sortedArr[sortedArr.length - 1]
}

module.exports = {
  f,
}

function Main(input) {
  const lines = input.split("\n")
  // const n = parseInt(lines[0], 10)
  const arr = lines[1].split(" ").map((item) => parseInt(item, 10))

  console.log(f(arr))
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"))


Measured memory_bytes: 7500
k = int(input())

sum = 0

def gcd(a, b):
    if b == 0:
        return a
    
    return gcd(b, a % b)


for a in range(1, k + 1):
    for b in range(1, k + 1):
        ab_gcd = gcd(a, b)
        for c in range(1, k + 1):
            abc_gcd = gcd(c, ab_gcd)
            sum += abc_gcd
        
print(sum)


Measured memory_bytes: 78720
#include<bits/stdc++.h>
using namespace std;
const int N=2e5+10;
int a[N];
int pre[N],suf[N];
int main()
{
    memset(pre,0,sizeof(pre));
    memset(suf,0,sizeof(suf));
    int n;
    scanf("%d",&n);
    for(int i=1;i<=n;i++) scanf("%d",&a[i]);
    for(int i=1;i<=n;i++)
        pre[i]=max(pre[i-1],a[i]);
    for(int i=n;i>=1;i--)
        suf[i]=max(suf[i+1],a[i]);
        for(int i=1;i<=n;i++)
            printf("%d\n",max(pre[i-1],suf[i+1]));
}


Measured memory_bytes: 3968
#include <iostream>
#include <vector>
#include <boost/multiprecision/cpp_int.hpp>
#define rep0(i, n) for(int i=0; i<(int)(n);i++)
typedef int64_t lint;
using namespace std;

int main(){
    lint n, k;
    cin >> n >> k;
    vector<lint> a(n);
    rep0(i, n){
        cin >> a[i];
    }
    lint kk = k * (k - 1) / 2;
    boost::multiprecision::cpp_int ans = 0;
    for (int i = 0; i < n; ++i) {
        lint left = 0;
        lint right = 0;
        for (int j = 0; j < n; ++j) {
            if(a[i] > a[j]){
                if(i > j)left ++ ;
                if(i < j)right ++ ;
            }
        }
        for(int j = 0 ; j < left ; j++)
        {
            ans += kk;
        }
        //ans += kk * left;

        rep0(j,right)
        {
            ans += kk;
            ans += k;
        }
        ans %= 1000000007;
    }
    cout << ans << endl;
}

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

#define all(x) x.begin(), x.end()
#define int long long
#define ll long long
#define ins insert
#define pb push_back
#define ppb pop_back
#define pf push_front
#define ppf pop_front
#define ff first
#define ss second
#define ld long double
#define rsz resize
#define pii pair<int, int>

using namespace std;

mt19937 rnd(time(nullptr));

const long long INF = 1e18;

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n, M, v, p;
    cin >> n >> M >> v >> p;
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    sort(all(a));
    vector<int> pref(n);
    pref[0] = a[0];
    for (int i = 1; i < n; i++) {
        pref[i] = pref[i - 1] + a[i];
    }
    int ans = 0;
    for (int i = 0; i < n; i++) {
        int x = a[i] + M, b = i;
        auto it = upper_bound(all(a), x) - 1, it2 = upper_bound(all(a), a[i]) - 1;
        i = it2 - a.begin();
        int j = it - a.begin(), sum = (v - 1) * M - i * M - (n - j - 1) * M;
        int l = -1, r = (j - i);
        while (r - l > 1) {
            int m = (l + r) / 2;
            int new_sum = sum - m * M, id = j - m;
            new_sum -= x * (id - i) - (pref[id] - pref[i]);
            if (new_sum <= 0) {
                r = m;
            } else {
                l = m;
            }
        }
        int new_i = n - (j - r);
        if (new_i <= p) {
            //cout << b << "\n";
            ans++;
        }
        i = b;
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
namespace ZDY{
    #pragma GCC optimize(3)
    #define il __inline__ __attribute__ ((always_inline))
    #define rg register
    #define ll long long
    #define ull unsigned long long
    #define db double
    #define sht short
    #define MB template <class T>il
    #define Fur(i,x,y) for(int i=x;i<=y;++i)
    #define Fdr(i,x,y) for(int i=x;i>=y;--i)
    #define fl(i,x) for(int i=head[x],to;to=e[i].to,i;i=e[i].nxt)
    #define clr(x,y) memset(x,y,sizeof(x))
    #define cpy(x,y) memcpy(x,y,sizeof(x))
    #define fin(s) freopen(s".in","r",stdin)
    #define fout(s) freopen(s".out","w",stdout)
    #define fcin ios::sync_with_stdio(false)
    #define l2(n) (int(log2(n)))
    #define inf 0x3f3f3f3f
    MB T ABS(T x){return x>0?x:-x;}
    MB T MAX(T x,T y){return x>y?x:y;}
    MB T MIN(T x,T y){return x<y?x:y;}
    MB T GCD(T x,T y){return y?GCD(y,x%y):x;}
    MB void SWAP(T &x,T &y){T t=x;x=y;y=t;}
}using namespace ZDY;using namespace std;
namespace IO{const char* ln="\n";const int str=1<<20;struct IN{char buf[str],*s,*t;bool _;IN():s(buf),t(buf),_(0){}il char gc(){return s==t&&((t=(s=buf)+fread(buf,1,str,stdin))==s)?EOF:(*s++);}IN&operator>>(char&ch){if(_)return *this;char c;while((c=gc())!=EOF&&isspace(c));if(c==EOF)_=1;else ch=c;return *this;}IN& operator>>(char* ch){clr(ch,0);if(_)return *this;char c;while((c=gc())!=EOF&&isspace(c));if(c==EOF)return _=1,*this;*ch=c;ch++;while((c=gc())!=EOF&&!isspace(c))*ch=c,ch++;if(c==EOF)_=1;return *this;}IN& operator>>(string& ch){if(_)return *this;char c;while((c=gc())!=EOF&&isspace(c));if(c==EOF)return _=1,*this;ch+=c;while((c=gc())!=EOF&&!isspace(c))ch+=c;if(c==EOF)_=1;return *this;}template<typename T>IN&operator>>(T&x){if(_)return *this;char c=gc();bool ff=0;while(c!=EOF&&(c<'0'||c>'9'))ff^=(c=='-'),c=gc();if(c==EOF){_=1;return *this;}x=0;while(c!=EOF&&'0'<=c&&c<='9')x=(x<<3)+(x<<1)+c-48,c=gc();if(c==EOF)_=1;if(ff)x=-x;return *this;}}in;struct OUT{char buf[str],*s,*t;OUT():s(buf),t(buf+str){}~OUT(){fwrite(buf,1,s-buf,stdout);}void pt(char c){(s==t)?(fwrite(s=buf,1,str,stdout),*s++=c):(*s++=c);}OUT&operator<<(const char*s){while(*s)pt(*s++);return *this;}OUT&operator<<(char*s){while(*s)pt(*s++);return *this;}OUT&operator<<(string s){for(int i=0;s[i];i++)pt(s[i]);return *this;}template<typename T>OUT&operator<<(T x){if(!x)return pt('0'),*this;if(x<0)pt('-'),x=-x;char a[30],t=0;while(x)a[t++]=x%10,x/=10;while(t--)pt(a[t]+'0');return *this;}}out;}using namespace IO;
#define N 100011
int n;
struct node{
    int x,id;
}a[N];
bool cmp(node x,node y){
    return x.x<y.x;
}
int main(){
    in>>n;
    Fur(i,1,n)in>>a[i].x,a[i].id=i;
    sort(a+1,a+n+1,cmp);
    Fur(i,1,n)out<<a[i].id<<" ";out<<ln;
}

Measured memory_bytes: 2816
#include <bits/stdc++.h>
#include <random>
using namespace std;
 
#define rep(i, N) for (int i = 0; i < N; i++)
#define pb push_back
 
typedef long long ll;
typedef pair<int, int> i_i;
typedef pair<double, int> d_i;
 
int main() {
	random_device rd;
	mt19937 mt(rd());
	int N, M; cin >> N >> M;
	vector<string> a(N);
	rep(i, N) cin >> a[i];
	rep(t, 100000) {
		vector<vector<bool>> b(M, vector<bool>(M, true));
		rep(j1, M) for (int j2 = j1; j2 < M; j2++)
			rep(i, N) if (a[i][j1] != a[N - 1 - i][j2]) b[j1][j2] = false;
		vector<bool> dp(1<<M);
		dp[0] = true;
		rep(S, 1<<M) if (dp[S])
			rep(j1, M) for (int j2 = j1 + 1; j2 < M; j2++)
				if (!(S>>j1 & 1) && !(S>>j2 & 1) && b[j1][j2])
					dp[S | 1<<j1 | 1<<j2] = true;
		bool ok = false;
		if (M % 2 == 0) ok = dp.back();
		else {
			rep(j, M) if (dp[(1<<M) - 1 - (1<<j)] && b[j][j]) ok = true;
		}
		if (ok) {
			cout << "YES" << endl;
			return 0;
		}
		shuffle(a.begin(),a.end(),mt);
	}
	cout << "NO" << endl;
}


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

int main() {
    int n, p[15], sum = 0;
    cin >> n;
    for (int i = 0; i < n; i++) cin >> p[i];
    sort(p, p + n);

    for (int i = 0; i < n - 1; i++) {
        sum += p[i];
    }
    sum += p[n - 1] / 2;

    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    int x;
    int c = 1;
    while(true){
        cin >> x;
        if(x == 0){
            break;
        }
        cout << "Case " << c << ": "<< x << endl;
        c = c + 1; 
    
    }
}



Measured memory_bytes: 2976
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream> 
#include<map>
#include <iomanip>
#include <time.h>
#include <random>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
using namespace std;
#define LONG_INF 10000000000000000
#define MAX_MOD 1000000007
#define REP(i,n) for(long long i = 0;i < n;++i)
int main() {
	int a, b;
	cin >> a >> b;
	int ans = (a + b)%24;
	cout << ans << endl;
}

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

int main(){
  string a, b, c;
  cin >> a >> b >> c;

  if(a.at(a.size()-1)==b.at(0) && b.at(b.size()-1)==c.at(0)) cout << "YES" << endl;
  else cout << "NO" << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <math.h>
#include <cstring>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <unordered_map>
#include <set>
#include <utility>
#include <iomanip>
#include <climits>
#include <map>
using namespace std;
#define ll long long
#define MOD 1000000007
#define INF 1000000000000000000
#define ln "\n"
#define pb push_back
#define pll pair<ll,ll>
#define vll vector<ll>
#define sll stack<ll>
#define qll queue<ll>
#define mp make_pair
#define f first
#define s second
#define bs binary_search
#define lb lower_bound
#define ub upper_bound
#define Test ll t;cin>>t; while(t--)
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL);
int main() 
{ 
    fast_io;
    ll n,x,sum=0;
    cin>>n;
    x=n/500;
    sum+=(x*1000);
    n-=x*500;
    x=n/5;
    sum+=(x*5);
    cout<<sum<<endl;
    return 0;
} 

Measured memory_bytes: 256
//Author ::  ABHINAV3010 ::

#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define fast ios_base::sync_with_stdio(false)
typedef long long ll;
typedef pair<ll,ll> p;
ll mod=1000000007;
ll gcd(ll a,ll b)
{
    return (b==0)?a:gcd(b,a%b);
}
ll power(ll x, ll y, ll p=mod)
{ll res = 1;x = x % p;while (y > 0){if (y & 1){res = (res*x) % p;}y = y>>1;x = (x*x) % p;}return res;}
ll fun(ll n,vector<ll>&v,ll k,ll i,ll j,bool allow,vector< vector< vector<ll> > > &dp)
{
    if(i==n&&j==k)
    {
        return 1;
    }

    if(i==n)
    {
        return 0;
    }
    if(j>k)
    {
        return 0;
    }
    //cout<<i<<" "<<j<<" "<<allow<<endl;
    if(dp[i][j][allow]!=-1)
    {
        return dp[i][j][allow];
    }
    ll ans=0;

    if(allow==true)
    {
        for(ll x=0;x<=v[i];x++)
        {
            if(x==v[i])
            {
                if(v[i]!=0)
                {

                ans+=fun(n,v,k,i+1,j+1,true,dp);
                }else
                {
                    ans+=fun(n,v,k,i+1,j,true,dp);
                }

            }else if(x==0)
            {
                 ans+=fun(n,v,k,i+1,j,false,dp);
            }else
            {
                ans+=fun(n,v,k,i+1,j+1,false,dp);
            }
        }
    }else
    {
        for(ll x=0;x<=9;x++)
        {
            if(x==0)
            {
                ans+=fun(n,v,k,i+1,j,false,dp);
            }else
            {
                ans+=fun(n,v,k,i+1,j+1,false,dp);
            }
        }
    }
    //cout<<i<<" "<<j<<" "<<ans<<endl;
    return dp[i][j][allow]=ans;
}
int main()
{
fast;
string s;
cin>>s;
ll k;
cin>>k;
vector<ll>v;
for(ll i=0;i<s.size();i++)
{
    v.pb(s[i]-48);
}
ll n=s.size();
vector< vector< vector<ll> > > dp(n+1,vector< vector<ll> >(k+1,vector< ll>(3,-1)));
ll ans=fun(n,v,k,0,0,true,dp);
cout<<ans<<endl;
return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <string>
#include <unordered_map>
using namespace std;


int main(){
    int n, k;
    cin >> n >> k;
    string s;
    cin >> s;
    int c = 0;
    for (int i = 1; i < n; i++){
        if (s[i] != s[i - 1]){
            c++;
        }
    }
    c = max(0, c - k * 2);
    cout << n - 1 - c << endl;
    return 0;
}

Measured memory_bytes: 512
#include <stdio.h>

int main(void) {
	long a, b, i, c=0;
	scanf("%ld%ld", &a, &b);
	if( a <= 0 && b >= 0 ) {
		printf("Zero");
	}else if(a>0 && b>0){
		printf("Positive");
	}else if((b-a)%2 == 0){
		printf("Negative");
	}else{
		printf("Positive");
	}
	return 0;
}


Measured memory_bytes: 128
A=[0]*(10**4+1)
for i in range(1,101):
    for j in range(1,101):
        for k in range(1,101):
            a=i**2+j**2+k**2+i*j+j*k+k*i
            if a<=10**4:
                A[a]+=1
n=int(input())
for i in range(n):
    print(A[i+1])

Measured memory_bytes: 9156
#define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
#include <map>

using namespace std;

int ratemax = 0;
map<int, int> m;

void check(int tmp)
{
    if (1 <= tmp && tmp <= 399) m[0]++;
    else if (400 <= tmp && tmp <= 799) m[1]++;
    else if (800 <= tmp && tmp <= 1199) m[2]++;
    else if (1200 <= tmp && tmp <= 1599) m[3]++;
    else if (1600 <= tmp && tmp <= 1999) m[4]++;
    else if (2000 <= tmp && tmp <= 2399) m[5]++;
    else if (2400 <= tmp && tmp <= 2799) m[6]++;
    else if (2800 <= tmp && tmp <= 3199) m[7]++;
    else ratemax++;
    return;
}

int main()
{
    int N;
    if (scanf("%d", &N) < 1) return 0;

    int tmp;
    for (int i = 0; i < N; i++)
    {
        if (scanf("%d", &tmp) < 1) return 0;
        check(tmp);
    }

    int num = m.size();
    printf("%d %d\n", num ? num : 1, num + ratemax);
    return 0;
}


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

int main() {
  int a, b, c, d;
  cin >> a;
  d = a % 10;
  a /= 10;
  c = a % 10;
  a /= 10;
  b = a % 10;
  a /= 10;

  if (a + b + c + d == 7)
    cout << a << "+" << b << "+" << c << "+" << d << "=7";
  else if (a + b + c - d == 7)
    cout << a << "+" << b << "+" << c << "-" << d << "=7";
  else if (a + b - c + d == 7)
    cout << a << "+" << b << "-" << c << "+" << d << "=7";
  else if (a + b - c - d == 7)
    cout << a << "+" << b << "-" << c << "-" << d << "=7";
  else if (a - b - c - d == 7)
    cout << a << "-" << b << "-" << c << "-" << d << "=7";
  else if (a - b - c + d == 7)
    cout << a << "-" << b << "-" << c << "+" << d << "=7";
  else if (a - b + c - d == 7)
    cout << a << "-" << b << "+" << c << "-" << d << "=7";
  else if (a - b + c + d == 7)
    cout << a << "-" << b << "+" << c << "+" << d << "=7";
    
  return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#pragma comment(linker, "/stack:256000000")
#include<utility>
#include<iostream>
#include<vector>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<ctime>
#include<functional>
#include<random>
#include<climits>
#include<queue>
#include<stack>
#include<deque>
#include<bitset>
#include<map>
#include<set>
#include<unordered_map>
#include<unordered_set>
#include<cassert>
#include<ccomplex>

//4Head
#define all(x) x.begin(), x.end()
#define mp make_pair
#define X first
#define Y second

using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
mt19937_64 gen(time(NULL));

// belik's shit
ll const mod = 1e9 + 7;
namespace {
	ll mult(ll& a, ll& b) {
		ll val = a * b - (ll)((ld)a * b / mod) * mod;
		if (val < 0) {
			val += mod;
		}
		if (val >= mod) {
			val -= mod;
		}
		return val;
	}
	ll poww(ll a, ll b)
	{
		ll val = 1;
		a %= mod;
		while (b > 0){
			if (b % 2) val = mult(a, val);
			a = mult(a, a);
			b >>= 1;
		}
		return val % mod;
	}
	ll inv(ll a) {
		return poww(a, mod - 2);
	}
}

ll const maxn = 3e5 + 5;
ll dp[105][maxn];
signed main() {
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	ll n; cin >> n; ll W; cin >> W;
	vector<ll>w(n + 1), v(n + 1);
	for (ll i = 1; i <= n; i++) {
		cin >> w[i] >> v[i];
	}
	for (ll i = 0; i < n; i++) {
		for(ll wei = 0; wei <= W; wei++) {
			if (wei + w[i + 1] <= W)
				dp[i + 1][wei + w[i + 1]] = max(dp[i + 1][wei + w[i + 1]], dp[i][wei] + v[i + 1]);
			dp[i + 1][wei] = max(dp[i + 1][wei], dp[i][wei]);
		}
	}
	cout << *max_element(dp[n], dp[n] + maxn) << endl;
	return 0;
}
/*

*/

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

int main() {
	int N;
	cin >> N;
	vector<int>T(N);
	int sum = 0;
	for (int i = 0; i < N; ++i) {
		cin >> T[i];
		sum += T[i];
	}
	int M;
	cin >> M;
	for (int i = 0; i < M; ++i) {
		int p, x;
		cin >> p >> x;
		cout << sum - T[p - 1] + x << endl;
	}
	return 0;
}

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

int main() {
  int N,L;
  cin >> N >> L;
  vector<string> s(N);
  for (int i = 0; i < N; i++) {
    cin >> s[i];
  }
  sort(s.begin(),s.end());
  for (int i = 0; i < N; i++) {
    cout << s[i];
  }
  cout << endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String w = sc.next();
    int[] count = new int[26];
    for (int i = 0; i < w.length(); i++) {
      count[w.charAt(i) - 'a']++;
    }
    for (int i = 0; i < 26; i++) {
      if (count[i] % 2 != 0) {
        System.out.println("No");
        return;
      }
    }
    System.out.println("Yes");
  }
}

Measured memory_bytes: 21332
#include<stdio.h>
#include<string.h>
int main(){

	int N,T;		
	int i;
	int j=0;
	int Start[20][2];
	int End[20][2];
	char st[20][60];
	char en[20][60];
	int outint[20];
	char outchar[20][60];
	int tp1,tp2,tp3;
	int count=0;
	
	scanf("%d %d",&N,&T);
	for(i=0;i<N;i++){
		scanf("%d:%d",&Start[i][0],&Start[i][1]);
		scanf("%s",st[i]);
		scanf("%d:%d",&End[i][0],&End[i][1]);
		scanf("%s",en[i]);
	}
	for(i=0;i<N-1;i++){
		tp1=60*Start[i+1][0]+Start[i+1][1];
		tp2=60*End[i][0]+End[i][1];
		tp3=tp1-tp2;
		if(tp3>=T){
			count++;
			outint[j]=tp3;
			strcpy(outchar[j],en[i]);
			j++;
		}
	}
	
	
	printf("%d\n",count);
	for(i=0;i<count;i++){
		printf("%s %d\n",outchar[i],outint[i]);
	}
	
	return 0;
}

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

void solve()
{
    int n; cin >> n;
    vector<int> v(n);
    for (int i = 0; i < n; ++i) {
        cin >> v[i];
    }
    ll ans = 0, ss = v.front(), mod = 1e9+7;
    for (int i = 1; i < n; ++i) {
        ll prod = v[i] * ss;
        if (prod > mod) prod %= mod;
        ans += prod;
        if (ans > mod) ans %= mod;
        ss += v[i];
        if (ss > mod) ss %= mod;
    }
    cout << ans << '\n';
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    solve();
    return 0;
}

Measured memory_bytes: 3960
import java.util.Arrays;
import java.util.LinkedList;
import java.util.Scanner;

public class Main {
    public static void main(String args[]) {
        try (Scanner in = new Scanner(System.in)) {
            int n = in.nextInt();

            int[] a = new int[n];
            for (int i = 0; i < a.length; i++) {
                a[i] = in.nextInt();
            }

            LinkedList<Integer> queue = new LinkedList<>();
            boolean isReverse = !true;

            for (int i = 0; i < a.length; i++) {
                if (!isReverse) {
                    queue.addLast(a[i]);
                } else {
                    queue.addFirst(a[i]);
                }

                isReverse = !isReverse;
            }

            StringBuilder sb = new StringBuilder();
            for (; !queue.isEmpty();) {
                if (!isReverse) {
                    sb.append(queue.pollFirst() + " ");
                } else {
                    sb.append(queue.pollLast() + " ");
                }
            }
            System.out.println(sb.toString().trim());

        }
    }

}

final class Utils {
    private Utils() {
    }

    public static final void debug(Object... o) {
        System.err.println(toString(o));
    }

    public static final String toString(Object... o) {
        return Arrays.deepToString(o);
    }

}


Measured memory_bytes: 100384